forked from espressif/esp-idf
add function to start spi transaction from isr
This commit is contained in:
@ -407,6 +407,9 @@ int spi_get_freq_limit(bool gpio_is_used, int input_delay_ns);
|
||||
*/
|
||||
esp_err_t spi_bus_get_max_transaction_len(spi_host_device_t host_id, size_t *max_bytes);
|
||||
|
||||
intr_handle_t spi_bus_get_intr(spi_host_device_t host);
|
||||
void spi_dma_reset_start(spi_device_handle_t handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -721,6 +721,22 @@ static void SPI_MASTER_ISR_ATTR spi_bus_intr_disable(void *host)
|
||||
#define spi_dma_start(chan, addr) gdma_start(chan, (intptr_t)(addr))
|
||||
#endif
|
||||
|
||||
void SPI_MASTER_ISR_ATTR spi_dma_reset_start(spi_device_handle_t handle){
|
||||
spi_host_t *host = handle->host;
|
||||
spi_hal_context_t *hal = &(host->hal);
|
||||
|
||||
const spi_dma_ctx_t *dma_ctx = host->dma_ctx;
|
||||
|
||||
spi_dma_reset(dma_ctx->rx_dma_chan);
|
||||
spi_hal_hw_prepare_rx(hal->hw);
|
||||
spi_dma_start(dma_ctx->rx_dma_chan, dma_ctx->dmadesc_rx);
|
||||
|
||||
|
||||
spi_dma_reset(dma_ctx->tx_dma_chan);
|
||||
spi_hal_hw_prepare_tx(hal->hw);
|
||||
spi_dma_start(dma_ctx->tx_dma_chan, dma_ctx->dmadesc_tx);
|
||||
}
|
||||
|
||||
static void SPI_MASTER_ISR_ATTR s_spi_dma_prepare_data(spi_host_t *host, spi_hal_context_t *hal, const spi_hal_dev_config_t *dev, const spi_hal_trans_config_t *trans)
|
||||
{
|
||||
const spi_dma_ctx_t *dma_ctx = host->dma_ctx;
|
||||
@ -1510,6 +1526,10 @@ esp_err_t spi_bus_get_max_transaction_len(spi_host_device_t host_id, size_t *max
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
intr_handle_t spi_bus_get_intr(spi_host_device_t host) {
|
||||
return bus_driver_ctx[host]->intr;
|
||||
}
|
||||
|
||||
#if SOC_SPI_SCT_SUPPORTED
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user