timer.h

Go to the documentation of this file.
00001 #ifndef _GPXE_TIMER_H
00002 #define _GPXE_TIMER_H
00003 
00004 /** @file
00005  *
00006  * gPXE timer API
00007  *
00008  * The timer API provides udelay() for fixed delays, and currticks()
00009  * for a monotonically increasing tick counter.
00010  */
00011 
00012 FILE_LICENCE ( GPL2_OR_LATER );
00013 
00014 #include <gpxe/api.h>
00015 #include <config/timer.h>
00016 
00017 /**
00018  * Calculate static inline timer API function name
00019  *
00020  * @v _prefix           Subsystem prefix
00021  * @v _api_func         API function
00022  * @ret _subsys_func    Subsystem API function
00023  */
00024 #define TIMER_INLINE( _subsys, _api_func ) \
00025         SINGLE_API_INLINE ( TIMER_PREFIX_ ## _subsys, _api_func )
00026 
00027 /**
00028  * Provide a timer API implementation
00029  *
00030  * @v _prefix           Subsystem prefix
00031  * @v _api_func         API function
00032  * @v _func             Implementing function
00033  */
00034 #define PROVIDE_TIMER( _subsys, _api_func, _func ) \
00035         PROVIDE_SINGLE_API ( TIMER_PREFIX_ ## _subsys, _api_func, _func )
00036 
00037 /**
00038  * Provide a static inline timer API implementation
00039  *
00040  * @v _prefix           Subsystem prefix
00041  * @v _api_func         API function
00042  */
00043 #define PROVIDE_TIMER_INLINE( _subsys, _api_func ) \
00044         PROVIDE_SINGLE_API_INLINE ( TIMER_PREFIX_ ## _subsys, _api_func )
00045 
00046 /* Include all architecture-independent I/O API headers */
00047 #include <gpxe/efi/efi_timer.h>
00048 
00049 /* Include all architecture-dependent I/O API headers */
00050 #include <bits/timer.h>
00051 
00052 /**
00053  * Delay for a fixed number of microseconds
00054  *
00055  * @v usecs             Number of microseconds for which to delay
00056  */
00057 void udelay ( unsigned long usecs );
00058 
00059 /**
00060  * Get current system time in ticks
00061  *
00062  * @ret ticks           Current time, in ticks
00063  */
00064 unsigned long currticks ( void );
00065 
00066 /**
00067  * Get number of ticks per second
00068  *
00069  * @ret ticks_per_sec   Number of ticks per second
00070  */
00071 unsigned long ticks_per_sec ( void );
00072 
00073 /** Number of ticks per second */
00074 #define TICKS_PER_SEC ( ticks_per_sec() )
00075 
00076 #endif /* _GPXE_TIMER_H */

Generated on Tue Apr 6 20:00:51 2010 for gPXE by  doxygen 1.5.7.1