Module driver:pcserial - 8250/16450/16550 serial UART driver

8250/16450/16550 serial UART driver. This provides support for standard 8250/16450/16550 serial UARTs typically found on PCs.

Requires: driver:biosmem driver:system interface:serport

Used:

Provides: interface:input interface:output

Index

Declarations

pcserial.occ:72Process pcserial.driver

PROC pcserial.driver (CT.DRIVER? link, SHARED LOG! log, VAL []BYTE options)

Standard PC serial-port driver process. This process implements the serial-port driver. It attempts to detect, and then initialise, the various serial ports reported in the BIOS configuration area. Port endpoints are passed to the 'serial' process.

Parameters:

CT.DRIVER? link Link to parent driver.
SHARED LOG! log System log channels.
VAL []BYTE options Driver options.

pcserial.occ:76Record PC.SERPORT

DATA TYPE PC.SERPORT

Serial port structure.

pcserial.occ:78Variable pinf

SERPORT

Port information (held by serial infrastructure).

pcserial.occ:79Variable addr

INT

Base I/O port address.

pcserial.occ:80Variable type

INT

Serial port type (see UART.TYPE).

pcserial.occ:81Variable devid

INT

Device ID (read from divisor registers).

pcserial.occ:82Variable cap

INT

Capability (see UART.CAP).

pcserial.occ:83Variable baud

INT

Baud rate.

pcserial.occ:84Variable parity

INT

Parity settings (see UART.PARITY).

pcserial.occ:85Variable stop

INT

Stop bits settings (see UART.STOP).

pcserial.occ:86Variable wlen

INT

Word length settings (see UART.WLEN).

pcserial.occ:87Variable hwflow

BOOL

Using hardware flow-control?

pcserial.occ:88Variable swflow

BOOL

Using software flow-control?

pcserial.occ:89Variable tx.fifo.len

INT

Transmit FIFO length.

pcserial.occ:90Variable rx.fifo.len

INT

Receive FIFO length.

pcserial.occ:91Variable do.intr

BOOL

Use interrupts?

pcserial.occ:92Variable intr

INT

Interrupt line.

pcserial.occ:93Variable acr

BYTE

Additional control register (saved bits).

pcserial.occ:94Variable lcr

BYTE

Line control register bits (not BSR).

pcserial.occ:99Protocol P.SER.LL.IN

PROTOCOL P.SER.LL.IN

Input protocol to the low-level serial driver.

pcserial.occ:101Tag set.baud

set.baud; INT

Set baud rate.

pcserial.occ:102Tag set.hwflow

set.hwflow; BOOL

Set hardware based flow-control.

pcserial.occ:103Tag set.swflow

set.swflow; BOOL

Set software based flow-control.

pcserial.occ:104Tag set.linectl

set.linectl; INT

Set line control settings (parity, etc.) (see SERPORT.LINE).

pcserial.occ:105Tag read.lsr

read.lsr

Read line status register.

pcserial.occ:106Tag get.baud

get.baud

Get baud rate.

pcserial.occ:107Tag get.hwflow

get.hwflow

Get hardware flow-control setting.

pcserial.occ:108Tag get.swflow

get.swflow

Get software flow-control setting.

pcserial.occ:109Tag get.linectl

get.linectl

Get line control settings (parity, etc.).

pcserial.occ:110Tag write.data

write.data; BYTE

Write to the serial transmitter.

pcserial.occ:111Tag read.data

read.data

Read from the receiver register.

pcserial.occ:112Tag set.intflags

set.intflags; BYTE

Set interrupt control flags.

pcserial.occ:116Protocol P.SER.LL.OUT

PROTOCOL P.SER.LL.OUT

Output protocol from the low-level serial driver.

pcserial.occ:118Tag result

result; INT

Generic result.

pcserial.occ:119Tag reg.val

reg.val; BYTE

Register value.

pcserial.occ:123Channel type CT.SER.LL

CHAN TYPE CT.SER.LL

Channel-type for the low-level serial driver.

pcserial.occ:125Variable in?

CHAN P.SER.LL.IN

Requests.

pcserial.occ:126Variable out!

CHAN P.SER.LL.OUT

Responses.

pcserial.occ:136Process init.serial.struct

PROC init.serial.struct (PC.SERPORT port)

Initialises the serial-port structure.

Parameters:

PC.SERPORT port Serial port structure.

pcserial.occ:167Process test.for.serial.port

PROC test.for.serial.port (PC.SERPORT port, SHARED LOG! log, RESULT BOOL ok)

Tests to see if a given serial port exists. On entry to this, only the 'portno' and 'addr' fields are likely to be set in the PC.SERPORT structure.

Parameters:

PC.SERPORT port Serial port structure.
SHARED LOG! log System log channels.
RESULT BOOL ok Set to indicate success or failure.

pcserial.occ:189Process read.divisor.id

PROC read.divisor.id (PC.SERPORT port, RESULT INT id)

Reads UART ID using the divisor registers. Returns UART ID in bits 8-15, revision in bits 0-7.

Parameters:

PC.SERPORT port Serial port.
RESULT INT id Device ID placed here.

pcserial.occ:220Process size.serial.fifo

PROC size.serial.fifo (PC.SERPORT port, RESULT INT length)

Attempts to determine the length of the serial FIFO.

Parameters:

PC.SERPORT port Serial port.
RESULT INT length Discovered length of FIFO.

pcserial.occ:283Process serial.icr.write

PROC serial.icr.write (PC.SERPORT port, VAL BYTE index, value)

Writes to specified index control register.

Parameters:

PC.SERPORT port Serial port.
VAL BYTE index Index register to write.
VAL BYTE value Value to write.

pcserial.occ:298Process serial.icr.read

PROC serial.icr.read (PC.SERPORT port, VAL BYTE index, RESULT BYTE value)

Reads from the specified index control register.

Parameters:

PC.SERPORT port Serial port.
VAL BYTE index Index register to read.
RESULT BYTE value Result value.

pcserial.occ:315Process serial.clear.fifos

PROC serial.clear.fifos (PC.SERPORT port)

Clears the UART FIFOs.

Parameters:

PC.SERPORT port Serial port.

pcserial.occ:336Process set.port.speed

PROC set.port.speed (PC.SERPORT port, SHARED LOG! log, RESULT INT result)

Sets the serial-port baud rate. This is defined for a traditional serial-port, does not support enhanced serial port timing yet. Baud rate taken from port[baud].

Parameters:

PC.SERPORT port Serial port.
SHARED LOG! log System log channels.
RESULT INT result Indicates success or error.

pcserial.occ:430Process set.port.flow

PROC set.port.flow (PC.SERPORT port, SHARED LOG! log, RESULT INT result)

Sets the serial-port flow-control. This is used to toggle hardware and/or software flow-control. Settings are taken from port[hwflow] and port[swflow].

Parameters:

PC.SERPORT port Serial port.
SHARED LOG! log System log channels.
RESULT INT result Indicates success or failure.

pcserial.occ:484Process set.port.comm

PROC set.port.comm (PC.SERPORT port, SHARED LOG! log, RESULT INT result)

Sets port communication parameters (parity, stop-bits, word-length).

Parameters:

PC.SERPORT port Serial port structure.
SHARED LOG! log System log channels.
RESULT INT result Indicates success or failure

pcserial.occ:530Process initialise.serial.port

PROC initialise.serial.port (PC.SERPORT port, SHARED LOG! log, RESULT BOOL ok)

Initialises a serial-port, determines its type and other characteristics. On entry to this, only the 'portno' and 'addr' fields are likely to be set in the PC.SERPORT structure. However, we assume that there is some sort of serial port in this location.

Parameters:

PC.SERPORT port Serial port structure.
SHARED LOG! log System log channels.
RESULT BOOL ok Set to indicate success or failure.

pcserial.occ:999Process serial.low.level

PROC serial.low.level (PC.SERPORT port, SHARED LOG! log, CT.SER.LL? in)

Low-level serial port driver. This runs in parallel alongside other processes, responsible for interacting with the serial port's I/O region.

Parameters:

PC.SERPORT port Serial port.
SHARED LOG! log System log channels.
CT.SER.LL? in Commands in from other serial-port processes.

pcserial.occ:1190Process ser.poll.handler

PROC ser.poll.handler (VAL INT portno, CHAN INT tx.signal!, rx.signal!, tx.ctrl?, rx.ctrl?, SHARED CT.SER.LL! serdev, SHARED LOG! log, VAL BOOL dfl.trig.tx, dfl.trig.rx)

Serial port polling process.

Parameters:

VAL INT portno Port number (0..).
CHAN INT tx.signal Signal sent to transmit control process.
CHAN INT rx.signal Signal sent to receive control process.
CHAN INT tx.ctrl Enable/disable signal from transmit control process.
CHAN INT rx.ctrl Enable/disable signal from receive control process.
SHARED CT.SER.LL! serdev Connection to low-level serial device.
SHARED LOG! log System log channels.
VAL BOOL dfl.trig.tx Enable transmitter trigger by default.
VAL BOOL dfl.trig.rx Enable receiver trigger by default.

pcserial.occ:1309Process ser.int.handler

PROC ser.int.handler (VAL INT portno, irq.num, CHAN INT tx.signal!, rx.signal!, tx.ctrl?, rx.ctrl?, SHARED CT.SER.LL! serdev, SHARED CT.BLOCK! sys, SHARED LOG! log, VAL BOOL dfl.trig.tx, dfl.trig.rx)

Serial port interrupt handler process. This process is responsible for handling serial-port interrupts. When an interrupt is triggered, the line status register is checked to see if there's a new character available in the receiver, or if we can squeeze another character into the transmitter holding register.

Parameters:

VAL INT portno Port number (0..).
VAL INT irq.num Hardware IRQ for this port.
CHAN INT tx.signal Signal sent to transmit control process.
CHAN INT rx.signal Signal sent to receive control process.
CHAN INT tx.ctrl Enable/disable signal from transmit control process.
CHAN INT rx.ctrl Enable/disable signal from receive control process.
SHARED CT.SER.LL! serdev Connection to low-level serial device.
SHARED CT.BLOCK! sys Connection to system driver.
SHARED LOG! log System log channels.
VAL BOOL dfl.trig.tx Enable transmitter trigger by default.
VAL BOOL dfl.trig.rx Enable receiver trigger by default.

pcserial.occ:1509Process ser.tx.queue

PROC ser.tx.queue (VAL INT portno, CHAN INT int.select!, intr.in?, SHARED CT.SER.LL! serdev, SHARED LOG! log, CHAN BYTE in?)

Serial port transmitter process.

Parameters:

VAL INT portno Port number (0..).
CHAN INT int.select Used to control interrupt notification
CHAN INT intr.in Signalled when a transmitter interrupt occurs.
SHARED CT.SER.LL! serdev Connection to low-level serial driver.
SHARED LOG! log System log channels.
CHAN BYTE in Bytes to be transmitted.

pcserial.occ:1585Process ser.rx.queue

PROC ser.rx.queue (VAL INT portno, CHAN INT int.select!, intr.in?, SHARED CT.SER.LL! serdev, SHARED LOG! log, CHAN BYTE out!)

Serial port receiver process.

Parameters:

VAL INT portno Port number (0..).
CHAN INT int.select Used to control interrupt notification.
CHAN INT intr.in Signalled when a receiver interrupt occurs
SHARED CT.SER.LL! serdev Connection to low-level serial driver.
SHARED LOG! log System log channels.
CHAN BYTE out Bytes received.

pcserial.occ:1654Process inp.driver

PROC inp.driver (VAL INT portno, CT.DRIVER? link, SHARED CT.SER.LL! serdev, SHARED LOG! log, CHAN BYTE rx?)

Serial interface input driver. This handles the input side of a serial port (e.g. serial.0i).

Parameters:

VAL INT portno Port number (0..).
CT.DRIVER? link Link to parent driver (individual port driver).
SHARED CT.SER.LL! serdev Link to low-level serial driver.
SHARED LOG! log System log channels.
CHAN BYTE rx Received bytes from serial device.

pcserial.occ:1838Process outp.driver

PROC outp.driver (VAL INT portno, CT.DRIVER? link, SHARED CT.SER.LL! serdev, SHARED LOG! log, CHAN BYTE tx!)

Serial interface output driver. This handles the output side of a serial port (e.g. serial.0o).

Parameters:

VAL INT portno Port number (0..).
CT.DRIVER? link Link to parent driver (individual port driver).
SHARED CT.SER.LL! serdev Link to low-level serial driver.
SHARED LOG! log System log channels.
CHAN BYTE tx Bytes sent to serial device.