Intel 386 User Manual page 177

Embedded microprocessor
Table of Contents

Advertisement

Intel386™ EX EMBEDDED MICROPROCESSOR USER'S MANUAL
}
/*************************** Function InitSIO *******************************
Parameters:
Unit
Unit number of the serial port.
port 1.
Mode
Defines parity, number of data bits, number of stop bits...
Reference Serial Line Control register for various options
ModemCntrl
Defines the operation of the modem control lines
BaudRate
Specifies baud rate.
based on clocking source and clock frequency.
frequency is set by calling the InitializeLibrary function.
ClockRate
Specifies the serial port clocking rate, for internal clocking
= CLK2 for external = COMCLK
Returns:
Error Codes
E_INVAILD_DEVICE
E_OK
Assumptions:
SIOCFG
Has already been configured for Clocking source and Modem control
source
REMAPCFG register has Expanded I/O space access enabled (ESE bit set).
The processor Port pin are initialized separately.
Real/Protected Mode
No changes required.
--------------------------------------------------------------------------*/
int InitSIO(int Unit,
BYTE Mode,
BYTE ModemCntrl,
DWORD BaudRate,
DWORD BaudClkIn)
{
WORD SIOPortBase;
WORD BaudDivisor;
// Check for valid unit
if(Unit > 1)
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
7-18
The baud divisor value is calculated
-- Unit number specifies a non-existing device
-- Initialized OK, No error.
0 for SIO port 0, 1 for SIO
The clocking

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Intel386 exIntel386 extbIntel386 extc

Table of Contents