Skip to content

Commit

Permalink
esp32s3_serial.c: make up_putc take the critical section
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Nov 14, 2024
1 parent fcf69bd commit e021c2c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/xtensa/src/esp32s3/esp32s3_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1213,15 +1213,18 @@ void xtensa_serialinit(void)
void up_putc(int ch)
{
#ifdef CONSOLE_UART
irqstate_t flags;
uint32_t int_status;

flags = enter_critical_section();
esp32s3_lowputc_disable_all_uart_int(CONSOLE_DEV.priv, &int_status);
#endif

xtensa_lowputc((char)ch);

#ifdef CONSOLE_UART
esp32s3_lowputc_restore_all_uart_int(CONSOLE_DEV.priv, &int_status);
leave_critical_section(flags);
#endif
}

Expand All @@ -1240,15 +1243,18 @@ void up_putc(int ch)
void up_putc(int ch)
{
#ifdef CONSOLE_UART
irqstate_t flags;
uint32_t int_status;

flags = enter_critical_section();
esp32s3_lowputc_disable_all_uart_int(CONSOLE_DEV.priv, &int_status);
#endif

xtensa_lowputc(ch);

#ifdef CONSOLE_UART
esp32s3_lowputc_restore_all_uart_int(CONSOLE_DEV.priv, &int_status);
leave_critical_section(flags);
#endif
}

Expand Down

0 comments on commit e021c2c

Please sign in to comment.