{
unsigned char *p;
long bytesToSend, remainCount;
while (pILock != 0) {}; /* Wait for pILock to be released */
if (VersatecOnLine() == FALSE) {
return(FALSE); /* bad termination */
};
if (byteCount == 0 ) {
return(TRUE); /* nothing to do */
};
if ( (byteAddress % 16) != 0 || (byteCount < 96)) {
/* not aligned on an 16 bytes word bondary or buffer too small */
/* send one byte at a time */
pILock = 1;
newPIByteAddress = byteAddress + 1; /* tells the int routine to continue */
newPIByteCount = byteCount - 1;
p = (unsigned char *) byteAddress;
SendOneByte (*p);
return (VersatecOnLine()); /* don't wait to return*/
};
/* buffer bigger than 96 aligned on an 16 bytes word bondary */
if ( byteCount > 1024 * 1024 ) { /* send 1 mega byte max at a time */
bytesToSend = 1024 * 1024;
remainCount = byteCount - 1024 * 1024;
if (remainCount < 96) bytesToSend -= 96; /* extend the last chunk to more than 96 */
}
else { /* buffer smaller than 1 mega */
bytesToSend = byteCount - (byteCount % 16);
};
newPIByteAddress = byteAddress + bytesToSend;
newPIByteCount = byteCount - bytesToSend;
pILock = 1; /* take the pILock (will be released by the interrupt) */
SparcSoftcardOps←SetDMAState(DMAState←inactive);
SparcSoftcardOps←SetDMAMode(DMAMode←versatecStream);
SparcSoftcardOps𡤍MAAddressRegisterLoad(byteAddress);
SetTimer(bytesToSend);
SparcSoftcardOps←SetDMAState(DMAStatetive);
return (VersatecOnLine()); /* don't wait to return*/
};