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

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

?? os_task.c

?? C51下uc/osii的一個完整的LCD項目源碼
?? 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) reentrant;

/*
*********************************************************************************************************
*                                            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
{
}

/*$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
*
*              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) 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, 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.
*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
制服丝袜亚洲播放| 国产99精品在线观看| 国产精品拍天天在线| 亚洲欧洲精品成人久久奇米网| 欧美成人三级电影在线| 国产亚洲污的网站| 国产丝袜欧美中文另类| 一区二区三区高清不卡| 国产精品午夜免费| 国产三级精品视频| 亚洲精品国产一区二区精华液| 亚洲女人小视频在线观看| 国产精品私人影院| 一区二区三区精密机械公司| 亚洲精品一区二区三区四区高清| 91免费国产在线观看| 欧美日韩中字一区| 精品国内片67194| 国产精品久久毛片av大全日韩| 国产精品区一区二区三区| 亚洲第一福利一区| 免费成人小视频| 国产精品一区二区三区乱码| 99视频精品在线| 欧美精品第一页| 国产精品视频九色porn| 日日夜夜免费精品视频| 成人激情动漫在线观看| 日韩网站在线看片你懂的| 亚洲国产日韩一区二区| 99国产欧美久久久精品| 欧美mv日韩mv国产网站| 亚洲国产精品一区二区www在线| 蜜桃av一区二区| 欧美日本在线看| 亚洲综合一二区| 色视频欧美一区二区三区| 中文字幕一区二区三区视频| 国产乱码精品一区二区三| 精品嫩草影院久久| 玖玖九九国产精品| 久久视频一区二区| 国产精品一区二区三区99| 久久精子c满五个校花| av亚洲精华国产精华精华| 蜜臂av日日欢夜夜爽一区| 26uuu精品一区二区| 久久99国产精品久久99果冻传媒| 欧美精品电影在线播放| 日韩精品亚洲一区| 久久婷婷久久一区二区三区| 国产一区二区三区| 亚洲欧美另类图片小说| 欧美日本在线视频| 五月综合激情婷婷六月色窝| 日韩色视频在线观看| 从欧美一区二区三区| 亚洲免费观看在线观看| 日韩欧美一级二级三级| 五月婷婷欧美视频| 精品国产1区2区3区| 色综合久久精品| 国产精品123| 日产精品久久久久久久性色| 亚洲国产高清在线观看视频| 色国产综合视频| 国产盗摄精品一区二区三区在线 | 国产日韩欧美高清| 在线观看日产精品| 一本到高清视频免费精品| 免费国产亚洲视频| 99精品热视频| 久久久久久久国产精品影院| 91国产免费看| 97精品国产97久久久久久久久久久久| 全国精品久久少妇| 精品一区二区三区视频在线观看| 免费成人性网站| 日韩女优制服丝袜电影| 欧美视频在线一区二区三区| 成人免费毛片a| 国产成人超碰人人澡人人澡| 91麻豆精品秘密| 麻豆精品在线播放| 免费人成网站在线观看欧美高清| 日本一区二区电影| 欧美美女一区二区在线观看| 欧美色国产精品| 91精品国模一区二区三区| 欧美精品久久一区二区三区| 欧美精选在线播放| 在线播放日韩导航| 日韩欧美一级精品久久| 久久久国产精品麻豆| 国产精品女主播av| 亚洲一二三四久久| 日韩精品91亚洲二区在线观看 | 久久激情五月激情| 国产毛片精品一区| 在线观看日韩国产| 欧美精品久久久久久久多人混战| 欧美伦理视频网站| 国产精品高潮呻吟久久| 亚洲愉拍自拍另类高清精品| 国产精品久久久久久久久搜平片| 午夜精品久久久久久久久久久 | 中文字幕一区在线观看视频| 一区二区三区毛片| 国产综合色产在线精品| 欧美三级视频在线播放| 国产精品免费网站在线观看| 爽爽淫人综合网网站| 国产精品一区二区三区99| 欧美日韩精品久久久| 国产精品久久影院| 国产一区二区三区久久悠悠色av| 欧美视频一区二| 亚洲激情成人在线| 不卡的电影网站| 国产亚洲欧美激情| 免费观看在线色综合| 在线中文字幕不卡| 亚洲欧美日韩国产成人精品影院| 国产一区二区成人久久免费影院 | 日韩精品一二三| 欧美日韩黄色影视| 亚洲午夜羞羞片| 欧美性大战久久| 亚洲国产一区视频| 5566中文字幕一区二区电影| 亚洲综合精品久久| 欧美视频一二三区| 天堂成人国产精品一区| 欧美日韩另类一区| 日韩欧美一级在线播放| 欧美亚洲国产怡红院影院| 亚洲精品第一国产综合野| proumb性欧美在线观看| 中文字幕一区二区三区四区| 日本道在线观看一区二区| 亚洲韩国精品一区| 精品乱人伦一区二区三区| 国产精品一区二区男女羞羞无遮挡| 久久久av毛片精品| 91一区二区三区在线观看| 青椒成人免费视频| 久久久久久一二三区| 色94色欧美sute亚洲线路二| 亚洲国产另类精品专区| 精品久久久久久无| 91麻豆国产香蕉久久精品| 国产91精品一区二区麻豆网站 | 成人午夜私人影院| 伊人一区二区三区| 久久久久久97三级| 欧美人狂配大交3d怪物一区| 福利一区二区在线观看| 午夜精品一区二区三区电影天堂 | 国产亚洲制服色| 精品国产伦一区二区三区免费| 99精品热视频| 国产成人精品免费看| 亚洲午夜激情av| 亚洲色图清纯唯美| 久久久久久日产精品| 久久一区二区三区国产精品| 欧美高清激情brazzers| 欧洲av在线精品| 91视频com| 色av成人天堂桃色av| 色综合欧美在线| 91国偷自产一区二区使用方法| av激情综合网| 99久久精品免费看| 91在线你懂得| 色综合色综合色综合| 久久人人爽人人爽| 久久亚洲私人国产精品va媚药| 欧美日韩专区在线| 欧美日韩国产综合久久| 欧美一区二区三区日韩视频| 欧美一级一级性生活免费录像| 欧美日韩一区成人| 日韩女优毛片在线| 国产色一区二区| 亚洲一区二区中文在线| 丝瓜av网站精品一区二区| 精品综合免费视频观看| 成人高清免费观看| 欧美猛男超大videosgay| 精品三级在线看| 亚洲日本va午夜在线电影| 美日韩黄色大片| 色综合久久久久久久久| 日韩一区二区三| 尤物视频一区二区| 国产在线看一区| 欧美一区二区久久| 亚洲午夜精品17c| 成人18视频日本|