int 15h/AH=86h (WAIT) doesn't work properly on all hardware and emulators, so

for the countdown use the more coarsely grained sleep implementation based
on int 1ah/AH=00h (GET SYSTEM TIME).

ok ad@
This commit is contained in:
jmcneill 2009-08-26 13:28:48 +00:00
parent d73f433280
commit c07ee161fd
1 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcio.c,v 1.26 2009/06/29 09:23:16 mbalmer Exp $ */
/* $NetBSD: pcio.c,v 1.27 2009/08/26 13:28:48 jmcneill Exp $ */
/*
* Copyright (c) 1996, 1997
@ -71,6 +71,20 @@ static int getcomaddr(int);
#define POLL_FREQ 10
static void
wait(int us)
{
int prev = biosgetsystime();
int tgt = prev + (20 * us) / 1000000;
int new;
while ((new = biosgetsystime()) < tgt) {
if (new < prev) /* XXX timer wrapped */
break;
prev = new;
}
}
#ifdef SUPPORT_SERIAL
static int
getcomaddr(int idx)
@ -346,7 +360,7 @@ awaitkey(int timeout, int tell)
goto out;
}
if (i--)
delay(1000000 / POLL_FREQ);
wait(1000000 / POLL_FREQ);
else
break;
}