[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.
This commit is contained in:
Michael Brown
2008-03-18 14:48:28 +00:00
parent 03398e3389
commit 2652abdc5f
4 changed files with 60 additions and 44 deletions
+20 -12
View File
@@ -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 */