summaryrefslogtreecommitdiffstats
path: root/src/include
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
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')
-rw-r--r--src/include/gpxe/init.h11
-rw-r--r--src/include/gpxe/timer.h32
2 files changed, 22 insertions, 21 deletions
diff --git a/src/include/gpxe/init.h b/src/include/gpxe/init.h
index a5caa3e0..d83aa5e5 100644
--- a/src/include/gpxe/init.h
+++ b/src/include/gpxe/init.h
@@ -22,7 +22,8 @@ struct init_fn {
*/
#define INIT_EARLY 01 /**< Early initialisation */
-#define INIT_NORMAL 02 /**< Normal initialisation */
+#define INIT_CONSOLE 02 /**< Console initialisation */
+#define INIT_NORMAL 03 /**< Normal initialisation */
/** @} */
@@ -54,14 +55,6 @@ struct startup_fn {
/** @} */
-/* Use double digits to avoid problems with "10" < "9" on alphabetic sort */
-#define INIT_CONSOLE 02
-#define INIT_GDBSYM 03
-#define INIT_CPU 04
-#define INIT_TIMERS 05
-#define INIT_LOADBUF 08
-#define INIT_PCMCIA 09
-
extern void initialise ( void );
extern void startup ( void );
extern void shutdown ( void );
diff --git a/src/include/gpxe/timer.h b/src/include/gpxe/timer.h
index 4a4cf5b2..ecd30001 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 */