mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
b74cc4637b
fix(pm): trigger regdma retention by PMU when TOP is not power down on esp32H2 Closes PM-47 and PM-65 See merge request espressif/esp-idf!28046
44 lines
1.4 KiB
C
44 lines
1.4 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
// The HAL layer for PAU (ESP32-H2 specific part)
|
|
|
|
#include "soc/soc.h"
|
|
#include "soc/pcr_struct.h"
|
|
#include "esp_attr.h"
|
|
#include "hal/misc.h"
|
|
#include "hal/pau_hal.h"
|
|
#include "hal/pau_types.h"
|
|
|
|
void pau_hal_set_regdma_entry_link_addr(pau_hal_context_t *hal, pau_regdma_link_addr_t *link_addr)
|
|
{
|
|
pau_ll_set_regdma_link0_addr(hal->dev, (*link_addr)[0]);
|
|
}
|
|
|
|
void IRAM_ATTR pau_hal_start_regdma_system_link(pau_hal_context_t *hal, bool backup_or_restore)
|
|
{
|
|
pau_ll_clear_regdma_backup_done_intr_state(hal->dev);
|
|
|
|
pau_ll_select_regdma_entry_link(hal->dev, 0);
|
|
pau_ll_set_regdma_entry_link_backup_direction(hal->dev, backup_or_restore);
|
|
pau_ll_set_regdma_entry_link_backup_start_enable(hal->dev);
|
|
|
|
while (!(pau_ll_get_regdma_intr_raw_signal(hal->dev) & PAU_DONE_INT_RAW));
|
|
}
|
|
|
|
void IRAM_ATTR pau_hal_stop_regdma_system_link(pau_hal_context_t *hal)
|
|
{
|
|
pau_ll_set_regdma_entry_link_backup_start_disable(hal->dev);
|
|
pau_ll_select_regdma_entry_link(hal->dev, 0); /* restore link select to default */
|
|
pau_ll_clear_regdma_backup_done_intr_state(hal->dev);
|
|
}
|
|
|
|
void IRAM_ATTR pau_hal_regdma_clock_configure(pau_hal_context_t *hal, bool enable)
|
|
{
|
|
HAL_FORCE_MODIFY_U32_REG_FIELD(PCR.regdma_conf, regdma_rst_en, !enable);
|
|
HAL_FORCE_MODIFY_U32_REG_FIELD(PCR.regdma_conf, regdma_clk_en, enable);
|
|
}
|