Procházet zdrojové kódy

bt: fix OS abstraction layer for correct critical section API usage

Signed-off-by: Mahavir Jain <mahavir@espressif.com>
Mahavir Jain před 7 roky
rodič
revize
bd177a34c6
1 změnil soubory, kde provedl 10 přidání a 2 odebrání
  1. 10 2
      components/bt/bt.c

+ 10 - 2
components/bt/bt.c

@@ -254,12 +254,20 @@ bool IRAM_ATTR btdm_queue_generic_deregister(btdm_queue_item_t *queue)
 
 static void IRAM_ATTR interrupt_disable(void)
 {
-    portENTER_CRITICAL(&global_int_mux);
+    if (xPortInIsrContext()) {
+        portENTER_CRITICAL_ISR(&global_int_mux);
+    } else {
+        portENTER_CRITICAL(&global_int_mux);
+    }
 }
 
 static void IRAM_ATTR interrupt_restore(void)
 {
-    portEXIT_CRITICAL(&global_int_mux);
+    if (xPortInIsrContext()) {
+        portEXIT_CRITICAL_ISR(&global_int_mux);
+    } else {
+        portEXIT_CRITICAL(&global_int_mux);
+    }
 }
 
 static void IRAM_ATTR task_yield_from_isr(void)