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

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

?? os_task.c

?? ARM7Proteus.rar
?? 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)
{
#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), 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
*                       specific.  See OS_TASK_OPT_??? in uCOS-II.H.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美α欧美αv大片| 国产精品久久久久aaaa| 国产精品每日更新| 亚洲成人av一区二区三区| 国产69精品久久99不卡| 7878成人国产在线观看| 国产精品美日韩| 国产一区二区三区四| 7777女厕盗摄久久久| 亚洲女人****多毛耸耸8| 国产精品一级片在线观看| 91精选在线观看| 亚洲午夜精品在线| av在线不卡观看免费观看| 精品国产污污免费网站入口| 爽爽淫人综合网网站| 在线一区二区三区做爰视频网站| 亚洲国产精品v| 国产a区久久久| 国产日韩精品视频一区| 国产精品 日产精品 欧美精品| 日韩一区二区三区视频| 青青草精品视频| 欧美三级中文字| 亚欧色一区w666天堂| 欧美日韩亚洲丝袜制服| 亚洲第一主播视频| 欧美精品一级二级三级| 日本大胆欧美人术艺术动态| 欧美一区二区三区日韩| 奇米亚洲午夜久久精品| 欧美一二三四区在线| 理论片日本一区| 精品国产一区二区三区不卡 | 国产女人18水真多18精品一级做| 亚洲成人一区二区| 9191国产精品| 日本亚洲视频在线| 日韩精品一区二区三区在线| 精品无人区卡一卡二卡三乱码免费卡 | 中文字幕国产一区| 懂色av中文字幕一区二区三区| 日本一区二区三区四区| 91视频.com| 一区二区免费看| 制服.丝袜.亚洲.中文.综合| 美女mm1313爽爽久久久蜜臀| 久久久不卡网国产精品二区| 成人深夜福利app| 亚洲一区二区视频在线观看| 欧美一区二区播放| 国产成人精品一区二区三区四区| 亚洲国产精品激情在线观看| 色八戒一区二区三区| 蜜臂av日日欢夜夜爽一区| 久久综合999| 91社区在线播放| 美女被吸乳得到大胸91| 欧美国产国产综合| 在线免费观看视频一区| 久久精品国产77777蜜臀| 国产精品久久久久久久久晋中| 欧洲生活片亚洲生活在线观看| 日韩成人精品在线观看| 国产精品色呦呦| 欧美精品第1页| 国产成a人亚洲| 日韩国产精品久久久| 国产嫩草影院久久久久| 欧美日韩国产色站一区二区三区| 激情欧美一区二区| 亚洲欧洲日产国产综合网| 日韩片之四级片| 成人天堂资源www在线| 亚洲成人av在线电影| 国产精品视频yy9299一区| 欧美肥大bbwbbw高潮| 97久久精品人人做人人爽50路| 日本亚洲天堂网| 夜夜揉揉日日人人青青一国产精品 | 欧美日韩中文字幕一区二区| 成人一级黄色片| 日本怡春院一区二区| 夜夜亚洲天天久久| 中文字幕视频一区| 精品999在线播放| 欧美高清视频不卡网| 色综合久久中文综合久久牛| 国产精品一线二线三线精华| 日本欧美一区二区| 亚洲123区在线观看| 亚洲欧美电影一区二区| 国产精品久久久久久久蜜臀| 久久综合色综合88| 日韩美女主播在线视频一区二区三区| 色激情天天射综合网| 99久久精品免费观看| 成人av在线看| 国产精品77777| 精品亚洲国产成人av制服丝袜| 亚洲电影在线播放| 亚洲国产毛片aaaaa无费看| 亚洲乱码国产乱码精品精小说| 中文字幕 久热精品 视频在线| 日韩精品一区二区在线| 日韩精品一区二区三区在线观看 | 日韩va亚洲va欧美va久久| 一区二区三区av电影 | 日韩有码一区二区三区| 亚洲图片欧美视频| 亚洲成人手机在线| 亚洲成a人片在线不卡一二三区| 一区二区三区精品视频在线| 国产精品嫩草久久久久| 国产精品久久久爽爽爽麻豆色哟哟| 久久久久成人黄色影片| 国产免费成人在线视频| 中文字幕av一区二区三区免费看| 国产欧美综合色| 国产精品欧美一区喷水| 日本一区免费视频| 国产精品成人一区二区三区夜夜夜| 国产精品久久免费看| 日韩一区中文字幕| 亚洲国产aⅴ天堂久久| 日本亚洲天堂网| 国产乱人伦偷精品视频免下载| 国产精品亚洲一区二区三区妖精| 成人黄页毛片网站| 欧美性生交片4| 日韩精品中午字幕| 国产午夜亚洲精品不卡| 亚洲精品视频在线| 午夜精品一区在线观看| 激情成人午夜视频| zzijzzij亚洲日本少妇熟睡| 色猫猫国产区一区二在线视频| 欧美日韩黄色影视| 久久中文字幕电影| 亚洲激情一二三区| 美国毛片一区二区| 成人美女视频在线观看| 欧美亚洲精品一区| 久久综合久色欧美综合狠狠| 国产精品久久久久久户外露出| 亚洲成在人线在线播放| 国产一区二区免费在线| 91国产精品成人| 日韩欧美一级特黄在线播放| 亚洲国产精品ⅴa在线观看| 亚洲1区2区3区4区| 成人免费毛片嘿嘿连载视频| 欧美日韩高清在线| 国产欧美日韩一区二区三区在线观看| 亚洲与欧洲av电影| 国产mv日韩mv欧美| 91精品国产91热久久久做人人| 中文字幕在线不卡一区二区三区| 日韩高清不卡一区二区| 91在线精品秘密一区二区| 91精品国产手机| 亚洲人成影院在线观看| 久久99国内精品| 欧美视频在线播放| 国产精品免费视频观看| 久国产精品韩国三级视频| 欧美在线免费播放| 亚洲欧美在线视频| 国产高清精品久久久久| 日韩美女视频一区二区在线观看| 亚洲免费av观看| 成人国产精品免费观看| 精品乱人伦小说| 视频在线在亚洲| 在线免费观看视频一区| 中文字幕一区日韩精品欧美| 国产一区二区三区四区五区美女| 91精品国产免费| 亚洲国产cao| 欧美影院午夜播放| 亚洲视频在线一区| www.色综合.com| 国产午夜精品一区二区 | 日韩成人一区二区| 91视视频在线观看入口直接观看www | 午夜a成v人精品| 欧美三片在线视频观看| 亚洲一区在线视频观看| 色女孩综合影院| 亚洲美女一区二区三区| 99国产精品久久久久久久久久 | 中文字幕一区二区三| 高清在线成人网| 国产亚洲一区二区在线观看| 久久国产福利国产秒拍| 欧美变态凌虐bdsm| 黑人精品欧美一区二区蜜桃| 精品国产a毛片| 国产成a人亚洲| 综合激情成人伊人|