mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'bugfix/spi_concurrency_3.3' into 'release/v3.3'
spi: fix a possible concurrency issue (port to v3.3) See merge request idf/esp-idf!5279
This commit is contained in:
@ -467,12 +467,14 @@ static void SPI_SLAVE_ISR_ATTR spi_intr(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Disable interrupt before checking to avoid concurrency issue.
|
||||||
|
esp_intr_disable(host->intr);
|
||||||
//Grab next transaction
|
//Grab next transaction
|
||||||
r = xQueueReceiveFromISR(host->trans_queue, &trans, &do_yield);
|
r = xQueueReceiveFromISR(host->trans_queue, &trans, &do_yield);
|
||||||
if (!r) {
|
if (r) {
|
||||||
//No packet waiting. Disable interrupt.
|
//enable the interrupt again if there is packet to send
|
||||||
esp_intr_disable(host->intr);
|
esp_intr_enable(host->intr);
|
||||||
} else {
|
|
||||||
//We have a transaction. Send it.
|
//We have a transaction. Send it.
|
||||||
host->hw->slave.trans_done = 0; //clear int bit
|
host->hw->slave.trans_done = 0; //clear int bit
|
||||||
host->cur_trans = trans;
|
host->cur_trans = trans;
|
||||||
|
Reference in New Issue
Block a user