ESP32: Add implementation of up_putc

This commit is contained in:
Gregory Nutt 2016-10-27 18:27:19 -06:00
parent 4b16a64212
commit 1e7f78e5c0
1 changed files with 33 additions and 0 deletions

View File

@ -1231,4 +1231,37 @@ void xtensa_serial_initialize(void)
#endif
}
/****************************************************************************
* Name: up_putc
*
* Description:
* Provide priority, low-level access to support OS debug writes
*
****************************************************************************/
int up_putc(int ch)
{
#ifdef HAVE_SERIAL_CONSOLE
uint32_t intena;
esp32_disableallints(CONSOLE_DEV.priv, &intena);
/* Check for LF */
if (ch == '\n')
{
/* Add CR */
while(!esp32_txready(&CONSOLE_DEV));
esp32_send(&CONSOLE_DEV, 'r');
}
while(!esp32_txready(&CONSOLE_DEV));
esp32_send(&CONSOLE_DEV, ch);
esp32_restoreuartint(CONSOLE_DEV.priv, intena);
#endif
return ch;
}
#endif /* USE_SERIALDRIVER */