Intel 386 User Manual page 323

Embedded microprocessor
Table of Contents

Advertisement

Intel386™ EX EMBEDDED MICROPROCESSOR USER'S MANUAL
#define SIO_0
#define LENGTH 32
char String_Read[LENGTH];
int error;
error = SerialReadStr (SIO_0,
Real/Protected Mode
No changes required.
*****************************************************************************/
int SerialReadStr(int Unit, char far *str, int count)
{
WORD ReceivePortAddr;
WORD StatusPortAddr;
BYTE Status;
int i;
/* Set Port base, based on serial port used */
ReceivePortAddr = (Unit ? RBR1 : RBR0);
StatusPortAddr =
for(i=0; i < count-1; i++)
{
// 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 )
{
}
str[i] = _GetEXRegByte(ReceivePortAddr);
}
str[i] = '\0';
return E_OK;
}/* SerialReadStr */
/*****************************************************************************
SerialReadChar:
Description:
Is a Polled serial port read function that waits forever or
11-36
0
String_Read,
LENGTH);
(Unit ? LSR1 : LSR0);
/* Error Bit set then return NULL */
str[i+1] = '\0';
return Status & SIO_ERROR_BITS;

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Intel386 exIntel386 extbIntel386 extc

Table of Contents