refactor(hal): clean up some hal file dependency on sdkconfig.h

This commit is contained in:
morris
2025-07-17 10:33:08 +08:00
parent 0296c30908
commit ccd092d7dc
35 changed files with 108 additions and 149 deletions
+3 -3
View File
@@ -19,12 +19,12 @@
#include "hal/gdma_ll.h"
#endif
#if CONFIG_IDF_TARGET_ESP32S2
#if SOC_IS(ESP32S2)
//ADC utilises SPI3 DMA on ESP32S2
#include "hal/spi_ll.h"
#endif
#if CONFIG_IDF_TARGET_ESP32
#if SOC_IS(ESP32)
//ADC utilises I2S0 DMA on ESP32
#include "hal/i2s_ll.h"
#endif
@@ -33,7 +33,7 @@
extern "C" {
#endif
#if CONFIG_IDF_TARGET_ESP32
#if SOC_IS(ESP32)
#define ADC_HAL_DMA_I2S_HOST 0
#endif
+4 -5
View File
@@ -7,7 +7,6 @@
#include <stdbool.h>
#include <stdint.h>
#include "sdkconfig.h"
#include "soc/soc_caps.h"
#include "soc/clk_tree_defs.h"
#include "esp_attr.h"
@@ -159,7 +158,7 @@ typedef enum {
/*---------------------------------------------------------------
Output Format
---------------------------------------------------------------*/
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
#if SOC_IS(ESP32) || SOC_IS(ESP32S2)
/**
* @brief ADC digital controller (DMA mode) output data format.
* Used to analyze the acquired ADC (DMA) data.
@@ -184,7 +183,7 @@ typedef struct {
};
} adc_digi_output_data_t;
#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2
#elif SOC_IS(ESP32C3) || SOC_IS(ESP32C2)
/**
* @brief ADC digital controller (DMA mode) output data format.
* Used to analyze the acquired ADC (DMA) data.
@@ -204,7 +203,7 @@ typedef struct {
};
} adc_digi_output_data_t;
#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4
#elif SOC_IS(ESP32S3) || SOC_IS(ESP32P4)
/**
* @brief ADC digital controller (DMA mode) output data format.
* Used to analyze the acquired ADC (DMA) data.
@@ -224,7 +223,7 @@ typedef struct {
};
} adc_digi_output_data_t;
#elif CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61
#elif SOC_IS(ESP32C6) || SOC_IS(ESP32H2) || SOC_IS(ESP32C5) || SOC_IS(ESP32C61)
/**
* @brief ADC digital controller (DMA mode) output data format.
* Used to analyze the acquired ADC (DMA) data.
+3 -3
View File
@@ -16,7 +16,7 @@ extern "C" {
#include "hal/apm_ll.h"
#include "hal/apm_types.h"
#if CONFIG_IDF_TARGET_ESP32P4
#if SOC_IS(ESP32P4)
/**
* @brief DMA configurable region configuration data.
@@ -360,11 +360,11 @@ void apm_hal_enable_reset_event_bypass(bool enable);
*/
void apm_hal_enable_ctrl_clk_gating(apm_ctrl_module_t ctrl_mod, bool enable);
#endif //CONFIG_IDF_TARGET_ESP32P4
#endif //SOC_IS(ESP32P4)
#elif SOC_APM_CTRL_FILTER_SUPPORTED //!SOC_APM_SUPPORTED
#if CONFIG_IDF_TARGET_ESP32H4
#if SOC_IS(ESP32H4)
#include "soc/hp_apm_reg.h"
#define apm_hal_enable_ctrl_filter_all(en) \
REG_WRITE(HP_APM_FUNC_CTRL_REG, en ? 0xFFFFFFFF : 0);
+5 -4
View File
@@ -12,6 +12,7 @@
#include "esp_err.h"
#include "hal/eth_types.h"
#include "soc/soc_caps.h"
#ifdef __cplusplus
extern "C" {
#endif
@@ -25,7 +26,7 @@ extern "C" {
#define TYPE_SIZE_ERR_MSG(DATATYPE, SIZE) #DATATYPE " should occupy " STR(SIZE) " bytes in memory"
#define ASSERT_TYPE_SIZE(DATATYPE, SIZE) ESP_STATIC_ASSERT(sizeof(DATATYPE) == SIZE, TYPE_SIZE_ERR_MSG(DATATYPE, SIZE))
#if CONFIG_IDF_TARGET_ESP32P4
#if SOC_IS(ESP32P4)
// Descriptor must be 64B aligned for ESP32P4 due to cache arrangement
#define EMAC_HAL_DMA_DESC_SIZE (64)
#else
@@ -191,7 +192,7 @@ ASSERT_TYPE_SIZE(eth_dma_rx_descriptor_t, EMAC_HAL_DMA_DESC_SIZE);
typedef struct emac_mac_dev_s *emac_mac_soc_regs_t;
typedef struct emac_dma_dev_s *emac_dma_soc_regs_t;
#if CONFIG_IDF_TARGET_ESP32
#if SOC_IS(ESP32)
typedef struct emac_ext_dev_s *emac_ext_soc_regs_t;
#else
typedef void *emac_ext_soc_regs_t;
@@ -236,9 +237,9 @@ void emac_hal_init(emac_hal_context_t *hal);
#define emac_hal_clock_enable_rmii_input(hal) emac_ll_clock_enable_rmii_input((hal)->ext_regs)
#ifdef CONFIG_IDF_TARGET_ESP32P4
#if SOC_IS(ESP32P4)
#define emac_hal_clock_rmii_rx_tx_div(hal, div) emac_ll_clock_rmii_rx_tx_div((hal)->ext_regs, div)
#endif // CONFIG_IDF_TARGET_ESP32P4
#endif // SOC_IS(ESP32P4)
#define emac_hal_clock_enable_rmii_output(hal) emac_ll_clock_enable_rmii_output((hal)->ext_regs)
+2 -2
View File
@@ -9,7 +9,7 @@
#pragma once
#include "soc/soc_caps.h"
#include "sdkconfig.h"
#if SOC_MODEM_CLOCK_IS_INDEPENDENT && SOC_MODEM_CLOCK_SUPPORTED
#include "hal/modem_syscon_ll.h"
#include "hal/modem_lpcon_ll.h"
@@ -24,7 +24,7 @@ typedef struct {
modem_lpcon_dev_t *lpcon_dev;
} modem_clock_hal_context_t;
#if !CONFIG_IDF_TARGET_ESP32H2 //TODO: PM-92
#if !SOC_IS(ESP32H2) //TODO: PM-92
void modem_clock_hal_set_clock_domain_icg_bitmap(modem_clock_hal_context_t *hal, modem_clock_domain_t domain, uint32_t bitmap);
uint32_t modem_clock_hal_get_clock_domain_icg_bitmap(modem_clock_hal_context_t *hal, modem_clock_domain_t domain);
#endif
+5 -6
View File
@@ -16,8 +16,7 @@
#include <stdint.h>
#include <sys/param.h>
#include "hal/mpi_types.h"
#include "sdkconfig.h"
#include "soc/soc_caps.h"
#ifdef __cplusplus
extern "C" {
@@ -32,7 +31,7 @@ extern "C" {
size_t mpi_hal_calc_hardware_words(size_t words);
/**
* @brief Clear the MPI power control bit and intitialise the MPI hardware.
* @brief Clear the MPI power control bit and initialise the MPI hardware.
*
*/
void mpi_hal_enable_hardware_hw_op(void);
@@ -91,13 +90,13 @@ void mpi_hal_write_at_offset(mpi_param_t param, int offset, uint32_t value);
void mpi_hal_write_m_prime(uint32_t Mprime);
/**
* @brief Write first word of the parametr Rinv.
* @brief Write first word of the parameter Rinv.
*
* @param rinv Value of first word of rinv.
*/
void mpi_hal_write_rinv(uint32_t rinv);
#if !CONFIG_IDF_TARGET_ESP32
#if !SOC_IS(ESP32)
/**
* @brief Enable/Disable constant time acceleration option.
*
@@ -118,7 +117,7 @@ void mpi_hal_enable_search(bool enable);
* @param position Address to start search.
*/
void mpi_hal_set_search_position(size_t position);
#endif /* !CONFIG_IDF_TARGET_ESP32 */
#endif /* !SOC_IS(ESP32) */
/**
* @brief Begin an MPI operation.
+1 -2
View File
@@ -8,7 +8,6 @@
#include <stdint.h>
#include "soc/soc_caps.h"
#include "sdkconfig.h"
#ifdef __cplusplus
extern "C" {
@@ -36,7 +35,7 @@ typedef enum {
/**
* @brief PMU power domain of HP system
*/
#if CONFIG_IDF_TARGET_ESP32P4
#if SOC_IS(ESP32P4)
typedef enum {
PMU_HP_PD_TOP = 0, /*!< Power domain of digital top */
PMU_HP_PD_CNNT = 1, /*!< Power domain of high-speed IO peripherals such as USB/SDIO/Ethernet etc.*/
+1 -2
View File
@@ -9,9 +9,8 @@
#include <stdint.h>
#include "soc/soc_caps.h"
#include "hal/gpio_types.h"
#include "sdkconfig.h"
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
#if SOC_IS(ESP32) || SOC_IS(ESP32C2) || SOC_IS(ESP32C3) || SOC_IS(ESP32S2) || SOC_IS(ESP32S3)
#include "hal/rtc_cntl_ll.h"
#endif
-8
View File
@@ -6,21 +6,13 @@
#pragma once
#include "sdkconfig.h"
/* Use enum from rom for backwards compatibility */
#include "rom/sha.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Use enum from rom for backwards compatibility */
#if CONFIG_IDF_TARGET_ESP32
typedef enum SHA_TYPE esp_sha_type;
#else
typedef SHA_TYPE esp_sha_type;
#endif
#ifdef __cplusplus
}
@@ -8,7 +8,6 @@
#include <stdbool.h>
#include <stdint.h>
#include "sdkconfig.h"
#include "esp_attr.h"
#include "esp_bit_defs.h"
#include "soc/soc_caps.h"
@@ -128,7 +127,7 @@ typedef enum {
#define TOUCH_PAD_THRESHOLD_MAX (0xFFFF) /*!< If set touch threshold max value, The touch sensor can't be in touched status */
#endif
#ifdef CONFIG_IDF_TARGET_ESP32
#if SOC_IS(ESP32)
#define TOUCH_PAD_SLEEP_CYCLE_DEFAULT (0x1000) /*!<The timer frequency is RTC_SLOW_CLK (can be 150k or 32k depending on the options), max value is 0xffff */
#define TOUCH_PAD_MEASURE_CYCLE_DEFAULT (0x7fff) /*!<The timer frequency is 8Mhz, the max value is 0x7fff */
@@ -136,9 +135,9 @@ typedef enum {
#define TOUCH_TRIGGER_MODE_DEFAULT (TOUCH_TRIGGER_BELOW) /*!<Interrupts can be triggered if sensor value gets below or above threshold */
#define TOUCH_TRIGGER_SOURCE_DEFAULT (TOUCH_TRIGGER_SOURCE_SET1) /*!<The wakeup trigger source can be SET1 or both SET1 and SET2 */
#endif // CONFIG_IDF_TARGET ESP32
#endif // SOC_IS(ESP32)
#if !CONFIG_IDF_TARGET_ESP32
#if !SOC_IS(ESP32)
/**
* Excessive total time will slow down the touch response.
* Too small measurement time will not be sampled enough, resulting in inaccurate measurements.
@@ -301,7 +300,7 @@ typedef struct {
bool en_proximity; /*!<enable proximity function for sleep pad */
} touch_pad_sleep_channel_t;
#endif // !CONFIG_IDF_TARGET_ESP32
#endif // !SOC_IS(ESP32)
#ifdef __cplusplus
}
-1
View File
@@ -13,7 +13,6 @@
#include <stddef.h>
#include <stdbool.h>
#include "sdkconfig.h"
#include "soc/soc_caps.h"
#include "hal/twai_types.h"