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

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

?? os_task.c

?? 一共40M 不能貼在論壇中。絕對好東西。要得話留下email
?? 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) reentrant
{
#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
*
*              ppdata   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 'ppdata' as follows:
*
*                           void Task (void *ppdata)
*                           {
*                               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) reentrant, void *ppdata, OS_STK *ptos, INT8U prio) reentrant
{
#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, ppdata, 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
*
*              ppdata   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 *ppdata)
*                           {
*                               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一区二区三区免费野_久草精品视频
成人h精品动漫一区二区三区| 国产精品色在线| 26uuu国产一区二区三区| 久久久国际精品| 亚洲久本草在线中文字幕| 青青草97国产精品免费观看无弹窗版| 男女激情视频一区| jlzzjlzz欧美大全| 欧美精品乱码久久久久久按摩| 精品久久久久久综合日本欧美| 自拍偷在线精品自拍偷无码专区| 日韩黄色在线观看| 成人av在线资源网| 538prom精品视频线放| 国产目拍亚洲精品99久久精品| 亚洲观看高清完整版在线观看| 国内精品视频666| 欧美性色欧美a在线播放| 国产亚洲成av人在线观看导航| 一区二区三区免费| 国产精品中文字幕一区二区三区| 欧美视频日韩视频在线观看| 国产欧美一区二区三区鸳鸯浴| 丝袜美腿亚洲一区二区图片| 成人中文字幕电影| 91精品国产91久久久久久最新毛片| 国产蜜臀av在线一区二区三区| 日韩激情一二三区| 日本高清不卡视频| 国产肉丝袜一区二区| 免费看欧美美女黄的网站| 色综合一区二区| 国产色爱av资源综合区| 日韩中文字幕区一区有砖一区 | 精品国产乱码久久久久久1区2区| 亚洲欧美日韩国产手机在线| 黑人巨大精品欧美一区| 8x8x8国产精品| 亚洲精品视频在线看| 国产aⅴ精品一区二区三区色成熟| 制服丝袜av成人在线看| 一区二区欧美国产| 成人av小说网| 国产欧美一区二区精品忘忧草| 日韩精品电影在线观看| 亚洲www啪成人一区二区麻豆| 日韩和的一区二区| 91久久线看在观草草青青| 国产女同性恋一区二区| 国产麻豆精品久久一二三| 日韩欧美中文字幕制服| 无码av免费一区二区三区试看 | 一区二区三区久久| 成人ar影院免费观看视频| 国产日韩欧美精品一区| 久久成人免费电影| 91精品国产福利在线观看| 亚洲午夜av在线| 欧美中文字幕一二三区视频| 亚洲欧美日韩系列| 99精品国产99久久久久久白柏| 亚洲国产精品v| 国产精选一区二区三区| 久久免费视频色| 国模套图日韩精品一区二区| 欧美成人伊人久久综合网| 青草av.久久免费一区| 日韩一级片在线观看| 美女视频网站久久| 精品欧美乱码久久久久久| 久久精品国产精品亚洲红杏| 日韩免费视频一区| 国内精品不卡在线| 国产亚洲精品超碰| 粉嫩av亚洲一区二区图片| 国产精品色婷婷| 91欧美一区二区| 亚洲精品免费在线| 欧美色图免费看| 天天影视涩香欲综合网| 欧美一区二区三区不卡| 麻豆国产91在线播放| 2023国产一二三区日本精品2022| 国模一区二区三区白浆 | 99国产欧美久久久精品| 亚洲日本一区二区| 欧美三级视频在线观看| 日韩av中文在线观看| 精品国产露脸精彩对白| 成人一道本在线| 综合网在线视频| 欧美特级限制片免费在线观看| 亚洲.国产.中文慕字在线| 91精品国产色综合久久| 精品一区二区三区免费| 国产亚洲欧美日韩俺去了| 99久久婷婷国产综合精品| 亚洲自拍欧美精品| 精品久久久久久久久久久久久久久| 国产福利一区二区三区在线视频| 亚洲日本乱码在线观看| 欧美丰满一区二区免费视频| 精品无人码麻豆乱码1区2区| 国产精品久久毛片av大全日韩| 欧美视频一区在线| 国产裸体歌舞团一区二区| 久久久久久久久久久99999| 三级久久三级久久| 久久久久99精品国产片| aaa亚洲精品| 日韩中文字幕区一区有砖一区 | 国产成a人亚洲| 亚洲色欲色欲www在线观看| 欧美日韩aaaaa| 国产一区二区三区四| 亚洲视频免费观看| 日韩视频一区在线观看| thepron国产精品| 美女网站色91| 亚洲免费观看高清| 精品国产免费久久| 色丁香久综合在线久综合在线观看| 蜜桃精品在线观看| 亚洲色图制服诱惑| 精品久久国产字幕高潮| 99精品1区2区| 激情图片小说一区| 亚洲成a人v欧美综合天堂| 国产亚洲一区二区三区在线观看 | 日韩成人精品视频| 国产精品久久免费看| 日韩精品中文字幕一区| 91丨九色丨蝌蚪富婆spa| 精品一区二区三区在线视频| 一区2区3区在线看| 日本一区二区三区电影| 日韩午夜电影在线观看| 色吧成人激情小说| 东方欧美亚洲色图在线| 日韩制服丝袜av| 亚洲最新视频在线观看| 国产精品人妖ts系列视频| 日韩欧美国产不卡| 欧美日本一区二区| av中文一区二区三区| 国产一区二区精品在线观看| 琪琪一区二区三区| 亚洲电影一区二区| 亚洲精品欧美专区| 国产精品久久看| 精品久久国产老人久久综合| 欧美精品在线观看一区二区| 一本大道久久a久久综合婷婷| 国产成人丝袜美腿| 精品一区二区三区香蕉蜜桃| 免费成人av在线播放| 性做久久久久久久久| 一区二区三区国产精华| 日韩伦理免费电影| 自拍偷拍亚洲激情| 国产精品素人一区二区| 国产日产亚洲精品系列| 久久色视频免费观看| 欧美videos中文字幕| 337p亚洲精品色噜噜噜| 欧美日韩在线播放三区四区| 色视频欧美一区二区三区| gogo大胆日本视频一区| 成人午夜视频免费看| 成人精品亚洲人成在线| 成人免费va视频| av一二三不卡影片| 成人免费视频视频| 成人免费黄色在线| 99在线精品一区二区三区| 成人永久免费视频| www.日韩大片| 91欧美一区二区| 在线视频国内一区二区| 在线影院国内精品| 欧美在线观看视频一区二区三区| 色综合一个色综合| 在线中文字幕一区| 91 com成人网| 欧美大白屁股肥臀xxxxxx| 久久伊人蜜桃av一区二区| 2020国产成人综合网| 亚洲国产高清在线| 综合久久久久久| 亚洲午夜电影网| 青青青伊人色综合久久| 久久av资源网| 国产福利不卡视频| 成人黄色电影在线| 色噜噜狠狠成人中文综合| 欧美日韩在线综合| 日韩精品专区在线影院重磅| 久久久久国产免费免费| 国产精品国产三级国产专播品爱网 | 亚洲一区二区三区视频在线|