11-39
ASYNCHRONOUS SERIAL I/O UNIT
Description:
Is a Polled serial port write function that waits forever
or until all characters have been written to the serial port.
The NUL character (‘\0’) is used to indicate end of string.
Parameters:
Unit Unit number of the serial port. 0 for SIO port 0,
1 for SIO port 1.
str Address of a zero terminated string to be transmitted
Returns:
None
Assumptions:
REMAPCFG register has Expanded I/O space access enabled (ESE bit set).
The processor Port pin are initialized separately.
Syntax:
#define SIO_0 0
SerialWriteStr (SIO_0,
HelloString);
Real/Protected Mode
No changes required.
*****************************************************************************/
void SerialWriteStr(int Unit, const char far *str)
{
WORD TransmitPortAddr;
WORD StatusPortAddr;
/* Set Port base, based on serial port used */
TransmitPortAddr = (Unit ? TBR1 : TBR0);
StatusPortAddr = (Unit ? LSR1 : LSR0);
for( ; *str != ‘\0’; str++)
{
/* Wait until buffer is empty */
while(!(_GetEXRegByte(StatusPortAddr) & SIO_TX_BUF_EMPTY)) ;
/* Write Character */
_SetEXRegByte(TransmitPortAddr,*str);
}
}/* SerialWriteStr */