arch/risc-v/src/mpfs/mpfs_serial.c: Allow switching uart output to console off

By setting "isconsole" to false, mpfs_serial stops outputting to console.

This can be used to disable output to debug console in low level.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen 2023-10-31 11:46:02 +02:00 committed by Xiang Xiao
parent a28f6716d5
commit 888dc229fa
1 changed files with 13 additions and 0 deletions

View File

@ -1027,6 +1027,13 @@ static void up_send(struct uart_dev_s *dev, int ch)
{
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
#ifdef HAVE_SERIAL_CONSOLE
if (dev == &CONSOLE_DEV && !dev->isconsole)
{
return;
}
#endif
while ((up_serialin(priv, MPFS_UART_LSR_OFFSET)
& UART_LSR_THRE) == 0);
@ -1198,6 +1205,12 @@ int up_putc(int ch)
#ifdef HAVE_SERIAL_CONSOLE
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
uint32_t ier;
if (!CONSOLE_DEV.isconsole)
{
return ch;
}
up_disableuartint(priv, &ier);
#endif