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

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

?? os_task.c

?? ucosii小實驗任務3 哲學家就餐
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                          (c) Copyright 1992-2002, 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                   */
        }
        ptcb = OSTCBPrioTbl[oldprio];
        if (ptcb != (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 {
                pevent = ptcb->OSTCBEventPtr;
                if (pevent != (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.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
另类小说色综合网站| 亚洲一区二区三区视频在线| 欧美一区二区女人| 制服丝袜一区二区三区| 欧美三级一区二区| 欧美日韩欧美一区二区| 制服.丝袜.亚洲.另类.中文| 欧美乱妇20p| 日韩一区二区三区四区| 日韩免费视频一区| 久久精品亚洲精品国产欧美kt∨| 日韩限制级电影在线观看| 欧美va亚洲va香蕉在线 | 国产精品久久毛片av大全日韩| 精品99999| 国产日本亚洲高清| 亚洲色图视频网| 午夜视频在线观看一区| 日韩国产高清在线| 国产精品18久久久久久久久久久久 | 亚洲免费在线视频一区 二区| 中文字幕一区二区三| 亚洲一区在线观看网站| 精品一区二区三区的国产在线播放| 国内精品不卡在线| 色婷婷av一区二区| 精品免费日韩av| 亚洲图片欧美激情| 麻豆免费精品视频| 99久久精品费精品国产一区二区| 欧美日韩精品是欧美日韩精品| 91精品国产欧美一区二区18| 久久久久国产精品免费免费搜索| 亚洲婷婷综合色高清在线| 日日夜夜精品免费视频| 波多野结衣91| 欧美视频三区在线播放| 久久久综合九色合综国产精品| 亚洲乱码国产乱码精品精小说 | 精品国产91亚洲一区二区三区婷婷| 久久在线观看免费| 午夜精品一区在线观看| 成人av片在线观看| 欧美精品一区二区三区高清aⅴ| 国产精品人妖ts系列视频| 日韩电影在线看| 91偷拍与自偷拍精品| 欧美精品一区二区三区一线天视频 | 国产精品情趣视频| 麻豆精品一区二区av白丝在线 | 视频在线观看一区| 91丨九色丨尤物| 久久尤物电影视频在线观看| 午夜亚洲福利老司机| 色婷婷综合激情| www国产成人| 久久国产精品99久久久久久老狼| 色婷婷国产精品综合在线观看| 亚洲国产精品二十页| 久久精品国产一区二区三| 欧美日韩国产精选| 亚洲一区二区在线免费观看视频| 精品一区二区三区香蕉蜜桃 | 粉嫩欧美一区二区三区高清影视| 欧美日韩色一区| 一区二区三区在线免费播放| 波多野结衣亚洲一区| 久久久电影一区二区三区| 裸体健美xxxx欧美裸体表演| 欧美日韩精品高清| 夜夜嗨av一区二区三区网页 | 国产99久久久国产精品潘金| 欧美第一区第二区| 免费观看在线综合色| 日韩一区二区三区视频在线观看| 五月综合激情婷婷六月色窝| 精品视频1区2区| 三级欧美韩日大片在线看| 欧美亚洲尤物久久| 日韩高清不卡一区二区三区| 69av一区二区三区| 蜜臀av在线播放一区二区三区| 日韩一区二区电影在线| 理论片日本一区| 国产欧美视频一区二区| 成人综合日日夜夜| 亚洲视频资源在线| 欧美亚洲日本一区| 青娱乐精品视频在线| 日韩精品专区在线影院观看| 激情图片小说一区| 国产精品乱码一区二区三区软件 | 亚洲一区二区在线免费观看视频| 色综合一区二区| 亚洲午夜激情av| 7777精品久久久大香线蕉| 精品亚洲成av人在线观看| 国产丝袜美腿一区二区三区| 91蜜桃传媒精品久久久一区二区| 亚洲综合一区二区精品导航| 91精品国产欧美一区二区成人| 韩国理伦片一区二区三区在线播放| 欧美国产成人精品| 在线欧美小视频| 韩国午夜理伦三级不卡影院| 国产精品久久久久久福利一牛影视| 欧洲av在线精品| 激情综合网天天干| 亚洲视频一区二区在线观看| 欧美人动与zoxxxx乱| 国产精品自拍在线| 亚洲国产精品久久艾草纯爱| 国产亚洲一区二区三区四区| 91视频你懂的| 国产剧情av麻豆香蕉精品| 亚洲卡通欧美制服中文| 精品日韩99亚洲| 色成人在线视频| 韩国理伦片一区二区三区在线播放 | 久久一区二区三区国产精品| 色94色欧美sute亚洲线路二 | 欧美欧美欧美欧美首页| 国产在线视频一区二区| 亚洲主播在线播放| 国产欧美视频一区二区三区| 欧美一卡二卡在线| 一本久久综合亚洲鲁鲁五月天| 精彩视频一区二区| 亚洲一区二区三区四区中文字幕| 国产欧美一区二区精品久导航| 欧美精品日日鲁夜夜添| 一本大道久久a久久精品综合| 精品一区二区三区久久| 日本视频中文字幕一区二区三区| 国产精品污www在线观看| 精品国产91亚洲一区二区三区婷婷| 欧美写真视频网站| 色综合激情五月| 99视频国产精品| 成人精品鲁一区一区二区| 精品综合久久久久久8888| 婷婷综合另类小说色区| 亚洲夂夂婷婷色拍ww47| 亚洲精品第一国产综合野| √…a在线天堂一区| 国产精品不卡在线| 国产精品无人区| 国产精品久久三区| 亚洲色图第一区| 国产精品久久免费看| 久久久亚洲综合| 精品国产乱子伦一区| 欧美成人精精品一区二区频| 91精品国产综合久久精品| 欧美一区二区三区免费大片 | 久久久亚洲精品一区二区三区| 日韩精品一区二区三区在线播放 | 麻豆精品在线看| 麻豆国产欧美一区二区三区| 秋霞电影网一区二区| 日本不卡一区二区三区| 午夜在线成人av| 久久精品国产亚洲一区二区三区| 男人的天堂亚洲一区| 国产在线精品免费| caoporen国产精品视频| 91原创在线视频| 欧美制服丝袜第一页| 欧美一级搡bbbb搡bbbb| 精品处破学生在线二十三| 国产精品久线在线观看| 亚洲精品ww久久久久久p站| 亚洲大尺度视频在线观看| 视频在线在亚洲| 国产一区二区三区四区五区入口 | 午夜影院在线观看欧美| 日韩成人一区二区三区在线观看| 久久99国产精品久久| 盗摄精品av一区二区三区| 日本久久精品电影| 日韩欧美一级二级三级久久久| 久久精品一区二区三区四区| 综合久久久久久| 日韩精品一级中文字幕精品视频免费观看 | 亚洲精品一区二区三区蜜桃下载| 国产日韩欧美一区二区三区综合| 亚洲欧洲美洲综合色网| 视频一区二区欧美| 成人一级视频在线观看| 欧美日韩精品综合在线| 国产日韩精品视频一区| 五月婷婷色综合| 高清国产午夜精品久久久久久| 欧美三区在线观看| 国产日韩欧美一区二区三区综合 | 日韩欧美在线不卡| 中文字幕制服丝袜一区二区三区 | 亚洲人成影院在线观看| 久久丁香综合五月国产三级网站| 成人高清在线视频|