11-35
ASYNCHRONOUS SERIAL I/O UNIT
return E_INVALID_DEVICE;
/* Set Port base based on serial port used */
SIOPortBase = (Unit ? SIO1_BASE : SIO0_BASE);
/* Initialized Serial Port registers */
/* Calculate the baud divisor value, based on baud clocking */
BaudDivisor = (WORD)(BaudClkIn / (16*BaudRate));
/* Turn on access to baud divisor register */
_SetEXRegByte(SIOPortBase + LCR, 0x80);
/* Set the baud rate divisor register, High byte first */
_SetEXRegByte(SIOPortBase + DLH, HIBYTE(BaudDivisor) );
_SetEXRegByte(SIOPortBase + DLL, LOBYTE(BaudDivisor) );
/*** Set Serial Line control register ***/
_SetEXRegByte(SIOPortBase + LCR, Mode);// Sets Mode and
//reset the Divisor latch
/* Set modem control bits */
_SetEXRegByte(SIOPortBase + MCR, ModemCntrl);
return E_OK;
}/* InitSIO */
/*****************************************************************************
SerialReadStr
Description:
Is a Polled serial port read function that waits forever or until
count characters are read from the serial port.
Parameters:
Unit Unit number of the serial port. 0 for SIO port 0,
1 for SIO port 1.
str Address of where to place the input data
count Number of characters to read before returning.
Returns: Error Code
E_OK or Error code status (value of Line Status Register (LSR)
Assumptions:
REMAPCFG register has Expanded I/O space access enabled (ESE bit set).
The processor Port pin are initialized separately.
Syntax: