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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_task.c

?? LPC2104/5/6嵌入式系統(tǒng)程序?qū)嵗?帶有PROTUES7.1仿真文件,適合做入門指導(dǎo)
?? 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.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲激情图片一区| 亚洲国产wwwccc36天堂| 色美美综合视频| 奇米精品一区二区三区四区| 国产精品蜜臀在线观看| 在线播放中文一区| 91在线观看高清| 国产一区二三区好的| 三级久久三级久久久| 亚洲视频狠狠干| 欧美成va人片在线观看| 欧美在线看片a免费观看| 粉嫩蜜臀av国产精品网站| 免费美女久久99| 亚洲精品国产a久久久久久| 日本一区二区免费在线观看视频| 91精品国模一区二区三区| 欧亚一区二区三区| 成人福利在线看| 国产精一区二区三区| 麻豆91小视频| 午夜久久久影院| 一区二区三区精品在线| 国产精品黄色在线观看| 亚洲精品一区二区在线观看| 欧美午夜视频网站| 91网上在线视频| 成人黄色777网| 国产在线不卡视频| 久久综合综合久久综合| 日本少妇一区二区| 偷拍自拍另类欧美| 亚洲成人av一区| 午夜免费久久看| 亚洲国产婷婷综合在线精品| 亚洲激情第一区| 一区二区三区欧美日| 亚洲精品美腿丝袜| 亚洲精品五月天| 一区二区三区在线免费观看 | 99久久精品免费看国产免费软件| 激情都市一区二区| 久久99精品国产麻豆婷婷| 日本欧美肥老太交大片| 日本va欧美va精品| 六月丁香婷婷久久| 老色鬼精品视频在线观看播放| 日韩高清欧美激情| 免费精品视频在线| 国产一区亚洲一区| 丰满亚洲少妇av| av不卡在线播放| 91国偷自产一区二区使用方法| 91一区二区三区在线播放| 色综合天天综合狠狠| 欧美亚洲国产bt| 91精品蜜臀在线一区尤物| 欧美xxxxxxxx| 国产色一区二区| 亚洲激情中文1区| 日韩电影免费在线看| 蓝色福利精品导航| 丁香天五香天堂综合| 91麻豆免费观看| 欧美日韩五月天| 欧美mv日韩mv| 国产亚洲精品资源在线26u| 久久久蜜桃精品| 自拍偷拍欧美精品| 日韩国产成人精品| 国产乱码一区二区三区| 9久草视频在线视频精品| 91久久精品一区二区三区| 欧美精品一二三| 久久久精品国产免费观看同学| 亚洲视频香蕉人妖| 麻豆成人久久精品二区三区红 | 欧美色中文字幕| 日韩亚洲欧美成人一区| 国产精品伦理一区二区| 午夜视黄欧洲亚洲| 风间由美性色一区二区三区| 精品视频1区2区3区| 欧美va天堂va视频va在线| 国产精品久久久久久福利一牛影视 | 国产精品1区2区3区在线观看| 91同城在线观看| 欧美大片一区二区| 亚洲视频香蕉人妖| 精品一区二区三区在线视频| 国产成人综合精品三级| 欧美日韩成人综合天天影院 | 国产三级三级三级精品8ⅰ区| 亚洲图片激情小说| 日韩国产在线观看| 国产aⅴ精品一区二区三区色成熟| 日本道色综合久久| 欧美另类高清zo欧美| 中文字幕av不卡| 日韩电影一二三区| 91国偷自产一区二区三区观看| 久久人人爽人人爽| 日韩精品欧美精品| 91丨九色丨尤物| 国产丝袜在线精品| 日本亚洲视频在线| 91亚洲精品久久久蜜桃| 26uuu亚洲综合色欧美| 亚洲一本大道在线| 91在线精品一区二区三区| 精品成人佐山爱一区二区| 亚洲成av人影院在线观看网| 成人一级黄色片| 日韩美女主播在线视频一区二区三区| 亚洲情趣在线观看| 国产成人精品影视| 日韩亚洲欧美在线| 午夜伊人狠狠久久| 日本韩国欧美一区| 亚洲手机成人高清视频| 国产成人亚洲综合a∨猫咪| 日韩三级视频在线看| 亚洲成人av电影| 欧美丝袜丝交足nylons| 一区二区成人在线视频| 97精品电影院| 中文字幕一区二区三区四区| 国产69精品久久久久毛片| 久久久久久久综合色一本| 麻豆极品一区二区三区| 日韩精品一区二区三区中文不卡 | 依依成人精品视频| www.99精品| 国产精品久久久久影院色老大| 黑人巨大精品欧美黑白配亚洲| 欧美一卡二卡在线| 免费高清成人在线| 日韩欧美亚洲国产另类 | 日本vs亚洲vs韩国一区三区二区| 欧美这里有精品| 亚洲午夜在线电影| 欧美日韩在线亚洲一区蜜芽| 亚洲国产精品嫩草影院| 精品视频在线视频| 视频一区欧美精品| 91精品国产综合久久福利| 青青草原综合久久大伊人精品 | 国产午夜精品在线观看| 国产高清精品在线| 中文字幕一区二区三区不卡在线| 成人午夜电影久久影院| 成人欧美一区二区三区| 欧洲av一区二区嗯嗯嗯啊| 亚洲h精品动漫在线观看| 制服丝袜亚洲精品中文字幕| 麻豆精品一区二区av白丝在线| 久久久久久久久久久久久久久99 | 亚洲欧洲制服丝袜| 欧美在线制服丝袜| 日韩国产欧美在线观看| 久久一夜天堂av一区二区三区 | 91精品婷婷国产综合久久| 青青草成人在线观看| 久久久久亚洲蜜桃| 99久久综合99久久综合网站| 亚洲高清一区二区三区| 精品裸体舞一区二区三区| 成人永久aaa| 亚洲444eee在线观看| 精品国产91乱码一区二区三区 | 久久超级碰视频| 国产精品蜜臀在线观看| 欧美日韩亚洲综合在线| 激情另类小说区图片区视频区| 亚洲天堂久久久久久久| 777久久久精品| 岛国精品在线观看| 亚洲精品国产a| 久久综合色综合88| 色偷偷一区二区三区| 久久99精品久久久久久国产越南 | 免费视频一区二区| 国产精品久久久久久一区二区三区| 欧美色图一区二区三区| 国产精品影视在线| 亚洲h精品动漫在线观看| 国产拍揄自揄精品视频麻豆| 欧美午夜精品理论片a级按摩| 国产伦精品一区二区三区视频青涩| 亚洲乱码日产精品bd| 精品少妇一区二区三区免费观看| av在线不卡免费看| 蜜桃久久精品一区二区| 亚洲人成小说网站色在线| 欧美r级电影在线观看| 欧美日韩亚洲高清一区二区| 99热在这里有精品免费| 国产在线视视频有精品| 午夜精品免费在线| 亚洲靠逼com|