mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-24 17:27:21 +00:00
feat(spi): Add helper function for alignment reqiured memory allocation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -167,6 +167,25 @@ esp_err_t spi_bus_initialize(spi_host_device_t host_id, const spi_bus_config_t *
|
||||
*/
|
||||
esp_err_t spi_bus_free(spi_host_device_t host_id);
|
||||
|
||||
/**
|
||||
* @brief Helper function for malloc DMA capable memory for SPI driver
|
||||
*
|
||||
* @note This API will take care of the cache and hardware alignment internally.
|
||||
* To free/release memory allocated by this helper function, simply calling `free()`
|
||||
*
|
||||
* @param[in] size Size in bytes, the amount of memory to allocate
|
||||
* @param[out] out_ptr Pointer to the memory if allocated successfully
|
||||
* @param[in] extra_heap_caps Extra heap caps based on MALLOC_CAP_DMA
|
||||
* @param[out] actual_size Optional, Actual size for allocation in bytes, when the size you specified doesn't meet the internal alignment requirements,
|
||||
* This value might be bigger than the size you specified. Set NULL if don't care this value.
|
||||
*
|
||||
* @return
|
||||
* - ESP_ERR_INVALID_ARG Invalid argument
|
||||
* - ESP_ERR_NO_MEM No enough memory for allocation
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
esp_err_t spi_bus_dma_memory_malloc(size_t size, void **out_ptr, uint32_t extra_heap_caps, size_t *actual_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user