⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ztimer.c

📁 uboot在arm处理器s3c2410的移植代码
💻 C
📖 第 1 页 / 共 2 页
字号:
PARAMETERS:tm  - Timer object to compute the elapsed time with.RETURNS:Count that has elapsed in microseconds.REMARKS:Returns the current count that has elapsed between calls toLZTimerOn and LZTimerOff in microseconds.SEE ALSO:LZTimerOn, LZTimerOff, LZTimerLap****************************************************************************/ulong ZAPI LZTimerCountExt(    LZTimerObject *tm){#ifdef  __INTEL__    CPU_largeInteger    tmCount;    if (haveRDTSC) {	_CPU_diffTime64(&tm->start,&tm->end,&tmCount);	return _CPU_calcMicroSec(&tmCount,cpuSpeed);	}    else#endif	return __LZTimerCount(tm);}/****************************************************************************DESCRIPTION:Starts the Long Period Zen Timer counting.HEADER:ztimer.hREMARKS:Obsolete function. You should use the LZTimerOnExt function insteadwhich allows for multiple timers running at the same time.****************************************************************************/void ZAPI LZTimerOn(void){ LZTimerOnExt(&LZTimer); }/****************************************************************************DESCRIPTION:Returns the current count for the Long Period Zen Timer and keeps itrunning.HEADER:ztimer.hRETURNS:Count that has elapsed in microseconds.REMARKS:Obsolete function. You should use the LZTimerLapExt function insteadwhich allows for multiple timers running at the same time.****************************************************************************/ulong ZAPI LZTimerLap(void){ return LZTimerLapExt(&LZTimer); }/****************************************************************************DESCRIPTION:Stops the Long Period Zen Timer counting.HEADER:ztimer.hREMARKS:Obsolete function. You should use the LZTimerOffExt function insteadwhich allows for multiple timers running at the same time.****************************************************************************/void ZAPI LZTimerOff(void){ LZTimerOffExt(&LZTimer); }/****************************************************************************DESCRIPTION:Returns the current count for the Long Period Zen Timer.HEADER:ztimer.hRETURNS:Count that has elapsed in microseconds.REMARKS:Obsolete function. You should use the LZTimerCountExt function insteadwhich allows for multiple timers running at the same time.****************************************************************************/ulong ZAPI LZTimerCount(void){ return LZTimerCountExt(&LZTimer); }/****************************************************************************DESCRIPTION:Starts the Ultra Long Period Zen Timer counting.HEADER:ztimer.hREMARKS:Starts the Ultra Long Period Zen Timer counting. Once you have started thetimer, you can stop it with ULZTimerOff or you can latch the current countwith ULZTimerLap.The Ultra Long Period Zen Timer uses the available operating system servicesto obtain accurate timings results with as much precision as the operatingsystem provides, but with enough granularity to time longer periods oftime than the Long Period Zen Timer. Note that the resolution of the timerticks is not constant between different platforms, and you should use theULZTimerResolution function to determine the number of seconds in a singletick of the timer, and use this to convert the timer counts to seconds.Under 32-bit Windows, we use the timeGetTime function which provides aresolution of 1 millisecond (0.001 of a second). Given that the timercount is returned as an unsigned 32-bit integer, this we can time intervalsthat are a maximum of 2^32 milliseconds in length (or about 1,200 hours or50 days!).Under 32-bit DOS, we use the system timer tick which runs at 18.2 times persecond. Given that the timer count is returned as an unsigned 32-bit integer,this we can time intervals that are a maximum of 2^32 * (1/18.2) in length(or about 65,550 hours or 2731 days!).SEE ALSO:ULZTimerOff, ULZTimerLap, ULZTimerCount, ULZElapsedTime, ULZReadTime****************************************************************************/void ZAPI ULZTimerOn(void){ start = __ULZReadTime(); }/****************************************************************************DESCRIPTION:Returns the current count for the Ultra Long Period Zen Timer and keeps itrunning.HEADER:ztimer.hRETURNS:Count that has elapsed in resolution counts.REMARKS:Returns the current count that has elapsed since the last call toULZTimerOn in microseconds. The time continues to run after this function iscalled so you can call this function repeatedly.SEE ALSO:ULZTimerOn, ULZTimerOff, ULZTimerCount****************************************************************************/ulong ZAPI ULZTimerLap(void){ return (__ULZReadTime() - start); }/****************************************************************************DESCRIPTION:Stops the Long Period Zen Timer counting.HEADER:ztimer.hREMARKS:Stops the Ultra Long Period Zen Timer counting and latches the count. Onceyou have stopped the timer you can read the count with ULZTimerCount.SEE ALSO:ULZTimerOn, ULZTimerLap, ULZTimerCount****************************************************************************/void ZAPI ULZTimerOff(void){ finish = __ULZReadTime(); }/****************************************************************************DESCRIPTION:Returns the current count for the Ultra Long Period Zen Timer.HEADER:ztimer.hRETURNS:Count that has elapsed in resolution counts.REMARKS:Returns the current count that has elapsed between calls toULZTimerOn and ULZTimerOff in resolution counts.SEE ALSO:ULZTimerOn, ULZTimerOff, ULZTimerLap, ULZTimerResolution****************************************************************************/ulong ZAPI ULZTimerCount(void){ return (finish - start); }/****************************************************************************DESCRIPTION:Reads the current time from the Ultra Long Period Zen Timer.HEADER:ztimer.hRETURNS:Current timer value in resolution counts.REMARKS:Reads the current Ultra Long Period Zen Timer and returns it抯 currentcount. You can use the ULZElapsedTime function to find the elapsed timebetween two timer count readings.SEE ALSO:ULZElapsedTime, ULZTimerResolution****************************************************************************/ulong ZAPI ULZReadTime(void){ return __ULZReadTime(); }/****************************************************************************DESCRIPTION:Compute the elapsed time between two timer counts.HEADER:ztimer.hPARAMETERS:start   - Starting time for elapsed countfinish  - Ending time for elapsed countRETURNS:Elapsed timer in resolution counts.REMARKS:Returns the elapsed time for the Ultra Long Period Zen Timer in units of thetimers resolution (1/18th of a second under DOS). This function correctlycomputes the difference even if a midnight boundary has been crossedduring the timing period.SEE ALSO:ULZReadTime, ULZTimerResolution****************************************************************************/ulong ZAPI ULZElapsedTime(    ulong start,    ulong finish){ return __ULZElapsedTime(start,finish); }/****************************************************************************DESCRIPTION:Returns the resolution of the Ultra Long Period Zen Timer.HEADER:ztimer.hPARAMETERS:resolution   - Place to store the timer in microseconds per timer count.REMARKS:Returns the resolution of the Ultra Long Period Zen Timer as a 32-bitinteger value measured in microseconds per timer count.SEE ALSO:ULZReadTime, ULZElapsedTime, ULZTimerCount****************************************************************************/void ZAPI ULZTimerResolution(	ulong *resolution){ *resolution = ULZTIMER_RESOLUTION; }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -