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

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

?? os_task.c

?? 給一個調試好的UCOS源代碼與大家分享
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                            TASK MANAGEMENT
*
*                        (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
*                                           All Rights Reserved
*
*                                                  V2.00
*
* File : OS_TASK.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "includes.h"
#endif

/*
*********************************************************************************************************
*                                        LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/


static  void  OSDummy(void);

/*
*********************************************************************************************************
*                                            DUMMY FUNCTION
*
* Description: This function doesn't do anything.  It is called by OSTaskDel() to ensure that interrupts
*              are disabled immediately after they are enabled.
*
* Arguments  : none
*
* Returns    : none
*********************************************************************************************************
*/

static void  OSDummy (void)
{
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                        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
INT8U OSTaskChangePrio (INT8U oldprio, INT8U newprio)
{
    OS_TCB   *ptcb;
    OS_EVENT *pevent;
    INT8U     x;
    INT8U     y;
    INT8U     bitx;
    INT8U     bity;


    if ((oldprio >= OS_LOWEST_PRIO && oldprio != OS_PRIO_SELF)  || 
         newprio >= OS_LOWEST_PRIO) {
        return (OS_PRIO_INVALID);
    }
    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) {     /* If task is ready make it not ready  */
                if ((OSRdyTbl[ptcb->OSTCBY] &= ~ptcb->OSTCBBitX) == 0) {
                    OSRdyGrp &= ~ptcb->OSTCBBitY;
                }
                OSRdyGrp    |= bity;                            /* Make new priority ready to run      */
                OSRdyTbl[y] |= bitx;
            } 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;
                }
            }
            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();
            OSSched();                                          /* 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
INT8U OSTaskCreate (void (*task)(void *pd), void *pdata, OS_STK *ptos, INT8U prio)
{
    void   *psp;
    INT8U   err;


    if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
        return (OS_PRIO_INVALID);
    }
    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 = (void *)OSTaskStkInit(task, pdata, ptos, 0); /* Initialize the task's stack              */
        err = OSTCBInit(prio, psp, (void *)0, 0, 0, (void *)0, 0);         
        if (err == OS_NO_ERR) {
            OS_ENTER_CRITICAL();
            OSTaskCtr++;                                   /* Increment the #tasks counter             */
            OSTaskCreateHook(OSTCBPrioTbl[prio]);          /* Call user defined hook                   */
            OS_EXIT_CRITICAL();
            if (OSRunning) {                 /* Find highest priority task if multitasking has started */
                OSSched();
            }
        } else {
            OS_ENTER_CRITICAL();
            OSTCBPrioTbl[prio] = (OS_TCB *)0;/* Make this priority available to others                 */
            OS_EXIT_CRITICAL();
        }
        return (err);
    } else {
        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.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
狠狠色丁香久久婷婷综| 亚洲乱码国产乱码精品精98午夜| 亚洲妇熟xx妇色黄| 国产拍揄自揄精品视频麻豆| 91麻豆精品国产91| 日本高清视频一区二区| 成人三级伦理片| 国产成人在线网站| 日韩av二区在线播放| 亚洲午夜免费视频| 亚洲三级小视频| 国产精品电影一区二区三区| 精品国精品国产尤物美女| 欧美三级电影精品| 色av成人天堂桃色av| 91色综合久久久久婷婷| 国产·精品毛片| 国内精品免费**视频| 日本人妖一区二区| 日韩有码一区二区三区| 亚洲午夜久久久久久久久电影院 | 91精品1区2区| 色美美综合视频| 91免费精品国自产拍在线不卡| 国产91丝袜在线18| 国产成人一区二区精品非洲| 国产一区二区主播在线| 国产真实乱对白精彩久久| 国产在线精品不卡| 国产精品一区二区视频| 成人h精品动漫一区二区三区| 丁香婷婷深情五月亚洲| 国产精品一区二区在线观看不卡| 国产乱人伦偷精品视频不卡| 国产福利一区二区三区在线视频| 日韩av电影一区| 国产九色sp调教91| 成人精品视频.| 色噜噜狠狠色综合欧洲selulu| 欧美午夜理伦三级在线观看| 欧美乱熟臀69xxxxxx| 欧美一级二级三级乱码| 国产亚洲污的网站| 亚洲精品一区二区三区蜜桃下载 | 91黄色在线观看| 美腿丝袜亚洲综合| 成人不卡免费av| 欧美日韩在线播放一区| 久久精品在线免费观看| 亚洲超碰精品一区二区| 夫妻av一区二区| 欧美一级黄色大片| 亚洲一二三区视频在线观看| 成人性生交大片| 精品国精品国产尤物美女| 亚洲码国产岛国毛片在线| 国产在线精品视频| 欧美二区乱c少妇| 综合久久综合久久| 成人中文字幕在线| 精品成人一区二区| 看电影不卡的网站| 欧美日韩国产a| 亚洲综合一区在线| 色av成人天堂桃色av| 亚洲欧洲精品天堂一级| 国产v日产∨综合v精品视频| 日韩精品一区二区三区在线播放| 日韩综合小视频| 欧美午夜电影一区| 亚洲码国产岛国毛片在线| 99免费精品视频| 综合久久国产九一剧情麻豆| 成人av网站在线| 国产精品另类一区| 成人18视频日本| 国产精品理论在线观看| 成人av综合在线| 国产精品久久久久久久蜜臀 | 国产精品成人免费精品自在线观看 | 樱桃国产成人精品视频| 成人免费毛片片v| 国产精品全国免费观看高清| 高清成人免费视频| 国产精品的网站| 色综合久久久网| 五月天一区二区三区| 91精品在线一区二区| 久久机这里只有精品| 久久久.com| 91视频xxxx| 亚洲成人av中文| 日韩一二三区不卡| 国产精品原创巨作av| 国产精品成人在线观看| 欧美日韩中文精品| 蜜臀精品一区二区三区在线观看| 欧美成人午夜电影| 国产成人精品免费网站| 亚洲美女淫视频| 欧美一二三在线| 成人免费福利片| 亚洲一级二级在线| 久久亚洲精品国产精品紫薇| 成人性生交大片免费看视频在线| 亚洲女人的天堂| 日韩欧美一级二级三级久久久| 国产伦理精品不卡| 亚洲一区在线电影| 亚洲精品在线观| 欧美三级一区二区| 国产一区二区在线观看免费| 亚洲男女一区二区三区| 欧美一区二区三区免费大片| 成人高清在线视频| 蜜臀91精品一区二区三区 | 欧美日韩中文另类| 国产在线精品一区在线观看麻豆| 自拍偷拍亚洲综合| 欧美成人video| 欧美少妇bbb| 成人高清伦理免费影院在线观看| 丝袜亚洲另类欧美| 日韩美女啊v在线免费观看| 欧美va在线播放| 欧美日韩在线播放| 91伊人久久大香线蕉| 狠狠色狠狠色合久久伊人| 亚洲综合男人的天堂| 国产精品―色哟哟| 精品精品国产高清一毛片一天堂| 色婷婷亚洲一区二区三区| 国产在线视视频有精品| 日韩福利电影在线| 亚洲尤物在线视频观看| 中文字幕在线免费不卡| 久久久久久久久久美女| 日韩一区二区三区电影在线观看| 91一区一区三区| youjizz国产精品| 高清国产午夜精品久久久久久| 久久精品国产一区二区| 日韩电影免费一区| 天天综合网 天天综合色| 一区二区三区四区高清精品免费观看| 国产调教视频一区| 精品成人一区二区三区四区| 日韩精品一区二区三区在线 | 国产免费久久精品| 久久伊99综合婷婷久久伊| 欧美电视剧免费全集观看| 7777女厕盗摄久久久| 欧美精品三级日韩久久| 欧美日韩激情在线| 欧美日韩一区二区三区免费看| 色播五月激情综合网| 91丨九色porny丨蝌蚪| 一本一本大道香蕉久在线精品| 99久久久精品免费观看国产蜜| 99r国产精品| 91豆麻精品91久久久久久| 欧美性做爰猛烈叫床潮| 欧美日本一区二区| 日韩一区二区免费高清| 26uuu国产在线精品一区二区| 欧美大片国产精品| 国产欧美视频一区二区| 中文字幕一区二| 一区二区三区精品视频| 视频一区视频二区在线观看| 日韩电影一二三区| 国产一区二区三区日韩| 国产91清纯白嫩初高中在线观看| 波多野结衣亚洲| 欧美日韩在线一区二区| 欧美电视剧在线看免费| 久久天堂av综合合色蜜桃网| 亚洲国产精品ⅴa在线观看| 国产精品久久久久影院亚瑟| 亚洲黄网站在线观看| 免费看日韩a级影片| 成人黄页在线观看| 欧美性色欧美a在线播放| 精品久久久久一区二区国产| 国产精品乱码妇女bbbb| 亚洲不卡在线观看| 国产精品一二二区| 欧美日韩日本视频| 久久久久久久久久久久电影 | 亚洲国产精品黑人久久久| 亚洲精品水蜜桃| 欧美aa在线视频| 91免费在线看| xf在线a精品一区二区视频网站| 国产欧美一区二区精品婷婷| 亚洲成人在线免费| 成人av第一页| 久久久综合网站| 亚洲电影一区二区三区| 国产一区在线精品|