µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os::driver::serial Namespace Reference

Classes

class  Capabilities
 Serial device driver capabilities. More...
 
class  Modem_status
 Serial modem status More...
 
class  Status
 Serial port status More...
 

Typedefs

using bit_number_t = uint32_t
 
using config_arg_t = uint32_t
 
using config_t = uint32_t
 
using control_arg_t = uint32_t
 
using control_t = uint32_t
 
using modem_config_t = uint32_t
 

Enumerations

enum  Control : control_t {
  enable_tx = (0x15UL << CONFIG_Pos) ,
  enable_rx = (0x16UL << CONFIG_Pos) ,
  enable_break = (0x17UL << CONFIG_Pos) ,
  abort_send = (0x18UL << CONFIG_Pos) ,
  abort_receive = (0x19UL << CONFIG_Pos) ,
  abort_transfer = (0x1AUL << CONFIG_Pos) ,
  disable_tx = (0x25UL << CONFIG_Pos) ,
  disable_rx = (0x26UL << CONFIG_Pos) ,
  disable_break = (0x27UL << CONFIG_Pos)
}
 
enum  Event : event_t {
  send_complete = (1UL << 0) ,
  receive_complete = (1UL << 1) ,
  transfer_complete = (1UL << 2) ,
  tx_complete = (1UL << 3) ,
  tx_underflow = (1UL << 4) ,
  rx_overflow = (1UL << 5) ,
  rx_timeout = (1UL << 6) ,
  rx_break = (1UL << 7) ,
  rx_framing_error = (1UL << 8) ,
  rx_parity_error = (1UL << 9) ,
  cts = (1UL << 10) ,
  dsr = (1UL << 11) ,
  dcd = (1UL << 12) ,
  ri = (1UL << 13)
}
 Serial Events. More...
 
enum class  Modem_control : modem_config_t {
  clear_rts ,
  set_rts ,
  clear_dtr ,
  set_dtr
}
 Configuration to change the serial modem lines. More...
 

Functions

constexpr config_t CONFIG_Msk (0xFFUL<< CONFIG_Pos)
 

Variables

constexpr bit_number_t CONFIG_Pos = 0
 
constexpr config_t CPHA0 = (0UL << CPHA_Pos)
 CPHA = 1.
 
constexpr config_t CPHA1 = (1UL << CPHA_Pos)
 
constexpr config_t CPHA_Msk = (1UL << CPHA_Pos)
 CPHA = 0 = (default);.
 
constexpr bit_number_t CPHA_Pos = 19
 
constexpr config_t CPOL0 = (0UL << CPOL_Pos)
 CPOL = 1.
 
constexpr config_t CPOL1 = (1UL << CPOL_Pos)
 
constexpr config_t CPOL_Msk = (1UL << CPOL_Pos)
 CPOL = 0 = (default);.
 
constexpr bit_number_t CPOL_Pos = 18
 
constexpr config_t DATA_BITS_5 = (5UL << DATA_BITS_Pos)
 6 Data bit
 
constexpr config_t DATA_BITS_6 = (6UL << DATA_BITS_Pos)
 7 Data bits
 
constexpr config_t DATA_BITS_7 = (7UL << DATA_BITS_Pos)
 8 Data bits = (default);
 
constexpr config_t DATA_BITS_8 = (0UL << DATA_BITS_Pos)
 9 Data bits
 
constexpr config_t DATA_BITS_9 = (1UL << DATA_BITS_Pos)
 
constexpr config_t DATA_BITS_Msk = (7UL << DATA_BITS_Pos)
 5 Data bits
 
constexpr bit_number_t DATA_BITS_Pos = 8
 
constexpr config_t DEFAULT_TX_VALUE = (0x10UL << CONFIG_Pos)
 < Set default Transmit value = (Synchronous Receive only); arg = value
 
constexpr return_t ERROR_BAUDRATE = ERROR_SPECIFIC - 2
 Specified number of Data bits not supported.
 
constexpr return_t ERROR_CPHA = ERROR_SPECIFIC - 8
 
constexpr return_t ERROR_CPOL = ERROR_SPECIFIC - 7
 Specified Clock Phase not supported.
 
constexpr return_t ERROR_DATA_BITS = ERROR_SPECIFIC - 3
 Specified Parity not supported.
 
constexpr return_t ERROR_FLOW_CONTROL = ERROR_SPECIFIC - 6
 Specified Clock Polarity not supported.
 
constexpr return_t ERROR_MODE = ERROR_SPECIFIC - 1
 < Specified Mode not supported
 
constexpr return_t ERROR_PARITY = ERROR_SPECIFIC - 4
 Specified number of Stop bits not supported.
 
constexpr return_t ERROR_STOP_BITS = ERROR_SPECIFIC - 5
 Specified Flow Control not supported.
 
constexpr bit_number_t FLOW_CONFIG_Pos = 16
 
constexpr config_t FLOW_CONTROL_CTS = (2UL << FLOW_CONFIG_Pos)
 RTS/CTS Flow Control.
 
constexpr config_t FLOW_CONTROL_Msk = (3UL << FLOW_CONFIG_Pos)
 No Flow Control = (default);.
 
constexpr config_t FLOW_CONTROL_NONE = (0UL << FLOW_CONFIG_Pos)
 RTS Flow Control.
 
constexpr config_t FLOW_CONTROL_RTS = (1UL << FLOW_CONFIG_Pos)
 CTS Flow Control.
 
constexpr config_t FLOW_CONTROL_RTS_CTS = (3UL << FLOW_CONFIG_Pos)
 
constexpr config_t IRDA_PULSE = (0x11UL << CONFIG_Pos)
 Set Smart Card Guard Time; arg = number of bit periods.
 
constexpr config_t MODE_ASYNCHRONOUS = (0x01UL << CONFIG_Pos)
 < UART = (Asynchronous);; arg = Baudrate
 
constexpr config_t MODE_IRDA = (0x05UL << CONFIG_Pos)
 UART Smart Card; arg = Baudrate.
 
constexpr config_t MODE_SINGLE_WIRE = (0x04UL << CONFIG_Pos)
 UART IrDA; arg = Baudrate.
 
constexpr config_t MODE_SMART_CARD = (0x06UL << CONFIG_Pos)
 
constexpr config_t MODE_SYNCHRONOUS_MASTER = (0x02UL << CONFIG_Pos)
 Synchronous Slave = (external clock signal);.
 
constexpr config_t MODE_SYNCHRONOUS_SLAVE = (0x03UL << CONFIG_Pos)
 UART Single-wire = (half-duplex);; arg = Baudrate.
 
constexpr config_t PARITY_EVEN = (1UL << PARITY_Pos)
 Odd Parity.
 
constexpr config_t PARITY_Msk = (3UL << PARITY_Pos)
 No Parity = (default);.
 
constexpr config_t PARITY_NONE = (0UL << PARITY_Pos)
 Even Parity.
 
constexpr config_t PARITY_ODD = (2UL << PARITY_Pos)
 
constexpr bit_number_t PARITY_Pos = 12
 
constexpr config_t SMART_CARD_CLOCK = (0x13UL << CONFIG_Pos)
 Smart Card NACK generation; arg: 0=disabled, 1=enabled.
 
constexpr config_t SMART_CARD_GUARD_TIME = (0x12UL << CONFIG_Pos)
 Set Smart Card Clock in Hz; arg: 0=Clock not generated.
 
constexpr config_t SMART_CARD_NACK = (0x14UL << CONFIG_Pos)
 
constexpr config_t STOP_BITS_0_5 = (3UL << STOP_BITS_Pos)
 
constexpr config_t STOP_BITS_1 = (0UL << STOP_BITS_Pos)
 2 Stop bits
 
constexpr config_t STOP_BITS_1_5 = (2UL << STOP_BITS_Pos)
 0.5 Stop bits
 
constexpr config_t STOP_BITS_2 = (1UL << STOP_BITS_Pos)
 1.5 Stop bits
 
constexpr config_t STOP_BITS_Msk = (3UL << STOP_BITS_Pos)
 1 Stop bit = (default);
 
constexpr bit_number_t STOP_BITS_Pos = 14
 

Typedef Documentation

◆ bit_number_t

using os::driver::serial::bit_number_t = typedef uint32_t

Definition at line 50 of file serial.h.

◆ config_arg_t

using os::driver::serial::config_arg_t = typedef uint32_t

Definition at line 52 of file serial.h.

◆ config_t

using os::driver::serial::config_t = typedef uint32_t

Definition at line 51 of file serial.h.

◆ control_arg_t

using os::driver::serial::control_arg_t = typedef uint32_t

Definition at line 54 of file serial.h.

◆ control_t

using os::driver::serial::control_t = typedef uint32_t

Definition at line 53 of file serial.h.

◆ modem_config_t

using os::driver::serial::modem_config_t = typedef uint32_t

Definition at line 315 of file serial.h.

Enumeration Type Documentation

◆ Control

Enumerator
enable_tx 

Enable Transmitter.

Enable Receiver

enable_rx 

Enable Continuous Break transmission.

enable_break 

Abort Serial::send()

abort_send 

Abort Serial::receive()

abort_receive 

Abort Serial::transfer()

abort_transfer 

Disable Transmitter.

disable_tx 

Disable Receiver.

disable_rx 

Disable Continuous Break transmission;.

disable_break 

Definition at line 184 of file serial.h.

◆ Event

Serial Events.

Enumerator
send_complete 

Send completed; however USART may still transmit data.

Receive completed

receive_complete 

Transfer completed.

transfer_complete 

Transmit completed (optional)

tx_complete 

Transmit data not available (Synchronous Slave)

tx_underflow 

Receive data overflow.

rx_overflow 

Receive character timeout (optional)

rx_timeout 

Break detected on receive.

rx_break 

Framing error detected on receive.

rx_framing_error 

Parity error detected on receive.

rx_parity_error 

CTS state changed (optional)

cts 

DSR state changed (optional)

dsr 

DCD state changed (optional)

dcd 

RI state changed (optional)

ri 

Definition at line 393 of file serial.h.

◆ Modem_control

Configuration to change the serial modem lines.

Enumerator
clear_rts 

Deactivate RTS.

Activate RTS

set_rts 

Deactivate DTR.

clear_dtr 

Activate DTR.

set_dtr 

Definition at line 320 of file serial.h.

Function Documentation

◆ CONFIG_Msk()

constexpr config_t os::driver::serial::CONFIG_Msk ( 0xFFUL<<  CONFIG_Pos)
constexpr

Variable Documentation

◆ CONFIG_Pos

constexpr bit_number_t os::driver::serial::CONFIG_Pos = 0
constexpr

Definition at line 58 of file serial.h.

◆ CPHA0

constexpr config_t os::driver::serial::CPHA0 = (0UL << CPHA_Pos)
constexpr

CPHA = 1.

Definition at line 159 of file serial.h.

◆ CPHA1

constexpr config_t os::driver::serial::CPHA1 = (1UL << CPHA_Pos)
constexpr

Definition at line 162 of file serial.h.

◆ CPHA_Msk

constexpr config_t os::driver::serial::CPHA_Msk = (1UL << CPHA_Pos)
constexpr

CPHA = 0 = (default);.

Definition at line 156 of file serial.h.

◆ CPHA_Pos

constexpr bit_number_t os::driver::serial::CPHA_Pos = 19
constexpr

Definition at line 155 of file serial.h.

◆ CPOL0

constexpr config_t os::driver::serial::CPOL0 = (0UL << CPOL_Pos)
constexpr

CPOL = 1.

Definition at line 149 of file serial.h.

◆ CPOL1

constexpr config_t os::driver::serial::CPOL1 = (1UL << CPOL_Pos)
constexpr

Definition at line 152 of file serial.h.

◆ CPOL_Msk

constexpr config_t os::driver::serial::CPOL_Msk = (1UL << CPOL_Pos)
constexpr

CPOL = 0 = (default);.

Definition at line 146 of file serial.h.

◆ CPOL_Pos

constexpr bit_number_t os::driver::serial::CPOL_Pos = 18
constexpr

Definition at line 145 of file serial.h.

◆ DATA_BITS_5

constexpr config_t os::driver::serial::DATA_BITS_5 = (5UL << DATA_BITS_Pos)
constexpr

6 Data bit

Definition at line 85 of file serial.h.

◆ DATA_BITS_6

constexpr config_t os::driver::serial::DATA_BITS_6 = (6UL << DATA_BITS_Pos)
constexpr

7 Data bits

Definition at line 88 of file serial.h.

◆ DATA_BITS_7

constexpr config_t os::driver::serial::DATA_BITS_7 = (7UL << DATA_BITS_Pos)
constexpr

8 Data bits = (default);

Definition at line 91 of file serial.h.

◆ DATA_BITS_8

constexpr config_t os::driver::serial::DATA_BITS_8 = (0UL << DATA_BITS_Pos)
constexpr

9 Data bits

Definition at line 94 of file serial.h.

◆ DATA_BITS_9

constexpr config_t os::driver::serial::DATA_BITS_9 = (1UL << DATA_BITS_Pos)
constexpr

Definition at line 97 of file serial.h.

◆ DATA_BITS_Msk

constexpr config_t os::driver::serial::DATA_BITS_Msk = (7UL << DATA_BITS_Pos)
constexpr

5 Data bits

Definition at line 82 of file serial.h.

◆ DATA_BITS_Pos

constexpr bit_number_t os::driver::serial::DATA_BITS_Pos = 8
constexpr

Definition at line 81 of file serial.h.

◆ DEFAULT_TX_VALUE

constexpr config_t os::driver::serial::DEFAULT_TX_VALUE = (0x10UL << CONFIG_Pos)
constexpr

< Set default Transmit value = (Synchronous Receive only); arg = value

Set IrDA Pulse in ns; arg: 0=3/16 of bit period

Definition at line 167 of file serial.h.

◆ ERROR_BAUDRATE

constexpr return_t os::driver::serial::ERROR_BAUDRATE = ERROR_SPECIFIC - 2
constexpr

Specified number of Data bits not supported.

Definition at line 223 of file serial.h.

◆ ERROR_CPHA

constexpr return_t os::driver::serial::ERROR_CPHA = ERROR_SPECIFIC - 8
constexpr

Definition at line 241 of file serial.h.

◆ ERROR_CPOL

constexpr return_t os::driver::serial::ERROR_CPOL = ERROR_SPECIFIC - 7
constexpr

Specified Clock Phase not supported.

Definition at line 238 of file serial.h.

◆ ERROR_DATA_BITS

constexpr return_t os::driver::serial::ERROR_DATA_BITS = ERROR_SPECIFIC - 3
constexpr

Specified Parity not supported.

Definition at line 226 of file serial.h.

◆ ERROR_FLOW_CONTROL

constexpr return_t os::driver::serial::ERROR_FLOW_CONTROL = ERROR_SPECIFIC - 6
constexpr

Specified Clock Polarity not supported.

Definition at line 235 of file serial.h.

◆ ERROR_MODE

constexpr return_t os::driver::serial::ERROR_MODE = ERROR_SPECIFIC - 1
constexpr

< Specified Mode not supported

Specified baudrate not supported

Definition at line 220 of file serial.h.

◆ ERROR_PARITY

constexpr return_t os::driver::serial::ERROR_PARITY = ERROR_SPECIFIC - 4
constexpr

Specified number of Stop bits not supported.

Definition at line 229 of file serial.h.

◆ ERROR_STOP_BITS

constexpr return_t os::driver::serial::ERROR_STOP_BITS = ERROR_SPECIFIC - 5
constexpr

Specified Flow Control not supported.

Definition at line 232 of file serial.h.

◆ FLOW_CONFIG_Pos

constexpr bit_number_t os::driver::serial::FLOW_CONFIG_Pos = 16
constexpr

Definition at line 129 of file serial.h.

◆ FLOW_CONTROL_CTS

constexpr config_t os::driver::serial::FLOW_CONTROL_CTS = (2UL << FLOW_CONFIG_Pos)
constexpr

RTS/CTS Flow Control.

Definition at line 139 of file serial.h.

◆ FLOW_CONTROL_Msk

constexpr config_t os::driver::serial::FLOW_CONTROL_Msk = (3UL << FLOW_CONFIG_Pos)
constexpr

No Flow Control = (default);.

Definition at line 130 of file serial.h.

◆ FLOW_CONTROL_NONE

constexpr config_t os::driver::serial::FLOW_CONTROL_NONE = (0UL << FLOW_CONFIG_Pos)
constexpr

RTS Flow Control.

Definition at line 133 of file serial.h.

◆ FLOW_CONTROL_RTS

constexpr config_t os::driver::serial::FLOW_CONTROL_RTS = (1UL << FLOW_CONFIG_Pos)
constexpr

CTS Flow Control.

Definition at line 136 of file serial.h.

◆ FLOW_CONTROL_RTS_CTS

constexpr config_t os::driver::serial::FLOW_CONTROL_RTS_CTS = (3UL << FLOW_CONFIG_Pos)
constexpr

Definition at line 142 of file serial.h.

◆ IRDA_PULSE

constexpr config_t os::driver::serial::IRDA_PULSE = (0x11UL << CONFIG_Pos)
constexpr

Set Smart Card Guard Time; arg = number of bit periods.

Definition at line 170 of file serial.h.

◆ MODE_ASYNCHRONOUS

constexpr config_t os::driver::serial::MODE_ASYNCHRONOUS = (0x01UL << CONFIG_Pos)
constexpr

< UART = (Asynchronous);; arg = Baudrate

Synchronous Master = (generates clock signal); arg = Baudrate

Definition at line 63 of file serial.h.

◆ MODE_IRDA

constexpr config_t os::driver::serial::MODE_IRDA = (0x05UL << CONFIG_Pos)
constexpr

UART Smart Card; arg = Baudrate.

Definition at line 75 of file serial.h.

◆ MODE_SINGLE_WIRE

constexpr config_t os::driver::serial::MODE_SINGLE_WIRE = (0x04UL << CONFIG_Pos)
constexpr

UART IrDA; arg = Baudrate.

Definition at line 72 of file serial.h.

◆ MODE_SMART_CARD

constexpr config_t os::driver::serial::MODE_SMART_CARD = (0x06UL << CONFIG_Pos)
constexpr

Definition at line 78 of file serial.h.

◆ MODE_SYNCHRONOUS_MASTER

constexpr config_t os::driver::serial::MODE_SYNCHRONOUS_MASTER = (0x02UL << CONFIG_Pos)
constexpr

Synchronous Slave = (external clock signal);.

Definition at line 66 of file serial.h.

◆ MODE_SYNCHRONOUS_SLAVE

constexpr config_t os::driver::serial::MODE_SYNCHRONOUS_SLAVE = (0x03UL << CONFIG_Pos)
constexpr

UART Single-wire = (half-duplex);; arg = Baudrate.

Definition at line 69 of file serial.h.

◆ PARITY_EVEN

constexpr config_t os::driver::serial::PARITY_EVEN = (1UL << PARITY_Pos)
constexpr

Odd Parity.

Definition at line 107 of file serial.h.

◆ PARITY_Msk

constexpr config_t os::driver::serial::PARITY_Msk = (3UL << PARITY_Pos)
constexpr

No Parity = (default);.

Definition at line 101 of file serial.h.

◆ PARITY_NONE

constexpr config_t os::driver::serial::PARITY_NONE = (0UL << PARITY_Pos)
constexpr

Even Parity.

Definition at line 104 of file serial.h.

◆ PARITY_ODD

constexpr config_t os::driver::serial::PARITY_ODD = (2UL << PARITY_Pos)
constexpr

Definition at line 110 of file serial.h.

◆ PARITY_Pos

constexpr bit_number_t os::driver::serial::PARITY_Pos = 12
constexpr

Definition at line 100 of file serial.h.

◆ SMART_CARD_CLOCK

constexpr config_t os::driver::serial::SMART_CARD_CLOCK = (0x13UL << CONFIG_Pos)
constexpr

Smart Card NACK generation; arg: 0=disabled, 1=enabled.

Definition at line 176 of file serial.h.

◆ SMART_CARD_GUARD_TIME

constexpr config_t os::driver::serial::SMART_CARD_GUARD_TIME = (0x12UL << CONFIG_Pos)
constexpr

Set Smart Card Clock in Hz; arg: 0=Clock not generated.

Definition at line 173 of file serial.h.

◆ SMART_CARD_NACK

constexpr config_t os::driver::serial::SMART_CARD_NACK = (0x14UL << CONFIG_Pos)
constexpr

Definition at line 179 of file serial.h.

◆ STOP_BITS_0_5

constexpr config_t os::driver::serial::STOP_BITS_0_5 = (3UL << STOP_BITS_Pos)
constexpr

Definition at line 126 of file serial.h.

◆ STOP_BITS_1

constexpr config_t os::driver::serial::STOP_BITS_1 = (0UL << STOP_BITS_Pos)
constexpr

2 Stop bits

Definition at line 117 of file serial.h.

◆ STOP_BITS_1_5

constexpr config_t os::driver::serial::STOP_BITS_1_5 = (2UL << STOP_BITS_Pos)
constexpr

0.5 Stop bits

Definition at line 123 of file serial.h.

◆ STOP_BITS_2

constexpr config_t os::driver::serial::STOP_BITS_2 = (1UL << STOP_BITS_Pos)
constexpr

1.5 Stop bits

Definition at line 120 of file serial.h.

◆ STOP_BITS_Msk

constexpr config_t os::driver::serial::STOP_BITS_Msk = (3UL << STOP_BITS_Pos)
constexpr

1 Stop bit = (default);

Definition at line 114 of file serial.h.

◆ STOP_BITS_Pos

constexpr bit_number_t os::driver::serial::STOP_BITS_Pos = 14
constexpr

Definition at line 113 of file serial.h.