36 #ifndef __MHAL_UART_H__
37 #define __MHAL_UART_H__
39 #include "mhal_osai.h"
258 #define UART_EPTR (1)
260 #define UART_ENXIO (6)
262 #define UART_EINVAL (22)
264 #define UART_ETIMEDOUT (110)
267 #define UART_INT_DISABLE 0x00
269 #define UART_INT_RX_BUFFER_FULL 0x01
271 #define UART_INT_TX_BUFFER_EMPTY 0x02
273 #define UART_INT_LINE_STATUS 0x04
275 #define UART_INT_SW_FLOW_CONTROL 0x20
277 #define UART_INT_HW_FLOW_CONTROL_RTS 0x40
279 #define UART_INT_HW_FLOW_CONTROL_CTS 0x80
282 #define UART_EFR_HW_FC_DISABLE 0x00
284 #define UART_EFR_HW_FC_RTS 0x40
286 #define UART_EFR_HW_FC_CTS 0x80
288 #define UART_EFR_HW_FC_RTS_CTS 0xC0
421 u8 xon1, u8 xoff1, u8 xon2, u8 xoff2, u8 escape_data);
u32 rx_size
tx transfer len
Definition: mhal_uart.h:208
unsigned char * tx_buf
used for tx temp buf
Definition: mhal_uart.h:193
u32 tx_len
temp tx transfer len
Definition: mhal_uart.h:202
mhal_uart_data_len
This enum defines UART data length.
Definition: mhal_uart.h:112
int mtk_mhal_uart_set_dma(struct mtk_uart_controller *ctlr, bool enable_dma)
This function is used to set the DMA setting relative to the UART.
7 bits word length
Definition: mhal_uart.h:118
u32 baudrate
UART baudrate.
Definition: mhal_uart.h:235
Disbale parity.
Definition: mhal_uart.h:127
u32 rx_len
temp rx transfer len
Definition: mhal_uart.h:204
u8 port_num
UART controller port num.
Definition: mhal_uart.h:229
int mtk_mhal_uart_set_format(struct mtk_uart_controller *ctlr)
This function is used to set UART data format.
mhal_uart_stop_bit stop_bit
UART stop bit.
Definition: mhal_uart.h:241
int mtk_mhal_uart_sw_reset(struct mtk_uart_controller *ctlr)
This function is used to reset UART.
int mtk_mhal_uart_start_dma_tx(struct mtk_uart_controller *ctlr)
This function is used to start UART DMA TX transaction.
int mtk_mhal_uart_disable_sw_fc(struct mtk_uart_controller *ctlr)
This function is used to disable UART software flow control.
dma_addr_t rx_dma
temp rx DMA physical addr
Definition: mhal_uart.h:199
1 stop bit
Definition: mhal_uart.h:142
u8 vff_dma_mode
UART DMA mode.
Definition: mhal_uart.h:243
mhal_uart_parity parity
UART parity.
Definition: mhal_uart.h:239
6 bits word length
Definition: mhal_uart.h:116
void * user_data
user_data is used to store spis hw setting.
Definition: mhal_spis.h:788
int mtk_mhal_uart_dma_tx_config(struct mtk_uart_controller *ctlr)
This function is used to config UART DMA TX channel.
5 bits word length
Definition: mhal_uart.h:114
int mtk_mhal_uart_getc_nowait(struct mtk_uart_controller *ctlr)
This function is used to get data directly in PIO mode.
M-HAL private structure.
Definition: mhal_uart.h:186
int mtk_mhal_uart_stop_dma_rx(struct mtk_uart_controller *ctlr)
This function is used to stop UART DMA RX transaction.
void * user_data
user_data is a OS-HAL defined parameter provided by #mtk_mhal_uart_dma_done_callback_register().
Definition: mhal_uart.h:213
Interface to UART.
Definition: mhal_uart.h:227
int(* uart_dma_done_callback)(void *user_data)
This defines the callback function prototype.
Definition: mhal_uart.h:172
int mtk_mhal_uart_release_dma_tx_ch(struct mtk_uart_controller *ctlr)
This function is used to release UART DMA TX channel.
Enable space parity.
Definition: mhal_uart.h:135
mhal_uart_data_len data_bit
UART data bit.
Definition: mhal_uart.h:237
u8 dma_tx_ch
temp tx transfer len
Definition: mhal_uart.h:188
int mtk_mhal_uart_set_hw_fc(struct mtk_uart_controller *ctlr, u8 hw_fc)
This function is used to enable UART hardware flow control.
mhal_uart_parity
This enum defines UART parity parameter.
Definition: mhal_uart.h:125
uart_dma_done_callback uart_rx_dma_callback
This function is used to register user's RX DMA done callback to OS-HAL layer.
Definition: mhal_uart.h:221
2 stop bits
Definition: mhal_uart.h:144
struct mtk_uart_private * mdata
M-HAL privite structure, used by M-HAL only.
Definition: mhal_uart.h:245
u8 dma_rx_ch
temp rx transfer len
Definition: mhal_uart.h:190
int mtk_mhal_uart_enable_clk(struct mtk_uart_controller *ctlr)
This function is used to enable UART clock.
dma_addr_t tx_dma
temp tx DMA physical addr
Definition: mhal_uart.h:197
int mtk_mhal_uart_dumpreg(struct mtk_uart_controller *ctlr)
This function is used to dump UART register.
int mtk_mhal_uart_dma_tx_callback_register(struct mtk_uart_controller *ctlr, uart_dma_done_callback callback, void *user_data)
This defines the callback function prototype.
int mtk_mhal_uart_update_dma_rx_info(struct mtk_uart_controller *ctlr)
This function is used to update DMA RX information when RX fail.
void __iomem * cg_base
Clock gate base address.
Definition: mhal_uart.h:233
int mtk_mhal_uart_set_sw_fc(struct mtk_uart_controller *ctlr, u8 xon1, u8 xoff1, u8 xon2, u8 xoff2, u8 escape_data)
This function is used to configure UART software flow control.
int mtk_mhal_uart_dma_rx_callback_register(struct mtk_uart_controller *ctlr, uart_dma_done_callback callback, void *user_data)
This defines the callback function prototype.
int mtk_mhal_uart_getc(struct mtk_uart_controller *ctlr)
This function is used to get data in PIO mode.
int mtk_mhal_uart_putc(struct mtk_uart_controller *ctlr, u8 data)
This function is used to send one byte of data in PIO mode.
int mtk_mhal_uart_clear_irq_status(struct mtk_uart_controller *ctlr)
This function is used to get and clear UART IRQ.
int mtk_mhal_uart_update_dma_tx_info(struct mtk_uart_controller *ctlr)
This function is used to update DMA TX information when TX fail.
int mtk_mhal_uart_dma_rx_config(struct mtk_uart_controller *ctlr)
This function is used to config UART DMA RX channel.
int mtk_mhal_uart_release_dma_rx_ch(struct mtk_uart_controller *ctlr)
This function is used to release UART DMA RX channel.
Enable mark parity.
Definition: mhal_uart.h:133
Enable even parity.
Definition: mhal_uart.h:131
u32 tx_size
tx transfer len
Definition: mhal_uart.h:206
int mtk_mhal_uart_stop_dma_tx(struct mtk_uart_controller *ctlr)
This function is used to stop UART DMA TX transaction.
Enable odd parity.
Definition: mhal_uart.h:129
int mtk_mhal_uart_disable_clk(struct mtk_uart_controller *ctlr)
This function is used to disable UART clock.
8 bits word length
Definition: mhal_uart.h:120
void __iomem * base
UART controller base address.
Definition: mhal_uart.h:231
int mtk_mhal_uart_allocate_dma_rx_ch(struct mtk_uart_controller *ctlr)
This function is used to allocate UART DMA RX channel.
int mtk_mhal_uart_allocate_dma_tx_ch(struct mtk_uart_controller *ctlr)
This function is used to allocate UART DMA TX channel.
int mtk_mhal_uart_start_dma_rx(struct mtk_uart_controller *ctlr)
This function is used to start UART DMA RX transaction.
int mtk_mhal_uart_hw_init(struct mtk_uart_controller *ctlr)
This function is used to initialize UART port.
uart_dma_done_callback uart_tx_dma_callback
This function is used to register user's TX DMA done callback to OS-HAL layer.
Definition: mhal_uart.h:217
int mtk_mhal_uart_set_baudrate(struct mtk_uart_controller *ctlr)
This function is used to change UART baudrate.
mhal_uart_stop_bit
This enum defines stop bit length.
Definition: mhal_uart.h:140
unsigned char * rx_buf
used for rx temp buf
Definition: mhal_uart.h:195
int mtk_mhal_uart_set_irq(struct mtk_uart_controller *ctlr, u8 int_flag)
This function is used to set UART IRQ function.