Contiki 2.6

system-timer.h

Go to the documentation of this file.
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 int16u halCommonGetInt16uMillisecondTick(void);
00052 
00053 /**
00054  * @brief Returns the current system time in system ticks, as a 32-bit
00055  * value.
00056  *
00057  * @nostackusage
00058  *
00059  * @return The least significant 32 bits of the current system time, in 
00060  * system ticks.
00061  */
00062 int32u halCommonGetInt32uMillisecondTick(void);
00063 
00064 /**
00065  * @brief Returns the current system time in quarter second ticks, as a
00066  * 16-bit value.
00067  *
00068  * @nostackusage
00069  *
00070  * @return The least significant 16 bits of the current system time, in system
00071  * ticks multiplied by 256.
00072  */
00073 int16u halCommonGetInt16uQuarterSecondTick(void);
00074 
00075 #endif //__SYSTEM_TIMER_H__
00076 
00077 /**@} //END addtogroup 
00078  */
00079 
00080 
00081 
00082