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

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

?? os_task.c

?? uCOS_II在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
*********************************************************************************************************
*/


static  void  OSDummy(void) REENTRANT;

/*
*********************************************************************************************************
*                                            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
{
}

/*$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   DT_XDATA *ptcb;
    OS_EVENT DT_XDATA *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 DT_XDATA *)0) {                 /* New priority must not already exist */
        OS_EXIT_CRITICAL();
        return (OS_PRIO_EXIST);
    } else {
        OSTCBPrioTbl[newprio] = (OS_TCB DT_XDATA *)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 DT_XDATA *)0) {    /* Task to change must exist           */
            OSTCBPrioTbl[oldprio] = (OS_TCB DT_XDATA *)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 DT_XDATA *)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 DT_XDATA *)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
*
*              ppdata    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 'ppdata' as follows:
*
*                           void Task (void *ppdata)
*                           {
*                               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 (DT_CODE *task)(void DT_XDATA *pd), void DT_XDATA *ppdata, OS_STK DT_XDATA *ptos, INT8U prio) REENTRANT
{
    void DT_XDATA *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 DT_XDATA *)0) { /* Make sure task doesn't already exist at this priority  */
        OSTCBPrioTbl[prio] = (OS_TCB DT_XDATA *)1;    /* Reserve the priority to prevent others from doing ...  */
                                             /* ... the same thing until task is created.              */
        OS_EXIT_CRITICAL();
        psp = (void DT_XDATA *)OSTaskStkInit(task, ppdata, ptos, 0); /* Initialize the task's stack              */
        err = OSTCBInit(prio, psp, (void DT_XDATA *)0, 0, 0, (void DT_XDATA *)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 DT_XDATA *)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
*
*              ppdata    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 'ppdata' as follows:
*
*                           void Task (void *ppdata)
*                           {
*                               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一区二区三区免费野_久草精品视频
国产精品一区专区| 日本高清无吗v一区| 一区二区在线观看视频| 日韩午夜小视频| 色综合久久久网| 国产一区二区三区久久悠悠色av | 欧美日韩大陆一区二区| 国产一区二区免费看| 亚洲高清视频的网址| 国产精品欧美久久久久无广告 | 一区二区三区视频在线观看| 精品粉嫩超白一线天av| 欧美色综合网站| 97久久超碰国产精品| 国产乱码一区二区三区| 青青草97国产精品免费观看 | 久久综合资源网| 欧美精选一区二区| 日本一区二区三区dvd视频在线| 91在线你懂得| 成人黄色软件下载| 国产一区二区三区综合| 看片网站欧美日韩| 日韩影院精彩在线| 午夜精品福利在线| 亚洲一区二区三区四区在线| 中文字幕在线一区二区三区| 国产三级一区二区三区| 精品国产亚洲在线| 91精品国产综合久久香蕉麻豆| 色8久久人人97超碰香蕉987| 不卡av免费在线观看| 国产一区不卡在线| 国产一区二区不卡老阿姨| 国模冰冰炮一区二区| 激情伊人五月天久久综合| 久久99这里只有精品| 久久99热99| 国产一区亚洲一区| 国产一区二区三区四| 国产精品18久久久| 成人av午夜影院| 99精品视频一区二区| 成年人国产精品| 97精品久久久午夜一区二区三区| 成人福利视频网站| av不卡在线播放| 91福利在线播放| 欧美影院一区二区三区| 欧美视频第二页| 欧美一区日韩一区| 欧美变态口味重另类| 久久亚洲一区二区三区四区| 亚洲精品一区在线观看| 国产日韩精品视频一区| 国产精品国产精品国产专区不片| 亚洲欧美综合色| 亚洲一区二区三区自拍| 日本成人在线网站| 国产一区二区视频在线播放| 国产aⅴ综合色| 在线亚洲人成电影网站色www| 欧美天天综合网| 欧美xxxxx裸体时装秀| 国产欧美一区在线| 亚洲欧美色一区| 日韩电影网1区2区| 国产精品88888| 色香蕉久久蜜桃| 欧美一二三四区在线| 国产日韩av一区二区| 亚洲男帅同性gay1069| 日日摸夜夜添夜夜添亚洲女人| 韩国在线一区二区| 91麻豆产精品久久久久久 | 欧美草草影院在线视频| 中文字幕精品综合| 亚洲一区二区三区国产| 美脚の诱脚舐め脚责91 | 亚洲在线视频免费观看| 麻豆成人av在线| 91网站在线播放| 91精品国产91久久综合桃花 | 欧美电影免费提供在线观看| 国产亚洲精久久久久久| 亚洲成av人在线观看| 国产一区二区三区香蕉| 欧美亚洲动漫制服丝袜| 久久精品亚洲乱码伦伦中文 | 精品国产91乱码一区二区三区| 国产精品视频看| 日本亚洲三级在线| 97久久精品人人做人人爽50路| 91精品国产91久久久久久最新毛片| 国产精品久久毛片| 麻豆精品久久精品色综合| 91在线精品秘密一区二区| 日韩你懂的在线观看| 亚洲欧美一区二区久久 | 欧美精品欧美精品系列| 国产精品五月天| 捆绑紧缚一区二区三区视频| 日本黄色一区二区| 国产精品久久久久久亚洲伦| 麻豆91精品视频| 欧美日韩成人在线一区| 亚洲三级视频在线观看| 国产乱码精品1区2区3区| 欧美精品高清视频| 亚洲精品免费看| 99久久精品免费看国产免费软件| 精品国产乱码久久久久久久| 亚洲精品久久久久久国产精华液| 国产麻豆9l精品三级站| 日韩一本二本av| 天天综合网天天综合色| 在线视频观看一区| ●精品国产综合乱码久久久久| 国产一区二三区好的| 欧美电影免费观看完整版| 日韩精品一区第一页| 色久优优欧美色久优优| 亚洲欧洲美洲综合色网| 高清不卡一区二区在线| 久久影院午夜论| 国模一区二区三区白浆| 欧美成人女星排行榜| 免费高清视频精品| 91精品国产欧美一区二区成人| 亚欧色一区w666天堂| 欧美日韩国产成人在线免费| 亚洲伦理在线免费看| 91蝌蚪国产九色| 亚洲欧美日韩国产综合在线| 91在线精品一区二区| 亚洲欧美aⅴ...| 一本色道a无线码一区v| 亚洲欧美一区二区久久| 91成人国产精品| 亚洲图片欧美综合| 欧美酷刑日本凌虐凌虐| 婷婷开心激情综合| 日韩亚洲国产中文字幕欧美| 久久国产精品区| 久久亚区不卡日本| 国产91在线看| 亚洲欧美综合网| 欧美在线观看视频在线| 亚洲福中文字幕伊人影院| 制服丝袜国产精品| 精品在线亚洲视频| 久久新电视剧免费观看| 成人黄色免费短视频| 一区二区三区四区在线免费观看| 欧美在线制服丝袜| 无码av免费一区二区三区试看| 欧美精品久久天天躁| 久久精品国产一区二区| 国产午夜亚洲精品不卡| av网站免费线看精品| 亚洲午夜精品在线| 日韩久久免费av| 国产成人在线看| 亚洲欧美电影一区二区| 欧美乱熟臀69xxxxxx| 国产一区二区三区久久悠悠色av| 日本一区二区高清| 在线视频中文字幕一区二区| 日韩电影免费一区| 中文久久乱码一区二区| 欧美系列亚洲系列| 青青草精品视频| 亚洲国产激情av| 在线不卡中文字幕播放| 国产精品77777| 亚洲综合无码一区二区| 精品va天堂亚洲国产| 9色porny自拍视频一区二区| 午夜久久久久久| 国产精品理伦片| 欧美日韩视频在线第一区| 国产精品综合av一区二区国产馆| 亚洲免费资源在线播放| 日韩精品一区二| 在线视频国内一区二区| 精品亚洲免费视频| 亚洲一区在线观看视频| 久久综合精品国产一区二区三区 | 日日夜夜精品视频天天综合网| 久久久激情视频| 欧美日韩精品系列| 国产精品一二三区| 婷婷亚洲久悠悠色悠在线播放| 中文字幕精品—区二区四季| 欧美一区二区三区在线视频| 99久久99久久精品免费看蜜桃| 麻豆精品新av中文字幕| 一区二区三区欧美久久| 国产色91在线| 欧美白人最猛性xxxxx69交|