00001 /** @file hal/micro/system-timer.h 00002 * @brief Header file for system_timer APIs 00003 * 00004 * 00005 * <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. --> 00006 00007 */ 00008 00009 /** @addtogroup system_timer 00010 * @brief Functions that provide access to the system clock. 00011 * 00012 * A single system tick (as returned by ::halCommonGetInt16uMillisecondTick() and 00013 * ::halCommonGetInt32uMillisecondTick() ) is approximately 1 millisecond. 00014 * 00015 * - When used with a 32.768kHz crystal, the system tick is 0.976 milliseconds. 00016 * 00017 * - When used with a 3.6864MHz crystal, the system tick is 1.111 milliseconds. 00018 * 00019 * A single quarter-second tick (as returned by 00020 * ::halCommonGetInt16uQuarterSecondTick() ) is approximately 0.25 seconds. 00021 * 00022 * The values used by the time support functions will wrap after an interval. 00023 * The length of the interval depends on the length of the tick and the number 00024 * of bits in the value. However, there is no issue when comparing time deltas 00025 * of less than half this interval with a subtraction, if all data types are the 00026 * same. 00027 * 00028 * See system-timer.h for source code. 00029 *@{ 00030 */ 00031 00032 #ifndef __SYSTEM_TIMER_H__ 00033 #define __SYSTEM_TIMER_H__ 00034 00035 /** 00036 * @brief Initializes the system tick. 00037 * 00038 * @return Time to update the async registers after RTC is started (units of 100 00039 * microseconds). 00040 */ 00041 int16u halInternalStartSystemTimer(void); 00042 00043 00044 /** 00045 * @brief Returns the current system time in system ticks, as a 16-bit 00046 * value. 00047 * 00048 * @return The least significant 16 bits of the current system time, in system 00049 * ticks. 00050 */ 00051 #pragma pagezero_on // place this function in zero-page memory for xap 00052 int16u halCommonGetInt16uMillisecondTick(void); 00053 #pragma pagezero_off 00054 00055 /** 00056 * @brief Returns the current system time in system ticks, as a 32-bit 00057 * value. 00058 * 00059 * @nostackusage 00060 * 00061 * @return The least significant 32 bits of the current system time, in 00062 * system ticks. 00063 */ 00064 int32u halCommonGetInt32uMillisecondTick(void); 00065 00066 /** 00067 * @brief Returns the current system time in quarter second ticks, as a 00068 * 16-bit value. 00069 * 00070 * @nostackusage 00071 * 00072 * @return The least significant 16 bits of the current system time, in system 00073 * ticks multiplied by 256. 00074 */ 00075 int16u halCommonGetInt16uQuarterSecondTick(void); 00076 00077 #endif //__SYSTEM_TIMER_H__ 00078 00079 /**@} //END addtogroup 00080 */ 00081 00082 00083 00084