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

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

?? os_task.c

?? uCosII 郵箱消息和任務管理
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2001, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File : OS_TASK.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include  "includes.h"
#endif

/*
*********************************************************************************************************
*                                        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 > 0
INT8U  OSTaskChangePrio (INT8U oldprio, INT8U newprio)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR    cpu_sr;
#endif

#if OS_EVENT_EN > 0
    OS_EVENT    *pevent;
#endif

    OS_TCB      *ptcb;
    INT8U        x;
    INT8U        y;
    INT8U        bitx;
    INT8U        bity;



#if OS_ARG_CHK_EN > 0
    if ((oldprio >= OS_LOWEST_PRIO && oldprio != OS_PRIO_SELF)  ||
         newprio >= OS_LOWEST_PRIO) {
        return (OS_PRIO_INVALID);
    }
#endif
    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) != 0x00) {  /* If task is ready make it not */
                if ((OSRdyTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0x00) {
                    OSRdyGrp &= ~ptcb->OSTCBBitY;
                }
                OSRdyGrp    |= bity;                            /* Make new priority ready to run      */
                OSRdyTbl[y] |= bitx;
#if OS_EVENT_EN > 0
            } 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;
                }
#endif
            }
            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();
            OS_Sched();                                         /* 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 > 0
INT8U  OSTaskCreate (void (*task)(void *pd), void *pdata, OS_STK *ptos, INT8U prio)
{
#if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
    OS_CPU_SR  cpu_sr;
#endif
    OS_STK    *psp;
    INT8U      err;


#if OS_ARG_CHK_EN > 0
    if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
        return (OS_PRIO_INVALID);
    }
#endif
    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 = (OS_STK *)OSTaskStkInit(task, pdata, ptos, 0);    /* Initialize the task's stack         */
        err = OS_TCBInit(prio, psp, (OS_STK *)0, 0, 0, (void *)0, 0);
        if (err == OS_NO_ERR) {
            OS_ENTER_CRITICAL();
            OSTaskCtr++;                                        /* Increment the #tasks counter        */
            OS_EXIT_CRITICAL();
            if (OSRunning == TRUE) {         /* Find highest priority task if multitasking has started */
                OS_Sched();
            }
        } else {
            OS_ENTER_CRITICAL();
            OSTCBPrioTbl[prio] = (OS_TCB *)0;/* Make this priority available to others                 */
            OS_EXIT_CRITICAL();
        }
        return (err);
    }
    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.
*
*              id       is the task's ID (0..65535)
*
*              pbos     is a pointer to the task's bottom 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).  'pbos' will thus point to the LOWEST (valid) memory
*                       location of the stack.  If OS_STK_GROWTH is set to 0, 'pbos' will point to the
*                       HIGHEST memory location of the stack and the stack will grow with increasing
*                       memory locations.  'pbos' MUST point to a valid 'free' data item.
*
*              stk_size is the size of the stack in number of elements.  If OS_STK is set to INT8U,
*                       'stk_size' corresponds to the number of bytes available.  If OS_STK is set to
*                       INT16U, 'stk_size' contains the number of 16-bit entries available.  Finally, if
*                       OS_STK is set to INT32U, 'stk_size' contains the number of 32-bit entries
*                       available on the stack.
*
*              pext     is a pointer to a user supplied memory location which is used as a TCB extension.
*                       For example, this user memory can hold the contents of floating-point registers
*                       during a context switch, the time each task takes to execute, the number of times
*                       the task has been switched-in, etc.
*
*              opt      contains additional information (or options) about the behavior of the task.  The
*                       LOWER 8-bits are reserved by uC/OS-II while the upper 8 bits can be application

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久久网站| 678五月天丁香亚洲综合网| 石原莉奈在线亚洲二区| 亚洲午夜电影在线观看| 国产精品久久久久久久久久免费看| 欧美大肚乱孕交hd孕妇| 日韩午夜精品电影| 久久这里都是精品| 国产精品免费丝袜| 亚洲色欲色欲www| 亚洲一区二区三区影院| 天堂av在线一区| 免费精品视频在线| 国产一区二区剧情av在线| 国产成人av一区| 91亚洲精品一区二区乱码| 色综合久久中文综合久久97| 色88888久久久久久影院野外| 欧美一a一片一级一片| 欧美丰满美乳xxx高潮www| 91精品国产高清一区二区三区蜜臀| 欧美一二三四在线| 国产无人区一区二区三区| 综合激情成人伊人| 午夜精品久久久久久久久久久| 日本女优在线视频一区二区| 另类人妖一区二区av| 成a人片亚洲日本久久| 欧美午夜精品久久久| 久久久久久9999| 亚洲成人中文在线| 国产成人在线观看| 在线观看国产91| 精品国产凹凸成av人导航| 国产精品高潮呻吟久久| 婷婷夜色潮精品综合在线| 国产精品白丝av| 欧美在线视频你懂得| 久久精品一区蜜桃臀影院| 午夜精品在线看| 成人福利视频在线看| 日韩午夜小视频| 亚洲免费资源在线播放| 国产在线精品一区在线观看麻豆| 色婷婷av一区二区三区大白胸| 久久综合999| 日本中文在线一区| 99re6这里只有精品视频在线观看| 日韩欧美精品在线| 亚洲精品少妇30p| 高清日韩电视剧大全免费| 欧美高清www午色夜在线视频| 日韩毛片一二三区| 国产美女精品人人做人人爽| 777久久久精品| 亚洲欧美激情视频在线观看一区二区三区 | 久久久精品日韩欧美| 亚洲chinese男男1069| 成人自拍视频在线| 精品国产欧美一区二区| 午夜国产不卡在线观看视频| 99九九99九九九视频精品| 国产午夜精品一区二区 | 精品国产免费人成在线观看| 亚洲久本草在线中文字幕| 成人精品国产一区二区4080| 日韩精品一区二区在线观看| 丝瓜av网站精品一区二区| 欧美亚洲一区二区三区四区| 一区二区欧美在线观看| 99久久婷婷国产综合精品电影 | 91久久免费观看| 亚洲欧美在线aaa| 99久久99久久综合| 国产精品电影一区二区| 高清beeg欧美| 亚洲欧美在线视频观看| www.亚洲在线| 国产精品国产自产拍高清av王其| 国产精品911| 久久久www成人免费毛片麻豆| 国产中文一区二区三区| 久久久国产精品午夜一区ai换脸| 看国产成人h片视频| 欧美变态口味重另类| 国产在线乱码一区二区三区| 国产亚洲精品久| 99国内精品久久| 一区二区三区高清不卡| 制服.丝袜.亚洲.另类.中文 | 国产精品九色蝌蚪自拍| 91在线云播放| 亚洲国产wwwccc36天堂| 6080国产精品一区二区| 激情亚洲综合在线| 中文字幕巨乱亚洲| 在线免费观看日韩欧美| 青青青伊人色综合久久| 欧美激情一区二区三区四区 | 日韩欧美精品三级| 国产成人免费网站| 亚洲日本护士毛茸茸| 欧美日韩高清一区二区三区| 欧美aa在线视频| 日本一区二区免费在线| 欧美日韩免费一区二区三区 | 91精品久久久久久久99蜜桃| 激情都市一区二区| 国产精品你懂的在线欣赏| 欧美日韩aaa| 国产伦精品一区二区三区免费迷| 亚洲视频在线观看三级| 日韩视频一区在线观看| 99riav一区二区三区| 爽好久久久欧美精品| 国产精品人妖ts系列视频| 精品视频全国免费看| 国产夫妻精品视频| 亚洲va中文字幕| 国产欧美精品在线观看| 欧美精品自拍偷拍| 国产不卡在线一区| 蜜臀av性久久久久蜜臀aⅴ| 亚洲欧美日韩国产综合| 久久精品无码一区二区三区| 欧美高清视频www夜色资源网| 成人sese在线| 国产激情一区二区三区四区| 亚洲国产成人av好男人在线观看| 国产精品视频免费看| 日韩欧美国产电影| 欧美日韩国产123区| 99久久久精品| 懂色av噜噜一区二区三区av | 亚洲国产精品av| 日韩精品一区二区三区在线| 欧美自拍丝袜亚洲| 成人av网址在线| 国产制服丝袜一区| 老司机精品视频导航| 日本色综合中文字幕| 手机精品视频在线观看| 一区二区三区日本| 国产精品人成在线观看免费| 国产丝袜欧美中文另类| 欧美精品一区二区久久久 | 国产xxx精品视频大全| 欧美bbbbb| 蜜桃av一区二区三区| 日韩精品五月天| 欧美96一区二区免费视频| 午夜精品成人在线| 午夜精品aaa| 日韩电影在线观看电影| 日韩国产精品久久久| 日韩电影在线一区二区| 日本不卡一区二区三区| 日韩在线一区二区| 免费成人在线网站| 免费看欧美美女黄的网站| 精品综合久久久久久8888| 国内精品免费**视频| 国产一区二区三区久久悠悠色av| 久久99精品久久久久| 国产精品正在播放| 成人午夜激情在线| 91久久精品网| 欧美午夜一区二区三区| 日韩一区二区免费视频| 久久综合久色欧美综合狠狠| 久久综合中文字幕| 中文字幕在线不卡视频| 一区二区三区电影在线播| 日韩黄色免费电影| 国产麻豆91精品| 91免费版在线| 欧美精选在线播放| 久久精品日韩一区二区三区| 国产精品乱人伦一区二区| ...av二区三区久久精品| 亚洲国产欧美一区二区三区丁香婷| 亚洲bdsm女犯bdsm网站| 国产一区二区伦理片| 91久久线看在观草草青青| 日韩视频免费直播| 中文字幕乱码亚洲精品一区| 亚洲国产aⅴ成人精品无吗| 韩国三级中文字幕hd久久精品| 成人高清免费在线播放| 欧美美女直播网站| 国产亚洲短视频| 一区二区三区国产精品| 国产一区二区三区| 色八戒一区二区三区| ww久久中文字幕| 亚洲综合色在线| 国产福利一区二区| 制服丝袜亚洲色图| 亚洲精品国产第一综合99久久 | 日韩在线a电影|