spi_master: added a device flag "SPI_DEVICE_NO_RETURN_RESULT"

Add this flag to select if returning done transaction descriptors from ISR.
You should get the finished transaction descriptor by the callback "post_cb"
if you using this flag, if not, same as the past.

Close https://github.com/espressif/esp-idf/pull/9141
This commit is contained in:
meawoppl 2022-06-12 13:10:42 -07:00 committed by wanlei
parent 45ad46eb27
commit 677a0c438d
2 changed files with 7 additions and 3 deletions

View File

@ -43,7 +43,7 @@ extern "C"
*/
#define SPI_DEVICE_NO_DUMMY (1<<6)
#define SPI_DEVICE_DDRCLK (1<<7)
#define SPI_DEVICE_NO_RETURN_RESULT (1<<8) ///< Don't return the descriptor to the host on completion (use post_cb to notify instead)
typedef struct spi_transaction_t spi_transaction_t;
typedef void(*transaction_cb_t)(spi_transaction_t *trans);

View File

@ -612,9 +612,13 @@ static void SPI_MASTER_ISR_ATTR spi_intr(void *arg)
//cur_cs is changed to DEV_NUM_MAX here
spi_post_trans(host);
if (!(host->device[cs]->cfg.flags & SPI_DEVICE_NO_RETURN_RESULT)) {
//Return transaction descriptor.
xQueueSendFromISR(host->device[cs]->ret_queue, &host->cur_trans_buf, &do_yield);
}
// spi_bus_lock_bg_pause(bus_attr->lock);
//Return transaction descriptor.
xQueueSendFromISR(host->device[cs]->ret_queue, &host->cur_trans_buf, &do_yield);
#ifdef CONFIG_PM_ENABLE
//Release APB frequency lock
esp_pm_lock_release(bus_attr->pm_lock);