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

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

?? os_task.c

?? 非常經典的8051F040代碼
?? 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   *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
*
*              pdata    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 'pdata' as follows:
*
*                           void Task (void *pdata)
*                           {
*                               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), void *ppdata, 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, ppdata, 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
*
*              pdata    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 'pdata' as follows:
*
*                           void Task (void *pdata)
*                           {
*                               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一区二区三区免费野_久草精品视频
久久精品国产999大香线蕉| 欧美激情一区二区三区全黄| 欧美一区二区精美| 久久影院午夜片一区| 国产精品天美传媒| 亚洲一卡二卡三卡四卡五卡| 全部av―极品视觉盛宴亚洲| 国产成人精品在线看| 日本韩国欧美在线| 欧美电影免费提供在线观看| 国产精品理论片| 五月天视频一区| 国产成人在线色| 欧美丝袜第三区| 久久久99精品久久| 亚洲午夜久久久久久久久电影院 | 99久久伊人久久99| 欧美日韩不卡在线| 久久丝袜美腿综合| 亚洲综合免费观看高清完整版在线| 蜜臂av日日欢夜夜爽一区| 成+人+亚洲+综合天堂| 91精品免费在线观看| 国产精品丝袜在线| 麻豆成人综合网| 色老汉一区二区三区| 久久先锋资源网| 亚洲va在线va天堂| heyzo一本久久综合| 欧美一级艳片视频免费观看| 亚洲视频电影在线| 国产一区二区三区久久悠悠色av| 欧美伊人久久大香线蕉综合69| 2023国产精品自拍| 五月开心婷婷久久| 99国产精品国产精品毛片| 欧美成人欧美edvon| 一二三四区精品视频| 国产69精品一区二区亚洲孕妇| 欧美精品久久99久久在免费线 | 精品一区二区av| 在线观看日韩高清av| 中文字幕精品一区 | 久久久777精品电影网影网 | 欧美日韩一区久久| 亚洲欧洲www| 国产成人福利片| 精品成人免费观看| 日韩成人伦理电影在线观看| 色综合久久中文综合久久牛| 国产欧美日韩在线视频| 麻豆国产精品一区二区三区 | 亚洲电影你懂得| 色综合天天天天做夜夜夜夜做| 久久精品夜色噜噜亚洲aⅴ| 免费成人小视频| 欧美人与z0zoxxxx视频| 一区二区三区成人| 色婷婷激情久久| 亚洲欧美日韩在线不卡| eeuss影院一区二区三区| 国产人成一区二区三区影院| 韩国成人福利片在线播放| 欧美一二三在线| 日韩成人伦理电影在线观看| 欧美精品高清视频| 日韩av中文在线观看| 欧美日韩国产高清一区二区 | 欧美日韩精品一区二区三区| 一区二区三区免费| 91九色02白丝porn| 亚洲男人的天堂在线aⅴ视频| av成人免费在线| 国产精品美女久久久久久久久 | 在线成人免费观看| 日韩激情一二三区| 日韩视频一区在线观看| 麻豆精品久久精品色综合| 欧美成人福利视频| 国产在线一区观看| 国产欧美日韩三区| 成人av第一页| 亚洲美女少妇撒尿| 91黄色免费观看| 亚洲成a人片在线不卡一二三区 | 亚洲综合偷拍欧美一区色| 欧美网站一区二区| 日本中文在线一区| 精品久久久久久久久久久院品网 | 久久亚洲精精品中文字幕早川悠里 | 国产91精品一区二区麻豆网站| 中文字幕的久久| 91看片淫黄大片一级| 亚洲一线二线三线视频| 欧美精品久久久久久久多人混战| 免费成人av在线播放| 久久综合av免费| av资源站一区| 亚洲一本大道在线| 欧美电影免费观看高清完整版在线 | 丁香婷婷综合色啪| 亚洲免费观看高清在线观看| 欧美日韩一区二区三区免费看| 日韩av电影一区| 国产日产精品1区| 91麻豆免费观看| 日韩电影免费一区| 国产欧美日韩不卡| 欧美最猛黑人xxxxx猛交| 蜜桃视频一区二区| 国产精品久久久久精k8 | 亚洲精品高清在线| 欧美一级日韩一级| 成人性视频网站| 亚洲成人1区2区| 国产欧美视频在线观看| 欧美日韩在线亚洲一区蜜芽| 黑人精品欧美一区二区蜜桃| 亚洲欧美日韩在线| 欧美一区二区视频观看视频| 懂色av一区二区三区免费看| 亚洲一区二区三区三| 久久久久久久久久久99999| 色一区在线观看| 久久99国产精品尤物| 亚洲精品国产一区二区精华液| 欧美一级在线视频| 97久久超碰精品国产| 六月丁香综合在线视频| 亚洲欧美日韩在线播放| 久久综合视频网| 欧美午夜不卡视频| 国产成人无遮挡在线视频| 一区二区三区欧美视频| 久久精品亚洲一区二区三区浴池 | 亚洲人精品午夜| 精品久久久久久久久久久久久久久| 99riav久久精品riav| 久久99久久久欧美国产| 一区二区三区在线看| 国产日韩综合av| 欧美一级一级性生活免费录像| 91天堂素人约啪| 国产一区二区免费视频| 天堂一区二区在线| 亚洲男同性恋视频| 久久久久久久久久久99999| 欧美精品乱人伦久久久久久| 91色在线porny| 国产999精品久久久久久| 人人精品人人爱| 亚洲国产日韩a在线播放性色| 日本一区二区视频在线| 欧美成人一区二区| 欧美日韩高清在线| 色偷偷88欧美精品久久久| 成人综合婷婷国产精品久久免费| 免费成人结看片| 丝袜美腿亚洲综合| 亚洲一区精品在线| 亚洲另类在线制服丝袜| 国产精品少妇自拍| 久久人人爽人人爽| 欧美va在线播放| 日韩欧美资源站| 7777精品伊人久久久大香线蕉超级流畅 | 91精品欧美综合在线观看最新| 91电影在线观看| 91蜜桃网址入口| av电影在线观看一区| 国产91富婆露脸刺激对白| 国产伦精品一区二区三区视频青涩| 日本v片在线高清不卡在线观看| 亚洲大尺度视频在线观看| 亚洲自拍偷拍网站| 一区二区三区在线免费视频| 亚洲人成网站色在线观看| 亚洲欧洲av色图| 综合欧美一区二区三区| 亚洲三级久久久| 一区二区在线电影| 亚洲最大成人网4388xx| 一区二区三区精品视频在线| 伊人夜夜躁av伊人久久| 一级女性全黄久久生活片免费| 亚洲一区影音先锋| 午夜亚洲国产au精品一区二区 | 日韩欧美电影在线| 精品黑人一区二区三区久久| 精品日韩99亚洲| 2024国产精品视频| 午夜电影网一区| 亚洲国产精品t66y| 一区二区中文字幕在线| 专区另类欧美日韩| 一区二区三区四区五区视频在线观看 | 日韩av中文字幕一区二区| 美女视频黄 久久| 韩国精品一区二区| 高潮精品一区videoshd|