From 1f2e2fe8afb517ee4c40b04880e40913126cbeab Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Wed, 8 Jan 2020 12:50:03 +0800 Subject: [PATCH 1/3] soc: separate abstraction, description and implementation --- .../fatfs/test_fatfs_host/Makefile.files | 3 +- components/soc/CMakeLists.txt | 95 +-- components/soc/README.md | 44 ++ components/soc/component.mk | 7 +- components/soc/esp32/component.mk | 5 - components/soc/esp32/sources.cmake | 34 - components/soc/esp32s2/component.mk | 1 - components/soc/esp32s2/sources.cmake | 28 - components/soc/include/hal/spi_flash_types.h | 2 +- components/soc/{esp32s2 => include}/soc_log.h | 17 + components/soc/soc/CMakeLists.txt | 2 + components/soc/soc/component.mk | 2 + components/soc/soc/esp32/CMakeLists.txt | 17 + components/soc/{ => soc}/esp32/adc_periph.c | 0 components/soc/{ => soc}/esp32/dac_periph.c | 0 components/soc/{ => soc}/esp32/gpio_periph.c | 0 components/soc/{ => soc}/esp32/i2c_apll.h | 0 components/soc/{ => soc}/esp32/i2c_bbpll.h | 0 components/soc/{ => soc}/esp32/i2c_periph.c | 0 components/soc/{ => soc}/esp32/i2s_periph.c | 0 .../{ => soc}/esp32/include/soc/adc_caps.h | 0 .../{ => soc}/esp32/include/soc/adc_channel.h | 0 .../esp32/include/soc/apb_ctrl_reg.h | 0 .../esp32/include/soc/apb_ctrl_struct.h | 0 .../soc/{ => soc}/esp32/include/soc/bb_reg.h | 0 .../{ => soc}/esp32/include/soc/boot_mode.h | 0 .../esp32/include/soc/brownout_caps.h | 0 .../{ => soc}/esp32/include/soc/can_caps.h | 0 .../{ => soc}/esp32/include/soc/can_struct.h | 0 .../esp32/include/soc/clkout_channel.h | 0 .../soc/{ => soc}/esp32/include/soc/cpu.h | 0 .../{ => soc}/esp32/include/soc/dac_caps.h | 0 .../{ => soc}/esp32/include/soc/dac_channel.h | 0 .../esp32/include/soc/dport_access.h | 0 .../{ => soc}/esp32/include/soc/dport_reg.h | 0 .../{ => soc}/esp32/include/soc/efuse_reg.h | 0 .../esp32/include/soc/emac_dma_struct.h | 0 .../esp32/include/soc/emac_ext_struct.h | 0 .../esp32/include/soc/emac_mac_struct.h | 0 .../soc/{ => soc}/esp32/include/soc/fe_reg.h | 0 .../esp32/include/soc/frc_timer_reg.h | 0 .../{ => soc}/esp32/include/soc/gpio_caps.h | 0 .../{ => soc}/esp32/include/soc/gpio_reg.h | 0 .../{ => soc}/esp32/include/soc/gpio_sd_reg.h | 0 .../esp32/include/soc/gpio_sd_struct.h | 0 .../esp32/include/soc/gpio_sig_map.h | 0 .../{ => soc}/esp32/include/soc/gpio_struct.h | 0 .../{ => soc}/esp32/include/soc/hinf_reg.h | 0 .../{ => soc}/esp32/include/soc/hinf_struct.h | 0 .../{ => soc}/esp32/include/soc/host_reg.h | 0 .../{ => soc}/esp32/include/soc/host_struct.h | 0 .../esp32/include/soc/hwcrypto_reg.h | 0 .../{ => soc}/esp32/include/soc/i2c_caps.h | 0 .../soc/{ => soc}/esp32/include/soc/i2c_reg.h | 0 .../{ => soc}/esp32/include/soc/i2c_struct.h | 0 .../{ => soc}/esp32/include/soc/i2s_caps.h | 0 .../soc/{ => soc}/esp32/include/soc/i2s_reg.h | 0 .../{ => soc}/esp32/include/soc/i2s_struct.h | 0 .../{ => soc}/esp32/include/soc/io_mux_reg.h | 0 .../{ => soc}/esp32/include/soc/ledc_caps.h | 0 .../{ => soc}/esp32/include/soc/ledc_reg.h | 0 .../{ => soc}/esp32/include/soc/ledc_struct.h | 0 .../{ => soc}/esp32/include/soc/mcpwm_caps.h | 0 .../{ => soc}/esp32/include/soc/mcpwm_reg.h | 0 .../esp32/include/soc/mcpwm_struct.h | 0 .../soc/{ => soc}/esp32/include/soc/nrx_reg.h | 0 .../{ => soc}/esp32/include/soc/pcnt_caps.h | 0 .../{ => soc}/esp32/include/soc/pcnt_reg.h | 0 .../{ => soc}/esp32/include/soc/pcnt_struct.h | 0 .../{ => soc}/esp32/include/soc/periph_defs.h | 0 .../soc/{ => soc}/esp32/include/soc/pid.h | 0 .../{ => soc}/esp32/include/soc/rmt_caps.h | 0 .../soc/{ => soc}/esp32/include/soc/rmt_reg.h | 0 .../{ => soc}/esp32/include/soc/rmt_struct.h | 0 .../soc/{ => soc}/esp32/include/soc/rtc.h | 0 .../esp32/include/soc/rtc_cntl_reg.h | 0 .../esp32/include/soc/rtc_cntl_struct.h | 0 .../{ => soc}/esp32/include/soc/rtc_i2c_reg.h | 0 .../{ => soc}/esp32/include/soc/rtc_io_caps.h | 0 .../esp32/include/soc/rtc_io_channel.h | 0 .../{ => soc}/esp32/include/soc/rtc_io_reg.h | 0 .../esp32/include/soc/rtc_io_struct.h | 0 .../esp32/include/soc/sdio_slave_pins.h | 0 .../{ => soc}/esp32/include/soc/sdmmc_pins.h | 0 .../{ => soc}/esp32/include/soc/sdmmc_reg.h | 0 .../esp32/include/soc/sdmmc_struct.h | 0 .../{ => soc}/esp32/include/soc/sens_reg.h | 0 .../{ => soc}/esp32/include/soc/sens_struct.h | 0 .../esp32/include/soc/sigmadelta_caps.h | 0 .../soc/{ => soc}/esp32/include/soc/slc_reg.h | 0 .../{ => soc}/esp32/include/soc/slc_struct.h | 0 .../soc/{ => soc}/esp32/include/soc/soc.h | 0 .../{ => soc}/esp32/include/soc/soc_caps.h | 0 .../soc/{ => soc}/esp32/include/soc/soc_ulp.h | 0 .../{ => soc}/esp32/include/soc/spi_caps.h | 0 .../soc/{ => soc}/esp32/include/soc/spi_reg.h | 0 .../{ => soc}/esp32/include/soc/spi_struct.h | 0 .../{ => soc}/esp32/include/soc/syscon_reg.h | 0 .../esp32/include/soc/syscon_struct.h | 0 .../esp32/include/soc/timer_group_caps.h | 0 .../esp32/include/soc/timer_group_reg.h | 0 .../esp32/include/soc/timer_group_struct.h | 0 .../esp32/include/soc/touch_sensor_caps.h | 0 .../esp32/include/soc/touch_sensor_channel.h | 0 .../{ => soc}/esp32/include/soc/uart_caps.h | 0 .../esp32/include/soc/uart_channel.h | 0 .../{ => soc}/esp32/include/soc/uart_reg.h | 0 .../{ => soc}/esp32/include/soc/uart_struct.h | 0 .../{ => soc}/esp32/include/soc/uhci_reg.h | 0 .../{ => soc}/esp32/include/soc/uhci_struct.h | 0 .../{ => soc}/esp32/include/soc/wdev_reg.h | 0 components/soc/{ => soc}/esp32/interrupts.c | 0 components/soc/{ => soc}/esp32/ledc_periph.c | 0 .../soc/{ => soc}/esp32/rtc_io_periph.c | 0 components/soc/{ => soc}/esp32/rtc_periph.c | 0 .../soc/{ => soc}/esp32/sdio_slave_periph.c | 0 components/soc/{ => soc}/esp32/sdmmc_periph.c | 0 components/soc/{ => soc}/esp32/spi_periph.c | 0 .../soc/{ => soc}/esp32/touch_sensor_periph.c | 0 components/soc/{ => soc}/esp32/uart_periph.c | 0 components/soc/soc/esp32s2/CMakeLists.txt | 16 + components/soc/{ => soc}/esp32s2/adc_periph.c | 0 components/soc/{ => soc}/esp32s2/dac_periph.c | 0 .../soc/{ => soc}/esp32s2/gpio_periph.c | 0 components/soc/{ => soc}/esp32s2/i2c_apll.h | 0 components/soc/{ => soc}/esp32s2/i2c_bbpll.h | 0 components/soc/{ => soc}/esp32s2/i2c_periph.c | 0 components/soc/{ => soc}/esp32s2/i2s_periph.c | 0 .../{ => soc}/esp32s2/include/soc/adc_caps.h | 0 .../esp32s2/include/soc/adc_channel.h | 0 .../esp32s2/include/soc/apb_ctrl_reg.h | 0 .../esp32s2/include/soc/apb_ctrl_struct.h | 0 .../esp32s2/include/soc/apb_saradc_reg.h | 0 .../esp32s2/include/soc/apb_saradc_struct.h | 0 .../esp32s2/include/soc/assist_debug_reg.h | 0 .../{ => soc}/esp32s2/include/soc/bb_reg.h | 0 .../{ => soc}/esp32s2/include/soc/boot_mode.h | 0 .../esp32s2/include/soc/brownout_caps.h | 0 .../esp32s2/include/soc/cache_memory.h | 0 .../esp32s2/include/soc/clkout_channel.h | 0 .../soc/{ => soc}/esp32s2/include/soc/cpu.h | 0 .../esp32s2/include/soc/crypto_dma_reg.h | 0 .../{ => soc}/esp32s2/include/soc/dac_caps.h | 0 .../esp32s2/include/soc/dac_channel.h | 0 .../esp32s2/include/soc/dport_access.h | 0 .../{ => soc}/esp32s2/include/soc/dport_reg.h | 0 .../{ => soc}/esp32s2/include/soc/efuse_reg.h | 0 .../esp32s2/include/soc/efuse_struct.h | 0 .../esp32s2/include/soc/extmem_reg.h | 0 .../{ => soc}/esp32s2/include/soc/fe_reg.h | 0 .../esp32s2/include/soc/frc_timer_reg.h | 0 .../{ => soc}/esp32s2/include/soc/gpio_caps.h | 0 .../{ => soc}/esp32s2/include/soc/gpio_reg.h | 0 .../esp32s2/include/soc/gpio_sd_reg.h | 0 .../esp32s2/include/soc/gpio_sd_struct.h | 0 .../esp32s2/include/soc/gpio_sig_map.h | 0 .../esp32s2/include/soc/gpio_struct.h | 0 .../{ => soc}/esp32s2/include/soc/hinf_reg.h | 0 .../esp32s2/include/soc/hinf_struct.h | 0 .../{ => soc}/esp32s2/include/soc/host_reg.h | 0 .../esp32s2/include/soc/host_struct.h | 0 .../esp32s2/include/soc/hwcrypto_reg.h | 0 .../{ => soc}/esp32s2/include/soc/i2c_caps.h | 0 .../{ => soc}/esp32s2/include/soc/i2c_reg.h | 0 .../esp32s2/include/soc/i2c_struct.h | 0 .../{ => soc}/esp32s2/include/soc/i2s_caps.h | 0 .../{ => soc}/esp32s2/include/soc/i2s_reg.h | 0 .../esp32s2/include/soc/i2s_struct.h | 0 .../esp32s2/include/soc/interrupt_reg.h | 0 .../esp32s2/include/soc/io_mux_reg.h | 0 .../{ => soc}/esp32s2/include/soc/ledc_caps.h | 0 .../{ => soc}/esp32s2/include/soc/ledc_reg.h | 0 .../esp32s2/include/soc/ledc_struct.h | 0 .../{ => soc}/esp32s2/include/soc/mcpwm_reg.h | 0 .../esp32s2/include/soc/mcpwm_struct.h | 0 .../{ => soc}/esp32s2/include/soc/nrx_reg.h | 0 .../{ => soc}/esp32s2/include/soc/pcnt_caps.h | 0 .../{ => soc}/esp32s2/include/soc/pcnt_reg.h | 0 .../esp32s2/include/soc/pcnt_struct.h | 0 .../esp32s2/include/soc/periph_defs.h | 0 .../{ => soc}/esp32s2/include/soc/rmt_caps.h | 0 .../{ => soc}/esp32s2/include/soc/rmt_reg.h | 0 .../esp32s2/include/soc/rmt_struct.h | 0 .../soc/{ => soc}/esp32s2/include/soc/rtc.h | 0 .../esp32s2/include/soc/rtc_cntl_reg.h | 0 .../esp32s2/include/soc/rtc_cntl_struct.h | 0 .../esp32s2/include/soc/rtc_i2c_reg.h | 0 .../esp32s2/include/soc/rtc_i2c_struct.h | 0 .../esp32s2/include/soc/rtc_io_caps.h | 0 .../esp32s2/include/soc/rtc_io_channel.h | 0 .../esp32s2/include/soc/rtc_io_reg.h | 0 .../esp32s2/include/soc/rtc_io_struct.h | 0 .../esp32s2/include/soc/sdio_slave_pins.h | 0 .../esp32s2/include/soc/sdmmc_pins.h | 0 .../{ => soc}/esp32s2/include/soc/sdmmc_reg.h | 0 .../esp32s2/include/soc/sdmmc_struct.h | 0 .../{ => soc}/esp32s2/include/soc/sens_reg.h | 0 .../esp32s2/include/soc/sens_struct.h | 0 .../esp32s2/include/soc/sensitive_reg.h | 0 .../esp32s2/include/soc/sigmadelta_caps.h | 0 .../{ => soc}/esp32s2/include/soc/slc_reg.h | 0 .../esp32s2/include/soc/slc_struct.h | 0 .../soc/{ => soc}/esp32s2/include/soc/soc.h | 0 .../{ => soc}/esp32s2/include/soc/soc_caps.h | 0 .../{ => soc}/esp32s2/include/soc/soc_ulp.h | 0 .../{ => soc}/esp32s2/include/soc/spi_caps.h | 0 .../esp32s2/include/soc/spi_mem_reg.h | 0 .../esp32s2/include/soc/spi_mem_struct.h | 0 .../soc/soc/esp32s2/include/soc/spi_pins.h | 40 + .../{ => soc}/esp32s2/include/soc/spi_reg.h | 0 .../esp32s2/include/soc/spi_struct.h | 0 .../esp32s2/include/soc/syscon_reg.h | 0 .../esp32s2/include/soc/syscon_struct.h | 0 .../esp32s2/include/soc/system_reg.h | 0 .../esp32s2/include/soc/systimer_reg.h | 0 .../esp32s2/include/soc/timer_group_caps.h | 0 .../esp32s2/include/soc/timer_group_reg.h | 0 .../esp32s2/include/soc/timer_group_struct.h | 0 .../esp32s2/include/soc/touch_sensor_caps.h | 0 .../include/soc/touch_sensor_channel.h | 0 .../{ => soc}/esp32s2/include/soc/uart_caps.h | 0 .../esp32s2/include/soc/uart_channel.h | 0 .../{ => soc}/esp32s2/include/soc/uart_reg.h | 0 .../esp32s2/include/soc/uart_struct.h | 0 .../{ => soc}/esp32s2/include/soc/uhci_reg.h | 0 .../esp32s2/include/soc/uhci_struct.h | 0 .../{ => soc}/esp32s2/include/soc/usb_caps.h | 0 .../esp32s2}/include/soc/usb_periph.h | 0 .../{ => soc}/esp32s2/include/soc/usb_pins.h | 0 .../{ => soc}/esp32s2/include/soc/usb_reg.h | 0 .../esp32s2/include/soc/usb_struct.h | 0 .../{ => soc}/esp32s2/include/soc/usb_types.h | 0 .../{ => soc}/esp32s2/include/soc/wdev_reg.h | 0 components/soc/{ => soc}/esp32s2/interrupts.c | 0 .../soc/{ => soc}/esp32s2/ledc_periph.c | 0 .../soc/{ => soc}/esp32s2/rtc_io_periph.c | 0 components/soc/{ => soc}/esp32s2/rtc_periph.c | 0 components/soc/{ => soc}/esp32s2/spi_periph.c | 0 .../{ => soc}/esp32s2/touch_sensor_periph.c | 0 .../soc/{ => soc}/esp32s2/uart_periph.c | 0 components/soc/{ => soc}/esp32s2/usb_periph.c | 0 .../soc/{ => soc}/include/soc/adc_periph.h | 0 .../soc/{ => soc}/include/soc/can_periph.h | 0 .../soc/{ => soc}/include/soc/dac_periph.h | 0 .../soc/{ => soc}/include/soc/efuse_periph.h | 0 .../soc/{ => soc}/include/soc/emac_periph.h | 0 .../soc/{ => soc}/include/soc/gpio_periph.h | 0 .../{ => soc}/include/soc/hwcrypto_periph.h | 0 .../soc/{ => soc}/include/soc/i2c_periph.h | 0 .../soc/{ => soc}/include/soc/i2s_periph.h | 0 .../soc/{ => soc}/include/soc/interrupts.h | 0 .../soc/{ => soc}/include/soc/ledc_periph.h | 0 .../soc/{ => soc}/include/soc/mcpwm_periph.h | 0 .../soc/{ => soc}/include/soc/pcnt_periph.h | 0 .../soc/{ => soc}/include/soc/rmt_periph.h | 0 .../soc/{ => soc}/include/soc/rtc_io_periph.h | 2 +- .../soc/{ => soc}/include/soc/rtc_periph.h | 0 .../{ => soc}/include/soc/sdio_slave_periph.h | 0 .../soc/{ => soc}/include/soc/sdmmc_periph.h | 0 .../soc/{ => soc}/include/soc/sens_periph.h | 0 .../{ => soc}/include/soc/sigmadelta_periph.h | 0 .../soc/{ => soc}/include/soc/spi_periph.h | 0 .../soc/{ => soc}/include/soc/syscon_periph.h | 0 .../soc/{ => soc}/include/soc/timer_periph.h | 0 .../include/soc/touch_sensor_periph.h | 0 .../soc/{ => soc}/include/soc/uart_periph.h | 0 .../soc/{ => soc}/include/soc/uhci_periph.h | 0 components/soc/src/esp32/CMakeLists.txt | 27 + components/soc/{ => src}/esp32/brownout_hal.c | 0 components/soc/src/esp32/component.mk | 8 + components/soc/{ => src}/esp32/cpu_util.c | 0 components/soc/{ => src}/esp32/emac_hal.c | 0 components/soc/{ => src}/esp32/i2c_rtc_clk.h | 0 .../soc/{ => src}/esp32/include/hal/adc_ll.h | 0 .../soc/{ => src}/esp32/include/hal/can_ll.h | 0 .../soc/{ => src}/esp32/include/hal/dac_ll.h | 0 .../soc/{ => src}/esp32/include/hal/emac.h | 0 .../soc/{ => src}/esp32/include/hal/gpio_ll.h | 0 .../soc/{ => src}/esp32/include/hal/i2c_ll.h | 0 .../soc/{ => src}/esp32/include/hal/i2s_ll.h | 0 .../soc/{ => src}/esp32/include/hal/ledc_ll.h | 0 .../{ => src}/esp32/include/hal/mcpwm_ll.h | 0 .../soc/{ => src}/esp32/include/hal/pcnt_ll.h | 0 .../soc/{ => src}/esp32/include/hal/rmt_ll.h | 0 .../{ => src}/esp32/include/hal/rtc_io_ll.h | 1 + .../esp32/include/hal/sigmadelta_ll.h | 0 .../esp32/include/hal/spi_flash_ll.h | 0 .../soc/{ => src}/esp32/include/hal/spi_ll.h | 0 .../{ => src}/esp32/include/hal/timer_ll.h | 0 .../include/hal/touch_sensor_hal_esp32.h | 0 .../esp32/include/hal/touch_sensor_ll.h | 0 .../soc/{ => src}/esp32/include/hal/uart_ll.h | 0 components/soc/{ => src}/esp32/rtc_clk.c | 0 .../soc/{ => src}/esp32/rtc_clk_common.h | 0 components/soc/{ => src}/esp32/rtc_clk_init.c | 0 components/soc/{ => src}/esp32/rtc_init.c | 0 components/soc/{ => src}/esp32/rtc_pm.c | 0 components/soc/{ => src}/esp32/rtc_sleep.c | 0 components/soc/{ => src}/esp32/rtc_time.c | 0 components/soc/{ => src}/esp32/rtc_wdt.c | 0 components/soc/src/esp32/sdio_slave_hal.c | 729 ++++++++++++++++++ components/soc/{ => src}/esp32/soc_log.h | 0 .../soc/{ => src}/esp32/soc_memory_layout.c | 0 .../soc/{ => src}/esp32/test/test_rtc_clk.c | 0 .../soc/{ => src}/esp32/touch_sensor_hal.c | 0 components/soc/src/esp32s2/CMakeLists.txt | 22 + .../soc/{ => src}/esp32s2/brownout_hal.c | 0 components/soc/{ => src}/esp32s2/cpu_util.c | 0 .../soc/{ => src}/esp32s2/i2c_brownout.h | 0 .../soc/{ => src}/esp32s2/i2c_rtc_clk.h | 0 .../{ => src}/esp32s2/include/hal/adc_ll.h | 0 .../{ => src}/esp32s2/include/hal/dac_ll.h | 0 .../{ => src}/esp32s2/include/hal/gpio_ll.h | 0 .../esp32s2/include/hal/gpspi_flash_ll.h | 0 .../{ => src}/esp32s2/include/hal/i2c_ll.h | 0 .../{ => src}/esp32s2/include/hal/i2s_ll.h | 0 .../{ => src}/esp32s2/include/hal/ledc_ll.h | 0 .../{ => src}/esp32s2/include/hal/pcnt_ll.h | 0 .../{ => src}/esp32s2/include/hal/rmt_ll.h | 0 .../{ => src}/esp32s2/include/hal/rtc_io_ll.h | 1 + .../esp32s2/include/hal/sigmadelta_ll.h | 0 .../esp32s2/include/hal/spi_flash_ll.h | 0 .../{ => src}/esp32s2/include/hal/spi_ll.h | 0 .../esp32s2/include/hal/spimem_flash_ll.h | 0 .../{ => src}/esp32s2/include/hal/timer_ll.h | 0 .../include/hal/touch_sensor_hal_esp32s2.h | 0 .../esp32s2/include/hal/touch_sensor_ll.h | 0 .../{ => src}/esp32s2/include/hal/uart_ll.h | 0 .../{ => src}/esp32s2/include/hal/usb_ll.h | 0 components/soc/{ => src}/esp32s2/rtc_clk.c | 0 components/soc/{ => src}/esp32s2/rtc_init.c | 0 components/soc/{ => src}/esp32s2/rtc_pm.c | 0 components/soc/{ => src}/esp32s2/rtc_sleep.c | 0 components/soc/{ => src}/esp32s2/rtc_time.c | 0 components/soc/{ => src}/esp32s2/rtc_wdt.c | 0 .../soc/{ => src}/esp32s2/soc_memory_layout.c | 0 .../soc/{ => src}/esp32s2/touch_sensor_hal.c | 0 .../{esp32s2/hal => src/esp32s2}/usb_hal.c | 0 components/soc/test/CMakeLists.txt | 8 +- components/soc/test/component.mk | 2 +- components/soc/test/test_rtc_clk.c | 285 +++++++ components/spi_flash/sim/Makefile.files | 3 +- components/spi_flash/sim/stubs/Makefile.files | 3 +- .../spiffs/test_spiffs_host/Makefile.files | 3 +- .../test_wl_host/Makefile.files | 3 +- docs/Doxyfile | 10 +- 346 files changed, 1275 insertions(+), 145 deletions(-) create mode 100644 components/soc/README.md delete mode 100644 components/soc/esp32/component.mk delete mode 100644 components/soc/esp32/sources.cmake delete mode 100644 components/soc/esp32s2/component.mk delete mode 100644 components/soc/esp32s2/sources.cmake rename components/soc/{esp32s2 => include}/soc_log.h (68%) create mode 100644 components/soc/soc/CMakeLists.txt create mode 100644 components/soc/soc/component.mk create mode 100644 components/soc/soc/esp32/CMakeLists.txt rename components/soc/{ => soc}/esp32/adc_periph.c (100%) rename components/soc/{ => soc}/esp32/dac_periph.c (100%) rename components/soc/{ => soc}/esp32/gpio_periph.c (100%) rename components/soc/{ => soc}/esp32/i2c_apll.h (100%) rename components/soc/{ => soc}/esp32/i2c_bbpll.h (100%) rename components/soc/{ => soc}/esp32/i2c_periph.c (100%) rename components/soc/{ => soc}/esp32/i2s_periph.c (100%) rename components/soc/{ => soc}/esp32/include/soc/adc_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/adc_channel.h (100%) rename components/soc/{ => soc}/esp32/include/soc/apb_ctrl_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/apb_ctrl_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/bb_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/boot_mode.h (100%) rename components/soc/{ => soc}/esp32/include/soc/brownout_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/can_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/can_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/clkout_channel.h (100%) rename components/soc/{ => soc}/esp32/include/soc/cpu.h (100%) rename components/soc/{ => soc}/esp32/include/soc/dac_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/dac_channel.h (100%) rename components/soc/{ => soc}/esp32/include/soc/dport_access.h (100%) rename components/soc/{ => soc}/esp32/include/soc/dport_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/efuse_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/emac_dma_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/emac_ext_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/emac_mac_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/fe_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/frc_timer_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/gpio_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/gpio_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/gpio_sd_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/gpio_sd_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/gpio_sig_map.h (100%) rename components/soc/{ => soc}/esp32/include/soc/gpio_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/hinf_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/hinf_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/host_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/host_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/hwcrypto_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/i2c_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/i2c_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/i2c_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/i2s_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/i2s_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/i2s_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/io_mux_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/ledc_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/ledc_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/ledc_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/mcpwm_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/mcpwm_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/mcpwm_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/nrx_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/pcnt_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/pcnt_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/pcnt_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/periph_defs.h (100%) rename components/soc/{ => soc}/esp32/include/soc/pid.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rmt_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rmt_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rmt_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rtc.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rtc_cntl_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rtc_cntl_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rtc_i2c_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rtc_io_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rtc_io_channel.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rtc_io_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/rtc_io_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/sdio_slave_pins.h (100%) rename components/soc/{ => soc}/esp32/include/soc/sdmmc_pins.h (100%) rename components/soc/{ => soc}/esp32/include/soc/sdmmc_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/sdmmc_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/sens_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/sens_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/sigmadelta_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/slc_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/slc_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/soc.h (100%) rename components/soc/{ => soc}/esp32/include/soc/soc_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/soc_ulp.h (100%) rename components/soc/{ => soc}/esp32/include/soc/spi_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/spi_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/spi_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/syscon_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/syscon_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/timer_group_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/timer_group_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/timer_group_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/touch_sensor_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/touch_sensor_channel.h (100%) rename components/soc/{ => soc}/esp32/include/soc/uart_caps.h (100%) rename components/soc/{ => soc}/esp32/include/soc/uart_channel.h (100%) rename components/soc/{ => soc}/esp32/include/soc/uart_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/uart_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/uhci_reg.h (100%) rename components/soc/{ => soc}/esp32/include/soc/uhci_struct.h (100%) rename components/soc/{ => soc}/esp32/include/soc/wdev_reg.h (100%) rename components/soc/{ => soc}/esp32/interrupts.c (100%) rename components/soc/{ => soc}/esp32/ledc_periph.c (100%) rename components/soc/{ => soc}/esp32/rtc_io_periph.c (100%) rename components/soc/{ => soc}/esp32/rtc_periph.c (100%) rename components/soc/{ => soc}/esp32/sdio_slave_periph.c (100%) rename components/soc/{ => soc}/esp32/sdmmc_periph.c (100%) rename components/soc/{ => soc}/esp32/spi_periph.c (100%) rename components/soc/{ => soc}/esp32/touch_sensor_periph.c (100%) rename components/soc/{ => soc}/esp32/uart_periph.c (100%) create mode 100644 components/soc/soc/esp32s2/CMakeLists.txt rename components/soc/{ => soc}/esp32s2/adc_periph.c (100%) rename components/soc/{ => soc}/esp32s2/dac_periph.c (100%) rename components/soc/{ => soc}/esp32s2/gpio_periph.c (100%) rename components/soc/{ => soc}/esp32s2/i2c_apll.h (100%) rename components/soc/{ => soc}/esp32s2/i2c_bbpll.h (100%) rename components/soc/{ => soc}/esp32s2/i2c_periph.c (100%) rename components/soc/{ => soc}/esp32s2/i2s_periph.c (100%) rename components/soc/{ => soc}/esp32s2/include/soc/adc_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/adc_channel.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/apb_ctrl_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/apb_ctrl_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/apb_saradc_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/apb_saradc_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/assist_debug_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/bb_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/boot_mode.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/brownout_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/cache_memory.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/clkout_channel.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/cpu.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/crypto_dma_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/dac_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/dac_channel.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/dport_access.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/dport_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/efuse_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/efuse_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/extmem_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/fe_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/frc_timer_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/gpio_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/gpio_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/gpio_sd_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/gpio_sd_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/gpio_sig_map.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/gpio_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/hinf_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/hinf_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/host_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/host_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/hwcrypto_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/i2c_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/i2c_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/i2c_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/i2s_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/i2s_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/i2s_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/interrupt_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/io_mux_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/ledc_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/ledc_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/ledc_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/mcpwm_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/mcpwm_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/nrx_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/pcnt_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/pcnt_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/pcnt_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/periph_defs.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rmt_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rmt_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rmt_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rtc.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rtc_cntl_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rtc_cntl_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rtc_i2c_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rtc_i2c_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rtc_io_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rtc_io_channel.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rtc_io_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/rtc_io_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/sdio_slave_pins.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/sdmmc_pins.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/sdmmc_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/sdmmc_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/sens_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/sens_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/sensitive_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/sigmadelta_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/slc_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/slc_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/soc.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/soc_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/soc_ulp.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/spi_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/spi_mem_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/spi_mem_struct.h (100%) create mode 100644 components/soc/soc/esp32s2/include/soc/spi_pins.h rename components/soc/{ => soc}/esp32s2/include/soc/spi_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/spi_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/syscon_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/syscon_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/system_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/systimer_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/timer_group_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/timer_group_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/timer_group_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/touch_sensor_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/touch_sensor_channel.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/uart_caps.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/uart_channel.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/uart_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/uart_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/uhci_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/uhci_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/usb_caps.h (100%) rename components/soc/{ => soc/esp32s2}/include/soc/usb_periph.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/usb_pins.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/usb_reg.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/usb_struct.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/usb_types.h (100%) rename components/soc/{ => soc}/esp32s2/include/soc/wdev_reg.h (100%) rename components/soc/{ => soc}/esp32s2/interrupts.c (100%) rename components/soc/{ => soc}/esp32s2/ledc_periph.c (100%) rename components/soc/{ => soc}/esp32s2/rtc_io_periph.c (100%) rename components/soc/{ => soc}/esp32s2/rtc_periph.c (100%) rename components/soc/{ => soc}/esp32s2/spi_periph.c (100%) rename components/soc/{ => soc}/esp32s2/touch_sensor_periph.c (100%) rename components/soc/{ => soc}/esp32s2/uart_periph.c (100%) rename components/soc/{ => soc}/esp32s2/usb_periph.c (100%) rename components/soc/{ => soc}/include/soc/adc_periph.h (100%) rename components/soc/{ => soc}/include/soc/can_periph.h (100%) rename components/soc/{ => soc}/include/soc/dac_periph.h (100%) rename components/soc/{ => soc}/include/soc/efuse_periph.h (100%) rename components/soc/{ => soc}/include/soc/emac_periph.h (100%) rename components/soc/{ => soc}/include/soc/gpio_periph.h (100%) rename components/soc/{ => soc}/include/soc/hwcrypto_periph.h (100%) rename components/soc/{ => soc}/include/soc/i2c_periph.h (100%) rename components/soc/{ => soc}/include/soc/i2s_periph.h (100%) rename components/soc/{ => soc}/include/soc/interrupts.h (100%) rename components/soc/{ => soc}/include/soc/ledc_periph.h (100%) rename components/soc/{ => soc}/include/soc/mcpwm_periph.h (100%) rename components/soc/{ => soc}/include/soc/pcnt_periph.h (100%) rename components/soc/{ => soc}/include/soc/rmt_periph.h (100%) rename components/soc/{ => soc}/include/soc/rtc_io_periph.h (99%) rename components/soc/{ => soc}/include/soc/rtc_periph.h (100%) rename components/soc/{ => soc}/include/soc/sdio_slave_periph.h (100%) rename components/soc/{ => soc}/include/soc/sdmmc_periph.h (100%) rename components/soc/{ => soc}/include/soc/sens_periph.h (100%) rename components/soc/{ => soc}/include/soc/sigmadelta_periph.h (100%) rename components/soc/{ => soc}/include/soc/spi_periph.h (100%) rename components/soc/{ => soc}/include/soc/syscon_periph.h (100%) rename components/soc/{ => soc}/include/soc/timer_periph.h (100%) rename components/soc/{ => soc}/include/soc/touch_sensor_periph.h (100%) rename components/soc/{ => soc}/include/soc/uart_periph.h (100%) rename components/soc/{ => soc}/include/soc/uhci_periph.h (100%) create mode 100644 components/soc/src/esp32/CMakeLists.txt rename components/soc/{ => src}/esp32/brownout_hal.c (100%) create mode 100644 components/soc/src/esp32/component.mk rename components/soc/{ => src}/esp32/cpu_util.c (100%) rename components/soc/{ => src}/esp32/emac_hal.c (100%) rename components/soc/{ => src}/esp32/i2c_rtc_clk.h (100%) rename components/soc/{ => src}/esp32/include/hal/adc_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/can_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/dac_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/emac.h (100%) rename components/soc/{ => src}/esp32/include/hal/gpio_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/i2c_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/i2s_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/ledc_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/mcpwm_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/pcnt_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/rmt_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/rtc_io_ll.h (99%) rename components/soc/{ => src}/esp32/include/hal/sigmadelta_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/spi_flash_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/spi_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/timer_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/touch_sensor_hal_esp32.h (100%) rename components/soc/{ => src}/esp32/include/hal/touch_sensor_ll.h (100%) rename components/soc/{ => src}/esp32/include/hal/uart_ll.h (100%) rename components/soc/{ => src}/esp32/rtc_clk.c (100%) rename components/soc/{ => src}/esp32/rtc_clk_common.h (100%) rename components/soc/{ => src}/esp32/rtc_clk_init.c (100%) rename components/soc/{ => src}/esp32/rtc_init.c (100%) rename components/soc/{ => src}/esp32/rtc_pm.c (100%) rename components/soc/{ => src}/esp32/rtc_sleep.c (100%) rename components/soc/{ => src}/esp32/rtc_time.c (100%) rename components/soc/{ => src}/esp32/rtc_wdt.c (100%) create mode 100644 components/soc/src/esp32/sdio_slave_hal.c rename components/soc/{ => src}/esp32/soc_log.h (100%) rename components/soc/{ => src}/esp32/soc_memory_layout.c (100%) rename components/soc/{ => src}/esp32/test/test_rtc_clk.c (100%) rename components/soc/{ => src}/esp32/touch_sensor_hal.c (100%) create mode 100644 components/soc/src/esp32s2/CMakeLists.txt rename components/soc/{ => src}/esp32s2/brownout_hal.c (100%) rename components/soc/{ => src}/esp32s2/cpu_util.c (100%) rename components/soc/{ => src}/esp32s2/i2c_brownout.h (100%) rename components/soc/{ => src}/esp32s2/i2c_rtc_clk.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/adc_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/dac_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/gpio_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/gpspi_flash_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/i2c_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/i2s_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/ledc_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/pcnt_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/rmt_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/rtc_io_ll.h (99%) rename components/soc/{ => src}/esp32s2/include/hal/sigmadelta_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/spi_flash_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/spi_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/spimem_flash_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/timer_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/touch_sensor_hal_esp32s2.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/touch_sensor_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/uart_ll.h (100%) rename components/soc/{ => src}/esp32s2/include/hal/usb_ll.h (100%) rename components/soc/{ => src}/esp32s2/rtc_clk.c (100%) rename components/soc/{ => src}/esp32s2/rtc_init.c (100%) rename components/soc/{ => src}/esp32s2/rtc_pm.c (100%) rename components/soc/{ => src}/esp32s2/rtc_sleep.c (100%) rename components/soc/{ => src}/esp32s2/rtc_time.c (100%) rename components/soc/{ => src}/esp32s2/rtc_wdt.c (100%) rename components/soc/{ => src}/esp32s2/soc_memory_layout.c (100%) rename components/soc/{ => src}/esp32s2/touch_sensor_hal.c (100%) rename components/soc/{esp32s2/hal => src/esp32s2}/usb_hal.c (100%) create mode 100644 components/soc/test/test_rtc_clk.c diff --git a/components/fatfs/test_fatfs_host/Makefile.files b/components/fatfs/test_fatfs_host/Makefile.files index ab77bc40c..2055ab890 100644 --- a/components/fatfs/test_fatfs_host/Makefile.files +++ b/components/fatfs/test_fatfs_host/Makefile.files @@ -27,8 +27,9 @@ INCLUDE_DIRS := \ esp_rom/include \ xtensa/include \ xtensa/esp32/include \ - soc/esp32/include \ + soc/soc/esp32/include \ soc/include \ + soc/soc/include \ esp32/include \ esp_common/include \ bootloader_support/include \ diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index 545dba327..1bb0e31ef 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -1,56 +1,43 @@ -idf_build_get_property(soc_name IDF_TARGET) +idf_build_get_property(target IDF_TARGET) -if(EXISTS "${COMPONENT_DIR}/${soc_name}") - include(${COMPONENT_DIR}/${soc_name}/sources.cmake) - - spaces2list(SOC_SRCS) - add_prefix(srcs "${soc_name}/" ${SOC_SRCS}) - set(include_dirs ${soc_name}/include) -endif() - -list(APPEND include_dirs include) -list(APPEND srcs - "src/memory_layout_utils.c" - "src/lldesc.c" - "src/hal/rmt_hal.c" - "src/hal/rtc_io_hal.c" - "src/hal/dac_hal.c" - "src/hal/adc_hal.c" - "src/hal/spi_hal.c" - "src/hal/spi_hal_iram.c" - "src/hal/spi_slave_hal.c" - "src/hal/spi_slave_hal_iram.c" - "src/hal/touch_sensor_hal.c" - "src/soc_include_legacy_warn.c" - "src/hal/pcnt_hal.c" - "src/hal/i2s_hal.c" - "src/hal/sigmadelta_hal.c" - "src/hal/timer_hal.c" - "src/hal/ledc_hal.c" - "src/hal/ledc_hal_iram.c" - "src/hal/i2c_hal.c" - "src/hal/i2c_hal_iram.c" - "src/hal/gpio_hal.c" - "src/hal/uart_hal.c" - "src/hal/uart_hal_iram.c" - "src/hal/spi_flash_hal.c" - "src/hal/spi_flash_hal_iram.c" - "src/compare_set.c" - ) - -if(IDF_TARGET STREQUAL "esp32") - list(APPEND srcs "src/hal/mcpwm_hal.c" - "src/hal/sdio_slave_hal.c" - "src/hal/can_hal.c" - ) -endif() - -if(IDF_TARGET STREQUAL "esp32s2") - list(APPEND srcs "src/hal/spi_flash_hal_gpspi.c" - "esp32s2/hal/usb_hal.c") -endif() - -idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "${include_dirs}" - PRIV_REQUIRES ${soc_name} +idf_component_register(SRCS "src/memory_layout_utils.c" + "src/lldesc.c" + "src/hal/rmt_hal.c" + "src/hal/rtc_io_hal.c" + "src/hal/dac_hal.c" + "src/hal/adc_hal.c" + "src/hal/spi_hal.c" + "src/hal/spi_hal_iram.c" + "src/hal/spi_slave_hal.c" + "src/hal/spi_slave_hal_iram.c" + "src/hal/touch_sensor_hal.c" + "src/soc_include_legacy_warn.c" + "src/hal/pcnt_hal.c" + "src/hal/i2s_hal.c" + "src/hal/sigmadelta_hal.c" + "src/hal/timer_hal.c" + "src/hal/ledc_hal.c" + "src/hal/ledc_hal_iram.c" + "src/hal/i2c_hal.c" + "src/hal/i2c_hal_iram.c" + "src/hal/gpio_hal.c" + "src/hal/uart_hal.c" + "src/hal/uart_hal_iram.c" + "src/hal/spi_flash_hal.c" + "src/hal/spi_flash_hal_iram.c" + "src/compare_set.c" + PRIV_REQUIRES ${target} LDFRAGMENTS linker.lf) + +if(CONFIG_IDF_TARGET_ESP32) + target_sources(${COMPONENT_LIB} PRIVATE "src/hal/can_hal.c" + "src/hal/mcpwm_hal.c" + "src/hal/sdio_slave_hal.c") +elseif(CONFIG_IDF_TARGET_ESP32S2) + target_sources(${COMPONENT_LIB} PRIVATE "src/hal/spi_flash_hal_gpspi.c") +endif() + +add_subdirectory(soc) +target_link_libraries(${COMPONENT_LIB} PUBLIC "soc_${target}") + +add_subdirectory(src/${target}) diff --git a/components/soc/README.md b/components/soc/README.md new file mode 100644 index 000000000..461d39192 --- /dev/null +++ b/components/soc/README.md @@ -0,0 +1,44 @@ +## `soc` ## + +The `soc` component provides abstraction, hardware description and implementation for targets suppported by ESP-IDF. This is reflected in +the component's subdirectories: + +- `soc/include` - abstraction +- `soc/soc` - description +- `soc/src` - implementation + +#### `soc/include` #### + +`soc/include` contains header files which provide a hardware-agnostic interface to the SoC. The interface consists of +function declarations and abstracted types that other, higher level components can make use of in order to have code portable to +all targets ESP-IDF supports. + +The `hal` subdirectory contains an abstraction layer for interacting with/driving the hardware found in the SoC such as the peripherals +and 'core' hardware such as the CPU, MPU, caches, etc. It contains `xxx_hal.h` files for the function declarations and `xxx_types.h` for the abstracted types. +The abstraction design is actually two levels -- oftentimes `xxx_hal.h` includes a lower-level header from a +`xxx_ll.h`, which resides in the implementation, `soc/src` subdirectory. More on this abstraction design in the [`hal` subdirectory's README](include/hal/readme.md). + +The `soc` subdirectory contains other useful interface for SoC-level operations or concepts, such as the memory layout, spinlocks, etc. + +#### `soc/soc` #### + +The `soc/soc` subdirectory contains description of the underlying hardware: + + - `xxx_reg.h` - defines registers related to the hardware + - `xxx_struct.h` - hardware description in C `struct` + - `xxx_channel.h` - definitions for hardware with multiple channels + - `xxx_caps.h` - features/capabilities of the hardware + - `xxx_pins.h` - pin definitions + - `xxx_periph.h/*.c` - includes all headers related to a peripheral; declaration and definition of IO mapping for that hardware + +Since the hardware description is target-specific, there are subdirectories for each target containing copies of the files above. +Furthermore, the files in this directory should be standalone, i.e. should not include files from outside directories. + +#### `soc/src` #### + +Provides the implementation of the hardware-agnostic interface in the abstraction. Target-specific subdirectories exist for wildly different implementations between targets; while code that are common/very similar might be placed in the top-level of `soc/src`, using some amount of conditional preprocessors. It is up to the developers' discretion on which strategy to use. Code usually reside in source files with same names to header files whose interfaces they implement, ex. `xxx_hal.c` for `xxx_hal.h`. + +As mentioned previously, the lower-level abstraction header `xxx_ll.h` resides in this directory, since they contain hardware-specific details. +However, what these can do is provide some abstraction among implementations, so that more code can be moved to the common, non-target-specific subdirectories. + +This can also contain target-specific extensions to the HAL headers. These target-specific HAL headers have the same name and include the abstraction layer HAL header via `include_next`. These extensions might add more function declarations or override some things using macro magic. \ No newline at end of file diff --git a/components/soc/component.mk b/components/soc/component.mk index 9aed53c28..b86e9f8d0 100644 --- a/components/soc/component.mk +++ b/components/soc/component.mk @@ -1,9 +1,10 @@ SOC_NAME := $(IDF_TARGET) -COMPONENT_SRCDIRS := $(SOC_NAME) src src/hal +COMPONENT_SRCDIRS := src src/hal -COMPONENT_ADD_INCLUDEDIRS := $(SOC_NAME)/include include +COMPONENT_ADD_INCLUDEDIRS := include --include $(COMPONENT_PATH)/$(SOC_NAME)/component.mk +-include $(COMPONENT_PATH)/soc/component.mk +-include $(COMPONENT_PATH)/src/$(SOC_NAME)/component.mk COMPONENT_ADD_LDFRAGMENTS += linker.lf diff --git a/components/soc/esp32/component.mk b/components/soc/esp32/component.mk deleted file mode 100644 index 52c33c8d2..000000000 --- a/components/soc/esp32/component.mk +++ /dev/null @@ -1,5 +0,0 @@ -ifndef CONFIG_ETH_USE_ESP32_EMAC - COMPONENT_OBJEXCLUDE += esp32/emac_hal.o -endif - -esp32/rtc_clk.o: CFLAGS += -fno-jump-tables -fno-tree-switch-conversion diff --git a/components/soc/esp32/sources.cmake b/components/soc/esp32/sources.cmake deleted file mode 100644 index 01a0fc69a..000000000 --- a/components/soc/esp32/sources.cmake +++ /dev/null @@ -1,34 +0,0 @@ -set(SOC_SRCS "adc_periph.c" - "brownout_hal.c" - "dac_periph.c" - "cpu_util.c" - "gpio_periph.c" - "rtc_clk.c" - "rtc_clk_init.c" - "rtc_init.c" - "rtc_io_periph.c" - "rtc_periph.c" - "rtc_pm.c" - "rtc_sleep.c" - "rtc_time.c" - "rtc_wdt.c" - "sdio_slave_periph.c" - "sdmmc_periph.c" - "interrupts.c" - "soc_memory_layout.c" - "spi_periph.c" - "ledc_periph.c" - "i2s_periph.c" - "i2c_periph.c" - "uart_periph.c" - "touch_sensor_hal.c" - "touch_sensor_periph.c") - -if(NOT BOOTLOADER_BUILD AND CONFIG_ETH_USE_ESP32_EMAC) - list(APPEND SOC_SRCS "emac_hal.c") -endif() - -if(NOT CMAKE_BUILD_EARLY_EXPANSION) - set_source_files_properties("esp32/rtc_clk.c" PROPERTIES - COMPILE_FLAGS "-fno-jump-tables -fno-tree-switch-conversion") -endif() diff --git a/components/soc/esp32s2/component.mk b/components/soc/esp32s2/component.mk deleted file mode 100644 index 611b717d7..000000000 --- a/components/soc/esp32s2/component.mk +++ /dev/null @@ -1 +0,0 @@ -esp32s2/rtc_clk.o: CFLAGS += -fno-jump-tables -fno-tree-switch-conversion diff --git a/components/soc/esp32s2/sources.cmake b/components/soc/esp32s2/sources.cmake deleted file mode 100644 index 4555f3b15..000000000 --- a/components/soc/esp32s2/sources.cmake +++ /dev/null @@ -1,28 +0,0 @@ -set(SOC_SRCS "adc_periph.c" - "brownout_hal.c" - "dac_periph.c" - "cpu_util.c" - "gpio_periph.c" - "rtc_clk.c" - "rtc_init.c" - "rtc_io_periph.c" - "rtc_periph.c" - "rtc_pm.c" - "rtc_sleep.c" - "rtc_time.c" - "rtc_wdt.c" - "interrupts.c" - "soc_memory_layout.c" - "spi_periph.c" - "ledc_periph.c" - "i2s_periph.c" - "i2c_periph.c" - "uart_periph.c" - "usb_periph.c" - "touch_sensor_hal.c" - "touch_sensor_periph.c") - -if(NOT CMAKE_BUILD_EARLY_EXPANSION) - set_source_files_properties("esp32s2/rtc_clk.c" PROPERTIES - COMPILE_FLAGS "-fno-jump-tables -fno-tree-switch-conversion") -endif() diff --git a/components/soc/include/hal/spi_flash_types.h b/components/soc/include/hal/spi_flash_types.h index d68e544ab..0a468c607 100644 --- a/components/soc/include/hal/spi_flash_types.h +++ b/components/soc/include/hal/spi_flash_types.h @@ -15,7 +15,7 @@ #pragma once #include -#include "hal/esp_flash_err.h" +#include "esp_flash_err.h" #ifdef __cplusplus extern "C" { diff --git a/components/soc/esp32s2/soc_log.h b/components/soc/include/soc_log.h similarity index 68% rename from components/soc/esp32s2/soc_log.h rename to components/soc/include/soc_log.h index 4cd669e11..a88d47d73 100644 --- a/components/soc/esp32s2/soc_log.h +++ b/components/soc/include/soc_log.h @@ -22,8 +22,25 @@ * 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 + +#ifdef CONFIG_IDF_TARGET_ESPP32 +#include "esp32/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32S2 +#include "esp32s2/rom/ets_sys.h" +#endif + #define SOC_LOGE(tag, fmt, ...) ets_printf("%s(err): " fmt, tag, ##__VA_ARGS__) #define SOC_LOGW(tag, fmt, ...) ets_printf("%s(warn): " fmt, tag, ##__VA_ARGS__) #define SOC_LOGI(tag, fmt, ...) ets_printf("%s(info): " fmt, tag, ##__VA_ARGS__) #define SOC_LOGD(tag, fmt, ...) ets_printf("%s(dbg): " fmt, tag, ##__VA_ARGS__) #define SOC_LOGV(tag, fmt, ...) ets_printf("%s: " fmt, tag, ##__VA_ARGS__) +#endif //ESP_PLATFORM diff --git a/components/soc/soc/CMakeLists.txt b/components/soc/soc/CMakeLists.txt new file mode 100644 index 000000000..0f0ee7f6c --- /dev/null +++ b/components/soc/soc/CMakeLists.txt @@ -0,0 +1,2 @@ +idf_build_get_property(target IDF_TARGET) +add_subdirectory(${target}) diff --git a/components/soc/soc/component.mk b/components/soc/soc/component.mk new file mode 100644 index 000000000..0bbeee084 --- /dev/null +++ b/components/soc/soc/component.mk @@ -0,0 +1,2 @@ +COMPONENT_ADD_INCLUDEDIRS += soc/include soc/$(SOC_NAME) soc/$(SOC_NAME)/include +COMPONENT_SRCDIRS += soc/$(SOC_NAME) diff --git a/components/soc/soc/esp32/CMakeLists.txt b/components/soc/soc/esp32/CMakeLists.txt new file mode 100644 index 000000000..d078dd52d --- /dev/null +++ b/components/soc/soc/esp32/CMakeLists.txt @@ -0,0 +1,17 @@ +add_library(soc_esp32 STATIC + "adc_periph.c" + "dac_periph.c" + "gpio_periph.c" + "rtc_io_periph.c" + "rtc_periph.c" + "sdio_slave_periph.c" + "sdmmc_periph.c" + "interrupts.c" + "spi_periph.c" + "ledc_periph.c" + "i2s_periph.c" + "i2c_periph.c" + "uart_periph.c" + "touch_sensor_periph.c") + +target_include_directories(soc_esp32 PUBLIC . include ../include) \ No newline at end of file diff --git a/components/soc/esp32/adc_periph.c b/components/soc/soc/esp32/adc_periph.c similarity index 100% rename from components/soc/esp32/adc_periph.c rename to components/soc/soc/esp32/adc_periph.c diff --git a/components/soc/esp32/dac_periph.c b/components/soc/soc/esp32/dac_periph.c similarity index 100% rename from components/soc/esp32/dac_periph.c rename to components/soc/soc/esp32/dac_periph.c diff --git a/components/soc/esp32/gpio_periph.c b/components/soc/soc/esp32/gpio_periph.c similarity index 100% rename from components/soc/esp32/gpio_periph.c rename to components/soc/soc/esp32/gpio_periph.c diff --git a/components/soc/esp32/i2c_apll.h b/components/soc/soc/esp32/i2c_apll.h similarity index 100% rename from components/soc/esp32/i2c_apll.h rename to components/soc/soc/esp32/i2c_apll.h diff --git a/components/soc/esp32/i2c_bbpll.h b/components/soc/soc/esp32/i2c_bbpll.h similarity index 100% rename from components/soc/esp32/i2c_bbpll.h rename to components/soc/soc/esp32/i2c_bbpll.h diff --git a/components/soc/esp32/i2c_periph.c b/components/soc/soc/esp32/i2c_periph.c similarity index 100% rename from components/soc/esp32/i2c_periph.c rename to components/soc/soc/esp32/i2c_periph.c diff --git a/components/soc/esp32/i2s_periph.c b/components/soc/soc/esp32/i2s_periph.c similarity index 100% rename from components/soc/esp32/i2s_periph.c rename to components/soc/soc/esp32/i2s_periph.c diff --git a/components/soc/esp32/include/soc/adc_caps.h b/components/soc/soc/esp32/include/soc/adc_caps.h similarity index 100% rename from components/soc/esp32/include/soc/adc_caps.h rename to components/soc/soc/esp32/include/soc/adc_caps.h diff --git a/components/soc/esp32/include/soc/adc_channel.h b/components/soc/soc/esp32/include/soc/adc_channel.h similarity index 100% rename from components/soc/esp32/include/soc/adc_channel.h rename to components/soc/soc/esp32/include/soc/adc_channel.h diff --git a/components/soc/esp32/include/soc/apb_ctrl_reg.h b/components/soc/soc/esp32/include/soc/apb_ctrl_reg.h similarity index 100% rename from components/soc/esp32/include/soc/apb_ctrl_reg.h rename to components/soc/soc/esp32/include/soc/apb_ctrl_reg.h diff --git a/components/soc/esp32/include/soc/apb_ctrl_struct.h b/components/soc/soc/esp32/include/soc/apb_ctrl_struct.h similarity index 100% rename from components/soc/esp32/include/soc/apb_ctrl_struct.h rename to components/soc/soc/esp32/include/soc/apb_ctrl_struct.h diff --git a/components/soc/esp32/include/soc/bb_reg.h b/components/soc/soc/esp32/include/soc/bb_reg.h similarity index 100% rename from components/soc/esp32/include/soc/bb_reg.h rename to components/soc/soc/esp32/include/soc/bb_reg.h diff --git a/components/soc/esp32/include/soc/boot_mode.h b/components/soc/soc/esp32/include/soc/boot_mode.h similarity index 100% rename from components/soc/esp32/include/soc/boot_mode.h rename to components/soc/soc/esp32/include/soc/boot_mode.h diff --git a/components/soc/esp32/include/soc/brownout_caps.h b/components/soc/soc/esp32/include/soc/brownout_caps.h similarity index 100% rename from components/soc/esp32/include/soc/brownout_caps.h rename to components/soc/soc/esp32/include/soc/brownout_caps.h diff --git a/components/soc/esp32/include/soc/can_caps.h b/components/soc/soc/esp32/include/soc/can_caps.h similarity index 100% rename from components/soc/esp32/include/soc/can_caps.h rename to components/soc/soc/esp32/include/soc/can_caps.h diff --git a/components/soc/esp32/include/soc/can_struct.h b/components/soc/soc/esp32/include/soc/can_struct.h similarity index 100% rename from components/soc/esp32/include/soc/can_struct.h rename to components/soc/soc/esp32/include/soc/can_struct.h diff --git a/components/soc/esp32/include/soc/clkout_channel.h b/components/soc/soc/esp32/include/soc/clkout_channel.h similarity index 100% rename from components/soc/esp32/include/soc/clkout_channel.h rename to components/soc/soc/esp32/include/soc/clkout_channel.h diff --git a/components/soc/esp32/include/soc/cpu.h b/components/soc/soc/esp32/include/soc/cpu.h similarity index 100% rename from components/soc/esp32/include/soc/cpu.h rename to components/soc/soc/esp32/include/soc/cpu.h diff --git a/components/soc/esp32/include/soc/dac_caps.h b/components/soc/soc/esp32/include/soc/dac_caps.h similarity index 100% rename from components/soc/esp32/include/soc/dac_caps.h rename to components/soc/soc/esp32/include/soc/dac_caps.h diff --git a/components/soc/esp32/include/soc/dac_channel.h b/components/soc/soc/esp32/include/soc/dac_channel.h similarity index 100% rename from components/soc/esp32/include/soc/dac_channel.h rename to components/soc/soc/esp32/include/soc/dac_channel.h diff --git a/components/soc/esp32/include/soc/dport_access.h b/components/soc/soc/esp32/include/soc/dport_access.h similarity index 100% rename from components/soc/esp32/include/soc/dport_access.h rename to components/soc/soc/esp32/include/soc/dport_access.h diff --git a/components/soc/esp32/include/soc/dport_reg.h b/components/soc/soc/esp32/include/soc/dport_reg.h similarity index 100% rename from components/soc/esp32/include/soc/dport_reg.h rename to components/soc/soc/esp32/include/soc/dport_reg.h diff --git a/components/soc/esp32/include/soc/efuse_reg.h b/components/soc/soc/esp32/include/soc/efuse_reg.h similarity index 100% rename from components/soc/esp32/include/soc/efuse_reg.h rename to components/soc/soc/esp32/include/soc/efuse_reg.h diff --git a/components/soc/esp32/include/soc/emac_dma_struct.h b/components/soc/soc/esp32/include/soc/emac_dma_struct.h similarity index 100% rename from components/soc/esp32/include/soc/emac_dma_struct.h rename to components/soc/soc/esp32/include/soc/emac_dma_struct.h diff --git a/components/soc/esp32/include/soc/emac_ext_struct.h b/components/soc/soc/esp32/include/soc/emac_ext_struct.h similarity index 100% rename from components/soc/esp32/include/soc/emac_ext_struct.h rename to components/soc/soc/esp32/include/soc/emac_ext_struct.h diff --git a/components/soc/esp32/include/soc/emac_mac_struct.h b/components/soc/soc/esp32/include/soc/emac_mac_struct.h similarity index 100% rename from components/soc/esp32/include/soc/emac_mac_struct.h rename to components/soc/soc/esp32/include/soc/emac_mac_struct.h diff --git a/components/soc/esp32/include/soc/fe_reg.h b/components/soc/soc/esp32/include/soc/fe_reg.h similarity index 100% rename from components/soc/esp32/include/soc/fe_reg.h rename to components/soc/soc/esp32/include/soc/fe_reg.h diff --git a/components/soc/esp32/include/soc/frc_timer_reg.h b/components/soc/soc/esp32/include/soc/frc_timer_reg.h similarity index 100% rename from components/soc/esp32/include/soc/frc_timer_reg.h rename to components/soc/soc/esp32/include/soc/frc_timer_reg.h diff --git a/components/soc/esp32/include/soc/gpio_caps.h b/components/soc/soc/esp32/include/soc/gpio_caps.h similarity index 100% rename from components/soc/esp32/include/soc/gpio_caps.h rename to components/soc/soc/esp32/include/soc/gpio_caps.h diff --git a/components/soc/esp32/include/soc/gpio_reg.h b/components/soc/soc/esp32/include/soc/gpio_reg.h similarity index 100% rename from components/soc/esp32/include/soc/gpio_reg.h rename to components/soc/soc/esp32/include/soc/gpio_reg.h diff --git a/components/soc/esp32/include/soc/gpio_sd_reg.h b/components/soc/soc/esp32/include/soc/gpio_sd_reg.h similarity index 100% rename from components/soc/esp32/include/soc/gpio_sd_reg.h rename to components/soc/soc/esp32/include/soc/gpio_sd_reg.h diff --git a/components/soc/esp32/include/soc/gpio_sd_struct.h b/components/soc/soc/esp32/include/soc/gpio_sd_struct.h similarity index 100% rename from components/soc/esp32/include/soc/gpio_sd_struct.h rename to components/soc/soc/esp32/include/soc/gpio_sd_struct.h diff --git a/components/soc/esp32/include/soc/gpio_sig_map.h b/components/soc/soc/esp32/include/soc/gpio_sig_map.h similarity index 100% rename from components/soc/esp32/include/soc/gpio_sig_map.h rename to components/soc/soc/esp32/include/soc/gpio_sig_map.h diff --git a/components/soc/esp32/include/soc/gpio_struct.h b/components/soc/soc/esp32/include/soc/gpio_struct.h similarity index 100% rename from components/soc/esp32/include/soc/gpio_struct.h rename to components/soc/soc/esp32/include/soc/gpio_struct.h diff --git a/components/soc/esp32/include/soc/hinf_reg.h b/components/soc/soc/esp32/include/soc/hinf_reg.h similarity index 100% rename from components/soc/esp32/include/soc/hinf_reg.h rename to components/soc/soc/esp32/include/soc/hinf_reg.h diff --git a/components/soc/esp32/include/soc/hinf_struct.h b/components/soc/soc/esp32/include/soc/hinf_struct.h similarity index 100% rename from components/soc/esp32/include/soc/hinf_struct.h rename to components/soc/soc/esp32/include/soc/hinf_struct.h diff --git a/components/soc/esp32/include/soc/host_reg.h b/components/soc/soc/esp32/include/soc/host_reg.h similarity index 100% rename from components/soc/esp32/include/soc/host_reg.h rename to components/soc/soc/esp32/include/soc/host_reg.h diff --git a/components/soc/esp32/include/soc/host_struct.h b/components/soc/soc/esp32/include/soc/host_struct.h similarity index 100% rename from components/soc/esp32/include/soc/host_struct.h rename to components/soc/soc/esp32/include/soc/host_struct.h diff --git a/components/soc/esp32/include/soc/hwcrypto_reg.h b/components/soc/soc/esp32/include/soc/hwcrypto_reg.h similarity index 100% rename from components/soc/esp32/include/soc/hwcrypto_reg.h rename to components/soc/soc/esp32/include/soc/hwcrypto_reg.h diff --git a/components/soc/esp32/include/soc/i2c_caps.h b/components/soc/soc/esp32/include/soc/i2c_caps.h similarity index 100% rename from components/soc/esp32/include/soc/i2c_caps.h rename to components/soc/soc/esp32/include/soc/i2c_caps.h diff --git a/components/soc/esp32/include/soc/i2c_reg.h b/components/soc/soc/esp32/include/soc/i2c_reg.h similarity index 100% rename from components/soc/esp32/include/soc/i2c_reg.h rename to components/soc/soc/esp32/include/soc/i2c_reg.h diff --git a/components/soc/esp32/include/soc/i2c_struct.h b/components/soc/soc/esp32/include/soc/i2c_struct.h similarity index 100% rename from components/soc/esp32/include/soc/i2c_struct.h rename to components/soc/soc/esp32/include/soc/i2c_struct.h diff --git a/components/soc/esp32/include/soc/i2s_caps.h b/components/soc/soc/esp32/include/soc/i2s_caps.h similarity index 100% rename from components/soc/esp32/include/soc/i2s_caps.h rename to components/soc/soc/esp32/include/soc/i2s_caps.h diff --git a/components/soc/esp32/include/soc/i2s_reg.h b/components/soc/soc/esp32/include/soc/i2s_reg.h similarity index 100% rename from components/soc/esp32/include/soc/i2s_reg.h rename to components/soc/soc/esp32/include/soc/i2s_reg.h diff --git a/components/soc/esp32/include/soc/i2s_struct.h b/components/soc/soc/esp32/include/soc/i2s_struct.h similarity index 100% rename from components/soc/esp32/include/soc/i2s_struct.h rename to components/soc/soc/esp32/include/soc/i2s_struct.h diff --git a/components/soc/esp32/include/soc/io_mux_reg.h b/components/soc/soc/esp32/include/soc/io_mux_reg.h similarity index 100% rename from components/soc/esp32/include/soc/io_mux_reg.h rename to components/soc/soc/esp32/include/soc/io_mux_reg.h diff --git a/components/soc/esp32/include/soc/ledc_caps.h b/components/soc/soc/esp32/include/soc/ledc_caps.h similarity index 100% rename from components/soc/esp32/include/soc/ledc_caps.h rename to components/soc/soc/esp32/include/soc/ledc_caps.h diff --git a/components/soc/esp32/include/soc/ledc_reg.h b/components/soc/soc/esp32/include/soc/ledc_reg.h similarity index 100% rename from components/soc/esp32/include/soc/ledc_reg.h rename to components/soc/soc/esp32/include/soc/ledc_reg.h diff --git a/components/soc/esp32/include/soc/ledc_struct.h b/components/soc/soc/esp32/include/soc/ledc_struct.h similarity index 100% rename from components/soc/esp32/include/soc/ledc_struct.h rename to components/soc/soc/esp32/include/soc/ledc_struct.h diff --git a/components/soc/esp32/include/soc/mcpwm_caps.h b/components/soc/soc/esp32/include/soc/mcpwm_caps.h similarity index 100% rename from components/soc/esp32/include/soc/mcpwm_caps.h rename to components/soc/soc/esp32/include/soc/mcpwm_caps.h diff --git a/components/soc/esp32/include/soc/mcpwm_reg.h b/components/soc/soc/esp32/include/soc/mcpwm_reg.h similarity index 100% rename from components/soc/esp32/include/soc/mcpwm_reg.h rename to components/soc/soc/esp32/include/soc/mcpwm_reg.h diff --git a/components/soc/esp32/include/soc/mcpwm_struct.h b/components/soc/soc/esp32/include/soc/mcpwm_struct.h similarity index 100% rename from components/soc/esp32/include/soc/mcpwm_struct.h rename to components/soc/soc/esp32/include/soc/mcpwm_struct.h diff --git a/components/soc/esp32/include/soc/nrx_reg.h b/components/soc/soc/esp32/include/soc/nrx_reg.h similarity index 100% rename from components/soc/esp32/include/soc/nrx_reg.h rename to components/soc/soc/esp32/include/soc/nrx_reg.h diff --git a/components/soc/esp32/include/soc/pcnt_caps.h b/components/soc/soc/esp32/include/soc/pcnt_caps.h similarity index 100% rename from components/soc/esp32/include/soc/pcnt_caps.h rename to components/soc/soc/esp32/include/soc/pcnt_caps.h diff --git a/components/soc/esp32/include/soc/pcnt_reg.h b/components/soc/soc/esp32/include/soc/pcnt_reg.h similarity index 100% rename from components/soc/esp32/include/soc/pcnt_reg.h rename to components/soc/soc/esp32/include/soc/pcnt_reg.h diff --git a/components/soc/esp32/include/soc/pcnt_struct.h b/components/soc/soc/esp32/include/soc/pcnt_struct.h similarity index 100% rename from components/soc/esp32/include/soc/pcnt_struct.h rename to components/soc/soc/esp32/include/soc/pcnt_struct.h diff --git a/components/soc/esp32/include/soc/periph_defs.h b/components/soc/soc/esp32/include/soc/periph_defs.h similarity index 100% rename from components/soc/esp32/include/soc/periph_defs.h rename to components/soc/soc/esp32/include/soc/periph_defs.h diff --git a/components/soc/esp32/include/soc/pid.h b/components/soc/soc/esp32/include/soc/pid.h similarity index 100% rename from components/soc/esp32/include/soc/pid.h rename to components/soc/soc/esp32/include/soc/pid.h diff --git a/components/soc/esp32/include/soc/rmt_caps.h b/components/soc/soc/esp32/include/soc/rmt_caps.h similarity index 100% rename from components/soc/esp32/include/soc/rmt_caps.h rename to components/soc/soc/esp32/include/soc/rmt_caps.h diff --git a/components/soc/esp32/include/soc/rmt_reg.h b/components/soc/soc/esp32/include/soc/rmt_reg.h similarity index 100% rename from components/soc/esp32/include/soc/rmt_reg.h rename to components/soc/soc/esp32/include/soc/rmt_reg.h diff --git a/components/soc/esp32/include/soc/rmt_struct.h b/components/soc/soc/esp32/include/soc/rmt_struct.h similarity index 100% rename from components/soc/esp32/include/soc/rmt_struct.h rename to components/soc/soc/esp32/include/soc/rmt_struct.h diff --git a/components/soc/esp32/include/soc/rtc.h b/components/soc/soc/esp32/include/soc/rtc.h similarity index 100% rename from components/soc/esp32/include/soc/rtc.h rename to components/soc/soc/esp32/include/soc/rtc.h diff --git a/components/soc/esp32/include/soc/rtc_cntl_reg.h b/components/soc/soc/esp32/include/soc/rtc_cntl_reg.h similarity index 100% rename from components/soc/esp32/include/soc/rtc_cntl_reg.h rename to components/soc/soc/esp32/include/soc/rtc_cntl_reg.h diff --git a/components/soc/esp32/include/soc/rtc_cntl_struct.h b/components/soc/soc/esp32/include/soc/rtc_cntl_struct.h similarity index 100% rename from components/soc/esp32/include/soc/rtc_cntl_struct.h rename to components/soc/soc/esp32/include/soc/rtc_cntl_struct.h diff --git a/components/soc/esp32/include/soc/rtc_i2c_reg.h b/components/soc/soc/esp32/include/soc/rtc_i2c_reg.h similarity index 100% rename from components/soc/esp32/include/soc/rtc_i2c_reg.h rename to components/soc/soc/esp32/include/soc/rtc_i2c_reg.h diff --git a/components/soc/esp32/include/soc/rtc_io_caps.h b/components/soc/soc/esp32/include/soc/rtc_io_caps.h similarity index 100% rename from components/soc/esp32/include/soc/rtc_io_caps.h rename to components/soc/soc/esp32/include/soc/rtc_io_caps.h diff --git a/components/soc/esp32/include/soc/rtc_io_channel.h b/components/soc/soc/esp32/include/soc/rtc_io_channel.h similarity index 100% rename from components/soc/esp32/include/soc/rtc_io_channel.h rename to components/soc/soc/esp32/include/soc/rtc_io_channel.h diff --git a/components/soc/esp32/include/soc/rtc_io_reg.h b/components/soc/soc/esp32/include/soc/rtc_io_reg.h similarity index 100% rename from components/soc/esp32/include/soc/rtc_io_reg.h rename to components/soc/soc/esp32/include/soc/rtc_io_reg.h diff --git a/components/soc/esp32/include/soc/rtc_io_struct.h b/components/soc/soc/esp32/include/soc/rtc_io_struct.h similarity index 100% rename from components/soc/esp32/include/soc/rtc_io_struct.h rename to components/soc/soc/esp32/include/soc/rtc_io_struct.h diff --git a/components/soc/esp32/include/soc/sdio_slave_pins.h b/components/soc/soc/esp32/include/soc/sdio_slave_pins.h similarity index 100% rename from components/soc/esp32/include/soc/sdio_slave_pins.h rename to components/soc/soc/esp32/include/soc/sdio_slave_pins.h diff --git a/components/soc/esp32/include/soc/sdmmc_pins.h b/components/soc/soc/esp32/include/soc/sdmmc_pins.h similarity index 100% rename from components/soc/esp32/include/soc/sdmmc_pins.h rename to components/soc/soc/esp32/include/soc/sdmmc_pins.h diff --git a/components/soc/esp32/include/soc/sdmmc_reg.h b/components/soc/soc/esp32/include/soc/sdmmc_reg.h similarity index 100% rename from components/soc/esp32/include/soc/sdmmc_reg.h rename to components/soc/soc/esp32/include/soc/sdmmc_reg.h diff --git a/components/soc/esp32/include/soc/sdmmc_struct.h b/components/soc/soc/esp32/include/soc/sdmmc_struct.h similarity index 100% rename from components/soc/esp32/include/soc/sdmmc_struct.h rename to components/soc/soc/esp32/include/soc/sdmmc_struct.h diff --git a/components/soc/esp32/include/soc/sens_reg.h b/components/soc/soc/esp32/include/soc/sens_reg.h similarity index 100% rename from components/soc/esp32/include/soc/sens_reg.h rename to components/soc/soc/esp32/include/soc/sens_reg.h diff --git a/components/soc/esp32/include/soc/sens_struct.h b/components/soc/soc/esp32/include/soc/sens_struct.h similarity index 100% rename from components/soc/esp32/include/soc/sens_struct.h rename to components/soc/soc/esp32/include/soc/sens_struct.h diff --git a/components/soc/esp32/include/soc/sigmadelta_caps.h b/components/soc/soc/esp32/include/soc/sigmadelta_caps.h similarity index 100% rename from components/soc/esp32/include/soc/sigmadelta_caps.h rename to components/soc/soc/esp32/include/soc/sigmadelta_caps.h diff --git a/components/soc/esp32/include/soc/slc_reg.h b/components/soc/soc/esp32/include/soc/slc_reg.h similarity index 100% rename from components/soc/esp32/include/soc/slc_reg.h rename to components/soc/soc/esp32/include/soc/slc_reg.h diff --git a/components/soc/esp32/include/soc/slc_struct.h b/components/soc/soc/esp32/include/soc/slc_struct.h similarity index 100% rename from components/soc/esp32/include/soc/slc_struct.h rename to components/soc/soc/esp32/include/soc/slc_struct.h diff --git a/components/soc/esp32/include/soc/soc.h b/components/soc/soc/esp32/include/soc/soc.h similarity index 100% rename from components/soc/esp32/include/soc/soc.h rename to components/soc/soc/esp32/include/soc/soc.h diff --git a/components/soc/esp32/include/soc/soc_caps.h b/components/soc/soc/esp32/include/soc/soc_caps.h similarity index 100% rename from components/soc/esp32/include/soc/soc_caps.h rename to components/soc/soc/esp32/include/soc/soc_caps.h diff --git a/components/soc/esp32/include/soc/soc_ulp.h b/components/soc/soc/esp32/include/soc/soc_ulp.h similarity index 100% rename from components/soc/esp32/include/soc/soc_ulp.h rename to components/soc/soc/esp32/include/soc/soc_ulp.h diff --git a/components/soc/esp32/include/soc/spi_caps.h b/components/soc/soc/esp32/include/soc/spi_caps.h similarity index 100% rename from components/soc/esp32/include/soc/spi_caps.h rename to components/soc/soc/esp32/include/soc/spi_caps.h diff --git a/components/soc/esp32/include/soc/spi_reg.h b/components/soc/soc/esp32/include/soc/spi_reg.h similarity index 100% rename from components/soc/esp32/include/soc/spi_reg.h rename to components/soc/soc/esp32/include/soc/spi_reg.h diff --git a/components/soc/esp32/include/soc/spi_struct.h b/components/soc/soc/esp32/include/soc/spi_struct.h similarity index 100% rename from components/soc/esp32/include/soc/spi_struct.h rename to components/soc/soc/esp32/include/soc/spi_struct.h diff --git a/components/soc/esp32/include/soc/syscon_reg.h b/components/soc/soc/esp32/include/soc/syscon_reg.h similarity index 100% rename from components/soc/esp32/include/soc/syscon_reg.h rename to components/soc/soc/esp32/include/soc/syscon_reg.h diff --git a/components/soc/esp32/include/soc/syscon_struct.h b/components/soc/soc/esp32/include/soc/syscon_struct.h similarity index 100% rename from components/soc/esp32/include/soc/syscon_struct.h rename to components/soc/soc/esp32/include/soc/syscon_struct.h diff --git a/components/soc/esp32/include/soc/timer_group_caps.h b/components/soc/soc/esp32/include/soc/timer_group_caps.h similarity index 100% rename from components/soc/esp32/include/soc/timer_group_caps.h rename to components/soc/soc/esp32/include/soc/timer_group_caps.h diff --git a/components/soc/esp32/include/soc/timer_group_reg.h b/components/soc/soc/esp32/include/soc/timer_group_reg.h similarity index 100% rename from components/soc/esp32/include/soc/timer_group_reg.h rename to components/soc/soc/esp32/include/soc/timer_group_reg.h diff --git a/components/soc/esp32/include/soc/timer_group_struct.h b/components/soc/soc/esp32/include/soc/timer_group_struct.h similarity index 100% rename from components/soc/esp32/include/soc/timer_group_struct.h rename to components/soc/soc/esp32/include/soc/timer_group_struct.h diff --git a/components/soc/esp32/include/soc/touch_sensor_caps.h b/components/soc/soc/esp32/include/soc/touch_sensor_caps.h similarity index 100% rename from components/soc/esp32/include/soc/touch_sensor_caps.h rename to components/soc/soc/esp32/include/soc/touch_sensor_caps.h diff --git a/components/soc/esp32/include/soc/touch_sensor_channel.h b/components/soc/soc/esp32/include/soc/touch_sensor_channel.h similarity index 100% rename from components/soc/esp32/include/soc/touch_sensor_channel.h rename to components/soc/soc/esp32/include/soc/touch_sensor_channel.h diff --git a/components/soc/esp32/include/soc/uart_caps.h b/components/soc/soc/esp32/include/soc/uart_caps.h similarity index 100% rename from components/soc/esp32/include/soc/uart_caps.h rename to components/soc/soc/esp32/include/soc/uart_caps.h diff --git a/components/soc/esp32/include/soc/uart_channel.h b/components/soc/soc/esp32/include/soc/uart_channel.h similarity index 100% rename from components/soc/esp32/include/soc/uart_channel.h rename to components/soc/soc/esp32/include/soc/uart_channel.h diff --git a/components/soc/esp32/include/soc/uart_reg.h b/components/soc/soc/esp32/include/soc/uart_reg.h similarity index 100% rename from components/soc/esp32/include/soc/uart_reg.h rename to components/soc/soc/esp32/include/soc/uart_reg.h diff --git a/components/soc/esp32/include/soc/uart_struct.h b/components/soc/soc/esp32/include/soc/uart_struct.h similarity index 100% rename from components/soc/esp32/include/soc/uart_struct.h rename to components/soc/soc/esp32/include/soc/uart_struct.h diff --git a/components/soc/esp32/include/soc/uhci_reg.h b/components/soc/soc/esp32/include/soc/uhci_reg.h similarity index 100% rename from components/soc/esp32/include/soc/uhci_reg.h rename to components/soc/soc/esp32/include/soc/uhci_reg.h diff --git a/components/soc/esp32/include/soc/uhci_struct.h b/components/soc/soc/esp32/include/soc/uhci_struct.h similarity index 100% rename from components/soc/esp32/include/soc/uhci_struct.h rename to components/soc/soc/esp32/include/soc/uhci_struct.h diff --git a/components/soc/esp32/include/soc/wdev_reg.h b/components/soc/soc/esp32/include/soc/wdev_reg.h similarity index 100% rename from components/soc/esp32/include/soc/wdev_reg.h rename to components/soc/soc/esp32/include/soc/wdev_reg.h diff --git a/components/soc/esp32/interrupts.c b/components/soc/soc/esp32/interrupts.c similarity index 100% rename from components/soc/esp32/interrupts.c rename to components/soc/soc/esp32/interrupts.c diff --git a/components/soc/esp32/ledc_periph.c b/components/soc/soc/esp32/ledc_periph.c similarity index 100% rename from components/soc/esp32/ledc_periph.c rename to components/soc/soc/esp32/ledc_periph.c diff --git a/components/soc/esp32/rtc_io_periph.c b/components/soc/soc/esp32/rtc_io_periph.c similarity index 100% rename from components/soc/esp32/rtc_io_periph.c rename to components/soc/soc/esp32/rtc_io_periph.c diff --git a/components/soc/esp32/rtc_periph.c b/components/soc/soc/esp32/rtc_periph.c similarity index 100% rename from components/soc/esp32/rtc_periph.c rename to components/soc/soc/esp32/rtc_periph.c diff --git a/components/soc/esp32/sdio_slave_periph.c b/components/soc/soc/esp32/sdio_slave_periph.c similarity index 100% rename from components/soc/esp32/sdio_slave_periph.c rename to components/soc/soc/esp32/sdio_slave_periph.c diff --git a/components/soc/esp32/sdmmc_periph.c b/components/soc/soc/esp32/sdmmc_periph.c similarity index 100% rename from components/soc/esp32/sdmmc_periph.c rename to components/soc/soc/esp32/sdmmc_periph.c diff --git a/components/soc/esp32/spi_periph.c b/components/soc/soc/esp32/spi_periph.c similarity index 100% rename from components/soc/esp32/spi_periph.c rename to components/soc/soc/esp32/spi_periph.c diff --git a/components/soc/esp32/touch_sensor_periph.c b/components/soc/soc/esp32/touch_sensor_periph.c similarity index 100% rename from components/soc/esp32/touch_sensor_periph.c rename to components/soc/soc/esp32/touch_sensor_periph.c diff --git a/components/soc/esp32/uart_periph.c b/components/soc/soc/esp32/uart_periph.c similarity index 100% rename from components/soc/esp32/uart_periph.c rename to components/soc/soc/esp32/uart_periph.c diff --git a/components/soc/soc/esp32s2/CMakeLists.txt b/components/soc/soc/esp32s2/CMakeLists.txt new file mode 100644 index 000000000..808e76f7e --- /dev/null +++ b/components/soc/soc/esp32s2/CMakeLists.txt @@ -0,0 +1,16 @@ +add_library(soc_esp32s2 STATIC + "adc_periph.c" + "dac_periph.c" + "gpio_periph.c" + "rtc_io_periph.c" + "rtc_periph.c" + "interrupts.c" + "spi_periph.c" + "ledc_periph.c" + "i2s_periph.c" + "i2c_periph.c" + "uart_periph.c" + "usb_periph.c" + "touch_sensor_periph.c") + +target_include_directories(soc_esp32s2 PUBLIC . include ../include) diff --git a/components/soc/esp32s2/adc_periph.c b/components/soc/soc/esp32s2/adc_periph.c similarity index 100% rename from components/soc/esp32s2/adc_periph.c rename to components/soc/soc/esp32s2/adc_periph.c diff --git a/components/soc/esp32s2/dac_periph.c b/components/soc/soc/esp32s2/dac_periph.c similarity index 100% rename from components/soc/esp32s2/dac_periph.c rename to components/soc/soc/esp32s2/dac_periph.c diff --git a/components/soc/esp32s2/gpio_periph.c b/components/soc/soc/esp32s2/gpio_periph.c similarity index 100% rename from components/soc/esp32s2/gpio_periph.c rename to components/soc/soc/esp32s2/gpio_periph.c diff --git a/components/soc/esp32s2/i2c_apll.h b/components/soc/soc/esp32s2/i2c_apll.h similarity index 100% rename from components/soc/esp32s2/i2c_apll.h rename to components/soc/soc/esp32s2/i2c_apll.h diff --git a/components/soc/esp32s2/i2c_bbpll.h b/components/soc/soc/esp32s2/i2c_bbpll.h similarity index 100% rename from components/soc/esp32s2/i2c_bbpll.h rename to components/soc/soc/esp32s2/i2c_bbpll.h diff --git a/components/soc/esp32s2/i2c_periph.c b/components/soc/soc/esp32s2/i2c_periph.c similarity index 100% rename from components/soc/esp32s2/i2c_periph.c rename to components/soc/soc/esp32s2/i2c_periph.c diff --git a/components/soc/esp32s2/i2s_periph.c b/components/soc/soc/esp32s2/i2s_periph.c similarity index 100% rename from components/soc/esp32s2/i2s_periph.c rename to components/soc/soc/esp32s2/i2s_periph.c diff --git a/components/soc/esp32s2/include/soc/adc_caps.h b/components/soc/soc/esp32s2/include/soc/adc_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/adc_caps.h rename to components/soc/soc/esp32s2/include/soc/adc_caps.h diff --git a/components/soc/esp32s2/include/soc/adc_channel.h b/components/soc/soc/esp32s2/include/soc/adc_channel.h similarity index 100% rename from components/soc/esp32s2/include/soc/adc_channel.h rename to components/soc/soc/esp32s2/include/soc/adc_channel.h diff --git a/components/soc/esp32s2/include/soc/apb_ctrl_reg.h b/components/soc/soc/esp32s2/include/soc/apb_ctrl_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/apb_ctrl_reg.h rename to components/soc/soc/esp32s2/include/soc/apb_ctrl_reg.h diff --git a/components/soc/esp32s2/include/soc/apb_ctrl_struct.h b/components/soc/soc/esp32s2/include/soc/apb_ctrl_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/apb_ctrl_struct.h rename to components/soc/soc/esp32s2/include/soc/apb_ctrl_struct.h diff --git a/components/soc/esp32s2/include/soc/apb_saradc_reg.h b/components/soc/soc/esp32s2/include/soc/apb_saradc_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/apb_saradc_reg.h rename to components/soc/soc/esp32s2/include/soc/apb_saradc_reg.h diff --git a/components/soc/esp32s2/include/soc/apb_saradc_struct.h b/components/soc/soc/esp32s2/include/soc/apb_saradc_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/apb_saradc_struct.h rename to components/soc/soc/esp32s2/include/soc/apb_saradc_struct.h diff --git a/components/soc/esp32s2/include/soc/assist_debug_reg.h b/components/soc/soc/esp32s2/include/soc/assist_debug_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/assist_debug_reg.h rename to components/soc/soc/esp32s2/include/soc/assist_debug_reg.h diff --git a/components/soc/esp32s2/include/soc/bb_reg.h b/components/soc/soc/esp32s2/include/soc/bb_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/bb_reg.h rename to components/soc/soc/esp32s2/include/soc/bb_reg.h diff --git a/components/soc/esp32s2/include/soc/boot_mode.h b/components/soc/soc/esp32s2/include/soc/boot_mode.h similarity index 100% rename from components/soc/esp32s2/include/soc/boot_mode.h rename to components/soc/soc/esp32s2/include/soc/boot_mode.h diff --git a/components/soc/esp32s2/include/soc/brownout_caps.h b/components/soc/soc/esp32s2/include/soc/brownout_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/brownout_caps.h rename to components/soc/soc/esp32s2/include/soc/brownout_caps.h diff --git a/components/soc/esp32s2/include/soc/cache_memory.h b/components/soc/soc/esp32s2/include/soc/cache_memory.h similarity index 100% rename from components/soc/esp32s2/include/soc/cache_memory.h rename to components/soc/soc/esp32s2/include/soc/cache_memory.h diff --git a/components/soc/esp32s2/include/soc/clkout_channel.h b/components/soc/soc/esp32s2/include/soc/clkout_channel.h similarity index 100% rename from components/soc/esp32s2/include/soc/clkout_channel.h rename to components/soc/soc/esp32s2/include/soc/clkout_channel.h diff --git a/components/soc/esp32s2/include/soc/cpu.h b/components/soc/soc/esp32s2/include/soc/cpu.h similarity index 100% rename from components/soc/esp32s2/include/soc/cpu.h rename to components/soc/soc/esp32s2/include/soc/cpu.h diff --git a/components/soc/esp32s2/include/soc/crypto_dma_reg.h b/components/soc/soc/esp32s2/include/soc/crypto_dma_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/crypto_dma_reg.h rename to components/soc/soc/esp32s2/include/soc/crypto_dma_reg.h diff --git a/components/soc/esp32s2/include/soc/dac_caps.h b/components/soc/soc/esp32s2/include/soc/dac_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/dac_caps.h rename to components/soc/soc/esp32s2/include/soc/dac_caps.h diff --git a/components/soc/esp32s2/include/soc/dac_channel.h b/components/soc/soc/esp32s2/include/soc/dac_channel.h similarity index 100% rename from components/soc/esp32s2/include/soc/dac_channel.h rename to components/soc/soc/esp32s2/include/soc/dac_channel.h diff --git a/components/soc/esp32s2/include/soc/dport_access.h b/components/soc/soc/esp32s2/include/soc/dport_access.h similarity index 100% rename from components/soc/esp32s2/include/soc/dport_access.h rename to components/soc/soc/esp32s2/include/soc/dport_access.h diff --git a/components/soc/esp32s2/include/soc/dport_reg.h b/components/soc/soc/esp32s2/include/soc/dport_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/dport_reg.h rename to components/soc/soc/esp32s2/include/soc/dport_reg.h diff --git a/components/soc/esp32s2/include/soc/efuse_reg.h b/components/soc/soc/esp32s2/include/soc/efuse_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/efuse_reg.h rename to components/soc/soc/esp32s2/include/soc/efuse_reg.h diff --git a/components/soc/esp32s2/include/soc/efuse_struct.h b/components/soc/soc/esp32s2/include/soc/efuse_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/efuse_struct.h rename to components/soc/soc/esp32s2/include/soc/efuse_struct.h diff --git a/components/soc/esp32s2/include/soc/extmem_reg.h b/components/soc/soc/esp32s2/include/soc/extmem_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/extmem_reg.h rename to components/soc/soc/esp32s2/include/soc/extmem_reg.h diff --git a/components/soc/esp32s2/include/soc/fe_reg.h b/components/soc/soc/esp32s2/include/soc/fe_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/fe_reg.h rename to components/soc/soc/esp32s2/include/soc/fe_reg.h diff --git a/components/soc/esp32s2/include/soc/frc_timer_reg.h b/components/soc/soc/esp32s2/include/soc/frc_timer_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/frc_timer_reg.h rename to components/soc/soc/esp32s2/include/soc/frc_timer_reg.h diff --git a/components/soc/esp32s2/include/soc/gpio_caps.h b/components/soc/soc/esp32s2/include/soc/gpio_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/gpio_caps.h rename to components/soc/soc/esp32s2/include/soc/gpio_caps.h diff --git a/components/soc/esp32s2/include/soc/gpio_reg.h b/components/soc/soc/esp32s2/include/soc/gpio_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/gpio_reg.h rename to components/soc/soc/esp32s2/include/soc/gpio_reg.h diff --git a/components/soc/esp32s2/include/soc/gpio_sd_reg.h b/components/soc/soc/esp32s2/include/soc/gpio_sd_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/gpio_sd_reg.h rename to components/soc/soc/esp32s2/include/soc/gpio_sd_reg.h diff --git a/components/soc/esp32s2/include/soc/gpio_sd_struct.h b/components/soc/soc/esp32s2/include/soc/gpio_sd_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/gpio_sd_struct.h rename to components/soc/soc/esp32s2/include/soc/gpio_sd_struct.h diff --git a/components/soc/esp32s2/include/soc/gpio_sig_map.h b/components/soc/soc/esp32s2/include/soc/gpio_sig_map.h similarity index 100% rename from components/soc/esp32s2/include/soc/gpio_sig_map.h rename to components/soc/soc/esp32s2/include/soc/gpio_sig_map.h diff --git a/components/soc/esp32s2/include/soc/gpio_struct.h b/components/soc/soc/esp32s2/include/soc/gpio_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/gpio_struct.h rename to components/soc/soc/esp32s2/include/soc/gpio_struct.h diff --git a/components/soc/esp32s2/include/soc/hinf_reg.h b/components/soc/soc/esp32s2/include/soc/hinf_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/hinf_reg.h rename to components/soc/soc/esp32s2/include/soc/hinf_reg.h diff --git a/components/soc/esp32s2/include/soc/hinf_struct.h b/components/soc/soc/esp32s2/include/soc/hinf_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/hinf_struct.h rename to components/soc/soc/esp32s2/include/soc/hinf_struct.h diff --git a/components/soc/esp32s2/include/soc/host_reg.h b/components/soc/soc/esp32s2/include/soc/host_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/host_reg.h rename to components/soc/soc/esp32s2/include/soc/host_reg.h diff --git a/components/soc/esp32s2/include/soc/host_struct.h b/components/soc/soc/esp32s2/include/soc/host_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/host_struct.h rename to components/soc/soc/esp32s2/include/soc/host_struct.h diff --git a/components/soc/esp32s2/include/soc/hwcrypto_reg.h b/components/soc/soc/esp32s2/include/soc/hwcrypto_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/hwcrypto_reg.h rename to components/soc/soc/esp32s2/include/soc/hwcrypto_reg.h diff --git a/components/soc/esp32s2/include/soc/i2c_caps.h b/components/soc/soc/esp32s2/include/soc/i2c_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/i2c_caps.h rename to components/soc/soc/esp32s2/include/soc/i2c_caps.h diff --git a/components/soc/esp32s2/include/soc/i2c_reg.h b/components/soc/soc/esp32s2/include/soc/i2c_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/i2c_reg.h rename to components/soc/soc/esp32s2/include/soc/i2c_reg.h diff --git a/components/soc/esp32s2/include/soc/i2c_struct.h b/components/soc/soc/esp32s2/include/soc/i2c_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/i2c_struct.h rename to components/soc/soc/esp32s2/include/soc/i2c_struct.h diff --git a/components/soc/esp32s2/include/soc/i2s_caps.h b/components/soc/soc/esp32s2/include/soc/i2s_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/i2s_caps.h rename to components/soc/soc/esp32s2/include/soc/i2s_caps.h diff --git a/components/soc/esp32s2/include/soc/i2s_reg.h b/components/soc/soc/esp32s2/include/soc/i2s_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/i2s_reg.h rename to components/soc/soc/esp32s2/include/soc/i2s_reg.h diff --git a/components/soc/esp32s2/include/soc/i2s_struct.h b/components/soc/soc/esp32s2/include/soc/i2s_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/i2s_struct.h rename to components/soc/soc/esp32s2/include/soc/i2s_struct.h diff --git a/components/soc/esp32s2/include/soc/interrupt_reg.h b/components/soc/soc/esp32s2/include/soc/interrupt_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/interrupt_reg.h rename to components/soc/soc/esp32s2/include/soc/interrupt_reg.h diff --git a/components/soc/esp32s2/include/soc/io_mux_reg.h b/components/soc/soc/esp32s2/include/soc/io_mux_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/io_mux_reg.h rename to components/soc/soc/esp32s2/include/soc/io_mux_reg.h diff --git a/components/soc/esp32s2/include/soc/ledc_caps.h b/components/soc/soc/esp32s2/include/soc/ledc_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/ledc_caps.h rename to components/soc/soc/esp32s2/include/soc/ledc_caps.h diff --git a/components/soc/esp32s2/include/soc/ledc_reg.h b/components/soc/soc/esp32s2/include/soc/ledc_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/ledc_reg.h rename to components/soc/soc/esp32s2/include/soc/ledc_reg.h diff --git a/components/soc/esp32s2/include/soc/ledc_struct.h b/components/soc/soc/esp32s2/include/soc/ledc_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/ledc_struct.h rename to components/soc/soc/esp32s2/include/soc/ledc_struct.h diff --git a/components/soc/esp32s2/include/soc/mcpwm_reg.h b/components/soc/soc/esp32s2/include/soc/mcpwm_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/mcpwm_reg.h rename to components/soc/soc/esp32s2/include/soc/mcpwm_reg.h diff --git a/components/soc/esp32s2/include/soc/mcpwm_struct.h b/components/soc/soc/esp32s2/include/soc/mcpwm_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/mcpwm_struct.h rename to components/soc/soc/esp32s2/include/soc/mcpwm_struct.h diff --git a/components/soc/esp32s2/include/soc/nrx_reg.h b/components/soc/soc/esp32s2/include/soc/nrx_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/nrx_reg.h rename to components/soc/soc/esp32s2/include/soc/nrx_reg.h diff --git a/components/soc/esp32s2/include/soc/pcnt_caps.h b/components/soc/soc/esp32s2/include/soc/pcnt_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/pcnt_caps.h rename to components/soc/soc/esp32s2/include/soc/pcnt_caps.h diff --git a/components/soc/esp32s2/include/soc/pcnt_reg.h b/components/soc/soc/esp32s2/include/soc/pcnt_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/pcnt_reg.h rename to components/soc/soc/esp32s2/include/soc/pcnt_reg.h diff --git a/components/soc/esp32s2/include/soc/pcnt_struct.h b/components/soc/soc/esp32s2/include/soc/pcnt_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/pcnt_struct.h rename to components/soc/soc/esp32s2/include/soc/pcnt_struct.h diff --git a/components/soc/esp32s2/include/soc/periph_defs.h b/components/soc/soc/esp32s2/include/soc/periph_defs.h similarity index 100% rename from components/soc/esp32s2/include/soc/periph_defs.h rename to components/soc/soc/esp32s2/include/soc/periph_defs.h diff --git a/components/soc/esp32s2/include/soc/rmt_caps.h b/components/soc/soc/esp32s2/include/soc/rmt_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/rmt_caps.h rename to components/soc/soc/esp32s2/include/soc/rmt_caps.h diff --git a/components/soc/esp32s2/include/soc/rmt_reg.h b/components/soc/soc/esp32s2/include/soc/rmt_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/rmt_reg.h rename to components/soc/soc/esp32s2/include/soc/rmt_reg.h diff --git a/components/soc/esp32s2/include/soc/rmt_struct.h b/components/soc/soc/esp32s2/include/soc/rmt_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/rmt_struct.h rename to components/soc/soc/esp32s2/include/soc/rmt_struct.h diff --git a/components/soc/esp32s2/include/soc/rtc.h b/components/soc/soc/esp32s2/include/soc/rtc.h similarity index 100% rename from components/soc/esp32s2/include/soc/rtc.h rename to components/soc/soc/esp32s2/include/soc/rtc.h diff --git a/components/soc/esp32s2/include/soc/rtc_cntl_reg.h b/components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/rtc_cntl_reg.h rename to components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h diff --git a/components/soc/esp32s2/include/soc/rtc_cntl_struct.h b/components/soc/soc/esp32s2/include/soc/rtc_cntl_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/rtc_cntl_struct.h rename to components/soc/soc/esp32s2/include/soc/rtc_cntl_struct.h diff --git a/components/soc/esp32s2/include/soc/rtc_i2c_reg.h b/components/soc/soc/esp32s2/include/soc/rtc_i2c_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/rtc_i2c_reg.h rename to components/soc/soc/esp32s2/include/soc/rtc_i2c_reg.h diff --git a/components/soc/esp32s2/include/soc/rtc_i2c_struct.h b/components/soc/soc/esp32s2/include/soc/rtc_i2c_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/rtc_i2c_struct.h rename to components/soc/soc/esp32s2/include/soc/rtc_i2c_struct.h diff --git a/components/soc/esp32s2/include/soc/rtc_io_caps.h b/components/soc/soc/esp32s2/include/soc/rtc_io_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/rtc_io_caps.h rename to components/soc/soc/esp32s2/include/soc/rtc_io_caps.h diff --git a/components/soc/esp32s2/include/soc/rtc_io_channel.h b/components/soc/soc/esp32s2/include/soc/rtc_io_channel.h similarity index 100% rename from components/soc/esp32s2/include/soc/rtc_io_channel.h rename to components/soc/soc/esp32s2/include/soc/rtc_io_channel.h diff --git a/components/soc/esp32s2/include/soc/rtc_io_reg.h b/components/soc/soc/esp32s2/include/soc/rtc_io_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/rtc_io_reg.h rename to components/soc/soc/esp32s2/include/soc/rtc_io_reg.h diff --git a/components/soc/esp32s2/include/soc/rtc_io_struct.h b/components/soc/soc/esp32s2/include/soc/rtc_io_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/rtc_io_struct.h rename to components/soc/soc/esp32s2/include/soc/rtc_io_struct.h diff --git a/components/soc/esp32s2/include/soc/sdio_slave_pins.h b/components/soc/soc/esp32s2/include/soc/sdio_slave_pins.h similarity index 100% rename from components/soc/esp32s2/include/soc/sdio_slave_pins.h rename to components/soc/soc/esp32s2/include/soc/sdio_slave_pins.h diff --git a/components/soc/esp32s2/include/soc/sdmmc_pins.h b/components/soc/soc/esp32s2/include/soc/sdmmc_pins.h similarity index 100% rename from components/soc/esp32s2/include/soc/sdmmc_pins.h rename to components/soc/soc/esp32s2/include/soc/sdmmc_pins.h diff --git a/components/soc/esp32s2/include/soc/sdmmc_reg.h b/components/soc/soc/esp32s2/include/soc/sdmmc_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/sdmmc_reg.h rename to components/soc/soc/esp32s2/include/soc/sdmmc_reg.h diff --git a/components/soc/esp32s2/include/soc/sdmmc_struct.h b/components/soc/soc/esp32s2/include/soc/sdmmc_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/sdmmc_struct.h rename to components/soc/soc/esp32s2/include/soc/sdmmc_struct.h diff --git a/components/soc/esp32s2/include/soc/sens_reg.h b/components/soc/soc/esp32s2/include/soc/sens_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/sens_reg.h rename to components/soc/soc/esp32s2/include/soc/sens_reg.h diff --git a/components/soc/esp32s2/include/soc/sens_struct.h b/components/soc/soc/esp32s2/include/soc/sens_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/sens_struct.h rename to components/soc/soc/esp32s2/include/soc/sens_struct.h diff --git a/components/soc/esp32s2/include/soc/sensitive_reg.h b/components/soc/soc/esp32s2/include/soc/sensitive_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/sensitive_reg.h rename to components/soc/soc/esp32s2/include/soc/sensitive_reg.h diff --git a/components/soc/esp32s2/include/soc/sigmadelta_caps.h b/components/soc/soc/esp32s2/include/soc/sigmadelta_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/sigmadelta_caps.h rename to components/soc/soc/esp32s2/include/soc/sigmadelta_caps.h diff --git a/components/soc/esp32s2/include/soc/slc_reg.h b/components/soc/soc/esp32s2/include/soc/slc_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/slc_reg.h rename to components/soc/soc/esp32s2/include/soc/slc_reg.h diff --git a/components/soc/esp32s2/include/soc/slc_struct.h b/components/soc/soc/esp32s2/include/soc/slc_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/slc_struct.h rename to components/soc/soc/esp32s2/include/soc/slc_struct.h diff --git a/components/soc/esp32s2/include/soc/soc.h b/components/soc/soc/esp32s2/include/soc/soc.h similarity index 100% rename from components/soc/esp32s2/include/soc/soc.h rename to components/soc/soc/esp32s2/include/soc/soc.h diff --git a/components/soc/esp32s2/include/soc/soc_caps.h b/components/soc/soc/esp32s2/include/soc/soc_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/soc_caps.h rename to components/soc/soc/esp32s2/include/soc/soc_caps.h diff --git a/components/soc/esp32s2/include/soc/soc_ulp.h b/components/soc/soc/esp32s2/include/soc/soc_ulp.h similarity index 100% rename from components/soc/esp32s2/include/soc/soc_ulp.h rename to components/soc/soc/esp32s2/include/soc/soc_ulp.h diff --git a/components/soc/esp32s2/include/soc/spi_caps.h b/components/soc/soc/esp32s2/include/soc/spi_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/spi_caps.h rename to components/soc/soc/esp32s2/include/soc/spi_caps.h diff --git a/components/soc/esp32s2/include/soc/spi_mem_reg.h b/components/soc/soc/esp32s2/include/soc/spi_mem_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/spi_mem_reg.h rename to components/soc/soc/esp32s2/include/soc/spi_mem_reg.h diff --git a/components/soc/esp32s2/include/soc/spi_mem_struct.h b/components/soc/soc/esp32s2/include/soc/spi_mem_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/spi_mem_struct.h rename to components/soc/soc/esp32s2/include/soc/spi_mem_struct.h diff --git a/components/soc/soc/esp32s2/include/soc/spi_pins.h b/components/soc/soc/esp32s2/include/soc/spi_pins.h new file mode 100644 index 000000000..fb95efe12 --- /dev/null +++ b/components/soc/soc/esp32s2/include/soc/spi_pins.h @@ -0,0 +1,40 @@ +// Copyright 2015-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. + +#ifndef _SOC_SPI_PINS_H_ +#define _SOC_SPI_PINS_H_ + +#define SPI_PERIPH_NUM 3 + +#define SPI_FUNC_NUM 2 +#define SPI_IOMUX_PIN_NUM_HD 27 +#define SPI_IOMUX_PIN_NUM_CS 29 +#define SPI_IOMUX_PIN_NUM_MOSI 32 +#define SPI_IOMUX_PIN_NUM_CLK 30 +#define SPI_IOMUX_PIN_NUM_MISO 31 +#define SPI_IOMUX_PIN_NUM_WP 28 +//TODO: add the next slot + +#define FSPI_FUNC_NUM 0 +#define FSPI_IOMUX_PIN_NUM_HD 9 +#define FSPI_IOMUX_PIN_NUM_CS 10 +#define FSPI_IOMUX_PIN_NUM_MOSI 11 +#define FSPI_IOMUX_PIN_NUM_CLK 12 +#define FSPI_IOMUX_PIN_NUM_MISO 13 +#define FSPI_IOMUX_PIN_NUM_WP 14 +//TODO: add the next slot + +//HSPI and VSPI have no iomux pins + +#endif \ No newline at end of file diff --git a/components/soc/esp32s2/include/soc/spi_reg.h b/components/soc/soc/esp32s2/include/soc/spi_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/spi_reg.h rename to components/soc/soc/esp32s2/include/soc/spi_reg.h diff --git a/components/soc/esp32s2/include/soc/spi_struct.h b/components/soc/soc/esp32s2/include/soc/spi_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/spi_struct.h rename to components/soc/soc/esp32s2/include/soc/spi_struct.h diff --git a/components/soc/esp32s2/include/soc/syscon_reg.h b/components/soc/soc/esp32s2/include/soc/syscon_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/syscon_reg.h rename to components/soc/soc/esp32s2/include/soc/syscon_reg.h diff --git a/components/soc/esp32s2/include/soc/syscon_struct.h b/components/soc/soc/esp32s2/include/soc/syscon_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/syscon_struct.h rename to components/soc/soc/esp32s2/include/soc/syscon_struct.h diff --git a/components/soc/esp32s2/include/soc/system_reg.h b/components/soc/soc/esp32s2/include/soc/system_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/system_reg.h rename to components/soc/soc/esp32s2/include/soc/system_reg.h diff --git a/components/soc/esp32s2/include/soc/systimer_reg.h b/components/soc/soc/esp32s2/include/soc/systimer_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/systimer_reg.h rename to components/soc/soc/esp32s2/include/soc/systimer_reg.h diff --git a/components/soc/esp32s2/include/soc/timer_group_caps.h b/components/soc/soc/esp32s2/include/soc/timer_group_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/timer_group_caps.h rename to components/soc/soc/esp32s2/include/soc/timer_group_caps.h diff --git a/components/soc/esp32s2/include/soc/timer_group_reg.h b/components/soc/soc/esp32s2/include/soc/timer_group_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/timer_group_reg.h rename to components/soc/soc/esp32s2/include/soc/timer_group_reg.h diff --git a/components/soc/esp32s2/include/soc/timer_group_struct.h b/components/soc/soc/esp32s2/include/soc/timer_group_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/timer_group_struct.h rename to components/soc/soc/esp32s2/include/soc/timer_group_struct.h diff --git a/components/soc/esp32s2/include/soc/touch_sensor_caps.h b/components/soc/soc/esp32s2/include/soc/touch_sensor_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/touch_sensor_caps.h rename to components/soc/soc/esp32s2/include/soc/touch_sensor_caps.h diff --git a/components/soc/esp32s2/include/soc/touch_sensor_channel.h b/components/soc/soc/esp32s2/include/soc/touch_sensor_channel.h similarity index 100% rename from components/soc/esp32s2/include/soc/touch_sensor_channel.h rename to components/soc/soc/esp32s2/include/soc/touch_sensor_channel.h diff --git a/components/soc/esp32s2/include/soc/uart_caps.h b/components/soc/soc/esp32s2/include/soc/uart_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/uart_caps.h rename to components/soc/soc/esp32s2/include/soc/uart_caps.h diff --git a/components/soc/esp32s2/include/soc/uart_channel.h b/components/soc/soc/esp32s2/include/soc/uart_channel.h similarity index 100% rename from components/soc/esp32s2/include/soc/uart_channel.h rename to components/soc/soc/esp32s2/include/soc/uart_channel.h diff --git a/components/soc/esp32s2/include/soc/uart_reg.h b/components/soc/soc/esp32s2/include/soc/uart_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/uart_reg.h rename to components/soc/soc/esp32s2/include/soc/uart_reg.h diff --git a/components/soc/esp32s2/include/soc/uart_struct.h b/components/soc/soc/esp32s2/include/soc/uart_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/uart_struct.h rename to components/soc/soc/esp32s2/include/soc/uart_struct.h diff --git a/components/soc/esp32s2/include/soc/uhci_reg.h b/components/soc/soc/esp32s2/include/soc/uhci_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/uhci_reg.h rename to components/soc/soc/esp32s2/include/soc/uhci_reg.h diff --git a/components/soc/esp32s2/include/soc/uhci_struct.h b/components/soc/soc/esp32s2/include/soc/uhci_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/uhci_struct.h rename to components/soc/soc/esp32s2/include/soc/uhci_struct.h diff --git a/components/soc/esp32s2/include/soc/usb_caps.h b/components/soc/soc/esp32s2/include/soc/usb_caps.h similarity index 100% rename from components/soc/esp32s2/include/soc/usb_caps.h rename to components/soc/soc/esp32s2/include/soc/usb_caps.h diff --git a/components/soc/include/soc/usb_periph.h b/components/soc/soc/esp32s2/include/soc/usb_periph.h similarity index 100% rename from components/soc/include/soc/usb_periph.h rename to components/soc/soc/esp32s2/include/soc/usb_periph.h diff --git a/components/soc/esp32s2/include/soc/usb_pins.h b/components/soc/soc/esp32s2/include/soc/usb_pins.h similarity index 100% rename from components/soc/esp32s2/include/soc/usb_pins.h rename to components/soc/soc/esp32s2/include/soc/usb_pins.h diff --git a/components/soc/esp32s2/include/soc/usb_reg.h b/components/soc/soc/esp32s2/include/soc/usb_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/usb_reg.h rename to components/soc/soc/esp32s2/include/soc/usb_reg.h diff --git a/components/soc/esp32s2/include/soc/usb_struct.h b/components/soc/soc/esp32s2/include/soc/usb_struct.h similarity index 100% rename from components/soc/esp32s2/include/soc/usb_struct.h rename to components/soc/soc/esp32s2/include/soc/usb_struct.h diff --git a/components/soc/esp32s2/include/soc/usb_types.h b/components/soc/soc/esp32s2/include/soc/usb_types.h similarity index 100% rename from components/soc/esp32s2/include/soc/usb_types.h rename to components/soc/soc/esp32s2/include/soc/usb_types.h diff --git a/components/soc/esp32s2/include/soc/wdev_reg.h b/components/soc/soc/esp32s2/include/soc/wdev_reg.h similarity index 100% rename from components/soc/esp32s2/include/soc/wdev_reg.h rename to components/soc/soc/esp32s2/include/soc/wdev_reg.h diff --git a/components/soc/esp32s2/interrupts.c b/components/soc/soc/esp32s2/interrupts.c similarity index 100% rename from components/soc/esp32s2/interrupts.c rename to components/soc/soc/esp32s2/interrupts.c diff --git a/components/soc/esp32s2/ledc_periph.c b/components/soc/soc/esp32s2/ledc_periph.c similarity index 100% rename from components/soc/esp32s2/ledc_periph.c rename to components/soc/soc/esp32s2/ledc_periph.c diff --git a/components/soc/esp32s2/rtc_io_periph.c b/components/soc/soc/esp32s2/rtc_io_periph.c similarity index 100% rename from components/soc/esp32s2/rtc_io_periph.c rename to components/soc/soc/esp32s2/rtc_io_periph.c diff --git a/components/soc/esp32s2/rtc_periph.c b/components/soc/soc/esp32s2/rtc_periph.c similarity index 100% rename from components/soc/esp32s2/rtc_periph.c rename to components/soc/soc/esp32s2/rtc_periph.c diff --git a/components/soc/esp32s2/spi_periph.c b/components/soc/soc/esp32s2/spi_periph.c similarity index 100% rename from components/soc/esp32s2/spi_periph.c rename to components/soc/soc/esp32s2/spi_periph.c diff --git a/components/soc/esp32s2/touch_sensor_periph.c b/components/soc/soc/esp32s2/touch_sensor_periph.c similarity index 100% rename from components/soc/esp32s2/touch_sensor_periph.c rename to components/soc/soc/esp32s2/touch_sensor_periph.c diff --git a/components/soc/esp32s2/uart_periph.c b/components/soc/soc/esp32s2/uart_periph.c similarity index 100% rename from components/soc/esp32s2/uart_periph.c rename to components/soc/soc/esp32s2/uart_periph.c diff --git a/components/soc/esp32s2/usb_periph.c b/components/soc/soc/esp32s2/usb_periph.c similarity index 100% rename from components/soc/esp32s2/usb_periph.c rename to components/soc/soc/esp32s2/usb_periph.c diff --git a/components/soc/include/soc/adc_periph.h b/components/soc/soc/include/soc/adc_periph.h similarity index 100% rename from components/soc/include/soc/adc_periph.h rename to components/soc/soc/include/soc/adc_periph.h diff --git a/components/soc/include/soc/can_periph.h b/components/soc/soc/include/soc/can_periph.h similarity index 100% rename from components/soc/include/soc/can_periph.h rename to components/soc/soc/include/soc/can_periph.h diff --git a/components/soc/include/soc/dac_periph.h b/components/soc/soc/include/soc/dac_periph.h similarity index 100% rename from components/soc/include/soc/dac_periph.h rename to components/soc/soc/include/soc/dac_periph.h diff --git a/components/soc/include/soc/efuse_periph.h b/components/soc/soc/include/soc/efuse_periph.h similarity index 100% rename from components/soc/include/soc/efuse_periph.h rename to components/soc/soc/include/soc/efuse_periph.h diff --git a/components/soc/include/soc/emac_periph.h b/components/soc/soc/include/soc/emac_periph.h similarity index 100% rename from components/soc/include/soc/emac_periph.h rename to components/soc/soc/include/soc/emac_periph.h diff --git a/components/soc/include/soc/gpio_periph.h b/components/soc/soc/include/soc/gpio_periph.h similarity index 100% rename from components/soc/include/soc/gpio_periph.h rename to components/soc/soc/include/soc/gpio_periph.h diff --git a/components/soc/include/soc/hwcrypto_periph.h b/components/soc/soc/include/soc/hwcrypto_periph.h similarity index 100% rename from components/soc/include/soc/hwcrypto_periph.h rename to components/soc/soc/include/soc/hwcrypto_periph.h diff --git a/components/soc/include/soc/i2c_periph.h b/components/soc/soc/include/soc/i2c_periph.h similarity index 100% rename from components/soc/include/soc/i2c_periph.h rename to components/soc/soc/include/soc/i2c_periph.h diff --git a/components/soc/include/soc/i2s_periph.h b/components/soc/soc/include/soc/i2s_periph.h similarity index 100% rename from components/soc/include/soc/i2s_periph.h rename to components/soc/soc/include/soc/i2s_periph.h diff --git a/components/soc/include/soc/interrupts.h b/components/soc/soc/include/soc/interrupts.h similarity index 100% rename from components/soc/include/soc/interrupts.h rename to components/soc/soc/include/soc/interrupts.h diff --git a/components/soc/include/soc/ledc_periph.h b/components/soc/soc/include/soc/ledc_periph.h similarity index 100% rename from components/soc/include/soc/ledc_periph.h rename to components/soc/soc/include/soc/ledc_periph.h diff --git a/components/soc/include/soc/mcpwm_periph.h b/components/soc/soc/include/soc/mcpwm_periph.h similarity index 100% rename from components/soc/include/soc/mcpwm_periph.h rename to components/soc/soc/include/soc/mcpwm_periph.h diff --git a/components/soc/include/soc/pcnt_periph.h b/components/soc/soc/include/soc/pcnt_periph.h similarity index 100% rename from components/soc/include/soc/pcnt_periph.h rename to components/soc/soc/include/soc/pcnt_periph.h diff --git a/components/soc/include/soc/rmt_periph.h b/components/soc/soc/include/soc/rmt_periph.h similarity index 100% rename from components/soc/include/soc/rmt_periph.h rename to components/soc/soc/include/soc/rmt_periph.h diff --git a/components/soc/include/soc/rtc_io_periph.h b/components/soc/soc/include/soc/rtc_io_periph.h similarity index 99% rename from components/soc/include/soc/rtc_io_periph.h rename to components/soc/soc/include/soc/rtc_io_periph.h index de24b9b9d..28431d566 100644 --- a/components/soc/include/soc/rtc_io_periph.h +++ b/components/soc/soc/include/soc/rtc_io_periph.h @@ -22,7 +22,7 @@ #include "soc/rtc_io_struct.h" #include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_struct.h" -#include "hal/gpio_types.h" +#include "soc/gpio_caps.h" #ifdef __cplusplus extern "C" diff --git a/components/soc/include/soc/rtc_periph.h b/components/soc/soc/include/soc/rtc_periph.h similarity index 100% rename from components/soc/include/soc/rtc_periph.h rename to components/soc/soc/include/soc/rtc_periph.h diff --git a/components/soc/include/soc/sdio_slave_periph.h b/components/soc/soc/include/soc/sdio_slave_periph.h similarity index 100% rename from components/soc/include/soc/sdio_slave_periph.h rename to components/soc/soc/include/soc/sdio_slave_periph.h diff --git a/components/soc/include/soc/sdmmc_periph.h b/components/soc/soc/include/soc/sdmmc_periph.h similarity index 100% rename from components/soc/include/soc/sdmmc_periph.h rename to components/soc/soc/include/soc/sdmmc_periph.h diff --git a/components/soc/include/soc/sens_periph.h b/components/soc/soc/include/soc/sens_periph.h similarity index 100% rename from components/soc/include/soc/sens_periph.h rename to components/soc/soc/include/soc/sens_periph.h diff --git a/components/soc/include/soc/sigmadelta_periph.h b/components/soc/soc/include/soc/sigmadelta_periph.h similarity index 100% rename from components/soc/include/soc/sigmadelta_periph.h rename to components/soc/soc/include/soc/sigmadelta_periph.h diff --git a/components/soc/include/soc/spi_periph.h b/components/soc/soc/include/soc/spi_periph.h similarity index 100% rename from components/soc/include/soc/spi_periph.h rename to components/soc/soc/include/soc/spi_periph.h diff --git a/components/soc/include/soc/syscon_periph.h b/components/soc/soc/include/soc/syscon_periph.h similarity index 100% rename from components/soc/include/soc/syscon_periph.h rename to components/soc/soc/include/soc/syscon_periph.h diff --git a/components/soc/include/soc/timer_periph.h b/components/soc/soc/include/soc/timer_periph.h similarity index 100% rename from components/soc/include/soc/timer_periph.h rename to components/soc/soc/include/soc/timer_periph.h diff --git a/components/soc/include/soc/touch_sensor_periph.h b/components/soc/soc/include/soc/touch_sensor_periph.h similarity index 100% rename from components/soc/include/soc/touch_sensor_periph.h rename to components/soc/soc/include/soc/touch_sensor_periph.h diff --git a/components/soc/include/soc/uart_periph.h b/components/soc/soc/include/soc/uart_periph.h similarity index 100% rename from components/soc/include/soc/uart_periph.h rename to components/soc/soc/include/soc/uart_periph.h diff --git a/components/soc/include/soc/uhci_periph.h b/components/soc/soc/include/soc/uhci_periph.h similarity index 100% rename from components/soc/include/soc/uhci_periph.h rename to components/soc/soc/include/soc/uhci_periph.h diff --git a/components/soc/src/esp32/CMakeLists.txt b/components/soc/src/esp32/CMakeLists.txt new file mode 100644 index 000000000..be5ed8b4f --- /dev/null +++ b/components/soc/src/esp32/CMakeLists.txt @@ -0,0 +1,27 @@ +set(srcs "brownout_hal.c" + "cpu_util.c" + "rtc_clk.c" + "rtc_clk_init.c" + "rtc_init.c" + "rtc_pm.c" + "rtc_sleep.c" + "rtc_time.c" + "rtc_wdt.c" + "sdio_slave_hal.c" + "soc_memory_layout.c" + "touch_sensor_hal.c") + +if(NOT BOOTLOADER_BUILD AND CONFIG_ETH_USE_ESP32_EMAC) + list(APPEND srcs "emac_hal.c") +endif() + +add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") + +target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") +target_include_directories(${COMPONENT_LIB} PUBLIC . include) +target_include_directories(${COMPONENT_LIB} PRIVATE ../hal) + +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/rtc_clk.c" PROPERTIES + COMPILE_FLAGS "-fno-jump-tables -fno-tree-switch-conversion") +endif() diff --git a/components/soc/esp32/brownout_hal.c b/components/soc/src/esp32/brownout_hal.c similarity index 100% rename from components/soc/esp32/brownout_hal.c rename to components/soc/src/esp32/brownout_hal.c diff --git a/components/soc/src/esp32/component.mk b/components/soc/src/esp32/component.mk new file mode 100644 index 000000000..aea3541d8 --- /dev/null +++ b/components/soc/src/esp32/component.mk @@ -0,0 +1,8 @@ +COMPONENT_ADD_INCLUDEDIRS += src/$(SOC_NAME) src/$(SOC_NAME)/include +COMPONENT_SRCDIRS += src/$(SOC_NAME) + +ifndef CONFIG_ETH_USE_ESP32_EMAC + COMPONENT_OBJEXCLUDE += src/esp32/emac_hal.o +endif + +src/esp32/rtc_clk.o: CFLAGS += -fno-jump-tables -fno-tree-switch-conversion \ No newline at end of file diff --git a/components/soc/esp32/cpu_util.c b/components/soc/src/esp32/cpu_util.c similarity index 100% rename from components/soc/esp32/cpu_util.c rename to components/soc/src/esp32/cpu_util.c diff --git a/components/soc/esp32/emac_hal.c b/components/soc/src/esp32/emac_hal.c similarity index 100% rename from components/soc/esp32/emac_hal.c rename to components/soc/src/esp32/emac_hal.c diff --git a/components/soc/esp32/i2c_rtc_clk.h b/components/soc/src/esp32/i2c_rtc_clk.h similarity index 100% rename from components/soc/esp32/i2c_rtc_clk.h rename to components/soc/src/esp32/i2c_rtc_clk.h diff --git a/components/soc/esp32/include/hal/adc_ll.h b/components/soc/src/esp32/include/hal/adc_ll.h similarity index 100% rename from components/soc/esp32/include/hal/adc_ll.h rename to components/soc/src/esp32/include/hal/adc_ll.h diff --git a/components/soc/esp32/include/hal/can_ll.h b/components/soc/src/esp32/include/hal/can_ll.h similarity index 100% rename from components/soc/esp32/include/hal/can_ll.h rename to components/soc/src/esp32/include/hal/can_ll.h diff --git a/components/soc/esp32/include/hal/dac_ll.h b/components/soc/src/esp32/include/hal/dac_ll.h similarity index 100% rename from components/soc/esp32/include/hal/dac_ll.h rename to components/soc/src/esp32/include/hal/dac_ll.h diff --git a/components/soc/esp32/include/hal/emac.h b/components/soc/src/esp32/include/hal/emac.h similarity index 100% rename from components/soc/esp32/include/hal/emac.h rename to components/soc/src/esp32/include/hal/emac.h diff --git a/components/soc/esp32/include/hal/gpio_ll.h b/components/soc/src/esp32/include/hal/gpio_ll.h similarity index 100% rename from components/soc/esp32/include/hal/gpio_ll.h rename to components/soc/src/esp32/include/hal/gpio_ll.h diff --git a/components/soc/esp32/include/hal/i2c_ll.h b/components/soc/src/esp32/include/hal/i2c_ll.h similarity index 100% rename from components/soc/esp32/include/hal/i2c_ll.h rename to components/soc/src/esp32/include/hal/i2c_ll.h diff --git a/components/soc/esp32/include/hal/i2s_ll.h b/components/soc/src/esp32/include/hal/i2s_ll.h similarity index 100% rename from components/soc/esp32/include/hal/i2s_ll.h rename to components/soc/src/esp32/include/hal/i2s_ll.h diff --git a/components/soc/esp32/include/hal/ledc_ll.h b/components/soc/src/esp32/include/hal/ledc_ll.h similarity index 100% rename from components/soc/esp32/include/hal/ledc_ll.h rename to components/soc/src/esp32/include/hal/ledc_ll.h diff --git a/components/soc/esp32/include/hal/mcpwm_ll.h b/components/soc/src/esp32/include/hal/mcpwm_ll.h similarity index 100% rename from components/soc/esp32/include/hal/mcpwm_ll.h rename to components/soc/src/esp32/include/hal/mcpwm_ll.h diff --git a/components/soc/esp32/include/hal/pcnt_ll.h b/components/soc/src/esp32/include/hal/pcnt_ll.h similarity index 100% rename from components/soc/esp32/include/hal/pcnt_ll.h rename to components/soc/src/esp32/include/hal/pcnt_ll.h diff --git a/components/soc/esp32/include/hal/rmt_ll.h b/components/soc/src/esp32/include/hal/rmt_ll.h similarity index 100% rename from components/soc/esp32/include/hal/rmt_ll.h rename to components/soc/src/esp32/include/hal/rmt_ll.h diff --git a/components/soc/esp32/include/hal/rtc_io_ll.h b/components/soc/src/esp32/include/hal/rtc_io_ll.h similarity index 99% rename from components/soc/esp32/include/hal/rtc_io_ll.h rename to components/soc/src/esp32/include/hal/rtc_io_ll.h index 760c1d90c..ea53a93a2 100644 --- a/components/soc/esp32/include/hal/rtc_io_ll.h +++ b/components/soc/src/esp32/include/hal/rtc_io_ll.h @@ -23,6 +23,7 @@ #include #include "soc/rtc_io_periph.h" #include "hal/rtc_io_types.h" +#include "hal/gpio_types.h" typedef enum { RTCIO_FUNC_RTC = 0x0, /*!< The pin controled by RTC module. */ diff --git a/components/soc/esp32/include/hal/sigmadelta_ll.h b/components/soc/src/esp32/include/hal/sigmadelta_ll.h similarity index 100% rename from components/soc/esp32/include/hal/sigmadelta_ll.h rename to components/soc/src/esp32/include/hal/sigmadelta_ll.h diff --git a/components/soc/esp32/include/hal/spi_flash_ll.h b/components/soc/src/esp32/include/hal/spi_flash_ll.h similarity index 100% rename from components/soc/esp32/include/hal/spi_flash_ll.h rename to components/soc/src/esp32/include/hal/spi_flash_ll.h diff --git a/components/soc/esp32/include/hal/spi_ll.h b/components/soc/src/esp32/include/hal/spi_ll.h similarity index 100% rename from components/soc/esp32/include/hal/spi_ll.h rename to components/soc/src/esp32/include/hal/spi_ll.h diff --git a/components/soc/esp32/include/hal/timer_ll.h b/components/soc/src/esp32/include/hal/timer_ll.h similarity index 100% rename from components/soc/esp32/include/hal/timer_ll.h rename to components/soc/src/esp32/include/hal/timer_ll.h diff --git a/components/soc/esp32/include/hal/touch_sensor_hal_esp32.h b/components/soc/src/esp32/include/hal/touch_sensor_hal_esp32.h similarity index 100% rename from components/soc/esp32/include/hal/touch_sensor_hal_esp32.h rename to components/soc/src/esp32/include/hal/touch_sensor_hal_esp32.h diff --git a/components/soc/esp32/include/hal/touch_sensor_ll.h b/components/soc/src/esp32/include/hal/touch_sensor_ll.h similarity index 100% rename from components/soc/esp32/include/hal/touch_sensor_ll.h rename to components/soc/src/esp32/include/hal/touch_sensor_ll.h diff --git a/components/soc/esp32/include/hal/uart_ll.h b/components/soc/src/esp32/include/hal/uart_ll.h similarity index 100% rename from components/soc/esp32/include/hal/uart_ll.h rename to components/soc/src/esp32/include/hal/uart_ll.h diff --git a/components/soc/esp32/rtc_clk.c b/components/soc/src/esp32/rtc_clk.c similarity index 100% rename from components/soc/esp32/rtc_clk.c rename to components/soc/src/esp32/rtc_clk.c diff --git a/components/soc/esp32/rtc_clk_common.h b/components/soc/src/esp32/rtc_clk_common.h similarity index 100% rename from components/soc/esp32/rtc_clk_common.h rename to components/soc/src/esp32/rtc_clk_common.h diff --git a/components/soc/esp32/rtc_clk_init.c b/components/soc/src/esp32/rtc_clk_init.c similarity index 100% rename from components/soc/esp32/rtc_clk_init.c rename to components/soc/src/esp32/rtc_clk_init.c diff --git a/components/soc/esp32/rtc_init.c b/components/soc/src/esp32/rtc_init.c similarity index 100% rename from components/soc/esp32/rtc_init.c rename to components/soc/src/esp32/rtc_init.c diff --git a/components/soc/esp32/rtc_pm.c b/components/soc/src/esp32/rtc_pm.c similarity index 100% rename from components/soc/esp32/rtc_pm.c rename to components/soc/src/esp32/rtc_pm.c diff --git a/components/soc/esp32/rtc_sleep.c b/components/soc/src/esp32/rtc_sleep.c similarity index 100% rename from components/soc/esp32/rtc_sleep.c rename to components/soc/src/esp32/rtc_sleep.c diff --git a/components/soc/esp32/rtc_time.c b/components/soc/src/esp32/rtc_time.c similarity index 100% rename from components/soc/esp32/rtc_time.c rename to components/soc/src/esp32/rtc_time.c diff --git a/components/soc/esp32/rtc_wdt.c b/components/soc/src/esp32/rtc_wdt.c similarity index 100% rename from components/soc/esp32/rtc_wdt.c rename to components/soc/src/esp32/rtc_wdt.c diff --git a/components/soc/src/esp32/sdio_slave_hal.c b/components/soc/src/esp32/sdio_slave_hal.c new file mode 100644 index 000000000..f54a7f08f --- /dev/null +++ b/components/soc/src/esp32/sdio_slave_hal.c @@ -0,0 +1,729 @@ +// Copyright 2015-2019 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. + +// The HAL layer for SDIO slave (common part) + +#include +#include +#include +#include +#include +#include "hal/sdio_slave_hal.h" +#include "hal/hal_defs.h" +#include "esp_attr.h" + + +#define SDIO_SLAVE_CHECK(res, str, ret_val) do { if(!(res)){\ + HAL_LOGE(TAG, "%s", str);\ + return ret_val;\ +} }while (0) + +static const char TAG[] = "SDIO_HAL"; + +static esp_err_t init_send_queue(sdio_slave_context_t *hal); + +/**************** Ring buffer for SDIO sending use *****************/ +typedef enum { + RINGBUF_GET_ONE = 0, + RINGBUF_GET_ALL = 1, +} ringbuf_get_all_t; + +typedef enum { + RINGBUF_WRITE_PTR, + RINGBUF_READ_PTR, + RINGBUF_FREE_PTR, +} sdio_ringbuf_pointer_t; + +static esp_err_t sdio_ringbuf_send(sdio_ringbuf_t *buf, esp_err_t (*copy_callback)(uint8_t *, void *), void *arg); +static inline esp_err_t sdio_ringbuf_recv(sdio_ringbuf_t *buf, uint8_t **start, uint8_t **end, ringbuf_get_all_t get_all); +static inline int sdio_ringbuf_return(sdio_ringbuf_t* buf, uint8_t *ptr); + +#define _SEND_DESC_NEXT(x) STAILQ_NEXT(&((sdio_slave_hal_send_desc_t*)x)->dma_desc, qe) +#define SEND_DESC_NEXT(x) (sdio_slave_hal_send_desc_t*)_SEND_DESC_NEXT(x) +#define SEND_DESC_NEXT_SET(x, target) do { \ + _SEND_DESC_NEXT(x)=(lldesc_t*)target; \ + }while(0) + +static esp_err_t link_desc_to_last(uint8_t* desc, void* arg) +{ + SEND_DESC_NEXT_SET(arg, desc); + return ESP_OK; +} + +//calculate a pointer with offset to a original pointer of the specific ringbuffer +static inline uint8_t* sdio_ringbuf_offset_ptr(sdio_ringbuf_t *buf, sdio_ringbuf_pointer_t ptr, uint32_t offset) +{ + uint8_t *buf_ptr; + switch (ptr) { + case RINGBUF_WRITE_PTR: + buf_ptr = buf->write_ptr; + break; + case RINGBUF_READ_PTR: + buf_ptr = buf->read_ptr; + break; + case RINGBUF_FREE_PTR: + buf_ptr = buf->free_ptr; + break; + default: + abort(); + } + + uint8_t *offset_ptr=buf_ptr+offset; + if (offset_ptr >= buf->data + buf->size) { + offset_ptr -= buf->size; + } + return offset_ptr; +} + +static esp_err_t sdio_ringbuf_send(sdio_ringbuf_t *buf, esp_err_t (*copy_callback)(uint8_t *, void *), void *arg) +{ + uint8_t* get_ptr = sdio_ringbuf_offset_ptr(buf, RINGBUF_WRITE_PTR, SDIO_SLAVE_SEND_DESC_SIZE); + esp_err_t err = ESP_OK; + if (copy_callback) { + (*copy_callback)(get_ptr, arg); + } + if (err != ESP_OK) return err; + + buf->write_ptr = get_ptr; + return ESP_OK; +} + +// this ringbuf is a return-before-recv-again strategy +// since this is designed to be called in the ISR, no parallel logic +static inline esp_err_t sdio_ringbuf_recv(sdio_ringbuf_t *buf, uint8_t **start, uint8_t **end, ringbuf_get_all_t get_all) +{ + assert(buf->free_ptr == buf->read_ptr); //must return before recv again + if (start == NULL && end == NULL) return ESP_ERR_INVALID_ARG; // must have a output + if (buf->read_ptr == buf->write_ptr) return ESP_ERR_NOT_FOUND; // no data + + uint8_t *get_start = sdio_ringbuf_offset_ptr(buf, RINGBUF_READ_PTR, SDIO_SLAVE_SEND_DESC_SIZE); + + if (get_all != RINGBUF_GET_ONE) { + buf->read_ptr = buf->write_ptr; + } else { + buf->read_ptr = get_start; + } + + if (start != NULL) { + *start = get_start; + } + if (end != NULL) { + *end = buf->read_ptr; + } + return ESP_OK; +} + +static inline int sdio_ringbuf_return(sdio_ringbuf_t* buf, uint8_t *ptr) +{ + assert(sdio_ringbuf_offset_ptr(buf, RINGBUF_FREE_PTR, SDIO_SLAVE_SEND_DESC_SIZE) == ptr); + int size = (buf->read_ptr + buf->size - buf->free_ptr) % buf->size; + int count = size / SDIO_SLAVE_SEND_DESC_SIZE; + assert(count * SDIO_SLAVE_SEND_DESC_SIZE==size); + buf->free_ptr = buf->read_ptr; + return count; +} + +static inline uint8_t* sdio_ringbuf_peek_front(sdio_ringbuf_t* buf) +{ + if (buf->read_ptr != buf->write_ptr) { + return sdio_ringbuf_offset_ptr(buf, RINGBUF_READ_PTR, SDIO_SLAVE_SEND_DESC_SIZE); + } else { + return NULL; + } +} + +static inline uint8_t* sdio_ringbuf_peek_rear(sdio_ringbuf_t *buf) +{ + return buf->write_ptr; +} + +static inline bool sdio_ringbuf_empty(sdio_ringbuf_t* buf) +{ + return (buf->read_ptr == buf->write_ptr); +} + +/**************** End of Ring buffer *****************/ + +void sdio_slave_hal_init(sdio_slave_context_t *hal) +{ + hal->host = sdio_slave_ll_get_host(0); + hal->slc = sdio_slave_ll_get_slc(0); + hal->hinf = sdio_slave_ll_get_hinf(0); + hal->send_state = STATE_IDLE; + hal->recv_link_list = (sdio_slave_hal_recv_stailq_t)STAILQ_HEAD_INITIALIZER(hal->recv_link_list); + + init_send_queue(hal); +} + +void sdio_slave_hal_hw_init(sdio_slave_context_t *hal) +{ + sdio_slave_ll_init(hal->slc); + sdio_slave_ll_enable_hs(hal->hinf, true); + sdio_slave_ll_set_timing(hal->host, hal->timing); + sdio_slave_ll_slvint_t intr_ena = 0xff; + sdio_slave_ll_slvint_set_ena(hal->slc, &intr_ena); +} + +static esp_err_t init_send_queue(sdio_slave_context_t *hal) +{ + esp_err_t ret; + esp_err_t rcv_res; + sdio_ringbuf_t *buf = &(hal->send_desc_queue); + + //initialize pointers + buf->write_ptr = buf->data; + buf->read_ptr = buf->data; + buf->free_ptr = buf->data; + + sdio_slave_hal_send_desc_t *first = NULL, *last = NULL; + //no copy for the first descriptor + + ret = sdio_ringbuf_send(buf, NULL, NULL); + if (ret != ESP_OK) return ret; + + //loop in the ringbuf to link all the desc one after another as a ring + for (int i = 0; i < hal->send_queue_size + 1; i++) { + rcv_res = sdio_ringbuf_recv(buf, (uint8_t **) &last, NULL, RINGBUF_GET_ONE); + assert (rcv_res == ESP_OK); + + ret = sdio_ringbuf_send(buf, link_desc_to_last, last); + if (ret != ESP_OK) return ret; + + sdio_ringbuf_return(buf, (uint8_t *) last); + } + + first = NULL; + last = NULL; + //clear the queue + rcv_res = sdio_ringbuf_recv(buf, (uint8_t **) &first, (uint8_t **) &last, RINGBUF_GET_ALL); + assert (rcv_res == ESP_OK); + assert(first == last); //there should be only one desc remain + sdio_ringbuf_return(buf, (uint8_t *) first); + return ESP_OK; +} + +void sdio_slave_hal_set_ioready(sdio_slave_context_t *hal, bool ready) +{ + sdio_slave_ll_set_ioready(hal->hinf, ready); //set IO ready to 1 to allow host to use +} + + +/*--------------------------------------------------------------------------- + * Send + * + * The hardware has a cache, so that once a descriptor is loaded onto the linked-list, it cannot be modified + * until returned (used) by the hardware. This forbids us from loading descriptors onto the linked list during + * the transfer (or the time waiting for host to start a transfer). However, we use a "ringbuffer" (different from + * the one in ``freertos/`` folder) holding descriptors to solve this: + + * 1. The driver allocates continuous memory for several buffer descriptors (the maximum buffer number) during + * initialization. Then the driver points the STAILQ_NEXT pointer of all the descriptors except the last one + * to the next descriptor of each of them. Then the pointer of the last descriptor points back to the first one: + * now the descriptor is in a ring. + + * 2. The "ringbuffer" has a write pointer points to where app can write new descriptor. The app writes the new descriptor + * indicated by the write pointer without touching the STAILQ_NEXT pointer so that the descriptors are always in a + * ring-like linked-list. The app never touches the part of linked-list being used by the hardware. + + * 3. When the hardware needs some data to send, it automatically pick a part of linked descriptors. According to the mode: + * - Buffer mode: only pick the next one to the last one sent; + * - Stream mode: pick the whole unsent linked list, starting from the one above, to the latest linked one. + + * The driver removes the STAILQ_NEXT pointer of the last descriptor and put the head of the part to the DMA controller so + * that it looks like just a linear linked-list rather than a ring to the hardware. + + * 4. The counter of sending FIFO can increase when app load new buffers (in STREAM_MODE) or when new transfer should + * start (in PACKET_MODE). + + * 5. When the sending transfer is finished, the driver goes through the descriptors just send in the ISR and push all + * the ``arg`` member of descriptors to the queue back to the app, so that the app can handle finished buffers. The + * driver also fix the STAILQ_NEXT pointer of the last descriptor so that the descriptors are now in a ring again. +----------------------------------------------------------------------------*/ +static inline void send_set_state(sdio_slave_context_t *hal, send_state_t state) +{ + hal->send_state = state; +} + +static inline send_state_t send_get_state(sdio_slave_context_t* hal) +{ + return hal->send_state; +} + +DMA_ATTR static const lldesc_t start_desc = { + .owner = 1, + .buf = (void*)0x3ffbbbbb, //assign a dma-capable pointer other than NULL, which will not be used + .size = 1, + .length = 1, + .eof = 1, +}; + +//force trigger rx_done interrupt. the interrupt is abused to invoke ISR from the app by the enable bit and never cleared. +static void send_isr_invoker_enable(const sdio_slave_context_t *hal) +{ + sdio_slave_ll_send_reset(hal->slc); + sdio_slave_ll_send_start(hal->slc, &start_desc); + //wait for rx_done + while(!sdio_slave_ll_send_invoker_ready(hal->slc)); + sdio_slave_ll_send_stop(hal->slc); + sdio_slave_ll_send_hostint_clr(hal->host); +} + +static void send_isr_invoker_disable(sdio_slave_context_t *hal) +{ + sdio_slave_ll_send_part_done_clear(hal->slc); +} + +void sdio_slave_hal_send_handle_isr_invoke(sdio_slave_context_t *hal) +{ + sdio_slave_ll_send_part_done_intr_ena(hal->slc, false); +} + +//start hw operation with existing data (if exist) +esp_err_t sdio_slave_hal_send_start(sdio_slave_context_t *hal) +{ + SDIO_SLAVE_CHECK(send_get_state(hal) == STATE_IDLE, + "already started", ESP_ERR_INVALID_STATE); + send_set_state(hal, STATE_WAIT_FOR_START); + send_isr_invoker_enable(hal); + sdio_slave_ll_send_intr_clr(hal->slc); + sdio_slave_ll_send_intr_ena(hal->slc, true); + return ESP_OK; +} + +//only stop hw operations, no touch to data as well as counter +void sdio_slave_hal_send_stop(sdio_slave_context_t *hal) +{ + sdio_slave_ll_send_stop(hal->slc); + send_isr_invoker_disable(hal); + sdio_slave_ll_send_intr_ena(hal->slc, false); + send_set_state(hal, STATE_IDLE); +} + +static void send_new_packet(sdio_slave_context_t *hal) +{ + // since eof is changed, we have to stop and reset the link list, + // and restart new link list operation + sdio_slave_hal_send_desc_t *const start_desc = hal->in_flight_head; + sdio_slave_hal_send_desc_t *const end_desc = hal->in_flight_end; + assert(start_desc != NULL && end_desc != NULL); + + sdio_slave_ll_send_stop(hal->slc); + sdio_slave_ll_send_reset(hal->slc); + sdio_slave_ll_send_start(hal->slc, (lldesc_t*)start_desc); + + // update pkt_len register to allow host reading. + sdio_slave_ll_send_write_len(hal->slc, end_desc->pkt_len); + ESP_EARLY_LOGV(TAG, "send_length_write: %d, last_len: %08X", end_desc->pkt_len, sdio_slave_ll_send_read_len(hal->host)); + + send_set_state(hal, STATE_SENDING); + + ESP_EARLY_LOGD(TAG, "restart new send: %p->%p, pkt_len: %d", start_desc, end_desc, end_desc->pkt_len); +} + +static esp_err_t send_check_new_packet(sdio_slave_context_t *hal) +{ + esp_err_t ret; + sdio_slave_hal_send_desc_t *start = NULL; + sdio_slave_hal_send_desc_t *end = NULL; + if (hal->sending_mode == SDIO_SLAVE_SEND_PACKET) { + ret = sdio_ringbuf_recv(&(hal->send_desc_queue), (uint8_t **) &start, (uint8_t **) &end, RINGBUF_GET_ONE); + } else { //stream mode + ret = sdio_ringbuf_recv(&(hal->send_desc_queue), (uint8_t **) &start, (uint8_t **) &end, RINGBUF_GET_ALL); + } + if (ret == ESP_OK) { + hal->in_flight_head = start; + hal->in_flight_end = end; + end->dma_desc.eof = 1; + //temporarily break the link ring here, the ring will be re-connected in ``send_isr_eof()``. + hal->in_flight_next = SEND_DESC_NEXT(end); + SEND_DESC_NEXT_SET(end, NULL); + } + return ESP_OK; +} + +bool sdio_slave_hal_send_eof_happened(sdio_slave_context_t* hal) +{ + // Goto idle state (cur_start=NULL) if transmission done, + // also update sequence and recycle descs. + if (sdio_slave_ll_send_done(hal->slc)) { + //check current state + assert(send_get_state(hal) == STATE_SENDING); + sdio_slave_ll_send_intr_clr(hal->slc); + return true; + } else { + return false; + } +} + +//clear counter but keep data +esp_err_t sdio_slave_hal_send_reset_counter(sdio_slave_context_t* hal) +{ + SDIO_SLAVE_CHECK(send_get_state(hal) == STATE_IDLE, + "reset counter when transmission started", ESP_ERR_INVALID_STATE); + + uint32_t len; + sdio_slave_ll_send_write_len(hal->slc, 0); + ESP_EARLY_LOGV(TAG, "send_length_write: %d, last_len: %08X", len, sdio_slave_ll_send_read_len(hal->host)); + + hal->tail_pkt_len = 0; + sdio_slave_hal_send_desc_t *desc = hal->in_flight_head; + while(desc != NULL) { + hal->tail_pkt_len += desc->dma_desc.length; + desc->pkt_len = hal->tail_pkt_len; + desc = SEND_DESC_NEXT(desc); + } + // in theory the desc should be the one right next to the last of in_flight_head, + // but the link of last is NULL, so get the desc from the ringbuf directly. + desc = (sdio_slave_hal_send_desc_t*)sdio_ringbuf_peek_front(&(hal->send_desc_queue)); + while(desc != NULL) { + hal->tail_pkt_len += desc->dma_desc.length; + desc->pkt_len = hal->tail_pkt_len; + desc = SEND_DESC_NEXT(desc); + } + + return ESP_OK; +} + +static esp_err_t send_get_inflight_desc(sdio_slave_context_t *hal, void **out_arg, uint32_t *out_returned_cnt, + bool init) +{ + esp_err_t ret; + if (init) { + assert(hal->returned_desc == NULL); + hal->returned_desc = hal->in_flight_head; + send_set_state(hal, STATE_GETTING_RESULT); + } + + if (hal->returned_desc != NULL) { + *out_arg = hal->returned_desc->arg; + hal->returned_desc = SEND_DESC_NEXT(hal->returned_desc); + ret = ESP_OK; + } else { + if (hal->in_flight_head != NULL) { + // fix the link broken of last desc when being sent + assert(hal->in_flight_end != NULL); + SEND_DESC_NEXT_SET(hal->in_flight_end, hal->in_flight_next); + + *out_returned_cnt = sdio_ringbuf_return(&(hal->send_desc_queue), (uint8_t*)hal->in_flight_head); + } + + hal->in_flight_head = NULL; + hal->in_flight_end = NULL; + + ret = ESP_ERR_NOT_FOUND; + } + return ret; +} + +static esp_err_t send_get_unsent_desc(sdio_slave_context_t *hal, void **out_arg, uint32_t *out_return_cnt) +{ + esp_err_t ret; + sdio_slave_hal_send_desc_t *head, *tail; + ret = sdio_ringbuf_recv(&(hal->send_desc_queue), (uint8_t **) &head, (uint8_t **) &tail, RINGBUF_GET_ONE); + + if (ret == ESP_OK) { + //currently each packet takes only one desc. + assert(head == tail); + (*out_arg) = head->arg; + (*out_return_cnt) = sdio_ringbuf_return(&(hal->send_desc_queue), (uint8_t*) head); + } else if (ret == ESP_ERR_NOT_FOUND) { + // if in wait to send state, set the sequence number of tail to the value last sent, just as if the packet wait to + // send never queued. + // Go to idle state (cur_end!=NULL and cur_start=NULL) + send_set_state(hal, STATE_IDLE); + hal->tail_pkt_len = sdio_slave_ll_send_read_len(hal->host); + } + return ret; +} + +esp_err_t sdio_slave_hal_send_get_next_finished_arg(sdio_slave_context_t *hal, void **out_arg, uint32_t* out_returned_cnt) +{ + bool init = (send_get_state(hal) == STATE_SENDING); + if (init) { + assert(hal->in_flight_head != NULL); + } else { + assert(send_get_state(hal) == STATE_GETTING_RESULT); + } + *out_returned_cnt = 0; + + esp_err_t ret = send_get_inflight_desc(hal, out_arg, out_returned_cnt, init); + + if (ret == ESP_ERR_NOT_FOUND) { + // Go to wait for packet state + send_set_state(hal, STATE_WAIT_FOR_START); + } + return ret; +} + + +esp_err_t sdio_slave_hal_send_flush_next_buffer(sdio_slave_context_t *hal, void **out_arg, uint32_t *out_return_cnt) +{ + esp_err_t ret = ESP_OK; + *out_return_cnt = 0; + bool init = (send_get_state(hal) == STATE_IDLE); + if (!init) { + if (send_get_state(hal) != STATE_GETTING_RESULT && send_get_state(hal) != STATE_GETTING_UNSENT_DESC) { + return ESP_ERR_INVALID_STATE; + } + } + + if (init || send_get_state(hal) == STATE_GETTING_RESULT) { + ret = send_get_inflight_desc(hal, out_arg, out_return_cnt, init); + if (ret == ESP_ERR_NOT_FOUND) { + send_set_state(hal, STATE_GETTING_UNSENT_DESC); + } + } + if (send_get_state(hal) == STATE_GETTING_UNSENT_DESC) { + ret = send_get_unsent_desc(hal, out_arg, out_return_cnt); + if (ret == ESP_ERR_NOT_FOUND) { + send_set_state(hal, STATE_IDLE); + } + } + return ret; +} + +esp_err_t sdio_slave_hal_send_new_packet_if_exist(sdio_slave_context_t *hal) +{ + esp_err_t ret; + // Go to wait sending state (cur_start!=NULL && cur_end==NULL) if not sending and new packet ready. + // Note we may also enter this state by stopping sending in the app. + if (send_get_state(hal) == STATE_WAIT_FOR_START) { + if (hal->in_flight_head == NULL) { + send_check_new_packet(hal); + } + // Go to sending state (cur_start and cur_end != NULL) if has packet to send. + if (hal->in_flight_head) { + send_new_packet(hal); + ret = ESP_OK; + } else { + ret = ESP_ERR_NOT_FOUND; + } + } else { + ret = ESP_ERR_INVALID_STATE; + } + return ret; +} + +static esp_err_t send_write_desc(uint8_t* desc, void* arg) +{ + sdio_slave_hal_send_desc_t* next_desc = SEND_DESC_NEXT(desc); + memcpy(desc, arg, sizeof(sdio_slave_hal_send_desc_t)); + SEND_DESC_NEXT_SET(desc, next_desc); + return ESP_OK; +} + +static void send_isr_invoke(sdio_slave_context_t *hal) +{ + sdio_slave_ll_send_part_done_intr_ena(hal->slc, true); +} + +esp_err_t sdio_slave_hal_send_queue(sdio_slave_context_t* hal, uint8_t *addr, size_t len, void *arg) +{ + hal->tail_pkt_len += len; + sdio_slave_hal_send_desc_t new_desc = { + .dma_desc = { + .size = len, + .length = len, + .buf = addr, + .owner = 1, + // in stream mode, the eof is only appended (in ISR) when new packet is ready to be sent + .eof = (hal->sending_mode == SDIO_SLAVE_SEND_PACKET), + }, + .arg = arg, + .pkt_len = hal->tail_pkt_len, + }; + + esp_err_t ret = sdio_ringbuf_send(&(hal->send_desc_queue), send_write_desc, &new_desc); + send_isr_invoke(hal); + return ret; +} + +/*--------------------------------------------------------------------------- + * Receive + *--------------------------------------------------------------------------*/ + +static lldesc_t* recv_get_first_empty_buf(sdio_slave_context_t* hal) +{ + sdio_slave_hal_recv_stailq_t *const queue = &(hal->recv_link_list); + lldesc_t *desc = STAILQ_FIRST(queue); + while(desc && desc->owner == 0) { + desc = STAILQ_NEXT(desc, qe); + } + return desc; +} + +void sdio_slave_hal_recv_stop(sdio_slave_context_t* hal) +{ + sdio_slave_ll_set_ioready(hal->hinf, false); //set IO ready to 0 to stop host from using + sdio_slave_ll_send_stop(hal->slc); + sdio_slave_ll_recv_stop(hal->slc); + sdio_slave_ll_recv_intr_ena(hal->slc, false); +} + +//touching linked list, should be protected by spinlock +bool sdio_slave_hal_recv_has_next_item(sdio_slave_context_t* hal) +{ + + if (hal->recv_cur_ret == NULL || hal->recv_cur_ret->owner != 0) return false; + + // This may cause the ``cur_ret`` pointer to be NULL, indicating the list is empty, + // in this case the ``tx_done`` should happen no longer until new desc is appended. + // The app is responsible to place the pointer to the right place again when appending new desc. + + hal->recv_cur_ret = STAILQ_NEXT(hal->recv_cur_ret, qe); + return true; +} + +bool sdio_slave_hal_recv_done(sdio_slave_context_t *hal) +{ + bool ret = sdio_slave_ll_recv_done(hal->slc); + if (ret) { + sdio_slave_ll_recv_done_clear(hal->slc); + } + return ret; +} + +lldesc_t *sdio_slave_hal_recv_unload_desc(sdio_slave_context_t *hal) +{ + sdio_slave_hal_recv_stailq_t *const queue = &hal->recv_link_list; + lldesc_t *desc = STAILQ_FIRST(queue); + if (desc) { + STAILQ_REMOVE_HEAD(queue, qe); + } + return desc; +} + +void sdio_slave_hal_recv_init_desc(sdio_slave_context_t* hal, lldesc_t *desc, uint8_t *start) +{ + *desc = (lldesc_t) { + .size = hal->recv_buffer_size, + .buf = start, + }; +} + +void sdio_slave_hal_recv_start(sdio_slave_context_t *hal) +{ + sdio_slave_ll_recv_reset(hal->slc); + lldesc_t *desc = recv_get_first_empty_buf(hal); + if (!desc) { + HAL_LOGD(TAG, "recv: restart without desc"); + } else { + //the counter is handled when add/flush/reset + sdio_slave_ll_recv_start(hal->slc, desc); + sdio_slave_ll_recv_intr_ena(hal->slc, true); + } +} + +void sdio_slave_hal_recv_reset_counter(sdio_slave_context_t *hal) +{ + sdio_slave_ll_recv_size_reset(hal->slc); + lldesc_t *desc = recv_get_first_empty_buf(hal); + while (desc != NULL) { + sdio_slave_ll_recv_size_inc(hal->slc); + desc = STAILQ_NEXT(desc, qe); + } +} + +void sdio_slave_hal_recv_flush_one_buffer(sdio_slave_context_t *hal) +{ + sdio_slave_hal_recv_stailq_t *const queue = &hal->recv_link_list; + lldesc_t *desc = STAILQ_FIRST(queue); + assert (desc != NULL && desc->owner == 0); + STAILQ_REMOVE_HEAD(queue, qe); + desc->owner = 1; + STAILQ_INSERT_TAIL(queue, desc, qe); + sdio_slave_ll_recv_size_inc(hal->slc); + //we only add it to the tail here, without start the DMA nor increase buffer num. +} + +void sdio_slave_hal_load_buf(sdio_slave_context_t *hal, lldesc_t *desc) +{ + sdio_slave_hal_recv_stailq_t *const queue = &(hal->recv_link_list); + desc->owner = 1; + + lldesc_t *const tail = STAILQ_LAST(queue, lldesc_s, qe); + + STAILQ_INSERT_TAIL(queue, desc, qe); + if (hal->recv_cur_ret == NULL) { + hal->recv_cur_ret = desc; + } + + if (tail == NULL) { + //no one in the ll, start new ll operation. + sdio_slave_ll_recv_start(hal->slc, desc); + sdio_slave_ll_recv_intr_ena(hal->slc, true); + HAL_LOGV(TAG, "recv_load_buf: start new"); + } else { + //restart former ll operation + sdio_slave_ll_recv_restart(hal->slc); + HAL_LOGV(TAG, "recv_load_buf: restart"); + } + sdio_slave_ll_recv_size_inc(hal->slc); +} + +static inline void show_queue_item(lldesc_t *item) +{ + ESP_EARLY_LOGI(TAG, "=> %p: size: %d(%d), eof: %d, owner: %d", item, item->size, item->length, item->eof, item->owner); + ESP_EARLY_LOGI(TAG, " buf: %p, stqe_next: %p", item->buf, item->qe.stqe_next); +} + +static void __attribute((unused)) dump_queue(sdio_slave_hal_recv_stailq_t *queue) +{ + int cnt = 0; + lldesc_t *item = NULL; + ESP_EARLY_LOGI(TAG, ">>>>> first: %p, last: %p <<<<<", queue->stqh_first, queue->stqh_last); + STAILQ_FOREACH(item, queue, qe) { + cnt++; + show_queue_item(item); + } + ESP_EARLY_LOGI(TAG, "total: %d", cnt); +} + +/*--------------------------------------------------------------------------- + * Host + *--------------------------------------------------------------------------*/ +void sdio_slave_hal_hostint_get_ena(sdio_slave_context_t *hal, sdio_slave_hostint_t *out_int_mask) +{ + *out_int_mask = sdio_slave_ll_host_get_intena(hal->host); +} + +void sdio_slave_hal_hostint_clear(sdio_slave_context_t *hal, const sdio_slave_hostint_t *mask) +{ + sdio_slave_ll_host_intr_clear(hal->host, mask);//clear all interrupts +} + +void sdio_slave_hal_hostint_set_ena(sdio_slave_context_t *hal, const sdio_slave_hostint_t *mask) +{ + sdio_slave_ll_host_set_intena(hal->host, mask); +} + +void sdio_slave_hal_hostint_send(sdio_slave_context_t *hal, const sdio_slave_hostint_t *mask) +{ + sdio_slave_ll_host_send_int(hal->slc, mask); +} + +uint8_t sdio_slave_hal_host_get_reg(sdio_slave_context_t *hal, int pos) +{ + return sdio_slave_ll_host_get_reg(hal->host, pos); +} +void sdio_slave_hal_host_set_reg(sdio_slave_context_t *hal, int pos, uint8_t reg) +{ + sdio_slave_ll_host_set_reg(hal->host, pos, reg); +} + +void sdio_slave_hal_slvint_fetch_clear(sdio_slave_context_t *hal, sdio_slave_ll_slvint_t *out_int_mask) +{ + sdio_slave_ll_slvint_fetch_clear(hal->slc, out_int_mask); +} + diff --git a/components/soc/esp32/soc_log.h b/components/soc/src/esp32/soc_log.h similarity index 100% rename from components/soc/esp32/soc_log.h rename to components/soc/src/esp32/soc_log.h diff --git a/components/soc/esp32/soc_memory_layout.c b/components/soc/src/esp32/soc_memory_layout.c similarity index 100% rename from components/soc/esp32/soc_memory_layout.c rename to components/soc/src/esp32/soc_memory_layout.c diff --git a/components/soc/esp32/test/test_rtc_clk.c b/components/soc/src/esp32/test/test_rtc_clk.c similarity index 100% rename from components/soc/esp32/test/test_rtc_clk.c rename to components/soc/src/esp32/test/test_rtc_clk.c diff --git a/components/soc/esp32/touch_sensor_hal.c b/components/soc/src/esp32/touch_sensor_hal.c similarity index 100% rename from components/soc/esp32/touch_sensor_hal.c rename to components/soc/src/esp32/touch_sensor_hal.c diff --git a/components/soc/src/esp32s2/CMakeLists.txt b/components/soc/src/esp32s2/CMakeLists.txt new file mode 100644 index 000000000..86cf1c3d3 --- /dev/null +++ b/components/soc/src/esp32s2/CMakeLists.txt @@ -0,0 +1,22 @@ +set(srcs "brownout_hal.c" + "cpu_util.c" + "rtc_clk.c" + "rtc_init.c" + "rtc_pm.c" + "rtc_sleep.c" + "rtc_time.c" + "rtc_wdt.c" + "soc_memory_layout.c" + "touch_sensor_hal.c" + "usb_hal.c") + +add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") + +target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") +target_include_directories(${COMPONENT_LIB} PUBLIC . include) +target_include_directories(${COMPONENT_LIB} PRIVATE ../hal) + +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/rtc_clk.c" PROPERTIES + COMPILE_FLAGS "-fno-jump-tables -fno-tree-switch-conversion") +endif() diff --git a/components/soc/esp32s2/brownout_hal.c b/components/soc/src/esp32s2/brownout_hal.c similarity index 100% rename from components/soc/esp32s2/brownout_hal.c rename to components/soc/src/esp32s2/brownout_hal.c diff --git a/components/soc/esp32s2/cpu_util.c b/components/soc/src/esp32s2/cpu_util.c similarity index 100% rename from components/soc/esp32s2/cpu_util.c rename to components/soc/src/esp32s2/cpu_util.c diff --git a/components/soc/esp32s2/i2c_brownout.h b/components/soc/src/esp32s2/i2c_brownout.h similarity index 100% rename from components/soc/esp32s2/i2c_brownout.h rename to components/soc/src/esp32s2/i2c_brownout.h diff --git a/components/soc/esp32s2/i2c_rtc_clk.h b/components/soc/src/esp32s2/i2c_rtc_clk.h similarity index 100% rename from components/soc/esp32s2/i2c_rtc_clk.h rename to components/soc/src/esp32s2/i2c_rtc_clk.h diff --git a/components/soc/esp32s2/include/hal/adc_ll.h b/components/soc/src/esp32s2/include/hal/adc_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/adc_ll.h rename to components/soc/src/esp32s2/include/hal/adc_ll.h diff --git a/components/soc/esp32s2/include/hal/dac_ll.h b/components/soc/src/esp32s2/include/hal/dac_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/dac_ll.h rename to components/soc/src/esp32s2/include/hal/dac_ll.h diff --git a/components/soc/esp32s2/include/hal/gpio_ll.h b/components/soc/src/esp32s2/include/hal/gpio_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/gpio_ll.h rename to components/soc/src/esp32s2/include/hal/gpio_ll.h diff --git a/components/soc/esp32s2/include/hal/gpspi_flash_ll.h b/components/soc/src/esp32s2/include/hal/gpspi_flash_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/gpspi_flash_ll.h rename to components/soc/src/esp32s2/include/hal/gpspi_flash_ll.h diff --git a/components/soc/esp32s2/include/hal/i2c_ll.h b/components/soc/src/esp32s2/include/hal/i2c_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/i2c_ll.h rename to components/soc/src/esp32s2/include/hal/i2c_ll.h diff --git a/components/soc/esp32s2/include/hal/i2s_ll.h b/components/soc/src/esp32s2/include/hal/i2s_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/i2s_ll.h rename to components/soc/src/esp32s2/include/hal/i2s_ll.h diff --git a/components/soc/esp32s2/include/hal/ledc_ll.h b/components/soc/src/esp32s2/include/hal/ledc_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/ledc_ll.h rename to components/soc/src/esp32s2/include/hal/ledc_ll.h diff --git a/components/soc/esp32s2/include/hal/pcnt_ll.h b/components/soc/src/esp32s2/include/hal/pcnt_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/pcnt_ll.h rename to components/soc/src/esp32s2/include/hal/pcnt_ll.h diff --git a/components/soc/esp32s2/include/hal/rmt_ll.h b/components/soc/src/esp32s2/include/hal/rmt_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/rmt_ll.h rename to components/soc/src/esp32s2/include/hal/rmt_ll.h diff --git a/components/soc/esp32s2/include/hal/rtc_io_ll.h b/components/soc/src/esp32s2/include/hal/rtc_io_ll.h similarity index 99% rename from components/soc/esp32s2/include/hal/rtc_io_ll.h rename to components/soc/src/esp32s2/include/hal/rtc_io_ll.h index 14767873e..56403ca3d 100644 --- a/components/soc/esp32s2/include/hal/rtc_io_ll.h +++ b/components/soc/src/esp32s2/include/hal/rtc_io_ll.h @@ -23,6 +23,7 @@ #include #include "soc/rtc_io_periph.h" #include "hal/rtc_io_types.h" +#include "hal/gpio_types.h" typedef enum { RTCIO_FUNC_RTC = 0x0, /*!< The pin controled by RTC module. */ diff --git a/components/soc/esp32s2/include/hal/sigmadelta_ll.h b/components/soc/src/esp32s2/include/hal/sigmadelta_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/sigmadelta_ll.h rename to components/soc/src/esp32s2/include/hal/sigmadelta_ll.h diff --git a/components/soc/esp32s2/include/hal/spi_flash_ll.h b/components/soc/src/esp32s2/include/hal/spi_flash_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/spi_flash_ll.h rename to components/soc/src/esp32s2/include/hal/spi_flash_ll.h diff --git a/components/soc/esp32s2/include/hal/spi_ll.h b/components/soc/src/esp32s2/include/hal/spi_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/spi_ll.h rename to components/soc/src/esp32s2/include/hal/spi_ll.h diff --git a/components/soc/esp32s2/include/hal/spimem_flash_ll.h b/components/soc/src/esp32s2/include/hal/spimem_flash_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/spimem_flash_ll.h rename to components/soc/src/esp32s2/include/hal/spimem_flash_ll.h diff --git a/components/soc/esp32s2/include/hal/timer_ll.h b/components/soc/src/esp32s2/include/hal/timer_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/timer_ll.h rename to components/soc/src/esp32s2/include/hal/timer_ll.h diff --git a/components/soc/esp32s2/include/hal/touch_sensor_hal_esp32s2.h b/components/soc/src/esp32s2/include/hal/touch_sensor_hal_esp32s2.h similarity index 100% rename from components/soc/esp32s2/include/hal/touch_sensor_hal_esp32s2.h rename to components/soc/src/esp32s2/include/hal/touch_sensor_hal_esp32s2.h diff --git a/components/soc/esp32s2/include/hal/touch_sensor_ll.h b/components/soc/src/esp32s2/include/hal/touch_sensor_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/touch_sensor_ll.h rename to components/soc/src/esp32s2/include/hal/touch_sensor_ll.h diff --git a/components/soc/esp32s2/include/hal/uart_ll.h b/components/soc/src/esp32s2/include/hal/uart_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/uart_ll.h rename to components/soc/src/esp32s2/include/hal/uart_ll.h diff --git a/components/soc/esp32s2/include/hal/usb_ll.h b/components/soc/src/esp32s2/include/hal/usb_ll.h similarity index 100% rename from components/soc/esp32s2/include/hal/usb_ll.h rename to components/soc/src/esp32s2/include/hal/usb_ll.h diff --git a/components/soc/esp32s2/rtc_clk.c b/components/soc/src/esp32s2/rtc_clk.c similarity index 100% rename from components/soc/esp32s2/rtc_clk.c rename to components/soc/src/esp32s2/rtc_clk.c diff --git a/components/soc/esp32s2/rtc_init.c b/components/soc/src/esp32s2/rtc_init.c similarity index 100% rename from components/soc/esp32s2/rtc_init.c rename to components/soc/src/esp32s2/rtc_init.c diff --git a/components/soc/esp32s2/rtc_pm.c b/components/soc/src/esp32s2/rtc_pm.c similarity index 100% rename from components/soc/esp32s2/rtc_pm.c rename to components/soc/src/esp32s2/rtc_pm.c diff --git a/components/soc/esp32s2/rtc_sleep.c b/components/soc/src/esp32s2/rtc_sleep.c similarity index 100% rename from components/soc/esp32s2/rtc_sleep.c rename to components/soc/src/esp32s2/rtc_sleep.c diff --git a/components/soc/esp32s2/rtc_time.c b/components/soc/src/esp32s2/rtc_time.c similarity index 100% rename from components/soc/esp32s2/rtc_time.c rename to components/soc/src/esp32s2/rtc_time.c diff --git a/components/soc/esp32s2/rtc_wdt.c b/components/soc/src/esp32s2/rtc_wdt.c similarity index 100% rename from components/soc/esp32s2/rtc_wdt.c rename to components/soc/src/esp32s2/rtc_wdt.c diff --git a/components/soc/esp32s2/soc_memory_layout.c b/components/soc/src/esp32s2/soc_memory_layout.c similarity index 100% rename from components/soc/esp32s2/soc_memory_layout.c rename to components/soc/src/esp32s2/soc_memory_layout.c diff --git a/components/soc/esp32s2/touch_sensor_hal.c b/components/soc/src/esp32s2/touch_sensor_hal.c similarity index 100% rename from components/soc/esp32s2/touch_sensor_hal.c rename to components/soc/src/esp32s2/touch_sensor_hal.c diff --git a/components/soc/esp32s2/hal/usb_hal.c b/components/soc/src/esp32s2/usb_hal.c similarity index 100% rename from components/soc/esp32s2/hal/usb_hal.c rename to components/soc/src/esp32s2/usb_hal.c diff --git a/components/soc/test/CMakeLists.txt b/components/soc/test/CMakeLists.txt index c64b31f1b..17353d373 100644 --- a/components/soc/test/CMakeLists.txt +++ b/components/soc/test/CMakeLists.txt @@ -1,11 +1,5 @@ idf_build_get_property(soc_name IDF_TARGET) -get_filename_component(soc_test "${CMAKE_CURRENT_SOURCE_DIR}/../${soc_name}/test" ABSOLUTE) -if(EXISTS "${soc_test}") - set(src_dirs "${soc_test}") - set(include_dirs "${soc_test}") -endif() - -idf_component_register(SRC_DIRS "${src_dirs}" +idf_component_register(SRC_DIRS "." INCLUDE_DIRS "${include_dirs}" REQUIRES unity test_utils) diff --git a/components/soc/test/component.mk b/components/soc/test/component.mk index 3e6df4ba7..03698b514 100644 --- a/components/soc/test/component.mk +++ b/components/soc/test/component.mk @@ -1,6 +1,6 @@ SOC_NAME := $(IDF_TARGET) -COMPONENT_SRCDIRS := ../$(SOC_NAME)/test +COMPONENT_SRCDIRS := $(SOC_NAME) COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive diff --git a/components/soc/test/test_rtc_clk.c b/components/soc/test/test_rtc_clk.c new file mode 100644 index 000000000..36480d038 --- /dev/null +++ b/components/soc/test/test_rtc_clk.c @@ -0,0 +1,285 @@ +#include +#include "unity.h" + +#include "soc/rtc.h" +#include "soc/rtc_periph.h" +#include "soc/sens_periph.h" +#include "soc/gpio_periph.h" +#include "driver/rtc_io.h" +#include "test_utils.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" +#include "../esp_clk_internal.h" + +#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2) + +#include "esp32/clk.h" +#include "esp32/rom/ets_sys.h" +#include "esp32/rom/uart.h" + + +#define CALIBRATE_ONE(cali_clk) calibrate_one(cali_clk, #cali_clk) + +static uint32_t calibrate_one(rtc_cal_sel_t cal_clk, const char* name) +{ + const uint32_t cal_count = 1000; + const float factor = (1 << 19) * 1000.0f; + uint32_t cali_val; + printf("%s:\n", name); + for (int i = 0; i < 5; ++i) { + printf("calibrate (%d): ", i); + cali_val = rtc_clk_cal(cal_clk, cal_count); + printf("%.3f kHz\n", factor / (float) cali_val); + } + return cali_val; +} + +TEST_CASE("RTC_SLOW_CLK sources calibration", "[rtc_clk]") +{ + rtc_clk_32k_enable(true); + rtc_clk_8m_enable(true, true); + + CALIBRATE_ONE(RTC_CAL_RTC_MUX); + CALIBRATE_ONE(RTC_CAL_8MD256); + uint32_t cal_32k = CALIBRATE_ONE(RTC_CAL_32K_XTAL); + + if (cal_32k == 0) { + printf("32K XTAL OSC has not started up"); + } else { + printf("switching to RTC_SLOW_FREQ_32K_XTAL: "); + rtc_clk_slow_freq_set(RTC_SLOW_FREQ_32K_XTAL); + printf("done\n"); + + CALIBRATE_ONE(RTC_CAL_RTC_MUX); + CALIBRATE_ONE(RTC_CAL_8MD256); + CALIBRATE_ONE(RTC_CAL_32K_XTAL); + } + + printf("switching to RTC_SLOW_FREQ_8MD256: "); + rtc_clk_slow_freq_set(RTC_SLOW_FREQ_8MD256); + printf("done\n"); + + CALIBRATE_ONE(RTC_CAL_RTC_MUX); + CALIBRATE_ONE(RTC_CAL_8MD256); + CALIBRATE_ONE(RTC_CAL_32K_XTAL); +} + +/* The following two are not unit tests, but are added here to make it easy to + * check the frequency of 150k/32k oscillators. The following two "tests" will + * output either 32k or 150k clock to GPIO25. + */ + +static void pull_out_clk(int sel) +{ + REG_SET_BIT(RTC_IO_PAD_DAC1_REG, RTC_IO_PDAC1_MUX_SEL_M); + REG_CLR_BIT(RTC_IO_PAD_DAC1_REG, RTC_IO_PDAC1_RDE_M | RTC_IO_PDAC1_RUE_M); + REG_SET_FIELD(RTC_IO_PAD_DAC1_REG, RTC_IO_PDAC1_FUN_SEL, 1); + REG_SET_FIELD(SENS_SAR_DAC_CTRL1_REG, SENS_DEBUG_BIT_SEL, 0); + REG_SET_FIELD(RTC_IO_RTC_DEBUG_SEL_REG, RTC_IO_DEBUG_SEL0, sel); +} + +TEST_CASE("Output 150k clock to GPIO25", "[rtc_clk][ignore]") +{ + pull_out_clk(RTC_IO_DEBUG_SEL0_150K_OSC); +} + +TEST_CASE("Output 32k XTAL clock to GPIO25", "[rtc_clk][ignore]") +{ + rtc_clk_32k_enable(true); + pull_out_clk(RTC_IO_DEBUG_SEL0_32K_XTAL); +} + +TEST_CASE("Output 8M XTAL clock to GPIO25", "[rtc_clk][ignore]") +{ + rtc_clk_8m_enable(true, true); + SET_PERI_REG_MASK(RTC_IO_RTC_DEBUG_SEL_REG, RTC_IO_DEBUG_12M_NO_GATING); + pull_out_clk(RTC_IO_DEBUG_SEL0_8M); +} + +static void test_clock_switching(void (*switch_func)(const rtc_cpu_freq_config_t* config)) +{ + uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM); + + const int test_duration_sec = 10; + ref_clock_init(); + uint64_t t_start = ref_clock_get(); + + rtc_cpu_freq_config_t cur_config; + rtc_clk_cpu_freq_get_config(&cur_config); + + rtc_cpu_freq_config_t xtal_config; + rtc_clk_cpu_freq_mhz_to_config((uint32_t) rtc_clk_xtal_freq_get(), &xtal_config); + + int count = 0; + while (ref_clock_get() - t_start < test_duration_sec * 1000000) { + switch_func(&xtal_config); + switch_func(&cur_config); + ++count; + } + uint64_t t_end = ref_clock_get(); + printf("Switch count: %d. Average time to switch PLL -> XTAL -> PLL: %d us\n", count, (int) ((t_end - t_start) / count)); + ref_clock_deinit(); +} + +TEST_CASE("Calculate 8M clock frequency", "[rtc_clk]") +{ + // calibrate 8M/256 clock against XTAL, get 8M/256 clock period + uint32_t rtc_8md256_period = rtc_clk_cal(RTC_CAL_8MD256, 100); + uint32_t rtc_fast_freq_hz = 1000000ULL * (1 << RTC_CLK_CAL_FRACT) * 256 / rtc_8md256_period; + printf("RTC_FAST_CLK=%d Hz\n", rtc_fast_freq_hz); + TEST_ASSERT_INT32_WITHIN(500000, RTC_FAST_CLK_FREQ_APPROX, rtc_fast_freq_hz); +} + +TEST_CASE("Test switching between PLL and XTAL", "[rtc_clk]") +{ + test_clock_switching(rtc_clk_cpu_freq_set_config); +} + +TEST_CASE("Test fast switching between PLL and XTAL", "[rtc_clk]") +{ + test_clock_switching(rtc_clk_cpu_freq_set_config_fast); +} + +#define COUNT_TEST 3 +#define TIMEOUT_TEST_MS (5 + CONFIG_ESP32_RTC_CLK_CAL_CYCLES / 16) + +void stop_rtc_external_quartz(void){ + const uint8_t pin_32 = 32; + const uint8_t pin_33 = 33; + const uint8_t mask_32 = (1 << (pin_32 - 32)); + const uint8_t mask_33 = (1 << (pin_33 - 32)); + + rtc_clk_32k_enable(false); + + gpio_pad_select_gpio(pin_32); + gpio_pad_select_gpio(pin_33); + gpio_output_set_high(0, mask_32 | mask_33, mask_32 | mask_33, 0); + ets_delay_us(500000); + gpio_output_set_high(0, 0, 0, mask_32 | mask_33); // disable pins +} + +static void start_freq(rtc_slow_freq_t required_src_freq, uint32_t start_delay_ms) +{ + int i = 0, fail = 0; + uint32_t start_time; + uint32_t end_time; + rtc_slow_freq_t selected_src_freq; + stop_rtc_external_quartz(); +#ifdef CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS + uint32_t bootstrap_cycles = CONFIG_ESP32_RTC_XTAL_BOOTSTRAP_CYCLES; + printf("Test is started. Kconfig settings:\n External 32K crystal is selected,\n Oscillation cycles = %d,\n Calibration cycles = %d.\n", + bootstrap_cycles, + CONFIG_ESP32_RTC_CLK_CAL_CYCLES); +#else + uint32_t bootstrap_cycles = 5; + printf("Test is started. Kconfig settings:\n Internal RC is selected,\n Oscillation cycles = %d,\n Calibration cycles = %d.\n", + bootstrap_cycles, + CONFIG_ESP32_RTC_CLK_CAL_CYCLES); +#endif + if (start_delay_ms == 0 && CONFIG_ESP32_RTC_CLK_CAL_CYCLES < 1500){ + start_delay_ms = 50; + printf("Recommended increase Number of cycles for RTC_SLOW_CLK calibration to 3000!\n"); + } + while(i < COUNT_TEST){ + start_time = xTaskGetTickCount() * (1000 / configTICK_RATE_HZ); + i++; + printf("attempt #%d/%d...", i, COUNT_TEST); + rtc_clk_32k_bootstrap(bootstrap_cycles); + ets_delay_us(start_delay_ms * 1000); + rtc_clk_select_rtc_slow_clk(); + selected_src_freq = rtc_clk_slow_freq_get(); + end_time = xTaskGetTickCount() * (1000 / configTICK_RATE_HZ); + printf(" [time=%d] ", (end_time - start_time) - start_delay_ms); + if(selected_src_freq != required_src_freq){ + printf("FAIL. Time measurement..."); + fail = 1; + } else { + printf("PASS. Time measurement..."); + } + uint64_t clk_rtc_time; + uint32_t fail_measure = 0; + for (int j = 0; j < 3; ++j) { + clk_rtc_time = esp_clk_rtc_time(); + ets_delay_us(1000000); + uint64_t delta = esp_clk_rtc_time() - clk_rtc_time; + if (delta < 900000LL || delta > 1100000){ + printf("FAIL"); + fail = 1; + fail_measure = 1; + break; + } + } + if(fail_measure == 0) { + printf("PASS"); + } + printf(" [calibration val = %d] \n", esp_clk_slowclk_cal_get()); + stop_rtc_external_quartz(); + ets_delay_us(500000); + } + TEST_ASSERT_MESSAGE(fail == 0, "Test failed"); + printf("Test passed successfully\n"); +} + +TEST_CASE("Test starting external RTC quartz", "[rtc_clk][test_env=UT_T1_32kXTAL]") +{ + int i = 0, fail = 0; + uint32_t start_time; + uint32_t end_time; + stop_rtc_external_quartz(); +#ifdef CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS + uint32_t bootstrap_cycles = CONFIG_ESP32_RTC_XTAL_BOOTSTRAP_CYCLES; + printf("Test is started. Kconfig settings:\n External 32K crystal is selected,\n Oscillation cycles = %d,\n Calibration cycles = %d.\n", + bootstrap_cycles, + CONFIG_ESP32_RTC_CLK_CAL_CYCLES); +#else + uint32_t bootstrap_cycles = 5; + printf("Test is started. Kconfig settings:\n Internal RC is selected,\n Oscillation cycles = %d,\n Calibration cycles = %d.\n", + bootstrap_cycles, + CONFIG_ESP32_RTC_CLK_CAL_CYCLES); +#endif + if (CONFIG_ESP32_RTC_CLK_CAL_CYCLES < 1500){ + printf("Recommended increase Number of cycles for RTC_SLOW_CLK calibration to 3000!\n"); + } + while(i < COUNT_TEST){ + start_time = xTaskGetTickCount() * (1000 / configTICK_RATE_HZ); + i++; + printf("attempt #%d/%d...", i, COUNT_TEST); + rtc_clk_32k_bootstrap(bootstrap_cycles); + rtc_clk_select_rtc_slow_clk(); + end_time = xTaskGetTickCount() * (1000 / configTICK_RATE_HZ); + printf(" [time=%d] ", end_time - start_time); + if((end_time - start_time) > TIMEOUT_TEST_MS){ + printf("FAIL\n"); + fail = 1; + } else { + printf("PASS\n"); + } + stop_rtc_external_quartz(); + ets_delay_us(100000); + } + TEST_ASSERT_MESSAGE(fail == 0, "Test failed"); + printf("Test passed successfully\n"); +} + +TEST_CASE("Test starting 'External 32kHz XTAL' on the board with it.", "[rtc_clk][test_env=UT_T1_32kXTAL]") +{ + start_freq(RTC_SLOW_FREQ_32K_XTAL, 200); + start_freq(RTC_SLOW_FREQ_32K_XTAL, 0); +} + +TEST_CASE("Test starting 'External 32kHz XTAL' on the board without it.", "[rtc_clk][test_env=UT_T1_no32kXTAL]") +{ + printf("Tries to start the 'External 32kHz XTAL' on the board without it. " + "Clock switching to 'Internal 150 kHz RC oscillator'.\n"); + + printf("This test will be successful for boards without an external crystal or non-working crystal. " + "First, there will be an attempt to start from the external crystal after a failure " + "will switch to the internal RC circuit. If the switch to the internal RC circuit " + "was successful then the test succeeded.\n"); + + start_freq(RTC_SLOW_FREQ_RTC, 200); + start_freq(RTC_SLOW_FREQ_RTC, 0); +} + +#endif diff --git a/components/spi_flash/sim/Makefile.files b/components/spi_flash/sim/Makefile.files index f66a58c67..8cbd1e6fc 100644 --- a/components/spi_flash/sim/Makefile.files +++ b/components/spi_flash/sim/Makefile.files @@ -28,8 +28,9 @@ INCLUDE_DIRS := \ esp_common/include \ xtensa/include \ xtensa/esp32/include \ - soc/esp32/include \ + soc/soc/esp32/include \ soc/include \ + soc/soc/include \ esp32/include \ bootloader_support/include \ app_update/include \ diff --git a/components/spi_flash/sim/stubs/Makefile.files b/components/spi_flash/sim/stubs/Makefile.files index 91c034768..6c5dc266e 100644 --- a/components/spi_flash/sim/stubs/Makefile.files +++ b/components/spi_flash/sim/stubs/Makefile.files @@ -19,8 +19,9 @@ INCLUDE_DIRS := \ vfs/include \ $(addprefix ../../../../components/, \ esp_common/include \ - soc/esp32/include \ + soc/soc/esp32/include \ soc/include \ + soc/soc/include \ xtensa/include \ xtensa/esp32/include \ esp32/include \ diff --git a/components/spiffs/test_spiffs_host/Makefile.files b/components/spiffs/test_spiffs_host/Makefile.files index 41a852f91..f7c864766 100644 --- a/components/spiffs/test_spiffs_host/Makefile.files +++ b/components/spiffs/test_spiffs_host/Makefile.files @@ -28,8 +28,9 @@ INCLUDE_DIRS := \ esp_common/include \ xtensa/include \ xtensa/esp32/include \ - soc/esp32/include \ + soc/soc/esp32/include \ soc/include \ + soc/soc/include \ esp32/include \ bootloader_support/include \ app_update/include \ diff --git a/components/wear_levelling/test_wl_host/Makefile.files b/components/wear_levelling/test_wl_host/Makefile.files index e65187bad..132d5f1d6 100644 --- a/components/wear_levelling/test_wl_host/Makefile.files +++ b/components/wear_levelling/test_wl_host/Makefile.files @@ -27,8 +27,9 @@ INCLUDE_DIRS := \ esp_common/include \ xtensa/include \ xtensa/esp32/include \ - soc/esp32/include \ + soc/soc/esp32/include \ soc/include \ + soc/soc/include \ esp32/include \ bootloader_support/include \ app_update/include \ diff --git a/docs/Doxyfile b/docs/Doxyfile index 1de1a7923..3f6c13085 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -123,11 +123,11 @@ INPUT = \ $(IDF_PATH)/components/soc/include/hal/gpio_types.h \ $(IDF_PATH)/components/soc/include/hal/uart_types.h \ $(IDF_PATH)/components/soc/include/hal/touch_sensor_types.h \ - $(IDF_PATH)/components/soc/esp32/include/soc/adc_channel.h \ - $(IDF_PATH)/components/soc/esp32/include/soc/dac_channel.h \ - $(IDF_PATH)/components/soc/esp32/include/soc/touch_sensor_channel.h \ - $(IDF_PATH)/components/soc/esp32/include/soc/uart_channel.h \ - $(IDF_PATH)/components/soc/esp32/include/soc/rtc_io_channel.h \ + $(IDF_PATH)/components/soc/soc/esp32/include/soc/adc_channel.h \ + $(IDF_PATH)/components/soc/soc/esp32/include/soc/dac_channel.h \ + $(IDF_PATH)/components/soc/soc/esp32/include/soc/touch_sensor_channel.h \ + $(IDF_PATH)/components/soc/soc/esp32/include/soc/uart_channel.h \ + $(IDF_PATH)/components/soc/soc/esp32/include/soc/rtc_io_channel.h \ ## esp_netif - API Reference $(IDF_PATH)/components/esp_netif/include/esp_netif.h \ $(IDF_PATH)/components/esp_netif/include/esp_netif_net_stack.h \ From b675df4b088e53e7647ab207605dd22bd62fcf8f Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Thu, 9 Jan 2020 14:43:41 +0800 Subject: [PATCH 2/3] soc: use include_next for including common touch sensor hal header --- components/soc/CMakeLists.txt | 8 ++++++-- components/soc/component.mk | 8 ++++++-- components/soc/include/hal/touch_sensor_hal.h | 6 ------ .../hal/{touch_sensor_hal_esp32.h => touch_sensor_hal.h} | 2 ++ .../{touch_sensor_hal_esp32s2.h => touch_sensor_hal.h} | 2 ++ 5 files changed, 16 insertions(+), 10 deletions(-) rename components/soc/src/esp32/include/hal/{touch_sensor_hal_esp32.h => touch_sensor_hal.h} (99%) rename components/soc/src/esp32s2/include/hal/{touch_sensor_hal_esp32s2.h => touch_sensor_hal.h} (99%) diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index 1bb0e31ef..7116f7261 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -37,7 +37,11 @@ elseif(CONFIG_IDF_TARGET_ESP32S2) target_sources(${COMPONENT_LIB} PRIVATE "src/hal/spi_flash_hal_gpspi.c") endif() +# Since there can be chip-specific HAL headers which can include the common +# HAL header via include_next, process the build scripts here first so that +# include directories appear first in the compile command. +add_subdirectory(src/${target}) +target_include_directories(${COMPONENT_LIB} PUBLIC include) + add_subdirectory(soc) target_link_libraries(${COMPONENT_LIB} PUBLIC "soc_${target}") - -add_subdirectory(src/${target}) diff --git a/components/soc/component.mk b/components/soc/component.mk index b86e9f8d0..96d220493 100644 --- a/components/soc/component.mk +++ b/components/soc/component.mk @@ -1,10 +1,14 @@ SOC_NAME := $(IDF_TARGET) COMPONENT_SRCDIRS := src src/hal +COMPONENT_ADD_INCLUDEDIRS := -COMPONENT_ADD_INCLUDEDIRS := include +# Since there can be chip-specific HAL headers which can include the common +# HAL header via include_next, process the build scripts here first so that +# include directories appear first in the compile command. +-include $(COMPONENT_PATH)/src/$(SOC_NAME)/component.mk +COMPONENT_ADD_INCLUDEDIRS += include -include $(COMPONENT_PATH)/soc/component.mk --include $(COMPONENT_PATH)/src/$(SOC_NAME)/component.mk COMPONENT_ADD_LDFRAGMENTS += linker.lf diff --git a/components/soc/include/hal/touch_sensor_hal.h b/components/soc/include/hal/touch_sensor_hal.h index dc2023f19..3d2f715b8 100644 --- a/components/soc/include/hal/touch_sensor_hal.h +++ b/components/soc/include/hal/touch_sensor_hal.h @@ -25,12 +25,6 @@ #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_types.h" -#ifdef CONFIG_IDF_TARGET_ESP32 -#include "hal/touch_sensor_hal_esp32.h" -#elif CONFIG_IDF_TARGET_ESP32S2 -#include "hal/touch_sensor_hal_esp32s2.h" -#endif - typedef struct { touch_high_volt_t refh; touch_low_volt_t refl; diff --git a/components/soc/src/esp32/include/hal/touch_sensor_hal_esp32.h b/components/soc/src/esp32/include/hal/touch_sensor_hal.h similarity index 99% rename from components/soc/src/esp32/include/hal/touch_sensor_hal_esp32.h rename to components/soc/src/esp32/include/hal/touch_sensor_hal.h index 82f8b799e..5ff2155dd 100644 --- a/components/soc/src/esp32/include/hal/touch_sensor_hal_esp32.h +++ b/components/soc/src/esp32/include/hal/touch_sensor_hal.h @@ -25,6 +25,8 @@ #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_types.h" +#include_next "hal/touch_sensor_hal.h" + /** * Set touch sensor measurement time. * diff --git a/components/soc/src/esp32s2/include/hal/touch_sensor_hal_esp32s2.h b/components/soc/src/esp32s2/include/hal/touch_sensor_hal.h similarity index 99% rename from components/soc/src/esp32s2/include/hal/touch_sensor_hal_esp32s2.h rename to components/soc/src/esp32s2/include/hal/touch_sensor_hal.h index ff0315abb..76e77e2d0 100644 --- a/components/soc/src/esp32s2/include/hal/touch_sensor_hal_esp32s2.h +++ b/components/soc/src/esp32s2/include/hal/touch_sensor_hal.h @@ -25,6 +25,8 @@ #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_types.h" +#include_next "hal/touch_sensor_hal.h" + /** * Reset the whole of touch module. * From 16e0c93e404f1b76d587d6f1ef37a9c688c54be9 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Mon, 27 Jan 2020 11:43:08 +0800 Subject: [PATCH 3/3] ci: solve public headers errors --- components/esp32s2/include/esp32s2/brownout.h | 8 ++++++++ components/esp32s2/include/esp32s2/cache_err_int.h | 7 +++++++ components/esp32s2/include/esp32s2/spiram.h | 7 +++++++ components/esp32s2/include/esp_clk.h | 8 ++++++++ components/esp32s2/include/esp_spiram.h | 7 +++++++ components/esp_wifi/esp32s2/include/phy_init_data.h | 8 ++++++++ components/soc/include/hal/touch_sensor_hal.h | 10 +++++++++- components/soc/soc/esp32/include/soc/brownout_caps.h | 2 ++ components/soc/soc/esp32/include/soc/can_caps.h | 2 ++ components/soc/soc/esp32/include/soc/cpu.h | 8 ++++++++ components/soc/soc/esp32s2/include/soc/cpu.h | 8 ++++++++ components/soc/soc/esp32s2/include/soc/periph_defs.h | 2 ++ components/soc/soc/include/soc/adc_periph.h | 10 +++++++++- components/soc/soc/include/soc/can_periph.h | 8 ++++++++ components/soc/soc/include/soc/emac_periph.h | 2 -- components/soc/soc/include/soc/i2c_periph.h | 8 ++++++++ components/soc/soc/include/soc/ledc_periph.h | 8 ++++++++ components/soc/soc/include/soc/touch_sensor_periph.h | 10 +++++++++- components/soc/soc/include/soc/uart_periph.h | 9 +++++++++ components/soc/src/esp32/i2c_rtc_clk.h | 9 +++++++++ components/soc/src/esp32/include/hal/adc_ll.h | 8 ++++++++ components/soc/src/esp32/include/hal/dac_ll.h | 11 ++++++++++- components/soc/src/esp32/include/hal/i2c_ll.h | 11 ++++++++++- components/soc/src/esp32/include/hal/ledc_ll.h | 8 ++++++++ components/soc/src/esp32/include/hal/mcpwm_ll.h | 8 ++++++++ components/soc/src/esp32/include/hal/rtc_io_ll.h | 10 +++++++++- components/soc/src/esp32/include/hal/spi_flash_ll.h | 7 +++++++ components/soc/src/esp32/include/hal/spi_ll.h | 8 ++++++++ .../soc/src/esp32/include/hal/touch_sensor_hal.h | 10 +++++++++- .../soc/src/esp32/include/hal/touch_sensor_ll.h | 9 +++++++++ components/soc/src/esp32/include/hal/uart_ll.h | 8 ++++++++ components/soc/src/esp32/rtc_clk_common.h | 7 +++++++ components/soc/src/esp32s2/i2c_rtc_clk.h | 8 ++++++++ components/soc/src/esp32s2/include/hal/adc_ll.h | 9 +++++++++ components/soc/src/esp32s2/include/hal/dac_ll.h | 10 +++++++++- .../soc/src/esp32s2/include/hal/gpspi_flash_ll.h | 6 ++++++ components/soc/src/esp32s2/include/hal/i2c_ll.h | 8 ++++++++ components/soc/src/esp32s2/include/hal/ledc_ll.h | 8 ++++++++ components/soc/src/esp32s2/include/hal/rtc_io_ll.h | 10 +++++++++- components/soc/src/esp32s2/include/hal/spi_flash_ll.h | 8 ++++++++ components/soc/src/esp32s2/include/hal/spi_ll.h | 8 ++++++++ .../soc/src/esp32s2/include/hal/spimem_flash_ll.h | 8 ++++++++ .../soc/src/esp32s2/include/hal/touch_sensor_hal.h | 8 ++++++++ .../soc/src/esp32s2/include/hal/touch_sensor_ll.h | 11 ++++++++++- components/soc/src/esp32s2/include/hal/uart_ll.h | 8 ++++++++ .../xtensa/esp32s2/include/xtensa/config/core.h | 7 +++++++ .../xtensa/esp32s2/include/xtensa/config/defs.h | 3 --- .../xtensa/esp32s2/include/xtensa/config/tie-asm.h | 8 ++++++++ tools/ci/check_public_headers_exceptions.txt | 2 -- 49 files changed, 359 insertions(+), 17 deletions(-) diff --git a/components/esp32s2/include/esp32s2/brownout.h b/components/esp32s2/include/esp32s2/brownout.h index dafba8dd7..d0c120dd0 100644 --- a/components/esp32s2/include/esp32s2/brownout.h +++ b/components/esp32s2/include/esp32s2/brownout.h @@ -16,6 +16,14 @@ #ifndef __ESP_BROWNOUT_H #define __ESP_BROWNOUT_H +#ifdef __cplusplus +extern "C" { +#endif + void esp_brownout_init(void); +#ifdef __cplusplus +} +#endif + #endif \ No newline at end of file diff --git a/components/esp32s2/include/esp32s2/cache_err_int.h b/components/esp32s2/include/esp32s2/cache_err_int.h index 8881291a2..d87a7d9dd 100644 --- a/components/esp32s2/include/esp32s2/cache_err_int.h +++ b/components/esp32s2/include/esp32s2/cache_err_int.h @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +#ifdef __cplusplus +extern "C" { +#endif /** * @brief initialize cache invalid access interrupt @@ -31,3 +34,7 @@ void esp_cache_err_int_init(void); * - (-1) otherwise */ int esp_cache_err_get_cpuid(void); + +#ifdef __cplusplus +} +#endif diff --git a/components/esp32s2/include/esp32s2/spiram.h b/components/esp32s2/include/esp32s2/spiram.h index 3ca4e3fa1..d7320c1af 100644 --- a/components/esp32s2/include/esp32s2/spiram.h +++ b/components/esp32s2/include/esp32s2/spiram.h @@ -21,6 +21,10 @@ #include #include "esp_err.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Initialize spiram interface/hardware. Normally called from cpu_start.c. * @@ -87,5 +91,8 @@ void esp_spiram_writeback_cache(void); */ esp_err_t esp_spiram_reserve_dma_pool(size_t size); +#ifdef __cplusplus +} +#endif #endif diff --git a/components/esp32s2/include/esp_clk.h b/components/esp32s2/include/esp_clk.h index 06ada586b..2d379d651 100644 --- a/components/esp32s2/include/esp_clk.h +++ b/components/esp32s2/include/esp_clk.h @@ -14,6 +14,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + /** * @file esp_clk.h * @@ -73,3 +77,7 @@ int esp_clk_apb_freq(void); * @return Value or RTC counter, expressed in microseconds */ uint64_t esp_clk_rtc_time(void); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/esp32s2/include/esp_spiram.h b/components/esp32s2/include/esp_spiram.h index 2c3a37eac..414cc310a 100644 --- a/components/esp32s2/include/esp_spiram.h +++ b/components/esp32s2/include/esp_spiram.h @@ -20,6 +20,10 @@ #include #include "esp_err.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Initialize spiram interface/hardware. Normally called from cpu_start.c. * @@ -86,5 +90,8 @@ void esp_spiram_writeback_cache(void); */ esp_err_t esp_spiram_reserve_dma_pool(size_t size); +#ifdef __cplusplus +} +#endif #endif diff --git a/components/esp_wifi/esp32s2/include/phy_init_data.h b/components/esp_wifi/esp32s2/include/phy_init_data.h index 57ea2faa2..da21d6fe2 100644 --- a/components/esp_wifi/esp32s2/include/phy_init_data.h +++ b/components/esp_wifi/esp32s2/include/phy_init_data.h @@ -17,6 +17,10 @@ #include "esp_phy_init.h" #include "sdkconfig.h" +#ifdef __cplusplus +extern "C" { +#endif + // constrain a value between 'low' and 'high', inclusive #define LIMIT(val, low, high) ((val < low) ? low : (val > high) ? high : val) @@ -144,5 +148,9 @@ static const esp_phy_init_data_t phy_init_data= { { static const char phy_init_magic_post[] = PHY_INIT_MAGIC; +#ifdef __cplusplus +} +#endif + #endif /* PHY_INIT_DATA_H */ diff --git a/components/soc/include/hal/touch_sensor_hal.h b/components/soc/include/hal/touch_sensor_hal.h index 3d2f715b8..db64bac87 100644 --- a/components/soc/include/hal/touch_sensor_hal.h +++ b/components/soc/include/hal/touch_sensor_hal.h @@ -25,6 +25,10 @@ #include "hal/touch_sensor_ll.h" #include "hal/touch_sensor_types.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { touch_high_volt_t refh; touch_low_volt_t refl; @@ -218,4 +222,8 @@ void touch_hal_deinit(void); /** * Configure touch sensor for each channel. */ -void touch_hal_config(touch_pad_t touch_num); \ No newline at end of file +void touch_hal_config(touch_pad_t touch_num); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/soc/esp32/include/soc/brownout_caps.h b/components/soc/soc/esp32/include/soc/brownout_caps.h index 5e867a892..079386811 100644 --- a/components/soc/soc/esp32/include/soc/brownout_caps.h +++ b/components/soc/soc/esp32/include/soc/brownout_caps.h @@ -18,6 +18,8 @@ extern "C" { #endif +#include "sdkconfig.h" + #if (CONFIG_ESP32_REV_MIN >= 1) #define SOC_BROWNOUT_RESET_SUPPORTED 1 #endif diff --git a/components/soc/soc/esp32/include/soc/can_caps.h b/components/soc/soc/esp32/include/soc/can_caps.h index 68073a336..2d2df9c43 100644 --- a/components/soc/soc/esp32/include/soc/can_caps.h +++ b/components/soc/soc/esp32/include/soc/can_caps.h @@ -18,6 +18,8 @@ extern "C" { #endif +#include "sdkconfig.h" + #if (CONFIG_ESP32_REV_MIN >= 2) #define CAN_BRP_DIV_SUPPORTED 1 #define CAN_BRP_DIV_THRESH 128 diff --git a/components/soc/soc/esp32/include/soc/cpu.h b/components/soc/soc/esp32/include/soc/cpu.h index 5e1eca273..82e710bfa 100644 --- a/components/soc/soc/esp32/include/soc/cpu.h +++ b/components/soc/soc/esp32/include/soc/cpu.h @@ -21,6 +21,10 @@ #include "xtensa/corebits.h" #include "xtensa/config/core.h" +#ifdef __cplusplus +extern "C" { +#endif + /* C macros for xtensa special register read/write/exchange */ #define RSR(reg, curval) asm volatile ("rsr %0, " #reg : "=r" (curval)); @@ -140,4 +144,8 @@ static inline esp_cpu_ccount_t esp_cpu_get_ccount(void) return result; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/components/soc/soc/esp32s2/include/soc/cpu.h b/components/soc/soc/esp32s2/include/soc/cpu.h index c73b16f24..a09e458b8 100644 --- a/components/soc/soc/esp32s2/include/soc/cpu.h +++ b/components/soc/soc/esp32s2/include/soc/cpu.h @@ -20,6 +20,10 @@ #include #include "xtensa/corebits.h" +#ifdef __cplusplus +extern "C" { +#endif + /* C macros for xtensa special register read/write/exchange */ #define RSR(reg, curval) asm volatile ("rsr %0, " #reg : "=r" (curval)); @@ -131,4 +135,8 @@ static inline esp_cpu_ccount_t esp_cpu_get_ccount(void) return result; } +#ifdef __cplusplus +} +#endif + #endif diff --git a/components/soc/soc/esp32s2/include/soc/periph_defs.h b/components/soc/soc/esp32s2/include/soc/periph_defs.h index a7541ef7b..c72b5a5a4 100644 --- a/components/soc/soc/esp32s2/include/soc/periph_defs.h +++ b/components/soc/soc/esp32s2/include/soc/periph_defs.h @@ -15,6 +15,8 @@ #ifndef _SOC_PERIPH_DEFS_H_ #define _SOC_PERIPH_DEFS_H_ +#include "sdkconfig.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/components/soc/soc/include/soc/adc_periph.h b/components/soc/soc/include/soc/adc_periph.h index b234cf2d7..2ac7e7d35 100644 --- a/components/soc/soc/include/soc/adc_periph.h +++ b/components/soc/soc/include/soc/adc_periph.h @@ -23,6 +23,10 @@ #include "soc/adc_channel.h" #include "soc/adc_caps.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * Store IO number corresponding to the ADC channel number. * @@ -30,4 +34,8 @@ * - >=0 : GPIO number index. * - -1 : Not support. */ -extern const int adc_channel_io_map[SOC_ADC_PERIPH_NUM][SOC_ADC_MAX_CHANNEL_NUM]; \ No newline at end of file +extern const int adc_channel_io_map[SOC_ADC_PERIPH_NUM][SOC_ADC_MAX_CHANNEL_NUM]; + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/soc/include/soc/can_periph.h b/components/soc/soc/include/soc/can_periph.h index f00a15d00..d21c08d44 100644 --- a/components/soc/soc/include/soc/can_periph.h +++ b/components/soc/soc/include/soc/can_periph.h @@ -16,7 +16,15 @@ #include "sdkconfig.h" +#ifdef __cplusplus +extern "C" { +#endif + #if CONFIG_IDF_TARGET_ESP32 #include "soc/can_struct.h" #include "soc/can_caps.h" #endif + +#ifdef __cplusplus +} +#endif diff --git a/components/soc/soc/include/soc/emac_periph.h b/components/soc/soc/include/soc/emac_periph.h index 4121018b6..6f7323f46 100644 --- a/components/soc/soc/include/soc/emac_periph.h +++ b/components/soc/soc/include/soc/emac_periph.h @@ -13,5 +13,3 @@ // limitations under the License. #pragma once -#include "soc/emac_reg_v2.h" -#include "soc/emac_ex_reg.h" diff --git a/components/soc/soc/include/soc/i2c_periph.h b/components/soc/soc/include/soc/i2c_periph.h index ea9c2eec6..3f597c5d5 100644 --- a/components/soc/soc/include/soc/i2c_periph.h +++ b/components/soc/soc/include/soc/i2c_periph.h @@ -18,6 +18,10 @@ #include "soc/i2c_caps.h" #include "soc/periph_defs.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { const uint8_t sda_out_sig; const uint8_t sda_in_sig; @@ -28,3 +32,7 @@ typedef struct { } i2c_signal_conn_t; extern const i2c_signal_conn_t i2c_periph_signal[SOC_I2C_NUM]; + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/soc/include/soc/ledc_periph.h b/components/soc/soc/include/soc/ledc_periph.h index e93771e19..4cfb5ac9d 100644 --- a/components/soc/soc/include/soc/ledc_periph.h +++ b/components/soc/soc/include/soc/ledc_periph.h @@ -17,6 +17,10 @@ #include "soc/ledc_struct.h" #include "soc/ledc_caps.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Stores a bunch of per-ledc-peripheral data. */ @@ -29,3 +33,7 @@ extern const ledc_signal_conn_t ledc_periph_signal[2]; #else extern const ledc_signal_conn_t ledc_periph_signal[1]; #endif + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/soc/include/soc/touch_sensor_periph.h b/components/soc/soc/include/soc/touch_sensor_periph.h index edd5195b0..a1ebeafcd 100644 --- a/components/soc/soc/include/soc/touch_sensor_periph.h +++ b/components/soc/soc/include/soc/touch_sensor_periph.h @@ -22,4 +22,12 @@ #include "soc/sens_struct.h" #include "soc/rtc_io_struct.h" -extern const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM]; \ No newline at end of file +#ifdef __cplusplus +extern "C" { +#endif + +extern const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM]; + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/soc/include/soc/uart_periph.h b/components/soc/soc/include/soc/uart_periph.h index 7dbf8aedd..3ce864543 100644 --- a/components/soc/soc/include/soc/uart_periph.h +++ b/components/soc/soc/include/soc/uart_periph.h @@ -19,6 +19,10 @@ #include "soc/periph_defs.h" #include "soc/gpio_sig_map.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { const uint8_t tx_sig; const uint8_t rx_sig; @@ -29,3 +33,8 @@ typedef struct { } uart_signal_conn_t; extern const uart_signal_conn_t uart_periph_signal[SOC_UART_NUM]; + +#ifdef __cplusplus +} +#endif + diff --git a/components/soc/src/esp32/i2c_rtc_clk.h b/components/soc/src/esp32/i2c_rtc_clk.h index a26b52100..5ca44d308 100644 --- a/components/soc/src/esp32/i2c_rtc_clk.h +++ b/components/soc/src/esp32/i2c_rtc_clk.h @@ -17,6 +17,10 @@ #include "i2c_apll.h" #include "i2c_bbpll.h" +#ifdef __cplusplus +extern "C" { +#endif + /* Analog function control register */ #define ANA_CONFIG_REG 0x6000E044 #define ANA_CONFIG_S (8) @@ -46,3 +50,8 @@ void rom_i2c_writeReg_Mask(uint8_t block, uint8_t host_id, uint8_t reg_add, uint #define I2C_READREG_RTC(block, reg_add) \ rom_i2c_readReg(block, block##_HOSTID, reg_add) + + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32/include/hal/adc_ll.h b/components/soc/src/esp32/include/hal/adc_ll.h index d08ec0a84..2d3c6c982 100644 --- a/components/soc/src/esp32/include/hal/adc_ll.h +++ b/components/soc/src/esp32/include/hal/adc_ll.h @@ -4,6 +4,10 @@ #include "hal/adc_types.h" #include +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { ADC_DIG_FORMAT_12BIT, /*!< ADC to I2S data format, [15:12]-channel [11:0]-12 bits ADC data. Note: In single convert mode. */ @@ -620,3 +624,7 @@ static inline bool adc_ll_vref_output(int io) SENS.sar_meas_start2.sar2_en_pad = 1 << channel; return true; } + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32/include/hal/dac_ll.h b/components/soc/src/esp32/include/hal/dac_ll.h index 1f31c7283..15606357c 100644 --- a/components/soc/src/esp32/include/hal/dac_ll.h +++ b/components/soc/src/esp32/include/hal/dac_ll.h @@ -24,6 +24,10 @@ #include "soc/dac_periph.h" #include "hal/dac_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * Power on dac module and start output voltage. * @@ -182,4 +186,9 @@ static inline void dac_ll_dma_enable(void) static inline void dac_ll_dma_disable(void) { SENS.sar_dac_ctrl1.dac_dig_force = 0; -} \ No newline at end of file +} + + +#ifdef __cplusplus +} +#endif diff --git a/components/soc/src/esp32/include/hal/i2c_ll.h b/components/soc/src/esp32/include/hal/i2c_ll.h index 993af1e22..a670a66d8 100644 --- a/components/soc/src/esp32/include/hal/i2c_ll.h +++ b/components/soc/src/esp32/include/hal/i2c_ll.h @@ -18,6 +18,10 @@ #include "soc/i2c_periph.h" #include "hal/i2c_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief I2C hardware cmd register filed. */ @@ -848,4 +852,9 @@ static inline void i2c_ll_slave_init(i2c_dev_t *hw) ctrl_reg.scl_force_out = 1; hw->ctr.val = ctrl_reg.val; hw->fifo_conf.fifo_addr_cfg_en = 0; -} \ No newline at end of file +} + +#ifdef __cplusplus +} +#endif + diff --git a/components/soc/src/esp32/include/hal/ledc_ll.h b/components/soc/src/esp32/include/hal/ledc_ll.h index 674b55cff..4bbd90e88 100644 --- a/components/soc/src/esp32/include/hal/ledc_ll.h +++ b/components/soc/src/esp32/include/hal/ledc_ll.h @@ -22,6 +22,10 @@ #define LEDC_LL_GET_HW() &LEDC +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Set LEDC low speed timer clock * @@ -456,3 +460,7 @@ static inline void ledc_ll_bind_channel_timer(ledc_dev_t *hw, ledc_mode_t speed_ static inline void ledc_ll_get_channel_timer(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, ledc_timer_t *timer_sel){ *timer_sel = hw->channel_group[speed_mode].channel[channel_num].conf0.timer_sel; } + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32/include/hal/mcpwm_ll.h b/components/soc/src/esp32/include/hal/mcpwm_ll.h index 6bb4bb0c7..b99067518 100644 --- a/components/soc/src/esp32/include/hal/mcpwm_ll.h +++ b/components/soc/src/esp32/include/hal/mcpwm_ll.h @@ -30,6 +30,10 @@ #include "esp_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /// Get the address of peripheral registers #define MCPWM_LL_GET_HW(ID) (((ID)==0)? &MCPWM0: &MCPWM1) @@ -725,3 +729,7 @@ static inline mcpwm_intr_t mcpwm_ll_get_cap_intr_def(int bit) { return BIT(bit+MCPWM_CAP0_INT_RAW_S); } + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32/include/hal/rtc_io_ll.h b/components/soc/src/esp32/include/hal/rtc_io_ll.h index ea53a93a2..450185327 100644 --- a/components/soc/src/esp32/include/hal/rtc_io_ll.h +++ b/components/soc/src/esp32/include/hal/rtc_io_ll.h @@ -25,6 +25,10 @@ #include "hal/rtc_io_types.h" #include "hal/gpio_types.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { RTCIO_FUNC_RTC = 0x0, /*!< The pin controled by RTC module. */ RTCIO_FUNC_DIGITAL = 0x1, /*!< The pin controlled by DIGITAL module. */ @@ -346,4 +350,8 @@ static inline void rtcio_ll_enable_sleep_setting(gpio_num_t gpio_num) static inline void rtcio_ll_disable_sleep_setting(gpio_num_t gpio_num) { CLEAR_PERI_REG_MASK(rtc_io_desc[gpio_num].reg, rtc_io_desc[gpio_num].slpsel); -} \ No newline at end of file +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32/include/hal/spi_flash_ll.h b/components/soc/src/esp32/include/hal/spi_flash_ll.h index 36ccb7169..d47396f54 100644 --- a/components/soc/src/esp32/include/hal/spi_flash_ll.h +++ b/components/soc/src/esp32/include/hal/spi_flash_ll.h @@ -30,6 +30,9 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif //Supported clock register values #define SPI_FLASH_LL_CLKREG_VAL_5MHZ ((spi_flash_ll_clock_reg_t){.val=0x0000F1CF}) ///< Clock set to 5 MHz @@ -375,3 +378,7 @@ static inline void spi_flash_ll_set_dummy(spi_dev_t *dev, uint32_t dummy_n) dev->user.usr_dummy = dummy_n ? 1 : 0; dev->user1.usr_dummy_cyclelen = dummy_n - 1; } + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32/include/hal/spi_ll.h b/components/soc/src/esp32/include/hal/spi_ll.h index aaa4fa7ab..bfcc9e736 100644 --- a/components/soc/src/esp32/include/hal/spi_ll.h +++ b/components/soc/src/esp32/include/hal/spi_ll.h @@ -29,6 +29,10 @@ #include #include //for abs() +#ifdef __cplusplus +extern "C" { +#endif + /// Registers to reset during initialization. Don't use in app. #define SPI_LL_RST_MASK (SPI_OUT_RST | SPI_IN_RST | SPI_AHBM_RST | SPI_AHBM_FIFO_RST) /// Interrupt not used. Don't use in app. @@ -874,3 +878,7 @@ static inline uint32_t spi_ll_slave_get_rcv_bitlen(spi_dev_t *hw) #undef SPI_LL_RST_MASK #undef SPI_LL_UNUSED_INT_MASK + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32/include/hal/touch_sensor_hal.h b/components/soc/src/esp32/include/hal/touch_sensor_hal.h index 5ff2155dd..f21bbd418 100644 --- a/components/soc/src/esp32/include/hal/touch_sensor_hal.h +++ b/components/soc/src/esp32/include/hal/touch_sensor_hal.h @@ -27,6 +27,10 @@ #include_next "hal/touch_sensor_hal.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * Set touch sensor measurement time. * @@ -119,4 +123,8 @@ * * @param pad_num pointer to touch pad which caused wakeup. */ -void touch_hal_get_wakeup_status(touch_pad_t *pad_num); \ No newline at end of file +void touch_hal_get_wakeup_status(touch_pad_t *pad_num); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32/include/hal/touch_sensor_ll.h b/components/soc/src/esp32/include/hal/touch_sensor_ll.h index 6786fef4a..fa86c2399 100644 --- a/components/soc/src/esp32/include/hal/touch_sensor_ll.h +++ b/components/soc/src/esp32/include/hal/touch_sensor_ll.h @@ -27,6 +27,11 @@ #include "soc/touch_sensor_periph.h" #include "hal/touch_sensor_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + //Some register bits of touch sensor 8 and 9 are mismatched, we need to swap the bits. #define TOUCH_LL_BIT_SWAP(data, n, m) (((data >> n) & 0x1) == ((data >> m) & 0x1) ? (data) : ((data) ^ ((0x1 < +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { ADC_DIG_FORMAT_12BIT, /*!< ADC to I2S data format, [15:12]-channel [11:0]-12 bits ADC data. Note: In single convert mode. */ @@ -588,3 +592,8 @@ static inline bool adc_ll_vref_output(int io) { return false; } + + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32s2/include/hal/dac_ll.h b/components/soc/src/esp32s2/include/hal/dac_ll.h index 1f31c7283..d99471810 100644 --- a/components/soc/src/esp32s2/include/hal/dac_ll.h +++ b/components/soc/src/esp32s2/include/hal/dac_ll.h @@ -24,6 +24,10 @@ #include "soc/dac_periph.h" #include "hal/dac_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * Power on dac module and start output voltage. * @@ -182,4 +186,8 @@ static inline void dac_ll_dma_enable(void) static inline void dac_ll_dma_disable(void) { SENS.sar_dac_ctrl1.dac_dig_force = 0; -} \ No newline at end of file +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32s2/include/hal/gpspi_flash_ll.h b/components/soc/src/esp32s2/include/hal/gpspi_flash_ll.h index af23a0dbb..993370dc4 100644 --- a/components/soc/src/esp32s2/include/hal/gpspi_flash_ll.h +++ b/components/soc/src/esp32s2/include/hal/gpspi_flash_ll.h @@ -30,6 +30,9 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif #define gpspi_flash_ll_get_hw(host_id) (((host_id)==SPI2_HOST ? &GPSPI2 \ : ((host_id)==SPI3_HOST ? &GPSPI3 \ @@ -352,3 +355,6 @@ static inline void gpspi_flash_ll_set_dummy_out(spi_dev_t *dev, uint32_t out_en, dev->ctrl.d_pol = out_lev; } +#ifdef __cplusplus +} +#endif diff --git a/components/soc/src/esp32s2/include/hal/i2c_ll.h b/components/soc/src/esp32s2/include/hal/i2c_ll.h index e3d080aa8..f06bd8d11 100644 --- a/components/soc/src/esp32s2/include/hal/i2c_ll.h +++ b/components/soc/src/esp32s2/include/hal/i2c_ll.h @@ -18,6 +18,10 @@ #include "soc/i2c_periph.h" #include "hal/i2c_types.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief I2C hardware cmd register filed. */ @@ -864,3 +868,7 @@ static inline void i2c_ll_slave_init(i2c_dev_t *hw) hw->ctr.val = ctrl_reg.val; hw->fifo_conf.fifo_addr_cfg_en = 0; } + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32s2/include/hal/ledc_ll.h b/components/soc/src/esp32s2/include/hal/ledc_ll.h index 3cd87a9de..5f3e22a41 100644 --- a/components/soc/src/esp32s2/include/hal/ledc_ll.h +++ b/components/soc/src/esp32s2/include/hal/ledc_ll.h @@ -20,6 +20,10 @@ #include "hal/ledc_types.h" #include "soc/ledc_periph.h" +#ifdef __cplusplus +extern "C" { +#endif + #define LEDC_LL_GET_HW() &LEDC /** @@ -477,3 +481,7 @@ static inline void ledc_ll_bind_channel_timer(ledc_dev_t *hw, ledc_mode_t speed_ static inline void ledc_ll_get_channel_timer(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, ledc_timer_t *timer_sel){ *timer_sel = hw->channel_group[speed_mode].channel[channel_num].conf0.timer_sel; } + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32s2/include/hal/rtc_io_ll.h b/components/soc/src/esp32s2/include/hal/rtc_io_ll.h index 56403ca3d..3a57ad922 100644 --- a/components/soc/src/esp32s2/include/hal/rtc_io_ll.h +++ b/components/soc/src/esp32s2/include/hal/rtc_io_ll.h @@ -25,6 +25,10 @@ #include "hal/rtc_io_types.h" #include "hal/gpio_types.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { RTCIO_FUNC_RTC = 0x0, /*!< The pin controled by RTC module. */ RTCIO_FUNC_DIGITAL = 0x1, /*!< The pin controlled by DIGITAL module. */ @@ -346,4 +350,8 @@ static inline void rtcio_ll_enable_sleep_setting(gpio_num_t gpio_num) static inline void rtcio_ll_disable_sleep_setting(gpio_num_t gpio_num) { CLEAR_PERI_REG_MASK(rtc_io_desc[gpio_num].reg, rtc_io_desc[gpio_num].slpsel); -} \ No newline at end of file +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32s2/include/hal/spi_flash_ll.h b/components/soc/src/esp32s2/include/hal/spi_flash_ll.h index 79a83dc81..383c8275a 100644 --- a/components/soc/src/esp32s2/include/hal/spi_flash_ll.h +++ b/components/soc/src/esp32s2/include/hal/spi_flash_ll.h @@ -25,6 +25,10 @@ #include "gpspi_flash_ll.h" #include "spimem_flash_ll.h" +#ifdef __cplusplus +extern "C" { +#endif + // For esp32s2, spimem is equivalent to traditional spi peripherals found // in esp32. Let the spi flash clock reg definitions reflect this. #define SPI_FLASH_LL_CLKREG_VAL_5MHZ {.spimem=SPIMEM_FLASH_LL_CLKREG_VAL_5MHZ} @@ -89,3 +93,7 @@ typedef union { #define spi_flash_ll_set_dummy(dev, dummy) spimem_flash_ll_set_dummy((spi_mem_dev_t*)dev, dummy) #define spi_flash_ll_set_dummy_out(dev, en, lev) spimem_flash_ll_set_dummy_out((spi_mem_dev_t*)dev, en, lev) #endif + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32s2/include/hal/spi_ll.h b/components/soc/src/esp32s2/include/hal/spi_ll.h index b09523a52..f719202a0 100644 --- a/components/soc/src/esp32s2/include/hal/spi_ll.h +++ b/components/soc/src/esp32s2/include/hal/spi_ll.h @@ -29,6 +29,10 @@ #include "soc/spi_periph.h" #include "esp32s2/rom/lldesc.h" +#ifdef __cplusplus +extern "C" { +#endif + /// Registers to reset during initialization. Don't use in app. #define SPI_LL_RST_MASK (SPI_OUT_RST | SPI_IN_RST | SPI_AHBM_RST | SPI_AHBM_FIFO_RST) /// Interrupt not used. Don't use in app. @@ -858,3 +862,7 @@ static inline uint32_t spi_ll_slave_get_rcv_bitlen(spi_dev_t *hw) #undef SPI_LL_RST_MASK #undef SPI_LL_UNUSED_INT_MASK + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32s2/include/hal/spimem_flash_ll.h b/components/soc/src/esp32s2/include/hal/spimem_flash_ll.h index c243d2875..dc8b39611 100644 --- a/components/soc/src/esp32s2/include/hal/spimem_flash_ll.h +++ b/components/soc/src/esp32s2/include/hal/spimem_flash_ll.h @@ -31,6 +31,10 @@ #include "hal/spi_types.h" #include "hal/spi_flash_types.h" +#ifdef __cplusplus +extern "C" { +#endif + #define spimem_flash_ll_get_hw(host_id) (((host_id)==SPI1_HOST ? &SPIMEM1 : NULL )) typedef typeof(SPIMEM1.clock) spimem_flash_ll_clock_reg_t; @@ -377,3 +381,7 @@ static inline void spimem_flash_ll_set_dummy_out(spi_mem_dev_t *dev, uint32_t ou dev->ctrl.q_pol = out_lev; dev->ctrl.d_pol = out_lev; } + +#ifdef __cplusplus +} +#endif diff --git a/components/soc/src/esp32s2/include/hal/touch_sensor_hal.h b/components/soc/src/esp32s2/include/hal/touch_sensor_hal.h index 76e77e2d0..40e5a0b41 100644 --- a/components/soc/src/esp32s2/include/hal/touch_sensor_hal.h +++ b/components/soc/src/esp32s2/include/hal/touch_sensor_hal.h @@ -27,6 +27,10 @@ #include_next "hal/touch_sensor_hal.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * Reset the whole of touch module. * @@ -572,3 +576,7 @@ void touch_hal_sleep_channel_config(const touch_pad_sleep_channel_t *slp_config) * @param pad_num pointer to touch pad which caused wakeup. */ #define touch_hal_get_wakeup_status(pad_num) touch_ll_get_wakeup_status(pad_num) + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32s2/include/hal/touch_sensor_ll.h b/components/soc/src/esp32s2/include/hal/touch_sensor_ll.h index 8cc54b68b..0bd1aa70b 100644 --- a/components/soc/src/esp32s2/include/hal/touch_sensor_ll.h +++ b/components/soc/src/esp32s2/include/hal/touch_sensor_ll.h @@ -27,6 +27,11 @@ #include "soc/touch_sensor_periph.h" #include "hal/touch_sensor_types.h" +#ifdef __cplusplus +extern "C" { +#endif + + /** * Set touch sensor touch sensor times of charge and discharge. * @@ -1070,4 +1075,8 @@ static inline void touch_ll_sleep_read_proximity_cnt(uint32_t *approach_cnt) static inline void touch_ll_get_wakeup_status(touch_pad_t *pad_num) { *pad_num = (touch_pad_t)RTCCNTL.touch_slp_thres.touch_slp_pad; -} \ No newline at end of file +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/soc/src/esp32s2/include/hal/uart_ll.h b/components/soc/src/esp32s2/include/hal/uart_ll.h index 7a2a045d3..7068b926f 100644 --- a/components/soc/src/esp32s2/include/hal/uart_ll.h +++ b/components/soc/src/esp32s2/include/hal/uart_ll.h @@ -20,6 +20,10 @@ #include "hal/uart_types.h" #include "soc/uart_periph.h" +#ifdef __cplusplus +extern "C" { +#endif + // The default fifo depth #define UART_LL_FIFO_DEF_LEN (UART_FIFO_LEN) // Get UART hardware instance with giving uart num @@ -767,3 +771,7 @@ static inline void uart_ll_inverse_signal(uart_dev_t *hw, uint32_t inv_mask) conf0_reg.dtr_inv |= (inv_mask & UART_SIGNAL_DTR_INV) ? 1 : 0; hw->conf0.val = conf0_reg.val; } + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/components/xtensa/esp32s2/include/xtensa/config/core.h b/components/xtensa/esp32s2/include/xtensa/config/core.h index f5bb44faf..8460d1c92 100644 --- a/components/xtensa/esp32s2/include/xtensa/config/core.h +++ b/components/xtensa/esp32s2/include/xtensa/config/core.h @@ -64,6 +64,10 @@ #endif #endif /*_ASMLANGUAGE or __ASSEMBLER__*/ +#ifdef __cplusplus +extern "C" { +#endif + /*---------------------------------------------------------------------- GENERAL @@ -1403,6 +1407,9 @@ extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP7_IDENT); # define XCHAL_HW_RELEASE_MAJOR_AT(major) XCHAL_HW_RELEASE_AT(major,0) #endif +#ifdef __cplusplus +} +#endif #endif /*XTENSA_CONFIG_CORE_H*/ diff --git a/components/xtensa/esp32s2/include/xtensa/config/defs.h b/components/xtensa/esp32s2/include/xtensa/config/defs.h index 9cf321a1d..bb57294f4 100644 --- a/components/xtensa/esp32s2/include/xtensa/config/defs.h +++ b/components/xtensa/esp32s2/include/xtensa/config/defs.h @@ -30,8 +30,5 @@ #ifdef __XTENSA__ -#include -#include - #endif /* __XTENSA__ */ #endif /* !_XTENSA_BASE_HEADER */ diff --git a/components/xtensa/esp32s2/include/xtensa/config/tie-asm.h b/components/xtensa/esp32s2/include/xtensa/config/tie-asm.h index 681b45602..ac1f374da 100644 --- a/components/xtensa/esp32s2/include/xtensa/config/tie-asm.h +++ b/components/xtensa/esp32s2/include/xtensa/config/tie-asm.h @@ -32,6 +32,10 @@ #ifndef _XTENSA_CORE_TIE_ASM_H #define _XTENSA_CORE_TIE_ASM_H +#ifdef __cplusplus +extern "C" { +#endif + /* Selection parameter values for save-area save/restore macros: */ /* Option vs. TIE: */ #define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */ @@ -126,5 +130,9 @@ #define XCHAL_SA_NUM_ATMPS 1 +#ifdef __cplusplus +} +#endif + #endif /*_XTENSA_CORE_TIE_ASM_H*/ diff --git a/tools/ci/check_public_headers_exceptions.txt b/tools/ci/check_public_headers_exceptions.txt index 8b6c7e46c..0ff628ab3 100644 --- a/tools/ci/check_public_headers_exceptions.txt +++ b/tools/ci/check_public_headers_exceptions.txt @@ -12,8 +12,6 @@ components/freertos/xtensa/include/freertos/* components/log/include/esp_log_internal.h -components/soc/esp32/include/hal/* -components/soc/esp32/include/soc/* components/soc/include/hal/* components/soc/include/soc/*