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

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

?? os_task.c

?? 51下的一個(gè)操作系統(tǒng)源碼
?? 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
*********************************************************************************************************
*/

#if OS_TASK_DEL_EN
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)reentrant
{
}
#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_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)reentrant
{
    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
*
*              dataptr    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 'dataptr' as follows:
*
*                           void Task (void *dataptr)
*                           {
*                               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)reentrant, 
		    void *dataptr, 
		    OS_STK *ptos, 
		    INT8U prio)reentrant
{
    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, dataptr, 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
*
*              dataptr    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 'dataptr' as follows:
*
*                           void Task (void *dataptr)
*                           {
*                               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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久国产老人久久综合| av亚洲精华国产精华精华 | 亚洲麻豆国产自偷在线| 国产91在线|亚洲| 欧美激情一二三区| av影院午夜一区| 一区二区三区日韩精品| 欧美老女人第四色| 久久国产欧美日韩精品| 一区二区三区欧美| 欧美在线视频你懂得| 性做久久久久久| 日韩欧美另类在线| 成人亚洲一区二区一| 一区二区三区四区在线免费观看 | 国产大陆精品国产| 中文字幕日韩一区| 欧美日韩一区二区三区在线| 日本视频在线一区| 日本一区二区不卡视频| 在线亚洲一区二区| 精品一区二区三区免费观看| 国产精品久久久久9999吃药| 欧美视频三区在线播放| 国产乱码精品一品二品| 亚洲精品视频一区| 日韩精品一区二区三区蜜臀| 成人精品一区二区三区四区| 5月丁香婷婷综合| 精品一区二区综合| 亚洲欧美激情在线| 日韩一卡二卡三卡四卡| 懂色av一区二区三区免费看| 中文字幕第一区综合| 欧美亚洲国产一区在线观看网站| 麻豆精品精品国产自在97香蕉| 国产精品视频九色porn| 欧美日韩国产一级| 成av人片一区二区| 久久99久久99精品免视看婷婷| 国产精品电影一区二区| 日韩一级精品视频在线观看| 99热精品一区二区| 国产在线精品一区二区夜色 | 久久网这里都是精品| 日本韩国欧美在线| 国产v综合v亚洲欧| 美女网站在线免费欧美精品| 亚洲图片欧美激情| 久久亚区不卡日本| 欧美一区二区视频在线观看2020| 9i在线看片成人免费| 精品亚洲免费视频| 午夜精品久久久久久久| 亚洲乱码国产乱码精品精98午夜| 久久久久国产精品免费免费搜索| 欧美高清www午色夜在线视频| 99热精品一区二区| 懂色av噜噜一区二区三区av| 久久99热国产| 美洲天堂一区二卡三卡四卡视频| 亚洲一区日韩精品中文字幕| **欧美大码日韩| 中文字幕在线免费不卡| 国产人久久人人人人爽| 久久免费视频一区| 欧美xxxx老人做受| 日韩欧美电影在线| 欧美一级二级三级乱码| 6080yy午夜一二三区久久| 欧美三级午夜理伦三级中视频| 99re热这里只有精品免费视频| 国产美女视频91| 国产精品影视天天线| 国产剧情一区二区| 国产成人在线电影| 成人免费视频视频在线观看免费| 精品一区二区三区香蕉蜜桃| 久久国产综合精品| 国内外成人在线| 国产麻豆91精品| 国产91富婆露脸刺激对白| 国产高清久久久久| www.亚洲精品| 在线观看一区日韩| 欧美日韩一区视频| 欧美一区二区私人影院日本| 欧美大片免费久久精品三p| 日韩美女视频在线| 久久精品亚洲乱码伦伦中文| 国产欧美精品一区二区三区四区| 国产网站一区二区| 国产精品久久久一本精品 | 欧美妇女性影城| 日韩精品中午字幕| xnxx国产精品| 国产精品午夜在线观看| 亚洲精品乱码久久久久久久久 | 91一区二区三区在线观看| 在线日韩av片| 日韩欧美国产小视频| 国产欧美日韩视频一区二区| 亚洲欧洲成人精品av97| 亚洲一级二级三级在线免费观看| 日韩精品久久理论片| 韩国视频一区二区| 99精品国产99久久久久久白柏| 欧美三级三级三级| 欧美成人三级电影在线| 国产精品视频你懂的| 香蕉久久夜色精品国产使用方法| 久久99精品久久久久久国产越南| 东方欧美亚洲色图在线| 欧洲精品一区二区三区在线观看| 日韩欧美亚洲一区二区| 国产色一区二区| 亚洲永久精品国产| 国产一区二区免费看| 在线观看亚洲一区| 337p日本欧洲亚洲大胆精品| 亚洲欧美电影院| 国产在线精品视频| 欧美亚洲国产怡红院影院| 久久这里只精品最新地址| 亚洲欧洲中文日韩久久av乱码| 麻豆精品国产91久久久久久| 91免费版在线| 欧美精品一区二区三区很污很色的| 国产精品久久久久久久久动漫| 日本欧美在线看| 在线精品视频小说1| 国产日韩欧美精品在线| 日韩vs国产vs欧美| 一本到不卡精品视频在线观看| 日韩午夜精品视频| 一区二区三区高清| 国产成人在线视频网址| 91精品国产一区二区人妖| 中文字幕一区三区| 精品中文字幕一区二区| 色欧美片视频在线观看在线视频| 欧美变态口味重另类| 亚洲成人tv网| 色婷婷av一区二区三区软件| 久久午夜老司机| 美女视频一区在线观看| 欧美性三三影院| 日韩美女视频19| 国产91精品久久久久久久网曝门 | 91黄视频在线观看| 国产视频一区二区在线| 日本在线不卡一区| 欧美日韩中文一区| 亚洲激情在线激情| 99久久精品免费看| 一色桃子久久精品亚洲| 国产黄人亚洲片| 精品播放一区二区| 黄网站免费久久| 欧美变态tickle挠乳网站| 日本va欧美va瓶| 69堂亚洲精品首页| 欧美bbbbb| 欧美刺激午夜性久久久久久久| 视频精品一区二区| 欧美乱熟臀69xxxxxx| 亚洲一区二区四区蜜桃| 欧美在线免费观看视频| 一卡二卡三卡日韩欧美| 91黄色小视频| 亚洲成人三级小说| 91精品婷婷国产综合久久性色 | 99riav久久精品riav| 欧美国产欧美亚州国产日韩mv天天看完整| 黄色日韩网站视频| 国产丝袜美腿一区二区三区| 丁香激情综合五月| 亚洲少妇最新在线视频| 91国产丝袜在线播放| 亚洲午夜免费电影| 这里只有精品99re| 精彩视频一区二区三区| 久久久久久久久久久久久夜| 成人一级片网址| 亚洲美女淫视频| 欧美日韩成人综合在线一区二区| 免费三级欧美电影| 久久久不卡网国产精品一区| 波多野结衣中文字幕一区二区三区| 最新成人av在线| 在线电影一区二区三区| 久久精品国产**网站演员| 国产视频在线观看一区二区三区| av在线不卡免费看| 亚洲国产综合色| 久久综合九色综合欧美亚洲| 波多野结衣视频一区| 亚洲成人黄色小说| 久久九九久精品国产免费直播| 色综合久久久久综合体桃花网|