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

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

?? os_task.c

?? ep7312- ad轉換的源碼
?? 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一区二区三区免费野_久草精品视频
国产一区二区三区不卡在线观看 | 亚洲国产成人tv| 亚洲va中文字幕| 日欧美一区二区| 国产一区二区三区在线看麻豆| 丁香一区二区三区| 欧美色成人综合| 久久免费视频一区| 亚洲一区二区偷拍精品| 另类小说综合欧美亚洲| 91免费观看在线| 欧美成人伊人久久综合网| 最新不卡av在线| 狂野欧美性猛交blacked| 一本色道亚洲精品aⅴ| 日韩欧美色综合| 一区二区三区四区不卡视频| 九一久久久久久| 欧美视频日韩视频在线观看| 亚洲精品在线观看视频| 一区二区三区在线视频观看| 国产精品乡下勾搭老头1| 欧美图片一区二区三区| 国产欧美精品一区二区色综合朱莉| 亚洲v精品v日韩v欧美v专区| 成人高清在线视频| 这里只有精品视频在线观看| 国产精品毛片久久久久久| 理论电影国产精品| 欧美在线观看你懂的| 欧美激情中文字幕| 久久av中文字幕片| 欧美日韩中文字幕一区二区| 中文字幕日韩欧美一区二区三区| 麻豆一区二区在线| 欧美日韩一区不卡| 国产精品久久久久aaaa樱花 | 久久久亚洲国产美女国产盗摄 | 在线91免费看| 亚洲人成人一区二区在线观看 | 国产精品久久久久久久久快鸭| 日本sm残虐另类| 欧美影院精品一区| 亚洲欧美色综合| caoporen国产精品视频| 精品电影一区二区三区| 日韩黄色小视频| 欧美日韩国产不卡| 一区二区三区波多野结衣在线观看| 成人高清免费在线播放| 欧美国产精品劲爆| 国产福利视频一区二区三区| 2014亚洲片线观看视频免费| 婷婷成人激情在线网| 欧美日韩一区二区三区高清| 亚洲影视在线播放| 欧美色精品在线视频| 亚洲大尺度视频在线观看| 欧美亚一区二区| 亚洲综合av网| 欧美在线观看视频一区二区三区| 亚洲裸体在线观看| 99re在线精品| 亚洲欧美另类图片小说| 99re成人在线| 亚洲色图视频免费播放| 色综合久久久久久久久久久| 亚洲欧美国产高清| 欧美又粗又大又爽| 偷拍一区二区三区| 日韩色在线观看| 精品在线亚洲视频| 精品99一区二区| 国产91精品久久久久久久网曝门| 久久天堂av综合合色蜜桃网| 国产精品自拍av| 中文av字幕一区| 91免费在线看| 亚洲成a人片在线观看中文| 欧美日韩高清不卡| 免费美女久久99| 久久一夜天堂av一区二区三区| 国产精品一区不卡| 国产精品久久久久久福利一牛影视| 91色porny在线视频| 亚洲制服丝袜av| 538prom精品视频线放| 精品午夜久久福利影院| 欧美国产综合一区二区| 日本大香伊一区二区三区| 午夜欧美在线一二页| 精品福利一区二区三区免费视频| 国产一区二区精品久久91| 国产精品免费av| 欧美亚洲一区三区| 免费成人性网站| 国产精品午夜在线| 欧美三级日本三级少妇99| 蜜臂av日日欢夜夜爽一区| 国产清纯白嫩初高生在线观看91 | ...中文天堂在线一区| 欧美性色综合网| 免费高清在线视频一区·| 国产欧美日韩三级| 在线免费观看日韩欧美| 人人精品人人爱| 久久中文字幕电影| 91麻豆精品秘密| 青青草91视频| 国产精品久久久久久久久动漫| 欧美三级韩国三级日本一级| 黄页网站大全一区二区| 亚洲视频一区二区在线| 日韩三区在线观看| 成人av免费在线播放| 亚洲成人你懂的| 久久97超碰色| 亚洲女人****多毛耸耸8| 欧美videos大乳护士334| 91浏览器打开| 久久不见久久见中文字幕免费| 国产精品白丝在线| 欧美一区二区三区免费| 99久久久国产精品| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产精品久久久久久久岛一牛影视 | 久久夜色精品国产欧美乱极品| 不卡免费追剧大全电视剧网站| 亚洲va天堂va国产va久| 国产欧美视频一区二区| 欧美伦理视频网站| 丰满少妇在线播放bd日韩电影| 亚洲成av人片| 国产精品欧美久久久久无广告| 欧美福利视频导航| av一二三不卡影片| 激情文学综合插| 亚洲一二三四久久| 中文字幕欧美激情一区| 日韩欧美国产wwwww| 在线观看免费成人| 成人精品一区二区三区四区| 捆绑变态av一区二区三区| 亚洲一本大道在线| 最新欧美精品一区二区三区| 欧美精品一区男女天堂| 欧美福利电影网| 欧美三区免费完整视频在线观看| av在线免费不卡| 国产精品亚洲一区二区三区妖精| 日精品一区二区三区| 亚洲永久精品国产| 中文字幕一区二区三区不卡| 久久久久亚洲蜜桃| 精品剧情v国产在线观看在线| 精品视频在线免费看| 91国产成人在线| 99久久99久久精品国产片果冻 | 综合久久一区二区三区| 久久久www成人免费无遮挡大片| 欧美精品第一页| 欧美色视频在线| 欧美体内she精高潮| 91片黄在线观看| 99久久婷婷国产综合精品电影 | 亚洲男人的天堂av| 国产精品人人做人人爽人人添| 欧美精品一区二区久久久| 日韩一区二区三区四区| 日韩亚洲国产中文字幕欧美| 欧美日韩国产小视频在线观看| 欧美在线视频你懂得| 91福利社在线观看| 在线观看亚洲a| 欧洲人成人精品| 精品污污网站免费看| 欧美日韩激情一区二区三区| 欧美日韩一级二级| 欧美精三区欧美精三区 | 伦理电影国产精品| 久久99精品国产91久久来源| 美女视频一区在线观看| 美女高潮久久久| 久久精品99国产国产精| 国内精品第一页| 风间由美一区二区av101| 成人app在线观看| 成人av在线影院| 91猫先生在线| 欧美性色黄大片| 91精品国产黑色紧身裤美女| 日韩精品一区二区三区在线播放 | 粉嫩aⅴ一区二区三区四区五区| 国产精品羞羞答答xxdd | 亚洲国产wwwccc36天堂| 亚洲成人福利片| 麻豆一区二区三| 福利电影一区二区三区| 91最新地址在线播放| 欧美日韩一区二区三区高清|