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

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

?? os_task.c

?? ucosII操作系統移植源代碼(包括詳細的移植步驟和心得)。
?? 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_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 *ppdata, OS_STK *ptos, INT8U prio)
{

    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, ppdata, 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人自拍高清视频在线免费播放| 午夜欧美一区二区三区在线播放| 91精品久久久久久久91蜜桃| 欧美人动与zoxxxx乱| 欧美三日本三级三级在线播放| 色欧美片视频在线观看在线视频| 99国产精品久| 欧美巨大另类极品videosbest| 欧美日韩精品久久久| 日韩一区二区免费视频| 久久综合一区二区| 国产精品理论片在线观看| 中文字幕一区二区三区四区| 亚洲欧洲综合另类在线 | 青青草国产精品亚洲专区无| 日韩黄色免费网站| 国产一区二区精品在线观看| hitomi一区二区三区精品| 日本伦理一区二区| 91精品国产综合久久小美女| 久久久噜噜噜久久人人看| 亚洲视频一区在线观看| 日韩不卡一二三区| 高清久久久久久| 在线亚洲免费视频| 精品福利在线导航| 亚洲人被黑人高潮完整版| 日韩影院免费视频| 不卡视频一二三| 欧美猛男gaygay网站| 久久久久久免费| 一区二区三区蜜桃| 国产精品影视天天线| 色综合久久66| 国产亚洲欧美色| 视频一区二区欧美| 成人av资源下载| 欧美精选午夜久久久乱码6080| 日韩欧美一级特黄在线播放| 亚洲欧美色一区| 国产美女一区二区| 欧美一卡二卡三卡| 亚洲欧美日韩国产另类专区| 久久电影国产免费久久电影| 欧美亚洲一区三区| 中文字幕人成不卡一区| 国产一区三区三区| 欧美日韩国产乱码电影| 自拍偷拍亚洲欧美日韩| 国产毛片一区二区| 日韩午夜三级在线| 亚洲成人激情社区| 色悠悠久久综合| 国产精品久久久一本精品| 久久99国产精品尤物| 91.com在线观看| 亚洲精品免费在线观看| 成人免费av资源| 久久久久久久久免费| 精品综合免费视频观看| 欧美精品久久久久久久多人混战| 亚洲女爱视频在线| www.久久久久久久久| 久久久久久**毛片大全| 久久国产精品72免费观看| 欧美一级高清片| 蜜桃久久久久久| 欧美一二三四在线| 日韩国产高清在线| 91精品国产麻豆| 日产精品久久久久久久性色| 欧美精品少妇一区二区三区 | 欧美嫩在线观看| 亚洲愉拍自拍另类高清精品| 91免费国产在线| 一区二区欧美在线观看| 欧美在线制服丝袜| 亚洲成人久久影院| 日韩欧美在线影院| 男男视频亚洲欧美| 精品久久久久香蕉网| 国产一区二区看久久| 亚洲国产精品精华液2区45| 成人一区在线看| 亚洲欧美另类小说视频| 欧美性色黄大片| 麻豆精品一区二区av白丝在线| 精品国产91洋老外米糕| 国产乱码精品1区2区3区| 日本一区二区三区四区| 色综合色狠狠综合色| 午夜视频在线观看一区二区| 日韩视频免费观看高清完整版| 韩国三级电影一区二区| 自拍av一区二区三区| 在线一区二区三区做爰视频网站| 午夜欧美视频在线观看| 久久亚洲综合色| 99re热视频精品| 日韩—二三区免费观看av| 国产视频一区在线观看 | 日日夜夜免费精品| 2023国产精华国产精品| 91在线丨porny丨国产| 午夜精品久久久久久不卡8050| 欧美大片在线观看| 99国产精品久| 精品无人码麻豆乱码1区2区| 亚洲少妇屁股交4| 欧美成人免费网站| 99国产精品久久久久久久久久| 日本特黄久久久高潮| 国产精品福利影院| 日韩欧美一级二级三级久久久| 国产成人av影院| 亚洲一区二区三区不卡国产欧美 | 中文字幕制服丝袜一区二区三区 | 亚洲欧洲三级电影| 制服丝袜一区二区三区| a美女胸又www黄视频久久| 美女尤物国产一区| 亚洲夂夂婷婷色拍ww47| 国产精品视频第一区| 精品日韩欧美一区二区| 欧美无乱码久久久免费午夜一区 | 成人免费一区二区三区在线观看| 555夜色666亚洲国产免| 91在线视频免费91| 国产高清精品网站| 日韩av电影天堂| 午夜视频一区二区| 亚洲主播在线播放| 伊人性伊人情综合网| 18欧美亚洲精品| 欧美激情中文字幕一区二区| 精品欧美黑人一区二区三区| 555www色欧美视频| 91麻豆精品久久久久蜜臀| 欧美少妇xxx| 91成人在线观看喷潮| 97se亚洲国产综合在线| 成人免费va视频| 豆国产96在线|亚洲| 国产盗摄女厕一区二区三区| 国产麻豆精品theporn| 狠狠色狠狠色合久久伊人| 狂野欧美性猛交blacked| 亚洲mv在线观看| 亚洲第一主播视频| 日韩精品免费视频人成| 男男视频亚洲欧美| 久草中文综合在线| 国产在线播精品第三| 国产高清久久久| 9i在线看片成人免费| 色综合久久久久网| 欧美日韩在线综合| 4hu四虎永久在线影院成人| 在线不卡免费av| 日韩精品中午字幕| 久久久久免费观看| 国产精品久久久久桃色tv| 亚洲精品国产精华液| 亚洲与欧洲av电影| 麻豆精品精品国产自在97香蕉| 美女诱惑一区二区| 国产成人免费视频一区| 99久久99久久精品国产片果冻 | 精品一二三四区| 国产剧情av麻豆香蕉精品| 国产激情偷乱视频一区二区三区| 成人午夜碰碰视频| 在线观看成人小视频| 日韩欧美一级特黄在线播放| 欧美激情一区二区三区不卡| 亚洲人精品午夜| 久久精品国产一区二区三区免费看 | 免费成人你懂的| 成人在线视频一区二区| 欧美羞羞免费网站| 精品女同一区二区| 亚洲激情第一区| 狠狠色丁香九九婷婷综合五月| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 中文字幕一区二区三区av| 偷拍自拍另类欧美| 国产91高潮流白浆在线麻豆| 在线观看区一区二| 久久久91精品国产一区二区三区| 亚洲欧美一区二区三区久本道91 | 久久91精品国产91久久小草| 97久久久精品综合88久久| 日韩一区二区三区在线| ...av二区三区久久精品| 麻豆一区二区三| 色菇凉天天综合网| 精品91自产拍在线观看一区| 亚洲伦理在线精品| 国产精品99久久久久久似苏梦涵 | 欧美日韩国产综合一区二区三区|