1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

Fix delay() function in the BERI loader code.

Reviewed by:	brooks @
Sponsored by:	DARPA, AFRL
This commit is contained in:
Hans Petter Selasky 2014-05-30 13:53:37 +00:00
parent ce19294c0e
commit 6cdd2fc633
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=266885

View File

@ -215,13 +215,25 @@ time(time_t *tloc)
}
/*
* Delay - presumably in usecs?
* Delay - in usecs
*
* NOTE: We are assuming that the CPU is running at 100MHz.
*/
void
delay(int usecs)
{
register_t t;
uint32_t delta;
uint32_t curr;
uint32_t last;
t = cp0_count_get() + usecs * 100;
while (cp0_count_get() < t);
last = cp0_count_get();
while (usecs > 0) {
curr = cp0_count_get();
delta = curr - last;
while (usecs > 0 && delta >= 100) {
usecs--;
last += 100;
delta -= 100;
}
}
}