亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美一区二区观看视频| 色偷偷88欧美精品久久久| 日韩三级中文字幕| 狂野欧美性猛交blacked| 日韩欧美一级二级三级久久久| 婷婷国产在线综合| 欧美一区二区视频在线观看 | 日韩欧美国产一区在线观看| 免费人成网站在线观看欧美高清| 精品久久人人做人人爽| 丁香婷婷深情五月亚洲| 日韩一区在线看| 欧美综合欧美视频| 免费观看成人av| 国产欧美一二三区| 一本久道久久综合中文字幕| 天天综合天天做天天综合| 精品国产第一区二区三区观看体验| 国产suv一区二区三区88区| 日韩理论片网站| 91精品在线免费观看| 国产一区二区精品在线观看| 亚洲欧美日韩一区| 91精品国模一区二区三区| 国产精品综合在线视频| 亚洲黄色免费电影| www国产成人| 欧洲视频一区二区| 国产一区二区三区av电影| 亚洲精品视频在线看| 亚洲精品在线免费播放| 在线视频欧美精品| 国产高清精品在线| 丝袜诱惑制服诱惑色一区在线观看| 国产网站一区二区| 欧美色视频在线| 丁香激情综合五月| 日本不卡一区二区三区高清视频| 国产精品久久久久久久蜜臀| 欧美一区二区日韩一区二区| 91在线国产福利| 激情综合亚洲精品| 午夜久久福利影院| 国产精品天干天干在线综合| 日韩午夜激情免费电影| 91免费小视频| 国产精品中文有码| 蜜臀av国产精品久久久久| 一区二区欧美精品| 中文字幕一区二区不卡| 精品国产91亚洲一区二区三区婷婷| 欧洲视频一区二区| 91视频在线看| 成人免费的视频| 精品在线播放免费| 日韩精品欧美精品| 亚洲三级在线看| 国产女同性恋一区二区| 欧美一区二区私人影院日本| 在线精品视频一区二区| 99re66热这里只有精品3直播 | 成人h精品动漫一区二区三区| 日本三级亚洲精品| 亚洲不卡av一区二区三区| 亚洲三级电影网站| 国产美女在线观看一区| 精彩视频一区二区三区| 奇米影视一区二区三区小说| 亚洲国产精品尤物yw在线观看| 日韩一区在线免费观看| 国产精品美女久久久久久| 国产网红主播福利一区二区| 久久嫩草精品久久久久| 久久麻豆一区二区| 久久久亚洲高清| 国产亚洲一区二区三区| 久久日一线二线三线suv| 欧美v日韩v国产v| 久久综合成人精品亚洲另类欧美| 日韩免费高清电影| 久久综合色婷婷| 欧美精彩视频一区二区三区| 国产欧美一区二区在线| 中文字幕精品一区二区精品绿巨人| 精品999在线播放| 久久久久综合网| 中文字幕一区二区三区不卡在线| 国产精品乱码一区二区三区软件| 国产精品久久久久精k8| 一区二区在线观看视频在线观看| 亚洲成人激情综合网| 免费黄网站欧美| 国产一区二区三区不卡在线观看 | 91亚洲男人天堂| 欧美视频完全免费看| 欧美群妇大交群中文字幕| 日韩亚洲欧美高清| 国产丝袜美腿一区二区三区| 亚洲欧洲日产国码二区| 亚洲一级二级三级在线免费观看| 亚洲bt欧美bt精品| 国模无码大尺度一区二区三区| 大白屁股一区二区视频| 91黄色在线观看| 欧美一区二区三区四区视频| 久久欧美中文字幕| 亚洲欧洲制服丝袜| 日韩激情一区二区| 国产精品1区2区3区| 色就色 综合激情| 欧美mv日韩mv国产网站| 国产精品久久久久久久蜜臀| 亚洲a一区二区| 国产不卡视频一区二区三区| 欧美日韩中文字幕一区| 国产亚洲一本大道中文在线| 亚洲欧美一区二区三区国产精品| 天堂资源在线中文精品| 国产一区二区成人久久免费影院 | 日本亚洲电影天堂| 成人av午夜电影| 日韩无一区二区| 亚洲天堂免费在线观看视频| 麻豆91精品视频| 一本一本大道香蕉久在线精品| 精品久久久久久亚洲综合网 | 欧美一级理论片| 亚洲三级电影全部在线观看高清| 久久综合综合久久综合| 色综合天天综合网国产成人综合天 | 狠狠v欧美v日韩v亚洲ⅴ| 91理论电影在线观看| 久久综合九色欧美综合狠狠 | 精品国产精品一区二区夜夜嗨| 亚洲靠逼com| 国产91精品久久久久久久网曝门 | 亚洲精品在线观看网站| 午夜视频在线观看一区二区| 91网上在线视频| 国产精品三级av| 久久99国产精品麻豆| 欧美精品久久99| 一区二区三区免费在线观看| 99这里只有精品| 久久久久久久久久久久久女国产乱 | 91啪九色porn原创视频在线观看| 久久久久久久久久久久久久久99| 免费在线看成人av| 欧美撒尿777hd撒尿| 自拍偷自拍亚洲精品播放| 国产成人午夜99999| 欧美变态凌虐bdsm| 日韩电影免费在线| 在线观看免费视频综合| 一区二区在线观看免费| 99精品久久99久久久久| 国产日韩欧美不卡在线| 国产美女在线精品| 久久久亚洲高清| 国产一区二区成人久久免费影院| 欧美成人一级视频| 久久99精品一区二区三区| 精品人伦一区二区色婷婷| 另类小说欧美激情| 欧美成人精品1314www| 麻豆精品国产91久久久久久| 在线成人av网站| 日韩成人精品在线观看| 日韩视频在线一区二区| 日韩不卡手机在线v区| 日韩女优av电影| 久久99精品久久久久| 久久综合久久鬼色中文字| 国产大片一区二区| 欧美国产在线观看| av综合在线播放| 亚洲综合视频网| 91麻豆精品国产综合久久久久久| 天堂久久久久va久久久久| 日韩你懂的在线播放| 国产一区二区三区精品欧美日韩一区二区三区 | 国产精品久久久久久户外露出| 99亚偷拍自图区亚洲| 亚洲精品水蜜桃| 777欧美精品| 国产精一品亚洲二区在线视频| 久久九九99视频| 99久久99久久免费精品蜜臀| 一区二区三区成人在线视频| 欧美美女直播网站| 精品一区二区免费在线观看| 国产亚洲欧美在线| 色屁屁一区二区| 美脚の诱脚舐め脚责91 | 久久久欧美精品sm网站| 波多野结衣在线一区| 亚洲国产成人高清精品| 欧美精品一区二区在线观看| 成人免费视频网站在线观看| 亚洲成人福利片|