Specifications

Sample Driver Code 69
packettype garbage;
do {
if (getanypacketbus(garbage))
count ;
else
return(OK);
} while (count > 0);
return(SHORTED);
}
void disablecontroller(void)
{
if (mca)
resetmcacontrollerpos();
}
boolean getpacket(packettype packet, byte p)
/* discard all packets until we see the packet requested by p */
{
int i;
for (i=0; i<10; i++) {
if (!getanypacketbus(packet))
break;
if (*packet == p)
return(TRUE);
}
return(FALSE);
}
boolean getanypacketbus(packettype packet)
{
unsigned i;
byte *p;
currenttime = getclocktime();
do {
if (timeout(2))
return(FALSE);
} while (inp(baseport) & 0x80); /* not ready */
for (i=0, p=packet; i<8; i++) /* read 8 consecutive I/O ports */
*p++ = (byte)inp(baseport+i);
currenttime = getclocktime();
do {
if (timeout(1))
return(FALSE);
} while (*packet == (byte)inp(baseport)); /* wait for byte 0 to change */
return(TRUE); /* so we don't read the same data twice on a fast PC */
}
boolean sendpacket(packettype packet)
{
unsigned i;
for (i=0; i<8; i++) /* output to 8 consecutive I/O ports */
outp(baseport+i,*packet++);
return(TRUE);
}
/************************** Micro Channel Specific ***********************/
boolean checkmca(void)
/* check if running on MCA */
{
boolean mca_found = FALSE;
_asm {
mov ah,0c0h ; get BIOS ID
mov bx, 1
stc
int 15h
jc no_mca
cmp bx, 1
je no_mca
test byte ptr es:[bx+5],2
jz no_mca
mov mca_found,1
no_mca:
}
return(mca_found);
}
int findmcacontroller(void)
{
unsigned posbase,j;
byte mcainfo[8],i;