mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
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:
@@ -132,7 +132,7 @@ void up_idle(void)
|
|||||||
nxsched_process_timer();
|
nxsched_process_timer();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_DEV_CONSOLE) && !defined(CONFIG_SIM_UART_DATAPOST)
|
#ifdef CONFIG_DEV_CONSOLE
|
||||||
/* Handle UART data availability */
|
/* Handle UART data availability */
|
||||||
|
|
||||||
if (g_uart_data_available)
|
if (g_uart_data_available)
|
||||||
|
|||||||
@@ -98,10 +98,6 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The design for how we signal UART data availability is up in the air */
|
|
||||||
|
|
||||||
#undef CONFIG_SIM_UART_DATAPOST
|
|
||||||
|
|
||||||
/* Context Switching Definitions ******************************************/
|
/* Context Switching Definitions ******************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
|
#if defined(CONFIG_HOST_X86_64) && !defined(CONFIG_SIM_M32)
|
||||||
@@ -208,7 +204,7 @@ extern volatile int g_eventloop;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_DEV_CONSOLE) && !defined(CONFIG_SIM_UART_DATAPOST)
|
#ifdef CONFIG_DEV_CONSOLE
|
||||||
extern volatile int g_uart_data_available;
|
extern volatile int g_uart_data_available;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -53,10 +53,6 @@
|
|||||||
|
|
||||||
#define SIMUART_BUFSIZE 256
|
#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
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -69,9 +65,7 @@ static volatile int g_uarttail;
|
|||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_SIM_UART_DATAPOST
|
|
||||||
volatile int g_uart_data_available;
|
volatile int g_uart_data_available;
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* NuttX Domain Public Function Prototypes
|
* NuttX Domain Public Function Prototypes
|
||||||
@@ -142,9 +136,6 @@ static void *simuart_thread(void *arg)
|
|||||||
|
|
||||||
if (nread == 1)
|
if (nread == 1)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SIM_UART_DATAPOST
|
|
||||||
sched_lock();
|
|
||||||
#endif
|
|
||||||
/* Get the index to the next slot in the UART buffer */
|
/* Get the index to the next slot in the UART buffer */
|
||||||
|
|
||||||
prev = g_uarthead;
|
prev = g_uarthead;
|
||||||
@@ -174,25 +165,9 @@ static void *simuart_thread(void *arg)
|
|||||||
* input.
|
* input.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_SIM_UART_DATAPOST
|
|
||||||
simuart_post();
|
|
||||||
#else
|
|
||||||
g_uart_data_available = 1;
|
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user