]> granicus.if.org Git - esp-idf/commitdiff
intr_alloc: port*_CRITICAL vanilla FreeRTOS compliance
authorSachin Parekh <sachin.parekh@espressif.com>
Mon, 25 Mar 2019 10:39:55 +0000 (16:09 +0530)
committerSachin Parekh <sachin.parekh@espressif.com>
Mon, 13 May 2019 11:09:19 +0000 (16:39 +0530)
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
components/esp32/intr_alloc.c

index 35e60239766267fac88d9f5ec27a63fdbbd22481..856cebb55ffed498f9d93047921b62615fd8349b 100644 (file)
@@ -494,7 +494,7 @@ static void IRAM_ATTR shared_intr_isr(void *arg)
 {
     vector_desc_t *vd=(vector_desc_t*)arg;
     shared_vector_desc_t *sh_vec=vd->shared_vec_info;
-    portENTER_CRITICAL(&spinlock);
+    portENTER_CRITICAL_ISR(&spinlock);
     while(sh_vec) {
         if (!sh_vec->disabled) {
             if ((sh_vec->statusreg == NULL) || (*sh_vec->statusreg & sh_vec->statusmask)) {
@@ -512,7 +512,7 @@ static void IRAM_ATTR shared_intr_isr(void *arg)
         }
         sh_vec=sh_vec->next;
     }
-    portEXIT_CRITICAL(&spinlock);
+    portEXIT_CRITICAL_ISR(&spinlock);
 }
 
 #if CONFIG_SYSVIEW_ENABLE
@@ -520,7 +520,7 @@ static void IRAM_ATTR shared_intr_isr(void *arg)
 static void IRAM_ATTR non_shared_intr_isr(void *arg)
 {
     non_shared_isr_arg_t *ns_isr_arg=(non_shared_isr_arg_t*)arg;
-    portENTER_CRITICAL(&spinlock);
+    portENTER_CRITICAL_ISR(&spinlock);
     traceISR_ENTER(ns_isr_arg->source+ETS_INTERNAL_INTR_SOURCE_OFF);
     // FIXME: can we call ISR and check port_switch_flag after releasing spinlock?
     // when CONFIG_SYSVIEW_ENABLE = 0 ISRs for non-shared IRQs are called without spinlock
@@ -529,7 +529,7 @@ static void IRAM_ATTR non_shared_intr_isr(void *arg)
     if (!port_switch_flag[xPortGetCoreID()]) {
         traceISR_EXIT();
     }
-    portEXIT_CRITICAL(&spinlock);
+    portEXIT_CRITICAL_ISR(&spinlock);
 }
 #endif
 
@@ -794,7 +794,7 @@ int esp_intr_get_cpu(intr_handle_t handle)
 esp_err_t IRAM_ATTR esp_intr_enable(intr_handle_t handle)
 {
     if (!handle) return ESP_ERR_INVALID_ARG;
-    portENTER_CRITICAL(&spinlock);
+    portENTER_CRITICAL_SAFE(&spinlock);
     int source;
     if (handle->shared_vector_desc) {
         handle->shared_vector_desc->disabled=0;
@@ -810,14 +810,14 @@ esp_err_t IRAM_ATTR esp_intr_enable(intr_handle_t handle)
         if (handle->vector_desc->cpu!=xPortGetCoreID()) return ESP_ERR_INVALID_ARG; //Can only enable these ints on this cpu
         ESP_INTR_ENABLE(handle->vector_desc->intno);
     }
-    portEXIT_CRITICAL(&spinlock);
+    portEXIT_CRITICAL_SAFE(&spinlock);
     return ESP_OK;
 }
 
 esp_err_t IRAM_ATTR esp_intr_disable(intr_handle_t handle)
 {
     if (!handle) return ESP_ERR_INVALID_ARG;
-    portENTER_CRITICAL(&spinlock);
+    portENTER_CRITICAL_SAFE(&spinlock);
     int source;
     bool disabled = 1;
     if (handle->shared_vector_desc) {
@@ -850,7 +850,7 @@ esp_err_t IRAM_ATTR esp_intr_disable(intr_handle_t handle)
         }
         ESP_INTR_DISABLE(handle->vector_desc->intno);
     }
-    portEXIT_CRITICAL(&spinlock);
+    portEXIT_CRITICAL_SAFE(&spinlock);
     return ESP_OK;
 }