dport access: Fix nested calls to DPORT_STALL_OTHER_CPU_START()

pull/846/merge
Angus Gratton 2017-08-15 11:23:35 +10:00 zatwierdzone przez Angus Gratton
rodzic 08287852ab
commit dc8c33892e
1 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -79,11 +79,12 @@ void IRAM_ATTR esp_dport_access_stall_other_cpu_start(void)
#ifdef DPORT_ACCESS_BENCHMARK #ifdef DPORT_ACCESS_BENCHMARK
ccount_start[cpu_id] = XTHAL_GET_CCOUNT(); ccount_start[cpu_id] = XTHAL_GET_CCOUNT();
#endif #endif
BaseType_t intLvl=portENTER_CRITICAL_NESTED(); BaseType_t intLvl = portENTER_CRITICAL_NESTED();
oldInterruptLevel[cpu_id]=intLvl;
if (dport_access_ref[cpu_id] == 0) { if (dport_access_ref[cpu_id] == 0) {
portENTER_CRITICAL_ISR(&g_dport_mux); portENTER_CRITICAL_ISR(&g_dport_mux);
oldInterruptLevel[cpu_id]=intLvl;
dport_access_start[cpu_id] = 0; dport_access_start[cpu_id] = 0;
dport_access_end[cpu_id] = 0; dport_access_end[cpu_id] = 0;
@ -100,6 +101,11 @@ void IRAM_ATTR esp_dport_access_stall_other_cpu_start(void)
} }
dport_access_ref[cpu_id]++; dport_access_ref[cpu_id]++;
if (dport_access_ref[cpu_id] > 1) {
/* Interrupts are already disabled by the parent, we're nested here. */
portEXIT_CRITICAL_NESTED(intLvl);
}
#endif /* CONFIG_FREERTOS_UNICORE */ #endif /* CONFIG_FREERTOS_UNICORE */
} }
@ -124,9 +130,9 @@ void IRAM_ATTR esp_dport_access_stall_other_cpu_end(void)
dport_access_end[cpu_id] = 1; dport_access_end[cpu_id] = 1;
portEXIT_CRITICAL_ISR(&g_dport_mux); portEXIT_CRITICAL_ISR(&g_dport_mux);
portEXIT_CRITICAL_NESTED(oldInterruptLevel[cpu_id]);
} }
portEXIT_CRITICAL_NESTED(oldInterruptLevel[cpu_id]);
#ifdef DPORT_ACCESS_BENCHMARK #ifdef DPORT_ACCESS_BENCHMARK
ccount_end[cpu_id] = XTHAL_GET_CCOUNT(); ccount_end[cpu_id] = XTHAL_GET_CCOUNT();