Crate serial_port
source ·Expand description
A full serial driver with more advanced I/O support, e.g., interrupt-based data receival.
This crate builds on [serial_port_basic
], which provides the lower-level types
and functions that enable simple interactions with serial ports.
This crate extends that functionality to provide interrupt handlers for receiving data
and handling data access in a deferred, asynchronous manner.
It also implements additional higher-level I/O traits for serial ports,
namely [core2::io::Read
] and [core2::io::Write
].
Notes
Typically, drivers do not need to be designed in this split manner. However, the serial port is the very earliest device to be initialized and used in Theseus, as it acts as the backend output stream for Theseus’s logger.
Structs
- A chunk of data read from a serial port that will be transmitted to a receiver.
- An empty error type indicating that a data sender could not be set for a serial port because a sender had already been set for it.
- A serial port abstraction with support for interrupt-based data receival.
- A serial port and its various data and control registers.
Enums
- The base port I/O addresses for COM serial ports.
- The types of events that can trigger an interrupt on a serial port.
Functions
- Obtains a reference to the
SerialPort
specified by the givenSerialPortAddress
, if it has been initialized (seeinit_serial_port()
). - Initializes the
SerialPort
specified by the givenSerialPortAddress
. - A temporary hack to allow the serial port interrupt handler to inform a listener on the other end of this channel that a new connection has been detected on one of the serial ports, i.e., that it received some data on a serial port that didn’t expect it or wasn’t yet set up to handle incoming data.
- Takes ownership of the
SerialPort
specified by the givenSerialPortAddress
.