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

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

?? os_task.c

?? ADS下ARM7lpc21xx的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 "Ucos Core\\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)KCREENTRANT
{
#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
*
*              pdat    is a pointer to an optional dat 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 'pdat' as follows:
*
*                           void Task (void *pdat)
*                           {
*                               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 *pdat, OS_STK *ptos, INT8U prio)KCREENTRANT
{
#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, pdat, ptos, 0);    /* Initialize the task's stack         */
        psp = (OS_STK *)OSTaskStkInit(task, pdat, ptos, prio);    /* 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
*
*              pdat    is a pointer to an optional dat 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 'pdat' as follows:
*
*                           void Task (void *pdat)
*                           {
*                               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' dat 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' dat 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一区二区三区免费野_久草精品视频
亚洲欧美aⅴ...| 日本欧美一区二区三区乱码| 亚洲大片免费看| 国产一区二区三区免费观看| 91电影在线观看| 亚洲国产精华液网站w| 青青草原综合久久大伊人精品优势| 亚洲视频你懂的| 国内成人精品2018免费看| 欧美视频在线观看一区| 国产精品色哟哟| 国产乱码精品一区二区三区五月婷| 在线观看欧美精品| 亚洲欧洲制服丝袜| 成人短视频下载| 国产日韩欧美亚洲| 国产福利一区二区三区视频在线 | 视频一区二区中文字幕| www.亚洲激情.com| 国产亚洲一区二区三区四区 | 精品国产免费一区二区三区香蕉| 亚洲精品国产一区二区精华液| 国产成人亚洲综合色影视| 日韩欧美一区二区三区在线| 日韩二区在线观看| 3d动漫精品啪啪1区2区免费 | 制服.丝袜.亚洲.另类.中文| 一级做a爱片久久| 91麻豆123| 亚洲制服丝袜av| 欧洲国内综合视频| 午夜精品久久久久久久99水蜜桃 | 久久精品国产99国产精品| 欧美美女网站色| 青青草国产精品亚洲专区无| 欧美三级在线播放| 午夜精品久久久| 欧美mv和日韩mv国产网站| 日本成人超碰在线观看| 日韩欧美精品在线视频| 国产一区二区精品久久91| 久久久99精品久久| av影院午夜一区| 亚洲精品国产第一综合99久久| 色八戒一区二区三区| 亚洲国产va精品久久久不卡综合 | 欧美韩国日本不卡| 91在线小视频| 亚洲第一成人在线| 日韩精品一区二区三区中文不卡| 久久av中文字幕片| 国产精品无遮挡| 欧洲精品一区二区| 日本午夜一区二区| 欧美国产精品v| 在线亚洲欧美专区二区| 免费久久99精品国产| 久久精品免视看| 欧洲日韩一区二区三区| 麻豆成人91精品二区三区| 欧美激情在线一区二区三区| 欧美中文字幕一区二区三区 | 国产欧美一区二区精品性色超碰| 成人av在线播放网站| 午夜视频在线观看一区二区| 精品国产三级a在线观看| 一本大道久久a久久精二百 | jlzzjlzz亚洲日本少妇| 亚洲午夜久久久久久久久久久| 日韩一区二区三区视频在线| av电影天堂一区二区在线观看| 无码av中文一区二区三区桃花岛| 久久久久久影视| 91福利社在线观看| 国产精品1区二区.| 亚洲va国产天堂va久久en| 欧美精品一区二区三区蜜臀| 色88888久久久久久影院野外| 青青草国产成人99久久| 亚洲欧洲精品一区二区精品久久久| 欧美群妇大交群的观看方式| 顶级嫩模精品视频在线看| 婷婷夜色潮精品综合在线| 中文字幕精品一区二区三区精品| 欧美日韩国产高清一区二区三区 | 丝袜美腿一区二区三区| 日本一区二区综合亚洲| 91精品国产入口| 色综合久久88色综合天天6| 国产麻豆91精品| 毛片av中文字幕一区二区| 一区二区三区在线免费视频| 国产欧美日韩在线| 久久综合色一综合色88| 91精品综合久久久久久| 91麻豆国产香蕉久久精品| 国产激情视频一区二区在线观看| 日本美女一区二区三区视频| 亚洲一区二区av电影| 国产精品人成在线观看免费| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 91亚洲国产成人精品一区二区三 | 国产在线精品一区二区夜色 | 欧美不卡在线视频| 欧美日韩精品一区二区三区| 91福利在线看| 欧美亚洲图片小说| 99久久国产综合精品色伊| 国产不卡视频一区| 国产成人精品1024| 国产jizzjizz一区二区| 国产久卡久卡久卡久卡视频精品| 久久电影国产免费久久电影| 久久国内精品视频| 精品中文字幕一区二区| 激情综合亚洲精品| 国产999精品久久| 91在线观看污| 欧美中文字幕一区| 欧美久久久久久久久久| 91精品国产91久久久久久一区二区 | 精品99久久久久久| 久久久国产一区二区三区四区小说| 精品久久久久久无| 国产片一区二区三区| 日本一区二区电影| 国产精品乱码一区二区三区软件 | 中文字幕免费一区| 日韩一区中文字幕| 亚洲一区二区精品久久av| 亚洲gay无套男同| 久久99久久99小草精品免视看| 激情都市一区二区| 成年人午夜久久久| 欧美三电影在线| 精品国产一区二区三区av性色| 久久综合999| 亚洲久草在线视频| 免费高清在线一区| 成人av中文字幕| 欧洲人成人精品| 精品国产一区二区三区不卡| ●精品国产综合乱码久久久久| 午夜精品aaa| 成人丝袜高跟foot| 欧美视频在线观看一区二区| 久久午夜色播影院免费高清| 中文字幕亚洲电影| 日韩不卡一区二区| jizzjizzjizz欧美| 7777精品伊人久久久大香线蕉超级流畅 | 国产麻豆精品久久一二三| 91女厕偷拍女厕偷拍高清| 欧美一区二区三区在线观看| 久久精品视频在线看| 亚洲亚洲人成综合网络| 精品一区二区在线看| 91啦中文在线观看| 久久影院电视剧免费观看| 亚洲人精品午夜| 精品在线免费观看| 欧美影院精品一区| 久久精品一区二区三区不卡| 天天射综合影视| 91原创在线视频| 久久精品网站免费观看| 日韩av电影免费观看高清完整版| 成人精品小蝌蚪| 精品成人佐山爱一区二区| 亚洲国产欧美在线| 成人免费视频播放| 欧美精品一区二区三区视频 | 99免费精品视频| 精品国产一区二区亚洲人成毛片| 一区二区三区精品视频在线| 夫妻av一区二区| 精品国产乱码久久久久久久久 | 日韩一级二级三级| 亚洲午夜免费电影| 色综合久久99| 日韩美女精品在线| 成人伦理片在线| 国产日韩欧美制服另类| 精品一区二区三区视频在线观看| 欧美日韩精品是欧美日韩精品| 亚洲精品视频在线观看免费| 成人一区二区三区中文字幕| 2023国产精华国产精品| 久久精品国产精品亚洲红杏 | 一区二区三区免费看视频| 成人国产精品视频| 欧美激情一区二区三区蜜桃视频| 美女一区二区三区在线观看| 91麻豆精品国产91久久久久久久久 | 亚洲无人区一区| 在线观看免费一区| 一级精品视频在线观看宜春院 | 色94色欧美sute亚洲线路二 | 一区二区欧美国产| 色999日韩国产欧美一区二区|