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.

timer.h 745B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef GPXE_TIMER_H
  2. #define GPXE_TIMER_H
  3. #include <stddef.h>
  4. typedef unsigned long tick_t;
  5. #define MSECS_IN_SEC (1000)
  6. #define USECS_IN_SEC (1000*1000)
  7. #define USECS_IN_MSEC (1000)
  8. #define TICKS_PER_SEC USECS_IN_SEC
  9. extern tick_t currticks ( void );
  10. extern void generic_currticks_udelay ( unsigned int usecs );
  11. /** A timer */
  12. struct timer {
  13. /** Initialise timer
  14. *
  15. * @ret rc Return status code
  16. */
  17. int ( * init ) ( void );
  18. /** Read current time
  19. *
  20. * @ret ticks Current time, in ticks
  21. */
  22. tick_t ( * currticks ) ( void );
  23. /** Delay
  24. *
  25. * @v usecs Time to delay, in microseconds
  26. */
  27. void ( * udelay ) ( unsigned int usecs );
  28. };
  29. #define __timer( order ) __table ( struct timer, timers, order )
  30. #endif /* GPXE_TIMER_H */