Panic: stop dport access handler without trying to use a lock

This commit is contained in:
Jeroen Domburg 2017-09-11 12:31:16 +08:00
parent de038f502c
commit b3fd494e71
3 changed files with 15 additions and 2 deletions

View file

@ -194,6 +194,15 @@ void IRAM_ATTR esp_dport_access_int_pause(void)
portEXIT_CRITICAL_ISR(&g_dport_mux);
}
//Used in panic code: the enter_critical stuff may be messed up so we just stop everything without checking the mux.
void IRAM_ATTR esp_dport_access_int_abort(void)
{
dport_core_state[0] = DPORT_CORE_STATE_IDLE;
#ifndef CONFIG_FREERTOS_UNICORE
dport_core_state[1] = DPORT_CORE_STATE_IDLE;
#endif
}
void IRAM_ATTR esp_dport_access_int_resume(void)
{
portENTER_CRITICAL_ISR(&g_dport_mux);

View file

@ -27,6 +27,10 @@ void esp_dport_access_int_init(void);
void esp_dport_access_int_pause(void);
void esp_dport_access_int_resume(void);
//This routine does not stop the dport routines in any way that is recoverable. Please
//only call in case of panic().
void esp_dport_access_int_abort(void);
#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
#define DPORT_STALL_OTHER_CPU_START()
#define DPORT_STALL_OTHER_CPU_END()

View file

@ -211,7 +211,7 @@ void panicHandler(XtExcFrame *frame)
return;
}
haltOtherCore();
esp_dport_access_int_pause();
esp_dport_access_int_abort();
panicPutStr("Guru Meditation Error: Core ");
panicPutDec(core_id);
panicPutStr(" panic'ed (");
@ -264,7 +264,7 @@ void panicHandler(XtExcFrame *frame)
void xt_unhandled_exception(XtExcFrame *frame)
{
haltOtherCore();
esp_dport_access_int_pause();
esp_dport_access_int_abort();
if (!abort_called) {
panicPutStr("Guru Meditation Error of type ");
int exccause = frame->exccause;