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

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

?? os_task.c

?? LPC2104/5/6嵌入式系統(tǒng)程序?qū)嵗?帶有PROTUES7.1仿真文件,適合做入門指導(dǎo)
?? C
?? 第 1 頁 / 共 3 頁
字號(hào):
/*
*********************************************************************************************************
*                                                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
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av电影一区二区| 在线精品视频小说1| 一区二区在线看| 精品日韩在线观看| 91毛片在线观看| 国产一区在线不卡| 石原莉奈在线亚洲三区| 国产精品免费av| 亚洲精品一区在线观看| 欧美日韩精品综合在线| av不卡在线播放| 国产成人综合在线观看| 人妖欧美一区二区| 亚洲大尺度视频在线观看| 国产精品久久99| 久久精品人人做| 精品久久久久一区| 88在线观看91蜜桃国自产| 色偷偷一区二区三区| 国产精品18久久久久久久网站| 日本大胆欧美人术艺术动态| 亚洲一区二区三区四区在线| 亚洲蜜臀av乱码久久精品蜜桃| 欧美激情在线看| 国产日韩成人精品| 国产亚洲精品bt天堂精选| 日韩一区二区不卡| 日韩区在线观看| 日韩午夜精品视频| 日韩一区二区三| 欧美精品v日韩精品v韩国精品v| 一本大道久久精品懂色aⅴ| www.日韩精品| 91在线小视频| 91亚洲男人天堂| 99re热视频这里只精品| www.色综合.com| 91老司机福利 在线| 91丨九色丨蝌蚪丨老版| 一本一道久久a久久精品| 99re热这里只有精品视频| av不卡在线观看| 色狠狠桃花综合| 欧美自拍偷拍一区| 欧美男同性恋视频网站| 欧美羞羞免费网站| 在线播放91灌醉迷j高跟美女| 欧美乱熟臀69xxxxxx| 日韩一区二区在线观看视频播放| 欧美一区二区二区| 精品国产91亚洲一区二区三区婷婷 | 国产精品资源在线| 国产成人午夜精品5599| 成人黄色av电影| 一本一本久久a久久精品综合麻豆| 色域天天综合网| 欧美人与禽zozo性伦| 日韩美女在线视频 | 久久精品一区蜜桃臀影院| 中文一区一区三区高中清不卡| 中文字幕一区二区三区精华液| 亚洲女子a中天字幕| 亚洲bdsm女犯bdsm网站| 麻豆精品久久久| 成人午夜视频网站| 色94色欧美sute亚洲线路一久| 欧美男女性生活在线直播观看| 欧美一二三区在线| 国产精品久久午夜| 亚洲成av人片一区二区| 九九精品一区二区| av中文字幕一区| 欧美日韩的一区二区| 国产午夜久久久久| 亚洲一二三四久久| 国内成+人亚洲+欧美+综合在线| 成人动漫一区二区在线| 7777精品伊人久久久大香线蕉 | 久久老女人爱爱| 亚洲日韩欧美一区二区在线| 日韩黄色在线观看| 粉嫩欧美一区二区三区高清影视 | 91精品欧美综合在线观看最新| 久久九九久久九九| 亚洲一区二区av在线| 国产成人午夜视频| 3atv在线一区二区三区| 国产日本欧美一区二区| 五月综合激情网| 国产一区视频在线看| 欧美挠脚心视频网站| 国产精品乱码一区二区三区软件| 午夜日韩在线电影| 成人福利视频在线| 精品国产自在久精品国产| 一区二区三区产品免费精品久久75| 久草中文综合在线| 欧美日韩视频不卡| 中文字幕在线观看不卡| 久久精品国产秦先生| 欧美日韩一区三区| 日韩毛片高清在线播放| 国产一区二区0| 欧美一级欧美一级在线播放| 亚洲人成人一区二区在线观看| 久久99久久精品欧美| 欧美三级欧美一级| 亚洲欧美自拍偷拍| 国产高清成人在线| 日韩欧美在线1卡| 亚洲国产一区视频| 色国产综合视频| 欧美激情在线免费观看| 国产一区二区导航在线播放| 日韩一区二区免费视频| 五月综合激情婷婷六月色窝| 欧美主播一区二区三区| 亚洲天堂中文字幕| 成人国产精品免费网站| 欧美激情一区在线| 国产精品123区| wwww国产精品欧美| 久久97超碰国产精品超碰| 日韩视频免费观看高清在线视频| 亚洲一区二区在线视频| 一本大道久久a久久综合婷婷| 国产精品乱人伦| 成人av高清在线| 中文字幕亚洲精品在线观看| 成人一级视频在线观看| 中文字幕成人av| 高清beeg欧美| 国产免费成人在线视频| 高清国产午夜精品久久久久久| 久久久久久久久久久99999| 国产一区二区看久久| 久久婷婷综合激情| 国产黄色91视频| 欧美国产日韩在线观看| 成人黄色大片在线观看| 最新欧美精品一区二区三区| 91美女在线看| 亚洲成人先锋电影| 日韩视频免费直播| 国产麻豆日韩欧美久久| 中文字幕精品一区二区三区精品| 成人精品免费看| 综合中文字幕亚洲| 色88888久久久久久影院按摩| 亚洲第一激情av| 日韩区在线观看| 成人免费观看男女羞羞视频| 中文字幕亚洲电影| 在线观看www91| 久久精品国产亚洲a| 国产视频一区二区在线观看| 99精品黄色片免费大全| 夜夜精品视频一区二区 | 精品国产网站在线观看| 国产成人av一区二区三区在线 | 国产精品 欧美精品| 亚洲三级视频在线观看| 7777精品伊人久久久大香线蕉超级流畅| 美腿丝袜亚洲综合| 中文字幕乱码久久午夜不卡| 色噜噜狠狠成人中文综合| 免费看日韩a级影片| 欧美国产日本视频| 91国产免费看| 美国av一区二区| 综合网在线视频| 日韩亚洲欧美成人一区| jlzzjlzz国产精品久久| 天堂av在线一区| 亚洲国产精品成人久久综合一区| 欧美亚洲综合网| 国产精品99久| 亚洲影院理伦片| 精品国产免费视频| 欧美在线观看视频一区二区三区| 蜜芽一区二区三区| 国产精品久久久久久久久免费樱桃 | 成人av动漫网站| 日本欧美肥老太交大片| 亚洲欧洲精品一区二区精品久久久 | 日韩色视频在线观看| 一本久道久久综合中文字幕 | 91久久国产综合久久| 国产中文字幕精品| 偷窥少妇高潮呻吟av久久免费| 久久先锋影音av鲁色资源网| 欧美三级欧美一级| 99久久国产综合精品色伊| 久久精品国产亚洲5555| 亚洲一区二区四区蜜桃| 亚洲国产成人午夜在线一区| 日韩免费福利电影在线观看| 欧美性猛交xxxx乱大交退制版 | 国模套图日韩精品一区二区| 亚洲一区二区黄色|