mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-20 03:05:47 +08:00
dev/serial: Simplify zynq_uart_reset_tx_flush()
Load the status register only once. Use _IO_Relax() to reduce bus traffic while waiting and simplify testing.
This commit is contained in:
@@ -131,11 +131,7 @@ void zynq_uart_initialize(volatile zynq_uart *regs)
|
||||
uint32_t bauddiv = 0x6;
|
||||
uint32_t mode_clks = regs->mode & ZYNQ_UART_MODE_CLKS;
|
||||
|
||||
while ((regs->channel_sts & ZYNQ_UART_CHANNEL_STS_TEMPTY) == 0 ||
|
||||
(regs->channel_sts & ZYNQ_UART_CHANNEL_STS_TACTIVE) != 0) {
|
||||
/* Wait */
|
||||
}
|
||||
|
||||
zynq_uart_reset_tx_flush(regs);
|
||||
zynq_cal_baud_rate(ZYNQ_UART_DEFAULT_BAUD, &brgr, &bauddiv, mode_clks);
|
||||
|
||||
regs->control = 0;
|
||||
@@ -174,9 +170,10 @@ void zynq_uart_write_char_polled(volatile zynq_uart *regs, char c)
|
||||
|
||||
void zynq_uart_reset_tx_flush(volatile zynq_uart *regs)
|
||||
{
|
||||
|
||||
while ((regs->channel_sts & ZYNQ_UART_CHANNEL_STS_TEMPTY) == 0 ||
|
||||
(regs->channel_sts & ZYNQ_UART_CHANNEL_STS_TACTIVE) != 0) {
|
||||
/* Wait */
|
||||
while (
|
||||
(regs->channel_sts &
|
||||
(ZYNQ_UART_CHANNEL_STS_TEMPTY | ZYNQ_UART_CHANNEL_STS_TACTIVE)) !=
|
||||
ZYNQ_UART_CHANNEL_STS_TEMPTY) {
|
||||
_IO_Relax();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user