feat(gdma): move gdma sleep retention info from esp_hal_dma to esp_driver_dma

This commit is contained in:
morris
2026-04-24 15:35:35 +08:00
parent 0aa8b1ce13
commit d318aeaafb
22 changed files with 1509 additions and 1447 deletions

View File

@@ -38,6 +38,16 @@
#include "esp_private/sleep_retention.h"
#include "esp_efuse.h"
#if CI_TEST_SW_RETENTION
#define GDMA_RETENTION_ENTRY REGDMA_SW_TRIGGER_ENTRY
#else
#if SOC_PHY_SUPPORTED
#define GDMA_RETENTION_ENTRY (ENTRY(0) | ENTRY(2))
#else
#define GDMA_RETENTION_ENTRY (ENTRY(0))
#endif
#endif
#if CONFIG_GDMA_OBJ_DRAM_SAFE
#define GDMA_MEM_ALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
#else
@@ -100,9 +110,20 @@ struct gdma_rx_channel_t {
gdma_rx_event_callbacks_t cbs; // RX event callbacks
};
#if SOC_GDMA_SUPPORT_SLEEP_RETENTION && SOC_PAU_SUPPORTED
typedef struct {
const regdma_entries_config_t *link_list;
uint32_t link_num;
const periph_retention_module_t module_id;
} gdma_retention_desc_t;
extern const gdma_retention_desc_t gdma_retention_infos[GDMA_LL_GET(INST_NUM)][GDMA_LL_GET(PAIRS_PER_INST)];
void gdma_acquire_sleep_retention(gdma_pair_t* pair);
void gdma_release_sleep_retention(gdma_pair_t* pair);
#endif // SOC_GDMA_SUPPORT_SLEEP_RETENTION && SOC_PAU_SUPPORTED
#ifdef __cplusplus
}
#endif

View File

@@ -19,9 +19,9 @@ static esp_err_t sleep_gdma_channel_retention_init(void *arg)
int group_id = pair->group->group_id;
int pair_id = pair->pair_id;
sleep_retention_module_t module = gdma_chx_regs_retention[group_id][pair_id].module_id;
esp_err_t err = sleep_retention_entries_create(gdma_chx_regs_retention[group_id][pair_id].link_list,
gdma_chx_regs_retention[group_id][pair_id].link_num,
sleep_retention_module_t module = gdma_retention_infos[group_id][pair_id].module_id;
esp_err_t err = sleep_retention_entries_create(gdma_retention_infos[group_id][pair_id].link_list,
gdma_retention_infos[group_id][pair_id].link_num,
REGDMA_LINK_PRI_GDMA, module);
if (err == ESP_OK) {
ESP_LOGD(TAG, "retention link created for pair (%d, %d)", group_id, pair_id);
@@ -39,7 +39,7 @@ void gdma_acquire_sleep_retention(gdma_pair_t* pair)
.cbs = { .create = { .handle = sleep_gdma_channel_retention_init, .arg = pair } },
.depends = RETENTION_MODULE_BITMAP_INIT(CLOCK_SYSTEM)
};
sleep_retention_module_t module = gdma_chx_regs_retention[group_id][pair_id].module_id;
sleep_retention_module_t module = gdma_retention_infos[group_id][pair_id].module_id;
_lock_acquire(&gdma_sleep_retention_lock);
// First time acquiring this pair, initialize the module
@@ -63,7 +63,7 @@ void gdma_release_sleep_retention(gdma_pair_t* pair)
{
int group_id = pair->group->group_id;
int pair_id = pair->pair_id;
sleep_retention_module_t module = gdma_chx_regs_retention[group_id][pair_id].module_id;
sleep_retention_module_t module = gdma_retention_infos[group_id][pair_id].module_id;
_lock_acquire(&gdma_sleep_retention_lock);
pair_ref_counts[group_id][pair_id]--;