APM:Libraries
|
#include <UARTDriver.h>
Classes | |
struct | SerialDef |
Public Member Functions | |
UARTDriver (uint8_t serial_num) | |
void | begin (uint32_t b) |
void | begin (uint32_t b, uint16_t rxS, uint16_t txS) |
void | end () |
void | flush () |
bool | is_initialized () |
void | set_blocking_writes (bool blocking) |
bool | tx_pending () |
uint32_t | available () override |
uint32_t | txspace () override |
int16_t | read () override |
void | _timer_tick (void) override |
size_t | write (uint8_t c) |
size_t | write (const uint8_t *buffer, size_t size) |
bool | lock_port (uint32_t key) override |
size_t | write_locked (const uint8_t *buffer, size_t size, uint32_t key) override |
bool | wait_timeout (uint16_t n, uint32_t timeout_ms) override |
void | set_flow_control (enum flow_control flow_control) override |
enum flow_control | get_flow_control (void) override |
bool | set_unbuffered_writes (bool on) override |
void | configure_parity (uint8_t v) override |
void | set_stop_bits (int n) override |
uint64_t | receive_time_constraint_us (uint16_t nbytes) override |
Public Member Functions inherited from AP_HAL::UARTDriver | |
UARTDriver () | |
virtual void | set_flow_control (enum flow_control flow_control_setting) |
Public Member Functions inherited from AP_HAL::BetterStream | |
virtual void | printf (const char *,...) FMT_PRINTF(2 |
virtual void virtual void | vprintf (const char *, va_list) |
void | print (const char *str) |
void | println (const char *str) |
size_t | write (const char *str) |
Private Member Functions | |
void | dma_tx_allocate (Shared_DMA *ctx) |
void | dma_tx_deallocate (Shared_DMA *ctx) |
void | update_rts_line (void) |
void | check_dma_tx_completion (void) |
void | write_pending_bytes_DMA (uint32_t n) |
void | write_pending_bytes_NODMA (uint32_t n) |
void | write_pending_bytes (void) |
void | receive_timestamp_update (void) |
void | thread_init () |
Static Private Member Functions | |
static void | rx_irq_cb (void *sd) |
static void | rxbuff_full_irq (void *self, uint32_t flags) |
static void | tx_complete (void *self, uint32_t flags) |
static void | uart_thread (void *) |
Private Attributes | |
bool | tx_bounce_buf_ready |
const SerialDef & | sdef |
uint8_t | serial_num |
uint32_t | lock_key |
uint32_t | _baudrate |
uint16_t | tx_len |
SerialConfig | sercfg |
const thread_t * | _uart_owner_thd |
struct { | |
thread_t * thread_ctx | |
uint16_t n | |
} | _wait |
uint8_t | rx_bounce_buf [RX_BOUNCE_BUFSIZE] |
uint8_t | tx_bounce_buf [TX_BOUNCE_BUFSIZE] |
ByteBuffer | _readbuf {0} |
ByteBuffer | _writebuf {0} |
Semaphore | _write_mutex |
const stm32_dma_stream_t * | rxdma |
const stm32_dma_stream_t * | txdma |
bool | _in_timer |
bool | _blocking_writes |
bool | _initialised |
bool | _device_initialised |
bool | _lock_rx_in_timer_tick = false |
Shared_DMA * | dma_handle |
uint64_t | _receive_timestamp [2] |
uint8_t | _receive_timestamp_idx |
enum flow_control | _flow_control = FLOW_CONTROL_DISABLE |
bool | _rts_is_active |
uint32_t | _last_write_completed_us |
uint32_t | _first_write_started_us |
bool | unbuffered_writes |
Static Private Attributes | |
static thread_t * | uart_thread_ctx |
static uint32_t | last_thread_run_us |
static UARTDriver * | uart_drivers [UART_MAX_DRIVERS] |
static const SerialDef | _serial_tab [] = { HAL_UART_DEVICE_LIST } |
Additional Inherited Members | |
Public Types inherited from AP_HAL::UARTDriver | |
enum | flow_control { FLOW_CONTROL_DISABLE =0, FLOW_CONTROL_ENABLE =1, FLOW_CONTROL_AUTO =2 } |
Definition at line 30 of file UARTDriver.h.
UARTDriver::UARTDriver | ( | uint8_t | serial_num | ) |
Definition at line 55 of file UARTDriver.cpp.
|
overridevirtual |
Reimplemented from AP_HAL::UARTDriver.
Definition at line 727 of file UARTDriver.cpp.
Referenced by uart_thread().
|
overridevirtual |
Implements AP_HAL::BetterStream.
Definition at line 436 of file UARTDriver.cpp.
Referenced by receive_time_constraint_us(), and wait_timeout().
|
virtual |
Implements AP_HAL::UARTDriver.
Definition at line 387 of file UARTDriver.cpp.
|
virtual |
Extended port open method
Allows for both opening with specified buffer sizes, and re-opening to adjust a subset of the port's settings.
baud | Selects the speed that the port will be configured to. If zero, the port speed is left unchanged. |
rxSpace | Sets the receive buffer size for the port. If zero then the buffer size is left unchanged if the port is open, or set to ::_default_rx_buffer_size if it is currently closed. |
txSpace | Sets the transmit buffer size for the port. If zero then the buffer size is left unchanged if the port is open, or set to ::_default_tx_buffer_size if it is currently closed. |
Implements AP_HAL::UARTDriver.
Definition at line 128 of file UARTDriver.cpp.
|
private |
Definition at line 588 of file UARTDriver.cpp.
Referenced by write_pending_bytes(), and write_pending_bytes_DMA().
|
overridevirtual |
Reimplemented from AP_HAL::UARTDriver.
Definition at line 902 of file UARTDriver.cpp.
Referenced by get_flow_control().
|
private |
Definition at line 284 of file UARTDriver.cpp.
Referenced by begin().
|
private |
Definition at line 304 of file UARTDriver.cpp.
Referenced by begin().
|
virtual |
Implements AP_HAL::UARTDriver.
Definition at line 392 of file UARTDriver.cpp.
|
virtual |
Implements AP_HAL::UARTDriver.
Definition at line 411 of file UARTDriver.cpp.
|
inlineoverridevirtual |
Reimplemented from AP_HAL::UARTDriver.
Definition at line 76 of file UARTDriver.h.
|
virtual |
Implements AP_HAL::UARTDriver.
Definition at line 423 of file UARTDriver.cpp.
|
overridevirtual |
Reimplemented from AP_HAL::UARTDriver.
Definition at line 540 of file UARTDriver.cpp.
|
overridevirtual |
Implements AP_HAL::BetterStream.
Definition at line 459 of file UARTDriver.cpp.
|
overridevirtual |
Reimplemented from AP_HAL::UARTDriver.
Definition at line 991 of file UARTDriver.cpp.
Referenced by get_flow_control().
|
private |
Definition at line 972 of file UARTDriver.cpp.
Referenced by _timer_tick(), and rxbuff_full_irq().
|
staticprivate |
Definition at line 332 of file UARTDriver.cpp.
Referenced by begin().
|
staticprivate |
Definition at line 354 of file UARTDriver.cpp.
Referenced by begin().
|
virtual |
Implements AP_HAL::UARTDriver.
Definition at line 428 of file UARTDriver.cpp.
|
override |
Referenced by _timer_tick(), begin(), ChibiOS::UARTDriver::SerialDef::get_index(), and write_pending_bytes().
|
overridevirtual |
Reimplemented from AP_HAL::UARTDriver.
Definition at line 943 of file UARTDriver.cpp.
Referenced by get_flow_control().
|
overridevirtual |
Reimplemented from AP_HAL::UARTDriver.
Definition at line 889 of file UARTDriver.cpp.
Referenced by get_flow_control().
|
private |
Definition at line 100 of file UARTDriver.cpp.
Referenced by begin().
|
staticprivate |
Definition at line 315 of file UARTDriver.cpp.
Referenced by dma_tx_allocate().
|
virtual |
Implements AP_HAL::UARTDriver.
Definition at line 433 of file UARTDriver.cpp.
|
overridevirtual |
Implements AP_HAL::BetterStream.
Definition at line 451 of file UARTDriver.cpp.
|
staticprivate |
Definition at line 73 of file UARTDriver.cpp.
Referenced by thread_init().
|
private |
Definition at line 871 of file UARTDriver.cpp.
Referenced by _timer_tick(), read(), and rxbuff_full_irq().
|
overridevirtual |
Reimplemented from AP_HAL::UARTDriver.
Definition at line 573 of file UARTDriver.cpp.
Referenced by ChibiOS::UARTDriver::SerialDef::get_index().
|
virtual |
Implements AP_HAL::BetterStream.
Definition at line 480 of file UARTDriver.cpp.
Referenced by write().
|
virtual |
Reimplemented from AP_HAL::BetterStream.
Definition at line 506 of file UARTDriver.cpp.
|
overridevirtual |
Reimplemented from AP_HAL::UARTDriver.
Definition at line 554 of file UARTDriver.cpp.
|
private |
Definition at line 687 of file UARTDriver.cpp.
Referenced by _timer_tick(), and write().
|
private |
Definition at line 606 of file UARTDriver.cpp.
Referenced by write_pending_bytes().
|
private |
Definition at line 652 of file UARTDriver.cpp.
Referenced by write_pending_bytes().
|
private |
Definition at line 118 of file UARTDriver.h.
Referenced by begin(), receive_time_constraint_us(), and write_pending_bytes_DMA().
|
private |
Definition at line 142 of file UARTDriver.h.
Referenced by set_blocking_writes(), and write().
|
private |
Definition at line 144 of file UARTDriver.h.
Referenced by begin().
|
private |
Definition at line 157 of file UARTDriver.h.
Referenced by _timer_tick(), and write_pending_bytes().
|
private |
Definition at line 154 of file UARTDriver.h.
Referenced by _timer_tick(), begin(), get_flow_control(), update_rts_line(), and write_pending_bytes().
|
private |
Definition at line 141 of file UARTDriver.h.
Referenced by _timer_tick(), begin(), and end().
|
private |
Definition at line 143 of file UARTDriver.h.
Referenced by _timer_tick(), available(), begin(), end(), is_initialized(), read(), txspace(), uart_thread(), and write().
|
private |
Definition at line 156 of file UARTDriver.h.
Referenced by _timer_tick(), check_dma_tx_completion(), tx_complete(), write_pending_bytes(), and write_pending_bytes_NODMA().
|
private |
Definition at line 145 of file UARTDriver.h.
Referenced by _timer_tick(), and rxbuff_full_irq().
|
private |
Definition at line 136 of file UARTDriver.h.
Referenced by _timer_tick(), available(), begin(), end(), read(), rxbuff_full_irq(), and update_rts_line().
|
private |
Definition at line 150 of file UARTDriver.h.
Referenced by receive_time_constraint_us(), and receive_timestamp_update().
|
private |
Definition at line 151 of file UARTDriver.h.
Referenced by receive_time_constraint_us(), and receive_timestamp_update().
|
private |
Definition at line 155 of file UARTDriver.h.
Referenced by _timer_tick(), read(), rxbuff_full_irq(), and update_rts_line().
|
staticprivate |
Definition at line 147 of file UARTDriver.h.
Referenced by ChibiOS::UARTDriver::SerialDef::get_index().
|
private |
Definition at line 123 of file UARTDriver.h.
struct { ... } ChibiOS::UARTDriver::_wait |
Referenced by _timer_tick(), rxbuff_full_irq(), and wait_timeout().
|
private |
Definition at line 138 of file UARTDriver.h.
Referenced by _timer_tick(), write(), and write_locked().
|
private |
Definition at line 137 of file UARTDriver.h.
Referenced by begin(), end(), tx_complete(), txspace(), write(), write_locked(), write_pending_bytes(), write_pending_bytes_DMA(), and write_pending_bytes_NODMA().
|
private |
Definition at line 146 of file UARTDriver.h.
Referenced by begin(), check_dma_tx_completion(), tx_complete(), and write_pending_bytes_DMA().
|
staticprivate |
Definition at line 107 of file UARTDriver.h.
Referenced by uart_thread().
|
private |
Definition at line 116 of file UARTDriver.h.
Referenced by lock_port(), write(), and write_locked().
uint16_t ChibiOS::UARTDriver::n |
Definition at line 129 of file UARTDriver.h.
Referenced by ChibiOS::UARTDriver::SerialDef::get_index(), rxbuff_full_irq(), wait_timeout(), and write_pending_bytes().
|
private |
Definition at line 134 of file UARTDriver.h.
Referenced by _timer_tick(), begin(), and rxbuff_full_irq().
|
private |
Definition at line 139 of file UARTDriver.h.
Referenced by _timer_tick(), begin(), rx_irq_cb(), and rxbuff_full_irq().
|
private |
Definition at line 101 of file UARTDriver.h.
Referenced by _timer_tick(), available(), begin(), configure_parity(), dma_tx_allocate(), end(), flush(), receive_time_constraint_us(), rx_irq_cb(), rxbuff_full_irq(), set_stop_bits(), set_unbuffered_writes(), update_rts_line(), write_pending_bytes(), write_pending_bytes_DMA(), and write_pending_bytes_NODMA().
|
private |
Definition at line 121 of file UARTDriver.h.
Referenced by begin(), configure_parity(), and set_stop_bits().
|
private |
Definition at line 113 of file UARTDriver.h.
Referenced by begin(), tx_complete(), and UARTDriver().
thread_t* ChibiOS::UARTDriver::thread_ctx |
Definition at line 127 of file UARTDriver.h.
Referenced by rxbuff_full_irq().
|
private |
Definition at line 135 of file UARTDriver.h.
Referenced by write_pending_bytes_DMA().
|
private |
Definition at line 100 of file UARTDriver.h.
Referenced by check_dma_tx_completion(), tx_complete(), and write_pending_bytes_DMA().
|
private |
Definition at line 119 of file UARTDriver.h.
Referenced by write_pending_bytes_DMA().
|
private |
Definition at line 140 of file UARTDriver.h.
Referenced by check_dma_tx_completion(), dma_tx_allocate(), dma_tx_deallocate(), and write_pending_bytes_DMA().
|
staticprivate |
Definition at line 110 of file UARTDriver.h.
Referenced by uart_thread(), and UARTDriver().
|
staticprivate |
Definition at line 104 of file UARTDriver.h.
Referenced by thread_init(), tx_complete(), and uart_thread().
|
private |
Definition at line 160 of file UARTDriver.h.
Referenced by _timer_tick(), set_unbuffered_writes(), tx_complete(), and write().