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

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

?? os_task.c

?? UCOSII-V2.53在SPCE061A的移植 使用開發環境u nSP 1.84
?? 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一区二区三区免费野_久草精品视频
97aⅴ精品视频一二三区| 欧美视频在线一区| 欧美伊人久久久久久久久影院| 97久久超碰国产精品| 欧美军同video69gay| 久久综合丝袜日本网| 国产精品久久久久久久久免费丝袜| 国产精品电影院| 午夜电影网一区| 日韩黄色小视频| 白白色 亚洲乱淫| 欧美军同video69gay| 国产欧美一二三区| 日韩激情在线观看| 99久久免费视频.com| 欧美丰满少妇xxxbbb| 欧美高清在线一区二区| 一级女性全黄久久生活片免费| 日本成人在线一区| 91免费精品国自产拍在线不卡| 欧美一区日韩一区| 亚洲精品视频免费观看| 国产盗摄一区二区| www.爱久久.com| 久久女同互慰一区二区三区| 亚洲一区二区视频在线观看| 亚洲女与黑人做爰| 国产一区啦啦啦在线观看| 成人高清伦理免费影院在线观看| 91成人免费在线视频| 国产色爱av资源综合区| 日韩电影网1区2区| 日本道色综合久久| 国产农村妇女精品| 极品少妇xxxx精品少妇| 制服丝袜中文字幕一区| 亚洲色图.com| 亚洲一区二区3| 成人激情动漫在线观看| 久久久久国产一区二区三区四区| 国产精品久久久一本精品| 国产综合色在线| 日韩欧美一区中文| 日本欧美在线看| 欧美中文字幕一区二区三区| 亚洲三级在线播放| 国产精品1区2区3区| 久久麻豆一区二区| 午夜av区久久| 欧美裸体bbwbbwbbw| 亚洲午夜三级在线| 欧美日韩中文字幕一区二区| 国产精品久久久久久亚洲毛片| 国产九色精品成人porny| 精品1区2区在线观看| 一区二区三区 在线观看视频| 成a人片亚洲日本久久| 国产午夜精品理论片a级大结局| 日韩精品1区2区3区| 色噜噜久久综合| 亚洲摸摸操操av| 欧美三级韩国三级日本三斤| 亚洲国产视频一区二区| 91精品国产免费| 日韩精品一二三| 欧美精品一区二区三区在线播放| 久久国产福利国产秒拍| 久久香蕉国产线看观看99| 成人精品小蝌蚪| 亚洲欧美另类图片小说| 欧美性猛交一区二区三区精品| 亚洲韩国一区二区三区| 日韩视频一区二区三区 | 日韩av电影一区| 欧美xxxxx牲另类人与| 另类小说色综合网站| 国产午夜精品久久| 91麻豆国产福利在线观看| 亚洲欧美日韩国产另类专区| 欧美性猛交xxxx黑人交| 久久国内精品视频| 国产精品久久网站| av在线不卡电影| 亚洲免费资源在线播放| 欧美日韩国产另类不卡| 日韩和欧美一区二区| 国产亚洲1区2区3区| 欧美三级蜜桃2在线观看| 国产一区二区在线影院| 国产欧美一区二区精品秋霞影院| 91黄视频在线| 蜜桃久久精品一区二区| 欧美激情一区在线| 欧美丝袜丝nylons| 国产一二精品视频| 久久夜色精品一区| 色综合久久中文字幕| 一区二区三区免费在线观看| 欧美成人vr18sexvr| 色婷婷亚洲精品| 国产又黄又大久久| 午夜久久久久久| 亚洲色图制服诱惑 | 国产日本亚洲高清| 色8久久精品久久久久久蜜| 亚洲观看高清完整版在线观看| 精品国产免费人成电影在线观看四季| 成人黄色综合网站| 一区二区三国产精华液| 欧美精品一区二区三区高清aⅴ | 精品国产3级a| 欧美日韩五月天| 成人短视频下载| 日本特黄久久久高潮| 一区二区三区免费在线观看| 欧美国产激情一区二区三区蜜月| 91精品国产一区二区| 一本久道久久综合中文字幕| 国产经典欧美精品| 久久av资源站| 免费视频一区二区| 中文字幕中文字幕在线一区| 国产欧美精品区一区二区三区| 日韩视频一区二区三区在线播放 | 国产网站一区二区三区| 日韩欧美久久一区| 色婷婷精品大在线视频| 成人精品鲁一区一区二区| 经典三级一区二区| 日韩综合在线视频| 午夜精品久久久久久久久久久 | 国产精品毛片大码女人| 亚洲国产成人在线| 欧美国产一区二区| 国产精品成人免费| 中文字幕欧美一| 成人免费在线播放视频| 一区在线中文字幕| 国产女人水真多18毛片18精品视频| 精品精品国产高清一毛片一天堂| 99久久精品国产导航| 99精品国产视频| 欧美午夜宅男影院| 欧美一区永久视频免费观看| 欧美丰满美乳xxx高潮www| 91精品国产麻豆国产自产在线| 欧美一区二区在线看| 精品美女一区二区| 久久精品亚洲乱码伦伦中文| 国产欧美1区2区3区| 亚洲日本一区二区三区| 国产日韩欧美精品一区| 日韩毛片精品高清免费| 亚洲精品国产一区二区精华液| 日韩三级视频在线观看| 日韩美女天天操| 欧美日韩日日夜夜| 精品久久久三级丝袜| 欧美国产乱子伦| 亚洲午夜免费视频| 久久99精品国产.久久久久| 丝瓜av网站精品一区二区 | 国产精品一区二区无线| 菠萝蜜视频在线观看一区| 9久草视频在线视频精品| 91美女片黄在线| 日韩视频在线观看一区二区| 国产校园另类小说区| 一区二区三区欧美视频| 国产在线精品一区在线观看麻豆| 成人视屏免费看| 91麻豆精品国产91久久久久久久久| 欧美三级视频在线| 国产丝袜美腿一区二区三区| 夜夜嗨av一区二区三区| 99麻豆久久久国产精品免费 | 久久嫩草精品久久久久| 久久精品亚洲国产奇米99| 麻豆一区二区三| 色婷婷综合久久久久中文一区二区 | 美女www一区二区| 精品一二三四区| 欧洲视频一区二区| 91精品国产综合久久蜜臀| 一区二区在线免费观看| 国内外精品视频| 2023国产精品| 天堂在线亚洲视频| 激情丁香综合五月| 777亚洲妇女| 中文字幕日韩一区| 91免费版在线看| 国产婷婷色一区二区三区四区| 韩国午夜理伦三级不卡影院| 欧美三级一区二区| 午夜精品福利一区二区三区蜜桃| 93久久精品日日躁夜夜躁欧美| 91麻豆精品国产自产在线| 视频在线在亚洲| 欧美色图在线观看|