forked from espressif/esp-idf
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:
@@ -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);
|
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;
|
ctx->rx_eof_desc_addr = event_data->rx_eof_desc_addr;
|
||||||
return s_adc_dma_intr(user_data);
|
return s_adc_dma_intr(user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static IRAM_ATTR void adc_dma_intr_handler(void *arg)
|
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;
|
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(((uint32_t)data_buf % 4) == 0);
|
||||||
HAL_ASSERT((per_eof_size % 4) == 0);
|
HAL_ASSERT((per_eof_size % 4) == 0);
|
||||||
uint32_t n = 0;
|
uint32_t n = 0;
|
||||||
|
dma_descriptor_t *desc_head = desc;
|
||||||
|
|
||||||
while (eof_num--) {
|
while (eof_num--) {
|
||||||
uint32_t eof_size = per_eof_size;
|
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++;
|
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)
|
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
|
//Find the eof list start
|
||||||
eof_desc = eof_desc->next;
|
eof_desc = eof_desc->next;
|
||||||
|
eof_desc->dw0.owner = 1;
|
||||||
buffer_start = eof_desc->buffer;
|
buffer_start = eof_desc->buffer;
|
||||||
eof_len += eof_desc->dw0.length;
|
eof_len += eof_desc->dw0.length;
|
||||||
|
if ((intptr_t)eof_desc == eof_desc_addr) {
|
||||||
|
goto valid;
|
||||||
|
}
|
||||||
|
|
||||||
//Find the eof list end
|
//Find the eof list end
|
||||||
for (int i = 1; i < hal->eof_step; i++) {
|
for (int i = 1; i < hal->eof_step; i++) {
|
||||||
eof_desc = eof_desc->next;
|
eof_desc = eof_desc->next;
|
||||||
|
eof_desc->dw0.owner = 1;
|
||||||
eof_len += eof_desc->dw0.length;
|
eof_len += eof_desc->dw0.length;
|
||||||
|
if ((intptr_t)eof_desc == eof_desc_addr) {
|
||||||
|
goto valid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
valid:
|
||||||
hal->cur_desc_ptr = eof_desc;
|
hal->cur_desc_ptr = eof_desc;
|
||||||
*buffer = buffer_start;
|
*buffer = buffer_start;
|
||||||
*len = eof_len;
|
*len = eof_len;
|
||||||
|
Reference in New Issue
Block a user