You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bios_timer.h 855B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _IPXE_BIOS_TIMER_H
  2. #define _IPXE_BIOS_TIMER_H
  3. /** @file
  4. *
  5. * BIOS timer
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER );
  9. #ifdef TIMER_PCBIOS
  10. #define TIMER_PREFIX_pcbios
  11. #else
  12. #define TIMER_PREFIX_pcbios __pcbios_
  13. #endif
  14. #include <ipxe/timer2.h>
  15. /**
  16. * Delay for a fixed number of microseconds
  17. *
  18. * @v usecs Number of microseconds for which to delay
  19. */
  20. static inline __always_inline void
  21. TIMER_INLINE ( pcbios, udelay ) ( unsigned long usecs ) {
  22. /* BIOS timer is not high-resolution enough for udelay(), so
  23. * we use timer2
  24. */
  25. timer2_udelay ( usecs );
  26. }
  27. /**
  28. * Get number of ticks per second
  29. *
  30. * @ret ticks_per_sec Number of ticks per second
  31. */
  32. static inline __always_inline unsigned long
  33. TIMER_INLINE ( pcbios, ticks_per_sec ) ( void ) {
  34. /* BIOS timer ticks over at 18.2 ticks per second */
  35. return 18;
  36. }
  37. #endif /* _IPXE_BIOS_TIMER_H */