mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
refactor(driver_spi): use more info in spi_common
This commit is contained in:
@@ -106,19 +106,18 @@ esp_err_t spicommon_bus_free(spi_host_device_t host_id);
|
||||
*
|
||||
* @param host_id SPI host ID
|
||||
* @param dma_chan DMA channel to be used
|
||||
* @param out_dma_ctx Actual DMA channel context (if you choose to assign a specific DMA channel, this will be the channel you assigned before)
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: On success
|
||||
* - ESP_ERR_NO_MEM: No enough memory
|
||||
* - ESP_ERR_NOT_FOUND: There is no available DMA channel
|
||||
*/
|
||||
esp_err_t spicommon_dma_chan_alloc(spi_host_device_t host_id, spi_dma_chan_t dma_chan, spi_dma_ctx_t **out_dma_ctx);
|
||||
esp_err_t spicommon_dma_chan_alloc(spi_host_device_t host_id, spi_dma_chan_t dma_chan);
|
||||
|
||||
/**
|
||||
* @brief Alloc DMA descriptors for SPI
|
||||
*
|
||||
* @param dma_ctx DMA context returned by `spicommon_dma_chan_alloc`
|
||||
* @param[in] host_id SPI host ID
|
||||
* @param[in] cfg_max_sz Expected maximum transfer size, in bytes.
|
||||
* @param[out] actual_max_sz Actual max transfer size one transaction can be, in bytes.
|
||||
*
|
||||
@@ -126,7 +125,7 @@ esp_err_t spicommon_dma_chan_alloc(spi_host_device_t host_id, spi_dma_chan_t dma
|
||||
* - ESP_OK: On success
|
||||
* - ESP_ERR_NO_MEM: No enough memory
|
||||
*/
|
||||
esp_err_t spicommon_dma_desc_alloc(spi_dma_ctx_t *dma_ctx, int cfg_max_sz, int *actual_max_sz);
|
||||
esp_err_t spicommon_dma_desc_alloc(spi_host_device_t host_id, int cfg_max_sz, int *actual_max_sz);
|
||||
|
||||
/**
|
||||
* Setupt/Configure dma descriptor link list
|
||||
@@ -141,12 +140,12 @@ void spicommon_dma_desc_setup_link(spi_dma_desc_t *dmadesc, const void *data, in
|
||||
/**
|
||||
* @brief Free DMA for SPI
|
||||
*
|
||||
* @param dma_ctx spi_dma_ctx_t struct pointer
|
||||
* @param host_id SPI host ID
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: On success
|
||||
*/
|
||||
esp_err_t spicommon_dma_chan_free(spi_dma_ctx_t *dma_ctx);
|
||||
esp_err_t spicommon_dma_chan_free(spi_host_device_t host_id);
|
||||
|
||||
/**
|
||||
* @brief Connect a SPI peripheral to GPIO pins
|
||||
@@ -182,7 +181,7 @@ esp_err_t spicommon_dma_chan_free(spi_dma_ctx_t *dma_ctx);
|
||||
* - ESP_ERR_INVALID_ARG if parameter is invalid
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
esp_err_t spicommon_bus_initialize_io(spi_host_device_t host, const spi_bus_config_t *bus_config, uint32_t flags, uint32_t *flags_o, uint64_t *io_reserved);
|
||||
esp_err_t spicommon_bus_initialize_io(spi_host_device_t host, const spi_bus_config_t *bus_config, uint32_t flags, uint32_t *flags_o);
|
||||
|
||||
/**
|
||||
* @brief Free the IO used by a SPI peripheral
|
||||
@@ -295,7 +294,7 @@ void spicommon_dmaworkaround_transfer_active(int dmachan);
|
||||
* @param host_id The specified host to get attribute
|
||||
* @return (Const) Pointer to the attributes
|
||||
*/
|
||||
const spi_bus_attr_t* spi_bus_get_attr(spi_host_device_t host_id);
|
||||
spi_bus_attr_t* spi_bus_get_attr(spi_host_device_t host_id);
|
||||
|
||||
/**
|
||||
* @brief Get the dma context of a specified SPI bus.
|
||||
@@ -303,7 +302,7 @@ const spi_bus_attr_t* spi_bus_get_attr(spi_host_device_t host_id);
|
||||
* @param host_id The specified host to get attribute
|
||||
* @return (Const) Pointer to the dma context
|
||||
*/
|
||||
const spi_dma_ctx_t* spi_bus_get_dma_ctx(spi_host_device_t host_id);
|
||||
spi_dma_ctx_t* spi_bus_get_dma_ctx(spi_host_device_t host_id);
|
||||
|
||||
/**
|
||||
* @brief Register a function to a initialized bus to make it called when deinitializing the bus.
|
||||
|
||||
Reference in New Issue
Block a user