From 2652abdc5f42f623ce4abf0efc117dc4f0d20474 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 18 Mar 2008 14:48:28 +0000 Subject: [Timers] Miscellaneous timer system fixes Add missing comments to timer code. Lock system if no suitable timer source is found. Fix initialisation order so that timers are initialised before code that needs to use them. --- src/include/gpxe/timer.h | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src/include/gpxe/timer.h') diff --git a/src/include/gpxe/timer.h b/src/include/gpxe/timer.h index 4a4cf5b2f..ecd300015 100644 --- a/src/include/gpxe/timer.h +++ b/src/include/gpxe/timer.h @@ -3,7 +3,7 @@ #include -typedef uint32_t tick_t; +typedef unsigned long tick_t; #define MSECS_IN_SEC (1000) #define USECS_IN_SEC (1000*1000) @@ -11,22 +11,30 @@ typedef uint32_t tick_t; #define TICKS_PER_SEC USECS_IN_SEC -tick_t currticks(void); +extern tick_t currticks ( void ); -void generic_currticks_udelay(unsigned int usecs); +extern void generic_currticks_udelay ( unsigned int usecs ); +/** A timer */ struct timer { - /* Returns zero on successful initialisation. */ - int (*init) (void); - - /* Return the current time, int mictoseconds since the beginning. */ - tick_t (*currticks) (void); - - /* Sleep for a few useconds. */ - void (*udelay) (unsigned int useconds); + /** Initialise timer + * + * @ret rc Return status code + */ + int ( * init ) ( void ); + /** Read current time + * + * @ret ticks Current time, in ticks + */ + tick_t ( * currticks ) ( void ); + /** Delay + * + * @v usecs Time to delay, in microseconds + */ + void ( * udelay ) ( unsigned int usecs ); }; -#define __timer(order) __table (struct timer, timers, order) +#define __timer( order ) __table ( struct timer, timers, order ) #endif /* GPXE_TIMER_H */ -- cgit v1.2.3-55-g7522