1 #ifndef _IPXE_BIOS_TIMER_H
2 #define _IPXE_BIOS_TIMER_H
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13 #define TIMER_PREFIX_pcbios
15 #define TIMER_PREFIX_pcbios __pcbios_
18 #include <ipxe/pit8254.h>
21 * Delay for a fixed number of microseconds
23 * @v usecs Number of microseconds for which to delay
25 static inline __always_inline void
26 TIMER_INLINE ( pcbios, udelay ) ( unsigned long usecs ) {
27 /* BIOS timer is not high-resolution enough for udelay(), so
28 * we use the 8254 Programmable Interval Timer.
30 pit8254_udelay ( usecs );
34 * Get number of ticks per second
36 * @ret ticks_per_sec Number of ticks per second
38 static inline __always_inline unsigned long
39 TIMER_INLINE ( pcbios, ticks_per_sec ) ( void ) {
40 /* BIOS timer ticks over at 18.2 ticks per second */
44 #endif /* _IPXE_BIOS_TIMER_H */