fix(esp_hw_support): use iterator for regdma_link_stats to save stack consume

Closes https://github.com/espressif/esp-idf/issues/13288
This commit is contained in:
Li Shuai 2024-05-11 19:29:25 +08:00 committed by wuzhenghui
parent 58a9d0e27b
commit f5f020f6e7
No known key found for this signature in database
GPG Key ID: 3EFEDECDEBA39BB9

View File

@ -445,9 +445,22 @@ static void regdma_link_update_stats_wrapper(void *link, int entry, int depth)
regdma_link_update_stats(regdma_link_get_stats(link), entry, depth);
}
static void regdma_link_iterator(void *link, int entry, void (*hook)(void *, int, int))
{
assert(entry < REGDMA_LINK_ENTRY_NUM);
int iter = 0;
while (link) {
if (hook) {
(*hook)(link, entry, iter++);
}
link = regdma_link_get_next(link, entry);
}
}
void regdma_link_stats(void *link, int entry)
{
regdma_link_recursive_impl(link, entry, 0, regdma_link_update_stats_wrapper);
regdma_link_iterator(link, entry, regdma_link_update_stats_wrapper);
}
static void regdma_link_destroy_wrapper(void *link, int entry, int depth)