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

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

?? os_task.c

?? 基于ARM的嵌入式代碼
?? 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久久99久久综合| 99久久久久久99| 日韩欧美一级精品久久| 亚洲欧美偷拍三级| 久久99深爱久久99精品| 欧美中文字幕不卡| 国产日产欧美一区二区三区| 日本不卡视频在线| 欧洲国产伦久久久久久久| 国产视频视频一区| 蜜桃av噜噜一区| 欧美性猛交xxxx乱大交退制版| 国产亚洲婷婷免费| 韩国精品在线观看| 日韩免费观看高清完整版| 亚洲一区二区三区爽爽爽爽爽| 国产99久久久国产精品潘金网站| 日韩视频一区二区三区在线播放| 亚洲午夜久久久久| 色94色欧美sute亚洲线路一久| 国产精品素人视频| 国产成+人+日韩+欧美+亚洲| 欧美成人精品1314www| 日本麻豆一区二区三区视频| 在线观看91精品国产麻豆| 亚洲成人免费在线| 欧美色图一区二区三区| 亚洲综合色噜噜狠狠| 91精品福利在线| 一区二区三区不卡视频| 在线一区二区三区四区五区| 亚洲主播在线观看| 欧美亚洲愉拍一区二区| 亚洲香蕉伊在人在线观| 欧美日韩一区二区在线观看视频| 亚洲影视在线播放| 欧美日韩午夜精品| 日韩综合一区二区| 欧美一区二区三区视频免费播放| 日韩精品久久理论片| 日韩视频中午一区| 国产一区二区三区日韩| 欧美高清在线精品一区| 成人av在线资源网| 亚洲一区二区三区激情| 91精品国产入口| 国产精品自在欧美一区| 国产精品毛片久久久久久久| 91亚洲永久精品| 亚洲成人三级小说| 2022国产精品视频| 99久久精品免费看国产| 五月综合激情日本mⅴ| 日韩美女一区二区三区四区| 国产高清无密码一区二区三区| 成人免费在线播放视频| 欧美日韩一区二区在线视频| 激情久久久久久久久久久久久久久久| 国产亚洲精品aa午夜观看| 色综合久久久网| 日本女人一区二区三区| 日本一区二区成人| 欧美男人的天堂一二区| 久久超碰97中文字幕| 中文字幕一区二区三区视频| 欧美日韩一级黄| 国产精品乡下勾搭老头1| 亚洲蜜臀av乱码久久精品| 日韩一区二区中文字幕| 99久久久久免费精品国产| 天堂久久久久va久久久久| 国产精品久久夜| 日韩一区国产二区欧美三区| 99视频在线精品| 精品一区二区在线看| 亚洲美女屁股眼交3| 久久色视频免费观看| 欧美综合一区二区| 国产精品1区2区3区在线观看| 亚洲国产日产av| 欧美国产97人人爽人人喊| 91精品国产91久久综合桃花| 99国产精品99久久久久久| 精品在线观看视频| 亚洲国产成人porn| 亚洲欧洲日产国产综合网| 精品国产亚洲在线| 欧美精品在线视频| 在线观看免费成人| 91小视频在线免费看| 国产iv一区二区三区| 久久成人麻豆午夜电影| 日韩精品一级二级| 亚洲伊人色欲综合网| **网站欧美大片在线观看| 国产欧美va欧美不卡在线| 日韩午夜在线观看视频| 欧美精品一级二级| 91视视频在线观看入口直接观看www| 国产精一区二区三区| 极品少妇xxxx精品少妇| 蜜桃精品视频在线观看| 午夜精品视频一区| 亚洲国产wwwccc36天堂| 亚洲自拍偷拍欧美| 亚洲综合一区在线| 亚洲综合偷拍欧美一区色| 亚洲美女视频在线| 亚洲乱码国产乱码精品精小说| 国产精品色在线| 综合av第一页| 亚洲精品国产a| 亚洲激情图片小说视频| 亚洲美女屁股眼交3| 一级日本不卡的影视| 一区二区三区日本| 亚洲不卡在线观看| 蜜臀va亚洲va欧美va天堂| 久久se精品一区二区| 韩国欧美一区二区| 成人免费va视频| 99久久综合国产精品| 成人免费视频视频在线观看免费| 成人国产精品视频| 91免费观看视频在线| 欧美亚洲愉拍一区二区| 欧美美女网站色| 欧美成人一区二区| 国产日韩在线不卡| 亚洲天堂成人网| 亚洲国产精品麻豆| 日韩黄色片在线观看| 久久黄色级2电影| 福利一区二区在线观看| 色综合视频一区二区三区高清| 欧美三级电影在线看| 日韩欧美一级在线播放| 欧美国产精品一区二区| 亚洲综合色视频| 精品一区二区av| 色综合久久综合网| 日韩欧美中文字幕一区| 日本一区二区三区在线不卡| 亚洲精品久久7777| 六月丁香婷婷久久| 9l国产精品久久久久麻豆| 欧美在线|欧美| 精品久久久网站| 一区二区三区日韩精品视频| 麻豆91精品91久久久的内涵| 成人激情图片网| 欧美另类高清zo欧美| 国产欧美一区二区三区在线看蜜臀| 亚洲影视在线播放| 国产美女娇喘av呻吟久久| 在线观看日韩毛片| 久久久噜噜噜久久中文字幕色伊伊| 一区二区三区在线观看视频| 久久av中文字幕片| 色婷婷av一区二区| 久久综合精品国产一区二区三区| 一区二区在线观看视频| 精品亚洲aⅴ乱码一区二区三区| 色综合中文综合网| 亚洲va韩国va欧美va| 成人中文字幕在线| 欧美三电影在线| 国产精品久久毛片av大全日韩| 免费久久99精品国产| 色婷婷综合久久久久中文一区二区| 久久美女高清视频| 三级不卡在线观看| 日本高清不卡aⅴ免费网站| 精品国产髙清在线看国产毛片| 一区二区日韩av| 91亚洲精品乱码久久久久久蜜桃 | 狠狠色丁香婷婷综合| 在线中文字幕不卡| 亚洲视频精选在线| 成人动漫中文字幕| 国产亚洲综合性久久久影院| 日本最新不卡在线| 欧美日本不卡视频| 亚洲在线成人精品| 色婷婷久久一区二区三区麻豆| 国产精品入口麻豆九色| 国内不卡的二区三区中文字幕 | 欧美三级视频在线播放| 1024国产精品| 91在线云播放| 国产精品国产a| 99久精品国产| 亚洲精品视频在线观看网站| 91丝袜国产在线播放| 一区二区三区丝袜| 精品视频一区 二区 三区| 亚洲成人免费视| 这里只有精品99re| 久久99国产精品免费网站|