summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe/timer.h
blob: 4a4cf5b2ff02c19accc189aecae394836b7aae13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef	GPXE_TIMER_H
#define GPXE_TIMER_H

#include <stddef.h>

typedef uint32_t tick_t;

#define MSECS_IN_SEC (1000)
#define USECS_IN_SEC (1000*1000)
#define USECS_IN_MSEC (1000)

#define	TICKS_PER_SEC	USECS_IN_SEC

tick_t currticks(void);

void generic_currticks_udelay(unsigned int usecs);

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);
};

#define __timer(order) __table (struct timer, timers, order)

#endif	/* GPXE_TIMER_H */