diff options
author | Michael Brown <mcb30@ipxe.org> | 2017-01-25 20:59:15 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2017-01-26 08:17:37 +0000 |
commit | 302f1eeb80706fb10067efedb1279fa3f85ddda2 (patch) | |
tree | 90e58309094b20a26cedc8244fabf72d96fe6135 /src/include/unistd.h | |
parent | d37e025b81cb6fd0e7833b927ed138b42a628bc8 (diff) | |
download | ipxe-302f1eeb80706fb10067efedb1279fa3f85ddda2.tar.gz |
[time] Allow timer to be selected at runtime
Allow the active timer (providing udelay() and currticks()) to be
selected at runtime based on probing during the INIT_EARLY stage of
initialisation.
TICKS_PER_SEC is now a fixed compile-time constant for all builds, and
is independent of the underlying clock tick rate. We choose the value
1024 to allow multiplications and divisions on seconds to be converted
to bit shifts.
TICKS_PER_MS is defined as 1, allowing multiplications and divisions
on milliseconds to be omitted entirely. The 2% inaccuracy in this
definition is negligible when using the standard BIOS timer (running
at around 18.2Hz).
TIMER_RDTSC now checks for a constant TSC before claiming to be a
usable timer. (This timer can be tested in KVM via the command-line
option "-cpu host,+invtsc".)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/unistd.h')
-rw-r--r-- | src/include/unistd.h | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/include/unistd.h b/src/include/unistd.h index d09e1ae30..6c31c0601 100644 --- a/src/include/unistd.h +++ b/src/include/unistd.h @@ -23,19 +23,9 @@ extern int execv ( const char *command, char * const argv[] ); rc; \ } ) -/* Pick up udelay() */ +/* Pick up udelay() and sleep() */ #include <ipxe/timer.h> -/* - * sleep() prototype is defined by POSIX.1. usleep() prototype is - * defined by 4.3BSD. udelay() and mdelay() prototypes are chosen to - * be reasonably sensible. - * - */ - -extern unsigned int sleep ( unsigned int seconds ); -extern void mdelay ( unsigned long msecs ); - static inline __always_inline void usleep ( unsigned long usecs ) { udelay ( usecs ); } |