summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/timer.h
diff options
context:
space:
mode:
authorMichael Brown2008-03-18 15:48:28 +0100
committerMichael Brown2008-03-18 15:48:28 +0100
commit2652abdc5f42f623ce4abf0efc117dc4f0d20474 (patch)
treec15ea19010d37aa352413c054a6f319de248422c /src/include/gpxe/timer.h
parent[Settings] Allow encapsulated options to be specified as named settings (diff)
downloadipxe-2652abdc5f42f623ce4abf0efc117dc4f0d20474.tar.gz
ipxe-2652abdc5f42f623ce4abf0efc117dc4f0d20474.tar.xz
ipxe-2652abdc5f42f623ce4abf0efc117dc4f0d20474.zip
[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.
Diffstat (limited to 'src/include/gpxe/timer.h')
-rw-r--r--src/include/gpxe/timer.h32
1 files changed, 20 insertions, 12 deletions
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 <stddef.h>
-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 */