mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/use_circular_dma_desc_link_in_adc_continuous_mode' into 'master'
adc: pr 11500, use circular dma descriptors in adc continuous mode Closes IDFGH-10235 See merge request espressif/esp-idf!24048
This commit is contained in:
commit
cd7ef82ab2
@ -386,11 +386,6 @@ static IRAM_ATTR bool s_adc_dma_intr(adc_digi_context_t *adc_digi_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
if (status == ADC_HAL_DMA_DESC_NULL) {
|
||||
//start next turns of dma operation
|
||||
adc_hal_digi_start(&adc_digi_ctx->hal, adc_digi_ctx->rx_dma_buf);
|
||||
}
|
||||
|
||||
return (taskAwoken == pdTRUE);
|
||||
}
|
||||
|
||||
|
@ -263,6 +263,7 @@ static IRAM_ATTR bool adc_dma_in_suc_eof_callback(gdma_channel_handle_t dma_chan
|
||||
ctx->rx_eof_desc_addr = event_data->rx_eof_desc_addr;
|
||||
return s_adc_dma_intr(user_data);
|
||||
}
|
||||
|
||||
#else
|
||||
static IRAM_ATTR void adc_dma_intr_handler(void *arg)
|
||||
{
|
||||
@ -342,11 +343,6 @@ static IRAM_ATTR bool s_adc_dma_intr(adc_continuous_ctx_t *adc_digi_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
if (status == ADC_HAL_DMA_DESC_NULL) {
|
||||
//start next turns of dma operation
|
||||
adc_hal_digi_start(&adc_digi_ctx->hal, adc_digi_ctx->rx_dma_buf);
|
||||
}
|
||||
|
||||
return need_yield;
|
||||
}
|
||||
|
||||
|
@ -234,6 +234,7 @@ static void adc_hal_digi_dma_link_descriptors(dma_descriptor_t *desc, uint8_t *d
|
||||
HAL_ASSERT(((uint32_t)data_buf % 4) == 0);
|
||||
HAL_ASSERT((per_eof_size % 4) == 0);
|
||||
uint32_t n = 0;
|
||||
dma_descriptor_t *desc_head = desc;
|
||||
|
||||
while (eof_num--) {
|
||||
uint32_t eof_size = per_eof_size;
|
||||
@ -257,7 +258,7 @@ static void adc_hal_digi_dma_link_descriptors(dma_descriptor_t *desc, uint8_t *d
|
||||
n++;
|
||||
}
|
||||
}
|
||||
desc[n-1].next = NULL;
|
||||
desc[n-1].next = desc_head;
|
||||
}
|
||||
|
||||
void adc_hal_digi_start(adc_hal_dma_ctx_t *hal, uint8_t *data_buf)
|
||||
@ -312,15 +313,24 @@ adc_hal_dma_desc_status_t adc_hal_get_reading_result(adc_hal_dma_ctx_t *hal, con
|
||||
|
||||
//Find the eof list start
|
||||
eof_desc = eof_desc->next;
|
||||
eof_desc->dw0.owner = 1;
|
||||
buffer_start = eof_desc->buffer;
|
||||
eof_len += eof_desc->dw0.length;
|
||||
if ((intptr_t)eof_desc == eof_desc_addr) {
|
||||
goto valid;
|
||||
}
|
||||
|
||||
//Find the eof list end
|
||||
for (int i = 1; i < hal->eof_step; i++) {
|
||||
eof_desc = eof_desc->next;
|
||||
eof_desc->dw0.owner = 1;
|
||||
eof_len += eof_desc->dw0.length;
|
||||
if ((intptr_t)eof_desc == eof_desc_addr) {
|
||||
goto valid;
|
||||
}
|
||||
}
|
||||
|
||||
valid:
|
||||
hal->cur_desc_ptr = eof_desc;
|
||||
*buffer = buffer_start;
|
||||
*len = eof_len;
|
||||
|
Loading…
Reference in New Issue
Block a user