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

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

?? os_task.c

?? uc/osII基于51單片機的時鐘
?? 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) REENTRANT;

/*
*********************************************************************************************************
*                                            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
{
}

/*$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   DT_XDATA *ptcb;
    OS_EVENT DT_XDATA *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 DT_XDATA *)0) {                 /* New priority must not already exist */
        OS_EXIT_CRITICAL();
        return (OS_PRIO_EXIST);
    } else {
        OSTCBPrioTbl[newprio] = (OS_TCB DT_XDATA *)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 DT_XDATA *)0) {    /* Task to change must exist           */
            OSTCBPrioTbl[oldprio] = (OS_TCB DT_XDATA *)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 DT_XDATA *)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 DT_XDATA *)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
*
*              ppdata    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 'ppdata' as follows:
*
*                           void Task (void *ppdata)
*                           {
*                               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 (DT_CODE *task)(void DT_XDATA *pd), void DT_XDATA *ppdata, OS_STK DT_XDATA *ptos, INT8U prio) REENTRANT
{
    void DT_XDATA *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 DT_XDATA *)0) { /* Make sure task doesn't already exist at this priority  */
        OSTCBPrioTbl[prio] = (OS_TCB DT_XDATA *)1;    /* Reserve the priority to prevent others from doing ...  */
                                             /* ... the same thing until task is created.              */
        OS_EXIT_CRITICAL();
        psp = (void DT_XDATA *)OSTaskStkInit(task, ppdata, ptos, 0); /* Initialize the task's stack              */
        err = OSTCBInit(prio, psp, (void DT_XDATA *)0, 0, 0, (void DT_XDATA *)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 DT_XDATA *)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
*
*              ppdata    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 'ppdata' as follows:
*
*                           void Task (void *ppdata)
*                           {
*                               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视频精品在这里| 欧美一区二区三区视频在线观看 | 亚洲男帅同性gay1069| 成人动漫一区二区| 亚洲欧美国产三级| 欧美视频一区二区三区在线观看| 亚洲成av人片在线观看无码| 日韩一区二区三区免费看| 麻豆精品蜜桃视频网站| 欧美xfplay| 成人av免费在线观看| 亚洲激情中文1区| 3d动漫精品啪啪一区二区竹菊| 日本欧美一区二区在线观看| 久久久亚洲高清| 成人激情黄色小说| 亚洲一区av在线| 精品裸体舞一区二区三区| 国产91丝袜在线观看| 日韩理论片中文av| 日韩一级高清毛片| caoporen国产精品视频| 亚洲国产欧美在线人成| 日韩久久免费av| 99精品视频在线观看| 亚洲成人资源在线| 国产欧美视频在线观看| 在线视频一区二区三区| 久久99精品久久久久| 日韩一区中文字幕| 日韩精品中文字幕在线不卡尤物| 不卡的电影网站| 秋霞影院一区二区| 国产精品成人免费在线| 91麻豆精品国产91久久久久久久久| 国产美女在线观看一区| 亚洲午夜久久久久久久久电影院| 26uuu久久综合| 欧美亚洲一区二区在线观看| 色综合亚洲欧洲| 另类调教123区 | 精品91自产拍在线观看一区| 91偷拍与自偷拍精品| 韩国理伦片一区二区三区在线播放| 亚洲卡通动漫在线| 欧美激情在线观看视频免费| 91精品国产色综合久久| 91影院在线观看| 国产福利一区在线观看| 天堂一区二区在线免费观看| 日韩理论电影院| 中文字幕精品在线不卡| 精品久久久久久综合日本欧美| 欧美亚洲禁片免费| 97久久精品人人爽人人爽蜜臀 | 日本不卡123| 亚洲一区在线免费观看| 最好看的中文字幕久久| 久久久精品2019中文字幕之3| 51精品视频一区二区三区| 欧美唯美清纯偷拍| 91热门视频在线观看| jlzzjlzz国产精品久久| 懂色av一区二区在线播放| 精品一区二区三区免费播放 | 久久免费偷拍视频| 欧美videos中文字幕| 欧美一区二区日韩一区二区| 欧美日韩激情一区| 欧美日韩欧美一区二区| 欧美日韩亚洲国产综合| 欧美亚洲一区二区在线| 欧美视频在线观看一区| 欧美性大战久久久| 欧美网站一区二区| 在线播放国产精品二区一二区四区| 在线免费av一区| 欧美日韩精品免费| 欧美一区二区三区在线视频| 日韩视频在线永久播放| 精品国内二区三区| 久久精品一区四区| 国产农村妇女毛片精品久久麻豆| 国产欧美日韩在线观看| 国产精品视频看| 亚洲日本成人在线观看| 亚洲欧美日韩国产一区二区三区 | 国产91精品一区二区麻豆亚洲| 国产成人在线影院| 成人开心网精品视频| av福利精品导航| 日本韩国一区二区三区| 欧美日韩国产美| 日韩欧美在线观看一区二区三区| 精品国产乱子伦一区| 日本一区二区三区久久久久久久久不 | 色香蕉成人二区免费| 色欲综合视频天天天| 欧美日韩在线播| 欧美成人精品高清在线播放| 久久九九全国免费| 亚洲人成网站色在线观看| 亚洲va韩国va欧美va| 极品美女销魂一区二区三区 | 亚洲色图都市小说| 亚洲二区在线视频| 久久er精品视频| 成人免费视频一区| 欧美日韩国产综合草草| 亚洲精品一线二线三线无人区| 国产精品午夜电影| 亚洲成av人片在www色猫咪| 国产一区二区不卡老阿姨| 91免费视频大全| 欧美一级生活片| 国产精品福利av| 青青草国产成人99久久| 成人18精品视频| 91精品国产日韩91久久久久久| 日本一区二区三区dvd视频在线| 一区二区在线观看av| 精品综合久久久久久8888| 91在线视频播放地址| 欧美一级一区二区| 亚洲精品一二三四区| 国模少妇一区二区三区| 欧美性高清videossexo| 国产精品理论在线观看| 成人黄页毛片网站| 日韩一区二区免费在线观看| 中文字幕一区不卡| 国产在线乱码一区二区三区| 欧美日韩免费观看一区二区三区| 久久精品一区四区| 免费高清在线视频一区·| 色综合视频在线观看| 久久久久国产精品免费免费搜索| 午夜精品久久久久久不卡8050| 成人av电影免费观看| 久久婷婷综合激情| 五月婷婷另类国产| 欧美在线视频不卡| 日韩一区有码在线| 丁香婷婷深情五月亚洲| 久久综合色8888| 青青草原综合久久大伊人精品优势| 91国模大尺度私拍在线视频| 国产精品伦一区| 粉嫩13p一区二区三区| 精品国产sm最大网站免费看| 日韩精品每日更新| 欧美巨大另类极品videosbest | 蜜臀国产一区二区三区在线播放| 色综合视频一区二区三区高清| 中日韩免费视频中文字幕| 国产精品亚洲综合一区在线观看| 日韩欧美一级二级三级久久久| 婷婷亚洲久悠悠色悠在线播放| 欧美在线一二三四区| 亚洲免费观看视频| 91美女片黄在线观看| 国产精品久久久久久久蜜臀| 成人av动漫网站| 综合久久给合久久狠狠狠97色| 成人小视频免费在线观看| 国产欧美日产一区| 成人午夜激情视频| 中文字幕色av一区二区三区| jlzzjlzz欧美大全| 中文字幕在线不卡视频| 91日韩在线专区| 亚洲综合色网站| 欧美三片在线视频观看| 五月激情综合婷婷| 日韩美女一区二区三区四区| 久久福利资源站| 久久免费的精品国产v∧| 国产精品自在在线| 国产精品污污网站在线观看| www.成人网.com| 亚洲第一激情av| 日韩欧美资源站| 国产精品一二三四| 国产精品拍天天在线| 色美美综合视频| 丝袜美腿亚洲综合| 久久亚洲精品国产精品紫薇| 99精品偷自拍| 亚洲国产毛片aaaaa无费看| 欧美精品一二三四| 国内精品伊人久久久久av一坑| 国产精品无遮挡| 欧美三级资源在线| 久久成人免费网站| 亚洲欧洲性图库| 欧美人与z0zoxxxx视频| 国精产品一区一区三区mba桃花| 国产精品亲子伦对白| 欧美精选在线播放|