18#ifndef __VSF_TEMPLATE_USART_H__
19#define __VSF_TEMPLATE_USART_H__
38#ifndef VSF_USART_CFG_MULTI_CLASS
39# define VSF_USART_CFG_MULTI_CLASS ENABLED
50#if defined(VSF_HW_USART_COUNT) && !defined(VSF_HW_USART_MASK)
51# define VSF_HW_USART_MASK VSF_HAL_COUNT_TO_MASK(VSF_HW_USART_COUNT)
62#if defined(VSF_HW_USART_MASK) && !defined(VSF_HW_USART_COUNT)
63# define VSF_HW_USART_COUNT VSF_HAL_MASK_TO_COUNT(VSF_HW_USART_MASK)
83#ifndef VSF_USART_CFG_PREFIX
84# if VSF_USART_CFG_MULTI_CLASS == ENABLED
85# define VSF_USART_CFG_PREFIX vsf
86# elif defined(VSF_HW_USART_COUNT) && (VSF_HW_USART_COUNT != 0)
87# define VSF_USART_CFG_PREFIX vsf_hw
89# define VSF_USART_CFG_PREFIX vsf
101#ifndef VSF_USART_CFG_FUNCTION_RENAME
102# define VSF_USART_CFG_FUNCTION_RENAME ENABLED
113#ifndef VSF_USART_CFG_REIMPLEMENT_TYPE_MODE
114# define VSF_USART_CFG_REIMPLEMENT_TYPE_MODE DISABLED
125#ifndef VSF_USART_CFG_REIMPLEMENT_TYPE_IRQ_MASK
126# define VSF_USART_CFG_REIMPLEMENT_TYPE_IRQ_MASK DISABLED
137#ifndef VSF_USART_CFG_REIMPLEMENT_TYPE_STATUS
138# define VSF_USART_CFG_REIMPLEMENT_TYPE_STATUS DISABLED
149#ifndef VSF_USART_CFG_REIMPLEMENT_TYPE_CTRL
150# define VSF_USART_CFG_REIMPLEMENT_TYPE_CTRL DISABLED
162#ifndef VSF_USART_CFG_REIMPLEMENT_MODE_TO_DATA_BITS
163# define VSF_USART_CFG_REIMPLEMENT_MODE_TO_DATA_BITS \
176#ifndef VSF_USART_CFG_REIMPLEMENT_TYPE_CFG
177# define VSF_USART_CFG_REIMPLEMENT_TYPE_CFG DISABLED
190#ifndef VSF_USART_CFG_REIMPLEMENT_TYPE_CAPABILITY
191# define VSF_USART_CFG_REIMPLEMENT_TYPE_CAPABILITY DISABLED
202#ifndef VSF_USART_CFG_REIMPLEMENT_TYPE_STATUS
203# define VSF_USART_CFG_REIMPLEMENT_TYPE_STATUS DISABLED
214#ifndef VSF_USART_CFG_INHERIT_HAL_CAPABILITY
215# define VSF_USART_CFG_INHERIT_HAL_CAPABILITY ENABLED
228#define VSF_USART_APIS(__prefix_name) \
229 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, usart, init, VSF_MCONNECT(__prefix_name, _t) *usart_ptr, vsf_usart_cfg_t *cfg_ptr) \
230 __VSF_HAL_TEMPLATE_API(__prefix_name, void, usart, fini, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
231 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, usart, get_configuration, VSF_MCONNECT(__prefix_name, _t) *usart_ptr, vsf_usart_cfg_t *cfg_ptr) \
232 __VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, usart, enable, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
233 __VSF_HAL_TEMPLATE_API(__prefix_name, fsm_rt_t, usart, disable, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
234 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_usart_capability_t, usart, capability, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
235 __VSF_HAL_TEMPLATE_API(__prefix_name, void, usart, irq_enable, VSF_MCONNECT(__prefix_name, _t) *usart_ptr, vsf_usart_irq_mask_t irq_mask) \
236 __VSF_HAL_TEMPLATE_API(__prefix_name, void, usart, irq_disable, VSF_MCONNECT(__prefix_name, _t) *usart_ptr, vsf_usart_irq_mask_t irq_mask) \
237 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_usart_status_t, usart, status, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
238 __VSF_HAL_TEMPLATE_API(__prefix_name, uint_fast32_t, usart, rxfifo_get_data_count, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
239 __VSF_HAL_TEMPLATE_API(__prefix_name, uint_fast32_t, usart, rxfifo_read, VSF_MCONNECT(__prefix_name, _t) *usart_ptr, void *buffer_ptr, uint_fast32_t count) \
240 __VSF_HAL_TEMPLATE_API(__prefix_name, uint_fast32_t, usart, txfifo_get_free_count, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
241 __VSF_HAL_TEMPLATE_API(__prefix_name, uint_fast32_t, usart, txfifo_write, VSF_MCONNECT(__prefix_name, _t) *usart_ptr, void *buffer_ptr, uint_fast32_t count) \
242 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, usart, request_rx, VSF_MCONNECT(__prefix_name, _t) *usart_ptr, void *buffer_ptr, uint_fast32_t count) \
243 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, usart, request_tx, VSF_MCONNECT(__prefix_name, _t) *usart_ptr, void *buffer_ptr, uint_fast32_t count) \
244 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, usart, cancel_rx, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
245 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, usart, cancel_tx, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
246 __VSF_HAL_TEMPLATE_API(__prefix_name, int_fast32_t, usart, get_rx_count, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
247 __VSF_HAL_TEMPLATE_API(__prefix_name, int_fast32_t, usart, get_tx_count, VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
248 __VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, usart, ctrl, VSF_MCONNECT(__prefix_name, _t) *usart_ptr, vsf_usart_ctrl_t ctrl, void* param)
250#define VSF_USART_ADDITIONAL_APIS(__prefix_name) \
251 static inline vsf_err_t VSF_MCONNECT(__prefix_name, _send_break) \
252 (VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
254 return VSF_MCONNECT(__prefix_name, _ctrl)(usart_ptr, \
255 VSF_USART_CTRL_SEND_BREAK, NULL); \
257 static inline vsf_err_t VSF_MCONNECT(__prefix_name, _set_break) \
258 (VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
260 vsf_usart_capability_t cap = \
261 VSF_MCONNECT(__prefix_name, _capability)(usart_ptr); \
262 VSF_HAL_ASSERT(cap.support_set_and_clear_break); \
263 return VSF_MCONNECT(__prefix_name, _ctrl)(usart_ptr, \
264 VSF_USART_CTRL_SET_BREAK, NULL); \
266 static inline vsf_err_t VSF_MCONNECT(__prefix_name, _clear_break) \
267 (VSF_MCONNECT(__prefix_name, _t) *usart_ptr) \
269 vsf_usart_capability_t cap = \
270 VSF_MCONNECT(__prefix_name, _capability)(usart_ptr); \
271 VSF_HAL_ASSERT(cap.support_set_and_clear_break); \
272 return VSF_MCONNECT(__prefix_name, _ctrl)(usart_ptr, \
273 VSF_USART_CTRL_CLEAR_BREAK, NULL); \
278#if VSF_USART_CFG_REIMPLEMENT_TYPE_MODE == DISABLED
406#ifndef VSF_USART_PARITY_MASK
414#ifndef VSF_USART_STOPBIT_MASK
421#ifndef VSF_USART_BIT_LENGTH_MASK
430#ifndef VSF_USART_TX_FIFO_THRESHOLD_MASK
436#ifndef VSF_USART_RX_FIFO_THRESHOLD_MASK
442#ifndef VSF_USART_HWCONTROL_MASK
471#ifdef VSF_USART_SYNC_CLOCK_LAST_BIT_MASK
475#ifdef VSF_USART_IRDA_PRESCALER_MASK
476 | VSF_USART_IRDA_PRESCALER_MASK
478#ifdef VSF_USART_IRDA_MASK
479 | VSF_USART_IRDA_MASK
482#ifdef VSF_USART_SMARTCARD_MASK
483 | VSF_USART_SMARTCARD_MASK
487#if VSF_USART_CFG_REIMPLEMENT_TYPE_IRQ_MASK == DISABLED
529# define VSF_USART_IRQ_MASK_TX_IDLE VSF_USART_IRQ_MASK_TX_IDLE
553# define VSF_USART_IRQ_MASK_NOISE_ERR VSF_USART_IRQ_MASK_NOISE_ERR
564#ifndef VSF_USART_IRQ_MASK_RX_IDLE
570#ifndef VSF_USART_IRQ_MASK_ERR
574# ifdef VSF_USART_IRQ_MASK_TX_OVERFLOW_ERR
580#ifndef VSF_USART_IRQ_ALL_BITS_MASK
584#ifdef VSF_USART_IRQ_MASK_RX_IDLE
587#ifdef VSF_USART_IRQ_MASK_TX_IDLE
594# ifdef VSF_USART_IRQ_MASK_TX_HALF_CPL
595 | VSF_USART_IRQ_MASK_TX_HALF_CPL
597# ifdef VSF_USART_IRQ_MASK_RX_HALF_CPL
598 | VSF_USART_IRQ_MASK_RX_HALF_CPL
600# ifdef VSF_USART_IRQ_MASK_CANCEL_TX_CPL
601 | VSF_USART_IRQ_MASK_CANCEL_TX_CPL
603# ifdef VSF_USART_IRQ_MASK_CANCEL_RX_CPL
604 | VSF_USART_IRQ_MASK_CANCEL_RX_CPL
609#if VSF_USART_CFG_REIMPLEMENT_TYPE_CFG == DISABLED
691# ifdef VSF_USART_IRQ_MASK_RX_IDLE
698#if VSF_USART_CFG_REIMPLEMENT_TYPE_CTRL == DISABLED
728# define VSF_USART_CTRL_SET_BREAK VSF_USART_CTRL_SET_BREAK
772#if VSF_USART_CFG_REIMPLEMENT_TYPE_STATUS == DISABLED
796#if VSF_USART_CFG_REIMPLEMENT_TYPE_CAPABILITY == DISABLED
798#if VSF_USART_CFG_INHERIT_HAL_CAPABILITY == ENABLED
816# ifdef VSF_USART_IRQ_MASK_TX_IDLE
819# ifdef VSF_USART_IRQ_MASK_RX_IDLE
834#undef __VSF_HAL_TEMPLATE_API
835#define __VSF_HAL_TEMPLATE_API VSF_HAL_TEMPLATE_API_FP
841#if VSF_USART_CFG_MULTI_CLASS == ENABLED
1171#if VSF_USART_CFG_REIMPLEMENT_MODE_TO_DATA_BITS == DISABLED
1264#if VSF_USART_CFG_FUNCTION_RENAME == ENABLED
1265# define __vsf_usart_t VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_t)
1266# define vsf_usart_init(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_init) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
1267# define vsf_usart_fini(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_fini) ((__vsf_usart_t *)(__USART))
1268# define vsf_usart_get_configuration(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_get_configuration) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
1269# define vsf_usart_capability(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_capability) ((__vsf_usart_t *)(__USART))
1270# define vsf_usart_enable(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_enable) ((__vsf_usart_t *)(__USART))
1271# define vsf_usart_disable(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_disable) ((__vsf_usart_t *)(__USART))
1272# define vsf_usart_irq_enable(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_irq_enable) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
1273# define vsf_usart_irq_disable(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_irq_disable) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
1274# define vsf_usart_status(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_status) ((__vsf_usart_t *)(__USART))
1275# define vsf_usart_rxfifo_get_data_count(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_rxfifo_get_data_count) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
1276# define vsf_usart_rxfifo_read(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_rxfifo_read) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
1277# define vsf_usart_txfifo_get_free_count(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_txfifo_get_free_count) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
1278# define vsf_usart_txfifo_write(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_txfifo_write) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
1279# define vsf_usart_request_rx(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_request_rx) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
1280# define vsf_usart_request_tx(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_request_tx) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
1281# define vsf_usart_cancel_rx(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_cancel_rx) ((__vsf_usart_t *)(__USART))
1282# define vsf_usart_cancel_tx(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_cancel_tx) ((__vsf_usart_t *)(__USART))
1283# define vsf_usart_get_rx_count(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_get_rx_count) ((__vsf_usart_t *)(__USART))
1284# define vsf_usart_get_tx_count(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_get_tx_count) ((__vsf_usart_t *)(__USART))
1285# define vsf_usart_send_break(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_send_break) ((__vsf_usart_t *)(__USART))
1286# define vsf_usart_set_break(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_set_break) ((__vsf_usart_t *)(__USART))
1287# define vsf_usart_clear_break(__USART) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_clear_break) ((__vsf_usart_t *)(__USART))
1288# define vsf_usart_ctrl(__USART, ...) VSF_MCONNECT(VSF_USART_CFG_PREFIX, _usart_ctrl) ((__vsf_usart_t *)(__USART), ##__VA_ARGS__)
vsf_err_t
Definition __type.h:42
vsf_usart_mode_t
Definition uart.h:32
vsf_usart_irq_mask_t
Definition uart.h:106
#define VSF_USART_SYNC_CLOCK_LAST_BIT_MASK
Definition usart.h:129
vsf_arch_prio_t
Definition cortex_a_generic.h:88
#define NULL
Definition lvgl.h:26
const i_spi_t vsf_spi_irq_mask_t irq_mask
Definition spi_interface.h:38
unsigned uint32_t
Definition stdint.h:9
unsigned int uint_fast32_t
Definition stdint.h:27
int int_fast32_t
Definition stdint.h:26
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_template_hal_driver.h:203
Definition vsf_template_hal_driver.h:196
USART capability structure Defines the hardware capabilities and limitations of the USART interface.
Definition vsf_template_usart.h:797
uint8_t support_tx_idle
Support TX idle interrupt.
Definition vsf_template_usart.h:817
uint8_t max_data_bits
Maximum data bits per frame.
Definition vsf_template_usart.h:809
uint8_t support_set_and_clear_break
Support set and clear break.
Definition vsf_template_usart.h:814
inherit(vsf_peripheral_capability_t) vsf_usart_irq_mask_t irq_mask
Supported interrupt mask bits.
vsf_usart_irq_mask_t irq_mask
Definition usart.h:387
uint8_t support_rx_timeout
Support receive timeout.
Definition vsf_template_usart.h:812
uint8_t rxfifo_depth
RX FIFO depth in data frames (0 means no FIFO)
Definition vsf_template_usart.h:807
uint8_t support_rx_idle
Support RX idle interrupt.
Definition vsf_template_usart.h:820
uint8_t support_send_break
Support send break.
Definition vsf_template_usart.h:813
uint8_t txfifo_depth
TX FIFO depth in data frames (0 means no FIFO)
Definition vsf_template_usart.h:806
uint8_t min_data_bits
Minimum data bits per frame.
Definition vsf_template_usart.h:810
uint32_t min_baudrate
Minimum supported baudrate (bps) according to current clock configurations.
Definition vsf_template_usart.h:804
uint32_t max_baudrate
Maximum supported baudrate (bps) according to current clock configurations.
Definition vsf_template_usart.h:803
uint8_t support_sync_clock
Support Synchronous clock.
Definition vsf_template_usart.h:815
USART configuration structure Contains all parameters needed to initialize and configure a USART inst...
Definition vsf_template_usart.h:687
uint32_t mode
USART working mode.
Definition vsf_template_usart.h:688
uint32_t baudrate
Baudrate in Hz.
Definition vsf_template_usart.h:689
uint32_t rx_timeout
RX timeout in microseconds.
Definition vsf_template_usart.h:690
uint32_t rx_idle_cnt
Definition vsf_template_usart.h:692
vsf_usart_isr_t isr
Interrupt configuration.
Definition vsf_template_usart.h:694
USART interrupt configuration structure Contains all necessary information for configuring USART inte...
Definition vsf_template_usart.h:673
vsf_usart_isr_handler_t * handler_fn
Interrupt handler function pointer.
Definition vsf_template_usart.h:674
vsf_arch_prio_t prio
Interrupt priority.
Definition vsf_template_usart.h:676
void * target_ptr
User target pointer.
Definition vsf_template_usart.h:675
USART operation interface structure Contains function pointers for all USART operations.
Definition vsf_template_usart.h:832
USART status information structure Contains the current status of USART operations and FIFO threshold...
Definition uart.h:157
uint32_t is_busy
USART is busy with any operation.
Definition vsf_template_usart.h:778
uint32_t is_tx_busy
TX is busy transmitting data.
Definition vsf_template_usart.h:779
uint32_t value
Definition usart.h:284
uint32_t tx_fifo_thresh
TX FIFO threshold level (0-255)
Definition vsf_template_usart.h:781
uint32_t rx_fifo_thresh
RX FIFO threshold level (0-255)
Definition vsf_template_usart.h:782
uint32_t is_rx_busy
RX is busy receiving data.
Definition vsf_template_usart.h:780
USART instance structure Used for USART Multi Class support.
Definition vsf_template_usart.h:850
const vsf_usart_op_t * op
Operation functions.
Definition vsf_template_usart.h:851
vsf_usart_irq_mask_t
Definition usart.h:174
void vsf_usart_isr_handler_t(void *target_ptr, vsf_usart_t *usart_ptr, vsf_usart_irq_mask_t irq_mask)
Definition usart.h:255
fsm_rt_t
Definition vsf_fsm.h:315
#define VSF_HAL_ASSERT(__CON)
all hal modules use this configuration file
Definition vsf_hal_cfg.h:36
@ VSF_USART_IRQ_MASK_ERR
Combined error interrupt mask.
Definition vsf_template_usart.h:571
@ VSF_USART_IRQ_MASK_TX_FIFO_THRESHOLD
TX FIFO threshold interrupt mask.
Definition vsf_template_usart.h:567
@ VSF_USART_IRQ_ALL_BITS_MASK
All supported interrupt mask bits.
Definition vsf_template_usart.h:581
@ VSF_USART_IRQ_MASK_RX_FIFO_THRESHOLD
RX FIFO threshold interrupt mask.
Definition vsf_template_usart.h:568
fsm_rt_t vsf_usart_disable(vsf_usart_t *usart_ptr)
Disable a USART instance.
Definition usart_common.c:75
vsf_usart_status_t vsf_usart_status(vsf_usart_t *usart_ptr)
Get the status of USART instance.
Definition usart_common.c:102
struct vsf_usart_cfg_t vsf_usart_cfg_t
USART configuration structure Contains all parameters needed to initialize and configure a USART inst...
vsf_err_t vsf_usart_request_rx(vsf_usart_t *usart_ptr, void *buffer_ptr, uint_fast32_t count)
Request a DMA receive operation through the USART.
Definition usart_common.c:156
struct vsf_usart_capability_t vsf_usart_capability_t
USART capability structure Defines the hardware capabilities and limitations of the USART interface.
vsf_err_t vsf_usart_cancel_rx(vsf_usart_t *usart_ptr)
Cancel an ongoing USART receive operation.
Definition usart_common.c:174
vsf_usart_mode_t
Predefined VSF USART modes that can be reimplemented in specific HAL drivers. Even if the hardware do...
Definition vsf_template_usart.h:302
@ VSF_USART_TX_FIFO_THRESHOLD_EMPTY
USART TX FIFO threshold configuration options Note: Some devices may support additional threshold lev...
Definition vsf_template_usart.h:387
@ VSF_USART_HALF_DUPLEX_DISABLE
USART Half-duplex configuration options.
Definition vsf_template_usart.h:376
@ VSF_USART_8_BIT_LENGTH
8-bit data length
Definition vsf_template_usart.h:335
@ VSF_USART_SYNC_CLOCK_ENABLE
USART Synchronous clock configuration options.
Definition vsf_template_usart.h:367
@ VSF_USART_EVEN_PARITY
Even parity.
Definition vsf_template_usart.h:310
@ VSF_USART_RX_FIFO_THRESHOLD_NOT_EMPTY
USART RX FIFO threshold configuration options Note: Some devices may support additional threshold lev...
Definition vsf_template_usart.h:399
@ VSF_USART_ODD_PARITY
Odd parity.
Definition vsf_template_usart.h:311
@ VSF_USART_NO_PARITY
USART Parity configuration options.
Definition vsf_template_usart.h:309
@ VSF_USART_10_BIT_LENGTH
10-bit data length
Definition vsf_template_usart.h:337
@ VSF_USART_RTS_HWCONTROL
RTS hardware flow control.
Definition vsf_template_usart.h:346
@ VSF_USART_RX_FIFO_THRESHOLD_HALF_FULL
RX FIFO half full.
Definition vsf_template_usart.h:400
@ VSF_USART_RX_ENABLE
RX enabled.
Definition vsf_template_usart.h:358
@ VSF_USART_FORCE_0_PARITY
Force 0 parity.
Definition vsf_template_usart.h:312
@ VSF_USART_TX_FIFO_THRESHOLD_NOT_FULL
TX FIFO not full.
Definition vsf_template_usart.h:389
@ VSF_USART_TX_ENABLE
USART TX/RX enable/disable options.
Definition vsf_template_usart.h:356
@ VSF_USART_9_BIT_LENGTH
9-bit data length
Definition vsf_template_usart.h:336
@ VSF_USART_7_BIT_LENGTH
7-bit data length
Definition vsf_template_usart.h:334
@ VSF_USART_1_STOPBIT
USART Stop bit configuration options.
Definition vsf_template_usart.h:321
@ VSF_USART_FORCE_1_PARITY
Force 1 parity.
Definition vsf_template_usart.h:313
@ VSF_USART_RX_DISABLE
RX disabled.
Definition vsf_template_usart.h:359
@ VSF_USART_2_STOPBIT
2 stop bits
Definition vsf_template_usart.h:324
@ VSF_USART_CTS_HWCONTROL
CTS hardware flow control.
Definition vsf_template_usart.h:347
@ VSF_USART_5_BIT_LENGTH
USART Data bit length configuration options.
Definition vsf_template_usart.h:332
@ VSF_USART_SYNC_CLOCK_DISABLE
Sync clock disabled.
Definition vsf_template_usart.h:368
@ VSF_USART_RTS_CTS_HWCONTROL
RTS/CTS hardware flow control.
Definition vsf_template_usart.h:348
@ VSF_USART_HALF_DUPLEX_ENABLE
Half-duplex enabled.
Definition vsf_template_usart.h:377
@ VSF_USART_TX_DISABLE
TX disabled.
Definition vsf_template_usart.h:357
@ VSF_USART_RX_FIFO_THRESHOLD_FULL
RX FIFO full.
Definition vsf_template_usart.h:401
@ VSF_USART_6_BIT_LENGTH
6-bit data length
Definition vsf_template_usart.h:333
@ VSF_USART_0_5_STOPBIT
0.5 stop bit
Definition vsf_template_usart.h:323
@ VSF_USART_TX_FIFO_THRESHOLD_HALF_EMPTY
TX FIFO half empty.
Definition vsf_template_usart.h:388
@ VSF_USART_NO_HWCONTROL
USART Hardware flow control configuration options.
Definition vsf_template_usart.h:345
@ VSF_USART_1_5_STOPBIT
1.5 stop bits
Definition vsf_template_usart.h:322
uint_fast32_t vsf_usart_rxfifo_get_data_count(vsf_usart_t *usart_ptr)
Get the number of data currently received in the USART receive FIFO.
Definition usart_common.c:120
uint_fast32_t vsf_usart_rxfifo_read(vsf_usart_t *usart_ptr, void *buffer_ptr, uint_fast32_t count)
Try to read the maximum length of data from the USART receive FIFO.
#define VSF_USART_CTRL_SET_BREAK
Definition vsf_template_usart.h:728
@ VSF_USART_BIT_LENGTH_MASK
Definition vsf_template_usart.h:422
@ VSF_USART_TX_FIFO_THRESHOLD_MASK
Definition vsf_template_usart.h:431
@ VSF_USART_PARITY_MASK
Definition vsf_template_usart.h:407
@ VSF_USART_MODE_ALL_BITS_MASK
Definition vsf_template_usart.h:461
@ VSF_USART_HALF_DUPLEX_MASK
Definition vsf_template_usart.h:458
@ VSF_USART_HWCONTROL_MASK
Definition vsf_template_usart.h:443
@ VSF_USART_RX_MASK
Definition vsf_template_usart.h:452
@ VSF_USART_STOPBIT_MASK
Definition vsf_template_usart.h:415
@ VSF_USART_RX_FIFO_THRESHOLD_MASK
Definition vsf_template_usart.h:437
@ VSF_USART_SYNC_CLOCK_MASK
Definition vsf_template_usart.h:455
@ VSF_USART_TX_MASK
Definition vsf_template_usart.h:449
#define VSF_USART_CTRL_SEND_BREAK
Definition vsf_template_usart.h:717
fsm_rt_t vsf_usart_enable(vsf_usart_t *usart_ptr)
Enable a USART instance.
Definition usart_common.c:66
struct vsf_usart_isr_t vsf_usart_isr_t
USART interrupt configuration structure Contains all necessary information for configuring USART inte...
vsf_err_t vsf_usart_request_tx(vsf_usart_t *usart_ptr, void *buffer_ptr, uint_fast32_t count)
Request a DMA transmit operation through the USART.
Definition usart_common.c:165
uint_fast32_t vsf_usart_txfifo_get_free_count(vsf_usart_t *usart_ptr)
Get the maximum number of data that can be sent through the USART send FIFO.
Definition usart_common.c:138
vsf_err_t vsf_usart_cancel_tx(vsf_usart_t *usart_ptr)
Cancel an ongoing USART transmit operation.
Definition usart_common.c:183
vsf_usart_irq_mask_t
USART interrupt mask definitions These interrupts provide status and event notifications for USART op...
Definition vsf_template_usart.h:496
@ VSF_USART_IRQ_MASK_TX_CPL
TX complete(for request_tx API, data is written to TX FIFO) interrupt.
Definition vsf_template_usart.h:497
@ VSF_USART_IRQ_MASK_CTS
CTS change interrupt.
Definition vsf_template_usart.h:502
@ VSF_USART_IRQ_MASK_TX
TX FIFO threshold interrupt.
Definition vsf_template_usart.h:499
@ VSF_USART_IRQ_MASK_BREAK_ERR
Break error interrupt.
Definition vsf_template_usart.h:505
@ VSF_USART_IRQ_MASK_RX
RX FIFO threshold interrupt.
Definition vsf_template_usart.h:500
@ VSF_USART_IRQ_MASK_RX_TIMEOUT
RX timeout interrupt.
Definition vsf_template_usart.h:501
@ VSF_USART_IRQ_MASK_RX_OVERFLOW_ERR
RX overflow error interrupt.
Definition vsf_template_usart.h:506
@ VSF_USART_IRQ_MASK_RX_CPL
RX complete(for request_rx API, data is read from RX FIFO) interrupt.
Definition vsf_template_usart.h:498
@ VSF_USART_IRQ_MASK_PARITY_ERR
Parity error interrupt.
Definition vsf_template_usart.h:504
@ VSF_USART_IRQ_MASK_FRAME_ERR
Frame error interrupt.
Definition vsf_template_usart.h:503
void vsf_usart_fini(vsf_usart_t *usart_ptr)
Finalize a USART instance.
Definition usart_common.c:47
#define VSF_USART_APIS(__prefix_name)
USART API template, used to generate USART type, specific prefix function declarations,...
Definition vsf_template_usart.h:228
void vsf_usart_irq_enable(vsf_usart_t *usart_ptr, vsf_usart_irq_mask_t irq_mask)
Enable interrupt masks of USART instance.
Definition usart_common.c:84
void vsf_usart_irq_disable(vsf_usart_t *usart_ptr, vsf_usart_irq_mask_t irq_mask)
Disable interrupt masks of USART instance.
Definition usart_common.c:93
struct vsf_usart_status_t vsf_usart_status_t
USART status information structure Contains the current status of USART operations and FIFO threshold...
int_fast32_t vsf_usart_get_rx_count(vsf_usart_t *usart_ptr)
Get the number of bytes received in the current or last USART operation.
Definition usart_common.c:192
vsf_err_t vsf_usart_init(vsf_usart_t *usart_ptr, vsf_usart_cfg_t *cfg_ptr)
Initialize a USART instance.
Definition usart_common.c:38
vsf_usart_capability_t vsf_usart_capability(vsf_usart_t *usart_ptr)
Get the capability of USART instance.
Definition usart_common.c:111
vsf_usart_ctrl_t
USART control commands Defines the available control operations for USART instances.
Definition vsf_template_usart.h:707
@ __VSF_USART_CTRL_DUMMY_MASK
Definition vsf_template_usart.h:760
vsf_err_t vsf_usart_ctrl(vsf_usart_t *usart_ptr, vsf_usart_ctrl_t ctrl, void *param)
Execute a control command on the USART instance.
Definition usart_common.c:210
vsf_err_t vsf_usart_get_configuration(vsf_usart_t *usart_ptr, vsf_usart_cfg_t *cfg_ptr)
Get current configuration of a USART instance.
Definition usart_common.c:56
#define VSF_USART_IRQ_MASK_TX_IDLE
Definition vsf_template_usart.h:529
#define VSF_USART_CTRL_CLEAR_BREAK
Definition vsf_template_usart.h:739
#define VSF_USART_IRQ_MASK_RX_IDLE
Definition vsf_template_usart.h:542
int_fast32_t vsf_usart_get_tx_count(vsf_usart_t *usart_ptr)
Get the number of bytes transmitted in the current or last USART operation.
Definition usart_common.c:201
void vsf_usart_isr_handler_t(void *target_ptr, vsf_usart_t *usart_ptr, vsf_usart_irq_mask_t irq_mask)
USART interrupt handler function type declaration.
Definition vsf_template_usart.h:661
#define VSF_USART_IRQ_MASK_NOISE_ERR
uint_fast32_t vsf_usart_txfifo_write(vsf_usart_t *usart_ptr, void *buffer_ptr, uint_fast32_t count)
Try to write the maximum length of data to the USART send FIFO.
#define VSF_USART_IRQ_MASK_TX_OVERFLOW_ERR
Definition vsf_template_usart.h:518