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

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

?? os_task.c

?? ucosII for ARM4510B
?? 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)
{
    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.
*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美三级中文字幕在线观看| 欧美色爱综合网| 99在线精品免费| 欧美日韩成人综合| 国产精品久久久久7777按摩 | 欧美三级视频在线| 久久精品视频免费| 免费在线观看不卡| 在线视频一区二区三区| 中文字幕欧美激情| 国模少妇一区二区三区| 91精品麻豆日日躁夜夜躁| 亚洲视频一区在线观看| 福利一区福利二区| 久久伊人中文字幕| 韩国三级在线一区| 日韩精品一区二区三区在线 | 欧美在线观看视频一区二区| 国产午夜精品一区二区三区嫩草| 亚洲国产aⅴ成人精品无吗| 99精品视频在线免费观看| 国产午夜精品久久久久久久| 秋霞影院一区二区| 日韩一区二区免费在线电影| 天天影视涩香欲综合网| 欧美三级电影一区| 亚洲第一狼人社区| 欧美日韩在线综合| 日韩中文字幕91| 3atv一区二区三区| 麻豆精品一区二区av白丝在线| 欧美狂野另类xxxxoooo| 日韩av电影天堂| 国产精品毛片高清在线完整版| 国产成人精品影视| 国产精品―色哟哟| 91麻豆国产在线观看| 综合婷婷亚洲小说| 欧美偷拍一区二区| 无码av中文一区二区三区桃花岛| 欧美三区在线观看| 日韩精品电影在线观看| 精品精品国产高清a毛片牛牛 | 91美女福利视频| 亚洲精品视频在线| 欧美日本一道本在线视频| 日韩电影免费在线| 久久久久久夜精品精品免费| 国产盗摄视频一区二区三区| 国产精品久久福利| 欧美日韩亚洲综合在线 | 欧美精品一区二区三区四区 | 在线视频欧美精品| 日韩一区欧美二区| 亚洲精品一线二线三线无人区| 国内不卡的二区三区中文字幕 | 国产日韩视频一区二区三区| 国产成人精品一区二区三区四区| 中文字幕日本不卡| 欧美一级免费观看| 国产成人在线网站| 亚洲国产成人porn| 国产亚洲一区二区在线观看| 在线观看日韩精品| 国产一区二区在线看| 亚洲精品伦理在线| 2021国产精品久久精品 | 成人综合在线视频| 爽好久久久欧美精品| 久久网站热最新地址| 欧美日韩在线不卡| 国产激情91久久精品导航| 午夜精品福利一区二区三区av| 国产视频一区二区在线| 欧美日韩色综合| 粗大黑人巨茎大战欧美成人| 亚洲欧美日韩中文播放| 欧美日韩国产一级| 国产一区激情在线| 天天操天天综合网| 国产欧美一区二区三区在线看蜜臀| 99免费精品在线观看| 日本午夜一区二区| 国产精品色噜噜| 欧美一区二区私人影院日本| 国内精品国产成人国产三级粉色| 国产精品久久久久久久久快鸭| 欧美日韩国产精品自在自线| 国产精品亚洲а∨天堂免在线| 亚洲永久精品大片| 久久久久久电影| 欧美三区在线视频| 日韩欧美在线网站| 韩国v欧美v亚洲v日本v| 亚洲综合久久久| 中文字幕欧美日韩一区| 欧美丰满少妇xxxxx高潮对白| 国产高清不卡一区| 一区二区三区精品视频在线| 中文字幕第一区综合| 日韩欧美高清dvd碟片| 91麻豆国产福利在线观看| 国产一区视频导航| 天天综合日日夜夜精品| 成人欧美一区二区三区小说| 久久久国产精品午夜一区ai换脸| 欧美日韩激情一区| 99riav久久精品riav| 国产另类ts人妖一区二区| 亚洲成a天堂v人片| 成人免费一区二区三区视频| 欧美美女直播网站| 91精品国产综合久久精品麻豆| 一本久久综合亚洲鲁鲁五月天| 国产成人小视频| 蓝色福利精品导航| 日本视频中文字幕一区二区三区| 亚洲狠狠丁香婷婷综合久久久| 欧美片网站yy| 日韩午夜激情电影| 69p69国产精品| 在线视频中文字幕一区二区| 成人午夜免费电影| 国产在线不卡一区| 蜜桃免费网站一区二区三区| 天堂va蜜桃一区二区三区| 亚洲国产一区二区a毛片| 图片区小说区区亚洲影院| 亚洲精品美腿丝袜| 一区二区理论电影在线观看| 亚洲精品成人在线| 亚洲一区二区三区在线| 国产欧美一区二区精品仙草咪| 亚洲欧洲日产国码二区| ●精品国产综合乱码久久久久 | 欧美日韩一级片在线观看| 日本精品一区二区三区四区的功能| 97久久精品人人做人人爽| 在线观看网站黄不卡| 欧美三级在线视频| 91精品国产色综合久久| 欧美va亚洲va国产综合| 2020国产精品| 麻豆国产91在线播放| 亚洲裸体在线观看| 蜜臀av在线播放一区二区三区| 久久精品99国产精品日本| 韩国理伦片一区二区三区在线播放| 国模少妇一区二区三区| 国产91对白在线观看九色| 在线欧美一区二区| 欧美精三区欧美精三区| 日韩无一区二区| 国产日韩欧美制服另类| 亚洲欧洲综合另类| 天天综合色天天综合色h| 国内精品嫩模私拍在线| 成人午夜视频在线| 91久久免费观看| 欧美成人高清电影在线| 91精品在线观看入口| 久久久精品中文字幕麻豆发布| 国产精品国产三级国产aⅴ无密码| 亚洲一区二区三区视频在线| 国产成人丝袜美腿| 欧美四级电影网| 久久久午夜电影| 一区二区三区国产精华| 国产一区二区免费看| 欧日韩精品视频| 亚洲精品一线二线三线无人区| 亚洲一区二区不卡免费| 国产激情偷乱视频一区二区三区| 91丝袜美女网| 欧美va亚洲va| 亚洲卡通欧美制服中文| 高清在线成人网| 欧美日韩另类一区| 国产欧美精品一区| 日韩激情视频在线观看| 欧美亚洲国产一区二区三区va| 久久亚洲一区二区三区四区| 亚洲香蕉伊在人在线观| 福利电影一区二区| 91国在线观看| 亚洲精品视频观看| 国产精品羞羞答答xxdd| 欧美高清www午色夜在线视频| 中文字幕在线观看一区| 国产成人在线色| 日韩三级视频在线看| 亚洲超碰97人人做人人爱| gogogo免费视频观看亚洲一| 日韩欧美国产三级| 狠狠狠色丁香婷婷综合激情| 欧美日韩日日夜夜| 亚洲美女区一区| av一区二区三区| 国产视频一区二区在线| 久久www免费人成看片高清|