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

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

?? os_task.c

?? C51單片機上的嵌入式操作系統,具有任務調度,文件服務,等功能
?? 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
*********************************************************************************************************
*/

#if OS_TASK_DEL_EN
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)reentrant
{
}
#endif
/*$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)reentrant
{
    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
*
*              dataptr    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 'dataptr' as follows:
*
*                           void Task (void *dataptr)
*                           {
*                               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)reentrant, 
		    void *dataptr, 
		    OS_STK *ptos, 
		    INT8U prio)reentrant
{
    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, dataptr, 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
*
*              dataptr    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 'dataptr' as follows:
*
*                           void Task (void *dataptr)
*                           {
*                               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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜电影网亚洲视频| xfplay精品久久| 91精品国产一区二区人妖| 亚洲精品一区二区三区影院| 亚洲女同女同女同女同女同69| 日本一区中文字幕| 成人国产亚洲欧美成人综合网 | 成人午夜视频网站| 亚洲国产精品人人做人人爽| 午夜精品久久久久久| 日韩视频一区二区三区在线播放| 激情综合网激情| 国产精品久久久久久亚洲伦| 欧美综合久久久| 琪琪一区二区三区| 欧美一级久久久久久久大片| av一区二区三区黑人| 国产成a人亚洲| 日韩午夜中文字幕| 亚洲国产视频直播| 色婷婷激情一区二区三区| 国产亚洲精品免费| 国内欧美视频一区二区| 欧美一区二区三区在线电影| 亚洲成精国产精品女| 欧美三级电影在线观看| 亚洲一区二区三区自拍| 欧美性感一类影片在线播放| 亚洲精品国久久99热| 91香蕉国产在线观看软件| 国产亚洲自拍一区| 国产高清在线精品| 久久精品网站免费观看| 国产精品一区二区男女羞羞无遮挡| 2017欧美狠狠色| 国产一区高清在线| 日韩欧美的一区| 久久福利视频一区二区| 久久蜜桃香蕉精品一区二区三区| 激情成人午夜视频| 国产三级精品在线| 99r精品视频| 一区二区三区国产精华| 欧美色视频在线| 日本欧美一区二区| 久久蜜臀中文字幕| 91在线视频网址| 亚洲123区在线观看| 欧美电影免费观看高清完整版在| 国产很黄免费观看久久| 亚洲美腿欧美偷拍| 337p亚洲精品色噜噜狠狠| 久久激五月天综合精品| 国产嫩草影院久久久久| 色婷婷综合久久久久中文| 奇米四色…亚洲| 国产精品每日更新| 欧美日韩电影一区| 国产精品一卡二卡| 亚洲一区影音先锋| 欧美不卡激情三级在线观看| av资源网一区| 日韩电影一二三区| 中文字幕免费不卡| 欧美久久一二三四区| 久久女同精品一区二区| 亚洲三级电影全部在线观看高清| 成人夜色视频网站在线观看| 26uuu国产日韩综合| 性欧美疯狂xxxxbbbb| 99re这里只有精品视频首页| 亚洲精品在线电影| 亚洲一区二区三区在线看| 韩国三级电影一区二区| aaa国产一区| 久久嫩草精品久久久久| 亚洲一区国产视频| 午夜精品久久一牛影视| 久久你懂得1024| 欧美日韩精品一区二区三区蜜桃| 国产一区二区三区四区五区入口 | 国产亚洲欧美在线| 欧美视频在线播放| 国产久卡久卡久卡久卡视频精品| 亚洲午夜三级在线| 欧美高清在线一区| 欧美不卡一区二区| 欧美日韩在线播放三区| 成人av网站免费| 国产精品18久久久久| 天天av天天翘天天综合网| 亚洲三级理论片| 国产女同互慰高潮91漫画| 日韩三级在线免费观看| 欧美午夜在线一二页| 91在线高清观看| 国产成人精品在线看| 麻豆一区二区在线| 丝袜美腿亚洲一区| 亚洲综合色噜噜狠狠| 国产精品不卡在线观看| 国产亚洲人成网站| 精品少妇一区二区三区免费观看| 欧美精选在线播放| 欧美日韩国产小视频| 在线观看日韩精品| 一本久道久久综合中文字幕| 99麻豆久久久国产精品免费| 国产99精品在线观看| 国产一区免费电影| 国产在线视视频有精品| 精品一区二区成人精品| 精品一区二区三区av| 久久69国产一区二区蜜臀 | 亚洲日本在线a| 国产精品美女久久久久久久久久久| 国产婷婷一区二区| 国产女人水真多18毛片18精品视频| 久久久久久久久免费| 日本一区二区三区电影| 国产精品高潮呻吟| 国产精品久久久久国产精品日日| 国产精品伦一区| 亚洲欧美日韩人成在线播放| 亚洲黄色小视频| 亚洲国产va精品久久久不卡综合| 亚洲国产sm捆绑调教视频 | 久久久精品国产99久久精品芒果 | 久久噜噜亚洲综合| 欧美日韩二区三区| 在线成人av影院| 欧美老肥妇做.爰bbww视频| 精品视频一区三区九区| 日本伦理一区二区| 在线观看免费一区| 男女性色大片免费观看一区二区 | 国产精品久久看| 亚洲精品乱码久久久久久黑人| 亚洲一区二区高清| 蜜桃精品视频在线| 粉嫩av亚洲一区二区图片| 色综合久久久久久久久| 91精品国产免费| 久久久.com| 亚洲午夜视频在线观看| 黑人精品欧美一区二区蜜桃| av午夜一区麻豆| 欧美日韩黄色影视| 国产香蕉久久精品综合网| 成人免费在线播放视频| 日产国产高清一区二区三区| 国产精品中文字幕欧美| 欧美性一级生活| 国产午夜精品福利| 视频在线在亚洲| 国产**成人网毛片九色 | 91久久精品一区二区三区| 欧美一区二区三区视频在线观看| 亚洲国产高清在线观看视频| 婷婷开心久久网| 成人精品高清在线| 日韩欧美综合在线| 亚洲精品中文在线观看| 韩国中文字幕2020精品| 色综合天天性综合| 中文字幕亚洲精品在线观看| 日日摸夜夜添夜夜添国产精品 | 国产精品网站在线观看| 日本不卡在线视频| 色综合天天综合网天天看片| 久久久不卡影院| 麻豆成人91精品二区三区| 色播五月激情综合网| 欧美国产禁国产网站cc| 美女一区二区视频| 欧美日韩一区不卡| 亚洲精品日日夜夜| 国产不卡视频在线观看| 欧美成人三级在线| 天天影视涩香欲综合网| 91成人在线精品| 国产精品久久99| 国产不卡高清在线观看视频| 久久这里只有精品视频网| 视频一区在线视频| 欧美在线免费观看亚洲| 亚洲日本免费电影| www.亚洲免费av| 欧美国产日韩亚洲一区| 加勒比av一区二区| 日韩欧美国产1| 蜜臀av亚洲一区中文字幕| 欧美三级中文字幕在线观看| 亚洲男女一区二区三区| 成人精品小蝌蚪| 中文字幕在线观看不卡视频| 成人av小说网| 中文字幕一区二区三区四区| jlzzjlzz亚洲女人18| 国产精品美女视频|