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

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

?? os_task.c

?? 自已寫的lwip+ucos程序已調通
?? 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
*                       specific.  See OS_TASK_OPT_??? in uCOS-II.H.
*
* 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)
*********************************************************************************************************
*/
/*$PAGE*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕不卡在线观看| 99re这里都是精品| 制服丝袜中文字幕一区| 亚洲综合无码一区二区| 欧美亚洲禁片免费| 日韩av电影一区| 精品久久久久久综合日本欧美| 国产乱子伦视频一区二区三区| 日本一区二区三区在线不卡| 国产.精品.日韩.另类.中文.在线.播放 | 99视频一区二区三区| 亚洲欧美日韩国产另类专区| 欧美在线小视频| 天天综合色天天| 久久九九久久九九| 色偷偷88欧美精品久久久| 日一区二区三区| 久久品道一品道久久精品| 99久久婷婷国产综合精品电影| 亚洲国产一区视频| 精品成人免费观看| 91麻豆文化传媒在线观看| 日韩av在线发布| 中文字幕免费一区| 欧美激情在线一区二区三区| 色成年激情久久综合| 蜜芽一区二区三区| 中文字幕亚洲综合久久菠萝蜜| 精品视频资源站| 国产成人av网站| 午夜精品成人在线视频| 中文无字幕一区二区三区| 欧美色爱综合网| 国产福利一区二区三区在线视频| 亚洲美女电影在线| 久久久久青草大香线综合精品| 色综合天天综合网天天狠天天| 蜜桃av噜噜一区| 亚洲欧美日韩久久精品| 久久综合色之久久综合| 在线一区二区视频| 成人网男人的天堂| 蜜臀久久99精品久久久画质超高清| 国产精品久久久久久久蜜臀| 欧美一区二区大片| 色婷婷久久久久swag精品| 国产一区二三区好的| 亚洲国产三级在线| 亚洲天堂中文字幕| 国产亚洲综合在线| 欧美mv日韩mv国产网站app| 欧美中文字幕一区| 一本大道久久a久久综合| 国产69精品久久久久777| 久久99久久久久久久久久久| 亚洲成人动漫一区| 亚洲最大的成人av| 1区2区3区精品视频| 日本一区二区三区久久久久久久久不| 欧美一区二区精美| 91成人网在线| 色综合一个色综合亚洲| 成人h精品动漫一区二区三区| 国产在线看一区| 经典三级视频一区| 美女一区二区视频| 蜜桃视频一区二区| 免播放器亚洲一区| 久久精品国产第一区二区三区| 石原莉奈一区二区三区在线观看 | 成人欧美一区二区三区在线播放| 蜜臀a∨国产成人精品| 亚洲影视资源网| 一区二区三区精品视频| 一区二区三区不卡在线观看| 亚洲婷婷综合色高清在线| 中文字幕av一区二区三区免费看 | 在线成人小视频| 欧美日韩一区二区欧美激情| 在线观看国产精品网站| 91福利在线导航| 欧美色综合网站| 欧美视频第二页| 欧美日韩aaa| 91精品国产手机| 日韩精品中午字幕| 久久免费精品国产久精品久久久久| 精品久久久影院| 国产欧美日韩精品一区| 综合欧美亚洲日本| 亚洲综合一区二区精品导航| 亚洲成人7777| 麻豆国产欧美一区二区三区| 美女mm1313爽爽久久久蜜臀| 久久99精品一区二区三区| 国产风韵犹存在线视精品| 不卡的av中国片| 欧美做爰猛烈大尺度电影无法无天| 欧美亚洲国产一区在线观看网站| 欧美日韩国产片| 欧美变态tickle挠乳网站| 国产欧美日韩在线看| 亚洲视频在线一区观看| 午夜精品久久久| 国产精品影视在线| 91在线丨porny丨国产| 中文字幕一区二区视频| 亚洲一区在线观看视频| 美腿丝袜亚洲色图| 大白屁股一区二区视频| 欧美日韩免费观看一区三区| 欧美xxx久久| 亚洲品质自拍视频| 午夜婷婷国产麻豆精品| 国产乱子伦视频一区二区三区| av男人天堂一区| 日韩一级免费观看| 综合激情成人伊人| 美女一区二区在线观看| a亚洲天堂av| 日韩欧美一级在线播放| 亚洲欧美一区二区三区极速播放| 天堂一区二区在线| 成年人网站91| 精品久久久久久亚洲综合网| 亚洲欧美一区二区三区极速播放 | 精品一二三四在线| 色综合天天视频在线观看| 精品日韩一区二区三区免费视频| 国产精品第四页| 久久99久久久欧美国产| 欧美日韩免费高清一区色橹橹 | 中文天堂在线一区| 蜜桃视频在线观看一区| 日本韩国视频一区二区| 久久久无码精品亚洲日韩按摩| 亚洲综合在线免费观看| 高清国产午夜精品久久久久久| 欧美一区二区视频网站| 自拍偷拍国产精品| 国产二区国产一区在线观看| 日韩一区二区三区视频| 亚洲一区二区三区四区的| 成人少妇影院yyyy| 久久综合九色综合久久久精品综合| av电影在线不卡| 欧美精品一区二区三区很污很色的| 亚洲国产精品影院| 一本色道a无线码一区v| 国产精品嫩草久久久久| 国产一区久久久| 日韩精品一区二区三区四区视频| 亚洲综合色视频| 在线免费av一区| 亚洲精品视频免费观看| 成人av在线影院| 欧美国产乱子伦| 国产精品99久| 国产亚洲精品aa午夜观看| 麻豆国产欧美日韩综合精品二区| 欧美精品一二三四| 石原莉奈在线亚洲三区| 欧美日韩成人激情| 午夜伦欧美伦电影理论片| 欧美中文字幕亚洲一区二区va在线| 成人欧美一区二区三区| 97精品久久久久中文字幕| 亚洲素人一区二区| 日本高清不卡一区| 亚洲大片免费看| 欧美精品久久天天躁| 日韩有码一区二区三区| 欧美疯狂性受xxxxx喷水图片| 污片在线观看一区二区| 欧美精品丝袜中出| 日本成人在线一区| 日韩一区二区视频| 激情综合一区二区三区| 久久久精品日韩欧美| 国产大陆亚洲精品国产| 国产精品网站一区| 一本久久a久久精品亚洲| 亚洲激情一二三区| 欧美美女喷水视频| 麻豆成人久久精品二区三区红| 精品久久久久久亚洲综合网| 国产精品一二三四五| 国产精品高潮呻吟| 国产精品久久久久7777按摩| 91在线观看污| 亚洲五码中文字幕| 日韩三级精品电影久久久| 国产一区二区三区美女| 国产精品青草久久| 欧美三级电影网| 国产在线日韩欧美| 亚洲美女屁股眼交| 日韩视频一区二区三区在线播放| 国产福利精品一区二区| 亚洲一二三四在线|