Intel386™ EX EMBEDDED MICROPROCESSOR USER’S MANUAL
11-40
/*****************************************************************************
SerialWriteMem:
Description:
Is a Polled serial port write function that waits forever or
until count characters have been written to the serial port.
Parameters:
Unit Unit number of the serial port. 0 for SIO port 0,
1 for SIO port 1.
mem Address of a buffer to be transmitted
count Number of characters in buffer 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
#define COUNT 32
char Buffer[COUNT];
SerialWriteMem (SIO_0,
Buffer,
COUNT);
Real/Protected Mode
No changes required.
*****************************************************************************/
void SerialWriteMem(int Unit, const char far *mem, int count)
{
WORD TransmitPortAddr;
WORD StatusPortAddr;
int i;
/* Set Port base, based on serial port used */
TransmitPortAddr = (Unit ? TBR1 : TBR0);
StatusPortAddr = (Unit ? LSR1 : LSR0);
for(i=0 ; i < count; i++)
{
/* Wait until buffer is empty */
while(!(_GetEXRegByte(StatusPortAddr) & SIO_TX_BUF_EMPTY)) ;
/* Write Character */
_SetEXRegByte(TransmitPortAddr,mem[i]);