Copyright clean-up (part 1):
[AROS.git] / arch / all-pc / kernel / kernel_timer.c
blobac2a0793cb7455347b95f9911dd0c509c694c016
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <hardware/pit.h>
8 #include "kernel_base.h"
9 #include "kernel_debug.h"
10 #include "kernel_timer.h"
12 #define D(x)
14 /* See timer/ticks.c for the explanation */
15 static const unsigned int timer_rpr = 3599597124UL;
17 static inline unsigned int usec2tick(unsigned int usec)
19 unsigned int ret = 0;
21 asm volatile("divl %2":"+a"(ret),"+d"(usec):"m"(timer_rpr));
22 return ret;
25 void pit_udelay(unsigned int usec)
27 unsigned int start = usec2tick(usec);
29 D(bug("[PIT] udelay: %d usec = %d ticks\n", usec, start));
31 pit_start(start);
32 pit_wait(start);