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

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

?? os_task.c

?? 最新版ucos2.86源碼和程序說明文件
?? C
?? 第 1 頁 / 共 4 頁
字號:
                }
            } else {
                OS_EXIT_CRITICAL();
            }
        } else {                                              /* Must be pending on event              */
            OS_EXIT_CRITICAL();
        }
        return (OS_ERR_NONE);
    }
    OS_EXIT_CRITICAL();
    return (OS_ERR_TASK_NOT_SUSPENDED);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                             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_ERR_NONE            upon success
*              OS_ERR_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_ERR_TASK_NOT_EXIST  if the desired task has not been created or is assigned to a Mutex PIP
*              OS_ERR_TASK_OPT        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_STAT_STK_CHK_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
INT8U  OSTaskStkChk (INT8U prio, OS_STK_DATA *p_stk_data)
{
    OS_TCB    *ptcb;
    OS_STK    *pchk;
    INT32U     nfree;
    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_ERR_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_ERR_TASK_NOT_EXIST);
    }
    if (ptcb == OS_TCB_RESERVED) {
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_NOT_EXIST);
    }
    if ((ptcb->OSTCBOpt & OS_TASK_OPT_STK_CHK) == 0) { /* Make sure stack checking option is set       */
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_OPT);
    }
    nfree = 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 */
        nfree++;
    }
#else
    while (*pchk-- == (OS_STK)0) {
        nfree++;
    }
#endif
    p_stk_data->OSFree = nfree * sizeof(OS_STK);          /* Compute number of free bytes on the stack */
    p_stk_data->OSUsed = (size - nfree) * sizeof(OS_STK); /* Compute number of bytes used on the stack */
    return (OS_ERR_NONE);
}
#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_ERR_NONE               if the requested task is suspended
*              OS_ERR_TASK_SUSPEND_IDLE  if you attempted to suspend the idle task which is not allowed.
*              OS_ERR_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_ERR_TASK_SUSPEND_PRIO  if the task to suspend does not exist
*              OS_ERR_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_ERR_TASK_SUSPEND_IDLE);
    }
    if (prio >= OS_LOWEST_PRIO) {                               /* Task priority valid ?               */
        if (prio != OS_PRIO_SELF) {
            return (OS_ERR_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_ERR_TASK_SUSPEND_PRIO);
    }
    if (ptcb == OS_TCB_RESERVED) {                              /* See if assigned to Mutex            */
        OS_EXIT_CRITICAL();
        return (OS_ERR_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();                                             /* Find new highest priority task      */
    }
    return (OS_ERR_NONE);
}
#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_ERR_NONE            if the requested task is suspended
*              OS_ERR_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_ERR_PRIO            if the desired task has not been created
*              OS_ERR_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_ERR_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_ERR_PRIO);
    }
    if (ptcb == OS_TCB_RESERVED) {               /* Task to query must not be assigned to a Mutex      */
        OS_EXIT_CRITICAL();
        return (OS_ERR_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_ERR_NONE);
}
#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_STAT_STK_CHK_EN > 0) && (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成人在线观看喷潮| a级精品国产片在线观看| 成人精品一区二区三区四区 | 亚洲视频狠狠干| 国产精品久久一级| 中文字幕在线不卡国产视频| 国产精品毛片久久久久久久| 中文字幕国产一区二区| 国产精品久久久久精k8| 亚洲精品乱码久久久久久日本蜜臀| 国产精品久久三| 亚洲免费大片在线观看| 亚洲一区二区美女| 蜜桃久久久久久久| 国产一区二区三区观看| 成人av动漫网站| 欧美亚洲综合在线| 91精品国产高清一区二区三区| 欧美一级艳片视频免费观看| 精品国产99国产精品| 国产欧美日本一区二区三区| 伦理电影国产精品| 激情五月激情综合网| 成人av免费在线观看| 欧美色图激情小说| 久久综合九色综合97婷婷女人| 国产欧美日韩在线观看| 亚洲综合激情小说| 狠狠狠色丁香婷婷综合久久五月| 成人av电影观看| 777a∨成人精品桃花网| 国产肉丝袜一区二区| 一区二区三区久久| 国内偷窥港台综合视频在线播放| av中文一区二区三区| 欧美一级搡bbbb搡bbbb| 国产精品第五页| 蜜桃久久久久久| 在线视频综合导航| 精品久久久久久久久久久久久久久久久| 国产精品每日更新在线播放网址| 日韩高清不卡一区| 色婷婷久久一区二区三区麻豆| 日韩一区二区电影网| 亚洲美女在线国产| 国产精品一区一区三区| 欧美日韩国产精品自在自线| 国产精品入口麻豆原神| 日日夜夜免费精品视频| 97se亚洲国产综合自在线| 精品国产麻豆免费人成网站| 亚洲电影在线免费观看| av午夜精品一区二区三区| 精品久久国产字幕高潮| 亚洲成在线观看| 色激情天天射综合网| 久久久久久久久久久黄色| 日韩国产一区二| 欧美日韩一区二区三区不卡| 亚洲丝袜另类动漫二区| 国产成人精品免费网站| 久久先锋影音av| 精品一区二区影视| 日韩一卡二卡三卡| 亚洲一区视频在线观看视频| 本田岬高潮一区二区三区| 久久久久久亚洲综合| 国产综合色在线视频区| 日韩免费性生活视频播放| 婷婷久久综合九色综合绿巨人 | 欧美一区二区二区| 亚洲五码中文字幕| 在线视频国内一区二区| 一区二区在线电影| 欧美视频一区二| 亚洲国产欧美在线人成| 欧美欧美午夜aⅴ在线观看| 亚洲另类春色国产| 91福利在线观看| 亚洲图片欧美综合| 欧美理论片在线| 久久精品国产网站| 久久综合久久综合九色| 成人综合婷婷国产精品久久| 国产精品久久久久久久久免费相片| 粉嫩久久99精品久久久久久夜| 国产午夜精品理论片a级大结局| 粉嫩aⅴ一区二区三区四区| 中文字幕免费不卡| 99久久免费视频.com| 一个色综合网站| 欧美丰满美乳xxx高潮www| 美女免费视频一区二区| 欧美激情综合在线| 色先锋资源久久综合| 日韩主播视频在线| 2020国产精品自拍| 97成人超碰视| 美女任你摸久久| 国产精品第一页第二页第三页| 欧美在线免费观看亚洲| 久久99久久久久| 日本成人在线电影网| 精品国产制服丝袜高跟| 成人短视频下载| 日韩精品电影在线观看| 国产欧美精品一区| 欧美日韩国产小视频| 国产精品一区二区三区网站| 怡红院av一区二区三区| 欧美精品一区二区三区在线播放 | 欧美无人高清视频在线观看| 免费观看在线综合| 1024国产精品| 欧美成人一区二区三区| 91福利资源站| 国产v日产∨综合v精品视频| 亚洲二区在线视频| 国产精品美女久久久久久久久久久 | 成人午夜av在线| 无码av免费一区二区三区试看 | 亚洲成精国产精品女| 国产色爱av资源综合区| 91精品国产入口| 99久久免费精品高清特色大片| 久久er99精品| 午夜视频在线观看一区二区| 国产精品精品国产色婷婷| 日韩三级精品电影久久久| 97se亚洲国产综合在线| 国产风韵犹存在线视精品| 免费在线看成人av| 亚洲永久精品大片| **欧美大码日韩| 国产色一区二区| 久久免费电影网| 欧美大片一区二区| 91精品国产丝袜白色高跟鞋| 欧美少妇一区二区| 91福利精品第一导航| 99久久国产综合色|国产精品| 国产精品影视在线| 激情综合色丁香一区二区| 日本女优在线视频一区二区| 亚洲18女电影在线观看| 亚洲一本大道在线| 奇米综合一区二区三区精品视频| 亚洲欧美日韩成人高清在线一区| 欧美激情综合五月色丁香小说| 久久色.com| 国产亚洲欧美一区在线观看| 久久久精品中文字幕麻豆发布| 欧美xxxxxxxx| 久久综合色播五月| 国产亚洲欧洲一区高清在线观看| 精品欧美一区二区在线观看| 亚洲精品一区二区三区影院| 久久夜色精品国产欧美乱极品| 精品国产百合女同互慰| 久久久不卡影院| 久久久久免费观看| 久久精品亚洲麻豆av一区二区| 国产色一区二区| 亚洲色图另类专区| 亚洲在线视频免费观看| 日韩国产在线一| 九九精品一区二区| 成人午夜av电影| 91久久精品国产91性色tv| 欧美美女bb生活片| 日韩欧美国产一二三区| 国产日韩成人精品| 亚洲欧美日韩中文字幕一区二区三区| 一区二区三区欧美视频| 日本在线不卡视频一二三区| 国产精品一卡二| 成人app在线| 欧美在线影院一区二区| 欧美一区二区三区日韩| 欧美国产一区视频在线观看| 亚洲精品免费在线观看| 久久精品久久综合| 91一区二区在线| 日韩一级高清毛片| 中文av一区二区| 亚洲.国产.中文慕字在线| 国产福利视频一区二区三区| 一本到不卡精品视频在线观看 | 亚洲va韩国va欧美va精品| 久久99精品国产91久久来源| 不卡免费追剧大全电视剧网站| 欧美日韩国产欧美日美国产精品| 久久免费的精品国产v∧| 亚洲高清久久久| 国产精品99久久久久久久vr| 欧美性感一区二区三区| 欧美激情综合五月色丁香小说| 亚洲成a人片在线观看中文|