亚洲欧美第一页_禁久久精品乱码_粉嫩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 *ppdata, 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, 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一区二区三区免费野_久草精品视频
日韩欧美一二区| 精品视频一区二区三区免费| caoporen国产精品视频| 欧美日韩在线直播| 国产精品视频一二| 秋霞午夜av一区二区三区| 99精品国产91久久久久久| 欧美tickle裸体挠脚心vk| 亚洲电影在线免费观看| 成人av综合在线| 久久人人97超碰com| 三级不卡在线观看| 欧美四级电影在线观看| 国产一区不卡精品| 91视频国产观看| xf在线a精品一区二区视频网站| 亚洲欧美区自拍先锋| 国产精品主播直播| 精品福利一区二区三区免费视频| 亚洲成在线观看| 日本丶国产丶欧美色综合| 国产精品萝li| 成人免费av资源| 国产亚洲欧美一区在线观看| 精品一区二区免费| 日韩精品中文字幕一区| 免费视频一区二区| 欧美一区二区在线播放| 日韩中文字幕一区二区三区| 欧美三级一区二区| 石原莉奈在线亚洲二区| 欧美日韩国产高清一区二区三区 | 97精品电影院| 久久久精品免费观看| 欧美aaa在线| 日韩一级片网址| 日本不卡一区二区| 日韩视频一区二区| 九九视频精品免费| 久久午夜老司机| 国产 欧美在线| 亚洲品质自拍视频网站| 欧美无乱码久久久免费午夜一区| 亚洲主播在线播放| 欧美绝品在线观看成人午夜影视| 午夜精品福利一区二区蜜股av| 欧美精选一区二区| 久久成人免费电影| 中文在线资源观看网站视频免费不卡| k8久久久一区二区三区| 日韩午夜精品视频| 久久99精品国产麻豆婷婷洗澡| 日韩欧美国产一二三区| 精品一区二区三区免费毛片爱| 久久欧美一区二区| 91在线视频18| 三级不卡在线观看| 久久久久久久av麻豆果冻| 99视频精品在线| 亚洲国产精品麻豆| 久久精品一区二区三区av| 床上的激情91.| 亚洲bt欧美bt精品777| 精品99一区二区| 色婷婷国产精品久久包臀| 日韩高清欧美激情| 国产精品久久99| 欧美久久一二三四区| 国产成人午夜高潮毛片| 亚洲另类色综合网站| 日韩欧美的一区| 91碰在线视频| 久久国产欧美日韩精品| 国产欧美综合色| 欧美三级日韩三级| 国产成人精品综合在线观看| 一区二区高清视频在线观看| 欧美xxxxx牲另类人与| 99久久精品国产网站| 日本 国产 欧美色综合| 国产精品欧美久久久久一区二区 | 喷水一区二区三区| 成人免费一区二区三区视频| 欧美视频在线一区| 懂色av一区二区三区免费看| 日韩电影在线一区二区| 中文字幕色av一区二区三区| 精品黑人一区二区三区久久| 欧美性xxxxxx少妇| 成人免费视频一区| 激情小说亚洲一区| 五月天久久比比资源色| 亚洲欧美日韩在线播放| 视频一区中文字幕国产| 欧美亚洲国产bt| 国产91综合一区在线观看| 天堂一区二区在线免费观看| 中文字幕一区二区三区在线播放| 日韩欧美一级二级| 欧美男男青年gay1069videost| 成人免费视频国产在线观看| 麻豆精品精品国产自在97香蕉| 亚洲成av人在线观看| 亚洲欧美一区二区三区孕妇| 国产欧美视频在线观看| 精品国产一区二区三区久久久蜜月 | 国产精品国产三级国产普通话蜜臀 | 久久蜜桃av一区精品变态类天堂 | 国产一区二区伦理片| 538在线一区二区精品国产| 成人黄色在线网站| 国产麻豆9l精品三级站| 久久精品国产亚洲a| 首页综合国产亚洲丝袜| 水蜜桃久久夜色精品一区的特点| 亚洲一卡二卡三卡四卡五卡| 一区二区成人在线视频 | 久久久精品国产免大香伊| 日韩久久免费av| 精品少妇一区二区三区在线播放| 日韩欧美色综合| 久久久久久久网| 中文字幕二三区不卡| 中文字幕一区二区三区精华液 | 国产调教视频一区| 国产午夜精品在线观看| 国产精品人成在线观看免费 | **网站欧美大片在线观看| 日韩一区二区麻豆国产| 欧美精品电影在线播放| 欧美精品成人一区二区三区四区| 欧美老人xxxx18| 欧美电影免费观看高清完整版在线| 精品不卡在线视频| 国产精品伦一区| 一区二区三区免费看视频| 五月天国产精品| 精品一区二区三区在线播放 | 色综合亚洲欧洲| 欧美最新大片在线看 | 亚洲国产成人午夜在线一区| 成人免费一区二区三区视频| 亚洲综合av网| 精品亚洲成a人| av午夜精品一区二区三区| 欧美一级高清大全免费观看| 国产99久久久久久免费看农村| 成人午夜激情在线| 99精品一区二区三区| 欧美日本一区二区在线观看| 欧美大胆人体bbbb| 亚洲人成在线观看一区二区| 五月天丁香久久| 成人一区二区三区中文字幕| 欧洲视频一区二区| 精品国免费一区二区三区| 樱桃视频在线观看一区| 日本aⅴ免费视频一区二区三区 | 久久青草国产手机看片福利盒子| 国产精品美女久久久久aⅴ国产馆| 午夜精品久久久久| 懂色av一区二区夜夜嗨| 欧美高清视频不卡网| 国产精品久久久久久久久搜平片| 日韩精品91亚洲二区在线观看| 成人综合激情网| 日韩欧美黄色影院| 亚洲高清视频在线| 不卡av在线免费观看| 欧美成人女星排行榜| 亚洲免费大片在线观看| 97久久人人超碰| 日韩av电影免费观看高清完整版 | 不卡影院免费观看| 在线播放91灌醉迷j高跟美女| 国产欧美一二三区| 免费高清视频精品| 一本大道久久a久久精二百| 久久一日本道色综合| 亚洲成av人片在线观看无码| 99久久精品99国产精品| 久久女同互慰一区二区三区| 麻豆视频一区二区| 欧美日高清视频| 亚洲国产视频一区| 色综合久久88色综合天天6| 国产女人18水真多18精品一级做| 轻轻草成人在线| 看片网站欧美日韩| 日韩电影免费在线看| 国产成人av电影免费在线观看| 91麻豆精品国产91久久久久久久久| 亚洲欧美视频在线观看视频| 国产成人丝袜美腿| 欧美tk—视频vk| 国内精品自线一区二区三区视频| 欧美在线一区二区| 一区二区高清免费观看影视大全| 91久久精品一区二区三| 亚洲精品菠萝久久久久久久|