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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_task.c

?? 嵌入式實時操作系統(tǒng)uc/OS_II在凌陽單片機(jī)上的移植。跟大家共享
?? 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.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
视频一区在线播放| 亚洲成人一区二区在线观看| 亚洲国产毛片aaaaa无费看| 成人一区二区三区视频| 91麻豆精品91久久久久同性| av电影在线观看不卡| 日韩美女视频一区二区在线观看| 一区二区三区自拍| 国产电影一区二区三区| 88在线观看91蜜桃国自产| 日本在线观看不卡视频| 欧美亚洲综合另类| 亚洲欧洲另类国产综合| 国产成人精品网址| 亚洲美女在线国产| 色综合天天综合色综合av| 国产精品嫩草影院av蜜臀| 国产一区二区美女诱惑| 日韩欧美一区在线| 欧美bbbbb| 欧美一卡在线观看| 男女男精品视频| 久久久久久一级片| 国产一区二区调教| 亚洲日本在线a| 91成人网在线| 亚洲成人黄色小说| 久久综合成人精品亚洲另类欧美| 韩国理伦片一区二区三区在线播放| 日韩欧美一区二区视频| 成人网在线播放| 亚洲丰满少妇videoshd| 久久欧美一区二区| 色呦呦网站一区| 亚洲国产视频网站| 欧美精品一区视频| 高清国产午夜精品久久久久久| 九色综合国产一区二区三区| 日韩午夜电影av| av一区二区三区| 午夜精品一区二区三区电影天堂| 欧美精品乱人伦久久久久久| 免费国产亚洲视频| 国产精品久久综合| 色播五月激情综合网| 久久精品国产99国产| 久久精品亚洲乱码伦伦中文| 国产美女精品在线| 亚洲一二三级电影| 亚洲国产高清不卡| 色老汉一区二区三区| 韩国一区二区视频| 亚洲国产美女搞黄色| 日本一区二区三区在线不卡| 91美女片黄在线观看| 一二三四区精品视频| 久久精品综合网| 在线综合亚洲欧美在线视频| 99久久99久久精品国产片果冻| 亚洲综合网站在线观看| 日韩欧美色综合网站| 日本高清不卡aⅴ免费网站| 国产激情偷乱视频一区二区三区 | 久久久久综合网| 欧美日韩中文一区| 精品一区二区三区影院在线午夜| 一区二区三区不卡视频| 国产亚洲一区字幕| 午夜激情一区二区三区| 亚洲三级久久久| 国产亚洲欧美日韩在线一区| 欧美一区二区黄| 欧美性受极品xxxx喷水| av中文一区二区三区| 韩国精品免费视频| 日本中文字幕不卡| 亚洲成人av在线电影| 亚洲婷婷在线视频| 中文字幕国产一区| 欧美xxxxxxxx| 91麻豆.com| 成人白浆超碰人人人人| 午夜精品一区二区三区三上悠亚| 亚洲人成网站色在线观看| 日本一区二区三区电影| 337p日本欧洲亚洲大胆精品| 欧美一区二区在线视频| 欧美日韩中文字幕一区| 在线观看一区日韩| 国产乱码精品一区二区三区忘忧草 | 久久99国产精品尤物| 水野朝阳av一区二区三区| 亚洲精品视频在线看| 欧美电影免费观看高清完整版在线观看| 欧美艳星brazzers| 在线视频中文字幕一区二区| 成人国产亚洲欧美成人综合网| 国产精品一二三区| 国产一区二区三区av电影| 精品一区二区三区免费播放 | 日韩亚洲欧美成人一区| 欧美情侣在线播放| 成人黄色电影在线 | 久久综合久久综合九色| 欧美不卡123| 日韩欧美一级精品久久| 欧美一级在线免费| 欧美一三区三区四区免费在线看| 欧美美女直播网站| 欧美日韩大陆一区二区| 在线影视一区二区三区| 欧美午夜精品电影| 精品视频一区三区九区| 欧美日韩夫妻久久| 欧美一级搡bbbb搡bbbb| 日韩免费视频一区| 久久女同精品一区二区| 国产日韩影视精品| 中文字幕一区二区不卡| 亚洲另类在线制服丝袜| 亚洲午夜久久久久中文字幕久| 亚洲成人手机在线| 美女视频黄久久| 亚洲一区二区免费视频| 午夜精品久久久久久久久| 日本人妖一区二区| 国产资源在线一区| 粉嫩欧美一区二区三区高清影视 | 91影视在线播放| 91精品办公室少妇高潮对白| 欧美日韩色综合| 日韩一区二区电影| 国产亚洲精品超碰| 9久草视频在线视频精品| 97超碰欧美中文字幕| 欧美亚洲丝袜传媒另类| 91精品在线免费| 久久蜜桃av一区二区天堂| 国产精品免费视频网站| 亚洲自拍偷拍九九九| 日韩av电影免费观看高清完整版在线观看| 久久精品免费观看| 成人黄色软件下载| 欧美性极品少妇| 亚洲精品一区二区三区福利 | 国产乱码一区二区三区| 99久久久精品| 欧美日韩国产一级| xnxx国产精品| 亚洲日本韩国一区| 日产欧产美韩系列久久99| 国产精品一线二线三线精华| 91视频com| 日韩欧美黄色影院| 成人欧美一区二区三区1314| 亚洲成av人片在www色猫咪| 久久99国产乱子伦精品免费| 99视频在线观看一区三区| 欧美精三区欧美精三区| 久久久久久久电影| 亚洲夂夂婷婷色拍ww47| 极品少妇xxxx精品少妇| 91免费版在线| 日韩美女在线视频| 亚洲人成电影网站色mp4| 美女www一区二区| 极品少妇xxxx精品少妇| 色综合久久天天| 日韩精品资源二区在线| 综合中文字幕亚洲| 久久精品二区亚洲w码| 91在线免费看| 欧美成人一级视频| 亚洲激情五月婷婷| 国产一区二区网址| 欧美美女网站色| 亚洲天堂中文字幕| 国内外精品视频| 欧美体内she精视频| 中文字幕电影一区| 五月天丁香久久| a级精品国产片在线观看| 日韩你懂的在线观看| 亚洲精品国产精华液| 国产一区二区三区免费观看| 欧美性淫爽ww久久久久无| 国产精品美女一区二区在线观看| 视频在线观看91| 色婷婷精品大视频在线蜜桃视频| 精品盗摄一区二区三区| 亚洲va在线va天堂| av不卡在线播放| 久久久久久久久免费| 日韩精品高清不卡| 在线亚洲一区观看| 国产欧美一区二区精品性色超碰| 日韩激情中文字幕| 91九色最新地址| 中文字幕日韩欧美一区二区三区| 国产一区视频网站|