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

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

?? os_task.c

?? 51下的一個操作系統源碼
?? 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久一区二区三区| 午夜不卡av免费| 国产午夜一区二区三区| 日韩免费看网站| 91精品国产入口| 日韩一级精品视频在线观看| 7777女厕盗摄久久久| 欧美日韩国产色站一区二区三区| 欧美日韩三级视频| 欧美日韩免费不卡视频一区二区三区| 欧美性猛交一区二区三区精品| 欧洲精品视频在线观看| 欧美日韩精品福利| 日韩一级片网址| 欧美精品一区二区久久婷婷| 久久婷婷综合激情| 国产精品成人免费| 亚洲一区二区三区影院| 午夜久久久久久电影| 老汉av免费一区二区三区 | 水野朝阳av一区二区三区| 性感美女久久精品| 美女一区二区在线观看| 国内一区二区视频| 不卡一区二区三区四区| 欧洲日韩一区二区三区| 91精品国产免费| 久久久五月婷婷| 亚洲三级电影全部在线观看高清| 夜夜操天天操亚洲| 免费视频最近日韩| 懂色av一区二区三区免费观看| 99精品久久免费看蜜臀剧情介绍| 国产亚洲午夜高清国产拍精品| 国产女人18毛片水真多成人如厕| 国产精品对白交换视频| 石原莉奈在线亚洲三区| 国产麻豆精品一区二区| 一本色道久久加勒比精品| 91麻豆精品国产自产在线 | 中文字幕av免费专区久久| 亚洲色图视频网站| 日韩1区2区日韩1区2区| 懂色av中文一区二区三区| 在线亚洲+欧美+日本专区| 日韩欧美综合一区| 中文字幕一区二区三区精华液 | 国产精品1区2区| 91理论电影在线观看| 日韩精品一区二区三区在线观看| 国产精品嫩草久久久久| 日本免费在线视频不卡一不卡二| 国产成人av自拍| 51精品秘密在线观看| 中文字幕精品在线不卡| 日韩精品亚洲一区二区三区免费| 国产成人aaa| 欧美一级理论性理论a| 欧美国产日韩a欧美在线观看 | 在线免费视频一区二区| 日韩免费在线观看| 亚洲一区二区三区四区在线观看| 国产伦精品一区二区三区视频青涩| 日本道色综合久久| 亚洲国产精品成人综合| 日本色综合中文字幕| 色久优优欧美色久优优| 国产欧美一区二区精品秋霞影院| 亚洲图片自拍偷拍| 99久久er热在这里只有精品66| 欧美成人艳星乳罩| 亚洲午夜激情网站| 99国产精品久久久久久久久久 | 6080日韩午夜伦伦午夜伦| 国产精品日韩成人| 激情小说欧美图片| 一级做a爱片久久| 成人深夜福利app| 精品久久99ma| 日韩av一区二区三区四区| 在线欧美日韩精品| 中文字幕亚洲在| 国产成人啪免费观看软件| 日韩一区二区影院| 日韩精品一二三| 欧美日韩三级一区二区| 一区二区三区四区视频精品免费| 成人午夜视频福利| 久久久国产精品午夜一区ai换脸| 麻豆91精品91久久久的内涵| 欧美日本国产一区| 亚洲精品免费在线| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 亚洲精选一二三| av福利精品导航| 国产欧美精品一区aⅴ影院| 经典三级视频一区| 欧美精品一区视频| 国产一区二区三区四| 欧美精品一区二区三| 国产一区二区精品久久99| 日韩精品中午字幕| 韩国女主播成人在线观看| 日韩欧美国产一区二区三区| 奇米精品一区二区三区在线观看一| 欧美精选一区二区| 午夜精品一区二区三区电影天堂 | 欧美另类久久久品| 三级成人在线视频| 日韩免费看的电影| 极品少妇xxxx精品少妇偷拍| 久久先锋影音av| 福利91精品一区二区三区| 国产精品视频yy9299一区| 99视频一区二区三区| 亚洲三级在线观看| 欧美网站大全在线观看| 日韩精品成人一区二区在线| 91精品国产色综合久久不卡蜜臀 | 国产精品久久毛片a| 欧美一级午夜免费电影| 4438x成人网最大色成网站| 青青草97国产精品免费观看| 日韩欧美黄色影院| 国产精品主播直播| 中文字幕亚洲精品在线观看| 99精品黄色片免费大全| 亚洲自拍欧美精品| 欧美一级片在线看| 国产成人免费视| 一区二区三区高清在线| 在线播放中文一区| 国产精品一区二区免费不卡 | 国产美女精品在线| 国产精品家庭影院| 欧美嫩在线观看| 国产老妇另类xxxxx| 亚洲欧美成人一区二区三区| 欧美日韩一本到| 国产精品夜夜嗨| 一区二区三区在线看| 日韩三级.com| 99综合电影在线视频| 亚洲gay无套男同| 久久亚洲免费视频| 日韩欧美视频在线| 成人免费小视频| 欧美一卡在线观看| 风间由美中文字幕在线看视频国产欧美| 综合色中文字幕| 69av一区二区三区| 不卡电影一区二区三区| 天天综合天天做天天综合| 久久先锋影音av鲁色资源网| 在线观看日韩一区| ㊣最新国产の精品bt伙计久久| 轻轻草成人在线| 国产精品一二三在| 综合色天天鬼久久鬼色| 制服丝袜成人动漫| 97久久久精品综合88久久| 麻豆免费精品视频| 亚洲宅男天堂在线观看无病毒| 精品成人免费观看| 欧美日韩性生活| 不卡在线观看av| 狠狠色丁香婷婷综合| 亚洲成a人片综合在线| 中文字幕在线观看不卡| 精品美女被调教视频大全网站| 色噜噜狠狠色综合中国| 国产成人精品三级| 日本视频在线一区| 亚洲香肠在线观看| 国产精品伦理一区二区| 精品国产青草久久久久福利| 欧美图片一区二区三区| 91原创在线视频| 国产精品综合一区二区| 蜜臀av性久久久久蜜臀aⅴ四虎| 亚洲黄色免费电影| 国产精品久久一级| 久久久亚洲午夜电影| 亚洲国产精品综合小说图片区| 国产精品婷婷午夜在线观看| 精品国产制服丝袜高跟| 91麻豆精品国产91久久久久久 | 秋霞电影网一区二区| 亚洲成a人片在线观看中文| 亚洲视频免费在线| 国产精品网友自拍| 日本一区二区三区国色天香| 欧美大肚乱孕交hd孕妇| 欧美一区二区三区喷汁尤物| 欧美日韩中文字幕精品| 91国模大尺度私拍在线视频| 不卡av免费在线观看| 成人国产精品免费观看动漫| 国产精品亚洲а∨天堂免在线| 激情综合网天天干|