]> granicus.if.org Git - esp-idf/commitdiff
driver/spi: add _ISR counterparts if invoked from interrupt for critical section
authorMahavir Jain <mahavir@espressif.com>
Fri, 23 Mar 2018 13:58:03 +0000 (19:28 +0530)
committerMahavir Jain <mahavir@espressif.com>
Thu, 19 Apr 2018 12:58:55 +0000 (18:28 +0530)
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
components/driver/spi_common.c

index 4ea94a7c005bb61e4507072f6203aa7c69d3e6a1..0aab4ee026f400bcaccb3bc335f1588516993500 100644 (file)
@@ -438,7 +438,7 @@ bool IRAM_ATTR spicommon_dmaworkaround_req_reset(int dmachan, dmaworkaround_cb_t
 {
     int otherchan = (dmachan == 1) ? 2 : 1;
     bool ret;
-    portENTER_CRITICAL(&dmaworkaround_mux);
+    portENTER_CRITICAL_ISR(&dmaworkaround_mux);
     if (dmaworkaround_channels_busy[otherchan-1]) {
         //Other channel is busy. Call back when it's done.
         dmaworkaround_cb = cb;
@@ -450,7 +450,7 @@ bool IRAM_ATTR spicommon_dmaworkaround_req_reset(int dmachan, dmaworkaround_cb_t
         periph_module_reset( PERIPH_SPI_DMA_MODULE );
         ret = true;
     }
-    portEXIT_CRITICAL(&dmaworkaround_mux);
+    portEXIT_CRITICAL_ISR(&dmaworkaround_mux);
     return ret;
 }
 
@@ -461,7 +461,7 @@ bool IRAM_ATTR spicommon_dmaworkaround_reset_in_progress()
 
 void IRAM_ATTR spicommon_dmaworkaround_idle(int dmachan)
 {
-    portENTER_CRITICAL(&dmaworkaround_mux);
+    portENTER_CRITICAL_ISR(&dmaworkaround_mux);
     dmaworkaround_channels_busy[dmachan-1] = 0;
     if (dmaworkaround_waiting_for_chan == dmachan) {
         //Reset DMA
@@ -471,14 +471,14 @@ void IRAM_ATTR spicommon_dmaworkaround_idle(int dmachan)
         dmaworkaround_cb(dmaworkaround_cb_arg);
 
     }
-    portEXIT_CRITICAL(&dmaworkaround_mux);
+    portEXIT_CRITICAL_ISR(&dmaworkaround_mux);
 }
 
 void IRAM_ATTR spicommon_dmaworkaround_transfer_active(int dmachan)
 {
-    portENTER_CRITICAL(&dmaworkaround_mux);
+    portENTER_CRITICAL_ISR(&dmaworkaround_mux);
     dmaworkaround_channels_busy[dmachan-1] = 1;
-    portEXIT_CRITICAL(&dmaworkaround_mux);
+    portEXIT_CRITICAL_ISR(&dmaworkaround_mux);
 }