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

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

?? os_task.c

?? UCOSII在mcs12dg128上的移植
?? 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 "..\Sources\UCOS2\CONFIG_UCOS\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一区二区三区免费野_久草精品视频
中文一区二区完整视频在线观看| 久久国产精品露脸对白| 五月天一区二区三区| 国产成人精品免费在线| 欧美日本一道本| 亚洲欧美日韩国产中文在线| 国产一区二区三区免费观看| 欧美专区亚洲专区| 亚洲欧洲精品天堂一级| 狠狠色综合播放一区二区| 欧美老肥妇做.爰bbww视频| 1区2区3区精品视频| 国产做a爰片久久毛片| 91精品蜜臀在线一区尤物| 亚洲欧美日韩在线播放| 成人av免费在线观看| 久久综合精品国产一区二区三区| 婷婷久久综合九色综合伊人色| 一本色道久久综合精品竹菊| 国产精品视频看| 国产麻豆9l精品三级站| 日韩欧美电影一二三| 人人爽香蕉精品| 欧美无砖专区一中文字| 亚洲精品中文字幕乱码三区| 不卡电影一区二区三区| 一区二区三区精品在线观看| 国产aⅴ综合色| 国产性做久久久久久| 精品在线亚洲视频| 精品国产污污免费网站入口| 久久99精品国产麻豆婷婷洗澡| 欧美一级片免费看| 麻豆精品视频在线观看免费| 欧美一级日韩一级| 久久99久久久欧美国产| 精品国产乱子伦一区| 国产在线播放一区| 中文字幕欧美激情一区| 99久久综合国产精品| 一区二区三区四区在线免费观看| 91精品福利视频| 日韩在线卡一卡二| 日韩精品一区二区三区三区免费| 久久精品国产亚洲aⅴ| 久久久夜色精品亚洲| 成人午夜精品在线| 一区二区三区日韩欧美| 欧美精品丝袜久久久中文字幕| 日韩国产欧美视频| 久久嫩草精品久久久久| 国产成人亚洲综合a∨婷婷图片| 国产精品色婷婷久久58| 欧美亚洲动漫制服丝袜| 日韩不卡免费视频| 欧美激情综合网| 在线观看视频一区二区欧美日韩| 日日摸夜夜添夜夜添亚洲女人| 精品国精品国产| 99久久精品国产精品久久| 五月天精品一区二区三区| 2023国产一二三区日本精品2022| 99久久精品国产网站| 日韩国产成人精品| 国产精品美女久久久久久久网站| 欧美羞羞免费网站| 国产精品一区二区男女羞羞无遮挡| 亚洲国产中文字幕| 国产日韩av一区二区| 欧美日韩久久不卡| 成人自拍视频在线观看| 亚洲成人综合在线| 欧美激情在线一区二区三区| 欧美视频精品在线观看| 成人高清免费观看| 免费在线看一区| **网站欧美大片在线观看| 日韩一级免费观看| 色综合久久久网| 国产美女av一区二区三区| 亚洲香肠在线观看| 国产精品少妇自拍| 久久只精品国产| 欧美日韩不卡一区二区| 99re66热这里只有精品3直播| 免费高清视频精品| 亚洲影院久久精品| 国产精品全国免费观看高清| 日韩欧美国产综合在线一区二区三区 | 亚洲小少妇裸体bbw| 久久这里只有精品首页| 欧美久久久久久久久久| 91麻豆国产精品久久| 国产成人在线免费| 激情欧美一区二区| 日韩不卡在线观看日韩不卡视频| 亚洲欧美激情小说另类| 国产欧美一区二区在线| 久久看人人爽人人| 精品久久人人做人人爽| 91麻豆精品91久久久久久清纯| 在线日韩国产精品| 91福利在线免费观看| 欧美一级日韩免费不卡| 欧美日韩一区三区四区| 在线免费观看日韩欧美| 99久久精品免费观看| 成人精品视频.| 丰满放荡岳乱妇91ww| 国产成人精品免费| 高清成人在线观看| 国产精品亚洲综合一区在线观看| 久久99精品久久只有精品| 裸体健美xxxx欧美裸体表演| 免费人成在线不卡| 美女久久久精品| 激情深爱一区二区| 国产宾馆实践打屁股91| 成人免费视频一区二区| 91在线小视频| 欧美亚洲日本国产| 欧美日韩国产小视频在线观看| 欧美日韩精品综合在线| 欧美成人一区二区三区在线观看 | 99精品久久只有精品| 91在线观看地址| 欧美日韩中文字幕一区| 日韩一区二区三区免费看 | 一本大道久久精品懂色aⅴ| 成人app网站| 欧美在线啊v一区| 欧美日韩成人一区二区| 精品久久久久久久久久久久包黑料 | 亚洲一区二区三区三| 亚洲v日本v欧美v久久精品| 亚洲第一狼人社区| 久久av资源站| 99久久精品国产观看| 欧美午夜精品久久久久久孕妇| 91麻豆精品国产91久久久资源速度| 日韩一区二区在线观看| 亚洲国产精品激情在线观看 | 国产亚洲综合在线| 亚洲欧美另类久久久精品 | 日韩精品影音先锋| 中文字幕欧美激情一区| 亚洲国产cao| 夫妻av一区二区| 欧美午夜精品免费| 久久久久久久综合色一本| 怡红院av一区二区三区| 久久国产精品色| 一本一道久久a久久精品 | 久久国产成人午夜av影院| 成人性生交大片免费看视频在线| 欧美少妇bbb| 中文无字幕一区二区三区 | 日韩欧美www| 国产精品国产精品国产专区不蜜 | 亚洲欧美另类图片小说| 麻豆国产欧美日韩综合精品二区| 成人av电影免费在线播放| 欧美日本在线看| 亚洲视频一区二区在线| 久久精品国产99| 欧美日韩一区 二区 三区 久久精品| 久久久久成人黄色影片| 午夜精品久久久久久不卡8050| 大尺度一区二区| 精品卡一卡二卡三卡四在线| 亚洲欧美日韩久久精品| 国产ts人妖一区二区| 欧美一区二区播放| 亚洲影视在线观看| 99在线视频精品| 国产日本欧洲亚洲| 捆绑调教一区二区三区| 欧美色图天堂网| 亚洲欧洲日韩在线| 国产精品一线二线三线精华| 777xxx欧美| 性感美女久久精品| 欧美亚洲日本国产| 亚洲综合av网| 91久久久免费一区二区| 国产精品久久久久9999吃药| 国产成人精品免费网站| 久久久久久久久一| 韩国精品在线观看| 欧美成人精品福利| 麻豆中文一区二区| 717成人午夜免费福利电影| 亚洲一区二区三区国产| 在线观看国产日韩| 亚洲成人精品影院| 在线播放中文一区| 午夜免费久久看| 欧美一区二区免费观在线| 青椒成人免费视频| 精品久久久久一区|