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

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

?? os_task.c

?? uCOS-II內核源代碼及相關文檔,可以看看。
?? 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一区二区三区免费野_久草精品视频
精品国产精品网麻豆系列| 亚洲激情图片qvod| 亚洲伦理在线免费看| 久久电影国产免费久久电影| 成人性色生活片| 欧美va在线播放| 亚洲一区二区精品久久av| 国产成人综合在线播放| 91精品免费在线| 亚洲人成精品久久久久久| 国产一区二区影院| 日韩美女主播在线视频一区二区三区 | 色女孩综合影院| 精品久久久久久久久久久久久久久久久 | 欧美白人最猛性xxxxx69交| 亚洲另类一区二区| 成人av网在线| 国产情人综合久久777777| 麻豆久久久久久| 欧美卡1卡2卡| 亚洲国产aⅴ成人精品无吗| 不卡的av电影在线观看| 国产日韩三级在线| 国产专区综合网| 精品久久久久久久久久久久久久久| 午夜精品福利一区二区三区av| 色综合久久综合网97色综合| 亚洲品质自拍视频| 91麻豆国产福利精品| 成人欧美一区二区三区白人| bt欧美亚洲午夜电影天堂| 国产精品久久看| 不卡视频一二三四| 亚洲日本丝袜连裤袜办公室| 9i在线看片成人免费| 亚洲欧洲99久久| 91麻豆精品一区二区三区| 亚洲天天做日日做天天谢日日欢 | 在线成人高清不卡| 日本不卡视频在线| 精品奇米国产一区二区三区| 韩日av一区二区| 国产嫩草影院久久久久| 大胆欧美人体老妇| 亚洲欧美另类综合偷拍| 欧美狂野另类xxxxoooo| 久久www免费人成看片高清| 久久久午夜精品| av中文字幕在线不卡| 亚洲另类在线一区| 91精品婷婷国产综合久久性色| 激情综合网激情| 国产精品久久久久影院色老大 | 日韩av一区二区三区四区| 欧美mv日韩mv国产| 成年人国产精品| 亚洲在线视频网站| 精品处破学生在线二十三| 丁香啪啪综合成人亚洲小说| 亚洲一区二区三区中文字幕在线| 欧美一级在线观看| bt欧美亚洲午夜电影天堂| 午夜亚洲福利老司机| 精品sm在线观看| 99久久国产综合精品色伊| 日韩成人dvd| 国产精品乱人伦中文| 欧美日韩卡一卡二| 成人av小说网| 日韩电影免费在线看| 国产精品萝li| 精品卡一卡二卡三卡四在线| 99久久综合精品| 美女mm1313爽爽久久久蜜臀| 最新欧美精品一区二区三区| 91精品国产色综合久久不卡蜜臀| 高清不卡在线观看| 日本伊人午夜精品| 亚洲精品久久嫩草网站秘色| 日韩精品中文字幕在线不卡尤物 | 欧美哺乳videos| 色视频欧美一区二区三区| 国内成+人亚洲+欧美+综合在线| 亚洲精品网站在线观看| 久久久三级国产网站| 欧美日韩一区在线| 95精品视频在线| 国产真实乱偷精品视频免| 午夜精品成人在线视频| 99久久久免费精品国产一区二区| 国产精品久久久久婷婷| 7799精品视频| 色婷婷久久综合| 韩国女主播一区二区三区| 日韩电影在线观看网站| 玉足女爽爽91| 中文字幕欧美一区| 2024国产精品视频| 欧美精品xxxxbbbb| 欧美中文字幕一区二区三区 | 亚洲一区二区三区中文字幕在线| 中文字幕国产一区二区| 26uuu另类欧美| 精品日本一线二线三线不卡| 欧美一区二区性放荡片| 欧美日韩电影在线播放| 欧美最猛黑人xxxxx猛交| 91黄色免费观看| 欧美色图第一页| 成人av资源网站| 成人午夜激情在线| 成人av电影免费在线播放| 国产精品18久久久久久久网站| 91在线视频18| 久久久午夜电影| 精品国产污污免费网站入口| 欧美剧情片在线观看| 制服丝袜亚洲色图| 7777精品伊人久久久大香线蕉超级流畅 | 中文字幕人成不卡一区| 国产精品毛片大码女人| 国产精品嫩草99a| 中文字幕中文字幕中文字幕亚洲无线| 国产精品久久久久国产精品日日| 欧美极品另类videosde| 亚洲视频在线观看三级| 亚洲激情图片一区| 日精品一区二区三区| 全国精品久久少妇| 国产乱码精品一区二区三区忘忧草 | 亚洲综合偷拍欧美一区色| 亚洲午夜免费视频| 蜜乳av一区二区| 国产精品一级片在线观看| av在线免费不卡| 欧美三级午夜理伦三级中视频| 欧美午夜一区二区三区免费大片| 欧美日韩国产免费| 久久这里只精品最新地址| 国产日韩欧美一区二区三区乱码| 国产精品国产三级国产a| 一区二区国产视频| 老司机午夜精品| 国产成人高清在线| 91传媒视频在线播放| 日韩亚洲电影在线| 国产精品视频九色porn| 亚洲一区二区视频在线观看| 国产在线不卡一区| 一本久久a久久免费精品不卡| 91精品国产综合久久婷婷香蕉| 精品国产乱码久久久久久久久| 中文字幕一区二区5566日韩| 日本vs亚洲vs韩国一区三区| www.久久久久久久久| 日韩精品一区二区三区在线播放| 欧美国产精品一区二区| 亚洲.国产.中文慕字在线| 国产一区在线不卡| 欧美日韩免费观看一区二区三区 | 亚洲在线视频免费观看| 激情偷乱视频一区二区三区| 一本久久a久久精品亚洲| 欧美mv日韩mv国产网站| 夜夜嗨av一区二区三区四季av| 韩国精品在线观看| 欧美系列在线观看| 国产精品美女久久久久高潮| 蜜桃传媒麻豆第一区在线观看| caoporm超碰国产精品| www国产成人| 奇米精品一区二区三区在线观看| 色av成人天堂桃色av| 欧美激情一区二区在线| 精品一区二区在线观看| 欧美写真视频网站| 亚洲欧美综合网| 国产91精品久久久久久久网曝门| 日韩精品在线网站| 男女男精品视频网| 91福利在线导航| 中文字幕在线不卡一区| 青青草视频一区| 高清不卡一区二区| 精品黑人一区二区三区久久| 一区二区三区日韩欧美| av电影在线观看一区| 久久久国产精华| 国内久久精品视频| 日韩女优av电影在线观看| 日本aⅴ亚洲精品中文乱码| 欧美日韩精品专区| 亚洲成人动漫一区| 欧美日免费三级在线| 一区二区三区日韩欧美精品 | 国产精品久久二区二区| 国产成人精品免费一区二区| 久久亚洲一级片| 成人黄色免费短视频| 中文字幕精品在线不卡|