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

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

?? os_task.c

?? ucos在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一区二区三区免费野_久草精品视频
亚洲午夜电影在线观看| 在线观看亚洲成人| 亚洲高清中文字幕| 国产日韩精品视频一区| 69久久夜色精品国产69蝌蚪网| 成人深夜福利app| 极品少妇xxxx精品少妇| 午夜不卡av免费| 一区二区三区精品| 一区二区三区四区不卡在线| 国产精品二三区| 2023国产精华国产精品| 精品乱人伦小说| 欧美大黄免费观看| 欧美电视剧免费全集观看| 91超碰这里只有精品国产| 欧美高清视频一二三区| 欧美日本韩国一区二区三区视频| 成人美女视频在线看| 国内国产精品久久| 国产精品69毛片高清亚洲| 久久99日本精品| 国产在线播放一区二区三区| 天堂成人国产精品一区| 亚洲成人高清在线| 一区二区成人在线| 五月婷婷久久丁香| 亚洲精品老司机| 亚洲一本大道在线| 亚洲国产aⅴ成人精品无吗| 亚洲亚洲精品在线观看| 日韩av中文在线观看| 免费高清成人在线| 精油按摩中文字幕久久| 成人午夜电影久久影院| av激情成人网| 欧美日韩夫妻久久| 欧美一区中文字幕| 国产色爱av资源综合区| 亚洲女同ⅹxx女同tv| 亚洲国产日日夜夜| 久久av资源站| 91网站最新地址| 欧美剧情电影在线观看完整版免费励志电影| 欧美午夜一区二区| 国产精品久久福利| 洋洋成人永久网站入口| 国产精品一二一区| 亚洲美女在线一区| 国产精品99久久不卡二区| 91精品麻豆日日躁夜夜躁| 亚洲国产欧美在线人成| 欧美另类一区二区三区| 午夜一区二区三区视频| 亚洲欧洲av另类| 91视频精品在这里| 亚洲精品美腿丝袜| 欧美在线你懂的| 亚洲成人免费在线观看| 欧美日韩成人综合| 蜜臀a∨国产成人精品| 亚洲精品在线一区二区| 国产精品一区久久久久| 国产精品乱码妇女bbbb| 色综合久久久久综合体| 亚洲电影视频在线| 日韩一区二区三区电影 | 国产亚洲女人久久久久毛片| 国产一区二区三区四区五区美女| 久久亚洲综合色| 国产91精品免费| 亚洲欧美日韩国产综合在线| 欧美色精品天天在线观看视频| 天天色图综合网| 精品久久人人做人人爽| 国产成人免费在线观看不卡| 亚洲人成精品久久久久久| 欧美精品在欧美一区二区少妇| 亚洲一二三专区| 2021国产精品久久精品| 91一区二区在线观看| 三级不卡在线观看| 久久亚洲综合av| 色视频一区二区| 视频一区国产视频| 国产三级欧美三级| 欧美日韩中文字幕一区二区| 国产主播一区二区三区| 一区二区三区在线视频免费| 欧美一二三区在线| 99视频在线观看一区三区| 午夜私人影院久久久久| 国产精品色噜噜| 欧美日韩国产片| 国产夫妻精品视频| 天堂精品中文字幕在线| 亚洲视频免费观看| 精品va天堂亚洲国产| 99久久综合精品| 蜜乳av一区二区| 亚洲激情男女视频| 久久婷婷综合激情| 欧美日本一区二区三区| 成人av电影在线网| 另类综合日韩欧美亚洲| 夜夜嗨av一区二区三区网页| 国产拍揄自揄精品视频麻豆| 6080国产精品一区二区| 色吊一区二区三区| 福利一区在线观看| 美女mm1313爽爽久久久蜜臀| 精品国产乱码久久久久久1区2区 | 免费看日韩a级影片| 一区二区三区丝袜| 一区2区3区在线看| 亚洲午夜精品在线| 亚洲成人综合网站| 日韩中文欧美在线| 视频一区视频二区中文| 免费日本视频一区| 老司机精品视频在线| 国产精品人人做人人爽人人添| 亚洲婷婷综合色高清在线| 国产午夜精品一区二区三区嫩草 | 国产亚洲精品aa| 国产亚洲自拍一区| 亚洲国产精品高清| 中文字幕一区二区三区不卡| 亚洲天堂精品视频| 亚洲成人在线观看视频| 久久精品99国产精品日本| 狠狠久久亚洲欧美| www.亚洲精品| 欧美三级资源在线| 欧美精品一区二区久久久| 欧美三级电影一区| 日本道免费精品一区二区三区| 精品久久久久久久久久久院品网 | 欧美三级欧美一级| 欧美一区日韩一区| 26uuu国产电影一区二区| 国产精品亲子乱子伦xxxx裸| 亚洲卡通欧美制服中文| 日韩av不卡在线观看| 国产成人精品一区二区三区四区| 99精品偷自拍| 欧美一级片免费看| 欧美激情一区二区三区四区| 亚洲欧美一区二区三区极速播放| 亚洲国产成人高清精品| 国产在线播精品第三| 色噜噜狠狠色综合中国| 欧美一级二级在线观看| 国产精品电影一区二区| 日日摸夜夜添夜夜添精品视频| 国产成人av影院| 在线播放中文一区| 国产精品亲子伦对白| 蜜桃视频第一区免费观看| 不卡视频免费播放| 91精选在线观看| 亚洲欧美国产77777| 久久精品99国产精品| 日本福利一区二区| 国产午夜精品一区二区三区四区| 亚洲福利电影网| av不卡在线播放| 精品久久久久久久久久久久包黑料| 日韩美女啊v在线免费观看| 久久精工是国产品牌吗| 在线一区二区三区做爰视频网站| 久久久综合九色合综国产精品| 亚洲大尺度视频在线观看| 99国产精品久| 日本一区二区电影| 国产做a爰片久久毛片| 欧美三级韩国三级日本三斤| 综合久久一区二区三区| 成人午夜电影小说| 国产亚洲欧洲997久久综合| 视频一区视频二区在线观看| 91福利视频网站| 亚洲视频中文字幕| 成人18精品视频| 久久久精品国产免大香伊| 日本伊人午夜精品| 在线观看91av| 亚洲va欧美va国产va天堂影院| 一本大道久久a久久精品综合| 久久久国产一区二区三区四区小说 | 亚洲色图欧洲色图婷婷| 成人性色生活片| 久久久久久久国产精品影院| 日本不卡不码高清免费观看| 欧美日韩成人在线一区| 亚洲自拍偷拍九九九| 在线观看视频一区二区欧美日韩| 国产精品国产三级国产aⅴ入口 | 国产三级一区二区三区| 国产91综合网|