Transmitter (USART).
See Quick start guide for the SAM USART module.
This is a low-level driver implementation for the SAM Universal Synchronous/Asynchronous Receiver/Transmitter.
Data Structures | |
struct | sam_usart_opt_t |
struct | usart_iso7816_opt_t |
struct | usart_spi_opt_t |
Macros | |
#define | SPI_CPHA (1 << 0) |
Clock phase. More... | |
#define | SPI_CPOL (1 << 1) |
Clock polarity. More... | |
#define | SPI_MODE_0 0 |
SPI mode definition. More... | |
#define | SPI_MODE_1 (SPI_CPHA) |
#define | SPI_MODE_2 (SPI_CPOL) |
#define | SPI_MODE_3 (SPI_CPOL | SPI_CPHA) |
#define | US_MR_USART_MODE_LIN_MASTER 0x0A |
micro definition for LIN mode of SAMV71 More... | |
#define | US_MR_USART_MODE_LIN_SLAVE 0x0B |
Functions | |
void | usart_disable_interrupt (Usart *p_usart, uint32_t ul_sources) |
Disable USART interrupts. More... | |
void | usart_disable_rx (Usart *p_usart) |
Disable USART receiver. More... | |
void | usart_disable_tx (Usart *p_usart) |
Disable USART transmitter. More... | |
void | usart_disable_writeprotect (Usart *p_usart) |
Disable write protect of USART registers. More... | |
void | usart_drive_DTR_pin_high (Usart *p_usart) |
void | usart_drive_DTR_pin_low (Usart *p_usart) |
void | usart_drive_RTS_pin_high (Usart *p_usart) |
Drive the pin RTS to 1. More... | |
void | usart_drive_RTS_pin_low (Usart *p_usart) |
Drive the pin RTS to 0. More... | |
void | usart_enable_interrupt (Usart *p_usart, uint32_t ul_sources) |
Enable USART interrupts. More... | |
void | usart_enable_rx (Usart *p_usart) |
Enable USART receiver. More... | |
void | usart_enable_tx (Usart *p_usart) |
Enable USART transmitter. More... | |
void | usart_enable_writeprotect (Usart *p_usart) |
Enable write protect of USART registers. More... | |
uint8_t | usart_get_error_number (Usart *p_usart) |
uint32_t | usart_get_interrupt_mask (Usart *p_usart) |
Read USART interrupt mask. More... | |
Pdc * | usart_get_pdc_base (Usart *p_usart) |
uint32_t * | usart_get_rx_access (Usart *p_usart) |
uint32_t | usart_get_status (Usart *p_usart) |
Get current status. More... | |
uint32_t * | usart_get_tx_access (Usart *p_usart) |
uint32_t | usart_get_version (Usart *p_usart) |
uint32_t | usart_get_writeprotect_status (Usart *p_usart) |
Get write protect status. More... | |
uint32_t | usart_getchar (Usart *p_usart, uint32_t *c) |
Read from USART Receive Holding Register. More... | |
uint32_t | usart_init_hw_handshaking (Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck) |
Configure USART to work in hardware handshaking mode. More... | |
uint32_t | usart_init_irda (Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck) |
uint32_t | usart_init_iso7816 (Usart *p_usart, const usart_iso7816_opt_t *p_usart_opt, uint32_t ul_mck) |
uint32_t | usart_init_lin_master (Usart *p_usart, uint32_t ul_baudrate, uint32_t ul_mck) |
uint32_t | usart_init_lin_slave (Usart *p_usart, uint32_t ul_baudrate, uint32_t ul_mck) |
uint32_t | usart_init_lon (Usart *p_usart, uint32_t ul_baudrate, uint32_t ul_mck) |
uint32_t | usart_init_modem (Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck) |
uint32_t | usart_init_rs232 (Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck) |
Configure USART to work in RS232 mode. More... | |
uint32_t | usart_init_rs485 (Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck) |
Configure USART to work in RS485 mode. More... | |
uint32_t | usart_init_spi_master (Usart *p_usart, const usart_spi_opt_t *p_usart_opt, uint32_t ul_mck) |
Configure USART to work in SPI mode and act as a master. More... | |
uint32_t | usart_init_spi_slave (Usart *p_usart, const usart_spi_opt_t *p_usart_opt) |
Configure USART to work in SPI mode and act as a slave. More... | |
uint32_t | usart_init_sync_master (Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck) |
Configure USART to work in SYNC mode and act as a master. More... | |
uint32_t | usart_init_sync_slave (Usart *p_usart, const sam_usart_opt_t *p_usart_opt) |
Configure USART to work in SYNC mode and act as a slave. More... | |
uint32_t | usart_is_rx_buf_end (Usart *p_usart) |
uint32_t | usart_is_rx_buf_full (Usart *p_usart) |
uint32_t | usart_is_rx_ready (Usart *p_usart) |
Check if the received data are ready. More... | |
uint32_t | usart_is_tx_buf_empty (Usart *p_usart) |
uint32_t | usart_is_tx_buf_end (Usart *p_usart) |
uint32_t | usart_is_tx_empty (Usart *p_usart) |
Check if Transmit Holding Register is empty. More... | |
uint32_t | usart_is_tx_ready (Usart *p_usart) |
Check if Transmit is Ready. More... | |
void | usart_lin_abort_tx (Usart *p_usart) |
void | usart_lin_disable_checksum (Usart *p_usart) |
void | usart_lin_disable_frame_slot (Usart *p_usart) |
void | usart_lin_disable_parity (Usart *p_usart) |
void | usart_lin_disable_pdc_mode (Usart *p_usart) |
void | usart_lin_enable_checksum (Usart *p_usart) |
void | usart_lin_enable_frame_slot (Usart *p_usart) |
void | usart_lin_enable_parity (Usart *p_usart) |
void | usart_lin_enable_pdc_mode (Usart *p_usart) |
uint8_t | usart_lin_get_data_length (Usart *usart) |
uint8_t | usart_lin_identifier_reception_complete (Usart *usart) |
uint8_t | usart_lin_identifier_send_complete (Usart *usart) |
uint8_t | usart_lin_read_identifier (Usart *p_usart) |
void | usart_lin_send_wakeup_signal (Usart *p_usart) |
void | usart_lin_set_checksum_type (Usart *p_usart, uint8_t uc_type) |
void | usart_lin_set_data_len_mode (Usart *p_usart, uint8_t uc_mode) |
void | usart_lin_set_node_action (Usart *p_usart, uint8_t uc_action) |
void | usart_lin_set_response_data_len (Usart *p_usart, uint8_t uc_len) |
void | usart_lin_set_tx_identifier (Usart *p_usart, uint8_t uc_id) |
void | usart_lin_set_wakeup_signal_type (Usart *p_usart, uint8_t uc_type) |
uint8_t | usart_lin_tx_complete (Usart *usart) |
void | usart_lon_disable_coll_detection (Usart *p_usart) |
void | usart_lon_enable_coll_detection (Usart *p_usart) |
uint32_t | usart_lon_is_rx_end (Usart *p_usart) |
uint32_t | usart_lon_is_tx_end (Usart *p_usart) |
void | usart_lon_set_beta1_rx_len (Usart *p_usart, uint32_t ul_len) |
void | usart_lon_set_beta1_tx_len (Usart *p_usart, uint32_t ul_len) |
void | usart_lon_set_cdtail (Usart *p_usart, uint8_t uc_type) |
void | usart_lon_set_comm_type (Usart *p_usart, uint8_t uc_type) |
void | usart_lon_set_data_len (Usart *p_usart, uint8_t uc_len) |
void | usart_lon_set_dmam (Usart *p_usart, uint8_t uc_type) |
void | usart_lon_set_l2hdr (Usart *p_usart, uint8_t uc_bli, uint8_t uc_altp, uint8_t uc_pb) |
void | usart_lon_set_pre_len (Usart *p_usart, uint32_t ul_len) |
void | usart_lon_set_priority (Usart *p_usart, uint8_t uc_psnb, uint8_t uc_nps) |
void | usart_lon_set_rx_idt (Usart *p_usart, uint32_t ul_time) |
void | usart_lon_set_tcol (Usart *p_usart, uint8_t uc_type) |
void | usart_lon_set_tx_idt (Usart *p_usart, uint32_t ul_time) |
void | usart_man_disable_drift_compensation (Usart *p_usart) |
void | usart_man_enable_drift_compensation (Usart *p_usart) |
void | usart_man_set_rx_polarity (Usart *p_usart, uint8_t uc_polarity) |
void | usart_man_set_rx_pre_len (Usart *p_usart, uint8_t uc_len) |
void | usart_man_set_rx_pre_pattern (Usart *p_usart, uint8_t uc_pattern) |
void | usart_man_set_tx_polarity (Usart *p_usart, uint8_t uc_polarity) |
void | usart_man_set_tx_pre_len (Usart *p_usart, uint8_t uc_len) |
void | usart_man_set_tx_pre_pattern (Usart *p_usart, uint8_t uc_pattern) |
uint32_t | usart_putchar (Usart *p_usart, uint32_t c) |
Write to USART Transmit Holding Register. More... | |
uint32_t | usart_read (Usart *p_usart, uint32_t *c) |
Read from USART Receive Holding Register. More... | |
void | usart_reset (Usart *p_usart) |
Reset the USART and disable TX and RX. More... | |
void | usart_reset_iterations (Usart *p_usart) |
void | usart_reset_nack (Usart *p_usart) |
void | usart_reset_rx (Usart *p_usart) |
Immediately stop and disable USART receiver. More... | |
void | usart_reset_status (Usart *p_usart) |
Reset status bits (PARE, OVER, MANERR, UNRE and PXBRK in US_CSR). More... | |
void | usart_reset_tx (Usart *p_usart) |
Immediately stop and disable USART transmitter. More... | |
void | usart_restart_rx_timeout (Usart *p_usart) |
Restart the receive timeout. More... | |
uint32_t | usart_send_address (Usart *p_usart, uint32_t ul_addr) |
In Multidrop mode only, the next character written to the US_THR is sent with the address bit set. More... | |
uint32_t | usart_set_async_baudrate (Usart *p_usart, uint32_t baudrate, uint32_t ul_mck) |
Calculate a clock divider(CD) and a fractional part (FP) for the USART asynchronous modes to generate a baudrate as close as possible to the baudrate set point. More... | |
void | usart_set_rx_timeout (Usart *p_usart, uint32_t timeout) |
Configure the receive timeout register. More... | |
void | usart_set_sleepwalking (Usart *p_uart, uint8_t ul_low_value, bool cmpmode, bool cmppar, uint8_t ul_high_value) |
void | usart_set_tx_timeguard (Usart *p_usart, uint32_t timeguard) |
Configure the transmit timeguard register. More... | |
void | usart_spi_force_chip_select (Usart *p_usart) |
Drive the slave select line NSS (RTS pin) to 0 in SPI master mode. More... | |
void | usart_spi_release_chip_select (Usart *p_usart) |
Drive the slave select line NSS (RTS pin) to 1 in SPI master mode. More... | |
void | usart_start_rx_timeout (Usart *p_usart) |
Start waiting for a character before clocking the timeout count. More... | |
void | usart_start_tx_break (Usart *p_usart) |
Start transmission of a break. More... | |
void | usart_stop_tx_break (Usart *p_usart) |
Stop transmission of a break. More... | |
uint32_t | usart_write (Usart *p_usart, uint32_t c) |
Write to USART Transmit Holding Register. More... | |
void | usart_write_line (Usart *p_usart, const char *string) |
Write one-line string through USART. More... | |
#define SPI_CPHA (1 << 0) |
Clock phase.
#define SPI_CPOL (1 << 1) |
Clock polarity.
#define SPI_MODE_0 0 |
SPI mode definition.
Referenced by usart_init_spi_master(), and usart_init_spi_slave().
#define SPI_MODE_1 (SPI_CPHA) |
Referenced by usart_init_spi_master(), and usart_init_spi_slave().
#define SPI_MODE_2 (SPI_CPOL) |
Referenced by usart_init_spi_master(), and usart_init_spi_slave().
Referenced by usart_init_spi_master(), and usart_init_spi_slave().
#define US_MR_USART_MODE_LIN_MASTER 0x0A |
micro definition for LIN mode of SAMV71
#define US_MR_USART_MODE_LIN_SLAVE 0x0B |
void usart_disable_interrupt | ( | Usart * | p_usart, |
uint32_t | ul_sources | ||
) |
Disable USART interrupts.
p_usart | Pointer to a USART peripheral. |
ul_sources | Interrupt sources bit map. |
void usart_disable_rx | ( | Usart * | p_usart | ) |
Disable USART receiver.
p_usart | Pointer to a USART instance. |
void usart_disable_tx | ( | Usart * | p_usart | ) |
Disable USART transmitter.
p_usart | Pointer to a USART instance. |
void usart_disable_writeprotect | ( | Usart * | p_usart | ) |
Disable write protect of USART registers.
p_usart | Pointer to a USART instance. |
References US_WPMR_WPKEY_PASSWD.
Referenced by usart_reset().
void usart_drive_DTR_pin_high | ( | Usart * | p_usart | ) |
Referenced by usart_reset().
void usart_drive_DTR_pin_low | ( | Usart * | p_usart | ) |
void usart_drive_RTS_pin_high | ( | Usart * | p_usart | ) |
void usart_drive_RTS_pin_low | ( | Usart * | p_usart | ) |
Drive the pin RTS to 0.
p_usart | Pointer to a USART instance. |
void usart_enable_interrupt | ( | Usart * | p_usart, |
uint32_t | ul_sources | ||
) |
Enable USART interrupts.
p_usart | Pointer to a USART peripheral. |
ul_sources | Interrupt sources bit map. |
void usart_enable_rx | ( | Usart * | p_usart | ) |
Enable USART receiver.
p_usart | Pointer to a USART instance. |
Referenced by usart_serial_init().
void usart_enable_tx | ( | Usart * | p_usart | ) |
Enable USART transmitter.
p_usart | Pointer to a USART instance. |
Referenced by usart_serial_init().
void usart_enable_writeprotect | ( | Usart * | p_usart | ) |
Enable write protect of USART registers.
p_usart | Pointer to a USART instance. |
References US_WPMR_WPKEY_PASSWD.
uint8_t usart_get_error_number | ( | Usart * | p_usart | ) |
uint32_t usart_get_interrupt_mask | ( | Usart * | p_usart | ) |
Read USART interrupt mask.
p_usart | Pointer to a USART peripheral. |
Pdc* usart_get_pdc_base | ( | Usart * | p_usart | ) |
uint32_t* usart_get_rx_access | ( | Usart * | p_usart | ) |
uint32_t usart_get_status | ( | Usart * | p_usart | ) |
Get current status.
p_usart | Pointer to a USART instance. |
uint32_t* usart_get_tx_access | ( | Usart * | p_usart | ) |
uint32_t usart_get_version | ( | Usart * | p_usart | ) |
uint32_t usart_get_writeprotect_status | ( | Usart * | p_usart | ) |
Get write protect status.
p_usart | Pointer to a USART instance. |
uint32_t usart_getchar | ( | Usart * | p_usart, |
uint32_t * | c | ||
) |
Read from USART Receive Holding Register.
Before reading user should check if rx is ready.
p_usart | Pointer to a USART instance. |
c | Pointer where the one-byte received data will be stored. |
0 | Data has been received. |
1 | on failure. |
uint32_t usart_init_hw_handshaking | ( | Usart * | p_usart, |
const sam_usart_opt_t * | p_usart_opt, | ||
uint32_t | ul_mck | ||
) |
Configure USART to work in hardware handshaking mode.
p_usart | Pointer to a USART instance. |
p_usart_opt | Pointer to sam_usart_opt_t instance. |
ul_mck | USART module input clock frequency. |
0 | on success. |
1 | on failure. |
References usart_init_rs232().
uint32_t usart_init_irda | ( | Usart * | p_usart, |
const sam_usart_opt_t * | p_usart_opt, | ||
uint32_t | ul_mck | ||
) |
uint32_t usart_init_iso7816 | ( | Usart * | p_usart, |
const usart_iso7816_opt_t * | p_usart_opt, | ||
uint32_t | ul_mck | ||
) |
uint32_t usart_init_lin_master | ( | Usart * | p_usart, |
uint32_t | ul_baudrate, | ||
uint32_t | ul_mck | ||
) |
uint32_t usart_init_lin_slave | ( | Usart * | p_usart, |
uint32_t | ul_baudrate, | ||
uint32_t | ul_mck | ||
) |
uint32_t usart_init_lon | ( | Usart * | p_usart, |
uint32_t | ul_baudrate, | ||
uint32_t | ul_mck | ||
) |
uint32_t usart_init_modem | ( | Usart * | p_usart, |
const sam_usart_opt_t * | p_usart_opt, | ||
uint32_t | ul_mck | ||
) |
uint32_t usart_init_rs232 | ( | Usart * | p_usart, |
const sam_usart_opt_t * | p_usart_opt, | ||
uint32_t | ul_mck | ||
) |
Configure USART to work in RS232 mode.
p_usart | Pointer to a USART instance. |
p_usart_opt | Pointer to sam_usart_opt_t instance. |
ul_mck | USART module input clock frequency. |
0 | on success. |
1 | on failure. |
References sam_usart_opt_t::baudrate, sam_usart_opt_t::channel_mode, sam_usart_opt_t::char_length, sam_usart_opt_t::parity_type, sam_usart_opt_t::stop_bits, usart_reset(), and usart_set_async_baudrate().
Referenced by usart_init_hw_handshaking(), usart_init_rs485(), and usart_serial_init().
uint32_t usart_init_rs485 | ( | Usart * | p_usart, |
const sam_usart_opt_t * | p_usart_opt, | ||
uint32_t | ul_mck | ||
) |
Configure USART to work in RS485 mode.
p_usart | Pointer to a USART instance. |
p_usart_opt | Pointer to sam_usart_opt_t instance. |
ul_mck | USART module input clock frequency. |
0 | on success. |
1 | on failure. |
References usart_init_rs232().
uint32_t usart_init_spi_master | ( | Usart * | p_usart, |
const usart_spi_opt_t * | p_usart_opt, | ||
uint32_t | ul_mck | ||
) |
Configure USART to work in SPI mode and act as a master.
p_usart | Pointer to a USART instance. |
p_usart_opt | Pointer to sam_usart_opt_t instance. |
ul_mck | USART module input clock frequency. |
0 | on success. |
1 | on failure. |
References usart_spi_opt_t::baudrate, usart_spi_opt_t::channel_mode, usart_spi_opt_t::char_length, usart_spi_opt_t::spi_mode, SPI_MODE_0, SPI_MODE_1, SPI_MODE_2, SPI_MODE_3, usart_reset(), and usart_set_spi_master_baudrate().
uint32_t usart_init_spi_slave | ( | Usart * | p_usart, |
const usart_spi_opt_t * | p_usart_opt | ||
) |
Configure USART to work in SPI mode and act as a slave.
p_usart | Pointer to a USART instance. |
p_usart_opt | Pointer to sam_usart_opt_t instance. |
0 | on success. |
1 | on failure. |
References usart_spi_opt_t::channel_mode, usart_spi_opt_t::char_length, usart_spi_opt_t::spi_mode, SPI_MODE_0, SPI_MODE_1, SPI_MODE_2, SPI_MODE_3, usart_reset(), and usart_set_spi_slave_baudrate().
uint32_t usart_init_sync_master | ( | Usart * | p_usart, |
const sam_usart_opt_t * | p_usart_opt, | ||
uint32_t | ul_mck | ||
) |
Configure USART to work in SYNC mode and act as a master.
p_usart | Pointer to a USART instance. |
p_usart_opt | Pointer to sam_usart_opt_t instance. |
ul_mck | USART module input clock frequency. |
0 | on success. |
1 | on failure. |
References sam_usart_opt_t::baudrate, sam_usart_opt_t::channel_mode, sam_usart_opt_t::char_length, sam_usart_opt_t::parity_type, sam_usart_opt_t::stop_bits, usart_reset(), and usart_set_sync_master_baudrate().
uint32_t usart_init_sync_slave | ( | Usart * | p_usart, |
const sam_usart_opt_t * | p_usart_opt | ||
) |
Configure USART to work in SYNC mode and act as a slave.
p_usart | Pointer to a USART instance. |
p_usart_opt | Pointer to sam_usart_opt_t instance. |
0 | on success. |
1 | on failure. |
References sam_usart_opt_t::channel_mode, sam_usart_opt_t::char_length, sam_usart_opt_t::parity_type, sam_usart_opt_t::stop_bits, usart_reset(), and usart_set_sync_slave_baudrate().
uint32_t usart_is_rx_buf_end | ( | Usart * | p_usart | ) |
uint32_t usart_is_rx_buf_full | ( | Usart * | p_usart | ) |
uint32_t usart_is_rx_ready | ( | Usart * | p_usart | ) |
Check if the received data are ready.
Check if Data have been received and loaded into USART_RHR.
p_usart | Pointer to a USART instance. |
1 | Some data has been received. |
0 | No data has been received. |
Referenced by usart_serial_is_rx_ready().
uint32_t usart_is_tx_buf_empty | ( | Usart * | p_usart | ) |
uint32_t usart_is_tx_buf_end | ( | Usart * | p_usart | ) |
uint32_t usart_is_tx_empty | ( | Usart * | p_usart | ) |
Check if Transmit Holding Register is empty.
Check if the last data written in USART_THR have been loaded in TSR and the last data loaded in TSR have been transmitted.
p_usart | Pointer to a USART instance. |
1 | Transmitter is empty. |
0 | Transmitter is not empty. |
Referenced by init_chip(), test_wait_mode(), and user_change_clock().
uint32_t usart_is_tx_ready | ( | Usart * | p_usart | ) |
Check if Transmit is Ready.
Check if data have been loaded in USART_THR and are waiting to be loaded into the Transmit Shift Register (TSR).
p_usart | Pointer to a USART instance. |
1 | No data is in the Transmit Holding Register. |
0 | There is data in the Transmit Holding Register. |
void usart_lin_abort_tx | ( | Usart * | p_usart | ) |
void usart_lin_disable_checksum | ( | Usart * | p_usart | ) |
void usart_lin_disable_frame_slot | ( | Usart * | p_usart | ) |
void usart_lin_disable_parity | ( | Usart * | p_usart | ) |
void usart_lin_disable_pdc_mode | ( | Usart * | p_usart | ) |
void usart_lin_enable_checksum | ( | Usart * | p_usart | ) |
void usart_lin_enable_frame_slot | ( | Usart * | p_usart | ) |
void usart_lin_enable_parity | ( | Usart * | p_usart | ) |
void usart_lin_enable_pdc_mode | ( | Usart * | p_usart | ) |
uint8_t usart_lin_get_data_length | ( | Usart * | usart | ) |
uint8_t usart_lin_identifier_reception_complete | ( | Usart * | usart | ) |
uint8_t usart_lin_identifier_send_complete | ( | Usart * | usart | ) |
uint8_t usart_lin_read_identifier | ( | Usart * | p_usart | ) |
void usart_lin_send_wakeup_signal | ( | Usart * | p_usart | ) |
void usart_lin_set_checksum_type | ( | Usart * | p_usart, |
uint8_t | uc_type | ||
) |
void usart_lin_set_data_len_mode | ( | Usart * | p_usart, |
uint8_t | uc_mode | ||
) |
void usart_lin_set_node_action | ( | Usart * | p_usart, |
uint8_t | uc_action | ||
) |
void usart_lin_set_response_data_len | ( | Usart * | p_usart, |
uint8_t | uc_len | ||
) |
void usart_lin_set_tx_identifier | ( | Usart * | p_usart, |
uint8_t | uc_id | ||
) |
void usart_lin_set_wakeup_signal_type | ( | Usart * | p_usart, |
uint8_t | uc_type | ||
) |
uint8_t usart_lin_tx_complete | ( | Usart * | usart | ) |
void usart_lon_disable_coll_detection | ( | Usart * | p_usart | ) |
void usart_lon_enable_coll_detection | ( | Usart * | p_usart | ) |
uint32_t usart_lon_is_rx_end | ( | Usart * | p_usart | ) |
uint32_t usart_lon_is_tx_end | ( | Usart * | p_usart | ) |
void usart_lon_set_beta1_rx_len | ( | Usart * | p_usart, |
uint32_t | ul_len | ||
) |
void usart_lon_set_beta1_tx_len | ( | Usart * | p_usart, |
uint32_t | ul_len | ||
) |
void usart_lon_set_cdtail | ( | Usart * | p_usart, |
uint8_t | uc_type | ||
) |
void usart_lon_set_comm_type | ( | Usart * | p_usart, |
uint8_t | uc_type | ||
) |
void usart_lon_set_data_len | ( | Usart * | p_usart, |
uint8_t | uc_len | ||
) |
void usart_lon_set_dmam | ( | Usart * | p_usart, |
uint8_t | uc_type | ||
) |
void usart_lon_set_l2hdr | ( | Usart * | p_usart, |
uint8_t | uc_bli, | ||
uint8_t | uc_altp, | ||
uint8_t | uc_pb | ||
) |
void usart_lon_set_pre_len | ( | Usart * | p_usart, |
uint32_t | ul_len | ||
) |
void usart_lon_set_priority | ( | Usart * | p_usart, |
uint8_t | uc_psnb, | ||
uint8_t | uc_nps | ||
) |
void usart_lon_set_rx_idt | ( | Usart * | p_usart, |
uint32_t | ul_time | ||
) |
void usart_lon_set_tcol | ( | Usart * | p_usart, |
uint8_t | uc_type | ||
) |
void usart_lon_set_tx_idt | ( | Usart * | p_usart, |
uint32_t | ul_time | ||
) |
void usart_man_disable_drift_compensation | ( | Usart * | p_usart | ) |
void usart_man_enable_drift_compensation | ( | Usart * | p_usart | ) |
void usart_man_set_rx_polarity | ( | Usart * | p_usart, |
uint8_t | uc_polarity | ||
) |
void usart_man_set_rx_pre_len | ( | Usart * | p_usart, |
uint8_t | uc_len | ||
) |
void usart_man_set_rx_pre_pattern | ( | Usart * | p_usart, |
uint8_t | uc_pattern | ||
) |
void usart_man_set_tx_polarity | ( | Usart * | p_usart, |
uint8_t | uc_polarity | ||
) |
void usart_man_set_tx_pre_len | ( | Usart * | p_usart, |
uint8_t | uc_len | ||
) |
void usart_man_set_tx_pre_pattern | ( | Usart * | p_usart, |
uint8_t | uc_pattern | ||
) |
uint32_t usart_putchar | ( | Usart * | p_usart, |
uint32_t | c | ||
) |
Write to USART Transmit Holding Register.
p_usart | Pointer to a USART instance. |
c | Data to be sent. |
0 | on success. |
1 | on failure. |
Referenced by usart_write_line().
uint32_t usart_read | ( | Usart * | p_usart, |
uint32_t * | c | ||
) |
Read from USART Receive Holding Register.
p_usart | Pointer to a USART instance. |
c | Pointer where the one-byte received data will be stored. |
0 | on success. |
1 | if no data is available or errors. |
Referenced by usart_serial_getchar().
void usart_reset | ( | Usart * | p_usart | ) |
Reset the USART and disable TX and RX.
p_usart | Pointer to a USART instance. |
References usart_disable_writeprotect(), usart_drive_DTR_pin_high(), usart_drive_RTS_pin_high(), usart_reset_rx(), usart_reset_status(), and usart_reset_tx().
Referenced by usart_init_rs232(), usart_init_spi_master(), usart_init_spi_slave(), usart_init_sync_master(), and usart_init_sync_slave().
void usart_reset_iterations | ( | Usart * | p_usart | ) |
void usart_reset_nack | ( | Usart * | p_usart | ) |
void usart_reset_rx | ( | Usart * | p_usart | ) |
Immediately stop and disable USART receiver.
p_usart | Pointer to a USART instance. |
Referenced by usart_reset().
void usart_reset_status | ( | Usart * | p_usart | ) |
Reset status bits (PARE, OVER, MANERR, UNRE and PXBRK in US_CSR).
p_usart | Pointer to a USART instance. |
Referenced by usart_reset().
void usart_reset_tx | ( | Usart * | p_usart | ) |
Immediately stop and disable USART transmitter.
p_usart | Pointer to a USART instance. |
Referenced by usart_reset().
void usart_restart_rx_timeout | ( | Usart * | p_usart | ) |
Restart the receive timeout.
p_usart | Pointer to a USART instance. |
uint32_t usart_send_address | ( | Usart * | p_usart, |
uint32_t | ul_addr | ||
) |
In Multidrop mode only, the next character written to the US_THR is sent with the address bit set.
p_usart | Pointer to a USART instance. |
ul_addr | The address to be sent out. |
0 | on success. |
1 | on failure. |
References usart_write().
uint32_t usart_set_async_baudrate | ( | Usart * | p_usart, |
uint32_t | baudrate, | ||
uint32_t | ul_mck | ||
) |
Calculate a clock divider(CD) and a fractional part (FP) for the USART asynchronous modes to generate a baudrate as close as possible to the baudrate set point.
p_usart | Pointer to a USART instance. |
baudrate | Baud rate set point. |
ul_mck | USART module input clock frequency. |
0 | Baud rate is successfully initialized. |
1 | Baud rate set point is out of range for the given input clock frequency. |
References HIGH_FRQ_SAMPLE_DIV, LOW_FRQ_SAMPLE_DIV, and MAX_CD_VALUE.
Referenced by usart_init_rs232().
void usart_set_rx_timeout | ( | Usart * | p_usart, |
uint32_t | timeout | ||
) |
Configure the receive timeout register.
p_usart | Pointer to a USART instance. |
timeout | The value of receive timeout. |
void usart_set_sleepwalking | ( | Usart * | p_uart, |
uint8_t | ul_low_value, | ||
bool | cmpmode, | ||
bool | cmppar, | ||
uint8_t | ul_high_value | ||
) |
void usart_set_tx_timeguard | ( | Usart * | p_usart, |
uint32_t | timeguard | ||
) |
Configure the transmit timeguard register.
p_usart | Pointer to a USART instance. |
timeguard | The value of transmit timeguard. |
void usart_spi_force_chip_select | ( | Usart * | p_usart | ) |
Drive the slave select line NSS (RTS pin) to 0 in SPI master mode.
p_usart | Pointer to a USART instance. |
void usart_spi_release_chip_select | ( | Usart * | p_usart | ) |
Drive the slave select line NSS (RTS pin) to 1 in SPI master mode.
p_usart | Pointer to a USART instance. |
void usart_start_rx_timeout | ( | Usart * | p_usart | ) |
Start waiting for a character before clocking the timeout count.
Reset the status bit TIMEOUT in US_CSR.
p_usart | Pointer to a USART instance. |
void usart_start_tx_break | ( | Usart * | p_usart | ) |
Start transmission of a break.
p_usart | Pointer to a USART instance. |
void usart_stop_tx_break | ( | Usart * | p_usart | ) |
Stop transmission of a break.
p_usart | Pointer to a USART instance. |
uint32_t usart_write | ( | Usart * | p_usart, |
uint32_t | c | ||
) |
Write to USART Transmit Holding Register.
p_usart | Pointer to a USART instance. |
c | Data to be sent. |
0 | on success. |
1 | on failure. |
Referenced by usart_send_address(), and usart_serial_putchar().
void usart_write_line | ( | Usart * | p_usart, |
const char * | string | ||
) |
Write one-line string through USART.
p_usart | Pointer to a USART instance. |
string | Pointer to one-line string to be sent. |
References usart_putchar().