kopia lustrzana https://github.com/espressif/esp-idf
Fix out-of-bounds on dmaworkaround_channels_busy
rodzic
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;
|
||||
bool ret;
|
||||
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.
|
||||
dmaworkaround_cb = cb;
|
||||
dmaworkaround_cb_arg = arg;
|
||||
|
@ -374,7 +374,7 @@ bool IRAM_ATTR spicommon_dmaworkaround_reset_in_progress()
|
|||
void IRAM_ATTR spicommon_dmaworkaround_idle(int dmachan)
|
||||
{
|
||||
portENTER_CRITICAL(&dmaworkaround_mux);
|
||||
dmaworkaround_channels_busy[dmachan] = 0;
|
||||
dmaworkaround_channels_busy[dmachan-1] = 0;
|
||||
if (dmaworkaround_waiting_for_chan == dmachan) {
|
||||
//Reset DMA
|
||||
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)
|
||||
{
|
||||
portENTER_CRITICAL(&dmaworkaround_mux);
|
||||
dmaworkaround_channels_busy[dmachan] = 1;
|
||||
dmaworkaround_channels_busy[dmachan-1] = 1;
|
||||
portEXIT_CRITICAL(&dmaworkaround_mux);
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue