Browse Source

freertos port: check we're not in interrupt

Also try to make LWIP_ASSERT_CORE_LOCKED() work for NO_SYS (check we're
not in interrupt)
master
goldsimon 8 years ago
parent
commit
5e41ca8e23
  1. 12
      ports/freertos/sys_arch.c

12
ports/freertos/sys_arch.c

@ -569,19 +569,30 @@ sys_unlock_tcpip_core(void)
#endif /* LWIP_TCPIP_CORE_LOCKING */
#if !NO_SYS
static TaskHandle_t lwip_tcpip_thread;
#endif
void
sys_mark_tcpip_thread(void)
{
#if !NO_SYS
lwip_tcpip_thread = xTaskGetCurrentTaskHandle();
#endif
}
void
sys_check_core_locking(void)
{
/* Embedded systems should check we are NOT in an interrupt context here */
/* E.g. core Cortex-M3/M4 ports:
configASSERT( ( portNVIC_INT_CTRL_REG & portVECTACTIVE_MASK ) == 0 );
Instead, we use more generic FreeRTOS functions here, which should fail from ISR: */
taskENTER_CRITICAL();
taskEXIT_CRITICAL();
#if !NO_SYS
if (lwip_tcpip_thread != 0) {
TaskHandle_t current_thread = xTaskGetCurrentTaskHandle();
@ -592,6 +603,7 @@ sys_check_core_locking(void)
LWIP_ASSERT("Function called from wrong thread", current_thread == lwip_tcpip_thread);
#endif /* LWIP_TCPIP_CORE_LOCKING */
}
#endif /* !NO_SYS */
}
#endif /* LWIP_FREERTOS_CHECK_CORE_LOCKING*/

Loading…
Cancel
Save