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

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

?? os_task.c

?? 這是AVR單片機移植UCOS
?? C
?? 第 1 頁 / 共 4 頁
字號:
                }
            } else {
                OS_EXIT_CRITICAL();
            }
        } else {                                              /* Must be pending on event              */
            OS_EXIT_CRITICAL();
        }
        return (OS_ERR_NONE);
    }
    OS_EXIT_CRITICAL();
    return (OS_ERR_TASK_NOT_SUSPENDED);
}
#endif
/*$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_ERR_NONE            upon success
*              OS_ERR_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_ERR_TASK_NOT_EXIST  if the desired task has not been created or is assigned to a Mutex PIP
*              OS_ERR_TASK_OPT        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_STAT_STK_CHK_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
INT8U  OSTaskStkChk (INT8U prio, OS_STK_DATA *p_stk_data)
{
    OS_TCB    *ptcb;
    OS_STK    *pchk;
    INT32U     nfree;
    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_ERR_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_ERR_TASK_NOT_EXIST);
    }
    if (ptcb == OS_TCB_RESERVED) {
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_NOT_EXIST);
    }
    if ((ptcb->OSTCBOpt & OS_TASK_OPT_STK_CHK) == 0) { /* Make sure stack checking option is set       */
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_OPT);
    }
    nfree = 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 */
        nfree++;
    }
#else
    while (*pchk-- == (OS_STK)0) {
        nfree++;
    }
#endif
    p_stk_data->OSFree = nfree * sizeof(OS_STK);          /* Compute number of free bytes on the stack */
    p_stk_data->OSUsed = (size - nfree) * sizeof(OS_STK); /* Compute number of bytes used on the stack */
    return (OS_ERR_NONE);
}
#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_ERR_NONE               if the requested task is suspended
*              OS_ERR_TASK_SUSPEND_IDLE  if you attempted to suspend the idle task which is not allowed.
*              OS_ERR_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_ERR_TASK_SUSPEND_PRIO  if the task to suspend does not exist
*              OS_ERR_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 = 0;
#endif



#if OS_ARG_CHK_EN > 0
    if (prio == OS_TASK_IDLE_PRIO) {                            /* Not allowed to suspend idle task    */
        return (OS_ERR_TASK_SUSPEND_IDLE);
    }
    if (prio >= OS_LOWEST_PRIO) {                               /* Task priority valid ?               */
        if (prio != OS_PRIO_SELF) {
            return (OS_ERR_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_ERR_TASK_SUSPEND_PRIO);
    }
    if (ptcb == OS_TCB_RESERVED) {                              /* See if assigned to Mutex            */
        OS_EXIT_CRITICAL();
        return (OS_ERR_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();                                             /* Find new highest priority task      */
    }
    return (OS_ERR_NONE);
}
#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_ERR_NONE            if the requested task is suspended
*              OS_ERR_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_ERR_PRIO            if the desired task has not been created
*              OS_ERR_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)
{
    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_ERR_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_ERR_PRIO);
    }
    if (ptcb == OS_TCB_RESERVED) {               /* Task to query must not be assigned to a Mutex      */
        OS_EXIT_CRITICAL();
        return (OS_ERR_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_ERR_NONE);
}
#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_STAT_STK_CHK_EN > 0) && (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电影| 麻豆精品在线看| 91浏览器打开| 久久欧美中文字幕| 三级影片在线观看欧美日韩一区二区 | 亚洲品质自拍视频| 免费在线观看日韩欧美| 色综合久久综合网欧美综合网| 日韩欧美在线影院| 亚洲va欧美va人人爽午夜| 国产精品99久久久久久久vr| 欧美日韩成人综合在线一区二区| 国产精品成人一区二区三区夜夜夜| 免费久久99精品国产| 欧美亚洲国产bt| 亚洲欧美日韩国产综合在线| 国精产品一区一区三区mba桃花 | 9色porny自拍视频一区二区| 欧美大白屁股肥臀xxxxxx| 亚洲五月六月丁香激情| 97久久精品人人做人人爽50路| 久久久综合视频| 韩国三级在线一区| 日韩三级视频中文字幕| 偷拍与自拍一区| 欧美三级电影网站| 亚洲一级二级三级| 欧美性受xxxx黑人xyx| 亚洲美女免费在线| 91蝌蚪porny九色| 亚洲欧洲制服丝袜| 99re视频精品| 亚洲精品精品亚洲| 91福利资源站| 午夜精品久久久久久不卡8050| 91美女精品福利| 樱花草国产18久久久久| 91九色02白丝porn| 亚洲一区二区三区四区五区黄| 在线中文字幕一区| 亚洲国产婷婷综合在线精品| 欧美日韩久久一区二区| 天天综合天天做天天综合| 69成人精品免费视频| 日本亚洲最大的色成网站www| 日韩欧美激情四射| 国产成人免费视频网站| 国产精品久久久久久亚洲毛片 | 在线免费不卡视频| 国产成人av电影在线观看| 久久久久久久精| 91在线一区二区三区| 亚洲成a人v欧美综合天堂| 91精品国产综合久久小美女| 国产一区二区成人久久免费影院 | 美女在线一区二区| 欧美国产综合一区二区| 99re热这里只有精品免费视频| 一区二区三区在线影院| 日韩一区二区在线播放| 国产成人99久久亚洲综合精品| 亚洲精品国产视频| 日韩视频在线观看一区二区| 国产精品123区| 夜夜揉揉日日人人青青一国产精品| 欧美一级电影网站| 波多野结衣91| 美女视频网站久久| 国产精品国产三级国产aⅴ入口 | 亚洲一区二区三区精品在线| 日韩一二三区视频| 成人黄色网址在线观看| 丝袜亚洲另类丝袜在线| 欧美—级在线免费片| 欧美日韩精品一区二区在线播放| 精品中文字幕一区二区| 亚洲素人一区二区| 精品久久久三级丝袜| 色综合久久久久| 国产在线精品不卡| 亚洲午夜影视影院在线观看| 久久人人爽爽爽人久久久| 在线观看中文字幕不卡| 日韩午夜激情免费电影| 91丨porny丨国产| 国产一区二区精品久久99| 午夜视黄欧洲亚洲| 亚洲精品中文在线观看| 国产婷婷色一区二区三区四区| 欧美日韩你懂得| 91香蕉视频污| 成人一区二区三区视频在线观看| 日韩高清电影一区| 一区二区在线观看视频| 久久久午夜精品理论片中文字幕| 欧美久久久久中文字幕| 91免费看片在线观看| 国产xxx精品视频大全| 美日韩黄色大片| 日韩精品福利网| 亚洲综合久久久| 亚洲欧美激情一区二区| 国产精品女主播在线观看| 久久综合九色综合97婷婷| 欧美一区2区视频在线观看| 91久久国产最好的精华液| 99精品桃花视频在线观看| 粉嫩av一区二区三区在线播放| 久久激五月天综合精品| 奇米精品一区二区三区在线观看 | 欧美一区午夜精品| 欧美性猛交xxxxxxxx| 91精品办公室少妇高潮对白| 色综合一个色综合| 91免费版在线看| 色狠狠一区二区三区香蕉| 91看片淫黄大片一级| 99re视频这里只有精品| 久久综合色天天久久综合图片| 日韩欧美卡一卡二| 欧美精品一区二区三区在线| 精品国产凹凸成av人导航| 精品久久久久香蕉网| 精品国产一区二区国模嫣然| 亚洲精品在线三区| 日本一区二区成人| 亚洲人成精品久久久久久| 一区二区三区不卡在线观看| 亚洲一级二级三级在线免费观看| 亚洲成av人影院| 精品一区精品二区高清| 国产一区二区伦理片| 成人福利在线看| 色爱区综合激月婷婷| 欧美精品一卡二卡| 精品美女被调教视频大全网站| 久久久99精品免费观看| 国产精品成人网| 亚洲动漫第一页| 免费成人av资源网| 国产a区久久久| 欧美午夜精品一区二区三区| 欧美一区二区三区公司| 欧美激情在线看| 一区二区三区精品视频在线| 蜜臀久久99精品久久久久宅男| 国产成人在线免费| 欧美怡红院视频| 欧美电影免费观看高清完整版在线| 国产日韩欧美电影| 一区二区三区在线免费| 久久不见久久见免费视频1| 成人黄色a**站在线观看| 欧美伊人精品成人久久综合97| 日韩欧美一区二区久久婷婷| 国产女人18水真多18精品一级做| 亚洲欧美另类图片小说| 久久av老司机精品网站导航| 99久久精品免费精品国产| 欧美疯狂性受xxxxx喷水图片| 久久看人人爽人人| 亚洲高清久久久| 久久精品国产成人一区二区三区| 91啪亚洲精品| 久久伊99综合婷婷久久伊| 一区二区三区美女视频| 国产精品综合av一区二区国产馆| 在线观看亚洲成人| 亚洲国产激情av| 青青草原综合久久大伊人精品| 成人福利电影精品一区二区在线观看 | 欧美精三区欧美精三区| 中文字幕一区二区三区在线观看| 奇米在线7777在线精品| 在线精品视频小说1| 欧美国产1区2区| 九九九精品视频| 91精品免费观看| 亚洲一二三四区| 99热99精品| 中文一区二区完整视频在线观看 | 亚洲成人综合网站| 99精品在线免费| 国产精品乱子久久久久| 国产一区二区主播在线| 91麻豆精品国产自产在线观看一区 | 日韩午夜精品视频| 亚洲福利一区二区| 91激情在线视频| 亚洲欧美在线另类| 国产+成+人+亚洲欧洲自线| 亚洲国产一区二区三区青草影视| 不卡电影一区二区三区| 日本一区免费视频| 成人在线一区二区三区| 欧美精品一区二区蜜臀亚洲| 久88久久88久久久| 日韩美女在线视频| 蜜臀av性久久久久蜜臀aⅴ流畅|