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

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

?? os_task.c

?? C51單片機上的嵌入式操作系統,具有任務調度,文件服務,等功能
?? 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
*********************************************************************************************************
*/

#if OS_TASK_DEL_EN
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)reentrant
{
}
#endif
/*$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   *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
*
*              dataptr    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 'dataptr' as follows:
*
*                           void Task (void *dataptr)
*                           {
*                               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)reentrant, 
		    void *dataptr, 
		    OS_STK *ptos, 
		    INT8U prio)reentrant
{
    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, dataptr, 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
*
*              dataptr    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 'dataptr' as follows:
*
*                           void Task (void *dataptr)
*                           {
*                               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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
天天色图综合网| 同产精品九九九| 欧美精品一区在线观看| 日韩免费视频一区| 国产亚洲精品久| 欧美电影免费观看高清完整版在 | 国产精品每日更新| 欧美激情一区不卡| 一区二区三区四区在线免费观看| 一个色妞综合视频在线观看| 亚洲国产精品久久人人爱| 国产精品女同互慰在线看| 亚洲欧美一区二区三区孕妇| 17c精品麻豆一区二区免费| 亚洲自拍欧美精品| 日韩精品视频网| 91蝌蚪porny| 国产亚洲午夜高清国产拍精品 | 色综合中文字幕国产| 91精品国产综合久久国产大片| 国产三级精品三级在线专区| 一个色综合网站| 精品一区中文字幕| 中文成人综合网| 国产精品 日产精品 欧美精品| 在线电影欧美成精品| 亚洲影院免费观看| 成人a免费在线看| 国产日产欧美一区二区视频| 精品亚洲免费视频| 亚洲精品在线电影| 免费成人av在线播放| 日韩一区二区三区免费看 | 日本精品视频一区二区| 亚洲精品国产精华液| 91女神在线视频| 香蕉成人啪国产精品视频综合网| 91久久久免费一区二区| 一区二区高清视频在线观看| 欧美性欧美巨大黑白大战| 亚洲伦在线观看| 欧美色网站导航| 五月激情综合网| 久久你懂得1024| 99视频有精品| 视频在线观看国产精品| 日韩欧美国产麻豆| 成人美女在线观看| 亚洲与欧洲av电影| 久久尤物电影视频在线观看| 美女在线观看视频一区二区| 亚洲精品一区二区三区在线观看| fc2成人免费人成在线观看播放| 亚洲视频 欧洲视频| 日韩欧美一级二级三级久久久| 激情av综合网| 性久久久久久久久久久久| 国产精品无遮挡| 欧美精品视频www在线观看 | 国产精品成人一区二区艾草 | av不卡在线播放| 精品无人码麻豆乱码1区2区 | 欧美性做爰猛烈叫床潮| 国产综合色视频| 另类中文字幕网| 性做久久久久久免费观看欧美| 中文在线资源观看网站视频免费不卡| 欧美婷婷六月丁香综合色| 91网站在线播放| 风流少妇一区二区| 国产在线精品国自产拍免费| 日韩成人av影视| 亚洲成av人片在www色猫咪| 国产精品女主播在线观看| 久久嫩草精品久久久久| 欧美成人午夜电影| 欧美tk丨vk视频| 制服丝袜中文字幕亚洲| 在线精品视频一区二区| 色综合天天综合| 91原创在线视频| 一本久道中文字幕精品亚洲嫩| 国产一区二区在线影院| 国产东北露脸精品视频| 99vv1com这只有精品| 91社区在线播放| 欧美美女bb生活片| 久久亚洲二区三区| 亚洲精品国产一区二区三区四区在线| 欧美国产乱子伦| 亚洲一级二级在线| 紧缚奴在线一区二区三区| 国产成人精品免费在线| 日本高清不卡一区| 欧美成人女星排名| 精品三级av在线| 综合久久综合久久| 亚洲成人激情社区| 狂野欧美性猛交blacked| 亚洲小少妇裸体bbw| 国产在线播放一区三区四| 粉嫩av亚洲一区二区图片| av网站免费线看精品| 欧美日韩综合在线| 91精品国产综合久久精品app| 久久久www成人免费无遮挡大片 | 中文字幕一区二区三| 日韩av一区二区在线影视| 国产电影一区二区三区| 在线欧美小视频| 精品久久久久久久人人人人传媒| 中文字幕不卡的av| 国产一区二区美女诱惑| 91传媒视频在线播放| 欧美极品aⅴ影院| 看电视剧不卡顿的网站| www.欧美色图| 国产精品久久久久aaaa| 亚洲国产另类av| 国产成人av资源| 91精品欧美一区二区三区综合在 | 老汉av免费一区二区三区| 国产在线视频精品一区| 精品电影一区二区三区| 日本美女一区二区| 欧美三区免费完整视频在线观看| 中文字幕一区二区三区视频| 麻豆91在线播放| 久久综合色婷婷| 久久电影网站中文字幕| 777久久久精品| 三级在线观看一区二区| 91社区在线播放| 一区二区三区精品| 欧美亚洲动漫精品| 午夜成人在线视频| 欧美日韩国产一级二级| 老司机午夜精品99久久| 久久久一区二区三区捆绑**| 国产成人综合亚洲91猫咪| 久久精品日产第一区二区三区高清版| 国产精品一区免费在线观看| 专区另类欧美日韩| 91精品国产综合久久久蜜臀粉嫩| 日韩vs国产vs欧美| 26uuu亚洲| 欧美精品粉嫩高潮一区二区| 卡一卡二国产精品| 成人欧美一区二区三区视频网页| 日本韩国精品一区二区在线观看| 亚洲永久免费av| 国产三级三级三级精品8ⅰ区| 99精品视频在线观看| 亚洲va欧美va国产va天堂影院| 欧美成人一区二区三区在线观看| 不卡的看片网站| 青青草一区二区三区| 国产精品福利在线播放| 99精品桃花视频在线观看| 亚洲国产日韩a在线播放性色| 欧美一区二区三区思思人| 色综合久久久久久久久| 亚洲成人手机在线| 亚洲韩国一区二区三区| 亚洲精品一线二线三线无人区| 在线免费观看日韩欧美| 国产精品亚洲第一区在线暖暖韩国| 亚洲国产精品影院| 亚洲精品美国一| 国产精品久久久99| 欧美三级电影精品| 91精品国产综合久久久久| 欧美午夜一区二区| 欧美最新大片在线看| 99视频精品全部免费在线| 另类欧美日韩国产在线| 五月天国产精品| 亚洲国产成人va在线观看天堂| 亚洲精品欧美激情| 一区二区三区影院| 亚洲国产人成综合网站| 亚洲精品老司机| 一区二区三区四区精品在线视频| 国产精品久久久久一区二区三区共| 91精品国产品国语在线不卡| 欧美手机在线视频| 91精品国产欧美一区二区| 欧美一级视频精品观看| 精品国产一二三区| 欧美在线观看视频一区二区| 欧美日韩视频在线观看一区二区三区 | 色妞www精品视频| 在线区一区二视频| 欧美一级久久久| 国产精品美女www爽爽爽| 中文字幕永久在线不卡| 亚洲高清一区二区三区| 国产毛片精品国产一区二区三区| 国产成人精品免费看| 色中色一区二区|