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

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

?? os_time.c

?? 基于ARM7處理器的中斷與串口在ucos下切換的演示程序
?? C
字號:
/*
*********************************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                             TIME MANAGEMENT
*
*                          (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
*                                           All Rights Reserved
*
* File : OS_TIME.C
* By   : Jean J. Labrosse
*********************************************************************************************************
*/

#ifndef  OS_MASTER_FILE
#include "includes.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)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    


    if (ticks > 0) {                                                      /* 0 means no delay!         */
        OS_ENTER_CRITICAL();
        if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0) {  /* Delay current task        */
            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 (hours > 0 || minutes > 0 || seconds > 0 || milli > 0) {
        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);
        }
                                                 /* 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(32768);
            OSTimeDly(32768);
            loops--;
        }
        return (OS_NO_ERR);
    }
    return (OS_TIME_ZERO_DLY);
}
#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 MUST NOT call this function to resume a
*              task that is waiting for an event with timeout.  This situation would make the task look
*              like a timeout occurred (unless you desire this effect).  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
*********************************************************************************************************
*/

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


    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) {
        if (ptcb->OSTCBDly != 0) {                         /* See if task is delayed                   */
            ptcb->OSTCBDly  = 0;                           /* Clear the time delay                     */
            if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) {  /* See if task is ready to run  */
                OSRdyGrp               |= ptcb->OSTCBBitY;             /* Make task ready to run       */
                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);
        } else {
            OS_EXIT_CRITICAL();
            return (OS_TIME_NOT_DLY);                      /* Indicate that task was not delayed       */
        }
    }
    OS_EXIT_CRITICAL();
    return (OS_TASK_NOT_EXIST);                            /* The task does not exist                  */
}
#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)
{
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;
#endif    
    INT32U     ticks;


    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;
#endif    


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

//
// 延時毫秒級 
//
void delay( INT16U milliseconds) 
{
	INT32U temp = milliseconds / (1000 / OS_TICKS_PER_SEC);

	if( temp == 0 )
		OSTimeDly(1);
	else
		OSTimeDly( temp );
}

/*
 * Return the difference between t and the current system elapsed
 *  time in milliseconds.
 */
LONG diffTime(ULONG t)
{
	return 0;
}

// Time diff in jiffys, between system time in jiffys and time in jiffys
// !!!NOTICE!!!
// If time is newer than system time this functions returns a value > 0
// If time is older than system time this functions returns a value < 0 (NEGATIVE VALUE)
long diffJTime(ULONG time)
{
    return time>OSTimeGet()?1:-1;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人激情视频网站| 欧美日韩一卡二卡| 日韩影视精彩在线| 国产色一区二区| 6080午夜不卡| 波波电影院一区二区三区| 免费欧美在线视频| 亚洲制服丝袜在线| 国产精品免费观看视频| 日韩一区二区三区视频| 欧美在线不卡一区| 国产69精品久久久久毛片 | 精品一区二区在线视频| 亚洲一区二区三区中文字幕| 欧美国产乱子伦| 日韩你懂的在线播放| 色综合久久久久综合体| 国产一区999| 久久99精品久久只有精品| 亚洲影院在线观看| 亚洲欧美aⅴ...| 中文字幕乱码亚洲精品一区| 亚洲精品一区在线观看| 91精品午夜视频| 精品视频一区三区九区| 一本一道久久a久久精品 | 极品少妇一区二区三区精品视频| 亚洲一区二区偷拍精品| 椎名由奈av一区二区三区| 国产日韩欧美a| 久久蜜桃香蕉精品一区二区三区| 91麻豆精品国产91久久久| 欧美在线一二三| 91免费版在线| 91免费版pro下载短视频| 成人av网在线| 成人sese在线| 成人av电影在线| 成人激情开心网| 成人黄色综合网站| www.亚洲免费av| 不卡电影一区二区三区| 99国产麻豆精品| 91美女片黄在线| 91国偷自产一区二区开放时间| 一本到一区二区三区| 色婷婷综合久久久久中文一区二区| 不卡高清视频专区| 色天天综合久久久久综合片| 色吊一区二区三区| 欧美视频一区二区在线观看| 欧美日韩日日摸| 91精品国产综合久久婷婷香蕉| 91精品国产一区二区三区香蕉| 欧美一区二区三区性视频| 日韩一级高清毛片| 久久日一线二线三线suv| 国产日韩精品一区| 亚洲日本乱码在线观看| 亚洲自拍偷拍图区| 热久久免费视频| 精品一区免费av| 日本一区二区三区dvd视频在线| 国产福利一区在线观看| 国产在线精品国自产拍免费| 国产精品一级片| 成人av中文字幕| 91久久久免费一区二区| 69堂亚洲精品首页| 精品国产一区二区亚洲人成毛片 | 亚洲一区二区三区中文字幕 | 男人的天堂亚洲一区| 精品一区二区三区免费视频| 懂色av中文字幕一区二区三区| 99久久er热在这里只有精品15| 欧美日韩一区三区| 精品日韩一区二区三区免费视频| 欧美国产日本韩| 午夜精品国产更新| 国产一区二区免费在线| 色综合夜色一区| 精品女同一区二区| 亚洲男同性视频| 美女任你摸久久| 91美女在线看| 亚洲精品一区二区三区在线观看| 中文字幕一区二区三区乱码在线| 日韩avvvv在线播放| 国产精品18久久久久| 在线日韩国产精品| 久久久噜噜噜久久中文字幕色伊伊| 国产精品久久99| 久久精品国产在热久久| 色天使久久综合网天天| 久久久久亚洲综合| 三级在线观看一区二区| 不卡一区二区三区四区| 日韩精品资源二区在线| 亚洲午夜精品17c| 国产成人综合网| 欧美一区二区三区免费视频| ...中文天堂在线一区| 九九热在线视频观看这里只有精品| 色综合色综合色综合色综合色综合 | 国产精品美女一区二区三区| 日本aⅴ亚洲精品中文乱码| 91老师国产黑色丝袜在线| 久久综合九色综合欧美亚洲| 亚洲福利一区二区| 99精品视频中文字幕| 久久噜噜亚洲综合| 日韩av一区二区三区四区| 91极品美女在线| 国产精品无遮挡| 国产一区二区三区| 日韩三级中文字幕| 亚洲第一在线综合网站| 91免费视频大全| 国产欧美日韩视频一区二区| 久久99精品久久久久婷婷| 91麻豆精品国产自产在线观看一区| 亚洲裸体在线观看| gogogo免费视频观看亚洲一| 欧美激情综合网| 国内精品在线播放| 欧美电影免费提供在线观看| 免费成人在线网站| 91精品国产综合久久香蕉的特点 | 国产在线精品一区二区不卡了| 欧美一区二区三区免费在线看| 午夜欧美大尺度福利影院在线看| 色8久久精品久久久久久蜜| 最新中文字幕一区二区三区 | 欧美日韩国产大片| 亚洲丶国产丶欧美一区二区三区| 在线精品亚洲一区二区不卡| 亚洲精品国产无天堂网2021| 色综合久久久久综合体| 夜夜亚洲天天久久| 欧美亚洲高清一区| 午夜精品影院在线观看| 欧美精品第1页| 免费看黄色91| 久久青草欧美一区二区三区| 国产91精品一区二区麻豆网站| 国产精品三级在线观看| 99re亚洲国产精品| 亚洲一区二区三区四区在线| 欧美日韩1234| 久久国产日韩欧美精品| 久久九九影视网| 99久久综合国产精品| 亚洲自拍偷拍av| 日韩欧美高清dvd碟片| 国产一区啦啦啦在线观看| 国产精品天干天干在观线| 色婷婷av一区二区三区软件| 图片区小说区国产精品视频| 日韩精品一区二区三区视频播放| 国产一区二区在线影院| 中文字幕av一区 二区| 99久久99久久久精品齐齐| 亚洲综合自拍偷拍| 欧美在线观看18| 精品一区二区三区在线观看国产| 精品粉嫩超白一线天av| 国产一区福利在线| 伊人色综合久久天天人手人婷| 欧洲中文字幕精品| 午夜精品久久久久久久久久| 色88888久久久久久影院按摩| 日韩电影在线免费观看| 欧美变态tickle挠乳网站| 激情综合色播激情啊| 久久久久久久av麻豆果冻| 91亚洲精华国产精华精华液| 亚洲午夜在线视频| 欧美一区二区三区视频在线观看 | 精品在线你懂的| 亚洲视频 欧洲视频| 欧美日韩一区二区三区高清| 日本成人在线网站| 久久久亚洲精华液精华液精华液| 色婷婷一区二区| 美女视频一区在线观看| 国产精品久久免费看| 欧美丰满少妇xxxbbb| 另类调教123区| 国产精品国产三级国产aⅴ中文| 色噜噜狠狠色综合中国| 韩国成人在线视频| 亚洲欧美综合在线精品| 欧美剧情片在线观看| 一区二区三区在线看| 国产日韩精品一区| 精品视频在线视频| 国产乱淫av一区二区三区| 偷窥少妇高潮呻吟av久久免费| 久久免费的精品国产v∧| 欧美视频日韩视频|