CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Loading...
Searching...
No Matches
SynopsisExtended16550< DefaultBaudRate > Struct Template Reference

The Synopsis extended 16550 UART has two additional registers that are not part of a standard 16550, one of which allows for fractional multipliers. More...

#include <platform-uart.hh>

Inheritance diagram for SynopsisExtended16550< DefaultBaudRate >:
Collaboration diagram for SynopsisExtended16550< DefaultBaudRate >:

Public Member Functions

void init (unsigned baudRate=DefaultBaudRate, unsigned timerFrequency=CPU_TIMER_HZ) volatile
 Initialise the UART.
Public Member Functions inherited from Uart16550< uint32_t >
bool can_write () volatile
 Returns true if the transmit buffer is empty.
bool can_read () volatile
 Returns true if the receive buffer is not.
uint8_t blocking_read () volatile
 Read one byte, blocking until a byte is available.
void blocking_write (uint8_t byte) volatile
 Write one byte, blocking until the byte is written.
void init (int divisor=1, T &&otherSetup=no_custom_init) volatile
 Initialise the UART.

Public Attributes

uint32_t loopback
 Loopback register.
uint32_t divisorLatchFraction
 Divisor latch fraction.
Public Attributes inherited from Uart16550< uint32_t >
uint32_t data
 The interface to the read/write FIFOs for this UART.
uint32_t intrEnable
 Interrupt-enabled control / status.
uint32_t intrIDandFifo
 Interrupt identification and FIFO enable/disable.
uint32_t lineControl
 Specifies properties of the line (stop bit, parity, and so on).
uint32_t modemControl
 Modem control.
const uint32_t LineStatus
 The line status word.
const uint32_t ModemStatus
 Modem status.
uint32_t scratch
 Scratch register.

Static Public Attributes

static constexpr uint32_t BaudScaleFactorShift = 4
 The divisor is calculated from 16 times the baud rate.
static constexpr uint32_t BaudFractionBits = 4
 The value in divisorLatchFraction is truncated to this many bits.

Detailed Description

template<unsigned DefaultBaudRate = 115'200>
struct SynopsisExtended16550< DefaultBaudRate >

The Synopsis extended 16550 UART has two additional registers that are not part of a standard 16550, one of which allows for fractional multipliers.

This is always instantiated with 32-bit device registers. The default baud rate is set as a template parameter and can be overridden in init.

Definition at line 15 of file platform-uart.hh.

Member Function Documentation

◆ init()

template<unsigned DefaultBaudRate = 115'200>
void SynopsisExtended16550< DefaultBaudRate >::init ( unsigned baudRate = DefaultBaudRate,
unsigned timerFrequency = CPU_TIMER_HZ ) volatile
inline

Member Data Documentation

◆ BaudFractionBits

template<unsigned DefaultBaudRate = 115'200>
uint32_t SynopsisExtended16550< DefaultBaudRate >::BaudFractionBits = 4
staticconstexpr

The value in divisorLatchFraction is truncated to this many bits.

Definition at line 45 of file platform-uart.hh.

◆ BaudScaleFactorShift

template<unsigned DefaultBaudRate = 115'200>
uint32_t SynopsisExtended16550< DefaultBaudRate >::BaudScaleFactorShift = 4
staticconstexpr

The divisor is calculated from 16 times the baud rate.

The baud rate is in the range of KHz to hundreds of KHz, whereas the clock frequency is typically tens to hundreds of MHz. The divisor must fit in a 16-bit integer (written across two 8-bit device registers) and so is scaled to ensure that it fits (by a power of two, which makes it trivial to reverse the multiplication in the hardware).

Definition at line 40 of file platform-uart.hh.

Referenced by init().

◆ divisorLatchFraction

template<unsigned DefaultBaudRate = 115'200>
uint32_t SynopsisExtended16550< DefaultBaudRate >::divisorLatchFraction

Divisor latch fraction.

When the divisor latch is set (for writing the divisor), this is used for the fraction. RS-232 requires a 3% tolerance for the baud rate and an integer divisor over the clock frequency of the host may not get within this range. This register is used to provide a 4-bit correction that allows baud rates to stay within the required range.

Definition at line 30 of file platform-uart.hh.

Referenced by init().

◆ loopback

template<unsigned DefaultBaudRate = 115'200>
uint32_t SynopsisExtended16550< DefaultBaudRate >::loopback

Loopback register.

Unused.

Definition at line 20 of file platform-uart.hh.


The documentation for this struct was generated from the following file: