Merge branch 'feature/esp32h21_esp32h4_ledc_support' into 'master'

feat(ledc): Add LEDC support for ESP32H21 and ESP32H4

Closes IDF-12343, IDF-12344, IDF-12920, IDF-11568, IDF-11569, IDF-12115, and IDF-13672

See merge request espressif/esp-idf!41172
This commit is contained in:
Song Ruo Jing
2025-09-17 10:55:00 +08:00
93 changed files with 2836 additions and 671 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -9,14 +9,17 @@
#include <stdint.h>
#include "riscv/csr.h"
#ifdef __cplusplus
extern "C" {
#endif
/*fast gpio*/
#define CSR_GPIO_OEN_USER 0x803
#define CSR_GPIO_IN_USER 0x804
#define CSR_GPIO_OUT_USER 0x805
#ifdef __cplusplus
extern "C" {
#endif
/*!< The dedicated GPIO (a.k.a. fast GPIO) is featured by some customized CPU instructions, which is always enabled */
#define DEDIC_GPIO_CPU_LL_PERIPH_ALWAYS_ENABLE 1
__attribute__((always_inline))
static inline void dedic_gpio_cpu_ll_enable_output(uint32_t mask)

View File

@@ -73,6 +73,32 @@ static inline void ledc_ll_enable_clock(ledc_dev_t *hw, bool en)
PCR.ledc_sclk_conf.ledc_sclk_en = en;
}
/**
* @brief Enable the power for LEDC channel
*
* @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, low-speed mode only
* @param channel_num LEDC channel index (0-5), select from ledc_channel_t
* @param en True to enable, false to disable
*/
static inline void ledc_ll_enable_channel_power(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool en)
{
// No per channel power control on C5
}
/**
* @brief Enable the power for LEDC timer
*
* @param hw Beginning address of the peripheral registers
* @param speed_mode LEDC speed_mode, low-speed mode only
* @param timer_sel LEDC timer index (0-3), select from ledc_timer_t
* @param en True to enable, false to disable
*/
static inline void ledc_ll_enable_timer_power(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_timer_t timer_sel, bool en)
{
// No per timer power control on C5
}
/**
* @brief Set LEDC low speed timer clock
*