11/*
2- * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+ * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
33 *
44 * SPDX-License-Identifier: Apache-2.0
55 */
1414#include "soc/pau_reg.h"
1515#include "soc/pau_struct.h"
1616#include "soc/pcr_struct.h"
17+ #include "soc/lp_aon_struct.h"
1718#include "hal/pau_types.h"
1819#include "hal/assert.h"
20+ #include "hal/misc.h"
1921
2022#ifdef __cplusplus
2123extern "C" {
@@ -47,14 +49,9 @@ static inline void pau_ll_set_regdma_entry_link_backup_direction(pau_dev_t *dev,
4749 dev -> regdma_conf .to_mem = to_mem ? 1 : 0 ;
4850}
4951
50- static inline void pau_ll_set_regdma_entry_link_backup_start_enable (pau_dev_t * dev )
52+ static inline void pau_ll_set_regdma_entry_link_backup_start_enable (pau_dev_t * dev , bool enable )
5153{
52- dev -> regdma_conf .start = 1 ;
53- }
54-
55- static inline void pau_ll_set_regdma_entry_link_backup_start_disable (pau_dev_t * dev )
56- {
57- dev -> regdma_conf .start = 0 ;
54+ dev -> regdma_conf .start = enable ;
5855}
5956
6057static inline void pau_ll_set_regdma_select_wifimac_link (pau_dev_t * dev )
@@ -107,14 +104,9 @@ static inline uint32_t pau_ll_get_regdma_intr_status(pau_dev_t *dev)
107104 return dev -> int_st .val ;
108105}
109106
110- static inline void pau_ll_set_regdma_backup_done_intr_enable (pau_dev_t * dev )
111- {
112- dev -> int_ena .done_int_ena = 1 ;
113- }
114-
115- static inline void pau_ll_set_regdma_backup_done_intr_disable (pau_dev_t * dev )
107+ static inline void pau_ll_set_regdma_backup_done_intr_enable (pau_dev_t * dev , bool enable )
116108{
117- dev -> int_ena .done_int_ena = 0 ;
109+ dev -> int_ena .done_int_ena = enable ;
118110}
119111
120112static inline void pau_ll_set_regdma_backup_error_intr_enable (pau_dev_t * dev )
@@ -129,12 +121,61 @@ static inline void pau_ll_set_regdma_backup_error_intr_disable(pau_dev_t *dev)
129121
130122static inline void pau_ll_clear_regdma_backup_done_intr_state (pau_dev_t * dev )
131123{
132- dev -> int_clr .done_int_clr = 1 ;
124+ dev -> int_clr .val = 0x1 ;
133125}
134126
135127static inline void pau_ll_clear_regdma_backup_error_intr_state (pau_dev_t * dev )
136128{
137- dev -> int_clr .error_int_clr = 1 ;
129+ dev -> int_clr .val = 0x2 ;
130+ }
131+
132+
133+ /**
134+ * @brief Set the maximum number of linked lists supported by REGDMA
135+ * @param count: the maximum number of regdma link
136+ */
137+ static inline void pau_ll_set_regdma_link_count (int count )
138+ {
139+ HAL_FORCE_MODIFY_U32_REG_FIELD (LP_AON .backup_dma_cfg0 , branch_link_length_aon , count );
140+ }
141+
142+ /**
143+ * @brief Set the maximum number of times a single linked list can run for REGDMA. If a linked list continuously reads in a loop
144+ * for some reason and the execution count exceeds this configured number, a timeout will be triggered.
145+ * @param count: the maximum number of loop
146+ */
147+ static inline void pau_ll_set_regdma_link_loop_threshold (int count )
148+ {
149+ HAL_FORCE_MODIFY_U32_REG_FIELD (LP_AON .backup_dma_cfg1 , link_work_tout_thres_aon , count );
150+ }
151+
152+ /**
153+ * @brief Set the timeout duration for accessing registers. If REGDMA encounters bus-related issues while accessing
154+ * registers and gets stuck on the bus, a timeout will be triggered.
155+ * @param count: the maximum number of time
156+ */
157+ static inline void pau_ll_set_regdma_link_reg_access_tout_threshold (int count )
158+ {
159+ HAL_FORCE_MODIFY_U32_REG_FIELD (LP_AON .backup_dma_cfg1 , link_backup_tout_thres_aon , count );
160+ }
161+
162+ /**
163+ * @brief Set the regdma_link_addr
164+ * @param addr: the addr of regdma_link
165+ */
166+ static inline void pau_ll_set_regdma_link_addr (uint32_t addr )
167+ {
168+ HAL_FORCE_MODIFY_U32_REG_FIELD (LP_AON .backup_dma_cfg2 , link_addr_aon , addr );
169+ }
170+
171+ static inline void pau_ll_set_regdma_link_wait_retry_count (int count )
172+ {
173+ HAL_FORCE_MODIFY_U32_REG_FIELD (LP_AON .backup_dma_cfg1 , link_wait_tout_thres_aon , count );
174+ }
175+
176+ static inline void pau_ll_set_regdma_link_wait_read_interval (int interval )
177+ {
178+ HAL_FORCE_MODIFY_U32_REG_FIELD (LP_AON .backup_dma_cfg0 , read_interval_aon , interval );
138179}
139180
140181#ifdef __cplusplus
0 commit comments