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

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

?? os_task.c

?? 我 Porting 的 uC/OS-II V2.84 (目前Micrium)最新版之 Keil C51 工程,專供給 8051 上做任務調度,我已將 Code Size 改小至 4000 Byte,對
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
*********************************************************************************************************
*                                             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
*              OS_ERR_PDATA_NULL   if 'p_stk_data' is a NULL pointer
*********************************************************************************************************
*/
#if OS_TASK_CREATE_EXT_EN > 0
INT8U  OSTaskStkChk (INT8U prio, OS_STK_DATA *p_stk_data) reentrant
{
    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 = 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_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_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) reentrant
{
    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_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 = 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_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] == 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();
    }
    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
*              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) reentrant
{
    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_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_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)	reentrant
{
    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电影在线| 日韩精品欧美精品| 激情久久五月天| 高清不卡一区二区在线| 91国偷自产一区二区开放时间| 在线亚洲欧美专区二区| 7878成人国产在线观看| 欧美成人午夜电影| 日本一区二区综合亚洲| 亚洲欧美电影院| 爽好久久久欧美精品| 国产综合色产在线精品| 99久久99精品久久久久久| 欧美人动与zoxxxx乱| 欧美白人最猛性xxxxx69交| 久久久国产精品不卡| 亚洲精品欧美专区| 乱一区二区av| 99国内精品久久| 日韩午夜精品电影| 中文字幕一区二区三区四区不卡 | 中文字幕精品一区二区精品绿巨人| 久久精品欧美日韩精品 | 偷拍日韩校园综合在线| 国产成人综合亚洲网站| 欧美影视一区二区三区| www国产精品av| 亚洲成人激情自拍| 波多野结衣中文字幕一区二区三区| 在线观看国产一区二区| 久久久国产午夜精品| 五月综合激情网| 色婷婷精品大视频在线蜜桃视频| 日韩一区二区精品在线观看| 亚洲视频免费观看| 国产在线看一区| 欧美午夜视频网站| 亚洲视频网在线直播| 狠狠久久亚洲欧美| 91精品国产福利| 亚洲精选视频免费看| 成人av资源在线| 欧美mv和日韩mv的网站| 亚洲国产日韩精品| 一本大道av伊人久久综合| 久久夜色精品国产噜噜av| 丝袜亚洲另类欧美综合| 欧美视频你懂的| 伊人婷婷欧美激情| 97精品国产97久久久久久久久久久久| 久久综合资源网| 久久精品99国产精品日本| 91精品综合久久久久久| 亚洲宅男天堂在线观看无病毒| 成人国产精品免费| 国产欧美日韩在线| 国产精品亚洲午夜一区二区三区| 日韩亚洲欧美一区| 麻豆国产精品一区二区三区| 欧美久久一区二区| 污片在线观看一区二区| 884aa四虎影成人精品一区| 亚洲成av人片一区二区| 欧美日韩视频第一区| 亚洲无人区一区| 精品1区2区3区| 日韩av高清在线观看| 欧美一区二区三区四区在线观看| 免费日韩伦理电影| 精品国产1区2区3区| 国产精品99久久不卡二区| 国产视频一区二区在线观看| 高清在线不卡av| 中文字幕视频一区二区三区久| 91在线码无精品| 亚洲综合在线五月| 51精品国自产在线| 国产九色sp调教91| 中文字幕欧美一区| 欧美色手机在线观看| 久久99国产精品免费| 国产三级精品视频| 99国产麻豆精品| 日本va欧美va瓶| 亚洲国产精品成人综合| 91社区在线播放| 天堂成人国产精品一区| 久久久综合激的五月天| 不卡av免费在线观看| 亚洲国产aⅴ天堂久久| 久久综合成人精品亚洲另类欧美| 成人免费黄色在线| 午夜免费久久看| 国产欧美精品国产国产专区| 97se亚洲国产综合在线| 日本sm残虐另类| 亚洲欧洲日韩女同| 日韩一级黄色片| 色婷婷av久久久久久久| 蜜臀精品久久久久久蜜臀| 国产精品美女久久久久久2018| 欧美天天综合网| 成人美女在线视频| 蜜臀久久99精品久久久久久9| 国产精品卡一卡二| 欧美电影精品一区二区| 色综合天天综合网天天狠天天| 日本女优在线视频一区二区| 中文字幕不卡在线播放| 欧美一区二区免费视频| 色悠悠久久综合| 国产一区二区三区免费| 天天av天天翘天天综合网| 国产精品无遮挡| 精品三级av在线| 欧美精品tushy高清| 色狠狠桃花综合| 成人精品gif动图一区| 国产一区二区视频在线| 午夜精品免费在线| 亚洲另类春色校园小说| 国产精品毛片a∨一区二区三区| 日韩亚洲电影在线| 67194成人在线观看| 精品污污网站免费看| 99久久久久久99| 不卡视频在线看| 丁香激情综合五月| 黑人巨大精品欧美一区| 日韩高清一区二区| 婷婷综合在线观看| 亚洲国产精品久久一线不卡| 国产精品激情偷乱一区二区∴| 久久综合国产精品| 国产午夜亚洲精品不卡| 久久精品亚洲精品国产欧美kt∨| 日韩视频免费观看高清完整版在线观看 | 日本一区二区在线不卡| 26uuu久久天堂性欧美| 精品国产乱码久久久久久久 | av电影天堂一区二区在线| 高清国产一区二区三区| 丁香啪啪综合成人亚洲小说| 国产传媒一区在线| 波多野结衣精品在线| 91香蕉视频在线| 色婷婷综合久久久| 欧美酷刑日本凌虐凌虐| 欧美一区二区三区日韩视频| 日韩久久精品一区| 2欧美一区二区三区在线观看视频| 欧美精品一区二区三区在线| 精品国产乱码久久久久久夜甘婷婷 | 日本高清无吗v一区| 91在线观看成人| 欧美系列亚洲系列| 日韩一区二区三区三四区视频在线观看 | 久久综合给合久久狠狠狠97色69| 久久久久久久久久久久久久久99 | 国产一区二区导航在线播放| 国产成人无遮挡在线视频| 99精品视频在线免费观看| 在线影院国内精品| 日韩欧美国产系列| 中文欧美字幕免费| 亚洲国产美国国产综合一区二区| 日韩精品国产欧美| 国产精品一区二区三区乱码| av亚洲精华国产精华精| 777色狠狠一区二区三区| 欧美本精品男人aⅴ天堂| 亚洲欧美偷拍卡通变态| 日韩福利视频导航| av在线一区二区| 精品久久一区二区三区| 亚洲精品日日夜夜| 国产真实乱偷精品视频免| 在线免费视频一区二区| 26uuu国产在线精品一区二区| 亚洲欧美日韩国产一区二区三区| 奇米888四色在线精品| 91在线视频在线| 久久理论电影网| 丝袜亚洲另类欧美| 色综合色综合色综合色综合色综合| 日韩一区二区三区视频在线| 亚洲精品视频在线观看网站| 国产一区二区福利| 日韩欧美国产成人一区二区| 亚洲免费电影在线|