亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美精品xxxxbbbb| 国产成人精品一区二| 欧美色图12p| 无吗不卡中文字幕| 欧美一级生活片| 久久99久久99| 中文字幕国产一区二区| 99久久国产综合精品麻豆| 亚洲你懂的在线视频| 欧美日韩国产免费一区二区| 午夜激情久久久| 精品三级在线看| 国产一区二区三区在线观看精品 | 国产精品每日更新| 风间由美一区二区三区在线观看 | 成人美女视频在线观看18| 亚洲天天做日日做天天谢日日欢 | 亚洲卡通欧美制服中文| 欧美日本国产一区| 国产麻豆精品95视频| 亚洲欧美激情视频在线观看一区二区三区 | 2020国产精品自拍| 99精品国产热久久91蜜凸| 亚洲h精品动漫在线观看| 欧美va亚洲va香蕉在线| jizz一区二区| 日本欧美加勒比视频| 国产欧美一区二区在线| 欧美一a一片一级一片| 国产尤物一区二区在线| 一区二区三区丝袜| 欧美不卡一二三| 色嗨嗨av一区二区三区| 精品午夜一区二区三区在线观看| 亚洲人成亚洲人成在线观看图片| 欧美一区二区三区爱爱| 99久久免费国产| 久久成人免费网| 久久久久久影视| 欧美日韩在线播| 成人短视频下载| 蜜臀精品一区二区三区在线观看| 欧美国产日产图区| 日韩一区二区免费在线电影| 97精品久久久午夜一区二区三区 | 亚洲精品日产精品乱码不卡| 337p日本欧洲亚洲大胆精品| 欧美午夜视频网站| 94色蜜桃网一区二区三区| 九九九久久久精品| 亚洲sss视频在线视频| 亚洲婷婷综合色高清在线| 久久久精品综合| 91精品婷婷国产综合久久| 欧美专区日韩专区| 97久久超碰国产精品电影| 国产成人精品免费在线| 久久成人免费日本黄色| 日韩在线一区二区三区| 亚洲一区二区三区爽爽爽爽爽| 国产女主播在线一区二区| 欧美变态凌虐bdsm| 日韩视频中午一区| 91精品蜜臀在线一区尤物| 欧美日韩一本到| 欧美色图激情小说| 欧美色综合网站| 欧美一级淫片007| 欧美一区二区三区四区高清| 欧美日韩亚洲另类| 欧美三级一区二区| 欧美日韩久久久| 欧美日高清视频| 欧美高清激情brazzers| 欧美久久一区二区| 欧美精品99久久久**| 欧美夫妻性生活| 欧美一区二区在线播放| 日韩限制级电影在线观看| 欧美一区二区不卡视频| 欧美一区二区黄色| 欧美人牲a欧美精品| 欧美人xxxx| 欧美一区二区三区视频免费| 欧美一级生活片| 日韩美女视频一区二区在线观看| 777午夜精品视频在线播放| 欧美日韩一本到| 337p亚洲精品色噜噜狠狠| 6080午夜不卡| 欧美成人性福生活免费看| 亚洲精品一区二区三区影院 | 成人午夜在线播放| 成人h版在线观看| 92精品国产成人观看免费| 91国内精品野花午夜精品| 欧美色涩在线第一页| 在线不卡免费欧美| 欧美成人免费网站| 国产亚洲一区字幕| 最新欧美精品一区二区三区| 亚洲自拍偷拍网站| 久久99国产精品尤物| 成人在线综合网| 欧日韩精品视频| 91精品蜜臀在线一区尤物| 久久久久久久精| 亚洲免费av高清| 蜜臀av在线播放一区二区三区| 国产最新精品精品你懂的| 99久久99久久久精品齐齐| 欧美午夜寂寞影院| 精品欧美一区二区在线观看| 国产精品久久久久久久久晋中| 亚洲自拍偷拍欧美| 国内外精品视频| 色综合一区二区| 欧美成人乱码一区二区三区| 国产精品久久综合| 日韩国产精品91| 成人av资源站| 日韩一区二区在线观看视频 | 午夜私人影院久久久久| 国产毛片精品视频| 欧美四级电影网| 久久精品亚洲国产奇米99| 亚洲成精国产精品女| 丁香五精品蜜臀久久久久99网站| 精品视频在线免费| 国产精品乱码一区二三区小蝌蚪| 亚洲电影一级片| 成人h动漫精品一区二| 欧美大片一区二区三区| 一区二区三区成人| 国产xxx精品视频大全| 制服丝袜亚洲精品中文字幕| 亚洲欧洲精品成人久久奇米网 | 国内精品自线一区二区三区视频| 色先锋aa成人| 国产日产亚洲精品系列| 日本亚洲三级在线| 色婷婷久久久亚洲一区二区三区 | 成人av资源网站| 久久综合999| 日本最新不卡在线| 一本大道久久a久久综合| 国产午夜精品久久久久久免费视| 日本aⅴ亚洲精品中文乱码| 色婷婷激情综合| 一色屋精品亚洲香蕉网站| 韩国av一区二区三区| 日韩一级大片在线| 日韩在线一二三区| 欧美日韩国产综合视频在线观看| 亚洲人吸女人奶水| 风流少妇一区二区| 久久久久久97三级| 韩国成人精品a∨在线观看| 51精品久久久久久久蜜臀| 亚洲一区二区精品视频| 91色乱码一区二区三区| 中文欧美字幕免费| 成人免费观看视频| 国产精品―色哟哟| 成人h版在线观看| 国产精品乱码一区二三区小蝌蚪| 国产成人av影院| 国产欧美精品一区二区三区四区 | 中文字幕在线观看一区| 粉嫩aⅴ一区二区三区四区五区| 久久午夜羞羞影院免费观看| 久久福利资源站| 2020国产精品久久精品美国| 国产精品一级在线| 久久免费偷拍视频| 成人在线综合网站| 亚洲人成伊人成综合网小说| 色哟哟欧美精品| 亚洲国产一区二区视频| 欧美日韩不卡一区| 久久超级碰视频| 久久久综合视频| www.在线欧美| 一区二区三区四区蜜桃| 欧美人xxxx| 精品一区二区精品| 国产欧美一区二区精品忘忧草 | 亚洲一二三四区不卡| 欧美日本韩国一区| 久久国产精品无码网站| 欧美激情自拍偷拍| 色激情天天射综合网| 日韩av中文字幕一区二区| 欧美成人精品1314www| 国产福利一区二区| 亚洲精品成人在线| 日韩精品一区在线| 成人理论电影网| 午夜精品久久久久久久99樱桃| 91精品国产综合久久福利软件|