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

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

?? os_task.c

?? 邵貝貝的UCOS書后光盤內容
?? 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视频在线观看| 日韩精品一区二区三区蜜臀| 麻豆成人综合网| 久久综合精品国产一区二区三区 | av一区二区久久| 中文字幕日韩一区| 91蜜桃网址入口| 亚洲一区二区三区中文字幕 | 在线一区二区三区四区五区| 婷婷成人激情在线网| 日韩三级电影网址| 国产激情91久久精品导航| 中文字幕av在线一区二区三区| 成人av网址在线观看| 依依成人精品视频| 欧美一级免费观看| 国产成人精品亚洲午夜麻豆| 一区二区三区四区在线| 欧美一区二区在线免费播放| 成人性生交大片免费看中文网站| 亚洲精品成a人| 欧美一区二区女人| 不卡一区中文字幕| 舔着乳尖日韩一区| 国产日韩欧美激情| 欧美日韩精品一区二区三区四区| 国产一区二区在线影院| 亚洲伊人色欲综合网| 精品国免费一区二区三区| 色综合色综合色综合色综合色综合| 亚洲第一二三四区| 中文字幕电影一区| 宅男在线国产精品| eeuss鲁片一区二区三区在线观看| 天天综合网 天天综合色| 国产三级精品视频| 欧美日韩成人综合天天影院| 丁香网亚洲国际| 日韩电影一区二区三区| 国产精品美女一区二区三区 | 国产经典欧美精品| 亚洲成av人片在线| 亚洲人精品午夜| 2020国产成人综合网| 欧美日韩免费观看一区三区| 成人伦理片在线| 国产一区不卡视频| 日韩在线播放一区二区| 亚洲精品亚洲人成人网| 久久麻豆一区二区| 678五月天丁香亚洲综合网| jvid福利写真一区二区三区| 国内精品久久久久影院薰衣草| 五月天婷婷综合| 亚洲免费观看高清在线观看| 欧美国产精品一区二区三区| 国产精品美女久久久久aⅴ | 国产精品一区二区在线观看网站| 午夜精品视频在线观看| 亚洲视频中文字幕| 国产精品福利影院| 国产网站一区二区| 国产视频在线观看一区二区三区| 日韩欧美国产电影| 日韩一区二区高清| 欧美精品777| 欧美精品777| 91精品在线观看入口| 欧美日韩在线精品一区二区三区激情| 色综合久久久久综合| 99riav久久精品riav| 成人精品视频网站| 国产成人精品一区二区三区四区 | 国产美女一区二区| 韩国女主播一区| 久久99精品一区二区三区三区| 天天影视网天天综合色在线播放| 亚洲综合小说图片| 一区二区三国产精华液| 亚洲精品国产视频| 一卡二卡三卡日韩欧美| 亚洲一区二区三区四区五区黄| 亚洲一区二区三区四区在线观看 | 91精品国产色综合久久久蜜香臀| 欧美日韩一区二区欧美激情| 337p亚洲精品色噜噜狠狠| 4438x成人网最大色成网站| 日韩一级片在线播放| 欧美大胆一级视频| 国产欧美一区二区三区沐欲| 中文字幕制服丝袜一区二区三区| 亚洲欧美日韩久久| 亚洲成年人影院| 麻豆精品蜜桃视频网站| 国产在线国偷精品免费看| 成人一区二区三区中文字幕| 91视频在线观看| 欧美区一区二区三区| 精品欧美一区二区在线观看| 国产精品久久久久影院老司| 亚洲午夜免费视频| 美国毛片一区二区三区| 成人激情小说乱人伦| 色屁屁一区二区| 欧美成人女星排名| 中文字幕欧美激情| 午夜激情久久久| 国产在线播精品第三| 色婷婷亚洲精品| 日韩精品中文字幕在线不卡尤物| 日本一二三四高清不卡| 亚洲国产精品一区二区久久| 国内精品伊人久久久久av一坑 | 欧美乱妇20p| 久久亚洲精品小早川怜子| 中文字幕视频一区| 免费欧美高清视频| 99在线视频精品| 日韩欧美一区二区久久婷婷| 18成人在线观看| 久久精品国产亚洲一区二区三区| 91在线小视频| 欧美不卡在线视频| 一区二区三区色| 国产丶欧美丶日本不卡视频| 欧美日韩在线播放三区四区| 国产精品免费网站在线观看| 日韩av一级片| 色哟哟国产精品免费观看| 日韩欧美国产wwwww| 亚洲一区二区av在线| 大胆亚洲人体视频| 精品成人一区二区三区| 亚洲永久精品大片| 99精品偷自拍| 国产日韩欧美激情| 激情综合一区二区三区| 欧美无乱码久久久免费午夜一区| 国产拍欧美日韩视频二区 | 国产一区视频网站| 欧美高清dvd| 亚洲影院在线观看| 99久久国产综合色|国产精品| 久久久国际精品| 久久精品国产77777蜜臀| 欧美丝袜自拍制服另类| 国产精品不卡视频| 成人午夜精品一区二区三区| 精品欧美一区二区三区精品久久| 天天综合色天天| 欧美三区在线观看| 亚洲夂夂婷婷色拍ww47| 99re成人在线| 中文字幕一区在线| 北岛玲一区二区三区四区 | 一区二区三区日韩在线观看| 9l国产精品久久久久麻豆| 国产精品欧美精品| 国产.欧美.日韩| 国产午夜精品美女毛片视频| 韩国精品主播一区二区在线观看| 91精品国产乱| 五月婷婷久久丁香| 91麻豆精品国产| 蜜臀av一区二区三区| 日韩精品在线网站| 精品无人码麻豆乱码1区2区 | 欧美一区二区三区免费在线看 | 欧美精品一区男女天堂| 蜜桃免费网站一区二区三区| 精品少妇一区二区三区视频免付费 | 91久久国产综合久久| 中文字幕亚洲一区二区av在线 | 欧美日韩国产bt| 亚洲成人精品一区二区| 欧美丰满嫩嫩电影| 麻豆国产91在线播放| 久久精品一区四区| 成人av影视在线观看| 亚洲免费观看高清完整版在线观看熊 | 欧美日韩黄色影视| 日本成人在线看| 精品对白一区国产伦| 成人精品视频一区二区三区| 亚洲激情自拍偷拍| 7777精品久久久大香线蕉| 国内精品不卡在线| 日本一区二区成人| 精品视频免费在线| 麻豆成人91精品二区三区| 国产日韩av一区二区| 91麻豆视频网站| 午夜精品久久久久久久99樱桃| 欧美成人乱码一区二区三区| 成人综合在线观看| 亚洲成人先锋电影| 久久精品视频网| 在线观看av不卡| 国产一区二区三区精品欧美日韩一区二区三区 |