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

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

?? os_task.c

?? ucosii移植到C8051F023上的源代碼。 有三個任務
?? 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一区二区三区免费野_久草精品视频
91在线你懂得| 国产精品五月天| 国产婷婷精品av在线| 亚洲精品国产一区二区精华液| 日韩中文字幕一区二区三区| 成人精品一区二区三区四区| 日韩欧美国产1| 亚洲自拍偷拍网站| 成人黄色网址在线观看| 欧美www视频| 亚洲电影第三页| 色先锋久久av资源部| 国产欧美精品一区二区色综合| 日韩电影免费在线| 欧美日韩精品系列| 亚洲一区二区av电影| 波多野结衣在线一区| 久久久99精品免费观看| 日本中文字幕一区二区视频| 色老汉av一区二区三区| 国产精品成人午夜| www.欧美色图| 中文字幕一区二区三区四区不卡 | 日韩av在线免费观看不卡| 91视频在线观看免费| 国产精品久久久久久妇女6080 | 国产毛片精品国产一区二区三区| 欧美福利视频导航| 日一区二区三区| 欧美电影在线免费观看| 亚洲动漫第一页| 欧美日韩在线播放三区四区| 一区二区国产视频| 欧美三区在线观看| 午夜精品久久久久久久久| 欧美久久一二区| 奇米精品一区二区三区四区| 欧美草草影院在线视频| 韩国成人福利片在线播放| 国产午夜亚洲精品不卡| 成人美女视频在线观看18| 亚洲欧洲另类国产综合| 在线观看日产精品| 爽好多水快深点欧美视频| 日韩欧美在线不卡| 国产精品中文字幕一区二区三区| 日本一区二区三区电影| 一本色道久久综合亚洲91| 亚洲午夜精品在线| 精品国内二区三区| 成人久久18免费网站麻豆 | 中文字幕人成不卡一区| 一本色道久久综合亚洲91| 午夜精品福利一区二区三区蜜桃| 日韩亚洲欧美一区二区三区| 激情综合色播激情啊| 国产精品久久久久久亚洲毛片| 在线观看亚洲专区| 日本视频免费一区| 国产精品无遮挡| 69av一区二区三区| 丁香另类激情小说| 亚洲成av人在线观看| 久久久91精品国产一区二区三区| 97se亚洲国产综合自在线观| 日韩影院免费视频| 国产精品久久看| 欧美精品v日韩精品v韩国精品v| 激情综合色综合久久| 亚洲视频1区2区| 日韩精品一区二区三区在线 | 精品欧美一区二区在线观看| 成人在线视频首页| 日韩国产高清在线| 国产精品福利一区二区三区| 日韩写真欧美这视频| av在线不卡免费看| 日本人妖一区二区| 亚洲色图在线看| 久久久精品一品道一区| 欧美理论片在线| 99久久精品国产网站| 精品伊人久久久久7777人| 亚洲国产欧美另类丝袜| 国产精品久久久99| 亚洲精品在线三区| 欧美精品日韩精品| 色欧美88888久久久久久影院| 国产高清久久久| 蜜桃久久久久久久| 亚洲大型综合色站| 亚洲精品欧美二区三区中文字幕| 久久久av毛片精品| 日韩亚洲欧美在线| 在线成人小视频| 欧洲国内综合视频| 色国产精品一区在线观看| 成人精品亚洲人成在线| 国产成人在线观看免费网站| 秋霞影院一区二区| 五月天久久比比资源色| 亚洲综合在线观看视频| 亚洲欧洲日本在线| 国产精品日韩成人| 国产精品久久久久影视| 日本一区二区三区电影| 国产三级精品在线| 久久这里只有精品6| 精品处破学生在线二十三| 精品国产免费人成在线观看| 欧美草草影院在线视频| 久久新电视剧免费观看| 久久久久久久综合| 国产天堂亚洲国产碰碰| 国产精品美女久久久久久久久久久 | 亚洲人成亚洲人成在线观看图片| 国产欧美综合色| 国产日韩综合av| 国产精品久久久久精k8| 亚洲欧美另类图片小说| 亚洲精品成人少妇| 亚洲一区二区av在线| 青青草原综合久久大伊人精品优势| 首页国产欧美日韩丝袜| 久久99国内精品| 精久久久久久久久久久| 国产精品一区二区三区99| 成人精品视频一区二区三区| 91在线一区二区三区| 欧美图片一区二区三区| 日韩视频一区二区| 国产无人区一区二区三区| 国产精品第一页第二页第三页| 怡红院av一区二区三区| 日韩精品视频网站| 精品一区二区三区日韩| 成人一级片在线观看| 在线观看日韩高清av| 欧美一区二区视频网站| 久久女同性恋中文字幕| 亚洲视频一区在线| 秋霞影院一区二区| 成人高清免费在线播放| 欧美三区在线视频| 国产午夜亚洲精品羞羞网站| 玉米视频成人免费看| 久久成人免费日本黄色| 99久久精品一区二区| 日韩欧美国产一区二区三区| 欧美国产精品中文字幕| 亚洲午夜国产一区99re久久| 久久99国产精品久久99| 99久久综合国产精品| 欧美一级理论片| 中文字幕中文字幕在线一区| 免费一级欧美片在线观看| 99久久亚洲一区二区三区青草| 在线成人免费观看| 中文字幕欧美区| 秋霞电影网一区二区| 日本高清免费不卡视频| 久久久久久久久99精品| 日韩成人午夜精品| 99久久精品免费看| 久久久国产精华| 日韩和欧美的一区| 色婷婷亚洲婷婷| 国产欧美日韩中文久久| 美女视频免费一区| 在线观看日韩高清av| 中文字幕在线观看不卡视频| 免费的成人av| 欧美在线观看视频一区二区三区| 国产欧美精品一区二区色综合 | 中文字幕一区免费在线观看| 麻豆久久久久久久| 欧美吻胸吃奶大尺度电影| 国产精品不卡一区| 国产精品99久久久久久有的能看| 欧美视频第二页| 亚洲欧美韩国综合色| 不卡的看片网站| 日本一区二区免费在线观看视频| 日韩成人一级大片| 宅男在线国产精品| 首页国产丝袜综合| 欧美久久久一区| 亚洲第一久久影院| 欧美日韩高清一区| 亚洲国产欧美一区二区三区丁香婷| 97精品超碰一区二区三区| 中文字幕不卡一区| 成人午夜私人影院| 亚洲国产精品成人综合| 国产成人精品综合在线观看 | 在线中文字幕一区| 亚洲一区二区美女| 欧美精品日韩精品| 免费在线视频一区| 亚洲精品一区二区三区蜜桃下载|