diff --git a/components/esp_hw_support/port/esp32c2/private_include/regi2c_brownout.h b/components/esp_hw_support/port/esp32c2/private_include/regi2c_brownout.h deleted file mode 100644 index 0d42d89282..0000000000 --- a/components/esp_hw_support/port/esp32c2/private_include/regi2c_brownout.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "soc/regi2c_brownout.h" diff --git a/components/esp_hw_support/port/esp32c3/private_include/regi2c_brownout.h b/components/esp_hw_support/port/esp32c3/private_include/regi2c_brownout.h deleted file mode 100644 index 733d0daa9f..0000000000 --- a/components/esp_hw_support/port/esp32c3/private_include/regi2c_brownout.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "soc/regi2c_brownout.h" diff --git a/components/esp_hw_support/port/esp32h2/private_include/regi2c_brownout.h b/components/esp_hw_support/port/esp32h2/private_include/regi2c_brownout.h deleted file mode 100644 index 733d0daa9f..0000000000 --- a/components/esp_hw_support/port/esp32h2/private_include/regi2c_brownout.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "soc/regi2c_brownout.h" diff --git a/components/hal/esp32c2/brownout_hal.c b/components/hal/esp32c2/brownout_hal.c index 9d8d3aea8f..64b42f73c2 100644 --- a/components/hal/esp32c2/brownout_hal.c +++ b/components/hal/esp32c2/brownout_hal.c @@ -9,14 +9,7 @@ #include "soc/rtc_cntl_struct.h" #include "soc/rtc_cntl_reg.h" #include "esp_attr.h" -#include "esp_rom_regi2c.h" -#if __has_include("esp_private/regi2c_ctrl.h") - #include "esp_private/regi2c_ctrl.h" -#else - /* Only write funciton is needed in HAL component */ - #define REGI2C_WRITE_MASK(block, reg_add, indata) esp_rom_regi2c_write_mask(block, block##_HOSTID, reg_add, reg_add##_MSB, reg_add##_LSB, indata) -#endif - +#include "hal/regi2c_ctrl.h" #include "soc/regi2c_brownout.h" diff --git a/components/hal/esp32c2/include/hal/adc_ll.h b/components/hal/esp32c2/include/hal/adc_ll.h index 5237a71da8..d8e194cac7 100644 --- a/components/hal/esp32c2/include/hal/adc_ll.h +++ b/components/hal/esp32c2/include/hal/adc_ll.h @@ -17,14 +17,7 @@ #include "hal/misc.h" #include "hal/adc_types.h" #include "hal/adc_types_private.h" -#include "esp_rom_regi2c.h" - -#if __has_include("esp_private/regi2c_ctrl.h") - #include "esp_private/regi2c_ctrl.h" -#else - #define REGI2C_WRITE_MASK(block, reg_add, indata) esp_rom_regi2c_write_mask(block, block##_HOSTID, reg_add, reg_add##_MSB, reg_add##_LSB, indata) -#endif - +#include "hal/regi2c_ctrl.h" #include "soc/regi2c_saradc.h" #ifdef __cplusplus diff --git a/components/hal/esp32c3/brownout_hal.c b/components/hal/esp32c3/brownout_hal.c index 8a514c4f03..7fa9a3b68f 100644 --- a/components/hal/esp32c3/brownout_hal.c +++ b/components/hal/esp32c3/brownout_hal.c @@ -9,14 +9,7 @@ #include "soc/rtc_cntl_struct.h" #include "soc/rtc_cntl_reg.h" #include "esp_attr.h" -#include "esp_rom_regi2c.h" -#if __has_include("esp_private/regi2c_ctrl.h") - #include "esp_private/regi2c_ctrl.h" -#else - /* Only write funciton is needed in HAL component */ - #define REGI2C_WRITE_MASK(block, reg_add, indata) esp_rom_regi2c_write_mask(block, block##_HOSTID, reg_add, reg_add##_MSB, reg_add##_LSB, indata) -#endif - +#include "hal/regi2c_ctrl.h" #include "soc/regi2c_brownout.h" void brownout_hal_config(const brownout_hal_config_t *cfg) diff --git a/components/hal/esp32c3/include/hal/adc_ll.h b/components/hal/esp32c3/include/hal/adc_ll.h index 81ab475307..8bf642b3ef 100644 --- a/components/hal/esp32c3/include/hal/adc_ll.h +++ b/components/hal/esp32c3/include/hal/adc_ll.h @@ -18,13 +18,7 @@ #include "hal/assert.h" #include "hal/adc_types.h" #include "hal/adc_types_private.h" -#include "esp_rom_regi2c.h" - -#if __has_include("esp_private/regi2c_ctrl.h") - #include "esp_private/regi2c_ctrl.h" -#else - #define REGI2C_WRITE_MASK(block, reg_add, indata) esp_rom_regi2c_write_mask(block, block##_HOSTID, reg_add, reg_add##_MSB, reg_add##_LSB, indata) -#endif +#include "hal/regi2c_ctrl.h" #include "soc/regi2c_saradc.h" diff --git a/components/hal/esp32h2/brownout_hal.c b/components/hal/esp32h2/brownout_hal.c index db482d365e..a08e4da50e 100644 --- a/components/hal/esp32h2/brownout_hal.c +++ b/components/hal/esp32h2/brownout_hal.c @@ -10,14 +10,7 @@ #include "soc/rtc_cntl_reg.h" #include "i2c_pmu.h" #include "esp_attr.h" -#include "esp_rom_regi2c.h" -#if __has_include("esp_private/regi2c_ctrl.h") - #include "esp_private/regi2c_ctrl.h" -#else - /* Only write funciton is needed in HAL component */ - #define REGI2C_WRITE_MASK(block, reg_add, indata) esp_rom_regi2c_write_mask(block, block##_HOSTID, reg_add, reg_add##_MSB, reg_add##_LSB, indata) -#endif - +#include "hal/regi2c_ctrl.h" #include "soc/regi2c_brownout.h" diff --git a/components/hal/esp32h2/include/hal/adc_ll.h b/components/hal/esp32h2/include/hal/adc_ll.h index 8eb432b94c..086d70b578 100644 --- a/components/hal/esp32h2/include/hal/adc_ll.h +++ b/components/hal/esp32h2/include/hal/adc_ll.h @@ -17,13 +17,7 @@ #include "soc/rtc_cntl_struct.h" #include "soc/rtc_cntl_reg.h" #include "hal/misc.h" -#include "esp_rom_regi2c.h" - -#if __has_include("esp_private/regi2c_ctrl.h") - #include "esp_private/regi2c_ctrl.h" -#else - #define REGI2C_WRITE_MASK(block, reg_add, indata) esp_rom_regi2c_write_mask(block, block##_HOSTID, reg_add, reg_add##_MSB, reg_add##_LSB, indata) -#endif +#include "hal/regi2c_ctrl.h" #include "soc/regi2c_saradc.h" diff --git a/components/hal/platform_port/include/hal/regi2c_ctrl.h b/components/hal/platform_port/include/hal/regi2c_ctrl.h new file mode 100644 index 0000000000..59094ac52d --- /dev/null +++ b/components/hal/platform_port/include/hal/regi2c_ctrl.h @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#if __has_include("esp_private/regi2c_ctrl.h") + #include "esp_private/regi2c_ctrl.h" +#else + #include "esp_rom_regi2c.h" + #define REGI2C_WRITE_MASK(block, reg_add, indata) esp_rom_regi2c_write_mask(block, block##_HOSTID, reg_add, reg_add##_MSB, reg_add##_LSB, indata) +#endif