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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_task.c

?? ucosii移植到C8051F023上的源代碼。 有三個(gè)任務(wù)
?? 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.
*

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美视频第二页| 亚洲色图视频网站| 日韩免费视频一区二区| 欧美夫妻性生活| 同产精品九九九| 日韩一区二区免费电影| 精品一区中文字幕| 国产欧美日本一区视频| av在线综合网| 亚洲国产中文字幕| 日韩欧美激情一区| 国产精华液一区二区三区| 国产精品免费久久| 在线区一区二视频| 精品在线播放午夜| 国产精品毛片高清在线完整版| 在线影院国内精品| 日本在线播放一区二区三区| 久久久99久久| 91久久精品日日躁夜夜躁欧美| 丝袜诱惑制服诱惑色一区在线观看 | 日本不卡123| 91麻豆精品国产| 国产一区二区三区高清播放| 国产欧美日韩另类视频免费观看| 在线免费亚洲电影| 蜜桃视频在线一区| 国产精品卡一卡二| 欧洲生活片亚洲生活在线观看| 日韩中文字幕亚洲一区二区va在线 | 日本怡春院一区二区| 国产亚洲精品免费| 欧美三级电影一区| 国产激情视频一区二区三区欧美| 欧美军同video69gay| 亚洲成人在线免费| 国产欧美精品一区二区三区四区| 91福利国产成人精品照片| 麻豆成人免费电影| 亚洲久草在线视频| 久久综合五月天婷婷伊人| 在线精品国精品国产尤物884a| 国产一区二区三区黄视频| 亚洲成a人在线观看| 国产精品日日摸夜夜摸av| 91精品国产日韩91久久久久久| 99久久精品免费| 国产综合色精品一区二区三区| 亚洲一区av在线| 成人欧美一区二区三区| 精品99久久久久久| 欧美日本在线观看| 色婷婷av一区二区三区之一色屋| 国产成人自拍网| 精品一区二区日韩| 午夜久久久久久| 亚洲免费大片在线观看| 国产午夜精品美女毛片视频| 日韩一区二区电影| 欧美日韩一区二区三区四区| 色综合色狠狠综合色| 高清国产午夜精品久久久久久| 久久 天天综合| 奇米影视7777精品一区二区| 天天av天天翘天天综合网| 艳妇臀荡乳欲伦亚洲一区| 亚洲欧洲av一区二区三区久久| 久久免费看少妇高潮| wwww国产精品欧美| 精品国产乱码久久久久久闺蜜| 91.com视频| 久久亚洲精精品中文字幕早川悠里| 欧美午夜一区二区三区| 色哟哟欧美精品| 日本韩国视频一区二区| 91激情五月电影| 一本色道久久综合亚洲91| 成人av在线资源网站| 成人福利视频在线| 成人妖精视频yjsp地址| 成人午夜私人影院| 91免费精品国自产拍在线不卡| 91片在线免费观看| 欧美视频一区在线观看| 欧美日韩一二三| 91精品国产高清一区二区三区| 日韩欧美你懂的| 久久综合五月天婷婷伊人| 久久精品视频免费| 中文字幕一区二区三中文字幕| 亚洲人成影院在线观看| 亚洲一级二级在线| 免播放器亚洲一区| 激情综合色播五月| 国产成人精品综合在线观看| 91在线视频播放| 欧美日韩一区二区三区不卡| 日韩亚洲欧美成人一区| 久久久91精品国产一区二区精品| 国产精品免费aⅴ片在线观看| 亚洲男人的天堂在线观看| 婷婷中文字幕一区三区| 韩国女主播一区二区三区| 99久久精品国产精品久久| 欧美视频一区二区在线观看| 精品国内二区三区| 国产精品视频一二三区| 亚洲成a人片综合在线| 精品在线播放免费| 色中色一区二区| 日韩午夜精品视频| 中文字幕不卡在线播放| 午夜欧美电影在线观看| 精彩视频一区二区| 91福利社在线观看| 欧美精品一区二区精品网| 亚洲欧美日韩小说| 狠狠狠色丁香婷婷综合久久五月| 成人美女在线视频| 91精品欧美久久久久久动漫| 亚洲国产成人午夜在线一区| 午夜精品久久久久久久久| 国产二区国产一区在线观看| 欧美日韩精品一区二区天天拍小说 | 国产偷国产偷亚洲高清人白洁| 亚洲欧美日韩国产综合在线| 成人国产视频在线观看| 欧美日韩综合在线免费观看| 久久久久久久久一| 日韩激情av在线| 91老司机福利 在线| 久久夜色精品一区| 国产亚洲精品bt天堂精选| 午夜久久久久久久久久一区二区| 成av人片一区二区| 久久综合99re88久久爱| 亚洲成人av在线电影| 成人免费不卡视频| 久久综合色一综合色88| 亚洲成人一区二区| 91在线观看地址| 久久久91精品国产一区二区精品 | 国产91精品免费| 日韩欧美一区二区久久婷婷| 亚洲黄色性网站| 99国产麻豆精品| 国产日韩av一区二区| 九九在线精品视频| 欧美日韩免费一区二区三区| 综合婷婷亚洲小说| 成人免费高清视频在线观看| 久久免费视频色| 黄页网站大全一区二区| 欧美一区二区不卡视频| 亚洲二区视频在线| 欧美性欧美巨大黑白大战| **网站欧美大片在线观看| 高清国产午夜精品久久久久久| 久久日韩粉嫩一区二区三区| 精品一区二区在线免费观看| 欧美一二三四在线| 裸体歌舞表演一区二区| 日韩丝袜情趣美女图片| 日本美女一区二区| 日韩欧美123| 国产在线精品一区二区不卡了| 精品少妇一区二区三区视频免付费 | 免费在线观看精品| 制服视频三区第一页精品| 日韩在线观看一区二区| 538prom精品视频线放| 丝袜国产日韩另类美女| 欧美日韩在线播放三区| 污片在线观看一区二区| 7777精品久久久大香线蕉| 免费精品99久久国产综合精品| 欧美一区二区三区四区久久| 免费看日韩a级影片| 日韩色在线观看| 久久精品国产亚洲一区二区三区| 日韩欧美黄色影院| 国产不卡视频在线观看| 国产精品不卡在线| 日本韩国欧美三级| 日韩电影在线一区二区| 精品国产一区二区三区四区四| 紧缚捆绑精品一区二区| 国产精品全国免费观看高清| 91蜜桃婷婷狠狠久久综合9色| 亚洲国产日日夜夜| 欧美成人三级电影在线| 国产宾馆实践打屁股91| 亚洲欧美成人一区二区三区| 欧美高清视频一二三区 | 国产欧美一区二区精品性色| 99热国产精品| 丝瓜av网站精品一区二区| 精品国产一区二区三区忘忧草| 成人一道本在线| 舔着乳尖日韩一区|