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

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

?? os_task.c

?? AT91RM9200的uC/OS的源代碼,大家共享
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*$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_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
*********************************************************************************************************
*/
#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;



    cpu_sr = 0;                                        /* Prevent compiler warning                     */
#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);
        }
    }
#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;



    cpu_sr = 0;                                                 /* Prevent compiler warning            */
#endif    
#if OS_ARG_CHK_EN > 0
    if (prio == OS_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 = TRUE;
    } else if (prio == OSTCBCur->OSTCBPrio) {                   /* See if suspending self              */
        self = TRUE;
    } else {
        self = 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] == 0x00) { 
        OSRdyGrp &= ~ptcb->OSTCBBitY;
    }
    ptcb->OSTCBStat |= OS_STAT_SUSPEND;                         /* Status of task is 'SUSPENDED'       */
    OS_EXIT_CRITICAL();
    if (self == 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
*********************************************************************************************************
*/

#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;



    cpu_sr = 0;                                  /* Prevent compiler warning                           */
#endif    
#if OS_ARG_CHK_EN > 0
    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;
    }
    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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品一区二区三区免费视频| 精品国产乱码久久久久久牛牛| 亚洲精品亚洲人成人网在线播放| 99久久综合精品| 亚洲免费观看高清完整版在线观看 | 欧美精品1区2区| 日韩国产高清影视| 精品久久久久久亚洲综合网| 国产精品亚洲视频| 中文字幕日韩av资源站| 色天使色偷偷av一区二区| 亚洲成人免费影院| 欧美成人在线直播| 99免费精品在线观看| 午夜国产精品一区| 久久久久综合网| 在线亚洲精品福利网址导航| 奇米色一区二区| 日本一区免费视频| 欧美福利电影网| 成人av在线播放网址| 亚洲国产色一区| 国产性色一区二区| 欧美日韩一区久久| 91精品免费在线观看| 国产精品一二三四| 亚洲最大色网站| 久久久久久久综合日本| 欧美中文字幕一区二区三区亚洲| 蜜桃视频一区二区| 亚洲伦在线观看| 日韩视频中午一区| 色天使色偷偷av一区二区| 麻豆freexxxx性91精品| 中文字幕一区二区日韩精品绯色| 91精品国产乱| 91污片在线观看| 久久国产精品区| 亚洲国产日韩一区二区| 欧美tk—视频vk| 色综合久久天天综合网| 国产一区二区三区日韩| 五月天亚洲精品| 中文字幕亚洲电影| 久久蜜桃av一区二区天堂| 欧美日韩精品一区二区| 成人毛片老司机大片| 日本成人在线视频网站| 亚洲黄色免费网站| 亚洲国产经典视频| 精品国产一区二区三区忘忧草| 色悠久久久久综合欧美99| 国产在线精品一区在线观看麻豆| 亚洲va在线va天堂| 亚洲三级免费观看| 国产精品水嫩水嫩| 国产亚洲精品bt天堂精选| 日韩三级在线免费观看| 欧美日本一道本在线视频| 99久久综合精品| a在线欧美一区| 成人黄色小视频| 成人蜜臀av电影| 成人动漫在线一区| 成人动漫一区二区在线| 成人黄色免费短视频| 国产999精品久久久久久| 国产精品99久久久久久有的能看| 蜜桃精品视频在线| 免费xxxx性欧美18vr| 午夜av电影一区| 日韩福利视频导航| 日本va欧美va精品发布| 麻豆免费精品视频| 激情欧美一区二区| 国产做a爰片久久毛片| 久久99国产精品免费网站| 男女性色大片免费观看一区二区| 亚洲国产欧美在线人成| 亚洲二区在线视频| 免费在线成人网| 精品一二三四在线| 麻豆精品蜜桃视频网站| 国产在线国偷精品免费看| 激情偷乱视频一区二区三区| 国产在线精品免费| av中文字幕亚洲| 日本高清免费不卡视频| 欧美狂野另类xxxxoooo| 欧美一区二区免费观在线| 精品88久久久久88久久久| 久久久久久久久久久久久夜| 国产精品美女久久久久aⅴ| 日韩毛片在线免费观看| 亚洲国产日韩在线一区模特| 美女国产一区二区| 日韩美一区二区三区| 久久精品一区二区三区av| 国产精品久久三| 亚洲国产一区视频| 韩国av一区二区三区| 成人理论电影网| 欧美综合视频在线观看| 日韩精品中文字幕一区| 国产精品久久久久婷婷二区次| 亚洲激情自拍偷拍| 免费成人美女在线观看.| 国产成人精品免费一区二区| caoporm超碰国产精品| 91.xcao| 国产日本一区二区| 亚洲国产精品一区二区尤物区| 久久黄色级2电影| 菠萝蜜视频在线观看一区| 欧美日韩极品在线观看一区| 久久综合久久综合九色| 亚洲免费在线视频| 蜜臀av一级做a爰片久久| av成人免费在线| 3751色影院一区二区三区| 国产精品天干天干在观线| 亚洲成人精品在线观看| 国产成人av网站| 91麻豆精品国产91久久久久久 | 日韩电影免费在线| 国产成人日日夜夜| 欧美日产国产精品| 国产精品美女久久久久久久| 日韩精品乱码免费| a级精品国产片在线观看| 欧美sm美女调教| 亚洲综合免费观看高清完整版| 国产在线国偷精品产拍免费yy| 欧美视频自拍偷拍| 成人欧美一区二区三区黑人麻豆| 麻豆精品蜜桃视频网站| 在线观看视频91| 国产精品免费观看视频| 精品午夜一区二区三区在线观看| 精品视频一区三区九区| **性色生活片久久毛片| 国产精品一区免费视频| 日韩女优av电影| 视频一区二区中文字幕| 在线观看精品一区| 亚洲欧洲另类国产综合| 高清不卡一区二区| 精品成a人在线观看| 人人爽香蕉精品| 欧美影院午夜播放| 亚洲欧美二区三区| 99re视频这里只有精品| 中文字幕免费不卡在线| 国产美女一区二区| 久久综合九色综合欧美就去吻| 日韩成人免费在线| 欧美电影一区二区| 午夜视频一区二区三区| 欧美三级乱人伦电影| 亚洲影视在线观看| 色婷婷久久一区二区三区麻豆| 国产精品福利一区二区三区| 国产成人亚洲综合a∨猫咪| 久久久久久一二三区| 国产精品一区二区黑丝| 欧美精品一区二区三区蜜桃视频| 日本亚洲电影天堂| 欧美一区二区视频在线观看2020 | 狠狠色狠狠色合久久伊人| 亚洲国产视频在线| 欧美三级蜜桃2在线观看| 午夜欧美视频在线观看| 777亚洲妇女| 久久精品国产亚洲高清剧情介绍 | 欧美一区二区成人6969| 久久99精品国产麻豆不卡| 精品av综合导航| 国产成人av电影| 亚洲女女做受ⅹxx高潮| 在线视频你懂得一区二区三区| 亚洲夂夂婷婷色拍ww47| 欧美日韩亚洲综合在线| 日本一不卡视频| 国产亚洲精品7777| 色婷婷综合久久久久中文| 夜色激情一区二区| 日韩一区二区高清| 国产经典欧美精品| 一区二区三区精密机械公司| 7777精品伊人久久久大香线蕉| 精品写真视频在线观看| 中文字幕成人网| 欧美色综合影院| 精品无人区卡一卡二卡三乱码免费卡| 国产日韩精品一区二区浪潮av| 91视频国产观看| 青青草97国产精品免费观看无弹窗版| 久久精品人人爽人人爽| 91精品福利视频| 精品一区二区三区免费观看|