mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Fix out-of-bounds on dmaworkaround_channels_busy
This commit is contained in:
parent
8af3fe4e84
commit
9962cc9c9f
@ -350,7 +350,7 @@ bool IRAM_ATTR spicommon_dmaworkaround_req_reset(int dmachan, dmaworkaround_cb_t
|
|||||||
int otherchan = (dmachan == 1) ? 2 : 1;
|
int otherchan = (dmachan == 1) ? 2 : 1;
|
||||||
bool ret;
|
bool ret;
|
||||||
portENTER_CRITICAL(&dmaworkaround_mux);
|
portENTER_CRITICAL(&dmaworkaround_mux);
|
||||||
if (dmaworkaround_channels_busy[otherchan]) {
|
if (dmaworkaround_channels_busy[otherchan-1]) {
|
||||||
//Other channel is busy. Call back when it's done.
|
//Other channel is busy. Call back when it's done.
|
||||||
dmaworkaround_cb = cb;
|
dmaworkaround_cb = cb;
|
||||||
dmaworkaround_cb_arg = arg;
|
dmaworkaround_cb_arg = arg;
|
||||||
@ -374,7 +374,7 @@ bool IRAM_ATTR spicommon_dmaworkaround_reset_in_progress()
|
|||||||
void IRAM_ATTR spicommon_dmaworkaround_idle(int dmachan)
|
void IRAM_ATTR spicommon_dmaworkaround_idle(int dmachan)
|
||||||
{
|
{
|
||||||
portENTER_CRITICAL(&dmaworkaround_mux);
|
portENTER_CRITICAL(&dmaworkaround_mux);
|
||||||
dmaworkaround_channels_busy[dmachan] = 0;
|
dmaworkaround_channels_busy[dmachan-1] = 0;
|
||||||
if (dmaworkaround_waiting_for_chan == dmachan) {
|
if (dmaworkaround_waiting_for_chan == dmachan) {
|
||||||
//Reset DMA
|
//Reset DMA
|
||||||
SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_SPI_DMA_RST);
|
SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_SPI_DMA_RST);
|
||||||
@ -390,7 +390,7 @@ void IRAM_ATTR spicommon_dmaworkaround_idle(int dmachan)
|
|||||||
void IRAM_ATTR spicommon_dmaworkaround_transfer_active(int dmachan)
|
void IRAM_ATTR spicommon_dmaworkaround_transfer_active(int dmachan)
|
||||||
{
|
{
|
||||||
portENTER_CRITICAL(&dmaworkaround_mux);
|
portENTER_CRITICAL(&dmaworkaround_mux);
|
||||||
dmaworkaround_channels_busy[dmachan] = 1;
|
dmaworkaround_channels_busy[dmachan-1] = 1;
|
||||||
portEXIT_CRITICAL(&dmaworkaround_mux);
|
portEXIT_CRITICAL(&dmaworkaround_mux);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user