亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? os_task.c

?? uCos_II到ARM7的移植
?? C
?? 第 1 頁 / 共 4 頁
字號:
*********************************************************************************************************
*                                             STACK CHECKING
*
* Description: This function is called to check the amount of free memory left on the specified task's
*              stack.
*
* Arguments  : prio          is the task priority
*
*              p_stk_data    is a pointer to a data structure of type OS_STK_DATA.
*
* Returns    : OS_NO_ERR           upon success
*              OS_PRIO_INVALID     if the priority you specify is higher that the maximum allowed
*                                  (i.e. > OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF.
*              OS_TASK_NOT_EXIST   if the desired task has not been created or is assigned to a Mutex PIP
*              OS_TASK_OPT_ERR     if you did NOT specified OS_TASK_OPT_STK_CHK when the task was created
*              OS_ERR_PDATA_NULL   if 'p_stk_data' is a NULL pointer
*********************************************************************************************************
*/
#if OS_TASK_CREATE_EXT_EN > 0
INT8U  OSTaskStkChk (INT8U prio, OS_STK_DATA *p_stk_data)
{
    OS_TCB    *ptcb;
    OS_STK    *pchk;
    INT32U     free;
    INT32U     size;
#if OS_CRITICAL_METHOD == 3                            /* Allocate storage for CPU status register     */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (prio > OS_LOWEST_PRIO) {                       /* Make sure task priority is valid             */
        if (prio != OS_PRIO_SELF) {
            return (OS_PRIO_INVALID);
        }
    }
    if (p_stk_data == (OS_STK_DATA *)0) {              /* Validate 'p_stk_data'                        */
        return (OS_ERR_PDATA_NULL);
    }
#endif
    p_stk_data->OSFree = 0;                            /* Assume failure, set to 0 size                */
    p_stk_data->OSUsed = 0;
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                        /* See if check for SELF                        */
        prio = OSTCBCur->OSTCBPrio;
    }
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                         /* Make sure task exist                         */
        OS_EXIT_CRITICAL();
        return (OS_TASK_NOT_EXIST);
    }
    if (ptcb == (OS_TCB *)1) {
        OS_EXIT_CRITICAL();
        return (OS_TASK_NOT_EXIST);
    }
    if ((ptcb->OSTCBOpt & OS_TASK_OPT_STK_CHK) == 0) { /* Make sure stack checking option is set       */
        OS_EXIT_CRITICAL();
        return (OS_TASK_OPT_ERR);
    }
    free = 0;
    size = ptcb->OSTCBStkSize;
    pchk = ptcb->OSTCBStkBottom;
    OS_EXIT_CRITICAL();
#if OS_STK_GROWTH == 1
    while (*pchk++ == (OS_STK)0) {                    /* Compute the number of zero entries on the stk */
        free++;
    }
#else
    while (*pchk-- == (OS_STK)0) {
        free++;
    }
#endif
    p_stk_data->OSFree = free * sizeof(OS_STK);           /* Compute number of free bytes on the stack */
    p_stk_data->OSUsed = (size - free) * sizeof(OS_STK);  /* Compute number of bytes used on the stack */
    return (OS_NO_ERR);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                            SUSPEND A TASK
*
* Description: This function is called to suspend a task.  The task can be the calling task if the
*              priority passed to OSTaskSuspend() is the priority of the calling task or OS_PRIO_SELF.
*
* Arguments  : prio     is the priority of the task to suspend.  If you specify OS_PRIO_SELF, the
*                       calling task will suspend itself and rescheduling will occur.
*
* Returns    : OS_NO_ERR                if the requested task is suspended
*              OS_TASK_SUSPEND_IDLE     if you attempted to suspend the idle task which is not allowed.
*              OS_PRIO_INVALID          if the priority you specify is higher that the maximum allowed
*                                       (i.e. >= OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF.
*              OS_TASK_SUSPEND_PRIO     if the task to suspend does not exist
*              OS_TASK_NOT_EXITS        if the task is assigned to a Mutex PIP
*
* Note       : You should use this function with great care.  If you suspend a task that is waiting for
*              an event (i.e. a message, a semaphore, a queue ...) you will prevent this task from
*              running when the event arrives.
*********************************************************************************************************
*/

#if OS_TASK_SUSPEND_EN > 0
INT8U  OSTaskSuspend (INT8U prio)
{
    BOOLEAN    self;
    OS_TCB    *ptcb;
    INT8U      y;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (prio == OS_TASK_IDLE_PRIO) {                            /* Not allowed to suspend idle task    */
        return (OS_TASK_SUSPEND_IDLE);
    }
    if (prio >= OS_LOWEST_PRIO) {                               /* Task priority valid ?               */
        if (prio != OS_PRIO_SELF) {
            return (OS_PRIO_INVALID);
        }
    }
#endif
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                                 /* See if suspend SELF                 */
        prio = OSTCBCur->OSTCBPrio;
        self = OS_TRUE;
    } else if (prio == OSTCBCur->OSTCBPrio) {                   /* See if suspending self              */
        self = OS_TRUE;
    } else {
        self = OS_FALSE;                                        /* No suspending another task          */
    }
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                                  /* Task to suspend must exist          */
        OS_EXIT_CRITICAL();
        return (OS_TASK_SUSPEND_PRIO);
    }
    if (ptcb == (OS_TCB *)1) {                                  /* See if assigned to Mutex            */
        OS_EXIT_CRITICAL();
        return (OS_TASK_NOT_EXIST);
    }
    y            = ptcb->OSTCBY;
    OSRdyTbl[y] &= ~ptcb->OSTCBBitX;                            /* Make task not ready                 */
    if (OSRdyTbl[y] == 0) {
        OSRdyGrp &= ~ptcb->OSTCBBitY;
    }
    ptcb->OSTCBStat |= OS_STAT_SUSPEND;                         /* Status of task is 'SUSPENDED'       */
    OS_EXIT_CRITICAL();
    if (self == OS_TRUE) {                                      /* Context switch only if SELF         */
        OS_Sched();
    }
    return (OS_NO_ERR);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                            QUERY A TASK
*
* Description: This function is called to obtain a copy of the desired task's TCB.
*
* Arguments  : prio         is the priority of the task to obtain information from.
*
*              p_task_data  is a pointer to where the desired task's OS_TCB will be stored.
*
* Returns    : OS_NO_ERR          if the requested task is suspended
*              OS_PRIO_INVALID    if the priority you specify is higher that the maximum allowed
*                                 (i.e. > OS_LOWEST_PRIO) or, you have not specified OS_PRIO_SELF.
*              OS_PRIO_ERR        if the desired task has not been created
*              OS_TASK_NOT_EXIST  if the task is assigned to a Mutex PIP
*              OS_ERR_PDATA_NULL  if 'p_task_data' is a NULL pointer
*********************************************************************************************************
*/

#if OS_TASK_QUERY_EN > 0
INT8U  OSTaskQuery (INT8U prio, OS_TCB *p_task_data)
{
    OS_TCB    *ptcb;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (prio > OS_LOWEST_PRIO) {                 /* Task priority valid ?                              */
        if (prio != OS_PRIO_SELF) {
            return (OS_PRIO_INVALID);
        }
    }
    if (p_task_data == (OS_TCB *)0) {            /* Validate 'p_task_data'                             */
        return (OS_ERR_PDATA_NULL);
    }
#endif
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                  /* See if suspend SELF                                */
        prio = OSTCBCur->OSTCBPrio;
    }
    ptcb = OSTCBPrioTbl[prio];
    if (ptcb == (OS_TCB *)0) {                   /* Task to query must exist                           */
        OS_EXIT_CRITICAL();
        return (OS_PRIO_ERR);
    }
    if (ptcb == (OS_TCB *)1) {                   /* Task to query must not be assigned to a Mutex      */
        OS_EXIT_CRITICAL();
        return (OS_TASK_NOT_EXIST);
    }
                                                 /* Copy TCB into user storage area                    */
    OS_MemCopy((INT8U *)p_task_data, (INT8U *)ptcb, sizeof(OS_TCB));
    OS_EXIT_CRITICAL();
    return (OS_NO_ERR);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                        CLEAR TASK STACK
*
* Description: This function is used to clear the stack of a task (i.e. write all zeros)
*
* Arguments  : pbos     is a pointer to the task's bottom of stack.  If the configuration constant
*                       OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
*                       memory to low memory).  'pbos' will thus point to the lowest (valid) memory
*                       location of the stack.  If OS_STK_GROWTH is set to 0, 'pbos' will point to the
*                       highest memory location of the stack and the stack will grow with increasing
*                       memory locations.  'pbos' MUST point to a valid 'free' data item.
*
*              size     is the number of 'stack elements' to clear.
*
*              opt      contains additional information (or options) about the behavior of the task.  The
*                       LOWER 8-bits are reserved by uC/OS-II while the upper 8 bits can be application
*                       specific.  See OS_TASK_OPT_??? in uCOS-II.H.
*
* Returns    : none
*********************************************************************************************************
*/
#if OS_TASK_CREATE_EXT_EN > 0
void  OS_TaskStkClr (OS_STK *pbos, INT32U size, INT16U opt)
{
    if ((opt & OS_TASK_OPT_STK_CHK) != 0x0000) {       /* See if stack checking has been enabled       */
        if ((opt & OS_TASK_OPT_STK_CLR) != 0x0000) {   /* See if stack needs to be cleared             */
#if OS_STK_GROWTH == 1
            while (size > 0) {                         /* Stack grows from HIGH to LOW memory          */
                size--;
                *pbos++ = (OS_STK)0;                   /* Clear from bottom of stack and up!           */
            }
#else
            while (size > 0) {                         /* Stack grows from LOW to HIGH memory          */
                size--;
                *pbos-- = (OS_STK)0;                   /* Clear from bottom of stack and down          */
            }
#endif
        }
    }
}

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线一二三| 一区二区三区不卡视频在线观看| 国产成人精品亚洲午夜麻豆| 亚洲人精品午夜| 精品国产一区二区在线观看| 91在线播放网址| 国产在线观看免费一区| 亚洲h在线观看| 国产精品国产成人国产三级| 精品欧美一区二区在线观看| 欧美性大战xxxxx久久久| 国产成人超碰人人澡人人澡| 奇米777欧美一区二区| 亚洲欧美日韩人成在线播放| 日本一区二区三级电影在线观看 | 香蕉久久一区二区不卡无毒影院 | 国产日韩三级在线| 欧美肥妇bbw| 91黄色激情网站| 波多野结衣的一区二区三区| 韩国一区二区三区| 日本亚洲欧美天堂免费| 亚洲永久免费av| 国产精品国产三级国产| 国产欧美日韩另类一区| 精品久久久久久久久久久久包黑料| 在线免费视频一区二区| 91麻豆精品视频| 成人深夜在线观看| 高清不卡一区二区| 国产精品综合久久| 国产夫妻精品视频| 国产精品综合二区| 国产成a人亚洲精品| 国产精品资源在线| 国产自产视频一区二区三区| 狠狠狠色丁香婷婷综合激情| 国内精品免费**视频| 韩日av一区二区| 国产精品99久久久久久似苏梦涵 | 成人综合激情网| 国产高清在线精品| 国产不卡在线视频| 成人久久视频在线观看| 丰满亚洲少妇av| 高清成人在线观看| 91在线码无精品| 91激情五月电影| 欧美日韩小视频| 欧美一区二区在线播放| 精品国产伦一区二区三区观看方式 | 日韩av一级电影| 日韩av在线播放中文字幕| 欧美aaa在线| 国产在线视频一区二区三区| 狠狠网亚洲精品| www.视频一区| 欧美亚男人的天堂| 日韩欧美一级精品久久| 久久久一区二区| 国产精品久久精品日日| 一二三四区精品视频| 污片在线观看一区二区| 精品一区二区三区在线播放| 国产成人精品aa毛片| 色94色欧美sute亚洲线路一久 | 一区二区三区久久| 午夜精品福利一区二区三区av| 蜜臀精品久久久久久蜜臀| 激情另类小说区图片区视频区| 韩国成人福利片在线播放| 成人黄色小视频在线观看| 色哟哟一区二区在线观看| 欧美人狂配大交3d怪物一区| 欧美第一区第二区| 综合激情网...| 美女视频一区二区| 91在线视频在线| 日韩一区二区影院| 国产精品美女久久久久久久网站| 一区二区三区在线视频免费| 老司机精品视频导航| www.欧美日韩国产在线| 欧美精选在线播放| 久久精品日产第一区二区三区高清版 | 国产在线播精品第三| 91麻豆国产福利在线观看| 91精品国产91久久综合桃花| 国产欧美一区二区精品性色| 午夜精品一区在线观看| 国产成人精品网址| 欧美喷潮久久久xxxxx| 国产精品久久午夜夜伦鲁鲁| 日韩av在线播放中文字幕| www.日韩精品| 精品福利av导航| 亚洲福利一区二区三区| 成人午夜电影网站| 日韩欧美国产麻豆| 亚洲va天堂va国产va久| eeuss鲁片一区二区三区| 日韩美一区二区三区| 亚洲国产一区二区三区青草影视| 国产91综合一区在线观看| 51精品视频一区二区三区| 亚洲精品中文在线观看| 成人激情图片网| 欧美成人免费网站| 日本怡春院一区二区| 91福利在线导航| 国产精品亲子乱子伦xxxx裸| 久久99精品久久久久久动态图 | 欧美一级电影网站| 亚洲色图视频网站| 成人免费av在线| 久久久久亚洲蜜桃| 久久成人久久鬼色| 欧美精品一二三| 亚洲高清免费一级二级三级| 91一区在线观看| 欧美国产综合色视频| 国产精品影视网| 久久综合色婷婷| 麻豆久久久久久| 欧美一二三四区在线| 日韩精品电影在线观看| 在线观看亚洲a| 亚洲免费成人av| 色婷婷国产精品| 一区二区三区免费| 在线免费不卡电影| 亚洲一区二区三区四区在线免费观看| 不卡av免费在线观看| 一区在线观看视频| 99视频有精品| 亚洲女女做受ⅹxx高潮| 欧美最猛性xxxxx直播| 亚洲国产欧美日韩另类综合| 欧美日韩极品在线观看一区| 三级亚洲高清视频| 777奇米四色成人影色区| 免费欧美日韩国产三级电影| 日韩精品一区二区三区四区视频 | 久久成人久久鬼色| 久久午夜色播影院免费高清 | 色综合久久综合网| 一区二区成人在线| 在线播放视频一区| 久久99精品一区二区三区| 精品91自产拍在线观看一区| 国产精一区二区三区| 国产精品色一区二区三区| 一本色道a无线码一区v| 午夜精品久久久| 日韩欧美一级在线播放| 国产91富婆露脸刺激对白| 一区在线播放视频| 精品视频色一区| 国产一区二区视频在线| 国产精品乱码人人做人人爱| 91久久精品一区二区三| 首页综合国产亚洲丝袜| 精品三级在线看| 成人激情小说乱人伦| 亚洲国产毛片aaaaa无费看 | www.成人网.com| 亚洲成人av一区二区三区| 日韩精品一区国产麻豆| 成人av在线一区二区| 亚洲二区在线视频| 欧美精品一区二区三区一线天视频| 粉嫩欧美一区二区三区高清影视| 亚洲日穴在线视频| 精品国产一区a| 91论坛在线播放| 免费高清视频精品| 中文字幕亚洲区| 欧美一级片在线看| 成人av资源在线观看| 婷婷六月综合亚洲| 国产精品乱码人人做人人爱| 欧美乱熟臀69xxxxxx| 成人污污视频在线观看| 日韩精品国产精品| 亚洲日本免费电影| 久久久av毛片精品| 欧美日韩在线播放三区四区| 国产一区二区福利| 午夜激情一区二区| 国产精品女主播av| 日韩视频123| 欧美丝袜自拍制服另类| zzijzzij亚洲日本少妇熟睡| 毛片av一区二区| 亚洲高清在线视频| 成人欧美一区二区三区黑人麻豆| 精品美女在线播放| 精品污污网站免费看| 91蝌蚪porny九色| 国产成人午夜精品5599|