Fix delay(). The processor cycle counter is a 32-bit wrapping counter.
Hence, mask off the upper 32 bits and deal with wrap-arounds. MFC after: 1 week
This commit is contained in:
parent
ecf4269527
commit
b7b527edfa
@ -34,8 +34,11 @@ void
|
||||
delay(int usecs)
|
||||
{
|
||||
struct rpb *hwrpb = (struct rpb *)HWRPB_ADDR;
|
||||
unsigned long start = alpha_rpcc();
|
||||
unsigned long end = start + (hwrpb->rpb_cc_freq * usecs) / 1000000;
|
||||
while (alpha_rpcc() < end)
|
||||
;
|
||||
unsigned long end, now, start;
|
||||
|
||||
start = alpha_rpcc() & 0xfffffffful;
|
||||
end = start + (hwrpb->rpb_cc_freq * usecs) / 1000000;
|
||||
do {
|
||||
now = alpha_rpcc() & 0xfffffffful;
|
||||
} while (now < end || (now > start && end < start));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user