Skip to content

Commit 08b798a

Browse files
committed
fix(bt): fixed sw_intr issue with BT register or trigger error core on ESP32
1 parent a0f071f commit 08b798a

File tree

1 file changed

+14
-5
lines changed
  • components/bt/controller/esp32

1 file changed

+14
-5
lines changed

components/bt/controller/esp32/bt.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -878,9 +878,22 @@ static int IRAM_ATTR cause_sw_intr_to_core_wrapper(int core_id, int intr_no)
878878
#if CONFIG_FREERTOS_UNICORE
879879
cause_sw_intr((void *)intr_no);
880880
#else /* CONFIG_FREERTOS_UNICORE */
881+
#if CONFIG_FREERTOS_SMP
882+
uint32_t state = portDISABLE_INTERRUPTS();
883+
#else
884+
uint32_t state = portSET_INTERRUPT_MASK_FROM_ISR();
885+
#endif
881886
if (xPortGetCoreID() == core_id) {
882887
cause_sw_intr((void *)intr_no);
888+
#if CONFIG_FREERTOS_SMP
889+
portRESTORE_INTERRUPTS(state);
890+
} else {
891+
portRESTORE_INTERRUPTS(state);
892+
#else
893+
portCLEAR_INTERRUPT_MASK_FROM_ISR(state);
883894
} else {
895+
portCLEAR_INTERRUPT_MASK_FROM_ISR(state);
896+
#endif
884897
err = esp_ipc_call(core_id, cause_sw_intr, (void *)intr_no);
885898
}
886899
#endif /* !CONFIG_FREERTOS_UNICORE */
@@ -1501,11 +1514,7 @@ static void hli_queue_setup_pinned_to_core(int core_id)
15011514
#if CONFIG_FREERTOS_UNICORE
15021515
hli_queue_setup_cb(NULL);
15031516
#else /* CONFIG_FREERTOS_UNICORE */
1504-
if (xPortGetCoreID() == core_id) {
1505-
hli_queue_setup_cb(NULL);
1506-
} else {
1507-
esp_ipc_call(core_id, hli_queue_setup_cb, NULL);
1508-
}
1517+
esp_ipc_call_blocking(core_id, hli_queue_setup_cb, NULL);
15091518
#endif /* !CONFIG_FREERTOS_UNICORE */
15101519
}
15111520
#endif /* CONFIG_BTDM_CTRL_HLI */

0 commit comments

Comments
 (0)