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

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

?? os_task.c

?? uc/osII基于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一区二区三区免费野_久草精品视频
日韩一卡二卡三卡四卡| 97久久精品人人做人人爽50路| 国产日韩影视精品| 欧美xxxxx裸体时装秀| 日韩一区二区三区在线视频| 欧美日韩精品一区视频| 欧美日韩在线三级| 欧美日韩久久不卡| 91麻豆精品久久久久蜜臀| 欧美久久久久久蜜桃| 欧美久久久久久久久中文字幕| 在线观看欧美黄色| 51精品秘密在线观看| 精品免费国产二区三区| 久久这里只有精品6| 久久蜜桃一区二区| 国产精品国产三级国产aⅴ入口| 中文字幕一区二区三区精华液 | 日韩高清不卡在线| 日韩精品一级二级 | 91精品国产91久久久久久一区二区 | 精品国产亚洲一区二区三区在线观看| 日韩视频免费观看高清完整版| 日韩欧美中文一区| 国产亚洲精品福利| 一区二区三区国产精品| 亚洲午夜久久久久中文字幕久| 日本不卡高清视频| 国产不卡在线播放| 在线免费观看成人短视频| 欧美精品乱码久久久久久按摩| 欧美成人一区二区三区在线观看| 国产亚洲综合色| 夜夜嗨av一区二区三区网页| 全部av―极品视觉盛宴亚洲| 国产福利一区二区| 欧美丝袜丝nylons| 国产亚洲一区二区在线观看| 亚洲欧美日韩人成在线播放| 麻豆国产一区二区| 色88888久久久久久影院按摩| 欧美va亚洲va| 亚洲伊人色欲综合网| 国产乱子轮精品视频| 欧美视频完全免费看| 国产欧美一区二区精品性| 亚洲国产日韩a在线播放| 国产精品18久久久久久久久久久久 | 久久精品二区亚洲w码| 99久久亚洲一区二区三区青草| 欧美二区乱c少妇| 国产精品污网站| 久久成人免费网| 欧美在线观看你懂的| 国产精品美女久久久久aⅴ| 婷婷丁香久久五月婷婷| 成人激情视频网站| 久久影院午夜论| 五月天中文字幕一区二区| 色综合视频在线观看| 国产日韩欧美精品在线| 久久精品99国产国产精| 欧美群妇大交群中文字幕| 亚洲精选视频在线| 成人午夜激情影院| 久久久精品日韩欧美| 另类小说图片综合网| 91精品国产综合久久婷婷香蕉| 亚洲人吸女人奶水| 91香蕉视频污在线| 中文字幕五月欧美| 国产福利不卡视频| 久久精品亚洲精品国产欧美| 麻豆成人免费电影| 日韩一区二区免费高清| 青草国产精品久久久久久| 欧美日韩aaaaa| 亚洲国产精品一区二区尤物区| 不卡的av网站| 亚洲靠逼com| 欧美影片第一页| 天天色综合成人网| 欧美一区二区视频在线观看2022| 午夜欧美视频在线观看| 欧美精品日韩一区| 久久er99热精品一区二区| 精品国免费一区二区三区| 国产在线一区二区| 国产亚洲一本大道中文在线| 福利91精品一区二区三区| 中文字幕高清不卡| 97国产一区二区| 亚洲高清免费一级二级三级| 制服丝袜激情欧洲亚洲| 国产成人免费在线观看不卡| 国产精品亲子伦对白| 91蜜桃在线免费视频| 亚洲第一av色| 精品国产一区二区国模嫣然| 丁香桃色午夜亚洲一区二区三区| 国产精品国产成人国产三级| 91色在线porny| 日韩av电影免费观看高清完整版 | 日韩激情视频在线观看| 欧美成人三级在线| 成人精品电影在线观看| 一区二区三区.www| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 亚洲欧美一区二区在线观看| 色噜噜狠狠色综合欧洲selulu| 日韩国产精品久久久| 26uuu精品一区二区在线观看| 99久久er热在这里只有精品66| 亚洲第四色夜色| 欧美激情一区二区| 制服.丝袜.亚洲.另类.中文 | 国产精品亚洲а∨天堂免在线| ㊣最新国产の精品bt伙计久久| 欧美日韩色一区| 国产成a人亚洲精| 亚洲国产日韩精品| 亚洲欧洲一区二区三区| 欧美一区二区三区在线看| 成人av手机在线观看| 麻豆国产欧美日韩综合精品二区 | 91精品国产丝袜白色高跟鞋| 国产成人av一区二区三区在线| 亚洲一区二区三区精品在线| 久久久亚洲综合| 欧美日韩国产综合视频在线观看 | 久久亚洲影视婷婷| 欧美日韩黄色一区二区| jlzzjlzz国产精品久久| 精品在线观看免费| 五月天久久比比资源色| 18成人在线观看| 久久先锋影音av鲁色资源网| 欧美日韩在线不卡| 色噜噜狠狠色综合中国| 成人黄色免费短视频| 国产在线视视频有精品| 另类欧美日韩国产在线| 日韩中文字幕不卡| 亚洲成人精品在线观看| 一区二区三区欧美| 国产精品不卡在线观看| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 午夜精品福利视频网站| 亚洲青青青在线视频| 自拍av一区二区三区| 中文字幕av一区二区三区| 国产女人水真多18毛片18精品视频| 日韩精品一区二区三区中文不卡 | 日韩免费在线观看| 欧美一区二区三区在线视频| 在线成人免费观看| 欧美欧美欧美欧美| 欧美精品色综合| 欧美一二区视频| 日韩欧美中文字幕一区| 精品少妇一区二区三区日产乱码| 欧美一区二区精品在线| 日韩一级片网址| 欧美tk—视频vk| 国产欧美日产一区| 中文字幕在线不卡视频| 日韩理论片在线| 亚洲综合精品自拍| 日韩va亚洲va欧美va久久| 免费成人性网站| 国产精品1区二区.| 成人网页在线观看| 91麻豆成人久久精品二区三区| 97se亚洲国产综合自在线不卡| 欧美日韩综合不卡| 日韩三级高清在线| 国产精品你懂的在线欣赏| 亚洲色图欧洲色图| 日本不卡在线视频| 国产大陆a不卡| 欧美色综合天天久久综合精品| 3atv一区二区三区| 欧美国产激情二区三区| 亚洲午夜久久久久久久久电影网 | 久久久精品国产免大香伊| 国产精品久久久久天堂| 亚洲小说春色综合另类电影| 水蜜桃久久夜色精品一区的特点 | 一区二区三区国产| 午夜精品免费在线| 国产成人精品www牛牛影视| 91麻豆swag| 精品国产百合女同互慰| 一区二区三区四区乱视频| 免费的国产精品| 色综合久久久久综合体| 欧美电影免费观看高清完整版在线| 国产精品拍天天在线| 日韩电影在线免费观看| 99国产精品国产精品久久|