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

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

?? os_task.c

?? 嵌入式實時操作系統uc/OS_II在凌陽單片機上的移植。跟大家共享
?? C
?? 第 1 頁 / 共 3 頁
字號:
    INT8U    err;
    OS_TCB  *ptcb;


    if (prio == OS_IDLE_PRIO) {                                 /* Not allowed to delete idle task     */
        return (OS_TASK_DEL_IDLE);
    }
    if (prio >= OS_LOWEST_PRIO && prio != OS_PRIO_SELF) {       /* Task priority valid ?               */
        return (OS_PRIO_INVALID);
    }
    if (prio == OS_PRIO_SELF) {                                 /* See if a task is requesting to ...  */
        OS_ENTER_CRITICAL();                                    /* ... this task to delete itself      */
        stat = OSTCBCur->OSTCBDelReq;                           /* Return request status to caller     */
        OS_EXIT_CRITICAL();
        return (stat);
    } else {
        OS_ENTER_CRITICAL();
        if ((ptcb = OSTCBPrioTbl[prio]) != (OS_TCB *)0) {       /* Task to delete must exist           */
            ptcb->OSTCBDelReq = OS_TASK_DEL_REQ;                /* Set flag indicating task to be DEL. */
            err               = OS_NO_ERR;
        } else {
            err               = OS_TASK_NOT_EXIST;              /* Task must be deleted                */
        }
        OS_EXIT_CRITICAL();
        return (err);
    }
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                        RESUME A SUSPENDED TASK
*
* Description: This function is called to resume a previously suspended task.  This is the only call that
*              will remove an explicit task suspension.
*
* Arguments  : prio     is the priority of the task to resume.
*
* Returns    : OS_NO_ERR                if the requested task is resumed
*              OS_PRIO_INVALID          if the priority you specify is higher that the maximum allowed 
*                                       (i.e. >= OS_LOWEST_PRIO)
*              OS_TASK_RESUME_PRIO      if the task to resume does not exist
*              OS_TASK_NOT_SUSPENDED    if the task to resume has not been suspended
*********************************************************************************************************
*/

#if OS_TASK_SUSPEND_EN
INT8U OSTaskResume (INT8U prio)
{
    OS_TCB   *ptcb;


    if (prio >= OS_LOWEST_PRIO) {                               /* Make sure task priority is valid    */
        return (OS_PRIO_INVALID);
    }
    OS_ENTER_CRITICAL();
    if ((ptcb = OSTCBPrioTbl[prio]) == (OS_TCB *)0) {           /* Task to suspend must exist          */
        OS_EXIT_CRITICAL();
        return (OS_TASK_RESUME_PRIO);
    } else {
        if (ptcb->OSTCBStat & OS_STAT_SUSPEND) {                           /* Task must be suspended   */
            if (((ptcb->OSTCBStat &= ~OS_STAT_SUSPEND) == OS_STAT_RDY) &&  /* Remove suspension        */
                 (ptcb->OSTCBDly  == 0)) {                                 /* Must not be delayed      */
                OSRdyGrp               |= ptcb->OSTCBBitY;                 /* Make task ready to run   */
                OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
                OS_EXIT_CRITICAL();
                OSSched();
            } else {
                OS_EXIT_CRITICAL();
            }
            return (OS_NO_ERR);
        } else {
            OS_EXIT_CRITICAL();
            return (OS_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
*
*              pdata    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
*              OS_TASK_OPT_ERR     if you did NOT specified OS_TASK_OPT_STK_CHK when the task was created
*********************************************************************************************************
*/
#if   OS_TASK_CREATE_EXT_EN
INT8U OSTaskStkChk (INT8U prio, OS_STK_DATA *pdata)
{
    OS_TCB  *ptcb;
    OS_STK  *pchk;
    INT32U   free;
    INT32U   size;


    pdata->OSFree = 0;                                          /* Assume failure, set to 0 size       */
    pdata->OSUsed = 0;
    if (prio > OS_LOWEST_PRIO && prio != OS_PRIO_SELF) {        /* Make sure task priority is valid    */
        return (OS_PRIO_INVALID);
    }
    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->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++ == 0) {                            /* Compute the number of zero entries on the stk */
        free++;
    }
#else
    while (*pchk-- == 0) {
        free++;
    }
#endif
    pdata->OSFree = free * sizeof(OS_STK);            /* Compute number of free bytes on the stack     */
    pdata->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
*
* 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
INT8U OSTaskSuspend (INT8U prio)
{
    BOOLEAN   self;
    OS_TCB   *ptcb;


    if (prio == OS_IDLE_PRIO) {                                 /* Not allowed to suspend idle task    */
        return (OS_TASK_SUSPEND_IDLE);
    }
    if (prio >= OS_LOWEST_PRIO && prio != OS_PRIO_SELF) {       /* Task priority valid ?               */
        return (OS_PRIO_INVALID);
    }
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                                 /* See if suspend SELF                 */
        prio = OSTCBCur->OSTCBPrio;
        self = TRUE;
    } else if (prio == OSTCBCur->OSTCBPrio) {                   /* See if suspending self              */
        self = TRUE;
    } else {
        self = FALSE;                                           /* No suspending another task          */
    }
    if ((ptcb = OSTCBPrioTbl[prio]) == (OS_TCB *)0) {                /* Task to suspend must exist     */
        OS_EXIT_CRITICAL();
        return (OS_TASK_SUSPEND_PRIO);
    } else {
        if ((OSRdyTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0) {     /* Make task not ready            */
            OSRdyGrp &= ~ptcb->OSTCBBitY;
        }
        ptcb->OSTCBStat |= OS_STAT_SUSPEND;                          /* Status of task is 'SUSPENDED'  */
        OS_EXIT_CRITICAL();
        if (self == TRUE) {                                          /* Context switch only if SELF    */
            OSSched();
        }
        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.  
*
* 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 
*********************************************************************************************************
*/

INT8U OSTaskQuery (INT8U prio, OS_TCB *pdata)
{
    OS_TCB *ptcb;


    if (prio > OS_LOWEST_PRIO && prio != OS_PRIO_SELF) {   /* Task priority valid ?                    */
        return (OS_PRIO_INVALID);
    }
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                            /* See if suspend SELF                      */
        prio = OSTCBCur->OSTCBPrio;
    }
    if ((ptcb = OSTCBPrioTbl[prio]) == (OS_TCB *)0) {      /* Task to query must exist                 */
        OS_EXIT_CRITICAL();
        return (OS_PRIO_ERR);
    }
    *pdata = *ptcb;                                        /* Copy TCB into user storage area          */
    OS_EXIT_CRITICAL();
    return (OS_NO_ERR);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品亚洲成a人在线观看| 香蕉av福利精品导航| 欧美丝袜丝nylons| 国产综合色在线| 亚洲国产成人porn| 国产欧美日韩另类一区| 欧美精品v国产精品v日韩精品 | 在线一区二区三区四区| 国产一区二区三区免费看 | 亚洲六月丁香色婷婷综合久久| 欧美一区二区在线不卡| 不卡大黄网站免费看| 青青青伊人色综合久久| 亚洲精品中文字幕在线观看| 久久精品亚洲精品国产欧美kt∨| 欧美猛男超大videosgay| 99精品热视频| 国产福利一区在线观看| 另类小说一区二区三区| 午夜激情综合网| 中文字幕乱码日本亚洲一区二区| 日韩视频免费观看高清完整版在线观看 | 日韩欧美亚洲国产精品字幕久久久 | 91麻豆精品国产自产在线观看一区| www.久久精品| 国产一区二区三区不卡在线观看| 日本美女一区二区三区| 亚洲国产视频直播| 亚洲精品视频在线看| 国产精品成人免费精品自在线观看| 精品国产乱码久久久久久久| 欧美一区欧美二区| 在线成人免费视频| 欧美日韩二区三区| 欧美男同性恋视频网站| 欧美日韩免费高清一区色橹橹| 色哟哟一区二区三区| 成人av电影观看| thepron国产精品| 成人性生交大片免费看中文网站| 国产一区二区女| 国产自产v一区二区三区c| 久久精品99久久久| 极品尤物av久久免费看| 精品一区二区免费视频| 精品无人码麻豆乱码1区2区| 免费在线观看一区二区三区| 日韩中文欧美在线| 视频一区二区欧美| 玖玖九九国产精品| 国产主播一区二区| 成人精品在线视频观看| 91在线精品一区二区| 色综合久久综合网欧美综合网| 色国产综合视频| 欧美日韩国产乱码电影| 91精品国产色综合久久不卡电影| 精品噜噜噜噜久久久久久久久试看| 欧美一级搡bbbb搡bbbb| 久久女同互慰一区二区三区| 国产拍欧美日韩视频二区| 亚洲欧洲日本在线| 一区二区三区在线免费播放| 天天色综合成人网| 狠狠色丁香婷综合久久| 成人国产精品免费网站| 91福利社在线观看| 日韩一区二区高清| 久久久精品国产99久久精品芒果| 国产精品视频麻豆| 亚洲成人精品一区| 黄网站免费久久| 91在线免费播放| 69堂成人精品免费视频| 国产亚洲欧美日韩在线一区| 亚洲视频狠狠干| 青青草国产成人99久久| 国产成人日日夜夜| 欧美视频精品在线| 久久久久久久久久电影| 亚洲色图一区二区| 蜜桃av一区二区在线观看| 成人激情免费电影网址| 欧美三区免费完整视频在线观看| 精品国产乱码久久久久久久久| 中文字幕一区二| 日产欧产美韩系列久久99| 成人av在线影院| 欧美精品乱人伦久久久久久| 国产精品美女久久久久av爽李琼| 午夜电影网一区| 成人免费不卡视频| 欧美一卡二卡三卡| 亚洲欧美激情小说另类| 国产最新精品免费| 欧美日韩中文字幕一区二区| 国产日韩欧美亚洲| 日韩高清不卡一区二区三区| av一二三不卡影片| 欧美mv和日韩mv国产网站| 亚洲女女做受ⅹxx高潮| 国产一区 二区| 欧美日韩在线综合| 日韩一区有码在线| 国产精品自拍av| 欧美一区二区三区的| 亚洲靠逼com| 不卡一区二区在线| 精品成人私密视频| 丝袜美腿高跟呻吟高潮一区| 色婷婷香蕉在线一区二区| 久久久久久9999| 日韩高清在线不卡| 欧美午夜理伦三级在线观看| 中文字幕在线观看一区二区| 欧美日韩大陆在线| 国产精品不卡在线| 国产成人在线免费观看| 日韩精品中文字幕在线一区| 亚洲成人综合网站| 色999日韩国产欧美一区二区| 欧美国产精品v| 久久99国产精品久久99果冻传媒| 欧美日韩成人在线一区| 亚洲一区二区三区美女| 91免费看片在线观看| 日韩一区在线播放| 99久久国产综合精品女不卡| 中文子幕无线码一区tr| 国产成人自拍在线| 26uuu欧美| 国产一区二区不卡| 久久综合久久综合久久| 国产一区二区调教| 久久久精品免费免费| 国产二区国产一区在线观看| 久久精品一区八戒影视| 国产精品一区一区| 国产欧美1区2区3区| 国产精品自在在线| 中文欧美字幕免费| gogo大胆日本视频一区| 亚洲四区在线观看| 91精品福利在线| 一区二区三区高清在线| 欧美色爱综合网| 日日夜夜精品视频免费| 日韩欧美一区在线观看| 精品一二三四区| 国产午夜精品美女毛片视频| 丁香婷婷综合五月| 亚洲欧美日韩在线播放| 欧美系列一区二区| 日日夜夜精品视频免费| 精品国产精品网麻豆系列| 国产一区二区按摩在线观看| 中文字幕乱码一区二区免费| 色国产精品一区在线观看| 亚洲1区2区3区视频| 欧美一级片在线| 国产a级毛片一区| 亚洲精品免费电影| 91麻豆精品国产91久久久资源速度 | 日韩欧美亚洲另类制服综合在线| 极品少妇xxxx精品少妇偷拍| 中文一区一区三区高中清不卡| 99re这里只有精品首页| 午夜久久久久久| 欧美成人r级一区二区三区| 成人午夜电影小说| 亚洲午夜激情网页| 欧美电视剧免费观看| 国产成人精品三级| 亚洲综合精品久久| 精品区一区二区| 91捆绑美女网站| 久久精品国产精品亚洲精品| 国产精品欧美久久久久一区二区| 欧美三级视频在线观看| 国产精品一二三四| 亚洲尤物在线视频观看| 26uuu欧美| 欧美性猛交xxxxxx富婆| 国产精品一区久久久久| 亚洲永久免费av| 国产三级精品在线| 欧美喷潮久久久xxxxx| 成人免费视频国产在线观看| 天堂在线一区二区| 中文一区二区在线观看| 欧美一区二区三区人| 91麻豆成人久久精品二区三区| 久久99久久久欧美国产| 一区二区三区在线免费播放| xvideos.蜜桃一区二区| 欧美日韩国产片| 97超碰欧美中文字幕| 国产精品一二三四五| 日本aⅴ亚洲精品中文乱码| 亚洲精品成人在线|