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

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

?? os_time.c

?? 我 Porting 的 uC/OS-II V2.84 (目前Micrium)最新版之 Keil C51 工程,專供給 8051 上做任務調度,我已將 Code Size 改小至 4000 Byte,對
?? C
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                             TIME MANAGEMENT
*
*                          (c) Copyright 1992-2006, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_TIME.C
* By      : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include <ucos_ii.h>
#endif

/*
*********************************************************************************************************
*                                DELAY TASK 'n' TICKS   (n from 0 to 65535)
*
* Description: This function is called to delay execution of the currently running task until the
*              specified number of system ticks expires.  This, of course, directly equates to delaying
*              the current task for some time to expire.  No delay will result If the specified delay is
*              0.  If the specified delay is greater than 0 then, a context switch will result.
*
* Arguments  : ticks     is the time delay that the task will be suspended in number of clock 'ticks'.
*                        Note that by specifying 0, the task will not be delayed.
*
* Returns    : none
*********************************************************************************************************
*/

void  OSTimeDly (INT16U ticks) reentrant
{
    INT8U      y;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



    if (ticks > 0) {                             /* 0 means no delay!                                  */
        OS_ENTER_CRITICAL();
        y            =  OSTCBCur->OSTCBY;        /* Delay current task                                 */
        OSRdyTbl[y] &= ~OSTCBCur->OSTCBBitX;
        if (OSRdyTbl[y] == 0) {
            OSRdyGrp &= ~OSTCBCur->OSTCBBitY;
        }
        OSTCBCur->OSTCBDly = ticks;              /* Load ticks in TCB                                  */
        OS_EXIT_CRITICAL();
        OS_Sched();                              /* Find next task to run!                             */
    }
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                     DELAY TASK FOR SPECIFIED TIME
*
* Description: This function is called to delay execution of the currently running task until some time
*              expires.  This call allows you to specify the delay time in HOURS, MINUTES, SECONDS and
*              MILLISECONDS instead of ticks.
*
* Arguments  : hours     specifies the number of hours that the task will be delayed (max. is 255)
*              minutes   specifies the number of minutes (max. 59)
*              seconds   specifies the number of seconds (max. 59)
*              milli     specifies the number of milliseconds (max. 999)
*
* Returns    : OS_NO_ERR
*              OS_TIME_INVALID_MINUTES
*              OS_TIME_INVALID_SECONDS
*              OS_TIME_INVALID_MS
*              OS_TIME_ZERO_DLY
*
* Note(s)    : The resolution on the milliseconds depends on the tick rate.  For example, you can't do
*              a 10 mS delay if the ticker interrupts every 100 mS.  In this case, the delay would be
*              set to 0.  The actual delay is rounded to the nearest tick.
*********************************************************************************************************
*/

#if OS_TIME_DLY_HMSM_EN > 0
INT8U  OSTimeDlyHMSM (INT8U hours, INT8U minutes, INT8U seconds, INT16U milli) reentrant
{
    INT32U ticks;
    INT16U loops;


#if OS_ARG_CHK_EN > 0
    if (hours == 0) {
        if (minutes == 0) {
            if (seconds == 0) {
                if (milli == 0) {
                    return (OS_TIME_ZERO_DLY);
                }
            }
        }
    }
    if (minutes > 59) {
        return (OS_TIME_INVALID_MINUTES);        /* Validate arguments to be within range              */
    }
    if (seconds > 59) {
        return (OS_TIME_INVALID_SECONDS);
    }
    if (milli > 999) {
        return (OS_TIME_INVALID_MILLI);
    }
#endif
                                                 /* Compute the total number of clock ticks required.. */
                                                 /* .. (rounded to the nearest tick)                   */
    ticks = ((INT32U)hours * 3600L + (INT32U)minutes * 60L + (INT32U)seconds) * OS_TICKS_PER_SEC
          + OS_TICKS_PER_SEC * ((INT32U)milli + 500L / OS_TICKS_PER_SEC) / 1000L;
    loops = (INT16U)(ticks / 65536L);            /* Compute the integral number of 65536 tick delays   */
    ticks = ticks % 65536L;                      /* Obtain  the fractional number of ticks             */
    OSTimeDly((INT16U)ticks);
    while (loops > 0) {
        OSTimeDly((INT16U)32768u);
        OSTimeDly((INT16U)32768u);
        loops--;
    }
    return (OS_NO_ERR);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                         RESUME A DELAYED TASK
*
* Description: This function is used resume a task that has been delayed through a call to either
*              OSTimeDly() or OSTimeDlyHMSM().  Note that you can call this function to resume a
*              task that is waiting for an event with timeout.  This would make the task look
*              like a timeout occurred.
*
*              Also, you cannot resume a task that has called OSTimeDlyHMSM() with a combined time that
*              exceeds 65535 clock ticks.  In other words, if the clock tick runs at 100 Hz then, you will
*              not be able to resume a delayed task that called OSTimeDlyHMSM(0, 10, 55, 350) or higher:
*
*                  (10 Minutes * 60 + 55 Seconds + 0.35) * 100 ticks/second.
*
* Arguments  : prio                      specifies the priority of the task to resume
*
* Returns    : OS_NO_ERR                 Task has been resumed
*              OS_PRIO_INVALID           if the priority you specify is higher that the maximum allowed
*                                        (i.e. >= OS_LOWEST_PRIO)
*              OS_TIME_NOT_DLY           Task is not waiting for time to expire
*              OS_TASK_NOT_EXIST         The desired task has not been created or has been assigned to a Mutex.
*********************************************************************************************************
*/

#if OS_TIME_DLY_RESUME_EN > 0
INT8U  OSTimeDlyResume (INT8U prio) reentrant
{
    OS_TCB    *ptcb;
#if OS_CRITICAL_METHOD == 3                                    /* Storage for CPU status register      */
    OS_CPU_SR  cpu_sr = 0;
#endif



    if (prio >= OS_LOWEST_PRIO) {
        return (OS_PRIO_INVALID);
    }
    OS_ENTER_CRITICAL();
    ptcb = OSTCBPrioTbl[prio];                                 /* Make sure that task exist            */
    if (ptcb == (OS_TCB *)0) {
        OS_EXIT_CRITICAL();
        return (OS_TASK_NOT_EXIST);                            /* The task does not exist              */
    }
    if (ptcb == (OS_TCB *)1) {
        OS_EXIT_CRITICAL();
        return (OS_TASK_NOT_EXIST);                            /* The task does not exist              */
    }
    if (ptcb->OSTCBDly == 0) {                                 /* See if task is delayed               */
        OS_EXIT_CRITICAL();
        return (OS_TIME_NOT_DLY);                              /* Indicate that task was not delayed   */
    }

    ptcb->OSTCBDly = 0;                                        /* Clear the time delay                 */
    if ((ptcb->OSTCBStat & OS_STAT_PEND_ANY) != OS_STAT_RDY) {
        ptcb->OSTCBStat   &= ~OS_STAT_PEND_ANY;                /* Yes, Clear status flag               */
        ptcb->OSTCBPendTO  = OS_TRUE;                          /* Indicate PEND timeout                */
    } else {
        ptcb->OSTCBPendTO  = OS_FALSE;
    }
    if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) {  /* Is task suspended?                   */
        OSRdyGrp               |= ptcb->OSTCBBitY;             /* No,  Make ready                      */
        OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
        OS_EXIT_CRITICAL();
        OS_Sched();                                           /* See if this is new highest priority   */
    } else {
        OS_EXIT_CRITICAL();                                   /* Task may be suspended                 */
    }
    return (OS_NO_ERR);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                         GET CURRENT SYSTEM TIME
*
* Description: This function is used by your application to obtain the current value of the 32-bit
*              counter which keeps track of the number of clock ticks.
*
* Arguments  : none
*
* Returns    : The current value of OSTime
*********************************************************************************************************
*/

#if OS_TIME_GET_SET_EN > 0
INT32U  OSTimeGet (void) reentrant

{
    INT32U     ticks;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



    OS_ENTER_CRITICAL();
    ticks = OSTime;
    OS_EXIT_CRITICAL();
    return (ticks);
}
#endif

/*
*********************************************************************************************************
*                                            SET SYSTEM CLOCK
*
* Description: This function sets the 32-bit counter which keeps track of the number of clock ticks.
*
* Arguments  : ticks      specifies the new value that OSTime needs to take.
*
* Returns    : none
*********************************************************************************************************
*/

#if OS_TIME_GET_SET_EN > 0
void  OSTimeSet (INT32U ticks) reentrant
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr = 0;
#endif



    OS_ENTER_CRITICAL();
    OSTime = ticks;
    OS_EXIT_CRITICAL();
}
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av资源网站| 成人精品在线视频观看| 亚洲精品亚洲人成人网在线播放| 欧美精品一区二区三区四区 | 欧美性高清videossexo| 99久久国产综合色|国产精品| 成人国产免费视频| 91免费版在线| 欧美亚洲国产怡红院影院| 欧美调教femdomvk| 69av一区二区三区| 亚洲精品一线二线三线| 日本一二三不卡| 亚洲人成影院在线观看| 亚洲综合激情网| 日韩和欧美一区二区| 久久狠狠亚洲综合| 国产激情视频一区二区三区欧美| 成人午夜免费电影| 欧美三级午夜理伦三级中视频| 欧美丰满一区二区免费视频| 欧美videossexotv100| 久久久久久久久岛国免费| 亚洲欧洲日本在线| 亚洲gay无套男同| 国内精品免费**视频| 99麻豆久久久国产精品免费优播| 日本高清不卡视频| 日韩视频免费直播| 国产精品久久久99| 日日夜夜精品免费视频| 成人黄色一级视频| 欧美日韩国产大片| 欧美国产日韩一二三区| 日韩精品一二三四| 波多野结衣中文一区| 欧美日韩精品一区视频| 欧美国产丝袜视频| 免费不卡在线观看| 在线免费观看成人短视频| 2021国产精品久久精品| 亚洲成人免费影院| 99久久久久免费精品国产| 91麻豆精品国产91久久久使用方法| 国产欧美一区二区精品忘忧草| 亚洲第一电影网| 91碰在线视频| 国产三级三级三级精品8ⅰ区| 亚洲超碰97人人做人人爱| 成人视屏免费看| 精品人在线二区三区| 亚洲一级不卡视频| 波多野结衣精品在线| 2024国产精品| 蜜桃av一区二区三区电影| 91丨porny丨蝌蚪视频| 久久久综合视频| 蜜臀av在线播放一区二区三区| 欧美伊人久久久久久久久影院| 国产精品黄色在线观看| 国产成人亚洲综合a∨婷婷| 日韩你懂的在线观看| 丝袜美腿成人在线| 欧洲精品在线观看| 亚洲免费观看高清在线观看| 不卡一区二区三区四区| 欧美激情综合网| 国产成人av电影在线观看| 国产免费观看久久| 国产精品18久久久久久久久| 欧美成人综合网站| 极品尤物av久久免费看| 91精品久久久久久久99蜜桃| 日韩电影在线观看一区| 欧美日韩不卡在线| 日韩制服丝袜av| 日韩欧美一区二区不卡| 美腿丝袜亚洲一区| 久久这里只有精品视频网| 黄页视频在线91| 久久久蜜桃精品| 国产999精品久久| 国产精品乱人伦一区二区| 9人人澡人人爽人人精品| 国产精品国产三级国产普通话99| 国产91综合网| 亚洲精品国产一区二区三区四区在线| 99国产精品国产精品毛片| 亚洲蜜臀av乱码久久精品蜜桃| 91久久一区二区| 免费成人在线播放| 日本一区二区综合亚洲| 在线一区二区三区四区| 日韩精品乱码av一区二区| 日韩欧美在线一区二区三区| 国产一区二区三区四| 中文字幕一区av| 欧美系列日韩一区| 久久国产尿小便嘘嘘尿| 欧美国产日韩亚洲一区| 色噜噜久久综合| 日韩1区2区3区| 中文字幕不卡在线观看| 欧美日韩亚洲综合| 国产精品主播直播| 亚洲精品免费看| 久久久无码精品亚洲日韩按摩| 91美女视频网站| 久久精品国产免费| 亚洲人成影院在线观看| 26uuu久久天堂性欧美| 在线看一区二区| 国产盗摄精品一区二区三区在线 | 久久久久久久久久久久久夜| 91看片淫黄大片一级在线观看| 日韩1区2区3区| 亚洲欧美欧美一区二区三区| 欧美xfplay| 91成人免费网站| 成人手机电影网| 极品少妇xxxx精品少妇| 亚洲 欧美综合在线网络| 欧美高清在线精品一区| 欧美一区二区久久久| 色婷婷国产精品| 岛国精品在线播放| 蜜臀国产一区二区三区在线播放| 亚洲激情中文1区| 国产午夜久久久久| 日韩一区二区三区免费看 | 亚洲免费在线电影| 久久精品视频免费| 7777精品伊人久久久大香线蕉的 | av亚洲产国偷v产偷v自拍| 久久精品国产77777蜜臀| 亚洲日本青草视频在线怡红院| 欧美mv和日韩mv国产网站| 欧美日本在线一区| 色婷婷av一区二区三区大白胸| 不卡的看片网站| 成人a免费在线看| caoporen国产精品视频| 国产另类ts人妖一区二区| 免费看日韩精品| 免费一级欧美片在线观看| 天天操天天色综合| 天天综合日日夜夜精品| 亚洲线精品一区二区三区八戒| 亚洲视频香蕉人妖| 国产精品三级在线观看| 亚洲国产激情av| 自拍偷拍亚洲欧美日韩| 亚洲视频在线观看一区| 中文字幕佐山爱一区二区免费| 中文字幕一区免费在线观看| 中文字幕一区二区三区在线不卡| 国产精品久久久一本精品 | 风间由美一区二区三区在线观看| 韩国v欧美v亚洲v日本v| 国产麻豆视频一区二区| www.在线欧美| 色婷婷久久99综合精品jk白丝| 99国产精品一区| 欧美视频完全免费看| 538在线一区二区精品国产| 91精品国产入口| 久久先锋影音av鲁色资源网| 中文成人综合网| 亚洲最大成人综合| 蜜桃在线一区二区三区| 国产乱子轮精品视频| av一本久道久久综合久久鬼色| 99re成人在线| 91精品综合久久久久久| 久久久三级国产网站| 亚洲人成在线观看一区二区| 亚洲成人免费视频| 国产精品一区二区男女羞羞无遮挡 | 亚洲综合色婷婷| 免费成人在线视频观看| 成人毛片老司机大片| 欧美亚洲国产一区二区三区va| 精品国产一区a| 亚洲天堂成人网| 韩国v欧美v亚洲v日本v| 日本高清不卡视频| 久久综合成人精品亚洲另类欧美| 国产精品福利一区二区| 午夜电影一区二区| 成人毛片视频在线观看| 日韩一区二区三区三四区视频在线观看 | 亚洲高清一区二区三区| 狠狠色狠狠色综合系列| 色八戒一区二区三区| 欧美不卡一区二区三区| 亚洲女女做受ⅹxx高潮| 国产在线播放一区三区四| 精品视频全国免费看| 国产亚洲一区字幕| 日本免费新一区视频|