Intel 386 User Manual page 324

Embedded microprocessor
Table of Contents

Advertisement

until a character has been received from the serial port.
Parameters:
Unit
Unit number of the serial port. 0 for SIO port 0,
1 for SIO port 1.
Returns:
BYTE Read from serial port, if zero an error occurred.
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
BYTE character;
character = SerialReadChar (SIO_0);
Real/Protected Mode
No changes required.
*****************************************************************************/
BYTE SerialReadChar(int Unit)
{
WORD ReceivePortAddr;
WORD StatusPortAddr;
WORD Status;
/* Set Port base, based on serial port used */
ReceivePortAddr = (Unit ? RBR1 : RBR0);
StatusPortAddr =
// Status register is cleared after read, so we must save
// it's value when read
while(!((Status=_GetEXRegByte(StatusPortAddr)) & SIO_RX_BUF_FULL))
if( Status & SIO_ERROR_BITS )
{
return 0;
}
return _GetEXRegByte(ReceivePortAddr);
}/* SerialReadChar */
/*****************************************************************************
(Unit ? LSR1 : LSR0);
// Error Bit set then return NULL
ASYNCHRONOUS SERIAL I/O UNIT
11-37

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Intel386 exIntel386 extbIntel386 extc

Table of Contents