mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
uart_pl011: "pl011_irq_tx_ready" and "pl011_txready" is reversed.
Build Documentation / build-html (push) Has been cancelled
Build Documentation / build-html (push) Has been cancelled
The implementation logic of "pl011_irq_tx_ready" and "pl011_txready" is reversed. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
+13
-13
@@ -594,13 +594,18 @@ static int pl011_irq_tx_complete(FAR const struct pl011_uart_port_s *sport)
|
|||||||
return config->uart->fr & PL011_FR_TXFE;
|
return config->uart->fr & PL011_FR_TXFE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pl011_irq_tx_ready(const struct pl011_uart_port_s *sport)
|
static int pl011_irq_tx_ready(FAR const struct pl011_uart_port_s *sport)
|
||||||
{
|
{
|
||||||
const struct pl011_config *config = &sport->config;
|
FAR const struct pl011_config *config = &sport->config;
|
||||||
|
FAR const struct pl011_data *data = &sport->data;
|
||||||
|
|
||||||
/* check for TX FIFO not full */
|
if (!data->sbsa && !(config->uart->cr & PL011_CR_TXE))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return ((config->uart->fr & PL011_FR_TXFF) == 0);
|
return (config->uart->imsc & PL011_IMSC_TXIM) &&
|
||||||
|
(!(config->uart->fr & PL011_FR_TXFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pl011_irq_rx_ready(FAR const struct pl011_uart_port_s *sport)
|
static int pl011_irq_rx_ready(FAR const struct pl011_uart_port_s *sport)
|
||||||
@@ -629,15 +634,10 @@ static bool pl011_txready(FAR struct uart_dev_s *dev)
|
|||||||
{
|
{
|
||||||
FAR struct pl011_uart_port_s *sport = dev->priv;
|
FAR struct pl011_uart_port_s *sport = dev->priv;
|
||||||
FAR const struct pl011_config *config = &sport->config;
|
FAR const struct pl011_config *config = &sport->config;
|
||||||
FAR struct pl011_data *data = &sport->data;
|
|
||||||
|
|
||||||
if (!data->sbsa && !(config->uart->cr & PL011_CR_TXE))
|
/* check for TX FIFO not full */
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (config->uart->imsc & PL011_IMSC_TXIM) &&
|
return ((config->uart->fr & PL011_FR_TXFF) == 0);
|
||||||
pl011_irq_tx_ready(sport);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@@ -668,7 +668,7 @@ static void pl011_send(FAR struct uart_dev_s *dev, int ch)
|
|||||||
FAR struct pl011_uart_port_s *sport = dev->priv;
|
FAR struct pl011_uart_port_s *sport = dev->priv;
|
||||||
FAR const struct pl011_config *config = &sport->config;
|
FAR const struct pl011_config *config = &sport->config;
|
||||||
|
|
||||||
while (!pl011_irq_tx_ready(sport));
|
while (!pl011_txready(dev));
|
||||||
|
|
||||||
config->uart->dr = ch;
|
config->uart->dr = ch;
|
||||||
}
|
}
|
||||||
@@ -837,7 +837,7 @@ static int pl011_irq_handler(int irq, FAR void *context, FAR void *arg)
|
|||||||
uart_recvchars(dev);
|
uart_recvchars(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl011_txready(dev))
|
if (pl011_irq_tx_ready(sport))
|
||||||
{
|
{
|
||||||
uart_xmitchars(dev);
|
uart_xmitchars(dev);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user