mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
refactor(dac): improve the DAC driver
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -117,6 +117,19 @@ esp_err_t gdma_link_mount_buffers(gdma_link_list_handle_t list, int start_item_i
|
||||
*/
|
||||
uintptr_t gdma_link_get_head_addr(gdma_link_list_handle_t list);
|
||||
|
||||
/**
|
||||
* @brief Get the address of a specific link list item by index
|
||||
* @note The returned address is the cached address used by the DMA hardware (same convention as `gdma_link_get_head_addr`).
|
||||
* It can be passed directly to the DMA start function to resume transmission from a specific descriptor.
|
||||
*
|
||||
* @param[in] list Link list handle, allocated by `gdma_new_link_list`
|
||||
* @param[in] item_index Index of the link list item (wraps around if out of range)
|
||||
* @return
|
||||
* - Address of the specified item
|
||||
* - 0: Invalid handle
|
||||
*/
|
||||
uintptr_t gdma_link_get_item_addr(gdma_link_list_handle_t list, int item_index);
|
||||
|
||||
/**
|
||||
* @brief Concatenate two link lists as follows:
|
||||
*
|
||||
|
||||
@@ -281,6 +281,16 @@ uintptr_t gdma_link_get_head_addr(gdma_link_list_handle_t list)
|
||||
return (uintptr_t)(list->items);
|
||||
}
|
||||
|
||||
uintptr_t gdma_link_get_item_addr(gdma_link_list_handle_t list, int item_index)
|
||||
{
|
||||
if (!list) {
|
||||
return 0;
|
||||
}
|
||||
int num_items = list->num_items;
|
||||
item_index = (item_index % num_items + num_items) % num_items;
|
||||
return (uintptr_t)(list->items + item_index * list->item_size);
|
||||
}
|
||||
|
||||
esp_err_t gdma_link_concat(gdma_link_list_handle_t first_link, int first_link_item_index, gdma_link_list_handle_t second_link, int second_link_item_index)
|
||||
{
|
||||
if (!first_link) {
|
||||
|
||||
Reference in New Issue
Block a user