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

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

?? os_task.c

?? ucosii操作系統的編寫,用于嵌入式的操作系統.
?? 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);

/*
*********************************************************************************************************
*                                            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)
{
}

/*$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)
{
    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 *pdata, OS_STK *ptos, INT8U prio)
{
    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, pdata, 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一区二区三区免费野_久草精品视频
日本道色综合久久| 中文字幕精品三区| 欧美日韩激情一区二区三区| 99re这里只有精品视频首页| 成人av免费在线观看| 国产精品1区2区3区在线观看| 久久精品国内一区二区三区| 日韩av网站在线观看| 日韩精品乱码av一区二区| 天堂一区二区在线免费观看| 五月天欧美精品| 亚洲成a人在线观看| 青青草国产精品97视觉盛宴| 日韩国产高清在线| 久久精品国产网站| 国产在线精品一区二区三区不卡| 久久国产精品99久久人人澡| 精久久久久久久久久久| 久久福利视频一区二区| 国产精品一区二区在线观看不卡 | 亚洲婷婷国产精品电影人久久| 国产欧美日韩精品一区| 国产精品久久久久久久久免费樱桃| 中文字幕av在线一区二区三区| 国产精品久久久久久久久久免费看| 亚洲日本成人在线观看| 亚洲无线码一区二区三区| 日日夜夜免费精品视频| 另类小说图片综合网| 国产精品66部| 99久久精品国产一区二区三区 | 99国产精品99久久久久久| 色综合久久精品| 欧美久久久久中文字幕| 精品国产成人系列| 亚洲欧美一区二区在线观看| 亚洲成人午夜影院| 国产制服丝袜一区| 99免费精品视频| 欧美日韩免费高清一区色橹橹 | 一区二区久久久| 亚洲国产精品尤物yw在线观看| 日本不卡一二三| 国产成都精品91一区二区三 | 国产三级精品在线| 亚洲已满18点击进入久久| 日韩va亚洲va欧美va久久| 国产成人自拍高清视频在线免费播放| 波多野结衣欧美| 欧美美女bb生活片| 中文一区二区在线观看| 亚洲综合一二三区| 国产精品正在播放| 欧美日韩在线播放一区| 精品福利二区三区| 一区二区不卡在线视频 午夜欧美不卡在| 日韩高清不卡在线| 99热在这里有精品免费| 欧美电影一区二区三区| 国产精品久久看| 琪琪久久久久日韩精品| jlzzjlzz欧美大全| 日韩欧美国产综合一区| 亚洲精品乱码久久久久久久久| 麻豆国产精品官网| 欧美性xxxxxxxx| 亚洲国产电影在线观看| 日韩一区欧美二区| 成人激情视频网站| 91精品国产乱码久久蜜臀| 亚洲欧洲精品一区二区三区| 久久99久久99精品免视看婷婷| 日本黄色一区二区| 国产日韩欧美电影| 国产在线视频一区二区三区| 欧美午夜在线一二页| 欧美韩国日本不卡| 看电视剧不卡顿的网站| 91福利社在线观看| 国产精品久久久久一区二区三区 | 日韩视频在线一区二区| 国产精品久久久久久久久晋中| 精品亚洲成a人在线观看| 精品视频一区 二区 三区| 中文字幕成人av| 欧美色成人综合| 一区在线观看视频| 成人午夜在线播放| 久久久亚洲精品石原莉奈| 青青草精品视频| 欧美高清视频不卡网| 一区二区三区资源| 色综合久久久久网| 一区精品在线播放| 成人免费视频caoporn| 久久女同互慰一区二区三区| 欧美bbbbb| 日韩欧美在线观看一区二区三区| 亚洲成人在线免费| 欧美另类高清zo欧美| 一区二区三区在线高清| 91免费国产在线观看| 国产精品传媒在线| 成人av电影在线观看| 久久无码av三级| 国产精品资源在线看| 久久综合国产精品| 激情成人综合网| 26uuu另类欧美亚洲曰本| 精品在线播放午夜| 2021久久国产精品不只是精品| 久久99精品国产91久久来源| 欧美成人性战久久| 国产一区日韩二区欧美三区| 精品国内片67194| 国产一区二区视频在线| 国产日韩欧美高清| 色综合久久六月婷婷中文字幕| 国产精品三级久久久久三级| 成人午夜视频在线| 亚洲伦在线观看| 欧美日韩色一区| 免费成人在线播放| 国产视频不卡一区| 99久久er热在这里只有精品66| 亚洲视频网在线直播| 欧美日韩中字一区| 蜜臀国产一区二区三区在线播放| 欧美精品一区二区高清在线观看 | 欧美亚洲图片小说| 午夜伦理一区二区| www一区二区| 91理论电影在线观看| 午夜久久久久久| 国产午夜精品理论片a级大结局 | 国产亚洲一本大道中文在线| av不卡免费在线观看| 午夜欧美大尺度福利影院在线看| 精品国产免费一区二区三区四区| 国产成人精品免费一区二区| 成人免费一区二区三区在线观看 | 亚洲人成网站精品片在线观看 | 亚洲一区二区精品视频| 欧美一区二区三区在线| 国产成人在线观看免费网站| 亚洲精品国产视频| 精品欧美乱码久久久久久1区2区| 成人晚上爱看视频| 五月天亚洲精品| 国产欧美一区二区精品性色超碰 | 91久久香蕉国产日韩欧美9色| 午夜视频一区二区| 国产偷国产偷亚洲高清人白洁| 91国产丝袜在线播放| 久久 天天综合| 一区二区久久久久久| 久久综合九色综合97婷婷女人 | 久久99热狠狠色一区二区| 国产精品美日韩| 欧美男男青年gay1069videost| 国产成人av福利| 亚洲v日本v欧美v久久精品| 久久久久97国产精华液好用吗| 欧美三级一区二区| 丁香网亚洲国际| 久久精品国产一区二区三| 亚洲另类在线制服丝袜| 精品国产污污免费网站入口| 欧美无人高清视频在线观看| 国产不卡视频一区| 美日韩一级片在线观看| 亚洲天天做日日做天天谢日日欢| 精品久久久久久无| 国产日韩欧美a| 欧美一级片在线看| 欧美性极品少妇| www.色综合.com| 紧缚奴在线一区二区三区| 一区二区三区四区高清精品免费观看| 久久免费电影网| 欧美成人一区二区三区| 欧美四级电影网| 91在线视频网址| 日本va欧美va精品发布| 18欧美乱大交hd1984| 国产校园另类小说区| 日韩一区二区免费高清| 欧美体内she精高潮| 色综合天天综合| 成人禁用看黄a在线| 国产成人精品网址| 九九国产精品视频| 免费在线观看日韩欧美| 亚洲五月六月丁香激情| 一区二区三区中文在线| 亚洲丝袜另类动漫二区| 中文字幕精品综合| 精品国产乱码久久| 日韩欧美一区中文| 欧美一区二区在线观看|