3737#include "adc_continuous_internal.h"
3838#include "esp_private/adc_dma.h"
3939#include "adc_dma_internal.h"
40- #include "esp_dma_utils.h"
4140#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
4241#include "esp_cache.h"
4342#include "esp_private/esp_cache_private.h"
@@ -192,11 +191,7 @@ esp_err_t adc_continuous_new_handle(const adc_continuous_handle_cfg_t *hdl_confi
192191 }
193192
194193 //malloc internal buffer used by DMA
195- esp_dma_mem_info_t dma_mem_info = {
196- .extra_heap_caps = (MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA ),
197- .dma_alignment_bytes = 4 ,
198- };
199- esp_dma_capable_calloc (1 , hdl_config -> conv_frame_size * INTERNAL_BUF_NUM , & dma_mem_info , (void * * )& adc_ctx -> rx_dma_buf , NULL );
194+ adc_ctx -> rx_dma_buf = heap_caps_calloc (INTERNAL_BUF_NUM , hdl_config -> conv_frame_size , MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA | MALLOC_CAP_8BIT );
200195 if (!adc_ctx -> rx_dma_buf ) {
201196 ret = ESP_ERR_NO_MEM ;
202197 goto cleanup ;
@@ -205,7 +200,7 @@ esp_err_t adc_continuous_new_handle(const adc_continuous_handle_cfg_t *hdl_confi
205200 //malloc dma descriptor
206201 uint32_t dma_desc_num_per_frame = (hdl_config -> conv_frame_size + DMA_DESCRIPTOR_BUFFER_MAX_SIZE_4B_ALIGNED - 1 ) / DMA_DESCRIPTOR_BUFFER_MAX_SIZE_4B_ALIGNED ;
207202 uint32_t dma_desc_max_num = dma_desc_num_per_frame * INTERNAL_BUF_NUM ;
208- esp_dma_capable_calloc ( 1 , ( sizeof (dma_descriptor_t )) * dma_desc_max_num , & dma_mem_info , ( void * * ) & adc_ctx -> hal . rx_desc , & adc_ctx -> adc_desc_size );
203+ adc_ctx -> hal . rx_desc = heap_caps_aligned_calloc ( ADC_DMA_DESC_ALIGN , dma_desc_max_num , sizeof (dma_descriptor_t ), MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA | MALLOC_CAP_8BIT );
209204 if (!adc_ctx -> hal .rx_desc ) {
210205 ret = ESP_ERR_NO_MEM ;
211206 goto cleanup ;
@@ -550,12 +545,12 @@ esp_err_t adc_continuous_flush_pool(adc_continuous_handle_t handle)
550545 return ESP_OK ;
551546}
552547
553- esp_err_t adc_continuous_io_to_channel (int io_num , adc_unit_t * const unit_id , adc_channel_t * const channel )
548+ esp_err_t adc_continuous_io_to_channel (int io_num , adc_unit_t * const unit_id , adc_channel_t * const channel )
554549{
555550 return adc_io_to_channel (io_num , unit_id , channel );
556551}
557552
558- esp_err_t adc_continuous_channel_to_io (adc_unit_t unit_id , adc_channel_t channel , int * const io_num )
553+ esp_err_t adc_continuous_channel_to_io (adc_unit_t unit_id , adc_channel_t channel , int * const io_num )
559554{
560555 return adc_channel_to_io (unit_id , channel , io_num );
561556}
0 commit comments