8 * The timer API provides udelay() for fixed delays, and currticks()
9 * for a monotonically increasing tick counter.
12 FILE_LICENCE ( GPL2_OR_LATER );
15 #include <config/timer.h>
18 * Calculate static inline timer API function name
20 * @v _prefix Subsystem prefix
21 * @v _api_func API function
22 * @ret _subsys_func Subsystem API function
24 #define TIMER_INLINE( _subsys, _api_func ) \
25 SINGLE_API_INLINE ( TIMER_PREFIX_ ## _subsys, _api_func )
28 * Provide a timer API implementation
30 * @v _prefix Subsystem prefix
31 * @v _api_func API function
32 * @v _func Implementing function
34 #define PROVIDE_TIMER( _subsys, _api_func, _func ) \
35 PROVIDE_SINGLE_API ( TIMER_PREFIX_ ## _subsys, _api_func, _func )
38 * Provide a static inline timer API implementation
40 * @v _prefix Subsystem prefix
41 * @v _api_func API function
43 #define PROVIDE_TIMER_INLINE( _subsys, _api_func ) \
44 PROVIDE_SINGLE_API_INLINE ( TIMER_PREFIX_ ## _subsys, _api_func )
46 /* Include all architecture-independent I/O API headers */
47 #include <ipxe/efi/efi_timer.h>
48 #include <ipxe/linux/linux_timer.h>
50 /* Include all architecture-dependent I/O API headers */
51 #include <bits/timer.h>
54 * Delay for a fixed number of microseconds
56 * @v usecs Number of microseconds for which to delay
58 void udelay ( unsigned long usecs );
61 * Get current system time in ticks
63 * @ret ticks Current time, in ticks
65 unsigned long currticks ( void );
68 * Get number of ticks per second
70 * @ret ticks_per_sec Number of ticks per second
72 unsigned long ticks_per_sec ( void );
74 /** Number of ticks per second */
75 #define TICKS_PER_SEC ( ticks_per_sec() )
77 #endif /* _IPXE_TIMER_H */