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

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

?? os_time.c

?? ucos v2.62 安裝程序 附帶已移植到C8051F020的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    
    INT8U      y;


    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)	KCREENTRANT	
{
    INT32U ticks;
    INT16U loops;


    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);
    }
                                                 /* 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 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)	KCREENTRANT	
{
#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)	KCREENTRANT	
{
#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 OSTimeInit()  KCREENTRANT	
{	uint16 tmp = 0;
    TMOD &=0xf1;
	TMOD |=0x01;
	CKCON &=0xf0;//系統時鐘的12分頻 
    tmp = -(SYSCLK/12/TICKS); 
	TH0 =tmp/256;
	TL0 =tmp%256;
	TR0 = 1;
}    

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人的网站免费观看| 国产高清成人在线| 国产精品理伦片| 久久综合成人精品亚洲另类欧美 | 26uuu另类欧美亚洲曰本| 欧美美女bb生活片| 欧美电影在线免费观看| 制服.丝袜.亚洲.另类.中文| 欧美日韩精品一区二区在线播放| 91福利国产成人精品照片| 色天天综合色天天久久| 91理论电影在线观看| 在线观看日韩精品| 欧美精品 日韩| 久久午夜电影网| 国产精品灌醉下药二区| 亚洲欧美欧美一区二区三区| 亚洲国产欧美在线人成| 日韩精品国产精品| 国产精品66部| 91麻豆国产精品久久| 91一区二区在线| 欧美精品第1页| 久久精品亚洲精品国产欧美kt∨ | 色综合天天综合狠狠| 欧美三级资源在线| 久久先锋资源网| 亚洲伦理在线精品| 美女脱光内衣内裤视频久久影院| 久久国产麻豆精品| 99精品热视频| 日韩欧美一级二级| 亚洲男人的天堂网| 免费欧美在线视频| 一本色道久久综合亚洲91| 日韩女优av电影| 国产精品免费观看视频| 日韩国产欧美在线视频| 国产成人啪午夜精品网站男同| 色屁屁一区二区| 日韩精品一区国产麻豆| 亚洲精品免费电影| 国产乱淫av一区二区三区| 色域天天综合网| 久久免费国产精品| 午夜电影一区二区| 99久久国产免费看| www亚洲一区| 日韩国产欧美视频| 94-欧美-setu| 久久久亚洲欧洲日产国码αv| 一区二区日韩电影| 成人免费视频视频在线观看免费| 欧美二区三区的天堂| 亚洲一区免费观看| 成人免费黄色大片| 欧美精品一区二区三区蜜桃视频| 亚洲一区二区高清| 波多野结衣视频一区| 国产亚洲综合色| 另类人妖一区二区av| 欧美区在线观看| 一区二区三区鲁丝不卡| 99久久er热在这里只有精品66| 欧美激情综合五月色丁香| 久久99精品久久久久久动态图| 欧美年轻男男videosbes| 一区二区激情视频| 色婷婷激情综合| 亚洲综合在线第一页| 波多野结衣91| 亚洲免费观看高清在线观看| 国产白丝网站精品污在线入口| 久久综合国产精品| 成人一区二区三区中文字幕| 久久精品欧美日韩| 大白屁股一区二区视频| 国产欧美一区二区精品久导航 | 亚洲午夜一区二区| 精品视频在线看| 午夜精品久久久久久久| 欧美视频一区二| 亚洲成av人片| 51精品秘密在线观看| 奇米精品一区二区三区在线观看| 欧美一区二区三级| 黑人巨大精品欧美一区| 久久嫩草精品久久久精品一| 国产福利一区二区三区视频| 久久久99久久| 91美女蜜桃在线| 亚洲高清视频中文字幕| 欧美日韩mp4| 韩国中文字幕2020精品| 欧美激情综合在线| 欧美私人免费视频| 九九国产精品视频| **网站欧美大片在线观看| 91麻豆国产福利精品| 五月天网站亚洲| 久久久五月婷婷| 91蝌蚪porny九色| 三级影片在线观看欧美日韩一区二区| 欧美电影免费观看高清完整版 | 国产精品久久久久久久久图文区 | 欧美日韩的一区二区| 久草中文综合在线| 亚洲天堂av老司机| 欧美一区二区三区公司| 成人免费毛片app| 视频一区二区中文字幕| 国产视频一区二区在线观看| 欧美中文字幕不卡| 黄一区二区三区| 亚洲男同性恋视频| 亚洲精品在线观看视频| 在线观看不卡一区| 国产精品白丝av| 污片在线观看一区二区| 国产精品美女久久久久高潮| 欧美片在线播放| 色综合久久中文字幕综合网| 精品一区二区三区在线播放视频| 最新国产精品久久精品| 久久久久久一级片| 欧美一区二区三区公司| 91久久久免费一区二区| 国产不卡一区视频| 久久99精品久久久久久动态图| 一区二区三区四区在线| 国产欧美日韩在线| 欧美电视剧在线看免费| 欧美午夜理伦三级在线观看| 成人午夜免费视频| 国产精品12区| 久久69国产一区二区蜜臀| 亚洲电影一级黄| 亚洲主播在线观看| 一区二区三区在线不卡| 亚洲欧美一区二区三区极速播放 | 欧美综合在线视频| 99久久综合99久久综合网站| 国产一区二区三区观看| 久久精品国产第一区二区三区| 亚洲已满18点击进入久久| 亚洲欧美日韩国产成人精品影院| 国产精品久久久久久久久免费樱桃 | 成人欧美一区二区三区小说| 久久嫩草精品久久久精品| 精品久久久久一区| 精品国产三级a在线观看| 91精品国产色综合久久不卡蜜臀| 欧美三级三级三级| 欧美日韩在线三级| 欧美精品丝袜中出| 这里只有精品99re| 日韩欧美激情四射| 26uuu亚洲综合色欧美 | 成人综合婷婷国产精品久久蜜臀| 国产一区二区三区免费观看| 国产成人在线视频播放| 国产不卡在线一区| 一本大道久久a久久精品综合| 色哟哟一区二区三区| 欧美综合欧美视频| 67194成人在线观看| 日韩欧美国产一区二区三区| 精品乱人伦小说| 国产欧美一区二区在线| 亚洲日本成人在线观看| 亚洲高清视频的网址| 久久99九九99精品| 波多野结衣亚洲一区| 在线日韩av片| 日韩亚洲欧美综合| 久久久电影一区二区三区| 国产精品国产成人国产三级 | 国产免费观看久久| 亚洲精品成人在线| 琪琪久久久久日韩精品| 国产电影一区二区三区| 在线看国产一区| 日韩天堂在线观看| 中文字幕一区二区不卡| 亚洲mv大片欧洲mv大片精品| 国内久久精品视频| 在线一区二区观看| 久久久不卡网国产精品二区| 亚洲精品中文在线| 九九九精品视频| 在线观看免费视频综合| 国产日韩综合av| 午夜精品久久久久影视| 国产综合色产在线精品| 在线观看视频一区二区欧美日韩| 久久欧美一区二区| 香蕉久久一区二区不卡无毒影院| 国产东北露脸精品视频| 91精品国产免费| 亚洲最大成人网4388xx|