亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产精品国产三级国产普通话蜜臀 | 久久麻豆一区二区| 中文字幕一区二区三区色视频| 亚洲成a人片在线观看中文| 国产九九视频一区二区三区| 欧美一级黄色录像| 亚洲女人的天堂| 国产精选一区二区三区| 欧美一区二区三区播放老司机| 国产精品黄色在线观看| 韩国女主播成人在线| 欧美日韩的一区二区| 中文字幕日韩精品一区| 国产美女精品在线| 久久综合五月天婷婷伊人| 性久久久久久久久| 欧洲中文字幕精品| 亚洲日本一区二区| 成人激情开心网| 国产日韩欧美在线一区| 精品在线你懂的| 欧美一区2区视频在线观看| 亚洲女爱视频在线| 91丨porny丨国产入口| 国产精品免费aⅴ片在线观看| 国产中文字幕精品| 久久综合中文字幕| 国产酒店精品激情| 欧美激情中文字幕| 成人激情免费电影网址| 国产日韩一级二级三级| 国产91高潮流白浆在线麻豆| 久久影院午夜片一区| 精品一区二区在线视频| 日韩欧美专区在线| 精品一区二区在线视频| 精品国产91久久久久久久妲己 | 亚洲啪啪综合av一区二区三区| 成人激情av网| 亚洲欧美另类久久久精品| 色av综合在线| 五月综合激情日本mⅴ| 欧美精品日日鲁夜夜添| 蜜臀va亚洲va欧美va天堂| 日韩欧美aaaaaa| 国产一区二区福利| 国产精品国产馆在线真实露脸 | 美女视频黄频大全不卡视频在线播放| 69堂成人精品免费视频| 麻豆精品国产传媒mv男同| 欧美一级日韩一级| 国产麻豆一精品一av一免费| 欧美国产欧美亚州国产日韩mv天天看完整| 国产成人在线色| 亚洲免费在线观看| 777久久久精品| 国产福利一区二区| 一区二区三区日本| 日韩精品一区二区三区老鸭窝| 国产白丝精品91爽爽久久| 亚洲激情第一区| 日韩一区二区中文字幕| 色哟哟国产精品| 日韩vs国产vs欧美| 中文字幕高清一区| 欧美午夜精品一区二区三区| 蜜桃久久精品一区二区| 国产精品第13页| 欧美一区二区三区电影| av不卡一区二区三区| 日韩成人一级片| 中文字幕二三区不卡| 欧美精品久久久久久久久老牛影院| 国产在线视视频有精品| 一区二区三区欧美久久| 26uuu色噜噜精品一区二区| 亚洲国产成人porn| 日韩一区二区三区在线视频| 韩国成人在线视频| 亚洲高清免费观看| 国产蜜臀97一区二区三区| 欧美色图在线观看| 国产成人精品1024| 奇米影视一区二区三区小说| 中文字幕一区二区三区色视频| 在线播放欧美女士性生活| www.色精品| 国产一区二区不卡在线| 午夜久久久久久| 亚洲激情综合网| 国产精品成人免费精品自在线观看| 欧美夫妻性生活| 在线观看一区二区视频| 国产不卡在线播放| 美腿丝袜一区二区三区| 亚洲午夜激情av| 中文字幕一区二区三| 久久久青草青青国产亚洲免观| 91超碰这里只有精品国产| 欧美午夜宅男影院| 色婷婷综合久色| 不卡一区二区中文字幕| 国产精品一区二区久久不卡| 美女脱光内衣内裤视频久久网站| 亚洲成a人片在线观看中文| 亚洲欧美国产77777| 日韩一区中文字幕| 国产精品成人一区二区三区夜夜夜| 久久久一区二区| 久久久www成人免费无遮挡大片| 欧美一区二区三区系列电影| 欧美日韩精品高清| 欧美女孩性生活视频| 欧美日韩国产片| 欧美猛男男办公室激情| 欧美人体做爰大胆视频| 56国语精品自产拍在线观看| 欧美电影影音先锋| 欧美一区二区三区系列电影| 欧美一区二区日韩| 日韩美一区二区三区| 2023国产精品视频| 国产欧美精品一区| 国产精品盗摄一区二区三区| 亚洲视频免费在线| 亚洲综合在线观看视频| 一区二区三区中文字幕电影| 亚洲一区二区欧美| 亚洲第一成年网| 久久精品国产秦先生| 国产一区二区美女| 91小视频在线免费看| 欧美日韩亚洲综合在线| 日韩亚洲欧美中文三级| 久久久精品2019中文字幕之3| 国产精品色哟哟网站| 亚洲一区二区影院| 全国精品久久少妇| 国产成人精品网址| 日本二三区不卡| 91精品一区二区三区在线观看| 日韩欧美视频一区| 亚洲丝袜美腿综合| 婷婷国产在线综合| 国产xxx精品视频大全| 在线观看亚洲一区| 精品国产伦一区二区三区观看方式 | 亚洲第一成人在线| 国产精品 欧美精品| 欧美视频一区在线观看| 久久久噜噜噜久久中文字幕色伊伊| 国产精品久久久久精k8| 日韩1区2区3区| 成人不卡免费av| 日韩一区二区免费在线观看| 国产欧美一区二区三区网站| 亚洲一级在线观看| 高清成人在线观看| 欧美精品少妇一区二区三区| 欧美国产日韩精品免费观看| 天天综合天天做天天综合| 成人永久免费视频| 欧美一区二区二区| 亚洲人一二三区| 国产一区二区看久久| 欧美日韩国产大片| 国产精品第一页第二页第三页| 久久精品噜噜噜成人av农村| 91麻豆免费在线观看| 久久久久国产精品麻豆ai换脸 | 久久66热re国产| 欧美日韩国产大片| 亚洲色欲色欲www| 国产揄拍国内精品对白| 欧美乱妇20p| 亚洲欧美日韩精品久久久久| 国产久卡久卡久卡久卡视频精品| 欧美精品久久99久久在免费线 | 日本一区二区在线不卡| 九九在线精品视频| 91麻豆精品国产91久久久使用方法| 一区视频在线播放| 国产成人精品午夜视频免费| 精品久久久久久久久久久久包黑料| 亚洲小说欧美激情另类| 色综合久久中文综合久久牛| 中文字幕不卡一区| 国产98色在线|日韩| 久久久亚洲国产美女国产盗摄 | 成人av免费在线| 欧美激情在线观看视频免费| 美国毛片一区二区三区| 欧美丰满高潮xxxx喷水动漫| 亚洲国产日日夜夜| 欧美日韩一区中文字幕| 亚洲一区二区中文在线| 欧美私人免费视频| 亚洲国产精品久久人人爱| 欧美日韩一区视频| 午夜在线成人av|