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

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

?? os_task.c

?? ucos-ii在msp430f149上的移植
?? C
?? 第 1 頁 / 共 4 頁
字號:
*                                            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*/
/*
*********************************************************************************************************
*                                 GET THE CURRENT VALUE OF A TASK VARIABLE
*
* Description: This function is called to obtain the current value of a task variable.  Task variables
*              are application specific and can be used to store task specific values such as 'error 
*              numbers' (i.e. errno), statistics, etc.  Each task variable can hold a 32-bit value.
*
* Arguments  : prio      is the priority of the task you want to get the task variable from.  If you
*                        specify OS_PRIO_SELF then the task variable of the current task will be obtained.
*
*              id        is the 'id' of the desired task variable.  Note that the 'id' must be less
*                        than OS_TASK_REG_TBL_SIZE
*
*              perr      is a pointer to a variable that will hold an error code related to this call.
*
*                        OS_ERR_NONE            if the call was successful
*                        OS_ERR_PRIO_INVALID    if you specified an invalid priority
*                        OS_ERR_ID_INVALID      if the 'id' is not between 0 and OS_TASK_REG_TBL_SIZE-1
*
* Returns    : The current value of the task's variable or 0 if an error is detected.
*
* Note(s)    : The maximum number of task variables is 254
*********************************************************************************************************
*/

#if OS_TASK_REG_TBL_SIZE > 0
INT32U  OSTaskRegGet (INT8U   prio,
                      INT8U   id,
                      INT8U  *perr)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif
    INT32U     value;
    OS_TCB    *ptcb;


#if OS_ARG_CHK_EN > 0
    if (prio >= OS_LOWEST_PRIO) {
        if (prio != OS_PRIO_SELF) {
            *perr = OS_ERR_PRIO_INVALID;
            return (0);
        }
    }
    if (id >= OS_TASK_REG_TBL_SIZE) {
        *perr = OS_ERR_ID_INVALID;
        return (0);
    }
#endif
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                  /* See if need to get variable from current task      */
        ptcb = OSTCBCur;
    } else {
        ptcb = OSTCBPrioTbl[prio];
    }
    value = ptcb->OSTCBVarTbl[id];
    OS_EXIT_CRITICAL();
    *perr = OS_ERR_NONE;
    return (value);    
}                                       
#endif                                       
                                       
/*$PAGE*/
/*
*********************************************************************************************************
*                                 SET THE CURRENT VALUE OF A TASK VARIABLE
*
* Description: This function is called to change the current value of a task variable.  Task variables
*              are application specific and can be used to store task specific values such as 'error 
*              numbers' (i.e. errno), statistics, etc.  Each task variable can hold a 32-bit value.
*
* Arguments  : prio      is the priority of the task you want to set the task variable for.  If you
*                        specify OS_PRIO_SELF then the task variable of the current task will be obtained.
*
*              var_id    is the 'id' of the desired task variable.  Note that the 'id' must be less
*                        than OS_TASK_REG_TBL_SIZE
*
*              value     is the desired value for the task variable.
*
*              perr      is a pointer to a variable that will hold an error code related to this call.
*
*                        OS_ERR_NONE            if the call was successful
*                        OS_ERR_PRIO_INVALID    if you specified an invalid priority
*                        OS_ERR_ID_INVALID      if the 'id' is not between 0 and OS_TASK_REG_TBL_SIZE-1
*
* Returns    : The current value of the task's variable or 0 if an error is detected.
*
* Note(s)    : The maximum number of task variables is 254
*********************************************************************************************************
*/

#if OS_TASK_REG_TBL_SIZE > 0
void  OSTaskRegSet (INT8U    prio,
                    INT8U    id,
                    INT32U   value,
                    INT8U   *perr)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif
    OS_TCB    *ptcb;


#if OS_ARG_CHK_EN > 0
    if (prio >= OS_LOWEST_PRIO) {
        if (prio != OS_PRIO_SELF) {
            *perr = OS_ERR_PRIO_INVALID;
            return;
        }
    }
    if (id >= OS_TASK_REG_TBL_SIZE) {
        *perr = OS_ERR_ID_INVALID;
        return;
    }
#endif
    OS_ENTER_CRITICAL();
    if (prio == OS_PRIO_SELF) {                  /* See if need to get variable from current task      */
        ptcb = OSTCBCur;
    } else {
        ptcb = OSTCBPrioTbl[prio];
    }
    ptcb->OSTCBVarTbl[id] = value;
    OS_EXIT_CRITICAL();
    *perr                 = OS_ERR_NONE;
}
#endif
                                       
/*
*********************************************************************************************************
*                                        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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品每日更新| 国产激情一区二区三区| 亚洲一区二区三区不卡国产欧美| 最新国产成人在线观看| 亚洲欧美日韩人成在线播放| 亚洲女同女同女同女同女同69| 亚洲三级在线观看| 亚洲一区中文日韩| 亚洲影视资源网| 亚洲一二三四久久| 午夜天堂影视香蕉久久| 日韩电影在线免费观看| 麻豆精品在线看| 国产一区二区三区电影在线观看| 国产精品综合二区| 成人综合在线观看| 色婷婷久久一区二区三区麻豆| 色狠狠综合天天综合综合| 欧美日韩久久不卡| 51精品秘密在线观看| 日韩精品专区在线影院重磅| 久久久无码精品亚洲日韩按摩| 国产亚洲一区二区三区四区| 国产精品久久久久久久久久免费看 | 亚洲欧美日韩精品久久久久| 一区二区三区精品久久久| 亚洲成av人在线观看| 久久激情五月婷婷| 成人小视频免费在线观看| 色一情一乱一乱一91av| 欧美日韩视频一区二区| 欧美大片顶级少妇| 中文字幕成人在线观看| 伊人一区二区三区| 日本大胆欧美人术艺术动态| 国产成人自拍高清视频在线免费播放| 99精品视频在线免费观看| 欧美在线免费播放| 日韩欧美视频在线| 中文字幕一区二区在线播放| 亚洲国产综合在线| 国产精品一级黄| 日本韩国欧美一区二区三区| 欧美一区二区三区小说| 国产精品九色蝌蚪自拍| 午夜亚洲福利老司机| 国产成人av电影| 欧美日韩一二三| 国产日韩影视精品| 日韩制服丝袜先锋影音| 成人激情开心网| 91精品综合久久久久久| 国产精品乱码久久久久久 | 在线欧美日韩国产| 久久在线观看免费| 亚洲图片欧美色图| 国产91精品一区二区| 4438x亚洲最大成人网| 国产精品护士白丝一区av| 蜜臀久久久99精品久久久久久| 91在线观看下载| 精品三级av在线| 一区二区视频在线| 国产精品一区二区在线观看网站| 欧美三级在线播放| 亚洲欧美自拍偷拍色图| 老鸭窝一区二区久久精品| 91美女在线看| 日本一区二区三区在线不卡| 麻豆精品在线视频| 欧美日韩视频在线观看一区二区三区| 国产精品美女一区二区三区| 麻豆久久久久久久| 欧美日韩久久久| 亚洲激情欧美激情| av在线不卡网| 久久久精品天堂| 免费亚洲电影在线| 欧美美女视频在线观看| 亚洲精品精品亚洲| 99麻豆久久久国产精品免费优播| 精品女同一区二区| 免费在线观看一区| 91 com成人网| 婷婷中文字幕一区三区| 91麻豆成人久久精品二区三区| 国产人久久人人人人爽| 韩国精品一区二区| 日韩精品中文字幕一区二区三区| 日一区二区三区| 欧美日韩国产美| 午夜视频在线观看一区二区| 欧美色综合久久| 一区二区三区不卡视频在线观看| 99精品国产视频| 国产精品久久久久久久岛一牛影视| 国产91精品久久久久久久网曝门| 久久免费精品国产久精品久久久久| 麻豆精品一二三| 欧美成人女星排行榜| 麻豆精品视频在线观看免费| 欧美一级日韩免费不卡| 青青草国产精品亚洲专区无| 欧美一区日韩一区| 日本v片在线高清不卡在线观看| 欧美日韩国产影片| 五月开心婷婷久久| 欧美精品乱码久久久久久| 天天综合天天做天天综合| 7878成人国产在线观看| 日本一区中文字幕| 精品免费国产二区三区| 国产一区二区不卡老阿姨| 久久久蜜桃精品| av在线不卡电影| 亚洲三级久久久| 欧美色涩在线第一页| 亚洲va天堂va国产va久| 欧美一区午夜精品| 韩国v欧美v亚洲v日本v| 国产精品网站在线观看| 99久精品国产| 偷窥国产亚洲免费视频| 日韩免费视频一区二区| 粉嫩aⅴ一区二区三区四区| 亚洲欧美日韩精品久久久久| 欧美精品1区2区3区| 极品少妇一区二区三区精品视频| 国产亚洲精品aa| 99精品在线观看视频| 亚洲电影在线播放| 精品日韩欧美在线| 欧美久久一区二区| 免费欧美在线视频| 国产欧美在线观看一区| 一本一本大道香蕉久在线精品 | 日韩午夜激情电影| 狠狠色丁香婷婷综合| 国产精品伦一区二区三级视频| 91福利国产成人精品照片| 丝袜诱惑亚洲看片| 国产日产欧产精品推荐色| 在线观看不卡视频| 久久成人精品无人区| 亚洲欧洲国产日本综合| 欧美精品123区| 粉嫩一区二区三区性色av| 亚洲福利视频一区二区| 久久久午夜精品| 欧美日韩在线三级| 国产一区二区在线免费观看| 亚洲欧美日韩国产中文在线| 日韩欧美一区二区久久婷婷| av中文字幕在线不卡| 日本91福利区| 国产精品二区一区二区aⅴ污介绍| 欧美三级中文字幕在线观看| 国产精品亚洲一区二区三区在线| 亚洲综合无码一区二区| 久久久一区二区| 欧美日韩激情一区二区三区| 国产91色综合久久免费分享| 天堂成人国产精品一区| 欧美经典三级视频一区二区三区| 欧美日韩电影在线| 粉嫩在线一区二区三区视频| 日本不卡一区二区三区高清视频| 亚洲欧美综合另类在线卡通| 欧美电影免费观看高清完整版在线 | 91精品国产综合久久香蕉麻豆| 国产91精品在线观看| 美女一区二区视频| 亚洲一区中文在线| 中文字幕人成不卡一区| 精品三级在线看| 91.com视频| 欧美视频在线一区二区三区| 成人做爰69片免费看网站| 麻豆久久一区二区| 午夜不卡在线视频| 亚洲综合自拍偷拍| 国产精品不卡在线| 久久久综合激的五月天| 日韩一区二区三区在线视频| 欧美色图一区二区三区| 成人午夜碰碰视频| 极品少妇xxxx偷拍精品少妇| 调教+趴+乳夹+国产+精品| 亚洲综合色成人| 一区在线观看免费| 国产精品色一区二区三区| 久久久蜜臀国产一区二区| 欧美成人一区二区| 日韩午夜中文字幕| 欧美剧情电影在线观看完整版免费励志电影 | 一区二区三区影院| ...xxx性欧美| 国产精品亲子乱子伦xxxx裸| 国产亚洲欧美一区在线观看| 久久这里只有精品首页|