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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? os_task.c

?? uc/os2.83最新源代碼
?? C
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
*********************************************************************************************************
*                                             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

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线91免费看| 欧美日韩久久不卡| 久久国产综合精品| 国产在线一区二区综合免费视频| 五月激情综合网| 久久超碰97人人做人人爱| 精品综合久久久久久8888| 激情五月婷婷综合| 成人av电影在线网| 99精品热视频| 欧美另类z0zxhd电影| 欧美一卡二卡在线观看| 久久综合狠狠综合久久综合88 | 国产三级精品在线| 自拍偷拍欧美精品| 天天色综合天天| 国产传媒日韩欧美成人| 在线视频欧美精品| 久久精品视频免费| 爽爽淫人综合网网站| 国产a级毛片一区| 久久婷婷色综合| 91精品国产综合久久婷婷香蕉| 91麻豆精品国产91久久久久久| 精品日韩一区二区| 亚洲成人你懂的| 99国产精品国产精品久久| 精品99999| 麻豆一区二区99久久久久| 一本久久综合亚洲鲁鲁五月天| 久久精品亚洲国产奇米99| 天堂在线一区二区| 欧美日韩在线亚洲一区蜜芽| 亚洲三级电影网站| 色呦呦国产精品| 国产精品三级久久久久三级| 国产福利一区二区三区视频在线 | 久久一区二区视频| 久久国产精品99久久人人澡| 欧美精品一二三四| 日精品一区二区| 91精品国产丝袜白色高跟鞋| 午夜精品视频一区| 91精品国产色综合久久不卡电影 | 久久蜜桃一区二区| 国产成人综合在线观看| 欧美国产日本韩| 不卡的电影网站| 亚洲一二三区在线观看| 欧洲精品一区二区| 蜜桃久久久久久| 国产亚洲欧美一级| 色婷婷久久99综合精品jk白丝 | 国产91对白在线观看九色| 国产精品国产馆在线真实露脸| 97精品国产97久久久久久久久久久久| 日本一区二区成人在线| 91久久一区二区| 久久精品国产久精国产| 亚洲欧洲精品一区二区精品久久久| 日本韩国欧美一区| 精品一区二区在线视频| 综合电影一区二区三区| 欧美一区二区三区婷婷月色| 国产成人精品影院| 日韩精品91亚洲二区在线观看| 国产亚洲一区字幕| 91精品啪在线观看国产60岁| 国产成人在线网站| 日本sm残虐另类| 五月天网站亚洲| 亚洲人成人一区二区在线观看| 欧美成人在线直播| 欧美挠脚心视频网站| 一本色道亚洲精品aⅴ| 国产成人亚洲综合a∨猫咪| 午夜精品123| 亚洲a一区二区| 一二三四社区欧美黄| 亚洲欧洲av在线| 国产精品丝袜在线| 国产亚洲一区二区三区| 精品美女被调教视频大全网站| 欧美日韩欧美一区二区| 色婷婷av久久久久久久| 欧洲色大大久久| 欧美日韩大陆在线| 日韩网站在线看片你懂的| 7799精品视频| 精品福利一区二区三区免费视频| 91精品国产综合久久国产大片| 欧美精品 日韩| 久久婷婷综合激情| 中文字幕在线观看一区| 亚洲精选免费视频| 视频一区在线视频| 国产精品夜夜爽| 91日韩一区二区三区| 欧美美女一区二区在线观看| 在线不卡a资源高清| 日韩一区二区麻豆国产| 欧美经典三级视频一区二区三区| 中文一区一区三区高中清不卡| 国产精品久久久久精k8 | 成人性生交大片免费看视频在线 | 亚洲欧洲中文日韩久久av乱码| 一区二区在线观看视频在线观看| 亚洲国产wwwccc36天堂| 日本不卡中文字幕| 色噜噜狠狠色综合中国| 精品国产凹凸成av人导航| 国产精品天干天干在线综合| 久久久av毛片精品| 欧美综合一区二区三区| 色先锋aa成人| 国产精品麻豆久久久| 午夜不卡在线视频| 色综合天天综合色综合av| 精品电影一区二区| 亚洲成av人综合在线观看| 国产iv一区二区三区| 欧美不卡视频一区| 日韩av一区二区在线影视| 95精品视频在线| 国产精品免费免费| 国产成人欧美日韩在线电影| 欧美电影免费观看高清完整版在| 亚洲综合一二三区| 91麻豆国产精品久久| 国产精品成人在线观看| 福利91精品一区二区三区| 亚洲精品在线免费播放| 蜜桃久久久久久| 欧美sm极限捆绑bd| 国产一区二区在线观看视频| 久久一日本道色综合| 国模无码大尺度一区二区三区| 精品精品国产高清一毛片一天堂| 亚洲成人av电影| 亚洲精品一区二区三区在线观看| 日韩va亚洲va欧美va久久| 欧美一区欧美二区| 国产一区二区看久久| 中文无字幕一区二区三区| 99国产精品99久久久久久| 亚洲超丰满肉感bbw| 日韩精品影音先锋| 国产宾馆实践打屁股91| 一区二区三区中文在线| 欧美日韩在线播放三区四区| 蜜臀av一区二区在线免费观看 | 亚洲精品国产a久久久久久| 欧美综合久久久| 国产高清不卡一区| 午夜电影一区二区三区| 国产欧美日韩麻豆91| 欧美精品少妇一区二区三区| 国产福利一区二区三区视频在线| 亚洲国产一区二区三区青草影视| 精品国产青草久久久久福利| 欧美在线一区二区| 成人一级片在线观看| 精品综合免费视频观看| 日韩电影免费在线看| 亚洲女与黑人做爰| 久久久久久久久久久99999| 在线观看免费亚洲| 99国产精品久久久久久久久久| 老司机精品视频在线| 亚洲va欧美va人人爽| 亚洲午夜久久久久中文字幕久| 欧美国产在线观看| 日本一区二区三级电影在线观看| 日韩欧美激情四射| 欧美一区二区三区思思人| 欧美剧情片在线观看| 色婷婷综合激情| 欧美性高清videossexo| 色狠狠一区二区三区香蕉| 91麻豆精品视频| 欧美性色黄大片| 欧美r级电影在线观看| 精品不卡在线视频| 国产精品视频第一区| 亚洲日本va在线观看| 亚洲午夜精品久久久久久久久| 一二三四社区欧美黄| 免费高清视频精品| 粉嫩aⅴ一区二区三区四区五区 | 亚洲国产成人午夜在线一区| 国产精品久久久久aaaa| 亚洲综合一二三区| 精品综合免费视频观看| 色综合一区二区三区| 正在播放亚洲一区| 国产日产欧美一区二区视频| 亚洲男人天堂一区| 久久99国产精品久久| 色88888久久久久久影院按摩 | 亚洲在线一区二区三区|