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

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

?? os_task.c

?? 在Visual C++環境下實現uC/OS-II的移植
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2001, 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                   */
        }
        if ((ptcb = OSTCBPrioTbl[oldprio]) != (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 {
                if ((pevent = ptcb->OSTCBEventPtr) != (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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美激情综合在线| 久久精品国产99国产精品| 亚洲成人三级小说| 福利一区福利二区| 777精品伊人久久久久大香线蕉| 久久久欧美精品sm网站| 亚洲一区日韩精品中文字幕| 久久99久久99小草精品免视看| 色综合咪咪久久| 欧美激情一区在线| 国产在线视频一区二区| 欧美日韩中文字幕精品| 日韩一区日韩二区| 国产精品一区二区三区网站| 538在线一区二区精品国产| 亚洲欧美国产三级| 成人黄色片在线观看| 精品久久国产老人久久综合| 偷拍一区二区三区| 91久久精品日日躁夜夜躁欧美| 国产精品嫩草99a| 激情小说欧美图片| 欧美一区二区三区免费大片| 五月婷婷综合在线| 欧美日韩一区二区三区不卡 | 国产999精品久久久久久绿帽| 欧美裸体一区二区三区| 亚洲黄一区二区三区| 91免费视频大全| 亚洲欧美一区二区三区久本道91| 懂色av一区二区三区免费观看| 精品国内片67194| 国内精品第一页| 精品1区2区在线观看| 久久国产夜色精品鲁鲁99| 欧美一二三四区在线| 日韩激情视频网站| 日韩一区二区在线免费观看| 免费在线一区观看| 欧美tickling网站挠脚心| 精品一二线国产| 久久九九国产精品| 成人精品国产免费网站| 综合亚洲深深色噜噜狠狠网站| av在线不卡电影| 亚洲综合精品自拍| 欧美日韩色一区| 美女免费视频一区| 久久精品亚洲一区二区三区浴池 | 日韩一区二区在线免费观看| 美腿丝袜在线亚洲一区| 精品99999| 99精品热视频| 亚洲一区在线看| 日韩免费在线观看| 国产成人精品1024| 一区二区三区在线视频免费 | 欧美美女视频在线观看| 日韩国产欧美视频| 国产片一区二区| 色国产综合视频| 麻豆精品久久久| 亚洲国产精品国自产拍av| 在线免费不卡电影| 丝袜a∨在线一区二区三区不卡| 精品sm在线观看| 色8久久人人97超碰香蕉987| 日韩福利电影在线观看| 国产亚洲精品超碰| 欧美色男人天堂| 国产在线精品免费| 一区二区三区在线视频观看58| 制服.丝袜.亚洲.中文.综合| 福利视频网站一区二区三区| 亚洲一区二区三区四区中文字幕| 日韩久久免费av| 色猫猫国产区一区二在线视频| 免费高清在线一区| 亚洲狼人国产精品| 久久久久国产精品麻豆ai换脸| 91福利视频网站| 国产激情偷乱视频一区二区三区| 亚洲一区视频在线观看视频| 久久久久久久av麻豆果冻| 欧美人伦禁忌dvd放荡欲情| 国产成人精品免费看| 亚洲成在人线免费| 国产精品高潮久久久久无| 欧美一区二区二区| 色播五月激情综合网| 国产成都精品91一区二区三| 丝袜美腿亚洲一区| 亚洲色图清纯唯美| 欧美国产欧美亚州国产日韩mv天天看完整| 欧美日韩久久久久久| 91在线高清观看| 国产麻豆精品在线观看| 秋霞午夜av一区二区三区| 一区二区三区色| 中文字幕一区二区三区四区| 久久久蜜桃精品| 精品国产乱码久久久久久图片| 欧美日韩精品综合在线| 在线观看国产精品网站| 99久久综合国产精品| 国产高清精品在线| 国产曰批免费观看久久久| 日本vs亚洲vs韩国一区三区二区| 一区二区三区电影在线播| 亚洲色图一区二区三区| 国产精品全国免费观看高清| 国产亚洲成av人在线观看导航| 日韩欧美成人一区二区| 日韩一区二区视频| 91麻豆精品国产91久久久使用方法| 欧美性色黄大片| 在线观看日韩电影| 在线日韩一区二区| 欧美亚洲高清一区二区三区不卡| 色综合久久综合| 一本一道久久a久久精品| 在线观看免费一区| 欧美日韩高清在线播放| 制服丝袜亚洲网站| 欧美va天堂va视频va在线| 精品国产一区二区三区久久影院| 日韩一区二区三区四区| 精品蜜桃在线看| 国产免费久久精品| 久久久青草青青国产亚洲免观| 国产午夜亚洲精品不卡| 亚洲国产精品99久久久久久久久| 国产午夜亚洲精品理论片色戒| 欧美国产一区二区在线观看 | 日韩一区二区三| 精品国产乱码久久久久久蜜臀| 亚洲精品在线观看视频| 欧美国产日本韩| 一区二区三区四区中文字幕| 午夜精品久久久久久久蜜桃app| 日本vs亚洲vs韩国一区三区二区 | 久久久久国产成人精品亚洲午夜| 国产日韩av一区| 亚洲精品国产无套在线观| 午夜不卡av在线| 国产乱人伦偷精品视频不卡 | 亚洲国产精品二十页| 一区二区三区欧美视频| 蜜臀国产一区二区三区在线播放| 国产一区二区美女诱惑| 色www精品视频在线观看| 777xxx欧美| 中文字幕va一区二区三区| 亚洲午夜免费电影| 国产自产高清不卡| 在线观看视频一区| 久久精品一级爱片| 亚洲午夜在线视频| 国产成人日日夜夜| 欧美精品久久一区| 欧美激情综合五月色丁香| 丝袜美腿亚洲色图| av一区二区三区黑人| 欧美一级高清大全免费观看| 最新不卡av在线| 国产在线播放一区| 欧美日韩一本到| 国产精品毛片久久久久久| 免费在线观看视频一区| 99国产精品久久久| 久久久www成人免费毛片麻豆| 亚洲午夜精品一区二区三区他趣| 国产一区二区不卡老阿姨| 欧美高清dvd| 亚洲美女电影在线| 国产91精品精华液一区二区三区| 91麻豆精品国产自产在线| 亚洲精选一二三| 丁香婷婷综合五月| 精品入口麻豆88视频| 亚洲综合色在线| 不卡av免费在线观看| 26uuu国产电影一区二区| 日韩精品一二三四| 欧美影视一区二区三区| 亚洲男人的天堂网| 99天天综合性| 国产精品激情偷乱一区二区∴| 精品亚洲aⅴ乱码一区二区三区| 7777精品伊人久久久大香线蕉 | 91精品在线一区二区| 一区二区在线观看视频在线观看| 粉嫩av一区二区三区粉嫩| 久久久久成人黄色影片| 国产麻豆成人传媒免费观看| 精品久久国产字幕高潮| 九九精品一区二区| 欧美xxxxxxxxx| 狠狠色狠狠色综合系列| 精品国产伦一区二区三区免费|