Skip to content

Commit

Permalink
Merge branch 'fix/spi_hd_seg_fix_iwdt_timeout' into 'master'
Browse files Browse the repository at this point in the history
fix(spi_slave_hd): fix seg mode potential iwdt timeout when multi task call

Closes IDF-9671

See merge request espressif/esp-idf!30224
  • Loading branch information
wanckl committed May 31, 2024
2 parents c285c7a + 165394b commit 55d4de5
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions components/esp_driver_spi/src/gpspi/spi_slave_hd.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ typedef struct {
QueueHandle_t tx_ret_queue;
QueueHandle_t rx_trans_queue;
QueueHandle_t rx_ret_queue;
QueueHandle_t tx_cnting_sem;
QueueHandle_t rx_cnting_sem;
SemaphoreHandle_t tx_cnting_sem;
SemaphoreHandle_t rx_cnting_sem;

spi_slave_hd_trans_priv_t tx_curr_trans;
spi_slave_hd_trans_priv_t rx_curr_trans;
Expand Down Expand Up @@ -334,16 +334,14 @@ static IRAM_ATTR void s_spi_slave_hd_segment_isr(void *arg)
awoken |= intr_check_clear_callback(host, SPI_EV_CMD9, callback->cb_cmd9);
awoken |= intr_check_clear_callback(host, SPI_EV_CMDA, callback->cb_cmdA);

bool tx_done = false;
bool rx_done = false;
bool tx_done = false, rx_done = false;
bool tx_event = false, rx_event = false;

portENTER_CRITICAL_ISR(&host->int_spinlock);
if (host->tx_curr_trans.trans && spi_slave_hd_hal_check_disable_event(hal, SPI_EV_SEND)) {
tx_done = true;
}
if (host->rx_curr_trans.trans && spi_slave_hd_hal_check_disable_event(hal, SPI_EV_RECV)) {
rx_done = true;
}
tx_event = spi_slave_hd_hal_check_disable_event(hal, SPI_EV_SEND);
rx_event = spi_slave_hd_hal_check_disable_event(hal, SPI_EV_RECV);
tx_done = host->tx_curr_trans.trans && tx_event;
rx_done = host->rx_curr_trans.trans && rx_event;
portEXIT_CRITICAL_ISR(&host->int_spinlock);

if (tx_done) {
Expand Down

0 comments on commit 55d4de5

Please # to comment.