From: Mahavir Jain Date: Fri, 23 Mar 2018 13:58:03 +0000 (+0530) Subject: driver/spi: add _ISR counterparts if invoked from interrupt for critical section X-Git-Tag: v3.1-beta1~238^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43a12894ea7f6f6dabe1f48008898a9297b4ed08;p=esp-idf driver/spi: add _ISR counterparts if invoked from interrupt for critical section Signed-off-by: Mahavir Jain --- diff --git a/components/driver/spi_common.c b/components/driver/spi_common.c index 4ea94a7c00..0aab4ee026 100644 --- a/components/driver/spi_common.c +++ b/components/driver/spi_common.c @@ -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); }