diff --git a/components/README.md b/components/README.md index c4c33d8674..b913c28026 100644 --- a/components/README.md +++ b/components/README.md @@ -150,11 +150,10 @@ The current implementation in `esp_system` can then just register the interrupt #### `esp_mac.h`, `esp_chip_info.h`, `esp_random.h` (`esp_hw_support`) The functions in these headers used to be in `esp_system.h`, but have been split-off. -However, to maintain backward compatibility, `esp_system.h` includes these headers. The remaining functions in `esp_system.h` are those that deal with system behavior, such as `esp_register_shutdown_handler`, or are proxy for other system components's APIs such as `esp_get_free_heap_size`. The functions split-off from `esp_system.h` are much more hardware manipulation oriented such as: -`esp_read_mac`, `esp_random` and `esp_chip_info`. \ No newline at end of file +`esp_read_mac`, `esp_random` and `esp_chip_info`. diff --git a/components/bootloader_support/src/bootloader_random.c b/components/bootloader_support/src/bootloader_random.c index 412b234f26..55b83bdda7 100644 --- a/components/bootloader_support/src/bootloader_random.c +++ b/components/bootloader_support/src/bootloader_random.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2010-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -9,7 +9,7 @@ #include "soc/wdev_reg.h" #ifndef BOOTLOADER_BUILD -#include "esp_system.h" +#include "esp_random.h" #include "esp_private/periph_ctrl.h" __attribute__((weak)) void bootloader_fill_random(void *buffer, size_t length) diff --git a/components/bt/controller/esp32/bt.c b/components/bt/controller/esp32/bt.c index 3432e09846..63c6fb0f8c 100644 --- a/components/bt/controller/esp32/bt.c +++ b/components/bt/controller/esp32/bt.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -20,7 +20,8 @@ #include "freertos/portmacro.h" #include "xtensa/core-macros.h" #include "esp_types.h" -#include "esp_system.h" +#include "esp_mac.h" +#include "esp_random.h" #include "esp_task.h" #include "esp_intr_alloc.h" #include "esp_attr.h" diff --git a/components/bt/controller/esp32c3/bt.c b/components/bt/controller/esp32c3/bt.c index 80d641784a..4919d7ff90 100644 --- a/components/bt/controller/esp32c3/bt.c +++ b/components/bt/controller/esp32c3/bt.c @@ -18,7 +18,8 @@ #include "freertos/semphr.h" #include "freertos/portmacro.h" #include "esp_types.h" -#include "esp_system.h" +#include "esp_mac.h" +#include "esp_random.h" #include "esp_task.h" #include "riscv/interrupt.h" #include "esp_attr.h" diff --git a/components/bt/controller/esp32s3/bt.c b/components/bt/controller/esp32s3/bt.c index 5e9e2ba2f4..af1be1d16b 100644 --- a/components/bt/controller/esp32s3/bt.c +++ b/components/bt/controller/esp32s3/bt.c @@ -20,7 +20,8 @@ #include "freertos/portmacro.h" #include "xtensa/core-macros.h" #include "esp_types.h" -#include "esp_system.h" +#include "esp_mac.h" +#include "esp_random.h" #include "esp_task.h" #include "esp_attr.h" #include "esp_phy_init.h" diff --git a/components/bt/esp_ble_mesh/mesh_common/mesh_common.c b/components/bt/esp_ble_mesh/mesh_common/mesh_common.c index 2bc9918b76..80c424200a 100644 --- a/components/bt/esp_ble_mesh/mesh_common/mesh_common.c +++ b/components/bt/esp_ble_mesh/mesh_common/mesh_common.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -7,7 +7,7 @@ #include #include -#include "esp_system.h" +#include "esp_random.h" #include "mesh_main.h" #include "client_common.h" diff --git a/components/bt/test/test_smp.c b/components/bt/test/test_smp.c index 7554007b6d..9cf51c41a7 100644 --- a/components/bt/test/test_smp.c +++ b/components/bt/test/test_smp.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -24,7 +24,7 @@ #include "esp_heap_caps.h" #include "esp_log.h" #include "freertos/ringbuf.h" -#include "esp_system.h" +#include "esp_random.h" #include "nvs_flash.h" #include "esp_bt.h" diff --git a/components/driver/i2s.c b/components/driver/i2s.c index 7c7b0f6c18..562d36f0ce 100644 --- a/components/driver/i2s.c +++ b/components/driver/i2s.c @@ -29,7 +29,7 @@ #include "esp_private/gdma.h" #endif -#include "soc/clk_ctrl_os.h" +#include "clk_ctrl_os.h" #include "esp_intr_alloc.h" #include "esp_err.h" #include "esp_check.h" diff --git a/components/driver/ledc.c b/components/driver/ledc.c index e9fb066ecd..b8286566f9 100644 --- a/components/driver/ledc.c +++ b/components/driver/ledc.c @@ -18,7 +18,7 @@ #include "driver/ledc.h" #include "esp_rom_gpio.h" #include "esp_rom_sys.h" -#include "soc/clk_ctrl_os.h" +#include "clk_ctrl_os.h" #include "esp_private/periph_ctrl.h" static __attribute__((unused)) const char *LEDC_TAG = "ledc"; diff --git a/components/driver/test/test_rs485.c b/components/driver/test/test_rs485.c index 8c5f6b6339..8c97973e44 100644 --- a/components/driver/test/test_rs485.c +++ b/components/driver/test/test_rs485.c @@ -12,7 +12,7 @@ #include "test_utils.h" // unity_send_signal #include "driver/uart.h" // for the uart driver access #include "esp_log.h" -#include "esp_system.h" // for uint32_t esp_random() +#include "esp_random.h" // for uint32_t esp_random() #define UART_TAG "Uart" #define UART_NUM1 (UART_NUM_1) diff --git a/components/esp-tls/test/test_esp_tls.c b/components/esp-tls/test/test_esp_tls.c index 2d22e31e49..f01fd30ef5 100644 --- a/components/esp-tls/test/test_esp_tls.c +++ b/components/esp-tls/test/test_esp_tls.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -9,6 +9,7 @@ #include "unity.h" #include "esp_err.h" #include "esp_log.h" +#include "esp_mac.h" #if SOC_SHA_SUPPORT_PARALLEL_ENG #include "sha/sha_parallel_engine.h" #elif SOC_SHA_SUPPORT_DMA diff --git a/components/esp_eth/src/esp_eth_mac_esp.c b/components/esp_eth/src/esp_eth_mac_esp.c index c49f25eade..2e9ce19a70 100644 --- a/components/esp_eth/src/esp_eth_mac_esp.c +++ b/components/esp_eth/src/esp_eth_mac_esp.c @@ -13,7 +13,7 @@ #include "esp_check.h" #include "esp_eth.h" #include "esp_pm.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_heap_caps.h" #include "esp_intr_alloc.h" #include "esp_private/esp_clk.h" @@ -24,7 +24,7 @@ #include "hal/emac_hal.h" #include "hal/gpio_hal.h" #include "soc/soc.h" -#include "soc/clk_ctrl_os.h" +#include "clk_ctrl_os.h" #include "sdkconfig.h" #include "esp_rom_gpio.h" #include "esp_rom_sys.h" diff --git a/components/esp_event/event_send_compat.inc b/components/esp_event/event_send_compat.inc index d8381f36c1..e0c37d0b5e 100644 --- a/components/esp_event/event_send_compat.inc +++ b/components/esp_event/event_send_compat.inc @@ -17,6 +17,7 @@ #include "esp_event_legacy.h" #include "esp_wifi_types.h" #include "esp_netif.h" +#include "esp_mac.h" #if CONFIG_ETH_ENABLED #include "esp_eth.h" #endif diff --git a/components/esp_hw_support/clk_ctrl_os.c b/components/esp_hw_support/clk_ctrl_os.c index 991adc84e7..855501e6bb 100644 --- a/components/esp_hw_support/clk_ctrl_os.c +++ b/components/esp_hw_support/clk_ctrl_os.c @@ -1,11 +1,11 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #include -#include "soc/clk_ctrl_os.h" +#include "clk_ctrl_os.h" #include "esp_check.h" #include "sdkconfig.h" diff --git a/components/esp_hw_support/compare_set.c b/components/esp_hw_support/compare_set.c index ebce9c127a..cc61b93aaa 100644 --- a/components/esp_hw_support/compare_set.c +++ b/components/esp_hw_support/compare_set.c @@ -1,10 +1,10 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#include "soc/compare_set.h" -#include "soc/spinlock.h" +#include "compare_set.h" +#include "spinlock.h" #include "soc/soc_caps.h" #if __XTENSA__ && SOC_SPIRAM_SUPPORTED diff --git a/components/esp_hw_support/include/soc/clk_ctrl_os.h b/components/esp_hw_support/include/clk_ctrl_os.h similarity index 97% rename from components/esp_hw_support/include/soc/clk_ctrl_os.h rename to components/esp_hw_support/include/clk_ctrl_os.h index 95bce65793..88478663bb 100644 --- a/components/esp_hw_support/include/soc/clk_ctrl_os.h +++ b/components/esp_hw_support/include/clk_ctrl_os.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/esp_hw_support/include/compare_set.h b/components/esp_hw_support/include/compare_set.h new file mode 100644 index 0000000000..e6a2e84fd9 --- /dev/null +++ b/components/esp_hw_support/include/compare_set.h @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include +#include "esp_cpu.h" +#include "soc/soc_memory_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static inline void __attribute__((always_inline)) compare_and_set_native(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ + cpu_ll_compare_and_set_native(addr, compare, set); +} + +void compare_and_set_extram(volatile uint32_t *addr, uint32_t compare, uint32_t *set); + +#ifdef __cplusplus +} +#endif diff --git a/components/esp_hw_support/include/soc/esp32/himem.h b/components/esp_hw_support/include/esp_himem.h similarity index 96% rename from components/esp_hw_support/include/soc/esp32/himem.h rename to components/esp_hw_support/include/esp_himem.h index e3e85a4ba7..fb28f399df 100644 --- a/components/esp_hw_support/include/soc/esp32/himem.h +++ b/components/esp_hw_support/include/esp_himem.h @@ -1,10 +1,17 @@ /* - * SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ + #pragma once +#include "sdkconfig.h" + +#if !CONFIG_IDF_TARGET_ESP32 +#error esp_himem is only supported on ESP32 +#else + #include #include "esp_err.h" @@ -141,3 +148,5 @@ size_t esp_himem_reserved_area_size(void); #ifdef __cplusplus } #endif + +#endif // !CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp_hw_support/include/esp_random.h b/components/esp_hw_support/include/esp_random.h index a6b8a884b6..4a1af7548a 100644 --- a/components/esp_hw_support/include/esp_random.h +++ b/components/esp_hw_support/include/esp_random.h @@ -1,10 +1,11 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ -#pragma once +#ifndef __ESP_RANDOM_H__ +#define __ESP_RANDOM_H__ #include #include @@ -42,3 +43,5 @@ void esp_fill_random(void *buf, size_t len); #ifdef __cplusplus } #endif + +#endif /* __ESP_RANDOM_H__ */ diff --git a/components/esp_hw_support/include/soc/rtc_wdt.h b/components/esp_hw_support/include/rtc_wdt.h similarity index 100% rename from components/esp_hw_support/include/soc/rtc_wdt.h rename to components/esp_hw_support/include/rtc_wdt.h diff --git a/components/esp_hw_support/include/soc/compare_set.h b/components/esp_hw_support/include/soc/compare_set.h deleted file mode 100644 index a1ab4a5c58..0000000000 --- a/components/esp_hw_support/include/soc/compare_set.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include -#include -#include "esp_cpu.h" -#include "soc/soc_memory_types.h" - -#if __XTENSA__ -#include "xtensa/xtruntime.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -static inline void __attribute__((always_inline)) compare_and_set_native(volatile uint32_t *addr, uint32_t compare, uint32_t *set) -{ -#if (XCHAL_HAVE_S32C1I > 0) - __asm__ __volatile__ ( - "WSR %2,SCOMPARE1 \n" - "S32C1I %0, %1, 0 \n" - :"=r"(*set) - :"r"(addr), "r"(compare), "0"(*set) - ); -#else - uint32_t old_value; - -#ifdef __XTENSA__ - // No S32C1I, so do this by disabling and re-enabling interrupts (slower) - uint32_t intlevel; - __asm__ __volatile__ ("rsil %0, " XTSTR(XCHAL_EXCM_LEVEL) "\n" - : "=r"(intlevel)); -#else - unsigned old_mstatus = RV_CLEAR_CSR(mstatus, MSTATUS_MIE); -#endif - - old_value = *addr; - if (old_value == compare) { - *addr = *set; - } - -#ifdef __XTENSA__ - __asm__ __volatile__ ("memw \n" - "wsr %0, ps\n" - :: "r"(intlevel)); - -#else - RV_SET_CSR(mstatus, old_mstatus & MSTATUS_MIE); -#endif - - *set = old_value; -#endif -} - - -void compare_and_set_extram(volatile uint32_t *addr, uint32_t compare, uint32_t *set); - -#ifdef __cplusplus -} -#endif diff --git a/components/esp_hw_support/include/soc/esp_himem.h b/components/esp_hw_support/include/soc/esp_himem.h deleted file mode 100644 index c3ac9f52eb..0000000000 --- a/components/esp_hw_support/include/soc/esp_himem.h +++ /dev/null @@ -1,2 +0,0 @@ -#warning esp_himem.h has been replaced by esp32/himem.h, please include esp32/himem.h instead -#include "esp32/himem.h" diff --git a/components/esp_hw_support/include/soc/esp_spiram.h b/components/esp_hw_support/include/soc/esp_spiram.h deleted file mode 100644 index eabd6b6b35..0000000000 --- a/components/esp_hw_support/include/soc/esp_spiram.h +++ /dev/null @@ -1,2 +0,0 @@ -#warning esp_spiram.h has been replaced by esp32/spiram.h, please include esp32/spiram.h instead -#include "esp32/spiram.h" diff --git a/components/esp_hw_support/include/soc_log.h b/components/esp_hw_support/include/soc_log.h deleted file mode 100644 index 5585aae8c5..0000000000 --- a/components/esp_hw_support/include/soc_log.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once -#include "esp_rom_sys.h" - -/** - * @file soc_log.h - * @brief SOC library logging functions - * - * To make SOC library compatible with environments which don't use ESP-IDF, - * this header file provides wrappers for logging functions. - */ - -#ifdef ESP_PLATFORM -#include "esp_log.h" -#define SOC_LOGE(tag, fmt, ...) ESP_EARLY_LOGE(tag, fmt, ##__VA_ARGS__) -#define SOC_LOGW(tag, fmt, ...) ESP_EARLY_LOGW(tag, fmt, ##__VA_ARGS__) -#define SOC_LOGI(tag, fmt, ...) ESP_EARLY_LOGI(tag, fmt, ##__VA_ARGS__) -#define SOC_LOGD(tag, fmt, ...) ESP_EARLY_LOGD(tag, fmt, ##__VA_ARGS__) -#define SOC_LOGV(tag, fmt, ...) ESP_EARLY_LOGV(tag, fmt, ##__VA_ARGS__) - -#else - -#define SOC_LOGE(tag, fmt, ...) esp_rom_printf("%s(err): " fmt, tag, ##__VA_ARGS__) -#define SOC_LOGW(tag, fmt, ...) esp_rom_printf("%s(warn): " fmt, tag, ##__VA_ARGS__) -#define SOC_LOGI(tag, fmt, ...) esp_rom_printf("%s(info): " fmt, tag, ##__VA_ARGS__) -#define SOC_LOGD(tag, fmt, ...) esp_rom_printf("%s(dbg): " fmt, tag, ##__VA_ARGS__) -#define SOC_LOGV(tag, fmt, ...) esp_rom_printf("%s: " fmt, tag, ##__VA_ARGS__) -#endif //ESP_PLATFORM diff --git a/components/esp_hw_support/include/soc/spinlock.h b/components/esp_hw_support/include/spinlock.h similarity index 98% rename from components/esp_hw_support/include/soc/spinlock.h rename to components/esp_hw_support/include/spinlock.h index ff9cbf741e..2254de40c4 100644 --- a/components/esp_hw_support/include/soc/spinlock.h +++ b/components/esp_hw_support/include/spinlock.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -9,7 +9,7 @@ #include #include "sdkconfig.h" #include "hal/cpu_hal.h" -#include "soc/compare_set.h" +#include "compare_set.h" #if __XTENSA__ #include "xtensa/xtruntime.h" diff --git a/components/esp_hw_support/mac_addr.c b/components/esp_hw_support/mac_addr.c index 65f7db4f7e..5769308c70 100644 --- a/components/esp_hw_support/mac_addr.c +++ b/components/esp_hw_support/mac_addr.c @@ -1,12 +1,12 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #include #include "sdkconfig.h" #include "esp_rom_efuse.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_efuse.h" #include "esp_efuse_table.h" diff --git a/components/esp_hw_support/port/esp32/esp_himem.c b/components/esp_hw_support/port/esp32/esp_himem.c index 061b2661aa..3bdbdf9059 100644 --- a/components/esp_hw_support/port/esp32/esp_himem.c +++ b/components/esp_hw_support/port/esp32/esp_himem.c @@ -9,7 +9,7 @@ #include "esp32/spiram.h" #include "esp32/rom/cache.h" #include "sdkconfig.h" -#include "esp32/himem.h" +#include "esp_himem.h" #include "soc/soc.h" #include "esp_log.h" #include "esp_check.h" diff --git a/components/esp_hw_support/port/esp32/rtc_clk.c b/components/esp_hw_support/port/esp32/rtc_clk.c index 977b6cf165..8c17bb50a0 100644 --- a/components/esp_hw_support/port/esp32/rtc_clk.c +++ b/components/esp_hw_support/port/esp32/rtc_clk.c @@ -24,7 +24,7 @@ #include "hal/gpio_ll.h" #include "esp_rom_sys.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "sdkconfig.h" #include "rtc_clk_common.h" @@ -287,7 +287,7 @@ uint32_t rtc_clk_apll_coeff_calc(uint32_t freq, uint32_t *_o_div, uint32_t *_sdm uint32_t rtc_xtal_freq = (uint32_t)rtc_clk_xtal_freq_get(); if (rtc_xtal_freq == 0) { // xtal_freq has not set yet - SOC_LOGE(TAG, "Get xtal clock frequency failed, it has not been set yet"); + ESP_HW_LOGE(TAG, "Get xtal clock frequency failed, it has not been set yet"); abort(); } /* Reference formula: apll_freq = xtal_freq * (4 + sdm2 + sdm1/256 + sdm0/65536) / ((o_div + 2) * 2) @@ -304,7 +304,7 @@ uint32_t rtc_clk_apll_coeff_calc(uint32_t freq, uint32_t *_o_div, uint32_t *_sdm * 350 MHz / ((31 + 2) * 2) = 5303031 Hz (for ceil) */ o_div = (int)(SOC_APLL_MULTIPLIER_OUT_MIN_HZ / (float)(freq * 2) + 1) - 2; if (o_div > 31) { - SOC_LOGE(TAG, "Expected frequency is too small"); + ESP_HW_LOGE(TAG, "Expected frequency is too small"); return 0; } if (o_div < 0) { @@ -314,7 +314,7 @@ uint32_t rtc_clk_apll_coeff_calc(uint32_t freq, uint32_t *_o_div, uint32_t *_sdm * 500 MHz / ((0 + 2) * 2) = 125000000 Hz */ o_div = (int)(SOC_APLL_MULTIPLIER_OUT_MAX_HZ / (float)(freq * 2)) - 2; if (o_div < 0) { - SOC_LOGE(TAG, "Expected frequency is too big"); + ESP_HW_LOGE(TAG, "Expected frequency is too big"); return 0; } } @@ -585,7 +585,7 @@ static void rtc_clk_cpu_freq_to_pll_mhz(int cpu_freq_mhz) dbias = DIG_DBIAS_240M; per_conf = DPORT_CPUPERIOD_SEL_240; } else { - SOC_LOGE(TAG, "invalid frequency"); + ESP_HW_LOGE(TAG, "invalid frequency"); abort(); } DPORT_REG_WRITE(DPORT_CPU_PER_CONF_REG, per_conf); @@ -644,7 +644,7 @@ void rtc_clk_cpu_freq_to_config(rtc_cpu_freq_t cpu_freq, rtc_cpu_freq_config_t* freq_mhz = 240; break; default: - SOC_LOGE(TAG, "invalid rtc_cpu_freq_t value"); + ESP_HW_LOGE(TAG, "invalid rtc_cpu_freq_t value"); abort(); } @@ -758,7 +758,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t* out_config) div = 2; freq_mhz = 240; } else { - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); abort(); } break; @@ -771,7 +771,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t* out_config) break; case RTC_CNTL_SOC_CLK_SEL_APLL: default: - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); abort(); } *out_config = (rtc_cpu_freq_config_t) { diff --git a/components/esp_hw_support/port/esp32/rtc_clk_init.c b/components/esp_hw_support/port/esp32/rtc_clk_init.c index a1790c230e..b48420846d 100644 --- a/components/esp_hw_support/port/esp32/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32/rtc_clk_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -17,7 +17,7 @@ #include "soc/syscon_reg.h" #include "hal/cpu_hal.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "sdkconfig.h" #include "rtc_clk_common.h" @@ -79,7 +79,7 @@ void rtc_clk_init(rtc_clk_config_t cfg) /* Not set yet, estimate XTAL frequency based on RTC_FAST_CLK */ xtal_freq = rtc_clk_xtal_freq_estimate(); if (xtal_freq == RTC_XTAL_FREQ_AUTO) { - SOC_LOGW(TAG, "Can't estimate XTAL frequency, assuming 26MHz"); + ESP_HW_LOGW(TAG, "Can't estimate XTAL frequency, assuming 26MHz"); xtal_freq = RTC_XTAL_FREQ_26M; } } @@ -91,7 +91,7 @@ void rtc_clk_init(rtc_clk_config_t cfg) rtc_xtal_freq_t est_xtal_freq = rtc_clk_xtal_freq_estimate(); if (est_xtal_freq != xtal_freq) { - SOC_LOGW(TAG, "Possibly invalid CONFIG_ESP32_XTAL_FREQ setting (%dMHz). Detected %d MHz.", + ESP_HW_LOGW(TAG, "Possibly invalid CONFIG_ESP32_XTAL_FREQ setting (%dMHz). Detected %d MHz.", xtal_freq, est_xtal_freq); } } @@ -106,7 +106,7 @@ void rtc_clk_init(rtc_clk_config_t cfg) bool res = rtc_clk_cpu_freq_mhz_to_config(cfg.cpu_freq_mhz, &new_config); if (!res) { - SOC_LOGE(TAG, "invalid CPU frequency value"); + ESP_HW_LOGE(TAG, "invalid CPU frequency value"); abort(); } rtc_clk_cpu_freq_set_config(&new_config); @@ -154,15 +154,15 @@ static rtc_xtal_freq_t rtc_clk_xtal_freq_estimate(void) case 21 ... 31: return RTC_XTAL_FREQ_26M; case 32 ... 33: - SOC_LOGW(TAG, "Potentially bogus XTAL frequency: %d MHz, guessing 26 MHz", freq_mhz); + ESP_HW_LOGW(TAG, "Potentially bogus XTAL frequency: %d MHz, guessing 26 MHz", freq_mhz); return RTC_XTAL_FREQ_26M; case 34 ... 35: - SOC_LOGW(TAG, "Potentially bogus XTAL frequency: %d MHz, guessing 40 MHz", freq_mhz); + ESP_HW_LOGW(TAG, "Potentially bogus XTAL frequency: %d MHz, guessing 40 MHz", freq_mhz); return RTC_XTAL_FREQ_40M; case 36 ... 45: return RTC_XTAL_FREQ_40M; default: - SOC_LOGW(TAG, "Bogus XTAL frequency: %d MHz", freq_mhz); + ESP_HW_LOGW(TAG, "Bogus XTAL frequency: %d MHz", freq_mhz); return RTC_XTAL_FREQ_AUTO; } /* Restore 8M and 8md256 clocks to original state */ diff --git a/components/esp_hw_support/port/esp32/rtc_time.c b/components/esp_hw_support/port/esp32/rtc_time.c index 95b59789ee..7142db5a86 100644 --- a/components/esp_hw_support/port/esp32/rtc_time.c +++ b/components/esp_hw_support/port/esp32/rtc_time.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -8,7 +8,7 @@ #include "esp_rom_sys.h" #include "soc/rtc.h" #include "soc/timer_periph.h" -#include "soc_log.h" +#include "esp_hw_log.h" #define MHZ (1000000) @@ -69,7 +69,7 @@ static uint32_t rtc_clk_cal_internal(rtc_cal_sel_t cal_clk, uint32_t slowclk_cyc } const uint32_t us_timer_max = TIMG_RTC_CALI_VALUE / (uint32_t) xtal_freq; if (us_time_estimate >= us_timer_max) { - SOC_LOGE(TAG, "slowclk_cycles value too large, possible overflow"); + ESP_HW_LOGE(TAG, "slowclk_cycles value too large, possible overflow"); return 0; } /* Start calibration */ diff --git a/components/esp_hw_support/port/esp32/spiram.c b/components/esp_hw_support/port/esp32/spiram.c index 651aff4e12..11a88ff84d 100644 --- a/components/esp_hw_support/port/esp32/spiram.c +++ b/components/esp_hw_support/port/esp32/spiram.c @@ -25,7 +25,7 @@ we add more types of external RAM memory, this can be made into a more intellige #include "esp_heap_caps_init.h" #include "soc/soc_memory_layout.h" #include "soc/dport_reg.h" -#include "esp32/himem.h" +#include "esp_himem.h" #include "esp32/rom/cache.h" #if CONFIG_FREERTOS_UNICORE diff --git a/components/esp_hw_support/port/esp32c2/rtc_clk.c b/components/esp_hw_support/port/esp32c2/rtc_clk.c index a1168fb6da..fb7ba04960 100644 --- a/components/esp_hw_support/port/esp32c2/rtc_clk.c +++ b/components/esp_hw_support/port/esp32c2/rtc_clk.c @@ -20,7 +20,7 @@ #include "soc/syscon_reg.h" #include "soc/system_reg.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "rtc_clk_common.h" #include "esp_rom_sys.h" @@ -179,7 +179,7 @@ static void rtc_clk_cpu_freq_to_pll_mhz(int cpu_freq_mhz) } else if (cpu_freq_mhz == 120) { per_conf = DPORT_CPUPERIOD_SEL_120; } else { - SOC_LOGE(TAG, "invalid frequency"); + ESP_HW_LOGE(TAG, "invalid frequency"); abort(); } REG_SET_FIELD(SYSTEM_CPU_PER_CONF_REG, SYSTEM_CPUPERIOD_SEL, per_conf); @@ -278,7 +278,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t *out_config) div = 4; freq_mhz = 120; } else { - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); abort(); } break; @@ -290,7 +290,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t *out_config) freq_mhz = source_freq_mhz; break; default: - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); abort(); } *out_config = (rtc_cpu_freq_config_t) { @@ -349,7 +349,7 @@ rtc_xtal_freq_t rtc_clk_xtal_freq_get(void) { uint32_t xtal_freq_reg = READ_PERI_REG(RTC_XTAL_FREQ_REG); if (!clk_val_is_valid(xtal_freq_reg)) { - SOC_LOGW(TAG, "invalid RTC_XTAL_FREQ_REG value: 0x%08x", xtal_freq_reg); + ESP_HW_LOGW(TAG, "invalid RTC_XTAL_FREQ_REG value: 0x%08x", xtal_freq_reg); return RTC_XTAL_FREQ_40M; } return reg_val_to_clk_val(xtal_freq_reg); diff --git a/components/esp_hw_support/port/esp32c2/rtc_clk_init.c b/components/esp_hw_support/port/esp32c2/rtc_clk_init.c index 53b107598d..a21954bcfe 100644 --- a/components/esp_hw_support/port/esp32c2/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32c2/rtc_clk_init.c @@ -16,7 +16,7 @@ #include "soc/efuse_periph.h" #include "hal/cpu_hal.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "sdkconfig.h" #include "rtc_clk_common.h" #include "esp_rom_uart.h" @@ -58,7 +58,7 @@ void rtc_clk_init(rtc_clk_config_t cfg) uint32_t freq_before = old_config.freq_mhz; bool res = rtc_clk_cpu_freq_mhz_to_config(cfg.cpu_freq_mhz, &new_config); if (!res) { - SOC_LOGE(TAG, "invalid CPU frequency value"); + ESP_HW_LOGE(TAG, "invalid CPU frequency value"); abort(); } rtc_clk_cpu_freq_set_config(&new_config); diff --git a/components/esp_hw_support/port/esp32c2/rtc_init.c b/components/esp_hw_support/port/esp32c2/rtc_init.c index 23b67f3cc6..9d8d256e62 100644 --- a/components/esp_hw_support/port/esp32c2/rtc_init.c +++ b/components/esp_hw_support/port/esp32c2/rtc_init.c @@ -15,7 +15,7 @@ #include "soc/extmem_reg.h" #include "soc/system_reg.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "esp_efuse.h" #include "esp_efuse_table.h" @@ -39,7 +39,7 @@ void rtc_init(rtc_config_t cfg) esp_err_t err = esp_efuse_read_field_blob(ESP_EFUSE_BLOCK2_VERSION, &rtc_calib_version, 3); if (err != ESP_OK) { rtc_calib_version = 0; - SOC_LOGW(TAG, "efuse read fail, set default rtc_calib_version: %d\n", rtc_calib_version); + ESP_HW_LOGW(TAG, "efuse read fail, set default rtc_calib_version: %d\n", rtc_calib_version); } if (rtc_calib_version == 1) { set_ocode_by_efuse(rtc_calib_version); @@ -181,7 +181,7 @@ static void calibrate_ocode(void) break; } if (cycle1 >= timeout_cycle) { - SOC_LOGW(TAG, "o_code calibration fail\n"); + ESP_HW_LOGW(TAG, "o_code calibration fail\n"); break; } } @@ -198,7 +198,7 @@ static uint32_t get_dig_dbias_by_efuse(uint8_t chip_version) esp_err_t err = esp_efuse_read_field_blob(ESP_EFUSE_DIG_DBIAS_HVT, &dig_dbias, 5); if (err != ESP_OK) { dig_dbias = 28; - SOC_LOGW(TAG, "efuse read fail, set default dig_dbias value: %d\n", dig_dbias); + ESP_HW_LOGW(TAG, "efuse read fail, set default dig_dbias value: %d\n", dig_dbias); } return dig_dbias; #endif @@ -221,7 +221,7 @@ uint32_t get_rtc_dbias_by_efuse(uint8_t chip_version, uint32_t dig_dbias) k_dig_ldo = 0; v_rtc_bias20 = 0; v_dig_bias20 = 0; - SOC_LOGW(TAG, "efuse read fail, k_rtc_ldo: %d, k_dig_ldo: %d, v_rtc_bias20: %d, v_dig_bias20: %d\n", k_rtc_ldo, k_dig_ldo, v_rtc_bias20, v_dig_bias20); + ESP_HW_LOGW(TAG, "efuse read fail, k_rtc_ldo: %d, k_dig_ldo: %d, v_rtc_bias20: %d, v_dig_bias20: %d\n", k_rtc_ldo, k_dig_ldo, v_rtc_bias20, v_dig_bias20); } k_rtc_ldo = ((k_rtc_ldo & BIT(6)) != 0)? -(k_rtc_ldo & 0x3f): k_rtc_ldo; @@ -268,11 +268,11 @@ static void set_rtc_dig_dbias() rtc_dbias = get_rtc_dbias_by_efuse(chip_version, dig_dbias); // already burn dig_dbias in efuse } else { dig_dbias = 28; - SOC_LOGD(TAG, "not burn core voltage in efuse or burn wrong voltage value in chip version: 0%d\n", chip_version); + ESP_HW_LOGD(TAG, "not burn core voltage in efuse or burn wrong voltage value in chip version: 0%d\n", chip_version); } } else { - SOC_LOGD(TAG, "chip_version is less than 3, not burn core voltage in efuse\n"); + ESP_HW_LOGD(TAG, "chip_version is less than 3, not burn core voltage in efuse\n"); } REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_EXT_RTC_DREG, rtc_dbias); REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_EXT_DIG_DREG, dig_dbias); diff --git a/components/esp_hw_support/port/esp32c3/rtc_clk.c b/components/esp_hw_support/port/esp32c3/rtc_clk.c index d568b45400..98240a9aa0 100644 --- a/components/esp_hw_support/port/esp32c3/rtc_clk.c +++ b/components/esp_hw_support/port/esp32c3/rtc_clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -20,7 +20,7 @@ #include "soc/syscon_reg.h" #include "soc/system_reg.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "rtc_clk_common.h" #include "esp_rom_sys.h" #include "hal/usb_serial_jtag_ll.h" @@ -280,7 +280,7 @@ static void rtc_clk_cpu_freq_to_pll_mhz(int cpu_freq_mhz) } else if (cpu_freq_mhz == 160) { per_conf = DPORT_CPUPERIOD_SEL_160; } else { - SOC_LOGE(TAG, "invalid frequency"); + ESP_HW_LOGE(TAG, "invalid frequency"); abort(); } REG_SET_FIELD(SYSTEM_CPU_PER_CONF_REG, SYSTEM_CPUPERIOD_SEL, per_conf); @@ -383,7 +383,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t *out_config) div = 3; freq_mhz = 160; } else { - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); abort(); } break; @@ -395,7 +395,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t *out_config) freq_mhz = source_freq_mhz; break; default: - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); abort(); } *out_config = (rtc_cpu_freq_config_t) { @@ -457,7 +457,7 @@ rtc_xtal_freq_t rtc_clk_xtal_freq_get(void) { uint32_t xtal_freq_reg = READ_PERI_REG(RTC_XTAL_FREQ_REG); if (!clk_val_is_valid(xtal_freq_reg)) { - SOC_LOGW(TAG, "invalid RTC_XTAL_FREQ_REG value: 0x%08x", xtal_freq_reg); + ESP_HW_LOGW(TAG, "invalid RTC_XTAL_FREQ_REG value: 0x%08x", xtal_freq_reg); return RTC_XTAL_FREQ_40M; } return reg_val_to_clk_val(xtal_freq_reg); diff --git a/components/esp_hw_support/port/esp32c3/rtc_clk_init.c b/components/esp_hw_support/port/esp32c3/rtc_clk_init.c index 930407d139..606d811588 100644 --- a/components/esp_hw_support/port/esp32c3/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32c3/rtc_clk_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -17,7 +17,7 @@ #include "soc/syscon_reg.h" #include "hal/cpu_hal.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "sdkconfig.h" #include "rtc_clk_common.h" #include "esp_rom_uart.h" @@ -59,7 +59,7 @@ void rtc_clk_init(rtc_clk_config_t cfg) uint32_t freq_before = old_config.freq_mhz; bool res = rtc_clk_cpu_freq_mhz_to_config(cfg.cpu_freq_mhz, &new_config); if (!res) { - SOC_LOGE(TAG, "invalid CPU frequency value"); + ESP_HW_LOGE(TAG, "invalid CPU frequency value"); abort(); } rtc_clk_cpu_freq_set_config(&new_config); diff --git a/components/esp_hw_support/port/esp32c3/rtc_init.c b/components/esp_hw_support/port/esp32c3/rtc_init.c index 388399f107..6c9a4f2d0b 100644 --- a/components/esp_hw_support/port/esp32c3/rtc_init.c +++ b/components/esp_hw_support/port/esp32c3/rtc_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -15,7 +15,7 @@ #include "soc/extmem_reg.h" #include "soc/system_reg.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "esp_efuse.h" #include "esp_efuse_table.h" @@ -53,7 +53,7 @@ void rtc_init(rtc_config_t cfg) esp_err_t err = esp_efuse_read_field_blob(ESP_EFUSE_BLOCK2_VERSION, &rtc_calib_version, 3); if (err != ESP_OK) { rtc_calib_version = 0; - SOC_LOGW(TAG, "efuse read fail, set default rtc_calib_version: %d\n", rtc_calib_version); + ESP_HW_LOGW(TAG, "efuse read fail, set default rtc_calib_version: %d\n", rtc_calib_version); } if (rtc_calib_version == 1) { set_ocode_by_efuse(rtc_calib_version); @@ -248,7 +248,7 @@ static void calibrate_ocode(void) break; } if (cycle1 >= timeout_cycle) { - SOC_LOGW(TAG, "o_code calibration fail\n"); + ESP_HW_LOGW(TAG, "o_code calibration fail\n"); break; } } @@ -262,7 +262,7 @@ static uint32_t get_dig_dbias_by_efuse(uint8_t chip_version) esp_err_t err = esp_efuse_read_field_blob(ESP_EFUSE_DIG_DBIAS_HVT, &dig_dbias, 5); if (err != ESP_OK) { dig_dbias = 28; - SOC_LOGW(TAG, "efuse read fail, set default dig_dbias value: %d\n", dig_dbias); + ESP_HW_LOGW(TAG, "efuse read fail, set default dig_dbias value: %d\n", dig_dbias); } return dig_dbias; } @@ -281,7 +281,7 @@ uint32_t get_rtc_dbias_by_efuse(uint8_t chip_version, uint32_t dig_dbias) k_dig_ldo = 0; v_rtc_bias20 = 0; v_dig_bias20 = 0; - SOC_LOGW(TAG, "efuse read fail, k_rtc_ldo: %d, k_dig_ldo: %d, v_rtc_bias20: %d, v_dig_bias20: %d\n", k_rtc_ldo, k_dig_ldo, v_rtc_bias20, v_dig_bias20); + ESP_HW_LOGW(TAG, "efuse read fail, k_rtc_ldo: %d, k_dig_ldo: %d, v_rtc_bias20: %d, v_dig_bias20: %d\n", k_rtc_ldo, k_dig_ldo, v_rtc_bias20, v_dig_bias20); } k_rtc_ldo = ((k_rtc_ldo & BIT(6)) != 0)? -(k_rtc_ldo & 0x3f): k_rtc_ldo; @@ -327,11 +327,11 @@ static void set_rtc_dig_dbias() rtc_dbias = get_rtc_dbias_by_efuse(chip_version, dig_dbias); // already burn dig_dbias in efuse } else { dig_dbias = 28; - SOC_LOGD(TAG, "not burn core voltage in efuse or burn wrong voltage value in chip version: 0%d\n", chip_version); + ESP_HW_LOGD(TAG, "not burn core voltage in efuse or burn wrong voltage value in chip version: 0%d\n", chip_version); } } else { - SOC_LOGD(TAG, "chip_version is less than 3, not burn core voltage in efuse\n"); + ESP_HW_LOGD(TAG, "chip_version is less than 3, not burn core voltage in efuse\n"); } REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_EXT_RTC_DREG, rtc_dbias); REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_EXT_DIG_DREG, dig_dbias); diff --git a/components/esp_hw_support/port/esp32h2/rtc_clk.c b/components/esp_hw_support/port/esp32h2/rtc_clk.c index 9c0c4abed5..23416af7de 100644 --- a/components/esp_hw_support/port/esp32h2/rtc_clk.c +++ b/components/esp_hw_support/port/esp32h2/rtc_clk.c @@ -21,7 +21,7 @@ #include "soc/syscon_reg.h" #include "soc/system_reg.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "rtc_clk_common.h" #include "esp_rom_sys.h" @@ -166,7 +166,7 @@ void rtc_clk_bbpll_configure(rtc_xtal_freq_t xtal_freq, int pll_freq) } else { div_ref = 0; div5_0 = 1; - SOC_LOGE(TAG, "invalid pll frequency"); + ESP_HW_LOGE(TAG, "invalid pll frequency"); } REGI2C_WRITE_MASK(I2C_BBPLL, I2C_BBPLL_OC_REF_DIV, div_ref); @@ -187,7 +187,7 @@ static void rtc_clk_cpu_freq_to_pll_mhz(int cpu_freq_mhz) if (RTC_PLL_FREQ_96M % cpu_freq_mhz == 0) { div = RTC_PLL_FREQ_96M / cpu_freq_mhz; } else { - SOC_LOGE(TAG, "invalid frequency"); + ESP_HW_LOGE(TAG, "invalid frequency"); abort(); } rtc_clk_cpu_freq_set(DPORT_SOC_CLK_SEL_PLL, div - 1); @@ -272,7 +272,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t *out_config) break; } default: { - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); abort(); } } @@ -328,7 +328,7 @@ rtc_xtal_freq_t rtc_clk_xtal_freq_get(void) { uint32_t xtal_freq_reg = READ_PERI_REG(RTC_XTAL_FREQ_REG); if (!clk_val_is_valid(xtal_freq_reg)) { - SOC_LOGW(TAG, "invalid RTC_XTAL_FREQ_REG value: 0x%08x", xtal_freq_reg); + ESP_HW_LOGW(TAG, "invalid RTC_XTAL_FREQ_REG value: 0x%08x", xtal_freq_reg); return RTC_XTAL_FREQ_32M; } return reg_val_to_clk_val(xtal_freq_reg); @@ -443,7 +443,7 @@ uint32_t root_clk_slt(uint32_t source) rtc_clk_bbpll_disable(); break; default: - SOC_LOGE(TAG, "unsupported source clk configuration"); + ESP_HW_LOGE(TAG, "unsupported source clk configuration"); root_clk_freq_mhz = RTC_XTAL_FREQ_32M; rtc_clk_bbpll_disable(); source = 0; diff --git a/components/esp_hw_support/port/esp32h2/rtc_clk_init.c b/components/esp_hw_support/port/esp32h2/rtc_clk_init.c index fe88b95c66..c237338399 100644 --- a/components/esp_hw_support/port/esp32h2/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32h2/rtc_clk_init.c @@ -20,7 +20,8 @@ #include "soc/syscon_reg.h" #include "hal/cpu_hal.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" +#include "sdkconfig.h" #include "rtc_clk_common.h" #include "esp_rom_uart.h" #include "soc/efuse_reg.h" @@ -70,7 +71,7 @@ void rtc_clk_init(rtc_clk_config_t cfg) root_clk_slt(cfg.root_clk_slt); bool res = rtc_clk_cpu_freq_mhz_to_config(cfg.cpu_freq_mhz, &new_config); if (!res) { - SOC_LOGE(TAG, "invalid CPU frequency value"); + ESP_HW_LOGE(TAG, "invalid CPU frequency value"); abort(); } rtc_clk_cpu_freq_set_config(&new_config); diff --git a/components/esp_hw_support/port/esp32h2/rtc_init.c b/components/esp_hw_support/port/esp32h2/rtc_init.c index b22c2a101c..c7fc512a0e 100644 --- a/components/esp_hw_support/port/esp32h2/rtc_init.c +++ b/components/esp_hw_support/port/esp32h2/rtc_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -17,7 +17,6 @@ #include "soc/system_reg.h" #include "soc/syscon_reg.h" #include "regi2c_ctrl.h" -#include "soc_log.h" #include "esp_efuse.h" #include "esp_efuse_table.h" #include "i2c_pmu.h" diff --git a/components/esp_hw_support/port/esp32h2/rtc_sleep.c b/components/esp_hw_support/port/esp32h2/rtc_sleep.c index a0b75b5389..4090356fda 100644 --- a/components/esp_hw_support/port/esp32h2/rtc_sleep.c +++ b/components/esp_hw_support/port/esp32h2/rtc_sleep.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -21,7 +21,7 @@ #include "regi2c_ctrl.h" #include "esp_efuse.h" #include "i2c_pmu.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "esp_rom_uart.h" #if CONFIG_IDF_TARGET_ESP32H2_BETA_VERSION_2 @@ -81,7 +81,7 @@ void dcdc_ctl(uint32_t mode) } else if (mode == 2) { REG_SET_FIELD(RTC_CNTL_DCDC_CTRL1_REG, RTC_CNTL_DCDC_MODE_SLP, RTC_CNTL_DCDC_DSLP_MODE); } else { - SOC_LOGE(TAG, "invalid dcdc mode!\n"); + ESP_HW_LOGE(TAG, "invalid dcdc mode!\n"); } } diff --git a/components/esp_hw_support/port/esp32s2/rtc_clk.c b/components/esp_hw_support/port/esp32s2/rtc_clk.c index 14ba0ec209..b9280c029f 100644 --- a/components/esp_hw_support/port/esp32s2/rtc_clk.c +++ b/components/esp_hw_support/port/esp32s2/rtc_clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -22,7 +22,7 @@ #include "soc/syscon_reg.h" #include "esp_rom_sys.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "rtc_clk_common.h" #include "sdkconfig.h" @@ -131,7 +131,7 @@ uint32_t rtc_clk_apll_coeff_calc(uint32_t freq, uint32_t *_o_div, uint32_t *_sdm uint32_t rtc_xtal_freq = (uint32_t)rtc_clk_xtal_freq_get(); if (rtc_xtal_freq == 0) { // xtal_freq has not set yet - SOC_LOGE(TAG, "Get xtal clock frequency failed, it has not been set yet"); + ESP_HW_LOGE(TAG, "Get xtal clock frequency failed, it has not been set yet"); abort(); } /* Reference formula: apll_freq = xtal_freq * (4 + sdm2 + sdm1/256 + sdm0/65536) / ((o_div + 2) * 2) @@ -148,7 +148,7 @@ uint32_t rtc_clk_apll_coeff_calc(uint32_t freq, uint32_t *_o_div, uint32_t *_sdm * 350 MHz / ((31 + 2) * 2) = 5303031 Hz (for ceil) */ o_div = (int)(SOC_APLL_MULTIPLIER_OUT_MIN_HZ / (float)(freq * 2) + 1) - 2; if (o_div > 31) { - SOC_LOGE(TAG, "Expected frequency is too small"); + ESP_HW_LOGE(TAG, "Expected frequency is too small"); return 0; } if (o_div < 0) { @@ -158,7 +158,7 @@ uint32_t rtc_clk_apll_coeff_calc(uint32_t freq, uint32_t *_o_div, uint32_t *_sdm * 500 MHz / ((0 + 2) * 2) = 125000000 Hz */ o_div = (int)(SOC_APLL_MULTIPLIER_OUT_MAX_HZ / (float)(freq * 2)) - 2; if (o_div < 0) { - SOC_LOGE(TAG, "Expected frequency is too big"); + ESP_HW_LOGE(TAG, "Expected frequency is too big"); return 0; } } @@ -315,7 +315,7 @@ void rtc_clk_bbpll_configure(rtc_xtal_freq_t xtal_freq, int pll_freq) break; } if (ext_cap == 15) { - SOC_LOGE(TAG, "BBPLL SOFTWARE CAL FAIL"); + ESP_HW_LOGE(TAG, "BBPLL SOFTWARE CAL FAIL"); abort(); } } @@ -340,7 +340,7 @@ static void rtc_clk_cpu_freq_to_pll_mhz(int cpu_freq_mhz) dbias = DIG_DBIAS_240M; per_conf = DPORT_CPUPERIOD_SEL_240; } else { - SOC_LOGE(TAG, "invalid frequency"); + ESP_HW_LOGE(TAG, "invalid frequency"); abort(); } REG_SET_FIELD(DPORT_CPU_PER_CONF_REG, DPORT_CPUPERIOD_SEL, per_conf); @@ -450,7 +450,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t* out_config) div = 2; freq_mhz = 240; } else { - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); abort(); } break; @@ -463,7 +463,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t* out_config) break; case DPORT_SOC_CLK_SEL_APLL: default: - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); abort(); } *out_config = (rtc_cpu_freq_config_t) { diff --git a/components/esp_hw_support/port/esp32s2/rtc_clk_init.c b/components/esp_hw_support/port/esp32s2/rtc_clk_init.c index 569b995112..63a880847e 100644 --- a/components/esp_hw_support/port/esp32s2/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32s2/rtc_clk_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -17,7 +17,7 @@ #include "soc/syscon_reg.h" #include "hal/cpu_hal.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "sdkconfig.h" #include "rtc_clk_common.h" @@ -57,7 +57,7 @@ void rtc_clk_init(rtc_clk_config_t cfg) uint32_t freq_before = old_config.freq_mhz; bool res = rtc_clk_cpu_freq_mhz_to_config(cfg.cpu_freq_mhz, &new_config); if (!res) { - SOC_LOGE(TAG, "invalid CPU frequency value"); + ESP_HW_LOGE(TAG, "invalid CPU frequency value"); abort(); } rtc_clk_cpu_freq_set_config(&new_config); diff --git a/components/esp_hw_support/port/esp32s2/rtc_init.c b/components/esp_hw_support/port/esp32s2/rtc_init.c index 946eed5ae6..937705aafc 100644 --- a/components/esp_hw_support/port/esp32s2/rtc_init.c +++ b/components/esp_hw_support/port/esp32s2/rtc_init.c @@ -15,7 +15,7 @@ #include "soc/extmem_reg.h" #include "regi2c_ulp.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "esp_efuse.h" #include "esp_efuse_table.h" @@ -276,7 +276,7 @@ static void calibrate_ocode(void) if (odone_flag && bg_odone_flag) break; if (cycle1 >= timeout_cycle) { - SOC_LOGW(TAG, "o_code calibration fail"); + ESP_HW_LOGW(TAG, "o_code calibration fail"); break; } } diff --git a/components/esp_hw_support/port/esp32s3/rtc_clk.c b/components/esp_hw_support/port/esp32s3/rtc_clk.c index 2d3f1d3139..13c942ba72 100644 --- a/components/esp_hw_support/port/esp32s3/rtc_clk.c +++ b/components/esp_hw_support/port/esp32s3/rtc_clk.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -22,7 +22,7 @@ #include "soc/system_reg.h" #include "esp_rom_sys.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "rtc_clk_common.h" #include "hal/usb_serial_jtag_ll.h" #include "sdkconfig.h" @@ -304,7 +304,7 @@ static void rtc_clk_cpu_freq_to_pll_mhz(int cpu_freq_mhz) dbias = DIG_DBIAS_240M; per_conf = DPORT_CPUPERIOD_SEL_240; } else { - SOC_LOGE(TAG, "invalid frequency"); + ESP_HW_LOGE(TAG, "invalid frequency"); } REGI2C_WRITE_MASK(I2C_DIG_REG, I2C_DIG_REG_EXT_DIG_DREG, dbias); wait_dig_dbias_valid(2); @@ -416,7 +416,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t *out_config) div = 2; freq_mhz = 240; } else { - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); return; } break; @@ -428,7 +428,7 @@ void rtc_clk_cpu_freq_get_config(rtc_cpu_freq_config_t *out_config) freq_mhz = source_freq_mhz; break; default: - SOC_LOGE(TAG, "unsupported frequency configuration"); + ESP_HW_LOGE(TAG, "unsupported frequency configuration"); return; } *out_config = (rtc_cpu_freq_config_t) { @@ -500,7 +500,7 @@ rtc_xtal_freq_t rtc_clk_xtal_freq_get(void) { uint32_t xtal_freq_reg = READ_PERI_REG(RTC_XTAL_FREQ_REG); if (!clk_val_is_valid(xtal_freq_reg)) { - SOC_LOGW(TAG, "invalid RTC_XTAL_FREQ_REG value: 0x%08x", xtal_freq_reg); + ESP_HW_LOGW(TAG, "invalid RTC_XTAL_FREQ_REG value: 0x%08x", xtal_freq_reg); return RTC_XTAL_FREQ_40M; } return reg_val_to_clk_val(xtal_freq_reg); diff --git a/components/esp_hw_support/port/esp32s3/rtc_clk_init.c b/components/esp_hw_support/port/esp32s3/rtc_clk_init.c index bbc878e966..8fe92ba513 100644 --- a/components/esp_hw_support/port/esp32s3/rtc_clk_init.c +++ b/components/esp_hw_support/port/esp32s3/rtc_clk_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -15,7 +15,7 @@ #include "soc/syscon_reg.h" #include "hal/cpu_hal.h" #include "regi2c_ctrl.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "rtc_clk_common.h" static const char *TAG = "rtc_clk_init"; @@ -55,7 +55,7 @@ void rtc_clk_init(rtc_clk_config_t cfg) uint32_t freq_before = old_config.freq_mhz; bool res = rtc_clk_cpu_freq_mhz_to_config(cfg.cpu_freq_mhz, &new_config); if (!res) { - SOC_LOGE(TAG, "invalid CPU frequency value"); + ESP_HW_LOGE(TAG, "invalid CPU frequency value"); abort(); } rtc_clk_cpu_freq_set_config(&new_config); diff --git a/components/esp_hw_support/port/esp32s3/rtc_init.c b/components/esp_hw_support/port/esp32s3/rtc_init.c index ed44fd7baa..f2f0edc001 100644 --- a/components/esp_hw_support/port/esp32s3/rtc_init.c +++ b/components/esp_hw_support/port/esp32s3/rtc_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -16,7 +16,7 @@ #include "soc/syscon_reg.h" #include "regi2c_ctrl.h" #include "regi2c_ulp.h" -#include "soc_log.h" +#include "esp_hw_log.h" #include "esp_err.h" #include "esp_attr.h" #include "esp_efuse.h" @@ -73,7 +73,7 @@ void rtc_init(rtc_config_t cfg) esp_err_t err = esp_efuse_read_field_blob(ESP_EFUSE_BLK_VER_MAJOR, &blk_ver_major, ESP_EFUSE_BLK_VER_MAJOR[0]->bit_count); if (err != ESP_OK) { blk_ver_major = 0; - SOC_LOGW(TAG, "efuse read fail, set default blk_ver_major: %d\n", blk_ver_major); + ESP_HW_LOGW(TAG, "efuse read fail, set default blk_ver_major: %d\n", blk_ver_major); } //default blk_ver_major will fallback to using the self-calibration way for OCode @@ -289,7 +289,7 @@ static void calibrate_ocode(void) break; } if (cycle1 >= timeout_cycle) { - SOC_LOGW(TAG, "o_code calibration fail\n"); + ESP_HW_LOGW(TAG, "o_code calibration fail\n"); break; } } diff --git a/components/esp_hw_support/port/include/esp_hw_log.h b/components/esp_hw_support/port/include/esp_hw_log.h new file mode 100644 index 0000000000..19e66ce5f7 --- /dev/null +++ b/components/esp_hw_support/port/include/esp_hw_log.h @@ -0,0 +1,33 @@ +/* + * SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once +#include "esp_rom_sys.h" + +/** + * @file esp_hw_log.h + * @brief ESP HW Support logging functions + * + * This header file provides wrappers for logging functions for libraries which may or + * may not use the ESP-IDF environment. + */ + +#ifdef ESP_PLATFORM +#include "esp_log.h" +#define ESP_HW_LOGE(tag, fmt, ...) ESP_EARLY_LOGE(tag, fmt, ##__VA_ARGS__) +#define ESP_HW_LOGW(tag, fmt, ...) ESP_EARLY_LOGW(tag, fmt, ##__VA_ARGS__) +#define ESP_HW_LOGI(tag, fmt, ...) ESP_EARLY_LOGI(tag, fmt, ##__VA_ARGS__) +#define ESP_HW_LOGD(tag, fmt, ...) ESP_EARLY_LOGD(tag, fmt, ##__VA_ARGS__) +#define ESP_HW_LOGV(tag, fmt, ...) ESP_EARLY_LOGV(tag, fmt, ##__VA_ARGS__) + +#else + +#define ESP_HW_LOGE(tag, fmt, ...) esp_rom_printf("%s(err): " fmt, tag, ##__VA_ARGS__) +#define ESP_HW_LOGW(tag, fmt, ...) esp_rom_printf("%s(warn): " fmt, tag, ##__VA_ARGS__) +#define ESP_HW_LOGI(tag, fmt, ...) esp_rom_printf("%s(info): " fmt, tag, ##__VA_ARGS__) +#define ESP_HW_LOGD(tag, fmt, ...) esp_rom_printf("%s(dbg): " fmt, tag, ##__VA_ARGS__) +#define ESP_HW_LOGV(tag, fmt, ...) esp_rom_printf("%s: " fmt, tag, ##__VA_ARGS__) +#endif //ESP_PLATFORM diff --git a/components/esp_hw_support/port/include/esp_spiram.h b/components/esp_hw_support/port/include/esp_spiram.h new file mode 100644 index 0000000000..4740964e24 --- /dev/null +++ b/components/esp_hw_support/port/include/esp_spiram.h @@ -0,0 +1,15 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/spiram.h" +#elif CONFIG_IDF_TARGET_ESP32S2 +#include "esp32s2/spiram.h" +#elif CONFIG_IDF_TARGET_ESP32S3 +#include "esp32s3/spiram.h" +#endif diff --git a/components/esp_hw_support/rtc_wdt.c b/components/esp_hw_support/rtc_wdt.c index 7ca9c5c358..648fc32f92 100644 --- a/components/esp_hw_support/rtc_wdt.c +++ b/components/esp_hw_support/rtc_wdt.c @@ -5,7 +5,7 @@ */ #include "soc/efuse_periph.h" -#include "soc/rtc_wdt.h" +#include "rtc_wdt.h" #include "soc/rtc.h" #include "hal/efuse_ll.h" diff --git a/components/esp_hw_support/test/test_himem.c b/components/esp_hw_support/test/test_himem.c index c8ac371284..3a2249b07e 100644 --- a/components/esp_hw_support/test/test_himem.c +++ b/components/esp_hw_support/test/test_himem.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -12,9 +12,9 @@ #include "esp_system.h" #include "esp32/rom/cache.h" #include "sdkconfig.h" -#include "esp32/himem.h" #if CONFIG_IDF_TARGET_ESP32 +#include "esp_himem.h" #if CONFIG_SPIRAM_BANKSWITCH_ENABLE diff --git a/components/esp_hw_support/test/test_random.c b/components/esp_hw_support/test/test_random.c index 58aed599b9..81f7707718 100644 --- a/components/esp_hw_support/test/test_random.c +++ b/components/esp_hw_support/test/test_random.c @@ -1,12 +1,12 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #include #include #include "unity.h" -#include "esp_system.h" +#include "esp_random.h" /* Note: these are just sanity tests, not the same as entropy tests diff --git a/components/esp_lcd/test_apps/i80_lcd/main/test_i80_lcd_panel.c b/components/esp_lcd/test_apps/i80_lcd/main/test_i80_lcd_panel.c index 50f7a87c10..9c7ee6524c 100644 --- a/components/esp_lcd/test_apps/i80_lcd/main/test_i80_lcd_panel.c +++ b/components/esp_lcd/test_apps/i80_lcd/main/test_i80_lcd_panel.c @@ -9,6 +9,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "unity.h" +#include "esp_random.h" #include "esp_lcd_panel_io.h" #include "esp_lcd_panel_vendor.h" #include "esp_lcd_panel_ops.h" diff --git a/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c b/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c index 12053097d2..12ae23cec5 100644 --- a/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c +++ b/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c @@ -8,7 +8,7 @@ #include "unity.h" #include "esp_lcd_panel_rgb.h" #include "esp_lcd_panel_ops.h" -#include "esp_system.h" +#include "esp_random.h" #include "test_rgb_board.h" void test_app_include_rgb_lcd(void) diff --git a/components/esp_lcd/test_apps/spi_lcd/main/test_spi_lcd_panel.c b/components/esp_lcd/test_apps/spi_lcd/main/test_spi_lcd_panel.c index 1dd8a930b4..6721605942 100644 --- a/components/esp_lcd/test_apps/spi_lcd/main/test_spi_lcd_panel.c +++ b/components/esp_lcd/test_apps/spi_lcd/main/test_spi_lcd_panel.c @@ -12,7 +12,7 @@ #include "esp_lcd_panel_io.h" #include "esp_lcd_panel_vendor.h" #include "esp_lcd_panel_ops.h" -#include "esp_system.h" +#include "esp_random.h" #include "soc/soc_caps.h" #include "test_spi_board.h" diff --git a/components/esp_netif/lwip/esp_netif_lwip.c b/components/esp_netif/lwip/esp_netif_lwip.c index d1ceb23cad..372519b6a7 100644 --- a/components/esp_netif/lwip/esp_netif_lwip.c +++ b/components/esp_netif/lwip/esp_netif_lwip.c @@ -13,6 +13,7 @@ #include "esp_netif.h" #include "esp_netif_private.h" +#include "esp_random.h" #if CONFIG_ESP_NETIF_TCPIP_LWIP diff --git a/components/esp_phy/src/phy_init.c b/components/esp_phy/src/phy_init.c index ce89b54259..a33b60450b 100644 --- a/components/esp_phy/src/phy_init.c +++ b/components/esp_phy/src/phy_init.c @@ -13,7 +13,7 @@ #include "soc/rtc.h" #include "esp_err.h" #include "esp_phy_init.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_log.h" #include "nvs.h" #include "nvs_flash.h" diff --git a/components/esp_system/eh_frame_parser.c b/components/esp_system/eh_frame_parser.c index 7dd9faee6f..5e8fefffa7 100644 --- a/components/esp_system/eh_frame_parser.c +++ b/components/esp_system/eh_frame_parser.c @@ -16,7 +16,7 @@ * http://dwarfstd.org/Download.php */ -#include "eh_frame_parser.h" +#include "esp_private/eh_frame_parser.h" #include "esp_private/panic_internal.h" #include diff --git a/components/esp_system/include/eh_frame_parser.h b/components/esp_system/include/eh_frame_parser.h deleted file mode 100644 index f99f63bb77..0000000000 --- a/components/esp_system/include/eh_frame_parser.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef EH_FRAME_PARSER_H -#define EH_FRAME_PARSER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Print backtrace for the given execution frame. - * - * @param frame_or Snapshot of the CPU registers when the program stopped its - * normal execution. This frame is usually generated on the - * stack when an exception or an interrupt occurs. - */ -void esp_eh_frame_print_backtrace(const void *frame_or); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/components/esp_system/include/esp_private/eh_frame_parser.h b/components/esp_system/include/esp_private/eh_frame_parser.h new file mode 100644 index 0000000000..a9b70aab1c --- /dev/null +++ b/components/esp_system/include/esp_private/eh_frame_parser.h @@ -0,0 +1,27 @@ +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef EH_FRAME_PARSER_H +#define EH_FRAME_PARSER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Print backtrace for the given execution frame. + * + * @param frame_or Snapshot of the CPU registers when the program stopped its + * normal execution. This frame is usually generated on the + * stack when an exception or an interrupt occurs. + */ +void esp_eh_frame_print_backtrace(const void *frame_or); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/esp_system/include/esp_system.h b/components/esp_system/include/esp_system.h index b1508fd04f..fea13af97d 100644 --- a/components/esp_system/include/esp_system.h +++ b/components/esp_system/include/esp_system.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -14,15 +14,6 @@ #include "esp_bit_defs.h" #include "esp_idf_version.h" -#include "sdkconfig.h" - -// For backward compatibility. These headers -// contains hardware operation functions and definitions -// that were originally declared in this header. -#include "esp_mac.h" -#include "esp_chip_info.h" -#include "esp_random.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/components/esp_system/int_wdt.c b/components/esp_system/int_wdt.c index a21082466f..74a3942524 100644 --- a/components/esp_system/int_wdt.c +++ b/components/esp_system/int_wdt.c @@ -16,6 +16,7 @@ #include "esp_intr_alloc.h" #include "esp_attr.h" #include "esp_log.h" +#include "esp_chip_info.h" #include "esp_freertos_hooks.h" #include "soc/timer_periph.h" #include "esp_private/periph_ctrl.h" diff --git a/components/esp_system/port/arch/riscv/panic_arch.c b/components/esp_system/port/arch/riscv/panic_arch.c index aacdad4bb3..89d8d98094 100644 --- a/components/esp_system/port/arch/riscv/panic_arch.c +++ b/components/esp_system/port/arch/riscv/panic_arch.c @@ -24,7 +24,7 @@ #endif #if CONFIG_ESP_SYSTEM_USE_EH_FRAME -#include "eh_frame_parser.h" +#include "esp_private/eh_frame_parser.h" #endif diff --git a/components/esp_system/port/cpu_start.c b/components/esp_system/port/cpu_start.c index f3b3ae38c8..ad165114a8 100644 --- a/components/esp_system/port/cpu_start.c +++ b/components/esp_system/port/cpu_start.c @@ -12,7 +12,7 @@ #include "esp_err.h" #include "esp_log.h" -#include "esp_system.h" +#include "esp_chip_info.h" #include "esp_efuse.h" #include "esp_private/cache_err_int.h" @@ -76,7 +76,6 @@ #include "soc/periph_defs.h" #include "esp_cpu.h" #include "soc/rtc.h" -#include "soc/spinlock.h" #if CONFIG_ESP32_TRAX || CONFIG_ESP32S2_TRAX || CONFIG_ESP32S3_TRAX #include "esp_private/trax.h" diff --git a/components/esp_system/port/soc/esp32s2/usb_console.c b/components/esp_system/port/soc/esp32s2/usb_console.c index 860b85f513..4750207208 100644 --- a/components/esp_system/port/soc/esp32s2/usb_console.c +++ b/components/esp_system/port/soc/esp32s2/usb_console.c @@ -1,16 +1,8 @@ -// Copyright 2019-2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include @@ -27,7 +19,6 @@ #include "soc/rtc_cntl_reg.h" #include "soc/usb_struct.h" #include "soc/usb_reg.h" -#include "soc/spinlock.h" #include "hal/soc_hal.h" #include "esp_rom_uart.h" #include "esp_rom_sys.h" diff --git a/components/esp_system/port/soc/esp32s3/usb_console.c b/components/esp_system/port/soc/esp32s3/usb_console.c index 96958769da..15b7f89ba5 100644 --- a/components/esp_system/port/soc/esp32s3/usb_console.c +++ b/components/esp_system/port/soc/esp32s3/usb_console.c @@ -1,16 +1,8 @@ -// Copyright 2019-2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include @@ -27,7 +19,7 @@ #include "soc/rtc_cntl_reg.h" #include "soc/usb_struct.h" #include "soc/usb_reg.h" -#include "soc/spinlock.h" +#include "spinlock.h" #include "hal/soc_hal.h" #include "esp_rom_uart.h" #include "esp_rom_sys.h" diff --git a/components/esp_system/stack_check.c b/components/esp_system/stack_check.c index 50822f7baa..f7ae331393 100644 --- a/components/esp_system/stack_check.c +++ b/components/esp_system/stack_check.c @@ -1,19 +1,12 @@ -// Copyright 2017 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include "sdkconfig.h" #include "esp_system.h" +#include "esp_random.h" #include "esp_rom_sys.h" #if CONFIG_COMPILER_STACK_CHECK diff --git a/components/esp_system/test/test_sleep.c b/components/esp_system/test/test_sleep.c index 1470f58fb6..42b2599023 100644 --- a/components/esp_system/test/test_sleep.c +++ b/components/esp_system/test/test_sleep.c @@ -26,6 +26,7 @@ #include "esp_rom_sys.h" #include "esp_timer.h" #include "esp_private/esp_clk.h" +#include "esp_random.h" #define ESP_EXT0_WAKEUP_LEVEL_LOW 0 #define ESP_EXT0_WAKEUP_LEVEL_HIGH 1 diff --git a/components/esp_system/test_eh_frame_parser/main.c b/components/esp_system/test_eh_frame_parser/main.c index cdde0ed341..40ca64a827 100644 --- a/components/esp_system/test_eh_frame_parser/main.c +++ b/components/esp_system/test_eh_frame_parser/main.c @@ -1,17 +1,9 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ /** * @file DWARF Exception Frames parser header @@ -30,7 +22,7 @@ #include #include #include -#include "../include/eh_frame_parser.h" +#include "../include/esp_private/eh_frame_parser.h" #include "eh_frame_parser_impl.h" /** diff --git a/components/esp_timer/src/esp_timer.c b/components/esp_timer/src/esp_timer.c index 4b3bd253db..2ea8409ebb 100644 --- a/components/esp_timer/src/esp_timer.c +++ b/components/esp_timer/src/esp_timer.c @@ -15,7 +15,6 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" -#include "soc/spinlock.h" #include "esp_timer.h" #include "esp_timer_impl.h" diff --git a/components/esp_wifi/esp32/esp_adapter.c b/components/esp_wifi/esp32/esp_adapter.c index ff9e43cc6b..36828e8b7e 100644 --- a/components/esp_wifi/esp32/esp_adapter.c +++ b/components/esp_wifi/esp32/esp_adapter.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -20,7 +20,8 @@ #include "freertos/portmacro.h" #include "freertos/xtensa_api.h" #include "esp_types.h" -#include "esp_system.h" +#include "esp_random.h" +#include "esp_mac.h" #include "esp_task.h" #include "esp_intr_alloc.h" #include "esp_attr.h" diff --git a/components/esp_wifi/esp32c3/esp_adapter.c b/components/esp_wifi/esp32c3/esp_adapter.c index 48295bc341..a5e52a62b9 100644 --- a/components/esp_wifi/esp32c3/esp_adapter.c +++ b/components/esp_wifi/esp32c3/esp_adapter.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -20,7 +20,8 @@ #include "riscv/interrupt.h" #include "riscv/riscv_interrupts.h" #include "esp_types.h" -#include "esp_system.h" +#include "esp_random.h" +#include "esp_mac.h" #include "esp_task.h" #include "esp_intr_alloc.h" #include "esp_attr.h" diff --git a/components/esp_wifi/esp32s2/esp_adapter.c b/components/esp_wifi/esp32s2/esp_adapter.c index 2770cedcc9..8924b29a2f 100644 --- a/components/esp_wifi/esp32s2/esp_adapter.c +++ b/components/esp_wifi/esp32s2/esp_adapter.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -20,7 +20,8 @@ #include "freertos/portmacro.h" #include "freertos/xtensa_api.h" #include "esp_types.h" -#include "esp_system.h" +#include "esp_random.h" +#include "esp_mac.h" #include "esp_task.h" #include "esp_intr_alloc.h" #include "esp_attr.h" diff --git a/components/esp_wifi/esp32s3/esp_adapter.c b/components/esp_wifi/esp32s3/esp_adapter.c index c782b96298..f2ce2614bd 100644 --- a/components/esp_wifi/esp32s3/esp_adapter.c +++ b/components/esp_wifi/esp32s3/esp_adapter.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -19,7 +19,8 @@ #include "freertos/portmacro.h" #include "freertos/xtensa_api.h" #include "esp_types.h" -#include "esp_system.h" +#include "esp_random.h" +#include "esp_mac.h" #include "esp_task.h" #include "esp_intr_alloc.h" #include "esp_attr.h" diff --git a/components/esp_wifi/test/test_wifi.c b/components/esp_wifi/test/test_wifi.c index 256d53f32a..f186086e1f 100644 --- a/components/esp_wifi/test/test_wifi.c +++ b/components/esp_wifi/test/test_wifi.c @@ -12,7 +12,7 @@ #include "string.h" #include "unity.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_event.h" #include "esp_wifi.h" #include "esp_wifi_types.h" diff --git a/components/espcoredump/include_core_dump/esp_core_dump_common.h b/components/espcoredump/include_core_dump/esp_core_dump_common.h index 5362a27cc2..8915db228e 100644 --- a/components/espcoredump/include_core_dump/esp_core_dump_common.h +++ b/components/espcoredump/include_core_dump/esp_core_dump_common.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -7,7 +7,6 @@ #define ESP_CORE_DUMP_COMMON_H_ #include "freertos/FreeRTOS.h" -#include "esp_debug_helpers.h" #include "esp_app_format.h" #include "esp_core_dump_types.h" diff --git a/components/espcoredump/include_core_dump/esp_core_dump_port.h b/components/espcoredump/include_core_dump/esp_core_dump_port.h index c643201f8f..c73e86b035 100644 --- a/components/espcoredump/include_core_dump/esp_core_dump_port.h +++ b/components/espcoredump/include_core_dump/esp_core_dump_port.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -18,7 +18,6 @@ #include "sdkconfig.h" #include "freertos/FreeRTOS.h" -#include "esp_debug_helpers.h" #include "esp_app_format.h" #include "esp_core_dump_types.h" #include "esp_core_dump_port_impl.h" diff --git a/components/fatfs/test/test_fatfs_sdmmc.c b/components/fatfs/test/test_fatfs_sdmmc.c index 5cbe96ffe0..2c5c937049 100644 --- a/components/fatfs/test/test_fatfs_sdmmc.c +++ b/components/fatfs/test/test_fatfs_sdmmc.c @@ -12,7 +12,7 @@ #include #include "unity.h" #include "esp_log.h" -#include "esp_system.h" +#include "esp_random.h" #include "esp_vfs.h" #include "esp_vfs_fat.h" #include "freertos/FreeRTOS.h" diff --git a/components/fatfs/test/test_fatfs_spiflash.c b/components/fatfs/test/test_fatfs_spiflash.c index 6f1e052fdf..df8db0457a 100644 --- a/components/fatfs/test/test_fatfs_spiflash.c +++ b/components/fatfs/test/test_fatfs_spiflash.c @@ -1,16 +1,8 @@ -// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include @@ -21,7 +13,7 @@ #include "unity.h" #include "test_utils.h" #include "esp_log.h" -#include "esp_system.h" +#include "esp_random.h" #include "esp_vfs.h" #include "esp_vfs_fat.h" #include "freertos/FreeRTOS.h" diff --git a/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h index 9c58efd791..60044fbb1d 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h @@ -42,7 +42,7 @@ #include #include #include -#include "soc/spinlock.h" +#include "spinlock.h" #include "soc/interrupt_core0_reg.h" #include "esp_macro.h" #include "esp_attr.h" diff --git a/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c b/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c index 30c13faab1..f036e72bb6 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c +++ b/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c @@ -50,7 +50,6 @@ #include "esp_attr.h" #include "esp_system.h" #include "esp_intr_alloc.h" -#include "esp_debug_helpers.h" #include "esp_log.h" #include "FreeRTOS.h" /* This pulls in portmacro.h */ #include "task.h" diff --git a/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h index b016f8c9df..a0368670c6 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h @@ -71,7 +71,7 @@ #include /* required for xthal_get_ccount. [refactor-todo] use cpu_hal instead */ #include /* required for XTOS_SET_INTLEVEL. [refactor-todo] add common intr functions to esp_hw_support */ #include "xt_instr_macros.h" -#include "soc/spinlock.h" +#include "spinlock.h" #include "hal/cpu_hal.h" #include "esp_private/crosscore_int.h" #include "esp_macro.h" diff --git a/components/freertos/test/test_xtensa_loadstore_handler.c b/components/freertos/test/test_xtensa_loadstore_handler.c index 4e436be63f..cbfc2774c5 100644 --- a/components/freertos/test/test_xtensa_loadstore_handler.c +++ b/components/freertos/test/test_xtensa_loadstore_handler.c @@ -1,3 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + /* Test for LoadStore exception handlers. This test performs unaligned load and store in 32bit aligned addresses */ @@ -6,7 +12,7 @@ #include #include #include "sdkconfig.h" -#include "esp_system.h" +#include "esp_random.h" #include "unity.h" #if CONFIG_IDF_TARGET_ARCH_XTENSA diff --git a/components/hal/esp32/include/hal/cpu_ll.h b/components/hal/esp32/include/hal/cpu_ll.h index 49d2e3947d..6b853cdbe7 100644 --- a/components/hal/esp32/include/hal/cpu_ll.h +++ b/components/hal/esp32/include/hal/cpu_ll.h @@ -1,16 +1,8 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #include @@ -183,6 +175,16 @@ static inline void cpu_ll_waiti(void) asm volatile ("waiti 0\n"); } +static inline void cpu_ll_compare_and_set_native(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ + __asm__ __volatile__ ( + "WSR %2,SCOMPARE1 \n" + "S32C1I %0, %1, 0 \n" + :"=r"(*set) + :"r"(addr), "r"(compare), "0"(*set) + ); +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32c2/include/hal/cpu_ll.h b/components/hal/esp32c2/include/hal/cpu_ll.h index bb3332b0f3..7ccffb1550 100644 --- a/components/hal/esp32c2/include/hal/cpu_ll.h +++ b/components/hal/esp32c2/include/hal/cpu_ll.h @@ -232,6 +232,21 @@ static inline void cpu_ll_write_dedic_gpio_mask(uint32_t mask, uint32_t value) RV_CLEAR_CSR(CSR_GPIO_OUT_USER, mask & ~(value)); } +static inline void cpu_ll_compare_and_set_native(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ + uint32_t old_value; + unsigned old_mstatus = RV_CLEAR_CSR(mstatus, MSTATUS_MIE); + + old_value = *addr; + if (old_value == compare) { + *addr = *set; + } + + RV_SET_CSR(mstatus, old_mstatus & MSTATUS_MIE); + + *set = old_value; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32c3/include/hal/cpu_ll.h b/components/hal/esp32c3/include/hal/cpu_ll.h index bb3332b0f3..7ccffb1550 100644 --- a/components/hal/esp32c3/include/hal/cpu_ll.h +++ b/components/hal/esp32c3/include/hal/cpu_ll.h @@ -232,6 +232,21 @@ static inline void cpu_ll_write_dedic_gpio_mask(uint32_t mask, uint32_t value) RV_CLEAR_CSR(CSR_GPIO_OUT_USER, mask & ~(value)); } +static inline void cpu_ll_compare_and_set_native(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ + uint32_t old_value; + unsigned old_mstatus = RV_CLEAR_CSR(mstatus, MSTATUS_MIE); + + old_value = *addr; + if (old_value == compare) { + *addr = *set; + } + + RV_SET_CSR(mstatus, old_mstatus & MSTATUS_MIE); + + *set = old_value; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32h2/include/hal/cpu_ll.h b/components/hal/esp32h2/include/hal/cpu_ll.h index 41c59ea47c..023e57185a 100644 --- a/components/hal/esp32h2/include/hal/cpu_ll.h +++ b/components/hal/esp32h2/include/hal/cpu_ll.h @@ -225,6 +225,21 @@ static inline void cpu_ll_write_dedic_gpio_mask(uint32_t mask, uint32_t value) RV_CLEAR_CSR(CSR_GPIO_OUT_USER, mask & ~(value)); } +static inline void cpu_ll_compare_and_set_native(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ + uint32_t old_value; + unsigned old_mstatus = RV_CLEAR_CSR(mstatus, MSTATUS_MIE); + + old_value = *addr; + if (old_value == compare) { + *addr = *set; + } + + RV_SET_CSR(mstatus, old_mstatus & MSTATUS_MIE); + + *set = old_value; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32s2/include/hal/cpu_ll.h b/components/hal/esp32s2/include/hal/cpu_ll.h index ded1ca3ab4..131d5e5823 100644 --- a/components/hal/esp32s2/include/hal/cpu_ll.h +++ b/components/hal/esp32s2/include/hal/cpu_ll.h @@ -1,16 +1,8 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #include @@ -23,6 +15,7 @@ #include "xtensa/config/extreg.h" #include "esp_bit_defs.h" #include "xtensa/config/core.h" +#include "xtensa/xtruntime.h" #ifdef __cplusplus extern "C" { @@ -202,6 +195,27 @@ static inline void cpu_ll_waiti(void) asm volatile ("waiti 0\n"); } +static inline void cpu_ll_compare_and_set_native(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ + uint32_t old_value; + + // No S32C1I, so do this by disabling and re-enabling interrupts (slower) + uint32_t intlevel; + __asm__ __volatile__ ("rsil %0, " XTSTR(XCHAL_EXCM_LEVEL) "\n" + : "=r"(intlevel)); + + old_value = *addr; + if (old_value == compare) { + *addr = *set; + } + + __asm__ __volatile__ ("memw \n" + "wsr %0, ps\n" + :: "r"(intlevel)); + + *set = old_value; +} + #ifdef __cplusplus } #endif diff --git a/components/hal/esp32s3/include/hal/cpu_ll.h b/components/hal/esp32s3/include/hal/cpu_ll.h index 284e86757d..c383a8b445 100644 --- a/components/hal/esp32s3/include/hal/cpu_ll.h +++ b/components/hal/esp32s3/include/hal/cpu_ll.h @@ -1,16 +1,8 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once #include @@ -206,6 +198,16 @@ static inline void cpu_ll_write_dedic_gpio_mask(uint32_t mask, uint32_t value) asm volatile("ee.wr_mask_gpio_out %0, %1" : : "r"(value), "r"(mask):); } +static inline void cpu_ll_compare_and_set_native(volatile uint32_t *addr, uint32_t compare, uint32_t *set) +{ + __asm__ __volatile__ ( + "WSR %2,SCOMPARE1 \n" + "S32C1I %0, %1, 0 \n" + :"=r"(*set) + :"r"(addr), "r"(compare), "0"(*set) + ); +} + #ifdef __cplusplus } #endif diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index 89f7210645..c7eada4a28 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -15,7 +15,7 @@ #include #include #include "esp_task.h" -#include "esp_system.h" +#include "esp_random.h" #include "sdkconfig.h" #include "netif/dhcp_state.h" #include "sntp/sntp_get_set_time.h" diff --git a/components/mbedtls/port/esp_hardware.c b/components/mbedtls/port/esp_hardware.c index 3244c06644..6376ca8f8c 100644 --- a/components/mbedtls/port/esp_hardware.c +++ b/components/mbedtls/port/esp_hardware.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include "esp_random.h" #include diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c index 44df1db970..8b47b3c35a 100644 --- a/components/mdns/mdns.c +++ b/components/mdns/mdns.c @@ -15,6 +15,8 @@ #include "mdns.h" #include "mdns_private.h" #include "mdns_networking.h" +#include "esp_log.h" +#include "esp_random.h" #ifdef MDNS_ENABLE_DEBUG void mdns_debug_packet(const uint8_t * data, size_t len); diff --git a/components/mdns/test_afl_fuzz_host/esp32_mock.h b/components/mdns/test_afl_fuzz_host/esp32_mock.h index b5187cb0c8..8afe01fba4 100644 --- a/components/mdns/test_afl_fuzz_host/esp32_mock.h +++ b/components/mdns/test_afl_fuzz_host/esp32_mock.h @@ -52,7 +52,7 @@ #define ESP_LOGV(a,b,c,d) #define LWIP_HDR_PBUF_H -#define __ESP_SYSTEM_H__ +#define __ESP_RANDOM_H__ #define INC_TASK_H #define pdMS_TO_TICKS(a) a diff --git a/components/mqtt/esp-mqtt b/components/mqtt/esp-mqtt index 985078affa..0eda78e9b7 160000 --- a/components/mqtt/esp-mqtt +++ b/components/mqtt/esp-mqtt @@ -1 +1 @@ -Subproject commit 985078affa8a2d2b56b87c8e6455252850f895c6 +Subproject commit 0eda78e9b7cf008cd91aeccd734e2db195c6dd22 diff --git a/components/mqtt/test/test_mqtt.c b/components/mqtt/test/test_mqtt.c index e103b59d20..f2c27b0db8 100644 --- a/components/mqtt/test/test_mqtt.c +++ b/components/mqtt/test/test_mqtt.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 * @@ -22,6 +22,7 @@ #include "sdkconfig.h" #include "test_mqtt_client_broker.h" #include "test_mqtt_connection.h" +#include "esp_mac.h" static void test_leak_setup(const char * file, long line) { diff --git a/components/mqtt/test/test_mqtt_client_broker.c b/components/mqtt/test/test_mqtt_client_broker.c index 167a00752b..cb0f3ae017 100644 --- a/components/mqtt/test/test_mqtt_client_broker.c +++ b/components/mqtt/test/test_mqtt_client_broker.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -7,6 +7,7 @@ #include "freertos/event_groups.h" #include "mqtt_client.h" #include "esp_log.h" +#include "esp_mac.h" #define WAIT_FOR_EVENT(event) \ TEST_ASSERT_TRUE(xEventGroupWaitBits(s_event_group, event, pdTRUE, pdTRUE, pdMS_TO_TICKS(COMMON_OPERATION_TIMEOUT)) & event); diff --git a/components/newlib/random.c b/components/newlib/random.c index 5d3e6175c8..6225fff479 100644 --- a/components/newlib/random.c +++ b/components/newlib/random.c @@ -1,23 +1,15 @@ -// Copyright 2018 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include #include #include #include -#include "esp_system.h" +#include "esp_random.h" #include "esp_log.h" static const char *TAG = "RANDOM"; diff --git a/components/protocomm/src/transports/protocomm_httpd.c b/components/protocomm/src/transports/protocomm_httpd.c index ffb0d39d1c..3e8ed8449c 100644 --- a/components/protocomm/src/transports/protocomm_httpd.c +++ b/components/protocomm/src/transports/protocomm_httpd.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -8,6 +8,7 @@ #include #include #include +#include "esp_random.h" #include diff --git a/components/pthread/test/test_pthread_local_storage.c b/components/pthread/test/test_pthread_local_storage.c index 98e6fd7d99..d6d7678dad 100644 --- a/components/pthread/test/test_pthread_local_storage.c +++ b/components/pthread/test/test_pthread_local_storage.c @@ -4,7 +4,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "test_utils.h" -#include "esp_system.h" +#include "esp_random.h" TEST_CASE("pthread local storage basics", "[pthread]") { diff --git a/components/touch_element/test/test_touch_button.c b/components/touch_element/test/test_touch_button.c index 5bbd728b9f..a8f6739696 100644 --- a/components/touch_element/test/test_touch_button.c +++ b/components/touch_element/test/test_touch_button.c @@ -7,6 +7,7 @@ #include "freertos/queue.h" #include "freertos/semphr.h" #include "unity.h" +#include "esp_random.h" #include "touch_element/touch_element_private.h" #include "touch_element/touch_button.h" diff --git a/components/vfs/vfs_eventfd.c b/components/vfs/vfs_eventfd.c index 726a0b13a9..cc1a1cbc0d 100644 --- a/components/vfs/vfs_eventfd.c +++ b/components/vfs/vfs_eventfd.c @@ -1,16 +1,8 @@ -// Copyright 2021 Espressif Systems (Shanghai) CO LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License +/* + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include "esp_vfs_eventfd.h" @@ -29,7 +21,7 @@ #include "esp_vfs.h" #include "freertos/FreeRTOS.h" #include "freertos/portmacro.h" -#include "soc/spinlock.h" +#include "spinlock.h" #define FD_INVALID -1 #define FD_PENDING_SELECT -2 diff --git a/components/wear_levelling/WL_Flash.cpp b/components/wear_levelling/WL_Flash.cpp index c1131d5a06..9f81e08315 100644 --- a/components/wear_levelling/WL_Flash.cpp +++ b/components/wear_levelling/WL_Flash.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ #include -#include "esp_system.h" +#include "esp_random.h" #include "esp_log.h" #include "WL_Flash.h" #include diff --git a/components/wpa_supplicant/port/os_xtensa.c b/components/wpa_supplicant/port/os_xtensa.c index 53ed080ca8..db1991f0d9 100644 --- a/components/wpa_supplicant/port/os_xtensa.c +++ b/components/wpa_supplicant/port/os_xtensa.c @@ -27,7 +27,7 @@ #include #include #include -#include "esp_system.h" +#include "esp_random.h" #include "utils/common.h" #include "mbedtls/platform_util.h" diff --git a/docs/doxygen/Doxyfile_esp32 b/docs/doxygen/Doxyfile_esp32 index e78a8de59d..3d5cd6fd13 100644 --- a/docs/doxygen/Doxyfile_esp32 +++ b/docs/doxygen/Doxyfile_esp32 @@ -8,7 +8,7 @@ INPUT += \ $(PROJECT_PATH)/components/soc/$(IDF_TARGET)/include/soc/rtc_io_channel.h \ $(PROJECT_PATH)/components/soc/$(IDF_TARGET)/include/soc/touch_sensor_channel.h \ $(PROJECT_PATH)/components/driver/$(IDF_TARGET)/include/driver/touch_sensor.h \ - $(PROJECT_PATH)/components/esp_hw_support/include/soc/esp32/himem.h \ + $(PROJECT_PATH)/components/esp_hw_support/include/esp_himem.h \ $(PROJECT_PATH)/components/ulp/ulp_fsm/include/$(IDF_TARGET)/ulp.h \ $(PROJECT_PATH)/components/ulp/ulp_common/include/$(IDF_TARGET)/ulp_common_defs.h \ $(PROJECT_PATH)/components/esp_system/include/esp_ipc.h \ diff --git a/docs/en/api-reference/system/himem.rst b/docs/en/api-reference/system/himem.rst index 00529485d5..1de6c75973 100644 --- a/docs/en/api-reference/system/himem.rst +++ b/docs/en/api-reference/system/himem.rst @@ -30,4 +30,4 @@ An example doing a simple memory test of the high memory range is available in e API Reference ------------- -.. include-build-file:: inc/himem.inc +.. include-build-file:: inc/esp_himem.inc diff --git a/docs/en/migration-guides/system.rst b/docs/en/migration-guides/system.rst index 2810604741..8459bd70a2 100644 --- a/docs/en/migration-guides/system.rst +++ b/docs/en/migration-guides/system.rst @@ -40,6 +40,15 @@ ESP HW Support - The header files ``soc/cpu.h`` have been deleted and deprecated CPU util functions have been removed. ESP-IDF developers should include ``esp_cpu.h`` instead for equivalent functions. - The header file ``esp_intr.h`` has been deleted. Please include ``esp_intr_alloc.h`` to allocate and manipulate interrupts. - The header file ``esp_panic.h`` has been deleted. ESP-IDF developers should include ``esp_private/panic_reason.h`` to get supported panic reasons. And should include ``esp_debug_helpers.h`` to use any debug related helper functions, e.g. print backtrace. +- The header file ``soc_log.h`` is now renamed to ``esp_hw_log.h`` and all logging macros have been updated from ``SOC_LOGx`` to ``ESP_HW_LOGx``. ESP-IDF users must use the later form. +- The header file ``esp_spiram.h`` file is deleted. Users should use the ``/spiram.h`` file instead. +- The header file ``esp32/himem.h`` file is deleted. Users should use the esp_himem.h file instead. +- The header files ``spinlock.h``, ``clk_ctrl_os.h`` and ``rtc_wdt.h`` must now be included without the ``soc`` prefix. Eg:- ``#include "spinlock.h"``. + +ESP System +---------- +- The header files ``esp_random.h``, ``esp_mac.h`` and ``esp_chip_info.h``, which were all previously indirectly included via the header file ``esp_system.h``, must now be included directly. These headers are removed from ``esp_system.h``. +- The header file ``eh_frame_parser.h`` must now be included with a ``esp_private`` prefix like ``#include "esp_private/eh_frame_parser.h"``. SOC dependency -------------- diff --git a/examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_mesh.c b/examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_mesh.c index b2d38f9022..80a72e6993 100644 --- a/examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_mesh.c +++ b/examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_mesh.c @@ -1,22 +1,15 @@ // Copyright (C) 2018-2020 Alibaba Group Holding Limited -// Adaptations to ESP-IDF Copyright (c) 2020 Espressif Systems (Shanghai) Co. Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include #include "esp_log.h" +#include "esp_random.h" #include "nvs_flash.h" #include "esp_ble_mesh_defs.h" diff --git a/examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_model_srv.c b/examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_model_srv.c index 30e79fdf3a..abf5893a96 100644 --- a/examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_model_srv.c +++ b/examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_model_srv.c @@ -1,22 +1,15 @@ // Copyright (C) 2018-2020 Alibaba Group Holding Limited -// Adaptations to ESP-IDF Copyright (c) 2020 Espressif Systems (Shanghai) Co. Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include #include "esp_log.h" +#include "esp_random.h" #include "nvs_flash.h" #include "esp_ble_mesh_defs.h" diff --git a/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/aligenie_demo.c b/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/aligenie_demo.c index 7fa961c5ef..0d54379329 100644 --- a/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/aligenie_demo.c +++ b/examples/bluetooth/esp_ble_mesh/aligenie_demo/main/aligenie_demo.c @@ -12,6 +12,7 @@ #include #include "esp_log.h" +#include "esp_mac.h" #include "nvs_flash.h" #include "mbedtls/sha256.h" diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/main/coex_cmd.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/main/coex_cmd.c index 0dda534810..c35adcfa2a 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/main/coex_cmd.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/main/coex_cmd.c @@ -1,7 +1,7 @@ /* * ESP BLE Mesh Example * - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -9,6 +9,7 @@ #include #include #include "esp_log.h" +#include "esp_mac.h" #include "esp_console.h" #include "argtable3/argtable3.h" diff --git a/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c b/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c index 4fa3240b1c..6fbff80eb5 100644 --- a/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c +++ b/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -9,7 +9,7 @@ #include #include "esp_log.h" #include "esp_console.h" -#include "esp_system.h" +#include "esp_chip_info.h" #include "esp_sleep.h" #include "esp_spi_flash.h" #include "driver/rtc_io.h" diff --git a/examples/build_system/cmake/idf_as_lib/main.c b/examples/build_system/cmake/idf_as_lib/main.c index 9eb73f55ef..f61f972f2a 100644 --- a/examples/build_system/cmake/idf_as_lib/main.c +++ b/examples/build_system/cmake/idf_as_lib/main.c @@ -9,7 +9,7 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "esp_system.h" +#include "esp_chip_info.h" #include "esp_spi_flash.h" void app_main(void) diff --git a/examples/ethernet/iperf/main/cmd_ethernet.c b/examples/ethernet/iperf/main/cmd_ethernet.c index e9999eda69..9d1a4dadcf 100644 --- a/examples/ethernet/iperf/main/cmd_ethernet.c +++ b/examples/ethernet/iperf/main/cmd_ethernet.c @@ -15,6 +15,7 @@ #include "esp_console.h" #include "esp_event.h" #include "esp_eth.h" +#include "esp_mac.h" #include "driver/gpio.h" #include "argtable3/argtable3.h" #include "iperf.h" diff --git a/examples/get-started/hello_world/main/hello_world_main.c b/examples/get-started/hello_world/main/hello_world_main.c index ebc5eb0b04..63d5665b8e 100644 --- a/examples/get-started/hello_world/main/hello_world_main.c +++ b/examples/get-started/hello_world/main/hello_world_main.c @@ -10,7 +10,7 @@ #include "sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "esp_system.h" +#include "esp_chip_info.h" #include "esp_spi_flash.h" void app_main(void) diff --git a/examples/mesh/internal_communication/main/mesh_main.c b/examples/mesh/internal_communication/main/mesh_main.c index a05d9a58ba..79930a2cf3 100644 --- a/examples/mesh/internal_communication/main/mesh_main.c +++ b/examples/mesh/internal_communication/main/mesh_main.c @@ -8,7 +8,7 @@ */ #include #include "esp_wifi.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_event.h" #include "esp_log.h" #include "esp_mesh.h" diff --git a/examples/mesh/ip_internal_network/main/mesh_main.c b/examples/mesh/ip_internal_network/main/mesh_main.c index 9d09d49fe8..a838c7813d 100644 --- a/examples/mesh/ip_internal_network/main/mesh_main.c +++ b/examples/mesh/ip_internal_network/main/mesh_main.c @@ -8,7 +8,7 @@ */ #include #include "esp_wifi.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_event.h" #include "esp_log.h" #include "esp_mesh.h" diff --git a/examples/mesh/ip_internal_network/main/mesh_netif.c b/examples/mesh/ip_internal_network/main/mesh_netif.c index 1f5723693a..f9a1c4c1a5 100644 --- a/examples/mesh/ip_internal_network/main/mesh_netif.c +++ b/examples/mesh/ip_internal_network/main/mesh_netif.c @@ -11,6 +11,7 @@ #include "esp_log.h" #include #include "esp_mesh.h" +#include "esp_mac.h" #include "lwip/lwip_napt.h" #include "esp_wifi_netif.h" #include "mesh_netif.h" diff --git a/examples/mesh/manual_networking/main/mesh_main.c b/examples/mesh/manual_networking/main/mesh_main.c index ff419acc42..241301cc71 100644 --- a/examples/mesh/manual_networking/main/mesh_main.c +++ b/examples/mesh/manual_networking/main/mesh_main.c @@ -8,7 +8,7 @@ */ #include #include "esp_wifi.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_event.h" #include "esp_log.h" #include "esp_mesh.h" diff --git a/examples/protocols/http_server/captive_portal/main/main.c b/examples/protocols/http_server/captive_portal/main/main.c index a6cd33c368..1712f6e042 100644 --- a/examples/protocols/http_server/captive_portal/main/main.c +++ b/examples/protocols/http_server/captive_portal/main/main.c @@ -11,7 +11,7 @@ #include "esp_event.h" #include "esp_log.h" -#include "esp_system.h" +#include "esp_mac.h" #include "nvs_flash.h" #include "esp_wifi.h" diff --git a/examples/protocols/http_server/restful_server/main/rest_server.c b/examples/protocols/http_server/restful_server/main/rest_server.c index d68bd0a0aa..23f90ad83c 100644 --- a/examples/protocols/http_server/restful_server/main/rest_server.c +++ b/examples/protocols/http_server/restful_server/main/rest_server.c @@ -9,7 +9,8 @@ #include #include #include "esp_http_server.h" -#include "esp_system.h" +#include "esp_chip_info.h" +#include "esp_random.h" #include "esp_log.h" #include "esp_vfs.h" #include "cJSON.h" diff --git a/examples/protocols/mdns/main/mdns_example_main.c b/examples/protocols/mdns/main/mdns_example_main.c index 0b5e962458..c1db88ba09 100644 --- a/examples/protocols/mdns/main/mdns_example_main.c +++ b/examples/protocols/mdns/main/mdns_example_main.c @@ -10,7 +10,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_netif_ip_addr.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_event.h" #include "esp_log.h" #include "nvs_flash.h" diff --git a/examples/security/flash_encryption/main/flash_encrypt_main.c b/examples/security/flash_encryption/main/flash_encrypt_main.c index fad5debd7b..9a26c1bb2a 100644 --- a/examples/security/flash_encryption/main/flash_encrypt_main.c +++ b/examples/security/flash_encryption/main/flash_encrypt_main.c @@ -11,7 +11,7 @@ #include "freertos/task.h" #include "soc/efuse_reg.h" #include "esp_efuse.h" -#include "esp_system.h" +#include "esp_chip_info.h" #include "esp_spi_flash.h" #include "esp_partition.h" #include "esp_flash_encrypt.h" diff --git a/examples/system/base_mac_address/main/base_mac_address_example_main.c b/examples/system/base_mac_address/main/base_mac_address_example_main.c index 60cdd71aa5..b59c19eae2 100644 --- a/examples/system/base_mac_address/main/base_mac_address_example_main.c +++ b/examples/system/base_mac_address/main/base_mac_address_example_main.c @@ -10,7 +10,7 @@ #include #include #include "esp_log.h" -#include "esp_system.h" +#include "esp_mac.h" #define TAG "BASE_MAC" diff --git a/examples/system/console/advanced/components/cmd_system/cmd_system.c b/examples/system/console/advanced/components/cmd_system/cmd_system.c index 01a849fb92..47fbc2808f 100644 --- a/examples/system/console/advanced/components/cmd_system/cmd_system.c +++ b/examples/system/console/advanced/components/cmd_system/cmd_system.c @@ -13,7 +13,7 @@ #include #include "esp_log.h" #include "esp_console.h" -#include "esp_system.h" +#include "esp_chip_info.h" #include "esp_sleep.h" #include "esp_spi_flash.h" #include "driver/rtc_io.h" diff --git a/examples/system/heap_task_tracking/main/heap_task_tracking_main.c b/examples/system/heap_task_tracking/main/heap_task_tracking_main.c index 6be040ac7b..a01868c0fc 100644 --- a/examples/system/heap_task_tracking/main/heap_task_tracking_main.c +++ b/examples/system/heap_task_tracking/main/heap_task_tracking_main.c @@ -11,6 +11,7 @@ #include "freertos/task.h" #include "esp_heap_task_info.h" #include "esp_log.h" +#include "esp_random.h" #define MAX_TASK_NUM 20 // Max number of per tasks info that it can store diff --git a/examples/system/himem/main/himem_example_main.c b/examples/system/himem/main/himem_example_main.c index 38c1f22622..5329c27e97 100644 --- a/examples/system/himem/main/himem_example_main.c +++ b/examples/system/himem/main/himem_example_main.c @@ -17,7 +17,7 @@ #include "esp_heap_caps.h" #include "esp32/spiram.h" #include "sdkconfig.h" -#include "esp32/himem.h" +#include "esp_himem.h" //Fill memory with pseudo-random data generated from the given seed. diff --git a/examples/system/unit_test/main/example_unit_test_main.c b/examples/system/unit_test/main/example_unit_test_main.c index 627cd420a6..bd0199f7d2 100644 --- a/examples/system/unit_test/main/example_unit_test_main.c +++ b/examples/system/unit_test/main/example_unit_test_main.c @@ -8,7 +8,7 @@ */ #include -#include "esp_system.h" +#include "esp_random.h" #include "testable.h" /* This application has a test subproject in 'test' directory, all the diff --git a/examples/wifi/espnow/main/espnow_example_main.c b/examples/wifi/espnow/main/espnow_example_main.c index 75ae4e669b..6b5c42b0e5 100644 --- a/examples/wifi/espnow/main/espnow_example_main.c +++ b/examples/wifi/espnow/main/espnow_example_main.c @@ -24,7 +24,7 @@ #include "esp_netif.h" #include "esp_wifi.h" #include "esp_log.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_now.h" #include "esp_crc.h" #include "espnow_example.h" diff --git a/examples/wifi/ftm/main/ftm_main.c b/examples/wifi/ftm/main/ftm_main.c index 25af1b2f70..db781b5a37 100644 --- a/examples/wifi/ftm/main/ftm_main.c +++ b/examples/wifi/ftm/main/ftm_main.c @@ -21,6 +21,7 @@ #include "esp_err.h" #include "esp_wifi.h" #include "esp_console.h" +#include "esp_mac.h" typedef struct { struct arg_str *ssid; diff --git a/examples/wifi/getting_started/softAP/main/softap_example_main.c b/examples/wifi/getting_started/softAP/main/softap_example_main.c index b4ed246a63..fedccd5b32 100644 --- a/examples/wifi/getting_started/softAP/main/softap_example_main.c +++ b/examples/wifi/getting_started/softAP/main/softap_example_main.c @@ -9,7 +9,7 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_wifi.h" #include "esp_event.h" #include "esp_log.h" diff --git a/examples/wifi/roaming/main/roaming_example.c b/examples/wifi/roaming/main/roaming_example.c index 7532d8d4da..bad74db9d3 100644 --- a/examples/wifi/roaming/main/roaming_example.c +++ b/examples/wifi/roaming/main/roaming_example.c @@ -9,7 +9,7 @@ #include "esp_mbo.h" #include "esp_event.h" #include "esp_log.h" -#include "esp_system.h" +#include "esp_mac.h" #include "nvs_flash.h" #include "esp_netif.h" diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 7c36af05af..d225c45035 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -717,11 +717,8 @@ components/esp_system/port/soc/esp32h2/cache_err_int.h components/esp_system/port/soc/esp32h2/reset_reason.c components/esp_system/port/soc/esp32s2/cache_err_int.h components/esp_system/port/soc/esp32s2/reset_reason.c -components/esp_system/port/soc/esp32s2/usb_console.c components/esp_system/port/soc/esp32s3/cache_err_int.h components/esp_system/port/soc/esp32s3/reset_reason.c -components/esp_system/port/soc/esp32s3/usb_console.c -components/esp_system/stack_check.c components/esp_system/test/test_delay.c components/esp_system/test/test_reset_reason.c components/esp_system/test/test_stack_check.c @@ -729,7 +726,6 @@ components/esp_system/test/test_system_time.c components/esp_system/test_eh_frame_parser/eh_frame_parser_impl.h components/esp_system/test_eh_frame_parser/esp_private/panic_internal.h components/esp_system/test_eh_frame_parser/linker.ld -components/esp_system/test_eh_frame_parser/main.c components/esp_system/ubsan.c components/esp_timer/include/esp_private/esp_timer_private.h components/esp_timer/test/test_esp_timer.c @@ -795,7 +791,6 @@ components/fatfs/src/ffsystem.c components/fatfs/src/ffunicode.c components/fatfs/test/test_fatfs_common.c components/fatfs/test/test_fatfs_rawflash.c -components/fatfs/test/test_fatfs_spiflash.c components/fatfs/test_fatfs_host/main.cpp components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h components/fatfs/test_fatfs_host/test_fatfs.cpp @@ -813,7 +808,6 @@ components/hal/esp32/include/hal/can_hal.h components/hal/esp32/include/hal/can_ll.h components/hal/esp32/include/hal/can_types.h components/hal/esp32/include/hal/clk_gate_ll.h -components/hal/esp32/include/hal/cpu_ll.h components/hal/esp32/include/hal/dac_ll.h components/hal/esp32/include/hal/i2c_ll.h components/hal/esp32/include/hal/interrupt_controller_ll.h @@ -888,7 +882,6 @@ components/hal/esp32s2/include/hal/adc_hal_conf.h components/hal/esp32s2/include/hal/aes_ll.h components/hal/esp32s2/include/hal/cp_dma_hal.h components/hal/esp32s2/include/hal/cp_dma_ll.h -components/hal/esp32s2/include/hal/cpu_ll.h components/hal/esp32s2/include/hal/crypto_dma_ll.h components/hal/esp32s2/include/hal/dac_hal.h components/hal/esp32s2/include/hal/dac_ll.h @@ -918,7 +911,6 @@ components/hal/esp32s2/touch_sensor_hal.c components/hal/esp32s3/brownout_hal.c components/hal/esp32s3/include/hal/adc_hal_conf.h components/hal/esp32s3/include/hal/aes_ll.h -components/hal/esp32s3/include/hal/cpu_ll.h components/hal/esp32s3/include/hal/gpspi_flash_ll.h components/hal/esp32s3/include/hal/i2c_ll.h components/hal/esp32s3/include/hal/interrupt_controller_ll.h @@ -1162,7 +1154,6 @@ components/newlib/platform_include/time.h components/newlib/poll.c components/newlib/priv_include/esp_time_impl.h components/newlib/pthread.c -components/newlib/random.c components/newlib/reent_init.c components/newlib/syscalls.c components/newlib/termios.c @@ -1757,7 +1748,6 @@ components/vfs/test/test_vfs_append.c components/vfs/test/test_vfs_lwip.c components/vfs/test/test_vfs_paths.c components/vfs/test/test_vfs_uart.c -components/vfs/vfs_eventfd.c components/wifi_provisioning/include/wifi_provisioning/manager.h components/wifi_provisioning/include/wifi_provisioning/scheme_ble.h components/wifi_provisioning/include/wifi_provisioning/scheme_console.h @@ -2045,8 +2035,6 @@ docs/conf_common.py docs/en/conf.py docs/zh_CN/conf.py examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_event.c -examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_mesh.c -examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_model_srv.c examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_reset.c examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_timer.c examples/bluetooth/esp_ble_mesh/aligenie_demo/components/vendor_model/genie_util.c @@ -2640,7 +2628,6 @@ tools/test_apps/system/panic/main/test_panic_main.c tools/test_apps/system/panic/panic_tests.py tools/test_apps/system/panic/test_panic_util/test_panic_util.py tools/test_apps/system/startup/app_test.py -tools/test_apps/system/startup/main/chip_info_patch.c tools/test_apps/system/startup/main/test_startup_main.c tools/test_idf_monitor/dummy.c tools/test_idf_monitor/run_test_idf_monitor.py diff --git a/tools/test_apps/peripherals/i2c_wifi/main/i2c_wifi_main.c b/tools/test_apps/peripherals/i2c_wifi/main/i2c_wifi_main.c index 9506fc046f..4f0cdcd7dc 100644 --- a/tools/test_apps/peripherals/i2c_wifi/main/i2c_wifi_main.c +++ b/tools/test_apps/peripherals/i2c_wifi/main/i2c_wifi_main.c @@ -5,7 +5,7 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "esp_system.h" +#include "esp_mac.h" #include "esp_wifi.h" #include "esp_event.h" #include "esp_log.h" diff --git a/tools/test_apps/protocols/mdns/main/main.c b/tools/test_apps/protocols/mdns/main/main.c index 4be8ec494d..0a160aee2c 100644 --- a/tools/test_apps/protocols/mdns/main/main.c +++ b/tools/test_apps/protocols/mdns/main/main.c @@ -5,7 +5,7 @@ */ #include #include -#include "esp_system.h" +#include "esp_mac.h" #include "nvs_flash.h" #include "esp_event.h" #include "esp_netif.h" diff --git a/tools/test_apps/security/secure_boot/main/secure_boot_main.c b/tools/test_apps/security/secure_boot/main/secure_boot_main.c index 0ca31e3bfa..fc30075f6a 100644 --- a/tools/test_apps/security/secure_boot/main/secure_boot_main.c +++ b/tools/test_apps/security/secure_boot/main/secure_boot_main.c @@ -12,7 +12,7 @@ #include "soc/efuse_reg.h" #include "esp_efuse.h" #include "esp_secure_boot.h" -#include "esp_system.h" +#include "esp_chip_info.h" #include "esp_spi_flash.h" #include "esp_log.h" #include "esp_efuse_table.h" diff --git a/tools/test_apps/security/secure_boot/main/secure_boot_main_esp32.c b/tools/test_apps/security/secure_boot/main/secure_boot_main_esp32.c index 709d408df4..094c56ccd3 100644 --- a/tools/test_apps/security/secure_boot/main/secure_boot_main_esp32.c +++ b/tools/test_apps/security/secure_boot/main/secure_boot_main_esp32.c @@ -12,7 +12,7 @@ #include "soc/efuse_reg.h" #include "hal/efuse_ll.h" #include "esp_efuse.h" -#include "esp_system.h" +#include "esp_chip_info.h" #include "esp_spi_flash.h" #include "esp_log.h" #include "esp_efuse_table.h" diff --git a/tools/test_apps/system/gdb_loadable_elf/main/hello_world_main.c b/tools/test_apps/system/gdb_loadable_elf/main/hello_world_main.c index 1bbb227906..57dec8d9d6 100644 --- a/tools/test_apps/system/gdb_loadable_elf/main/hello_world_main.c +++ b/tools/test_apps/system/gdb_loadable_elf/main/hello_world_main.c @@ -10,7 +10,7 @@ #include "sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#include "esp_system.h" +#include "esp_chip_info.h" #include "esp_spi_flash.h" void app_main(void) diff --git a/tools/test_apps/system/startup/main/chip_info_patch.c b/tools/test_apps/system/startup/main/chip_info_patch.c index 21b6ac78bc..cf2afdd50c 100644 --- a/tools/test_apps/system/startup/main/chip_info_patch.c +++ b/tools/test_apps/system/startup/main/chip_info_patch.c @@ -1,18 +1,10 @@ -// Copyright 2013-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2013-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ -#include "esp_system.h" +#include "esp_chip_info.h" extern void __real_esp_chip_info(esp_chip_info_t* out_info);