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

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

?? os_task.c

?? The uC OS-II port for Keil C V6.20, V6.21 or higher
?? 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) KCREENTRANT
{
#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) KCREENTRANT, void *pdata, OS_STK *ptos, INT8U prio) KCREENTRANT
{
#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一区二区三区免费野_久草精品视频
91精品国产欧美一区二区18| 国产精品自在在线| 欧美日韩综合在线| 亚洲国产乱码最新视频 | 欧美日韩精品一区二区天天拍小说 | 亚洲已满18点击进入久久| 色网站国产精品| 亚洲18影院在线观看| 欧美变态口味重另类| 成人综合婷婷国产精品久久蜜臀| 中文字幕在线观看不卡| 欧美最新大片在线看| 三级成人在线视频| 久久综合九色综合97婷婷| 成人av集中营| 亚瑟在线精品视频| 久久婷婷色综合| 99久久er热在这里只有精品15| 亚洲一区二区三区四区不卡| 日韩三级视频中文字幕| 成人性生交大片免费看在线播放 | 豆国产96在线|亚洲| 亚洲精品视频自拍| 欧美一区二区精品久久911| 福利视频网站一区二区三区| 亚洲三级电影全部在线观看高清| 91精品久久久久久久99蜜桃| 国产成人av一区二区三区在线观看| 成人欧美一区二区三区小说| 日韩一区二区三区电影| caoporen国产精品视频| 日韩不卡一区二区三区 | 色综合天天天天做夜夜夜夜做| 性欧美疯狂xxxxbbbb| 国产亚洲欧美中文| 欧美日韩大陆一区二区| www.在线成人| 免费看精品久久片| 亚洲乱码国产乱码精品精的特点| 日韩欧美一级二级三级 | 3d成人h动漫网站入口| 国v精品久久久网| 三级在线观看一区二区 | 图片区小说区国产精品视频| 欧美www视频| 欧美日韩精品一区二区在线播放| 成人国产电影网| 久久99精品久久久久久| 日韩影院免费视频| 一区二区三区日韩欧美| 日本一区二区成人| 精品国免费一区二区三区| 欧美性色欧美a在线播放| 成人动漫视频在线| 国产成人免费视频精品含羞草妖精| 日韩av电影天堂| 一个色妞综合视频在线观看| 国产精品午夜电影| 久久久久久毛片| 欧美一区二区三区在| 色婷婷狠狠综合| 97成人超碰视| 国产成人福利片| 国产成人av福利| 国产中文字幕精品| 久久国产精品第一页| 免费成人av在线| 青青草精品视频| 欧美aaaaaa午夜精品| 日韩精品免费专区| 香蕉加勒比综合久久| 亚洲国产精品视频| 亚洲成av人片观看| 丝袜美腿亚洲色图| 日本中文字幕一区二区视频 | 日韩成人免费在线| 亚洲3atv精品一区二区三区| 亚洲gay无套男同| 亚洲国产欧美在线人成| 亚洲国产一区二区三区| 亚洲五码中文字幕| 亚洲444eee在线观看| 日av在线不卡| 精东粉嫩av免费一区二区三区| 久久疯狂做爰流白浆xx| 国产在线视视频有精品| 高清视频一区二区| 99久久精品免费看| 欧美色成人综合| 欧美一区二区在线不卡| 久久嫩草精品久久久精品| 国产欧美日本一区二区三区| 国产三级一区二区| 亚洲天堂免费在线观看视频| 亚洲综合一二区| 日韩精品电影在线| 国产一区999| 99久久国产免费看| 欧美区一区二区三区| 精品久久久久香蕉网| 国产人成一区二区三区影院| 亚洲天堂av一区| 日日夜夜精品视频天天综合网| 精品亚洲欧美一区| 91在线观看成人| 欧美日韩成人激情| 国产视频在线观看一区二区三区| 国产精品区一区二区三区| 一区二区三区蜜桃| 美女网站一区二区| 国产91丝袜在线播放九色| 色综合久久综合网欧美综合网| 欧美日本一道本| 国产色一区二区| 亚洲国产成人精品视频| 国产一区二区三区精品欧美日韩一区二区三区 | 欧美丰满嫩嫩电影| 久久久久久久久一| 尤物在线观看一区| 美女尤物国产一区| 91色婷婷久久久久合中文| 欧美电影免费观看高清完整版| 1000精品久久久久久久久| 麻豆91精品视频| 色综合天天天天做夜夜夜夜做| 51精品国自产在线| 中文字幕欧美一| 日本免费新一区视频| 99精品久久只有精品| 日韩欧美一级片| 亚洲国产视频在线| av在线播放一区二区三区| 91精品国产91久久综合桃花| 国产精品久久午夜夜伦鲁鲁| 蜜臂av日日欢夜夜爽一区| 色综合天天综合网天天狠天天 | 欧美视频中文字幕| 久久久无码精品亚洲日韩按摩| 亚洲一区二区三区美女| 岛国一区二区三区| 精品国产乱码久久久久久老虎| 亚洲国产视频a| 91蜜桃视频在线| 欧美国产精品中文字幕| 久久国产日韩欧美精品| 欧美人伦禁忌dvd放荡欲情| 亚洲视频一二三区| 成人精品免费看| 久久久精品国产免费观看同学| 日韩国产精品久久| 欧美日韩精品一区二区三区 | 视频精品一区二区| 欧美性xxxxxx少妇| 成人免费在线视频| 成人一级黄色片| 国产亚洲制服色| 国产成人av自拍| 久久久亚洲午夜电影| 久久狠狠亚洲综合| 精品国产a毛片| 久久99精品国产麻豆不卡| 91精品啪在线观看国产60岁| 亚洲成人自拍一区| 欧美年轻男男videosbes| 夜夜揉揉日日人人青青一国产精品 | 亚洲免费在线视频一区 二区| 成人免费看片app下载| 久久久精品蜜桃| 成人激情电影免费在线观看| 欧美激情在线一区二区| av在线不卡免费看| 一区二区三区在线视频免费观看| 色久综合一二码| 午夜精品久久一牛影视| 日韩一区二区三区视频在线| 美国十次综合导航| 久久久久久久久蜜桃| 成人美女视频在线观看| 亚洲蜜桃精久久久久久久| 欧美四级电影网| 热久久免费视频| 久久人人爽人人爽| 不卡一二三区首页| 亚洲一区二区在线视频| 欧美理论片在线| 国产在线精品一区二区不卡了 | 色偷偷88欧美精品久久久| 一区二区三区日韩精品视频| 7777精品久久久大香线蕉| 激情都市一区二区| 国产精品久久久久婷婷| 在线观看av不卡| 免费观看成人鲁鲁鲁鲁鲁视频| 久久久久综合网| 色婷婷av一区二区三区软件| 日本中文一区二区三区| 樱桃视频在线观看一区| 欧美一区二区二区| 国产99久久久国产精品潘金网站| 亚洲激情一二三区|