Put the delay in a macro, and implement it differently.

This commit is contained in:
mycroft 1994-10-09 09:28:54 +00:00
parent cbe87dbb9c
commit cce04a7aa1
1 changed files with 17 additions and 8 deletions

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)pccons.c 5.11 (Berkeley) 5/21/91
* $Id: pccons.c,v 1.66 1994/08/17 19:14:53 mycroft Exp $
* $Id: pccons.c,v 1.67 1994/10/09 09:28:54 mycroft Exp $
*/
/*
@ -149,6 +149,12 @@ char partab[];
extern pcopen(dev_t, int, int, struct proc *);
#define KBD_DELAY \
{ u_char x = inb(0x84); } \
{ u_char x = inb(0x84); } \
{ u_char x = inb(0x84); } \
{ u_char x = inb(0x84); }
static inline int
kbd_wait()
{
@ -156,7 +162,7 @@ kbd_wait()
for (i = 100000; i; i--)
if ((inb(KBSTATP) & KBS_IBF) == 0) {
delay(6);
KBD_DELAY;
return 1;
}
return 0;
@ -216,7 +222,8 @@ kbd_cmd(val, polling)
for (i = 100000; i; i--) {
if (inb(KBSTATP) & KBS_DIB) {
register u_char c;
delay(6);
KBD_DELAY;
c = inb(KBDATAP);
if (c == KBR_ACK || c == KBR_ECHO) {
ack = 1;
@ -233,6 +240,7 @@ kbd_cmd(val, polling)
}
else
for (i = 100000; i; i--) {
inb(KBSTATP);
if (ack)
return 1;
if (nak)
@ -334,7 +342,7 @@ pcprobe(parent, self, aux)
#if 1
/* Flush any garbage. */
while (inb(KBSTATP) & KBS_DIB) {
delay(6);
KBD_DELAY;
(void) inb(KBDATAP);
}
/* Reset the keyboard. */
@ -343,7 +351,7 @@ pcprobe(parent, self, aux)
goto lose;
}
while ((inb(KBSTATP) & KBS_DIB) == 0);
delay(6);
KBD_DELAY;
if (inb(KBDATAP) != KBR_RSTDONE) {
printf("pcprobe: reset error %d\n", 2);
goto lose;
@ -354,7 +362,7 @@ pcprobe(parent, self, aux)
* flushing the buffer.
*/
while (inb(KBSTATP) & KBS_DIB) {
delay(6);
KBD_DELAY;
(void) inb(KBDATAP);
}
/* Just to be sure. */
@ -666,13 +674,13 @@ pccnputc(dev, c)
pccngetc(dev)
dev_t dev;
{
register int s;
u_char oldpolling;
register char *cp;
u_char oldpolling = polling;
if (pc_xmode > 0)
return 0;
oldpolling = polling;
polling = 1;
do {
/* wait for byte */
@ -1328,6 +1336,7 @@ sget()
static u_char capchar[2];
top:
KBD_DELAY;
dt = inb(KBDATAP);
switch (dt) {