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

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

?? os_task.c

?? ucos-II 基于pc的范例 中文解釋 包涵全部源碼
?? 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 *pdata, 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, pdata, 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一区二区三区免费野_久草精品视频
久久久精品黄色| 91精品国产综合久久久久久久 | 26uuu国产电影一区二区| 最新中文字幕一区二区三区| 日本一不卡视频| 99国产精品久久久久久久久久| 欧美一级夜夜爽| 亚洲视频电影在线| 久久66热偷产精品| 亚洲欧美在线视频观看| 成人小视频在线观看| 欧美日韩国产一二三| 国产精品美日韩| 久88久久88久久久| 欧美高清一级片在线| 亚洲特黄一级片| 国产乱码精品一区二区三| 欧美美女激情18p| 亚洲激情男女视频| caoporen国产精品视频| 久久久久亚洲综合| 久久精品免费观看| 欧美一区二区三区的| 亚洲一二三区在线观看| 一本大道久久a久久综合| 国产女人18毛片水真多成人如厕| 久久国产婷婷国产香蕉| 欧美一卡2卡3卡4卡| 秋霞午夜鲁丝一区二区老狼| 精品视频123区在线观看| 一区二区三区精品在线观看| 色综合久久中文字幕综合网| 1000部国产精品成人观看| av影院午夜一区| 一区免费观看视频| 色哟哟一区二区在线观看 | 日韩美女在线视频| 日本不卡123| 日韩精品一区在线观看| 韩国精品在线观看| 中文字幕久久午夜不卡| 成人黄色小视频在线观看| 国产精品久线在线观看| 色综合天天综合| 亚洲国产一区视频| 欧美一级xxx| 国产精品1区2区3区在线观看| 26uuu亚洲婷婷狠狠天堂| 国产成人精品三级麻豆| 亚洲丝袜自拍清纯另类| 欧美色综合网站| 蜜桃av一区二区| 中文字幕乱码久久午夜不卡| 91免费版在线| 日韩一区精品视频| 久久日韩粉嫩一区二区三区 | 欧美日韩和欧美的一区二区| 蜜桃久久久久久久| 中文文精品字幕一区二区| 一本大道综合伊人精品热热| 午夜精品福利一区二区蜜股av| 日韩免费高清视频| 99re亚洲国产精品| 日韩va亚洲va欧美va久久| 国产丝袜欧美中文另类| 欧洲日韩一区二区三区| 国产主播一区二区三区| 亚洲激情成人在线| 久久综合国产精品| 日本高清免费不卡视频| 伦理电影国产精品| 亚洲人成网站在线| 日韩午夜在线影院| 91亚洲午夜精品久久久久久| 日本色综合中文字幕| 日韩毛片在线免费观看| 欧美一级理论片| 色八戒一区二区三区| 国产米奇在线777精品观看| 亚洲精品久久嫩草网站秘色| 久久久久久久久99精品| 欧美日韩免费视频| thepron国产精品| 免费xxxx性欧美18vr| 亚洲人成小说网站色在线| 久久麻豆一区二区| 91精品国产色综合久久| 91啦中文在线观看| 国产成人午夜99999| 日本亚洲一区二区| 五月综合激情婷婷六月色窝| 国产精品夫妻自拍| 日本一区二区三区视频视频| 日韩美女视频在线| 91精品国产综合久久久久| 色综合婷婷久久| 成人激情免费视频| 在线观看亚洲精品视频| 国产suv精品一区二区883| 久久精品国产**网站演员| 舔着乳尖日韩一区| 一区二区不卡在线播放| 亚洲三级免费电影| 中文字幕一区二区三区视频| 久久男人中文字幕资源站| 日韩手机在线导航| 日韩三级中文字幕| 欧美一级在线观看| 日韩区在线观看| 91精品国产综合久久福利软件 | 亚洲精品一二三| 亚洲色图欧洲色图婷婷| 中文字幕制服丝袜成人av | 综合av第一页| 亚洲三级电影网站| 一区二区三区美女视频| 亚洲国产精品自拍| 午夜免费久久看| 免费高清在线一区| 狠狠网亚洲精品| 国产综合成人久久大片91| 国产精品1区二区.| 成人av电影观看| 在线视频国产一区| 欧美老人xxxx18| 日韩三级精品电影久久久 | 欧美日韩在线播| 91精品国产一区二区| 欧美变态tickle挠乳网站| 精品黑人一区二区三区久久| 2020国产精品久久精品美国| 国产精品视频yy9299一区| 日韩美女视频19| 亚洲线精品一区二区三区| 日韩中文欧美在线| aaa国产一区| 欧美三级在线播放| 精品国产一区久久| 亚洲视频在线观看三级| 午夜久久久久久久久| 经典三级在线一区| 99r国产精品| 欧美日韩国产一级二级| www国产精品av| 亚洲三级在线播放| 裸体歌舞表演一区二区| 成人午夜激情片| 欧美精品三级日韩久久| 国产婷婷一区二区| 亚洲国产一区视频| 国产一区二区不卡| 欧美日韩视频一区二区| 久久久久久久久99精品| 亚洲 欧美综合在线网络| 国内偷窥港台综合视频在线播放| 色综合一个色综合亚洲| 精品久久久久一区二区国产| 亚洲人成网站精品片在线观看| 日本va欧美va欧美va精品| 成人黄页在线观看| 欧美一区二区精品| 亚洲欧美日韩在线| 国产成人午夜视频| 91精品国产色综合久久| 亚洲美女少妇撒尿| 国产自产v一区二区三区c| 欧美三级电影在线看| 中文字幕精品在线不卡| 裸体一区二区三区| 在线观看区一区二| 亚洲欧洲性图库| 久久99久久99精品免视看婷婷| 欧美视频一区二区三区| 国产日产精品一区| 奇米精品一区二区三区在线观看 | 精品在线你懂的| 欧美日韩国产综合视频在线观看| 国产精品高清亚洲| 国产精品综合二区| 精品处破学生在线二十三| 日韩中文字幕91| 在线免费观看成人短视频| 亚洲欧洲国产日本综合| 成人精品一区二区三区四区| 久久综合九色欧美综合狠狠 | 亚洲狠狠爱一区二区三区| 国产91精品一区二区麻豆亚洲| 日韩精品中文字幕一区二区三区| 亚洲国产欧美在线人成| 色综合天天天天做夜夜夜夜做| 久久久久久97三级| 精品一区二区三区久久| 日韩精品一区二区三区视频 | 国产一区欧美日韩| 欧美视频日韩视频| 亚洲二区在线视频| 在线视频中文字幕一区二区| 亚洲免费观看高清完整版在线观看 | 日韩精品一区二区三区视频| 偷拍自拍另类欧美|