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

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

?? os_task.c

?? uc0s zai 51 上的移植
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2002, 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)TASK_REENTRANT
{
#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                   */
        }
        ptcb = OSTCBPrioTbl[oldprio];
        if (ptcb != (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 {
                pevent = ptcb->OSTCBEventPtr;
                if (pevent != (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)TASK_REENTRANT, void *os_pdata, OS_STK *ptos, INT8U prio)TASK_REENTRANT
{
#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, os_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
*
*          os_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 'os_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
*                       specific.  See OS_TASK_OPT_??? in uCOS-II.H.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品一区国产麻豆| 中文字幕在线不卡视频| 国产日韩欧美a| 亚洲国产精品尤物yw在线观看| 韩日av一区二区| 欧美日韩激情在线| 亚洲欧洲一区二区在线播放| 日本不卡一二三| 欧美性大战xxxxx久久久| 国产欧美日韩在线| 国产永久精品大片wwwapp| 欧美三区在线视频| 亚洲精品国产无天堂网2021| 懂色av一区二区夜夜嗨| 精品国产免费一区二区三区四区 | 国产一区二区三区视频在线播放| 91网站最新网址| 国产精品久久久久久久久图文区| 激情亚洲综合在线| 日韩一区二区三区高清免费看看| 一区二区三国产精华液| youjizz国产精品| 国产视频视频一区| 国产一区视频网站| wwww国产精品欧美| 久久99热这里只有精品| 3d成人动漫网站| 免费成人小视频| 日韩欧美自拍偷拍| 久久电影网站中文字幕| 精品免费一区二区三区| 久久国产成人午夜av影院| 日韩一区二区三区高清免费看看| 亚洲va国产天堂va久久en| 欧美私人免费视频| 亚洲h动漫在线| 91精品国产乱| 国产精品影视天天线| 国产亚洲美州欧州综合国| 国产在线国偷精品免费看| 久久久影院官网| 成人av免费网站| 亚洲主播在线观看| 国产精品久久久久久亚洲毛片 | 在线观看国产精品网站| 亚洲品质自拍视频| 欧美探花视频资源| 人人爽香蕉精品| 精品粉嫩超白一线天av| 国产精品亚洲人在线观看| 欧美激情一区二区三区| 99视频在线精品| 亚洲v日本v欧美v久久精品| 欧美一区午夜精品| 国产成a人亚洲精品| 亚洲人一二三区| 欧美日韩免费在线视频| 免费的国产精品| 国产日韩欧美a| 欧美伊人久久大香线蕉综合69 | 国产精品视频一二三区| 91丨九色丨黑人外教| 亚洲一区二区三区四区中文字幕| 91精品国产欧美日韩| 国产精品自拍在线| 一区二区三区四区激情| 777a∨成人精品桃花网| 欧美手机在线视频| 韩国在线一区二区| 一区二区在线电影| 精品国产凹凸成av人导航| av在线不卡电影| 日本伊人午夜精品| 日韩一区在线免费观看| 91精品国产综合久久精品| 粗大黑人巨茎大战欧美成人| 亚洲成在线观看| 国产亚洲短视频| 91精品久久久久久蜜臀| 97久久精品人人爽人人爽蜜臀| 日韩高清中文字幕一区| 国产精品亲子伦对白| 欧美一区二区三区免费| av网站免费线看精品| 六月婷婷色综合| 亚洲小少妇裸体bbw| 国产欧美精品一区二区色综合朱莉 | 久久婷婷国产综合精品青草| 欧美色图天堂网| 成人美女在线观看| 精品制服美女丁香| 性做久久久久久久免费看| 中文字幕在线一区二区三区| 欧美白人最猛性xxxxx69交| 精品污污网站免费看| 97se亚洲国产综合在线| 欧美一级淫片007| 色一区在线观看| 成人午夜视频在线观看| 国产精品中文有码| 久久国产综合精品| 麻豆成人在线观看| 日本欧美肥老太交大片| 日韩精品久久理论片| 亚洲一区电影777| 一区二区三区在线视频观看| 国产精品每日更新| 日本一区二区三区视频视频| 久久久噜噜噜久久人人看| 精品日韩在线一区| 日韩免费一区二区| 欧美成人免费网站| 91麻豆精品国产91久久久使用方法 | 不卡欧美aaaaa| 国产乱对白刺激视频不卡| 另类中文字幕网| 蜜乳av一区二区| 久久精品免费观看| 久久99精品视频| 韩国一区二区在线观看| 国产盗摄视频一区二区三区| 夫妻av一区二区| 99久久久精品免费观看国产蜜| 99久久久免费精品国产一区二区| 97久久精品人人做人人爽| 在线亚洲人成电影网站色www| 在线视频你懂得一区二区三区| 日本二三区不卡| 欧美日韩国产经典色站一区二区三区| 欧美在线观看禁18| 欧美一级理论片| 国产欧美日韩综合精品一区二区| 国产精品理伦片| 亚洲国产成人高清精品| 麻豆精品视频在线观看视频| 国内偷窥港台综合视频在线播放| 国产精品一区二区在线播放 | 亚洲日本青草视频在线怡红院| 综合av第一页| 日本不卡一二三区黄网| 国产伦精品一区二区三区在线观看 | 久久精品国产在热久久| 国产成人av资源| 一本到不卡免费一区二区| 欧美裸体bbwbbwbbw| 精品欧美一区二区在线观看 | 成人av电影免费在线播放| 欧美主播一区二区三区美女| 欧美一区二区免费| 中文字幕制服丝袜一区二区三区| 一区二区三区电影在线播| 蜜臀精品一区二区三区在线观看 | 欧美在线综合视频| 精品久久久久久亚洲综合网| 欧美国产成人在线| 日韩中文欧美在线| 91网站在线播放| 精品国产凹凸成av人导航| 樱桃视频在线观看一区| 国产精品一区二区果冻传媒| 91福利资源站| 欧美激情一区二区三区不卡| 日本在线不卡一区| 91麻豆蜜桃一区二区三区| 日韩欧美在线观看一区二区三区| 1000精品久久久久久久久| 老司机精品视频导航| 在线视频一区二区三区| 国产亚洲一区二区三区| 视频一区免费在线观看| 97se亚洲国产综合在线| 国产亚洲欧美在线| 麻豆一区二区三区| 91福利社在线观看| 国产精品久久久久久久久晋中 | 中文字幕一区二区三区蜜月 | 日本最新不卡在线| 欧美性猛片xxxx免费看久爱| 中文字幕av一区二区三区免费看| 久久99精品久久久久久动态图 | 日韩中文欧美在线| 欧美日韩高清在线| 亚洲黄网站在线观看| 97aⅴ精品视频一二三区| 国产日韩欧美高清在线| 国产乱国产乱300精品| 精品1区2区在线观看| 日韩极品在线观看| 91麻豆精品国产自产在线观看一区| 一区二区在线观看av| 日本丶国产丶欧美色综合| 亚洲欧美在线aaa| 成人黄色小视频在线观看| 亚洲bt欧美bt精品777| 日本精品一区二区三区四区的功能| 国产精品嫩草久久久久| 波多野结衣一区二区三区| 中文字幕乱码日本亚洲一区二区| 国产精品888| 国产欧美一区二区三区在线看蜜臀|