Home | History | Annotate | Download | only in gpxe
      1 #ifndef _GPXE_BIOS_TIMER_H
      2 #define _GPXE_BIOS_TIMER_H
      3 
      4 /** @file
      5  *
      6  * BIOS timer
      7  *
      8  */
      9 
     10 FILE_LICENCE ( GPL2_OR_LATER );
     11 
     12 #ifdef TIMER_PCBIOS
     13 #define TIMER_PREFIX_pcbios
     14 #else
     15 #define TIMER_PREFIX_pcbios __pcbios_
     16 #endif
     17 
     18 #include <gpxe/timer2.h>
     19 
     20 /**
     21  * Delay for a fixed number of microseconds
     22  *
     23  * @v usecs		Number of microseconds for which to delay
     24  */
     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 timer2
     29 	 */
     30 	timer2_udelay ( usecs );
     31 }
     32 
     33 /**
     34  * Get number of ticks per second
     35  *
     36  * @ret ticks_per_sec	Number of ticks per second
     37  */
     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 */
     41 	return 18;
     42 }
     43 
     44 #endif /* _GPXE_BIOS_TIMER_H */
     45