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

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

?? os_task.c

?? uCOS-II源碼公開的實時嵌入式操作系統.rar
?? 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一区二区三区免费野_久草精品视频
91精品婷婷国产综合久久竹菊| 从欧美一区二区三区| 欧美日韩精品欧美日韩精品一综合| 亚洲黄色小视频| 欧美三级蜜桃2在线观看| 偷拍日韩校园综合在线| 日韩欧美国产一区二区在线播放| 精品一区二区在线观看| 国产三级精品视频| 成人免费高清在线| 亚洲激情综合网| 制服.丝袜.亚洲.中文.综合| 久久精品国产精品亚洲综合| 久久久www成人免费无遮挡大片| 丁香天五香天堂综合| 国产精品久久国产精麻豆99网站| 欧洲人成人精品| 日本欧美一区二区| 欧美国产激情一区二区三区蜜月| 91色porny蝌蚪| 三级欧美在线一区| 日本一区二区免费在线| 国产亲近乱来精品视频| 日本少妇一区二区| 国产精品天干天干在观线| 91麻豆国产福利在线观看| 日本va欧美va精品| 国产午夜精品一区二区三区视频| 91看片淫黄大片一级| 五月婷婷另类国产| 国产日韩亚洲欧美综合| 91国产精品成人| 精品一区二区三区久久久| 最新不卡av在线| 欧美日韩国产综合草草| 国产成人精品免费一区二区| 一区二区三区在线播放| 26uuu亚洲| 欧美日韩另类一区| 成人一区二区三区| 日本视频免费一区| 亚洲另类在线一区| 国产午夜一区二区三区| 88在线观看91蜜桃国自产| www.视频一区| 精品一区二区三区久久久| 亚洲国产精品一区二区尤物区| 久久亚洲一级片| 777奇米成人网| 在线精品视频小说1| 国产99久久久国产精品潘金| 日本成人超碰在线观看| 亚洲狠狠丁香婷婷综合久久久| 久久蜜桃一区二区| 欧美一二三区在线观看| 欧美偷拍一区二区| 91在线丨porny丨国产| 国产精品99久久久久久似苏梦涵 | 亚洲一区精品在线| 亚洲国产精品国自产拍av| 日韩欧美久久久| 欧美绝品在线观看成人午夜影视 | 欧美偷拍一区二区| 99国产一区二区三精品乱码| 高清不卡在线观看av| 裸体在线国模精品偷拍| 三级影片在线观看欧美日韩一区二区| 亚洲卡通动漫在线| 自拍偷拍亚洲激情| 中文字幕成人av| 欧美精品一区二区三区蜜桃视频| 日韩午夜中文字幕| 91精品国产美女浴室洗澡无遮挡| 欧美日本在线一区| 欧美日韩国产高清一区二区三区 | 久久精品人人做人人爽97| 日韩欧美久久一区| 精品福利二区三区| 久久婷婷一区二区三区| 国产亚洲综合色| 欧美国产日韩a欧美在线观看 | 欧美色成人综合| 日本久久一区二区| 在线这里只有精品| 欧美日韩精品三区| 日韩一区二区免费视频| 日韩一区二区三区av| 欧美变态tickle挠乳网站| 欧美成人女星排名| 国产亚洲一区二区三区四区| 国产亚洲婷婷免费| 国产精品美女视频| 中文字幕字幕中文在线中不卡视频| 国产精品传媒入口麻豆| 亚洲欧美日韩久久| 亚洲小少妇裸体bbw| 秋霞成人午夜伦在线观看| 黄页网站大全一区二区| 粉嫩aⅴ一区二区三区四区 | 6080yy午夜一二三区久久| 9191成人精品久久| 精品入口麻豆88视频| 国产欧美精品一区二区色综合朱莉 | 亚洲日穴在线视频| 亚洲国产精品尤物yw在线观看| 免费在线一区观看| 高清shemale亚洲人妖| 色一情一乱一乱一91av| 777亚洲妇女| 久久免费看少妇高潮| 亚洲精品视频在线观看免费| 美女视频黄免费的久久| 成人av动漫在线| 在线观看91视频| 精品va天堂亚洲国产| 国产精品国产馆在线真实露脸| 天涯成人国产亚洲精品一区av| 久久国产精品99久久久久久老狼| 国产成人精品aa毛片| 欧洲一区二区三区在线| 国产亚洲综合在线| 亚洲一二三区不卡| 国产老妇另类xxxxx| 欧美色综合天天久久综合精品| 日韩精品一区二区三区老鸭窝 | 在线观看欧美日本| 精品国产乱码久久| 亚洲一区二区欧美激情| 在线亚洲+欧美+日本专区| 欧美亚洲国产bt| 国产人伦精品一区二区| 日本午夜精品一区二区三区电影| 成人黄色国产精品网站大全在线免费观看 | 久久成人精品无人区| 在线观看av一区| 国产精品女主播在线观看| 六月婷婷色综合| 欧美三级中文字| 国产精品白丝在线| 国产一区二三区好的| 69堂亚洲精品首页| 亚洲五码中文字幕| 99re亚洲国产精品| 久久影音资源网| 日韩国产欧美三级| 欧美在线观看视频一区二区| 中文在线一区二区| 精品一区二区三区在线视频| 欧美日韩精品电影| 亚洲精品久久久久久国产精华液| 国产精品一区二区久久精品爱涩| 欧美夫妻性生活| 亚洲第一激情av| 91污在线观看| 国产午夜亚洲精品羞羞网站| 激情图片小说一区| 日韩一区二区影院| 日本欧洲一区二区| 91精品国产综合久久久久| 亚洲风情在线资源站| 一本色道亚洲精品aⅴ| 自拍偷拍欧美激情| 91小视频在线| 亚洲人成网站影音先锋播放| 成人avav在线| 中文字幕av一区二区三区高| 国产一区二区电影| 久久久高清一区二区三区| 国产综合久久久久影院| 久久午夜色播影院免费高清| 久久99国产精品免费网站| 精品嫩草影院久久| 精品一区二区三区av| 337p粉嫩大胆色噜噜噜噜亚洲| 国产综合色精品一区二区三区| 久久看人人爽人人| 成人久久18免费网站麻豆| 日韩一区有码在线| 在线亚洲免费视频| 视频在线观看91| 91麻豆精品国产91久久久| 久久99精品久久久久久动态图| 欧美一区二区三区四区久久| 激情av综合网| 中文一区一区三区高中清不卡| 国产精品一区二区免费不卡| 国产精品护士白丝一区av| 91精品1区2区| 日一区二区三区| 久久久精品免费网站| 99麻豆久久久国产精品免费优播| 91视频免费看| 久久久久久久久伊人| 91视频国产资源| 日本在线不卡视频一二三区| 精品女同一区二区| www.久久久久久久久| 亚洲国产视频a| 久久久国产精华| 91国在线观看|