blob: c82df1973b7d78eba5d216942e5d6e0030a522c0 (
plain)
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
|
/* Copyright 2000 AG Electronics Ltd. */
/* This code is distributed without warranty under the GPL v2 (see COPYING) */
#include <timer.h>
#include <bsp.h>
unsigned get_hz(void)
{
return bsp_clock_speed();
}
unsigned ticks_since_boot(void)
{
extern unsigned long long _timebase(void);
return (unsigned) (_timebase());
}
void sleep_ticks(unsigned ticks)
{
unsigned then = ticks + ticks_since_boot();
while(ticks_since_boot() < then)
;
}
void udelay(int usecs)
{
unsigned ticksperusec = get_hz() / 1000000;
sleep_ticks(ticksperusec * usecs);
}
|