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

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

?? os_task.c

?? 新版本ucosii移植
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                        (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
*                                           All Rights Reserved
*
*                                                  V2.00
*
* File : OS_TASK.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "includes.h"
#endif

/*
*********************************************************************************************************
*                                        LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/


static  void  OSDummy(void) ;

/*
*********************************************************************************************************
*                                            DUMMY FUNCTION
*
* Description: This function doesn't do anything.  It is called by OSTaskDel() to ensure that interrupts
*              are disabled immediately after they are enabled.
*
* Arguments  : none
*
* Returns    : none
*********************************************************************************************************
*/

static void  OSDummy (void) 
{
}

/*$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_NO_ERR        is the call was successful
*              OS_PRIO_INVALID  if the priority you specify is higher that the maximum allowed 
*                               (i.e. >= OS_LOWEST_PRIO)
*              OS_PRIO_EXIST    if the new priority already exist.
*              OS_PRIO_ERR      there is no task with the specified OLD priority (i.e. the OLD task does
*                               not exist.
*********************************************************************************************************
*/

#if OS_TASK_CHANGE_PRIO_EN
INT8U OSTaskChangePrio (INT8U oldprio, INT8U newprio) 
{
    OS_TCB   *ptcb;
    OS_EVENT *pevent;
    INT8U     x;
    INT8U     y;
    INT8U     bitx;
    INT8U     bity;


    if ((oldprio >= OS_LOWEST_PRIO && oldprio != OS_PRIO_SELF)  || 
         newprio >= OS_LOWEST_PRIO) {
        return (OS_PRIO_INVALID);
    }
    OS_ENTER_CRITICAL();
    if (OSTCBPrioTbl[newprio] != (OS_TCB *)0) {                 /* New priority must not already exist */
        OS_EXIT_CRITICAL();
        return (OS_PRIO_EXIST);
    } else {
        OSTCBPrioTbl[newprio] = (OS_TCB *)1;                    /* Reserve the entry to prevent others */
        OS_EXIT_CRITICAL();
        y    = newprio >> 3;                                    /* Precompute to reduce INT. latency   */
        bity = OSMapTbl[y];
        x    = newprio & 0x07;
        bitx = OSMapTbl[x];
        OS_ENTER_CRITICAL();
        if (oldprio == OS_PRIO_SELF) {                          /* See if changing self                */
            oldprio = OSTCBCur->OSTCBPrio;                      /* Yes, get priority                   */
        }
        if ((ptcb = OSTCBPrioTbl[oldprio]) != (OS_TCB *)0) {    /* Task to change must exist           */
            OSTCBPrioTbl[oldprio] = (OS_TCB *)0;                /* Remove TCB from old priority        */
            if (OSRdyTbl[ptcb->OSTCBY] & ptcb->OSTCBBitX) {     /* If task is ready make it not ready  */
                if ((OSRdyTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0) {
                    OSRdyGrp &= ~ptcb->OSTCBBitY;
                }
                OSRdyGrp    |= bity;                            /* Make new priority ready to run      */
                OSRdyTbl[y] |= bitx;
            } else {
                if ((pevent = ptcb->OSTCBEventPtr) != (OS_EVENT *)0) { /* Remove from event wait list  */
                    if ((pevent->OSEventTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0) {
                        pevent->OSEventGrp &= ~ptcb->OSTCBBitY;
                    }
                    pevent->OSEventGrp    |= bity;              /* Add new priority to wait list       */
                    pevent->OSEventTbl[y] |= bitx;
                }
            }
            OSTCBPrioTbl[newprio] = ptcb;                       /* Place pointer to TCB @ new priority */
            ptcb->OSTCBPrio       = newprio;                    /* Set new task priority               */
            ptcb->OSTCBY          = y;
            ptcb->OSTCBX          = x;
            ptcb->OSTCBBitY       = bity;
            ptcb->OSTCBBitX       = bitx;
            OS_EXIT_CRITICAL();
            OSSched();                                          /* Run highest priority task ready     */
            return (OS_NO_ERR);
        } else {
            OSTCBPrioTbl[newprio] = (OS_TCB *)0;                /* Release the reserved prio.          */
            OS_EXIT_CRITICAL();
            return (OS_PRIO_ERR);                               /* Task to change didn't exist         */
        }
    }
}
#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
*
*              pdata    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 'pdata' as follows:
*
*                           void Task (void *pdata)
*                           {
*                               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_NO_ERR        if the function was successful.
*              OS_PRIO_EXIT     if the task priority already exist 
*                               (each task MUST have a unique priority).
*              OS_PRIO_INVALID  if the priority you specify is higher that the maximum allowed 
*                               (i.e. >= OS_LOWEST_PRIO)
*********************************************************************************************************
*/

#if OS_TASK_CREATE_EN
INT8U OSTaskCreate (void (*task)(void *pd), void *ppdata, OS_STK *ptos, INT8U prio) 
{
    void   *psp;
    INT8U   err;


    if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
        return (OS_PRIO_INVALID);
    }
    OS_ENTER_CRITICAL();
    if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority  */
        OSTCBPrioTbl[prio] = (OS_TCB *)1;    /* Reserve the priority to prevent others from doing ...  */
                                             /* ... the same thing until task is created.              */
        OS_EXIT_CRITICAL();
        psp = (void *)OSTaskStkInit(task, ppdata, ptos, 0); /* Initialize the task's stack              */
        err = OSTCBInit(prio, psp, (void *)0, 0, 0, (void *)0, 0);         
        if (err == OS_NO_ERR) {
            OS_ENTER_CRITICAL();
            OSTaskCtr++;                                   /* Increment the #tasks counter             */
            OSTaskCreateHook(OSTCBPrioTbl[prio]);          /* Call user defined hook                   */
            OS_EXIT_CRITICAL();
            if (OSRunning) {                 /* Find highest priority task if multitasking has started */
                OSSched();
            }
        } else {
            OS_ENTER_CRITICAL();
            OSTCBPrioTbl[prio] = (OS_TCB *)0;/* Make this priority available to others                 */
            OS_EXIT_CRITICAL();
        }
        return (err);
    } else {
        OS_EXIT_CRITICAL();
        return (OS_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
*
*              pdata    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 'pdata' as follows:
*
*                           void Task (void *pdata)
*                           {
*                               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.  'pstk' 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.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
蜜臀精品一区二区三区在线观看 | 激情综合亚洲精品| 亚洲综合另类小说| 亚洲精品国产视频| 一区二区三区精品在线| 亚洲综合在线电影| 午夜亚洲福利老司机| 日韩av一级电影| 日韩国产欧美视频| 久久国产尿小便嘘嘘尿| 国产在线麻豆精品观看| 国产精品一区一区三区| 国产91精品在线观看| 高清成人免费视频| 91麻豆.com| 欧美性生活影院| 91精品国产综合久久国产大片| 欧美一区二区三区电影| 精品电影一区二区| 欧美经典三级视频一区二区三区| 国产视频亚洲色图| 亚洲天堂av一区| 亚洲一区二区三区在线播放| 五月婷婷色综合| 久久超级碰视频| 丁香桃色午夜亚洲一区二区三区| av中文一区二区三区| 欧美三级韩国三级日本三斤| 91精品国产91久久久久久一区二区| 精品国产一区二区三区久久影院| 欧美极品aⅴ影院| 亚洲一区在线观看视频| 蜜桃久久久久久久| 国产99久久久国产精品潘金 | 精品国产乱子伦一区| 久久精品视频一区二区三区| 国产精品灌醉下药二区| 亚洲成va人在线观看| 狠狠v欧美v日韩v亚洲ⅴ| 成人av电影在线| 欧美精品久久久久久久久老牛影院| 精品国产91乱码一区二区三区| 中文字幕av不卡| 视频在线观看国产精品| 国产成人自拍高清视频在线免费播放| 色综合久久久久综合体| 日韩免费福利电影在线观看| 一色屋精品亚洲香蕉网站| 日韩综合在线视频| 成人亚洲一区二区一| 欧美日韩亚洲另类| 久久久国产精华| 一区二区三区精品在线观看| 精品一区二区三区蜜桃| 欧美优质美女网站| 久久久久久一二三区| 亚洲电影视频在线| 粉嫩在线一区二区三区视频| 欧美欧美午夜aⅴ在线观看| 国产日韩欧美在线一区| 天天影视色香欲综合网老头| 成人精品视频一区二区三区| 日韩欧美在线网站| 亚洲一区免费视频| jizz一区二区| 亚洲精品一区二区三区影院| 亚洲成人一区在线| 成人性生交大片免费看中文| 欧美一卡在线观看| 亚洲一区二区在线播放相泽| 91年精品国产| 色哦色哦哦色天天综合| 丁香亚洲综合激情啪啪综合| 欧美视频一区二区| 中文字幕一区二区三区在线不卡| 久久99国产精品久久99| 欧美日韩高清一区二区不卡| 亚洲视频狠狠干| 国产不卡免费视频| 精品卡一卡二卡三卡四在线| 丝袜美腿亚洲一区二区图片| 色伊人久久综合中文字幕| 久久久久久久久97黄色工厂| 免费一区二区视频| 欧美精品一二三四| 亚洲第一电影网| 一本大道久久a久久综合| 欧美国产精品一区| 国产美女精品在线| 亚洲精品一区二区三区影院| 免费不卡在线视频| 这里只有精品99re| 亚洲成av人片一区二区| 在线观看不卡视频| 一区二区三区高清在线| 一本色道久久综合亚洲91| 综合久久给合久久狠狠狠97色 | 欧美亚洲国产一区在线观看网站| 国产精品高潮呻吟久久| 成人app在线观看| 中文成人综合网| 成人午夜av影视| 国产精品网站一区| 成人激情图片网| 国产精品久久久久婷婷二区次| 丰满少妇在线播放bd日韩电影| 日本一区免费视频| av在线不卡电影| 一区二区三区资源| 欧美制服丝袜第一页| 亚洲一区二区在线视频| 欧美色倩网站大全免费| 午夜精品久久久久久久| 欧美剧情片在线观看| 琪琪一区二区三区| 精品国产伦一区二区三区观看方式| 国产在线精品不卡| 国产人成亚洲第一网站在线播放| 成人国产在线观看| 一区二区三区成人| 51午夜精品国产| 精品亚洲欧美一区| 国产欧美精品一区aⅴ影院| 成人动漫中文字幕| 一区二区三区日韩欧美精品| 欧美亚洲综合在线| 免费成人在线播放| 久久久久久免费毛片精品| eeuss影院一区二区三区| 一二三区精品福利视频| 日韩免费福利电影在线观看| 国产91在线看| 亚洲一区二区三区国产| 日韩小视频在线观看专区| 国产成人在线免费| 一区二区三区高清不卡| 日韩免费视频一区二区| 成人国产一区二区三区精品| 亚洲一区二区中文在线| 精品国产免费人成电影在线观看四季 | 国产精品1024| 最新久久zyz资源站| 欧美理论在线播放| 国产成人免费在线视频| 一区二区欧美精品| 精品国产一区二区三区四区四| 97久久久精品综合88久久| 手机精品视频在线观看| 中文成人综合网| 91精品国产综合久久久蜜臀粉嫩| 国产精品正在播放| 午夜在线成人av| 中文字幕精品一区| 欧美人与禽zozo性伦| 国产精品18久久久久久久久| 亚洲高清久久久| 国产女人水真多18毛片18精品视频 | 蜜臀va亚洲va欧美va天堂| 欧美高清在线一区二区| 精品视频一区二区不卡| 国产成人综合亚洲91猫咪| 天堂av在线一区| 国产精品你懂的在线| 欧美一三区三区四区免费在线看| av电影在线不卡| 老司机午夜精品| 一区二区三区在线免费播放| 久久久久久久久伊人| 欧美日韩日日骚| youjizz国产精品| 九一九一国产精品| 亚洲国产成人91porn| 国产精品区一区二区三| 欧美电影精品一区二区| 欧美亚洲国产一区二区三区| 丁香五精品蜜臀久久久久99网站 | 欧美天堂亚洲电影院在线播放| 国产精品一卡二卡在线观看| 香蕉影视欧美成人| 亚洲免费看黄网站| 久久久久久久综合日本| 制服丝袜在线91| 91小视频在线观看| 精品一区二区三区免费播放| 日韩福利电影在线观看| 一个色在线综合| 亚洲欧美激情插| 欧美激情资源网| 国产婷婷色一区二区三区| 精品入口麻豆88视频| 91精品国产91久久久久久最新毛片| 日本韩国欧美一区| 99视频精品在线| 国产.精品.日韩.另类.中文.在线.播放| 日本91福利区| 日韩成人免费看| av高清不卡在线| 国产盗摄一区二区| 国产精品伊人色| 国产成人综合亚洲网站|