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

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

?? os_task.c

?? 講UC/OS的書
?? 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一区二区三区免费野_久草精品视频
欧亚洲嫩模精品一区三区| 亚洲成人先锋电影| 国产乱码精品一品二品| 欧美一区二区三区播放老司机| 亚洲卡通欧美制服中文| 日本伊人精品一区二区三区观看方式| 欧美三片在线视频观看| 亚洲地区一二三色| 欧美久久一二区| 天天综合色天天综合色h| 91麻豆视频网站| 亚洲乱码中文字幕| 日本韩国精品在线| 亚洲成人一区二区| 在线电影欧美成精品| 国产精品白丝在线| 91免费版在线看| 亚洲国产婷婷综合在线精品| 一本久久a久久免费精品不卡| 一区二区三区波多野结衣在线观看| 色哟哟精品一区| 亚洲成人三级小说| 欧美日韩一区二区不卡| 视频一区视频二区中文| 日韩欧美高清dvd碟片| 国产一区二区在线视频| 一区在线观看视频| 不卡视频在线观看| 亚洲自拍偷拍图区| 欧美tickling网站挠脚心| 国产精品69久久久久水密桃| 中文字幕一区二区5566日韩| 91国模大尺度私拍在线视频| 日韩av一区二区在线影视| 久久精品网站免费观看| 色香蕉久久蜜桃| 美女一区二区视频| 国产精品久久久久久久久久免费看| 色视频成人在线观看免| 久久超碰97人人做人人爱| 亚洲专区一二三| 中文字幕av一区二区三区高 | 欧美区视频在线观看| 国产电影一区二区三区| 天堂一区二区在线| 亚洲人成人一区二区在线观看| 精品国产网站在线观看| 欧美午夜片在线看| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 国产精品一区二区免费不卡| 夜夜爽夜夜爽精品视频| 亚洲国产精品二十页| 欧美mv日韩mv国产网站| 69堂国产成人免费视频| 91美女在线看| av电影在线观看不卡 | 高清在线不卡av| 国精产品一区一区三区mba桃花 | 91久久精品国产91性色tv| 国产成人亚洲综合a∨婷婷| 美女视频黄免费的久久| 天天免费综合色| 亚洲成av人片在线观看无码| 夜夜精品视频一区二区| 亚洲精品免费电影| 国产精品色眯眯| 国产农村妇女毛片精品久久麻豆| 26uuu国产在线精品一区二区| 制服丝袜日韩国产| 欧美另类高清zo欧美| 欧美日本在线播放| 欧美精品亚洲二区| 欧美一区三区二区| 日韩一级黄色大片| 欧美电影免费观看高清完整版| 欧美福利一区二区| 欧美一区二区啪啪| 日韩免费一区二区| 精品国产凹凸成av人导航| 欧美不卡一区二区三区四区| 精品国产伦一区二区三区观看体验 | 91美女片黄在线观看| 一本久久精品一区二区| 在线观看日韩精品| 在线观看av一区| 6080日韩午夜伦伦午夜伦| 日韩欧美综合在线| 久久综合九色综合97婷婷女人| 国产亚洲欧美一区在线观看| 亚洲国产精品v| 尤物视频一区二区| 天天做天天摸天天爽国产一区| 日韩福利视频网| 国产麻豆视频一区| 99久久99久久精品免费看蜜桃| 一本大道久久a久久综合| 精品视频资源站| 精品少妇一区二区| 国产精品久久一卡二卡| 一区二区在线观看视频 | 亚洲午夜久久久久久久久电影网 | 精品午夜久久福利影院| 韩国av一区二区| va亚洲va日韩不卡在线观看| 精品视频一区二区不卡| 日韩三级免费观看| 国产精品久久久久婷婷| 亚洲一级二级三级| 久久99国产精品久久| 99久久精品久久久久久清纯| 在线观看91精品国产麻豆| 久久久久久久久久久久久女国产乱 | 美女在线一区二区| 不卡电影一区二区三区| 欧美日韩精品一区二区天天拍小说| 欧美不卡视频一区| 亚洲欧美另类久久久精品2019| 日本aⅴ免费视频一区二区三区 | 欧美蜜桃一区二区三区| 久久精品人人做| 亚洲第一会所有码转帖| 国产在线乱码一区二区三区| 99视频精品在线| 欧美本精品男人aⅴ天堂| 亚洲天堂精品视频| 国内精品免费在线观看| 欧美日韩亚洲综合| 亚洲国产精品av| 久久精品99国产精品| 欧美影院精品一区| 国产精品国产三级国产aⅴ中文| 麻豆91精品91久久久的内涵| 色综合久久天天综合网| 久久精品欧美日韩| 全国精品久久少妇| 欧美日韩综合不卡| 国产精品私人自拍| 国产精一区二区三区| 日韩欧美一区在线观看| 一区二区三区加勒比av| 成人污视频在线观看| 久久亚洲影视婷婷| 美国毛片一区二区| 欧美视频中文一区二区三区在线观看| 国产婷婷色一区二区三区四区| 免费高清在线视频一区·| 在线一区二区视频| 亚洲精品中文在线观看| 成人免费视频网站在线观看| 精品欧美一区二区久久| 99精品国产99久久久久久白柏| 久久亚洲精华国产精华液 | 亚洲国产美女搞黄色| jlzzjlzz国产精品久久| 国产欧美日韩另类视频免费观看 | 视频一区欧美日韩| 色综合久久中文综合久久97| 中文字幕一区二区三区在线播放 | av在线一区二区三区| 欧美国产丝袜视频| 成人免费视频网站在线观看| 国产校园另类小说区| 粉嫩在线一区二区三区视频| 久久久欧美精品sm网站| 国产精品88av| 国产精品第五页| 色综合久久久网| 亚洲成人在线网站| 51久久夜色精品国产麻豆| 婷婷国产v国产偷v亚洲高清| 69堂成人精品免费视频| 乱一区二区av| 久久综合色之久久综合| 国产精品一二三四区| 欧美国产精品专区| av在线不卡电影| 亚洲午夜电影在线| 日韩亚洲欧美一区| 国产精品99精品久久免费| 国产精品欧美一区喷水| 91久久精品一区二区| 日韩二区三区在线观看| 欧美电影免费观看高清完整版在线 | 亚洲激情第一区| 欧美日韩精品一区二区天天拍小说 | 麻豆91精品91久久久的内涵| 亚洲国产欧美日韩另类综合| 欧美精品三级日韩久久| 国产另类ts人妖一区二区| 亚洲欧美综合色| 欧美日韩不卡视频| 国产精品一区二区在线看| 亚洲视频在线观看三级| 欧美日韩精品一区二区三区| 久久国产日韩欧美精品| 中文字幕一区二区三中文字幕 | 日韩免费在线观看| 成人中文字幕电影| 亚洲www啪成人一区二区麻豆| 日韩一级高清毛片|