From de68029de961ed39be159e5f4a469bc94f03aa02 Mon Sep 17 00:00:00 2001 From: Armando Date: Fri, 28 Jul 2023 12:06:14 +0800 Subject: [PATCH 1/3] change(header): modify p4 headers issues from check_header_py --- .../driver/deprecated/adc_i2s_deprecated.c | 3 +-- components/driver/deprecated/adc_legacy.c | 4 ++-- .../deprecated/driver/adc_types_legacy.h | 2 +- .../deprecated/driver/timer_types_legacy.h | 9 +++++++- components/esp_adc/adc_filter.c | 1 + components/esp_adc/esp32p4/include/.gitkeep | 0 .../esp32p4/include/adc_cali_schemes.h | 15 +++++++++++++ components/esp_hw_support/adc_share_hw_ctrl.c | 2 +- .../esp_hw_support/port/esp32p4/systimer.c | 22 +++++++++++++++++++ .../hal/esp32p4/include/hal/clk_gate_ll.h | 4 ++-- .../hal/esp32p4/include/hal/regi2c_ctrl_ll.h | 1 + .../hal/esp32p4/include/hal/spimem_flash_ll.h | 1 + components/hal/esp32p4/include/hal/uart_ll.h | 4 ++-- components/hal/include/hal/adc_hal.h | 7 +++--- components/hal/include/hal/adc_types.h | 3 +++ components/hal/include/hal/aes_hal.h | 3 +++ components/hal/include/hal/i2c_hal.h | 11 ++++++++-- components/hal/include/hal/i2c_types.h | 7 +++++- components/hal/include/hal/ledc_hal.h | 12 +++++++--- components/hal/include/hal/rtc_hal.h | 3 +++ components/hal/include/hal/spi_hal.h | 14 ++++++++---- components/hal/include/hal/spi_slave_hal.h | 14 ++++++++---- components/hal/include/hal/spi_slave_hd_hal.h | 13 ++++++++--- components/hal/include/hal/timer_types.h | 10 ++++++++- .../soc/esp32p4/include/soc/clk_tree_defs.h | 18 +++++++++++++++ .../include/soc/hp_sys_clkrst_struct.h | 4 ++-- .../soc/esp32p4/ld/esp32p4.peripherals.ld | 1 + .../env_caps/esp32p4/Kconfig.env_caps | 15 +++++++++++++ 28 files changed, 169 insertions(+), 34 deletions(-) delete mode 100644 components/esp_adc/esp32p4/include/.gitkeep create mode 100644 components/esp_adc/esp32p4/include/adc_cali_schemes.h create mode 100644 components/esp_hw_support/port/esp32p4/systimer.c create mode 100644 examples/common_components/env_caps/esp32p4/Kconfig.env_caps diff --git a/components/driver/deprecated/adc_i2s_deprecated.c b/components/driver/deprecated/adc_i2s_deprecated.c index 0e7a6f84d5..2971e47609 100644 --- a/components/driver/deprecated/adc_i2s_deprecated.c +++ b/components/driver/deprecated/adc_i2s_deprecated.c @@ -13,7 +13,6 @@ #include "esp_log.h" #include "esp_intr_alloc.h" #include "driver/rtc_io.h" -#include "hal/adc_hal.h" #include "hal/adc_ll.h" #include "hal/adc_types.h" #ifdef CONFIG_PM_ENABLE @@ -237,7 +236,7 @@ esp_err_t adc_i2s_mode_init(adc_unit_t adc_unit, adc_channel_t channel) adc_ll_digi_set_fsm_time(ADC_LL_FSM_RSTB_WAIT_DEFAULT, ADC_LL_FSM_START_WAIT_DEFAULT, ADC_LL_FSM_STANDBY_WAIT_DEFAULT); adc_ll_set_sample_cycle(ADC_LL_SAMPLE_CYCLE_DEFAULT); - adc_hal_pwdet_set_cct(ADC_LL_PWDET_CCT_DEFAULT); + adc_ll_pwdet_set_cct(ADC_LL_PWDET_CCT_DEFAULT); adc_ll_digi_output_invert(ADC_UNIT_1, ADC_LL_DIGI_DATA_INVERT_DEFAULT(ADC_UNIT_1)); adc_ll_digi_output_invert(ADC_UNIT_2, ADC_LL_DIGI_DATA_INVERT_DEFAULT(ADC_UNIT_2)); adc_ll_digi_set_clk_div(ADC_LL_DIGI_SAR_CLK_DIV_DEFAULT); diff --git a/components/driver/deprecated/adc_legacy.c b/components/driver/deprecated/adc_legacy.c index 9b5c4d7f00..d23a3be844 100644 --- a/components/driver/deprecated/adc_legacy.c +++ b/components/driver/deprecated/adc_legacy.c @@ -23,7 +23,7 @@ #include "esp_private/sar_periph_ctrl.h" #include "adc1_private.h" #include "hal/adc_types.h" -#include "hal/adc_hal.h" +#include "hal/adc_ll.h" #include "hal/adc_hal_common.h" #include "esp_private/periph_ctrl.h" #include "driver/adc_types_legacy.h" @@ -164,7 +164,7 @@ static void adc_rtc_chan_init(adc_unit_t adc_unit) #endif } if (adc_unit == ADC_UNIT_2) { - adc_hal_pwdet_set_cct(ADC_LL_PWDET_CCT_DEFAULT); + adc_ll_pwdet_set_cct(ADC_LL_PWDET_CCT_DEFAULT); adc_oneshot_ll_output_invert(ADC_UNIT_2, ADC_LL_DATA_INVERT_DEFAULT(ADC_UNIT_2)); adc_ll_set_sar_clk_div(ADC_UNIT_2, ADC_LL_SAR_CLK_DIV_DEFAULT(ADC_UNIT_2)); } diff --git a/components/driver/deprecated/driver/adc_types_legacy.h b/components/driver/deprecated/driver/adc_types_legacy.h index 1f36f22594..e8cecf04bd 100644 --- a/components/driver/deprecated/driver/adc_types_legacy.h +++ b/components/driver/deprecated/driver/adc_types_legacy.h @@ -70,7 +70,7 @@ typedef enum { ADC1_CHANNEL_4, /*!< ADC1 channel 4 is GPIO4 */ ADC1_CHANNEL_MAX, } adc1_channel_t; -#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 +#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32P4 typedef enum { ADC1_CHANNEL_0 = 0, /*!< ADC1 channel 0 is GPIO0 */ ADC1_CHANNEL_1, /*!< ADC1 channel 1 is GPIO1 */ diff --git a/components/driver/deprecated/driver/timer_types_legacy.h b/components/driver/deprecated/driver/timer_types_legacy.h index 16eaaf2061..09916af59f 100644 --- a/components/driver/deprecated/driver/timer_types_legacy.h +++ b/components/driver/deprecated/driver/timer_types_legacy.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2010-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -96,10 +96,17 @@ typedef enum { TIMER_AUTORELOAD_MAX, } timer_autoreload_t; +#if SOC_GPTIMER_SUPPORTED /** * @brief Timer group clock source */ typedef soc_periph_tg_clk_src_legacy_t timer_src_clk_t; +#else +/** + * @brief Default type + */ +typedef int timer_src_clk_t; +#endif /** * @brief Interrupt handler callback function diff --git a/components/esp_adc/adc_filter.c b/components/esp_adc/adc_filter.c index fdb413b877..672b5acd5a 100644 --- a/components/esp_adc/adc_filter.c +++ b/components/esp_adc/adc_filter.c @@ -13,6 +13,7 @@ #include "freertos/FreeRTOS.h" #include "hal/adc_types.h" #include "hal/adc_hal.h" +#include "hal/adc_ll.h" #include "adc_continuous_internal.h" #include "esp_adc/adc_filter.h" diff --git a/components/esp_adc/esp32p4/include/.gitkeep b/components/esp_adc/esp32p4/include/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/components/esp_adc/esp32p4/include/adc_cali_schemes.h b/components/esp_adc/esp32p4/include/adc_cali_schemes.h new file mode 100644 index 0000000000..16dc6be4f1 --- /dev/null +++ b/components/esp_adc/esp32p4/include/adc_cali_schemes.h @@ -0,0 +1,15 @@ +/* + * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +/** + * @file adc_cali_schemes.h + * + * @brief Supported calibration schemes + */ + +//Now no scheme supported diff --git a/components/esp_hw_support/adc_share_hw_ctrl.c b/components/esp_hw_support/adc_share_hw_ctrl.c index 57325e8aad..f9b8167258 100644 --- a/components/esp_hw_support/adc_share_hw_ctrl.c +++ b/components/esp_hw_support/adc_share_hw_ctrl.c @@ -24,8 +24,8 @@ #include "esp_check.h" #include "freertos/FreeRTOS.h" #include "hal/adc_types.h" -#include "hal/adc_hal.h" #include "hal/adc_hal_common.h" +#include "hal/adc_ll.h" #include "esp_private/adc_share_hw_ctrl.h" #include "esp_private/sar_periph_ctrl.h" //For calibration diff --git a/components/esp_hw_support/port/esp32p4/systimer.c b/components/esp_hw_support/port/esp32p4/systimer.c new file mode 100644 index 0000000000..65844875f0 --- /dev/null +++ b/components/esp_hw_support/port/esp32p4/systimer.c @@ -0,0 +1,22 @@ +/* + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "esp_private/systimer.h" + +/** + * @brief systimer's clock source is fixed to XTAL (40MHz), and has a fixed fractional divider (2.5). + * So the resolution of the systimer is 40MHz/2.5 = 16MHz. + */ + +uint64_t systimer_ticks_to_us(uint64_t ticks) +{ + return ticks / 16; +} + +uint64_t systimer_us_to_ticks(uint64_t us) +{ + return us * 16; +} diff --git a/components/hal/esp32p4/include/hal/clk_gate_ll.h b/components/hal/esp32p4/include/hal/clk_gate_ll.h index 92c72ebebc..3edb60f12f 100644 --- a/components/hal/esp32p4/include/hal/clk_gate_ll.h +++ b/components/hal/esp32p4/include/hal/clk_gate_ll.h @@ -225,7 +225,7 @@ static inline uint32_t periph_ll_get_rst_en_mask(periph_module_t periph, bool en } } -static uint32_t periph_ll_get_clk_en_reg(periph_module_t periph) +static inline uint32_t periph_ll_get_clk_en_reg(periph_module_t periph) { switch (periph) { case PERIPH_AHB_PDMA_MODULE: @@ -293,7 +293,7 @@ static uint32_t periph_ll_get_clk_en_reg(periph_module_t periph) } } -static uint32_t periph_ll_get_rst_en_reg(periph_module_t periph) +static inline uint32_t periph_ll_get_rst_en_reg(periph_module_t periph) { switch (periph) { case PERIPH_PVT_MODULE: diff --git a/components/hal/esp32p4/include/hal/regi2c_ctrl_ll.h b/components/hal/esp32p4/include/hal/regi2c_ctrl_ll.h index d946da02f6..e22a025815 100644 --- a/components/hal/esp32p4/include/hal/regi2c_ctrl_ll.h +++ b/components/hal/esp32p4/include/hal/regi2c_ctrl_ll.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include "soc/soc.h" #include "soc/regi2c_defs.h" diff --git a/components/hal/esp32p4/include/hal/spimem_flash_ll.h b/components/hal/esp32p4/include/hal/spimem_flash_ll.h index 4b295319fa..faa47ab26c 100644 --- a/components/hal/esp32p4/include/hal/spimem_flash_ll.h +++ b/components/hal/esp32p4/include/hal/spimem_flash_ll.h @@ -24,6 +24,7 @@ #include "hal/assert.h" #include "hal/spi_types.h" #include "hal/spi_flash_types.h" +#include "hal/misc.h" #ifdef __cplusplus extern "C" { diff --git a/components/hal/esp32p4/include/hal/uart_ll.h b/components/hal/esp32p4/include/hal/uart_ll.h index d7f95ae4d6..00b105d8a0 100644 --- a/components/hal/esp32p4/include/hal/uart_ll.h +++ b/components/hal/esp32p4/include/hal/uart_ll.h @@ -163,9 +163,9 @@ static inline void uart_ll_set_baudrate(uart_dev_t *hw, uint32_t baud, uint32_t //needs force u32 write if ((hw) == &UART0) { - HP_SYSTEM.peri_clk_ctrl111.reg_uart0_sclk_div_num = sclk_div - 1; + HP_SYS_CLKRST.peri_clk_ctrl111.reg_uart0_sclk_div_num = sclk_div - 1; } else { - HP_SYSTEM.peri_clk_ctrl112.reg_uart1_sclk_div_num = sclk_div - 1; + HP_SYS_CLKRST.peri_clk_ctrl112.reg_uart1_sclk_div_num = sclk_div - 1; } #undef DIV_UP diff --git a/components/hal/include/hal/adc_hal.h b/components/hal/include/hal/adc_hal.h index d023ff7dd6..8504477005 100644 --- a/components/hal/include/hal/adc_hal.h +++ b/components/hal/include/hal/adc_hal.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -10,9 +10,10 @@ #include "soc/soc_caps.h" #include "hal/dma_types.h" #include "hal/adc_types.h" -#include "hal/adc_ll.h" #include "hal/adc_hal_common.h" -#include "esp_err.h" +#if SOC_ADC_DMA_SUPPORTED +#include "hal/adc_ll.h" +#endif #if SOC_GDMA_SUPPORTED #include "soc/gdma_struct.h" diff --git a/components/hal/include/hal/adc_types.h b/components/hal/include/hal/adc_types.h index b5bf184dea..ede6325c9a 100644 --- a/components/hal/include/hal/adc_types.h +++ b/components/hal/include/hal/adc_types.h @@ -89,6 +89,9 @@ typedef soc_periph_adc_digi_clk_src_t adc_continuous_clk_src_t; ///< Clock s #elif SOC_ADC_RTC_CTRL_SUPPORTED typedef soc_periph_adc_rtc_clk_src_t adc_oneshot_clk_src_t; ///< Clock source type of oneshot mode which uses RTC controller typedef soc_periph_adc_digi_clk_src_t adc_continuous_clk_src_t; ///< Clock source type of continuous mode which uses digital controller +#else +typedef int adc_oneshot_clk_src_t; ///< Default type +typedef int adc_continuous_clk_src_t; ///< Default type #endif /** diff --git a/components/hal/include/hal/aes_hal.h b/components/hal/include/hal/aes_hal.h index 5bf7f1cbda..4020896b18 100644 --- a/components/hal/include/hal/aes_hal.h +++ b/components/hal/include/hal/aes_hal.h @@ -12,11 +12,14 @@ #pragma once +#include #include #include #include "soc/soc_caps.h" #include "hal/aes_types.h" +#if SOC_AES_SUPPORTED #include "hal/aes_ll.h" +#endif #ifdef __cplusplus extern "C" { diff --git a/components/hal/include/hal/i2c_hal.h b/components/hal/include/hal/i2c_hal.h index dc308fbed7..24b72675d5 100644 --- a/components/hal/include/hal/i2c_hal.h +++ b/components/hal/include/hal/i2c_hal.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -14,13 +14,18 @@ #pragma once -#include "hal/i2c_ll.h" +#include "soc/soc_caps.h" #include "hal/i2c_types.h" +#if SOC_I2C_SUPPORTED +#include "hal/i2c_ll.h" +#endif #ifdef __cplusplus extern "C" { #endif +#if SOC_I2C_SUPPORTED + /** * @brief I2C hal Context definition */ @@ -131,6 +136,8 @@ void i2c_hal_get_timing_config(i2c_hal_context_t *hal, i2c_hal_timing_config_t * */ void i2c_hal_set_timing_config(i2c_hal_context_t *hal, i2c_hal_timing_config_t *timing_config); +#endif // #if SOC_I2C_SUPPORTED + #ifdef __cplusplus } #endif diff --git a/components/hal/include/hal/i2c_types.h b/components/hal/include/hal/i2c_types.h index ea733f3566..dc8398edc5 100644 --- a/components/hal/include/hal/i2c_types.h +++ b/components/hal/include/hal/i2c_types.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -97,6 +97,11 @@ typedef struct { * @brief I2C group clock source */ typedef soc_periph_i2c_clk_src_t i2c_clock_source_t; +#else +/** + * @brief Default type + */ +typedef int i2c_clock_source_t; #endif diff --git a/components/hal/include/hal/ledc_hal.h b/components/hal/include/hal/ledc_hal.h index cf912fdd8e..d01f0a8b3a 100644 --- a/components/hal/include/hal/ledc_hal.h +++ b/components/hal/include/hal/ledc_hal.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -15,14 +15,18 @@ #pragma once -#include "hal/ledc_ll.h" -#include "hal/ledc_types.h" #include "soc/soc_caps.h" +#include "hal/ledc_types.h" +#if SOC_LEDC_SUPPORTED +#include "hal/ledc_ll.h" +#endif #ifdef __cplusplus extern "C" { #endif + +#if SOC_LEDC_SUPPORTED /** * Context that should be maintained by both the driver and the HAL */ @@ -439,6 +443,8 @@ void ledc_hal_clear_fade_end_intr_status(ledc_hal_context_t *hal, ledc_channel_t */ void ledc_hal_get_clk_cfg(ledc_hal_context_t *hal, ledc_timer_t timer_sel, ledc_clk_cfg_t *clk_cfg); +#endif //#if SOC_LEDC_SUPPORTED + #ifdef __cplusplus } #endif diff --git a/components/hal/include/hal/rtc_hal.h b/components/hal/include/hal/rtc_hal.h index 182117e849..ad1dbccf08 100644 --- a/components/hal/include/hal/rtc_hal.h +++ b/components/hal/include/hal/rtc_hal.h @@ -9,10 +9,13 @@ #include #include "soc/soc_caps.h" #include "hal/gpio_types.h" +#include "sdkconfig.h" +#if !CONFIG_IDF_TARGET_ESP32P4 //TODO: IDF-7532 #if !SOC_LP_TIMER_SUPPORTED #include "hal/rtc_cntl_ll.h" #endif +#endif //#if !CONFIG_IDF_TARGET_ESP32P4 #if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED #include "hal/rtc_io_ll.h" #endif diff --git a/components/hal/include/hal/spi_hal.h b/components/hal/include/hal/spi_hal.h index e5d6b174b2..ad4ad8a319 100644 --- a/components/hal/include/hal/spi_hal.h +++ b/components/hal/include/hal/spi_hal.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -26,16 +26,20 @@ // field comments. #pragma once -#include "hal/spi_ll.h" -#include -#include "soc/lldesc.h" +#include "esp_err.h" #include "soc/soc_caps.h" #include "hal/spi_types.h" +#if SOC_GPSPI_SUPPORTED +#include "hal/spi_ll.h" +#include "soc/lldesc.h" +#endif #ifdef __cplusplus extern "C" { #endif +#if SOC_GPSPI_SUPPORTED + /** * Input parameters to the ``spi_hal_cal_clock_conf`` to calculate the timing configuration */ @@ -269,6 +273,8 @@ void spi_hal_cal_timing(int source_freq_hz, int eff_clk, bool gpio_is_used, int */ int spi_hal_get_freq_limit(bool gpio_is_used, int input_delay_ns); +#endif //#if SOC_GPSPI_SUPPORTED + #ifdef __cplusplus } #endif diff --git a/components/hal/include/hal/spi_slave_hal.h b/components/hal/include/hal/spi_slave_hal.h index 1b6e2cf625..4ef6e26db1 100644 --- a/components/hal/include/hal/spi_slave_hal.h +++ b/components/hal/include/hal/spi_slave_hal.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -24,16 +24,20 @@ #pragma once -#include -#include "soc/lldesc.h" -#include "soc/spi_struct.h" +#include "sdkconfig.h" +#include "esp_types.h" #include "soc/soc_caps.h" +#if SOC_GPSPI_SUPPORTED +#include "soc/lldesc.h" #include "hal/spi_ll.h" +#endif #ifdef __cplusplus extern "C" { #endif +#if SOC_GPSPI_SUPPORTED + /** * Context that should be maintained by both the driver and the HAL. */ @@ -160,6 +164,8 @@ uint32_t spi_slave_hal_get_rcv_bitlen(spi_slave_hal_context_t *hal); bool spi_slave_hal_dma_need_reset(const spi_slave_hal_context_t *hal); #endif //#if CONFIG_IDF_TARGET_ESP32 +#endif //#if SOC_GPSPI_SUPPORTED + #ifdef __cplusplus } #endif diff --git a/components/hal/include/hal/spi_slave_hd_hal.h b/components/hal/include/hal/spi_slave_hd_hal.h index fe587fa250..be38031c87 100644 --- a/components/hal/include/hal/spi_slave_hd_hal.h +++ b/components/hal/include/hal/spi_slave_hd_hal.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -43,15 +43,20 @@ #pragma once -#include +#include "esp_types.h" #include "esp_err.h" -#include "hal/spi_ll.h" +#include "soc/soc_caps.h" #include "hal/spi_types.h" +#if SOC_GPSPI_SUPPORTED +#include "hal/spi_ll.h" +#endif #ifdef __cplusplus extern "C" { #endif +#if SOC_GPSPI_SUPPORTED + /** * @brief Type of dma descriptor with appended members * this structure inherits DMA descriptor, with a pointer to the transaction descriptor passed from users. @@ -311,6 +316,8 @@ esp_err_t spi_slave_hd_hal_txdma_append(spi_slave_hd_hal_context_t *hal, uint8_t */ esp_err_t spi_slave_hd_hal_rxdma_append(spi_slave_hd_hal_context_t *hal, uint8_t *data, size_t len, void *arg); +#endif //#if SOC_GPSPI_SUPPORTED + #ifdef __cplusplus } #endif diff --git a/components/hal/include/hal/timer_types.h b/components/hal/include/hal/timer_types.h index 8c444874ae..4a5682dcbf 100644 --- a/components/hal/include/hal/timer_types.h +++ b/components/hal/include/hal/timer_types.h @@ -1,22 +1,30 @@ /* - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#include "soc/soc_caps.h" #include "soc/clk_tree_defs.h" #ifdef __cplusplus extern "C" { #endif +#if SOC_GPTIMER_SUPPORTED /** * @brief GPTimer clock source * @note User should select the clock source based on the power and resolution requirement */ typedef soc_periph_gptimer_clk_src_t gptimer_clock_source_t; +#else +/** + * @brief Default type + */ +typedef int gptimer_clock_source_t; +#endif /** * @brief GPTimer count direction diff --git a/components/soc/esp32p4/include/soc/clk_tree_defs.h b/components/soc/esp32p4/include/soc/clk_tree_defs.h index c78bc31e47..d5b08f3e8c 100644 --- a/components/soc/esp32p4/include/soc/clk_tree_defs.h +++ b/components/soc/esp32p4/include/soc/clk_tree_defs.h @@ -278,6 +278,24 @@ typedef enum { //////////////////////////////////////////////////LEDC///////////////////////////////////////////////////////////////// +//TODO: IDF-6510 +/** + * @brief Array initializer for all supported clock sources of LEDC + */ +#define SOC_LEDC_CLKS {SOC_MOD_CLK_XTAL, SOC_MOD_CLK_PLL_F80M, SOC_MOD_CLK_RC_FAST} + +/** + * @brief Type of LEDC clock source, reserved for the legacy LEDC driver + */ +typedef enum { + LEDC_AUTO_CLK = 0, /*!< LEDC source clock will be automatically selected based on the giving resolution and duty parameter when init the timer*/ + LEDC_USE_PLL_DIV_CLK = SOC_MOD_CLK_PLL_F80M, /*!< Select PLL_F80M clock as the source clock */ + LEDC_USE_RC_FAST_CLK = SOC_MOD_CLK_RC_FAST, /*!< Select RC_FAST as the source clock */ + LEDC_USE_XTAL_CLK = SOC_MOD_CLK_XTAL, /*!< Select XTAL as the source clock */ + + LEDC_USE_RTC8M_CLK __attribute__((deprecated("please use 'LEDC_USE_RC_FAST_CLK' instead"))) = LEDC_USE_RC_FAST_CLK, /*!< Alias of 'LEDC_USE_RC_FAST_CLK' */ +} soc_periph_ledc_clk_src_legacy_t; + //////////////////////////////////////////////////PARLIO//////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/components/soc/esp32p4/include/soc/hp_sys_clkrst_struct.h b/components/soc/esp32p4/include/soc/hp_sys_clkrst_struct.h index 169c4c3860..d672ecc629 100644 --- a/components/soc/esp32p4/include/soc/hp_sys_clkrst_struct.h +++ b/components/soc/esp32p4/include/soc/hp_sys_clkrst_struct.h @@ -2922,7 +2922,7 @@ typedef union { } hp_sys_clkrst_hpcore_wdt_reset_source0_reg_t; -typedef struct { +typedef struct hp_sys_clkrst_dev_t { volatile hp_sys_clkrst_clk_en0_reg_t clk_en0; volatile hp_sys_clkrst_root_clk_ctrl0_reg_t root_clk_ctrl0; volatile hp_sys_clkrst_root_clk_ctrl1_reg_t root_clk_ctrl1; @@ -2985,7 +2985,7 @@ typedef struct { volatile hp_sys_clkrst_hpcore_wdt_reset_source0_reg_t hpcore_wdt_reset_source0; } hp_sys_clkrst_dev_t; -extern hp_sys_clkrst_dev_t HP_SYSTEM; +extern hp_sys_clkrst_dev_t HP_SYS_CLKRST; #ifndef __cplusplus diff --git a/components/soc/esp32p4/ld/esp32p4.peripherals.ld b/components/soc/esp32p4/ld/esp32p4.peripherals.ld index 6b48ee957d..f35009c86d 100644 --- a/components/soc/esp32p4/ld/esp32p4.peripherals.ld +++ b/components/soc/esp32p4/ld/esp32p4.peripherals.ld @@ -55,6 +55,7 @@ PROVIDE ( GPIO = 0x500E0000 ); PROVIDE ( SIGMADELTA = 0x500E0F00 ); PROVIDE ( HP_SYSTEM = 0x500E5000 ); +PROVIDE ( HP_SYS_CLKRST = 0x500E6000 ); PROVIDE ( TEE = 0x60098000 ); /* TODO: IDF-7542 */ PROVIDE ( HP_APM = 0x60099000 ); /* TODO: IDF-7542 */ diff --git a/examples/common_components/env_caps/esp32p4/Kconfig.env_caps b/examples/common_components/env_caps/esp32p4/Kconfig.env_caps new file mode 100644 index 0000000000..d736f9c179 --- /dev/null +++ b/examples/common_components/env_caps/esp32p4/Kconfig.env_caps @@ -0,0 +1,15 @@ +config ENV_GPIO_RANGE_MIN + int + default 0 + +config ENV_GPIO_RANGE_MAX + int + default 56 + +config ENV_GPIO_IN_RANGE_MAX + int + default ENV_GPIO_RANGE_MAX + +config ENV_GPIO_OUT_RANGE_MAX + int + default ENV_GPIO_RANGE_MAX From b9708d933f6c9e21e499de62932d7f73b8c64219 Mon Sep 17 00:00:00 2001 From: Armando Date: Thu, 3 Aug 2023 11:05:32 +0800 Subject: [PATCH 2/3] fix(soc): fix ecc_mult_struct.h struct size check --- components/soc/esp32p4/include/soc/ecc_mult_struct.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/soc/esp32p4/include/soc/ecc_mult_struct.h b/components/soc/esp32p4/include/soc/ecc_mult_struct.h index 4cb6a8afba..5754a9e3cd 100644 --- a/components/soc/esp32p4/include/soc/ecc_mult_struct.h +++ b/components/soc/esp32p4/include/soc/ecc_mult_struct.h @@ -158,7 +158,7 @@ typedef struct { #ifndef __cplusplus -_Static_assert(sizeof(ecc_mult_dev_t) == 0x160, "Invalid size of ecc_mult_dev_t structure"); +_Static_assert(sizeof(ecc_mult_dev_t) == 0x1C0, "Invalid size of ecc_mult_dev_t structure"); #endif #ifdef __cplusplus From 3fdddc2f1bbd0f72162d3cb721c43846faa62b18 Mon Sep 17 00:00:00 2001 From: Armando Date: Thu, 3 Aug 2023 11:50:47 +0800 Subject: [PATCH 3/3] change(ci): enable esp32p4 check public header --- .gitlab/ci/pre_check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab/ci/pre_check.yml b/.gitlab/ci/pre_check.yml index 74842e0ce7..f093b370ff 100644 --- a/.gitlab/ci/pre_check.yml +++ b/.gitlab/ci/pre_check.yml @@ -120,6 +120,7 @@ check_public_headers: - IDF_TARGET=esp32c2 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf- - IDF_TARGET=esp32c6 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf- - IDF_TARGET=esp32h2 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf- + - IDF_TARGET=esp32p4 python tools/ci/check_public_headers.py --jobs 4 --prefix riscv32-esp-elf- check_chip_support_components: extends: