18#ifndef __VSF_HAL_DISTBUS_USART_H__
19#define __VSF_HAL_DISTBUS_USART_H__
25#if VSF_HAL_USE_USART == ENABLED && VSF_HAL_DISTBUS_USE_USART == ENABLED
30#if defined(__VSF_HAL_DISTBUS_USART_CLASS_IMPLEMENT)
31# define __VSF_CLASS_IMPLEMENT__
32#elif defined(__VSF_HAL_DISTBUS_USART_CLASS_INHERIT__)
33# define __VSF_CLASS_INHERIT__
44#ifndef VSF_HAL_DISTBUS_USART_CFG_MULTI_CLASS
45# define VSF_HAL_DISTBUS_USART_CFG_MULTI_CLASS VSF_USART_CFG_MULTI_CLASS
48#ifndef VSF_HAL_DISTBUS_USART_CFG_FIFO_SIZE
49# define VSF_HAL_DISTBUS_USART_CFG_FIFO_SIZE 1024
55#if defined(__VSF_HAL_DISTBUS_USART_CLASS_IMPLEMENT) || defined(__VSF_HAL_DISTBUS_USART_CLASS_INHERIT__)
58 VSF_HAL_DISTBUS_USART_CMD_INIT = 0,
59 VSF_HAL_DISTBUS_USART_CMD_ENABLE,
60 VSF_HAL_DISTBUS_USART_CMD_DISABLE,
61 VSF_HAL_DISTBUS_USART_CMD_IRQ_ENABLE,
62 VSF_HAL_DISTBUS_USART_CMD_IRQ_DISABLE,
63 VSF_HAL_DISTBUS_USART_CMD_TX,
66 VSF_HAL_DISTBUS_USART_CMD_TXED_COUNT,
67 VSF_HAL_DISTBUS_USART_CMD_RX,
68 VSF_HAL_DISTBUS_USART_CMD_ISR,
70 VSF_HAL_DISTBUS_USART_CMD_ADDR_RANGE,
73typedef enum vsf_hal_distbus_usart_mode_t {
75 VSF_HAL_DISTBUS_USART_NO_PARITY = (0x0ul << 0),
76 VSF_HAL_DISTBUS_USART_EVEN_PARITY = (0x1ul << 0),
77 VSF_HAL_DISTBUS_USART_ODD_PARITY = (0x2ul << 0),
78 VSF_HAL_DISTBUS_USART_FORCE_0_PARITY = (0x3ul << 0),
79 VSF_HAL_DISTBUS_USART_FORCE_1_PARITY = (0x4ul << 0),
80 VSF_HAL_DISTBUS_USART_PARITY_MASK = VSF_HAL_DISTBUS_USART_NO_PARITY
81 | VSF_HAL_DISTBUS_USART_EVEN_PARITY
82 | VSF_HAL_DISTBUS_USART_ODD_PARITY
83 | VSF_HAL_DISTBUS_USART_FORCE_0_PARITY
84 | VSF_HAL_DISTBUS_USART_FORCE_1_PARITY,
87 VSF_HAL_DISTBUS_USART_1_STOPBIT = (0x0ul << 3),
88 VSF_HAL_DISTBUS_USART_1_5_STOPBIT = (0x1ul << 3),
89 VSF_HAL_DISTBUS_USART_2_STOPBIT = (0x2ul << 3),
90 VSF_HAL_DISTBUS_USART_STOPBIT_MASK = VSF_HAL_DISTBUS_USART_1_STOPBIT
91 | VSF_HAL_DISTBUS_USART_1_5_STOPBIT
92 | VSF_HAL_DISTBUS_USART_2_STOPBIT,
95 VSF_HAL_DISTBUS_USART_5_BIT_LENGTH = (0x0ul << 5),
96 VSF_HAL_DISTBUS_USART_6_BIT_LENGTH = (0x1ul << 5),
97 VSF_HAL_DISTBUS_USART_7_BIT_LENGTH = (0x2ul << 5),
98 VSF_HAL_DISTBUS_USART_8_BIT_LENGTH = (0x3ul << 5),
99 VSF_HAL_DISTBUS_USART_9_BIT_LENGTH = (0x4ul << 5),
100 VSF_HAL_DISTBUS_USART_BIT_LENGTH_MASK = VSF_HAL_DISTBUS_USART_5_BIT_LENGTH
101 | VSF_HAL_DISTBUS_USART_6_BIT_LENGTH
102 | VSF_HAL_DISTBUS_USART_7_BIT_LENGTH
103 | VSF_HAL_DISTBUS_USART_8_BIT_LENGTH
104 | VSF_HAL_DISTBUS_USART_9_BIT_LENGTH,
107 VSF_HAL_DISTBUS_USART_NO_HWCONTROL = (0x0ul << 8),
108 VSF_HAL_DISTBUS_USART_RTS_HWCONTROL = (0x1ul << 8),
109 VSF_HAL_DISTBUS_USART_CTS_HWCONTROL = (0x2ul << 8),
110 VSF_HAL_DISTBUS_USART_RTS_CTS_HWCONTROL = (0x3ul << 8),
111 VSF_HAL_DISTBUS_USART_HWCONTROL_MASK = VSF_HAL_DISTBUS_USART_NO_HWCONTROL
112 | VSF_HAL_DISTBUS_USART_RTS_HWCONTROL
113 | VSF_HAL_DISTBUS_USART_CTS_HWCONTROL
114 | VSF_HAL_DISTBUS_USART_RTS_CTS_HWCONTROL,
117 VSF_HAL_DISTBUS_USART_TX_ENABLE = (0x1ul << 11),
118 VSF_HAL_DISTBUS_USART_RX_ENABLE = (0x1ul << 12),
119 VSF_HAL_DISTBUS_USART_ENABLE_MASK = VSF_HAL_DISTBUS_USART_TX_ENABLE
120 | VSF_HAL_DISTBUS_USART_RX_ENABLE,
122 VSF_HAL_DISTBUS_USART_MODE_ALL_BITS_MASK = VSF_HAL_DISTBUS_USART_PARITY_MASK
123 | VSF_HAL_DISTBUS_USART_STOPBIT_MASK
124 | VSF_HAL_DISTBUS_USART_BIT_LENGTH_MASK
125 | VSF_HAL_DISTBUS_USART_HWCONTROL_MASK
126 | VSF_HAL_DISTBUS_USART_ENABLE_MASK,
127} vsf_hal_distbus_usart_mode_t;
129typedef enum vsf_hal_distbus_usart_irq_mask_t {
130 VSF_HAL_DISTBUS_USART_IRQ_MASK_TX_CPL = 1UL << 0,
131 VSF_HAL_DISTBUS_USART_IRQ_MASK_RX_CPL = 1UL << 1,
132 VSF_HAL_DISTBUS_USART_IRQ_MASK_TX = 1UL << 2,
133 VSF_HAL_DISTBUS_USART_IRQ_MASK_RX = 1UL << 3,
134 VSF_HAL_DISTBUS_USART_IRQ_MASK_FRAME_ERR = 1UL << 8,
135 VSF_HAL_DISTBUS_USART_IRQ_MASK_PARITY_ERR = 1UL << 9,
136 VSF_HAL_DISTBUS_USART_IRQ_MASK_BREAK_ERR = 1UL << 10,
137 VSF_HAL_DISTBUS_USART_IRQ_MASK_OVERFLOW_ERR = 1UL << 11,
138 VSF_HAL_DISTBUS_USART_IRQ_MASK_RX_TIMEOUT = 1UL << 12,
140 VSF_HAL_DISTBUS_USART_IRQ_MASK_ERR = VSF_HAL_DISTBUS_USART_IRQ_MASK_FRAME_ERR
141 | VSF_HAL_DISTBUS_USART_IRQ_MASK_PARITY_ERR
142 | VSF_HAL_DISTBUS_USART_IRQ_MASK_BREAK_ERR
143 | VSF_HAL_DISTBUS_USART_IRQ_MASK_OVERFLOW_ERR,
145 VSF_HAL_DISTBUS_USART_IRQ_ALL_BITS_MASK = VSF_HAL_DISTBUS_USART_IRQ_MASK_TX
146 | VSF_HAL_DISTBUS_USART_IRQ_MASK_RX
147 | VSF_HAL_DISTBUS_USART_IRQ_MASK_RX_TIMEOUT
148 | VSF_HAL_DISTBUS_USART_IRQ_MASK_TX_CPL
149 | VSF_HAL_DISTBUS_USART_IRQ_MASK_RX_CPL
150 | VSF_HAL_DISTBUS_USART_IRQ_MASK_ERR,
151} vsf_hal_distbus_usart_irq_mask_t;
153typedef struct vsf_hal_distbus_usart_init_t {
159typedef struct vsf_hal_distbus_usart_isr_t {
163typedef struct vsf_hal_distbus_usart_txed_cnt_t {
169#if VSF_HAL_DISTBUS_USART_CFG_MULTI_CLASS == ENABLED
214#if defined(__VSF_HAL_DISTBUS_USART_CLASS_IMPLEMENT) || defined(__VSF_HAL_DISTBUS_USART_CLASS_INHERIT__)
223#define VSF_USART_CFG_DEC_PREFIX vsf_hal_distbus
224#define VSF_USART_CFG_DEC_UPCASE_PREFIX VSF_HAL_DISTBUS
225#define VSF_USART_CFG_DEC_FIFO_TO_REQUEST
232#undef __VSF_HAL_DISTBUS_USART_CLASS_IMPLEMENT
233#undef __VSF_HAL_DISTBUS_USART_CLASS_INHERIT__
vsf_usart_mode_t
Definition uart.h:32
vsf_usart_irq_mask_t
Definition uart.h:106
Definition vsf_distbus.h:86
Definition vsf_distbus.h:119
Definition vsf_hal_distbus_usart.h:168
Definition vsf_mem_stream.h:88
unsigned int uint32_t
Definition lvgl.h:43
unsigned char uint8_t
Definition lvgl.h:40
#define vsf_class(__name)
Definition ooc_class.h:48
const i_spi_t vsf_spi_irq_mask_t irq_mask
Definition spi_interface.h:38
Definition vsf_template_usart.h:726
vsf_usart_irq_mask_t vsf_hal_distbus_usart_irqmask_to_generic_usart_irqmask(uint32_t hal_distbus_usart_irqmask)
Definition vsf_hal_distbus_usart.c:80
uint32_t vsf_generic_usart_irqmask_to_hal_distbus_usart_irqmask(vsf_usart_irq_mask_t generic_usart_irqmask)
Definition vsf_hal_distbus_usart.c:86
uint32_t vsf_generic_usart_mode_to_hal_distbus_usart_mode(vsf_usart_mode_t generic_usart_mode)
Definition vsf_hal_distbus_usart.c:74
vsf_usart_mode_t vsf_hal_distbus_usart_mode_to_generic_usart_mode(uint32_t hal_distbus_usart_mode)
Definition vsf_hal_distbus_usart.c:68
#define VSF_HAL_DISTBUS_USART_CFG_FIFO_SIZE
Definition vsf_hal_distbus_usart.h:49
uint32_t vsf_hal_distbus_usart_register_service(vsf_distbus_t *distbus, vsf_hal_distbus_usart_t *usart, void *info, uint32_t infolen)
Definition vsf_hal_distbus_usart.c:173
uint32_t size
Definition vsf_memfs.h:50
__bfs_node_fifo_t fifo
Definition vsf_msg_tree.h:247
struct vk_romfs_header_t VSF_CAL_PACKED
void vsf_usart_isr_handler_t(void *target_ptr, vsf_usart_t *usart_ptr, vsf_usart_irq_mask_t irq_mask)
Definition vsf_template_usart.h:611