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

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

?? os_task.c

?? OS : ucos-2 Target : MSP430
?? 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一区二区三区免费野_久草精品视频
日本高清免费不卡视频| 国产欧美精品一区二区色综合| 成人欧美一区二区三区在线播放| 丁香亚洲综合激情啪啪综合| 久久蜜桃av一区精品变态类天堂| 国产风韵犹存在线视精品| 中文字幕在线一区二区三区| 97久久精品人人澡人人爽| 一区二区成人在线观看| 色菇凉天天综合网| 亚洲一区二区三区四区五区中文 | 欧美韩国日本一区| 成人少妇影院yyyy| 一区在线观看视频| 在线亚洲一区二区| 久久精品国产免费| 国产精品国模大尺度视频| 91黄色激情网站| 久久不见久久见免费视频7| 国产精品网曝门| 欧美在线小视频| 国产综合色产在线精品| 亚洲欧美成aⅴ人在线观看| 666欧美在线视频| 高清不卡一区二区| 亚洲mv大片欧洲mv大片精品| 日韩精品中文字幕在线一区| av不卡在线播放| 免费不卡在线视频| 亚洲欧洲www| 日韩美女天天操| 色婷婷一区二区三区四区| 麻豆精品国产91久久久久久| 亚洲天天做日日做天天谢日日欢| 91精品国产一区二区三区蜜臀 | 毛片一区二区三区| 国产精品久久久久久久久免费相片 | 麻豆91精品视频| ...xxx性欧美| 日韩美女一区二区三区| 成人污污视频在线观看| 免费一级片91| 综合在线观看色| 2024国产精品| 制服丝袜av成人在线看| 色综合网站在线| 国产成人精品影视| 美女网站视频久久| 午夜亚洲国产au精品一区二区| 日韩免费一区二区三区在线播放| 色婷婷av一区二区三区之一色屋| 韩国欧美一区二区| 日韩主播视频在线| 亚洲精品在线观| 欧美日韩性生活| 99re免费视频精品全部| 国产综合成人久久大片91| 亚洲综合av网| 久久久99久久精品欧美| 69堂亚洲精品首页| 欧美三级午夜理伦三级中视频| 国产黄色成人av| 裸体歌舞表演一区二区| 日本大胆欧美人术艺术动态| 亚洲一区二区视频在线观看| 亚洲免费伊人电影| 成人sese在线| 风间由美一区二区av101| 伦理电影国产精品| 久久国产精品99精品国产| 蜜桃久久久久久| 蜜臀精品久久久久久蜜臀| 日韩二区三区四区| 蜜臀va亚洲va欧美va天堂 | 亚洲精品一区二区三区影院 | 欧美精品久久一区二区三区| 在线看日本不卡| 欧美在线观看一区| av不卡一区二区三区| 99re视频这里只有精品| 色偷偷成人一区二区三区91 | 久久不见久久见中文字幕免费| 同产精品九九九| 五月天精品一区二区三区| 日韩av电影天堂| 日本美女视频一区二区| 激情欧美一区二区三区在线观看| 奇米精品一区二区三区四区| 久久国产乱子精品免费女| 无吗不卡中文字幕| 午夜伦理一区二区| 美脚の诱脚舐め脚责91| 免费高清视频精品| 国内精品国产三级国产a久久 | 偷拍日韩校园综合在线| 日韩福利电影在线| 国产精品资源站在线| 99视频在线观看一区三区| 欧美美女一区二区在线观看| 亚洲一区二区三区四区在线| 日韩国产一二三区| 国产精品一区在线观看乱码| 成人三级伦理片| 欧美精三区欧美精三区| 久久综合色婷婷| 中文字幕人成不卡一区| 天天操天天色综合| 黑人精品欧美一区二区蜜桃| 99久久99久久精品免费看蜜桃| 欧美在线观看一区| 久久一夜天堂av一区二区三区 | 一区在线播放视频| 视频在线观看一区| 国产精品 日产精品 欧美精品| 99国产精品视频免费观看| 91精品国产综合久久精品性色| 久久久久久久综合日本| 亚洲综合一区二区| 国产麻豆成人传媒免费观看| 不卡一区在线观看| 色吧成人激情小说| 日韩丝袜美女视频| 中文字幕字幕中文在线中不卡视频| 日日夜夜精品免费视频| 成人小视频免费观看| 91欧美一区二区| 精品国产一区久久| 亚洲精品视频免费看| 国产精品中文有码| 欧美日韩三级在线| 中文字幕一区在线观看视频| 免费欧美日韩国产三级电影| 色婷婷久久久综合中文字幕| 久久久精品国产免大香伊| 午夜伊人狠狠久久| 国产99一区视频免费 | 99久久精品免费| 欧美不卡一二三| 狠狠色丁香婷综合久久| 一区二区三区国产| 国产精品一区二区久久精品爱涩| 在线播放欧美女士性生活| 国产日本欧美一区二区| 亚洲高清免费观看 | 一本久久精品一区二区| 日韩午夜中文字幕| 亚洲欧美国产毛片在线| 国内久久婷婷综合| 欧美日韩国产精选| 综合中文字幕亚洲| 成人午夜电影网站| 国产日产精品一区| 激情深爱一区二区| 2020日本不卡一区二区视频| 亚洲va国产va欧美va观看| 麻豆精品久久久| 欧美日韩中文字幕一区二区| 亚洲欧美激情在线| 91网站最新网址| 国产精品久久久久一区| 国产精品一区二区免费不卡| 精品国产乱码久久久久久图片| 青青草原综合久久大伊人精品 | 欧美日韩日本视频| 亚洲一区二区三区在线播放| 色琪琪一区二区三区亚洲区| 亚洲欧美综合在线精品| 91在线观看地址| 亚洲精选视频在线| 在线观看视频一区二区| 亚洲动漫第一页| 欧美一区二区视频观看视频| 免费看黄色91| 久久蜜桃香蕉精品一区二区三区| 国产精品原创巨作av| 国产精品久久久久久久久免费桃花 | 日韩一区在线免费观看| 日韩精品久久理论片| 欧美久久一二区| 日韩成人av影视| 精品国产一区二区亚洲人成毛片| 国产在线视频精品一区| 国产欧美一区二区在线| av中文字幕亚洲| 亚洲日本在线天堂| 欧美视频在线一区二区三区| 日韩国产欧美在线观看| 日韩一区二区免费高清| 精品一二三四区| 国产精品国产精品国产专区不蜜| 国产a级毛片一区| 亚洲一区二区三区不卡国产欧美| 在线观看91视频| 亚洲综合在线电影| 日韩女优毛片在线| 成人av电影在线网| 无码av免费一区二区三区试看| 精品久久五月天| 99精品国产99久久久久久白柏| 午夜影院久久久|