kopia lustrzana https://github.com/espressif/esp-idf
Dport accesses would re-enable interrupts unconditionally, breaking things when called in an ISR. This saves and restores the interrupt status, fixing this.
rodzic
dbb862299d
commit
fded7b4270
|
@ -60,6 +60,10 @@ static uint32_t ccount_margin[portNUM_PROCESSORS][DPORT_ACCESS_BENCHMARK_STORE_N
|
||||||
static uint32_t ccount_margin_cnt;
|
static uint32_t ccount_margin_cnt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_FREERTOS_UNICORE
|
||||||
|
static BaseType_t oldInterruptLevel[2];
|
||||||
|
#endif
|
||||||
|
|
||||||
/* stall other cpu that this cpu is pending to access dport register start */
|
/* stall other cpu that this cpu is pending to access dport register start */
|
||||||
void IRAM_ATTR esp_dport_access_stall_other_cpu_start(void)
|
void IRAM_ATTR esp_dport_access_stall_other_cpu_start(void)
|
||||||
{
|
{
|
||||||
|
@ -74,8 +78,8 @@ 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();
|
||||||
portDISABLE_INTERRUPTS();
|
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);
|
||||||
|
@ -121,7 +125,7 @@ void IRAM_ATTR esp_dport_access_stall_other_cpu_end(void)
|
||||||
portEXIT_CRITICAL_ISR(&g_dport_mux);
|
portEXIT_CRITICAL_ISR(&g_dport_mux);
|
||||||
}
|
}
|
||||||
|
|
||||||
portENABLE_INTERRUPTS();
|
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();
|
||||||
|
|
Ładowanie…
Reference in New Issue