arch/sim/src/sim/up_simuart.c: Remove CONFIG_SIM_UART_DATAPOST for arch/sim. It's very dangerous to call NuttX API from simuart_thread.

This commit is contained in:
Xiang Xiao 2019-11-10 20:38:25 -06:00 committed by Gregory Nutt
parent 27a6039501
commit db8a7ab39c
3 changed files with 2 additions and 31 deletions

View File

@ -132,7 +132,7 @@ void up_idle(void)
nxsched_process_timer();
#endif
#if defined(CONFIG_DEV_CONSOLE) && !defined(CONFIG_SIM_UART_DATAPOST)
#ifdef CONFIG_DEV_CONSOLE
/* Handle UART data availability */
if (g_uart_data_available)

View File

@ -98,10 +98,6 @@
# endif
#endif
/* The design for how we signal UART data availability is up in the air */
#undef CONFIG_SIM_UART_DATAPOST
/* Context Switching Definitions ******************************************/
#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
@ -208,7 +204,7 @@ extern volatile int g_eventloop;
#endif
#endif
#if defined(CONFIG_DEV_CONSOLE) && !defined(CONFIG_SIM_UART_DATAPOST)
#ifdef CONFIG_DEV_CONSOLE
extern volatile int g_uart_data_available;
#endif

View File

@ -53,10 +53,6 @@
#define SIMUART_BUFSIZE 256
/* The design for how we signal UART data availability is up in the air */
#undef CONFIG_SIM_UART_DATAPOST
/****************************************************************************
* Private Data
****************************************************************************/
@ -69,9 +65,7 @@ static volatile int g_uarttail;
* Public Data
****************************************************************************/
#ifndef CONFIG_SIM_UART_DATAPOST
volatile int g_uart_data_available;
#endif
/****************************************************************************
* NuttX Domain Public Function Prototypes
@ -142,9 +136,6 @@ static void *simuart_thread(void *arg)
if (nread == 1)
{
#ifdef CONFIG_SIM_UART_DATAPOST
sched_lock();
#endif
/* Get the index to the next slot in the UART buffer */
prev = g_uarthead;
@ -174,25 +165,9 @@ static void *simuart_thread(void *arg)
* input.
*/
#ifdef CONFIG_SIM_UART_DATAPOST
simuart_post();
#else
g_uart_data_available = 1;
#endif
}
}
#ifdef CONFIG_SIM_UART_DATAPOST
/* REVISIT: This is very weird and scary here. When sched_unlock()
* is called, we may do a lonjmp() style context switch meaning
* that the logic will be run running on this thread! (but with a
* different stack). So we do not get back here until the task
* sleeps again. I can't help but believe that that is going to
* be a problem someday.
*/
sched_unlock();
#endif
}
}