mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-23 20:20:22 +08:00
dev/serial: Simplify some Zynq UART functions
Make the initialization and polled functions independent of the Termios context. This helps to implement the kernel I/O support without a dependency on the Termios framework.
This commit is contained in:
@@ -43,6 +43,8 @@
|
||||
|
||||
#include <bsp/utility.h>
|
||||
|
||||
#define ZYNQ_UART_DEFAULT_BAUD 115200
|
||||
|
||||
#define ZYNQ_UART_FIFO_DEPTH 64
|
||||
|
||||
typedef struct zynq_uart {
|
||||
@@ -158,6 +160,24 @@ typedef struct zynq_uart {
|
||||
#define ZYNQ_UART_TX_FIFO_TRG_LVL_TTRIG_SET(reg, val) BSP_FLD32SET(reg, val, 0, 5)
|
||||
} zynq_uart;
|
||||
|
||||
void zynq_uart_initialize(volatile zynq_uart *regs);
|
||||
|
||||
int zynq_uart_read_char_polled(volatile zynq_uart *regs);
|
||||
|
||||
void zynq_uart_write_char_polled(volatile zynq_uart *regs, char c);
|
||||
|
||||
/**
|
||||
* Flush TX FIFO and wait until it is empty. Used in bsp_reset.
|
||||
*/
|
||||
void zynq_uart_reset_tx_flush(volatile zynq_uart *regs);
|
||||
|
||||
int zynq_cal_baud_rate(
|
||||
uint32_t baudrate,
|
||||
uint32_t* brgr,
|
||||
uint32_t* bauddiv,
|
||||
uint32_t modereg
|
||||
);
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* LIBBSP_ARM_XILINX_ZYNQ_UART_REGS_H */
|
||||
|
||||
@@ -59,29 +59,6 @@ typedef struct {
|
||||
|
||||
extern const rtems_termios_device_handler zynq_uart_handler;
|
||||
|
||||
#define ZYNQ_UART_DEFAULT_BAUD 115200
|
||||
|
||||
void zynq_uart_initialize(rtems_termios_device_context *base);
|
||||
|
||||
int zynq_uart_read_polled(rtems_termios_device_context *base);
|
||||
|
||||
void zynq_uart_write_polled(
|
||||
rtems_termios_device_context *base,
|
||||
char c
|
||||
);
|
||||
|
||||
/**
|
||||
* Flush TX FIFO and wait until it is empty. Used in bsp_reset.
|
||||
*/
|
||||
void zynq_uart_reset_tx_flush(zynq_uart_context *ctx);
|
||||
|
||||
int zynq_cal_baud_rate(
|
||||
uint32_t baudrate,
|
||||
uint32_t* brgr,
|
||||
uint32_t* bauddiv,
|
||||
uint32_t modereg
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
Reference in New Issue
Block a user