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

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

?? os_task.c

?? ucos-ii在msp430f149上的移植
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                              (c) Copyright 1992-2008, Micrium, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_TASK.C
* By      : Jean J. Labrosse
* Version : V2.87
*
* 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 > 0
INT8U  OSTaskChangePrio (INT8U oldprio, INT8U newprio)
{
#if (OS_EVENT_EN)
    OS_EVENT  *pevent;
#if (OS_EVENT_MULTI_EN > 0)
    OS_EVENT **pevents;
#endif
#endif
    OS_TCB    *ptcb;
    INT8U      y_new;
    INT8U      x_new;
    INT8U      y_old;
#if OS_LOWEST_PRIO <= 63
    INT8U      bity_new;
    INT8U      bitx_new;
    INT8U      bity_old;
    INT8U      bitx_old;
#else
    INT16U     bity_new;
    INT16U     bitx_new;
    INT16U     bity_old;
    INT16U     bitx_old;
#endif
#if OS_CRITICAL_METHOD == 3
    OS_CPU_SR  cpu_sr = 0;                                  /* Storage for CPU status register         */
#endif


/*$PAGE*/
#if OS_ARG_CHK_EN > 0
    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 <= 63
    y_new                 = (INT8U)(newprio >> 3);          /* Yes, compute new TCB fields             */
    x_new                 = (INT8U)(newprio & 0x07);
    bity_new              = (INT8U)(1 << y_new);
    bitx_new              = (INT8U)(1 << x_new);
#else
    y_new                 = (INT8U)((newprio >> 4) & 0x0F);
    x_new                 = (INT8U)( newprio & 0x0F);
    bity_new              = (INT16U)(1 << y_new);
    bitx_new              = (INT16U)(1 << x_new);
#endif

    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) != 0) {              /* If task is ready make it not            */
         OSRdyTbl[y_old] &= ~bitx_old;
         if (OSRdyTbl[y_old] == 0) {
             OSRdyGrp &= ~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] &= ~bitx_old;             /* Remove old task prio from wait list     */
        if (pevent->OSEventTbl[y_old] == 0) {
            pevent->OSEventGrp    &= ~bity_old;
        }
        pevent->OSEventGrp        |= bity_new;              /* Add    new task prio to   wait list     */
        pevent->OSEventTbl[y_new] |= bitx_new;
    }
#if (OS_EVENT_MULTI_EN > 0)
    if (ptcb->OSTCBEventMultiPtr != (OS_EVENT **)0) {
        pevents =  ptcb->OSTCBEventMultiPtr;
        pevent  = *pevents;
        while (pevent != (OS_EVENT *)0) {
            pevent->OSEventTbl[y_old] &= ~bitx_old;         /* Remove old task prio from wait lists    */
            if (pevent->OSEventTbl[y_old] == 0) {
                pevent->OSEventGrp    &= ~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 > 0
INT8U  OSTaskCreate (void (*task)(void *p_arg), void *p_arg, OS_STK *ptos, INT8U prio)
{
    OS_STK    *psp;
    INT8U      err;
#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 priority is within allowable range           */
        return (OS_ERR_PRIO_INVALID);
    }
#endif
    OS_ENTER_CRITICAL();
    if (OSIntNesting > 0) {                  /* 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, 0);              /* Initialize the task's stack         */
        err = OS_TCBInit(prio, psp, (OS_STK *)0, 0, 0, (void *)0, 0);
        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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品视频999| 在线免费观看一区| 蜜臀av一区二区| 国产欧美日韩亚州综合| 69久久夜色精品国产69蝌蚪网| 欧美日韩第一区日日骚| 欧美福利视频导航| 亚洲一区二区三区视频在线| 日本中文字幕一区二区视频 | 亚洲精品乱码久久久久久黑人 | 成人丝袜高跟foot| 91免费精品国自产拍在线不卡| 成人福利在线看| 欧美日韩综合在线| 国产欧美一区二区精品性色 | 51精品久久久久久久蜜臀| 日韩三级视频在线看| 最新欧美精品一区二区三区| 五月婷婷久久综合| 99精品国产99久久久久久白柏| 欧美日韩一本到| 中文字幕免费观看一区| 亚洲成av人综合在线观看| 成人免费视频一区二区| 91国产福利在线| 一本大道av伊人久久综合| 国产精品影视在线观看| 欧美写真视频网站| 亚洲区小说区图片区qvod| 亚洲嫩草精品久久| 国产精品系列在线观看| 国产成人免费视频精品含羞草妖精 | 精品日韩一区二区三区| 尤物视频一区二区| 国产成人免费9x9x人网站视频| 日韩午夜三级在线| 日韩中文字幕一区二区三区| 91精品福利在线| 一区二区欧美精品| 91官网在线免费观看| ...xxx性欧美| 婷婷亚洲久悠悠色悠在线播放| 色狠狠色狠狠综合| 伊人一区二区三区| 欧美高清hd18日本| 久久99久久精品| 久久综合久久久久88| 国产真实乱对白精彩久久| 久久综合久久久久88| 国产不卡视频在线播放| 日韩美女视频一区二区| 欧美午夜片在线看| 国内外成人在线视频| 国产精品美女久久久久av爽李琼 | 久久久久九九视频| 97se亚洲国产综合自在线观| 亚洲一卡二卡三卡四卡无卡久久| 欧美特级限制片免费在线观看| 美女尤物国产一区| 国产一区三区三区| 国产女人aaa级久久久级| 成人性生交大片免费看中文| 国产欧美日韩在线观看| 欧美天堂亚洲电影院在线播放| 久久国产视频网| 伊人夜夜躁av伊人久久| 日韩亚洲欧美综合| 丝袜美腿亚洲色图| 亚洲欧美综合色| 日韩免费在线观看| 在线精品视频小说1| 国产精品一区久久久久| 亚洲在线视频免费观看| 中文字幕一区二区在线播放 | 亚洲一区中文日韩| 国产精品久久久久久户外露出| 精品入口麻豆88视频| 在线免费视频一区二区| 精品国产91洋老外米糕| 日韩久久精品一区| 97精品超碰一区二区三区| 国产一区二区不卡| 激情六月婷婷久久| 国产主播一区二区| 激情文学综合丁香| 久久精品国产免费| 免费成人在线观看视频| 美女被吸乳得到大胸91| 精品亚洲国内自在自线福利| 蜜臀精品久久久久久蜜臀| 奇米在线7777在线精品| 国产精品萝li| 亚洲成人免费影院| 午夜视频在线观看一区| 午夜精品久久久久久久久久久| 五月婷婷激情综合网| 免费不卡在线视频| 国产一区二区三区| 91在线看国产| 99久久99久久免费精品蜜臀| 97成人超碰视| 欧美一级高清片| 国产精品卡一卡二卡三| 亚洲伦理在线精品| 日韩高清国产一区在线| 国产高清无密码一区二区三区| 国产在线精品不卡| av动漫一区二区| 日韩欧美国产综合| 亚洲自拍欧美精品| 国产一区二区精品久久| 8x8x8国产精品| 国产亚洲一区二区三区在线观看 | 国产一区在线精品| 日本乱人伦aⅴ精品| 亚洲国产精品黑人久久久| 天天免费综合色| 色综合天天综合网天天狠天天| 精品裸体舞一区二区三区| 水野朝阳av一区二区三区| 91免费在线播放| 国产欧美一区二区精品性| 天堂久久一区二区三区| 91国偷自产一区二区三区成为亚洲经典| 精品久久久三级丝袜| 日本色综合中文字幕| 日本亚洲三级在线| 日韩国产欧美视频| 欧美日本一区二区在线观看| 亚洲综合免费观看高清在线观看| 成人一道本在线| 国产精品视频免费看| 99久久er热在这里只有精品66| 国产精品―色哟哟| 色综合色综合色综合色综合色综合| 国产精品欧美精品| 色爱区综合激月婷婷| 一区二区三区在线影院| 欧美性一级生活| 激情小说欧美图片| 国产精品乱码久久久久久| 波多野结衣在线一区| 亚洲电影激情视频网站| 日韩午夜激情av| av中文字幕在线不卡| 亚洲一区二区三区四区五区中文| 亚洲欧洲99久久| 高清国产一区二区| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 成人精品亚洲人成在线| 亚洲6080在线| 国产欧美日本一区二区三区| 欧美综合视频在线观看| 激情五月婷婷综合| 亚洲自拍偷拍av| 国产精品久久久久婷婷二区次| 在线影院国内精品| 成人午夜激情在线| 麻豆91精品视频| 午夜影院久久久| 最新热久久免费视频| 久久午夜国产精品| 欧美美女黄视频| 91成人免费在线| 色婷婷av一区二区三区之一色屋| 国产精品一区二区三区乱码| 奇米影视一区二区三区小说| 欧美精品一卡二卡| 91精品久久久久久久99蜜桃| 成人av免费在线播放| 国产一区二区伦理片| 日韩av在线免费观看不卡| 亚洲免费观看高清| 亚洲男人天堂av| 亚洲精品videosex极品| 亚洲品质自拍视频| 亚洲六月丁香色婷婷综合久久| 亚洲欧美激情一区二区| 18欧美亚洲精品| 亚洲国产日韩a在线播放性色| 亚洲免费观看视频| 午夜精品久久久久久久99樱桃| 亚洲高清免费视频| 美国av一区二区| 精品一区二区日韩| 99久久精品国产毛片| 91免费版在线看| 欧美三级电影网| 26uuu亚洲综合色| 综合中文字幕亚洲| 免费高清不卡av| 国产不卡在线播放| 欧美美女网站色| 日本一区二区三区国色天香 | 日韩精品一区二区三区视频播放 | 欧美伦理视频网站| 欧美精品一区二区蜜臀亚洲| 亚洲免费在线看| 国产宾馆实践打屁股91| 欧美高清视频一二三区|