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

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

?? ucos ii v2.9 ?

?? uCOSII_V2.9
?? 9 ?
?? 第 1 頁 / 共 4 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                              (c) Copyright 1992-2009, Micrium, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_TASK.C
* By      : Jean J. Labrosse
* Version : V2.91
*
* LICENSING TERMS:
* ---------------
*   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.
* If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly license
* its use in your product. We provide ALL the source code for your convenience and to help you experience
* uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  paying a
* licensing fee.
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include <ucos_ii.h>
#endif

/*$PAGE*/
/*
*********************************************************************************************************
*                                        CHANGE PRIORITY OF A TASK
*
* Description: This function allows you to change the priority of a task dynamically.  Note that the new
*              priority MUST be available.
*
* Arguments  : oldp     is the old priority
*
*              newp     is the new priority
*
* Returns    : OS_ERR_NONE            is the call was successful
*              OS_ERR_PRIO_INVALID    if the priority you specify is higher that the maximum allowed
*                                     (i.e. >= OS_LOWEST_PRIO)
*              OS_ERR_PRIO_EXIST      if the new priority already exist.
*              OS_ERR_PRIO            there is no task with the specified OLD priority (i.e. the OLD task does
*                                     not exist.
*              OS_ERR_TASK_NOT_EXIST  if the task is assigned to a Mutex PIP.
*********************************************************************************************************
*/

#if OS_TASK_CHANGE_PRIO_EN > 0u
INT8U  OSTaskChangePrio (INT8U  oldprio,
                         INT8U  newprio)
{
#if (OS_EVENT_EN)
    OS_EVENT  *pevent;
#if (OS_EVENT_MULTI_EN > 0u)
    OS_EVENT **pevents;
#endif
#endif
    OS_TCB    *ptcb;
    INT8U      y_new;
    INT8U      x_new;
    INT8U      y_old;
    OS_PRIO    bity_new;
    OS_PRIO    bitx_new;
    OS_PRIO    bity_old;
    OS_PRIO    bitx_old;
#if OS_CRITICAL_METHOD == 3u
    OS_CPU_SR  cpu_sr = 0u;                                 /* Storage for CPU status register         */
#endif


/*$PAGE*/
#if OS_ARG_CHK_EN > 0u
    if (oldprio >= OS_LOWEST_PRIO) {
        if (oldprio != OS_PRIO_SELF) {
            return (OS_ERR_PRIO_INVALID);
        }
    }
    if (newprio >= OS_LOWEST_PRIO) {
        return (OS_ERR_PRIO_INVALID);
    }
#endif
    OS_ENTER_CRITICAL();
    if (OSTCBPrioTbl[newprio] != (OS_TCB *)0) {             /* New priority must not already exist     */
        OS_EXIT_CRITICAL();
        return (OS_ERR_PRIO_EXIST);
    }
    if (oldprio == OS_PRIO_SELF) {                          /* See if changing self                    */
        oldprio = OSTCBCur->OSTCBPrio;                      /* Yes, get priority                       */
    }
    ptcb = OSTCBPrioTbl[oldprio];
    if (ptcb == (OS_TCB *)0) {                              /* Does task to change exist?              */
        OS_EXIT_CRITICAL();                                 /* No, can't change its priority!          */
        return (OS_ERR_PRIO);
    }
    if (ptcb == OS_TCB_RESERVED) {                          /* Is task assigned to Mutex               */
        OS_EXIT_CRITICAL();                                 /* No, can't change its priority!          */
        return (OS_ERR_TASK_NOT_EXIST);
    }
#if OS_LOWEST_PRIO <= 63u
    y_new                 = (INT8U)(newprio >> 3u);         /* Yes, compute new TCB fields             */
    x_new                 = (INT8U)(newprio & 0x07u);
#else
    y_new                 = (INT8U)((INT8U)(newprio >> 4u) & 0x0Fu);
    x_new                 = (INT8U)(newprio & 0x0Fu);
#endif
    bity_new              = (OS_PRIO)(1uL << y_new);
    bitx_new              = (OS_PRIO)(1uL << x_new);

    OSTCBPrioTbl[oldprio] = (OS_TCB *)0;                    /* Remove TCB from old priority            */
    OSTCBPrioTbl[newprio] =  ptcb;                          /* Place pointer to TCB @ new priority     */
    y_old                 =  ptcb->OSTCBY;
    bity_old              =  ptcb->OSTCBBitY;
    bitx_old              =  ptcb->OSTCBBitX;
    if ((OSRdyTbl[y_old] &   bitx_old) != 0u) {             /* If task is ready make it not            */
         OSRdyTbl[y_old] &= (OS_PRIO)~bitx_old;
         if (OSRdyTbl[y_old] == 0u) {
             OSRdyGrp &= (OS_PRIO)~bity_old;
         }
         OSRdyGrp        |= bity_new;                       /* Make new priority ready to run          */
         OSRdyTbl[y_new] |= bitx_new;
    }

#if (OS_EVENT_EN)
    pevent = ptcb->OSTCBEventPtr;
    if (pevent != (OS_EVENT *)0) {
        pevent->OSEventTbl[y_old] &= (OS_PRIO)~bitx_old;    /* Remove old task prio from wait list     */
        if (pevent->OSEventTbl[y_old] == 0u) {
            pevent->OSEventGrp    &= (OS_PRIO)~bity_old;
        }
        pevent->OSEventGrp        |= bity_new;              /* Add    new task prio to   wait list     */
        pevent->OSEventTbl[y_new] |= bitx_new;
    }
#if (OS_EVENT_MULTI_EN > 0u)
    if (ptcb->OSTCBEventMultiPtr != (OS_EVENT **)0) {
        pevents =  ptcb->OSTCBEventMultiPtr;
        pevent  = *pevents;
        while (pevent != (OS_EVENT *)0) {
            pevent->OSEventTbl[y_old] &= (OS_PRIO)~bitx_old;   /* Remove old task prio from wait lists */
            if (pevent->OSEventTbl[y_old] == 0u) {
                pevent->OSEventGrp    &= (OS_PRIO)~bity_old;
            }
            pevent->OSEventGrp        |= bity_new;          /* Add    new task prio to   wait lists    */
            pevent->OSEventTbl[y_new] |= bitx_new;
            pevents++;
            pevent                     = *pevents;
        }
    }
#endif
#endif

    ptcb->OSTCBPrio = newprio;                              /* Set new task priority                   */
    ptcb->OSTCBY    = y_new;
    ptcb->OSTCBX    = x_new;
    ptcb->OSTCBBitY = bity_new;
    ptcb->OSTCBBitX = bitx_new;
    OS_EXIT_CRITICAL();
    if (OSRunning == OS_TRUE) {
        OS_Sched();                                         /* Find new highest priority task          */
    }
    return (OS_ERR_NONE);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                            CREATE A TASK
*
* Description: This function is used to have uC/OS-II manage the execution of a task.  Tasks can either
*              be created prior to the start of multitasking or by a running task.  A task cannot be
*              created by an ISR.
*
* Arguments  : task     is a pointer to the task's code
*
*              p_arg    is a pointer to an optional data area which can be used to pass parameters to
*                       the task when the task first executes.  Where the task is concerned it thinks
*                       it was invoked and passed the argument 'p_arg' as follows:
*
*                           void Task (void *p_arg)
*                           {
*                               for (;;) {
*                                   Task code;
*                               }
*                           }
*
*              ptos     is a pointer to the task's top 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).  'pstk' will thus point to the highest (valid) memory
*                       location of the stack.  If OS_STK_GROWTH is set to 0, 'pstk' will point to the
*                       lowest memory location of the stack and the stack will grow with increasing
*                       memory locations.
*
*              prio     is the task's priority.  A unique priority MUST be assigned to each task and the
*                       lower the number, the higher the priority.
*
* Returns    : OS_ERR_NONE             if the function was successful.
*              OS_PRIO_EXIT            if the task priority already exist
*                                      (each task MUST have a unique priority).
*              OS_ERR_PRIO_INVALID     if the priority you specify is higher that the maximum allowed
*                                      (i.e. >= OS_LOWEST_PRIO)
*              OS_ERR_TASK_CREATE_ISR  if you tried to create a task from an ISR.
*********************************************************************************************************
*/

#if OS_TASK_CREATE_EN > 0u
INT8U  OSTaskCreate (void   (*task)(void *p_arg),
                     void    *p_arg,
                     OS_STK  *ptos,
                     INT8U    prio)
{
    OS_STK    *psp;
    INT8U      err;
#if OS_CRITICAL_METHOD == 3u                 /* Allocate storage for CPU status register               */
    OS_CPU_SR  cpu_sr = 0u;
#endif



#ifdef OS_SAFETY_CRITICAL_IEC61508
    if (OSSafetyCriticalStartFlag == OS_TRUE) {
        OS_SAFETY_CRITICAL_EXCEPTION();
    }
#endif

#if OS_ARG_CHK_EN > 0u
    if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
        return (OS_ERR_PRIO_INVALID);
    }
#endif
    OS_ENTER_CRITICAL();
    if (OSIntNesting > 0u) {                 /* Make sure we don't create the task from within an ISR  */
        OS_EXIT_CRITICAL();
        return (OS_ERR_TASK_CREATE_ISR);
    }
    if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority  */
        OSTCBPrioTbl[prio] = OS_TCB_RESERVED;/* Reserve the priority to prevent others from doing ...  */
                                             /* ... the same thing until task is created.              */
        OS_EXIT_CRITICAL();
        psp = OSTaskStkInit(task, p_arg, ptos, 0u);             /* Initialize the task's stack         */
        err = OS_TCBInit(prio, psp, (OS_STK *)0, 0u, 0u, (void *)0, 0u);
        if (err == OS_ERR_NONE) {
            if (OSRunning == OS_TRUE) {      /* Find highest priority task if multitasking has started */
                OS_Sched();
            }
        } else {
            OS_ENTER_CRITICAL();
            OSTCBPrioTbl[prio] = (OS_TCB *)0;/* Make this priority available to others                 */
            OS_EXIT_CRITICAL();
        }
        return (err);
    }
    OS_EXIT_CRITICAL();
    return (OS_ERR_PRIO_EXIST);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                     CREATE A TASK (Extended Version)
*
* Description: This function is used to have uC/OS-II manage the execution of a task.  Tasks can either
*              be created prior to the start of multitasking or by a running task.  A task cannot be
*              created by an ISR.  This function is similar to OSTaskCreate() except that it allows
*              additional information about a task to be specified.
*
* Arguments  : task      is a pointer to the task's code
*
*              p_arg     is a pointer to an optional data area which can be used to pass parameters to
*                        the task when the task first executes.  Where the task is concerned it thinks
*                        it was invoked and passed the argument 'p_arg' as follows:
*
*                            void Task (void *p_arg)
*                            {
*                                for (;;) {
*                                    Task code;
*                                }
*                            }
*
*              ptos      is a pointer to the task's top 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).  'ptos' will thus point to the highest (valid) memory
*                        location of the stack.  If OS_STK_GROWTH is set to 0, 'ptos' will point to the
*                        lowest memory location of the stack and the stack will grow with increasing
*                        memory locations.  'ptos' MUST point to a valid 'free' data item.
*
*              prio      is the task's priority.  A unique priority MUST be assigned to each task and the
*                        lower the number, the higher the priority.
*
*              id        is the task's ID (0..65535)
*
*              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.
*
*              stk_size  is the size of the stack in number of elements.  If OS_STK is set to INT8U,
*                        'stk_size' corresponds to the number of bytes available.  If OS_STK is set to
*                        INT16U, 'stk_size' contains the number of 16-bit entries available.  Finally, if
*                        OS_STK is set to INT32U, 'stk_size' contains the number of 32-bit entries
*                        available on the stack.
*
*              pext      is a pointer to a user supplied memory location which is used as a TCB extension.
*                        For example, this user memory can hold the contents of floating-point registers
*                        during a context switch, the time each task takes to execute, the number of times
*                        the task has been switched-in, etc.
*
*              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.  Current choices are:
*
*                        OS_TASK_OPT_STK_CHK      Stack checking to be allowed for the task
*                        OS_TASK_OPT_STK_CLR      Clear the stack when the task is created
*                        OS_TASK_OPT_SAVE_FP      If the CPU has floating-point registers, save them

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美电影免费观看高清完整版在 | 成人h动漫精品一区二| 免费成人美女在线观看.| 亚洲一级二级三级在线免费观看| 亚洲蜜桃精久久久久久久| 中文字幕亚洲一区二区av在线 | 欧美精品在线视频| 欧美日韩视频在线观看一区二区三区| 在线观看不卡视频| 欧美日韩三级视频| 欧美一区二区三区四区高清 | 久久久亚洲精品石原莉奈| 日韩一卡二卡三卡| 精品播放一区二区| 日本一区二区久久| 亚洲免费看黄网站| 亚洲成人午夜电影| 久久99精品国产.久久久久久| 韩国av一区二区三区在线观看| 国内外成人在线| av亚洲精华国产精华精华| 色综合久久中文综合久久牛| 欧美日韩国产乱码电影| 日韩一区二区三区免费观看| 久久久午夜电影| 最新国产精品久久精品| 一区二区三区精品| 蜜臀久久99精品久久久久久9| 国产精品一区不卡| 色天使色偷偷av一区二区| 欧美久久婷婷综合色| 久久久不卡网国产精品二区 | 在线免费观看日本一区| 欧美精品在线视频| 国产精品久久久久久一区二区三区| 亚洲综合一区二区| 国产一区欧美一区| 欧美性色aⅴ视频一区日韩精品| 日韩三区在线观看| 亚洲国产精品99久久久久久久久 | 99精品欧美一区二区蜜桃免费 | 26uuu亚洲综合色| 亚洲人成网站精品片在线观看| 日韩成人伦理电影在线观看| 成人午夜激情视频| 日韩欧美国产一区在线观看| 亚洲精品欧美激情| 国产98色在线|日韩| 91精品欧美一区二区三区综合在 | 美腿丝袜亚洲色图| 日本二三区不卡| 久久天天做天天爱综合色| 亚洲h在线观看| 在线免费不卡电影| 国产精品电影一区二区| 国产在线国偷精品免费看| 欧美日韩国产欧美日美国产精品| 欧美国产欧美综合| 国产麻豆成人精品| xnxx国产精品| 免费欧美高清视频| 欧美一区二区不卡视频| 亚洲一区二区三区国产| 91蜜桃传媒精品久久久一区二区| 国产亚洲精品中文字幕| 国产一区啦啦啦在线观看| 欧美一区二区福利视频| 日韩精品一二三四| 欧美精品乱码久久久久久| 亚洲一二三区在线观看| 91香蕉视频在线| 最好看的中文字幕久久| 成人黄色电影在线| 国产精品国产自产拍在线| 国产999精品久久久久久绿帽| 国产亚洲婷婷免费| 成人动漫av在线| 亚洲欧美日本韩国| 在线国产电影不卡| 亚洲成av人片在线| 7777精品伊人久久久大香线蕉的 | 久久这里只精品最新地址| 久久99热99| 国产亚洲综合性久久久影院| 国产精品资源在线| 国产精品免费av| 91亚洲精品久久久蜜桃网站| 一区二区视频在线| 欧美日韩国产高清一区| 免费黄网站欧美| 国产欧美视频在线观看| hitomi一区二区三区精品| 亚洲一区二区综合| 日韩丝袜情趣美女图片| 国产一区视频在线看| 国产精品久久精品日日| 欧美调教femdomvk| 另类小说一区二区三区| 国产偷国产偷精品高清尤物 | 日本人妖一区二区| 久久精品视频免费| 色综合久久久久综合99| 蜜臀av性久久久久蜜臀aⅴ| 国产婷婷色一区二区三区| 91在线视频官网| 卡一卡二国产精品 | 亚洲成人精品一区二区| 精品国产三级电影在线观看| jlzzjlzz国产精品久久| 日本一区中文字幕| 亚洲日本在线观看| 欧美不卡一二三| 色婷婷综合久色| 久久99国产乱子伦精品免费| 亚洲日本一区二区三区| 精品免费视频一区二区| 91麻豆123| 国产乱色国产精品免费视频| 亚洲国产精品精华液网站| 国产精品乱子久久久久| 日韩三级高清在线| 欧亚洲嫩模精品一区三区| 国产一区二区三区四区五区入口 | 91浏览器在线视频| 国产一区二区在线看| 午夜视频一区在线观看| 中文字幕字幕中文在线中不卡视频| 在线播放日韩导航| 在线观看视频一区二区欧美日韩| 国产精品1024| 精品午夜久久福利影院| 天堂久久一区二区三区| 亚洲黄色在线视频| 中文天堂在线一区| 久久这里只有精品6| 欧美一级黄色片| 欧美日韩在线观看一区二区 | 蜜臀av性久久久久蜜臀aⅴ流畅| 亚洲精品老司机| 亚洲少妇中出一区| 中文字幕一区二区三区在线不卡 | 3d成人h动漫网站入口| 欧美性生交片4| 91黄色免费看| 在线一区二区三区| 在线影院国内精品| 色视频成人在线观看免| 91麻豆免费观看| 日本高清免费不卡视频| 日本久久一区二区三区| 91视频在线看| 色婷婷精品大在线视频| 色诱亚洲精品久久久久久| 99国产欧美久久久精品| 91在线观看成人| 色偷偷一区二区三区| 日本高清免费不卡视频| 欧美三级日韩三级国产三级| 欧美日韩大陆一区二区| 欧美肥妇free| 亚洲精品在线免费播放| 中文在线一区二区| 自拍偷拍欧美精品| 亚洲综合在线第一页| 婷婷中文字幕一区三区| 免费精品视频在线| 国产精品一区二区久久精品爱涩 | 欧洲精品一区二区三区在线观看| 日本电影欧美片| 91精品国产欧美日韩| 精品国产乱码久久久久久图片 | 玉足女爽爽91| 午夜精品在线看| 精彩视频一区二区三区| 不卡一卡二卡三乱码免费网站| 97久久人人超碰| 91精品国产91热久久久做人人| 精品国产成人在线影院| 日韩一区在线播放| 视频一区欧美精品| 国产成人aaaa| 在线观看区一区二| 久久中文娱乐网| 亚洲午夜激情av| 国产精品亚洲成人| 欧美综合一区二区| 精品处破学生在线二十三| 亚洲精品中文在线观看| 麻豆精品国产传媒mv男同| 不卡电影一区二区三区| 欧美一区二区三区四区五区| 国产欧美一区在线| 天天av天天翘天天综合网| 国产风韵犹存在线视精品| 欧美日韩免费电影| 国产嫩草影院久久久久| 日韩1区2区3区| 99国产精品一区| 久久九九全国免费| 日本不卡一二三区黄网|