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

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

?? os_task.c

?? mega128-ucos285-gcc-avrstdio可以和proteus7.4sp3一起仿真的好東西
?? 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一区二区三区免费野_久草精品视频
亚洲另类在线一区| 欧美精品一区二区在线观看| 国产黄色成人av| 国产老肥熟一区二区三区| 极品销魂美女一区二区三区| 蜜桃视频在线一区| 国产一区二区在线视频| 国产成人自拍网| av在线一区二区| 欧美影视一区二区三区| 欧美在线视频日韩| 欧美乱熟臀69xxxxxx| 91精品国产91久久久久久最新毛片| 欧美乱妇20p| 精品国产凹凸成av人导航| 久久精品视频在线免费观看 | 亚洲香肠在线观看| 亚洲va欧美va人人爽午夜| 日韩黄色片在线观看| 九九精品一区二区| 99久久精品情趣| 在线播放中文字幕一区| 精品成人a区在线观看| 1024成人网色www| 日韩影院精彩在线| 成人晚上爱看视频| 欧美四级电影网| 久久香蕉国产线看观看99| 亚洲欧美区自拍先锋| 秋霞成人午夜伦在线观看| 国产成人午夜精品影院观看视频| 97se亚洲国产综合自在线观| 欧美一级二级三级蜜桃| 国产精品欧美一区喷水| 奇米影视在线99精品| 99久久久久久99| 精品国产凹凸成av人网站| 亚洲午夜久久久久中文字幕久| 精品一区免费av| 欧美系列亚洲系列| 国产欧美日韩不卡| 日本在线播放一区二区三区| av成人免费在线| 亚洲精品在线免费播放| 亚洲国产cao| 色呦呦日韩精品| 欧美激情在线观看视频免费| 天堂一区二区在线| 一本到不卡精品视频在线观看| 欧美大胆一级视频| 亚洲高清在线精品| 91麻豆国产福利在线观看| 国产午夜精品久久久久久久| 日韩精品电影在线| 欧美色窝79yyyycom| 国产精品初高中害羞小美女文| 精品一区二区三区香蕉蜜桃| 欧美日韩国产精品成人| 亚洲精品国产成人久久av盗摄| 国产成人精品影视| 久久日一线二线三线suv| 日韩电影一区二区三区四区| 欧美日韩中文字幕一区| 亚洲人精品一区| 不卡电影免费在线播放一区| 久久麻豆一区二区| 国产成人综合在线播放| 欧美成人一区二区三区片免费| 日韩精品电影一区亚洲| 欧美一区二区三区精品| 日本一区中文字幕| 欧美成人综合网站| 久久精品99国产精品日本| 精品国偷自产国产一区| 国产中文字幕精品| 国产日韩精品久久久| 国产黄色精品网站| 中文字幕一区日韩精品欧美| 成人av网址在线| 亚洲最大成人网4388xx| 欧美日韩国产在线观看| 日韩中文字幕一区二区三区| 欧美肥妇free| 国产在线精品一区二区夜色| 国产欧美一区二区精品忘忧草| 国产91综合网| 亚洲精品视频在线观看网站| 欧美丝袜丝交足nylons| 免费视频最近日韩| 国产日产精品一区| 91女厕偷拍女厕偷拍高清| 亚洲一区中文在线| 宅男噜噜噜66一区二区66| 九九视频精品免费| |精品福利一区二区三区| 欧美日韩一区二区在线视频| 日本大胆欧美人术艺术动态| 日韩精品一区二区三区在线观看| 国产一区二区三区香蕉| 日韩一区欧美一区| 欧美日本韩国一区| 国产成人av福利| 亚洲电影激情视频网站| 欧美精品一区二区在线观看| 91麻豆福利精品推荐| 蜜臀av亚洲一区中文字幕| 国产精品丝袜久久久久久app| 欧美亚洲日本国产| 国产乱对白刺激视频不卡| 亚洲一区二区三区四区五区中文| 精品国产电影一区二区| 91国偷自产一区二区三区成为亚洲经典 | 亚洲成av人片观看| 久久久久久久久久久99999| 972aa.com艺术欧美| 久久精品免费看| 亚洲少妇最新在线视频| 精品免费99久久| 一本久久a久久精品亚洲| 免费av网站大全久久| 亚洲日本韩国一区| 久久久91精品国产一区二区精品 | 欧美一区二区三区思思人| 成人在线视频首页| 久久精品国产精品青草| 亚洲午夜免费电影| 亚洲人成网站色在线观看| 久久婷婷一区二区三区| 777午夜精品视频在线播放| av在线播放不卡| 成人性生交大合| 韩国中文字幕2020精品| 丝袜诱惑亚洲看片| 亚洲日本护士毛茸茸| 欧美激情一区二区三区| 久久综合色天天久久综合图片| 欧美日韩免费电影| 在线视频欧美区| 色偷偷一区二区三区| 91女人视频在线观看| 不卡一区在线观看| 夫妻av一区二区| 国产成人精品在线看| 国产精品一区二区久激情瑜伽| 久久国产视频网| 久久精品国产**网站演员| 天堂在线亚洲视频| 日本aⅴ亚洲精品中文乱码| 偷窥国产亚洲免费视频| 亚洲成人一区二区在线观看| 亚洲一级二级在线| 亚洲福利视频一区| 亚洲国产精品久久一线不卡| 日韩毛片精品高清免费| 亚洲欧美自拍偷拍| 亚洲综合一二区| 香蕉久久一区二区不卡无毒影院| 亚洲精品国产一区二区精华液| 亚洲男人的天堂在线aⅴ视频| 亚洲人成精品久久久久久| 亚洲乱码日产精品bd| 亚洲综合色区另类av| 婷婷综合另类小说色区| 麻豆成人久久精品二区三区小说| 激情五月婷婷综合| 成人免费看黄yyy456| 91视频com| 欧美精品一卡二卡| 亚洲精品一区二区三区福利| 国产欧美一区二区三区在线看蜜臀| 欧美国产一区在线| 亚洲精品日韩综合观看成人91| 亚洲图片欧美视频| 精品影院一区二区久久久| 成人av第一页| 欧美精品成人一区二区三区四区| 欧美大度的电影原声| 日韩伦理av电影| 天天操天天干天天综合网| 免费av成人在线| 99re这里只有精品首页| 欧美日韩国产美| 久久久久久夜精品精品免费| 亚洲免费毛片网站| 国产一区福利在线| 日本韩国欧美一区二区三区| 91色九色蝌蚪| 欧美刺激午夜性久久久久久久| 欧美激情艳妇裸体舞| 亚洲成a人片综合在线| 国模娜娜一区二区三区| 欧美综合久久久| 国产天堂亚洲国产碰碰| 午夜av区久久| 99久久精品国产精品久久| 欧美一卡二卡三卡| 亚洲成人777| 色哟哟精品一区| 欧美国产日韩在线观看| 免费成人在线视频观看|