Skip to content

Commit

Permalink
arch/risc-v/src/mpfs/mpfs_serial.c: Allow switching uart output to co…
Browse files Browse the repository at this point in the history
…nsole 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 <[email protected]>
  • Loading branch information
jlaitine committed Oct 31, 2023
1 parent da552ca commit f548d35
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions arch/risc-v/src/mpfs/mpfs_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,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);

Expand Down Expand Up @@ -1547,6 +1554,14 @@ int up_putc(int ch)
#ifdef HAVE_SERIAL_CONSOLE
struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
uint32_t ier;
#endif

if (!CONSOLE_DEV.isconsole)
{
return ch;
}

#ifdef HAVE_SERIAL_CONSOLE
up_disableuartint(priv, &ier);
#endif

Expand Down

0 comments on commit f548d35

Please sign in to comment.