forked from espressif/esp-idf
dport access: Fix WDT bug (permanent locking) in non-pinned tasks
If scheduler switches cores in narrow window during esp_dport_access_stall_other_cpu_start(), could cause the stall interrupt to occur on the running CPU - halting the CPU until WDT cleans up. Related to https://github.com/espressif/esp-idf/issues/630
This commit is contained in:
committed by
Angus Gratton
parent
50e0a54630
commit
afb6119504
@@ -69,17 +69,18 @@ static BaseType_t oldInterruptLevel[2];
|
|||||||
void IRAM_ATTR esp_dport_access_stall_other_cpu_start(void)
|
void IRAM_ATTR esp_dport_access_stall_other_cpu_start(void)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_FREERTOS_UNICORE
|
#ifndef CONFIG_FREERTOS_UNICORE
|
||||||
int cpu_id = xPortGetCoreID();
|
|
||||||
|
|
||||||
if (dport_core_state[0] == DPORT_CORE_STATE_IDLE
|
if (dport_core_state[0] == DPORT_CORE_STATE_IDLE
|
||||||
|| dport_core_state[1] == DPORT_CORE_STATE_IDLE) {
|
|| dport_core_state[1] == DPORT_CORE_STATE_IDLE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BaseType_t intLvl = portENTER_CRITICAL_NESTED();
|
||||||
|
|
||||||
|
int cpu_id = xPortGetCoreID();
|
||||||
|
|
||||||
#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();
|
|
||||||
|
|
||||||
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);
|
||||||
|
Reference in New Issue
Block a user