亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩毛片高清在线播放| 欧美一区二区三区四区高清| 欧美激情一区二区三区全黄| 国产美女主播视频一区| 国产欧美精品一区aⅴ影院| 国产精品一区二区三区99| 国产午夜精品久久久久久免费视| 欧美日韩国产成人在线91| 日韩影院免费视频| 亚洲精品一区二区三区香蕉| 国产一区二区美女| ...中文天堂在线一区| 欧洲在线/亚洲| 麻豆免费看一区二区三区| 欧美激情一区二区三区全黄| 色先锋资源久久综合| 偷窥少妇高潮呻吟av久久免费| 日韩一级二级三级| 春色校园综合激情亚洲| 一区二区三区在线观看视频| 538prom精品视频线放| 国产91富婆露脸刺激对白| 一区二区三区在线视频观看| 日韩欧美一区二区不卡| av高清久久久| 日韩精品亚洲专区| 国产精品免费视频观看| 欧美日韩视频在线一区二区| 国产精品影音先锋| 亚洲成国产人片在线观看| 国产三级精品视频| 欧美日韩第一区日日骚| 国产成人日日夜夜| 五月天欧美精品| 国产精品美女久久久久高潮 | 日韩欧美精品在线| 国产91精品免费| 香蕉av福利精品导航| 国产精品久久久久9999吃药| 7777精品久久久大香线蕉| 99国产精品久| 国产一区二区三区免费| 亚洲一区二区三区四区中文字幕| 国产亚洲一区字幕| 欧美精品日韩精品| 91视频在线观看| 东方aⅴ免费观看久久av| 午夜精品国产更新| 一区二区三区在线高清| 国产精品丝袜一区| 精品国产制服丝袜高跟| 在线不卡欧美精品一区二区三区| 99精品久久久久久| 国产一区二三区| 免费看欧美美女黄的网站| 亚洲精品高清视频在线观看| 国产精品青草综合久久久久99| 欧美岛国在线观看| 欧美一级艳片视频免费观看| 在线日韩国产精品| 91麻豆视频网站| 成人美女视频在线观看| 国产酒店精品激情| 久草在线在线精品观看| 蜜桃av噜噜一区| 免费高清成人在线| 秋霞电影一区二区| 日本欧美在线观看| 亚洲3atv精品一区二区三区| 亚洲第一精品在线| 亚洲成在线观看| 一级中文字幕一区二区| 亚洲男人电影天堂| 日韩欧美国产wwwww| 国产成人精品午夜视频免费| 亚洲在线视频免费观看| 亚洲精品中文字幕在线观看| 亚洲欧美在线另类| 亚洲欧美日韩中文字幕一区二区三区| 国产午夜亚洲精品不卡| 国产精品美女久久久久久| 国产精品另类一区| **性色生活片久久毛片| 国产成人精品一区二区三区四区| 国产乱人伦偷精品视频免下载| 黄色日韩三级电影| 国产成人在线免费观看| 成人午夜短视频| 91美女在线视频| 在线亚洲一区二区| 欧美丰满少妇xxxbbb| 日韩免费福利电影在线观看| 久久综合中文字幕| 国产拍欧美日韩视频二区| 国产精品超碰97尤物18| 亚洲曰韩产成在线| 日本伊人精品一区二区三区观看方式 | 国产日韩欧美精品一区| 中文一区二区在线观看| 一区二区三区中文在线| 五月天一区二区| 久久国产精品99精品国产 | 日韩精品免费视频人成| 久久se这里有精品| 成人动漫av在线| 欧美性受xxxx黑人xyx| 日韩欧美国产一区二区三区 | 国产精品综合在线视频| 91亚洲国产成人精品一区二区三| 欧美性猛片aaaaaaa做受| 精品成人免费观看| 亚洲视频香蕉人妖| 青草av.久久免费一区| 国产精品一区二区在线观看不卡 | 九一九一国产精品| 成人精品视频一区| 欧美日韩精品欧美日韩精品一| 日韩欧美国产一二三区| 亚洲日本韩国一区| 九色porny丨国产精品| 高清不卡一区二区| 欧美日韩视频在线第一区 | 国产日韩成人精品| 午夜精品福利视频网站| 成人免费观看视频| 日韩午夜电影av| 亚洲欧美视频在线观看| 激情小说亚洲一区| 欧美日韩精品一区二区三区四区 | 爽好多水快深点欧美视频| 免费成人av在线播放| 国产一区三区三区| 成人国产一区二区三区精品| 欧美成人一区二区三区| 日韩欧美在线观看一区二区三区| 亚洲成av人在线观看| 国产一区二区三区最好精华液| 91蝌蚪国产九色| 一区二区三区精品在线| 久久国产欧美日韩精品| 懂色av中文字幕一区二区三区| 成人三级在线视频| 日韩精品一区二区三区三区免费| 青椒成人免费视频| 五月天国产精品| 91视视频在线观看入口直接观看www| 欧美成人a∨高清免费观看| 亚洲国产成人高清精品| 不卡一区在线观看| 久久久精品免费免费| 久久99热国产| 日韩限制级电影在线观看| 亚洲激情欧美激情| 成人黄色综合网站| 国产欧美日韩另类视频免费观看| 免费在线观看不卡| 91精品国产综合久久久蜜臀粉嫩| 亚洲黄色尤物视频| 色综合色综合色综合| 中文字幕中文字幕一区二区| 国产成人午夜电影网| 国产午夜精品久久久久久久| 久草这里只有精品视频| 精品成人免费观看| 久草精品在线观看| 久久精品夜色噜噜亚洲aⅴ| 激情综合五月天| 精品美女被调教视频大全网站| 精品在线一区二区| 26uuu久久综合| 国产精品一色哟哟哟| 亚洲国产激情av| 欧美本精品男人aⅴ天堂| 日本女人一区二区三区| 欧美成人精品3d动漫h| 九色综合国产一区二区三区| 精品国产91乱码一区二区三区 | 99精品热视频| 亚洲欧洲国产日韩| 日本高清不卡一区| 天天爽夜夜爽夜夜爽精品视频| 欧美日韩一级视频| 另类专区欧美蜜桃臀第一页| 精品国产一区二区精华| 国产jizzjizz一区二区| 亚洲欧美怡红院| 欧美性做爰猛烈叫床潮| 日产国产欧美视频一区精品| 亚洲精品一区二区三区在线观看| 粗大黑人巨茎大战欧美成人| 成人免费小视频| 欧美精品色一区二区三区| 狂野欧美性猛交blacked| 国产欧美精品国产国产专区| 一本大道综合伊人精品热热| 爽爽淫人综合网网站| 国产日韩精品一区| 欧美亚洲综合色| 久久av中文字幕片| 亚洲天堂免费在线观看视频|