From 43a12894ea7f6f6dabe1f48008898a9297b4ed08 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Fri, 23 Mar 2018 19:28:03 +0530 Subject: [PATCH] driver/spi: add _ISR counterparts if invoked from interrupt for critical section Signed-off-by: Mahavir Jain --- components/driver/spi_common.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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); }