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

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

?? os_time.c

?? 在ATmega16芯片上移植的ucosii系統應用
?? C
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                             TIME MANAGEMENT
*
*                          (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File    : OS_TIME.C
* By      : Jean J. Labrosse
* Version : V2.76
*********************************************************************************************************
*/

#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)
{
    INT8U      y;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                  /* Prevent compiler warning                           */
#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)
{
    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)
{
    OS_TCB    *ptcb;
#if OS_CRITICAL_METHOD == 3                                    /* Storage for CPU status register      */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                                /* Prevent compiler warning             */
#endif    
    if (prio >= OS_LOWEST_PRIO) {
        return (OS_PRIO_INVALID);
    }
    OS_ENTER_CRITICAL();
    ptcb = (OS_TCB *)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  = TRUE;                             /* Indicate PEND timeout                */
    } else {
        ptcb->OSTCBPendTO  = 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)
{
    INT32U     ticks;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                  /* Prevent compiler warning                           */
#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)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                  /* Prevent compiler warning                           */
#endif    
    OS_ENTER_CRITICAL();
    OSTime = ticks;
    OS_EXIT_CRITICAL();
}
#endif    

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久婷婷国产综合精品| 国产丶欧美丶日本不卡视频| 中文无字幕一区二区三区| 91精品国产福利| 欧美一级日韩一级| 日韩欧美国产系列| 亚洲精品在线电影| 精品国产制服丝袜高跟| 精品国产一区a| 欧美韩国日本一区| √…a在线天堂一区| 亚洲精品国产a久久久久久| 亚洲一区二区三区四区五区黄| 亚洲黄色性网站| 婷婷夜色潮精品综合在线| 日本不卡视频在线| 国产一区二区毛片| eeuss鲁片一区二区三区在线看| www.亚洲国产| 在线看日韩精品电影| 欧美一级高清大全免费观看| 日韩女优电影在线观看| 久久久久成人黄色影片| 日韩一区日韩二区| 午夜国产不卡在线观看视频| 精品午夜久久福利影院| 高清成人在线观看| 在线亚洲高清视频| 精品国偷自产国产一区| 中文字幕一区二区在线观看| 香蕉成人伊视频在线观看| 国产一区二区精品久久91| 91丨国产丨九色丨pron| 日韩精品中文字幕在线不卡尤物| 国产精品天美传媒| 亚洲成a人v欧美综合天堂| 国产一区 二区| 欧美丝袜第三区| 久久久国产午夜精品| 一级精品视频在线观看宜春院| 久久国产精品72免费观看| av一本久道久久综合久久鬼色| 欧美亚洲自拍偷拍| 国产精品久久久久一区| 日韩高清在线不卡| 97精品视频在线观看自产线路二| 欧美肥妇free| 亚洲精品国产a久久久久久| 国产一区二区精品久久91| 欧美日韩国产a| 亚洲女与黑人做爰| 国产一区二区三区不卡在线观看 | 成人av网在线| 欧美日韩在线亚洲一区蜜芽| 国产精品国产三级国产aⅴ中文 | 国产电影精品久久禁18| 欧美高清dvd| 亚洲精品免费在线观看| 顶级嫩模精品视频在线看| 欧美一级久久久久久久大片| 一区二区三区在线免费观看| 国产电影一区二区三区| 久久婷婷成人综合色| 日本91福利区| 欧美三级中文字幕在线观看| 成人免费在线视频| 国产大陆精品国产| 久久精品一二三| 激情五月播播久久久精品| 日韩一二三区视频| 日韩国产高清在线| 欧美日本一区二区| 日韩国产高清影视| 欧美一区二区三区视频在线| 日日夜夜精品视频免费| 欧美日韩免费不卡视频一区二区三区 | 91小视频在线| 国产精品久久久久久久久免费丝袜 | 欧美日韩综合一区| 亚洲自拍偷拍麻豆| 欧美日韩视频一区二区| 亚洲va在线va天堂| 91精品国产全国免费观看 | 久久九九全国免费| 国产成人精品免费看| 久久久久久久久97黄色工厂| 国产精品888| 国产精品久久久久久妇女6080 | 亚洲免费在线播放| 色婷婷激情综合| 亚洲成人手机在线| 欧美大片一区二区| 国产黄色91视频| 国产精品成人一区二区三区夜夜夜| 波多野结衣亚洲| 亚洲激情av在线| 日韩欧美国产精品| 成人免费视频视频| 一区二区三区免费看视频| 欧美另类高清zo欧美| 麻豆成人免费电影| 国产精品久久久久久一区二区三区| 97久久精品人人做人人爽| 日韩精品一二三| 久久久国产精品午夜一区ai换脸| 91视频观看免费| 午夜精品视频在线观看| 久久精品免视看| 色哟哟国产精品免费观看| 欧美96一区二区免费视频| 国产喷白浆一区二区三区| 欧洲精品一区二区三区在线观看| 久色婷婷小香蕉久久| 中文字幕一区二区三区四区| 欧美美女网站色| 成年人国产精品| 免费在线观看视频一区| 成人免费一区二区三区视频| 欧美一级免费大片| 一本色道a无线码一区v| 久久激情五月激情| 亚洲综合一二区| 久久久久99精品一区| 4438x成人网最大色成网站| 福利视频网站一区二区三区| 午夜一区二区三区视频| 中日韩av电影| 久久久久久一二三区| 91精品免费观看| 91麻豆自制传媒国产之光| 国产精品一区二区三区99| 亚洲午夜视频在线观看| 一色桃子久久精品亚洲| 欧美xxx久久| 欧美美女喷水视频| 91视频免费观看| 白白色 亚洲乱淫| 成人免费电影视频| 激情小说亚洲一区| 久久99精品国产麻豆不卡| 午夜精品123| 亚洲成人av资源| 亚洲综合在线第一页| 亚洲欧美另类久久久精品| 国产精品网友自拍| 久久精品人人爽人人爽| 久久久久久久久久看片| 日韩免费看的电影| 91精品国产入口| 91精品午夜视频| 欧美精品在线观看播放| 欧美日韩在线播放一区| 欧美特级限制片免费在线观看| 91蜜桃传媒精品久久久一区二区| 99久久精品免费看| 99久久久国产精品| 色悠悠久久综合| 欧美日韩一区二区三区高清 | 老司机精品视频在线| 蜜桃视频在线观看一区| 蜜乳av一区二区三区| 蜜桃久久av一区| 精品一区二区三区久久久| 久久不见久久见中文字幕免费| 久久精品99国产精品日本| 国产一区二区三区| 国产91精品久久久久久久网曝门| 成人免费不卡视频| 91国产免费看| 4438x成人网最大色成网站| 欧美一级二级在线观看| 国产肉丝袜一区二区| 亚洲人一二三区| 日本大胆欧美人术艺术动态| 激情综合网av| 99国产精品久久久久久久久久久| 99国产欧美另类久久久精品| 欧美日韩国产综合视频在线观看 | 国产精品中文字幕日韩精品 | 久久久国际精品| 久久久99精品久久| 国产精品高清亚洲| 亚洲免费观看高清完整版在线观看熊| 中文字幕的久久| 欧美亚日韩国产aⅴ精品中极品| 精品国产伦一区二区三区观看方式| 亚洲图片一区二区| 91视频在线看| 亚洲日穴在线视频| 成人精品gif动图一区| 国产日韩欧美电影| 国产经典欧美精品| 国产日韩视频一区二区三区| 国产主播一区二区三区| 精品国产乱码久久久久久1区2区| 免费日本视频一区| 日韩欧美中文字幕公布| 日本不卡123| 欧美刺激午夜性久久久久久久| 日韩和欧美的一区|