dioscuri.module.serialport
Class SerialPort

java.lang.Object
  extended by dioscuri.module.AbstractModule
      extended by dioscuri.module.ModuleSerialPort
          extended by dioscuri.module.serialport.SerialPort
All Implemented Interfaces:
Addressable, Module, Updateable

public class SerialPort
extends ModuleSerialPort

An implementation of a serial port module.

See Also:

Metadata module ******************************************** general.type : serialport general.name : UART 16550A Serial Port general.architecture : Von Neumann general.description : Models a 9-pin serial port general.creator : Tessella Support Services, Koninklijke Bibliotheek, Nationaal Archief of the Netherlands general.version : 1.0 general.keywords : serial port, port, RS232, DE-9, COM, UART general.relations : Motherboard, PIC general.yearOfIntroduction : general.yearOfEnding : general.ancestor : general.successor :

Notes: - AbstractModule serial port supports up to 4 COM ports - It is based on the UART 16550A interface (including FIFO buffer) - Data is transmitted in little-endian order (least significant bit first)

References: - I/O Port information: http://mudlist.eorbit.net/~adam/pickey/ports.html - UART register information from PC16550D UART with FIFOs (National Semiconductor): http://www.national.com/mpf/PC/PC16550D.html - Bochs X86 emulator: http://bochs.sourceforge.net

PORT 03F8-03FF - serial port (8250,8250A,8251,16450,16550,16550A,etc.) COM1 Range: PORT 02E8h-02EFh (COM2), PORT 02F8h-02FFh (typical non-PS/2 COM3), and PORT 03E8h-03EFh (typical non-PS/2 COM4)

Chips overview: 8250 original PC, specified up to 56Kbd, but mostly runs only 9600Bd, no scratchregister, bug: sometimes shots ints without reasons 8250A, 16450, 16C451: ATs, most chips run up to 115KBd, no bug: shots no causeless ints 8250B: PC,XT,AT, pseudo bug: shots one causeless int for compatibility with 8250, runs up to 56KBd 16550, 16550N, 16550V: early PS/2, FIFO bugs 16550A,16550AF,16550AFN,16550C,16C551,16C552: PS/2, FIFO ok 82510: laptops & industry, multi emulation mode (default=16450), special-FIFO. 8251: completely different synchronous SIO chip, not compatible!

Each COM-port uses 8 I/O ports and 12 UART interface registers: 03F8 W transmitter holding register (THR), which contains the character to be sent. Bit 0 is sent first. bit 7-0 data bits when DLAB=0 (Divisor Latch Access Bit) 03F8 R receiver buffer register (RBR), which contains the received character. Bit 0 is received first bit 7-0 data bits when DLAB=0 (Divisor Latch Access Bit) 03F8 RW divisor latch low byte (DLL) when DLAB=1 (see #P189) 03F9 RW divisor latch high byte (DLM) when DLAB=1 (see #P189) 03F9 RW interrupt enable register (IER) when DLAB=0 (see #P190) 03FA R interrupt identification register (IIR) Information about a pending interrupt is stored here. When the ID register is addressed, the highest priority interrupt is held, and no other interrupts are acknowledged until the CPU services that interrupt. 03FA W 16650 FIFO Control Register (FCR) (see #P192) 03FB RW line control register (LCR) (see #P193) 03FC RW modem control register (see #P194) 03FD R line status register (LSR) (see #P195) 03FE R modem status register (MSR) (see #P196) 03FF RW scratch register (SCR) (not used for serial I/O; available to any application using 16450, 16550) (not present on original 8250)


Nested Class Summary
 
Nested classes/interfaces inherited from interface dioscuri.interfaces.Module
Module.Type
 
Field Summary
static int TOTALCOMPORTS
           
 
Fields inherited from class dioscuri.module.AbstractModule
type
 
Constructor Summary
SerialPort(Emulator owner)
          Class constructor
 
Method Summary
 byte getIOPortByte(int portAddress)
          
 byte[] getIOPortDoubleWord(int portAddress)
          
 byte[] getIOPortWord(int portAddress)
          
 int getUpdateInterval()
          Get the update interval.
 boolean reset()
          Reset all parameters of module.
 void setIOPortByte(int portAddress, byte data)
          
 void setIOPortDoubleWord(int portAddress, byte[] dataDoubleWord)
          
 void setIOPortWord(int portAddress, byte[] dataWord)
          
 boolean setUARTDevice(UART device, int comPort)
          
 void setUpdateInterval(int interval)
          Defines the interval between subsequent updates
 void update()
          Update the module.
 
Methods inherited from class dioscuri.module.AbstractModule
getConnection, getConnections, getDebugMode, getDump, getExpectedConnections, getType, isConnected, setConnection, setDebugMode, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dioscuri.interfaces.Module
getConnection, getConnections, getDebugMode, getDump, getExpectedConnections, getType, isConnected, setConnection, setDebugMode, start, stop
 

Field Detail

TOTALCOMPORTS

public static final int TOTALCOMPORTS
See Also:
Constant Field Values
Constructor Detail

SerialPort

public SerialPort(Emulator owner)
Class constructor

Parameters:
owner -
Method Detail

reset

public boolean reset()
Reset all parameters of module.

Specified by:
reset in interface Module
Specified by:
reset in class AbstractModule
Returns:
true iff the AbstractModule was reset properly.
See Also:
AbstractModule

getUpdateInterval

public int getUpdateInterval()
Get the update interval.

Returns:
the update interval
See Also:
Updateable

setUpdateInterval

public void setUpdateInterval(int interval)
Defines the interval between subsequent updates

Parameters:
interval - the interval between subsequent updates in ms.
See Also:
Updateable

update

public void update()
Update the module.

See Also:
Updateable

getIOPortByte

public byte getIOPortByte(int portAddress)
                   throws UnknownPortException,
                          WriteOnlyPortException

Returns:
Throws:
UnknownPortException
WriteOnlyPortException
See Also:
Addressable

setIOPortByte

public void setIOPortByte(int portAddress,
                          byte data)
                   throws UnknownPortException

Throws:
UnknownPortException
See Also:
Addressable

getIOPortWord

public byte[] getIOPortWord(int portAddress)
                     throws ModuleException,
                            WriteOnlyPortException

Returns:
Throws:
ModuleException
WriteOnlyPortException
See Also:
Addressable

setIOPortWord

public void setIOPortWord(int portAddress,
                          byte[] dataWord)
                   throws ModuleException

Throws:
ModuleException
See Also:
Addressable

getIOPortDoubleWord

public byte[] getIOPortDoubleWord(int portAddress)
                           throws ModuleException,
                                  WriteOnlyPortException

Returns:
Throws:
ModuleException
WriteOnlyPortException
See Also:
Addressable

setIOPortDoubleWord

public void setIOPortDoubleWord(int portAddress,
                                byte[] dataDoubleWord)
                         throws ModuleException

Throws:
ModuleException
See Also:
Addressable

setUARTDevice

public boolean setUARTDevice(UART device,
                             int comPort)

Specified by:
setUARTDevice in class ModuleSerialPort
Returns:
-
See Also:
ModuleSerialPort