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

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

?? os_task.c

?? 最小的嵌入式操作系統(tǒng)
?? 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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区国产精华| 91捆绑美女网站| 欧美美女网站色| 亚洲精品午夜久久久| 99久久综合99久久综合网站| 日韩午夜激情免费电影| 极品销魂美女一区二区三区| 日韩一区二区精品在线观看| 日日摸夜夜添夜夜添精品视频| 欧美日韩一区不卡| 亚洲成人av在线电影| 欧美亚洲一区二区在线观看| 亚洲自拍偷拍麻豆| 欧美日本免费一区二区三区| 亚洲va天堂va国产va久| 欧美理论在线播放| 麻豆精品视频在线观看视频| 日韩欧美成人一区| 国产美女精品一区二区三区| 国产欧美一区二区精品久导航| 国产成人一区在线| 久久综合精品国产一区二区三区 | 日韩一区二区三区高清免费看看| 激情综合网激情| 久久久久久久久久久99999| 国产成人在线观看免费网站| 亚洲免费电影在线| 欧美日韩精品专区| 另类成人小视频在线| 欧美国产激情二区三区| 一本色道久久综合亚洲91| 亚洲图片欧美视频| 欧美一区二区三区视频免费| 国产91精品一区二区麻豆网站 | 一区av在线播放| 欧美精品自拍偷拍动漫精品| 激情综合色播激情啊| 亚洲欧洲日本在线| 7777精品伊人久久久大香线蕉经典版下载| 青青草原综合久久大伊人精品 | 欧美日韩精品高清| 精品一区二区久久久| 午夜欧美视频在线观看| 亚洲欧洲精品一区二区精品久久久| 欧美午夜视频网站| 久草中文综合在线| 一区二区三国产精华液| 日韩精品一区二区三区蜜臀| 91久久久免费一区二区| 九一久久久久久| 亚洲午夜激情av| 欧美国产精品中文字幕| 欧美精品三级日韩久久| 国产福利一区二区三区视频| 亚洲图片一区二区| 国产精品天天看| 欧美电影影音先锋| 色视频一区二区| 国产精品一级黄| 日本午夜精品视频在线观看| 亚洲人成精品久久久久久| 欧美成人精品福利| 欧美在线观看视频一区二区三区| 国产在线麻豆精品观看| 亚洲mv在线观看| 18涩涩午夜精品.www| 久久美女艺术照精彩视频福利播放| 欧美影视一区在线| 91视频观看视频| 国产99久久久精品| 国产一区二三区好的| 视频一区二区三区中文字幕| 五月天亚洲婷婷| 亚洲一区精品在线| 亚洲综合男人的天堂| 自拍av一区二区三区| 国产亚洲1区2区3区| 日韩精品中文字幕在线一区| 欧美裸体一区二区三区| 91视频你懂的| 色菇凉天天综合网| 99麻豆久久久国产精品免费优播| 国产乱对白刺激视频不卡| 蜜桃视频在线一区| 日韩av中文字幕一区二区| 亚洲小说欧美激情另类| 亚洲精品免费视频| 亚洲黄网站在线观看| 成人免费在线观看入口| 亚洲女人的天堂| 一区二区三区日韩| 亚洲一区二区三区四区在线免费观看 | 欧美一级爆毛片| 9191成人精品久久| 一本一本久久a久久精品综合麻豆| aaa亚洲精品| 色综合中文字幕国产 | 欧美怡红院视频| 欧美老肥妇做.爰bbww| 精品999久久久| 国产精品国产成人国产三级| 一区二区三区在线观看欧美| 一区二区三区av电影| 亚洲成精国产精品女| 日韩福利视频导航| 久久精品国产亚洲高清剧情介绍| 老司机免费视频一区二区三区| 蜜臀久久99精品久久久画质超高清| 美女一区二区在线观看| 国产乱码精品一品二品| 成人黄色在线视频| 91免费观看视频在线| 欧美精品一卡二卡| 精品少妇一区二区三区| 国产精品嫩草影院av蜜臀| 亚洲欧洲精品天堂一级| 亚洲最新视频在线观看| 日韩影院免费视频| 国产一区二区三区在线观看免费视频 | 在线欧美小视频| 欧美人动与zoxxxx乱| 精品国产免费视频| 国产精品久久久久影院老司| 亚洲第一二三四区| 精品综合免费视频观看| eeuss影院一区二区三区| yourporn久久国产精品| 欧美婷婷六月丁香综合色| 欧美视频三区在线播放| 91精品国产91久久久久久一区二区| 国产日韩影视精品| 亚洲综合免费观看高清在线观看| 972aa.com艺术欧美| 欧美剧在线免费观看网站 | 激情五月播播久久久精品| 成人精品鲁一区一区二区| 欧美综合亚洲图片综合区| 精品免费视频.| 亚洲男人的天堂在线aⅴ视频| 男女性色大片免费观看一区二区| 国产传媒欧美日韩成人| 欧美乱妇23p| 亚洲日本一区二区| 国产乱对白刺激视频不卡| 欧美三级欧美一级| 欧美激情一区二区| 视频一区视频二区中文| 99综合电影在线视频| 欧美一区二区三区四区五区| 国产精品美女久久久久久2018| 天天av天天翘天天综合网色鬼国产| 丁香桃色午夜亚洲一区二区三区| 欧美酷刑日本凌虐凌虐| 亚洲免费观看高清完整版在线| 久久99精品久久久久久| 欧美在线观看一区| 亚洲欧洲美洲综合色网| 国产一区啦啦啦在线观看| 欧美军同video69gay| 亚洲欧美在线aaa| 国产又黄又大久久| 欧美一级高清片在线观看| 亚洲国产cao| 国产高清精品网站| 欧美剧在线免费观看网站| 亚洲欧洲无码一区二区三区| 丝袜亚洲另类欧美| 福利电影一区二区| www国产精品av| 另类小说图片综合网| 欧美精品久久久久久久多人混战 | 日韩一级欧美一级| 亚洲综合久久av| 色婷婷久久久亚洲一区二区三区| 久久精品视频免费| 国产一区二区三区免费在线观看| 欧美日韩成人综合天天影院| 亚洲综合在线五月| 色婷婷国产精品综合在线观看| 国产精品久久久久aaaa樱花 | 国产精品久久久久精k8 | 成人午夜免费av| 欧美日韩精品电影| 久久精品夜色噜噜亚洲a∨| 久久精品国产秦先生| 欧美精品久久天天躁| 日韩精品亚洲一区二区三区免费| 91丨porny丨首页| 国产欧美一区二区三区在线看蜜臀| 麻豆成人久久精品二区三区红 | 国产美女在线观看一区| 久久久国产一区二区三区四区小说| 韩国成人精品a∨在线观看| 久久亚洲一区二区三区明星换脸| 免费欧美在线视频| 欧美精品一区二区三区蜜臀| 成人伦理片在线| 亚洲大尺度视频在线观看| 欧美军同video69gay| 韩国精品在线观看|