diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5d94e62310..58941f2406 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,7 +26,8 @@ variables: # If the "recursive" strategy is used we have a problem with using relative URLs for sub-submodules. GIT_SUBMODULE_STRATEGY: normal - UNIT_TEST_BUILD_SYSTEM: make + UNIT_TEST_BUILD_SYSTEM: cmake + EXAMPLE_TEST_BUILD_SYSTEM: cmake # IDF environment IDF_PATH: "$CI_PROJECT_DIR" diff --git a/.gitmodules b/.gitmodules index 8366568747..f054087dd0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -71,6 +71,10 @@ path = components/esp_wifi/lib_esp32 url = ../../espressif/esp32-wifi-lib.git +[submodule "components/esp_wifi/lib_esp32s2beta"] + path = components/esp_wifi/lib_esp32s2beta + url = ../../espressif/esp32-wifi-lib.git + [submodule "components/bt/host/nimble/nimble"] path = components/bt/host/nimble/nimble url = ../../espressif/esp-nimble.git @@ -78,3 +82,4 @@ [submodule "components/cbor/tinycbor"] path = components/cbor/tinycbor url = ../../intel/tinycbor.git + diff --git a/Kconfig b/Kconfig index 815f87d072..7b87763b17 100644 --- a/Kconfig +++ b/Kconfig @@ -29,15 +29,29 @@ mainmenu "Espressif IoT Development Framework Configuration" default "IDF_TARGET_NOT_SET" if IDF_TARGET_ENV="" default IDF_TARGET_ENV + config IDF_TARGET_ESP32 + bool + default "y" if IDF_TARGET="esp32" + default "n" + + config IDF_TARGET_ESP32S2BETA + bool + default "y" if IDF_TARGET="esp32s2beta" + default "n" + select FREERTOS_UNICORE + config IDF_FIRMWARE_CHIP_ID hex - default 0x0000 if IDF_TARGET="esp32" + default 0x0000 if IDF_TARGET_ESP32 + # note: S2 beta uses Chip ID 0 still, S2 will use 0x0002 + default 0x0000 if IDF_TARGET_ESP32S2BETA default 0xFFFF menu "SDK tool configuration" config SDK_TOOLPREFIX string "Compiler toolchain path/prefix" - default "xtensa-esp32-elf-" + default "xtensa-esp32-elf-" if IDF_TARGET_ESP32 + default "xtensa-esp32s2-elf-" if IDF_TARGET_ESP32S2BETA help The prefix/path that is used to call the toolchain. The default setting assumes a crosstool-ng gcc setup that is in your PATH. diff --git a/components/app_trace/app_trace_util.c b/components/app_trace/app_trace_util.c index 0558351b75..a23d906a2f 100644 --- a/components/app_trace/app_trace_util.c +++ b/components/app_trace/app_trace_util.c @@ -15,7 +15,12 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_app_trace_util.h" +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/clk.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/clk.h" +#endif /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////// TIMEOUT ///////////////////////////////////// diff --git a/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h b/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h index aee813a3b1..4d359ebad3 100644 --- a/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h +++ b/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h @@ -65,6 +65,8 @@ Revision: $Rev: 5927 $ #ifndef SEGGER_SYSVIEW_CONF_H #define SEGGER_SYSVIEW_CONF_H +#include "soc/soc.h" + /********************************************************************* * * Defines, fixed @@ -147,7 +149,7 @@ Revision: $Rev: 5927 $ * SystemView Id configuration */ //TODO: optimise it -#define SEGGER_SYSVIEW_ID_BASE 0x3F400000 // Default value for the lowest Id reported by the application. Can be overridden by the application via SEGGER_SYSVIEW_SetRAMBase(). (i.e. 0x20000000 when all Ids are an address in this RAM) +#define SEGGER_SYSVIEW_ID_BASE SOC_DROM_LOW // Default value for the lowest Id reported by the application. Can be overridden by the application via SEGGER_SYSVIEW_SetRAMBase(). (i.e. 0x20000000 when all Ids are an address in this RAM) #define SEGGER_SYSVIEW_ID_SHIFT 0 // Number of bits to shift the Id to save bandwidth. (i.e. 2 when Ids are 4 byte aligned) /********************************************************************* diff --git a/components/app_trace/sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c b/components/app_trace/sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c index b1e9fc14e1..9fe8c018ca 100644 --- a/components/app_trace/sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c +++ b/components/app_trace/sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c @@ -63,11 +63,19 @@ Revision: $Rev: 3734 $ */ #include "freertos/FreeRTOS.h" #include "SEGGER_SYSVIEW.h" -#include "esp32/rom/ets_sys.h" #include "esp_app_trace.h" #include "esp_app_trace_util.h" #include "esp_intr_alloc.h" +#include "soc/soc.h" +#include "soc/interrupts.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/ets_sys.h" #include "esp32/clk.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/clk.h" +#endif + extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI; @@ -81,7 +89,7 @@ extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI; #define SYSVIEW_APP_NAME "FreeRTOS Application" // The target device name -#define SYSVIEW_DEVICE_NAME "ESP32" +#define SYSVIEW_DEVICE_NAME CONFIG_IDF_TARGET // Determine which timer to use as timestamp source #if CONFIG_SYSVIEW_TS_SOURCE_CCOUNT @@ -123,14 +131,19 @@ extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI; #if TS_USE_CCOUNT // CCOUNT is incremented at CPU frequency +#if CONFIG_IDF_TARGET_ESP32 #define SYSVIEW_TIMESTAMP_FREQ (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000) +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define SYSVIEW_TIMESTAMP_FREQ (CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000) +#endif + #endif // TS_USE_CCOUNT // System Frequency. #define SYSVIEW_CPU_FREQ (esp_clk_cpu_freq()) // The lowest RAM address used for IDs (pointers) -#define SYSVIEW_RAM_BASE (0x3F400000) +#define SYSVIEW_RAM_BASE (SOC_DROM_LOW) #if CONFIG_FREERTOS_CORETIMER_0 #define SYSTICK_INTR_ID (ETS_INTERNAL_TIMER0_INTR_SOURCE+ETS_INTERNAL_INTR_SOURCE_OFF) @@ -147,78 +160,6 @@ extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI; static esp_apptrace_lock_t s_sys_view_lock = {.mux = portMUX_INITIALIZER_UNLOCKED, .int_state = 0}; -static const char * const s_isr_names[] = { - [0] = "WIFI_MAC", - [1] = "WIFI_NMI", - [2] = "WIFI_BB", - [3] = "BT_MAC", - [4] = "BT_BB", - [5] = "BT_BB_NMI", - [6] = "RWBT", - [7] = "RWBLE", - [8] = "RWBT_NMI", - [9] = "RWBLE_NMI", - [10] = "SLC0", - [11] = "SLC1", - [12] = "UHCI0", - [13] = "UHCI1", - [14] = "TG0_T0_LEVEL", - [15] = "TG0_T1_LEVEL", - [16] = "TG0_WDT_LEVEL", - [17] = "TG0_LACT_LEVEL", - [18] = "TG1_T0_LEVEL", - [19] = "TG1_T1_LEVEL", - [20] = "TG1_WDT_LEVEL", - [21] = "TG1_LACT_LEVEL", - [22] = "GPIO", - [23] = "GPIO_NMI", - [24] = "FROM_CPU0", - [25] = "FROM_CPU1", - [26] = "FROM_CPU2", - [27] = "FROM_CPU3", - [28] = "SPI0", - [29] = "SPI1", - [30] = "SPI2", - [31] = "SPI3", - [32] = "I2S0", - [33] = "I2S1", - [34] = "UART0", - [35] = "UART1", - [36] = "UART2", - [37] = "SDIO_HOST", - [38] = "ETH_MAC", - [39] = "PWM0", - [40] = "PWM1", - [41] = "PWM2", - [42] = "PWM3", - [43] = "LEDC", - [44] = "EFUSE", - [45] = "CAN", - [46] = "RTC_CORE", - [47] = "RMT", - [48] = "PCNT", - [49] = "I2C_EXT0", - [50] = "I2C_EXT1", - [51] = "RSA", - [52] = "SPI1_DMA", - [53] = "SPI2_DMA", - [54] = "SPI3_DMA", - [55] = "WDT", - [56] = "TIMER1", - [57] = "TIMER2", - [58] = "TG0_T0_EDGE", - [59] = "TG0_T1_EDGE", - [60] = "TG0_WDT_EDGE", - [61] = "TG0_LACT_EDGE", - [62] = "TG1_T0_EDGE", - [63] = "TG1_T1_EDGE", - [64] = "TG1_WDT_EDGE", - [65] = "TG1_LACT_EDGE", - [66] = "MMU_IA", - [67] = "MPU_IA", - [68] = "CACHE_IA", -}; - /********************************************************************* * * _cbSendSystemDesc() @@ -231,9 +172,9 @@ static void _cbSendSystemDesc(void) { SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",C=Xtensa,O=FreeRTOS"); snprintf(irq_str, sizeof(irq_str), "I#%d=SysTick", SYSTICK_INTR_ID); SEGGER_SYSVIEW_SendSysDesc(irq_str); - size_t isr_count = sizeof(s_isr_names)/sizeof(s_isr_names[0]); + size_t isr_count = sizeof(esp_isr_names)/sizeof(esp_isr_names[0]); for (size_t i = 0; i < isr_count; ++i) { - snprintf(irq_str, sizeof(irq_str), "I#%d=%s", ETS_INTERNAL_INTR_SOURCE_OFF + i, s_isr_names[i]); + snprintf(irq_str, sizeof(irq_str), "I#%d=%s", ETS_INTERNAL_INTR_SOURCE_OFF + i, esp_isr_names[i]); SEGGER_SYSVIEW_SendSysDesc(irq_str); } } diff --git a/components/app_update/test/CMakeLists.txt b/components/app_update/test/CMakeLists.txt index e56fd72838..2259c1ffe9 100644 --- a/components/app_update/test/CMakeLists.txt +++ b/components/app_update/test/CMakeLists.txt @@ -1,3 +1,5 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." - REQUIRES unity test_utils app_update bootloader_support nvs_flash) \ No newline at end of file +if(IDF_TARGET STREQUAL "esp32") + idf_component_register(SRC_DIRS "." + INCLUDE_DIRS "." + REQUIRES unity test_utils app_update bootloader_support nvs_flash) +endif() diff --git a/components/app_update/test/test_ota_ops.c b/components/app_update/test/test_ota_ops.c index e7773ac245..b1d168d046 100644 --- a/components/app_update/test/test_ota_ops.c +++ b/components/app_update/test/test_ota_ops.c @@ -58,7 +58,7 @@ TEST_CASE("esp_ota_get_next_update_partition logic", "[ota]") TEST_ASSERT_NOT_NULL(ota_1); TEST_ASSERT_NULL(ota_2); /* this partition shouldn't exist in test partition table */ - TEST_ASSERT_EQUAL_PTR(factory, running); /* this may not be true if/when we get OTA tests that do OTA updates */ + TEST_ASSERT_EQUAL_PTR(factory, running); /* this may not be true if/when we get OTA tests that do OTA updates */ /* (The test steps verify subtypes before verifying pointer equality, because the failure messages are more readable this way.) diff --git a/components/app_update/test/test_switch_ota.c b/components/app_update/test/test_switch_ota.c index 4b0907b41a..af87f6e7fb 100644 --- a/components/app_update/test/test_switch_ota.c +++ b/components/app_update/test/test_switch_ota.c @@ -7,9 +7,13 @@ #include "string.h" #include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/spi_flash.h" #include "esp32/rom/rtc.h" -#include "esp32/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/spi_flash.h" +#include "esp32s2beta/rom/rtc.h" +#endif #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/bootloader/Kconfig.projbuild b/components/bootloader/Kconfig.projbuild index c46a310776..9c8b9ae6b6 100644 --- a/components/bootloader/Kconfig.projbuild +++ b/components/bootloader/Kconfig.projbuild @@ -204,10 +204,13 @@ menu "Bootloader config" config BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD int "Size of the efuse secure version field" depends on BOOTLOADER_APP_ANTI_ROLLBACK - range 1 32 - default 32 + range 1 32 if IDF_TARGET_ESP32 + default 32 if IDF_TARGET_ESP32 + range 1 16 if IDF_TARGET_ESP32S2BETA + default 16 if IDF_TARGET_ESP32S2BETA help - The size of the efuse secure version field. Its length is limited to 32 bits. + The size of the efuse secure version field. + Its length is limited to 32 bits for ESP32 and 16 bits for ESP32S2BETA. This determines how many times the security version can be increased. config BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE @@ -462,6 +465,26 @@ menu "Security features" Read https://docs.espressif.com/projects/esp-idf/en/latest/security/flash-encryption.html before enabling. + choice SECURE_FLASH_ENCRYPTION_KEYSIZE + bool "Size of generated AES-XTS key" + default SECURE_FLASH_ENCRYPTION_AES128 + depends on IDF_TARGET_ESP32S2BETA && SECURE_FLASH_ENC_ENABLED + help + Size of generated AES-XTS key. + + AES-128 uses a 256-bit key (32 bytes) which occupies one Efuse key block. + AES-256 uses a 512-bit key (64 bytes) which occupies two Efuse key blocks. + + This setting is ignored if either type of key is already burned to Efuse before the first boot. + In this case, the pre-burned key is used and no new key is generated. + + config SECURE_FLASH_ENCRYPTION_AES128 + bool "AES-128 (256-bit key)" + + config SECURE_FLASH_ENCRYPTION_AES256 + bool "AES-256 (512-bit key)" + endchoice + choice SECURE_FLASH_ENCRYPTION_MODE bool "Enable usage mode" depends on SECURE_FLASH_ENC_ENABLED diff --git a/components/bootloader/subproject/main/CMakeLists.txt b/components/bootloader/subproject/main/CMakeLists.txt index d73d46debc..82760cad09 100644 --- a/components/bootloader/subproject/main/CMakeLists.txt +++ b/components/bootloader/subproject/main/CMakeLists.txt @@ -2,7 +2,8 @@ idf_component_register(SRCS "bootloader_start.c" REQUIRES bootloader bootloader_support) idf_build_get_property(target IDF_TARGET) -set(scripts "${target}.bootloader.ld" - "${target}.bootloader.rom.ld") +set(scripts "ld/${target}/bootloader.ld" + "ld/${target}/bootloader.rom.ld") + +target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}") -target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}") \ No newline at end of file diff --git a/components/bootloader/subproject/main/bootloader_start.c b/components/bootloader/subproject/main/bootloader_start.c index 4cc1f38f1e..ac679002db 100644 --- a/components/bootloader/subproject/main/bootloader_start.c +++ b/components/bootloader/subproject/main/bootloader_start.c @@ -14,19 +14,24 @@ #include #include #include - #include "esp_log.h" -#include "esp32/rom/gpio.h" -#include "esp32/rom/spi_flash.h" #include "bootloader_config.h" #include "bootloader_init.h" #include "bootloader_utility.h" #include "bootloader_common.h" #include "sdkconfig.h" #include "esp_image_format.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/gpio.h" #include "esp32/rom/rtc.h" +#include "esp32/rom/spi_flash.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/gpio.h" +#include "esp32s2beta/rom/rtc.h" +#include "esp32s2beta/rom/spi_flash.h" +#endif -static const char* TAG = "boot"; +static const char *TAG = "boot"; static int select_partition_number (bootloader_state_t *bs); static int selected_boot_partition(const bootloader_state_t *bs); @@ -101,7 +106,7 @@ static int selected_boot_partition(const bootloader_state_t *bs) return bootloader_utility_get_selected_boot_partition(bs); } #endif - // TEST firmware. + // TEST firmware. #ifdef CONFIG_BOOTLOADER_APP_TEST if (bootloader_common_check_long_hold_gpio(CONFIG_BOOTLOADER_NUM_PIN_APP_TEST, CONFIG_BOOTLOADER_HOLD_TIME_GPIO) == 1) { ESP_LOGI(TAG, "Detect a boot condition of the test firmware"); diff --git a/components/bootloader/subproject/main/component.mk b/components/bootloader/subproject/main/component.mk index c74985132f..535b78e6aa 100644 --- a/components/bootloader/subproject/main/component.mk +++ b/components/bootloader/subproject/main/component.mk @@ -6,14 +6,17 @@ # LINKER_SCRIPTS := \ - $(IDF_TARGET).bootloader.ld \ - $(IDF_TARGET).bootloader.rom.ld \ + $(COMPONENT_PATH)/ld/$(IDF_TARGET)/bootloader.ld \ + $(COMPONENT_PATH)/ld/$(IDF_TARGET)/bootloader.rom.ld \ $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.ld \ $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.newlib-funcs.ld \ $(IDF_PATH)/components/$(IDF_TARGET)/ld/$(IDF_TARGET).peripherals.ld -ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH -LINKER_SCRIPTS += $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.spiflash.ld +# SPI driver patch for ROM is only needed in ESP32 +ifdef CONFIG_IDF_TARGET_ESP32 + ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH + LINKER_SCRIPTS += $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.spiflash.ld + endif endif COMPONENT_ADD_LDFLAGS += -L $(COMPONENT_PATH) $(addprefix -T ,$(LINKER_SCRIPTS)) diff --git a/components/bootloader/subproject/main/esp32.bootloader.ld b/components/bootloader/subproject/main/ld/esp32/bootloader.ld similarity index 100% rename from components/bootloader/subproject/main/esp32.bootloader.ld rename to components/bootloader/subproject/main/ld/esp32/bootloader.ld diff --git a/components/bootloader/subproject/main/esp32.bootloader.rom.ld b/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld similarity index 100% rename from components/bootloader/subproject/main/esp32.bootloader.rom.ld rename to components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld diff --git a/components/bootloader/subproject/main/ld/esp32s2beta/bootloader.ld b/components/bootloader/subproject/main/ld/esp32s2beta/bootloader.ld new file mode 100644 index 0000000000..e72ab776d5 --- /dev/null +++ b/components/bootloader/subproject/main/ld/esp32s2beta/bootloader.ld @@ -0,0 +1,162 @@ +/* +Linker file used to link the bootloader. +*/ + + +/* Simplified memory map for the bootloader + + The main purpose is to make sure the bootloader can load into main memory + without overwriting itself. +*/ + +MEMORY +{ + /* I/O */ + dport0_seg (RW) : org = 0x3FF00000, len = 0x10 + iram_loader_seg (RWX) : org = 0x40062000, len = 0x4000 /* 16KB, IRAM */ + iram_seg (RWX) : org = 0x40066000, len = 0x4000 /* 16KB, IRAM */ + /* 8k at the end of DRAM, before ROM data & stack */ + dram_seg (RW) : org = 0x3FFFA000, len = 0x2000 +} + +/* Default entry point: */ +ENTRY(call_start_cpu0); + + +SECTIONS +{ + + .iram_loader.text : + { + . = ALIGN (16); + _loader_text_start = ABSOLUTE(.); + *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */ + *liblog.a:(.literal .text .literal.* .text.*) + *libgcc.a:(.literal .text .literal.* .text.*) + *libbootloader_support.a:bootloader_common.*(.literal .text .literal.* .text.*) + *libbootloader_support.a:bootloader_flash.*(.literal .text .literal.* .text.*) + *libbootloader_support.a:bootloader_random.*(.literal .text .literal.* .text.*) + *libbootloader_support.a:bootloader_utility.*(.literal .text .literal.* .text.*) + *libbootloader_support.a:bootloader_sha.*(.literal .text .literal.* .text.*) + *libbootloader_support.a:esp_image_format.*(.literal .text .literal.* .text.*) + *libbootloader_support.a:flash_encrypt.*(.literal .text .literal.* .text.*) + *libbootloader_support.a:flash_partitions.*(.literal .text .literal.* .text.*) + *libbootloader_support.a:secure_boot.*(.literal .text .literal.* .text.*) + *libbootloader_support.a:secure_boot_signatures.*(.literal .text .literal.* .text.*) + *libmicro-ecc.a:*.*(.literal .text .literal.* .text.*) + *libspi_flash.a:*.*(.literal .text .literal.* .text.*) + *libsoc.a:rtc_wdt.*(.literal .text .literal.* .text.*) + *libefuse.a:*.*(.literal .text .literal.* .text.*) + *(.fini.literal) + *(.fini) + *(.gnu.version) + _loader_text_end = ABSOLUTE(.); + } > iram_loader_seg + + .iram.text : + { + . = ALIGN (16); + *(.entry.text) + *(.init.literal) + *(.init) + } > iram_seg + + + /* Shared RAM */ + .dram0.bss (NOLOAD) : + { + . = ALIGN (8); + _bss_start = ABSOLUTE(.); + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + *(.dynbss) + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN (8); + _bss_end = ABSOLUTE(.); + } >dram_seg + + .dram0.data : + { + _data_start = ABSOLUTE(.); + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + *(.data1) + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + *(.jcr) + _data_end = ABSOLUTE(.); + } >dram_seg + + .dram0.rodata : + { + _rodata_start = ABSOLUTE(.); + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + *(.rodata1) + __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); + *(.xt_except_table) + *(.gcc_except_table) + *(.gnu.linkonce.e.*) + *(.gnu.version_r) + *(.eh_frame) + . = (. + 3) & ~ 3; + /* C++ constructor and destructor tables, properly ordered: */ + __init_array_start = ABSOLUTE(.); + KEEP (*crtbegin.*(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + __init_array_end = ABSOLUTE(.); + KEEP (*crtbegin.*(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + /* C++ exception handlers table: */ + __XT_EXCEPTION_DESCS_ = ABSOLUTE(.); + *(.xt_except_desc) + *(.gnu.linkonce.h.*) + __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); + *(.xt_except_desc_end) + *(.dynamic) + *(.gnu.version_d) + _rodata_end = ABSOLUTE(.); + /* Literals are also RO data. */ + _lit4_start = ABSOLUTE(.); + *(*.lit4) + *(.lit4.*) + *(.gnu.linkonce.lit4.*) + _lit4_end = ABSOLUTE(.); + . = ALIGN(4); + _heap_start = ABSOLUTE(.); + } >dram_seg + + .iram.text : + { + _stext = .; + _text_start = ABSOLUTE(.); + *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.iram .iram.*) /* catch stray IRAM_ATTR */ + *(.fini.literal) + *(.fini) + *(.gnu.version) + _text_end = ABSOLUTE(.); + _etext = .; + } > iram_seg + +} diff --git a/components/bootloader/subproject/main/ld/esp32s2beta/bootloader.rom.ld b/components/bootloader/subproject/main/ld/esp32s2beta/bootloader.rom.ld new file mode 100644 index 0000000000..6a9e880fe3 --- /dev/null +++ b/components/bootloader/subproject/main/ld/esp32s2beta/bootloader.rom.ld @@ -0,0 +1,14 @@ +/* + * ESP32S2 ROM address table + * Generated for ROM with MD5sum: f054d40c5f6b9207d3827460a6f5748c +*/ +PROVIDE ( ets_update_cpu_frequency = 0x4000d954 ); + +/* ToDo: Following address may need modification */ +PROVIDE ( MD5Final = 0x400056e8 ); +PROVIDE ( MD5Init = 0x40005648 ); +PROVIDE ( MD5Update = 0x40005668 ); +/* bootloader will use following functions from xtensa hal library */ +xthal_get_ccount = 0x40015cbc; +xthal_get_ccompare = 0x40015ce8; +xthal_set_ccompare = 0x40015cc4; diff --git a/components/bootloader_support/CMakeLists.txt b/components/bootloader_support/CMakeLists.txt index 038a2aec07..311dad0e24 100644 --- a/components/bootloader_support/CMakeLists.txt +++ b/components/bootloader_support/CMakeLists.txt @@ -1,35 +1,44 @@ -set(srcs +set(srcs "src/bootloader_clock.c" "src/bootloader_common.c" "src/bootloader_flash.c" - "src/bootloader_flash_config.c" "src/bootloader_random.c" "src/bootloader_utility.c" "src/esp_image_format.c" - "src/flash_encrypt.c" "src/flash_partitions.c" - "src/flash_qio_mode.c") + "src/flash_qio_mode.c" + "src/bootloader_flash_config_${IDF_TARGET}.c" + "src/bootloader_efuse_${IDF_TARGET}.c" + ) + +if(IDF_TARGET STREQUAL "esp32") + # Not supported on ESP32S2Beta yet + list(APPEND srcs "src/flash_encrypt.c") +endif() if(BOOTLOADER_BUILD) set(include_dirs "include" "include_bootloader") - set(requires soc) #unfortunately the header directly uses SOC registers - set(priv_requires micro-ecc spi_flash efuse) - list(APPEND srcs + # freertos is included just for the CONFIG_FREERTOS_UNICORE macro + set(priv_requires micro-ecc spi_flash efuse freertos) + list(APPEND srcs "src/bootloader_init.c" "src/${IDF_TARGET}/bootloader_sha.c" "src/${IDF_TARGET}/flash_encrypt.c" "src/${IDF_TARGET}/secure_boot_signatures.c" - "src/${IDF_TARGET}/secure_boot.c") + "src/${IDF_TARGET}/secure_boot.c" + "src/${IDF_TARGET}/bootloader_${IDF_TARGET}.c" + ) else() - list(APPEND srcs + list(APPEND srcs "src/idf/bootloader_sha.c" "src/idf/secure_boot_signatures.c") set(include_dirs "include") set(priv_include_dirs "include_bootloader") - set(requires soc) #unfortunately the header directly uses SOC registers set(priv_requires spi_flash mbedtls efuse) endif() +set(requires soc) #unfortunately the header directly uses SOC registers + idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "${include_dirs}" PRIV_INCLUDE_DIRS "${priv_include_dirs}" diff --git a/components/bootloader_support/component.mk b/components/bootloader_support/component.mk index 202e357698..18c560abd7 100644 --- a/components/bootloader_support/component.mk +++ b/components/bootloader_support/component.mk @@ -19,6 +19,9 @@ ifndef IS_BOOTLOADER_BUILD COMPONENT_OBJEXCLUDE := src/bootloader_init.o endif +COMPONENT_OBJEXCLUDE += src/bootloader_flash_config_esp32s2beta.o \ + src/bootloader_efuse_esp32s2beta.o + # # Secure boot signing key support # @@ -46,10 +49,10 @@ $(ORIG_SECURE_BOOT_VERIFICATION_KEY): $(SECURE_BOOT_VERIFICATION_KEY): $(ORIG_SECURE_BOOT_VERIFICATION_KEY) $(SDKCONFIG_MAKEFILE) $(summary) CP $< $@ cp $< $@ -endif +endif #CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES COMPONENT_EXTRA_CLEAN += $(SECURE_BOOT_VERIFICATION_KEY) COMPONENT_EMBED_FILES := $(SECURE_BOOT_VERIFICATION_KEY) -endif +endif #CONFIG_SECURE_SIGNED_APPS diff --git a/components/bootloader_support/include/bootloader_clock.h b/components/bootloader_support/include/bootloader_clock.h index b07d7c9822..da3bc9e646 100644 --- a/components/bootloader_support/include/bootloader_clock.h +++ b/components/bootloader_support/include/bootloader_clock.h @@ -24,6 +24,11 @@ extern "C" { */ void bootloader_clock_configure(void); +/** @brief Return the rated maximum frequency of this chip + */ +int bootloader_clock_get_rated_freq_mhz(void); + #ifdef __cplusplus } #endif + diff --git a/components/bootloader_support/include/bootloader_common.h b/components/bootloader_support/include/bootloader_common.h index cb1f4acdc6..7ed874ad31 100644 --- a/components/bootloader_support/include/bootloader_common.h +++ b/components/bootloader_support/include/bootloader_common.h @@ -88,6 +88,13 @@ bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_dat */ bool bootloader_common_label_search(const char *list, char *label); +/** + * @brief Configure default SPI pin modes and drive strengths + * + * @param drv GPIO drive level (determined by clock frequency) + */ +void bootloader_configure_spi_pins(int drv); + /** * @brief Calculates a sha-256 for a given partition or returns a appended digest. * diff --git a/components/bootloader_support/include/esp_flash_encrypt.h b/components/bootloader_support/include/esp_flash_encrypt.h index acfbf5d1cf..10a0b71356 100644 --- a/components/bootloader_support/include/esp_flash_encrypt.h +++ b/components/bootloader_support/include/esp_flash_encrypt.h @@ -20,6 +20,7 @@ #include "esp_spi_flash.h" #endif #include "soc/efuse_periph.h" +#include "sdkconfig.h" #ifdef __cplusplus extern "C" { @@ -46,11 +47,17 @@ typedef enum { * * @return true if flash encryption is enabled. */ -static inline /** @cond */ IRAM_ATTR /** @endcond */ bool esp_flash_encryption_enabled(void) { - uint32_t flash_crypt_cnt = REG_GET_FIELD(EFUSE_BLK0_RDATA0_REG, EFUSE_RD_FLASH_CRYPT_CNT); +static inline /** @cond */ IRAM_ATTR /** @endcond */ bool esp_flash_encryption_enabled(void) +{ + uint32_t flash_crypt_cnt; +#if CONFIG_IDF_TARGET_ESP32 + flash_crypt_cnt = REG_GET_FIELD(EFUSE_BLK0_RDATA0_REG, EFUSE_RD_FLASH_CRYPT_CNT); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + flash_crypt_cnt = REG_GET_FIELD(EFUSE_RD_REPEAT_DATA1_REG, EFUSE_SPI_BOOT_CRYPT_CNT); +#endif /* __builtin_parity is in flash, so we calculate parity inline */ bool enabled = false; - while(flash_crypt_cnt) { + while (flash_crypt_cnt) { if (flash_crypt_cnt & 1) { enabled = !enabled; } diff --git a/components/bootloader_support/include/esp_secure_boot.h b/components/bootloader_support/include/esp_secure_boot.h index 2a7c22750b..c7c8583350 100644 --- a/components/bootloader_support/include/esp_secure_boot.h +++ b/components/bootloader_support/include/esp_secure_boot.h @@ -18,6 +18,9 @@ #include "soc/efuse_periph.h" #include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/efuse.h" +#endif #ifdef CONFIG_SECURE_BOOT_ENABLED #if !defined(CONFIG_SECURE_SIGNED_ON_BOOT) || !defined(CONFIG_SECURE_SIGNED_ON_UPDATE) || !defined(CONFIG_SECURE_SIGNED_APPS) @@ -36,14 +39,18 @@ extern "C" { /** @brief Is secure boot currently enabled in hardware? * - * Secure boot is enabled if the ABS_DONE_0 efuse is blown. This means - * that the ROM bootloader code will only boot a verified secure - * bootloader digest from now on. + * This means that the ROM bootloader code will only boot + * a verified secure bootloader from now on. * * @return true if secure boot is enabled. */ -static inline bool esp_secure_boot_enabled(void) { +static inline bool esp_secure_boot_enabled(void) +{ +#if CONFIG_IDF_TARGET_ESP32 return REG_READ(EFUSE_BLK0_RDATA6_REG) & EFUSE_RD_ABS_DONE_0; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + return ets_efuse_secure_boot_enabled(); +#endif } /** @brief Generate secure digest from bootloader image diff --git a/components/bootloader_support/include_bootloader/bootloader_utility.h b/components/bootloader_support/include_bootloader/bootloader_utility.h index 4f31f5acbc..d505e17e71 100644 --- a/components/bootloader_support/include_bootloader/bootloader_utility.h +++ b/components/bootloader_support/include_bootloader/bootloader_utility.h @@ -15,6 +15,7 @@ #include "bootloader_config.h" #include "esp_image_format.h" +#include "bootloader_config.h" /** * @brief Load partition table. @@ -96,3 +97,14 @@ __attribute__((noreturn)) void bootloader_reset(void); * ESP_ERR_INVALID_ARG: Error in the passed arguments */ esp_err_t bootloader_sha256_hex_to_str(char *out_str, const uint8_t *in_array_hex, size_t len); + +/** + * @brief Debug log contents of a buffer as hexadecimal + * + * @note Only works if component log level is DEBUG or higher. + * + * @param buffer Buffer to log + * @param length Length of buffer in bytes. Maximum length 128 bytes. + * @param label Label to print at beginning of log line. + */ +void bootloader_debug_buffer(const void *buffer, size_t length, const char *label); diff --git a/components/bootloader_support/src/bootloader_clock.c b/components/bootloader_support/src/bootloader_clock.c index a40cb0688f..4e21256ae3 100644 --- a/components/bootloader_support/src/bootloader_clock.c +++ b/components/bootloader_support/src/bootloader_clock.c @@ -11,13 +11,20 @@ // 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. -#include "esp32/rom/uart.h" -#include "esp32/rom/rtc.h" +#include "sdkconfig.h" #include "soc/soc.h" #include "soc/rtc.h" #include "soc/dport_reg.h" #include "soc/efuse_periph.h" +#ifdef CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/uart.h" +#include "esp32/rom/rtc.h" +#else +#include "esp32s2beta/rom/uart.h" +#include "esp32s2beta/rom/rtc.h" +#endif + void bootloader_clock_configure(void) { // ROM bootloader may have put a lot of text into UART0 FIFO. @@ -27,23 +34,30 @@ void bootloader_clock_configure(void) // and will be done with the bootloader much earlier than UART FIFO is empty. uart_tx_wait_idle(0); - /* Set CPU to 80MHz. Keep other clocks unmodified. */ - int cpu_freq_mhz = 80; - /* On ESP32 rev 0, switching to 80/160 MHz if clock was previously set to * 240 MHz may cause the chip to lock up (see section 3.5 of the errata * document). For rev. 0, switch to 240 instead if it has been enabled * previously. */ +#if CONFIG_IDF_TARGET_ESP32 + /* Set CPU to 80MHz. Keep other clocks unmodified. */ + int cpu_freq_mhz = 80; + uint32_t chip_ver_reg = REG_READ(EFUSE_BLK0_RDATA3_REG); if ((chip_ver_reg & EFUSE_RD_CHIP_VER_REV1_M) == 0 && DPORT_REG_GET_FIELD(DPORT_CPU_PER_CONF_REG, DPORT_CPUPERIOD_SEL) == DPORT_CPUPERIOD_SEL_240) { cpu_freq_mhz = 240; } +#endif rtc_clk_config_t clk_cfg = RTC_CLK_CONFIG_DEFAULT(); +#if CONFIG_IDF_TARGET_ESP32 clk_cfg.xtal_freq = CONFIG_ESP32_XTAL_FREQ; clk_cfg.cpu_freq_mhz = cpu_freq_mhz; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + clk_cfg.xtal_freq = CONFIG_ESP32S2_XTAL_FREQ; + clk_cfg.cpu_freq = RTC_CPU_FREQ_80M; +#endif clk_cfg.slow_freq = rtc_clk_slow_freq_get(); clk_cfg.fast_freq = rtc_clk_fast_freq_get(); rtc_clk_init(clk_cfg); diff --git a/components/bootloader_support/src/bootloader_common.c b/components/bootloader_support/src/bootloader_common.c index ab3d12c023..a6eec3cfc0 100644 --- a/components/bootloader_support/src/bootloader_common.c +++ b/components/bootloader_support/src/bootloader_common.c @@ -17,16 +17,22 @@ #include "sdkconfig.h" #include "esp_err.h" #include "esp_log.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/spi_flash.h" #include "esp32/rom/crc.h" #include "esp32/rom/gpio.h" -#include "esp_secure_boot.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/spi_flash.h" +#include "esp32s2beta/rom/crc.h" +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/gpio.h" +#endif #include "esp_flash_partitions.h" #include "bootloader_flash.h" #include "bootloader_common.h" #include "soc/gpio_periph.h" #include "soc/rtc.h" #include "soc/efuse_reg.h" -#include "soc/apb_ctrl_reg.h" #include "esp_image_format.h" #include "bootloader_sha.h" #include "sys/param.h" @@ -273,35 +279,6 @@ void bootloader_common_vddsdio_configure(void) #endif // CONFIG_BOOTLOADER_VDDSDIO_BOOST } -#ifdef CONFIG_IDF_TARGET_ESP32 -uint8_t bootloader_common_get_chip_revision(void) -{ - uint8_t eco_bit0, eco_bit1, eco_bit2; - eco_bit0 = (REG_READ(EFUSE_BLK0_RDATA3_REG) & 0xF000) >> 15; - eco_bit1 = (REG_READ(EFUSE_BLK0_RDATA5_REG) & 0x100000) >> 20; - eco_bit2 = (REG_READ(APB_CTRL_DATE_REG) & 0x80000000) >> 31; - uint32_t combine_value = (eco_bit2 << 2) | (eco_bit1 << 1) | eco_bit0; - uint8_t chip_ver = 0; - switch (combine_value) { - case 0: - chip_ver = 0; - break; - case 1: - chip_ver = 1; - break; - case 3: - chip_ver = 2; - break; - case 7: - chip_ver = 3; - break; - default: - chip_ver = 0; - break; - } - return chip_ver; -} -#endif esp_err_t bootloader_common_check_chip_validity(const esp_image_header_t* img_hdr, esp_image_type type) { diff --git a/components/bootloader_support/src/bootloader_efuse_esp32.c b/components/bootloader_support/src/bootloader_efuse_esp32.c new file mode 100644 index 0000000000..35f8e9f88b --- /dev/null +++ b/components/bootloader_support/src/bootloader_efuse_esp32.c @@ -0,0 +1,56 @@ +// Copyright 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. + +#include "bootloader_common.h" +#include "bootloader_clock.h" +#include "soc/efuse_reg.h" +#include "soc/apb_ctrl_reg.h" + +uint8_t bootloader_common_get_chip_revision(void) +{ + uint8_t eco_bit0, eco_bit1, eco_bit2; + eco_bit0 = (REG_READ(EFUSE_BLK0_RDATA3_REG) & 0xF000) >> 15; + eco_bit1 = (REG_READ(EFUSE_BLK0_RDATA5_REG) & 0x100000) >> 20; + eco_bit2 = (REG_READ(APB_CTRL_DATE_REG) & 0x80000000) >> 31; + uint32_t combine_value = (eco_bit2 << 2) | (eco_bit1 << 1) | eco_bit0; + uint8_t chip_ver = 0; + switch (combine_value) { + case 0: + chip_ver = 0; + break; + case 1: + chip_ver = 1; + break; + case 3: + chip_ver = 2; + break; + case 7: + chip_ver = 3; + break; + default: + chip_ver = 0; + break; + } + return chip_ver; +} + +int bootloader_clock_get_rated_freq_mhz() +{ + //Check if ESP32 is rated for a CPU frequency of 160MHz only + if (REG_GET_BIT(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_CPU_FREQ_RATED) && + REG_GET_BIT(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_CPU_FREQ_LOW)) { + return 160; + } + return 240; +} diff --git a/components/bootloader_support/src/bootloader_efuse_esp32s2beta.c b/components/bootloader_support/src/bootloader_efuse_esp32s2beta.c new file mode 100644 index 0000000000..b762d2c4f8 --- /dev/null +++ b/components/bootloader_support/src/bootloader_efuse_esp32s2beta.c @@ -0,0 +1,29 @@ +// Copyright 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. + +#include "sdkconfig.h" +#include "bootloader_clock.h" +#include "bootloader_common.h" + +int bootloader_clock_get_rated_freq_mhz() +{ + /* No known limitation: all chips are 240MHz rated */ + return 240; +} + +uint8_t bootloader_common_get_chip_revision(void) +{ + /* No other revisions for ESP32-S2beta */ + return 0; +} diff --git a/components/bootloader_support/src/bootloader_flash.c b/components/bootloader_support/src/bootloader_flash.c index 09ed73deba..96121c8230 100644 --- a/components/bootloader_support/src/bootloader_flash.c +++ b/components/bootloader_support/src/bootloader_flash.c @@ -17,6 +17,9 @@ #include #include /* including in bootloader for error values */ #include +#if CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/spi_flash.h" +#endif #ifndef BOOTLOADER_BUILD /* Normal app version maps to esp_spi_flash.h operations... @@ -37,7 +40,7 @@ const void *bootloader_mmap(uint32_t src_addr, uint32_t size) return NULL; /* existing mapping in use... */ } const void *result = NULL; - uint32_t src_page = src_addr & ~(SPI_FLASH_MMU_PAGE_SIZE-1); + uint32_t src_page = src_addr & ~(SPI_FLASH_MMU_PAGE_SIZE - 1); size += (src_addr - src_page); esp_err_t err = spi_flash_mmap(src_page, size, SPI_FLASH_MMAP_DATA, &result, &map); if (err != ESP_OK) { @@ -49,7 +52,7 @@ const void *bootloader_mmap(uint32_t src_addr, uint32_t size) void bootloader_munmap(const void *mapping) { - if(mapping && map) { + if (mapping && map) { spi_flash_munmap(map); } map = 0; @@ -67,7 +70,11 @@ esp_err_t bootloader_flash_read(size_t src, void *dest, size_t size, bool allow_ esp_err_t bootloader_flash_write(size_t dest_addr, void *src, size_t size, bool write_encrypted) { if (write_encrypted) { +#if CONFIG_IDF_TARGET_ESP32 return spi_flash_write_encrypted(dest_addr, src, size); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + return SPI_Encrypt_Write(dest_addr, src, size); +#endif } else { return spi_flash_write(dest_addr, src, size); } @@ -86,18 +93,35 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size) #else /* Bootloader version, uses ROM functions only */ #include +#if CONFIG_IDF_TARGET_ESP32 #include #include - +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include +#include +#endif static const char *TAG = "bootloader_flash"; +#if CONFIG_IDF_TARGET_ESP32 /* Use first 50 blocks in MMU for bootloader_mmap, 50th block for bootloader_flash_read */ -#define MMU_BLOCK0_VADDR 0x3f400000 -#define MMU_BLOCK50_VADDR 0x3f720000 -#define MMU_FREE_PAGES ((MMU_BLOCK50_VADDR - MMU_BLOCK0_VADDR) / FLASH_BLOCK_SIZE) +#define MMU_BLOCK0_VADDR SOC_DROM_LOW +#define MMU_SIZE (0x320000) +#define MMU_BLOCK50_VADDR (MMU_BLOCK0_VADDR + MMU_SIZE) +#define FLASH_READ_VADDR MMU_BLOCK50_VADDR +#elif CONFIG_IDF_TARGET_ESP32S2BETA +/* Use first 63 blocks in MMU for bootloader_mmap, + 63th block for bootloader_flash_read +*/ +#define MMU_BLOCK0_VADDR SOC_DROM_LOW +#define MMU_SIZE (0x3f0000) +#define MMU_BLOCK63_VADDR (MMU_BLOCK0_VADDR + MMU_SIZE) +#define FLASH_READ_VADDR MMU_BLOCK63_VADDR +#endif +#define MMU_FREE_PAGES (MMU_SIZE / FLASH_BLOCK_SIZE) + static bool mapped; // Current bootloader mapping (ab)used for bootloader_read() @@ -118,25 +142,41 @@ const void *bootloader_mmap(uint32_t src_addr, uint32_t size) ESP_LOGE(TAG, "tried to bootloader_mmap twice"); return NULL; /* can't map twice */ } - if (size > 0x320000) { - /* Allow mapping up to 50 of the 51 available MMU blocks (last one used for reads) */ + if (size > MMU_SIZE) { ESP_LOGE(TAG, "bootloader_mmap excess size %x", size); return NULL; } uint32_t src_addr_aligned = src_addr & MMU_FLASH_MASK; uint32_t count = bootloader_cache_pages_to_map(size, src_addr); +#if CONFIG_IDF_TARGET_ESP32 Cache_Read_Disable(0); Cache_Flush(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + uint32_t autoload = Cache_Suspend_ICache(); + Cache_Invalidate_ICache_All(); +#endif ESP_LOGD(TAG, "mmu set paddr=%08x count=%d size=%x src_addr=%x src_addr_aligned=%x", - src_addr & MMU_FLASH_MASK, count, size, src_addr, src_addr_aligned ); + src_addr & MMU_FLASH_MASK, count, size, src_addr, src_addr_aligned ); +#if CONFIG_IDF_TARGET_ESP32 int e = cache_flash_mmu_set(0, 0, MMU_BLOCK0_VADDR, src_addr_aligned, 64, count); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + int e = Cache_Ibus_MMU_Set(DPORT_MMU_ACCESS_FLASH, MMU_BLOCK0_VADDR, src_addr_aligned, 64, count, 0); +#endif if (e != 0) { ESP_LOGE(TAG, "cache_flash_mmu_set failed: %d\n", e); +#if CONFIG_IDF_TARGET_ESP32 Cache_Read_Enable(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + Cache_Resume_ICache(autoload); +#endif return NULL; } +#if CONFIG_IDF_TARGET_ESP32 Cache_Read_Enable(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + Cache_Resume_ICache(autoload); +#endif mapped = true; @@ -146,10 +186,17 @@ const void *bootloader_mmap(uint32_t src_addr, uint32_t size) void bootloader_munmap(const void *mapping) { if (mapped) { +#if CONFIG_IDF_TARGET_ESP32 /* Full MMU reset */ Cache_Read_Disable(0); Cache_Flush(0); mmu_init(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + //TODO, save the autoload value. + Cache_Suspend_ICache(); + Cache_Invalidate_ICache_All(); + Cache_MMU_Init(); +#endif mapped = false; current_read_mapping = UINT32_MAX; } @@ -157,7 +204,7 @@ void bootloader_munmap(const void *mapping) static esp_err_t spi_to_esp_err(esp_rom_spiflash_result_t r) { - switch(r) { + switch (r) { case ESP_ROM_SPIFLASH_RESULT_OK: return ESP_OK; case ESP_ROM_SPIFLASH_RESULT_ERR: @@ -171,10 +218,18 @@ static esp_err_t spi_to_esp_err(esp_rom_spiflash_result_t r) static esp_err_t bootloader_flash_read_no_decrypt(size_t src_addr, void *dest, size_t size) { +#if CONFIG_IDF_TARGET_ESP32 Cache_Read_Disable(0); Cache_Flush(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + uint32_t autoload = Cache_Suspend_ICache(); +#endif esp_rom_spiflash_result_t r = esp_rom_spiflash_read(src_addr, dest, size); +#if CONFIG_IDF_TARGET_ESP32 Cache_Read_Enable(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + Cache_Resume_ICache(autoload); +#endif return spi_to_esp_err(r); } @@ -183,28 +238,42 @@ static esp_err_t bootloader_flash_read_allow_decrypt(size_t src_addr, void *dest { uint32_t *dest_words = (uint32_t *)dest; - /* Use the 51st MMU mapping to read from flash in 64KB blocks. - (MMU will transparently decrypt if encryption is enabled.) - */ for (int word = 0; word < size / 4; word++) { uint32_t word_src = src_addr + word * 4; /* Read this offset from flash */ uint32_t map_at = word_src & MMU_FLASH_MASK; /* Map this 64KB block from flash */ uint32_t *map_ptr; if (map_at != current_read_mapping) { /* Move the 64KB mmu mapping window to fit map_at */ +#if CONFIG_IDF_TARGET_ESP32 Cache_Read_Disable(0); Cache_Flush(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + uint32_t autoload = Cache_Suspend_ICache(); + Cache_Invalidate_ICache_All(); +#endif ESP_LOGD(TAG, "mmu set block paddr=0x%08x (was 0x%08x)", map_at, current_read_mapping); - int e = cache_flash_mmu_set(0, 0, MMU_BLOCK50_VADDR, map_at, 64, 1); +#if CONFIG_IDF_TARGET_ESP32 + int e = cache_flash_mmu_set(0, 0, FLASH_READ_VADDR, map_at, 64, 1); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + int e = Cache_Ibus_MMU_Set(DPORT_MMU_ACCESS_FLASH, FLASH_READ_VADDR, map_at, 64, 1, 0); +#endif if (e != 0) { ESP_LOGE(TAG, "cache_flash_mmu_set failed: %d\n", e); +#if CONFIG_IDF_TARGET_ESP32 Cache_Read_Enable(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + Cache_Resume_ICache(autoload); +#endif return ESP_FAIL; } current_read_mapping = map_at; +#if CONFIG_IDF_TARGET_ESP32 Cache_Read_Enable(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + Cache_Resume_ICache(autoload); +#endif } - map_ptr = (uint32_t *)(MMU_BLOCK50_VADDR + (word_src - map_at)); + map_ptr = (uint32_t *)(FLASH_READ_VADDR + (word_src - map_at)); dest_words[word] = *map_ptr; } return ESP_OK; @@ -255,7 +324,12 @@ esp_err_t bootloader_flash_write(size_t dest_addr, void *src, size_t size, bool } if (write_encrypted) { +#if CONFIG_IDF_TARGET_ESP32 return spi_to_esp_err(esp_rom_spiflash_write_encrypted(dest_addr, src, size)); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + // TODO: use the same ROM AP here + return spi_to_esp_err(SPI_Encrypt_Write(dest_addr, src, size)); +#endif } else { return spi_to_esp_err(esp_rom_spiflash_write(dest_addr, src, size)); } diff --git a/components/bootloader_support/src/bootloader_flash_config.c b/components/bootloader_support/src/bootloader_flash_config_esp32.c similarity index 100% rename from components/bootloader_support/src/bootloader_flash_config.c rename to components/bootloader_support/src/bootloader_flash_config_esp32.c diff --git a/components/bootloader_support/src/bootloader_flash_config_esp32s2beta.c b/components/bootloader_support/src/bootloader_flash_config_esp32s2beta.c new file mode 100644 index 0000000000..f6bea6cf4b --- /dev/null +++ b/components/bootloader_support/src/bootloader_flash_config_esp32s2beta.c @@ -0,0 +1,118 @@ +// Copyright 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. +#include +#include +#include "string.h" +#include "sdkconfig.h" +#include "esp_err.h" +#include "esp_log.h" +#include "esp32s2beta/rom/gpio.h" +#include "esp32s2beta/rom/spi_flash.h" +#include "esp32s2beta/rom/efuse.h" +#include "soc/gpio_periph.h" +#include "soc/efuse_reg.h" +#include "soc/spi_reg.h" +#include "soc/spi_mem_reg.h" +#include "soc/spi_caps.h" +#include "flash_qio_mode.h" +#include "bootloader_flash_config.h" +#include "bootloader_common.h" + +#define FLASH_IO_MATRIX_DUMMY_40M 0 +#define FLASH_IO_MATRIX_DUMMY_80M 0 + +#define FLASH_IO_DRIVE_GD_WITH_1V8PSRAM 3 + +void bootloader_flash_update_id() +{ + g_rom_flashchip.device_id = bootloader_read_flash_id(); +} + +void IRAM_ATTR bootloader_flash_cs_timing_config() +{ + SET_PERI_REG_MASK(SPI_USER_REG(0), SPI_CS_HOLD_M | SPI_CS_SETUP_M); + SET_PERI_REG_BITS(SPI_CTRL2_REG(0), SPI_CS_HOLD_TIME_V, 1, SPI_CS_HOLD_TIME_S); + SET_PERI_REG_BITS(SPI_CTRL2_REG(0), SPI_CS_SETUP_TIME_V, 0, SPI_CS_SETUP_TIME_S); + SET_PERI_REG_MASK(SPI_USER_REG(1), SPI_CS_HOLD_M | SPI_CS_SETUP_M); + SET_PERI_REG_BITS(SPI_CTRL2_REG(1), SPI_CS_HOLD_TIME_V, 1, SPI_CS_HOLD_TIME_S); + SET_PERI_REG_BITS(SPI_CTRL2_REG(1), SPI_CS_SETUP_TIME_V, 0, SPI_CS_SETUP_TIME_S); +} + +void IRAM_ATTR bootloader_flash_clock_config(const esp_image_header_t* pfhdr) +{ + uint32_t spi_clk_div = 0; + switch (pfhdr->spi_speed) { + case ESP_IMAGE_SPI_SPEED_80M: + spi_clk_div = 1; + break; + case ESP_IMAGE_SPI_SPEED_40M: + spi_clk_div = 2; + break; + case ESP_IMAGE_SPI_SPEED_26M: + spi_clk_div = 3; + break; + case ESP_IMAGE_SPI_SPEED_20M: + spi_clk_div = 4; + break; + default: + break; + } + esp_rom_spiflash_config_clk(spi_clk_div, 0); +} + +void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr) +{ + +} + +void IRAM_ATTR bootloader_flash_dummy_config(const esp_image_header_t* pfhdr) +{ + int spi_cache_dummy = 0; + int drv = 2; + switch (pfhdr->spi_mode) { + case ESP_IMAGE_SPI_MODE_QIO: + spi_cache_dummy = SPI0_R_QIO_DUMMY_CYCLELEN; + break; + case ESP_IMAGE_SPI_MODE_DIO: + spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN; //qio 3 + break; + case ESP_IMAGE_SPI_MODE_QOUT: + case ESP_IMAGE_SPI_MODE_DOUT: + default: + spi_cache_dummy = SPI0_R_FAST_DUMMY_CYCLELEN; + break; + } + + /* dummy_len_plus values defined in ROM for SPI flash configuration */ + extern uint8_t g_rom_spiflash_dummy_len_plus[]; + switch (pfhdr->spi_speed) { + case ESP_IMAGE_SPI_SPEED_80M: + g_rom_spiflash_dummy_len_plus[0] = FLASH_IO_MATRIX_DUMMY_80M; + g_rom_spiflash_dummy_len_plus[1] = FLASH_IO_MATRIX_DUMMY_80M; + SET_PERI_REG_BITS(SPI_MEM_USER1_REG(0), SPI_MEM_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + FLASH_IO_MATRIX_DUMMY_80M, + SPI_MEM_USR_DUMMY_CYCLELEN_S); //DUMMY + drv = 3; + break; + case ESP_IMAGE_SPI_SPEED_40M: + g_rom_spiflash_dummy_len_plus[0] = FLASH_IO_MATRIX_DUMMY_40M; + g_rom_spiflash_dummy_len_plus[1] = FLASH_IO_MATRIX_DUMMY_40M; + SET_PERI_REG_BITS(SPI_MEM_USER1_REG(0), SPI_MEM_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + FLASH_IO_MATRIX_DUMMY_40M, + SPI_MEM_USR_DUMMY_CYCLELEN_S); //DUMMY + break; + default: + break; + } + + bootloader_configure_spi_pins(drv); +} diff --git a/components/bootloader_support/src/bootloader_init.c b/components/bootloader_support/src/bootloader_init.c index 601df8a593..45118aa950 100644 --- a/components/bootloader_support/src/bootloader_init.c +++ b/components/bootloader_support/src/bootloader_init.c @@ -19,6 +19,7 @@ #include "esp_attr.h" #include "esp_log.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/cache.h" #include "esp32/rom/efuse.h" #include "esp32/rom/ets_sys.h" @@ -28,6 +29,19 @@ #include "esp32/rom/uart.h" #include "esp32/rom/gpio.h" #include "esp32/rom/secure_boot.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/cache.h" +#include "esp32s2beta/rom/efuse.h" +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/spi_flash.h" +#include "esp32s2beta/rom/crc.h" +#include "esp32s2beta/rom/rtc.h" +#include "esp32s2beta/rom/uart.h" +#include "esp32s2beta/rom/gpio.h" +#include "esp32s2beta/rom/secure_boot.h" +#else +#error "Unsupported IDF_TARGET" +#endif #include "soc/soc.h" #include "soc/cpu.h" @@ -39,6 +53,11 @@ #include "soc/timer_periph.h" #include "soc/rtc_wdt.h" #include "soc/spi_periph.h" +#if CONFIG_IDF_TARGET_ESP32S2BETA +#include "soc/spi_mem_reg.h" +#include "soc/extmem_reg.h" +#include "soc/assist_debug_reg.h" +#endif #include "sdkconfig.h" #include "esp_image_format.h" @@ -48,6 +67,7 @@ #include "bootloader_flash.h" #include "bootloader_random.h" #include "bootloader_config.h" +#include "bootloader_common.h" #include "bootloader_clock.h" #include "bootloader_common.h" #include "bootloader_flash_config.h" @@ -60,7 +80,7 @@ extern int _bss_end; extern int _data_start; extern int _data_end; -static const char* TAG = "boot"; +static const char *TAG = "boot"; static esp_err_t bootloader_main(void); static void print_flash_info(const esp_image_header_t* pfhdr); @@ -78,11 +98,13 @@ esp_err_t bootloader_init(void) /* Sanity check that static RAM is after the stack */ #ifndef NDEBUG { - int *sp = get_sp(); assert(&_bss_start <= &_bss_end); assert(&_data_start <= &_data_end); +#if CONFIG_IDF_TARGET_ESP32 + int *sp = get_sp(); assert(sp < &_bss_start); assert(sp < &_data_start); +#endif } #endif @@ -91,14 +113,27 @@ esp_err_t bootloader_init(void) /* completely reset MMU for both CPUs (in case serial bootloader was running) */ +#if CONFIG_IDF_TARGET_ESP32 Cache_Read_Disable(0); +#if !CONFIG_FREERTOS_UNICORE Cache_Read_Disable(1); +#endif Cache_Flush(0); +#if !CONFIG_FREERTOS_UNICORE Cache_Flush(1); +#endif mmu_init(0); +#if !CONFIG_FREERTOS_UNICORE DPORT_REG_SET_BIT(DPORT_APP_CACHE_CTRL1_REG, DPORT_APP_CACHE_MMU_IA_CLR); mmu_init(1); DPORT_REG_CLR_BIT(DPORT_APP_CACHE_CTRL1_REG, DPORT_APP_CACHE_MMU_IA_CLR); +#endif +#elif CONFIG_IDF_TARGET_ESP32S2BETA + //TODO, save the autoload value + Cache_Suspend_ICache(); + Cache_Invalidate_ICache_All(); + Cache_MMU_Init(); +#endif /* (above steps probably unnecessary for most serial bootloader usage, all that's absolutely needed is that we unmask DROM0 cache on the following two lines - normal ROM boot exits with @@ -109,10 +144,15 @@ esp_err_t bootloader_init(void) The lines which manipulate DPORT_APP_CACHE_MMU_IA_CLR bit are necessary to work around a hardware bug. */ +#if CONFIG_IDF_TARGET_ESP32 DPORT_REG_CLR_BIT(DPORT_PRO_CACHE_CTRL1_REG, DPORT_PRO_CACHE_MASK_DROM0); +#if !CONFIG_FREERTOS_UNICORE DPORT_REG_CLR_BIT(DPORT_APP_CACHE_CTRL1_REG, DPORT_APP_CACHE_MASK_DROM0); - - if(bootloader_main() != ESP_OK){ +#endif +#elif CONFIG_IDF_TARGET_ESP32S2BETA + DPORT_REG_CLR_BIT(DPORT_PRO_ICACHE_CTRL1_REG, DPORT_PRO_ICACHE_MASK_DROM0); +#endif + if (bootloader_main() != ESP_OK) { return ESP_FAIL; } return ESP_OK; @@ -137,21 +177,25 @@ static esp_err_t bootloader_main(void) } bootloader_init_flash_configure(&fhdr); -#if (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ == 240) - //Check if ESP32 is rated for a CPU frequency of 160MHz only - if (REG_GET_BIT(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_CPU_FREQ_RATED) && - REG_GET_BIT(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_CPU_FREQ_LOW)) { - ESP_LOGE(TAG, "Chip CPU frequency rated for 160MHz. Modify CPU frequency in menuconfig"); + +#ifdef CONFIG_IDF_TARGET_ESP32 + int rated_freq = bootloader_clock_get_rated_freq_mhz(); + if (rated_freq < CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ) { + ESP_LOGE(TAG, "Chip CPU frequency rated for %dMHz, configured for %dMHz. Modify CPU frequency in menuconfig", + rated_freq, CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ); return ESP_FAIL; } #endif + bootloader_clock_configure(); uart_console_configure(); wdt_reset_check(); ESP_LOGI(TAG, "ESP-IDF %s 2nd stage bootloader", IDF_VER); ESP_LOGI(TAG, "compile time " __TIME__ ); +#if !CONFIG_FREERTOS_UNICORE ets_set_appcpu_boot_addr(0); +#endif #ifdef CONFIG_BOOTLOADER_WDT_ENABLE ESP_LOGD(TAG, "Enabling RTCWDT(%d ms)", CONFIG_BOOTLOADER_WDT_TIME_MS); @@ -172,7 +216,7 @@ static esp_err_t bootloader_main(void) #ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH const uint32_t spiconfig = ets_efuse_get_spiconfig(); - if(spiconfig != EFUSE_SPICONFIG_SPI_DEFAULTS && spiconfig != EFUSE_SPICONFIG_HSPI_DEFAULTS) { + if (spiconfig != EFUSE_SPICONFIG_SPI_DEFAULTS && spiconfig != EFUSE_SPICONFIG_HSPI_DEFAULTS) { ESP_LOGE(TAG, "SPI flash pins are overridden. \"Enable SPI flash ROM driver patched functions\" must be enabled in menuconfig"); return ESP_FAIL; } @@ -193,38 +237,46 @@ static esp_err_t bootloader_main(void) return ESP_OK; } -static void update_flash_config(const esp_image_header_t* pfhdr) +static void update_flash_config(const esp_image_header_t *pfhdr) { uint32_t size; - switch(pfhdr->spi_size) { - case ESP_IMAGE_FLASH_SIZE_1MB: - size = 1; - break; - case ESP_IMAGE_FLASH_SIZE_2MB: - size = 2; - break; - case ESP_IMAGE_FLASH_SIZE_4MB: - size = 4; - break; - case ESP_IMAGE_FLASH_SIZE_8MB: - size = 8; - break; - case ESP_IMAGE_FLASH_SIZE_16MB: - size = 16; - break; - default: - size = 2; + switch (pfhdr->spi_size) { + case ESP_IMAGE_FLASH_SIZE_1MB: + size = 1; + break; + case ESP_IMAGE_FLASH_SIZE_2MB: + size = 2; + break; + case ESP_IMAGE_FLASH_SIZE_4MB: + size = 4; + break; + case ESP_IMAGE_FLASH_SIZE_8MB: + size = 8; + break; + case ESP_IMAGE_FLASH_SIZE_16MB: + size = 16; + break; + default: + size = 2; } - Cache_Read_Disable( 0 ); +#if CONFIG_IDF_TARGET_ESP32 + Cache_Read_Disable(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + uint32_t autoload = Cache_Suspend_ICache(); +#endif // Set flash chip size esp_rom_spiflash_config_param(g_rom_flashchip.device_id, size * 0x100000, 0x10000, 0x1000, 0x100, 0xffff); // TODO: set mode // TODO: set frequency +#if CONFIG_IDF_TARGET_ESP32 Cache_Flush(0); - Cache_Read_Enable( 0 ); + Cache_Read_Enable(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + Cache_Resume_ICache(autoload); +#endif } -static void print_flash_info(const esp_image_header_t* phdr) +static void print_flash_info(const esp_image_header_t *phdr) { #if (BOOT_LOG_LEVEL >= BOOT_LOG_LEVEL_NOTICE) @@ -234,7 +286,7 @@ static void print_flash_info(const esp_image_header_t* phdr) ESP_LOGD(TAG, "spi_speed %02x", phdr->spi_speed ); ESP_LOGD(TAG, "spi_size %02x", phdr->spi_size ); - const char* str; + const char *str; switch ( phdr->spi_speed ) { case ESP_IMAGE_SPI_SPEED_40M: str = "40MHz"; @@ -256,6 +308,7 @@ static void print_flash_info(const esp_image_header_t* phdr) /* SPI mode could have been set to QIO during boot already, so test the SPI registers not the flash header */ +#if CONFIG_IDF_TARGET_ESP32 uint32_t spi_ctrl = REG_READ(SPI_CTRL_REG(0)); if (spi_ctrl & SPI_FREAD_QIO) { str = "QIO"; @@ -270,6 +323,22 @@ static void print_flash_info(const esp_image_header_t* phdr) } else { str = "SLOW READ"; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + uint32_t spi_ctrl = REG_READ(SPI_MEM_CTRL_REG(0)); + if (spi_ctrl & SPI_MEM_FREAD_QIO) { + str = "QIO"; + } else if (spi_ctrl & SPI_MEM_FREAD_QUAD) { + str = "QOUT"; + } else if (spi_ctrl & SPI_MEM_FREAD_DIO) { + str = "DIO"; + } else if (spi_ctrl & SPI_MEM_FREAD_DUAL) { + str = "DOUT"; + } else if (spi_ctrl & SPI_MEM_FASTRD_MODE) { + str = "FAST READ"; + } else { + str = "SLOW READ"; + } +#endif ESP_LOGI(TAG, "SPI Mode : %s", str ); switch ( phdr->spi_size ) { @@ -296,10 +365,6 @@ static void print_flash_info(const esp_image_header_t* phdr) #endif } -/* - * Bootloader reads SPI configuration from bin header, so that - * the burning configuration can be different with compiling configuration. - */ static void IRAM_ATTR bootloader_init_flash_configure(const esp_image_header_t* pfhdr) { bootloader_flash_gpio_config(pfhdr); @@ -362,9 +427,16 @@ static void uart_console_configure(void) static void wdt_reset_cpu0_info_enable(void) { +#if CONFIG_IDF_TARGET_ESP32 //We do not reset core1 info here because it didn't work before cpu1 was up. So we put it into call_start_cpu1. DPORT_REG_SET_BIT(DPORT_PRO_CPU_RECORD_CTRL_REG, DPORT_PRO_CPU_PDEBUG_ENABLE | DPORT_PRO_CPU_RECORD_ENABLE); DPORT_REG_CLR_BIT(DPORT_PRO_CPU_RECORD_CTRL_REG, DPORT_PRO_CPU_RECORD_ENABLE); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + DPORT_REG_SET_BIT(DPORT_PERI_CLK_EN_REG, DPORT_PERI_EN_ASSIST_DEBUG); + DPORT_REG_CLR_BIT(DPORT_PERI_RST_EN_REG, DPORT_PERI_EN_ASSIST_DEBUG); + REG_WRITE(ASSIST_DEBUG_PRO_PDEBUGENABLE, 1); + REG_WRITE(ASSIST_DEBUG_PRO_RCD_RECORDING, 1); +#endif } static void wdt_reset_info_dump(int cpu) @@ -373,6 +445,7 @@ static void wdt_reset_info_dump(int cpu) lsstat = 0, lsaddr = 0, lsdata = 0, dstat = 0; const char *cpu_name = cpu ? "APP" : "PRO"; +#if CONFIG_IDF_TARGET_ESP32 if (cpu == 0) { stat = DPORT_REG_READ(DPORT_PRO_CPU_RECORD_STATUS_REG); pid = DPORT_REG_READ(DPORT_PRO_CPU_RECORD_PID_REG); @@ -385,6 +458,7 @@ static void wdt_reset_info_dump(int cpu) lsdata = DPORT_REG_READ(DPORT_PRO_CPU_RECORD_PDEBUGLS0DATA_REG); } else { +#if !CONFIG_FREERTOS_UNICORE stat = DPORT_REG_READ(DPORT_APP_CPU_RECORD_STATUS_REG); pid = DPORT_REG_READ(DPORT_APP_CPU_RECORD_PID_REG); inst = DPORT_REG_READ(DPORT_APP_CPU_RECORD_PDEBUGINST_REG); @@ -394,9 +468,25 @@ static void wdt_reset_info_dump(int cpu) lsstat = DPORT_REG_READ(DPORT_APP_CPU_RECORD_PDEBUGLS0STAT_REG); lsaddr = DPORT_REG_READ(DPORT_APP_CPU_RECORD_PDEBUGLS0ADDR_REG); lsdata = DPORT_REG_READ(DPORT_APP_CPU_RECORD_PDEBUGLS0DATA_REG); +#else + ESP_LOGE(TAG, "WDT reset info: &s CPU not support!\n", cpu_name); + return; +#endif } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + stat = 0xdeadbeef; + pid = 0; + inst = REG_READ(ASSIST_DEBUG_PRO_RCD_PDEBUGINST); + dstat = REG_READ(ASSIST_DEBUG_PRO_RCD_PDEBUGSTATUS); + data = REG_READ(ASSIST_DEBUG_PRO_RCD_PDEBUGDATA); + pc = REG_READ(ASSIST_DEBUG_PRO_RCD_PDEBUGPC); + lsstat = REG_READ(ASSIST_DEBUG_PRO_RCD_PDEBUGLS0STAT); + lsaddr = REG_READ(ASSIST_DEBUG_PRO_RCD_PDEBUGLS0ADDR); + lsdata = REG_READ(ASSIST_DEBUG_PRO_RCD_PDEBUGLS0DATA); +#endif + if (DPORT_RECORD_PDEBUGINST_SZ(inst) == 0 && - DPORT_RECORD_PDEBUGSTATUS_BBCAUSE(dstat) == DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_WAITI) { + DPORT_RECORD_PDEBUGSTATUS_BBCAUSE(dstat) == DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_WAITI) { ESP_LOGW(TAG, "WDT reset info: %s CPU PC=0x%x (waiti mode)", cpu_name, pc); } else { ESP_LOGW(TAG, "WDT reset info: %s CPU PC=0x%x", cpu_name, pc); @@ -418,21 +508,31 @@ static void wdt_reset_check(void) RESET_REASON rst_reas[2]; rst_reas[0] = rtc_get_reset_reason(0); +#if CONFIG_IDF_TARGET_ESP32 rst_reas[1] = rtc_get_reset_reason(1); if (rst_reas[0] == RTCWDT_SYS_RESET || rst_reas[0] == TG0WDT_SYS_RESET || rst_reas[0] == TG1WDT_SYS_RESET || - rst_reas[0] == TGWDT_CPU_RESET || rst_reas[0] == RTCWDT_CPU_RESET) { + rst_reas[0] == TGWDT_CPU_RESET || rst_reas[0] == RTCWDT_CPU_RESET) { ESP_LOGW(TAG, "PRO CPU has been reset by WDT."); wdt_rst = 1; } if (rst_reas[1] == RTCWDT_SYS_RESET || rst_reas[1] == TG0WDT_SYS_RESET || rst_reas[1] == TG1WDT_SYS_RESET || - rst_reas[1] == TGWDT_CPU_RESET || rst_reas[1] == RTCWDT_CPU_RESET) { + rst_reas[1] == TGWDT_CPU_RESET || rst_reas[1] == RTCWDT_CPU_RESET) { ESP_LOGW(TAG, "APP CPU has been reset by WDT."); wdt_rst = 1; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if (rst_reas[0] == RTCWDT_SYS_RESET || rst_reas[0] == TG0WDT_SYS_RESET || rst_reas[0] == TG1WDT_SYS_RESET || + rst_reas[0] == TG0WDT_CPU_RESET || rst_reas[0] == TG1WDT_CPU_RESET || rst_reas[0] == RTCWDT_CPU_RESET) { + ESP_LOGW(TAG, "PRO CPU has been reset by WDT."); + wdt_rst = 1; + } +#endif if (wdt_rst) { // if reset by WDT dump info from trace port wdt_reset_info_dump(0); +#if CONFIG_IDF_TARGET_ESP32 wdt_reset_info_dump(1); +#endif } wdt_reset_cpu0_info_enable(); } @@ -440,16 +540,16 @@ static void wdt_reset_check(void) void __assert_func(const char *file, int line, const char *func, const char *expr) { ESP_LOGE(TAG, "Assert failed in %s, %s:%d (%s)", func, file, line, expr); - while(1) {} + while (1) {} } void abort(void) { -#if !CONFIG_ESP32_PANIC_SILENT_REBOOT +#if !(CONFIG_ESP32_PANIC_SILENT_REBOOT || CONFIG_ESP32S2_PANIC_SILENT_REBOOT) ets_printf("abort() was called at PC 0x%08x\r\n", (intptr_t)__builtin_return_address(0) - 3); #endif if (esp_cpu_in_ocd_debug_mode()) { __asm__ ("break 0,0"); } - while(1) {} + while (1) {} } diff --git a/components/bootloader_support/src/bootloader_random.c b/components/bootloader_support/src/bootloader_random.c index 4d0adb1221..3772d7c32d 100644 --- a/components/bootloader_support/src/bootloader_random.c +++ b/components/bootloader_support/src/bootloader_random.c @@ -35,7 +35,9 @@ void bootloader_fill_random(void *buffer, size_t length) { uint8_t *buffer_bytes = (uint8_t *)buffer; uint32_t random; +#if CONFIG_IDF_TARGET_ESP32 uint32_t start, now; +#endif assert(buffer != NULL); @@ -48,14 +50,18 @@ void bootloader_fill_random(void *buffer, size_t length) as-is, we repeatedly read the RNG register and XOR all values. */ +#if CONFIG_IDF_TARGET_ESP32 random = REG_READ(WDEV_RND_REG); RSR(CCOUNT, start); do { random ^= REG_READ(WDEV_RND_REG); RSR(CCOUNT, now); - } while(now - start < 80*32*2); /* extra factor of 2 is precautionary */ + } while (now - start < 80 * 32 * 2); /* extra factor of 2 is precautionary */ +#elif CONFIG_IDF_TARGET_ESP32S2BETA + // ToDo: Get random from register + random = 12345678; +#endif } - buffer_bytes[i] = random >> ((i % 4) * 8); } } @@ -80,6 +86,7 @@ void bootloader_random_enable(void) */ SET_PERI_REG_BITS(RTC_CNTL_TEST_MUX_REG, RTC_CNTL_DTEST_RTC, 2, RTC_CNTL_DTEST_RTC_S); SET_PERI_REG_MASK(RTC_CNTL_TEST_MUX_REG, RTC_CNTL_ENT_RTC); +#if CONFIG_IDF_TARGET_ESP32 SET_PERI_REG_MASK(SENS_SAR_START_FORCE_REG, SENS_SAR2_EN_TEST); #ifdef BOOTLOADER_BUILD @@ -89,6 +96,13 @@ void bootloader_random_enable(void) #endif // BOOTLOADER_BUILD CLEAR_PERI_REG_MASK(SENS_SAR_START_FORCE_REG, SENS_ULP_CP_FORCE_START_TOP); CLEAR_PERI_REG_MASK(SENS_SAR_START_FORCE_REG, SENS_ULP_CP_START_TOP); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SET_PERI_REG_MASK(SENS_SAR_MEAS2_CTRL1_REG, SENS_SAR2_EN_TEST); + DPORT_SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S0_CLK_EN); + CLEAR_PERI_REG_MASK(RTC_CNTL_ULP_CP_CTRL_REG, RTC_CNTL_ULP_CP_FORCE_START_TOP); + CLEAR_PERI_REG_MASK(RTC_CNTL_ULP_CP_CTRL_REG, RTC_CNTL_ULP_CP_START_TOP); +#endif + // Test pattern configuration byte 0xAD: //--[7:4] channel_sel: 10-->en_test //--[3:2] bit_width : 3-->12bit @@ -97,22 +111,31 @@ void bootloader_random_enable(void) WRITE_PERI_REG(SYSCON_SARADC_SAR2_PATT_TAB2_REG, 0xADADADAD); WRITE_PERI_REG(SYSCON_SARADC_SAR2_PATT_TAB3_REG, 0xADADADAD); WRITE_PERI_REG(SYSCON_SARADC_SAR2_PATT_TAB4_REG, 0xADADADAD); - +#if CONFIG_IDF_TARGET_ESP32 SET_PERI_REG_BITS(SENS_SAR_MEAS_WAIT2_REG, SENS_FORCE_XPD_SAR, 3, SENS_FORCE_XPD_SAR_S); SET_PERI_REG_MASK(SENS_SAR_READ_CTRL_REG, SENS_SAR1_DIG_FORCE); SET_PERI_REG_MASK(SENS_SAR_READ_CTRL2_REG, SENS_SAR2_DIG_FORCE); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SET_PERI_REG_BITS(SENS_SAR_POWER_XPD_SAR_REG, SENS_FORCE_XPD_SAR, 3, SENS_FORCE_XPD_SAR_S); + SET_PERI_REG_MASK(SENS_SAR_MEAS1_MUX_REG, SENS_SAR1_DIG_FORCE); +#endif + +#if CONFIG_IDF_TARGET_ESP32 SET_PERI_REG_MASK(SYSCON_SARADC_CTRL_REG, SYSCON_SARADC_SAR2_MUX); +#endif SET_PERI_REG_BITS(SYSCON_SARADC_CTRL_REG, SYSCON_SARADC_SAR_CLK_DIV, 4, SYSCON_SARADC_SAR_CLK_DIV_S); SET_PERI_REG_BITS(SYSCON_SARADC_FSM_REG, SYSCON_SARADC_RSTB_WAIT, 8, SYSCON_SARADC_RSTB_WAIT_S); /* was 1 */ +#if CONFIG_IDF_TARGET_ESP32 SET_PERI_REG_BITS(SYSCON_SARADC_FSM_REG, SYSCON_SARADC_START_WAIT, 10, SYSCON_SARADC_START_WAIT_S); +#endif SET_PERI_REG_BITS(SYSCON_SARADC_CTRL_REG, SYSCON_SARADC_WORK_MODE, 0, SYSCON_SARADC_WORK_MODE_S); SET_PERI_REG_MASK(SYSCON_SARADC_CTRL_REG, SYSCON_SARADC_SAR_SEL); CLEAR_PERI_REG_MASK(SYSCON_SARADC_CTRL_REG, SYSCON_SARADC_DATA_SAR_SEL); SET_PERI_REG_BITS(I2S_SAMPLE_RATE_CONF_REG(0), I2S_RX_BCK_DIV_NUM, 20, I2S_RX_BCK_DIV_NUM_S); - SET_PERI_REG_MASK(SYSCON_SARADC_CTRL_REG,SYSCON_SARADC_DATA_TO_I2S); + SET_PERI_REG_MASK(SYSCON_SARADC_CTRL_REG, SYSCON_SARADC_DATA_TO_I2S); CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_CAMERA_EN); SET_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_LCD_EN); @@ -139,15 +162,28 @@ void bootloader_random_disable(void) CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START); /* Restore SYSCON mode registers */ +#if CONFIG_IDF_TARGET_ESP32 CLEAR_PERI_REG_MASK(SENS_SAR_READ_CTRL_REG, SENS_SAR1_DIG_FORCE); CLEAR_PERI_REG_MASK(SENS_SAR_READ_CTRL2_REG, SENS_SAR2_DIG_FORCE); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + CLEAR_PERI_REG_MASK(SENS_SAR_MEAS1_MUX_REG, SENS_SAR1_DIG_FORCE); +#endif +#if CONFIG_IDF_TARGET_ESP32 /* Restore SAR ADC mode */ CLEAR_PERI_REG_MASK(SENS_SAR_START_FORCE_REG, SENS_SAR2_EN_TEST); CLEAR_PERI_REG_MASK(SYSCON_SARADC_CTRL_REG, SYSCON_SARADC_SAR2_MUX | SYSCON_SARADC_SAR_SEL | SYSCON_SARADC_DATA_TO_I2S); SET_PERI_REG_BITS(SENS_SAR_MEAS_WAIT2_REG, SENS_FORCE_XPD_SAR, 0, SENS_FORCE_XPD_SAR_S); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + CLEAR_PERI_REG_MASK(SENS_SAR_MEAS2_CTRL1_REG, SENS_SAR2_EN_TEST); + CLEAR_PERI_REG_MASK(SYSCON_SARADC_CTRL_REG, SYSCON_SARADC_SAR_SEL | SYSCON_SARADC_DATA_TO_I2S); + SET_PERI_REG_BITS(SENS_SAR_POWER_XPD_SAR_REG, SENS_FORCE_XPD_SAR, 0, SENS_FORCE_XPD_SAR_S); +#endif + +#if CONFIG_IDF_TARGET_ESP32 SET_PERI_REG_BITS(SYSCON_SARADC_FSM_REG, SYSCON_SARADC_START_WAIT, 8, SYSCON_SARADC_START_WAIT_S); +#endif /* Reset i2s peripheral */ #ifdef BOOTLOADER_BUILD diff --git a/components/bootloader_support/src/bootloader_utility.c b/components/bootloader_support/src/bootloader_utility.c index b9d76ed9bc..613d5aa0d5 100644 --- a/components/bootloader_support/src/bootloader_utility.c +++ b/components/bootloader_support/src/bootloader_utility.c @@ -19,6 +19,7 @@ #include "esp_attr.h" #include "esp_log.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/cache.h" #include "esp32/rom/efuse.h" #include "esp32/rom/ets_sys.h" @@ -28,7 +29,19 @@ #include "esp32/rom/uart.h" #include "esp32/rom/gpio.h" #include "esp32/rom/secure_boot.h" -#include "esp32/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/cache.h" +#include "esp32s2beta/rom/efuse.h" +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/spi_flash.h" +#include "esp32s2beta/rom/crc.h" +#include "esp32s2beta/rom/rtc.h" +#include "esp32s2beta/rom/uart.h" +#include "esp32s2beta/rom/gpio.h" +#include "esp32s2beta/rom/secure_boot.h" +#else +#error "Unsupported IDF_TARGET" +#endif #include "soc/soc.h" #include "soc/cpu.h" @@ -52,22 +65,22 @@ #include "bootloader_sha.h" #include "esp_efuse.h" -static const char* TAG = "boot"; +static const char *TAG = "boot"; /* Reduce literal size for some generic string literals */ #define MAP_ERR_MSG "Image contains multiple %s segments. Only the last one will be mapped." static bool ota_has_initial_contents; -static void load_image(const esp_image_metadata_t* image_data); +static void load_image(const esp_image_metadata_t *image_data); static void unpack_load_app(const esp_image_metadata_t *data); static void set_cache_and_start_app(uint32_t drom_addr, - uint32_t drom_load_addr, - uint32_t drom_size, - uint32_t irom_addr, - uint32_t irom_load_addr, - uint32_t irom_size, - uint32_t entry_addr); + uint32_t drom_load_addr, + uint32_t drom_size, + uint32_t irom_addr, + uint32_t irom_load_addr, + uint32_t irom_size, + uint32_t entry_addr); // Read ota_info partition and fill array from two otadata structures. static esp_err_t read_otadata(const esp_partition_pos_t *ota_info, esp_ota_select_entry_t *two_otadata) @@ -97,7 +110,7 @@ static esp_err_t read_otadata(const esp_partition_pos_t *ota_info, esp_ota_selec return ESP_OK; } -bool bootloader_utility_load_partition_table(bootloader_state_t* bs) +bool bootloader_utility_load_partition_table(bootloader_state_t *bs) { const esp_partition_info_t *partitions; const char *partition_usage; @@ -120,16 +133,16 @@ bool bootloader_utility_load_partition_table(bootloader_state_t* bs) ESP_LOGI(TAG, "Partition Table:"); ESP_LOGI(TAG, "## Label Usage Type ST Offset Length"); - for(int i = 0; i < num_partitions; i++) { + for (int i = 0; i < num_partitions; i++) { const esp_partition_info_t *partition = &partitions[i]; ESP_LOGD(TAG, "load partition table entry 0x%x", (intptr_t)partition); ESP_LOGD(TAG, "type=%x subtype=%x", partition->type, partition->subtype); partition_usage = "unknown"; /* valid partition table */ - switch(partition->type) { + switch (partition->type) { case PART_TYPE_APP: /* app partition */ - switch(partition->subtype) { + switch (partition->subtype) { case PART_SUBTYPE_FACTORY: /* factory binary */ bs->factory = partition->pos; partition_usage = "factory app"; @@ -144,15 +157,14 @@ bool bootloader_utility_load_partition_table(bootloader_state_t* bs) bs->ota[partition->subtype & PART_SUBTYPE_OTA_MASK] = partition->pos; ++bs->app_count; partition_usage = "OTA app"; - } - else { + } else { partition_usage = "Unknown app"; } break; } break; /* PART_TYPE_APP */ case PART_TYPE_DATA: /* data partition */ - switch(partition->subtype) { + switch (partition->subtype) { case PART_SUBTYPE_DATA_OTA: /* ota data */ bs->ota_info = partition->pos; partition_usage = "OTA data"; @@ -189,7 +201,7 @@ bool bootloader_utility_load_partition_table(bootloader_state_t* bs) bootloader_munmap(partitions); - ESP_LOGI(TAG,"End of partition table"); + ESP_LOGI(TAG, "End of partition table"); return true; } @@ -215,7 +227,7 @@ static esp_partition_pos_t index_to_partition(const bootloader_state_t *bs, int static void log_invalid_app_partition(int index) { const char *not_bootable = " is not bootable"; /* save a few string literal bytes */ - switch(index) { + switch (index) { case FACTORY_INDEX: ESP_LOGE(TAG, "Factory app partition%s", not_bootable); break; @@ -318,8 +330,8 @@ int bootloader_utility_get_selected_boot_partition(const bootloader_state_t *bs) #ifndef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK if ((bootloader_common_ota_select_invalid(&otadata[0]) && - bootloader_common_ota_select_invalid(&otadata[1])) || - bs->app_count == 0) { + bootloader_common_ota_select_invalid(&otadata[1])) || + bs->app_count == 0) { ESP_LOGD(TAG, "OTA sequence numbers both empty (all-0xFF) or partition table does not have bootable ota_apps (app_count=%d)", bs->app_count); if (bs->factory.offset != 0) { ESP_LOGI(TAG, "Defaulting to factory image"); @@ -329,7 +341,7 @@ int bootloader_utility_get_selected_boot_partition(const bootloader_state_t *bs) boot_index = 0; // Try to boot from ota_0. if ((otadata[0].ota_seq == UINT32_MAX || otadata[0].crc != bootloader_common_ota_select_crc(&otadata[0])) && - (otadata[1].ota_seq == UINT32_MAX || otadata[1].crc != bootloader_common_ota_select_crc(&otadata[1]))) { + (otadata[1].ota_seq == UINT32_MAX || otadata[1].crc != bootloader_common_ota_select_crc(&otadata[1]))) { // Factory is not found and both otadata are initial(0xFFFFFFFF) or incorrect crc. // will set correct ota_seq. ota_has_initial_contents = true; @@ -342,7 +354,7 @@ int bootloader_utility_get_selected_boot_partition(const bootloader_state_t *bs) ESP_LOGI(TAG, "Secure version (from eFuse) = %d", esp_efuse_read_secure_version()); // When CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK is enabled factory partition should not be in partition table, only two ota_app are there. if ((otadata[0].ota_seq == UINT32_MAX || otadata[0].crc != bootloader_common_ota_select_crc(&otadata[0])) && - (otadata[1].ota_seq == UINT32_MAX || otadata[1].crc != bootloader_common_ota_select_crc(&otadata[1]))) { + (otadata[1].ota_seq == UINT32_MAX || otadata[1].crc != bootloader_common_ota_select_crc(&otadata[1]))) { ESP_LOGI(TAG, "otadata[0..1] in initial state"); // both otadata are initial(0xFFFFFFFF) or incorrect crc. // will set correct ota_seq. @@ -450,7 +462,7 @@ void bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_ esp_partition_pos_t part; esp_image_metadata_t image_data; - if(start_index == TEST_APP_INDEX) { + if (start_index == TEST_APP_INDEX) { if (try_load_partition(&bs->test, &image_data)) { load_image(&image_data); } else { @@ -460,7 +472,7 @@ void bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_ } /* work backwards from start_index, down to the factory app */ - for(index = start_index; index >= FACTORY_INDEX; index--) { + for (index = start_index; index >= FACTORY_INDEX; index--) { part = index_to_partition(bs, index); if (part.size == 0) { continue; @@ -474,7 +486,7 @@ void bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_ } /* failing that work forwards from start_index, try valid OTA slots */ - for(index = start_index + 1; index < bs->app_count; index++) { + for (index = start_index + 1; index < bs->app_count; index++) { part = index_to_partition(bs, index); if (part.size == 0) { continue; @@ -498,7 +510,7 @@ void bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_ } // Copy loaded segments to RAM, set up caches for mapped segments, and start application. -static void load_image(const esp_image_metadata_t* image_data) +static void load_image(const esp_image_metadata_t *image_data) { /** * Rough steps for a first boot, when encryption and secure boot are both disabled: @@ -595,6 +607,7 @@ static void load_image(const esp_image_metadata_t* image_data) so issue a system reset to ensure flash encryption cache resets properly */ ESP_LOGI(TAG, "Resetting with flash encryption enabled..."); + uart_tx_wait_idle(0); bootloader_reset(); } #endif @@ -606,7 +619,7 @@ static void load_image(const esp_image_metadata_t* image_data) unpack_load_app(image_data); } -static void unpack_load_app(const esp_image_metadata_t* data) +static void unpack_load_app(const esp_image_metadata_t *data) { uint32_t drom_addr = 0; uint32_t drom_load_addr = 0; @@ -642,12 +655,12 @@ static void unpack_load_app(const esp_image_metadata_t* data) ESP_LOGD(TAG, "calling set_cache_and_start_app"); set_cache_and_start_app(drom_addr, - drom_load_addr, - drom_size, - irom_addr, - irom_load_addr, - irom_size, - data->image.entry_addr); + drom_load_addr, + drom_size, + irom_addr, + irom_load_addr, + irom_size, + data->image.entry_addr); } static void set_cache_and_start_app( @@ -661,8 +674,13 @@ static void set_cache_and_start_app( { int rc; ESP_LOGD(TAG, "configure drom and irom and start"); - Cache_Read_Disable( 0 ); - Cache_Flush( 0 ); +#if CONFIG_IDF_TARGET_ESP32 + Cache_Read_Disable(0); + Cache_Flush(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + uint32_t autoload = Cache_Suspend_ICache(); + Cache_Invalidate_ICache_All(); +#endif /* Clear the MMU entries that are already set up, so the new app only has the mappings it creates. @@ -674,33 +692,70 @@ static void set_cache_and_start_app( uint32_t drom_load_addr_aligned = drom_load_addr & MMU_FLASH_MASK; uint32_t drom_page_count = bootloader_cache_pages_to_map(drom_size, drom_load_addr); ESP_LOGV(TAG, "d mmu set paddr=%08x vaddr=%08x size=%d n=%d", - drom_addr & MMU_FLASH_MASK, drom_load_addr_aligned, drom_size, drom_page_count); + drom_addr & MMU_FLASH_MASK, drom_load_addr_aligned, drom_size, drom_page_count); +#if CONFIG_IDF_TARGET_ESP32 rc = cache_flash_mmu_set(0, 0, drom_load_addr_aligned, drom_addr & MMU_FLASH_MASK, 64, drom_page_count); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + rc = Cache_Ibus_MMU_Set(DPORT_MMU_ACCESS_FLASH, drom_load_addr & 0xffff0000, drom_addr & 0xffff0000, + 64, drom_page_count, 0); +#endif ESP_LOGV(TAG, "rc=%d", rc); +#if CONFIG_IDF_TARGET_ESP32 && !CONFIG_FREERTOS_UNICORE rc = cache_flash_mmu_set(1, 0, drom_load_addr_aligned, drom_addr & MMU_FLASH_MASK, 64, drom_page_count); ESP_LOGV(TAG, "rc=%d", rc); - +#endif uint32_t irom_load_addr_aligned = irom_load_addr & MMU_FLASH_MASK; uint32_t irom_page_count = bootloader_cache_pages_to_map(irom_size, irom_load_addr); ESP_LOGV(TAG, "i mmu set paddr=%08x vaddr=%08x size=%d n=%d", - irom_addr & MMU_FLASH_MASK, irom_load_addr_aligned, irom_size, irom_page_count); + irom_addr & MMU_FLASH_MASK, irom_load_addr_aligned, irom_size, irom_page_count); +#if CONFIG_IDF_TARGET_ESP32 rc = cache_flash_mmu_set(0, 0, irom_load_addr_aligned, irom_addr & MMU_FLASH_MASK, 64, irom_page_count); ESP_LOGV(TAG, "rc=%d", rc); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + uint32_t iram1_used = 0, irom0_used = 0; + if (irom_load_addr + irom_size > IRAM1_ADDRESS_LOW) { + iram1_used = 1; + } + if (irom_load_addr + irom_size > IROM0_ADDRESS_LOW) { + irom0_used = 1; + } + if (iram1_used || irom0_used) { + rc = Cache_Ibus_MMU_Set(DPORT_MMU_ACCESS_FLASH, IRAM0_ADDRESS_LOW, 0, 64, 64, 1); + rc = Cache_Ibus_MMU_Set(DPORT_MMU_ACCESS_FLASH, IRAM1_ADDRESS_LOW, 0, 64, 64, 1); + REG_SET_BIT(DPORT_CACHE_SOURCE_1_REG, DPORT_PRO_CACHE_I_SOURCE_PRO_IRAM1); + REG_CLR_BIT(DPORT_PRO_ICACHE_CTRL1_REG, DPORT_PRO_ICACHE_MASK_IRAM1); + if (irom0_used) { + rc = Cache_Ibus_MMU_Set(DPORT_MMU_ACCESS_FLASH, IROM0_ADDRESS_LOW, 0, 64, 64, 1); + REG_SET_BIT(DPORT_CACHE_SOURCE_1_REG, DPORT_PRO_CACHE_I_SOURCE_PRO_IROM0); + REG_CLR_BIT(DPORT_PRO_ICACHE_CTRL1_REG, DPORT_PRO_ICACHE_MASK_IROM0); + } + } + rc = Cache_Ibus_MMU_Set(DPORT_MMU_ACCESS_FLASH, irom_load_addr & 0xffff0000, irom_addr & 0xffff0000, 64, irom_page_count, 0); +#endif + ESP_LOGV(TAG, "rc=%d", rc); +#if CONFIG_IDF_TARGET_ESP32 +#if !CONFIG_FREERTOS_UNICORE rc = cache_flash_mmu_set(1, 0, irom_load_addr_aligned, irom_addr & MMU_FLASH_MASK, 64, irom_page_count); ESP_LOGV(TAG, "rc=%d", rc); - +#endif DPORT_REG_CLR_BIT( DPORT_PRO_CACHE_CTRL1_REG, - (DPORT_PRO_CACHE_MASK_IRAM0) | (DPORT_PRO_CACHE_MASK_IRAM1 & 0) | - (DPORT_PRO_CACHE_MASK_IROM0 & 0) | DPORT_PRO_CACHE_MASK_DROM0 | - DPORT_PRO_CACHE_MASK_DRAM1 ); - + (DPORT_PRO_CACHE_MASK_IRAM0) | (DPORT_PRO_CACHE_MASK_IRAM1 & 0) | + (DPORT_PRO_CACHE_MASK_IROM0 & 0) | DPORT_PRO_CACHE_MASK_DROM0 | + DPORT_PRO_CACHE_MASK_DRAM1 ); +#if !CONFIG_FREERTOS_UNICORE DPORT_REG_CLR_BIT( DPORT_APP_CACHE_CTRL1_REG, - (DPORT_APP_CACHE_MASK_IRAM0) | (DPORT_APP_CACHE_MASK_IRAM1 & 0) | - (DPORT_APP_CACHE_MASK_IROM0 & 0) | DPORT_APP_CACHE_MASK_DROM0 | - DPORT_APP_CACHE_MASK_DRAM1 ); - - Cache_Read_Enable( 0 ); - + (DPORT_APP_CACHE_MASK_IRAM0) | (DPORT_APP_CACHE_MASK_IRAM1 & 0) | + (DPORT_APP_CACHE_MASK_IROM0 & 0) | DPORT_APP_CACHE_MASK_DROM0 | + DPORT_APP_CACHE_MASK_DRAM1 ); +#endif +#elif CONFIG_IDF_TARGET_ESP32S2BETA + DPORT_REG_CLR_BIT( DPORT_PRO_ICACHE_CTRL1_REG, (DPORT_PRO_ICACHE_MASK_IRAM0) | (DPORT_PRO_ICACHE_MASK_IRAM1 & 0) | (DPORT_PRO_ICACHE_MASK_IROM0 & 0) | DPORT_PRO_ICACHE_MASK_DROM0 ); +#endif +#if CONFIG_IDF_TARGET_ESP32 + Cache_Read_Enable(0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + Cache_Resume_ICache(autoload); +#endif // Application will need to do Cache_Flush(1) and Cache_Read_Enable(1) ESP_LOGD(TAG, "start: 0x%08x", entry_addr); @@ -712,7 +767,6 @@ static void set_cache_and_start_app( (*entry)(); } - void bootloader_reset(void) { #ifdef BOOTLOADER_BUILD @@ -743,3 +797,24 @@ esp_err_t bootloader_sha256_hex_to_str(char *out_str, const uint8_t *in_array_he } return ESP_OK; } + +void bootloader_debug_buffer(const void *buffer, size_t length, const char *label) +{ +#if BOOT_LOG_LEVEL >= LOG_LEVEL_DEBUG + assert(length <= 128); // Avoid unbounded VLA size + const uint8_t *bytes = (const uint8_t *)buffer; + char hexbuf[length * 2 + 1]; + hexbuf[length * 2] = 0; + for (int i = 0; i < length; i++) { + for (int shift = 0; shift < 2; shift++) { + uint8_t nibble = (bytes[i] >> (shift ? 0 : 4)) & 0x0F; + if (nibble < 10) { + hexbuf[i * 2 + shift] = '0' + nibble; + } else { + hexbuf[i * 2 + shift] = 'a' + nibble - 10; + } + } + } + ESP_LOGD(TAG, "%s: %s", label, hexbuf); +#endif +} diff --git a/components/bootloader_support/src/esp32/bootloader_esp32.c b/components/bootloader_support/src/esp32/bootloader_esp32.c new file mode 100644 index 0000000000..7e9cba9130 --- /dev/null +++ b/components/bootloader_support/src/esp32/bootloader_esp32.c @@ -0,0 +1,88 @@ +// Copyright 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. + +#include "bootloader_common.h" +#include "sdkconfig.h" +#include "soc/efuse_reg.h" +#include "soc/gpio_sig_map.h" +#include "soc/io_mux_reg.h" +#include "esp32/rom/efuse.h" +#include "esp32/rom/gpio.h" +#include "esp32/rom/spi_flash.h" + +#define FLASH_CLK_IO SPI_CLK_GPIO_NUM +#define FLASH_CS_IO SPI_CS0_GPIO_NUM +#define FLASH_SPIQ_IO SPI_Q_GPIO_NUM +#define FLASH_SPID_IO SPI_D_GPIO_NUM +#define FLASH_SPIWP_IO SPI_WP_GPIO_NUM +#define FLASH_SPIHD_IO SPI_HD_GPIO_NUM + +void bootloader_configure_spi_pins(int drv) +{ + uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG); + uint32_t pkg_ver = chip_ver & 0x7; + + if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) { + // For ESP32D2WD the SPI pins are already configured + // flash clock signal should come from IO MUX. + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S); + } else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) { + // For ESP32PICOD2 the SPI pins are already configured + // flash clock signal should come from IO MUX. + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S); + } else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) { + // For ESP32PICOD4 the SPI pins are already configured + // flash clock signal should come from IO MUX. + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S); + } else { + const uint32_t spiconfig = ets_efuse_get_spiconfig(); + if (spiconfig == EFUSE_SPICONFIG_SPI_DEFAULTS) { + gpio_matrix_out(FLASH_CS_IO, SPICS0_OUT_IDX, 0, 0); + gpio_matrix_out(FLASH_SPIQ_IO, SPIQ_OUT_IDX, 0, 0); + gpio_matrix_in(FLASH_SPIQ_IO, SPIQ_IN_IDX, 0); + gpio_matrix_out(FLASH_SPID_IO, SPID_OUT_IDX, 0, 0); + gpio_matrix_in(FLASH_SPID_IO, SPID_IN_IDX, 0); + gpio_matrix_out(FLASH_SPIWP_IO, SPIWP_OUT_IDX, 0, 0); + gpio_matrix_in(FLASH_SPIWP_IO, SPIWP_IN_IDX, 0); + gpio_matrix_out(FLASH_SPIHD_IO, SPIHD_OUT_IDX, 0, 0); + gpio_matrix_in(FLASH_SPIHD_IO, SPIHD_IN_IDX, 0); + //select pin function gpio + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO); + // flash clock signal should come from IO MUX. + // set drive ability for clock + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S); + + #if CONFIG_SPIRAM_TYPE_ESPPSRAM32 || CONFIG_SPIRAM_TYPE_ESPPSRAM64 + uint32_t flash_id = g_rom_flashchip.device_id; + if (flash_id == FLASH_ID_GD25LQ32C) { + // Set drive ability for 1.8v flash in 80Mhz. + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA0_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA1_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA2_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA3_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CMD_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, 3, FUN_DRV_S); + } + #endif + } + } +} diff --git a/components/bootloader_support/src/esp32/bootloader_sha.c b/components/bootloader_support/src/esp32/bootloader_sha.c index 6ebbab8757..79862685cf 100644 --- a/components/bootloader_support/src/esp32/bootloader_sha.c +++ b/components/bootloader_support/src/esp32/bootloader_sha.c @@ -16,9 +16,10 @@ #include #include #include + #include "esp32/rom/sha.h" +#include "soc/dport_reg.h" #include "soc/hwcrypto_periph.h" -#include "esp32/rom/ets_sys.h" // TO REMOVE static uint32_t words_hashed; diff --git a/components/bootloader_support/src/esp32/flash_encrypt.c b/components/bootloader_support/src/esp32/flash_encrypt.c index 0e81ccff0b..5c72636db8 100644 --- a/components/bootloader_support/src/esp32/flash_encrypt.c +++ b/components/bootloader_support/src/esp32/flash_encrypt.c @@ -174,7 +174,7 @@ static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_cry /* If the last flash_crypt_cnt bit is burned or write-disabled, the device can't re-encrypt itself. */ - if (flash_crypt_wr_dis) { + if (flash_crypt_wr_dis || flash_crypt_cnt == 0xFF) { ESP_LOGE(TAG, "Cannot re-encrypt data (FLASH_CRYPT_CNT 0x%02x write disabled %d", flash_crypt_cnt, flash_crypt_wr_dis); return ESP_FAIL; } diff --git a/components/bootloader_support/src/esp32s2beta/bootloader_esp32s2beta.c b/components/bootloader_support/src/esp32s2beta/bootloader_esp32s2beta.c new file mode 100644 index 0000000000..452974f7d0 --- /dev/null +++ b/components/bootloader_support/src/esp32s2beta/bootloader_esp32s2beta.c @@ -0,0 +1,68 @@ +// Copyright 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. + +#include "bootloader_common.h" +#include "sdkconfig.h" +#include "soc/efuse_reg.h" +#include "soc/gpio_sig_map.h" +#include "soc/io_mux_reg.h" +#include "esp32s2beta/rom/efuse.h" +#include "esp32s2beta/rom/gpio.h" +#include "esp32s2beta/rom/spi_flash.h" + +#define FLASH_CLK_IO SPI_CLK_GPIO_NUM +#define FLASH_CS_IO SPI_CS0_GPIO_NUM +#define FLASH_SPIQ_IO SPI_Q_GPIO_NUM +#define FLASH_SPID_IO SPI_D_GPIO_NUM +#define FLASH_SPIWP_IO SPI_WP_GPIO_NUM +#define FLASH_SPIHD_IO SPI_HD_GPIO_NUM + +void bootloader_configure_spi_pins(int drv) +{ + const uint32_t spiconfig = ets_efuse_get_spiconfig(); + if (spiconfig == EFUSE_SPICONFIG_SPI_DEFAULTS) { + gpio_matrix_out(FLASH_CS_IO, SPICS0_OUT_IDX, 0, 0); + gpio_matrix_out(FLASH_SPIQ_IO, SPIQ_OUT_IDX, 0, 0); + gpio_matrix_in(FLASH_SPIQ_IO, SPIQ_IN_IDX, 0); + gpio_matrix_out(FLASH_SPID_IO, SPID_OUT_IDX, 0, 0); + gpio_matrix_in(FLASH_SPID_IO, SPID_IN_IDX, 0); + gpio_matrix_out(FLASH_SPIWP_IO, SPIWP_OUT_IDX, 0, 0); + gpio_matrix_in(FLASH_SPIWP_IO, SPIWP_IN_IDX, 0); + gpio_matrix_out(FLASH_SPIHD_IO, SPIHD_OUT_IDX, 0, 0); + gpio_matrix_in(FLASH_SPIHD_IO, SPIHD_IN_IDX, 0); + //select pin function gpio + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPIHD_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPIWP_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPICS0_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPIQ_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPID_U, PIN_FUNC_GPIO); + // flash clock signal should come from IO MUX. + // set drive ability for clock + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPICLK_U, FUNC_SPICLK_SPICLK); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPICLK_U, FUN_DRV, drv, FUN_DRV_S); + +#if CONFIG_SPIRAM_TYPE_ESPPSRAM32 || CONFIG_SPIRAM_TYPE_ESPPSRAM64 + uint32_t flash_id = g_rom_flashchip.device_id; + if (flash_id == FLASH_ID_GD25LQ32C) { + // Set drive ability for 1.8v flash in 80Mhz. + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPIHD_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPIWP_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPICS0_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPICLK_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPIQ_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPID_U, FUN_DRV, 3, FUN_DRV_S); + } +#endif + } +} diff --git a/components/bootloader_support/src/esp32s2beta/bootloader_sha.c b/components/bootloader_support/src/esp32s2beta/bootloader_sha.c new file mode 100644 index 0000000000..bb6b97396d --- /dev/null +++ b/components/bootloader_support/src/esp32s2beta/bootloader_sha.c @@ -0,0 +1,53 @@ +// Copyright 2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#include "bootloader_sha.h" +#include +#include +#include +#include + +#include "esp32s2beta/rom/sha.h" + +static SHA_CTX ctx; + +// Words per SHA256 block +// static const size_t BLOCK_WORDS = (64/sizeof(uint32_t)); +// Words in final SHA256 digest +// static const size_t DIGEST_WORDS = (32/sizeof(uint32_t)); + +bootloader_sha256_handle_t bootloader_sha256_start() +{ + // Enable SHA hardware + ets_sha_enable(); + ets_sha_init(&ctx, SHA2_256); + return &ctx; // Meaningless non-NULL value +} + +void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len) +{ + assert(handle != NULL); + assert(data_len % 4 == 0); + ets_sha_update(&ctx, data, data_len, false); +} + +void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest) +{ + assert(handle != NULL); + + if (digest == NULL) { + bzero(&ctx, sizeof(ctx)); + return; + } + ets_sha_finish(&ctx, digest); +} diff --git a/components/bootloader_support/src/esp32s2beta/flash_encrypt.c b/components/bootloader_support/src/esp32s2beta/flash_encrypt.c new file mode 100644 index 0000000000..5afa4b7e6d --- /dev/null +++ b/components/bootloader_support/src/esp32s2beta/flash_encrypt.c @@ -0,0 +1,303 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "bootloader_flash.h" +#include "bootloader_random.h" +#include "bootloader_utility.h" +#include "esp_image_format.h" +#include "esp_flash_encrypt.h" +#include "esp_flash_partitions.h" +#include "esp_secure_boot.h" +#include "esp_log.h" +#include "esp32s2beta/rom/secure_boot.h" +#include "esp32s2beta/rom/cache.h" +#include "esp32s2beta/rom/efuse.h" + +static const char *TAG = "flash_encrypt"; + +/* Static functions for stages of flash encryption */ +static esp_err_t initialise_flash_encryption(void); +static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_crypt_wr_dis); +static esp_err_t encrypt_bootloader(void); +static esp_err_t encrypt_and_load_partition_table(esp_partition_info_t *partition_table, int *num_partitions); +static esp_err_t encrypt_partition(int index, const esp_partition_info_t *partition); + +esp_err_t esp_flash_encrypt_check_and_update(void) +{ + // TODO: not clear why this is read from DATA1 and written to PGM_DATA2 + uint32_t cnt = REG_GET_FIELD(EFUSE_RD_REPEAT_DATA1_REG, EFUSE_SPI_BOOT_CRYPT_CNT); + ESP_LOGV(TAG, "SPI_BOOT_CRYPT_CNT 0x%x", cnt); + + bool flash_crypt_wr_dis = false; // TODO: check if CRYPT_CNT is write disabled + + _Static_assert(EFUSE_SPI_BOOT_CRYPT_CNT == 0x7, "assuming CRYPT_CNT is only 3 bits wide"); + + if (cnt == 1 || cnt == 3 || cnt == 7) { + /* Flash is already encrypted */ + int left; + if (cnt == 7 /* || disabled */) { + left = 0; + } else if (cnt == 3) { + left = 1; + } else { + left = 2; + } + ESP_LOGI(TAG, "flash encryption is enabled (%d plaintext flashes left)", left); + return ESP_OK; + } + else { + /* Flash is not encrypted, so encrypt it! */ + return encrypt_flash_contents(cnt, flash_crypt_wr_dis); + } +} + +static esp_err_t initialise_flash_encryption(void) +{ + /* Before first flash encryption pass, need to initialise key & crypto config */ + + /* Find out if a key is already set */ + bool has_aes128 = ets_efuse_find_purpose(ETS_EFUSE_KEY_PURPOSE_XTS_AES_128_KEY, NULL); + bool has_aes256_1 = ets_efuse_find_purpose(ETS_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_1, NULL); + bool has_aes256_2 = ets_efuse_find_purpose(ETS_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2, NULL); + + bool has_key = has_aes128 || (has_aes256_1 && has_aes256_2); + + if (!has_key && (has_aes256_1 || has_aes256_2)) { + ESP_LOGE(TAG, "Invalid efuse key blocks: Both AES-256 key blocks must be set."); + return ESP_ERR_INVALID_STATE; + } + + if (has_key) { + ESP_LOGI(TAG, "Using pre-existing key in efuse"); + + ESP_LOGE(TAG, "TODO: Check key is read & write protected"); // TODO + } else { + ESP_LOGI(TAG, "Generating new flash encryption key..."); +#ifdef CONFIG_SECURE_FLASH_ENCRYPTION_AES256 + const unsigned BLOCKS_NEEDED = 2; + const ets_efuse_purpose_t PURPOSE_START = ETS_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_1; + const ets_efuse_purpose_t PURPOSE_END = ETS_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2; +#else + const unsigned BLOCKS_NEEDED = 1; + const ets_efuse_purpose_t PURPOSE_START = ETS_EFUSE_KEY_PURPOSE_XTS_AES_128_KEY; + const ets_efuse_purpose_t PURPOSE_END = ETS_EFUSE_KEY_PURPOSE_XTS_AES_128_KEY; +#endif + + if (ets_efuse_count_unused_key_blocks() < BLOCKS_NEEDED) { + ESP_LOGE(TAG, "Not enough free efuse key blocks (need %d) to continue", BLOCKS_NEEDED); + return ESP_ERR_INVALID_STATE; + } + + for(ets_efuse_purpose_t purpose = PURPOSE_START; purpose <= PURPOSE_END; purpose++) { + uint32_t buf[8]; + bootloader_fill_random(buf, sizeof(buf)); + ets_efuse_block_t block = ets_efuse_find_unused_key_block(); + ESP_LOGD(TAG, "Writing ETS_EFUSE_BLOCK_KEY%d with purpose %d", + block - ETS_EFUSE_BLOCK_KEY0, purpose); + bootloader_debug_buffer(buf, sizeof(buf), "Key content"); + int r = ets_efuse_write_key(block, purpose, buf, sizeof(buf)); + bzero(buf, sizeof(buf)); + if (r != 0) { + ESP_LOGE(TAG, "Failed to write efuse block %d with purpose %d. Can't continue."); + return ESP_FAIL; + } + } + + ESP_LOGD(TAG, "Key generation complete"); + } + + ESP_LOGE(TAG, "TODO: burn remaining security protection bits"); // TODO + + return ESP_OK; +} + +/* Encrypt all flash data that should be encrypted */ +static esp_err_t encrypt_flash_contents(uint32_t spi_boot_crypt_cnt, bool flash_crypt_wr_dis) +{ + esp_err_t err; + esp_partition_info_t partition_table[ESP_PARTITION_TABLE_MAX_ENTRIES]; + int num_partitions; + + /* If the last spi_boot_crypt_cnt bit is burned or write-disabled, the + device can't re-encrypt itself. */ + if (flash_crypt_wr_dis || spi_boot_crypt_cnt == EFUSE_SPI_BOOT_CRYPT_CNT) { + ESP_LOGE(TAG, "Cannot re-encrypt data (SPI_BOOT_CRYPT_CNT 0x%02x write disabled %d", spi_boot_crypt_cnt, flash_crypt_wr_dis); + return ESP_FAIL; + } + + if (spi_boot_crypt_cnt == 0) { + /* Very first flash of encrypted data: generate keys, etc. */ + err = initialise_flash_encryption(); + if (err != ESP_OK) { + return err; + } + } + + err = encrypt_bootloader(); + if (err != ESP_OK) { + return err; + } + + err = encrypt_and_load_partition_table(partition_table, &num_partitions); + if (err != ESP_OK) { + return err; + } + + /* Now iterate the just-loaded partition table, looking for entries to encrypt + */ + + /* Go through each partition and encrypt if necessary */ + for (int i = 0; i < num_partitions; i++) { + err = encrypt_partition(i, &partition_table[i]); + if (err != ESP_OK) { + return err; + } + } + + ESP_LOGD(TAG, "All flash regions checked for encryption pass"); + + /* Set least significant 0-bit in spi_boot_crypt_cnt */ + int ffs_inv = __builtin_ffs((~spi_boot_crypt_cnt) & 0x7); + /* ffs_inv shouldn't be zero, as zero implies spi_boot_crypt_cnt == 0xFF */ + uint32_t new_spi_boot_crypt_cnt = spi_boot_crypt_cnt + (1 << (ffs_inv - 1)); + ESP_LOGD(TAG, "SPI_BOOT_CRYPT_CNT 0x%x -> 0x%x", spi_boot_crypt_cnt, new_spi_boot_crypt_cnt); + + ets_efuse_clear_program_registers(); + REG_SET_FIELD(EFUSE_PGM_DATA2_REG, EFUSE_SPI_BOOT_CRYPT_CNT, new_spi_boot_crypt_cnt); + ets_efuse_program(ETS_EFUSE_BLOCK0); + + ESP_LOGI(TAG, "Flash encryption completed"); + + return ESP_OK; +} + +static esp_err_t encrypt_bootloader(void) +{ + esp_err_t err; + uint32_t image_length; + /* Check for plaintext bootloader (verification will fail if it's already encrypted) */ + if (esp_image_verify_bootloader(&image_length) == ESP_OK) { + ESP_LOGD(TAG, "bootloader is plaintext. Encrypting..."); + err = esp_flash_encrypt_region(ESP_BOOTLOADER_OFFSET, image_length); + if (err != ESP_OK) { + ESP_LOGE(TAG, "Failed to encrypt bootloader in place: 0x%x", err); + return err; + } + + if (esp_secure_boot_enabled()) { + // TODO: anything different for secure boot? + } + } + else { + ESP_LOGW(TAG, "no valid bootloader was found"); + } + + return ESP_OK; +} + +static esp_err_t encrypt_and_load_partition_table(esp_partition_info_t *partition_table, int *num_partitions) +{ + esp_err_t err; + /* Check for plaintext partition table */ + err = bootloader_flash_read(ESP_PARTITION_TABLE_OFFSET, partition_table, ESP_PARTITION_TABLE_MAX_LEN, false); + if (err != ESP_OK) { + ESP_LOGE(TAG, "Failed to read partition table data"); + return err; + } + if (esp_partition_table_verify(partition_table, false, num_partitions) == ESP_OK) { + ESP_LOGD(TAG, "partition table is plaintext. Encrypting..."); + esp_err_t err = esp_flash_encrypt_region(ESP_PARTITION_TABLE_OFFSET, + FLASH_SECTOR_SIZE); + if (err != ESP_OK) { + ESP_LOGE(TAG, "Failed to encrypt partition table in place. %x", err); + return err; + } + } + else { + ESP_LOGE(TAG, "Failed to read partition table data - not plaintext?"); + return ESP_ERR_INVALID_STATE; + } + + /* Valid partition table loded */ + return ESP_OK; +} + + +static esp_err_t encrypt_partition(int index, const esp_partition_info_t *partition) +{ + esp_err_t err; + bool should_encrypt = (partition->flags & PART_FLAG_ENCRYPTED); + + if (partition->type == PART_TYPE_APP) { + /* check if the partition holds a valid unencrypted app */ + esp_image_metadata_t data_ignored; + err = esp_image_verify(ESP_IMAGE_VERIFY, + &partition->pos, + &data_ignored); + should_encrypt = (err == ESP_OK); + } else if (partition->type == PART_TYPE_DATA && partition->subtype == PART_SUBTYPE_DATA_OTA) { + /* check if we have ota data partition and the partition should be encrypted unconditionally */ + should_encrypt = true; + } + + if (!should_encrypt) { + return ESP_OK; + } + else { + /* should_encrypt */ + ESP_LOGI(TAG, "Encrypting partition %d at offset 0x%x (length 0x%x)...", index, partition->pos.offset, partition->pos.size); + + err = esp_flash_encrypt_region(partition->pos.offset, partition->pos.size); + ESP_LOGI(TAG, "Done encrypting"); + if (err != ESP_OK) { + ESP_LOGE(TAG, "Failed to encrypt partition %d", index); + } + return err; + } +} + + +esp_err_t esp_flash_encrypt_region(uint32_t src_addr, size_t data_length) +{ + esp_err_t err; + uint32_t buf[FLASH_SECTOR_SIZE / sizeof(uint32_t)]; + + if (src_addr % FLASH_SECTOR_SIZE != 0) { + ESP_LOGE(TAG, "esp_flash_encrypt_region bad src_addr 0x%x",src_addr); + return ESP_FAIL; + } + + for (size_t i = 0; i < data_length; i += FLASH_SECTOR_SIZE) { + uint32_t sec_start = i + src_addr; + err = bootloader_flash_read(sec_start, buf, FLASH_SECTOR_SIZE, false); + if (err != ESP_OK) { + goto flash_failed; + } + err = bootloader_flash_erase_sector(sec_start / FLASH_SECTOR_SIZE); + if (err != ESP_OK) { + goto flash_failed; + } + err = bootloader_flash_write(sec_start, buf, FLASH_SECTOR_SIZE, true); + if (err != ESP_OK) { + goto flash_failed; + } + } + return ESP_OK; + + flash_failed: + ESP_LOGE(TAG, "flash operation failed: 0x%x", err); + return err; +} diff --git a/components/bootloader_support/src/esp32s2beta/secure_boot.c b/components/bootloader_support/src/esp32s2beta/secure_boot.c new file mode 100644 index 0000000000..aac9405a07 --- /dev/null +++ b/components/bootloader_support/src/esp32s2beta/secure_boot.c @@ -0,0 +1,45 @@ +// 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. +#include "esp_secure_boot.h" +#include "esp_log.h" +#include "esp32s2beta/rom/secure_boot.h" + +#define TAG "secure_boot" + +esp_err_t esp_secure_boot_permanently_enable(void) +{ + uint8_t hash[32]; + + if (ets_efuse_secure_boot_enabled()) + { + ESP_LOGI(TAG, "secure boot is already enabled, continuing.."); + return ESP_OK; + } + + ESP_LOGI(TAG, "Verifying bootloader signature...\n"); + int r = ets_secure_boot_verify_bootloader(hash, false); + if (r != ESP_OK) { + ESP_LOGE(TAG, "Failed to verify bootloader signature"); + return r; + } + + ets_efuse_clear_program_registers(); + REG_SET_BIT(EFUSE_PGM_DATA3_REG, EFUSE_SECURE_BOOT_EN); + ets_efuse_program(ETS_EFUSE_BLOCK0); + + assert(ets_efuse_secure_boot_enabled()); + ESP_LOGI(TAG, "Secure boot permanently enabled"); + + return ESP_OK; +} diff --git a/components/bootloader_support/src/esp32s2beta/secure_boot_signatures.c b/components/bootloader_support/src/esp32s2beta/secure_boot_signatures.c new file mode 100644 index 0000000000..d553c1ee60 --- /dev/null +++ b/components/bootloader_support/src/esp32s2beta/secure_boot_signatures.c @@ -0,0 +1,92 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#include "sdkconfig.h" + +#include "bootloader_flash.h" +#include "bootloader_sha.h" +#include "esp_log.h" +#include "esp_image_format.h" +#include "esp32s2beta/rom/secure_boot.h" + +static const char* TAG = "secure_boot"; + +#define DIGEST_LEN 32 + +esp_err_t esp_secure_boot_verify_signature(uint32_t src_addr, uint32_t length) +{ + ets_secure_boot_key_digests_t trusted_keys = { 0 }; + uint8_t digest[DIGEST_LEN]; + const uint8_t *data; + + ESP_LOGD(TAG, "verifying signature src_addr 0x%x length 0x%x", src_addr, length); + + if ((src_addr + length) % 4096 != 0) { + ESP_LOGE(TAG, "addr 0x%x length 0x%x doesn't end on a sector boundary", src_addr, length); + return ESP_ERR_INVALID_ARG; + } + + data = bootloader_mmap(src_addr, length + sizeof(struct ets_secure_boot_sig_block)); + if(data == NULL) { + ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", src_addr, length+sizeof(ets_secure_boot_signature_t)); + return ESP_FAIL; + } + + // Calculate digest of main image +#ifdef BOOTLOADER_BUILD + bootloader_sha256_handle_t handle = bootloader_sha256_start(); + bootloader_sha256_data(handle, data, length); + bootloader_sha256_finish(handle, digest); +#else + /* Use thread-safe esp-idf SHA function */ + esp_sha(SHA2_256, data, length, digest); +#endif + + int r = ets_secure_boot_read_key_digests(&trusted_keys); + + if (r == ETS_OK) { + const ets_secure_boot_signature_t *sig = (const ets_secure_boot_signature_t *)(data + length); + // TODO: calling this function in IDF app context is unsafe + r = ets_secure_boot_verify_signature(sig, digest, &trusted_keys); + } + bootloader_munmap(data); + + return (r == ETS_OK) ? ESP_OK : ESP_FAIL; +} + +esp_err_t esp_secure_boot_verify_signature_block(uint32_t sig_block_flash_offs, const uint8_t *image_digest) +{ + ets_secure_boot_key_digests_t trusted_keys; + + assert(sig_block_flash_offs % 4096 == 0); // TODO: enforce this in a better way + + const ets_secure_boot_signature_t *sig = bootloader_mmap(sig_block_flash_offs, sizeof(ets_secure_boot_signature_t)); + + if (sig == NULL) { + ESP_LOGE(TAG, "Failed to mmap data at offset 0x%x", sig_block_flash_offs); + return ESP_FAIL; + } + + int r = ets_secure_boot_read_key_digests(&trusted_keys); + if (r != 0) { + ESP_LOGE(TAG, "No trusted key digests were found in efuse!"); + } else { + ESP_LOGD(TAG, "Verifying with RSA-PSS..."); + // TODO: calling this function in IDF app context is unsafe + r = ets_secure_boot_verify_signature(sig, image_digest, &trusted_keys); + } + + bootloader_munmap(sig); + + return (r == 0) ? ESP_OK : ESP_ERR_IMAGE_INVALID; +} diff --git a/components/bootloader_support/src/esp_image_format.c b/components/bootloader_support/src/esp_image_format.c index 5bb789c3d5..ea19323072 100644 --- a/components/bootloader_support/src/esp_image_format.c +++ b/components/bootloader_support/src/esp_image_format.c @@ -13,8 +13,6 @@ // limitations under the License. #include #include - -#include #include #include #include @@ -25,6 +23,13 @@ #include #include "bootloader_util.h" #include "bootloader_common.h" +#if CONFIG_IDF_TARGET_ESP32 +#include +#include +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include +#include +#endif /* Checking signatures as part of verifying images is necessary: - Always if secure boot is enabled @@ -164,7 +169,7 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_ } // if (do_verify) uint32_t next_addr = data->start_addr + sizeof(esp_image_header_t); - for(int i = 0; i < data->image.segment_count; i++) { + for (int i = 0; i < data->image.segment_count; i++) { esp_image_segment_header_t *header = &data->segments[i]; ESP_LOGV(TAG, "loading segment header %d at offset 0x%x", i, next_addr); err = process_segment(i, next_addr, header, silent, do_load, sha_handle, checksum); @@ -192,17 +197,24 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_ } } - if (data->image_len > part->size) { - FAIL_LOAD("Image length %d doesn't fit in partition length %d", data->image_len, part->size); - } + /* For secure boot on ESP32, we don't calculate SHA or verify signautre on bootloaders. + For ESP32S2, we do verify signature on botoloaders which includes the SHA calculation. - bool is_bootloader = (data->start_addr == ESP_BOOTLOADER_OFFSET); - /* For secure boot, we don't verify signature on bootloaders. - - For non-secure boot, we don't verify any SHA-256 hash appended to the bootloader because esptool.py may have - rewritten the header - rely on esptool.py having verified the bootloader at flashing time, instead. + (For non-secure boot, we don't verify any SHA-256 hash appended to the bootloader because + esptool.py may have rewritten the header - rely on esptool.py having verified the bootloader at flashing time, instead.) */ - if (!is_bootloader) { + bool verify_sha; +#if defined(CONFIG_SECURE_BOOT_ENABLED) && defined(CONFIG_IDF_TARGET_ESP32S2BETA) + verify_sha = true; +#else // ESP32, or ESP32S2 without secure boot enabled + verify_sha = (data->start_addr != ESP_BOOTLOADER_OFFSET); +#endif + + if (verify_sha) { + if (data->image_len > part->size) { + FAIL_LOAD("Image length %d doesn't fit in partition length %d", data->image_len, part->size); + } + #ifdef SECURE_BOOT_CHECK_SIGNATURE // secure boot images have a signature appended err = verify_secure_boot_signature(sha_handle, data); @@ -212,24 +224,24 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_ err = verify_simple_hash(sha_handle, data); } #endif // SECURE_BOOT_CHECK_SIGNATURE - } else { // is_bootloader + } else { // verify_sha // bootloader may still have a sha256 digest handle open if (sha_handle != NULL) { bootloader_sha256_finish(sha_handle, NULL); } - } - if (data->image.hash_appended) { - const void *hash = bootloader_mmap(data->start_addr + data->image_len - HASH_LEN, HASH_LEN); - if (hash == NULL) { - err = ESP_FAIL; - goto err; + if (data->image.hash_appended) { + const void *hash = bootloader_mmap(data->start_addr + data->image_len - HASH_LEN, HASH_LEN); + if (hash == NULL) { + err = ESP_FAIL; + goto err; + } + memcpy(data->image_digest, hash, HASH_LEN); + bootloader_munmap(hash); } - memcpy(data->image_digest, hash, HASH_LEN); - bootloader_munmap(hash); - } - sha_handle = NULL; - } // if (do_verify) + sha_handle = NULL; + } // verify_sha + } // do_verify if (err != ESP_OK) { goto err; @@ -241,7 +253,7 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_ uint32_t load_addr = data->segments[i].load_addr; if (should_load(load_addr)) { uint32_t *loaded = (uint32_t *)load_addr; - for (int j = 0; j < data->segments[i].data_len/sizeof(uint32_t); j++) { + for (int j = 0; j < data->segments[i].data_len / sizeof(uint32_t); j++) { loaded[j] ^= (j & 1) ? ram_obfs_value[0] : ram_obfs_value[1]; } } @@ -252,9 +264,9 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_ // Success! return ESP_OK; - err: +err: if (err == ESP_OK) { - err = ESP_ERR_IMAGE_INVALID; + err = ESP_ERR_IMAGE_INVALID; } if (sha_handle != NULL) { // Need to finish the hash process to free the handle @@ -263,7 +275,7 @@ static esp_err_t image_load(esp_image_load_mode_t mode, const esp_partition_pos_ // Prevent invalid/incomplete data leaking out bzero(data, sizeof(esp_image_metadata_t)); return err; -} + } esp_err_t bootloader_load_image(const esp_partition_pos_t *part, esp_image_metadata_t *data) { @@ -351,7 +363,7 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme ESP_LOGI(TAG, "segment %d: paddr=0x%08x vaddr=0x%08x size=0x%05x (%6d) %s", index, data_addr, load_addr, data_len, data_len, - (do_load)?"load":(is_mapping)?"map":""); + (do_load) ? "load" : (is_mapping) ? "map" : ""); } @@ -359,7 +371,7 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme /* Before loading segment, check it doesn't clobber bootloader RAM. */ if (do_load) { const intptr_t load_end = load_addr + data_len; - if (load_end <= (intptr_t) SOC_DIRAM_DRAM_HIGH) { + if (load_end < (intptr_t) SOC_DRAM_HIGH) { /* Writing to DRAM */ intptr_t sp = (intptr_t)get_sp(); if (load_end > sp - STACK_LOAD_HEADROOM) { @@ -380,7 +392,7 @@ static esp_err_t process_segment(int index, uint32_t flash_addr, esp_image_segme const intptr_t loader_iram_end = (intptr_t) &_loader_text_end; if (bootloader_util_regions_overlap(loader_iram_start, loader_iram_end, - load_addr, load_end)) { + load_addr, load_end)) { ESP_LOGE(TAG, "Segment %d (0x%08x-0x%08x) overlaps bootloader IRAM (0x%08x-0x%08x)", index, load_addr, load_end, loader_iram_start, loader_iram_end); return ESP_ERR_IMAGE_INVALID; @@ -425,7 +437,7 @@ static esp_err_t process_segment_data(intptr_t load_addr, uint32_t data_addr, ui } const uint32_t *data = (const uint32_t *)bootloader_mmap(data_addr, data_len); - if(!data) { + if (!data) { ESP_LOGE(TAG, "bootloader_mmap(0x%x, 0x%x) failed", data_addr, data_len); return ESP_FAIL; @@ -448,7 +460,7 @@ static esp_err_t process_segment_data(intptr_t load_addr, uint32_t data_addr, ui const uint32_t *src = data; for (int i = 0; i < data_len; i += 4) { - int w_i = i/4; // Word index + int w_i = i / 4; // Word index uint32_t w = src[w_i]; if (checksum != NULL) { *checksum ^= w; @@ -477,7 +489,7 @@ static esp_err_t process_segment_data(intptr_t load_addr, uint32_t data_addr, ui static esp_err_t verify_segment_header(int index, const esp_image_segment_header_t *segment, uint32_t segment_data_offs, bool silent) { if ((segment->data_len & 3) != 0 - || segment->data_len >= SIXTEEN_MB) { + || segment->data_len >= SIXTEEN_MB) { if (!silent) { ESP_LOGE(TAG, "invalid segment length 0x%x", segment->data_len); } @@ -493,7 +505,7 @@ static esp_err_t verify_segment_header(int index, const esp_image_segment_header ESP_LOGV(TAG, "segment %d map_segment %d segment_data_offs 0x%x load_addr 0x%x", index, map_segment, segment_data_offs, load_addr); if (map_segment - && ((segment_data_offs % SPI_FLASH_MMU_PAGE_SIZE) != (load_addr % SPI_FLASH_MMU_PAGE_SIZE))) { + && ((segment_data_offs % SPI_FLASH_MMU_PAGE_SIZE) != (load_addr % SPI_FLASH_MMU_PAGE_SIZE))) { if (!silent) { ESP_LOGE(TAG, "Segment %d load address 0x%08x, doesn't match data 0x%08x", index, load_addr, segment_data_offs); @@ -507,7 +519,7 @@ static esp_err_t verify_segment_header(int index, const esp_image_segment_header static bool should_map(uint32_t load_addr) { return (load_addr >= SOC_IROM_LOW && load_addr < SOC_IROM_HIGH) - || (load_addr >= SOC_DROM_LOW && load_addr < SOC_DROM_HIGH); + || (load_addr >= SOC_DROM_LOW && load_addr < SOC_DROM_HIGH); } static bool should_load(uint32_t load_addr) @@ -566,8 +578,8 @@ esp_err_t esp_image_verify_bootloader_data(esp_image_metadata_t *data) .size = ESP_PARTITION_TABLE_OFFSET - ESP_BOOTLOADER_OFFSET, }; return esp_image_verify(ESP_IMAGE_VERIFY, - &bootloader_part, - data); + &bootloader_part, + data); } @@ -582,9 +594,9 @@ static esp_err_t verify_checksum(bootloader_sha256_handle_t sha_handle, uint32_t esp_err_t err = bootloader_flash_read(data->start_addr + unpadded_length, buf, length - unpadded_length, true); uint8_t calc = buf[length - unpadded_length - 1]; uint8_t checksum = (checksum_word >> 24) - ^ (checksum_word >> 16) - ^ (checksum_word >> 8) - ^ (checksum_word >> 0); + ^ (checksum_word >> 16) + ^ (checksum_word >> 8) + ^ (checksum_word >> 0); if (err != ESP_OK || checksum != calc) { ESP_LOGE(TAG, "Checksum failed. Calculated 0x%x read 0x%x", checksum, calc); return ESP_ERR_IMAGE_INVALID; @@ -602,26 +614,36 @@ static esp_err_t verify_checksum(bootloader_sha256_handle_t sha_handle, uint32_t return ESP_OK; } -static void debug_log_hash(const uint8_t *image_hash, const char *caption); - static esp_err_t verify_secure_boot_signature(bootloader_sha256_handle_t sha_handle, esp_image_metadata_t *data) { uint8_t image_hash[HASH_LEN] = { 0 }; + uint32_t end = data->start_addr + data->image_len; ESP_LOGI(TAG, "Verifying image signature..."); // For secure boot, we calculate the signature hash over the whole file, which includes any "simple" hash // appended to the image for corruption detection if (data->image.hash_appended) { - const void *simple_hash = bootloader_mmap(data->start_addr + data->image_len - HASH_LEN, HASH_LEN); + const void *simple_hash = bootloader_mmap(end - HASH_LEN, HASH_LEN); bootloader_sha256_data(sha_handle, simple_hash, HASH_LEN); bootloader_munmap(simple_hash); } +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA + // Pad to 4096 byte sector boundary + if (end % FLASH_SECTOR_SIZE != 0) { + uint32_t pad_len = FLASH_SECTOR_SIZE - (end % FLASH_SECTOR_SIZE); + const void *padding = bootloader_mmap(end, pad_len); + bootloader_sha256_data(sha_handle, padding, pad_len); + bootloader_munmap(padding); + end += pad_len; + } +#endif + bootloader_sha256_finish(sha_handle, image_hash); // Log the hash for debugging - debug_log_hash(image_hash, "Calculated secure boot hash"); + bootloader_debug_buffer(image_hash, HASH_LEN, "Calculated secure boot hash"); // Use hash to verify signature block const esp_secure_boot_sig_block_t *sig_block = bootloader_mmap(data->start_addr + data->image_len, sizeof(esp_secure_boot_sig_block_t)); @@ -646,6 +668,11 @@ static esp_err_t verify_secure_boot_signature(bootloader_sha256_handle_t sha_han return ESP_ERR_IMAGE_INVALID; } +#if CONFIG_IDF_TARGET_ESP32S2BETA + // Adjust image length result to include the appended signature + data->image_len = end - data->start_addr + sizeof(ets_secure_boot_signature_t); +#endif + return ESP_OK; } @@ -655,13 +682,13 @@ static esp_err_t verify_simple_hash(bootloader_sha256_handle_t sha_handle, esp_i bootloader_sha256_finish(sha_handle, image_hash); // Log the hash for debugging - debug_log_hash(image_hash, "Calculated hash"); + bootloader_debug_buffer(image_hash, HASH_LEN, "Calculated hash"); // Simple hash for verification only const void *hash = bootloader_mmap(data->start_addr + data->image_len - HASH_LEN, HASH_LEN); if (memcmp(hash, image_hash, HASH_LEN) != 0) { ESP_LOGE(TAG, "Image hash failed - image is corrupt"); - debug_log_hash(hash, "Expected hash"); + bootloader_debug_buffer(hash, HASH_LEN, "Expected hash"); bootloader_munmap(hash); return ESP_ERR_IMAGE_INVALID; } @@ -669,14 +696,3 @@ static esp_err_t verify_simple_hash(bootloader_sha256_handle_t sha_handle, esp_i bootloader_munmap(hash); return ESP_OK; } - -// Log a hash as a hex string -static void debug_log_hash(const uint8_t *image_hash, const char *label) -{ -#if BOOT_LOG_LEVEL >= LOG_LEVEL_DEBUG - char hash_print[HASH_LEN * 2 + 1]; - hash_print[HASH_LEN * 2] = 0; - bootloader_sha256_hex_to_str(hash_print, image_hash, HASH_LEN); - ESP_LOGD(TAG, "%s: %s", label, hash_print); -#endif -} diff --git a/components/bootloader_support/src/flash_qio_mode.c b/components/bootloader_support/src/flash_qio_mode.c index adf536893d..577994d561 100644 --- a/components/bootloader_support/src/flash_qio_mode.c +++ b/components/bootloader_support/src/flash_qio_mode.c @@ -16,14 +16,28 @@ #include "flash_qio_mode.h" #include "esp_log.h" #include "esp_err.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/spi_flash.h" #include "esp32/rom/efuse.h" -#include "soc/spi_periph.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/spi_flash.h" +#include "esp32s2beta/rom/efuse.h" +#endif +#include "soc/spi_struct.h" +#include "soc/spi_reg.h" +#if CONFIG_IDF_TARGET_ESP32S2BETA +#include "soc/spi_mem_struct.h" +#endif #include "soc/efuse_periph.h" +#include "soc/io_mux_reg.h" #include "sdkconfig.h" /* SPI flash controller */ +#if CONFIG_IDF_TARGET_ESP32 #define SPIFLASH SPI1 +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define SPIFLASH SPIMEM1 +#endif /* SPI commands (actual on-wire commands not SPI controller bitmasks) Suitable for use with the execute_flash_command static function. @@ -42,7 +56,8 @@ static const char *TAG = "qio_mode"; typedef unsigned (*read_status_fn_t)(void); typedef void (*write_status_fn_t)(unsigned); -typedef struct __attribute__((packed)) { +typedef struct __attribute__((packed)) +{ const char *manufacturer; uint8_t mfg_id; /* 8-bit JEDEC manufacturer ID */ uint16_t flash_id; /* 16-bit JEDEC flash chip ID */ @@ -90,7 +105,7 @@ static void write_status_8b_xmc25qu64a(unsigned new_status); Searching of this table stops when the first match is found. */ const static qio_info_t chip_data[] = { -/* Manufacturer, mfg_id, flash_id, id mask, Read Status, Write Status, QIE Bit */ + /* Manufacturer, mfg_id, flash_id, id mask, Read Status, Write Status, QIE Bit */ { "MXIC", 0xC2, 0x2000, 0xFF00, read_status_8b_rdsr, write_status_8b_wrsr, 6 }, { "ISSI", 0x9D, 0x4000, 0xCF00, read_status_8b_rdsr, write_status_8b_wrsr, 6 }, /* IDs 0x40xx, 0x70xx */ { "WinBond", 0xEF, 0x4000, 0xFF00, read_status_16b_rdsr_rdsr2, write_status_16b_wrsr, 9 }, @@ -109,8 +124,8 @@ const static qio_info_t chip_data[] = { #define NUM_CHIPS (sizeof(chip_data) / sizeof(qio_info_t)) static esp_err_t enable_qio_mode(read_status_fn_t read_status_fn, - write_status_fn_t write_status_fn, - uint8_t status_qio_bit); + write_status_fn_t write_status_fn, + uint8_t status_qio_bit); /* Generic function to use the "user command" SPI controller functionality to send commands to the SPI flash and read the respopnse. @@ -128,6 +143,46 @@ uint32_t bootloader_read_flash_id(void) return id; } +#if CONFIG_IDF_TARGET_ESP32S2BETA +#define FLASH_WRAP_CMD 0x77 +typedef enum { + FLASH_WRAP_MODE_8B = 0, + FLASH_WRAP_MODE_16B = 2, + FLASH_WRAP_MODE_32B = 4, + FLASH_WRAP_MODE_64B = 6, + FLASH_WRAP_MODE_DISABLE = 1 +} spi_flash_wrap_mode_t; +static esp_err_t spi_flash_wrap_set(spi_flash_wrap_mode_t mode) +{ + uint32_t reg_bkp_ctrl = SPIFLASH.ctrl.val; + uint32_t reg_bkp_usr = SPIFLASH.user.val; + SPIFLASH.user.fwrite_dio = 0; + SPIFLASH.user.fwrite_dual = 0; + SPIFLASH.user.fwrite_qio = 1; + SPIFLASH.user.fwrite_quad = 0; + SPIFLASH.ctrl.fcmd_dual = 0; + SPIFLASH.ctrl.fcmd_quad = 0; + SPIFLASH.user.usr_dummy = 0; + SPIFLASH.user.usr_addr = 1; + SPIFLASH.user.usr_command = 1; + SPIFLASH.user2.usr_command_bitlen = 7; + SPIFLASH.user2.usr_command_value = FLASH_WRAP_CMD; + SPIFLASH.user1.usr_addr_bitlen = 23; + SPIFLASH.addr = 0; + SPIFLASH.user.usr_miso = 0; + SPIFLASH.user.usr_mosi = 1; + SPIFLASH.mosi_dlen.usr_mosi_bit_len = 7; + SPIFLASH.data_buf[0] = (uint32_t) mode << 4;; + SPIFLASH.cmd.usr = 1; + while (SPIFLASH.cmd.usr != 0) { + } + + SPIFLASH.ctrl.val = reg_bkp_ctrl; + SPIFLASH.user.val = reg_bkp_usr; + return ESP_OK; +} +#endif + void bootloader_enable_qio_mode(void) { uint32_t raw_flash_id; @@ -145,7 +200,7 @@ void bootloader_enable_qio_mode(void) flash_id = raw_flash_id & 0xFFFF; ESP_LOGD(TAG, "Manufacturer ID 0x%02x chip ID 0x%04x", mfg_id, flash_id); - for (i = 0; i < NUM_CHIPS-1; i++) { + for (i = 0; i < NUM_CHIPS - 1; i++) { const qio_info_t *chip = &chip_data[i]; if (mfg_id == chip->mfg_id && (flash_id & chip->id_mask) == (chip->flash_id & chip->id_mask)) { ESP_LOGI(TAG, "Enabling QIO for flash chip %s", chip_data[i].manufacturer); @@ -156,19 +211,22 @@ void bootloader_enable_qio_mode(void) if (i == NUM_CHIPS - 1) { ESP_LOGI(TAG, "Enabling default flash chip QIO"); } - +#if CONFIG_IDF_TARGET_ESP32S2BETA + spi_flash_wrap_set(FLASH_WRAP_MODE_DISABLE); +#endif enable_qio_mode(chip_data[i].read_status_fn, chip_data[i].write_status_fn, chip_data[i].status_qio_bit); } static esp_err_t enable_qio_mode(read_status_fn_t read_status_fn, - write_status_fn_t write_status_fn, - uint8_t status_qio_bit) + write_status_fn_t write_status_fn, + uint8_t status_qio_bit) { uint32_t status; const uint32_t spiconfig = ets_efuse_get_spiconfig(); +#if CONFIG_IDF_TARGET_ESP32 if (spiconfig != EFUSE_SPICONFIG_SPI_DEFAULTS && spiconfig != EFUSE_SPICONFIG_HSPI_DEFAULTS) { // spiconfig specifies a custom efuse pin configuration. This config defines all pins -except- WP, // which is compiled into the bootloader instead. @@ -178,27 +236,28 @@ static esp_err_t enable_qio_mode(read_status_fn_t read_status_fn, //assignment from that chip's WP pin. uint32_t pkg_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG); if (CONFIG_BOOTLOADER_SPI_WP_PIN != ESP32_D2WD_WP_GPIO && - (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || - pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 || - pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4)) { + (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || + pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 || + pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4)) { ESP_LOGW(TAG, "Chip is ESP32-D2WD/ESP32-PICOD4 but flash WP pin is different value to internal flash"); } } +#endif esp_rom_spiflash_wait_idle(&g_rom_flashchip); status = read_status_fn(); ESP_LOGD(TAG, "Initial flash chip status 0x%x", status); - if ((status & (1< 0; +#if CONFIG_IDF_TARGET_ESP32 SPIFLASH.miso_dlen.usr_miso_dbitlen = miso_len ? (miso_len - 1) : 0; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SPIFLASH.miso_dlen.usr_miso_bit_len = miso_len ? (miso_len - 1) : 0; +#endif SPIFLASH.user.usr_mosi = mosi_len > 0; +#if CONFIG_IDF_TARGET_ESP32 SPIFLASH.mosi_dlen.usr_mosi_dbitlen = mosi_len ? (mosi_len - 1) : 0; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SPIFLASH.mosi_dlen.usr_mosi_bit_len = mosi_len ? (mosi_len - 1) : 0; +#endif SPIFLASH.data_buf[0] = mosi_data; if (g_rom_spiflash_dummy_len_plus[1]) { @@ -299,8 +377,8 @@ static uint32_t execute_flash_command(uint8_t command, uint32_t mosi_data, uint8 } SPIFLASH.cmd.usr = 1; - while(SPIFLASH.cmd.usr != 0) - { } + while (SPIFLASH.cmd.usr != 0) { + } SPIFLASH.ctrl.val = old_ctrl_reg; return SPIFLASH.data_buf[0]; diff --git a/components/bootloader_support/test/test_verify_image.c b/components/bootloader_support/test/test_verify_image.c index d5a7c84ae2..530beaa560 100644 --- a/components/bootloader_support/test/test_verify_image.c +++ b/components/bootloader_support/test/test_verify_image.c @@ -5,7 +5,6 @@ #include #include #include "string.h" -#include "esp32/rom/ets_sys.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -34,7 +33,7 @@ TEST_CASE("Verify bootloader image in flash", "[bootloader_support]") TEST_ASSERT_EQUAL(data.image_len, bootloader_length); } -TEST_CASE("Verify unit test app image", "[bootloader_support]") +TEST_CASE_ESP32("Verify unit test app image", "[bootloader_support]") { esp_image_metadata_t data = { 0 }; const esp_partition_t *running = esp_ota_get_running_partition(); diff --git a/components/bt/Kconfig b/components/bt/Kconfig index 6346b818f0..dfde444c7a 100644 --- a/components/bt/Kconfig +++ b/components/bt/Kconfig @@ -2,6 +2,7 @@ menu "Bluetooth" config BT_ENABLED bool "Bluetooth" + depends on IDF_TARGET_ESP32 help Select this option to enable Bluetooth and show the submenu with Bluetooth configuration choices. diff --git a/components/cxx/test/test_cxx.cpp b/components/cxx/test/test_cxx.cpp index 0bf92f324b..138e2f4eed 100644 --- a/components/cxx/test/test_cxx.cpp +++ b/components/cxx/test/test_cxx.cpp @@ -276,14 +276,14 @@ TEST_CASE("c++ exceptions emergency pool", "[cxx] [ignore]") #else // !CONFIG_COMPILER_CXX_EXCEPTIONS -TEST_CASE("std::out_of_range exception when -fno-exceptions", "[cxx][reset=abort,SW_CPU_RESET]") +TEST_CASE_ESP32("std::out_of_range exception when -fno-exceptions", "[cxx][reset=abort,SW_CPU_RESET]") { std::vector v(10); v.at(20) = 42; TEST_FAIL_MESSAGE("Unreachable because we are aborted on the line above"); } -TEST_CASE("std::bad_alloc exception when -fno-exceptions", "[cxx][reset=abort,SW_CPU_RESET]") +TEST_CASE_ESP32("std::bad_alloc exception when -fno-exceptions", "[cxx][reset=abort,SW_CPU_RESET]") { std::string s = std::string(2000000000, 'a'); (void)s; diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index f0509fcf19..31dce58c68 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -1,17 +1,13 @@ -set(srcs +set(srcs "can.c" "gpio.c" "i2c.c" "i2s.c" "ledc.c" - "mcpwm.c" "pcnt.c" "periph_ctrl.c" "rmt.c" "rtc_module.c" - "sdio_slave.c" - "sdmmc_host.c" - "sdmmc_transaction.c" "sdspi_crc.c" "sdspi_host.c" "sdspi_transaction.c" @@ -22,12 +18,29 @@ set(srcs "timer.c" "uart.c") +set(includes "include") + +if(IDF_TARGET STREQUAL "esp32") + # SDMMC and MCPWM are in ESP32 only. + list(APPEND srcs "mcpwm.c" + "sdio_slave.c" + "sdmmc_host.c" + "sdmmc_transaction.c") +endif() + +if(IDF_TARGET STREQUAL "esp32s2beta") + list(APPEND srcs "esp32s2beta/rtc_tempsensor.c" + "esp32s2beta/rtc_touchpad.c") + # currently only S2 beta has its own target-specific includes + list(APPEND includes "esp32s2beta/include") +endif() + idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "include" + INCLUDE_DIRS ${includes} PRIV_INCLUDE_DIRS "include/driver" REQUIRES esp_ringbuf soc) #cannot totally hide soc headers, since there are a lot arguments in the driver are chip-dependent if(GCC_NOT_5_2_0) # uses C11 atomic feature set_source_files_properties(spi_master.c PROPERTIES COMPILE_FLAGS -std=gnu11) -endif() \ No newline at end of file +endif() diff --git a/components/driver/can.c b/components/driver/can.c index 2fcda84ee4..3d6ff5a148 100644 --- a/components/driver/can.c +++ b/components/driver/can.c @@ -11,7 +11,7 @@ // 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. - +#include "sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/portmacro.h" #include "freertos/task.h" @@ -25,6 +25,7 @@ #include "driver/gpio.h" #include "driver/periph_ctrl.h" #include "driver/can.h" +#if CONFIG_IDF_TARGET_ESP32 /* ---------------------------- Definitions --------------------------------- */ //Internal Macros @@ -1049,3 +1050,4 @@ esp_err_t can_clear_receive_queue(void) return ESP_OK; } +#endif diff --git a/components/driver/component.mk b/components/driver/component.mk index bff34c912e..31aa32c297 100644 --- a/components/driver/component.mk +++ b/components/driver/component.mk @@ -1,8 +1,9 @@ # # Component Makefile # +COMPONENT_SRCDIRS := . $(IDF_TARGET) -COMPONENT_ADD_INCLUDEDIRS := include +COMPONENT_ADD_INCLUDEDIRS := include $(IDF_TARGET)/include COMPONENT_PRIV_INCLUDEDIRS := include/driver diff --git a/components/driver/esp32s2beta/include/temp_sensor.h b/components/driver/esp32s2beta/include/temp_sensor.h new file mode 100644 index 0000000000..09d2a6c5f3 --- /dev/null +++ b/components/driver/esp32s2beta/include/temp_sensor.h @@ -0,0 +1,99 @@ +// Copyright 2010-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. + +#pragma once + +#include +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + TSENS_DAC_L0 = 0, /*!< offset = -2, measure range: 50℃ ~ 125℃, error < 3℃. */ + TSENS_DAC_L1, /*!< offset = -1, measure range: 20℃ ~ 100℃, error < 2℃. */ + TSENS_DAC_L2, /*!< offset = 0, measure range:-10℃ ~ 80℃, error < 1℃. */ + TSENS_DAC_L3, /*!< offset = 1, measure range:-30℃ ~ 50℃, error < 2℃. */ + TSENS_DAC_L4, /*!< offset = 2, measure range:-40℃ ~ 20℃, error < 3℃. */ + TSENS_DAC_MAX, + TSENS_DAC_DEFAULT = TSENS_DAC_L2, +} temp_sensor_dac_offset_t; + +/** + * @brief Configuration for temperature sensor reading + */ +typedef struct { + temp_sensor_dac_offset_t dac_offset; /*!< The temperature measurement range is configured with a built-in temperature offset DAC. */ + uint8_t clk_div; /*!< Default: 6 */ +} temp_sensor_config_t; + +#define TSENS_CONFIG_DEFAULT() {.dac_offset = TSENS_DAC_L2, \ + .clk_div = 6} + +/** + * @brief Set parameter of temperature sensor. + * @param tsens + * @return + * - ESP_OK Success + */ +esp_err_t temp_sensor_set_config(temp_sensor_config_t tsens); + +/** + * @brief Get parameter of temperature sensor. + * @param tsens + * @return + * - ESP_OK Success + */ +esp_err_t temp_sensor_get_config(temp_sensor_config_t *tsens); + +/** + * @brief Start temperature sensor measure. + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG + */ +esp_err_t temp_sensor_start(void); + +/** + * @brief Stop temperature sensor measure. + * @return + * - ESP_OK Success + */ +esp_err_t temp_sensor_stop(void); + +/** + * @brief Read temperature sensor raw data. + * @param tsens_out Pointer to raw data, Range: 0 ~ 255 + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG `tsens_out` is NULL + * - ESP_ERR_INVALID_STATE temperature sensor dont start + */ +esp_err_t temp_sensor_read_raw(uint32_t *tsens_out); + +/** + * @brief Read temperature sensor data that is converted to degrees Celsius. + * @note Should not be called from interrupt. + * @param celsius The measure output value. + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG ARG is NULL. + * - ESP_ERR_INVALID_STATE The ambient temperature is out of range. + */ +esp_err_t temp_sensor_read_celsius(float *celsius); + +#ifdef __cplusplus +} +#endif diff --git a/components/driver/esp32s2beta/rtc_tempsensor.c b/components/driver/esp32s2beta/rtc_tempsensor.c new file mode 100644 index 0000000000..0f8d2a2d04 --- /dev/null +++ b/components/driver/esp32s2beta/rtc_tempsensor.c @@ -0,0 +1,144 @@ +// Copyright 2016-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. + +#include +#include +#include +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "esp_log.h" +#include "soc/rtc_io_reg.h" +#include "soc/rtc_io_struct.h" +#include "soc/sens_reg.h" +#include "soc/sens_struct.h" +#include "temp_sensor.h" +#include "esp32s2beta/rom/ets_sys.h" + +static const char *TAG = "tsens"; + +#define TSENS_CHECK(res, ret_val) ({ \ + if (!(res)) { \ + ESP_LOGE(TAG, "%s:%d (%s)", __FILE__, __LINE__, __FUNCTION__); \ + return (ret_val); \ + } \ +}) +#define TSENS_XPD_WAIT_DEFAULT 0xFF /* Set wait cycle time(8MHz) from power up to reset enable. */ +#define TSENS_ADC_FACTOR (0.4386) +#define TSENS_DAC_FACTOR (27.88) +#define TSENS_SYS_OFFSET (20.52) + +typedef struct { + int index; + int offset; + int set_val; + int range_min; + int range_max; + int error_max; +} tsens_dac_offset_t; + +static const tsens_dac_offset_t dac_offset[TSENS_DAC_MAX] = { + /* DAC Offset reg_val min max error */ + {TSENS_DAC_L0, -2, 5, 50, 125, 3}, + {TSENS_DAC_L1, -1, 7, 20, 100, 2}, + {TSENS_DAC_L2, 0, 15, -10, 80, 1}, + {TSENS_DAC_L3, 1, 11, -30, 50, 2}, + {TSENS_DAC_L4, 2, 10, -40, 20, 3}, +}; + +static SemaphoreHandle_t rtc_tsens_mux = NULL; + +esp_err_t temp_sensor_set_config(temp_sensor_config_t tsens) +{ + SENS.sar_tctrl.tsens_dac = dac_offset[tsens.dac_offset].set_val; + SENS.sar_tctrl.tsens_clk_div = tsens.clk_div; + SENS.sar_tctrl.tsens_power_up_force = 1; + SENS.sar_tctrl2.tsens_xpd_wait = TSENS_XPD_WAIT_DEFAULT; + SENS.sar_tctrl2.tsens_xpd_force = 1; + SENS.sar_tctrl2.tsens_reset = 1;// Reset the temp sensor. + SENS.sar_tctrl2.tsens_reset = 0;// Clear the reset status. + ESP_LOGI(TAG, "Config temperature range [%d°C ~ %d°C], error < %d°C", + dac_offset[tsens.dac_offset].range_min, + dac_offset[tsens.dac_offset].range_max, + dac_offset[tsens.dac_offset].error_max); + return ESP_OK; +} + +esp_err_t temp_sensor_get_config(temp_sensor_config_t *tsens) +{ + TSENS_CHECK(tsens != NULL, ESP_ERR_INVALID_ARG); + tsens->dac_offset = SENS.sar_tctrl.tsens_dac; + for(int i=TSENS_DAC_L0; idac_offset == dac_offset[i].set_val) { + tsens->dac_offset = dac_offset[i].index; + break; + } + } + tsens->clk_div = SENS.sar_tctrl.tsens_clk_div; + return ESP_OK; +} + +esp_err_t temp_sensor_start(void) +{ + if (rtc_tsens_mux == NULL) { + rtc_tsens_mux = xSemaphoreCreateMutex(); + } + TSENS_CHECK(rtc_tsens_mux != NULL, ESP_ERR_NO_MEM); + SENS.sar_tctrl.tsens_dump_out = 0; + SENS.sar_tctrl2.tsens_clkgate_en = 1; + SENS.sar_tctrl.tsens_power_up = 1; + return ESP_OK; +} + +esp_err_t temp_sensor_stop(void) +{ + SENS.sar_tctrl.tsens_power_up = 0; + SENS.sar_tctrl2.tsens_clkgate_en = 0; + if (rtc_tsens_mux != NULL) { + vSemaphoreDelete(rtc_tsens_mux); + rtc_tsens_mux = NULL; + } + return ESP_OK; +} + +esp_err_t temp_sensor_read_raw(uint32_t *tsens_out) +{ + TSENS_CHECK(tsens_out != NULL, ESP_ERR_INVALID_ARG); + TSENS_CHECK(rtc_tsens_mux != NULL, ESP_ERR_INVALID_STATE); + xSemaphoreTake(rtc_tsens_mux, portMAX_DELAY); + SENS.sar_tctrl.tsens_dump_out = 1; + while (!SENS.sar_tctrl.tsens_ready); + *tsens_out = SENS.sar_tctrl.tsens_out; + SENS.sar_tctrl.tsens_dump_out = 0; + xSemaphoreGive(rtc_tsens_mux); + return ESP_OK; +} + +esp_err_t temp_sensor_read_celsius(float *celsius) +{ + TSENS_CHECK(celsius != NULL, ESP_ERR_INVALID_ARG); + temp_sensor_config_t tsens; + uint32_t tsens_out = 0; + esp_err_t ret = temp_sensor_get_config(&tsens); + if (ret == ESP_OK) { + ret = temp_sensor_read_raw(&tsens_out); + TSENS_CHECK(ret == ESP_OK, ret); + const tsens_dac_offset_t *dac = &dac_offset[tsens.dac_offset]; + *celsius = (TSENS_ADC_FACTOR * (float)tsens_out - TSENS_DAC_FACTOR * dac->offset - TSENS_SYS_OFFSET); + if (*celsius < dac->range_min || *celsius > dac->range_max) { + ESP_LOGW(TAG, "Exceeding the temperature range!"); + ret = ESP_ERR_INVALID_STATE; + } + } + return ret; +} \ No newline at end of file diff --git a/components/driver/esp32s2beta/rtc_touchpad.c b/components/driver/esp32s2beta/rtc_touchpad.c new file mode 100644 index 0000000000..0f62e22ea0 --- /dev/null +++ b/components/driver/esp32s2beta/rtc_touchpad.c @@ -0,0 +1,674 @@ +// Copyright 2016-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. + +#include +#include +#include +#include "esp_log.h" +#include "soc/rtc_periph.h" +#include "soc/sens_periph.h" +#include "soc/rtc_io_reg.h" +#include "soc/rtc_io_struct.h" +#include "soc/sens_reg.h" +#include "soc/sens_struct.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/rtc_cntl_struct.h" +#include "soc/rtc.h" +#include "soc/periph_defs.h" +#include "rtc_io.h" +#include "touch_pad.h" +#include "freertos/FreeRTOS.h" +#include "freertos/xtensa_api.h" +#include "freertos/semphr.h" +#include "freertos/timers.h" +#include "esp_intr_alloc.h" +#include "sys/lock.h" +#include "driver/rtc_cntl.h" +#include "driver/gpio.h" +#include "sdkconfig.h" + +#include "esp32s2beta/rom/ets_sys.h" + +#ifndef NDEBUG +// Enable built-in checks in queue.h in debug builds +#define INVARIANTS +#endif +#include "sys/queue.h" + +#define TOUCH_PAD_FILTER_FACTOR_DEFAULT (4) // IIR filter coefficient. +#define TOUCH_PAD_SHIFT_DEFAULT (4) // Increase computing accuracy. +#define TOUCH_PAD_SHIFT_ROUND_DEFAULT (8) // ROUND = 2^(n-1); rounding off for fractional. +#define TOUCH_PAD_MEASURE_WAIT_DEFAULT (0xFF) // The timer frequency is 8Mhz, the max value is 0xff +#define DAC_ERR_STR_CHANNEL_ERROR "DAC channel error" + +#define RTC_MODULE_CHECK(a, str, ret_val) ({ \ + if (!(a)) { \ + ESP_LOGE(RTC_MODULE_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + return (ret_val); \ + } \ +}) + +#define RTC_RES_CHECK(res, ret_val) ({ \ + if ( (res) != ESP_OK) { \ + ESP_LOGE(RTC_MODULE_TAG,"%s:%d (%s)", __FILE__, __LINE__, __FUNCTION__);\ + return (ret_val); \ + } \ +}) + +static portMUX_TYPE rtc_spinlock = portMUX_INITIALIZER_UNLOCKED; +#define RTC_TOUCH_ENTER_CRITICAL() portENTER_CRITICAL(&rtc_spinlock) +#define RTC_TOUCH_EXIT_CRITICAL() portEXIT_CRITICAL(&rtc_spinlock) + +static SemaphoreHandle_t rtc_touch_mux = NULL; +static const char *RTC_MODULE_TAG = "RTC_MODULE"; + +/*--------------------------------------------------------------- + Touch Pad +---------------------------------------------------------------*/ +esp_err_t touch_pad_isr_register(intr_handler_t fn, void *arg, touch_pad_intr_mask_t intr_mask) +{ + assert(fn != NULL); + return rtc_isr_register(fn, arg, TOUCH_PAD_INTR_MASK_ALL & (intr_mask << RTC_CNTL_TOUCH_DONE_INT_ENA_S)); +} + +esp_err_t touch_pad_isr_deregister(intr_handler_t fn, void *arg) +{ + return rtc_isr_deregister(fn, arg); +} + +esp_err_t touch_pad_set_meas_time(uint16_t sleep_cycle, uint16_t meas_times) +{ + RTC_TOUCH_ENTER_CRITICAL(); + // touch sensor sleep cycle Time = sleep_cycle / RTC_SLOW_CLK( can be 150k or 32k depending on the options) + RTCCNTL.touch_ctrl1.touch_sleep_cycles = sleep_cycle; + //The times of charge and discharge in each measure process of touch channels. + RTCCNTL.touch_ctrl1.touch_meas_num = meas_times; + //the waiting cycles (in 8MHz) between TOUCH_START and TOUCH_XPD + RTCCNTL.touch_ctrl2.touch_xpd_wait = TOUCH_PAD_MEASURE_WAIT_DEFAULT; //wait volt stable + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_get_meas_time(uint16_t *sleep_cycle, uint16_t *meas_times) +{ + if (sleep_cycle) { + *sleep_cycle = RTCCNTL.touch_ctrl1.touch_sleep_cycles; + } + if (meas_times) { + *meas_times = RTCCNTL.touch_ctrl1.touch_meas_num; + } + return ESP_OK; +} + +esp_err_t touch_pad_set_inactive_connect(touch_pad_conn_type_t type) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_scan_ctrl.touch_inactive_connection = type; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_get_inactive_connect(touch_pad_conn_type_t *type) +{ + RTC_MODULE_CHECK(type != NULL, "parameter is NULL", ESP_ERR_INVALID_ARG); + *type = RTCCNTL.touch_scan_ctrl.touch_inactive_connection; + return ESP_OK; +} + +esp_err_t touch_pad_set_voltage(touch_high_volt_t refh, touch_low_volt_t refl, touch_volt_atten_t atten) +{ + RTC_TOUCH_ENTER_CRITICAL(); + if (refh > TOUCH_HVOLT_KEEP) { + RTCCNTL.touch_ctrl2.touch_drefh = refh; + } + if (refl > TOUCH_LVOLT_KEEP) { + RTCCNTL.touch_ctrl2.touch_drefl = refl; + } + if (atten > TOUCH_HVOLT_ATTEN_KEEP) { + RTCCNTL.touch_ctrl2.touch_drange = atten; + } + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_get_voltage(touch_high_volt_t *refh, touch_low_volt_t *refl, touch_volt_atten_t *atten) +{ + if (refh) { + *refh = RTCCNTL.touch_ctrl2.touch_drefh; + } + if (refl) { + *refl = RTCCNTL.touch_ctrl2.touch_drefl; + } + if (atten) { + *atten = RTCCNTL.touch_ctrl2.touch_drange; + } + return ESP_OK; +} + +esp_err_t touch_pad_set_cnt_mode(touch_pad_t touch_num, touch_cnt_slope_t slope, touch_tie_opt_t opt) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCIO.touch_pad[touch_num].tie_opt = opt; + RTCIO.touch_pad[touch_num].dac = slope; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_get_cnt_mode(touch_pad_t touch_num, touch_cnt_slope_t *slope, touch_tie_opt_t *opt) +{ + if (slope) { + *slope = RTCIO.touch_pad[touch_num].dac; + } + if (opt) { + *opt = RTCIO.touch_pad[touch_num].tie_opt; + } + return ESP_OK; +} + +esp_err_t touch_pad_io_init(touch_pad_t touch_num) +{ + RTC_MODULE_CHECK(touch_num != TOUCH_DENOISE_CHANNEL, + "please use `touch_pad_denoise_enable` to set denoise channel", ESP_ERR_INVALID_ARG); + rtc_gpio_init(touch_num); + rtc_gpio_set_direction(touch_num, RTC_GPIO_MODE_DISABLED); + rtc_gpio_pulldown_dis(touch_num); + rtc_gpio_pullup_dis(touch_num); + return ESP_OK; +} + +esp_err_t touch_pad_wait_init_done(void) +{ + // TODO + return ESP_FAIL; +} + +esp_err_t touch_pad_fsm_start(void) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_ctrl2.touch_clkgate_en = 1; //enable touch clock for FSM. or force enable. + SENS.sar_touch_chn_st.touch_channel_clr = TOUCH_PAD_BIT_MASK_MAX; // clear SENS_TOUCH_SLP_BASELINE + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_fsm_stop(void) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_ctrl2.touch_start_en = 0; //stop touch fsm + RTCCNTL.touch_ctrl2.touch_slp_timer_en = 0; + RTCCNTL.touch_ctrl2.touch_clkgate_en = 0; //enable touch clock for FSM. or force enable. + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_set_fsm_mode(touch_fsm_mode_t mode) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_ctrl2.touch_start_en = 0; //stop touch fsm + RTCCNTL.touch_ctrl2.touch_start_force = mode; + RTCCNTL.touch_ctrl2.touch_slp_timer_en = (mode == TOUCH_FSM_MODE_TIMER ? 1 : 0); + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_get_fsm_mode(touch_fsm_mode_t *mode) +{ + assert(mode != NULL); + *mode = RTCCNTL.touch_ctrl2.touch_start_force; + return ESP_OK; +} + +bool touch_pad_meas_is_done(void) +{ + return SENS.sar_touch_chn_st.touch_meas_done; +} + +esp_err_t touch_pad_sw_start(void) +{ + RTC_MODULE_CHECK((RTCCNTL.touch_ctrl2.touch_start_force == TOUCH_FSM_MODE_SW), + "touch fsm mode error", ESP_ERR_INVALID_STATE); + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_ctrl2.touch_start_en = 0; + RTCCNTL.touch_ctrl2.touch_start_en = 1; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_set_thresh(touch_pad_t touch_num, uint32_t threshold) +{ + RTC_MODULE_CHECK((touch_num < TOUCH_PAD_MAX) && (touch_num != TOUCH_DENOISE_CHANNEL), "touch num error", ESP_ERR_INVALID_ARG); + RTC_TOUCH_ENTER_CRITICAL(); + SENS.touch_thresh[touch_num - 1].thresh = threshold; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_get_thresh(touch_pad_t touch_num, uint32_t *threshold) +{ + if (threshold) { + *threshold = SENS.touch_thresh[touch_num - 1].thresh; + } + return ESP_OK; +} + +esp_err_t touch_pad_set_group_mask(uint16_t enable_mask) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_scan_ctrl.touch_scan_pad_map |= (enable_mask & TOUCH_PAD_BIT_MASK_MAX); + SENS.sar_touch_conf.touch_outen |= (enable_mask & TOUCH_PAD_BIT_MASK_MAX); + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_get_group_mask(uint16_t *enable_mask) +{ + RTC_TOUCH_ENTER_CRITICAL(); + *enable_mask = SENS.sar_touch_conf.touch_outen \ + & RTCCNTL.touch_scan_ctrl.touch_scan_pad_map \ + & TOUCH_PAD_BIT_MASK_MAX; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_clear_group_mask(uint16_t enable_mask) +{ + RTC_TOUCH_ENTER_CRITICAL(); + SENS.sar_touch_conf.touch_outen &= ~(enable_mask & TOUCH_PAD_BIT_MASK_MAX); + RTCCNTL.touch_scan_ctrl.touch_scan_pad_map &= ~(enable_mask & TOUCH_PAD_BIT_MASK_MAX); + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +uint32_t IRAM_ATTR touch_pad_get_status(void) +{ + return (SENS.sar_touch_chn_st.touch_pad_active & TOUCH_PAD_BIT_MASK_MAX); +} + +static esp_err_t touch_pad_clear_status(void) +{ + SENS.sar_touch_conf.touch_status_clr = 1; + return ESP_OK; +} + +touch_pad_t IRAM_ATTR touch_pad_get_scan_curr(void) +{ + return (touch_pad_t)(SENS.sar_touch_status0.touch_scan_curr); +} + +esp_err_t touch_pad_intr_enable(touch_pad_intr_mask_t int_mask) +{ + RTC_TOUCH_ENTER_CRITICAL(); + if (int_mask & TOUCH_PAD_INTR_MASK_DONE) { + RTCCNTL.int_ena.rtc_touch_done = 1; + } + if (int_mask & TOUCH_PAD_INTR_MASK_ACTIVE) { + RTCCNTL.int_ena.rtc_touch_active = 1; + } + if (int_mask & TOUCH_PAD_INTR_MASK_INACTIVE) { + RTCCNTL.int_ena.rtc_touch_inactive = 1; + } + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_intr_disable(touch_pad_intr_mask_t int_mask) +{ + RTC_TOUCH_ENTER_CRITICAL(); + if (int_mask & TOUCH_PAD_INTR_MASK_DONE) { + RTCCNTL.int_ena.rtc_touch_done = 0; + } + if (int_mask & TOUCH_PAD_INTR_MASK_ACTIVE) { + RTCCNTL.int_ena.rtc_touch_active = 0; + } + if (int_mask & TOUCH_PAD_INTR_MASK_INACTIVE) { + RTCCNTL.int_ena.rtc_touch_inactive = 0; + } + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +uint32_t touch_pad_intr_status_get_mask(void) +{ + return ((REG_READ(RTC_CNTL_INT_ST_REG) >> (RTC_CNTL_TOUCH_DONE_INT_ST_S)) & TOUCH_PAD_INTR_MASK_ALL); +} + +esp_err_t touch_pad_config(touch_pad_t touch_num) +{ + RTC_MODULE_CHECK(touch_num != TOUCH_DENOISE_CHANNEL, \ + "please use `touch_pad_denoise_enable` to set denoise channel", ESP_ERR_INVALID_ARG); + touch_pad_io_init(touch_num); + touch_pad_set_cnt_mode(touch_num, TOUCH_PAD_SLOPE_7, TOUCH_PAD_TIE_OPT_LOW); + touch_pad_set_thresh(touch_num, TOUCH_PAD_THRESHOLD_MAX); + touch_pad_set_group_mask(BIT(touch_num)); + return ESP_OK; +} + +esp_err_t touch_pad_init(void) +{ + if (rtc_touch_mux == NULL) { + rtc_touch_mux = xSemaphoreCreateMutex(); + } + if (rtc_touch_mux == NULL) { + return ESP_ERR_NO_MEM; + } + touch_pad_intr_disable(TOUCH_PAD_INTR_ALL); + touch_pad_clear_group_mask(TOUCH_PAD_BIT_MASK_MAX); + touch_pad_clear_status(); + touch_pad_set_meas_time(TOUCH_PAD_SLEEP_CYCLE_DEFAULT, TOUCH_PAD_MEASURE_CYCLE_DEFAULT); + // Set reference voltage for charging/discharging + touch_pad_set_voltage(TOUCH_HVOLT_2V7, TOUCH_LVOLT_0V5, TOUCH_HVOLT_ATTEN_0V5); + touch_pad_set_inactive_connect(TOUCH_PAD_CONN_GND); + return ESP_OK; +} + +esp_err_t touch_pad_deinit(void) +{ + RTC_MODULE_CHECK(rtc_touch_mux != NULL, "Touch pad not initialized", ESP_FAIL); + xSemaphoreTake(rtc_touch_mux, portMAX_DELAY); + touch_pad_fsm_stop(); + touch_pad_clear_status(); + touch_pad_intr_disable(TOUCH_PAD_INTR_ALL); + xSemaphoreGive(rtc_touch_mux); + vSemaphoreDelete(rtc_touch_mux); + rtc_touch_mux = NULL; + return ESP_OK; +} + +esp_err_t IRAM_ATTR touch_pad_read_raw_data(touch_pad_t touch_num, uint32_t *raw_data) +{ + if (raw_data) { + *raw_data = SENS.touch_meas[touch_num].meas_out; + } + return ESP_OK; +} + + +esp_err_t IRAM_ATTR touch_pad_filter_baseline_read(touch_pad_t touch_num, uint32_t *basedata) +{ + RTC_MODULE_CHECK(touch_num != TOUCH_DENOISE_CHANNEL, "denoise channel don't support", ESP_ERR_INVALID_ARG); + if (basedata) { + *basedata = SENS.sar_touch_status[touch_num - 1].touch_pad_baseline; + } + return ESP_OK; +} + +esp_err_t touch_pad_filter_debounce_read(touch_pad_t touch_num, uint32_t *debounce) +{ + RTC_MODULE_CHECK(touch_num != TOUCH_DENOISE_CHANNEL, "denoise channel don't support", ESP_ERR_INVALID_ARG); + if (debounce) { + *debounce = SENS.sar_touch_status[touch_num - 1].touch_pad_debounce; + } + return ESP_OK; +} + +/* Should be call after clk enable and filter enable. */ +esp_err_t touch_pad_filter_baseline_reset(touch_pad_t touch_num) +{ + RTC_TOUCH_ENTER_CRITICAL(); + if (touch_num == TOUCH_PAD_MAX) { + SENS.sar_touch_chn_st.touch_channel_clr = TOUCH_PAD_BIT_MASK_MAX; + } else { + SENS.sar_touch_chn_st.touch_channel_clr = BIT(touch_num); + } + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_filter_set_config(touch_filter_config_t *filter_info) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_filter_ctrl.touch_filter_mode = filter_info->mode; + RTCCNTL.touch_filter_ctrl.touch_debounce = filter_info->debounce_cnt; + RTCCNTL.touch_filter_ctrl.touch_hysteresis = filter_info->hysteresis_thr; + RTCCNTL.touch_filter_ctrl.touch_noise_thres = filter_info->noise_thr; + RTCCNTL.touch_filter_ctrl.touch_neg_noise_thres = filter_info->noise_neg_thr; + RTCCNTL.touch_filter_ctrl.touch_neg_noise_limit = filter_info->neg_noise_limit; + RTCCNTL.touch_filter_ctrl.touch_jitter_step = filter_info->jitter_step; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_filter_get_config(touch_filter_config_t *filter_info) +{ + RTC_TOUCH_ENTER_CRITICAL(); + filter_info->mode = RTCCNTL.touch_filter_ctrl.touch_filter_mode; + filter_info->debounce_cnt = RTCCNTL.touch_filter_ctrl.touch_debounce; + filter_info->hysteresis_thr = RTCCNTL.touch_filter_ctrl.touch_hysteresis; + filter_info->noise_thr = RTCCNTL.touch_filter_ctrl.touch_noise_thres; + filter_info->noise_neg_thr = RTCCNTL.touch_filter_ctrl.touch_neg_noise_thres; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_filter_enable(void) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_filter_ctrl.touch_filter_en = 1; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_filter_disable(void) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_filter_ctrl.touch_filter_en = 0; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_denoise_enable(void) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_scan_ctrl.touch_scan_pad_map &= ~(BIT(TOUCH_DENOISE_CHANNEL)); + RTCCNTL.touch_scan_ctrl.touch_denoise_en = 1; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_denoise_disable(void) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_scan_ctrl.touch_denoise_en = 0; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_denoise_set_config(touch_pad_denoise_t denoise) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCIO.touch_pad[TOUCH_DENOISE_CHANNEL].tie_opt = TOUCH_PAD_TIE_OPT_LOW; + RTCIO.touch_pad[TOUCH_DENOISE_CHANNEL].dac = TOUCH_PAD_SLOPE_7; + RTCCNTL.touch_ctrl2.touch_refc = denoise.cap_level; + RTCCNTL.touch_scan_ctrl.touch_denoise_res = denoise.grade; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_denoise_get_config(touch_pad_denoise_t *denoise) +{ + RTC_TOUCH_ENTER_CRITICAL(); + denoise->grade = RTCCNTL.touch_scan_ctrl.touch_denoise_res; + denoise->cap_level = RTCCNTL.touch_ctrl2.touch_refc; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_denoise_data_get(uint32_t *data) +{ + if (data) { + *data = SENS.sar_touch_status0.touch_denoise_data; + } + return ESP_OK; +} + +esp_err_t touch_pad_waterproof_set_config(touch_pad_waterproof_t waterproof) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_scan_ctrl.touch_out_ring = waterproof.guard_ring_pad; + RTCCNTL.touch_scan_ctrl.touch_bufdrv = waterproof.shield_driver; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_waterproof_get_config(touch_pad_waterproof_t *waterproof) +{ + if (waterproof) { + RTC_TOUCH_ENTER_CRITICAL(); + waterproof->guard_ring_pad = RTCCNTL.touch_scan_ctrl.touch_out_ring; + waterproof->shield_driver = RTCCNTL.touch_scan_ctrl.touch_bufdrv; + RTC_TOUCH_EXIT_CRITICAL(); + } + return ESP_OK; +} + +esp_err_t touch_pad_waterproof_enable(void) +{ + touch_pad_io_init(TOUCH_SHIELD_CHANNEL); + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_scan_ctrl.touch_scan_pad_map &= ~(BIT(TOUCH_SHIELD_CHANNEL)); + RTCCNTL.touch_scan_ctrl.touch_shield_pad_en = 1; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_waterproof_disable(void) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_scan_ctrl.touch_shield_pad_en = 0; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_proximity_set_config(touch_pad_proximity_t proximity) +{ + RTC_TOUCH_ENTER_CRITICAL(); + if (proximity.select_pad0) { + SENS.sar_touch_conf.touch_approach_pad0 = proximity.select_pad0; + } + if (proximity.select_pad1) { + SENS.sar_touch_conf.touch_approach_pad1 = proximity.select_pad1; + } + if (proximity.select_pad2) { + SENS.sar_touch_conf.touch_approach_pad2 = proximity.select_pad2; + } + RTCCNTL.touch_approach.touch_approach_meas_time = proximity.meas_num; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_proximity_get_config(touch_pad_proximity_t *proximity) +{ + if (proximity) { + RTC_TOUCH_ENTER_CRITICAL(); + proximity->select_pad0 = SENS.sar_touch_conf.touch_approach_pad0; + proximity->select_pad1 = SENS.sar_touch_conf.touch_approach_pad1; + proximity->select_pad2 = SENS.sar_touch_conf.touch_approach_pad2; + proximity->meas_num = RTCCNTL.touch_approach.touch_approach_meas_time; + RTC_TOUCH_EXIT_CRITICAL(); + } else { + return ESP_ERR_INVALID_ARG; + } + return ESP_OK; +} + +esp_err_t touch_pad_proximity_get_meas_cnt(touch_pad_t touch_num, uint32_t *cnt) +{ + if (cnt == NULL) { + return ESP_ERR_INVALID_ARG; + } + if (SENS.sar_touch_conf.touch_approach_pad0 == touch_num) { + *cnt = SENS.sar_touch_status16.touch_approach_pad0_cnt; + } else if (SENS.sar_touch_conf.touch_approach_pad1 == touch_num) { + *cnt = SENS.sar_touch_status16.touch_approach_pad1_cnt; + } else if (SENS.sar_touch_conf.touch_approach_pad2 == touch_num) { + *cnt = SENS.sar_touch_status16.touch_approach_pad2_cnt; + } else { + return ESP_ERR_INVALID_ARG; + } + return ESP_OK; +} + +esp_err_t touch_pad_proximity_data_get(touch_pad_t touch_num, uint32_t *measure_out) +{ + if ((SENS.sar_touch_conf.touch_approach_pad0 != touch_num) + && (SENS.sar_touch_conf.touch_approach_pad1 != touch_num) + && (SENS.sar_touch_conf.touch_approach_pad2 != touch_num)) { + return ESP_ERR_INVALID_ARG; + } + if (ESP_OK != touch_pad_filter_baseline_read(touch_num, measure_out)) { + return ESP_ERR_INVALID_ARG; + } + return ESP_OK; +} + +esp_err_t touch_pad_reset() +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_ctrl2.touch_reset = 0; + RTCCNTL.touch_ctrl2.touch_reset = 1; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +/************** sleep pad setting ***********************/ + +esp_err_t touch_pad_sleep_channel_config(touch_pad_sleep_channel_t slp_config) +{ + RTC_TOUCH_ENTER_CRITICAL(); + RTCCNTL.touch_slp_thres.touch_slp_pad = slp_config.touch_num; + RTCCNTL.touch_slp_thres.touch_slp_th = slp_config.sleep_pad_threshold; + RTCCNTL.touch_slp_thres.touch_slp_approach_en = slp_config.en_proximity; + RTC_TOUCH_EXIT_CRITICAL(); + return ESP_OK; +} + +esp_err_t touch_pad_sleep_channel_baseline_get(uint32_t *baseline) +{ + if (baseline) { + *baseline = REG_GET_FIELD(SENS_SAR_TOUCH_STATUS15_REG, SENS_TOUCH_SLP_BASELINE); + } else { + return ESP_ERR_INVALID_ARG; + } + return ESP_OK; +} + +esp_err_t touch_pad_sleep_channel_debounce_get(uint32_t *debounce) +{ + if (debounce) { + *debounce = REG_GET_FIELD(SENS_SAR_TOUCH_STATUS15_REG, SENS_TOUCH_SLP_DEBOUNCE); + } else { + return ESP_ERR_INVALID_ARG; + } + return ESP_OK; +} + +esp_err_t touch_pad_sleep_channel_proximity_cnt_get(uint32_t *approach_cnt) +{ + if (approach_cnt) { + *approach_cnt = REG_GET_FIELD(SENS_SAR_TOUCH_STATUS16_REG, SENS_TOUCH_SLP_APPROACH_CNT); + } else { + return ESP_ERR_INVALID_ARG; + } + return ESP_OK; +} + +esp_err_t touch_pad_get_wakeup_status(touch_pad_t *pad_num) +{ + if (pad_num) { + *pad_num = (touch_pad_t)RTCCNTL.touch_slp_thres.touch_slp_pad; + } else { + return ESP_ERR_INVALID_ARG; + } + return ESP_OK; +} diff --git a/components/driver/gpio.c b/components/driver/gpio.c index f27a181f6c..50865d8cc7 100644 --- a/components/driver/gpio.c +++ b/components/driver/gpio.c @@ -18,6 +18,8 @@ #include "driver/gpio.h" #include "driver/rtc_io.h" #include "soc/soc.h" +#include "soc/periph_defs.h" +#include "soc/rtc_cntl_reg.h" #include "soc/gpio_periph.h" #include "esp_log.h" #if !CONFIG_FREERTOS_UNICORE @@ -55,44 +57,60 @@ static portMUX_TYPE gpio_spinlock = portMUX_INITIALIZER_UNLOCKED; esp_err_t gpio_pullup_en(gpio_num_t gpio_num) { GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); +#if CONFIG_IDF_TARGET_ESP32 if (RTC_GPIO_IS_VALID_GPIO(gpio_num)) { rtc_gpio_pullup_en(gpio_num); } else { REG_SET_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PU); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_SET_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PU); +#endif return ESP_OK; } esp_err_t gpio_pullup_dis(gpio_num_t gpio_num) { GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); +#if CONFIG_IDF_TARGET_ESP32 if (RTC_GPIO_IS_VALID_GPIO(gpio_num)) { rtc_gpio_pullup_dis(gpio_num); } else { REG_CLR_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PU); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_CLR_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PU); +#endif return ESP_OK; } esp_err_t gpio_pulldown_en(gpio_num_t gpio_num) { GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); +#if CONFIG_IDF_TARGET_ESP32 if (RTC_GPIO_IS_VALID_GPIO(gpio_num)) { rtc_gpio_pulldown_en(gpio_num); } else { REG_SET_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PD); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_SET_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PD); +#endif return ESP_OK; } esp_err_t gpio_pulldown_dis(gpio_num_t gpio_num) { GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); +#if CONFIG_IDF_TARGET_ESP32 if (RTC_GPIO_IS_VALID_GPIO(gpio_num)) { rtc_gpio_pulldown_dis(gpio_num); } else { REG_CLR_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PD); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_CLR_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PD); +#endif return ESP_OK; } @@ -116,11 +134,17 @@ static void gpio_intr_status_clr(gpio_num_t gpio_num) static esp_err_t gpio_intr_enable_on_core (gpio_num_t gpio_num, uint32_t core_id) { gpio_intr_status_clr(gpio_num); +#if CONFIG_IDF_TARGET_ESP32 if (core_id == 0) { GPIO.pin[gpio_num].int_ena = GPIO_PRO_CPU_INTR_ENA; //enable pro cpu intr } else { GPIO.pin[gpio_num].int_ena = GPIO_APP_CPU_INTR_ENA; //enable pro cpu intr } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if (core_id == 0) { + GPIO.pin[gpio_num].int_ena = GPIO_PRO_CPU_INTR_ENA; //enable pro cpu intr + } +#endif return ESP_OK; } @@ -232,7 +256,11 @@ esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull) esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode) { GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); +#if CONFIG_IDF_TARGET_ESP32 if (gpio_num >= 34 && (mode & GPIO_MODE_DEF_OUTPUT)) { +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if (gpio_num >= 46 && (mode & GPIO_MODE_DEF_OUTPUT)) { +#endif ESP_LOGE(GPIO_TAG, "io_num=%d can only be input", gpio_num); return ESP_ERR_INVALID_ARG; } @@ -269,6 +297,7 @@ esp_err_t gpio_config(const gpio_config_t *pGPIOConfig) ESP_LOGE(GPIO_TAG, "GPIO_PIN mask error "); return ESP_ERR_INVALID_ARG; } +#if CONFIG_IDF_TARGET_ESP32 if ((pGPIOConfig->mode) & (GPIO_MODE_DEF_OUTPUT)) { //GPIO 34/35/36/37/38/39 can only be used as input mode; if ((gpio_pin_mask & ( GPIO_SEL_34 | GPIO_SEL_35 | GPIO_SEL_36 | GPIO_SEL_37 | GPIO_SEL_38 | GPIO_SEL_39))) { @@ -276,6 +305,12 @@ esp_err_t gpio_config(const gpio_config_t *pGPIOConfig) return ESP_ERR_INVALID_ARG; } } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if ( (pGPIOConfig->mode & GPIO_MODE_DEF_OUTPUT) && (gpio_pin_mask & GPIO_SEL_46) ) { + ESP_LOGE(GPIO_TAG, "GPIO46 can only be used as input mode"); + return ESP_ERR_INVALID_ARG; + } +#endif do { io_reg = GPIO_PIN_MUX_REG[io_num]; if (((gpio_pin_mask >> io_num) & BIT(0))) { @@ -363,14 +398,24 @@ static void IRAM_ATTR gpio_intr_service(void* arg) return; } //read status to get interrupt status for GPIO0-31 - const uint32_t gpio_intr_status = (isr_core_id == 0) ? GPIO.pcpu_int : GPIO.acpu_int; + uint32_t gpio_intr_status; +#ifdef CONFIG_IDF_TARGET_ESP32 + gpio_intr_status = (isr_core_id == 0) ? GPIO.pcpu_int : GPIO.acpu_int; +#else + gpio_intr_status = GPIO.pcpu_int; +#endif if (gpio_intr_status) { gpio_isr_loop(gpio_intr_status, 0); GPIO.status_w1tc = gpio_intr_status; } //read status1 to get interrupt status for GPIO32-39 - const uint32_t gpio_intr_status_h = (isr_core_id == 0) ? GPIO.pcpu_int1.intr : GPIO.acpu_int1.intr; + uint32_t gpio_intr_status_h; +#ifdef CONFIG_IDF_TARGET_ESP32 + gpio_intr_status_h = (isr_core_id == 0) ? GPIO.pcpu_int1.intr : GPIO.acpu_int1.intr; +#else + gpio_intr_status_h = GPIO.pcpu_int1.intr; +#endif if (gpio_intr_status_h) { gpio_isr_loop(gpio_intr_status_h, 32); GPIO.status1_w1tc.intr_st = gpio_intr_status_h; @@ -498,12 +543,15 @@ esp_err_t gpio_set_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t streng { GPIO_CHECK(GPIO_IS_VALID_OUTPUT_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); GPIO_CHECK(strength < GPIO_DRIVE_CAP_MAX, "GPIO drive capability error", ESP_ERR_INVALID_ARG); - +#if CONFIG_IDF_TARGET_ESP32 if (RTC_GPIO_IS_VALID_GPIO(gpio_num)) { rtc_gpio_set_drive_capability(gpio_num, strength); } else { SET_PERI_REG_BITS(GPIO_PIN_MUX_REG[gpio_num], FUN_DRV_V, strength, FUN_DRV_S); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SET_PERI_REG_BITS(GPIO_PIN_MUX_REG[gpio_num], FUN_DRV_V, strength, FUN_DRV_S); +#endif return ESP_OK; } @@ -511,15 +559,19 @@ esp_err_t gpio_get_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t* stren { GPIO_CHECK(GPIO_IS_VALID_OUTPUT_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); GPIO_CHECK(strength != NULL, "GPIO drive capability pointer error", ESP_ERR_INVALID_ARG); - +#if CONFIG_IDF_TARGET_ESP32 if (RTC_GPIO_IS_VALID_GPIO(gpio_num)) { return rtc_gpio_get_drive_capability(gpio_num, strength); } else { *strength = GET_PERI_REG_BITS2(GPIO_PIN_MUX_REG[gpio_num], FUN_DRV_V, FUN_DRV_S); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + *strength = GET_PERI_REG_BITS2(GPIO_PIN_MUX_REG[gpio_num], FUN_DRV_V, FUN_DRV_S); +#endif return ESP_OK; } +#if CONFIG_IDF_TARGET_ESP32 static const uint32_t GPIO_HOLD_MASK[34] = { 0, GPIO_SEL_1, @@ -556,6 +608,7 @@ static const uint32_t GPIO_HOLD_MASK[34] = { 0, 0, }; +#endif esp_err_t gpio_hold_en(gpio_num_t gpio_num) { @@ -563,11 +616,17 @@ esp_err_t gpio_hold_en(gpio_num_t gpio_num) esp_err_t r = ESP_OK; if (RTC_GPIO_IS_VALID_GPIO(gpio_num)) { r = rtc_gpio_hold_en(gpio_num); +#if CONFIG_IDF_TARGET_ESP32 } else if (GPIO_HOLD_MASK[gpio_num]) { SET_PERI_REG_MASK(RTC_IO_DIG_PAD_HOLD_REG, GPIO_HOLD_MASK[gpio_num]); } else { r = ESP_ERR_NOT_SUPPORTED; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + } else { + SET_PERI_REG_MASK(RTC_CNTL_DIG_PAD_HOLD_REG, BIT(gpio_num - RTC_GPIO_NUMBER)); + } +#endif return r == ESP_OK ? ESP_OK : ESP_ERR_NOT_SUPPORTED; } @@ -577,11 +636,17 @@ esp_err_t gpio_hold_dis(gpio_num_t gpio_num) esp_err_t r = ESP_OK; if (RTC_GPIO_IS_VALID_GPIO(gpio_num)) { r = rtc_gpio_hold_dis(gpio_num); - } else if (GPIO_HOLD_MASK[gpio_num]) { +#if CONFIG_IDF_TARGET_ESP32 + }else if (GPIO_HOLD_MASK[gpio_num]) { CLEAR_PERI_REG_MASK(RTC_IO_DIG_PAD_HOLD_REG, GPIO_HOLD_MASK[gpio_num]); } else { r = ESP_ERR_NOT_SUPPORTED; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PAD_HOLD_REG, BIT(gpio_num - RTC_GPIO_NUMBER)); + } +#endif return r == ESP_OK ? ESP_OK : ESP_ERR_NOT_SUPPORTED; } @@ -595,10 +660,34 @@ void gpio_deep_sleep_hold_en(void) void gpio_deep_sleep_hold_dis(void) { portENTER_CRITICAL(&gpio_spinlock); +#if CONFIG_IDF_TARGET_ESP32 CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_AUTOHOLD_EN_M); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_CLR_DG_PAD_AUTOHOLD); +#endif portEXIT_CRITICAL(&gpio_spinlock); } +#if CONFIG_IDF_TARGET_ESP32S2BETA + +esp_err_t gpio_force_hold_all() +{ + rtc_gpio_force_hold_all(); + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_UNHOLD); + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_HOLD); + return ESP_OK; +} + +esp_err_t gpio_force_unhold_all() +{ + rtc_gpio_force_hold_dis_all(); + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_HOLD); + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_UNHOLD); + SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_CLR_DG_PAD_AUTOHOLD); + return ESP_OK; +} +#endif + void gpio_iomux_in(uint32_t gpio, uint32_t signal_idx) { GPIO.func_in_sel_cfg[signal_idx].sig_in_sel = 0; diff --git a/components/driver/i2c.c b/components/driver/i2c.c index 556dcdf1ff..264eefa1c1 100644 --- a/components/driver/i2c.c +++ b/components/driver/i2c.c @@ -24,11 +24,12 @@ #include "freertos/task.h" #include "freertos/ringbuf.h" #include "soc/i2c_periph.h" +#include "soc/soc_memory_layout.h" #include "driver/i2c.h" #include "driver/gpio.h" #include "driver/periph_ctrl.h" #include "esp_pm.h" -#include "soc/soc_memory_layout.h" +#include "sdkconfig.h" static const char* I2C_TAG = "i2c"; #define I2C_CHECK(a, str, ret) if(!(a)) { \ @@ -458,7 +459,11 @@ static void IRAM_ATTR i2c_isr_handler_default(void* arg) if (p_i2c->mode == I2C_MODE_SLAVE) { int rx_fifo_cnt = I2C[i2c_num]->status_reg.rx_fifo_cnt; for (idx = 0; idx < rx_fifo_cnt; idx++) { + #if CONFIG_IDF_TARGET_ESP32 p_i2c->data_buf[idx] = I2C[i2c_num]->fifo_data.data; + #elif CONFIG_IDF_TARGET_ESP32S2BETA + p_i2c->data_buf[idx] = READ_PERI_REG(I2C_DATA_APB_REG(i2c_num)); + #endif } xRingbufferSendFromISR(p_i2c->rx_ring_buf, p_i2c->data_buf, rx_fifo_cnt, &HPTaskAwoken); I2C[i2c_num]->int_clr.rx_fifo_full = 1; @@ -500,7 +505,11 @@ static void IRAM_ATTR i2c_isr_handler_default(void* arg) } else if (status & I2C_RXFIFO_FULL_INT_ST_M) { int rx_fifo_cnt = I2C[i2c_num]->status_reg.rx_fifo_cnt; for (idx = 0; idx < rx_fifo_cnt; idx++) { + #if CONFIG_IDF_TARGET_ESP32 p_i2c->data_buf[idx] = I2C[i2c_num]->fifo_data.data; + #elif CONFIG_IDF_TARGET_ESP32S2BETA + p_i2c->data_buf[idx] = READ_PERI_REG(I2C_DATA_APB_REG(i2c_num)); + #endif } xRingbufferSendFromISR(p_i2c->rx_ring_buf, p_i2c->data_buf, rx_fifo_cnt, &HPTaskAwoken); I2C[i2c_num]->int_clr.rx_fifo_full = 1; @@ -551,6 +560,7 @@ esp_err_t i2c_get_data_mode(i2c_port_t i2c_num, i2c_trans_mode_t *tx_trans_mode, static esp_err_t i2c_master_clear_bus(i2c_port_t i2c_num) { I2C_CHECK(i2c_num < I2C_NUM_MAX, I2C_NUM_ERROR_STR, ESP_ERR_INVALID_ARG); +#if CONFIG_IDF_TARGET_ESP32 const int scl_half_period = I2C_CLR_BUS_HALF_PERIOD_US; // use standard 100kHz data rate int sda_in_sig = 0, scl_in_sig = 0; int i = 0; @@ -586,6 +596,10 @@ static esp_err_t i2c_master_clear_bus(i2c_port_t i2c_num) ets_delay_us(scl_half_period); gpio_set_level(sda_io, 1); // STOP, SDA low -> high while SCL is HIGH i2c_set_pin(i2c_num, sda_io, scl_io, 1, 1, I2C_MODE_MASTER); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + I2C[i2c_num]->scl_sp_conf.scl_rst_slv_num = 9; + I2C[i2c_num]->scl_sp_conf.scl_rst_slv_en = 1; +#endif return ESP_OK; } @@ -596,6 +610,7 @@ static esp_err_t i2c_master_clear_bus(i2c_port_t i2c_num) static esp_err_t i2c_hw_fsm_reset(i2c_port_t i2c_num) { I2C_CHECK(i2c_num < I2C_NUM_MAX, I2C_NUM_ERROR_STR, ESP_ERR_INVALID_ARG); +#if CONFIG_IDF_TARGET_ESP32 uint32_t ctr = I2C[i2c_num]->ctr.val; uint32_t fifo_conf = I2C[i2c_num]->fifo_conf.val; uint32_t scl_low_period = I2C[i2c_num]->scl_low_period.val; @@ -615,7 +630,7 @@ static esp_err_t i2c_hw_fsm_reset(i2c_port_t i2c_num) i2c_hw_disable(i2c_num); i2c_master_clear_bus(i2c_num); i2c_hw_enable(i2c_num); - I2C[i2c_num]->int_ena.val = 0; + I2C[i2c_num]->ctr.val = ctr & (~I2C_TRANS_START_M); I2C[i2c_num]->fifo_conf.val = fifo_conf; I2C[i2c_num]->scl_low_period.val = scl_low_period; @@ -629,18 +644,28 @@ static esp_err_t i2c_hw_fsm_reset(i2c_port_t i2c_num) I2C[i2c_num]->timeout.val = timeout; I2C[i2c_num]->scl_filter_cfg.val = scl_filter_cfg; I2C[i2c_num]->sda_filter_cfg.val = sda_filter_cfg; - uint32_t intr_mask = ( I2C_TRANS_COMPLETE_INT_ENA_M + I2C[i2c_num]->slave_addr.val = slave_addr; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + i2c_master_clear_bus(i2c_num); + + I2C[i2c_num]->ctr.fsm_rst = 1; + I2C[i2c_num]->ctr.fsm_rst = 0; + I2C[i2c_num]->fifo_conf.rx_fifo_rst = 1; + I2C[i2c_num]->fifo_conf.rx_fifo_rst = 0; + I2C[i2c_num]->fifo_conf.tx_fifo_rst = 1; + I2C[i2c_num]->fifo_conf.tx_fifo_rst = 0; +#endif + + I2C[i2c_num]->int_ena.val = 0; + uint32_t intr_mask = I2C_TRANS_COMPLETE_INT_ENA_M | I2C_TRANS_START_INT_ENA_M | I2C_ACK_ERR_INT_ENA_M | I2C_RXFIFO_OVF_INT_ENA_M | I2C_SLAVE_TRAN_COMP_INT_ENA_M - | I2C_TIME_OUT_INT_ENA_M); - if (I2C[i2c_num]->ctr.ms_mode == I2C_MODE_SLAVE) { - I2C[i2c_num]->slave_addr.val = slave_addr; - intr_mask |= ( I2C_RXFIFO_FULL_INT_ENA_M | I2C_TRANS_COMPLETE_INT_ENA_M); - } else { - intr_mask |= I2C_ARBITRATION_LOST_INT_ENA_M; - } + | I2C_TIME_OUT_INT_ENA_M + | I2C_RXFIFO_FULL_INT_ENA_M + | I2C_ARBITRATION_LOST_INT_ENA_M; + I2C[i2c_num]->int_clr.val = intr_mask; I2C[i2c_num]->int_ena.val = intr_mask; return ESP_OK; @@ -657,6 +682,7 @@ esp_err_t i2c_param_config(i2c_port_t i2c_num, const i2c_config_t* i2c_conf) if (ret != ESP_OK) { return ret; } + // Reset the I2C hardware in case there is a soft reboot. i2c_hw_disable(i2c_num); i2c_hw_enable(i2c_num); @@ -668,6 +694,12 @@ esp_err_t i2c_param_config(i2c_port_t i2c_num, const i2c_config_t* i2c_conf) I2C[i2c_num]->ctr.scl_force_out = 1; // set open-drain output mode I2C[i2c_num]->ctr.sample_scl_level = 0; //sample at high level of clock +#if CONFIG_IDF_TARGET_ESP32S2BETA + I2C[i2c_num]->ctr.ref_always_on = 1; + I2C[i2c_num]->sda_filter_cfg.val = 0; + I2C[i2c_num]->scl_filter_cfg.val = 0; +#endif + if (i2c_conf->mode == I2C_MODE_SLAVE) { //slave mode I2C[i2c_num]->slave_addr.addr = i2c_conf->slave.slave_addr; I2C[i2c_num]->slave_addr.en_10bit = i2c_conf->slave.addr_10bit_en; @@ -687,10 +719,21 @@ esp_err_t i2c_param_config(i2c_port_t i2c_num, const i2c_config_t* i2c_conf) I2C[i2c_num]->timeout.tout = cycle * I2C_MASTER_TOUT_CNUM_DEFAULT; //set timing for data I2C[i2c_num]->sda_hold.time = half_cycle / 2; - I2C[i2c_num]->sda_sample.time = half_cycle / 2; +#if CONFIG_IDF_TARGET_ESP32 + I2C[i2c_num]->sda_sample.time = half_cycle / 2; I2C[i2c_num]->scl_low_period.period = half_cycle; I2C[i2c_num]->scl_high_period.period = half_cycle; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + int low_period = half_cycle; + int wait_high = 0; + int high_period = cycle - low_period - wait_high; + I2C[i2c_num]->sda_sample.time = high_period / 2; + I2C[i2c_num]->scl_low_period.period = low_period; + I2C[i2c_num]->scl_high_period.period = high_period; + I2C[i2c_num]->scl_high_period.scl_wait_high_period = wait_high; +#endif + //set timing for start signal I2C[i2c_num]->scl_start_hold.time = half_cycle; I2C[i2c_num]->scl_rstart_setup.time = half_cycle; diff --git a/components/driver/i2s.c b/components/driver/i2s.c index 2d2046e1b9..2cb4663443 100644 --- a/components/driver/i2s.c +++ b/components/driver/i2s.c @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// 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. @@ -18,7 +18,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/queue.h" #include "freertos/xtensa_api.h" - +#include "soc/i2s_periph.h" #include "soc/rtc_periph.h" #include "soc/rtc.h" #include "soc/efuse_periph.h" @@ -34,6 +34,8 @@ #include "esp_err.h" #include "esp_log.h" #include "esp_pm.h" +#include "sdkconfig.h" + static const char* I2S_TAG = "I2S"; @@ -96,8 +98,13 @@ typedef struct { } i2s_obj_t; static i2s_obj_t *p_i2s_obj[I2S_NUM_MAX] = {0}; +#ifdef CONFIG_IDF_TARGET_ESP32 static i2s_dev_t* I2S[I2S_NUM_MAX] = {&I2S0, &I2S1}; -static portMUX_TYPE i2s_spinlock[I2S_NUM_MAX] = {portMUX_INITIALIZER_UNLOCKED, portMUX_INITIALIZER_UNLOCKED}; +static portMUX_TYPE i2s_spinlock[I2S_NUM_MAX] = {portMUX_INITIALIZER_UNLOCKED,portMUX_INITIALIZER_UNLOCKED}; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA +static i2s_dev_t* I2S[I2S_NUM_MAX] = {&I2S0}; +static portMUX_TYPE i2s_spinlock[I2S_NUM_MAX] = {portMUX_INITIALIZER_UNLOCKED}; +#endif static int _i2s_adc_unit = -1; static int _i2s_adc_channel = -1; @@ -187,18 +194,23 @@ float i2s_get_clk(i2s_port_t i2s_num) static esp_err_t i2s_isr_register(i2s_port_t i2s_num, int intr_alloc_flags, void (*fn)(void*), void * arg, i2s_isr_handle_t *handle) { - return esp_intr_alloc(ETS_I2S0_INTR_SOURCE + i2s_num, intr_alloc_flags, fn, arg, handle); + return esp_intr_alloc(i2s_periph_signal[i2s_num].irq, intr_alloc_flags, fn, arg, handle); } static float i2s_apll_get_fi2s(int bits_per_sample, int sdm0, int sdm1, int sdm2, int odir) { int f_xtal = (int)rtc_clk_xtal_freq_get() * 1000000; +#ifdef CONFIG_IDF_TARGET_ESP32 uint32_t is_rev0 = (GET_PERI_REG_BITS2(EFUSE_BLK0_RDATA3_REG, 1, 15) == 0); if (is_rev0) { sdm0 = 0; sdm1 = 0; } +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + sdm0 = 0; + sdm1 = 0; +#endif float fout = f_xtal * (sdm2 + sdm1 / 256.0f + sdm0 / 65536.0f + 4); if (fout < APLL_MIN_FREQ || fout > APLL_MAX_FREQ) { return APLL_MAX_FREQ; @@ -408,7 +420,13 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, i2s_bits_per_sample_t b i2s_driver_uninstall(i2s_num); return ESP_ERR_NO_MEM; } +#ifdef CONFIG_IDF_TARGET_ESP32 + //On ESP32S2, the eof_num count in words. I2S[i2s_num]->rx_eof_num = (p_i2s_obj[i2s_num]->dma_buf_len * p_i2s_obj[i2s_num]->channel_num * p_i2s_obj[i2s_num]->bytes_per_sample)/4; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + //On ESP32S2, the eof_num count in bytes. + I2S[i2s_num]->rx_eof_num = (p_i2s_obj[i2s_num]->dma_buf_len * p_i2s_obj[i2s_num]->channel_num * p_i2s_obj[i2s_num]->bytes_per_sample); +#endif I2S[i2s_num]->in_link.addr = (uint32_t) p_i2s_obj[i2s_num]->rx->desc[0]; //destroy old rx dma if exist @@ -434,6 +452,7 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, i2s_bits_per_sample_t b clkmInteger = clkmdiv; clkmDecimals = (clkmdiv - clkmInteger) / denom; bck = mclk / b_clk; +#if SOC_I2S_SUPPORT_PDM } else if (p_i2s_obj[i2s_num]->mode & I2S_MODE_PDM) { uint32_t b_clk = 0; if (p_i2s_obj[i2s_num]->mode & I2S_MODE_TX) { @@ -451,6 +470,7 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, i2s_bits_per_sample_t b clkmInteger = clkmdiv; clkmDecimals = (clkmdiv - clkmInteger) / denom; bck = mclk / b_clk; +#endif } else { clkmInteger = clkmdiv; clkmDecimals = (clkmdiv - clkmInteger) / denom; @@ -470,13 +490,21 @@ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, i2s_bits_per_sample_t b I2S[i2s_num]->clkm_conf.clkm_div_a = 1; I2S[i2s_num]->sample_rate_conf.tx_bck_div_num = m_scale; I2S[i2s_num]->sample_rate_conf.rx_bck_div_num = m_scale; +#ifdef CONFIG_IDF_TARGET_ESP32 I2S[i2s_num]->clkm_conf.clka_en = 1; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + I2S[i2s_num]->clkm_conf.clk_sel = 1; +#endif double fi2s_rate = i2s_apll_get_fi2s(bits, sdm0, sdm1, sdm2, odir); p_i2s_obj[i2s_num]->real_rate = fi2s_rate/bits/channel/m_scale; ESP_LOGI(I2S_TAG, "APLL: Req RATE: %d, real rate: %0.3f, BITS: %u, CLKM: %u, BCK_M: %u, MCLK: %0.3f, SCLK: %f, diva: %d, divb: %d", rate, fi2s_rate/bits/channel/m_scale, bits, 1, m_scale, fi2s_rate, fi2s_rate/8, 1, 0); } else { +#ifdef CONFIG_IDF_TARGET_ESP32 I2S[i2s_num]->clkm_conf.clka_en = 0; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + I2S[i2s_num]->clkm_conf.clk_sel = 2; +#endif I2S[i2s_num]->clkm_conf.clkm_div_a = 63; I2S[i2s_num]->clkm_conf.clkm_div_b = clkmDecimals; I2S[i2s_num]->clkm_conf.clkm_div_num = clkmInteger; @@ -507,6 +535,13 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) i2s_obj_t *p_i2s = (i2s_obj_t*) arg; uint8_t i2s_num = p_i2s->i2s_num; i2s_dev_t* i2s_reg = I2S[i2s_num]; + + typeof(i2s_reg->int_st) int_st_val = i2s_reg->int_st; + if(int_st_val.val == 0) { + //Avoid spurious interrupt + return; + } + i2s_event_t i2s_event; int dummy; @@ -514,8 +549,8 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) lldesc_t *finish_desc; - if (i2s_reg->int_st.out_dscr_err || i2s_reg->int_st.in_dscr_err) { - ESP_EARLY_LOGE(I2S_TAG, "dma error, interrupt status: 0x%08x", i2s_reg->int_st.val); + if (int_st_val.out_dscr_err || int_st_val.in_dscr_err) { + ESP_EARLY_LOGE(I2S_TAG, "dma error, interrupt status: 0x%08x", int_st_val.val); if (p_i2s->i2s_queue) { i2s_event.type = I2S_EVENT_DMA_ERROR; if (xQueueIsQueueFullFromISR(p_i2s->i2s_queue)) { @@ -525,7 +560,7 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) } } - if (i2s_reg->int_st.out_eof && p_i2s->tx) { + if (int_st_val.out_eof && p_i2s->tx) { finish_desc = (lldesc_t*) i2s_reg->out_eof_des_addr; // All buffers are empty. This means we have an underflow on our hands. if (xQueueIsQueueFullFromISR(p_i2s->tx->queue)) { @@ -547,7 +582,7 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) } } - if (i2s_reg->int_st.in_suc_eof && p_i2s->rx) { + if (int_st_val.in_suc_eof && p_i2s->rx) { // All buffers are full. This means we have an overflow. finish_desc = (lldesc_t*) i2s_reg->in_eof_des_addr; if (xQueueIsQueueFullFromISR(p_i2s->rx->queue)) { @@ -562,11 +597,11 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) xQueueSendFromISR(p_i2s->i2s_queue, (void * )&i2s_event, &high_priority_task_awoken); } } + i2s_reg->int_clr.val = int_st_val.val; + if (high_priority_task_awoken == pdTRUE) { portYIELD_FROM_ISR(); } - - i2s_reg->int_clr.val = I2S[i2s_num]->int_st.val; } static esp_err_t i2s_destroy_dma_queue(i2s_port_t i2s_num, i2s_dma_t *dma) @@ -784,72 +819,37 @@ esp_err_t i2s_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin) //For TX unit, the input signal index should be I2SnO_xxx_IN_IDX if (p_i2s_obj[i2s_num]->mode & I2S_MODE_TX) { if (p_i2s_obj[i2s_num]->mode & I2S_MODE_MASTER) { - if (i2s_num == I2S_NUM_0) { - bck_sig = I2S0O_BCK_OUT_IDX; - ws_sig = I2S0O_WS_OUT_IDX; - data_out_sig = I2S0O_DATA_OUT23_IDX; - } else { - bck_sig = I2S1O_BCK_OUT_IDX; - ws_sig = I2S1O_WS_OUT_IDX; - data_out_sig = I2S1O_DATA_OUT23_IDX; - } + bck_sig = i2s_periph_signal[i2s_num].o_bck_out_sig; + ws_sig = i2s_periph_signal[i2s_num].o_ws_out_sig; + data_out_sig = i2s_periph_signal[i2s_num].o_data_out_sig; } else if (p_i2s_obj[i2s_num]->mode & I2S_MODE_SLAVE) { - if (i2s_num == I2S_NUM_0) { - bck_sig = I2S0O_BCK_IN_IDX; - ws_sig = I2S0O_WS_IN_IDX; - data_out_sig = I2S0O_DATA_OUT23_IDX; - } else { - bck_sig = I2S1O_BCK_IN_IDX; - ws_sig = I2S1O_WS_IN_IDX; - data_out_sig = I2S1O_DATA_OUT23_IDX; - } + bck_sig = i2s_periph_signal[i2s_num].o_bck_in_sig; + ws_sig = i2s_periph_signal[i2s_num].o_ws_in_sig; + data_out_sig = i2s_periph_signal[i2s_num].o_data_out_sig; } } //For RX unit, the output signal index should be I2SnI_xxx_OUT_IDX //For RX unit, the input signal index shuld be I2SnI_xxx_IN_IDX if (p_i2s_obj[i2s_num]->mode & I2S_MODE_RX) { if (p_i2s_obj[i2s_num]->mode & I2S_MODE_MASTER) { - if (i2s_num == I2S_NUM_0) { - bck_sig = I2S0I_BCK_OUT_IDX; - ws_sig = I2S0I_WS_OUT_IDX; - data_in_sig = I2S0I_DATA_IN15_IDX; - } else { - bck_sig = I2S1I_BCK_OUT_IDX; - ws_sig = I2S1I_WS_OUT_IDX; - data_in_sig = I2S1I_DATA_IN15_IDX; - } + bck_sig = i2s_periph_signal[i2s_num].i_bck_out_sig; + ws_sig = i2s_periph_signal[i2s_num].i_ws_out_sig; + data_in_sig = i2s_periph_signal[i2s_num].i_data_in_sig; } else if (p_i2s_obj[i2s_num]->mode & I2S_MODE_SLAVE) { - if (i2s_num == I2S_NUM_0) { - bck_sig = I2S0I_BCK_IN_IDX; - ws_sig = I2S0I_WS_IN_IDX; - data_in_sig = I2S0I_DATA_IN15_IDX; - } else { - bck_sig = I2S1I_BCK_IN_IDX; - ws_sig = I2S1I_WS_IN_IDX; - data_in_sig = I2S1I_DATA_IN15_IDX; - } + bck_sig = i2s_periph_signal[i2s_num].i_bck_in_sig; + ws_sig = i2s_periph_signal[i2s_num].i_ws_in_sig; + data_in_sig = i2s_periph_signal[i2s_num].i_data_in_sig; } } //For "full-duplex + slave" mode, we should select RX signal index for ws and bck. //For "full-duplex + master" mode, we should select TX signal index for ws and bck. if ((p_i2s_obj[i2s_num]->mode & I2S_FULL_DUPLEX_SLAVE_MODE_MASK) == I2S_FULL_DUPLEX_SLAVE_MODE_MASK) { - if (i2s_num == I2S_NUM_0) { - bck_sig = I2S0I_BCK_IN_IDX; - ws_sig = I2S0I_WS_IN_IDX; - } else { - bck_sig = I2S1I_BCK_IN_IDX; - ws_sig = I2S1I_WS_IN_IDX; - } + bck_sig = i2s_periph_signal[i2s_num].i_bck_in_sig; + ws_sig = i2s_periph_signal[i2s_num].i_ws_in_sig; } else if ((p_i2s_obj[i2s_num]->mode & I2S_FULL_DUPLEX_MASTER_MODE_MASK) == I2S_FULL_DUPLEX_MASTER_MODE_MASK) { - if (i2s_num == I2S_NUM_0) { - bck_sig = I2S0O_BCK_OUT_IDX; - ws_sig = I2S0O_WS_OUT_IDX; - } else { - bck_sig = I2S1O_BCK_OUT_IDX; - ws_sig = I2S1O_WS_OUT_IDX; - } + bck_sig = i2s_periph_signal[i2s_num].o_bck_out_sig; + ws_sig = i2s_periph_signal[i2s_num].o_ws_out_sig; } - gpio_matrix_out_check(pin->data_out_num, data_out_sig, 0, 0); gpio_matrix_in_check(pin->data_in_num, data_in_sig, 0); if (p_i2s_obj[i2s_num]->mode & I2S_MODE_MASTER) { @@ -871,12 +871,14 @@ esp_err_t i2s_set_sample_rates(i2s_port_t i2s_num, uint32_t rate) return i2s_set_clk(i2s_num, rate, p_i2s_obj[i2s_num]->bits_per_sample, p_i2s_obj[i2s_num]->channel_num); } +#if SOC_I2S_SUPPORT_PDM esp_err_t i2s_set_pdm_rx_down_sample(i2s_port_t i2s_num, i2s_pdm_dsr_t dsr) { I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); I2S[i2s_num]->pdm_conf.rx_sinc_dsr_16_en = dsr; return i2s_set_clk(i2s_num, p_i2s_obj[i2s_num]->sample_rate, p_i2s_obj[i2s_num]->bits_per_sample, p_i2s_obj[i2s_num]->channel_num); } +#endif static esp_err_t i2s_param_config(i2s_port_t i2s_num, const i2s_config_t *i2s_config) { @@ -884,7 +886,10 @@ static esp_err_t i2s_param_config(i2s_port_t i2s_num, const i2s_config_t *i2s_co I2S_CHECK((i2s_config), "param null", ESP_ERR_INVALID_ARG); I2S_CHECK(!((i2s_config->mode & I2S_MODE_ADC_BUILT_IN) && (i2s_num != I2S_NUM_0)), "I2S ADC built-in only support on I2S0", ESP_ERR_INVALID_ARG); I2S_CHECK(!((i2s_config->mode & I2S_MODE_DAC_BUILT_IN) && (i2s_num != I2S_NUM_0)), "I2S DAC built-in only support on I2S0", ESP_ERR_INVALID_ARG); +#if SOC_I2S_SUPPORT_PDM I2S_CHECK(!((i2s_config->mode & I2S_MODE_PDM) && (i2s_num != I2S_NUM_0)), "I2S DAC PDM only support on I2S0", ESP_ERR_INVALID_ARG); +#endif + periph_module_enable(i2s_periph_signal[i2s_num].module); if(i2s_config->mode & I2S_MODE_ADC_BUILT_IN) { //in ADC built-in mode, we need to call i2s_set_adc_mode to @@ -966,6 +971,7 @@ static esp_err_t i2s_param_config(i2s_port_t i2s_num, const i2s_config_t *i2s_co I2S[i2s_num]->conf2.camera_en = 0; } +#if SOC_I2S_SUPPORT_PDM if (i2s_config->mode & I2S_MODE_PDM) { I2S[i2s_num]->fifo_conf.rx_fifo_mod_force_en = 1; I2S[i2s_num]->fifo_conf.tx_fifo_mod_force_en = 1; @@ -984,6 +990,10 @@ static esp_err_t i2s_param_config(i2s_port_t i2s_num, const i2s_config_t *i2s_co I2S[i2s_num]->pdm_conf.rx_pdm_en = 0; I2S[i2s_num]->pdm_conf.tx_pdm_en = 0; } +#else + I2S[i2s_num]->pdm_conf.rx_pdm_en = 0; + I2S[i2s_num]->pdm_conf.tx_pdm_en = 0; +#endif if (i2s_config->communication_format & I2S_COMM_FORMAT_I2S) { I2S[i2s_num]->conf.tx_short_sync = 0; I2S[i2s_num]->conf.rx_short_sync = 0; @@ -1092,13 +1102,7 @@ esp_err_t i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config, #endif //CONFIG_PM_ENABLE //To make sure hardware is enabled before any hardware register operations. - if (i2s_num == I2S_NUM_1) { - periph_module_reset(PERIPH_I2S1_MODULE); - periph_module_enable(PERIPH_I2S1_MODULE); - } else { - periph_module_reset(PERIPH_I2S0_MODULE); - periph_module_enable(PERIPH_I2S0_MODULE); - } + periph_module_enable(i2s_periph_signal[i2s_num].module); //initial interrupt err = i2s_isr_register(i2s_num, i2s_config->intr_alloc_flags, i2s_intr_handler_default, p_i2s_obj[i2s_num], &p_i2s_obj[i2s_num]->i2s_isr_handle); @@ -1171,12 +1175,8 @@ esp_err_t i2s_driver_uninstall(i2s_port_t i2s_num) free(p_i2s_obj[i2s_num]); p_i2s_obj[i2s_num] = NULL; + periph_module_disable(i2s_periph_signal[i2s_num].module); - if (i2s_num == I2S_NUM_0) { - periph_module_disable(PERIPH_I2S0_MODULE); - } else if (i2s_num == I2S_NUM_1) { - periph_module_disable(PERIPH_I2S1_MODULE); - } return ESP_OK; } @@ -1251,14 +1251,14 @@ esp_err_t i2s_write_expand(i2s_port_t i2s_num, const void *src, size_t size, siz I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); I2S_CHECK((size > 0), "size must greater than zero", ESP_ERR_INVALID_ARG); I2S_CHECK((aim_bits * size < I2S_MAX_BUFFER_SIZE), "size is too large", ESP_ERR_INVALID_ARG); - I2S_CHECK((aim_bits >= src_bits), "aim_bits musn't less than src_bits", ESP_ERR_INVALID_ARG); + I2S_CHECK((aim_bits >= src_bits), "aim_bits mustn't be less than src_bits", ESP_ERR_INVALID_ARG); I2S_CHECK((p_i2s_obj[i2s_num]->tx), "tx NULL", ESP_ERR_INVALID_ARG); if (src_bits < I2S_BITS_PER_SAMPLE_8BIT || aim_bits < I2S_BITS_PER_SAMPLE_8BIT) { - ESP_LOGE(I2S_TAG,"bits musn't be less than 8, src_bits %d aim_bits %d", src_bits, aim_bits); + ESP_LOGE(I2S_TAG,"bits mustn't be less than 8, src_bits %d aim_bits %d", src_bits, aim_bits); return ESP_ERR_INVALID_ARG; } if (src_bits > I2S_BITS_PER_SAMPLE_32BIT || aim_bits > I2S_BITS_PER_SAMPLE_32BIT) { - ESP_LOGE(I2S_TAG,"bits musn't be greater than 32, src_bits %d aim_bits %d", src_bits, aim_bits); + ESP_LOGE(I2S_TAG,"bits mustn't be greater than 32, src_bits %d aim_bits %d", src_bits, aim_bits); return ESP_ERR_INVALID_ARG; } if ((src_bits == I2S_BITS_PER_SAMPLE_16BIT || src_bits == I2S_BITS_PER_SAMPLE_32BIT) && (size % 2 != 0)) { diff --git a/components/driver/include/driver/adc.h b/components/driver/include/driver/adc.h index 520970d79f..ad9021c4ee 100644 --- a/components/driver/include/driver/adc.h +++ b/components/driver/include/driver/adc.h @@ -53,28 +53,34 @@ typedef enum { #define ADC_WIDTH_12Bit ADC_WIDTH_BIT_12 typedef enum { - ADC1_CHANNEL_0 = 0, /*!< ADC1 channel 0 is GPIO36 */ - ADC1_CHANNEL_1, /*!< ADC1 channel 1 is GPIO37 */ - ADC1_CHANNEL_2, /*!< ADC1 channel 2 is GPIO38 */ - ADC1_CHANNEL_3, /*!< ADC1 channel 3 is GPIO39 */ - ADC1_CHANNEL_4, /*!< ADC1 channel 4 is GPIO32 */ - ADC1_CHANNEL_5, /*!< ADC1 channel 5 is GPIO33 */ - ADC1_CHANNEL_6, /*!< ADC1 channel 6 is GPIO34 */ - ADC1_CHANNEL_7, /*!< ADC1 channel 7 is GPIO35 */ + ADC1_CHANNEL_0 = 0, /*!< ADC1 channel 0 is GPIO36 (ESP32), GPIO1 (ESP32-S2) */ + ADC1_CHANNEL_1, /*!< ADC1 channel 1 is GPIO37 (ESP32), GPIO2 (ESP32-S2) */ + ADC1_CHANNEL_2, /*!< ADC1 channel 2 is GPIO38 (ESP32), GPIO3 (ESP32-S2) */ + ADC1_CHANNEL_3, /*!< ADC1 channel 3 is GPIO39 (ESP32), GPIO4 (ESP32-S2) */ + ADC1_CHANNEL_4, /*!< ADC1 channel 4 is GPIO32 (ESP32), GPIO5 (ESP32-S2) */ + ADC1_CHANNEL_5, /*!< ADC1 channel 5 is GPIO33 (ESP32), GPIO6 (ESP32-S2) */ + ADC1_CHANNEL_6, /*!< ADC1 channel 6 is GPIO34 (ESP32), GPIO7 (ESP32-S2) */ + ADC1_CHANNEL_7, /*!< ADC1 channel 7 is GPIO35 (ESP32), GPIO8 (ESP32-S2) */ +#if CONFIG_IDF_TARGET_ESP32 ADC1_CHANNEL_MAX, +#elif CONFIG_IDF_TARGET_ESP32S2BETA + ADC1_CHANNEL_8, /*!< ADC1 channel 6 is GPIO9 (ESP32-S2)*/ + ADC1_CHANNEL_9, /*!< ADC1 channel 7 is GPIO10 (ESP32-S2) */ + ADC1_CHANNEL_MAX, +#endif } adc1_channel_t; typedef enum { - ADC2_CHANNEL_0 = 0, /*!< ADC2 channel 0 is GPIO4 */ - ADC2_CHANNEL_1, /*!< ADC2 channel 1 is GPIO0 */ - ADC2_CHANNEL_2, /*!< ADC2 channel 2 is GPIO2 */ - ADC2_CHANNEL_3, /*!< ADC2 channel 3 is GPIO15 */ - ADC2_CHANNEL_4, /*!< ADC2 channel 4 is GPIO13 */ - ADC2_CHANNEL_5, /*!< ADC2 channel 5 is GPIO12 */ - ADC2_CHANNEL_6, /*!< ADC2 channel 6 is GPIO14 */ - ADC2_CHANNEL_7, /*!< ADC2 channel 7 is GPIO27 */ - ADC2_CHANNEL_8, /*!< ADC2 channel 8 is GPIO25 */ - ADC2_CHANNEL_9, /*!< ADC2 channel 9 is GPIO26 */ + ADC2_CHANNEL_0 = 0, /*!< ADC2 channel 0 is GPIO4 (ESP32), GPIO11 (ESP32-S2) */ + ADC2_CHANNEL_1, /*!< ADC2 channel 1 is GPIO0 (ESP32), GPIO12 (ESP32-S2) */ + ADC2_CHANNEL_2, /*!< ADC2 channel 2 is GPIO2 (ESP32), GPIO13 (ESP32-S2) */ + ADC2_CHANNEL_3, /*!< ADC2 channel 3 is GPIO15 (ESP32), GPIO14 (ESP32-S2) */ + ADC2_CHANNEL_4, /*!< ADC2 channel 4 is GPIO13 (ESP32), GPIO15 (ESP32-S2) */ + ADC2_CHANNEL_5, /*!< ADC2 channel 5 is GPIO12 (ESP32), GPIO16 (ESP32-S2) */ + ADC2_CHANNEL_6, /*!< ADC2 channel 6 is GPIO14 (ESP32), GPIO17 (ESP32-S2) */ + ADC2_CHANNEL_7, /*!< ADC2 channel 7 is GPIO27 (ESP32), GPIO18 (ESP32-S2) */ + ADC2_CHANNEL_8, /*!< ADC2 channel 8 is GPIO25 (ESP32), GPIO19 (ESP32-S2) */ + ADC2_CHANNEL_9, /*!< ADC2 channel 9 is GPIO26 (ESP32), GPIO20 (ESP32-S2) */ ADC2_CHANNEL_MAX, } adc2_channel_t; diff --git a/components/driver/include/driver/dac.h b/components/driver/include/driver/dac.h index d153230bde..fe375190cf 100644 --- a/components/driver/include/driver/dac.h +++ b/components/driver/include/driver/dac.h @@ -24,8 +24,8 @@ extern "C" { #include "soc/dac_periph.h" typedef enum { - DAC_CHANNEL_1 = 1, /*!< DAC channel 1 is GPIO25 */ - DAC_CHANNEL_2, /*!< DAC channel 2 is GPIO26 */ + DAC_CHANNEL_1 = 1, /*!< DAC channel 1 is GPIO25 (ESP32), GPIO17 (ESP32-S2) */ + DAC_CHANNEL_2, /*!< DAC channel 2 is GPIO26 (ESP32), GPIO18 (ESP32-S2) */ DAC_CHANNEL_MAX, } dac_channel_t; diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h index 11425201d4..7223d6f465 100644 --- a/components/driver/include/driver/gpio.h +++ b/components/driver/include/driver/gpio.h @@ -32,6 +32,7 @@ extern "C" { #endif +#if CONFIG_IDF_TARGET_ESP32 #define GPIO_SEL_0 (BIT(0)) /*!< Pin 0 selected */ #define GPIO_SEL_1 (BIT(1)) /*!< Pin 1 selected */ #define GPIO_SEL_2 (BIT(2)) /*!< Pin 2 selected @@ -76,6 +77,54 @@ extern "C" { #define GPIO_SEL_38 ((uint64_t)(((uint64_t)1)<<38)) /*!< Pin 38 selected */ #define GPIO_SEL_39 ((uint64_t)(((uint64_t)1)<<39)) /*!< Pin 39 selected */ +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define GPIO_SEL_0 (BIT(0)) /*!< Pin 0 selected */ +#define GPIO_SEL_1 (BIT(1)) /*!< Pin 1 selected */ +#define GPIO_SEL_2 (BIT(2)) /*!< Pin 2 selected */ +#define GPIO_SEL_3 (BIT(3)) /*!< Pin 3 selected */ +#define GPIO_SEL_4 (BIT(4)) /*!< Pin 4 selected */ +#define GPIO_SEL_5 (BIT(5)) /*!< Pin 5 selected */ +#define GPIO_SEL_6 (BIT(6)) /*!< Pin 6 selected */ +#define GPIO_SEL_7 (BIT(7)) /*!< Pin 7 selected */ +#define GPIO_SEL_8 (BIT(8)) /*!< Pin 8 selected */ +#define GPIO_SEL_9 (BIT(9)) /*!< Pin 9 selected */ +#define GPIO_SEL_10 (BIT(10)) /*!< Pin 10 selected */ +#define GPIO_SEL_11 (BIT(11)) /*!< Pin 11 selected */ +#define GPIO_SEL_12 (BIT(12)) /*!< Pin 12 selected */ +#define GPIO_SEL_13 (BIT(13)) /*!< Pin 13 selected */ +#define GPIO_SEL_14 (BIT(14)) /*!< Pin 14 selected */ +#define GPIO_SEL_15 (BIT(15)) /*!< Pin 15 selected */ +#define GPIO_SEL_16 (BIT(16)) /*!< Pin 16 selected */ +#define GPIO_SEL_17 (BIT(17)) /*!< Pin 17 selected */ +#define GPIO_SEL_18 (BIT(18)) /*!< Pin 18 selected */ +#define GPIO_SEL_19 (BIT(19)) /*!< Pin 19 selected */ +#define GPIO_SEL_20 (BIT(20)) /*!< Pin 20 selected */ +#define GPIO_SEL_21 (BIT(21)) /*!< Pin 21 selected */ + +#define GPIO_SEL_26 (BIT(26)) /*!< Pin 26 selected */ +#define GPIO_SEL_27 (BIT(27)) /*!< Pin 27 selected */ +#define GPIO_SEL_28 (BIT(28)) /*!< Pin 28 selected */ +#define GPIO_SEL_29 (BIT(29)) /*!< Pin 29 selected */ +#define GPIO_SEL_30 (BIT(30)) /*!< Pin 30 selected */ +#define GPIO_SEL_31 (BIT(31)) /*!< Pin 31 selected */ +#define GPIO_SEL_32 ((uint64_t)(((uint64_t)1)<<32)) /*!< Pin 32 selected */ +#define GPIO_SEL_33 ((uint64_t)(((uint64_t)1)<<33)) /*!< Pin 33 selected */ +#define GPIO_SEL_34 ((uint64_t)(((uint64_t)1)<<34)) /*!< Pin 34 selected */ +#define GPIO_SEL_35 ((uint64_t)(((uint64_t)1)<<35)) /*!< Pin 35 selected */ +#define GPIO_SEL_36 ((uint64_t)(((uint64_t)1)<<36)) /*!< Pin 36 selected */ +#define GPIO_SEL_37 ((uint64_t)(((uint64_t)1)<<37)) /*!< Pin 37 selected */ +#define GPIO_SEL_38 ((uint64_t)(((uint64_t)1)<<38)) /*!< Pin 38 selected */ +#define GPIO_SEL_39 ((uint64_t)(((uint64_t)1)<<39)) /*!< Pin 39 selected */ +#define GPIO_SEL_40 ((uint64_t)(((uint64_t)1)<<40)) /*!< Pin 40 selected */ +#define GPIO_SEL_41 ((uint64_t)(((uint64_t)1)<<41)) /*!< Pin 41 selected */ +#define GPIO_SEL_42 ((uint64_t)(((uint64_t)1)<<42)) /*!< Pin 42 selected */ +#define GPIO_SEL_43 ((uint64_t)(((uint64_t)1)<<43)) /*!< Pin 43 selected */ +#define GPIO_SEL_44 ((uint64_t)(((uint64_t)1)<<44)) /*!< Pin 44 selected */ +#define GPIO_SEL_45 ((uint64_t)(((uint64_t)1)<<45)) /*!< Pin 45 selected */ +#define GPIO_SEL_46 ((uint64_t)(((uint64_t)1)<<46)) /*!< Pin 46 selected */ +#endif + +#if CONFIG_IDF_TARGET_ESP32 #define GPIO_PIN_REG_0 IO_MUX_GPIO0_REG #define GPIO_PIN_REG_1 IO_MUX_GPIO1_REG #define GPIO_PIN_REG_2 IO_MUX_GPIO2_REG @@ -111,12 +160,67 @@ extern "C" { #define GPIO_PIN_REG_37 IO_MUX_GPIO37_REG #define GPIO_PIN_REG_38 IO_MUX_GPIO38_REG #define GPIO_PIN_REG_39 IO_MUX_GPIO39_REG +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define GPIO_PIN_REG_0 IO_MUX_GPIO0_REG +#define GPIO_PIN_REG_1 IO_MUX_GPIO1_REG +#define GPIO_PIN_REG_2 IO_MUX_GPIO2_REG +#define GPIO_PIN_REG_3 IO_MUX_GPIO3_REG +#define GPIO_PIN_REG_4 IO_MUX_GPIO4_REG +#define GPIO_PIN_REG_5 IO_MUX_GPIO5_REG +#define GPIO_PIN_REG_6 IO_MUX_GPIO6_REG +#define GPIO_PIN_REG_7 IO_MUX_GPIO7_REG +#define GPIO_PIN_REG_8 IO_MUX_GPIO8_REG +#define GPIO_PIN_REG_9 IO_MUX_GPIO9_REG +#define GPIO_PIN_REG_10 IO_MUX_GPIO10_REG +#define GPIO_PIN_REG_11 IO_MUX_GPIO11_REG +#define GPIO_PIN_REG_12 IO_MUX_GPIO12_REG +#define GPIO_PIN_REG_13 IO_MUX_GPIO13_REG +#define GPIO_PIN_REG_14 IO_MUX_GPIO14_REG +#define GPIO_PIN_REG_15 IO_MUX_GPIO15_REG +#define GPIO_PIN_REG_16 IO_MUX_GPIO16_REG +#define GPIO_PIN_REG_17 IO_MUX_GPIO17_REG +#define GPIO_PIN_REG_18 IO_MUX_GPIO18_REG +#define GPIO_PIN_REG_19 IO_MUX_GPIO19_REG +#define GPIO_PIN_REG_20 IO_MUX_GPIO20_REG +#define GPIO_PIN_REG_21 IO_MUX_GPIO21_REG +#define GPIO_PIN_REG_22 IO_MUX_GPIO22_REG +#define GPIO_PIN_REG_23 IO_MUX_GPIO23_REG +#define GPIO_PIN_REG_24 IO_MUX_GPIO24_REG +#define GPIO_PIN_REG_25 IO_MUX_GPIO25_REG +#define GPIO_PIN_REG_26 IO_MUX_GPIO26_REG +#define GPIO_PIN_REG_27 IO_MUX_GPIO27_REG +#define GPIO_PIN_REG_28 IO_MUX_GPIO28_REG +#define GPIO_PIN_REG_29 IO_MUX_GPIO29_REG +#define GPIO_PIN_REG_30 IO_MUX_GPIO30_REG +#define GPIO_PIN_REG_31 IO_MUX_GPIO31_REG +#define GPIO_PIN_REG_32 IO_MUX_GPIO32_REG +#define GPIO_PIN_REG_33 IO_MUX_GPIO33_REG +#define GPIO_PIN_REG_34 IO_MUX_GPIO34_REG +#define GPIO_PIN_REG_35 IO_MUX_GPIO35_REG +#define GPIO_PIN_REG_36 IO_MUX_GPIO36_REG +#define GPIO_PIN_REG_37 IO_MUX_GPIO37_REG +#define GPIO_PIN_REG_38 IO_MUX_GPIO38_REG +#define GPIO_PIN_REG_39 IO_MUX_GPIO39_REG +#define GPIO_PIN_REG_40 IO_MUX_GPIO40_REG +#define GPIO_PIN_REG_41 IO_MUX_GPIO41_REG +#define GPIO_PIN_REG_42 IO_MUX_GPIO42_REG +#define GPIO_PIN_REG_43 IO_MUX_GPIO43_REG +#define GPIO_PIN_REG_44 IO_MUX_GPIO44_REG +#define GPIO_PIN_REG_45 IO_MUX_GPIO45_REG +#define GPIO_PIN_REG_46 IO_MUX_GPIO46_REG +#define GPIO_PIN_REG_47 IO_MUX_GPIO47_REG +#endif +#if CONFIG_IDF_TARGET_ESP32 #define GPIO_APP_CPU_INTR_ENA (BIT(0)) #define GPIO_APP_CPU_NMI_INTR_ENA (BIT(1)) #define GPIO_PRO_CPU_INTR_ENA (BIT(2)) #define GPIO_PRO_CPU_NMI_INTR_ENA (BIT(3)) #define GPIO_SDIO_EXT_INTR_ENA (BIT(4)) +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define GPIO_PRO_CPU_INTR_ENA (BIT(0)) +#define GPIO_PRO_CPU_NMI_INTR_ENA (BIT(1)) +#endif #define GPIO_MODE_DEF_DISABLE (0) #define GPIO_MODE_DEF_INPUT (BIT0) @@ -127,8 +231,13 @@ extern "C" { /** @endcond */ #define GPIO_IS_VALID_GPIO(gpio_num) ((gpio_num < GPIO_PIN_COUNT && GPIO_PIN_MUX_REG[gpio_num] != 0)) /*!< Check whether it is a valid GPIO number */ +#if CONFIG_IDF_TARGET_ESP32 #define GPIO_IS_VALID_OUTPUT_GPIO(gpio_num) ((GPIO_IS_VALID_GPIO(gpio_num)) && (gpio_num < 34)) /*!< Check whether it can be a valid GPIO number of output mode */ +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define GPIO_IS_VALID_OUTPUT_GPIO(gpio_num) ((GPIO_IS_VALID_GPIO(gpio_num)) && (gpio_num < 46)) /*!< Check whether it can be a valid GPIO number of output mode */ +#endif +#if CONFIG_IDF_TARGET_ESP32 typedef enum { GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ @@ -177,6 +286,59 @@ typedef enum { /** @endcond */ } gpio_num_t; + +#elif CONFIG_IDF_TARGET_ESP32S2BETA +typedef enum { + GPIO_NUM_NC = -1, /*!< Use to signal not connected to S/W */ + GPIO_NUM_0 = 0, /*!< GPIO0, input and output */ + GPIO_NUM_1 = 1, /*!< GPIO1, input and output */ + GPIO_NUM_2 = 2, /*!< GPIO2, input and output */ + GPIO_NUM_3 = 3, /*!< GPIO3, input and output */ + GPIO_NUM_4 = 4, /*!< GPIO4, input and output */ + GPIO_NUM_5 = 5, /*!< GPIO5, input and output */ + GPIO_NUM_6 = 6, /*!< GPIO6, input and output */ + GPIO_NUM_7 = 7, /*!< GPIO7, input and output */ + GPIO_NUM_8 = 8, /*!< GPIO8, input and output */ + GPIO_NUM_9 = 9, /*!< GPIO9, input and output */ + GPIO_NUM_10 = 10, /*!< GPIO10, input and output */ + GPIO_NUM_11 = 11, /*!< GPIO11, input and output */ + GPIO_NUM_12 = 12, /*!< GPIO12, input and output */ + GPIO_NUM_13 = 13, /*!< GPIO13, input and output */ + GPIO_NUM_14 = 14, /*!< GPIO14, input and output */ + GPIO_NUM_15 = 15, /*!< GPIO15, input and output */ + GPIO_NUM_16 = 16, /*!< GPIO16, input and output */ + GPIO_NUM_17 = 17, /*!< GPIO17, input and output */ + GPIO_NUM_18 = 18, /*!< GPIO18, input and output */ + GPIO_NUM_19 = 19, /*!< GPIO19, input and output */ + GPIO_NUM_20 = 20, /*!< GPIO20, input and output */ + GPIO_NUM_21 = 21, /*!< GPIO21, input and output */ + /* Note: The missing IO is because it is used inside the chip. */ + GPIO_NUM_26 = 26, /*!< GPIO26, input and output */ + GPIO_NUM_27 = 27, /*!< GPIO27, input and output */ + GPIO_NUM_28 = 28, /*!< GPIO28, input and output */ + GPIO_NUM_29 = 29, /*!< GPIO29, input and output */ + GPIO_NUM_30 = 30, /*!< GPIO30, input and output */ + GPIO_NUM_31 = 31, /*!< GPIO31, input and output */ + GPIO_NUM_32 = 32, /*!< GPIO32, input and output */ + GPIO_NUM_33 = 33, /*!< GPIO33, input and output */ + GPIO_NUM_34 = 34, /*!< GPIO34, input and output */ + GPIO_NUM_35 = 35, /*!< GPIO35, input and output */ + GPIO_NUM_36 = 36, /*!< GPIO36, input and output */ + GPIO_NUM_37 = 37, /*!< GPIO37, input and output */ + GPIO_NUM_38 = 38, /*!< GPIO38, input and output */ + GPIO_NUM_39 = 39, /*!< GPIO39, input and output */ + GPIO_NUM_40 = 40, /*!< GPIO40, input and output */ + GPIO_NUM_41 = 41, /*!< GPIO41, input and output */ + GPIO_NUM_42 = 42, /*!< GPIO42, input and output */ + GPIO_NUM_43 = 43, /*!< GPIO43, input and output */ + GPIO_NUM_44 = 44, /*!< GPIO44, input and output */ + GPIO_NUM_45 = 45, /*!< GPIO45, input and output */ + GPIO_NUM_46 = 46, /*!< GPIO46, input mode only */ + GPIO_NUM_MAX = 47, +/** @endcond */ +} gpio_num_t; +#endif + typedef enum { GPIO_INTR_DISABLE = 0, /*!< Disable GPIO interrupt */ GPIO_INTR_POSEDGE = 1, /*!< GPIO interrupt type : rising edge */ @@ -613,6 +775,20 @@ void gpio_iomux_in(uint32_t gpio_num, uint32_t signal_idx); */ void gpio_iomux_out(uint8_t gpio_num, int func, bool oen_inv); +#if CONFIG_IDF_TARGET_ESP32S2BETA +/** + * @brief Force hold digital and rtc gpio pad. + * @note GPIO force hold, whether the chip in sleep mode or wakeup mode. + * */ +esp_err_t gpio_force_hold_all(void); + +/** + * @brief Force unhold digital and rtc gpio pad. + * @note GPIO force unhold, whether the chip in sleep mode or wakeup mode. + * */ +esp_err_t gpio_force_unhold_all(void); +#endif + #ifdef __cplusplus } #endif diff --git a/components/driver/include/driver/i2c.h b/components/driver/include/driver/i2c.h index 57204cc60e..fafbc7b968 100644 --- a/components/driver/include/driver/i2c.h +++ b/components/driver/include/driver/i2c.h @@ -80,20 +80,20 @@ typedef enum { * @brief I2C initialization parameters */ typedef struct{ - i2c_mode_t mode; /*!< I2C mode */ + i2c_mode_t mode; /*!< I2C mode */ gpio_num_t sda_io_num; /*!< GPIO number for I2C sda signal */ gpio_pullup_t sda_pullup_en; /*!< Internal GPIO pull mode for I2C sda signal*/ gpio_num_t scl_io_num; /*!< GPIO number for I2C scl signal */ gpio_pullup_t scl_pullup_en; /*!< Internal GPIO pull mode for I2C scl signal*/ - + //TODO: add ref tick configure union { struct { uint32_t clk_speed; /*!< I2C clock frequency for master mode, (no higher than 1MHz for now) */ - } master; + } master; /*!< Configuration if the I2C peripheral is master */ struct { uint8_t addr_10bit_en; /*!< I2C 10bit address mode enable for slave mode */ uint16_t slave_addr; /*!< I2C address for slave mode */ - } slave; + } slave; /*!< Configuration if the I2C peripheral is slave */ }; }i2c_config_t; diff --git a/components/driver/include/driver/i2s.h b/components/driver/include/driver/i2s.h index 37d8278d63..3ccd55135b 100644 --- a/components/driver/include/driver/i2s.h +++ b/components/driver/include/driver/i2s.h @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// 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. @@ -101,7 +101,9 @@ typedef enum { */ typedef enum { I2S_NUM_0 = 0x0, /*!< I2S 0*/ - I2S_NUM_1 = 0x1, /*!< I2S 1*/ +#if SOC_I2S_PERIPH_NUM > 1 + I2S_NUM_1, /*!< I2S 1*/ +#endif I2S_NUM_MAX, } i2s_port_t; @@ -118,7 +120,9 @@ typedef enum { I2S_MODE_RX = 8, I2S_MODE_DAC_BUILT_IN = 16, /*!< Output I2S data to built-in DAC, no matter the data format is 16bit or 32 bit, the DAC module will only take the 8bits from MSB*/ I2S_MODE_ADC_BUILT_IN = 32, /*!< Input I2S data from built-in ADC, each data can be 12-bit width at most*/ +#if SOC_I2S_SUPPORT_PDM I2S_MODE_PDM = 64, +#endif } i2s_mode_t; @@ -187,6 +191,7 @@ typedef struct { int data_in_num; /*!< DATA in pin*/ } i2s_pin_config_t; +#if SOC_I2S_SUPPORT_PDM /** * @brief I2S PDM RX downsample mode */ @@ -195,6 +200,7 @@ typedef enum { I2S_PDM_DSR_16S, /*!< downsampling number is 16 for PDM RX mode*/ I2S_PDM_DSR_MAX, } i2s_pdm_dsr_t; +#endif typedef intr_handle_t i2s_isr_handle_t; /** @@ -221,6 +227,7 @@ typedef intr_handle_t i2s_isr_handle_t; */ esp_err_t i2s_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin); +#if SOC_I2S_SUPPORT_PDM /** * @brief Set PDM mode down-sample rate * In PDM RX mode, there would be 2 rounds of downsample process in hardware. @@ -239,6 +246,7 @@ esp_err_t i2s_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin); * - ESP_ERR_NO_MEM Out of memory */ esp_err_t i2s_set_pdm_rx_down_sample(i2s_port_t i2s_num, i2s_pdm_dsr_t dsr); +#endif /** * @brief Set I2S dac mode, I2S built-in DAC is disabled by default diff --git a/components/driver/include/driver/ledc.h b/components/driver/include/driver/ledc.h index 845f44286b..82ab7a1f8d 100644 --- a/components/driver/include/driver/ledc.h +++ b/components/driver/include/driver/ledc.h @@ -30,7 +30,9 @@ extern "C" { #define LEDC_ERR_VAL (-1) typedef enum { +#ifdef CONFIG_IDF_TARGET_ESP32 LEDC_HIGH_SPEED_MODE = 0, /*!< LEDC high speed speed_mode */ +#endif LEDC_LOW_SPEED_MODE, /*!< LEDC low speed speed_mode */ LEDC_SPEED_MODE_MAX, /*!< LEDC speed limit */ } ledc_mode_t; @@ -93,12 +95,14 @@ typedef enum { LEDC_TIMER_12_BIT, /*!< LEDC PWM duty resolution of 12 bits */ LEDC_TIMER_13_BIT, /*!< LEDC PWM duty resolution of 13 bits */ LEDC_TIMER_14_BIT, /*!< LEDC PWM duty resolution of 14 bits */ +#ifdef CONFIG_IDF_TARGET_ESP32 LEDC_TIMER_15_BIT, /*!< LEDC PWM duty resolution of 15 bits */ LEDC_TIMER_16_BIT, /*!< LEDC PWM duty resolution of 16 bits */ LEDC_TIMER_17_BIT, /*!< LEDC PWM duty resolution of 17 bits */ LEDC_TIMER_18_BIT, /*!< LEDC PWM duty resolution of 18 bits */ LEDC_TIMER_19_BIT, /*!< LEDC PWM duty resolution of 19 bits */ LEDC_TIMER_20_BIT, /*!< LEDC PWM duty resolution of 20 bits */ +#endif LEDC_TIMER_BIT_MAX, } ledc_timer_bit_t; @@ -307,7 +311,6 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t * @param arg User-supplied argument passed to the handler function. * @param intr_alloc_flags Flags used to allocate the interrupt. One or multiple (ORred) * ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info. - * @param arg Parameter for handler function * @param handle Pointer to return handle. If non-NULL, a handle for the interrupt will * be returned here. * diff --git a/components/driver/include/driver/mcpwm.h b/components/driver/include/driver/mcpwm.h index 03483cc4ad..4d29cfb966 100644 --- a/components/driver/include/driver/mcpwm.h +++ b/components/driver/include/driver/mcpwm.h @@ -20,6 +20,11 @@ #include "driver/gpio.h" #include "driver/periph_ctrl.h" #include "esp_intr_alloc.h" +#include "soc/soc_caps.h" + +#ifndef SOC_MCPWM_SUPPORTED +#error MCPWM is not supported in this chip target +#endif #ifdef __cplusplus extern "C" { @@ -691,7 +696,6 @@ esp_err_t mcpwm_sync_disable(mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num); * @param arg user-supplied argument passed to the handler function. * @param intr_alloc_flags flags used to allocate the interrupt. One or multiple (ORred) * ESP_INTR_FLAG_* values. see esp_intr_alloc.h for more info. - * @param arg parameter for handler function * @param handle pointer to return handle. If non-NULL, a handle for the interrupt will * be returned here. * diff --git a/components/driver/include/driver/pcnt.h b/components/driver/include/driver/pcnt.h index 76202cf902..f984dc68d3 100644 --- a/components/driver/include/driver/pcnt.h +++ b/components/driver/include/driver/pcnt.h @@ -47,10 +47,13 @@ typedef enum { PCNT_UNIT_1 = 1, /*!< PCNT unit 1 */ PCNT_UNIT_2 = 2, /*!< PCNT unit 2 */ PCNT_UNIT_3 = 3, /*!< PCNT unit 3 */ +//ESP32-S2 only have 4 unit +#ifdef CONFIG_IDF_TARGET_ESP32 PCNT_UNIT_4 = 4, /*!< PCNT unit 4 */ PCNT_UNIT_5 = 5, /*!< PCNT unit 5 */ PCNT_UNIT_6 = 6, /*!< PCNT unit 6 */ PCNT_UNIT_7 = 7, /*!< PCNT unit 7 */ +#endif PCNT_UNIT_MAX, } pcnt_unit_t; @@ -67,11 +70,11 @@ typedef enum { * @brief Selection of counter's events the may trigger an interrupt */ typedef enum { - PCNT_EVT_L_LIM = 0, /*!< PCNT watch point event: Minimum counter value */ - PCNT_EVT_H_LIM = 1, /*!< PCNT watch point event: Maximum counter value */ - PCNT_EVT_THRES_0 = 2, /*!< PCNT watch point event: threshold0 value event */ - PCNT_EVT_THRES_1 = 3, /*!< PCNT watch point event: threshold1 value event */ - PCNT_EVT_ZERO = 4, /*!< PCNT watch point event: counter value zero event */ + PCNT_EVT_THRES_1 = BIT(2), /*!< PCNT watch point event: threshold1 value event */ + PCNT_EVT_THRES_0 = BIT(3), /*!< PCNT watch point event: threshold0 value event */ + PCNT_EVT_L_LIM = BIT(4), /*!< PCNT watch point event: Minimum counter value */ + PCNT_EVT_H_LIM = BIT(5), /*!< PCNT watch point event: Maximum counter value */ + PCNT_EVT_ZERO = BIT(6), /*!< PCNT watch point event: counter value zero event */ PCNT_EVT_MAX } pcnt_evt_type_t; diff --git a/components/driver/include/driver/rmt.h b/components/driver/include/driver/rmt.h index f177c82b3b..317f063126 100644 --- a/components/driver/include/driver/rmt.h +++ b/components/driver/include/driver/rmt.h @@ -35,15 +35,18 @@ typedef enum { RMT_CHANNEL_1, /*!< RMT Channel 1 */ RMT_CHANNEL_2, /*!< RMT Channel 2 */ RMT_CHANNEL_3, /*!< RMT Channel 3 */ +//ESP32-S2 only have 4 channel +#ifdef CONFIG_IDF_TARGET_ESP32 RMT_CHANNEL_4, /*!< RMT Channel 4 */ RMT_CHANNEL_5, /*!< RMT Channel 5 */ RMT_CHANNEL_6, /*!< RMT Channel 6 */ RMT_CHANNEL_7, /*!< RMT Channel 7 */ +#endif RMT_CHANNEL_MAX } rmt_channel_t; typedef enum { - RMT_MEM_OWNER_TX = 0, /*!< RMT RX mode, RMT transmitter owns the memory block*/ + RMT_MEM_OWNER_TX = 0, /*!< RMT TX mode, RMT transmitter owns the memory block*/ RMT_MEM_OWNER_RX = 1, /*!< RMT RX mode, RMT receiver owns the memory block*/ RMT_MEM_OWNER_MAX, }rmt_mem_owner_t; diff --git a/components/driver/include/driver/rtc_io.h b/components/driver/include/driver/rtc_io.h index a2f37a3e7d..73ede43419 100644 --- a/components/driver/include/driver/rtc_io.h +++ b/components/driver/include/driver/rtc_io.h @@ -24,12 +24,19 @@ extern "C" { #endif typedef enum { - RTC_GPIO_MODE_INPUT_ONLY , /*!< Pad input */ - RTC_GPIO_MODE_OUTPUT_ONLY, /*!< Pad output */ + RTC_GPIO_MODE_INPUT_ONLY , /*!< Pad input */ + RTC_GPIO_MODE_OUTPUT_ONLY, /*!< Pad output */ RTC_GPIO_MODE_INPUT_OUTPUT, /*!< Pad pull input + output */ - RTC_GPIO_MODE_DISABLED, /*!< Pad (output + input) disable */ + RTC_GPIO_MODE_DISABLED, /*!< Pad (output + input) disable */ } rtc_gpio_mode_t; +#if CONFIG_IDF_TARGET_ESP32S2BETA +typedef enum { + RTCIO_MODE_OUTPUT = 0, /*!< Pad output normal mode */ + RTCIO_MODE_OUTPUT_OD = 1, /*!< Pad output OD mode */ +} rtc_io_out_mode_t; +#endif + /** * @brief Determine if the specified GPIO is a valid RTC GPIO. * @@ -38,8 +45,12 @@ typedef enum { */ inline static bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 return gpio_num < GPIO_PIN_COUNT && rtc_gpio_desc[gpio_num].reg != 0; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + return (gpio_num < RTC_GPIO_NUMBER); +#endif } #define RTC_GPIO_IS_VALID_GPIO(gpio_num) rtc_gpio_is_valid_gpio(gpio_num) // Deprecated, use rtc_gpio_is_valid_gpio() @@ -266,7 +277,71 @@ esp_err_t rtc_gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) */ esp_err_t rtc_gpio_wakeup_disable(gpio_num_t gpio_num); +#if CONFIG_IDF_TARGET_ESP32S2BETA +/** + * @brief RTC IO set output mode + * @param gpio_num Configure GPIO pins number + * @param mode GPIO output mode + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG GPIO error + * + */ +esp_err_t rtc_gpio_set_output_mode(gpio_num_t gpio_num, rtc_io_out_mode_t mode); +/** + * @brief RTC IO get output mode + * @param gpio_num Configure GPIO pins number + * @param mode GPIO output mode + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG GPIO error + */ +esp_err_t rtc_gpio_get_output_mode(gpio_num_t gpio_num, rtc_io_out_mode_t *mode); + +/** + * @brief Set RTC IO status in deep sleep + * In some application scenarios, IO needs to have another states during deep sleep. + * @param gpio_num Configure GPIO pins number + * @param input input mode. false: close; true: open; + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG GPIO error + */ +esp_err_t rtc_gpio_sleep_input_enable(gpio_num_t gpio_num, bool input); + +/** + * @brief Set RTC IO status in deep sleep + * In some application scenarios, IO needs to have another states during deep sleep. + * @param gpio_num Configure GPIO pins number + * @param output output mode. false: close; true: open; + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG GPIO error + */ +esp_err_t rtc_gpio_sleep_output_enable(gpio_num_t gpio_num, bool output); + +/** + * @brief Close RTC IO status in deep sleep + * In some application scenarios, IO needs to have another states during deep sleep. + * @param gpio_num Configure GPIO pins number + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG GPIO error + */ +esp_err_t rtc_gpio_sleep_mode_disable(gpio_num_t gpio_num); + +/** + * @brief Enable force hold signal for all RTC IOs + * + * Each RTC pad has a "force hold" input signal from the RTC controller. + * If this signal is set, pad latches current values of input enable, + * function, output enable, and other signals which come from the RTC mux. + * Force hold signal is enabled before going into deep sleep for pins which + * are used for EXT1 wakeup. + */ +esp_err_t rtc_gpio_force_hold_all(void); +#endif #ifdef __cplusplus } diff --git a/components/driver/include/driver/sdmmc_host.h b/components/driver/include/driver/sdmmc_host.h index 8cd403d859..1cae99e2dd 100644 --- a/components/driver/include/driver/sdmmc_host.h +++ b/components/driver/include/driver/sdmmc_host.h @@ -20,6 +20,12 @@ #include "sdmmc_types.h" #include "driver/gpio.h" +#include "soc/soc_caps.h" + +#ifndef SOC_SDMMC_HOST_SUPPORTED +#error SDMMC host is not supported in this chip target +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/components/driver/include/driver/sdspi_host.h b/components/driver/include/driver/sdspi_host.h index 8cb922803f..6eb24587de 100644 --- a/components/driver/include/driver/sdspi_host.h +++ b/components/driver/include/driver/sdspi_host.h @@ -20,7 +20,6 @@ #include "sdmmc_types.h" #include "driver/gpio.h" #include "driver/spi_master.h" -#include "driver/sdmmc_host.h" #ifdef __cplusplus extern "C" { diff --git a/components/driver/include/driver/spi_common.h b/components/driver/include/driver/spi_common.h index eab9b35279..a7e3fde718 100644 --- a/components/driver/include/driver/spi_common.h +++ b/components/driver/include/driver/spi_common.h @@ -17,7 +17,7 @@ #include #include #include "esp_err.h" -#include "esp32/rom/lldesc.h" +#include "soc/lldesc.h" #include "soc/spi_periph.h" #include "hal/spi_types.h" #include "sdkconfig.h" @@ -138,7 +138,6 @@ esp_err_t spi_bus_initialize(spi_host_device_t host, const spi_bus_config_t *bus */ esp_err_t spi_bus_free(spi_host_device_t host); - #ifdef __cplusplus } #endif diff --git a/components/driver/include/driver/spi_master.h b/components/driver/include/driver/spi_master.h index 87ba4142a6..4753a780c8 100644 --- a/components/driver/include/driver/spi_master.h +++ b/components/driver/include/driver/spi_master.h @@ -22,6 +22,7 @@ /** SPI master clock is divided by 80MHz apb clock. Below defines are example frequencies, and are accurate. Be free to specify a random frequency, it will be rounded to closest frequency (to macros below if above 8MHz). * 8MHz */ +#if APB_CLK_FREQ==80*1000*1000 #define SPI_MASTER_FREQ_8M (APB_CLK_FREQ/10) #define SPI_MASTER_FREQ_9M (APB_CLK_FREQ/9) ///< 8.89MHz #define SPI_MASTER_FREQ_10M (APB_CLK_FREQ/8) ///< 10MHz @@ -32,7 +33,14 @@ #define SPI_MASTER_FREQ_26M (APB_CLK_FREQ/3) ///< 26.67MHz #define SPI_MASTER_FREQ_40M (APB_CLK_FREQ/2) ///< 40MHz #define SPI_MASTER_FREQ_80M (APB_CLK_FREQ/1) ///< 80MHz - +#elif APB_CLK_FREQ==40*1000*1000 +#define SPI_MASTER_FREQ_7M (APB_CLK_FREQ/6) ///< 13.33MHz +#define SPI_MASTER_FREQ_8M (APB_CLK_FREQ/5) ///< 16MHz +#define SPI_MASTER_FREQ_10M (APB_CLK_FREQ/4) ///< 20MHz +#define SPI_MASTER_FREQ_13M (APB_CLK_FREQ/3) ///< 26.67MHz +#define SPI_MASTER_FREQ_20M (APB_CLK_FREQ/2) ///< 40MHz +#define SPI_MASTER_FREQ_40M (APB_CLK_FREQ/1) ///< 80MHz +#endif #ifdef __cplusplus extern "C" { @@ -51,6 +59,7 @@ extern "C" * Set this flag to confirm that you're going to work with output only, or read without dummy bits at your own risk. */ #define SPI_DEVICE_NO_DUMMY (1<<6) +#define SPI_DEVICE_DDRCLK (1<<7) typedef struct spi_transaction_t spi_transaction_t; @@ -64,8 +73,8 @@ typedef struct { uint8_t address_bits; ///< Default amount of bits in address phase (0-64), used when ``SPI_TRANS_VARIABLE_ADDR`` is not used, otherwise ignored. uint8_t dummy_bits; ///< Amount of dummy bits to insert between address and data phase uint8_t mode; ///< SPI mode (0-3) - uint8_t duty_cycle_pos; ///< Duty cycle of positive clock, in 1/256th increments (128 = 50%/50% duty). Setting this to 0 (=not setting it) is equivalent to setting this to 128. - uint8_t cs_ena_pretrans; ///< Amount of SPI bit-cycles the cs should be activated before the transmission (0-16). This only works on half-duplex transactions. + uint16_t duty_cycle_pos; ///< Duty cycle of positive clock, in 1/256th increments (128 = 50%/50% duty). Setting this to 0 (=not setting it) is equivalent to setting this to 128. + uint16_t cs_ena_pretrans; ///< Amount of SPI bit-cycles the cs should be activated before the transmission (0-16). This only works on half-duplex transactions. uint8_t cs_ena_posttrans; ///< Amount of SPI bit-cycles the cs should stay active after the transmission (0-16) int clock_speed_hz; ///< Clock speed, divisors of 80MHz, in Hz. See ``SPI_MASTER_FREQ_*``. int input_delay_ns; /**< Maximum data valid time of slave. The time required between SCLK and MISO @@ -107,6 +116,7 @@ typedef struct { #define SPI_TRANS_VARIABLE_CMD (1<<5) ///< Use the ``command_bits`` in ``spi_transaction_ext_t`` rather than default value in ``spi_device_interface_config_t``. #define SPI_TRANS_VARIABLE_ADDR (1<<6) ///< Use the ``address_bits`` in ``spi_transaction_ext_t`` rather than default value in ``spi_device_interface_config_t``. #define SPI_TRANS_VARIABLE_DUMMY (1<<7) ///< Use the ``dummy_bits`` in ``spi_transaction_ext_t`` rather than default value in ``spi_device_interface_config_t``. +#define SPI_TRANS_SET_CD (1<<7) ///< Set the CD pin /** * This structure describes one SPI transaction. The descriptor should not be modified until the transaction finishes. diff --git a/components/driver/include/driver/timer.h b/components/driver/include/driver/timer.h index 6ab7e10958..c760fb3898 100644 --- a/components/driver/include/driver/timer.h +++ b/components/driver/include/driver/timer.h @@ -73,6 +73,16 @@ typedef enum { TIMER_AUTORELOAD_MAX, } timer_autoreload_t; +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +/** + * @brief Select timer source clock. + */ +typedef enum { + TIMER_SRC_CLK_APB = 0, /*!< Select APB as the source clock*/ + TIMER_SRC_CLK_XTAL = 1, /*!< Select XTAL as the source clock*/ +} timer_src_clk_t; +#endif + /** * @brief Data structure with timer's configuration settings */ @@ -83,6 +93,9 @@ typedef struct { timer_count_dir_t counter_dir; /*!< Counter direction */ bool auto_reload; /*!< Timer auto-reload */ uint32_t divider; /*!< Counter clock divider. The divider's range is from from 2 to 65536. */ +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA + timer_src_clk_t clk_sel; /*!< Use XTAL as source clock. */ +#endif } timer_config_t; diff --git a/components/driver/include/driver/touch_pad.h b/components/driver/include/driver/touch_pad.h index 8731115b4b..92f2c6e8a2 100644 --- a/components/driver/include/driver/touch_pad.h +++ b/components/driver/include/driver/touch_pad.h @@ -14,6 +14,7 @@ #ifndef _DRIVER_TOUCH_PAD_H_ #define _DRIVER_TOUCH_PAD_H_ + #ifdef __cplusplus extern "C" { #endif @@ -21,6 +22,7 @@ extern "C" { #include "esp_intr_alloc.h" #include "soc/touch_periph.h" +#if CONFIG_IDF_TARGET_ESP32 typedef enum { TOUCH_PAD_NUM0 = 0, /*!< Touch pad channel 0 is GPIO4 */ TOUCH_PAD_NUM1, /*!< Touch pad channel 1 is GPIO0 */ @@ -34,6 +36,32 @@ typedef enum { TOUCH_PAD_NUM9, /*!< Touch pad channel 9 is GPIO32*/ TOUCH_PAD_MAX, } touch_pad_t; +#elif CONFIG_IDF_TARGET_ESP32S2BETA +typedef enum { + TOUCH_PAD_NUM0 = 0, /*!< Internal channel, be used for denoise */ +#define TOUCH_DENOISE_CHANNEL TOUCH_PAD_NUM0 /*!< T0 is an internal channel that does not have a corresponding external GPIO. + T0 will work simultaneously with the measured channel Tn. Finally, the actual + measured value of Tn is the value after subtracting lower bits of T0. */ + TOUCH_PAD_NUM1, /*!< Touch channel 1 is GPIO1 */ + TOUCH_PAD_NUM2, /*!< Touch channel 2 is GPIO2 */ + TOUCH_PAD_NUM3, /*!< Touch channel 3 is GPIO3 */ + TOUCH_PAD_NUM4, /*!< Touch channel 4 is GPIO4 */ + TOUCH_PAD_NUM5, /*!< Touch channel 5 is GPIO5 */ + TOUCH_PAD_NUM6, /*!< Touch channel 6 is GPIO6 */ + TOUCH_PAD_NUM7, /*!< Touch channel 7 is GPIO7 */ + TOUCH_PAD_NUM8, /*!< Touch channel 8 is GPIO8 */ + TOUCH_PAD_NUM9, /*!< Touch channel 9 is GPIO9 */ + TOUCH_PAD_NUM10, /*!< Touch channel 9 is GPIO10 */ + TOUCH_PAD_NUM11, /*!< Touch channel 9 is GPIO11 */ + TOUCH_PAD_NUM12, /*!< Touch channel 9 is GPIO12 */ + TOUCH_PAD_NUM13, /*!< Touch channel 9 is GPIO13 */ + TOUCH_PAD_NUM14, /*!< Touch channel 9 is GPIO14 */ +#define TOUCH_SHIELD_CHANNEL TOUCH_PAD_NUM14 /*!< The waterproof function includes a shielded channel (TOUCH_PAD_NUM14) + The shielded channel outputs the same signal as the channel being measured. + It is generally designed as a grid and is placed around the touch buttons. */ + TOUCH_PAD_MAX, +} touch_pad_t; +#endif typedef enum { TOUCH_HVOLT_KEEP = -1, /*! (touch threshold + hysteresis), the touch channel be touched. + If (raw data - baseline) < (touch threshold - hysteresis), the touch channel be released. + Range: 0 ~ 3. The coefficient is 0: 1/8; 1: 3/32; 2: 1/16; 3: 1/32 */ + uint8_t noise_thr; /*! (noise), the baseline stop updating. + If (raw data - baseline) < (noise), the baseline start updating. + Range: 0 ~ 3. The coefficient is 0: 1/2; 1: 3/8; 2: 1/4; 3: 1/8; */ + uint8_t noise_neg_thr; /*! (- negative noise), the baseline start updating. + If (raw data - baseline) < (- negative noise), the baseline stop updating. + Range: 0 ~ 3. The coefficient is 0: 1/2; 1: 3/8; 2: 1/4; 3: 1/8; */ + uint8_t neg_noise_limit; /*! BIT(14) + * @return + * - ESP_OK on success + */ +esp_err_t touch_pad_set_group_mask(uint16_t enable_mask); + +/** + * @brief Get the touch sensor scan group bit mask. + * @param enable_mask Pointer to bitmask of touch sensor scan group. + * e.g. TOUCH_PAD_NUM14 -> BIT(14) + * @return + * - ESP_OK on success + */ +esp_err_t touch_pad_get_group_mask(uint16_t *enable_mask); + +/** + * @brief Clear touch channel from touch sensor scan group. + * The working mode of the touch sensor is cyclically scanned. + * This function will clear the scan bits according to the given bitmask. + * @note If clear all mask, the FSM timer should be stop firsty. + * @param enable_mask bitmask of touch sensor scan group. + * e.g. TOUCH_PAD_NUM14 -> BIT(14) + * @return + * - ESP_OK on success + */ +esp_err_t touch_pad_clear_group_mask(uint16_t enable_mask); + +/** + * @brief Configure parameter for each touch channel. + * @note Touch num 0 is denoise channel, please use `touch_pad_denoise_enable` to set denoise function + * @param touch_num touch pad index + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG if argument wrong + * - ESP_FAIL if touch pad not initialized + */ +esp_err_t touch_pad_config(touch_pad_t touch_num); + +/** + * @brief Reset the whole of touch module. + * @note Call this funtion after `touch_pad_fsm_stop`, + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_reset(void); + +/** + * @brief Check touch sensor measurement status. + * If doing measurement, the flag will be clear. + * If finish measurement. the flag will be set. + * @return + * - TRUE finish measurement + * - FALSE doing measurement + */ +bool touch_pad_meas_is_done(void); + +/** + * @brief Get the current scan channel. + * usually used in ISR to decide channel scaning, and then, get the current measurement value. + * The role of each bit is reference to type `touch_pad_intr_mask_t`. + * @return + * - touch channel number + */ +touch_pad_t touch_pad_get_scan_curr(void); + +/** + * @brief Get the touch sensor interrupt status mask. usually used in ISR to decide interrupt type. + * The role of each bit is reference to type `touch_pad_intr_mask_t`. + * @return + * - touch intrrupt bit + */ +uint32_t touch_pad_intr_status_get_mask(void); + +/** + * @brief Enable touch sensor interrupt. + * @param type interrupt type + * @return + * - ESP_OK on success + */ +esp_err_t touch_pad_intr_enable(touch_pad_intr_mask_t int_mask); + +/** + * @brief Disable touch sensor interrupt. + * @param type interrupt type + * @return + * - ESP_OK on success + */ +esp_err_t touch_pad_intr_disable(touch_pad_intr_mask_t int_mask); + +/** + * @brief Register touch-pad ISR. + * The handler will be attached to the same CPU core that this function is running on. + * @param fn Pointer to ISR handler + * @param arg Parameter for ISR + * @return + * - ESP_OK Success ; + * - ESP_ERR_INVALID_ARG GPIO error + * - ESP_ERR_NO_MEM No memory + */ +esp_err_t touch_pad_isr_register(intr_handler_t fn, void* arg, touch_pad_intr_mask_t intr_mask); + +/** + * @brief get raw data of touch sensor. + * @note After the initialization is complete, the "raw_data" is max value. You need to wait for a measurement + * cycle before you can read the correct touch value. + * @param touch_num touch pad index + * @param raw_data pointer to accept touch sensor value + * @return + * - ESP_OK Success + * - ESP_FAIL Touch channel 0 havent this parameter. + */ + +esp_err_t touch_pad_read_raw_data(touch_pad_t touch_num, uint32_t *raw_data); + +/** + * @brief get baseline of touch sensor. + * @note After the initialization is complete, the "touch_value" is max value. You need to wait for a measurement + * cycle before you can read the correct touch value. + * @param touch_num touch pad index + * @param touch_value pointer to accept touch sensor value + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG Touch channel 0 havent this parameter. + */ +esp_err_t touch_pad_filter_baseline_read(touch_pad_t touch_num, uint32_t *basedata); + +/** + * @brief Reset baseline to raw data of touch sensor. + * @param touch_num touch pad index + * - TOUCH_PAD_MAX Reset basaline of all channels + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_filter_baseline_reset(touch_pad_t touch_num); + +/** + * @brief get debounce count of touch sensor. + * @param touch_num touch pad index + * @param debounce pointer to debounce value + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG Touch channel 0 havent this parameter. + */ +esp_err_t touch_pad_filter_debounce_read(touch_pad_t touch_num, uint32_t *debounce); + +/** + * @brief set parameter of touch sensor filter and detection algorithm. + * For more details on the detection algorithm, please refer to the application documentation. + * @param filter_info select filter type and threshold of detection algorithm + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_filter_set_config(touch_filter_config_t *filter_info); + +/** + * @brief get parameter of touch sensor filter and detection algorithm. + * For more details on the detection algorithm, please refer to the application documentation. + * @param filter_info select filter type and threshold of detection algorithm + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_filter_get_config(touch_filter_config_t *filter_info); + +/** + * @brief enable touch sensor filter and detection algorithm. + * For more details on the detection algorithm, please refer to the application documentation. + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_filter_enable(void); + +/** + * @brief diaable touch sensor filter and detection algorithm. + * For more details on the detection algorithm, please refer to the application documentation. + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_filter_disable(void); + +/** + * @brief set parameter of denoise pad (TOUCH_PAD_NUM0). + * T0 is an internal channel that does not have a corresponding external GPIO. + * T0 will work simultaneously with the measured channel Tn. Finally, the actual + * measured value of Tn is the value after subtracting lower bits of T0. + * This denoise function filters out interference introduced on all channels, + * such as noise introduced by the power supply and external EMI. + * @param denoise parameter of denoise + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_denoise_set_config(touch_pad_denoise_t denoise); + +/** + * @brief get parameter of denoise pad (TOUCH_PAD_NUM0). + * @param denoise Pointer to parameter of denoise + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_denoise_get_config(touch_pad_denoise_t *denoise); + +/** + * @brief enable denoise function. + * T0 is an internal channel that does not have a corresponding external GPIO. + * T0 will work simultaneously with the measured channel Tn. Finally, the actual + * measured value of Tn is the value after subtracting lower bits of T0. + * This denoise function filters out interference introduced on all channels, + * such as noise introduced by the power supply and external EMI. + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_denoise_enable(void); + +/** + * @brief disable denoise function. + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_denoise_disable(void); + +/** + * @brief get denoise measure value (TOUCH_PAD_NUM0). + * @param denoise value of denoise + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_denoise_data_get(uint32_t *data); + +/** + * @brief set parameter of waterproof function. + * The waterproof function includes a shielded channel (TOUCH_PAD_NUM14) and a guard channel. + * The shielded channel outputs the same signal as the channel being measured. + * It is generally designed as a grid and is placed around the touch buttons. + * The shielded channel does not follow the measurement signal of the protection channel. + * So that the guard channel can detect a large area of water. + * @param waterproof parameter of waterproof + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_waterproof_set_config(touch_pad_waterproof_t waterproof); + +/** + * @brief get parameter of waterproof function. + * @param waterproof parameter of waterproof + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_waterproof_get_config(touch_pad_waterproof_t *waterproof); + +/** + * @brief Enable parameter of waterproof function. + * The waterproof function includes a shielded channel (TOUCH_PAD_NUM14) and a guard channel. + * The shielded channel outputs the same signal as the channel being measured. + * It is generally designed as a grid and is placed around the touch buttons. + * The shielded channel does not follow the measurement signal of the protection channel. + * So that the guard channel can detect a large area of water. + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_waterproof_enable(void); + +/** + * @brief Enable parameter of waterproof function. + * The waterproof function includes a shielded channel (TOUCH_PAD_NUM14) and a guard channel. + * The shielded channel outputs the same signal as the channel being measured. + * It is generally designed as a grid and is placed around the touch buttons. + * The shielded channel does not follow the measurement signal of the protection channel. + * So that the guard channel can detect a large area of water. + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_waterproof_disable(void); + +/** + * @brief Set parameter of proximity channel. Three proximity sensing channels can be set. + * The proximity sensor measurement is the accumulation of touch channel measurements. + * @note If stop the proximity function for the channel, point this proximity channel to `TOUCH_PAD_NUM0`. + * @param proximity parameter of proximity + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_proximity_set_config(touch_pad_proximity_t proximity); + +/** + * @brief Get parameter of proximity channel. Three proximity sensing channels can be set. + * The proximity sensor measurement is the accumulation of touch channel measurements. + * @param proximity parameter of proximity + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_proximity_get_config(touch_pad_proximity_t *proximity); + +/** + * @brief Get measure count of proximity channel. + * The proximity sensor measurement is the accumulation of touch channel measurements. + * @param touch_num touch pad index + * @param proximity parameter of proximity + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG parameter is NULL + */ +esp_err_t touch_pad_proximity_get_meas_cnt(touch_pad_t touch_num, uint32_t *cnt); + +/** + * @brief Get the accumulated measurement of the proximity sensor. + * The proximity sensor measurement is the accumulation of touch channel measurements. + * @param touch_num touch pad index + * @param measure_out If the accumulation process does not end, the `measure_out` is the process value. + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_proximity_data_get(touch_pad_t touch_num, uint32_t *measure_out); + +/** + * @brief Set parameter of touch sensor in sleep mode. + * In order to achieve low power consumption in sleep mode, other circuits except the RTC part of the register are in a power-off state. + * Only one touch channel is supported in the sleep state, which can be used as a wake-up function. + * If in non-sleep mode, the sleep parameters do not work. + * @param slp_config touch pad config + * @return + * - ESP_OK Success + */ +esp_err_t touch_pad_sleep_channel_config(touch_pad_sleep_channel_t slp_config); + +/** + * @brief get baseline of touch sensor in sleep mode. + * @param baseline pointer to accept touch sensor baseline value + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG parameter is NULL + */ +esp_err_t touch_pad_sleep_channel_baseline_get(uint32_t *baseline); + +/** + * @brief get debounce of touch sensor in sleep mode. + * @param debounce pointer to accept touch sensor debounce value + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG parameter is NULL + */ +esp_err_t touch_pad_sleep_channel_debounce_get(uint32_t *debounce); + +/** + * @brief get proximity count of touch sensor in sleep mode. + * @param proximity_cnt pointer to accept touch sensor proximity count value + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG parameter is NULL + */ +esp_err_t touch_pad_sleep_channel_proximity_cnt_get(uint32_t *proximity_cnt); + +#endif // CONFIG_IDF_TARGET_ESP32S2BETA #ifdef __cplusplus } diff --git a/components/driver/include/driver/uart.h b/components/driver/include/driver/uart.h index f25e21776e..7e82b82c66 100644 --- a/components/driver/include/driver/uart.h +++ b/components/driver/include/driver/uart.h @@ -675,26 +675,51 @@ esp_err_t uart_get_buffered_data_len(uart_port_t uart_num, size_t* size); */ esp_err_t uart_disable_pattern_det_intr(uart_port_t uart_num); +#if CONFIG_IDF_TARGET_ESP32 +/** + * @brief UART enable pattern detect function. + * Designed for applications like 'AT commands'. + * When the hardware detect a series of one same character, the interrupt will be triggered. + * @note This function only works for esp32. And this function is deprecated, please use + * uart_enable_pattern_det_baud_intr instead. + * + * @param uart_num UART port number. + * @param pattern_chr character of the pattern. + * @param chr_num number of the character, 8bit value. + * @param chr_tout timeout of the interval between each pattern characters, 24bit value, unit is APB (80Mhz) clock cycle. + * When the duration is less than this value, it will not take this data as at_cmd char. + * @param post_idle idle time after the last pattern character, 24bit value, unit is APB (80Mhz) clock cycle. + * When the duration is less than this value, it will not take the previous data as the last at_cmd char + * @param pre_idle idle time before the first pattern character, 24bit value, unit is APB (80Mhz) clock cycle. + * When the duration is less than this value, it will not take this data as the first at_cmd char. + * + * @return + * - ESP_OK Success + * - ESP_FAIL Parameter error + */ +esp_err_t uart_enable_pattern_det_intr(uart_port_t uart_num, char pattern_chr, uint8_t chr_num, int chr_tout, int post_idle, int pre_idle) __attribute__((deprecated)); +#endif + /** * @brief UART enable pattern detect function. * Designed for applications like 'AT commands'. * When the hardware detect a series of one same character, the interrupt will be triggered. * * @param uart_num UART port number. - * @param pattern_chr character of the pattern + * @param pattern_chr character of the pattern. * @param chr_num number of the character, 8bit value. - * @param chr_tout timeout of the interval between each pattern characters, 24bit value, unit is APB (80Mhz) clock cycle. - * When the duration is less than this value, it will not take this data as at_cmd char - * @param post_idle idle time after the last pattern character, 24bit value, unit is APB (80Mhz) clock cycle. + * @param chr_tout timeout of the interval between each pattern characters, 16bit value, unit is the baud-rate cycle you configured. + * When the duration is more than this value, it will not take this data as at_cmd char. + * @param post_idle idle time after the last pattern character, 16bit value, unit is the baud-rate cycle you configured. * When the duration is less than this value, it will not take the previous data as the last at_cmd char - * @param pre_idle idle time before the first pattern character, 24bit value, unit is APB (80Mhz) clock cycle. - * When the duration is less than this value, it will not take this data as the first at_cmd char + * @param pre_idle idle time before the first pattern character, 16bit value, unit is the baud-rate cycle you configured. + * When the duration is less than this value, it will not take this data as the first at_cmd char. * * @return * - ESP_OK Success * - ESP_FAIL Parameter error */ -esp_err_t uart_enable_pattern_det_intr(uart_port_t uart_num, char pattern_chr, uint8_t chr_num, int chr_tout, int post_idle, int pre_idle); +esp_err_t uart_enable_pattern_det_baud_intr(uart_port_t uart_num, char pattern_chr, uint8_t chr_num, int chr_tout, int post_idle, int pre_idle); /** * @brief Return the nearest detected pattern position in buffer. diff --git a/components/driver/ledc.c b/components/driver/ledc.c index b0e9a3939d..f44625217e 100644 --- a/components/driver/ledc.c +++ b/components/driver/ledc.c @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// 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. @@ -11,8 +11,8 @@ // 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. -#include #include +#include #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" #include "freertos/xtensa_api.h" @@ -52,9 +52,13 @@ static ledc_isr_handle_t s_ledc_fade_isr_handle = NULL; #define LEDC_VAL_NO_CHANGE (-1) #define LEDC_STEP_NUM_MAX (1023) #define LEDC_DUTY_DECIMAL_BIT_NUM (4) +#define LEDC_TIMER_DIV_NUM_MAX (0x3FFFF) +#define LEDC_DUTY_NUM_MAX (LEDC_DUTY_NUM_LSCH0_V) +#define LEDC_DUTY_CYCLE_MAX (LEDC_DUTY_CYCLE_LSCH0_V) +#define LEDC_DUTY_SCALE_MAX (LEDC_DUTY_SCALE_LSCH0_V) +#define LEDC_HPOINT_VAL_MAX (LEDC_HPOINT_LSCH1_V) #define DELAY_CLK8M_CLK_SWITCH (5) #define SLOW_CLK_CYC_CALIBRATE (13) -#define LEDC_HPOINT_VAL_MAX (LEDC_HPOINT_HSCH1_V) #define LEDC_FADE_TOO_SLOW_STR "LEDC FADE TOO SLOW" #define LEDC_FADE_TOO_FAST_STR "LEDC FADE TOO FAST" static const char *LEDC_FADE_SERVICE_ERR_STR = "LEDC fade service not installed"; @@ -80,6 +84,7 @@ static IRAM_ATTR void ledc_ls_channel_update(ledc_mode_t speed_mode, ledc_channe //We know that CLK8M is about 8M, but don't know the actual value. So we need to do a calibration. static bool ledc_slow_clk_calibrate(void) { +#ifdef CONFIG_IDF_TARGET_ESP32 //Enable CLK8M for LEDC SET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_CLK8M_EN_M); //Waiting for CLK8M to turn on @@ -92,6 +97,10 @@ static bool ledc_slow_clk_calibrate(void) s_ledc_slow_clk_8M = 1000000ULL * (1 << RTC_CLK_CAL_FRACT) * 256 / cal_val; ESP_LOGD(LEDC_TAG, "Calibrate CLK8M_CLK : %d Hz", s_ledc_slow_clk_8M); return true; +#else + ESP_LOGE(LEDC_TAG, "CLK8M source currently only supported on ESP32"); + return false; +#endif } static esp_err_t ledc_enable_intr_type(ledc_mode_t speed_mode, uint32_t channel, ledc_intr_type_t type) @@ -101,7 +110,11 @@ static esp_err_t ledc_enable_intr_type(ledc_mode_t speed_mode, uint32_t channel, uint32_t intr_type = type; portENTER_CRITICAL(&ledc_spinlock); value = LEDC.int_ena.val; +#ifdef CONFIG_IDF_TARGET_ESP32 uint8_t int_en_base = LEDC_DUTY_CHNG_END_HSCH0_INT_ENA_S; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + uint8_t int_en_base = LEDC_DUTY_CHNG_END_LSCH0_INT_ENA_S; +#endif if (speed_mode == LEDC_LOW_SPEED_MODE) { int_en_base = LEDC_DUTY_CHNG_END_LSCH0_INT_ENA_S; } @@ -162,7 +175,18 @@ esp_err_t ledc_timer_set(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_ LEDC_ARG_CHECK(timer_sel < LEDC_TIMER_MAX, "timer_select"); portENTER_CRITICAL(&ledc_spinlock); LEDC.timer_group[speed_mode].timer[timer_sel].conf.clock_divider = clock_divider; - LEDC.timer_group[speed_mode].timer[timer_sel].conf.tick_sel = clk_src; +#ifdef CONFIG_IDF_TARGET_ESP32 + LEDC.timer_group[speed_mode].timer[timer_sel].conf.tick_sel = clk_src; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + if(clk_src == LEDC_REF_TICK) { + //REF_TICK can only be used when APB is selected. + LEDC.timer_group[speed_mode].timer[timer_sel].conf.tick_sel = 1; + LEDC.conf.apb_clk_sel = 1; + } else { + LEDC.timer_group[speed_mode].timer[timer_sel].conf.tick_sel = 0; + LEDC.conf.apb_clk_sel = clk_src; + } +#endif LEDC.timer_group[speed_mode].timer[timer_sel].conf.duty_resolution = duty_resolution; ledc_ls_timer_update(speed_mode, timer_sel); portEXIT_CRITICAL(&ledc_spinlock); @@ -174,15 +198,18 @@ static IRAM_ATTR esp_err_t ledc_duty_config(ledc_mode_t speed_mode, ledc_channel { portENTER_CRITICAL(&ledc_spinlock); if (hpoint_val >= 0) { - LEDC.channel_group[speed_mode].channel[channel_num].hpoint.hpoint = hpoint_val & LEDC_HPOINT_HSCH1_V; + LEDC.channel_group[speed_mode].channel[channel_num].hpoint.hpoint = hpoint_val; } if (duty_val >= 0) { LEDC.channel_group[speed_mode].channel[channel_num].duty.duty = duty_val; } - LEDC.channel_group[speed_mode].channel[channel_num].conf1.val = ((duty_direction & LEDC_DUTY_INC_HSCH0_V) << LEDC_DUTY_INC_HSCH0_S) | - ((duty_num & LEDC_DUTY_NUM_HSCH0_V) << LEDC_DUTY_NUM_HSCH0_S) | - ((duty_cycle & LEDC_DUTY_CYCLE_HSCH0_V) << LEDC_DUTY_CYCLE_HSCH0_S) | - ((duty_scale & LEDC_DUTY_SCALE_HSCH0_V) << LEDC_DUTY_SCALE_HSCH0_S); + typeof(LEDC.channel_group[0].channel[0].conf1) channel_cfg; + channel_cfg.val = 0; + channel_cfg.duty_inc = duty_direction; + channel_cfg.duty_num = duty_num; + channel_cfg.duty_cycle = duty_cycle; + channel_cfg.duty_scale = duty_scale; + LEDC.channel_group[speed_mode].channel[channel_num].conf1.val = channel_cfg.val; ledc_ls_channel_update(speed_mode, channel_num); portEXIT_CRITICAL(&ledc_spinlock); return ESP_OK; @@ -263,7 +290,7 @@ static esp_err_t ledc_set_timer_div(ledc_mode_t speed_mode, ledc_timer_t timer_n if (clk_cfg == LEDC_AUTO_CLK) { // Try calculating divisor based on LEDC_APB_CLK div_param = ( (uint64_t) LEDC_APB_CLK_HZ << 8 ) / freq_hz / precision; - if (div_param > LEDC_DIV_NUM_HSTIMER0_V) { + if (div_param > LEDC_TIMER_DIV_NUM_MAX) { // APB_CLK results in divisor which too high. Try using REF_TICK as clock source. timer_clk_src = LEDC_REF_TICK; div_param = ((uint64_t) LEDC_REF_CLK_HZ << 8) / freq_hz / precision; @@ -278,13 +305,15 @@ static esp_err_t ledc_set_timer_div(ledc_mode_t speed_mode, ledc_timer_t timer_n div_param = ( (uint64_t) sclk_freq << 8 ) / freq_hz / precision; } } - if (div_param < 256 || div_param > LEDC_DIV_NUM_LSTIMER0_V) { + if (div_param < 256 || div_param > LEDC_TIMER_DIV_NUM_MAX) { goto error; } +#ifdef CONFIG_IDF_TARGET_ESP32 // For low speed channels, if RTC_8MCLK is used as the source clock, the `slow_clk_sel` register should be cleared, otherwise it should be set. if (speed_mode == LEDC_LOW_SPEED_MODE) { LEDC.conf.slow_clk_sel = (clk_cfg == LEDC_USE_RTC8M_CLK) ? 0 : 1; } +#endif //Set the divisor ledc_timer_set(speed_mode, timer_num, div_param, duty_resolution, timer_clk_src); // reset the timer @@ -324,11 +353,7 @@ esp_err_t ledc_set_pin(int gpio_num, ledc_mode_t speed_mode, ledc_channel_t ledc LEDC_ARG_CHECK(speed_mode < LEDC_SPEED_MODE_MAX, "speed_mode"); PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], PIN_FUNC_GPIO); gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT); - if (speed_mode == LEDC_HIGH_SPEED_MODE) { - gpio_matrix_out(gpio_num, LEDC_HS_SIG_OUT0_IDX + ledc_channel, 0, 0); - } else { - gpio_matrix_out(gpio_num, LEDC_LS_SIG_OUT0_IDX + ledc_channel, 0, 0); - } + gpio_matrix_out(gpio_num, ledc_periph_signal[speed_mode].sig_out0_idx + ledc_channel, 0, 0); return ESP_OK; } @@ -364,11 +389,8 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t* ledc_conf) /*set LEDC signal in gpio matrix*/ PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], PIN_FUNC_GPIO); gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT); - if (speed_mode == LEDC_HIGH_SPEED_MODE) { - gpio_matrix_out(gpio_num, LEDC_HS_SIG_OUT0_IDX + ledc_channel, 0, 0); - } else { - gpio_matrix_out(gpio_num, LEDC_LS_SIG_OUT0_IDX + ledc_channel, 0, 0); - } + gpio_matrix_out(gpio_num, ledc_periph_signal[speed_mode].sig_out0_idx + ledc_channel, 0, 0); + return ret; } @@ -403,9 +425,9 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t LEDC_ARG_CHECK(speed_mode < LEDC_SPEED_MODE_MAX, "speed_mode"); LEDC_ARG_CHECK(channel < LEDC_CHANNEL_MAX, "channel"); LEDC_ARG_CHECK(fade_direction < LEDC_DUTY_DIR_MAX, "fade_direction"); - LEDC_ARG_CHECK(step_num <= LEDC_DUTY_NUM_HSCH0_V, "step_num"); - LEDC_ARG_CHECK(duty_cyle_num <= LEDC_DUTY_CYCLE_HSCH0_V, "duty_cycle_num"); - LEDC_ARG_CHECK(duty_scale <= LEDC_DUTY_SCALE_HSCH0_V, "duty_scale"); + LEDC_ARG_CHECK(step_num <= LEDC_DUTY_NUM_MAX, "step_num"); + LEDC_ARG_CHECK(duty_cyle_num <= LEDC_DUTY_CYCLE_MAX, "duty_cycle_num"); + LEDC_ARG_CHECK(duty_scale <= LEDC_DUTY_SCALE_MAX, "duty_scale"); _ledc_fade_hw_acquire(speed_mode, channel); ledc_duty_config(speed_mode, channel, //uint32_t chan_num, @@ -488,7 +510,7 @@ esp_err_t ledc_set_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num, uint32_t } else { clock_divider = ((uint64_t) LEDC_REF_CLK_HZ << 8) / freq_hz / precision; } - if (clock_divider <= 256 || clock_divider > LEDC_DIV_NUM_HSTIMER0) { + if (clock_divider <= 256 || clock_divider > LEDC_TIMER_DIV_NUM_MAX) { ESP_LOGE(LEDC_TAG, "div param err,div_param=%u", clock_divider); ret = ESP_FAIL; } @@ -516,66 +538,75 @@ uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num) return freq; } +static inline void ledc_calc_fade_end_channel(uint32_t *fade_end_status, int *channel, int *speed_mode) +{ + int i = __builtin_ffs((*fade_end_status)) - 1; + (*fade_end_status) &= ~(1 << i); + *speed_mode = LEDC_LOW_SPEED_MODE; + *channel = i; +#ifdef CONFIG_IDF_TARGET_ESP32 + if (i < LEDC_CHANNEL_MAX) { + *speed_mode = LEDC_HIGH_SPEED_MODE; + } else { + *channel = i - LEDC_CHANNEL_MAX; + } +#endif +} + void IRAM_ATTR ledc_fade_isr(void* arg) { - int channel; portBASE_TYPE HPTaskAwoken = pdFALSE; uint32_t intr_status = LEDC.int_st.val; //read LEDC interrupt status. - LEDC.int_clr.val = intr_status; //clear LEDC interrupt status. - int speed_mode = LEDC_HIGH_SPEED_MODE; - for (channel = 0; channel < LEDC_CHANNEL_MAX; channel++) { - if (intr_status & (BIT(LEDC_DUTY_CHNG_END_HSCH0_INT_ST_S + channel) | BIT(LEDC_DUTY_CHNG_END_LSCH0_INT_ST_S + channel))) { - if (intr_status & BIT(LEDC_DUTY_CHNG_END_HSCH0_INT_ST_S + channel)) { - speed_mode = LEDC_HIGH_SPEED_MODE; - } else { - speed_mode = LEDC_LOW_SPEED_MODE; - } - if (s_ledc_fade_rec[speed_mode][channel] == NULL) { - //fade object not initialized yet. - continue; - } - uint32_t duty_cur = LEDC.channel_group[speed_mode].channel[channel].duty_rd.duty_read >> LEDC_DUTY_DECIMAL_BIT_NUM; - if (duty_cur == s_ledc_fade_rec[speed_mode][channel]->target_duty) { - xSemaphoreGiveFromISR(s_ledc_fade_rec[speed_mode][channel]->ledc_fade_sem, &HPTaskAwoken); - if (HPTaskAwoken == pdTRUE) { - portYIELD_FROM_ISR(); - } - continue; - } - uint32_t duty_tar = s_ledc_fade_rec[speed_mode][channel]->target_duty; - int scale = s_ledc_fade_rec[speed_mode][channel]->scale; - if (scale == 0) { - xSemaphoreGiveFromISR(s_ledc_fade_rec[speed_mode][channel]->ledc_fade_sem, &HPTaskAwoken); - continue; - } - int cycle = s_ledc_fade_rec[speed_mode][channel]->cycle_num; - int delta = s_ledc_fade_rec[speed_mode][channel]->direction == LEDC_DUTY_DIR_DECREASE ? duty_cur - duty_tar : duty_tar - duty_cur; - int step = delta / scale > LEDC_STEP_NUM_MAX ? LEDC_STEP_NUM_MAX : delta / scale; - if (delta > scale) { - ledc_duty_config( - speed_mode, - channel, - LEDC_VAL_NO_CHANGE, - duty_cur << LEDC_DUTY_DECIMAL_BIT_NUM, - s_ledc_fade_rec[speed_mode][channel]->direction, - step, - cycle, - scale); - } else { - ledc_duty_config( - speed_mode, - channel, - LEDC_VAL_NO_CHANGE, - duty_tar << LEDC_DUTY_DECIMAL_BIT_NUM, - s_ledc_fade_rec[speed_mode][channel]->direction, - 1, - 1, - 0); - } - LEDC.channel_group[speed_mode].channel[channel].conf1.duty_start = 1; + uint32_t fade_end_status = (intr_status >> LEDC_LSTIMER0_OVF_INT_ST_S); + int speed_mode; + int channel; + while (fade_end_status) { + ledc_calc_fade_end_channel(&fade_end_status, &channel, &speed_mode); + if (s_ledc_fade_rec[speed_mode][channel] == NULL) { + //fade object not initialized yet. + continue; } + uint32_t duty_cur = LEDC.channel_group[speed_mode].channel[channel].duty_rd.duty_read >> LEDC_DUTY_DECIMAL_BIT_NUM; + if (duty_cur == s_ledc_fade_rec[speed_mode][channel]->target_duty) { + xSemaphoreGiveFromISR(s_ledc_fade_rec[speed_mode][channel]->ledc_fade_sem, &HPTaskAwoken); + continue; + } + uint32_t duty_tar = s_ledc_fade_rec[speed_mode][channel]->target_duty; + int scale = s_ledc_fade_rec[speed_mode][channel]->scale; + if (scale == 0) { + xSemaphoreGiveFromISR(s_ledc_fade_rec[speed_mode][channel]->ledc_fade_sem, &HPTaskAwoken); + continue; + } + int cycle = s_ledc_fade_rec[speed_mode][channel]->cycle_num; + int delta = s_ledc_fade_rec[speed_mode][channel]->direction == LEDC_DUTY_DIR_DECREASE ? duty_cur - duty_tar : duty_tar - duty_cur; + int step = delta / scale > LEDC_STEP_NUM_MAX ? LEDC_STEP_NUM_MAX : delta / scale; + if (delta > scale) { + ledc_duty_config( + speed_mode, + channel, + LEDC_VAL_NO_CHANGE, + duty_cur << LEDC_DUTY_DECIMAL_BIT_NUM, + s_ledc_fade_rec[speed_mode][channel]->direction, + step, + cycle, + scale); + } else { + ledc_duty_config( + speed_mode, + channel, + LEDC_VAL_NO_CHANGE, + duty_tar << LEDC_DUTY_DECIMAL_BIT_NUM, + s_ledc_fade_rec[speed_mode][channel]->direction, + 1, + 1, + 0); + } + LEDC.channel_group[speed_mode].channel[channel].conf1.duty_start = 1; } LEDC.int_clr.val = intr_status; //clear LEDC interrupt status. + if (HPTaskAwoken == pdTRUE) { + portYIELD_FROM_ISR(); + } } static esp_err_t ledc_fade_channel_deinit(ledc_mode_t speed_mode, ledc_channel_t channel) @@ -686,16 +717,16 @@ static esp_err_t _ledc_set_fade_with_time(ledc_mode_t speed_mode, ledc_channel_t if (total_cycles > duty_delta) { scale = 1; cycle_num = total_cycles / duty_delta; - if (cycle_num > LEDC_DUTY_NUM_HSCH0_V) { + if (cycle_num > LEDC_DUTY_NUM_MAX) { ESP_LOGW(LEDC_TAG, LEDC_FADE_TOO_SLOW_STR); - cycle_num = LEDC_DUTY_NUM_HSCH0_V; + cycle_num = LEDC_DUTY_NUM_MAX; } } else { cycle_num = 1; scale = duty_delta / total_cycles; - if (scale > LEDC_DUTY_SCALE_HSCH0_V) { + if (scale > LEDC_DUTY_SCALE_MAX) { ESP_LOGW(LEDC_TAG, LEDC_FADE_TOO_FAST_STR); - scale = LEDC_DUTY_SCALE_HSCH0_V; + scale = LEDC_DUTY_SCALE_MAX; } } return _ledc_set_fade_with_step(speed_mode, channel, target_duty, scale, cycle_num); @@ -705,7 +736,11 @@ static void _ledc_fade_start(ledc_mode_t speed_mode, ledc_channel_t channel, led { s_ledc_fade_rec[speed_mode][channel]->mode = fade_mode; // Clear interrupt status of channel +#ifdef CONFIG_IDF_TARGET_ESP32 int duty_resolution_ch0 = (speed_mode == LEDC_HIGH_SPEED_MODE) ? LEDC_DUTY_CHNG_END_HSCH0_INT_ENA_S : LEDC_DUTY_CHNG_END_LSCH0_INT_ENA_S; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + int duty_resolution_ch0 = LEDC_DUTY_CHNG_END_LSCH0_INT_ENA_S; +#endif LEDC.int_clr.val |= BIT(duty_resolution_ch0 + channel); // Enable interrupt for channel ledc_enable_intr_type(speed_mode, channel, LEDC_INTR_FADE_END); @@ -732,8 +767,8 @@ esp_err_t ledc_set_fade_with_step(ledc_mode_t speed_mode, ledc_channel_t channel { LEDC_ARG_CHECK(speed_mode < LEDC_SPEED_MODE_MAX, "speed_mode"); LEDC_ARG_CHECK(channel < LEDC_CHANNEL_MAX, "channel"); - LEDC_ARG_CHECK((scale > 0) && (scale <= LEDC_DUTY_SCALE_HSCH0_V), "fade scale"); - LEDC_ARG_CHECK((cycle_num > 0) && (cycle_num <= LEDC_DUTY_CYCLE_HSCH0_V), "cycle_num"); + LEDC_ARG_CHECK((scale > 0) && (scale <= LEDC_DUTY_SCALE_MAX), "fade scale"); + LEDC_ARG_CHECK((cycle_num > 0) && (cycle_num <= LEDC_DUTY_CYCLE_MAX), "cycle_num"); LEDC_ARG_CHECK(target_duty <= ledc_get_max_duty(speed_mode, channel), "target_duty"); LEDC_CHECK(ledc_fade_channel_init_check(speed_mode, channel) == ESP_OK , LEDC_FADE_INIT_ERROR_STR, ESP_FAIL); @@ -820,8 +855,8 @@ esp_err_t ledc_set_fade_step_and_start(ledc_mode_t speed_mode, ledc_channel_t ch LEDC_ARG_CHECK(channel < LEDC_CHANNEL_MAX, "channel"); LEDC_ARG_CHECK(fade_mode < LEDC_FADE_MAX, "fade_mode"); LEDC_CHECK(ledc_fade_channel_init_check(speed_mode, channel) == ESP_OK , LEDC_FADE_INIT_ERROR_STR, ESP_FAIL); - LEDC_ARG_CHECK((scale > 0) && (scale <= LEDC_DUTY_SCALE_HSCH0_V), "fade scale"); - LEDC_ARG_CHECK((cycle_num > 0) && (cycle_num <= LEDC_DUTY_CYCLE_HSCH0_V), "cycle_num"); + LEDC_ARG_CHECK((scale > 0) && (scale <= LEDC_DUTY_SCALE_MAX), "fade scale"); + LEDC_ARG_CHECK((cycle_num > 0) && (cycle_num <= LEDC_DUTY_CYCLE_MAX), "cycle_num"); LEDC_ARG_CHECK(target_duty <= ledc_get_max_duty(speed_mode, channel), "target_duty"); _ledc_op_lock_acquire(speed_mode, channel); _ledc_fade_hw_acquire(speed_mode, channel); diff --git a/components/driver/mcpwm.c b/components/driver/mcpwm.c index 714855ea5a..bbb837045b 100644 --- a/components/driver/mcpwm.c +++ b/components/driver/mcpwm.c @@ -23,6 +23,8 @@ #include "soc/gpio_periph.h" #include "driver/mcpwm.h" #include "driver/periph_ctrl.h" +#include "sdkconfig.h" + static mcpwm_dev_t *MCPWM[2] = {&MCPWM0, &MCPWM1}; static const char *MCPWM_TAG = "MCPWM"; @@ -41,7 +43,7 @@ static portMUX_TYPE mcpwm_spinlock = portMUX_INITIALIZER_UNLOCKED; #define MCPWM_DB_ERROR "MCPWM DEADTIME TYPE ERROR" #define MCPWM_BASE_CLK (2 * APB_CLK_FREQ) //2*APB_CLK_FREQ 160Mhz -#define MCPWM_CLK_PRESCL 15 //MCPWM clock prescale +#define MCPWM_CLK_PRESCL 15 //MCPWM clock prescale #define TIMER_CLK_PRESCALE 9 //MCPWM timer prescales #define MCPWM_CLK (MCPWM_BASE_CLK/(MCPWM_CLK_PRESCL +1)) #define MCPWM_PIN_IGNORE (-1) diff --git a/components/driver/pcnt.c b/components/driver/pcnt.c index 32ceb23483..e9500f6430 100644 --- a/components/driver/pcnt.c +++ b/components/driver/pcnt.c @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// 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. @@ -53,7 +53,7 @@ esp_err_t pcnt_unit_config(const pcnt_config_t *pcnt_config) PCNT_CHECK(unit < PCNT_UNIT_MAX, PCNT_UNIT_ERR_STR, ESP_ERR_INVALID_ARG); PCNT_CHECK(channel < PCNT_CHANNEL_MAX, PCNT_CHANNEL_ERR_STR, ESP_ERR_INVALID_ARG); - PCNT_CHECK(input_io < 0 || (GPIO_IS_VALID_GPIO(input_io) && (input_io != ctrl_io)), "PCNT pluse input io error", ESP_ERR_INVALID_ARG); + PCNT_CHECK(input_io < 0 || (GPIO_IS_VALID_GPIO(input_io) && (input_io != ctrl_io)), "PCNT pulse input io error", ESP_ERR_INVALID_ARG); PCNT_CHECK(ctrl_io < 0 || GPIO_IS_VALID_GPIO(ctrl_io), "PCNT ctrl io error", ESP_ERR_INVALID_ARG); PCNT_CHECK((pcnt_config->pos_mode < PCNT_COUNT_MAX) && (pcnt_config->neg_mode < PCNT_COUNT_MAX), PCNT_COUNT_MODE_ERR_STR, ESP_ERR_INVALID_ARG); PCNT_CHECK((pcnt_config->hctrl_mode < PCNT_MODE_MAX) && (pcnt_config->lctrl_mode < PCNT_MODE_MAX), PCNT_CTRL_MODE_ERR_STR, ESP_ERR_INVALID_ARG); @@ -106,11 +106,11 @@ esp_err_t pcnt_set_pin(pcnt_unit_t unit, pcnt_channel_t channel, int pulse_io, i PCNT_CHECK(channel < PCNT_CHANNEL_MAX, PCNT_CHANNEL_ERR_STR, ESP_ERR_INVALID_ARG); PCNT_CHECK(GPIO_IS_VALID_GPIO(pulse_io) || pulse_io < 0, PCNT_GPIO_ERR_STR, ESP_ERR_INVALID_ARG); PCNT_CHECK(GPIO_IS_VALID_GPIO(ctrl_io) || ctrl_io < 0, PCNT_GPIO_ERR_STR, ESP_ERR_INVALID_ARG); - + int sig_base = (channel == 0) ? PCNT_SIG_CH0_IN0_IDX : PCNT_SIG_CH1_IN0_IDX; int ctrl_base = (channel == 0) ? PCNT_CTRL_CH0_IN0_IDX : PCNT_CTRL_CH1_IN0_IDX; - if (unit > 4) { - sig_base += 12; // GPIO matrix assignments have a gap between units 4 & 5 + if (unit > 4) { + sig_base += 12; // GPIO matrix assignments have a gap between units 4 & 5 ctrl_base += 12; } int input_sig_index = sig_base + (4 * unit); @@ -161,7 +161,11 @@ esp_err_t pcnt_counter_clear(pcnt_unit_t pcnt_unit) { PCNT_CHECK(pcnt_unit < PCNT_UNIT_MAX, PCNT_UNIT_ERR_STR, ESP_ERR_INVALID_ARG); PCNT_ENTER_CRITICAL(&pcnt_spinlock); +#ifdef CONFIG_IDF_TARGET_ESP32 uint32_t reset_bit = BIT(PCNT_PLUS_CNT_RST_U0_S + (pcnt_unit * 2)); +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + uint32_t reset_bit = BIT(PCNT_PULSE_CNT_RST_U0_S + (pcnt_unit * 2)); +#endif PCNT.ctrl.val |= reset_bit; PCNT.ctrl.val &= ~reset_bit; PCNT_EXIT_CRITICAL(&pcnt_spinlock); diff --git a/components/driver/periph_ctrl.c b/components/driver/periph_ctrl.c index 65ece09e18..d448a914bf 100644 --- a/components/driver/periph_ctrl.c +++ b/components/driver/periph_ctrl.c @@ -16,7 +16,9 @@ #include "freertos/semphr.h" #include "freertos/xtensa_api.h" #include "soc/dport_reg.h" +#include "soc/syscon_reg.h" #include "driver/periph_ctrl.h" +#include "sdkconfig.h" static portMUX_TYPE periph_spinlock = portMUX_INITIALIZER_UNLOCKED; @@ -61,8 +63,13 @@ static uint32_t get_clk_en_mask(periph_module_t periph) return DPORT_UART_CLK_EN; case PERIPH_UART1_MODULE: return DPORT_UART1_CLK_EN; +#if CONFIG_IDF_TARGET_ESP32 case PERIPH_UART2_MODULE: return DPORT_UART2_CLK_EN; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + case PERIPH_USB_MODULE: + return DPORT_USB_CLK_EN; +#endif case PERIPH_I2C0_MODULE: return DPORT_I2C_EXT0_CLK_EN; case PERIPH_I2C1_MODULE: @@ -91,12 +98,27 @@ static uint32_t get_clk_en_mask(periph_module_t periph) return DPORT_PCNT_CLK_EN; case PERIPH_SPI_MODULE: return DPORT_SPI01_CLK_EN; +#if CONFIG_IDF_TARGET_ESP32 case PERIPH_HSPI_MODULE: return DPORT_SPI2_CLK_EN; case PERIPH_VSPI_MODULE: return DPORT_SPI3_CLK_EN; case PERIPH_SPI_DMA_MODULE: return DPORT_SPI_DMA_CLK_EN; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + case PERIPH_FSPI_MODULE: + return DPORT_SPI2_CLK_EN; + case PERIPH_HSPI_MODULE: + return DPORT_SPI3_CLK_EN; + case PERIPH_VSPI_MODULE: + return DPORT_SPI4_CLK_EN; + case PERIPH_SPI2_DMA_MODULE: + return DPORT_SPI2_DMA_CLK_EN; + case PERIPH_SPI3_DMA_MODULE: + return DPORT_SPI3_DMA_CLK_EN; + case PERIPH_SPI_SHARED_DMA_MODULE: + return DPORT_SPI_SHARED_DMA_CLK_EN; +#endif case PERIPH_SDMMC_MODULE: return DPORT_WIFI_CLK_SDIO_HOST_EN; case PERIPH_SDIO_SLAVE_MODULE: @@ -108,7 +130,11 @@ static uint32_t get_clk_en_mask(periph_module_t periph) case PERIPH_RNG_MODULE: return DPORT_WIFI_CLK_RNG_EN; case PERIPH_WIFI_MODULE: +#if CONFIG_IDF_TARGET_ESP32 return DPORT_WIFI_CLK_WIFI_EN_M; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + return 0; +#endif case PERIPH_BT_MODULE: return DPORT_WIFI_CLK_BT_EN_M; case PERIPH_WIFI_BT_COMMON_MODULE: @@ -117,12 +143,14 @@ static uint32_t get_clk_en_mask(periph_module_t periph) return DPORT_BT_BASEBAND_EN; case PERIPH_BT_LC_MODULE: return DPORT_BT_LC_EN; +#if CONFIG_IDF_TARGET_ESP32 case PERIPH_AES_MODULE: return DPORT_PERI_EN_AES; case PERIPH_SHA_MODULE: return DPORT_PERI_EN_SHA; case PERIPH_RSA_MODULE: return DPORT_PERI_EN_RSA; +#endif default: return 0; } @@ -139,8 +167,13 @@ static uint32_t get_rst_en_mask(periph_module_t periph, bool enable) return DPORT_UART_RST; case PERIPH_UART1_MODULE: return DPORT_UART1_RST; +#if CONFIG_IDF_TARGET_ESP32 case PERIPH_UART2_MODULE: return DPORT_UART2_RST; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + case PERIPH_USB_MODULE: + return DPORT_USB_RST; +#endif case PERIPH_I2C0_MODULE: return DPORT_I2C_EXT0_RST; case PERIPH_I2C1_MODULE: @@ -169,12 +202,27 @@ static uint32_t get_rst_en_mask(periph_module_t periph, bool enable) return DPORT_PCNT_RST; case PERIPH_SPI_MODULE: return DPORT_SPI01_RST; +#if CONFIG_IDF_TARGET_ESP32 case PERIPH_HSPI_MODULE: return DPORT_SPI2_RST; case PERIPH_VSPI_MODULE: return DPORT_SPI3_RST; case PERIPH_SPI_DMA_MODULE: return DPORT_SPI_DMA_RST; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + case PERIPH_FSPI_MODULE: + return DPORT_SPI2_RST; + case PERIPH_HSPI_MODULE: + return DPORT_SPI3_RST; + case PERIPH_VSPI_MODULE: + return DPORT_SPI4_RST; + case PERIPH_SPI2_DMA_MODULE: + return DPORT_SPI2_DMA_RST; + case PERIPH_SPI3_DMA_MODULE: + return DPORT_SPI3_DMA_RST; + case PERIPH_SPI_SHARED_DMA_MODULE: + return DPORT_SPI_SHARED_DMA_RST; +#endif case PERIPH_SDMMC_MODULE: return DPORT_SDIO_HOST_RST; case PERIPH_SDIO_SLAVE_MODULE: @@ -183,6 +231,7 @@ static uint32_t get_rst_en_mask(periph_module_t periph, bool enable) return DPORT_CAN_RST; case PERIPH_EMAC_MODULE: return DPORT_EMAC_RST; +#if CONFIG_IDF_TARGET_ESP32 case PERIPH_AES_MODULE: if (enable == true) { // Clear reset on digital signature & secure boot units, otherwise AES unit is held in reset also. @@ -207,6 +256,7 @@ static uint32_t get_rst_en_mask(periph_module_t periph, bool enable) // Don't reset digital signature unit, as this resets AES also return DPORT_PERI_EN_RSA; } +#endif case PERIPH_WIFI_MODULE: case PERIPH_BT_MODULE: case PERIPH_WIFI_BT_COMMON_MODULE: @@ -240,18 +290,32 @@ static bool is_wifi_clk_peripheral(periph_module_t periph) static uint32_t get_clk_en_reg(periph_module_t periph) { +#if CONFIG_IDF_TARGET_ESP32 if (periph == PERIPH_AES_MODULE || periph == PERIPH_SHA_MODULE || periph == PERIPH_RSA_MODULE) { return DPORT_PERI_CLK_EN_REG; - } else { + } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if(periph == PERIPH_SPI_SHARED_DMA_MODULE) { + return DPORT_PERIP_CLK_EN1_REG; + } +#endif + else { return is_wifi_clk_peripheral(periph) ? DPORT_WIFI_CLK_EN_REG : DPORT_PERIP_CLK_EN_REG; } } static uint32_t get_rst_en_reg(periph_module_t periph) { +#if CONFIG_IDF_TARGET_ESP32 if (periph == PERIPH_AES_MODULE || periph == PERIPH_SHA_MODULE || periph == PERIPH_RSA_MODULE) { return DPORT_PERI_RST_EN_REG; - } else { + } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if(periph == PERIPH_SPI_SHARED_DMA_MODULE){ + return DPORT_PERIP_CLK_EN1_REG; + } +#endif + else { return is_wifi_clk_peripheral(periph) ? DPORT_CORE_RST_EN_REG : DPORT_PERIP_RST_EN_REG; } } diff --git a/components/driver/rmt.c b/components/driver/rmt.c index 966600a956..dd295a8354 100644 --- a/components/driver/rmt.c +++ b/components/driver/rmt.c @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// 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. @@ -193,8 +193,12 @@ esp_err_t rmt_tx_stop(rmt_channel_t channel) { RMT_CHECK(channel < RMT_CHANNEL_MAX, RMT_CHANNEL_ERROR_STR, ESP_ERR_INVALID_ARG); portENTER_CRITICAL(&rmt_spinlock); +#ifdef CONFIG_IDF_TARGET_ESP32 RMTMEM.chan[channel].data32[0].val = 0; RMT.conf_ch[channel].conf1.tx_start = 0; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + RMT.conf_ch[channel].conf1.tx_stop = 1; +#endif RMT.conf_ch[channel].conf1.mem_rd_rst = 1; RMT.conf_ch[channel].conf1.mem_rd_rst = 0; portEXIT_CRITICAL(&rmt_spinlock); @@ -317,7 +321,11 @@ esp_err_t rmt_get_idle_level(rmt_channel_t channel, bool* idle_out_en, rmt_idle_ esp_err_t rmt_get_status(rmt_channel_t channel, uint32_t* status) { RMT_CHECK(channel < RMT_CHANNEL_MAX, RMT_CHANNEL_ERROR_STR, ESP_ERR_INVALID_ARG); +#ifdef CONFIG_IDF_TARGET_ESP32 *status = RMT.status_ch[channel]; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + *status = RMT.status_ch[channel].val; +#endif return ESP_OK; } @@ -382,9 +390,15 @@ esp_err_t rmt_set_tx_thr_intr_en(rmt_channel_t channel, bool en, uint16_t evt_th RMT.tx_lim_ch[channel].limit = evt_thresh; portEXIT_CRITICAL(&rmt_spinlock); rmt_set_tx_wrap_en(true); +#ifdef CONFIG_IDF_TARGET_ESP32 rmt_set_intr_enable_mask(BIT(channel + 24)); } else { rmt_clr_intr_enable_mask(BIT(channel + 24)); +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + rmt_set_intr_enable_mask(BIT(channel + 12)); + } else { + rmt_clr_intr_enable_mask(BIT(channel + 12)); +#endif } return ESP_OK; } @@ -396,7 +410,7 @@ esp_err_t rmt_set_pin(rmt_channel_t channel, rmt_mode_t mode, gpio_num_t gpio_nu RMT_CHECK(((GPIO_IS_VALID_GPIO(gpio_num) && (mode == RMT_MODE_RX)) || (GPIO_IS_VALID_OUTPUT_GPIO(gpio_num) && (mode == RMT_MODE_TX))), RMT_GPIO_ERROR_STR, ESP_ERR_INVALID_ARG); - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], 2); + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio_num], PIN_FUNC_GPIO); if(mode == RMT_MODE_TX) { gpio_set_direction(gpio_num, GPIO_MODE_OUTPUT); gpio_matrix_out(gpio_num, RMT_SIG_OUT0_IDX + channel, 0, 0); @@ -566,7 +580,12 @@ static void IRAM_ATTR rmt_driver_isr_default(void* arg) while (status) { int i = __builtin_ffs(status) - 1; status &= ~(1 << i); +#ifdef CONFIG_IDF_TARGET_ESP32 if(i < 24) { +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + if(i >= 15) { + } else if(i < 12) { +#endif channel = i / 3; rmt_obj_t* p_rmt = p_rmt_obj[channel]; if(NULL == p_rmt) { @@ -617,8 +636,13 @@ static void IRAM_ATTR rmt_driver_isr_default(void* arg) default: break; } +#ifdef CONFIG_IDF_TARGET_ESP32 } else { channel = i - 24; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + } else if(i >= 12 && i < 16) { + channel = i - 12; +#endif rmt_obj_t* p_rmt = p_rmt_obj[channel]; if(p_rmt->tx_data == NULL) { diff --git a/components/driver/rtc_module.c b/components/driver/rtc_module.c index 2162b015b6..3c76e7304b 100644 --- a/components/driver/rtc_module.c +++ b/components/driver/rtc_module.c @@ -15,12 +15,12 @@ #include #include #include -#include "esp32/rom/ets_sys.h" #include "esp_log.h" #include "soc/rtc_periph.h" #include "soc/sens_periph.h" #include "soc/syscon_periph.h" #include "soc/rtc.h" +#include "soc/periph_defs.h" #include "rtc_io.h" #include "touch_pad.h" #include "adc.h" @@ -34,6 +34,12 @@ #include "driver/rtc_cntl.h" #include "driver/gpio.h" #include "adc1_i2s_private.h" +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#endif #ifndef NDEBUG // Enable built-in checks in queue.h in debug builds @@ -80,17 +86,19 @@ static const char *RTC_MODULE_TAG = "RTC_MODULE"; } }while (0) portMUX_TYPE rtc_spinlock = portMUX_INITIALIZER_UNLOCKED; +#if CONFIG_IDF_TARGET_ESP32 static SemaphoreHandle_t rtc_touch_mux = NULL; +#endif /* In ADC2, there're two locks used for different cases: -1. lock shared with app and WIFI: - when wifi using the ADC2, we assume it will never stop, +1. lock shared with app and WIFI: + when wifi using the ADC2, we assume it will never stop, so app checks the lock and returns immediately if failed. -2. lock shared between tasks: - when several tasks sharing the ADC2, we want to guarantee +2. lock shared between tasks: + when several tasks sharing the ADC2, we want to guarantee all the requests will be handled. - Since conversions are short (about 31us), app returns the lock very soon, + Since conversions are short (about 31us), app returns the lock very soon, we use a spinlock to stand there waiting to do conversions one by one. adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock. @@ -103,6 +111,7 @@ portMUX_TYPE adc2_spinlock = portMUX_INITIALIZER_UNLOCKED; //prevent ADC1 being used by I2S dma and other tasks at the same time. static _lock_t adc1_i2s_lock; +#if CONFIG_IDF_TARGET_ESP32 typedef struct { TimerHandle_t timer; uint16_t filtered_val[TOUCH_PAD_MAX]; @@ -115,6 +124,7 @@ static touch_pad_filter_t *s_touch_pad_filter = NULL; // check if touch pad be inited. static uint16_t s_touch_pad_init_bit = 0x0000; static filter_cb_t s_filter_cb = NULL; +#endif typedef enum { ADC_CTRL_RTC = 0, @@ -136,10 +146,15 @@ esp_err_t rtc_gpio_init(gpio_num_t gpio_num) { RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 // 0: GPIO connected to digital GPIO module. 1: GPIO connected to analog RTC module. SET_PERI_REG_MASK(rtc_gpio_desc[gpio_num].reg, (rtc_gpio_desc[gpio_num].mux)); //0:RTC FUNCIOTN 1,2,3:Reserved SET_PERI_REG_BITS(rtc_gpio_desc[gpio_num].reg, RTC_IO_TOUCH_PAD1_FUN_SEL_V, 0x0, rtc_gpio_desc[gpio_num].func); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + rtc_gpio_reg[gpio_num]->mux_sel = 0x1; + rtc_gpio_reg[gpio_num]->fun_sel = 0x0; +#endif portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; @@ -150,7 +165,11 @@ esp_err_t rtc_gpio_deinit(gpio_num_t gpio_num) RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); portENTER_CRITICAL(&rtc_spinlock); //Select Gpio as Digital Gpio +#if CONFIG_IDF_TARGET_ESP32 CLEAR_PERI_REG_MASK(rtc_gpio_desc[gpio_num].reg, (rtc_gpio_desc[gpio_num].mux)); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + rtc_gpio_reg[gpio_num]->mux_sel = 0x0; +#endif portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; @@ -158,21 +177,27 @@ esp_err_t rtc_gpio_deinit(gpio_num_t gpio_num) static esp_err_t rtc_gpio_output_enable(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 int rtc_gpio_num = rtc_gpio_desc[gpio_num].rtc_num; RTC_MODULE_CHECK(rtc_gpio_num != -1, "RTC_GPIO number error", ESP_ERR_INVALID_ARG); SET_PERI_REG_MASK(RTC_GPIO_ENABLE_W1TS_REG, (1 << (rtc_gpio_num + RTC_GPIO_ENABLE_W1TS_S))); - CLEAR_PERI_REG_MASK(RTC_GPIO_ENABLE_W1TC_REG, (1 << (rtc_gpio_num + RTC_GPIO_ENABLE_W1TC_S))); - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + SET_PERI_REG_MASK(RTC_GPIO_ENABLE_W1TS_REG, (1 << ( gpio_num + RTC_GPIO_ENABLE_W1TS_S))); +#endif return ESP_OK; } static esp_err_t rtc_gpio_output_disable(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 int rtc_gpio_num = rtc_gpio_desc[gpio_num].rtc_num; RTC_MODULE_CHECK(rtc_gpio_num != -1, "RTC_GPIO number error", ESP_ERR_INVALID_ARG); - CLEAR_PERI_REG_MASK(RTC_GPIO_ENABLE_W1TS_REG, (1 << (rtc_gpio_num + RTC_GPIO_ENABLE_W1TS_S))); SET_PERI_REG_MASK(RTC_GPIO_ENABLE_W1TC_REG, (1 << ( rtc_gpio_num + RTC_GPIO_ENABLE_W1TC_S))); - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + SET_PERI_REG_MASK(RTC_GPIO_ENABLE_W1TC_REG, (1 << ( gpio_num + RTC_GPIO_ENABLE_W1TC_S))); +#endif return ESP_OK; } @@ -180,7 +205,11 @@ static esp_err_t rtc_gpio_input_enable(gpio_num_t gpio_num) { RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 SET_PERI_REG_MASK(rtc_gpio_desc[gpio_num].reg, rtc_gpio_desc[gpio_num].ie); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + rtc_gpio_reg[gpio_num]->fun_ie = 1; +#endif portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; @@ -190,14 +219,44 @@ static esp_err_t rtc_gpio_input_disable(gpio_num_t gpio_num) { RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 CLEAR_PERI_REG_MASK(rtc_gpio_desc[gpio_num].reg, rtc_gpio_desc[gpio_num].ie); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + rtc_gpio_reg[gpio_num]->fun_ie = 0; +#endif portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; } +#if CONFIG_IDF_TARGET_ESP32S2BETA +esp_err_t rtc_gpio_sleep_output_enable(gpio_num_t gpio_num, bool output) +{ + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + rtc_gpio_reg[gpio_num]->slp_sel = 1; + rtc_gpio_reg[gpio_num]->slp_oe = output; + return ESP_OK; +} + +esp_err_t rtc_gpio_sleep_input_enable(gpio_num_t gpio_num, bool input) +{ + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + rtc_gpio_reg[gpio_num]->slp_sel = 1; + rtc_gpio_reg[gpio_num]->slp_ie = input; + return ESP_OK; +} + +esp_err_t rtc_gpio_sleep_mode_disable(gpio_num_t gpio_num) +{ + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + rtc_gpio_reg[gpio_num]->slp_sel = 0; + return ESP_OK; +} +#endif + esp_err_t rtc_gpio_set_level(gpio_num_t gpio_num, uint32_t level) { +#if CONFIG_IDF_TARGET_ESP32 int rtc_gpio_num = rtc_gpio_num = rtc_gpio_desc[gpio_num].rtc_num;; RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); @@ -206,13 +265,21 @@ esp_err_t rtc_gpio_set_level(gpio_num_t gpio_num, uint32_t level) } else { WRITE_PERI_REG(RTC_GPIO_OUT_W1TC_REG, (1 << (rtc_gpio_num + RTC_GPIO_OUT_DATA_W1TC_S))); } - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + if (level) { + WRITE_PERI_REG(RTC_GPIO_OUT_W1TS_REG, (1 << (gpio_num + RTC_GPIO_OUT_DATA_W1TS_S))); + } else { + WRITE_PERI_REG(RTC_GPIO_OUT_W1TC_REG, (1 << (gpio_num + RTC_GPIO_OUT_DATA_W1TC_S))); + } +#endif return ESP_OK; } uint32_t rtc_gpio_get_level(gpio_num_t gpio_num) { uint32_t level = 0; +#if CONFIG_IDF_TARGET_ESP32 int rtc_gpio_num = rtc_gpio_desc[gpio_num].rtc_num; RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); @@ -220,6 +287,13 @@ uint32_t rtc_gpio_get_level(gpio_num_t gpio_num) level = READ_PERI_REG(RTC_GPIO_IN_REG); portEXIT_CRITICAL(&rtc_spinlock); return ((level >> (RTC_GPIO_IN_NEXT_S + rtc_gpio_num)) & 0x01); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + portENTER_CRITICAL(&rtc_spinlock); + level = RTCIO.in_val.in; + portEXIT_CRITICAL(&rtc_spinlock); + return ((level >> gpio_num) & 0x1); +#endif } esp_err_t rtc_gpio_set_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t strength) @@ -229,7 +303,11 @@ esp_err_t rtc_gpio_set_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t st RTC_MODULE_CHECK(strength < GPIO_DRIVE_CAP_MAX, "GPIO drive capability error", ESP_ERR_INVALID_ARG); portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 SET_PERI_REG_BITS(rtc_gpio_desc[gpio_num].reg, rtc_gpio_desc[gpio_num].drv_v, strength, rtc_gpio_desc[gpio_num].drv_s); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + rtc_gpio_reg[gpio_num]->drv = strength; +#endif portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; } @@ -239,8 +317,11 @@ esp_err_t rtc_gpio_get_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t* s RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); RTC_MODULE_CHECK(GPIO_IS_VALID_OUTPUT_GPIO(gpio_num), "Output pad only", ESP_ERR_INVALID_ARG); RTC_MODULE_CHECK(strength != NULL, "GPIO drive pointer error", ESP_ERR_INVALID_ARG); - +#if CONFIG_IDF_TARGET_ESP32 *strength = GET_PERI_REG_BITS2(rtc_gpio_desc[gpio_num].reg, rtc_gpio_desc[gpio_num].drv_v, rtc_gpio_desc[gpio_num].drv_s); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + *strength = rtc_gpio_reg[gpio_num]->drv; +#endif return ESP_OK; } @@ -272,21 +353,45 @@ esp_err_t rtc_gpio_set_direction(gpio_num_t gpio_num, rtc_gpio_mode_t mode) esp_err_t rtc_gpio_pullup_en(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 //this is a digital pad if (rtc_gpio_desc[gpio_num].pullup == 0) { return ESP_ERR_INVALID_ARG; } - +#endif //this is a rtc pad portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 SET_PERI_REG_MASK(rtc_gpio_desc[gpio_num].reg, rtc_gpio_desc[gpio_num].pullup); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + rtc_gpio_reg[gpio_num]->rue = 0x1; +#endif portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; } +#if CONFIG_IDF_TARGET_ESP32S2BETA +esp_err_t rtc_gpio_set_output_mode(gpio_num_t gpio_num, rtc_io_out_mode_t mode) +{ + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + portENTER_CRITICAL(&rtc_spinlock); + RTCIO.pin[gpio_num].pad_driver = mode; + portEXIT_CRITICAL(&rtc_spinlock); + return ESP_OK; +} + +esp_err_t rtc_gpio_get_output_mode(gpio_num_t gpio_num, rtc_io_out_mode_t *mode) +{ + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + *mode = RTCIO.pin[gpio_num].pad_driver; + return ESP_OK; +} +#endif + esp_err_t rtc_gpio_pulldown_en(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 //this is a digital pad if (rtc_gpio_desc[gpio_num].pulldown == 0) { return ESP_ERR_INVALID_ARG; @@ -296,12 +401,17 @@ esp_err_t rtc_gpio_pulldown_en(gpio_num_t gpio_num) portENTER_CRITICAL(&rtc_spinlock); SET_PERI_REG_MASK(rtc_gpio_desc[gpio_num].reg, rtc_gpio_desc[gpio_num].pulldown); portEXIT_CRITICAL(&rtc_spinlock); - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + portENTER_CRITICAL(&rtc_spinlock); + rtc_gpio_reg[gpio_num]->rde = 0x1; + portEXIT_CRITICAL(&rtc_spinlock); +#endif return ESP_OK; } esp_err_t rtc_gpio_pullup_dis(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 //this is a digital pad if ( rtc_gpio_desc[gpio_num].pullup == 0 ) { return ESP_ERR_INVALID_ARG; @@ -311,12 +421,17 @@ esp_err_t rtc_gpio_pullup_dis(gpio_num_t gpio_num) portENTER_CRITICAL(&rtc_spinlock); CLEAR_PERI_REG_MASK(rtc_gpio_desc[gpio_num].reg, rtc_gpio_desc[gpio_num].pullup); portEXIT_CRITICAL(&rtc_spinlock); - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + portENTER_CRITICAL(&rtc_spinlock); + rtc_gpio_reg[gpio_num]->rue = 0x0; + portEXIT_CRITICAL(&rtc_spinlock); +#endif return ESP_OK; } esp_err_t rtc_gpio_pulldown_dis(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 //this is a digital pad if (rtc_gpio_desc[gpio_num].pulldown == 0) { return ESP_ERR_INVALID_ARG; @@ -326,12 +441,17 @@ esp_err_t rtc_gpio_pulldown_dis(gpio_num_t gpio_num) portENTER_CRITICAL(&rtc_spinlock); CLEAR_PERI_REG_MASK(rtc_gpio_desc[gpio_num].reg, rtc_gpio_desc[gpio_num].pulldown); portEXIT_CRITICAL(&rtc_spinlock); - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + portENTER_CRITICAL(&rtc_spinlock); + rtc_gpio_reg[gpio_num]->rde = 0x0; + portEXIT_CRITICAL(&rtc_spinlock); +#endif return ESP_OK; } esp_err_t rtc_gpio_hold_en(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 // check if an RTC IO if (rtc_gpio_desc[gpio_num].pullup == 0) { return ESP_ERR_INVALID_ARG; @@ -339,11 +459,18 @@ esp_err_t rtc_gpio_hold_en(gpio_num_t gpio_num) portENTER_CRITICAL(&rtc_spinlock); SET_PERI_REG_MASK(rtc_gpio_desc[gpio_num].reg, rtc_gpio_desc[gpio_num].hold); portEXIT_CRITICAL(&rtc_spinlock); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + portENTER_CRITICAL(&rtc_spinlock); + RTCCNTL.pad_hold.val |= BIT(gpio_num); + portEXIT_CRITICAL(&rtc_spinlock); +#endif return ESP_OK; } esp_err_t rtc_gpio_hold_dis(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 // check if an RTC IO if (rtc_gpio_desc[gpio_num].pullup == 0) { return ESP_ERR_INVALID_ARG; @@ -351,15 +478,24 @@ esp_err_t rtc_gpio_hold_dis(gpio_num_t gpio_num) portENTER_CRITICAL(&rtc_spinlock); CLEAR_PERI_REG_MASK(rtc_gpio_desc[gpio_num].reg, rtc_gpio_desc[gpio_num].hold); portEXIT_CRITICAL(&rtc_spinlock); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + portENTER_CRITICAL(&rtc_spinlock); + RTCCNTL.pad_hold.val &= ~(BIT(gpio_num)); + portEXIT_CRITICAL(&rtc_spinlock); +#endif return ESP_OK; } esp_err_t rtc_gpio_isolate(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 if (rtc_gpio_desc[gpio_num].reg == 0) { return ESP_ERR_INVALID_ARG; } - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); +#endif rtc_gpio_pullup_dis(gpio_num); rtc_gpio_pulldown_dis(gpio_num); rtc_gpio_set_direction(gpio_num, RTC_GPIO_MODE_DISABLED); @@ -370,16 +506,23 @@ esp_err_t rtc_gpio_isolate(gpio_num_t gpio_num) void rtc_gpio_force_hold_dis_all(void) { +#if CONFIG_IDF_TARGET_ESP32 for (int gpio = 0; gpio < GPIO_PIN_COUNT; ++gpio) { const rtc_gpio_desc_t* desc = &rtc_gpio_desc[gpio]; if (desc->hold_force != 0) { REG_CLR_BIT(RTC_CNTL_HOLD_FORCE_REG, desc->hold_force); } } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + portENTER_CRITICAL(&rtc_spinlock); + RTCCNTL.rtc_pwc.rtc_pad_force_hold = 0; + portEXIT_CRITICAL(&rtc_spinlock); +#endif } esp_err_t rtc_gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) { +#if CONFIG_IDF_TARGET_ESP32 int rtc_num = rtc_gpio_desc[gpio_num].rtc_num; if (rtc_num < 0) { return ESP_ERR_INVALID_ARG; @@ -392,11 +535,21 @@ esp_err_t rtc_gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type) /* each pin has its own register, spinlock not needed */ REG_SET_BIT(reg, RTC_GPIO_PIN0_WAKEUP_ENABLE); REG_SET_FIELD(reg, RTC_GPIO_PIN0_INT_TYPE, intr_type); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + if (( intr_type != GPIO_INTR_LOW_LEVEL ) && ( intr_type != GPIO_INTR_HIGH_LEVEL )) { + return ESP_ERR_INVALID_ARG; + } + /* each pin has its own register, spinlock not needed */ + RTCIO.pin[gpio_num].wakeup_enable = 1; + RTCIO.pin[gpio_num].int_type = intr_type; +#endif return ESP_OK; } esp_err_t rtc_gpio_wakeup_disable(gpio_num_t gpio_num) { +#if CONFIG_IDF_TARGET_ESP32 int rtc_num = rtc_gpio_desc[gpio_num].rtc_num; if (rtc_num < 0) { return ESP_ERR_INVALID_ARG; @@ -406,10 +559,25 @@ esp_err_t rtc_gpio_wakeup_disable(gpio_num_t gpio_num) /* each pin has its own register, spinlock not needed */ REG_CLR_BIT(reg, RTC_GPIO_PIN0_WAKEUP_ENABLE); REG_SET_FIELD(reg, RTC_GPIO_PIN0_INT_TYPE, 0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + RTC_MODULE_CHECK(rtc_gpio_is_valid_gpio(gpio_num), "RTC_GPIO number error", ESP_ERR_INVALID_ARG); + /* each pin has its own register, spinlock not needed */ + RTCIO.pin[gpio_num].wakeup_enable = 0; + RTCIO.pin[gpio_num].int_type = 0; +#endif return ESP_OK; } - +#if CONFIG_IDF_TARGET_ESP32S2BETA +esp_err_t rtc_gpio_force_hold_all() +{ + portENTER_CRITICAL(&rtc_spinlock); + RTCCNTL.rtc_pwc.rtc_pad_force_hold = 1; + portEXIT_CRITICAL(&rtc_spinlock); + return ESP_OK; +} +#endif +#if CONFIG_IDF_TARGET_ESP32 /*--------------------------------------------------------------- Touch Pad ---------------------------------------------------------------*/ @@ -429,10 +597,24 @@ inline static touch_pad_t touch_pad_num_wrap(touch_pad_t touch_num) return touch_num; } +esp_err_t touch_pad_isr_handler_register(void (*fn)(void *), void *arg, int no_use, intr_handle_t *handle_no_use) +{ + RTC_MODULE_CHECK(fn, "Touch_Pad ISR null", ESP_ERR_INVALID_ARG); +#if CONFIG_IDF_TARGET_ESP32 + return rtc_isr_register(fn, arg, RTC_CNTL_TOUCH_INT_ST_M); +#else + return ESP_FAIL; +#endif +} + esp_err_t touch_pad_isr_register(intr_handler_t fn, void* arg) { RTC_MODULE_CHECK(fn, "Touch_Pad ISR null", ESP_ERR_INVALID_ARG); +#if CONFIG_IDF_TARGET_ESP32 return rtc_isr_register(fn, arg, RTC_CNTL_TOUCH_INT_ST_M); +#else + return ESP_FAIL; +#endif } esp_err_t touch_pad_isr_deregister(intr_handler_t fn, void *arg) @@ -560,7 +742,7 @@ esp_err_t touch_pad_set_voltage(touch_high_volt_t refh, touch_low_volt_t refl, t ESP_ERR_INVALID_ARG); RTC_MODULE_CHECK(((atten < TOUCH_HVOLT_ATTEN_MAX) && (refh >= (int )TOUCH_HVOLT_ATTEN_KEEP)), "touch atten error", ESP_ERR_INVALID_ARG); - +#if CONFIG_IDF_TARGET_ESP32 portENTER_CRITICAL(&rtc_spinlock); if (refh > TOUCH_HVOLT_KEEP) { RTCIO.touch_cfg.drefh = refh; @@ -572,11 +754,13 @@ esp_err_t touch_pad_set_voltage(touch_high_volt_t refh, touch_low_volt_t refl, t RTCIO.touch_cfg.drange = atten; } portEXIT_CRITICAL(&rtc_spinlock); +#endif return ESP_OK; } esp_err_t touch_pad_get_voltage(touch_high_volt_t *refh, touch_low_volt_t *refl, touch_volt_atten_t *atten) { +#if CONFIG_IDF_TARGET_ESP32 portENTER_CRITICAL(&rtc_spinlock); if (refh) { *refh = RTCIO.touch_cfg.drefh; @@ -588,6 +772,7 @@ esp_err_t touch_pad_get_voltage(touch_high_volt_t *refh, touch_low_volt_t *refl, *atten = RTCIO.touch_cfg.drange; } portEXIT_CRITICAL(&rtc_spinlock); +#endif return ESP_OK; } @@ -595,7 +780,7 @@ esp_err_t touch_pad_set_cnt_mode(touch_pad_t touch_num, touch_cnt_slope_t slope, { RTC_MODULE_CHECK((slope < TOUCH_PAD_SLOPE_MAX), "touch slope error", ESP_ERR_INVALID_ARG); RTC_MODULE_CHECK((opt < TOUCH_PAD_TIE_OPT_MAX), "touch opt error", ESP_ERR_INVALID_ARG); - + touch_pad_t touch_pad_wrap = touch_pad_num_wrap(touch_num); portENTER_CRITICAL(&rtc_spinlock); RTCIO.touch_pad[touch_pad_wrap].tie_opt = opt; @@ -607,7 +792,7 @@ esp_err_t touch_pad_set_cnt_mode(touch_pad_t touch_num, touch_cnt_slope_t slope, esp_err_t touch_pad_get_cnt_mode(touch_pad_t touch_num, touch_cnt_slope_t *slope, touch_tie_opt_t *opt) { RTC_MODULE_CHECK((touch_num < TOUCH_PAD_MAX), "touch IO error", ESP_ERR_INVALID_ARG); - + touch_pad_t touch_pad_wrap = touch_pad_num_wrap(touch_num); portENTER_CRITICAL(&rtc_spinlock); if(opt) { @@ -774,9 +959,7 @@ uint32_t IRAM_ATTR touch_pad_get_status(void) esp_err_t IRAM_ATTR touch_pad_clear_status(void) { - portENTER_CRITICAL(&rtc_spinlock); SENS.sar_touch_ctrl2.touch_meas_en_clr = 1; - portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; } @@ -1043,13 +1226,28 @@ esp_err_t touch_pad_get_wakeup_status(touch_pad_t *pad_num) *pad_num = touch_pad_num_wrap((touch_pad_t)(__builtin_ffs(touch_mask) - 1)); return ESP_OK; } - +#endif /*--------------------------------------------------------------- ADC Common ---------------------------------------------------------------*/ +#if CONFIG_IDF_TARGET_ESP32S2BETA +#define SENS_FORCE_XPD_AMP_FSM 0 // Use FSM to control power down +#define SENS_FORCE_XPD_AMP_PD 2 // Force power down +#define SENS_FORCE_XPD_AMP_PU 3 // Force power up + +#define SENS_SAR1_ATTEN_VAL_MASK 0x3 +#define SENS_SAR2_ATTEN_VAL_MASK 0x3 + +#define SENS_FORCE_XPD_SAR_SW_M (BIT(1)) +#define SENS_FORCE_XPD_SAR_FSM 0 // Use FSM to control power down +#define SENS_FORCE_XPD_SAR_PD 2 // Force power down +#define SENS_FORCE_XPD_SAR_PU 3 // Force power up +#endif + static esp_err_t adc_set_fsm_time(int rst_wait, int start_wait, int standby_wait, int sample_cycle) { portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 // Internal FSM reset wait time if (rst_wait >= 0) { SYSCON.saradc_fsm.rstb_wait = rst_wait; @@ -1062,6 +1260,20 @@ static esp_err_t adc_set_fsm_time(int rst_wait, int start_wait, int standby_wait if (standby_wait >= 0) { SYSCON.saradc_fsm.standby_wait = standby_wait; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + // Internal FSM reset wait time + if (rst_wait >= 0) { + SYSCON.saradc_fsm_wait.rstb_wait = rst_wait; + } + // Internal FSM start wait time + if (start_wait >= 0) { + SYSCON.saradc_fsm_wait.xpd_wait = start_wait; + } + // Internal FSM standby wait time + if (standby_wait >= 0) { + SYSCON.saradc_fsm_wait.standby_wait = standby_wait; + } +#endif // Internal FSM standby sample cycle if (sample_cycle >= 0) { SYSCON.saradc_fsm.sample_cycle = sample_cycle; @@ -1140,24 +1352,43 @@ static esp_err_t adc_set_atten(adc_unit_t adc_unit, adc_channel_t channel, adc_a void adc_power_always_on(void) { portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 SENS.sar_meas_wait2.force_xpd_sar = SENS_FORCE_XPD_SAR_PU; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SENS.sar_power_xpd_sar.force_xpd_sar = SENS_FORCE_XPD_SAR_PU; +#endif portEXIT_CRITICAL(&rtc_spinlock); } void adc_power_on(void) { portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 //The power FSM controlled mode saves more power, while the ADC noise may get increased. #ifndef CONFIG_ADC_FORCE_XPD_FSM //Set the power always on to increase precision. SENS.sar_meas_wait2.force_xpd_sar = SENS_FORCE_XPD_SAR_PU; -#else +#else //Use the FSM to turn off the power while not used to save power. if (SENS.sar_meas_wait2.force_xpd_sar & SENS_FORCE_XPD_SAR_SW_M) { SENS.sar_meas_wait2.force_xpd_sar = SENS_FORCE_XPD_SAR_PU; } else { SENS.sar_meas_wait2.force_xpd_sar = SENS_FORCE_XPD_SAR_FSM; } +#endif +#elif CONFIG_IDF_TARGET_ESP32S2BETA + //The power FSM controlled mode saves more power, while the ADC noise may get increased. +#ifndef CONFIG_ADC_FORCE_XPD_FSM + //Set the power always on to increase precision. + SENS.sar_power_xpd_sar.force_xpd_sar = SENS_FORCE_XPD_SAR_PU; +#else + //Use the FSM to turn off the power while not used to save power. + if (SENS.sar_power_xpd_sar.force_xpd_sar & SENS_FORCE_XPD_SAR_SW_M) { + SENS.sar_power_xpd_sar.force_xpd_sar = SENS_FORCE_XPD_SAR_PU; + } else { + SENS.sar_power_xpd_sar.force_xpd_sar = SENS_FORCE_XPD_SAR_FSM; + } +#endif #endif portEXIT_CRITICAL(&rtc_spinlock); } @@ -1165,9 +1396,14 @@ void adc_power_on(void) void adc_power_off(void) { portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 //Bit1 0:Fsm 1: SW mode //Bit0 0:SW mode power down 1: SW mode power on SENS.sar_meas_wait2.force_xpd_sar = SENS_FORCE_XPD_SAR_PD; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SENS.sar_power_xpd_sar.force_xpd_sar = SENS_FORCE_XPD_SAR_PD; +#endif + portEXIT_CRITICAL(&rtc_spinlock); } @@ -1208,6 +1444,7 @@ esp_err_t adc_gpio_init(adc_unit_t adc_unit, adc_channel_t channel) esp_err_t adc_set_data_inv(adc_unit_t adc_unit, bool inv_en) { portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 if (adc_unit & ADC_UNIT_1) { // Enable ADC data invert SENS.sar_read_ctrl.sar1_data_inv = inv_en; @@ -1216,6 +1453,16 @@ esp_err_t adc_set_data_inv(adc_unit_t adc_unit, bool inv_en) // Enable ADC data invert SENS.sar_read_ctrl2.sar2_data_inv = inv_en; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if (adc_unit & ADC_UNIT_1) { + // Enable ADC data invert + SENS.sar_reader1_ctrl.sar1_data_inv = inv_en; + } + if (adc_unit & ADC_UNIT_2) { + // Enable ADC data invert + SENS.sar_reader2_ctrl.sar2_data_inv = inv_en; + } +#endif portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; } @@ -1225,6 +1472,7 @@ esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t bits) ADC_CHECK_UNIT(adc_unit); RTC_MODULE_CHECK(bits < ADC_WIDTH_MAX, "ADC bit width error", ESP_ERR_INVALID_ARG); portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 if (adc_unit & ADC_UNIT_1) { SENS.sar_start_force.sar1_bit_width = bits; SENS.sar_read_ctrl.sar1_sample_bit = bits; @@ -1233,6 +1481,16 @@ esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t bits) SENS.sar_start_force.sar2_bit_width = bits; SENS.sar_read_ctrl2.sar2_sample_bit = bits; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if (adc_unit & ADC_UNIT_1) { + SENS.sar_meas1_ctrl1.sar1_bit_width = bits; + SENS.sar_reader1_ctrl.sar1_sample_bit = bits; + } + if (adc_unit & ADC_UNIT_2) { + SENS.sar_meas2_ctrl1.sar2_bit_width = bits; + SENS.sar_reader2_ctrl.sar2_sample_bit = bits; + } +#endif portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; } @@ -1240,6 +1498,7 @@ esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t bits) // this function should be called in the critical section static void adc_set_controller(adc_unit_t unit, adc_controller_t ctrl ) { +#if CONFIG_IDF_TARGET_ESP32 if ( unit == ADC_UNIT_1 ) { switch( ctrl ) { case ADC_CTRL_RTC: @@ -1265,12 +1524,12 @@ static void adc_set_controller(adc_unit_t unit, adc_controller_t ctrl ) break; default: ESP_LOGE(TAG, "adc1 selects invalid controller"); - break; + break; } } else if ( unit == ADC_UNIT_2) { switch( ctrl ) { case ADC_CTRL_RTC: - SENS.sar_meas_start2.meas2_start_force = true; //RTC controller controls the ADC,not ulp coprocessor + SENS.sar_meas_start2.meas2_start_force = true; //RTC controller controls the ADC,not ulp coprocessor SENS.sar_meas_start2.sar2_en_pad_force = true; //RTC controller controls the data port, not ulp coprocessor SENS.sar_read_ctrl2.sar2_dig_force = false; //RTC controller controls the ADC, not digital controller SENS.sar_read_ctrl2.sar2_pwdet_force = false; //RTC controller controls the ADC, not PWDET @@ -1306,12 +1565,69 @@ static void adc_set_controller(adc_unit_t unit, adc_controller_t ctrl ) ESP_LOGE(TAG, "invalid adc unit"); assert(0); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if ( unit == ADC_UNIT_1 ) { + switch( ctrl ) { + case ADC_CTRL_RTC: + SENS.sar_meas1_mux.sar1_dig_force = false; //RTC controller controls the ADC, not digital controller + SENS.sar_meas1_ctrl2.meas1_start_force = true; //RTC controller controls the ADC,not ulp coprocessor + SENS.sar_meas1_ctrl2.sar1_en_pad_force = true; //RTC controller controls the data port, not ulp coprocessor + SENS.sar_hall_ctrl.xpd_hall_force = true; // RTC controller controls the hall sensor power,not ulp coprocessor + SENS.sar_hall_ctrl.hall_phase_force = true; // RTC controller controls the hall sensor phase,not ulp coprocessor + break; + case ADC_CTRL_ULP: + SENS.sar_meas1_mux.sar1_dig_force = false; + SENS.sar_meas1_ctrl2.meas1_start_force = false; + SENS.sar_meas1_ctrl2.sar1_en_pad_force = false; + SENS.sar_hall_ctrl.xpd_hall_force = false; + SENS.sar_hall_ctrl.hall_phase_force = false; + break; + case ADC_CTRL_DIG: + SENS.sar_meas1_mux.sar1_dig_force = true; + SENS.sar_meas1_ctrl2.meas1_start_force = true; + SENS.sar_meas1_ctrl2.sar1_en_pad_force = true; + SENS.sar_hall_ctrl.xpd_hall_force = true; + SENS.sar_hall_ctrl.hall_phase_force = true; + break; + default: + ESP_LOGE(TAG, "adc1 selects invalid controller"); + break; + } + } else if ( unit == ADC_UNIT_2) { + switch( ctrl ) { + case ADC_CTRL_RTC: + SENS.sar_meas2_ctrl2.meas2_start_force = true; //RTC controller controls the ADC,not ulp coprocessor + SENS.sar_meas2_ctrl2.sar2_en_pad_force = true; //RTC controller controls the data port, not ulp coprocessor + break; + case ADC_CTRL_ULP: + SENS.sar_meas2_ctrl2.meas2_start_force = false; + SENS.sar_meas2_ctrl2.sar2_en_pad_force = false; + break; + case ADC_CTRL_DIG: + SENS.sar_meas2_ctrl2.meas2_start_force = true; + SENS.sar_meas2_ctrl2.sar2_en_pad_force = true; + break; + case ADC2_CTRL_PWDET: + //currently only used by Wi-Fi + SENS.sar_meas2_ctrl2.meas2_start_force = true; + SENS.sar_meas2_ctrl2.sar2_en_pad_force = true; + break; + default: + ESP_LOGE(TAG, "adc2 selects invalid controller"); + break; + } + } else { + ESP_LOGE(TAG, "invalid adc unit"); + assert(0); + } +#endif } // this function should be called in the critical section static int adc_convert( adc_unit_t unit, int channel) { - uint16_t adc_value; + uint16_t adc_value = 0; +#if CONFIG_IDF_TARGET_ESP32 if ( unit == ADC_UNIT_1 ) { SENS.sar_meas_start1.sar1_en_pad = (1 << channel); //only one channel is selected. while (SENS.sar_slave_addr1.meas_status != 0); @@ -1320,16 +1636,36 @@ static int adc_convert( adc_unit_t unit, int channel) while (SENS.sar_meas_start1.meas1_done_sar == 0); adc_value = SENS.sar_meas_start1.meas1_data_sar; } else if ( unit == ADC_UNIT_2 ) { - SENS.sar_meas_start2.sar2_en_pad = (1 << channel); //only one channel is selected. - + SENS.sar_meas_start2.sar2_en_pad = (1 << channel); //only one channel is selected. + SENS.sar_meas_start2.meas2_start_sar = 0; //start force 0 SENS.sar_meas_start2.meas2_start_sar = 1; //start force 1 while (SENS.sar_meas_start2.meas2_done_sar == 0) {}; //read done - adc_value = SENS.sar_meas_start2.meas2_data_sar; + adc_value = SENS.sar_meas_start2.meas2_data_sar; } else { ESP_LOGE(TAG, "invalid adc unit"); return ESP_ERR_INVALID_ARG; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if ( unit == ADC_UNIT_1 ) { + SENS.sar_meas1_ctrl2.sar1_en_pad = (1 << channel); //only one channel is selected. + while (SENS.sar_slave_addr1.meas_status != 0); + SENS.sar_meas1_ctrl2.meas1_start_sar = 0; + SENS.sar_meas1_ctrl2.meas1_start_sar = 1; + while (SENS.sar_meas1_ctrl2.meas1_done_sar == 0); + adc_value = SENS.sar_meas1_ctrl2.meas1_data_sar; + } else if ( unit == ADC_UNIT_2 ) { + SENS.sar_meas2_ctrl2.sar2_en_pad = (1 << channel); //only one channel is selected. + + SENS.sar_meas2_ctrl2.meas2_start_sar = 0; //start force 0 + SENS.sar_meas2_ctrl2.meas2_start_sar = 1; //start force 1 + while (SENS.sar_meas2_ctrl2.meas2_done_sar == 0) {}; //read done + adc_value = SENS.sar_meas2_ctrl2.meas2_data_sar; + } else { + ESP_LOGE(TAG, "invalid adc unit"); + return ESP_ERR_INVALID_ARG; + } +#endif return adc_value; } @@ -1470,6 +1806,7 @@ esp_err_t adc1_config_width(adc_bits_width_t width_bit) static inline void adc1_fsm_disable(void) { +#if CONFIG_IDF_TARGET_ESP32 //channel is set in the convert function SENS.sar_meas_wait2.force_xpd_amp = SENS_FORCE_XPD_AMP_PD; //disable FSM, it's only used by the LNA. @@ -1479,6 +1816,17 @@ static inline void adc1_fsm_disable(void) SENS.sar_meas_wait1.sar_amp_wait1 = 1; SENS.sar_meas_wait1.sar_amp_wait2 = 1; SENS.sar_meas_wait2.sar_amp_wait3 = 1; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + //channel is set in the convert function + SENS.sar_meas1_ctrl1.force_xpd_amp = SENS_FORCE_XPD_AMP_PD; + //disable FSM, it's only used by the LNA. + SENS.sar_amp_ctrl3.amp_rst_fb_fsm = 0; + SENS.sar_amp_ctrl3.amp_short_ref_fsm = 0; + SENS.sar_amp_ctrl3.amp_short_ref_gnd_fsm = 0; + SENS.sar_amp_ctrl1.sar_amp_wait1 = 1; + SENS.sar_amp_ctrl1.sar_amp_wait2 = 1; + SENS.sar_amp_ctrl2.sar_amp_wait3 = 1; +#endif } esp_err_t adc1_i2s_mode_acquire(void) @@ -1488,9 +1836,15 @@ esp_err_t adc1_i2s_mode_acquire(void) _lock_acquire( &adc1_i2s_lock ); ESP_LOGD( RTC_MODULE_TAG, "i2s mode takes adc1 lock." ); portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 SENS.sar_meas_wait2.force_xpd_sar = SENS_FORCE_XPD_SAR_PU; //switch SARADC into DIG channel SENS.sar_read_ctrl.sar1_dig_force = 1; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SENS.sar_power_xpd_sar.force_xpd_sar = SENS_FORCE_XPD_SAR_PU; + //switch SARADC into DIG channel + SENS.sar_meas1_mux.sar1_dig_force = 1; +#endif portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; } @@ -1500,13 +1854,18 @@ esp_err_t adc1_adc_mode_acquire(void) //lazy initialization //for adc1, block until acquire the lock _lock_acquire( &adc1_i2s_lock ); + ESP_LOGD( RTC_MODULE_TAG, "adc mode takes adc1 lock." ); portENTER_CRITICAL(&rtc_spinlock); // for now the WiFi would use ADC2 and set xpd_sar force on. // so we can not reset xpd_sar to fsm mode directly. // We should handle this after the synchronization mechanism is established. //switch SARADC into RTC channel +#if CONFIG_IDF_TARGET_ESP32 SENS.sar_read_ctrl.sar1_dig_force = 0; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SENS.sar_meas1_mux.sar1_dig_force = 0; +#endif portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; } @@ -1529,7 +1888,7 @@ int adc1_get_raw(adc1_channel_t channel) adc1_adc_mode_acquire(); adc_power_on(); - portENTER_CRITICAL(&rtc_spinlock); + portENTER_CRITICAL(&rtc_spinlock); //disable other peripherals adc1_hall_enable(false); adc1_fsm_disable(); //currently the LNA is not open, close it by default @@ -1646,7 +2005,7 @@ esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten) } SENS.sar_atten2 = ( SENS.sar_atten2 & ~(3<<(channel*2)) ) | ((atten&3) << (channel*2)); _lock_release( &adc2_wifi_lock ); - + portEXIT_CRITICAL( &adc2_spinlock ); return ESP_OK; } @@ -1654,6 +2013,7 @@ esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten) static inline void adc2_config_width(adc_bits_width_t width_bit) { portENTER_CRITICAL(&rtc_spinlock); +#if CONFIG_IDF_TARGET_ESP32 //sar_start_force shared with ADC1 SENS.sar_start_force.sar2_bit_width = width_bit; //cct set to the same value with PHY @@ -1664,19 +2024,38 @@ static inline void adc2_config_width(adc_bits_width_t width_bit) SENS.sar_read_ctrl2.sar2_data_inv = 1; //Set The adc sample width,invert adc value,must digital sar2_bit_width[1:0]=3 SENS.sar_read_ctrl2.sar2_sample_bit = width_bit; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + //sar_start_force shared with ADC1 + SENS.sar_meas2_ctrl1.sar2_bit_width = width_bit; + //cct set to the same value with PHY + SENS.sar_meas2_mux.sar2_pwdet_cct = 4; + portEXIT_CRITICAL(&rtc_spinlock); + //Invert the adc value,the Output value is invert + SENS.sar_reader2_ctrl.sar2_data_inv = 1; + //Set The adc sample width,invert adc value,must digital sar2_bit_width[1:0]=3 + SENS.sar_reader2_ctrl.sar2_sample_bit = width_bit; +#endif } static inline void adc2_dac_disable( adc2_channel_t channel) { +#if CONFIG_IDF_TARGET_ESP32 if ( channel == ADC2_CHANNEL_8 ) { // the same as DAC channel 1 dac_output_set_enable( DAC_CHANNEL_1, false ); } else if ( channel == ADC2_CHANNEL_9 ) { dac_output_set_enable( DAC_CHANNEL_2, false ); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if ( channel == ADC2_CHANNEL_6 ) { // the same as DAC channel 1 + dac_output_set_enable( DAC_CHANNEL_1, false ); + } else if ( channel == ADC2_CHANNEL_7 ) { + dac_output_set_enable( DAC_CHANNEL_2, false ); + } +#endif } //registers in critical section with adc1: -//SENS_SAR_START_FORCE_REG, +//SENS_SAR_START_FORCE_REG, esp_err_t adc2_get_raw(adc2_channel_t channel, adc_bits_width_t width_bit, int* raw_out) { uint16_t adc_value = 0; @@ -1686,7 +2065,7 @@ esp_err_t adc2_get_raw(adc2_channel_t channel, adc_bits_width_t width_bit, int* adc_power_on(); //avoid collision with other tasks - portENTER_CRITICAL(&adc2_spinlock); + portENTER_CRITICAL(&adc2_spinlock); //lazy initialization //try the lock, return if failed (wifi using). if ( _lock_try_acquire( &adc2_wifi_lock ) == -1 ) { @@ -1714,6 +2093,7 @@ esp_err_t adc2_get_raw(adc2_channel_t channel, adc_bits_width_t width_bit, int* esp_err_t adc2_vref_to_gpio(gpio_num_t gpio) { +#if CONFIG_IDF_TARGET_ESP32 int channel; if(gpio == GPIO_NUM_25){ channel = 8; //Channel 8 bit @@ -1745,7 +2125,7 @@ esp_err_t adc2_vref_to_gpio(gpio_num_t gpio) SENS.sar_meas_start2.sar2_en_pad_force = 1; //Pad bitmap controlled by SW //set en_pad for channels 7,8,9 (bits 0x380) SENS.sar_meas_start2.sar2_en_pad = 1< +#include "sdkconfig.h" #include "driver/spi_master.h" #include "soc/spi_periph.h" -#include "esp32/rom/ets_sys.h" #include "esp_types.h" #include "esp_attr.h" #include "esp_log.h" @@ -55,6 +55,9 @@ typedef struct spi_device_t spi_device_t; //Periph 1 is 'claimed' by SPI flash code. static atomic_bool spi_periph_claimed[SOC_SPI_PERIPH_NUM] = { ATOMIC_VAR_INIT(true), ATOMIC_VAR_INIT(false), ATOMIC_VAR_INIT(false), +#if SOC_SPI_PERIPH_NUM >= 4 + ATOMIC_VAR_INIT(false), +#endif }; static const char* spi_claiming_func[3] = {NULL, NULL, NULL}; static uint8_t spi_dma_chan_enabled = 0; @@ -102,7 +105,20 @@ int spicommon_irqdma_source_for_host(spi_host_device_t host) static inline uint32_t get_dma_periph(int dma_chan) { +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA + if (dma_chan==1) { + return PERIPH_SPI2_DMA_MODULE; + } else if (dma_chan==2) { + return PERIPH_SPI3_DMA_MODULE; + } else if (dma_chan==3) { + return PERIPH_SPI_SHARED_DMA_MODULE; + } else { + abort(); + return -1; + } +#elif defined(CONFIG_IDF_TARGET_ESP32) return PERIPH_SPI_DMA_MODULE; +#endif } bool spicommon_dma_chan_claim (int dma_chan) @@ -116,7 +132,18 @@ bool spicommon_dma_chan_claim (int dma_chan) spi_dma_chan_enabled |= DMA_CHANNEL_ENABLED(dma_chan); ret = true; } + +#if CONFIG_IDF_TARGET_ESP32 periph_module_enable(get_dma_periph(dma_chan)); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if (dma_chan==1) { + periph_module_enable(PERIPH_SPI2_DMA_MODULE); + } else if (dma_chan==2) { + periph_module_enable(PERIPH_SPI3_DMA_MODULE); + } else if (dma_chan==3) { + periph_module_enable(PERIPH_SPI_SHARED_DMA_MODULE); + } +#endif portEXIT_CRITICAL(&spi_dma_spinlock); return ret; @@ -135,10 +162,20 @@ bool spicommon_dma_chan_free(int dma_chan) portENTER_CRITICAL(&spi_dma_spinlock); spi_dma_chan_enabled &= ~DMA_CHANNEL_ENABLED(dma_chan); +#if CONFIG_IDF_TARGET_ESP32 if ( spi_dma_chan_enabled == 0 ) { //disable the DMA only when all the channels are freed. periph_module_disable(get_dma_periph(dma_chan)); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if (dma_chan==1) { + periph_module_disable(PERIPH_SPI2_DMA_MODULE); + } else if (dma_chan==2) { + periph_module_disable(PERIPH_SPI3_DMA_MODULE); + } else if (dma_chan==3) { + periph_module_disable(PERIPH_SPI_SHARED_DMA_MODULE); + } +#endif portEXIT_CRITICAL(&spi_dma_spinlock); return true; @@ -238,23 +275,43 @@ esp_err_t spicommon_bus_initialize_io(spi_host_device_t host, const spi_bus_conf ESP_LOGD(SPI_TAG, "SPI%d use iomux pins.", host+1); if (bus_config->mosi_io_num >= 0) { gpio_iomux_in(bus_config->mosi_io_num, spi_periph_signal[host].spid_in); +#if CONFIG_IDF_TARGET_ESP32 gpio_iomux_out(bus_config->mosi_io_num, spi_periph_signal[host].func, false); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + gpio_iomux_out(bus_config->mosi_io_num, spi_periph_signal[host].func, false); +#endif } if (bus_config->miso_io_num >= 0) { gpio_iomux_in(bus_config->miso_io_num, spi_periph_signal[host].spiq_in); +#if CONFIG_IDF_TARGET_ESP32 gpio_iomux_out(bus_config->miso_io_num, spi_periph_signal[host].func, false); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + gpio_iomux_out(bus_config->miso_io_num, spi_periph_signal[host].func, false); +#endif } if (bus_config->quadwp_io_num >= 0) { gpio_iomux_in(bus_config->quadwp_io_num, spi_periph_signal[host].spiwp_in); +#if CONFIG_IDF_TARGET_ESP32 gpio_iomux_out(bus_config->quadwp_io_num, spi_periph_signal[host].func, false); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + gpio_iomux_out(bus_config->quadwp_io_num, spi_periph_signal[host].func, false); +#endif } if (bus_config->quadhd_io_num >= 0) { gpio_iomux_in(bus_config->quadhd_io_num, spi_periph_signal[host].spihd_in); +#if CONFIG_IDF_TARGET_ESP32 gpio_iomux_out(bus_config->quadhd_io_num, spi_periph_signal[host].func, false); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + gpio_iomux_out(bus_config->quadhd_io_num, spi_periph_signal[host].func, false); +#endif } if (bus_config->sclk_io_num >= 0) { gpio_iomux_in(bus_config->sclk_io_num, spi_periph_signal[host].spiclk_in); +#if CONFIG_IDF_TARGET_ESP32 gpio_iomux_out(bus_config->sclk_io_num, spi_periph_signal[host].func, false); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + gpio_iomux_out(bus_config->sclk_io_num, spi_periph_signal[host].func, false); +#endif } temp_flag |= SPICOMMON_BUSFLAG_IOMUX_PINS; } else { @@ -268,6 +325,9 @@ esp_err_t spicommon_bus_initialize_io(spi_host_device_t host, const spi_bus_conf gpio_set_direction(bus_config->mosi_io_num, GPIO_MODE_INPUT); } gpio_matrix_in(bus_config->mosi_io_num, spi_periph_signal[host].spid_in, false); +#if CONFIG_IDF_TARGET_ESP32S2BETA + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[bus_config->mosi_io_num]); +#endif PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[bus_config->mosi_io_num], FUNC_GPIO); } if (bus_config->miso_io_num >= 0) { @@ -278,18 +338,27 @@ esp_err_t spicommon_bus_initialize_io(spi_host_device_t host, const spi_bus_conf gpio_set_direction(bus_config->miso_io_num, GPIO_MODE_INPUT); } gpio_matrix_in(bus_config->miso_io_num, spi_periph_signal[host].spiq_in, false); +#if CONFIG_IDF_TARGET_ESP32S2BETA + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[bus_config->miso_io_num]); +#endif PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[bus_config->miso_io_num], FUNC_GPIO); } if (bus_config->quadwp_io_num >= 0) { gpio_set_direction(bus_config->quadwp_io_num, GPIO_MODE_INPUT_OUTPUT); gpio_matrix_out(bus_config->quadwp_io_num, spi_periph_signal[host].spiwp_out, false, false); gpio_matrix_in(bus_config->quadwp_io_num, spi_periph_signal[host].spiwp_in, false); +#if CONFIG_IDF_TARGET_ESP32S2BETA + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[bus_config->quadwp_io_num]); +#endif PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[bus_config->quadwp_io_num], FUNC_GPIO); } if (bus_config->quadhd_io_num >= 0) { gpio_set_direction(bus_config->quadhd_io_num, GPIO_MODE_INPUT_OUTPUT); gpio_matrix_out(bus_config->quadhd_io_num, spi_periph_signal[host].spihd_out, false, false); gpio_matrix_in(bus_config->quadhd_io_num, spi_periph_signal[host].spihd_in, false); +#if CONFIG_IDF_TARGET_ESP32S2BETA + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[bus_config->quadhd_io_num]); +#endif PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[bus_config->quadhd_io_num], FUNC_GPIO); } if (bus_config->sclk_io_num >= 0) { @@ -300,12 +369,21 @@ esp_err_t spicommon_bus_initialize_io(spi_host_device_t host, const spi_bus_conf gpio_set_direction(bus_config->sclk_io_num, GPIO_MODE_INPUT); } gpio_matrix_in(bus_config->sclk_io_num, spi_periph_signal[host].spiclk_in, false); +#if CONFIG_IDF_TARGET_ESP32S2BETA + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[bus_config->sclk_io_num]); +#endif PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[bus_config->sclk_io_num], FUNC_GPIO); } } //Select DMA channel. +#ifdef CONFIG_IDF_TARGET_ESP32 DPORT_SET_PERI_REG_BITS(DPORT_SPI_DMA_CHAN_SEL_REG, 3, dma_chan, (host * 2)); +#elif defined(CONFIG_IDF_TARGET_ESP32S2BETA) + if (dma_chan==VSPI_HOST) { + DPORT_SET_PERI_REG_MASK(DPORT_SPI_DMA_CHAN_SEL_REG, DPORT_SPI_SHARED_DMA_SEL_M); + } +#endif if (flags_o) *flags_o = temp_flag; return ESP_OK; @@ -332,7 +410,11 @@ void spicommon_cs_initialize(spi_host_device_t host, int cs_io_num, int cs_num, if (!force_gpio_matrix && cs_io_num == spi_periph_signal[host].spics0_iomux_pin && cs_num == 0) { //The cs0s for all SPI peripherals map to pin mux source 1, so we use that instead of a define. gpio_iomux_in(cs_io_num, spi_periph_signal[host].spics_in); +#if CONFIG_IDF_TARGET_ESP32 gpio_iomux_out(cs_io_num, spi_periph_signal[host].func, false); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + gpio_iomux_out(cs_io_num, spi_periph_signal[host].func, false); +#endif } else { //Use GPIO matrix if (GPIO_IS_VALID_OUTPUT_GPIO(cs_io_num)) { @@ -342,6 +424,7 @@ void spicommon_cs_initialize(spi_host_device_t host, int cs_io_num, int cs_num, gpio_set_direction(cs_io_num, GPIO_MODE_INPUT); } if (cs_num == 0) gpio_matrix_in(cs_io_num, spi_periph_signal[host].spics_in, false); + PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[cs_io_num]); PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[cs_io_num], FUNC_GPIO); } } @@ -366,16 +449,17 @@ bool spicommon_bus_using_iomux(spi_host_device_t host) /* Code for workaround for DMA issue in ESP32 v0/v1 silicon */ - - +#if CONFIG_IDF_TARGET_ESP32 static volatile int dmaworkaround_channels_busy[2] = {0, 0}; static dmaworkaround_cb_t dmaworkaround_cb; static void *dmaworkaround_cb_arg; static portMUX_TYPE dmaworkaround_mux = portMUX_INITIALIZER_UNLOCKED; static int dmaworkaround_waiting_for_chan = 0; +#endif bool IRAM_ATTR spicommon_dmaworkaround_req_reset(int dmachan, dmaworkaround_cb_t cb, void *arg) { +#if CONFIG_IDF_TARGET_ESP32 int otherchan = (dmachan == 1) ? 2 : 1; bool ret; portENTER_CRITICAL_ISR(&dmaworkaround_mux); @@ -392,15 +476,24 @@ bool IRAM_ATTR spicommon_dmaworkaround_req_reset(int dmachan, dmaworkaround_cb_t } portEXIT_CRITICAL_ISR(&dmaworkaround_mux); return ret; +#else + //no need to reset + return true; +#endif } bool IRAM_ATTR spicommon_dmaworkaround_reset_in_progress(void) { +#if CONFIG_IDF_TARGET_ESP32 return (dmaworkaround_waiting_for_chan != 0); +#else + return false; +#endif } void IRAM_ATTR spicommon_dmaworkaround_idle(int dmachan) { +#if CONFIG_IDF_TARGET_ESP32 portENTER_CRITICAL_ISR(&dmaworkaround_mux); dmaworkaround_channels_busy[dmachan-1] = 0; if (dmaworkaround_waiting_for_chan == dmachan) { @@ -412,13 +505,14 @@ void IRAM_ATTR spicommon_dmaworkaround_idle(int dmachan) } portEXIT_CRITICAL_ISR(&dmaworkaround_mux); +#endif } void IRAM_ATTR spicommon_dmaworkaround_transfer_active(int dmachan) { +#if CONFIG_IDF_TARGET_ESP32 portENTER_CRITICAL_ISR(&dmaworkaround_mux); dmaworkaround_channels_busy[dmachan-1] = 1; portEXIT_CRITICAL_ISR(&dmaworkaround_mux); +#endif } - - diff --git a/components/driver/spi_master.c b/components/driver/spi_master.c index fee42c1487..966ecc6ae2 100644 --- a/components/driver/spi_master.c +++ b/components/driver/spi_master.c @@ -122,7 +122,6 @@ We have two bits to control the interrupt: #include "driver/spi_common_internal.h" #include "driver/spi_master.h" #include "soc/spi_periph.h" -#include "esp32/rom/ets_sys.h" #include "esp_types.h" #include "esp_attr.h" #include "esp_intr_alloc.h" @@ -134,12 +133,10 @@ We have two bits to control the interrupt: #include "freertos/xtensa_api.h" #include "freertos/task.h" #include "soc/soc_memory_layout.h" -#include "esp32/rom/lldesc.h" #include "driver/gpio.h" #include "esp_heap_caps.h" #include "stdatomic.h" #include "sdkconfig.h" - #include "hal/spi_hal.h" typedef struct spi_device_t spi_device_t; @@ -221,7 +218,11 @@ esp_err_t spi_bus_initialize(spi_host_device_t host, const spi_bus_config_t *bus SPI_CHECK(host!=SPI_HOST, "SPI1 is not supported", ESP_ERR_NOT_SUPPORTED); SPI_CHECK(host>=SPI_HOST && host<=VSPI_HOST, "invalid host", ESP_ERR_INVALID_ARG); +#ifdef CONFIG_IDF_TARGET_ESP32 SPI_CHECK( dma_chan >= 0 && dma_chan <= 2, "invalid dma channel", ESP_ERR_INVALID_ARG ); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SPI_CHECK( dma_chan == 0 || dma_chan == host, "invalid dma channel", ESP_ERR_INVALID_ARG ); +#endif SPI_CHECK((bus_config->intr_flags & (ESP_INTR_FLAG_HIGH|ESP_INTR_FLAG_EDGE|ESP_INTR_FLAG_INTRDISABLED))==0, "intr flag not allowed", ESP_ERR_INVALID_ARG); #ifndef CONFIG_SPI_MASTER_ISR_IN_IRAM SPI_CHECK((bus_config->intr_flags & ESP_INTR_FLAG_IRAM)==0, "ESP_INTR_FLAG_IRAM should be disabled when CONFIG_SPI_MASTER_ISR_IN_IRAM is not set.", ESP_ERR_INVALID_ARG); @@ -245,6 +246,7 @@ esp_err_t spi_bus_initialize(spi_host_device_t host, const spi_bus_config_t *bus } memset(spihost[host], 0, sizeof(spi_host_t)); memcpy( &spihost[host]->bus_cfg, bus_config, sizeof(spi_bus_config_t)); + #ifdef CONFIG_PM_ENABLE err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "spi_master", &spihost[host]->pm_lock); @@ -259,7 +261,6 @@ esp_err_t spi_bus_initialize(spi_host_device_t host, const spi_bus_config_t *bus ret = err; goto cleanup; } - int dma_desc_ct=0; spihost[host]->dma_chan=dma_chan; if (dma_chan == 0) { @@ -379,10 +380,12 @@ esp_err_t spi_bus_add_device(spi_host_device_t host, const spi_device_interface_ if (atomic_compare_exchange_strong(&spihost[host]->device[freecs], &null, (spi_device_t *)1)) break; } SPI_CHECK(freecs!=NO_CS, "no free cs pins for host", ESP_ERR_NOT_FOUND); +#ifdef CONFIG_IDF_TARGET_ESP32 //The hardware looks like it would support this, but actually setting cs_ena_pretrans when transferring in full //duplex mode does absolutely nothing on the ESP32. SPI_CHECK( dev_config->cs_ena_pretrans <= 1 || (dev_config->address_bits == 0 && dev_config->command_bits == 0) || (dev_config->flags & SPI_DEVICE_HALFDUPLEX), "In full-duplex mode, only support cs pretrans delay = 1 and without address_bits and command_bits", ESP_ERR_INVALID_ARG); +#endif duty_cycle = (dev_config->duty_cycle_pos==0) ? 128 : dev_config->duty_cycle_pos; @@ -804,8 +807,12 @@ static SPI_MASTER_ISR_ATTR esp_err_t check_trans_valid(spi_device_handle_t handl //check working mode SPI_CHECK(!((trans_desc->flags & (SPI_TRANS_MODE_DIO|SPI_TRANS_MODE_QIO)) && (handle->cfg.flags & SPI_DEVICE_3WIRE)), "incompatible iface params", ESP_ERR_INVALID_ARG); SPI_CHECK(!((trans_desc->flags & (SPI_TRANS_MODE_DIO|SPI_TRANS_MODE_QIO)) && (!(handle->cfg.flags & SPI_DEVICE_HALFDUPLEX))), "incompatible iface params", ESP_ERR_INVALID_ARG); +#ifdef CONFIG_IDF_TARGET_ESP32 SPI_CHECK( !(handle->cfg.flags & SPI_DEVICE_HALFDUPLEX) || host->dma_chan == 0 || !(trans_desc->flags & SPI_TRANS_USE_RXDATA || trans_desc->rx_buffer != NULL) || !(trans_desc->flags & SPI_TRANS_USE_TXDATA || trans_desc->tx_buffer!=NULL), "SPI half duplex mode does not support using DMA with both MOSI and MISO phases.", ESP_ERR_INVALID_ARG ); +#else + (void)host; +#endif //MOSI phase is skipped only when both tx_buffer and SPI_TRANS_USE_TXDATA are not set. SPI_CHECK(trans_desc->length != 0 || (trans_desc->tx_buffer == NULL && !(trans_desc->flags & SPI_TRANS_USE_TXDATA)), "trans tx_buffer should be NULL and SPI_TRANS_USE_TXDATA should be cleared to skip MOSI phase.", ESP_ERR_INVALID_ARG); @@ -1086,4 +1093,3 @@ esp_err_t SPI_MASTER_ISR_ATTR spi_device_polling_transmit(spi_device_handle_t ha return ESP_OK; } - diff --git a/components/driver/spi_slave.c b/components/driver/spi_slave.c index abefdc767d..f4eddb1665 100644 --- a/components/driver/spi_slave.c +++ b/components/driver/spi_slave.c @@ -13,13 +13,13 @@ // limitations under the License. #include +#include "sdkconfig.h" #include #include #include #include "driver/spi_common_internal.h" #include "driver/spi_slave.h" #include "soc/spi_periph.h" -#include "esp32/rom/ets_sys.h" #include "esp_types.h" #include "esp_attr.h" #include "esp_intr_alloc.h" @@ -31,7 +31,6 @@ #include "freertos/xtensa_api.h" #include "freertos/task.h" #include "soc/soc_memory_layout.h" -#include "esp32/rom/lldesc.h" #include "driver/gpio.h" #include "esp_heap_caps.h" @@ -104,7 +103,11 @@ esp_err_t spi_slave_initialize(spi_host_device_t host, const spi_bus_config_t *b esp_err_t err; //We only support HSPI/VSPI, period. SPI_CHECK(VALID_HOST(host), "invalid host", ESP_ERR_INVALID_ARG); +#if defined(CONFIG_IDF_TARGET_ESP32) SPI_CHECK( dma_chan >= 0 && dma_chan <= 2, "invalid dma channel", ESP_ERR_INVALID_ARG ); +#elif defined(CONFIG_IDF_TARGET_ESP32S2BETA) + SPI_CHECK( dma_chan == 0 || dma_chan == host, "invalid dma channel", ESP_ERR_INVALID_ARG ); +#endif SPI_CHECK((bus_config->intr_flags & (ESP_INTR_FLAG_HIGH|ESP_INTR_FLAG_EDGE|ESP_INTR_FLAG_INTRDISABLED))==0, "intr flag not allowed", ESP_ERR_INVALID_ARG); #ifndef CONFIG_SPI_SLAVE_ISR_IN_IRAM SPI_CHECK((bus_config->intr_flags & ESP_INTR_FLAG_IRAM)==0, "ESP_INTR_FLAG_IRAM should be disabled when CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set.", ESP_ERR_INVALID_ARG); @@ -394,4 +397,3 @@ static void SPI_SLAVE_ISR_ATTR spi_intr(void *arg) if (do_yield) portYIELD_FROM_ISR(); } - diff --git a/components/driver/test/CMakeLists.txt b/components/driver/test/CMakeLists.txt index 7102bae72e..f6245349c2 100644 --- a/components/driver/test/CMakeLists.txt +++ b/components/driver/test/CMakeLists.txt @@ -1,3 +1,9 @@ -idf_component_register(SRC_DIRS "." "param_test" - INCLUDE_DIRS "include" "param_test/include" - REQUIRES unity test_utils driver nvs_flash) \ No newline at end of file +set(srcdirs . param_test) +if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcdirs "esp32") +endif() + +idf_component_register(SRC_DIRS ${srcdirs} + INCLUDE_DIRS include param_test/include + REQUIRES unity test_utils driver nvs_flash + ) diff --git a/components/driver/test/component.mk b/components/driver/test/component.mk index 2f9f42ccdb..f37a1fa51c 100644 --- a/components/driver/test/component.mk +++ b/components/driver/test/component.mk @@ -2,6 +2,7 @@ #Component Makefile # +COMPONENT_SRCDIRS += esp32 COMPONENT_SRCDIRS += param_test COMPONENT_PRIV_INCLUDEDIRS += param_test/include diff --git a/components/driver/test/test_adc2.c b/components/driver/test/esp32/test_adc2.c similarity index 100% rename from components/driver/test/test_adc2.c rename to components/driver/test/esp32/test_adc2.c diff --git a/components/driver/test/test_gpio.c b/components/driver/test/esp32/test_gpio.c similarity index 99% rename from components/driver/test/test_gpio.c rename to components/driver/test/esp32/test_gpio.c index c40815683c..8777e5207f 100644 --- a/components/driver/test/test_gpio.c +++ b/components/driver/test/esp32/test_gpio.c @@ -4,7 +4,7 @@ */ #include #include -#include "esp32/rom/uart.h" + #include "esp_system.h" #include "esp_sleep.h" #include "unity.h" @@ -12,6 +12,13 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/queue.h" +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/uart.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/uart.h" +#endif #define WAKE_UP_IGNORE 1 // gpio_wakeup function development is not completed yet, set it deprecated. #define GPIO_OUTPUT_IO 18 // default output GPIO diff --git a/components/driver/test/esp32/test_i2c.c b/components/driver/test/esp32/test_i2c.c new file mode 100644 index 0000000000..75eec14d7f --- /dev/null +++ b/components/driver/test/esp32/test_i2c.c @@ -0,0 +1,356 @@ +/** + * test environment UT_T2_I2C: + * please prepare two ESP32-WROVER-KIT board. + * Then connect GPIO18 and GPIO18, GPIO19 and GPIO19 between these two boards. + */ +#include +#include +#include "unity.h" +#include "test_utils.h" +#include "unity_config.h" +#include "driver/i2c.h" +#include "esp_attr.h" +#include "esp_log.h" +#include "soc/gpio_periph.h" +#include "soc/i2c_periph.h" +#include "esp_system.h" +#include "driver/pcnt.h" + + +#define DATA_LENGTH 512 /*! #include #include -#include "esp32/rom/ets_sys.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" diff --git a/components/driver/test/test_pcnt.c b/components/driver/test/esp32/test_pcnt.c similarity index 99% rename from components/driver/test/test_pcnt.c rename to components/driver/test/esp32/test_pcnt.c index 90dc2c4ece..826cab0cdb 100644 --- a/components/driver/test/test_pcnt.c +++ b/components/driver/test/esp32/test_pcnt.c @@ -22,7 +22,6 @@ #include "esp_log.h" #include "soc/gpio_periph.h" #include "unity.h" -#include "esp32/rom/ets_sys.h" #define PULSE_IO 18 #define PCNT_INPUT_IO 4 diff --git a/components/driver/test/test_pwm.c b/components/driver/test/esp32/test_pwm.c similarity index 99% rename from components/driver/test/test_pwm.c rename to components/driver/test/esp32/test_pwm.c index b787f8e3ab..34780da3f1 100644 --- a/components/driver/test/test_pwm.c +++ b/components/driver/test/esp32/test_pwm.c @@ -25,7 +25,6 @@ #include "esp_attr.h" #include "esp_log.h" #include "soc/rtc.h" -#include "esp32/rom/ets_sys.h" #define GPIO_PWMA_OUT 4 #define GPIO_PWMB_OUT 13 diff --git a/components/driver/test/test_rmt.c b/components/driver/test/esp32/test_rmt.c similarity index 100% rename from components/driver/test/test_rmt.c rename to components/driver/test/esp32/test_rmt.c diff --git a/components/driver/test/esp32/test_rs485.c b/components/driver/test/esp32/test_rs485.c new file mode 100644 index 0000000000..c81686b24f --- /dev/null +++ b/components/driver/test/esp32/test_rs485.c @@ -0,0 +1,281 @@ +/* This file is from test_uart.c, but mainly about RS485 */ + + +#include +#include +#include "unity.h" +#include "test_utils.h" // unity_send_signal +#include "driver/uart.h" // for the uart driver access +#include "esp_log.h" +#include "esp_system.h" // for uint32_t esp_random() + +#define UART_TAG "Uart" +#define UART_NUM1 (UART_NUM_1) +#define BUF_SIZE (100) +#define UART1_RX_PIN (22) +#define UART1_TX_PIN (23) +#define UART_BAUD_11520 (11520) +#define UART_BAUD_115200 (115200) +#define TOLERANCE (0.02) //baud rate error tolerance 2%. + +#define UART_TOLERANCE_CHECK(val, uper_limit, lower_limit) ( (val) <= (uper_limit) && (val) >= (lower_limit) ) + +// RTS for RS485 Half-Duplex Mode manages DE/~RE +#define UART1_RTS_PIN (18) + +// Number of packets to be send during test +#define PACKETS_NUMBER (10) + +// Wait timeout for uart driver +#define PACKET_READ_TICS (1000 / portTICK_RATE_MS) + +// The table for fast CRC16 calculation +static const uint8_t crc_hi[] = { + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, + 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, + 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, + 0x81, 0x40, 0x01, + 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, + 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, + 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, + 0x41, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x01, + 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, + 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, + 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, + 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, + 0x81, 0x40, 0x01, + 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, + 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, + 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, + 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x01, + 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, + 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, + 0x40 +}; + +static const uint8_t crc_low[] = { + 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7, + 0x05, 0xC5, 0xC4, + 0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, + 0x0B, 0xC9, 0x09, + 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, + 0xDF, 0x1F, 0xDD, + 0x1D, 0x1C, 0xDC, 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, + 0x12, 0x13, 0xD3, + 0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32, + 0x36, 0xF6, 0xF7, + 0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, + 0xFE, 0xFA, 0x3A, + 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, + 0x2A, 0xEA, 0xEE, + 0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, + 0xE7, 0xE6, 0x26, + 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1, + 0x63, 0xA3, 0xA2, + 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4, 0x6C, 0xAC, 0xAD, + 0x6D, 0xAF, 0x6F, + 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, + 0xB9, 0x79, 0xBB, + 0x7B, 0x7A, 0xBA, 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, + 0x74, 0x75, 0xB5, + 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0, + 0x50, 0x90, 0x91, + 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, + 0x54, 0x9C, 0x5C, + 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, + 0x58, 0x98, 0x88, + 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, + 0x4D, 0x4C, 0x8C, + 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, + 0x41, 0x81, 0x80, + 0x40 +}; + + +// Calculate buffer checksum using tables +// The checksum CRC16 algorithm is specific +// for Modbus standard and uses polynomial value = 0xA001 +static uint16_t get_buffer_crc16( uint8_t * frame_ptr, uint16_t length ) +{ + TEST_ASSERT( frame_ptr != NULL); + + uint8_t crc_hi_byte = 0xFF; + uint8_t crc_low_byte = 0xFF; + int index; + + while ( length-- ) + { + index = crc_low_byte ^ *(frame_ptr++); + crc_low_byte = crc_hi_byte ^ crc_hi[index]; + crc_hi_byte = crc_low[index]; + } + return ((crc_hi_byte << 8) | crc_low_byte); +} + +// Fill the buffer with random numbers and apply CRC16 at the end +static uint16_t buffer_fill_random(uint8_t *buffer, size_t length) +{ + TEST_ASSERT( buffer != NULL); + // Packet is too short + if (length < 4) { + return 0; + } + for (int i = 0; i < length; i += 4) { + uint32_t random = esp_random(); + memcpy(buffer + i, &random, MIN(length - i, 4)); + } + // Get checksum of the buffer + uint16_t crc = get_buffer_crc16((uint8_t*)buffer, (length - 2)); + // Apply checksum bytes into packet + buffer[length - 2] = (uint8_t)(crc & 0xFF); // Set Low byte CRC + buffer[length - 1] = (uint8_t)(crc >> 8); // Set High byte CRC + return crc; +} + +static void rs485_init(void) +{ + uart_config_t uart_config = { + .baud_rate = UART_BAUD_115200, + .data_bits = UART_DATA_8_BITS, + .parity = UART_PARITY_DISABLE, + .stop_bits = UART_STOP_BITS_1, + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, + .rx_flow_ctrl_thresh = 122, + }; + printf("RS485 port initialization...\r\n"); + // Configure UART1 parameters + uart_param_config(UART_NUM1, &uart_config); + // Set UART1 pins(TX: IO4, RX: I05, RTS: IO18, CTS: IO19) + uart_set_pin(UART_NUM1, UART1_TX_PIN, UART1_RX_PIN, UART1_RTS_PIN, UART_PIN_NO_CHANGE); + // Install UART driver (we don't need an event queue here) + uart_driver_install(UART_NUM1, BUF_SIZE * 2, 0, 0, NULL, 0); + // Setup rs485 half duplex mode + //uart_set_rs485_hd_mode(uart_num, true); + uart_set_mode(UART_NUM1, UART_MODE_RS485_HALF_DUPLEX); +} + +static esp_err_t print_packet_data(const char *str, uint8_t *buffer, uint16_t buffer_size) +{ + TEST_ASSERT( buffer != NULL); + TEST_ASSERT( str != NULL); + + // Calculate the checksum of the buffer + uint16_t crc16_calc = get_buffer_crc16(buffer, (buffer_size - 2)); + uint16_t crc16_in = ((uint16_t)(buffer[buffer_size - 1]) << 8) | buffer[buffer_size - 2]; + const char* state_str = (crc16_in != crc16_calc) ? "incorrect " : "correct "; + // Print an array of data + printf("%s%s RS485 packet = [ ", str, state_str); + for (int i = 0; i < buffer_size; i++) { + printf("0x%.2X ", (uint8_t)buffer[i]); + } + printf(" ]\r\n"); + printf("crc_in = 0x%.4X\r\n", (uint16_t)crc16_in); + printf("crc_calc = 0x%.4X\r\n", (uint16_t)crc16_calc); + esp_err_t result = (crc16_in != crc16_calc) ? ESP_ERR_INVALID_CRC : ESP_OK; + return result; +} + +// Slave test case for multi device +static void rs485_slave(void) +{ + rs485_init(); + uint8_t* slave_data = (uint8_t*) malloc(BUF_SIZE); + uint16_t err_count = 0, good_count = 0; + printf("Start recieve loop.\r\n"); + unity_send_signal("Slave_ready"); + unity_wait_for_signal("Master_started"); + for(int pack_count = 0; pack_count < PACKETS_NUMBER; pack_count++) { + //Read slave_data from UART + int len = uart_read_bytes(UART_NUM1, slave_data, BUF_SIZE, (PACKET_READ_TICS * 2)); + //Write slave_data back to UART + if (len > 2) { + esp_err_t status = print_packet_data("Received ", slave_data, len); + + // If received packet is correct then send it back + if (status == ESP_OK) { + uart_write_bytes(UART_NUM1, (char*)slave_data, len); + good_count++; + } else { + printf("Incorrect packet received.\r\n"); + err_count++; + } + } else { + printf("Incorrect data packet[%d] received.\r\n", pack_count); + err_count++; + } + } + printf("Test completed. Received packets = %d, errors = %d\r\n", good_count, err_count); + // Wait for packet to be sent + uart_wait_tx_done(UART_NUM1, PACKET_READ_TICS); + free(slave_data); + uart_driver_delete(UART_NUM1); + TEST_ASSERT(err_count < 2); +} + +// Master test of multi device test case. +// It forms packet with random data, apply generated CRC16 and sends to slave. +// If response recieved correctly from slave means RS485 channel works. +static void rs485_master(void) +{ + uint16_t err_count = 0, good_count = 0; + rs485_init(); + uint8_t* master_buffer = (uint8_t*) malloc(BUF_SIZE); + uint8_t* slave_buffer = (uint8_t*) malloc(BUF_SIZE); + // The master test case should be synchronized with slave + unity_wait_for_signal("Slave_ready"); + unity_send_signal("Master_started"); + printf("Start recieve loop.\r\n"); + for(int i = 0; i < PACKETS_NUMBER; i++) { + // Form random buffer with CRC16 + buffer_fill_random(master_buffer, BUF_SIZE); + // Print created packet for debugging + esp_err_t status = print_packet_data("Send ", master_buffer, BUF_SIZE); + TEST_ASSERT(status == ESP_OK); + uart_write_bytes(UART_NUM1, (char*)master_buffer, BUF_SIZE); + // Read translated packet from slave + int len = uart_read_bytes(UART_NUM1, slave_buffer, BUF_SIZE, (PACKET_READ_TICS * 2)); + // Check if the received packet is too short + if (len > 2) { + // Print received packet and check checksum + esp_err_t status = print_packet_data("Received ", slave_buffer, len); + if (status == ESP_OK) { + good_count++; + printf("Received: %d\r\n", good_count); + } else { + err_count++; + printf("Errors: %d\r\n", err_count); + } + } + else { + printf("Incorrect answer from slave.\r\n"); + err_count++; + } + } + // Free the buffer and delete driver at the end + free(master_buffer); + uart_driver_delete(UART_NUM1); + TEST_ASSERT(err_count <= 1); + printf("Test completed. Received packets = %d, errors = %d\r\n", (uint16_t)good_count, (uint16_t)err_count); +} + +/* + * This multi devices test case verifies RS485 mode of the uart driver and checks + * correctness of RS485 interface channel communication. It requires + * RS485 bus driver hardware to be connected to boards. +*/ +TEST_CASE_MULTIPLE_DEVICES("RS485 half duplex uart multiple devices test.", "[driver_RS485][test_env=UT_T2_RS485]", rs485_master, rs485_slave); diff --git a/components/driver/test/test_spi_master.c b/components/driver/test/esp32/test_spi_master.c similarity index 89% rename from components/driver/test/test_spi_master.c rename to components/driver/test/esp32/test_spi_master.c index 7e773cd68a..75ca7883b0 100644 --- a/components/driver/test/test_spi_master.c +++ b/components/driver/test/esp32/test_spi_master.c @@ -7,7 +7,6 @@ #include #include #include -#include "esp32/rom/ets_sys.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" @@ -55,10 +54,12 @@ static void check_spi_pre_n_for(int clk, int pre, int n) t.tx_buffer=sendbuf; ret=spi_device_transmit(handle, &t); - printf("Checking clk rate %dHz. expect pre %d n %d, got pre %d n %d\n", clk, pre, n, SPI2.clock.clkdiv_pre+1, SPI2.clock.clkcnt_n+1); + spi_dev_t* hw = spi_periph_signal[TEST_SPI_HOST].hw; - TEST_ASSERT(SPI2.clock.clkcnt_n+1==n); - TEST_ASSERT(SPI2.clock.clkdiv_pre+1==pre); + printf("Checking clk rate %dHz. expect pre %d n %d, got pre %d n %d\n", clk, pre, n, hw->clock.clkdiv_pre+1, hw->clock.clkcnt_n+1); + + TEST_ASSERT(hw->clock.clkcnt_n+1==n); + TEST_ASSERT(hw->clock.clkdiv_pre+1==pre); ret=spi_bus_remove_device(handle); TEST_ASSERT(ret==ESP_OK); @@ -331,7 +332,7 @@ TEST_CASE("spi bus setting with different pin configs", "[spi]") ESP_LOGI(TAG, "test 6 iomux output pins..."); flags_expected = SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MOSI | SPICOMMON_BUSFLAG_MISO | SPICOMMON_BUSFLAG_IOMUX_PINS | SPICOMMON_BUSFLAG_QUAD; - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .miso_io_num = HSPI_IOMUX_PIN_NUM_MISO, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .miso_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ESP_OK(spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL_HEX32( flags_expected, flags_o ); @@ -340,7 +341,7 @@ TEST_CASE("spi bus setting with different pin configs", "[spi]") ESP_LOGI(TAG, "test 4 iomux output pins..."); flags_expected = SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MOSI | SPICOMMON_BUSFLAG_MISO | SPICOMMON_BUSFLAG_IOMUX_PINS | SPICOMMON_BUSFLAG_DUAL; - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .miso_io_num = HSPI_IOMUX_PIN_NUM_MISO, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = -1, .quadwp_io_num = -1, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .miso_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = -1, .quadwp_io_num = -1, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ESP_OK(spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL_HEX32( flags_expected, flags_o ); @@ -350,7 +351,7 @@ TEST_CASE("spi bus setting with different pin configs", "[spi]") ESP_LOGI(TAG, "test 6 output pins..."); flags_expected = SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MOSI | SPICOMMON_BUSFLAG_MISO | SPICOMMON_BUSFLAG_QUAD; //swap MOSI and MISO - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MISO, .miso_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .miso_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ESP_OK(spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL_HEX32( flags_expected, flags_o ); @@ -360,7 +361,7 @@ TEST_CASE("spi bus setting with different pin configs", "[spi]") ESP_LOGI(TAG, "test 4 output pins..."); flags_expected = SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MOSI | SPICOMMON_BUSFLAG_MISO | SPICOMMON_BUSFLAG_DUAL; //swap MOSI and MISO - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MISO, .miso_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = -1, .quadwp_io_num = -1, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .miso_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = -1, .quadwp_io_num = -1, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ESP_OK(spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL_HEX32( flags_expected, flags_o ); @@ -369,14 +370,14 @@ TEST_CASE("spi bus setting with different pin configs", "[spi]") ESP_LOGI(TAG, "test master 5 output pins and MOSI on input-only pin..."); flags_expected = SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MOSI | SPICOMMON_BUSFLAG_MISO | SPICOMMON_BUSFLAG_WPHD; - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .miso_io_num = 34, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .miso_io_num = 34, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ESP_OK(spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL_HEX32( flags_expected, flags_o ); ESP_LOGI(TAG, "test slave 5 output pins and MISO on input-only pin..."); flags_expected = SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MOSI | SPICOMMON_BUSFLAG_MISO | SPICOMMON_BUSFLAG_WPHD; - cfg = (spi_bus_config_t){.mosi_io_num = 34, .miso_io_num = HSPI_IOMUX_PIN_NUM_MISO, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = 34, .miso_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ESP_OK(spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); TEST_ASSERT_EQUAL_HEX32( flags_expected, flags_o ); @@ -384,14 +385,14 @@ TEST_CASE("spi bus setting with different pin configs", "[spi]") ESP_LOGI(TAG, "test master 3 output pins and MOSI on input-only pin..."); flags_expected = SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MOSI | SPICOMMON_BUSFLAG_MISO; - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .miso_io_num = 34, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = -1, .quadwp_io_num = -1, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .miso_io_num = 34, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = -1, .quadwp_io_num = -1, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ESP_OK(spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL_HEX32( flags_expected, flags_o ); ESP_LOGI(TAG, "test slave 3 output pins and MISO on input-only pin..."); flags_expected = SPICOMMON_BUSFLAG_SCLK | SPICOMMON_BUSFLAG_MOSI | SPICOMMON_BUSFLAG_MISO; - cfg = (spi_bus_config_t){.mosi_io_num = 34, .miso_io_num = HSPI_IOMUX_PIN_NUM_MISO, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = -1, .quadwp_io_num = -1, + cfg = (spi_bus_config_t){.mosi_io_num = 34, .miso_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = -1, .quadwp_io_num = -1, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ESP_OK(spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); TEST_ASSERT_EQUAL_HEX32( flags_expected, flags_o ); @@ -399,7 +400,7 @@ TEST_CASE("spi bus setting with different pin configs", "[spi]") ESP_LOGI(TAG, "check native flag for 6 output pins..."); flags_expected = SPICOMMON_BUSFLAG_IOMUX_PINS; //swap MOSI and MISO - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MISO, .miso_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .miso_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); @@ -407,61 +408,61 @@ TEST_CASE("spi bus setting with different pin configs", "[spi]") ESP_LOGI(TAG, "check native flag for 4 output pins..."); flags_expected = SPICOMMON_BUSFLAG_IOMUX_PINS; //swap MOSI and MISO - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MISO, .miso_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = -1, .quadwp_io_num = -1, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .miso_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = -1, .quadwp_io_num = -1, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); ESP_LOGI(TAG, "check dual flag for master 5 output pins and MISO/MOSI on input-only pin..."); flags_expected = SPICOMMON_BUSFLAG_DUAL; - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .miso_io_num = 34, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .miso_io_num = 34, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); - cfg = (spi_bus_config_t){.mosi_io_num = 34, .miso_io_num = HSPI_IOMUX_PIN_NUM_MISO, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = 34, .miso_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); ESP_LOGI(TAG, "check dual flag for master 3 output pins and MISO/MOSI on input-only pin..."); flags_expected = SPICOMMON_BUSFLAG_DUAL; - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .miso_io_num = 34, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = -1, .quadwp_io_num = -1, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .miso_io_num = 34, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = -1, .quadwp_io_num = -1, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); - cfg = (spi_bus_config_t){.mosi_io_num = 34, .miso_io_num = HSPI_IOMUX_PIN_NUM_MISO, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = -1, .quadwp_io_num = -1, + cfg = (spi_bus_config_t){.mosi_io_num = 34, .miso_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = -1, .quadwp_io_num = -1, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); ESP_LOGI(TAG, "check sclk flag..."); flags_expected = SPICOMMON_BUSFLAG_SCLK; - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .miso_io_num = HSPI_IOMUX_PIN_NUM_MISO, .sclk_io_num = -1, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .miso_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .sclk_io_num = -1, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); ESP_LOGI(TAG, "check mosi flag..."); flags_expected = SPICOMMON_BUSFLAG_MOSI; - cfg = (spi_bus_config_t){.mosi_io_num = -1, .miso_io_num = HSPI_IOMUX_PIN_NUM_MISO, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = -1, .miso_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); ESP_LOGI(TAG, "check miso flag..."); flags_expected = SPICOMMON_BUSFLAG_MISO; - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .miso_io_num = -1, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .miso_io_num = -1, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); ESP_LOGI(TAG, "check quad flag..."); flags_expected = SPICOMMON_BUSFLAG_QUAD; - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .miso_io_num = HSPI_IOMUX_PIN_NUM_MISO, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = -1, .quadwp_io_num = HSPI_IOMUX_PIN_NUM_WP, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .miso_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = -1, .quadwp_io_num = spi_periph_signal[HSPI_HOST].spiwp_iomux_pin, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); - cfg = (spi_bus_config_t){.mosi_io_num = HSPI_IOMUX_PIN_NUM_MOSI, .miso_io_num = HSPI_IOMUX_PIN_NUM_MISO, .sclk_io_num = HSPI_IOMUX_PIN_NUM_CLK, .quadhd_io_num = HSPI_IOMUX_PIN_NUM_HD, .quadwp_io_num = -1, + cfg = (spi_bus_config_t){.mosi_io_num = spi_periph_signal[HSPI_HOST].spid_iomux_pin, .miso_io_num = spi_periph_signal[HSPI_HOST].spiq_iomux_pin, .sclk_io_num = spi_periph_signal[HSPI_HOST].spiclk_iomux_pin, .quadhd_io_num = spi_periph_signal[HSPI_HOST].spihd_iomux_pin, .quadwp_io_num = -1, .max_transfer_sz = 8, .flags = flags_expected}; TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_MASTER, &flags_o)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, spicommon_bus_initialize_io(TEST_SPI_HOST, &cfg, 0, flags_expected|SPICOMMON_BUSFLAG_SLAVE, &flags_o)); @@ -544,7 +545,7 @@ static const uint8_t data_drom[320+3] = { TEST_CASE("SPI Master DMA test, TX and RX in different regions", "[spi]") { -#ifdef CONFIG_ESP32_SPIRAM_SUPPORT +#ifdef CONFIG_SPIRAM //test psram if enabled ESP_LOGI(TAG, "testing PSRAM..."); uint32_t* data_malloc = (uint32_t*)heap_caps_malloc(324, MALLOC_CAP_SPIRAM); diff --git a/components/driver/test/test_spi_param.c b/components/driver/test/esp32/test_spi_param.c similarity index 100% rename from components/driver/test/test_spi_param.c rename to components/driver/test/esp32/test_spi_param.c diff --git a/components/driver/test/test_spi_sio.c b/components/driver/test/esp32/test_spi_sio.c similarity index 100% rename from components/driver/test/test_spi_sio.c rename to components/driver/test/esp32/test_spi_sio.c diff --git a/components/driver/test/test_spi_slave.c b/components/driver/test/esp32/test_spi_slave.c similarity index 89% rename from components/driver/test/test_spi_slave.c rename to components/driver/test/esp32/test_spi_slave.c index c1e913c480..ba79393f51 100644 --- a/components/driver/test/test_spi_slave.c +++ b/components/driver/test/esp32/test_spi_slave.c @@ -11,7 +11,7 @@ #include "sdkconfig.h" #include "test/test_common_spi.h" -#ifndef CONFIG_ESP32_SPIRAM_SUPPORT +#ifndef CONFIG_SPIRAM //This test should be removed once the timing test is merged. @@ -88,10 +88,10 @@ TEST_CASE("test slave send unaligned","[spi]") slave_init(); //do internal connection - int_connect( PIN_NUM_MOSI, HSPID_OUT_IDX, VSPIQ_IN_IDX ); - int_connect( PIN_NUM_MISO, VSPIQ_OUT_IDX, HSPID_IN_IDX ); - int_connect( PIN_NUM_CS, HSPICS0_OUT_IDX, VSPICS0_IN_IDX ); - int_connect( PIN_NUM_CLK, HSPICLK_OUT_IDX, VSPICLK_IN_IDX ); + int_connect( PIN_NUM_MOSI, spi_periph_signal[TEST_SPI_HOST].spid_out, spi_periph_signal[TEST_SLAVE_HOST].spiq_in ); + int_connect( PIN_NUM_MISO, spi_periph_signal[TEST_SLAVE_HOST].spiq_out, spi_periph_signal[TEST_SPI_HOST].spid_in ); + int_connect( PIN_NUM_CS, spi_periph_signal[TEST_SPI_HOST].spics_out[0], spi_periph_signal[TEST_SLAVE_HOST].spics_in ); + int_connect( PIN_NUM_CLK, spi_periph_signal[TEST_SPI_HOST].spiclk_out, spi_periph_signal[TEST_SLAVE_HOST].spiclk_in ); for ( int i = 0; i < 4; i ++ ) { //slave send @@ -140,4 +140,4 @@ TEST_CASE("test slave send unaligned","[spi]") ESP_LOGI(MASTER_TAG, "test passed."); } -#endif // !CONFIG_ESP32_SPIRAM_SUPPORT +#endif // !CONFIG_SPIRAM diff --git a/components/driver/test/include/test/test_common_spi.h b/components/driver/test/include/test/test_common_spi.h index 38fa59237c..fea4df7d01 100644 --- a/components/driver/test/include/test/test_common_spi.h +++ b/components/driver/test/include/test/test_common_spi.h @@ -13,9 +13,43 @@ // All the tests using the header should use this definition as much as possible, // so that the working host can be changed easily in the future. +#if CONFIG_IDF_TARGET_ESP32 #define TEST_SPI_HOST HSPI_HOST #define TEST_SLAVE_HOST VSPI_HOST +#define PIN_NUM_MISO HSPI_IOMUX_PIN_NUM_MISO +#define PIN_NUM_MOSI HSPI_IOMUX_PIN_NUM_MOSI +#define PIN_NUM_CLK HSPI_IOMUX_PIN_NUM_CLK +#define PIN_NUM_CS HSPI_IOMUX_PIN_NUM_CS +#define PIN_NUM_WP HSPI_IOMUX_PIN_NUM_WP +#define PIN_NUM_HD HSPI_IOMUX_PIN_NUM_HD + +#define SLAVE_PIN_NUM_MISO VSPI_IOMUX_PIN_NUM_MISO +#define SLAVE_PIN_NUM_MOSI VSPI_IOMUX_PIN_NUM_MOSI +#define SLAVE_PIN_NUM_CLK VSPI_IOMUX_PIN_NUM_CLK +#define SLAVE_PIN_NUM_CS VSPI_IOMUX_PIN_NUM_CS +#define SLAVE_PIN_NUM_WP VSPI_IOMUX_PIN_NUM_WP +#define SLAVE_PIN_NUM_HD VSPI_IOMUX_PIN_NUM_HD +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define TEST_SPI_HOST FSPI_HOST +#define TEST_SLAVE_HOST HSPI_HOST + +#define PIN_NUM_MISO FSPI_IOMUX_PIN_NUM_MISO +#define PIN_NUM_MOSI FSPI_IOMUX_PIN_NUM_MOSI +#define PIN_NUM_CLK FSPI_IOMUX_PIN_NUM_CLK +#define PIN_NUM_CS FSPI_IOMUX_PIN_NUM_CS +#define PIN_NUM_WP FSPI_IOMUX_PIN_NUM_WP +#define PIN_NUM_HD FSPI_IOMUX_PIN_NUM_HD + +#define SLAVE_PIN_NUM_MISO HSPI_IOMUX_PIN_NUM_MISO +#define SLAVE_PIN_NUM_MOSI HSPI_IOMUX_PIN_NUM_MOSI +#define SLAVE_PIN_NUM_CLK HSPI_IOMUX_PIN_NUM_CLK +#define SLAVE_PIN_NUM_CS HSPI_IOMUX_PIN_NUM_CS +#define SLAVE_PIN_NUM_WP HSPI_IOMUX_PIN_NUM_WP +#define SLAVE_PIN_NUM_HD HSPI_IOMUX_PIN_NUM_HD +#endif + + #define FUNC_SPI 1 #define FUNC_GPIO 2 @@ -52,11 +86,6 @@ 0,\ } -#define PIN_NUM_MISO HSPI_IOMUX_PIN_NUM_MISO -#define PIN_NUM_MOSI HSPI_IOMUX_PIN_NUM_MOSI -#define PIN_NUM_CLK HSPI_IOMUX_PIN_NUM_CLK -#define PIN_NUM_CS HSPI_IOMUX_PIN_NUM_CS - //default bus config for tests #define SPI_BUS_TEST_DEFAULT_CONFIG() {\ .miso_io_num=PIN_NUM_MISO, \ diff --git a/components/driver/test/test_i2c.c b/components/driver/test/test_i2c.c index bde591cb3f..d26d458614 100644 --- a/components/driver/test/test_i2c.c +++ b/components/driver/test/test_i2c.c @@ -62,19 +62,6 @@ static esp_err_t i2c_master_write_slave(i2c_port_t i2c_num, uint8_t *data_wr, si return ret; } -// print the reading buffer -static void disp_buf(uint8_t *buf, int len) -{ - int i; - for (i = 0; i < len; i++) { - printf("%02x ", buf[i]); - if (( i + 1 ) % 16 == 0) { - printf("\n"); - } - } - printf("\n"); -} - static i2c_config_t i2c_master_init(void) { i2c_config_t conf_master = { @@ -252,260 +239,6 @@ TEST_CASE("I2C driver memory leaking check", "[i2c]") TEST_ASSERT_INT_WITHIN(100, size, esp_get_free_heap_size()); } -static void i2c_master_write_test(void) -{ - uint8_t *data_wr = (uint8_t *) malloc(DATA_LENGTH); - int i; - - i2c_config_t conf_master = i2c_master_init(); - TEST_ESP_OK(i2c_param_config(I2C_MASTER_NUM, &conf_master)); - - TEST_ESP_OK(i2c_driver_install(I2C_MASTER_NUM, I2C_MODE_MASTER, - I2C_MASTER_RX_BUF_DISABLE, - I2C_MASTER_TX_BUF_DISABLE, 0)); - unity_wait_for_signal("i2c slave init finish"); - - unity_send_signal("master write"); - for (i = 0; i < DATA_LENGTH / 2; i++) { - data_wr[i] = i; - } - i2c_master_write_slave(I2C_MASTER_NUM, data_wr, DATA_LENGTH / 2); - disp_buf(data_wr, i + 1); - free(data_wr); - unity_wait_for_signal("ready to delete"); - TEST_ESP_OK(i2c_driver_delete(I2C_MASTER_NUM)); -} - -static void i2c_slave_read_test(void) -{ - uint8_t *data_rd = (uint8_t *) malloc(DATA_LENGTH); - int size_rd = 0; - int len = 0; - - i2c_config_t conf_slave = i2c_slave_init(); - TEST_ESP_OK(i2c_param_config( I2C_SLAVE_NUM, &conf_slave)); - TEST_ESP_OK(i2c_driver_install(I2C_SLAVE_NUM, I2C_MODE_SLAVE, - I2C_SLAVE_RX_BUF_LEN, - I2C_SLAVE_TX_BUF_LEN, 0)); - unity_send_signal("i2c slave init finish"); - - unity_wait_for_signal("master write"); - while (1) { - len = i2c_slave_read_buffer( I2C_SLAVE_NUM, data_rd + size_rd, DATA_LENGTH, 10000 / portTICK_RATE_MS); - if (len == 0) { - break; - } - size_rd += len; - } - disp_buf(data_rd, size_rd); - for (int i = 0; i < size_rd; i++) { - TEST_ASSERT(data_rd[i] == i); - } - free(data_rd); - unity_send_signal("ready to delete"); - TEST_ESP_OK(i2c_driver_delete(I2C_SLAVE_NUM)); -} - -TEST_CASE_MULTIPLE_DEVICES("I2C master write slave test", "[i2c][test_env=UT_T2_I2C][timeout=150]", i2c_master_write_test, i2c_slave_read_test); - -static void master_read_slave_test(void) -{ - uint8_t *data_rd = (uint8_t *) malloc(DATA_LENGTH); - memset(data_rd, 0, DATA_LENGTH); - i2c_config_t conf_master = i2c_master_init(); - TEST_ESP_OK(i2c_param_config(I2C_MASTER_NUM, &conf_master)); - TEST_ESP_OK(i2c_driver_install(I2C_MASTER_NUM, I2C_MODE_MASTER, - I2C_MASTER_RX_BUF_DISABLE, - I2C_MASTER_TX_BUF_DISABLE, 0)); - unity_wait_for_signal("i2c slave init finish"); - - i2c_cmd_handle_t cmd = i2c_cmd_link_create(); - i2c_master_start(cmd); - i2c_master_write_byte(cmd, ( ESP_SLAVE_ADDR << 1 ) | READ_BIT, ACK_CHECK_EN); - - unity_send_signal("slave write"); - unity_wait_for_signal("master read"); - i2c_master_read(cmd, data_rd, RW_TEST_LENGTH-1, ACK_VAL); - i2c_master_read_byte(cmd, data_rd + RW_TEST_LENGTH-1, NACK_VAL); - i2c_master_stop(cmd); - i2c_master_cmd_begin(I2C_MASTER_NUM, cmd, 5000 / portTICK_RATE_MS); - i2c_cmd_link_delete(cmd); - vTaskDelay(100 / portTICK_RATE_MS); - for (int i = 0; i < RW_TEST_LENGTH; i++) { - printf("%d\n", data_rd[i]); - TEST_ASSERT(data_rd[i]==i); - } - free(data_rd); - unity_send_signal("ready to delete"); - i2c_driver_delete(I2C_MASTER_NUM); -} - -static void slave_write_buffer_test(void) -{ - uint8_t *data_wr = (uint8_t *) malloc(DATA_LENGTH); - int size_rd; - - i2c_config_t conf_slave = i2c_slave_init(); - TEST_ESP_OK(i2c_param_config( I2C_SLAVE_NUM, &conf_slave)); - TEST_ESP_OK(i2c_driver_install(I2C_SLAVE_NUM, I2C_MODE_SLAVE, - I2C_SLAVE_RX_BUF_LEN, - I2C_SLAVE_TX_BUF_LEN, 0)); - unity_send_signal("i2c slave init finish"); - - unity_wait_for_signal("slave write"); - for (int i = 0; i < DATA_LENGTH / 2; i++) { - data_wr[i] = i; - } - size_rd = i2c_slave_write_buffer(I2C_SLAVE_NUM, data_wr, RW_TEST_LENGTH, 2000 / portTICK_RATE_MS); - disp_buf(data_wr, size_rd); - unity_send_signal("master read"); - unity_wait_for_signal("ready to delete"); - free(data_wr); - i2c_driver_delete(I2C_SLAVE_NUM); -} - - -TEST_CASE_MULTIPLE_DEVICES("I2C master read slave test", "[i2c][test_env=UT_T2_I2C][timeout=150]", master_read_slave_test, slave_write_buffer_test); - -static void i2c_master_write_read_test(void) -{ - uint8_t *data_rd = (uint8_t *) malloc(DATA_LENGTH); - memset(data_rd, 0, DATA_LENGTH); - uint8_t *data_wr = (uint8_t *) malloc(DATA_LENGTH); - - i2c_config_t conf_master = i2c_master_init(); - TEST_ESP_OK(i2c_param_config(I2C_MASTER_NUM, &conf_master)); - TEST_ESP_OK(i2c_driver_install(I2C_MASTER_NUM, I2C_MODE_MASTER, - I2C_MASTER_RX_BUF_DISABLE, - I2C_MASTER_TX_BUF_DISABLE, 0)); - unity_wait_for_signal("i2c slave init finish"); - i2c_cmd_handle_t cmd = i2c_cmd_link_create(); - i2c_master_start(cmd); - i2c_master_write_byte(cmd, ( ESP_SLAVE_ADDR << 1 ) | READ_BIT, ACK_CHECK_EN); - - unity_send_signal("slave write"); - unity_wait_for_signal("master read and write"); - i2c_master_read(cmd, data_rd, RW_TEST_LENGTH, ACK_VAL); - i2c_master_read_byte(cmd, data_rd + RW_TEST_LENGTH, NACK_VAL); - i2c_master_stop(cmd); - i2c_master_cmd_begin(I2C_MASTER_NUM, cmd, 5000 / portTICK_RATE_MS); - i2c_cmd_link_delete(cmd); - vTaskDelay(100 / portTICK_RATE_MS); - disp_buf(data_rd, RW_TEST_LENGTH); - for (int i = 0; i < RW_TEST_LENGTH; i++) { - TEST_ASSERT(data_rd[i] == i/2); - } - - for (int i = 0; i < DATA_LENGTH; i++) { - data_wr[i] = i % 3; - } - - vTaskDelay(100 / portTICK_RATE_MS); - i2c_master_write_slave(I2C_MASTER_NUM, data_wr, RW_TEST_LENGTH); - free(data_wr); - free(data_rd); - unity_send_signal("slave read"); - unity_wait_for_signal("ready to delete"); - i2c_driver_delete(I2C_MASTER_NUM); -} - -static void i2c_slave_read_write_test(void) -{ - uint8_t *data_rd = (uint8_t *) malloc(DATA_LENGTH); - memset(data_rd, 0, DATA_LENGTH); - uint8_t *data_wr = (uint8_t *) malloc(DATA_LENGTH); - int size_rd; - - i2c_config_t conf_slave = i2c_slave_init(); - TEST_ESP_OK(i2c_param_config( I2C_SLAVE_NUM, &conf_slave)); - TEST_ESP_OK(i2c_driver_install(I2C_SLAVE_NUM, I2C_MODE_SLAVE, - I2C_SLAVE_RX_BUF_LEN, - I2C_SLAVE_TX_BUF_LEN, 0)); - unity_send_signal("i2c slave init finish"); - unity_wait_for_signal("slave write"); - - for (int i = 0; i < DATA_LENGTH / 2; i++) { - data_wr[i] = i/2; - } - size_rd = i2c_slave_write_buffer(I2C_SLAVE_NUM, data_wr, RW_TEST_LENGTH, 2000 / portTICK_RATE_MS); - disp_buf(data_wr, size_rd); - unity_send_signal("master read and write"); - unity_wait_for_signal("slave read"); - size_rd = i2c_slave_read_buffer( I2C_SLAVE_NUM, data_rd, RW_TEST_LENGTH, 1000 / portTICK_RATE_MS); - printf("slave read data is:\n"); - disp_buf(data_rd, size_rd); - for (int i = 0; i < RW_TEST_LENGTH; i++) { - TEST_ASSERT(data_rd[i] == i % 3); - } - free(data_wr); - free(data_rd); - unity_send_signal("ready to delete"); - i2c_driver_delete(I2C_SLAVE_NUM); -} - -TEST_CASE_MULTIPLE_DEVICES("I2C read and write test", "[i2c][test_env=UT_T2_I2C][timeout=150]", i2c_master_write_read_test, i2c_slave_read_write_test); - -static void i2c_master_repeat_write(void) -{ - uint8_t *data_wr = (uint8_t *) malloc(DATA_LENGTH); - int times = 3; - - i2c_config_t conf_master = i2c_master_init(); - TEST_ESP_OK(i2c_param_config(I2C_MASTER_NUM, &conf_master)); - - TEST_ESP_OK(i2c_driver_install(I2C_MASTER_NUM, I2C_MODE_MASTER, - I2C_MASTER_RX_BUF_DISABLE, - I2C_MASTER_TX_BUF_DISABLE, 0)); - unity_wait_for_signal("i2c slave init finish"); - - for (int j = 0; j < times; j++) { - for (int i = 0; i < DATA_LENGTH; i++) { - data_wr[i] = j + i; - } - i2c_master_write_slave(I2C_MASTER_NUM, data_wr, RW_TEST_LENGTH); - disp_buf(data_wr, RW_TEST_LENGTH); - } - free(data_wr); - unity_send_signal("master write"); - unity_wait_for_signal("ready to delete"); - i2c_driver_delete(I2C_MASTER_NUM); -} - -static void i2c_slave_repeat_read(void) -{ - int size_rd = 0; - int times = 3; - uint8_t *data_rd = (uint8_t *) malloc(DATA_LENGTH * 3); - - i2c_config_t conf_slave = i2c_slave_init(); - TEST_ESP_OK(i2c_param_config( I2C_SLAVE_NUM, &conf_slave)); - TEST_ESP_OK(i2c_driver_install(I2C_SLAVE_NUM, I2C_MODE_SLAVE, - I2C_SLAVE_RX_BUF_LEN, - I2C_SLAVE_TX_BUF_LEN, 0)); - unity_send_signal("i2c slave init finish"); - unity_wait_for_signal("master write"); - - while (1) { - int len = i2c_slave_read_buffer( I2C_SLAVE_NUM, data_rd + size_rd, RW_TEST_LENGTH * 3, 10000 / portTICK_RATE_MS); - if (len == 0) { - break; - } - size_rd += len; - } - disp_buf(data_rd, size_rd); - for (int j = 0; j < times; j++) { - for (int i = 0; i < RW_TEST_LENGTH; i++) { - printf("data: %d, %d\n", data_rd[j * RW_TEST_LENGTH + i], (i % 129 + j)); - TEST_ASSERT(data_rd[j * RW_TEST_LENGTH + i] == (i % 129 + j)); - } - } - free(data_rd); - unity_send_signal("ready to delete"); - i2c_driver_delete(I2C_SLAVE_NUM); -} - -TEST_CASE_MULTIPLE_DEVICES("I2C repeat write test", "[i2c][test_env=UT_T2_I2C][timeout=150]", i2c_master_repeat_write, i2c_slave_repeat_read); - static volatile bool exit_flag; static bool test_read_func; diff --git a/components/driver/test/test_sdmmc_sdspi_init.cpp b/components/driver/test/test_sdmmc_sdspi_init.cpp index d2406f582c..b6bedecdb8 100644 --- a/components/driver/test/test_sdmmc_sdspi_init.cpp +++ b/components/driver/test/test_sdmmc_sdspi_init.cpp @@ -1,4 +1,9 @@ +#include "soc/soc_caps.h" + +#if SOC_SDMMC_HOST_SUPPORTED #include "driver/sdmmc_host.h" +#endif + #include "driver/sdspi_host.h" @@ -9,10 +14,12 @@ static void test_initializers() __attribute__((unused)); static void test_initializers() { +#if SOC_SDMMC_HOST_SUPPORTED sdmmc_host_t sdmmc_host = SDMMC_HOST_DEFAULT(); (void) sdmmc_host; sdmmc_slot_config_t sdmmc_slot = SDMMC_SLOT_CONFIG_DEFAULT(); (void) sdmmc_slot; +#endif sdmmc_host_t sdspi_host = SDSPI_HOST_DEFAULT(); (void) sdspi_host; sdspi_slot_config_t sdspi_slot = SDSPI_SLOT_CONFIG_DEFAULT(); diff --git a/components/driver/test/test_uart.c b/components/driver/test/test_uart.c index 0196044032..3283b9f6f0 100644 --- a/components/driver/test/test_uart.c +++ b/components/driver/test/test_uart.c @@ -26,83 +26,6 @@ // Wait timeout for uart driver #define PACKET_READ_TICS (1000 / portTICK_RATE_MS) -// The table for fast CRC16 calculation -static const uint8_t crc_hi[] = { - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, - 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, - 0x40, 0x01, 0xC0, - 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, - 0x81, 0x40, 0x01, - 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, - 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, - 0x00, 0xC1, 0x81, - 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, - 0x41, 0x01, 0xC0, - 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, - 0x80, 0x41, 0x01, - 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, - 0xC1, 0x81, 0x40, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, - 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, - 0x40, 0x01, 0xC0, - 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, - 0x81, 0x40, 0x01, - 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, - 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, - 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, - 0x40, 0x01, 0xC0, - 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, - 0x80, 0x41, 0x01, - 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, - 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, - 0x40 -}; - -static const uint8_t crc_low[] = { - 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, 0x07, 0xC7, - 0x05, 0xC5, 0xC4, - 0x04, 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, - 0x0B, 0xC9, 0x09, - 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A, 0x1E, 0xDE, - 0xDF, 0x1F, 0xDD, - 0x1D, 0x1C, 0xDC, 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, - 0x12, 0x13, 0xD3, - 0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32, - 0x36, 0xF6, 0xF7, - 0x37, 0xF5, 0x35, 0x34, 0xF4, 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, - 0xFE, 0xFA, 0x3A, - 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, - 0x2A, 0xEA, 0xEE, - 0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, - 0xE7, 0xE6, 0x26, - 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, 0x61, 0xA1, - 0x63, 0xA3, 0xA2, - 0x62, 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4, 0x6C, 0xAC, 0xAD, - 0x6D, 0xAF, 0x6F, - 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68, 0x78, 0xB8, - 0xB9, 0x79, 0xBB, - 0x7B, 0x7A, 0xBA, 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, - 0x74, 0x75, 0xB5, - 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0, - 0x50, 0x90, 0x91, - 0x51, 0x93, 0x53, 0x52, 0x92, 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, - 0x54, 0x9C, 0x5C, - 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, - 0x58, 0x98, 0x88, - 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, - 0x4D, 0x4C, 0x8C, - 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, 0x43, 0x83, - 0x41, 0x81, 0x80, - 0x40 -}; - static void uart_config(uint32_t baud_rate, bool use_ref_tick) { uart_config_t uart_config = { @@ -203,177 +126,3 @@ TEST_CASE("test uart tx data with break", "[uart]") free(psend); uart_driver_delete(UART_NUM1); } - -// Calculate buffer checksum using tables -// The checksum CRC16 algorithm is specific -// for Modbus standard and uses polynomial value = 0xA001 -static uint16_t get_buffer_crc16( uint8_t * frame_ptr, uint16_t length ) -{ - TEST_ASSERT( frame_ptr != NULL); - - uint8_t crc_hi_byte = 0xFF; - uint8_t crc_low_byte = 0xFF; - int index; - - while ( length-- ) - { - index = crc_low_byte ^ *(frame_ptr++); - crc_low_byte = crc_hi_byte ^ crc_hi[index]; - crc_hi_byte = crc_low[index]; - } - return ((crc_hi_byte << 8) | crc_low_byte); -} - -// Fill the buffer with random numbers and apply CRC16 at the end -static uint16_t buffer_fill_random(uint8_t *buffer, size_t length) -{ - TEST_ASSERT( buffer != NULL); - // Packet is too short - if (length < 4) { - return 0; - } - for (int i = 0; i < length; i += 4) { - uint32_t random = esp_random(); - memcpy(buffer + i, &random, MIN(length - i, 4)); - } - // Get checksum of the buffer - uint16_t crc = get_buffer_crc16((uint8_t*)buffer, (length - 2)); - // Apply checksum bytes into packet - buffer[length - 2] = (uint8_t)(crc & 0xFF); // Set Low byte CRC - buffer[length - 1] = (uint8_t)(crc >> 8); // Set High byte CRC - return crc; -} - -static void rs485_init(void) -{ - uart_config_t uart_config = { - .baud_rate = UART_BAUD_115200, - .data_bits = UART_DATA_8_BITS, - .parity = UART_PARITY_DISABLE, - .stop_bits = UART_STOP_BITS_1, - .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, - .rx_flow_ctrl_thresh = 122, - }; - printf("RS485 port initialization...\r\n"); - // Configure UART1 parameters - uart_param_config(UART_NUM1, &uart_config); - // Set UART1 pins(TX: IO4, RX: I05, RTS: IO18, CTS: IO19) - uart_set_pin(UART_NUM1, UART1_TX_PIN, UART1_RX_PIN, UART1_RTS_PIN, UART_PIN_NO_CHANGE); - // Install UART driver (we don't need an event queue here) - uart_driver_install(UART_NUM1, BUF_SIZE * 2, 0, 0, NULL, 0); - // Setup rs485 half duplex mode - //uart_set_rs485_hd_mode(uart_num, true); - uart_set_mode(UART_NUM1, UART_MODE_RS485_HALF_DUPLEX); -} - -static esp_err_t print_packet_data(const char *str, uint8_t *buffer, uint16_t buffer_size) -{ - TEST_ASSERT( buffer != NULL); - TEST_ASSERT( str != NULL); - - // Calculate the checksum of the buffer - uint16_t crc16_calc = get_buffer_crc16(buffer, (buffer_size - 2)); - uint16_t crc16_in = ((uint16_t)(buffer[buffer_size - 1]) << 8) | buffer[buffer_size - 2]; - const char* state_str = (crc16_in != crc16_calc) ? "incorrect " : "correct "; - // Print an array of data - printf("%s%s RS485 packet = [ ", str, state_str); - for (int i = 0; i < buffer_size; i++) { - printf("0x%.2X ", (uint8_t)buffer[i]); - } - printf(" ]\r\n"); - printf("crc_in = 0x%.4X\r\n", (uint16_t)crc16_in); - printf("crc_calc = 0x%.4X\r\n", (uint16_t)crc16_calc); - esp_err_t result = (crc16_in != crc16_calc) ? ESP_ERR_INVALID_CRC : ESP_OK; - return result; -} - -// Slave test case for multi device -static void rs485_slave(void) -{ - rs485_init(); - uint8_t* slave_data = (uint8_t*) malloc(BUF_SIZE); - uint16_t err_count = 0, good_count = 0; - printf("Start recieve loop.\r\n"); - unity_send_signal("Slave_ready"); - unity_wait_for_signal("Master_started"); - for(int pack_count = 0; pack_count < PACKETS_NUMBER; pack_count++) { - //Read slave_data from UART - int len = uart_read_bytes(UART_NUM1, slave_data, BUF_SIZE, (PACKET_READ_TICS * 2)); - //Write slave_data back to UART - if (len > 2) { - esp_err_t status = print_packet_data("Received ", slave_data, len); - - // If received packet is correct then send it back - if (status == ESP_OK) { - uart_write_bytes(UART_NUM1, (char*)slave_data, len); - good_count++; - } else { - printf("Incorrect packet received.\r\n"); - err_count++; - } - } else { - printf("Incorrect data packet[%d] received.\r\n", pack_count); - err_count++; - } - } - printf("Test completed. Received packets = %d, errors = %d\r\n", good_count, err_count); - // Wait for packet to be sent - uart_wait_tx_done(UART_NUM1, PACKET_READ_TICS); - free(slave_data); - uart_driver_delete(UART_NUM1); - TEST_ASSERT(err_count < 2); -} - -// Master test of multi device test case. -// It forms packet with random data, apply generated CRC16 and sends to slave. -// If response recieved correctly from slave means RS485 channel works. -static void rs485_master(void) -{ - uint16_t err_count = 0, good_count = 0; - rs485_init(); - uint8_t* master_buffer = (uint8_t*) malloc(BUF_SIZE); - uint8_t* slave_buffer = (uint8_t*) malloc(BUF_SIZE); - // The master test case should be synchronized with slave - unity_wait_for_signal("Slave_ready"); - unity_send_signal("Master_started"); - printf("Start recieve loop.\r\n"); - for(int i = 0; i < PACKETS_NUMBER; i++) { - // Form random buffer with CRC16 - buffer_fill_random(master_buffer, BUF_SIZE); - // Print created packet for debugging - esp_err_t status = print_packet_data("Send ", master_buffer, BUF_SIZE); - TEST_ASSERT(status == ESP_OK); - uart_write_bytes(UART_NUM1, (char*)master_buffer, BUF_SIZE); - // Read translated packet from slave - int len = uart_read_bytes(UART_NUM1, slave_buffer, BUF_SIZE, (PACKET_READ_TICS * 2)); - // Check if the received packet is too short - if (len > 2) { - // Print received packet and check checksum - esp_err_t status = print_packet_data("Received ", slave_buffer, len); - if (status == ESP_OK) { - good_count++; - printf("Received: %d\r\n", good_count); - } else { - err_count++; - printf("Errors: %d\r\n", err_count); - } - } - else { - printf("Incorrect answer from slave.\r\n"); - err_count++; - } - } - // Free the buffer and delete driver at the end - free(master_buffer); - uart_driver_delete(UART_NUM1); - TEST_ASSERT(err_count <= 1); - printf("Test completed. Received packets = %d, errors = %d\r\n", (uint16_t)good_count, (uint16_t)err_count); -} - -/* - * This multi devices test case verifies RS485 mode of the uart driver and checks - * correctness of RS485 interface channel communication. It requires - * RS485 bus driver hardware to be connected to boards. -*/ -TEST_CASE_MULTIPLE_DEVICES("RS485 half duplex uart multiple devices test.", "[driver_RS485][test_env=UT_T2_RS485]", rs485_master, rs485_slave); - diff --git a/components/driver/timer.c b/components/driver/timer.c index 67f0fffb32..b69a70a278 100644 --- a/components/driver/timer.c +++ b/components/driver/timer.c @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// 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. @@ -20,6 +20,7 @@ #include "driver/timer.h" #include "driver/periph_ctrl.h" #include "hal/timer_ll.h" +#include "soc/rtc.h" static const char* TIMER_TAG = "timer_group"; #define TIMER_CHECK(a, str, ret_val) \ @@ -48,7 +49,11 @@ esp_err_t timer_get_counter_value(timer_group_t group_num, timer_idx_t timer_num TIMER_CHECK(timer_num < TIMER_MAX, TIMER_NUM_ERROR, ESP_ERR_INVALID_ARG); TIMER_CHECK(timer_val != NULL, TIMER_PARAM_ADDR_ERROR, ESP_ERR_INVALID_ARG); portENTER_CRITICAL_SAFE(&timer_spinlock[group_num]); +#ifdef CONFIG_IDF_TARGET_ESP32 TG[group_num]->hw_timer[timer_num].update = 1; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + TG[group_num]->hw_timer[timer_num].update.update = 1; +#endif *timer_val = ((uint64_t) TG[group_num]->hw_timer[timer_num].cnt_high << 32) | (TG[group_num]->hw_timer[timer_num].cnt_low); portEXIT_CRITICAL_SAFE(&timer_spinlock[group_num]); @@ -65,7 +70,15 @@ esp_err_t timer_get_counter_time_sec(timer_group_t group_num, timer_idx_t timer_ esp_err_t err = timer_get_counter_value(group_num, timer_num, &timer_val); if (err == ESP_OK) { uint16_t div = TG[group_num]->hw_timer[timer_num].config.divider; +#ifdef CONFIG_IDF_TARGET_ESP32 *time = (double)timer_val * div / TIMER_BASE_CLK; +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + if(TG[group_num]->hw_timer[timer_num].config.use_xtal) { + *time = (double)timer_val * div / ((int)rtc_clk_xtal_freq_get() * 1000000); + } else { + *time = (double)timer_val * div / rtc_clk_apb_freq_get(); + } +#endif } return err; } @@ -223,7 +236,11 @@ esp_err_t timer_init(timer_group_t group_num, timer_idx_t timer_num, const timer //but software reset does not clear interrupt status. This is not safe for application when enable the interrupt of timer_group. //we need to disable the interrupt and clear the interrupt status here. TG[group_num]->int_ena.val &= (~BIT(timer_num)); +#ifdef CONFIG_IDF_TARGET_ESP32 TG[group_num]->int_clr_timers.val = BIT(timer_num); +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + TG[group_num]->int_clr.val = BIT(timer_num); +#endif TG[group_num]->hw_timer[timer_num].config.autoreload = config->auto_reload; TG[group_num]->hw_timer[timer_num].config.divider = (uint16_t) config->divider; TG[group_num]->hw_timer[timer_num].config.enable = config->counter_en; @@ -231,6 +248,9 @@ esp_err_t timer_init(timer_group_t group_num, timer_idx_t timer_num, const timer TG[group_num]->hw_timer[timer_num].config.alarm_en = config->alarm_en; TG[group_num]->hw_timer[timer_num].config.level_int_en = (config->intr_type == TIMER_INTR_LEVEL ? 1 : 0); TG[group_num]->hw_timer[timer_num].config.edge_int_en = (config->intr_type == TIMER_INTR_LEVEL ? 0 : 1); +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA + TG[group_num]->hw_timer[timer_num].config.use_xtal = config->clk_sel; +#endif TIMER_EXIT_CRITICAL(&timer_spinlock[group_num]); return ESP_OK; } @@ -327,3 +347,4 @@ bool IRAM_ATTR timer_group_get_auto_reload_in_isr(timer_group_t group_num, timer { return timer_ll_get_auto_reload(TG[group_num], timer_num); } + diff --git a/components/driver/uart.c b/components/driver/uart.c index cb58057d7d..99b34845d9 100644 --- a/components/driver/uart.c +++ b/components/driver/uart.c @@ -17,7 +17,6 @@ #include "esp_intr_alloc.h" #include "esp_log.h" #include "esp_err.h" -#include "esp32/clk.h" #include "malloc.h" #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" @@ -30,18 +29,24 @@ #include "driver/uart_select.h" #include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/clk.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/clk.h" +#endif + +#define UART_NUM SOC_UART_NUM + #ifdef CONFIG_UART_ISR_IN_IRAM #define UART_ISR_ATTR IRAM_ATTR #else #define UART_ISR_ATTR #endif -#define UART_NUM SOC_UART_NUM - #define XOFF (char)0x13 #define XON (char)0x11 -static const char* UART_TAG = "uart"; +static const char *UART_TAG = "uart"; #define UART_CHECK(a, str, ret_val) \ if (!(a)) { \ ESP_LOGE(UART_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ @@ -78,7 +83,7 @@ typedef struct { int wr; int rd; int len; - int* data; + int *data; } uart_pat_rb_t; typedef struct { @@ -96,8 +101,8 @@ typedef struct { RingbufHandle_t rx_ring_buf; /*!< RX ring buffer handler*/ bool rx_buffer_full_flg; /*!< RX ring buffer full flag. */ int rx_cur_remain; /*!< Data number that waiting to be read out in ring buffer item*/ - uint8_t* rx_ptr; /*!< pointer to the current data in ring buffer*/ - uint8_t* rx_head_ptr; /*!< pointer to the head of RX item*/ + uint8_t *rx_ptr; /*!< pointer to the current data in ring buffer*/ + uint8_t *rx_head_ptr; /*!< pointer to the head of RX item*/ uint8_t rx_data_buf[UART_FIFO_LEN]; /*!< Data buffer to stash FIFO data*/ uint8_t rx_stash_len; /*!< stashed data length.(When using flow control, after reading out FIFO data, if we fail to push to buffer, we can just stash them.) */ uart_pat_rb_t rx_pattern_pos; @@ -110,8 +115,8 @@ typedef struct { int tx_buf_size; /*!< TX ring buffer size */ RingbufHandle_t tx_ring_buf; /*!< TX ring buffer handler*/ bool tx_waiting_fifo; /*!< this flag indicates that some task is waiting for FIFO empty interrupt, used to send all data without any data buffer*/ - uint8_t* tx_ptr; /*!< TX data pointer to push to FIFO in TX buffer mode*/ - uart_tx_data_t* tx_head; /*!< TX data pointer to head of the current buffer in TX ring buffer*/ + uint8_t *tx_ptr; /*!< TX data pointer to push to FIFO in TX buffer mode*/ + uart_tx_data_t *tx_head; /*!< TX data pointer to head of the current buffer in TX ring buffer*/ uint32_t tx_len_tot; /*!< Total length of current item in ring buffer*/ uint32_t tx_len_cur; uint8_t tx_brk_flg; /*!< Flag to indicate to send a break signal in the end of the item sending procedure */ @@ -122,7 +127,7 @@ typedef struct { static uart_obj_t *p_uart_obj[UART_NUM_MAX] = {0}; /* DRAM_ATTR is required to avoid UART array placed in flash, due to accessed from ISR */ -static DRAM_ATTR uart_dev_t* const UART[UART_NUM_MAX] = { +static DRAM_ATTR uart_dev_t *const UART[UART_NUM_MAX] = { &UART0, &UART1, #if UART_NUM > 2 @@ -148,7 +153,7 @@ esp_err_t uart_set_word_length(uart_port_t uart_num, uart_word_length_t data_bit return ESP_OK; } -esp_err_t uart_get_word_length(uart_port_t uart_num, uart_word_length_t* data_bit) +esp_err_t uart_get_word_length(uart_port_t uart_num, uart_word_length_t *data_bit) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); *(data_bit) = UART[uart_num]->conf0.bit_num; @@ -173,15 +178,19 @@ esp_err_t uart_set_stop_bits(uart_port_t uart_num, uart_stop_bits_t stop_bit) return ESP_OK; } -esp_err_t uart_get_stop_bits(uart_port_t uart_num, uart_stop_bits_t* stop_bit) +esp_err_t uart_get_stop_bits(uart_port_t uart_num, uart_stop_bits_t *stop_bit) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); +#if CONFIG_IDF_TARGET_ESP32 //workaround for hardware bug, when uart stop bit set as 2-bit mode. if (UART[uart_num]->rs485_conf.dl1_en == 1 && UART[uart_num]->conf0.stop_bit_num == UART_STOP_BITS_1) { (*stop_bit) = UART_STOP_BITS_2; } else { (*stop_bit) = UART[uart_num]->conf0.stop_bit_num; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + (*stop_bit) = UART[uart_num]->conf0.stop_bit_num; +#endif return ESP_OK; } @@ -195,12 +204,12 @@ esp_err_t uart_set_parity(uart_port_t uart_num, uart_parity_t parity_mode) return ESP_OK; } -esp_err_t uart_get_parity(uart_port_t uart_num, uart_parity_t* parity_mode) +esp_err_t uart_get_parity(uart_port_t uart_num, uart_parity_t *parity_mode) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); int val = UART[uart_num]->conf0.val; - if(val & UART_PARITY_EN_M) { - if(val & UART_PARITY_M) { + if (val & UART_PARITY_EN_M) { + if (val & UART_PARITY_M) { (*parity_mode) = UART_PARITY_ODD; } else { (*parity_mode) = UART_PARITY_EVEN; @@ -235,14 +244,14 @@ esp_err_t uart_set_baudrate(uart_port_t uart_num, uint32_t baud_rate) return ret; } -esp_err_t uart_get_baudrate(uart_port_t uart_num, uint32_t* baudrate) +esp_err_t uart_get_baudrate(uart_port_t uart_num, uint32_t *baudrate) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); uint32_t clk_div = (UART[uart_num]->clk_div.div_int << 4) | UART[uart_num]->clk_div.div_frag; UART_EXIT_CRITICAL(&uart_spinlock[uart_num]); uint32_t uart_clk_freq = esp_clk_apb_freq(); - if(UART[uart_num]->conf0.tick_ref_always_on == 0) { + if (UART[uart_num]->conf0.tick_ref_always_on == 0) { uart_clk_freq = REF_CLK_FREQ; } (*baudrate) = ((uart_clk_freq) << 4) / clk_div; @@ -266,12 +275,19 @@ esp_err_t uart_set_sw_flow_ctrl(uart_port_t uart_num, bool enable, uint8_t rx_t UART_CHECK((rx_thresh_xon < UART_FIFO_LEN), "rx flow xon thresh error", ESP_FAIL); UART_CHECK((rx_thresh_xoff < UART_FIFO_LEN), "rx flow xon thresh error", ESP_FAIL); UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); - UART[uart_num]->flow_conf.sw_flow_con_en = enable? 1:0; - UART[uart_num]->flow_conf.xonoff_del = enable?1:0; + UART[uart_num]->flow_conf.sw_flow_con_en = enable ? 1 : 0; + UART[uart_num]->flow_conf.xonoff_del = enable ? 1 : 0; +#if CONFIG_IDF_TARGET_ESP32 UART[uart_num]->swfc_conf.xon_threshold = rx_thresh_xon; UART[uart_num]->swfc_conf.xoff_threshold = rx_thresh_xoff; UART[uart_num]->swfc_conf.xon_char = XON; UART[uart_num]->swfc_conf.xoff_char = XOFF; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + UART[uart_num]->swfc_conf1.xon_threshold = rx_thresh_xon; + UART[uart_num]->swfc_conf0.xoff_threshold = rx_thresh_xoff; + UART[uart_num]->swfc_conf1.xon_char = XON; + UART[uart_num]->swfc_conf0.xoff_char = XOFF; +#endif UART_EXIT_CRITICAL(&uart_spinlock[uart_num]); return ESP_OK; } @@ -283,13 +299,17 @@ esp_err_t uart_set_hw_flow_ctrl(uart_port_t uart_num, uart_hw_flowcontrol_t flow UART_CHECK((rx_thresh < UART_FIFO_LEN), "rx flow thresh error", ESP_FAIL); UART_CHECK((flow_ctrl < UART_HW_FLOWCTRL_MAX), "hw_flowctrl mode error", ESP_FAIL); UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); - if(flow_ctrl & UART_HW_FLOWCTRL_RTS) { + if (flow_ctrl & UART_HW_FLOWCTRL_RTS) { +#if CONFIG_IDF_TARGET_ESP32 UART[uart_num]->conf1.rx_flow_thrhd = rx_thresh; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + UART[uart_num]->mem_conf.rx_flow_thrhd = rx_thresh; +#endif UART[uart_num]->conf1.rx_flow_en = 1; } else { UART[uart_num]->conf1.rx_flow_en = 0; } - if(flow_ctrl & UART_HW_FLOWCTRL_CTS) { + if (flow_ctrl & UART_HW_FLOWCTRL_CTS) { UART[uart_num]->conf0.tx_flow_en = 1; } else { UART[uart_num]->conf0.tx_flow_en = 0; @@ -298,14 +318,14 @@ esp_err_t uart_set_hw_flow_ctrl(uart_port_t uart_num, uart_hw_flowcontrol_t flow return ESP_OK; } -esp_err_t uart_get_hw_flow_ctrl(uart_port_t uart_num, uart_hw_flowcontrol_t* flow_ctrl) +esp_err_t uart_get_hw_flow_ctrl(uart_port_t uart_num, uart_hw_flowcontrol_t *flow_ctrl) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); uart_hw_flowcontrol_t val = UART_HW_FLOWCTRL_DISABLE; - if(UART[uart_num]->conf1.rx_flow_en) { + if (UART[uart_num]->conf1.rx_flow_en) { val |= UART_HW_FLOWCTRL_RTS; } - if(UART[uart_num]->conf0.tx_flow_en) { + if (UART[uart_num]->conf0.tx_flow_en) { val |= UART_HW_FLOWCTRL_CTS; } (*flow_ctrl) = val; @@ -315,13 +335,18 @@ esp_err_t uart_get_hw_flow_ctrl(uart_port_t uart_num, uart_hw_flowcontrol_t* flo static esp_err_t UART_ISR_ATTR uart_reset_rx_fifo(uart_port_t uart_num) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); +#if CONFIG_IDF_TARGET_ESP32 //Due to hardware issue, we can not use fifo_rst to reset uart fifo. //See description about UART_TXFIFO_RST and UART_RXFIFO_RST in <> v2.6 or later. // we read the data out and make `fifo_len == 0 && rd_addr == wr_addr`. - while(UART[uart_num]->status.rxfifo_cnt != 0 || (UART[uart_num]->mem_rx_status.wr_addr != UART[uart_num]->mem_rx_status.rd_addr)) { + while (UART[uart_num]->status.rxfifo_cnt != 0 || (UART[uart_num]->mem_rx_status.wr_addr != UART[uart_num]->mem_rx_status.rd_addr)) { READ_PERI_REG(UART_FIFO_REG(uart_num)); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + UART[uart_num]->conf0.rxfifo_rst = 1; + UART[uart_num]->conf0.rxfifo_rst = 0; +#endif return ESP_OK; } @@ -371,7 +396,7 @@ static esp_err_t uart_pattern_link_free(uart_port_t uart_num) { UART_CHECK((p_uart_obj[uart_num]), "uart driver error", ESP_FAIL); if (p_uart_obj[uart_num]->rx_pattern_pos.data != NULL) { - int* pdata = p_uart_obj[uart_num]->rx_pattern_pos.data; + int *pdata = p_uart_obj[uart_num]->rx_pattern_pos.data; UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); p_uart_obj[uart_num]->rx_pattern_pos.data = NULL; p_uart_obj[uart_num]->rx_pattern_pos.wr = 0; @@ -387,7 +412,7 @@ static esp_err_t UART_ISR_ATTR uart_pattern_enqueue(uart_port_t uart_num, int po UART_CHECK((p_uart_obj[uart_num]), "uart driver error", ESP_FAIL); esp_err_t ret = ESP_OK; UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); - uart_pat_rb_t* p_pos = &p_uart_obj[uart_num]->rx_pattern_pos; + uart_pat_rb_t *p_pos = &p_uart_obj[uart_num]->rx_pattern_pos; int next = p_pos->wr + 1; if (next >= p_pos->len) { next = 0; @@ -407,12 +432,12 @@ static esp_err_t UART_ISR_ATTR uart_pattern_enqueue(uart_port_t uart_num, int po static esp_err_t uart_pattern_dequeue(uart_port_t uart_num) { UART_CHECK((p_uart_obj[uart_num]), "uart driver error", ESP_FAIL); - if(p_uart_obj[uart_num]->rx_pattern_pos.data == NULL) { + if (p_uart_obj[uart_num]->rx_pattern_pos.data == NULL) { return ESP_ERR_INVALID_STATE; } else { esp_err_t ret = ESP_OK; UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); - uart_pat_rb_t* p_pos = &p_uart_obj[uart_num]->rx_pattern_pos; + uart_pat_rb_t *p_pos = &p_uart_obj[uart_num]->rx_pattern_pos; if (p_pos->rd == p_pos->wr) { ret = ESP_FAIL; } else { @@ -430,9 +455,9 @@ static esp_err_t uart_pattern_queue_update(uart_port_t uart_num, int diff_len) { UART_CHECK((p_uart_obj[uart_num]), "uart driver error", ESP_FAIL); UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); - uart_pat_rb_t* p_pos = &p_uart_obj[uart_num]->rx_pattern_pos; + uart_pat_rb_t *p_pos = &p_uart_obj[uart_num]->rx_pattern_pos; int rd = p_pos->rd; - while(rd != p_pos->wr) { + while (rd != p_pos->wr) { p_pos->data[rd] -= diff_len; int rd_rec = rd; rd ++; @@ -451,7 +476,7 @@ int uart_pattern_pop_pos(uart_port_t uart_num) { UART_CHECK((p_uart_obj[uart_num]), "uart driver error", (-1)); UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); - uart_pat_rb_t* pat_pos = &p_uart_obj[uart_num]->rx_pattern_pos; + uart_pat_rb_t *pat_pos = &p_uart_obj[uart_num]->rx_pattern_pos; int pos = -1; if (pat_pos != NULL && pat_pos->rd != pat_pos->wr) { pos = pat_pos->data[pat_pos->rd]; @@ -465,7 +490,7 @@ int uart_pattern_get_pos(uart_port_t uart_num) { UART_CHECK((p_uart_obj[uart_num]), "uart driver error", (-1)); UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); - uart_pat_rb_t* pat_pos = &p_uart_obj[uart_num]->rx_pattern_pos; + uart_pat_rb_t *pat_pos = &p_uart_obj[uart_num]->rx_pattern_pos; int pos = -1; if (pat_pos != NULL && pat_pos->rd != pat_pos->wr) { pos = pat_pos->data[pat_pos->rd]; @@ -479,12 +504,12 @@ esp_err_t uart_pattern_queue_reset(uart_port_t uart_num, int queue_length) UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); UART_CHECK((p_uart_obj[uart_num]), "uart driver error", ESP_ERR_INVALID_STATE); - int* pdata = (int*) malloc(queue_length * sizeof(int)); - if(pdata == NULL) { + int *pdata = (int *) malloc(queue_length * sizeof(int)); + if (pdata == NULL) { return ESP_ERR_NO_MEM; } UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); - int* ptmp = p_uart_obj[uart_num]->rx_pattern_pos.data; + int *ptmp = p_uart_obj[uart_num]->rx_pattern_pos.data; p_uart_obj[uart_num]->rx_pattern_pos.data = pdata; p_uart_obj[uart_num]->rx_pattern_pos.len = queue_length; p_uart_obj[uart_num]->rx_pattern_pos.rd = 0; @@ -494,8 +519,10 @@ esp_err_t uart_pattern_queue_reset(uart_port_t uart_num, int queue_length) return ESP_OK; } +#if CONFIG_IDF_TARGET_ESP32 esp_err_t uart_enable_pattern_det_intr(uart_port_t uart_num, char pattern_chr, uint8_t chr_num, int chr_tout, int post_idle, int pre_idle) { + //This function is deprecated, please use uart_enable_pattern_det_baud_intr instead. UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); UART_CHECK(chr_tout >= 0 && chr_tout <= UART_RX_GAP_TOUT_V, "uart pattern set error\n", ESP_FAIL); UART_CHECK(post_idle >= 0 && post_idle <= UART_POST_IDLE_NUM_V, "uart pattern set error\n", ESP_FAIL); @@ -507,6 +534,37 @@ esp_err_t uart_enable_pattern_det_intr(uart_port_t uart_num, char pattern_chr, u UART[uart_num]->at_cmd_precnt.pre_idle_num = pre_idle; return uart_enable_intr_mask(uart_num, UART_AT_CMD_CHAR_DET_INT_ENA_M); } +#endif + +esp_err_t uart_enable_pattern_det_baud_intr(uart_port_t uart_num, char pattern_chr, uint8_t chr_num, int chr_tout, int post_idle, int pre_idle) +{ + UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); + UART_CHECK(chr_tout >= 0 && chr_tout <= UART_RX_GAP_TOUT_V, "uart pattern set error\n", ESP_FAIL); + UART_CHECK(post_idle >= 0 && post_idle <= UART_POST_IDLE_NUM_V, "uart pattern set error\n", ESP_FAIL); + UART_CHECK(pre_idle >= 0 && pre_idle <= UART_PRE_IDLE_NUM_V, "uart pattern set error\n", ESP_FAIL); + UART[uart_num]->at_cmd_char.data = pattern_chr; + UART[uart_num]->at_cmd_char.char_num = chr_num; + +#if CONFIG_IDF_TARGET_ESP32 + int apb_clk_freq = 0; + uint32_t uart_baud = 0; + uint32_t uart_div = 0; + + uart_get_baudrate(uart_num, &uart_baud); + apb_clk_freq = esp_clk_apb_freq(); + uart_div = apb_clk_freq / uart_baud; + + UART[uart_num]->at_cmd_gaptout.rx_gap_tout = chr_tout * uart_div; + UART[uart_num]->at_cmd_postcnt.post_idle_num = post_idle * uart_div; + UART[uart_num]->at_cmd_precnt.pre_idle_num = pre_idle * uart_div; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + UART[uart_num]->at_cmd_gaptout.rx_gap_tout = chr_tout; + UART[uart_num]->at_cmd_postcnt.post_idle_num = post_idle; + UART[uart_num]->at_cmd_precnt.pre_idle_num = pre_idle; +#endif + + return uart_enable_intr_mask(uart_num, UART_AT_CMD_CHAR_DET_INT_ENA_M); +} esp_err_t uart_disable_pattern_det_intr(uart_port_t uart_num) { @@ -515,12 +573,12 @@ esp_err_t uart_disable_pattern_det_intr(uart_port_t uart_num) esp_err_t uart_enable_rx_intr(uart_port_t uart_num) { - return uart_enable_intr_mask(uart_num, UART_RXFIFO_FULL_INT_ENA|UART_RXFIFO_TOUT_INT_ENA); + return uart_enable_intr_mask(uart_num, UART_RXFIFO_FULL_INT_ENA | UART_RXFIFO_TOUT_INT_ENA); } esp_err_t uart_disable_rx_intr(uart_port_t uart_num) { - return uart_disable_intr_mask(uart_num, UART_RXFIFO_FULL_INT_ENA|UART_RXFIFO_TOUT_INT_ENA); + return uart_disable_intr_mask(uart_num, UART_RXFIFO_FULL_INT_ENA | UART_RXFIFO_TOUT_INT_ENA); } esp_err_t uart_disable_tx_intr(uart_port_t uart_num) @@ -540,7 +598,7 @@ esp_err_t uart_enable_tx_intr(uart_port_t uart_num, int enable, int thresh) return ESP_OK; } -esp_err_t uart_isr_register(uart_port_t uart_num, void (*fn)(void*), void * arg, int intr_alloc_flags, uart_isr_handle_t *handle) +esp_err_t uart_isr_register(uart_port_t uart_num, void (*fn)(void *), void *arg, int intr_alloc_flags, uart_isr_handle_t *handle) { int ret; UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); @@ -568,10 +626,12 @@ esp_err_t uart_isr_free(uart_port_t uart_num) { esp_err_t ret; UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); - if (p_uart_obj[uart_num]->intr_handle==NULL) return ESP_ERR_INVALID_ARG; + if (p_uart_obj[uart_num]->intr_handle == NULL) { + return ESP_ERR_INVALID_ARG; + } UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); - ret=esp_intr_free(p_uart_obj[uart_num]->intr_handle); - p_uart_obj[uart_num]->intr_handle=NULL; + ret = esp_intr_free(p_uart_obj[uart_num]->intr_handle); + p_uart_obj[uart_num]->intr_handle = NULL; UART_EXIT_CRITICAL(&uart_spinlock[uart_num]); return ret; } @@ -616,24 +676,24 @@ esp_err_t uart_set_pin(uart_port_t uart_num, int tx_io_num, int rx_io_num, int r cts_sig = U0CTS_IN_IDX; break; } - if(tx_io_num >= 0) { + if (tx_io_num >= 0) { PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[tx_io_num], PIN_FUNC_GPIO); gpio_set_level(tx_io_num, 1); gpio_matrix_out(tx_io_num, tx_sig, 0, 0); } - if(rx_io_num >= 0) { + if (rx_io_num >= 0) { PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[rx_io_num], PIN_FUNC_GPIO); gpio_set_pull_mode(rx_io_num, GPIO_PULLUP_ONLY); gpio_set_direction(rx_io_num, GPIO_MODE_INPUT); gpio_matrix_in(rx_io_num, rx_sig, 0); } - if(rts_io_num >= 0) { + if (rts_io_num >= 0) { PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[rts_io_num], PIN_FUNC_GPIO); gpio_set_direction(rts_io_num, GPIO_MODE_OUTPUT); gpio_matrix_out(rts_io_num, rts_sig, 0, 0); } - if(cts_io_num >= 0) { + if (cts_io_num >= 0) { PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[cts_io_num], PIN_FUNC_GPIO); gpio_set_pull_mode(cts_io_num, GPIO_PULLUP_ONLY); gpio_set_direction(cts_io_num, GPIO_MODE_INPUT); @@ -702,18 +762,24 @@ esp_err_t uart_param_config(uart_port_t uart_num, const uart_config_t *uart_conf } periph_module_enable(periph_module); r = uart_set_hw_flow_ctrl(uart_num, uart_config->flow_ctrl, uart_config->rx_flow_ctrl_thresh); - if (r != ESP_OK) return r; + if (r != ESP_OK) { + return r; + } UART[uart_num]->conf0.val = - (uart_config->parity << UART_PARITY_S) + (uart_config->parity << UART_PARITY_S) | (uart_config->data_bits << UART_BIT_NUM_S) | ((uart_config->flow_ctrl & UART_HW_FLOWCTRL_CTS) ? UART_TX_FLOW_EN : 0x0) | (uart_config->use_ref_tick ? 0 : UART_TICK_REF_ALWAYS_ON_M); r = uart_set_baudrate(uart_num, uart_config->baud_rate); - if (r != ESP_OK) return r; + if (r != ESP_OK) { + return r; + } r = uart_set_tx_idle_num(uart_num, UART_TX_IDLE_NUM_DEFAULT); - if (r != ESP_OK) return r; + if (r != ESP_OK) { + return r; + } r = uart_set_stop_bits(uart_num, uart_config->stop_bits); //A hardware reset does not reset the fifo, //so we need to reset the fifo manually. @@ -727,7 +793,8 @@ esp_err_t uart_intr_config(uart_port_t uart_num, const uart_intr_config_t *intr_ UART_CHECK((intr_conf), "param null", ESP_FAIL); UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); UART[uart_num]->int_clr.val = UART_INTR_MASK; - if(intr_conf->intr_enable_mask & UART_RXFIFO_TOUT_INT_ENA_M) { + if (intr_conf->intr_enable_mask & UART_RXFIFO_TOUT_INT_ENA_M) { +#if CONFIG_IDF_TARGET_ESP32 //Hardware issue workaround: when using ref_tick, the rx timeout threshold needs increase to 10 times. //T_ref = T_apb * APB_CLK/(REF_TICK << CLKDIV_FRAG_BIT_WIDTH) if(UART[uart_num]->conf0.tick_ref_always_on == 0) { @@ -735,14 +802,17 @@ esp_err_t uart_intr_config(uart_port_t uart_num, const uart_intr_config_t *intr_ } else { UART[uart_num]->conf1.rx_tout_thrhd = intr_conf->rx_timeout_thresh; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + UART[uart_num]->mem_conf.rx_tout_thrhd = ((intr_conf->rx_timeout_thresh) & UART_RX_TOUT_THRHD_V); +#endif UART[uart_num]->conf1.rx_tout_en = 1; } else { UART[uart_num]->conf1.rx_tout_en = 0; } - if(intr_conf->intr_enable_mask & UART_RXFIFO_FULL_INT_ENA_M) { + if (intr_conf->intr_enable_mask & UART_RXFIFO_FULL_INT_ENA_M) { UART[uart_num]->conf1.rxfifo_full_thrhd = intr_conf->rxfifo_full_thresh; } - if(intr_conf->intr_enable_mask & UART_TXFIFO_EMPTY_INT_ENA_M) { + if (intr_conf->intr_enable_mask & UART_TXFIFO_EMPTY_INT_ENA_M) { UART[uart_num]->conf1.txfifo_empty_thrhd = intr_conf->txfifo_empty_intr_thresh; } UART[uart_num]->int_ena.val = intr_conf->intr_enable_mask; @@ -771,9 +841,9 @@ static int UART_ISR_ATTR uart_find_pattern_from_last(uint8_t* buf, int length, u //internal isr handler for default driver code. static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) { - uart_obj_t *p_uart = (uart_obj_t*) param; + uart_obj_t *p_uart = (uart_obj_t *) param; uint8_t uart_num = p_uart->uart_num; - uart_dev_t* uart_reg = UART[uart_num]; + uart_dev_t *uart_reg = UART[uart_num]; int rx_fifo_len = 0; uint8_t buf_idx = 0; uint32_t uart_intr_status = 0; @@ -788,19 +858,19 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) break; } uart_event.type = UART_EVENT_MAX; - if(uart_intr_status & UART_TXFIFO_EMPTY_INT_ST_M) { + if (uart_intr_status & UART_TXFIFO_EMPTY_INT_ST_M) { uart_clear_intr_status(uart_num, UART_TXFIFO_EMPTY_INT_CLR_M); uart_disable_intr_mask_from_isr(uart_num, UART_TXFIFO_EMPTY_INT_ENA_M); - if(p_uart->tx_waiting_brk) { + if (p_uart->tx_waiting_brk) { continue; } //TX semaphore will only be used when tx_buf_size is zero. - if(p_uart->tx_waiting_fifo == true && p_uart->tx_buf_size == 0) { + if (p_uart->tx_waiting_fifo == true && p_uart->tx_buf_size == 0) { p_uart->tx_waiting_fifo = false; xSemaphoreGiveFromISR(p_uart->tx_fifo_sem, &HPTaskAwoken); } else { //We don't use TX ring buffer, because the size is zero. - if(p_uart->tx_buf_size == 0) { + if (p_uart->tx_buf_size == 0) { continue; } int tx_fifo_rem = UART_FIFO_LEN - uart_reg->status.txfifo_cnt; @@ -808,17 +878,17 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) //We need to put a loop here, in case all the buffer items are very short. //That would cause a watch_dog reset because empty interrupt happens so often. //Although this is a loop in ISR, this loop will execute at most 128 turns. - while(tx_fifo_rem) { - if(p_uart->tx_len_tot == 0 || p_uart->tx_ptr == NULL || p_uart->tx_len_cur == 0) { + while (tx_fifo_rem) { + if (p_uart->tx_len_tot == 0 || p_uart->tx_ptr == NULL || p_uart->tx_len_cur == 0) { size_t size; - p_uart->tx_head = (uart_tx_data_t*) xRingbufferReceiveFromISR(p_uart->tx_ring_buf, &size); - if(p_uart->tx_head) { + p_uart->tx_head = (uart_tx_data_t *) xRingbufferReceiveFromISR(p_uart->tx_ring_buf, &size); + if (p_uart->tx_head) { //The first item is the data description //Get the first item to get the data information - if(p_uart->tx_len_tot == 0) { + if (p_uart->tx_len_tot == 0) { p_uart->tx_ptr = NULL; p_uart->tx_len_tot = p_uart->tx_head->tx_data.size; - if(p_uart->tx_head->type == UART_DATA_BREAK) { + if (p_uart->tx_head->type == UART_DATA_BREAK) { p_uart->tx_brk_flg = 1; p_uart->tx_brk_len = p_uart->tx_head->tx_data.brk_len; } @@ -826,12 +896,11 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) vRingbufferReturnItemFromISR(p_uart->tx_ring_buf, p_uart->tx_head, &HPTaskAwoken); }else if(p_uart->tx_ptr == NULL) { //Update the TX item pointer, we will need this to return item to buffer. - p_uart->tx_ptr = (uint8_t*) p_uart->tx_head; + p_uart->tx_ptr = (uint8_t *) p_uart->tx_head; en_tx_flg = true; p_uart->tx_len_cur = size; } - } - else { + } else { //Can not get data from ring buffer, return; break; } @@ -848,7 +917,7 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) } for (buf_idx = 0; buf_idx < send_len; buf_idx++) { WRITE_PERI_REG(UART_FIFO_AHB_REG(uart_num), - *(p_uart->tx_ptr++) & 0xff); + *(p_uart->tx_ptr++) & 0xff); } p_uart->tx_len_tot -= send_len; p_uart->tx_len_cur -= send_len; @@ -860,7 +929,7 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) p_uart->tx_ptr = NULL; //Sending item done, now we need to send break if there is a record. //Set TX break signal after FIFO is empty - if(p_uart->tx_len_tot == 0 && p_uart->tx_brk_flg == 1) { + if (p_uart->tx_len_tot == 0 && p_uart->tx_brk_flg == 1) { UART_ENTER_CRITICAL_ISR(&uart_spinlock[uart_num]); uart_reg->int_ena.tx_brk_done = 0; uart_reg->idle_conf.tx_brk_num = p_uart->tx_brk_len; @@ -886,20 +955,23 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) uart_enable_intr_mask_from_isr(uart_num, UART_TXFIFO_EMPTY_INT_ENA_M); } } - } - else if ((uart_intr_status & UART_RXFIFO_TOUT_INT_ST_M) - || (uart_intr_status & UART_RXFIFO_FULL_INT_ST_M) - || (uart_intr_status & UART_AT_CMD_CHAR_DET_INT_ST_M) - ) { + } else if ((uart_intr_status & UART_RXFIFO_TOUT_INT_ST_M) + || (uart_intr_status & UART_RXFIFO_FULL_INT_ST_M) + || (uart_intr_status & UART_AT_CMD_CHAR_DET_INT_ST_M) + ) { rx_fifo_len = uart_reg->status.rxfifo_cnt; - if(pat_flg == 1) { + if (pat_flg == 1) { uart_intr_status |= UART_AT_CMD_CHAR_DET_INT_ST_M; pat_flg = 0; } if (p_uart->rx_buffer_full_flg == false) { //We have to read out all data in RX FIFO to clear the interrupt signal for(buf_idx = 0; buf_idx < rx_fifo_len; buf_idx++) { +#if CONFIG_IDF_TARGET_ESP32 p_uart->rx_data_buf[buf_idx] = uart_reg->fifo.rw_byte; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + p_uart->rx_data_buf[buf_idx] = READ_PERI_REG(UART_FIFO_AHB_REG(uart_num)); +#endif } uint8_t pat_chr = uart_reg->at_cmd_char.data; int pat_num = uart_reg->at_cmd_char.char_num; @@ -925,7 +997,7 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) p_uart->rx_stash_len = rx_fifo_len; //If we fail to push data to ring buffer, we will have to stash the data, and send next time. //Mainly for applications that uses flow control or small ring buffer. - if(pdFALSE == xRingbufferSendFromISR(p_uart->rx_ring_buf, p_uart->rx_data_buf, p_uart->rx_stash_len, &HPTaskAwoken)) { + if (pdFALSE == xRingbufferSendFromISR(p_uart->rx_ring_buf, p_uart->rx_data_buf, p_uart->rx_stash_len, &HPTaskAwoken)) { p_uart->rx_buffer_full_flg = true; uart_disable_intr_mask_from_isr(uart_num, UART_RXFIFO_TOUT_INT_ENA_M | UART_RXFIFO_FULL_INT_ENA_M); if (uart_event.type == UART_PATTERN_DET) { @@ -934,11 +1006,11 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) uart_pattern_enqueue(uart_num, p_uart->rx_buffered_len - (pat_num - rx_fifo_len)); } else { uart_pattern_enqueue(uart_num, - pat_idx <= -1 ? - //can not find the pattern in buffer, - p_uart->rx_buffered_len + p_uart->rx_stash_len : - // find the pattern in buffer - p_uart->rx_buffered_len + pat_idx); + pat_idx <= -1 ? + //can not find the pattern in buffer, + p_uart->rx_buffered_len + p_uart->rx_stash_len : + // find the pattern in buffer + p_uart->rx_buffered_len + pat_idx); } if ((p_uart->xQueueUart != NULL) && (pdFALSE == xQueueSendFromISR(p_uart->xQueueUart, (void * )&uart_event, &HPTaskAwoken))) { ESP_EARLY_LOGV(UART_TAG, "UART event queue full"); @@ -951,7 +1023,7 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) if (rx_fifo_len < pat_num) { //some of the characters are read out in last interrupt uart_pattern_enqueue(uart_num, p_uart->rx_buffered_len - (pat_num - rx_fifo_len)); - } else if(pat_idx >= 0) { + } else if (pat_idx >= 0) { // find pattern in statsh buffer. uart_pattern_enqueue(uart_num, p_uart->rx_buffered_len + pat_idx); } @@ -962,14 +1034,14 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) } else { uart_disable_intr_mask_from_isr(uart_num, UART_RXFIFO_FULL_INT_ENA_M | UART_RXFIFO_TOUT_INT_ENA_M); uart_clear_intr_status(uart_num, UART_RXFIFO_FULL_INT_CLR_M | UART_RXFIFO_TOUT_INT_CLR_M); - if(uart_intr_status & UART_AT_CMD_CHAR_DET_INT_ST_M) { + if (uart_intr_status & UART_AT_CMD_CHAR_DET_INT_ST_M) { uart_reg->int_clr.at_cmd_char_det = 1; uart_event.type = UART_PATTERN_DET; uart_event.size = rx_fifo_len; pat_flg = 1; } } - } else if(uart_intr_status & UART_RXFIFO_OVF_INT_ST_M) { + } else if (uart_intr_status & UART_RXFIFO_OVF_INT_ST_M) { // When fifo overflows, we reset the fifo. UART_ENTER_CRITICAL_ISR(&uart_spinlock[uart_num]); uart_reset_rx_fifo(uart_num); @@ -981,10 +1053,10 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) p_uart->uart_select_notif_callback(uart_num, UART_SELECT_ERROR_NOTIF, &HPTaskAwoken); } UART_EXIT_CRITICAL_ISR(&uart_selectlock); - } else if(uart_intr_status & UART_BRK_DET_INT_ST_M) { + } else if (uart_intr_status & UART_BRK_DET_INT_ST_M) { uart_reg->int_clr.brk_det = 1; uart_event.type = UART_BREAK; - } else if(uart_intr_status & UART_FRM_ERR_INT_ST_M) { + } else if (uart_intr_status & UART_FRM_ERR_INT_ST_M) { uart_reg->int_clr.frm_err = 1; uart_event.type = UART_FRAME_ERR; UART_ENTER_CRITICAL_ISR(&uart_selectlock); @@ -992,7 +1064,7 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) p_uart->uart_select_notif_callback(uart_num, UART_SELECT_ERROR_NOTIF, &HPTaskAwoken); } UART_EXIT_CRITICAL_ISR(&uart_selectlock); - } else if(uart_intr_status & UART_PARITY_ERR_INT_ST_M) { + } else if (uart_intr_status & UART_PARITY_ERR_INT_ST_M) { uart_reg->int_clr.parity_err = 1; uart_event.type = UART_PARITY_ERR; UART_ENTER_CRITICAL_ISR(&uart_selectlock); @@ -1000,30 +1072,30 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) p_uart->uart_select_notif_callback(uart_num, UART_SELECT_ERROR_NOTIF, &HPTaskAwoken); } UART_EXIT_CRITICAL_ISR(&uart_selectlock); - } else if(uart_intr_status & UART_TX_BRK_DONE_INT_ST_M) { + } else if (uart_intr_status & UART_TX_BRK_DONE_INT_ST_M) { UART_ENTER_CRITICAL_ISR(&uart_spinlock[uart_num]); uart_reg->conf0.txd_brk = 0; uart_reg->int_ena.tx_brk_done = 0; uart_reg->int_clr.tx_brk_done = 1; - if(p_uart->tx_brk_flg == 1) { + if (p_uart->tx_brk_flg == 1) { uart_reg->int_ena.txfifo_empty = 1; } UART_EXIT_CRITICAL_ISR(&uart_spinlock[uart_num]); - if(p_uart->tx_brk_flg == 1) { + if (p_uart->tx_brk_flg == 1) { p_uart->tx_brk_flg = 0; p_uart->tx_waiting_brk = 0; } else { xSemaphoreGiveFromISR(p_uart->tx_brk_sem, &HPTaskAwoken); } - } else if(uart_intr_status & UART_TX_BRK_IDLE_DONE_INT_ST_M) { + } else if (uart_intr_status & UART_TX_BRK_IDLE_DONE_INT_ST_M) { uart_disable_intr_mask_from_isr(uart_num, UART_TX_BRK_IDLE_DONE_INT_ENA_M); uart_clear_intr_status(uart_num, UART_TX_BRK_IDLE_DONE_INT_CLR_M); - } else if(uart_intr_status & UART_AT_CMD_CHAR_DET_INT_ST_M) { + } else if (uart_intr_status & UART_AT_CMD_CHAR_DET_INT_ST_M) { uart_reg->int_clr.at_cmd_char_det = 1; uart_event.type = UART_PATTERN_DET; } else if ((uart_intr_status & UART_RS485_CLASH_INT_ST_M) - || (uart_intr_status & UART_RS485_FRM_ERR_INT_ENA) - || (uart_intr_status & UART_RS485_PARITY_ERR_INT_ENA)) { + || (uart_intr_status & UART_RS485_FRM_ERR_INT_ENA) + || (uart_intr_status & UART_RS485_PARITY_ERR_INT_ENA)) { // RS485 collision or frame error interrupt triggered uart_clear_intr_status(uart_num, UART_RS485_CLASH_INT_CLR_M); UART_ENTER_CRITICAL_ISR(&uart_spinlock[uart_num]); @@ -1032,7 +1104,7 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) p_uart_obj[uart_num]->coll_det_flg = true; UART_EXIT_CRITICAL_ISR(&uart_spinlock[uart_num]); uart_event.type = UART_EVENT_MAX; - } else if(uart_intr_status & UART_TX_DONE_INT_ST_M) { + } else if (uart_intr_status & UART_TX_DONE_INT_ST_M) { uart_disable_intr_mask_from_isr(uart_num, UART_TX_DONE_INT_ENA_M); uart_clear_intr_status(uart_num, UART_TX_DONE_INT_CLR_M); // If RS485 half duplex mode is enable then reset FIFO and @@ -1049,7 +1121,7 @@ static void UART_ISR_ATTR uart_rx_intr_handler_default(void *param) uart_event.type = UART_EVENT_MAX; } - if(uart_event.type != UART_EVENT_MAX && p_uart->xQueueUart) { + if (uart_event.type != UART_EVENT_MAX && p_uart->xQueueUart) { if (pdFALSE == xQueueSendFromISR(p_uart->xQueueUart, (void * )&uart_event, &HPTaskAwoken)) { ESP_EARLY_LOGV(UART_TAG, "UART event queue full"); } @@ -1069,13 +1141,17 @@ esp_err_t uart_wait_tx_done(uart_port_t uart_num, TickType_t ticks_to_wait) portTickType ticks_start = xTaskGetTickCount(); //Take tx_mux res = xSemaphoreTake(p_uart_obj[uart_num]->tx_mux, (portTickType)ticks_to_wait); - if(res == pdFALSE) { + if (res == pdFALSE) { return ESP_ERR_TIMEOUT; } xSemaphoreTake(p_uart_obj[uart_num]->tx_done_sem, 0); typeof(UART0.status) status = UART[uart_num]->status; //Wait txfifo_cnt = 0, and the transmitter state machine is in idle state. - if(status.txfifo_cnt == 0 && status.st_utx_out == 0) { +#ifdef CONFIG_IDF_TARGET_ESP32 + if (status.txfifo_cnt == 0 && status.st_utx_out == 0) { +#else /* TODO: check transmitter state machine on ESP32S2Beta */ + if (status.txfifo_cnt == 0) { +#endif xSemaphoreGive(p_uart_obj[uart_num]->tx_mux); return ESP_OK; } @@ -1089,7 +1165,7 @@ esp_err_t uart_wait_tx_done(uart_port_t uart_num, TickType_t ticks_to_wait) } //take 2nd tx_done_sem, wait given from ISR res = xSemaphoreTake(p_uart_obj[uart_num]->tx_done_sem, (portTickType)ticks_to_wait); - if(res == pdFALSE) { + if (res == pdFALSE) { uart_disable_intr_mask(uart_num, UART_TX_DONE_INT_ENA_M); xSemaphoreGive(p_uart_obj[uart_num]->tx_mux); return ESP_ERR_TIMEOUT; @@ -1111,7 +1187,7 @@ static esp_err_t uart_set_break(uart_port_t uart_num, int break_num) //Fill UART tx_fifo and return a number, //This function by itself is not thread-safe, always call from within a muxed section. -static int uart_fill_fifo(uart_port_t uart_num, const char* buffer, uint32_t len) +static int uart_fill_fifo(uart_port_t uart_num, const char *buffer, uint32_t len) { uint8_t i = 0; uint8_t tx_fifo_cnt = UART[uart_num]->status.txfifo_cnt; @@ -1128,23 +1204,23 @@ static int uart_fill_fifo(uart_port_t uart_num, const char* buffer, uint32_t len return copy_cnt; } -int uart_tx_chars(uart_port_t uart_num, const char* buffer, uint32_t len) +int uart_tx_chars(uart_port_t uart_num, const char *buffer, uint32_t len) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", (-1)); UART_CHECK((p_uart_obj[uart_num]), "uart driver error", (-1)); UART_CHECK(buffer, "buffer null", (-1)); - if(len == 0) { + if (len == 0) { return 0; } xSemaphoreTake(p_uart_obj[uart_num]->tx_mux, (portTickType)portMAX_DELAY); - int tx_len = uart_fill_fifo(uart_num, (const char*) buffer, len); + int tx_len = uart_fill_fifo(uart_num, (const char *) buffer, len); xSemaphoreGive(p_uart_obj[uart_num]->tx_mux); return tx_len; } -static int uart_tx_all(uart_port_t uart_num, const char* src, size_t size, bool brk_en, int brk_len) +static int uart_tx_all(uart_port_t uart_num, const char *src, size_t size, bool brk_en, int brk_len) { - if(size == 0) { + if (size == 0) { return 0; } size_t original_size = size; @@ -1152,31 +1228,31 @@ static int uart_tx_all(uart_port_t uart_num, const char* src, size_t size, bool //lock for uart_tx xSemaphoreTake(p_uart_obj[uart_num]->tx_mux, (portTickType)portMAX_DELAY); p_uart_obj[uart_num]->coll_det_flg = false; - if(p_uart_obj[uart_num]->tx_buf_size > 0) { + if (p_uart_obj[uart_num]->tx_buf_size > 0) { int max_size = xRingbufferGetMaxItemSize(p_uart_obj[uart_num]->tx_ring_buf); int offset = 0; uart_tx_data_t evt; evt.tx_data.size = size; evt.tx_data.brk_len = brk_len; - if(brk_en) { + if (brk_en) { evt.type = UART_DATA_BREAK; } else { evt.type = UART_DATA; } - xRingbufferSend(p_uart_obj[uart_num]->tx_ring_buf, (void*) &evt, sizeof(uart_tx_data_t), portMAX_DELAY); - while(size > 0) { + xRingbufferSend(p_uart_obj[uart_num]->tx_ring_buf, (void *) &evt, sizeof(uart_tx_data_t), portMAX_DELAY); + while (size > 0) { int send_size = size > max_size / 2 ? max_size / 2 : size; - xRingbufferSend(p_uart_obj[uart_num]->tx_ring_buf, (void*) (src + offset), send_size, portMAX_DELAY); + xRingbufferSend(p_uart_obj[uart_num]->tx_ring_buf, (void *) (src + offset), send_size, portMAX_DELAY); size -= send_size; offset += send_size; uart_enable_tx_intr(uart_num, 1, UART_EMPTY_THRESH_DEFAULT); } } else { - while(size) { + while (size) { //semaphore for tx_fifo available - if(pdTRUE == xSemaphoreTake(p_uart_obj[uart_num]->tx_fifo_sem, (portTickType)portMAX_DELAY)) { - size_t sent = uart_fill_fifo(uart_num, (char*) src, size); - if(sent < size) { + if (pdTRUE == xSemaphoreTake(p_uart_obj[uart_num]->tx_fifo_sem, (portTickType)portMAX_DELAY)) { + size_t sent = uart_fill_fifo(uart_num, (char *) src, size); + if (sent < size) { p_uart_obj[uart_num]->tx_waiting_fifo = true; uart_enable_tx_intr(uart_num, 1, UART_EMPTY_THRESH_DEFAULT); } @@ -1184,7 +1260,7 @@ static int uart_tx_all(uart_port_t uart_num, const char* src, size_t size, bool src += sent; } } - if(brk_en) { + if (brk_en) { uart_set_break(uart_num, brk_len); xSemaphoreTake(p_uart_obj[uart_num]->tx_brk_sem, (portTickType)portMAX_DELAY); } @@ -1194,7 +1270,7 @@ static int uart_tx_all(uart_port_t uart_num, const char* src, size_t size, bool return original_size; } -int uart_write_bytes(uart_port_t uart_num, const char* src, size_t size) +int uart_write_bytes(uart_port_t uart_num, const char *src, size_t size) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", (-1)); UART_CHECK((p_uart_obj[uart_num] != NULL), "uart driver error", (-1)); @@ -1202,7 +1278,7 @@ int uart_write_bytes(uart_port_t uart_num, const char* src, size_t size) return uart_tx_all(uart_num, src, size, 0, 0); } -int uart_write_bytes_with_break(uart_port_t uart_num, const char* src, size_t size, int brk_len) +int uart_write_bytes_with_break(uart_port_t uart_num, const char *src, size_t size, int brk_len) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", (-1)); UART_CHECK((p_uart_obj[uart_num]), "uart driver error", (-1)); @@ -1214,9 +1290,9 @@ int uart_write_bytes_with_break(uart_port_t uart_num, const char* src, size_t si static bool uart_check_buf_full(uart_port_t uart_num) { - if(p_uart_obj[uart_num]->rx_buffer_full_flg) { + if (p_uart_obj[uart_num]->rx_buffer_full_flg) { BaseType_t res = xRingbufferSend(p_uart_obj[uart_num]->rx_ring_buf, p_uart_obj[uart_num]->rx_data_buf, p_uart_obj[uart_num]->rx_stash_len, 1); - if(res == pdTRUE) { + if (res == pdTRUE) { UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); p_uart_obj[uart_num]->rx_buffered_len += p_uart_obj[uart_num]->rx_stash_len; p_uart_obj[uart_num]->rx_buffer_full_flg = false; @@ -1228,22 +1304,22 @@ static bool uart_check_buf_full(uart_port_t uart_num) return false; } -int uart_read_bytes(uart_port_t uart_num, uint8_t* buf, uint32_t length, TickType_t ticks_to_wait) +int uart_read_bytes(uart_port_t uart_num, uint8_t *buf, uint32_t length, TickType_t ticks_to_wait) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", (-1)); UART_CHECK((buf), "uart data null", (-1)); UART_CHECK((p_uart_obj[uart_num]), "uart driver error", (-1)); - uint8_t* data = NULL; + uint8_t *data = NULL; size_t size; size_t copy_len = 0; int len_tmp; - if(xSemaphoreTake(p_uart_obj[uart_num]->rx_mux,(portTickType)ticks_to_wait) != pdTRUE) { + if (xSemaphoreTake(p_uart_obj[uart_num]->rx_mux, (portTickType)ticks_to_wait) != pdTRUE) { return -1; } - while(length) { - if(p_uart_obj[uart_num]->rx_cur_remain == 0) { - data = (uint8_t*) xRingbufferReceive(p_uart_obj[uart_num]->rx_ring_buf, &size, (portTickType) ticks_to_wait); - if(data) { + while (length) { + if (p_uart_obj[uart_num]->rx_cur_remain == 0) { + data = (uint8_t *) xRingbufferReceive(p_uart_obj[uart_num]->rx_ring_buf, &size, (portTickType) ticks_to_wait); + if (data) { p_uart_obj[uart_num]->rx_head_ptr = data; p_uart_obj[uart_num]->rx_ptr = data; p_uart_obj[uart_num]->rx_cur_remain = size; @@ -1251,7 +1327,7 @@ int uart_read_bytes(uart_port_t uart_num, uint8_t* buf, uint32_t length, TickTyp //When using dual cores, `rx_buffer_full_flg` may read and write on different cores at same time, //which may lose synchronization. So we also need to call `uart_check_buf_full` once when ringbuffer is empty //to solve the possible asynchronous issues. - if(uart_check_buf_full(uart_num)) { + if (uart_check_buf_full(uart_num)) { //This condition will never be true if `uart_read_bytes` //and `uart_rx_intr_handler_default` are scheduled on the same core. continue; @@ -1261,7 +1337,7 @@ int uart_read_bytes(uart_port_t uart_num, uint8_t* buf, uint32_t length, TickTyp } } } - if(p_uart_obj[uart_num]->rx_cur_remain > length) { + if (p_uart_obj[uart_num]->rx_cur_remain > length) { len_tmp = length; } else { len_tmp = p_uart_obj[uart_num]->rx_cur_remain; @@ -1275,7 +1351,7 @@ int uart_read_bytes(uart_port_t uart_num, uint8_t* buf, uint32_t length, TickTyp p_uart_obj[uart_num]->rx_cur_remain -= len_tmp; copy_len += len_tmp; length -= len_tmp; - if(p_uart_obj[uart_num]->rx_cur_remain == 0) { + if (p_uart_obj[uart_num]->rx_cur_remain == 0) { vRingbufferReturnItem(p_uart_obj[uart_num]->rx_ring_buf, p_uart_obj[uart_num]->rx_head_ptr); p_uart_obj[uart_num]->rx_head_ptr = NULL; p_uart_obj[uart_num]->rx_ptr = NULL; @@ -1287,7 +1363,7 @@ int uart_read_bytes(uart_port_t uart_num, uint8_t* buf, uint32_t length, TickTyp return copy_len; } -esp_err_t uart_get_buffered_data_len(uart_port_t uart_num, size_t* size) +esp_err_t uart_get_buffered_data_len(uart_port_t uart_num, size_t *size) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); UART_CHECK((p_uart_obj[uart_num]), "uart driver error", ESP_FAIL); @@ -1301,15 +1377,15 @@ esp_err_t uart_flush_input(uart_port_t uart_num) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); UART_CHECK((p_uart_obj[uart_num]), "uart driver error", ESP_FAIL); - uart_obj_t* p_uart = p_uart_obj[uart_num]; - uint8_t* data; + uart_obj_t *p_uart = p_uart_obj[uart_num]; + uint8_t *data; size_t size; //rx sem protect the ring buffer read related functions xSemaphoreTake(p_uart->rx_mux, (portTickType)portMAX_DELAY); uart_disable_rx_intr(p_uart_obj[uart_num]->uart_num); - while(true) { - if(p_uart->rx_head_ptr) { + while (true) { + if (p_uart->rx_head_ptr) { vRingbufferReturnItem(p_uart->rx_ring_buf, p_uart->rx_head_ptr); UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); p_uart_obj[uart_num]->rx_buffered_len -= p_uart->rx_cur_remain; @@ -1319,9 +1395,9 @@ esp_err_t uart_flush_input(uart_port_t uart_num) p_uart->rx_cur_remain = 0; p_uart->rx_head_ptr = NULL; } - data = (uint8_t*) xRingbufferReceive(p_uart->rx_ring_buf, &size, (portTickType) 0); - if(data == NULL) { - if( p_uart_obj[uart_num]->rx_buffered_len != 0 ) { + data = (uint8_t *) xRingbufferReceive(p_uart->rx_ring_buf, &size, (portTickType) 0); + if (data == NULL) { + if ( p_uart_obj[uart_num]->rx_buffered_len != 0 ) { ESP_LOGE(UART_TAG, "rx_buffered_len error"); p_uart_obj[uart_num]->rx_buffered_len = 0; } @@ -1336,9 +1412,9 @@ esp_err_t uart_flush_input(uart_port_t uart_num) uart_pattern_queue_update(uart_num, size); UART_EXIT_CRITICAL(&uart_spinlock[uart_num]); vRingbufferReturnItem(p_uart->rx_ring_buf, data); - if(p_uart_obj[uart_num]->rx_buffer_full_flg) { + if (p_uart_obj[uart_num]->rx_buffer_full_flg) { BaseType_t res = xRingbufferSend(p_uart_obj[uart_num]->rx_ring_buf, p_uart_obj[uart_num]->rx_data_buf, p_uart_obj[uart_num]->rx_stash_len, 1); - if(res == pdTRUE) { + if (res == pdTRUE) { UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); p_uart_obj[uart_num]->rx_buffered_len += p_uart_obj[uart_num]->rx_stash_len; p_uart_obj[uart_num]->rx_buffer_full_flg = false; @@ -1369,9 +1445,9 @@ esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_b "should not set ESP_INTR_FLAG_IRAM when CONFIG_UART_ISR_IN_IRAM is not enabled", ESP_FAIL); #endif - if(p_uart_obj[uart_num] == NULL) { - p_uart_obj[uart_num] = (uart_obj_t*) calloc(1, sizeof(uart_obj_t)); - if(p_uart_obj[uart_num] == NULL) { + if (p_uart_obj[uart_num] == NULL) { + p_uart_obj[uart_num] = (uart_obj_t *) calloc(1, sizeof(uart_obj_t)); + if (p_uart_obj[uart_num] == NULL) { ESP_LOGE(UART_TAG, "UART driver malloc error"); return ESP_FAIL; } @@ -1394,7 +1470,7 @@ esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_b p_uart_obj[uart_num]->rx_buffered_len = 0; uart_pattern_queue_reset(uart_num, UART_PATTERN_DET_QLEN_DEFAULT); - if(uart_queue) { + if (uart_queue) { p_uart_obj[uart_num]->xQueueUart = xQueueCreate(queue_size, sizeof(uart_event_t)); *uart_queue = p_uart_obj[uart_num]->xQueueUart; ESP_LOGI(UART_TAG, "queue free spaces: %d", uxQueueSpacesAvailable(p_uart_obj[uart_num]->xQueueUart)); @@ -1407,7 +1483,7 @@ esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_b p_uart_obj[uart_num]->rx_cur_remain = 0; p_uart_obj[uart_num]->rx_head_ptr = NULL; p_uart_obj[uart_num]->rx_ring_buf = xRingbufferCreate(rx_buffer_size, RINGBUF_TYPE_BYTEBUF); - if(tx_buffer_size > 0) { + if (tx_buffer_size > 0) { p_uart_obj[uart_num]->tx_ring_buf = xRingbufferCreate(tx_buffer_size, RINGBUF_TYPE_NOSPLIT); p_uart_obj[uart_num]->tx_buf_size = tx_buffer_size; } else { @@ -1420,21 +1496,25 @@ esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_b return ESP_FAIL; } - r=uart_isr_register(uart_num, uart_rx_intr_handler_default, p_uart_obj[uart_num], intr_alloc_flags, &p_uart_obj[uart_num]->intr_handle); - if (r!=ESP_OK) goto err; + r = uart_isr_register(uart_num, uart_rx_intr_handler_default, p_uart_obj[uart_num], intr_alloc_flags, &p_uart_obj[uart_num]->intr_handle); + if (r != ESP_OK) { + goto err; + } uart_intr_config_t uart_intr = { .intr_enable_mask = UART_RXFIFO_FULL_INT_ENA_M - | UART_RXFIFO_TOUT_INT_ENA_M - | UART_FRM_ERR_INT_ENA_M - | UART_RXFIFO_OVF_INT_ENA_M - | UART_BRK_DET_INT_ENA_M - | UART_PARITY_ERR_INT_ENA_M, + | UART_RXFIFO_TOUT_INT_ENA_M + | UART_FRM_ERR_INT_ENA_M + | UART_RXFIFO_OVF_INT_ENA_M + | UART_BRK_DET_INT_ENA_M + | UART_PARITY_ERR_INT_ENA_M, .rxfifo_full_thresh = UART_FULL_THRESH_DEFAULT, .rx_timeout_thresh = UART_TOUT_THRESH_DEFAULT, .txfifo_empty_intr_thresh = UART_EMPTY_THRESH_DEFAULT }; - r=uart_intr_config(uart_num, &uart_intr); - if (r!=ESP_OK) goto err; + r = uart_intr_config(uart_num, &uart_intr); + if (r != ESP_OK) { + goto err; + } return r; err: @@ -1446,7 +1526,7 @@ err: esp_err_t uart_driver_delete(uart_port_t uart_num) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_FAIL); - if(p_uart_obj[uart_num] == NULL) { + if (p_uart_obj[uart_num] == NULL) { ESP_LOGI(UART_TAG, "ALREADY NULL"); return ESP_OK; } @@ -1455,35 +1535,35 @@ esp_err_t uart_driver_delete(uart_port_t uart_num) uart_disable_tx_intr(uart_num); uart_pattern_link_free(uart_num); - if(p_uart_obj[uart_num]->tx_fifo_sem) { + if (p_uart_obj[uart_num]->tx_fifo_sem) { vSemaphoreDelete(p_uart_obj[uart_num]->tx_fifo_sem); p_uart_obj[uart_num]->tx_fifo_sem = NULL; } - if(p_uart_obj[uart_num]->tx_done_sem) { + if (p_uart_obj[uart_num]->tx_done_sem) { vSemaphoreDelete(p_uart_obj[uart_num]->tx_done_sem); p_uart_obj[uart_num]->tx_done_sem = NULL; } - if(p_uart_obj[uart_num]->tx_brk_sem) { + if (p_uart_obj[uart_num]->tx_brk_sem) { vSemaphoreDelete(p_uart_obj[uart_num]->tx_brk_sem); p_uart_obj[uart_num]->tx_brk_sem = NULL; } - if(p_uart_obj[uart_num]->tx_mux) { + if (p_uart_obj[uart_num]->tx_mux) { vSemaphoreDelete(p_uart_obj[uart_num]->tx_mux); p_uart_obj[uart_num]->tx_mux = NULL; } - if(p_uart_obj[uart_num]->rx_mux) { + if (p_uart_obj[uart_num]->rx_mux) { vSemaphoreDelete(p_uart_obj[uart_num]->rx_mux); p_uart_obj[uart_num]->rx_mux = NULL; } - if(p_uart_obj[uart_num]->xQueueUart) { + if (p_uart_obj[uart_num]->xQueueUart) { vQueueDelete(p_uart_obj[uart_num]->xQueueUart); p_uart_obj[uart_num]->xQueueUart = NULL; } - if(p_uart_obj[uart_num]->rx_ring_buf) { + if (p_uart_obj[uart_num]->rx_ring_buf) { vRingbufferDelete(p_uart_obj[uart_num]->rx_ring_buf); p_uart_obj[uart_num]->rx_ring_buf = NULL; } - if(p_uart_obj[uart_num]->tx_ring_buf) { + if (p_uart_obj[uart_num]->tx_ring_buf) { vRingbufferDelete(p_uart_obj[uart_num]->tx_ring_buf); p_uart_obj[uart_num]->tx_ring_buf = NULL; } @@ -1509,6 +1589,7 @@ portMUX_TYPE *uart_get_selectlock(void) { return &uart_selectlock; } + // Set UART mode esp_err_t uart_set_mode(uart_port_t uart_num, uart_mode_t mode) { @@ -1517,7 +1598,7 @@ esp_err_t uart_set_mode(uart_port_t uart_num, uart_mode_t mode) if ((mode == UART_MODE_RS485_COLLISION_DETECT) || (mode == UART_MODE_RS485_APP_CTRL) || (mode == UART_MODE_RS485_HALF_DUPLEX)) { UART_CHECK((UART[uart_num]->conf1.rx_flow_en != 1), - "disable hw flowctrl before using RS485 mode", ESP_ERR_INVALID_ARG); + "disable hw flowctrl before using RS485 mode", ESP_ERR_INVALID_ARG); } UART_ENTER_CRITICAL(&uart_spinlock[uart_num]); UART[uart_num]->rs485_conf.en = 0; @@ -1538,10 +1619,10 @@ esp_err_t uart_set_mode(uart_port_t uart_num, uart_mode_t mode) UART[uart_num]->rs485_conf.en = 1; // Enable collision detection interrupts uart_enable_intr_mask(uart_num, UART_RXFIFO_TOUT_INT_ENA - | UART_RXFIFO_FULL_INT_ENA - | UART_RS485_CLASH_INT_ENA - | UART_RS485_FRM_ERR_INT_ENA - | UART_RS485_PARITY_ERR_INT_ENA); + | UART_RXFIFO_FULL_INT_ENA + | UART_RS485_CLASH_INT_ENA + | UART_RS485_FRM_ERR_INT_ENA + | UART_RS485_PARITY_ERR_INT_ENA); break; case UART_MODE_RS485_APP_CTRL: // Application software control, remove echo @@ -1577,13 +1658,17 @@ esp_err_t uart_set_rx_timeout(uart_port_t uart_num, const uint8_t tout_thresh) // The tout_thresh = 1, defines TOUT interrupt timeout equal to // transmission time of one symbol (~11 bit) on current baudrate if (tout_thresh > 0) { - //Hardware issue workaround: when using ref_tick, the rx timeout threshold needs increase to 10 times. +#if CONFIG_IDF_TARGET_ESP32 + //ESP32 hardware issue workaround: when using ref_tick, the rx timeout threshold needs increase to 10 times. //T_ref = T_apb * APB_CLK/(REF_TICK << CLKDIV_FRAG_BIT_WIDTH) - if(UART[uart_num]->conf0.tick_ref_always_on == 0) { - UART[uart_num]->conf1.rx_tout_thrhd = tout_thresh * UART_TOUT_REF_FACTOR_DEFAULT; + if (UART[uart_num]->conf0.tick_ref_always_on == 0) { + UART[uart_num]->conf1.rx_tout_thrhd = ((tout_thresh * UART_TOUT_REF_FACTOR_DEFAULT) & UART_RX_TOUT_THRHD_V); } else { - UART[uart_num]->conf1.rx_tout_thrhd = tout_thresh; + UART[uart_num]->conf1.rx_tout_thrhd = ((tout_thresh) & UART_RX_TOUT_THRHD_V); } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + UART[uart_num]->mem_conf.rx_tout_thrhd = ((tout_thresh) & UART_RX_TOUT_THRHD_V); +#endif UART[uart_num]->conf1.rx_tout_en = 1; } else { UART[uart_num]->conf1.rx_tout_en = 0; @@ -1592,7 +1677,7 @@ esp_err_t uart_set_rx_timeout(uart_port_t uart_num, const uint8_t tout_thresh) return ESP_OK; } -esp_err_t uart_get_collision_flag(uart_port_t uart_num, bool* collision_flag) +esp_err_t uart_get_collision_flag(uart_port_t uart_num, bool *collision_flag) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG); UART_CHECK((collision_flag != NULL), "wrong parameter pointer", ESP_ERR_INVALID_ARG); @@ -1608,13 +1693,13 @@ esp_err_t uart_set_wakeup_threshold(uart_port_t uart_num, int wakeup_threshold) UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG); UART_CHECK((wakeup_threshold <= UART_ACTIVE_THRESHOLD_V && wakeup_threshold > UART_MIN_WAKEUP_THRESH), - "wakeup_threshold out of bounds", ESP_ERR_INVALID_ARG); + "wakeup_threshold out of bounds", ESP_ERR_INVALID_ARG); UART[uart_num]->sleep_conf.active_threshold = wakeup_threshold - UART_MIN_WAKEUP_THRESH; return ESP_OK; } -esp_err_t uart_get_wakeup_threshold(uart_port_t uart_num, int* out_wakeup_threshold) +esp_err_t uart_get_wakeup_threshold(uart_port_t uart_num, int *out_wakeup_threshold) { UART_CHECK((uart_num < UART_NUM_MAX), "uart_num error", ESP_ERR_INVALID_ARG); UART_CHECK((out_wakeup_threshold != NULL), "argument is NULL", ESP_ERR_INVALID_ARG); diff --git a/components/efuse/CMakeLists.txt b/components/efuse/CMakeLists.txt index 5fe2cde147..70a1c360e0 100644 --- a/components/efuse/CMakeLists.txt +++ b/components/efuse/CMakeLists.txt @@ -1,28 +1,35 @@ -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) +if(EXISTS "${COMPONENT_DIR}/${target}") + include(${COMPONENT_DIR}/${target}/sources.cmake) spaces2list(EFUSE_SOC_SRCS) - add_prefix(srcs "${soc_name}/" ${EFUSE_SOC_SRCS}) - set(include_dirs include ${soc_name}/include) + set(include_dirs include ${target}/include) + add_prefix(srcs "${target}/" ${EFUSE_SOC_SRCS}) + list(APPEND srcs "src/${target}/esp_efuse_api.c" + "src/${target}/esp_efuse_fields.c" + "src/${target}/esp_efuse_utility.c") endif() -list(APPEND srcs - "src/esp_efuse_api.c" - "src/esp_efuse_fields.c" - "src/esp_efuse_utility.c") +list(APPEND srcs "src/esp_efuse_api.c" + "src/esp_efuse_fields.c" + "src/esp_efuse_utility.c") idf_component_register(SRCS "${srcs}" PRIV_REQUIRES bootloader_support soc spi_flash - INCLUDE_DIRS "${include_dirs}") + INCLUDE_DIRS "${include_dirs}" + PRIV_INCLUDE_DIRS private_include) -set(GEN_EFUSE_TABLE_ARG --max_blk_len ${CONFIG_EFUSE_MAX_BLK_LEN}) +if(target) + set(TOOL_TARGET -t ${target}) +endif() + +set(GEN_EFUSE_TABLE_ARG ${TOOL_TARGET} --max_blk_len ${CONFIG_EFUSE_MAX_BLK_LEN}) idf_build_get_property(python PYTHON) ################### # Make common files esp_efuse_table.c and include/esp_efuse_table.h files. -set(EFUSE_COMMON_TABLE_CSV_PATH "${COMPONENT_DIR}/${soc_name}/esp_efuse_table.csv") +set(EFUSE_COMMON_TABLE_CSV_PATH "${COMPONENT_DIR}/${target}/esp_efuse_table.csv") add_custom_target(efuse_common_table COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py" ${EFUSE_COMMON_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG}) @@ -33,9 +40,9 @@ if(${CONFIG_EFUSE_CUSTOM_TABLE}) # Custom filename expands any path relative to the project idf_build_get_property(project_dir PROJECT_DIR) get_filename_component(EFUSE_CUSTOM_TABLE_CSV_PATH "${CONFIG_EFUSE_CUSTOM_TABLE_FILENAME}" ABSOLUTE BASE_DIR "${project_dir}") - add_custom_target(efuse_custom_table COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py" ${EFUSE_COMMON_TABLE_CSV_PATH} ${EFUSE_CUSTOM_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG}) + add_custom_target(efuse_custom_table COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py" ${EFUSE_COMMON_TABLE_CSV_PATH} ${EFUSE_CUSTOM_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG}) else() - add_custom_target(efuse_custom_table COMMAND) + add_custom_target(efuse_custom_table COMMAND) endif()#if(${CONFIG_EFUSE_CUSTOM_TABLE}) add_custom_target(show_efuse_table COMMAND "${python}" "${CMAKE_CURRENT_SOURCE_DIR}/efuse_table_gen.py" ${EFUSE_COMMON_TABLE_CSV_PATH} ${EFUSE_CUSTOM_TABLE_CSV_PATH} ${GEN_EFUSE_TABLE_ARG} "--info") diff --git a/components/efuse/Kconfig b/components/efuse/Kconfig index b4f83c8836..21e80a4e0d 100644 --- a/components/efuse/Kconfig +++ b/components/efuse/Kconfig @@ -25,6 +25,7 @@ menu "eFuse Bit Manager" choice EFUSE_CODE_SCHEME_SELECTOR prompt "Coding Scheme Compatibility" default EFUSE_CODE_SCHEME_COMPAT_3_4 + depends on IDF_TARGET_ESP32 help Selector eFuse code scheme. @@ -41,5 +42,6 @@ menu "eFuse Bit Manager" default 256 if EFUSE_CODE_SCHEME_COMPAT_NONE default 192 if EFUSE_CODE_SCHEME_COMPAT_3_4 default 128 if EFUSE_CODE_SCHEME_COMPAT_REPEAT + default 256 if IDF_TARGET_ESP32S2BETA endmenu diff --git a/components/efuse/component.mk b/components/efuse/component.mk index 393f21020b..530b590fd8 100644 --- a/components/efuse/component.mk +++ b/components/efuse/component.mk @@ -1,10 +1,10 @@ # # Component Makefile # currently the only SoC supported; to be moved into Kconfig -SOC_NAME := $(IDF_TARGET) +TARGET := $(IDF_TARGET) -COMPONENT_SRCDIRS := $(SOC_NAME) src +COMPONENT_SRCDIRS := $(TARGET) src src/$(TARGET) +COMPONENT_PRIV_INCLUDEDIRS := private_include +COMPONENT_ADD_INCLUDEDIRS := $(TARGET)/include include -COMPONENT_ADD_INCLUDEDIRS := $(SOC_NAME)/include include - --include $(COMPONENT_PATH)/$(SOC_NAME)/component.mk \ No newline at end of file +-include $(COMPONENT_PATH)/$(TARGET)/component.mk \ No newline at end of file diff --git a/components/efuse/efuse_table_gen.py b/components/efuse/efuse_table_gen.py index 02940c27a5..a5a8e52c98 100755 --- a/components/efuse/efuse_table_gen.py +++ b/components/efuse/efuse_table_gen.py @@ -28,6 +28,7 @@ __version__ = '1.0' quiet = False max_blk_len = 256 +idf_target = "esp32" copyright = '''// Copyright 2017-2018 Espressif Systems (Shanghai) PTE LTD // @@ -244,35 +245,36 @@ class FuseTable(list): rows += [""] - rows += ["#define MAX_BLK_LEN CONFIG_EFUSE_MAX_BLK_LEN"] + if idf_target == "esp32": + rows += ["#define MAX_BLK_LEN CONFIG_EFUSE_MAX_BLK_LEN"] - rows += [""] + rows += [""] - last_free_bit_blk1 = self.get_str_position_last_free_bit_in_blk("EFUSE_BLK1") - last_free_bit_blk2 = self.get_str_position_last_free_bit_in_blk("EFUSE_BLK2") - last_free_bit_blk3 = self.get_str_position_last_free_bit_in_blk("EFUSE_BLK3") + last_free_bit_blk1 = self.get_str_position_last_free_bit_in_blk("EFUSE_BLK1") + last_free_bit_blk2 = self.get_str_position_last_free_bit_in_blk("EFUSE_BLK2") + last_free_bit_blk3 = self.get_str_position_last_free_bit_in_blk("EFUSE_BLK3") - rows += ["// The last free bit in the block is counted over the entire file."] - if last_free_bit_blk1 is not None: - rows += ["#define LAST_FREE_BIT_BLK1 " + last_free_bit_blk1] - if last_free_bit_blk2 is not None: - rows += ["#define LAST_FREE_BIT_BLK2 " + last_free_bit_blk2] - if last_free_bit_blk3 is not None: - rows += ["#define LAST_FREE_BIT_BLK3 " + last_free_bit_blk3] + rows += ["// The last free bit in the block is counted over the entire file."] + if last_free_bit_blk1 is not None: + rows += ["#define LAST_FREE_BIT_BLK1 " + last_free_bit_blk1] + if last_free_bit_blk2 is not None: + rows += ["#define LAST_FREE_BIT_BLK2 " + last_free_bit_blk2] + if last_free_bit_blk3 is not None: + rows += ["#define LAST_FREE_BIT_BLK3 " + last_free_bit_blk3] - rows += [""] + rows += [""] - if last_free_bit_blk1 is not None: - rows += ['_Static_assert(LAST_FREE_BIT_BLK1 <= MAX_BLK_LEN, "The eFuse table does not match the coding scheme. ' - 'Edit the table and restart the efuse_common_table or efuse_custom_table command to regenerate the new files.");'] - if last_free_bit_blk2 is not None: - rows += ['_Static_assert(LAST_FREE_BIT_BLK2 <= MAX_BLK_LEN, "The eFuse table does not match the coding scheme. ' - 'Edit the table and restart the efuse_common_table or efuse_custom_table command to regenerate the new files.");'] - if last_free_bit_blk3 is not None: - rows += ['_Static_assert(LAST_FREE_BIT_BLK3 <= MAX_BLK_LEN, "The eFuse table does not match the coding scheme. ' - 'Edit the table and restart the efuse_common_table or efuse_custom_table command to regenerate the new files.");'] + if last_free_bit_blk1 is not None: + rows += ['_Static_assert(LAST_FREE_BIT_BLK1 <= MAX_BLK_LEN, "The eFuse table does not match the coding scheme. ' + 'Edit the table and restart the efuse_common_table or efuse_custom_table command to regenerate the new files.");'] + if last_free_bit_blk2 is not None: + rows += ['_Static_assert(LAST_FREE_BIT_BLK2 <= MAX_BLK_LEN, "The eFuse table does not match the coding scheme. ' + 'Edit the table and restart the efuse_common_table or efuse_custom_table command to regenerate the new files.");'] + if last_free_bit_blk3 is not None: + rows += ['_Static_assert(LAST_FREE_BIT_BLK3 <= MAX_BLK_LEN, "The eFuse table does not match the coding scheme. ' + 'Edit the table and restart the efuse_common_table or efuse_custom_table command to regenerate the new files.");'] - rows += [""] + rows += [""] last_name = '' for p in self: @@ -348,8 +350,16 @@ class FuseDefinition(object): def parse_block(self, strval): if strval == "": raise InputError("Field 'efuse_block' can't be left empty.") - if strval not in ["EFUSE_BLK0", "EFUSE_BLK1", "EFUSE_BLK2", "EFUSE_BLK3"]: - raise InputError("Field 'efuse_block' should consist from EFUSE_BLK0..EFUSE_BLK3") + if idf_target == "esp32": + if strval not in ["EFUSE_BLK0", "EFUSE_BLK1", "EFUSE_BLK2", "EFUSE_BLK3"]: + raise InputError("Field 'efuse_block' should be one of EFUSE_BLK0..EFUSE_BLK3") + + if idf_target == "esp32s2beta": + if strval not in ["EFUSE_BLK0", "EFUSE_BLK1", "EFUSE_BLK2", "EFUSE_BLK3", "EFUSE_BLK4", + "EFUSE_BLK5", "EFUSE_BLK6", "EFUSE_BLK7", "EFUSE_BLK8", "EFUSE_BLK9", + "EFUSE_BLK10"]: + raise InputError("Field 'efuse_block' should be one of EFUSE_BLK0..EFUSE_BLK10") + return strval def get_max_bits_of_block(self): @@ -450,17 +460,21 @@ def create_output_files(name, output_table, debug): def main(): global quiet global max_blk_len + global idf_target parser = argparse.ArgumentParser(description='ESP32 eFuse Manager') + parser.add_argument('--idf_target', '-t', help='Target chip type', choices=['esp32','esp32s2beta'], default='esp32') parser.add_argument('--quiet', '-q', help="Don't print non-critical status messages to stderr", action='store_true') parser.add_argument('--debug', help='Create header file with debug info', default=False, action="store_false") parser.add_argument('--info', help='Print info about range of used bits', default=False, action="store_true") - parser.add_argument('--max_blk_len', help='Max number of bits in BLK1, BLK2 and BLK3', type=int, default=256) + parser.add_argument('--max_blk_len', help='Max number of bits in BLOCKs', type=int, default=256) parser.add_argument('common_input', help='Path to common CSV file to parse.', type=argparse.FileType('r')) parser.add_argument('custom_input', help='Path to custom CSV file to parse.', type=argparse.FileType('r'), nargs='?', default=None) args = parser.parse_args() + idf_target = args.idf_target + max_blk_len = args.max_blk_len print("Max number of bits in BLK %d" % (max_blk_len)) if max_blk_len not in [256, 192, 128]: diff --git a/components/efuse/esp32s2beta/component.mk b/components/efuse/esp32s2beta/component.mk new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/efuse/esp32s2beta/esp_efuse_table.c b/components/efuse/esp32s2beta/esp_efuse_table.c new file mode 100644 index 0000000000..076615a85d --- /dev/null +++ b/components/efuse/esp32s2beta/esp_efuse_table.c @@ -0,0 +1,939 @@ +// Copyright 2017-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 + +#include "sdkconfig.h" +#include "esp_efuse.h" +#include +#include "esp_efuse_table.h" + +// md5_digest_table fc489601ff9b21658f4eb9c617ee072d +// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY. +// If you want to change some fields, you need to change esp_efuse_table.csv file +// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file. +// To show efuse_table run the command 'show_efuse_table'. + +static const esp_efuse_desc_t WR_DIS_RD_DIS[] = { + {EFUSE_BLK0, 0, 1}, // Write protection for RD_DIS_KEY0 RD_DIS_KEY1 RD_DIS_KEY2 RD_DIS_KEY3 RD_DIS_KEY4 RD_DIS_KEY5 RD_DIS_SYS_DATA_PART2, +}; + +static const esp_efuse_desc_t WR_DIS_DIS_RTC_RAM_BOOT[] = { + {EFUSE_BLK0, 1, 1}, // Write protection for DIS_RTC_RAM_BOOT, +}; + +static const esp_efuse_desc_t WR_DIS_GROUP_1[] = { + {EFUSE_BLK0, 2, 1}, // Write protection for DIS_ICACHE DIS_DCACHE DIS_DOWNLOAD_ICACHE DIS_DOWNLOAD_DCACHE DIS_FORCE_DOWNLOAD DIS_USB DIS_CAN DIS_BOOT_REMAP SOFT_DIS_JTAG HARD_DIS_JTAG DIS_DOWNLOAD_MANUAL_ENCRYPT, +}; + +static const esp_efuse_desc_t WR_DIS_GROUP_2[] = { + {EFUSE_BLK0, 3, 1}, // Write protection for VDD_SPI_XPD VDD_SPI_TIEH VDD_SPI_FORCE VDD_SPI_INIT VDD_SPI_DCAP WDT_DELAY_SEL, +}; + +static const esp_efuse_desc_t WR_DIS_SPI_BOOT_CRYPT_CNT[] = { + {EFUSE_BLK0, 4, 1}, // Write protection for SPI_BOOT_CRYPT_CNT, +}; + +static const esp_efuse_desc_t WR_DIS_SECURE_BOOT_KEY_REVOKE0[] = { + {EFUSE_BLK0, 5, 1}, // Write protection for SECURE_BOOT_KEY_REVOKE0, +}; + +static const esp_efuse_desc_t WR_DIS_SECURE_BOOT_KEY_REVOKE1[] = { + {EFUSE_BLK0, 6, 1}, // Write protection for SECURE_BOOT_KEY_REVOKE1, +}; + +static const esp_efuse_desc_t WR_DIS_SECURE_BOOT_KEY_REVOKE2[] = { + {EFUSE_BLK0, 7, 1}, // Write protection for SECURE_BOOT_KEY_REVOKE2, +}; + +static const esp_efuse_desc_t WR_DIS_KEY0_PURPOSE[] = { + {EFUSE_BLK0, 8, 1}, // Write protection for key_purpose. KEY0, +}; + +static const esp_efuse_desc_t WR_DIS_KEY1_PURPOSE[] = { + {EFUSE_BLK0, 9, 1}, // Write protection for key_purpose. KEY1, +}; + +static const esp_efuse_desc_t WR_DIS_KEY2_PURPOSE[] = { + {EFUSE_BLK0, 10, 1}, // Write protection for key_purpose. KEY2, +}; + +static const esp_efuse_desc_t WR_DIS_KEY3_PURPOSE[] = { + {EFUSE_BLK0, 11, 1}, // Write protection for key_purpose. KEY3, +}; + +static const esp_efuse_desc_t WR_DIS_KEY4_PURPOSE[] = { + {EFUSE_BLK0, 12, 1}, // Write protection for key_purpose. KEY4, +}; + +static const esp_efuse_desc_t WR_DIS_KEY5_PURPOSE[] = { + {EFUSE_BLK0, 13, 1}, // Write protection for key_purpose. KEY5, +}; + +static const esp_efuse_desc_t WR_DIS_SECURE_BOOT_EN[] = { + {EFUSE_BLK0, 15, 1}, // Write protection for SECURE_BOOT_EN, +}; + +static const esp_efuse_desc_t WR_DIS_SECURE_BOOT_AGGRESSIVE_REVOKE[] = { + {EFUSE_BLK0, 16, 1}, // Write protection for SECURE_BOOT_AGGRESSIVE_REVOKE, +}; + +static const esp_efuse_desc_t WR_DIS_GROUP_3[] = { + {EFUSE_BLK0, 18, 1}, // Write protection for FLASH_TPUW DIS_DOWNLOAD_MODE DIS_LEGACY_SPI_BOOT UART_PRINT_CHANNEL DIS_TINY_BASIC DIS_USB_DOWNLOAD_MODE ENABLE_SECURITY_DOWNLOAD UART_PRINT_CONTROL PIN_POWER_SELECTION FLASH_TYPE FORCE_SEND_RESUME SECURE_VERSION, +}; + +static const esp_efuse_desc_t WR_DIS_BLK1[] = { + {EFUSE_BLK0, 20, 1}, // Write protection for EFUSE_BLK1. MAC_SPI_8M_SYS, +}; + +static const esp_efuse_desc_t WR_DIS_SYS_DATA_PART1[] = { + {EFUSE_BLK0, 21, 1}, // Write protection for EFUSE_BLK2. SYS_DATA_PART1, +}; + +static const esp_efuse_desc_t WR_DIS_USER_DATA[] = { + {EFUSE_BLK0, 22, 1}, // Write protection for EFUSE_BLK3. USER_DATA, +}; + +static const esp_efuse_desc_t WR_DIS_KEY0[] = { + {EFUSE_BLK0, 23, 1}, // Write protection for EFUSE_BLK4. KEY0, +}; + +static const esp_efuse_desc_t WR_DIS_KEY1[] = { + {EFUSE_BLK0, 24, 1}, // Write protection for EFUSE_BLK5. KEY1, +}; + +static const esp_efuse_desc_t WR_DIS_KEY2[] = { + {EFUSE_BLK0, 25, 1}, // Write protection for EFUSE_BLK6. KEY2, +}; + +static const esp_efuse_desc_t WR_DIS_KEY3[] = { + {EFUSE_BLK0, 26, 1}, // Write protection for EFUSE_BLK7. KEY3, +}; + +static const esp_efuse_desc_t WR_DIS_KEY4[] = { + {EFUSE_BLK0, 27, 1}, // Write protection for EFUSE_BLK8. KEY4, +}; + +static const esp_efuse_desc_t WR_DIS_KEY5[] = { + {EFUSE_BLK0, 28, 1}, // Write protection for EFUSE_BLK9. KEY5, +}; + +static const esp_efuse_desc_t WR_DIS_SYS_DATA_PART2[] = { + {EFUSE_BLK0, 29, 1}, // Write protection for EFUSE_BLK10. SYS_DATA_PART2, +}; + +static const esp_efuse_desc_t WR_DIS_USB_EXCHG_PINS[] = { + {EFUSE_BLK0, 30, 1}, // Write protection for USB_EXCHG_PINS, +}; + +static const esp_efuse_desc_t RD_DIS_KEY0[] = { + {EFUSE_BLK0, 32, 1}, // Read protection for EFUSE_BLK4. KEY0, +}; + +static const esp_efuse_desc_t RD_DIS_KEY1[] = { + {EFUSE_BLK0, 33, 1}, // Read protection for EFUSE_BLK5. KEY1, +}; + +static const esp_efuse_desc_t RD_DIS_KEY2[] = { + {EFUSE_BLK0, 34, 1}, // Read protection for EFUSE_BLK6. KEY2, +}; + +static const esp_efuse_desc_t RD_DIS_KEY3[] = { + {EFUSE_BLK0, 35, 1}, // Read protection for EFUSE_BLK7. KEY3, +}; + +static const esp_efuse_desc_t RD_DIS_KEY4[] = { + {EFUSE_BLK0, 36, 1}, // Read protection for EFUSE_BLK8. KEY4, +}; + +static const esp_efuse_desc_t RD_DIS_KEY5[] = { + {EFUSE_BLK0, 37, 1}, // Read protection for EFUSE_BLK9. KEY5, +}; + +static const esp_efuse_desc_t RD_DIS_SYS_DATA_PART2[] = { + {EFUSE_BLK0, 38, 1}, // Read protection for EFUSE_BLK10. SYS_DATA_PART2, +}; + +static const esp_efuse_desc_t DIS_RTC_RAM_BOOT[] = { + {EFUSE_BLK0, 39, 1}, // Disable boot from RTC RAM, +}; + +static const esp_efuse_desc_t DIS_ICACHE[] = { + {EFUSE_BLK0, 40, 1}, // Disable Icache, +}; + +static const esp_efuse_desc_t DIS_DCACHE[] = { + {EFUSE_BLK0, 41, 1}, // Disable Dcace, +}; + +static const esp_efuse_desc_t DIS_DOWNLOAD_ICACHE[] = { + {EFUSE_BLK0, 42, 1}, // Disable Icache in download mode include boot_mode 0 1 2 3 6 7, +}; + +static const esp_efuse_desc_t DIS_DOWNLOAD_DCACHE[] = { + {EFUSE_BLK0, 43, 1}, // Disable Dcache in download mode include boot_mode 0 1 2 3 6 7, +}; + +static const esp_efuse_desc_t DIS_FORCE_DOWNLOAD[] = { + {EFUSE_BLK0, 44, 1}, // Disable force chip go to download mode function, +}; + +static const esp_efuse_desc_t DIS_USB[] = { + {EFUSE_BLK0, 45, 1}, // Disable USB function, +}; + +static const esp_efuse_desc_t DIS_CAN[] = { + {EFUSE_BLK0, 46, 1}, // Disable CAN function, +}; + +static const esp_efuse_desc_t DIS_BOOT_REMAP[] = { + {EFUSE_BLK0, 47, 1}, // Disable boot from RAM. REMAP means RAM space can be mapped to ROM space. this signal will disable this function, +}; + +static const esp_efuse_desc_t SOFT_DIS_JTAG[] = { + {EFUSE_BLK0, 49, 1}, // Software disable jtag jtag can be activated again by hmac module, +}; + +static const esp_efuse_desc_t HARD_DIS_JTAG[] = { + {EFUSE_BLK0, 50, 1}, // Hardware disable jtag permanently disable jtag function, +}; + +static const esp_efuse_desc_t DIS_DOWNLOAD_MANUAL_ENCRYPT[] = { + {EFUSE_BLK0, 51, 1}, // Disable flash encrypt function, +}; + +static const esp_efuse_desc_t USB_EXCHG_PINS[] = { + {EFUSE_BLK0, 56, 1}, // Exchange D+ D- pins, +}; + +static const esp_efuse_desc_t USB_EXT_PHY_ENABLE[] = { + {EFUSE_BLK0, 57, 1}, // Enable external PHY, +}; + +static const esp_efuse_desc_t VDD_SPI_XPD[] = { + {EFUSE_BLK0, 68, 1}, // VDD_SPI regulator power up, +}; + +static const esp_efuse_desc_t VDD_SPI_TIEH[] = { + {EFUSE_BLK0, 69, 1}, // VDD_SPI regulator tie high to vdda, +}; + +static const esp_efuse_desc_t VDD_SPI_FORCE[] = { + {EFUSE_BLK0, 70, 1}, // Force using eFuse configuration of VDD_SPI, +}; + +static const esp_efuse_desc_t WDT_DELAY_SEL[] = { + {EFUSE_BLK0, 80, 2}, // Select RTC WDT time out threshold, +}; + +static const esp_efuse_desc_t SPI_BOOT_CRYPT_CNT[] = { + {EFUSE_BLK0, 82, 3}, // SPI boot encrypt decrypt enable. odd number 1 enable. even number 1 disable, +}; + +static const esp_efuse_desc_t SECURE_BOOT_KEY_REVOKE0[] = { + {EFUSE_BLK0, 85, 1}, // Enable revoke first secure boot key, +}; + +static const esp_efuse_desc_t SECURE_BOOT_KEY_REVOKE1[] = { + {EFUSE_BLK0, 86, 1}, // Enable revoke second secure boot key, +}; + +static const esp_efuse_desc_t SECURE_BOOT_KEY_REVOKE2[] = { + {EFUSE_BLK0, 87, 1}, // Enable revoke third secure boot key, +}; + +static const esp_efuse_desc_t KEY_PURPOSE_0[] = { + {EFUSE_BLK0, 88, 4}, // Key0 purpose, +}; + +static const esp_efuse_desc_t KEY_PURPOSE_1[] = { + {EFUSE_BLK0, 92, 4}, // Key1 purpose, +}; + +static const esp_efuse_desc_t KEY_PURPOSE_2[] = { + {EFUSE_BLK0, 96, 4}, // Key2 purpose, +}; + +static const esp_efuse_desc_t KEY_PURPOSE_3[] = { + {EFUSE_BLK0, 100, 4}, // Key3 purpose, +}; + +static const esp_efuse_desc_t KEY_PURPOSE_4[] = { + {EFUSE_BLK0, 104, 4}, // Key4 purpose, +}; + +static const esp_efuse_desc_t KEY_PURPOSE_5[] = { + {EFUSE_BLK0, 108, 4}, // Key5 purpose, +}; + +static const esp_efuse_desc_t SECURE_BOOT_EN[] = { + {EFUSE_BLK0, 116, 1}, // Secure boot enable, +}; + +static const esp_efuse_desc_t SECURE_BOOT_AGGRESSIVE_REVOKE[] = { + {EFUSE_BLK0, 117, 1}, // Enable aggressive secure boot revoke, +}; + +static const esp_efuse_desc_t FLASH_TPUW[] = { + {EFUSE_BLK0, 124, 4}, // Flash wait time after power up. (unit is ms). When value is 15. the time is 30 ms, +}; + +static const esp_efuse_desc_t DIS_DOWNLOAD_MODE[] = { + {EFUSE_BLK0, 128, 1}, // Disble download mode include boot_mode[3:0] is 0 1 2 3 6 7, +}; + +static const esp_efuse_desc_t DIS_LEGACY_SPI_BOOT[] = { + {EFUSE_BLK0, 129, 1}, // Disable_Legcy_SPI_boot mode include boot_mode[3:0] is 4, +}; + +static const esp_efuse_desc_t UART_PRINT_CHANNEL[] = { + {EFUSE_BLK0, 130, 1}, // 0: UART0. 1: UART1, +}; + +static const esp_efuse_desc_t DIS_TINY_BASIC[] = { + {EFUSE_BLK0, 131, 1}, // Disable tiny basic console in ROM, +}; + +static const esp_efuse_desc_t DIS_USB_DOWNLOAD_MODE[] = { + {EFUSE_BLK0, 132, 1}, // Disable download through USB, +}; + +static const esp_efuse_desc_t ENABLE_SECURITY_DOWNLOAD[] = { + {EFUSE_BLK0, 133, 1}, // Enable security download mode, +}; + +static const esp_efuse_desc_t UART_PRINT_CONTROL[] = { + {EFUSE_BLK0, 134, 2}, // b00:force print. b01:control by GPIO46 - low level print. b10:control by GPIO46 - high level print. b11:force disable print., +}; + +static const esp_efuse_desc_t PIN_POWER_SELECTION[] = { + {EFUSE_BLK0, 136, 1}, // GPIO33-GPIO37 power supply selection in ROM code. 0:VDD3P3_CPU. 1:VDD_SPI., +}; + +static const esp_efuse_desc_t FLASH_TYPE[] = { + {EFUSE_BLK0, 137, 1}, // Connected Flash interface type. 0: 4 data line. 1: 8 data line, +}; + +static const esp_efuse_desc_t FORCE_SEND_RESUME[] = { + {EFUSE_BLK0, 138, 1}, // Force ROM code to send a resume command during SPI boot, +}; + +static const esp_efuse_desc_t SECURE_VERSION[] = { + {EFUSE_BLK0, 139, 16}, // Secure version for anti-rollback, +}; + +static const esp_efuse_desc_t MAC_FACTORY[] = { + {EFUSE_BLK1, 40, 8}, // Factory MAC addr [0], + {EFUSE_BLK1, 32, 8}, // Factory MAC addr [1], + {EFUSE_BLK1, 24, 8}, // Factory MAC addr [2], + {EFUSE_BLK1, 16, 8}, // Factory MAC addr [3], + {EFUSE_BLK1, 8, 8}, // Factory MAC addr [4], + {EFUSE_BLK1, 0, 8}, // Factory MAC addr [5], +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_CLK[] = { + {EFUSE_BLK1, 48, 6}, // SPI_PAD_configure CLK, +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_Q_D1[] = { + {EFUSE_BLK1, 54, 6}, // SPI_PAD_configure Q(D1), +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_D_D0[] = { + {EFUSE_BLK1, 60, 6}, // SPI_PAD_configure D(D0), +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_CS[] = { + {EFUSE_BLK1, 66, 6}, // SPI_PAD_configure CS, +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_HD_D3[] = { + {EFUSE_BLK1, 72, 6}, // SPI_PAD_configure HD(D3), +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_WP_D2[] = { + {EFUSE_BLK1, 78, 6}, // SPI_PAD_configure WP(D2), +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_DQS[] = { + {EFUSE_BLK1, 84, 6}, // SPI_PAD_configure DQS, +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_D4[] = { + {EFUSE_BLK1, 90, 6}, // SPI_PAD_configure D4, +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_D5[] = { + {EFUSE_BLK1, 96, 6}, // SPI_PAD_configure D5, +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_D6[] = { + {EFUSE_BLK1, 102, 6}, // SPI_PAD_configure D6, +}; + +static const esp_efuse_desc_t SPI_PAD_CONFIG_D7[] = { + {EFUSE_BLK1, 108, 6}, // SPI_PAD_configure D7, +}; + +static const esp_efuse_desc_t CLK8M_FREQ[] = { + {EFUSE_BLK1, 114, 12}, // The frequency of 8M CLK (0.01MHz), +}; + +static const esp_efuse_desc_t SYS_DATA_PART0[] = { + {EFUSE_BLK1, 126, 66}, // System configuration, +}; + +static const esp_efuse_desc_t SYS_DATA_PART1[] = { + {EFUSE_BLK2, 0, 256}, // System configuration, +}; + +static const esp_efuse_desc_t USER_DATA[] = { + {EFUSE_BLK3, 0, 256}, // User data, +}; + +static const esp_efuse_desc_t KEY0[] = { + {EFUSE_BLK4, 0, 256}, // Key0 or user data, +}; + +static const esp_efuse_desc_t KEY1[] = { + {EFUSE_BLK5, 0, 256}, // Key1 or user data, +}; + +static const esp_efuse_desc_t KEY2[] = { + {EFUSE_BLK6, 0, 256}, // Key2 or user data, +}; + +static const esp_efuse_desc_t KEY3[] = { + {EFUSE_BLK7, 0, 256}, // Key3 or user data, +}; + +static const esp_efuse_desc_t KEY4[] = { + {EFUSE_BLK8, 0, 256}, // Key4 or user data, +}; + +static const esp_efuse_desc_t KEY5[] = { + {EFUSE_BLK9, 0, 256}, // Key5 or user data, +}; + +static const esp_efuse_desc_t SYS_DATA_PART2[] = { + {EFUSE_BLK10, 0, 256}, // System configuration, +}; + + + + + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_RD_DIS[] = { + &WR_DIS_RD_DIS[0], // Write protection for RD_DIS_KEY0 RD_DIS_KEY1 RD_DIS_KEY2 RD_DIS_KEY3 RD_DIS_KEY4 RD_DIS_KEY5 RD_DIS_SYS_DATA_PART2 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_DIS_RTC_RAM_BOOT[] = { + &WR_DIS_DIS_RTC_RAM_BOOT[0], // Write protection for DIS_RTC_RAM_BOOT + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_GROUP_1[] = { + &WR_DIS_GROUP_1[0], // Write protection for DIS_ICACHE DIS_DCACHE DIS_DOWNLOAD_ICACHE DIS_DOWNLOAD_DCACHE DIS_FORCE_DOWNLOAD DIS_USB DIS_CAN DIS_BOOT_REMAP SOFT_DIS_JTAG HARD_DIS_JTAG DIS_DOWNLOAD_MANUAL_ENCRYPT + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_GROUP_2[] = { + &WR_DIS_GROUP_2[0], // Write protection for VDD_SPI_XPD VDD_SPI_TIEH VDD_SPI_FORCE VDD_SPI_INIT VDD_SPI_DCAP WDT_DELAY_SEL + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SPI_BOOT_CRYPT_CNT[] = { + &WR_DIS_SPI_BOOT_CRYPT_CNT[0], // Write protection for SPI_BOOT_CRYPT_CNT + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SECURE_BOOT_KEY_REVOKE0[] = { + &WR_DIS_SECURE_BOOT_KEY_REVOKE0[0], // Write protection for SECURE_BOOT_KEY_REVOKE0 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SECURE_BOOT_KEY_REVOKE1[] = { + &WR_DIS_SECURE_BOOT_KEY_REVOKE1[0], // Write protection for SECURE_BOOT_KEY_REVOKE1 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SECURE_BOOT_KEY_REVOKE2[] = { + &WR_DIS_SECURE_BOOT_KEY_REVOKE2[0], // Write protection for SECURE_BOOT_KEY_REVOKE2 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY0_PURPOSE[] = { + &WR_DIS_KEY0_PURPOSE[0], // Write protection for key_purpose. KEY0 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY1_PURPOSE[] = { + &WR_DIS_KEY1_PURPOSE[0], // Write protection for key_purpose. KEY1 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY2_PURPOSE[] = { + &WR_DIS_KEY2_PURPOSE[0], // Write protection for key_purpose. KEY2 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY3_PURPOSE[] = { + &WR_DIS_KEY3_PURPOSE[0], // Write protection for key_purpose. KEY3 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY4_PURPOSE[] = { + &WR_DIS_KEY4_PURPOSE[0], // Write protection for key_purpose. KEY4 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY5_PURPOSE[] = { + &WR_DIS_KEY5_PURPOSE[0], // Write protection for key_purpose. KEY5 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SECURE_BOOT_EN[] = { + &WR_DIS_SECURE_BOOT_EN[0], // Write protection for SECURE_BOOT_EN + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SECURE_BOOT_AGGRESSIVE_REVOKE[] = { + &WR_DIS_SECURE_BOOT_AGGRESSIVE_REVOKE[0], // Write protection for SECURE_BOOT_AGGRESSIVE_REVOKE + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_GROUP_3[] = { + &WR_DIS_GROUP_3[0], // Write protection for FLASH_TPUW DIS_DOWNLOAD_MODE DIS_LEGACY_SPI_BOOT UART_PRINT_CHANNEL DIS_TINY_BASIC DIS_USB_DOWNLOAD_MODE ENABLE_SECURITY_DOWNLOAD UART_PRINT_CONTROL PIN_POWER_SELECTION FLASH_TYPE FORCE_SEND_RESUME SECURE_VERSION + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_BLK1[] = { + &WR_DIS_BLK1[0], // Write protection for EFUSE_BLK1. MAC_SPI_8M_SYS + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SYS_DATA_PART1[] = { + &WR_DIS_SYS_DATA_PART1[0], // Write protection for EFUSE_BLK2. SYS_DATA_PART1 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_USER_DATA[] = { + &WR_DIS_USER_DATA[0], // Write protection for EFUSE_BLK3. USER_DATA + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY0[] = { + &WR_DIS_KEY0[0], // Write protection for EFUSE_BLK4. KEY0 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY1[] = { + &WR_DIS_KEY1[0], // Write protection for EFUSE_BLK5. KEY1 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY2[] = { + &WR_DIS_KEY2[0], // Write protection for EFUSE_BLK6. KEY2 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY3[] = { + &WR_DIS_KEY3[0], // Write protection for EFUSE_BLK7. KEY3 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY4[] = { + &WR_DIS_KEY4[0], // Write protection for EFUSE_BLK8. KEY4 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY5[] = { + &WR_DIS_KEY5[0], // Write protection for EFUSE_BLK9. KEY5 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SYS_DATA_PART2[] = { + &WR_DIS_SYS_DATA_PART2[0], // Write protection for EFUSE_BLK10. SYS_DATA_PART2 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_USB_EXCHG_PINS[] = { + &WR_DIS_USB_EXCHG_PINS[0], // Write protection for USB_EXCHG_PINS + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY0[] = { + &RD_DIS_KEY0[0], // Read protection for EFUSE_BLK4. KEY0 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY1[] = { + &RD_DIS_KEY1[0], // Read protection for EFUSE_BLK5. KEY1 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY2[] = { + &RD_DIS_KEY2[0], // Read protection for EFUSE_BLK6. KEY2 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY3[] = { + &RD_DIS_KEY3[0], // Read protection for EFUSE_BLK7. KEY3 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY4[] = { + &RD_DIS_KEY4[0], // Read protection for EFUSE_BLK8. KEY4 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY5[] = { + &RD_DIS_KEY5[0], // Read protection for EFUSE_BLK9. KEY5 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_SYS_DATA_PART2[] = { + &RD_DIS_SYS_DATA_PART2[0], // Read protection for EFUSE_BLK10. SYS_DATA_PART2 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_RTC_RAM_BOOT[] = { + &DIS_RTC_RAM_BOOT[0], // Disable boot from RTC RAM + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_ICACHE[] = { + &DIS_ICACHE[0], // Disable Icache + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_DCACHE[] = { + &DIS_DCACHE[0], // Disable Dcace + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_ICACHE[] = { + &DIS_DOWNLOAD_ICACHE[0], // Disable Icache in download mode include boot_mode 0 1 2 3 6 7 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_DCACHE[] = { + &DIS_DOWNLOAD_DCACHE[0], // Disable Dcache in download mode include boot_mode 0 1 2 3 6 7 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_FORCE_DOWNLOAD[] = { + &DIS_FORCE_DOWNLOAD[0], // Disable force chip go to download mode function + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_USB[] = { + &DIS_USB[0], // Disable USB function + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_CAN[] = { + &DIS_CAN[0], // Disable CAN function + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_BOOT_REMAP[] = { + &DIS_BOOT_REMAP[0], // Disable boot from RAM. REMAP means RAM space can be mapped to ROM space. this signal will disable this function + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SOFT_DIS_JTAG[] = { + &SOFT_DIS_JTAG[0], // Software disable jtag jtag can be activated again by hmac module + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_HARD_DIS_JTAG[] = { + &HARD_DIS_JTAG[0], // Hardware disable jtag permanently disable jtag function + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT[] = { + &DIS_DOWNLOAD_MANUAL_ENCRYPT[0], // Disable flash encrypt function + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_USB_EXCHG_PINS[] = { + &USB_EXCHG_PINS[0], // Exchange D+ D- pins + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_USB_EXT_PHY_ENABLE[] = { + &USB_EXT_PHY_ENABLE[0], // Enable external PHY + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_VDD_SPI_XPD[] = { + &VDD_SPI_XPD[0], // VDD_SPI regulator power up + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_VDD_SPI_TIEH[] = { + &VDD_SPI_TIEH[0], // VDD_SPI regulator tie high to vdda + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_VDD_SPI_FORCE[] = { + &VDD_SPI_FORCE[0], // Force using eFuse configuration of VDD_SPI + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_WDT_DELAY_SEL[] = { + &WDT_DELAY_SEL[0], // Select RTC WDT time out threshold + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_BOOT_CRYPT_CNT[] = { + &SPI_BOOT_CRYPT_CNT[0], // SPI boot encrypt decrypt enable. odd number 1 enable. even number 1 disable + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_KEY_REVOKE0[] = { + &SECURE_BOOT_KEY_REVOKE0[0], // Enable revoke first secure boot key + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_KEY_REVOKE1[] = { + &SECURE_BOOT_KEY_REVOKE1[0], // Enable revoke second secure boot key + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_KEY_REVOKE2[] = { + &SECURE_BOOT_KEY_REVOKE2[0], // Enable revoke third secure boot key + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_0[] = { + &KEY_PURPOSE_0[0], // Key0 purpose + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_1[] = { + &KEY_PURPOSE_1[0], // Key1 purpose + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_2[] = { + &KEY_PURPOSE_2[0], // Key2 purpose + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_3[] = { + &KEY_PURPOSE_3[0], // Key3 purpose + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_4[] = { + &KEY_PURPOSE_4[0], // Key4 purpose + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_5[] = { + &KEY_PURPOSE_5[0], // Key5 purpose + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_EN[] = { + &SECURE_BOOT_EN[0], // Secure boot enable + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE[] = { + &SECURE_BOOT_AGGRESSIVE_REVOKE[0], // Enable aggressive secure boot revoke + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_FLASH_TPUW[] = { + &FLASH_TPUW[0], // Flash wait time after power up. (unit is ms). When value is 15. the time is 30 ms + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_MODE[] = { + &DIS_DOWNLOAD_MODE[0], // Disble download mode include boot_mode[3:0] is 0 1 2 3 6 7 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_LEGACY_SPI_BOOT[] = { + &DIS_LEGACY_SPI_BOOT[0], // Disable_Legcy_SPI_boot mode include boot_mode[3:0] is 4 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CHANNEL[] = { + &UART_PRINT_CHANNEL[0], // 0: UART0. 1: UART1 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_TINY_BASIC[] = { + &DIS_TINY_BASIC[0], // Disable tiny basic console in ROM + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_DIS_USB_DOWNLOAD_MODE[] = { + &DIS_USB_DOWNLOAD_MODE[0], // Disable download through USB + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_ENABLE_SECURITY_DOWNLOAD[] = { + &ENABLE_SECURITY_DOWNLOAD[0], // Enable security download mode + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CONTROL[] = { + &UART_PRINT_CONTROL[0], // b00:force print. b01:control by GPIO46 - low level print. b10:control by GPIO46 - high level print. b11:force disable print. + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_PIN_POWER_SELECTION[] = { + &PIN_POWER_SELECTION[0], // GPIO33-GPIO37 power supply selection in ROM code. 0:VDD3P3_CPU. 1:VDD_SPI. + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_FLASH_TYPE[] = { + &FLASH_TYPE[0], // Connected Flash interface type. 0: 4 data line. 1: 8 data line + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_FORCE_SEND_RESUME[] = { + &FORCE_SEND_RESUME[0], // Force ROM code to send a resume command during SPI boot + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SECURE_VERSION[] = { + &SECURE_VERSION[0], // Secure version for anti-rollback + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_MAC_FACTORY[] = { + &MAC_FACTORY[0], // Factory MAC addr [0] + &MAC_FACTORY[1], // Factory MAC addr [1] + &MAC_FACTORY[2], // Factory MAC addr [2] + &MAC_FACTORY[3], // Factory MAC addr [3] + &MAC_FACTORY[4], // Factory MAC addr [4] + &MAC_FACTORY[5], // Factory MAC addr [5] + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_CLK[] = { + &SPI_PAD_CONFIG_CLK[0], // SPI_PAD_configure CLK + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_Q_D1[] = { + &SPI_PAD_CONFIG_Q_D1[0], // SPI_PAD_configure Q(D1) + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D_D0[] = { + &SPI_PAD_CONFIG_D_D0[0], // SPI_PAD_configure D(D0) + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_CS[] = { + &SPI_PAD_CONFIG_CS[0], // SPI_PAD_configure CS + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_HD_D3[] = { + &SPI_PAD_CONFIG_HD_D3[0], // SPI_PAD_configure HD(D3) + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_WP_D2[] = { + &SPI_PAD_CONFIG_WP_D2[0], // SPI_PAD_configure WP(D2) + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_DQS[] = { + &SPI_PAD_CONFIG_DQS[0], // SPI_PAD_configure DQS + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D4[] = { + &SPI_PAD_CONFIG_D4[0], // SPI_PAD_configure D4 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D5[] = { + &SPI_PAD_CONFIG_D5[0], // SPI_PAD_configure D5 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D6[] = { + &SPI_PAD_CONFIG_D6[0], // SPI_PAD_configure D6 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D7[] = { + &SPI_PAD_CONFIG_D7[0], // SPI_PAD_configure D7 + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_CLK8M_FREQ[] = { + &CLK8M_FREQ[0], // The frequency of 8M CLK (0.01MHz) + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART0[] = { + &SYS_DATA_PART0[0], // System configuration + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART1[] = { + &SYS_DATA_PART1[0], // System configuration + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_USER_DATA[] = { + &USER_DATA[0], // User data + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY0[] = { + &KEY0[0], // Key0 or user data + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY1[] = { + &KEY1[0], // Key1 or user data + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY2[] = { + &KEY2[0], // Key2 or user data + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY3[] = { + &KEY3[0], // Key3 or user data + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY4[] = { + &KEY4[0], // Key4 or user data + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_KEY5[] = { + &KEY5[0], // Key5 or user data + NULL +}; + +const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART2[] = { + &SYS_DATA_PART2[0], // System configuration + NULL +}; + diff --git a/components/efuse/esp32s2beta/esp_efuse_table.csv b/components/efuse/esp32s2beta/esp_efuse_table.csv new file mode 100644 index 0000000000..0f95ec7055 --- /dev/null +++ b/components/efuse/esp32s2beta/esp_efuse_table.csv @@ -0,0 +1,138 @@ +# field_name, | efuse_block, | bit_start, | bit_count, |comment # +# | (EFUSE_BLK0 | (0..255) | (1..-) | # +# | EFUSE_BLK1 | |MAX_BLK_LEN*| # +# | ... | | | # +# | EFUSE_BLK10)| | | # +########################################################################## +# *) The value MAX_BLK_LEN depends on CONFIG_EFUSE_MAX_BLK_LEN, will be replaced with "None" - 256. "3/4" - 192. "REPEAT" - 128. +# !!!!!!!!!!! # +# After editing this file, run the command manually "make efuse_common_table" or "idf.py efuse_common_table" +# this will generate new source files, next rebuild all the sources. +# !!!!!!!!!!! # + +# EFUSE_RD_REPEAT_DATA BLOCK # +############################## + # EFUSE_RD_WR_DIS_REG # + # EFUSE_WR_DIS [WR_DIS 0 32] # + WR_DIS_RD_DIS, EFUSE_BLK0, 0, 1, Write protection for RD_DIS_KEY0 RD_DIS_KEY1 RD_DIS_KEY2 RD_DIS_KEY3 RD_DIS_KEY4 RD_DIS_KEY5 RD_DIS_SYS_DATA_PART2 + WR_DIS_DIS_RTC_RAM_BOOT, EFUSE_BLK0, 1, 1, Write protection for DIS_RTC_RAM_BOOT + WR_DIS_GROUP_1, EFUSE_BLK0, 2, 1, Write protection for DIS_ICACHE DIS_DCACHE DIS_DOWNLOAD_ICACHE DIS_DOWNLOAD_DCACHE DIS_FORCE_DOWNLOAD DIS_USB DIS_CAN DIS_BOOT_REMAP SOFT_DIS_JTAG HARD_DIS_JTAG DIS_DOWNLOAD_MANUAL_ENCRYPT + WR_DIS_GROUP_2, EFUSE_BLK0, 3, 1, Write protection for VDD_SPI_XPD VDD_SPI_TIEH VDD_SPI_FORCE VDD_SPI_INIT VDD_SPI_DCAP WDT_DELAY_SEL + WR_DIS_SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 4, 1, Write protection for SPI_BOOT_CRYPT_CNT + WR_DIS_SECURE_BOOT_KEY_REVOKE0,EFUSE_BLK0, 5, 1, Write protection for SECURE_BOOT_KEY_REVOKE0 + WR_DIS_SECURE_BOOT_KEY_REVOKE1,EFUSE_BLK0, 6, 1, Write protection for SECURE_BOOT_KEY_REVOKE1 + WR_DIS_SECURE_BOOT_KEY_REVOKE2,EFUSE_BLK0, 7, 1, Write protection for SECURE_BOOT_KEY_REVOKE2 + WR_DIS_KEY0_PURPOSE, EFUSE_BLK0, 8, 1, Write protection for key_purpose. KEY0 + WR_DIS_KEY1_PURPOSE, EFUSE_BLK0, 9, 1, Write protection for key_purpose. KEY1 + WR_DIS_KEY2_PURPOSE, EFUSE_BLK0, 10, 1, Write protection for key_purpose. KEY2 + WR_DIS_KEY3_PURPOSE, EFUSE_BLK0, 11, 1, Write protection for key_purpose. KEY3 + WR_DIS_KEY4_PURPOSE, EFUSE_BLK0, 12, 1, Write protection for key_purpose. KEY4 + WR_DIS_KEY5_PURPOSE, EFUSE_BLK0, 13, 1, Write protection for key_purpose. KEY5 + WR_DIS_SECURE_BOOT_EN, EFUSE_BLK0, 15, 1, Write protection for SECURE_BOOT_EN + WR_DIS_SECURE_BOOT_AGGRESSIVE_REVOKE,EFUSE_BLK0, 16, 1, Write protection for SECURE_BOOT_AGGRESSIVE_REVOKE + WR_DIS_GROUP_3, EFUSE_BLK0, 18, 1, Write protection for FLASH_TPUW DIS_DOWNLOAD_MODE DIS_LEGACY_SPI_BOOT UART_PRINT_CHANNEL DIS_TINY_BASIC DIS_USB_DOWNLOAD_MODE ENABLE_SECURITY_DOWNLOAD UART_PRINT_CONTROL PIN_POWER_SELECTION FLASH_TYPE FORCE_SEND_RESUME SECURE_VERSION + WR_DIS_BLK1, EFUSE_BLK0, 20, 1, Write protection for EFUSE_BLK1. MAC_SPI_8M_SYS + WR_DIS_SYS_DATA_PART1, EFUSE_BLK0, 21, 1, Write protection for EFUSE_BLK2. SYS_DATA_PART1 + WR_DIS_USER_DATA, EFUSE_BLK0, 22, 1, Write protection for EFUSE_BLK3. USER_DATA + WR_DIS_KEY0, EFUSE_BLK0, 23, 1, Write protection for EFUSE_BLK4. KEY0 + WR_DIS_KEY1, EFUSE_BLK0, 24, 1, Write protection for EFUSE_BLK5. KEY1 + WR_DIS_KEY2, EFUSE_BLK0, 25, 1, Write protection for EFUSE_BLK6. KEY2 + WR_DIS_KEY3, EFUSE_BLK0, 26, 1, Write protection for EFUSE_BLK7. KEY3 + WR_DIS_KEY4, EFUSE_BLK0, 27, 1, Write protection for EFUSE_BLK8. KEY4 + WR_DIS_KEY5, EFUSE_BLK0, 28, 1, Write protection for EFUSE_BLK9. KEY5 + WR_DIS_SYS_DATA_PART2, EFUSE_BLK0, 29, 1, Write protection for EFUSE_BLK10. SYS_DATA_PART2 + WR_DIS_USB_EXCHG_PINS, EFUSE_BLK0, 30, 1, Write protection for USB_EXCHG_PINS + + # EFUSE_RD_REPEAT_DATA0_REG # + # [RD_DIS 0 7] # + RD_DIS_KEY0, EFUSE_BLK0, 32, 1, Read protection for EFUSE_BLK4. KEY0 + RD_DIS_KEY1, EFUSE_BLK0, 33, 1, Read protection for EFUSE_BLK5. KEY1 + RD_DIS_KEY2, EFUSE_BLK0, 34, 1, Read protection for EFUSE_BLK6. KEY2 + RD_DIS_KEY3, EFUSE_BLK0, 35, 1, Read protection for EFUSE_BLK7. KEY3 + RD_DIS_KEY4, EFUSE_BLK0, 36, 1, Read protection for EFUSE_BLK8. KEY4 + RD_DIS_KEY5, EFUSE_BLK0, 37, 1, Read protection for EFUSE_BLK9. KEY5 + RD_DIS_SYS_DATA_PART2, EFUSE_BLK0, 38, 1, Read protection for EFUSE_BLK10. SYS_DATA_PART2 + DIS_RTC_RAM_BOOT, EFUSE_BLK0, 39, 1, Disable boot from RTC RAM + DIS_ICACHE, EFUSE_BLK0, 40, 1, Disable Icache + DIS_DCACHE, EFUSE_BLK0, 41, 1, Disable Dcace + DIS_DOWNLOAD_ICACHE, EFUSE_BLK0, 42, 1, Disable Icache in download mode include boot_mode 0 1 2 3 6 7 + DIS_DOWNLOAD_DCACHE, EFUSE_BLK0, 43, 1, Disable Dcache in download mode include boot_mode 0 1 2 3 6 7 + DIS_FORCE_DOWNLOAD, EFUSE_BLK0, 44, 1, Disable force chip go to download mode function + DIS_USB, EFUSE_BLK0, 45, 1, Disable USB function + DIS_CAN, EFUSE_BLK0, 46, 1, Disable CAN function + DIS_BOOT_REMAP, EFUSE_BLK0, 47, 1, Disable boot from RAM. REMAP means RAM space can be mapped to ROM space. this signal will disable this function + SOFT_DIS_JTAG, EFUSE_BLK0, 49, 1, Software disable jtag jtag can be activated again by hmac module + HARD_DIS_JTAG, EFUSE_BLK0, 50, 1, Hardware disable jtag permanently disable jtag function + DIS_DOWNLOAD_MANUAL_ENCRYPT, EFUSE_BLK0, 51, 1, Disable flash encrypt function, other than SPI/Legacy SPI boot mode + USB_EXCHG_PINS, EFUSE_BLK0, 56, 1, Exchange D+ D- pins + USB_EXT_PHY_ENABLE, EFUSE_BLK0, 57, 1, Enable external PHY + + # EFUSE_RD_REPEAT_DATA1_REG # + VDD_SPI_XPD, EFUSE_BLK0, 68, 1, VDD_SPI regulator power up + VDD_SPI_TIEH, EFUSE_BLK0, 69, 1, VDD_SPI regulator tie high to vdda + VDD_SPI_FORCE, EFUSE_BLK0, 70, 1, Force using eFuse configuration of VDD_SPI + WDT_DELAY_SEL, EFUSE_BLK0, 80, 2, Select RTC WDT time out threshold + SPI_BOOT_CRYPT_CNT, EFUSE_BLK0, 82, 3, SPI boot encrypt decrypt enable. odd number 1 enable. even number 1 disable + SECURE_BOOT_KEY_REVOKE0, EFUSE_BLK0, 85, 1, Enable revoke first secure boot key + SECURE_BOOT_KEY_REVOKE1, EFUSE_BLK0, 86, 1, Enable revoke second secure boot key + SECURE_BOOT_KEY_REVOKE2, EFUSE_BLK0, 87, 1, Enable revoke third secure boot key + KEY_PURPOSE_0, EFUSE_BLK0, 88, 4, Key0 purpose + KEY_PURPOSE_1, EFUSE_BLK0, 92, 4, Key1 purpose + + # EFUSE_RD_REPEAT_DATA2_REG # + KEY_PURPOSE_2, EFUSE_BLK0, 96, 4, Key2 purpose + KEY_PURPOSE_3, EFUSE_BLK0, 100, 4, Key3 purpose + KEY_PURPOSE_4, EFUSE_BLK0, 104, 4, Key4 purpose + KEY_PURPOSE_5, EFUSE_BLK0, 108, 4, Key5 purpose + SECURE_BOOT_EN, EFUSE_BLK0, 116, 1, Secure boot enable + SECURE_BOOT_AGGRESSIVE_REVOKE, EFUSE_BLK0, 117, 1, Enable aggressive secure boot revoke + FLASH_TPUW, EFUSE_BLK0, 124, 4, Flash wait time after power up. (unit is ms). When value is 15. the time is 30 ms + + # EFUSE_RD_REPEAT_DATA3_REG # + DIS_DOWNLOAD_MODE, EFUSE_BLK0, 128, 1, Disble download mode include boot_mode[3:0] is 0 1 2 3 6 7 + DIS_LEGACY_SPI_BOOT, EFUSE_BLK0, 129, 1, Disable_Legcy_SPI_boot mode include boot_mode[3:0] is 4 + UART_PRINT_CHANNEL, EFUSE_BLK0, 130, 1, 0: UART0. 1: UART1 + DIS_TINY_BASIC, EFUSE_BLK0, 131, 1, Disable tiny basic console in ROM + DIS_USB_DOWNLOAD_MODE, EFUSE_BLK0, 132, 1, Disable download through USB + ENABLE_SECURITY_DOWNLOAD, EFUSE_BLK0, 133, 1, Enable security download mode + UART_PRINT_CONTROL, EFUSE_BLK0, 134, 2, b00:force print. b01:control by GPIO46 - low level print. b10:control by GPIO46 - high level print. b11:force disable print. + PIN_POWER_SELECTION, EFUSE_BLK0, 136, 1, GPIO33-GPIO37 power supply selection in ROM code. 0:VDD3P3_CPU. 1:VDD_SPI. + FLASH_TYPE, EFUSE_BLK0, 137, 1, Connected Flash interface type. 0: 4 data line. 1: 8 data line + FORCE_SEND_RESUME, EFUSE_BLK0, 138, 1, Force ROM code to send a resume command during SPI boot + SECURE_VERSION, EFUSE_BLK0, 139, 16, Secure version for anti-rollback + + # EFUSE_RD_REPEAT_DATA4_REG # + + +# MAC_SPI_8M_SYS BLOCK# +####################### + MAC_FACTORY, EFUSE_BLK1, 40, 8, Factory MAC addr [0] + , EFUSE_BLK1, 32, 8, Factory MAC addr [1] + , EFUSE_BLK1, 24, 8, Factory MAC addr [2] + , EFUSE_BLK1, 16, 8, Factory MAC addr [3] + , EFUSE_BLK1, 8, 8, Factory MAC addr [4] + , EFUSE_BLK1, 0, 8, Factory MAC addr [5] + SPI_PAD_CONFIG_CLK, EFUSE_BLK1, 48, 6, SPI_PAD_configure CLK + SPI_PAD_CONFIG_Q_D1, EFUSE_BLK1, 54, 6, SPI_PAD_configure Q(D1) + SPI_PAD_CONFIG_D_D0, EFUSE_BLK1, 60, 6, SPI_PAD_configure D(D0) + SPI_PAD_CONFIG_CS, EFUSE_BLK1, 66, 6, SPI_PAD_configure CS + SPI_PAD_CONFIG_HD_D3, EFUSE_BLK1, 72, 6, SPI_PAD_configure HD(D3) + SPI_PAD_CONFIG_WP_D2, EFUSE_BLK1, 78, 6, SPI_PAD_configure WP(D2) + SPI_PAD_CONFIG_DQS, EFUSE_BLK1, 84, 6, SPI_PAD_configure DQS + SPI_PAD_CONFIG_D4, EFUSE_BLK1, 90, 6, SPI_PAD_configure D4 + SPI_PAD_CONFIG_D5, EFUSE_BLK1, 96, 6, SPI_PAD_configure D5 + SPI_PAD_CONFIG_D6, EFUSE_BLK1, 102, 6, SPI_PAD_configure D6 + SPI_PAD_CONFIG_D7, EFUSE_BLK1, 108, 6, SPI_PAD_configure D7 + CLK8M_FREQ, EFUSE_BLK1, 114, 12, The frequency of 8M CLK (0.01MHz) + SYS_DATA_PART0, EFUSE_BLK1, 126, 66, System configuration + +################ +SYS_DATA_PART1, EFUSE_BLK2, 0, 256, System configuration +USER_DATA, EFUSE_BLK3, 0, 256, User data +KEY0, EFUSE_BLK4, 0, 256, Key0 or user data +KEY1, EFUSE_BLK5, 0, 256, Key1 or user data +KEY2, EFUSE_BLK6, 0, 256, Key2 or user data +KEY3, EFUSE_BLK7, 0, 256, Key3 or user data +KEY4, EFUSE_BLK8, 0, 256, Key4 or user data +KEY5, EFUSE_BLK9, 0, 256, Key5 or user data +SYS_DATA_PART2, EFUSE_BLK10, 0, 256, System configuration \ No newline at end of file diff --git a/components/efuse/esp32s2beta/include/esp_efuse_table.h b/components/efuse/esp32s2beta/include/esp_efuse_table.h new file mode 100644 index 0000000000..3eaf5600cd --- /dev/null +++ b/components/efuse/esp32s2beta/include/esp_efuse_table.h @@ -0,0 +1,131 @@ +// Copyright 2017-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 + +#ifdef __cplusplus +extern "C" { +#endif + + +// md5_digest_table fc489601ff9b21658f4eb9c617ee072d +// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY. +// If you want to change some fields, you need to change esp_efuse_table.csv file +// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file. +// To show efuse_table run the command 'show_efuse_table'. + + +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_RD_DIS[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_DIS_RTC_RAM_BOOT[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_GROUP_1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_GROUP_2[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SPI_BOOT_CRYPT_CNT[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SECURE_BOOT_KEY_REVOKE0[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SECURE_BOOT_KEY_REVOKE1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SECURE_BOOT_KEY_REVOKE2[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY0_PURPOSE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY1_PURPOSE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY2_PURPOSE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY3_PURPOSE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY4_PURPOSE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY5_PURPOSE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SECURE_BOOT_EN[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SECURE_BOOT_AGGRESSIVE_REVOKE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_GROUP_3[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_BLK1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SYS_DATA_PART1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_USER_DATA[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY0[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY2[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY3[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY4[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_KEY5[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SYS_DATA_PART2[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_USB_EXCHG_PINS[]; +extern const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY0[]; +extern const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY2[]; +extern const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY3[]; +extern const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY4[]; +extern const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_KEY5[]; +extern const esp_efuse_desc_t* ESP_EFUSE_RD_DIS_SYS_DATA_PART2[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_RTC_RAM_BOOT[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_ICACHE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_DCACHE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_ICACHE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_DCACHE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_FORCE_DOWNLOAD[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_USB[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_CAN[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_BOOT_REMAP[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SOFT_DIS_JTAG[]; +extern const esp_efuse_desc_t* ESP_EFUSE_HARD_DIS_JTAG[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT[]; +extern const esp_efuse_desc_t* ESP_EFUSE_USB_EXCHG_PINS[]; +extern const esp_efuse_desc_t* ESP_EFUSE_USB_EXT_PHY_ENABLE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_VDD_SPI_XPD[]; +extern const esp_efuse_desc_t* ESP_EFUSE_VDD_SPI_TIEH[]; +extern const esp_efuse_desc_t* ESP_EFUSE_VDD_SPI_FORCE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_WDT_DELAY_SEL[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_BOOT_CRYPT_CNT[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_KEY_REVOKE0[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_KEY_REVOKE1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_KEY_REVOKE2[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_0[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_2[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_3[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_4[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY_PURPOSE_5[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_EN[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_TPUW[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_DOWNLOAD_MODE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_LEGACY_SPI_BOOT[]; +extern const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CHANNEL[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_TINY_BASIC[]; +extern const esp_efuse_desc_t* ESP_EFUSE_DIS_USB_DOWNLOAD_MODE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_ENABLE_SECURITY_DOWNLOAD[]; +extern const esp_efuse_desc_t* ESP_EFUSE_UART_PRINT_CONTROL[]; +extern const esp_efuse_desc_t* ESP_EFUSE_PIN_POWER_SELECTION[]; +extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_TYPE[]; +extern const esp_efuse_desc_t* ESP_EFUSE_FORCE_SEND_RESUME[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SECURE_VERSION[]; +extern const esp_efuse_desc_t* ESP_EFUSE_MAC_FACTORY[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_CLK[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_Q_D1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D_D0[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_CS[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_HD_D3[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_WP_D2[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_DQS[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D4[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D5[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D6[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SPI_PAD_CONFIG_D7[]; +extern const esp_efuse_desc_t* ESP_EFUSE_CLK8M_FREQ[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART0[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_USER_DATA[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY0[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY1[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY2[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY3[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY4[]; +extern const esp_efuse_desc_t* ESP_EFUSE_KEY5[]; +extern const esp_efuse_desc_t* ESP_EFUSE_SYS_DATA_PART2[]; + +#ifdef __cplusplus +} +#endif + diff --git a/components/efuse/esp32s2beta/sources.cmake b/components/efuse/esp32s2beta/sources.cmake new file mode 100644 index 0000000000..492216be21 --- /dev/null +++ b/components/efuse/esp32s2beta/sources.cmake @@ -0,0 +1 @@ +set(EFUSE_SOC_SRCS "esp_efuse_table.c") \ No newline at end of file diff --git a/components/efuse/include/esp32/esp_efuse.h b/components/efuse/include/esp32/esp_efuse.h new file mode 100644 index 0000000000..43531820a9 --- /dev/null +++ b/components/efuse/include/esp32/esp_efuse.h @@ -0,0 +1,44 @@ +// Copyright 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. + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Type of eFuse blocks for ESP32 + */ +typedef enum { + EFUSE_BLK0 = 0, /**< Number of eFuse block. Reserved. */ + EFUSE_BLK1 = 1, /**< Number of eFuse block. Used for Flash Encryption. If not using that Flash Encryption feature, they can be used for another purpose. */ + EFUSE_BLK2 = 2, /**< Number of eFuse block. Used for Secure Boot. If not using that Secure Boot feature, they can be used for another purpose. */ + EFUSE_BLK3 = 3, /**< Number of eFuse block. Uses for the purpose of the user. */ + EFUSE_BLK_MAX +} esp_efuse_block_t; + +/** + * @brief Type of coding scheme + */ +typedef enum { + EFUSE_CODING_SCHEME_NONE = 0, /**< None */ + EFUSE_CODING_SCHEME_3_4 = 1, /**< 3/4 coding */ + EFUSE_CODING_SCHEME_REPEAT = 2, /**< Repeat coding */ +} esp_efuse_coding_scheme_t; + + +#ifdef __cplusplus +} +#endif diff --git a/components/efuse/include/esp32s2beta/esp_efuse.h b/components/efuse/include/esp32s2beta/esp_efuse.h new file mode 100644 index 0000000000..94fbb21686 --- /dev/null +++ b/components/efuse/include/esp32s2beta/esp_efuse.h @@ -0,0 +1,69 @@ +// Copyright 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. + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Type of eFuse blocks ESP32S2BETA + */ +typedef enum { + EFUSE_BLK0 = 0, /**< Number of eFuse BLOCK0. REPEAT_DATA */ + + EFUSE_BLK1 = 1, /**< Number of eFuse BLOCK1. MAC_SPI_8M_SYS */ + + EFUSE_BLK2 = 2, /**< Number of eFuse BLOCK2. SYS_DATA_PART1 */ + EFUSE_BLK_SYS_DATA_PART1 = 2, /**< Number of eFuse BLOCK2. SYS_DATA_PART1 */ + + EFUSE_BLK3 = 3, /**< Number of eFuse BLOCK3. USER_DATA*/ + EFUSE_BLK_USER_DATA = 3, /**< Number of eFuse BLOCK3. USER_DATA*/ + + EFUSE_BLK4 = 4, /**< Number of eFuse BLOCK4. KEY0 */ + EFUSE_BLK_KEY0 = 4, /**< Number of eFuse BLOCK4. KEY0 */ + + EFUSE_BLK5 = 5, /**< Number of eFuse BLOCK5. KEY1 */ + EFUSE_BLK_KEY1 = 5, /**< Number of eFuse BLOCK5. KEY1 */ + + EFUSE_BLK6 = 6, /**< Number of eFuse BLOCK6. KEY2 */ + EFUSE_BLK_KEY2 = 6, /**< Number of eFuse BLOCK6. KEY2 */ + + EFUSE_BLK7 = 7, /**< Number of eFuse BLOCK7. KEY3 */ + EFUSE_BLK_KEY3 = 7, /**< Number of eFuse BLOCK7. KEY3 */ + + EFUSE_BLK8 = 8, /**< Number of eFuse BLOCK8. KEY4 */ + EFUSE_BLK_KEY4 = 8, /**< Number of eFuse BLOCK8. KEY4 */ + + EFUSE_BLK9 = 9, /**< Number of eFuse BLOCK9. KEY5 */ + EFUSE_BLK_KEY5 = 9, /**< Number of eFuse BLOCK9. KEY5 */ + + EFUSE_BLK10 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */ + EFUSE_BLK_SYS_DATA_PART2 = 10, /**< Number of eFuse BLOCK10. SYS_DATA_PART2 */ + + EFUSE_BLK_MAX +} esp_efuse_block_t; + +/** + * @brief Type of coding scheme + */ +typedef enum { + EFUSE_CODING_SCHEME_NONE = 0, /**< None */ + EFUSE_CODING_SCHEME_RS = 3, /**< Reed-Solomon coding */ +} esp_efuse_coding_scheme_t; + +#ifdef __cplusplus +} +#endif diff --git a/components/efuse/include/esp_efuse.h b/components/efuse/include/esp_efuse.h index 0d7ed8373a..f1497dc26d 100644 --- a/components/efuse/include/esp_efuse.h +++ b/components/efuse/include/esp_efuse.h @@ -12,8 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef _ESP_EFUSE_MANAGER_H_ -#define _ESP_EFUSE_MANAGER_H_ +#pragma once #ifdef __cplusplus extern "C" { @@ -22,6 +21,12 @@ extern "C" { #include #include "esp_err.h" #include "esp_log.h" +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/esp_efuse.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/esp_efuse.h" +#endif #define ESP_ERR_EFUSE 0x1600 /*!< Base error code for efuse api. */ #define ESP_OK_EFUSE_CNT (ESP_ERR_EFUSE + 0x01) /*!< OK the required number of bits is set. */ @@ -29,25 +34,6 @@ extern "C" { #define ESP_ERR_EFUSE_REPEATED_PROG (ESP_ERR_EFUSE + 0x03) /*!< Error repeated programming of programmed bits is strictly forbidden. */ #define ESP_ERR_CODING (ESP_ERR_EFUSE + 0x04) /*!< Error while a encoding operation. */ -/** - * @brief Type of eFuse blocks - */ -typedef enum { - EFUSE_BLK0 = 0, /**< Number of eFuse block. Reserved. */ - EFUSE_BLK1 = 1, /**< Number of eFuse block. Used for Flash Encryption. If not using that Flash Encryption feature, they can be used for another purpose. */ - EFUSE_BLK2 = 2, /**< Number of eFuse block. Used for Secure Boot. If not using that Secure Boot feature, they can be used for another purpose. */ - EFUSE_BLK3 = 3 /**< Number of eFuse block. Uses for the purpose of the user. */ -} esp_efuse_block_t; - -/** - * @brief Type of coding scheme - */ -typedef enum { - EFUSE_CODING_SCHEME_NONE = 0, /**< None */ - EFUSE_CODING_SCHEME_3_4 = 1, /**< 3/4 coding */ - EFUSE_CODING_SCHEME_REPEAT = 2, /**< Repeat coding */ -} esp_efuse_coding_scheme_t; - /** * @brief Structure eFuse field */ @@ -287,20 +273,6 @@ void esp_efuse_reset(void); */ void esp_efuse_disable_basic_rom_console(void); -/* @brief Encode one or more sets of 6 byte sequences into - * 8 bytes suitable for 3/4 Coding Scheme. - * - * This function is only useful if the CODING_SCHEME efuse - * is set to value 1 for 3/4 Coding Scheme. - * - * @param[in] in_bytes Pointer to a sequence of bytes to encode for 3/4 Coding Scheme. Must have length in_bytes_len. After being written to hardware, these bytes will read back as little-endian words. - * @param[out] out_words Pointer to array of words suitable for writing to efuse write registers. Array must contain 2 words (8 bytes) for every 6 bytes in in_bytes_len. Can be a pointer to efuse write registers. - * @param in_bytes_len. Length of array pointed to by in_bytes, in bytes. Must be a multiple of 6. - * - * @return ESP_ERR_INVALID_ARG if either pointer is null or in_bytes_len is not a multiple of 6. ESP_OK otherwise. - */ -esp_err_t esp_efuse_apply_34_encoding(const uint8_t *in_bytes, uint32_t *out_words, size_t in_bytes_len); - /* @brief Write random data to efuse key block write registers * * @note Caller is responsible for ensuring efuse @@ -358,5 +330,3 @@ void esp_efuse_init(uint32_t offset, uint32_t size); #ifdef __cplusplus } #endif - -#endif // _ESP_EFUSE_MANAGER_H_ diff --git a/components/efuse/private_include/esp32/esp_efuse_utility.h b/components/efuse/private_include/esp32/esp_efuse_utility.h new file mode 100644 index 0000000000..36f23e6117 --- /dev/null +++ b/components/efuse/private_include/esp32/esp_efuse_utility.h @@ -0,0 +1,49 @@ +// Copyright 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. + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#define COUNT_EFUSE_BLOCKS 4 /* The number of blocks. */ +#define COUNT_EFUSE_REG_PER_BLOCK 8 /* The number of registers per block. */ + +#define ESP_EFUSE_SECURE_VERSION_NUM_BLOCK EFUSE_BLK3 + +#define ESP_EFUSE_FIELD_CORRESPONDS_CODING_SCHEME(blk, max_num_bit) \ + esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(blk); \ + if ((scheme == EFUSE_CODING_SCHEME_3_4 && max_num_bit > 192) || \ + (scheme == EFUSE_CODING_SCHEME_REPEAT && max_num_bit > 128)) { \ + return false; \ + } + +/* @brief Encode one or more sets of 6 byte sequences into + * 8 bytes suitable for 3/4 Coding Scheme. + * + * This function is only useful if the CODING_SCHEME efuse + * is set to value 1 for 3/4 Coding Scheme. + * + * @param[in] in_bytes Pointer to a sequence of bytes to encode for 3/4 Coding Scheme. Must have length in_bytes_len. After being written to hardware, these bytes will read back as little-endian words. + * @param[out] out_words Pointer to array of words suitable for writing to efuse write registers. Array must contain 2 words (8 bytes) for every 6 bytes in in_bytes_len. Can be a pointer to efuse write registers. + * @param in_bytes_len. Length of array pointed to by in_bytes, in bytes. Must be a multiple of 6. + * + * @return ESP_ERR_INVALID_ARG if either pointer is null or in_bytes_len is not a multiple of 6. ESP_OK otherwise. + */ +esp_err_t esp_efuse_utility_apply_34_encoding(const uint8_t *in_bytes, uint32_t *out_words, size_t in_bytes_len); + +#ifdef __cplusplus +} +#endif diff --git a/components/efuse/private_include/esp32s2beta/esp_efuse_utility.h b/components/efuse/private_include/esp32s2beta/esp_efuse_utility.h new file mode 100644 index 0000000000..a573d75041 --- /dev/null +++ b/components/efuse/private_include/esp32s2beta/esp_efuse_utility.h @@ -0,0 +1,30 @@ +// Copyright 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. + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#define COUNT_EFUSE_BLOCKS 11 /* The number of blocks. */ +#define COUNT_EFUSE_REG_PER_BLOCK 8 /* The number of registers per block. */ + +#define ESP_EFUSE_SECURE_VERSION_NUM_BLOCK EFUSE_BLK0 + +#define ESP_EFUSE_FIELD_CORRESPONDS_CODING_SCHEME(scheme, max_num_bit) + +#ifdef __cplusplus +} +#endif diff --git a/components/efuse/src/esp_efuse_utility.h b/components/efuse/private_include/esp_efuse_utility.h similarity index 91% rename from components/efuse/src/esp_efuse_utility.h rename to components/efuse/private_include/esp_efuse_utility.h index eadd80e02f..c6b2e691a7 100644 --- a/components/efuse/src/esp_efuse_utility.h +++ b/components/efuse/private_include/esp_efuse_utility.h @@ -12,8 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef _ESP_EFUSE_UTILITY_H_ -#define _ESP_EFUSE_UTILITY_H_ +#pragma once #ifdef __cplusplus extern "C" { @@ -23,6 +22,20 @@ extern "C" { #include "esp_types.h" #include "esp_err.h" #include "esp_efuse.h" +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/esp_efuse_utility.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/esp_efuse_utility.h" +#endif + +/** + * @brief Structure range address by blocks + */ +typedef struct { + uint32_t start; + uint32_t end; +} esp_efuse_range_addr_t; /** * @brief This is type of function that will handle the efuse field register. @@ -133,8 +146,11 @@ void esp_efuse_utility_erase_virt_blocks(void); */ esp_err_t esp_efuse_utility_apply_new_coding_scheme(void); +/** + * @brief Efuse read operation: copies data from physical efuses to efuse read registers. + */ +void esp_efuse_utility_clear_program_registers(void); + #ifdef __cplusplus } #endif - -#endif // _ESP_EFUSE_UTILITY_H_ diff --git a/components/efuse/src/esp32/esp_efuse_api.c b/components/efuse/src/esp32/esp_efuse_api.c new file mode 100644 index 0000000000..5cc14d7708 --- /dev/null +++ b/components/efuse/src/esp32/esp_efuse_api.c @@ -0,0 +1,69 @@ +// Copyright 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. + +#include "esp_efuse.h" +#include "esp_efuse_utility.h" +#include "soc/efuse_periph.h" +#include "assert.h" +#include "sdkconfig.h" +#include "esp_efuse_table.h" + +const static char *TAG = "efuse"; + +// Sets a write protection for the whole block. +esp_err_t esp_efuse_set_write_protect(esp_efuse_block_t blk) +{ + if (blk == EFUSE_BLK1) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_BLK1, 1); + } else if (blk == EFUSE_BLK2) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_BLK2, 1); + } else if (blk == EFUSE_BLK3) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_BLK3, 1); + } + return ESP_ERR_NOT_SUPPORTED; +} + +// read protect for blk. +esp_err_t esp_efuse_set_read_protect(esp_efuse_block_t blk) +{ + if (blk == EFUSE_BLK1) { + return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_BLK1, 1); + } else if (blk == EFUSE_BLK2) { + return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_BLK2, 1); + } else if (blk == EFUSE_BLK3) { + return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_BLK3, 1); + } + return ESP_ERR_NOT_SUPPORTED; +} + +// get efuse coding_scheme. +esp_efuse_coding_scheme_t esp_efuse_get_coding_scheme(esp_efuse_block_t blk) +{ + esp_efuse_coding_scheme_t scheme; + if (blk == EFUSE_BLK0) { + scheme = EFUSE_CODING_SCHEME_NONE; + } else { + uint32_t coding_scheme = REG_GET_FIELD(EFUSE_BLK0_RDATA6_REG, EFUSE_CODING_SCHEME); + if (coding_scheme == EFUSE_CODING_SCHEME_VAL_NONE || + coding_scheme == (EFUSE_CODING_SCHEME_VAL_34 | EFUSE_CODING_SCHEME_VAL_REPEAT)) { + scheme = EFUSE_CODING_SCHEME_NONE; + } else if (coding_scheme == EFUSE_CODING_SCHEME_VAL_34) { + scheme = EFUSE_CODING_SCHEME_3_4; + } else { + scheme = EFUSE_CODING_SCHEME_REPEAT; + } + } + ESP_LOGD(TAG, "coding scheme %d", scheme); + return scheme; +} diff --git a/components/efuse/src/esp32/esp_efuse_fields.c b/components/efuse/src/esp32/esp_efuse_fields.c new file mode 100644 index 0000000000..79d6044b59 --- /dev/null +++ b/components/efuse/src/esp32/esp_efuse_fields.c @@ -0,0 +1,102 @@ +// Copyright 2017-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. + +#include "esp_efuse.h" +#include "esp_efuse_utility.h" +#include "esp_efuse_table.h" +#include "stdlib.h" +#include "esp_types.h" +#include "esp32/rom/efuse.h" +#include "assert.h" +#include "esp_err.h" +#include "esp_log.h" +#include "soc/efuse_periph.h" +#include "bootloader_random.h" +#include "sys/param.h" +#include "soc/apb_ctrl_reg.h" + +const static char *TAG = "efuse"; + +// Contains functions that provide access to efuse fields which are often used in IDF. + +// Returns chip version from efuse +uint8_t esp_efuse_get_chip_ver(void) +{ + uint8_t eco_bit0, eco_bit1, eco_bit2; + esp_efuse_read_field_blob(ESP_EFUSE_CHIP_VER_REV1, &eco_bit0, 1); + esp_efuse_read_field_blob(ESP_EFUSE_CHIP_VER_REV2, &eco_bit1, 1); + eco_bit2 = (REG_READ(APB_CTRL_DATE_REG) & 0x80000000) >> 31; + uint32_t combine_value = (eco_bit2 << 2) | (eco_bit1 << 1) | eco_bit0; + uint8_t chip_ver = 0; + switch (combine_value) { + case 0: + chip_ver = 0; + break; + case 1: + chip_ver = 1; + break; + case 3: + chip_ver = 2; + break; + case 7: + chip_ver = 3; + break; + default: + chip_ver = 0; + break; + } + return chip_ver; +} + +// Returns chip package from efuse +uint32_t esp_efuse_get_pkg_ver(void) +{ + uint32_t pkg_ver = 0; + esp_efuse_read_field_blob(ESP_EFUSE_CHIP_VER_PKG, &pkg_ver, 3); + return pkg_ver; +} + +// Disable BASIC ROM Console via efuse +void esp_efuse_disable_basic_rom_console(void) +{ + uint8_t console_debug_disable = 0; + esp_efuse_read_field_blob(ESP_EFUSE_CONSOLE_DEBUG_DISABLE, &console_debug_disable, 1); + if (console_debug_disable == 0) { + esp_efuse_write_field_cnt(ESP_EFUSE_CONSOLE_DEBUG_DISABLE, 1); + ESP_EARLY_LOGI(TAG, "Disable BASIC ROM Console fallback via efuse..."); + } +} + +void esp_efuse_write_random_key(uint32_t blk_wdata0_reg) +{ + uint32_t buf[8]; + uint8_t raw[24]; + + if (esp_efuse_get_coding_scheme(EFUSE_BLK2) == EFUSE_CODING_SCHEME_NONE) { + bootloader_fill_random(buf, sizeof(buf)); + } else { // 3/4 Coding Scheme + bootloader_fill_random(raw, sizeof(raw)); + esp_err_t r = esp_efuse_utility_apply_34_encoding(raw, buf, sizeof(raw)); + (void) r; + assert(r == ESP_OK); + } + + ESP_LOGV(TAG, "Writing random values to address 0x%08x", blk_wdata0_reg); + for (int i = 0; i < 8; i++) { + ESP_LOGV(TAG, "EFUSE_BLKx_WDATA%d_REG = 0x%08x", i, buf[i]); + REG_WRITE(blk_wdata0_reg + 4*i, buf[i]); + } + bzero(buf, sizeof(buf)); + bzero(raw, sizeof(raw)); +} diff --git a/components/efuse/src/esp32/esp_efuse_utility.c b/components/efuse/src/esp32/esp_efuse_utility.c new file mode 100644 index 0000000000..2983ea9589 --- /dev/null +++ b/components/efuse/src/esp32/esp_efuse_utility.c @@ -0,0 +1,234 @@ +// Copyright 2017-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. + +#include "esp_efuse_utility.h" +#include "soc/efuse_periph.h" +#include "esp32/clk.h" +#include "esp_log.h" +#include "assert.h" +#include "sdkconfig.h" +#include + +static const char *TAG = "efuse"; + +#ifdef CONFIG_EFUSE_VIRTUAL +extern uint32_t virt_blocks[COUNT_EFUSE_BLOCKS][COUNT_EFUSE_REG_PER_BLOCK]; +#endif // CONFIG_EFUSE_VIRTUAL + +/*Range addresses to read blocks*/ +const esp_efuse_range_addr_t range_read_addr_blocks[] = { + {EFUSE_BLK0_RDATA0_REG, EFUSE_BLK0_RDATA6_REG}, // range address of EFUSE_BLK0 + {EFUSE_BLK1_RDATA0_REG, EFUSE_BLK1_RDATA7_REG}, // range address of EFUSE_BLK1 + {EFUSE_BLK2_RDATA0_REG, EFUSE_BLK2_RDATA7_REG}, // range address of EFUSE_BLK2 + {EFUSE_BLK3_RDATA0_REG, EFUSE_BLK3_RDATA7_REG} // range address of EFUSE_BLK3 +}; + +/*Range addresses to write blocks*/ +const esp_efuse_range_addr_t range_write_addr_blocks[] = { + {EFUSE_BLK0_WDATA0_REG, EFUSE_BLK0_WDATA6_REG}, // range address of EFUSE_BLK0 + {EFUSE_BLK1_WDATA0_REG, EFUSE_BLK1_WDATA7_REG}, // range address of EFUSE_BLK1 + {EFUSE_BLK2_WDATA0_REG, EFUSE_BLK2_WDATA7_REG}, // range address of EFUSE_BLK2 + {EFUSE_BLK3_WDATA0_REG, EFUSE_BLK3_WDATA7_REG} // range address of EFUSE_BLK3 +}; + +#define EFUSE_CONF_WRITE 0x5A5A /* eFuse_pgm_op_ena, force no rd/wr disable. */ +#define EFUSE_CONF_READ 0x5AA5 /* eFuse_read_op_ena, release force. */ +#define EFUSE_CMD_PGM 0x02 /* Command to program. */ +#define EFUSE_CMD_READ 0x01 /* Command to read. */ + +#ifndef CONFIG_EFUSE_VIRTUAL +// Update Efuse timing configuration +static esp_err_t esp_efuse_set_timing(void) +{ + uint32_t apb_freq_mhz = esp_clk_apb_freq() / 1000000; + uint32_t clk_sel0, clk_sel1, dac_clk_div; + if (apb_freq_mhz <= 26) { + clk_sel0 = 250; + clk_sel1 = 255; + dac_clk_div = 52; + } else if (apb_freq_mhz <= 40) { + clk_sel0 = 160; + clk_sel1 = 255; + dac_clk_div = 80; + } else { + clk_sel0 = 80; + clk_sel1 = 128; + dac_clk_div = 100; + } + REG_SET_FIELD(EFUSE_DAC_CONF_REG, EFUSE_DAC_CLK_DIV, dac_clk_div); + REG_SET_FIELD(EFUSE_CLK_REG, EFUSE_CLK_SEL0, clk_sel0); + REG_SET_FIELD(EFUSE_CLK_REG, EFUSE_CLK_SEL1, clk_sel1); + return ESP_OK; +} +#endif // ifndef CONFIG_EFUSE_VIRTUAL + +// Efuse read operation: copies data from physical efuses to efuse read registers. +void esp_efuse_utility_clear_program_registers(void) +{ + REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_READ); +} + +// Burn values written to the efuse write registers +void esp_efuse_utility_burn_efuses(void) +{ +#ifdef CONFIG_EFUSE_VIRTUAL + ESP_LOGW(TAG, "Virtual efuses enabled: Not really burning eFuses"); + for (int num_block = 0; num_block < COUNT_EFUSE_BLOCKS; num_block++) { + esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block); + if (scheme == EFUSE_CODING_SCHEME_3_4) { + uint8_t buf[COUNT_EFUSE_REG_PER_BLOCK * 4] = { 0 }; + int i = 0; + for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4, ++i) { + *((uint32_t*)buf + i) = REG_READ(addr_wr_block); + } + int j = 0; + uint32_t out_buf[COUNT_EFUSE_REG_PER_BLOCK] = { 0 }; + for (int k = 0; k < 4; ++k, ++j) { + memcpy((uint8_t*)out_buf + j * 6, &buf[k * 8], 6); + } + for (int k = 0; k < COUNT_EFUSE_REG_PER_BLOCK; ++k) { + REG_WRITE(range_write_addr_blocks[num_block].start + k * 4, out_buf[k]); + } + } + int subblock = 0; + for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) { + virt_blocks[num_block][subblock++] |= REG_READ(addr_wr_block); + } + } +#else + esp_efuse_set_timing(); + // Permanently update values written to the efuse write registers + REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_WRITE); + REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_PGM); + while (REG_READ(EFUSE_CMD_REG) != 0) {}; + REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_READ); + REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_READ); + while (REG_READ(EFUSE_CMD_REG) != 0) {}; +#endif // CONFIG_EFUSE_VIRTUAL + esp_efuse_utility_reset(); +} + +esp_err_t esp_efuse_utility_apply_34_encoding(const uint8_t *in_bytes, uint32_t *out_words, size_t in_bytes_len) +{ + if (in_bytes == NULL || out_words == NULL || in_bytes_len % 6 != 0) { + return ESP_ERR_INVALID_ARG; + } + + while (in_bytes_len > 0) { + uint8_t out[8]; + uint8_t xor = 0; + uint8_t mul = 0; + for (int i = 0; i < 6; i++) { + xor ^= in_bytes[i]; + mul += (i + 1) * __builtin_popcount(in_bytes[i]); + } + + memcpy(out, in_bytes, 6); // Data bytes + out[6] = xor; + out[7] = mul; + + memcpy(out_words, out, 8); + + in_bytes_len -= 6; + in_bytes += 6; + out_words += 2; + } + + return ESP_OK; +} + +static bool read_w_data_and_check_fill(esp_efuse_block_t num_block, uint32_t *buf_w_data) +{ + bool blk_is_filled = false; + int i = 0; + for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4, ++i) { + buf_w_data[i] = REG_READ(addr_wr_block); + if (buf_w_data[i] != 0) { + REG_WRITE(addr_wr_block, 0); + blk_is_filled = true; + } + } + return blk_is_filled; +} + +static void read_r_data(esp_efuse_block_t num_block, uint32_t* buf_r_data) +{ + int i = 0; + for (uint32_t addr_rd_block = range_read_addr_blocks[num_block].start; addr_rd_block <= range_read_addr_blocks[num_block].end; addr_rd_block += 4, ++i) { + buf_r_data[i] = esp_efuse_utility_read_reg(num_block, i); + } +} + +// After esp_efuse_write.. functions EFUSE_BLKx_WDATAx_REG were filled is not coded values. +// This function reads EFUSE_BLKx_WDATAx_REG registers, applies coding scheme and writes encoded values back to EFUSE_BLKx_WDATAx_REG. +esp_err_t esp_efuse_utility_apply_new_coding_scheme() +{ + uint8_t buf_w_data[COUNT_EFUSE_REG_PER_BLOCK * 4]; + uint8_t buf_r_data[COUNT_EFUSE_REG_PER_BLOCK * 4]; + uint32_t reg[COUNT_EFUSE_REG_PER_BLOCK]; + // start with EFUSE_BLK1. EFUSE_BLK0 - always uses EFUSE_CODING_SCHEME_NONE. + for (int num_block = 1; num_block < COUNT_EFUSE_BLOCKS; num_block++) { + esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block); + // check and apply a new coding scheme. + if (scheme != EFUSE_CODING_SCHEME_NONE) { + memset(buf_w_data, 0, sizeof(buf_w_data)); + memset((uint8_t*)reg, 0, sizeof(reg)); + if (read_w_data_and_check_fill(num_block, (uint32_t*)buf_w_data) == true) { + read_r_data(num_block, (uint32_t*)buf_r_data); + if (scheme == EFUSE_CODING_SCHEME_3_4) { + if (*((uint32_t*)buf_w_data + 6) != 0 || *((uint32_t*)buf_w_data + 7) != 0) { + return ESP_ERR_CODING; + } + for (int i = 0; i < 24; ++i) { + if (buf_w_data[i] != 0) { + int st_offset_buf = (i / 6) * 6; + // check that place is free. + for (int n = st_offset_buf; n < st_offset_buf + 6; ++n) { + if (buf_r_data[n] != 0) { + ESP_LOGE(TAG, "Bits are not empty. Write operation is forbidden."); + return ESP_ERR_CODING; + } + } + + esp_err_t err = esp_efuse_utility_apply_34_encoding(&buf_w_data[st_offset_buf], reg, 6); + if (err != ESP_OK) { + return err; + } + + int num_reg = (st_offset_buf / 6) * 2; + for (int r = 0; r < 2; r++) { + REG_WRITE(range_write_addr_blocks[num_block].start + (num_reg + r) * 4, reg[r]); + } + i = st_offset_buf + 5; + } + } + } else if (scheme == EFUSE_CODING_SCHEME_REPEAT) { + uint32_t* buf_32 = (uint32_t*)buf_w_data; + for (int i = 4; i < 8; ++i) { + if (*(buf_32 + i) != 0) { + return ESP_ERR_CODING; + } + } + for (int i = 0; i < 4; ++i) { + if (buf_32[i] != 0) { + REG_WRITE(range_write_addr_blocks[num_block].start + i * 4, buf_32[i]); + REG_WRITE(range_write_addr_blocks[num_block].start + (i + 4) * 4, buf_32[i]); + } + } + } + } + } + } + return ESP_OK; +} diff --git a/components/efuse/src/esp32s2beta/esp_efuse_api.c b/components/efuse/src/esp32s2beta/esp_efuse_api.c new file mode 100644 index 0000000000..9eaeade7a5 --- /dev/null +++ b/components/efuse/src/esp32s2beta/esp_efuse_api.c @@ -0,0 +1,83 @@ +// Copyright 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. + +#include "esp_efuse.h" +#include "esp_efuse_utility.h" +#include "soc/efuse_periph.h" +#include "assert.h" +#include "sdkconfig.h" +#include "esp_efuse_table.h" + +const static char *TAG = "efuse"; + +// Sets a write protection for the whole block. +esp_err_t esp_efuse_set_write_protect(esp_efuse_block_t blk) +{ + if (blk == EFUSE_BLK1) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_BLK1, 1); + } else if (blk == EFUSE_BLK2) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_SYS_DATA_PART1, 1); + } else if (blk == EFUSE_BLK3) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_USER_DATA, 1); + } else if (blk == EFUSE_BLK4) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_KEY0, 1); + } else if (blk == EFUSE_BLK5) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_KEY1, 1); + } else if (blk == EFUSE_BLK6) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_KEY2, 1); + } else if (blk == EFUSE_BLK7) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_KEY3, 1); + } else if (blk == EFUSE_BLK8) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_KEY4, 1); + } else if (blk == EFUSE_BLK9) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_KEY5, 1); + } else if (blk == EFUSE_BLK10) { + return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_SYS_DATA_PART2, 1); + } + return ESP_ERR_NOT_SUPPORTED; +} + +// read protect for blk. +esp_err_t esp_efuse_set_read_protect(esp_efuse_block_t blk) +{ + if (blk == EFUSE_BLK4) { + return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_KEY0, 1); + } else if (blk == EFUSE_BLK5) { + return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_KEY1, 1); + } else if (blk == EFUSE_BLK6) { + return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_KEY2, 1); + } else if (blk == EFUSE_BLK7) { + return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_KEY3, 1); + } else if (blk == EFUSE_BLK8) { + return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_KEY4, 1); + } else if (blk == EFUSE_BLK9) { + return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_KEY5, 1); + } else if (blk == EFUSE_BLK10) { + return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_SYS_DATA_PART2, 1); + } + return ESP_ERR_NOT_SUPPORTED; +} + +// get efuse coding_scheme. +esp_efuse_coding_scheme_t esp_efuse_get_coding_scheme(esp_efuse_block_t blk) +{ + esp_efuse_coding_scheme_t scheme; + if (blk == EFUSE_BLK0) { + scheme = EFUSE_CODING_SCHEME_NONE; + } else { + scheme = EFUSE_CODING_SCHEME_RS; + } + ESP_LOGD(TAG, "coding scheme %d", scheme); + return scheme; +} diff --git a/components/efuse/src/esp32s2beta/esp_efuse_fields.c b/components/efuse/src/esp32s2beta/esp_efuse_fields.c new file mode 100644 index 0000000000..be4f111dfb --- /dev/null +++ b/components/efuse/src/esp32s2beta/esp_efuse_fields.c @@ -0,0 +1,76 @@ +// Copyright 2017-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. + +#include "esp_efuse.h" +#include "esp_efuse_utility.h" +#include "esp_efuse_table.h" +#include "stdlib.h" +#include "esp_types.h" +#include "esp32/rom/efuse.h" +#include "assert.h" +#include "esp_err.h" +#include "esp_log.h" +#include "soc/efuse_periph.h" +#include "bootloader_random.h" +#include "sys/param.h" + +const static char *TAG = "efuse"; + +// Contains functions that provide access to efuse fields which are often used in IDF. + +// Returns chip version from efuse +uint8_t esp_efuse_get_chip_ver(void) +{ + uint32_t chip_ver = 0; + // TODO: ESP32S2BETA does not have this field + return chip_ver; +} + +// Returns chip package from efuse +uint32_t esp_efuse_get_pkg_ver(void) +{ + uint32_t pkg_ver = 0; + // TODO: ESP32S2BETA does not have this field + return pkg_ver; +} + +// Disable BASIC ROM Console via efuse +void esp_efuse_disable_basic_rom_console(void) +{ + uint8_t dis_tiny_basic = 0; + uint8_t dis_legacy_spi_boot = 0; + esp_efuse_read_field_blob(ESP_EFUSE_DIS_TINY_BASIC, &dis_tiny_basic, 1); + esp_efuse_read_field_blob(ESP_EFUSE_DIS_LEGACY_SPI_BOOT, &dis_legacy_spi_boot, 1); + if (dis_tiny_basic == 0 || dis_legacy_spi_boot == 0) { + esp_efuse_write_field_cnt(ESP_EFUSE_DIS_TINY_BASIC, 1); + esp_efuse_write_field_cnt(ESP_EFUSE_DIS_LEGACY_SPI_BOOT, 1); + ESP_EARLY_LOGI(TAG, "Disable tiny basic console in ROM and Disable_Legcy_SPI_boot mode..."); + } +} + +void esp_efuse_write_random_key(uint32_t blk_wdata0_reg) +{ + uint32_t buf[8]; + uint8_t raw[24]; + + bootloader_fill_random(buf, sizeof(buf)); + + ESP_LOGV(TAG, "Writing random values to address 0x%08x", blk_wdata0_reg); + for (int i = 0; i < 8; i++) { + ESP_LOGV(TAG, "EFUSE_BLKx_WDATA%d_REG = 0x%08x", i, buf[i]); + REG_WRITE(blk_wdata0_reg + 4*i, buf[i]); + } + bzero(buf, sizeof(buf)); + bzero(raw, sizeof(raw)); +} diff --git a/components/efuse/src/esp32s2beta/esp_efuse_utility.c b/components/efuse/src/esp32s2beta/esp_efuse_utility.c new file mode 100644 index 0000000000..d741384f54 --- /dev/null +++ b/components/efuse/src/esp32s2beta/esp_efuse_utility.c @@ -0,0 +1,178 @@ +// Copyright 2017-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. + +#include "esp_efuse_utility.h" +#include "soc/efuse_periph.h" +#include "esp32s2beta/clk.h" +#include "esp_log.h" +#include "assert.h" +#include "sdkconfig.h" +#include +#include "esp32s2beta/rom/efuse.h" + +static const char *TAG = "efuse"; + +#ifdef CONFIG_EFUSE_VIRTUAL +extern uint32_t virt_blocks[COUNT_EFUSE_BLOCKS][COUNT_EFUSE_REG_PER_BLOCK]; +#endif // CONFIG_EFUSE_VIRTUAL + +/*Range addresses to read blocks*/ +const esp_efuse_range_addr_t range_read_addr_blocks[] = { + {EFUSE_RD_WR_DIS_REG, EFUSE_RD_REPEAT_DATA4_REG}, // range address of EFUSE_BLK0 REPEAT + {EFUSE_RD_MAC_SPI_8M_0_REG, EFUSE_RD_MAC_SPI_8M_5_REG}, // range address of EFUSE_BLK1 MAC_SPI_8M + {EFUSE_RD_SYS_DATA0_REG, EFUSE_RD_SYS_DATA7_REG}, // range address of EFUSE_BLK2 SYS_DATA + {EFUSE_RD_USR_DATA0_REG, EFUSE_RD_USR_DATA7_REG}, // range address of EFUSE_BLK3 USR_DATA + {EFUSE_RD_KEY0_DATA0_REG, EFUSE_RD_KEY0_DATA7_REG}, // range address of EFUSE_BLK4 KEY0 + {EFUSE_RD_KEY1_DATA0_REG, EFUSE_RD_KEY1_DATA7_REG}, // range address of EFUSE_BLK5 KEY1 + {EFUSE_RD_KEY2_DATA0_REG, EFUSE_RD_KEY2_DATA7_REG}, // range address of EFUSE_BLK6 KEY2 + {EFUSE_RD_KEY3_DATA0_REG, EFUSE_RD_KEY3_DATA7_REG}, // range address of EFUSE_BLK7 KEY3 + {EFUSE_RD_KEY4_DATA0_REG, EFUSE_RD_KEY4_DATA7_REG}, // range address of EFUSE_BLK8 KEY4 + {EFUSE_RD_KEY5_DATA0_REG, EFUSE_RD_KEY5_DATA7_REG}, // range address of EFUSE_BLK9 KEY5 + {EFUSE_RD_KEY6_DATA0_REG, EFUSE_RD_KEY6_DATA7_REG} // range address of EFUSE_BLK10 KEY6 +}; + +static uint32_t write_mass_blocks[COUNT_EFUSE_BLOCKS][COUNT_EFUSE_REG_PER_BLOCK] = { 0 }; + +/*Range addresses to write blocks (it is not real regs, it is buffer) */ +const esp_efuse_range_addr_t range_write_addr_blocks[] = { + {(uint32_t)&write_mass_blocks[EFUSE_BLK0][0], (uint32_t)&write_mass_blocks[EFUSE_BLK0][5]}, + {(uint32_t)&write_mass_blocks[EFUSE_BLK1][0], (uint32_t)&write_mass_blocks[EFUSE_BLK1][5]}, + {(uint32_t)&write_mass_blocks[EFUSE_BLK2][0], (uint32_t)&write_mass_blocks[EFUSE_BLK2][7]}, + {(uint32_t)&write_mass_blocks[EFUSE_BLK3][0], (uint32_t)&write_mass_blocks[EFUSE_BLK3][7]}, + {(uint32_t)&write_mass_blocks[EFUSE_BLK4][0], (uint32_t)&write_mass_blocks[EFUSE_BLK4][7]}, + {(uint32_t)&write_mass_blocks[EFUSE_BLK5][0], (uint32_t)&write_mass_blocks[EFUSE_BLK5][7]}, + {(uint32_t)&write_mass_blocks[EFUSE_BLK6][0], (uint32_t)&write_mass_blocks[EFUSE_BLK6][7]}, + {(uint32_t)&write_mass_blocks[EFUSE_BLK7][0], (uint32_t)&write_mass_blocks[EFUSE_BLK7][7]}, + {(uint32_t)&write_mass_blocks[EFUSE_BLK8][0], (uint32_t)&write_mass_blocks[EFUSE_BLK8][7]}, + {(uint32_t)&write_mass_blocks[EFUSE_BLK9][0], (uint32_t)&write_mass_blocks[EFUSE_BLK9][7]}, + {(uint32_t)&write_mass_blocks[EFUSE_BLK10][0], (uint32_t)&write_mass_blocks[EFUSE_BLK10][7]}, +}; + +#ifndef CONFIG_EFUSE_VIRTUAL +// Update Efuse timing configuration +static esp_err_t esp_efuse_set_timing(void) +{ + uint32_t clock = esp_clk_apb_freq(); + // ets_efuse_set_timing(clock); + uint32_t clk_div, power_on; + //uint32_t power_off; // Support for 7.2.3 chip + uint32_t tsup_a = 1, thp_a = 1, tpgm, tpgm_inact; + uint32_t tsur_a = 1, thr_a = 1, trd; + if (clock == 20000000 || clock == 5000000 || clock == 10000000) { + clk_div = 0x28; + power_on = 0x2880; + //power_off = 0x40; + tpgm = 0xc8; + tpgm_inact = 1; + trd = 1; + } else if (clock == 40000000) { + clk_div = 0x50; + power_on = 0x5100; + //power_off = 0x80; + tpgm = 0x190; + tpgm_inact = 2; + trd = 2; + } else if (clock == 80000000) { + clk_div = 0xa0; + power_on = 0xa200; + //power_off = 0x100; + tpgm = 0x320; + tpgm_inact = 3; + trd = 3; + } else { + ESP_LOGE(TAG, "Efuse does not support this %d Hz APB clock", clock); + return ESP_ERR_NOT_SUPPORTED; + } + REG_SET_FIELD(EFUSE_DAC_CONF_REG, EFUSE_DAC_CLK_DIV, clk_div); + REG_SET_FIELD(EFUSE_WR_TIM_CONF0_REG, EFUSE_TPGM, tpgm); + REG_SET_FIELD(EFUSE_WR_TIM_CONF0_REG, EFUSE_TPGM_INACTIVE, tpgm_inact); + REG_SET_FIELD(EFUSE_WR_TIM_CONF0_REG, EFUSE_THP_A, thp_a); + REG_SET_FIELD(EFUSE_WR_TIM_CONF1_REG, EFUSE_PWR_ON_NUM, power_on); + REG_SET_FIELD(EFUSE_WR_TIM_CONF1_REG, EFUSE_TSUP_A, tsup_a); + //REG_SET_FIELD(EFUSE_WR_TIM_CONF2_REG, EFUSE_PWR_OFF_NUM, power_off); + REG_SET_FIELD(EFUSE_RD_TIM_CONF_REG, EFUSE_TSUR_A, tsur_a); + REG_SET_FIELD(EFUSE_RD_TIM_CONF_REG, EFUSE_TRD, trd); + REG_SET_FIELD(EFUSE_RD_TIM_CONF_REG, EFUSE_THR_A, thr_a); + return ESP_OK; +} +#endif // ifndef CONFIG_EFUSE_VIRTUAL + +// Efuse read operation: copies data from physical efuses to efuse read registers. +void esp_efuse_utility_clear_program_registers(void) +{ + ets_efuse_read(); + ets_efuse_clear_program_registers(); +} + +// Burn values written to the efuse write registers +void esp_efuse_utility_burn_efuses(void) +{ +#ifdef CONFIG_EFUSE_VIRTUAL + ESP_LOGW(TAG, "Virtual efuses enabled: Not really burning eFuses"); + for (int num_block = 0; num_block < COUNT_EFUSE_BLOCKS; num_block++) { + int subblock = 0; + for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) { + virt_blocks[num_block][subblock++] |= REG_READ(addr_wr_block); + } + } +#else + if (esp_efuse_set_timing() != ESP_OK) { + ESP_LOGE(TAG, "Efuse fields are not burnt"); + } else { + // Permanently update values written to the efuse write registers + for (int num_block = 0; num_block < COUNT_EFUSE_BLOCKS; num_block++) { + for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) { + if (REG_READ(addr_wr_block) != 0) { + if (esp_efuse_get_coding_scheme(num_block) == EFUSE_CODING_SCHEME_RS) { + uint8_t block_rs[12]; + ets_efuse_rs_calculate((void *)range_write_addr_blocks[num_block].start, block_rs); + memcpy((void *)EFUSE_PGM_CHECK_VALUE0_REG, block_rs, sizeof(block_rs)); + } + int data_len = (range_write_addr_blocks[num_block].end - range_write_addr_blocks[num_block].start) + sizeof(uint32_t); + memcpy((void *)EFUSE_PGM_DATA0_REG, (void *)range_write_addr_blocks[num_block].start, data_len); + ets_efuse_program(num_block); + break; + } + } + } + } +#endif // CONFIG_EFUSE_VIRTUAL + esp_efuse_utility_reset(); +} + +// After esp_efuse_write.. functions EFUSE_BLKx_WDATAx_REG were filled is not coded values. +// This function reads EFUSE_BLKx_WDATAx_REG registers, and checks possible to write these data with RS coding scheme. +// The RS coding scheme does not require data changes for the encoded data. esp32s2beta has special registers for this. +// They will be filled during the burn operation. +esp_err_t esp_efuse_utility_apply_new_coding_scheme() +{ + // start with EFUSE_BLK1. EFUSE_BLK0 - always uses EFUSE_CODING_SCHEME_NONE. + for (int num_block = 1; num_block < COUNT_EFUSE_BLOCKS; num_block++) { + if (esp_efuse_get_coding_scheme(num_block) == EFUSE_CODING_SCHEME_RS) { + for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) { + if (REG_READ(addr_wr_block)) { + int num_reg = 0; + for (uint32_t addr_rd_block = range_read_addr_blocks[num_block].start; addr_rd_block <= range_read_addr_blocks[num_block].end; addr_rd_block += 4, ++num_reg) { + if (esp_efuse_utility_read_reg(num_block, num_reg)) { + ESP_LOGE(TAG, "Bits are not empty. Write operation is forbidden."); + return ESP_ERR_CODING; + } + } + break; + } + } + } + } + return ESP_OK; +} diff --git a/components/efuse/src/esp_efuse_api.c b/components/efuse/src/esp_efuse_api.c index 57a71970a3..0e0ed00b09 100644 --- a/components/efuse/src/esp_efuse_api.c +++ b/components/efuse/src/esp_efuse_api.c @@ -114,32 +114,6 @@ esp_err_t esp_efuse_write_field_cnt(const esp_efuse_desc_t* field[], size_t cnt) return err; } -// Sets a write protection for the whole block. -esp_err_t esp_efuse_set_write_protect(esp_efuse_block_t blk) -{ - if (blk == EFUSE_BLK1) { - return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_BLK1, 1); - } else if (blk == EFUSE_BLK2) { - return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_BLK2, 1); - } else if (blk == EFUSE_BLK3) { - return esp_efuse_write_field_cnt(ESP_EFUSE_WR_DIS_BLK3, 1); - } - return ESP_ERR_NOT_SUPPORTED; -} - -// read protect for blk. -esp_err_t esp_efuse_set_read_protect(esp_efuse_block_t blk) -{ - if (blk == EFUSE_BLK1) { - return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_BLK1, 1); - } else if (blk == EFUSE_BLK2) { - return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_BLK2, 1); - } else if (blk == EFUSE_BLK3) { - return esp_efuse_write_field_cnt(ESP_EFUSE_RD_DIS_BLK3, 1); - } - return ESP_ERR_NOT_SUPPORTED; -} - // get the length of the field in bits int esp_efuse_get_field_size(const esp_efuse_desc_t* field[]) { @@ -180,32 +154,11 @@ esp_err_t esp_efuse_write_reg(esp_efuse_block_t blk, unsigned int num_reg, uint3 return err; } -// get efuse coding_scheme. -esp_efuse_coding_scheme_t esp_efuse_get_coding_scheme(esp_efuse_block_t blk) -{ - esp_efuse_coding_scheme_t scheme; - if (blk == EFUSE_BLK0) { - scheme = EFUSE_CODING_SCHEME_NONE; - } else { - uint32_t coding_scheme = REG_GET_FIELD(EFUSE_BLK0_RDATA6_REG, EFUSE_CODING_SCHEME); - if (coding_scheme == EFUSE_CODING_SCHEME_VAL_NONE || - coding_scheme == (EFUSE_CODING_SCHEME_VAL_34 | EFUSE_CODING_SCHEME_VAL_REPEAT)) { - scheme = EFUSE_CODING_SCHEME_NONE; - } else if (coding_scheme == EFUSE_CODING_SCHEME_VAL_34) { - scheme = EFUSE_CODING_SCHEME_3_4; - } else { - scheme = EFUSE_CODING_SCHEME_REPEAT; - } - } - ESP_LOGD(TAG, "coding scheme %d", scheme); - return scheme; -} - // This function reads the key from the efuse block, starting at the offset and the required size. esp_err_t esp_efuse_read_block(esp_efuse_block_t blk, void* dst_key, size_t offset_in_bits, size_t size_bits) { esp_err_t err = ESP_OK; - if (blk == EFUSE_BLK0 || blk > EFUSE_BLK3 || dst_key == NULL || size_bits == 0) { + if (blk == EFUSE_BLK0 || blk >= EFUSE_BLK_MAX || dst_key == NULL || size_bits == 0) { err = ESP_ERR_INVALID_ARG; } else { const esp_efuse_desc_t field_desc[] = { @@ -225,7 +178,7 @@ esp_err_t esp_efuse_read_block(esp_efuse_block_t blk, void* dst_key, size_t offs esp_err_t esp_efuse_write_block(esp_efuse_block_t blk, const void* src_key, size_t offset_in_bits, size_t size_bits) { esp_err_t err = ESP_OK; - if (blk == EFUSE_BLK0 || blk > EFUSE_BLK3 || src_key == NULL || size_bits == 0) { + if (blk == EFUSE_BLK0 || blk >= EFUSE_BLK_MAX || src_key == NULL || size_bits == 0) { err = ESP_ERR_INVALID_ARG; } else { const esp_efuse_desc_t field_desc[] = { diff --git a/components/efuse/src/esp_efuse_fields.c b/components/efuse/src/esp_efuse_fields.c index 8aa9ade461..640098b8f6 100644 --- a/components/efuse/src/esp_efuse_fields.c +++ b/components/efuse/src/esp_efuse_fields.c @@ -24,47 +24,7 @@ #include "soc/efuse_periph.h" #include "bootloader_random.h" #include "soc/apb_ctrl_reg.h" - -const static char *TAG = "efuse"; - -// Contains functions that provide access to efuse fields which are often used in IDF. - -// Returns chip version from efuse -uint8_t esp_efuse_get_chip_ver(void) -{ - uint8_t eco_bit0, eco_bit1, eco_bit2; - esp_efuse_read_field_blob(ESP_EFUSE_CHIP_VER_REV1, &eco_bit0, 1); - esp_efuse_read_field_blob(ESP_EFUSE_CHIP_VER_REV2, &eco_bit1, 1); - eco_bit2 = (REG_READ(APB_CTRL_DATE_REG) & 0x80000000) >> 31; - uint32_t combine_value = (eco_bit2 << 2) | (eco_bit1 << 1) | eco_bit0; - uint8_t chip_ver = 0; - switch (combine_value) { - case 0: - chip_ver = 0; - break; - case 1: - chip_ver = 1; - break; - case 3: - chip_ver = 2; - break; - case 7: - chip_ver = 3; - break; - default: - chip_ver = 0; - break; - } - return chip_ver; -} - -// Returns chip package from efuse -uint32_t esp_efuse_get_pkg_ver(void) -{ - uint32_t pkg_ver = 0; - esp_efuse_read_field_blob(ESP_EFUSE_CHIP_VER_PKG, &pkg_ver, 3); - return pkg_ver; -} +#include "sys/param.h" // Permanently update values written to the efuse write registers void esp_efuse_burn_new_values(void) @@ -78,74 +38,15 @@ void esp_efuse_reset(void) esp_efuse_utility_reset(); } -// Disable BASIC ROM Console via efuse -void esp_efuse_disable_basic_rom_console(void) -{ - if (esp_efuse_write_field_cnt(ESP_EFUSE_CONSOLE_DEBUG_DISABLE, 1) == ESP_OK) { - ESP_EARLY_LOGI(TAG, "Disable BASIC ROM Console fallback via efuse..."); - } -} - -esp_err_t esp_efuse_apply_34_encoding(const uint8_t *in_bytes, uint32_t *out_words, size_t in_bytes_len) -{ - if (in_bytes == NULL || out_words == NULL || in_bytes_len % 6 != 0) { - return ESP_ERR_INVALID_ARG; - } - - while (in_bytes_len > 0) { - uint8_t out[8]; - uint8_t xor = 0; - uint8_t mul = 0; - for (int i = 0; i < 6; i++) { - xor ^= in_bytes[i]; - mul += (i + 1) * __builtin_popcount(in_bytes[i]); - } - - memcpy(out, in_bytes, 6); // Data bytes - out[6] = xor; - out[7] = mul; - - memcpy(out_words, out, 8); - - in_bytes_len -= 6; - in_bytes += 6; - out_words += 2; - } - - return ESP_OK; -} - -void esp_efuse_write_random_key(uint32_t blk_wdata0_reg) -{ - uint32_t buf[8]; - uint8_t raw[24]; - uint32_t coding_scheme = REG_READ(EFUSE_BLK0_RDATA6_REG) & EFUSE_CODING_SCHEME_M; - - if (coding_scheme == EFUSE_CODING_SCHEME_VAL_NONE) { - bootloader_fill_random(buf, sizeof(buf)); - } else { // 3/4 Coding Scheme - bootloader_fill_random(raw, sizeof(raw)); - esp_err_t r = esp_efuse_apply_34_encoding(raw, buf, sizeof(raw)); - (void) r; - assert(r == ESP_OK); - } - - ESP_LOGV(TAG, "Writing random values to address 0x%08x", blk_wdata0_reg); - for (int i = 0; i < 8; i++) { - ESP_LOGV(TAG, "EFUSE_BLKx_WDATA%d_REG = 0x%08x", i, buf[i]); - REG_WRITE(blk_wdata0_reg + 4 * i, buf[i]); - } - bzero(buf, sizeof(buf)); - bzero(raw, sizeof(raw)); -} - #ifdef CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE #include "../include_bootloader/bootloader_flash.h" #include "esp_flash_encrypt.h" +const static char *TAG = "efuse"; static uint32_t esp_efuse_flash_offset = 0; static uint32_t esp_efuse_flash_size = 0; + void esp_efuse_init(uint32_t offset, uint32_t size) { esp_efuse_flash_offset = offset; @@ -186,24 +87,21 @@ static void emulate_secure_version_write(uint32_t secure_version) } ESP_LOGV(TAG, "Write 0x%08x secure_version into flash", secure_version); } -#endif - -// This efuse register is used whole for secure version (32 bits). -#define EFUSE_BLK_RD_ANTI_ROLLBACK EFUSE_BLK3_RDATA4_REG -#define EFUSE_BLK_WR_ANTI_ROLLBACK EFUSE_BLK3_WDATA4_REG +#endif // CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE uint32_t esp_efuse_read_secure_version(void) { #ifdef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK - uint32_t secure_version; - + uint32_t secure_version = 0; + int size = esp_efuse_get_field_size(ESP_EFUSE_SECURE_VERSION); + size = MIN(CONFIG_BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD, size); #ifdef CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE secure_version = emulate_secure_version_read(); #else - secure_version = REG_READ(EFUSE_BLK_RD_ANTI_ROLLBACK); + esp_efuse_read_field_blob(ESP_EFUSE_SECURE_VERSION, &secure_version, size); #endif // CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE - return __builtin_popcount(secure_version & ((1ULL << CONFIG_BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD) - 1)); + return __builtin_popcount(secure_version & ((1ULL << size) - 1)); #else return 0; #endif @@ -212,12 +110,12 @@ uint32_t esp_efuse_read_secure_version(void) #ifdef CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK static void write_anti_rollback(uint32_t new_bits) { + int size = esp_efuse_get_field_size(ESP_EFUSE_SECURE_VERSION); + size = MIN(CONFIG_BOOTLOADER_APP_SEC_VER_SIZE_EFUSE_FIELD, size); #ifdef CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE emulate_secure_version_write(new_bits); #else - esp_efuse_reset(); - REG_WRITE(EFUSE_BLK_WR_ANTI_ROLLBACK, new_bits); - esp_efuse_burn_new_values(); + esp_efuse_write_field_blob(ESP_EFUSE_SECURE_VERSION, &new_bits, size); #endif } #endif @@ -236,9 +134,9 @@ esp_err_t esp_efuse_update_secure_version(uint32_t secure_version) return ESP_ERR_INVALID_ARG; } #ifndef CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE - uint32_t coding_scheme = REG_READ(EFUSE_BLK0_RDATA6_REG) & EFUSE_CODING_SCHEME_M; - if (coding_scheme != EFUSE_CODING_SCHEME_VAL_NONE) { - ESP_LOGE(TAG, "Anti rollback is not supported with a 3/4 coding scheme."); + esp_efuse_coding_scheme_t coding_scheme = esp_efuse_get_coding_scheme(ESP_EFUSE_SECURE_VERSION_NUM_BLOCK); + if (coding_scheme != EFUSE_CODING_SCHEME_NONE) { + ESP_LOGE(TAG, "Anti rollback is not supported with any coding scheme."); return ESP_ERR_NOT_SUPPORTED; } #endif diff --git a/components/efuse/src/esp_efuse_utility.c b/components/efuse/src/esp_efuse_utility.c index 5f61b5cbd3..108cba17e3 100644 --- a/components/efuse/src/esp_efuse_utility.c +++ b/components/efuse/src/esp_efuse_utility.c @@ -15,7 +15,6 @@ #include "esp_efuse_utility.h" #include "soc/efuse_periph.h" -#include "esp32/clk.h" #include "esp_log.h" #include "assert.h" #include "sdkconfig.h" @@ -23,45 +22,16 @@ static const char *TAG = "efuse"; -#define COUNT_EFUSE_BLOCKS 4 /* The number of blocks. */ -#define COUNT_EFUSE_REG_PER_BLOCK 8 /* The number of registers per block. */ -#define EFUSE_CONF_WRITE 0x5A5A /* eFuse_pgm_op_ena, force no rd/wr disable. */ -#define EFUSE_CONF_READ 0x5AA5 /* eFuse_read_op_ena, release force. */ -#define EFUSE_CMD_PGM 0x02 /* Command to program. */ -#define EFUSE_CMD_READ 0x01 /* Command to read. */ - // Array for emulate efuse registers. #ifdef CONFIG_EFUSE_VIRTUAL -static uint32_t virt_blocks[COUNT_EFUSE_BLOCKS][COUNT_EFUSE_REG_PER_BLOCK]; +uint32_t virt_blocks[COUNT_EFUSE_BLOCKS][COUNT_EFUSE_REG_PER_BLOCK]; /* Call the update function to seed virtual efuses during initialization */ __attribute__((constructor)) void esp_efuse_utility_update_virt_blocks(void); - #endif -/** - * @brief Structure range address by blocks - */ -typedef struct { - uint32_t start; - uint32_t end; -} esp_efuse_range_addr_t; - -/*Range addresses to read blocks*/ -static const esp_efuse_range_addr_t range_read_addr_blocks[] = { - {EFUSE_BLK0_RDATA0_REG, EFUSE_BLK0_RDATA6_REG}, // range address of EFUSE_BLK0 - {EFUSE_BLK1_RDATA0_REG, EFUSE_BLK1_RDATA7_REG}, // range address of EFUSE_BLK1 - {EFUSE_BLK2_RDATA0_REG, EFUSE_BLK2_RDATA7_REG}, // range address of EFUSE_BLK2 - {EFUSE_BLK3_RDATA0_REG, EFUSE_BLK3_RDATA7_REG} // range address of EFUSE_BLK3 -}; - -/*Range addresses to write blocks*/ -static const esp_efuse_range_addr_t range_write_addr_blocks[] = { - {EFUSE_BLK0_WDATA0_REG, EFUSE_BLK0_WDATA6_REG}, // range address of EFUSE_BLK0 - {EFUSE_BLK1_WDATA0_REG, EFUSE_BLK1_WDATA7_REG}, // range address of EFUSE_BLK1 - {EFUSE_BLK2_WDATA0_REG, EFUSE_BLK2_WDATA7_REG}, // range address of EFUSE_BLK2 - {EFUSE_BLK3_WDATA0_REG, EFUSE_BLK3_WDATA7_REG} // range address of EFUSE_BLK3 -}; +extern const esp_efuse_range_addr_t range_read_addr_blocks[]; +extern const esp_efuse_range_addr_t range_write_addr_blocks[]; static int get_reg_num(int bit_start, int bit_count, int i_reg); static int get_starting_bit_num_in_reg(int bit_start, int i_reg); @@ -174,7 +144,7 @@ esp_err_t esp_efuse_utility_write_cnt(unsigned int num_reg, esp_efuse_block_t ef // Reset efuse write registers void esp_efuse_utility_reset(void) { - REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_READ); + esp_efuse_utility_clear_program_registers(); for (int num_block = 0; num_block < COUNT_EFUSE_BLOCKS; num_block++) { for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) { REG_WRITE(addr_wr_block, 0); @@ -182,65 +152,6 @@ void esp_efuse_utility_reset(void) } } -// Burn values written to the efuse write registers -void esp_efuse_utility_burn_efuses(void) -{ -#ifdef CONFIG_EFUSE_VIRTUAL - ESP_LOGW(TAG, "Virtual efuses enabled: Not really burning eFuses"); - for (int num_block = 0; num_block < COUNT_EFUSE_BLOCKS; num_block++) { - esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block); - if (scheme == EFUSE_CODING_SCHEME_3_4) { - uint8_t buf[COUNT_EFUSE_REG_PER_BLOCK * 4] = { 0 }; - int i = 0; - for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4, ++i) { - *((uint32_t*)buf + i) = REG_READ(addr_wr_block); - } - int j = 0; - uint32_t out_buf[COUNT_EFUSE_REG_PER_BLOCK] = { 0 }; - for (int k = 0; k < 4; ++k, ++j) { - memcpy((uint8_t*)out_buf + j * 6, &buf[k * 8], 6); - } - for (int k = 0; k < COUNT_EFUSE_REG_PER_BLOCK; ++k) { - REG_WRITE(range_write_addr_blocks[num_block].start + k * 4, out_buf[k]); - } - } - int subblock = 0; - for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4) { - virt_blocks[num_block][subblock++] |= REG_READ(addr_wr_block); - } - } -#else - // Update Efuse timing configuration - uint32_t apb_freq_mhz = esp_clk_apb_freq() / 1000000; - uint32_t clk_sel0, clk_sel1, dac_clk_div; - if (apb_freq_mhz <= 26) { - clk_sel0 = 250; - clk_sel1 = 255; - dac_clk_div = 52; - } else if (apb_freq_mhz <= 40) { - clk_sel0 = 160; - clk_sel1 = 255; - dac_clk_div = 80; - } else { - clk_sel0 = 80; - clk_sel1 = 128; - dac_clk_div = 100; - } - REG_SET_FIELD(EFUSE_DAC_CONF_REG, EFUSE_DAC_CLK_DIV, dac_clk_div); - REG_SET_FIELD(EFUSE_CLK_REG, EFUSE_CLK_SEL0, clk_sel0); - REG_SET_FIELD(EFUSE_CLK_REG, EFUSE_CLK_SEL1, clk_sel1); - // Permanently update values written to the efuse write registers - REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_WRITE); - REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_PGM); - while (REG_READ(EFUSE_CMD_REG) != 0) {}; - REG_WRITE(EFUSE_CONF_REG, EFUSE_CONF_READ); - REG_WRITE(EFUSE_CMD_REG, EFUSE_CMD_READ); - while (REG_READ(EFUSE_CMD_REG) != 0) {}; -#endif - esp_efuse_utility_reset(); -} - - // Erase the virt_blocks array. void esp_efuse_utility_erase_virt_blocks(void) { @@ -314,13 +225,9 @@ esp_err_t esp_efuse_utility_write_reg(esp_efuse_block_t efuse_block, unsigned in // Reading efuse register. uint32_t esp_efuse_utility_read_reg(esp_efuse_block_t blk, unsigned int num_reg) { - assert(blk >= 0 && blk <= 3); - if (blk == 0) { - assert(num_reg <= 6); - } else { - assert(num_reg <= 7); - } - + assert(blk >= 0 && blk < EFUSE_BLK_MAX); + unsigned int max_num_reg = (range_read_addr_blocks[blk].end - range_read_addr_blocks[blk].start) / sizeof(uint32_t); + assert(num_reg <= max_num_reg); uint32_t value; #ifdef CONFIG_EFUSE_VIRTUAL value = virt_blocks[blk][num_reg]; @@ -335,12 +242,9 @@ uint32_t esp_efuse_utility_read_reg(esp_efuse_block_t blk, unsigned int num_reg) // writing efuse register. static void write_reg(esp_efuse_block_t blk, unsigned int num_reg, uint32_t value) { - assert(blk >= 0 && blk <= 3); - if (blk == 0) { - assert(num_reg <= 6); - } else { - assert(num_reg <= 7); - } + assert(blk >= 0 && blk < EFUSE_BLK_MAX); + unsigned int max_num_reg = (range_read_addr_blocks[blk].end - range_read_addr_blocks[blk].start) / sizeof(uint32_t); + assert(num_reg <= max_num_reg); uint32_t addr_wr_reg = range_write_addr_blocks[blk].start + num_reg * 4; uint32_t reg_to_write = REG_READ(addr_wr_reg) | value; // The register can be written in parts so we combine the new value with the one already available. @@ -440,97 +344,11 @@ static uint32_t set_cnt_in_reg(int bit_start_in_reg, int bit_count_used_in_reg, // check range of bits for any coding scheme. static bool check_range_of_bits(esp_efuse_block_t blk, int offset_in_bits, int size_bits) { - esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(blk); int max_num_bit = offset_in_bits + size_bits; - if ((scheme == EFUSE_CODING_SCHEME_NONE && max_num_bit > 256) || - (scheme == EFUSE_CODING_SCHEME_3_4 && max_num_bit > 192) || - (scheme == EFUSE_CODING_SCHEME_REPEAT && max_num_bit > 128)) { + if (max_num_bit > 256) { return false; + } else { + ESP_EFUSE_FIELD_CORRESPONDS_CODING_SCHEME(blk, max_num_bit); } return true; } - -static bool read_w_data_and_check_fill(esp_efuse_block_t num_block, uint32_t *buf_w_data) -{ - bool blk_is_filled = false; - int i = 0; - for (uint32_t addr_wr_block = range_write_addr_blocks[num_block].start; addr_wr_block <= range_write_addr_blocks[num_block].end; addr_wr_block += 4, ++i) { - buf_w_data[i] = REG_READ(addr_wr_block); - if (buf_w_data[i] != 0) { - REG_WRITE(addr_wr_block, 0); - blk_is_filled = true; - } - } - return blk_is_filled; -} - -static void read_r_data(esp_efuse_block_t num_block, uint32_t* buf_r_data) -{ - int i = 0; - for (uint32_t addr_rd_block = range_read_addr_blocks[num_block].start; addr_rd_block <= range_read_addr_blocks[num_block].end; addr_rd_block += 4, ++i) { - buf_r_data[i] = REG_READ(addr_rd_block); - } -} - -// After esp_efuse_write.. functions EFUSE_BLKx_WDATAx_REG were filled is not coded values. -// This function reads EFUSE_BLKx_WDATAx_REG registers, applies coding scheme and writes encoded values back to EFUSE_BLKx_WDATAx_REG. -esp_err_t esp_efuse_utility_apply_new_coding_scheme(void) -{ - uint8_t buf_w_data[COUNT_EFUSE_REG_PER_BLOCK * 4]; - uint8_t buf_r_data[COUNT_EFUSE_REG_PER_BLOCK * 4]; - uint32_t reg[COUNT_EFUSE_REG_PER_BLOCK]; - // start with EFUSE_BLK1. EFUSE_BLK0 - always uses EFUSE_CODING_SCHEME_NONE. - for (int num_block = 1; num_block < COUNT_EFUSE_BLOCKS; num_block++) { - esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block); - // check and apply a new coding scheme. - if (scheme != EFUSE_CODING_SCHEME_NONE) { - memset(buf_w_data, 0, sizeof(buf_w_data)); - memset((uint8_t*)reg, 0, sizeof(reg)); - if (read_w_data_and_check_fill(num_block, (uint32_t*)buf_w_data) == true) { - read_r_data(num_block, (uint32_t*)buf_r_data); - if (scheme == EFUSE_CODING_SCHEME_3_4) { - if (*((uint32_t*)buf_w_data + 6) != 0 || *((uint32_t*)buf_w_data + 7) != 0) { - return ESP_ERR_CODING; - } - for (int i = 0; i < 24; ++i) { - if (buf_w_data[i] != 0) { - int st_offset_buf = (i / 6) * 6; - // check that place is free. - for (int n = st_offset_buf; n < st_offset_buf + 6; ++n) { - if (buf_r_data[n] != 0) { - ESP_LOGE(TAG, "Bits are not empty. Write operation is forbidden."); - return ESP_ERR_CODING; - } - } - - esp_err_t err = esp_efuse_apply_34_encoding(&buf_w_data[st_offset_buf], reg, 6); - if (err != ESP_OK) { - return err; - } - - int num_reg = (st_offset_buf / 6) * 2; - for (int r = 0; r < 2; r++) { - REG_WRITE(range_write_addr_blocks[num_block].start + (num_reg + r) * 4, reg[r]); - } - i = st_offset_buf + 5; - } - } - } else if (scheme == EFUSE_CODING_SCHEME_REPEAT) { - uint32_t* buf_32 = (uint32_t*)buf_w_data; - for (int i = 4; i < 8; ++i) { - if (*(buf_32 + i) != 0) { - return ESP_ERR_CODING; - } - } - for (int i = 0; i < 4; ++i) { - if (buf_32[i] != 0) { - REG_WRITE(range_write_addr_blocks[num_block].start + i * 4, buf_32[i]); - REG_WRITE(range_write_addr_blocks[num_block].start + (i + 4) * 4, buf_32[i]); - } - } - } - } - } - } - return ESP_OK; -} diff --git a/components/efuse/test/CMakeLists.txt b/components/efuse/test/CMakeLists.txt index e239bfe5ce..dcb4d58c76 100644 --- a/components/efuse/test/CMakeLists.txt +++ b/components/efuse/test/CMakeLists.txt @@ -1,3 +1,5 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." "include" - REQUIRES unity test_utils efuse bootloader_support) \ No newline at end of file +idf_component_register(SRC_DIRS "." ${IDF_TARGET} + INCLUDE_DIRS "." "include" + PRIV_INCLUDE_DIRS "../private_include" + REQUIRES unity test_utils efuse bootloader_support + ) \ No newline at end of file diff --git a/components/efuse/test/component.mk b/components/efuse/test/component.mk index 5dda86047d..e1f27bc79e 100644 --- a/components/efuse/test/component.mk +++ b/components/efuse/test/component.mk @@ -2,5 +2,7 @@ #Component Makefile # COMPONENT_ADD_INCLUDEDIRS := include +COMPONENT_SRCDIRS := . ${IDF_TARGET} +COMPONENT_PRIV_INCLUDEDIRS = "../private_include" COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive diff --git a/components/efuse/test/esp32/test_efuse.c b/components/efuse/test/esp32/test_efuse.c new file mode 100644 index 0000000000..027a339f3d --- /dev/null +++ b/components/efuse/test/esp32/test_efuse.c @@ -0,0 +1,67 @@ +#include +#include +#include +#include +#include +#include "unity.h" +#include "esp_log.h" +#include +#include "esp_efuse.h" +#include "esp_efuse_table.h" +#include "esp_efuse_utility.h" +#include "esp_efuse_test_table.h" +#include "esp32/rom/efuse.h" +#include "bootloader_random.h" +#include "sdkconfig.h" + + +#ifdef CONFIG_EFUSE_VIRTUAL +TEST_CASE("Test a write/read protection", "[efuse]") +{ + esp_efuse_utility_reset(); + esp_efuse_utility_erase_virt_blocks(); + + esp_efuse_utility_debug_dump_blocks(); + + TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, esp_efuse_set_write_protect(EFUSE_BLK0)); + TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, esp_efuse_set_read_protect(EFUSE_BLK0)); + + size_t out_cnt; + esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_BLK1, &out_cnt); + TEST_ASSERT_EQUAL_INT(0, out_cnt); + TEST_ESP_OK(esp_efuse_set_write_protect(EFUSE_BLK1)); + esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_BLK1, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + TEST_ESP_ERR(ESP_ERR_EFUSE_CNT_IS_FULL, esp_efuse_set_write_protect(EFUSE_BLK1)); + + TEST_ESP_OK(esp_efuse_set_write_protect(EFUSE_BLK2)); + esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_BLK2, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + + TEST_ESP_OK(esp_efuse_set_write_protect(EFUSE_BLK3)); + esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_BLK3, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + + esp_efuse_utility_debug_dump_blocks(); + + esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_BLK1, &out_cnt); + TEST_ASSERT_EQUAL_INT(0, out_cnt); + TEST_ESP_OK(esp_efuse_set_read_protect(EFUSE_BLK1)); + esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_BLK1, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + TEST_ESP_ERR(ESP_ERR_EFUSE_CNT_IS_FULL, esp_efuse_set_read_protect(EFUSE_BLK1)); + + TEST_ESP_OK(esp_efuse_set_read_protect(EFUSE_BLK2)); + esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_BLK2, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + + TEST_ESP_OK(esp_efuse_set_read_protect(EFUSE_BLK3)); + esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_BLK3, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + + esp_efuse_utility_debug_dump_blocks(); + esp_efuse_utility_reset(); + esp_efuse_utility_erase_virt_blocks(); +} + +#endif // #ifdef CONFIG_EFUSE_VIRTUAL diff --git a/components/efuse/test/test_efuse_coding_scheme.c b/components/efuse/test/esp32/test_efuse_coding_scheme.c similarity index 95% rename from components/efuse/test/test_efuse_coding_scheme.c rename to components/efuse/test/esp32/test_efuse_coding_scheme.c index cccacb5d6e..6485f2a7e5 100644 --- a/components/efuse/test/test_efuse_coding_scheme.c +++ b/components/efuse/test/esp32/test_efuse_coding_scheme.c @@ -1,7 +1,7 @@ #include #include #include "esp_efuse.h" -#include "../src/esp_efuse_utility.h" +#include "esp_efuse_utility.h" #include "soc/efuse_periph.h" #include "unity.h" #include "bootloader_random.h" @@ -82,20 +82,21 @@ TEST_CASE("Test 3/4 Coding Scheme Algorithm", "[efuse]") const coding_scheme_test_t *t = &coding_scheme_data[i]; printf("Test case %d...\n", i); - esp_err_t r = esp_efuse_apply_34_encoding(t->unencoded, result, sizeof(t->unencoded)); + esp_err_t r = esp_efuse_utility_apply_34_encoding(t->unencoded, result, sizeof(t->unencoded)); TEST_ASSERT_EQUAL_HEX(ESP_OK, r); TEST_ASSERT_EQUAL_HEX32_ARRAY(t->encoded, result, 8); // Do the same, 6 bytes at a time for (int offs = 0; offs < sizeof(t->unencoded); offs += 6) { bzero(result, sizeof(result)); - r = esp_efuse_apply_34_encoding(t->unencoded + offs, result, 6); + r = esp_efuse_utility_apply_34_encoding(t->unencoded + offs, result, 6); TEST_ASSERT_EQUAL_HEX(ESP_OK, r); TEST_ASSERT_EQUAL_HEX32_ARRAY(t->encoded + (offs / 6 * 2), result, 2); } } } +#if CONFIG_IDF_TARGET_ESP32 TEST_CASE("Test Coding Scheme for efuse manager", "[efuse]") { int count_useful_reg = 0; @@ -117,6 +118,7 @@ TEST_CASE("Test Coding Scheme for efuse manager", "[efuse]") useful_data_in_byte = count_useful_reg * 4; for (int i = 0; i < 10; ++i) { + esp_efuse_utility_erase_virt_blocks(); printf("Test case %d...\n", i); memset(buf, 0, sizeof(buf)); memset(encoded, 0, sizeof(encoded)); @@ -140,7 +142,7 @@ TEST_CASE("Test Coding Scheme for efuse manager", "[efuse]") if (coding_scheme == EFUSE_CODING_SCHEME_NONE) { memcpy((uint8_t*)encoded, buf, sizeof(buf)); } else if (coding_scheme == EFUSE_CODING_SCHEME_3_4) { - TEST_ESP_OK(esp_efuse_apply_34_encoding(buf, encoded, useful_data_in_byte)); + TEST_ESP_OK(esp_efuse_utility_apply_34_encoding(buf, encoded, useful_data_in_byte)); } else if (coding_scheme == EFUSE_CODING_SCHEME_REPEAT) { for (int j = 0; j < count_useful_reg; ++j) { encoded[j] = *((uint32_t*)buf + j); @@ -172,7 +174,9 @@ TEST_CASE("Test Coding Scheme for efuse manager", "[efuse]") esp_efuse_utility_reset(); bootloader_random_disable(); } +#endif +#if CONFIG_IDF_TARGET_ESP32 TEST_CASE("Test data does not match the coding scheme", "[efuse]") { int count_useful_reg = 0; @@ -202,3 +206,4 @@ TEST_CASE("Test data does not match the coding scheme", "[efuse]") esp_efuse_utility_reset(); } +#endif diff --git a/components/efuse/test/esp32s2beta/test_efuse.c b/components/efuse/test/esp32s2beta/test_efuse.c new file mode 100644 index 0000000000..80e310188e --- /dev/null +++ b/components/efuse/test/esp32s2beta/test_efuse.c @@ -0,0 +1,130 @@ +#include +#include +#include +#include +#include +#include "unity.h" +#include "esp_log.h" +#include +#include "esp_efuse.h" +#include "esp_efuse_table.h" +#include "esp_efuse_utility.h" +#include "esp_efuse_test_table.h" +#include "esp32/rom/efuse.h" +#include "bootloader_random.h" +#include "sdkconfig.h" + + +//#define MANUAL_FPGA_TEST + +#if defined(MANUAL_FPGA_TEST) && defined(CONFIG_IDF_TARGET_ESP32S2BETA) && !defined(CONFIG_EFUSE_VIRTUAL) +TEST_CASE("Test a real write (FPGA)", "[efuse]") +{ + ESP_LOGI(TAG, "1. Write MAC address"); + esp_efuse_utility_debug_dump_blocks(); + uint8_t mac[6]; + TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_MAC_FACTORY, &mac, sizeof(mac) * 8)); + ESP_LOGI(TAG, "MAC: %02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + uint8_t new_mac[6]; + if (mac[0] == 0) { + new_mac[0] = 0x71; + new_mac[1] = 0x62; + new_mac[2] = 0x53; + new_mac[3] = 0x44; + new_mac[4] = 0x35; + new_mac[5] = 0x26; + TEST_ESP_OK(esp_efuse_write_field_blob(ESP_EFUSE_MAC_FACTORY, &new_mac, sizeof(new_mac) * 8)); + ESP_LOGI(TAG, "new MAC: %02x:%02x:%02x:%02x:%02x:%02x", new_mac[0], new_mac[1], new_mac[2], new_mac[3], new_mac[4], new_mac[5]); + TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_MAC_FACTORY, &mac, sizeof(mac) * 8)); + TEST_ASSERT_EQUAL_HEX8_ARRAY(new_mac, mac, sizeof(new_mac)); + esp_efuse_utility_debug_dump_blocks(); + } + + ESP_LOGI(TAG, "2. Write KEY3"); + uint8_t key[32] = {0}; + TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_KEY3, &key, 256)); + for (int i = 0; i < sizeof(key); ++i) { + TEST_ASSERT_EQUAL_INT(0, key[i]); + } + uint8_t new_key[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 12, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 22, 24, 25, 26, 27, 28, 29, + 30, 31}; + TEST_ESP_OK(esp_efuse_write_field_blob(ESP_EFUSE_KEY3, &new_key, 256)); + TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_KEY3, &key, 256)); + TEST_ASSERT_EQUAL_HEX8_ARRAY(new_key, key, sizeof(new_mac)); + esp_efuse_utility_debug_dump_blocks(); + + ESP_LOGI(TAG, "3. Set a read protection for KEY3"); + TEST_ESP_OK(esp_efuse_set_read_protect(EFUSE_BLK7)); + TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_KEY3, &key, 256)); + for (int i = 0; i < sizeof(key); ++i) { + TEST_ASSERT_EQUAL_INT(0, key[i]); + } + esp_efuse_utility_debug_dump_blocks(); + + ESP_LOGI(TAG, "4. Write SECURE_VERSION"); + int max_bits = esp_efuse_get_field_size(ESP_EFUSE_SECURE_VERSION); + size_t read_sec_version; + esp_efuse_utility_debug_dump_blocks(); + for (int i = 0; i < max_bits; ++i) { + ESP_LOGI(TAG, "# %d", i); + TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_SECURE_VERSION, 1)); + TEST_ESP_OK(esp_efuse_read_field_cnt(ESP_EFUSE_SECURE_VERSION, &read_sec_version)); + esp_efuse_utility_debug_dump_blocks(); + TEST_ASSERT_EQUAL_INT(i + 1, read_sec_version); + } +} + +#endif + +#ifdef CONFIG_EFUSE_VIRTUAL +TEST_CASE("Test a write/read protection", "[efuse]") +{ + esp_efuse_utility_reset(); + esp_efuse_utility_erase_virt_blocks(); + + esp_efuse_utility_debug_dump_blocks(); + + TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, esp_efuse_set_write_protect(EFUSE_BLK0)); + TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, esp_efuse_set_read_protect(EFUSE_BLK0)); + + size_t out_cnt; + esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_BLK1, &out_cnt); + TEST_ASSERT_EQUAL_INT(0, out_cnt); + TEST_ESP_OK(esp_efuse_set_write_protect(EFUSE_BLK1)); + esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_BLK1, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + TEST_ESP_ERR(ESP_ERR_EFUSE_CNT_IS_FULL, esp_efuse_set_write_protect(EFUSE_BLK1)); + + TEST_ESP_OK(esp_efuse_set_write_protect(EFUSE_BLK2)); + esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_SYS_DATA_PART1, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + + TEST_ESP_OK(esp_efuse_set_write_protect(EFUSE_BLK3)); + esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_USER_DATA, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + + esp_efuse_utility_debug_dump_blocks(); + + esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_KEY0, &out_cnt); + TEST_ASSERT_EQUAL_INT(0, out_cnt); + TEST_ESP_OK(esp_efuse_set_read_protect(EFUSE_BLK4)); + esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_KEY0, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + TEST_ESP_ERR(ESP_ERR_EFUSE_CNT_IS_FULL, esp_efuse_set_read_protect(EFUSE_BLK4)); + + TEST_ESP_OK(esp_efuse_set_read_protect(EFUSE_BLK5)); + esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_KEY1, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + + TEST_ESP_OK(esp_efuse_set_read_protect(EFUSE_BLK6)); + esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_KEY2, &out_cnt); + TEST_ASSERT_EQUAL_INT(1, out_cnt); + + esp_efuse_utility_debug_dump_blocks(); + esp_efuse_utility_reset(); + esp_efuse_utility_erase_virt_blocks(); +} + +#endif // #ifdef CONFIG_EFUSE_VIRTUAL diff --git a/components/efuse/test/esp32s2beta/test_efuse_coding_scheme.c b/components/efuse/test/esp32s2beta/test_efuse_coding_scheme.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/efuse/test/test_efuse.c b/components/efuse/test/test_efuse.c index 7ea2830774..fdcfa88f19 100644 --- a/components/efuse/test/test_efuse.c +++ b/components/efuse/test/test_efuse.c @@ -8,7 +8,7 @@ #include #include "esp_efuse.h" #include "esp_efuse_table.h" -#include "../src/esp_efuse_utility.h" +#include "esp_efuse_utility.h" #include "esp_efuse_test_table.h" #include "esp32/rom/efuse.h" #include "bootloader_random.h" @@ -29,10 +29,12 @@ static void test_read_blob(void) TEST_ASSERT_EQUAL_INT(sizeof(mac) * 8, esp_efuse_get_field_size(ESP_EFUSE_MAC_FACTORY)); ESP_LOGI(TAG, "MAC: %02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); +#if CONFIG_IDF_TARGET_ESP32 ESP_LOGI(TAG, "2. Check CRC by MAC"); uint8_t crc; TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_MAC_FACTORY_CRC, &crc, 8)); TEST_ASSERT_EQUAL_HEX8(crc, esp_crc8(mac, sizeof(mac))); +#endif // CONFIG_IDF_TARGET_ESP32 ESP_LOGI(TAG, "3. Test check args"); uint32_t test_var; @@ -85,6 +87,7 @@ TEST_CASE("efuse test read_field_cnt", "[efuse]") #ifdef CONFIG_EFUSE_VIRTUAL static void test_write_blob(void) { + esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(EFUSE_BLK1); esp_efuse_utility_erase_virt_blocks(); esp_efuse_utility_debug_dump_blocks(); @@ -103,12 +106,25 @@ static void test_write_blob(void) TEST_ASSERT_EQUAL_HEX16(test1_len_8&((1 << 7) - 1), val_read1); uint16_t test1_len_8_hi = test1_len_8 & ~((1 << 7) - 1); - TEST_ESP_OK(esp_efuse_write_field_blob(ESP_EFUSE_TEST1_LEN_8, &test1_len_8_hi, 8)); + if (scheme == EFUSE_CODING_SCHEME_NONE) { + TEST_ESP_OK(esp_efuse_write_field_blob(ESP_EFUSE_TEST1_LEN_8, &test1_len_8_hi, 8)); + } else { + TEST_ESP_ERR(ESP_ERR_CODING, esp_efuse_write_field_blob(ESP_EFUSE_TEST1_LEN_8, &test1_len_8_hi, 8)); + } + TEST_ESP_ERR(ESP_ERR_EFUSE_REPEATED_PROG, esp_efuse_write_field_blob(ESP_EFUSE_TEST1_LEN_8, &test1_len_8, 8)); val_read1 = 0; TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_TEST1_LEN_8, &val_read1, 16)); - TEST_ASSERT_EQUAL_HEX16(test1_len_8&0x00FF, val_read1); + if (scheme == EFUSE_CODING_SCHEME_NONE) { + TEST_ASSERT_EQUAL_HEX16(test1_len_8&0x00FF, val_read1); + } else { + TEST_ASSERT_EQUAL_HEX16(test1_len_8&0x007F, val_read1); + } + if (scheme != EFUSE_CODING_SCHEME_NONE) { + esp_efuse_utility_erase_virt_blocks(); + ESP_LOGI(TAG, "erase virt blocks"); + } uint16_t test2_len_16 = 0xAA55; uint32_t val_32 = test2_len_16; TEST_ESP_OK(esp_efuse_write_field_blob(ESP_EFUSE_TEST2_LEN_16, &val_32, 17)); @@ -145,6 +161,7 @@ TEST_CASE("efuse test write_field_blob", "[efuse]") static void test_write_cnt(void) { + esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(EFUSE_BLK1); esp_efuse_utility_erase_virt_blocks(); esp_efuse_utility_debug_dump_blocks(); @@ -162,11 +179,23 @@ static void test_write_cnt(void) TEST_ESP_OK(esp_efuse_read_field_cnt(ESP_EFUSE_TEST3_LEN_6, &test3_len_6)); TEST_ASSERT_EQUAL_INT(1, test3_len_6); - TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_TEST3_LEN_6, 1)); + if (scheme == EFUSE_CODING_SCHEME_NONE) { + TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_TEST3_LEN_6, 1)); + } else { + esp_efuse_utility_erase_virt_blocks(); + ESP_LOGI(TAG, "erase virt blocks"); + TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_TEST3_LEN_6, 2)); + } TEST_ESP_OK(esp_efuse_read_field_cnt(ESP_EFUSE_TEST3_LEN_6, &test3_len_6)); TEST_ASSERT_EQUAL_INT(2, test3_len_6); - TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_TEST3_LEN_6, 3)); + if (scheme == EFUSE_CODING_SCHEME_NONE) { + TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_TEST3_LEN_6, 3)); + } else { + esp_efuse_utility_erase_virt_blocks(); + ESP_LOGI(TAG, "erase virt blocks"); + TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_TEST3_LEN_6, 5)); + } TEST_ESP_OK(esp_efuse_read_field_cnt(ESP_EFUSE_TEST3_LEN_6, &test3_len_6)); TEST_ASSERT_EQUAL_INT(5, test3_len_6); @@ -178,7 +207,12 @@ static void test_write_cnt(void) esp_efuse_utility_debug_dump_blocks(); for (int i = 0; i < max_bits / 26; ++i) { ESP_LOGD(TAG, "# %d", i); - TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_TEST4_LEN_182, 26)); + if (scheme == EFUSE_CODING_SCHEME_NONE) { + TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_TEST4_LEN_182, 26)); + } else { + esp_efuse_utility_erase_virt_blocks(); + TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_TEST4_LEN_182, (i + 1) * 26)); + } TEST_ESP_OK(esp_efuse_read_field_cnt(ESP_EFUSE_TEST4_LEN_182, &test4_len_182)); esp_efuse_utility_debug_dump_blocks(); TEST_ASSERT_EQUAL_INT((i + 1) * 26, test4_len_182); @@ -196,6 +230,11 @@ static void test_write_cnt(void) TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_TEST5_LEN_1, &test5_len_1, 1)); TEST_ASSERT_EQUAL_HEX8(0, test5_len_1); + if (scheme != EFUSE_CODING_SCHEME_NONE) { + esp_efuse_utility_erase_virt_blocks(); + ESP_LOGI(TAG, "erase virt blocks"); + } + test5_len_1 = 1; TEST_ESP_OK(esp_efuse_write_field_cnt(ESP_EFUSE_TEST5_LEN_1, test5_len_1)); @@ -441,7 +480,12 @@ void check_efuse_table_test(int cycle) TEST_CASE("efuse esp_efuse_table_test", "[efuse]") { - check_efuse_table_test(2); + esp_efuse_coding_scheme_t coding_scheme = esp_efuse_get_coding_scheme(EFUSE_BLK2); + if (coding_scheme == EFUSE_CODING_SCHEME_NONE) { + check_efuse_table_test(2); + } else { + ESP_LOGI(TAG, "This test is applicable only to the EFUSE_CODING_SCHEME_NONE. Skip this test."); + } } @@ -452,13 +496,21 @@ TEST_CASE("Test esp_efuse_read_block esp_efuse_write_block functions", "[efuse]" if (coding_scheme == EFUSE_CODING_SCHEME_NONE) { printf("EFUSE_CODING_SCHEME_NONE\n"); count_useful_reg = 8; - } else if (coding_scheme == EFUSE_CODING_SCHEME_3_4) { + } +#if CONFIG_IDF_TARGET_ESP32 + if (coding_scheme == EFUSE_CODING_SCHEME_3_4) { printf("EFUSE_CODING_SCHEME_3_4\n"); count_useful_reg = 6; } else if (coding_scheme == EFUSE_CODING_SCHEME_REPEAT) { printf("EFUSE_CODING_SCHEME_REPEAT\n"); count_useful_reg = 4; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if (coding_scheme == EFUSE_CODING_SCHEME_RS) { + printf("EFUSE_CODING_SCHEME_RS\n"); + count_useful_reg = 8; + } +#endif esp_efuse_utility_reset(); esp_efuse_utility_erase_virt_blocks(); @@ -507,13 +559,25 @@ TEST_CASE("Test Bits are not empty. Write operation is forbidden", "[efuse]") printf("EFUSE_CODING_SCHEME_NONE. The test is not applicable.\n"); count_useful_reg = 8; return; - } else if (coding_scheme == EFUSE_CODING_SCHEME_3_4) { + } +#if CONFIG_IDF_TARGET_ESP32 + if (coding_scheme == EFUSE_CODING_SCHEME_3_4) { printf("EFUSE_CODING_SCHEME_3_4\n"); count_useful_reg = 6; } else if (coding_scheme == EFUSE_CODING_SCHEME_REPEAT) { printf("EFUSE_CODING_SCHEME_REPEAT\n"); count_useful_reg = 4; } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if (coding_scheme == EFUSE_CODING_SCHEME_RS) { + printf("EFUSE_CODING_SCHEME_RS\n"); + if (num_block == EFUSE_BLK1) { + count_useful_reg = 6; + } else { + count_useful_reg = 8; + } + } +#endif TEST_ESP_OK(esp_efuse_read_block(num_block, r_buff, 0, count_useful_reg * 32)); for (int i = 0; i < count_useful_reg * 4; ++i) { if (r_buff[i] != 0) { @@ -544,51 +608,4 @@ TEST_CASE("Test Bits are not empty. Write operation is forbidden", "[efuse]") } } -TEST_CASE("Test a write/read protection", "[efuse]") -{ - esp_efuse_utility_reset(); - esp_efuse_utility_erase_virt_blocks(); - - esp_efuse_utility_debug_dump_blocks(); - - TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, esp_efuse_set_write_protect(EFUSE_BLK0)); - TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, esp_efuse_set_read_protect(EFUSE_BLK0)); - - size_t out_cnt; - esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_BLK1, &out_cnt); - TEST_ASSERT_EQUAL_INT(0, out_cnt); - TEST_ESP_OK(esp_efuse_set_write_protect(EFUSE_BLK1)); - esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_BLK1, &out_cnt); - TEST_ASSERT_EQUAL_INT(1, out_cnt); - TEST_ESP_ERR(ESP_ERR_EFUSE_CNT_IS_FULL, esp_efuse_set_write_protect(EFUSE_BLK1)); - - TEST_ESP_OK(esp_efuse_set_write_protect(EFUSE_BLK2)); - esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_BLK2, &out_cnt); - TEST_ASSERT_EQUAL_INT(1, out_cnt); - - TEST_ESP_OK(esp_efuse_set_write_protect(EFUSE_BLK3)); - esp_efuse_read_field_cnt(ESP_EFUSE_WR_DIS_BLK3, &out_cnt); - TEST_ASSERT_EQUAL_INT(1, out_cnt); - - esp_efuse_utility_debug_dump_blocks(); - - esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_BLK1, &out_cnt); - TEST_ASSERT_EQUAL_INT(0, out_cnt); - TEST_ESP_OK(esp_efuse_set_read_protect(EFUSE_BLK1)); - esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_BLK1, &out_cnt); - TEST_ASSERT_EQUAL_INT(1, out_cnt); - TEST_ESP_ERR(ESP_ERR_EFUSE_CNT_IS_FULL, esp_efuse_set_read_protect(EFUSE_BLK1)); - - TEST_ESP_OK(esp_efuse_set_read_protect(EFUSE_BLK2)); - esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_BLK2, &out_cnt); - TEST_ASSERT_EQUAL_INT(1, out_cnt); - - TEST_ESP_OK(esp_efuse_set_read_protect(EFUSE_BLK3)); - esp_efuse_read_field_cnt(ESP_EFUSE_RD_DIS_BLK3, &out_cnt); - TEST_ASSERT_EQUAL_INT(1, out_cnt); - - esp_efuse_utility_debug_dump_blocks(); - esp_efuse_utility_reset(); - esp_efuse_utility_erase_virt_blocks(); -} #endif // #ifdef CONFIG_EFUSE_VIRTUAL diff --git a/components/efuse/test_efuse_host/efuse_tests.py b/components/efuse/test_efuse_host/efuse_tests.py index b94092451f..1e4b9d3383 100755 --- a/components/efuse/test_efuse_host/efuse_tests.py +++ b/components/efuse/test_efuse_host/efuse_tests.py @@ -236,7 +236,7 @@ name4, EFUSE_BLK2, 30, name1, EFUSE_BLK5, 0, 5, Use for test name 1 name2, EFUSE_BLK3, 5, 4, Use for test name 2 """ - with self.assertRaisesRegex(efuse_table_gen.InputError, "'efuse_block' should consist from EFUSE_BLK0..EFUSE_BLK3"): + with self.assertRaisesRegex(efuse_table_gen.InputError, "'efuse_block' should be one of EFUSE_BLK0..EFUSE_BLK3"): efuse_table_gen.FuseTable.from_csv(csv) def test_field_size_is_ok(self): diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index 70a3805939..06cc8f9c66 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -1,4 +1,10 @@ +idf_build_get_property(target IDF_TARGET) +if(NOT "${target}" STREQUAL "esp32") + return() +endif() + idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) + if(BOOTLOADER_BUILD) # For bootloader, all we need from esp32 is headers idf_component_register(INCLUDE_DIRS include) diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 2bb234f06f..47975e1977 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -1,4 +1,8 @@ menu "ESP32-specific" + # TODO: this component simply shouldn't be included + # in the build at the CMake level, but this is currently + # not working so we just hide all items here + visible if IDF_TARGET_ESP32 choice ESP32_REV_MIN prompt "Minimum Supported ESP32 Revision" @@ -48,9 +52,12 @@ menu "ESP32-specific" default 160 if ESP32_DEFAULT_CPU_FREQ_160 default 240 if ESP32_DEFAULT_CPU_FREQ_240 + # Note: to support SPIRAM across multiple chips, check CONFIG_SPIRAM + # instead config ESP32_SPIRAM_SUPPORT bool "Support for external, SPI-connected RAM" default "n" + select SPIRAM help This enables support for an external SPI RAM chip, connected in parallel with the main SPI flash chip. @@ -58,41 +65,6 @@ menu "ESP32-specific" menu "SPI RAM config" depends on ESP32_SPIRAM_SUPPORT - config SPIRAM_BOOT_INIT - bool "Initialize SPI RAM when booting the ESP32" - default "y" - help - If this is enabled, the SPI RAM will be enabled during initial boot. Unless you - have specific requirements, you'll want to leave this enabled so memory allocated - during boot-up can also be placed in SPI RAM. - - config SPIRAM_IGNORE_NOTFOUND - bool "Ignore PSRAM when not found" - default "n" - depends on SPIRAM_BOOT_INIT && !SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY - help - Normally, if psram initialization is enabled during compile time but not found at runtime, it - is seen as an error making the ESP32 panic. If this is enabled, the ESP32 will keep on - running but will not add the (non-existing) RAM to any allocator. - - choice SPIRAM_USE - prompt "SPI RAM access method" - default SPIRAM_USE_MALLOC - help - The SPI RAM can be accessed in multiple methods: by just having it available as an unmanaged - memory region in the ESP32 memory map, by integrating it in the ESP32s heap as 'special' memory - needing heap_caps_malloc to allocate, or by fully integrating it making malloc() also able to - return SPI RAM pointers. - - config SPIRAM_USE_MEMMAP - bool "Integrate RAM into ESP32 memory map" - config SPIRAM_USE_CAPS_ALLOC - bool "Make RAM allocatable using heap_caps_malloc(..., MALLOC_CAP_SPIRAM)" - config SPIRAM_USE_MALLOC - bool "Make RAM allocatable using malloc() as well" - select FREERTOS_SUPPORT_STATIC_ALLOCATION - endchoice - choice SPIRAM_TYPE prompt "Type of SPI RAM chip in use" default SPIRAM_TYPE_AUTO @@ -139,13 +111,8 @@ menu "ESP32-specific" bool "80MHz clock speed" endchoice - config SPIRAM_MEMTEST - bool "Run memory test on SPI RAM initialization" - default "y" - depends on SPIRAM_BOOT_INIT - help - Runs a rudimentary memory test on initialization. Aborts when memory test fails. Disable this for - slightly faster startop. + # insert non-chip-specific items here + source "$IDF_PATH/components/esp_common/Kconfig.spiram.common" config SPIRAM_CACHE_WORKAROUND bool "Enable workaround for bug in SPI RAM cache for Rev1 ESP32s" @@ -187,47 +154,6 @@ menu "ESP32-specific" any himem calls, the reservation is not done and the original amount of memory will be available to malloc/esp_heap_alloc_caps. - config SPIRAM_MALLOC_ALWAYSINTERNAL - int "Maximum malloc() size, in bytes, to always put in internal memory" - depends on SPIRAM_USE_MALLOC - default 16384 - range 0 131072 - help - If malloc() is capable of also allocating SPI-connected ram, its allocation strategy will prefer to - allocate chunks less than this size in internal memory, while allocations larger than this will be - done from external RAM. If allocation from the preferred region fails, an attempt is made to allocate - from the non-preferred region instead, so malloc() will not suddenly fail when either internal or - external memory is full. - - config SPIRAM_TRY_ALLOCATE_WIFI_LWIP - bool "Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, allocate internal memory" - depends on SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC - default "n" - help - Try to allocate memories of WiFi and LWIP in SPIRAM firstly. If failed, try to allocate internal - memory then. - - config SPIRAM_MALLOC_RESERVE_INTERNAL - int "Reserve this amount of bytes for data that specifically needs to be in DMA or internal memory" - depends on SPIRAM_USE_MALLOC - default 32768 - range 0 262144 - help - Because the external/internal RAM allocation strategy is not always perfect, it sometimes may happen - that the internal memory is entirely filled up. This causes allocations that are specifically done in - internal memory, for example the stack for new tasks or memory to service DMA or have memory that's - also available when SPI cache is down, to fail. This option reserves a pool specifically for requests - like that; the memory in this pool is not given out when a normal malloc() is called. - - Set this to 0 to disable this feature. - - Note that because FreeRTOS stacks are forced to internal memory, they will also use this memory pool; - be sure to keep this in mind when adjusting this value. - - Note also that the DMA reserved pool may not be one single contiguous memory region, depending on the - configured size and the static memory usage of the app. - - config SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY bool "Allow external memory as an argument to xTaskCreateStatic" default n @@ -240,15 +166,6 @@ menu "ESP32-specific" and does not call on ROM code in any way (no direct calls, but also no Bluetooth/WiFi), you can try to disable this and use xTaskCreateStatic to create the tasks stack in external memory. - config SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY - bool "Allow .bss segment placed in external memory" - default n - depends on ESP32_SPIRAM_SUPPORT - help - If enabled the option,and add EXT_RAM_ATTR defined your variable,then your variable will be placed in - PSRAM instead of internal memory, and placed most of variables of lwip,net802.11,pp,bluedroid library - to external memory defaultly. - choice SPIRAM_OCCUPY_SPI_HOST prompt "SPI host to use for 32MBit PSRAM" default SPIRAM_OCCUPY_VSPI_HOST @@ -477,8 +394,6 @@ menu "ESP32-specific" e.g. GCOV data dump. config ESP32_BROWNOUT_DET - #The brownout detector code is disabled (by making it depend on a nonexisting symbol) because the current - #revision of ESP32 silicon has a bug in the brown-out detector, rendering it unusable for resetting the CPU. bool "Hardware brownout detect & reset" default y help @@ -783,23 +698,13 @@ menu "ESP32-specific" To prevent interrupting DPORT workarounds, need to disable interrupt with a maximum used level in the system. - config ESP32_PANIC_HANDLER_IRAM - bool "Place panic handler code in IRAM" - default n - help - If this option is disabled (default), the panic handler code is placed in flash not IRAM. - This means that if ESP-IDF crashes while flash cache is disabled, the panic handler will - automatically re-enable flash cache before running GDB Stub or Core Dump. This adds some minor - risk, if the flash cache status is also corrupted during the crash. - - If this option is enabled, the panic handler code is placed in IRAM. This allows the panic - handler to run without needing to re-enable cache first. This may be necessary to debug some - complex issues with crashes while flash cache is disabled (for example, when writing to - SPI flash.) - endmenu # ESP32-Specific menu "Power Management" + # TODO: this component simply shouldn't be included + # in the build at the CMake level, but this is currently + # not working so we just hide all items here + visible if IDF_TARGET_ESP32 config PM_ENABLE bool "Support for power management" diff --git a/components/esp32/intr_alloc.c b/components/esp32/intr_alloc.c index 11466a5997..04c9462afa 100644 --- a/components/esp32/intr_alloc.c +++ b/components/esp32/intr_alloc.c @@ -30,10 +30,13 @@ #include "esp_attr.h" #include #include +#include "soc/soc.h" + #if !CONFIG_FREERTOS_UNICORE #include "esp_ipc.h" #endif + static const char* TAG = "intr_alloc"; #define ETS_INTERNAL_TIMER0_INTR_NO 6 @@ -342,7 +345,7 @@ static bool is_vect_desc_usable(vector_desc_t *vd, int flags, int cpu, int force ALCHLOG("....Unusable: reserved at runtime."); return false; } - + //Ints can't be both shared and non-shared. assert(!((vd->flags&VECDESC_FL_SHARED)&&(vd->flags&VECDESC_FL_NONSHARED))); //check if interrupt already is in use by a non-shared interrupt @@ -370,7 +373,7 @@ static bool is_vect_desc_usable(vector_desc_t *vd, int flags, int cpu, int force ALCHLOG("....Unusable: already allocated"); return false; } - + return true; } @@ -387,7 +390,7 @@ static int get_available_int(int flags, int cpu, int force, int source) vector_desc_t empty_vect_desc; memset(&empty_vect_desc, 0, sizeof(vector_desc_t)); - + //Level defaults to any low/med interrupt if (!(flags&ESP_INTR_FLAG_LEVELMASK)) flags|=ESP_INTR_FLAG_LOWMED; @@ -412,13 +415,13 @@ static int get_available_int(int flags, int cpu, int force, int source) if (vd == NULL ) { //if existing vd not found, just check the default state for the intr. empty_vect_desc.intno = force; - vd = &empty_vect_desc; + vd = &empty_vect_desc; } if ( is_vect_desc_usable(vd, flags, cpu, force) ) { best = vd->intno; } else { ALCHLOG("get_avalible_int: forced vd invalid."); - } + } return best; } @@ -435,12 +438,12 @@ static int get_available_int(int flags, int cpu, int force, int source) ALCHLOG("Int %d reserved %d level %d %s hasIsr %d", x, int_desc[x].cpuflags[cpu]==INTDESC_RESVD, int_desc[x].level, int_desc[x].type==INTTP_LEVEL?"LEVEL":"EDGE", int_has_handler(x, cpu)); - + if ( !is_vect_desc_usable(vd, flags, cpu, force) ) continue; if (flags&ESP_INTR_FLAG_SHARED) { //We're allocating a shared int. - + //See if int already is used as a shared interrupt. if (vd->flags&VECDESC_FL_SHARED) { //We can use this already-marked-as-shared interrupt. Count the already attached isrs in order to see @@ -550,9 +553,12 @@ esp_err_t esp_intr_alloc_intrstatus(int source, int flags, uint32_t intrstatusre //Statusreg should have a mask if (intrstatusreg && !intrstatusmask) return ESP_ERR_INVALID_ARG; //If the ISR is marked to be IRAM-resident, the handler must not be in the cached region + //ToDo: if we are to allow placing interrupt handlers into the 0x400c0000—0x400c2000 region, + //we need to make sure the interrupt is connected to the CPU0. + //CPU1 does not have access to the RTC fast memory through this region. if ((flags&ESP_INTR_FLAG_IRAM) && - (ptrdiff_t) handler >= 0x400C0000 && - (ptrdiff_t) handler < 0x50000000 ) { + (ptrdiff_t) handler >= SOC_RTC_IRAM_HIGH && + (ptrdiff_t) handler < SOC_RTC_DATA_LOW ) { return ESP_ERR_INVALID_ARG; } diff --git a/components/esp32/ld/esp32.ld b/components/esp32/ld/esp32.ld index cb0f14437b..167404ed3c 100644 --- a/components/esp32/ld/esp32.ld +++ b/components/esp32/ld/esp32.ld @@ -52,12 +52,14 @@ MEMORY #ifdef CONFIG_APP_BUILD_USE_FLASH_SECTIONS /* Even though the segment name is iram, it is actually mapped to flash */ - iram0_2_seg (RX) : org = 0x400D0018, len = 0x330000-0x18 + iram0_2_seg (RX) : org = 0x400D0020, len = 0x330000-0x20 /* - (0x18 offset above is a convenience for the app binary image generation. Flash cache has 64KB pages. The .bin file - which is flashed to the chip has a 0x18 byte file header. Setting this offset makes it simple to meet the flash - cache MMU's constraint that (paddr % 64KB == vaddr % 64KB).) + (0x20 offset above is a convenience for the app binary image generation. + Flash cache has 64KB pages. The .bin file which is flashed to the chip + has a 0x18 byte file header, and each segment has a 0x08 byte segment + header. Setting this offset makes it simple to meet the flash cache MMU's + constraint that (paddr % 64KB == vaddr % 64KB).) */ #endif // CONFIG_APP_BUILD_USE_FLASH_SECTIONS @@ -76,9 +78,9 @@ MEMORY #ifdef CONFIG_APP_BUILD_USE_FLASH_SECTIONS /* Flash mapped constant data */ - drom0_0_seg (R) : org = 0x3F400018, len = 0x400000-0x18 + drom0_0_seg (R) : org = 0x3F400020, len = 0x400000-0x20 - /* (See iram0_2_seg for meaning of 0x18 offset in the above.) */ + /* (See iram0_2_seg for meaning of 0x20 offset in the above.) */ #endif // CONFIG_APP_BUILD_USE_FLASH_SECTIONS /* RTC fast memory (executable). Persists over deep sleep. diff --git a/components/esp32/panic.c b/components/esp32/panic.c index 5a27f26d0d..2c45ec09f7 100644 --- a/components/esp32/panic.c +++ b/components/esp32/panic.c @@ -608,7 +608,7 @@ static __attribute__((noreturn)) void commonErrorHandler(XtExcFrame *frame) reconfigureAllWdts(); #endif -#if !CONFIG_ESP32_PANIC_HANDLER_IRAM +#if !CONFIG_ESP_PANIC_HANDLER_IRAM // Re-enable CPU cache for current CPU if it was disabled if (!spi_flash_cache_enabled()) { spi_flash_enable_cache(core_id); diff --git a/components/esp32/sleep_modes.c b/components/esp32/sleep_modes.c index 97d0c6d710..86c2091624 100644 --- a/components/esp32/sleep_modes.c +++ b/components/esp32/sleep_modes.c @@ -302,7 +302,7 @@ esp_err_t esp_light_sleep_start(void) const uint32_t flash_enable_time_us = VDD_SDIO_POWERUP_TO_FLASH_READ_US + CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY; -#ifndef CONFIG_ESP32_SPIRAM_SUPPORT +#ifndef CONFIG_SPIRAM const uint32_t vddsdio_pd_sleep_duration = MAX(FLASH_PD_MIN_SLEEP_TIME_US, flash_enable_time_us + LIGHT_SLEEP_TIME_OVERHEAD_US + LIGHT_SLEEP_MIN_TIME_US); @@ -310,7 +310,7 @@ esp_err_t esp_light_sleep_start(void) pd_flags |= RTC_SLEEP_PD_VDDSDIO; s_config.sleep_time_adjustment += flash_enable_time_us; } -#endif //CONFIG_ESP32_SPIRAM_SUPPORT +#endif //CONFIG_SPIRAM rtc_vddsdio_config_t vddsdio_config = rtc_vddsdio_get_config(); diff --git a/components/esp32/spiram.c b/components/esp32/spiram.c index 37ae07e2c0..bb250908c5 100644 --- a/components/esp32/spiram.c +++ b/components/esp32/spiram.c @@ -46,7 +46,7 @@ we add more types of external RAM memory, this can be made into a more intellige #endif #endif -#if CONFIG_ESP32_SPIRAM_SUPPORT +#if CONFIG_SPIRAM static const char* TAG = "spiram"; diff --git a/components/esp32/spiram_psram.c b/components/esp32/spiram_psram.c index b23e7fa9c9..0bd2a96386 100644 --- a/components/esp32/spiram_psram.c +++ b/components/esp32/spiram_psram.c @@ -37,7 +37,7 @@ #include "driver/periph_ctrl.h" #include "bootloader_common.h" -#if CONFIG_ESP32_SPIRAM_SUPPORT +#if CONFIG_SPIRAM #include "soc/rtc.h" //Commands for PSRAM chip @@ -847,4 +847,4 @@ static void IRAM_ATTR psram_cache_init(psram_cache_mode_t psram_cache_mode, psra CLEAR_PERI_REG_MASK(SPI_PIN_REG(0), SPI_CS1_DIS_M); //ENABLE SPI0 CS1 TO PSRAM(CS0--FLASH; CS1--SRAM) } -#endif // CONFIG_ESP32_SPIRAM_SUPPORT +#endif // CONFIG_SPIRAM diff --git a/components/esp32/test/CMakeLists.txt b/components/esp32/test/CMakeLists.txt index 624f11d598..74ed23aeeb 100644 --- a/components/esp32/test/CMakeLists.txt +++ b/components/esp32/test/CMakeLists.txt @@ -1,16 +1,19 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}" - REQUIRES unity test_utils nvs_flash ulp esp_common) +if(IDF_TARGET STREQUAL "esp32") + idf_component_register(SRC_DIRS . + INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR} + REQUIRES unity test_utils nvs_flash ulp esp_common + ) -add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" - COMMAND xxd -i "logo.jpg" "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" - WORKING_DIRECTORY ${COMPONENT_DIR} - DEPENDS "${CMAKE_CURRENT_LIST_DIR}/logo.jpg") + add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" + COMMAND xxd -i "logo.jpg" "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" + WORKING_DIRECTORY ${COMPONENT_DIR} + DEPENDS "${CMAKE_CURRENT_LIST_DIR}/logo.jpg") -add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h") + add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h") -add_dependencies(${COMPONENT_LIB} esp32_test_logo) + add_dependencies(${COMPONENT_LIB} esp32_test_logo) -idf_build_set_property(COMPILE_DEFINITIONS "-DESP_TIMER_DYNAMIC_OVERFLOW_VAL" APPEND) + idf_build_set_property(COMPILE_DEFINITIONS "-DESP_TIMER_DYNAMIC_OVERFLOW_VAL" APPEND) + target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5") +endif() -target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5") diff --git a/components/esp32/test/test_4mpsram.c b/components/esp32/test/test_4mpsram.c index 64210b30be..528d791f41 100644 --- a/components/esp32/test/test_4mpsram.c +++ b/components/esp32/test/test_4mpsram.c @@ -6,7 +6,7 @@ static const char TAG[] = "test_psram"; -#ifdef CONFIG_ESP32_SPIRAM_SUPPORT +#ifdef CONFIG_SPIRAM static void test_psram_content(void) { const int test_size = 2048; @@ -40,7 +40,7 @@ static void test_psram_content(void) TEST_CASE("can use spi when not being used by psram", "[psram_4m]") { spi_host_device_t host; -#if !CONFIG_ESP32_SPIRAM_SUPPORT || !CONFIG_SPIRAM_SPEED_80M || CONFIG_SPIRAM_BANKSWITCH_ENABLE +#if !CONFIG_SPIRAM || !CONFIG_SPIRAM_SPEED_80M || CONFIG_SPIRAM_BANKSWITCH_ENABLE //currently all 8M psram don't need more SPI peripherals host = -1; #elif CONFIG_SPIRAM_OCCUPY_HSPI_HOST @@ -66,7 +66,7 @@ TEST_CASE("can use spi when not being used by psram", "[psram_4m]") TEST_ASSERT(claim_vspi==true); } -#ifdef CONFIG_ESP32_SPIRAM_SUPPORT +#ifdef CONFIG_SPIRAM test_psram_content(); #endif } diff --git a/components/esp32/test/test_aes_sha_rsa.c b/components/esp32/test/test_aes_sha_rsa.c index 8453b68f57..c4aff1d5ed 100644 --- a/components/esp32/test/test_aes_sha_rsa.c +++ b/components/esp32/test/test_aes_sha_rsa.c @@ -2,7 +2,6 @@ #include #include #include "esp_types.h" -#include "esp32/clk.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/esp32/test/test_intr_alloc.c b/components/esp32/test/test_intr_alloc.c index b17fb9e83e..a372675dd0 100644 --- a/components/esp32/test/test_intr_alloc.c +++ b/components/esp32/test/test_intr_alloc.c @@ -4,8 +4,11 @@ #include #include +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/ets_sys.h" - +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#endif #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" diff --git a/components/esp32/test/test_sleep.c b/components/esp32/test/test_sleep.c index 12e268e358..dc40af52c0 100644 --- a/components/esp32/test/test_sleep.c +++ b/components/esp32/test/test_sleep.c @@ -18,6 +18,7 @@ #include "test_utils.h" #include "sdkconfig.h" + #define ESP_EXT0_WAKEUP_LEVEL_LOW 0 #define ESP_EXT0_WAKEUP_LEVEL_HIGH 1 @@ -330,7 +331,7 @@ TEST_CASE("wake up using ext1 when RTC_PERIPH is on (13 low)", "[deepsleep][igno static float get_time_ms(void) { gettimeofday(&tv_stop, NULL); - + float dt = (tv_stop.tv_sec - tv_start.tv_sec) * 1e3f + (tv_stop.tv_usec - tv_start.tv_usec) * 1e-3f; return fabs(dt); @@ -343,20 +344,20 @@ static uint32_t get_cause(void) return wakeup_cause; } -// This test case verifies deactivation of trigger for wake up sources +// This test case verifies deactivation of trigger for wake up sources TEST_CASE("disable source trigger behavior", "[deepsleep]") { float dt = 0; printf("Setup timer and ext0 to wake up immediately from GPIO_13 \n"); - + // Setup ext0 configuration to wake up almost immediately // The wakeup time is proportional to input capacitance * pullup resistance ESP_ERROR_CHECK(rtc_gpio_init(GPIO_NUM_13)); ESP_ERROR_CHECK(gpio_pullup_en(GPIO_NUM_13)); ESP_ERROR_CHECK(gpio_pulldown_dis(GPIO_NUM_13)); ESP_ERROR_CHECK(esp_sleep_enable_ext0_wakeup(GPIO_NUM_13, ESP_EXT0_WAKEUP_LEVEL_HIGH)); - + // Setup timer to wakeup with timeout esp_sleep_enable_timer_wakeup(2000000); @@ -367,22 +368,22 @@ TEST_CASE("disable source trigger behavior", "[deepsleep]") dt = get_time_ms(); printf("Ext0 sleep time = %d \n", (int) dt); - // Check wakeup from Ext0 using time measurement because wakeup cause is + // Check wakeup from Ext0 using time measurement because wakeup cause is // not available in light sleep mode TEST_ASSERT_INT32_WITHIN(100, 100, (int) dt); - + TEST_ASSERT((get_cause() & RTC_EXT0_TRIG_EN) != 0); - + // Disable Ext0 source. Timer source should be triggered ESP_ERROR_CHECK(esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_EXT0)); printf("Disable ext0 trigger and leave timer active.\n"); - + gettimeofday(&tv_start, NULL); esp_light_sleep_start(); dt = get_time_ms(); printf("Timer sleep time = %d \n", (int) dt); - + TEST_ASSERT_INT32_WITHIN(500, 2000, (int) dt); // Additionally check wakeup cause @@ -407,8 +408,8 @@ TEST_CASE("disable source trigger behavior", "[deepsleep]") TEST_ASSERT_INT32_WITHIN(100, 100, (int) dt); TEST_ASSERT((get_cause() & RTC_EXT0_TRIG_EN) != 0); - - // Check error message when source is already disabled + + // Check error message when source is already disabled esp_err_t err_code = esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER); TEST_ASSERT(err_code == ESP_ERR_INVALID_STATE); } @@ -429,7 +430,7 @@ static void trigger_deepsleep(void) // Save start time. Deep sleep. gettimeofday(&start, NULL); esp_sleep_enable_timer_wakeup(1000); - // In function esp_deep_sleep_start() uses function esp_sync_counters_rtc_and_frc() + // In function esp_deep_sleep_start() uses function esp_sync_counters_rtc_and_frc() // to prevent a negative time after wake up. esp_deep_sleep_start(); } diff --git a/components/esp32/test/test_spiram_cache_flush.c b/components/esp32/test/test_spiram_cache_flush.c index 6e984be6ce..e525d21770 100644 --- a/components/esp32/test/test_spiram_cache_flush.c +++ b/components/esp32/test/test_spiram_cache_flush.c @@ -20,8 +20,9 @@ This code tests the interaction between PSRAM and SPI flash routines. #include "esp_spi_flash.h" #include "esp_partition.h" #include "test_utils.h" +#include "soc/soc.h" -#if CONFIG_ESP32_SPIRAM_SUPPORT +#if CONFIG_SPIRAM #if CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC #define USE_CAPS_ALLOC 1 @@ -61,8 +62,8 @@ TEST_CASE("Spiram cache flush on mmap", "[spiram]") mem[0]=heap_caps_malloc(TSTSZ, MALLOC_CAP_SPIRAM); mem[1]=heap_caps_malloc(TSTSZ, MALLOC_CAP_SPIRAM); #else - mem[0]=(void*)0x3f800000; - mem[1]=(void*)0x3f800000+TSTSZ; + mem[0]=(void*)SOC_EXTRAM_DATA_LOW; + mem[1]=(void*)SOC_EXTRAM_DATA_LOW+TSTSZ; #endif assert(mem[0]); assert(mem[1]); @@ -105,8 +106,8 @@ TEST_CASE("Spiram cache flush on write/read", "[spiram]") mem[0]=heap_caps_malloc(TSTSZ, MALLOC_CAP_SPIRAM); mem[1]=heap_caps_malloc(TSTSZ, MALLOC_CAP_SPIRAM); #else - mem[0]=(void*)0x3f800000; - mem[1]=(void*)0x3f800000+TSTSZ; + mem[0]=(void*)SOC_EXTRAM_DATA_LOW; + mem[1]=(void*)SOC_EXTRAM_DATA_LOW+TSTSZ; #endif assert(mem[0]); assert(mem[1]); @@ -148,7 +149,7 @@ IRAM_ATTR TEST_CASE("Spiram memcmp weirdness at 80MHz", "[spiram]") { #if USE_CAPS_ALLOC char *mem2=heap_caps_malloc(0x10000, MALLOC_CAP_SPIRAM); #else - char *mem2=(void*)0x3f800000; + char *mem2=(void*)SOC_EXTRAM_DATA_LOW; #endif #if !CONFIG_SPIRAM_SPEED_80M @@ -179,4 +180,4 @@ IRAM_ATTR TEST_CASE("Spiram memcmp weirdness at 80MHz", "[spiram]") { #endif } -#endif // CONFIG_ESP32_SPIRAM_SUPPORT +#endif // CONFIG_SPIRAM diff --git a/components/esp32s2beta/CMakeLists.txt b/components/esp32s2beta/CMakeLists.txt new file mode 100644 index 0000000000..a21e4f42dd --- /dev/null +++ b/components/esp32s2beta/CMakeLists.txt @@ -0,0 +1,89 @@ +idf_build_get_property(target IDF_TARGET) +idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER) +if(NOT "${target}" STREQUAL "esp32s2beta") + return() +endif() + +if(BOOTLOADER_BUILD) + # For bootloader, all we need from esp32s2beta is headers + idf_component_register(INCLUDE_DIRS include) + target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2beta.peripherals.ld") +else() + # Regular app build + + set(srcs "brownout.c" + "cache_err_int.c" + "clk.c" + "cpu_start.c" + "crosscore_int.c" + "dport_access.c" + "dport_panic_highint_hdl.S" + "esp_adapter.c" + "esp_timer_esp32s2beta.c" + "hw_random.c" + "int_wdt.c" + "intr_alloc.c" + "panic.c" + "pm_esp32s2beta.c" + "pm_trace.c" + "sleep_modes.c" + "spiram.c" + "spiram_psram.c" + "system_api.c" + "task_wdt.c") + set(include_dirs "include") + + set(requires driver esp_event efuse soc) #unfortunately rom/uart uses SOC registers directly + + # driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t + # app_update is added here because cpu_start.c uses esp_ota_get_app_description() function. + set(priv_requires + app_trace app_update bootloader_support log mbedtls nvs_flash + pthread spi_flash vfs wpa_supplicant espcoredump esp_common esp_wifi) + + set(fragments linker.lf ld/esp32s2beta_fragments.lf) + + idf_component_register(SRCS "${srcs}" + INCLUDE_DIRS "${include_dirs}" + LDFRAGMENTS "${fragments}" + REQUIRES "${requires}" + PRIV_REQUIRES "${priv_requires}" + REQUIRED_IDF_TARGETS esp32s2beta) + + target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/esp32s2beta_out.ld") + + # Rely on user code to define app_main + target_link_libraries(${COMPONENT_LIB} INTERFACE "-u app_main") + + # Process the template file through the linker script generation mechanism, and use the output for linking the + # final binary + target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp32s2beta.project.ld.in" PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32.project.ld") + + target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32s2beta.peripherals.ld") + target_link_libraries(${COMPONENT_LIB} PUBLIC gcc) + target_link_libraries(${COMPONENT_LIB} INTERFACE "-u call_user_start_cpu0") + + #ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the + #linker will ignore panic_highint_hdl.S as it has no other files depending on any + #symbols in it. + target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_panic_highint_hdl") + + idf_build_get_property(config_dir CONFIG_DIR) + # Preprocess esp32s2beta.ld linker script to include configuration, becomes esp32s2beta_out.ld + set(LD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ld) + add_custom_command( + OUTPUT esp32s2beta_out.ld + COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32s2beta_out.ld -I ${config_dir} ${LD_DIR}/esp32s2beta.ld + MAIN_DEPENDENCY ${LD_DIR}/esp32s2beta.ld ${sdkconfig_header} + COMMENT "Generating linker script..." + VERBATIM) + + add_custom_target(esp32s2beta_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32s2beta_out.ld) + add_dependencies(${COMPONENT_LIB} esp32s2beta_linker_script) + + # disable stack protection in files which are involved in initialization of that feature + set_source_files_properties( + cpu_start.c + PROPERTIES COMPILE_FLAGS + -fno-stack-protector) +endif() diff --git a/components/esp32s2beta/Kconfig b/components/esp32s2beta/Kconfig new file mode 100644 index 0000000000..351617840d --- /dev/null +++ b/components/esp32s2beta/Kconfig @@ -0,0 +1,597 @@ +menu "ESP32S2-specific" + # TODO: this component simply shouldn't be included + # in the build at the CMake level, but this is currently + # not working so we just hide all items here + visible if IDF_TARGET_ESP32S2BETA + + choice ESP32S2_BETA_CHIP_VERSION + # TODO: remove once final S2 chip is supported + prompt "ESP32-S2 Beta chip version" + default ESP32S2_BETA_VERSION_A + help + There are three versions of ESP32-S2 beta chip with different Wi-Fi PHY: A, B and Marlin3. + + This setting must match the chip for Wi-Fi to work correctly. You can determine + the chip version by reading the markings on top of the chip. It will be one of the + three options given here. + + The Wi-Fi performance of Marlin3 is the best among the three versions of chip. + + config ESP32S2_BETA_VERSION_A + bool "Chip7.2.2-A" + config ESP32S2_BETA_VERSION_B + bool "Chip7.2.2-B" + config ESP32S2_BETA_VERSION_MARLIN3 + bool "Marlin3-B2 or Marlin3-B3" + endchoice + + choice ESP32S2_DEFAULT_CPU_FREQ_MHZ + prompt "CPU frequency" + default ESP32S2_DEFAULT_CPU_FREQ_160 + help + CPU frequency to be set on application startup. + + config ESP32S2_DEFAULT_CPU_FREQ_80 + bool "80 MHz" + config ESP32S2_DEFAULT_CPU_FREQ_160 + bool "160 MHz" + config ESP32S2_DEFAULT_CPU_FREQ_240 + bool "240 MHz" + endchoice + + config ESP32S2_DEFAULT_CPU_FREQ_MHZ + int + default 80 if ESP32S2_DEFAULT_CPU_FREQ_80 + default 160 if ESP32S2_DEFAULT_CPU_FREQ_160 + default 240 if ESP32S2_DEFAULT_CPU_FREQ_240 + + menu "Cache config" + + choice ESP32S2_INSTRUCTION_CACHE_SIZE + prompt "Instruction cache size" + default ESP32S2_INSTRUCTION_CACHE_8KB + help + Instruction cache size to be set on application startup. + If you use 8KB instruction cache rather than 16KB instruction cache, + then the other 8KB will be added to the heap. + + config ESP32S2_INSTRUCTION_CACHE_8KB + bool "8KB" + config ESP32S2_INSTRUCTION_CACHE_16KB + bool "16KB" + endchoice + + choice ESP32S2_INSTRUCTION_CACHE_WAYS + prompt "Instruction cache associated ways" + default ESP32S2_INSTRUCTION_CACHE_8WAYS + help + Instruction cache associated ways to be set on application startup. + + config ESP32S2_INSTRUCTION_CACHE_4WAYS + bool "4 ways" + config ESP32S2_INSTRUCTION_CACHE_8WAYS + bool "8 ways" + endchoice + + choice ESP32S2_INSTRUCTION_CACHE_LINE_SIZE + prompt "Instruction cache line size" + default ESP32S2_INSTRUCTION_CACHE_LINE_32B + help + Instruction cache line size to be set on application startup. + + config ESP32S2_INSTRUCTION_CACHE_LINE_16B + bool "16 Bytes" + config ESP32S2_INSTRUCTION_CACHE_LINE_32B + bool "32 Bytes" + config ESP32S2_INSTRUCTION_CACHE_LINE_64B + bool "64 Bytes" + endchoice + + choice ESP32S2_DATA_CACHE_SIZE + prompt "Data cache size" + default ESP32S2_DATA_CACHE_8KB + help + Data cache size to be set on application startup. + If you use 8KB data cache rather than 16KB data cache, the other 8KB will be added to the heap. + + config ESP32S2_DATA_CACHE_0KB + depends on !ESP32S2_SPIRAM_SUPPORT + bool "0KB" + config ESP32S2_DATA_CACHE_8KB + bool "8KB" + config ESP32S2_DATA_CACHE_16KB + bool "16KB" + endchoice + + choice ESP32S2_DATA_CACHE_ASSOCIATED_WAYS + prompt "Data cache associated ways" + default ESP32S2_DATA_CACHE_8WAYS + help + Data cache associated ways to be set on application startup. + + config ESP32S2_DATA_CACHE_4WAYS + bool "4 ways" + config ESP32S2_DATA_CACHE_8WAYS + bool "8 ways" + endchoice + + choice ESP32S2_DATA_CACHE_LINE_SIZE + prompt "Data cache line size" + default ESP32S2_DATA_CACHE_LINE_32B + help + Data cache line size to be set on application startup. + + config ESP32S2_DATA_CACHE_LINE_16B + bool "16 Bytes" + config ESP32S2_DATA_CACHE_LINE_32B + bool "32 Bytes" + config ESP32S2_DATA_CACHE_LINE_64B + bool "64 Bytes" + endchoice + + config ESP32S2_RODATA_USE_DATA_CACHE + depends on ESP32S2_DATA_CACHE_8KB || ESP32S2_DATA_CACHE_16KB + bool "Use data cache rather than instruction cache to access read only data" + default "n" + help + If enabled, CPU will access rodata through data cache, which will reduce the overload + of instruction cache, however will increase the overload of data cache. + + config ESP32S2_INSTRUCTION_CACHE_WRAP + bool "Enable instruction cache wrap" + default "n" + help + If enabled, instruction cache will use wrap mode to read spi flash (maybe spiram). + The wrap length equals to INSTRUCTION_CACHE_LINE_SIZE. + However, it depends on complex conditions. + + config ESP32S2_DATA_CACHE_WRAP + bool "Enable data cache wrap" + default "n" + help + If enabled, data cache will use wrap mode to read spiram (maybe spi flash). + The wrap length equals to DATA_CACHE_LINE_SIZE. + However, it depends on complex conditions. + + endmenu # Cache config + + # Note: to support SPIRAM across multiple chips, check CONFIG_SPIRAM + # instead + config ESP32S2_SPIRAM_SUPPORT + bool "Support for external, SPI-connected RAM" + default "n" + select SPIRAM + help + This enables support for an external SPI RAM chip, connected in parallel with the + main SPI flash chip. + + menu "SPI RAM config" + depends on ESP32S2_SPIRAM_SUPPORT + + choice SPIRAM_TYPE + prompt "Type of SPI RAM chip in use" + default SPIRAM_TYPE_ESPPSRAM32 + + config SPIRAM_TYPE_ESPPSRAM32 + bool "ESP-PSRAM32 or IS25WP032" + + config SPIRAM_TYPE_ESPPSRAM64 + bool "ESP-PSRAM64 or LY68L6400" + endchoice + + config SPIRAM_SIZE + int + default 4194304 if SPIRAM_TYPE_ESPPSRAM32 + default 8388608 if SPIRAM_TYPE_ESPPSRAM64 + default 0 + + config SPIRAM_FETCH_INSTRUCTIONS + bool "Cache fetch instructions from SPI RAM" + default n + help + If enabled, instruction in flash will be copied into SPIRAM. + If SPIRAM_RODATA also enabled, + you can run the instruction when erasing or programming the flash. + + config SPIRAM_RODATA + bool "Cache load read only data from SPI RAM" + default n + help + If enabled, radata in flash will be copied into SPIRAM. + If SPIRAM_FETCH_INSTRUCTIONS also enabled, + you can run the instruction when erasing or programming the flash. + + config SPIRAM_USE_AHB_DBUS3 + bool "Enable AHB DBUS3 to access SPIRAM" + default n + help + If Enabled, if SPI_CONFIG_SIZE is bigger then 10MB+576KB, + then you can have 4MB more space to map the SPIRAM. + However, the AHB bus is slower than other data cache buses. + + choice SPIRAM_SPEED + prompt "Set RAM clock speed" + default SPIRAM_CACHE_SPEED_40M + help + Select the speed for the SPI RAM chip. + If SPI RAM is enabled, we only support three combinations of SPI speed mode we supported now: + + 1. Flash SPI running at 40Mhz and RAM SPI running at 40Mhz + 2. Flash SPI running at 80Mhz and RAM SPI running at 40Mhz + 3. Flash SPI running at 80Mhz and RAM SPI running at 80Mhz + + Note: If the third mode(80Mhz+80Mhz) is enabled for SPI RAM of type 32MBit, one of the HSPI/VSPI host + will be occupied by the system. Which SPI host to use can be selected by the config item + SPIRAM_OCCUPY_SPI_HOST. Application code should never touch HSPI/VSPI hardware in this case. The + option to select 80MHz will only be visible if the flash SPI speed is also 80MHz. + (ESPTOOLPY_FLASHFREQ_80M is true) + + config SPIRAM_SPEED_80M + bool "80MHz clock speed" + config SPIRAM_SPEED_40M + bool "40Mhz clock speed" + config SPIRAM_SPEED_26M + bool "26Mhz clock speed" + config SPIRAM_SPEED_20M + bool "20Mhz clock speed" + endchoice + + # insert non-chip-specific items here + source "$IDF_PATH/components/esp_common/Kconfig.spiram.common" + + endmenu + + config ESP32S2_MEMMAP_TRACEMEM + bool + default "n" + + config ESP32S2_TRAX + bool "Use TRAX tracing feature" + default "n" + select ESP32S2_MEMMAP_TRACEMEM + help + The ESP32S2 contains a feature which allows you to trace the execution path the processor + has taken through the program. This is stored in a chunk of 32K (16K for single-processor) + of memory that can't be used for general purposes anymore. Disable this if you do not know + what this is. + + config ESP32S2_TRACEMEM_RESERVE_DRAM + hex + default 0x4000 if ESP32S2_MEMMAP_TRACEMEM + default 0x0 + + + choice ESP32S2_UNIVERSAL_MAC_ADDRESSES + bool "Number of universally administered (by IEEE) MAC address" + default ESP32S2_UNIVERSAL_MAC_ADDRESSES_FOUR + help + Configure the number of universally administered (by IEEE) MAC addresses. + During initialisation, MAC addresses for each network interface are generated or derived from a + single base MAC address. + If the number of universal MAC addresses is four, all four interfaces (WiFi station, WiFi softap, + Bluetooth and Ethernet) receive a universally administered MAC address. These are generated + sequentially by adding 0, 1, 2 and 3 (respectively) to the final octet of the base MAC address. + If the number of universal MAC addresses is two, only two interfaces (WiFi station and Bluetooth) + receive a universally administered MAC address. These are generated sequentially by adding 0 + and 1 (respectively) to the base MAC address. The remaining two interfaces (WiFi softap and Ethernet) + receive local MAC addresses. These are derived from the universal WiFi station and Bluetooth MAC + addresses, respectively. + When using the default (Espressif-assigned) base MAC address, either setting can be used. When using + a custom universal MAC address range, the correct setting will depend on the allocation of MAC + addresses in this range (either 2 or 4 per device.) + + config ESP32S2_UNIVERSAL_MAC_ADDRESSES_TWO + bool "Two" + config ESP32S2_UNIVERSAL_MAC_ADDRESSES_FOUR + bool "Four" + endchoice + + config ESP32S2_UNIVERSAL_MAC_ADDRESSES + int + default 2 if ESP32S2_UNIVERSAL_MAC_ADDRESSES_TWO + default 4 if ESP32S2_UNIVERSAL_MAC_ADDRESSES_FOUR + + config ESP32S2_ULP_COPROC_ENABLED + bool "Enable Ultra Low Power (ULP) Coprocessor" + default "n" + help + Set to 'y' if you plan to load a firmware for the coprocessor. + + If this option is enabled, further coprocessor configuration will appear in the Components menu. + + config ESP32S2_ULP_COPROC_RESERVE_MEM + int + prompt "RTC slow memory reserved for coprocessor" if ESP32S2_ULP_COPROC_ENABLED + default 512 if ESP32S2_ULP_COPROC_ENABLED + range 32 8192 if ESP32S2_ULP_COPROC_ENABLED + default 0 if !ESP32S2_ULP_COPROC_ENABLED + range 0 0 if !ESP32S2_ULP_COPROC_ENABLED + help + Bytes of memory to reserve for ULP coprocessor firmware & data. + + Data is reserved at the beginning of RTC slow memory. + + choice ESP32S2_PANIC + prompt "Panic handler behaviour" + default ESP32S2_PANIC_PRINT_REBOOT + help + If FreeRTOS detects unexpected behaviour or an unhandled exception, the panic handler is + invoked. Configure the panic handlers action here. + + config ESP32S2_PANIC_PRINT_HALT + bool "Print registers and halt" + help + Outputs the relevant registers over the serial port and halt the + processor. Needs a manual reset to restart. + + config ESP32S2_PANIC_PRINT_REBOOT + bool "Print registers and reboot" + help + Outputs the relevant registers over the serial port and immediately + reset the processor. + + config ESP32S2_PANIC_SILENT_REBOOT + bool "Silent reboot" + help + Just resets the processor without outputting anything + + config ESP32S2_PANIC_GDBSTUB + bool "Invoke GDBStub" + select ESP_GDBSTUB_ENABLED + help + Invoke gdbstub on the serial port, allowing for gdb to attach to it to do a postmortem + of the crash. + endchoice + + config ESP32S2_DEBUG_OCDAWARE + bool "Make exception and panic handlers JTAG/OCD aware" + default y + help + The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and + instead of panicking, have the debugger stop on the offending instruction. + + config ESP32S2_DEBUG_STUBS_ENABLE + bool "OpenOCD debug stubs" + default COMPILER_OPTIMIZATION_LEVEL_DEBUG + depends on !ESP32S2_TRAX + help + Debug stubs are used by OpenOCD to execute pre-compiled onboard code which does some useful debugging, + e.g. GCOV data dump. + + config ESP32S2_BROWNOUT_DET + bool "Hardware brownout detect & reset" + default y + help + The ESP32S2 has a built-in brownout detector which can detect if the voltage is lower than + a specific value. If this happens, it will reset the chip in order to prevent unintended + behaviour. + + choice ESP32S2_BROWNOUT_DET_LVL_SEL + prompt "Brownout voltage level" + depends on ESP32S2_BROWNOUT_DET + default ESP32S2_BROWNOUT_DET_LVL_SEL_25 + help + The brownout detector will reset the chip when the supply voltage is approximately + below this level. Note that there may be some variation of brownout voltage level + between each ESP32 chip. + + #The voltage levels here are estimates, more work needs to be done to figure out the exact voltages + #of the brownout threshold levels. + config ESP32S2_BROWNOUT_DET_LVL_SEL_0 + bool "2.43V +/- 0.05" + config ESP32S2_BROWNOUT_DET_LVL_SEL_1 + bool "2.48V +/- 0.05" + config ESP32S2_BROWNOUT_DET_LVL_SEL_2 + bool "2.58V +/- 0.05" + config ESP32S2_BROWNOUT_DET_LVL_SEL_3 + bool "2.62V +/- 0.05" + config ESP32S2_BROWNOUT_DET_LVL_SEL_4 + bool "2.67V +/- 0.05" + config ESP32S2_BROWNOUT_DET_LVL_SEL_5 + bool "2.70V +/- 0.05" + config ESP32S2_BROWNOUT_DET_LVL_SEL_6 + bool "2.77V +/- 0.05" + config ESP32S2_BROWNOUT_DET_LVL_SEL_7 + bool "2.80V +/- 0.05" + endchoice + + config ESP32S2_BROWNOUT_DET_LVL + int + default 0 if ESP32S2_BROWNOUT_DET_LVL_SEL_0 + default 1 if ESP32S2_BROWNOUT_DET_LVL_SEL_1 + default 2 if ESP32S2_BROWNOUT_DET_LVL_SEL_2 + default 3 if ESP32S2_BROWNOUT_DET_LVL_SEL_3 + default 4 if ESP32S2_BROWNOUT_DET_LVL_SEL_4 + default 5 if ESP32S2_BROWNOUT_DET_LVL_SEL_5 + default 6 if ESP32S2_BROWNOUT_DET_LVL_SEL_6 + default 7 if ESP32S2_BROWNOUT_DET_LVL_SEL_7 + + + # Note about the use of "FRC1" name: currently FRC1 timer is not used for + # high resolution timekeeping anymore. Instead the esp_timer API, implemented + # using FRC2 timer, is used. + # FRC1 name in the option name is kept for compatibility. + choice ESP32S2_TIME_SYSCALL + prompt "Timers used for gettimeofday function" + default ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 + help + This setting defines which hardware timers are used to + implement 'gettimeofday' and 'time' functions in C library. + + - If both high-resolution and RTC timers are used, timekeeping will + continue in deep sleep. Time will be reported at 1 microsecond + resolution. This is the default, and the recommended option. + - If only high-resolution timer is used, gettimeofday will + provide time at microsecond resolution. + Time will not be preserved when going into deep sleep mode. + - If only RTC timer is used, timekeeping will continue in + deep sleep, but time will be measured at 6.(6) microsecond + resolution. Also the gettimeofday function itself may take + longer to run. + - If no timers are used, gettimeofday and time functions + return -1 and set errno to ENOSYS. + - When RTC is used for timekeeping, two RTC_STORE registers are + used to keep time in deep sleep mode. + + config ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 + bool "RTC and high-resolution timer" + config ESP32S2_TIME_SYSCALL_USE_RTC + bool "RTC" + config ESP32S2_TIME_SYSCALL_USE_FRC1 + bool "High-resolution timer" + config ESP32S2_TIME_SYSCALL_USE_NONE + bool "None" + endchoice + + choice ESP32S2_RTC_CLK_SRC + prompt "RTC clock source" + default ESP32S2_RTC_CLK_SRC_INT_RC + help + Choose which clock is used as RTC clock source. + + config ESP32S2_RTC_CLK_SRC_INT_RC + bool "Internal 150kHz RC oscillator" + config ESP32S2_RTC_CLK_SRC_EXT_CRYS + bool "External 32kHz crystal" + endchoice + + config ESP32S2_RTC_CLK_CAL_CYCLES + int "Number of cycles for RTC_SLOW_CLK calibration" + default 3000 if ESP32S2_RTC_CLK_SRC_EXT_CRYS + default 1024 if ESP32S2_RTC_CLK_SRC_INT_RC + range 0 125000 + help + When the startup code initializes RTC_SLOW_CLK, it can perform + calibration by comparing the RTC_SLOW_CLK frequency with main XTAL + frequency. This option sets the number of RTC_SLOW_CLK cycles measured + by the calibration routine. Higher numbers increase calibration + precision, which may be important for applications which spend a lot of + time in deep sleep. Lower numbers reduce startup time. + + When this option is set to 0, clock calibration will not be performed at + startup, and approximate clock frequencies will be assumed: + + - 150000 Hz if internal RC oscillator is used as clock source. For this use value 1024. + - 32768 Hz if the 32k crystal oscillator is used. For this use value 3000 or more. + In case more value will help improve the definition of the launch of the crystal. + If the crystal could not start, it will be switched to internal RC. + + choice ESP32S2_XTAL_FREQ_SEL + prompt "Main XTAL frequency" + default ESP32S2_XTAL_FREQ_40 + help + ESP32 currently supports the following XTAL frequencies: + + - 26 MHz + - 40 MHz + + Startup code can automatically estimate XTAL frequency. This feature + uses the internal 8MHz oscillator as a reference. Because the internal + oscillator frequency is temperature dependent, it is not recommended + to use automatic XTAL frequency detection in applications which need + to work at high ambient temperatures and use high-temperature + qualified chips and modules. + config ESP32S2_XTAL_FREQ_40 + bool "40 MHz" + config ESP32S2_XTAL_FREQ_26 + bool "26 MHz" + config ESP32S2_XTAL_FREQ_AUTO + bool "Autodetect" + endchoice + + # Keep these values in sync with rtc_xtal_freq_t enum in soc/rtc.h + config ESP32S2_XTAL_FREQ + int + default 0 if ESP32S2_XTAL_FREQ_AUTO + default 40 if ESP32S2_XTAL_FREQ_40 + default 26 if ESP32S2_XTAL_FREQ_26 + + config ESP32S2_DISABLE_BASIC_ROM_CONSOLE + bool "Permanently disable BASIC ROM Console" + default n + help + If set, the first time the app boots it will disable the BASIC ROM Console + permanently (by burning an eFuse). + + Otherwise, the BASIC ROM Console starts on reset if no valid bootloader is + read from the flash. + + (Enabling secure boot also disables the BASIC ROM Console by default.) + + config ESP32S2_NO_BLOBS + bool "No Binary Blobs" + depends on !BT_ENABLED + default n + help + If enabled, this disables the linking of binary libraries in the application build. Note + that after enabling this Wi-Fi/Bluetooth will not work. + +endmenu # ESP32S2-Specific + +menu "Power Management" + # TODO: this component simply shouldn't be included + # in the build at the CMake level, but this is currently + # not working so we just hide all items here + visible if IDF_TARGET_ESP32S2BETA + + config PM_ENABLE + bool "Support for power management" + default n + help + If enabled, application is compiled with support for power management. + This option has run-time overhead (increased interrupt latency, + longer time to enter idle state), and it also reduces accuracy of + RTOS ticks and timers used for timekeeping. + Enable this option if application uses power management APIs. + + config PM_DFS_INIT_AUTO + bool "Enable dynamic frequency scaling (DFS) at startup" + depends on PM_ENABLE + default n + help + If enabled, startup code configures dynamic frequency scaling. + Max CPU frequency is set to CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ setting, + min frequency is set to XTAL frequency. + If disabled, DFS will not be active until the application + configures it using esp_pm_configure function. + + config PM_USE_RTC_TIMER_REF + bool "Use RTC timer to prevent time drift (EXPERIMENTAL)" + depends on PM_ENABLE && (ESP32S2_TIME_SYSCALL_USE_RTC || ESP32S2_TIME_SYSCALL_USE_RTC_FRC1) + default n + help + When APB clock frequency changes, high-resolution timer (esp_timer) + scale and base value need to be adjusted. Each adjustment may cause + small error, and over time such small errors may cause time drift. + If this option is enabled, RTC timer will be used as a reference to + compensate for the drift. + It is recommended that this option is only used if 32k XTAL is selected + as RTC clock source. + + config PM_PROFILING + bool "Enable profiling counters for PM locks" + depends on PM_ENABLE + default n + help + If enabled, esp_pm_* functions will keep track of the amount of time + each of the power management locks has been held, and esp_pm_dump_locks + function will print this information. + This feature can be used to analyze which locks are preventing the chip + from going into a lower power state, and see what time the chip spends + in each power saving mode. This feature does incur some run-time + overhead, so should typically be disabled in production builds. + + config PM_TRACE + bool "Enable debug tracing of PM using GPIOs" + depends on PM_ENABLE + default n + help + If enabled, some GPIOs will be used to signal events such as RTOS ticks, + frequency switching, entry/exit from idle state. Refer to pm_trace.c + file for the list of GPIOs. + This feature is intended to be used when analyzing/debugging behavior + of power management implementation, and should be kept disabled in + applications. + + +endmenu # "Power Management" diff --git a/components/esp32s2beta/Makefile.projbuild b/components/esp32s2beta/Makefile.projbuild new file mode 100644 index 0000000000..2e7a946644 --- /dev/null +++ b/components/esp32s2beta/Makefile.projbuild @@ -0,0 +1 @@ +# nothing here, esp32s2beta is not suppoted in Make build system \ No newline at end of file diff --git a/components/esp32s2beta/brownout.c b/components/esp32s2beta/brownout.c new file mode 100644 index 0000000000..5257e1820c --- /dev/null +++ b/components/esp32s2beta/brownout.c @@ -0,0 +1,56 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include +#include "sdkconfig.h" +#include "soc/soc.h" +#include "soc/cpu.h" +#include "soc/rtc_cntl_reg.h" +#include "esp32s2beta/rom/ets_sys.h" +#include "esp_private/system_internal.h" +#include "driver/rtc_cntl.h" +#include "freertos/FreeRTOS.h" + +#ifdef CONFIG_ESP32S2_BROWNOUT_DET_LVL +#define BROWNOUT_DET_LVL CONFIG_ESP32S2_BROWNOUT_DET_LVL +#else +#define BROWNOUT_DET_LVL 0 +#endif //CONFIG_ESP32S2_BROWNOUT_DET_LVL + +static void rtc_brownout_isr_handler(void *arg) +{ + /* Normally RTC ISR clears the interrupt flag after the application-supplied + * handler returns. Since restart is called here, the flag needs to be + * cleared manually. + */ + REG_WRITE(RTC_CNTL_INT_CLR_REG, RTC_CNTL_BROWN_OUT_INT_CLR); + /* Stall the other CPU to make sure the code running there doesn't use UART + * at the same time as the following ets_printf. + */ + esp_cpu_stall(!xPortGetCoreID()); + ets_printf("\r\nBrownout detector was triggered\r\n\r\n"); + esp_restart_noos(); +} + +void esp_brownout_init(void) +{ +// TODO: implement brownout threshold configuration for esp32s2beta - IDF-751 + + ESP_ERROR_CHECK( rtc_isr_register(rtc_brownout_isr_handler, NULL, RTC_CNTL_BROWN_OUT_INT_ENA_M) ); + + REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_BROWN_OUT_INT_ENA_M); +} diff --git a/components/esp32s2beta/cache_err_int.c b/components/esp32s2beta/cache_err_int.c new file mode 100644 index 0000000000..914be97b85 --- /dev/null +++ b/components/esp32s2beta/cache_err_int.c @@ -0,0 +1,73 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* + The cache has an interrupt that can be raised as soon as an access to a cached + region (flash, psram) is done without the cache being enabled. We use that here + to panic the CPU, which from a debugging perspective is better than grabbing bad + data from the bus. +*/ + +#include +#include +#include +#include +#include "freertos/FreeRTOS.h" +#include "esp_err.h" +#include "esp_intr_alloc.h" +#include "esp_attr.h" +#include "soc/dport_reg.h" +#include "soc/periph_defs.h" +#include "sdkconfig.h" +#include "esp32s2beta/dport_access.h" + +void esp_cache_err_int_init(void) +{ + uint32_t core_id = xPortGetCoreID(); + ESP_INTR_DISABLE(ETS_CACHEERR_INUM); + + // We do not register a handler for the interrupt because it is interrupt + // level 4 which is not serviceable from C. Instead, xtensa_vectors.S has + // a call to the panic handler for + // this interrupt. + intr_matrix_set(core_id, ETS_CACHE_IA_INTR_SOURCE, ETS_CACHEERR_INUM); + + // Enable invalid cache access interrupt when the cache is disabled. + // When the interrupt happens, we can not determine the CPU where the + // invalid cache access has occurred. We enable the interrupt to catch + // invalid access on both CPUs, but the interrupt is connected to the + // CPU which happens to call this function. + // For this reason, panic handler backtrace will not be correct if the + // interrupt is connected to PRO CPU and invalid access happens on the APP + // CPU. + + DPORT_SET_PERI_REG_MASK(DPORT_PRO_CACHE_IA_INT_EN_REG, + DPORT_MMU_ENTRY_FAULT_INT_ENA | + DPORT_DCACHE_REJECT_INT_ENA | + DPORT_DCACHE_WRITE_FLASH_INT_ENA | + DPORT_DC_PRELOAD_SIZE_FAULT_INT_ENA | + DPORT_DC_SYNC_SIZE_FAULT_INT_ENA | + DPORT_ICACHE_REJECT_INT_ENA | + DPORT_IC_PRELOAD_SIZE_FAULT_INT_ENA | + DPORT_IC_SYNC_SIZE_FAULT_INT_ENA | + DPORT_CACHE_DBG_INT_CLR | + DPORT_CACHE_DBG_EN); + + ESP_INTR_ENABLE(ETS_CACHEERR_INUM); +} + +int IRAM_ATTR esp_cache_err_get_cpuid(void) +{ + return PRO_CPU_NUM; +} diff --git a/components/esp32s2beta/clk.c b/components/esp32s2beta/clk.c new file mode 100644 index 0000000000..94a4587955 --- /dev/null +++ b/components/esp32s2beta/clk.c @@ -0,0 +1,321 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include +#include "sdkconfig.h" +#include "esp_attr.h" +#include "esp_log.h" +#include "esp32s2beta/clk.h" +#include "esp_clk_internal.h" +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/uart.h" +#include "esp32s2beta/rom/rtc.h" +#include "soc/system_reg.h" +#include "soc/dport_access.h" +#include "soc/soc.h" +#include "soc/rtc.h" +#include "soc/rtc_wdt.h" +#include "soc/rtc_periph.h" +#include "soc/i2s_reg.h" +#include "driver/periph_ctrl.h" +#include "xtensa/core-macros.h" +#include "bootloader_clock.h" +#include "soc/syscon_reg.h" + +/* Number of cycles to wait from the 32k XTAL oscillator to consider it running. + * Larger values increase startup delay. Smaller values may cause false positive + * detection (i.e. oscillator runs for a few cycles and then stops). + */ +#define SLOW_CLK_CAL_CYCLES CONFIG_ESP32S2_RTC_CLK_CAL_CYCLES + +#define MHZ (1000000) + +static void select_rtc_slow_clk(rtc_slow_freq_t slow_clk); + +// g_ticks_us defined in ROMs for PRO and APP CPU +extern uint32_t g_ticks_per_us_pro; +#if !CONFIG_FREERTOS_UNICORE +extern uint32_t g_ticks_per_us_app; +#endif //!CONFIG_FREERTOS_UNICORE + +static const char* TAG = "clk"; + + +void esp_clk_init(void) +{ + rtc_config_t cfg = RTC_CONFIG_DEFAULT(); + rtc_init(cfg); + + assert(rtc_clk_xtal_freq_get() != RTC_XTAL_FREQ_AUTO); + + rtc_clk_fast_freq_set(RTC_FAST_FREQ_8M); + +#ifdef CONFIG_BOOTLOADER_WDT_ENABLE + // WDT uses a SLOW_CLK clock source. After a function select_rtc_slow_clk a frequency of this source can changed. + // If the frequency changes from 90kHz to 32kHz, then the timeout set for the WDT will increase 2.8 times. + // Therefore, for the time of frequency change, set a new lower timeout value (1.6 sec). + // This prevents excessive delay before resetting in case the supply voltage is drawdown. + // (If frequency is changed from 90kHz to 32kHz then WDT timeout will increased to 1.6sec * 90/32 = 4.5 sec). + rtc_wdt_protect_off(); + rtc_wdt_feed(); + rtc_wdt_set_time(RTC_WDT_STAGE0, 1600); + rtc_wdt_protect_on(); +#endif + +#ifdef CONFIG_ESP32S2_RTC_CLK_SRC_EXT_CRYS + select_rtc_slow_clk(RTC_SLOW_FREQ_32K_XTAL); +#else + select_rtc_slow_clk(RTC_SLOW_FREQ_RTC); +#endif + +#ifdef CONFIG_BOOTLOADER_WDT_ENABLE + // After changing a frequency WDT timeout needs to be set for new frequency. + rtc_wdt_protect_off(); + rtc_wdt_feed(); + rtc_wdt_set_time(RTC_WDT_STAGE0, CONFIG_BOOTLOADER_WDT_TIME_MS); + rtc_wdt_protect_on(); +#endif + + uint32_t freq_mhz = CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ; + rtc_cpu_freq_t freq = RTC_CPU_FREQ_80M; + switch(freq_mhz) { + case 240: + freq = RTC_CPU_FREQ_240M; + break; + case 160: + freq = RTC_CPU_FREQ_160M; + break; + case 80: + freq = RTC_CPU_FREQ_80M; + break; + default: + freq_mhz = 80; + freq = RTC_CPU_FREQ_80M; + break; + } + + // Wait for UART TX to finish, otherwise some UART output will be lost + // when switching APB frequency + uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM); + + uint32_t freq_before = rtc_clk_cpu_freq_value(rtc_clk_cpu_freq_get()) / MHZ ; + + rtc_clk_cpu_freq_set(freq); + + // Re calculate the ccount to make time calculation correct. + uint32_t freq_after = CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ; + XTHAL_SET_CCOUNT( XTHAL_GET_CCOUNT() * freq_after / freq_before ); +} + +int IRAM_ATTR esp_clk_cpu_freq(void) +{ + return g_ticks_per_us_pro * 1000000; +} + +int IRAM_ATTR esp_clk_apb_freq(void) +{ + return MIN(g_ticks_per_us_pro, 80) * 1000000; +} + +void IRAM_ATTR ets_update_cpu_frequency(uint32_t ticks_per_us) +{ + /* Update scale factors used by ets_delay_us */ + g_ticks_per_us_pro = ticks_per_us; +#if !CONFIG_FREERTOS_UNICORE + g_ticks_per_us_app = ticks_per_us; +#endif //!CONFIG_FREERTOS_UNICORE +} + +static void select_rtc_slow_clk(rtc_slow_freq_t slow_clk) +{ + uint32_t cal_val = 0; + uint32_t wait = 0; + const uint32_t warning_timeout = 3 /* sec */ * 32768 /* Hz */ / (2 * SLOW_CLK_CAL_CYCLES); + bool changing_clock_to_150k = false; + do { + if (slow_clk == RTC_SLOW_FREQ_32K_XTAL) { + /* 32k XTAL oscillator needs to be enabled and running before it can + * be used. Hardware doesn't have a direct way of checking if the + * oscillator is running. Here we use rtc_clk_cal function to count + * the number of main XTAL cycles in the given number of 32k XTAL + * oscillator cycles. If the 32k XTAL has not started up, calibration + * will time out, returning 0. + */ + ESP_EARLY_LOGD(TAG, "waiting for 32k oscillator to start up"); + rtc_clk_32k_enable(true); + cal_val = rtc_clk_cal(RTC_CAL_32K_XTAL, SLOW_CLK_CAL_CYCLES); + if(cal_val == 0 || cal_val < 15000000L){ + ESP_EARLY_LOGE(TAG, "RTC: Not found External 32 kHz XTAL. Switching to Internal 150 kHz RC chain"); + slow_clk = RTC_SLOW_FREQ_RTC; + changing_clock_to_150k = true; + } + } + rtc_clk_slow_freq_set(slow_clk); + if (changing_clock_to_150k == true && wait > 1){ + // This helps when there are errors when switching the clock from External 32 kHz XTAL to Internal 150 kHz RC chain. + rtc_clk_32k_enable(false); + uint32_t min_bootstrap = 5; // Min bootstrapping for continue switching the clock. + rtc_clk_32k_bootstrap(min_bootstrap); + rtc_clk_32k_enable(true); + } + + if (SLOW_CLK_CAL_CYCLES > 0) { + /* TODO: 32k XTAL oscillator has some frequency drift at startup. + * Improve calibration routine to wait until the frequency is stable. + */ + cal_val = rtc_clk_cal(RTC_CAL_RTC_MUX, SLOW_CLK_CAL_CYCLES); + } else { + const uint64_t cal_dividend = (1ULL << RTC_CLK_CAL_FRACT) * 1000000ULL; + cal_val = (uint32_t) (cal_dividend / rtc_clk_slow_freq_get_hz()); + } + if (++wait % warning_timeout == 0) { + ESP_EARLY_LOGW(TAG, "still waiting for source selection RTC"); + } + } while (cal_val == 0); + ESP_EARLY_LOGD(TAG, "RTC_SLOW_CLK calibration value: %d", cal_val); + esp_clk_slowclk_cal_set(cal_val); +} + +void rtc_clk_select_rtc_slow_clk(void) +{ + select_rtc_slow_clk(RTC_SLOW_FREQ_32K_XTAL); +} + +/* This function is not exposed as an API at this point. + * All peripheral clocks are default enabled after chip is powered on. + * This function disables some peripheral clocks when cpu starts. + * These peripheral clocks are enabled when the peripherals are initialized + * and disabled when they are de-initialized. + */ +void esp_perip_clk_init(void) +{ + uint32_t common_perip_clk, hwcrypto_perip_clk, wifi_bt_sdio_clk = 0; + uint32_t common_perip_clk1 = 0; + +#if CONFIG_FREERTOS_UNICORE + RESET_REASON rst_reas[1]; +#else + RESET_REASON rst_reas[2]; +#endif + + rst_reas[0] = rtc_get_reset_reason(0); + +#if !CONFIG_FREERTOS_UNICORE + rst_reas[1] = rtc_get_reset_reason(1); +#endif + + /* For reason that only reset CPU, do not disable the clocks + * that have been enabled before reset. + */ + if ((rst_reas[0] >= TG0WDT_CPU_RESET && rst_reas[0] <= TG0WDT_CPU_RESET && rst_reas[0] != RTCWDT_BROWN_OUT_RESET) +#if !CONFIG_FREERTOS_UNICORE + || (rst_reas[1] >= TGWDT_CPU_RESET && rst_reas[1] <= RTCWDT_CPU_RESET) +#endif + ) { + common_perip_clk = ~DPORT_READ_PERI_REG(DPORT_PERIP_CLK_EN_REG); + hwcrypto_perip_clk = ~DPORT_READ_PERI_REG(DPORT_PERI_CLK_EN_REG); + wifi_bt_sdio_clk = ~DPORT_READ_PERI_REG(DPORT_WIFI_CLK_EN_REG); + } + else { + common_perip_clk = DPORT_WDG_CLK_EN | + DPORT_I2S0_CLK_EN | +#if CONFIG_ESP_CONSOLE_UART_NUM != 0 + DPORT_UART_CLK_EN | +#endif +#if CONFIG_ESP_CONSOLE_UART_NUM != 1 + DPORT_UART1_CLK_EN | +#endif + DPORT_USB_CLK_EN | + DPORT_SPI2_CLK_EN | + DPORT_I2C_EXT0_CLK_EN | + DPORT_UHCI0_CLK_EN | + DPORT_RMT_CLK_EN | + DPORT_PCNT_CLK_EN | + DPORT_LEDC_CLK_EN | + DPORT_TIMERGROUP1_CLK_EN | + DPORT_SPI3_CLK_EN | + DPORT_SPI4_CLK_EN | + DPORT_PWM0_CLK_EN | + DPORT_CAN_CLK_EN | + DPORT_PWM1_CLK_EN | + DPORT_I2S1_CLK_EN | + DPORT_SPI2_DMA_CLK_EN | + DPORT_SPI3_DMA_CLK_EN | + DPORT_PWM2_CLK_EN | + DPORT_PWM3_CLK_EN; + common_perip_clk1 = DPORT_SPI_SHARED_DMA_CLK_EN; + hwcrypto_perip_clk = DPORT_PERI_EN_AES | + DPORT_PERI_EN_SHA | + DPORT_PERI_EN_RSA | + DPORT_PERI_EN_SECUREBOOT; + wifi_bt_sdio_clk = DPORT_WIFI_CLK_WIFI_EN | + DPORT_WIFI_CLK_BT_EN_M | + DPORT_WIFI_CLK_UNUSED_BIT5 | + DPORT_WIFI_CLK_UNUSED_BIT12 | + DPORT_WIFI_CLK_SDIOSLAVE_EN | + DPORT_WIFI_CLK_SDIO_HOST_EN | + DPORT_WIFI_CLK_EMAC_EN; + } + + //Reset the communication peripherals like I2C, SPI, UART, I2S and bring them to known state. + common_perip_clk |= DPORT_I2S0_CLK_EN | +#if CONFIG_ESP_CONSOLE_UART_NUM != 0 + DPORT_UART_CLK_EN | +#endif +#if CONFIG_ESP_CONSOLE_UART_NUM != 1 + DPORT_UART1_CLK_EN | +#endif + DPORT_USB_CLK_EN | + DPORT_SPI2_CLK_EN | + DPORT_I2C_EXT0_CLK_EN | + DPORT_UHCI0_CLK_EN | + DPORT_RMT_CLK_EN | + DPORT_UHCI1_CLK_EN | + DPORT_SPI3_CLK_EN | + DPORT_SPI4_CLK_EN | + DPORT_I2C_EXT1_CLK_EN | + DPORT_I2S1_CLK_EN | + DPORT_SPI2_DMA_CLK_EN | + DPORT_SPI3_DMA_CLK_EN; + common_perip_clk1 = DPORT_SPI_SHARED_DMA_CLK_EN; + + /* Change I2S clock to audio PLL first. Because if I2S uses 160MHz clock, + * the current is not reduced when disable I2S clock. + */ + REG_SET_FIELD(I2S_CLKM_CONF_REG(0), I2S_CLK_SEL, I2S_CLK_AUDIO_PLL); + REG_SET_FIELD(I2S_CLKM_CONF_REG(1), I2S_CLK_SEL, I2S_CLK_AUDIO_PLL); + + /* Disable some peripheral clocks. */ + DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, common_perip_clk); + DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, common_perip_clk); + + DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN1_REG, common_perip_clk1); + DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN1_REG, common_perip_clk1); + + /* Disable hardware crypto clocks. */ + DPORT_CLEAR_PERI_REG_MASK(DPORT_PERI_CLK_EN_REG, hwcrypto_perip_clk); + DPORT_SET_PERI_REG_MASK(DPORT_PERI_RST_EN_REG, hwcrypto_perip_clk); + + /* Disable WiFi/BT/SDIO clocks. */ + DPORT_CLEAR_PERI_REG_MASK(DPORT_WIFI_CLK_EN_REG, wifi_bt_sdio_clk); + + /* Enable WiFi MAC and POWER clocks */ + DPORT_SET_PERI_REG_MASK(DPORT_WIFI_CLK_EN_REG, DPORT_WIFI_CLK_WIFI_EN); + + /* Enable RNG clock. */ + periph_module_enable(PERIPH_RNG_MODULE); +} diff --git a/components/esp32s2beta/component.mk b/components/esp32s2beta/component.mk new file mode 100644 index 0000000000..a2f7dc1797 --- /dev/null +++ b/components/esp32s2beta/component.mk @@ -0,0 +1,4 @@ +# +# Component Makefile +# +COMPONENT_CONFIG_ONLY := 1 diff --git a/components/esp32s2beta/cpu_start.c b/components/esp32s2beta/cpu_start.c new file mode 100644 index 0000000000..ac8c73d14e --- /dev/null +++ b/components/esp32s2beta/cpu_start.c @@ -0,0 +1,402 @@ +// 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. + +#include +#include +#include "sdkconfig.h" +#include "esp_attr.h" +#include "esp_err.h" + +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/uart.h" +#include "esp32s2beta/rom/rtc.h" +#include "esp32s2beta/rom/cache.h" +#include "esp32s2beta/dport_access.h" +#include "esp32s2beta/brownout.h" +#include "esp32s2beta/cache_err_int.h" +#include "esp32s2beta/spiram.h" + +#include "soc/cpu.h" +#include "soc/rtc.h" +#include "soc/dport_reg.h" +#include "soc/io_mux_reg.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/timer_group_reg.h" +#include "soc/periph_defs.h" +#include "soc/rtc_wdt.h" +#include "driver/rtc_io.h" + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" +#include "freertos/queue.h" +#include "freertos/portmacro.h" + +#include "esp_heap_caps_init.h" +#include "esp_system.h" +#include "esp_spi_flash.h" +#include "nvs_flash.h" +#include "esp_event.h" +#include "esp_spi_flash.h" +#include "esp_ipc.h" +#include "esp_private/crosscore_int.h" +#include "esp_log.h" +#include "esp_vfs_dev.h" +#include "esp_newlib.h" +#include "esp_int_wdt.h" +#include "esp_task.h" +#include "esp_task_wdt.h" +#include "esp_phy_init.h" +#include "esp_coexist_internal.h" +#include "esp_debug_helpers.h" +#include "esp_core_dump.h" +#include "esp_app_trace.h" +#include "esp_private/dbg_stubs.h" +#include "esp_clk_internal.h" +#include "esp_timer.h" +#include "esp_pm.h" +#include "esp_private/pm_impl.h" +#include "trax.h" +#include "esp_efuse.h" + +#define STRINGIFY(s) STRINGIFY2(s) +#define STRINGIFY2(s) #s + +void start_cpu0(void) __attribute__((weak, alias("start_cpu0_default"))) __attribute__((noreturn)); +void start_cpu0_default(void) IRAM_ATTR __attribute__((noreturn)); + +static void do_global_ctors(void); +static void main_task(void* args); +extern void app_main(void); +extern esp_err_t esp_pthread_init(void); + +extern int _bss_start; +extern int _bss_end; +extern int _rtc_bss_start; +extern int _rtc_bss_end; +extern int _init_start; +extern void (*__init_array_start)(void); +extern void (*__init_array_end)(void); +extern volatile int port_xSchedulerRunning[2]; + +static const char* TAG = "cpu_start"; + +struct object { long placeholder[ 10 ]; }; +void __register_frame_info (const void *begin, struct object *ob); +extern char __eh_frame[]; + +//If CONFIG_SPIRAM_IGNORE_NOTFOUND is set and external RAM is not found or errors out on testing, this is set to false. +static bool s_spiram_okay=true; + +/* + * We arrive here after the bootloader finished loading the program from flash. The hardware is mostly uninitialized, + * and the app CPU is in reset. We do have a stack, so we can do the initialization in C. + */ + +void IRAM_ATTR call_start_cpu0(void) +{ + RESET_REASON rst_reas; + + cpu_configure_region_protection(); + + //Move exception vectors to IRAM + asm volatile (\ + "wsr %0, vecbase\n" \ + ::"r"(&_init_start)); + + rst_reas = rtc_get_reset_reason(0); + + // from panic handler we can be reset by RWDT or TG0WDT + if (rst_reas == RTCWDT_SYS_RESET || rst_reas == TG0WDT_SYS_RESET) { +#ifndef CONFIG_BOOTLOADER_WDT_ENABLE + rtc_wdt_disable(); +#endif + } + + //Clear BSS. Please do not attempt to do any complex stuff (like early logging) before this. + memset(&_bss_start, 0, (&_bss_end - &_bss_start) * sizeof(_bss_start)); + + /* Unless waking from deep sleep (implying RTC memory is intact), clear RTC bss */ + if (rst_reas != DEEPSLEEP_RESET) { + memset(&_rtc_bss_start, 0, (&_rtc_bss_end - &_rtc_bss_start) * sizeof(_rtc_bss_start)); + } + + /* Configure the mode of instruction cache : cache size, cache associated ways, cache line size. */ +extern void esp_config_instruction_cache_mode(void); + esp_config_instruction_cache_mode(); + + /* copy MMU table from ICache to DCache, so we can use DCache to access rodata later. */ +#if CONFIG_ESP32S2_RODATA_USE_DATA_CACHE + MMU_Drom0_I2D_Copy(); +#endif + + /* If we need use SPIRAM, we should use data cache, or if we want to access rodata, we also should use data cache. + Configure the mode of data : cache size, cache associated ways, cache line size. + Enable data cache, so if we don't use SPIRAM, it just works. */ +#if CONFIG_SPIRAM_BOOT_INIT || CONFIG_ESP32S2_RODATA_USE_DATA_CACHE +extern void esp_config_data_cache_mode(void); + esp_config_data_cache_mode(); + Cache_Enable_DCache(0); +#endif + + /* In SPIRAM code, we will reconfigure data cache, as well as instruction cache, so that we can: + 1. make data buses works with SPIRAM + 2. make instruction and rodata work with SPIRAM, still through instruction cache */ +#if CONFIG_SPIRAM_BOOT_INIT + esp_spiram_init_cache(); + if (esp_spiram_init() != ESP_OK) { +#if CONFIG_SPIRAM_IGNORE_NOTFOUND + ESP_EARLY_LOGI(TAG, "Failed to init external RAM; continuing without it."); + s_spiram_okay = false; +#else + ESP_EARLY_LOGE(TAG, "Failed to init external RAM!"); + abort(); +#endif + } +#endif + + /* Start to use data cache to access rodata. */ +#if CONFIG_ESP32S2_RODATA_USE_DATA_CACHE +extern void esp_switch_rodata_to_dcache(void); + esp_switch_rodata_to_dcache(); +#endif + + ESP_EARLY_LOGI(TAG, "Pro cpu up."); + ESP_EARLY_LOGI(TAG, "Single core mode"); + +#if CONFIG_SPIRAM_MEMTEST + if (s_spiram_okay) { + bool ext_ram_ok=esp_spiram_test(); + if (!ext_ram_ok) { + ESP_EARLY_LOGE(TAG, "External RAM failed memory test!"); + abort(); + } + } +#endif + +#if CONFIG_SPIRAM_FETCH_INSTRUCTIONS +extern void esp_spiram_enable_instruction_access(void); + esp_spiram_enable_instruction_access(); +#endif +#if SPIRAM_RODATA +extern void esp_spiram_enable_rodata_access(void); + esp_spiram_enable_rodata_access(); +#endif + +#if CONFIG_ESP32S2_INSTRUCTION_CACHE_WRAP || CONFIG_ESP32S2_DATA_CACHE_WRAP +uint32_t icache_wrap_enable = 0,dcache_wrap_enable = 0; +#if CONFIG_ESP32S2_INSTRUCTION_CACHE_WRAP + icache_wrap_enable = 1; +#endif +#if CONFIG_ESP32S2_DATA_CACHE_WRAP + dcache_wrap_enable = 1; +#endif +extern void esp_enable_cache_wrap(uint32_t icache_wrap_enable, uint32_t dcache_wrap_enable); + esp_enable_cache_wrap(icache_wrap_enable, dcache_wrap_enable); +#endif + + /* Initialize heap allocator. WARNING: This *needs* to happen *after* the app cpu has booted. + If the heap allocator is initialized first, it will put free memory linked list items into + memory also used by the ROM. Starting the app cpu will let its ROM initialize that memory, + corrupting those linked lists. Initializing the allocator *after* the app cpu has booted + works around this problem. + With SPI RAM enabled, there's a second reason: half of the SPI RAM will be managed by the + app CPU, and when that is not up yet, the memory will be inaccessible and heap_caps_init may + fail initializing it properly. */ + heap_caps_init(); + + ESP_EARLY_LOGI(TAG, "Pro cpu start user code"); + start_cpu0(); +} + +static void intr_matrix_clear(void) +{ + //Clear all the interrupt matrix register + for (int i = ETS_WIFI_MAC_INTR_SOURCE; i < ETS_MAX_INTR_SOURCE; i++) { + intr_matrix_set(0, i, ETS_INVALID_INUM); + } +} + +void start_cpu0_default(void) +{ + esp_err_t err; + esp_setup_syscall_table(); + + if (s_spiram_okay) { +#if CONFIG_SPIRAM_BOOT_INIT && (CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC) + esp_err_t r=esp_spiram_add_to_heapalloc(); + if (r != ESP_OK) { + ESP_EARLY_LOGE(TAG, "External RAM could not be added to heap!"); + abort(); + } +#if CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL + r=esp_spiram_reserve_dma_pool(CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL); + if (r != ESP_OK) { + ESP_EARLY_LOGE(TAG, "Could not reserve internal/DMA pool!"); + abort(); + } +#endif +#if CONFIG_SPIRAM_USE_MALLOC + heap_caps_malloc_extmem_enable(CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL); +#endif +#endif + } + +//Enable trace memory and immediately start trace. +#if CONFIG_ESP32S2_TRAX + trax_enable(TRAX_ENA_PRO); + trax_start_trace(TRAX_DOWNCOUNT_WORDS); +#endif + esp_clk_init(); + esp_perip_clk_init(); + intr_matrix_clear(); + +#ifndef CONFIG_CONSOLE_UART_NONE +#ifdef CONFIG_PM_ENABLE + const int uart_clk_freq = REF_CLK_FREQ; + /* When DFS is enabled, use REFTICK as UART clock source */ + CLEAR_PERI_REG_MASK(UART_CONF0_REG(CONFIG_ESP_CONSOLE_UART_NUM), UART_TICK_REF_ALWAYS_ON); +#else + const int uart_clk_freq = APB_CLK_FREQ; +#endif // CONFIG_PM_DFS_ENABLE + uart_div_modify(CONFIG_ESP_CONSOLE_UART_NUM, (uart_clk_freq << 4) / CONFIG_CONSOLE_UART_BAUDRATE); +#endif // CONFIG_CONSOLE_UART_NONE + +#if CONFIG_ESP32S2_BROWNOUT_DET + esp_brownout_init(); +#endif +#if CONFIG_ESP32S2_DISABLE_BASIC_ROM_CONSOLE + esp_efuse_disable_basic_rom_console(); +#endif + rtc_gpio_force_hold_dis_all(); + esp_vfs_dev_uart_register(); + esp_reent_init(_GLOBAL_REENT); +#ifndef CONFIG_CONSOLE_UART_NONE + const char* default_uart_dev = "/dev/uart/" STRINGIFY(CONFIG_ESP_CONSOLE_UART_NUM); + _GLOBAL_REENT->_stdin = fopen(default_uart_dev, "r"); + _GLOBAL_REENT->_stdout = fopen(default_uart_dev, "w"); + _GLOBAL_REENT->_stderr = fopen(default_uart_dev, "w"); +#else + _GLOBAL_REENT->_stdin = (FILE*) &__sf_fake_stdin; + _GLOBAL_REENT->_stdout = (FILE*) &__sf_fake_stdout; + _GLOBAL_REENT->_stderr = (FILE*) &__sf_fake_stderr; +#endif + esp_timer_init(); + esp_set_time_from_rtc(); +#if CONFIG_ESP32_APPTRACE_ENABLE + err = esp_apptrace_init(); + assert(err == ESP_OK && "Failed to init apptrace module on PRO CPU!"); +#endif +#if CONFIG_SYSVIEW_ENABLE + SEGGER_SYSVIEW_Conf(); +#endif +#if CONFIG_ESP32S2_DEBUG_STUBS_ENABLE + esp_dbg_stubs_init(); +#endif + err = esp_pthread_init(); + assert(err == ESP_OK && "Failed to init pthread module!"); + + do_global_ctors(); +#if CONFIG_ESP_INT_WDT + esp_int_wdt_init(); + //Initialize the interrupt watch dog + esp_int_wdt_cpu_init(); +#endif + esp_cache_err_int_init(); + esp_crosscore_int_init(); + spi_flash_init(); + /* init default OS-aware flash access critical section */ + spi_flash_guard_set(&g_flash_guard_default_ops); +#ifdef CONFIG_PM_ENABLE + esp_pm_impl_init(); +#ifdef CONFIG_PM_DFS_INIT_AUTO + rtc_cpu_freq_t max_freq; + rtc_clk_cpu_freq_from_mhz(CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ, &max_freq); + esp_pm_config_esp32_t cfg = { + .max_cpu_freq = max_freq, + .min_cpu_freq = RTC_CPU_FREQ_XTAL + }; + esp_pm_configure(&cfg); +#endif //CONFIG_PM_DFS_INIT_AUTO +#endif //CONFIG_PM_ENABLE + +#if CONFIG_ESP32_ENABLE_COREDUMP + esp_core_dump_init(); +#endif + + portBASE_TYPE res = xTaskCreatePinnedToCore(&main_task, "main", + ESP_TASK_MAIN_STACK, NULL, + ESP_TASK_MAIN_PRIO, NULL, 0); + assert(res == pdTRUE); + ESP_LOGI(TAG, "Starting scheduler on PRO CPU."); + vTaskStartScheduler(); + abort(); /* Only get to here if not enough free heap to start scheduler */ +} + +#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS +size_t __cxx_eh_arena_size_get(void) +{ + return CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE; +} +#endif + +static void do_global_ctors(void) +{ +#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS + static struct object ob; + __register_frame_info( __eh_frame, &ob ); +#endif + + void (**p)(void); + for (p = &__init_array_end - 1; p >= &__init_array_start; --p) { + (*p)(); + } +} + +static void main_task(void* args) +{ + //Enable allocation in region where the startup stacks were located. + heap_caps_enable_nonos_stack_heaps(); + + //Initialize task wdt if configured to do so +#ifdef CONFIG_ESP_TASK_WDT_PANIC + ESP_ERROR_CHECK(esp_task_wdt_init(CONFIG_ESP_TASK_WDT_TIMEOUT_S, true)); +#elif CONFIG_ESP_TASK_WDT + ESP_ERROR_CHECK(esp_task_wdt_init(CONFIG_ESP_TASK_WDT_TIMEOUT_S, false)); +#endif + + //Add IDLE 0 to task wdt +#ifdef CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 + TaskHandle_t idle_0 = xTaskGetIdleTaskHandleForCPU(0); + if(idle_0 != NULL){ + ESP_ERROR_CHECK(esp_task_wdt_add(idle_0)); + } +#endif + + // Now that the application is about to start, disable boot watchdog +#ifndef CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE + rtc_wdt_disable(); +#endif + +#ifdef CONFIG_BOOTLOADER_EFUSE_SECURE_VERSION_EMULATE + const esp_partition_t *efuse_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_EFUSE_EM, NULL); + if (efuse_partition) { + esp_efuse_init(efuse_partition->address, efuse_partition->size); + } +#endif + + app_main(); + vTaskDelete(NULL); +} + diff --git a/components/esp32s2beta/crosscore_int.c b/components/esp32s2beta/crosscore_int.c new file mode 100644 index 0000000000..f1e24ca285 --- /dev/null +++ b/components/esp32s2beta/crosscore_int.c @@ -0,0 +1,104 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#include +#include + +#include "esp_attr.h" +#include "esp_err.h" +#include "esp_intr_alloc.h" + +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/uart.h" + +#include "soc/cpu.h" +#include "soc/dport_reg.h" +#include "soc/io_mux_reg.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/periph_defs.h" + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" +#include "freertos/queue.h" +#include "freertos/portmacro.h" + + +#define REASON_YIELD BIT(0) +#define REASON_FREQ_SWITCH BIT(1) + +static portMUX_TYPE reason_spinlock = portMUX_INITIALIZER_UNLOCKED; +static volatile uint32_t reason; + +/* +ToDo: There is a small chance the CPU already has yielded when this ISR is serviced. In that case, it's running the intended task but +the ISR will cause it to switch _away_ from it. portYIELD_FROM_ISR will probably just schedule the task again, but have to check that. +*/ +static inline void IRAM_ATTR esp_crosscore_isr_handle_yield(void) +{ + portYIELD_FROM_ISR(); +} + +static void IRAM_ATTR esp_crosscore_isr(void *arg) { + uint32_t my_reason_val; + //A pointer to the correct reason item is passed to this ISR. + volatile uint32_t *my_reason=arg; + + //Clear the interrupt first. + DPORT_WRITE_PERI_REG(DPORT_CPU_INTR_FROM_CPU_0_REG, 0); + //Grab the reason and clear it. + portENTER_CRITICAL_ISR(&reason_spinlock); + my_reason_val=*my_reason; + *my_reason=0; + portEXIT_CRITICAL_ISR(&reason_spinlock); + + //Check what we need to do. + if (my_reason_val & REASON_YIELD) { + esp_crosscore_isr_handle_yield(); + } + if (my_reason_val & REASON_FREQ_SWITCH) { + /* Nothing to do here; the frequency switch event was already + * handled by a hook in xtensa_vectors.S. Could be used in the future + * to allow DFS features without the extra latency of the ISR hook. + */ + } +} + +//Initialize the crosscore interrupt on this core. +void esp_crosscore_int_init(void) { + portENTER_CRITICAL(&reason_spinlock); + reason = 0; + portEXIT_CRITICAL(&reason_spinlock); + ESP_ERROR_CHECK(esp_intr_alloc(ETS_FROM_CPU_INTR0_SOURCE, ESP_INTR_FLAG_IRAM, esp_crosscore_isr, (void*)&reason, NULL)); +} + +static void IRAM_ATTR esp_crosscore_int_send(int core_id, uint32_t reason_mask) { + assert(core_id +#include +#include "soc/dport_access.h" + +// Read a sequence of DPORT registers to the buffer. +void esp_dport_access_read_buffer(uint32_t *buff_out, uint32_t address, uint32_t num_words) +{ + for (uint32_t i = 0; i < num_words; ++i) { + buff_out[i] = DPORT_SEQUENCE_REG_READ(address + i * 4); + } +} diff --git a/components/esp32s2beta/dport_panic_highint_hdl.S b/components/esp32s2beta/dport_panic_highint_hdl.S new file mode 100644 index 0000000000..7ade4d6b93 --- /dev/null +++ b/components/esp32s2beta/dport_panic_highint_hdl.S @@ -0,0 +1,120 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#include +#include +#include +#include "freertos/xtensa_context.h" +#include "esp_private/panic_reason.h" +#include "sdkconfig.h" +#include "soc/soc.h" +#include "soc/dport_reg.h" + +/* + +Interrupt , a high-priority interrupt, is used for several things: +- Cache error panic handler +- Interrupt watchdog panic handler + +*/ + + .section .iram1,"ax" + .global xt_highint4 + .type xt_highint4,@function + .align 4 +xt_highint4: + + /* Allocate exception frame and save minimal context. */ + mov a0, sp + addi sp, sp, -XT_STK_FRMSZ + s32i a0, sp, XT_STK_A1 + #if XCHAL_HAVE_WINDOWED + s32e a0, sp, -12 /* for debug backtrace */ + #endif + rsr a0, PS /* save interruptee's PS */ + s32i a0, sp, XT_STK_PS + rsr a0, EPC_4 /* save interruptee's PC */ + s32i a0, sp, XT_STK_PC + #if XCHAL_HAVE_WINDOWED + s32e a0, sp, -16 /* for debug backtrace */ + #endif + s32i a12, sp, XT_STK_A12 /* _xt_context_save requires A12- */ + s32i a13, sp, XT_STK_A13 /* A13 to have already been saved */ + call0 _xt_context_save + + /* Save vaddr into exception frame */ + rsr a0, EXCVADDR + s32i a0, sp, XT_STK_EXCVADDR + + /* Figure out reason, save into EXCCAUSE reg */ + + rsr a0, INTERRUPT + extui a0, a0, ETS_CACHEERR_INUM, 1 /* get cacheerr int bit */ + beqz a0, 1f + /* Kill this interrupt; we cannot reset it. */ + rsr a0, INTENABLE + movi a4, ~(1< +#include +#include +#include +#include +#include + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" +#include "freertos/event_groups.h" +#include "freertos/xtensa_api.h" +#include "freertos/portmacro.h" +#include "freertos/xtensa_api.h" +#include "esp_types.h" +#include "esp_system.h" +#include "esp_task.h" +#include "esp_intr_alloc.h" +#include "esp_attr.h" +#include "esp_log.h" +#include "esp_event.h" +#include "esp_heap_caps.h" +#include "esp_private/wifi_os_adapter.h" +#include "esp_private/wifi.h" +#include "esp_phy_init.h" +#if CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/clk.h" +#endif +#include "driver/periph_ctrl.h" +#include "nvs.h" +#include "os.h" +#include "esp_smartconfig.h" +#include "esp_coexist_internal.h" +#include "esp_coexist_adapter.h" + +#define TAG "esp_adapter" + +/* + If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly. + If failed, try to allocate it in internal memory then. + */ +IRAM_ATTR void *wifi_malloc( size_t size ) +{ +#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP + return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); +#else + return malloc(size); +#endif +} + +/* + If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly. + If failed, try to allocate it in internal memory then. + */ +IRAM_ATTR void *wifi_realloc( void *ptr, size_t size ) +{ +#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP + return heap_caps_realloc_prefer(ptr, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); +#else + return realloc(ptr, size); +#endif +} + +/* + If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly. + If failed, try to allocate it in internal memory then. + */ +IRAM_ATTR void *wifi_calloc( size_t n, size_t size ) +{ +#if CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP + return heap_caps_calloc_prefer(n, size, 2, MALLOC_CAP_DEFAULT|MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); +#else + return calloc(n, size); +#endif +} + +static void * IRAM_ATTR wifi_zalloc_wrapper(size_t size) +{ + void *ptr = wifi_calloc(1, size); + if (ptr) { + memset(ptr, 0, size); + } + return ptr; +} + +wifi_static_queue_t* wifi_create_queue( int queue_len, int item_size) +{ + wifi_static_queue_t *queue = NULL; + + queue = (wifi_static_queue_t*)heap_caps_malloc(sizeof(wifi_static_queue_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); + if (!queue) { + return NULL; + } + +#if CONFIG_SPIRAM_USE_MALLOC + + queue->storage = heap_caps_calloc(1, sizeof(StaticQueue_t) + (queue_len*item_size), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); + if (!queue->storage) { + goto _error; + } + + queue->handle = xQueueCreateStatic( queue_len, item_size, ((uint8_t*)(queue->storage)) + sizeof(StaticQueue_t), (StaticQueue_t*)(queue->storage)); + + if (!queue->handle) { + goto _error; + } + + return queue; + +_error: + if (queue) { + if (queue->storage) { + free(queue->storage); + } + + free(queue); + } + + return NULL; +#else + queue->handle = xQueueCreate( queue_len, item_size); + return queue; +#endif +} + +void wifi_delete_queue(wifi_static_queue_t *queue) +{ + if (queue) { + vQueueDelete(queue->handle); + +#if CONFIG_SPIRAM_USE_MALLOC + if (queue->storage) { + free(queue->storage); + } +#endif + + free(queue); + } +} + +static void * wifi_create_queue_wrapper(int queue_len, int item_size) +{ + return wifi_create_queue(queue_len, item_size); +} + +static void wifi_delete_queue_wrapper(void *queue) +{ + wifi_delete_queue(queue); +} + +static void set_isr_wrapper(int32_t n, void *f, void *arg) +{ + xt_set_interrupt_handler(n, (xt_handler)f, arg); +} + +static void * spin_lock_create_wrapper(void) +{ + portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; + void *mux = malloc(sizeof(portMUX_TYPE)); + + if (mux) { + memcpy(mux,&tmp,sizeof(portMUX_TYPE)); + return mux; + } + return NULL; +} + +static uint32_t IRAM_ATTR wifi_int_disable_wrapper(void *wifi_int_mux) +{ + if (xPortInIsrContext()) { + portENTER_CRITICAL_ISR(wifi_int_mux); + } else { + portENTER_CRITICAL(wifi_int_mux); + } + + return 0; +} + +static void IRAM_ATTR wifi_int_restore_wrapper(void *wifi_int_mux, uint32_t tmp) +{ + if (xPortInIsrContext()) { + portEXIT_CRITICAL_ISR(wifi_int_mux); + } else { + portEXIT_CRITICAL(wifi_int_mux); + } +} + +static void IRAM_ATTR task_yield_from_isr_wrapper(void) +{ + portYIELD_FROM_ISR(); +} + +static void * semphr_create_wrapper(uint32_t max, uint32_t init) +{ + return (void *)xSemaphoreCreateCounting(max, init); +} + +static void semphr_delete_wrapper(void *semphr) +{ + vSemaphoreDelete(semphr); +} + +static void wifi_thread_semphr_free(void* data) +{ + xSemaphoreHandle *sem = (xSemaphoreHandle*)(data); + + if (sem) { + vSemaphoreDelete(sem); + } +} + +static void * wifi_thread_semphr_get_wrapper(void) +{ + static bool s_wifi_thread_sem_key_init = false; + static pthread_key_t s_wifi_thread_sem_key; + xSemaphoreHandle sem = NULL; + + if (s_wifi_thread_sem_key_init == false) { + if (0 != pthread_key_create(&s_wifi_thread_sem_key, wifi_thread_semphr_free)) { + return NULL; + } + s_wifi_thread_sem_key_init = true; + } + + sem = pthread_getspecific(s_wifi_thread_sem_key); + if (!sem) { + sem = xSemaphoreCreateCounting(1, 0); + if (sem) { + pthread_setspecific(s_wifi_thread_sem_key, sem); + ESP_LOGV(TAG, "thread sem create: sem=%p", sem); + } + } + + ESP_LOGV(TAG, "thread sem get: sem=%p", sem); + return (void*)sem; +} + +static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreTakeFromISR(semphr, hptw); +} + +static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw) +{ + return (int32_t)xSemaphoreGiveFromISR(semphr, hptw); +} + +static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xSemaphoreTake(semphr, portMAX_DELAY); + } else { + return (int32_t)xSemaphoreTake(semphr, block_time_tick); + } +} + +static int32_t semphr_give_wrapper(void *semphr) +{ + return (int32_t)xSemaphoreGive(semphr); +} + +static void * recursive_mutex_create_wrapper(void) +{ + return (void *)xSemaphoreCreateRecursiveMutex(); +} + +static void * mutex_create_wrapper(void) +{ + return (void *)xSemaphoreCreateMutex(); +} + +static void mutex_delete_wrapper(void *mutex) +{ + vSemaphoreDelete(mutex); +} + +static int32_t IRAM_ATTR mutex_lock_wrapper(void *mutex) +{ + return (int32_t)xSemaphoreTakeRecursive(mutex, portMAX_DELAY); +} + +static int32_t IRAM_ATTR mutex_unlock_wrapper(void *mutex) +{ + return (int32_t)xSemaphoreGiveRecursive(mutex); +} + +static void * queue_create_wrapper(uint32_t queue_len, uint32_t item_size) +{ + return (void *)xQueueCreate(queue_len, item_size); +} + +static int32_t queue_send_wrapper(void *queue, void *item, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xQueueSend(queue, item, portMAX_DELAY); + } else { + return (int32_t)xQueueSend(queue, item, block_time_tick); + } +} + +static int32_t IRAM_ATTR queue_send_from_isr_wrapper(void *queue, void *item, void *hptw) +{ + return (int32_t)xQueueSendFromISR(queue, item, hptw); +} + +static int32_t queue_send_to_back_wrapper(void *queue, void *item, uint32_t block_time_tick) +{ + return (int32_t)xQueueGenericSend(queue, item, block_time_tick, queueSEND_TO_BACK); +} + +static int32_t queue_send_to_front_wrapper(void *queue, void *item, uint32_t block_time_tick) +{ + return (int32_t)xQueueGenericSend(queue, item, block_time_tick, queueSEND_TO_FRONT); +} + +static int32_t queue_recv_wrapper(void *queue, void *item, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)xQueueReceive(queue, item, portMAX_DELAY); + } else { + return (int32_t)xQueueReceive(queue, item, block_time_tick); + } +} + +static uint32_t event_group_wait_bits_wrapper(void *event, uint32_t bits_to_wait_for, int clear_on_exit, int wait_for_all_bits, uint32_t block_time_tick) +{ + if (block_time_tick == OSI_FUNCS_TIME_BLOCKING) { + return (uint32_t)xEventGroupWaitBits(event, bits_to_wait_for, clear_on_exit, wait_for_all_bits, portMAX_DELAY); + } else { + return (uint32_t)xEventGroupWaitBits(event, bits_to_wait_for, clear_on_exit, wait_for_all_bits, block_time_tick); + } +} + +static int32_t task_create_pinned_to_core_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id) +{ + return (uint32_t)xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < portNUM_PROCESSORS ? core_id : tskNO_AFFINITY)); +} + +static int32_t task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle) +{ + return (uint32_t)xTaskCreate(task_func, name, stack_depth, param, prio, task_handle); +} + +static int32_t IRAM_ATTR task_ms_to_tick_wrapper(uint32_t ms) +{ + return (int32_t)(ms / portTICK_PERIOD_MS); +} + + +static int32_t task_get_max_priority_wrapper(void) +{ + return (int32_t)(configMAX_PRIORITIES); +} + +static int32_t esp_event_post_wrapper(const char* event_base, int32_t event_id, void* event_data, size_t event_data_size, uint32_t ticks_to_wait) +{ + if (ticks_to_wait == OSI_FUNCS_TIME_BLOCKING) { + return (int32_t)esp_event_post(event_base, event_id, event_data, event_data_size, portMAX_DELAY); + } else { + return (int32_t)esp_event_post(event_base, event_id, event_data, event_data_size, ticks_to_wait); + } +} + +static void IRAM_ATTR timer_arm_wrapper(void *timer, uint32_t tmout, bool repeat) +{ + ets_timer_arm(timer, tmout, repeat); +} + +static void IRAM_ATTR timer_disarm_wrapper(void *timer) +{ + ets_timer_disarm(timer); +} + +static void timer_done_wrapper(void *ptimer) +{ + ets_timer_done(ptimer); +} + +static void timer_setfn_wrapper(void *ptimer, void *pfunction, void *parg) +{ + ets_timer_setfn(ptimer, pfunction, parg); +} + +static void IRAM_ATTR timer_arm_us_wrapper(void *ptimer, uint32_t us, bool repeat) +{ + ets_timer_arm_us(ptimer, us, repeat); +} + +static int get_time_wrapper(void *t) +{ + return os_get_time(t); +} + +static void * IRAM_ATTR malloc_internal_wrapper(size_t size) +{ + return heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); +} + +static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) +{ + return heap_caps_realloc(ptr, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); +} + +static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size) +{ + return heap_caps_calloc(n, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); +} + +static void * IRAM_ATTR zalloc_internal_wrapper(size_t size) +{ + void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + if (ptr) { + memset(ptr, 0, size); + } + return ptr; +} + +static uint32_t coex_status_get_wrapper(void) +{ +#if CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE + return coex_status_get(); +#else + return 0; +#endif +} + +static void coex_condition_set_wrapper(uint32_t type, bool dissatisfy) +{ +#if CONFIG_SW_COEXIST_ENABLE + coex_condition_set(type, dissatisfy); +#endif +} + +static int coex_wifi_request_wrapper(uint32_t event, uint32_t latency, uint32_t duration) +{ +#if CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE + return coex_wifi_request(event, latency, duration); +#else + return 0; +#endif +} + +static int coex_wifi_release_wrapper(uint32_t event) +{ +#if CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE + return coex_wifi_release(event); +#else + return 0; +#endif +} + +int IRAM_ATTR coex_bt_request_wrapper(uint32_t event, uint32_t latency, uint32_t duration) +{ +#if CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE + return coex_bt_request(event, latency, duration); +#else + return 0; +#endif +} + +int IRAM_ATTR coex_bt_release_wrapper(uint32_t event) +{ +#if CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE + return coex_bt_release(event); +#else + return 0; +#endif +} + +int coex_register_bt_cb_wrapper(coex_func_cb_t cb) +{ +#if CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE + return coex_register_bt_cb(cb); +#else + return 0; +#endif +} + +uint32_t IRAM_ATTR coex_bb_reset_lock_wrapper(void) +{ +#if CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE + return coex_bb_reset_lock(); +#else + return 0; +#endif +} + +void IRAM_ATTR coex_bb_reset_unlock_wrapper(uint32_t restore) +{ +#if CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE + coex_bb_reset_unlock(restore); +#endif +} + +static void IRAM_ATTR esp_empty_wrapper(void) +{ + +} + +wifi_osi_funcs_t g_wifi_osi_funcs = { + ._version = ESP_WIFI_OS_ADAPTER_VERSION, + ._set_isr = set_isr_wrapper, + ._ints_on = xt_ints_on, + ._ints_off = xt_ints_off, + ._spin_lock_create = spin_lock_create_wrapper, + ._spin_lock_delete = free, + ._wifi_int_disable = wifi_int_disable_wrapper, + ._wifi_int_restore = wifi_int_restore_wrapper, + ._task_yield_from_isr = task_yield_from_isr_wrapper, + ._semphr_create = semphr_create_wrapper, + ._semphr_delete = semphr_delete_wrapper, + ._semphr_take = semphr_take_wrapper, + ._semphr_give = semphr_give_wrapper, + ._wifi_thread_semphr_get = wifi_thread_semphr_get_wrapper, + ._mutex_create = mutex_create_wrapper, + ._recursive_mutex_create = recursive_mutex_create_wrapper, + ._mutex_delete = mutex_delete_wrapper, + ._mutex_lock = mutex_lock_wrapper, + ._mutex_unlock = mutex_unlock_wrapper, + ._queue_create = queue_create_wrapper, + ._queue_delete = vQueueDelete, + ._queue_send = queue_send_wrapper, + ._queue_send_from_isr = queue_send_from_isr_wrapper, + ._queue_send_to_back = queue_send_to_back_wrapper, + ._queue_send_to_front = queue_send_to_front_wrapper, + ._queue_recv = queue_recv_wrapper, + ._queue_msg_waiting = uxQueueMessagesWaiting, + ._event_group_create = xEventGroupCreate, + ._event_group_delete = vEventGroupDelete, + ._event_group_set_bits = xEventGroupSetBits, + ._event_group_clear_bits = xEventGroupClearBits, + ._event_group_wait_bits = event_group_wait_bits_wrapper, + ._task_create_pinned_to_core = task_create_pinned_to_core_wrapper, + ._task_create = task_create_wrapper, + ._task_delete = vTaskDelete, + ._task_delay = vTaskDelay, + ._task_ms_to_tick = task_ms_to_tick_wrapper, + ._task_get_current_task = xTaskGetCurrentTaskHandle, + ._task_get_max_priority = task_get_max_priority_wrapper, + ._malloc = malloc, + ._free = free, + ._event_post = esp_event_post_wrapper, + ._get_free_heap_size = esp_get_free_heap_size, + ._rand = esp_random, + ._dport_access_stall_other_cpu_start_wrap = esp_empty_wrapper, + ._dport_access_stall_other_cpu_end_wrap = esp_empty_wrapper, + ._phy_rf_deinit = esp_phy_rf_deinit, + ._phy_load_cal_and_init = esp_phy_load_cal_and_init, + ._read_mac = esp_read_mac, + ._timer_arm = timer_arm_wrapper, + ._timer_disarm = timer_disarm_wrapper, + ._timer_done = timer_done_wrapper, + ._timer_setfn = timer_setfn_wrapper, + ._timer_arm_us = timer_arm_us_wrapper, + ._periph_module_enable = periph_module_enable, + ._periph_module_disable = periph_module_disable, + ._esp_timer_get_time = esp_timer_get_time, + ._nvs_set_i8 = nvs_set_i8, + ._nvs_get_i8 = nvs_get_i8, + ._nvs_set_u8 = nvs_set_u8, + ._nvs_get_u8 = nvs_get_u8, + ._nvs_set_u16 = nvs_set_u16, + ._nvs_get_u16 = nvs_get_u16, + ._nvs_open = nvs_open, + ._nvs_close = nvs_close, + ._nvs_commit = nvs_commit, + ._nvs_set_blob = nvs_set_blob, + ._nvs_get_blob = nvs_get_blob, + ._nvs_erase_key = nvs_erase_key, + ._get_random = os_get_random, + ._get_time = get_time_wrapper, + ._random = os_random, +#if CONFIG_IDF_TARGET_ESP32S2BETA + ._slowclk_cal_get = esp_clk_slowclk_cal_get, +#endif + ._log_write = esp_log_write, + ._log_timestamp = esp_log_timestamp, + ._malloc_internal = malloc_internal_wrapper, + ._realloc_internal = realloc_internal_wrapper, + ._calloc_internal = calloc_internal_wrapper, + ._zalloc_internal = zalloc_internal_wrapper, + ._wifi_malloc = wifi_malloc, + ._wifi_realloc = wifi_realloc, + ._wifi_calloc = wifi_calloc, + ._wifi_zalloc = wifi_zalloc_wrapper, + ._wifi_create_queue = wifi_create_queue_wrapper, + ._wifi_delete_queue = wifi_delete_queue_wrapper, + ._modem_sleep_enter = esp_modem_sleep_enter, + ._modem_sleep_exit = esp_modem_sleep_exit, + ._modem_sleep_register = esp_modem_sleep_register, + ._modem_sleep_deregister = esp_modem_sleep_deregister, + ._coex_status_get = coex_status_get_wrapper, + ._coex_condition_set = coex_condition_set_wrapper, + ._coex_wifi_request = coex_wifi_request_wrapper, + ._coex_wifi_release = coex_wifi_release_wrapper, + ._magic = ESP_WIFI_OS_ADAPTER_MAGIC, +}; + +coex_adapter_funcs_t g_coex_adapter_funcs = { + ._version = COEX_ADAPTER_VERSION, + ._spin_lock_create = spin_lock_create_wrapper, + ._spin_lock_delete = free, + ._int_disable = wifi_int_disable_wrapper, + ._int_enable = wifi_int_restore_wrapper, + ._task_yield_from_isr = task_yield_from_isr_wrapper, + ._semphr_create = semphr_create_wrapper, + ._semphr_delete = semphr_delete_wrapper, + ._semphr_take_from_isr = semphr_take_from_isr_wrapper, + ._semphr_give_from_isr = semphr_give_from_isr_wrapper, + ._semphr_take = semphr_take_wrapper, + ._semphr_give = semphr_give_wrapper, + ._is_in_isr = xPortInIsrContext, + ._malloc_internal = malloc_internal_wrapper, + ._free = free, + ._timer_disarm = timer_disarm_wrapper, + ._timer_done = timer_done_wrapper, + ._timer_setfn = timer_setfn_wrapper, + ._timer_arm_us = timer_arm_us_wrapper, + ._esp_timer_get_time = esp_timer_get_time, + ._magic = COEX_ADAPTER_MAGIC, +}; diff --git a/components/esp32s2beta/esp_clk_internal.h b/components/esp32s2beta/esp_clk_internal.h new file mode 100644 index 0000000000..f1f8964573 --- /dev/null +++ b/components/esp32s2beta/esp_clk_internal.h @@ -0,0 +1,44 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +/** + * @file esp_clk_internal.h + * + * Private clock-related functions + */ + +/** + * @brief Initialize clock-related settings + * + * Called from cpu_start.c, not intended to be called from other places. + * This function configures the CPU clock, RTC slow and fast clocks, and + * performs RTC slow clock calibration. + */ +void esp_clk_init(void); + + +/** + * @brief Disables clock of some peripherals + * + * Called from cpu_start.c, not intended to be called from other places. + * This function disables clock of useless peripherals when cpu starts. + */ +void esp_perip_clk_init(void); + +/* Selects an external clock source (32 kHz) for RTC. + * Only internal use in unit test. + */ +void rtc_clk_select_rtc_slow_clk(void); diff --git a/components/esp32s2beta/esp_timer_esp32s2beta.c b/components/esp32s2beta/esp_timer_esp32s2beta.c new file mode 100644 index 0000000000..ff01cfe70a --- /dev/null +++ b/components/esp32s2beta/esp_timer_esp32s2beta.c @@ -0,0 +1,407 @@ +// Copyright 2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "esp_err.h" +#include "esp_timer.h" +#include "esp_system.h" +#include "esp_task.h" +#include "esp_attr.h" +#include "esp_intr_alloc.h" +#include "esp_log.h" +#include "esp32s2beta/clk.h" +#include "esp_private/esp_timer_impl.h" +#include "soc/frc_timer_reg.h" +#include "soc/rtc.h" +#include "soc/periph_defs.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" + +/** + * @file esp_timer_esp32.c + * @brief Implementation of chip-specific part of esp_timer + * + * This implementation uses FRC2 (legacy) timer of the ESP32. This timer is + * a 32-bit up-counting timer, with a programmable compare value (called 'alarm' + * hereafter). When the timer reaches compare value, interrupt is raised. + * The timer can be configured to produce an edge or a level interrupt. + * + * In this implementation the timer is used for two purposes: + * 1. To generate interrupts at certain moments — the upper layer of esp_timer + * uses this to trigger callbacks of esp_timer objects. + * + * 2. To keep track of time relative to application start. This facility is + * used both by the upper layer of esp_timer and by time functions, such as + * gettimeofday. + * + * Whenever an esp_timer timer is armed (configured to fire once or + * periodically), timer_insert function of the upper layer calls + * esp_timer_impl_set_alarm to enable the interrupt at the required moment. + * This implementation sets up the timer interrupt to fire at the earliest of + * two moments: + * a) the time requested by upper layer + * b) the time when the timer count reaches 0xffffffff (i.e. is about to overflow) + * + * Whenever the interrupt fires and timer overflow is detected, interrupt hander + * increments s_time_base_us variable, which is used for timekeeping. + * + * When the interrupt fires, the upper layer is notified, and it dispatches + * the callbacks (if any timers have expired) and sets new alarm value (if any + * timers are still active). + * + * At any point in time, esp_timer_impl_get_time will return the current timer + * value (expressed in microseconds) plus s_time_base_us. To account for the + * case when the timer counter has overflown, but the interrupt has not fired + * yet (for example, because interupts are temporarily disabled), + * esp_timer_impl_get_time will also check timer overflow flag, and will add + * s_timer_us_per_overflow to the returned value. + * + */ + +/* Timer is clocked from APB. To allow for integer scaling factor between ticks + * and microseconds, divider 1 is used. 16 or 256 would not work for APB + * frequencies such as 40 or 26 or 2 MHz. + */ +#define TIMER_DIV 1 +#define TIMER_DIV_CFG FRC_TIMER_PRESCALER_1 + +/* ALARM_OVERFLOW_VAL is used as timer alarm value when there are not timers + * enabled which need to fire within the next timer overflow period. This alarm + * is used to perform timekeeping (i.e. to track timer overflows). + * Due to the 0xffffffff cannot recognize the real overflow or the scenario that + * ISR happens follow set_alarm, so change the ALARM_OVERFLOW_VAL to resolve this problem. + * Set it to 0xefffffffUL. The remain 0x10000000UL(about 3 second) is enough to handle ISR. + */ +#define DEFAULT_ALARM_OVERFLOW_VAL 0xefffffffUL + +/* Provision to set lower overflow value for unit testing. Lowering the + * overflow value helps check for race conditions which occur near overflow + * moment. + */ +#ifndef ESP_TIMER_DYNAMIC_OVERFLOW_VAL +#define ALARM_OVERFLOW_VAL DEFAULT_ALARM_OVERFLOW_VAL +#else +static uint32_t s_alarm_overflow_val = DEFAULT_ALARM_OVERFLOW_VAL; +#define ALARM_OVERFLOW_VAL (s_alarm_overflow_val) +#endif + +static const char* TAG = "esp_timer_impl"; + +// Interrupt handle returned by the interrupt allocator +static intr_handle_t s_timer_interrupt_handle; + +// Function from the upper layer to be called when the interrupt happens. +// Registered in esp_timer_impl_init. +static intr_handler_t s_alarm_handler; + +// Time in microseconds from startup to the moment +// when timer counter was last equal to 0. This variable is updated each time +// when timer overflows, and when APB frequency switch is performed. +static uint64_t s_time_base_us; + +// Number of timer ticks per microsecond. Calculated from APB frequency. +static uint32_t s_timer_ticks_per_us; + +// Period between timer overflows, in microseconds. +// Equal to 2^32 / s_timer_ticks_per_us. +static uint32_t s_timer_us_per_overflow; + +// When frequency switch happens, timer counter is reset to 0, s_time_base_us +// is updated, and alarm value is re-calculated based on the new APB frequency. +// However because the frequency switch can happen before the final +// interrupt handler is invoked, interrupt handler may see a different alarm +// value than the one which caused an interrupt. This can cause interrupt handler +// to consider that the interrupt has happened due to timer overflow, incrementing +// s_time_base_us. To avoid this, frequency switch hook sets this flag if +// it needs to set timer alarm value to ALARM_OVERFLOW_VAL. Interrupt handler +// will not increment s_time_base_us if this flag is set. +static bool s_mask_overflow; + +//The timer_overflow_happened read alarm register to tell if overflow happened. +//However, there is a monent that overflow happens, and before ISR function called +//alarm register is set to another value, then you call timer_overflow_happened, +//it will return false. +//So we store the overflow value when new alarm is to be set. +static bool s_overflow_happened; + +#ifdef CONFIG_PM_DFS_USE_RTC_TIMER_REF +// If DFS is enabled, upon the first frequency change this value is set to the +// difference between esp_timer value and RTC timer value. On every subsequent +// frequency change, s_time_base_us is adjusted to maintain the same difference +// between esp_timer and RTC timer. (All mentioned values are in microseconds.) +static uint64_t s_rtc_time_diff = 0; +#endif + +// Spinlock used to protect access to static variables above and to the hardware +// registers. +portMUX_TYPE s_time_update_lock = portMUX_INITIALIZER_UNLOCKED; + +//Use FRC_TIMER_LOAD_VALUE(1) instead of UINT32_MAX, convenience to change FRC TIMER for future +#define TIMER_IS_AFTER_OVERFLOW(a) (ALARM_OVERFLOW_VAL < (a) && (a) <= FRC_TIMER_LOAD_VALUE(1)) + +// Check if timer overflow has happened (but was not handled by ISR yet) +static inline bool IRAM_ATTR timer_overflow_happened(void) +{ + if (s_overflow_happened) { + return true; + } + + return ((REG_READ(FRC_TIMER_CTRL_REG(1)) & FRC_TIMER_INT_STATUS) != 0 && + ((REG_READ(FRC_TIMER_ALARM_REG(1)) == ALARM_OVERFLOW_VAL && TIMER_IS_AFTER_OVERFLOW(REG_READ(FRC_TIMER_COUNT_REG(1))) && !s_mask_overflow) || + (!TIMER_IS_AFTER_OVERFLOW(REG_READ(FRC_TIMER_ALARM_REG(1))) && TIMER_IS_AFTER_OVERFLOW(REG_READ(FRC_TIMER_COUNT_REG(1)))))); +} + +static inline void IRAM_ATTR timer_count_reload(void) +{ + //this function should be only called the real overflow happened. And the count cannot be very approach to 0xffffffff. + assert(TIMER_IS_AFTER_OVERFLOW(REG_READ(FRC_TIMER_COUNT_REG(1)))); + + /* Restart the timer count by current time count minus ALARM_OVERFLOW_VAL(0xefffffff), it may cause error, if current tick is near boundary. + * But even if the error happen 100% per overflow(the distance of each real overflow is about 50 second), + * the error is 0.0125us*N per 50s(the FRC time clock is 80MHz), the N is the ticks run by the line following, + * Normally, N is less than 10, assume N is 10, so the error accumulation is only 6.48ms per month. + * In fact, if the CPU frequency is large than 80MHz. The error accumulation will be more less than 6.48ms per month. + * so It can be adopted. + */ + REG_WRITE(FRC_TIMER_LOAD_REG(1), REG_READ(FRC_TIMER_COUNT_REG(1)) - ALARM_OVERFLOW_VAL); +} + +void esp_timer_impl_lock(void) +{ + portENTER_CRITICAL(&s_time_update_lock); +} + +void esp_timer_impl_unlock(void) +{ + portEXIT_CRITICAL(&s_time_update_lock); +} + +uint64_t IRAM_ATTR esp_timer_impl_get_time(void) +{ + uint32_t timer_val; + uint64_t time_base; + uint32_t ticks_per_us; + bool overflow; + + do { + /* Read all values needed to calculate current time */ + timer_val = REG_READ(FRC_TIMER_COUNT_REG(1)); + time_base = s_time_base_us; + overflow = timer_overflow_happened(); + ticks_per_us = s_timer_ticks_per_us; + + /* Read them again and compare */ + /* In this function, do not call timer_count_reload() when overflow is true. + * Because there's remain count enough to allow FRC_TIMER_COUNT_REG grow + */ + if (REG_READ(FRC_TIMER_COUNT_REG(1)) > timer_val && + time_base == *((volatile uint64_t*) &s_time_base_us) && + ticks_per_us == *((volatile uint32_t*) &s_timer_ticks_per_us) && + overflow == timer_overflow_happened()) { + break; + } + + /* If any value has changed (other than the counter increasing), read again */ + } while(true); + + uint64_t result = time_base + + timer_val / ticks_per_us; + return result; +} + +void IRAM_ATTR esp_timer_impl_set_alarm(uint64_t timestamp) +{ + portENTER_CRITICAL(&s_time_update_lock); + // Alarm time relative to the moment when counter was 0 + uint64_t time_after_timebase_us = timestamp - s_time_base_us; + // Adjust current time if overflow has happened + bool overflow = timer_overflow_happened(); + uint64_t cur_count = REG_READ(FRC_TIMER_COUNT_REG(1)); + + if (overflow) { + assert(time_after_timebase_us > s_timer_us_per_overflow); + time_after_timebase_us -= s_timer_us_per_overflow; + s_overflow_happened = true; + } + // Calculate desired timer compare value (may exceed 2^32-1) + uint64_t compare_val = time_after_timebase_us * s_timer_ticks_per_us; + uint32_t alarm_reg_val = ALARM_OVERFLOW_VAL; + // Use calculated alarm value if it is less than ALARM_OVERFLOW_VAL. + // Note that if by the time we update ALARM_REG, COUNT_REG value is higher, + // interrupt will not happen for another ALARM_OVERFLOW_VAL timer ticks, + // so need to check if alarm value is too close in the future (e.g. <2 us away). + const uint32_t offset = s_timer_ticks_per_us * 2; + if (compare_val < ALARM_OVERFLOW_VAL) { + if (compare_val < cur_count + offset) { + compare_val = cur_count + offset; + if (compare_val > ALARM_OVERFLOW_VAL) { + compare_val = ALARM_OVERFLOW_VAL; + } + } + alarm_reg_val = (uint32_t) compare_val; + } + REG_WRITE(FRC_TIMER_ALARM_REG(1), alarm_reg_val); + portEXIT_CRITICAL(&s_time_update_lock); +} + +static void IRAM_ATTR timer_alarm_isr(void *arg) +{ + portENTER_CRITICAL_ISR(&s_time_update_lock); + // Timekeeping: adjust s_time_base_us if counter has passed ALARM_OVERFLOW_VAL + if (timer_overflow_happened()) { + timer_count_reload(); + s_time_base_us += s_timer_us_per_overflow; + s_overflow_happened = false; + } + s_mask_overflow = false; + // Clear interrupt status + REG_WRITE(FRC_TIMER_INT_REG(1), FRC_TIMER_INT_CLR); + // Set alarm to the next overflow moment. Later, upper layer function may + // call esp_timer_impl_set_alarm to change this to an earlier value. + REG_WRITE(FRC_TIMER_ALARM_REG(1), ALARM_OVERFLOW_VAL); + portEXIT_CRITICAL_ISR(&s_time_update_lock); + // Call the upper layer handler + (*s_alarm_handler)(arg); +} + +void IRAM_ATTR esp_timer_impl_update_apb_freq(uint32_t apb_ticks_per_us) +{ + portENTER_CRITICAL_ISR(&s_time_update_lock); + /* Bail out if the timer is not initialized yet */ + if (s_timer_interrupt_handle == NULL) { + portEXIT_CRITICAL_ISR(&s_time_update_lock); + return; + } + + uint32_t new_ticks_per_us = apb_ticks_per_us / TIMER_DIV; + uint32_t alarm = REG_READ(FRC_TIMER_ALARM_REG(1)); + uint32_t count = REG_READ(FRC_TIMER_COUNT_REG(1)); + uint64_t ticks_to_alarm = alarm - count; + uint64_t new_ticks = (ticks_to_alarm * new_ticks_per_us) / s_timer_ticks_per_us; + uint32_t new_alarm_val; + if (alarm > count && new_ticks <= ALARM_OVERFLOW_VAL) { + new_alarm_val = new_ticks; + } else { + new_alarm_val = ALARM_OVERFLOW_VAL; + if (alarm != ALARM_OVERFLOW_VAL) { + s_mask_overflow = true; + } + } + REG_WRITE(FRC_TIMER_ALARM_REG(1), new_alarm_val); + REG_WRITE(FRC_TIMER_LOAD_REG(1), 0); + + s_time_base_us += count / s_timer_ticks_per_us; + +#ifdef CONFIG_PM_DFS_USE_RTC_TIMER_REF + // Due to the extra time required to read RTC time, don't attempt this + // adjustment when switching to a higher frequency (which usually + // happens in an interrupt). + if (new_ticks_per_us < s_timer_ticks_per_us) { + uint64_t rtc_time = esp_clk_rtc_time(); + uint64_t new_rtc_time_diff = s_time_base_us - rtc_time; + if (s_rtc_time_diff != 0) { + uint64_t correction = new_rtc_time_diff - s_rtc_time_diff; + s_time_base_us -= correction; + } else { + s_rtc_time_diff = new_rtc_time_diff; + } + } +#endif // CONFIG_PM_DFS_USE_RTC_TIMER_REF + + s_timer_ticks_per_us = new_ticks_per_us; + s_timer_us_per_overflow = ALARM_OVERFLOW_VAL / new_ticks_per_us; + + portEXIT_CRITICAL_ISR(&s_time_update_lock); +} + +void esp_timer_impl_advance(int64_t time_us) +{ + assert(time_us > 0 && "negative adjustments not supported yet"); + + portENTER_CRITICAL(&s_time_update_lock); + uint64_t count = REG_READ(FRC_TIMER_COUNT_REG(1)); + /* Trigger an ISR to handle past alarms and set new one. + * ISR handler will run once we exit the critical section. + */ + REG_WRITE(FRC_TIMER_ALARM_REG(1), 0); + REG_WRITE(FRC_TIMER_LOAD_REG(1), 0); + s_time_base_us += count / s_timer_ticks_per_us + time_us; + s_overflow_happened = false; + portEXIT_CRITICAL(&s_time_update_lock); +} + +esp_err_t esp_timer_impl_init(intr_handler_t alarm_handler) +{ + s_alarm_handler = alarm_handler; + + esp_err_t err = esp_intr_alloc(ETS_TIMER2_INTR_SOURCE, + ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_IRAM, + &timer_alarm_isr, NULL, &s_timer_interrupt_handle); + + if (err != ESP_OK) { + ESP_EARLY_LOGE(TAG, "esp_intr_alloc failed (0x%0x)", err); + return err; + } + + uint32_t apb_freq = rtc_clk_apb_freq_get(); + s_timer_ticks_per_us = apb_freq / 1000000 / TIMER_DIV; + assert(s_timer_ticks_per_us > 0 + && apb_freq % TIMER_DIV == 0 + && "APB frequency does not result in a valid ticks_per_us value"); + s_timer_us_per_overflow = ALARM_OVERFLOW_VAL / s_timer_ticks_per_us; + s_time_base_us = 0; + + REG_WRITE(FRC_TIMER_ALARM_REG(1), ALARM_OVERFLOW_VAL); + REG_WRITE(FRC_TIMER_LOAD_REG(1), 0); + REG_WRITE(FRC_TIMER_CTRL_REG(1), + TIMER_DIV_CFG | FRC_TIMER_ENABLE | FRC_TIMER_LEVEL_INT); + REG_WRITE(FRC_TIMER_INT_REG(1), FRC_TIMER_INT_CLR); + ESP_ERROR_CHECK( esp_intr_enable(s_timer_interrupt_handle) ); + + return ESP_OK; +} + +void esp_timer_impl_deinit(void) +{ + esp_intr_disable(s_timer_interrupt_handle); + + REG_WRITE(FRC_TIMER_CTRL_REG(1), 0); + REG_WRITE(FRC_TIMER_ALARM_REG(1), 0); + REG_WRITE(FRC_TIMER_LOAD_REG(1), 0); + + esp_intr_free(s_timer_interrupt_handle); + s_timer_interrupt_handle = NULL; +} + +// FIXME: This value is safe for 80MHz APB frequency. +// Should be modified to depend on clock frequency. + +uint64_t IRAM_ATTR esp_timer_impl_get_min_period_us(void) +{ + return 50; +} + +#ifdef ESP_TIMER_DYNAMIC_OVERFLOW_VAL +uint32_t esp_timer_impl_get_overflow_val(void) +{ + return s_alarm_overflow_val; +} + +void esp_timer_impl_set_overflow_val(uint32_t overflow_val) +{ + s_alarm_overflow_val = overflow_val; + /* update alarm value */ + esp_timer_impl_update_apb_freq(esp_clk_apb_freq() / 1000000); +} +#endif // ESP_TIMER_DYNAMIC_OVERFLOW_VAL diff --git a/components/esp32s2beta/hw_random.c b/components/esp32s2beta/hw_random.c new file mode 100644 index 0000000000..b2c6418491 --- /dev/null +++ b/components/esp32s2beta/hw_random.c @@ -0,0 +1,70 @@ +// Copyright 2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#include +#include +#include +#include +#include "esp_attr.h" +#include "esp32s2beta/clk.h" +#include "soc/wdev_reg.h" +#include "freertos/FreeRTOSConfig.h" +#include "xtensa/core-macros.h" + +uint32_t IRAM_ATTR esp_random(void) +{ + /* The PRNG which implements WDEV_RANDOM register gets 2 bits + * of extra entropy from a hardware randomness source every APB clock cycle + * (provided WiFi or BT are enabled). To make sure entropy is not drained + * faster than it is added, this function needs to wait for at least 16 APB + * clock cycles after reading previous word. This implementation may actually + * wait a bit longer due to extra time spent in arithmetic and branch statements. + * + * As a (probably unncessary) precaution to avoid returning the + * RNG state as-is, the result is XORed with additional + * WDEV_RND_REG reads while waiting. + */ + + /* This code does not run in a critical section, so CPU frequency switch may + * happens while this code runs (this will not happen in the current + * implementation, but possible in the future). However if that happens, + * the number of cycles spent on frequency switching will certainly be more + * than the number of cycles we need to wait here. + */ + uint32_t cpu_to_apb_freq_ratio = esp_clk_cpu_freq() / esp_clk_apb_freq(); + + static uint32_t last_ccount = 0; + uint32_t ccount; + uint32_t result = 0; + do { + ccount = XTHAL_GET_CCOUNT(); + result ^= REG_READ(WDEV_RND_REG); + } while (ccount - last_ccount < cpu_to_apb_freq_ratio * 16); + last_ccount = ccount; + return result ^ REG_READ(WDEV_RND_REG); +} + +void esp_fill_random(void *buf, size_t len) +{ + assert(buf != NULL); + uint8_t *buf_bytes = (uint8_t *)buf; + while (len > 0) { + uint32_t word = esp_random(); + uint32_t to_copy = MIN(sizeof(word), len); + memcpy(buf_bytes, &word, to_copy); + buf_bytes += to_copy; + len -= to_copy; + } +} diff --git a/components/esp32s2beta/include/esp32s2beta/brownout.h b/components/esp32s2beta/include/esp32s2beta/brownout.h new file mode 100644 index 0000000000..dafba8dd79 --- /dev/null +++ b/components/esp32s2beta/include/esp32s2beta/brownout.h @@ -0,0 +1,21 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef __ESP_BROWNOUT_H +#define __ESP_BROWNOUT_H + +void esp_brownout_init(void); + +#endif \ No newline at end of file diff --git a/components/esp32s2beta/include/esp32s2beta/cache_err_int.h b/components/esp32s2beta/include/esp32s2beta/cache_err_int.h new file mode 100644 index 0000000000..8881291a2d --- /dev/null +++ b/components/esp32s2beta/include/esp32s2beta/cache_err_int.h @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +/** + * @brief initialize cache invalid access interrupt + * + * This function enables cache invalid access interrupt source and connects it + * to interrupt input number ETS_CACHEERR_INUM (see soc/soc.h). It is called + * from the startup code. + */ +void esp_cache_err_int_init(void); + + +/** + * @brief get the CPU which caused cache invalid access interrupt + * @return + * - PRO_CPU_NUM, if PRO_CPU has caused cache IA interrupt + * - APP_CPU_NUM, if APP_CPU has caused cache IA interrupt + * - (-1) otherwise + */ +int esp_cache_err_get_cpuid(void); diff --git a/components/esp32s2beta/include/esp32s2beta/clk.h b/components/esp32s2beta/include/esp32s2beta/clk.h new file mode 100644 index 0000000000..06ada586bd --- /dev/null +++ b/components/esp32s2beta/include/esp32s2beta/clk.h @@ -0,0 +1,75 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +/** + * @file esp_clk.h + * + * This file contains declarations of clock related functions. + */ + +/** + * @brief Get the calibration value of RTC slow clock + * + * The value is in the same format as returned by rtc_clk_cal (microseconds, + * in Q13.19 fixed-point format). + * + * @return the calibration value obtained using rtc_clk_cal, at startup time + */ +uint32_t esp_clk_slowclk_cal_get(void); + +/** + * @brief Update the calibration value of RTC slow clock + * + * The value has to be in the same format as returned by rtc_clk_cal (microseconds, + * in Q13.19 fixed-point format). + * This value is used by timekeeping functions (such as gettimeofday) to + * calculate current time based on RTC counter value. + * @param value calibration value obtained using rtc_clk_cal + */ +void esp_clk_slowclk_cal_set(uint32_t value); + +/** + * @brief Return current CPU clock frequency + * When frequency switching is performed, this frequency may change. + * However it is guaranteed that the frequency never changes with a critical + * section. + * + * @return CPU clock frequency, in Hz + */ +int esp_clk_cpu_freq(void); + +/** + * @brief Return current APB clock frequency + * + * When frequency switching is performed, this frequency may change. + * However it is guaranteed that the frequency never changes with a critical + * section. + * + * @return APB clock frequency, in Hz + */ +int esp_clk_apb_freq(void); + + +/** + * @brief Read value of RTC counter, converting it to microseconds + * @attention The value returned by this function may change abruptly when + * calibration value of RTC counter is updated via esp_clk_slowclk_cal_set + * function. This should not happen unless application calls esp_clk_slowclk_cal_set. + * In ESP-IDF, esp_clk_slowclk_cal_set is only called in startup code. + * + * @return Value or RTC counter, expressed in microseconds + */ +uint64_t esp_clk_rtc_time(void); diff --git a/components/esp32s2beta/include/esp32s2beta/dport_access.h b/components/esp32s2beta/include/esp32s2beta/dport_access.h new file mode 100644 index 0000000000..ffb43c07a5 --- /dev/null +++ b/components/esp32s2beta/include/esp32s2beta/dport_access.h @@ -0,0 +1,40 @@ +// Copyright 2010-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _ESP_DPORT_ACCESS_H_ +#define _ESP_DPORT_ACCESS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Read a sequence of DPORT registers to the buffer. + * + * @param[out] buff_out Contains the read data. + * @param[in] address Initial address for reading registers. + * @param[in] num_words The number of words. + */ +void esp_dport_access_read_buffer(uint32_t *buff_out, uint32_t address, uint32_t num_words); + +#define DPORT_STALL_OTHER_CPU_START() +#define DPORT_STALL_OTHER_CPU_END() +#define DPORT_INTERRUPT_DISABLE() +#define DPORT_INTERRUPT_RESTORE() + +#ifdef __cplusplus +} +#endif + +#endif /* _ESP_DPORT_ACCESS_H_ */ diff --git a/components/esp32s2beta/include/esp32s2beta/pm.h b/components/esp32s2beta/include/esp32s2beta/pm.h new file mode 100644 index 0000000000..a7cbf0eac7 --- /dev/null +++ b/components/esp32s2beta/include/esp32s2beta/pm.h @@ -0,0 +1,42 @@ +// Copyright 2016-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#pragma once +#include +#include +#include "esp_err.h" + +#include "soc/rtc.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief Power management config for ESP32 + * + * Pass a pointer to this structure as an argument to esp_pm_configure function. + */ +typedef struct { + rtc_cpu_freq_t max_cpu_freq; /*!< Maximum CPU frequency to use */ + rtc_cpu_freq_t min_cpu_freq; /*!< Minimum CPU frequency to use when no frequency locks are taken */ + bool light_sleep_enable; /*!< Enter light sleep when no locks are taken */ +} esp_pm_config_esp32_t; + + +#ifdef __cplusplus +} +#endif diff --git a/components/esp32s2beta/include/esp32s2beta/spiram.h b/components/esp32s2beta/include/esp32s2beta/spiram.h new file mode 100644 index 0000000000..3ca4e3fa17 --- /dev/null +++ b/components/esp32s2beta/include/esp32s2beta/spiram.h @@ -0,0 +1,91 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef __ESP_SPIRAM_H +#define __ESP_SPIRAM_H + +#include +#include +#include +#include "esp_err.h" + +/** + * @brief Initialize spiram interface/hardware. Normally called from cpu_start.c. + * + * @return ESP_OK on success + */ +esp_err_t esp_spiram_init(void); + +/** + * @brief Configure Cache/MMU for access to external SPI RAM. + * + * Normally this function is called from cpu_start, if CONFIG_SPIRAM_BOOT_INIT + * option is enabled. Applications which need to enable SPI RAM at run time + * can disable CONFIG_SPIRAM_BOOT_INIT, and call this function later. + * + * @attention this function must be called with flash cache disabled. + */ +void esp_spiram_init_cache(void); + + +/** + * @brief Memory test for SPI RAM. Should be called after SPI RAM is initialized and + * (in case of a dual-core system) the app CPU is online. This test overwrites the + * memory with crap, so do not call after e.g. the heap allocator has stored important + * stuff in SPI RAM. + * + * @return true on success, false on failed memory test + */ +bool esp_spiram_test(void); + + +/** + * @brief Add the initialized SPI RAM to the heap allocator. + */ +esp_err_t esp_spiram_add_to_heapalloc(void); + + +/** + * @brief Get the size of the attached SPI RAM chip selected in menuconfig + * + * @return Size in bytes, or 0 if no external RAM chip support compiled in. + */ +size_t esp_spiram_get_size(void); + + +/** + * @brief Force a writeback of the data in the SPI RAM cache. This is to be called whenever + * cache is disabled, because disabling cache on the ESP32 discards the data in the SPI + * RAM cache. + * + * This is meant for use from within the SPI flash code. + */ +void esp_spiram_writeback_cache(void); + + + +/** + * @brief Reserve a pool of internal memory for specific DMA/internal allocations + * + * @param size Size of reserved pool in bytes + * + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM when no memory available for pool + */ +esp_err_t esp_spiram_reserve_dma_pool(size_t size); + + +#endif diff --git a/components/esp32s2beta/include/esp_clk.h b/components/esp32s2beta/include/esp_clk.h new file mode 100644 index 0000000000..06ada586bd --- /dev/null +++ b/components/esp32s2beta/include/esp_clk.h @@ -0,0 +1,75 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +/** + * @file esp_clk.h + * + * This file contains declarations of clock related functions. + */ + +/** + * @brief Get the calibration value of RTC slow clock + * + * The value is in the same format as returned by rtc_clk_cal (microseconds, + * in Q13.19 fixed-point format). + * + * @return the calibration value obtained using rtc_clk_cal, at startup time + */ +uint32_t esp_clk_slowclk_cal_get(void); + +/** + * @brief Update the calibration value of RTC slow clock + * + * The value has to be in the same format as returned by rtc_clk_cal (microseconds, + * in Q13.19 fixed-point format). + * This value is used by timekeeping functions (such as gettimeofday) to + * calculate current time based on RTC counter value. + * @param value calibration value obtained using rtc_clk_cal + */ +void esp_clk_slowclk_cal_set(uint32_t value); + +/** + * @brief Return current CPU clock frequency + * When frequency switching is performed, this frequency may change. + * However it is guaranteed that the frequency never changes with a critical + * section. + * + * @return CPU clock frequency, in Hz + */ +int esp_clk_cpu_freq(void); + +/** + * @brief Return current APB clock frequency + * + * When frequency switching is performed, this frequency may change. + * However it is guaranteed that the frequency never changes with a critical + * section. + * + * @return APB clock frequency, in Hz + */ +int esp_clk_apb_freq(void); + + +/** + * @brief Read value of RTC counter, converting it to microseconds + * @attention The value returned by this function may change abruptly when + * calibration value of RTC counter is updated via esp_clk_slowclk_cal_set + * function. This should not happen unless application calls esp_clk_slowclk_cal_set. + * In ESP-IDF, esp_clk_slowclk_cal_set is only called in startup code. + * + * @return Value or RTC counter, expressed in microseconds + */ +uint64_t esp_clk_rtc_time(void); diff --git a/components/esp32s2beta/include/esp_intr.h b/components/esp32s2beta/include/esp_intr.h new file mode 100644 index 0000000000..6710e3c166 --- /dev/null +++ b/components/esp32s2beta/include/esp_intr.h @@ -0,0 +1,89 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef __ESP_INTR_H__ +#define __ESP_INTR_H__ + +#include "esp32s2beta/rom/ets_sys.h" +#include "freertos/xtensa_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ESP_CCOMPARE_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_CCOMPARE_INUM, (func), (void *)(arg)) + +#define ESP_EPWM_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_EPWM_INUM, (func), (void *)(arg)) + +#define ESP_MPWM_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_MPWM_INUM, (func), (void *)(arg)) + +#define ESP_SPI1_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_SPI1_INUM, (func), (void *)(arg)) + +#define ESP_SPI2_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_SPI2_INUM, (func), (void *)(arg)) + +#define ESP_SPI3_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_SPI3_INUM, (func), (void *)(arg)) + +#define ESP_I2S0_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_I2S0_INUM, (func), (void *)(arg)) + +#define ESP_PCNT_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_PCNT_INUM, (func), (void *)(arg)) + +#define ESP_LEDC_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_LEDC_INUM, (func), (void *)(arg)) + +#define ESP_WMAC_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_WMAC_INUM, (func), (void *)(arg)) + +#define ESP_FRC_TIMER1_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_FRC_TIMER1_INUM, (func), (void *)(arg)) + +#define ESP_FRC_TIMER2_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_FRC_TIMER2_INUM, (func), (void *)(arg)) + +#define ESP_GPIO_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_GPIO_INUM, (func), (void *)(arg)) + +#define ESP_UART0_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_UART0_INUM, (func), (void *)(arg)) + +#define ESP_WDT_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_WDT_INUM, (func), (void *)(arg)) + +#define ESP_RTC_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_RTC_INUM, (func), (void *)(arg)) + +#define ESP_SLC_INTR_ATTACH(func, arg) \ + xt_set_interrupt_handler(ETS_SLC_INUM, (func), (void *)(arg)) + +#define ESP_RMT_CTRL_INTRL(func,arg)\ + xt_set_interrupt_handler(ETS_RMT_CTRL_INUM, (func), (void *)(arg)) + +#define ESP_INTR_ENABLE(inum) \ + xt_ints_on((1< +#include +#include "esp_err.h" +#include "freertos/xtensa_api.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** @addtogroup Intr_Alloc + * @{ + */ + + +/** @brief Interrupt allocation flags + * + * These flags can be used to specify which interrupt qualities the + * code calling esp_intr_alloc* needs. + * + */ + +//Keep the LEVELx values as they are here; they match up with (1<3 + * is requested, because these types of interrupts aren't C-callable. + * @param arg Optional argument for passed to the interrupt handler + * @param ret_handle Pointer to an intr_handle_t to store a handle that can later be + * used to request details or free the interrupt. Can be NULL if no handle + * is required. + * + * @return ESP_ERR_INVALID_ARG if the combination of arguments is invalid. + * ESP_ERR_NOT_FOUND No free interrupt found with the specified flags + * ESP_OK otherwise + */ +esp_err_t esp_intr_alloc(int source, int flags, intr_handler_t handler, void *arg, intr_handle_t *ret_handle); + + +/** + * @brief Allocate an interrupt with the given parameters. + * + * + * This essentially does the same as esp_intr_alloc, but allows specifying a register and mask + * combo. For shared interrupts, the handler is only called if a read from the specified + * register, ANDed with the mask, returns non-zero. By passing an interrupt status register + * address and a fitting mask, this can be used to accelerate interrupt handling in the case + * a shared interrupt is triggered; by checking the interrupt statuses first, the code can + * decide which ISRs can be skipped + * + * @param source The interrupt source. One of the ETS_*_INTR_SOURCE interrupt mux + * sources, as defined in soc/soc.h, or one of the internal + * ETS_INTERNAL_*_INTR_SOURCE sources as defined in this header. + * @param flags An ORred mask of the ESP_INTR_FLAG_* defines. These restrict the + * choice of interrupts that this routine can choose from. If this value + * is 0, it will default to allocating a non-shared interrupt of level + * 1, 2 or 3. If this is ESP_INTR_FLAG_SHARED, it will allocate a shared + * interrupt of level 1. Setting ESP_INTR_FLAG_INTRDISABLED will return + * from this function with the interrupt disabled. + * @param intrstatusreg The address of an interrupt status register + * @param intrstatusmask A mask. If a read of address intrstatusreg has any of the bits + * that are 1 in the mask set, the ISR will be called. If not, it will be + * skipped. + * @param handler The interrupt handler. Must be NULL when an interrupt of level >3 + * is requested, because these types of interrupts aren't C-callable. + * @param arg Optional argument for passed to the interrupt handler + * @param ret_handle Pointer to an intr_handle_t to store a handle that can later be + * used to request details or free the interrupt. Can be NULL if no handle + * is required. + * + * @return ESP_ERR_INVALID_ARG if the combination of arguments is invalid. + * ESP_ERR_NOT_FOUND No free interrupt found with the specified flags + * ESP_OK otherwise + */ +esp_err_t esp_intr_alloc_intrstatus(int source, int flags, uint32_t intrstatusreg, uint32_t intrstatusmask, intr_handler_t handler, void *arg, intr_handle_t *ret_handle); + + +/** + * @brief Disable and free an interrupt. + * + * Use an interrupt handle to disable the interrupt and release the resources + * associated with it. + * + * @note + * When the handler shares its source with other handlers, the interrupt status + * bits it's responsible for should be managed properly before freeing it. see + * ``esp_intr_disable`` for more details. + * + * @param handle The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus + * + * @return ESP_ERR_INVALID_ARG if handle is invalid, or esp_intr_free runs on another core than + * where the interrupt is allocated on. + * ESP_OK otherwise + */ +esp_err_t esp_intr_free(intr_handle_t handle); + + +/** + * @brief Get CPU number an interrupt is tied to + * + * @param handle The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus + * + * @return The core number where the interrupt is allocated + */ +int esp_intr_get_cpu(intr_handle_t handle); + +/** + * @brief Get the allocated interrupt for a certain handle + * + * @param handle The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus + * + * @return The interrupt number + */ +int esp_intr_get_intno(intr_handle_t handle); + +/** + * @brief Disable the interrupt associated with the handle + * + * @note + * 1. For local interrupts (ESP_INTERNAL_* sources), this function has to be called on the + * CPU the interrupt is allocated on. Other interrupts have no such restriction. + * 2. When several handlers sharing a same interrupt source, interrupt status bits, which are + * handled in the handler to be disabled, should be masked before the disabling, or handled + * in other enabled interrupts properly. Miss of interrupt status handling will cause infinite + * interrupt calls and finally system crash. + * + * @param handle The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus + * + * @return ESP_ERR_INVALID_ARG if the combination of arguments is invalid. + * ESP_OK otherwise + */ +esp_err_t esp_intr_disable(intr_handle_t handle); + +/** + * @brief Enable the interrupt associated with the handle + * + * @note For local interrupts (ESP_INTERNAL_* sources), this function has to be called on the + * CPU the interrupt is allocated on. Other interrupts have no such restriction. + * + * @param handle The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus + * + * @return ESP_ERR_INVALID_ARG if the combination of arguments is invalid. + * ESP_OK otherwise + */ +esp_err_t esp_intr_enable(intr_handle_t handle); + +/** + * @brief Set the "in IRAM" status of the handler. + * + * @note Does not work on shared interrupts. + * + * @param handle The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus + * @param is_in_iram Whether the handler associated with this handle resides in IRAM. + * Handlers residing in IRAM can be called when cache is disabled. + * + * @return ESP_ERR_INVALID_ARG if the combination of arguments is invalid. + * ESP_OK otherwise + */ +esp_err_t esp_intr_set_in_iram(intr_handle_t handle, bool is_in_iram); + +/** + * @brief Disable interrupts that aren't specifically marked as running from IRAM + */ +void esp_intr_noniram_disable(void); + + +/** + * @brief Re-enable interrupts disabled by esp_intr_noniram_disable + */ +void esp_intr_noniram_enable(void); + +/**@}*/ + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/esp32s2beta/include/esp_sleep.h b/components/esp32s2beta/include/esp_sleep.h new file mode 100644 index 0000000000..fabdfe5020 --- /dev/null +++ b/components/esp32s2beta/include/esp_sleep.h @@ -0,0 +1,325 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include "esp_err.h" +#include "driver/gpio.h" +#include "driver/touch_pad.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Logic function used for EXT1 wakeup mode. + */ +typedef enum { + ESP_EXT1_WAKEUP_ALL_LOW = 0, //!< Wake the chip when all selected GPIOs go low + ESP_EXT1_WAKEUP_ANY_HIGH = 1 //!< Wake the chip when any of the selected GPIOs go high +} esp_sleep_ext1_wakeup_mode_t; + +/** + * @brief Power domains which can be powered down in sleep mode + */ +typedef enum { + ESP_PD_DOMAIN_RTC_PERIPH, //!< RTC IO, sensors and ULP co-processor + ESP_PD_DOMAIN_RTC_SLOW_MEM, //!< RTC slow memory + ESP_PD_DOMAIN_RTC_FAST_MEM, //!< RTC fast memory + ESP_PD_DOMAIN_XTAL, //!< XTAL oscillator + ESP_PD_DOMAIN_MAX //!< Number of domains +} esp_sleep_pd_domain_t; + +/** + * @brief Power down options + */ +typedef enum { + ESP_PD_OPTION_OFF, //!< Power down the power domain in sleep mode + ESP_PD_OPTION_ON, //!< Keep power domain enabled during sleep mode + ESP_PD_OPTION_AUTO //!< Keep power domain enabled in sleep mode, if it is needed by one of the wakeup options. Otherwise power it down. +} esp_sleep_pd_option_t; + +/** + * @brief Sleep wakeup cause + */ +typedef enum { + ESP_SLEEP_WAKEUP_UNDEFINED, //!< In case of deep sleep, reset was not caused by exit from deep sleep + ESP_SLEEP_WAKEUP_EXT0, //!< Wakeup caused by external signal using RTC_IO + ESP_SLEEP_WAKEUP_EXT1, //!< Wakeup caused by external signal using RTC_CNTL + ESP_SLEEP_WAKEUP_TIMER, //!< Wakeup caused by timer + ESP_SLEEP_WAKEUP_TOUCHPAD, //!< Wakeup caused by touchpad + ESP_SLEEP_WAKEUP_ULP, //!< Wakeup caused by ULP program +} esp_sleep_source_t; + +/* Leave this type define for compatibility */ +typedef esp_sleep_source_t esp_sleep_wakeup_cause_t; + +/** + * @brief Disable wakeup source + * + * This function is used to deactivate wake up trigger for source + * defined as parameter of the function. + * + * @note This function does not modify wake up configuration in RTC. + * It will be performed in esp_sleep_start function. + * + * See docs/sleep-modes.rst for details. + * + * @param source - number of source to disable of type esp_sleep_source_t + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if trigger was not active + */ +esp_err_t esp_sleep_disable_wakeup_source(esp_sleep_source_t source); + +/** + * @brief Enable wakeup by ULP coprocessor + * @note In revisions 0 and 1 of the ESP32, ULP wakeup source + * can not be used when RTC_PERIPH power domain is forced + * to be powered on (ESP_PD_OPTION_ON) or when ext0 wakeup + * source is used. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if ULP co-processor is not enabled or if wakeup triggers conflict + */ +esp_err_t esp_sleep_enable_ulp_wakeup(void); + +/** + * @brief Enable wakeup by timer + * @param time_in_us time before wakeup, in microseconds + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if value is out of range (TBD) + */ +esp_err_t esp_sleep_enable_timer_wakeup(uint64_t time_in_us); + +/** + * @brief Enable wakeup by touch sensor + * + * @note In revisions 0 and 1 of the ESP32, touch wakeup source + * can not be used when RTC_PERIPH power domain is forced + * to be powered on (ESP_PD_OPTION_ON) or when ext0 wakeup + * source is used. + * + * @note The FSM mode of the touch button should be configured + * as the timer trigger mode. + * + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if wakeup triggers conflict + */ +esp_err_t esp_sleep_enable_touchpad_wakeup(void); + +/** + * @brief Get the touch pad which caused wakeup + * + * If wakeup was caused by another source, this function will return TOUCH_PAD_MAX; + * + * @return touch pad which caused wakeup + */ +touch_pad_t esp_sleep_get_touchpad_wakeup_status(void); + +/** + * @brief Enable wakeup using a pin + * + * This function uses external wakeup feature of RTC_IO peripheral. + * It will work only if RTC peripherals are kept on during sleep. + * + * This feature can monitor any pin which is an RTC IO. Once the pin transitions + * into the state given by level argument, the chip will be woken up. + * + * @note This function does not modify pin configuration. The pin is + * configured in esp_sleep_start, immediately before entering sleep mode. + * + * @note In revisions 0 and 1 of the ESP32, ext0 wakeup source + * can not be used together with touch or ULP wakeup sources. + * + * @param gpio_num GPIO number used as wakeup source. Only GPIOs which are have RTC + * functionality can be used: 0,2,4,12-15,25-27,32-39. + * @param level input level which will trigger wakeup (0=low, 1=high) + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if the selected GPIO is not an RTC GPIO, + * or the mode is invalid + * - ESP_ERR_INVALID_STATE if wakeup triggers conflict + */ +esp_err_t esp_sleep_enable_ext0_wakeup(gpio_num_t gpio_num, int level); + +/** + * @brief Enable wakeup using multiple pins + * + * This function uses external wakeup feature of RTC controller. + * It will work even if RTC peripherals are shut down during sleep. + * + * This feature can monitor any number of pins which are in RTC IOs. + * Once any of the selected pins goes into the state given by mode argument, + * the chip will be woken up. + * + * @note This function does not modify pin configuration. The pins are + * configured in esp_sleep_start, immediately before + * entering sleep mode. + * + * @note internal pullups and pulldowns don't work when RTC peripherals are + * shut down. In this case, external resistors need to be added. + * Alternatively, RTC peripherals (and pullups/pulldowns) may be + * kept enabled using esp_sleep_pd_config function. + * + * @param mask bit mask of GPIO numbers which will cause wakeup. Only GPIOs + * which are have RTC functionality can be used in this bit map: + * 0,2,4,12-15,25-27,32-39. + * @param mode select logic function used to determine wakeup condition: + * - ESP_EXT1_WAKEUP_ALL_LOW: wake up when all selected GPIOs are low + * - ESP_EXT1_WAKEUP_ANY_HIGH: wake up when any of the selected GPIOs is high + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if any of the selected GPIOs is not an RTC GPIO, + * or mode is invalid + */ +esp_err_t esp_sleep_enable_ext1_wakeup(uint64_t mask, esp_sleep_ext1_wakeup_mode_t mode); + + +/** + * @brief Get the bit mask of GPIOs which caused wakeup (ext1) + * + * If wakeup was caused by another source, this function will return 0. + * + * @return bit mask, if GPIOn caused wakeup, BIT(n) will be set + */ +uint64_t esp_sleep_get_ext1_wakeup_status(void); + +/** + * @brief Set power down mode for an RTC power domain in sleep mode + * + * If not set set using this API, all power domains default to ESP_PD_OPTION_AUTO. + * + * @param domain power domain to configure + * @param option power down option (ESP_PD_OPTION_OFF, ESP_PD_OPTION_ON, or ESP_PD_OPTION_AUTO) + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if either of the arguments is out of range + */ +esp_err_t esp_sleep_pd_config(esp_sleep_pd_domain_t domain, + esp_sleep_pd_option_t option); + +/** + * @brief Enter deep sleep with the configured wakeup options + * + * This function does not return. + */ +void esp_deep_sleep_start(void) __attribute__((noreturn)); + +/** + * @brief Enter light sleep with the configured wakeup options + * + * @return + * - ESP_OK on success (returned after wakeup) + * - ESP_ERR_INVALID_STATE if WiFi or BT is not stopped + */ +esp_err_t esp_light_sleep_start(void); + +/** + * @brief Enter deep-sleep mode + * + * The device will automatically wake up after the deep-sleep time + * Upon waking up, the device calls deep sleep wake stub, and then proceeds + * to load application. + * + * Call to this function is equivalent to a call to esp_deep_sleep_enable_timer_wakeup + * followed by a call to esp_deep_sleep_start. + * + * esp_deep_sleep does not shut down WiFi, BT, and higher level protocol + * connections gracefully. + * Make sure relevant WiFi and BT stack functions are called to close any + * connections and deinitialize the peripherals. These include: + * - esp_bluedroid_disable + * - esp_bt_controller_disable + * - esp_wifi_stop + * + * This function does not return. + * + * @param time_in_us deep-sleep time, unit: microsecond + */ +void esp_deep_sleep(uint64_t time_in_us) __attribute__((noreturn)); + +/** + * @brief Enter deep-sleep mode + * + * Function has been renamed to esp_deep_sleep. + * This name is deprecated and will be removed in a future version. + * + * @param time_in_us deep-sleep time, unit: microsecond + */ +void system_deep_sleep(uint64_t time_in_us) __attribute__((noreturn, deprecated)); + + +/** + * @brief Get the source which caused wakeup from sleep + * + * @return wakeup cause, or ESP_DEEP_SLEEP_WAKEUP_UNDEFINED if reset happened for reason other than deep sleep wakeup + */ +esp_sleep_wakeup_cause_t esp_sleep_get_wakeup_cause(void); + + +/** + * @brief Default stub to run on wake from deep sleep. + * + * Allows for executing code immediately on wake from sleep, before + * the software bootloader or ESP-IDF app has started up. + * + * This function is weak-linked, so you can implement your own version + * to run code immediately when the chip wakes from + * sleep. + * + * See docs/deep-sleep-stub.rst for details. + */ +void esp_wake_deep_sleep(void); + +/** + * @brief Function type for stub to run on wake from sleep. + * + */ +typedef void (*esp_deep_sleep_wake_stub_fn_t)(void); + +/** + * @brief Install a new stub at runtime to run on wake from deep sleep + * + * If implementing esp_wake_deep_sleep() then it is not necessary to + * call this function. + * + * However, it is possible to call this function to substitute a + * different deep sleep stub. Any function used as a deep sleep stub + * must be marked RTC_IRAM_ATTR, and must obey the same rules given + * for esp_wake_deep_sleep(). + */ +void esp_set_deep_sleep_wake_stub(esp_deep_sleep_wake_stub_fn_t new_stub); + +/** + * @brief Get current wake from deep sleep stub + * @return Return current wake from deep sleep stub, or NULL if + * no stub is installed. + */ +esp_deep_sleep_wake_stub_fn_t esp_get_deep_sleep_wake_stub(void); + +/** + * @brief The default esp-idf-provided esp_wake_deep_sleep() stub. + * + * See docs/deep-sleep-stub.rst for details. + */ +void esp_default_wake_deep_sleep(void); + + +#ifdef __cplusplus +} +#endif diff --git a/components/esp32s2beta/include/esp_spiram.h b/components/esp32s2beta/include/esp_spiram.h new file mode 100644 index 0000000000..2c3a37eacc --- /dev/null +++ b/components/esp32s2beta/include/esp_spiram.h @@ -0,0 +1,90 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#ifndef __ESP_SPIRAM_H +#define __ESP_SPIRAM_H + +#include +#include +#include "esp_err.h" + +/** + * @brief Initialize spiram interface/hardware. Normally called from cpu_start.c. + * + * @return ESP_OK on success + */ +esp_err_t esp_spiram_init(void); + +/** + * @brief Configure Cache/MMU for access to external SPI RAM. + * + * Normally this function is called from cpu_start, if CONFIG_SPIRAM_BOOT_INIT + * option is enabled. Applications which need to enable SPI RAM at run time + * can disable CONFIG_SPIRAM_BOOT_INIT, and call this function later. + * + * @attention this function must be called with flash cache disabled. + */ +void esp_spiram_init_cache(void); + + +/** + * @brief Memory test for SPI RAM. Should be called after SPI RAM is initialized and + * (in case of a dual-core system) the app CPU is online. This test overwrites the + * memory with crap, so do not call after e.g. the heap allocator has stored important + * stuff in SPI RAM. + * + * @return true on success, false on failed memory test + */ +bool esp_spiram_test(void); + + +/** + * @brief Add the initialized SPI RAM to the heap allocator. + */ +esp_err_t esp_spiram_add_to_heapalloc(void); + + +/** + * @brief Get the size of the attached SPI RAM chip selected in menuconfig + * + * @return Size in bytes, or 0 if no external RAM chip support compiled in. + */ +size_t esp_spiram_get_size(void); + + +/** + * @brief Force a writeback of the data in the SPI RAM cache. This is to be called whenever + * cache is disabled, because disabling cache on the ESP32 discards the data in the SPI + * RAM cache. + * + * This is meant for use from within the SPI flash code. + */ +void esp_spiram_writeback_cache(void); + + + +/** + * @brief Reserve a pool of internal memory for specific DMA/internal allocations + * + * @param size Size of reserved pool in bytes + * + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM when no memory available for pool + */ +esp_err_t esp_spiram_reserve_dma_pool(size_t size); + + +#endif diff --git a/components/esp32s2beta/include/esp_ssc.h b/components/esp32s2beta/include/esp_ssc.h new file mode 100644 index 0000000000..02893ff410 --- /dev/null +++ b/components/esp32s2beta/include/esp_ssc.h @@ -0,0 +1,119 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef __ESP_SSC_H__ +#define __ESP_SSC_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define CMD_T_ASYNC 0x01 +#define CMD_T_SYNC 0x02 + +typedef struct cmd_s { + char *cmd_str; + uint8_t flag; + uint8_t id; + void (* cmd_func)(void); + void (* cmd_callback)(void *arg); +} ssc_cmd_t; + +#define MAX_LINE_N 127 + +typedef enum { + SSC_BR_9600 = 9600, + SSC_BR_19200 = 19200, + SSC_BR_38400 = 38400, + SSC_BR_57600 = 57600, + SSC_BR_74880 = 74880, + SSC_BR_115200 = 115200, + SSC_BR_230400 = 230400, + SSC_BR_460800 = 460800, + SSC_BR_921600 = 921600 +} SscBaudRate; + +/** \defgroup SSC_APIs SSC APIs + * @brief SSC APIs + * + * SSC means simple serial command. + * SSC APIs allows users to define their own command, users can refer to spiffs_test/test_main.c. + * + */ + +/** @addtogroup SSC_APIs + * @{ + */ + +/** + * @brief Initial the ssc function. + * + * @attention param is no use, just compatible with ESP8266, default bandrate is 115200 + * + * @param SscBaudRate bandrate : baud rate + * + * @return null + */ +void ssc_attach(SscBaudRate bandrate); + +/** + * @brief Get the length of the simple serial command. + * + * @param null + * + * @return length of the command. + */ +int ssc_param_len(void); + +/** + * @brief Get the simple serial command string. + * + * @param null + * + * @return the command. + */ +char *ssc_param_str(void); + +/** + * @brief Parse the simple serial command (ssc). + * + * @param char *pLine : [input] the ssc string + * @param char *argv[] : [output] parameters of the ssc + * + * @return the number of parameters. + */ +int ssc_parse_param(char *pLine, char *argv[]); + +/** + * @brief Register the user-defined simple serial command (ssc) set. + * + * @param ssc_cmd_t *cmdset : the ssc set + * @param uint8 cmdnum : number of commands + * @param void (* help)(void) : callback of user-guide + * + * @return null + */ +void ssc_register(ssc_cmd_t *cmdset, uint8_t cmdnum, void (* help)(void)); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __ESP_SSC_H__ */ diff --git a/components/esp32s2beta/int_wdt.c b/components/esp32s2beta/int_wdt.c new file mode 100644 index 0000000000..bd46f37027 --- /dev/null +++ b/components/esp32s2beta/int_wdt.c @@ -0,0 +1,86 @@ +// Copyright 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. + + + +#include "sdkconfig.h" +#include +#include +#include +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include +#include "esp_err.h" +#include "esp_intr_alloc.h" +#include "esp_attr.h" +#include "esp_freertos_hooks.h" +#include "soc/timer_group_struct.h" +#include "soc/timer_group_reg.h" +#include "driver/timer.h" +#include "driver/periph_ctrl.h" +#include "esp_int_wdt.h" + +#if CONFIG_ESP_INT_WDT + + +#define WDT_INT_NUM 24 + + +//Take care: the tick hook can also be called before esp_int_wdt_init() is called. + +static void IRAM_ATTR tick_hook(void) +{ + TIMERG1.wdt_wprotect=TIMG_WDT_WKEY_VALUE; + TIMERG1.wdt_config2=CONFIG_ESP_INT_WDT_TIMEOUT_MS*2; //Set timeout before interrupt + TIMERG1.wdt_config3=CONFIG_ESP_INT_WDT_TIMEOUT_MS*4; //Set timeout before reset + TIMERG1.wdt_feed=1; + TIMERG1.wdt_wprotect=0; +} + +void esp_int_wdt_init(void) +{ + periph_module_enable(PERIPH_TIMG1_MODULE); + TIMERG1.wdt_wprotect=TIMG_WDT_WKEY_VALUE; + TIMERG1.wdt_config0.sys_reset_length=7; //3.2uS + TIMERG1.wdt_config0.cpu_reset_length=7; //3.2uS + TIMERG1.wdt_config0.level_int_en=1; + TIMERG1.wdt_config0.stg0=TIMG_WDT_STG_SEL_INT; //1st stage timeout: interrupt + TIMERG1.wdt_config0.stg1=TIMG_WDT_STG_SEL_RESET_SYSTEM; //2nd stage timeout: reset system + TIMERG1.wdt_config1.clk_prescale=80*500; //Prescaler: wdt counts in ticks of 0.5mS + //The timer configs initially are set to 5 seconds, to make sure the CPU can start up. The tick hook sets + //it to their actual value. + TIMERG1.wdt_config2=10000; + TIMERG1.wdt_config3=10000; + TIMERG1.wdt_config0.en=1; + TIMERG1.wdt_feed=1; + TIMERG1.wdt_wprotect=0; + TIMERG1.int_clr.wdt=1; + timer_group_intr_enable(TIMER_GROUP_1, TIMG_WDT_INT_ENA_M); +} + +void esp_int_wdt_cpu_init(void) +{ + esp_register_freertos_tick_hook_for_cpu(tick_hook, 0); + ESP_INTR_DISABLE(WDT_INT_NUM); + intr_matrix_set(0, ETS_TG1_WDT_LEVEL_INTR_SOURCE, WDT_INT_NUM); + //We do not register a handler for the interrupt because it is interrupt level 4 which + //is not servicable from C. Instead, xtensa_vectors.S has a call to the panic handler for + //this interrupt. + ESP_INTR_ENABLE(WDT_INT_NUM); +} + + + +#endif // CONFIG_ESP_INT_WDT diff --git a/components/esp32s2beta/intr_alloc.c b/components/esp32s2beta/intr_alloc.c new file mode 100644 index 0000000000..534e4cb0b0 --- /dev/null +++ b/components/esp32s2beta/intr_alloc.c @@ -0,0 +1,894 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + + +#include "sdkconfig.h" +#include +#include +#include +#include +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include +#include "esp_err.h" +#include "esp_log.h" +#include "esp_intr_alloc.h" +#include "esp_attr.h" +#include "soc/soc.h" +#include +#include + +static const char* TAG = "intr_alloc"; + +#define ETS_INTERNAL_TIMER0_INTR_NO 6 +#define ETS_INTERNAL_TIMER1_INTR_NO 15 +#define ETS_INTERNAL_TIMER2_INTR_NO 16 +#define ETS_INTERNAL_SW0_INTR_NO 7 +#define ETS_INTERNAL_SW1_INTR_NO 29 +#define ETS_INTERNAL_PROFILING_INTR_NO 11 + + +/* +Define this to debug the choices made when allocating the interrupt. This leads to much debugging +output within a critical region, which can lead to weird effects like e.g. the interrupt watchdog +being triggered, that is why it is separate from the normal LOG* scheme. +*/ +//define DEBUG_INT_ALLOC_DECISIONS +#ifdef DEBUG_INT_ALLOC_DECISIONS +# define ALCHLOG(...) ESP_EARLY_LOGD(TAG, __VA_ARGS__) +#else +# define ALCHLOG(...) do {} while (0) +#endif + + +typedef enum { + INTDESC_NORMAL=0, + INTDESC_RESVD, + INTDESC_SPECIAL //for xtensa timers / software ints +} int_desc_flag_t; + +typedef enum { + INTTP_LEVEL=0, + INTTP_EDGE, + INTTP_NA +} int_type_t; + +typedef struct { + int level; + int_type_t type; + int_desc_flag_t cpuflags[2]; +} int_desc_t; + + +//We should mark the interrupt for the timer used by FreeRTOS as reserved. The specific timer +//is selectable using menuconfig; we use these cpp bits to convert that into something we can use in +//the table below. +#if CONFIG_FREERTOS_CORETIMER_0 +#define INT6RES INTDESC_RESVD +#else +#define INT6RES INTDESC_SPECIAL +#endif + +#if CONFIG_FREERTOS_CORETIMER_1 +#define INT15RES INTDESC_RESVD +#else +#define INT15RES INTDESC_SPECIAL +#endif + +//This is basically a software-readable version of the interrupt usage table in include/soc/soc.h +const static int_desc_t int_desc[32]={ + { 1, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_RESVD } }, //0 + { 1, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_RESVD } }, //1 + { 1, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //2 + { 1, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //3 + { 1, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_NORMAL} }, //4 + { 1, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_RESVD } }, //5 + { 1, INTTP_NA, {INT6RES, INT6RES } }, //6 + { 1, INTTP_NA, {INTDESC_SPECIAL,INTDESC_SPECIAL}}, //7 + { 1, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_RESVD } }, //8 + { 1, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //9 + { 1, INTTP_EDGE , {INTDESC_NORMAL, INTDESC_NORMAL} }, //10 + { 3, INTTP_NA, {INTDESC_SPECIAL,INTDESC_SPECIAL}}, //11 + { 1, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //12 + { 1, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //13 + { 7, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_RESVD } }, //14, NMI + { 3, INTTP_NA, {INT15RES, INT15RES } }, //15 + { 5, INTTP_NA, {INTDESC_SPECIAL,INTDESC_SPECIAL} }, //16 + { 1, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //17 + { 1, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //18 + { 2, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //19 + { 2, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //20 + { 2, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //21 + { 3, INTTP_EDGE, {INTDESC_RESVD, INTDESC_NORMAL} }, //22 + { 3, INTTP_LEVEL, {INTDESC_NORMAL, INTDESC_NORMAL} }, //23 + { 4, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_NORMAL} }, //24 + { 4, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_RESVD } }, //25 + { 5, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_RESVD } }, //26 + { 3, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_RESVD } }, //27 + { 4, INTTP_EDGE, {INTDESC_NORMAL, INTDESC_NORMAL} }, //28 + { 3, INTTP_NA, {INTDESC_SPECIAL,INTDESC_SPECIAL}}, //29 + { 4, INTTP_EDGE, {INTDESC_RESVD, INTDESC_RESVD } }, //30 + { 5, INTTP_LEVEL, {INTDESC_RESVD, INTDESC_RESVD } }, //31 +}; + +typedef struct shared_vector_desc_t shared_vector_desc_t; +typedef struct vector_desc_t vector_desc_t; + +struct shared_vector_desc_t { + int disabled: 1; + int source: 8; + volatile uint32_t *statusreg; + uint32_t statusmask; + intr_handler_t isr; + void *arg; + shared_vector_desc_t *next; +}; + + +#define VECDESC_FL_RESERVED (1<<0) +#define VECDESC_FL_INIRAM (1<<1) +#define VECDESC_FL_SHARED (1<<2) +#define VECDESC_FL_NONSHARED (1<<3) + +//Pack using bitfields for better memory use +struct vector_desc_t { + int flags: 16; //OR of VECDESC_FLAG_* defines + unsigned int cpu: 1; + unsigned int intno: 5; + int source: 8; //Interrupt mux flags, used when not shared + shared_vector_desc_t *shared_vec_info; //used when VECDESC_FL_SHARED + vector_desc_t *next; +}; + +struct intr_handle_data_t { + vector_desc_t *vector_desc; + shared_vector_desc_t *shared_vector_desc; +}; + +typedef struct non_shared_isr_arg_t non_shared_isr_arg_t; + +struct non_shared_isr_arg_t { + intr_handler_t isr; + void *isr_arg; + int source; +}; + +//Linked list of vector descriptions, sorted by cpu.intno value +static vector_desc_t *vector_desc_head = NULL; + +//This bitmask has an 1 if the int should be disabled when the flash is disabled. +static uint32_t non_iram_int_mask[portNUM_PROCESSORS]; +//This bitmask has 1 in it if the int was disabled using esp_intr_noniram_disable. +static uint32_t non_iram_int_disabled[portNUM_PROCESSORS]; +static bool non_iram_int_disabled_flag[portNUM_PROCESSORS]; + +#if CONFIG_SYSVIEW_ENABLE +extern uint32_t port_switch_flag[]; +#endif + +static portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; + +//Inserts an item into vector_desc list so that the list is sorted +//with an incrementing cpu.intno value. +static void insert_vector_desc(vector_desc_t *to_insert) +{ + vector_desc_t *vd=vector_desc_head; + vector_desc_t *prev=NULL; + while(vd!=NULL) { + if (vd->cpu > to_insert->cpu) break; + if (vd->cpu == to_insert->cpu && vd->intno >= to_insert->intno) break; + prev=vd; + vd=vd->next; + } + if ((vector_desc_head==NULL) || (prev==NULL)) { + //First item + to_insert->next = vd; + vector_desc_head=to_insert; + } else { + prev->next=to_insert; + to_insert->next=vd; + } +} + +//Returns a vector_desc entry for an intno/cpu, or NULL if none exists. +static vector_desc_t *find_desc_for_int(int intno, int cpu) +{ + vector_desc_t *vd=vector_desc_head; + while(vd!=NULL) { + if (vd->cpu==cpu && vd->intno==intno) break; + vd=vd->next; + } + return vd; +} + +//Returns a vector_desc entry for an intno/cpu. +//Either returns a preexisting one or allocates a new one and inserts +//it into the list. Returns NULL on malloc fail. +static vector_desc_t *get_desc_for_int(int intno, int cpu) +{ + vector_desc_t *vd=find_desc_for_int(intno, cpu); + if (vd==NULL) { + vector_desc_t *newvd=heap_caps_malloc(sizeof(vector_desc_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); + if (newvd==NULL) return NULL; + memset(newvd, 0, sizeof(vector_desc_t)); + newvd->intno=intno; + newvd->cpu=cpu; + insert_vector_desc(newvd); + return newvd; + } else { + return vd; + } +} + +//Returns a vector_desc entry for an source, the cpu parameter is used to tell GPIO_INT and GPIO_NMI from different CPUs +static vector_desc_t * find_desc_for_source(int source, int cpu) +{ + vector_desc_t *vd=vector_desc_head; + while(vd!=NULL) { + if ( !(vd->flags & VECDESC_FL_SHARED) ) { + if ( vd->source == source && cpu == vd->cpu ) break; + } else if ( vd->cpu == cpu ) { + // check only shared vds for the correct cpu, otherwise skip + bool found = false; + shared_vector_desc_t *svd = vd->shared_vec_info; + assert(svd != NULL ); + while(svd) { + if ( svd->source == source ) { + found = true; + break; + } + svd = svd->next; + } + if ( found ) break; + } + vd=vd->next; + } + return vd; +} + +esp_err_t esp_intr_mark_shared(int intno, int cpu, bool is_int_ram) +{ + if (intno>31) return ESP_ERR_INVALID_ARG; + if (cpu>=portNUM_PROCESSORS) return ESP_ERR_INVALID_ARG; + + portENTER_CRITICAL(&spinlock); + vector_desc_t *vd=get_desc_for_int(intno, cpu); + if (vd==NULL) { + portEXIT_CRITICAL(&spinlock); + return ESP_ERR_NO_MEM; + } + vd->flags=VECDESC_FL_SHARED; + if (is_int_ram) vd->flags|=VECDESC_FL_INIRAM; + portEXIT_CRITICAL(&spinlock); + + return ESP_OK; +} + +esp_err_t esp_intr_reserve(int intno, int cpu) +{ + if (intno>31) return ESP_ERR_INVALID_ARG; + if (cpu>=portNUM_PROCESSORS) return ESP_ERR_INVALID_ARG; + + portENTER_CRITICAL(&spinlock); + vector_desc_t *vd=get_desc_for_int(intno, cpu); + if (vd==NULL) { + portEXIT_CRITICAL(&spinlock); + return ESP_ERR_NO_MEM; + } + vd->flags=VECDESC_FL_RESERVED; + portEXIT_CRITICAL(&spinlock); + + return ESP_OK; +} + +//Interrupt handler table and unhandled uinterrupt routine. Duplicated +//from xtensa_intr.c... it's supposed to be private, but we need to look +//into it in order to see if someone allocated an int using +//xt_set_interrupt_handler. +typedef struct xt_handler_table_entry { + void * handler; + void * arg; +} xt_handler_table_entry; +extern xt_handler_table_entry _xt_interrupt_table[XCHAL_NUM_INTERRUPTS*portNUM_PROCESSORS]; +extern void xt_unhandled_interrupt(void * arg); + +//Returns true if handler for interrupt is not the default unhandled interrupt handler +static bool int_has_handler(int intr, int cpu) +{ + return (_xt_interrupt_table[intr*portNUM_PROCESSORS+cpu].handler != xt_unhandled_interrupt); +} + +static bool is_vect_desc_usable(vector_desc_t *vd, int flags, int cpu, int force) +{ + //Check if interrupt is not reserved by design + int x = vd->intno; + if (int_desc[x].cpuflags[cpu]==INTDESC_RESVD) { + ALCHLOG("....Unusable: reserved"); + return false; + } + if (int_desc[x].cpuflags[cpu]==INTDESC_SPECIAL && force==-1) { + ALCHLOG("....Unusable: special-purpose int"); + return false; + } + //Check if the interrupt level is acceptable + if (!(flags&(1<flags&VECDESC_FL_RESERVED) { + ALCHLOG("....Unusable: reserved at runtime."); + return false; + } + //Ints can't be both shared and non-shared. + assert(!((vd->flags&VECDESC_FL_SHARED)&&(vd->flags&VECDESC_FL_NONSHARED))); + //check if interrupt already is in use by a non-shared interrupt + if (vd->flags&VECDESC_FL_NONSHARED) { + ALCHLOG("....Unusable: already in (non-shared) use."); + return false; + } + // check shared interrupt flags + if (vd->flags&VECDESC_FL_SHARED ) { + if (flags&ESP_INTR_FLAG_SHARED) { + bool in_iram_flag=((flags&ESP_INTR_FLAG_IRAM)!=0); + bool desc_in_iram_flag=((vd->flags&VECDESC_FL_INIRAM)!=0); + //Bail out if int is shared, but iram property doesn't match what we want. + if ((vd->flags&VECDESC_FL_SHARED) && (desc_in_iram_flag!=in_iram_flag)) { + ALCHLOG("....Unusable: shared but iram prop doesn't match"); + return false; + } + } else { + //We need an unshared IRQ; can't use shared ones; bail out if this is shared. + ALCHLOG("...Unusable: int is shared, we need non-shared."); + return false; + } + } else if (int_has_handler(x, cpu)) { + //Check if interrupt already is allocated by xt_set_interrupt_handler + ALCHLOG("....Unusable: already allocated"); + return false; + } + return true; +} + +//Locate a free interrupt compatible with the flags given. +//The 'force' argument can be -1, or 0-31 to force checking a certain interrupt. +//When a CPU is forced, the INTDESC_SPECIAL marked interrupts are also accepted. +static int get_available_int(int flags, int cpu, int force, int source) +{ + int x; + int best=-1; + int bestLevel=9; + int bestSharedCt=INT_MAX; + //Default vector desc, for vectors not in the linked list + vector_desc_t empty_vect_desc; + memset(&empty_vect_desc, 0, sizeof(vector_desc_t)); + + //Level defaults to any low/med interrupt + if (!(flags&ESP_INTR_FLAG_LEVELMASK)) flags|=ESP_INTR_FLAG_LOWMED; + + ALCHLOG("get_available_int: try to find existing. Cpu: %d, Source: %d", cpu, source); + vector_desc_t *vd = find_desc_for_source(source, cpu); + if ( vd ) { + // if existing vd found, don't need to search any more. + ALCHLOG("get_avalible_int: existing vd found. intno: %d", vd->intno); + if ( force != -1 && force != vd->intno ) { + ALCHLOG("get_avalible_int: intr forced but not matach existing. existing intno: %d, force: %d", vd->intno, force); + } else if ( !is_vect_desc_usable(vd, flags, cpu, force) ) { + ALCHLOG("get_avalible_int: existing vd invalid."); + } else { + best = vd->intno; + } + return best; + } + if (force!=-1) { + ALCHLOG("get_available_int: try to find force. Cpu: %d, Source: %d, Force: %d", cpu, source, force); + //if force assigned, don't need to search any more. + vd = find_desc_for_int(force, cpu); + if (vd == NULL ) { + //if existing vd not found, just check the default state for the intr. + empty_vect_desc.intno = force; + vd = &empty_vect_desc; + } + if ( is_vect_desc_usable(vd, flags, cpu, force) ) { + best = vd->intno; + } else { + ALCHLOG("get_avalible_int: forced vd invalid."); + } + return best; + } + + ALCHLOG("get_free_int: start looking. Current cpu: %d", cpu); + //No allocated handlers as well as forced intr, iterate over the 32 possible interrupts + for (x=0; x<32; x++) { + //Grab the vector_desc for this vector. + vd=find_desc_for_int(x, cpu); + if (vd==NULL) { + empty_vect_desc.intno = x; + vd=&empty_vect_desc; + } + + ALCHLOG("Int %d reserved %d level %d %s hasIsr %d", + x, int_desc[x].cpuflags[cpu]==INTDESC_RESVD, int_desc[x].level, + int_desc[x].type==INTTP_LEVEL?"LEVEL":"EDGE", int_has_handler(x, cpu)); + if ( !is_vect_desc_usable(vd, flags, cpu, force) ) continue; + + if (flags&ESP_INTR_FLAG_SHARED) { + //We're allocating a shared int. + //See if int already is used as a shared interrupt. + if (vd->flags&VECDESC_FL_SHARED) { + //We can use this already-marked-as-shared interrupt. Count the already attached isrs in order to see + //how useful it is. + int no=0; + shared_vector_desc_t *svdesc=vd->shared_vec_info; + while (svdesc!=NULL) { + no++; + svdesc=svdesc->next; + } + if (noint_desc[x].level) { + //Seems like this shared vector is both okay and has the least amount of ISRs already attached to it. + best=x; + bestSharedCt=no; + bestLevel=int_desc[x].level; + ALCHLOG("...int %d more usable as a shared int: has %d existing vectors", x, no); + } else { + ALCHLOG("...worse than int %d", best); + } + } else { + if (best==-1) { + //We haven't found a feasible shared interrupt yet. This one is still free and usable, even if + //not marked as shared. + //Remember it in case we don't find any other shared interrupt that qualifies. + if (bestLevel>int_desc[x].level) { + best=x; + bestLevel=int_desc[x].level; + ALCHLOG("...int %d usable as a new shared int", x); + } + } else { + ALCHLOG("...already have a shared int"); + } + } + } else { + //Seems this interrupt is feasible. Select it and break out of the loop; no need to search further. + if (bestLevel>int_desc[x].level) { + best=x; + bestLevel=int_desc[x].level; + } else { + ALCHLOG("...worse than int %d", best); + } + } + } + ALCHLOG("get_available_int: using int %d", best); + + //Okay, by now we have looked at all potential interrupts and hopefully have selected the best one in best. + return best; +} + +//Common shared isr handler. Chain-call all ISRs. +static void IRAM_ATTR shared_intr_isr(void *arg) +{ + vector_desc_t *vd=(vector_desc_t*)arg; + shared_vector_desc_t *sh_vec=vd->shared_vec_info; + portENTER_CRITICAL(&spinlock); + while(sh_vec) { + if (!sh_vec->disabled) { + if ((sh_vec->statusreg == NULL) || (*sh_vec->statusreg & sh_vec->statusmask)) { +#if CONFIG_SYSVIEW_ENABLE + traceISR_ENTER(sh_vec->source+ETS_INTERNAL_INTR_SOURCE_OFF); +#endif + sh_vec->isr(sh_vec->arg); +#if CONFIG_SYSVIEW_ENABLE + // check if we will return to scheduler or to interrupted task after ISR + if (!port_switch_flag[xPortGetCoreID()]) { + traceISR_EXIT(); + } +#endif + } + } + sh_vec=sh_vec->next; + } + portEXIT_CRITICAL(&spinlock); +} + +#if CONFIG_SYSVIEW_ENABLE +//Common non-shared isr handler wrapper. +static void IRAM_ATTR non_shared_intr_isr(void *arg) +{ + non_shared_isr_arg_t *ns_isr_arg=(non_shared_isr_arg_t*)arg; + portENTER_CRITICAL(&spinlock); + traceISR_ENTER(ns_isr_arg->source+ETS_INTERNAL_INTR_SOURCE_OFF); + // FIXME: can we call ISR and check port_switch_flag after releasing spinlock? + // when CONFIG_SYSVIEW_ENABLE = 0 ISRs for non-shared IRQs are called without spinlock + ns_isr_arg->isr(ns_isr_arg->isr_arg); + // check if we will return to scheduler or to interrupted task after ISR + if (!port_switch_flag[xPortGetCoreID()]) { + traceISR_EXIT(); + } + portEXIT_CRITICAL(&spinlock); +} +#endif + +//We use ESP_EARLY_LOG* here because this can be called before the scheduler is running. +esp_err_t esp_intr_alloc_intrstatus(int source, int flags, uint32_t intrstatusreg, uint32_t intrstatusmask, intr_handler_t handler, + void *arg, intr_handle_t *ret_handle) +{ + intr_handle_data_t *ret=NULL; + int force=-1; + ESP_EARLY_LOGV(TAG, "esp_intr_alloc_intrstatus (cpu %d): checking args", xPortGetCoreID()); + //Shared interrupts should be level-triggered. + if ((flags&ESP_INTR_FLAG_SHARED) && (flags&ESP_INTR_FLAG_EDGE)) return ESP_ERR_INVALID_ARG; + //You can't set an handler / arg for a non-C-callable interrupt. + if ((flags&ESP_INTR_FLAG_HIGH) && (handler)) return ESP_ERR_INVALID_ARG; + //Shared ints should have handler and non-processor-local source + if ((flags&ESP_INTR_FLAG_SHARED) && (!handler || source<0)) return ESP_ERR_INVALID_ARG; + //Statusreg should have a mask + if (intrstatusreg && !intrstatusmask) return ESP_ERR_INVALID_ARG; + //If the ISR is marked to be IRAM-resident, the handler must not be in the cached region + if ((flags&ESP_INTR_FLAG_IRAM) && + (ptrdiff_t) handler >= SOC_RTC_IRAM_HIGH && + (ptrdiff_t) handler < SOC_RTC_DATA_LOW ) { + return ESP_ERR_INVALID_ARG; + } + + //Default to prio 1 for shared interrupts. Default to prio 1, 2 or 3 for non-shared interrupts. + if ((flags&ESP_INTR_FLAG_LEVELMASK)==0) { + if (flags&ESP_INTR_FLAG_SHARED) { + flags|=ESP_INTR_FLAG_LEVEL1; + } else { + flags|=ESP_INTR_FLAG_LOWMED; + } + } + ESP_EARLY_LOGV(TAG, "esp_intr_alloc_intrstatus (cpu %d): Args okay. Resulting flags 0x%X", xPortGetCoreID(), flags); + + //Check 'special' interrupt sources. These are tied to one specific interrupt, so we + //have to force get_free_int to only look at that. + if (source==ETS_INTERNAL_TIMER0_INTR_SOURCE) force=ETS_INTERNAL_TIMER0_INTR_NO; + if (source==ETS_INTERNAL_TIMER1_INTR_SOURCE) force=ETS_INTERNAL_TIMER1_INTR_NO; + if (source==ETS_INTERNAL_TIMER2_INTR_SOURCE) force=ETS_INTERNAL_TIMER2_INTR_NO; + if (source==ETS_INTERNAL_SW0_INTR_SOURCE) force=ETS_INTERNAL_SW0_INTR_NO; + if (source==ETS_INTERNAL_SW1_INTR_SOURCE) force=ETS_INTERNAL_SW1_INTR_NO; + if (source==ETS_INTERNAL_PROFILING_INTR_SOURCE) force=ETS_INTERNAL_PROFILING_INTR_NO; + + //Allocate a return handle. If we end up not needing it, we'll free it later on. + ret=heap_caps_malloc(sizeof(intr_handle_data_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); + if (ret==NULL) return ESP_ERR_NO_MEM; + + portENTER_CRITICAL(&spinlock); + int cpu=xPortGetCoreID(); + //See if we can find an interrupt that matches the flags. + int intr=get_available_int(flags, cpu, force, source); + if (intr==-1) { + //None found. Bail out. + portEXIT_CRITICAL(&spinlock); + free(ret); + return ESP_ERR_NOT_FOUND; + } + //Get an int vector desc for int. + vector_desc_t *vd=get_desc_for_int(intr, cpu); + if (vd==NULL) { + portEXIT_CRITICAL(&spinlock); + free(ret); + return ESP_ERR_NO_MEM; + } + + //Allocate that int! + if (flags&ESP_INTR_FLAG_SHARED) { + //Populate vector entry and add to linked list. + shared_vector_desc_t *sh_vec=malloc(sizeof(shared_vector_desc_t)); + if (sh_vec==NULL) { + portEXIT_CRITICAL(&spinlock); + free(ret); + return ESP_ERR_NO_MEM; + } + memset(sh_vec, 0, sizeof(shared_vector_desc_t)); + sh_vec->statusreg=(uint32_t*)intrstatusreg; + sh_vec->statusmask=intrstatusmask; + sh_vec->isr=handler; + sh_vec->arg=arg; + sh_vec->next=vd->shared_vec_info; + sh_vec->source=source; + sh_vec->disabled=0; + vd->shared_vec_info=sh_vec; + vd->flags|=VECDESC_FL_SHARED; + //(Re-)set shared isr handler to new value. + xt_set_interrupt_handler(intr, shared_intr_isr, vd); + } else { + //Mark as unusable for other interrupt sources. This is ours now! + vd->flags=VECDESC_FL_NONSHARED; + if (handler) { +#if CONFIG_SYSVIEW_ENABLE + non_shared_isr_arg_t *ns_isr_arg=malloc(sizeof(non_shared_isr_arg_t)); + if (!ns_isr_arg) { + portEXIT_CRITICAL(&spinlock); + free(ret); + return ESP_ERR_NO_MEM; + } + ns_isr_arg->isr=handler; + ns_isr_arg->isr_arg=arg; + ns_isr_arg->source=source; + xt_set_interrupt_handler(intr, non_shared_intr_isr, ns_isr_arg); +#else + xt_set_interrupt_handler(intr, handler, arg); +#endif + } + if (flags&ESP_INTR_FLAG_EDGE) xthal_set_intclear(1 << intr); + vd->source=source; + } + if (flags&ESP_INTR_FLAG_IRAM) { + vd->flags|=VECDESC_FL_INIRAM; + non_iram_int_mask[cpu]&=~(1<flags&=~VECDESC_FL_INIRAM; + non_iram_int_mask[cpu]|=(1<=0) { + intr_matrix_set(cpu, source, intr); + } + + //Fill return handle data. + ret->vector_desc=vd; + ret->shared_vector_desc=vd->shared_vec_info; + + //Enable int at CPU-level; + ESP_INTR_ENABLE(intr); + + //If interrupt has to be started disabled, do that now; ints won't be enabled for real until the end + //of the critical section. + if (flags&ESP_INTR_FLAG_INTRDISABLED) { + esp_intr_disable(ret); + } + + portEXIT_CRITICAL(&spinlock); + + //Fill return handle if needed, otherwise free handle. + if (ret_handle!=NULL) { + *ret_handle=ret; + } else { + free(ret); + } + + ESP_EARLY_LOGD(TAG, "Connected src %d to int %d (cpu %d)", source, intr, cpu); + return ESP_OK; +} + +esp_err_t esp_intr_alloc(int source, int flags, intr_handler_t handler, void *arg, intr_handle_t *ret_handle) +{ + /* + As an optimization, we can create a table with the possible interrupt status registers and masks for every single + source there is. We can then add code here to look up an applicable value and pass that to the + esp_intr_alloc_intrstatus function. + */ + return esp_intr_alloc_intrstatus(source, flags, 0, 0, handler, arg, ret_handle); +} + +esp_err_t IRAM_ATTR esp_intr_set_in_iram(intr_handle_t handle, bool is_in_iram) +{ + if (!handle) return ESP_ERR_INVALID_ARG; + vector_desc_t *vd = handle->vector_desc; + if (vd->flags & VECDESC_FL_SHARED) { + return ESP_ERR_INVALID_ARG; + } + portENTER_CRITICAL(&spinlock); + uint32_t mask = (1 << vd->intno); + if (is_in_iram) { + vd->flags |= VECDESC_FL_INIRAM; + non_iram_int_mask[vd->cpu] &= ~mask; + } else { + vd->flags &= ~VECDESC_FL_INIRAM; + non_iram_int_mask[vd->cpu] |= mask; + } + portEXIT_CRITICAL(&spinlock); + return ESP_OK; +} + +esp_err_t esp_intr_free(intr_handle_t handle) +{ + bool free_shared_vector=false; + if (!handle) return ESP_ERR_INVALID_ARG; + //This routine should be called from the interrupt the task is scheduled on. + if (handle->vector_desc->cpu!=xPortGetCoreID()) return ESP_ERR_INVALID_ARG; + + portENTER_CRITICAL(&spinlock); + esp_intr_disable(handle); + if (handle->vector_desc->flags&VECDESC_FL_SHARED) { + //Find and kill the shared int + shared_vector_desc_t *svd=handle->vector_desc->shared_vec_info; + shared_vector_desc_t *prevsvd=NULL; + assert(svd); //should be something in there for a shared int + while (svd!=NULL) { + if (svd==handle->shared_vector_desc) { + //Found it. Now kill it. + if (prevsvd) { + prevsvd->next=svd->next; + } else { + handle->vector_desc->shared_vec_info=svd->next; + } + free(svd); + break; + } + prevsvd=svd; + svd=svd->next; + } + //If nothing left, disable interrupt. + if (handle->vector_desc->shared_vec_info==NULL) free_shared_vector=true; + ESP_LOGV(TAG, "esp_intr_free: Deleting shared int: %s. Shared int is %s", svd?"not found or last one":"deleted", free_shared_vector?"empty now.":"still in use"); + } + + if ((handle->vector_desc->flags&VECDESC_FL_NONSHARED) || free_shared_vector) { + ESP_LOGV(TAG, "esp_intr_free: Disabling int, killing handler"); +#if CONFIG_SYSVIEW_ENABLE + if (!free_shared_vector) { + void *isr_arg = xt_get_interrupt_handler_arg(handle->vector_desc->intno); + if (isr_arg) { + free(isr_arg); + } + } +#endif + //Reset to normal handler + xt_set_interrupt_handler(handle->vector_desc->intno, xt_unhandled_interrupt, (void*)((int)handle->vector_desc->intno)); + //Theoretically, we could free the vector_desc... not sure if that's worth the few bytes of memory + //we save.(We can also not use the same exit path for empty shared ints anymore if we delete + //the desc.) For now, just mark it as free. + handle->vector_desc->flags&=!(VECDESC_FL_NONSHARED|VECDESC_FL_RESERVED); + //Also kill non_iram mask bit. + non_iram_int_mask[handle->vector_desc->cpu]&=~(1<<(handle->vector_desc->intno)); + } + portEXIT_CRITICAL(&spinlock); + free(handle); + return ESP_OK; +} + +int esp_intr_get_intno(intr_handle_t handle) +{ + return handle->vector_desc->intno; +} + +int esp_intr_get_cpu(intr_handle_t handle) +{ + return handle->vector_desc->cpu; +} + +/* + Interrupt disabling strategy: + If the source is >=0 (meaning a muxed interrupt), we disable it by muxing the interrupt to a non-connected + interrupt. If the source is <0 (meaning an internal, per-cpu interrupt), we disable it using ESP_INTR_DISABLE. + This allows us to, for the muxed CPUs, disable an int from the other core. It also allows disabling shared + interrupts. + */ + +//Muxing an interrupt source to interrupt 6, 7, 11, 15, 16 or 29 cause the interrupt to effectively be disabled. +#define INT_MUX_DISABLED_INTNO 6 + +esp_err_t IRAM_ATTR esp_intr_enable(intr_handle_t handle) +{ + if (!handle) return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&spinlock); + int source; + if (handle->shared_vector_desc) { + handle->shared_vector_desc->disabled=0; + source=handle->shared_vector_desc->source; + } else { + source=handle->vector_desc->source; + } + if (source >= 0) { + //Disabled using int matrix; re-connect to enable + intr_matrix_set(handle->vector_desc->cpu, source, handle->vector_desc->intno); + } else { + //Re-enable using cpu int ena reg + if (handle->vector_desc->cpu!=xPortGetCoreID()) return ESP_ERR_INVALID_ARG; //Can only enable these ints on this cpu + ESP_INTR_ENABLE(handle->vector_desc->intno); + } + portEXIT_CRITICAL(&spinlock); + return ESP_OK; +} + +esp_err_t IRAM_ATTR esp_intr_disable(intr_handle_t handle) +{ + if (!handle) return ESP_ERR_INVALID_ARG; + portENTER_CRITICAL(&spinlock); + int source; + bool disabled = 1; + if (handle->shared_vector_desc) { + handle->shared_vector_desc->disabled=1; + source=handle->shared_vector_desc->source; + + shared_vector_desc_t *svd=handle->vector_desc->shared_vec_info; + assert( svd != NULL ); + while( svd ) { + if ( svd->source == source && svd->disabled == 0 ) { + disabled = 0; + break; + } + svd = svd->next; + } + } else { + source=handle->vector_desc->source; + } + + if (source >= 0) { + if ( disabled ) { + //Disable using int matrix + intr_matrix_set(handle->vector_desc->cpu, source, INT_MUX_DISABLED_INTNO); + } + } else { + //Disable using per-cpu regs + if (handle->vector_desc->cpu!=xPortGetCoreID()) { + portEXIT_CRITICAL(&spinlock); + return ESP_ERR_INVALID_ARG; //Can only enable these ints on this cpu + } + ESP_INTR_DISABLE(handle->vector_desc->intno); + } + portEXIT_CRITICAL(&spinlock); + return ESP_OK; +} + + +void IRAM_ATTR esp_intr_noniram_disable(void) +{ + int oldint; + int cpu=xPortGetCoreID(); + int intmask=~non_iram_int_mask[cpu]; + if (non_iram_int_disabled_flag[cpu]) abort(); + non_iram_int_disabled_flag[cpu]=true; + asm volatile ( + "movi %0,0\n" + "xsr %0,INTENABLE\n" //disable all ints first + "rsync\n" + "and a3,%0,%1\n" //mask ints that need disabling + "wsr a3,INTENABLE\n" //write back + "rsync\n" + :"=&r"(oldint):"r"(intmask):"a3"); + //Save which ints we did disable + non_iram_int_disabled[cpu]=oldint&non_iram_int_mask[cpu]; +} + +void IRAM_ATTR esp_intr_noniram_enable(void) +{ + int cpu=xPortGetCoreID(); + int intmask=non_iram_int_disabled[cpu]; + if (!non_iram_int_disabled_flag[cpu]) abort(); + non_iram_int_disabled_flag[cpu]=false; + asm volatile ( + "movi a3,0\n" + "xsr a3,INTENABLE\n" + "rsync\n" + "or a3,a3,%0\n" + "wsr a3,INTENABLE\n" + "rsync\n" + ::"r"(intmask):"a3"); +} + +//These functions are provided in ROM, but the ROM-based functions use non-multicore-capable +//virtualized interrupt levels. Thus, we disable them in the ld file and provide working +//equivalents here. + + +void IRAM_ATTR ets_isr_unmask(unsigned int mask) { + xt_ints_on(mask); +} + +void IRAM_ATTR ets_isr_mask(unsigned int mask) { + xt_ints_off(mask); +} + + + + diff --git a/components/esp32s2beta/ld/esp32s2beta.ld b/components/esp32s2beta/ld/esp32s2beta.ld new file mode 100644 index 0000000000..54eb54a7bf --- /dev/null +++ b/components/esp32s2beta/ld/esp32s2beta.ld @@ -0,0 +1,111 @@ +/* ESP32S2Beta Linker Script Memory Layout + + This file describes the memory layout (memory blocks) as virtual + memory addresses. + + esp32.common.ld contains output sections to link compiler output + into these memory blocks. + + *** + + This linker script is passed through the C preprocessor to include + configuration options. + + Please use preprocessor features sparingly! Restrict + to simple macros with numeric values, and/or #if/#endif blocks. +*/ +#include "sdkconfig.h" + + +#ifdef CONFIG_ESP32S2_INSTRUCTION_CACHE_8KB +#define CONFIG_ESP32S2_INSTRUCTION_CACHE_SIZE 0x2000 +#else +#define CONFIG_ESP32S2_INSTRUCTION_CACHE_SIZE 0x4000 +#endif + +#ifdef CONFIG_ESP32S2_DATA_CACHE_0KB +#define CONFIG_ESP32S2_DATA_CACHE_SIZE 0 +#elif defined CONFIG_ESP32S2_DATA_CACHE_8KB +#define CONFIG_ESP32S2_DATA_CACHE_SIZE 0x2000 +#else +#define CONFIG_ESP32S2_DATA_CACHE_SIZE 0x4000 +#endif + +#define RAM_IRAM_START 0x40020000 +#define RAM_DRAM_START 0x3FFB0000 +#define DATA_RAM_END 0x3FFF2000 /* start address of bootloader */ + +#define IRAM_ORG (RAM_IRAM_START + CONFIG_ESP32S2_INSTRUCTION_CACHE_SIZE \ + + CONFIG_ESP32S2_DATA_CACHE_SIZE) +#define IRAM_SIZE 0x18000 + +#define DRAM_ORG (RAM_DRAM_START + CONFIG_ESP32S2_INSTRUCTION_CACHE_SIZE \ + + CONFIG_ESP32S2_DATA_CACHE_SIZE \ + + IRAM_SIZE) +#define DRAM_SIZE DATA_RAM_END - DRAM_ORG + +MEMORY +{ + /* All these values assume the flash cache is on, and have the blocks this uses subtracted from the length + of the various regions. The 'data access port' dram/drom regions map to the same iram/irom regions but + are connected to the data port of the CPU and eg allow bytewise access. */ + + /* IRAM for CPU.*/ + iram0_0_seg (RX) : org = IRAM_ORG, len = IRAM_SIZE + + /* Even though the segment name is iram, it is actually mapped to flash + */ + iram0_2_seg (RX) : org = 0x40080020, len = 0xb80000-0x20 + + /* + (0x20 offset above is a convenience for the app binary image generation. + Flash cache has 64KB pages. The .bin file which is flashed to the chip + has a 0x18 byte file header, and each segment has a 0x08 byte segment + header. Setting this offset makes it simple to meet the flash cache MMU's + constraint that (paddr % 64KB == vaddr % 64KB).) + */ + + + /* Shared data RAM, excluding memory reserved for bootloader and ROM bss/data/stack. + + Enabling Bluetooth & Trace Memory features in menuconfig will decrease + the amount of RAM available. + */ + dram0_0_seg (RW) : org = DRAM_ORG, len = DRAM_SIZE + + /* Flash mapped constant data */ + drom0_0_seg (R) : org = 0x3F000020, len = 0x3f0000-0x20 + + /* (See iram0_2_seg for meaning of 0x20 offset in the above.) */ + + /* RTC fast memory (executable). Persists over deep sleep. + */ + rtc_iram_seg(RWX) : org = 0x40070000, len = 0x2000 + + /* RTC slow memory (data accessible). Persists over deep sleep. + + Start of RTC slow memory is reserved for ULP co-processor code + data, if enabled. + */ + rtc_slow_seg(RW) : org = 0x50000000 + CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM, + len = 0x2000 - CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM + + /* RTC fast memory (same block as above), viewed from data bus */ + rtc_data_seg(RW) : org = 0x3ff9e000, len = 0x2000 +} + +_static_data_end = _bss_end; + +/* Heap ends at top of dram0_0_seg */ +_heap_end = 0x40000000 - CONFIG_ESP32S2_TRACEMEM_RESERVE_DRAM; + +_data_seg_org = ORIGIN(rtc_data_seg); + +/* The lines below define location alias for .rtc.data section based on Kconfig option. + When the option is not defined then use slow memory segment + else the data will be placed in fast memory segment + TODO: check whether the rtc_data_location is correct for esp32s2beta - IDF-761 */ +#ifndef CONFIG_ESP32_RTCDATA_IN_FAST_MEM +REGION_ALIAS("rtc_data_location", rtc_slow_seg ); +#else +REGION_ALIAS("rtc_data_location", rtc_data_seg ); +#endif diff --git a/components/esp32s2beta/ld/esp32s2beta.peripherals.ld b/components/esp32s2beta/ld/esp32s2beta.peripherals.ld new file mode 100644 index 0000000000..a7c71e769a --- /dev/null +++ b/components/esp32s2beta/ld/esp32s2beta.peripherals.ld @@ -0,0 +1,29 @@ +PROVIDE ( UART0 = 0x3f400000 ); +PROVIDE ( SPIMEM1 = 0x3f402000 ); +PROVIDE ( SPIMEM0 = 0x3f403000 ); +PROVIDE ( GPIO = 0x3f404000 ); +PROVIDE ( SIGMADELTA = 0x3f404f00 ); +PROVIDE ( RTCCNTL = 0x3f408000 ); +PROVIDE ( RTCIO = 0x3f408400 ); +PROVIDE ( SENS = 0x3f408800 ); +PROVIDE ( HINF = 0x3f40B000 ); +PROVIDE ( I2S0 = 0x3f40F000 ); +PROVIDE ( UART1 = 0x3f410000 ); +PROVIDE ( I2C0 = 0x3f413000 ); +PROVIDE ( UHCI0 = 0x3f414000 ); +PROVIDE ( HOST = 0x3f415000 ); +PROVIDE ( RMT = 0x3f416000 ); +PROVIDE ( RMTMEM = 0x3f416400 ); +PROVIDE ( PCNT = 0x3f417000 ); +PROVIDE ( SLC = 0x3f418000 ); +PROVIDE ( LEDC = 0x3f419000 ); +PROVIDE ( TIMERG0 = 0x3f41F000 ); +PROVIDE ( TIMERG1 = 0x3f420000 ); +PROVIDE ( GPSPI2 = 0x3f424000 ); +PROVIDE ( GPSPI3 = 0x3f425000 ); +PROVIDE ( SYSCON = 0x3f426000 ); +PROVIDE ( I2C1 = 0x3f427000 ); +PROVIDE ( GPSPI4 = 0x3f437000 ); + +PROVIDE ( ToBeCleanedUpBelow = 0x00000000 ); +PROVIDE ( UART2 = 0x3f410000 ); diff --git a/components/esp32s2beta/ld/esp32s2beta.project.ld.in b/components/esp32s2beta/ld/esp32s2beta.project.ld.in new file mode 100644 index 0000000000..597b07e814 --- /dev/null +++ b/components/esp32s2beta/ld/esp32s2beta.project.ld.in @@ -0,0 +1,332 @@ +/* Default entry point: */ +ENTRY(call_start_cpu0); + +SECTIONS +{ + /* RTC fast memory holds RTC wake stub code, + including from any source file named rtc_wake_stub*.c + */ + .rtc.text : + { + . = ALIGN(4); + + mapping[rtc_text] + + *rtc_wake_stub*.*(.literal .text .literal.* .text.*) + _rtc_text_end = ABSOLUTE(.); + } > rtc_iram_seg + + /* + This section is required to skip rtc.text area because rtc_iram_seg and + rtc_data_seg are reflect the same address space on different buses. + */ + .rtc.dummy : + { + _rtc_dummy_start = ABSOLUTE(.); + _rtc_fast_start = ABSOLUTE(.); + . = SIZEOF(.rtc.text); + _rtc_dummy_end = ABSOLUTE(.); + } > rtc_data_seg + + /* This section located in RTC FAST Memory area. + It holds data marked with RTC_FAST_ATTR attribute. + See the file "esp_attr.h" for more information. + */ + .rtc.force_fast : + { + . = ALIGN(4); + _rtc_force_fast_start = ABSOLUTE(.); + *(.rtc.force_fast .rtc.force_fast.*) + . = ALIGN(4) ; + _rtc_force_fast_end = ABSOLUTE(.); + } > rtc_data_seg + + /* RTC data section holds RTC wake stub + data/rodata, including from any source file + named rtc_wake_stub*.c and the data marked with + RTC_DATA_ATTR, RTC_RODATA_ATTR attributes. + The memory location of the data is dependent on + CONFIG_ESP32_RTCDATA_IN_FAST_MEM option. + */ + .rtc.data : + { + _rtc_data_start = ABSOLUTE(.); + + mapping[rtc_data] + + *rtc_wake_stub*.*(.data .rodata .data.* .rodata.* .bss .bss.*) + _rtc_data_end = ABSOLUTE(.); + } > rtc_data_location + + /* RTC bss, from any source file named rtc_wake_stub*.c */ + .rtc.bss (NOLOAD) : + { + _rtc_bss_start = ABSOLUTE(.); + *rtc_wake_stub*.*(.bss .bss.*) + *rtc_wake_stub*.*(COMMON) + + mapping[rtc_bss] + + _rtc_bss_end = ABSOLUTE(.); + } > rtc_data_location + + /* This section holds data that should not be initialized at power up + and will be retained during deep sleep. + User data marked with RTC_NOINIT_ATTR will be placed + into this section. See the file "esp_attr.h" for more information. + The memory location of the data is dependent on + CONFIG_ESP32_RTCDATA_IN_FAST_MEM option. + */ + .rtc_noinit (NOLOAD): + { + . = ALIGN(4); + _rtc_noinit_start = ABSOLUTE(.); + *(.rtc_noinit .rtc_noinit.*) + . = ALIGN(4) ; + _rtc_noinit_end = ABSOLUTE(.); + } > rtc_data_location + + /* This section located in RTC SLOW Memory area. + It holds data marked with RTC_SLOW_ATTR attribute. + See the file "esp_attr.h" for more information. + */ + .rtc.force_slow : + { + . = ALIGN(4); + _rtc_force_slow_start = ABSOLUTE(.); + *(.rtc.force_slow .rtc.force_slow.*) + . = ALIGN(4) ; + _rtc_force_slow_end = ABSOLUTE(.); + } > rtc_slow_seg + + /* Get size of rtc slow data based on rtc_data_location alias */ + _rtc_slow_length = (ORIGIN(rtc_slow_seg) == ORIGIN(rtc_data_location)) + ? (_rtc_force_slow_end - _rtc_data_start) + : (_rtc_force_slow_end - _rtc_force_slow_start); + + _rtc_fast_length = (ORIGIN(rtc_slow_seg) == ORIGIN(rtc_data_location)) + ? (_rtc_force_fast_end - _rtc_fast_start) + : (_rtc_noinit_end - _rtc_fast_start); + + ASSERT((_rtc_slow_length <= LENGTH(rtc_slow_seg)), + "RTC_SLOW segment data does not fit.") + + ASSERT((_rtc_fast_length <= LENGTH(rtc_data_seg)), + "RTC_FAST segment data does not fit.") + + /* Send .iram0 code to iram */ + .iram0.vectors : + { + _iram_start = ABSOLUTE(.); + /* Vectors go to IRAM */ + _init_start = ABSOLUTE(.); + /* Vectors according to builds/RF-2015.2-win32/esp108_v1_2_s5_512int_2/config.html */ + . = 0x0; + KEEP(*(.WindowVectors.text)); + . = 0x180; + KEEP(*(.Level2InterruptVector.text)); + . = 0x1c0; + KEEP(*(.Level3InterruptVector.text)); + . = 0x200; + KEEP(*(.Level4InterruptVector.text)); + . = 0x240; + KEEP(*(.Level5InterruptVector.text)); + . = 0x280; + KEEP(*(.DebugExceptionVector.text)); + . = 0x2c0; + KEEP(*(.NMIExceptionVector.text)); + . = 0x300; + KEEP(*(.KernelExceptionVector.text)); + . = 0x340; + KEEP(*(.UserExceptionVector.text)); + . = 0x3C0; + KEEP(*(.DoubleExceptionVector.text)); + . = 0x400; + *(.*Vector.literal) + + *(.UserEnter.literal); + *(.UserEnter.text); + . = ALIGN (16); + *(.entry.text) + *(.init.literal) + *(.init) + _init_end = ABSOLUTE(.); + } > iram0_0_seg + + .iram0.text : + { + /* Code marked as runnning out of IRAM */ + _iram_text_start = ABSOLUTE(.); + + mapping[iram0_text] + + _iram_text_end = ABSOLUTE(.); + _iram_end = ABSOLUTE(.); + } > iram0_0_seg + + ASSERT(((_iram_text_end - ORIGIN(iram0_0_seg)) <= LENGTH(iram0_0_seg)), + "IRAM0 segment data does not fit.") + + .dram0.data : + { + _data_start = ABSOLUTE(.); + _bt_data_start = ABSOLUTE(.); + *libbt.a:(.data .data.*) + . = ALIGN (4); + _bt_data_end = ABSOLUTE(.); + _btdm_data_start = ABSOLUTE(.); + *libbtdm_app.a:(.data .data.*) + . = ALIGN (4); + _btdm_data_end = ABSOLUTE(.); + *(.gnu.linkonce.d.*) + *(.data1) + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s.*) + *(.sdata2) + *(.sdata2.*) + *(.gnu.linkonce.s2.*) + *(.jcr) + + mapping[dram0_data] + + _data_end = ABSOLUTE(.); + . = ALIGN(4); + } > dram0_0_seg + + /*This section holds data that should not be initialized at power up. + The section located in Internal SRAM memory region. The macro _NOINIT + can be used as attribute to place data into this section. + See the esp_attr.h file for more information. + */ + .noinit (NOLOAD): + { + . = ALIGN(4); + _noinit_start = ABSOLUTE(.); + *(.noinit .noinit.*) + . = ALIGN(4) ; + _noinit_end = ABSOLUTE(.); + } > dram0_0_seg + + /* Shared RAM */ + .dram0.bss (NOLOAD) : + { + . = ALIGN (8); + _bss_start = ABSOLUTE(.); + *(.ext_ram.bss*) + _bt_bss_start = ABSOLUTE(.); + *libbt.a:(.bss .bss.* COMMON) + . = ALIGN (4); + _bt_bss_end = ABSOLUTE(.); + _btdm_bss_start = ABSOLUTE(.); + *libbtdm_app.a:(.bss .bss.* COMMON) + . = ALIGN (4); + _btdm_bss_end = ABSOLUTE(.); + + mapping[dram0_bss] + + *(.dynsbss) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + *(.scommon) + *(.sbss2) + *(.sbss2.*) + *(.gnu.linkonce.sb2.*) + *(.dynbss) + *(.share.mem) + *(.gnu.linkonce.b.*) + + . = ALIGN (8); + _bss_end = ABSOLUTE(.); + /* The heap starts right after end of this section */ + _heap_start = ABSOLUTE(.); + } > dram0_0_seg + + ASSERT(((_bss_end - ORIGIN(dram0_0_seg)) <= LENGTH(dram0_0_seg)), + "DRAM segment data does not fit.") + + .flash.rodata : + { + _rodata_start = ABSOLUTE(.); + + *(.rodata_desc .rodata_desc.*) /* Should be the first. App version info. DO NOT PUT ANYTHING BEFORE IT! */ + *(.rodata_custom_desc .rodata_custom_desc.*) /* Should be the second. Custom app version info. DO NOT PUT ANYTHING BEFORE IT! */ + + mapping[flash_rodata] + + *(.irom1.text) /* catch stray ICACHE_RODATA_ATTR */ + *(.gnu.linkonce.r.*) + *(.rodata1) + __XT_EXCEPTION_TABLE_ = ABSOLUTE(.); + *(.xt_except_table) + *(.gcc_except_table .gcc_except_table.*) + *(.gnu.linkonce.e.*) + *(.gnu.version_r) + . = (. + 3) & ~ 3; + __eh_frame = ABSOLUTE(.); + KEEP(*(.eh_frame)) + . = (. + 7) & ~ 3; + /* C++ constructor and destructor tables, properly ordered: */ + __init_array_start = ABSOLUTE(.); + KEEP (*crtbegin.*(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.*) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + __init_array_end = ABSOLUTE(.); + KEEP (*crtbegin.*(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.*) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + /* C++ exception handlers table: */ + __XT_EXCEPTION_DESCS_ = ABSOLUTE(.); + *(.xt_except_desc) + *(.gnu.linkonce.h.*) + __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.); + *(.xt_except_desc_end) + *(.dynamic) + *(.gnu.version_d) + /* Addresses of memory regions reserved via + SOC_RESERVE_MEMORY_REGION() */ + soc_reserved_memory_region_start = ABSOLUTE(.); + KEEP (*(.reserved_memory_address)) + soc_reserved_memory_region_end = ABSOLUTE(.); + _rodata_end = ABSOLUTE(.); + /* Literals are also RO data. */ + _lit4_start = ABSOLUTE(.); + *(*.lit4) + *(.lit4.*) + *(.gnu.linkonce.lit4.*) + _lit4_end = ABSOLUTE(.); + . = ALIGN(4); + _thread_local_start = ABSOLUTE(.); + *(.tdata) + *(.tdata.*) + *(.tbss) + *(.tbss.*) + _thread_local_end = ABSOLUTE(.); + . = ALIGN(4); + } >drom0_0_seg + + .flash.text : + { + _stext = .; + _text_start = ABSOLUTE(.); + + mapping[flash_text] + + *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.irom0.text) /* catch stray ICACHE_RODATA_ATTR */ + *(.fini.literal) + *(.fini) + *(.gnu.version) + _text_end = ABSOLUTE(.); + _etext = .; + + /* Similar to _iram_start, this symbol goes here so it is + resolved by addr2line in preference to the first symbol in + the flash.text segment. + */ + _flash_cache_start = ABSOLUTE(0); + } >iram0_2_seg +} diff --git a/components/esp32s2beta/ld/esp32s2beta_fragments.lf b/components/esp32s2beta/ld/esp32s2beta_fragments.lf new file mode 100644 index 0000000000..932197caf0 --- /dev/null +++ b/components/esp32s2beta/ld/esp32s2beta_fragments.lf @@ -0,0 +1,89 @@ +[sections:text] +entries: + .text+ + .literal+ + +[sections:data] +entries: + .data+ + +[sections:bss] +entries: + .bss+ + +[sections:common] +entries: + COMMON + +[sections:rodata] +entries: + .rodata+ + +[sections:rtc_text] +entries: + .rtc.text+ + .rtc.literal + +[sections:rtc_data] +entries: + .rtc.data+ + +[sections:rtc_rodata] +entries: + .rtc.rodata+ + +[sections:rtc_bss] +entries: + .rtc.bss + +[sections:iram] +entries: + .iram1+ + +[sections:dram] +entries: + .dram1+ + +[sections:wifi_iram] +entries: + .wifi0iram+ + +[scheme:default] +entries: + text -> flash_text + rodata -> flash_rodata + data -> dram0_data + bss -> dram0_bss + common -> dram0_bss + iram -> iram0_text + dram -> dram0_data + rtc_text -> rtc_text + rtc_data -> rtc_data + rtc_rodata -> rtc_data + rtc_bss -> rtc_bss + wifi_iram -> flash_text + +[scheme:rtc] +entries: + text -> rtc_text + data -> rtc_data + rodata -> rtc_data + bss -> rtc_bss + common -> rtc_bss + +[scheme:noflash] +entries: + text -> iram0_text + rodata -> dram0_data + +[scheme:noflash_data] +entries: + rodata -> dram0_data + +[scheme:noflash_text] +entries: + text -> iram0_text + +[scheme:wifi_iram] +entries: + wifi_iram -> iram0_text diff --git a/components/esp32s2beta/linker.lf b/components/esp32s2beta/linker.lf new file mode 100644 index 0000000000..b0d99f2211 --- /dev/null +++ b/components/esp32s2beta/linker.lf @@ -0,0 +1,14 @@ +[mapping:esp32s2beta] +archive: libesp32s2beta.a +entries: + panic (noflash) + +[mapping:gcc] +archive: libgcc.a +entries: + lib2funcs (noflash_text) + +[mapping:gcov] +archive: libgcov.a +entries: + * (noflash) diff --git a/components/esp32s2beta/panic.c b/components/esp32s2beta/panic.c new file mode 100644 index 0000000000..0082e0a85e --- /dev/null +++ b/components/esp32s2beta/panic.c @@ -0,0 +1,751 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#include + +#include + +#include "esp32s2beta/rom/rtc.h" +#include "esp32s2beta/rom/uart.h" + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/xtensa_api.h" + +#include "soc/uart_reg.h" +#include "soc/io_mux_reg.h" +#include "soc/dport_reg.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/timer_group_struct.h" +#include "soc/timer_group_reg.h" +#include "soc/cpu.h" +#include "soc/soc_memory_layout.h" +#include "soc/rtc.h" +#include "soc/rtc_wdt.h" + +#include "esp_private/gdbstub.h" +#include "esp_debug_helpers.h" +#include "esp_private/panic_reason.h" +#include "esp_attr.h" +#include "esp_err.h" +#include "esp_core_dump.h" +#include "esp_spi_flash.h" +#include "esp32s2beta/cache_err_int.h" +#include "esp_app_trace.h" +#include "esp_private/system_internal.h" +#include "sdkconfig.h" +#if CONFIG_SYSVIEW_ENABLE +#include "SEGGER_RTT.h" +#endif + +#if CONFIG_ESP32_APPTRACE_ONPANIC_HOST_FLUSH_TMO == -1 +#define APPTRACE_ONPANIC_HOST_FLUSH_TMO ESP_APPTRACE_TMO_INFINITE +#else +#define APPTRACE_ONPANIC_HOST_FLUSH_TMO (1000*CONFIG_ESP32_APPTRACE_ONPANIC_HOST_FLUSH_TMO) +#endif +/* + Panic handlers; these get called when an unhandled exception occurs or the assembly-level + task switching / interrupt code runs into an unrecoverable error. The default task stack + overflow handler and abort handler are also in here. +*/ + +/* + Note: The linker script will put everything in this file in IRAM/DRAM, so it also works with flash cache disabled. +*/ + +#if !CONFIG_ESP32S2_PANIC_SILENT_REBOOT +//printf may be broken, so we fix our own printing fns... +static void panicPutChar(char c) +{ + while (((READ_PERI_REG(UART_STATUS_REG(CONFIG_ESP_CONSOLE_UART_NUM)) >> UART_TXFIFO_CNT_S)&UART_TXFIFO_CNT) >= 126) ; + WRITE_PERI_REG(UART_FIFO_AHB_REG(CONFIG_ESP_CONSOLE_UART_NUM), c); +} + +static void panicPutStr(const char *c) +{ + int x = 0; + while (c[x] != 0) { + panicPutChar(c[x]); + x++; + } +} + +static void panicPutHex(int a) +{ + int x; + int c; + for (x = 0; x < 8; x++) { + c = (a >> 28) & 0xf; + if (c < 10) { + panicPutChar('0' + c); + } else { + panicPutChar('a' + c - 10); + } + a <<= 4; + } +} + +static void panicPutDec(int a) +{ + int n1, n2; + n1 = a % 10; + n2 = a / 10; + if (n2 == 0) { + panicPutChar(' '); + } else { + panicPutChar(n2 + '0'); + } + panicPutChar(n1 + '0'); +} +#else +//No printing wanted. Stub out these functions. +static void panicPutChar(char c) { } +static void panicPutStr(const char *c) { } +static void panicPutHex(int a) { } +static void panicPutDec(int a) { } +#endif + +void __attribute__((weak)) vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName ) +{ + panicPutStr("***ERROR*** A stack overflow in task "); + panicPutStr((char *)pcTaskName); + panicPutStr(" has been detected.\r\n"); + abort(); +} + +static bool abort_called; + +static __attribute__((noreturn)) inline void invoke_abort(void) +{ + abort_called = true; +#if CONFIG_ESP32_APPTRACE_ENABLE +#if CONFIG_SYSVIEW_ENABLE + SEGGER_RTT_ESP32_FlushNoLock(CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH, APPTRACE_ONPANIC_HOST_FLUSH_TMO); +#else + esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_TRAX, CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH, + APPTRACE_ONPANIC_HOST_FLUSH_TMO); +#endif +#endif + while (1) { + if (esp_cpu_in_ocd_debug_mode()) { + __asm__ ("break 0,0"); + } + *((int *) 0) = 0; + } +} + +void abort(void) +{ +#if !CONFIG_ESP32S2_PANIC_SILENT_REBOOT + ets_printf("abort() was called at PC 0x%08x on core %d\r\n", (intptr_t)__builtin_return_address(0) - 3, xPortGetCoreID()); +#endif + invoke_abort(); +} + + +static const char *edesc[] = { + "IllegalInstruction", "Syscall", "InstructionFetchError", "LoadStoreError", + "Level1Interrupt", "Alloca", "IntegerDivideByZero", "PCValue", + "Privileged", "LoadStoreAlignment", "res", "res", + "InstrPDAddrError", "LoadStorePIFDataError", "InstrPIFAddrError", "LoadStorePIFAddrError", + "InstTLBMiss", "InstTLBMultiHit", "InstFetchPrivilege", "res", + "InstrFetchProhibited", "res", "res", "res", + "LoadStoreTLBMiss", "LoadStoreTLBMultihit", "LoadStorePrivilege", "res", + "LoadProhibited", "StoreProhibited", "res", "res", + "Cp0Dis", "Cp1Dis", "Cp2Dis", "Cp3Dis", + "Cp4Dis", "Cp5Dis", "Cp6Dis", "Cp7Dis" +}; + +#define NUM_EDESCS (sizeof(edesc) / sizeof(char *)) + +static void commonErrorHandler(XtExcFrame *frame); +static inline void disableAllWdts(void); + +//The fact that we've panic'ed probably means the other CPU is now running wild, possibly +//messing up the serial output, so we stall it here. +static void haltOtherCore(void) +{ + esp_cpu_stall( xPortGetCoreID() == 0 ? 1 : 0 ); +} + + +static void setFirstBreakpoint(uint32_t pc) +{ + asm( + "wsr.ibreaka0 %0\n" \ + "rsr.ibreakenable a3\n" \ + "movi a4,1\n" \ + "or a4, a4, a3\n" \ + "wsr.ibreakenable a4\n" \ + ::"r"(pc):"a3", "a4"); +} + +static inline void printCacheError(void) +{ + uint32_t vaddr = 0, size = 0; + uint32_t status[2]; + status[0] = REG_READ(DPORT_CACHE_DBG_STATUS0_REG); + status[1] = REG_READ(DPORT_CACHE_DBG_STATUS1_REG); + for (int i = 0; i < 32; i++) { + switch (status[0] & BIT(i)) + { + case DPORT_IC_SYNC_SIZE_FAULT_ST: + vaddr = REG_READ(DPORT_PRO_ICACHE_MEM_SYNC0_REG); + size = REG_READ(DPORT_PRO_ICACHE_MEM_SYNC1_REG); + panicPutStr("Icache sync parameter configuration error, the error address and size is 0x"); + panicPutHex(vaddr); + panicPutStr("(0x"); + panicPutHex(size); + panicPutStr(")\r\n"); + break; + case DPORT_IC_PRELOAD_SIZE_FAULT_ST: + vaddr = REG_READ(DPORT_PRO_ICACHE_PRELOAD_ADDR_REG); + size = REG_READ(DPORT_PRO_ICACHE_PRELOAD_SIZE_REG); + panicPutStr("Icache preload parameter configuration error, the error address and size is 0x"); + panicPutHex(vaddr); + panicPutStr("(0x"); + panicPutHex(size); + panicPutStr(")\r\n"); + break; + case DPORT_ICACHE_REJECT_ST: + vaddr = REG_READ(DPORT_PRO_ICACHE_REJECT_VADDR_REG); + panicPutStr("Icache reject error occurred while accessing the address 0x"); + panicPutHex(vaddr); + + if (REG_READ(DPORT_PRO_CACHE_MMU_ERROR_CONTENT_REG) & DPORT_MMU_INVALID) { + panicPutStr(" (invalid mmu entry)"); + } + panicPutStr("\r\n"); + break; + default: + break; + } + switch (status[1] & BIT(i)) + { + case DPORT_DC_SYNC_SIZE_FAULT_ST: + vaddr = REG_READ(DPORT_PRO_DCACHE_MEM_SYNC0_REG); + size = REG_READ(DPORT_PRO_DCACHE_MEM_SYNC1_REG); + panicPutStr("Dcache sync parameter configuration error, the error address and size is 0x"); + panicPutHex(vaddr); + panicPutStr("(0x"); + panicPutHex(size); + panicPutStr(")\r\n"); + break; + case DPORT_DC_PRELOAD_SIZE_FAULT_ST: + vaddr = REG_READ(DPORT_PRO_DCACHE_PRELOAD_ADDR_REG); + size = REG_READ(DPORT_PRO_DCACHE_PRELOAD_SIZE_REG); + panicPutStr("Dcache preload parameter configuration error, the error address and size is 0x"); + panicPutHex(vaddr); + panicPutStr("(0x"); + panicPutHex(size); + panicPutStr(")\r\n"); + break; + case DPORT_DCACHE_WRITE_FLASH_ST: + panicPutStr("Write back error occurred while dcache tries to write back to flash\r\n"); + break; + case DPORT_DCACHE_REJECT_ST: + vaddr = REG_READ(DPORT_PRO_DCACHE_REJECT_VADDR_REG); + panicPutStr("Dcache reject error occurred while accessing the address 0x"); + panicPutHex(vaddr); + + if (REG_READ(DPORT_PRO_CACHE_MMU_ERROR_CONTENT_REG) & DPORT_MMU_INVALID) { + panicPutStr(" (invalid mmu entry)"); + } + panicPutStr("\r\n"); + break; + case DPORT_MMU_ENTRY_FAULT_ST: + vaddr = REG_READ(DPORT_PRO_CACHE_MMU_ERROR_VADDR_REG); + panicPutStr("MMU entry fault error occurred while accessing the address 0x"); + panicPutHex(vaddr); + + if (REG_READ(DPORT_PRO_CACHE_MMU_ERROR_CONTENT_REG) & DPORT_MMU_INVALID) { + panicPutStr(" (invalid mmu entry)"); + } + panicPutStr("\r\n"); + break; + default: + break; + } + } + panicPutStr("\r\n"); +} + +//When interrupt watchdog happen in one core, both cores will be interrupted. +//The core which doesn't trigger the interrupt watchdog will save the frame and return. +//The core which triggers the interrupt watchdog will use the saved frame, and dump frames for both cores. +#if !CONFIG_FREERTOS_UNICORE +static volatile XtExcFrame * other_core_frame = NULL; +#endif //!CONFIG_FREERTOS_UNICORE + +void panicHandler(XtExcFrame *frame) +{ + int core_id = xPortGetCoreID(); + //Please keep in sync with PANIC_RSN_* defines + const char *reasons[] = { + "Unknown reason", + "Unhandled debug exception", + "Double exception", + "Unhandled kernel exception", + "Coprocessor exception", + "Interrupt wdt timeout on CPU0", + "Interrupt wdt timeout on CPU1", + "Cache exception", + }; + const char *reason = reasons[0]; + //The panic reason is stored in the EXCCAUSE register. + if (frame->exccause <= PANIC_RSN_MAX) { + reason = reasons[frame->exccause]; + } + +#if !CONFIG_FREERTOS_UNICORE + //Save frame for other core. + if ((frame->exccause == PANIC_RSN_INTWDT_CPU0 && core_id == 1) || (frame->exccause == PANIC_RSN_INTWDT_CPU1 && core_id == 0)) { + other_core_frame = frame; + while (1); + } + + //The core which triggers the interrupt watchdog will delay 1 us, so the other core can save its frame. + if (frame->exccause == PANIC_RSN_INTWDT_CPU0 || frame->exccause == PANIC_RSN_INTWDT_CPU1) { + ets_delay_us(1); + } + + if (frame->exccause == PANIC_RSN_CACHEERR && esp_cache_err_get_cpuid() != core_id) { + // Cache error interrupt will be handled by the panic handler + // on the other CPU. + while (1); + } +#endif //!CONFIG_FREERTOS_UNICORE + + haltOtherCore(); + panicPutStr("Guru Meditation Error: Core "); + panicPutDec(core_id); + panicPutStr(" panic'ed ("); + panicPutStr(reason); + panicPutStr(")\r\n"); + if (frame->exccause == PANIC_RSN_DEBUGEXCEPTION) { + int debugRsn; + asm("rsr.debugcause %0":"=r"(debugRsn)); + panicPutStr("Debug exception reason: "); + if (debugRsn & XCHAL_DEBUGCAUSE_ICOUNT_MASK) { + panicPutStr("SingleStep "); + } + if (debugRsn & XCHAL_DEBUGCAUSE_IBREAK_MASK) { + panicPutStr("HwBreakpoint "); + } + if (debugRsn & XCHAL_DEBUGCAUSE_DBREAK_MASK) { + //Unlike what the ISA manual says, this core seemingly distinguishes from a DBREAK + //reason caused by watchdog 0 and one caused by watchdog 1 by setting bit 8 of the + //debugcause if the cause is watchdog 1 and clearing it if it's watchdog 0. + if (debugRsn & (1 << 8)) { +#if CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK + const char *name = pcTaskGetTaskName(xTaskGetCurrentTaskHandleForCPU(core_id)); + panicPutStr("Stack canary watchpoint triggered ("); + panicPutStr(name); + panicPutStr(") "); +#else + panicPutStr("Watchpoint 1 triggered "); +#endif + } else { + panicPutStr("Watchpoint 0 triggered "); + } + } + if (debugRsn & XCHAL_DEBUGCAUSE_BREAK_MASK) { + panicPutStr("BREAK instr "); + } + if (debugRsn & XCHAL_DEBUGCAUSE_BREAKN_MASK) { + panicPutStr("BREAKN instr "); + } + if (debugRsn & XCHAL_DEBUGCAUSE_DEBUGINT_MASK) { + panicPutStr("DebugIntr "); + } + panicPutStr("\r\n"); + } else if (frame->exccause == PANIC_RSN_CACHEERR) { + panicPutStr(" ^~~~~~~~~~~~~~~\r\n"); + printCacheError(); + } + + if (esp_cpu_in_ocd_debug_mode()) { + disableAllWdts(); + if (frame->exccause == PANIC_RSN_INTWDT_CPU0 || + frame->exccause == PANIC_RSN_INTWDT_CPU1) { + TIMERG1.int_clr.wdt = 1; + } +#if CONFIG_ESP32_APPTRACE_ENABLE +#if CONFIG_SYSVIEW_ENABLE + SEGGER_RTT_ESP32_FlushNoLock(CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH, APPTRACE_ONPANIC_HOST_FLUSH_TMO); +#else + esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_TRAX, CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH, + APPTRACE_ONPANIC_HOST_FLUSH_TMO); +#endif +#endif + setFirstBreakpoint(frame->pc); + return; + } + commonErrorHandler(frame); +} + +void xt_unhandled_exception(XtExcFrame *frame) +{ + haltOtherCore(); + if (!abort_called) { + panicPutStr("Guru Meditation Error: Core "); + panicPutDec(xPortGetCoreID()); + panicPutStr(" panic'ed ("); + int exccause = frame->exccause; + if (exccause < NUM_EDESCS) { + panicPutStr(edesc[exccause]); + } else { + panicPutStr("Unknown"); + } + panicPutStr(")"); +#ifdef PANIC_COMPLETE_IN_ESP32C + if (esp_cpu_in_ocd_debug_mode()) { + panicPutStr(" at pc="); + panicPutHex(frame->pc); + panicPutStr(". Setting bp and returning..\r\n"); +#if CONFIG_ESP32_APPTRACE_ENABLE +#if CONFIG_SYSVIEW_ENABLE + SEGGER_RTT_ESP32_FlushNoLock(CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH, APPTRACE_ONPANIC_HOST_FLUSH_TMO); +#else + esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_TRAX, CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH, + APPTRACE_ONPANIC_HOST_FLUSH_TMO); +#endif +#endif + //Stick a hardware breakpoint on the address the handler returns to. This way, the OCD debugger + //will kick in exactly at the context the error happened. + setFirstBreakpoint(frame->pc); + return; + } +#endif + panicPutStr(". Exception was unhandled.\r\n"); + } + commonErrorHandler(frame); +} + + +/* + If watchdogs are enabled, the panic handler runs the risk of getting aborted pre-emptively because + an overzealous watchdog decides to reset it. On the other hand, if we disable all watchdogs, we run + the risk of somehow halting in the panic handler and not resetting. That is why this routine kills + all watchdogs except the timer group 0 watchdog, and it reconfigures that to reset the chip after + one second. +*/ +static void reconfigureAllWdts(void) +{ + TIMERG0.wdt_wprotect = TIMG_WDT_WKEY_VALUE; + TIMERG0.wdt_feed = 1; + TIMERG0.wdt_config0.sys_reset_length = 7; //3.2uS + TIMERG0.wdt_config0.cpu_reset_length = 7; //3.2uS + TIMERG0.wdt_config0.stg0 = TIMG_WDT_STG_SEL_RESET_SYSTEM; //1st stage timeout: reset system + TIMERG0.wdt_config1.clk_prescale = 80 * 500; //Prescaler: wdt counts in ticks of 0.5mS + TIMERG0.wdt_config2 = 2000; //1 second before reset + TIMERG0.wdt_config0.en = 1; + TIMERG0.wdt_wprotect = 0; + //Disable wdt 1 + TIMERG1.wdt_wprotect = TIMG_WDT_WKEY_VALUE; + TIMERG1.wdt_config0.en = 0; + TIMERG1.wdt_wprotect = 0; +} + +/* + This disables all the watchdogs for when we call the gdbstub. +*/ +static inline void disableAllWdts(void) +{ + TIMERG0.wdt_wprotect = TIMG_WDT_WKEY_VALUE; + TIMERG0.wdt_config0.en = 0; + TIMERG0.wdt_wprotect = 0; + TIMERG1.wdt_wprotect = TIMG_WDT_WKEY_VALUE; + TIMERG1.wdt_config0.en = 0; + TIMERG1.wdt_wprotect = 0; +} + +#if CONFIG_ESP32S2_PANIC_PRINT_REBOOT || CONFIG_ESP32S2_PANIC_SILENT_REBOOT + +static void esp_panic_dig_reset(void) __attribute__((noreturn)); + +static void esp_panic_dig_reset(void) +{ + // make sure all the panic handler output is sent from UART FIFO + uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM); + // switch to XTAL (otherwise we will keep running from the PLL) + rtc_clk_cpu_freq_set(RTC_CPU_FREQ_XTAL); + // reset the digital part + esp_cpu_unstall(PRO_CPU_NUM); + SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_SW_SYS_RST); + while (true) { + ; + } +} + +#endif + +static void putEntry(uint32_t pc, uint32_t sp) +{ + if (pc & 0x80000000) { + pc = (pc & 0x3fffffff) | 0x40000000; + } + panicPutStr(" 0x"); + panicPutHex(pc); + panicPutStr(":0x"); + panicPutHex(sp); +} + +static void doBacktrace(XtExcFrame *frame) +{ + uint32_t i = 0, pc = frame->pc, sp = frame->a1; + panicPutStr("\r\nBacktrace:"); + /* Do not check sanity on first entry, PC could be smashed. */ + putEntry(pc, sp); + pc = frame->a0; + while (i++ < 100) { + uint32_t psp = sp; + if (!esp_stack_ptr_is_sane(sp) || i++ > 100) { + break; + } + sp = *((uint32_t *) (sp - 0x10 + 4)); + putEntry(pc - 3, sp); // stack frame addresses are return addresses, so subtract 3 to get the CALL address + pc = *((uint32_t *) (psp - 0x10)); + if (pc < 0x40000000) { + break; + } + } + panicPutStr("\r\n\r\n"); +} + +/* + * Dump registers and do backtrace. + */ +static void commonErrorHandler_dump(XtExcFrame *frame, int core_id) +{ + int *regs = (int *)frame; + int x, y; + const char *sdesc[] = { + "PC ", "PS ", "A0 ", "A1 ", "A2 ", "A3 ", "A4 ", "A5 ", + "A6 ", "A7 ", "A8 ", "A9 ", "A10 ", "A11 ", "A12 ", "A13 ", + "A14 ", "A15 ", "SAR ", "EXCCAUSE", "EXCVADDR", "LBEG ", "LEND ", "LCOUNT " + }; + + /* only dump registers for 'real' crashes, if crashing via abort() + the register window is no longer useful. + */ + if (!abort_called) { + panicPutStr("Core"); + panicPutDec(core_id); + panicPutStr(" register dump:\r\n"); + + for (x = 0; x < 24; x += 4) { + for (y = 0; y < 4; y++) { + if (sdesc[x + y][0] != 0) { + panicPutStr(sdesc[x + y]); + panicPutStr(": 0x"); + panicPutHex(regs[x + y + 1]); + panicPutStr(" "); + } + } + panicPutStr("\r\n"); + } + + if (xPortInterruptedFromISRContext() +#if !CONFIG_FREERTOS_UNICORE + && other_core_frame != frame +#endif //!CONFIG_FREERTOS_UNICORE + ) { + //If the core which triggers the interrupt watchdog was in ISR context, dump the epc registers. + uint32_t __value; + panicPutStr("Core"); + panicPutDec(core_id); + panicPutStr(" was running in ISR context:\r\n"); + + __asm__("rsr.epc1 %0" : "=a"(__value)); + panicPutStr("EPC1 : 0x"); + panicPutHex(__value); + + __asm__("rsr.epc2 %0" : "=a"(__value)); + panicPutStr(" EPC2 : 0x"); + panicPutHex(__value); + + __asm__("rsr.epc3 %0" : "=a"(__value)); + panicPutStr(" EPC3 : 0x"); + panicPutHex(__value); + + __asm__("rsr.epc4 %0" : "=a"(__value)); + panicPutStr(" EPC4 : 0x"); + panicPutHex(__value); + + panicPutStr("\r\n"); + } + + } + + /* With windowed ABI backtracing is easy, let's do it. */ + doBacktrace(frame); + +} + +/* + We arrive here after a panic or unhandled exception, when no OCD is detected. Dump the registers to the + serial port and either jump to the gdb stub, halt the CPU or reboot. +*/ +static __attribute__((noreturn)) void commonErrorHandler(XtExcFrame *frame) +{ + + int core_id = xPortGetCoreID(); + // start panic WDT to restart system if we hang in this handler + if (!rtc_wdt_is_on()) { + rtc_wdt_protect_off(); + rtc_wdt_disable(); + rtc_wdt_set_length_of_reset_signal(RTC_WDT_SYS_RESET_SIG, RTC_WDT_LENGTH_3_2us); + rtc_wdt_set_length_of_reset_signal(RTC_WDT_CPU_RESET_SIG, RTC_WDT_LENGTH_3_2us); + rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_SYSTEM); + // 64KB of core dump data (stacks of about 30 tasks) will produce ~85KB base64 data. + // @ 115200 UART speed it will take more than 6 sec to print them out. + rtc_wdt_set_time(RTC_WDT_STAGE0, 7000); + rtc_wdt_enable(); + rtc_wdt_protect_on(); + } + + //Feed the watchdogs, so they will give us time to print out debug info + reconfigureAllWdts(); + + commonErrorHandler_dump(frame, core_id); +#if !CONFIG_FREERTOS_UNICORE + if (other_core_frame != NULL) { + commonErrorHandler_dump((XtExcFrame *)other_core_frame, (core_id ? 0 : 1)); + } +#endif //!CONFIG_FREERTOS_UNICORE + +#if CONFIG_ESP32_APPTRACE_ENABLE + disableAllWdts(); +#if CONFIG_SYSVIEW_ENABLE + SEGGER_RTT_ESP32_FlushNoLock(CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH, APPTRACE_ONPANIC_HOST_FLUSH_TMO); +#else + esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_TRAX, CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH, + APPTRACE_ONPANIC_HOST_FLUSH_TMO); +#endif + reconfigureAllWdts(); +#endif + +#if CONFIG_ESP32S2_PANIC_GDBSTUB + disableAllWdts(); + rtc_wdt_disable(); + panicPutStr("Entering gdb stub now.\r\n"); + esp_gdbstub_panic_handler(frame); +#else +#if CONFIG_ESP32_ENABLE_COREDUMP + static bool s_dumping_core; + if (s_dumping_core) { + panicPutStr("Re-entered core dump! Exception happened during core dump!\r\n"); + } else { + disableAllWdts(); + s_dumping_core = true; +#if CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH + esp_core_dump_to_flash(frame); +#endif +#if CONFIG_ESP32_ENABLE_COREDUMP_TO_UART && !CONFIG_ESP32S2_PANIC_SILENT_REBOOT + esp_core_dump_to_uart(frame); +#endif + s_dumping_core = false; + reconfigureAllWdts(); + } +#endif /* CONFIG_ESP32_ENABLE_COREDUMP */ + rtc_wdt_disable(); +#if CONFIG_ESP32S2_PANIC_PRINT_REBOOT || CONFIG_ESP32S2_PANIC_SILENT_REBOOT + panicPutStr("Rebooting...\r\n"); + if (frame->exccause != PANIC_RSN_CACHEERR) { + esp_restart_noos(); + } else { + // The only way to clear invalid cache access interrupt is to reset the digital part + esp_panic_dig_reset(); + } +#else + disableAllWdts(); + panicPutStr("CPU halted.\r\n"); + while (1); +#endif /* CONFIG_ESP32S2_PANIC_PRINT_REBOOT || CONFIG_ESP32S2_PANIC_SILENT_REBOOT */ +#endif /* CONFIG_ESP32S2_PANIC_GDBSTUB */ +} + + +void esp_set_breakpoint_if_jtag(void *fn) +{ + if (esp_cpu_in_ocd_debug_mode()) { + setFirstBreakpoint((uint32_t)fn); + } +} + + +esp_err_t esp_set_watchpoint(int no, void *adr, int size, int flags) +{ + int x; + if (no < 0 || no > 1) { + return ESP_ERR_INVALID_ARG; + } + if (flags & (~0xC0000000)) { + return ESP_ERR_INVALID_ARG; + } + int dbreakc = 0x3F; + //We support watching 2^n byte values, from 1 to 64. Calculate the mask for that. + for (x = 0; x < 7; x++) { + if (size == (1 << x)) { + break; + } + dbreakc <<= 1; + } + if (x == 7) { + return ESP_ERR_INVALID_ARG; + } + //Mask mask and add in flags. + dbreakc = (dbreakc & 0x3f) | flags; + + if (no == 0) { + asm volatile( + "wsr.dbreaka0 %0\n" \ + "wsr.dbreakc0 %1\n" \ + ::"r"(adr), "r"(dbreakc)); + } else { + asm volatile( + "wsr.dbreaka1 %0\n" \ + "wsr.dbreakc1 %1\n" \ + ::"r"(adr), "r"(dbreakc)); + } + return ESP_OK; +} + +void esp_clear_watchpoint(int no) +{ + //Setting a dbreakc register to 0 makes it trigger on neither load nor store, effectively disabling it. + int dbreakc = 0; + if (no == 0) { + asm volatile( + "wsr.dbreakc0 %0\n" \ + ::"r"(dbreakc)); + } else { + asm volatile( + "wsr.dbreakc1 %0\n" \ + ::"r"(dbreakc)); + } +} + +void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression) +{ + ets_printf("ESP_ERROR_CHECK failed: esp_err_t 0x%x", rc); +#ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP + ets_printf(" (%s)", esp_err_to_name(rc)); +#endif //CONFIG_ESP_ERR_TO_NAME_LOOKUP + ets_printf(" at 0x%08x\n", (intptr_t)__builtin_return_address(0) - 3); + if (spi_flash_cache_enabled()) { // strings may be in flash cache + ets_printf("file: \"%s\" line %d\nfunc: %s\nexpression: %s\n", file, line, function, expression); + } + invoke_abort(); +} diff --git a/components/esp32s2beta/pm_esp32s2beta.c b/components/esp32s2beta/pm_esp32s2beta.c new file mode 100644 index 0000000000..e3e5180af5 --- /dev/null +++ b/components/esp32s2beta/pm_esp32s2beta.c @@ -0,0 +1,591 @@ +// Copyright 2016-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include + +#include "esp_attr.h" +#include "esp_err.h" +#include "esp_pm.h" +#include "esp_log.h" +#include "esp32s2beta/clk.h" +#include "esp_private/crosscore_int.h" + +#include "soc/rtc.h" + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/xtensa_timer.h" +#include "xtensa/core-macros.h" + +#include "esp_private/pm_impl.h" +#include "esp_private/pm_trace.h" +#include "esp_private/esp_timer_impl.h" +#include "esp32s2beta/pm.h" + +/* CCOMPARE update timeout, in CPU cycles. Any value above ~600 cycles will work + * for the purpose of detecting a deadlock. + */ +#define CCOMPARE_UPDATE_TIMEOUT 1000000 + +/* When changing CCOMPARE, don't allow changes if the difference is less + * than this. This is to prevent setting CCOMPARE below CCOUNT. + */ +#define CCOMPARE_MIN_CYCLES_IN_FUTURE 1000 + +/* When light sleep is used, wake this number of microseconds earlier than + * the next tick. + */ +#define LIGHT_SLEEP_EARLY_WAKEUP_US 100 + +#ifdef CONFIG_PM_PROFILING +#define WITH_PROFILING +#endif + + +static portMUX_TYPE s_switch_lock = portMUX_INITIALIZER_UNLOCKED; +/* The following state variables are protected using s_switch_lock: */ +/* Current sleep mode; When switching, contains old mode until switch is complete */ +static pm_mode_t s_mode = PM_MODE_CPU_MAX; +/* True when switch is in progress */ +static volatile bool s_is_switching; +/* When switch is in progress, this is the mode we are switching into */ +static pm_mode_t s_new_mode = PM_MODE_CPU_MAX; +/* Number of times each mode was locked */ +static size_t s_mode_lock_counts[PM_MODE_COUNT]; +/* Bit mask of locked modes. BIT(i) is set iff s_mode_lock_counts[i] > 0. */ +static uint32_t s_mode_mask; + +/* Divider and multiplier used to adjust (ccompare - ccount) duration. + * Only set to non-zero values when switch is in progress. + */ +static uint32_t s_ccount_div; +static uint32_t s_ccount_mul; + +/* Indicates to the ISR hook that CCOMPARE needs to be updated on the given CPU. + * Used in conjunction with cross-core interrupt to update CCOMPARE on the other CPU. + */ +static volatile bool s_need_update_ccompare[portNUM_PROCESSORS]; + +/* When no RTOS tasks are active, these locks are released to allow going into + * a lower power mode. Used by ISR hook and idle hook. + */ +static esp_pm_lock_handle_t s_rtos_lock_handle[portNUM_PROCESSORS]; + +/* A flag indicating that Idle hook has run on a given CPU; + * Next interrupt on the same CPU will take s_rtos_lock_handle. + */ +static bool s_core_idle[portNUM_PROCESSORS]; + +/* g_ticks_us defined in ROM for PRO CPU */ +extern uint32_t g_ticks_per_us_pro; + +/* Lookup table of CPU frequencies to be used in each mode. + * Initialized by esp_pm_impl_init and modified by esp_pm_configure. + */ +rtc_cpu_freq_t s_cpu_freq_by_mode[PM_MODE_COUNT]; + +/* Lookup table of CPU ticks per microsecond for each RTC_CPU_FREQ_ value. + * Essentially the same as returned by rtc_clk_cpu_freq_value(), but without + * the function call. Not const because XTAL frequency is only known at run time. + */ +static uint32_t s_cpu_freq_to_ticks[] = { + [RTC_CPU_FREQ_XTAL] = 0, /* This is set by esp_pm_impl_init */ + [RTC_CPU_FREQ_80M] = 80, + [RTC_CPU_FREQ_160M] = 160, + [RTC_CPU_FREQ_240M] = 240, + [RTC_CPU_FREQ_2M] = 2 +}; + +/* Lookup table of names for each RTC_CPU_FREQ_ value. Used for logging only. */ +static const char* s_freq_names[] __attribute__((unused)) = { + [RTC_CPU_FREQ_XTAL] = "XTAL", + [RTC_CPU_FREQ_80M] = "80", + [RTC_CPU_FREQ_160M] = "160", + [RTC_CPU_FREQ_240M] = "240", + [RTC_CPU_FREQ_2M] = "2" +}; + +/* Whether automatic light sleep is enabled */ +static bool s_light_sleep_en = false; + +/* When configuration is changed, current frequency may not match the + * newly configured frequency for the current mode. This is an indicator + * to the mode switch code to get the actual current frequency instead of + * relying on the current mode. + */ +static bool s_config_changed = false; + +#ifdef WITH_PROFILING +/* Time, in microseconds, spent so far in each mode */ +static pm_time_t s_time_in_mode[PM_MODE_COUNT]; +/* Timestamp, in microseconds, when the mode switch last happened */ +static pm_time_t s_last_mode_change_time; +/* User-readable mode names, used by esp_pm_impl_dump_stats */ +static const char* s_mode_names[] = { + "SLEEP", + "APB_MIN", + "APB_MAX", + "CPU_MAX" +}; +#endif // WITH_PROFILING + + +static const char* TAG = "pm_esp32"; + +static void update_ccompare(void); +static void do_switch(pm_mode_t new_mode); +static void leave_idle(void); +static void on_freq_update(uint32_t old_ticks_per_us, uint32_t ticks_per_us); + + +pm_mode_t esp_pm_impl_get_mode(esp_pm_lock_type_t type, int arg) +{ + (void) arg; + if (type == ESP_PM_CPU_FREQ_MAX) { + return PM_MODE_CPU_MAX; + } else if (type == ESP_PM_APB_FREQ_MAX) { + return PM_MODE_APB_MAX; + } else if (type == ESP_PM_NO_LIGHT_SLEEP) { + return PM_MODE_APB_MIN; + } else { + // unsupported mode + abort(); + } +} + +/* rtc_cpu_freq_t enum is not ordered by frequency, so convert to MHz, + * figure out the maximum value, then convert back to rtc_cpu_freq_t. + */ +static rtc_cpu_freq_t max_freq_of(rtc_cpu_freq_t f1, rtc_cpu_freq_t f2) +{ + int f1_hz = rtc_clk_cpu_freq_value(f1); + int f2_hz = rtc_clk_cpu_freq_value(f2); + int f_max_hz = MAX(f1_hz, f2_hz); + rtc_cpu_freq_t result = RTC_CPU_FREQ_XTAL; + if (!rtc_clk_cpu_freq_from_mhz(f_max_hz/1000000, &result)) { + assert(false && "unsupported frequency"); + } + return result; +} + +esp_err_t esp_pm_configure(const void* vconfig) +{ +#ifndef CONFIG_PM_ENABLE + return ESP_ERR_NOT_SUPPORTED; +#endif + + const esp_pm_config_esp32_t* config = (const esp_pm_config_esp32_t*) vconfig; +#ifndef CONFIG_FREERTOS_USE_TICKLESS_IDLE + if (config->light_sleep_enable) { + return ESP_ERR_NOT_SUPPORTED; + } +#endif + + if (config->min_cpu_freq == RTC_CPU_FREQ_2M) { + /* Minimal APB frequency to achieve 1MHz REF_TICK frequency is 5 MHz */ + return ESP_ERR_NOT_SUPPORTED; + } + + rtc_cpu_freq_t min_freq = config->min_cpu_freq; + rtc_cpu_freq_t max_freq = config->max_cpu_freq; + int min_freq_mhz = rtc_clk_cpu_freq_value(min_freq); + int max_freq_mhz = rtc_clk_cpu_freq_value(max_freq); + if (min_freq_mhz > max_freq_mhz) { + return ESP_ERR_INVALID_ARG; + } + + rtc_cpu_freq_t apb_max_freq = max_freq; /* CPU frequency in APB_MAX mode */ + if (max_freq == RTC_CPU_FREQ_240M) { + /* We can't switch between 240 and 80/160 without disabling PLL, + * so use 240MHz CPU frequency when 80MHz APB frequency is requested. + */ + apb_max_freq = RTC_CPU_FREQ_240M; + } else if (max_freq == RTC_CPU_FREQ_160M || max_freq == RTC_CPU_FREQ_80M) { + /* Otherwise, can use 80MHz + * CPU frequency when 80MHz APB frequency is requested. + */ + apb_max_freq = RTC_CPU_FREQ_80M; + } + + apb_max_freq = max_freq_of(apb_max_freq, min_freq); + + ESP_LOGI(TAG, "Frequency switching config: " + "CPU_MAX: %s, APB_MAX: %s, APB_MIN: %s, Light sleep: %s", + s_freq_names[max_freq], + s_freq_names[apb_max_freq], + s_freq_names[min_freq], + config->light_sleep_enable ? "ENABLED" : "DISABLED"); + + portENTER_CRITICAL(&s_switch_lock); + s_cpu_freq_by_mode[PM_MODE_CPU_MAX] = max_freq; + s_cpu_freq_by_mode[PM_MODE_APB_MAX] = apb_max_freq; + s_cpu_freq_by_mode[PM_MODE_APB_MIN] = min_freq; + s_cpu_freq_by_mode[PM_MODE_LIGHT_SLEEP] = min_freq; + s_light_sleep_en = config->light_sleep_enable; + s_config_changed = true; + portEXIT_CRITICAL(&s_switch_lock); + + return ESP_OK; +} + +static pm_mode_t IRAM_ATTR get_lowest_allowed_mode(void) +{ + /* TODO: optimize using ffs/clz */ + if (s_mode_mask >= BIT(PM_MODE_CPU_MAX)) { + return PM_MODE_CPU_MAX; + } else if (s_mode_mask >= BIT(PM_MODE_APB_MAX)) { + return PM_MODE_APB_MAX; + } else if (s_mode_mask >= BIT(PM_MODE_APB_MIN) || !s_light_sleep_en) { + return PM_MODE_APB_MIN; + } else { + return PM_MODE_LIGHT_SLEEP; + } +} + +void IRAM_ATTR esp_pm_impl_switch_mode(pm_mode_t mode, + pm_mode_switch_t lock_or_unlock, pm_time_t now) +{ + bool need_switch = false; + uint32_t mode_mask = BIT(mode); + portENTER_CRITICAL(&s_switch_lock); + uint32_t count; + if (lock_or_unlock == MODE_LOCK) { + count = ++s_mode_lock_counts[mode]; + } else { + count = s_mode_lock_counts[mode]--; + } + if (count == 1) { + if (lock_or_unlock == MODE_LOCK) { + s_mode_mask |= mode_mask; + } else { + s_mode_mask &= ~mode_mask; + } + need_switch = true; + } + + pm_mode_t new_mode = s_mode; + if (need_switch) { + new_mode = get_lowest_allowed_mode(); +#ifdef WITH_PROFILING + if (s_last_mode_change_time != 0) { + pm_time_t diff = now - s_last_mode_change_time; + s_time_in_mode[s_mode] += diff; + } + s_last_mode_change_time = now; +#endif // WITH_PROFILING + } + portEXIT_CRITICAL(&s_switch_lock); + if (need_switch && new_mode != s_mode) { + do_switch(new_mode); + } +} + +/** + * @brief Update clock dividers in esp_timer and FreeRTOS, and adjust CCOMPARE + * values on both CPUs. + * @param old_ticks_per_us old CPU frequency + * @param ticks_per_us new CPU frequency + */ +static void IRAM_ATTR on_freq_update(uint32_t old_ticks_per_us, uint32_t ticks_per_us) +{ + uint32_t old_apb_ticks_per_us = MIN(old_ticks_per_us, 80); + uint32_t apb_ticks_per_us = MIN(ticks_per_us, 80); + /* Update APB frequency value used by the timer */ + if (old_apb_ticks_per_us != apb_ticks_per_us) { + esp_timer_impl_update_apb_freq(apb_ticks_per_us); + } + + /* Calculate new tick divisor */ + _xt_tick_divisor = ticks_per_us * 1000000 / XT_TICK_PER_SEC; + + int core_id = xPortGetCoreID(); + if (s_rtos_lock_handle[core_id] != NULL) { + ESP_PM_TRACE_ENTER(CCOMPARE_UPDATE, core_id); + /* ccount_div and ccount_mul are used in esp_pm_impl_update_ccompare + * to calculate new CCOMPARE value. + */ + s_ccount_div = old_ticks_per_us; + s_ccount_mul = ticks_per_us; + + /* Update CCOMPARE value on this CPU */ + update_ccompare(); + +#if portNUM_PROCESSORS == 2 + /* Send interrupt to the other CPU to update CCOMPARE value */ + int other_core_id = (core_id == 0) ? 1 : 0; + + s_need_update_ccompare[other_core_id] = true; + esp_crosscore_int_send_freq_switch(other_core_id); + + int timeout = 0; + while (s_need_update_ccompare[other_core_id]) { + if (++timeout == CCOMPARE_UPDATE_TIMEOUT) { + assert(false && "failed to update CCOMPARE, possible deadlock"); + } + } +#endif // portNUM_PROCESSORS == 2 + + s_ccount_mul = 0; + s_ccount_div = 0; + ESP_PM_TRACE_EXIT(CCOMPARE_UPDATE, core_id); + } +} + +/** + * Perform the switch to new power mode. + * Currently only changes the CPU frequency and adjusts clock dividers. + * No light sleep yet. + * @param new_mode mode to switch to + */ +static void IRAM_ATTR do_switch(pm_mode_t new_mode) +{ + const int core_id = xPortGetCoreID(); + + do { + portENTER_CRITICAL_ISR(&s_switch_lock); + if (!s_is_switching) { + break; + } + if (s_new_mode <= new_mode) { + portEXIT_CRITICAL_ISR(&s_switch_lock); + return; + } + if (s_need_update_ccompare[core_id]) { + s_need_update_ccompare[core_id] = false; + } + portEXIT_CRITICAL_ISR(&s_switch_lock); + } while (true); + s_new_mode = new_mode; + s_is_switching = true; + bool config_changed = s_config_changed; + s_config_changed = false; + portEXIT_CRITICAL_ISR(&s_switch_lock); + + rtc_cpu_freq_t new_freq = s_cpu_freq_by_mode[new_mode]; + rtc_cpu_freq_t old_freq; + if (!config_changed) { + old_freq = s_cpu_freq_by_mode[s_mode]; + } else { + old_freq = rtc_clk_cpu_freq_get(); + } + + if (new_freq != old_freq) { + uint32_t old_ticks_per_us = g_ticks_per_us_pro; + uint32_t new_ticks_per_us = s_cpu_freq_to_ticks[new_freq]; + + bool switch_down = new_ticks_per_us < old_ticks_per_us; + + ESP_PM_TRACE_ENTER(FREQ_SWITCH, core_id); + if (switch_down) { + on_freq_update(old_ticks_per_us, new_ticks_per_us); + } + rtc_clk_cpu_freq_set_fast(new_freq); + if (!switch_down) { + on_freq_update(old_ticks_per_us, new_ticks_per_us); + } + ESP_PM_TRACE_EXIT(FREQ_SWITCH, core_id); + } + + portENTER_CRITICAL_ISR(&s_switch_lock); + s_mode = new_mode; + s_is_switching = false; + portEXIT_CRITICAL_ISR(&s_switch_lock); +} + +/** + * @brief Calculate new CCOMPARE value based on s_ccount_{mul,div} + * + * Adjusts CCOMPARE value so that the interrupt happens at the same time as it + * would happen without the frequency change. + * Assumes that the new_frequency = old_frequency * s_ccount_mul / s_ccount_div. + */ +static void IRAM_ATTR update_ccompare(void) +{ + uint32_t ccount = XTHAL_GET_CCOUNT(); + uint32_t ccompare = XTHAL_GET_CCOMPARE(XT_TIMER_INDEX); + if ((ccompare - CCOMPARE_MIN_CYCLES_IN_FUTURE) - ccount < UINT32_MAX / 2) { + uint32_t diff = ccompare - ccount; + uint32_t diff_scaled = (diff * s_ccount_mul + s_ccount_div - 1) / s_ccount_div; + if (diff_scaled < _xt_tick_divisor) { + uint32_t new_ccompare = ccount + diff_scaled; + XTHAL_SET_CCOMPARE(XT_TIMER_INDEX, new_ccompare); + } + } +} + +static void IRAM_ATTR leave_idle(void) +{ + int core_id = xPortGetCoreID(); + if (s_core_idle[core_id]) { + // TODO: possible optimization: raise frequency here first + esp_pm_lock_acquire(s_rtos_lock_handle[core_id]); + s_core_idle[core_id] = false; + } +} + +void esp_pm_impl_idle_hook(void) +{ + int core_id = xPortGetCoreID(); + uint32_t state = portENTER_CRITICAL_NESTED(); + if (!s_core_idle[core_id]) { + esp_pm_lock_release(s_rtos_lock_handle[core_id]); + s_core_idle[core_id] = true; + } + portEXIT_CRITICAL_NESTED(state); + ESP_PM_TRACE_ENTER(IDLE, core_id); +} + +void esp_pm_impl_waiti(void) +{ +#if CONFIG_FREERTOS_USE_TICKLESS_IDLE + int core_id = xPortGetCoreID(); + if (s_skipped_light_sleep[core_id]) { + asm("waiti 0"); + /* Interrupt took the CPU out of waiti and s_rtos_lock_handle[core_id] + * is now taken. However since we are back to idle task, we can release + * the lock so that vApplicationSleep can attempt to enter light sleep. + */ + esp_pm_impl_idle_hook(); + s_skipped_light_sleep[core_id] = false; + } +#else + asm("waiti 0"); +#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE +} + +void IRAM_ATTR esp_pm_impl_isr_hook(void) +{ + int core_id = xPortGetCoreID(); + ESP_PM_TRACE_ENTER(ISR_HOOK, core_id); +#if portNUM_PROCESSORS == 2 + if (s_need_update_ccompare[core_id]) { + update_ccompare(); + s_need_update_ccompare[core_id] = false; + } else { + leave_idle(); + } +#else + leave_idle(); +#endif // portNUM_PROCESSORS == 2 + ESP_PM_TRACE_EXIT(ISR_HOOK, core_id); +} + +#if CONFIG_FREERTOS_USE_TICKLESS_IDLE + +bool IRAM_ATTR vApplicationSleep( TickType_t xExpectedIdleTime ) +{ + bool result = false; + portENTER_CRITICAL(&s_switch_lock); + if (s_mode == PM_MODE_LIGHT_SLEEP && !s_is_switching) { + /* Calculate how much we can sleep */ + int64_t next_esp_timer_alarm = esp_timer_get_next_alarm(); + int64_t now = esp_timer_get_time(); + int64_t time_until_next_alarm = next_esp_timer_alarm - now; + int64_t wakeup_delay_us = portTICK_PERIOD_MS * 1000LL * xExpectedIdleTime; + int64_t sleep_time_us = MIN(wakeup_delay_us, time_until_next_alarm); + if (sleep_time_us >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP * portTICK_PERIOD_MS * 1000LL) { + esp_sleep_enable_timer_wakeup(sleep_time_us - LIGHT_SLEEP_EARLY_WAKEUP_US); +#ifdef CONFIG_PM_TRACE + /* to force tracing GPIOs to keep state */ + esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); +#endif + /* Enter sleep */ + int core_id = xPortGetCoreID(); + ESP_PM_TRACE_ENTER(SLEEP, core_id); + int64_t sleep_start = esp_timer_get_time(); + esp_light_sleep_start(); + int64_t slept_us = esp_timer_get_time() - sleep_start; + ESP_PM_TRACE_EXIT(SLEEP, core_id); + + uint32_t slept_ticks = slept_us / (portTICK_PERIOD_MS * 1000LL); + if (slept_ticks > 0) { + /* Adjust RTOS tick count based on the amount of time spent in sleep */ + vTaskStepTick(slept_ticks); + + /* Trigger tick interrupt, since sleep time was longer + * than portTICK_PERIOD_MS. Note that setting INTSET does not + * work for timer interrupt, and changing CCOMPARE would clear + * the interrupt flag. + */ + XTHAL_SET_CCOUNT(XTHAL_GET_CCOMPARE(XT_TIMER_INDEX) - 16); + while (!(XTHAL_GET_INTERRUPT() & BIT(XT_TIMER_INTNUM))) { + ; + } + } + result = true; + } + } + portEXIT_CRITICAL(&s_switch_lock); + return result; +} +#endif //CONFIG_FREERTOS_USE_TICKLESS_IDLE + +#ifdef WITH_PROFILING +void esp_pm_impl_dump_stats(FILE* out) +{ + pm_time_t time_in_mode[PM_MODE_COUNT]; + + portENTER_CRITICAL_ISR(&s_switch_lock); + memcpy(time_in_mode, s_time_in_mode, sizeof(time_in_mode)); + pm_time_t last_mode_change_time = s_last_mode_change_time; + pm_mode_t cur_mode = s_mode; + pm_time_t now = pm_get_time(); + portEXIT_CRITICAL_ISR(&s_switch_lock); + + time_in_mode[cur_mode] += now - last_mode_change_time; + + fprintf(out, "Mode stats:\n"); + for (int i = 0; i < PM_MODE_COUNT; ++i) { + if (i == PM_MODE_LIGHT_SLEEP && !s_light_sleep_en) { + /* don't display light sleep mode if it's not enabled */ + continue; + } + fprintf(out, "%8s %6s %12lld %2d%%\n", + s_mode_names[i], + s_freq_names[s_cpu_freq_by_mode[i]], + time_in_mode[i], + (int) (time_in_mode[i] * 100 / now)); + } +} +#endif // WITH_PROFILING + +void esp_pm_impl_init(void) +{ + s_cpu_freq_to_ticks[RTC_CPU_FREQ_XTAL] = rtc_clk_xtal_freq_get(); +#ifdef CONFIG_PM_TRACE + esp_pm_trace_init(); +#endif + ESP_ERROR_CHECK(esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "rtos0", + &s_rtos_lock_handle[0])); + ESP_ERROR_CHECK(esp_pm_lock_acquire(s_rtos_lock_handle[0])); +#if portNUM_PROCESSORS == 2 + ESP_ERROR_CHECK(esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "rtos1", + &s_rtos_lock_handle[1])); + ESP_ERROR_CHECK(esp_pm_lock_acquire(s_rtos_lock_handle[1])); +#endif // portNUM_PROCESSORS == 2 + + /* Configure all modes to use the default CPU frequency. + * This will be modified later by a call to esp_pm_configure. + */ + rtc_cpu_freq_t default_freq; + if (!rtc_clk_cpu_freq_from_mhz(CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ, &default_freq)) { + assert(false && "unsupported frequency"); + } + for (size_t i = 0; i < PM_MODE_COUNT; ++i) { + s_cpu_freq_by_mode[i] = default_freq; + } +} diff --git a/components/esp32s2beta/pm_trace.c b/components/esp32s2beta/pm_trace.c new file mode 100644 index 0000000000..cad2e40e2d --- /dev/null +++ b/components/esp32s2beta/pm_trace.c @@ -0,0 +1,52 @@ +// Copyright 2016-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#include "esp_private/pm_trace.h" +#include "driver/gpio.h" +#include "soc/gpio_reg.h" + +/* GPIOs to use for tracing of esp_pm events. + * Two entries in the array for each type, one for each CPU. + * Feel free to change when debugging. + */ +static const int DRAM_ATTR s_trace_io[] = { + BIT(4), BIT(5), // ESP_PM_TRACE_IDLE + BIT(16), BIT(17), // ESP_PM_TRACE_TICK + BIT(18), BIT(18), // ESP_PM_TRACE_FREQ_SWITCH + BIT(19), BIT(19), // ESP_PM_TRACE_CCOMPARE_UPDATE + BIT(25), BIT(26), // ESP_PM_TRACE_ISR_HOOK + BIT(27), BIT(27), // ESP_PM_TRACE_SLEEP +}; + +void esp_pm_trace_init(void) +{ + for (size_t i = 0; i < sizeof(s_trace_io)/sizeof(s_trace_io[0]); ++i) { + int io = __builtin_ffs(s_trace_io[i]); + if (io == 0) { + continue; + } + gpio_set_direction(io - 1, GPIO_MODE_OUTPUT); + } +} + +void IRAM_ATTR esp_pm_trace_enter(esp_pm_trace_event_t event, int core_id) +{ + REG_WRITE(GPIO_OUT_W1TS_REG, s_trace_io[2 * event + core_id]); +} + +void IRAM_ATTR esp_pm_trace_exit(esp_pm_trace_event_t event, int core_id) +{ + REG_WRITE(GPIO_OUT_W1TC_REG, s_trace_io[2 * event + core_id]); +} diff --git a/components/esp32s2beta/sleep_modes.c b/components/esp32s2beta/sleep_modes.c new file mode 100644 index 0000000000..f0c5bd24d8 --- /dev/null +++ b/components/esp32s2beta/sleep_modes.c @@ -0,0 +1,620 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include "esp_attr.h" +#include "esp_sleep.h" +#include "esp_private/esp_timer_impl.h" +#include "esp_log.h" +#include "esp32s2beta/clk.h" +#include "esp_newlib.h" +#include "esp_spi_flash.h" +#include "esp32s2beta/rom/cache.h" +#include "esp32s2beta/rom/rtc.h" +#include "esp32s2beta/rom/uart.h" +#include "esp32s2beta/rom/ets_sys.h" +#include "soc/cpu.h" +#include "soc/rtc.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/apb_ctrl_reg.h" +#include "soc/rtc_io_reg.h" +#include "soc/spi_mem_reg.h" +#include "soc/sens_reg.h" +#include "soc/dport_reg.h" +#include "soc/rtc_wdt.h" +#include "driver/rtc_io.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "sdkconfig.h" + +// If light sleep time is less than that, don't power down flash +#define FLASH_PD_MIN_SLEEP_TIME_US 2000 + +// Time from VDD_SDIO power up to first flash read in ROM code +#define VDD_SDIO_POWERUP_TO_FLASH_READ_US 700 + +// Extra time it takes to enter and exit light sleep and deep sleep +// For deep sleep, this is until the wake stub runs (not the app). +#ifdef CONFIG_ESP32S2_RTC_CLK_SRC_EXT_CRYS +#define LIGHT_SLEEP_TIME_OVERHEAD_US (650 + 30 * 240 / CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ) +#define DEEP_SLEEP_TIME_OVERHEAD_US (650 + 100 * 240 / CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ) +#else +#define LIGHT_SLEEP_TIME_OVERHEAD_US (250 + 30 * 240 / CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ) +#define DEEP_SLEEP_TIME_OVERHEAD_US (250 + 100 * 240 / CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ) +#endif // CONFIG_ESP32S2_RTC_CLK_SRC_EXT_CRYS + +// Minimal amount of time we can sleep for +#define LIGHT_SLEEP_MIN_TIME_US 200 + +#define CHECK_SOURCE(source, value, mask) ((s_config.wakeup_triggers & mask) && \ + (source == value)) + +/** + * Internal structure which holds all requested deep sleep parameters + */ +typedef struct { + esp_sleep_pd_option_t pd_options[ESP_PD_DOMAIN_MAX]; + uint64_t sleep_duration; + uint32_t wakeup_triggers : 11; + uint32_t ext1_trigger_mode : 1; + uint32_t ext1_rtc_gpio_mask : 18; + uint32_t ext0_trigger_level : 1; + uint32_t ext0_rtc_gpio_num : 5; + uint32_t sleep_time_adjustment; + uint64_t rtc_ticks_at_sleep_start; +} sleep_config_t; + +static sleep_config_t s_config = { + .pd_options = { ESP_PD_OPTION_AUTO, ESP_PD_OPTION_AUTO, ESP_PD_OPTION_AUTO }, + .wakeup_triggers = 0 +}; + +/* Updating RTC_MEMORY_CRC_REG register via set_rtc_memory_crc() + is not thread-safe. */ +static _lock_t lock_rtc_memory_crc; + +static const char* TAG = "sleep"; + +static uint32_t get_power_down_flags(void); +static void ext0_wakeup_prepare(void); +static void ext1_wakeup_prepare(void); +static void timer_wakeup_prepare(void); + +/* Wake from deep sleep stub + See esp_deepsleep.h esp_wake_deep_sleep() comments for details. +*/ +esp_deep_sleep_wake_stub_fn_t esp_get_deep_sleep_wake_stub(void) +{ + _lock_acquire(&lock_rtc_memory_crc); + uint32_t stored_crc = REG_READ(RTC_MEMORY_CRC_REG); + set_rtc_memory_crc(); + uint32_t calc_crc = REG_READ(RTC_MEMORY_CRC_REG); + REG_WRITE(RTC_MEMORY_CRC_REG, stored_crc); + _lock_release(&lock_rtc_memory_crc); + + if(stored_crc == calc_crc) { + return (esp_deep_sleep_wake_stub_fn_t)REG_READ(RTC_ENTRY_ADDR_REG); + } else { + return NULL; + } +} + +void esp_set_deep_sleep_wake_stub(esp_deep_sleep_wake_stub_fn_t new_stub) +{ + _lock_acquire(&lock_rtc_memory_crc); + REG_WRITE(RTC_ENTRY_ADDR_REG, (uint32_t)new_stub); + set_rtc_memory_crc(); + _lock_release(&lock_rtc_memory_crc); +} + +void RTC_IRAM_ATTR esp_default_wake_deep_sleep(void) { + /* Clear MMU for CPU 0 */ + _DPORT_REG_SET_BIT(DPORT_PRO_CACHE_IA_INT_EN_REG, DPORT_PRO_CACHE_INT_CLR); + _DPORT_REG_SET_BIT(DPORT_PRO_CACHE_IA_INT_EN_REG, DPORT_PRO_CACHE_DBG_EN); +} + +void __attribute__((weak, alias("esp_default_wake_deep_sleep"))) esp_wake_deep_sleep(void); + +void esp_deep_sleep(uint64_t time_in_us) +{ + esp_sleep_enable_timer_wakeup(time_in_us); + esp_deep_sleep_start(); +} + +static void IRAM_ATTR suspend_uarts(void) +{ + for (int i = 0; i < 2; ++i) { + REG_SET_BIT(UART_FLOW_CONF_REG(i), UART_FORCE_XOFF); + uart_tx_wait_idle(i); + } +} + +static void IRAM_ATTR resume_uarts(void) +{ + for (int i = 0; i < 2; ++i) { + REG_CLR_BIT(UART_FLOW_CONF_REG(i), UART_FORCE_XOFF); + REG_SET_BIT(UART_FLOW_CONF_REG(i), UART_FORCE_XON); + REG_CLR_BIT(UART_FLOW_CONF_REG(i), UART_FORCE_XON); + } +} + +static uint32_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags) +{ + // Stop UART output so that output is not lost due to APB frequency change + suspend_uarts(); + + // Save current frequency and switch to XTAL + rtc_cpu_freq_t cpu_freq = rtc_clk_cpu_freq_get(); + rtc_clk_cpu_freq_set(RTC_CPU_FREQ_XTAL); + + // Configure pins for external wakeup + if (s_config.wakeup_triggers & RTC_EXT0_TRIG_EN) { + ext0_wakeup_prepare(); + } + if (s_config.wakeup_triggers & RTC_EXT1_TRIG_EN) { + ext1_wakeup_prepare(); + } + // Enable ULP wakeup + if (s_config.wakeup_triggers & RTC_ULP_TRIG_EN) { + //TODO, esp32s2 does not have this bit + //SET_PERI_REG_MASK(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_WAKEUP_FORCE_EN); + } + + // Enter sleep + rtc_sleep_config_t config = RTC_SLEEP_CONFIG_DEFAULT(pd_flags); + rtc_sleep_init(config); + + // Configure timer wakeup + if ((s_config.wakeup_triggers & RTC_TIMER_TRIG_EN) && + s_config.sleep_duration > 0) { + timer_wakeup_prepare(); + } + uint32_t result = rtc_sleep_start(s_config.wakeup_triggers, 0,0); + + // Restore CPU frequency + rtc_clk_cpu_freq_set(cpu_freq); + + // re-enable UART output + resume_uarts(); + + return result; +} + +void IRAM_ATTR esp_deep_sleep_start(void) +{ + // record current RTC time + s_config.rtc_ticks_at_sleep_start = rtc_time_get(); + esp_sync_counters_rtc_and_frc(); + // Configure wake stub + if (esp_get_deep_sleep_wake_stub() == NULL) { + esp_set_deep_sleep_wake_stub(esp_wake_deep_sleep); + } + + // Decide which power domains can be powered down + uint32_t pd_flags = get_power_down_flags(); + + // Correct the sleep time + s_config.sleep_time_adjustment = DEEP_SLEEP_TIME_OVERHEAD_US; + + // Enter sleep + esp_sleep_start(RTC_SLEEP_PD_DIG | RTC_SLEEP_PD_VDDSDIO | pd_flags); + + // Because RTC is in a slower clock domain than the CPU, it + // can take several CPU cycles for the sleep mode to start. + while (1) { + ; + } +} + +/** + * Helper function which handles entry to and exit from light sleep + * Placed into IRAM as flash may need some time to be powered on. + */ +static esp_err_t esp_light_sleep_inner(uint32_t pd_flags, + uint32_t flash_enable_time_us, + rtc_vddsdio_config_t vddsdio_config) IRAM_ATTR __attribute__((noinline)); + +static esp_err_t esp_light_sleep_inner(uint32_t pd_flags, + uint32_t flash_enable_time_us, + rtc_vddsdio_config_t vddsdio_config) +{ + // Enter sleep + esp_err_t err = esp_sleep_start(pd_flags); + + // If VDDSDIO regulator was controlled by RTC registers before sleep, + // restore the configuration. + if (vddsdio_config.force) { + rtc_vddsdio_set_config(vddsdio_config); + } + + // If SPI flash was powered down, wait for it to become ready + if (pd_flags & RTC_SLEEP_PD_VDDSDIO) { + // Wait for the flash chip to start up + ets_delay_us(flash_enable_time_us); + } + return err; +} + +esp_err_t esp_light_sleep_start(void) +{ + static portMUX_TYPE light_sleep_lock = portMUX_INITIALIZER_UNLOCKED; + portENTER_CRITICAL(&light_sleep_lock); + /* We will be calling esp_timer_impl_advance inside DPORT access critical + * section. Make sure the code on the other CPU is not holding esp_timer + * lock, otherwise there will be deadlock. + */ + esp_timer_impl_lock(); + s_config.rtc_ticks_at_sleep_start = rtc_time_get(); + uint64_t frc_time_at_start = esp_timer_get_time(); + DPORT_STALL_OTHER_CPU_START(); + + // Decide which power domains can be powered down + uint32_t pd_flags = get_power_down_flags(); + + // Amount of time to subtract from actual sleep time. + // This is spent on entering and leaving light sleep. + s_config.sleep_time_adjustment = LIGHT_SLEEP_TIME_OVERHEAD_US; + + // Decide if VDD_SDIO needs to be powered down; + // If it needs to be powered down, adjust sleep time. + const uint32_t flash_enable_time_us = VDD_SDIO_POWERUP_TO_FLASH_READ_US; + +#ifndef CONFIG_ESP32S2_SPIRAM_SUPPORT + const uint32_t vddsdio_pd_sleep_duration = MAX(FLASH_PD_MIN_SLEEP_TIME_US, + flash_enable_time_us + LIGHT_SLEEP_TIME_OVERHEAD_US + LIGHT_SLEEP_MIN_TIME_US); + + if (s_config.sleep_duration > vddsdio_pd_sleep_duration) { + pd_flags |= RTC_SLEEP_PD_VDDSDIO; + s_config.sleep_time_adjustment += flash_enable_time_us; + } +#endif //CONFIG_ESP32S2_SPIRAM_SUPPORT + + rtc_vddsdio_config_t vddsdio_config = rtc_vddsdio_get_config(); + + // Safety net: enable WDT in case exit from light sleep fails + bool wdt_was_enabled = rtc_wdt_is_on(); // If WDT was enabled in the user code, then do not change it here. + if (!wdt_was_enabled) { + rtc_wdt_protect_off(); + rtc_wdt_disable(); + rtc_wdt_set_length_of_reset_signal(RTC_WDT_SYS_RESET_SIG, RTC_WDT_LENGTH_3_2us); + rtc_wdt_set_length_of_reset_signal(RTC_WDT_CPU_RESET_SIG, RTC_WDT_LENGTH_3_2us); + rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_RTC); + rtc_wdt_set_time(RTC_WDT_STAGE0, 1000); + rtc_wdt_enable(); + rtc_wdt_protect_on(); + } + + // Enter sleep, then wait for flash to be ready on wakeup + esp_err_t err = esp_light_sleep_inner(pd_flags, + flash_enable_time_us, vddsdio_config); + + // FRC1 has been clock gated for the duration of the sleep, correct for that. + uint64_t rtc_ticks_at_end = rtc_time_get(); + uint64_t frc_time_at_end = esp_timer_get_time(); + + uint64_t rtc_time_diff = rtc_time_slowclk_to_us(rtc_ticks_at_end - s_config.rtc_ticks_at_sleep_start, + esp_clk_slowclk_cal_get()); + uint64_t frc_time_diff = frc_time_at_end - frc_time_at_start; + + int64_t time_diff = rtc_time_diff - frc_time_diff; + /* Small negative values (up to 1 RTC_SLOW clock period) are possible, + * for very small values of sleep_duration. Ignore those to keep esp_timer + * monotonic. + */ + if (time_diff > 0) { + esp_timer_impl_advance(time_diff); + } + esp_set_time_from_rtc(); + + esp_timer_impl_unlock(); + DPORT_STALL_OTHER_CPU_END(); + if (!wdt_was_enabled) { + rtc_wdt_disable(); + } + portEXIT_CRITICAL(&light_sleep_lock); + return err; +} + +void system_deep_sleep(uint64_t) __attribute__((alias("esp_deep_sleep"))); + +esp_err_t esp_sleep_disable_wakeup_source(esp_sleep_source_t source) +{ + // For most of sources it is enough to set trigger mask in local + // configuration structure. The actual RTC wake up options + // will be updated by esp_sleep_start(). + if (CHECK_SOURCE(source, ESP_SLEEP_WAKEUP_TIMER, RTC_TIMER_TRIG_EN)) { + s_config.wakeup_triggers &= ~RTC_TIMER_TRIG_EN; + s_config.sleep_duration = 0; + } + else if (CHECK_SOURCE(source, ESP_SLEEP_WAKEUP_EXT0, RTC_EXT0_TRIG_EN)) { + s_config.ext0_rtc_gpio_num = 0; + s_config.ext0_trigger_level = 0; + s_config.wakeup_triggers &= ~RTC_EXT0_TRIG_EN; + } + else if (CHECK_SOURCE(source, ESP_SLEEP_WAKEUP_EXT1, RTC_EXT1_TRIG_EN)) { + s_config.ext1_rtc_gpio_mask = 0; + s_config.ext1_trigger_mode = 0; + s_config.wakeup_triggers &= ~RTC_EXT1_TRIG_EN; + } + else if (CHECK_SOURCE(source, ESP_SLEEP_WAKEUP_TOUCHPAD, RTC_TOUCH_TRIG_EN)) { + s_config.wakeup_triggers &= ~RTC_TOUCH_TRIG_EN; + } + else { + ESP_LOGE(TAG, "Incorrect wakeup source (%d) to disable.", (int) source); + return ESP_ERR_INVALID_STATE; + } + return ESP_OK; +} + +esp_err_t esp_sleep_enable_ulp_wakeup(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +esp_err_t esp_sleep_enable_timer_wakeup(uint64_t time_in_us) +{ + s_config.wakeup_triggers |= RTC_TIMER_TRIG_EN; + s_config.sleep_duration = time_in_us; + return ESP_OK; +} + +static void timer_wakeup_prepare(void) +{ + uint32_t period = esp_clk_slowclk_cal_get(); + int64_t sleep_duration = (int64_t) s_config.sleep_duration - (int64_t) s_config.sleep_time_adjustment; + if (sleep_duration < 0) { + sleep_duration = 0; + } + int64_t rtc_count_delta = rtc_time_us_to_slowclk(sleep_duration, period); + + rtc_sleep_set_wakeup_time(s_config.rtc_ticks_at_sleep_start + rtc_count_delta); +} + +esp_err_t esp_sleep_enable_touchpad_wakeup(void) +{ + if (s_config.wakeup_triggers & (RTC_EXT0_TRIG_EN)) { + ESP_LOGE(TAG, "Conflicting wake-up trigger: ext0"); + return ESP_ERR_INVALID_STATE; + } + s_config.wakeup_triggers |= RTC_TOUCH_TRIG_EN; + return ESP_OK; +} + +touch_pad_t esp_sleep_get_touchpad_wakeup_status(void) +{ + if (esp_sleep_get_wakeup_cause() != ESP_SLEEP_WAKEUP_TOUCHPAD) { + return TOUCH_PAD_MAX; + } + touch_pad_t pad_num; + esp_err_t ret = touch_pad_get_wakeup_status(&pad_num); + assert(ret == ESP_OK && "wakeup reason is RTC_TOUCH_TRIG_EN but SENS_TOUCH_MEAS_EN is zero"); + return pad_num; +} + +esp_err_t esp_sleep_enable_ext0_wakeup(gpio_num_t gpio_num, int level) +{ + if (level < 0 || level > 1) { + return ESP_ERR_INVALID_ARG; + } + if (!RTC_GPIO_IS_VALID_GPIO(gpio_num)) { + return ESP_ERR_INVALID_ARG; + } + if (s_config.wakeup_triggers & (RTC_TOUCH_TRIG_EN | RTC_ULP_TRIG_EN)) { + ESP_LOGE(TAG, "Conflicting wake-up triggers: touch / ULP"); + return ESP_ERR_INVALID_STATE; + } + s_config.ext0_rtc_gpio_num = gpio_num; + s_config.ext0_trigger_level = level; + s_config.wakeup_triggers |= RTC_EXT0_TRIG_EN; + return ESP_OK; +} + +static void ext0_wakeup_prepare(void) +{ + int rtc_gpio_num = s_config.ext0_rtc_gpio_num; + // Set GPIO to be used for wakeup + REG_SET_FIELD(RTC_IO_EXT_WAKEUP0_REG, RTC_IO_EXT_WAKEUP0_SEL, rtc_gpio_num); + // Set level which will trigger wakeup + SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, + s_config.ext0_trigger_level, RTC_CNTL_EXT_WAKEUP0_LV_S); + // Find GPIO descriptor in the rtc_gpio_reg table and configure the pad + for (size_t gpio_num = 0; gpio_num < GPIO_PIN_COUNT; ++gpio_num) { + if (gpio_num == rtc_gpio_num && RTC_GPIO_IS_VALID_GPIO(gpio_num)) { + rtc_gpio_reg[gpio_num]->mux_sel = 1; + rtc_gpio_reg[gpio_num]->fun_sel = 0; + rtc_gpio_reg[gpio_num]->fun_ie = 1; + break; + } + } +} + +esp_err_t esp_sleep_enable_ext1_wakeup(uint64_t mask, esp_sleep_ext1_wakeup_mode_t mode) +{ + if (mode > ESP_EXT1_WAKEUP_ANY_HIGH) { + return ESP_ERR_INVALID_ARG; + } + // Translate bit map of GPIO numbers into the bit map of RTC IO numbers + uint32_t rtc_gpio_mask = 0; + for (int gpio = 0; mask; ++gpio, mask >>= 1) { + if ((mask & 1) == 0) { + continue; + } + if (!RTC_GPIO_IS_VALID_GPIO(gpio)) { + ESP_LOGE(TAG, "Not an RTC IO: GPIO%d", gpio); + return ESP_ERR_INVALID_ARG; + } + rtc_gpio_mask |= BIT(gpio); + } + s_config.ext1_rtc_gpio_mask = rtc_gpio_mask; + s_config.ext1_trigger_mode = mode; + s_config.wakeup_triggers |= RTC_EXT1_TRIG_EN; + return ESP_OK; +} + +static void ext1_wakeup_prepare(void) +{ + // Configure all RTC IOs selected as ext1 wakeup inputs + uint32_t rtc_gpio_mask = s_config.ext1_rtc_gpio_mask; + for (int gpio = 0; gpio < GPIO_PIN_COUNT && rtc_gpio_mask != 0; ++gpio) { + if(!RTC_GPIO_IS_VALID_GPIO(gpio)) { + continue; + } + if ((rtc_gpio_mask & BIT(gpio)) == 0) { + continue; + } + // Route pad to RTC + rtc_gpio_reg[gpio]->mux_sel = 1; + rtc_gpio_reg[gpio]->fun_sel = 0; + // set input enable in sleep mode + rtc_gpio_reg[gpio]->fun_ie = 1; + // Pad configuration depends on RTC_PERIPH state in sleep mode + if (s_config.pd_options[ESP_PD_DOMAIN_RTC_PERIPH] != ESP_PD_OPTION_ON) { + // RTC_PERIPH will be powered down, so RTC_IO_ registers will + // loose their state. Lock pad configuration. + // Pullups/pulldowns also need to be disabled. + rtc_gpio_reg[gpio]->rue = 0; + rtc_gpio_reg[gpio]->rde = 0; + } + // Keep track of pins which are processed to bail out early + rtc_gpio_mask &= ~BIT(gpio); + } + // Clear state from previous wakeup + REG_SET_BIT(RTC_CNTL_EXT_WAKEUP1_REG, RTC_CNTL_EXT_WAKEUP1_STATUS_CLR); + // Set pins to be used for wakeup + REG_SET_FIELD(RTC_CNTL_EXT_WAKEUP1_REG, RTC_CNTL_EXT_WAKEUP1_SEL, s_config.ext1_rtc_gpio_mask); + // Set logic function (any low, all high) + SET_PERI_REG_BITS(RTC_CNTL_EXT_WAKEUP_CONF_REG, 0x1, + s_config.ext1_trigger_mode, RTC_CNTL_EXT_WAKEUP1_LV_S); +} + +uint64_t esp_sleep_get_ext1_wakeup_status(void) +{ + if (esp_sleep_get_wakeup_cause() != ESP_SLEEP_WAKEUP_EXT1) { + return 0; + } + uint32_t status = REG_GET_FIELD(RTC_CNTL_EXT_WAKEUP1_STATUS_REG, RTC_CNTL_EXT_WAKEUP1_STATUS); + // Translate bit map of RTC IO numbers into the bit map of GPIO numbers + uint64_t gpio_mask = 0; + for (int gpio = 0; gpio < GPIO_PIN_COUNT; ++gpio) { + if (!RTC_GPIO_IS_VALID_GPIO(gpio)) { + continue; + } + int rtc_pin = gpio; + if ((status & BIT(rtc_pin)) == 0) { + continue; + } + gpio_mask |= 1ULL << gpio; + } + return gpio_mask; +} + +esp_sleep_wakeup_cause_t esp_sleep_get_wakeup_cause(void) +{ + if (rtc_get_reset_reason(0) != DEEPSLEEP_RESET) { + return ESP_SLEEP_WAKEUP_UNDEFINED; + } + + uint32_t wakeup_cause = REG_GET_FIELD(RTC_CNTL_WAKEUP_STATE_REG, RTC_CNTL_WAKEUP_CAUSE); + if (wakeup_cause & RTC_EXT0_TRIG_EN) { + return ESP_SLEEP_WAKEUP_EXT0; + } else if (wakeup_cause & RTC_EXT1_TRIG_EN) { + return ESP_SLEEP_WAKEUP_EXT1; + } else if (wakeup_cause & RTC_TIMER_TRIG_EN) { + return ESP_SLEEP_WAKEUP_TIMER; + } else if (wakeup_cause & RTC_TOUCH_TRIG_EN) { + return ESP_SLEEP_WAKEUP_TOUCHPAD; + } else if (wakeup_cause & RTC_ULP_TRIG_EN) { + return ESP_SLEEP_WAKEUP_ULP; + } else { + return ESP_SLEEP_WAKEUP_UNDEFINED; + } +} + +esp_err_t esp_sleep_pd_config(esp_sleep_pd_domain_t domain, + esp_sleep_pd_option_t option) +{ + if (domain >= ESP_PD_DOMAIN_MAX || option > ESP_PD_OPTION_AUTO) { + return ESP_ERR_INVALID_ARG; + } + s_config.pd_options[domain] = option; + return ESP_OK; +} + +static uint32_t get_power_down_flags(void) +{ + // Where needed, convert AUTO options to ON. Later interpret AUTO as OFF. + + // RTC_SLOW_MEM is needed for the ULP, so keep RTC_SLOW_MEM powered up if ULP + // is used and RTC_SLOW_MEM is Auto. + // If there is any data placed into .rtc.data or .rtc.bss segments, and + // RTC_SLOW_MEM is Auto, keep it powered up as well. + + // These labels are defined in the linker script: + extern int _rtc_data_start, _rtc_data_end, _rtc_bss_start, _rtc_bss_end; + + if ((s_config.pd_options[ESP_PD_DOMAIN_RTC_SLOW_MEM] == ESP_PD_OPTION_AUTO) && + (&_rtc_data_end > &_rtc_data_start || &_rtc_bss_end > &_rtc_bss_start || + (s_config.wakeup_triggers & RTC_ULP_TRIG_EN))) { + s_config.pd_options[ESP_PD_DOMAIN_RTC_SLOW_MEM] = ESP_PD_OPTION_ON; + } + + // RTC_FAST_MEM is needed for deep sleep stub. + // If RTC_FAST_MEM is Auto, keep it powered on, so that deep sleep stub + // can run. + // In the new chip revision, deep sleep stub will be optional, + // and this can be changed. + if (s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM] == ESP_PD_OPTION_AUTO) { + s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM] = ESP_PD_OPTION_ON; + } + + // RTC_PERIPH is needed for EXT0 wakeup. + // If RTC_PERIPH is auto, and EXT0 isn't enabled, power down RTC_PERIPH. + if (s_config.pd_options[ESP_PD_DOMAIN_RTC_PERIPH] == ESP_PD_OPTION_AUTO) { + if (s_config.wakeup_triggers & RTC_EXT0_TRIG_EN) { + s_config.pd_options[ESP_PD_DOMAIN_RTC_PERIPH] = ESP_PD_OPTION_ON; + } else if (s_config.wakeup_triggers & (RTC_TOUCH_TRIG_EN | RTC_ULP_TRIG_EN)) { + // In both rev. 0 and rev. 1 of ESP32, forcing power up of RTC_PERIPH + // prevents ULP timer and touch FSMs from working correctly. + s_config.pd_options[ESP_PD_DOMAIN_RTC_PERIPH] = ESP_PD_OPTION_OFF; + } + } + + if (s_config.pd_options[ESP_PD_DOMAIN_XTAL] == ESP_PD_OPTION_AUTO) { + s_config.pd_options[ESP_PD_DOMAIN_XTAL] = ESP_PD_OPTION_OFF; + } + + const char* option_str[] = {"OFF", "ON", "AUTO(OFF)" /* Auto works as OFF */}; + ESP_LOGD(TAG, "RTC_PERIPH: %s, RTC_SLOW_MEM: %s, RTC_FAST_MEM: %s", + option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_PERIPH]], + option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_SLOW_MEM]], + option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM]]); + + // Prepare flags based on the selected options + uint32_t pd_flags = 0; + if (s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM] != ESP_PD_OPTION_ON) { + pd_flags |= RTC_SLEEP_PD_RTC_FAST_MEM; + } + if (s_config.pd_options[ESP_PD_DOMAIN_RTC_SLOW_MEM] != ESP_PD_OPTION_ON) { + pd_flags |= RTC_SLEEP_PD_RTC_SLOW_MEM; + } + if (s_config.pd_options[ESP_PD_DOMAIN_RTC_PERIPH] != ESP_PD_OPTION_ON) { + pd_flags |= RTC_SLEEP_PD_RTC_PERIPH; + } +// if (s_config.pd_options[ESP_PD_DOMAIN_XTAL] != ESP_PD_OPTION_ON) { +// pd_flags |= RTC_SLEEP_PD_XTAL; +// } + return pd_flags; +} diff --git a/components/esp32s2beta/spiram.c b/components/esp32s2beta/spiram.c new file mode 100644 index 0000000000..3411102d2d --- /dev/null +++ b/components/esp32s2beta/spiram.c @@ -0,0 +1,365 @@ +/* +Abstraction layer for spi-ram. For now, it's no more than a stub for the spiram_psram functions, but if +we add more types of external RAM memory, this can be made into a more intelligent dispatcher. +*/ + +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include "sdkconfig.h" +#include "esp_attr.h" +#include "esp_err.h" +#include "esp32s2beta/spiram.h" +#include "spiram_psram.h" +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/xtensa_api.h" +#include "soc/soc.h" +#include "esp_heap_caps_init.h" +#include "soc/soc_memory_layout.h" +#include "soc/dport_reg.h" +#include "esp32s2beta/rom/cache.h" + +#if CONFIG_FREERTOS_UNICORE +#define PSRAM_MODE PSRAM_VADDR_MODE_NORMAL +#else +#warning "spiram.c: TODO: no even/odd mode for ESP32S2 PSRAM?" +#if 0 +#define PSRAM_MODE PSRAM_VADDR_MODE_EVENODD +#else +#define PSRAM_MODE PSRAM_VADDR_MODE_LOWHIGH +#endif +#endif + +#if CONFIG_SPIRAM + +static const char* TAG = "spiram"; + +#if CONFIG_SPIRAM_SPEED_40M +#define PSRAM_SPEED PSRAM_CACHE_S40M +#elif CONFIG_SPIRAM_SPEED_80M +#define PSRAM_SPEED PSRAM_CACHE_S80M +#else +#define PSRAM_SPEED PSRAM_CACHE_S20M +#endif + + +static bool spiram_inited=false; + + +/* + Simple RAM test. Writes a word every 32 bytes. Takes about a second to complete for 4MiB. Returns + true when RAM seems OK, false when test fails. WARNING: Do not run this before the 2nd cpu has been + initialized (in a two-core system) or after the heap allocator has taken ownership of the memory. +*/ +bool esp_spiram_test(void) +{ + volatile int *spiram=(volatile int*)(SOC_EXTRAM_DATA_HIGH - CONFIG_SPIRAM_SIZE); + size_t p; + size_t s=CONFIG_SPIRAM_SIZE; + int errct=0; + int initial_err=-1; + + if ((SOC_EXTRAM_DATA_HIGH - SOC_EXTRAM_DATA_LOW) < CONFIG_SPIRAM_SIZE) { + ESP_EARLY_LOGW(TAG, "Only test spiram from %08x to %08x\n", SOC_EXTRAM_DATA_LOW, SOC_EXTRAM_DATA_HIGH); + spiram=(volatile int*)SOC_EXTRAM_DATA_LOW; + s = SOC_EXTRAM_DATA_HIGH - SOC_EXTRAM_DATA_LOW; + } + for (p=0; p<(s/sizeof(int)); p+=8) { + spiram[p]=p^0xAAAAAAAA; + } + for (p=0; p<(s/sizeof(int)); p+=8) { + if (spiram[p]!=(p^0xAAAAAAAA)) { + errct++; + if (errct==1) initial_err=p*4; + if (errct < 4) { + ESP_EARLY_LOGE(TAG, "SPI SRAM error@%08x:%08x/%08x \n", &spiram[p], spiram[p], p^0xAAAAAAAA); + } + } + } + if (errct) { + ESP_EARLY_LOGE(TAG, "SPI SRAM memory test fail. %d/%d writes failed, first @ %X\n", errct, s/32, initial_err+SOC_EXTRAM_DATA_LOW); + return false; + } else { + ESP_EARLY_LOGI(TAG, "SPI SRAM memory test OK"); + return true; + } +} + +#define DRAM0_ONLY_CACHE_SIZE BUS_IRAM0_CACHE_SIZE +#define DRAM0_DRAM1_CACHE_SIZE (BUS_IRAM0_CACHE_SIZE + BUS_IRAM1_CACHE_SIZE) +#define DRAM0_DRAM1_DPORT_CACHE_SIZE (BUS_IRAM0_CACHE_SIZE + BUS_IRAM1_CACHE_SIZE + BUS_DPORT_CACHE_SIZE) +#define DBUS3_ONLY_CACHE_SIZE BUS_AHB_DBUS3_CACHE_SIZE +#define DRAM0_DRAM1_DPORT_DBUS3_CACHE_SIZE (DRAM0_DRAM1_DPORT_CACHE_SIZE + DBUS3_ONLY_CACHE_SIZE) + +#define SPIRAM_SIZE_EXC_DRAM0_DRAM1_DPORT (CONFIG_SPIRAM_SIZE - DRAM0_DRAM1_DPORT_CACHE_SIZE) +#define SPIRAM_SIZE_EXC_DATA_CACHE (CONFIG_SPIRAM_SIZE - DRAM0_DRAM1_DPORT_DBUS3_CACHE_SIZE) + +#define SPIRAM_SMALL_SIZE_MAP_VADDR (DRAM0_CACHE_ADDRESS_HIGH - CONFIG_SPIRAM_SIZE) +#define SPIRAM_SMALL_SIZE_MAP_PADDR 0 +#define SPIRAM_SMALL_SIZE_MAP_SIZE CONFIG_SPIRAM_SIZE + +#define SPIRAM_MID_SIZE_MAP_VADDR (AHB_DBUS3_ADDRESS_HIGH - SPIRAM_SIZE_EXC_DRAM0_DRAM1_DPORT) +#define SPIRAM_MID_SIZE_MAP_PADDR 0 +#define SPIRAM_MID_SIZE_MAP_SIZE (SPIRAM_SIZE_EXC_DRAM0_DRAM1_DPORT) + +#define SPIRAM_BIG_SIZE_MAP_VADDR AHB_DBUS3_ADDRESS_LOW +#define SPIRAM_BIG_SIZE_MAP_PADDR (AHB_DBUS3_ADDRESS_HIGH - DRAM0_DRAM1_DPORT_DBUS3_CACHE_SIZE) +#define SPIRAM_BIG_SIZE_MAP_SIZE DBUS3_ONLY_CACHE_SIZE + +#define SPIRAM_MID_BIG_SIZE_MAP_VADDR DPORT_CACHE_ADDRESS_LOW +#define SPIRAM_MID_BIG_SIZE_MAP_PADDR SPIRAM_SIZE_EXC_DRAM0_DRAM1_DPORT +#define SPIRAM_MID_BIG_SIZE_MAP_SIZE DRAM0_DRAM1_DPORT_DBUS3_CACHE_SIZE + + +void IRAM_ATTR esp_spiram_init_cache(void) +{ + Cache_Suspend_DCache(); + /* map the address from SPIRAM end to the start, map the address in order: DRAM1, DRAM1, DPORT, DBUS3 */ +#if CONFIG_SPIRAM_SIZE <= DRAM0_ONLY_CACHE_SIZE + /* cache size <= 3MB + 576 KB, only map DRAM0 bus */ + Cache_Dbus_MMU_Set(DPORT_MMU_ACCESS_SPIRAM, SPIRAM_SMALL_SIZE_MAP_VADDR, SPIRAM_SMALL_SIZE_MAP_PADDR, 64, SPIRAM_SMALL_SIZE_MAP_SIZE >> 16, 0); + REG_SET_BIT(DPORT_CACHE_SOURCE_1_REG, DPORT_PRO_CACHE_D_SOURCE_PRO_DRAM0); + REG_CLR_BIT(DPORT_PRO_DCACHE_CTRL1_REG, DPORT_PRO_DCACHE_MASK_DRAM0); +#elif CONFIG_SPIRAM_SIZE <= DRAM0_DRAM1_CACHE_SIZE + /* cache size <= 7MB + 576KB, only map DRAM0 and DRAM1 bus */ + Cache_Dbus_MMU_Set(DPORT_MMU_ACCESS_SPIRAM, SPIRAM_SMALL_SIZE_MAP_VADDR, SPIRAM_SMALL_SIZE_MAP_PADDR, 64, SPIRAM_SMALL_SIZE_MAP_SIZE >> 16, 0); + REG_SET_BIT(DPORT_CACHE_SOURCE_1_REG, DPORT_PRO_CACHE_D_SOURCE_PRO_DRAM0); + REG_CLR_BIT(DPORT_PRO_DCACHE_CTRL1_REG, DPORT_PRO_DCACHE_MASK_DRAM1 | DPORT_PRO_DCACHE_MASK_DRAM0); +#elif CONFIG_SPIRAM_SIZE <= DRAM0_DRAM1_DPORT_CACHE_SIZE + /* cache size <= 10MB + 576KB, map DRAM0, DRAM1, DPORT bus */ + Cache_Dbus_MMU_Set(DPORT_MMU_ACCESS_SPIRAM, SPIRAM_SMALL_SIZE_MAP_VADDR, SPIRAM_SMALL_SIZE_MAP_PADDR, 64, SPIRAM_SMALL_SIZE_MAP_SIZE >> 16, 0); + REG_SET_BIT(DPORT_CACHE_SOURCE_1_REG, DPORT_PRO_CACHE_D_SOURCE_PRO_DPORT | DPORT_PRO_CACHE_D_SOURCE_PRO_DRAM0); + REG_CLR_BIT(DPORT_PRO_DCACHE_CTRL1_REG, DPORT_PRO_DCACHE_MASK_DRAM1 | DPORT_PRO_DCACHE_MASK_DRAM0 | DPORT_PRO_DCACHE_MASK_DPORT); +#else +#if CONFIG_SPIRAM_USE_AHB_DBUS3 +#if CONFIG_SPIRAM_SIZE <= DRAM0_DRAM1_DPORT_DBUS3_CACHE_SIZE + /* cache size <= 14MB + 576KB, map DRAM0, DRAM1, DPORT bus, as well as data bus3 */ + Cache_Dbus_MMU_Set(DPORT_MMU_ACCESS_SPIRAM, SPIRAM_MID_SIZE_MAP_VADDR, SPIRAM_MID_SIZE_MAP_PADDR, 64, SPIRAM_MID_SIZE_MAP_SIZE >> 16, 0); +#else + /* cache size > 14MB + 576KB, map DRAM0, DRAM1, DPORT bus, as well as data bus3 */ + Cache_Dbus_MMU_Set(DPORT_MMU_ACCESS_SPIRAM, SPIRAM_BIG_SIZE_MAP_VADDR, SPIRAM_BIG_SIZE_MAP_PADDR, 64, SPIRAM_BIG_SIZE_MAP_SIZE >> 16, 0); +#endif + Cache_Dbus_MMU_Set(DPORT_MMU_ACCESS_SPIRAM, SPIRAM_MID_BIG_SIZE_MAP_VADDR, SPIRAM_MID_BIG_SIZE_MAP_PADDR, 64, SPIRAM_MID_BIG_SIZE_MAP_SIZE >> 16, 0); + REG_SET_BIT(DPORT_CACHE_SOURCE_1_REG, DPORT_PRO_CACHE_D_SOURCE_PRO_DPORT | DPORT_PRO_CACHE_D_SOURCE_PRO_DRAM0); + REG_CLR_BIT(DPORT_CACHE_SOURCE_1_REG, DPORT_PRO_CACHE_D_SOURCE_PRO_DROM0); + REG_CLR_BIT(DPORT_PRO_DCACHE_CTRL1_REG, DPORT_PRO_DCACHE_MASK_DRAM1 | DPORT_PRO_DCACHE_MASK_DRAM0 | DPORT_PRO_DCACHE_MASK_DPORT | DPORT_PRO_DCACHE_MASK_BUS3); +#else + /* cache size > 10MB + 576KB, map DRAM0, DRAM1, DPORT bus , only remap 0x3f500000 ~ 0x3ff90000*/ + Cache_Dbus_MMU_Set(DPORT_MMU_ACCESS_SPIRAM, SPIRAM_MID_BIG_SIZE_MAP_VADDR, SPIRAM_MID_BIG_SIZE_MAP_PADDR, 64, SPIRAM_MID_BIG_SIZE_MAP_SIZE >> 16, 0); + REG_SET_BIT(DPORT_CACHE_SOURCE_1_REG, DPORT_PRO_CACHE_D_SOURCE_PRO_DPORT | DPORT_PRO_CACHE_D_SOURCE_PRO_DRAM0); + REG_CLR_BIT(DPORT_PRO_DCACHE_CTRL1_REG, DPORT_PRO_DCACHE_MASK_DRAM1 | DPORT_PRO_DCACHE_MASK_DRAM0 | DPORT_PRO_DCACHE_MASK_DPORT); +#endif +#endif +} + +static uint32_t pages_for_flash = 0; +static uint32_t page0_mapped = 0; +static uint32_t page0_page = 0xffff; +static uint32_t instrcution_in_spiram = 0; +static uint32_t rodata_in_spiram = 0; + +uint32_t esp_spiram_instruction_access_enabled(void) +{ + return instrcution_in_spiram; +} + +uint32_t esp_spiram_rodata_access_enabled(void) +{ + return rodata_in_spiram; +} + +esp_err_t esp_spiram_enable_instruction_access(void) +{ + uint32_t pages_in_flash = 0; + pages_in_flash += Cache_Count_Flash_Pages(PRO_CACHE_IBUS0, &page0_mapped); + pages_in_flash += Cache_Count_Flash_Pages(PRO_CACHE_IBUS1, &page0_mapped); + pages_in_flash += Cache_Count_Flash_Pages(PRO_CACHE_IBUS2, &page0_mapped); + if ((pages_in_flash + pages_for_flash) > (CONFIG_SPIRAM_SIZE >> 16)) { + ESP_EARLY_LOGE(TAG, "SPI RAM space not enough for the instructions, has %d pages, need %d pages.", (CONFIG_SPIRAM_SIZE >> 16), (pages_in_flash + pages_for_flash)); + return ESP_FAIL; + } + ESP_EARLY_LOGI(TAG, "Instructions copied and mapped to SPIRAM"); + pages_for_flash = Cache_Flash_To_SPIRAM_Copy(PRO_CACHE_IBUS0, IRAM0_ADDRESS_LOW, pages_for_flash, &page0_page); + pages_for_flash = Cache_Flash_To_SPIRAM_Copy(PRO_CACHE_IBUS1, IRAM1_ADDRESS_LOW, pages_for_flash, &page0_page); + pages_for_flash = Cache_Flash_To_SPIRAM_Copy(PRO_CACHE_IBUS2, IROM0_ADDRESS_LOW, pages_for_flash, &page0_page); + instrcution_in_spiram = 1; + return ESP_OK; +} + +esp_err_t esp_spiram_enable_rodata_access(void) +{ + uint32_t pages_in_flash = 0; + if (Cache_Drom0_Using_ICache()) { + pages_in_flash += Cache_Count_Flash_Pages(PRO_CACHE_IBUS3, &page0_mapped); + } else { + pages_in_flash += Cache_Count_Flash_Pages(PRO_CACHE_DBUS3, &page0_mapped); + } + pages_in_flash += Cache_Count_Flash_Pages(PRO_CACHE_DBUS0, &page0_mapped); + pages_in_flash += Cache_Count_Flash_Pages(PRO_CACHE_DBUS1, &page0_mapped); + pages_in_flash += Cache_Count_Flash_Pages(PRO_CACHE_DBUS2, &page0_mapped); + + if ((pages_in_flash + pages_for_flash) > (CONFIG_SPIRAM_SIZE >> 16)) { + ESP_EARLY_LOGE(TAG, "SPI RAM space not enough for the read only data."); + return ESP_FAIL; + } + + ESP_EARLY_LOGI(TAG, "Read only data copied and mapped to SPIRAM"); + if (Cache_Drom0_Using_ICache()) { + pages_for_flash = Cache_Flash_To_SPIRAM_Copy(PRO_CACHE_IBUS3, DROM0_ADDRESS_LOW, pages_for_flash, &page0_page); + } else { + pages_for_flash = Cache_Flash_To_SPIRAM_Copy(PRO_CACHE_DBUS3, DROM0_ADDRESS_LOW, pages_for_flash, &page0_page); + } + pages_for_flash = Cache_Flash_To_SPIRAM_Copy(PRO_CACHE_DBUS0, DRAM0_ADDRESS_LOW, pages_for_flash, &page0_page); + pages_for_flash = Cache_Flash_To_SPIRAM_Copy(PRO_CACHE_DBUS1, DRAM1_ADDRESS_LOW, pages_for_flash, &page0_page); + pages_for_flash = Cache_Flash_To_SPIRAM_Copy(PRO_CACHE_DBUS2, DPORT_ADDRESS_LOW, pages_for_flash, &page0_page); + rodata_in_spiram = 1; + return ESP_OK; +} + +esp_err_t esp_spiram_init(void) +{ + esp_err_t r; + r = psram_enable(PSRAM_SPEED, PSRAM_MODE); + if (r != ESP_OK) { +#if CONFIG_SPIRAM_IGNORE_NOTFOUND + ESP_EARLY_LOGE(TAG, "SPI RAM enabled but initialization failed. Bailing out."); +#endif + return r; + } + + ESP_EARLY_LOGI(TAG, "SPI RAM mode: %s", PSRAM_SPEED == PSRAM_CACHE_S40M ? "sram 40m" : \ + PSRAM_SPEED == PSRAM_CACHE_S80M ? "sram 80m" : "sram 20m"); + ESP_EARLY_LOGI(TAG, "PSRAM initialized, cache is in %s mode.", \ + (PSRAM_MODE==PSRAM_VADDR_MODE_EVENODD)?"even/odd (2-core)": \ + (PSRAM_MODE==PSRAM_VADDR_MODE_LOWHIGH)?"low/high (2-core)": \ + (PSRAM_MODE==PSRAM_VADDR_MODE_NORMAL)?"normal (1-core)":"ERROR"); + spiram_inited=true; + return ESP_OK; +} + + +esp_err_t esp_spiram_add_to_heapalloc(void) +{ + uint32_t size_for_flash = (pages_for_flash << 16); + ESP_EARLY_LOGI(TAG, "Adding pool of %dK of external SPI memory to heap allocator", (CONFIG_SPIRAM_SIZE - (pages_for_flash << 16))/1024); + //Add entire external RAM region to heap allocator. Heap allocator knows the capabilities of this type of memory, so there's + //no need to explicitly specify them. + +#if CONFIG_SPIRAM_SIZE <= DRAM0_DRAM1_DPORT_CACHE_SIZE + /* cache size <= 10MB + 576KB, map DRAM0, DRAM1, DPORT bus */ + return heap_caps_add_region((intptr_t)SPIRAM_SMALL_SIZE_MAP_VADDR + size_for_flash, (intptr_t)SPIRAM_SMALL_SIZE_MAP_VADDR + SPIRAM_SMALL_SIZE_MAP_SIZE -1); +#else +#if CONFIG_SPIRAM_USE_AHB_DBUS3 +#if CONFIG_SPIRAM_SIZE <= DRAM0_DRAM1_DPORT_DBUS3_CACHE_SIZE + /* cache size <= 14MB + 576KB, map DRAM0, DRAM1, DPORT bus, as well as data bus3 */ + if (size_for_flash <= SPIRAM_MID_SIZE_MAP_SIZE) { + esp_err_t err = heap_caps_add_region((intptr_t)SPIRAM_MID_SIZE_MAP_VADDR + size_for_flash, (intptr_t)SPIRAM_MID_SIZE_MAP_VADDR + SPIRAM_MID_SIZE_MAP_SIZE -1); + if (err) { + return err; + } + return heap_caps_add_region((intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR, (intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR + SPIRAM_MID_BIG_SIZE_MAP_SIZE -1); + } else { + return heap_caps_add_region((intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR + size_for_flash - SPIRAM_MID_SIZE_MAP_SIZE, (intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR + SPIRAM_MID_BIG_SIZE_MAP_SIZE -1); + } +#else + if (size_for_flash <= SPIRAM_SIZE_EXC_DATA_CACHE) { + esp_err_t err = heap_caps_add_region((intptr_t)SPIRAM_BIG_SIZE_MAP_VADDR, (intptr_t)SPIRAM_BIG_SIZE_MAP_VADDR + SPIRAM_BIG_SIZE_MAP_SIZE -1); + if (err) { + return err; + } + return heap_caps_add_region((intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR, (intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR + SPIRAM_MID_BIG_SIZE_MAP_SIZE -1); + } else if (size_for_flash <= SPIRAM_SIZE_EXC_DRAM0_DRAM1_DPORT) { + esp_err_t err = heap_caps_add_region((intptr_t)SPIRAM_BIG_SIZE_MAP_VADDR + size_for_flash - SPIRAM_SIZE_EXC_DATA_CACHE, (intptr_t)SPIRAM_MID_SIZE_MAP_VADDR + SPIRAM_MID_SIZE_MAP_SIZE -1); + if (err) { + return err; + } + return heap_caps_add_region((intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR, (intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR + SPIRAM_MID_BIG_SIZE_MAP_SIZE -1); + } else { + return heap_caps_add_region((intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR + size_for_flash - SPIRAM_SIZE_EXC_DRAM0_DRAM1_DPORT, (intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR + SPIRAM_MID_BIG_SIZE_MAP_SIZE -1); + } +#endif +#else + Cache_Dbus_MMU_Set(DPORT_MMU_ACCESS_SPIRAM, SPIRAM_MID_BIG_SIZE_MAP_VADDR, SPIRAM_MID_BIG_SIZE_MAP_PADDR, 64, SPIRAM_MID_BIG_SIZE_MAP_SIZE >> 16, 0); + if (size_for_flash <= SPIRAM_SIZE_EXC_DRAM0_DRAM1_DPORT) { + return heap_caps_add_region((intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR, (intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR + SPIRAM_MID_BIG_SIZE_MAP_SIZE -1); + } else { + return heap_caps_add_region((intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR + size_for_flash, (intptr_t)SPIRAM_MID_BIG_SIZE_MAP_VADDR + SPIRAM_MID_BIG_SIZE_MAP_SIZE -1); + } +#endif +#endif +} + + +static uint8_t *dma_heap; + +esp_err_t esp_spiram_reserve_dma_pool(size_t size) { + if (size==0) return ESP_OK; //no-op + ESP_EARLY_LOGI(TAG, "Reserving pool of %dK of internal memory for DMA/internal allocations", size/1024); + dma_heap=heap_caps_malloc(size, MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); + if (!dma_heap) return ESP_ERR_NO_MEM; + uint32_t caps[]={MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL, 0, MALLOC_CAP_8BIT|MALLOC_CAP_32BIT}; + return heap_caps_add_region_with_caps(caps, (intptr_t) dma_heap, (intptr_t) dma_heap+size-1); +} + +size_t esp_spiram_get_size(void) +{ + return CONFIG_SPIRAM_SIZE; +} + +/* + Before flushing the cache, if psram is enabled as a memory-mapped thing, we need to write back the data in the cache to the psram first, + otherwise it will get lost. For now, we just read 64/128K of random PSRAM memory to do this. +*/ +void IRAM_ATTR esp_spiram_writeback_cache(void) +{ + extern void Cache_WriteBack_All(void); + int cache_was_disabled=0; + + if (!spiram_inited) return; + + //We need cache enabled for this to work. Re-enable it if needed; make sure we + //disable it again on exit as well. + if (DPORT_REG_GET_BIT(DPORT_PRO_DCACHE_CTRL_REG, DPORT_PRO_DCACHE_ENABLE)==0) { + cache_was_disabled|=(1<<0); + DPORT_SET_PERI_REG_BITS(DPORT_PRO_DCACHE_CTRL_REG, 1, 1, DPORT_PRO_DCACHE_ENABLE_S); + } + +#ifndef CONFIG_FREERTOS_UNICORE + if (DPORT_REG_GET_BIT(DPORT_APP_CACHE_CTRL_REG, DPORT_APP_CACHE_ENABLE)==0) { + cache_was_disabled|=(1<<1); + DPORT_SET_PERI_REG_BITS(DPORT_APP_CACHE_CTRL_REG, 1, 1, DPORT_APP_CACHE_ENABLE_S); + } +#endif + + Cache_WriteBack_All(); + + if (cache_was_disabled&(1<<0)) { +#ifdef DPORT_CODE_COMPLETE + while (DPORT_GET_PERI_REG_BITS2(DPORT_PRO_DCACHE_DBUG2_REG, DPORT_PRO_CACHE_STATE, DPORT_PRO_CACHE_STATE_S) != 1) ; +#endif + DPORT_SET_PERI_REG_BITS(DPORT_PRO_DCACHE_CTRL_REG, 1, 0, DPORT_PRO_DCACHE_ENABLE_S); + } +#ifndef CONFIG_FREERTOS_UNICORE + if (cache_was_disabled&(1<<1)) { + while (DPORT_GET_PERI_REG_BITS2(DPORT_APP_DCACHE_DBUG2_REG, DPORT_APP_CACHE_STATE, DPORT_APP_CACHE_STATE_S) != 1) ; + DPORT_SET_PERI_REG_BITS(DPORT_APP_CACHE_CTRL_REG, 1, 0, DPORT_APP_CACHE_ENABLE_S); + } +#endif +} + +#endif diff --git a/components/esp32s2beta/spiram_psram.c b/components/esp32s2beta/spiram_psram.c new file mode 100644 index 0000000000..ae3af8f0c4 --- /dev/null +++ b/components/esp32s2beta/spiram_psram.c @@ -0,0 +1,889 @@ +/* + Driver bits for PSRAM chips (at the moment only the ESP-PSRAM32 chip). +*/ + +// Copyright 2013-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + + +#include "sdkconfig.h" +#include "string.h" +#include "esp_attr.h" +#include "esp_err.h" +#include "esp_types.h" +#include "esp_log.h" +#include "spiram_psram.h" +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/spi_flash.h" +#include "esp32s2beta/rom/gpio.h" +#include "esp32s2beta/rom/cache.h" +#include "soc/io_mux_reg.h" +#include "soc/dport_reg.h" +#include "soc/apb_ctrl_reg.h" +#include "soc/gpio_sig_map.h" +#include "soc/efuse_reg.h" +#include "driver/gpio.h" +#include "driver/spi_common.h" +#include "driver/periph_ctrl.h" + +#if CONFIG_SPIRAM +#include "soc/rtc.h" + +//Commands for PSRAM chip +#define PSRAM_READ 0x03 +#define PSRAM_FAST_READ 0x0B +#define PSRAM_FAST_READ_DUMMY 0x3 +#define PSRAM_FAST_READ_QUAD 0xEB +#define PSRAM_FAST_READ_QUAD_DUMMY 0x5 +#define PSRAM_WRITE 0x02 +#define PSRAM_QUAD_WRITE 0x38 +#define PSRAM_ENTER_QMODE 0x35 +#define PSRAM_EXIT_QMODE 0xF5 +#define PSRAM_RESET_EN 0x66 +#define PSRAM_RESET 0x99 +#define PSRAM_SET_BURST_LEN 0xC0 +#define PSRAM_DEVICE_ID 0x9F + +typedef enum { + PSRAM_CLK_MODE_NORM = 0, /*!< Normal SPI mode */ + PSRAM_CLK_MODE_DCLK = 1, /*!< Two extra clock cycles after CS is set high level */ +} psram_clk_mode_t; + +#define PSRAM_ID_KGD_M 0xff +#define PSRAM_ID_KGD_S 8 +#define PSRAM_ID_KGD 0x5d +#define PSRAM_ID_EID_M 0xff +#define PSRAM_ID_EID_S 16 + +#define PSRAM_KGD(id) (((id) >> PSRAM_ID_KGD_S) & PSRAM_ID_KGD_M) +#define PSRAM_EID(id) (((id) >> PSRAM_ID_EID_S) & PSRAM_ID_EID_M) +#define PSRAM_IS_VALID(id) (PSRAM_KGD(id) == PSRAM_ID_KGD) + +// PSRAM_EID = 0x26 or 0x4x ----> 64MBit psram +// PSRAM_EID = 0x20 ------------> 32MBit psram +#define PSRAM_IS_64MBIT(id) ((PSRAM_EID(id) == 0x26) || ((PSRAM_EID(id) & 0xf0) == 0x40)) +#define PSRAM_IS_32MBIT_VER0(id) (PSRAM_EID(id) == 0x20) + +// IO-pins for PSRAM. These need to be in the VDD_SIO power domain because all chips we +// currently support are 1.8V parts. +// WARNING: PSRAM shares all but the CS and CLK pins with the flash, so these defines +// hardcode the flash pins as well, making this code incompatible with either a setup +// that has the flash on non-standard pins or ESP32s with built-in flash. +#define FLASH_CLK_IO SPI_CLK_GPIO_NUM //Psram clock is a delayed version of this in 40MHz mode +#define FLASH_CS_IO SPI_CS0_GPIO_NUM +#define PSRAM_CS_IO 26 +#define PSRAM_SPIQ_IO SPI_Q_GPIO_NUM +#define PSRAM_SPID_IO SPI_D_GPIO_NUM +#define PSRAM_SPIWP_IO SPI_WP_GPIO_NUM +#define PSRAM_SPIHD_IO SPI_HD_GPIO_NUM +#define PSRAM_INTERNAL_IO_28 28 +#define PSRAM_INTERNAL_IO_29 29 +#define PSRAM_IO_MATRIX_DUMMY_20M 0 +#define PSRAM_IO_MATRIX_DUMMY_40M 0 +#define PSRAM_IO_MATRIX_DUMMY_80M 0 + +#define _SPI_CACHE_PORT 0 +#define _SPI_FLASH_PORT 1 +#define _SPI_80M_CLK_DIV 1 +#define _SPI_40M_CLK_DIV 2 +#define _SPI_20M_CLK_DIV 4 + +static const char* TAG = "psram"; +typedef enum { + PSRAM_SPI_1 = 0x1, + PSRAM_SPI_2, + PSRAM_SPI_3, + PSRAM_SPI_MAX , +} psram_spi_num_t; + +static psram_cache_mode_t s_psram_mode = PSRAM_CACHE_MAX; +static psram_clk_mode_t s_clk_mode = PSRAM_CLK_MODE_DCLK; +static uint32_t s_psram_id = 0; + +/* dummy_len_plus values defined in ROM for SPI flash configuration */ +extern uint8_t g_rom_spiflash_dummy_len_plus[]; +static int extra_dummy = 0; +typedef enum { + PSRAM_CMD_QPI, + PSRAM_CMD_SPI, +} psram_cmd_mode_t; + +typedef struct { + uint16_t cmd; /*!< Command value */ + uint16_t cmdBitLen; /*!< Command byte length*/ + uint32_t *addr; /*!< Point to address value*/ + uint16_t addrBitLen; /*!< Address byte length*/ + uint32_t *txData; /*!< Point to send data buffer*/ + uint16_t txDataBitLen; /*!< Send data byte length.*/ + uint32_t *rxData; /*!< Point to recevie data buffer*/ + uint16_t rxDataBitLen; /*!< Recevie Data byte length.*/ + uint32_t dummyBitLen; +} psram_cmd_t; + +static void IRAM_ATTR psram_cache_init(psram_cache_mode_t psram_cache_mode, psram_vaddr_mode_t vaddrmode); + +static void psram_clear_spi_fifo(psram_spi_num_t spi_num) +{ + int i; + for (i = 0; i < 16; i++) { + WRITE_PERI_REG(SPI_MEM_W0_REG(spi_num)+i*4, 0); + } +} + +//set basic SPI write mode +static void psram_set_basic_write_mode(psram_spi_num_t spi_num) +{ + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_FWRITE_QIO); + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FCMD_QUAD_M); + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_FWRITE_DIO); + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_FWRITE_QUAD); + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_FWRITE_DUAL); +} +//set QPI write mode +static void psram_set_qio_write_mode(psram_spi_num_t spi_num) +{ + SET_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_FWRITE_QIO); + SET_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FCMD_QUAD_M); + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_FWRITE_DIO); + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_FWRITE_QUAD); + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_FWRITE_DUAL); +} +//set QPI read mode +static void psram_set_qio_read_mode(psram_spi_num_t spi_num) +{ + SET_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FREAD_QIO); + SET_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FCMD_QUAD_M); + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FREAD_QUAD); + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FREAD_DUAL); + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FREAD_DIO); +} +//set SPI read mode +static void psram_set_basic_read_mode(psram_spi_num_t spi_num) +{ + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FREAD_QIO); + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FCMD_QUAD_M); + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FREAD_QUAD); + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FREAD_DUAL); + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_FREAD_DIO); +} + + +//start sending cmd/addr and optionally, receiving data +static void IRAM_ATTR psram_cmd_recv_start(psram_spi_num_t spi_num, uint32_t* pRxData, uint16_t rxByteLen, + psram_cmd_mode_t cmd_mode) +{ + //get cs1 + CLEAR_PERI_REG_MASK(SPI_MEM_MISC_REG(PSRAM_SPI_1), SPI_MEM_CS1_DIS_M); + SET_PERI_REG_MASK(SPI_MEM_MISC_REG(PSRAM_SPI_1), SPI_MEM_CS0_DIS_M); + + uint32_t mode_backup = (READ_PERI_REG(SPI_MEM_USER_REG(spi_num)) >> SPI_MEM_FWRITE_DUAL_S) & 0xf; +#ifdef FAKE_QPI + uint32_t rd_mode_backup = READ_PERI_REG(SPI_MEM_CTRL_REG(spi_num)) & (SPI_MEM_FREAD_DIO_M | SPI_MEM_FREAD_DUAL_M | SPI_MEM_FREAD_QUAD_M | SPI_MEM_FREAD_QIO_M); +#else + uint32_t rd_mode_backup = READ_PERI_REG(SPI_MEM_CTRL_REG(spi_num)) & (SPI_MEM_FREAD_DIO_M | SPI_MEM_FREAD_DUAL_M | SPI_MEM_FREAD_QUAD_M | SPI_MEM_FREAD_QIO_M | SPI_MEM_FCMD_QUAD); +#endif + if (cmd_mode == PSRAM_CMD_SPI) { + psram_set_basic_write_mode(spi_num); + psram_set_basic_read_mode(spi_num); + } else if (cmd_mode == PSRAM_CMD_QPI) { + psram_set_qio_write_mode(spi_num); + psram_set_qio_read_mode(spi_num); + } + + // Start send data + SET_PERI_REG_MASK(SPI_MEM_CMD_REG(spi_num), SPI_MEM_USR); + while ((READ_PERI_REG(SPI_MEM_CMD_REG(spi_num)) & SPI_MEM_USR)); + + //recover spi mode + SET_PERI_REG_BITS(SPI_MEM_USER_REG(spi_num), (pRxData?SPI_MEM_FWRITE_DUAL_M:0xf), mode_backup, SPI_MEM_FWRITE_DUAL_S); +#ifdef FAKE_QPI + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), (SPI_MEM_FREAD_DIO_M|SPI_MEM_FREAD_DUAL_M|SPI_MEM_FREAD_QUAD_M|SPI_MEM_FREAD_QIO_M)); +#else + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), (SPI_MEM_FREAD_DIO_M|SPI_MEM_FREAD_DUAL_M|SPI_MEM_FREAD_QUAD_M|SPI_MEM_FREAD_QIO_M|SPI_MEM_FCMD_QUAD)); +#endif + SET_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), rd_mode_backup); + + //return cs to cs0 + SET_PERI_REG_MASK(SPI_MEM_MISC_REG(PSRAM_SPI_1), SPI_MEM_CS1_DIS_M); + CLEAR_PERI_REG_MASK(SPI_MEM_MISC_REG(PSRAM_SPI_1), SPI_MEM_CS0_DIS_M); + + if (pRxData) { + int idx = 0; + // Read data out + do { + *pRxData++ = READ_PERI_REG(SPI_MEM_W0_REG(spi_num) + (idx << 2)); + } while (++idx < ((rxByteLen / 4) + ((rxByteLen % 4) ? 1 : 0))); + } +} + +static uint32_t backup_usr[3]; +static uint32_t backup_usr1[3]; +static uint32_t backup_usr2[3]; + + + +//setup spi command/addr/data/dummy in user mode +static int psram_cmd_config(psram_spi_num_t spi_num, psram_cmd_t* pInData) +{ + while (READ_PERI_REG(SPI_MEM_CMD_REG(spi_num)) & SPI_MEM_USR); + backup_usr[spi_num]=READ_PERI_REG(SPI_MEM_USER_REG(spi_num)); + backup_usr1[spi_num]=READ_PERI_REG(SPI_MEM_USER1_REG(spi_num)); + backup_usr2[spi_num]=READ_PERI_REG(SPI_MEM_USER2_REG(spi_num)); + // Set command by user. + if (pInData->cmdBitLen != 0) { + // Max command length 16 bits. + SET_PERI_REG_BITS(SPI_MEM_USER2_REG(spi_num), SPI_MEM_USR_COMMAND_BITLEN, pInData->cmdBitLen - 1, + SPI_MEM_USR_COMMAND_BITLEN_S); + // Enable command + SET_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_USR_COMMAND); + // Load command,bit15-0 is cmd value. + SET_PERI_REG_BITS(SPI_MEM_USER2_REG(spi_num), SPI_MEM_USR_COMMAND_VALUE, pInData->cmd, SPI_MEM_USR_COMMAND_VALUE_S); + } else { + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_USR_COMMAND); + SET_PERI_REG_BITS(SPI_MEM_USER2_REG(spi_num), SPI_MEM_USR_COMMAND_BITLEN, 0, SPI_MEM_USR_COMMAND_BITLEN_S); + } + // Set Address by user. + if (pInData->addrBitLen != 0) { + SET_PERI_REG_BITS(SPI_MEM_USER1_REG(spi_num), SPI_MEM_USR_ADDR_BITLEN, (pInData->addrBitLen - 1), SPI_MEM_USR_ADDR_BITLEN_S); + // Enable address + SET_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_USR_ADDR); + // Set address + WRITE_PERI_REG(SPI_MEM_ADDR_REG(spi_num), *pInData->addr); + } else { + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_USR_ADDR); + SET_PERI_REG_BITS(SPI_MEM_USER1_REG(spi_num), SPI_MEM_USR_ADDR_BITLEN, 0, SPI_MEM_USR_ADDR_BITLEN_S); + } + // Set data by user. + uint32_t* p_tx_val = pInData->txData; + if (pInData->txDataBitLen != 0) { + // Enable MOSI + SET_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_USR_MOSI); + // Load send buffer + int len = (pInData->txDataBitLen + 31) / 32; + if (p_tx_val != NULL) { + memcpy((void*)SPI_MEM_W0_REG(spi_num), p_tx_val, len * 4); + } + // Set data send buffer length.Max data length 64 bytes. + SET_PERI_REG_BITS(SPI_MEM_MOSI_DLEN_REG(spi_num), SPI_MEM_USR_MOSI_DBITLEN, (pInData->txDataBitLen - 1), + SPI_MEM_USR_MOSI_DBITLEN_S); + } else { + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_USR_MOSI); + SET_PERI_REG_BITS(SPI_MEM_MOSI_DLEN_REG(spi_num), SPI_MEM_USR_MOSI_DBITLEN, 0, SPI_MEM_USR_MOSI_DBITLEN_S); + } + // Set rx data by user. + if (pInData->rxDataBitLen != 0) { + // Enable MOSI + SET_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_USR_MISO); + // Set data send buffer length.Max data length 64 bytes. + SET_PERI_REG_BITS(SPI_MEM_MISO_DLEN_REG(spi_num), SPI_MEM_USR_MISO_DBITLEN, (pInData->rxDataBitLen - 1), + SPI_MEM_USR_MISO_DBITLEN_S); + } else { + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_USR_MISO); + SET_PERI_REG_BITS(SPI_MEM_MISO_DLEN_REG(spi_num), SPI_MEM_USR_MISO_DBITLEN, 0, SPI_MEM_USR_MISO_DBITLEN_S); + } + if (pInData->dummyBitLen != 0) { + SET_PERI_REG_MASK(SPI_MEM_USER_REG(PSRAM_SPI_1), SPI_MEM_USR_DUMMY); // dummy en + SET_PERI_REG_BITS(SPI_MEM_USER1_REG(PSRAM_SPI_1), SPI_MEM_USR_DUMMY_CYCLELEN_V, pInData->dummyBitLen - 1, + SPI_MEM_USR_DUMMY_CYCLELEN_S); //DUMMY + } else { + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(PSRAM_SPI_1), SPI_MEM_USR_DUMMY); // dummy en + SET_PERI_REG_BITS(SPI_MEM_USER1_REG(PSRAM_SPI_1), SPI_MEM_USR_DUMMY_CYCLELEN_V, 0, SPI_MEM_USR_DUMMY_CYCLELEN_S); //DUMMY + } + return 0; +} + +void psram_cmd_end(int spi_num) { + while (READ_PERI_REG(SPI_MEM_CMD_REG(spi_num)) & SPI_MEM_USR); + WRITE_PERI_REG(SPI_MEM_USER_REG(spi_num), backup_usr[spi_num]); + WRITE_PERI_REG(SPI_MEM_USER1_REG(spi_num), backup_usr1[spi_num]); + WRITE_PERI_REG(SPI_MEM_USER2_REG(spi_num), backup_usr2[spi_num]); +} + +#ifdef FAKE_QPI +//exit QPI mode(set back to SPI mode) +static void psram_disable_qio_mode(psram_spi_num_t spi_num) +{ + psram_cmd_t ps_cmd; + uint32_t cmd_exit_qpi; + cmd_exit_qpi = PSRAM_EXIT_QMODE; + ps_cmd.txDataBitLen = 8; + if (s_clk_mode == PSRAM_CLK_MODE_DCLK) { + switch (s_psram_mode) { + case PSRAM_CACHE_S80M: + break; + case PSRAM_CACHE_S40M: + default: + cmd_exit_qpi = PSRAM_EXIT_QMODE << 8; + ps_cmd.txDataBitLen = 16; + break; + } + } + ps_cmd.txData = &cmd_exit_qpi; + ps_cmd.cmd = 0; + ps_cmd.cmdBitLen = 0; + ps_cmd.addr = 0; + ps_cmd.addrBitLen = 0; + ps_cmd.rxData = NULL; + ps_cmd.rxDataBitLen = 0; + ps_cmd.dummyBitLen = 0; + psram_cmd_config(spi_num, &ps_cmd); + psram_cmd_recv_start(spi_num, NULL, 0, PSRAM_CMD_QPI); + psram_cmd_end(spi_num); +} + +//read psram id +static void psram_read_id(uint32_t* dev_id) +{ + psram_spi_num_t spi_num = PSRAM_SPI_1; + psram_disable_qio_mode(spi_num); + uint32_t dummy_bits = 0 + extra_dummy; + psram_cmd_t ps_cmd; + + uint32_t addr = 0; + ps_cmd.addrBitLen = 3 * 8; + ps_cmd.cmd = PSRAM_DEVICE_ID; + ps_cmd.cmdBitLen = 8; + if (s_clk_mode == PSRAM_CLK_MODE_DCLK) { + switch (s_psram_mode) { + case PSRAM_CACHE_S80M: + break; + case PSRAM_CACHE_S40M: + default: + ps_cmd.cmdBitLen = 2; //this two bits is used to delay 2 clock cycle + ps_cmd.cmd = 0; + addr = (PSRAM_DEVICE_ID << 24) | 0; + ps_cmd.addrBitLen = 4 * 8; + break; + } + } + ps_cmd.addr = &addr; + ps_cmd.txDataBitLen = 0; + ps_cmd.txData = NULL; + ps_cmd.rxDataBitLen = 4 * 8; + ps_cmd.rxData = dev_id; + ps_cmd.dummyBitLen = dummy_bits; + + psram_cmd_config(spi_num, &ps_cmd); + psram_clear_spi_fifo(spi_num); + psram_cmd_recv_start(spi_num, ps_cmd.rxData, ps_cmd.rxDataBitLen / 8, PSRAM_CMD_SPI); + psram_cmd_end(spi_num); +} + +//enter QPI mode +static esp_err_t IRAM_ATTR psram_enable_qio_mode(psram_spi_num_t spi_num) +{ + psram_cmd_t ps_cmd; + uint32_t addr = (PSRAM_ENTER_QMODE << 24) | 0; + + ps_cmd.cmdBitLen = 0; + if (s_clk_mode == PSRAM_CLK_MODE_DCLK) { + switch (s_psram_mode) { + case PSRAM_CACHE_S80M: + break; + case PSRAM_CACHE_S40M: + default: + ps_cmd.cmdBitLen = 2; + break; + } + } + ps_cmd.cmd = 0; + ps_cmd.addr = &addr; + ps_cmd.addrBitLen = 8; + ps_cmd.txData = NULL; + ps_cmd.txDataBitLen = 0; + ps_cmd.rxData = NULL; + ps_cmd.rxDataBitLen = 0; + ps_cmd.dummyBitLen = 0; + psram_cmd_config(spi_num, &ps_cmd); + psram_cmd_recv_start(spi_num, NULL, 0, PSRAM_CMD_SPI); + psram_cmd_end(spi_num); + return ESP_OK; +} +#else /* FAKE_QPI */ +//exit QPI mode(set back to SPI mode) +static void psram_disable_qio_mode(psram_spi_num_t spi_num) +{ + psram_cmd_t ps_cmd; + ps_cmd.txData = NULL; + ps_cmd.txDataBitLen = 0; + ps_cmd.cmd = PSRAM_EXIT_QMODE; + ps_cmd.cmdBitLen = 8; + ps_cmd.addr = 0; + ps_cmd.addrBitLen = 0; + ps_cmd.rxData = NULL; + ps_cmd.rxDataBitLen = 0; + ps_cmd.dummyBitLen = 0; + psram_cmd_config(spi_num, &ps_cmd); + psram_cmd_recv_start(spi_num, NULL, 0, PSRAM_CMD_QPI); + psram_cmd_end(spi_num); +} + + +//switch psram burst length(32 bytes or 1024 bytes) +//datasheet says it should be 1024 bytes by default +static void psram_set_wrap_burst_length(psram_spi_num_t spi_num, psram_cmd_mode_t mode) +{ + psram_cmd_t ps_cmd; + ps_cmd.cmd = 0xC0; + ps_cmd.cmdBitLen = 8; + ps_cmd.addr = 0; + ps_cmd.addrBitLen = 0; + ps_cmd.txData = NULL; + ps_cmd.txDataBitLen = 0; + ps_cmd.rxData = NULL; + ps_cmd.rxDataBitLen = 0; + ps_cmd.dummyBitLen = 0; + psram_cmd_config(spi_num, &ps_cmd); + psram_cmd_recv_start(spi_num, NULL, 0, mode); + psram_cmd_end(spi_num); +} + +//send reset command to psram, in spi mode +static void psram_reset_mode(psram_spi_num_t spi_num) +{ + psram_cmd_t ps_cmd; + ps_cmd.txData = NULL; + ps_cmd.txDataBitLen = 0; + ps_cmd.addr = NULL; + ps_cmd.addrBitLen = 0; + ps_cmd.cmd = PSRAM_RESET_EN; + ps_cmd.cmdBitLen = 8; + ps_cmd.rxData = NULL; + ps_cmd.rxDataBitLen = 0; + ps_cmd.dummyBitLen = 0; + psram_cmd_config(spi_num, &ps_cmd); + psram_cmd_recv_start(spi_num, NULL, 0, PSRAM_CMD_SPI); + psram_cmd_end(spi_num); + + memset(&ps_cmd, 0, sizeof(ps_cmd)); + ps_cmd.txData = NULL; + ps_cmd.txDataBitLen = 0; + ps_cmd.addr = NULL; + ps_cmd.addrBitLen = 0; + ps_cmd.cmd = PSRAM_RESET; + ps_cmd.cmdBitLen = 8; + ps_cmd.rxData = NULL; + ps_cmd.rxDataBitLen = 0; + ps_cmd.dummyBitLen = 0; + psram_cmd_config(spi_num, &ps_cmd); + psram_cmd_recv_start(spi_num, NULL, 0, PSRAM_CMD_SPI); + psram_cmd_end(spi_num); +} + +esp_err_t psram_enable_wrap(uint32_t wrap_size) +{ + switch (wrap_size) { + case 32: + psram_set_wrap_burst_length(PSRAM_SPI_1, PSRAM_CMD_QPI); + return ESP_OK; + case 16: + case 64: + default: + return ESP_FAIL; + } +} + +bool psram_support_wrap_size(uint32_t wrap_size) +{ + switch (wrap_size) { + case 0: + case 32: + return true; + case 16: + case 64: + default: + return false; + } + +} + +static void psram_read_id(uint32_t* dev_id) +{ + psram_spi_num_t spi_num = PSRAM_SPI_1; + psram_disable_qio_mode(spi_num); + uint32_t dummy_bits = 0; + uint32_t addr = 0; + psram_cmd_t ps_cmd; + switch (s_psram_mode) { + case PSRAM_CACHE_S80M: + dummy_bits = 0 + extra_dummy; + break; + case PSRAM_CACHE_S40M: + case PSRAM_CACHE_S26M: + case PSRAM_CACHE_S20M: + default: + dummy_bits = 0 + extra_dummy; + break; + } + ps_cmd.cmd = PSRAM_DEVICE_ID; + ps_cmd.cmdBitLen = 8; + ps_cmd.addr = &addr; + ps_cmd.addrBitLen = 24; + ps_cmd.txDataBitLen = 0; + ps_cmd.txData = NULL; + ps_cmd.rxDataBitLen = 3 * 8; + ps_cmd.rxData = dev_id; + ps_cmd.dummyBitLen = dummy_bits; + psram_cmd_config(spi_num, &ps_cmd); + psram_clear_spi_fifo(spi_num); + psram_cmd_recv_start(spi_num, ps_cmd.rxData, ps_cmd.rxDataBitLen / 8, PSRAM_CMD_SPI); + psram_cmd_end(spi_num); +} + +//enter QPI mode +static esp_err_t IRAM_ATTR psram_enable_qio_mode(psram_spi_num_t spi_num) +{ + psram_cmd_t ps_cmd; + ps_cmd.cmd = PSRAM_ENTER_QMODE; + ps_cmd.cmdBitLen = 8; //this two bits is used to delay 2 clock cycle + ps_cmd.addr = NULL; + ps_cmd.addrBitLen = 0; + ps_cmd.txData = NULL; + ps_cmd.txDataBitLen = 0; + ps_cmd.rxData = NULL; + ps_cmd.rxDataBitLen = 0; + ps_cmd.dummyBitLen = 0; + psram_cmd_config(spi_num, &ps_cmd); + psram_cmd_recv_start(spi_num, NULL, 0, PSRAM_CMD_SPI); + psram_cmd_end(spi_num); + return ESP_OK; +} +#endif /* FAKE_QPI */ + +//spi param init for psram +void IRAM_ATTR psram_spi_init(psram_spi_num_t spi_num, psram_cache_mode_t mode) +{ + uint8_t k; + SET_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_CS_SETUP); +#warning "psram_spi_init: part of configuration missing for esp32s2beta" +#if 0 + // SPI_CPOL & SPI_CPHA + CLEAR_PERI_REG_MASK(SPI_MEM_MISC_REG(spi_num), SPI_MEM_CK_IDLE_EDGE); + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_CK_OUT_EDGE); + // SPI bit order + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_WR_BIT_ORDER); + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(spi_num), SPI_MEM_RD_BIT_ORDER); + // SPI bit order + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_DOUTDIN); +#endif + // May be not must to do. + WRITE_PERI_REG(SPI_MEM_USER1_REG(spi_num), 0); +#if 0 + // SPI mode type + CLEAR_PERI_REG_MASK(SPI_MEM_SLAVE_REG(spi_num), SPI_MEM_SLAVE_MODE); +#endif + // Set SPI speed for non-80M mode. (80M mode uses APB clock directly.) + if (mode!=PSRAM_CACHE_S80M) { + k = 2; //Main divider. Divide by 2 so we get 40MHz + //clear bit 31, set SPI clock div + CLEAR_PERI_REG_MASK(SPI_MEM_CLOCK_REG(spi_num), SPI_MEM_CLK_EQU_SYSCLK); + WRITE_PERI_REG(SPI_MEM_CLOCK_REG(spi_num), + (((k - 1) & SPI_MEM_CLKCNT_N) << SPI_MEM_CLKCNT_N_S) | + ((((k + 1) / 2 - 1) & SPI_MEM_CLKCNT_H) << SPI_MEM_CLKCNT_H_S) | //50% duty cycle + (((k - 1) & SPI_MEM_CLKCNT_L) << SPI_MEM_CLKCNT_L_S)); + } + // Enable MOSI + SET_PERI_REG_MASK(SPI_MEM_USER_REG(spi_num), SPI_MEM_CS_SETUP | SPI_MEM_CS_HOLD | SPI_MEM_USR_MOSI); + memset((void*)SPI_MEM_W0_REG(spi_num), 0, 16 * 4); +} + +/* + * Psram mode init will overwrite original flash speed mode, so that it is possible to change psram and flash speed after OTA. + * Flash read mode(QIO/QOUT/DIO/DOUT) will not be changed in app bin. It is decided by bootloader, OTA can not change this mode. + */ +static void IRAM_ATTR psram_gpio_config(psram_cache_mode_t mode) +{ + int spi_cache_dummy = 0; + uint32_t rd_mode_reg = READ_PERI_REG(SPI_MEM_CTRL_REG(0)); + if (rd_mode_reg & (SPI_MEM_FREAD_QIO_M | SPI_MEM_FREAD_DIO_M)) { + spi_cache_dummy = SPI0_R_QIO_DUMMY_CYCLELEN; + } else if (rd_mode_reg & (SPI_MEM_FREAD_QUAD_M | SPI_MEM_FREAD_DUAL_M)) { + spi_cache_dummy = SPI0_R_FAST_DUMMY_CYCLELEN; + } else { + spi_cache_dummy = SPI0_R_FAST_DUMMY_CYCLELEN; + } + // In bootloader, all the signals are already configured, + // We keep the following code in case the bootloader is some older version. + gpio_matrix_out(FLASH_CS_IO, SPICS0_OUT_IDX, 0, 0); + gpio_matrix_out(PSRAM_SPIQ_IO, SPIQ_OUT_IDX, 0, 0); + gpio_matrix_in(PSRAM_SPIQ_IO, SPIQ_IN_IDX, 0); + gpio_matrix_out(PSRAM_SPID_IO, SPID_OUT_IDX, 0, 0); + gpio_matrix_in(PSRAM_SPID_IO, SPID_IN_IDX, 0); + gpio_matrix_out(PSRAM_SPIWP_IO, SPIWP_OUT_IDX, 0, 0); + gpio_matrix_in(PSRAM_SPIWP_IO, SPIWP_IN_IDX, 0); + gpio_matrix_out(PSRAM_SPIHD_IO, SPIHD_OUT_IDX, 0, 0); + gpio_matrix_in(PSRAM_SPIHD_IO, SPIHD_IN_IDX, 0); + +#warning "psram_gpio_config: parts not implemented for esp32s2beta" + + switch (mode) { + case PSRAM_CACHE_S40M: + extra_dummy = PSRAM_IO_MATRIX_DUMMY_40M; +#if CONFIG_ESPTOOLPY_FLASHFREQ_80M + g_rom_spiflash_dummy_len_plus[_SPI_CACHE_PORT] = PSRAM_IO_MATRIX_DUMMY_80M; + g_rom_spiflash_dummy_len_plus[_SPI_FLASH_PORT] = PSRAM_IO_MATRIX_DUMMY_40M; + SET_PERI_REG_BITS(SPI_MEM_USER1_REG(_SPI_CACHE_PORT), SPI_MEM_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + PSRAM_IO_MATRIX_DUMMY_80M, SPI_MEM_USR_DUMMY_CYCLELEN_S); //DUMMY + esp_rom_spiflash_config_clk(_SPI_80M_CLK_DIV, _SPI_CACHE_PORT); + esp_rom_spiflash_config_clk(_SPI_40M_CLK_DIV, _SPI_FLASH_PORT); +#endif + break; + case PSRAM_CACHE_S80M: + extra_dummy = PSRAM_IO_MATRIX_DUMMY_80M; +#if 0 + g_rom_spiflash_dummy_len_plus[_SPI_CACHE_PORT] = PSRAM_IO_MATRIX_DUMMY_80M; + g_rom_spiflash_dummy_len_plus[_SPI_FLASH_PORT] = PSRAM_IO_MATRIX_DUMMY_80M; + SET_PERI_REG_BITS(SPI_MEM_USER1_REG(_SPI_CACHE_PORT), SPI_MEM_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + PSRAM_IO_MATRIX_DUMMY_80M, SPI_MEM_USR_DUMMY_CYCLELEN_S); //DUMMY + + CLEAR_PERI_REG_MASK(PERIPHS_SPI_FLASH_CTRL, SPI_MEM_FREAD_QIO | SPI_MEM_FREAD_QUAD | SPI_MEM_FREAD_DIO | SPI_MEM_FREAD_DUAL | SPI_MEM_FASTRD_MODE); + esp_rom_spiflash_config_clk(_SPI_80M_CLK_DIV, _SPI_CACHE_PORT); + CLEAR_PERI_REG_MASK(PERIPHS_SPI_FLASH_CTRL, SPI_MEM_FREAD_QIO | SPI_MEM_FREAD_QUAD | SPI_MEM_FREAD_DIO | SPI_MEM_FREAD_DUAL | SPI_MEM_FASTRD_MODE); + esp_rom_spiflash_config_clk(_SPI_80M_CLK_DIV, _SPI_FLASH_PORT); + +#endif + break; + case PSRAM_CACHE_S26M: + case PSRAM_CACHE_S20M: + extra_dummy = PSRAM_IO_MATRIX_DUMMY_20M; +#if 0 + g_rom_spiflash_dummy_len_plus[_SPI_CACHE_PORT] = PSRAM_IO_MATRIX_DUMMY_20M; + g_rom_spiflash_dummy_len_plus[_SPI_FLASH_PORT] = PSRAM_IO_MATRIX_DUMMY_20M; + SET_PERI_REG_BITS(SPI_MEM_USER1_REG(_SPI_CACHE_PORT), SPI_MEM_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + PSRAM_IO_MATRIX_DUMMY_20M, SPI_MEM_USR_DUMMY_CYCLELEN_S); //DUMMY + + CLEAR_PERI_REG_MASK(PERIPHS_SPI_FLASH_CTRL, SPI_MEM_FREAD_QIO | SPI_MEM_FREAD_QUAD | SPI_MEM_FREAD_DIO | SPI_MEM_FREAD_DUAL | SPI_MEM_FASTRD_MODE); + esp_rom_spiflash_config_clk(_SPI_20M_CLK_DIV, _SPI_CACHE_PORT); + CLEAR_PERI_REG_MASK(PERIPHS_SPI_FLASH_CTRL, SPI_MEM_FREAD_QIO | SPI_MEM_FREAD_QUAD | SPI_MEM_FREAD_DIO | SPI_MEM_FREAD_DUAL | SPI_MEM_FASTRD_MODE); + esp_rom_spiflash_config_clk(_SPI_20M_CLK_DIV, _SPI_FLASH_PORT); +#endif + + default: + break; + } + SET_PERI_REG_MASK(SPI_MEM_USER_REG(0), SPI_MEM_USR_DUMMY); // dummy en + //select pin function gpio + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPIHD_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPIWP_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPICS0_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPIQ_U, PIN_FUNC_GPIO); + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPID_U, PIN_FUNC_GPIO); + // flash clock signal should come from IO MUX. + // set drive ability for clock + PIN_FUNC_SELECT(PERIPHS_IO_MUX_SPICLK_U, FUNC_SPICLK_SPICLK); +} + +psram_size_t psram_get_size(void) +{ + if (PSRAM_IS_32MBIT_VER0(s_psram_id)) { + return PSRAM_SIZE_32MBITS; + } else if (PSRAM_IS_64MBIT(s_psram_id)) { + return PSRAM_SIZE_64MBITS; + } else { + return PSRAM_SIZE_MAX; + } +} + +//psram gpio init , different working frequency we have different solutions +esp_err_t IRAM_ATTR psram_enable(psram_cache_mode_t mode, psram_vaddr_mode_t vaddrmode) //psram init +{ + + assert(mode < PSRAM_CACHE_MAX && "we don't support any other mode for now."); + s_psram_mode = mode; + + periph_module_enable(PERIPH_SPI_MODULE); + +#warning "psram_enable: some code disabled for esp32s2beta" +#if 0 + WRITE_PERI_REG(SPI_MEM_EXT3_REG(0), 0x1); + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(PSRAM_SPI_1), SPI_MEM_USR_PREP_HOLD_M); +#endif + + + switch (mode) { + case PSRAM_CACHE_S80M: + case PSRAM_CACHE_S40M: + case PSRAM_CACHE_S26M: + case PSRAM_CACHE_S20M: + default: + psram_spi_init(PSRAM_SPI_1, mode); + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(PSRAM_SPI_1), SPI_MEM_CS_HOLD); + gpio_matrix_out(PSRAM_CS_IO, SPICS1_OUT_IDX, 0, 0); +#ifdef FAKE_QPI + /* We need to delay CLK to the PSRAM with respect to the clock signal as output by the SPI peripheral. + We do this by routing it signal to signal 220/221, which are used as a loopback; the extra run through + the GPIO matrix causes the delay. We use GPIO20 (which is not in any package but has pad logic in + silicon) as a temporary pad for this. So the signal path is: + SPI CLK --> GPIO28 --> signal220(in then out) --> internal GPIO29 --> signal221(in then out) --> GPIO17(PSRAM CLK) + */ + gpio_matrix_out(PSRAM_INTERNAL_IO_28, SPICLK_OUT_IDX, 0, 0); + gpio_matrix_in(PSRAM_INTERNAL_IO_28, SIG_IN_FUNC220_IDX, 0); + gpio_matrix_out(PSRAM_INTERNAL_IO_29, SIG_IN_FUNC220_IDX, 0, 0); + gpio_matrix_in(PSRAM_INTERNAL_IO_29, SIG_IN_FUNC221_IDX, 0); + gpio_matrix_out(PSRAM_CLK_IO, SIG_IN_FUNC221_IDX, 0, 0); +#else + REG_SET_FIELD(SPI_MEM_SRAM_CMD_REG(0), SPI_MEM_SCLK_MODE, 1); + REG_SET_FIELD(SPI_MEM_CTRL1_REG(1), SPI_MEM_CLK_MODE, 1); +#endif + + break; + } + + #if CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V + // For flash 80Mhz, we must update ldo voltage in case older version of bootloader didn't do this. + rtc_vddsdio_config_t cfg = rtc_vddsdio_get_config(); + if (cfg.enable == 1 && cfg.tieh == RTC_VDDSDIO_TIEH_1_8V) { // VDDSDIO regulator is enabled @ 1.8V + cfg.drefh = 3; + cfg.drefm = 3; + cfg.drefl = 3; + cfg.force = 1; + rtc_vddsdio_set_config(cfg); + ets_delay_us(10); // wait for regulator to become stable + } + #endif + CLEAR_PERI_REG_MASK(SPI_MEM_USER_REG(PSRAM_SPI_1), SPI_MEM_CS_SETUP_M); + psram_gpio_config(mode); + PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[PSRAM_CS_IO], PIN_FUNC_GPIO); + psram_read_id(&s_psram_id); + if (!PSRAM_IS_VALID(s_psram_id)) { + return ESP_FAIL; + } + uint32_t flash_id = g_rom_flashchip.device_id; + if (flash_id == FLASH_ID_GD25LQ32C) { + // Set drive ability for 1.8v flash in 80Mhz. + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPIHD_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPIWP_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPICS0_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPICLK_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPIQ_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(PERIPHS_IO_MUX_SPID_U, FUN_DRV, 3, FUN_DRV_S); + SET_PERI_REG_BITS(GPIO_PIN_MUX_REG[PSRAM_CS_IO], FUN_DRV, 3, FUN_DRV_S); + } + if (PSRAM_IS_64MBIT(s_psram_id)) { + // For this psram, we don't need any extra clock cycles after cs get back to high level + s_clk_mode = PSRAM_CLK_MODE_NORM; + REG_SET_FIELD(SPI_MEM_SRAM_CMD_REG(0), SPI_MEM_SCLK_MODE, 0); + REG_SET_FIELD(SPI_MEM_CTRL1_REG(1), SPI_MEM_CLK_MODE, 0); + } else if (PSRAM_IS_32MBIT_VER0(s_psram_id)) { + s_clk_mode = PSRAM_CLK_MODE_DCLK; + if (mode == PSRAM_CACHE_S80M) { + } + } + psram_reset_mode(PSRAM_SPI_1); + psram_enable_qio_mode(PSRAM_SPI_1); + psram_cache_init(mode, vaddrmode); + return ESP_OK; +} + +static void IRAM_ATTR psram_clock_set(psram_spi_num_t spi_num, int8_t freqdiv) +{ + uint32_t freqbits; + if (1 >= freqdiv) { + WRITE_PERI_REG(SPI_MEM_SRAM_CLK_REG(spi_num), SPI_MEM_SCLK_EQU_SYSCLK); + } else { + freqbits = (((freqdiv-1)< + +#include "esp_system.h" +#include "esp_attr.h" +#include "esp_wifi.h" +#include "esp_private/wifi.h" +#include "esp_log.h" +#include "sdkconfig.h" +#include "esp32s2beta/rom/efuse.h" +#include "esp32s2beta/rom/cache.h" +#include "esp32s2beta/rom/uart.h" +#include "soc/dport_reg.h" +#include "soc/gpio_reg.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/timer_group_reg.h" +#include "soc/timer_group_struct.h" +#include "soc/cpu.h" +#include "soc/rtc.h" +#include "soc/rtc_wdt.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/xtensa_api.h" +#include "esp_heap_caps.h" +#include "soc/syscon_reg.h" +#include "esp_efuse.h" +#include "esp_efuse_table.h" + +static const char* TAG = "system_api"; + +static uint8_t base_mac_addr[6] = { 0 }; + +#define SHUTDOWN_HANDLERS_NO 2 +static shutdown_handler_t shutdown_handlers[SHUTDOWN_HANDLERS_NO]; + +void system_init(void) +{ +} + +esp_err_t esp_base_mac_addr_set(uint8_t *mac) +{ + if (mac == NULL) { + ESP_LOGE(TAG, "Base MAC address is NULL"); + abort(); + } + + memcpy(base_mac_addr, mac, 6); + + return ESP_OK; +} + +esp_err_t esp_base_mac_addr_get(uint8_t *mac) +{ + uint8_t null_mac[6] = {0}; + + if (memcmp(base_mac_addr, null_mac, 6) == 0) { + ESP_LOGI(TAG, "Base MAC address is not set, read default base MAC address from BLK0 of EFUSE"); + return ESP_ERR_INVALID_MAC; + } + + memcpy(mac, base_mac_addr, 6); + + return ESP_OK; +} + +esp_err_t esp_efuse_mac_get_custom(uint8_t *mac) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +esp_err_t esp_efuse_mac_get_default(uint8_t* mac) +{ + return esp_efuse_read_field_blob(ESP_EFUSE_MAC_FACTORY, mac, 48); +} + +esp_err_t system_efuse_read_mac(uint8_t *mac) __attribute__((alias("esp_efuse_mac_get_default"))); +esp_err_t esp_efuse_read_mac(uint8_t *mac) __attribute__((alias("esp_efuse_mac_get_default"))); + +esp_err_t esp_derive_mac(uint8_t* local_mac, const uint8_t* universal_mac) +{ + uint8_t idx; + + if (local_mac == NULL || universal_mac == NULL) { + ESP_LOGE(TAG, "mac address param is NULL"); + return ESP_ERR_INVALID_ARG; + } + + memcpy(local_mac, universal_mac, 6); + for (idx = 0; idx < 64; idx++) { + local_mac[0] = universal_mac[0] | 0x02; + local_mac[0] ^= idx << 2; + + if (memcmp(local_mac, universal_mac, 6)) { + break; + } + } + + return ESP_OK; +} + +esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type) +{ + uint8_t efuse_mac[6]; + + if (mac == NULL) { + ESP_LOGE(TAG, "mac address param is NULL"); + return ESP_ERR_INVALID_ARG; + } + + if (type < ESP_MAC_WIFI_STA || type > ESP_MAC_ETH) { + ESP_LOGE(TAG, "mac type is incorrect"); + return ESP_ERR_INVALID_ARG; + } + + _Static_assert(UNIVERSAL_MAC_ADDR_NUM == FOUR_UNIVERSAL_MAC_ADDR \ + || UNIVERSAL_MAC_ADDR_NUM == TWO_UNIVERSAL_MAC_ADDR, \ + "incorrect NUM_MAC_ADDRESS_FROM_EFUSE value"); + + if (esp_base_mac_addr_get(efuse_mac) != ESP_OK) { + esp_efuse_mac_get_default(efuse_mac); + } + + switch (type) { + case ESP_MAC_WIFI_STA: + memcpy(mac, efuse_mac, 6); + break; + case ESP_MAC_WIFI_SOFTAP: + if (UNIVERSAL_MAC_ADDR_NUM == FOUR_UNIVERSAL_MAC_ADDR) { + memcpy(mac, efuse_mac, 6); + mac[5] += 1; + } + else if (UNIVERSAL_MAC_ADDR_NUM == TWO_UNIVERSAL_MAC_ADDR) { + esp_derive_mac(mac, efuse_mac); + } + break; + case ESP_MAC_BT: + memcpy(mac, efuse_mac, 6); + if (UNIVERSAL_MAC_ADDR_NUM == FOUR_UNIVERSAL_MAC_ADDR) { + mac[5] += 2; + } + else if (UNIVERSAL_MAC_ADDR_NUM == TWO_UNIVERSAL_MAC_ADDR) { + mac[5] += 1; + } + break; + case ESP_MAC_ETH: + if (UNIVERSAL_MAC_ADDR_NUM == FOUR_UNIVERSAL_MAC_ADDR) { + memcpy(mac, efuse_mac, 6); + mac[5] += 3; + } + else if (UNIVERSAL_MAC_ADDR_NUM == TWO_UNIVERSAL_MAC_ADDR) { + efuse_mac[5] += 1; + esp_derive_mac(mac, efuse_mac); + } + break; + default: + ESP_LOGW(TAG, "incorrect mac type"); + break; + } + return ESP_OK; +} + +esp_err_t esp_register_shutdown_handler(shutdown_handler_t handler) +{ + int i; + for (i = 0; i < SHUTDOWN_HANDLERS_NO; i++) { + if (shutdown_handlers[i] == NULL) { + shutdown_handlers[i] = handler; + return ESP_OK; + } + } + return ESP_FAIL; +} + +esp_err_t esp_unregister_shutdown_handler(shutdown_handler_t handler) +{ + for (int i = 0; i < SHUTDOWN_HANDLERS_NO; i++) { + if (shutdown_handlers[i] == handler) { + shutdown_handlers[i] = NULL; + return ESP_OK; + } + } + return ESP_ERR_INVALID_STATE; +} + +void esp_restart_noos(void) __attribute__ ((noreturn)); + +void IRAM_ATTR esp_restart(void) +{ + int i; + for (i = 0; i < SHUTDOWN_HANDLERS_NO; i++) { + if (shutdown_handlers[i]) { + shutdown_handlers[i](); + } + } + + // Disable scheduler on this core. + vTaskSuspendAll(); + + esp_restart_noos(); +} + +/* "inner" restart function for after RTOS, interrupts & anything else on this + * core are already stopped. Stalls other core, resets hardware, + * triggers restart. +*/ +void IRAM_ATTR esp_restart_noos(void) +{ + // Disable interrupts + xt_ints_off(0xFFFFFFFF); + + // Enable RTC watchdog for 1 second + rtc_wdt_protect_off(); + rtc_wdt_disable(); + rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_RTC); + rtc_wdt_set_stage(RTC_WDT_STAGE1, RTC_WDT_STAGE_ACTION_RESET_SYSTEM); + rtc_wdt_set_length_of_reset_signal(RTC_WDT_SYS_RESET_SIG, RTC_WDT_LENGTH_200ns); + rtc_wdt_set_length_of_reset_signal(RTC_WDT_CPU_RESET_SIG, RTC_WDT_LENGTH_200ns); + rtc_wdt_set_time(RTC_WDT_STAGE0, 1000); + rtc_wdt_flashboot_mode_enable(); + + // Reset and stall the other CPU. + // CPU must be reset before stalling, in case it was running a s32c1i + // instruction. This would cause memory pool to be locked by arbiter + // to the stalled CPU, preventing current CPU from accessing this pool. + const uint32_t core_id = xPortGetCoreID(); +#if !CONFIG_FREERTOS_UNICORE + const uint32_t other_core_id = (core_id == 0) ? 1 : 0; + esp_cpu_reset(other_core_id); + esp_cpu_stall(other_core_id); +#endif + + // Disable TG0/TG1 watchdogs + TIMERG0.wdt_wprotect=TIMG_WDT_WKEY_VALUE; + TIMERG0.wdt_config0.en = 0; + TIMERG0.wdt_wprotect=0; + TIMERG1.wdt_wprotect=TIMG_WDT_WKEY_VALUE; + TIMERG1.wdt_config0.en = 0; + TIMERG1.wdt_wprotect=0; + + // Flush any data left in UART FIFOs + uart_tx_wait_idle(0); + uart_tx_wait_idle(1); + // Disable cache + Cache_Disable_ICache(); + Cache_Disable_DCache(); + + // 2nd stage bootloader reconfigures SPI flash signals. + // Reset them to the defaults expected by ROM. + WRITE_PERI_REG(GPIO_FUNC0_IN_SEL_CFG_REG, 0x30); + WRITE_PERI_REG(GPIO_FUNC1_IN_SEL_CFG_REG, 0x30); + WRITE_PERI_REG(GPIO_FUNC2_IN_SEL_CFG_REG, 0x30); + WRITE_PERI_REG(GPIO_FUNC3_IN_SEL_CFG_REG, 0x30); + WRITE_PERI_REG(GPIO_FUNC4_IN_SEL_CFG_REG, 0x30); + WRITE_PERI_REG(GPIO_FUNC5_IN_SEL_CFG_REG, 0x30); + + // Reset wifi/bluetooth/ethernet/sdio (bb/mac) + DPORT_SET_PERI_REG_MASK(DPORT_CORE_RST_EN_REG, + DPORT_BB_RST | DPORT_FE_RST | DPORT_MAC_RST | + DPORT_BT_RST | DPORT_BTMAC_RST | DPORT_SDIO_RST | + DPORT_SDIO_HOST_RST | DPORT_EMAC_RST | DPORT_MACPWR_RST | + DPORT_RW_BTMAC_RST | DPORT_RW_BTLP_RST); + DPORT_REG_WRITE(DPORT_CORE_RST_EN_REG, 0); + + // Reset timer/spi/uart + DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, + DPORT_TIMERS_RST | DPORT_SPI01_RST | DPORT_UART_RST); + DPORT_REG_WRITE(DPORT_PERIP_RST_EN_REG, 0); + + // Set CPU back to XTAL source, no PLL, same as hard reset + rtc_clk_cpu_freq_set(RTC_CPU_FREQ_XTAL); + +#if !CONFIG_FREERTOS_UNICORE + // Clear entry point for APP CPU + DPORT_REG_WRITE(DPORT_APPCPU_CTRL_D_REG, 0); +#endif + + // Reset CPUs + if (core_id == 0) { + // Running on PRO CPU: APP CPU is stalled. Can reset both CPUs. +#if !CONFIG_FREERTOS_UNICORE + esp_cpu_reset(1); +#endif + esp_cpu_reset(0); + } +#if !CONFIG_FREERTOS_UNICORE + else { + // Running on APP CPU: need to reset PRO CPU and unstall it, + // then reset APP CPU + esp_cpu_reset(0); + esp_cpu_unstall(0); + esp_cpu_reset(1); + } +#endif + while(true) { + ; + } +} + +void system_restart(void) __attribute__((alias("esp_restart"))); + +uint32_t esp_get_free_heap_size( void ) +{ + return heap_caps_get_free_size( MALLOC_CAP_DEFAULT ); +} + +uint32_t esp_get_minimum_free_heap_size( void ) +{ + return heap_caps_get_minimum_free_size( MALLOC_CAP_DEFAULT ); +} + +uint32_t system_get_free_heap_size(void) __attribute__((alias("esp_get_free_heap_size"))); + +const char* system_get_sdk_version(void) +{ + return "master"; +} + +const char* esp_get_idf_version(void) +{ + return IDF_VER; +} + +void esp_chip_info(esp_chip_info_t* out_info) +{ + memset(out_info, 0, sizeof(*out_info)); + + out_info->model = CHIP_ESP32S2BETA; + out_info->cores = 1; + out_info->features = CHIP_FEATURE_WIFI_BGN; + + // FIXME: other features? +} diff --git a/components/esp32s2beta/task_wdt.c b/components/esp32s2beta/task_wdt.c new file mode 100644 index 0000000000..e8ca2f7730 --- /dev/null +++ b/components/esp32s2beta/task_wdt.c @@ -0,0 +1,430 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include +#include +#include "sdkconfig.h" +#include "freertos/FreeRTOSConfig.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "freertos/semphr.h" +#include +#include "esp_err.h" +#include "esp_intr_alloc.h" +#include "esp_attr.h" +#include "esp_freertos_hooks.h" +#include "soc/timer_periph.h" +#include "esp_log.h" +#include "driver/timer.h" +#include "driver/periph_ctrl.h" +#include "esp_task_wdt.h" +#include "esp_private/system_internal.h" + +static const char *TAG = "task_wdt"; + +//Assertion macro where, if 'cond' is false, will exit the critical section and return 'ret' +#define ASSERT_EXIT_CRIT_RETURN(cond, ret) ({ \ + if(!(cond)){ \ + portEXIT_CRITICAL(&twdt_spinlock); \ + return ret; \ + } \ +}) + +//Empty define used in ASSERT_EXIT_CRIT_RETURN macro when returning in void +#define VOID_RETURN + +//Structure used for each subscribed task +typedef struct twdt_task_t twdt_task_t; +struct twdt_task_t { + TaskHandle_t task_handle; + bool has_reset; + twdt_task_t *next; +}; + +//Structure used to hold run time configuration of the TWDT +typedef struct twdt_config_t twdt_config_t; +struct twdt_config_t { + twdt_task_t *list; //Linked list of subscribed tasks + uint32_t timeout; //Timeout period of TWDT + bool panic; //Flag to trigger panic when TWDT times out + intr_handle_t intr_handle; +}; + +static twdt_config_t *twdt_config = NULL; +static portMUX_TYPE twdt_spinlock = portMUX_INITIALIZER_UNLOCKED; + +/* + * Idle hook callback for Idle Tasks to reset the TWDT. This callback will only + * be registered to the Idle Hook of a particular core when the corresponding + * Idle Task subscribes to the TWDT. + */ +static bool idle_hook_cb(void) +{ + esp_task_wdt_reset(); + return true; +} + +/* + * Internal function that looks for the target task in the TWDT task list. + * Returns the list item if found and returns null if not found. Also checks if + * all the other tasks have reset. Should be called within critical. + */ +static twdt_task_t *find_task_in_twdt_list(TaskHandle_t handle, bool *all_reset) +{ + twdt_task_t *target = NULL; + *all_reset = true; + for(twdt_task_t *task = twdt_config->list; task != NULL; task = task->next){ + if(task->task_handle == handle){ + target = task; //Get pointer to target task list member + }else{ + if(task->has_reset == false){ //If a task has yet to reset + *all_reset = false; + } + } + } + return target; +} + +/* + * Resets the hardware timer and has_reset flags of each task on the list. + * Called within critical + */ +static void reset_hw_timer(void) +{ + //All tasks have reset; time to reset the hardware timer. + TIMERG0.wdt_wprotect=TIMG_WDT_WKEY_VALUE; + TIMERG0.wdt_feed=1; + TIMERG0.wdt_wprotect=0; + //Clear all has_reset flags in list + for (twdt_task_t *task = twdt_config->list; task != NULL; task = task->next){ + task->has_reset=false; + } +} + +/* + * This function is called by task_wdt_isr function (ISR for when TWDT times out). + * It can be redefined in user code to handle twdt events. + * Note: It has the same limitations as the interrupt function. + * Do not use ESP_LOGI functions inside. + */ +void __attribute__((weak)) esp_task_wdt_isr_user_handler(void) +{ + +} + +/* + * ISR for when TWDT times out. Checks for which tasks have not reset. Also + * triggers panic if configured to do so + */ +static void task_wdt_isr(void *arg) +{ + portENTER_CRITICAL_ISR(&twdt_spinlock); + twdt_task_t *twdttask; + const char *cpu; + //Reset hardware timer so that 2nd stage timeout is not reached (will trigger system reset) + TIMERG0.wdt_wprotect=TIMG_WDT_WKEY_VALUE; + TIMERG0.wdt_feed=1; + TIMERG0.wdt_wprotect=0; + //Acknowledge interrupt + TIMERG0.int_clr.wdt=1; + //We are taking a spinlock while doing I/O (ESP_EARLY_LOGE) here. Normally, that is a pretty + //bad thing, possibly (temporarily) hanging up the 2nd core and stopping FreeRTOS. In this case, + //something bad already happened and reporting this is considered more important + //than the badness caused by a spinlock here. + + //Return immediately if no tasks have been added to task list + ASSERT_EXIT_CRIT_RETURN((twdt_config->list != NULL), VOID_RETURN); + + //Watchdog got triggered because at least one task did not reset in time. + ESP_EARLY_LOGE(TAG, "Task watchdog got triggered. The following tasks did not reset the watchdog in time:"); + for (twdttask=twdt_config->list; twdttask!=NULL; twdttask=twdttask->next) { + if (!twdttask->has_reset) { + cpu=xTaskGetAffinity(twdttask->task_handle)==0?DRAM_STR("CPU 0"):DRAM_STR("CPU 1"); + if (xTaskGetAffinity(twdttask->task_handle)==tskNO_AFFINITY) cpu=DRAM_STR("CPU 0/1"); + ESP_EARLY_LOGE(TAG, " - %s (%s)", pcTaskGetTaskName(twdttask->task_handle), cpu); + } + } + ESP_EARLY_LOGE(TAG, "%s", DRAM_STR("Tasks currently running:")); + for (int x=0; xpanic){ //Trigger Panic if configured to do so + ESP_EARLY_LOGE(TAG, "Aborting."); + portEXIT_CRITICAL_ISR(&twdt_spinlock); + // TODO: Add support reset reason for esp32s2beta. + // esp_reset_reason_set_hint(ESP_RST_TASK_WDT); + abort(); + } + + portEXIT_CRITICAL_ISR(&twdt_spinlock); +} + +/* + * Initializes the TWDT by allocating memory for the config data + * structure, obtaining the idle task handles/registering idle hooks, and + * setting the hardware timer registers. If reconfiguring, it will just modify + * wdt_config and reset the hardware timer. + */ +esp_err_t esp_task_wdt_init(uint32_t timeout, bool panic) +{ + portENTER_CRITICAL(&twdt_spinlock); + if(twdt_config == NULL){ //TWDT not initialized yet + //Allocate memory for wdt_config + twdt_config = calloc(1, sizeof(twdt_config_t)); + ASSERT_EXIT_CRIT_RETURN((twdt_config != NULL), ESP_ERR_NO_MEM); + + twdt_config->list = NULL; + twdt_config->timeout = timeout; + twdt_config->panic = panic; + + //Register Interrupt and ISR + ESP_ERROR_CHECK(esp_intr_alloc(ETS_TG0_WDT_LEVEL_INTR_SOURCE, 0, task_wdt_isr, NULL, &twdt_config->intr_handle)); + + //Configure hardware timer + periph_module_enable(PERIPH_TIMG0_MODULE); + TIMERG0.wdt_wprotect=TIMG_WDT_WKEY_VALUE; //Disable write protection + TIMERG0.wdt_config0.sys_reset_length=7; //3.2uS + TIMERG0.wdt_config0.cpu_reset_length=7; //3.2uS + TIMERG0.wdt_config0.level_int_en=1; + TIMERG0.wdt_config0.stg0=TIMG_WDT_STG_SEL_INT; //1st stage timeout: interrupt + TIMERG0.wdt_config0.stg1=TIMG_WDT_STG_SEL_RESET_SYSTEM; //2nd stage timeout: reset system + TIMERG0.wdt_config1.clk_prescale=80*500; //Prescaler: wdt counts in ticks of 0.5mS + TIMERG0.wdt_config2=twdt_config->timeout*2000; //Set timeout before interrupt + TIMERG0.wdt_config3=twdt_config->timeout*4000; //Set timeout before reset + TIMERG0.wdt_config0.en=1; + TIMERG0.wdt_feed=1; + TIMERG0.wdt_wprotect=0; //Enable write protection + + }else{ //twdt_config previously initialized + //Reconfigure task wdt + twdt_config->panic = panic; + twdt_config->timeout = timeout; + + //Reconfigure hardware timer + TIMERG0.wdt_wprotect=TIMG_WDT_WKEY_VALUE; //Disable write protection + TIMERG0.wdt_config0.en=0; //Disable timer + TIMERG0.wdt_config2=twdt_config->timeout*2000; //Set timeout before interrupt + TIMERG0.wdt_config3=twdt_config->timeout*4000; //Set timeout before reset + TIMERG0.wdt_config0.en=1; //Renable timer + TIMERG0.wdt_feed=1; //Reset timer + TIMERG0.wdt_wprotect=0; //Enable write protection + } + portEXIT_CRITICAL(&twdt_spinlock); + return ESP_OK; +} + +esp_err_t esp_task_wdt_deinit(void) +{ + portENTER_CRITICAL(&twdt_spinlock); + //TWDT must already be initialized + ASSERT_EXIT_CRIT_RETURN((twdt_config != NULL), ESP_ERR_NOT_FOUND); + //Task list must be empty + ASSERT_EXIT_CRIT_RETURN((twdt_config->list == NULL), ESP_ERR_INVALID_STATE); + + //Disable hardware timer + TIMERG0.wdt_wprotect=TIMG_WDT_WKEY_VALUE; //Disable write protection + TIMERG0.wdt_config0.en=0; //Disable timer + TIMERG0.wdt_wprotect=0; //Enable write protection + + ESP_ERROR_CHECK(esp_intr_free(twdt_config->intr_handle)); //Unregister interrupt + free(twdt_config); //Free twdt_config + twdt_config = NULL; + portEXIT_CRITICAL(&twdt_spinlock); + return ESP_OK; +} + +esp_err_t esp_task_wdt_add(TaskHandle_t handle) +{ + portENTER_CRITICAL(&twdt_spinlock); + //TWDT must already be initialized + ASSERT_EXIT_CRIT_RETURN((twdt_config != NULL), ESP_ERR_INVALID_STATE); + + twdt_task_t *target_task; + bool all_reset; + if (handle == NULL){ //Get handle of current task if none is provided + handle = xTaskGetCurrentTaskHandle(); + } + //Check if tasks exists in task list, and if all other tasks have reset + target_task = find_task_in_twdt_list(handle, &all_reset); + //task cannot be already subscribed + ASSERT_EXIT_CRIT_RETURN((target_task == NULL), ESP_ERR_INVALID_ARG); + + //Add target task to TWDT task list + target_task = calloc(1,sizeof(twdt_task_t)); + ASSERT_EXIT_CRIT_RETURN((target_task != NULL), ESP_ERR_NO_MEM); + target_task->task_handle = handle; + target_task->has_reset = true; + target_task->next = NULL; + if (twdt_config->list == NULL) { //Adding to empty list + twdt_config->list = target_task; + } else { //Adding to tail of list + twdt_task_t *task; + for (task = twdt_config->list; task->next != NULL; task = task->next){ + ; //point task to current tail of TWDT task list + } + task->next = target_task; + } + + //If idle task, register the idle hook callback to appropriate core + for(int i = 0; i < portNUM_PROCESSORS; i++){ + if(handle == xTaskGetIdleTaskHandleForCPU(i)){ + ESP_ERROR_CHECK(esp_register_freertos_idle_hook_for_cpu(idle_hook_cb, i)); + break; + } + } + + if(all_reset){ //Reset hardware timer if all other tasks in list have reset in + reset_hw_timer(); + } + + portEXIT_CRITICAL(&twdt_spinlock); //Nested critical if Legacy + return ESP_OK; +} + +esp_err_t esp_task_wdt_reset(void) +{ + portENTER_CRITICAL(&twdt_spinlock); + //TWDT must already be initialized + ASSERT_EXIT_CRIT_RETURN((twdt_config != NULL), ESP_ERR_INVALID_STATE); + + TaskHandle_t handle = xTaskGetCurrentTaskHandle(); + twdt_task_t *target_task; + bool all_reset; + + //Check if task exists in task list, and if all other tasks have reset + target_task = find_task_in_twdt_list(handle, &all_reset); + //Return error if trying to reset task that is not on the task list + ASSERT_EXIT_CRIT_RETURN((target_task != NULL), ESP_ERR_NOT_FOUND); + + target_task->has_reset = true; //Reset the task if it's on the task list + if(all_reset){ //Reset if all other tasks in list have reset in + reset_hw_timer(); + } + + portEXIT_CRITICAL(&twdt_spinlock); + return ESP_OK; +} + +esp_err_t esp_task_wdt_delete(TaskHandle_t handle) +{ + if(handle == NULL){ + handle = xTaskGetCurrentTaskHandle(); + } + portENTER_CRITICAL(&twdt_spinlock); + //Return error if twdt has not been initialized + ASSERT_EXIT_CRIT_RETURN((twdt_config != NULL), ESP_ERR_NOT_FOUND); + + twdt_task_t *target_task; + bool all_reset; + target_task = find_task_in_twdt_list(handle, &all_reset); + //Task doesn't exist on list. Return error + ASSERT_EXIT_CRIT_RETURN((target_task != NULL), ESP_ERR_INVALID_ARG); + + if(target_task == twdt_config->list){ //target_task is head of list. Delete + twdt_config->list = target_task->next; + free(target_task); + }else{ //target_task not head of list. Delete + twdt_task_t *prev; + for (prev = twdt_config->list; prev->next != target_task; prev = prev->next){ + ; //point prev to task preceding target_task + } + prev->next = target_task->next; + free(target_task); + } + + //If idle task, deregister idle hook callback form appropriate core + for(int i = 0; i < portNUM_PROCESSORS; i++){ + if(handle == xTaskGetIdleTaskHandleForCPU(i)){ + esp_deregister_freertos_idle_hook_for_cpu(idle_hook_cb, i); + break; + } + } + + if(all_reset){ //Reset hardware timer if all remaining tasks have reset + reset_hw_timer(); + } + + portEXIT_CRITICAL(&twdt_spinlock); + return ESP_OK; +} + +esp_err_t esp_task_wdt_status(TaskHandle_t handle) +{ + if(handle == NULL){ + handle = xTaskGetCurrentTaskHandle(); + } + + portENTER_CRITICAL(&twdt_spinlock); + //Return if TWDT is not initialized + ASSERT_EXIT_CRIT_RETURN((twdt_config != NULL), ESP_ERR_INVALID_STATE); + + twdt_task_t *task; + for(task = twdt_config->list; task!=NULL; task=task->next){ + //Return ESP_OK if task is found + ASSERT_EXIT_CRIT_RETURN((task->task_handle != handle), ESP_OK); + } + + //Task could not be found + portEXIT_CRITICAL(&twdt_spinlock); + return ESP_ERR_NOT_FOUND; +} + +void esp_task_wdt_feed(void) +{ + portENTER_CRITICAL(&twdt_spinlock); + //Return immediately if TWDT has not been initialized + ASSERT_EXIT_CRIT_RETURN((twdt_config != NULL), VOID_RETURN); + + //Check if task is on list + TaskHandle_t handle = xTaskGetCurrentTaskHandle(); + bool all_reset; + twdt_task_t *target_task = find_task_in_twdt_list(handle, &all_reset); + + //reset the task if it's on the list, then return + if(target_task != NULL){ + target_task->has_reset = true; + if(all_reset){ + reset_hw_timer(); //Reset hardware timer if all other tasks have reset + } + portEXIT_CRITICAL(&twdt_spinlock); + return; + } + + //Add task if it's has not on list + target_task = calloc(1, sizeof(twdt_task_t)); + ASSERT_EXIT_CRIT_RETURN((target_task != NULL), VOID_RETURN); //If calloc failed + target_task->task_handle = handle; + target_task->has_reset = true; + target_task->next = NULL; + + if (twdt_config->list == NULL) { //Adding to empty list + twdt_config->list = target_task; + } else { //Adding to tail of list + twdt_task_t *task; + for (task = twdt_config->list; task->next != NULL; task = task->next){ + ; //point task to current tail of wdt task list + } + task->next = target_task; + } + + portEXIT_CRITICAL(&twdt_spinlock); +} + + diff --git a/components/esp32s2beta/test/CMakeLists.txt b/components/esp32s2beta/test/CMakeLists.txt new file mode 100644 index 0000000000..2a333b89f1 --- /dev/null +++ b/components/esp32s2beta/test/CMakeLists.txt @@ -0,0 +1,19 @@ +if(IDF_TARGET STREQUAL "esp32s2beta") + idf_component_register(SRC_DIRS . + INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR} + REQUIRES unity test_utils nvs_flash ulp esp_common + ) + + add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" + COMMAND xxd -i "logo.jpg" "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h" + WORKING_DIRECTORY ${COMPONENT_DIR} + DEPENDS "${CMAKE_CURRENT_LIST_DIR}/logo.jpg") + + add_custom_target(esp32s2beta_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h") + + add_dependencies(${COMPONENT_LIB} esp32s2beta_test_logo) + + idf_build_set_property(COMPILE_DEFINITIONS "-DESP_TIMER_DYNAMIC_OVERFLOW_VAL" APPEND) + target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5") +endif() + diff --git a/components/esp32s2beta/test/component.mk b/components/esp32s2beta/test/component.mk new file mode 100644 index 0000000000..a2f7dc1797 --- /dev/null +++ b/components/esp32s2beta/test/component.mk @@ -0,0 +1,4 @@ +# +# Component Makefile +# +COMPONENT_CONFIG_ONLY := 1 diff --git a/components/esp32s2beta/test/logo.jpg b/components/esp32s2beta/test/logo.jpg new file mode 100644 index 0000000000..2bd9e775ea Binary files /dev/null and b/components/esp32s2beta/test/logo.jpg differ diff --git a/components/esp32s2beta/test/test_libgcc.c b/components/esp32s2beta/test/test_libgcc.c new file mode 100644 index 0000000000..7fca990d48 --- /dev/null +++ b/components/esp32s2beta/test/test_libgcc.c @@ -0,0 +1,185 @@ +#include +#include "unity.h" + +TEST_CASE("libgcc math functions", "[rom]") +{ + extern int64_t __absvdi2(int64_t x); + TEST_ASSERT(__absvdi2(-1L) == 1); + extern int __absvsi2(int x); + TEST_ASSERT(__absvsi2(-1) == 1); + extern double __adddf3(double x, double y); + TEST_ASSERT(__adddf3(1.0, 4.0) == 5.0); + extern float __addsf3(float x, float y); + TEST_ASSERT(__addsf3(1.0f, 4.0f) == 5.0f); + extern int64_t __addvdi3(int64_t x, int64_t y); + TEST_ASSERT(__addvdi3(1L, 4L) == 5L); + extern int __addvsi3(int x, int y); + TEST_ASSERT(__addvsi3(1, 4) == 5); + extern int64_t __ashldi3(int64_t x, int y); + TEST_ASSERT(__ashldi3(1, 4) == 16); + extern int64_t __ashrdi3(int64_t x, int y); + TEST_ASSERT(__ashrdi3(4, 1) == 2); + extern int64_t __bswapdi2(int64_t x); + TEST_ASSERT(__bswapdi2(0xaabbccddeeff0011ULL) == 0x1100ffeeddccbbaaULL); + extern int32_t __bswapsi2(int32_t x); + TEST_ASSERT(__bswapsi2(0xaabbccdd) == 0xddccbbaa); + extern int64_t __clrsbdi2(int64_t x); + TEST_ASSERT(__clrsbdi2(-1) == 63); + extern int __clrsbsi2(int x); + TEST_ASSERT(__clrsbsi2(-1) == 31); + extern int __clzdi2(int64_t x); + TEST_ASSERT(__clzdi2(1) == 63); + extern int __clzsi2(int x); + TEST_ASSERT(__clzsi2(1) == 31); + extern int __cmpdi2(int64_t x, int64_t y); + TEST_ASSERT(__cmpdi2(10, 10) == 1); + extern int __ctzdi2(uint64_t x); + TEST_ASSERT(__ctzdi2(0x8000000000000000ULL) == 63); + extern int __ctzsi2(unsigned x); + TEST_ASSERT(__ctzsi2(0x80000000U) == 31); + extern complex double __divdc3(double a, double b, double c, double d); + TEST_ASSERT(__divdc3(0, 1, 1, 0) == I); + extern double __divdf3(double x, double y); + TEST_ASSERT(__divdf3(16.0, 2.0) == 8.0); + extern int64_t __divdi3(int64_t x, int64_t y); + TEST_ASSERT(__divdi3(16, 2) == 8); + extern complex float __divsc3(float a, float b, float c, float d); + TEST_ASSERT(__divsc3(0, 1, 1, 0) == I); + extern float __divsf3(float x, float y); + TEST_ASSERT(__divsf3(16.0f, 2.0f) == 8.0f); + extern int __divsi3(int x, int y); + TEST_ASSERT(__divsi3(16, 2) == 8); + extern int __eqdf2(double x, double y); + TEST_ASSERT(__eqdf2(4.0, 4.0) == 0); + extern int __eqsf2(float x, float y); + TEST_ASSERT(__eqsf2(4.0f, 4.0f) == 0); + extern double __extendsfdf2(float x); + TEST_ASSERT(__extendsfdf2(4.0f) == 4.0); + extern int __ffsdi2(uint64_t x); + TEST_ASSERT(__ffsdi2(0x8000000000000000ULL) == 64); + extern int __ffssi2(unsigned x); + TEST_ASSERT(__ffssi2(0x80000000) == 32); + extern int64_t __fixdfdi(double x); + TEST_ASSERT(__fixdfdi(4.0) == 4LL); + extern int __fixdfsi(double x); + TEST_ASSERT(__fixdfsi(4.0) == 4); + extern int64_t __fixsfdi(float x); + TEST_ASSERT(__fixsfdi(4.0f) == 4LL); + extern int __fixsfsi(float x); + TEST_ASSERT(__fixsfsi(4.0f) == 4); + extern unsigned __fixunsdfsi(double x); + TEST_ASSERT(__fixunsdfsi(16.0) == 16); + extern uint64_t __fixunssfdi(float x); + TEST_ASSERT(__fixunssfdi(16.0f) == 16); + extern unsigned __fixunssfsi(float x); + TEST_ASSERT(__fixunssfsi(16.0f) == 16); + extern double __floatdidf(int64_t); + TEST_ASSERT(__floatdidf(-1LL) == -1.0f); + extern float __floatdisf(int64_t); + TEST_ASSERT(__floatdisf(-1LL) == -1.0f); + extern double __floatsidf(int x); + TEST_ASSERT(__floatsidf(-1) == -1.0); + extern float __floatsisf(int x); + TEST_ASSERT(__floatsisf(-1) == -1.0f); + extern double __floatundidf(uint64_t x); + TEST_ASSERT(__floatundidf(16) == 16.0); + extern float __floatundisf(uint64_t x); + TEST_ASSERT(__floatundisf(16) == 16.0f); + extern double __floatunsidf(unsigned x); + TEST_ASSERT(__floatunsidf(16) == 16.0); + extern float __floatunsisf(unsigned x); + TEST_ASSERT(__floatunsisf(16) == 16.0f); + extern int __gedf2(double x, double y); + TEST_ASSERT(__gedf2(2.0, 0.0) >= 0); + extern int __gesf2(float x, float y); + TEST_ASSERT(__gesf2(2.0f, 0.0f) >= 0); + extern int __gtdf2(double x, double y); + TEST_ASSERT(__gtdf2(2.0, 0.0) >= 0); + extern int __gtsf2(float x, float y); + TEST_ASSERT(__gtsf2(2.0f, 0.0f) >= 0); + extern int __ledf2(double x, double y); + TEST_ASSERT(__ledf2(0.0, 2.0) <= 0); + extern int __lesf2(float x, float y); + TEST_ASSERT(__lesf2(0.0f, 2.0f) <= 0); + extern int64_t __lshrdi3(int64_t x, int y); + TEST_ASSERT(__lshrdi3(0x8000000000000000LL, 1) == 0x4000000000000000LL); + extern int __ltdf2(double x, double y); + TEST_ASSERT(__ltdf2(0.0, 2.0) < 0); + extern int __ltsf2(float x, float y); + TEST_ASSERT(__ltsf2(0.0f, 2.0f) < 0); + extern int64_t __moddi3(int64_t x, int64_t y); + TEST_ASSERT(__moddi3(15, 2) == 1); + extern int __modsi3(int x, int y); + TEST_ASSERT(__modsi3(15, 2) == 1); + extern complex double __muldc3(double a, double b, double c, double d); + TEST_ASSERT(__muldc3(1.0, 0.0, 0.0, 1.0) == I); + extern double __muldf3(double x, double y); + TEST_ASSERT(__muldf3(2.0, 8.0) == 16.0); + extern int64_t __muldi3(int64_t x, int64_t y); + TEST_ASSERT(__muldi3(2, 8) == 16); + extern complex float __mulsc3 (float a, float b, float c, float d); + TEST_ASSERT(__mulsc3(1.0f, 0.0f, 0.0f, -1.0f) == -I); + extern float __mulsf3 (float a, float b); + TEST_ASSERT(__mulsf3(2.0f, 8.0f) == 16.0f); + extern int __mulsi3(int x, int y); + TEST_ASSERT(__mulsi3(2, 8) == 16); + extern int __mulvdi3(int64_t x, int64_t y); + TEST_ASSERT(__mulvdi3(2, 8) == 16); + extern int __mulvsi3(int x, int y); + TEST_ASSERT(__mulvsi3(2, 8) == 16); + extern int __nedf2(double x, double y); + TEST_ASSERT(__nedf2(2.0, 2.0) == 0); + extern double __negdf2(double x); + TEST_ASSERT(__negdf2(1.0) == -1.0); + extern int64_t __negdi2(int64_t x); + TEST_ASSERT(__negdi2(-1LL) == 1); + extern float __negsf2(float x); + TEST_ASSERT(__negsf2(-1.0f) == 1.0f); + extern int64_t __negvdi2(int64_t x); + TEST_ASSERT(__negvdi2(-1LL) == 1); + extern int __negvsi2(int x); + TEST_ASSERT(__negvsi2(-1) == 1); + extern int __nesf2(float x, float y); + TEST_ASSERT(__nesf2(2.0, 0.0) != 0); + extern int __paritysi2(unsigned x); + TEST_ASSERT(__paritysi2(0x10101010) == 0); + extern int __popcountdi2(uint64_t); + TEST_ASSERT(__popcountdi2(0xaaaaaaaa11111111ULL) == 24); + extern int __popcountsi2(unsigned x); + TEST_ASSERT(__popcountsi2(0x11111111) == 8); + extern double __powidf2(double x, int y); + TEST_ASSERT(__powidf2(2.0, -1) == 0.5); + extern float __powisf2(float x, int y); + TEST_ASSERT(__powisf2(2.0f, 2) == 4.0f); + extern double __subdf3(double x, double y); + TEST_ASSERT(__subdf3(2.0, 1.0) == 1.0); + extern float __subsf3(float x, float y); + TEST_ASSERT(__subsf3(5.0f, 4.0f) == 1.0f); + extern int64_t __subvdi3(int64_t x, int64_t y); + TEST_ASSERT(__subvdi3(-1LL, -1LL) == 0); + extern int __subvsi3(int x, int y); + TEST_ASSERT(__subvsi3(-1, -1) == 0); + extern float __truncdfsf2(double x); + TEST_ASSERT(__truncdfsf2(4.0) == 4.0f); + extern int __ucmpdi2(uint64_t x, uint64_t y); + TEST_ASSERT(__ucmpdi2(0x100000000ULL, 0x100000000ULL) == 1); + extern uint64_t __udivdi3(uint64_t x, uint64_t y); + TEST_ASSERT(__udivdi3(15, 2) == 7); + extern uint64_t __udivmoddi4(uint64_t x, uint64_t y, uint64_t* z); + uint64_t z; + TEST_ASSERT(__udivmoddi4(15, 2, &z) == 7); + TEST_ASSERT(z == 1); + extern unsigned __udivsi3(unsigned x, unsigned y); + TEST_ASSERT(__udivsi3(15, 2) == 7); + extern uint64_t __umoddi3(uint64_t x, uint64_t y); + TEST_ASSERT(__umoddi3(15, 2) == 1); + extern unsigned __umodsi3(unsigned x, unsigned y); + TEST_ASSERT(__umodsi3(15, 2) == 1); + extern uint64_t __umulsidi3(unsigned x, unsigned y); + TEST_ASSERT(__umulsidi3(0x10000000, 0x10000000) == 0x100000000000000ULL); + extern int __unorddf2(double x, double y); + TEST_ASSERT(__unorddf2(1.0, 2.0) == 0); + extern int __unordsf2(float x, float y); + TEST_ASSERT(__unordsf2(2.0f, 1.0f) == 0); + +} diff --git a/components/esp32s2beta/test/test_spiram_cache_flush.c b/components/esp32s2beta/test/test_spiram_cache_flush.c new file mode 100644 index 0000000000..fe89a7f52f --- /dev/null +++ b/components/esp32s2beta/test/test_spiram_cache_flush.c @@ -0,0 +1,182 @@ +/* +This code tests the interaction between PSRAM and SPI flash routines. +*/ + +#include +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" +#include "freertos/queue.h" +#include "freertos/xtensa_api.h" +#include "unity.h" +#include "soc/dport_reg.h" +#include "soc/io_mux_reg.h" +#include +#include +#include +#include +#include "esp_heap_caps.h" +#include "esp_spi_flash.h" +#include "esp_partition.h" +#include "test_utils.h" + +#if CONFIG_SPIRAM + +#if CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC +#define USE_CAPS_ALLOC 1 +#endif // CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC + +#define TSTSZ (16*1024) + +#if !CONFIG_FREERTOS_UNICORE + +volatile static int res[2], err[2]; + +void tstMem(void *arg) { + volatile unsigned char *mem=(volatile unsigned char*)arg; + int p=0; + while(1) { + for (int i=0; i #include #include "esp_err.h" - -// Include SoC-specific definitions. Only ESP32 supported for now. +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/pm.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/pm.h" +#endif #ifdef __cplusplus extern "C" { diff --git a/components/esp_common/include/esp_system.h b/components/esp_common/include/esp_system.h index 5e4fe882ff..46c2b88350 100644 --- a/components/esp_common/include/esp_system.h +++ b/components/esp_common/include/esp_system.h @@ -38,7 +38,11 @@ typedef enum { /** @cond */ #define TWO_UNIVERSAL_MAC_ADDR 2 #define FOUR_UNIVERSAL_MAC_ADDR 4 +#if CONFIG_IDF_TARGET_ESP32 #define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES +#endif /** @endcond */ /** @@ -232,7 +236,8 @@ esp_err_t esp_derive_local_mac(uint8_t* local_mac, const uint8_t* universal_mac) * @brief Chip models */ typedef enum { - CHIP_ESP32 = 1, //!< ESP32 + CHIP_ESP32 = 1, //!< ESP32 + CHIP_ESP32S2BETA = 2, //!< ESP32-S2 Beta } esp_chip_model_t; /* Chip feature flags, used in esp_chip_info_t */ diff --git a/components/esp_common/src/dbg_stubs.c b/components/esp_common/src/dbg_stubs.c index e0389ce1d6..b57ef43926 100644 --- a/components/esp_common/src/dbg_stubs.c +++ b/components/esp_common/src/dbg_stubs.c @@ -21,7 +21,7 @@ #include "esp_private/dbg_stubs.h" #include "esp_attr.h" -#if CONFIG_ESP32_DEBUG_STUBS_ENABLE +#if CONFIG_ESP32_DEBUG_STUBS_ENABLE || CONFIG_ESP32S2_DEBUG_STUBS_ENABLE /* Debug stubs is actually a table of 4-byte entries. Every entry is equal to zero or must contain meaningfull data. The first entry is a service one and has the followinf format: diff --git a/components/esp_common/src/esp_err_to_name.c b/components/esp_common/src/esp_err_to_name.c index 12b5e21cb9..e234a26b19 100644 --- a/components/esp_common/src/esp_err_to_name.c +++ b/components/esp_common/src/esp_err_to_name.c @@ -5,9 +5,6 @@ #if __has_include("soc/soc.h") #include "soc/soc.h" #endif -#if __has_include("esp32/ulp.h") -#include "esp32/ulp.h" -#endif #if __has_include("esp_efuse.h") #include "esp_efuse.h" #endif @@ -56,6 +53,9 @@ #if __has_include("tcpip_adapter.h") #include "tcpip_adapter.h" #endif +#if __has_include("ulp_common.h") +#include "ulp_common.h" +#endif #ifdef CONFIG_ESP_ERR_TO_NAME_LOOKUP #define ERR_TBL_IT(err) {err, #err} @@ -203,7 +203,7 @@ static const esp_err_msg_t esp_err_msg_table[] = { API functions. NVS key is different in comparison */ # endif - // components/ulp/include/esp32/ulp.h + // components/ulp/include/ulp_common.h # ifdef ESP_ERR_ULP_BASE ERR_TBL_IT(ESP_ERR_ULP_BASE), /* 4608 0x1200 Offset for ULP-related error codes */ # endif diff --git a/components/esp_common/src/ets_timer_legacy.c b/components/esp_common/src/ets_timer_legacy.c index 506f2c53c1..c08ecf3dd1 100644 --- a/components/esp_common/src/ets_timer_legacy.c +++ b/components/esp_common/src/ets_timer_legacy.c @@ -24,7 +24,6 @@ #include "esp_log.h" #include "esp_attr.h" #include "esp_intr_alloc.h" -#include "esp32/rom/ets_sys.h" #include "soc/frc_timer_reg.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -33,6 +32,11 @@ #include "sdkconfig.h" #include "esp_timer.h" #include "esp_private/esp_timer_impl.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#endif /* We abuse 'timer_arg' field of ETSTimer structure to hold a pointer to esp_timer */ #define ESP_TIMER(p_ets_timer) ((esp_timer_handle_t) (p_ets_timer)->timer_arg) diff --git a/components/esp_eth/CMakeLists.txt b/components/esp_eth/CMakeLists.txt index 8547a49e32..73f559e5b7 100644 --- a/components/esp_eth/CMakeLists.txt +++ b/components/esp_eth/CMakeLists.txt @@ -1,24 +1,34 @@ -set(esp_eth_srcs "src/esp_eth.c" - "src/esp_eth_phy_dp83848.c" - "src/esp_eth_phy_ip101.c" - "src/esp_eth_phy_lan8720.c" - "src/esp_eth_phy_rtl8201.c") +set(srcs) # If ethernet disabled in Kconfig, this is a config-only component +set(include) +set(linker) -if(CONFIG_ETH_USE_ESP32_EMAC) - list(APPEND esp_eth_srcs "src/esp_eth_mac_esp32.c") -endif() +if(CONFIG_ETH_ENABLED) + set(srcs "src/esp_eth.c") + set(include "include") + set(linker "linker.lf") -if(CONFIG_ETH_SPI_ETHERNET_DM9051) - list(APPEND esp_eth_srcs "src/esp_eth_mac_dm9051.c" - "src/esp_eth_phy_dm9051.c") + if(CONFIG_ETH_USE_ESP32_EMAC) + list(APPEND srcs "src/esp_eth_mac_esp32.c" + "src/esp_eth_phy_dp83848.c" + "src/esp_eth_phy_ip101.c" + "src/esp_eth_phy_lan8720.c" + "src/esp_eth_phy_rtl8201.c" + ) + endif() + + if(CONFIG_ETH_SPI_ETHERNET_DM9051) + list(APPEND srcs "src/esp_eth_mac_dm9051.c" + "src/esp_eth_phy_dm9051.c") + endif() endif() if(CONFIG_ETH_USE_OPENETH) - list(APPEND esp_eth_srcs "src/esp_eth_mac_openeth.c") + list(APPEND srcs "src/esp_eth_mac_openeth.c") endif() -idf_component_register(SRCS "${esp_eth_srcs}" - INCLUDE_DIRS "include" - LDFRAGMENTS "linker.lf" - REQUIRES "esp_event" - PRIV_REQUIRES "tcpip_adapter" "driver" "log") +idf_component_register(SRCS "${srcs}" + INCLUDE_DIRS ${include} + LDFRAGMENTS ${linker} + REQUIRES "esp_event" + PRIV_REQUIRES "tcpip_adapter" "driver" "log") + diff --git a/components/esp_eth/Kconfig b/components/esp_eth/Kconfig index 63ee869368..9988d995ed 100644 --- a/components/esp_eth/Kconfig +++ b/components/esp_eth/Kconfig @@ -1,9 +1,15 @@ menu "Ethernet" + # Invisible item that is enabled if any Ethernet + # selection is made + config ETH_ENABLED + bool + menuconfig ETH_USE_ESP32_EMAC depends on IDF_TARGET_ESP32 bool "Support ESP32 internal EMAC controller" default y + select ETH_ENABLED help ESP32 integrates a 10/100M Ethernet MAC controller. @@ -132,8 +138,9 @@ menu "Ethernet" menuconfig ETH_USE_SPI_ETHERNET bool "Support SPI to Ethernet Module" default y + select ETH_ENABLED help - ESP-IDF can also support some SPI-Ethernet module. + ESP-IDF can also support some SPI-Ethernet modules. if ETH_USE_SPI_ETHERNET menuconfig ETH_SPI_ETHERNET_DM9051 diff --git a/components/esp_eth/test/CMakeLists.txt b/components/esp_eth/test/CMakeLists.txt index c4041b1feb..789ab04cd1 100644 --- a/components/esp_eth/test/CMakeLists.txt +++ b/components/esp_eth/test/CMakeLists.txt @@ -1,3 +1,5 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." - PRIV_REQUIRES "unity" "test_utils" "esp_eth") +if(IDF_TARGET STREQUAL "esp32") + idf_component_register(SRC_DIRS . + INCLUDE_DIRS . + PRIV_REQUIRES unity test_utils esp_eth) +endif() diff --git a/components/esp_event/CMakeLists.txt b/components/esp_event/CMakeLists.txt index 6768a3cdf3..da463ff1fc 100644 --- a/components/esp_event/CMakeLists.txt +++ b/components/esp_event/CMakeLists.txt @@ -1,3 +1,9 @@ +if(IDF_TARGET STREQUAL "esp32") + set(priv_requires esp_eth) +else() + set(priv_requires) +endif() + idf_component_register(SRCS "default_event_loop.c" "esp_event.c" "esp_event_private.c" @@ -6,7 +12,7 @@ idf_component_register(SRCS "default_event_loop.c" INCLUDE_DIRS "include" PRIV_INCLUDE_DIRS "private_include" REQUIRES log tcpip_adapter - PRIV_REQUIRES esp_eth + PRIV_REQUIRES ${priv_requires} LDFRAGMENTS linker.lf) if(GCC_NOT_5_2_0 AND CONFIG_ESP_EVENT_LOOP_PROFILING) diff --git a/components/esp_event/event_send_compat.inc b/components/esp_event/event_send_compat.inc index eff799975b..721e8cd82b 100644 --- a/components/esp_event/event_send_compat.inc +++ b/components/esp_event/event_send_compat.inc @@ -17,7 +17,9 @@ #include "esp_event_legacy.h" #include "esp_wifi_types.h" #include "tcpip_adapter.h" +#if CONFIG_ETH_ENABLED #include "esp_eth.h" +#endif /** * The purpose of this file is to provide an "esp_event_send_to_default_loop" @@ -36,8 +38,7 @@ * default_event_loop.c is linked, this file is #include-ed into default_event_loop.c. */ -//#if LOG_LOCAL_LEVEL >= 4 /* ESP_LOG_DEBUG */ -#if 1 +#if LOG_LOCAL_LEVEL >= 4 /* ESP_LOG_DEBUG */ #define WITH_EVENT_DEBUG #endif @@ -88,7 +89,7 @@ esp_err_t esp_event_send_to_default_loop(system_event_t *event) HANDLE_SYS_EVENT_ARG(WIFI, AP_STACONNECTED, sta_connected); HANDLE_SYS_EVENT_ARG(WIFI, AP_STADISCONNECTED, sta_disconnected); HANDLE_SYS_EVENT_ARG(WIFI, AP_PROBEREQRECVED, ap_probereqrecved); - +#if CONFIG_ETH_ENABLED /* Ethernet events */ /* Some extra defines to fit the old naming scheme... */ #define ETH_EVENT_ETH_START ETHERNET_EVENT_START @@ -100,7 +101,7 @@ esp_err_t esp_event_send_to_default_loop(system_event_t *event) HANDLE_SYS_EVENT(ETH, ETH_STOP); HANDLE_SYS_EVENT(ETH, ETH_CONNECTED); HANDLE_SYS_EVENT(ETH, ETH_DISCONNECTED); - +#endif /* IP events */ HANDLE_SYS_EVENT_ARG(IP, STA_GOT_IP, got_ip); HANDLE_SYS_EVENT_ARG(IP, ETH_GOT_IP, got_ip); @@ -120,9 +121,9 @@ typedef struct { int err; const char *reason; } wifi_reason_t; - + static const wifi_reason_t wifi_reason[] = -{ +{ {0, "other reason"}, {WIFI_REASON_UNSPECIFIED, "unspecified"}, {WIFI_REASON_AUTH_EXPIRE, "auth expire"}, @@ -151,9 +152,9 @@ static const wifi_reason_t wifi_reason[] = {WIFI_REASON_UNSUPP_RSN_IE_VERSION, "unsupported RSN IE version"}, {WIFI_REASON_INVALID_RSN_IE_CAP, "invalid RSN IE capability"}, {WIFI_REASON_802_1X_AUTH_FAILED, "802.1x auth failed"}, - {WIFI_REASON_CIPHER_SUITE_REJECTED, "cipher suite rejected"} + {WIFI_REASON_CIPHER_SUITE_REJECTED, "cipher suite rejected"} }; - + static const char* wifi_disconnect_reason_to_str(int err) { for (int i=0; i< sizeof(wifi_reason)/sizeof(wifi_reason[0]); i++){ @@ -282,6 +283,7 @@ static void esp_system_event_debug(const system_event_t* event) IP6_ADDR_BLOCK8(addr)); break; } +#if CONFIG_IDF_TARGET_ESP32 case SYSTEM_EVENT_ETH_START: { ESP_LOGD(TAG, "SYSTEM_EVENT_ETH_START"); break; @@ -306,6 +308,7 @@ static void esp_system_event_debug(const system_event_t* event) IP2STR(&got_ip->ip_info.gw)); break; } +#endif default: { ESP_LOGW(TAG, "unexpected system event %d!", event->event_id); break; diff --git a/components/esp_event/test/CMakeLists.txt b/components/esp_event/test/CMakeLists.txt index 8264f10dda..79398640b5 100644 --- a/components/esp_event/test/CMakeLists.txt +++ b/components/esp_event/test/CMakeLists.txt @@ -1,3 +1,8 @@ -idf_component_register(SRC_DIRS "." - PRIV_INCLUDE_DIRS "../private_include" "." - REQUIRES unity test_utils esp_event driver) +set(srcdirs .) +if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcdirs "esp32") +endif() + +idf_component_register(SRC_DIRS ${srcdirs} + PRIV_INCLUDE_DIRS . ../private_include + PRIV_REQUIRES unity test_utils esp_event driver) diff --git a/components/esp_event/test/component.mk b/components/esp_event/test/component.mk index 22e49eddde..d74f156e8e 100644 --- a/components/esp_event/test/component.mk +++ b/components/esp_event/test/component.mk @@ -1,5 +1,7 @@ # #Component Makefile # + +COMPONENT_SRCDIRS += esp32 COMPONENT_PRIV_INCLUDEDIRS := ../private_include . COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive \ No newline at end of file diff --git a/components/esp_event/test/test_event.c b/components/esp_event/test/esp32/test_event.c similarity index 93% rename from components/esp_event/test/test_event.c rename to components/esp_event/test/esp32/test_event.c index c016f48f3c..181441c182 100644 --- a/components/esp_event/test/test_event.c +++ b/components/esp_event/test/esp32/test_event.c @@ -278,40 +278,6 @@ static void test_teardown(void) #define TIMER_SCALE (TIMER_BASE_CLK / TIMER_DIVIDER) // convert counter value to seconds #define TIMER_INTERVAL0_SEC (2.0) // sample test interval for the first timer -#if CONFIG_ESP_EVENT_POST_FROM_ISR -static void test_handler_post_from_isr(void* event_handler_arg, esp_event_base_t event_base, int32_t event_id, void* event_data) -{ - SemaphoreHandle_t *sem = (SemaphoreHandle_t*) event_handler_arg; - // Event data is just the address value (maybe have been truncated due to casting). - int *data = (int*) event_data; - TEST_ASSERT_EQUAL(*data, (int) (*sem)); - xSemaphoreGive(*sem); -} -#endif - -#if CONFIG_ESP_EVENT_POST_FROM_ISR -void IRAM_ATTR test_event_on_timer_alarm(void* para) -{ - /* Retrieve the interrupt status and the counter value - from the timer that reported the interrupt */ - uint64_t timer_counter_value = - timer_group_get_counter_value_in_isr(TIMER_GROUP_0, TIMER_0); - timer_group_intr_clr_in_isr(TIMER_GROUP_0, TIMER_0); - timer_counter_value += (uint64_t) (TIMER_INTERVAL0_SEC * TIMER_SCALE); - timer_group_set_alarm_value_in_isr(TIMER_GROUP_0, TIMER_0, timer_counter_value); - - int data = (int) para; - // Posting events with data more than 4 bytes should fail. - TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_event_isr_post(s_test_base1, TEST_EVENT_BASE1_EV1, &data, 5, NULL)); - // This should succeedd, as data is int-sized. The handler for the event checks that the passed event data - // is correct. - BaseType_t task_unblocked; - TEST_ASSERT_EQUAL(ESP_OK, esp_event_isr_post(s_test_base1, TEST_EVENT_BASE1_EV1, &data, sizeof(data), &task_unblocked)); - if (task_unblocked == pdTRUE) { - portYIELD_FROM_ISR(); - } -} -#endif //CONFIG_ESP_EVENT_POST_FROM_ISR TEST_CASE("can create and delete event loops", "[event]") { @@ -859,11 +825,11 @@ static void performance_test(bool dedicated_task) // Enabling profiling will slow down event dispatch, so the set threshold // is not valid when it is enabled. #else -#ifndef CONFIG_ESP32_SPIRAM_SUPPORT +#ifndef CONFIG_SPIRAM TEST_PERFORMANCE_GREATER_THAN(EVENT_DISPATCH, "%d", average); #else TEST_PERFORMANCE_GREATER_THAN(EVENT_DISPATCH_PSRAM, "%d", average); -#endif // CONFIG_ESP32_SPIRAM_SUPPORT +#endif // CONFIG_SPIRAM #endif // CONFIG_ESP_EVENT_LOOP_PROFILING } @@ -872,7 +838,7 @@ TEST_CASE("performance test - dedicated task", "[event]") performance_test(true); } -TEST_CASE("performance test - no dedicated task", "[event]") +TEST_CASE_ESP32("performance test - no dedicated task", "[event]") { performance_test(false); } @@ -1184,42 +1150,7 @@ TEST_CASE("can properly prepare event data posted to loop", "[event]") TEST_TEARDOWN(); } -TEST_CASE("can post events from interrupt handler", "[event]") -{ - SemaphoreHandle_t sem = xSemaphoreCreateBinary(); - - /* Select and initialize basic parameters of the timer */ - timer_config_t config; - config.divider = TIMER_DIVIDER; - config.counter_dir = TIMER_COUNT_UP; - config.counter_en = TIMER_PAUSE; - config.alarm_en = TIMER_ALARM_EN; - config.intr_type = TIMER_INTR_LEVEL; - config.auto_reload = false; - timer_init(TIMER_GROUP_0, TIMER_0, &config); - - /* Timer's counter will initially start from value below. - Also, if auto_reload is set, this value will be automatically reload on alarm */ - timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0x00000000ULL); - - /* Configure the alarm value and the interrupt on alarm. */ - timer_set_alarm_value(TIMER_GROUP_0, TIMER_0, TIMER_INTERVAL0_SEC * TIMER_SCALE); - timer_enable_intr(TIMER_GROUP_0, TIMER_0); - timer_isr_register(TIMER_GROUP_0, TIMER_0, test_event_on_timer_alarm, - (void *) sem, ESP_INTR_FLAG_IRAM, NULL); - - timer_start(TIMER_GROUP_0, TIMER_0); - - TEST_SETUP(); - - TEST_ASSERT_EQUAL(ESP_OK, esp_event_handler_register(s_test_base1, TEST_EVENT_BASE1_EV1, - test_handler_post_from_isr, &sem)); - - xSemaphoreTake(sem, portMAX_DELAY); - - TEST_TEARDOWN(); -} -#endif +#endif // CONFIG_ESP_EVENT_POST_FROM_ISR #ifdef CONFIG_ESP_EVENT_LOOP_PROFILING TEST_CASE("can dump event loop profile", "[event]") @@ -1273,4 +1204,4 @@ TEST_CASE("can dump event loop profile", "[event]") TEST_TEARDOWN(); } -#endif +#endif // CONFIG_ESP_EVENT_LOOP_PROFILING diff --git a/components/esp_gdbstub/esp32/gdbstub_esp32.c b/components/esp_gdbstub/esp32/gdbstub_esp32.c index 98a6454acd..a3f87ca7bb 100644 --- a/components/esp_gdbstub/esp32/gdbstub_esp32.c +++ b/components/esp_gdbstub/esp32/gdbstub_esp32.c @@ -17,7 +17,7 @@ #include "esp_gdbstub_common.h" #include "sdkconfig.h" -#define UART_NUM CONFIG_CONSOLE_UART_NUM +#define UART_NUM CONFIG_ESP_CONSOLE_UART_NUM void esp_gdbstub_target_init(void) { diff --git a/components/esp_gdbstub/esp32s2beta/gdbstub_esp32s2beta.c b/components/esp_gdbstub/esp32s2beta/gdbstub_esp32s2beta.c new file mode 100644 index 0000000000..7bf60cf702 --- /dev/null +++ b/components/esp_gdbstub/esp32s2beta/gdbstub_esp32s2beta.c @@ -0,0 +1,51 @@ +// 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. + +#include "soc/uart_periph.h" +#include "soc/gpio_periph.h" +#include "esp_gdbstub_common.h" +#include "sdkconfig.h" + +#define UART_NUM CONFIG_ESP_CONSOLE_UART_NUM + +void esp_gdbstub_target_init() +{ +} + +int esp_gdbstub_getchar() +{ + while (REG_GET_FIELD(UART_STATUS_REG(UART_NUM), UART_RXFIFO_CNT) == 0) { + ; + } + return REG_READ(UART_FIFO_AHB_REG(UART_NUM)); +} + +void esp_gdbstub_putchar(int c) +{ + while (REG_GET_FIELD(UART_STATUS_REG(UART_NUM), UART_TXFIFO_CNT) >= 126) { + ; + } + REG_WRITE(UART_FIFO_AHB_REG(UART_NUM), c); +} + +int esp_gdbstub_readmem(intptr_t addr) +{ + if (addr < 0x20000000 || addr >= 0x80000000) { + /* see cpu_configure_region_protection */ + return -1; + } + uint32_t val_aligned = *(uint32_t *)(addr & (~3)); + uint32_t shift = (addr & 3) * 8; + return (val_aligned >> shift) & 0xff; +} diff --git a/components/esp_gdbstub/esp32s2beta/gdbstub_target_config.h b/components/esp_gdbstub/esp32s2beta/gdbstub_target_config.h new file mode 100644 index 0000000000..0b15671ea1 --- /dev/null +++ b/components/esp_gdbstub/esp32s2beta/gdbstub_target_config.h @@ -0,0 +1,18 @@ +// Copyright 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. + +#pragma once + +/* Number of extra TIE defined registers, not listed in the XCHAL */ +#define GDBSTUB_EXTRA_TIE_SIZE 1 diff --git a/components/esp_gdbstub/linker.lf b/components/esp_gdbstub/linker.lf index 7093ea8b2a..8364565817 100644 --- a/components/esp_gdbstub/linker.lf +++ b/components/esp_gdbstub/linker.lf @@ -1,7 +1,7 @@ [mapping:esp_gdbstub] archive: libesp_gdbstub.a -entries: - if ESP32_PANIC_HANDLER_IRAM = y: +entries: + if ESP_PANIC_HANDLER_IRAM = y: * (noflash_text) else: * (default) \ No newline at end of file diff --git a/components/esp_rom/CMakeLists.txt b/components/esp_rom/CMakeLists.txt index 2c903a5100..39f08ceb0a 100644 --- a/components/esp_rom/CMakeLists.txt +++ b/components/esp_rom/CMakeLists.txt @@ -1,11 +1,17 @@ +idf_build_get_property(target IDF_TARGET) + if(BOOTLOADER_BUILD) # For bootloader, all we need is headers idf_component_register(INCLUDE_DIRS include) set(scripts - "esp32/ld/esp32.rom.ld" - "esp32/ld/esp32.rom.newlib-funcs.ld" - "esp32/ld/esp32.rom.libgcc.ld" + "${target}/ld/${target}.rom.ld" + "${target}/ld/${target}.rom.newlib-funcs.ld" + "${target}/ld/${target}.rom.libgcc.ld" ) + if (target STREQUAL "esp32s2beta") + list(APPEND scripts "esp32s2beta/ld/esp32s2beta.rom.spiflash.ld") + endif() + target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}") else() # Regular app build @@ -13,26 +19,38 @@ else() INCLUDE_DIRS include) set(scripts - "esp32/ld/esp32.rom.ld" - "esp32/ld/esp32.rom.libgcc.ld" - "esp32/ld/esp32.rom.syscalls.ld" - "esp32/ld/esp32.rom.newlib-data.ld" - ) + "${target}/ld/${target}.rom.ld" + "${target}/ld/${target}.rom.libgcc.ld" + "${target}/ld/${target}.rom.newlib-data.ld") + + if (target STREQUAL "esp32") + list(APPEND scripts "${target}/ld/${target}.rom.syscalls.ld") + + if(NOT CONFIG_SPIRAM_CACHE_WORKAROUND) + list(APPEND scripts "esp32/ld/esp32.rom.newlib-funcs.ld") + endif() + + if(CONFIG_NEWLIB_NANO_FORMAT) + list(APPEND scripts "esp32/ld/esp32.rom.newlib-nano.ld") + endif() + + if(NOT GCC_NOT_5_2_0) + list(APPEND scripts "esp32/ld/esp32.rom.newlib-locale.ld") + endif() + + if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH) + list(APPEND scripts "esp32/ld/esp32.rom.spiflash.ld") + endif() + + elseif(target STREQUAL "esp32s2beta") + # no SPIRAM workaround for esp32s2beta + # no nano formatting function in ROM + # no GCC 5.2.0 for esp32s2beta, hence not linking locale functions + + list(APPEND scripts "esp32s2beta/ld/esp32s2beta.rom.newlib-funcs.ld" + "esp32s2beta/ld/esp32s2beta.rom.spiflash.ld") + endif() + target_linker_script(${COMPONENT_LIB} INTERFACE "${scripts}") - if(NOT CONFIG_SPIRAM_CACHE_WORKAROUND) - target_linker_script(${COMPONENT_LIB} INTERFACE "esp32/ld/esp32.rom.newlib-funcs.ld") - endif() - - if(CONFIG_NEWLIB_NANO_FORMAT) - target_linker_script(${COMPONENT_LIB} INTERFACE "esp32/ld/esp32.rom.newlib-nano.ld") - endif() - - if(NOT GCC_NOT_5_2_0) - target_linker_script(${COMPONENT_LIB} INTERFACE "esp32/ld/esp32.rom.newlib-locale.ld") - endif() - - if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH) - target_linker_script(${COMPONENT_LIB} INTERFACE "esp32/ld/esp32.rom.spiflash.ld") - endif() endif() diff --git a/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.ld b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.ld new file mode 100644 index 0000000000..ee0b7332f6 --- /dev/null +++ b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.ld @@ -0,0 +1,968 @@ +/* +ESP32C ROM address table +Generated for ROM with MD5sum: +f054d40c5f6b9207d3827460a6f5748c /home/jack/esp-rom/rom//.output/eagle/release/image/eagle.pro.rom.out +*/ +PROVIDE ( abs = 0x4000073c ); +PROVIDE ( acm_config_descr = 0x3ffae859 ); +PROVIDE ( acm_usb_descriptors = 0x3ffae7b0 ); +PROVIDE ( app_gpio_arg = 0x3fffc9b4 ); +PROVIDE ( app_gpio_handler = 0x3fffc9b8 ); +PROVIDE ( __ascii_mbtowc = 0x40007de0 ); +PROVIDE ( __ascii_wctomb = 0x40001cac ); +PROVIDE ( __assert = 0x4001565c ); +PROVIDE ( __assert_func = 0x40015634 ); +PROVIDE ( atoi = 0x40000adc ); +PROVIDE ( _atoi_r = 0x40000aec ); +PROVIDE ( atol = 0x40000b04 ); +PROVIDE ( _atol_r = 0x40000b14 ); +PROVIDE ( boot_prepare = 0x4000c020 ); +PROVIDE ( bzero = 0x40007ca4 ); +PROVIDE ( Cache_Address_Through_DCache = 0x40013b50 ); +PROVIDE ( Cache_Address_Through_ICache = 0x40013b10 ); +PROVIDE ( Cache_Allocate_SRAM = 0x4001399c ); +PROVIDE ( Cache_Clean_Addr = 0x40013d80 ); +PROVIDE ( Cache_Clean_All = 0x40013e08 ); +PROVIDE ( Cache_Clean_Items = 0x40013c8c ); +PROVIDE ( Cache_Config_DCache_Autoload = 0x40014148 ); +PROVIDE ( Cache_Config_ICache_Autoload = 0x4001401c ); +PROVIDE ( Cache_Count_Flash_Pages = 0x400147c0 ); +PROVIDE ( Cache_Dbus_MMU_Set = 0x4001468c ); +PROVIDE ( Cache_DCache_Preload_Done = 0x40013fe8 ); +PROVIDE ( Cache_Disable_DCache = 0x40014474 ); +PROVIDE ( Cache_Disable_DCache_Autoload = 0x40014240 ); +PROVIDE ( Cache_Disable_DCache_Lock = 0x400143c8 ); +PROVIDE ( Cache_Disable_ICache = 0x40014438 ); +PROVIDE ( Cache_Disable_ICache_Autoload = 0x40014114 ); +PROVIDE ( Cache_Disable_ICache_Lock = 0x400142e0 ); +PROVIDE ( Cache_Drom0_Source_DCache = 0x400138f8 ); +PROVIDE ( Cache_Drom0_Source_ICache = 0x400138d0 ); +PROVIDE ( Cache_Drom0_Using_DCache = 0x40013940 ); +PROVIDE ( Cache_Drom0_Using_ICache = 0x40013920 ); +PROVIDE ( Cache_Enable_DCache = 0x40014564 ); +PROVIDE ( Cache_Enable_DCache_Autoload = 0x40014228 ); +PROVIDE ( Cache_Enable_DCache_Lock = 0x4001435c ); +PROVIDE ( Cache_Enable_ICache = 0x40014504 ); +PROVIDE ( Cache_Enable_ICache_Autoload = 0x400140fc ); +PROVIDE ( Cache_Enable_ICache_Lock = 0x40014274 ); +PROVIDE ( Cache_End_DCache_Preload = 0x40013ffc ); +PROVIDE ( Cache_End_ICache_Preload = 0x40013f7c ); +PROVIDE ( Cache_Flash_To_SPIRAM_Copy = 0x40014814 ); +PROVIDE ( Cache_Get_DCache_Line_Size = 0x4001397c ); +PROVIDE ( Cache_Get_ICache_Line_Size = 0x40013960 ); +PROVIDE ( Cache_Get_Memory_Addr = 0x40014b14 ); +PROVIDE ( Cache_Get_Memory_BaseAddr = 0x40014abc ); +PROVIDE ( Cache_Get_Memory_value = 0x40014b50 ); +PROVIDE ( Cache_Get_Mode = 0x40013a00 ); +PROVIDE ( Cache_Get_Virtual_Addr = 0x40014a1c ); +PROVIDE ( Cache_Ibus_MMU_Set = 0x4001459c ); +PROVIDE ( Cache_ICache_Preload_Done = 0x40013f68 ); +PROVIDE ( Cache_Invalidate_Addr = 0x40013d20 ); +PROVIDE ( Cache_Invalidate_DCache_All = 0x40013dfc ); +PROVIDE ( Cache_Invalidate_DCache_Items = 0x40013c44 ); +PROVIDE ( Cache_Invalidate_ICache_All = 0x40013df0 ); +PROVIDE ( Cache_Invalidate_ICache_Items = 0x40013bf4 ); +PROVIDE ( Cache_Mask_All = 0x40013e28 ); +PROVIDE ( cache_memory_baseaddrs = 0x3ffae8c8 ); +PROVIDE ( Cache_MMU_Init = 0x40014578 ); +PROVIDE ( Cache_Resume_DCache = 0x40014548 ); +PROVIDE ( Cache_Resume_DCache_Autoload = 0x40013ee8 ); +PROVIDE ( Cache_Resume_ICache = 0x400144e8 ); +PROVIDE ( Cache_Resume_ICache_Autoload = 0x40013ea0 ); +PROVIDE ( Cache_Set_DCache_Mode = 0x40013aa8 ); +PROVIDE ( Cache_Set_Default_Mode = 0x40013b8c ); +PROVIDE ( Cache_Set_ICache_Mode = 0x40013a58 ); +PROVIDE ( Cache_Start_DCache_Preload = 0x40013f90 ); +PROVIDE ( Cache_Start_ICache_Preload = 0x40013f10 ); +PROVIDE ( Cache_Suspend_DCache = 0x40014510 ); +PROVIDE ( Cache_Suspend_DCache_Autoload = 0x40013ebc ); +PROVIDE ( Cache_Suspend_ICache = 0x400144b0 ); +PROVIDE ( Cache_Suspend_ICache_Autoload = 0x40013e74 ); +PROVIDE ( Cache_Travel_Tag_Memory = 0x400148d0 ); +PROVIDE ( Cache_Unlock_DCache = 0x400143ec ); +PROVIDE ( Cache_Unlock_ICache = 0x40014304 ); +PROVIDE ( Cache_UnMask_Drom0 = 0x40013e50 ); +PROVIDE ( Cache_WriteBack_Addr = 0x40013db8 ); +PROVIDE ( Cache_WriteBack_All = 0x40013e14 ); +PROVIDE ( Cache_WriteBack_Items = 0x40013cd4 ); +PROVIDE ( cacl_rtc_memory_crc = 0x4000cc9c ); +PROVIDE ( calloc = 0x40015520 ); +PROVIDE ( _calloc_r = 0x40015234 ); +PROVIDE ( cdc_acm_class_handle_req = 0x4000fc74 ); +PROVIDE ( cdc_acm_config = 0x3fffc260 ); +PROVIDE ( cdc_acm_dev = 0x3fffc52c ); +PROVIDE ( cdc_acm_fifo_fill = 0x4000fd8c ); +PROVIDE ( cdc_acm_fifo_read = 0x4000fdcc ); +PROVIDE ( cdc_acm_init = 0x4000fd48 ); +PROVIDE ( cdc_acm_irq_callback_set = 0x4000fea0 ); +PROVIDE ( cdc_acm_irq_is_pending = 0x4000fe7c ); +PROVIDE ( cdc_acm_irq_rx_disable = 0x4000fe5c ); +PROVIDE ( cdc_acm_irq_rx_enable = 0x4000fe50 ); +PROVIDE ( cdc_acm_irq_rx_ready = 0x4000fe68 ); +PROVIDE ( cdc_acm_irq_state_disable = 0x4000fe30 ); +PROVIDE ( cdc_acm_irq_state_enable = 0x4000fe24 ); +PROVIDE ( cdc_acm_irq_tx_disable = 0x4000fe18 ); +PROVIDE ( cdc_acm_irq_tx_enable = 0x4000fe0c ); +PROVIDE ( cdc_acm_irq_tx_ready = 0x4000fe3c ); +PROVIDE ( cdc_acm_line_ctrl_get = 0x4000fefc ); +PROVIDE ( cdc_acm_line_ctrl_set = 0x4000fea8 ); +PROVIDE ( cdc_acm_poll_out = 0x4000ff2c ); +PROVIDE ( cdc_acm_rx_fifo_cnt = 0x4000fdb8 ); +PROVIDE ( chip_usb_dw_init = 0x40011be0 ); +PROVIDE ( _cleanup = 0x40015724 ); +PROVIDE ( _cleanup_r = 0x400156ac ); +PROVIDE ( __clear_cache = 0x40005e98 ); +PROVIDE ( close = 0x4000848c ); +PROVIDE ( _close_r = 0x40015378 ); +PROVIDE ( cpio_destroy = 0x40012088 ); +PROVIDE ( cpio_done = 0x40012054 ); +PROVIDE ( cpio_feed = 0x40011d5c ); +PROVIDE ( cpio_start = 0x40011d10 ); +PROVIDE ( crc16_be = 0x4000e744 ); +PROVIDE ( crc16_le = 0x4000e708 ); +PROVIDE ( crc32_be = 0x4000e6d4 ); +PROVIDE ( crc32_le = 0x4000e6a0 ); +PROVIDE ( crc8_be = 0x4000e7b4 ); +PROVIDE ( crc8_le = 0x4000e784 ); +PROVIDE ( creat = 0x40007c68 ); +PROVIDE ( _ctype_ = 0x3ffab96c ); +PROVIDE ( _cvt = 0x4000c6d8 ); +PROVIDE ( _data_end_all_pro = 0x3fffdd10 ); +PROVIDE ( _data_end_c = 0x3fffc040 ); +PROVIDE ( _data_end_cache = 0x3fffc020 ); +PROVIDE ( _data_end_ets = 0x3fffc010 ); +PROVIDE ( _data_end_etsc = 0x3fffcb10 ); +PROVIDE ( _data_end_gpio = 0x3fffc980 ); +PROVIDE ( _data_end_hal = 0x3fffc010 ); +PROVIDE ( _data_end_newlib = 0x3fffc020 ); +PROVIDE ( _data_end_phyrom = 0x3fffc230 ); +PROVIDE ( _data_end_sip = 0x3fffc690 ); +PROVIDE ( _data_end_slc = 0x3fffc540 ); +PROVIDE ( _data_end_spi_flash = 0x3fffc250 ); +PROVIDE ( _data_end_uart = 0x3fffc9c0 ); +PROVIDE ( _data_end_usbdev = 0x3fffc2c0 ); +PROVIDE ( _data_end_xtos = 0x3fffd1c0 ); +PROVIDE ( _data_start_all_pro = 0x3fffdd10 ); +PROVIDE ( _data_start_c = 0x3fffc030 ); +PROVIDE ( _data_start_cache = 0x3fffc020 ); +PROVIDE ( _data_start_ets = 0x3fffc010 ); +PROVIDE ( _data_start_etsc = 0x3fffcb00 ); +PROVIDE ( _data_start_gpio = 0x3fffc980 ); +PROVIDE ( _data_start_hal = 0x3fffc010 ); +PROVIDE ( _data_start_newlib = 0x3fffc020 ); +PROVIDE ( _data_start_phyrom = 0x3fffc050 ); +PROVIDE ( _data_start_sip = 0x3fffc690 ); +PROVIDE ( _data_start_slc = 0x3fffc540 ); +PROVIDE ( _data_start_spi_flash = 0x3fffc230 ); +PROVIDE ( _data_start_uart = 0x3fffc9c0 ); +PROVIDE ( _data_start_usbdev = 0x3fffc260 ); +PROVIDE ( _data_start_xtos = 0x3fffcda0 ); +PROVIDE ( dbus_ahb_baseaddrs = 0x3ffae8d8 ); +PROVIDE ( dbus_baseaddrs = 0x3ffae8e8 ); +PROVIDE ( _DebugExceptionVector = 0x40000280 ); +PROVIDE ( _DebugExceptionVector_text_end = 0x4000028b ); +PROVIDE ( _DebugExceptionVector_text_start = 0x40000280 ); +PROVIDE ( debug_timer = 0x3fffcd90 ); +PROVIDE ( debug_timerfn = 0x3fffcd94 ); +PROVIDE ( __default_global_locale = 0x3ffab800 ); +PROVIDE ( dfu_class_handle_req = 0x40011978 ); +PROVIDE ( dfu_config_descr = 0x3ffae778 ); +PROVIDE ( dfu_config_descr_dummy = 0x3ffae793 ); +PROVIDE ( dfu_cpio_callback = 0x4000ff58 ); +PROVIDE ( dfu_custom_handle_req = 0x40011b8c ); +PROVIDE ( dfu_flash_attach = 0x400120d8 ); +PROVIDE ( dfu_flash_deinit = 0x400120a0 ); +PROVIDE ( dfu_flash_erase = 0x400120a8 ); +PROVIDE ( dfu_flash_init = 0x40012090 ); +PROVIDE ( dfu_flash_program = 0x400120b8 ); +PROVIDE ( dfu_flash_read = 0x400120c8 ); +PROVIDE ( dfu_runtime_config_descr = 0x3ffae83e ); +PROVIDE ( dfu_status_cb = 0x40011b58 ); +PROVIDE ( dfu_updater_begin = 0x400101a4 ); +PROVIDE ( dfu_updater_clear_err = 0x4001015c ); +PROVIDE ( dfu_updater_enable = 0x40010174 ); +PROVIDE ( dfu_updater_end = 0x40010248 ); +PROVIDE ( dfu_updater_feed = 0x400101fc ); +PROVIDE ( dfu_updater_flash_read = 0x40010330 ); +PROVIDE ( dfu_updater_get_err = 0x40010148 ); +PROVIDE ( dfu_updater_set_raw_addr = 0x4001031c ); +PROVIDE ( dfu_usb_descriptors = 0x3ffae758 ); +PROVIDE ( dh_group14_generator = 0x3ffad898 ); +PROVIDE ( dh_group14_prime = 0x3ffad798 ); +PROVIDE ( dh_group15_generator = 0x3ffad797 ); +PROVIDE ( dh_group15_prime = 0x3ffad617 ); +PROVIDE ( dh_group16_generator = 0x3ffad616 ); +PROVIDE ( dh_group16_prime = 0x3ffad416 ); +PROVIDE ( dh_group17_generator = 0x3ffad415 ); +PROVIDE ( dh_group17_prime = 0x3ffad115 ); +PROVIDE ( dh_group18_generator = 0x3ffad114 ); +PROVIDE ( dh_group18_prime = 0x3ffacd14 ); +PROVIDE ( dh_group1_generator = 0x3ffada3b ); +PROVIDE ( dh_group1_prime = 0x3ffad9db ); +PROVIDE ( dh_group2_generator = 0x3ffad9da ); +PROVIDE ( dh_group2_prime = 0x3ffad95a ); +PROVIDE ( dh_group5_generator = 0x3ffad959 ); +PROVIDE ( dh_group5_prime = 0x3ffad899 ); +PROVIDE ( disable_default_watchdog = 0x4000bf84 ); +PROVIDE ( Disable_QMode = 0x40012d24 ); +PROVIDE ( div = 0x40000744 ); +PROVIDE ( _DoubleExceptionVector = 0x400003c0 ); +PROVIDE ( _DoubleExceptionVector_text_end = 0x400003c6 ); +PROVIDE ( _DoubleExceptionVector_text_start = 0x400003c0 ); +PROVIDE ( _dram0_0_start = 0x3fffc000 ); +PROVIDE ( _dram0_1_start = 0x3fffdd00 ); +PROVIDE ( dummy_len_plus = 0x3fffc250 ); +PROVIDE ( Enable_QMode = 0x40012cd4 ); +PROVIDE ( esp_crc8 = 0x4000e7e0 ); +PROVIDE ( _etext = 0x400170fc ); +PROVIDE ( ets_aes_block = 0x4000aa2c ); +PROVIDE ( ets_aes_disable = 0x4000a914 ); +PROVIDE ( ets_aes_enable = 0x4000a8e8 ); +PROVIDE ( ets_aes_set_endian = 0x4000a944 ); +PROVIDE ( ets_aes_setkey = 0x4000a9b0 ); +PROVIDE ( ets_aes_setkey_dec = 0x4000aa0c ); +PROVIDE ( ets_aes_setkey_enc = 0x4000a9fc ); +PROVIDE ( ets_bigint_disable = 0x4000ab6c ); +PROVIDE ( ets_bigint_enable = 0x4000ab24 ); +PROVIDE ( ets_bigint_getz = 0x4000ac74 ); +PROVIDE ( ets_bigint_modexp = 0x4000ac34 ); +PROVIDE ( ets_bigint_modmult = 0x4000ac10 ); +PROVIDE ( ets_bigint_multiply = 0x4000abac ); +PROVIDE ( ets_bigint_wait_finish = 0x4000ac5c ); +PROVIDE ( ets_config_flash_by_image_hdr = 0x4000db10 ); +PROVIDE ( ets_delay_us = 0x4000d938 ); +PROVIDE ( ets_efuse_clear_program_registers = 0x4000aec4 ); +PROVIDE ( ets_efuse_count_unused_key_blocks = 0x4000b088 ); +PROVIDE ( ets_efuse_download_modes_disabled = 0x4000b328 ); +PROVIDE ( ets_efuse_find_purpose = 0x4000afe0 ); +PROVIDE ( ets_efuse_find_unused_key_block = 0x4000b070 ); +PROVIDE ( ets_efuse_get_8M_clock = 0x4000b2b8 ); +PROVIDE ( ets_efuse_get_flash_delay_us = 0x4000b414 ); +PROVIDE ( ets_efuse_get_key_purpose = 0x4000af6c ); +PROVIDE ( ets_efuse_get_read_register_address = 0x4000af48 ); +PROVIDE ( ets_efuse_get_spiconfig = 0x4000b264 ); +PROVIDE ( ets_efuse_get_uart_print_channel = 0x4000b358 ); +PROVIDE ( ets_efuse_get_uart_print_control = 0x4000b348 ); +PROVIDE ( ets_efuse_get_wp_pad = 0x4000b208 ); +PROVIDE ( ets_efuse_get_xtal_freq = 0x4000b2c8 ); +PROVIDE ( ets_efuse_key_block_unused = 0x4000b00c ); +PROVIDE ( ets_efuse_legacy_spi_boot_mode_disabled = 0x4000b338 ); +PROVIDE ( ets_efuse_program = 0x4000af34 ); +PROVIDE ( ets_efuse_read = 0x4000ae94 ); +PROVIDE ( ets_efuse_rs_calculate = 0x4000b438 ); +PROVIDE ( ets_efuse_secure_boot_aggressive_revoke_enabled = 0x4000b404 ); +PROVIDE ( ets_efuse_secure_boot_enabled = 0x4000b3f4 ); +PROVIDE ( ets_efuse_security_download_modes_enabled = 0x4000b388 ); +PROVIDE ( ets_efuse_start = 0x4000ae28 ); +PROVIDE ( ets_efuse_tiny_basic_mode_disabled = 0x4000b368 ); +PROVIDE ( ets_efuse_usb_download_mode_disabled = 0x4000b3a8 ); +PROVIDE ( ets_efuse_usb_force_b = 0x4000b3e4 ); +PROVIDE ( ets_efuse_usb_module_disabled = 0x4000b378 ); +PROVIDE ( ets_efuse_usb_use_ext_phy = 0x4000b3d4 ); +PROVIDE ( ets_efuse_write_key = 0x4000b0c8 ); +PROVIDE ( ets_emsa_pss_verify = 0x4000e508 ); +PROVIDE ( ets_get_apb_freq = 0x4000d9cc ); +PROVIDE ( ets_get_cpu_frequency = 0x4000d960 ); +PROVIDE ( ets_get_xtal_freq = 0x4000d988 ); +PROVIDE ( ets_get_xtal_scale = 0x4000d970 ); +PROVIDE ( ets_hmac_calculate_downstream = 0x4000be1c ); +PROVIDE ( ets_hmac_calculate_message = 0x4000bd38 ); +PROVIDE ( ets_hmac_disable = 0x4000bd0c ); +PROVIDE ( ets_hmac_enable = 0x4000bcf0 ); +PROVIDE ( ets_hmac_invalidate_downstream = 0x4000be3c ); +PROVIDE ( ets_install_lock = 0x4000cbc0 ); +PROVIDE ( ets_install_putc1 = 0x4000cbd0 ); +PROVIDE ( ets_install_putc2 = 0x4000cbf0 ); +PROVIDE ( ets_install_uart_printf = 0x4000cbe0 ); +PROVIDE ( ets_intr_count = 0x3fffcd1c ); +PROVIDE ( ets_intr_lock = 0x4000be64 ); +PROVIDE ( ets_intr_unlock = 0x4000be78 ); +PROVIDE ( ets_isr_attach = 0x4000bea0 ); +PROVIDE ( ets_isr_mask = 0x4000beb0 ); +PROVIDE ( ets_isr_unmask = 0x4000bebc ); +PROVIDE ( ets_jtag_enable_temporarily = 0x4000b2dc ); +PROVIDE ( ets_loader_map_range = 0x4000da5c ); +PROVIDE ( ets_mgf1_sha256 = 0x4000e4a0 ); +PROVIDE ( ets_post = 0x4000ad78 ); +PROVIDE ( ets_printf = 0x4000cc00 ); +PROVIDE ( ets_printf_lock = 0x3fffc014 ); +PROVIDE ( ets_printf_unlock = 0x3fffc010 ); +PROVIDE ( ets_readySet_ = 0x3fffcb10 ); +PROVIDE ( ets_rsa_pss_verify = 0x4000e5e4 ); +PROVIDE ( ets_run = 0x4000acf0 ); +PROVIDE ( ets_run_flash_bootloader = 0x4000dc08 ); +PROVIDE ( ets_secure_boot_read_key_digests = 0x4000cdcc ); +PROVIDE ( ets_secure_boot_revoke_public_key_digest = 0x4000ce4c ); +PROVIDE ( ets_secure_boot_verify_bootloader = 0x4000d184 ); +PROVIDE ( ets_secure_boot_verify_bootloader_with_keys = 0x4000cff8 ); +PROVIDE ( ets_secure_boot_verify_signature = 0x4000ceb4 ); +PROVIDE ( ets_set_appcpu_boot_addr = 0x4000bf74 ); +PROVIDE ( ets_set_idle_cb = 0x4000aca8 ); +PROVIDE ( ets_set_startup_callback = 0x4000bf68 ); +PROVIDE ( ets_set_user_start = 0x4000bf58 ); +PROVIDE ( ets_sha_clone = 0x4000d3b0 ); +PROVIDE ( ets_sha_disable = 0x4000d208 ); +PROVIDE ( ets_sha_enable = 0x4000d1dc ); +PROVIDE ( ets_sha_finish = 0x4000d544 ); +PROVIDE ( ets_sha_get_state = 0x4000d388 ); +PROVIDE ( ets_sha_init = 0x4000d234 ); +PROVIDE ( ets_sha_process = 0x4000d3dc ); +PROVIDE ( ets_sha_starts = 0x4000d27c ); +PROVIDE ( ets_sha_update = 0x4000d484 ); +PROVIDE ( ets_startup_callback = 0x3fffcd24 ); +PROVIDE ( ets_task = 0x4000acbc ); +PROVIDE ( ets_unpack_flash_code_legacy = 0x4000e138 ); +PROVIDE ( ets_update_cpu_frequency = 0x4000d954 ); +PROVIDE ( ets_vprintf = 0x4000c75c ); +PROVIDE ( ets_waiti0 = 0x4000be8c ); +PROVIDE ( ets_wdt_reset_cpu = 0x40015a58 ); +PROVIDE ( ets_write_char = 0x4000c694 ); +PROVIDE ( ets_write_char_uart = 0x4000c6b8 ); +PROVIDE ( exc_cause_table = 0x3ffabda8 ); +PROVIDE ( _exit_r = 0x40015364 ); +PROVIDE ( fclose = 0x40015a30 ); +PROVIDE ( _fclose_r = 0x40015940 ); +PROVIDE ( fflush = 0x40001f94 ); +PROVIDE ( _fflush_r = 0x40001f0c ); +PROVIDE ( FilePacketSendDeflatedReqMsgProc = 0x4000ec20 ); +PROVIDE ( FilePacketSendReqMsgProc = 0x4000e920 ); +PROVIDE ( fiprintf = 0x40000e18 ); +PROVIDE ( _fiprintf_r = 0x40000df4 ); +PROVIDE ( flashchip = 0x3fffc230 ); +PROVIDE ( FlashDwnLdDeflatedStartMsgProc = 0x4000ebc8 ); +PROVIDE ( FlashDwnLdParamCfgMsgProc = 0x4000ea08 ); +PROVIDE ( FlashDwnLdStartMsgProc = 0x4000e8bc ); +PROVIDE ( FlashDwnLdStopDeflatedReqMsgProc = 0x4000ed20 ); +PROVIDE ( FlashDwnLdStopReqMsgProc = 0x4000e9d8 ); +PROVIDE ( __fp_lock_all = 0x40015864 ); +PROVIDE ( fprintf = 0x40000e18 ); +PROVIDE ( _fprintf_r = 0x40000df4 ); +PROVIDE ( __fp_unlock_all = 0x40015878 ); +PROVIDE ( fputwc = 0x40001c40 ); +PROVIDE ( __fputwc = 0x40001b4c ); +PROVIDE ( _fputwc_r = 0x40001bd4 ); +PROVIDE ( free = 0x400154f4 ); +PROVIDE ( _free_r = 0x40015208 ); +PROVIDE ( _fstat_r = 0x40015308 ); +PROVIDE ( _fwalk = 0x40016efc ); +PROVIDE ( _fwalk_reent = 0x40016f34 ); +PROVIDE ( general_device_descr = 0x3fffc2a8 ); +PROVIDE ( _GeneralException = 0x400077ab ); +PROVIDE ( get_id = 0x4001272c ); +PROVIDE ( _getpid_r = 0x40015338 ); +PROVIDE ( __getreent = 0x400154c8 ); +PROVIDE ( GetSecurityInfoProc = 0x4000ede0 ); +PROVIDE ( _gettimeofday_r = 0x40015294 ); +PROVIDE ( GetUartDevice = 0x4000fbb0 ); +PROVIDE ( _global_impure_ptr = 0x3fffc04c ); +PROVIDE ( __global_locale_ptr = 0x3fffc030 ); +PROVIDE ( g_phyFuns_instance = 0x3fffc054 ); +PROVIDE ( gpio_init = 0x40014cbc ); +PROVIDE ( gpio_input_get = 0x40014c20 ); +PROVIDE ( gpio_input_get_high = 0x40014c34 ); +PROVIDE ( gpio_intr_ack = 0x40014e70 ); +PROVIDE ( gpio_intr_ack_high = 0x40014eb8 ); +PROVIDE ( gpio_intr_handler_register = 0x40014f04 ); +PROVIDE ( gpio_intr_pending = 0x40014d88 ); +PROVIDE ( gpio_intr_pending_high = 0x40014d94 ); +PROVIDE ( gpio_matrix_in = 0x40014f74 ); +PROVIDE ( gpio_matrix_out = 0x40014fa4 ); +PROVIDE ( gpio_output_disable = 0x40015020 ); +PROVIDE ( gpio_output_enable = 0x40014ff4 ); +PROVIDE ( gpio_output_set = 0x40014bbc ); +PROVIDE ( gpio_output_set_high = 0x40014bf4 ); +PROVIDE ( gpio_pad_hold = 0x4001519c ); +PROVIDE ( gpio_pad_input_disable = 0x40015138 ); +PROVIDE ( gpio_pad_input_enable = 0x40015114 ); +PROVIDE ( gpio_pad_pulldown = 0x400150e0 ); +PROVIDE ( gpio_pad_pullup = 0x400150ac ); +PROVIDE ( gpio_pad_select_gpio = 0x40015054 ); +PROVIDE ( gpio_pad_set_drv = 0x40015080 ); +PROVIDE ( gpio_pad_unhold = 0x40015164 ); +PROVIDE ( gpio_pending_mask = 0x3fffc9b0 ); +PROVIDE ( gpio_pending_mask_high = 0x3fffc9bc ); +PROVIDE ( gpio_pin_intr_state_set = 0x40014da0 ); +PROVIDE ( gpio_pin_wakeup_disable = 0x40014f48 ); +PROVIDE ( gpio_pin_wakeup_enable = 0x40014f14 ); +PROVIDE ( gpio_register_get = 0x40014d58 ); +PROVIDE ( gpio_register_set = 0x40014c54 ); +PROVIDE ( g_ticks_per_us = 0x3fffcb00 ); +PROVIDE ( hmac_md5 = 0x4000586c ); +PROVIDE ( hmac_md5_vector = 0x4000577c ); +PROVIDE ( ibus_ahb_baseaddrs = 0x3ffae8f8 ); +PROVIDE ( ibus_baseaddrs = 0x3ffae908 ); +PROVIDE ( intr_matrix_set = 0x4000becc ); +PROVIDE ( _iram0_text_end = 0x40000540 ); +PROVIDE ( _iram0_text_start = 0x40000540 ); +PROVIDE ( _iram1_text_end = 0x60021100 ); +PROVIDE ( _iram1_text_start = 0x60021100 ); +PROVIDE ( isalnum = 0x40007cb4 ); +PROVIDE ( isalpha = 0x40007cc4 ); +PROVIDE ( isascii = 0x40015d18 ); +PROVIDE ( _isatty_r = 0x40007c7c ); +PROVIDE ( isblank = 0x40007cd4 ); +PROVIDE ( iscntrl = 0x40007cf4 ); +PROVIDE ( isdigit = 0x40007d0c ); +PROVIDE ( isgraph = 0x40007d44 ); +PROVIDE ( islower = 0x40007d24 ); +PROVIDE ( isprint = 0x40007d5c ); +PROVIDE ( ispunct = 0x40007d70 ); +PROVIDE ( isspace = 0x40007d88 ); +PROVIDE ( isupper = 0x40007da0 ); +PROVIDE ( itoa = 0x40000acc ); +PROVIDE ( __itoa = 0x40000a90 ); +PROVIDE ( _KernelExceptionVector = 0x40000300 ); +PROVIDE ( _KernelExceptionVector_text_end = 0x40000306 ); +PROVIDE ( _KernelExceptionVector_text_start = 0x40000300 ); +PROVIDE ( _kill_r = 0x4001534c ); +PROVIDE ( labs = 0x4000076c ); +PROVIDE ( ldiv = 0x40000774 ); +PROVIDE ( _Level2FromVector = 0x400078d4 ); +PROVIDE ( _Level2HandlerLabel = 0x00000000 ); +PROVIDE ( _Level2InterruptVector_text_end = 0x40000186 ); +PROVIDE ( _Level2InterruptVector_text_start = 0x40000180 ); +PROVIDE ( _Level2Vector = 0x40000180 ); +PROVIDE ( _Level3FromVector = 0x40007970 ); +PROVIDE ( _Level3HandlerLabel = 0x00000000 ); +PROVIDE ( _Level3InterruptVector_text_end = 0x400001c6 ); +PROVIDE ( _Level3InterruptVector_text_start = 0x400001c0 ); +PROVIDE ( _Level3Vector = 0x400001c0 ); +PROVIDE ( _Level4FromVector = 0x40007a08 ); +PROVIDE ( _Level4HandlerLabel = 0x00000000 ); +PROVIDE ( _Level4InterruptVector_text_end = 0x40000206 ); +PROVIDE ( _Level4InterruptVector_text_start = 0x40000200 ); +PROVIDE ( _Level4Vector = 0x40000200 ); +PROVIDE ( _Level5FromVector = 0x40007b38 ); +PROVIDE ( _Level5HandlerLabel = 0x00000000 ); +PROVIDE ( _Level5InterruptVector_text_end = 0x40000246 ); +PROVIDE ( _Level5InterruptVector_text_start = 0x40000240 ); +PROVIDE ( _Level5Vector = 0x40000240 ); +PROVIDE ( _LevelOneInterrupt = 0x400077e6 ); +PROVIDE ( _link_r = 0x400152d8 ); +PROVIDE ( _lit4_end = 0x40000540 ); +PROVIDE ( _lit4_start = 0x40000540 ); +PROVIDE ( lldesc_build_chain = 0x4000a784 ); +PROVIDE ( lldesc_num2link = 0x4000a874 ); +PROVIDE ( lldesc_set_owner = 0x4000a8a0 ); +PROVIDE ( __locale_ctype_ptr = 0x40002008 ); +PROVIDE ( __locale_ctype_ptr_l = 0x40002000 ); +PROVIDE ( __locale_mb_cur_max = 0x40001fe8 ); +PROVIDE ( _lock_acquire = 0x40015450 ); +PROVIDE ( _lock_acquire_recursive = 0x40015464 ); +PROVIDE ( _lock_close = 0x40015428 ); +PROVIDE ( _lock_close_recursive = 0x4001543c ); +PROVIDE ( _lock_init = 0x40015400 ); +PROVIDE ( _lock_init_recursive = 0x40015414 ); +PROVIDE ( _lock_release = 0x400154a0 ); +PROVIDE ( _lock_release_recursive = 0x400154b4 ); +PROVIDE ( _lock_try_acquire = 0x40015478 ); +PROVIDE ( _lock_try_acquire_recursive = 0x4001548c ); +PROVIDE ( longjmp = 0x400006c8 ); +PROVIDE ( _lseek_r = 0x400153c8 ); +PROVIDE ( main = 0x4000c390 ); +PROVIDE ( malloc = 0x400154dc ); +PROVIDE ( _malloc_r = 0x400151f0 ); +PROVIDE ( _mbtowc_r = 0x40007dbc ); +PROVIDE ( MD5Final = 0x400056e8 ); +PROVIDE ( MD5Init = 0x40005648 ); +PROVIDE ( MD5Update = 0x40005668 ); +PROVIDE ( md5_vector = 0x40005750 ); +PROVIDE ( memccpy = 0x40015d2c ); +PROVIDE ( memchr = 0x40015d50 ); +PROVIDE ( memcmp = 0x40015d6c ); +PROVIDE ( memcpy = 0x40015dd4 ); +PROVIDE ( MemDwnLdStartMsgProc = 0x4000ea34 ); +PROVIDE ( MemDwnLdStopReqMsgProc = 0x4000eac8 ); +PROVIDE ( _memmap_cacheattr_bp_allvalid = 0x22222222 ); +PROVIDE ( _memmap_cacheattr_bp_base = 0x00000220 ); +PROVIDE ( _memmap_cacheattr_bp_strict = 0xfffff22f ); +PROVIDE ( _memmap_cacheattr_bp_trapnull = 0x2222222f ); +PROVIDE ( _memmap_cacheattr_reset = 0x2222211f ); +PROVIDE ( _memmap_cacheattr_unused_mask = 0xfffff00f ); +PROVIDE ( _memmap_cacheattr_wb_allvalid = 0x22222112 ); +PROVIDE ( _memmap_cacheattr_wba_trapnull = 0x2222211f ); +PROVIDE ( _memmap_cacheattr_wb_base = 0x00000110 ); +PROVIDE ( _memmap_cacheattr_wbna_trapnull = 0x2222211f ); +PROVIDE ( _memmap_cacheattr_wb_strict = 0xfffff11f ); +PROVIDE ( _memmap_cacheattr_wb_trapnull = 0x2222211f ); +PROVIDE ( _memmap_cacheattr_wt_allvalid = 0x22222112 ); +PROVIDE ( _memmap_cacheattr_wt_base = 0x00000110 ); +PROVIDE ( _memmap_cacheattr_wt_strict = 0xfffff11f ); +PROVIDE ( _memmap_cacheattr_wt_trapnull = 0x2222211f ); +PROVIDE ( _memmap_vecbase_reset = 0x40000000 ); +PROVIDE ( memmove = 0x40015edc ); +PROVIDE ( MemPacketSendReqMsgProc = 0x4000ea64 ); +PROVIDE ( memrchr = 0x40015f18 ); +PROVIDE ( memset = 0x40015f68 ); +PROVIDE ( MMU_Drom0_I2D_Copy = 0x40014788 ); +PROVIDE ( MMU_Drom_ICache_Unmap = 0x400147a0 ); +PROVIDE ( multofup = 0x40009d90 ); +PROVIDE ( mz_adler32 = 0x4000326c ); +PROVIDE ( mz_crc32 = 0x40003334 ); +PROVIDE ( mz_free = 0x40003380 ); +PROVIDE ( _NMIExceptionVector = 0x400002c0 ); +PROVIDE ( _NMIExceptionVector_text_end = 0x400002c3 ); +PROVIDE ( _NMIExceptionVector_text_start = 0x400002c0 ); +PROVIDE ( open = 0x400084a0 ); +PROVIDE ( _open_r = 0x40015390 ); +PROVIDE ( __packed = 0x3fffc530 ); +PROVIDE ( _PathLocale = 0x3fffc040 ); +PROVIDE ( phy_get_romfuncs = 0x4000a8d4 ); +PROVIDE ( _Pri_4_HandlerAddress = 0x3fffcfa8 ); +PROVIDE ( _Pri_5_HandlerAddress = 0x3fffcfac ); +PROVIDE ( _printf_common = 0x4000123c ); +PROVIDE ( _printf_float = 0x40015538 ); +PROVIDE ( _printf_i = 0x40001308 ); +PROVIDE ( pthread_setcancelstate = 0x400151d4 ); +PROVIDE ( _putc1 = 0x3fffc01c ); +PROVIDE ( _putc2 = 0x3fffc018 ); +PROVIDE ( qsort = 0x40000818 ); +PROVIDE ( _raise_r = 0x400152ac ); +PROVIDE ( rand = 0x40007e54 ); +PROVIDE ( rand_r = 0x40007ed0 ); +PROVIDE ( RcvMsg = 0x4000fb60 ); +PROVIDE ( read = 0x400084f0 ); +PROVIDE ( _read_r = 0x400153e4 ); +PROVIDE ( realloc = 0x40015508 ); +PROVIDE ( _realloc_r = 0x4001521c ); +PROVIDE ( RecvBuff = 0x3fffc9c8 ); +PROVIDE ( recv_packet = 0x4000fa34 ); +PROVIDE ( _rename_r = 0x40015264 ); +PROVIDE ( _ResetHandler = 0x4000044c ); +PROVIDE ( _ResetVector = 0x40000400 ); +PROVIDE ( _ResetVector_literal_end = 0x40000540 ); +PROVIDE ( _ResetVector_literal_start = 0x40000540 ); +PROVIDE ( _ResetVector_text_end = 0x4000053d ); +PROVIDE ( _ResetVector_text_start = 0x40000400 ); +PROVIDE ( _rodata_end = 0x3ffaf840 ); +PROVIDE ( _rodata_start = 0x3ffab800 ); +PROVIDE ( rom_abs_temp = 0x40019428 ); +PROVIDE ( rom_bb_bss_bw_40_en = 0x40017ec8 ); +PROVIDE ( rom_bb_bss_cbw40_dig = 0x40017968 ); +PROVIDE ( rom_bb_rx_ht20_cen_bcov_en = 0x40017580 ); +PROVIDE ( rom_bb_tx_ht20_cen = 0x400175ac ); +PROVIDE ( rom_bb_wdg_test_en = 0x40017900 ); +PROVIDE ( rom_bb_wdt_get_status = 0x40017c00 ); +PROVIDE ( rom_bb_wdt_int_enable = 0x40017bc0 ); +PROVIDE ( rom_bb_wdt_rst_enable = 0x40017b9c ); +PROVIDE ( rom_bb_wdt_timeout_clear = 0x40017be4 ); +PROVIDE ( rom_cbw2040_cfg = 0x40017fb4 ); +PROVIDE ( rom_check_noise_floor = 0x40017a30 ); +PROVIDE ( rom_chip_i2c_readReg = 0x40018120 ); +PROVIDE ( rom_chip_i2c_writeReg = 0x4001819c ); +PROVIDE ( rom_chip_sleep_prot_dis = 0x40017940 ); +PROVIDE ( rom_chip_sleep_prot_en = 0x40017e0c ); +PROVIDE ( rom_clk_force_on_vit = 0x4001755c ); +PROVIDE ( rom_correct_rf_ana_gain = 0x40019eb4 ); +PROVIDE ( rom_dc_iq_est = 0x40019504 ); +PROVIDE ( rom_disable_agc = 0x40017138 ); +PROVIDE ( rom_enable_agc = 0x40017150 ); +PROVIDE ( rom_en_pwdet = 0x40019014 ); +PROVIDE ( rom_gen_rx_gain_table = 0x40017cec ); +PROVIDE ( rom_get_bbgain_db = 0x400172f4 ); +PROVIDE ( rom_get_data_sat = 0x400172a4 ); +PROVIDE ( rom_get_fm_sar_dout = 0x40019148 ); +PROVIDE ( rom_get_i2c_read_mask = 0x400180fc ); +PROVIDE ( rom_get_power_db = 0x40019c04 ); +PROVIDE ( rom_get_pwctrl_correct = 0x4001a070 ); +PROVIDE ( rom_get_rfcal_rxiq_data = 0x40019860 ); +PROVIDE ( rom_get_rf_gain_qdb = 0x40019e9c ); +PROVIDE ( rom_get_sar_dout = 0x4001a000 ); +PROVIDE ( rom_i2c_readReg = 0x4001817c ); +PROVIDE ( rom_i2c_readReg_Mask = 0x40018200 ); +PROVIDE ( rom_i2c_writeReg = 0x400181e4 ); +PROVIDE ( rom_i2c_writeReg_Mask = 0x4001823c ); +PROVIDE ( rom_index_to_txbbgain = 0x40018d20 ); +PROVIDE ( rom_iq_est_disable = 0x400194c8 ); +PROVIDE ( rom_iq_est_enable = 0x4001944c ); +PROVIDE ( rom_linear_to_db = 0x40019b98 ); +PROVIDE ( rom_loopback_mode_en = 0x40017270 ); +PROVIDE ( rom_meas_tone_pwr_db = 0x40019c40 ); +PROVIDE ( rom_mhz2ieee = 0x40017f54 ); +PROVIDE ( rom_noise_floor_auto_set = 0x40017998 ); +PROVIDE ( rom_pbus_debugmode = 0x4001849c ); +PROVIDE ( rom_pbus_force_mode = 0x400182ac ); +PROVIDE ( rom_pbus_force_test = 0x400183fc ); +PROVIDE ( rom_pbus_rd = 0x40018458 ); +PROVIDE ( rom_pbus_rd_addr = 0x40018374 ); +PROVIDE ( rom_pbus_rd_shift = 0x400183b4 ); +PROVIDE ( rom_pbus_set_dco = 0x4001867c ); +PROVIDE ( rom_pbus_set_rxgain = 0x400184c4 ); +PROVIDE ( rom_pbus_workmode = 0x400184b0 ); +PROVIDE ( rom_pbus_xpd_rx_off = 0x4001854c ); +PROVIDE ( rom_pbus_xpd_rx_on = 0x40018580 ); +PROVIDE ( rom_pbus_xpd_tx_off = 0x400185d4 ); +PROVIDE ( rom_pbus_xpd_tx_on = 0x40018624 ); +PROVIDE ( rom_phy_byte_to_word = 0x40017cbc ); +PROVIDE ( rom_phy_chan_filt_set = 0x4001801c ); +PROVIDE ( rom_phy_disable_agc = 0x40017104 ); +PROVIDE ( rom_phy_disable_cca = 0x40017174 ); +PROVIDE ( rom_phy_enable_agc = 0x40017120 ); +PROVIDE ( rom_phy_enable_cca = 0x400171a0 ); +PROVIDE ( rom_phy_freq_correct = 0x40018a84 ); +PROVIDE ( rom_phyFuns = 0x3fffc050 ); +PROVIDE ( rom_phy_get_noisefloor = 0x400179e8 ); +PROVIDE ( rom_phy_get_rx_freq = 0x400180b4 ); +PROVIDE ( rom_phy_get_tx_rate = 0x40017c38 ); +PROVIDE ( rom_phy_rx11blr_cfg = 0x40017b40 ); +PROVIDE ( rom_phy_set_bbfreq_init = 0x40019fd0 ); +PROVIDE ( rom_pow_usr = 0x400171b8 ); +PROVIDE ( rom_pwdet_sar2_init = 0x40018f68 ); +PROVIDE ( rom_read_hw_noisefloor = 0x40017b1c ); +PROVIDE ( rom_read_sar_dout = 0x40019120 ); +PROVIDE ( rom_restart_cal = 0x400186c4 ); +PROVIDE ( rom_rfbt_init = 0x40018cbc ); +PROVIDE ( rom_rfcal_pwrctrl = 0x40019c98 ); +PROVIDE ( rom_rfcal_rxiq = 0x400197ec ); +PROVIDE ( rom_rfcal_txcap = 0x40019a68 ); +PROVIDE ( rom_rfpll_set_freq = 0x400187d0 ); +PROVIDE ( rom_rfrx_init = 0x40018c1c ); +PROVIDE ( rom_rftx_init = 0x40018c48 ); +PROVIDE ( rom_rtc_mem_backup = 0x40017c4c ); +PROVIDE ( rom_rtc_mem_recovery = 0x40017c84 ); +PROVIDE ( rom_rx_gain_force = 0x40017364 ); +PROVIDE ( rom_rxiq_cover_mg_mp = 0x40019708 ); +PROVIDE ( rom_rxiq_get_mis = 0x4001958c ); +PROVIDE ( rom_rxiq_set_reg = 0x400196a0 ); +PROVIDE ( rom_set_cal_rxdc = 0x40017230 ); +PROVIDE ( rom_set_chan_cal_interp = 0x40019954 ); +PROVIDE ( rom_set_channel_freq = 0x40018840 ); +PROVIDE ( rom_set_loopback_gain = 0x400171d4 ); +PROVIDE ( rom_set_noise_floor = 0x40017ad8 ); +PROVIDE ( rom_set_rf_freq_offset = 0x40018be4 ); +PROVIDE ( rom_set_rxclk_en = 0x400173dc ); +PROVIDE ( rom_set_txcap_reg = 0x400199e4 ); +PROVIDE ( rom_set_txclk_en = 0x400173ac ); +PROVIDE ( rom_set_tx_dig_gain = 0x4001731c ); +PROVIDE ( rom_spur_cal = 0x40017ee8 ); +PROVIDE ( rom_spur_reg_write_one_tone = 0x4001763c ); +PROVIDE ( rom_start_tx_tone = 0x40017500 ); +PROVIDE ( rom_start_tx_tone_step = 0x40017418 ); +PROVIDE ( rom_stop_tx_tone = 0x40017e74 ); +PROVIDE ( _rom_store = 0x400170fc ); +PROVIDE ( _rom_store_table = 0x40016f74 ); +PROVIDE ( rom_target_power_add_backoff = 0x40019e78 ); +PROVIDE ( rom_txbbgain_to_index = 0x40018cf0 ); +PROVIDE ( rom_txcal_work_mode = 0x4001907c ); +PROVIDE ( rom_txdc_cal_init = 0x40018d3c ); +PROVIDE ( rom_txdc_cal_v70 = 0x40018dd4 ); +PROVIDE ( rom_txiq_cover = 0x400192d8 ); +PROVIDE ( rom_txiq_get_mis_pwr = 0x40019224 ); +PROVIDE ( rom_txiq_set_reg = 0x400190b0 ); +PROVIDE ( rom_tx_pwctrl_bg_init = 0x4001a0c4 ); +PROVIDE ( rom_txtone_linear_pwr = 0x400191d8 ); +PROVIDE ( rom_wait_rfpll_cal_end = 0x4001878c ); +PROVIDE ( rom_wifi_11g_rate_chg = 0x40019e60 ); +PROVIDE ( rom_wifi_rifs_mode_en = 0x40017c14 ); +PROVIDE ( rom_write_gain_mem = 0x400172c4 ); +PROVIDE ( rom_write_rfpll_sdm = 0x40018724 ); +PROVIDE ( roundup2 = 0x40009d80 ); +PROVIDE ( rtc_boot_control = 0x4000cd28 ); +PROVIDE ( rtc_get_reset_reason = 0x4000cc5c ); +PROVIDE ( rtc_get_wakeup_cause = 0x4000cc7c ); +PROVIDE ( rtc_select_apb_bridge = 0x4000cda0 ); +PROVIDE ( sbrk = 0x40008508 ); +PROVIDE ( _sbrk_r = 0x40015320 ); +PROVIDE ( _scanf_float = 0x40015554 ); +PROVIDE ( s_cdcacm_old_dtr = 0x3fffc9c4 ); +PROVIDE ( __sclose = 0x4001592c ); +PROVIDE ( sdio_slave_mode_init = 0x40009614 ); +PROVIDE ( sdio_slave_pads_init = 0x40009554 ); +PROVIDE ( SelectSpiFunction = 0x40012434 ); +PROVIDE ( SelectSpiQIO = 0x400122b8 ); +PROVIDE ( SendMsg = 0x4000f958 ); +PROVIDE ( send_packet = 0x4000f914 ); +PROVIDE ( __seofread = 0x400158bc ); +PROVIDE ( setjmp = 0x40000664 ); +PROVIDE ( setlocale = 0x40002020 ); +PROVIDE ( _setlocale_r = 0x40001fb8 ); +PROVIDE ( set_rtc_memory_crc = 0x4000cd0c ); +PROVIDE ( SetSpiDrvs = 0x40012348 ); +PROVIDE ( __sf_fake_stderr = 0x3ffae938 ); +PROVIDE ( __sf_fake_stdin = 0x3ffae978 ); +PROVIDE ( __sf_fake_stdout = 0x3ffae958 ); +PROVIDE ( __sflush_r = 0x40001db8 ); +PROVIDE ( __sfmoreglue = 0x400156f4 ); +PROVIDE ( __sfp = 0x400157bc ); +PROVIDE ( __sfp_lock_acquire = 0x40015734 ); +PROVIDE ( __sfp_lock_release = 0x40015740 ); +PROVIDE ( __sfputs_r = 0x40000e7c ); +PROVIDE ( __sfvwrite_r = 0x400016ec ); +PROVIDE ( sig_matrix = 0x3fffc253 ); +PROVIDE ( __sinit = 0x40015764 ); +PROVIDE ( __sinit_lock_acquire = 0x4001574c ); +PROVIDE ( __sinit_lock_release = 0x40015758 ); +PROVIDE ( sip_after_tx_complete = 0x4000a57c ); +PROVIDE ( sip_alloc_to_host_evt = 0x40009da4 ); +PROVIDE ( sip_download_begin = 0x4000a03c ); +PROVIDE ( sip_get_ptr = 0x4000a570 ); +PROVIDE ( sip_get_state = 0x4000a050 ); +PROVIDE ( sip_init_attach = 0x4000a07c ); +PROVIDE ( sip_install_rx_ctrl_cb = 0x4000a020 ); +PROVIDE ( sip_install_rx_data_cb = 0x4000a030 ); +PROVIDE ( sip_is_active = 0x4000a5e4 ); +PROVIDE ( sip_post_init = 0x4000a0fc ); +PROVIDE ( sip_reclaim_from_host_cmd = 0x40009fcc ); +PROVIDE ( sip_reclaim_tx_data_pkt = 0x40009f70 ); +PROVIDE ( sip_send = 0x4000a178 ); +PROVIDE ( sip_to_host_chain_append = 0x4000a11c ); +PROVIDE ( sip_to_host_evt_send_done = 0x40009e10 ); +PROVIDE ( slc_add_credits = 0x40009b00 ); +PROVIDE ( slc_enable = 0x4000967c ); +PROVIDE ( slc_from_host_chain_fetch = 0x40009830 ); +PROVIDE ( slc_from_host_chain_recycle = 0x40009b20 ); +PROVIDE ( slc_has_pkt_to_host = 0x400094f0 ); +PROVIDE ( slc_init_attach = 0x40009950 ); +PROVIDE ( slc_init_credit = 0x40009ae4 ); +PROVIDE ( slc_reattach = 0x40009528 ); +PROVIDE ( slc_send_to_host_chain = 0x400096d8 ); +PROVIDE ( slc_set_host_io_max_window = 0x400098e4 ); +PROVIDE ( slc_to_host_chain_recycle = 0x4000979c ); +PROVIDE ( __smakebuf_r = 0x40001d30 ); +PROVIDE ( software_reset = 0x4000cd64 ); +PROVIDE ( software_reset_cpu = 0x4000cd7c ); +PROVIDE ( SPI_block_erase = 0x400127fc ); +PROVIDE ( spi_cache_mode_switch = 0x40012d94 ); +PROVIDE ( SPI_chip_erase = 0x40012794 ); +PROVIDE ( SPIClkConfig = 0x40013294 ); +PROVIDE ( SPI_Common_Command = 0x40012950 ); +PROVIDE ( spi_dummy_len_fix = 0x40012280 ); +PROVIDE ( SPI_Encrypt_Write = 0x400138b8 ); +PROVIDE ( SPI_Encrypt_Write_Dest = 0x400137a4 ); +PROVIDE ( SPIEraseArea = 0x400136a0 ); +PROVIDE ( SPIEraseBlock = 0x40013300 ); +PROVIDE ( SPIEraseChip = 0x400132e0 ); +PROVIDE ( SPIEraseSector = 0x40013360 ); +PROVIDE ( spi_flash_attach = 0x40013214 ); +PROVIDE ( SPI_flashchip_data = 0x3fffc234 ); +PROVIDE ( SPI_init = 0x40012fb4 ); +PROVIDE ( SPILock = 0x40013134 ); +PROVIDE ( SPIMasterReadModeCnfig = 0x40013230 ); +PROVIDE ( SPI_page_program = 0x40012c00 ); +PROVIDE ( SPIParamCfg = 0x40013730 ); +PROVIDE ( SPIRead = 0x40013484 ); +PROVIDE ( SPI_read_data = 0x40012834 ); +PROVIDE ( SPIReadModeCnfig = 0x4001317c ); +PROVIDE ( SPI_read_status = 0x400126b8 ); +PROVIDE ( SPI_read_status_high = 0x400128fc ); +PROVIDE ( SPI_sector_erase = 0x400127bc ); +PROVIDE ( SPIUnlock = 0x400130e8 ); +PROVIDE ( SPI_user_command_read = 0x400125fc ); +PROVIDE ( SPI_Wait_Idle = 0x40012cc4 ); +PROVIDE ( SPI_WakeUp = 0x40012714 ); +PROVIDE ( SPIWrite = 0x400133c0 ); +PROVIDE ( SPI_write_enable = 0x40012bc4 ); +PROVIDE ( SPI_Write_Encrypt_Disable = 0x40013768 ); +PROVIDE ( SPI_Write_Encrypt_Enable = 0x4001374c ); +PROVIDE ( SPI_write_status = 0x4001291c ); +PROVIDE ( __sprint_r = 0x40000ec8 ); +PROVIDE ( srand = 0x40007e00 ); +PROVIDE ( __sread = 0x4001588c ); +PROVIDE ( __sseek = 0x400158f8 ); +PROVIDE ( __stack = 0x40000000 ); +PROVIDE ( _stack_sentry = 0x3fffdd10 ); +PROVIDE ( _start = 0x40007648 ); +PROVIDE ( _stat_r = 0x400152f0 ); +PROVIDE ( _stext = 0x400074f4 ); +PROVIDE ( strcasecmp = 0x40007f14 ); +PROVIDE ( strcasestr = 0x40007f58 ); +PROVIDE ( strcat = 0x40015fbc ); +PROVIDE ( strchr = 0x40015fdc ); +PROVIDE ( strcmp = 0x40007fc0 ); +PROVIDE ( strcoll = 0x400080c4 ); +PROVIDE ( strcpy = 0x400080d8 ); +PROVIDE ( strcspn = 0x40015ff8 ); +PROVIDE ( strdup = 0x40008160 ); +PROVIDE ( _strdup_r = 0x40008174 ); +PROVIDE ( string0_descr = 0x3ffae83a ); +PROVIDE ( strlcat = 0x40008194 ); +PROVIDE ( strlcpy = 0x40016024 ); +PROVIDE ( strlen = 0x400081e4 ); +PROVIDE ( strlwr = 0x40008244 ); +PROVIDE ( str_manu_descr = 0x3ffae826 ); +PROVIDE ( strncasecmp = 0x40008270 ); +PROVIDE ( strncat = 0x40016060 ); +PROVIDE ( strncmp = 0x40016090 ); +PROVIDE ( strncpy = 0x400082fc ); +PROVIDE ( strndup = 0x400083c4 ); +PROVIDE ( _strndup_r = 0x400083d8 ); +PROVIDE ( strnlen = 0x400160c8 ); +PROVIDE ( str_prod_descr = 0x3ffae7ec ); +PROVIDE ( str_prod_dfu_descr = 0x3ffae7d0 ); +PROVIDE ( strrchr = 0x4000841c ); +PROVIDE ( strsep = 0x40008448 ); +PROVIDE ( str_serial_descr = 0x3ffae7e8 ); +PROVIDE ( strspn = 0x400160e8 ); +PROVIDE ( strstr = 0x40016114 ); +PROVIDE ( __strtok_r = 0x40016144 ); +PROVIDE ( strtok_r = 0x400161a8 ); +PROVIDE ( strtol = 0x40000c70 ); +PROVIDE ( strtol_l = 0x40000c58 ); +PROVIDE ( _strtol_r = 0x40000c34 ); +PROVIDE ( strtoul = 0x40000dcc ); +PROVIDE ( strtoul_l = 0x40000db4 ); +PROVIDE ( _strtoul_r = 0x40000d90 ); +PROVIDE ( strupr = 0x40008460 ); +PROVIDE ( s_usb_osglue = 0x3fffc520 ); +PROVIDE ( __swbuf = 0x40001a58 ); +PROVIDE ( __swbuf_r = 0x40001998 ); +PROVIDE ( __swhatbuf_r = 0x40001cd4 ); +PROVIDE ( __swrite = 0x400158c4 ); +PROVIDE ( __swsetup_r = 0x40001a6c ); +PROVIDE ( _SyscallException = 0x40007706 ); +PROVIDE ( syscall_table_ptr_app = 0x3fffc020 ); +PROVIDE ( syscall_table_ptr_pro = 0x3fffc024 ); +PROVIDE ( _system_r = 0x4001524c ); +PROVIDE ( tdefl_compress = 0x400045b8 ); +PROVIDE ( tdefl_compress_buffer = 0x40004d14 ); +PROVIDE ( tdefl_compress_mem_to_mem = 0x40004e2c ); +PROVIDE ( tdefl_compress_mem_to_output = 0x40004e0c ); +PROVIDE ( tdefl_get_adler32 = 0x40004e04 ); +PROVIDE ( tdefl_get_prev_return_status = 0x40004dfc ); +PROVIDE ( tdefl_init = 0x40004d30 ); +PROVIDE ( tdefl_write_image_to_png_file_in_memory = 0x40004e40 ); +PROVIDE ( tdefl_write_image_to_png_file_in_memory_ex = 0x40004e34 ); +PROVIDE ( _text_end = 0x400170fc ); +PROVIDE ( _text_start = 0x400074f4 ); +PROVIDE ( _times_r = 0x4001527c ); +PROVIDE ( tinfl_decompress = 0x400033dc ); +PROVIDE ( tinfl_decompress_mem_to_callback = 0x40004584 ); +PROVIDE ( tinfl_decompress_mem_to_mem = 0x40004544 ); +PROVIDE ( toascii = 0x400161bc ); +PROVIDE ( tolower = 0x40008534 ); +PROVIDE ( toupper = 0x40008550 ); +PROVIDE ( uart_acm_dev = 0x3fffc9c0 ); +PROVIDE ( uartAttach = 0x4000f524 ); +PROVIDE ( uart_baudrate_detect = 0x4000f588 ); +PROVIDE ( uart_buff_switch = 0x4000f9b0 ); +PROVIDE ( UartConnCheck = 0x4000e824 ); +PROVIDE ( UartConnectProc = 0x4000eaf0 ); +PROVIDE ( UartDev = 0x3fffcac8 ); +PROVIDE ( uart_div_modify = 0x4000f628 ); +PROVIDE ( UartDwnLdProc = 0x4000eef8 ); +PROVIDE ( UartGetCmdLn = 0x4000fb78 ); +PROVIDE ( Uart_Init = 0x4000f68c ); +PROVIDE ( Uart_Init_USB = 0x4000f4c8 ); +PROVIDE ( UartRegReadProc = 0x4000eb40 ); +PROVIDE ( UartRegWriteProc = 0x4000eb00 ); +PROVIDE ( uart_rx_intr_handler = 0x4000f3d0 ); +PROVIDE ( uart_rx_one_char = 0x4000f874 ); +PROVIDE ( uart_rx_one_char_block = 0x4000f824 ); +PROVIDE ( uart_rx_readbuff = 0x4000f968 ); +PROVIDE ( UartRxString = 0x4000f8d0 ); +PROVIDE ( UartSecureDwnLdProc = 0x4000f1a4 ); +PROVIDE ( UartSetBaudProc = 0x4000eb9c ); +PROVIDE ( UartSpiAttachProc = 0x4000eb54 ); +PROVIDE ( UartSpiReadProc = 0x4000eb70 ); +PROVIDE ( uart_tx_flush = 0x4000f7c8 ); +PROVIDE ( uart_tx_one_char = 0x4000f79c ); +PROVIDE ( uart_tx_one_char2 = 0x4000f7b0 ); +PROVIDE ( uart_tx_switch = 0x4000f57c ); +PROVIDE ( uart_tx_wait_idle = 0x4000f7f4 ); +PROVIDE ( uart_usb_enable_reset_on_rts = 0x4000f4e8 ); +PROVIDE ( _unlink_r = 0x400152c0 ); +PROVIDE ( usb_cancel_transfer = 0x4001189c ); +PROVIDE ( usb_data_stuff = 0x3ffabe48 ); +PROVIDE ( usb_dc_attach = 0x400104f8 ); +PROVIDE ( usb_dc_check_poll_for_interrupts = 0x40010ef0 ); +PROVIDE ( usb_dc_detach = 0x400105b8 ); +PROVIDE ( usb_dc_ep_check_cap = 0x40010634 ); +PROVIDE ( usb_dc_ep_clear_stall = 0x40010890 ); +PROVIDE ( usb_dc_ep_configure = 0x40010678 ); +PROVIDE ( usb_dc_ep_disable = 0x40010a90 ); +PROVIDE ( usb_dc_ep_enable = 0x400109d0 ); +PROVIDE ( usb_dc_ep_flush = 0x40010b60 ); +PROVIDE ( usb_dc_ep_halt = 0x400108fc ); +PROVIDE ( usb_dc_ep_is_stalled = 0x4001095c ); +PROVIDE ( usb_dc_ep_mps = 0x40010ebc ); +PROVIDE ( usb_dc_ep_read = 0x40010e3c ); +PROVIDE ( usb_dc_ep_read_continue = 0x40010dfc ); +PROVIDE ( usb_dc_ep_read_wait = 0x40010d1c ); +PROVIDE ( usb_dc_ep_set_callback = 0x40010e74 ); +PROVIDE ( usb_dc_ep_set_stall = 0x40010830 ); +PROVIDE ( usb_dc_ep_write = 0x40010bd8 ); +PROVIDE ( usb_dc_reset = 0x400105e4 ); +PROVIDE ( usb_dc_set_address = 0x400105fc ); +PROVIDE ( usb_dc_set_status_callback = 0x40010eb0 ); +PROVIDE ( usb_deconfig = 0x40011654 ); +PROVIDE ( usb_disable = 0x40011704 ); +PROVIDE ( usb_enable = 0x40011674 ); +PROVIDE ( usb_ep_clear_stall = 0x40011764 ); +PROVIDE ( usb_ep_read_continue = 0x4001178c ); +PROVIDE ( usb_ep_read_wait = 0x40011774 ); +PROVIDE ( usb_ep_set_stall = 0x40011754 ); +PROVIDE ( usb_get_descriptor = 0x40012200 ); +PROVIDE ( usb_read = 0x4001173c ); +PROVIDE ( usb_set_config = 0x40011610 ); +PROVIDE ( usb_set_current_descriptor = 0x400121e8 ); +PROVIDE ( usb_transfer = 0x400117ec ); +PROVIDE ( usb_transfer_ep_callback = 0x4001179c ); +PROVIDE ( usb_transfer_sync = 0x400118ec ); +PROVIDE ( usb_write = 0x40011724 ); +PROVIDE ( user_code_start = 0x3fffcd20 ); +PROVIDE ( _UserExceptionVector = 0x40000340 ); +PROVIDE ( _UserExceptionVector_text_end = 0x40000357 ); +PROVIDE ( _UserExceptionVector_text_start = 0x40000340 ); +PROVIDE ( utoa = 0x40000654 ); +PROVIDE ( __utoa = 0x400005f0 ); +PROVIDE ( VerifyFlashMd5Proc = 0x4000ed4c ); +PROVIDE ( vfiprintf = 0x4000121c ); +PROVIDE ( _vfiprintf_r = 0x40000f34 ); +PROVIDE ( vfprintf = 0x4000121c ); +PROVIDE ( _vfprintf_r = 0x40000f34 ); +PROVIDE ( Wait_SPI_Idle = 0x40012764 ); +PROVIDE ( wcrtomb = 0x400016d0 ); +PROVIDE ( _wcrtomb_r = 0x4000167c ); +PROVIDE ( _wctomb_r = 0x40001c88 ); +PROVIDE ( _WindowOverflow12 = 0x40000100 ); +PROVIDE ( _WindowOverflow4 = 0x40000000 ); +PROVIDE ( _WindowOverflow8 = 0x40000080 ); +PROVIDE ( _WindowUnderflow12 = 0x40000140 ); +PROVIDE ( _WindowUnderflow4 = 0x40000040 ); +PROVIDE ( _WindowUnderflow8 = 0x400000c0 ); +PROVIDE ( _WindowVectors_text_end = 0x40000170 ); +PROVIDE ( _WindowVectors_text_start = 0x40000000 ); +PROVIDE ( write = 0x4000851c ); +PROVIDE ( _write_r = 0x400153ac ); +PROVIDE ( __XT_EXCEPTION_DESCS__ = 0x3ffaf840 ); +PROVIDE ( __XT_EXCEPTION_DESCS_END__ = 0x3ffaf840 ); +PROVIDE ( __XT_EXCEPTION_TABLE__ = 0x3ffaf74d ); +PROVIDE ( xthal_bcopy = 0x40015b44 ); +PROVIDE ( xthal_copy123 = 0x40015bd8 ); +PROVIDE ( xthal_get_ccompare = 0x40015ce8 ); +PROVIDE ( xthal_get_ccount = 0x40015cbc ); +PROVIDE ( xthal_get_interrupt = 0x40015d08 ); +PROVIDE ( Xthal_intlevel = 0x3ffae918 ); +PROVIDE ( xthal_memcpy = 0x40015b68 ); +PROVIDE ( xthal_set_ccompare = 0x40015cc4 ); +PROVIDE ( xthal_set_intclear = 0x40015d10 ); +PROVIDE ( xthals_hw_configid0 = 0xc2ecfafe ); +PROVIDE ( xthals_hw_configid1 = 0x224787b1 ); +PROVIDE ( xthals_release_major = 0x00002ee0 ); +PROVIDE ( xthals_release_minor = 0x00000009 ); +PROVIDE ( _xtos_alloca_handler = 0x40000010 ); +PROVIDE ( xtos_cause3_handler = 0x4000774c ); +PROVIDE ( xtos_c_handler_table = 0x3fffcea8 ); +PROVIDE ( xtos_c_wrapper_handler = 0x4000775c ); +PROVIDE ( _xtos_enabled = 0x3fffcfb0 ); +PROVIDE ( xtos_exc_handler_table = 0x3fffcda8 ); +PROVIDE ( xtos_interrupt_mask_table = 0x3fffd0b8 ); +PROVIDE ( xtos_interrupt_table = 0x3fffcfb8 ); +PROVIDE ( _xtos_ints_off = 0x4001560c ); +PROVIDE ( _xtos_ints_on = 0x400155e8 ); +PROVIDE ( _xtos_intstruct = 0x3fffcfb0 ); +PROVIDE ( _xtos_l1int_handler = 0x400077c8 ); +PROVIDE ( xtos_p_none = 0x40015acc ); +PROVIDE ( _xtos_restore_intlevel = 0x400078a8 ); +PROVIDE ( _xtos_return_from_exc = 0x40015ad4 ); +PROVIDE ( _xtos_set_exception_handler = 0x40007690 ); +PROVIDE ( _xtos_set_interrupt_handler = 0x400155ac ); +PROVIDE ( _xtos_set_interrupt_handler_arg = 0x40015570 ); +PROVIDE ( _xtos_set_intlevel = 0x40015aec ); +PROVIDE ( _xtos_set_min_intlevel = 0x40015b08 ); +PROVIDE ( _xtos_set_vpri = 0x400078b4 ); +PROVIDE ( _xtos_syscall_handler = 0x400076d8 ); +PROVIDE ( xtos_unhandled_exception = 0x40015b2c ); +PROVIDE ( xtos_unhandled_interrupt = 0x40015b3c ); +PROVIDE ( _xtos_vectors_ref_ = 0x00000000 ); +PROVIDE ( _xtos_vpri_enabled = 0x3fffcfb4 ); diff --git a/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.libgcc.ld b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.libgcc.ld new file mode 100644 index 0000000000..d53bd27e43 --- /dev/null +++ b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.libgcc.ld @@ -0,0 +1,98 @@ +/* Unlike other ROM functions which are exported using PROVIDE, which declares + weak symbols, these libgcc functions are exported using assignment, + which declares strong symbols. This is done so that ROM functions are always + used instead of the ones provided by libgcc.a. +*/ + +__absvdi2 = 0x40005eb4; +__absvsi2 = 0x40005ea0; +__adddf3 = 0x40008a3c; +__addsf3 = 0x40008594; +__addvdi3 = 0x4000916c; +__addvsi3 = 0x40009148; +__ashldi3 = 0x4001622c; +__ashrdi3 = 0x40016244; +__bswapdi2 = 0x40007110; +__bswapsi2 = 0x400070e8; +__clrsbdi2 = 0x40007184; +__clrsbsi2 = 0x4000716c; +__clzdi2 = 0x40016464; +__clzsi2 = 0x400161fc; +__cmpdi2 = 0x40005e58; +__ctzdi2 = 0x40016478; +__ctzsi2 = 0x40016204; +__divdc3 = 0x40006c30; +__divdf3 = 0x40008e00; +__divdi3 = 0x40016498; +__divsc3 = 0x40006920; +__divsf3 = 0x400087f8; +__divsi3 = 0x400161cc; +__eqdf2 = 0x40005ce0; +__eqsf2 = 0x400059ac; +__extendsfdf2 = 0x400090e4; +__ffsdi2 = 0x40016440; +__ffssi2 = 0x40016218; +__fixdfdi = 0x40008f74; +__fixdfsi = 0x40008f28; +__fixsfdi = 0x400088f8; +__fixsfsi = 0x400088b8; +__fixunsdfsi = 0x40008fe0; +__fixunssfdi = 0x400089b0; +__fixunssfsi = 0x40008958; +__floatdidf = 0x4001639c; +__floatdisf = 0x400162d4; +__floatsidf = 0x40016358; +__floatsisf = 0x40016284; +__floatundidf = 0x4001638c; +__floatundisf = 0x400162c4; +__floatunsidf = 0x4001634c; +__floatunsisf = 0x40016278; +__gcc_bcmp = 0x400071bc; +__gedf2 = 0x40005da0; +__gesf2 = 0x40005a44; +__gtdf2 = 0x40005d14; +__gtsf2 = 0x400059d8; +__ledf2 = 0x40005d3c; +__lesf2 = 0x400059f8; +__lshrdi3 = 0x40016260; +__ltdf2 = 0x40005dc8; +__ltsf2 = 0x40005a64; +__moddi3 = 0x40016760; +__modsi3 = 0x400161d4; +__muldc3 = 0x400062e8; +__muldf3 = 0x40005bc4; +__muldi3 = 0x40016410; +__mulsc3 = 0x40005f80; +__mulsf3 = 0x40005900; +__mulsi3 = 0x400161c4; +__mulvdi3 = 0x4000922c; +__mulvsi3 = 0x40009214; +__nedf2 = 0x40005ce0; +__negdf2 = 0x40005ad8; +__negdi2 = 0x40016428; +__negsf2 = 0x4000856c; +__negvdi2 = 0x40009348; +__negvsi2 = 0x40009328; +__nesf2 = 0x400059ac; +__nsau_data = 0x3ffaba70; +__paritysi2 = 0x40009414; +__popcountdi2 = 0x400093bc; +__popcountsi2 = 0x40009384; +__popcount_tab = 0x3ffaba70; +__powidf2 = 0x40005f1c; +__powisf2 = 0x40005ed4; +__subdf3 = 0x40008b90; +__subsf3 = 0x4000867c; +__subvdi3 = 0x400091d0; +__subvsi3 = 0x400091ac; +__truncdfsf2 = 0x40009040; +__ucmpdi2 = 0x40005e78; +__udivdi3 = 0x40016a08; +__udivmoddi4 = 0x400071fc; +__udivsi3 = 0x400161dc; +__udiv_w_sdiv = 0x400071f4; +__umoddi3 = 0x40016c8c; +__umodsi3 = 0x400161e4; +__umulsidi3 = 0x400161ec; +__unorddf2 = 0x40005e2c; +__unordsf2 = 0x40005ab0; diff --git a/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.newlib-data.ld b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.newlib-data.ld new file mode 100644 index 0000000000..dd4d696503 --- /dev/null +++ b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.newlib-data.ld @@ -0,0 +1,19 @@ +/* These are the .bss/.data symbols used by newlib functions present in ESP32S2beta ROM. + See also esp32s2beta.rom.newlib-funcs.ld for the list of general newlib functions, + and esp32s2beta.rom.newlib-stdio.ld for stdio related newlib functions. + + Unlike other ROM functions and data which are exported using PROVIDE, which declares + weak symbols, newlib related functions are exported using assignment, + which declares strong symbols. This is done so that ROM functions are always + used instead of the ones provided by libc.a. + */ + +_ctype_ = 0x3ffab96c; +__default_global_locale = 0x3ffab800; +_global_impure_ptr = 0x3fffc04c; +__global_locale_ptr = 0x3fffc030; +__locale_ctype_ptr = 0x40002008; +__locale_ctype_ptr_l = 0x40002000; +__locale_mb_cur_max = 0x40001fe8; +__packed = 0x3fffc530; +_PathLocale = 0x3fffc040; diff --git a/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.newlib-funcs.ld b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.newlib-funcs.ld new file mode 100644 index 0000000000..22b41594b5 --- /dev/null +++ b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.newlib-funcs.ld @@ -0,0 +1,96 @@ +/* These are the newlib functions present in ESP32S2beta ROM. + See also esp32s2beta.rom.newlib-data.ld for the list of .data/.bss symbols + used by these functions, and esp32s2beta.rom.newlib-stdio.ld for stdio related + functions. + + Unlike other ROM functions which are exported using PROVIDE, which declares + weak symbols, newlib related functions are exported using assignment, + which declares strong symbols. This is done so that ROM functions are always + used instead of the ones provided by libc.a. + */ + +abs = 0x4000073c; +__ascii_mbtowc = 0x40007de0; +__ascii_wctomb = 0x40001cac; +__assert = 0x4001565c; +__assert_func = 0x40015634; +atoi = 0x40000adc; +_atoi_r = 0x40000aec; +atol = 0x40000b04; +_atol_r = 0x40000b14; +bzero = 0x40007ca4; +_cvt = 0x4000c6d8; +div = 0x40000744; +isalnum = 0x40007cb4; +isalpha = 0x40007cc4; +isascii = 0x40015d18; +isblank = 0x40007cd4; +iscntrl = 0x40007cf4; +isdigit = 0x40007d0c; +isgraph = 0x40007d44; +islower = 0x40007d24; +isprint = 0x40007d5c; +ispunct = 0x40007d70; +isspace = 0x40007d88; +isupper = 0x40007da0; +itoa = 0x40000acc; +__itoa = 0x40000a90; +labs = 0x4000076c; +ldiv = 0x40000774; +longjmp = 0x400006c8; +_mbtowc_r = 0x40007dbc; +memccpy = 0x40015d2c; +memchr = 0x40015d50; +memcmp = 0x40015d6c; +memcpy = 0x40015dd4; +memmove = 0x40015edc; +memrchr = 0x40015f18; +memset = 0x40015f68; +pthread_setcancelstate = 0x400151d4; +qsort = 0x40000818; +rand = 0x40007e54; +rand_r = 0x40007ed0; +setjmp = 0x40000664; +srand = 0x40007e00; +strcasecmp = 0x40007f14; +strcasestr = 0x40007f58; +strcat = 0x40015fbc; +strchr = 0x40015fdc; +strcmp = 0x40007fc0; +strcoll = 0x400080c4; +strcpy = 0x400080d8; +strcspn = 0x40015ff8; +strdup = 0x40008160; +_strdup_r = 0x40008174; +strlcat = 0x40008194; +strlcpy = 0x40016024; +strlen = 0x400081e4; +strlwr = 0x40008244; +strncasecmp = 0x40008270; +strncat = 0x40016060; +strncmp = 0x40016090; +strncpy = 0x400082fc; +strndup = 0x400083c4; +_strndup_r = 0x400083d8; +strnlen = 0x400160c8; +strrchr = 0x4000841c; +strsep = 0x40008448; +strspn = 0x400160e8; +strstr = 0x40016114; +__strtok_r = 0x40016144; +strtok_r = 0x400161a8; +strtol = 0x40000c70; +strtol_l = 0x40000c58; +_strtol_r = 0x40000c34; +strtoul = 0x40000dcc; +strtoul_l = 0x40000db4; +_strtoul_r = 0x40000d90; +strupr = 0x40008460; +toascii = 0x400161bc; +tolower = 0x40008534; +toupper = 0x40008550; +utoa = 0x40000654; +__utoa = 0x400005f0; +wcrtomb = 0x400016d0; +_wcrtomb_r = 0x4000167c; +_wctomb_r = 0x40001c88; diff --git a/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.newlib-stdio.ld b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.newlib-stdio.ld new file mode 100644 index 0000000000..1b076838d3 --- /dev/null +++ b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.newlib-stdio.ld @@ -0,0 +1,54 @@ +/* These are the stdio related newlib functions present in ESP32S2beta ROM. + They are not used when compiling with newlib 3. +*/ + +PROVIDE ( fclose = 0x40015a30 ); +PROVIDE ( _fclose_r = 0x40015940 ); +PROVIDE ( fflush = 0x40001f94 ); +PROVIDE ( _fflush_r = 0x40001f0c ); +PROVIDE ( __fp_lock_all = 0x40015864 ); +PROVIDE ( _fwalk = 0x40016efc ); +PROVIDE ( _fwalk_reent = 0x40016f34 ); +PROVIDE ( fiprintf = 0x40000e18 ); +PROVIDE ( _fiprintf_r = 0x40000df4 ); +PROVIDE ( fprintf = 0x40000e18 ); +PROVIDE ( _fprintf_r = 0x40000df4 ); +PROVIDE ( __fp_unlock_all = 0x40015878 ); +PROVIDE ( fputwc = 0x40001c40 ); +PROVIDE ( __fputwc = 0x40001b4c ); +PROVIDE ( _fputwc_r = 0x40001bd4 ); +PROVIDE ( _printf_common = 0x4000123c ); +PROVIDE ( _printf_float = 0x40015538 ); +PROVIDE ( _printf_i = 0x40001308 ); +PROVIDE ( vfiprintf = 0x4000121c ); +PROVIDE ( _vfiprintf_r = 0x40000f34 ); +PROVIDE ( vfprintf = 0x4000121c ); +PROVIDE ( _vfprintf_r = 0x40000f34 ); +PROVIDE ( _scanf_float = 0x40015554 ); +PROVIDE ( __sclose = 0x4001592c ); +PROVIDE ( __seofread = 0x400158bc ); +PROVIDE ( __sf_fake_stderr = 0x3ffae938 ); +PROVIDE ( __sf_fake_stdin = 0x3ffae978 ); +PROVIDE ( __sf_fake_stdout = 0x3ffae958 ); +PROVIDE ( __sflush_r = 0x40001db8 ); +PROVIDE ( __sfmoreglue = 0x400156f4 ); +PROVIDE ( __sfp = 0x400157bc ); +PROVIDE ( __sfp_lock_acquire = 0x40015734 ); +PROVIDE ( __sfp_lock_release = 0x40015740 ); +PROVIDE ( __sfputs_r = 0x40000e7c ); +PROVIDE ( __sfvwrite_r = 0x400016ec ); +PROVIDE ( __sinit = 0x40015764 ); +PROVIDE ( __sinit_lock_acquire = 0x4001574c ); +PROVIDE ( __sinit_lock_release = 0x40015758 ); +PROVIDE ( __smakebuf_r = 0x40001d30 ); +PROVIDE ( __sprint_r = 0x40000ec8 ); +PROVIDE ( __sread = 0x4001588c ); +PROVIDE ( __sseek = 0x400158f8 ); +PROVIDE ( __swbuf = 0x40001a58 ); +PROVIDE ( __swbuf_r = 0x40001998 ); +PROVIDE ( __swhatbuf_r = 0x40001cd4 ); +PROVIDE ( __swrite = 0x400158c4 ); +PROVIDE ( __swsetup_r = 0x40001a6c ); +PROVIDE ( _cleanup = 0x40015724 ); +PROVIDE ( _cleanup_r = 0x400156ac ); +PROVIDE ( creat = 0x40007c68 ); diff --git a/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.redefined.ld b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.redefined.ld new file mode 100644 index 0000000000..04d949fd16 --- /dev/null +++ b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.redefined.ld @@ -0,0 +1,103 @@ +/* + ROM Functions defined in this file are not used in ESP-IDF as is, + and different definitions for functions with the same names are provided. + This file is not used when linking ESP-IDF and is intended for reference only +*/ + +PROVIDE ( abort = 0x400151e0 ); +PROVIDE ( ets_timer_arm = 0x4000d76c ); +PROVIDE ( ets_timer_arm_us = 0x4000d7b0 ); +PROVIDE ( ets_timer_disarm = 0x4000d7f0 ); +PROVIDE ( ets_timer_done = 0x4000d82c ); +PROVIDE ( ets_timer_handler_isr = 0x4000d858 ); +PROVIDE ( ets_timer_init = 0x4000d8ec ); +PROVIDE ( ets_timer_setfn = 0x4000d754 ); + +PROVIDE ( _KernelExceptionVector = 0x40000300 ); +PROVIDE ( _KernelExceptionVector_text_end = 0x40000306 ); +PROVIDE ( _KernelExceptionVector_text_start = 0x40000300 ); +PROVIDE ( _NMIExceptionVector = 0x400002c0 ); +PROVIDE ( _NMIExceptionVector_text_end = 0x400002c3 ); +PROVIDE ( _NMIExceptionVector_text_start = 0x400002c0 ); +PROVIDE ( _UserExceptionVector = 0x40000340 ); +PROVIDE ( _UserExceptionVector_text_end = 0x40000357 ); +PROVIDE ( _UserExceptionVector_text_start = 0x40000340 ); +PROVIDE ( _DebugExceptionVector = 0x40000280 ); +PROVIDE ( _DebugExceptionVector_text_end = 0x4000028b ); +PROVIDE ( _DebugExceptionVector_text_start = 0x40000280 ); +PROVIDE ( _DoubleExceptionVector = 0x400003c0 ); +PROVIDE ( _DoubleExceptionVector_text_end = 0x400003c6 ); +PROVIDE ( _DoubleExceptionVector_text_start = 0x400003c0 ); +PROVIDE ( _Level2FromVector = 0x400078d4 ); +PROVIDE ( _Level2HandlerLabel = 0x00000000 ); +PROVIDE ( _Level2InterruptVector_text_end = 0x40000186 ); +PROVIDE ( _Level2InterruptVector_text_start = 0x40000180 ); +PROVIDE ( _Level2Vector = 0x40000180 ); +PROVIDE ( _Level3FromVector = 0x40007970 ); +PROVIDE ( _Level3HandlerLabel = 0x00000000 ); +PROVIDE ( _Level3InterruptVector_text_end = 0x400001c6 ); +PROVIDE ( _Level3InterruptVector_text_start = 0x400001c0 ); +PROVIDE ( _Level3Vector = 0x400001c0 ); +PROVIDE ( _Level4FromVector = 0x40007a08 ); +PROVIDE ( _Level4HandlerLabel = 0x00000000 ); +PROVIDE ( _Level4InterruptVector_text_end = 0x40000206 ); +PROVIDE ( _Level4InterruptVector_text_start = 0x40000200 ); +PROVIDE ( _Level4Vector = 0x40000200 ); +PROVIDE ( _Level5FromVector = 0x40007b38 ); +PROVIDE ( _Level5HandlerLabel = 0x00000000 ); +PROVIDE ( _Level5InterruptVector_text_end = 0x40000246 ); +PROVIDE ( _Level5InterruptVector_text_start = 0x40000240 ); +PROVIDE ( _Level5Vector = 0x40000240 ); +PROVIDE ( _LevelOneInterrupt = 0x400077e6 ); +PROVIDE ( _ResetHandler = 0x4000044c ); +PROVIDE ( _ResetVector = 0x40000400 ); +PROVIDE ( _ResetVector_literal_end = 0x40000540 ); +PROVIDE ( _ResetVector_literal_start = 0x40000540 ); +PROVIDE ( _ResetVector_text_end = 0x4000053d ); +PROVIDE ( _ResetVector_text_start = 0x40000400 ); +PROVIDE ( _SyscallException = 0x40007706 ); +PROVIDE ( _WindowOverflow12 = 0x40000100 ); +PROVIDE ( _WindowOverflow4 = 0x40000000 ); +PROVIDE ( _WindowOverflow8 = 0x40000080 ); +PROVIDE ( _WindowUnderflow12 = 0x40000140 ); +PROVIDE ( _WindowUnderflow4 = 0x40000040 ); +PROVIDE ( _WindowUnderflow8 = 0x400000c0 ); +PROVIDE ( _WindowVectors_text_end = 0x40000170 ); +PROVIDE ( _WindowVectors_text_start = 0x40000000 ); + +PROVIDE ( hmac_md5 = 0x4000586c ); +PROVIDE ( hmac_md5_vector = 0x4000577c ); +PROVIDE ( MD5Final = 0x400056e8 ); +PROVIDE ( MD5Init = 0x40005648 ); +PROVIDE ( MD5Update = 0x40005668 ); +PROVIDE ( md5_vector = 0x40005750 ); + +PROVIDE ( _xtos_alloca_handler = 0x40000010 ); +PROVIDE ( xtos_cause3_handler = 0x4000774c ); +PROVIDE ( xtos_c_handler_table = 0x3fffcea8 ); +PROVIDE ( xtos_c_wrapper_handler = 0x4000775c ); +PROVIDE ( _xtos_enabled = 0x3fffcfb0 ); +PROVIDE ( xtos_exc_handler_table = 0x3fffcda8 ); +PROVIDE ( xtos_interrupt_mask_table = 0x3fffd0b8 ); +PROVIDE ( xtos_interrupt_table = 0x3fffcfb8 ); +PROVIDE ( _xtos_ints_off = 0x4001560c ); +PROVIDE ( _xtos_ints_on = 0x400155e8 ); +PROVIDE ( _xtos_intstruct = 0x3fffcfb0 ); +PROVIDE ( _xtos_l1int_handler = 0x400077c8 ); +PROVIDE ( xtos_p_none = 0x40015acc ); +PROVIDE ( _xtos_restore_intlevel = 0x400078a8 ); +PROVIDE ( _xtos_return_from_exc = 0x40015ad4 ); +PROVIDE ( _xtos_set_exception_handler = 0x40007690 ); +PROVIDE ( _xtos_set_interrupt_handler = 0x400155ac ); +PROVIDE ( _xtos_set_interrupt_handler_arg = 0x40015570 ); +PROVIDE ( _xtos_set_intlevel = 0x40015aec ); +PROVIDE ( _xtos_set_min_intlevel = 0x40015b08 ); +PROVIDE ( _xtos_set_vpri = 0x400078b4 ); +PROVIDE ( _xtos_syscall_handler = 0x400076d8 ); +PROVIDE ( xtos_unhandled_exception = 0x40015b2c ); +PROVIDE ( xtos_unhandled_interrupt = 0x40015b3c ); +PROVIDE ( _xtos_vectors_ref_ = 0x00000000 ); +PROVIDE ( _xtos_vpri_enabled = 0x3fffcfb4 ); + +PROVIDE ( setlocale = 0x40002020 ); +PROVIDE ( _setlocale_r = 0x40001fb8 ); diff --git a/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.spiflash.ld b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.spiflash.ld new file mode 100644 index 0000000000..71195da2bc --- /dev/null +++ b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.spiflash.ld @@ -0,0 +1,30 @@ +/* + SPI flash driver function, compatibility names. +*/ + + +PROVIDE ( cache_ibus_mmu_set_rom = cache_ibus_mmu_set ); +PROVIDE ( Cache_Read_Disable_rom = Cache_Read_Disable ); +PROVIDE ( Cache_Read_Enable_rom = Cache_Read_Enable ); +PROVIDE ( cache_dbus_mmu_set_rom = cache_dbus_mmu_set ); +PROVIDE ( g_rom_spiflash_dummy_len_plus = dummy_len_plus); +PROVIDE ( g_ticks_per_us_pro = g_ticks_per_us ); +PROVIDE ( g_rom_flashchip = SPI_flashchip_data ); +PROVIDE ( g_rom_spiflash_chip = SPI_flashchip_data ); +PROVIDE ( esp_rom_spiflash_config_param = SPIParamCfg ); +PROVIDE ( esp_rom_spiflash_read = SPIRead ); +PROVIDE ( esp_rom_spiflash_read_status = SPI_read_status ); +PROVIDE ( esp_rom_spiflash_read_statushigh = SPI_read_status_high ); +PROVIDE ( esp_rom_spiflash_read_user_cmd = SPI_user_command_read ); +PROVIDE ( esp_rom_spiflash_write = SPIWrite ); +PROVIDE ( esp_rom_spiflash_write_encrypted_disable = SPI_Write_Encrypt_Disable ); +PROVIDE ( esp_rom_spiflash_write_encrypted_enable = SPI_Write_Encrypt_Enable ); +PROVIDE ( esp_rom_spiflash_config_clk = SPIClkConfig ); +PROVIDE ( esp_rom_spiflash_select_qio_pins = SelectSpiQIO ); +PROVIDE ( esp_rom_spiflash_unlock = SPIUnlock ); +PROVIDE ( esp_rom_spiflash_erase_sector = SPIEraseSector ); +PROVIDE ( esp_rom_spiflash_erase_block = SPIEraseBlock ); +PROVIDE ( esp_rom_spiflash_wait_idle = SPI_Wait_Idle ); +PROVIDE ( esp_rom_spiflash_config_readmode = SPIReadModeCnfig ); +PROVIDE ( esp_rom_spiflash_erase_block = SPIEraseBlock ); +PROVIDE ( esp_rom_spiflash_write_encrypted = SPI_Encrypt_Write ); \ No newline at end of file diff --git a/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.syscalls.ld b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.syscalls.ld new file mode 100644 index 0000000000..9d4d45ec25 --- /dev/null +++ b/components/esp_rom/esp32s2beta/ld/esp32s2beta.rom.syscalls.ld @@ -0,0 +1,60 @@ +/* These ROM functions call respective entries in the syscall table. + They are called by other ROM functions (mostly from newlib). + We don't link to them directly, since in IDF there are actual + implementations of these functions, with same names. + + I.e.: + + times (in ROM) -> _times_r (in ROM) -> syscall table entry _times_r -> _times_r (in IDF) + + Hence the following entries are provided only for reference + and commented out. + */ + +/* + +PROVIDE ( calloc = 0x40015520 ); +PROVIDE ( _calloc_r = 0x40015234 ); +PROVIDE ( close = 0x4000848c ); +PROVIDE ( _close_r = 0x40015378 ); +PROVIDE ( free = 0x400154f4 ); +PROVIDE ( _free_r = 0x40015208 ); +PROVIDE ( _fstat_r = 0x40015308 ); +PROVIDE ( _getpid_r = 0x40015338 ); +PROVIDE ( __getreent = 0x400154c8 ); +PROVIDE ( _gettimeofday_r = 0x40015294 ); +PROVIDE ( _kill_r = 0x4001534c ); +PROVIDE ( _link_r = 0x400152d8 ); +PROVIDE ( _lock_acquire = 0x40015450 ); +PROVIDE ( _lock_acquire_recursive = 0x40015464 ); +PROVIDE ( _lock_close = 0x40015428 ); +PROVIDE ( _lock_close_recursive = 0x4001543c ); +PROVIDE ( _lock_init = 0x40015400 ); +PROVIDE ( _lock_init_recursive = 0x40015414 ); +PROVIDE ( _lock_release = 0x400154a0 ); +PROVIDE ( _lock_release_recursive = 0x400154b4 ); +PROVIDE ( _lock_try_acquire = 0x40015478 ); +PROVIDE ( _lock_try_acquire_recursive = 0x4001548c ); +PROVIDE ( _lseek_r = 0x400153c8 ); +PROVIDE ( malloc = 0x400154dc ); +PROVIDE ( _malloc_r = 0x400151f0 ); +PROVIDE ( open = 0x400084a0 ); +PROVIDE ( _open_r = 0x40015390 ); +PROVIDE ( _raise_r = 0x400152ac ); +PROVIDE ( read = 0x400084f0 ); +PROVIDE ( _read_r = 0x400153e4 ); +PROVIDE ( realloc = 0x40015508 ); +PROVIDE ( _realloc_r = 0x4001521c ); +PROVIDE ( _rename_r = 0x40015264 ); +PROVIDE ( sbrk = 0x40008508 ); +PROVIDE ( _sbrk_r = 0x40015320 ); +PROVIDE ( _stat_r = 0x400152f0 ); +PROVIDE ( _system_r = 0x4001524c ); +PROVIDE ( _times_r = 0x4001527c ); +PROVIDE ( _unlink_r = 0x400152c0 ); +PROVIDE ( write = 0x4000851c ); +PROVIDE ( _write_r = 0x400153ac ); +PROVIDE ( _isatty_r = 0x40007c7c ); +PROVIDE ( _exit_r = 0x40015364 ); + +*/ diff --git a/components/esp_rom/include/esp32/rom/ets_sys.h b/components/esp_rom/include/esp32/rom/ets_sys.h index fe1dacbf2a..3485f0d406 100644 --- a/components/esp_rom/include/esp32/rom/ets_sys.h +++ b/components/esp_rom/include/esp32/rom/ets_sys.h @@ -25,6 +25,10 @@ #include "soc/soc.h" #endif +#ifndef CONFIG_IDF_TARGET_ESP32 +#error "This header should only be included when building for ESP32" +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/components/esp_rom/include/esp32/rom/rtc.h b/components/esp_rom/include/esp32/rom/rtc.h index 6d9d297746..83e621631a 100644 --- a/components/esp_rom/include/esp32/rom/rtc.h +++ b/components/esp_rom/include/esp32/rom/rtc.h @@ -21,6 +21,7 @@ #include #include "soc/soc.h" +#include "soc/rtc_cntl_reg.h" #ifdef __cplusplus extern "C" { diff --git a/components/esp_rom/include/esp32s2beta/rom/aes.h b/components/esp_rom/include/esp32s2beta/rom/aes.h new file mode 100644 index 0000000000..9350e2511e --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/aes.h @@ -0,0 +1,62 @@ +/* + ROM functions for hardware AES support. + + It is not recommended to use these functions directly, + use the wrapper functions in hwcrypto/aes.h instead. + + */ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define AES_BLOCK_SIZE 16 + +enum AES_TYPE { + AES_ENC, + AES_DEC, +}; + +enum AES_BITS { + AES128, + AES192, + AES256 +}; + +void ets_aes_enable(void); + +void ets_aes_disable(void); + +void ets_aes_set_endian(bool key_word_swap, bool key_byte_swap, + bool in_word_swap, bool in_byte_swap, + bool out_word_swap, bool out_byte_swap); + +int ets_aes_setkey(enum AES_TYPE type, const void *key, enum AES_BITS bits); + +int ets_aes_setkey_enc(const void *key, enum AES_BITS bits); + +int ets_aes_setkey_dec(const void *key, enum AES_BITS bits); + +void ets_aes_block(const void *input, void *output); + +#ifdef __cplusplus +} +#endif diff --git a/components/esp_rom/include/esp32s2beta/rom/bigint.h b/components/esp_rom/include/esp32s2beta/rom/bigint.h new file mode 100644 index 0000000000..eee19d46bb --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/bigint.h @@ -0,0 +1,50 @@ +/* + ROM functions for hardware bigint support. + + It is not recommended to use these functions directly, + use the wrapper functions in hwcrypto/mpi.h instead. + + */ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _ROM_BIGINT_H_ +#define _ROM_BIGINT_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void ets_bigint_enable(void); + +void ets_bigint_disable(void); + +int ets_bigint_multiply(const uint32_t *x, const uint32_t *y, uint32_t len_words); + +int ets_bigint_modmult(const uint32_t *x, const uint32_t *y, const uint32_t *m, uint32_t m_dash, const uint32_t *rb, uint32_t len_words); + +int ets_bigint_modexp(const uint32_t *x, const uint32_t *y, const uint32_t *m, uint32_t m_dash, const uint32_t *rb, bool constant_time, uint32_t len_words); + +void ets_bigint_wait_finish(void); + +int ets_bigint_getz(uint32_t *z, uint32_t len_words); + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_BIGINT_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/cache.h b/components/esp_rom/include/esp32s2beta/rom/cache.h new file mode 100644 index 0000000000..666053b36c --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/cache.h @@ -0,0 +1,931 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _ROM_CACHE_H_ +#define _ROM_CACHE_H_ + +#include "esp_bit_defs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup cache_apis, cache operation related apis + * @brief cache apis + */ + +/** @addtogroup cache_apis + * @{ + */ + +#define MIN_CACHE_SIZE 8192 +#define MAX_CACHE_SIZE 16384 +#define MIN_CACHE_WAYS 4 +#define MAX_CACHE_WAYS 8 +#define MIN_CACHE_LINE_SIZE 16 +#define MAX_CACHE_LINE_SIZE 64 +//normally should be (MAX_CACHE_SIZE / MIN_CACHE_WAYS / MIN_CACHE_LINE_SIZE), however, the items not all in one tag memory block. +#define MAX_TAG_BLOCK_ITEMS (MAX_CACHE_SIZE / MAX_CACHE_WAYS / MIN_CACHE_LINE_SIZE) +#define TAG_SIZE 4 +#define MAX_TAG_BLOCK_SIZE (MAX_TAG_BLOCK_ITEMS * TAG_SIZE) + +#define ESP_CACHE_TEMP_ADDR DROM0_ADDRESS_LOW +#define CACHE_MAX_OPERATION_SIZE BUS_ADDR_SIZE + + +typedef enum { + CACHE_MEMORY_INVALID = 0, + CACHE_MEMORY_ICACHE_LOW = BIT(0), + CACHE_MEMORY_ICACHE_HIGH = BIT(1), + CACHE_MEMORY_DCACHE_LOW = BIT(2), + CACHE_MEMORY_DCACHE_HIGH = BIT(3), +} cache_layout_t; + +typedef enum { + CACHE_SIZE_8KB = 0, + CACHE_SIZE_16KB = 1, +} cache_size_t; + +typedef enum { + CACHE_4WAYS_ASSOC = 0, + CACHE_8WAYS_ASSOC = 1, +} cache_ways_t; + +typedef enum { + CACHE_LINE_SIZE_16B = 0, + CACHE_LINE_SIZE_32B = 1, + CACHE_LINE_SIZE_64B = 2, +} cache_line_size_t; + +typedef enum { + CACHE_AUTOLOAD_NORMAL_MODE = 0, /*!< normal mode will autoload anytime if enabled */ + CACHE_AUTOLOAD_REGION_MODE = 1, /*!< region mode only autoload if access the memory in regions */ +} cache_autoload_mode_t; + +typedef enum { + CACHE_AUTOLOAD_POSITIVE = 0, /*!< cache autoload step is positive */ + CACHE_AUTOLOAD_NEGATIVE = 1, /*!< cache autoload step is negative */ +} cache_autoload_order_t; + +#define CACHE_AUTOLOAD_STEP(i) ((i) - 1) + +typedef enum { + CACHE_AUTOLOAD_MISS_TRIGGER = 0, /*!< autoload only triggered by cache miss */ + CACHE_AUTOLOAD_HIT_TRIGGER = 1, /*!< autoload only triggered by cache hit */ + CACHE_AUTOLOAD_BOTH_TRIGGER = 2, /*!< autoload triggered both by cache miss and hit */ +} cache_autoload_trigger_t; + +struct cache_mode { + uint32_t cache_size; + uint16_t cache_line_size; + uint8_t cache_ways; + uint8_t icache; +}; + +struct tag_item { + uint32_t dirty:1; /*!< the cache line value is dirty or not */ + uint32_t tag:14; /*!< the tag is the high part of the cache address, however is only 16MB range, and with out low part */ + uint32_t valid:1; /*!< the tag item is valid or not */ + uint32_t fifo_cnt:3; /*!< fifo cnt, 0 ~ 3 for 4 ways cache, 0 ~ 7 for 8 ways cache */ + uint32_t lock:1; /*!< the cache line is locked or not */ + uint32_t attr:3; /*!< the attribute of the external memory physical address */ + uint32_t access:1; /*!< software accessable, used by hardware */ + uint32_t reserved:8; +}; + +struct autoload_config { + uint8_t mode; /*!< autoload mode */ + uint8_t order; /*!< autoload step is positive or negative */ + uint8_t step; /*!< autoload step */ + uint8_t trigger; /*!< autoload trigger */ + uint32_t autoload_size; /*!< autoload size */ + uint32_t addr0; /*!< autoload region0 start address */ + uint32_t size0; /*!< autoload region0 size */ + uint32_t addr1; /*!< autoload region1 start address */ + uint32_t size1; /*!< autoload region1 size */ +}; + +struct tag_group_info { + struct cache_mode mode; /*!< cache and cache mode */ + uint32_t vaddr_offset; /*!< virtual address offset of the cache ways */ + uint32_t tag_addr[MAX_CACHE_WAYS]; /*!< tag memory address, only [0~mode.ways-1] is valid to use */ + uint32_t cache_memory_offset[MAX_CACHE_WAYS]; /*!< cache memory address, only [0~mode.ways-1] is valid to use */ +}; + +struct lock_config { + uint32_t addr; /*!< manual lock address*/ + uint16_t size; /*!< manual lock size*/ + uint16_t group; /*!< manual lock group, 0 or 1*/ +}; + +#define MMU_SET_ADDR_ALIGNED_ERROR 1 +#define MMU_SET_PASE_SIZE_ERROR 3 +#define MMU_SET_VADDR_OUT_RANGE 5 + +/** + * @brief Initialise cache mmu, mark all entries as invalid. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_MMU_Init(void); + +/** + * @brief Set ICache mmu mapping. + * Please do not call this function in your SDK application. + * + * @param uint32_t ext_ram : DPORT_MMU_ACCESS_FLASH for flash, DPORT_MMU_ACCESS_SPIRAM for spiram, DPORT_MMU_INVALID for invalid. + * + * @param uint32_t vaddr : virtual address in CPU address space. + * Can be Iram0,Iram1,Irom0,Drom0 and AHB buses address. + * Should be aligned by psize. + * + * @param uint32_t paddr : physical address in external memory. + * Should be aligned by psize. + * + * @param uint32_t psize : page size of ICache, in kilobytes. Should be 64 here. + * + * @param uint32_t num : pages to be set. + * + * @param uint32_t fixed : 0 for physical pages grow with virtual pages, other for virtual pages map to same physical page. + * + * @return uint32_t: error status + * 0 : mmu set success + * 1 : vaddr or paddr is not aligned + * 3 : psize error + * 5 : vaddr is out of range + */ +int Cache_Ibus_MMU_Set(uint32_t ext_ram, uint32_t vaddr, uint32_t paddr, uint32_t psize, uint32_t num, uint32_t fixed); + +/** + * @brief Set DCache mmu mapping. + * Please do not call this function in your SDK application. + * + * @param uint32_t ext_ram : DPORT_MMU_ACCESS_FLASH for flash, DPORT_MMU_ACCESS_SPIRAM for spiram, DPORT_MMU_INVALID for invalid. + * + * @param uint32_t vaddr : virtual address in CPU address space. + * Can be DRam0, DRam1, DRom0, DPort and AHB buses address. + * Should be aligned by psize. + * + * @param uint32_t paddr : physical address in external memory. + * Should be aligned by psize. + * + * @param uint32_t psize : page size of DCache, in kilobytes. Should be 64 here. + * + * @param uint32_t num : pages to be set. + + * @param uint32_t fixed : 0 for physical pages grow with virtual pages, other for virtual pages map to same physical page. + * + * @return uint32_t: error status + * 0 : mmu set success + * 1 : vaddr or paddr is not aligned + * 3 : psize error + * 5 : vaddr is out of range + */ +int Cache_Dbus_MMU_Set(uint32_t ext_ram, uint32_t vaddr, uint32_t paddr, uint32_t psize, uint32_t num, uint32_t fixed); + +/** + * @brief Copy DRom0 ICache MMU to DCache MMU. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void MMU_Drom0_I2D_Copy(void); + +/** + * @brief Unmap DRom0 ICache MMU. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void MMU_Drom_ICache_Unmap(void); + +/** + * @brief Count the pages in the bus room address which map to Flash. + * Please do not call this function in your SDK application. + * + * @param uint32_t bus : the bus to count with. + * + * @param uint32_t * page0_mapped : value should be initial by user, 0 for not mapped, other for mapped count. + * + * return uint32_t : the number of pages which map to Flash. + */ +uint32_t Cache_Count_Flash_Pages(uint32_t bus, uint32_t * page0_mapped); + +/** + * @brief Copy Instruction or rodata from Flash to SPIRAM, and remap to SPIRAM. + * Please do not call this function in your SDK application. + * + * @param uint32_t bus : the bus which need to copy to SPIRAM. + * + * @param uint32_t bus_start_addr : the start virtual address for the bus. + * + * @param uint32_t start_page : the start (64KB) page number in SPIRAM. + * + * @param uint32_t * page0_page : the flash page0 in SPIRAM page number, 0xffff for invalid. + * + * return uint32_t : the next start page number for SPIRAM not mapped. + */ +uint32_t Cache_Flash_To_SPIRAM_Copy(uint32_t bus, uint32_t bus_start_addr, uint32_t start_page, uint32_t * page0_page); + + +/** + * @brief allocate memory to used by ICache and DCache. + * Please do not call this function in your SDK application. + * + * @param cache_layout_t sram0_layout : the usage of first 8KB internal memory block, can be CACHE_MEMORY_INVALID, CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_ICACHE_HIGH, CACHE_MEMORY_DCACHE_LOW and CACHE_MEMORY_DCACHE_HIGH + * + * @param cache_layout_t sram1_layout : the usage of second 8KB internal memory block + * + * @param cache_layout_t sram2_layout : the usage of third 8KB internal memory block + * + * @param cache_layout_t sram3_layout : the usage of forth 8KB internal memory block + * + * return none + */ +void Cache_Allocate_SRAM(cache_layout_t sram0_layout, cache_layout_t sram1_layout, cache_layout_t sram2_layout, cache_layout_t sram3_layout); + +/** + * @brief Get cache mode of ICache or DCache. + * Please do not call this function in your SDK application. + * + * @param struct cache_mode * mode : the pointer of cache mode struct + * + * return none + */ +void Cache_Get_Mode(struct cache_mode * mode); + +/** + * @brief set ICache modes: cache size, associate ways and cache line size. + * Please do not call this function in your SDK application. + * + * @param cache_size_t cache_size : the cache size, can be CACHE_SIZE_8KB and CACHE_SIZE_16KB + * + * @param cache_ways_t ways : the associate ways of cache, cane be CACHE_4WAYS_ASSOC and CACHE_8WAYS_ASSOC + * + * @param cache_line_size_t cache_line_size : the cache line size, can be CACHE_LINE_SIZE_16B, CACHE_LINE_SIZE_32B and CACHE_LINE_SIZE_64B + * + * @param cache_layout_t sram3_layout : the usage of forth 8KB internal memory block + * + * return none + */ +void Cache_Set_ICache_Mode(cache_size_t cache_size, cache_ways_t ways, cache_line_size_t cache_line_size); + +/** + * @brief set DCache modes: cache size, associate ways and cache line size. + * Please do not call this function in your SDK application. + * + * @param cache_size_t cache_size : the cache size, can be CACHE_SIZE_8KB and CACHE_SIZE_16KB + * + * @param cache_ways_t ways : the associate ways of cache, cane be CACHE_4WAYS_ASSOC and CACHE_8WAYS_ASSOC + * + * @param cache_line_size_t cache_line_size : the cache line size, can be CACHE_LINE_SIZE_16B, CACHE_LINE_SIZE_32B and CACHE_LINE_SIZE_64B + * + * @param cache_layout_t sram3_layout : the usage of forth 8KB internal memory block + * + * return none + */ +void Cache_Set_DCache_Mode(cache_size_t cache_size, cache_ways_t ways, cache_line_size_t cache_line_size); + +/** + * @brief check if the address is accessed through ICache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : the address to check. + * + * @return 1 if the address is accessed through ICache, 0 if not. + */ +uint32_t Cache_Address_Through_ICache(uint32_t addr); + +/** + * @brief check if the address is accessed through DCache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : the address to check. + * + * @return 1 if the address is accessed through DCache, 0 if not. + */ +uint32_t Cache_Address_Through_DCache(uint32_t addr); + +/** + * @brief Invalidate the cache items for ICache. + * Operation will be done CACHE_LINE_SIZE aligned. + * If the addr is not in our addr room, we will Flush all Cache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr: start address to invalidate + * + * @param uint32_t size: size to invalidate, should <= 4MB + * + * @return None + */ +void Cache_Invalidate_ICache_Items(uint32_t addr, uint32_t size); + +/** + * @brief Invalidate the cache items for DCache. + * Operation will be done CACHE_LINE_SIZE aligned. + * If the addr is not in our addr room, we will Flush all Cache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr: start address to invalidate + * + * @param uint32_t size: size to invalidate, should <= 4MB + * + * @return None + */ +void Cache_Invalidate_DCache_Items(uint32_t addr, uint32_t size); + +/** + * @brief Clean the dirty bit of cache Items of DCache. + * Operation will be done CACHE_LINE_SIZE aligned. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr: start address to Clean + * + * @param uint32_t size: size to Clean, should <= 4MB + * + * @return None + */ +void Cache_Clean_Items(uint32_t addr, uint32_t size); + +/** + * @brief Write back the cache items of DCache. + * Operation will be done CACHE_LINE_SIZE aligned. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr: start address to write back + * + * @param uint32_t size: size to write back, should <= 4MB + * + * @return None + */ +void Cache_WriteBack_Items(uint32_t addr, uint32_t size); + +/** + * @brief Invalidate the Cache items in the region from ICache or DCache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : invalidated region start address. + * + * @param uint32_t size : invalidated region size. + * + * @return None + */ +void Cache_Invalidate_Addr(uint32_t addr, uint32_t size); + +/** + * @brief Clean the dirty bit of Cache items in the region from DCache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : cleaned region start address. + * + * @param uint32_t size : cleaned region size. + * + * @return None + */ +void Cache_Clean_Addr(uint32_t addr, uint32_t size); + +/** + * @brief Writeback the Cache items(also clean the dirty bit) in the region from DCache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : writeback region start address. + * + * @param uint32_t size : writeback region size. + * + * @return None + */ +void Cache_WriteBack_Addr(uint32_t addr, uint32_t size); + + +/** + * @brief Invalidate all cache items in ICache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Invalidate_ICache_All(void); + +/** + * @brief Invalidate all cache items in DCache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Invalidate_DCache_All(void); + +/** + * @brief Clean the dirty bit of all cache items in DCache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Clean_All(void); + +/** + * @brief WriteBack all cache items in DCache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_WriteBack_All(void); + +/** + * @brief Mask all buses through ICache and DCache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Mask_All(void); + +/** + * @brief UnMask DRom0 bus through ICache or DCache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_UnMask_Drom0(void); + +/** + * @brief Suspend ICache auto preload operation, then you can resume it after some ICache operations. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return uint32_t : 0 for ICache not auto preload before suspend. + */ +uint32_t Cache_Suspend_ICache_Autoload(void); + +/** + * @brief Resume ICache auto preload operation after some ICache operations. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : 0 for ICache not auto preload before suspend. + * + * @return None. + */ +void Cache_Resume_ICache_Autoload(uint32_t autoload); + +/** + * @brief Suspend DCache auto preload operation, then you can resume it after some DCache operations. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return uint32_t : 0 for DCache not auto preload before suspend. + */ +uint32_t Cache_Suspend_DCache_Autoload(void); + +/** + * @brief Resume DCache auto preload operation after some DCache operations. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : 0 for DCache not auto preload before suspend. + * + * @return None. + */ +void Cache_Resume_DCache_Autoload(uint32_t autoload); + +/** + * @brief Start an ICache manual preload, will suspend auto preload of ICache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : start address of the preload region. + * + * @param uint32_t size : size of the preload region, should not exceed the size of ICache. + * + * @param uint32_t order : the preload order, 0 for positive, other for negative + * + * @return uint32_t : 0 for ICache not auto preload before manual preload. + */ +uint32_t Cache_Start_ICache_Preload(uint32_t addr, uint32_t size, uint32_t order); + +/** + * @brief Return if the ICache manual preload done. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return uint32_t : 0 for ICache manual preload not done. + */ +uint32_t Cache_ICache_Preload_Done(void); + +/** + * @brief End the ICache manual preload to resume auto preload of ICache. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : 0 for ICache not auto preload before manual preload. + * + * @return None + */ +void Cache_End_ICache_Preload(uint32_t autoload); + +/** + * @brief Start an DCache manual preload, will suspend auto preload of DCache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : start address of the preload region. + * + * @param uint32_t size : size of the preload region, should not exceed the size of DCache. + * + * @param uint32_t order : the preload order, 0 for positive, other for negative + * + * @return uint32_t : 0 for DCache not auto preload before manual preload. + */ +uint32_t Cache_Start_DCache_Preload(uint32_t addr, uint32_t size, uint32_t order); + +/** + * @brief Return if the DCache manual preload done. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return uint32_t : 0 for DCache manual preload not done. + */ +uint32_t Cache_DCache_Preload_Done(void); + +/** + * @brief End the DCache manual preload to resume auto preload of DCache. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : 0 for DCache not auto preload before manual preload. + * + * @return None + */ +void Cache_End_DCache_Preload(uint32_t autoload); + +/** + * @brief Config autoload parameters of ICache. + * Please do not call this function in your SDK application. + * + * @param struct autoload_config * config : autoload parameters. + * + * @return None + */ +void Cache_Config_ICache_Autoload(const struct autoload_config * config); + +/** + * @brief Enable auto preload for ICache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Enable_ICache_Autoload(void); + +/** + * @brief Disable auto preload for ICache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Disable_ICache_Autoload(void); + +/** + * @brief Config autoload parameters of DCache. + * Please do not call this function in your SDK application. + * + * @param struct autoload_config * config : autoload parameters. + * + * @return None + */ +void Cache_Config_DCache_Autoload(const struct autoload_config * config); + +/** + * @brief Enable auto preload for DCache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Enable_DCache_Autoload(void); + +/** + * @brief Disable auto preload for DCache. + * Please do not call this function in your SDK application. + * + * @param None + * + * @return None + */ +void Cache_Disable_DCache_Autoload(void); + +/** + * @brief Config a group of lock parameters of ICache. + * Please do not call this function in your SDK application. + * + * @param struct lock_config * config : a group of lock parameters. + * + * @return None + */ +void Cache_Enable_ICache_Lock(const struct lock_config *config); + +/** + * @brief Disable a group of lock parameters for ICache. + * However, the locked data will not be released. + * Please do not call this function in your SDK application. + * + * @param uint16_t group : 0 for group0, 1 for group1. + * + * @return None + */ +void Cache_Disable_ICache_Lock(uint16_t group); + +/** + * @brief Unlock the cache items in tag memory for ICache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : start address of unlock region. + * + * @param uint32_t size : size of unlock region. + * + * @return None + */ +void Cache_Unlock_ICache(uint32_t addr, uint32_t size); + +/** + * @brief Config a group of lock parameters of DCache. + * Please do not call this function in your SDK application. + * + * @param struct lock_config * config : a group of lock parameters. + * + * @return None + */ +void Cache_Enable_DCache_Lock(const struct lock_config *config); + +/** + * @brief Disable a group of lock parameters for DCache. + * However, the locked data will not be released. + * Please do not call this function in your SDK application. + * + * @param uint16_t group : 0 for group0, 1 for group1. + * + * @return None + */ +void Cache_Disable_DCache_Lock(uint16_t group); + +/** + * @brief Unlock the cache items in tag memory for DCache. + * Please do not call this function in your SDK application. + * + * @param uint32_t addr : start address of unlock region. + * + * @param uint32_t size : size of unlock region. + * + * @return None + */ +void Cache_Unlock_DCache(uint32_t addr, uint32_t size); + +/** + * @brief Disable ICache access for the cpu. + * This operation will make all ICache tag memory invalid, CPU can't access ICache, ICache will keep idle. + * Please do not call this function in your SDK application. + * + * @return uint32_t : auto preload enabled before + */ +uint32_t Cache_Disable_ICache(void); + +/** + * @brief Enable ICache access for the cpu. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : ICache will preload then. + * + * @return None + */ +void Cache_Enable_ICache(uint32_t autoload); + +/** + * @brief Disable DCache access for the cpu. + * This operation will make all DCache tag memory invalid, CPU can't access DCache, DCache will keep idle + * Please do not call this function in your SDK application. + * + * @return uint32_t : auto preload enabled before + */ +uint32_t Cache_Disable_DCache(void); + +/** + * @brief Enable DCache access for the cpu. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : DCache will preload then. + * + * @return None + */ +void Cache_Enable_DCache(uint32_t autoload); + +/** + * @brief Suspend ICache access for the cpu. + * The ICache tag memory is still there, CPU can't access ICache, ICache will keep idle. + * Please do not change MMU, cache mode or tag memory(tag memory can be changed in some special case). + * Please do not call this function in your SDK application. + * + * @param None + * + * @return uint32_t : auto preload enabled before + */ +uint32_t Cache_Suspend_ICache(void); + +/** + * @brief Resume ICache access for the cpu. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : ICache will preload then. + * + * @return None + */ +void Cache_Resume_ICache(uint32_t autoload); + +/** + * @brief Suspend DCache access for the cpu. + * The ICache tag memory is still there, CPU can't access DCache, DCache will keep idle. + × Please do not change MMU, cache mode or tag memory(tag memory can be changed in some special case). + * Please do not call this function in your SDK application. + * + * @param None + * + * @return uint32_t : auto preload enabled before + */ +uint32_t Cache_Suspend_DCache(void); + +/** + * @brief Resume DCache access for the cpu. + * Please do not call this function in your SDK application. + * + * @param uint32_t autoload : DCache will preload then. + * + * @return None + */ +void Cache_Resume_DCache(uint32_t autoload); + +/** + * @brief Make Drom0 bus access from ICache. + * + * @param None + * + * @return None + */ +void Cache_Drom0_Source_ICache(void); + +/** + * @brief Make Drom0 bus access from DCache. + * + * @param None + * + * @return None + */ +void Cache_Drom0_Source_DCache(void); + +/** + * @brief Return if Drom0 bus access from ICache. + * + * @param None + * + * @return uint32_t: 0 for no, other for yes + */ +uint32_t Cache_Drom0_Using_ICache(void); + +/** + * @brief Return if Drom0 bus access from DCache. + * + * @param None + * + * @return uint32_t: 0 for no, other for yes + */ +uint32_t Cache_Drom0_Using_DCache(void); + +/** + * @brief Get ICache cache line size + * + * @param None + * + * @return uint32_t: 16, 32, 64 Byte + */ +uint32_t Cache_Get_ICache_Line_Size(void); + +/** + * @brief Get DCache cache line size + * + * @param None + * + * @return uint32_t: 16, 32, 64 Byte + */ +uint32_t Cache_Get_DCache_Line_Size(void); + +/** + * @brief Set default mode from boot. + * + * @param None + * + * @return None + */ +void Cache_Set_Default_Mode(void); + +/** + * @brief Travel tag memory to run a call back function. + * ICache and DCache are suspend when doing this. + * The callback will get the parameter tag_group_info, which will include a group of tag memory addresses and cache memory addresses. + * Please do not call this function in your SDK application. + * + * @param struct cache_mode * mode : the cache to check and the cache mode. + * + * @param uint32_t filter_addr : only the cache lines which may include the filter_address will be returned to the call back function. + * 0 for do not filter, all cache lines will be returned. + * + * @param void (* process)(struct tag_group_info *) : call back function, which may be called many times, a group(the addresses in the group are in the same position in the cache ways) a time. + * + * @return None + */ +void Cache_Travel_Tag_Memory(struct cache_mode * mode, uint32_t filter_addr, void (* process)(struct tag_group_info *)); + +/** + * @brief Get the virtual address from cache mode, cache tag and the virtual address offset of cache ways. + * Please do not call this function in your SDK application. + * + * @param struct cache_mode * mode : the cache to calculate the virtual address and the cache mode. + * + * @param uint32_t tag : the tag part fo a tag item, 12-14 bits. + * + * @param uint32_t addr_offset : the virtual address offset of the cache ways. + * + * @return uint32_t : the virtual address. + */ +uint32_t Cache_Get_Virtual_Addr(struct cache_mode *mode, uint32_t tag, uint32_t vaddr_offset); + +/** + * @brief Get cache memory block base address. + * Please do not call this function in your SDK application. + * + * @param uint32_t icache : 0 for dcache, other for icache. + * + * @param uint32_t high : 0 for low part block, 1 for high part block. + * + * @return uint32_t : the cache memory block base address, 0 if the block not used. + */ +uint32_t Cache_Get_Memory_BaseAddr(uint32_t icache, uint32_t high); + +/** + * @brief Get the cache memory address from cache mode, cache memory offset and the virtual address offset of cache ways. + * Please do not call this function in your SDK application. + * + * @param struct cache_mode * mode : the cache to calculate the virtual address and the cache mode. + * + * @param uint32_t cache_memory_offset : the cache memory offset of the whole cache (ICache or DCache) for the cache line. + * + * @param uint32_t addr_offset : the virtual address offset of the cache ways. + * + * @return uint32_t : the virtual address. + */ +uint32_t Cache_Get_Memory_Addr(struct cache_mode *mode, uint32_t cache_memory_offset, uint32_t vaddr_offset); + +/** + * @brief Get the cache memory value by DRAM address. + * Please do not call this function in your SDK application. + * + * @param uint32_t cache_memory_addr : DRAM address for the cache memory. + * + * @return uint32_t : the word value of the address. + */ +uint32_t Cache_Get_Memory_value(uint32_t cache_memory_addr); +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_CACHE_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/crc.h b/components/esp_rom/include/esp32s2beta/rom/crc.h new file mode 100644 index 0000000000..90d6c6f6b6 --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/crc.h @@ -0,0 +1,127 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef ROM_CRC_H +#define ROM_CRC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup crc_apis, uart configuration and communication related apis + * @brief crc apis + */ + +/** @addtogroup crc_apis + * @{ + */ + + +/* Standard CRC8/16/32 algorithms. */ +// CRC-8 x8+x2+x1+1 0x07 +// CRC16-CCITT x16+x12+x5+1 1021 ISO HDLC, ITU X.25, V.34/V.41/V.42, PPP-FCS +// CRC32: +//G(x) = x32 +x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x1 + 1 +//If your buf is not continuous, you can use the first result to be the second parameter. + +/** + * @brief Crc32 value that is in little endian. + * + * @param uint32_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint32_t crc32_le(uint32_t crc, uint8_t const *buf, uint32_t len); + +/** + * @brief Crc32 value that is in big endian. + * + * @param uint32_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint32_t crc32_be(uint32_t crc, uint8_t const *buf, uint32_t len); + +/** + * @brief Crc16 value that is in little endian. + * + * @param uint16_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint16_t crc16_le(uint16_t crc, uint8_t const *buf, uint32_t len); + +/** + * @brief Crc16 value that is in big endian. + * + * @param uint16_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint16_t crc16_be(uint16_t crc, uint8_t const *buf, uint32_t len); + +/** + * @brief Crc8 value that is in little endian. + * + * @param uint8_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint8_t crc8_le(uint8_t crc, uint8_t const *buf, uint32_t len); + +/** + * @brief Crc8 value that is in big endian. + * + * @param uint32_t crc : init crc value, use 0 at the first use. + * + * @param uint8_t const *buf : buffer to start calculate crc. + * + * @param uint32_t len : buffer length in byte. + * + * @return None + */ +uint8_t crc8_be(uint8_t crc, uint8_t const *buf, uint32_t len); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/components/esp_rom/include/esp32s2beta/rom/efuse.h b/components/esp_rom/include/esp32s2beta/rom/efuse.h new file mode 100644 index 0000000000..4697bc305a --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/efuse.h @@ -0,0 +1,355 @@ +// 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 _ROM_EFUSE_H_ +#define _ROM_EFUSE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/** \defgroup efuse_APIs efuse APIs + * @brief ESP32 efuse read/write APIs + * @attention + * + */ + +/** @addtogroup efuse_APIs + * @{ + */ + +typedef enum { + ETS_EFUSE_KEY_PURPOSE_USER = 0, + ETS_EFUSE_KEY_PURPOSE_RESERVED = 1, + ETS_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_1 = 2, + ETS_EFUSE_KEY_PURPOSE_XTS_AES_256_KEY_2 = 3, + ETS_EFUSE_KEY_PURPOSE_XTS_AES_128_KEY = 4, + ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_ALL = 5, + ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_JTAG = 6, + ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE = 7, + ETS_EFUSE_KEY_PURPOSE_HMAC_UP = 8, + ETS_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST0 = 9, + ETS_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST1 = 10, + ETS_EFUSE_KEY_PURPOSE_SECURE_BOOT_DIGEST2 = 11, + ETS_EFUSE_KEY_PURPOSE_MAX, +} ets_efuse_purpose_t; + +typedef enum { + ETS_EFUSE_BLOCK0 = 0, + ETS_EFUSE_MAC_SPI_8M_0 = 1, + ETS_EFUSE_BLOCK_SYS_DATA = 2, + ETS_EFUSE_BLOCK_USR_DATA = 3, + ETS_EFUSE_BLOCK_KEY0 = 4, + ETS_EFUSE_BLOCK_KEY1 = 5, + ETS_EFUSE_BLOCK_KEY2 = 6, + ETS_EFUSE_BLOCK_KEY3 = 7, + ETS_EFUSE_BLOCK_KEY4 = 8, + ETS_EFUSE_BLOCK_KEY5 = 9, + ETS_EFUSE_BLOCK_KEY6 = 10, + ETS_EFUSE_BLOCK_MAX, +} ets_efuse_block_t; + +/** + * @brief Enable efuse subsystem. Called after reset. Doesn't need to be called again. + */ +void ets_efuse_start(void); + +/** + * @brief Efuse read operation: copies data from physical efuses to efuse read registers. + * + * @param null + * + * @return null + */ +void ets_efuse_read(void); + +/** + * @brief Efuse write operation: Copies data from efuse write registers to efuse. Operates on a single block of efuses at a time. + * + * @note This function does not update read efuses, call ets_efuse_read() once all programming is complete. + * + * @return null + */ +void ets_efuse_program(ets_efuse_block_t block); + +/** + * @brief Set all Efuse program registers to zero. + * + * Call this before writing new data to the program registers. + */ +void ets_efuse_clear_program_registers(void); + +/** + * @brief Program a block of key data to an efuse block + * + * @param key_block Block to read purpose for. Must be in range ETS_EFUSE_BLOCK_KEY0 to ETS_EFUSE_BLOCK_KEY6. Key block must be unused (@ref ets_efuse_key_block_unused). + * @param purpose Purpose to set for this key. + * @param data Pointer to data to write. + * @param data_len Length of data to write. + * + * @note This function also calls ets_efuse_program() for the specified block, and for block 0 (setting the purpose) + */ +int ets_efuse_write_key(ets_efuse_block_t key_block, ets_efuse_purpose_t purpose, const void *data, size_t data_len); + + +/* @brief Return the address of a particular efuse block's first read register + * + * @param block Index of efuse block to look up + * + * @return 0 if block is invalid, otherwise a numeric read register address + * of the first word in the block. + */ +uint32_t ets_efuse_get_read_register_address(ets_efuse_block_t block); + +/** + * @brief Return the current purpose set for an efuse key block + * + * @param key_block Block to read purpose for. Must be in range ETS_EFUSE_BLOCK_KEY0 to ETS_EFUSE_BLOCK_KEY6. + */ +ets_efuse_purpose_t ets_efuse_get_key_purpose(ets_efuse_block_t key_block); + +/** + * @brief Find a key block with the particular purpose set + * + * @param purpose Purpose to search for. + * @param[out] key_block Pointer which will be set to the key block if found. Can be NULL, if only need to test the key block exists. + * @return true if found, false if not found. If false, value at key_block pointer is unchanged. + */ +bool ets_efuse_find_purpose(ets_efuse_purpose_t purpose, ets_efuse_block_t *key_block); + +/** + * Return true if the key block is unused, false otherwise. + * + * An unused key block is all zero content, not read or write protected, + * and has purpose 0 (ETS_EFUSE_KEY_PURPOSE_USER) + * + * @param key_block key block to check. + * + * @return true if key block is unused, false if key block or used + * or the specified block index is not a key block. + */ +bool ets_efuse_key_block_unused(ets_efuse_block_t key_block); + + +/** + * @brief Search for an unused key block and return the first one found. + * + * See @ref ets_efuse_key_block_unused for a description of an unused key block. + * + * @return First unused key block, or ETS_EFUSE_BLOCK_MAX if no unused key block is found. + */ +ets_efuse_block_t ets_efuse_find_unused_key_block(void); + +/** + * @brief Return the number of unused efuse key blocks (0-6) + */ +unsigned ets_efuse_count_unused_key_blocks(void); + +/** + * @brief Calculate Reed-Solomon Encoding values for a block of efuse data. + * + * @param data Pointer to data buffer (length 32 bytes) + * @param rs_values Pointer to write encoded data to (length 12 bytes) + */ +void ets_efuse_rs_calculate(const void *data, void *rs_values); + +/** + * @brief Read 8M Analog Clock value(12 bits) in efuse, the analog clock will not change with temperature. + * It can be used to test the external xtal frequency, do not touch this efuse field. + * + * @param null + * + * @return uint32_t: 1 for 10KHZ, range is 0 to 4095. + */ +uint32_t ets_efuse_get_8M_clock(void); + +/** + * @brief Read xtal frequency value(6 bits) in efuse. + * + * @param null + * + * @return uint32_t: 1 for 1MHz, range is 0 to 63, 0 means the xtal frequency not record in efuse. + */ +uint32_t ets_efuse_get_xtal_freq(void); + +/** + * @brief Read spi flash pads configuration from Efuse + * + * @return + * - 0 for default SPI pins. + * - 1 for default HSPI pins. + * - Other values define a custom pin configuration mask. Pins are encoded as per the EFUSE_SPICONFIG_RET_SPICLK, + * EFUSE_SPICONFIG_RET_SPIQ, EFUSE_SPICONFIG_RET_SPID, EFUSE_SPICONFIG_RET_SPICS0, EFUSE_SPICONFIG_RET_SPIHD macros. + * WP pin (for quad I/O modes) is not saved in efuse and not returned by this function. + */ +uint32_t ets_efuse_get_spiconfig(void); + +/** + * @brief Read spi flash wp pad from Efuse + * + * @return + * - 0x3f for invalid. + * - 0~46 is valid. + */ +uint32_t ets_efuse_get_wp_pad(void); + +/** + * @brief Read if download mode disabled from Efuse + * + * @return + * - true for efuse disable download mode. + * - false for efuse doesn't disable download mode. + */ +bool ets_efuse_download_modes_disabled(void); + +/** + * @brief Read if legacy spi flash boot mode disabled from Efuse + * + * @return + * - true for efuse disable legacy spi flash boot mode. + * - false for efuse doesn't disable legacy spi flash boot mode. + */ +bool ets_efuse_legacy_spi_boot_mode_disabled(void); + +/** + * @brief Read if uart print control value from Efuse + * + * @return + * - 0 for uart force print. + * - 1 for uart print when GPIO46 is low when digital reset. + * 2 for uart print when GPIO46 is high when digital reset. + * 3 for uart force slient + */ +uint32_t ets_efuse_get_uart_print_control(void); + +/** + * @brief Read which channel will used by ROM to print + * + * @return + * - 0 for UART0. + * - 1 for UART1. + */ +uint32_t ets_efuse_get_uart_print_channel(void); + +/** + * @brief Read if usb dowload mode disabled from Efuse + * + * @return + * - true for efuse disable usb download mode. + * - false for efuse doesn't disable usb download mode. + */ +bool ets_efuse_usb_download_mode_disabled(void); + +/** + * @brief Read if tiny basic mode disabled from Efuse + * + * @return + * - true for efuse disable tiny basic mode. + * - false for efuse doesn't disable tiny basic mode. + */ +bool ets_efuse_tiny_basic_mode_disabled(void); + +/** + * @brief Read if usb module disabled from Efuse + * + * @return + * - true for efuse disable usb module. + * - false for efuse doesn't disable usb module. + */ +bool ets_efuse_usb_module_disabled(void); + +/** + * @brief Read if security download modes enabled from Efuse + * + * @return + * - true for efuse enable security download mode. + * - false for efuse doesn't enable security download mode. + */ +bool ets_efuse_security_download_modes_enabled(void); + +/** + * @brief Return true if secure boot enable in EFuse + */ +bool ets_efuse_secure_boot_enabled(void); + +/** + * @brief return the time in us ROM boot need wait flash to power on from Efuse + * + * @return + * - uint32_t the time in us. + */ +uint32_t ets_efuse_get_flash_delay_us(void); + +#define EFUSE_SPICONFIG_SPI_DEFAULTS 0 +#define EFUSE_SPICONFIG_HSPI_DEFAULTS 1 + +#define EFUSE_SPICONFIG_RET_SPICLK_MASK 0x3f +#define EFUSE_SPICONFIG_RET_SPICLK_SHIFT 0 +#define EFUSE_SPICONFIG_RET_SPICLK(ret) (((ret) >> EFUSE_SPICONFIG_RET_SPICLK_SHIFT) & EFUSE_SPICONFIG_RET_SPICLK_MASK) + +#define EFUSE_SPICONFIG_RET_SPIQ_MASK 0x3f +#define EFUSE_SPICONFIG_RET_SPIQ_SHIFT 6 +#define EFUSE_SPICONFIG_RET_SPIQ(ret) (((ret) >> EFUSE_SPICONFIG_RET_SPIQ_SHIFT) & EFUSE_SPICONFIG_RET_SPIQ_MASK) + +#define EFUSE_SPICONFIG_RET_SPID_MASK 0x3f +#define EFUSE_SPICONFIG_RET_SPID_SHIFT 12 +#define EFUSE_SPICONFIG_RET_SPID(ret) (((ret) >> EFUSE_SPICONFIG_RET_SPID_SHIFT) & EFUSE_SPICONFIG_RET_SPID_MASK) + +#define EFUSE_SPICONFIG_RET_SPICS0_MASK 0x3f +#define EFUSE_SPICONFIG_RET_SPICS0_SHIFT 18 +#define EFUSE_SPICONFIG_RET_SPICS0(ret) (((ret) >> EFUSE_SPICONFIG_RET_SPICS0_SHIFT) & EFUSE_SPICONFIG_RET_SPICS0_MASK) + + +#define EFUSE_SPICONFIG_RET_SPIHD_MASK 0x3f +#define EFUSE_SPICONFIG_RET_SPIHD_SHIFT 24 +#define EFUSE_SPICONFIG_RET_SPIHD(ret) (((ret) >> EFUSE_SPICONFIG_RET_SPIHD_SHIFT) & EFUSE_SPICONFIG_RET_SPIHD_MASK) + +/** + * @brief Enable JTAG temporarily by writing a JTAG HMAC "key" into + * the JTAG_CTRL registers. + * + * Works if JTAG has been "soft" disabled by burning the EFUSE_SOFT_DIS_JTAG efuse. + * + * Will enable the HMAC module to generate a "downstream" HMAC value from a key already saved in efuse, and then write the JTAG HMAC "key" which will enable JTAG if the two keys match. + * + * @param jtag_hmac_key Pointer to a 32 byte array containing a valid key. Supplied by user. + * @param key_block Index of a key block containing the source for this key. + * + * @return ETS_FAILED if HMAC operation fails or invalid parameter, ETS_OK otherwise. ETS_OK doesn't necessarily mean that JTAG was enabled. + */ +int ets_jtag_enable_temporarily(const uint8_t *jtag_hmac_key, ets_efuse_block_t key_block); + +/** + * @brief A crc8 algorithm used for MAC addresses in efuse + * + * @param unsigned char const *p : Pointer to original data. + * + * @param unsigned int len : Data length in byte. + * + * @return unsigned char: Crc value. + */ +unsigned char esp_crc8(unsigned char const *p, unsigned int len); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_EFUSE_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/ets_sys.h b/components/esp_rom/include/esp32s2beta/rom/ets_sys.h new file mode 100644 index 0000000000..f52994ad87 --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/ets_sys.h @@ -0,0 +1,615 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include + +#include "soc/soc.h" + +#include "sdkconfig.h" + +#ifndef CONFIG_IDF_TARGET_ESP32S2BETA +#error "This header should only be included when building for esp32s2beta" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup ets_sys_apis, ets system related apis + * @brief ets system apis + */ + +/** @addtogroup ets_sys_apis + * @{ + */ + +/************************************************************************ + * NOTE + * Many functions in this header files can't be run in FreeRTOS. + * Please see the comment of the Functions. + * There are also some functions that doesn't work on FreeRTOS + * without listed in the header, such as: + * xtos functions start with "_xtos_" in ld file. + * + *********************************************************************** + */ + +/** \defgroup ets_apis, Espressif Task Scheduler related apis + * @brief ets apis + */ + +/** @addtogroup ets_apis + * @{ + */ + +typedef enum { + ETS_OK = 0, /**< return successful in ets*/ + ETS_FAILED = 1 /**< return failed in ets*/ +} ETS_STATUS; + +typedef ETS_STATUS ets_status_t; + +typedef uint32_t ETSSignal; +typedef uint32_t ETSParam; + +typedef struct ETSEventTag ETSEvent; /**< Event transmit/receive in ets*/ + +struct ETSEventTag { + ETSSignal sig; /**< Event signal, in same task, different Event with different signal*/ + ETSParam par; /**< Event parameter, sometimes without usage, then will be set as 0*/ +}; + +typedef void (*ETSTask)(ETSEvent *e); /**< Type of the Task processer*/ +typedef void (* ets_idle_cb_t)(void *arg); /**< Type of the system idle callback*/ + +/** + * @brief Start the Espressif Task Scheduler, which is an infinit loop. Please do not add code after it. + * + * @param none + * + * @return none + */ +void ets_run(void); + +/** + * @brief Set the Idle callback, when Tasks are processed, will call the callback before CPU goto sleep. + * + * @param ets_idle_cb_t func : The callback function. + * + * @param void *arg : Argument of the callback. + * + * @return None + */ +void ets_set_idle_cb(ets_idle_cb_t func, void *arg); + +/** + * @brief Init a task with processer, priority, queue to receive Event, queue length. + * + * @param ETSTask task : The task processer. + * + * @param uint8_t prio : Task priority, 0-31, bigger num with high priority, one priority with one task. + * + * @param ETSEvent *queue : Queue belongs to the task, task always receives Events, Queue is circular used. + * + * @param uint8_t qlen : Queue length. + * + * @return None + */ +void ets_task(ETSTask task, uint8_t prio, ETSEvent *queue, uint8_t qlen); + +/** + * @brief Post an event to an Task. + * + * @param uint8_t prio : Priority of the Task. + * + * @param ETSSignal sig : Event signal. + * + * @param ETSParam par : Event parameter + * + * @return ETS_OK : post successful + * @return ETS_FAILED : post failed + */ +ETS_STATUS ets_post(uint8_t prio, ETSSignal sig, ETSParam par); + +/** + * @} + */ + +/** \defgroup ets_boot_apis, Boot routing related apis + * @brief ets boot apis + */ + +/** @addtogroup ets_apis + * @{ + */ + +extern const char *const exc_cause_table[40]; ///**< excption cause that defined by the core.*/ + +/** + * @brief Set Pro cpu Entry code, code can be called in PRO CPU when booting is not completed. + * When Pro CPU booting is completed, Pro CPU will call the Entry code if not NULL. + * + * @param uint32_t start : the PRO Entry code address value in uint32_t + * + * @return None + */ +void ets_set_user_start(uint32_t start); + +/** + * @brief Set Pro cpu Startup code, code can be called when booting is not completed, or in Entry code. + * When Entry code completed, CPU will call the Startup code if not NULL, else call ets_run. + * + * @param uint32_t callback : the Startup code address value in uint32_t + * + * @return None : post successful + */ +void ets_set_startup_callback(uint32_t callback); + +/** + * @brief Set App cpu Entry code, code can be called in PRO CPU. + * When APP booting is completed, APP CPU will call the Entry code if not NULL. + * + * @param uint32_t start : the APP Entry code address value in uint32_t, stored in register APPCPU_CTRL_REG_D. + * + * @return None + */ +void ets_set_appcpu_boot_addr(uint32_t start); + +/** + * @} + */ + +/** \defgroup ets_printf_apis, ets_printf related apis used in ets + * @brief ets printf apis + */ + +/** @addtogroup ets_printf_apis + * @{ + */ + +/** + * @brief Printf the strings to uart or other devices, similar with printf, simple than printf. + * Can not print float point data format, or longlong data format. + * So we maybe only use this in ROM. + * + * @param const char *fmt : See printf. + * + * @param ... : See printf. + * + * @return int : the length printed to the output device. + */ +int ets_printf(const char *fmt, ...); + +/** + * @brief Output a char to uart, which uart to output(which is in uart module in ROM) is not in scope of the function. + * Can not print float point data format, or longlong data format + * + * @param char c : char to output. + * + * @return None + */ +void ets_write_char_uart(char c); + +/** + * @brief Ets_printf have two output functions: putc1 and putc2, both of which will be called if need ouput. + * To install putc1, which is defaulted installed as ets_write_char_uart in none silent boot mode, as NULL in silent mode. + * + * @param void (*)(char) p: Output function to install. + * + * @return None + */ +void ets_install_putc1(void (*p)(char c)); + +/** + * @brief Ets_printf have two output functions: putc1 and putc2, both of which will be called if need ouput. + * To install putc2, which is defaulted installed as NULL. + * + * @param void (*)(char) p: Output function to install. + * + * @return None + */ +void ets_install_putc2(void (*p)(char c)); + +/** + * @brief Install putc1 as ets_write_char_uart. + * In silent boot mode(to void interfere the UART attached MCU), we can call this function, after booting ok. + * + * @param None + * + * @return None + */ +void ets_install_uart_printf(void); + +#define ETS_PRINTF(...) ets_printf(...) + +#define ETS_ASSERT(v) do { \ + if (!(v)) { \ + ets_printf("%s %u \n", __FILE__, __LINE__); \ + while (1) {}; \ + } \ +} while (0); + +/** + * @} + */ + +/** \defgroup ets_timer_apis, ets_timer related apis used in ets + * @brief ets timer apis + */ + +/** @addtogroup ets_timer_apis + * @{ + */ +typedef void ETSTimerFunc(void *timer_arg);/**< timer handler*/ + +typedef struct _ETSTIMER_ { + struct _ETSTIMER_ *timer_next; /**< timer linker*/ + uint32_t timer_expire; /**< abstruct time when timer expire*/ + uint32_t timer_period; /**< timer period, 0 means timer is not periodic repeated*/ + ETSTimerFunc *timer_func; /**< timer handler*/ + void *timer_arg; /**< timer handler argument*/ +} ETSTimer; + +/** + * @brief Init ets timer, this timer range is 640 us to 429496 ms + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param None + * + * @return None + */ +void ets_timer_init(void); + +/** + * @brief In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param None + * + * @return None + */ +void ets_timer_deinit(void); + +/** + * @brief Arm an ets timer, this timer range is 640 us to 429496 ms. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param ETSTimer *timer : Timer struct pointer. + * + * @param uint32_t tmout : Timer value in ms, range is 1 to 429496. + * + * @param bool repeat : Timer is periodic repeated. + * + * @return None + */ +void ets_timer_arm(ETSTimer *timer, uint32_t tmout, bool repeat); + +/** + * @brief Arm an ets timer, this timer range is 640 us to 429496 ms. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param ETSTimer *timer : Timer struct pointer. + * + * @param uint32_t tmout : Timer value in us, range is 1 to 429496729. + * + * @param bool repeat : Timer is periodic repeated. + * + * @return None + */ +void ets_timer_arm_us(ETSTimer *ptimer, uint32_t us, bool repeat); + +/** + * @brief Disarm an ets timer. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param ETSTimer *timer : Timer struct pointer. + * + * @return None + */ +void ets_timer_disarm(ETSTimer *timer); + +/** + * @brief Set timer callback and argument. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param ETSTimer *timer : Timer struct pointer. + * + * @param ETSTimerFunc *pfunction : Timer callback. + * + * @param void *parg : Timer callback argument. + * + * @return None + */ +void ets_timer_setfn(ETSTimer *ptimer, ETSTimerFunc *pfunction, void *parg); + +/** + * @brief Unset timer callback and argument to NULL. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param ETSTimer *timer : Timer struct pointer. + * + * @return None + */ +void ets_timer_done(ETSTimer *ptimer); + +/** + * @brief CPU do while loop for some time. + * In FreeRTOS task, please call FreeRTOS apis. + * + * @param uint32_t us : Delay time in us. + * + * @return None + */ +void ets_delay_us(uint32_t us); + +/** + * @brief Set the real CPU ticks per us to the ets, so that ets_delay_us will be accurate. + * Call this function when CPU frequency is changed. + * + * @param uint32_t ticks_per_us : CPU ticks per us. + * + * @return None + */ +void ets_update_cpu_frequency(uint32_t ticks_per_us); + +/** + * @brief Get the real CPU ticks per us to the ets. + * This function do not return real CPU ticks per us, just the record in ets. It can be used to check with the real CPU frequency. + * + * @param None + * + * @return uint32_t : CPU ticks per us record in ets. + */ +uint32_t ets_get_cpu_frequency(void); + +/** + * @brief Get xtal_freq/analog_8M*256 value calibrated in rtc module. + * + * @param None + * + * @return uint32_t : xtal_freq/analog_8M*256. + */ +uint32_t ets_get_xtal_scale(void); + +/** + * @brief Get xtal_freq value, If value not stored in RTC_STORE5, than store. + * + * @param None + * + * @return uint32_t : if stored in efuse(not 0) + * clock = ets_efuse_get_xtal_freq() * 1000000; + * else if analog_8M in efuse + * clock = ets_get_xtal_scale() * 625 / 16 * ets_efuse_get_8M_clock(); + * else clock = 40M. + */ +uint32_t ets_get_xtal_freq(void); + +/** + * @brief Get apb_freq value, If value not stored in RTC_STORE5, than store. + * + * @param None + * + * @return uint32_t : if rtc store the value (RTC_STORE5 high 16 bits and low 16 bits with same value), read from rtc register. + * clock = (REG_READ(RTC_STORE5) & 0xffff) << 12; + * else store ets_get_detected_xtal_freq() in. + */ +uint32_t ets_get_apb_freq(void); + +/** + * @} + */ + +/** \defgroup ets_intr_apis, ets interrupt configure related apis + * @brief ets intr apis + */ + +/** @addtogroup ets_intr_apis + * @{ + */ + +typedef void (* ets_isr_t)(void *);/**< interrupt handler type*/ + +/** + * @brief Attach a interrupt handler to a CPU interrupt number. + * This function equals to _xtos_set_interrupt_handler_arg(i, func, arg). + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param int i : CPU interrupt number. + * + * @param ets_isr_t func : Interrupt handler. + * + * @param void *arg : argument of the handler. + * + * @return None + */ +void ets_isr_attach(int i, ets_isr_t func, void *arg); + +/** + * @brief Mask the interrupts which show in mask bits. + * This function equals to _xtos_ints_off(mask). + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param uint32_t mask : BIT(i) means mask CPU interrupt number i. + * + * @return None + */ +void ets_isr_mask(uint32_t mask); + +/** + * @brief Unmask the interrupts which show in mask bits. + * This function equals to _xtos_ints_on(mask). + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param uint32_t mask : BIT(i) means mask CPU interrupt number i. + * + * @return None + */ +void ets_isr_unmask(uint32_t unmask); + +/** + * @brief Lock the interrupt to level 2. + * This function direct set the CPU registers. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param None + * + * @return None + */ +void ets_intr_lock(void); + +/** + * @brief Unlock the interrupt to level 0. + * This function direct set the CPU registers. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param None + * + * @return None + */ +void ets_intr_unlock(void); + +/** + * @brief Unlock the interrupt to level 0, and CPU will go into power save mode(wait interrupt). + * This function direct set the CPU registers. + * In FreeRTOS, please call FreeRTOS apis, never call this api. + * + * @param None + * + * @return None + */ +void ets_waiti0(void); + +/** + * @brief Attach an CPU interrupt to a hardware source. + * We have 4 steps to use an interrupt: + * 1.Attach hardware interrupt source to CPU. intr_matrix_set(0, ETS_WIFI_MAC_INTR_SOURCE, ETS_WMAC_INUM); + * 2.Set interrupt handler. xt_set_interrupt_handler(ETS_WMAC_INUM, func, NULL); + * 3.Enable interrupt for CPU. xt_ints_on(1 << ETS_WMAC_INUM); + * 4.Enable interrupt in the module. + * + * @param int cpu_no : The CPU which the interrupt number belongs. + * + * @param uint32_t model_num : The interrupt hardware source number, please see the interrupt hardware source table. + * + * @param uint32_t intr_num : The interrupt number CPU, please see the interrupt cpu using table. + * + * @return None + */ +void intr_matrix_set(int cpu_no, uint32_t model_num, uint32_t intr_num); + +#define _ETSTR(v) # v +#define _ETS_SET_INTLEVEL(intlevel) ({ unsigned __tmp; \ + __asm__ __volatile__( "rsil %0, " _ETSTR(intlevel) "\n" \ + : "=a" (__tmp) : : "memory" ); \ + }) + +#ifdef CONFIG_NONE_OS +#define ETS_INTR_LOCK() \ + ets_intr_lock() + +#define ETS_INTR_UNLOCK() \ + ets_intr_unlock() + +#define ETS_ISR_ATTACH \ + ets_isr_attach + +#define ETS_INTR_ENABLE(inum) \ + ets_isr_unmask((1< +#include + +#include "esp_attr.h" +#include "soc/gpio_reg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup gpio_apis, uart configuration and communication related apis + * @brief gpio apis + */ + +/** @addtogroup gpio_apis + * @{ + */ + +#define GPIO_REG_READ(reg) READ_PERI_REG(reg) +#define GPIO_REG_WRITE(reg, val) WRITE_PERI_REG(reg, val) +#define GPIO_ID_PIN0 0 +#define GPIO_ID_PIN(n) (GPIO_ID_PIN0+(n)) +#define GPIO_PIN_ADDR(i) (GPIO_PIN0_REG + i*4) + +#define GPIO_FUNC_IN_HIGH 0x38 +#define GPIO_FUNC_IN_LOW 0x3C + +#define GPIO_ID_IS_PIN_REGISTER(reg_id) \ + ((reg_id >= GPIO_ID_PIN0) && (reg_id <= GPIO_ID_PIN(GPIO_PIN_COUNT-1))) + +#define GPIO_REGID_TO_PINIDX(reg_id) ((reg_id) - GPIO_ID_PIN0) + +typedef enum { + GPIO_PIN_INTR_DISABLE = 0, + GPIO_PIN_INTR_POSEDGE = 1, + GPIO_PIN_INTR_NEGEDGE = 2, + GPIO_PIN_INTR_ANYEDGE = 3, + GPIO_PIN_INTR_LOLEVEL = 4, + GPIO_PIN_INTR_HILEVEL = 5 +} GPIO_INT_TYPE; + +#define GPIO_OUTPUT_SET(gpio_no, bit_value) \ + ((gpio_no < 32) ? gpio_output_set(bit_value<>gpio_no)&BIT0) : ((gpio_input_get_high()>>(gpio_no - 32))&BIT0)) + +/* GPIO interrupt handler, registered through gpio_intr_handler_register */ +typedef void (* gpio_intr_handler_fn_t)(uint32_t intr_mask, bool high, void *arg); + +/** + * @brief Initialize GPIO. This includes reading the GPIO Configuration DataSet + * to initialize "output enables" and pin configurations for each gpio pin. + * Please do not call this function in SDK. + * + * @param None + * + * @return None + */ +void gpio_init(void); + +/** + * @brief Change GPIO(0-31) pin output by setting, clearing, or disabling pins, GPIO0<->BIT(0). + * There is no particular ordering guaranteed; so if the order of writes is significant, + * calling code should divide a single call into multiple calls. + * + * @param uint32_t set_mask : the gpios that need high level. + * + * @param uint32_t clear_mask : the gpios that need low level. + * + * @param uint32_t enable_mask : the gpios that need be changed. + * + * @param uint32_t disable_mask : the gpios that need diable output. + * + * @return None + */ +void gpio_output_set(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mask, uint32_t disable_mask); + +/** + * @brief Change GPIO(32-39) pin output by setting, clearing, or disabling pins, GPIO32<->BIT(0). + * There is no particular ordering guaranteed; so if the order of writes is significant, + * calling code should divide a single call into multiple calls. + * + * @param uint32_t set_mask : the gpios that need high level. + * + * @param uint32_t clear_mask : the gpios that need low level. + * + * @param uint32_t enable_mask : the gpios that need be changed. + * + * @param uint32_t disable_mask : the gpios that need diable output. + * + * @return None + */ +void gpio_output_set_high(uint32_t set_mask, uint32_t clear_mask, uint32_t enable_mask, uint32_t disable_mask); + +/** + * @brief Sample the value of GPIO input pins(0-31) and returns a bitmask. + * + * @param None + * + * @return uint32_t : bitmask for GPIO input pins, BIT(0) for GPIO0. + */ +uint32_t gpio_input_get(void); + +/** + * @brief Sample the value of GPIO input pins(32-39) and returns a bitmask. + * + * @param None + * + * @return uint32_t : bitmask for GPIO input pins, BIT(0) for GPIO32. + */ +uint32_t gpio_input_get_high(void); + +/** + * @brief Register an application-specific interrupt handler for GPIO pin interrupts. + * Once the interrupt handler is called, it will not be called again until after a call to gpio_intr_ack. + * Please do not call this function in SDK. + * + * @param gpio_intr_handler_fn_t fn : gpio application-specific interrupt handler + * + * @param void *arg : gpio application-specific interrupt handler argument. + * + * @return None + */ +void gpio_intr_handler_register(gpio_intr_handler_fn_t fn, void *arg); + +/** + * @brief Get gpio interrupts which happens but not processed. + * Please do not call this function in SDK. + * + * @param None + * + * @return uint32_t : bitmask for GPIO pending interrupts, BIT(0) for GPIO0. + */ +uint32_t gpio_intr_pending(void); + +/** + * @brief Get gpio interrupts which happens but not processed. + * Please do not call this function in SDK. + * + * @param None + * + * @return uint32_t : bitmask for GPIO pending interrupts, BIT(0) for GPIO32. + */ +uint32_t gpio_intr_pending_high(void); + +/** + * @brief Ack gpio interrupts to process pending interrupts. + * Please do not call this function in SDK. + * + * @param uint32_t ack_mask: bitmask for GPIO ack interrupts, BIT(0) for GPIO0. + * + * @return None + */ +void gpio_intr_ack(uint32_t ack_mask); + +/** + * @brief Ack gpio interrupts to process pending interrupts. + * Please do not call this function in SDK. + * + * @param uint32_t ack_mask: bitmask for GPIO ack interrupts, BIT(0) for GPIO32. + * + * @return None + */ +void gpio_intr_ack_high(uint32_t ack_mask); + +/** + * @brief Set GPIO to wakeup the ESP32. + * Please do not call this function in SDK. + * + * @param uint32_t i: gpio number. + * + * @param GPIO_INT_TYPE intr_state : only GPIO_PIN_INTR_LOLEVEL\GPIO_PIN_INTR_HILEVEL can be used + * + * @return None + */ +void gpio_pin_wakeup_enable(uint32_t i, GPIO_INT_TYPE intr_state); + +/** + * @brief disable GPIOs to wakeup the ESP32. + * Please do not call this function in SDK. + * + * @param None + * + * @return None + */ +void gpio_pin_wakeup_disable(void); + +/** + * @brief set gpio input to a signal, one gpio can input to several signals. + * + * @param uint32_t gpio : gpio number, 0~0x2f + * gpio == 0x3C, input 0 to signal + * gpio == 0x3A, input nothing to signal + * gpio == 0x38, input 1 to signal + * + * @param uint32_t signal_idx : signal index. + * + * @param bool inv : the signal is inv or not + * + * @return None + */ +void gpio_matrix_in(uint32_t gpio, uint32_t signal_idx, bool inv); + +/** + * @brief set signal output to gpio, one signal can output to several gpios. + * + * @param uint32_t gpio : gpio number, 0~0x2f + * + * @param uint32_t signal_idx : signal index. + * signal_idx == 0x100, cancel output put to the gpio + * + * @param bool out_inv : the signal output is invert or not + * + * @param bool oen_inv : the signal output enable is invert or not + * + * @return None + */ +void gpio_matrix_out(uint32_t gpio, uint32_t signal_idx, bool out_inv, bool oen_inv); + +/** + * @brief Select pad as a gpio function from IOMUX. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_select_gpio(uint8_t gpio_num); + +/** + * @brief Set pad driver capability. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @param uint8_t drv : 0-3 + * + * @return None + */ +void gpio_pad_set_drv(uint8_t gpio_num, uint8_t drv); + +/** + * @brief Pull up the pad from gpio number. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_pullup(uint8_t gpio_num); + +/** + * @brief Pull down the pad from gpio number. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_pulldown(uint8_t gpio_num); + +/** + * @brief Unhold the pad from gpio number. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_unhold(uint8_t gpio_num); + +/** + * @brief Hold the pad from gpio number. + * + * @param uint32_t gpio_num : gpio number, 0~0x2f + * + * @return None + */ +void gpio_pad_hold(uint8_t gpio_num); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_GPIO_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/hmac.h b/components/esp_rom/include/esp32s2beta/rom/hmac.h new file mode 100644 index 0000000000..723769ce27 --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/hmac.h @@ -0,0 +1,63 @@ +// Copyright 2018 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _ROM_HMAC_H_ +#define _ROM_HMAC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "rom/efuse.h" + +void ets_hmac_enable(void); + +void ets_hmac_disable(void); + +/* Use the "upstream" HMAC key (ETS_EFUSE_KEY_PURPOSE_HMAC_UP) + to digest a message. +*/ +int ets_hmac_calculate_message(ets_efuse_block_t key_block, const void *message, size_t message_len, uint8_t *hmac); + +/* Calculate a downstream HMAC message to temporarily enable JTAG, or + to generate a Digital Signature data decryption key. + + - purpose must be ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE + or ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_JTAG + + - key_block must be in range ETS_EFUSE_BLOCK_KEY0 toETS_EFUSE_BLOCK_KEY6. + This efuse block must have the corresponding purpose set in "purpose", or + ETS_EFUSE_KEY_PURPOSE_HMAC_DOWN_ALL. + + The result of this HMAC calculation is only made available "downstream" to the + corresponding hardware module, and cannot be accessed by software. +*/ +int ets_hmac_calculate_downstream(ets_efuse_block_t key_block, ets_efuse_purpose_t purpose); + +/* Invalidate a downstream HMAC value previously calculated by ets_hmac_calculate_downstream(). + * + * - purpose must match a previous call to ets_hmac_calculate_downstream(). + * + * After this function is called, the corresponding internal operation (JTAG or DS) will no longer + * have access to the generated key. + */ +int ets_hmac_invalidate_downstream(ets_efuse_purpose_t purpose); + +#ifdef __cplusplus +} +#endif + +#endif // _ROM_HMAC_H_ diff --git a/components/esp_rom/include/esp32s2beta/rom/libc_stubs.h b/components/esp_rom/include/esp32s2beta/rom/libc_stubs.h new file mode 100644 index 0000000000..f4eb3a65e9 --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/libc_stubs.h @@ -0,0 +1,89 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef _ROM_LIBC_STUBS_H_ +#define _ROM_LIBC_STUBS_H_ + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* +ESP32 ROM code contains implementations of some of C library functions. +Whenever a function in ROM needs to use a syscall, it calls a pointer to the corresponding syscall +implementation defined in the following struct. + +The table itself, by default, is not allocated in RAM. There are two pointers, `syscall_table_ptr_pro` and +`syscall_table_ptr_app`, which can be set to point to the locations of syscall tables of CPU 0 (aka PRO CPU) +and CPU 1 (aka APP CPU). Location of these pointers in .bss segment of ROM code is defined in linker script. + +So, before using any of the C library functions (except for pure functions and memcpy/memset functions), +application must allocate syscall table structure for each CPU being used, and populate it with pointers +to actual implementations of corresponding syscalls. +*/ + +struct syscall_stub_table +{ + struct _reent* (*__getreent)(void); + void* (*_malloc_r)(struct _reent *r, size_t); + void (*_free_r)(struct _reent *r, void*); + void* (*_realloc_r)(struct _reent *r, void*, size_t); + void* (*_calloc_r)(struct _reent *r, size_t, size_t); + void (*_abort)(void); + int (*_system_r)(struct _reent *r, const char*); + int (*_rename_r)(struct _reent *r, const char*, const char*); + clock_t (*_times_r)(struct _reent *r, struct tms *); + int (*_gettimeofday_r) (struct _reent *r, struct timeval *, void *); + void (*_raise_r)(struct _reent *r); + int (*_unlink_r)(struct _reent *r, const char*); + int (*_link_r)(struct _reent *r, const char*, const char*); + int (*_stat_r)(struct _reent *r, const char*, struct stat *); + int (*_fstat_r)(struct _reent *r, int, struct stat *); + void* (*_sbrk_r)(struct _reent *r, ptrdiff_t); + int (*_getpid_r)(struct _reent *r); + int (*_kill_r)(struct _reent *r, int, int); + void (*_exit_r)(struct _reent *r, int); + int (*_close_r)(struct _reent *r, int); + int (*_open_r)(struct _reent *r, const char *, int, int); + int (*_write_r)(struct _reent *r, int, const void *, int); + int (*_lseek_r)(struct _reent *r, int, int, int); + int (*_read_r)(struct _reent *r, int, void *, int); + void (*_lock_init)(_lock_t *lock); + void (*_lock_init_recursive)(_lock_t *lock); + void (*_lock_close)(_lock_t *lock); + void (*_lock_close_recursive)(_lock_t *lock); + void (*_lock_acquire)(_lock_t *lock); + void (*_lock_acquire_recursive)(_lock_t *lock); + int (*_lock_try_acquire)(_lock_t *lock); + int (*_lock_try_acquire_recursive)(_lock_t *lock); + void (*_lock_release)(_lock_t *lock); + void (*_lock_release_recursive)(_lock_t *lock); + int (*_printf_float)(struct _reent *data, void *pdata, FILE * fp, int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap); + int (*_scanf_float) (struct _reent *rptr, void *pdata, FILE *fp, va_list *ap); +}; + +extern struct syscall_stub_table* syscall_table_ptr_pro; +extern struct syscall_stub_table* syscall_table_ptr_app; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif /* _ROM_LIBC_STUBS_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/lldesc.h b/components/esp_rom/include/esp32s2beta/rom/lldesc.h new file mode 100644 index 0000000000..ae5b4160ba --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/lldesc.h @@ -0,0 +1,176 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _ROM_LLDESC_H_ +#define _ROM_LLDESC_H_ + +#include + +#include "sys/queue.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define LLDESC_TX_MBLK_SIZE 268 /* */ +#define LLDESC_RX_SMBLK_SIZE 64 /* small block size, for small mgmt frame */ +#define LLDESC_RX_MBLK_SIZE 524 /* rx is large sinec we want to contain mgmt frame in one block*/ +#define LLDESC_RX_AMPDU_ENTRY_MBLK_SIZE 64 /* it is a small buffer which is a cycle link*/ +#define LLDESC_RX_AMPDU_LEN_MBLK_SIZE 256 /*for ampdu entry*/ +#ifdef ESP_MAC_5 +#define LLDESC_TX_MBLK_NUM 116 /* 64K / 256 */ +#define LLDESC_RX_MBLK_NUM 82 /* 64K / 512 MAX 172*/ +#define LLDESC_RX_AMPDU_ENTRY_MBLK_NUM 4 +#define LLDESC_RX_AMPDU_LEN_MLBK_NUM 12 +#else +#ifdef SBUF_RXTX +#define LLDESC_TX_MBLK_NUM_MAX (2 * 48) /* 23K / 260 - 8 */ +#define LLDESC_RX_MBLK_NUM_MAX (2 * 48) /* 23K / 524 */ +#define LLDESC_TX_MBLK_NUM_MIN (2 * 16) /* 23K / 260 - 8 */ +#define LLDESC_RX_MBLK_NUM_MIN (2 * 16) /* 23K / 524 */ +#endif +#define LLDESC_TX_MBLK_NUM 10 //(2 * 32) /* 23K / 260 - 8 */ + +#ifdef IEEE80211_RX_AMPDU +#define LLDESC_RX_MBLK_NUM 30 +#else +#define LLDESC_RX_MBLK_NUM 10 +#endif /*IEEE80211_RX_AMPDU*/ + +#define LLDESC_RX_AMPDU_ENTRY_MBLK_NUM 4 +#define LLDESC_RX_AMPDU_LEN_MLBK_NUM 8 +#endif /* !ESP_MAC_5 */ +/* + * SLC2 DMA Desc struct, aka lldesc_t + * + * -------------------------------------------------------------- + * | own | EoF | sub_sof | 5'b0 | length [11:0] | size [11:0] | + * -------------------------------------------------------------- + * | buf_ptr [31:0] | + * -------------------------------------------------------------- + * | next_desc_ptr [31:0] | + * -------------------------------------------------------------- + */ + +/* this bitfield is start from the LSB!!! */ +typedef struct lldesc_s { + volatile uint32_t size :12, + length:12, + offset: 5, /* h/w reserved 5bit, s/w use it as offset in buffer */ + sosf : 1, /* start of sub-frame */ + eof : 1, /* end of frame */ + owner : 1; /* hw or sw */ + volatile uint8_t *buf; /* point to buffer data */ + union{ + volatile uint32_t empty; + STAILQ_ENTRY(lldesc_s) qe; /* pointing to the next desc */ + }; +} lldesc_t; + +typedef struct tx_ampdu_entry_s{ + uint32_t sub_len :12, + dili_num : 7, + : 1, + null_byte: 2, + data : 1, + enc : 1, + seq : 8; +} tx_ampdu_entry_t; + +typedef struct lldesc_chain_s { + lldesc_t *head; + lldesc_t *tail; +} lldesc_chain_t; + +#ifdef SBUF_RXTX +enum sbuf_mask_s { + SBUF_MOVE_NO = 0, + SBUF_MOVE_TX2RX, + SBUF_MOVE_RX2TX, +} ; + +#define SBUF_MOVE_STEP 8 +#endif +#define LLDESC_SIZE sizeof(struct lldesc_s) + +/* SLC Descriptor */ +#define LLDESC_OWNER_MASK 0x80000000 +#define LLDESC_OWNER_SHIFT 31 +#define LLDESC_SW_OWNED 0 +#define LLDESC_HW_OWNED 1 + +#define LLDESC_EOF_MASK 0x40000000 +#define LLDESC_EOF_SHIFT 30 + +#define LLDESC_SOSF_MASK 0x20000000 +#define LLDESC_SOSF_SHIFT 29 + +#define LLDESC_LENGTH_MASK 0x00fff000 +#define LLDESC_LENGTH_SHIFT 12 + +#define LLDESC_SIZE_MASK 0x00000fff +#define LLDESC_SIZE_SHIFT 0 + +#define LLDESC_ADDR_MASK 0x000fffff + +void lldesc_build_chain(uint8_t *descptr, uint32_t desclen, uint8_t * mblkptr, uint32_t buflen, uint32_t blksz, uint8_t owner, + lldesc_t **head, +#ifdef TO_HOST_RESTART + lldesc_t ** one_before_tail, +#endif + lldesc_t **tail); + +lldesc_t *lldesc_num2link(lldesc_t * head, uint16_t nblks); + +lldesc_t *lldesc_set_owner(lldesc_t * head, uint16_t nblks, uint8_t owner); + +static inline uint32_t lldesc_get_chain_length(lldesc_t *head) +{ + lldesc_t *ds = head; + uint32_t len = 0; + + while (ds) { + len += ds->length; + ds = STAILQ_NEXT(ds, qe); + } + + return len; +} + +static inline void lldesc_config(lldesc_t *ds, uint8_t owner, uint8_t eof, uint8_t sosf, uint16_t len) +{ + ds->owner = owner; + ds->eof = eof; + ds->sosf = sosf; + ds->length = len; +} + +#define LLDESC_CONFIG(_desc, _owner, _eof, _sosf, _len) do { \ + (_desc)->owner = (_owner); \ + (_desc)->eof = (_eof); \ + (_desc)->sosf = (_sosf); \ + (_desc)->length = (_len); \ +} while(0) + +#define LLDESC_FROM_HOST_CLEANUP(ds) LLDESC_CONFIG((ds), LLDESC_HW_OWNED, 0, 0, 0) + +#define LLDESC_MAC_RX_CLEANUP(ds) LLDESC_CONFIG((ds), LLDESC_HW_OWNED, 0, 0, (ds)->size) + +#define LLDESC_TO_HOST_CLEANUP(ds) LLDESC_CONFIG((ds), LLDESC_HW_OWNED, 0, 0, 0) + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_LLDESC_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/md5_hash.h b/components/esp_rom/include/esp32s2beta/rom/md5_hash.h new file mode 100644 index 0000000000..f116f1e670 --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/md5_hash.h @@ -0,0 +1,38 @@ +/* + * MD5 internal definitions + * Copyright (c) 2003-2005, Jouni Malinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, this software may be distributed under the terms of BSD + * license. + * + * See README and COPYING for more details. + */ + +#ifndef _ROM_MD5_HASH_H_ +#define _ROM_MD5_HASH_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct MD5Context { + uint32_t buf[4]; + uint32_t bits[2]; + uint8_t in[64]; +}; + +void MD5Init(struct MD5Context *context); +void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len); +void MD5Final(unsigned char digest[16], struct MD5Context *context); + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_MD5_HASH_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/miniz.h b/components/esp_rom/include/esp32s2beta/rom/miniz.h new file mode 100644 index 0000000000..ed79beb2cb --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/miniz.h @@ -0,0 +1,777 @@ +#ifndef MINIZ_HEADER_INCLUDED +#define MINIZ_HEADER_INCLUDED + +#include + +// Defines to completely disable specific portions of miniz.c: +// If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl. + +// Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. +#define MINIZ_NO_STDIO + +// If MINIZ_NO_TIME is specified then the ZIP archive functions will not be able to get the current time, or +// get/set file times, and the C run-time funcs that get/set times won't be called. +// The current downside is the times written to your archives will be from 1979. +#define MINIZ_NO_TIME + +// Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's. +#define MINIZ_NO_ARCHIVE_APIS + +// Define MINIZ_NO_ARCHIVE_APIS to disable all writing related ZIP archive API's. +#define MINIZ_NO_ARCHIVE_WRITING_APIS + +// Define MINIZ_NO_ZLIB_APIS to remove all ZLIB-style compression/decompression API's. +#define MINIZ_NO_ZLIB_APIS + +// Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib. +#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES + +// Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc. +// Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc +// callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user +// functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. +#define MINIZ_NO_MALLOC + +#if defined(__TINYC__) && (defined(__linux) || defined(__linux__)) + // TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux + #define MINIZ_NO_TIME +#endif + +#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS) + #include +#endif + +//Hardcoded options for Xtensa - JD +#define MINIZ_X86_OR_X64_CPU 0 +#define MINIZ_LITTLE_ENDIAN 1 +#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0 +#define MINIZ_HAS_64BIT_REGISTERS 0 +#define TINFL_USE_64BIT_BITBUF 0 + + +#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__) +// MINIZ_X86_OR_X64_CPU is only used to help set the below macros. +#define MINIZ_X86_OR_X64_CPU 1 +#endif + +#if (__BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU +// Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian. +#define MINIZ_LITTLE_ENDIAN 1 +#endif + +#if MINIZ_X86_OR_X64_CPU +// Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses. +#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 +#endif + +#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__) +// Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are reasonably fast (and don't involve compiler generated calls to helper functions). +#define MINIZ_HAS_64BIT_REGISTERS 1 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// ------------------- zlib-style API Definitions. + +// For more compatibility with zlib, miniz.c uses unsigned long for some parameters/struct members. Beware: mz_ulong can be either 32 or 64-bits! +typedef unsigned long mz_ulong; + +// mz_free() internally uses the MZ_FREE() macro (which by default calls free() unless you've modified the MZ_MALLOC macro) to release a block allocated from the heap. +void mz_free(void *p); + +#define MZ_ADLER32_INIT (1) +// mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL. +mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len); + +#define MZ_CRC32_INIT (0) +// mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL. +mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len); + +// Compression strategies. +enum { MZ_DEFAULT_STRATEGY = 0, MZ_FILTERED = 1, MZ_HUFFMAN_ONLY = 2, MZ_RLE = 3, MZ_FIXED = 4 }; + +// Method +#define MZ_DEFLATED 8 + +#ifndef MINIZ_NO_ZLIB_APIS + +// Heap allocation callbacks. +// Note that mz_alloc_func parameter types purpsosely differ from zlib's: items/size is size_t, not unsigned long. +typedef void *(*mz_alloc_func)(void *opaque, size_t items, size_t size); +typedef void (*mz_free_func)(void *opaque, void *address); +typedef void *(*mz_realloc_func)(void *opaque, void *address, size_t items, size_t size); + +#define MZ_VERSION "9.1.15" +#define MZ_VERNUM 0x91F0 +#define MZ_VER_MAJOR 9 +#define MZ_VER_MINOR 1 +#define MZ_VER_REVISION 15 +#define MZ_VER_SUBREVISION 0 + +// Flush values. For typical usage you only need MZ_NO_FLUSH and MZ_FINISH. The other values are for advanced use (refer to the zlib docs). +enum { MZ_NO_FLUSH = 0, MZ_PARTIAL_FLUSH = 1, MZ_SYNC_FLUSH = 2, MZ_FULL_FLUSH = 3, MZ_FINISH = 4, MZ_BLOCK = 5 }; + +// Return status codes. MZ_PARAM_ERROR is non-standard. +enum { MZ_OK = 0, MZ_STREAM_END = 1, MZ_NEED_DICT = 2, MZ_ERRNO = -1, MZ_STREAM_ERROR = -2, MZ_DATA_ERROR = -3, MZ_MEM_ERROR = -4, MZ_BUF_ERROR = -5, MZ_VERSION_ERROR = -6, MZ_PARAM_ERROR = -10000 }; + +// Compression levels: 0-9 are the standard zlib-style levels, 10 is best possible compression (not zlib compatible, and may be very slow), MZ_DEFAULT_COMPRESSION=MZ_DEFAULT_LEVEL. +enum { MZ_NO_COMPRESSION = 0, MZ_BEST_SPEED = 1, MZ_BEST_COMPRESSION = 9, MZ_UBER_COMPRESSION = 10, MZ_DEFAULT_LEVEL = 6, MZ_DEFAULT_COMPRESSION = -1 }; + +// Window bits +#define MZ_DEFAULT_WINDOW_BITS 15 + +struct mz_internal_state; + +// Compression/decompression stream struct. +typedef struct mz_stream_s +{ + const unsigned char *next_in; // pointer to next byte to read + unsigned int avail_in; // number of bytes available at next_in + mz_ulong total_in; // total number of bytes consumed so far + + unsigned char *next_out; // pointer to next byte to write + unsigned int avail_out; // number of bytes that can be written to next_out + mz_ulong total_out; // total number of bytes produced so far + + char *msg; // error msg (unused) + struct mz_internal_state *state; // internal state, allocated by zalloc/zfree + + mz_alloc_func zalloc; // optional heap allocation function (defaults to malloc) + mz_free_func zfree; // optional heap free function (defaults to free) + void *opaque; // heap alloc function user pointer + + int data_type; // data_type (unused) + mz_ulong adler; // adler32 of the source or uncompressed data + mz_ulong reserved; // not used +} mz_stream; + +typedef mz_stream *mz_streamp; + +// Returns the version string of miniz.c. +const char *mz_version(void); + +// mz_deflateInit() initializes a compressor with default options: +// Parameters: +// pStream must point to an initialized mz_stream struct. +// level must be between [MZ_NO_COMPRESSION, MZ_BEST_COMPRESSION]. +// level 1 enables a specially optimized compression function that's been optimized purely for performance, not ratio. +// (This special func. is currently only enabled when MINIZ_USE_UNALIGNED_LOADS_AND_STORES and MINIZ_LITTLE_ENDIAN are defined.) +// Return values: +// MZ_OK on success. +// MZ_STREAM_ERROR if the stream is bogus. +// MZ_PARAM_ERROR if the input parameters are bogus. +// MZ_MEM_ERROR on out of memory. +int mz_deflateInit(mz_streamp pStream, int level); + +// mz_deflateInit2() is like mz_deflate(), except with more control: +// Additional parameters: +// method must be MZ_DEFLATED +// window_bits must be MZ_DEFAULT_WINDOW_BITS (to wrap the deflate stream with zlib header/adler-32 footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate/no header or footer) +// mem_level must be between [1, 9] (it's checked but ignored by miniz.c) +int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy); + +// Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2(). +int mz_deflateReset(mz_streamp pStream); + +// mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible. +// Parameters: +// pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. +// flush may be MZ_NO_FLUSH, MZ_PARTIAL_FLUSH/MZ_SYNC_FLUSH, MZ_FULL_FLUSH, or MZ_FINISH. +// Return values: +// MZ_OK on success (when flushing, or if more input is needed but not available, and/or there's more output to be written but the output buffer is full). +// MZ_STREAM_END if all input has been consumed and all output bytes have been written. Don't call mz_deflate() on the stream anymore. +// MZ_STREAM_ERROR if the stream is bogus. +// MZ_PARAM_ERROR if one of the parameters is invalid. +// MZ_BUF_ERROR if no forward progress is possible because the input and/or output buffers are empty. (Fill up the input buffer or free up some output space and try again.) +int mz_deflate(mz_streamp pStream, int flush); + +// mz_deflateEnd() deinitializes a compressor: +// Return values: +// MZ_OK on success. +// MZ_STREAM_ERROR if the stream is bogus. +int mz_deflateEnd(mz_streamp pStream); + +// mz_deflateBound() returns a (very) conservative upper bound on the amount of data that could be generated by deflate(), assuming flush is set to only MZ_NO_FLUSH or MZ_FINISH. +mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len); + +// Single-call compression functions mz_compress() and mz_compress2(): +// Returns MZ_OK on success, or one of the error codes from mz_deflate() on failure. +int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len); +int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level); + +// mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress(). +mz_ulong mz_compressBound(mz_ulong source_len); + +// Initializes a decompressor. +int mz_inflateInit(mz_streamp pStream); + +// mz_inflateInit2() is like mz_inflateInit() with an additional option that controls the window size and whether or not the stream has been wrapped with a zlib header/footer: +// window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate). +int mz_inflateInit2(mz_streamp pStream, int window_bits); + +// Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible. +// Parameters: +// pStream is the stream to read from and write to. You must initialize/update the next_in, avail_in, next_out, and avail_out members. +// flush may be MZ_NO_FLUSH, MZ_SYNC_FLUSH, or MZ_FINISH. +// On the first call, if flush is MZ_FINISH it's assumed the input and output buffers are both sized large enough to decompress the entire stream in a single call (this is slightly faster). +// MZ_FINISH implies that there are no more source bytes available beside what's already in the input buffer, and that the output buffer is large enough to hold the rest of the decompressed data. +// Return values: +// MZ_OK on success. Either more input is needed but not available, and/or there's more output to be written but the output buffer is full. +// MZ_STREAM_END if all needed input has been consumed and all output bytes have been written. For zlib streams, the adler-32 of the decompressed data has also been verified. +// MZ_STREAM_ERROR if the stream is bogus. +// MZ_DATA_ERROR if the deflate stream is invalid. +// MZ_PARAM_ERROR if one of the parameters is invalid. +// MZ_BUF_ERROR if no forward progress is possible because the input buffer is empty but the inflater needs more input to continue, or if the output buffer is not large enough. Call mz_inflate() again +// with more input data, or with more room in the output buffer (except when using single call decompression, described above). +int mz_inflate(mz_streamp pStream, int flush); + +// Deinitializes a decompressor. +int mz_inflateEnd(mz_streamp pStream); + +// Single-call decompression. +// Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure. +int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len); + +// Returns a string description of the specified error code, or NULL if the error code is invalid. +const char *mz_error(int err); + +// Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used as a drop-in replacement for the subset of zlib that miniz.c supports. +// Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project. +#ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES + typedef unsigned char Byte; + typedef unsigned int uInt; + typedef mz_ulong uLong; + typedef Byte Bytef; + typedef uInt uIntf; + typedef char charf; + typedef int intf; + typedef void *voidpf; + typedef uLong uLongf; + typedef void *voidp; + typedef void *const voidpc; + #define Z_NULL 0 + #define Z_NO_FLUSH MZ_NO_FLUSH + #define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH + #define Z_SYNC_FLUSH MZ_SYNC_FLUSH + #define Z_FULL_FLUSH MZ_FULL_FLUSH + #define Z_FINISH MZ_FINISH + #define Z_BLOCK MZ_BLOCK + #define Z_OK MZ_OK + #define Z_STREAM_END MZ_STREAM_END + #define Z_NEED_DICT MZ_NEED_DICT + #define Z_ERRNO MZ_ERRNO + #define Z_STREAM_ERROR MZ_STREAM_ERROR + #define Z_DATA_ERROR MZ_DATA_ERROR + #define Z_MEM_ERROR MZ_MEM_ERROR + #define Z_BUF_ERROR MZ_BUF_ERROR + #define Z_VERSION_ERROR MZ_VERSION_ERROR + #define Z_PARAM_ERROR MZ_PARAM_ERROR + #define Z_NO_COMPRESSION MZ_NO_COMPRESSION + #define Z_BEST_SPEED MZ_BEST_SPEED + #define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION + #define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION + #define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY + #define Z_FILTERED MZ_FILTERED + #define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY + #define Z_RLE MZ_RLE + #define Z_FIXED MZ_FIXED + #define Z_DEFLATED MZ_DEFLATED + #define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS + #define alloc_func mz_alloc_func + #define free_func mz_free_func + #define internal_state mz_internal_state + #define z_stream mz_stream + #define deflateInit mz_deflateInit + #define deflateInit2 mz_deflateInit2 + #define deflateReset mz_deflateReset + #define deflate mz_deflate + #define deflateEnd mz_deflateEnd + #define deflateBound mz_deflateBound + #define compress mz_compress + #define compress2 mz_compress2 + #define compressBound mz_compressBound + #define inflateInit mz_inflateInit + #define inflateInit2 mz_inflateInit2 + #define inflate mz_inflate + #define inflateEnd mz_inflateEnd + #define uncompress mz_uncompress + #define crc32 mz_crc32 + #define adler32 mz_adler32 + #define MAX_WBITS 15 + #define MAX_MEM_LEVEL 9 + #define zError mz_error + #define ZLIB_VERSION MZ_VERSION + #define ZLIB_VERNUM MZ_VERNUM + #define ZLIB_VER_MAJOR MZ_VER_MAJOR + #define ZLIB_VER_MINOR MZ_VER_MINOR + #define ZLIB_VER_REVISION MZ_VER_REVISION + #define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION + #define zlibVersion mz_version + #define zlib_version mz_version() +#endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES + +#endif // MINIZ_NO_ZLIB_APIS + +// ------------------- Types and macros + +typedef unsigned char mz_uint8; +typedef signed short mz_int16; +typedef unsigned short mz_uint16; +typedef unsigned int mz_uint32; +typedef unsigned int mz_uint; +typedef long long mz_int64; +typedef unsigned long long mz_uint64; +typedef int mz_bool; + +#define MZ_FALSE (0) +#define MZ_TRUE (1) + +// An attempt to work around MSVC's spammy "warning C4127: conditional expression is constant" message. +#ifdef _MSC_VER + #define MZ_MACRO_END while (0, 0) +#else + #define MZ_MACRO_END while (0) +#endif + +// ------------------- ZIP archive reading/writing + +#ifndef MINIZ_NO_ARCHIVE_APIS + +enum +{ + MZ_ZIP_MAX_IO_BUF_SIZE = 64*1024, + MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE = 260, + MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE = 256 +}; + +typedef struct +{ + mz_uint32 m_file_index; + mz_uint32 m_central_dir_ofs; + mz_uint16 m_version_made_by; + mz_uint16 m_version_needed; + mz_uint16 m_bit_flag; + mz_uint16 m_method; +#ifndef MINIZ_NO_TIME + time_t m_time; +#endif + mz_uint32 m_crc32; + mz_uint64 m_comp_size; + mz_uint64 m_uncomp_size; + mz_uint16 m_internal_attr; + mz_uint32 m_external_attr; + mz_uint64 m_local_header_ofs; + mz_uint32 m_comment_size; + char m_filename[MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE]; + char m_comment[MZ_ZIP_MAX_ARCHIVE_FILE_COMMENT_SIZE]; +} mz_zip_archive_file_stat; + +typedef size_t (*mz_file_read_func)(void *pOpaque, mz_uint64 file_ofs, void *pBuf, size_t n); +typedef size_t (*mz_file_write_func)(void *pOpaque, mz_uint64 file_ofs, const void *pBuf, size_t n); + +struct mz_zip_internal_state_tag; +typedef struct mz_zip_internal_state_tag mz_zip_internal_state; + +typedef enum +{ + MZ_ZIP_MODE_INVALID = 0, + MZ_ZIP_MODE_READING = 1, + MZ_ZIP_MODE_WRITING = 2, + MZ_ZIP_MODE_WRITING_HAS_BEEN_FINALIZED = 3 +} mz_zip_mode; + +typedef struct mz_zip_archive_tag +{ + mz_uint64 m_archive_size; + mz_uint64 m_central_directory_file_ofs; + mz_uint m_total_files; + mz_zip_mode m_zip_mode; + + mz_uint m_file_offset_alignment; + + mz_alloc_func m_pAlloc; + mz_free_func m_pFree; + mz_realloc_func m_pRealloc; + void *m_pAlloc_opaque; + + mz_file_read_func m_pRead; + mz_file_write_func m_pWrite; + void *m_pIO_opaque; + + mz_zip_internal_state *m_pState; + +} mz_zip_archive; + +typedef enum +{ + MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100, + MZ_ZIP_FLAG_IGNORE_PATH = 0x0200, + MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400, + MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY = 0x0800 +} mz_zip_flags; + +// ZIP archive reading + +// Inits a ZIP archive reader. +// These functions read and validate the archive's central directory. +mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags); +mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags); + +#ifndef MINIZ_NO_STDIO +mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags); +#endif + +// Returns the total number of files in the archive. +mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip); + +// Returns detailed information about an archive file entry. +mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat); + +// Determines if an archive file entry is a directory entry. +mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index); +mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index); + +// Retrieves the filename of an archive file entry. +// Returns the number of bytes written to pFilename, or if filename_buf_size is 0 this function returns the number of bytes needed to fully store the filename. +mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size); + +// Attempts to locates a file in the archive's central directory. +// Valid flags: MZ_ZIP_FLAG_CASE_SENSITIVE, MZ_ZIP_FLAG_IGNORE_PATH +// Returns -1 if the file cannot be found. +int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags); + +// Extracts a archive file to a memory buffer using no memory allocation. +mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); +mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size); + +// Extracts a archive file to a memory buffer. +mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags); +mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip, const char *pFilename, void *pBuf, size_t buf_size, mz_uint flags); + +// Extracts a archive file to a dynamically allocated heap buffer. +void *mz_zip_reader_extract_to_heap(mz_zip_archive *pZip, mz_uint file_index, size_t *pSize, mz_uint flags); +void *mz_zip_reader_extract_file_to_heap(mz_zip_archive *pZip, const char *pFilename, size_t *pSize, mz_uint flags); + +// Extracts a archive file using a callback function to output the file's data. +mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip, mz_uint file_index, mz_file_write_func pCallback, void *pOpaque, mz_uint flags); +mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip, const char *pFilename, mz_file_write_func pCallback, void *pOpaque, mz_uint flags); + +#ifndef MINIZ_NO_STDIO +// Extracts a archive file to a disk file and sets its last accessed and modified times. +// This function only extracts files, not archive directory records. +mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags); +mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags); +#endif + +// Ends archive reading, freeing all allocations, and closing the input archive file if mz_zip_reader_init_file() was used. +mz_bool mz_zip_reader_end(mz_zip_archive *pZip); + +// ZIP archive writing + +#ifndef MINIZ_NO_ARCHIVE_WRITING_APIS + +// Inits a ZIP archive writer. +mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size); +mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip, size_t size_to_reserve_at_beginning, size_t initial_allocation_size); + +#ifndef MINIZ_NO_STDIO +mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint64 size_to_reserve_at_beginning); +#endif + +// Converts a ZIP archive reader object into a writer object, to allow efficient in-place file appends to occur on an existing archive. +// For archives opened using mz_zip_reader_init_file, pFilename must be the archive's filename so it can be reopened for writing. If the file can't be reopened, mz_zip_reader_end() will be called. +// For archives opened using mz_zip_reader_init_mem, the memory block must be growable using the realloc callback (which defaults to realloc unless you've overridden it). +// Finally, for archives opened using mz_zip_reader_init, the mz_zip_archive's user provided m_pWrite function cannot be NULL. +// Note: In-place archive modification is not recommended unless you know what you're doing, because if execution stops or something goes wrong before +// the archive is finalized the file's central directory will be hosed. +mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip, const char *pFilename); + +// Adds the contents of a memory buffer to an archive. These functions record the current local time into the archive. +// To add a directory entry, call this method with an archive name ending in a forwardslash with empty buffer. +// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. +mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags); +mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags, mz_uint64 uncomp_size, mz_uint32 uncomp_crc32); + +#ifndef MINIZ_NO_STDIO +// Adds the contents of a disk file to an archive. This function also records the disk file's modified time into the archive. +// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. +mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchive_name, const char *pSrc_filename, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); +#endif + +// Adds a file to an archive by fully cloning the data from another archive. +// This function fully clones the source file's compressed data (no recompression), along with its full filename, extra data, and comment fields. +mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip, mz_zip_archive *pSource_zip, mz_uint file_index); + +// Finalizes the archive by writing the central directory records followed by the end of central directory record. +// After an archive is finalized, the only valid call on the mz_zip_archive struct is mz_zip_writer_end(). +// An archive must be manually finalized by calling this function for it to be valid. +mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip); +mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void **pBuf, size_t *pSize); + +// Ends archive writing, freeing all allocations, and closing the output file if mz_zip_writer_init_file() was used. +// Note for the archive to be valid, it must have been finalized before ending. +mz_bool mz_zip_writer_end(mz_zip_archive *pZip); + +// Misc. high-level helper functions: + +// mz_zip_add_mem_to_archive_file_in_place() efficiently (but not atomically) appends a memory blob to a ZIP archive. +// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION. +mz_bool mz_zip_add_mem_to_archive_file_in_place(const char *pZip_filename, const char *pArchive_name, const void *pBuf, size_t buf_size, const void *pComment, mz_uint16 comment_size, mz_uint level_and_flags); + +// Reads a single file from an archive into a heap block. +// Returns NULL on failure. +void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, const char *pArchive_name, size_t *pSize, mz_uint zip_flags); + +#endif // #ifndef MINIZ_NO_ARCHIVE_WRITING_APIS + +#endif // #ifndef MINIZ_NO_ARCHIVE_APIS + +// ------------------- Low-level Decompression API Definitions + +// Decompression flags used by tinfl_decompress(). +// TINFL_FLAG_PARSE_ZLIB_HEADER: If set, the input has a valid zlib header and ends with an adler32 checksum (it's a valid zlib stream). Otherwise, the input is a raw deflate stream. +// TINFL_FLAG_HAS_MORE_INPUT: If set, there are more input bytes available beyond the end of the supplied input buffer. If clear, the input buffer contains all remaining input. +// TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF: If set, the output buffer is large enough to hold the entire decompressed stream. If clear, the output buffer is at least the size of the dictionary (typically 32KB). +// TINFL_FLAG_COMPUTE_ADLER32: Force adler-32 checksum computation of the decompressed bytes. +enum +{ + TINFL_FLAG_PARSE_ZLIB_HEADER = 1, + TINFL_FLAG_HAS_MORE_INPUT = 2, + TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF = 4, + TINFL_FLAG_COMPUTE_ADLER32 = 8 +}; + +// High level decompression functions: +// tinfl_decompress_mem_to_heap() decompresses a block in memory to a heap block allocated via malloc(). +// On entry: +// pSrc_buf, src_buf_len: Pointer and size of the Deflate or zlib source data to decompress. +// On return: +// Function returns a pointer to the decompressed data, or NULL on failure. +// *pOut_len will be set to the decompressed data's size, which could be larger than src_buf_len on uncompressible data. +// The caller must call mz_free() on the returned block when it's no longer needed. +void *tinfl_decompress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags); + +// tinfl_decompress_mem_to_mem() decompresses a block in memory to another block in memory. +// Returns TINFL_DECOMPRESS_MEM_TO_MEM_FAILED on failure, or the number of bytes written on success. +#define TINFL_DECOMPRESS_MEM_TO_MEM_FAILED ((size_t)(-1)) +size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags); + +// tinfl_decompress_mem_to_callback() decompresses a block in memory to an internal 32KB buffer, and a user provided callback function will be called to flush the buffer. +// Returns 1 on success or 0 on failure. +typedef int (*tinfl_put_buf_func_ptr)(const void* pBuf, int len, void *pUser); +int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size, tinfl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); + +struct tinfl_decompressor_tag; typedef struct tinfl_decompressor_tag tinfl_decompressor; + +// Max size of LZ dictionary. +#define TINFL_LZ_DICT_SIZE 32768 + +// Return status. +typedef enum +{ + TINFL_STATUS_BAD_PARAM = -3, + TINFL_STATUS_ADLER32_MISMATCH = -2, + TINFL_STATUS_FAILED = -1, + TINFL_STATUS_DONE = 0, + TINFL_STATUS_NEEDS_MORE_INPUT = 1, + TINFL_STATUS_HAS_MORE_OUTPUT = 2 +} tinfl_status; + +// Initializes the decompressor to its initial state. +#define tinfl_init(r) do { (r)->m_state = 0; } MZ_MACRO_END +#define tinfl_get_adler32(r) (r)->m_check_adler32 + +// Main low-level decompressor coroutine function. This is the only function actually needed for decompression. All the other functions are just high-level helpers for improved usability. +// This is a universal API, i.e. it can be used as a building block to build any desired higher level decompression API. In the limit case, it can be called once per every byte input or output. +tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_next, size_t *pIn_buf_size, mz_uint8 *pOut_buf_start, mz_uint8 *pOut_buf_next, size_t *pOut_buf_size, const mz_uint32 decomp_flags); + +// Internal/private bits follow. +enum +{ + TINFL_MAX_HUFF_TABLES = 3, TINFL_MAX_HUFF_SYMBOLS_0 = 288, TINFL_MAX_HUFF_SYMBOLS_1 = 32, TINFL_MAX_HUFF_SYMBOLS_2 = 19, + TINFL_FAST_LOOKUP_BITS = 10, TINFL_FAST_LOOKUP_SIZE = 1 << TINFL_FAST_LOOKUP_BITS +}; + +typedef struct +{ + mz_uint8 m_code_size[TINFL_MAX_HUFF_SYMBOLS_0]; + mz_int16 m_look_up[TINFL_FAST_LOOKUP_SIZE], m_tree[TINFL_MAX_HUFF_SYMBOLS_0 * 2]; +} tinfl_huff_table; + +#if MINIZ_HAS_64BIT_REGISTERS + #define TINFL_USE_64BIT_BITBUF 1 +#endif + +#if TINFL_USE_64BIT_BITBUF + typedef mz_uint64 tinfl_bit_buf_t; + #define TINFL_BITBUF_SIZE (64) +#else + typedef mz_uint32 tinfl_bit_buf_t; + #define TINFL_BITBUF_SIZE (32) +#endif + +struct tinfl_decompressor_tag +{ + mz_uint32 m_state, m_num_bits, m_zhdr0, m_zhdr1, m_z_adler32, m_final, m_type, m_check_adler32, m_dist, m_counter, m_num_extra, m_table_sizes[TINFL_MAX_HUFF_TABLES]; + tinfl_bit_buf_t m_bit_buf; + size_t m_dist_from_out_buf_start; + tinfl_huff_table m_tables[TINFL_MAX_HUFF_TABLES]; + mz_uint8 m_raw_header[4], m_len_codes[TINFL_MAX_HUFF_SYMBOLS_0 + TINFL_MAX_HUFF_SYMBOLS_1 + 137]; +}; + +// ------------------- Low-level Compression API Definitions + +// Set TDEFL_LESS_MEMORY to 1 to use less memory (compression will be slightly slower, and raw/dynamic blocks will be output more frequently). +#define TDEFL_LESS_MEMORY 1 + +// tdefl_init() compression flags logically OR'd together (low 12 bits contain the max. number of probes per dictionary search): +// TDEFL_DEFAULT_MAX_PROBES: The compressor defaults to 128 dictionary probes per dictionary search. 0=Huffman only, 1=Huffman+LZ (fastest/crap compression), 4095=Huffman+LZ (slowest/best compression). +enum +{ + TDEFL_HUFFMAN_ONLY = 0, TDEFL_DEFAULT_MAX_PROBES = 128, TDEFL_MAX_PROBES_MASK = 0xFFF +}; + +// TDEFL_WRITE_ZLIB_HEADER: If set, the compressor outputs a zlib header before the deflate data, and the Adler-32 of the source data at the end. Otherwise, you'll get raw deflate data. +// TDEFL_COMPUTE_ADLER32: Always compute the adler-32 of the input data (even when not writing zlib headers). +// TDEFL_GREEDY_PARSING_FLAG: Set to use faster greedy parsing, instead of more efficient lazy parsing. +// TDEFL_NONDETERMINISTIC_PARSING_FLAG: Enable to decrease the compressor's initialization time to the minimum, but the output may vary from run to run given the same input (depending on the contents of memory). +// TDEFL_RLE_MATCHES: Only look for RLE matches (matches with a distance of 1) +// TDEFL_FILTER_MATCHES: Discards matches <= 5 chars if enabled. +// TDEFL_FORCE_ALL_STATIC_BLOCKS: Disable usage of optimized Huffman tables. +// TDEFL_FORCE_ALL_RAW_BLOCKS: Only use raw (uncompressed) deflate blocks. +// The low 12 bits are reserved to control the max # of hash probes per dictionary lookup (see TDEFL_MAX_PROBES_MASK). +enum +{ + TDEFL_WRITE_ZLIB_HEADER = 0x01000, + TDEFL_COMPUTE_ADLER32 = 0x02000, + TDEFL_GREEDY_PARSING_FLAG = 0x04000, + TDEFL_NONDETERMINISTIC_PARSING_FLAG = 0x08000, + TDEFL_RLE_MATCHES = 0x10000, + TDEFL_FILTER_MATCHES = 0x20000, + TDEFL_FORCE_ALL_STATIC_BLOCKS = 0x40000, + TDEFL_FORCE_ALL_RAW_BLOCKS = 0x80000 +}; + +// High level compression functions: +// tdefl_compress_mem_to_heap() compresses a block in memory to a heap block allocated via malloc(). +// On entry: +// pSrc_buf, src_buf_len: Pointer and size of source block to compress. +// flags: The max match finder probes (default is 128) logically OR'd against the above flags. Higher probes are slower but improve compression. +// On return: +// Function returns a pointer to the compressed data, or NULL on failure. +// *pOut_len will be set to the compressed data's size, which could be larger than src_buf_len on uncompressible data. +// The caller must free() the returned block when it's no longer needed. +void *tdefl_compress_mem_to_heap(const void *pSrc_buf, size_t src_buf_len, size_t *pOut_len, int flags); + +// tdefl_compress_mem_to_mem() compresses a block in memory to another block in memory. +// Returns 0 on failure. +size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags); + +// Compresses an image to a compressed PNG file in memory. +// On entry: +// pImage, w, h, and num_chans describe the image to compress. num_chans may be 1, 2, 3, or 4. +// The image pitch in bytes per scanline will be w*num_chans. The leftmost pixel on the top scanline is stored first in memory. +// level may range from [0,10], use MZ_NO_COMPRESSION, MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc. or a decent default is MZ_DEFAULT_LEVEL +// If flip is true, the image will be flipped on the Y axis (useful for OpenGL apps). +// On return: +// Function returns a pointer to the compressed data, or NULL on failure. +// *pLen_out will be set to the size of the PNG image file. +// The caller must mz_free() the returned heap block (which will typically be larger than *pLen_out) when it's no longer needed. +void *tdefl_write_image_to_png_file_in_memory_ex(const void *pImage, int w, int h, int num_chans, size_t *pLen_out, mz_uint level, mz_bool flip); +void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, int num_chans, size_t *pLen_out); + +// Output stream interface. The compressor uses this interface to write compressed data. It'll typically be called TDEFL_OUT_BUF_SIZE at a time. +typedef mz_bool (*tdefl_put_buf_func_ptr)(const void* pBuf, int len, void *pUser); + +// tdefl_compress_mem_to_output() compresses a block to an output stream. The above helpers use this function internally. +mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); + +enum { TDEFL_MAX_HUFF_TABLES = 3, TDEFL_MAX_HUFF_SYMBOLS_0 = 288, TDEFL_MAX_HUFF_SYMBOLS_1 = 32, TDEFL_MAX_HUFF_SYMBOLS_2 = 19, TDEFL_LZ_DICT_SIZE = 32768, TDEFL_LZ_DICT_SIZE_MASK = TDEFL_LZ_DICT_SIZE - 1, TDEFL_MIN_MATCH_LEN = 3, TDEFL_MAX_MATCH_LEN = 258 }; + +// TDEFL_OUT_BUF_SIZE MUST be large enough to hold a single entire compressed output block (using static/fixed Huffman codes). +#if TDEFL_LESS_MEMORY +enum { TDEFL_LZ_CODE_BUF_SIZE = 24 * 1024, TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13 ) / 10, TDEFL_MAX_HUFF_SYMBOLS = 288, TDEFL_LZ_HASH_BITS = 12, TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS }; +#else +enum { TDEFL_LZ_CODE_BUF_SIZE = 64 * 1024, TDEFL_OUT_BUF_SIZE = (TDEFL_LZ_CODE_BUF_SIZE * 13 ) / 10, TDEFL_MAX_HUFF_SYMBOLS = 288, TDEFL_LZ_HASH_BITS = 15, TDEFL_LEVEL1_HASH_SIZE_MASK = 4095, TDEFL_LZ_HASH_SHIFT = (TDEFL_LZ_HASH_BITS + 2) / 3, TDEFL_LZ_HASH_SIZE = 1 << TDEFL_LZ_HASH_BITS }; +#endif + +// The low-level tdefl functions below may be used directly if the above helper functions aren't flexible enough. The low-level functions don't make any heap allocations, unlike the above helper functions. +typedef enum +{ + TDEFL_STATUS_BAD_PARAM = -2, + TDEFL_STATUS_PUT_BUF_FAILED = -1, + TDEFL_STATUS_OKAY = 0, + TDEFL_STATUS_DONE = 1, +} tdefl_status; + +// Must map to MZ_NO_FLUSH, MZ_SYNC_FLUSH, etc. enums +typedef enum +{ + TDEFL_NO_FLUSH = 0, + TDEFL_SYNC_FLUSH = 2, + TDEFL_FULL_FLUSH = 3, + TDEFL_FINISH = 4 +} tdefl_flush; + +// tdefl's compression state structure. +typedef struct +{ + tdefl_put_buf_func_ptr m_pPut_buf_func; + void *m_pPut_buf_user; + mz_uint m_flags, m_max_probes[2]; + int m_greedy_parsing; + mz_uint m_adler32, m_lookahead_pos, m_lookahead_size, m_dict_size; + mz_uint8 *m_pLZ_code_buf, *m_pLZ_flags, *m_pOutput_buf, *m_pOutput_buf_end; + mz_uint m_num_flags_left, m_total_lz_bytes, m_lz_code_buf_dict_pos, m_bits_in, m_bit_buffer; + mz_uint m_saved_match_dist, m_saved_match_len, m_saved_lit, m_output_flush_ofs, m_output_flush_remaining, m_finished, m_block_index, m_wants_to_finish; + tdefl_status m_prev_return_status; + const void *m_pIn_buf; + void *m_pOut_buf; + size_t *m_pIn_buf_size, *m_pOut_buf_size; + tdefl_flush m_flush; + const mz_uint8 *m_pSrc; + size_t m_src_buf_left, m_out_buf_ofs; + mz_uint8 m_dict[TDEFL_LZ_DICT_SIZE + TDEFL_MAX_MATCH_LEN - 1]; + mz_uint16 m_huff_count[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; + mz_uint16 m_huff_codes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; + mz_uint8 m_huff_code_sizes[TDEFL_MAX_HUFF_TABLES][TDEFL_MAX_HUFF_SYMBOLS]; + mz_uint8 m_lz_code_buf[TDEFL_LZ_CODE_BUF_SIZE]; + mz_uint16 m_next[TDEFL_LZ_DICT_SIZE]; + mz_uint16 m_hash[TDEFL_LZ_HASH_SIZE]; + mz_uint8 m_output_buf[TDEFL_OUT_BUF_SIZE]; +} tdefl_compressor; + +// Initializes the compressor. +// There is no corresponding deinit() function because the tdefl API's do not dynamically allocate memory. +// pBut_buf_func: If NULL, output data will be supplied to the specified callback. In this case, the user should call the tdefl_compress_buffer() API for compression. +// If pBut_buf_func is NULL the user should always call the tdefl_compress() API. +// flags: See the above enums (TDEFL_HUFFMAN_ONLY, TDEFL_WRITE_ZLIB_HEADER, etc.) +tdefl_status tdefl_init(tdefl_compressor *d, tdefl_put_buf_func_ptr pPut_buf_func, void *pPut_buf_user, int flags); + +// Compresses a block of data, consuming as much of the specified input buffer as possible, and writing as much compressed data to the specified output buffer as possible. +tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf, size_t *pIn_buf_size, void *pOut_buf, size_t *pOut_buf_size, tdefl_flush flush); + +// tdefl_compress_buffer() is only usable when the tdefl_init() is called with a non-NULL tdefl_put_buf_func_ptr. +// tdefl_compress_buffer() always consumes the entire input buffer. +tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_buf, size_t in_buf_size, tdefl_flush flush); + +tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d); +mz_uint32 tdefl_get_adler32(tdefl_compressor *d); + +// Can't use tdefl_create_comp_flags_from_zip_params if MINIZ_NO_ZLIB_APIS isn't defined, because it uses some of its macros. +#ifndef MINIZ_NO_ZLIB_APIS +// Create tdefl_compress() flags given zlib-style compression parameters. +// level may range from [0,10] (where 10 is absolute max compression, but may be much slower on some files) +// window_bits may be -15 (raw deflate) or 15 (zlib) +// strategy may be either MZ_DEFAULT_STRATEGY, MZ_FILTERED, MZ_HUFFMAN_ONLY, MZ_RLE, or MZ_FIXED +mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, int strategy); +#endif // #ifndef MINIZ_NO_ZLIB_APIS + +#ifdef __cplusplus +} +#endif + +#endif // MINIZ_HEADER_INCLUDED + diff --git a/components/esp_rom/include/esp32s2beta/rom/queue.h b/components/esp_rom/include/esp32s2beta/rom/queue.h new file mode 100644 index 0000000000..29ee670600 --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/queue.h @@ -0,0 +1,645 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + * $FreeBSD$ + */ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This file defines four types of data structures: singly-linked lists, + * singly-linked tail queues, lists and tail queues. + * + * A singly-linked list is headed by a single forward pointer. The elements + * are singly linked for minimum space and pointer manipulation overhead at + * the expense of O(n) removal for arbitrary elements. New elements can be + * added to the list after an existing element or at the head of the list. + * Elements being removed from the head of the list should use the explicit + * macro for this purpose for optimum efficiency. A singly-linked list may + * only be traversed in the forward direction. Singly-linked lists are ideal + * for applications with large datasets and few or no removals or for + * implementing a LIFO queue. + * + * A singly-linked tail queue is headed by a pair of pointers, one to the + * head of the list and the other to the tail of the list. The elements are + * singly linked for minimum space and pointer manipulation overhead at the + * expense of O(n) removal for arbitrary elements. New elements can be added + * to the list after an existing element, at the head of the list, or at the + * end of the list. Elements being removed from the head of the tail queue + * should use the explicit macro for this purpose for optimum efficiency. + * A singly-linked tail queue may only be traversed in the forward direction. + * Singly-linked tail queues are ideal for applications with large datasets + * and few or no removals or for implementing a FIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * For details on the use of these macros, see the queue(3) manual page. + * + * + * SLIST LIST STAILQ TAILQ + * _HEAD + + + + + * _HEAD_INITIALIZER + + + + + * _ENTRY + + + + + * _INIT + + + + + * _EMPTY + + + + + * _FIRST + + + + + * _NEXT + + + + + * _PREV - - - + + * _LAST - - + + + * _FOREACH + + + + + * _FOREACH_SAFE + + + + + * _FOREACH_REVERSE - - - + + * _FOREACH_REVERSE_SAFE - - - + + * _INSERT_HEAD + + + + + * _INSERT_BEFORE - + - + + * _INSERT_AFTER + + + + + * _INSERT_TAIL - - + + + * _CONCAT - - + + + * _REMOVE_AFTER + - + - + * _REMOVE_HEAD + - + - + * _REMOVE + + + + + * + */ +#ifdef QUEUE_MACRO_DEBUG +/* Store the last 2 places the queue element or head was altered */ +struct qm_trace { + char * lastfile; + int lastline; + char * prevfile; + int prevline; +}; + +#define TRACEBUF struct qm_trace trace; +#define TRASHIT(x) do {(x) = (void *)-1;} while (0) +#define QMD_SAVELINK(name, link) void **name = (void *)&(link) + +#define QMD_TRACE_HEAD(head) do { \ + (head)->trace.prevline = (head)->trace.lastline; \ + (head)->trace.prevfile = (head)->trace.lastfile; \ + (head)->trace.lastline = __LINE__; \ + (head)->trace.lastfile = __FILE__; \ +} while (0) + +#define QMD_TRACE_ELEM(elem) do { \ + (elem)->trace.prevline = (elem)->trace.lastline; \ + (elem)->trace.prevfile = (elem)->trace.lastfile; \ + (elem)->trace.lastline = __LINE__; \ + (elem)->trace.lastfile = __FILE__; \ +} while (0) + +#else +#define QMD_TRACE_ELEM(elem) +#define QMD_TRACE_HEAD(head) +#define QMD_SAVELINK(name, link) +#define TRACEBUF +#define TRASHIT(x) +#endif /* QUEUE_MACRO_DEBUG */ + +/* + * Singly-linked List declarations. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List functions. + */ +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) + +#define SLIST_FIRST(head) ((head)->slh_first) + +#define SLIST_FOREACH(var, head, field) \ + for ((var) = SLIST_FIRST((head)); \ + (var); \ + (var) = SLIST_NEXT((var), field)) + +#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = SLIST_FIRST((head)); \ + (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ + for ((varp) = &SLIST_FIRST((head)); \ + ((var) = *(varp)) != NULL; \ + (varp) = &SLIST_NEXT((var), field)) + +#define SLIST_INIT(head) do { \ + SLIST_FIRST((head)) = NULL; \ +} while (0) + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ + SLIST_NEXT((slistelm), field) = (elm); \ +} while (0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ + SLIST_FIRST((head)) = (elm); \ +} while (0) + +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + QMD_SAVELINK(oldnext, (elm)->field.sle_next); \ + if (SLIST_FIRST((head)) == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = SLIST_FIRST((head)); \ + while (SLIST_NEXT(curelm, field) != (elm)) \ + curelm = SLIST_NEXT(curelm, field); \ + SLIST_REMOVE_AFTER(curelm, field); \ + } \ + TRASHIT(*oldnext); \ +} while (0) + +#define SLIST_REMOVE_AFTER(elm, field) do { \ + SLIST_NEXT(elm, field) = \ + SLIST_NEXT(SLIST_NEXT(elm, field), field); \ +} while (0) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ +} while (0) + +/* + * Singly-linked Tail queue declarations. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first;/* first element */ \ + struct type **stqh_last;/* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_CONCAT(head1, head2) do { \ + if (!STAILQ_EMPTY((head2))) { \ + *(head1)->stqh_last = (head2)->stqh_first; \ + (head1)->stqh_last = (head2)->stqh_last; \ + STAILQ_INIT((head2)); \ + } \ +} while (0) + +#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) + +#define STAILQ_FIRST(head) ((head)->stqh_first) + +#define STAILQ_FOREACH(var, head, field) \ + for((var) = STAILQ_FIRST((head)); \ + (var); \ + (var) = STAILQ_NEXT((var), field)) + + +#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = STAILQ_FIRST((head)); \ + (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define STAILQ_INIT(head) do { \ + STAILQ_FIRST((head)) = NULL; \ + (head)->stqh_last = &STAILQ_FIRST((head)); \ +} while (0) + +#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ + if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ + STAILQ_NEXT((tqelm), field) = (elm); \ +} while (0) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ + STAILQ_FIRST((head)) = (elm); \ +} while (0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + STAILQ_NEXT((elm), field) = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ +} while (0) + +#define STAILQ_LAST(head, type, field) \ + (STAILQ_EMPTY((head)) ? \ + NULL : \ + ((struct type *)(void *) \ + ((char *)((head)->stqh_last) - __offsetof(struct type, field)))) + +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \ + if (STAILQ_FIRST((head)) == (elm)) { \ + STAILQ_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = STAILQ_FIRST((head)); \ + while (STAILQ_NEXT(curelm, field) != (elm)) \ + curelm = STAILQ_NEXT(curelm, field); \ + STAILQ_REMOVE_AFTER(head, curelm, field); \ + } \ + TRASHIT(*oldnext); \ +} while (0) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if ((STAILQ_FIRST((head)) = \ + STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ + (head)->stqh_last = &STAILQ_FIRST((head)); \ +} while (0) + +#define STAILQ_REMOVE_AFTER(head, elm, field) do { \ + if ((STAILQ_NEXT(elm, field) = \ + STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \ + (head)->stqh_last = &STAILQ_NEXT((elm), field); \ +} while (0) + +#define STAILQ_SWAP(head1, head2, type) do { \ + struct type *swap_first = STAILQ_FIRST(head1); \ + struct type **swap_last = (head1)->stqh_last; \ + STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \ + (head1)->stqh_last = (head2)->stqh_last; \ + STAILQ_FIRST(head2) = swap_first; \ + (head2)->stqh_last = swap_last; \ + if (STAILQ_EMPTY(head1)) \ + (head1)->stqh_last = &STAILQ_FIRST(head1); \ + if (STAILQ_EMPTY(head2)) \ + (head2)->stqh_last = &STAILQ_FIRST(head2); \ +} while (0) + +#define STAILQ_INSERT_CHAIN_HEAD(head, elm_chead, elm_ctail, field) do { \ + if ((STAILQ_NEXT(elm_ctail, field) = STAILQ_FIRST(head)) == NULL ) { \ + (head)->stqh_last = &STAILQ_NEXT(elm_ctail, field); \ + } \ + STAILQ_FIRST(head) = (elm_chead); \ +} while (0) + + +/* + * List declarations. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List functions. + */ + +#if (defined(_KERNEL) && defined(INVARIANTS)) +#define QMD_LIST_CHECK_HEAD(head, field) do { \ + if (LIST_FIRST((head)) != NULL && \ + LIST_FIRST((head))->field.le_prev != \ + &LIST_FIRST((head))) \ + panic("Bad list head %p first->prev != head", (head)); \ +} while (0) + +#define QMD_LIST_CHECK_NEXT(elm, field) do { \ + if (LIST_NEXT((elm), field) != NULL && \ + LIST_NEXT((elm), field)->field.le_prev != \ + &((elm)->field.le_next)) \ + panic("Bad link elm %p next->prev != elm", (elm)); \ +} while (0) + +#define QMD_LIST_CHECK_PREV(elm, field) do { \ + if (*(elm)->field.le_prev != (elm)) \ + panic("Bad link elm %p prev->next != elm", (elm)); \ +} while (0) +#else +#define QMD_LIST_CHECK_HEAD(head, field) +#define QMD_LIST_CHECK_NEXT(elm, field) +#define QMD_LIST_CHECK_PREV(elm, field) +#endif /* (_KERNEL && INVARIANTS) */ + +#define LIST_EMPTY(head) ((head)->lh_first == NULL) + +#define LIST_FIRST(head) ((head)->lh_first) + +#define LIST_FOREACH(var, head, field) \ + for ((var) = LIST_FIRST((head)); \ + (var); \ + (var) = LIST_NEXT((var), field)) + +#define LIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = LIST_FIRST((head)); \ + (var) && ((tvar) = LIST_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define LIST_INIT(head) do { \ + LIST_FIRST((head)) = NULL; \ +} while (0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + QMD_LIST_CHECK_NEXT(listelm, field); \ + if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ + LIST_NEXT((listelm), field)->field.le_prev = \ + &LIST_NEXT((elm), field); \ + LIST_NEXT((listelm), field) = (elm); \ + (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ +} while (0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + QMD_LIST_CHECK_PREV(listelm, field); \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + LIST_NEXT((elm), field) = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ +} while (0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + QMD_LIST_CHECK_HEAD((head), field); \ + if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ + LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ + LIST_FIRST((head)) = (elm); \ + (elm)->field.le_prev = &LIST_FIRST((head)); \ +} while (0) + +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + +#define LIST_REMOVE(elm, field) do { \ + QMD_SAVELINK(oldnext, (elm)->field.le_next); \ + QMD_SAVELINK(oldprev, (elm)->field.le_prev); \ + QMD_LIST_CHECK_NEXT(elm, field); \ + QMD_LIST_CHECK_PREV(elm, field); \ + if (LIST_NEXT((elm), field) != NULL) \ + LIST_NEXT((elm), field)->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = LIST_NEXT((elm), field); \ + TRASHIT(*oldnext); \ + TRASHIT(*oldprev); \ +} while (0) + +#define LIST_SWAP(head1, head2, type, field) do { \ + struct type *swap_tmp = LIST_FIRST((head1)); \ + LIST_FIRST((head1)) = LIST_FIRST((head2)); \ + LIST_FIRST((head2)) = swap_tmp; \ + if ((swap_tmp = LIST_FIRST((head1))) != NULL) \ + swap_tmp->field.le_prev = &LIST_FIRST((head1)); \ + if ((swap_tmp = LIST_FIRST((head2))) != NULL) \ + swap_tmp->field.le_prev = &LIST_FIRST((head2)); \ +} while (0) + +/* + * Tail queue declarations. + */ +#define TAILQ_HEAD(name, type) \ +struct name { \ + struct type *tqh_first; /* first element */ \ + struct type **tqh_last; /* addr of last next element */ \ + TRACEBUF \ +} + +#define TAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).tqh_first } + +#define TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ + TRACEBUF \ +} + +/* + * Tail queue functions. + */ +#if (defined(_KERNEL) && defined(INVARIANTS)) +#define QMD_TAILQ_CHECK_HEAD(head, field) do { \ + if (!TAILQ_EMPTY(head) && \ + TAILQ_FIRST((head))->field.tqe_prev != \ + &TAILQ_FIRST((head))) \ + panic("Bad tailq head %p first->prev != head", (head)); \ +} while (0) + +#define QMD_TAILQ_CHECK_TAIL(head, field) do { \ + if (*(head)->tqh_last != NULL) \ + panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \ +} while (0) + +#define QMD_TAILQ_CHECK_NEXT(elm, field) do { \ + if (TAILQ_NEXT((elm), field) != NULL && \ + TAILQ_NEXT((elm), field)->field.tqe_prev != \ + &((elm)->field.tqe_next)) \ + panic("Bad link elm %p next->prev != elm", (elm)); \ +} while (0) + +#define QMD_TAILQ_CHECK_PREV(elm, field) do { \ + if (*(elm)->field.tqe_prev != (elm)) \ + panic("Bad link elm %p prev->next != elm", (elm)); \ +} while (0) +#else +#define QMD_TAILQ_CHECK_HEAD(head, field) +#define QMD_TAILQ_CHECK_TAIL(head, headname) +#define QMD_TAILQ_CHECK_NEXT(elm, field) +#define QMD_TAILQ_CHECK_PREV(elm, field) +#endif /* (_KERNEL && INVARIANTS) */ + +#define TAILQ_CONCAT(head1, head2, field) do { \ + if (!TAILQ_EMPTY(head2)) { \ + *(head1)->tqh_last = (head2)->tqh_first; \ + (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ + (head1)->tqh_last = (head2)->tqh_last; \ + TAILQ_INIT((head2)); \ + QMD_TRACE_HEAD(head1); \ + QMD_TRACE_HEAD(head2); \ + } \ +} while (0) + +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) + +#define TAILQ_FIRST(head) ((head)->tqh_first) + +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = TAILQ_FIRST((head)); \ + (var); \ + (var) = TAILQ_NEXT((var), field)) + +#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = TAILQ_FIRST((head)); \ + (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = TAILQ_LAST((head), headname); \ + (var); \ + (var) = TAILQ_PREV((var), headname, field)) + +#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ + for ((var) = TAILQ_LAST((head), headname); \ + (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ + (var) = (tvar)) + +#define TAILQ_INIT(head) do { \ + TAILQ_FIRST((head)) = NULL; \ + (head)->tqh_last = &TAILQ_FIRST((head)); \ + QMD_TRACE_HEAD(head); \ +} while (0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + QMD_TAILQ_CHECK_NEXT(listelm, field); \ + if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ + TAILQ_NEXT((elm), field)->field.tqe_prev = \ + &TAILQ_NEXT((elm), field); \ + else { \ + (head)->tqh_last = &TAILQ_NEXT((elm), field); \ + QMD_TRACE_HEAD(head); \ + } \ + TAILQ_NEXT((listelm), field) = (elm); \ + (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ + QMD_TRACE_ELEM(&(elm)->field); \ + QMD_TRACE_ELEM(&listelm->field); \ +} while (0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + QMD_TAILQ_CHECK_PREV(listelm, field); \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + TAILQ_NEXT((elm), field) = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ + QMD_TRACE_ELEM(&(elm)->field); \ + QMD_TRACE_ELEM(&listelm->field); \ +} while (0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + QMD_TAILQ_CHECK_HEAD(head, field); \ + if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ + TAILQ_FIRST((head))->field.tqe_prev = \ + &TAILQ_NEXT((elm), field); \ + else \ + (head)->tqh_last = &TAILQ_NEXT((elm), field); \ + TAILQ_FIRST((head)) = (elm); \ + (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ + QMD_TRACE_HEAD(head); \ + QMD_TRACE_ELEM(&(elm)->field); \ +} while (0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + QMD_TAILQ_CHECK_TAIL(head, field); \ + TAILQ_NEXT((elm), field) = NULL; \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &TAILQ_NEXT((elm), field); \ + QMD_TRACE_HEAD(head); \ + QMD_TRACE_ELEM(&(elm)->field); \ +} while (0) + +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)((head)->tqh_last))->tqh_last)) + +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) + +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + +#define TAILQ_REMOVE(head, elm, field) do { \ + QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \ + QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \ + QMD_TAILQ_CHECK_NEXT(elm, field); \ + QMD_TAILQ_CHECK_PREV(elm, field); \ + if ((TAILQ_NEXT((elm), field)) != NULL) \ + TAILQ_NEXT((elm), field)->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else { \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + QMD_TRACE_HEAD(head); \ + } \ + *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ + TRASHIT(*oldnext); \ + TRASHIT(*oldprev); \ + QMD_TRACE_ELEM(&(elm)->field); \ +} while (0) + +#define TAILQ_SWAP(head1, head2, type, field) do { \ + struct type *swap_first = (head1)->tqh_first; \ + struct type **swap_last = (head1)->tqh_last; \ + (head1)->tqh_first = (head2)->tqh_first; \ + (head1)->tqh_last = (head2)->tqh_last; \ + (head2)->tqh_first = swap_first; \ + (head2)->tqh_last = swap_last; \ + if ((swap_first = (head1)->tqh_first) != NULL) \ + swap_first->field.tqe_prev = &(head1)->tqh_first; \ + else \ + (head1)->tqh_last = &(head1)->tqh_first; \ + if ((swap_first = (head2)->tqh_first) != NULL) \ + swap_first->field.tqe_prev = &(head2)->tqh_first; \ + else \ + (head2)->tqh_last = &(head2)->tqh_first; \ +} while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_QUEUE_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/rsa_pss.h b/components/esp_rom/include/esp32s2beta/rom/rsa_pss.h new file mode 100644 index 0000000000..cd6218f7f8 --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/rsa_pss.h @@ -0,0 +1,36 @@ +// 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 _ROM_RSA_PSS_H_ +#define _ROM_RSA_PSS_H_ + +#include + +#define ETS_SIG_LEN 384 /* Bytes */ +#define ETS_DIGEST_LEN 32 /* SHA-256, bytes */ + +typedef struct { + uint8_t n[384]; /* Public key modulus */ + uint32_t e; /* Public key exponent */ + uint8_t rinv[384]; + uint32_t mdash; +} ets_rsa_pubkey_t; + +bool ets_rsa_pss_verify(const ets_rsa_pubkey_t *key, const uint8_t *sig, const uint8_t *digest); + +void ets_mgf1_sha256(const uint8_t *mgfSeed, size_t seedLen, size_t maskLen, uint8_t *mask); + +bool ets_emsa_pss_verify(const uint8_t *encoded_message, const uint8_t *mhash); + +#endif diff --git a/components/esp_rom/include/esp32s2beta/rom/rtc.h b/components/esp_rom/include/esp32s2beta/rom/rtc.h new file mode 100644 index 0000000000..3406eab33b --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/rtc.h @@ -0,0 +1,219 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _ROM_RTC_H_ +#define _ROM_RTC_H_ + +#include "ets_sys.h" + +#include +#include + +#include "soc/soc.h" +#include "soc/rtc_cntl_reg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup rtc_apis, rtc registers and memory related apis + * @brief rtc apis + */ + +/** @addtogroup rtc_apis + * @{ + */ + +/************************************************************************************** + * Note: * + * Some Rtc memory and registers are used, in ROM or in internal library. * + * Please do not use reserved or used rtc memory or registers. * + * * + ************************************************************************************* + * RTC Memory & Store Register usage + ************************************************************************************* + * rtc memory addr type size usage + * 0x3f421000(0x50000000) Slow SIZE_CP Co-Processor code/Reset Entry + * 0x3f421000+SIZE_CP Slow 8192-SIZE_CP + * + * 0x3ff80000(0x40070000) Fast 8192 deep sleep entry code + * + ************************************************************************************* + * RTC store registers usage + * RTC_CNTL_STORE0_REG Reserved + * RTC_CNTL_STORE1_REG RTC_SLOW_CLK calibration value + * RTC_CNTL_STORE2_REG Boot time, low word + * RTC_CNTL_STORE3_REG Boot time, high word + * RTC_CNTL_STORE4_REG External XTAL frequency + * RTC_CNTL_STORE5_REG APB bus frequency + * RTC_CNTL_STORE6_REG FAST_RTC_MEMORY_ENTRY + * RTC_CNTL_STORE7_REG FAST_RTC_MEMORY_CRC + ************************************************************************************* + */ + +#define RTC_SLOW_CLK_CAL_REG RTC_CNTL_STORE1_REG +#define RTC_BOOT_TIME_LOW_REG RTC_CNTL_STORE2_REG +#define RTC_BOOT_TIME_HIGH_REG RTC_CNTL_STORE3_REG +#define RTC_XTAL_FREQ_REG RTC_CNTL_STORE4_REG +#define RTC_APB_FREQ_REG RTC_CNTL_STORE5_REG +#define RTC_ENTRY_ADDR_REG RTC_CNTL_STORE6_REG +#define RTC_MEMORY_CRC_REG RTC_CNTL_STORE7_REG + + +typedef enum { + AWAKE = 0, // +#include "rsa_pss.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct ets_secure_boot_sig_block; +struct ets_secure_boot_signature_t; + +typedef struct ets_secure_boot_sig_block ets_secure_boot_sig_block_t; +typedef struct ets_secure_boot_signature ets_secure_boot_signature_t; +typedef struct ets_secure_boot_key_digests ets_secure_boot_key_digests_t; + +/* Verify bootloader image (reconfigures cache to map, + loads trusted key digests from efuse) + + If allow_key_revoke is true and aggressive revoke efuse is set, + any failed signature has its associated key revoked in efuse. + + If result is ETS_OK, the "simple hash" of the bootloader + is copied into verified_hash. +*/ +int ets_secure_boot_verify_bootloader(uint8_t *verified_hash, bool allow_key_revoke); + +/* Verify bootloader image (reconfigures cache to map), with + key digests provided as parameters.) + + Can be used to verify secure boot status before enabling + secure boot permanently. + + If result is ETS_OK, the "simple hash" of the bootloader is + copied into verified_hash. +*/ +int ets_secure_boot_verify_bootloader_with_keys(uint8_t *verified_hash, const ets_secure_boot_key_digests_t *trusted_keys); + +/* Verify supplied signature against supplied digest, using + supplied trusted key digests. + + Doesn't reconfigure cache or any other hardware access. +*/ +int ets_secure_boot_verify_signature(const ets_secure_boot_signature_t *sig, const uint8_t *image_digest, const ets_secure_boot_key_digests_t *trusted_keys); + +/* Read key digests from efuse. Any revoked/missing digests will be + marked as NULL + + Returns 0 if at least one valid digest was found. +*/ +int ets_secure_boot_read_key_digests(ets_secure_boot_key_digests_t *trusted_keys); + +#define ETS_SECURE_BOOT_V2_SIGNATURE_MAGIC 0xE7 + +/* Secure Boot V2 signature block (up to 3 can be appended) */ +struct ets_secure_boot_sig_block { + uint8_t magic_byte; + uint8_t version; + uint8_t _reserved1; + uint8_t _reserved2; + uint8_t image_digest[32]; + ets_rsa_pubkey_t key; + uint8_t signature[384]; + uint32_t block_crc; + uint8_t _padding[16]; +}; + +_Static_assert(sizeof(ets_secure_boot_sig_block_t) == 1216, "invalid sig block size"); + +#define SECURE_BOOT_NUM_BLOCKS 3 + +/* V2 Secure boot signature sector (up to 3 blocks) */ +struct ets_secure_boot_signature { + ets_secure_boot_sig_block_t block[SECURE_BOOT_NUM_BLOCKS]; + uint8_t _padding[4096 - (sizeof(ets_secure_boot_sig_block_t) * SECURE_BOOT_NUM_BLOCKS)]; +}; + +_Static_assert(sizeof(ets_secure_boot_signature_t) == 4096, "invalid sig sector size"); + +struct ets_secure_boot_key_digests { + const void *key_digests[3]; + bool allow_key_revoke; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_SECURE_BOOT_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/sha.h b/components/esp_rom/include/esp32s2beta/rom/sha.h new file mode 100644 index 0000000000..f04e9aec50 --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/sha.h @@ -0,0 +1,74 @@ +/* + ROM functions for hardware SHA support. + + It is not recommended to use these functions directly. If using + them from esp-idf then use the esp_sha_lock_engine() and + esp_sha_lock_memory_block() functions in hwcrypto/sha.h to ensure + exclusive access. + */ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef _ROM_SHA_H_ +#define _ROM_SHA_H_ + +#include +#include +#include "ets_sys.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SHA1 = 0, + SHA2_224, + SHA2_256, + SHA2_384, + SHA2_512, + SHA2_512224, + SHA2_512256, + SHA2_512T, + SHA_TYPE_MAX +} SHA_TYPE; + +typedef struct SHAContext { + bool start; + bool in_hardware; // Is this context currently in peripheral? Needs to be manually cleared if multiple SHAs are interleaved + SHA_TYPE type; + uint32_t state[16]; // For SHA1/SHA224/SHA256, used 8, other used 16 + unsigned char buffer[128]; // For SHA1/SHA224/SHA256, used 64, other used 128 + uint32_t total_bits[4]; +} SHA_CTX; + +void ets_sha_enable(void); + +void ets_sha_disable(void); + +ets_status_t ets_sha_init(SHA_CTX *ctx, SHA_TYPE type); + +ets_status_t ets_sha_starts(SHA_CTX *ctx, uint16_t sha512_t); + +void ets_sha_get_state(SHA_CTX *ctx); + +void ets_sha_process(SHA_CTX *ctx, const unsigned char *input); + +void ets_sha_update(SHA_CTX *ctx, const unsigned char *input, uint32_t input_bytes, bool update_ctx); + +ets_status_t ets_sha_finish(SHA_CTX *ctx, unsigned char *output); + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_SHA_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/spi_flash.h b/components/esp_rom/include/esp32s2beta/rom/spi_flash.h new file mode 100644 index 0000000000..130e1cac7c --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/spi_flash.h @@ -0,0 +1,561 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _ROM_SPI_FLASH_H_ +#define _ROM_SPI_FLASH_H_ + +#include +#include + +#include "esp_attr.h" + +#include "soc/spi_mem_reg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup spi_flash_apis, spi flash operation related apis + * @brief spi_flash apis + */ + +/** @addtogroup spi_flash_apis + * @{ + */ + +/************************************************************* + * Note + ************************************************************* + * 1. ESP32 chip have 4 SPI slave/master, however, SPI0 is + * used as an SPI master to access Flash and ext-SRAM by + * Cache module. It will support Decryto read for Flash, + * read/write for ext-SRAM. And SPI1 is also used as an + * SPI master for Flash read/write and ext-SRAM read/write. + * It will support Encrypto write for Flash. + * 2. As an SPI master, SPI support Highest clock to 80M, + * however, Flash with 80M Clock should be configured + * for different Flash chips. If you want to use 80M + * clock We should use the SPI that is certified by + * Espressif. However, the certification is not started + * at the time, so please use 40M clock at the moment. + * 3. SPI Flash can use 2 lines or 4 lines mode. If you + * use 2 lines mode, you can save two pad SPIHD and + * SPIWP for gpio. ESP32 support configured SPI pad for + * Flash, the configuration is stored in efuse and flash. + * However, the configurations of pads should be certified + * by Espressif. If you use this function, please use 40M + * clock at the moment. + * 4. ESP32 support to use Common SPI command to configure + * Flash to QIO mode, if you failed to configure with fix + * command. With Common SPI Command, ESP32 can also provide + * a way to use same Common SPI command groups on different + * Flash chips. + * 5. This functions are not protected by packeting, Please use the + ************************************************************* + */ + +#define PERIPHS_SPI_FLASH_CMD SPI_MEM_CMD_REG(1) +#define PERIPHS_SPI_FLASH_ADDR SPI_MEM_ADDR_REG(1) +#define PERIPHS_SPI_FLASH_CTRL SPI_MEM_CTRL_REG(1) +#define PERIPHS_SPI_FLASH_CTRL1 SPI_MEM_CTRL1_REG(1) +#define PERIPHS_SPI_FLASH_STATUS SPI_MEM_RD_STATUS_REG(1) +#define PERIPHS_SPI_FLASH_USRREG SPI_MEM_USER_REG(1) +#define PERIPHS_SPI_FLASH_USRREG1 SPI_MEM_USER1_REG(1) +#define PERIPHS_SPI_FLASH_USRREG2 SPI_MEM_USER2_REG(1) +#define PERIPHS_SPI_FLASH_C0 SPI_MEM_W0_REG(1) +#define PERIPHS_SPI_FLASH_C1 SPI_MEM_W1_REG(1) +#define PERIPHS_SPI_FLASH_C2 SPI_MEM_W2_REG(1) +#define PERIPHS_SPI_FLASH_C3 SPI_MEM_W3_REG(1) +#define PERIPHS_SPI_FLASH_C4 SPI_MEM_W4_REG(1) +#define PERIPHS_SPI_FLASH_C5 SPI_MEM_W5_REG(1) +#define PERIPHS_SPI_FLASH_C6 SPI_MEM_W6_REG(1) +#define PERIPHS_SPI_FLASH_C7 SPI_MEM_W7_REG(1) +#define PERIPHS_SPI_FLASH_TX_CRC SPI_MEM_TX_CRC_REG(1) + +#define SPI0_R_QIO_DUMMY_CYCLELEN 3 +#define SPI0_R_QIO_ADDR_BITSLEN 31 +#define SPI0_R_FAST_DUMMY_CYCLELEN 7 +#define SPI0_R_DIO_DUMMY_CYCLELEN 3 +#define SPI0_R_FAST_ADDR_BITSLEN 23 +#define SPI0_R_SIO_ADDR_BITSLEN 23 + +#define SPI1_R_QIO_DUMMY_CYCLELEN 3 +#define SPI1_R_QIO_ADDR_BITSLEN 31 +#define SPI1_R_FAST_DUMMY_CYCLELEN 7 +#define SPI1_R_DIO_DUMMY_CYCLELEN 3 +#define SPI1_R_DIO_ADDR_BITSLEN 31 +#define SPI1_R_FAST_ADDR_BITSLEN 23 +#define SPI1_R_SIO_ADDR_BITSLEN 23 + +#define ESP_ROM_SPIFLASH_W_SIO_ADDR_BITSLEN 23 + +#define ESP_ROM_SPIFLASH_TWO_BYTE_STATUS_EN SPI_MEM_WRSR_2B + +//SPI address register +#define ESP_ROM_SPIFLASH_BYTES_LEN 24 +#define ESP_ROM_SPIFLASH_BUFF_BYTE_WRITE_NUM 32 +#define ESP_ROM_SPIFLASH_BUFF_BYTE_READ_NUM 64 +#define ESP_ROM_SPIFLASH_BUFF_BYTE_READ_BITS 0x3f + +//SPI status register +#define ESP_ROM_SPIFLASH_BUSY_FLAG BIT0 +#define ESP_ROM_SPIFLASH_WRENABLE_FLAG BIT1 +#define ESP_ROM_SPIFLASH_BP0 BIT2 +#define ESP_ROM_SPIFLASH_BP1 BIT3 +#define ESP_ROM_SPIFLASH_BP2 BIT4 +#define ESP_ROM_SPIFLASH_WR_PROTECT (ESP_ROM_SPIFLASH_BP0|ESP_ROM_SPIFLASH_BP1|ESP_ROM_SPIFLASH_BP2) +#define ESP_ROM_SPIFLASH_QE BIT9 + +#define FLASH_ID_GD25LQ32C 0xC86016 + +typedef enum { + ESP_ROM_SPIFLASH_QIO_MODE = 0, + ESP_ROM_SPIFLASH_QOUT_MODE, + ESP_ROM_SPIFLASH_DIO_MODE, + ESP_ROM_SPIFLASH_DOUT_MODE, + ESP_ROM_SPIFLASH_FASTRD_MODE, + ESP_ROM_SPIFLASH_SLOWRD_MODE +} esp_rom_spiflash_read_mode_t; + +typedef enum { + ESP_ROM_SPIFLASH_RESULT_OK, + ESP_ROM_SPIFLASH_RESULT_ERR, + ESP_ROM_SPIFLASH_RESULT_TIMEOUT +} esp_rom_spiflash_result_t; + +typedef struct { + uint32_t device_id; + uint32_t chip_size; // chip size in bytes + uint32_t block_size; + uint32_t sector_size; + uint32_t page_size; + uint32_t status_mask; +} esp_rom_spiflash_chip_t; + +typedef struct { + uint8_t data_length; + uint8_t read_cmd0; + uint8_t read_cmd1; + uint8_t write_cmd; + uint16_t data_mask; + uint16_t data; +} esp_rom_spiflash_common_cmd_t; + +/** + * @brief Fix the bug in SPI hardware communication with Flash/Ext-SRAM in High Speed. + * Please do not call this function in SDK. + * + * @param uint8_t spi: 0 for SPI0(Cache Access), 1 for SPI1(Flash read/write). + * + * @param uint8_t freqdiv: Pll is 80M, 4 for 20M, 3 for 26.7M, 2 for 40M, 1 for 80M. + * + * @return None + */ +void esp_rom_spiflash_fix_dummylen(uint8_t spi, uint8_t freqdiv); + +/** + * @brief Select SPI Flash to QIO mode when WP pad is read from Flash. + * Please do not call this function in SDK. + * + * @param uint8_t wp_gpio_num: WP gpio number. + * + * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping + * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd + * + * @return None + */ +void esp_rom_spiflash_select_qiomode(uint8_t wp_gpio_num, uint32_t ishspi); + +/** + * @brief Set SPI Flash pad drivers. + * Please do not call this function in SDK. + * + * @param uint8_t wp_gpio_num: WP gpio number. + * + * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping + * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd + * + * @param uint8_t *drvs: drvs[0]-bit[3:0] for cpiclk, bit[7:4] for spiq, drvs[1]-bit[3:0] for spid, drvs[1]-bit[7:4] for spid + * drvs[2]-bit[3:0] for spihd, drvs[2]-bit[7:4] for spiwp. + * Values usually read from falsh by rom code, function usually callde by rom code. + * if value with bit(3) set, the value is valid, bit[2:0] is the real value. + * + * @return None + */ +void esp_rom_spiflash_set_drvs(uint8_t wp_gpio_num, uint32_t ishspi, uint8_t *drvs); + +/** + * @brief Select SPI Flash function for pads. + * Please do not call this function in SDK. + * + * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping + * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd + * + * @return None + */ +void esp_rom_spiflash_select_padsfunc(uint32_t ishspi); + +/** + * @brief SPI Flash init, clock divisor is 4, use 1 line Slow read mode. + * Please do not call this function in SDK. + * + * @param uint32_t ishspi: 0 for spi, 1 for hspi, flash pad decided by strapping + * else, bit[5:0] spiclk, bit[11:6] spiq, bit[17:12] spid, bit[23:18] spics0, bit[29:24] spihd + * + * @param uint8_t legacy: In legacy mode, more SPI command is used in line. + * + * @return None + */ +void esp_rom_spiflash_attach(uint32_t ishspi, bool legacy); + +/** + * @brief SPI Read Flash status register. We use CMD 0x05 (RDSR). + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file. + * + * @param uint32_t *status : The pointer to which to return the Flash status value. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : read OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : read error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : read timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_read_status(esp_rom_spiflash_chip_t *spi, uint32_t *status); + +/** + * @brief SPI Read Flash status register bits 8-15. We use CMD 0x35 (RDSR2). + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file. + * + * @param uint32_t *status : The pointer to which to return the Flash status value. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : read OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : read error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : read timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_read_statushigh(esp_rom_spiflash_chip_t *spi, uint32_t *status); + +/** + * @brief Write status to Falsh status register. + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file. + * + * @param uint32_t status_value : Value to . + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : write OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : write error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : write timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_write_status(esp_rom_spiflash_chip_t *spi, uint32_t status_value); + +/** + * @brief Use a command to Read Flash status register. + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_chip_t *spi : The information for Flash, which is exported from ld file. + * + * @param uint32_t*status : The pointer to which to return the Flash status value. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : read OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : read error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : read timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_read_user_cmd(uint32_t *status, uint8_t cmd); + +/** + * @brief Config SPI Flash read mode when init. + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_read_mode_t mode : QIO/QOUT/DIO/DOUT/FastRD/SlowRD. + * + * This function does not try to set the QIO Enable bit in the status register, caller is responsible for this. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : config OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : config error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : config timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_config_readmode(esp_rom_spiflash_read_mode_t mode); + +/** + * @brief Config SPI Flash clock divisor. + * Please do not call this function in SDK. + * + * @param uint8_t freqdiv: clock divisor. + * + * @param uint8_t spi: 0 for SPI0, 1 for SPI1. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : config OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : config error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : config timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_config_clk(uint8_t freqdiv, uint8_t spi); + +/** + * @brief Send CommonCmd to Flash so that is can go into QIO mode, some Flash use different CMD. + * Please do not call this function in SDK. + * + * @param esp_rom_spiflash_common_cmd_t *cmd : A struct to show the action of a command. + * + * @return uint16_t 0 : do not send command any more. + * 1 : go to the next command. + * n > 1 : skip (n - 1) commands. + */ +uint16_t esp_rom_spiflash_common_cmd(esp_rom_spiflash_common_cmd_t *cmd); + +/** + * @brief Unlock SPI write protect. + * Please do not call this function in SDK. + * + * @param None. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Unlock OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Unlock error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Unlock timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_unlock(void); + +/** + * @brief SPI write protect. + * Please do not call this function in SDK. + * + * @param None. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Lock OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Lock error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Lock timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_lock(void); + +/** + * @brief Update SPI Flash parameter. + * Please do not call this function in SDK. + * + * @param uint32_t deviceId : Device ID read from SPI, the low 32 bit. + * + * @param uint32_t chip_size : The Flash size. + * + * @param uint32_t block_size : The Flash block size. + * + * @param uint32_t sector_size : The Flash sector size. + * + * @param uint32_t page_size : The Flash page size. + * + * @param uint32_t status_mask : The Mask used when read status from Flash(use single CMD). + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Update OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Update error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Update timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_config_param(uint32_t deviceId, uint32_t chip_size, uint32_t block_size, + uint32_t sector_size, uint32_t page_size, uint32_t status_mask); + +/** + * @brief Erase whole flash chip. + * Please do not call this function in SDK. + * + * @param None + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_erase_chip(void); + +/** + * @brief Erase a 64KB block of flash + * Uses SPI flash command D8H. + * Please do not call this function in SDK. + * + * @param uint32_t block_num : Which block to erase. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_erase_block(uint32_t block_num); + +/** + * @brief Erase a sector of flash. + * Uses SPI flash command 20H. + * Please do not call this function in SDK. + * + * @param uint32_t sector_num : Which sector to erase. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_erase_sector(uint32_t sector_num); + +/** + * @brief Erase some sectors. + * Please do not call this function in SDK. + * + * @param uint32_t start_addr : Start addr to erase, should be sector aligned. + * + * @param uint32_t area_len : Length to erase, should be sector aligned. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Erase OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Erase error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Erase timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_erase_area(uint32_t start_addr, uint32_t area_len); + +/** + * @brief Write Data to Flash, you should Erase it yourself if need. + * Please do not call this function in SDK. + * + * @param uint32_t dest_addr : Address to write, should be 4 bytes aligned. + * + * @param const uint32_t *src : The pointer to data which is to write. + * + * @param uint32_t len : Length to write, should be 4 bytes aligned. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Write OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Write error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Write timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_write(uint32_t dest_addr, const uint32_t *src, int32_t len); + +/** + * @brief Read Data from Flash, you should Erase it yourself if need. + * Please do not call this function in SDK. + * + * @param uint32_t src_addr : Address to read, should be 4 bytes aligned. + * + * @param uint32_t *dest : The buf to read the data. + * + * @param uint32_t len : Length to read, should be 4 bytes aligned. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Read OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Read error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Read timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_read(uint32_t src_addr, uint32_t *dest, int32_t len); + +/** + * @brief SPI1 go into encrypto mode. + * Please do not call this function in SDK. + * + * @param None + * + * @return None + */ +void esp_rom_spiflash_write_encrypted_enable(void); + +/** + * @brief Prepare 32 Bytes data to encrpto writing, you should Erase it yourself if need. + * Please do not call this function in SDK. + * + * @param uint32_t flash_addr : Address to write, should be 32 bytes aligned. + * + * @param uint32_t *data : The pointer to data which is to write. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Prepare OK. + * ESP_ROM_SPIFLASH_RESULT_ERR : Prepare error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Prepare timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_prepare_encrypted_data(uint32_t flash_addr, uint32_t *data); + +/** + * @brief SPI1 go out of encrypto mode. + * Please do not call this function in SDK. + * + * @param None + * + * @return None + */ +void esp_rom_spiflash_write_encrypted_disable(void); + +/** + * @brief Write data to flash with transparent encryption. + * @note Sectors to be written should already be erased. + * + * @note Please do not call this function in SDK. + * + * @param uint32_t flash_addr : Address to write, should be 32 byte aligned. + * + * @param uint32_t *data : The pointer to data to write. Note, this pointer must + * be 32 bit aligned and the content of the data will be + * modified by the encryption function. + * + * @param uint32_t len : Length to write, should be 32 bytes aligned. + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Data written successfully. + * ESP_ROM_SPIFLASH_RESULT_ERR : Encryption write error. + * ESP_ROM_SPIFLASH_RESULT_TIMEOUT : Encrypto write timeout. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_write_encrypted(uint32_t flash_addr, uint32_t *data, uint32_t len); + + +/* TODO: figure out how to map these to their new names */ +typedef enum { + SPI_ENCRYPT_DESTINATION_FLASH, + SPI_ENCRYPT_DESTINATION_PSRAM, +} SpiEncryptDest; + +typedef esp_rom_spiflash_result_t SpiFlashOpResult; + +SpiFlashOpResult SPI_Encrypt_Write(uint32_t flash_addr, const void* data, uint32_t len); +SpiFlashOpResult SPI_Encrypt_Write_Dest(SpiEncryptDest dest, uint32_t flash_addr, const void* data, uint32_t len); +void SPI_Write_Encrypt_Enable(void); +void SPI_Write_Encrypt_Disable(void); + +/** @brief Wait until SPI flash write operation is complete + * + * @note Please do not call this function in SDK. + * + * Reads the Write In Progress bit of the SPI flash status register, + * repeats until this bit is zero (indicating write complete). + * + * @return ESP_ROM_SPIFLASH_RESULT_OK : Write is complete + * ESP_ROM_SPIFLASH_RESULT_ERR : Error while reading status. + */ +esp_rom_spiflash_result_t esp_rom_spiflash_wait_idle(esp_rom_spiflash_chip_t *spi); + + +/** @brief Enable Quad I/O pin functions + * + * @note Please do not call this function in SDK. + * + * Sets the HD & WP pin functions for Quad I/O modes, based on the + * efuse SPI pin configuration. + * + * @param wp_gpio_num - Number of the WP pin to reconfigure for quad I/O. + * + * @param spiconfig - Pin configuration, as returned from ets_efuse_get_spiconfig(). + * - If this parameter is 0, default SPI pins are used and wp_gpio_num parameter is ignored. + * - If this parameter is 1, default HSPI pins are used and wp_gpio_num parameter is ignored. + * - For other values, this parameter encodes the HD pin number and also the CLK pin number. CLK pin selection is used + * to determine if HSPI or SPI peripheral will be used (use HSPI if CLK pin is the HSPI clock pin, otherwise use SPI). + * Both HD & WP pins are configured via GPIO matrix to map to the selected peripheral. + */ +void esp_rom_spiflash_select_qio_pins(uint8_t wp_gpio_num, uint32_t spiconfig); + +/** @brief Global esp_rom_spiflash_chip_t structure used by ROM functions + * + */ +extern esp_rom_spiflash_chip_t g_rom_flashchip; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_SPI_FLASH_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/tbconsole.h b/components/esp_rom/include/esp32s2beta/rom/tbconsole.h new file mode 100644 index 0000000000..d6ca069cc7 --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/tbconsole.h @@ -0,0 +1,27 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef _ROM_TBCONSOLE_H_ +#define _ROM_TBCONSOLE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +void start_tb_console(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_TBCONSOLE_H_ */ diff --git a/components/esp_rom/include/esp32s2beta/rom/tjpgd.h b/components/esp_rom/include/esp32s2beta/rom/tjpgd.h new file mode 100644 index 0000000000..31fbc97cce --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/tjpgd.h @@ -0,0 +1,99 @@ +/*----------------------------------------------------------------------------/ +/ TJpgDec - Tiny JPEG Decompressor include file (C)ChaN, 2012 +/----------------------------------------------------------------------------*/ +#ifndef _TJPGDEC +#define _TJPGDEC +/*---------------------------------------------------------------------------*/ +/* System Configurations */ + +#define JD_SZBUF 512 /* Size of stream input buffer */ +#define JD_FORMAT 0 /* Output pixel format 0:RGB888 (3 BYTE/pix), 1:RGB565 (1 WORD/pix) */ +#define JD_USE_SCALE 1 /* Use descaling feature for output */ +#define JD_TBLCLIP 1 /* Use table for saturation (might be a bit faster but increases 1K bytes of code size) */ + +/*---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* These types must be 16-bit, 32-bit or larger integer */ +typedef int INT; +typedef unsigned int UINT; + +/* These types must be 8-bit integer */ +typedef char CHAR; +typedef unsigned char UCHAR; +typedef unsigned char BYTE; + +/* These types must be 16-bit integer */ +typedef short SHORT; +typedef unsigned short USHORT; +typedef unsigned short WORD; +typedef unsigned short WCHAR; + +/* These types must be 32-bit integer */ +typedef long LONG; +typedef unsigned long ULONG; +typedef unsigned long DWORD; + + +/* Error code */ +typedef enum { + JDR_OK = 0, /* 0: Succeeded */ + JDR_INTR, /* 1: Interrupted by output function */ + JDR_INP, /* 2: Device error or wrong termination of input stream */ + JDR_MEM1, /* 3: Insufficient memory pool for the image */ + JDR_MEM2, /* 4: Insufficient stream input buffer */ + JDR_PAR, /* 5: Parameter error */ + JDR_FMT1, /* 6: Data format error (may be damaged data) */ + JDR_FMT2, /* 7: Right format but not supported */ + JDR_FMT3 /* 8: Not supported JPEG standard */ +} JRESULT; + + + +/* Rectangular structure */ +typedef struct { + WORD left, right, top, bottom; +} JRECT; + + + +/* Decompressor object structure */ +typedef struct JDEC JDEC; +struct JDEC { + UINT dctr; /* Number of bytes available in the input buffer */ + BYTE* dptr; /* Current data read ptr */ + BYTE* inbuf; /* Bit stream input buffer */ + BYTE dmsk; /* Current bit in the current read byte */ + BYTE scale; /* Output scaling ratio */ + BYTE msx, msy; /* MCU size in unit of block (width, height) */ + BYTE qtid[3]; /* Quantization table ID of each component */ + SHORT dcv[3]; /* Previous DC element of each component */ + WORD nrst; /* Restart inverval */ + UINT width, height; /* Size of the input image (pixel) */ + BYTE* huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */ + WORD* huffcode[2][2]; /* Huffman code word tables [id][dcac] */ + BYTE* huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */ + LONG* qttbl[4]; /* Dequaitizer tables [id] */ + void* workbuf; /* Working buffer for IDCT and RGB output */ + BYTE* mcubuf; /* Working buffer for the MCU */ + void* pool; /* Pointer to available memory pool */ + UINT sz_pool; /* Size of momory pool (bytes available) */ + UINT (*infunc)(JDEC*, BYTE*, UINT);/* Pointer to jpeg stream input function */ + void* device; /* Pointer to I/O device identifiler for the session */ +}; + + + +/* TJpgDec API functions */ +JRESULT jd_prepare (JDEC*, UINT(*)(JDEC*,BYTE*,UINT), void*, UINT, void*); +JRESULT jd_decomp (JDEC*, UINT(*)(JDEC*,void*,JRECT*), BYTE); + + +#ifdef __cplusplus +} +#endif + +#endif /* _TJPGDEC */ diff --git a/components/esp_rom/include/esp32s2beta/rom/uart.h b/components/esp_rom/include/esp32s2beta/rom/uart.h new file mode 100644 index 0000000000..d69354d3f0 --- /dev/null +++ b/components/esp_rom/include/esp32s2beta/rom/uart.h @@ -0,0 +1,414 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _ROM_UART_H_ +#define _ROM_UART_H_ + +#include "esp_types.h" +#include "esp_attr.h" +#include "ets_sys.h" +#include "soc/soc.h" +#include "soc/uart_reg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \defgroup uart_apis, uart configuration and communication related apis + * @brief uart apis + */ + +/** @addtogroup uart_apis + * @{ + */ + +#define RX_BUFF_SIZE 0x100 +#define TX_BUFF_SIZE 100 + +//uart int enalbe register ctrl bits +#define UART_RCV_INTEN BIT0 +#define UART_TRX_INTEN BIT1 +#define UART_LINE_STATUS_INTEN BIT2 + +//uart int identification ctrl bits +#define UART_INT_FLAG_MASK 0x0E + +//uart fifo ctrl bits +#define UART_CLR_RCV_FIFO BIT1 +#define UART_CLR_TRX_FIFO BIT2 +#define UART_RCVFIFO_TRG_LVL_BITS BIT6 + +//uart line control bits +#define UART_DIV_LATCH_ACCESS_BIT BIT7 + +//uart line status bits +#define UART_RCV_DATA_RDY_FLAG BIT0 +#define UART_RCV_OVER_FLOW_FLAG BIT1 +#define UART_RCV_PARITY_ERR_FLAG BIT2 +#define UART_RCV_FRAME_ERR_FLAG BIT3 +#define UART_BRK_INT_FLAG BIT4 +#define UART_TRX_FIFO_EMPTY_FLAG BIT5 +#define UART_TRX_ALL_EMPTY_FLAG BIT6 // include fifo and shift reg +#define UART_RCV_ERR_FLAG BIT7 + +//send and receive message frame head +#define FRAME_FLAG 0x7E + +typedef enum { + UART_LINE_STATUS_INT_FLAG = 0x06, + UART_RCV_FIFO_INT_FLAG = 0x04, + UART_RCV_TMOUT_INT_FLAG = 0x0C, + UART_TXBUFF_EMPTY_INT_FLAG = 0x02 +} UartIntType; //consider bit0 for int_flag + +typedef enum { + RCV_ONE_BYTE = 0x0, + RCV_FOUR_BYTE = 0x1, + RCV_EIGHT_BYTE = 0x2, + RCV_FOURTEEN_BYTE = 0x3 +} UartRcvFifoTrgLvl; + +typedef enum { + FIVE_BITS = 0x0, + SIX_BITS = 0x1, + SEVEN_BITS = 0x2, + EIGHT_BITS = 0x3 +} UartBitsNum4Char; + +typedef enum { + ONE_STOP_BIT = 1, + ONE_HALF_STOP_BIT = 2, + TWO_STOP_BIT = 3 +} UartStopBitsNum; + +typedef enum { + NONE_BITS = 0, + ODD_BITS = 2, + EVEN_BITS = 3 + +} UartParityMode; + +typedef enum { + STICK_PARITY_DIS = 0, + STICK_PARITY_EN = 2 +} UartExistParity; + +typedef enum { + BIT_RATE_9600 = 9600, + BIT_RATE_19200 = 19200, + BIT_RATE_38400 = 38400, + BIT_RATE_57600 = 57600, + BIT_RATE_115200 = 115200, + BIT_RATE_230400 = 230400, + BIT_RATE_460800 = 460800, + BIT_RATE_921600 = 921600 +} UartBautRate; + +typedef enum { + NONE_CTRL, + HARDWARE_CTRL, + XON_XOFF_CTRL +} UartFlowCtrl; + +typedef enum { + EMPTY, + UNDER_WRITE, + WRITE_OVER +} RcvMsgBuffState; + +typedef struct { + uint8_t *pRcvMsgBuff; + uint8_t *pWritePos; + uint8_t *pReadPos; + uint8_t TrigLvl; + RcvMsgBuffState BuffState; +} RcvMsgBuff; + +typedef struct { + uint32_t TrxBuffSize; + uint8_t *pTrxBuff; +} TrxMsgBuff; + +typedef enum { + BAUD_RATE_DET, + WAIT_SYNC_FRM, + SRCH_MSG_HEAD, + RCV_MSG_BODY, + RCV_ESC_CHAR, +} RcvMsgState; + +typedef struct { + UartBautRate baut_rate; + UartBitsNum4Char data_bits; + UartExistParity exist_parity; + UartParityMode parity; // chip size in byte + UartStopBitsNum stop_bits; + UartFlowCtrl flow_ctrl; + uint8_t buff_uart_no; //indicate which uart use tx/rx buffer + uint8_t tx_uart_no; + RcvMsgBuff rcv_buff; +// TrxMsgBuff trx_buff; + RcvMsgState rcv_state; + int received; +} UartDevice; + +/** + * @brief Init uart device struct value and reset uart0/uart1 rx. + * Please do not call this function in SDK. + * + * @param None + * + * @return None + */ +void uartAttach(void); + +/** + * @brief Init uart0 or uart1 for UART download booting mode. + * Please do not call this function in SDK. + * + * @param uint8_t uart_no : 0 for UART0, else for UART1. + * + * @param uint32_t clock : clock used by uart module, to adjust baudrate. + * + * @return None + */ +void Uart_Init(uint8_t uart_no, uint32_t clock); + +/** + * @brief Modify uart baudrate. + * This function will reset RX/TX fifo for uart. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @param uint32_t DivLatchValue : (clock << 4)/baudrate. + * + * @return None + */ +void uart_div_modify(uint8_t uart_no, uint32_t DivLatchValue); + +/** + * @brief Init uart0 or uart1 for UART download booting mode. + * Please do not call this function in SDK. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @param uint8_t is_sync : 0, only one UART module, easy to detect, wait until detected; + * 1, two UART modules, hard to detect, detect and return. + * + * @return None + */ +int uart_baudrate_detect(uint8_t uart_no, uint8_t is_sync); + +/** + * @brief Switch printf channel of uart_tx_one_char. + * Please do not call this function when printf. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @return None + */ +void uart_tx_switch(uint8_t uart_no); + +/** + * @brief Switch message exchange channel for UART download booting. + * Please do not call this function in SDK. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @return None + */ +void uart_buff_switch(uint8_t uart_no); + +/** + * @brief Output a char to printf channel, wait until fifo not full. + * + * @param None + * + * @return OK. + */ +STATUS uart_tx_one_char(uint8_t TxChar); + +/** + * @brief Output a char to message exchange channel, wait until fifo not full. + * Please do not call this function in SDK. + * + * @param None + * + * @return OK. + */ +STATUS uart_tx_one_char2(uint8_t TxChar); + +/** + * @brief Wait until uart tx full empty. + * + * @param uint8_t uart_no : 0 for UART0, 1 for UART1. + * + * @return None. + */ +void uart_tx_flush(uint8_t uart_no); + +/** + * @brief Wait until uart tx full empty and the last char send ok. + * + * @param uart_no : 0 for UART0, 1 for UART1, 2 for UART2 + * + * The function defined in ROM code has a bug, so we define the correct version + * here for compatibility. + */ +void uart_tx_wait_idle(uint8_t uart_no); + +/** + * @brief Get an input char from message channel. + * Please do not call this function in SDK. + * + * @param uint8_t *pRxChar : the pointer to store the char. + * + * @return OK for successful. + * FAIL for failed. + */ +STATUS uart_rx_one_char(uint8_t *pRxChar); + +/** + * @brief Get an input char from message channel, wait until successful. + * Please do not call this function in SDK. + * + * @param None + * + * @return char : input char value. + */ +char uart_rx_one_char_block(void); + +/** + * @brief Get an input string line from message channel. + * Please do not call this function in SDK. + * + * @param uint8_t *pString : the pointer to store the string. + * + * @param uint8_t MaxStrlen : the max string length, incude '\0'. + * + * @return OK. + */ +STATUS UartRxString(uint8_t *pString, uint8_t MaxStrlen); + +/** + * @brief Process uart recevied information in the interrupt handler. + * Please do not call this function in SDK. + * + * @param void *para : the message receive buffer. + * + * @return None + */ +void uart_rx_intr_handler(void *para); + +/** + * @brief Get an char from receive buffer. + * Please do not call this function in SDK. + * + * @param RcvMsgBuff *pRxBuff : the pointer to the struct that include receive buffer. + * + * @param uint8_t *pRxByte : the pointer to store the char. + * + * @return OK for successful. + * FAIL for failed. + */ +STATUS uart_rx_readbuff( RcvMsgBuff *pRxBuff, uint8_t *pRxByte); + +/** + * @brief Get all chars from receive buffer. + * Please do not call this function in SDK. + * + * @param uint8_t *pCmdLn : the pointer to store the string. + * + * @return OK for successful. + * FAIL for failed. + */ +STATUS UartGetCmdLn(uint8_t *pCmdLn); + +/** + * @brief Get uart configuration struct. + * Please do not call this function in SDK. + * + * @param None + * + * @return UartDevice * : uart configuration struct pointer. + */ +UartDevice *GetUartDevice(void); + +/** + * @brief Send an packet to download tool, with SLIP escaping. + * Please do not call this function in SDK. + * + * @param uint8_t *p : the pointer to output string. + * + * @param int len : the string length. + * + * @return None. + */ +void send_packet(uint8_t *p, int len); + +/** + * @brief Receive an packet from download tool, with SLIP escaping. + * Please do not call this function in SDK. + * + * @param uint8_t *p : the pointer to input string. + * + * @param int len : If string length > len, the string will be truncated. + * + * @param uint8_t is_sync : 0, only one UART module; + * 1, two UART modules. + * + * @return int : the length of the string. + */ +int recv_packet(uint8_t *p, int len, uint8_t is_sync); + +/** + * @brief Send an packet to download tool, with SLIP escaping. + * Please do not call this function in SDK. + * + * @param uint8_t *pData : the pointer to input string. + * + * @param uint16_t DataLen : the string length. + * + * @return OK for successful. + * FAIL for failed. + */ +STATUS SendMsg(uint8_t *pData, uint16_t DataLen); + +/** + * @brief Receive an packet from download tool, with SLIP escaping. + * Please do not call this function in SDK. + * + * @param uint8_t *pData : the pointer to input string. + * + * @param uint16_t MaxDataLen : If string length > MaxDataLen, the string will be truncated. + * + * @param uint8_t is_sync : 0, only one UART module; + * 1, two UART modules. + * + * @return OK for successful. + * FAIL for failed. + */ +STATUS RcvMsg(uint8_t *pData, uint16_t MaxDataLen, uint8_t is_sync); + +extern UartDevice UartDev; + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _ROM_UART_H_ */ diff --git a/components/esp_wifi/CMakeLists.txt b/components/esp_wifi/CMakeLists.txt index 1d239ed115..f852a2095a 100644 --- a/components/esp_wifi/CMakeLists.txt +++ b/components/esp_wifi/CMakeLists.txt @@ -1,6 +1,10 @@ idf_build_get_property(idf_target IDF_TARGET) -if(NOT CONFIG_ESP32_NO_BLOBS) +if(CONFIG_ESP32_NO_BLOBS OR CONFIG_ESP32S2_NO_BLOBS) + set(link_binary_libs 0) + set(ldfragments) +else() + set(link_binary_libs 1) set(ldfragments "linker.lf") endif() @@ -18,8 +22,21 @@ idf_component_register(SRCS "src/coexist.c" idf_build_get_property(build_dir BUILD_DIR) target_link_libraries(${COMPONENT_LIB} PUBLIC "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib_${idf_target}") -if(NOT CONFIG_ESP32_NO_BLOBS) - set(blobs coexist core espnow mesh net80211 phy pp rtc smartconfig) +if(link_binary_libs) + if(CONFIG_IDF_TARGET_ESP32) + set(phy phy) + elseif(CONFIG_IDF_TARGET_ESP32S2BETA) + # TODO: remove once final S2 chip is supported + if(CONFIG_ESP32S2_BETA_VERSION_A) + set(phy phyA) + elseif(CONFIG_ESP32S2_BETA_VERSION_B) + set(phy phyB) + elseif(CONFIG_ESP32S2_BETA_VERSION_MARLIN3) + set(phy phy_marlin3) + endif() + endif() + set(blobs coexist core espnow mesh net80211 pp rtc smartconfig ${phy}) + foreach(blob ${blobs}) add_library(${blob} STATIC IMPORTED) set_property(TARGET ${blob} PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib_${idf_target}/lib${blob}.a) @@ -55,5 +72,16 @@ if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION) add_custom_target(phy_init_data ALL DEPENDS ${phy_init_data_bin}) add_dependencies(flash phy_init_data) - esptool_py_flash_project_args(phy ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT) + # ToDo: remove once MP chip is supported + if(CONFIG_IDF_TARGET_ESP32) + esptool_py_flash_project_args(phy ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT) + elseif(CONFIG_IDF_TARGET_ESP32S2BETA) + if(CONFIG_ESP32S2BETA_VERSION_A) + esptool_py_flash_project_args(phyA ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT) + elseif(CONFIG_ESP32S2BETA_VERSION_B) + esptool_py_flash_project_args(phyB ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT) + elseif(CONFIG_ESP32S2BETA_VERSION_MARLIN3) + esptool_py_flash_project_args(phy_marlin3 ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT) + endif() + endif() endif() diff --git a/components/esp_wifi/Kconfig b/components/esp_wifi/Kconfig index 2b19873cbb..4f60d8228e 100644 --- a/components/esp_wifi/Kconfig +++ b/components/esp_wifi/Kconfig @@ -321,6 +321,8 @@ endmenu # Wi-Fi menu "PHY" config ESP32_PHY_CALIBRATION_AND_DATA_STORAGE + # ToDo: remove once NVS and PHY partial calibration are supported + depends on IDF_TARGET_ESP32 bool "Store phy calibration data in NVS" default y help diff --git a/components/esp_wifi/esp32s2beta/include/phy_init_data.h b/components/esp_wifi/esp32s2beta/include/phy_init_data.h new file mode 100644 index 0000000000..57ea2faa2d --- /dev/null +++ b/components/esp_wifi/esp32s2beta/include/phy_init_data.h @@ -0,0 +1,148 @@ +// Copyright 2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef PHY_INIT_DATA_H +#define PHY_INIT_DATA_H /* don't use #pragma once here, we compile this file sometimes */ +#include "esp_phy_init.h" +#include "sdkconfig.h" + +// constrain a value between 'low' and 'high', inclusive +#define LIMIT(val, low, high) ((val < low) ? low : (val > high) ? high : val) + +#define PHY_INIT_MAGIC "PHYINIT" + +// define the lowest tx power as LOWEST_PHY_TX_POWER +#define PHY_TX_POWER_LOWEST LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 52) +#define PHY_TX_POWER_OFFSET 44 +#define PHY_TX_POWER_NUM 5 + +static const char phy_init_magic_pre[] = PHY_INIT_MAGIC; + +/** + * @brief Structure containing default recommended PHY initialization parameters. + */ +static const esp_phy_init_data_t phy_init_data= { { + 3, + 0, + 0x04, + 0x05, + 0x04, + 0x05, + 0x05, + 0x04, + 0x06, + 0x06, + 0x06, + 0x05, + 0x06, + 0x00, + 0x00, + 0x00, + 0x00, + 0x05, + 0x09, + 0x06, + 0x05, + 0x03, + 0x06, + 0x05, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0xf4, + 0xf8, + 0xf8, + 0xf0, + 0xf0, + 0xf0, + 0xe0, + 0xe0, + 0xe0, + 0x18, + 0x18, + 0x18, + LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 78), + LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 72), + LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 66), + LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 60), + LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 56), + LIMIT(CONFIG_ESP32_PHY_MAX_TX_POWER * 4, 0, 52), + 0, + 1, + 1, + 2, + 2, + 3, + 4, + 5, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +} }; + +static const char phy_init_magic_post[] = PHY_INIT_MAGIC; + +#endif /* PHY_INIT_DATA_H */ + diff --git a/components/esp_wifi/include/esp_private/wifi_os_adapter.h b/components/esp_wifi/include/esp_private/wifi_os_adapter.h index 89422c51c6..820399c903 100644 --- a/components/esp_wifi/include/esp_private/wifi_os_adapter.h +++ b/components/esp_wifi/include/esp_private/wifi_os_adapter.h @@ -103,6 +103,9 @@ typedef struct { int32_t (* _get_random)(uint8_t *buf, size_t len); int32_t (* _get_time)(void *t); unsigned long (* _random)(void); +#if CONFIG_IDF_TARGET_ESP32S2BETA + uint32_t (* _slowclk_cal_get)(void); +#endif void (* _log_write)(uint32_t level, const char* tag, const char* format, ...); uint32_t (* _log_timestamp)(void); void * (* _malloc_internal)(size_t size); diff --git a/components/esp_wifi/include/esp_wifi_types.h b/components/esp_wifi/include/esp_wifi_types.h index f18582b879..ad29f93bdd 100644 --- a/components/esp_wifi/include/esp_wifi_types.h +++ b/components/esp_wifi/include/esp_wifi_types.h @@ -314,7 +314,11 @@ typedef struct { unsigned stbc:2; /**< Space Time Block Code(STBC). 0: non STBC packet; 1: STBC packet */ unsigned fec_coding:1; /**< Flag is set for 11n packets which are LDPC */ unsigned sgi:1; /**< Short Guide Interval(SGI). 0: Long GI; 1: Short GI */ +#if CONFIG_IDF_TARGET_ESP32 signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: 0.25dBm*/ +#elif CONFIG_IDF_TARGET_ESP32S2BETA + unsigned :8; +#endif unsigned ampdu_cnt:8; /**< ampdu cnt */ unsigned channel:4; /**< primary channel on which this packet is received */ unsigned secondary_channel:4; /**< secondary channel on which this packet is received. 0: none; 1: above; 2: below */ @@ -323,6 +327,10 @@ typedef struct { unsigned :32; /**< reserve */ unsigned :31; /**< reserve */ unsigned ant:1; /**< antenna number from which this packet is received. 0: WiFi antenna 0; 1: WiFi antenna 1 */ +#if CONFIG_IDF_TARGET_ESP32S2BETA + signed noise_floor:8; /**< noise floor of Radio Frequency Module(RF). unit: 0.25dBm*/ + unsigned :24; +#endif unsigned sig_len:12; /**< length of packet including Frame Check Sequence(FCS) */ unsigned :12; /**< reserve */ unsigned rx_state:8; /**< state of the packet. 0: no error; others: error numbers which are not public */ diff --git a/components/esp_wifi/include/phy.h b/components/esp_wifi/include/phy.h index 1ee3f37dc5..b101200411 100644 --- a/components/esp_wifi/include/phy.h +++ b/components/esp_wifi/include/phy.h @@ -59,6 +59,13 @@ void phy_set_wifi_mode_only(bool wifi_only); */ void coex_bt_high_prio(void); +#if CONFIG_IDF_TARGET_ESP32S2BETA +/** + * @brief Open PHY and RF. + */ +void phy_wakeup_init(void); +#endif + /** * @brief Shutdown PHY and RF. */ diff --git a/components/esp_wifi/lib_esp32 b/components/esp_wifi/lib_esp32 index 1068594fee..1d830bc243 160000 --- a/components/esp_wifi/lib_esp32 +++ b/components/esp_wifi/lib_esp32 @@ -1 +1 @@ -Subproject commit 1068594fee5fd8a73b353c4e77ff3b44d111393d +Subproject commit 1d830bc2433b6e166d23329c612db6b86aabc59b diff --git a/components/esp_wifi/lib_esp32s2beta b/components/esp_wifi/lib_esp32s2beta new file mode 160000 index 0000000000..8ea1c65125 --- /dev/null +++ b/components/esp_wifi/lib_esp32s2beta @@ -0,0 +1 @@ +Subproject commit 8ea1c651254560c59f816c9d16aa71322dcd15e5 diff --git a/components/esp_wifi/src/phy_init.c b/components/esp_wifi/src/phy_init.c index ae8da2f5dd..76d7a0eb8d 100644 --- a/components/esp_wifi/src/phy_init.c +++ b/components/esp_wifi/src/phy_init.c @@ -16,13 +16,10 @@ #include #include #include - #include -#include "esp32/rom/ets_sys.h" -#include "esp32/rom/rtc.h" #include "soc/rtc.h" - +#include "soc/dport_reg.h" #include "esp_err.h" #include "esp_phy_init.h" #include "esp_system.h" @@ -30,7 +27,6 @@ #include "nvs.h" #include "nvs_flash.h" #include "sdkconfig.h" - #include "freertos/FreeRTOS.h" #include "freertos/portmacro.h" #include "phy.h" @@ -39,7 +35,17 @@ #include "driver/periph_ctrl.h" #include "esp_private/wifi.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/ets_sys.h" +#include "esp32/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/rtc.h" +#endif + +#if CONFIG_IDF_TARGET_ESP32 extern wifi_mac_time_update_cb_t s_wifi_mac_time_update_cb; +#endif static const char* TAG = "phy_init"; @@ -64,8 +70,10 @@ static volatile bool s_is_modem_sleep_en = false; static _lock_t s_modem_sleep_lock; +#if CONFIG_IDF_TARGET_ESP32 /* time stamp updated when the PHY/RF is turned on */ static int64_t s_phy_rf_en_ts = 0; +#endif uint32_t IRAM_ATTR phy_enter_critical(void) { @@ -77,6 +85,7 @@ void IRAM_ATTR phy_exit_critical(uint32_t level) portEXIT_CRITICAL_NESTED(level); } +#if CONFIG_IDF_TARGET_ESP32 int64_t esp_phy_rf_get_on_ts(void) { return s_phy_rf_en_ts; @@ -99,8 +108,9 @@ static inline void phy_update_wifi_mac_time(bool en_clock_stopped, int64_t now) } } } +#endif -esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibration_mode_t mode, +esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibration_mode_t mode, esp_phy_calibration_data_t* calibration_data, phy_rf_module_t module) { /* 3 modules may call phy_init: Wi-Fi, BT, Modem Sleep */ @@ -123,9 +133,9 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat } else { /* If Wi-Fi, BT all disabled, modem sleep should not take effect; - * If either Wi-Fi or BT is enabled, should allow modem sleep requires + * If either Wi-Fi or BT is enabled, should allow modem sleep requires * to enter sleep; - * If Wi-Fi, BT co-exist, it is disallowed that only one module + * If Wi-Fi, BT co-exist, it is disallowed that only one module * support modem sleep, E,g. BT support modem sleep but Wi-Fi not * support modem sleep; */ @@ -143,14 +153,22 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat } } if (s_is_phy_rf_en == true){ +#if CONFIG_IDF_TARGET_ESP32 // Update time stamp s_phy_rf_en_ts = esp_timer_get_time(); // Update WiFi MAC time before WiFi/BT common clock is enabled phy_update_wifi_mac_time(false, s_phy_rf_en_ts); +#endif // Enable WiFi/BT common peripheral clock periph_module_enable(PERIPH_WIFI_BT_COMMON_MODULE); phy_set_wifi_mode_only(0); +#if CONFIG_IDF_TARGET_ESP32S2BETA + if (module == PHY_MODEM_MODULE) { + phy_wakeup_init(); + } + else +#endif if (ESP_CAL_DATA_CHECK_FAIL == register_chipv7_phy(init_data, calibration_data, mode)) { ESP_LOGW(TAG, "saving new calibration data because of checksum failure, mode(%d)", mode); #ifdef CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE @@ -160,7 +178,9 @@ esp_err_t esp_phy_rf_init(const esp_phy_init_data_t* init_data, esp_phy_calibrat #endif } +#if CONFIG_IDF_TARGET_ESP32 coex_bt_high_prio(); +#endif } } @@ -230,8 +250,10 @@ esp_err_t esp_phy_rf_deinit(phy_rf_module_t module) if (s_is_phy_rf_en == false) { // Disable PHY and RF. phy_close_rf(); +#if CONFIG_IDF_TARGET_ESP32 // Update WiFi MAC time before disalbe WiFi/BT common peripheral clock phy_update_wifi_mac_time(true, esp_timer_get_time()); +#endif // Disable WiFi/BT common peripheral clock. Do not disable clock for hardware RNG periph_module_disable(PERIPH_WIFI_BT_COMMON_MODULE); } @@ -577,18 +599,19 @@ static esp_err_t store_cal_data_to_nvs_handle(nvs_handle_t handle, if (err != ESP_OK) { ESP_LOGE(TAG, "%s: store calibration nvs commit failed(0x%x)\n", __func__, err); } - + return err; } #if CONFIG_ESP32_REDUCE_PHY_TX_POWER -static void esp_phy_reduce_tx_power(esp_phy_init_data_t* init_data) +// TODO: fix the esp_phy_reduce_tx_power unused warning for esp32s2beta - IDF-759 +static void __attribute((unused)) esp_phy_reduce_tx_power(esp_phy_init_data_t* init_data) { uint8_t i; - + for(i = 0; i < PHY_TX_POWER_NUM; i++) { // LOWEST_PHY_TX_POWER is the lowest tx power - init_data->params[PHY_TX_POWER_OFFSET+i] = PHY_TX_POWER_LOWEST; + init_data->params[PHY_TX_POWER_OFFSET+i] = PHY_TX_POWER_LOWEST; } } #endif @@ -616,9 +639,12 @@ void esp_phy_load_cal_and_init(phy_rf_module_t module) } memcpy(init_data, phy_init_data, sizeof(esp_phy_init_data_t)); +#if CONFIG_IDF_TARGET_ESP32 + // ToDo: remove once esp_reset_reason is supported on esp32s2 if (esp_reset_reason() == ESP_RST_BROWNOUT) { esp_phy_reduce_tx_power(init_data); } +#endif #else const esp_phy_init_data_t* init_data = esp_phy_get_init_data(); if (init_data == NULL) { diff --git a/components/esp_wifi/src/wifi_init.c b/components/esp_wifi/src/wifi_init.c index 5082a77e48..d08cea3bb5 100644 --- a/components/esp_wifi/src/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -34,8 +34,10 @@ ESP_EVENT_DEFINE_BASE(WIFI_EVENT); static esp_pm_lock_handle_t s_wifi_modem_sleep_lock; #endif +#if CONFIG_IDF_TARGET_ESP32 /* Callback function to update WiFi MAC time */ wifi_mac_time_update_cb_t s_wifi_mac_time_update_cb = NULL; +#endif static const char* TAG = "wifi_init"; @@ -114,7 +116,9 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config) esp_err_t result = esp_wifi_init_internal(config); if (result == ESP_OK) { esp_wifi_set_debug_log(); +#if CONFIG_IDF_TARGET_ESP32 s_wifi_mac_time_update_cb = esp_wifi_internal_update_mac_time; +#endif result = esp_supplicant_init(); if (result != ESP_OK) { diff --git a/components/esp_wifi/test/CMakeLists.txt b/components/esp_wifi/test/CMakeLists.txt index e7cf4b12c8..049a1ec682 100644 --- a/components/esp_wifi/test/CMakeLists.txt +++ b/components/esp_wifi/test/CMakeLists.txt @@ -1,6 +1,12 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}" - REQUIRES unity test_utils nvs_flash ulp esp_common) +set(srcdirs ".") +if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcdirs "esp32") +endif() + +idf_component_register(SRC_DIRS ${srcdirs} + INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR} + REQUIRES unity test_utils nvs_flash ulp esp_common + ) idf_component_get_property(esp_wifi_dir esp_wifi COMPONENT_DIR) diff --git a/components/esp_wifi/test/component.mk b/components/esp_wifi/test/component.mk index 7dbb988dd0..3c4a6bb67a 100644 --- a/components/esp_wifi/test/component.mk +++ b/components/esp_wifi/test/component.mk @@ -5,6 +5,7 @@ COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive COMPONENT_SRCDIRS := . +COMPONENT_SRCDIRS += esp32 # Calculate MD5 value of header file esp_wifi_os_adapter.h WIFI_OS_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp_wifi/include/esp_private/wifi_os_adapter.h | cut -c 1-7)\" diff --git a/components/esp_wifi/test/test_phy_rtc.c b/components/esp_wifi/test/esp32/test_phy_rtc.c similarity index 94% rename from components/esp_wifi/test/test_phy_rtc.c rename to components/esp_wifi/test/esp32/test_phy_rtc.c index 133a62c355..9bbe9544a5 100644 --- a/components/esp_wifi/test/test_phy_rtc.c +++ b/components/esp_wifi/test/esp32/test_phy_rtc.c @@ -11,18 +11,23 @@ #include #include #include +#include "soc/soc_caps.h" //Function just extern, need not test +#ifdef SOC_BT_SUPPORTED extern void bt_bb_init_cmplx(void); +#endif extern void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu(void); extern void IRAM_ATTR spi_flash_enable_interrupts_caches_and_other_cpu(void); //Functions in librtc.a called by WIFI or Blutooth directly in ISR +#ifdef SOC_BT_SUPPORTED extern void bt_bb_init_cmplx_reg(void); +extern void bt_track_pll_cap(void); +#endif extern void force_wifi_mode(int); extern void unforce_wifi_mode(void); -extern void bt_track_pll_cap(void); static const char* TAG = "test_phy_rtc"; @@ -39,7 +44,9 @@ static void test_phy_rtc_init(void) } TEST_ESP_OK(ret); +#ifdef SOC_BT_SUPPORTED esp_phy_load_cal_and_init(PHY_BT_MODULE); +#endif esp_phy_load_cal_and_init(PHY_WIFI_MODULE); //must run here, not blocking in above code @@ -51,11 +58,6 @@ static IRAM_ATTR void test_phy_rtc_cache_task(void *arg) { test_phy_rtc_init(); - ESP_LOGI(TAG, "Test bt_bb_init_cmplx_reg()..."); - spi_flash_disable_interrupts_caches_and_other_cpu(); - bt_bb_init_cmplx_reg(); - spi_flash_enable_interrupts_caches_and_other_cpu(); - for (int i = 0; i < 2; i++) { ESP_LOGI(TAG, "Test force_wifi_mode(%d)...", i); spi_flash_disable_interrupts_caches_and_other_cpu(); @@ -68,10 +70,17 @@ static IRAM_ATTR void test_phy_rtc_cache_task(void *arg) spi_flash_enable_interrupts_caches_and_other_cpu(); } +#ifdef SOC_BT_SUPPORTED + ESP_LOGI(TAG, "Test bt_bb_init_cmplx_reg()..."); + spi_flash_disable_interrupts_caches_and_other_cpu(); + bt_bb_init_cmplx_reg(); + spi_flash_enable_interrupts_caches_and_other_cpu(); + ESP_LOGI(TAG, "Test bt_track_pll_cap()..."); spi_flash_disable_interrupts_caches_and_other_cpu(); bt_track_pll_cap(); spi_flash_enable_interrupts_caches_and_other_cpu(); +#endif TEST_ASSERT( xSemaphoreGive(semphr_done) ); diff --git a/components/esp_wifi/test/test_wifi.c b/components/esp_wifi/test/esp32/test_wifi.c similarity index 99% rename from components/esp_wifi/test/test_wifi.c rename to components/esp_wifi/test/esp32/test_wifi.c index b3d950e08e..89b94ac5cb 100644 --- a/components/esp_wifi/test/test_wifi.c +++ b/components/esp_wifi/test/esp32/test_wifi.c @@ -134,7 +134,7 @@ TEST_CASE("wifi stop and deinit","[wifi]") .password = DEFAULT_PWD }, }; - + //init nvs ESP_LOGI(TAG, EMPH_STR("nvs_flash_init")); esp_err_t r = nvs_flash_init(); @@ -142,15 +142,16 @@ TEST_CASE("wifi stop and deinit","[wifi]") ESP_LOGI(TAG, EMPH_STR("no free pages or nvs version mismatch, erase..")); TEST_ESP_OK(nvs_flash_erase()); r = nvs_flash_init(); - } + } TEST_ESP_OK(r); //init tcpip ESP_LOGI(TAG, EMPH_STR("tcpip_adapter_init")); tcpip_adapter_init(); //init event loop + ESP_LOGI(TAG, EMPH_STR("event_init")); event_init(); - + ESP_LOGI(TAG, "test wifi init & deinit..."); test_wifi_init_deinit(&cfg, &wifi_config); ESP_LOGI(TAG, "wifi init & deinit seem to be OK."); diff --git a/components/espcoredump/linker.lf b/components/espcoredump/linker.lf index 17470b53a1..96a6dd259f 100644 --- a/components/espcoredump/linker.lf +++ b/components/espcoredump/linker.lf @@ -1,7 +1,7 @@ [mapping:espcoredump] archive: libespcoredump.a entries: - if ESP32_PANIC_HANDLER_IRAM = y: + if ESP_PANIC_HANDLER_IRAM = y: core_dump_uart (noflash_text) core_dump_flash (noflash_text) core_dump_common (noflash_text) @@ -12,7 +12,7 @@ entries: [mapping:spi_flash_override] archive: libspi_flash.a entries: - if ESP32_PANIC_HANDLER_IRAM = y && ESP32_ENABLE_COREDUMP_TO_FLASH = y: + if ESP_PANIC_HANDLER_IRAM = y && ESP32_ENABLE_COREDUMP_TO_FLASH = y: esp_flash_api (noflash_text) esp_flash_spi_init (noflash_text) else: diff --git a/components/espcoredump/src/core_dump_uart.c b/components/espcoredump/src/core_dump_uart.c index 2a2aa2d5fa..0c89ca6c6e 100644 --- a/components/espcoredump/src/core_dump_uart.c +++ b/components/espcoredump/src/core_dump_uart.c @@ -15,8 +15,12 @@ #include "soc/uart_periph.h" #include "soc/gpio_periph.h" #include "driver/gpio.h" -#include "esp32/clk.h" #include "esp_core_dump_priv.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/clk.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/clk.h" +#endif const static DRAM_ATTR char TAG[] __attribute__((unused)) = "esp_core_dump_uart"; diff --git a/components/esptool_py/esptool b/components/esptool_py/esptool index de30f21a22..f04d34bcab 160000 --- a/components/esptool_py/esptool +++ b/components/esptool_py/esptool @@ -1 +1 @@ -Subproject commit de30f21a222ec62f5a023dd955439b4f57702768 +Subproject commit f04d34bcab29ace798d2d3800ba87020cccbbfdd diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index f319d981c8..b1297f1a1a 100644 --- a/components/esptool_py/project_include.cmake +++ b/components/esptool_py/project_include.cmake @@ -2,7 +2,7 @@ # # Many of these are read when generating flash_app_args & flash_project_args idf_build_get_property(python PYTHON) -set(ESPTOOLPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/esptool.py" --chip esp32) +set(ESPTOOLPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/esptool.py" --chip ${IDF_TARGET}) set(ESPSECUREPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/espsecure.py") set(ESPEFUSEPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/espefuse.py") diff --git a/components/fatfs/CMakeLists.txt b/components/fatfs/CMakeLists.txt index 2cd91bf005..b5f3af8de5 100644 --- a/components/fatfs/CMakeLists.txt +++ b/components/fatfs/CMakeLists.txt @@ -1,12 +1,18 @@ -idf_component_register(SRCS "diskio/diskio.c" - "diskio/diskio_rawflash.c" - "diskio/diskio_sdmmc.c" - "diskio/diskio_wl.c" - "src/ff.c" - "port/freertos/ffsystem.c" - "src/ffunicode.c" - "vfs/vfs_fat.c" - "vfs/vfs_fat_sdmmc.c" - "vfs/vfs_fat_spiflash.c" - INCLUDE_DIRS diskio vfs src - REQUIRES wear_levelling sdmmc) +set(srcs "diskio/diskio.c" + "diskio/diskio_rawflash.c" + "diskio/diskio_sdmmc.c" + "diskio/diskio_wl.c" + "src/ff.c" + "port/freertos/ffsystem.c" + "src/ffunicode.c" + "vfs/vfs_fat.c" + "vfs/vfs_fat_spiflash.c") + +if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcs "vfs/vfs_fat_sdmmc.c") +endif() + +idf_component_register(SRCS ${srcs} + INCLUDE_DIRS diskio vfs src + REQUIRES wear_levelling sdmmc + ) diff --git a/components/fatfs/test/CMakeLists.txt b/components/fatfs/test/CMakeLists.txt index 2796e95eb4..c3596a0f4c 100644 --- a/components/fatfs/test/CMakeLists.txt +++ b/components/fatfs/test/CMakeLists.txt @@ -1,4 +1,10 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." - REQUIRES unity test_utils vfs fatfs - EMBED_TXTFILES fatfs.img) \ No newline at end of file +set(srcdirs ".") +if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcdirs "esp32") +endif() + +idf_component_register(SRC_DIRS ${src_dirs} + INCLUDE_DIRS . + REQUIRES unity test_utils vfs fatfs + EMBED_TXTFILES fatfs.img + ) \ No newline at end of file diff --git a/components/fatfs/test/component.mk b/components/fatfs/test/component.mk index c7e0582205..4278d928c1 100644 --- a/components/fatfs/test/component.mk +++ b/components/fatfs/test/component.mk @@ -1,2 +1,3 @@ COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive COMPONENT_EMBED_TXTFILES := fatfs.img +COMPONENT_SRCDIRS += esp32 diff --git a/components/fatfs/test/test_fatfs_sdmmc.c b/components/fatfs/test/esp32/test_fatfs_sdmmc.c similarity index 99% rename from components/fatfs/test/test_fatfs_sdmmc.c rename to components/fatfs/test/esp32/test_fatfs_sdmmc.c index 50e1eb5a08..d1d5e369fc 100644 --- a/components/fatfs/test/test_fatfs_sdmmc.c +++ b/components/fatfs/test/esp32/test_fatfs_sdmmc.c @@ -29,7 +29,7 @@ #include "driver/sdmmc_defs.h" #include "sdmmc_cmd.h" #include "ff.h" -#include "test_fatfs_common.h" +#include "../test_fatfs_common.h" static void test_setup(void) diff --git a/components/fatfs/test_fatfs_host/Makefile b/components/fatfs/test_fatfs_host/Makefile index 3d17e5ac1a..2e63322c04 100644 --- a/components/fatfs/test_fatfs_host/Makefile +++ b/components/fatfs/test_fatfs_host/Makefile @@ -58,13 +58,13 @@ OBJ_FILES := $(addprefix $(BUILD_DIR)/, $(filter %.o, $(notdir $(SOURCE_FILES:.c define COMPILE_C $(call CTARGET, ${1}, $(BUILD_DIR)) : ${1} $(SDKCONFIG) - mkdir -p $(BUILD_DIR) + mkdir -p $(BUILD_DIR) $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $(call CTARGET, ${1}, $(BUILD_DIR)) ${1} endef define COMPILE_CPP $(call CPPTARGET, ${1}, $(BUILD_DIR)) : ${1} $(SDKCONFIG) - mkdir -p $(BUILD_DIR) + mkdir -p $(BUILD_DIR) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $(call CPPTARGET, ${1}, $(BUILD_DIR)) ${1} endef @@ -85,7 +85,7 @@ TEST_SOURCE_FILES = \ TEST_OBJ_FILES = $(filter %.o, $(TEST_SOURCE_FILES:.cpp=.o) $(TEST_SOURCE_FILES:.c=.o)) $(TEST_PROGRAM): lib $(TEST_OBJ_FILES) $(WEAR_LEVELLING_BUILD_DIR)/$(WEAR_LEVELLING_LIB) $(SPI_FLASH_SIM_BUILD_DIR)/$(SPI_FLASH_SIM_LIB) $(STUBS_LIB_BUILD_DIR)/$(STUBS_LIB) partition_table.bin $(SDKCONFIG) - g++ $(LDFLAGS) $(CXXFLAGS) -o $@ $(TEST_OBJ_FILES) -L$(BUILD_DIR) -l:$(COMPONENT_LIB) -L$(WEAR_LEVELLING_BUILD_DIR) -l:$(WEAR_LEVELLING_LIB) -L$(SPI_FLASH_SIM_BUILD_DIR) -l:$(SPI_FLASH_SIM_LIB) -L$(STUBS_LIB_BUILD_DIR) -l:$(STUBS_LIB) + g++ $(LDFLAGS) $(CXXFLAGS) -o $@ $(TEST_OBJ_FILES) -L$(BUILD_DIR) -l:$(COMPONENT_LIB) -L$(WEAR_LEVELLING_BUILD_DIR) -l:$(WEAR_LEVELLING_LIB) -L$(SPI_FLASH_SIM_BUILD_DIR) -l:$(SPI_FLASH_SIM_LIB) -L$(STUBS_LIB_BUILD_DIR) -l:$(STUBS_LIB) test: $(TEST_PROGRAM) ./$(TEST_PROGRAM) diff --git a/components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h b/components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h index 05ff65a5cc..1c08df4ae4 100644 --- a/components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h +++ b/components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h @@ -1,5 +1,5 @@ # pragma once - +#define CONFIG_IDF_TARGET_ESP32 1 #define CONFIG_WL_SECTOR_SIZE 4096 #define CONFIG_LOG_DEFAULT_LEVEL 3 #define CONFIG_PARTITION_TABLE_OFFSET 0x8000 diff --git a/components/fatfs/vfs/esp_vfs_fat.h b/components/fatfs/vfs/esp_vfs_fat.h index 906d8b79bb..01a4c70d12 100644 --- a/components/fatfs/vfs/esp_vfs_fat.h +++ b/components/fatfs/vfs/esp_vfs_fat.h @@ -17,7 +17,6 @@ #include "esp_err.h" #include "driver/gpio.h" #include "driver/sdmmc_types.h" -#include "driver/sdmmc_host.h" #include "driver/sdspi_host.h" #include "ff.h" #include "wear_levelling.h" diff --git a/components/freemodbus/port/porttimer.c b/components/freemodbus/port/porttimer.c index 709031d660..4898e0ca05 100644 --- a/components/freemodbus/port/porttimer.c +++ b/components/freemodbus/port/porttimer.c @@ -45,10 +45,10 @@ #include "port.h" /* ----------------------- Modbus includes ----------------------------------*/ +#include "sdkconfig.h" #include "mb.h" #include "mbport.h" #include "driver/timer.h" -#include "sdkconfig.h" #include "port_serial_slave.h" #ifdef CONFIG_FMB_TIMER_PORT_ENABLED diff --git a/components/freemodbus/port/porttimer_m.c b/components/freemodbus/port/porttimer_m.c index c2d52281b3..af0ded0859 100644 --- a/components/freemodbus/port/porttimer_m.c +++ b/components/freemodbus/port/porttimer_m.c @@ -40,6 +40,7 @@ #include "mb_m.h" #include "mbport.h" #include "port_serial_master.h" +#include "sdkconfig.h" #define MB_US50_FREQ (20000) // 20kHz 1/20000 = 50mks #define MB_TICK_TIME_US (50) // 50uS = one tick for timer diff --git a/components/freertos/CMakeLists.txt b/components/freertos/CMakeLists.txt index ee6b560392..9826fd8c91 100644 --- a/components/freertos/CMakeLists.txt +++ b/components/freertos/CMakeLists.txt @@ -1,4 +1,10 @@ -set(srcs +if(BOOTLOADER_BUILD) + # bootloader only needs FreeRTOS for config, not for anything else + idf_component_register() + return() +endif() + +set(srcs "croutine.c" "event_groups.c" "FreeRTOS-openocd.c" diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index 1341dc10cd..a6665118bb 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -1,7 +1,7 @@ menu "FreeRTOS" - # This is actually also handled in the ESP32 startup code, not only in FreeRTOS. config FREERTOS_UNICORE + # This config variable is also checked in the ESP32 startup code, not only in FreeRTOS. bool "Run FreeRTOS only on first core" default n help @@ -13,6 +13,7 @@ menu "FreeRTOS" # This invisible config value sets the value of tskNO_AFFINITY in task.h. # Intended to be used as a constant from other Kconfig files. # Value is (32-bit) INT_MAX. + config FREERTOS_NO_AFFINITY hex default 0x7FFFFFFF diff --git a/components/freertos/include/freertos/FreeRTOSConfig.h b/components/freertos/include/freertos/FreeRTOSConfig.h index bd3c72db59..884dde32f8 100644 --- a/components/freertos/include/freertos/FreeRTOSConfig.h +++ b/components/freertos/include/freertos/FreeRTOSConfig.h @@ -76,7 +76,7 @@ /* ESP31 and ESP32 are dualcore processors. */ #ifndef CONFIG_FREERTOS_UNICORE #define portNUM_PROCESSORS 2 -#else +#else #define portNUM_PROCESSORS 1 #endif @@ -117,7 +117,11 @@ int xt_clock_freq(void) __attribute__((deprecated)); /* configASSERT behaviour */ #ifndef __ASSEMBLER__ #include /* for abort() */ +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#endif #if defined(CONFIG_FREERTOS_ASSERT_DISABLE) #define configASSERT(a) /* assertions disabled */ @@ -155,7 +159,7 @@ int xt_clock_freq(void) __attribute__((deprecated)); * memory. * * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE - * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. *----------------------------------------------------------*/ #define configUSE_PREEMPTION 1 diff --git a/components/freertos/include/freertos/portmacro.h b/components/freertos/include/freertos/portmacro.h index d6b2184655..010f60f250 100644 --- a/components/freertos/include/freertos/portmacro.h +++ b/components/freertos/include/freertos/portmacro.h @@ -353,12 +353,30 @@ static inline unsigned portENTER_CRITICAL_NESTED(void) { * ESP32 (portMUX assertions would fail). */ static inline void uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) { +#if XCHAL_HAVE_S32C1I __asm__ __volatile__ ( "WSR %2,SCOMPARE1 \n" "S32C1I %0, %1, 0 \n" :"=r"(*set) :"r"(addr), "r"(compare), "0"(*set) ); +#else + // No S32C1I, so do this by disabling and re-enabling interrupts (slower) + uint32_t intlevel, old_value; + __asm__ __volatile__ ("rsil %0, " XTSTR(XCHAL_EXCM_LEVEL) "\n" + : "=r"(intlevel)); + + old_value = *addr; + if (old_value == compare) { + *addr = *set; + } + + __asm__ __volatile__ ("memw \n" + "wsr %0, ps\n" + :: "r"(intlevel)); + + *set = old_value; +#endif } diff --git a/components/freertos/port.c b/components/freertos/port.c index cd6720c964..bab93aad5a 100644 --- a/components/freertos/port.c +++ b/components/freertos/port.c @@ -97,7 +97,6 @@ #include "xtensa_rtos.h" -#include "esp32/rom/ets_sys.h" #include "soc/cpu.h" #include "FreeRTOS.h" @@ -109,6 +108,7 @@ #include "esp_intr_alloc.h" #include "esp_log.h" +#include "sdkconfig.h" /* Defined in portasm.h */ extern void _frxt_tick_timer_init(void); @@ -435,7 +435,7 @@ void vPortSetStackWatchpoint( void* pxStackStart ) { esp_set_watchpoint(1, (char*)addr, 32, ESP_WATCHPOINT_STORE); } -#if defined(CONFIG_ESP32_SPIRAM_SUPPORT) +#if defined(CONFIG_SPIRAM) /* * Compare & set (S32C1) does not work in external RAM. Instead, this routine uses a mux (in internal memory) to fake it. */ @@ -459,7 +459,7 @@ void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t vPortCPUReleaseMutexIntsDisabled(&extram_mux); #endif } -#endif //defined(CONFIG_ESP32_SPIRAM_SUPPORT) +#endif //defined(CONFIG_SPIRAM) diff --git a/components/freertos/portmux_impl.h b/components/freertos/portmux_impl.h index 691ad01e2f..af170bb3ea 100644 --- a/components/freertos/portmux_impl.h +++ b/components/freertos/portmux_impl.h @@ -64,7 +64,7 @@ #undef PORTMUX_COMPARE_SET_FN_NAME -#if defined(CONFIG_ESP32_SPIRAM_SUPPORT) +#if defined(CONFIG_SPIRAM) #define PORTMUX_AQUIRE_MUX_FN_NAME vPortCPUAcquireMutexIntsDisabledExtram #define PORTMUX_RELEASE_MUX_FN_NAME vPortCPUReleaseMutexIntsDisabledExtram @@ -91,22 +91,28 @@ static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexIntsDisabled(PORTMUX_AQUIRE_MUX_FN_ARGS) { -#if defined(CONFIG_ESP32_SPIRAM_SUPPORT) +#if !defined(CONFIG_FREERTOS_UNICORE) +#if defined(CONFIG_SPIRAM) if (esp_ptr_external_ram(mux)) { return vPortCPUAcquireMutexIntsDisabledExtram(PORTMUX_AQUIRE_MUX_FN_CALL_ARGS(mux)); } #endif return vPortCPUAcquireMutexIntsDisabledInternal(PORTMUX_AQUIRE_MUX_FN_CALL_ARGS(mux)); +#else + return true; +#endif } static inline void vPortCPUReleaseMutexIntsDisabled(PORTMUX_RELEASE_MUX_FN_ARGS) { -#if defined(CONFIG_ESP32_SPIRAM_SUPPORT) +#if !defined(CONFIG_FREERTOS_UNICORE) +#if defined(CONFIG_SPIRAM) if (esp_ptr_external_ram(mux)) { vPortCPUReleaseMutexIntsDisabledExtram(PORTMUX_RELEASE_MUX_FN_CALL_ARGS(mux)); return; } #endif vPortCPUReleaseMutexIntsDisabledInternal(PORTMUX_RELEASE_MUX_FN_CALL_ARGS(mux)); +#endif } diff --git a/components/freertos/queue.c b/components/freertos/queue.c index 1859dbd1dd..95de32e59f 100644 --- a/components/freertos/queue.c +++ b/components/freertos/queue.c @@ -78,8 +78,7 @@ #include #include - -#include "esp32/rom/ets_sys.h" +#include "sdkconfig.h" /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining all the API functions to use the MPU wrappers. That should only be done when diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index 634e64e486..77d713c62e 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -70,13 +70,12 @@ /* Standard includes. */ #include #include +#include "sdkconfig.h" /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining all the API functions to use the MPU wrappers. That should only be done when task.h is included from an application file. */ #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE - -#include "esp32/rom/ets_sys.h" #include "esp_newlib.h" /* FreeRTOS includes. */ diff --git a/components/freertos/test/CMakeLists.txt b/components/freertos/test/CMakeLists.txt index b531a14504..8f40b2df02 100644 --- a/components/freertos/test/CMakeLists.txt +++ b/components/freertos/test/CMakeLists.txt @@ -1,3 +1,11 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." - REQUIRES unity test_utils) \ No newline at end of file +set(srcdirs .) + +if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcdirs esp32) +endif() + + +idf_component_register(SRC_DIRS ${src_dirs} + INCLUDE_DIRS . + REQUIRES unity test_utils + ) \ No newline at end of file diff --git a/components/freertos/test/component.mk b/components/freertos/test/component.mk index 5dd172bdb7..b2b7d9048f 100644 --- a/components/freertos/test/component.mk +++ b/components/freertos/test/component.mk @@ -2,4 +2,5 @@ #Component Makefile # +COMPONENT_SRCDIRS += esp32 COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive diff --git a/components/freertos/test/test_freertos_task_delay_until.c b/components/freertos/test/esp32/test_freertos_task_delay_until.c similarity index 100% rename from components/freertos/test/test_freertos_task_delay_until.c rename to components/freertos/test/esp32/test_freertos_task_delay_until.c diff --git a/components/freertos/test/test_freertos.c b/components/freertos/test/test_freertos.c deleted file mode 100644 index 5925b64870..0000000000 --- a/components/freertos/test/test_freertos.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - Test for multicore FreeRTOS. This test spins up threads, fiddles with queues etc. -*/ - -#include -#include -#include "esp32/rom/ets_sys.h" - -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "freertos/semphr.h" -#include "freertos/queue.h" -#include "freertos/xtensa_api.h" -#include "unity.h" -#include "soc/uart_periph.h" -#include "soc/dport_reg.h" -#include "driver/gpio.h" - - -void ets_isr_unmask(uint32_t unmask); - -static xQueueHandle myQueue; -static xQueueHandle uartRxQueue; - -int ctr; - -#if 1 -//Idle-loop for delay. Tests involuntary yielding -static void cvTaskDelay(int dummy) -{ - volatile int i; - for (i = 0; i < (1 << 17); i++); -} -#else -//Delay task execution using FreeRTOS methods. Tests voluntary yielding. -#define cvTaskDelay(x) vTaskDelay(x) -#endif - -#if 0 -static void dosegfault3(int i) -{ - volatile char *p = (volatile char *)0; - *p = i; -} - -static void dosegfault2(int i) -{ - if (i > 3) { - dosegfault3(i); - } -} - -static void dosegfault(int i) -{ - if (i < 5) { - dosegfault(i + 1); - } - dosegfault2(i); -} -#endif - -static void queueSender(void *pvParameters) -{ - int myCtr = xPortGetCoreID() * 100000; - while (1) { - printf("Core %d: Send to queue: %d\n", xPortGetCoreID(), myCtr); - xQueueSend(myQueue, (void *)(&myCtr), portMAX_DELAY); - printf("Send to queue done.\n"); - cvTaskDelay(100); - myCtr++; - } -} - -static void queueReceiver(void *pvParameters) -{ - int theCtr; - while (1) { - xQueueReceive(myQueue, &theCtr, portMAX_DELAY); - printf("Core %d: Receive from queue: %d\n", xPortGetCoreID(), theCtr); - } -} - - -static void tskone(void *pvParameters) -{ -// char *p=(char *)0; - while (1) { - ctr++; -// if (ctr>60) dosegfault(3); - printf("Task1, core %d, ctr=%d\n", xPortGetCoreID(), ctr); - cvTaskDelay(500); - } -} - -static void tsktwo(void *pvParameters) -{ - while (1) { - ctr++; - printf("Task2, core %d, ctr=%d\n", xPortGetCoreID(), ctr); - cvTaskDelay(500); - } -} - -static void tskthree(void *pvParameters) -{ - while (1) { - ctr++; - printf("Task3, core %d, ctr=%d\n", xPortGetCoreID(), ctr); - cvTaskDelay(500); - } -} - -static void tskfour(void *pvParameters) -{ - while (1) { - ctr++; - printf("Task4, core %d, ctr=%d\n", xPortGetCoreID(), ctr); - cvTaskDelay(500); - } -} - -static void tskfive(void *pvParameters) -{ - while (1) { - ctr++; - printf("Task5, core %d, ctr=%d\n", xPortGetCoreID(), ctr); - cvTaskDelay(500); - } -} - -static void tskyield(void *pvParameters) -{ - while (1) { - portYIELD(); - } -} - -static void tskUartRecv(void *pvParameters) -{ - char c; - while (1) { - xQueueReceive(uartRxQueue, &c, portMAX_DELAY); - printf("Uart received %c!\n", c); - } -} - - -static void uartIsrHdl(void *arg) -{ - char c; - BaseType_t xHigherPriorityTaskWoken; - SET_PERI_REG_MASK(UART_INT_CLR_REG(0), UART_RXFIFO_FULL_INT_CLR); - while (READ_PERI_REG(UART_STATUS_REG(0)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S)) { - c = READ_PERI_REG(UART_FIFO_REG(0)); - xQueueSendFromISR(uartRxQueue, &c, &xHigherPriorityTaskWoken); - printf("ISR: %c\n", c); - } - if (xHigherPriorityTaskWoken) { - portYIELD_FROM_ISR(); - } -} - -static void uartRxInit(xQueueHandle q) -{ - uint32_t reg_val; - - gpio_pullup_dis(1); - PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_U0RXD); - PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_U0TXD); - - - PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_U0RXD); - -// reg_val = READ_PERI_REG(UART_CONF1(0)); - reg_val = (1 << UART_RXFIFO_FULL_THRHD_S); - WRITE_PERI_REG(UART_CONF1_REG(0), reg_val); - CLEAR_PERI_REG_MASK(UART_INT_ENA_REG(0), UART_TXFIFO_EMPTY_INT_ENA | UART_RXFIFO_TOUT_INT_ENA); - SET_PERI_REG_MASK(UART_INT_ENA_REG(0), UART_RXFIFO_FULL_INT_ENA); - - printf("Enabling int %d\n", ETS_UART0_INUM); - DPORT_REG_SET_FIELD(DPORT_PRO_UART_INTR_MAP_REG, DPORT_PRO_UART_INTR_MAP, ETS_UART0_INUM); - DPORT_REG_SET_FIELD(DPORT_PRO_UART1_INTR_MAP_REG, DPORT_PRO_UART1_INTR_MAP, ETS_UART0_INUM); - - xt_set_interrupt_handler(ETS_UART0_INUM, uartIsrHdl, NULL); - xt_ints_on(1 << ETS_UART0_INUM); - -} - -// TODO: split this thing into separate orthogonal tests -TEST_CASE("Bunch of FreeRTOS tests", "[freertos][ignore]") -{ - char *tst; - TaskHandle_t th[12]; - int i; - printf("%s\n", __FUNCTION__); - tst = pvPortMalloc(16); - printf("Test malloc returns addr %p\n", tst); - printf("Free heap: %u\n", xPortGetFreeHeapSize()); - myQueue = xQueueCreate(10, sizeof(int)); - uartRxQueue = xQueueCreate(256, sizeof(char)); - printf("Free heap: %u\n", xPortGetFreeHeapSize()); - - printf("Creating tasks\n"); - xTaskCreatePinnedToCore(tskyield , "tskyield1" , 2048, NULL, 3, &th[0], 0); - xTaskCreatePinnedToCore(tskyield , "tskyield2" , 2048, NULL, 3, &th[1], 1); - - xTaskCreatePinnedToCore(tskone , "tskone" , 2048, NULL, 3, &th[2], 0); - xTaskCreatePinnedToCore(tsktwo , "tsktwo" , 2048, NULL, 3, &th[3], 1); - xTaskCreatePinnedToCore(tskthree, "tskthree", 2048, NULL, 3, &th[4], 0); - xTaskCreatePinnedToCore(tskfour , "tskfour" , 2048, NULL, 3, &th[5], tskNO_AFFINITY); - xTaskCreatePinnedToCore(tskfive , "tskfive" , 2048, NULL, 3, &th[6], tskNO_AFFINITY); - xTaskCreatePinnedToCore(queueSender , "qsend1" , 2048, NULL, 3, &th[7], 0); - xTaskCreatePinnedToCore(queueSender , "qsend2" , 2048, NULL, 3, &th[8], 1); - xTaskCreatePinnedToCore(queueReceiver , "qrecv1" , 2048, NULL, 3, &th[9], 1); - xTaskCreatePinnedToCore(queueReceiver , "qrecv2" , 2048, NULL, 3, &th[10], 0); - xTaskCreatePinnedToCore(tskUartRecv , "tskuart" , 2048, NULL, 4, &th[11], 1); - printf("Free heap: %u\n", xPortGetFreeHeapSize()); - uartRxInit(uartRxQueue); - - // Let stuff run for 20s - vTaskDelay(20000 / portTICK_PERIOD_MS); - - //Shut down all the tasks - for (i = 0; i < 12; i++) { - vTaskDelete(th[i]); - } - xt_ints_off(1 << ETS_UART0_INUM); -} - diff --git a/components/freertos/test/test_freertos_eventgroups.c b/components/freertos/test/test_freertos_eventgroups.c index 1a245e2fb8..da4f800fab 100644 --- a/components/freertos/test/test_freertos_eventgroups.c +++ b/components/freertos/test/test_freertos_eventgroups.c @@ -8,6 +8,12 @@ #include "driver/timer.h" #include "unity.h" +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +#define int_clr_timers int_clr +#define update update.update +#define int_st_timers int_st +#endif + #define BIT_CALL (1 << 0) #define BIT_RESPONSE(TASK) (1 << (TASK+1)) #define ALL_RESPONSE_BITS (((1 << NUM_TASKS) - 1) << 1) diff --git a/components/freertos/test/test_freertos_isinisrcontext.c b/components/freertos/test/test_freertos_isinisrcontext.c index ff8bf27d5e..a34e154635 100644 --- a/components/freertos/test/test_freertos_isinisrcontext.c +++ b/components/freertos/test/test_freertos_isinisrcontext.c @@ -4,7 +4,6 @@ #include #include -#include "esp32/rom/ets_sys.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/freertos/test/test_freertos_task_delete.c b/components/freertos/test/test_freertos_task_delete.c index fa40f417a5..f82d8f15a7 100644 --- a/components/freertos/test/test_freertos_task_delete.c +++ b/components/freertos/test/test_freertos_task_delete.c @@ -17,7 +17,6 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_heap_caps.h" -#include "esp32/rom/ets_sys.h" #include "unity.h" #include "test_utils.h" diff --git a/components/freertos/test/test_freertos_task_notify.c b/components/freertos/test/test_freertos_task_notify.c index 226180d8aa..8fb0b217cb 100644 --- a/components/freertos/test/test_freertos_task_notify.c +++ b/components/freertos/test/test_freertos_task_notify.c @@ -15,6 +15,12 @@ #include "unity.h" #include "test_utils.h" +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +#define int_clr_timers int_clr +#define update update.update +#define int_st_timers int_st +#endif + #define NO_OF_NOTIFS 4 #define NO_OF_TASKS 2 //Sender and receiver #define TIMER_DIVIDER 10000 diff --git a/components/freertos/test/test_newlib_reent.c b/components/freertos/test/test_newlib_reent.c index ea723b70a3..b4a4f7c14e 100644 --- a/components/freertos/test/test_newlib_reent.c +++ b/components/freertos/test/test_newlib_reent.c @@ -5,7 +5,6 @@ #include #include #include -#include "esp32/rom/ets_sys.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/freertos/test/test_panic.c b/components/freertos/test/test_panic.c index 295e0486f1..20d55e32d3 100644 --- a/components/freertos/test/test_panic.c +++ b/components/freertos/test/test_panic.c @@ -4,7 +4,6 @@ #include #include -#include "esp32/rom/ets_sys.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/freertos/test/test_preemption.c b/components/freertos/test/test_preemption.c index 80713b2d6b..98668abb86 100644 --- a/components/freertos/test/test_preemption.c +++ b/components/freertos/test/test_preemption.c @@ -4,7 +4,6 @@ #include #include -#include "esp32/rom/ets_sys.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/freertos/test/test_spinlocks.c b/components/freertos/test/test_spinlocks.c index a54908f33c..3e12888671 100644 --- a/components/freertos/test/test_spinlocks.c +++ b/components/freertos/test/test_spinlocks.c @@ -4,7 +4,6 @@ #include #include -#include "esp32/rom/ets_sys.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -45,7 +44,7 @@ TEST_CASE("portMUX spinlocks (no contention)", "[freertos]") #ifdef CONFIG_FREERTOS_UNICORE TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE, "%d cycles/op", ((end - start)/REPEAT_OPS)); #else -#if CONFIG_ESP32_SPIRAM_SUPPORT +#if CONFIG_SPIRAM TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP_PSRAM, "%d cycles/op", ((end - start)/REPEAT_OPS)); #else TEST_PERFORMANCE_LESS_THAN(FREERTOS_SPINLOCK_CYCLES_PER_OP, "%d cycles/op", ((end - start)/REPEAT_OPS)); diff --git a/components/freertos/test/test_suspend_scheduler.c b/components/freertos/test/test_suspend_scheduler.c index 9e7b039ed1..fee9d8717d 100644 --- a/components/freertos/test/test_suspend_scheduler.c +++ b/components/freertos/test/test_suspend_scheduler.c @@ -13,6 +13,12 @@ #include "driver/timer.h" #include "sdkconfig.h" +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +#define int_clr_timers int_clr +#define update update.update +#define int_st_timers int_st +#endif + static SemaphoreHandle_t isr_semaphore; static volatile unsigned isr_count; diff --git a/components/freertos/test/test_task_suspend_resume.c b/components/freertos/test/test_task_suspend_resume.c index 9b7c47cd4e..01fbeee085 100644 --- a/components/freertos/test/test_task_suspend_resume.c +++ b/components/freertos/test/test_task_suspend_resume.c @@ -18,6 +18,11 @@ #include "esp_freertos_hooks.h" #include "sdkconfig.h" +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +#define int_clr_timers int_clr +#define update update.update +#define int_st_timers int_st +#endif /* Counter task counts a target variable forever */ static void task_count(void *vp_counter) diff --git a/components/freertos/xtensa_init.c b/components/freertos/xtensa_init.c index c503b7c37a..b8cd5f7fff 100644 --- a/components/freertos/xtensa_init.c +++ b/components/freertos/xtensa_init.c @@ -30,11 +30,16 @@ that are implemented in C. #ifdef XT_BOARD -#include +#include "xtensa/xtbsp.h" #endif -#include "xtensa_rtos.h" -#include "esp32/clk.h" +#include "xtensa_rtos.h" +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/clk.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/clk.h" +#endif #ifdef XT_RTOS_TIMER_INT diff --git a/components/freertos/xtensa_intr.c b/components/freertos/xtensa_intr.c index 03979f48a5..4a8724044a 100644 --- a/components/freertos/xtensa_intr.c +++ b/components/freertos/xtensa_intr.c @@ -33,8 +33,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "freertos/FreeRTOS.h" #include "freertos/xtensa_api.h" #include "freertos/portable.h" - -#include "esp32/rom/ets_sys.h" +#include "sdkconfig.h" #if XCHAL_HAVE_EXCEPTIONS diff --git a/components/heap/heap_caps.c b/components/heap/heap_caps.c index 1b5c98e2b9..9e2ddd3a41 100644 --- a/components/heap/heap_caps.c +++ b/components/heap/heap_caps.c @@ -39,12 +39,16 @@ possible. This should optimize the amount of RAM accessible to the code without IRAM_ATTR static void *dram_alloc_to_iram_addr(void *addr, size_t len) { uintptr_t dstart = (uintptr_t)addr; //First word - uintptr_t dend = dstart + len - 4; //Last word + uintptr_t dend = dstart + len; //Last word + 4 assert(esp_ptr_in_diram_dram((void *)dstart)); assert(esp_ptr_in_diram_dram((void *)dend)); assert((dstart & 3) == 0); assert((dend & 3) == 0); +#if CONFIG_IDF_TARGET_ESP32 uint32_t istart = SOC_DIRAM_IRAM_LOW + (SOC_DIRAM_DRAM_HIGH - dend); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + uint32_t istart = SOC_DIRAM_IRAM_LOW + (dstart - SOC_DIRAM_DRAM_LOW); +#endif uint32_t *iptr = (uint32_t *)istart; *iptr = dstart; return iptr + 1; diff --git a/components/heap/multi_heap_platform.h b/components/heap/multi_heap_platform.h index a3a0acc67b..19215288a4 100644 --- a/components/heap/multi_heap_platform.h +++ b/components/heap/multi_heap_platform.h @@ -16,7 +16,12 @@ #ifdef ESP_PLATFORM #include -#include +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#endif #include /* Because malloc/free can happen inside an ISR context, diff --git a/components/heap/test/test_leak.c b/components/heap/test/test_leak.c index 6fce4e6ffd..1153fe1bc9 100644 --- a/components/heap/test/test_leak.c +++ b/components/heap/test/test_leak.c @@ -57,4 +57,4 @@ static void test_fn3(void) check_calloc(7000); } -TEST_CASE_MULTIPLE_STAGES("Check for leaks in MULTIPLE_STAGES mode (manual reset)", "[heap][leaks][reset=SW_CPU_RESET, SW_CPU_RESET]", test_fn2, test_fn2, test_fn3); +TEST_CASE_MULTIPLE_STAGES_ESP32("Check for leaks in MULTIPLE_STAGES mode (manual reset)", "[heap][leaks][reset=SW_CPU_RESET, SW_CPU_RESET]", test_fn2, test_fn2, test_fn3); diff --git a/components/heap/test/test_malloc.c b/components/heap/test/test_malloc.c index 42f73cfe70..cfc634bada 100644 --- a/components/heap/test/test_malloc.c +++ b/components/heap/test/test_malloc.c @@ -4,7 +4,6 @@ #include #include -#include "esp32/rom/ets_sys.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" diff --git a/components/heap/test/test_malloc_caps.c b/components/heap/test/test_malloc_caps.c index 74c8084771..9fdbec5716 100644 --- a/components/heap/test/test_malloc_caps.c +++ b/components/heap/test/test_malloc_caps.c @@ -11,7 +11,7 @@ #include #include -TEST_CASE("Capabilities allocator test", "[heap]") +TEST_CASE_ESP32("Capabilities allocator test", "[heap]") { char *m1, *m2[10]; int x; diff --git a/components/heap/test/test_realloc.c b/components/heap/test/test_realloc.c index 290ee3da6e..6781c2af3f 100644 --- a/components/heap/test/test_realloc.c +++ b/components/heap/test/test_realloc.c @@ -22,7 +22,7 @@ TEST_CASE("realloc shrink buffer in place", "[heap]") #endif -TEST_CASE("realloc move data to a new heap type", "[heap]") +TEST_CASE_ESP32("realloc move data to a new heap type", "[heap]") { const char *test = "I am some test content to put in the heap"; char buf[64]; diff --git a/components/libsodium/test/test_sodium.c b/components/libsodium/test/test_sodium.c index f7f37d509f..ffbc1d1acd 100644 --- a/components/libsodium/test/test_sodium.c +++ b/components/libsodium/test/test_sodium.c @@ -39,7 +39,7 @@ TEST_CASE("box tests", "[libsodium]") extern int ed25519_convert_xmain(void); -TEST_CASE("ed25519_convert tests", "[libsodium][timeout=60]") +TEST_CASE_ESP32("ed25519_convert tests", "[libsodium][timeout=60]") { printf("Running ed25519_convert\n"); TEST_ASSERT_EQUAL(0, ed25519_convert_xmain() ); diff --git a/components/log/include/esp_log.h b/components/log/include/esp_log.h index c00a3b63dc..994174ec4b 100644 --- a/components/log/include/esp_log.h +++ b/components/log/include/esp_log.h @@ -18,7 +18,11 @@ #include #include #include "sdkconfig.h" -#include +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#endif #ifdef __cplusplus extern "C" { @@ -169,15 +173,15 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, . /** * @brief Dump a buffer to the log at specified level. - * + * * The dump log shows just like the one below: - * + * * W (195) log_example: 0x3ffb4280 45 53 50 33 32 20 69 73 20 67 72 65 61 74 2c 20 |ESP32 is great, | * W (195) log_example: 0x3ffb4290 77 6f 72 6b 69 6e 67 20 61 6c 6f 6e 67 20 77 69 |working along wi| * W (205) log_example: 0x3ffb42a0 74 68 20 74 68 65 20 49 44 46 2e 00 |th the IDF..| - * + * * It is highly recommend to use terminals with over 102 text width. - * + * * @param tag description tag * @param buffer Pointer to the buffer array * @param buff_len length of buffer in bytes @@ -303,7 +307,7 @@ void esp_log_write(esp_log_level_t level, const char* tag, const char* format, . #endif // BOOTLOADER_BUILD /** runtime macro to output logs at a specified level. - * + * * @param tag tag of the log, which can be used to change the log level by ``esp_log_level_set`` at runtime. * @param level level of the output log. * @param format format of the output log. see ``printf`` diff --git a/components/lwip/CMakeLists.txt b/components/lwip/CMakeLists.txt index 784f01423b..66ebac5410 100644 --- a/components/lwip/CMakeLists.txt +++ b/components/lwip/CMakeLists.txt @@ -88,7 +88,6 @@ set(srcs "port/esp32/debug/lwip_debug.c" "port/esp32/freertos/sys_arch.c" "port/esp32/netif/dhcp_state.c" - "port/esp32/netif/ethernetif.c" "port/esp32/netif/nettestif.c" "port/esp32/netif/wlanif.c") @@ -126,11 +125,15 @@ if(CONFIG_LWIP_PPP_SUPPORT) "lwip/src/netif/ppp/polarssl/sha1.c") endif() +if(CONFIG_ETH_ENABLED) + list(APPEND srcs "port/esp32/netif/ethernetif.c") +endif() + idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "${include_dirs}" LDFRAGMENTS linker.lf REQUIRES vfs esp_wifi - PRIV_REQUIRES esp_eth tcpip_adapter nvs_flash) + PRIV_REQUIRES ${priv_requires} esp_eth tcpip_adapter nvs_flash) # lots of LWIP source files evaluate macros that check address of stack variables target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-address) diff --git a/components/lwip/component.mk b/components/lwip/component.mk index bea9d738f0..46076d7a4c 100644 --- a/components/lwip/component.mk +++ b/components/lwip/component.mk @@ -26,6 +26,10 @@ COMPONENT_SRCDIRS := \ port/esp32/netif \ port/esp32/debug +ifndef CONFIG_IDF_TARGET_ESP32 + COMPONENT_OBJEXCLUDE := port/esp32/netif/ethernetif.o +endif + ifdef CONFIG_LWIP_PPP_SUPPORT COMPONENT_SRCDIRS += lwip/src/netif/ppp lwip/src/netif/ppp/polarssl endif diff --git a/components/lwip/weekend_test/net_suite_test.py b/components/lwip/weekend_test/net_suite_test.py index ce6340a2da..59e763b44c 100644 --- a/components/lwip/weekend_test/net_suite_test.py +++ b/components/lwip/weekend_test/net_suite_test.py @@ -9,6 +9,7 @@ from shutil import copyfile try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -83,7 +84,7 @@ def lwip_test_suite(env, extra_data): 3. Execute ttcn3 test suite 4. Collect result from ttcn3 """ - dut1 = env.get_dut("net_suite", "examples/system/network_tests") + dut1 = env.get_dut("net_suite", "examples/system/network_tests", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "net_suite.bin") bin_size = os.path.getsize(binary_file) diff --git a/components/mbedtls/CMakeLists.txt b/components/mbedtls/CMakeLists.txt index a2d082304c..0c4c263fef 100644 --- a/components/mbedtls/CMakeLists.txt +++ b/components/mbedtls/CMakeLists.txt @@ -1,5 +1,9 @@ +idf_build_get_property(idf_target IDF_TARGET) + idf_component_register(INCLUDE_DIRS "port/include" "mbedtls/include" - REQUIRES lwip) + REQUIRES lwip + PRIV_REQUIRES ${IDF_COMPONENT_REQUIRES_COMMON} soc + ) # Only build mbedtls libraries set(ENABLE_TESTING CACHE BOOL OFF) @@ -22,20 +26,22 @@ set(mbedtls_targets mbedtls mbedcrypto mbedx509) target_sources(mbedtls PRIVATE "${COMPONENT_DIR}/port/mbedtls_debug.c" "${COMPONENT_DIR}/port/net_sockets.c") -target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_bignum.c" - "${COMPONENT_DIR}/port/esp_hardware.c" +target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_hardware.c" "${COMPONENT_DIR}/port/esp_mem.c" "${COMPONENT_DIR}/port/esp_sha.c" "${COMPONENT_DIR}/port/esp_sha1.c" "${COMPONENT_DIR}/port/esp_sha256.c" "${COMPONENT_DIR}/port/esp_sha512.c" "${COMPONENT_DIR}/port/esp_timing.c" - "${COMPONENT_DIR}/port/esp32/aes.c" - "${COMPONENT_DIR}/port/esp32/sha.c") + "${COMPONENT_DIR}/port/${idf_target}/esp_bignum.c" + "${COMPONENT_DIR}/port/${idf_target}/aes.c" + "${COMPONENT_DIR}/port/${idf_target}/sha.c") foreach(target ${mbedtls_targets}) target_compile_definitions(${target} PUBLIC -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h") endforeach() +set_property(TARGET mbedcrypto APPEND PROPERTY LINK_INTERFACE_LIBRARIES mbedtls) + # Link mbedtls libraries to component library -target_link_libraries(${COMPONENT_LIB} INTERFACE ${mbedtls_targets}) +target_link_libraries(${COMPONENT_LIB} INTERFACE ${mbedtls_targets}) \ No newline at end of file diff --git a/components/mbedtls/Kconfig b/components/mbedtls/Kconfig index 89bfa9abe5..bcc0b9c450 100644 --- a/components/mbedtls/Kconfig +++ b/components/mbedtls/Kconfig @@ -131,6 +131,8 @@ menu "mbedTLS" config MBEDTLS_HARDWARE_AES bool "Enable hardware AES acceleration" + depends on IDF_TARGET_ESP32 + # ToDo: remove once hardware AES acceleration is supported on esp32s2 default y help Enable hardware accelerated AES encryption & decryption. diff --git a/components/mbedtls/component.mk b/components/mbedtls/component.mk index 09ce80c96c..f21c94660b 100644 --- a/components/mbedtls/component.mk +++ b/components/mbedtls/component.mk @@ -4,7 +4,7 @@ COMPONENT_ADD_INCLUDEDIRS := port/include mbedtls/include -COMPONENT_SRCDIRS := mbedtls/library port port/esp32 +COMPONENT_SRCDIRS := mbedtls/library port port/$(IDF_TARGET) COMPONENT_OBJEXCLUDE := mbedtls/library/net_sockets.o diff --git a/components/mbedtls/port/esp_bignum.c b/components/mbedtls/port/esp32/esp_bignum.c similarity index 100% rename from components/mbedtls/port/esp_bignum.c rename to components/mbedtls/port/esp32/esp_bignum.c diff --git a/components/mbedtls/port/esp32s2beta/aes.c b/components/mbedtls/port/esp32s2beta/aes.c new file mode 100644 index 0000000000..2740b45a2a --- /dev/null +++ b/components/mbedtls/port/esp32s2beta/aes.c @@ -0,0 +1,381 @@ +/** + * \brief AES block cipher, ESP32 hardware accelerated version + * Based on mbedTLS FIPS-197 compliant version. + * + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Additions Copyright (C) 2016-2017, Espressif Systems (Shanghai) PTE Ltd + * SPDX-License-Identifier: Apache-2.0 + * + * 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 AES block cipher was designed by Vincent Rijmen and Joan Daemen. + * + * http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf + * http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf + */ +#include +#include "mbedtls/aes.h" +#include "esp32s2beta/aes.h" +#include "soc/dport_reg.h" +#include "soc/hwcrypto_reg.h" +#include + +#include + +#include "soc/cpu.h" +#include + +#define AES_BLOCK_BYTES 16 + +/* AES uses a spinlock mux not a lock as the underlying block operation + only takes a small number of cycles, much less than using + a mutex for this. + + For CBC, CFB, etc. this may mean that interrupts are disabled for a longer + period of time for bigger data lengths. +*/ +static portMUX_TYPE aes_spinlock = portMUX_INITIALIZER_UNLOCKED; + +void esp_aes_acquire_hardware( void ) +{ + /* newlib locks lazy initialize on ESP-IDF */ + portENTER_CRITICAL(&aes_spinlock); + + /* Enable AES hardware */ + REG_SET_BIT(DPORT_PERI_CLK_EN_REG, DPORT_PERI_EN_AES); + /* Clear reset on digital signature unit, + otherwise AES unit is held in reset also. */ + REG_CLR_BIT(DPORT_PERI_RST_EN_REG, + DPORT_PERI_EN_AES + | DPORT_PERI_EN_DIGITAL_SIGNATURE); +} + +void esp_aes_release_hardware( void ) +{ + /* Disable AES hardware */ + REG_SET_BIT(DPORT_PERI_RST_EN_REG, DPORT_PERI_EN_AES); + /* Don't return other units to reset, as this pulls + reset on RSA & SHA units, respectively. */ + REG_CLR_BIT(DPORT_PERI_CLK_EN_REG, DPORT_PERI_EN_AES); + + portEXIT_CRITICAL(&aes_spinlock); +} + +void esp_aes_init( esp_aes_context *ctx ) +{ + bzero( ctx, sizeof( esp_aes_context ) ); +} + +void esp_aes_free( esp_aes_context *ctx ) +{ + if ( ctx == NULL ) { + return; + } + + bzero( ctx, sizeof( esp_aes_context ) ); +} + +/* + * AES key schedule (same for encryption or decryption, as hardware handles schedule) + * + */ +int esp_aes_setkey( esp_aes_context *ctx, const unsigned char *key, + unsigned int keybits ) +{ + if (keybits != 128 && keybits != 192 && keybits != 256) { + return MBEDTLS_ERR_AES_INVALID_KEY_LENGTH; + } + ctx->key_bytes = keybits / 8; + memcpy(ctx->key, key, ctx->key_bytes); + return 0; +} + +/* + * Helper function to copy key from esp_aes_context buffer + * to hardware key registers. + * + * Call only while holding esp_aes_acquire_hardware(). + */ +static inline void esp_aes_setkey_hardware( esp_aes_context *ctx, int mode) +{ + const uint32_t MODE_DECRYPT_BIT = 4; + unsigned mode_reg_base = (mode == ESP_AES_ENCRYPT) ? 0 : MODE_DECRYPT_BIT; + + memcpy((uint32_t *)AES_KEY_BASE, ctx->key, ctx->key_bytes); + REG_WRITE(AES_MODE_REG, mode_reg_base + ((ctx->key_bytes / 8) - 2)); +} + +/* Run a single 16 byte block of AES, using the hardware engine. + * + * Call only while holding esp_aes_acquire_hardware(). + */ +static inline void esp_aes_block(const void *input, void *output) +{ + memcpy((void *)AES_TEXT_IN_BASE, input, AES_BLOCK_BYTES); + + REG_WRITE(AES_TRIGGER_REG, 1); + while (REG_READ(AES_STATE_REG) != 0) { } + + memcpy(output, (void *)AES_TEXT_OUT_BASE, AES_BLOCK_BYTES); +} + +/* + * AES-ECB block encryption + */ +int esp_internal_aes_encrypt( esp_aes_context *ctx, + const unsigned char input[16], + unsigned char output[16] ) +{ + esp_aes_acquire_hardware(); + esp_aes_setkey_hardware(ctx, ESP_AES_ENCRYPT); + esp_aes_block(input, output); + esp_aes_release_hardware(); + return 0; +} + +void esp_aes_encrypt( esp_aes_context *ctx, + const unsigned char input[16], + unsigned char output[16] ) +{ + esp_internal_aes_encrypt(ctx, input, output); +} + +/* + * AES-ECB block decryption + */ + +int esp_internal_aes_decrypt( esp_aes_context *ctx, + const unsigned char input[16], + unsigned char output[16] ) +{ + esp_aes_acquire_hardware(); + esp_aes_setkey_hardware(ctx, ESP_AES_DECRYPT); + esp_aes_block(input, output); + esp_aes_release_hardware(); + return 0; +} + +void esp_aes_decrypt( esp_aes_context *ctx, + const unsigned char input[16], + unsigned char output[16] ) +{ + esp_internal_aes_decrypt(ctx, input, output); +} + + +/* + * AES-ECB block encryption/decryption + */ +int esp_aes_crypt_ecb( esp_aes_context *ctx, + int mode, + const unsigned char input[16], + unsigned char output[16] ) +{ + esp_aes_acquire_hardware(); + esp_aes_setkey_hardware(ctx, mode); + esp_aes_block(input, output); + esp_aes_release_hardware(); + + return 0; +} + + +/* + * AES-CBC buffer encryption/decryption + */ +int esp_aes_crypt_cbc( esp_aes_context *ctx, + int mode, + size_t length, + unsigned char iv[16], + const unsigned char *input, + unsigned char *output ) +{ + int i; + uint32_t *output_words = (uint32_t *)output; + const uint32_t *input_words = (const uint32_t *)input; + uint32_t *iv_words = (uint32_t *)iv; + unsigned char temp[16]; + + if ( length % 16 ) { + return ( ERR_ESP_AES_INVALID_INPUT_LENGTH ); + } + + esp_aes_acquire_hardware(); + + esp_aes_setkey_hardware(ctx, mode); + + if ( mode == ESP_AES_DECRYPT ) { + while ( length > 0 ) { + memcpy(temp, input_words, 16); + esp_aes_block(input_words, output_words); + + for ( i = 0; i < 4; i++ ) { + output_words[i] = output_words[i] ^ iv_words[i]; + } + + memcpy( iv_words, temp, 16 ); + + input_words += 4; + output_words += 4; + length -= 16; + } + } else { // ESP_AES_ENCRYPT + while ( length > 0 ) { + + for ( i = 0; i < 4; i++ ) { + output_words[i] = input_words[i] ^ iv_words[i]; + } + + esp_aes_block(output_words, output_words); + memcpy( iv_words, output_words, 16 ); + + input_words += 4; + output_words += 4; + length -= 16; + } + } + + esp_aes_release_hardware(); + + return 0; +} + +/* + * AES-CFB128 buffer encryption/decryption + */ +int esp_aes_crypt_cfb128( esp_aes_context *ctx, + int mode, + size_t length, + size_t *iv_off, + unsigned char iv[16], + const unsigned char *input, + unsigned char *output ) +{ + int c; + size_t n = *iv_off; + + esp_aes_acquire_hardware(); + + esp_aes_setkey_hardware(ctx, ESP_AES_ENCRYPT); + + if ( mode == ESP_AES_DECRYPT ) { + while ( length-- ) { + if ( n == 0 ) { + esp_aes_block(iv, iv ); + } + + c = *input++; + *output++ = (unsigned char)( c ^ iv[n] ); + iv[n] = (unsigned char) c; + + n = ( n + 1 ) & 0x0F; + } + } else { + while ( length-- ) { + if ( n == 0 ) { + esp_aes_block(iv, iv ); + } + + iv[n] = *output++ = (unsigned char)( iv[n] ^ *input++ ); + + n = ( n + 1 ) & 0x0F; + } + } + + *iv_off = n; + + esp_aes_release_hardware(); + + return 0; +} + +/* + * AES-CFB8 buffer encryption/decryption + */ +int esp_aes_crypt_cfb8( esp_aes_context *ctx, + int mode, + size_t length, + unsigned char iv[16], + const unsigned char *input, + unsigned char *output ) +{ + unsigned char c; + unsigned char ov[17]; + + esp_aes_acquire_hardware(); + + esp_aes_setkey_hardware(ctx, ESP_AES_ENCRYPT); + + while ( length-- ) { + memcpy( ov, iv, 16 ); + esp_aes_block(iv, iv); + + if ( mode == ESP_AES_DECRYPT ) { + ov[16] = *input; + } + + c = *output++ = (unsigned char)( iv[0] ^ *input++ ); + + if ( mode == ESP_AES_ENCRYPT ) { + ov[16] = c; + } + + memcpy( iv, ov + 1, 16 ); + } + + esp_aes_release_hardware(); + + return 0; +} + +/* + * AES-CTR buffer encryption/decryption + */ +int esp_aes_crypt_ctr( esp_aes_context *ctx, + size_t length, + size_t *nc_off, + unsigned char nonce_counter[16], + unsigned char stream_block[16], + const unsigned char *input, + unsigned char *output ) +{ + int c, i; + size_t n = *nc_off; + + esp_aes_acquire_hardware(); + + esp_aes_setkey_hardware(ctx, ESP_AES_ENCRYPT); + + while ( length-- ) { + if ( n == 0 ) { + esp_aes_block(nonce_counter, stream_block); + + for ( i = 16; i > 0; i-- ) + if ( ++nonce_counter[i - 1] != 0 ) { + break; + } + } + c = *input++; + *output++ = (unsigned char)( c ^ stream_block[n] ); + + n = ( n + 1 ) & 0x0F; + } + + *nc_off = n; + + esp_aes_release_hardware(); + + return 0; +} diff --git a/components/mbedtls/port/esp32s2beta/esp_bignum.c b/components/mbedtls/port/esp32s2beta/esp_bignum.c new file mode 100644 index 0000000000..5c74fbc16c --- /dev/null +++ b/components/mbedtls/port/esp32s2beta/esp_bignum.c @@ -0,0 +1,613 @@ +/** + * \brief Multi-precision integer library, ESP32C hardware accelerated parts + * + * based on mbedTLS implementation + * + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Additions Copyright (C) 2016, Espressif Systems (Shanghai) PTE Ltd + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include "mbedtls/bignum.h" +#include "esp32s2beta/rom/bigint.h" +#include "soc/hwcrypto_reg.h" +#include "esp_system.h" +#include "esp_log.h" +#include "esp_intr.h" +#include "esp_intr_alloc.h" +#include "esp_attr.h" + +#include "soc/dport_reg.h" +#include "soc/periph_defs.h" + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/semphr.h" + +static const __attribute__((unused)) char *TAG = "bignum"; + +#define ciL (sizeof(mbedtls_mpi_uint)) /* chars in limb */ +#define biL (ciL << 3) /* bits in limb */ + +#if defined(CONFIG_MBEDTLS_MPI_USE_INTERRUPT) +static SemaphoreHandle_t op_complete_sem; + +static IRAM_ATTR void rsa_complete_isr(void *arg) +{ + BaseType_t higher_woken; + DPORT_REG_WRITE(RSA_CLEAR_INTERRUPT_REG, 1); + xSemaphoreGiveFromISR(op_complete_sem, &higher_woken); + if (higher_woken) { + portYIELD_FROM_ISR(); + } +} + +static void rsa_isr_initialise(void) +{ + if (op_complete_sem == NULL) { + op_complete_sem = xSemaphoreCreateBinary(); + esp_intr_alloc(ETS_RSA_INTR_SOURCE, 0, rsa_complete_isr, NULL, NULL); + } +} + +#endif /* CONFIG_MBEDTLS_MPI_USE_INTERRUPT */ + +static _lock_t mpi_lock; + +void esp_mpi_acquire_hardware( void ) +{ + /* newlib locks lazy initialize on ESP-IDF */ + _lock_acquire(&mpi_lock); + + DPORT_REG_SET_BIT(DPORT_PERI_CLK_EN_REG, DPORT_CLK_EN_RSA); + /* also clear reset on digital signature & secure boot, otherwise RSA is held in reset */ + DPORT_REG_CLR_BIT(DPORT_PERI_RST_EN_REG, DPORT_RST_EN_RSA + | DPORT_RST_EN_DIGITAL_SIGNATURE + | DPORT_RST_EN_SECURE_BOOT); + + DPORT_REG_CLR_BIT(DPORT_RSA_PD_CTRL_REG, DPORT_RSA_MEM_PD); + + while(DPORT_REG_READ(RSA_QUERY_CLEAN_REG) != 1) { + } + // Note: from enabling RSA clock to here takes about 1.3us + +#ifdef CONFIG_MBEDTLS_MPI_USE_INTERRUPT + rsa_isr_initialise(); +#endif +} + +void esp_mpi_release_hardware( void ) +{ + DPORT_REG_SET_BIT(DPORT_RSA_PD_CTRL_REG, DPORT_RSA_PD); + + /* don't reset digital signature unit, as this resets AES also */ + DPORT_REG_SET_BIT(DPORT_PERI_RST_EN_REG, DPORT_PERI_EN_RSA); + DPORT_REG_CLR_BIT(DPORT_PERI_CLK_EN_REG, DPORT_PERI_EN_RSA); + + _lock_release(&mpi_lock); +} + + +/* Return the number of words actually used to represent an mpi + number. +*/ +static size_t mpi_words(const mbedtls_mpi *mpi) +{ + for (size_t i = mpi->n; i > 0; i--) { + if (mpi->p[i - 1] != 0) { + return i; + } + } + return 0; +} + +/* Copy mbedTLS MPI bignum 'mpi' to hardware memory block at 'mem_base'. + + If num_words is higher than the number of words in the bignum then + these additional words will be zeroed in the memory buffer. + + As this function only writes to DPORT memory, no DPORT_STALL_OTHER_CPU_START() + is required. +*/ +static inline void mpi_to_mem_block(uint32_t mem_base, const mbedtls_mpi *mpi, size_t num_words) +{ + uint32_t *pbase = (uint32_t *)mem_base; + uint32_t copy_words = num_words < mpi->n ? num_words : mpi->n; + + /* Copy MPI data to memory block registers */ + for (int i = 0; i < copy_words; i++) { + pbase[i] = mpi->p[i]; + } + + /* Zero any remaining memory block data */ + for (int i = copy_words; i < num_words; i++) { + pbase[i] = 0; + } + + /* Note: not executing memw here, can do it before we start a bignum operation */ +} + +/* Read mbedTLS MPI bignum back from hardware memory block. + + Reads num_words words from block. + + Can return a failure result if fails to grow the MPI result. + + Cannot be called inside DPORT_STALL_OTHER_CPU_START() (as may allocate memory). +*/ +static inline int mem_block_to_mpi(mbedtls_mpi *x, uint32_t mem_base, int num_words) +{ + int ret = 0; + + MBEDTLS_MPI_CHK( mbedtls_mpi_grow(x, num_words) ); + + /* Copy data from memory block registers */ + esp_dport_access_read_buffer(x->p, mem_base, num_words); + /* Zero any remaining limbs in the bignum, if the buffer is bigger + than num_words */ + for(size_t i = num_words; i < x->n; i++) { + x->p[i] = 0; + } + + asm volatile ("memw"); + cleanup: + return ret; +} + + +/** + * + * There is a need for the value of integer N' such that B^-1(B-1)-N^-1N'=1, + * where B^-1(B-1) mod N=1. Actually, only the least significant part of + * N' is needed, hence the definition N0'=N' mod b. We reproduce below the + * simple algorithm from an article by Dusse and Kaliski to efficiently + * find N0' from N0 and b + */ +static mbedtls_mpi_uint modular_inverse(const mbedtls_mpi *M) +{ + int i; + uint64_t t = 1; + uint64_t two_2_i_minus_1 = 2; /* 2^(i-1) */ + uint64_t two_2_i = 4; /* 2^i */ + uint64_t N = M->p[0]; + + for (i = 2; i <= 32; i++) { + if ((mbedtls_mpi_uint) N * t % two_2_i >= two_2_i_minus_1) { + t += two_2_i_minus_1; + } + + two_2_i_minus_1 <<= 1; + two_2_i <<= 1; + } + + return (mbedtls_mpi_uint)(UINT32_MAX - t + 1); +} + +/* Calculate Rinv = RR^2 mod M, where: + * + * R = b^n where b = 2^32, n=num_words, + * R = 2^N (where N=num_bits) + * RR = R^2 = 2^(2*N) (where N=num_bits=num_words*32) + * + * This calculation is computationally expensive (mbedtls_mpi_mod_mpi) + * so caller should cache the result where possible. + * + * DO NOT call this function while holding esp_mpi_acquire_hardware(). + * + */ +static int calculate_rinv(mbedtls_mpi *Rinv, const mbedtls_mpi *M, int num_words) +{ + int ret; + size_t num_bits = num_words * 32; + mbedtls_mpi RR; + mbedtls_mpi_init(&RR); + MBEDTLS_MPI_CHK(mbedtls_mpi_set_bit(&RR, num_bits * 2, 1)); + MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(Rinv, &RR, M)); + + cleanup: + mbedtls_mpi_free(&RR); + return ret; +} + + +/* Begin an RSA operation. op_reg specifies which 'START' register + to write to. + + Because the only DPORT operations here are writes, + does not need protecting via DPORT_STALL_OTHER_CPU_START(); +*/ +static inline void start_op(uint32_t op_reg) +{ + /* Clear interrupt status */ + DPORT_REG_WRITE(RSA_CLEAR_INTERRUPT_REG, 1); + + /* Note: above REG_WRITE includes a memw, so we know any writes + to the memory blocks are also complete. */ + + DPORT_REG_WRITE(op_reg, 1); +} + +/* Wait for an RSA operation to complete. + + This should NOT be called inside a DPORT_STALL_OTHER_CPU_START(), as it will stall the other CPU for an unacceptably long + period (and - depending on config - may require interrupts enabled). +*/ +static inline void wait_op_complete(uint32_t op_reg) +{ +#ifdef CONFIG_MBEDTLS_MPI_USE_INTERRUPT + if (!xSemaphoreTake(op_complete_sem, 2000 / portTICK_PERIOD_MS)) { + ESP_LOGE(TAG, "Timed out waiting for RSA operation (op_reg 0x%x int_reg 0x%x)", + op_reg, DPORT_REG_READ(RSA_QUERY_INTERRUPT_REG)); + abort(); /* indicates a fundamental problem with driver */ + } +#else + while(DPORT_REG_READ(RSA_QUERY_INTERRUPT_REG) != 1) + { } + + /* clear the interrupt */ + DPORT_REG_WRITE(RSA_CLEAR_INTERRUPT_REG, 1); +#endif + +} + +/* Z = (X * Y) mod M + + Not an mbedTLS function +*/ +int esp_mpi_mul_mpi_mod(mbedtls_mpi *Z, const mbedtls_mpi *X, const mbedtls_mpi *Y, const mbedtls_mpi *M) +{ + int ret; + size_t m_words = mpi_words(M); + mbedtls_mpi Rinv; + mbedtls_mpi_uint Mprime; + + size_t num_words = MAX(MAX(m_words, mpi_words(X)), mpi_words(Y)); + + if (num_words * 32 > 4096) { + return MBEDTLS_ERR_MPI_NOT_ACCEPTABLE; + } + + /* Calculate and load the first stage montgomery multiplication */ + mbedtls_mpi_init(&Rinv); + MBEDTLS_MPI_CHK(calculate_rinv(&Rinv, M, m_words)); + Mprime = modular_inverse(M); + + esp_mpi_acquire_hardware(); + + DPORT_REG_WRITE(RSA_LENGTH_REG, (num_words - 1)); + DPORT_REG_WRITE(RSA_M_DASH_REG, (uint32_t)Mprime); + + /* Load M, X, Rinv, Mprime (Mprime is mod 2^32) */ + mpi_to_mem_block(RSA_MEM_M_BLOCK_BASE, M, num_words); + mpi_to_mem_block(RSA_MEM_X_BLOCK_BASE, X, num_words); + mpi_to_mem_block(RSA_MEM_Y_BLOCK_BASE, Y, num_words); + mpi_to_mem_block(RSA_MEM_RB_BLOCK_BASE, &Rinv, num_words); + + /* Execute first stage montgomery multiplication */ + start_op(RSA_MOD_MULT_START_REG); + + wait_op_complete(RSA_MOD_MULT_START_REG); + + mem_block_to_mpi(Z, RSA_MEM_Z_BLOCK_BASE, m_words); + + esp_mpi_release_hardware(); + + cleanup: + mbedtls_mpi_free(&Rinv); + return ret; +} + +#if defined(MBEDTLS_MPI_EXP_MOD_ALT) + +/* + * Sliding-window exponentiation: Z = X^Y mod M (HAC 14.85) + * + * _Rinv is optional pre-calculated version of Rinv (via calculate_rinv()). + * + * (See RSA Accelerator section in Technical Reference for more about Mprime, Rinv) + * + */ +int mbedtls_mpi_exp_mod( mbedtls_mpi* Z, const mbedtls_mpi* X, const mbedtls_mpi* Y, const mbedtls_mpi* M, mbedtls_mpi* _Rinv ) +{ + int ret = 0; + size_t x_words = mpi_words(X); + size_t y_words = mpi_words(Y); + size_t m_words = mpi_words(M); + size_t num_words; + + mbedtls_mpi Rinv_new; /* used if _Rinv == NULL */ + mbedtls_mpi *Rinv; /* points to _Rinv (if not NULL) othwerwise &RR_new */ + mbedtls_mpi_uint Mprime; + + /* "all numbers must be the same length", so choose longest number + as cardinal length of operation... + */ + num_words = MAX(m_words, MAX(x_words, y_words)); + + if (num_words * 32 > 4096) { + return MBEDTLS_ERR_MPI_NOT_ACCEPTABLE; + } + + /* Determine RR pointer, either _RR for cached value + or local RR_new */ + if (_Rinv == NULL) { + mbedtls_mpi_init(&Rinv_new); + Rinv = &Rinv_new; + } else { + Rinv = _Rinv; + } + if (Rinv->p == NULL) { + MBEDTLS_MPI_CHK(calculate_rinv(Rinv, M, num_words)); + } + + Mprime = modular_inverse(M); + + esp_mpi_acquire_hardware(); + + DPORT_REG_WRITE(RSA_LENGTH_REG, num_words - 1); + + /* Load M, X, Rinv, M-prime (M-prime is mod 2^32) */ + mpi_to_mem_block(RSA_MEM_X_BLOCK_BASE, X, num_words); + mpi_to_mem_block(RSA_MEM_Y_BLOCK_BASE, Y, num_words); + mpi_to_mem_block(RSA_MEM_M_BLOCK_BASE, M, num_words); + mpi_to_mem_block(RSA_MEM_RB_BLOCK_BASE, Rinv, num_words); + DPORT_REG_WRITE(RSA_M_DASH_REG, Mprime); + + DPORT_REG_WRITE(RSA_CONSTANT_TIME_REG, 0); + DPORT_REG_WRITE(RSA_SEARCH_OPEN_REG, 1); + DPORT_REG_WRITE(RSA_SEARCH_POS_REG, (y_words * 32) - 1); + + start_op(RSA_MODEXP_START_REG); + wait_op_complete(RSA_MODEXP_START_REG); + + DPORT_REG_WRITE(RSA_SEARCH_OPEN_REG, 0); + DPORT_REG_WRITE(RSA_SEARCH_POS_REG, (m_words * 32) - 1); + + ret = mem_block_to_mpi(Z, RSA_MEM_Z_BLOCK_BASE, m_words); + + esp_mpi_release_hardware(); + + cleanup: + if (_Rinv == NULL) { + mbedtls_mpi_free(&Rinv_new); + } + + return ret; +} + +#endif /* MBEDTLS_MPI_EXP_MOD_ALT */ + +#if defined(MBEDTLS_MPI_MUL_MPI_ALT) /* MBEDTLS_MPI_MUL_MPI_ALT */ + +static int mpi_mult_mpi_failover_mod_mult(mbedtls_mpi *Z, const mbedtls_mpi *X, const mbedtls_mpi *Y, size_t num_words); +static int mpi_mult_mpi_overlong(mbedtls_mpi *Z, const mbedtls_mpi *X, const mbedtls_mpi *Y, size_t Y_bits, size_t words_result); + +/* Z = X * Y */ +int mbedtls_mpi_mul_mpi( mbedtls_mpi *Z, const mbedtls_mpi *X, const mbedtls_mpi *Y ) +{ + int ret = 0; + size_t bits_x, bits_y, words_x, words_y, words_mult, words_z; + + /* Count words needed for X & Y in hardware */ + bits_x = mbedtls_mpi_bitlen(X); + bits_y = mbedtls_mpi_bitlen(Y); + + words_x = (bits_x + 7) / 8; + words_y = (bits_y + 7) / 8; + + /* Short-circuit eval if either argument is 0 or 1. + + This is needed as the mpi modular division + argument will sometimes call in here when one + argument is too large for the hardware unit, but the other + argument is zero or one. + + This leaks some timing information, although overall there is a + lot less timing variation than a software MPI approach. + */ + if (bits_x == 0 || bits_y == 0) { + mbedtls_mpi_lset(Z, 0); + return 0; + } + if (bits_x == 1) { + ret = mbedtls_mpi_copy(Z, Y); + Z->s *= X->s; + return ret; + } + if (bits_y == 1) { + ret = mbedtls_mpi_copy(Z, X); + Z->s *= Y->s; + return ret; + } + + words_mult = (words_x > words_y ? words_x : words_y); + + /* Result Z has to have room for double the larger factor */ + words_z = words_mult * 2; + + /* If either factor is over 2048 bits, we can't use the standard hardware multiplier + (it assumes result is double longest factor, and result is max 4096 bits.) + + However, we can fail over to mod_mult for up to 4096 bits of result (modulo + multiplication doesn't have the same restriction, so result is simply the + number of bits in X plus number of bits in in Y.) + */ + if (words_mult * 32 > 2048) { + /* Calculate new length of Z */ + words_z = (bits_x + bits_y + 31) / 32; + if (words_z * 32 <= 4096) { + /* Note: it's possible to use mpi_mult_mpi_overlong + for this case as well, but it's very slightly + slower and requires a memory allocation. + */ + return mpi_mult_mpi_failover_mod_mult(Z, X, Y, words_z); + } else { + /* Still too long for the hardware unit... */ + if(bits_y > bits_x) { + return mpi_mult_mpi_overlong(Z, X, Y, bits_y, words_z); + } else { + return mpi_mult_mpi_overlong(Z, Y, X, bits_x, words_z); + } + } + } + + /* Otherwise, we can use the (faster) multiply hardware unit */ + + esp_mpi_acquire_hardware(); + + /* Copy X (right-extended) & Y (left-extended) to memory block */ + mpi_to_mem_block(RSA_MEM_X_BLOCK_BASE, X, words_mult); + mpi_to_mem_block(RSA_MEM_Z_BLOCK_BASE + words_mult * 4, Y, words_mult); + /* NB: as Y is left-extended, we don't zero the bottom words_mult words of Y block. + This is OK for now because zeroing is done by hardware when we do esp_mpi_acquire_hardware(). + */ + + DPORT_REG_WRITE(RSA_M_DASH_REG, 0); + DPORT_REG_WRITE(RSA_LENGTH_REG, (words_z - 1)); + start_op(RSA_MULT_START_REG); + + wait_op_complete(RSA_MULT_START_REG); + + /* Read back the result */ + ret = mem_block_to_mpi(Z, RSA_MEM_Z_BLOCK_BASE, words_z); + + Z->s = X->s * Y->s; + + esp_mpi_release_hardware(); + + return ret; +} + +/* Special-case of mbedtls_mpi_mult_mpi(), where we use hardware montgomery mod + multiplication to calculate an mbedtls_mpi_mult_mpi result where either + A or B are >2048 bits so can't use the standard multiplication method. + + Result (A bits + B bits) must still be less than 4096 bits. + + This case is simpler than the general case modulo multiply of + esp_mpi_mul_mpi_mod() because we can control the other arguments: + + * Modulus is chosen with M=(2^num_bits - 1) (ie M=R-1), so output + isn't actually modulo anything. + * Mprime and Rinv are therefore predictable as follows: + Mprime = 1 + Rinv = 1 + + (See RSA Accelerator section in Technical Reference for more about Mprime, Rinv) +*/ +static int mpi_mult_mpi_failover_mod_mult(mbedtls_mpi *Z, const mbedtls_mpi *X, const mbedtls_mpi *Y, size_t num_words) +{ + int ret = 0; + + /* Load coefficients to hardware */ + esp_mpi_acquire_hardware(); + + /* M = 2^num_words - 1, so block is entirely FF */ + for(int i = 0; i < num_words; i++) { + DPORT_REG_WRITE(RSA_MEM_M_BLOCK_BASE + i * 4, UINT32_MAX); + } + + /* Mprime = 1 */ + DPORT_REG_WRITE(RSA_M_DASH_REG, 1); + DPORT_REG_WRITE(RSA_LENGTH_REG, num_words -1); + + /* Load X & Y */ + mpi_to_mem_block(RSA_MEM_X_BLOCK_BASE, X, num_words); + mpi_to_mem_block(RSA_MEM_Y_BLOCK_BASE, Y, num_words); + + /* Rinv = 1 */ + DPORT_REG_WRITE(RSA_MEM_RB_BLOCK_BASE, 1); + for(int i = 1; i < num_words; i++) { + DPORT_REG_WRITE(RSA_MEM_RB_BLOCK_BASE + i * 4, 0); + } + + start_op(RSA_MOD_MULT_START_REG); + wait_op_complete(RSA_MOD_MULT_START_REG); + + mem_block_to_mpi(Z, RSA_MEM_Z_BLOCK_BASE, num_words); + + esp_mpi_release_hardware(); + + return ret; +} + +/* Deal with the case when X & Y are too long for the hardware unit, by splitting one operand + into two halves. + + Y must be the longer operand + + Slice Y into Yp, Ypp such that: + Yp = lower 'b' bits of Y + Ypp = upper 'b' bits of Y (right shifted) + + Such that + Z = X * Y + Z = X * (Yp + Ypp<p, + .n = limbs_slice, + .s = Y->s + }; + /* Ypp holds upper bits of Y, right shifted (also reuses Y's array contents) */ + const mbedtls_mpi Ypp = { + .p = Y->p + limbs_slice, + .n = limbs_y - limbs_slice, + .s = Y->s + }; + mbedtls_mpi_init(&Ztemp); + + /* Grow Z to result size early, avoid interim allocations */ + mbedtls_mpi_grow(Z, words_result); + + /* Get result Ztemp = Yp * X (need temporary variable Ztemp) */ + MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi(&Ztemp, X, &Yp) ); + + /* Z = Ypp * Y */ + MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi(Z, X, &Ypp) ); + + /* Z = Z << b */ + MBEDTLS_MPI_CHK( mbedtls_mpi_shift_l(Z, limbs_slice * biL) ); + + /* Z += Ztemp */ + MBEDTLS_MPI_CHK( mbedtls_mpi_add_mpi(Z, Z, &Ztemp) ); + + cleanup: + mbedtls_mpi_free(&Ztemp); + + return ret; +} + +#endif /* MBEDTLS_MPI_MUL_MPI_ALT */ + diff --git a/components/mbedtls/port/esp32s2beta/sha.c b/components/mbedtls/port/esp32s2beta/sha.c new file mode 100644 index 0000000000..d083d78167 --- /dev/null +++ b/components/mbedtls/port/esp32s2beta/sha.c @@ -0,0 +1,183 @@ +/* + * ESP32 hardware accelerated SHA1/256/512 implementation + * based on mbedTLS FIPS-197 compliant version. + * + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * Additions Copyright (C) 2016, Espressif Systems (Shanghai) PTE Ltd + * SPDX-License-Identifier: Apache-2.0 + * + * 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 SHA-1 standard was published by NIST in 1993. + * + * http://www.itl.nist.gov/fipspubs/fip180-1.htm + */ + +#include +#include +#include +#include + +#include "esp32s2beta/sha.h" +#include "esp32s2beta/rom/ets_sys.h" +#include "soc/dport_reg.h" +#include "soc/hwcrypto_reg.h" + +/* Single lock for SHA engine +*/ +static _lock_t s_sha_lock; + +/* This API was designed for ESP32, which has seperate + engines for SHA1,256,512. ESP32C has a single engine. +*/ + +/* Return block size (in bytes) for a given SHA type */ +inline static size_t block_length(esp_sha_type type) { + switch(type) { + case SHA1: + case SHA2_224: + case SHA2_256: + return 64; + case SHA2_384: + case SHA2_512: + return 128; + default: + return 0; + } +} + +/* Return state size (in bytes) for a given SHA type */ +inline static size_t state_length(esp_sha_type type) { + switch(type) { + case SHA1: + return 160/8; + case SHA2_224: + case SHA2_256: + return 256/8; + case SHA2_384: + case SHA2_512: + return 512/8; + default: + return 0; + } +} + +/* Copy words in memory (to/from a memory block), byte swapping as we go. */ +static void memcpy_endianswap(void *to, const void *from, size_t num_bytes) +{ + uint32_t *to_words = (uint32_t *)to; + const uint32_t *from_words = (const uint32_t *)from; + assert(num_bytes % 4 == 0); + for (int i = 0; i < num_bytes / 4; i++) { + to_words[i] = __builtin_bswap32(from_words[i]); + } + asm volatile ("memw"); +} + +static void memcpy_swapwords(void *to, const void *from, size_t num_bytes) +{ + uint32_t *to_words = (uint32_t *)to; + const uint32_t *from_words = (const uint32_t *)from; + assert(num_bytes % 8 == 0); + for (int i = 0; i < num_bytes / 4; i += 2) { + to_words[i] = from_words[i+1]; + to_words[i+1] = from_words[i]; + } + asm volatile ("memw"); +} + +static void esp_sha_lock_engine_inner(void); + +bool esp_sha_try_lock_engine(esp_sha_type sha_type) +{ + if(_lock_try_acquire(&s_sha_lock) != 0) { + /* SHA engine is already in use */ + return false; + } else { + esp_sha_lock_engine_inner(); + return true; + } +} + +void esp_sha_lock_engine(esp_sha_type sha_type) +{ + _lock_acquire(&s_sha_lock); + esp_sha_lock_engine_inner(); +} + +static void esp_sha_lock_engine_inner(void) +{ + ets_sha_enable(); +} + +void esp_sha_unlock_engine(esp_sha_type sha_type) +{ + ets_sha_disable(); + _lock_release(&s_sha_lock); +} + +void esp_sha_wait_idle(void) +{ + while(DPORT_REG_READ(SHA_BUSY_REG) != 0) { } +} + +void esp_sha_read_digest_state(esp_sha_type sha_type, void *digest_state) +{ + /* engine should be locked */ + esp_sha_wait_idle(); + if (sha_type != SHA2_512 && sha_type != SHA2_384) { + /* action_queue); free_lock: vSemaphoreDelete(_mdns_server->lock); @@ -4277,7 +4285,9 @@ void mdns_free(void) vSemaphoreDelete(_mdns_server->lock); esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler); esp_event_handler_unregister(IP_EVENT, ESP_EVENT_ANY_ID, &event_handler); +#if CONFIG_ETH_ENABLED esp_event_handler_unregister(ETH_EVENT, ESP_EVENT_ANY_ID, &event_handler); +#endif free(_mdns_server); _mdns_server = NULL; } diff --git a/components/mdns/private_include/mdns_networking.h b/components/mdns/private_include/mdns_networking.h index 1d13e308f9..6b32ec7f13 100644 --- a/components/mdns/private_include/mdns_networking.h +++ b/components/mdns/private_include/mdns_networking.h @@ -3,7 +3,7 @@ /* * MDNS Server Networking -- private include - * + * */ #include "mdns.h" #include "mdns_private.h" @@ -21,7 +21,9 @@ #include "esp_system.h" #include "esp_timer.h" #include "esp_event.h" +#if CONFIG_ETH_ENABLED #include "esp_eth.h" +#endif /** diff --git a/components/mqtt/weekend_test/mqtt_publish_test.py b/components/mqtt/weekend_test/mqtt_publish_test.py index 7b738a81a5..55e04074cf 100644 --- a/components/mqtt/weekend_test/mqtt_publish_test.py +++ b/components/mqtt/weekend_test/mqtt_publish_test.py @@ -13,6 +13,7 @@ import random try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -137,7 +138,7 @@ def test_weekend_mqtt_publish(env, extra_data): 3. Test evaluates python client received correct qos0 message 4. Test ESP32 client received correct qos0 message """ - dut1 = env.get_dut("mqtt_publish", "examples/protocols/mqtt/publish_test") + dut1 = env.get_dut("mqtt_publish", "examples/protocols/mqtt/publish_test", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "mqtt_publish.bin") bin_size = os.path.getsize(binary_file) diff --git a/components/newlib/test/test_newlib.c b/components/newlib/test/test_newlib.c index 12a10e4d53..41f72329bf 100644 --- a/components/newlib/test/test_newlib.c +++ b/components/newlib/test/test_newlib.c @@ -125,14 +125,14 @@ static bool fn_in_rom(void *fn, const char *name) TEST_CASE("check if ROM or Flash is used for functions", "[newlib]") { -#if defined(CONFIG_NEWLIB_NANO_FORMAT) && !defined(CONFIG_ESP32_SPIRAM_SUPPORT) +#if defined(CONFIG_NEWLIB_NANO_FORMAT) && !defined(CONFIG_SPIRAM) TEST_ASSERT(fn_in_rom(printf, "printf")); TEST_ASSERT(fn_in_rom(sscanf, "sscanf")); #else TEST_ASSERT_FALSE(fn_in_rom(printf, "printf")); TEST_ASSERT_FALSE(fn_in_rom(sscanf, "sscanf")); #endif -#if !defined(CONFIG_ESP32_SPIRAM_SUPPORT) +#if !defined(CONFIG_SPIRAM) TEST_ASSERT(fn_in_rom(atoi, "atoi")); TEST_ASSERT(fn_in_rom(strtol, "strtol")); #else diff --git a/components/newlib/test/test_time.c b/components/newlib/test/test_time.c index 57150d852a..85d6a72415 100644 --- a/components/newlib/test/test_time.c +++ b/components/newlib/test/test_time.c @@ -9,7 +9,6 @@ #include "freertos/semphr.h" #include "sdkconfig.h" #include "soc/rtc.h" -#include "esp32/clk.h" #include "esp_system.h" #include "test_utils.h" @@ -317,11 +316,11 @@ TEST_CASE("test time adjustment happens linearly", "[newlib][timeout=35]") } #endif -#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) +#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 ) #define WITH_RTC 1 #endif -#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) +#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_FRC1 ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 ) #define WITH_FRC 1 #endif void test_posix_timers_clock (void) diff --git a/components/newlib/time.c b/components/newlib/time.c index ffa9e4dd6f..22e4203073 100644 --- a/components/newlib/time.c +++ b/components/newlib/time.c @@ -22,26 +22,32 @@ #include #include #include -#include #include "esp_attr.h" #include "esp_intr_alloc.h" -#include "esp32/clk.h" #include "esp_timer.h" #include "soc/soc.h" #include "soc/rtc.h" #include "soc/frc_timer_reg.h" -#include "esp32/rom/ets_sys.h" #include "freertos/FreeRTOS.h" #include "freertos/xtensa_api.h" #include "freertos/task.h" -#include "sdkconfig.h" #include "limits.h" +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/ets_sys.h" +#include "esp32/clk.h" +#include "esp32/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/clk.h" +#include "esp32s2beta/rom/rtc.h" +#include "esp32s2beta/rom/ets_sys.h" +#endif -#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) +#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 ) #define WITH_RTC 1 #endif -#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) +#if defined( CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_FRC1 ) || defined( CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 ) #define WITH_FRC 1 #endif diff --git a/components/nvs_flash/include/nvs.h b/components/nvs_flash/include/nvs.h index c6de4abe3e..4ae824d471 100644 --- a/components/nvs_flash/include/nvs.h +++ b/components/nvs_flash/include/nvs.h @@ -205,7 +205,7 @@ esp_err_t nvs_set_u32 (nvs_handle_t handle, const char* key, uint32_t value); esp_err_t nvs_set_i64 (nvs_handle_t handle, const char* key, int64_t value); esp_err_t nvs_set_u64 (nvs_handle_t handle, const char* key, uint64_t value); esp_err_t nvs_set_str (nvs_handle_t handle, const char* key, const char* value); -/**@}*/ +/**@}*/ /** * @brief set variable length binary value for given key @@ -282,7 +282,7 @@ esp_err_t nvs_get_i32 (nvs_handle_t handle, const char* key, int32_t* out_value) esp_err_t nvs_get_u32 (nvs_handle_t handle, const char* key, uint32_t* out_value); esp_err_t nvs_get_i64 (nvs_handle_t handle, const char* key, int64_t* out_value); esp_err_t nvs_get_u64 (nvs_handle_t handle, const char* key, uint64_t* out_value); -/**@}*/ +/**@}*/ /** * @brief get value for given key diff --git a/components/nvs_flash/test_nvs_host/Makefile b/components/nvs_flash/test_nvs_host/Makefile index d509fd6ee3..717e2c5104 100644 --- a/components/nvs_flash/test_nvs_host/Makefile +++ b/components/nvs_flash/test_nvs_host/Makefile @@ -21,7 +21,7 @@ SOURCE_FILES = \ crc.cpp \ main.cpp -CPPFLAGS += -I../include -I../src -I./ -I../../esp_common/include -I../../esp32/include -I ../../mbedtls/mbedtls/include -I ../../spi_flash/include -I ../../soc/include -I ../../../tools/catch -fprofile-arcs -ftest-coverage +CPPFLAGS += -I../include -I../src -I./ -I../../esp_common/include -I../../esp32/include -I ../../mbedtls/mbedtls/include -I ../../spi_flash/include -I ../../soc/include -I ../../xtensa/include -I ../../../tools/catch -fprofile-arcs -ftest-coverage CFLAGS += -fprofile-arcs -ftest-coverage CXXFLAGS += -std=c++11 -Wall -Werror LDFLAGS += -lstdc++ -Wall -fprofile-arcs -ftest-coverage diff --git a/components/protocomm/test/test_protocomm.c b/components/protocomm/test/test_protocomm.c index 33d547b3d5..1523ddf405 100644 --- a/components/protocomm/test/test_protocomm.c +++ b/components/protocomm/test/test_protocomm.c @@ -1098,7 +1098,7 @@ static esp_err_t test_security0 (void) return ESP_OK; } -TEST_CASE("leak test", "[PROTOCOMM]") +TEST_CASE_ESP32("leak test", "[PROTOCOMM]") { #ifdef CONFIG_HEAP_TRACING heap_trace_init_standalone(trace_record, NUM_RECORDS); @@ -1144,17 +1144,17 @@ TEST_CASE("security 0 basic test", "[PROTOCOMM]") TEST_ASSERT(test_security0() == ESP_OK); } -TEST_CASE("security 1 basic test", "[PROTOCOMM]") +TEST_CASE_ESP32("security 1 basic test", "[PROTOCOMM]") { TEST_ASSERT(test_security1() == ESP_OK); } -TEST_CASE("security 1 no encryption test", "[PROTOCOMM]") +TEST_CASE_ESP32("security 1 no encryption test", "[PROTOCOMM]") { TEST_ASSERT(test_security1_no_encryption() == ESP_OK); } -TEST_CASE("security 1 session overflow test", "[PROTOCOMM]") +TEST_CASE_ESP32("security 1 session overflow test", "[PROTOCOMM]") { TEST_ASSERT(test_security1_session_overflow() == ESP_OK); } @@ -1164,12 +1164,12 @@ TEST_CASE("security 1 wrong pop test", "[PROTOCOMM]") TEST_ASSERT(test_security1_wrong_pop() == ESP_OK); } -TEST_CASE("security 1 insecure client test", "[PROTOCOMM]") +TEST_CASE_ESP32("security 1 insecure client test", "[PROTOCOMM]") { TEST_ASSERT(test_security1_insecure_client() == ESP_OK); } -TEST_CASE("security 1 weak session test", "[PROTOCOMM]") +TEST_CASE_ESP32("security 1 weak session test", "[PROTOCOMM]") { TEST_ASSERT(test_security1_weak_session() == ESP_OK); } diff --git a/components/pthread/pthread.c b/components/pthread/pthread.c index 40caf9e12e..7be44b2b9b 100644 --- a/components/pthread/pthread.c +++ b/components/pthread/pthread.c @@ -504,13 +504,13 @@ int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)) } uint32_t res = 1; -#if defined(CONFIG_ESP32_SPIRAM_SUPPORT) +#if defined(CONFIG_SPIRAM) if (esp_ptr_external_ram(once_control)) { uxPortCompareSetExtram((uint32_t *) &once_control->init_executed, 0, &res); } else { #endif uxPortCompareSet((uint32_t *) &once_control->init_executed, 0, &res); -#if defined(CONFIG_ESP32_SPIRAM_SUPPORT) +#if defined(CONFIG_SPIRAM) } #endif // Check if compare and set was successful diff --git a/components/sdmmc/test/CMakeLists.txt b/components/sdmmc/test/CMakeLists.txt index c7c2d52a9b..43d6f24a50 100644 --- a/components/sdmmc/test/CMakeLists.txt +++ b/components/sdmmc/test/CMakeLists.txt @@ -1,3 +1,5 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." - REQUIRES unity sdmmc) \ No newline at end of file +if(IDF_TARGET STREQUAL "esp32") + idf_component_register(SRC_DIRS "." + INCLUDE_DIRS "." + REQUIRES unity sdmmc) +endif() \ No newline at end of file diff --git a/components/sdmmc/test/test_sd.c b/components/sdmmc/test/test_sd.c index 29ce04a283..4f9d2f1d98 100644 --- a/components/sdmmc/test/test_sd.c +++ b/components/sdmmc/test/test_sd.c @@ -28,7 +28,7 @@ #include // Can't test eMMC (slot 0) and PSRAM together -#ifndef CONFIG_ESP32_SPIRAM_SUPPORT +#ifndef CONFIG_SPIRAM #define WITH_EMMC_TEST #endif diff --git a/components/sdmmc/test/test_sdio.c b/components/sdmmc/test/test_sdio.c index 0e5be1d6fd..3622932dca 100644 --- a/components/sdmmc/test/test_sdio.c +++ b/components/sdmmc/test/test_sdio.c @@ -40,7 +40,6 @@ /* TODO: add SDIO slave header files, remove these definitions */ -#define DR_REG_SLC_BASE 0x3ff58000 #define DR_REG_SLC_MASK 0xfffffc00 #define SLCCONF1 (DR_REG_SLC_BASE + 0x60) @@ -52,7 +51,6 @@ #define SLC_SLC0_TXLINK_RESTART (BIT(30)) #define SLC_SLC0_TXLINK_START (BIT(29)) -#define DR_REG_SLCHOST_BASE 0x3ff55000 #define DR_REG_SLCHOST_MASK 0xfffffc00 #define SLCHOST_STATE_W0 (DR_REG_SLCHOST_BASE + 0x64) #define SLCHOST_CONF_W0 (DR_REG_SLCHOST_BASE + 0x6C) diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index 11bbbd0d4c..83c0dbb931 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -9,7 +9,7 @@ if(EXISTS "${COMPONENT_DIR}/${soc_name}") endif() list(APPEND include_dirs include) -list(APPEND srcs +list(APPEND srcs "src/memory_layout_utils.c" "src/lldesc.c" "src/hal/spi_hal.c" @@ -17,10 +17,16 @@ list(APPEND srcs "src/hal/spi_slave_hal.c" "src/hal/spi_slave_hal_iram.c" "src/soc_include_legacy_warn.c" - "src/hal/spi_flash_hal.c" - "src/hal/spi_flash_hal_iram.c" ) +# TODO: SPI Flash HAL for ESP32S2Beta also +if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcs "src/hal/spi_flash_hal.c" + "src/hal/spi_flash_hal_iram.c" + ) +endif() + idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "${include_dirs}" - LDFRAGMENTS linker.lf) + INCLUDE_DIRS "${include_dirs}" + PRIV_REQUIRES ${soc_name} + LDFRAGMENTS linker.lf) diff --git a/components/soc/component.mk b/components/soc/component.mk index 22d239cbe0..9aed53c285 100644 --- a/components/soc/component.mk +++ b/components/soc/component.mk @@ -5,4 +5,5 @@ COMPONENT_SRCDIRS := $(SOC_NAME) src src/hal COMPONENT_ADD_INCLUDEDIRS := $(SOC_NAME)/include include -include $(COMPONENT_PATH)/$(SOC_NAME)/component.mk + COMPONENT_ADD_LDFRAGMENTS += linker.lf diff --git a/components/soc/esp32/i2s_periph.c b/components/soc/esp32/i2s_periph.c new file mode 100644 index 0000000000..cd9fef98e5 --- /dev/null +++ b/components/soc/esp32/i2s_periph.c @@ -0,0 +1,50 @@ +// 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. + +#include "soc/i2s_periph.h" +#include "soc/gpio_sig_map.h" + +/* + Bunch of constants for every I2S peripheral: GPIO signals, irqs, hw addr of registers etc +*/ +const i2s_signal_conn_t i2s_periph_signal[SOC_I2S_PERIPH_NUM] = { + { + .o_bck_in_sig = I2S0O_BCK_IN_IDX, + .o_ws_in_sig = I2S0O_WS_IN_IDX, + .o_bck_out_sig = I2S0O_BCK_OUT_IDX, + .o_ws_out_sig = I2S0O_WS_OUT_IDX, + .o_data_out_sig = I2S0O_DATA_OUT23_IDX, + .i_bck_in_sig = I2S0I_BCK_OUT_IDX, + .i_ws_in_sig = I2S0I_WS_OUT_IDX, + .i_bck_out_sig = I2S0I_BCK_IN_IDX, + .i_ws_out_sig = I2S0I_WS_IN_IDX, + .i_data_in_sig = I2S0I_DATA_IN15_IDX, + .irq = ETS_I2S0_INTR_SOURCE, + .module = PERIPH_I2S0_MODULE, + }, + { + .o_bck_in_sig = I2S1O_BCK_IN_IDX, + .o_ws_in_sig = I2S1O_WS_IN_IDX, + .o_bck_out_sig = I2S1O_BCK_OUT_IDX, + .o_ws_out_sig = I2S1O_WS_OUT_IDX, + .o_data_out_sig = I2S1O_DATA_OUT23_IDX, + .i_bck_in_sig = I2S1I_BCK_OUT_IDX, + .i_ws_in_sig = I2S1I_WS_OUT_IDX, + .i_bck_out_sig = I2S1I_BCK_IN_IDX, + .i_ws_out_sig = I2S1I_WS_IN_IDX, + .i_data_in_sig = I2S1I_DATA_IN15_IDX, + .irq = ETS_I2S1_INTR_SOURCE, + .module = PERIPH_I2S1_MODULE, + } +}; diff --git a/components/soc/include/hal/spi_ll.h b/components/soc/esp32/include/hal/spi_ll.h similarity index 98% rename from components/soc/include/hal/spi_ll.h rename to components/soc/esp32/include/hal/spi_ll.h index 0213d6dc12..aaa4fa7aba 100644 --- a/components/soc/include/hal/spi_ll.h +++ b/components/soc/esp32/include/hal/spi_ll.h @@ -36,6 +36,8 @@ /// Swap the bit order to its correct place to send #define HAL_SPI_SWAP_DATA_TX(data, len) HAL_SWAP32((uint32_t)data<<(32-len)) +#define SPI_LL_GET_HW(ID) ((ID)==0? &SPI1:((ID)==1? &SPI2 : &SPI3)) + /** * The data structure holding calculated clock configuration. Since the * calculation needs long time, it should be calculated during initialization and @@ -52,6 +54,12 @@ typedef enum { SPI_LL_IO_MODE_QUAD, ///< 4-bit mode for data phases only, 1-bit mode for command and address phases } spi_ll_io_mode_t; +/// Interrupt type for different working pattern +typedef enum { + SPI_LL_INT_TYPE_NORMAL = 0, ///< Typical pattern, only wait for trans done +} spi_ll_slave_intr_type; + + /*------------------------------------------------------------------------------ * Control *----------------------------------------------------------------------------*/ @@ -259,6 +267,10 @@ static inline void spi_ll_enable_int(spi_dev_t *hw) hw->slave.trans_inten = 1; } +static inline void spi_ll_slave_set_int_type(spi_dev_t *hw, spi_ll_slave_intr_type int_type) +{ + hw->slave.trans_inten = 1; +} /*------------------------------------------------------------------------------ * Configs: mode diff --git a/components/soc/esp32/include/soc/dport_reg.h b/components/soc/esp32/include/soc/dport_reg.h index ef223f3f68..b9f2c31e20 100644 --- a/components/soc/esp32/include/soc/dport_reg.h +++ b/components/soc/esp32/include/soc/dport_reg.h @@ -19,7 +19,7 @@ #ifndef __ASSEMBLER__ #include "dport_access.h" #endif - + /* Registers defined in this header file must be accessed using special macros, * prefixed with DPORT_. See soc/dport_access.h file for details. */ @@ -1084,7 +1084,7 @@ #define DPORT_BT_RST (BIT(3)) #define DPORT_MAC_RST (BIT(2)) #define DPORT_FE_RST (BIT(1)) -#define DPORT_BB_RST (BIT(0)) +#define DPORT_BB_RST (BIT(0)) #define DPORT_BT_LPCK_DIV_INT_REG (DR_REG_DPORT_BASE + 0x0D4) /* DPORT_BTEXTWAKEUP_REQ : R/W ;bitpos:[12] ;default: 1'b0 ; */ @@ -4277,6 +4277,8 @@ #define DPORT_FLASH_MMU_TABLE_INVALID_VAL 0x100 +#define DPORT_MMU_ADDRESS_MASK 0xff + #endif /*_SOC_DPORT_REG_H_ */ diff --git a/components/soc/esp32/include/soc/hwcrypto_reg.h b/components/soc/esp32/include/soc/hwcrypto_reg.h index d0dfa74858..1db081f2b1 100644 --- a/components/soc/esp32/include/soc/hwcrypto_reg.h +++ b/components/soc/esp32/include/soc/hwcrypto_reg.h @@ -26,16 +26,22 @@ #define RSA_M_DASH_REG (DR_REG_RSA_BASE + 0x800) #define RSA_MODEXP_MODE_REG (DR_REG_RSA_BASE + 0x804) -#define RSA_START_MODEXP_REG (DR_REG_RSA_BASE + 0x808) +#define RSA_MODEXP_START_REG (DR_REG_RSA_BASE + 0x808) #define RSA_MULT_MODE_REG (DR_REG_RSA_BASE + 0x80c) #define RSA_MULT_START_REG (DR_REG_RSA_BASE + 0x810) -#define RSA_INTERRUPT_REG (DR_REG_RSA_BASE + 0x814) +#define RSA_CLEAR_INTERRUPT_REG (DR_REG_RSA_BASE + 0x814) +#define RSA_QUERY_INTERRUPT_REG (DR_REG_RSA_BASE + 0x814) /* same */ -#define RSA_CLEAN_REG (DR_REG_RSA_BASE + 0x818) +#define RSA_QUERY_CLEAN_REG (DR_REG_RSA_BASE + 0x818) + +/* Backwards compatibility register names used pre-ESP32S2 */ +#define RSA_CLEAN_REG (RSA_QUERY_CLEAN_REG) +#define RSA_INTERRUPT_REG (RSA_CLEAR_INTERRUPT_REG) +#define RSA_START_MODEXP_REG (RSA_MODEXP_START_REG) /* SHA acceleration registers */ -#define SHA_TEXT_BASE ((DR_REG_SHA_BASE) + 0x00) +#define SHA_TEXT_BASE ((DR_REG_SHA_BASE) + 0x00) #define SHA_1_START_REG ((DR_REG_SHA_BASE) + 0x80) #define SHA_1_CONTINUE_REG ((DR_REG_SHA_BASE) + 0x84) diff --git a/components/soc/esp32/include/soc/i2s_caps.h b/components/soc/esp32/include/soc/i2s_caps.h new file mode 100644 index 0000000000..bddde5c613 --- /dev/null +++ b/components/soc/esp32/include/soc/i2s_caps.h @@ -0,0 +1,18 @@ +// 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. + +#pragma once + +#define SOC_I2S_PERIPH_NUM (2) //ESP32 have 2 I2S +#define SOC_I2S_SUPPORT_PDM (1) //ESP32 support PDM diff --git a/components/soc/esp32/include/soc/io_mux_reg.h b/components/soc/esp32/include/soc/io_mux_reg.h index 579134be2b..22ea25b91f 100644 --- a/components/soc/esp32/include/soc/io_mux_reg.h +++ b/components/soc/esp32/include/soc/io_mux_reg.h @@ -81,6 +81,13 @@ #define PIN_FUNC_GPIO 2 +#define SPI_CLK_GPIO_NUM 6 +#define SPI_CS0_GPIO_NUM 11 +#define SPI_Q_GPIO_NUM 7 +#define SPI_D_GPIO_NUM 8 +#define SPI_WP_GPIO_NUM 10 +#define SPI_HD_GPIO_NUM 9 + #define PIN_CTRL (DR_REG_IO_MUX_BASE +0x00) #define CLK_OUT3 0xf #define CLK_OUT3_V CLK_OUT3 diff --git a/components/soc/esp32/include/soc/rtc_gpio_channel.h b/components/soc/esp32/include/soc/rtc_gpio_channel.h index c5107a0fb1..2a87209e11 100644 --- a/components/soc/esp32/include/soc/rtc_gpio_channel.h +++ b/components/soc/esp32/include/soc/rtc_gpio_channel.h @@ -15,6 +15,8 @@ #ifndef _SOC_RTC_GPIO_CHANNEL_H #define _SOC_RTC_GPIO_CHANNEL_H +#define RTC_GPIO_NUMBER 18 + //RTC GPIO channels #define RTCIO_GPIO36_CHANNEL 0 //RTCIO_CHANNEL_0 #define RTCIO_CHANNEL_0_GPIO_NUM 36 diff --git a/components/soc/esp32/include/soc/soc.h b/components/soc/esp32/include/soc/soc.h index 419cf49b7f..603408795b 100644 --- a/components/soc/esp32/include/soc/soc.h +++ b/components/soc/esp32/include/soc/soc.h @@ -25,19 +25,6 @@ #define PRO_CPU_NUM (0) #define APP_CPU_NUM (1) -/* Overall memory map */ -#define SOC_IROM_LOW 0x400D0000 -#define SOC_IROM_HIGH 0x40400000 -#define SOC_DROM_LOW 0x3F400000 -#define SOC_DROM_HIGH 0x3F800000 -#define SOC_DRAM_LOW 0x3FFAE000 -#define SOC_DRAM_HIGH 0x40000000 -#define SOC_RTC_IRAM_LOW 0x400C0000 -#define SOC_RTC_IRAM_HIGH 0x400C2000 -#define SOC_RTC_DATA_LOW 0x50000000 -#define SOC_RTC_DATA_HIGH 0x50002000 -#define SOC_EXTRAM_DATA_LOW 0x3F800000 -#define SOC_EXTRAM_DATA_HIGH 0x3FC00000 #define SOC_MAX_CONTIGUOUS_RAM_SIZE 0x400000 ///< Largest span of contiguous memory (DRAM or IRAM) in the address space @@ -246,30 +233,34 @@ //}} /* Overall memory map */ -#define SOC_DROM_LOW 0x3F400000 -#define SOC_DROM_HIGH 0x3F800000 -#define SOC_IROM_LOW 0x400D0000 -#define SOC_IROM_HIGH 0x40400000 -#define SOC_IROM_MASK_LOW 0x40000000 -#define SOC_IROM_MASK_HIGH 0x40070000 -#define SOC_CACHE_PRO_LOW 0x40070000 -#define SOC_CACHE_PRO_HIGH 0x40078000 -#define SOC_CACHE_APP_LOW 0x40078000 -#define SOC_CACHE_APP_HIGH 0x40080000 -#define SOC_IRAM_LOW 0x40080000 -#define SOC_IRAM_HIGH 0x400A0000 -#define SOC_RTC_IRAM_LOW 0x400C0000 -#define SOC_RTC_IRAM_HIGH 0x400C2000 -#define SOC_RTC_DRAM_LOW 0x3FF80000 -#define SOC_RTC_DRAM_HIGH 0x3FF82000 -#define SOC_RTC_DATA_LOW 0x50000000 -#define SOC_RTC_DATA_HIGH 0x50002000 +#define SOC_DROM_LOW 0x3F400000 +#define SOC_DROM_HIGH 0x3F800000 +#define SOC_DRAM_LOW 0x3FFAE000 +#define SOC_DRAM_HIGH 0x40000000 +#define SOC_IROM_LOW 0x400D0000 +#define SOC_IROM_HIGH 0x40400000 +#define SOC_IROM_MASK_LOW 0x40000000 +#define SOC_IROM_MASK_HIGH 0x40070000 +#define SOC_CACHE_PRO_LOW 0x40070000 +#define SOC_CACHE_PRO_HIGH 0x40078000 +#define SOC_CACHE_APP_LOW 0x40078000 +#define SOC_CACHE_APP_HIGH 0x40080000 +#define SOC_IRAM_LOW 0x40080000 +#define SOC_IRAM_HIGH 0x400A0000 +#define SOC_RTC_IRAM_LOW 0x400C0000 +#define SOC_RTC_IRAM_HIGH 0x400C2000 +#define SOC_RTC_DRAM_LOW 0x3FF80000 +#define SOC_RTC_DRAM_HIGH 0x3FF82000 +#define SOC_RTC_DATA_LOW 0x50000000 +#define SOC_RTC_DATA_HIGH 0x50002000 +#define SOC_EXTRAM_DATA_LOW 0x3F800000 +#define SOC_EXTRAM_DATA_HIGH 0x3FC00000 //First and last words of the D/IRAM region, for both the DRAM address as well as the IRAM alias. #define SOC_DIRAM_IRAM_LOW 0x400A0000 -#define SOC_DIRAM_IRAM_HIGH 0x400BFFFC +#define SOC_DIRAM_IRAM_HIGH 0x400C0000 #define SOC_DIRAM_DRAM_LOW 0x3FFE0000 -#define SOC_DIRAM_DRAM_HIGH 0x3FFFFFFC +#define SOC_DIRAM_DRAM_HIGH 0x40000000 // Region of memory accessible via DMA. See esp_ptr_dma_capable(). #define SOC_DMA_LOW 0x3FFAE000 @@ -355,6 +346,7 @@ #define ETS_MMU_IA_INTR_SOURCE 66/**< interrupt of MMU Invalid Access, LEVEL*/ #define ETS_MPU_IA_INTR_SOURCE 67/**< interrupt of MPU Invalid Access, LEVEL*/ #define ETS_CACHE_IA_INTR_SOURCE 68/**< interrupt of Cache Invalied Access, LEVEL*/ +#define ETS_MAX_INTR_SOURCE 69/**< total number of interrupt sources*/ //interrupt cpu using table, Please see the core-isa.h /************************************************************************************************************* diff --git a/components/soc/esp32/include/soc/soc_caps.h b/components/soc/esp32/include/soc/soc_caps.h new file mode 100644 index 0000000000..224c2657d3 --- /dev/null +++ b/components/soc/esp32/include/soc/soc_caps.h @@ -0,0 +1,8 @@ +// The long term plan is to have a single soc_caps.h for each peripheral. +// During the refactoring and multichip support development process, we +// seperate these information into periph_caps.h for each peripheral and +// include them here. + +#define SOC_MCPWM_SUPPORTED 1 +#define SOC_SDMMC_HOST_SUPPORTED 1 +#define SOC_BT_SUPPORTED 1 \ No newline at end of file diff --git a/components/soc/esp32/include/soc/spi_caps.h b/components/soc/esp32/include/soc/spi_caps.h index 881e229976..bd0bdb87a5 100644 --- a/components/soc/esp32/include/soc/spi_caps.h +++ b/components/soc/esp32/include/soc/spi_caps.h @@ -1,4 +1,4 @@ -// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD +// 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. @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef _SOC_SPI_CAPS_H_ -#define _SOC_SPI_CAPS_H_ +#pragma once #define SOC_SPI_PERIPH_NUM 3 #define SOC_SPI_DMA_CHAN_NUM 2 +#define SPI_PERIPH_NUM 3 + +#define SPI_FUNC_NUM 1 #define SPI_IOMUX_PIN_NUM_MISO 7 #define SPI_IOMUX_PIN_NUM_MOSI 8 #define SPI_IOMUX_PIN_NUM_CLK 6 @@ -25,6 +27,8 @@ #define SPI_IOMUX_PIN_NUM_WP 10 #define SPI_IOMUX_PIN_NUM_HD 9 +#define HSPI_FUNC_NUM 1 + //For D2WD and PICO-D4 chip #define SPI_D2WD_PIN_NUM_MISO 17 #define SPI_D2WD_PIN_NUM_MOSI 8 @@ -40,6 +44,7 @@ #define HSPI_IOMUX_PIN_NUM_WP 2 #define HSPI_IOMUX_PIN_NUM_HD 4 +#define VSPI_FUNC_NUM 1 #define VSPI_IOMUX_PIN_NUM_MISO 19 #define VSPI_IOMUX_PIN_NUM_MOSI 23 #define VSPI_IOMUX_PIN_NUM_CLK 18 @@ -51,4 +56,7 @@ #define SOC_SPI_SUPPORT_AS_CS 1 //Support to toggle the CS while the clock toggles -#endif /* _SOC_SPI_CAPS_H_ */ \ No newline at end of file +//#define SOC_SPI_SUPPORT_DDRCLK +//#define SOC_SPI_SLAVE_SUPPORT_SEG_TRANS +//#define SOC_SPI_SUPPORT_CD_SIG + diff --git a/components/soc/esp32/include/soc/uart_caps.h b/components/soc/esp32/include/soc/uart_caps.h index 4234b4b133..21af9f4d85 100644 --- a/components/soc/esp32/include/soc/uart_caps.h +++ b/components/soc/esp32/include/soc/uart_caps.h @@ -23,4 +23,3 @@ extern "C" { #ifdef __cplusplus } #endif - diff --git a/components/soc/esp32/interrupts.c b/components/soc/esp32/interrupts.c new file mode 100644 index 0000000000..ed23bbd42b --- /dev/null +++ b/components/soc/esp32/interrupts.c @@ -0,0 +1,87 @@ +// Copyright 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. + +#include "soc/interrupts.h" + +const char * const esp_isr_names[ETS_MAX_INTR_SOURCE] = { + [0] = "WIFI_MAC", + [1] = "WIFI_NMI", + [2] = "WIFI_BB", + [3] = "BT_MAC", + [4] = "BT_BB", + [5] = "BT_BB_NMI", + [6] = "RWBT", + [7] = "RWBLE", + [8] = "RWBT_NMI", + [9] = "RWBLE_NMI", + [10] = "SLC0", + [11] = "SLC1", + [12] = "UHCI0", + [13] = "UHCI1", + [14] = "TG0_T0_LEVEL", + [15] = "TG0_T1_LEVEL", + [16] = "TG0_WDT_LEVEL", + [17] = "TG0_LACT_LEVEL", + [18] = "TG1_T0_LEVEL", + [19] = "TG1_T1_LEVEL", + [20] = "TG1_WDT_LEVEL", + [21] = "TG1_LACT_LEVEL", + [22] = "GPIO", + [23] = "GPIO_NMI", + [24] = "FROM_CPU0", + [25] = "FROM_CPU1", + [26] = "FROM_CPU2", + [27] = "FROM_CPU3", + [28] = "SPI0", + [29] = "SPI1", + [30] = "SPI2", + [31] = "SPI3", + [32] = "I2S0", + [33] = "I2S1", + [34] = "UART0", + [35] = "UART1", + [36] = "UART2", + [37] = "SDIO_HOST", + [38] = "ETH_MAC", + [39] = "PWM0", + [40] = "PWM1", + [41] = "PWM2", + [42] = "PWM3", + [43] = "LEDC", + [44] = "EFUSE", + [45] = "CAN", + [46] = "RTC_CORE", + [47] = "RMT", + [48] = "PCNT", + [49] = "I2C_EXT0", + [50] = "I2C_EXT1", + [51] = "RSA", + [52] = "SPI1_DMA", + [53] = "SPI2_DMA", + [54] = "SPI3_DMA", + [55] = "WDT", + [56] = "TIMER1", + [57] = "TIMER2", + [58] = "TG0_T0_EDGE", + [59] = "TG0_T1_EDGE", + [60] = "TG0_WDT_EDGE", + [61] = "TG0_LACT_EDGE", + [62] = "TG1_T0_EDGE", + [63] = "TG1_T1_EDGE", + [64] = "TG1_WDT_EDGE", + [65] = "TG1_LACT_EDGE", + [66] = "MMU_IA", + [67] = "MPU_IA", + [68] = "CACHE_IA", +}; diff --git a/components/soc/esp32/ledc_periph.c b/components/soc/esp32/ledc_periph.c new file mode 100644 index 0000000000..6380fbad1c --- /dev/null +++ b/components/soc/esp32/ledc_periph.c @@ -0,0 +1,28 @@ +// 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. + +#include "soc/ledc_periph.h" +#include "soc/gpio_sig_map.h" + +/* + Bunch of constants for every LEDC peripheral: GPIO signals +*/ +const ledc_signal_conn_t ledc_periph_signal[2] = { + { + .sig_out0_idx = LEDC_HS_SIG_OUT0_IDX, + }, + { + .sig_out0_idx = LEDC_LS_SIG_OUT0_IDX, + } +}; \ No newline at end of file diff --git a/components/soc/esp32/soc_memory_layout.c b/components/soc/esp32/soc_memory_layout.c index dcae0c472b..d8ba94d905 100644 --- a/components/soc/esp32/soc_memory_layout.c +++ b/components/soc/esp32/soc_memory_layout.c @@ -60,7 +60,7 @@ const soc_memory_type_desc_t soc_memory_types[] = { { "PID5DRAM", { MALLOC_CAP_PID5|MALLOC_CAP_INTERNAL, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT|MALLOC_CAP_DEFAULT }, false, false}, { "PID6DRAM", { MALLOC_CAP_PID6|MALLOC_CAP_INTERNAL, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT|MALLOC_CAP_DEFAULT }, false, false}, { "PID7DRAM", { MALLOC_CAP_PID7|MALLOC_CAP_INTERNAL, MALLOC_CAP_8BIT, MALLOC_CAP_32BIT|MALLOC_CAP_DEFAULT }, false, false}, -#ifdef CONFIG_ESP32_SPIRAM_SUPPORT +#ifdef CONFIG_SPIRAM //Type 15: SPI SRAM data { "SPIRAM", { MALLOC_CAP_SPIRAM|MALLOC_CAP_DEFAULT, 0, MALLOC_CAP_8BIT|MALLOC_CAP_32BIT}, false, false}, #endif @@ -68,6 +68,13 @@ const soc_memory_type_desc_t soc_memory_types[] = { const size_t soc_memory_type_count = sizeof(soc_memory_types)/sizeof(soc_memory_type_desc_t); +#if CONFIG_SPIRAM_SIZE == -1 +// Assume we need to reserve 4MB in the auto-detection case +#define RESERVE_SPIRAM_SIZE (4*1024*1024) +#else +#define RESERVE_SPIRAM_SIZE CONFIG_SPIRAM_SIZE +#endif + /* Region descriptors. These describe all regions of memory available, and map them to a type in the above type. @@ -75,8 +82,8 @@ Because of requirements in the coalescing code which merges adjacent regions, th from low to high start address. */ const soc_memory_region_t soc_memory_regions[] = { -#ifdef CONFIG_ESP32_SPIRAM_SUPPORT - { 0x3F800000, 0x400000, 15, 0}, //SPI SRAM, if available +#ifdef CONFIG_SPIRAM + { SOC_EXTRAM_DATA_LOW, RESERVE_SPIRAM_SIZE, 15, 0}, //SPI SRAM, if available #endif { 0x3FFAE000, 0x2000, 0, 0}, //pool 16 <- used for rom code { 0x3FFB0000, 0x8000, 0, 0}, //pool 15 <- if BT is enabled, used as BT HW shared memory @@ -166,8 +173,8 @@ SOC_RESERVE_MEMORY_REGION(0x3fffc000, 0x40000000, trace_mem); //Reserve trace me #endif #endif -#ifdef CONFIG_ESP32_SPIRAM_SUPPORT -SOC_RESERVE_MEMORY_REGION(0x3f800000, 0x3fC00000, spi_ram); //SPI RAM gets added later if needed, in spiram.c; reserve it for now +#ifdef CONFIG_SPIRAM +SOC_RESERVE_MEMORY_REGION(SOC_EXTRAM_DATA_LOW, SOC_EXTRAM_DATA_LOW + RESERVE_SPIRAM_SIZE, spi_ram); //SPI RAM gets added later if needed, in spiram.c; reserve it for now #endif #endif /* BOOTLOADER_BUILD */ diff --git a/components/soc/esp32/sources.cmake b/components/soc/esp32/sources.cmake index a5471b6b36..125d3bda08 100644 --- a/components/soc/esp32/sources.cmake +++ b/components/soc/esp32/sources.cmake @@ -10,8 +10,11 @@ set(SOC_SRCS "cpu_util.c" "rtc_wdt.c" "sdio_slave_periph.c" "sdmmc_periph.c" + "interrupts.c" "soc_memory_layout.c" - "spi_periph.c") + "spi_periph.c" + "ledc_periph.c" + "i2s_periph.c") if(NOT BOOTLOADER_BUILD AND CONFIG_ETH_USE_ESP32_EMAC) list(APPEND SOC_SRCS "emac_hal.c") diff --git a/components/soc/esp32/spi_periph.c b/components/soc/esp32/spi_periph.c index a800cc6ec5..c36de0266e 100644 --- a/components/soc/esp32/spi_periph.c +++ b/components/soc/esp32/spi_periph.c @@ -93,4 +93,4 @@ const spi_signal_conn_t spi_periph_signal[3] = { .func = FUNC_SPI, .hw = &SPI3 } -}; \ No newline at end of file +}; diff --git a/components/soc/esp32/test/test_rtc_clk.c b/components/soc/esp32/test/test_rtc_clk.c index 1c21a1af11..ecf1842eef 100644 --- a/components/soc/esp32/test/test_rtc_clk.c +++ b/components/soc/esp32/test/test_rtc_clk.c @@ -218,7 +218,7 @@ static void start_freq(rtc_slow_freq_t required_src_freq, uint32_t start_delay_m printf("Test passed successfully\n"); } -#ifdef CONFIG_ESP32_SPIRAM_SUPPORT +#ifdef CONFIG_SPIRAM // PSRAM tests run on ESP-WROVER-KIT boards, which have the 32k XTAL installed. // Other tests may run on DevKitC boards, which don't have a 32k XTAL. TEST_CASE("Test starting external RTC quartz", "[rtc_clk]") @@ -284,4 +284,4 @@ TEST_CASE("Test starting 'External 32kHz XTAL' on the board without it.", "[rtc_ start_freq(RTC_SLOW_FREQ_RTC, 0); } -#endif // CONFIG_ESP32_SPIRAM_SUPPORT +#endif // CONFIG_SPIRAM diff --git a/components/soc/esp32s2beta/component.mk b/components/soc/esp32s2beta/component.mk new file mode 100644 index 0000000000..385d55c753 --- /dev/null +++ b/components/soc/esp32s2beta/component.mk @@ -0,0 +1 @@ +esp32s2beta/rtc_clk.o: CFLAGS += -fno-jump-tables -fno-tree-switch-conversion diff --git a/components/soc/esp32s2beta/cpu_util.c b/components/soc/esp32s2beta/cpu_util.c new file mode 100644 index 0000000000..ab45ab3b26 --- /dev/null +++ b/components/soc/esp32s2beta/cpu_util.c @@ -0,0 +1,63 @@ +// Copyright 2013-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "esp_attr.h" +#include "soc/cpu.h" +#include "soc/soc.h" +#include "soc/rtc_cntl_reg.h" +#include "sdkconfig.h" + +void IRAM_ATTR esp_cpu_stall(int cpu_id) +{ + if (cpu_id == 1) { + CLEAR_PERI_REG_MASK(RTC_CNTL_SW_CPU_STALL_REG, RTC_CNTL_SW_STALL_APPCPU_C1_M); + SET_PERI_REG_MASK(RTC_CNTL_SW_CPU_STALL_REG, 0x21< +#include +#include //for abs() + +/// 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. +#define SPI_LL_UNUSED_INT_MASK (SPI_INT_TRANS_DONE_EN | SPI_INT_WR_DMA_DONE_EN | SPI_INT_RD_DMA_DONE_EN | SPI_INT_WR_BUF_DONE_EN | SPI_INT_RD_BUF_DONE_EN) +/// Swap the bit order to its correct place to send +#define HAL_SPI_SWAP_DATA_TX(data, len) HAL_SWAP32((uint32_t)data<<(32-len)) + +#define SPI_LL_GET_HW(ID) ((ID)==0? ({abort();NULL;}):((ID)==1? &GPSPI2 : ((ID)==2? &GPSPI3: &GPSPI4))) + +/** + * The data structure holding calculated clock configuration. Since the + * calculation needs long time, it should be calculated during initialization and + * stored somewhere to be quickly used. + */ +typedef uint32_t spi_ll_clock_val_t; + +/** IO modes supported by the master. */ +typedef enum { + SPI_LL_IO_MODE_NORMAL = 0, ///< 1-bit mode for all phases + SPI_LL_IO_MODE_DIO, ///< 2-bit mode for address and data phases, 1-bit mode for command phase + SPI_LL_IO_MODE_DUAL, ///< 2-bit mode for data phases only, 1-bit mode for command and address phases + SPI_LL_IO_MODE_QIO, ///< 4-bit mode for address and data phases, 1-bit mode for command phase + SPI_LL_IO_MODE_QUAD, ///< 4-bit mode for data phases only, 1-bit mode for command and address phases +} spi_ll_io_mode_t; + +/// Interrupt type for different working pattern +typedef enum { + SPI_LL_INT_TYPE_NORMAL = 0, ///< Typical pattern, only wait for trans done + SPI_LL_INT_TYPE_SEG = 1, ///< Wait for DMA signals +} spi_ll_slave_intr_type; + + +/*------------------------------------------------------------------------------ + * Control + *----------------------------------------------------------------------------*/ +/** + * Initialize SPI peripheral (master). + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_master_init(spi_dev_t *hw) +{ + //Reset DMA + hw->dma_conf.val |= SPI_LL_RST_MASK; + hw->dma_out_link.start = 0; + hw->dma_in_link.start = 0; + hw->dma_conf.val &= ~SPI_LL_RST_MASK; + //Reset timing + hw->ctrl2.val = 0; + + //use all 64 bytes of the buffer + hw->user.usr_miso_highpart = 0; + hw->user.usr_mosi_highpart = 0; + + //Disable unneeded ints + hw->slave.val &= ~SPI_LL_UNUSED_INT_MASK; +} + +/** + * Initialize SPI peripheral (slave). + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_slave_init(spi_dev_t *hw) +{ + //it's stupid, but if something goes wrong, try to uncomment it + //hw->slave.slave_mode = 1; + //Configure slave + hw->clock.val = 0; + hw->user.val = 0; + hw->ctrl.val = 0; + hw->user.doutdin = 1; //we only support full duplex + hw->user.sio = 0; + hw->user.tx_start_bit = 7; + hw->slave.slave_mode = 1; + hw->dma_conf.val |= SPI_LL_RST_MASK; + hw->dma_out_link.start = 0; + hw->dma_in_link.start = 0; + hw->dma_conf.val &= ~SPI_LL_RST_MASK; + hw->slave.sync_reset = 1; + hw->slave.sync_reset = 0; + //use all 64 bytes of the buffer + hw->user.usr_miso_highpart = 0; + hw->user.usr_mosi_highpart = 0; + //by default seg mode is disabled + hw->dma_conf.dma_continue = 0; + + //Disable unneeded ints + hw->slave.val &= ~SPI_LL_UNUSED_INT_MASK; + hw->dma_int_ena.val = 0; +} + +/** + * Reset TX and RX DMAs. + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_reset_dma(spi_dev_t *hw) +{ + //Reset DMA peripheral + hw->dma_conf.val |= SPI_LL_RST_MASK; + hw->dma_out_link.start = 0; + hw->dma_in_link.start = 0; + hw->dma_conf.val &= ~SPI_LL_RST_MASK; + hw->dma_conf.out_data_burst_en = 1; + hw->dma_conf.indscr_burst_en = 1; + hw->dma_conf.outdscr_burst_en = 1; + hw->dma_in_link.dma_rx_ena = 0; + assert(hw->dma_in_link.dma_rx_ena==0); +} + +/** + * Start RX DMA. + * + * @param hw Beginning address of the peripheral registers. + * @param addr Address of the beginning DMA descriptor. + */ +static inline void spi_ll_rxdma_start(spi_dev_t *hw, lldesc_t *addr) +{ + //if something breaks, uncomment this line + //hw->dma_in_link.restart = 1; + hw->dma_in_link.addr = (int) addr & 0xFFFFF; + hw->dma_in_link.start = 1; +} + +/** + * Start TX DMA. + * + * @param hw Beginning address of the peripheral registers. + * @param addr Address of the beginning DMA descriptor. + */ +static inline void spi_ll_txdma_start(spi_dev_t *hw, lldesc_t *addr) +{ + //if something breaks, uncomment this line + hw->dma_out_link.restart = 1; + hw->dma_out_link.addr = (int) addr & 0xFFFFF; + hw->dma_out_link.start = 1; +} + +/** + * Write to SPI buffer. + * + * @param hw Beginning address of the peripheral registers. + * @param buffer_to_send Data address to copy to the buffer. + * @param bitlen Length to copy, in bits. + */ +static inline void spi_ll_write_buffer(spi_dev_t *hw, const uint8_t *buffer_to_send, size_t bitlen) +{ + for (int x = 0; x < bitlen; x += 32) { + //Use memcpy to get around alignment issues for txdata + uint32_t word; + memcpy(&word, &buffer_to_send[x / 8], 4); + hw->data_buf[(x / 32)] = word; + } +} + +/** + * Read from SPI buffer. + * + * @param hw Beginning address of the peripheral registers. + * @param buffer_to_rcv Address to copy buffer data to. + * @param bitlen Length to copy, in bits. + */ +static inline void spi_ll_read_buffer(spi_dev_t *hw, uint8_t *buffer_to_rcv, size_t bitlen) +{ + for (int x = 0; x < bitlen; x += 32) { + //Do a memcpy to get around possible alignment issues in rx_buffer + uint32_t word = hw->data_buf[x / 32]; + int len = bitlen - x; + if (len > 32) { + len = 32; + } + memcpy(&buffer_to_rcv[x / 8], &word, (len + 7) / 8); + } +} + +/** + * Check whether user-defined transaction is done. + * + * @param hw Beginning address of the peripheral registers. + * + * @return true if transaction is done, otherwise false. + */ +static inline bool spi_ll_usr_is_done(spi_dev_t *hw) +{ + return hw->slave.trans_done; +} + +/** + * Trigger start of user-defined transaction. + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_user_start(spi_dev_t *hw) +{ + hw->cmd.usr = 1; +} + +/** + * Get current running command bit-mask. (Preview) + * + * @param hw Beginning address of the peripheral registers. + * + * @return Bitmask of running command, see ``SPI_CMD_REG``. 0 if no in-flight command. + */ +static inline uint32_t spi_ll_get_running_cmd(spi_dev_t *hw) +{ + return hw->cmd.val; +} + +/** + * Disable the trans_done interrupt. + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_disable_int(spi_dev_t *hw) +{ + hw->slave.int_trans_done_en = 0; +} + +/** + * Clear the trans_done interrupt. + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_clear_int_stat(spi_dev_t *hw) +{ + hw->slave.trans_done = 0; + hw->dma_int_clr.val = UINT32_MAX; +} + +/** + * Set the trans_done interrupt. + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_set_int_stat(spi_dev_t *hw) +{ + hw->slave.trans_done = 1; +} + +/** + * Enable the trans_done interrupt. + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_enable_int(spi_dev_t *hw) +{ + hw->slave.int_trans_done_en = 1; +} + +/** + * Set different interrupt types for the slave. + * + * @param hw Beginning address of the peripheral registers. + * @param int_type Interrupt type + */ +static inline void spi_ll_slave_set_int_type(spi_dev_t *hw, spi_ll_slave_intr_type int_type) +{ + switch (int_type) + { + case SPI_LL_INT_TYPE_SEG: + hw->dma_int_ena.in_suc_eof = 1; + hw->dma_int_ena.out_total_eof = 1; + hw->slave.int_trans_done_en = 0; + break; + default: + hw->dma_int_ena.in_suc_eof = 0; + hw->dma_int_ena.out_total_eof = 0; + hw->slave.int_trans_done_en = 1; + } +} + + + +/*------------------------------------------------------------------------------ + * Configs: mode + *----------------------------------------------------------------------------*/ +/** + * Enable/disable the postive-cs feature. + * + * @param hw Beginning address of the peripheral registers. + * @param cs One of the CS (0-2) to enable/disable the feature. + * @param pos_cs true to enable the feature, otherwise disable (default). + */ +static inline void spi_ll_master_set_pos_cs(spi_dev_t *hw, int cs, uint32_t pos_cs) +{ + if (pos_cs) { + hw->misc.master_cs_pol |= (1 << cs); + } else { + hw->misc.master_cs_pol &= (1 << cs); + } +} + +/** + * Enable/disable the LSBFIRST feature for TX data. + * + * @param hw Beginning address of the peripheral registers. + * @param lsbfirst true if LSB of TX data to be sent first, otherwise MSB is sent first (default). + */ +static inline void spi_ll_set_tx_lsbfirst(spi_dev_t *hw, bool lsbfirst) +{ + hw->ctrl.wr_bit_order = lsbfirst; +} + +/** + * Enable/disable the LSBFIRST feature for RX data. + * + * @param hw Beginning address of the peripheral registers. + * @param lsbfirst true if first bit received as LSB, otherwise as MSB (default). + */ +static inline void spi_ll_set_rx_lsbfirst(spi_dev_t *hw, bool lsbfirst) +{ + hw->ctrl.rd_bit_order = lsbfirst; +} + +/** + * Set SPI mode for the peripheral as master. + * + * @param hw Beginning address of the peripheral registers. + * @param mode SPI mode to work at, 0-3. + */ +static inline void spi_ll_master_set_mode(spi_dev_t *hw, uint8_t mode) +{ + //Configure polarity + if (mode == 0) { + hw->misc.ck_idle_edge = 0; + hw->user.ck_out_edge = 0; + } else if (mode == 1) { + hw->misc.ck_idle_edge = 0; + hw->user.ck_out_edge = 1; + } else if (mode == 2) { + hw->misc.ck_idle_edge = 1; + hw->user.ck_out_edge = 1; + } else if (mode == 3) { + hw->misc.ck_idle_edge = 1; + hw->user.ck_out_edge = 0; + } +} + +/** + * Set SPI mode for the peripheral as slave. + * + * @param hw Beginning address of the peripheral registers. + * @param mode SPI mode to work at, 0-3. + */ +static inline void spi_ll_slave_set_mode(spi_dev_t *hw, const int mode, bool dma_used) +{ + if (mode == 0) { + hw->misc.ck_idle_edge = 0; + hw->user.rsck_i_edge = 0; + hw->user.tsck_i_edge = 0; + hw->ctrl1.rsck_data_out = 0; + hw->ctrl1.clk_mode_13 = 0; + } else if (mode == 1) { + hw->misc.ck_idle_edge = 0; + hw->user.rsck_i_edge = 1; + hw->user.tsck_i_edge = 1; + hw->ctrl1.rsck_data_out = 0; + hw->ctrl1.clk_mode_13 = 1; + } else if (mode == 2) { + hw->misc.ck_idle_edge = 1; + hw->user.rsck_i_edge = 1; + hw->user.tsck_i_edge = 1; + hw->ctrl1.rsck_data_out = 0; + hw->ctrl1.clk_mode_13 = 0; + } else if (mode == 3) { + hw->misc.ck_idle_edge = 1; + hw->user.rsck_i_edge = 0; + hw->user.tsck_i_edge = 0; + hw->ctrl1.rsck_data_out = 0; + hw->ctrl1.clk_mode_13 = 1; + } + //hw->ctrl1.rsck_data_out = 1; +} + +/** + * Set SPI to work in full duplex or half duplex mode. + * + * @param hw Beginning address of the peripheral registers. + * @param half_duplex true to work in half duplex mode, otherwise in full duplex mode. + */ +static inline void spi_ll_set_half_duplex(spi_dev_t *hw, bool half_duplex) +{ + hw->user.doutdin = !half_duplex; +} + +/** + * Set SPI to work in SIO mode or not. + * + * SIO is a mode which MOSI and MISO share a line. The device MUST work in half-duplexmode. + * + * @param hw Beginning address of the peripheral registers. + * @param sio_mode true to work in SIO mode, otherwise false. + */ +static inline void spi_ll_set_sio_mode(spi_dev_t *hw, int sio_mode) +{ + hw->user.sio = sio_mode; +} + +/** + * Configure the io mode for the master to work at. + * + * @param hw Beginning address of the peripheral registers. + * @param io_mode IO mode to work at, see ``spi_ll_io_mode_t``. + */ +static inline void spi_ll_master_set_io_mode(spi_dev_t *hw, spi_ll_io_mode_t io_mode) +{ + hw->ctrl.val &= ~(SPI_FREAD_DUAL | SPI_FREAD_QUAD | SPI_FREAD_DIO | SPI_FREAD_QIO); + hw->user.val &= ~(SPI_FWRITE_DUAL | SPI_FWRITE_QUAD | SPI_FWRITE_DIO | SPI_FWRITE_QIO); + switch (io_mode) { + case SPI_LL_IO_MODE_DIO: + // hw->ctrl.fread_dio = 1; + // hw->user.fwrite_dio = 1; + break; + case SPI_LL_IO_MODE_DUAL: + hw->ctrl.fread_dual = 1; + hw->user.fwrite_dual = 1; + break; + case SPI_LL_IO_MODE_QIO: + // hw->ctrl.fread_qio = 1; + // hw->user.fwrite_qio = 1; + break; + case SPI_LL_IO_MODE_QUAD: + hw->ctrl.fread_quad = 1; + hw->user.fwrite_quad = 1; + break; + default: + break; + }; + // if (io_mode != SPI_LL_IO_MODE_NORMAL) { + // hw->ctrl.fastrd_mode = 1; + // } +} + +/** + * Select one of the CS to use in current transaction. + * + * @param hw Beginning address of the peripheral registers. + * @param cs_id The cs to use, 0-2, otherwise none of them is used. + */ +static inline void spi_ll_master_select_cs(spi_dev_t *hw, int cs_id) +{ + hw->misc.cs0_dis = (cs_id == 0) ? 0 : 1; + hw->misc.cs1_dis = (cs_id == 1) ? 0 : 1; + hw->misc.cs2_dis = (cs_id == 2) ? 0 : 1; +} + +/*------------------------------------------------------------------------------ + * Configs: parameters + *----------------------------------------------------------------------------*/ +/** + * Set the clock for master by stored value. + * + * @param hw Beginning address of the peripheral registers. + * @param val stored clock configuration calculated before (by ``spi_ll_cal_clock``). + */ +static inline void spi_ll_master_set_clock_by_reg(spi_dev_t *hw, spi_ll_clock_val_t *val) +{ + hw->clock.val = *(uint32_t *)val; +} + +/** + * Get the frequency of given dividers. Don't use in app. + * + * @param fapb APB clock of the system. + * @param pre Pre devider. + * @param n main divider. + * + * @return Frequency of given dividers. + */ +static inline int spi_ll_freq_for_pre_n(int fapb, int pre, int n) +{ + return (fapb / (pre * n)); +} + +/** + * Calculate the nearest frequency avaliable for master. + * + * @param fapb APB clock of the system. + * @param hz Frequncy desired. + * @param duty_cycle Duty cycle desired. + * @param out_reg Output address to store the calculated clock configurations for the return frequency. + * + * @return Actual (nearest) frequency. + */ +static inline int spi_ll_master_cal_clock(int fapb, int hz, int duty_cycle, spi_ll_clock_val_t *out_reg) +{ + typeof(GPSPI2.clock) reg; + int eff_clk; + + //In hw, n, h and l are 1-64, pre is 1-8K. Value written to register is one lower than used value. + if (hz > ((fapb / 4) * 3)) { + //Using Fapb directly will give us the best result here. + reg.clkcnt_l = 0; + reg.clkcnt_h = 0; + reg.clkcnt_n = 0; + reg.clkdiv_pre = 0; + reg.clk_equ_sysclk = 1; + eff_clk = fapb; + } else { + //For best duty cycle resolution, we want n to be as close to 32 as possible, but + //we also need a pre/n combo that gets us as close as possible to the intended freq. + //To do this, we bruteforce n and calculate the best pre to go along with that. + //If there's a choice between pre/n combos that give the same result, use the one + //with the higher n. + int pre, n, h, l; + int bestn = -1; + int bestpre = -1; + int besterr = 0; + int errval; + for (n = 2; n <= 64; n++) { //Start at 2: we need to be able to set h/l so we have at least one high and one low pulse. + //Effectively, this does pre=round((fapb/n)/hz). + pre = ((fapb / n) + (hz / 2)) / hz; + if (pre <= 0) { + pre = 1; + } + if (pre > 8192) { + pre = 8192; + } + errval = abs(spi_ll_freq_for_pre_n(fapb, pre, n) - hz); + if (bestn == -1 || errval <= besterr) { + besterr = errval; + bestn = n; + bestpre = pre; + } + } + + n = bestn; + pre = bestpre; + l = n; + //This effectively does round((duty_cycle*n)/256) + h = (duty_cycle * n + 127) / 256; + if (h <= 0) { + h = 1; + } + + reg.clk_equ_sysclk = 0; + reg.clkcnt_n = n - 1; + reg.clkdiv_pre = pre - 1; + reg.clkcnt_h = h - 1; + reg.clkcnt_l = l - 1; + eff_clk = spi_ll_freq_for_pre_n(fapb, pre, n); + } + if (out_reg != NULL) { + *(uint32_t *)out_reg = reg.val; + } + return eff_clk; +} + +/** + * Calculate and set clock for SPI master according to desired parameters. + * + * This takes long, suggest to calculate the configuration during + * initialization by ``spi_ll_master_cal_clock`` and store the result, then + * configure the clock by stored value when used by + * ``spi_ll_msater_set_clock_by_reg``. + * + * @param hw Beginning address of the peripheral registers. + * @param fapb APB clock of the system. + * @param hz Frequncy desired. + * @param duty_cycle Duty cycle desired. + * + * @return Actual frequency that is used. + */ +static inline int spi_ll_master_set_clock(spi_dev_t *hw, int fapb, int hz, int duty_cycle) +{ + spi_ll_clock_val_t reg_val; + int freq = spi_ll_master_cal_clock(fapb, hz, duty_cycle, ®_val); + spi_ll_master_set_clock_by_reg(hw, ®_val); + return freq; +} + +/** + * Set the mosi delay after the output edge to the signal. (Preview) + * + * The delay mode/num is a Espressif conception, may change in the new chips. + * + * @param hw Beginning address of the peripheral registers. + * @param delay_mode Delay mode, see TRM. + * @param delay_num APB clocks to delay. + */ +static inline void spi_ll_set_mosi_delay(spi_dev_t *hw, int delay_mode, int delay_num) +{ + //TODO: this doesn't make sense + hw->dout_num.dout0_num = 0; + hw->dout_num.dout1_num = 0; +} + +/** + * Set the miso delay applied to the input signal before the internal peripheral. (Preview) + * + * The delay mode/num is a Espressif conception, may change in the new chips. + * + * @param hw Beginning address of the peripheral registers. + * @param delay_mode Delay mode, see TRM. + * @param delay_num APB clocks to delay. + */ +static inline void spi_ll_set_miso_delay(spi_dev_t *hw, int delay_mode, int delay_num) +{ + //TODO: this doesn't make sense + hw->din_num.din0_num = 1; + hw->din_num.din1_num = 1; +} + +/** + * Set dummy clocks to output before RX phase (master), or clocks to skip + * before the data phase and after the address phase (slave). + * + * Note this phase is also used to compensate RX timing in half duplex mode. + * + * @param hw Beginning address of the peripheral registers. + * @param dummy_n Dummy cycles used. 0 to disable the dummy phase. + */ +static inline void spi_ll_set_dummy(spi_dev_t *hw, int dummy_n) +{ + hw->user.usr_dummy = dummy_n ? 1 : 0; + hw->user1.usr_dummy_cyclelen = dummy_n - 1; +} + +/** + * Set the delay of SPI clocks before the CS inactive edge after the last SPI clock. + * + * @param hw Beginning address of the peripheral registers. + * @param hold Delay of SPI clocks after the last clock, 0 to disable the hold phase. + */ +static inline void spi_ll_master_set_cs_hold(spi_dev_t *hw, int hold) +{ + hw->ctrl2.cs_hold_time = hold - 1; + hw->user.cs_hold = hold ? 1 : 0; +} + +/** + * Set the delay of SPI clocks before the first SPI clock after the CS active edge. + * + * Note ESP32 doesn't support to use this feature when command/address phases + * are used in full duplex mode. + * + * @param hw Beginning address of the peripheral registers. + * @param setup Delay of SPI clocks after the CS active edge, 0 to disable the setup phase. + */ +static inline void spi_ll_master_set_cs_setup(spi_dev_t *hw, uint8_t setup) +{ + hw->ctrl2.cs_setup_time = setup - 1; + hw->user.cs_setup = setup ? 1 : 0; +} + +/** + * Enable/disable the segment transfer feature for the slave. + * + * @param hw Beginning address of the peripheral registers. + * @param en true to enable, false to disable. + */ +static inline void spi_ll_slave_set_seg_en(spi_dev_t *hw, bool en) +{ + hw->dma_conf.slv_rx_seg_trans_en = en; +} + +/*------------------------------------------------------------------------------ + * Configs: data + *----------------------------------------------------------------------------*/ +/** + * Set the input length (master). + * + * @param hw Beginning address of the peripheral registers. + * @param bitlen input length, in bits. + */ +static inline void spi_ll_set_miso_bitlen(spi_dev_t *hw, size_t bitlen) +{ + hw->miso_dlen.usr_miso_bit_len = bitlen - 1; +} + +/** + * Set the output length (master). + * + * @param hw Beginning address of the peripheral registers. + * @param bitlen output length, in bits. + */ +static inline void spi_ll_set_mosi_bitlen(spi_dev_t *hw, size_t bitlen) +{ + hw->mosi_dlen.usr_mosi_bit_len = bitlen - 1; +} + +/** + * Set the maximum input length (slave). + * + * @param hw Beginning address of the peripheral registers. + * @param bitlen input length, in bits. + */ +static inline void spi_ll_slave_set_rx_bitlen(spi_dev_t *hw, size_t bitlen) +{ + hw->slv_wrbuf_dlen.bit_len = bitlen - 1; +} + +/** + * Set the maximum output length (slave). + * + * @param hw Beginning address of the peripheral registers. + * @param bitlen output length, in bits. + */ +static inline void spi_ll_slave_set_tx_bitlen(spi_dev_t *hw, size_t bitlen) +{ + hw->slv_rdbuf_dlen.bit_len = bitlen - 1; +} + +/** + * Set the length of command phase. + * + * When in 4-bit mode, the SPI cycles of the phase will be shorter. E.g. 16-bit + * command phases takes 4 cycles in 4-bit mode. + * + * @param hw Beginning address of the peripheral registers. + * @param bitlen Length of command phase, in bits. 0 to disable the command phase. + */ +static inline void spi_ll_set_command_bitlen(spi_dev_t *hw, int bitlen) +{ + hw->user2.usr_command_bitlen = bitlen - 1; + hw->user.usr_command = bitlen ? 1 : 0; +} + +/** + * Set the length of address phase. + * + * When in 4-bit mode, the SPI cycles of the phase will be shorter. E.g. 16-bit + * address phases takes 4 cycles in 4-bit mode. + * + * @param hw Beginning address of the peripheral registers. + * @param bitlen Length of address phase, in bits. 0 to disable the address phase. + */ +static inline void spi_ll_set_addr_bitlen(spi_dev_t *hw, int bitlen) +{ + hw->user1.usr_addr_bitlen = bitlen - 1; + hw->user.usr_addr = bitlen ? 1 : 0; +} + +/** + * Set the address value in an intuitive way. + * + * The length and lsbfirst is required to shift and swap the address to the right place. + * + * @param hw Beginning address of the peripheral registers. + * @param address Address to set + * @param addrlen Length of the address phase + * @param lsbfirst whether the LSB first feature is enabled. + */ +static inline void spi_ll_set_address(spi_dev_t *hw, uint64_t addr, int addrlen, uint32_t lsbfirst) +{ + if (lsbfirst) { + /* The output address start from the LSB of the highest byte, i.e. + * addr[24] -> addr[31] + * ... + * addr[0] -> addr[7] + * slv_wr_status[24] -> slv_wr_status[31] + * ... + * slv_wr_status[0] -> slv_wr_status[7] + * So swap the byte order to let the LSB sent first. + */ + addr = HAL_SWAP64(addr); + hw->addr = addr >> 32; + hw->slv_wr_status = addr; + } else { + // shift the address to MSB of addr (and maybe slv_wr_status) register. + // output address will be sent from MSB to LSB of addr register, then comes the MSB to LSB of slv_wr_status register. + if (addrlen > 32) { + hw->addr = addr >> (addrlen - 32); + hw->slv_wr_status = addr << (64 - addrlen); + } else { + hw->addr = addr << (32 - addrlen); + } + } +} + +/** + * Set the command value in an intuitive way. + * + * The length and lsbfirst is required to shift and swap the command to the right place. + * + * @param hw Beginning command of the peripheral registers. + * @param command Command to set + * @param addrlen Length of the command phase + * @param lsbfirst whether the LSB first feature is enabled. + */ +static inline void spi_ll_set_command(spi_dev_t *hw, uint16_t cmd, int cmdlen, bool lsbfirst) +{ + if (lsbfirst) { + // The output command start from bit0 to bit 15, kept as is. + hw->user2.usr_command_value = cmd; + } else { + /* Output command will be sent from bit 7 to 0 of command_value, and + * then bit 15 to 8 of the same register field. Shift and swap to send + * more straightly. + */ + hw->user2.usr_command_value = HAL_SPI_SWAP_DATA_TX(cmd, cmdlen); + + } +} + +/** + * Enable/disable the RX data phase. + * + * @param hw Beginning address of the peripheral registers. + * @param enable true if RX phase exist, otherwise false. + */ +static inline void spi_ll_enable_miso(spi_dev_t *hw, int enable) +{ + hw->user.usr_miso = enable; +} + +/** + * Enable/disable the TX data phase. + * + * @param hw Beginning address of the peripheral registers. + * @param enable true if TX phase exist, otherwise false. + */ +static inline void spi_ll_enable_mosi(spi_dev_t *hw, int enable) +{ + hw->user.usr_mosi = enable; +} + +/** + * Reset the slave peripheral before next transaction. + * + * @param hw Beginning address of the peripheral registers. + */ +static inline void spi_ll_slave_reset(spi_dev_t *hw) +{ + hw->slave.sync_reset = 1; + hw->slave.sync_reset = 0; +} + +/** + * Get the received bit length of the slave. + * + * @param hw Beginning address of the peripheral registers. + * + * @return Received bits of the slave. + */ +static inline uint32_t spi_ll_slave_get_rcv_bitlen(spi_dev_t *hw) +{ + return hw->slv_rd_byte.slv_rdata_bit * 8; +} + + +#undef SPI_LL_RST_MASK +#undef SPI_LL_UNUSED_INT_MASK diff --git a/components/soc/esp32s2beta/include/hal/timer_ll.h b/components/soc/esp32s2beta/include/hal/timer_ll.h new file mode 100644 index 0000000000..20805337a1 --- /dev/null +++ b/components/soc/esp32s2beta/include/hal/timer_ll.h @@ -0,0 +1,285 @@ +// 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 LL layer for Timer Group register operations. +// Note that most of the register operations in this layer are non-atomic operations. + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "hal/timer_types.h" +#include "soc/timer_periph.h" + +//Helper macro to get corresponding interrupt of a timer +#define TIMER_LL_GET_INTR(TIMER_IDX) ((TIMER_IDX)==TIMER_0? TIMER_INTR_T0: TIMER_INTR_T1) + +#define TIMER_LL_GET_HW(TIMER_GROUP) ((TIMER_GROUP)==0? &TIMERG0: &TIMERG1) + +_Static_assert(TIMER_INTR_T0 == TIMG_T0_INT_CLR, "Add mapping to LL interrupt handling, since it's no longer naturally compatible with the timer_intr_t"); +_Static_assert(TIMER_INTR_T1 == TIMG_T1_INT_CLR, "Add mapping to LL interrupt handling, since it's no longer naturally compatible with the timer_intr_t"); +_Static_assert(TIMER_INTR_WDT == TIMG_WDT_INT_CLR, "Add mapping to LL interrupt handling, since it's no longer naturally compatible with the timer_intr_t"); + +/** + * @brief Enable timer interrupt. + * + * @param hw Beginning address of the peripheral registers. + * @param intr_mask Interrupt enable mask + * + * @return None + */ +static inline void timer_ll_intr_enable(timg_dev_t *hw, timer_intr_t intr_mask) +{ + hw->int_ena.val |= intr_mask; +} + +/** + * @brief Disable timer interrupt. + * + * @param hw Beginning address of the peripheral registers. + * @param intr_mask Interrupt disable mask + * + * @return None + */ +static inline void timer_ll_intr_disable(timg_dev_t *hw, timer_intr_t intr_mask) +{ + hw->int_ena.val &= (~intr_mask); +} + +/** + * @brief Get timer interrupt status. + * + * @param hw Beginning address of the peripheral registers. + * + * @return Masked interrupt status + */ +static inline timer_intr_t timer_ll_intr_status_get(timg_dev_t *hw) +{ + return hw->int_raw.val; +} + +/** + * @brief Clear timer interrupt. + * + * @param hw Beginning address of the peripheral registers. + * @param intr_mask Interrupt mask to clear + * + * @return None + */ +static inline void timer_ll_intr_status_clear(timg_dev_t *hw, timer_intr_t intr_mask) +{ + hw->int_clr.val = intr_mask; +} + +/** + * @brief Get counter vaule from time-base counter + * + * @param hw Beginning address of the peripheral registers. + * @param timer_num The timer number + * @param timer_val Pointer to accept the counter value + * + * @return None + */ +static inline void timer_ll_get_counter_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t *timer_val) +{ + hw->hw_timer[timer_num].update.update = 1; + *timer_val = ((uint64_t) hw->hw_timer[timer_num].cnt_high << 32) | (hw->hw_timer[timer_num].cnt_low); +} + +/** + * @brief Set counter status, enable or disable counter. + * + * @param hw Beginning address of the peripheral registers. + * @param timer_num The timer number + * @param counter_en Counter enable status + * + * @return None + */ +static inline void timer_ll_set_counter_enable(timg_dev_t *hw, timer_idx_t timer_num, timer_start_t counter_en) +{ + hw->hw_timer[timer_num].config.enable = counter_en; +} + +/** + * @brief Get auto reload mode. + * + * @param hw Beginning address of the peripheral registers. + * @param timer_num The timer number + * @param reload Pointer to accept the auto reload mode + * + * @return None + */ +static inline bool timer_ll_get_auto_reload(timg_dev_t *hw, timer_idx_t timer_num) +{ + return hw->hw_timer[timer_num].config.autoreload; +} + +/** + * @brief Set the counter value to trigger the alarm. + * + * @param hw Beginning address of the peripheral registers. + * @param timer_num The timer number + * @param alarm_value Counter value to trigger the alarm + * + * @return None + */ +static inline void timer_ll_set_alarm_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t alarm_value) +{ + hw->hw_timer[timer_num].alarm_high = (uint32_t) (alarm_value >> 32); + hw->hw_timer[timer_num].alarm_low = (uint32_t) alarm_value; +} + +/** + * @brief Get the counter value to trigger the alarm. + * + * @param hw Beginning address of the peripheral registers. + * @param timer_num The timer number + * @param alarm_value Pointer to accept the counter value to trigger the alarm + * + * @return None + */ +static inline void timer_ll_get_alarm_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t *alarm_value) +{ + *alarm_value = ((uint64_t) hw->hw_timer[timer_num].alarm_high << 32) | (hw->hw_timer[timer_num].alarm_low); +} + +/** + * @brief Set the alarm status, enable or disable the alarm. + * + * @param hw Beginning address of the peripheral registers. + * @param timer_num The timer number + * @param alarm_en true to enable, false to disable + * + * @return None + */ +static inline void timer_ll_set_alarm_enable(timg_dev_t *hw, timer_idx_t timer_num, bool alarm_en) +{ + hw->hw_timer[timer_num].config.alarm_en = alarm_en; +} + +/** + * @brief Get the alarm status. + * + * @param hw Beginning address of the peripheral registers. + * @param timer_num The timer number + * @param alarm_en Pointer to accept the alarm status + * + * @return None + */ +static inline void timer_ll_get_alarm_enable(timg_dev_t *hw, timer_idx_t timer_num, bool *alarm_en) +{ + *alarm_en = hw->hw_timer[timer_num].config.alarm_en; +} + +/* WDT operations */ + +/** + * Unlock/lock the WDT register in case of mis-operations. + * + * @param hw Beginning address of the peripheral registers. + * @param protect true to lock, false to unlock before operations. + */ + +FORCE_INLINE_ATTR void timer_ll_wdt_set_protect(timg_dev_t* hw, bool protect) +{ + hw->wdt_wprotect=(protect? 0: TIMG_WDT_WKEY_VALUE); +} + +/** + * Initialize WDT. + * + * @param hw Beginning address of the peripheral registers. + * + * @note Call ``timer_ll_wdt_set_protect first`` + */ +FORCE_INLINE_ATTR void timer_ll_wdt_init(timg_dev_t* hw) +{ + hw->wdt_config0.sys_reset_length=7; //3.2uS + hw->wdt_config0.cpu_reset_length=7; //3.2uS + //currently only level interrupt is supported + hw->wdt_config0.level_int_en = 1; + hw->wdt_config0.edge_int_en = 0; +} + +FORCE_INLINE_ATTR void timer_ll_wdt_set_tick(timg_dev_t* hw, int tick_time_us) +{ + hw->wdt_config1.clk_prescale=80*tick_time_us; +} + +FORCE_INLINE_ATTR void timer_ll_wdt_feed(timg_dev_t* hw) +{ + hw->wdt_feed = 1; +} + +FORCE_INLINE_ATTR void timer_ll_wdt_set_timeout(timg_dev_t* hw, int stage, uint32_t timeout_tick) +{ + switch (stage) { + case 0: + hw->wdt_config2=timeout_tick; + break; + case 1: + hw->wdt_config3=timeout_tick; + break; + case 2: + hw->wdt_config4=timeout_tick; + break; + case 3: + hw->wdt_config5=timeout_tick; + break; + default: + abort(); + } +} + +_Static_assert(TIMER_WDT_OFF == TIMG_WDT_STG_SEL_OFF, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with the timer_wdt_behavior_t"); +_Static_assert(TIMER_WDT_INT == TIMG_WDT_STG_SEL_INT, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with the timer_wdt_behavior_t"); +_Static_assert(TIMER_WDT_RESET_CPU == TIMG_WDT_STG_SEL_RESET_CPU, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with the timer_wdt_behavior_t"); +_Static_assert(TIMER_WDT_RESET_SYSTEM == TIMG_WDT_STG_SEL_RESET_SYSTEM, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with the timer_wdt_behavior_t"); + +FORCE_INLINE_ATTR void timer_ll_wdt_set_timeout_behavior(timg_dev_t* hw, int stage, timer_wdt_behavior_t behavior) +{ + switch (stage) { + case 0: + hw->wdt_config0.stg0 = behavior; + break; + case 1: + hw->wdt_config0.stg1 = behavior; + break; + case 2: + hw->wdt_config0.stg2 = behavior; + break; + case 3: + hw->wdt_config0.stg3 = behavior; + break; + default: + abort(); + } +} + +FORCE_INLINE_ATTR void timer_ll_wdt_set_enable(timg_dev_t* hw, bool enable) +{ + hw->wdt_config0.en = enable; +} + +FORCE_INLINE_ATTR void timer_ll_wdt_flashboot_en(timg_dev_t* hw, bool enable) +{ + hw->wdt_config0.flashboot_mod_en = enable; +} + + +#ifdef __cplusplus +} +#endif diff --git a/components/soc/esp32s2beta/include/soc/adc_channel.h b/components/soc/esp32s2beta/include/soc/adc_channel.h new file mode 100644 index 0000000000..a03303f0f0 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/adc_channel.h @@ -0,0 +1,78 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _SOC_ADC_CHANNEL_H +#define _SOC_ADC_CHANNEL_H + +#define ADC1_GPIO1_CHANNEL ADC1_CHANNEL_0 +#define ADC1_CHANNEL_0_GPIO_NUM 1 + +#define ADC1_GPIO2_CHANNEL ADC1_CHANNEL_1 +#define ADC1_CHANNEL_1_GPIO_NUM 2 + +#define ADC1_GPIO3_CHANNEL ADC1_CHANNEL_2 +#define ADC1_CHANNEL_2_GPIO_NUM 3 + +#define ADC1_GPIO4_CHANNEL ADC1_CHANNEL_3 +#define ADC1_CHANNEL_3_GPIO_NUM 4 + +#define ADC1_GPIO5_CHANNEL ADC1_CHANNEL_4 +#define ADC1_CHANNEL_4_GPIO_NUM 5 + +#define ADC1_GPIO6_CHANNEL ADC1_CHANNEL_5 +#define ADC1_CHANNEL_5_GPIO_NUM 6 + +#define ADC1_GPIO7_CHANNEL ADC1_CHANNEL_6 +#define ADC1_CHANNEL_6_GPIO_NUM 7 + +#define ADC1_GPIO8_CHANNEL ADC1_CHANNEL_7 +#define ADC1_CHANNEL_7_GPIO_NUM 8 + +#define ADC1_GPIO9_CHANNEL ADC1_CHANNEL_8 +#define ADC1_CHANNEL_8_GPIO_NUM 9 + +#define ADC1_GPIO10_CHANNEL ADC1_CHANNEL_9 +#define ADC1_CHANNEL_9_GPIO_NUM 10 + +#define ADC2_GPIO11_CHANNEL ADC2_CHANNEL_0 +#define ADC2_CHANNEL_0_GPIO_NUM 11 + +#define ADC2_GPIO12_CHANNEL ADC2_CHANNEL_1 +#define ADC2_CHANNEL_1_GPIO_NUM 12 + +#define ADC2_GPIO13_CHANNEL ADC2_CHANNEL_2 +#define ADC2_CHANNEL_2_GPIO_NUM 13 + +#define ADC2_GPIO14_CHANNEL ADC2_CHANNEL_3 +#define ADC2_CHANNEL_3_GPIO_NUM 14 + +#define ADC2_GPIO15_CHANNEL ADC2_CHANNEL_4 +#define ADC2_CHANNEL_4_GPIO_NUM 15 + +#define ADC2_GPIO16_CHANNEL ADC2_CHANNEL_5 +#define ADC2_CHANNEL_5_GPIO_NUM 16 + +#define ADC2_GPIO17_CHANNEL ADC2_CHANNEL_6 +#define ADC2_CHANNEL_6_GPIO_NUM 17 + +#define ADC2_GPIO18_CHANNEL ADC2_CHANNEL_7 +#define ADC2_CHANNEL_7_GPIO_NUM 18 + +#define ADC2_GPIO19_CHANNEL ADC2_CHANNEL_8 +#define ADC2_CHANNEL_8_GPIO_NUM 19 + +#define ADC2_GPIO20_CHANNEL ADC2_CHANNEL_9 +#define ADC2_CHANNEL_9_GPIO_NUM 20 + +#endif diff --git a/components/soc/esp32s2beta/include/soc/apb_ctrl_reg.h b/components/soc/esp32s2beta/include/soc/apb_ctrl_reg.h new file mode 100644 index 0000000000..eefcf3b022 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/apb_ctrl_reg.h @@ -0,0 +1,841 @@ +// Copyright 2017-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_APB_CTRL_REG_H_ +#define _SOC_APB_CTRL_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define APB_CTRL_SYSCLK_CONF_REG (DR_REG_APB_CTRL_BASE + 0x000) +/* APB_CTRL_SOC_CLK_SEL : R/W ;bitpos:[15:14] ;default: 2'd0 ; */ +/*description: */ +#define APB_CTRL_SOC_CLK_SEL 0x00000003 +#define APB_CTRL_SOC_CLK_SEL_M ((APB_CTRL_SOC_CLK_SEL_V)<<(APB_CTRL_SOC_CLK_SEL_S)) +#define APB_CTRL_SOC_CLK_SEL_V 0x3 +#define APB_CTRL_SOC_CLK_SEL_S 14 +#define APB_CTRL_SOC_CLK_SEL_XTL 0 +#define APB_CTRL_SOC_CLK_SEL_PLL 1 +#define APB_CTRL_SOC_CLK_SEL_8M 2 +#define APB_CTRL_SOC_CLK_SEL_APLL 3 + +/* APB_CTRL_RST_TICK_CNT : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_RST_TICK_CNT (BIT(12)) +#define APB_CTRL_RST_TICK_CNT_M (BIT(12)) +#define APB_CTRL_RST_TICK_CNT_V 0x1 +#define APB_CTRL_RST_TICK_CNT_S 12 +/* APB_CTRL_CLK_EN : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_CLK_EN (BIT(11)) +#define APB_CTRL_CLK_EN_M (BIT(11)) +#define APB_CTRL_CLK_EN_V 0x1 +#define APB_CTRL_CLK_EN_S 11 +/* APB_CTRL_CLK_320M_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_CLK_320M_EN (BIT(10)) +#define APB_CTRL_CLK_320M_EN_M (BIT(10)) +#define APB_CTRL_CLK_320M_EN_V 0x1 +#define APB_CTRL_CLK_320M_EN_S 10 +/* APB_CTRL_PRE_DIV_CNT : R/W ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define APB_CTRL_PRE_DIV_CNT 0x000003FF +#define APB_CTRL_PRE_DIV_CNT_M ((APB_CTRL_PRE_DIV_CNT_V)<<(APB_CTRL_PRE_DIV_CNT_S)) +#define APB_CTRL_PRE_DIV_CNT_V 0x3FF +#define APB_CTRL_PRE_DIV_CNT_S 0 + +#define APB_CTRL_TICK_CONF_REG (DR_REG_APB_CTRL_BASE + 0x004) +/* APB_CTRL_TICK_ENABLE : R/W ;bitpos:[16] ;default: 1'd1 ; */ +/*description: */ +#define APB_CTRL_TICK_ENABLE (BIT(16)) +#define APB_CTRL_TICK_ENABLE_M (BIT(16)) +#define APB_CTRL_TICK_ENABLE_V 0x1 +#define APB_CTRL_TICK_ENABLE_S 16 +/* APB_CTRL_CK8M_TICK_NUM : R/W ;bitpos:[15:8] ;default: 8'd7 ; */ +/*description: */ +#define APB_CTRL_CK8M_TICK_NUM 0x000000FF +#define APB_CTRL_CK8M_TICK_NUM_M ((APB_CTRL_CK8M_TICK_NUM_V)<<(APB_CTRL_CK8M_TICK_NUM_S)) +#define APB_CTRL_CK8M_TICK_NUM_V 0xFF +#define APB_CTRL_CK8M_TICK_NUM_S 8 +/* APB_CTRL_XTAL_TICK_NUM : R/W ;bitpos:[7:0] ;default: 8'd39 ; */ +/*description: */ +#define APB_CTRL_XTAL_TICK_NUM 0x000000FF +#define APB_CTRL_XTAL_TICK_NUM_M ((APB_CTRL_XTAL_TICK_NUM_V)<<(APB_CTRL_XTAL_TICK_NUM_S)) +#define APB_CTRL_XTAL_TICK_NUM_V 0xFF +#define APB_CTRL_XTAL_TICK_NUM_S 0 + +#define APB_CTRL_SARADC_CTRL_REG (DR_REG_APB_CTRL_BASE + 0x008) +/* APB_CTRL_SARADC_XPD_SAR_FORCE : R/W ;bitpos:[28:27] ;default: 2'd0 ; */ +/*description: force option to xpd sar blocks*/ +#define APB_CTRL_SARADC_XPD_SAR_FORCE 0x00000003 +#define APB_CTRL_SARADC_XPD_SAR_FORCE_M ((APB_CTRL_SARADC_XPD_SAR_FORCE_V)<<(APB_CTRL_SARADC_XPD_SAR_FORCE_S)) +#define APB_CTRL_SARADC_XPD_SAR_FORCE_V 0x3 +#define APB_CTRL_SARADC_XPD_SAR_FORCE_S 27 +/* APB_CTRL_SARADC_DATA_TO_I2S : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: 1: I2S input data is from SAR ADC (for DMA) 0: I2S input data + is from GPIO matrix*/ +#define APB_CTRL_SARADC_DATA_TO_I2S (BIT(26)) +#define APB_CTRL_SARADC_DATA_TO_I2S_M (BIT(26)) +#define APB_CTRL_SARADC_DATA_TO_I2S_V 0x1 +#define APB_CTRL_SARADC_DATA_TO_I2S_S 26 +/* APB_CTRL_SARADC_DATA_SAR_SEL : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: 1: sar_sel will be coded by the MSB of the 16-bit output data + in this case the resolution should not be larger than 11 bits.*/ +#define APB_CTRL_SARADC_DATA_SAR_SEL (BIT(25)) +#define APB_CTRL_SARADC_DATA_SAR_SEL_M (BIT(25)) +#define APB_CTRL_SARADC_DATA_SAR_SEL_V 0x1 +#define APB_CTRL_SARADC_DATA_SAR_SEL_S 25 +/* APB_CTRL_SARADC_SAR2_PATT_P_CLEAR : R/W ;bitpos:[24] ;default: 1'd0 ; */ +/*description: clear the pointer of pattern table for DIG ADC2 CTRL*/ +#define APB_CTRL_SARADC_SAR2_PATT_P_CLEAR (BIT(24)) +#define APB_CTRL_SARADC_SAR2_PATT_P_CLEAR_M (BIT(24)) +#define APB_CTRL_SARADC_SAR2_PATT_P_CLEAR_V 0x1 +#define APB_CTRL_SARADC_SAR2_PATT_P_CLEAR_S 24 +/* APB_CTRL_SARADC_SAR1_PATT_P_CLEAR : R/W ;bitpos:[23] ;default: 1'd0 ; */ +/*description: clear the pointer of pattern table for DIG ADC1 CTRL*/ +#define APB_CTRL_SARADC_SAR1_PATT_P_CLEAR (BIT(23)) +#define APB_CTRL_SARADC_SAR1_PATT_P_CLEAR_M (BIT(23)) +#define APB_CTRL_SARADC_SAR1_PATT_P_CLEAR_V 0x1 +#define APB_CTRL_SARADC_SAR1_PATT_P_CLEAR_S 23 +/* APB_CTRL_SARADC_SAR2_PATT_LEN : R/W ;bitpos:[22:19] ;default: 4'd15 ; */ +/*description: 0 ~ 15 means length 1 ~ 16*/ +#define APB_CTRL_SARADC_SAR2_PATT_LEN 0x0000000F +#define APB_CTRL_SARADC_SAR2_PATT_LEN_M ((APB_CTRL_SARADC_SAR2_PATT_LEN_V)<<(APB_CTRL_SARADC_SAR2_PATT_LEN_S)) +#define APB_CTRL_SARADC_SAR2_PATT_LEN_V 0xF +#define APB_CTRL_SARADC_SAR2_PATT_LEN_S 19 +/* APB_CTRL_SARADC_SAR1_PATT_LEN : R/W ;bitpos:[18:15] ;default: 4'd15 ; */ +/*description: 0 ~ 15 means length 1 ~ 16*/ +#define APB_CTRL_SARADC_SAR1_PATT_LEN 0x0000000F +#define APB_CTRL_SARADC_SAR1_PATT_LEN_M ((APB_CTRL_SARADC_SAR1_PATT_LEN_V)<<(APB_CTRL_SARADC_SAR1_PATT_LEN_S)) +#define APB_CTRL_SARADC_SAR1_PATT_LEN_V 0xF +#define APB_CTRL_SARADC_SAR1_PATT_LEN_S 15 +/* APB_CTRL_SARADC_SAR_CLK_DIV : R/W ;bitpos:[14:7] ;default: 8'd4 ; */ +/*description: SAR clock divider*/ +#define APB_CTRL_SARADC_SAR_CLK_DIV 0x000000FF +#define APB_CTRL_SARADC_SAR_CLK_DIV_M ((APB_CTRL_SARADC_SAR_CLK_DIV_V)<<(APB_CTRL_SARADC_SAR_CLK_DIV_S)) +#define APB_CTRL_SARADC_SAR_CLK_DIV_V 0xFF +#define APB_CTRL_SARADC_SAR_CLK_DIV_S 7 +/* APB_CTRL_SARADC_SAR_CLK_GATED : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_SARADC_SAR_CLK_GATED (BIT(6)) +#define APB_CTRL_SARADC_SAR_CLK_GATED_M (BIT(6)) +#define APB_CTRL_SARADC_SAR_CLK_GATED_V 0x1 +#define APB_CTRL_SARADC_SAR_CLK_GATED_S 6 +/* APB_CTRL_SARADC_SAR_SEL : R/W ;bitpos:[5] ;default: 1'd0 ; */ +/*description: 0: SAR1 1: SAR2 only work for single SAR mode*/ +#define APB_CTRL_SARADC_SAR_SEL (BIT(5)) +#define APB_CTRL_SARADC_SAR_SEL_M (BIT(5)) +#define APB_CTRL_SARADC_SAR_SEL_V 0x1 +#define APB_CTRL_SARADC_SAR_SEL_S 5 +/* APB_CTRL_SARADC_WORK_MODE : R/W ;bitpos:[4:3] ;default: 2'd0 ; */ +/*description: 0: single mode 1: double mode 2: alternate mode*/ +#define APB_CTRL_SARADC_WORK_MODE 0x00000003 +#define APB_CTRL_SARADC_WORK_MODE_M ((APB_CTRL_SARADC_WORK_MODE_V)<<(APB_CTRL_SARADC_WORK_MODE_S)) +#define APB_CTRL_SARADC_WORK_MODE_V 0x3 +#define APB_CTRL_SARADC_WORK_MODE_S 3 +/* APB_CTRL_SARADC_START : R/W ;bitpos:[1] ;default: 1'd0 ; */ +/*description: */ +#define APB_CTRL_SARADC_START (BIT(1)) +#define APB_CTRL_SARADC_START_M (BIT(1)) +#define APB_CTRL_SARADC_START_V 0x1 +#define APB_CTRL_SARADC_START_S 1 +/* APB_CTRL_SARADC_START_FORCE : R/W ;bitpos:[0] ;default: 1'd0 ; */ +/*description: */ +#define APB_CTRL_SARADC_START_FORCE (BIT(0)) +#define APB_CTRL_SARADC_START_FORCE_M (BIT(0)) +#define APB_CTRL_SARADC_START_FORCE_V 0x1 +#define APB_CTRL_SARADC_START_FORCE_S 0 + +#define APB_CTRL_SARADC_CTRL2_REG (DR_REG_APB_CTRL_BASE + 0x00C) +/* APB_CTRL_SARADC_TIMER_EN : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: to enable saradc timer trigger*/ +#define APB_CTRL_SARADC_TIMER_EN (BIT(20)) +#define APB_CTRL_SARADC_TIMER_EN_M (BIT(20)) +#define APB_CTRL_SARADC_TIMER_EN_V 0x1 +#define APB_CTRL_SARADC_TIMER_EN_S 20 +/* APB_CTRL_SARADC_TIMER_TARGET : R/W ;bitpos:[19:12] ;default: 8'd10 ; */ +/*description: to set saradc timer target*/ +#define APB_CTRL_SARADC_TIMER_TARGET 0x000000FF +#define APB_CTRL_SARADC_TIMER_TARGET_M ((APB_CTRL_SARADC_TIMER_TARGET_V)<<(APB_CTRL_SARADC_TIMER_TARGET_S)) +#define APB_CTRL_SARADC_TIMER_TARGET_V 0xFF +#define APB_CTRL_SARADC_TIMER_TARGET_S 12 +/* APB_CTRL_SARADC_TIMER_SEL : R/W ;bitpos:[11] ;default: 1'd0 ; */ +/*description: 1: select saradc timer 0: i2s_ws trigger*/ +#define APB_CTRL_SARADC_TIMER_SEL (BIT(11)) +#define APB_CTRL_SARADC_TIMER_SEL_M (BIT(11)) +#define APB_CTRL_SARADC_TIMER_SEL_V 0x1 +#define APB_CTRL_SARADC_TIMER_SEL_S 11 +/* APB_CTRL_SARADC_SAR2_INV : R/W ;bitpos:[10] ;default: 1'd0 ; */ +/*description: 1: data to DIG ADC2 CTRL is inverted otherwise not*/ +#define APB_CTRL_SARADC_SAR2_INV (BIT(10)) +#define APB_CTRL_SARADC_SAR2_INV_M (BIT(10)) +#define APB_CTRL_SARADC_SAR2_INV_V 0x1 +#define APB_CTRL_SARADC_SAR2_INV_S 10 +/* APB_CTRL_SARADC_SAR1_INV : R/W ;bitpos:[9] ;default: 1'd0 ; */ +/*description: 1: data to DIG ADC1 CTRL is inverted otherwise not*/ +#define APB_CTRL_SARADC_SAR1_INV (BIT(9)) +#define APB_CTRL_SARADC_SAR1_INV_M (BIT(9)) +#define APB_CTRL_SARADC_SAR1_INV_V 0x1 +#define APB_CTRL_SARADC_SAR1_INV_S 9 +/* APB_CTRL_SARADC_MAX_MEAS_NUM : R/W ;bitpos:[8:1] ;default: 8'd255 ; */ +/*description: max conversion number*/ +#define APB_CTRL_SARADC_MAX_MEAS_NUM 0x000000FF +#define APB_CTRL_SARADC_MAX_MEAS_NUM_M ((APB_CTRL_SARADC_MAX_MEAS_NUM_V)<<(APB_CTRL_SARADC_MAX_MEAS_NUM_S)) +#define APB_CTRL_SARADC_MAX_MEAS_NUM_V 0xFF +#define APB_CTRL_SARADC_MAX_MEAS_NUM_S 1 +/* APB_CTRL_SARADC_MEAS_NUM_LIMIT : R/W ;bitpos:[0] ;default: 1'd0 ; */ +/*description: */ +#define APB_CTRL_SARADC_MEAS_NUM_LIMIT (BIT(0)) +#define APB_CTRL_SARADC_MEAS_NUM_LIMIT_M (BIT(0)) +#define APB_CTRL_SARADC_MEAS_NUM_LIMIT_V 0x1 +#define APB_CTRL_SARADC_MEAS_NUM_LIMIT_S 0 + +#define APB_CTRL_SARADC_FSM_REG (DR_REG_APB_CTRL_BASE + 0x010) +/* APB_CTRL_SARADC_SAMPLE_CYCLE : R/W ;bitpos:[31:24] ;default: 8'd2 ; */ +/*description: sample cycles*/ +#define APB_CTRL_SARADC_SAMPLE_CYCLE 0x000000FF +#define APB_CTRL_SARADC_SAMPLE_CYCLE_M ((APB_CTRL_SARADC_SAMPLE_CYCLE_V)<<(APB_CTRL_SARADC_SAMPLE_CYCLE_S)) +#define APB_CTRL_SARADC_SAMPLE_CYCLE_V 0xFF +#define APB_CTRL_SARADC_SAMPLE_CYCLE_S 24 +/* APB_CTRL_SARADC_SAMPLE_NUM : R/W ;bitpos:[23:16] ;default: 8'd0 ; */ +/*description: sample number*/ +#define APB_CTRL_SARADC_SAMPLE_NUM 0x000000FF +#define APB_CTRL_SARADC_SAMPLE_NUM_M ((APB_CTRL_SARADC_SAMPLE_NUM_V)<<(APB_CTRL_SARADC_SAMPLE_NUM_S)) +#define APB_CTRL_SARADC_SAMPLE_NUM_V 0xFF +#define APB_CTRL_SARADC_SAMPLE_NUM_S 16 + +#define APB_CTRL_SARADC_FSM_WAIT_REG (DR_REG_APB_CTRL_BASE + 0x014) +/* APB_CTRL_SARADC_STANDBY_WAIT : R/W ;bitpos:[23:16] ;default: 8'd255 ; */ +/*description: */ +#define APB_CTRL_SARADC_STANDBY_WAIT 0x000000FF +#define APB_CTRL_SARADC_STANDBY_WAIT_M ((APB_CTRL_SARADC_STANDBY_WAIT_V)<<(APB_CTRL_SARADC_STANDBY_WAIT_S)) +#define APB_CTRL_SARADC_STANDBY_WAIT_V 0xFF +#define APB_CTRL_SARADC_STANDBY_WAIT_S 16 +/* APB_CTRL_SARADC_RSTB_WAIT : R/W ;bitpos:[15:8] ;default: 8'd8 ; */ +/*description: */ +#define APB_CTRL_SARADC_RSTB_WAIT 0x000000FF +#define APB_CTRL_SARADC_RSTB_WAIT_M ((APB_CTRL_SARADC_RSTB_WAIT_V)<<(APB_CTRL_SARADC_RSTB_WAIT_S)) +#define APB_CTRL_SARADC_RSTB_WAIT_V 0xFF +#define APB_CTRL_SARADC_RSTB_WAIT_S 8 +/* APB_CTRL_SARADC_XPD_WAIT : R/W ;bitpos:[7:0] ;default: 8'd8 ; */ +/*description: */ +#define APB_CTRL_SARADC_XPD_WAIT 0x000000FF +#define APB_CTRL_SARADC_XPD_WAIT_M ((APB_CTRL_SARADC_XPD_WAIT_V)<<(APB_CTRL_SARADC_XPD_WAIT_S)) +#define APB_CTRL_SARADC_XPD_WAIT_V 0xFF +#define APB_CTRL_SARADC_XPD_WAIT_S 0 + +#define APB_CTRL_SARADC_SAR1_STATUS_REG (DR_REG_APB_CTRL_BASE + 0x018) +/* APB_CTRL_SARADC_SAR1_STATUS : RO ;bitpos:[31:0] ;default: 32'd0 ; */ +/*description: */ +#define APB_CTRL_SARADC_SAR1_STATUS 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR1_STATUS_M ((APB_CTRL_SARADC_SAR1_STATUS_V)<<(APB_CTRL_SARADC_SAR1_STATUS_S)) +#define APB_CTRL_SARADC_SAR1_STATUS_V 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR1_STATUS_S 0 + +#define APB_CTRL_SARADC_SAR2_STATUS_REG (DR_REG_APB_CTRL_BASE + 0x01C) +/* APB_CTRL_SARADC_SAR2_STATUS : RO ;bitpos:[31:0] ;default: 32'd0 ; */ +/*description: */ +#define APB_CTRL_SARADC_SAR2_STATUS 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR2_STATUS_M ((APB_CTRL_SARADC_SAR2_STATUS_V)<<(APB_CTRL_SARADC_SAR2_STATUS_S)) +#define APB_CTRL_SARADC_SAR2_STATUS_V 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR2_STATUS_S 0 + +#define APB_CTRL_SARADC_SAR1_PATT_TAB1_REG (DR_REG_APB_CTRL_BASE + 0x020) +/* APB_CTRL_SARADC_SAR1_PATT_TAB1 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: item 0 ~ 3 for pattern table 1 (each item one byte)*/ +#define APB_CTRL_SARADC_SAR1_PATT_TAB1 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR1_PATT_TAB1_M ((APB_CTRL_SARADC_SAR1_PATT_TAB1_V)<<(APB_CTRL_SARADC_SAR1_PATT_TAB1_S)) +#define APB_CTRL_SARADC_SAR1_PATT_TAB1_V 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR1_PATT_TAB1_S 0 + +#define APB_CTRL_SARADC_SAR1_PATT_TAB2_REG (DR_REG_APB_CTRL_BASE + 0x024) +/* APB_CTRL_SARADC_SAR1_PATT_TAB2 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 4 ~ 7 for pattern table 1 (each item one byte)*/ +#define APB_CTRL_SARADC_SAR1_PATT_TAB2 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR1_PATT_TAB2_M ((APB_CTRL_SARADC_SAR1_PATT_TAB2_V)<<(APB_CTRL_SARADC_SAR1_PATT_TAB2_S)) +#define APB_CTRL_SARADC_SAR1_PATT_TAB2_V 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR1_PATT_TAB2_S 0 + +#define APB_CTRL_SARADC_SAR1_PATT_TAB3_REG (DR_REG_APB_CTRL_BASE + 0x028) +/* APB_CTRL_SARADC_SAR1_PATT_TAB3 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 8 ~ 11 for pattern table 1 (each item one byte)*/ +#define APB_CTRL_SARADC_SAR1_PATT_TAB3 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR1_PATT_TAB3_M ((APB_CTRL_SARADC_SAR1_PATT_TAB3_V)<<(APB_CTRL_SARADC_SAR1_PATT_TAB3_S)) +#define APB_CTRL_SARADC_SAR1_PATT_TAB3_V 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR1_PATT_TAB3_S 0 + +#define APB_CTRL_SARADC_SAR1_PATT_TAB4_REG (DR_REG_APB_CTRL_BASE + 0x02C) +/* APB_CTRL_SARADC_SAR1_PATT_TAB4 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 12 ~ 15 for pattern table 1 (each item one byte)*/ +#define APB_CTRL_SARADC_SAR1_PATT_TAB4 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR1_PATT_TAB4_M ((APB_CTRL_SARADC_SAR1_PATT_TAB4_V)<<(APB_CTRL_SARADC_SAR1_PATT_TAB4_S)) +#define APB_CTRL_SARADC_SAR1_PATT_TAB4_V 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR1_PATT_TAB4_S 0 + +#define APB_CTRL_SARADC_SAR2_PATT_TAB1_REG (DR_REG_APB_CTRL_BASE + 0x030) +/* APB_CTRL_SARADC_SAR2_PATT_TAB1 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: item 0 ~ 3 for pattern table 2 (each item one byte)*/ +#define APB_CTRL_SARADC_SAR2_PATT_TAB1 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR2_PATT_TAB1_M ((APB_CTRL_SARADC_SAR2_PATT_TAB1_V)<<(APB_CTRL_SARADC_SAR2_PATT_TAB1_S)) +#define APB_CTRL_SARADC_SAR2_PATT_TAB1_V 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR2_PATT_TAB1_S 0 + +#define APB_CTRL_SARADC_SAR2_PATT_TAB2_REG (DR_REG_APB_CTRL_BASE + 0x034) +/* APB_CTRL_SARADC_SAR2_PATT_TAB2 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 4 ~ 7 for pattern table 2 (each item one byte)*/ +#define APB_CTRL_SARADC_SAR2_PATT_TAB2 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR2_PATT_TAB2_M ((APB_CTRL_SARADC_SAR2_PATT_TAB2_V)<<(APB_CTRL_SARADC_SAR2_PATT_TAB2_S)) +#define APB_CTRL_SARADC_SAR2_PATT_TAB2_V 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR2_PATT_TAB2_S 0 + +#define APB_CTRL_SARADC_SAR2_PATT_TAB3_REG (DR_REG_APB_CTRL_BASE + 0x038) +/* APB_CTRL_SARADC_SAR2_PATT_TAB3 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 8 ~ 11 for pattern table 2 (each item one byte)*/ +#define APB_CTRL_SARADC_SAR2_PATT_TAB3 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR2_PATT_TAB3_M ((APB_CTRL_SARADC_SAR2_PATT_TAB3_V)<<(APB_CTRL_SARADC_SAR2_PATT_TAB3_S)) +#define APB_CTRL_SARADC_SAR2_PATT_TAB3_V 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR2_PATT_TAB3_S 0 + +#define APB_CTRL_SARADC_SAR2_PATT_TAB4_REG (DR_REG_APB_CTRL_BASE + 0x03C) +/* APB_CTRL_SARADC_SAR2_PATT_TAB4 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 12 ~ 15 for pattern table 2 (each item one byte)*/ +#define APB_CTRL_SARADC_SAR2_PATT_TAB4 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR2_PATT_TAB4_M ((APB_CTRL_SARADC_SAR2_PATT_TAB4_V)<<(APB_CTRL_SARADC_SAR2_PATT_TAB4_S)) +#define APB_CTRL_SARADC_SAR2_PATT_TAB4_V 0xFFFFFFFF +#define APB_CTRL_SARADC_SAR2_PATT_TAB4_S 0 + +#define APB_CTRL_ADC_ARB_CTRL_REG (DR_REG_APB_CTRL_BASE + 0x040) +/* APB_CTRL_ADC_ARB_FIX_PRIORITY : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: adc2 arbiter uses fixed priority*/ +#define APB_CTRL_ADC_ARB_FIX_PRIORITY (BIT(12)) +#define APB_CTRL_ADC_ARB_FIX_PRIORITY_M (BIT(12)) +#define APB_CTRL_ADC_ARB_FIX_PRIORITY_V 0x1 +#define APB_CTRL_ADC_ARB_FIX_PRIORITY_S 12 +/* APB_CTRL_ADC_ARB_WIFI_PRIORITY : R/W ;bitpos:[11:10] ;default: 2'd2 ; */ +/*description: Set adc2 arbiter wifi priority*/ +#define APB_CTRL_ADC_ARB_WIFI_PRIORITY 0x00000003 +#define APB_CTRL_ADC_ARB_WIFI_PRIORITY_M ((APB_CTRL_ADC_ARB_WIFI_PRIORITY_V)<<(APB_CTRL_ADC_ARB_WIFI_PRIORITY_S)) +#define APB_CTRL_ADC_ARB_WIFI_PRIORITY_V 0x3 +#define APB_CTRL_ADC_ARB_WIFI_PRIORITY_S 10 +/* APB_CTRL_ADC_ARB_RTC_PRIORITY : R/W ;bitpos:[9:8] ;default: 2'd1 ; */ +/*description: Set adc2 arbiter rtc priority*/ +#define APB_CTRL_ADC_ARB_RTC_PRIORITY 0x00000003 +#define APB_CTRL_ADC_ARB_RTC_PRIORITY_M ((APB_CTRL_ADC_ARB_RTC_PRIORITY_V)<<(APB_CTRL_ADC_ARB_RTC_PRIORITY_S)) +#define APB_CTRL_ADC_ARB_RTC_PRIORITY_V 0x3 +#define APB_CTRL_ADC_ARB_RTC_PRIORITY_S 8 +/* APB_CTRL_ADC_ARB_APB_PRIORITY : R/W ;bitpos:[7:6] ;default: 2'd0 ; */ +/*description: Set adc2 arbiter apb priority*/ +#define APB_CTRL_ADC_ARB_APB_PRIORITY 0x00000003 +#define APB_CTRL_ADC_ARB_APB_PRIORITY_M ((APB_CTRL_ADC_ARB_APB_PRIORITY_V)<<(APB_CTRL_ADC_ARB_APB_PRIORITY_S)) +#define APB_CTRL_ADC_ARB_APB_PRIORITY_V 0x3 +#define APB_CTRL_ADC_ARB_APB_PRIORITY_S 6 +/* APB_CTRL_ADC_ARB_GRANT_FORCE : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: adc2 arbiter force grant*/ +#define APB_CTRL_ADC_ARB_GRANT_FORCE (BIT(5)) +#define APB_CTRL_ADC_ARB_GRANT_FORCE_M (BIT(5)) +#define APB_CTRL_ADC_ARB_GRANT_FORCE_V 0x1 +#define APB_CTRL_ADC_ARB_GRANT_FORCE_S 5 +/* APB_CTRL_ADC_ARB_WIFI_FORCE : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: adc2 arbiter force to enable wifi controller*/ +#define APB_CTRL_ADC_ARB_WIFI_FORCE (BIT(4)) +#define APB_CTRL_ADC_ARB_WIFI_FORCE_M (BIT(4)) +#define APB_CTRL_ADC_ARB_WIFI_FORCE_V 0x1 +#define APB_CTRL_ADC_ARB_WIFI_FORCE_S 4 +/* APB_CTRL_ADC_ARB_RTC_FORCE : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: adc2 arbiter force to enable rtc controller*/ +#define APB_CTRL_ADC_ARB_RTC_FORCE (BIT(3)) +#define APB_CTRL_ADC_ARB_RTC_FORCE_M (BIT(3)) +#define APB_CTRL_ADC_ARB_RTC_FORCE_V 0x1 +#define APB_CTRL_ADC_ARB_RTC_FORCE_S 3 +/* APB_CTRL_ADC_ARB_APB_FORCE : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: adc2 arbiter force to enable apb controller*/ +#define APB_CTRL_ADC_ARB_APB_FORCE (BIT(2)) +#define APB_CTRL_ADC_ARB_APB_FORCE_M (BIT(2)) +#define APB_CTRL_ADC_ARB_APB_FORCE_V 0x1 +#define APB_CTRL_ADC_ARB_APB_FORCE_S 2 + +#define APB_CTRL_CLK_OUT_EN_REG (DR_REG_APB_CTRL_BASE + 0x044) +/* APB_CTRL_CLK_XTAL_OEN : R/W ;bitpos:[10] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK_XTAL_OEN (BIT(10)) +#define APB_CTRL_CLK_XTAL_OEN_M (BIT(10)) +#define APB_CTRL_CLK_XTAL_OEN_V 0x1 +#define APB_CTRL_CLK_XTAL_OEN_S 10 +/* APB_CTRL_CLK40X_BB_OEN : R/W ;bitpos:[9] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK40X_BB_OEN (BIT(9)) +#define APB_CTRL_CLK40X_BB_OEN_M (BIT(9)) +#define APB_CTRL_CLK40X_BB_OEN_V 0x1 +#define APB_CTRL_CLK40X_BB_OEN_S 9 +/* APB_CTRL_CLK_DAC_CPU_OEN : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK_DAC_CPU_OEN (BIT(8)) +#define APB_CTRL_CLK_DAC_CPU_OEN_M (BIT(8)) +#define APB_CTRL_CLK_DAC_CPU_OEN_V 0x1 +#define APB_CTRL_CLK_DAC_CPU_OEN_S 8 +/* APB_CTRL_CLK_ADC_INF_OEN : R/W ;bitpos:[7] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK_ADC_INF_OEN (BIT(7)) +#define APB_CTRL_CLK_ADC_INF_OEN_M (BIT(7)) +#define APB_CTRL_CLK_ADC_INF_OEN_V 0x1 +#define APB_CTRL_CLK_ADC_INF_OEN_S 7 +/* APB_CTRL_CLK_320M_OEN : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK_320M_OEN (BIT(6)) +#define APB_CTRL_CLK_320M_OEN_M (BIT(6)) +#define APB_CTRL_CLK_320M_OEN_V 0x1 +#define APB_CTRL_CLK_320M_OEN_S 6 +/* APB_CTRL_CLK160_OEN : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK160_OEN (BIT(5)) +#define APB_CTRL_CLK160_OEN_M (BIT(5)) +#define APB_CTRL_CLK160_OEN_V 0x1 +#define APB_CTRL_CLK160_OEN_S 5 +/* APB_CTRL_CLK80_OEN : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK80_OEN (BIT(4)) +#define APB_CTRL_CLK80_OEN_M (BIT(4)) +#define APB_CTRL_CLK80_OEN_V 0x1 +#define APB_CTRL_CLK80_OEN_S 4 +/* APB_CTRL_CLK_BB_OEN : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK_BB_OEN (BIT(3)) +#define APB_CTRL_CLK_BB_OEN_M (BIT(3)) +#define APB_CTRL_CLK_BB_OEN_V 0x1 +#define APB_CTRL_CLK_BB_OEN_S 3 +/* APB_CTRL_CLK44_OEN : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK44_OEN (BIT(2)) +#define APB_CTRL_CLK44_OEN_M (BIT(2)) +#define APB_CTRL_CLK44_OEN_V 0x1 +#define APB_CTRL_CLK44_OEN_S 2 +/* APB_CTRL_CLK22_OEN : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK22_OEN (BIT(1)) +#define APB_CTRL_CLK22_OEN_M (BIT(1)) +#define APB_CTRL_CLK22_OEN_V 0x1 +#define APB_CTRL_CLK22_OEN_S 1 +/* APB_CTRL_CLK20_OEN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_CLK20_OEN (BIT(0)) +#define APB_CTRL_CLK20_OEN_M (BIT(0)) +#define APB_CTRL_CLK20_OEN_V 0x1 +#define APB_CTRL_CLK20_OEN_S 0 + +#define APB_CTRL_HOST_INF_SEL_REG (DR_REG_APB_CTRL_BASE + 0x048) +/* APB_CTRL_SPI_PRIOR : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_SPI_PRIOR (BIT(13)) +#define APB_CTRL_SPI_PRIOR_M (BIT(13)) +#define APB_CTRL_SPI_PRIOR_V 0x1 +#define APB_CTRL_SPI_PRIOR_S 13 +/* APB_CTRL_SPI1_HOLD : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_SPI1_HOLD (BIT(9)) +#define APB_CTRL_SPI1_HOLD_M (BIT(9)) +#define APB_CTRL_SPI1_HOLD_V 0x1 +#define APB_CTRL_SPI1_HOLD_S 9 +/* APB_CTRL_SPI0_HOLD : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_SPI0_HOLD (BIT(8)) +#define APB_CTRL_SPI0_HOLD_M (BIT(8)) +#define APB_CTRL_SPI0_HOLD_V 0x1 +#define APB_CTRL_SPI0_HOLD_S 8 +/* APB_CTRL_PERI_IO_SWAP : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define APB_CTRL_PERI_IO_SWAP 0x000000FF +#define APB_CTRL_PERI_IO_SWAP_M ((APB_CTRL_PERI_IO_SWAP_V)<<(APB_CTRL_PERI_IO_SWAP_S)) +#define APB_CTRL_PERI_IO_SWAP_V 0xFF +#define APB_CTRL_PERI_IO_SWAP_S 0 + +#define APB_CTRL_EXT_MEM_PMS_LOCK_REG (DR_REG_APB_CTRL_BASE + 0x04C) +/* APB_CTRL_EXT_MEM_PMS_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_EXT_MEM_PMS_LOCK (BIT(0)) +#define APB_CTRL_EXT_MEM_PMS_LOCK_M (BIT(0)) +#define APB_CTRL_EXT_MEM_PMS_LOCK_V 0x1 +#define APB_CTRL_EXT_MEM_PMS_LOCK_S 0 + +#define APB_CTRL_FLASH_ACE0_ATTR_REG (DR_REG_APB_CTRL_BASE + 0x050) +/* APB_CTRL_FLASH_ACE0_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE0_ATTR 0x00000007 +#define APB_CTRL_FLASH_ACE0_ATTR_M ((APB_CTRL_FLASH_ACE0_ATTR_V)<<(APB_CTRL_FLASH_ACE0_ATTR_S)) +#define APB_CTRL_FLASH_ACE0_ATTR_V 0x7 +#define APB_CTRL_FLASH_ACE0_ATTR_S 0 + +#define APB_CTRL_FLASH_ACE1_ATTR_REG (DR_REG_APB_CTRL_BASE + 0x054) +/* APB_CTRL_FLASH_ACE1_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE1_ATTR 0x00000007 +#define APB_CTRL_FLASH_ACE1_ATTR_M ((APB_CTRL_FLASH_ACE1_ATTR_V)<<(APB_CTRL_FLASH_ACE1_ATTR_S)) +#define APB_CTRL_FLASH_ACE1_ATTR_V 0x7 +#define APB_CTRL_FLASH_ACE1_ATTR_S 0 + +#define APB_CTRL_FLASH_ACE2_ATTR_REG (DR_REG_APB_CTRL_BASE + 0x058) +/* APB_CTRL_FLASH_ACE2_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE2_ATTR 0x00000007 +#define APB_CTRL_FLASH_ACE2_ATTR_M ((APB_CTRL_FLASH_ACE2_ATTR_V)<<(APB_CTRL_FLASH_ACE2_ATTR_S)) +#define APB_CTRL_FLASH_ACE2_ATTR_V 0x7 +#define APB_CTRL_FLASH_ACE2_ATTR_S 0 + +#define APB_CTRL_FLASH_ACE3_ATTR_REG (DR_REG_APB_CTRL_BASE + 0x05C) +/* APB_CTRL_FLASH_ACE3_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE3_ATTR 0x00000007 +#define APB_CTRL_FLASH_ACE3_ATTR_M ((APB_CTRL_FLASH_ACE3_ATTR_V)<<(APB_CTRL_FLASH_ACE3_ATTR_S)) +#define APB_CTRL_FLASH_ACE3_ATTR_V 0x7 +#define APB_CTRL_FLASH_ACE3_ATTR_S 0 + +#define APB_CTRL_FLASH_ACE0_ADDR_REG (DR_REG_APB_CTRL_BASE + 0x060) +/* APB_CTRL_FLASH_ACE0_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE0_ADDR_S 0xFFFFFFFF +#define APB_CTRL_FLASH_ACE0_ADDR_S_M ((APB_CTRL_FLASH_ACE0_ADDR_S_V)<<(APB_CTRL_FLASH_ACE0_ADDR_S_S)) +#define APB_CTRL_FLASH_ACE0_ADDR_S_V 0xFFFFFFFF +#define APB_CTRL_FLASH_ACE0_ADDR_S_S 0 + +#define APB_CTRL_FLASH_ACE1_ADDR_REG (DR_REG_APB_CTRL_BASE + 0x064) +/* APB_CTRL_FLASH_ACE1_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h10000000 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE1_ADDR_S 0xFFFFFFFF +#define APB_CTRL_FLASH_ACE1_ADDR_S_M ((APB_CTRL_FLASH_ACE1_ADDR_S_V)<<(APB_CTRL_FLASH_ACE1_ADDR_S_S)) +#define APB_CTRL_FLASH_ACE1_ADDR_S_V 0xFFFFFFFF +#define APB_CTRL_FLASH_ACE1_ADDR_S_S 0 + +#define APB_CTRL_FLASH_ACE2_ADDR_REG (DR_REG_APB_CTRL_BASE + 0x068) +/* APB_CTRL_FLASH_ACE2_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h20000000 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE2_ADDR_S 0xFFFFFFFF +#define APB_CTRL_FLASH_ACE2_ADDR_S_M ((APB_CTRL_FLASH_ACE2_ADDR_S_V)<<(APB_CTRL_FLASH_ACE2_ADDR_S_S)) +#define APB_CTRL_FLASH_ACE2_ADDR_S_V 0xFFFFFFFF +#define APB_CTRL_FLASH_ACE2_ADDR_S_S 0 + +#define APB_CTRL_FLASH_ACE3_ADDR_REG (DR_REG_APB_CTRL_BASE + 0x06C) +/* APB_CTRL_FLASH_ACE3_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h30000000 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE3_ADDR_S 0xFFFFFFFF +#define APB_CTRL_FLASH_ACE3_ADDR_S_M ((APB_CTRL_FLASH_ACE3_ADDR_S_V)<<(APB_CTRL_FLASH_ACE3_ADDR_S_S)) +#define APB_CTRL_FLASH_ACE3_ADDR_S_V 0xFFFFFFFF +#define APB_CTRL_FLASH_ACE3_ADDR_S_S 0 + +#define APB_CTRL_FLASH_ACE0_SIZE_REG (DR_REG_APB_CTRL_BASE + 0x070) +/* APB_CTRL_FLASH_ACE0_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE0_SIZE 0x0000FFFF +#define APB_CTRL_FLASH_ACE0_SIZE_M ((APB_CTRL_FLASH_ACE0_SIZE_V)<<(APB_CTRL_FLASH_ACE0_SIZE_S)) +#define APB_CTRL_FLASH_ACE0_SIZE_V 0xFFFF +#define APB_CTRL_FLASH_ACE0_SIZE_S 0 + +#define APB_CTRL_FLASH_ACE1_SIZE_REG (DR_REG_APB_CTRL_BASE + 0x074) +/* APB_CTRL_FLASH_ACE1_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE1_SIZE 0x0000FFFF +#define APB_CTRL_FLASH_ACE1_SIZE_M ((APB_CTRL_FLASH_ACE1_SIZE_V)<<(APB_CTRL_FLASH_ACE1_SIZE_S)) +#define APB_CTRL_FLASH_ACE1_SIZE_V 0xFFFF +#define APB_CTRL_FLASH_ACE1_SIZE_S 0 + +#define APB_CTRL_FLASH_ACE2_SIZE_REG (DR_REG_APB_CTRL_BASE + 0x078) +/* APB_CTRL_FLASH_ACE2_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE2_SIZE 0x0000FFFF +#define APB_CTRL_FLASH_ACE2_SIZE_M ((APB_CTRL_FLASH_ACE2_SIZE_V)<<(APB_CTRL_FLASH_ACE2_SIZE_S)) +#define APB_CTRL_FLASH_ACE2_SIZE_V 0xFFFF +#define APB_CTRL_FLASH_ACE2_SIZE_S 0 + +#define APB_CTRL_FLASH_ACE3_SIZE_REG (DR_REG_APB_CTRL_BASE + 0x07C) +/* APB_CTRL_FLASH_ACE3_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define APB_CTRL_FLASH_ACE3_SIZE 0x0000FFFF +#define APB_CTRL_FLASH_ACE3_SIZE_M ((APB_CTRL_FLASH_ACE3_SIZE_V)<<(APB_CTRL_FLASH_ACE3_SIZE_S)) +#define APB_CTRL_FLASH_ACE3_SIZE_V 0xFFFF +#define APB_CTRL_FLASH_ACE3_SIZE_S 0 + +#define APB_CTRL_SRAM_ACE0_ATTR_REG (DR_REG_APB_CTRL_BASE + 0x080) +/* APB_CTRL_SRAM_ACE0_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE0_ATTR 0x00000007 +#define APB_CTRL_SRAM_ACE0_ATTR_M ((APB_CTRL_SRAM_ACE0_ATTR_V)<<(APB_CTRL_SRAM_ACE0_ATTR_S)) +#define APB_CTRL_SRAM_ACE0_ATTR_V 0x7 +#define APB_CTRL_SRAM_ACE0_ATTR_S 0 + +#define APB_CTRL_SRAM_ACE1_ATTR_REG (DR_REG_APB_CTRL_BASE + 0x084) +/* APB_CTRL_SRAM_ACE1_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE1_ATTR 0x00000007 +#define APB_CTRL_SRAM_ACE1_ATTR_M ((APB_CTRL_SRAM_ACE1_ATTR_V)<<(APB_CTRL_SRAM_ACE1_ATTR_S)) +#define APB_CTRL_SRAM_ACE1_ATTR_V 0x7 +#define APB_CTRL_SRAM_ACE1_ATTR_S 0 + +#define APB_CTRL_SRAM_ACE2_ATTR_REG (DR_REG_APB_CTRL_BASE + 0x088) +/* APB_CTRL_SRAM_ACE2_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE2_ATTR 0x00000007 +#define APB_CTRL_SRAM_ACE2_ATTR_M ((APB_CTRL_SRAM_ACE2_ATTR_V)<<(APB_CTRL_SRAM_ACE2_ATTR_S)) +#define APB_CTRL_SRAM_ACE2_ATTR_V 0x7 +#define APB_CTRL_SRAM_ACE2_ATTR_S 0 + +#define APB_CTRL_SRAM_ACE3_ATTR_REG (DR_REG_APB_CTRL_BASE + 0x08C) +/* APB_CTRL_SRAM_ACE3_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE3_ATTR 0x00000007 +#define APB_CTRL_SRAM_ACE3_ATTR_M ((APB_CTRL_SRAM_ACE3_ATTR_V)<<(APB_CTRL_SRAM_ACE3_ATTR_S)) +#define APB_CTRL_SRAM_ACE3_ATTR_V 0x7 +#define APB_CTRL_SRAM_ACE3_ATTR_S 0 + +#define APB_CTRL_SRAM_ACE0_ADDR_REG (DR_REG_APB_CTRL_BASE + 0x090) +/* APB_CTRL_SRAM_ACE0_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE0_ADDR_S 0xFFFFFFFF +#define APB_CTRL_SRAM_ACE0_ADDR_S_M ((APB_CTRL_SRAM_ACE0_ADDR_S_V)<<(APB_CTRL_SRAM_ACE0_ADDR_S_S)) +#define APB_CTRL_SRAM_ACE0_ADDR_S_V 0xFFFFFFFF +#define APB_CTRL_SRAM_ACE0_ADDR_S_S 0 + +#define APB_CTRL_SRAM_ACE1_ADDR_REG (DR_REG_APB_CTRL_BASE + 0x094) +/* APB_CTRL_SRAM_ACE1_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h10000000 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE1_ADDR_S 0xFFFFFFFF +#define APB_CTRL_SRAM_ACE1_ADDR_S_M ((APB_CTRL_SRAM_ACE1_ADDR_S_V)<<(APB_CTRL_SRAM_ACE1_ADDR_S_S)) +#define APB_CTRL_SRAM_ACE1_ADDR_S_V 0xFFFFFFFF +#define APB_CTRL_SRAM_ACE1_ADDR_S_S 0 + +#define APB_CTRL_SRAM_ACE2_ADDR_REG (DR_REG_APB_CTRL_BASE + 0x098) +/* APB_CTRL_SRAM_ACE2_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h20000000 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE2_ADDR_S 0xFFFFFFFF +#define APB_CTRL_SRAM_ACE2_ADDR_S_M ((APB_CTRL_SRAM_ACE2_ADDR_S_V)<<(APB_CTRL_SRAM_ACE2_ADDR_S_S)) +#define APB_CTRL_SRAM_ACE2_ADDR_S_V 0xFFFFFFFF +#define APB_CTRL_SRAM_ACE2_ADDR_S_S 0 + +#define APB_CTRL_SRAM_ACE3_ADDR_REG (DR_REG_APB_CTRL_BASE + 0x09C) +/* APB_CTRL_SRAM_ACE3_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h30000000 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE3_ADDR_S 0xFFFFFFFF +#define APB_CTRL_SRAM_ACE3_ADDR_S_M ((APB_CTRL_SRAM_ACE3_ADDR_S_V)<<(APB_CTRL_SRAM_ACE3_ADDR_S_S)) +#define APB_CTRL_SRAM_ACE3_ADDR_S_V 0xFFFFFFFF +#define APB_CTRL_SRAM_ACE3_ADDR_S_S 0 + +#define APB_CTRL_SRAM_ACE0_SIZE_REG (DR_REG_APB_CTRL_BASE + 0x0A0) +/* APB_CTRL_SRAM_ACE0_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE0_SIZE 0x0000FFFF +#define APB_CTRL_SRAM_ACE0_SIZE_M ((APB_CTRL_SRAM_ACE0_SIZE_V)<<(APB_CTRL_SRAM_ACE0_SIZE_S)) +#define APB_CTRL_SRAM_ACE0_SIZE_V 0xFFFF +#define APB_CTRL_SRAM_ACE0_SIZE_S 0 + +#define APB_CTRL_SRAM_ACE1_SIZE_REG (DR_REG_APB_CTRL_BASE + 0x0A4) +/* APB_CTRL_SRAM_ACE1_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE1_SIZE 0x0000FFFF +#define APB_CTRL_SRAM_ACE1_SIZE_M ((APB_CTRL_SRAM_ACE1_SIZE_V)<<(APB_CTRL_SRAM_ACE1_SIZE_S)) +#define APB_CTRL_SRAM_ACE1_SIZE_V 0xFFFF +#define APB_CTRL_SRAM_ACE1_SIZE_S 0 + +#define APB_CTRL_SRAM_ACE2_SIZE_REG (DR_REG_APB_CTRL_BASE + 0x0A8) +/* APB_CTRL_SRAM_ACE2_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE2_SIZE 0x0000FFFF +#define APB_CTRL_SRAM_ACE2_SIZE_M ((APB_CTRL_SRAM_ACE2_SIZE_V)<<(APB_CTRL_SRAM_ACE2_SIZE_S)) +#define APB_CTRL_SRAM_ACE2_SIZE_V 0xFFFF +#define APB_CTRL_SRAM_ACE2_SIZE_S 0 + +#define APB_CTRL_SRAM_ACE3_SIZE_REG (DR_REG_APB_CTRL_BASE + 0x0AC) +/* APB_CTRL_SRAM_ACE3_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define APB_CTRL_SRAM_ACE3_SIZE 0x0000FFFF +#define APB_CTRL_SRAM_ACE3_SIZE_M ((APB_CTRL_SRAM_ACE3_SIZE_V)<<(APB_CTRL_SRAM_ACE3_SIZE_S)) +#define APB_CTRL_SRAM_ACE3_SIZE_V 0xFFFF +#define APB_CTRL_SRAM_ACE3_SIZE_S 0 + +#define APB_CTRL_SPI0_PMS_CTRL_REG (DR_REG_APB_CTRL_BASE + 0x0B0) +/* APB_CTRL_SPI0_REJECT_CDE : RO ;bitpos:[6:2] ;default: 5'h0 ; */ +/*description: */ +#define APB_CTRL_SPI0_REJECT_CDE 0x0000001F +#define APB_CTRL_SPI0_REJECT_CDE_M ((APB_CTRL_SPI0_REJECT_CDE_V)<<(APB_CTRL_SPI0_REJECT_CDE_S)) +#define APB_CTRL_SPI0_REJECT_CDE_V 0x1F +#define APB_CTRL_SPI0_REJECT_CDE_S 2 +/* APB_CTRL_SPI0_REJECT_CLR : WOD ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_SPI0_REJECT_CLR (BIT(1)) +#define APB_CTRL_SPI0_REJECT_CLR_M (BIT(1)) +#define APB_CTRL_SPI0_REJECT_CLR_V 0x1 +#define APB_CTRL_SPI0_REJECT_CLR_S 1 +/* APB_CTRL_SPI0_REJECT_INT : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_SPI0_REJECT_INT (BIT(0)) +#define APB_CTRL_SPI0_REJECT_INT_M (BIT(0)) +#define APB_CTRL_SPI0_REJECT_INT_V 0x1 +#define APB_CTRL_SPI0_REJECT_INT_S 0 + +#define APB_CTRL_SPI0_REJECT_ADDR_REG (DR_REG_APB_CTRL_BASE + 0x0B4) +/* APB_CTRL_SPI0_REJECT_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define APB_CTRL_SPI0_REJECT_ADDR 0xFFFFFFFF +#define APB_CTRL_SPI0_REJECT_ADDR_M ((APB_CTRL_SPI0_REJECT_ADDR_V)<<(APB_CTRL_SPI0_REJECT_ADDR_S)) +#define APB_CTRL_SPI0_REJECT_ADDR_V 0xFFFFFFFF +#define APB_CTRL_SPI0_REJECT_ADDR_S 0 + +#define APB_CTRL_SPI1_PMS_CTRL_REG (DR_REG_APB_CTRL_BASE + 0x0B8) +/* APB_CTRL_SPI1_REJECT_CDE : RO ;bitpos:[6:2] ;default: 5'h0 ; */ +/*description: */ +#define APB_CTRL_SPI1_REJECT_CDE 0x0000001F +#define APB_CTRL_SPI1_REJECT_CDE_M ((APB_CTRL_SPI1_REJECT_CDE_V)<<(APB_CTRL_SPI1_REJECT_CDE_S)) +#define APB_CTRL_SPI1_REJECT_CDE_V 0x1F +#define APB_CTRL_SPI1_REJECT_CDE_S 2 +/* APB_CTRL_SPI1_REJECT_CLR : WOD ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_SPI1_REJECT_CLR (BIT(1)) +#define APB_CTRL_SPI1_REJECT_CLR_M (BIT(1)) +#define APB_CTRL_SPI1_REJECT_CLR_V 0x1 +#define APB_CTRL_SPI1_REJECT_CLR_S 1 +/* APB_CTRL_SPI1_REJECT_INT : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_SPI1_REJECT_INT (BIT(0)) +#define APB_CTRL_SPI1_REJECT_INT_M (BIT(0)) +#define APB_CTRL_SPI1_REJECT_INT_V 0x1 +#define APB_CTRL_SPI1_REJECT_INT_S 0 + +#define APB_CTRL_SPI1_REJECT_ADDR_REG (DR_REG_APB_CTRL_BASE + 0x0BC) +/* APB_CTRL_SPI1_REJECT_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define APB_CTRL_SPI1_REJECT_ADDR 0xFFFFFFFF +#define APB_CTRL_SPI1_REJECT_ADDR_M ((APB_CTRL_SPI1_REJECT_ADDR_V)<<(APB_CTRL_SPI1_REJECT_ADDR_S)) +#define APB_CTRL_SPI1_REJECT_ADDR_V 0xFFFFFFFF +#define APB_CTRL_SPI1_REJECT_ADDR_S 0 + +#define APB_CTRL_SDIO_CTRL_REG (DR_REG_APB_CTRL_BASE + 0x0C0) +/* APB_CTRL_SDIO_WIN_ACCESS_EN : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define APB_CTRL_SDIO_WIN_ACCESS_EN (BIT(0)) +#define APB_CTRL_SDIO_WIN_ACCESS_EN_M (BIT(0)) +#define APB_CTRL_SDIO_WIN_ACCESS_EN_V 0x1 +#define APB_CTRL_SDIO_WIN_ACCESS_EN_S 0 + +#define APB_CTRL_REDCY_SIG0_REG (DR_REG_APB_CTRL_BASE + 0x0C4) +/* APB_CTRL_REDCY_ANDOR : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define APB_CTRL_REDCY_ANDOR (BIT(31)) +#define APB_CTRL_REDCY_ANDOR_M (BIT(31)) +#define APB_CTRL_REDCY_ANDOR_V 0x1 +#define APB_CTRL_REDCY_ANDOR_S 31 +/* APB_CTRL_REDCY_SIG0 : R/W ;bitpos:[30:0] ;default: 31'h0 ; */ +/*description: */ +#define APB_CTRL_REDCY_SIG0 0x7FFFFFFF +#define APB_CTRL_REDCY_SIG0_M ((APB_CTRL_REDCY_SIG0_V)<<(APB_CTRL_REDCY_SIG0_S)) +#define APB_CTRL_REDCY_SIG0_V 0x7FFFFFFF +#define APB_CTRL_REDCY_SIG0_S 0 + +#define APB_CTRL_REDCY_SIG1_REG (DR_REG_APB_CTRL_BASE + 0x0C8) +/* APB_CTRL_REDCY_NANDOR : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define APB_CTRL_REDCY_NANDOR (BIT(31)) +#define APB_CTRL_REDCY_NANDOR_M (BIT(31)) +#define APB_CTRL_REDCY_NANDOR_V 0x1 +#define APB_CTRL_REDCY_NANDOR_S 31 +/* APB_CTRL_REDCY_SIG1 : R/W ;bitpos:[30:0] ;default: 31'h0 ; */ +/*description: */ +#define APB_CTRL_REDCY_SIG1 0x7FFFFFFF +#define APB_CTRL_REDCY_SIG1_M ((APB_CTRL_REDCY_SIG1_V)<<(APB_CTRL_REDCY_SIG1_S)) +#define APB_CTRL_REDCY_SIG1_V 0x7FFFFFFF +#define APB_CTRL_REDCY_SIG1_S 0 + +#define APB_CTRL_WIFI_BB_CFG_REG (DR_REG_APB_CTRL_BASE + 0x0CC) +/* APB_CTRL_WIFI_BB_CFG : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define APB_CTRL_WIFI_BB_CFG 0xFFFFFFFF +#define APB_CTRL_WIFI_BB_CFG_M ((APB_CTRL_WIFI_BB_CFG_V)<<(APB_CTRL_WIFI_BB_CFG_S)) +#define APB_CTRL_WIFI_BB_CFG_V 0xFFFFFFFF +#define APB_CTRL_WIFI_BB_CFG_S 0 + +#define APB_CTRL_WIFI_BB_CFG_2_REG (DR_REG_APB_CTRL_BASE + 0x0D0) +/* APB_CTRL_WIFI_BB_CFG_2 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define APB_CTRL_WIFI_BB_CFG_2 0xFFFFFFFF +#define APB_CTRL_WIFI_BB_CFG_2_M ((APB_CTRL_WIFI_BB_CFG_2_V)<<(APB_CTRL_WIFI_BB_CFG_2_S)) +#define APB_CTRL_WIFI_BB_CFG_2_V 0xFFFFFFFF +#define APB_CTRL_WIFI_BB_CFG_2_S 0 + +#define APB_CTRL_WIFI_CLK_EN_REG (DR_REG_APB_CTRL_BASE + 0x0D4) +/* APB_CTRL_WIFI_CLK_EN : R/W ;bitpos:[31:0] ;default: 32'hfffce030 ; */ +/*description: */ +#define APB_CTRL_WIFI_CLK_EN 0xFFFFFFFF +#define APB_CTRL_WIFI_CLK_EN_M ((APB_CTRL_WIFI_CLK_EN_V)<<(APB_CTRL_WIFI_CLK_EN_S)) +#define APB_CTRL_WIFI_CLK_EN_V 0xFFFFFFFF +#define APB_CTRL_WIFI_CLK_EN_S 0 + +#define APB_CTRL_WIFI_RST_EN_REG (DR_REG_APB_CTRL_BASE + 0x0D8) +/* APB_CTRL_WIFI_RST : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define APB_CTRL_WIFI_RST 0xFFFFFFFF +#define APB_CTRL_WIFI_RST_M ((APB_CTRL_WIFI_RST_V)<<(APB_CTRL_WIFI_RST_S)) +#define APB_CTRL_WIFI_RST_V 0xFFFFFFFF +#define APB_CTRL_WIFI_RST_S 0 + +#define APB_CTRL_FRONT_END_MEM_PD_REG (DR_REG_APB_CTRL_BASE + 0x0DC) +/* APB_CTRL_DC_MEM_FORCE_PD : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_DC_MEM_FORCE_PD (BIT(5)) +#define APB_CTRL_DC_MEM_FORCE_PD_M (BIT(5)) +#define APB_CTRL_DC_MEM_FORCE_PD_V 0x1 +#define APB_CTRL_DC_MEM_FORCE_PD_S 5 +/* APB_CTRL_DC_MEM_FORCE_PU : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_DC_MEM_FORCE_PU (BIT(4)) +#define APB_CTRL_DC_MEM_FORCE_PU_M (BIT(4)) +#define APB_CTRL_DC_MEM_FORCE_PU_V 0x1 +#define APB_CTRL_DC_MEM_FORCE_PU_S 4 +/* APB_CTRL_PBUS_MEM_FORCE_PD : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_PBUS_MEM_FORCE_PD (BIT(3)) +#define APB_CTRL_PBUS_MEM_FORCE_PD_M (BIT(3)) +#define APB_CTRL_PBUS_MEM_FORCE_PD_V 0x1 +#define APB_CTRL_PBUS_MEM_FORCE_PD_S 3 +/* APB_CTRL_PBUS_MEM_FORCE_PU : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_PBUS_MEM_FORCE_PU (BIT(2)) +#define APB_CTRL_PBUS_MEM_FORCE_PU_M (BIT(2)) +#define APB_CTRL_PBUS_MEM_FORCE_PU_V 0x1 +#define APB_CTRL_PBUS_MEM_FORCE_PU_S 2 +/* APB_CTRL_AGC_MEM_FORCE_PD : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define APB_CTRL_AGC_MEM_FORCE_PD (BIT(1)) +#define APB_CTRL_AGC_MEM_FORCE_PD_M (BIT(1)) +#define APB_CTRL_AGC_MEM_FORCE_PD_V 0x1 +#define APB_CTRL_AGC_MEM_FORCE_PD_S 1 +/* APB_CTRL_AGC_MEM_FORCE_PU : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define APB_CTRL_AGC_MEM_FORCE_PU (BIT(0)) +#define APB_CTRL_AGC_MEM_FORCE_PU_M (BIT(0)) +#define APB_CTRL_AGC_MEM_FORCE_PU_V 0x1 +#define APB_CTRL_AGC_MEM_FORCE_PU_S 0 + +#define APB_CTRL_DATE_REG (DR_REG_APB_CTRL_BASE + 0x3FC) +/* APB_CTRL_DATE : R/W ;bitpos:[31:0] ;default: 32'h18102500 ; */ +/*description: */ +#define APB_CTRL_DATE 0xFFFFFFFF +#define APB_CTRL_DATE_M ((APB_CTRL_DATE_V)<<(APB_CTRL_DATE_S)) +#define APB_CTRL_DATE_V 0xFFFFFFFF +#define APB_CTRL_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_APB_CTRL_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/apb_ctrl_struct.h b/components/soc/esp32s2beta/include/soc/apb_ctrl_struct.h new file mode 100644 index 0000000000..9447912e91 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/apb_ctrl_struct.h @@ -0,0 +1,529 @@ +// Copyright 2017-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_APB_CTRL_STRUCT_H_ +#define _SOC_APB_CTRL_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t pre_div: 10; + uint32_t clk_320m_en: 1; + uint32_t clk_en: 1; + uint32_t rst_tick: 1; + uint32_t reserved13: 1; + uint32_t soc_clk_sel: 2; + uint32_t reserved16: 16; + }; + uint32_t val; + } clk_conf; + union { + struct { + uint32_t xtal_tick: 8; + uint32_t ck8m_tick: 8; + uint32_t tick_enable: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } tick_conf; + union { + struct { + uint32_t start_force: 1; + uint32_t start: 1; + uint32_t reserved2: 1; + uint32_t work_mode: 2; /*0: single mode 1: double mode 2: alternate mode*/ + uint32_t sar_sel: 1; /*0: SAR1 1: SAR2 only work for single SAR mode*/ + uint32_t sar_clk_gated: 1; + uint32_t sar_clk_div: 8; /*SAR clock divider*/ + uint32_t sar1_patt_len: 4; /*0 ~ 15 means length 1 ~ 16*/ + uint32_t sar2_patt_len: 4; /*0 ~ 15 means length 1 ~ 16*/ + uint32_t sar1_patt_p_clear: 1; /*clear the pointer of pattern table for DIG ADC1 CTRL*/ + uint32_t sar2_patt_p_clear: 1; /*clear the pointer of pattern table for DIG ADC2 CTRL*/ + uint32_t data_sar_sel: 1; /*1: sar_sel will be coded by the MSB of the 16-bit output data in this case the resolution should not be larger than 11 bits.*/ + uint32_t data_to_i2s: 1; /*1: I2S input data is from SAR ADC (for DMA) 0: I2S input data is from GPIO matrix*/ + uint32_t xpd_sar_force: 2; /*force option to xpd sar blocks*/ + uint32_t reserved29: 3; + }; + uint32_t val; + } saradc_ctrl; + union { + struct { + uint32_t meas_num_limit: 1; + uint32_t max_meas_num: 8; /*max conversion number*/ + uint32_t sar1_inv: 1; /*1: data to DIG ADC1 CTRL is inverted otherwise not*/ + uint32_t sar2_inv: 1; /*1: data to DIG ADC2 CTRL is inverted otherwise not*/ + uint32_t timer_sel: 1; /*1: select saradc timer 0: i2s_ws trigger*/ + uint32_t timer_target: 8; /*to set saradc timer target*/ + uint32_t timer_en: 1; /*to enable saradc timer trigger*/ + uint32_t reserved21: 11; + }; + uint32_t val; + } saradc_ctrl2; + union { + struct { + uint32_t reserved0: 16; + uint32_t sample_num: 8; /*sample number*/ + uint32_t sample_cycle: 8; /*sample cycles*/ + }; + uint32_t val; + } saradc_fsm; + union { + struct { + uint32_t xpd_wait: 8; + uint32_t rstb_wait: 8; + uint32_t standby_wait: 8; + uint32_t reserved24: 8; + }; + uint32_t val; + } saradc_fsm_wait; + uint32_t saradc_sar1_status; /**/ + uint32_t saradc_sar2_status; /**/ + uint32_t saradc_sar1_patt_tab[4]; /*item 0 ~ 15 for pattern table 1 (each item one byte)*/ + uint32_t saradc_sar2_patt_tab[4]; /*item 0 ~ 15 for pattern table 2 (each item one byte)*/ + union { + struct { + uint32_t reserved0: 2; + uint32_t adc_arb_apb_force: 1; /*adc2 arbiter force to enableapb controller*/ + uint32_t adc_arb_rtc_force: 1; /*adc2 arbiter force to enable rtc controller*/ + uint32_t adc_arb_wifi_force: 1; /*adc2 arbiter force to enable wifi controller*/ + uint32_t adc_arb_grant_force: 1; /*adc2 arbiter force grant*/ + uint32_t adc_arb_apb_priority: 2; /*Set adc2 arbiterapb priority*/ + uint32_t adc_arb_rtc_priority: 2; /*Set adc2 arbiter rtc priority*/ + uint32_t adc_arb_wifi_priority: 2; /*Set adc2 arbiter wifi priority*/ + uint32_t adc_arb_fix_priority: 1; /*adc2 arbiter uses fixed priority*/ + uint32_t reserved13: 19; + }; + uint32_t val; + } adc_arb_ctrl; + union { + struct { + uint32_t clk20_oen: 1; + uint32_t clk22_oen: 1; + uint32_t clk44_oen: 1; + uint32_t clk_bb_oen: 1; + uint32_t clk80_oen: 1; + uint32_t clk160_oen: 1; + uint32_t clk_320m_oen: 1; + uint32_t clk_adc_inf_oen: 1; + uint32_t clk_dac_cpu_oen: 1; + uint32_t clk40x_bb_oen: 1; + uint32_t clk_xtal_oen: 1; + uint32_t reserved11: 21; + }; + uint32_t val; + } clk_out_en; + union { + struct { + uint32_t peri_io_swap: 8; + uint32_t spi0_hold: 1; + uint32_t spi1_hold: 1; + uint32_t reserved10: 3; + uint32_t spi_prior: 1; + uint32_t reserved14: 18; + }; + uint32_t val; + } host_inf_sel; + union { + struct { + uint32_t ext_mem_pms_lock: 1; + uint32_t reserved1: 31; + }; + uint32_t val; + } ext_mem_pms_lock; + union { + struct { + uint32_t flash_ace0_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } flash_ace0_attr; + union { + struct { + uint32_t flash_ace1_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } flash_ace1_attr; + union { + struct { + uint32_t flash_ace2_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } flash_ace2_attr; + union { + struct { + uint32_t flash_ace3_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } flash_ace3_attr; + uint32_t flash_ace0_addr; /**/ + uint32_t flash_ace1_addr; /**/ + uint32_t flash_ace2_addr; /**/ + uint32_t flash_ace3_addr; /**/ + union { + struct { + uint32_t flash_ace0_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } flash_ace0_size; + union { + struct { + uint32_t flash_ace1_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } flash_ace1_size; + union { + struct { + uint32_t flash_ace2_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } flash_ace2_size; + union { + struct { + uint32_t flash_ace3_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } flash_ace3_size; + union { + struct { + uint32_t sram_ace0_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } sram_ace0_attr; + union { + struct { + uint32_t sram_ace1_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } sram_ace1_attr; + union { + struct { + uint32_t sram_ace2_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } sram_ace2_attr; + union { + struct { + uint32_t sram_ace3_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } sram_ace3_attr; + uint32_t sram_ace0_addr; /**/ + uint32_t sram_ace1_addr; /**/ + uint32_t sram_ace2_addr; /**/ + uint32_t sram_ace3_addr; /**/ + union { + struct { + uint32_t sram_ace0_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } sram_ace0_size; + union { + struct { + uint32_t sram_ace1_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } sram_ace1_size; + union { + struct { + uint32_t sram_ace2_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } sram_ace2_size; + union { + struct { + uint32_t sram_ace3_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } sram_ace3_size; + union { + struct { + uint32_t spi0_reject_int: 1; + uint32_t spi0_reject_clr: 1; + uint32_t spi0_reject_cde: 5; + uint32_t reserved7: 25; + }; + uint32_t val; + } spi0_pms_ctrl; + uint32_t spi0_reject_addr; /**/ + union { + struct { + uint32_t spi1_reject_int: 1; + uint32_t spi1_reject_clr: 1; + uint32_t spi1_reject_cde: 5; + uint32_t reserved7: 25; + }; + uint32_t val; + } spi1_pms_ctrl; + uint32_t spi1_reject_addr; /**/ + union { + struct { + uint32_t sdio_win_access_en: 1; + uint32_t reserved1: 31; + }; + uint32_t val; + } sdio_ctrl; + union { + struct { + uint32_t redcy_sig0: 31; + uint32_t redcy_andor: 1; + }; + uint32_t val; + } redcy_sig0; + union { + struct { + uint32_t redcy_sig1: 31; + uint32_t redcy_nandor: 1; + }; + uint32_t val; + } redcy_sig1; + uint32_t wifi_bb_cfg; /**/ + uint32_t wifi_bb_cfg_2; /**/ + uint32_t wifi_clk_en; /**/ + uint32_t wifi_rst_en; /**/ + union { + struct { + uint32_t agc_mem_force_pu: 1; + uint32_t agc_mem_force_pd: 1; + uint32_t pbus_mem_force_pu: 1; + uint32_t pbus_mem_force_pd: 1; + uint32_t dc_mem_force_pu: 1; + uint32_t dc_mem_force_pd: 1; + uint32_t reserved6: 26; + }; + uint32_t val; + } front_end_mem_pd; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t reserved_fc; + uint32_t reserved_100; + uint32_t reserved_104; + uint32_t reserved_108; + uint32_t reserved_10c; + uint32_t reserved_110; + uint32_t reserved_114; + uint32_t reserved_118; + uint32_t reserved_11c; + uint32_t reserved_120; + uint32_t reserved_124; + uint32_t reserved_128; + uint32_t reserved_12c; + uint32_t reserved_130; + uint32_t reserved_134; + uint32_t reserved_138; + uint32_t reserved_13c; + uint32_t reserved_140; + uint32_t reserved_144; + uint32_t reserved_148; + uint32_t reserved_14c; + uint32_t reserved_150; + uint32_t reserved_154; + uint32_t reserved_158; + uint32_t reserved_15c; + uint32_t reserved_160; + uint32_t reserved_164; + uint32_t reserved_168; + uint32_t reserved_16c; + uint32_t reserved_170; + uint32_t reserved_174; + uint32_t reserved_178; + uint32_t reserved_17c; + uint32_t reserved_180; + uint32_t reserved_184; + uint32_t reserved_188; + uint32_t reserved_18c; + uint32_t reserved_190; + uint32_t reserved_194; + uint32_t reserved_198; + uint32_t reserved_19c; + uint32_t reserved_1a0; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + uint32_t reserved_1f0; + uint32_t reserved_1f4; + uint32_t reserved_1f8; + uint32_t reserved_1fc; + uint32_t reserved_200; + uint32_t reserved_204; + uint32_t reserved_208; + uint32_t reserved_20c; + uint32_t reserved_210; + uint32_t reserved_214; + uint32_t reserved_218; + uint32_t reserved_21c; + uint32_t reserved_220; + uint32_t reserved_224; + uint32_t reserved_228; + uint32_t reserved_22c; + uint32_t reserved_230; + uint32_t reserved_234; + uint32_t reserved_238; + uint32_t reserved_23c; + uint32_t reserved_240; + uint32_t reserved_244; + uint32_t reserved_248; + uint32_t reserved_24c; + uint32_t reserved_250; + uint32_t reserved_254; + uint32_t reserved_258; + uint32_t reserved_25c; + uint32_t reserved_260; + uint32_t reserved_264; + uint32_t reserved_268; + uint32_t reserved_26c; + uint32_t reserved_270; + uint32_t reserved_274; + uint32_t reserved_278; + uint32_t reserved_27c; + uint32_t reserved_280; + uint32_t reserved_284; + uint32_t reserved_288; + uint32_t reserved_28c; + uint32_t reserved_290; + uint32_t reserved_294; + uint32_t reserved_298; + uint32_t reserved_29c; + uint32_t reserved_2a0; + uint32_t reserved_2a4; + uint32_t reserved_2a8; + uint32_t reserved_2ac; + uint32_t reserved_2b0; + uint32_t reserved_2b4; + uint32_t reserved_2b8; + uint32_t reserved_2bc; + uint32_t reserved_2c0; + uint32_t reserved_2c4; + uint32_t reserved_2c8; + uint32_t reserved_2cc; + uint32_t reserved_2d0; + uint32_t reserved_2d4; + uint32_t reserved_2d8; + uint32_t reserved_2dc; + uint32_t reserved_2e0; + uint32_t reserved_2e4; + uint32_t reserved_2e8; + uint32_t reserved_2ec; + uint32_t reserved_2f0; + uint32_t reserved_2f4; + uint32_t reserved_2f8; + uint32_t reserved_2fc; + uint32_t reserved_300; + uint32_t reserved_304; + uint32_t reserved_308; + uint32_t reserved_30c; + uint32_t reserved_310; + uint32_t reserved_314; + uint32_t reserved_318; + uint32_t reserved_31c; + uint32_t reserved_320; + uint32_t reserved_324; + uint32_t reserved_328; + uint32_t reserved_32c; + uint32_t reserved_330; + uint32_t reserved_334; + uint32_t reserved_338; + uint32_t reserved_33c; + uint32_t reserved_340; + uint32_t reserved_344; + uint32_t reserved_348; + uint32_t reserved_34c; + uint32_t reserved_350; + uint32_t reserved_354; + uint32_t reserved_358; + uint32_t reserved_35c; + uint32_t reserved_360; + uint32_t reserved_364; + uint32_t reserved_368; + uint32_t reserved_36c; + uint32_t reserved_370; + uint32_t reserved_374; + uint32_t reserved_378; + uint32_t reserved_37c; + uint32_t reserved_380; + uint32_t reserved_384; + uint32_t reserved_388; + uint32_t reserved_38c; + uint32_t reserved_390; + uint32_t reserved_394; + uint32_t reserved_398; + uint32_t reserved_39c; + uint32_t reserved_3a0; + uint32_t reserved_3a4; + uint32_t reserved_3a8; + uint32_t reserved_3ac; + uint32_t reserved_3b0; + uint32_t reserved_3b4; + uint32_t reserved_3b8; + uint32_t reserved_3bc; + uint32_t reserved_3c0; + uint32_t reserved_3c4; + uint32_t reserved_3c8; + uint32_t reserved_3cc; + uint32_t reserved_3d0; + uint32_t reserved_3d4; + uint32_t reserved_3d8; + uint32_t reserved_3dc; + uint32_t reserved_3e0; + uint32_t reserved_3e4; + uint32_t reserved_3e8; + uint32_t reserved_3ec; + uint32_t reserved_3f0; + uint32_t reserved_3f4; + uint32_t reserved_3f8; + uint32_t date; /**/ +} apb_ctrl_dev_t; +extern apb_ctrl_dev_t APB_CTRL; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_APB_CTRL_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/assist_debug_reg.h b/components/soc/esp32s2beta/include/soc/assist_debug_reg.h new file mode 100644 index 0000000000..bb34e315de --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/assist_debug_reg.h @@ -0,0 +1,115 @@ +#define ASSIST_DEBUG_BASE DR_REG_ASSIST_DEBUG_BASE + +#define ASSIST_DEBUG_INTERRUPT_ENA ((ASSIST_DEBUG_BASE) +0x00) +#define ASSIST_DEBUG_INTERRUPT_RAW ((ASSIST_DEBUG_BASE) +0x04) +#define ASSIST_DEBUG_INTERRUPT_RLS ((ASSIST_DEBUG_BASE) +0x08) +#define ASSIST_DEBUG_INTERRUPT_CLR ((ASSIST_DEBUG_BASE) +0x0C) +#define ASSIST_DEBUG_INTERRUPT_AREA_0_TOUCH_PRO_RD BIT(0) +#define ASSIST_DEBUG_INTERRUPT_AREA_0_TOUCH_PRO_WR BIT(1) +#define ASSIST_DEBUG_INTERRUPT_AREA_1_TOUCH_PRO_RD BIT(2) +#define ASSIST_DEBUG_INTERRUPT_AREA_1_TOUCH_PRO_WR BIT(3) +#define ASSIST_DEBUG_INTERRUPT_PRO_SP_SPILL_MIN BIT(4) +#define ASSIST_DEBUG_INTERRUPT_PRO_SP_SPILL_MAX BIT(5) + + +#define ASSIST_DEBUG_AREA_0_MIN ((ASSIST_DEBUG_BASE) +0x10) +#define ASSIST_DEBUG_AREA_0_MAX ((ASSIST_DEBUG_BASE) +0x14) +#define ASSIST_DEBUG_AREA_0_PC ((ASSIST_DEBUG_BASE) +0x18) +#define ASSIST_DEBUG_AREA_0_SP ((ASSIST_DEBUG_BASE) +0x1C) + +#define ASSIST_DEBUG_AREA_1_MIN ((ASSIST_DEBUG_BASE) +0x20) +#define ASSIST_DEBUG_AREA_1_MAX ((ASSIST_DEBUG_BASE) +0x24) +#define ASSIST_DEBUG_AREA_1_PC ((ASSIST_DEBUG_BASE) +0x28) +#define ASSIST_DEBUG_AREA_1_SP ((ASSIST_DEBUG_BASE) +0x2C) + +#define ASSIST_DEBUG_PRO_SP_UNSTABLE ((ASSIST_DEBUG_BASE) +0x30) +#define ASSIST_DEBUG_PRO_SP_MIN ((ASSIST_DEBUG_BASE) +0x34) +#define ASSIST_DEBUG_PRO_SP_MAX ((ASSIST_DEBUG_BASE) +0x38) +#define ASSIST_DEBUG_PRO_SP_PC ((ASSIST_DEBUG_BASE) +0x3C) + +#define ASSIST_DEBUG_PRO_PDEBUGENABLE ((ASSIST_DEBUG_BASE) +0x40) +#define ASSIST_DEBUG_PRO_RCD_RECORDING ((ASSIST_DEBUG_BASE) +0x44) +#define ASSIST_DEBUG_PRO_RCD_PDEBUGINST ((ASSIST_DEBUG_BASE) +0x48) +/* register layout: + * SIZE [7..0] : Instructions normally complete in the W stage. The size of the instruction in the W is given + * by this field in number of bytes. If it is 8’b0 in a given cycle the W stage has no completing + * instruction. This is also known as a bubble cycle. Also see DPORT_PRO_CPU_RECORD_PDEBUGSTATUS_REG. + * ISRC [14..12] : Instruction source. +** LOOP [23..20] : Loopback status. +** CINTLEVEL [27..24]: CINTLEVEL. +*/ +#define DPORT_RECORD_PDEBUGINST_SZ_M ((DPORT_RECORD_PDEBUGINST_SZ_V)<<(DPORT_RECORD_PDEBUGINST_SZ_S)) +#define DPORT_RECORD_PDEBUGINST_SZ_V 0xFF +#define DPORT_RECORD_PDEBUGINST_SZ_S 0 +#define DPORT_RECORD_PDEBUGINST_SZ(_r_) (((_r_)>>DPORT_RECORD_PDEBUGINST_SZ_S) & DPORT_RECORD_PDEBUGINST_SZ_V) +#define DPORT_RECORD_PDEBUGINST_ISRC_M ((DPORT_RECORD_PDEBUGINST_ISRC_V)<<(DPORT_RECORD_PDEBUGINST_ISRC_S)) +#define DPORT_RECORD_PDEBUGINST_ISRC_V 0x07 +#define DPORT_RECORD_PDEBUGINST_ISRC_S 12 +#define DPORT_RECORD_PDEBUGINST_ISRC(_r_) (((_r_)>>DPORT_RECORD_PDEBUGINST_ISRC_S) & DPORT_RECORD_PDEBUGINST_ISRC_V) +// #define DPORT_RECORD_PDEBUGINST_LOOP_M ((DPORT_RECORD_PDEBUGINST_LOOP_V)<<(DPORT_RECORD_PDEBUGINST_LOOP_S)) +// #define DPORT_RECORD_PDEBUGINST_LOOP_V 0x0F +// #define DPORT_RECORD_PDEBUGINST_LOOP_S 20 +// #define DPORT_RECORD_PDEBUGINST_LOOP(_r_) (((_r_)>>DPORT_RECORD_PDEBUGINST_LOOP_S) & DPORT_RECORD_PDEBUGINST_LOOP_V) +#define DPORT_RECORD_PDEBUGINST_LOOP_REP (BIT(20)) /* loopback will occur */ +#define DPORT_RECORD_PDEBUGINST_LOOP (BIT(21)) /* last inst of loop */ +#define DPORT_RECORD_PDEBUGINST_CINTL_M ((DPORT_RECORD_PDEBUGINST_CINTL_V)<<(DPORT_RECORD_PDEBUGINST_CINTL_S)) +#define DPORT_RECORD_PDEBUGINST_CINTL_V 0x0F +#define DPORT_RECORD_PDEBUGINST_CINTL_S 24 +#define DPORT_RECORD_PDEBUGINST_CINTL(_r_) (((_r_)>>DPORT_RECORD_PDEBUGINST_CINTL_S) & DPORT_RECORD_PDEBUGINST_CINTL_V) + +#define ASSIST_DEBUG_PRO_RCD_PDEBUGSTATUS ((ASSIST_DEBUG_BASE) +0x4C) +/* register layout: + * BBCAUSE [5..0]: Indicates cause for bubble cycle. See below for posible values. When DPORT_RECORD_PDEBUGINST_SZ == 0 + * INSNTYPE[5..0]: Indicates type of instruction retiring in the W stage. See below for posible values. When DPORT_RECORD_PDEBUGINST_SZ > 0 +*/ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_M ((DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_V)<<(DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_S)) +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_V 0x3F +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_S 0 +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE(_r_) (((_r_)>>DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_S) & DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_V) +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_PSO 0x00 /* Power shut off */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_DEP 0x02 /* Register dependency or resource conflict. See DPORT_XXX_CPU_RECORD_PDEBUGDATA_REG for extra info. */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_CTL 0x04 /* Control transfer bubble */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_ICM 0x08 /* I-cache miss (incl uncached miss) */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_DCM 0x0C /* D-cache miss (excl uncached miss) */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_EXC0 0x10 /* Exception or interrupt (W stage). See DPORT_XXX_CPU_RECORD_PDEBUGDATA_REG for extra info. + The virtual address of the instruction that was killed appears on DPORT_PRO_CPU_RECORD_PDEBUGPC_REG[31:0] */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_EXC1 0x11 /* Exception or interrupt (W+1 stage). See DPORT_XXX_CPU_RECORD_PDEBUGDATA_REG for extra info. */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_RPL 0x14 /* Instruction replay (other). DPORT_XXX_CPU_RECORD_PDEBUGDATA_REG has the PC of the replaying instruction. */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_ITLB 0x18 /* HW ITLB refill. The refill address and data are available on + DPORT_PRO_CPU_RECORD_PDEBUGLS0ADDR_REG and DPORT_PRO_CPU_RECORD_PDEBUGLS0DATA_REG. */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_ITLBM 0x1A /* ITLB miss */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_DTLB 0x1C /* HW DTLB refill. The refill address and data are available on + DPORT_PRO_CPU_RECORD_PDEBUGLS0ADDR_REG and DPORT_PRO_CPU_RECORD_PDEBUGLS0DATA_REG. */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_DTLBM 0x1E /* DTLB miss */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_STALL 0x20 /* Stall . The cause of the global stall is further classified in the DPORT_XXX_CPU_RECORD_PDEBUGDATA_REG. */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_HWMEC 0x24 /* HW-corrected memory error */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_WAITI 0x28 /* WAITI mode */ +#define DPORT_RECORD_PDEBUGSTATUS_BBCAUSE_OTHER 0x3C /* all other bubbles */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_M ((DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_V)<<(DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_S)) +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_V 0x3F +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_S 0 +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE(_r_) (((_r_)>>DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_S) & DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_V) +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_JX 0x00 /* JX */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_CALLX 0x04 /* CALLX */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_CRET 0x08 /* All call returns */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_ERET 0x0C /* All exception returns */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_B 0x10 /* Branch taken or loop not taken */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_J 0x14 /* J */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_CALL 0x18 /* CALL */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_BN 0x1C /* Branch not taken */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_LOOP 0x20 /* Loop instruction (taken) */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_S32C1I 0x24 /* S32C1I. The address and load data (before the conditional store) are available on the LS signals*/ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_WXSR2LB 0x28 /* WSR/XSR to LBEGIN */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_WSR2MMID 0x2C /* WSR to MMID */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_RWXSR 0x30 /* RSR or WSR (except MMID and LBEGIN) or XSR (except LBEGIN) */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_RWER 0x34 /* RER or WER */ +#define DPORT_RECORD_PDEBUGSTATUS_INSNTYPE_DEF 0x3C /* Default */ + + +#define ASSIST_DEBUG_PRO_RCD_PDEBUGDATA ((ASSIST_DEBUG_BASE) +0x50) +#define ASSIST_DEBUG_PRO_RCD_PDEBUGPC ((ASSIST_DEBUG_BASE) +0x54) +#define ASSIST_DEBUG_PRO_RCD_PDEBUGLS0STAT ((ASSIST_DEBUG_BASE) +0x58) +#define ASSIST_DEBUG_PRO_RCD_PDEBUGLS0ADDR ((ASSIST_DEBUG_BASE) +0x5C) +#define ASSIST_DEBUG_PRO_RCD_PDEBUGLS0DATA ((ASSIST_DEBUG_BASE) +0x60) +#define ASSIST_DEBUG_PRO_RCD_SP ((ASSIST_DEBUG_BASE) +0x64) + diff --git a/components/soc/esp32s2beta/include/soc/bb_reg.h b/components/soc/esp32s2beta/include/soc/bb_reg.h new file mode 100644 index 0000000000..69d2f43d20 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/bb_reg.h @@ -0,0 +1,42 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _SOC_BB_REG_H_ +#define _SOC_BB_REG_H_ + +/* Some of the baseband control registers. + * PU/PD fields defined here are used in sleep related functions. + */ + +#define BBPD_CTRL (DR_REG_BB_BASE + 0x0054) +#define BB_FFT_FORCE_PU (BIT(3)) +#define BB_FFT_FORCE_PU_M (BIT(3)) +#define BB_FFT_FORCE_PU_V 1 +#define BB_FFT_FORCE_PU_S 3 +#define BB_FFT_FORCE_PD (BIT(2)) +#define BB_FFT_FORCE_PD_M (BIT(2)) +#define BB_FFT_FORCE_PD_V 1 +#define BB_FFT_FORCE_PD_S 2 +#define BB_DC_EST_FORCE_PU (BIT(1)) +#define BB_DC_EST_FORCE_PU_M (BIT(1)) +#define BB_DC_EST_FORCE_PU_V 1 +#define BB_DC_EST_FORCE_PU_S 1 +#define BB_DC_EST_FORCE_PD (BIT(0)) +#define BB_DC_EST_FORCE_PD_M (BIT(0)) +#define BB_DC_EST_FORCE_PD_V 1 +#define BB_DC_EST_FORCE_PD_S 0 + + +#endif /* _SOC_BB_REG_H_ */ + diff --git a/components/soc/esp32s2beta/include/soc/boot_mode.h b/components/soc/esp32s2beta/include/soc/boot_mode.h new file mode 100644 index 0000000000..46d7205d4f --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/boot_mode.h @@ -0,0 +1,92 @@ +// Copyright 2017-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_BOOT_MODE_H_ +#define _SOC_BOOT_MODE_H_ + +#include "soc.h" + +/*SPI Boot*/ +#define IS_1XXX(v) (((v)&0x08)==0x08) + +/*Download Boot, USB/SDIO/UART0/UART1*/ +#define IS_00XX(v) (((v)&0x0c)==0x00) + +/*Download Boot, SDIO/UART0/UART1,FEI_FEO V2*/ +#define IS_0000(v) (((v)&0x0f)==0x00) + +/*Download Boot, SDIO/UART0/UART1,FEI_REO V2*/ +#define IS_0001(v) (((v)&0x0f)==0x01) + +/*Download Boot, SDIO/UART0/UART1,REI_FEO V2*/ +#define IS_0010(v) (((v)&0x0f)==0x02) + +/*Download Boot, SDIO/UART0/UART1,REI_REO V2*/ +#define IS_0011(v) (((v)&0x0f)==0x03) + +/*ATE/ANALOG Mode*/ +#define IS_0101(v) (((v)&0x0f)==0x05) + +/*Diagnostic Mode+UART0 download Mode*/ +#define IS_0111(v) (((v)&0x0f)==0x07) + +/*legacy SPI Boot*/ +#define IS_0100(v) (((v)&0x0f)==0x04) + +/*SDIO_Slave download Mode V1.1*/ +#define IS_0110(v) (((v)&0x0f)==0x06) + + + +#define BOOT_MODE_GET() (GPIO_REG_READ(GPIO_STRAP_REG)) + +/*do not include download mode*/ +#define ETS_IS_UART_BOOT() IS_0111(BOOT_MODE_GET()) + +/*all spi boot including spi/legacy*/ +#define ETS_IS_FLASH_BOOT() (IS_1XXX(BOOT_MODE_GET()) || IS_0100(BOOT_MODE_GET())) + +/*all faster spi boot including spi*/ +#define ETS_IS_FAST_FLASH_BOOT() IS_1XXX(BOOT_MODE_GET()) + +/*all sdio V2 of failing edge input, failing edge output*/ +#define ETS_IS_SDIO_FEI_FEO_V2_BOOT() IS_0000(BOOT_MODE_GET()) + +/*all sdio V2 of failing edge input, raising edge output*/ +#define ETS_IS_SDIO_FEI_REO_V2_BOOT() IS_0001(BOOT_MODE_GET()) + +/*all sdio V2 of raising edge input, failing edge output*/ +#define ETS_IS_SDIO_REI_FEO_V2_BOOT() IS_0010(BOOT_MODE_GET()) + +/*all sdio V2 of raising edge input, raising edge output*/ +#define ETS_IS_SDIO_REI_REO_V2_BOOT() IS_0011(BOOT_MODE_GET()) + +/*all sdio V1 of raising edge input, failing edge output*/ +#define ETS_IS_SDIO_REI_FEO_V1_BOOT() IS_0110(BOOT_MODE_GET()) + +/*do not include download mode*/ +#define ETS_IS_SDIO_BOOT() IS_0110(BOOT_MODE_GET()) + +/*joint download boot*/ +#define ETS_IS_USB_SDIO_UART_BOOT() IS_00XX(BOOT_MODE_GET()) + +/*ATE mode*/ +#define ETS_IS_ATE_BOOT() IS_0101(BOOT_MODE_GET()) + +/*used by ETS_IS_SDIO_UART_BOOT*/ +#define SEL_NO_BOOT 0 +#define SEL_SDIO_BOOT BIT0 +#define SEL_UART_BOOT BIT1 + +#endif /* _SOC_BOOT_MODE_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/clkout_channel.h b/components/soc/esp32s2beta/include/soc/clkout_channel.h new file mode 100644 index 0000000000..c9e9a0c245 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/clkout_channel.h @@ -0,0 +1,26 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _SOC_CLKOUT_CHANNEL_H +#define _SOC_CLKOUT_CHANNEL_H + +//CLKOUT channels +#define CLKOUT_GPIO20_DIRECT_CHANNEL CLKOUT_CHANNEL_1 +#define CLKOUT_CHANNEL_1_DIRECT_GPIO_NUM 20 +#define CLKOUT_GPIO19_DIRECT_CHANNEL CLKOUT_CHANNEL_2 +#define CLKOUT_CHANNEL_2_DIRECT_GPIO_NUM 19 +#define CLKOUT_GPIO18_DIRECT_CHANNEL CLKOUT_CHANNEL_3 +#define CLKOUT_CHANNEL_3_DIRECT_GPIO_NUM 18 + +#endif diff --git a/components/soc/esp32s2beta/include/soc/cpu.h b/components/soc/esp32s2beta/include/soc/cpu.h new file mode 100644 index 0000000000..fdde8c91a3 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/cpu.h @@ -0,0 +1,132 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _SOC_CPU_H +#define _SOC_CPU_H + +#include +#include +#include +#include "xtensa/corebits.h" + +/* C macros for xtensa special register read/write/exchange */ + +#define RSR(reg, curval) asm volatile ("rsr %0, " #reg : "=r" (curval)); +#define WSR(reg, newval) asm volatile ("wsr %0, " #reg : : "r" (newval)); +#define XSR(reg, swapval) asm volatile ("xsr %0, " #reg : "+r" (swapval)); + +/** @brief Read current stack pointer address + * + */ +static inline void *get_sp(void) +{ + void *sp; + asm volatile ("mov %0, sp;" : "=r" (sp)); + return sp; +} + +/* Functions to set page attributes for Region Protection option in the CPU. + * See Xtensa ISA Reference manual for explanation of arguments (section 4.6.3.2). + */ + +static inline void cpu_write_dtlb(uint32_t vpn, unsigned attr) +{ + asm volatile ("wdtlb %1, %0; dsync\n" :: "r" (vpn), "r" (attr)); +} + + +static inline void cpu_write_itlb(unsigned vpn, unsigned attr) +{ + asm volatile ("witlb %1, %0; isync\n" :: "r" (vpn), "r" (attr)); +} + +static inline void cpu_init_memctl(void) +{ +#if XCHAL_ERRATUM_572 +#error "Shouldn't have this errata or need this call on esp32s2beta" +#endif +} + +/** + * @brief Configure memory region protection + * + * Make page 0 access raise an exception. + * Also protect some other unused pages so we can catch weirdness. + * Useful attribute values: + * 0 — cached, RW + * 2 — bypass cache, RWX (default value after CPU reset) + * 15 — no access, raise exception + */ + +static inline void cpu_configure_region_protection(void) +{ + const uint32_t pages_to_protect[] = {0x00000000, 0x80000000, 0xa0000000, 0xc0000000, 0xe0000000}; + for (int i = 0; i < sizeof(pages_to_protect)/sizeof(pages_to_protect[0]); ++i) { + cpu_write_dtlb(pages_to_protect[i], 0xf); + cpu_write_itlb(pages_to_protect[i], 0xf); + } + cpu_write_dtlb(0x20000000, 0); + cpu_write_itlb(0x20000000, 0); +} + +/** + * @brief Stall CPU using RTC controller + * @param cpu_id ID of the CPU to stall (0 = PRO, 1 = APP) + */ +void esp_cpu_stall(int cpu_id); + +/** + * @brief Un-stall CPU using RTC controller + * @param cpu_id ID of the CPU to un-stall (0 = PRO, 1 = APP) + */ +void esp_cpu_unstall(int cpu_id); + +/** + * @brief Reset CPU using RTC controller + * @param cpu_id ID of the CPU to reset (0 = PRO, 1 = APP) + */ +void esp_cpu_reset(int cpu_id); + + +/** + * @brief Returns true if a JTAG debugger is attached to CPU + * OCD (on chip debug) port. + * + * @note If "Make exception and panic handlers JTAG/OCD aware" + * is disabled, this function always returns false. + */ +bool esp_cpu_in_ocd_debug_mode(void); + +/** + * @brief Convert the PC register value to its true address + * + * The address of the current instruction is not stored as an exact uint32_t + * representation in PC register. This function will convert the value stored in + * the PC register to a uint32_t address. + * + * @param pc_raw The PC as stored in register format. + * + * @return Address in uint32_t format + */ +static inline uint32_t esp_cpu_process_stack_pc(uint32_t pc) +{ + if (pc & 0x80000000) { + //Top two bits of a0 (return address) specify window increment. Overwrite to map to address space. + pc = (pc & 0x3fffffff) | 0x40000000; + } + //Minus 3 to get PC of previous instruction (i.e. instruction executed before return address) + return pc - 3; +} + +#endif diff --git a/components/soc/esp32s2beta/include/soc/dac_channel.h b/components/soc/esp32s2beta/include/soc/dac_channel.h new file mode 100644 index 0000000000..175158f785 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/dac_channel.h @@ -0,0 +1,24 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _SOC_DAC_CHANNEL_H +#define _SOC_DAC_CHANNEL_H + +#define DAC_GPIO17_CHANNEL DAC_CHANNEL_1 +#define DAC_CHANNEL_1_GPIO_NUM 17 + +#define DAC_GPIO18_CHANNEL DAC_CHANNEL_2 +#define DAC_CHANNEL_2_GPIO_NUM 18 + +#endif diff --git a/components/soc/esp32s2beta/include/soc/dport_access.h b/components/soc/esp32s2beta/include/soc/dport_access.h new file mode 100644 index 0000000000..eee914e324 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/dport_access.h @@ -0,0 +1,111 @@ +// Copyright 2010-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _DPORT_ACCESS_H_ +#define _DPORT_ACCESS_H_ + +#include +#include "esp_attr.h" +#include "esp32s2beta/dport_access.h" +#include "soc.h" +#include "uart_reg.h" +#include "xtensa/xtruntime.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// ESP32C is single core and does not have DPORT bug, so these macros are all same as the non-DPORT versions + +// _DPORT_REG_WRITE & DPORT_REG_WRITE are equivalent. +#define _DPORT_REG_READ(_r) (*(volatile uint32_t *)(_r)) +#define _DPORT_REG_WRITE(_r, _v) (*(volatile uint32_t *)(_r)) = (_v) + +// Write value to DPORT register (does not require protecting) +#define DPORT_REG_WRITE(_r, _v) _DPORT_REG_WRITE((_r), (_v)) + +#define DPORT_REG_READ(_r) _DPORT_REG_READ(_r) +#define DPORT_SEQUENCE_REG_READ(_r) _DPORT_REG_READ(_r) + +//get bit or get bits from register +#define DPORT_REG_GET_BIT(_r, _b) (DPORT_REG_READ(_r) & (_b)) + +//set bit or set bits to register +#define DPORT_REG_SET_BIT(_r, _b) DPORT_REG_WRITE((_r), (DPORT_REG_READ(_r)|(_b))) + +//clear bit or clear bits of register +#define DPORT_REG_CLR_BIT(_r, _b) DPORT_REG_WRITE((_r), (DPORT_REG_READ(_r) & (~(_b)))) + +//set bits of register controlled by mask +#define DPORT_REG_SET_BITS(_r, _b, _m) DPORT_REG_WRITE((_r), ((DPORT_REG_READ(_r) & (~(_m))) | ((_b) & (_m)))) + +//get field from register, uses field _S & _V to determine mask +#define DPORT_REG_GET_FIELD(_r, _f) ((DPORT_REG_READ(_r) >> (_f##_S)) & (_f##_V)) + +//set field to register, used when _f is not left shifted by _f##_S +#define DPORT_REG_SET_FIELD(_r, _f, _v) DPORT_REG_WRITE((_r), ((DPORT_REG_READ(_r) & (~((_f##_V) << (_f##_S))))|(((_v) & (_f##_V))<<(_f##_S)))) + +//get field value from a variable, used when _f is not left shifted by _f##_S +#define DPORT_VALUE_GET_FIELD(_r, _f) (((_r) >> (_f##_S)) & (_f)) + +//get field value from a variable, used when _f is left shifted by _f##_S +#define DPORT_VALUE_GET_FIELD2(_r, _f) (((_r) & (_f))>> (_f##_S)) + +//set field value to a variable, used when _f is not left shifted by _f##_S +#define DPORT_VALUE_SET_FIELD(_r, _f, _v) ((_r)=(((_r) & ~((_f) << (_f##_S)))|((_v)<<(_f##_S)))) + +//set field value to a variable, used when _f is left shifted by _f##_S +#define DPORT_VALUE_SET_FIELD2(_r, _f, _v) ((_r)=(((_r) & ~(_f))|((_v)<<(_f##_S)))) + +//generate a value from a field value, used when _f is not left shifted by _f##_S +#define DPORT_FIELD_TO_VALUE(_f, _v) (((_v)&(_f))<<_f##_S) + +//generate a value from a field value, used when _f is left shifted by _f##_S +#define DPORT_FIELD_TO_VALUE2(_f, _v) (((_v)<<_f##_S) & (_f)) + +//Register read macros with an underscore prefix access DPORT memory directly. In IDF apps, use the non-underscore versions to be SMP-safe. +#define _DPORT_READ_PERI_REG(addr) (*((volatile uint32_t *)(addr))) +#define _DPORT_WRITE_PERI_REG(addr, val) (*((volatile uint32_t *)(addr))) = (uint32_t)(val) +#define _DPORT_REG_SET_BIT(_r, _b) _DPORT_REG_WRITE((_r), (_DPORT_REG_READ(_r)|(_b))) +#define _DPORT_REG_CLR_BIT(_r, _b) _DPORT_REG_WRITE((_r), (_DPORT_REG_READ(_r) & (~(_b)))) + +#define DPORT_READ_PERI_REG(addr) _DPORT_READ_PERI_REG(addr) + +//write value to register +#define DPORT_WRITE_PERI_REG(addr, val) _DPORT_WRITE_PERI_REG((addr), (val)) + +//clear bits of register controlled by mask +#define DPORT_CLEAR_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)&(~(mask)))) + +//set bits of register controlled by mask +#define DPORT_SET_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)|(mask))) + +//get bits of register controlled by mask +#define DPORT_GET_PERI_REG_MASK(reg, mask) (DPORT_READ_PERI_REG(reg) & (mask)) + +//get bits of register controlled by highest bit and lowest bit +#define DPORT_GET_PERI_REG_BITS(reg, hipos,lowpos) ((DPORT_READ_PERI_REG(reg)>>(lowpos))&((1<<((hipos)-(lowpos)+1))-1)) + +//set bits of register controlled by mask and shift +#define DPORT_SET_PERI_REG_BITS(reg,bit_map,value,shift) DPORT_WRITE_PERI_REG((reg), ((DPORT_READ_PERI_REG(reg)&(~((bit_map)<<(shift))))|(((value) & bit_map)<<(shift)))) + +//get field of register +#define DPORT_GET_PERI_REG_BITS2(reg, mask,shift) ((DPORT_READ_PERI_REG(reg)>>(shift))&(mask)) +//}} + +#ifdef __cplusplus +} +#endif + +#endif /* _DPORT_ACCESS_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/dport_reg.h b/components/soc/esp32s2beta/include/soc/dport_reg.h new file mode 100644 index 0000000000..17270ac98b --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/dport_reg.h @@ -0,0 +1,193 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef _SOC_DPORT_REG_H_ +#define _SOC_DPORT_REG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include"extmem_reg.h" +#include"interrupt_reg.h" +#include"system_reg.h" +#include "sensitive_reg.h" +#include "soc.h" + +/*IRAM0 connected with Cache IBUS0*/ +#define IRAM0_ADDRESS_LOW 0x40000000 +#define IRAM0_ADDRESS_HIGH 0x40400000 +#define IRAM0_CACHE_ADDRESS_LOW 0x40080000 +#define IRAM0_CACHE_ADDRESS_HIGH 0x40400000 + +/*IRAM1 and AHB_IBUS1 connected with Cache IBUS1, alternative*/ +#define IRAM1_ADDRESS_LOW 0x40400000 +#define IRAM1_ADDRESS_HIGH 0x40800000 +#define AHB_IBUS1_ADDRESS_LOW 0x60400000 +#define AHB_IBUS1_ADDRESS_HIGH 0x60800000 + +/*IROM0 and AHB_IBUS2 connected with Cache IBUS2, alternative*/ +#define IROM0_ADDRESS_LOW 0x40800000 +#define IROM0_ADDRESS_HIGH 0x40c00000 +#define AHB_IBUS2_ADDRESS_LOW 0x60800000 +#define AHB_IBUS2_ADDRESS_HIGH 0x60c00000 + +/*DROM0 and AHB_IBUS2 connected with Cache IBUS3, alternative*/ +/*DROM0 and AHB_DBUS2 connected with Cache DBUS3, alternative*/ +#define DROM0_ADDRESS_LOW 0x3f000000 +#define DROM0_ADDRESS_HIGH 0x3f400000 +#define AHB_IBUS3_ADDRESS_LOW 0x60c00000 +#define AHB_IBUS3_ADDRESS_HIGH 0x61000000 +#define AHB_DBUS3_ADDRESS_LOW 0x61800000 +#define AHB_DBUS3_ADDRESS_HIGH 0x61c00000 + +/*DRAM0 and AHB_DBUS2 connected with Cache DBUS0, alternative*/ +#define DRAM0_ADDRESS_LOW 0x3fc00000 +#define DRAM0_ADDRESS_HIGH 0x40000000 +#define DRAM0_CACHE_ADDRESS_LOW 0x3fc00000 +#define DRAM0_CACHE_ADDRESS_HIGH 0x3ff90000 +#define AHB_DBUS0_ADDRESS_LOW 0x61000000 +#define AHB_DBUS0_ADDRESS_HIGH 0x61400000 + +/*DRAM1 connected with Cache DBUS1*/ +#define DRAM1_ADDRESS_LOW 0x3f800000 +#define DRAM1_ADDRESS_HIGH 0x3fc00000 + +/*DPORT and AHB_DBUS2 connected with Cache DBUS2, alternative*/ +#define DPORT_ADDRESS_LOW 0x3f400000 +#define DPORT_ADDRESS_HIGH 0x3f800000 +#define DPORT_CACHE_ADDRESS_LOW 0x3f500000 +#define DPORT_CACHE_ADDRESS_HIGH 0x3f800000 +#define AHB_DBUS2_ADDRESS_LOW 0x61400000 +#define AHB_DBUS2_ADDRESS_HIGH 0x61800000 + +#define BUS_SIZE(bus_name) (bus_name##_ADDRESS_HIGH - bus_name##_ADDRESS_LOW) +#define ADDRESS_IN_BUS(bus_name, vaddr) ((vaddr) >= bus_name##_ADDRESS_LOW && (vaddr) < bus_name##_ADDRESS_HIGH) + +#define ADDRESS_IN_IRAM0(vaddr) ADDRESS_IN_BUS(IRAM0, vaddr) +#define ADDRESS_IN_IRAM0_CACHE(vaddr) ADDRESS_IN_BUS(IRAM0_CACHE, vaddr) +#define ADDRESS_IN_IRAM1(vaddr) ADDRESS_IN_BUS(IRAM1, vaddr) +#define ADDRESS_IN_AHB_IBUS1(vaddr) ADDRESS_IN_BUS(AHB_IBUS1, vaddr) +#define ADDRESS_IN_IROM0(vaddr) ADDRESS_IN_BUS(IROM0, vaddr) +#define ADDRESS_IN_AHB_IBUS2(vaddr) ADDRESS_IN_BUS(AHB_IBUS2, vaddr) +#define ADDRESS_IN_DROM0(vaddr) ADDRESS_IN_BUS(DROM0, vaddr) +#define ADDRESS_IN_AHB_IBUS3(vaddr) ADDRESS_IN_BUS(AHB_IBUS3, vaddr) +#define ADDRESS_IN_AHB_DBUS3(vaddr) ADDRESS_IN_BUS(AHB_DBUS3, vaddr) +#define ADDRESS_IN_DRAM0(vaddr) ADDRESS_IN_BUS(DRAM0, vaddr) +#define ADDRESS_IN_DRAM0_CACHE(vaddr) ADDRESS_IN_BUS(DRAM0_CACHE, vaddr) +#define ADDRESS_IN_AHB_DBUS0(vaddr) ADDRESS_IN_BUS(AHB_DBUS0, vaddr) +#define ADDRESS_IN_DRAM1(vaddr) ADDRESS_IN_BUS(DRAM1, vaddr) +#define ADDRESS_IN_DPORT(vaddr) ADDRESS_IN_BUS(DPORT, vaddr) +#define ADDRESS_IN_DPORT_CACHE(vaddr) ADDRESS_IN_BUS(DPORT_CACHE, vaddr) +#define ADDRESS_IN_AHB_DBUS2(vaddr) ADDRESS_IN_BUS(AHB_DBUS2, vaddr) + +#define BUS_IRAM0_CACHE_SIZE BUS_SIZE(IRAM0_CACHE) +#define BUS_IRAM1_CACHE_SIZE BUS_SIZE(IRAM1) +#define BUS_IROM0_CACHE_SIZE BUS_SIZE(IROM0) +#define BUS_DROM0_CACHE_SIZE BUS_SIZE(DROM0) +#define BUS_DRAM0_CACHE_SIZE BUS_SIZE(DRAM0_CACHE) +#define BUS_DRAM1_CACHE_SIZE BUS_SIZE(DRAM1) +#define BUS_DPORT_CACHE_SIZE BUS_SIZE(DPORT) + +#define BUS_AHB_IBUS1_CACHE_SIZE BUS_SIZE(AHB_IBUS1) +#define BUS_AHB_IBUS2_CACHE_SIZE BUS_SIZE(AHB_IBUS2) +#define BUS_AHB_IBUS3_CACHE_SIZE BUS_SIZE(AHB_IBUS3) +#define BUS_AHB_DBUS0_CACHE_SIZE BUS_SIZE(AHB_DBUS0) +#define BUS_AHB_DBUS2_CACHE_SIZE BUS_SIZE(AHB_DBUS2) +#define BUS_AHB_DBUS3_CACHE_SIZE BUS_SIZE(AHB_DBUS3) + + + +#define PRO_CACHE_IBUS0 0 +#define PRO_CACHE_IBUS0_MMU_START 0 +#define PRO_CACHE_IBUS0_MMU_END 0x100 + +#define PRO_CACHE_IBUS1 1 +#define PRO_CACHE_IBUS1_MMU_START 0x100 +#define PRO_CACHE_IBUS1_MMU_END 0x200 + +#define PRO_CACHE_IBUS2 2 +#define PRO_CACHE_IBUS2_MMU_START 0x200 +#define PRO_CACHE_IBUS2_MMU_END 0x300 + +#define PRO_CACHE_IBUS3 3 +#define PRO_CACHE_IBUS3_MMU_START 0x300 +#define PRO_CACHE_IBUS3_MMU_END 0x400 + +#define PRO_CACHE_DBUS0 4 +#define PRO_CACHE_DBUS0_MMU_START 0x400 +#define PRO_CACHE_DBUS0_MMU_END 0x500 + +#define PRO_CACHE_DBUS1 5 +#define PRO_CACHE_DBUS1_MMU_START 0x500 +#define PRO_CACHE_DBUS1_MMU_END 0x600 + +#define PRO_CACHE_DBUS2 6 +#define PRO_CACHE_DBUS2_MMU_START 0x600 +#define PRO_CACHE_DBUS2_MMU_END 0x700 + +#define PRO_CACHE_DBUS3 7 +#define PRO_CACHE_DBUS3_MMU_START 0x700 +#define PRO_CACHE_DBUS3_MMU_END 0x800 + +#define DPORT_MMU_SIZE 0x800 +#define DPORT_ICACHE_MMU_SIZE 0x400 +#define DPORT_DCACHE_MMU_SIZE 0x400 + +#define DPORT_MMU_BUS_START(i) ((i) * 0x100) +#define DPORT_MMU_BUS_SIZE 0x100 + +#define DPORT_MMU_INVALID BIT(14) +#define DPORT_MMU_ACCESS_FLASH BIT(15) +#define DPORT_MMU_ACCESS_SPIRAM BIT(16) + +/* Flash MMU table for PRO CPU */ +#define DPORT_PRO_FLASH_MMU_TABLE ((volatile uint32_t*) DR_REG_MMU_TABLE) + +#define DPORT_FLASH_MMU_TABLE_SIZE (DPORT_ICACHE_MMU_SIZE/sizeof(uint32_t)) + +#define DPORT_MMU_TABLE_INVALID_VAL 0x4000 +#define DPORT_FLASH_MMU_TABLE_INVALID_VAL DPORT_MMU_TABLE_INVALID_VAL +#define DPORT_MMU_ADDRESS_MASK 0x3fff + +#define BUS_ADDR_SIZE 0x400000 +#define BUS_ADDR_MASK (BUS_ADDR_SIZE - 1) +#define BUS_NUM_MASK 0x3 + +#define CACHE_MEMORY_BLOCK_SIZE 8192 +#define CACHE_MEMORY_BLOCK_NUM 4 +#define CACHE_MEMORY_BLOCK_NUM_MASK 0x3 +#define CACHE_MEMORY_LAYOUT_SHIFT 4 +#define CACHE_MEMORY_LAYOUT_SHIFT0 0 +#define CACHE_MEMORY_LAYOUT_SHIFT1 4 +#define CACHE_MEMORY_LAYOUT_SHIFT2 8 +#define CACHE_MEMORY_LAYOUT_SHIFT3 12 +#define CACHE_MEMORY_LAYOUT_MASK 0xf +#define CACHE_MEMORY_BLOCK0_ADDR 0x40020000 +#define CACHE_MEMORY_BLOCK1_ADDR 0x40022000 +#define CACHE_MEMORY_BLOCK2_ADDR 0x40024000 +#define CACHE_MEMORY_BLOCK3_ADDR 0x40026000 + +#define DPORT_DATE_REG SYSTEM_DATE_REG + +#ifndef __ASSEMBLER__ +#include "dport_access.h" +#endif + +#ifdef __cplusplus +} +#endif + +#endif /*_SOC_DPORT_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/efuse_reg.h b/components/soc/esp32s2beta/include/soc/efuse_reg.h new file mode 100644 index 0000000000..b208fa9658 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/efuse_reg.h @@ -0,0 +1,2122 @@ +// Copyright 2017-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_EFUSE_REG_H_ +#define _SOC_EFUSE_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define EFUSE_PGM_DATA0_REG (DR_REG_EFUSE_BASE + 0x000) +/* EFUSE_WR_DIS : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define EFUSE_WR_DIS 0xFFFFFFFF +#define EFUSE_WR_DIS_M ((EFUSE_WR_DIS_V)<<(EFUSE_WR_DIS_S)) +#define EFUSE_WR_DIS_V 0xFFFFFFFF +#define EFUSE_WR_DIS_S 0 + +#define EFUSE_PGM_DATA1_REG (DR_REG_EFUSE_BASE + 0x004) +/* EFUSE_SDIO_DREFH : R/W ;bitpos:[31:30] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_SDIO_DREFH 0x00000003 +#define EFUSE_SDIO_DREFH_M ((EFUSE_SDIO_DREFH_V)<<(EFUSE_SDIO_DREFH_S)) +#define EFUSE_SDIO_DREFH_V 0x3 +#define EFUSE_SDIO_DREFH_S 30 +/* EFUSE_SDIO_MODECURLIM : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_MODECURLIM (BIT(29)) +#define EFUSE_SDIO_MODECURLIM_M (BIT(29)) +#define EFUSE_SDIO_MODECURLIM_V 0x1 +#define EFUSE_SDIO_MODECURLIM_S 29 +/* EFUSE_USB_DRES : R/W ;bitpos:[28:27] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_USB_DRES 0x00000003 +#define EFUSE_USB_DRES_M ((EFUSE_USB_DRES_V)<<(EFUSE_USB_DRES_S)) +#define EFUSE_USB_DRES_V 0x3 +#define EFUSE_USB_DRES_S 27 +/* EFUSE_USB_FORCE_B : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_USB_FORCE_B (BIT(26)) +#define EFUSE_USB_FORCE_B_M (BIT(26)) +#define EFUSE_USB_FORCE_B_V 0x1 +#define EFUSE_USB_FORCE_B_S 26 +/* EFUSE_USB_EXT_PHY_ENABLE : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_USB_EXT_PHY_ENABLE (BIT(25)) +#define EFUSE_USB_EXT_PHY_ENABLE_M (BIT(25)) +#define EFUSE_USB_EXT_PHY_ENABLE_V 0x1 +#define EFUSE_USB_EXT_PHY_ENABLE_S 25 +/* EFUSE_USB_EXCHG_PINS : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_USB_EXCHG_PINS (BIT(24)) +#define EFUSE_USB_EXCHG_PINS_M (BIT(24)) +#define EFUSE_USB_EXCHG_PINS_V 0x1 +#define EFUSE_USB_EXCHG_PINS_S 24 +/* EFUSE_USB_DREFL : R/W ;bitpos:[23:22] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_USB_DREFL 0x00000003 +#define EFUSE_USB_DREFL_M ((EFUSE_USB_DREFL_V)<<(EFUSE_USB_DREFL_S)) +#define EFUSE_USB_DREFL_V 0x3 +#define EFUSE_USB_DREFL_S 22 +/* EFUSE_USB_DREFH : R/W ;bitpos:[21:20] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_USB_DREFH 0x00000003 +#define EFUSE_USB_DREFH_M ((EFUSE_USB_DREFH_V)<<(EFUSE_USB_DREFH_S)) +#define EFUSE_USB_DREFH_V 0x3 +#define EFUSE_USB_DREFH_S 20 +/* EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT (BIT(19)) +#define EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_M (BIT(19)) +#define EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_V 0x1 +#define EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_S 19 +/* EFUSE_HARD_DIS_JTAG : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_HARD_DIS_JTAG (BIT(18)) +#define EFUSE_HARD_DIS_JTAG_M (BIT(18)) +#define EFUSE_HARD_DIS_JTAG_V 0x1 +#define EFUSE_HARD_DIS_JTAG_S 18 +/* EFUSE_SOFT_DIS_JTAG : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SOFT_DIS_JTAG (BIT(17)) +#define EFUSE_SOFT_DIS_JTAG_M (BIT(17)) +#define EFUSE_SOFT_DIS_JTAG_V 0x1 +#define EFUSE_SOFT_DIS_JTAG_S 17 +/* EFUSE_DIS_EFUSE_ATE_WR : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_EFUSE_ATE_WR (BIT(16)) +#define EFUSE_DIS_EFUSE_ATE_WR_M (BIT(16)) +#define EFUSE_DIS_EFUSE_ATE_WR_V 0x1 +#define EFUSE_DIS_EFUSE_ATE_WR_S 16 +/* EFUSE_DIS_SDIO_ACCESS : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_SDIO_ACCESS (BIT(15)) +#define EFUSE_DIS_SDIO_ACCESS_M (BIT(15)) +#define EFUSE_DIS_SDIO_ACCESS_V 0x1 +#define EFUSE_DIS_SDIO_ACCESS_S 15 +/* EFUSE_DIS_CAN : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_CAN (BIT(14)) +#define EFUSE_DIS_CAN_M (BIT(14)) +#define EFUSE_DIS_CAN_V 0x1 +#define EFUSE_DIS_CAN_S 14 +/* EFUSE_DIS_USB : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_USB (BIT(13)) +#define EFUSE_DIS_USB_M (BIT(13)) +#define EFUSE_DIS_USB_V 0x1 +#define EFUSE_DIS_USB_S 13 +/* EFUSE_DIS_BT : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_BT (BIT(12)) +#define EFUSE_DIS_BT_M (BIT(12)) +#define EFUSE_DIS_BT_V 0x1 +#define EFUSE_DIS_BT_S 12 +/* EFUSE_DIS_DOWNLOAD_DCACHE : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_DOWNLOAD_DCACHE (BIT(11)) +#define EFUSE_DIS_DOWNLOAD_DCACHE_M (BIT(11)) +#define EFUSE_DIS_DOWNLOAD_DCACHE_V 0x1 +#define EFUSE_DIS_DOWNLOAD_DCACHE_S 11 +/* EFUSE_DIS_DOWNLOAD_ICACHE : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_DOWNLOAD_ICACHE (BIT(10)) +#define EFUSE_DIS_DOWNLOAD_ICACHE_M (BIT(10)) +#define EFUSE_DIS_DOWNLOAD_ICACHE_V 0x1 +#define EFUSE_DIS_DOWNLOAD_ICACHE_S 10 +/* EFUSE_DIS_DCACHE : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_DCACHE (BIT(9)) +#define EFUSE_DIS_DCACHE_M (BIT(9)) +#define EFUSE_DIS_DCACHE_V 0x1 +#define EFUSE_DIS_DCACHE_S 9 +/* EFUSE_DIS_ICACHE : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_ICACHE (BIT(8)) +#define EFUSE_DIS_ICACHE_M (BIT(8)) +#define EFUSE_DIS_ICACHE_V 0x1 +#define EFUSE_DIS_ICACHE_S 8 +/* EFUSE_DIS_RTC_RAM_BOOT : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_RTC_RAM_BOOT (BIT(7)) +#define EFUSE_DIS_RTC_RAM_BOOT_M (BIT(7)) +#define EFUSE_DIS_RTC_RAM_BOOT_V 0x1 +#define EFUSE_DIS_RTC_RAM_BOOT_S 7 +/* EFUSE_RD_DIS : R/W ;bitpos:[6:0] ;default: 7'h0 ; */ +/*description: */ +#define EFUSE_RD_DIS 0x0000007F +#define EFUSE_RD_DIS_M ((EFUSE_RD_DIS_V)<<(EFUSE_RD_DIS_S)) +#define EFUSE_RD_DIS_V 0x7F +#define EFUSE_RD_DIS_S 0 + +#define EFUSE_PGM_DATA2_REG (DR_REG_EFUSE_BASE + 0x008) +/* EFUSE_KEY_PURPOSE_1 : R/W ;bitpos:[31:28] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_1 0x0000000F +#define EFUSE_KEY_PURPOSE_1_M ((EFUSE_KEY_PURPOSE_1_V)<<(EFUSE_KEY_PURPOSE_1_S)) +#define EFUSE_KEY_PURPOSE_1_V 0xF +#define EFUSE_KEY_PURPOSE_1_S 28 +/* EFUSE_KEY_PURPOSE_0 : R/W ;bitpos:[27:24] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_0 0x0000000F +#define EFUSE_KEY_PURPOSE_0_M ((EFUSE_KEY_PURPOSE_0_V)<<(EFUSE_KEY_PURPOSE_0_S)) +#define EFUSE_KEY_PURPOSE_0_V 0xF +#define EFUSE_KEY_PURPOSE_0_S 24 +/* EFUSE_SECURE_BOOT_KEY_REVOKE2 : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SECURE_BOOT_KEY_REVOKE2 (BIT(23)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE2_M (BIT(23)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE2_V 0x1 +#define EFUSE_SECURE_BOOT_KEY_REVOKE2_S 23 +/* EFUSE_SECURE_BOOT_KEY_REVOKE1 : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SECURE_BOOT_KEY_REVOKE1 (BIT(22)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE1_M (BIT(22)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE1_V 0x1 +#define EFUSE_SECURE_BOOT_KEY_REVOKE1_S 22 +/* EFUSE_SECURE_BOOT_KEY_REVOKE0 : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SECURE_BOOT_KEY_REVOKE0 (BIT(21)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE0_M (BIT(21)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE0_V 0x1 +#define EFUSE_SECURE_BOOT_KEY_REVOKE0_S 21 +/* EFUSE_SPI_BOOT_CRYPT_CNT : R/W ;bitpos:[20:18] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_SPI_BOOT_CRYPT_CNT 0x00000007 +#define EFUSE_SPI_BOOT_CRYPT_CNT_M ((EFUSE_SPI_BOOT_CRYPT_CNT_V)<<(EFUSE_SPI_BOOT_CRYPT_CNT_S)) +#define EFUSE_SPI_BOOT_CRYPT_CNT_V 0x7 +#define EFUSE_SPI_BOOT_CRYPT_CNT_S 18 +/* EFUSE_WDT_DELAY_SEL : R/W ;bitpos:[17:16] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_WDT_DELAY_SEL 0x00000003 +#define EFUSE_WDT_DELAY_SEL_M ((EFUSE_WDT_DELAY_SEL_V)<<(EFUSE_WDT_DELAY_SEL_S)) +#define EFUSE_WDT_DELAY_SEL_V 0x3 +#define EFUSE_WDT_DELAY_SEL_S 16 +/* EFUSE_SDIO_DCAP : R/W ;bitpos:[15:14] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_SDIO_DCAP 0x00000003 +#define EFUSE_SDIO_DCAP_M ((EFUSE_SDIO_DCAP_V)<<(EFUSE_SDIO_DCAP_S)) +#define EFUSE_SDIO_DCAP_V 0x3 +#define EFUSE_SDIO_DCAP_S 14 +/* EFUSE_SDIO_INIT : R/W ;bitpos:[13:12] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_SDIO_INIT 0x00000003 +#define EFUSE_SDIO_INIT_M ((EFUSE_SDIO_INIT_V)<<(EFUSE_SDIO_INIT_S)) +#define EFUSE_SDIO_INIT_V 0x3 +#define EFUSE_SDIO_INIT_S 12 +/* EFUSE_SDIO_DCURLIM : R/W ;bitpos:[11:9] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_SDIO_DCURLIM 0x00000007 +#define EFUSE_SDIO_DCURLIM_M ((EFUSE_SDIO_DCURLIM_V)<<(EFUSE_SDIO_DCURLIM_S)) +#define EFUSE_SDIO_DCURLIM_V 0x7 +#define EFUSE_SDIO_DCURLIM_S 9 +/* EFUSE_SDIO_ENCURLIM : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_ENCURLIM (BIT(8)) +#define EFUSE_SDIO_ENCURLIM_M (BIT(8)) +#define EFUSE_SDIO_ENCURLIM_V 0x1 +#define EFUSE_SDIO_ENCURLIM_S 8 +/* EFUSE_SDIO_EN_INIT : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_EN_INIT (BIT(7)) +#define EFUSE_SDIO_EN_INIT_M (BIT(7)) +#define EFUSE_SDIO_EN_INIT_V 0x1 +#define EFUSE_SDIO_EN_INIT_S 7 +/* EFUSE_SDIO_FORCE : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_FORCE (BIT(6)) +#define EFUSE_SDIO_FORCE_M (BIT(6)) +#define EFUSE_SDIO_FORCE_V 0x1 +#define EFUSE_SDIO_FORCE_S 6 +/* EFUSE_SDIO_TIEH : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_TIEH (BIT(5)) +#define EFUSE_SDIO_TIEH_M (BIT(5)) +#define EFUSE_SDIO_TIEH_V 0x1 +#define EFUSE_SDIO_TIEH_S 5 +/* EFUSE_SDIO_XPD : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_XPD (BIT(4)) +#define EFUSE_SDIO_XPD_M (BIT(4)) +#define EFUSE_SDIO_XPD_V 0x1 +#define EFUSE_SDIO_XPD_S 4 +/* EFUSE_SDIO_DREFL : R/W ;bitpos:[3:2] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_SDIO_DREFL 0x00000003 +#define EFUSE_SDIO_DREFL_M ((EFUSE_SDIO_DREFL_V)<<(EFUSE_SDIO_DREFL_S)) +#define EFUSE_SDIO_DREFL_V 0x3 +#define EFUSE_SDIO_DREFL_S 2 +/* EFUSE_SDIO_DREFM : R/W ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_SDIO_DREFM 0x00000003 +#define EFUSE_SDIO_DREFM_M ((EFUSE_SDIO_DREFM_V)<<(EFUSE_SDIO_DREFM_S)) +#define EFUSE_SDIO_DREFM_V 0x3 +#define EFUSE_SDIO_DREFM_S 0 + +#define EFUSE_PGM_DATA3_REG (DR_REG_EFUSE_BASE + 0x00c) +/* EFUSE_FLASH_TPUW : R/W ;bitpos:[31:28] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_FLASH_TPUW 0x0000000F +#define EFUSE_FLASH_TPUW_M ((EFUSE_FLASH_TPUW_V)<<(EFUSE_FLASH_TPUW_S)) +#define EFUSE_FLASH_TPUW_V 0xF +#define EFUSE_FLASH_TPUW_S 28 +/* EFUSE_XTAL_FREQ : R/W ;bitpos:[27:22] ;default: 6'b0 ; */ +/*description: */ +#define EFUSE_XTAL_FREQ 0x0000003F +#define EFUSE_XTAL_FREQ_M ((EFUSE_XTAL_FREQ_V)<<(EFUSE_XTAL_FREQ_S)) +#define EFUSE_XTAL_FREQ_V 0x3F +#define EFUSE_XTAL_FREQ_S 22 +/* EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE (BIT(21)) +#define EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE_M (BIT(21)) +#define EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE_V 0x1 +#define EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE_S 21 +/* EFUSE_SECURE_BOOT_EN : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SECURE_BOOT_EN (BIT(20)) +#define EFUSE_SECURE_BOOT_EN_M (BIT(20)) +#define EFUSE_SECURE_BOOT_EN_V 0x1 +#define EFUSE_SECURE_BOOT_EN_S 20 +/* EFUSE_KEY_PURPOSE_6 : R/W ;bitpos:[19:16] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_6 0x0000000F +#define EFUSE_KEY_PURPOSE_6_M ((EFUSE_KEY_PURPOSE_6_V)<<(EFUSE_KEY_PURPOSE_6_S)) +#define EFUSE_KEY_PURPOSE_6_V 0xF +#define EFUSE_KEY_PURPOSE_6_S 16 +/* EFUSE_KEY_PURPOSE_5 : R/W ;bitpos:[15:12] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_5 0x0000000F +#define EFUSE_KEY_PURPOSE_5_M ((EFUSE_KEY_PURPOSE_5_V)<<(EFUSE_KEY_PURPOSE_5_S)) +#define EFUSE_KEY_PURPOSE_5_V 0xF +#define EFUSE_KEY_PURPOSE_5_S 12 +/* EFUSE_KEY_PURPOSE_4 : R/W ;bitpos:[11:8] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_4 0x0000000F +#define EFUSE_KEY_PURPOSE_4_M ((EFUSE_KEY_PURPOSE_4_V)<<(EFUSE_KEY_PURPOSE_4_S)) +#define EFUSE_KEY_PURPOSE_4_V 0xF +#define EFUSE_KEY_PURPOSE_4_S 8 +/* EFUSE_KEY_PURPOSE_3 : R/W ;bitpos:[7:4] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_3 0x0000000F +#define EFUSE_KEY_PURPOSE_3_M ((EFUSE_KEY_PURPOSE_3_V)<<(EFUSE_KEY_PURPOSE_3_S)) +#define EFUSE_KEY_PURPOSE_3_V 0xF +#define EFUSE_KEY_PURPOSE_3_S 4 +/* EFUSE_KEY_PURPOSE_2 : R/W ;bitpos:[3:0] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_2 0x0000000F +#define EFUSE_KEY_PURPOSE_2_M ((EFUSE_KEY_PURPOSE_2_V)<<(EFUSE_KEY_PURPOSE_2_S)) +#define EFUSE_KEY_PURPOSE_2_V 0xF +#define EFUSE_KEY_PURPOSE_2_S 0 + +#define EFUSE_PGM_DATA4_REG (DR_REG_EFUSE_BASE + 0x010) +/* EFUSE_RESERVE : R/W ;bitpos:[31:8] ;default: 24'h0 ; */ +/*description: */ +#define EFUSE_RESERVE 0x00FFFFFF +#define EFUSE_RESERVE_M ((EFUSE_RESERVE_V)<<(EFUSE_RESERVE_S)) +#define EFUSE_RESERVE_V 0xFFFFFF +#define EFUSE_RESERVE_S 8 +/* EFUSE_UART_PRINT_CONTROL : R/W ;bitpos:[7:6] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_UART_PRINT_CONTROL 0x00000003 +#define EFUSE_UART_PRINT_CONTROL_M ((EFUSE_UART_PRINT_CONTROL_V)<<(EFUSE_UART_PRINT_CONTROL_S)) +#define EFUSE_UART_PRINT_CONTROL_V 0x3 +#define EFUSE_UART_PRINT_CONTROL_S 6 +/* EFUSE_ENABLE_SECURITY_DOWNLOAD : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_ENABLE_SECURITY_DOWNLOAD (BIT(5)) +#define EFUSE_ENABLE_SECURITY_DOWNLOAD_M (BIT(5)) +#define EFUSE_ENABLE_SECURITY_DOWNLOAD_V 0x1 +#define EFUSE_ENABLE_SECURITY_DOWNLOAD_S 5 +/* EFUSE_DIS_USB_DOWNLOAD_MODE : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_USB_DOWNLOAD_MODE (BIT(4)) +#define EFUSE_DIS_USB_DOWNLOAD_MODE_M (BIT(4)) +#define EFUSE_DIS_USB_DOWNLOAD_MODE_V 0x1 +#define EFUSE_DIS_USB_DOWNLOAD_MODE_S 4 +/* EFUSE_DIS_TINY_BASIC : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_TINY_BASIC (BIT(3)) +#define EFUSE_DIS_TINY_BASIC_M (BIT(3)) +#define EFUSE_DIS_TINY_BASIC_V 0x1 +#define EFUSE_DIS_TINY_BASIC_S 3 +/* EFUSE_UART_PRINT_CHANNEL : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_UART_PRINT_CHANNEL (BIT(2)) +#define EFUSE_UART_PRINT_CHANNEL_M (BIT(2)) +#define EFUSE_UART_PRINT_CHANNEL_V 0x1 +#define EFUSE_UART_PRINT_CHANNEL_S 2 +/* EFUSE_DIS_LEGACY_SPI_BOOT : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_LEGACY_SPI_BOOT (BIT(1)) +#define EFUSE_DIS_LEGACY_SPI_BOOT_M (BIT(1)) +#define EFUSE_DIS_LEGACY_SPI_BOOT_V 0x1 +#define EFUSE_DIS_LEGACY_SPI_BOOT_S 1 +/* EFUSE_DIS_DOWNLOAD_MODE : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_DOWNLOAD_MODE (BIT(0)) +#define EFUSE_DIS_DOWNLOAD_MODE_M (BIT(0)) +#define EFUSE_DIS_DOWNLOAD_MODE_V 0x1 +#define EFUSE_DIS_DOWNLOAD_MODE_S 0 + +#define EFUSE_PGM_DATA5_REG (DR_REG_EFUSE_BASE + 0x014) +/* EFUSE_RS_DATA_23 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define EFUSE_RS_DATA_23 0x000000FF +#define EFUSE_RS_DATA_23_M ((EFUSE_RS_DATA_23_V)<<(EFUSE_RS_DATA_23_S)) +#define EFUSE_RS_DATA_23_V 0xFF +#define EFUSE_RS_DATA_23_S 24 +/* EFUSE_CHIP_VERSION : R/W ;bitpos:[23:0] ;default: 24'b0 ; */ +/*description: */ +#define EFUSE_CHIP_VERSION 0x00FFFFFF +#define EFUSE_CHIP_VERSION_M ((EFUSE_CHIP_VERSION_V)<<(EFUSE_CHIP_VERSION_S)) +#define EFUSE_CHIP_VERSION_V 0xFFFFFF +#define EFUSE_CHIP_VERSION_S 0 + +#define EFUSE_PGM_DATA6_REG (DR_REG_EFUSE_BASE + 0x018) +/* EFUSE_RS_DATA_24_27 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_RS_DATA_24_27 0xFFFFFFFF +#define EFUSE_RS_DATA_24_27_M ((EFUSE_RS_DATA_24_27_V)<<(EFUSE_RS_DATA_24_27_S)) +#define EFUSE_RS_DATA_24_27_V 0xFFFFFFFF +#define EFUSE_RS_DATA_24_27_S 0 + +#define EFUSE_PGM_DATA7_REG (DR_REG_EFUSE_BASE + 0x01c) +/* EFUSE_RS_DATA_28_31 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_RS_DATA_28_31 0xFFFFFFFF +#define EFUSE_RS_DATA_28_31_M ((EFUSE_RS_DATA_28_31_V)<<(EFUSE_RS_DATA_28_31_S)) +#define EFUSE_RS_DATA_28_31_V 0xFFFFFFFF +#define EFUSE_RS_DATA_28_31_S 0 + +#define EFUSE_PGM_CHECK_VALUE0_REG (DR_REG_EFUSE_BASE + 0x020) +/* EFUSE_RS_DATA_32_35 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_RS_DATA_32_35 0xFFFFFFFF +#define EFUSE_RS_DATA_32_35_M ((EFUSE_RS_DATA_32_35_V)<<(EFUSE_RS_DATA_32_35_S)) +#define EFUSE_RS_DATA_32_35_V 0xFFFFFFFF +#define EFUSE_RS_DATA_32_35_S 0 + +#define EFUSE_PGM_CHECK_VALUE1_REG (DR_REG_EFUSE_BASE + 0x024) +/* EFUSE_RS_DATA_36_39 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_RS_DATA_36_39 0xFFFFFFFF +#define EFUSE_RS_DATA_36_39_M ((EFUSE_RS_DATA_36_39_V)<<(EFUSE_RS_DATA_36_39_S)) +#define EFUSE_RS_DATA_36_39_V 0xFFFFFFFF +#define EFUSE_RS_DATA_36_39_S 0 + +#define EFUSE_PGM_CHECK_VALUE2_REG (DR_REG_EFUSE_BASE + 0x028) +/* EFUSE_RS_DATA_40_43 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_RS_DATA_40_43 0xFFFFFFFF +#define EFUSE_RS_DATA_40_43_M ((EFUSE_RS_DATA_40_43_V)<<(EFUSE_RS_DATA_40_43_S)) +#define EFUSE_RS_DATA_40_43_V 0xFFFFFFFF +#define EFUSE_RS_DATA_40_43_S 0 + +#define EFUSE_RD_WR_DIS_REG (DR_REG_EFUSE_BASE + 0x02c) +/* EFUSE_WR_DIS : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define EFUSE_WR_DIS 0xFFFFFFFF +#define EFUSE_WR_DIS_M ((EFUSE_WR_DIS_V)<<(EFUSE_WR_DIS_S)) +#define EFUSE_WR_DIS_V 0xFFFFFFFF +#define EFUSE_WR_DIS_S 0 + +#define EFUSE_RD_REPEAT_DATA0_REG (DR_REG_EFUSE_BASE + 0x030) +/* EFUSE_SDIO_DREFH : RO ;bitpos:[31:30] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_SDIO_DREFH 0x00000003 +#define EFUSE_SDIO_DREFH_M ((EFUSE_SDIO_DREFH_V)<<(EFUSE_SDIO_DREFH_S)) +#define EFUSE_SDIO_DREFH_V 0x3 +#define EFUSE_SDIO_DREFH_S 30 +/* EFUSE_SDIO_MODECURLIM : RO ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_MODECURLIM (BIT(29)) +#define EFUSE_SDIO_MODECURLIM_M (BIT(29)) +#define EFUSE_SDIO_MODECURLIM_V 0x1 +#define EFUSE_SDIO_MODECURLIM_S 29 +/* EFUSE_USB_DRES : RO ;bitpos:[28:27] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_USB_DRES 0x00000003 +#define EFUSE_USB_DRES_M ((EFUSE_USB_DRES_V)<<(EFUSE_USB_DRES_S)) +#define EFUSE_USB_DRES_V 0x3 +#define EFUSE_USB_DRES_S 27 +/* EFUSE_USB_FORCE_B : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_USB_FORCE_B (BIT(26)) +#define EFUSE_USB_FORCE_B_M (BIT(26)) +#define EFUSE_USB_FORCE_B_V 0x1 +#define EFUSE_USB_FORCE_B_S 26 +/* EFUSE_USB_EXT_PHY_ENABLE : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_USB_EXT_PHY_ENABLE (BIT(25)) +#define EFUSE_USB_EXT_PHY_ENABLE_M (BIT(25)) +#define EFUSE_USB_EXT_PHY_ENABLE_V 0x1 +#define EFUSE_USB_EXT_PHY_ENABLE_S 25 +/* EFUSE_USB_EXCHG_PINS : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_USB_EXCHG_PINS (BIT(24)) +#define EFUSE_USB_EXCHG_PINS_M (BIT(24)) +#define EFUSE_USB_EXCHG_PINS_V 0x1 +#define EFUSE_USB_EXCHG_PINS_S 24 +/* EFUSE_USB_DREFL : RO ;bitpos:[23:22] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_USB_DREFL 0x00000003 +#define EFUSE_USB_DREFL_M ((EFUSE_USB_DREFL_V)<<(EFUSE_USB_DREFL_S)) +#define EFUSE_USB_DREFL_V 0x3 +#define EFUSE_USB_DREFL_S 22 +/* EFUSE_USB_DREFH : RO ;bitpos:[21:20] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_USB_DREFH 0x00000003 +#define EFUSE_USB_DREFH_M ((EFUSE_USB_DREFH_V)<<(EFUSE_USB_DREFH_S)) +#define EFUSE_USB_DREFH_V 0x3 +#define EFUSE_USB_DREFH_S 20 +/* EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT (BIT(19)) +#define EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_M (BIT(19)) +#define EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_V 0x1 +#define EFUSE_DIS_DOWNLOAD_MANUAL_ENCRYPT_S 19 +/* EFUSE_HARD_DIS_JTAG : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_HARD_DIS_JTAG (BIT(18)) +#define EFUSE_HARD_DIS_JTAG_M (BIT(18)) +#define EFUSE_HARD_DIS_JTAG_V 0x1 +#define EFUSE_HARD_DIS_JTAG_S 18 +/* EFUSE_SOFT_DIS_JTAG : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SOFT_DIS_JTAG (BIT(17)) +#define EFUSE_SOFT_DIS_JTAG_M (BIT(17)) +#define EFUSE_SOFT_DIS_JTAG_V 0x1 +#define EFUSE_SOFT_DIS_JTAG_S 17 +/* EFUSE_DIS_EFUSE_ATE_WR : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_EFUSE_ATE_WR (BIT(16)) +#define EFUSE_DIS_EFUSE_ATE_WR_M (BIT(16)) +#define EFUSE_DIS_EFUSE_ATE_WR_V 0x1 +#define EFUSE_DIS_EFUSE_ATE_WR_S 16 +/* EFUSE_DIS_SDIO_ACCESS : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_SDIO_ACCESS (BIT(15)) +#define EFUSE_DIS_SDIO_ACCESS_M (BIT(15)) +#define EFUSE_DIS_SDIO_ACCESS_V 0x1 +#define EFUSE_DIS_SDIO_ACCESS_S 15 +/* EFUSE_DIS_CAN : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_CAN (BIT(14)) +#define EFUSE_DIS_CAN_M (BIT(14)) +#define EFUSE_DIS_CAN_V 0x1 +#define EFUSE_DIS_CAN_S 14 +/* EFUSE_DIS_USB : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_USB (BIT(13)) +#define EFUSE_DIS_USB_M (BIT(13)) +#define EFUSE_DIS_USB_V 0x1 +#define EFUSE_DIS_USB_S 13 +/* EFUSE_DIS_BT : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_BT (BIT(12)) +#define EFUSE_DIS_BT_M (BIT(12)) +#define EFUSE_DIS_BT_V 0x1 +#define EFUSE_DIS_BT_S 12 +/* EFUSE_DIS_DOWNLOAD_DCACHE : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_DOWNLOAD_DCACHE (BIT(11)) +#define EFUSE_DIS_DOWNLOAD_DCACHE_M (BIT(11)) +#define EFUSE_DIS_DOWNLOAD_DCACHE_V 0x1 +#define EFUSE_DIS_DOWNLOAD_DCACHE_S 11 +/* EFUSE_DIS_DOWNLOAD_ICACHE : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_DOWNLOAD_ICACHE (BIT(10)) +#define EFUSE_DIS_DOWNLOAD_ICACHE_M (BIT(10)) +#define EFUSE_DIS_DOWNLOAD_ICACHE_V 0x1 +#define EFUSE_DIS_DOWNLOAD_ICACHE_S 10 +/* EFUSE_DIS_DCACHE : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_DCACHE (BIT(9)) +#define EFUSE_DIS_DCACHE_M (BIT(9)) +#define EFUSE_DIS_DCACHE_V 0x1 +#define EFUSE_DIS_DCACHE_S 9 +/* EFUSE_DIS_ICACHE : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_ICACHE (BIT(8)) +#define EFUSE_DIS_ICACHE_M (BIT(8)) +#define EFUSE_DIS_ICACHE_V 0x1 +#define EFUSE_DIS_ICACHE_S 8 +/* EFUSE_DIS_RTC_RAM_BOOT : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_RTC_RAM_BOOT (BIT(7)) +#define EFUSE_DIS_RTC_RAM_BOOT_M (BIT(7)) +#define EFUSE_DIS_RTC_RAM_BOOT_V 0x1 +#define EFUSE_DIS_RTC_RAM_BOOT_S 7 +/* EFUSE_RD_DIS : RO ;bitpos:[6:0] ;default: 7'h0 ; */ +/*description: */ +#define EFUSE_RD_DIS 0x0000007F +#define EFUSE_RD_DIS_M ((EFUSE_RD_DIS_V)<<(EFUSE_RD_DIS_S)) +#define EFUSE_RD_DIS_V 0x7F +#define EFUSE_RD_DIS_S 0 + +#define EFUSE_RD_REPEAT_DATA1_REG (DR_REG_EFUSE_BASE + 0x034) +/* EFUSE_KEY_PURPOSE_1 : RO ;bitpos:[31:28] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_1 0x0000000F +#define EFUSE_KEY_PURPOSE_1_M ((EFUSE_KEY_PURPOSE_1_V)<<(EFUSE_KEY_PURPOSE_1_S)) +#define EFUSE_KEY_PURPOSE_1_V 0xF +#define EFUSE_KEY_PURPOSE_1_S 28 +/* EFUSE_KEY_PURPOSE_0 : RO ;bitpos:[27:24] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_0 0x0000000F +#define EFUSE_KEY_PURPOSE_0_M ((EFUSE_KEY_PURPOSE_0_V)<<(EFUSE_KEY_PURPOSE_0_S)) +#define EFUSE_KEY_PURPOSE_0_V 0xF +#define EFUSE_KEY_PURPOSE_0_S 24 +/* EFUSE_SECURE_BOOT_KEY_REVOKE2 : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SECURE_BOOT_KEY_REVOKE2 (BIT(23)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE2_M (BIT(23)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE2_V 0x1 +#define EFUSE_SECURE_BOOT_KEY_REVOKE2_S 23 +/* EFUSE_SECURE_BOOT_KEY_REVOKE1 : RO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SECURE_BOOT_KEY_REVOKE1 (BIT(22)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE1_M (BIT(22)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE1_V 0x1 +#define EFUSE_SECURE_BOOT_KEY_REVOKE1_S 22 +/* EFUSE_SECURE_BOOT_KEY_REVOKE0 : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SECURE_BOOT_KEY_REVOKE0 (BIT(21)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE0_M (BIT(21)) +#define EFUSE_SECURE_BOOT_KEY_REVOKE0_V 0x1 +#define EFUSE_SECURE_BOOT_KEY_REVOKE0_S 21 +/* EFUSE_SPI_BOOT_CRYPT_CNT : RO ;bitpos:[20:18] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_SPI_BOOT_CRYPT_CNT 0x00000007 +#define EFUSE_SPI_BOOT_CRYPT_CNT_M ((EFUSE_SPI_BOOT_CRYPT_CNT_V)<<(EFUSE_SPI_BOOT_CRYPT_CNT_S)) +#define EFUSE_SPI_BOOT_CRYPT_CNT_V 0x7 +#define EFUSE_SPI_BOOT_CRYPT_CNT_S 18 +/* EFUSE_WDT_DELAY_SEL : RO ;bitpos:[17:16] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_WDT_DELAY_SEL 0x00000003 +#define EFUSE_WDT_DELAY_SEL_M ((EFUSE_WDT_DELAY_SEL_V)<<(EFUSE_WDT_DELAY_SEL_S)) +#define EFUSE_WDT_DELAY_SEL_V 0x3 +#define EFUSE_WDT_DELAY_SEL_S 16 +/* EFUSE_EUFSE_SDIO_DCAP : RO ;bitpos:[15:14] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_EUFSE_SDIO_DCAP 0x00000003 +#define EFUSE_EUFSE_SDIO_DCAP_M ((EFUSE_EUFSE_SDIO_DCAP_V)<<(EFUSE_EUFSE_SDIO_DCAP_S)) +#define EFUSE_EUFSE_SDIO_DCAP_V 0x3 +#define EFUSE_EUFSE_SDIO_DCAP_S 14 +/* EFUSE_SDIO_INIT : RO ;bitpos:[13:12] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_SDIO_INIT 0x00000003 +#define EFUSE_SDIO_INIT_M ((EFUSE_SDIO_INIT_V)<<(EFUSE_SDIO_INIT_S)) +#define EFUSE_SDIO_INIT_V 0x3 +#define EFUSE_SDIO_INIT_S 12 +/* EFUSE_SDIO_DCURLIM : RO ;bitpos:[11:9] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_SDIO_DCURLIM 0x00000007 +#define EFUSE_SDIO_DCURLIM_M ((EFUSE_SDIO_DCURLIM_V)<<(EFUSE_SDIO_DCURLIM_S)) +#define EFUSE_SDIO_DCURLIM_V 0x7 +#define EFUSE_SDIO_DCURLIM_S 9 +/* EFUSE_SDIO_ENCURLIM : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_ENCURLIM (BIT(8)) +#define EFUSE_SDIO_ENCURLIM_M (BIT(8)) +#define EFUSE_SDIO_ENCURLIM_V 0x1 +#define EFUSE_SDIO_ENCURLIM_S 8 +/* EFUSE_SDIO_EN_INIT : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_EN_INIT (BIT(7)) +#define EFUSE_SDIO_EN_INIT_M (BIT(7)) +#define EFUSE_SDIO_EN_INIT_V 0x1 +#define EFUSE_SDIO_EN_INIT_S 7 +/* EFUSE_SDIO_FORCE : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_FORCE (BIT(6)) +#define EFUSE_SDIO_FORCE_M (BIT(6)) +#define EFUSE_SDIO_FORCE_V 0x1 +#define EFUSE_SDIO_FORCE_S 6 +/* EFUSE_SDIO_TIEH : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_TIEH (BIT(5)) +#define EFUSE_SDIO_TIEH_M (BIT(5)) +#define EFUSE_SDIO_TIEH_V 0x1 +#define EFUSE_SDIO_TIEH_S 5 +/* EFUSE_SDIO_XPD : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SDIO_XPD (BIT(4)) +#define EFUSE_SDIO_XPD_M (BIT(4)) +#define EFUSE_SDIO_XPD_V 0x1 +#define EFUSE_SDIO_XPD_S 4 +/* EFUSE_SDIO_DREFL : RO ;bitpos:[3:2] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_SDIO_DREFL 0x00000003 +#define EFUSE_SDIO_DREFL_M ((EFUSE_SDIO_DREFL_V)<<(EFUSE_SDIO_DREFL_S)) +#define EFUSE_SDIO_DREFL_V 0x3 +#define EFUSE_SDIO_DREFL_S 2 +/* EFUSE_SDIO_DREFM : RO ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_SDIO_DREFM 0x00000003 +#define EFUSE_SDIO_DREFM_M ((EFUSE_SDIO_DREFM_V)<<(EFUSE_SDIO_DREFM_S)) +#define EFUSE_SDIO_DREFM_V 0x3 +#define EFUSE_SDIO_DREFM_S 0 + +#define EFUSE_RD_REPEAT_DATA2_REG (DR_REG_EFUSE_BASE + 0x038) +/* EFUSE_FLASH_TPUW : RO ;bitpos:[31:28] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_FLASH_TPUW 0x0000000F +#define EFUSE_FLASH_TPUW_M ((EFUSE_FLASH_TPUW_V)<<(EFUSE_FLASH_TPUW_S)) +#define EFUSE_FLASH_TPUW_V 0xF +#define EFUSE_FLASH_TPUW_S 28 +/* EFUSE_XTAL_FREQ : RO ;bitpos:[27:22] ;default: 6'b0 ; */ +/*description: */ +#define EFUSE_XTAL_FREQ 0x0000003F +#define EFUSE_XTAL_FREQ_M ((EFUSE_XTAL_FREQ_V)<<(EFUSE_XTAL_FREQ_S)) +#define EFUSE_XTAL_FREQ_V 0x3F +#define EFUSE_XTAL_FREQ_S 22 +/* EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE (BIT(21)) +#define EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE_M (BIT(21)) +#define EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE_V 0x1 +#define EFUSE_SECURE_BOOT_AGGRESSIVE_REVOKE_S 21 +/* EFUSE_SECURE_BOOT_EN : RO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_SECURE_BOOT_EN (BIT(20)) +#define EFUSE_SECURE_BOOT_EN_M (BIT(20)) +#define EFUSE_SECURE_BOOT_EN_V 0x1 +#define EFUSE_SECURE_BOOT_EN_S 20 +/* EFUSE_KEY_PURPOSE_6 : RO ;bitpos:[19:16] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_6 0x0000000F +#define EFUSE_KEY_PURPOSE_6_M ((EFUSE_KEY_PURPOSE_6_V)<<(EFUSE_KEY_PURPOSE_6_S)) +#define EFUSE_KEY_PURPOSE_6_V 0xF +#define EFUSE_KEY_PURPOSE_6_S 16 +/* EFUSE_KEY_PURPOSE_5 : RO ;bitpos:[15:12] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_5 0x0000000F +#define EFUSE_KEY_PURPOSE_5_M ((EFUSE_KEY_PURPOSE_5_V)<<(EFUSE_KEY_PURPOSE_5_S)) +#define EFUSE_KEY_PURPOSE_5_V 0xF +#define EFUSE_KEY_PURPOSE_5_S 12 +/* EFUSE_KEY_PURPOSE_4 : RO ;bitpos:[11:8] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_4 0x0000000F +#define EFUSE_KEY_PURPOSE_4_M ((EFUSE_KEY_PURPOSE_4_V)<<(EFUSE_KEY_PURPOSE_4_S)) +#define EFUSE_KEY_PURPOSE_4_V 0xF +#define EFUSE_KEY_PURPOSE_4_S 8 +/* EFUSE_KEY_PURPOSE_3 : RO ;bitpos:[7:4] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_3 0x0000000F +#define EFUSE_KEY_PURPOSE_3_M ((EFUSE_KEY_PURPOSE_3_V)<<(EFUSE_KEY_PURPOSE_3_S)) +#define EFUSE_KEY_PURPOSE_3_V 0xF +#define EFUSE_KEY_PURPOSE_3_S 4 +/* EFUSE_KEY_PURPOSE_2 : RO ;bitpos:[3:0] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_KEY_PURPOSE_2 0x0000000F +#define EFUSE_KEY_PURPOSE_2_M ((EFUSE_KEY_PURPOSE_2_V)<<(EFUSE_KEY_PURPOSE_2_S)) +#define EFUSE_KEY_PURPOSE_2_V 0xF +#define EFUSE_KEY_PURPOSE_2_S 0 + +#define EFUSE_RD_REPEAT_DATA3_REG (DR_REG_EFUSE_BASE + 0x03c) +/* EFUSE_RESERVE : RO ;bitpos:[31:8] ;default: 24'h0 ; */ +/*description: */ +#define EFUSE_RESERVE 0x00FFFFFF +#define EFUSE_RESERVE_M ((EFUSE_RESERVE_V)<<(EFUSE_RESERVE_S)) +#define EFUSE_RESERVE_V 0xFFFFFF +#define EFUSE_RESERVE_S 8 +/* EFUSE_UART_PRINT_CONTROL : RO ;bitpos:[7:6] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_UART_PRINT_CONTROL 0x00000003 +#define EFUSE_UART_PRINT_CONTROL_M ((EFUSE_UART_PRINT_CONTROL_V)<<(EFUSE_UART_PRINT_CONTROL_S)) +#define EFUSE_UART_PRINT_CONTROL_V 0x3 +#define EFUSE_UART_PRINT_CONTROL_S 6 +/* EFUSE_ENABLE_SECURITY_DOWNLOAD : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_ENABLE_SECURITY_DOWNLOAD (BIT(5)) +#define EFUSE_ENABLE_SECURITY_DOWNLOAD_M (BIT(5)) +#define EFUSE_ENABLE_SECURITY_DOWNLOAD_V 0x1 +#define EFUSE_ENABLE_SECURITY_DOWNLOAD_S 5 +/* EFUSE_DIS_USB_DOWNLOAD_MODE : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_USB_DOWNLOAD_MODE (BIT(4)) +#define EFUSE_DIS_USB_DOWNLOAD_MODE_M (BIT(4)) +#define EFUSE_DIS_USB_DOWNLOAD_MODE_V 0x1 +#define EFUSE_DIS_USB_DOWNLOAD_MODE_S 4 +/* EFUSE_DIS_TINY_BASIC : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_TINY_BASIC (BIT(3)) +#define EFUSE_DIS_TINY_BASIC_M (BIT(3)) +#define EFUSE_DIS_TINY_BASIC_V 0x1 +#define EFUSE_DIS_TINY_BASIC_S 3 +/* EFUSE_UART_PRINT_CHANNEL : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_UART_PRINT_CHANNEL (BIT(2)) +#define EFUSE_UART_PRINT_CHANNEL_M (BIT(2)) +#define EFUSE_UART_PRINT_CHANNEL_V 0x1 +#define EFUSE_UART_PRINT_CHANNEL_S 2 +/* EFUSE_DIS_LEGACY_SPI_BOOT : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_LEGACY_SPI_BOOT (BIT(1)) +#define EFUSE_DIS_LEGACY_SPI_BOOT_M (BIT(1)) +#define EFUSE_DIS_LEGACY_SPI_BOOT_V 0x1 +#define EFUSE_DIS_LEGACY_SPI_BOOT_S 1 +/* EFUSE_DIS_DOWNLOAD_MODE : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DIS_DOWNLOAD_MODE (BIT(0)) +#define EFUSE_DIS_DOWNLOAD_MODE_M (BIT(0)) +#define EFUSE_DIS_DOWNLOAD_MODE_V 0x1 +#define EFUSE_DIS_DOWNLOAD_MODE_S 0 + +#define EFUSE_RD_REPEAT_DATA4_REG (DR_REG_EFUSE_BASE + 0x040) +/* EFUSE_CHIP_VERSION : RO ;bitpos:[23:0] ;default: 24'b0 ; */ +/*description: */ +#define EFUSE_CHIP_VERSION 0x00FFFFFF +#define EFUSE_CHIP_VERSION_M ((EFUSE_CHIP_VERSION_V)<<(EFUSE_CHIP_VERSION_S)) +#define EFUSE_CHIP_VERSION_V 0xFFFFFF +#define EFUSE_CHIP_VERSION_S 0 + +#define EFUSE_RD_MAC_SPI_8M_0_REG (DR_REG_EFUSE_BASE + 0x044) +/* EFUSE_MAC_0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_MAC_0 0xFFFFFFFF +#define EFUSE_MAC_0_M ((EFUSE_MAC_0_V)<<(EFUSE_MAC_0_S)) +#define EFUSE_MAC_0_V 0xFFFFFFFF +#define EFUSE_MAC_0_S 0 + +#define EFUSE_RD_MAC_SPI_8M_1_REG (DR_REG_EFUSE_BASE + 0x048) +/* EFUSE_SPI_PAD_CONF_0 : RO ;bitpos:[31:16] ;default: 16'h0 ; */ +/*description: */ +#define EFUSE_SPI_PAD_CONF_0 0x0000FFFF +#define EFUSE_SPI_PAD_CONF_0_M ((EFUSE_SPI_PAD_CONF_0_V)<<(EFUSE_SPI_PAD_CONF_0_S)) +#define EFUSE_SPI_PAD_CONF_0_V 0xFFFF +#define EFUSE_SPI_PAD_CONF_0_S 16 +/* EFUSE_MAC_1 : RO ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: */ +#define EFUSE_MAC_1 0x0000FFFF +#define EFUSE_MAC_1_M ((EFUSE_MAC_1_V)<<(EFUSE_MAC_1_S)) +#define EFUSE_MAC_1_V 0xFFFF +#define EFUSE_MAC_1_S 0 + +#define EFUSE_RD_MAC_SPI_8M_2_REG (DR_REG_EFUSE_BASE + 0x04c) +/* EFUSE_CLK8M_FREQ : RO ;bitpos:[31:20] ;default: 12'h0 ; */ +/*description: */ +#define EFUSE_CLK8M_FREQ 0x00000FFF +#define EFUSE_CLK8M_FREQ_M ((EFUSE_CLK8M_FREQ_V)<<(EFUSE_CLK8M_FREQ_S)) +#define EFUSE_CLK8M_FREQ_V 0xFFF +#define EFUSE_CLK8M_FREQ_S 20 +/* EFUSE_SPI_PAD_CONF_1 : RO ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define EFUSE_SPI_PAD_CONF_1 0x000FFFFF +#define EFUSE_SPI_PAD_CONF_1_M ((EFUSE_SPI_PAD_CONF_1_V)<<(EFUSE_SPI_PAD_CONF_1_S)) +#define EFUSE_SPI_PAD_CONF_1_V 0xFFFFF +#define EFUSE_SPI_PAD_CONF_1_S 0 + +#define EFUSE_RD_MAC_SPI_8M_3_REG (DR_REG_EFUSE_BASE + 0x050) +/* EFUSE_SYS_DATA_PART0_0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA_PART0_0 0xFFFFFFFF +#define EFUSE_SYS_DATA_PART0_0_M ((EFUSE_SYS_DATA_PART0_0_V)<<(EFUSE_SYS_DATA_PART0_0_S)) +#define EFUSE_SYS_DATA_PART0_0_V 0xFFFFFFFF +#define EFUSE_SYS_DATA_PART0_0_S 0 + +#define EFUSE_RD_MAC_SPI_8M_4_REG (DR_REG_EFUSE_BASE + 0x054) +/* EFUSE_SYS_DATA_PART0_1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA_PART0_1 0xFFFFFFFF +#define EFUSE_SYS_DATA_PART0_1_M ((EFUSE_SYS_DATA_PART0_1_V)<<(EFUSE_SYS_DATA_PART0_1_S)) +#define EFUSE_SYS_DATA_PART0_1_V 0xFFFFFFFF +#define EFUSE_SYS_DATA_PART0_1_S 0 + +#define EFUSE_RD_MAC_SPI_8M_5_REG (DR_REG_EFUSE_BASE + 0x058) +/* EFUSE_SYS_DATA_PART0_2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA_PART0_2 0xFFFFFFFF +#define EFUSE_SYS_DATA_PART0_2_M ((EFUSE_SYS_DATA_PART0_2_V)<<(EFUSE_SYS_DATA_PART0_2_S)) +#define EFUSE_SYS_DATA_PART0_2_V 0xFFFFFFFF +#define EFUSE_SYS_DATA_PART0_2_S 0 + +#define EFUSE_RD_SYS_DATA0_REG (DR_REG_EFUSE_BASE + 0x05c) +/* EFUSE_SYS_DATA0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA0 0xFFFFFFFF +#define EFUSE_SYS_DATA0_M ((EFUSE_SYS_DATA0_V)<<(EFUSE_SYS_DATA0_S)) +#define EFUSE_SYS_DATA0_V 0xFFFFFFFF +#define EFUSE_SYS_DATA0_S 0 + +#define EFUSE_RD_SYS_DATA1_REG (DR_REG_EFUSE_BASE + 0x060) +/* EFUSE_SYS_DATA1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA1 0xFFFFFFFF +#define EFUSE_SYS_DATA1_M ((EFUSE_SYS_DATA1_V)<<(EFUSE_SYS_DATA1_S)) +#define EFUSE_SYS_DATA1_V 0xFFFFFFFF +#define EFUSE_SYS_DATA1_S 0 + +#define EFUSE_RD_SYS_DATA2_REG (DR_REG_EFUSE_BASE + 0x064) +/* EFUSE_SYS_DATA2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA2 0xFFFFFFFF +#define EFUSE_SYS_DATA2_M ((EFUSE_SYS_DATA2_V)<<(EFUSE_SYS_DATA2_S)) +#define EFUSE_SYS_DATA2_V 0xFFFFFFFF +#define EFUSE_SYS_DATA2_S 0 + +#define EFUSE_RD_SYS_DATA3_REG (DR_REG_EFUSE_BASE + 0x068) +/* EFUSE_SYS_DATA3 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA3 0xFFFFFFFF +#define EFUSE_SYS_DATA3_M ((EFUSE_SYS_DATA3_V)<<(EFUSE_SYS_DATA3_S)) +#define EFUSE_SYS_DATA3_V 0xFFFFFFFF +#define EFUSE_SYS_DATA3_S 0 + +#define EFUSE_RD_SYS_DATA4_REG (DR_REG_EFUSE_BASE + 0x06c) +/* EFUSE_SYS_DATA4 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA4 0xFFFFFFFF +#define EFUSE_SYS_DATA4_M ((EFUSE_SYS_DATA4_V)<<(EFUSE_SYS_DATA4_S)) +#define EFUSE_SYS_DATA4_V 0xFFFFFFFF +#define EFUSE_SYS_DATA4_S 0 + +#define EFUSE_RD_SYS_DATA5_REG (DR_REG_EFUSE_BASE + 0x070) +/* EFUSE_SYS_DATA5 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA5 0xFFFFFFFF +#define EFUSE_SYS_DATA5_M ((EFUSE_SYS_DATA5_V)<<(EFUSE_SYS_DATA5_S)) +#define EFUSE_SYS_DATA5_V 0xFFFFFFFF +#define EFUSE_SYS_DATA5_S 0 + +#define EFUSE_RD_SYS_DATA6_REG (DR_REG_EFUSE_BASE + 0x074) +/* EFUSE_SYS_DATA6 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA6 0xFFFFFFFF +#define EFUSE_SYS_DATA6_M ((EFUSE_SYS_DATA6_V)<<(EFUSE_SYS_DATA6_S)) +#define EFUSE_SYS_DATA6_V 0xFFFFFFFF +#define EFUSE_SYS_DATA6_S 0 + +#define EFUSE_RD_SYS_DATA7_REG (DR_REG_EFUSE_BASE + 0x078) +/* EFUSE_SYS_DATA7 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_SYS_DATA7 0xFFFFFFFF +#define EFUSE_SYS_DATA7_M ((EFUSE_SYS_DATA7_V)<<(EFUSE_SYS_DATA7_S)) +#define EFUSE_SYS_DATA7_V 0xFFFFFFFF +#define EFUSE_SYS_DATA7_S 0 + +#define EFUSE_RD_USR_DATA0_REG (DR_REG_EFUSE_BASE + 0x07c) +/* EFUSE_USR_DATA0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_USR_DATA0 0xFFFFFFFF +#define EFUSE_USR_DATA0_M ((EFUSE_USR_DATA0_V)<<(EFUSE_USR_DATA0_S)) +#define EFUSE_USR_DATA0_V 0xFFFFFFFF +#define EFUSE_USR_DATA0_S 0 + +#define EFUSE_RD_USR_DATA1_REG (DR_REG_EFUSE_BASE + 0x080) +/* EFUSE_USR_DATA1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_USR_DATA1 0xFFFFFFFF +#define EFUSE_USR_DATA1_M ((EFUSE_USR_DATA1_V)<<(EFUSE_USR_DATA1_S)) +#define EFUSE_USR_DATA1_V 0xFFFFFFFF +#define EFUSE_USR_DATA1_S 0 + +#define EFUSE_RD_USR_DATA2_REG (DR_REG_EFUSE_BASE + 0x084) +/* EFUSE_USR_DATA2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_USR_DATA2 0xFFFFFFFF +#define EFUSE_USR_DATA2_M ((EFUSE_USR_DATA2_V)<<(EFUSE_USR_DATA2_S)) +#define EFUSE_USR_DATA2_V 0xFFFFFFFF +#define EFUSE_USR_DATA2_S 0 + +#define EFUSE_RD_USR_DATA3_REG (DR_REG_EFUSE_BASE + 0x088) +/* EFUSE_USR_DATA3 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_USR_DATA3 0xFFFFFFFF +#define EFUSE_USR_DATA3_M ((EFUSE_USR_DATA3_V)<<(EFUSE_USR_DATA3_S)) +#define EFUSE_USR_DATA3_V 0xFFFFFFFF +#define EFUSE_USR_DATA3_S 0 + +#define EFUSE_RD_USR_DATA4_REG (DR_REG_EFUSE_BASE + 0x08c) +/* EFUSE_USR_DATA4 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_USR_DATA4 0xFFFFFFFF +#define EFUSE_USR_DATA4_M ((EFUSE_USR_DATA4_V)<<(EFUSE_USR_DATA4_S)) +#define EFUSE_USR_DATA4_V 0xFFFFFFFF +#define EFUSE_USR_DATA4_S 0 + +#define EFUSE_RD_USR_DATA5_REG (DR_REG_EFUSE_BASE + 0x090) +/* EFUSE_USR_DATA5 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_USR_DATA5 0xFFFFFFFF +#define EFUSE_USR_DATA5_M ((EFUSE_USR_DATA5_V)<<(EFUSE_USR_DATA5_S)) +#define EFUSE_USR_DATA5_V 0xFFFFFFFF +#define EFUSE_USR_DATA5_S 0 + +#define EFUSE_RD_USR_DATA6_REG (DR_REG_EFUSE_BASE + 0x094) +/* EFUSE_USR_DATA6 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_USR_DATA6 0xFFFFFFFF +#define EFUSE_USR_DATA6_M ((EFUSE_USR_DATA6_V)<<(EFUSE_USR_DATA6_S)) +#define EFUSE_USR_DATA6_V 0xFFFFFFFF +#define EFUSE_USR_DATA6_S 0 + +#define EFUSE_RD_USR_DATA7_REG (DR_REG_EFUSE_BASE + 0x098) +/* EFUSE_USR_DATA7 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_USR_DATA7 0xFFFFFFFF +#define EFUSE_USR_DATA7_M ((EFUSE_USR_DATA7_V)<<(EFUSE_USR_DATA7_S)) +#define EFUSE_USR_DATA7_V 0xFFFFFFFF +#define EFUSE_USR_DATA7_S 0 + +#define EFUSE_RD_KEY0_DATA0_REG (DR_REG_EFUSE_BASE + 0x09c) +/* EFUSE_KEY0_DATA0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY0_DATA0 0xFFFFFFFF +#define EFUSE_KEY0_DATA0_M ((EFUSE_KEY0_DATA0_V)<<(EFUSE_KEY0_DATA0_S)) +#define EFUSE_KEY0_DATA0_V 0xFFFFFFFF +#define EFUSE_KEY0_DATA0_S 0 + +#define EFUSE_RD_KEY0_DATA1_REG (DR_REG_EFUSE_BASE + 0x0a0) +/* EFUSE_KEY0_DATA1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY0_DATA1 0xFFFFFFFF +#define EFUSE_KEY0_DATA1_M ((EFUSE_KEY0_DATA1_V)<<(EFUSE_KEY0_DATA1_S)) +#define EFUSE_KEY0_DATA1_V 0xFFFFFFFF +#define EFUSE_KEY0_DATA1_S 0 + +#define EFUSE_RD_KEY0_DATA2_REG (DR_REG_EFUSE_BASE + 0x0a4) +/* EFUSE_KEY0_DATA2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY0_DATA2 0xFFFFFFFF +#define EFUSE_KEY0_DATA2_M ((EFUSE_KEY0_DATA2_V)<<(EFUSE_KEY0_DATA2_S)) +#define EFUSE_KEY0_DATA2_V 0xFFFFFFFF +#define EFUSE_KEY0_DATA2_S 0 + +#define EFUSE_RD_KEY0_DATA3_REG (DR_REG_EFUSE_BASE + 0x0a8) +/* EFUSE_KEY0_DATA3 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY0_DATA3 0xFFFFFFFF +#define EFUSE_KEY0_DATA3_M ((EFUSE_KEY0_DATA3_V)<<(EFUSE_KEY0_DATA3_S)) +#define EFUSE_KEY0_DATA3_V 0xFFFFFFFF +#define EFUSE_KEY0_DATA3_S 0 + +#define EFUSE_RD_KEY0_DATA4_REG (DR_REG_EFUSE_BASE + 0x0ac) +/* EFUSE_KEY0_DATA4 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY0_DATA4 0xFFFFFFFF +#define EFUSE_KEY0_DATA4_M ((EFUSE_KEY0_DATA4_V)<<(EFUSE_KEY0_DATA4_S)) +#define EFUSE_KEY0_DATA4_V 0xFFFFFFFF +#define EFUSE_KEY0_DATA4_S 0 + +#define EFUSE_RD_KEY0_DATA5_REG (DR_REG_EFUSE_BASE + 0x0b0) +/* EFUSE_KEY0_DATA5 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY0_DATA5 0xFFFFFFFF +#define EFUSE_KEY0_DATA5_M ((EFUSE_KEY0_DATA5_V)<<(EFUSE_KEY0_DATA5_S)) +#define EFUSE_KEY0_DATA5_V 0xFFFFFFFF +#define EFUSE_KEY0_DATA5_S 0 + +#define EFUSE_RD_KEY0_DATA6_REG (DR_REG_EFUSE_BASE + 0x0b4) +/* EFUSE_KEY0_DATA6 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY0_DATA6 0xFFFFFFFF +#define EFUSE_KEY0_DATA6_M ((EFUSE_KEY0_DATA6_V)<<(EFUSE_KEY0_DATA6_S)) +#define EFUSE_KEY0_DATA6_V 0xFFFFFFFF +#define EFUSE_KEY0_DATA6_S 0 + +#define EFUSE_RD_KEY0_DATA7_REG (DR_REG_EFUSE_BASE + 0x0b8) +/* EFUSE_KEY0_DATA7 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY0_DATA7 0xFFFFFFFF +#define EFUSE_KEY0_DATA7_M ((EFUSE_KEY0_DATA7_V)<<(EFUSE_KEY0_DATA7_S)) +#define EFUSE_KEY0_DATA7_V 0xFFFFFFFF +#define EFUSE_KEY0_DATA7_S 0 + +#define EFUSE_RD_KEY1_DATA0_REG (DR_REG_EFUSE_BASE + 0x0bc) +/* EFUSE_KEY1_DATA0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY1_DATA0 0xFFFFFFFF +#define EFUSE_KEY1_DATA0_M ((EFUSE_KEY1_DATA0_V)<<(EFUSE_KEY1_DATA0_S)) +#define EFUSE_KEY1_DATA0_V 0xFFFFFFFF +#define EFUSE_KEY1_DATA0_S 0 + +#define EFUSE_RD_KEY1_DATA1_REG (DR_REG_EFUSE_BASE + 0x0c0) +/* EFUSE_KEY1_DATA1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY1_DATA1 0xFFFFFFFF +#define EFUSE_KEY1_DATA1_M ((EFUSE_KEY1_DATA1_V)<<(EFUSE_KEY1_DATA1_S)) +#define EFUSE_KEY1_DATA1_V 0xFFFFFFFF +#define EFUSE_KEY1_DATA1_S 0 + +#define EFUSE_RD_KEY1_DATA2_REG (DR_REG_EFUSE_BASE + 0x0c4) +/* EFUSE_KEY1_DATA2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY1_DATA2 0xFFFFFFFF +#define EFUSE_KEY1_DATA2_M ((EFUSE_KEY1_DATA2_V)<<(EFUSE_KEY1_DATA2_S)) +#define EFUSE_KEY1_DATA2_V 0xFFFFFFFF +#define EFUSE_KEY1_DATA2_S 0 + +#define EFUSE_RD_KEY1_DATA3_REG (DR_REG_EFUSE_BASE + 0x0c8) +/* EFUSE_KEY1_DATA3 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY1_DATA3 0xFFFFFFFF +#define EFUSE_KEY1_DATA3_M ((EFUSE_KEY1_DATA3_V)<<(EFUSE_KEY1_DATA3_S)) +#define EFUSE_KEY1_DATA3_V 0xFFFFFFFF +#define EFUSE_KEY1_DATA3_S 0 + +#define EFUSE_RD_KEY1_DATA4_REG (DR_REG_EFUSE_BASE + 0x0cc) +/* EFUSE_KEY1_DATA4 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY1_DATA4 0xFFFFFFFF +#define EFUSE_KEY1_DATA4_M ((EFUSE_KEY1_DATA4_V)<<(EFUSE_KEY1_DATA4_S)) +#define EFUSE_KEY1_DATA4_V 0xFFFFFFFF +#define EFUSE_KEY1_DATA4_S 0 + +#define EFUSE_RD_KEY1_DATA5_REG (DR_REG_EFUSE_BASE + 0x0d0) +/* EFUSE_KEY1_DATA5 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY1_DATA5 0xFFFFFFFF +#define EFUSE_KEY1_DATA5_M ((EFUSE_KEY1_DATA5_V)<<(EFUSE_KEY1_DATA5_S)) +#define EFUSE_KEY1_DATA5_V 0xFFFFFFFF +#define EFUSE_KEY1_DATA5_S 0 + +#define EFUSE_RD_KEY1_DATA6_REG (DR_REG_EFUSE_BASE + 0x0d4) +/* EFUSE_KEY1_DATA6 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY1_DATA6 0xFFFFFFFF +#define EFUSE_KEY1_DATA6_M ((EFUSE_KEY1_DATA6_V)<<(EFUSE_KEY1_DATA6_S)) +#define EFUSE_KEY1_DATA6_V 0xFFFFFFFF +#define EFUSE_KEY1_DATA6_S 0 + +#define EFUSE_RD_KEY1_DATA7_REG (DR_REG_EFUSE_BASE + 0x0d8) +/* EFUSE_KEY1_DATA7 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY1_DATA7 0xFFFFFFFF +#define EFUSE_KEY1_DATA7_M ((EFUSE_KEY1_DATA7_V)<<(EFUSE_KEY1_DATA7_S)) +#define EFUSE_KEY1_DATA7_V 0xFFFFFFFF +#define EFUSE_KEY1_DATA7_S 0 + +#define EFUSE_RD_KEY2_DATA0_REG (DR_REG_EFUSE_BASE + 0x0dc) +/* EFUSE_KEY2_DATA0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY2_DATA0 0xFFFFFFFF +#define EFUSE_KEY2_DATA0_M ((EFUSE_KEY2_DATA0_V)<<(EFUSE_KEY2_DATA0_S)) +#define EFUSE_KEY2_DATA0_V 0xFFFFFFFF +#define EFUSE_KEY2_DATA0_S 0 + +#define EFUSE_RD_KEY2_DATA1_REG (DR_REG_EFUSE_BASE + 0x0e0) +/* EFUSE_KEY2_DATA1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY2_DATA1 0xFFFFFFFF +#define EFUSE_KEY2_DATA1_M ((EFUSE_KEY2_DATA1_V)<<(EFUSE_KEY2_DATA1_S)) +#define EFUSE_KEY2_DATA1_V 0xFFFFFFFF +#define EFUSE_KEY2_DATA1_S 0 + +#define EFUSE_RD_KEY2_DATA2_REG (DR_REG_EFUSE_BASE + 0x0e4) +/* EFUSE_KEY2_DATA2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY2_DATA2 0xFFFFFFFF +#define EFUSE_KEY2_DATA2_M ((EFUSE_KEY2_DATA2_V)<<(EFUSE_KEY2_DATA2_S)) +#define EFUSE_KEY2_DATA2_V 0xFFFFFFFF +#define EFUSE_KEY2_DATA2_S 0 + +#define EFUSE_RD_KEY2_DATA3_REG (DR_REG_EFUSE_BASE + 0x0e8) +/* EFUSE_KEY2_DATA3 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY2_DATA3 0xFFFFFFFF +#define EFUSE_KEY2_DATA3_M ((EFUSE_KEY2_DATA3_V)<<(EFUSE_KEY2_DATA3_S)) +#define EFUSE_KEY2_DATA3_V 0xFFFFFFFF +#define EFUSE_KEY2_DATA3_S 0 + +#define EFUSE_RD_KEY2_DATA4_REG (DR_REG_EFUSE_BASE + 0x0ec) +/* EFUSE_KEY2_DATA4 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY2_DATA4 0xFFFFFFFF +#define EFUSE_KEY2_DATA4_M ((EFUSE_KEY2_DATA4_V)<<(EFUSE_KEY2_DATA4_S)) +#define EFUSE_KEY2_DATA4_V 0xFFFFFFFF +#define EFUSE_KEY2_DATA4_S 0 + +#define EFUSE_RD_KEY2_DATA5_REG (DR_REG_EFUSE_BASE + 0x0f0) +/* EFUSE_KEY2_DATA5 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY2_DATA5 0xFFFFFFFF +#define EFUSE_KEY2_DATA5_M ((EFUSE_KEY2_DATA5_V)<<(EFUSE_KEY2_DATA5_S)) +#define EFUSE_KEY2_DATA5_V 0xFFFFFFFF +#define EFUSE_KEY2_DATA5_S 0 + +#define EFUSE_RD_KEY2_DATA6_REG (DR_REG_EFUSE_BASE + 0x0f4) +/* EFUSE_KEY2_DATA6 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY2_DATA6 0xFFFFFFFF +#define EFUSE_KEY2_DATA6_M ((EFUSE_KEY2_DATA6_V)<<(EFUSE_KEY2_DATA6_S)) +#define EFUSE_KEY2_DATA6_V 0xFFFFFFFF +#define EFUSE_KEY2_DATA6_S 0 + +#define EFUSE_RD_KEY2_DATA7_REG (DR_REG_EFUSE_BASE + 0x0f8) +/* EFUSE_KEY2_DATA7 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY2_DATA7 0xFFFFFFFF +#define EFUSE_KEY2_DATA7_M ((EFUSE_KEY2_DATA7_V)<<(EFUSE_KEY2_DATA7_S)) +#define EFUSE_KEY2_DATA7_V 0xFFFFFFFF +#define EFUSE_KEY2_DATA7_S 0 + +#define EFUSE_RD_KEY3_DATA0_REG (DR_REG_EFUSE_BASE + 0x0fc) +/* EFUSE_KEY3_DATA0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY3_DATA0 0xFFFFFFFF +#define EFUSE_KEY3_DATA0_M ((EFUSE_KEY3_DATA0_V)<<(EFUSE_KEY3_DATA0_S)) +#define EFUSE_KEY3_DATA0_V 0xFFFFFFFF +#define EFUSE_KEY3_DATA0_S 0 + +#define EFUSE_RD_KEY3_DATA1_REG (DR_REG_EFUSE_BASE + 0x100) +/* EFUSE_KEY3_DATA1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY3_DATA1 0xFFFFFFFF +#define EFUSE_KEY3_DATA1_M ((EFUSE_KEY3_DATA1_V)<<(EFUSE_KEY3_DATA1_S)) +#define EFUSE_KEY3_DATA1_V 0xFFFFFFFF +#define EFUSE_KEY3_DATA1_S 0 + +#define EFUSE_RD_KEY3_DATA2_REG (DR_REG_EFUSE_BASE + 0x104) +/* EFUSE_KEY3_DATA2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY3_DATA2 0xFFFFFFFF +#define EFUSE_KEY3_DATA2_M ((EFUSE_KEY3_DATA2_V)<<(EFUSE_KEY3_DATA2_S)) +#define EFUSE_KEY3_DATA2_V 0xFFFFFFFF +#define EFUSE_KEY3_DATA2_S 0 + +#define EFUSE_RD_KEY3_DATA3_REG (DR_REG_EFUSE_BASE + 0x108) +/* EFUSE_KEY3_DATA3 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY3_DATA3 0xFFFFFFFF +#define EFUSE_KEY3_DATA3_M ((EFUSE_KEY3_DATA3_V)<<(EFUSE_KEY3_DATA3_S)) +#define EFUSE_KEY3_DATA3_V 0xFFFFFFFF +#define EFUSE_KEY3_DATA3_S 0 + +#define EFUSE_RD_KEY3_DATA4_REG (DR_REG_EFUSE_BASE + 0x10c) +/* EFUSE_KEY3_DATA4 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY3_DATA4 0xFFFFFFFF +#define EFUSE_KEY3_DATA4_M ((EFUSE_KEY3_DATA4_V)<<(EFUSE_KEY3_DATA4_S)) +#define EFUSE_KEY3_DATA4_V 0xFFFFFFFF +#define EFUSE_KEY3_DATA4_S 0 + +#define EFUSE_RD_KEY3_DATA5_REG (DR_REG_EFUSE_BASE + 0x110) +/* EFUSE_KEY3_DATA5 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY3_DATA5 0xFFFFFFFF +#define EFUSE_KEY3_DATA5_M ((EFUSE_KEY3_DATA5_V)<<(EFUSE_KEY3_DATA5_S)) +#define EFUSE_KEY3_DATA5_V 0xFFFFFFFF +#define EFUSE_KEY3_DATA5_S 0 + +#define EFUSE_RD_KEY3_DATA6_REG (DR_REG_EFUSE_BASE + 0x114) +/* EFUSE_KEY3_DATA6 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY3_DATA6 0xFFFFFFFF +#define EFUSE_KEY3_DATA6_M ((EFUSE_KEY3_DATA6_V)<<(EFUSE_KEY3_DATA6_S)) +#define EFUSE_KEY3_DATA6_V 0xFFFFFFFF +#define EFUSE_KEY3_DATA6_S 0 + +#define EFUSE_RD_KEY3_DATA7_REG (DR_REG_EFUSE_BASE + 0x118) +/* EFUSE_KEY3_DATA7 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY3_DATA7 0xFFFFFFFF +#define EFUSE_KEY3_DATA7_M ((EFUSE_KEY3_DATA7_V)<<(EFUSE_KEY3_DATA7_S)) +#define EFUSE_KEY3_DATA7_V 0xFFFFFFFF +#define EFUSE_KEY3_DATA7_S 0 + +#define EFUSE_RD_KEY4_DATA0_REG (DR_REG_EFUSE_BASE + 0x11c) +/* EFUSE_KEY4_DATA0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY4_DATA0 0xFFFFFFFF +#define EFUSE_KEY4_DATA0_M ((EFUSE_KEY4_DATA0_V)<<(EFUSE_KEY4_DATA0_S)) +#define EFUSE_KEY4_DATA0_V 0xFFFFFFFF +#define EFUSE_KEY4_DATA0_S 0 + +#define EFUSE_RD_KEY4_DATA1_REG (DR_REG_EFUSE_BASE + 0x120) +/* EFUSE_KEY4_DATA1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY4_DATA1 0xFFFFFFFF +#define EFUSE_KEY4_DATA1_M ((EFUSE_KEY4_DATA1_V)<<(EFUSE_KEY4_DATA1_S)) +#define EFUSE_KEY4_DATA1_V 0xFFFFFFFF +#define EFUSE_KEY4_DATA1_S 0 + +#define EFUSE_RD_KEY4_DATA2_REG (DR_REG_EFUSE_BASE + 0x124) +/* EFUSE_KEY4_DATA2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY4_DATA2 0xFFFFFFFF +#define EFUSE_KEY4_DATA2_M ((EFUSE_KEY4_DATA2_V)<<(EFUSE_KEY4_DATA2_S)) +#define EFUSE_KEY4_DATA2_V 0xFFFFFFFF +#define EFUSE_KEY4_DATA2_S 0 + +#define EFUSE_RD_KEY4_DATA3_REG (DR_REG_EFUSE_BASE + 0x128) +/* EFUSE_KEY4_DATA3 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY4_DATA3 0xFFFFFFFF +#define EFUSE_KEY4_DATA3_M ((EFUSE_KEY4_DATA3_V)<<(EFUSE_KEY4_DATA3_S)) +#define EFUSE_KEY4_DATA3_V 0xFFFFFFFF +#define EFUSE_KEY4_DATA3_S 0 + +#define EFUSE_RD_KEY4_DATA4_REG (DR_REG_EFUSE_BASE + 0x12c) +/* EFUSE_KEY4_DATA4 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY4_DATA4 0xFFFFFFFF +#define EFUSE_KEY4_DATA4_M ((EFUSE_KEY4_DATA4_V)<<(EFUSE_KEY4_DATA4_S)) +#define EFUSE_KEY4_DATA4_V 0xFFFFFFFF +#define EFUSE_KEY4_DATA4_S 0 + +#define EFUSE_RD_KEY4_DATA5_REG (DR_REG_EFUSE_BASE + 0x130) +/* EFUSE_KEY4_DATA5 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY4_DATA5 0xFFFFFFFF +#define EFUSE_KEY4_DATA5_M ((EFUSE_KEY4_DATA5_V)<<(EFUSE_KEY4_DATA5_S)) +#define EFUSE_KEY4_DATA5_V 0xFFFFFFFF +#define EFUSE_KEY4_DATA5_S 0 + +#define EFUSE_RD_KEY4_DATA6_REG (DR_REG_EFUSE_BASE + 0x134) +/* EFUSE_KEY4_DATA6 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY4_DATA6 0xFFFFFFFF +#define EFUSE_KEY4_DATA6_M ((EFUSE_KEY4_DATA6_V)<<(EFUSE_KEY4_DATA6_S)) +#define EFUSE_KEY4_DATA6_V 0xFFFFFFFF +#define EFUSE_KEY4_DATA6_S 0 + +#define EFUSE_RD_KEY4_DATA7_REG (DR_REG_EFUSE_BASE + 0x138) +/* EFUSE_KEY4_DATA7 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY4_DATA7 0xFFFFFFFF +#define EFUSE_KEY4_DATA7_M ((EFUSE_KEY4_DATA7_V)<<(EFUSE_KEY4_DATA7_S)) +#define EFUSE_KEY4_DATA7_V 0xFFFFFFFF +#define EFUSE_KEY4_DATA7_S 0 + +#define EFUSE_RD_KEY5_DATA0_REG (DR_REG_EFUSE_BASE + 0x13c) +/* EFUSE_KEY5_DATA0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY5_DATA0 0xFFFFFFFF +#define EFUSE_KEY5_DATA0_M ((EFUSE_KEY5_DATA0_V)<<(EFUSE_KEY5_DATA0_S)) +#define EFUSE_KEY5_DATA0_V 0xFFFFFFFF +#define EFUSE_KEY5_DATA0_S 0 + +#define EFUSE_RD_KEY5_DATA1_REG (DR_REG_EFUSE_BASE + 0x140) +/* EFUSE_KEY5_DATA1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY5_DATA1 0xFFFFFFFF +#define EFUSE_KEY5_DATA1_M ((EFUSE_KEY5_DATA1_V)<<(EFUSE_KEY5_DATA1_S)) +#define EFUSE_KEY5_DATA1_V 0xFFFFFFFF +#define EFUSE_KEY5_DATA1_S 0 + +#define EFUSE_RD_KEY5_DATA2_REG (DR_REG_EFUSE_BASE + 0x144) +/* EFUSE_KEY5_DATA2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY5_DATA2 0xFFFFFFFF +#define EFUSE_KEY5_DATA2_M ((EFUSE_KEY5_DATA2_V)<<(EFUSE_KEY5_DATA2_S)) +#define EFUSE_KEY5_DATA2_V 0xFFFFFFFF +#define EFUSE_KEY5_DATA2_S 0 + +#define EFUSE_RD_KEY5_DATA3_REG (DR_REG_EFUSE_BASE + 0x148) +/* EFUSE_KEY5_DATA3 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY5_DATA3 0xFFFFFFFF +#define EFUSE_KEY5_DATA3_M ((EFUSE_KEY5_DATA3_V)<<(EFUSE_KEY5_DATA3_S)) +#define EFUSE_KEY5_DATA3_V 0xFFFFFFFF +#define EFUSE_KEY5_DATA3_S 0 + +#define EFUSE_RD_KEY5_DATA4_REG (DR_REG_EFUSE_BASE + 0x14c) +/* EFUSE_KEY5_DATA4 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY5_DATA4 0xFFFFFFFF +#define EFUSE_KEY5_DATA4_M ((EFUSE_KEY5_DATA4_V)<<(EFUSE_KEY5_DATA4_S)) +#define EFUSE_KEY5_DATA4_V 0xFFFFFFFF +#define EFUSE_KEY5_DATA4_S 0 + +#define EFUSE_RD_KEY5_DATA5_REG (DR_REG_EFUSE_BASE + 0x150) +/* EFUSE_KEY5_DATA5 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY5_DATA5 0xFFFFFFFF +#define EFUSE_KEY5_DATA5_M ((EFUSE_KEY5_DATA5_V)<<(EFUSE_KEY5_DATA5_S)) +#define EFUSE_KEY5_DATA5_V 0xFFFFFFFF +#define EFUSE_KEY5_DATA5_S 0 + +#define EFUSE_RD_KEY5_DATA6_REG (DR_REG_EFUSE_BASE + 0x154) +/* EFUSE_KEY5_DATA6 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY5_DATA6 0xFFFFFFFF +#define EFUSE_KEY5_DATA6_M ((EFUSE_KEY5_DATA6_V)<<(EFUSE_KEY5_DATA6_S)) +#define EFUSE_KEY5_DATA6_V 0xFFFFFFFF +#define EFUSE_KEY5_DATA6_S 0 + +#define EFUSE_RD_KEY5_DATA7_REG (DR_REG_EFUSE_BASE + 0x158) +/* EFUSE_KEY5_DATA7 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY5_DATA7 0xFFFFFFFF +#define EFUSE_KEY5_DATA7_M ((EFUSE_KEY5_DATA7_V)<<(EFUSE_KEY5_DATA7_S)) +#define EFUSE_KEY5_DATA7_V 0xFFFFFFFF +#define EFUSE_KEY5_DATA7_S 0 + +#define EFUSE_RD_KEY6_DATA0_REG (DR_REG_EFUSE_BASE + 0x15c) +/* EFUSE_KEY6_DATA0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY6_DATA0 0xFFFFFFFF +#define EFUSE_KEY6_DATA0_M ((EFUSE_KEY6_DATA0_V)<<(EFUSE_KEY6_DATA0_S)) +#define EFUSE_KEY6_DATA0_V 0xFFFFFFFF +#define EFUSE_KEY6_DATA0_S 0 + +#define EFUSE_RD_KEY6_DATA1_REG (DR_REG_EFUSE_BASE + 0x160) +/* EFUSE_KEY6_DATA1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY6_DATA1 0xFFFFFFFF +#define EFUSE_KEY6_DATA1_M ((EFUSE_KEY6_DATA1_V)<<(EFUSE_KEY6_DATA1_S)) +#define EFUSE_KEY6_DATA1_V 0xFFFFFFFF +#define EFUSE_KEY6_DATA1_S 0 + +#define EFUSE_RD_KEY6_DATA2_REG (DR_REG_EFUSE_BASE + 0x164) +/* EFUSE_KEY6_DATA2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY6_DATA2 0xFFFFFFFF +#define EFUSE_KEY6_DATA2_M ((EFUSE_KEY6_DATA2_V)<<(EFUSE_KEY6_DATA2_S)) +#define EFUSE_KEY6_DATA2_V 0xFFFFFFFF +#define EFUSE_KEY6_DATA2_S 0 + +#define EFUSE_RD_KEY6_DATA3_REG (DR_REG_EFUSE_BASE + 0x168) +/* EFUSE_KEY6_DATA3 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY6_DATA3 0xFFFFFFFF +#define EFUSE_KEY6_DATA3_M ((EFUSE_KEY6_DATA3_V)<<(EFUSE_KEY6_DATA3_S)) +#define EFUSE_KEY6_DATA3_V 0xFFFFFFFF +#define EFUSE_KEY6_DATA3_S 0 + +#define EFUSE_RD_KEY6_DATA4_REG (DR_REG_EFUSE_BASE + 0x16c) +/* EFUSE_KEY6_DATA4 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY6_DATA4 0xFFFFFFFF +#define EFUSE_KEY6_DATA4_M ((EFUSE_KEY6_DATA4_V)<<(EFUSE_KEY6_DATA4_S)) +#define EFUSE_KEY6_DATA4_V 0xFFFFFFFF +#define EFUSE_KEY6_DATA4_S 0 + +#define EFUSE_RD_KEY6_DATA5_REG (DR_REG_EFUSE_BASE + 0x170) +/* EFUSE_KEY6_DATA5 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY6_DATA5 0xFFFFFFFF +#define EFUSE_KEY6_DATA5_M ((EFUSE_KEY6_DATA5_V)<<(EFUSE_KEY6_DATA5_S)) +#define EFUSE_KEY6_DATA5_V 0xFFFFFFFF +#define EFUSE_KEY6_DATA5_S 0 + +#define EFUSE_RD_KEY6_DATA6_REG (DR_REG_EFUSE_BASE + 0x174) +/* EFUSE_KEY6_DATA6 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY6_DATA6 0xFFFFFFFF +#define EFUSE_KEY6_DATA6_M ((EFUSE_KEY6_DATA6_V)<<(EFUSE_KEY6_DATA6_S)) +#define EFUSE_KEY6_DATA6_V 0xFFFFFFFF +#define EFUSE_KEY6_DATA6_S 0 + +#define EFUSE_RD_KEY6_DATA7_REG (DR_REG_EFUSE_BASE + 0x178) +/* EFUSE_KEY6_DATA7 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define EFUSE_KEY6_DATA7 0xFFFFFFFF +#define EFUSE_KEY6_DATA7_M ((EFUSE_KEY6_DATA7_V)<<(EFUSE_KEY6_DATA7_S)) +#define EFUSE_KEY6_DATA7_V 0xFFFFFFFF +#define EFUSE_KEY6_DATA7_S 0 + +#define EFUSE_RD_REPEAT_ERR0_REG (DR_REG_EFUSE_BASE + 0x17c) +/* EFUSE_RD_SDIO_DREFH_ERR : RO ;bitpos:[31:30] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_DREFH_ERR 0x00000003 +#define EFUSE_RD_SDIO_DREFH_ERR_M ((EFUSE_RD_SDIO_DREFH_ERR_V)<<(EFUSE_RD_SDIO_DREFH_ERR_S)) +#define EFUSE_RD_SDIO_DREFH_ERR_V 0x3 +#define EFUSE_RD_SDIO_DREFH_ERR_S 30 +/* EFUSE_RD_SDIO_MODECURLIM_ERR : RO ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_MODECURLIM_ERR (BIT(29)) +#define EFUSE_RD_SDIO_MODECURLIM_ERR_M (BIT(29)) +#define EFUSE_RD_SDIO_MODECURLIM_ERR_V 0x1 +#define EFUSE_RD_SDIO_MODECURLIM_ERR_S 29 +/* EFUSE_RD_USB_DRES_ERR : RO ;bitpos:[28:25] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_RD_USB_DRES_ERR 0x0000000F +#define EFUSE_RD_USB_DRES_ERR_M ((EFUSE_RD_USB_DRES_ERR_V)<<(EFUSE_RD_USB_DRES_ERR_S)) +#define EFUSE_RD_USB_DRES_ERR_V 0xF +#define EFUSE_RD_USB_DRES_ERR_S 25 +/* EFUSE_RD_USB_EXCHG_PINS_ERR : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_USB_EXCHG_PINS_ERR (BIT(24)) +#define EFUSE_RD_USB_EXCHG_PINS_ERR_M (BIT(24)) +#define EFUSE_RD_USB_EXCHG_PINS_ERR_V 0x1 +#define EFUSE_RD_USB_EXCHG_PINS_ERR_S 24 +/* EFUSE_RD_USB_DREFL_ERR : RO ;bitpos:[23:22] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_RD_USB_DREFL_ERR 0x00000003 +#define EFUSE_RD_USB_DREFL_ERR_M ((EFUSE_RD_USB_DREFL_ERR_V)<<(EFUSE_RD_USB_DREFL_ERR_S)) +#define EFUSE_RD_USB_DREFL_ERR_V 0x3 +#define EFUSE_RD_USB_DREFL_ERR_S 22 +/* EFUSE_RD_USB_DREFH_ERR : RO ;bitpos:[21:20] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_RD_USB_DREFH_ERR 0x00000003 +#define EFUSE_RD_USB_DREFH_ERR_M ((EFUSE_RD_USB_DREFH_ERR_V)<<(EFUSE_RD_USB_DREFH_ERR_S)) +#define EFUSE_RD_USB_DREFH_ERR_V 0x3 +#define EFUSE_RD_USB_DREFH_ERR_S 20 +/* EFUSE_RD_DIS_DOWNLOAD_MANUAL_ENCRYPT_ERR : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_DOWNLOAD_MANUAL_ENCRYPT_ERR (BIT(19)) +#define EFUSE_RD_DIS_DOWNLOAD_MANUAL_ENCRYPT_ERR_M (BIT(19)) +#define EFUSE_RD_DIS_DOWNLOAD_MANUAL_ENCRYPT_ERR_V 0x1 +#define EFUSE_RD_DIS_DOWNLOAD_MANUAL_ENCRYPT_ERR_S 19 +/* EFUSE_RD_HARD_DIS_JTAG_ERR : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_HARD_DIS_JTAG_ERR (BIT(18)) +#define EFUSE_RD_HARD_DIS_JTAG_ERR_M (BIT(18)) +#define EFUSE_RD_HARD_DIS_JTAG_ERR_V 0x1 +#define EFUSE_RD_HARD_DIS_JTAG_ERR_S 18 +/* EFUSE_RD_SOFT_DIS_JTAG_ERR : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SOFT_DIS_JTAG_ERR (BIT(17)) +#define EFUSE_RD_SOFT_DIS_JTAG_ERR_M (BIT(17)) +#define EFUSE_RD_SOFT_DIS_JTAG_ERR_V 0x1 +#define EFUSE_RD_SOFT_DIS_JTAG_ERR_S 17 +/* EFUSE_RD_DIS_EFUSE_ATE_WR_ERR : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_EFUSE_ATE_WR_ERR (BIT(16)) +#define EFUSE_RD_DIS_EFUSE_ATE_WR_ERR_M (BIT(16)) +#define EFUSE_RD_DIS_EFUSE_ATE_WR_ERR_V 0x1 +#define EFUSE_RD_DIS_EFUSE_ATE_WR_ERR_S 16 +/* EFUSE_RD_DIS_SDIO_ACCESS_ERR : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_SDIO_ACCESS_ERR (BIT(15)) +#define EFUSE_RD_DIS_SDIO_ACCESS_ERR_M (BIT(15)) +#define EFUSE_RD_DIS_SDIO_ACCESS_ERR_V 0x1 +#define EFUSE_RD_DIS_SDIO_ACCESS_ERR_S 15 +/* EFUSE_RD_DIS_CAN_ERR : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_CAN_ERR (BIT(14)) +#define EFUSE_RD_DIS_CAN_ERR_M (BIT(14)) +#define EFUSE_RD_DIS_CAN_ERR_V 0x1 +#define EFUSE_RD_DIS_CAN_ERR_S 14 +/* EFUSE_RD_DIS_USB_ERR : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_USB_ERR (BIT(13)) +#define EFUSE_RD_DIS_USB_ERR_M (BIT(13)) +#define EFUSE_RD_DIS_USB_ERR_V 0x1 +#define EFUSE_RD_DIS_USB_ERR_S 13 +/* EFUSE_RD_DIS_BT_ERR : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_BT_ERR (BIT(12)) +#define EFUSE_RD_DIS_BT_ERR_M (BIT(12)) +#define EFUSE_RD_DIS_BT_ERR_V 0x1 +#define EFUSE_RD_DIS_BT_ERR_S 12 +/* EFUSE_RD_DIS_DOWNLOAD_DCACHE_ERR : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_DOWNLOAD_DCACHE_ERR (BIT(11)) +#define EFUSE_RD_DIS_DOWNLOAD_DCACHE_ERR_M (BIT(11)) +#define EFUSE_RD_DIS_DOWNLOAD_DCACHE_ERR_V 0x1 +#define EFUSE_RD_DIS_DOWNLOAD_DCACHE_ERR_S 11 +/* EFUSE_RD_DIS_DOWNLOAD_ICACHE_ERR : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_DOWNLOAD_ICACHE_ERR (BIT(10)) +#define EFUSE_RD_DIS_DOWNLOAD_ICACHE_ERR_M (BIT(10)) +#define EFUSE_RD_DIS_DOWNLOAD_ICACHE_ERR_V 0x1 +#define EFUSE_RD_DIS_DOWNLOAD_ICACHE_ERR_S 10 +/* EFUSE_RD_DIS_DCACHE_ERR : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_DCACHE_ERR (BIT(9)) +#define EFUSE_RD_DIS_DCACHE_ERR_M (BIT(9)) +#define EFUSE_RD_DIS_DCACHE_ERR_V 0x1 +#define EFUSE_RD_DIS_DCACHE_ERR_S 9 +/* EFUSE_RD_DIS_ICACHE_ERR : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_ICACHE_ERR (BIT(8)) +#define EFUSE_RD_DIS_ICACHE_ERR_M (BIT(8)) +#define EFUSE_RD_DIS_ICACHE_ERR_V 0x1 +#define EFUSE_RD_DIS_ICACHE_ERR_S 8 +/* EFUSE_RD_DIS_RTC_RAM_BOOT_ERR : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_RTC_RAM_BOOT_ERR (BIT(7)) +#define EFUSE_RD_DIS_RTC_RAM_BOOT_ERR_M (BIT(7)) +#define EFUSE_RD_DIS_RTC_RAM_BOOT_ERR_V 0x1 +#define EFUSE_RD_DIS_RTC_RAM_BOOT_ERR_S 7 +/* EFUSE_RD_RD_DIS_ERR : RO ;bitpos:[6:0] ;default: 7'h0 ; */ +/*description: */ +#define EFUSE_RD_RD_DIS_ERR 0x0000007F +#define EFUSE_RD_RD_DIS_ERR_M ((EFUSE_RD_RD_DIS_ERR_V)<<(EFUSE_RD_RD_DIS_ERR_S)) +#define EFUSE_RD_RD_DIS_ERR_V 0x7F +#define EFUSE_RD_RD_DIS_ERR_S 0 + +#define EFUSE_RD_REPEAT_ERR1_REG (DR_REG_EFUSE_BASE + 0x180) +/* EFUSE_RD_KEY_PURPOSE_1_ERR : RO ;bitpos:[31:28] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY_PURPOSE_1_ERR 0x0000000F +#define EFUSE_RD_KEY_PURPOSE_1_ERR_M ((EFUSE_RD_KEY_PURPOSE_1_ERR_V)<<(EFUSE_RD_KEY_PURPOSE_1_ERR_S)) +#define EFUSE_RD_KEY_PURPOSE_1_ERR_V 0xF +#define EFUSE_RD_KEY_PURPOSE_1_ERR_S 28 +/* EFUSE_RD_KEY_PURPOSE_0_ERR : RO ;bitpos:[27:24] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY_PURPOSE_0_ERR 0x0000000F +#define EFUSE_RD_KEY_PURPOSE_0_ERR_M ((EFUSE_RD_KEY_PURPOSE_0_ERR_V)<<(EFUSE_RD_KEY_PURPOSE_0_ERR_S)) +#define EFUSE_RD_KEY_PURPOSE_0_ERR_V 0xF +#define EFUSE_RD_KEY_PURPOSE_0_ERR_S 24 +/* EFUSE_RD_SECURE_BOOT_KEY_REVOKE2_ERR : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE2_ERR (BIT(23)) +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE2_ERR_M (BIT(23)) +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE2_ERR_V 0x1 +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE2_ERR_S 23 +/* EFUSE_RD_SECURE_BOOT_KEY_REVOKE1_ERR : RO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE1_ERR (BIT(22)) +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE1_ERR_M (BIT(22)) +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE1_ERR_V 0x1 +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE1_ERR_S 22 +/* EFUSE_RD_SECURE_BOOT_KEY_REVOKE0_ERR : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE0_ERR (BIT(21)) +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE0_ERR_M (BIT(21)) +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE0_ERR_V 0x1 +#define EFUSE_RD_SECURE_BOOT_KEY_REVOKE0_ERR_S 21 +/* EFUSE_RD_SPI_BOOT_CRYPT_CNT_ERR : RO ;bitpos:[20:18] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_SPI_BOOT_CRYPT_CNT_ERR 0x00000007 +#define EFUSE_RD_SPI_BOOT_CRYPT_CNT_ERR_M ((EFUSE_RD_SPI_BOOT_CRYPT_CNT_ERR_V)<<(EFUSE_RD_SPI_BOOT_CRYPT_CNT_ERR_S)) +#define EFUSE_RD_SPI_BOOT_CRYPT_CNT_ERR_V 0x7 +#define EFUSE_RD_SPI_BOOT_CRYPT_CNT_ERR_S 18 +/* EFUSE_RD_WDT_DELAY_SEL_ERR : RO ;bitpos:[17:16] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_RD_WDT_DELAY_SEL_ERR 0x00000003 +#define EFUSE_RD_WDT_DELAY_SEL_ERR_M ((EFUSE_RD_WDT_DELAY_SEL_ERR_V)<<(EFUSE_RD_WDT_DELAY_SEL_ERR_S)) +#define EFUSE_RD_WDT_DELAY_SEL_ERR_V 0x3 +#define EFUSE_RD_WDT_DELAY_SEL_ERR_S 16 +/* EFUSE_RD_SDIO_DCAP_ERR : RO ;bitpos:[15:14] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_DCAP_ERR 0x00000003 +#define EFUSE_RD_SDIO_DCAP_ERR_M ((EFUSE_RD_SDIO_DCAP_ERR_V)<<(EFUSE_RD_SDIO_DCAP_ERR_S)) +#define EFUSE_RD_SDIO_DCAP_ERR_V 0x3 +#define EFUSE_RD_SDIO_DCAP_ERR_S 14 +/* EFUSE_RD_SDIO_INIT_ERR : RO ;bitpos:[13:12] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_INIT_ERR 0x00000003 +#define EFUSE_RD_SDIO_INIT_ERR_M ((EFUSE_RD_SDIO_INIT_ERR_V)<<(EFUSE_RD_SDIO_INIT_ERR_S)) +#define EFUSE_RD_SDIO_INIT_ERR_V 0x3 +#define EFUSE_RD_SDIO_INIT_ERR_S 12 +/* EFUSE_RD_SDIO_DCURLIM_ERR : RO ;bitpos:[11:9] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_DCURLIM_ERR 0x00000007 +#define EFUSE_RD_SDIO_DCURLIM_ERR_M ((EFUSE_RD_SDIO_DCURLIM_ERR_V)<<(EFUSE_RD_SDIO_DCURLIM_ERR_S)) +#define EFUSE_RD_SDIO_DCURLIM_ERR_V 0x7 +#define EFUSE_RD_SDIO_DCURLIM_ERR_S 9 +/* EFUSE_RD_SDIO_ENCURLIM_ERR : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_ENCURLIM_ERR (BIT(8)) +#define EFUSE_RD_SDIO_ENCURLIM_ERR_M (BIT(8)) +#define EFUSE_RD_SDIO_ENCURLIM_ERR_V 0x1 +#define EFUSE_RD_SDIO_ENCURLIM_ERR_S 8 +/* EFUSE_RD_SDIO_EN_INIT_ERR : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_EN_INIT_ERR (BIT(7)) +#define EFUSE_RD_SDIO_EN_INIT_ERR_M (BIT(7)) +#define EFUSE_RD_SDIO_EN_INIT_ERR_V 0x1 +#define EFUSE_RD_SDIO_EN_INIT_ERR_S 7 +/* EFUSE_RD_SDIO_FORCE_ERR : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_FORCE_ERR (BIT(6)) +#define EFUSE_RD_SDIO_FORCE_ERR_M (BIT(6)) +#define EFUSE_RD_SDIO_FORCE_ERR_V 0x1 +#define EFUSE_RD_SDIO_FORCE_ERR_S 6 +/* EFUSE_RD_SDIO_TIEH_ERR : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_TIEH_ERR (BIT(5)) +#define EFUSE_RD_SDIO_TIEH_ERR_M (BIT(5)) +#define EFUSE_RD_SDIO_TIEH_ERR_V 0x1 +#define EFUSE_RD_SDIO_TIEH_ERR_S 5 +/* EFUSE_RD_SDIO_XPD_ERR : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_XPD_ERR (BIT(4)) +#define EFUSE_RD_SDIO_XPD_ERR_M (BIT(4)) +#define EFUSE_RD_SDIO_XPD_ERR_V 0x1 +#define EFUSE_RD_SDIO_XPD_ERR_S 4 +/* EFUSE_RD_SDIO_DREFL_ERR : RO ;bitpos:[3:2] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_DREFL_ERR 0x00000003 +#define EFUSE_RD_SDIO_DREFL_ERR_M ((EFUSE_RD_SDIO_DREFL_ERR_V)<<(EFUSE_RD_SDIO_DREFL_ERR_S)) +#define EFUSE_RD_SDIO_DREFL_ERR_V 0x3 +#define EFUSE_RD_SDIO_DREFL_ERR_S 2 +/* EFUSE_RD_SDIO_DREFM_ERR : RO ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_RD_SDIO_DREFM_ERR 0x00000003 +#define EFUSE_RD_SDIO_DREFM_ERR_M ((EFUSE_RD_SDIO_DREFM_ERR_V)<<(EFUSE_RD_SDIO_DREFM_ERR_S)) +#define EFUSE_RD_SDIO_DREFM_ERR_V 0x3 +#define EFUSE_RD_SDIO_DREFM_ERR_S 0 + +#define EFUSE_RD_REPEAT_ERR2_REG (DR_REG_EFUSE_BASE + 0x184) +/* EFUSE_RD_FLASH_TPUW_ERR : RO ;bitpos:[31:28] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_RD_FLASH_TPUW_ERR 0x0000000F +#define EFUSE_RD_FLASH_TPUW_ERR_M ((EFUSE_RD_FLASH_TPUW_ERR_V)<<(EFUSE_RD_FLASH_TPUW_ERR_S)) +#define EFUSE_RD_FLASH_TPUW_ERR_V 0xF +#define EFUSE_RD_FLASH_TPUW_ERR_S 28 +/* EFUSE_RD_XTAL_FREQ_ERR : RO ;bitpos:[27:22] ;default: 6'b0 ; */ +/*description: */ +#define EFUSE_RD_XTAL_FREQ_ERR 0x0000003F +#define EFUSE_RD_XTAL_FREQ_ERR_M ((EFUSE_RD_XTAL_FREQ_ERR_V)<<(EFUSE_RD_XTAL_FREQ_ERR_S)) +#define EFUSE_RD_XTAL_FREQ_ERR_V 0x3F +#define EFUSE_RD_XTAL_FREQ_ERR_S 22 +/* EFUSE_RD_SECURE_BOOT_AGGRESSIVE_REVOKE_ERR : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SECURE_BOOT_AGGRESSIVE_REVOKE_ERR (BIT(21)) +#define EFUSE_RD_SECURE_BOOT_AGGRESSIVE_REVOKE_ERR_M (BIT(21)) +#define EFUSE_RD_SECURE_BOOT_AGGRESSIVE_REVOKE_ERR_V 0x1 +#define EFUSE_RD_SECURE_BOOT_AGGRESSIVE_REVOKE_ERR_S 21 +/* EFUSE_RD_SECURE_BOOT_EN_ERR : RO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SECURE_BOOT_EN_ERR (BIT(20)) +#define EFUSE_RD_SECURE_BOOT_EN_ERR_M (BIT(20)) +#define EFUSE_RD_SECURE_BOOT_EN_ERR_V 0x1 +#define EFUSE_RD_SECURE_BOOT_EN_ERR_S 20 +/* EFUSE_RD_KEY_PURPOSE_6_ERR : RO ;bitpos:[19:16] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY_PURPOSE_6_ERR 0x0000000F +#define EFUSE_RD_KEY_PURPOSE_6_ERR_M ((EFUSE_RD_KEY_PURPOSE_6_ERR_V)<<(EFUSE_RD_KEY_PURPOSE_6_ERR_S)) +#define EFUSE_RD_KEY_PURPOSE_6_ERR_V 0xF +#define EFUSE_RD_KEY_PURPOSE_6_ERR_S 16 +/* EFUSE_RD_KEY_PURPOSE_5_ERR : RO ;bitpos:[15:12] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY_PURPOSE_5_ERR 0x0000000F +#define EFUSE_RD_KEY_PURPOSE_5_ERR_M ((EFUSE_RD_KEY_PURPOSE_5_ERR_V)<<(EFUSE_RD_KEY_PURPOSE_5_ERR_S)) +#define EFUSE_RD_KEY_PURPOSE_5_ERR_V 0xF +#define EFUSE_RD_KEY_PURPOSE_5_ERR_S 12 +/* EFUSE_RD_KEY_PURPOSE_4_ERR : RO ;bitpos:[11:8] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY_PURPOSE_4_ERR 0x0000000F +#define EFUSE_RD_KEY_PURPOSE_4_ERR_M ((EFUSE_RD_KEY_PURPOSE_4_ERR_V)<<(EFUSE_RD_KEY_PURPOSE_4_ERR_S)) +#define EFUSE_RD_KEY_PURPOSE_4_ERR_V 0xF +#define EFUSE_RD_KEY_PURPOSE_4_ERR_S 8 +/* EFUSE_RD_KEY_PURPOSE_3_ERR : RO ;bitpos:[7:4] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY_PURPOSE_3_ERR 0x0000000F +#define EFUSE_RD_KEY_PURPOSE_3_ERR_M ((EFUSE_RD_KEY_PURPOSE_3_ERR_V)<<(EFUSE_RD_KEY_PURPOSE_3_ERR_S)) +#define EFUSE_RD_KEY_PURPOSE_3_ERR_V 0xF +#define EFUSE_RD_KEY_PURPOSE_3_ERR_S 4 +/* EFUSE_RD_KEY_PURPOSE_2_ERR : RO ;bitpos:[3:0] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY_PURPOSE_2_ERR 0x0000000F +#define EFUSE_RD_KEY_PURPOSE_2_ERR_M ((EFUSE_RD_KEY_PURPOSE_2_ERR_V)<<(EFUSE_RD_KEY_PURPOSE_2_ERR_S)) +#define EFUSE_RD_KEY_PURPOSE_2_ERR_V 0xF +#define EFUSE_RD_KEY_PURPOSE_2_ERR_S 0 + +#define EFUSE_RD_REPEAT_ERR3_REG (DR_REG_EFUSE_BASE + 0x188) +/* EFUSE_RD_RESERVE_ERR : RO ;bitpos:[31:8] ;default: 24'h0 ; */ +/*description: */ +#define EFUSE_RD_RESERVE_ERR 0x00FFFFFF +#define EFUSE_RD_RESERVE_ERR_M ((EFUSE_RD_RESERVE_ERR_V)<<(EFUSE_RD_RESERVE_ERR_S)) +#define EFUSE_RD_RESERVE_ERR_V 0xFFFFFF +#define EFUSE_RD_RESERVE_ERR_S 8 +/* EFUSE_RD_UART_PRINT_CONTROL : RO ;bitpos:[7:6] ;default: 2'b0 ; */ +/*description: */ +#define EFUSE_RD_UART_PRINT_CONTROL 0x00000003 +#define EFUSE_RD_UART_PRINT_CONTROL_M ((EFUSE_RD_UART_PRINT_CONTROL_V)<<(EFUSE_RD_UART_PRINT_CONTROL_S)) +#define EFUSE_RD_UART_PRINT_CONTROL_V 0x3 +#define EFUSE_RD_UART_PRINT_CONTROL_S 6 +/* EFUSE_RD_ENABLE_SECURITY_DOWNLOAD : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_ENABLE_SECURITY_DOWNLOAD (BIT(5)) +#define EFUSE_RD_ENABLE_SECURITY_DOWNLOAD_M (BIT(5)) +#define EFUSE_RD_ENABLE_SECURITY_DOWNLOAD_V 0x1 +#define EFUSE_RD_ENABLE_SECURITY_DOWNLOAD_S 5 +/* EFUSE_RD_DIS_USB_DOWNLOAD_MODE : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_USB_DOWNLOAD_MODE (BIT(4)) +#define EFUSE_RD_DIS_USB_DOWNLOAD_MODE_M (BIT(4)) +#define EFUSE_RD_DIS_USB_DOWNLOAD_MODE_V 0x1 +#define EFUSE_RD_DIS_USB_DOWNLOAD_MODE_S 4 +/* EFUSE_RD_DIS_TINY_BASIC : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_TINY_BASIC (BIT(3)) +#define EFUSE_RD_DIS_TINY_BASIC_M (BIT(3)) +#define EFUSE_RD_DIS_TINY_BASIC_V 0x1 +#define EFUSE_RD_DIS_TINY_BASIC_S 3 +/* EFUSE_RD_UART_PRINT_CHANNEL : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_UART_PRINT_CHANNEL (BIT(2)) +#define EFUSE_RD_UART_PRINT_CHANNEL_M (BIT(2)) +#define EFUSE_RD_UART_PRINT_CHANNEL_V 0x1 +#define EFUSE_RD_UART_PRINT_CHANNEL_S 2 +/* EFUSE_RD_DIS_LEGACY_SPI_BOOT_ERR : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_LEGACY_SPI_BOOT_ERR (BIT(1)) +#define EFUSE_RD_DIS_LEGACY_SPI_BOOT_ERR_M (BIT(1)) +#define EFUSE_RD_DIS_LEGACY_SPI_BOOT_ERR_V 0x1 +#define EFUSE_RD_DIS_LEGACY_SPI_BOOT_ERR_S 1 +/* EFUSE_RD_DIS_DOWNLOAD_MODE_ERR : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_DIS_DOWNLOAD_MODE_ERR (BIT(0)) +#define EFUSE_RD_DIS_DOWNLOAD_MODE_ERR_M (BIT(0)) +#define EFUSE_RD_DIS_DOWNLOAD_MODE_ERR_V 0x1 +#define EFUSE_RD_DIS_DOWNLOAD_MODE_ERR_S 0 + +#define EFUSE_RD_REPEAT_ERR4_REG (DR_REG_EFUSE_BASE + 0x190) +/* EFUSE_RD_CHIP_VERSION_ERR : RO ;bitpos:[23:0] ;default: 24'h0 ; */ +/*description: */ +#define EFUSE_RD_CHIP_VERSION_ERR 0x00FFFFFF +#define EFUSE_RD_CHIP_VERSION_ERR_M ((EFUSE_RD_CHIP_VERSION_ERR_V)<<(EFUSE_RD_CHIP_VERSION_ERR_S)) +#define EFUSE_RD_CHIP_VERSION_ERR_V 0xFFFFFF +#define EFUSE_RD_CHIP_VERSION_ERR_S 0 + +#define EFUSE_RD_RS_ERR0_REG (DR_REG_EFUSE_BASE + 0x194) +/* EFUSE_RD_KEY4_FAIL : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY4_FAIL (BIT(31)) +#define EFUSE_RD_KEY4_FAIL_M (BIT(31)) +#define EFUSE_RD_KEY4_FAIL_V 0x1 +#define EFUSE_RD_KEY4_FAIL_S 31 +/* EFUSE_RD_KEY4_ERR_NUM : RO ;bitpos:[30:28] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY4_ERR_NUM 0x00000007 +#define EFUSE_RD_KEY4_ERR_NUM_M ((EFUSE_RD_KEY4_ERR_NUM_V)<<(EFUSE_RD_KEY4_ERR_NUM_S)) +#define EFUSE_RD_KEY4_ERR_NUM_V 0x7 +#define EFUSE_RD_KEY4_ERR_NUM_S 28 +/* EFUSE_RD_KEY3_FAIL : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY3_FAIL (BIT(27)) +#define EFUSE_RD_KEY3_FAIL_M (BIT(27)) +#define EFUSE_RD_KEY3_FAIL_V 0x1 +#define EFUSE_RD_KEY3_FAIL_S 27 +/* EFUSE_RD_KEY3_ERR_NUM : RO ;bitpos:[26:24] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY3_ERR_NUM 0x00000007 +#define EFUSE_RD_KEY3_ERR_NUM_M ((EFUSE_RD_KEY3_ERR_NUM_V)<<(EFUSE_RD_KEY3_ERR_NUM_S)) +#define EFUSE_RD_KEY3_ERR_NUM_V 0x7 +#define EFUSE_RD_KEY3_ERR_NUM_S 24 +/* EFUSE_RD_KEY2_FAIL : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY2_FAIL (BIT(23)) +#define EFUSE_RD_KEY2_FAIL_M (BIT(23)) +#define EFUSE_RD_KEY2_FAIL_V 0x1 +#define EFUSE_RD_KEY2_FAIL_S 23 +/* EFUSE_RD_KEY2_ERR_NUM : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY2_ERR_NUM 0x00000007 +#define EFUSE_RD_KEY2_ERR_NUM_M ((EFUSE_RD_KEY2_ERR_NUM_V)<<(EFUSE_RD_KEY2_ERR_NUM_S)) +#define EFUSE_RD_KEY2_ERR_NUM_V 0x7 +#define EFUSE_RD_KEY2_ERR_NUM_S 20 +/* EFUSE_RD_KEY1_FAIL : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY1_FAIL (BIT(19)) +#define EFUSE_RD_KEY1_FAIL_M (BIT(19)) +#define EFUSE_RD_KEY1_FAIL_V 0x1 +#define EFUSE_RD_KEY1_FAIL_S 19 +/* EFUSE_RD_KEY1_ERR_NUM : RO ;bitpos:[18:16] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY1_ERR_NUM 0x00000007 +#define EFUSE_RD_KEY1_ERR_NUM_M ((EFUSE_RD_KEY1_ERR_NUM_V)<<(EFUSE_RD_KEY1_ERR_NUM_S)) +#define EFUSE_RD_KEY1_ERR_NUM_V 0x7 +#define EFUSE_RD_KEY1_ERR_NUM_S 16 +/* EFUSE_RD_KEY0_FAIL : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY0_FAIL (BIT(15)) +#define EFUSE_RD_KEY0_FAIL_M (BIT(15)) +#define EFUSE_RD_KEY0_FAIL_V 0x1 +#define EFUSE_RD_KEY0_FAIL_S 15 +/* EFUSE_RD_KEY0_ERR_NUM : RO ;bitpos:[14:12] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY0_ERR_NUM 0x00000007 +#define EFUSE_RD_KEY0_ERR_NUM_M ((EFUSE_RD_KEY0_ERR_NUM_V)<<(EFUSE_RD_KEY0_ERR_NUM_S)) +#define EFUSE_RD_KEY0_ERR_NUM_V 0x7 +#define EFUSE_RD_KEY0_ERR_NUM_S 12 +/* EFUSE_RD_USR_DATA_FAIL : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_USR_DATA_FAIL (BIT(11)) +#define EFUSE_RD_USR_DATA_FAIL_M (BIT(11)) +#define EFUSE_RD_USR_DATA_FAIL_V 0x1 +#define EFUSE_RD_USR_DATA_FAIL_S 11 +/* EFUSE_RD_USR_DATA_ERR_NUM : RO ;bitpos:[10:8] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_USR_DATA_ERR_NUM 0x00000007 +#define EFUSE_RD_USR_DATA_ERR_NUM_M ((EFUSE_RD_USR_DATA_ERR_NUM_V)<<(EFUSE_RD_USR_DATA_ERR_NUM_S)) +#define EFUSE_RD_USR_DATA_ERR_NUM_V 0x7 +#define EFUSE_RD_USR_DATA_ERR_NUM_S 8 +/* EFUSE_RD_SYS_ERR_FAIL : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_SYS_ERR_FAIL (BIT(7)) +#define EFUSE_RD_SYS_ERR_FAIL_M (BIT(7)) +#define EFUSE_RD_SYS_ERR_FAIL_V 0x1 +#define EFUSE_RD_SYS_ERR_FAIL_S 7 +/* EFUSE_RD_SYS_ERR_NUM : RO ;bitpos:[6:4] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_SYS_ERR_NUM 0x00000007 +#define EFUSE_RD_SYS_ERR_NUM_M ((EFUSE_RD_SYS_ERR_NUM_V)<<(EFUSE_RD_SYS_ERR_NUM_S)) +#define EFUSE_RD_SYS_ERR_NUM_V 0x7 +#define EFUSE_RD_SYS_ERR_NUM_S 4 +/* EFUSE_RD_MAC_SPI_8M_FAIL : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_MAC_SPI_8M_FAIL (BIT(3)) +#define EFUSE_RD_MAC_SPI_8M_FAIL_M (BIT(3)) +#define EFUSE_RD_MAC_SPI_8M_FAIL_V 0x1 +#define EFUSE_RD_MAC_SPI_8M_FAIL_S 3 +/* EFUSE_RD_MAC_SPI_8M_ERR_NUM : RO ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_MAC_SPI_8M_ERR_NUM 0x00000007 +#define EFUSE_RD_MAC_SPI_8M_ERR_NUM_M ((EFUSE_RD_MAC_SPI_8M_ERR_NUM_V)<<(EFUSE_RD_MAC_SPI_8M_ERR_NUM_S)) +#define EFUSE_RD_MAC_SPI_8M_ERR_NUM_V 0x7 +#define EFUSE_RD_MAC_SPI_8M_ERR_NUM_S 0 + +#define EFUSE_RD_RS_ERR1_REG (DR_REG_EFUSE_BASE + 0x198) +/* EFUSE_RD_KEY6_FAIL : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY6_FAIL (BIT(7)) +#define EFUSE_RD_KEY6_FAIL_M (BIT(7)) +#define EFUSE_RD_KEY6_FAIL_V 0x1 +#define EFUSE_RD_KEY6_FAIL_S 7 +/* EFUSE_RD_KEY6_ERR_NUM : RO ;bitpos:[6:4] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY6_ERR_NUM 0x00000007 +#define EFUSE_RD_KEY6_ERR_NUM_M ((EFUSE_RD_KEY6_ERR_NUM_V)<<(EFUSE_RD_KEY6_ERR_NUM_S)) +#define EFUSE_RD_KEY6_ERR_NUM_V 0x7 +#define EFUSE_RD_KEY6_ERR_NUM_S 4 +/* EFUSE_RD_KEY5_FAIL : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY5_FAIL (BIT(3)) +#define EFUSE_RD_KEY5_FAIL_M (BIT(3)) +#define EFUSE_RD_KEY5_FAIL_V 0x1 +#define EFUSE_RD_KEY5_FAIL_S 3 +/* EFUSE_RD_KEY5_ERR_NUM : RO ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_RD_KEY5_ERR_NUM 0x00000007 +#define EFUSE_RD_KEY5_ERR_NUM_M ((EFUSE_RD_KEY5_ERR_NUM_V)<<(EFUSE_RD_KEY5_ERR_NUM_S)) +#define EFUSE_RD_KEY5_ERR_NUM_V 0x7 +#define EFUSE_RD_KEY5_ERR_NUM_S 0 + +#define EFUSE_CLK_REG (DR_REG_EFUSE_BASE + 0x19c) +/* EFUSE_CLK_EN : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_CLK_EN (BIT(16)) +#define EFUSE_CLK_EN_M (BIT(16)) +#define EFUSE_CLK_EN_V 0x1 +#define EFUSE_CLK_EN_S 16 +/* EFUSE_MEM_PD : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_MEM_PD (BIT(0)) +#define EFUSE_MEM_PD_M (BIT(0)) +#define EFUSE_MEM_PD_V 0x1 +#define EFUSE_MEM_PD_S 0 + +#define EFUSE_CONF_REG (DR_REG_EFUSE_BASE + 0x1a0) +/* EFUSE_OP_CODE : R/W ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: */ +#define EFUSE_OP_CODE 0x0000FFFF +#define EFUSE_OP_CODE_M ((EFUSE_OP_CODE_V)<<(EFUSE_OP_CODE_S)) +#define EFUSE_OP_CODE_V 0xFFFF +#define EFUSE_OP_CODE_S 0 + +#define EFUSE_STATUS_REG (DR_REG_EFUSE_BASE + 0x1a4) +/* EFUSE_REPEAT_ERR_CNT : RO ;bitpos:[16:9] ;default: 8'h0 ; */ +/*description: */ +#define EFUSE_REPEAT_ERR_CNT 0x000000FF +#define EFUSE_REPEAT_ERR_CNT_M ((EFUSE_REPEAT_ERR_CNT_V)<<(EFUSE_REPEAT_ERR_CNT_S)) +#define EFUSE_REPEAT_ERR_CNT_V 0xFF +#define EFUSE_REPEAT_ERR_CNT_S 9 +/* EFUSE_OTP_VDDQ_IS_SW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_OTP_VDDQ_IS_SW (BIT(8)) +#define EFUSE_OTP_VDDQ_IS_SW_M (BIT(8)) +#define EFUSE_OTP_VDDQ_IS_SW_V 0x1 +#define EFUSE_OTP_VDDQ_IS_SW_S 8 +/* EFUSE_OTP_PGENB_SW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_OTP_PGENB_SW (BIT(7)) +#define EFUSE_OTP_PGENB_SW_M (BIT(7)) +#define EFUSE_OTP_PGENB_SW_V 0x1 +#define EFUSE_OTP_PGENB_SW_S 7 +/* EFUSE_OTP_CSB_SW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_OTP_CSB_SW (BIT(6)) +#define EFUSE_OTP_CSB_SW_M (BIT(6)) +#define EFUSE_OTP_CSB_SW_V 0x1 +#define EFUSE_OTP_CSB_SW_S 6 +/* EFUSE_OTP_STROBE_SW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_OTP_STROBE_SW (BIT(5)) +#define EFUSE_OTP_STROBE_SW_M (BIT(5)) +#define EFUSE_OTP_STROBE_SW_V 0x1 +#define EFUSE_OTP_STROBE_SW_S 5 +/* EFUSE_OTP_VDDQ_C_SYNC2 : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_OTP_VDDQ_C_SYNC2 (BIT(4)) +#define EFUSE_OTP_VDDQ_C_SYNC2_M (BIT(4)) +#define EFUSE_OTP_VDDQ_C_SYNC2_V 0x1 +#define EFUSE_OTP_VDDQ_C_SYNC2_S 4 +/* EFUSE_OTP_LOAD_SW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_OTP_LOAD_SW (BIT(3)) +#define EFUSE_OTP_LOAD_SW_M (BIT(3)) +#define EFUSE_OTP_LOAD_SW_V 0x1 +#define EFUSE_OTP_LOAD_SW_S 3 +/* EFUSE_STATE : RO ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: */ +#define EFUSE_STATE 0x00000007 +#define EFUSE_STATE_M ((EFUSE_STATE_V)<<(EFUSE_STATE_S)) +#define EFUSE_STATE_V 0x7 +#define EFUSE_STATE_S 0 + +#define EFUSE_CMD_REG (DR_REG_EFUSE_BASE + 0x1a8) +/* EFUSE_BLK_NUM : R/W ;bitpos:[5:2] ;default: 4'b0 ; */ +/*description: */ +#define EFUSE_BLK_NUM 0x0000000F +#define EFUSE_BLK_NUM_M ((EFUSE_BLK_NUM_V)<<(EFUSE_BLK_NUM_S)) +#define EFUSE_BLK_NUM_V 0xF +#define EFUSE_BLK_NUM_S 2 +/* EFUSE_PGM_CMD : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_PGM_CMD (BIT(1)) +#define EFUSE_PGM_CMD_M (BIT(1)) +#define EFUSE_PGM_CMD_V 0x1 +#define EFUSE_PGM_CMD_S 1 +/* EFUSE_READ_CMD : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_READ_CMD (BIT(0)) +#define EFUSE_READ_CMD_M (BIT(0)) +#define EFUSE_READ_CMD_V 0x1 +#define EFUSE_READ_CMD_S 0 + +#define EFUSE_INT_RAW_REG (DR_REG_EFUSE_BASE + 0x1ac) +/* EFUSE_PGM_DONE_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_PGM_DONE_INT_RAW (BIT(1)) +#define EFUSE_PGM_DONE_INT_RAW_M (BIT(1)) +#define EFUSE_PGM_DONE_INT_RAW_V 0x1 +#define EFUSE_PGM_DONE_INT_RAW_S 1 +/* EFUSE_READ_DONE_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_READ_DONE_INT_RAW (BIT(0)) +#define EFUSE_READ_DONE_INT_RAW_M (BIT(0)) +#define EFUSE_READ_DONE_INT_RAW_V 0x1 +#define EFUSE_READ_DONE_INT_RAW_S 0 + +#define EFUSE_INT_ST_REG (DR_REG_EFUSE_BASE + 0x1b0) +/* EFUSE_PGM_DONE_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_PGM_DONE_INT_ST (BIT(1)) +#define EFUSE_PGM_DONE_INT_ST_M (BIT(1)) +#define EFUSE_PGM_DONE_INT_ST_V 0x1 +#define EFUSE_PGM_DONE_INT_ST_S 1 +/* EFUSE_READ_DONE_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_READ_DONE_INT_ST (BIT(0)) +#define EFUSE_READ_DONE_INT_ST_M (BIT(0)) +#define EFUSE_READ_DONE_INT_ST_V 0x1 +#define EFUSE_READ_DONE_INT_ST_S 0 + +#define EFUSE_INT_ENA_REG (DR_REG_EFUSE_BASE + 0x1b4) +/* EFUSE_PGM_DONE_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_PGM_DONE_INT_ENA (BIT(1)) +#define EFUSE_PGM_DONE_INT_ENA_M (BIT(1)) +#define EFUSE_PGM_DONE_INT_ENA_V 0x1 +#define EFUSE_PGM_DONE_INT_ENA_S 1 +/* EFUSE_READ_DONE_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_READ_DONE_INT_ENA (BIT(0)) +#define EFUSE_READ_DONE_INT_ENA_M (BIT(0)) +#define EFUSE_READ_DONE_INT_ENA_V 0x1 +#define EFUSE_READ_DONE_INT_ENA_S 0 + +#define EFUSE_INT_CLR_REG (DR_REG_EFUSE_BASE + 0x1b8) +/* EFUSE_PGM_DONE_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_PGM_DONE_INT_CLR (BIT(1)) +#define EFUSE_PGM_DONE_INT_CLR_M (BIT(1)) +#define EFUSE_PGM_DONE_INT_CLR_V 0x1 +#define EFUSE_PGM_DONE_INT_CLR_S 1 +/* EFUSE_READ_DONE_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_READ_DONE_INT_CLR (BIT(0)) +#define EFUSE_READ_DONE_INT_CLR_M (BIT(0)) +#define EFUSE_READ_DONE_INT_CLR_V 0x1 +#define EFUSE_READ_DONE_INT_CLR_S 0 + +#define EFUSE_DAC_CONF_REG (DR_REG_EFUSE_BASE + 0x1bc) +/* EFUSE_DAC_CLK_PAD_SEL : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define EFUSE_DAC_CLK_PAD_SEL (BIT(8)) +#define EFUSE_DAC_CLK_PAD_SEL_M (BIT(8)) +#define EFUSE_DAC_CLK_PAD_SEL_V 0x1 +#define EFUSE_DAC_CLK_PAD_SEL_S 8 +/* EFUSE_DAC_CLK_DIV : R/W ;bitpos:[7:0] ;default: 8'd40 ; */ +/*description: */ +#define EFUSE_DAC_CLK_DIV 0x000000FF +#define EFUSE_DAC_CLK_DIV_M ((EFUSE_DAC_CLK_DIV_V)<<(EFUSE_DAC_CLK_DIV_S)) +#define EFUSE_DAC_CLK_DIV_V 0xFF +#define EFUSE_DAC_CLK_DIV_S 0 + +#define EFUSE_RD_TIM_CONF_REG (DR_REG_EFUSE_BASE + 0x1c0) +/* EFUSE_READ_INIT_NUM : R/W ;bitpos:[31:24] ;default: 8'h12 ; */ +/*description: */ +#define EFUSE_READ_INIT_NUM 0x000000FF +#define EFUSE_READ_INIT_NUM_M ((EFUSE_READ_INIT_NUM_V)<<(EFUSE_READ_INIT_NUM_S)) +#define EFUSE_READ_INIT_NUM_V 0xFF +#define EFUSE_READ_INIT_NUM_S 24 +/* EFUSE_TSUR_A : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define EFUSE_TSUR_A 0x000000FF +#define EFUSE_TSUR_A_M ((EFUSE_TSUR_A_V)<<(EFUSE_TSUR_A_S)) +#define EFUSE_TSUR_A_V 0xFF +#define EFUSE_TSUR_A_S 16 +/* EFUSE_TRD : R/W ;bitpos:[15:8] ;default: 8'h2 ; */ +/*description: */ +#define EFUSE_TRD 0x000000FF +#define EFUSE_TRD_M ((EFUSE_TRD_V)<<(EFUSE_TRD_S)) +#define EFUSE_TRD_V 0xFF +#define EFUSE_TRD_S 8 +/* EFUSE_THR_A : R/W ;bitpos:[7:0] ;default: 8'h1 ; */ +/*description: */ +#define EFUSE_THR_A 0x000000FF +#define EFUSE_THR_A_M ((EFUSE_THR_A_V)<<(EFUSE_THR_A_S)) +#define EFUSE_THR_A_V 0xFF +#define EFUSE_THR_A_S 0 + +#define EFUSE_WR_TIM_CONF0_REG (DR_REG_EFUSE_BASE + 0x1c4) +/* EFUSE_TPGM : R/W ;bitpos:[31:16] ;default: 16'h190 ; */ +/*description: */ +#define EFUSE_TPGM 0x0000FFFF +#define EFUSE_TPGM_M ((EFUSE_TPGM_V)<<(EFUSE_TPGM_S)) +#define EFUSE_TPGM_V 0xFFFF +#define EFUSE_TPGM_S 16 +/* EFUSE_TPGM_INACTIVE : R/W ;bitpos:[15:8] ;default: 8'h2 ; */ +/*description: */ +#define EFUSE_TPGM_INACTIVE 0x000000FF +#define EFUSE_TPGM_INACTIVE_M ((EFUSE_TPGM_INACTIVE_V)<<(EFUSE_TPGM_INACTIVE_S)) +#define EFUSE_TPGM_INACTIVE_V 0xFF +#define EFUSE_TPGM_INACTIVE_S 8 +/* EFUSE_THP_A : R/W ;bitpos:[7:0] ;default: 8'h1 ; */ +/*description: */ +#define EFUSE_THP_A 0x000000FF +#define EFUSE_THP_A_M ((EFUSE_THP_A_V)<<(EFUSE_THP_A_S)) +#define EFUSE_THP_A_V 0xFF +#define EFUSE_THP_A_S 0 + +#define EFUSE_WR_TIM_CONF1_REG (DR_REG_EFUSE_BASE + 0x1c8) +/* EFUSE_PWR_ON_NUM : R/W ;bitpos:[23:8] ;default: 16'h7000 ; */ +/*description: */ +#define EFUSE_PWR_ON_NUM 0x0000FFFF +#define EFUSE_PWR_ON_NUM_M ((EFUSE_PWR_ON_NUM_V)<<(EFUSE_PWR_ON_NUM_S)) +#define EFUSE_PWR_ON_NUM_V 0xFFFF +#define EFUSE_PWR_ON_NUM_S 8 +/* EFUSE_TSUP_A : R/W ;bitpos:[7:0] ;default: 8'h1 ; */ +/*description: */ +#define EFUSE_TSUP_A 0x000000FF +#define EFUSE_TSUP_A_M ((EFUSE_TSUP_A_V)<<(EFUSE_TSUP_A_S)) +#define EFUSE_TSUP_A_V 0xFF +#define EFUSE_TSUP_A_S 0 + +#define EFUSE_DATE_REG (DR_REG_EFUSE_BASE + 0x1FC) +/* EFUSE_DATE : R/W ;bitpos:[31:0] ;default: 32'h18101600 ; */ +/*description: */ +#define EFUSE_DATE 0xFFFFFFFF +#define EFUSE_DATE_M ((EFUSE_DATE_V)<<(EFUSE_DATE_S)) +#define EFUSE_DATE_V 0xFFFFFFFF +#define EFUSE_DATE_S 0 + +#ifdef __cplusplus +} +#endif + +#endif /*_SOC_EFUSE_REG_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/efuse_struct.h b/components/soc/esp32s2beta/include/soc/efuse_struct.h new file mode 100644 index 0000000000..bde2b54f9d --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/efuse_struct.h @@ -0,0 +1,407 @@ +// Copyright 2017-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_EFUSE_STRUCT_H_ +#define _SOC_EFUSE_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t rd_efuse_wr_dis: 16; + uint32_t rd_efuse_rd_dis: 4; + uint32_t rd_flash_crypt_cnt: 8; + uint32_t reserved28: 4; + }; + uint32_t val; + } blk0_rdata0; + uint32_t blk0_rdata1; /**/ + union { + struct { + uint32_t rd_wifi_mac_crc_high:24; + uint32_t reserved24: 8; + }; + uint32_t val; + } blk0_rdata2; + union { + struct { + uint32_t rd_soft_disable_jtag: 1; + uint32_t rd_chip_ver_dis_bt: 1; + uint32_t rd_chip_ver_32pad: 1; + uint32_t rd_chip_ver_dis_cache: 1; + uint32_t rd_chip_ver_reserve: 13; + uint32_t reserved17: 15; + }; + uint32_t val; + } blk0_rdata3; + union { + struct { + uint32_t rd_ck8m_freq: 8; + uint32_t rd_sdio_drefh: 2; + uint32_t rd_sdio_drefm: 2; + uint32_t rd_sdio_drefl: 2; + uint32_t rd_xpd_sdio: 1; + uint32_t rd_sdio_tieh: 1; + uint32_t rd_sdio_force: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } blk0_rdata4; + union { + struct { + uint32_t rd_spi_pad_config: 20; + uint32_t rd_tsens_dos: 4; + uint32_t rd_reserve_use1: 4; + uint32_t rd_flash_crypt_config: 4; + }; + uint32_t val; + } blk0_rdata5; + union { + struct { + uint32_t rd_coding_scheme: 2; + uint32_t rd_dig_reserve: 1; + uint32_t rd_disable_sdio_host: 1; + uint32_t rd_abs_done_0: 1; + uint32_t rd_abs_done_1: 1; + uint32_t rd_hard_disable_jtag: 1; + uint32_t rd_disable_dl_encrypt: 1; + uint32_t rd_disable_dl_decrypt: 1; + uint32_t rd_disable_dl_cache: 1; + uint32_t rd_key_status: 1; + uint32_t reserved11: 21; + }; + uint32_t val; + } blk0_rdata6; + union { + struct { + uint32_t wr_dis: 16; + uint32_t rd_dis: 4; + uint32_t flash_crypt_cnt: 8; + uint32_t reserved28: 4; + }; + uint32_t val; + } blk0_wdata0; + uint32_t blk0_wdata1; /**/ + union { + struct { + uint32_t wifi_mac_crc_high:24; + uint32_t reserved24: 8; + }; + uint32_t val; + } blk0_wdata2; + union { + struct { + uint32_t soft_disable_jtag: 1; + uint32_t chip_ver_dis_bt: 1; + uint32_t chip_ver_32pad: 1; + uint32_t chip_ver_dis_cache: 1; + uint32_t chip_ver_reserve: 13; + uint32_t reserved17: 15; + }; + uint32_t val; + } blk0_wdata3; + union { + struct { + uint32_t ck8m_freq: 8; + uint32_t sdio_drefh: 2; + uint32_t sdio_drefm: 2; + uint32_t sdio_drefl: 2; + uint32_t xpd_sdio: 1; + uint32_t sdio_tieh: 1; + uint32_t sdio_force: 1; + uint32_t reserved17:15; + }; + uint32_t val; + } blk0_wdata4; + union { + struct { + uint32_t spi_pad_config: 20; + uint32_t tsens_dos: 4; + uint32_t reserve_use1: 4; + uint32_t flash_crypt_config: 4; + }; + uint32_t val; + } blk0_wdata5; + union { + struct { + uint32_t coding_scheme: 2; + uint32_t dig_reserve: 1; + uint32_t disable_sdio_host: 1; + uint32_t abs_done_0: 1; + uint32_t abs_done_1: 1; + uint32_t hard_disable_jtag: 1; + uint32_t disable_dl_encrypt: 1; + uint32_t disable_dl_decrypt: 1; + uint32_t disable_dl_cache: 1; + uint32_t key_status: 1; + uint32_t reserved11: 21; + }; + uint32_t val; + } blk0_wdata6; + uint32_t blk1_rdata0; /**/ + uint32_t blk1_rdata1; /**/ + uint32_t blk1_rdata2; /**/ + uint32_t blk1_rdata3; /**/ + uint32_t blk1_rdata4; /**/ + uint32_t blk1_rdata5; /**/ + uint32_t blk1_rdata6; /**/ + uint32_t blk1_rdata7; /**/ + uint32_t blk2_rdata0; /**/ + uint32_t blk2_rdata1; /**/ + uint32_t blk2_rdata2; /**/ + uint32_t blk2_rdata3; /**/ + uint32_t blk2_rdata4; /**/ + uint32_t blk2_rdata5; /**/ + uint32_t blk2_rdata6; /**/ + uint32_t blk2_rdata7; /**/ + uint32_t blk3_rdata0; /**/ + uint32_t blk3_rdata1; /**/ + uint32_t blk3_rdata2; /**/ + uint32_t blk3_rdata3; /**/ + uint32_t blk3_rdata4; /**/ + uint32_t blk3_rdata5; /**/ + uint32_t blk3_rdata6; /**/ + uint32_t blk3_rdata7; /**/ + uint32_t blk1_wdata0; /**/ + uint32_t blk1_wdata1; /**/ + uint32_t blk1_wdata2; /**/ + uint32_t blk1_wdata3; /**/ + uint32_t blk1_wdata4; /**/ + uint32_t blk1_wdata5; /**/ + uint32_t blk1_wdata6; /**/ + uint32_t blk1_wdata7; /**/ + uint32_t blk2_wdata0; /**/ + uint32_t blk2_wdata1; /**/ + uint32_t blk2_wdata2; /**/ + uint32_t blk2_wdata3; /**/ + uint32_t blk2_wdata4; /**/ + uint32_t blk2_wdata5; /**/ + uint32_t blk2_wdata6; /**/ + uint32_t blk2_wdata7; /**/ + uint32_t blk3_wdata0; /**/ + uint32_t blk3_wdata1; /**/ + uint32_t blk3_wdata2; /**/ + uint32_t blk3_wdata3; /**/ + uint32_t blk3_wdata4; /**/ + uint32_t blk3_wdata5; /**/ + uint32_t blk3_wdata6; /**/ + uint32_t blk3_wdata7; /**/ + union { + struct { + uint32_t reserved0: 16; + uint32_t clk_en: 1; + uint32_t reserved17:15; + }; + uint32_t val; + } clk; + union { + struct { + uint32_t op_code: 16; + uint32_t force_no_wr_rd_dis: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } conf; + uint32_t status; /**/ + union { + struct { + uint32_t read_cmd: 1; + uint32_t pgm_cmd: 1; + uint32_t reserved2: 30; + }; + uint32_t val; + } cmd; + union { + struct { + uint32_t read_done: 1; + uint32_t pgm_done: 1; + uint32_t reserved2: 30; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t read_done: 1; + uint32_t pgm_done: 1; + uint32_t reserved2: 30; + }; + uint32_t val; + } int_st; + union { + struct { + uint32_t read_done: 1; + uint32_t pgm_done: 1; + uint32_t reserved2: 30; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t read_done: 1; + uint32_t pgm_done: 1; + uint32_t reserved2: 30; + }; + uint32_t val; + } int_clr; + union { + struct { + uint32_t dac_clk_div: 8; + uint32_t dac_clk_pad_sel: 1; + uint32_t reserved9: 23; + }; + uint32_t val; + } dac_conf; + union { + struct { + uint32_t dec_warnings:12; + uint32_t reserved12: 20; + }; + uint32_t val; + } dec_status; + union { + struct { + uint32_t thr_a: 8; + uint32_t trd: 8; + uint32_t tsur_a: 8; + uint32_t read_init_num: 8; + }; + uint32_t val; + } rd_tim_conf; + union { + struct { + uint32_t thp_a: 8; + uint32_t tpgm_inactive: 8; + uint32_t tpgm: 16; + }; + uint32_t val; + } wr_tim_conf0; + union { + struct { + uint32_t tsup_a: 8; + uint32_t pwr_on_num:16; + uint32_t reserved24: 8; + }; + uint32_t val; + } wr_tim_conf1; + union { + struct { + uint32_t rd_dis_err: 4; + uint32_t chip_ver_reserve_err:13; + uint32_t ck8m_freq_err: 8; + uint32_t sdio_drefh_err: 2; + uint32_t sdio_drefm_err: 2; + uint32_t sdio_drefl_err: 2; + uint32_t key_status_err: 1; + }; + uint32_t val; + } repeat_err0; + union { + struct { + uint32_t spi_pad_config_err: 20; + uint32_t flash_crypt_config_err: 4; + uint32_t tsens_dos_err: 4; + uint32_t reserve_use1_err: 4; + }; + uint32_t val; + } repeat_err1; + union { + struct { + uint32_t abs_done_0_err: 1; + uint32_t abs_done_1_err: 1; + uint32_t hard_disable_jtag_err: 1; + uint32_t disable_dl_encrypt_err: 1; + uint32_t disable_dl_decrypt_err: 1; + uint32_t disable_dl_cache_err: 1; + uint32_t disable_sdio_host_err: 1; + uint32_t dig_reserve_err: 1; + uint32_t soft_disable_jtag_err: 1; + uint32_t chip_ver_dis_bt_err: 1; + uint32_t chip_ver_32pad_err: 1; + uint32_t chip_ver_dis_cache_err: 1; + uint32_t xpd_sdio_err: 1; + uint32_t sdio_tieh_err: 1; + uint32_t sdio_force_err: 1; + uint32_t reserved15: 17; + }; + uint32_t val; + } repeat_err2; + uint32_t repeat_blk1_err0; /**/ + uint32_t repeat_blk1_err1; /**/ + uint32_t repeat_blk1_err2; /**/ + uint32_t repeat_blk1_err3; /**/ + uint32_t repeat_blk2_err0; /**/ + uint32_t repeat_blk2_err1; /**/ + uint32_t repeat_blk2_err2; /**/ + uint32_t repeat_blk2_err3; /**/ + uint32_t repeat_blk3_err0; /**/ + uint32_t repeat_blk3_err1; /**/ + uint32_t repeat_blk3_err2; /**/ + uint32_t repeat_blk3_err3; /**/ + union { + struct { + uint32_t rs_errornum_blk1: 4; + uint32_t rs_fail_blk1: 1; + uint32_t rs_errornum_blk2: 4; + uint32_t rs_fail_blk2: 1; + uint32_t rs_errornum_blk3: 4; + uint32_t rs_fail_blk3: 1; + uint32_t reserved15: 17; + }; + uint32_t val; + } rs_state; + uint32_t reserved_16c; + uint32_t reserved_170; + uint32_t reserved_174; + uint32_t reserved_178; + uint32_t reserved_17c; + uint32_t reserved_180; + uint32_t reserved_184; + uint32_t reserved_188; + uint32_t reserved_18c; + uint32_t reserved_190; + uint32_t reserved_194; + uint32_t reserved_198; + uint32_t reserved_19c; + uint32_t reserved_1a0; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + uint32_t reserved_1f0; + uint32_t reserved_1f4; + uint32_t reserved_1f8; + uint32_t date; /**/ +} efuse_dev_t; +extern efuse_dev_t EFUSE; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_EFUSE_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/extmem_reg.h b/components/soc/esp32s2beta/include/soc/extmem_reg.h new file mode 100644 index 0000000000..815cde7cc5 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/extmem_reg.h @@ -0,0 +1,1459 @@ +// Copyright 2017-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_EXTMEM_REG_H_ +#define _SOC_EXTMEM_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define DPORT_PRO_DCACHE_CTRL_REG (DR_REG_EXTMEM_BASE + 0x000) +/* DPORT_PRO_DCACHE_UNLOCK_DONE : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_UNLOCK_DONE (BIT(23)) +#define DPORT_PRO_DCACHE_UNLOCK_DONE_M (BIT(23)) +#define DPORT_PRO_DCACHE_UNLOCK_DONE_V 0x1 +#define DPORT_PRO_DCACHE_UNLOCK_DONE_S 23 +/* DPORT_PRO_DCACHE_UNLOCK_ENA : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_UNLOCK_ENA (BIT(22)) +#define DPORT_PRO_DCACHE_UNLOCK_ENA_M (BIT(22)) +#define DPORT_PRO_DCACHE_UNLOCK_ENA_V 0x1 +#define DPORT_PRO_DCACHE_UNLOCK_ENA_S 22 +/* DPORT_PRO_DCACHE_PRELOAD_DONE : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_PRELOAD_DONE (BIT(21)) +#define DPORT_PRO_DCACHE_PRELOAD_DONE_M (BIT(21)) +#define DPORT_PRO_DCACHE_PRELOAD_DONE_V 0x1 +#define DPORT_PRO_DCACHE_PRELOAD_DONE_S 21 +/* DPORT_PRO_DCACHE_PRELOAD_ENA : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_PRELOAD_ENA (BIT(20)) +#define DPORT_PRO_DCACHE_PRELOAD_ENA_M (BIT(20)) +#define DPORT_PRO_DCACHE_PRELOAD_ENA_V 0x1 +#define DPORT_PRO_DCACHE_PRELOAD_ENA_S 20 +/* DPORT_PRO_DCACHE_AUTOLOAD_DONE : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_DONE (BIT(19)) +#define DPORT_PRO_DCACHE_AUTOLOAD_DONE_M (BIT(19)) +#define DPORT_PRO_DCACHE_AUTOLOAD_DONE_V 0x1 +#define DPORT_PRO_DCACHE_AUTOLOAD_DONE_S 19 +/* DPORT_PRO_DCACHE_AUTOLOAD_ENA : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_ENA (BIT(18)) +#define DPORT_PRO_DCACHE_AUTOLOAD_ENA_M (BIT(18)) +#define DPORT_PRO_DCACHE_AUTOLOAD_ENA_V 0x1 +#define DPORT_PRO_DCACHE_AUTOLOAD_ENA_S 18 +/* DPORT_PRO_DCACHE_LOCK1_EN : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_LOCK1_EN (BIT(15)) +#define DPORT_PRO_DCACHE_LOCK1_EN_M (BIT(15)) +#define DPORT_PRO_DCACHE_LOCK1_EN_V 0x1 +#define DPORT_PRO_DCACHE_LOCK1_EN_S 15 +/* DPORT_PRO_DCACHE_LOCK0_EN : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_LOCK0_EN (BIT(14)) +#define DPORT_PRO_DCACHE_LOCK0_EN_M (BIT(14)) +#define DPORT_PRO_DCACHE_LOCK0_EN_V 0x1 +#define DPORT_PRO_DCACHE_LOCK0_EN_S 14 +/* DPORT_PRO_DCACHE_CLEAN_DONE : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_CLEAN_DONE (BIT(13)) +#define DPORT_PRO_DCACHE_CLEAN_DONE_M (BIT(13)) +#define DPORT_PRO_DCACHE_CLEAN_DONE_V 0x1 +#define DPORT_PRO_DCACHE_CLEAN_DONE_S 13 +/* DPORT_PRO_DCACHE_CLEAN_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_CLEAN_ENA (BIT(12)) +#define DPORT_PRO_DCACHE_CLEAN_ENA_M (BIT(12)) +#define DPORT_PRO_DCACHE_CLEAN_ENA_V 0x1 +#define DPORT_PRO_DCACHE_CLEAN_ENA_S 12 +/* DPORT_PRO_DCACHE_FLUSH_DONE : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_FLUSH_DONE (BIT(11)) +#define DPORT_PRO_DCACHE_FLUSH_DONE_M (BIT(11)) +#define DPORT_PRO_DCACHE_FLUSH_DONE_V 0x1 +#define DPORT_PRO_DCACHE_FLUSH_DONE_S 11 +/* DPORT_PRO_DCACHE_FLUSH_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_FLUSH_ENA (BIT(10)) +#define DPORT_PRO_DCACHE_FLUSH_ENA_M (BIT(10)) +#define DPORT_PRO_DCACHE_FLUSH_ENA_V 0x1 +#define DPORT_PRO_DCACHE_FLUSH_ENA_S 10 +/* DPORT_PRO_DCACHE_INVALIDATE_DONE : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_INVALIDATE_DONE (BIT(9)) +#define DPORT_PRO_DCACHE_INVALIDATE_DONE_M (BIT(9)) +#define DPORT_PRO_DCACHE_INVALIDATE_DONE_V 0x1 +#define DPORT_PRO_DCACHE_INVALIDATE_DONE_S 9 +/* DPORT_PRO_DCACHE_INVALIDATE_ENA : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_INVALIDATE_ENA (BIT(8)) +#define DPORT_PRO_DCACHE_INVALIDATE_ENA_M (BIT(8)) +#define DPORT_PRO_DCACHE_INVALIDATE_ENA_V 0x1 +#define DPORT_PRO_DCACHE_INVALIDATE_ENA_S 8 +/* DPORT_PRO_DCACHE_BLOCKSIZE_MODE : R/W ;bitpos:[4:3] ;default: 2'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_BLOCKSIZE_MODE 0x00000003 +#define DPORT_PRO_DCACHE_BLOCKSIZE_MODE_M ((DPORT_PRO_DCACHE_BLOCKSIZE_MODE_V)<<(DPORT_PRO_DCACHE_BLOCKSIZE_MODE_S)) +#define DPORT_PRO_DCACHE_BLOCKSIZE_MODE_V 0x3 +#define DPORT_PRO_DCACHE_BLOCKSIZE_MODE_S 3 +/* DPORT_PRO_DCACHE_SETSIZE_MODE : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_SETSIZE_MODE (BIT(2)) +#define DPORT_PRO_DCACHE_SETSIZE_MODE_M (BIT(2)) +#define DPORT_PRO_DCACHE_SETSIZE_MODE_V 0x1 +#define DPORT_PRO_DCACHE_SETSIZE_MODE_S 2 +/* DPORT_PRO_DCACHE_MODE : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_MODE (BIT(1)) +#define DPORT_PRO_DCACHE_MODE_M (BIT(1)) +#define DPORT_PRO_DCACHE_MODE_V 0x1 +#define DPORT_PRO_DCACHE_MODE_S 1 +/* DPORT_PRO_DCACHE_ENABLE : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_ENABLE (BIT(0)) +#define DPORT_PRO_DCACHE_ENABLE_M (BIT(0)) +#define DPORT_PRO_DCACHE_ENABLE_V 0x1 +#define DPORT_PRO_DCACHE_ENABLE_S 0 + +#define DPORT_PRO_DCACHE_CTRL1_REG (DR_REG_EXTMEM_BASE + 0x004) +/* DPORT_PRO_DCACHE_MASK_BUS3 : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_MASK_BUS3 (BIT(3)) +#define DPORT_PRO_DCACHE_MASK_BUS3_M (BIT(3)) +#define DPORT_PRO_DCACHE_MASK_BUS3_V 0x1 +#define DPORT_PRO_DCACHE_MASK_BUS3_S 3 +/* DPORT_PRO_DCACHE_MASK_BUS2 : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_MASK_BUS2 (BIT(2)) +#define DPORT_PRO_DCACHE_MASK_BUS2_M (BIT(2)) +#define DPORT_PRO_DCACHE_MASK_BUS2_V 0x1 +#define DPORT_PRO_DCACHE_MASK_BUS2_S 2 +/* DPORT_PRO_DCACHE_MASK_BUS1 : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_MASK_BUS1 (BIT(1)) +#define DPORT_PRO_DCACHE_MASK_BUS1_M (BIT(1)) +#define DPORT_PRO_DCACHE_MASK_BUS1_V 0x1 +#define DPORT_PRO_DCACHE_MASK_BUS1_S 1 +/* DPORT_PRO_DCACHE_MASK_BUS0 : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_MASK_BUS0 (BIT(0)) +#define DPORT_PRO_DCACHE_MASK_BUS0_M (BIT(0)) +#define DPORT_PRO_DCACHE_MASK_BUS0_V 0x1 +#define DPORT_PRO_DCACHE_MASK_BUS0_S 0 +#define DPORT_PRO_DCACHE_MASK_DRAM0 DPORT_PRO_DCACHE_MASK_BUS0 +#define DPORT_PRO_DCACHE_MASK_DRAM1 DPORT_PRO_DCACHE_MASK_BUS1 +#define DPORT_PRO_DCACHE_MASK_DPORT DPORT_PRO_DCACHE_MASK_BUS2 +#define DPORT_PRO_DCACHE_MASK_DROM0 DPORT_PRO_DCACHE_MASK_BUS3 + +#define DPORT_PRO_DCACHE_TAG_POWER_CTRL_REG (DR_REG_EXTMEM_BASE + 0x008) +/* DPORT_PRO_DCACHE_TAG_MEM_PD : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_TAG_MEM_PD (BIT(1)) +#define DPORT_PRO_DCACHE_TAG_MEM_PD_M (BIT(1)) +#define DPORT_PRO_DCACHE_TAG_MEM_PD_V 0x1 +#define DPORT_PRO_DCACHE_TAG_MEM_PD_S 1 +/* DPORT_PRO_DCACHE_TAG_MEM_FORCE_ON : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_TAG_MEM_FORCE_ON (BIT(0)) +#define DPORT_PRO_DCACHE_TAG_MEM_FORCE_ON_M (BIT(0)) +#define DPORT_PRO_DCACHE_TAG_MEM_FORCE_ON_V 0x1 +#define DPORT_PRO_DCACHE_TAG_MEM_FORCE_ON_S 0 + +#define DPORT_PRO_DCACHE_LOCK0_ADDR_REG (DR_REG_EXTMEM_BASE + 0x00C) +/* DPORT_PRO_DCACHE_LOCK0_ADDR : R/W ;bitpos:[31:0] ;default: 10'h0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_LOCK0_ADDR 0xFFFFFFFF +#define DPORT_PRO_DCACHE_LOCK0_ADDR_M ((DPORT_PRO_DCACHE_LOCK0_ADDR_V)<<(DPORT_PRO_DCACHE_LOCK0_ADDR_S)) +#define DPORT_PRO_DCACHE_LOCK0_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_DCACHE_LOCK0_ADDR_S 0 + +#define DPORT_PRO_DCACHE_LOCK0_SIZE_REG (DR_REG_EXTMEM_BASE + 0x010) +/* DPORT_PRO_DCACHE_LOCK0_SIZE : R/W ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_LOCK0_SIZE 0x0000FFFF +#define DPORT_PRO_DCACHE_LOCK0_SIZE_M ((DPORT_PRO_DCACHE_LOCK0_SIZE_V)<<(DPORT_PRO_DCACHE_LOCK0_SIZE_S)) +#define DPORT_PRO_DCACHE_LOCK0_SIZE_V 0xFFFF +#define DPORT_PRO_DCACHE_LOCK0_SIZE_S 0 + +#define DPORT_PRO_DCACHE_LOCK1_ADDR_REG (DR_REG_EXTMEM_BASE + 0x014) +/* DPORT_PRO_DCACHE_LOCK1_ADDR : R/W ;bitpos:[31:0] ;default: 10'h0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_LOCK1_ADDR 0xFFFFFFFF +#define DPORT_PRO_DCACHE_LOCK1_ADDR_M ((DPORT_PRO_DCACHE_LOCK1_ADDR_V)<<(DPORT_PRO_DCACHE_LOCK1_ADDR_S)) +#define DPORT_PRO_DCACHE_LOCK1_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_DCACHE_LOCK1_ADDR_S 0 + +#define DPORT_PRO_DCACHE_LOCK1_SIZE_REG (DR_REG_EXTMEM_BASE + 0x018) +/* DPORT_PRO_DCACHE_LOCK1_SIZE : R/W ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_LOCK1_SIZE 0x0000FFFF +#define DPORT_PRO_DCACHE_LOCK1_SIZE_M ((DPORT_PRO_DCACHE_LOCK1_SIZE_V)<<(DPORT_PRO_DCACHE_LOCK1_SIZE_S)) +#define DPORT_PRO_DCACHE_LOCK1_SIZE_V 0xFFFF +#define DPORT_PRO_DCACHE_LOCK1_SIZE_S 0 + +#define DPORT_PRO_DCACHE_MEM_SYNC0_REG (DR_REG_EXTMEM_BASE + 0x01C) +/* DPORT_PRO_DCACHE_MEMSYNC_ADDR : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_MEMSYNC_ADDR 0xFFFFFFFF +#define DPORT_PRO_DCACHE_MEMSYNC_ADDR_M ((DPORT_PRO_DCACHE_MEMSYNC_ADDR_V)<<(DPORT_PRO_DCACHE_MEMSYNC_ADDR_S)) +#define DPORT_PRO_DCACHE_MEMSYNC_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_DCACHE_MEMSYNC_ADDR_S 0 + +#define DPORT_PRO_DCACHE_MEM_SYNC1_REG (DR_REG_EXTMEM_BASE + 0x020) +/* DPORT_PRO_DCACHE_MEMSYNC_SIZE : R/W ;bitpos:[22:0] ;default: 23'h400000 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_MEMSYNC_SIZE 0x007FFFFF +#define DPORT_PRO_DCACHE_MEMSYNC_SIZE_M ((DPORT_PRO_DCACHE_MEMSYNC_SIZE_V)<<(DPORT_PRO_DCACHE_MEMSYNC_SIZE_S)) +#define DPORT_PRO_DCACHE_MEMSYNC_SIZE_V 0x7FFFFF +#define DPORT_PRO_DCACHE_MEMSYNC_SIZE_S 0 + +#define DPORT_PRO_DCACHE_PRELOAD_ADDR_REG (DR_REG_EXTMEM_BASE + 0x024) +/* DPORT_PRO_DCACHE_PRELOAD_ADDR : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_PRELOAD_ADDR 0xFFFFFFFF +#define DPORT_PRO_DCACHE_PRELOAD_ADDR_M ((DPORT_PRO_DCACHE_PRELOAD_ADDR_V)<<(DPORT_PRO_DCACHE_PRELOAD_ADDR_S)) +#define DPORT_PRO_DCACHE_PRELOAD_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_DCACHE_PRELOAD_ADDR_S 0 + +#define DPORT_PRO_DCACHE_PRELOAD_SIZE_REG (DR_REG_EXTMEM_BASE + 0x028) +/* DPORT_PRO_DCACHE_PRELOAD_ORDER : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_PRELOAD_ORDER (BIT(16)) +#define DPORT_PRO_DCACHE_PRELOAD_ORDER_M (BIT(16)) +#define DPORT_PRO_DCACHE_PRELOAD_ORDER_V 0x1 +#define DPORT_PRO_DCACHE_PRELOAD_ORDER_S 16 +/* DPORT_PRO_DCACHE_PRELOAD_SIZE : R/W ;bitpos:[15:0] ;default: 16'h8000 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_PRELOAD_SIZE 0x0000FFFF +#define DPORT_PRO_DCACHE_PRELOAD_SIZE_M ((DPORT_PRO_DCACHE_PRELOAD_SIZE_V)<<(DPORT_PRO_DCACHE_PRELOAD_SIZE_S)) +#define DPORT_PRO_DCACHE_PRELOAD_SIZE_V 0xFFFF +#define DPORT_PRO_DCACHE_PRELOAD_SIZE_S 0 + +#define DPORT_PRO_DCACHE_AUTOLOAD_CFG_REG (DR_REG_EXTMEM_BASE + 0x02C) +/* DPORT_PRO_DCACHE_AUTOLOAD_SIZE : R/W ;bitpos:[21:6] ;default: 16'h1 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_SIZE 0x0000FFFF +#define DPORT_PRO_DCACHE_AUTOLOAD_SIZE_M ((DPORT_PRO_DCACHE_AUTOLOAD_SIZE_V)<<(DPORT_PRO_DCACHE_AUTOLOAD_SIZE_S)) +#define DPORT_PRO_DCACHE_AUTOLOAD_SIZE_V 0xFFFF +#define DPORT_PRO_DCACHE_AUTOLOAD_SIZE_S 6 +/* DPORT_PRO_DCACHE_AUTOLOAD_RQST : R/W ;bitpos:[5:4] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_RQST 0x00000003 +#define DPORT_PRO_DCACHE_AUTOLOAD_RQST_M ((DPORT_PRO_DCACHE_AUTOLOAD_RQST_V)<<(DPORT_PRO_DCACHE_AUTOLOAD_RQST_S)) +#define DPORT_PRO_DCACHE_AUTOLOAD_RQST_V 0x3 +#define DPORT_PRO_DCACHE_AUTOLOAD_RQST_S 4 +/* DPORT_PRO_DCACHE_AUTOLOAD_ORDER : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_ORDER (BIT(3)) +#define DPORT_PRO_DCACHE_AUTOLOAD_ORDER_M (BIT(3)) +#define DPORT_PRO_DCACHE_AUTOLOAD_ORDER_V 0x1 +#define DPORT_PRO_DCACHE_AUTOLOAD_ORDER_S 3 +/* DPORT_PRO_DCACHE_AUTOLOAD_STEP : R/W ;bitpos:[2:1] ;default: 2'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_STEP 0x00000003 +#define DPORT_PRO_DCACHE_AUTOLOAD_STEP_M ((DPORT_PRO_DCACHE_AUTOLOAD_STEP_V)<<(DPORT_PRO_DCACHE_AUTOLOAD_STEP_S)) +#define DPORT_PRO_DCACHE_AUTOLOAD_STEP_V 0x3 +#define DPORT_PRO_DCACHE_AUTOLOAD_STEP_S 1 +/* DPORT_PRO_DCACHE_AUTOLOAD_MODE : R/W ;bitpos:[0] ;default: 1'd0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_MODE (BIT(0)) +#define DPORT_PRO_DCACHE_AUTOLOAD_MODE_M (BIT(0)) +#define DPORT_PRO_DCACHE_AUTOLOAD_MODE_V 0x1 +#define DPORT_PRO_DCACHE_AUTOLOAD_MODE_S 0 + +#define DPORT_PRO_DCACHE_AUTOLOAD_SECTION0_ADDR_REG (DR_REG_EXTMEM_BASE + 0x030) +/* DPORT_PRO_DCACHE_AUTOLOAD_SCT0_ADDR : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT0_ADDR 0xFFFFFFFF +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT0_ADDR_M ((DPORT_PRO_DCACHE_AUTOLOAD_SCT0_ADDR_V)<<(DPORT_PRO_DCACHE_AUTOLOAD_SCT0_ADDR_S)) +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT0_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT0_ADDR_S 0 + +#define DPORT_PRO_DCACHE_AUTOLOAD_SECTION0_SIZE_REG (DR_REG_EXTMEM_BASE + 0x034) +/* DPORT_PRO_DCACHE_AUTOLOAD_SCT0_SIZE : R/W ;bitpos:[23:0] ;default: 24'h8000 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT0_SIZE 0x00FFFFFF +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT0_SIZE_M ((DPORT_PRO_DCACHE_AUTOLOAD_SCT0_SIZE_V)<<(DPORT_PRO_DCACHE_AUTOLOAD_SCT0_SIZE_S)) +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT0_SIZE_V 0xFFFFFF +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT0_SIZE_S 0 + +#define DPORT_PRO_DCACHE_AUTOLOAD_SECTION1_ADDR_REG (DR_REG_EXTMEM_BASE + 0x038) +/* DPORT_PRO_DCACHE_AUTOLOAD_SCT1_ADDR : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT1_ADDR 0xFFFFFFFF +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT1_ADDR_M ((DPORT_PRO_DCACHE_AUTOLOAD_SCT1_ADDR_V)<<(DPORT_PRO_DCACHE_AUTOLOAD_SCT1_ADDR_S)) +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT1_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT1_ADDR_S 0 + +#define DPORT_PRO_DCACHE_AUTOLOAD_SECTION1_SIZE_REG (DR_REG_EXTMEM_BASE + 0x03C) +/* DPORT_PRO_DCACHE_AUTOLOAD_SCT1_SIZE : R/W ;bitpos:[23:0] ;default: 24'h8000 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT1_SIZE 0x00FFFFFF +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT1_SIZE_M ((DPORT_PRO_DCACHE_AUTOLOAD_SCT1_SIZE_V)<<(DPORT_PRO_DCACHE_AUTOLOAD_SCT1_SIZE_S)) +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT1_SIZE_V 0xFFFFFF +#define DPORT_PRO_DCACHE_AUTOLOAD_SCT1_SIZE_S 0 + +#define DPORT_PRO_ICACHE_CTRL_REG (DR_REG_EXTMEM_BASE + 0x040) +/* DPORT_PRO_ICACHE_UNLOCK_DONE : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_UNLOCK_DONE (BIT(23)) +#define DPORT_PRO_ICACHE_UNLOCK_DONE_M (BIT(23)) +#define DPORT_PRO_ICACHE_UNLOCK_DONE_V 0x1 +#define DPORT_PRO_ICACHE_UNLOCK_DONE_S 23 +/* DPORT_PRO_ICACHE_UNLOCK_ENA : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_UNLOCK_ENA (BIT(22)) +#define DPORT_PRO_ICACHE_UNLOCK_ENA_M (BIT(22)) +#define DPORT_PRO_ICACHE_UNLOCK_ENA_V 0x1 +#define DPORT_PRO_ICACHE_UNLOCK_ENA_S 22 +/* DPORT_PRO_ICACHE_PRELOAD_DONE : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_PRELOAD_DONE (BIT(21)) +#define DPORT_PRO_ICACHE_PRELOAD_DONE_M (BIT(21)) +#define DPORT_PRO_ICACHE_PRELOAD_DONE_V 0x1 +#define DPORT_PRO_ICACHE_PRELOAD_DONE_S 21 +/* DPORT_PRO_ICACHE_PRELOAD_ENA : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_PRELOAD_ENA (BIT(20)) +#define DPORT_PRO_ICACHE_PRELOAD_ENA_M (BIT(20)) +#define DPORT_PRO_ICACHE_PRELOAD_ENA_V 0x1 +#define DPORT_PRO_ICACHE_PRELOAD_ENA_S 20 +/* DPORT_PRO_ICACHE_AUTOLOAD_DONE : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_DONE (BIT(19)) +#define DPORT_PRO_ICACHE_AUTOLOAD_DONE_M (BIT(19)) +#define DPORT_PRO_ICACHE_AUTOLOAD_DONE_V 0x1 +#define DPORT_PRO_ICACHE_AUTOLOAD_DONE_S 19 +/* DPORT_PRO_ICACHE_AUTOLOAD_ENA : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_ENA (BIT(18)) +#define DPORT_PRO_ICACHE_AUTOLOAD_ENA_M (BIT(18)) +#define DPORT_PRO_ICACHE_AUTOLOAD_ENA_V 0x1 +#define DPORT_PRO_ICACHE_AUTOLOAD_ENA_S 18 +/* DPORT_PRO_ICACHE_LOCK1_EN : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_LOCK1_EN (BIT(15)) +#define DPORT_PRO_ICACHE_LOCK1_EN_M (BIT(15)) +#define DPORT_PRO_ICACHE_LOCK1_EN_V 0x1 +#define DPORT_PRO_ICACHE_LOCK1_EN_S 15 +/* DPORT_PRO_ICACHE_LOCK0_EN : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_LOCK0_EN (BIT(14)) +#define DPORT_PRO_ICACHE_LOCK0_EN_M (BIT(14)) +#define DPORT_PRO_ICACHE_LOCK0_EN_V 0x1 +#define DPORT_PRO_ICACHE_LOCK0_EN_S 14 +/* DPORT_PRO_ICACHE_INVALIDATE_DONE : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_INVALIDATE_DONE (BIT(9)) +#define DPORT_PRO_ICACHE_INVALIDATE_DONE_M (BIT(9)) +#define DPORT_PRO_ICACHE_INVALIDATE_DONE_V 0x1 +#define DPORT_PRO_ICACHE_INVALIDATE_DONE_S 9 +/* DPORT_PRO_ICACHE_INVALIDATE_ENA : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_INVALIDATE_ENA (BIT(8)) +#define DPORT_PRO_ICACHE_INVALIDATE_ENA_M (BIT(8)) +#define DPORT_PRO_ICACHE_INVALIDATE_ENA_V 0x1 +#define DPORT_PRO_ICACHE_INVALIDATE_ENA_S 8 +/* DPORT_PRO_ICACHE_BLOCKSIZE_MODE : R/W ;bitpos:[4:3] ;default: 2'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_BLOCKSIZE_MODE 0x00000003 +#define DPORT_PRO_ICACHE_BLOCKSIZE_MODE_M ((DPORT_PRO_ICACHE_BLOCKSIZE_MODE_V)<<(DPORT_PRO_ICACHE_BLOCKSIZE_MODE_S)) +#define DPORT_PRO_ICACHE_BLOCKSIZE_MODE_V 0x3 +#define DPORT_PRO_ICACHE_BLOCKSIZE_MODE_S 3 +/* DPORT_PRO_ICACHE_SETSIZE_MODE : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_SETSIZE_MODE (BIT(2)) +#define DPORT_PRO_ICACHE_SETSIZE_MODE_M (BIT(2)) +#define DPORT_PRO_ICACHE_SETSIZE_MODE_V 0x1 +#define DPORT_PRO_ICACHE_SETSIZE_MODE_S 2 +/* DPORT_PRO_ICACHE_MODE : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_MODE (BIT(1)) +#define DPORT_PRO_ICACHE_MODE_M (BIT(1)) +#define DPORT_PRO_ICACHE_MODE_V 0x1 +#define DPORT_PRO_ICACHE_MODE_S 1 +/* DPORT_PRO_ICACHE_ENABLE : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_ENABLE (BIT(0)) +#define DPORT_PRO_ICACHE_ENABLE_M (BIT(0)) +#define DPORT_PRO_ICACHE_ENABLE_V 0x1 +#define DPORT_PRO_ICACHE_ENABLE_S 0 + +#define DPORT_PRO_ICACHE_CTRL1_REG (DR_REG_EXTMEM_BASE + 0x044) +/* DPORT_PRO_ICACHE_MASK_BUS3 : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_MASK_BUS3 (BIT(3)) +#define DPORT_PRO_ICACHE_MASK_BUS3_M (BIT(3)) +#define DPORT_PRO_ICACHE_MASK_BUS3_V 0x1 +#define DPORT_PRO_ICACHE_MASK_BUS3_S 3 +/* DPORT_PRO_ICACHE_MASK_BUS2 : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_MASK_BUS2 (BIT(2)) +#define DPORT_PRO_ICACHE_MASK_BUS2_M (BIT(2)) +#define DPORT_PRO_ICACHE_MASK_BUS2_V 0x1 +#define DPORT_PRO_ICACHE_MASK_BUS2_S 2 +/* DPORT_PRO_ICACHE_MASK_BUS1 : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_MASK_BUS1 (BIT(1)) +#define DPORT_PRO_ICACHE_MASK_BUS1_M (BIT(1)) +#define DPORT_PRO_ICACHE_MASK_BUS1_V 0x1 +#define DPORT_PRO_ICACHE_MASK_BUS1_S 1 +/* DPORT_PRO_ICACHE_MASK_BUS0 : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_MASK_BUS0 (BIT(0)) +#define DPORT_PRO_ICACHE_MASK_BUS0_M (BIT(0)) +#define DPORT_PRO_ICACHE_MASK_BUS0_V 0x1 +#define DPORT_PRO_ICACHE_MASK_BUS0_S 0 +#define DPORT_PRO_ICACHE_MASK_IRAM0 DPORT_PRO_ICACHE_MASK_BUS0 +#define DPORT_PRO_ICACHE_MASK_IRAM1 DPORT_PRO_ICACHE_MASK_BUS1 +#define DPORT_PRO_ICACHE_MASK_IROM0 DPORT_PRO_ICACHE_MASK_BUS2 +#define DPORT_PRO_ICACHE_MASK_DROM0 DPORT_PRO_ICACHE_MASK_BUS3 + +#define DPORT_PRO_ICACHE_TAG_POWER_CTRL_REG (DR_REG_EXTMEM_BASE + 0x048) +/* DPORT_PRO_ICACHE_TAG_MEM_PD : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_TAG_MEM_PD (BIT(1)) +#define DPORT_PRO_ICACHE_TAG_MEM_PD_M (BIT(1)) +#define DPORT_PRO_ICACHE_TAG_MEM_PD_V 0x1 +#define DPORT_PRO_ICACHE_TAG_MEM_PD_S 1 +/* DPORT_PRO_ICACHE_TAG_MEM_FORCE_ON : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_TAG_MEM_FORCE_ON (BIT(0)) +#define DPORT_PRO_ICACHE_TAG_MEM_FORCE_ON_M (BIT(0)) +#define DPORT_PRO_ICACHE_TAG_MEM_FORCE_ON_V 0x1 +#define DPORT_PRO_ICACHE_TAG_MEM_FORCE_ON_S 0 + +#define DPORT_PRO_ICACHE_LOCK0_ADDR_REG (DR_REG_EXTMEM_BASE + 0x04C) +/* DPORT_PRO_ICACHE_LOCK0_ADDR : R/W ;bitpos:[31:0] ;default: 10'h0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_LOCK0_ADDR 0xFFFFFFFF +#define DPORT_PRO_ICACHE_LOCK0_ADDR_M ((DPORT_PRO_ICACHE_LOCK0_ADDR_V)<<(DPORT_PRO_ICACHE_LOCK0_ADDR_S)) +#define DPORT_PRO_ICACHE_LOCK0_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_ICACHE_LOCK0_ADDR_S 0 + +#define DPORT_PRO_ICACHE_LOCK0_SIZE_REG (DR_REG_EXTMEM_BASE + 0x050) +/* DPORT_PRO_ICACHE_LOCK0_SIZE : R/W ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_LOCK0_SIZE 0x0000FFFF +#define DPORT_PRO_ICACHE_LOCK0_SIZE_M ((DPORT_PRO_ICACHE_LOCK0_SIZE_V)<<(DPORT_PRO_ICACHE_LOCK0_SIZE_S)) +#define DPORT_PRO_ICACHE_LOCK0_SIZE_V 0xFFFF +#define DPORT_PRO_ICACHE_LOCK0_SIZE_S 0 + +#define DPORT_PRO_ICACHE_LOCK1_ADDR_REG (DR_REG_EXTMEM_BASE + 0x054) +/* DPORT_PRO_ICACHE_LOCK1_ADDR : R/W ;bitpos:[31:0] ;default: 10'h0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_LOCK1_ADDR 0xFFFFFFFF +#define DPORT_PRO_ICACHE_LOCK1_ADDR_M ((DPORT_PRO_ICACHE_LOCK1_ADDR_V)<<(DPORT_PRO_ICACHE_LOCK1_ADDR_S)) +#define DPORT_PRO_ICACHE_LOCK1_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_ICACHE_LOCK1_ADDR_S 0 + +#define DPORT_PRO_ICACHE_LOCK1_SIZE_REG (DR_REG_EXTMEM_BASE + 0x058) +/* DPORT_PRO_ICACHE_LOCK1_SIZE : R/W ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_LOCK1_SIZE 0x0000FFFF +#define DPORT_PRO_ICACHE_LOCK1_SIZE_M ((DPORT_PRO_ICACHE_LOCK1_SIZE_V)<<(DPORT_PRO_ICACHE_LOCK1_SIZE_S)) +#define DPORT_PRO_ICACHE_LOCK1_SIZE_V 0xFFFF +#define DPORT_PRO_ICACHE_LOCK1_SIZE_S 0 + +#define DPORT_PRO_ICACHE_MEM_SYNC0_REG (DR_REG_EXTMEM_BASE + 0x05C) +/* DPORT_PRO_ICACHE_MEMSYNC_ADDR : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_MEMSYNC_ADDR 0xFFFFFFFF +#define DPORT_PRO_ICACHE_MEMSYNC_ADDR_M ((DPORT_PRO_ICACHE_MEMSYNC_ADDR_V)<<(DPORT_PRO_ICACHE_MEMSYNC_ADDR_S)) +#define DPORT_PRO_ICACHE_MEMSYNC_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_ICACHE_MEMSYNC_ADDR_S 0 + +#define DPORT_PRO_ICACHE_MEM_SYNC1_REG (DR_REG_EXTMEM_BASE + 0x060) +/* DPORT_PRO_ICACHE_MEMSYNC_SIZE : R/W ;bitpos:[22:0] ;default: 23'h400000 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_MEMSYNC_SIZE 0x007FFFFF +#define DPORT_PRO_ICACHE_MEMSYNC_SIZE_M ((DPORT_PRO_ICACHE_MEMSYNC_SIZE_V)<<(DPORT_PRO_ICACHE_MEMSYNC_SIZE_S)) +#define DPORT_PRO_ICACHE_MEMSYNC_SIZE_V 0x7FFFFF +#define DPORT_PRO_ICACHE_MEMSYNC_SIZE_S 0 + +#define DPORT_PRO_ICACHE_PRELOAD_ADDR_REG (DR_REG_EXTMEM_BASE + 0x064) +/* DPORT_PRO_ICACHE_PRELOAD_ADDR : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_PRELOAD_ADDR 0xFFFFFFFF +#define DPORT_PRO_ICACHE_PRELOAD_ADDR_M ((DPORT_PRO_ICACHE_PRELOAD_ADDR_V)<<(DPORT_PRO_ICACHE_PRELOAD_ADDR_S)) +#define DPORT_PRO_ICACHE_PRELOAD_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_ICACHE_PRELOAD_ADDR_S 0 + +#define DPORT_PRO_ICACHE_PRELOAD_SIZE_REG (DR_REG_EXTMEM_BASE + 0x068) +/* DPORT_PRO_ICACHE_PRELOAD_ORDER : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_PRELOAD_ORDER (BIT(16)) +#define DPORT_PRO_ICACHE_PRELOAD_ORDER_M (BIT(16)) +#define DPORT_PRO_ICACHE_PRELOAD_ORDER_V 0x1 +#define DPORT_PRO_ICACHE_PRELOAD_ORDER_S 16 +/* DPORT_PRO_ICACHE_PRELOAD_SIZE : R/W ;bitpos:[15:0] ;default: 16'h8000 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_PRELOAD_SIZE 0x0000FFFF +#define DPORT_PRO_ICACHE_PRELOAD_SIZE_M ((DPORT_PRO_ICACHE_PRELOAD_SIZE_V)<<(DPORT_PRO_ICACHE_PRELOAD_SIZE_S)) +#define DPORT_PRO_ICACHE_PRELOAD_SIZE_V 0xFFFF +#define DPORT_PRO_ICACHE_PRELOAD_SIZE_S 0 + +#define DPORT_PRO_ICACHE_AUTOLOAD_CFG_REG (DR_REG_EXTMEM_BASE + 0x06C) +/* DPORT_PRO_ICACHE_AUTOLOAD_SIZE : R/W ;bitpos:[21:6] ;default: 16'h1 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_SIZE 0x0000FFFF +#define DPORT_PRO_ICACHE_AUTOLOAD_SIZE_M ((DPORT_PRO_ICACHE_AUTOLOAD_SIZE_V)<<(DPORT_PRO_ICACHE_AUTOLOAD_SIZE_S)) +#define DPORT_PRO_ICACHE_AUTOLOAD_SIZE_V 0xFFFF +#define DPORT_PRO_ICACHE_AUTOLOAD_SIZE_S 6 +/* DPORT_PRO_ICACHE_AUTOLOAD_RQST : R/W ;bitpos:[5:4] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_RQST 0x00000003 +#define DPORT_PRO_ICACHE_AUTOLOAD_RQST_M ((DPORT_PRO_ICACHE_AUTOLOAD_RQST_V)<<(DPORT_PRO_ICACHE_AUTOLOAD_RQST_S)) +#define DPORT_PRO_ICACHE_AUTOLOAD_RQST_V 0x3 +#define DPORT_PRO_ICACHE_AUTOLOAD_RQST_S 4 +/* DPORT_PRO_ICACHE_AUTOLOAD_ORDER : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_ORDER (BIT(3)) +#define DPORT_PRO_ICACHE_AUTOLOAD_ORDER_M (BIT(3)) +#define DPORT_PRO_ICACHE_AUTOLOAD_ORDER_V 0x1 +#define DPORT_PRO_ICACHE_AUTOLOAD_ORDER_S 3 +/* DPORT_PRO_ICACHE_AUTOLOAD_STEP : R/W ;bitpos:[2:1] ;default: 2'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_STEP 0x00000003 +#define DPORT_PRO_ICACHE_AUTOLOAD_STEP_M ((DPORT_PRO_ICACHE_AUTOLOAD_STEP_V)<<(DPORT_PRO_ICACHE_AUTOLOAD_STEP_S)) +#define DPORT_PRO_ICACHE_AUTOLOAD_STEP_V 0x3 +#define DPORT_PRO_ICACHE_AUTOLOAD_STEP_S 1 +/* DPORT_PRO_ICACHE_AUTOLOAD_MODE : R/W ;bitpos:[0] ;default: 1'd0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_MODE (BIT(0)) +#define DPORT_PRO_ICACHE_AUTOLOAD_MODE_M (BIT(0)) +#define DPORT_PRO_ICACHE_AUTOLOAD_MODE_V 0x1 +#define DPORT_PRO_ICACHE_AUTOLOAD_MODE_S 0 + +#define DPORT_PRO_ICACHE_AUTOLOAD_SECTION0_ADDR_REG (DR_REG_EXTMEM_BASE + 0x070) +/* DPORT_PRO_ICACHE_AUTOLOAD_SCT0_ADDR : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT0_ADDR 0xFFFFFFFF +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT0_ADDR_M ((DPORT_PRO_ICACHE_AUTOLOAD_SCT0_ADDR_V)<<(DPORT_PRO_ICACHE_AUTOLOAD_SCT0_ADDR_S)) +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT0_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT0_ADDR_S 0 + +#define DPORT_PRO_ICACHE_AUTOLOAD_SECTION0_SIZE_REG (DR_REG_EXTMEM_BASE + 0x074) +/* DPORT_PRO_ICACHE_AUTOLOAD_SCT0_SIZE : R/W ;bitpos:[23:0] ;default: 24'h8000 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT0_SIZE 0x00FFFFFF +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT0_SIZE_M ((DPORT_PRO_ICACHE_AUTOLOAD_SCT0_SIZE_V)<<(DPORT_PRO_ICACHE_AUTOLOAD_SCT0_SIZE_S)) +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT0_SIZE_V 0xFFFFFF +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT0_SIZE_S 0 + +#define DPORT_PRO_ICACHE_AUTOLOAD_SECTION1_ADDR_REG (DR_REG_EXTMEM_BASE + 0x078) +/* DPORT_PRO_ICACHE_AUTOLOAD_SCT1_ADDR : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT1_ADDR 0xFFFFFFFF +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT1_ADDR_M ((DPORT_PRO_ICACHE_AUTOLOAD_SCT1_ADDR_V)<<(DPORT_PRO_ICACHE_AUTOLOAD_SCT1_ADDR_S)) +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT1_ADDR_V 0xFFFFFFFF +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT1_ADDR_S 0 + +#define DPORT_PRO_ICACHE_AUTOLOAD_SECTION1_SIZE_REG (DR_REG_EXTMEM_BASE + 0x07C) +/* DPORT_PRO_ICACHE_AUTOLOAD_SCT1_SIZE : R/W ;bitpos:[23:0] ;default: 24'h8000 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT1_SIZE 0x00FFFFFF +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT1_SIZE_M ((DPORT_PRO_ICACHE_AUTOLOAD_SCT1_SIZE_V)<<(DPORT_PRO_ICACHE_AUTOLOAD_SCT1_SIZE_S)) +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT1_SIZE_V 0xFFFFFF +#define DPORT_PRO_ICACHE_AUTOLOAD_SCT1_SIZE_S 0 + +#define DPORT_IC_PRELOAD_CNT_REG (DR_REG_EXTMEM_BASE + 0x080) +/* DPORT_IC_PRELOAD_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IC_PRELOAD_CNT 0xFFFFFFFF +#define DPORT_IC_PRELOAD_CNT_M ((DPORT_IC_PRELOAD_CNT_V)<<(DPORT_IC_PRELOAD_CNT_S)) +#define DPORT_IC_PRELOAD_CNT_V 0xFFFFFFFF +#define DPORT_IC_PRELOAD_CNT_S 0 + +#define DPORT_IC_PRELOAD_EVICT_CNT_REG (DR_REG_EXTMEM_BASE + 0x084) +/* DPORT_IC_PRELOAD_EVICT_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IC_PRELOAD_EVICT_CNT 0xFFFFFFFF +#define DPORT_IC_PRELOAD_EVICT_CNT_M ((DPORT_IC_PRELOAD_EVICT_CNT_V)<<(DPORT_IC_PRELOAD_EVICT_CNT_S)) +#define DPORT_IC_PRELOAD_EVICT_CNT_V 0xFFFFFFFF +#define DPORT_IC_PRELOAD_EVICT_CNT_S 0 + +#define DPORT_IC_PRELOAD_MISS_CNT_REG (DR_REG_EXTMEM_BASE + 0x088) +/* DPORT_IC_PRELOAD_MISS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IC_PRELOAD_MISS_CNT 0xFFFFFFFF +#define DPORT_IC_PRELOAD_MISS_CNT_M ((DPORT_IC_PRELOAD_MISS_CNT_V)<<(DPORT_IC_PRELOAD_MISS_CNT_S)) +#define DPORT_IC_PRELOAD_MISS_CNT_V 0xFFFFFFFF +#define DPORT_IC_PRELOAD_MISS_CNT_S 0 + +#define DPORT_IBUS3_ABANDON_CNT_REG (DR_REG_EXTMEM_BASE + 0x08C) +/* DPORT_IBUS3_ABANDON_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS3_ABANDON_CNT 0xFFFFFFFF +#define DPORT_IBUS3_ABANDON_CNT_M ((DPORT_IBUS3_ABANDON_CNT_V)<<(DPORT_IBUS3_ABANDON_CNT_S)) +#define DPORT_IBUS3_ABANDON_CNT_V 0xFFFFFFFF +#define DPORT_IBUS3_ABANDON_CNT_S 0 + +#define DPORT_IBUS2_ABANDON_CNT_REG (DR_REG_EXTMEM_BASE + 0x090) +/* DPORT_IBUS2_ABANDON_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS2_ABANDON_CNT 0xFFFFFFFF +#define DPORT_IBUS2_ABANDON_CNT_M ((DPORT_IBUS2_ABANDON_CNT_V)<<(DPORT_IBUS2_ABANDON_CNT_S)) +#define DPORT_IBUS2_ABANDON_CNT_V 0xFFFFFFFF +#define DPORT_IBUS2_ABANDON_CNT_S 0 + +#define DPORT_IBUS1_ABANDON_CNT_REG (DR_REG_EXTMEM_BASE + 0x094) +/* DPORT_IBUS1_ABANDON_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS1_ABANDON_CNT 0xFFFFFFFF +#define DPORT_IBUS1_ABANDON_CNT_M ((DPORT_IBUS1_ABANDON_CNT_V)<<(DPORT_IBUS1_ABANDON_CNT_S)) +#define DPORT_IBUS1_ABANDON_CNT_V 0xFFFFFFFF +#define DPORT_IBUS1_ABANDON_CNT_S 0 + +#define DPORT_IBUS0_ABANDON_CNT_REG (DR_REG_EXTMEM_BASE + 0x098) +/* DPORT_IBUS0_ABANDON_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS0_ABANDON_CNT 0xFFFFFFFF +#define DPORT_IBUS0_ABANDON_CNT_M ((DPORT_IBUS0_ABANDON_CNT_V)<<(DPORT_IBUS0_ABANDON_CNT_S)) +#define DPORT_IBUS0_ABANDON_CNT_V 0xFFFFFFFF +#define DPORT_IBUS0_ABANDON_CNT_S 0 + +#define DPORT_IBUS3_ACS_MISS_CNT_REG (DR_REG_EXTMEM_BASE + 0x09C) +/* DPORT_IBUS3_ACS_MISS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS3_ACS_MISS_CNT 0xFFFFFFFF +#define DPORT_IBUS3_ACS_MISS_CNT_M ((DPORT_IBUS3_ACS_MISS_CNT_V)<<(DPORT_IBUS3_ACS_MISS_CNT_S)) +#define DPORT_IBUS3_ACS_MISS_CNT_V 0xFFFFFFFF +#define DPORT_IBUS3_ACS_MISS_CNT_S 0 + +#define DPORT_IBUS2_ACS_MISS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0A0) +/* DPORT_IBUS2_ACS_MISS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS2_ACS_MISS_CNT 0xFFFFFFFF +#define DPORT_IBUS2_ACS_MISS_CNT_M ((DPORT_IBUS2_ACS_MISS_CNT_V)<<(DPORT_IBUS2_ACS_MISS_CNT_S)) +#define DPORT_IBUS2_ACS_MISS_CNT_V 0xFFFFFFFF +#define DPORT_IBUS2_ACS_MISS_CNT_S 0 + +#define DPORT_IBUS1_ACS_MISS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0A4) +/* DPORT_IBUS1_ACS_MISS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS1_ACS_MISS_CNT 0xFFFFFFFF +#define DPORT_IBUS1_ACS_MISS_CNT_M ((DPORT_IBUS1_ACS_MISS_CNT_V)<<(DPORT_IBUS1_ACS_MISS_CNT_S)) +#define DPORT_IBUS1_ACS_MISS_CNT_V 0xFFFFFFFF +#define DPORT_IBUS1_ACS_MISS_CNT_S 0 + +#define DPORT_IBUS0_ACS_MISS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0A8) +/* DPORT_IBUS0_ACS_MISS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS0_ACS_MISS_CNT 0xFFFFFFFF +#define DPORT_IBUS0_ACS_MISS_CNT_M ((DPORT_IBUS0_ACS_MISS_CNT_V)<<(DPORT_IBUS0_ACS_MISS_CNT_S)) +#define DPORT_IBUS0_ACS_MISS_CNT_V 0xFFFFFFFF +#define DPORT_IBUS0_ACS_MISS_CNT_S 0 + +#define DPORT_IBUS3_ACS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0AC) +/* DPORT_IBUS3_ACS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS3_ACS_CNT 0xFFFFFFFF +#define DPORT_IBUS3_ACS_CNT_M ((DPORT_IBUS3_ACS_CNT_V)<<(DPORT_IBUS3_ACS_CNT_S)) +#define DPORT_IBUS3_ACS_CNT_V 0xFFFFFFFF +#define DPORT_IBUS3_ACS_CNT_S 0 + +#define DPORT_IBUS2_ACS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0B0) +/* DPORT_IBUS2_ACS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS2_ACS_CNT 0xFFFFFFFF +#define DPORT_IBUS2_ACS_CNT_M ((DPORT_IBUS2_ACS_CNT_V)<<(DPORT_IBUS2_ACS_CNT_S)) +#define DPORT_IBUS2_ACS_CNT_V 0xFFFFFFFF +#define DPORT_IBUS2_ACS_CNT_S 0 + +#define DPORT_IBUS1_ACS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0B4) +/* DPORT_IBUS1_ACS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS1_ACS_CNT 0xFFFFFFFF +#define DPORT_IBUS1_ACS_CNT_M ((DPORT_IBUS1_ACS_CNT_V)<<(DPORT_IBUS1_ACS_CNT_S)) +#define DPORT_IBUS1_ACS_CNT_V 0xFFFFFFFF +#define DPORT_IBUS1_ACS_CNT_S 0 + +#define DPORT_IBUS0_ACS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0B8) +/* DPORT_IBUS0_ACS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_IBUS0_ACS_CNT 0xFFFFFFFF +#define DPORT_IBUS0_ACS_CNT_M ((DPORT_IBUS0_ACS_CNT_V)<<(DPORT_IBUS0_ACS_CNT_S)) +#define DPORT_IBUS0_ACS_CNT_V 0xFFFFFFFF +#define DPORT_IBUS0_ACS_CNT_S 0 + +#define DPORT_DC_PRELOAD_CNT_REG (DR_REG_EXTMEM_BASE + 0x0BC) +/* DPORT_DC_PRELOAD_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DC_PRELOAD_CNT 0xFFFFFFFF +#define DPORT_DC_PRELOAD_CNT_M ((DPORT_DC_PRELOAD_CNT_V)<<(DPORT_DC_PRELOAD_CNT_S)) +#define DPORT_DC_PRELOAD_CNT_V 0xFFFFFFFF +#define DPORT_DC_PRELOAD_CNT_S 0 + +#define DPORT_DC_PRELOAD_EVICT_CNT_REG (DR_REG_EXTMEM_BASE + 0x0C0) +/* DPORT_DC_PRELOAD_EVICT_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DC_PRELOAD_EVICT_CNT 0xFFFFFFFF +#define DPORT_DC_PRELOAD_EVICT_CNT_M ((DPORT_DC_PRELOAD_EVICT_CNT_V)<<(DPORT_DC_PRELOAD_EVICT_CNT_S)) +#define DPORT_DC_PRELOAD_EVICT_CNT_V 0xFFFFFFFF +#define DPORT_DC_PRELOAD_EVICT_CNT_S 0 + +#define DPORT_DC_PRELOAD_MISS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0C4) +/* DPORT_DC_PRELOAD_MISS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DC_PRELOAD_MISS_CNT 0xFFFFFFFF +#define DPORT_DC_PRELOAD_MISS_CNT_M ((DPORT_DC_PRELOAD_MISS_CNT_V)<<(DPORT_DC_PRELOAD_MISS_CNT_S)) +#define DPORT_DC_PRELOAD_MISS_CNT_V 0xFFFFFFFF +#define DPORT_DC_PRELOAD_MISS_CNT_S 0 + +#define DPORT_DBUS3_ABANDON_CNT_REG (DR_REG_EXTMEM_BASE + 0x0C8) +/* DPORT_DBUS3_ABANDON_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS3_ABANDON_CNT 0xFFFFFFFF +#define DPORT_DBUS3_ABANDON_CNT_M ((DPORT_DBUS3_ABANDON_CNT_V)<<(DPORT_DBUS3_ABANDON_CNT_S)) +#define DPORT_DBUS3_ABANDON_CNT_V 0xFFFFFFFF +#define DPORT_DBUS3_ABANDON_CNT_S 0 + +#define DPORT_DBUS2_ABANDON_CNT_REG (DR_REG_EXTMEM_BASE + 0x0CC) +/* DPORT_DBUS2_ABANDON_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS2_ABANDON_CNT 0xFFFFFFFF +#define DPORT_DBUS2_ABANDON_CNT_M ((DPORT_DBUS2_ABANDON_CNT_V)<<(DPORT_DBUS2_ABANDON_CNT_S)) +#define DPORT_DBUS2_ABANDON_CNT_V 0xFFFFFFFF +#define DPORT_DBUS2_ABANDON_CNT_S 0 + +#define DPORT_DBUS1_ABANDON_CNT_REG (DR_REG_EXTMEM_BASE + 0x0D0) +/* DPORT_DBUS1_ABANDON_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS1_ABANDON_CNT 0xFFFFFFFF +#define DPORT_DBUS1_ABANDON_CNT_M ((DPORT_DBUS1_ABANDON_CNT_V)<<(DPORT_DBUS1_ABANDON_CNT_S)) +#define DPORT_DBUS1_ABANDON_CNT_V 0xFFFFFFFF +#define DPORT_DBUS1_ABANDON_CNT_S 0 + +#define DPORT_DBUS0_ABANDON_CNT_REG (DR_REG_EXTMEM_BASE + 0x0D4) +/* DPORT_DBUS0_ABANDON_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS0_ABANDON_CNT 0xFFFFFFFF +#define DPORT_DBUS0_ABANDON_CNT_M ((DPORT_DBUS0_ABANDON_CNT_V)<<(DPORT_DBUS0_ABANDON_CNT_S)) +#define DPORT_DBUS0_ABANDON_CNT_V 0xFFFFFFFF +#define DPORT_DBUS0_ABANDON_CNT_S 0 + +#define DPORT_DBUS3_ACS_WB_CNT_REG (DR_REG_EXTMEM_BASE + 0x0D8) +/* DPORT_DBUS3_ACS_WB_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS3_ACS_WB_CNT 0xFFFFFFFF +#define DPORT_DBUS3_ACS_WB_CNT_M ((DPORT_DBUS3_ACS_WB_CNT_V)<<(DPORT_DBUS3_ACS_WB_CNT_S)) +#define DPORT_DBUS3_ACS_WB_CNT_V 0xFFFFFFFF +#define DPORT_DBUS3_ACS_WB_CNT_S 0 + +#define DPORT_DBUS2_ACS_WB_CNT_REG (DR_REG_EXTMEM_BASE + 0x0DC) +/* DPORT_DBUS2_ACS_WB_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS2_ACS_WB_CNT 0xFFFFFFFF +#define DPORT_DBUS2_ACS_WB_CNT_M ((DPORT_DBUS2_ACS_WB_CNT_V)<<(DPORT_DBUS2_ACS_WB_CNT_S)) +#define DPORT_DBUS2_ACS_WB_CNT_V 0xFFFFFFFF +#define DPORT_DBUS2_ACS_WB_CNT_S 0 + +#define DPORT_DBUS1_ACS_WB_CNT_REG (DR_REG_EXTMEM_BASE + 0x0E0) +/* DPORT_DBUS1_ACS_WB_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS1_ACS_WB_CNT 0xFFFFFFFF +#define DPORT_DBUS1_ACS_WB_CNT_M ((DPORT_DBUS1_ACS_WB_CNT_V)<<(DPORT_DBUS1_ACS_WB_CNT_S)) +#define DPORT_DBUS1_ACS_WB_CNT_V 0xFFFFFFFF +#define DPORT_DBUS1_ACS_WB_CNT_S 0 + +#define DPORT_DBUS0_ACS_WB_CNT_REG (DR_REG_EXTMEM_BASE + 0x0E4) +/* DPORT_DBUS0_ACS_WB_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS0_ACS_WB_CNT 0xFFFFFFFF +#define DPORT_DBUS0_ACS_WB_CNT_M ((DPORT_DBUS0_ACS_WB_CNT_V)<<(DPORT_DBUS0_ACS_WB_CNT_S)) +#define DPORT_DBUS0_ACS_WB_CNT_V 0xFFFFFFFF +#define DPORT_DBUS0_ACS_WB_CNT_S 0 + +#define DPORT_DBUS3_ACS_MISS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0E8) +/* DPORT_DBUS3_ACS_MISS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS3_ACS_MISS_CNT 0xFFFFFFFF +#define DPORT_DBUS3_ACS_MISS_CNT_M ((DPORT_DBUS3_ACS_MISS_CNT_V)<<(DPORT_DBUS3_ACS_MISS_CNT_S)) +#define DPORT_DBUS3_ACS_MISS_CNT_V 0xFFFFFFFF +#define DPORT_DBUS3_ACS_MISS_CNT_S 0 + +#define DPORT_DBUS2_ACS_MISS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0EC) +/* DPORT_DBUS2_ACS_MISS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS2_ACS_MISS_CNT 0xFFFFFFFF +#define DPORT_DBUS2_ACS_MISS_CNT_M ((DPORT_DBUS2_ACS_MISS_CNT_V)<<(DPORT_DBUS2_ACS_MISS_CNT_S)) +#define DPORT_DBUS2_ACS_MISS_CNT_V 0xFFFFFFFF +#define DPORT_DBUS2_ACS_MISS_CNT_S 0 + +#define DPORT_DBUS1_ACS_MISS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0F0) +/* DPORT_DBUS1_ACS_MISS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS1_ACS_MISS_CNT 0xFFFFFFFF +#define DPORT_DBUS1_ACS_MISS_CNT_M ((DPORT_DBUS1_ACS_MISS_CNT_V)<<(DPORT_DBUS1_ACS_MISS_CNT_S)) +#define DPORT_DBUS1_ACS_MISS_CNT_V 0xFFFFFFFF +#define DPORT_DBUS1_ACS_MISS_CNT_S 0 + +#define DPORT_DBUS0_ACS_MISS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0F4) +/* DPORT_DBUS0_ACS_MISS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS0_ACS_MISS_CNT 0xFFFFFFFF +#define DPORT_DBUS0_ACS_MISS_CNT_M ((DPORT_DBUS0_ACS_MISS_CNT_V)<<(DPORT_DBUS0_ACS_MISS_CNT_S)) +#define DPORT_DBUS0_ACS_MISS_CNT_V 0xFFFFFFFF +#define DPORT_DBUS0_ACS_MISS_CNT_S 0 + +#define DPORT_DBUS3_ACS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0F8) +/* DPORT_DBUS3_ACS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS3_ACS_CNT 0xFFFFFFFF +#define DPORT_DBUS3_ACS_CNT_M ((DPORT_DBUS3_ACS_CNT_V)<<(DPORT_DBUS3_ACS_CNT_S)) +#define DPORT_DBUS3_ACS_CNT_V 0xFFFFFFFF +#define DPORT_DBUS3_ACS_CNT_S 0 + +#define DPORT_DBUS2_ACS_CNT_REG (DR_REG_EXTMEM_BASE + 0x0FC) +/* DPORT_DBUS2_ACS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS2_ACS_CNT 0xFFFFFFFF +#define DPORT_DBUS2_ACS_CNT_M ((DPORT_DBUS2_ACS_CNT_V)<<(DPORT_DBUS2_ACS_CNT_S)) +#define DPORT_DBUS2_ACS_CNT_V 0xFFFFFFFF +#define DPORT_DBUS2_ACS_CNT_S 0 + +#define DPORT_DBUS1_ACS_CNT_REG (DR_REG_EXTMEM_BASE + 0x100) +/* DPORT_DBUS1_ACS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS1_ACS_CNT 0xFFFFFFFF +#define DPORT_DBUS1_ACS_CNT_M ((DPORT_DBUS1_ACS_CNT_V)<<(DPORT_DBUS1_ACS_CNT_S)) +#define DPORT_DBUS1_ACS_CNT_V 0xFFFFFFFF +#define DPORT_DBUS1_ACS_CNT_S 0 + +#define DPORT_DBUS0_ACS_CNT_REG (DR_REG_EXTMEM_BASE + 0x104) +/* DPORT_DBUS0_ACS_CNT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_DBUS0_ACS_CNT 0xFFFFFFFF +#define DPORT_DBUS0_ACS_CNT_M ((DPORT_DBUS0_ACS_CNT_V)<<(DPORT_DBUS0_ACS_CNT_S)) +#define DPORT_DBUS0_ACS_CNT_V 0xFFFFFFFF +#define DPORT_DBUS0_ACS_CNT_S 0 + +#define DPORT_PRO_CACHE_IA_INT_EN_REG DPORT_CACHE_DBG_INT_ENA_REG +#define DPORT_PRO_CACHE_INT_CLR DPORT_CACHE_DBG_INT_CLR +#define DPORT_PRO_CACHE_DBG_EN DPORT_CACHE_DBG_EN +#define DPORT_CACHE_DBG_INT_ENA_REG (DR_REG_EXTMEM_BASE + 0x108) +/* DPORT_MMU_ENTRY_FAULT_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_MMU_ENTRY_FAULT_INT_ENA (BIT(13)) +#define DPORT_MMU_ENTRY_FAULT_INT_ENA_M (BIT(13)) +#define DPORT_MMU_ENTRY_FAULT_INT_ENA_V 0x1 +#define DPORT_MMU_ENTRY_FAULT_INT_ENA_S 13 +/* DPORT_DCACHE_REJECT_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DCACHE_REJECT_INT_ENA (BIT(12)) +#define DPORT_DCACHE_REJECT_INT_ENA_M (BIT(12)) +#define DPORT_DCACHE_REJECT_INT_ENA_V 0x1 +#define DPORT_DCACHE_REJECT_INT_ENA_S 12 +/* DPORT_DCACHE_WRITE_FLASH_INT_ENA : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DCACHE_WRITE_FLASH_INT_ENA (BIT(11)) +#define DPORT_DCACHE_WRITE_FLASH_INT_ENA_M (BIT(11)) +#define DPORT_DCACHE_WRITE_FLASH_INT_ENA_V 0x1 +#define DPORT_DCACHE_WRITE_FLASH_INT_ENA_S 11 +/* DPORT_DC_PRELOAD_SIZE_FAULT_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DC_PRELOAD_SIZE_FAULT_INT_ENA (BIT(10)) +#define DPORT_DC_PRELOAD_SIZE_FAULT_INT_ENA_M (BIT(10)) +#define DPORT_DC_PRELOAD_SIZE_FAULT_INT_ENA_V 0x1 +#define DPORT_DC_PRELOAD_SIZE_FAULT_INT_ENA_S 10 +/* DPORT_DC_SYNC_SIZE_FAULT_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DC_SYNC_SIZE_FAULT_INT_ENA (BIT(9)) +#define DPORT_DC_SYNC_SIZE_FAULT_INT_ENA_M (BIT(9)) +#define DPORT_DC_SYNC_SIZE_FAULT_INT_ENA_V 0x1 +#define DPORT_DC_SYNC_SIZE_FAULT_INT_ENA_S 9 +/* DPORT_DBUS_CNT_OVF_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS_CNT_OVF_INT_ENA (BIT(8)) +#define DPORT_DBUS_CNT_OVF_INT_ENA_M (BIT(8)) +#define DPORT_DBUS_CNT_OVF_INT_ENA_V 0x1 +#define DPORT_DBUS_CNT_OVF_INT_ENA_S 8 +/* DPORT_DBUS_ACS_MSK_IC_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS_ACS_MSK_IC_INT_ENA (BIT(7)) +#define DPORT_DBUS_ACS_MSK_IC_INT_ENA_M (BIT(7)) +#define DPORT_DBUS_ACS_MSK_IC_INT_ENA_V 0x1 +#define DPORT_DBUS_ACS_MSK_IC_INT_ENA_S 7 +/* DPORT_ICACHE_REJECT_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_ICACHE_REJECT_INT_ENA (BIT(6)) +#define DPORT_ICACHE_REJECT_INT_ENA_M (BIT(6)) +#define DPORT_ICACHE_REJECT_INT_ENA_V 0x1 +#define DPORT_ICACHE_REJECT_INT_ENA_S 6 +/* DPORT_IC_PRELOAD_SIZE_FAULT_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IC_PRELOAD_SIZE_FAULT_INT_ENA (BIT(5)) +#define DPORT_IC_PRELOAD_SIZE_FAULT_INT_ENA_M (BIT(5)) +#define DPORT_IC_PRELOAD_SIZE_FAULT_INT_ENA_V 0x1 +#define DPORT_IC_PRELOAD_SIZE_FAULT_INT_ENA_S 5 +/* DPORT_IC_SYNC_SIZE_FAULT_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IC_SYNC_SIZE_FAULT_INT_ENA (BIT(4)) +#define DPORT_IC_SYNC_SIZE_FAULT_INT_ENA_M (BIT(4)) +#define DPORT_IC_SYNC_SIZE_FAULT_INT_ENA_V 0x1 +#define DPORT_IC_SYNC_SIZE_FAULT_INT_ENA_S 4 +/* DPORT_IBUS_CNT_OVF_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS_CNT_OVF_INT_ENA (BIT(3)) +#define DPORT_IBUS_CNT_OVF_INT_ENA_M (BIT(3)) +#define DPORT_IBUS_CNT_OVF_INT_ENA_V 0x1 +#define DPORT_IBUS_CNT_OVF_INT_ENA_S 3 +/* DPORT_IBUS_ACS_MSK_IC_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS_ACS_MSK_IC_INT_ENA (BIT(2)) +#define DPORT_IBUS_ACS_MSK_IC_INT_ENA_M (BIT(2)) +#define DPORT_IBUS_ACS_MSK_IC_INT_ENA_V 0x1 +#define DPORT_IBUS_ACS_MSK_IC_INT_ENA_S 2 +/* DPORT_CACHE_DBG_INT_CLR : WOD ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CACHE_DBG_INT_CLR (BIT(1)) +#define DPORT_CACHE_DBG_INT_CLR_M (BIT(1)) +#define DPORT_CACHE_DBG_INT_CLR_V 0x1 +#define DPORT_CACHE_DBG_INT_CLR_S 1 +/* DPORT_CACHE_DBG_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_CACHE_DBG_EN (BIT(0)) +#define DPORT_CACHE_DBG_EN_M (BIT(0)) +#define DPORT_CACHE_DBG_EN_V 0x1 +#define DPORT_CACHE_DBG_EN_S 0 + +#define DPORT_CACHE_DBG_STATUS0_REG (DR_REG_EXTMEM_BASE + 0x10C) +/* DPORT_ICACHE_REJECT_ST : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_ICACHE_REJECT_ST (BIT(21)) +#define DPORT_ICACHE_REJECT_ST_M (BIT(21)) +#define DPORT_ICACHE_REJECT_ST_V 0x1 +#define DPORT_ICACHE_REJECT_ST_S 21 +/* DPORT_IC_PRELOAD_SIZE_FAULT_ST : RO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IC_PRELOAD_SIZE_FAULT_ST (BIT(20)) +#define DPORT_IC_PRELOAD_SIZE_FAULT_ST_M (BIT(20)) +#define DPORT_IC_PRELOAD_SIZE_FAULT_ST_V 0x1 +#define DPORT_IC_PRELOAD_SIZE_FAULT_ST_S 20 +/* DPORT_IC_SYNC_SIZE_FAULT_ST : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IC_SYNC_SIZE_FAULT_ST (BIT(19)) +#define DPORT_IC_SYNC_SIZE_FAULT_ST_M (BIT(19)) +#define DPORT_IC_SYNC_SIZE_FAULT_ST_V 0x1 +#define DPORT_IC_SYNC_SIZE_FAULT_ST_S 19 +/* DPORT_IC_PRELOAD_CNT_OVF_ST : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IC_PRELOAD_CNT_OVF_ST (BIT(18)) +#define DPORT_IC_PRELOAD_CNT_OVF_ST_M (BIT(18)) +#define DPORT_IC_PRELOAD_CNT_OVF_ST_V 0x1 +#define DPORT_IC_PRELOAD_CNT_OVF_ST_S 18 +/* DPORT_IC_PRELOAD_EVICT_CNT_OVF_ST : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IC_PRELOAD_EVICT_CNT_OVF_ST (BIT(17)) +#define DPORT_IC_PRELOAD_EVICT_CNT_OVF_ST_M (BIT(17)) +#define DPORT_IC_PRELOAD_EVICT_CNT_OVF_ST_V 0x1 +#define DPORT_IC_PRELOAD_EVICT_CNT_OVF_ST_S 17 +/* DPORT_IC_PRELOAD_MISS_CNT_OVF_ST : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IC_PRELOAD_MISS_CNT_OVF_ST (BIT(16)) +#define DPORT_IC_PRELOAD_MISS_CNT_OVF_ST_M (BIT(16)) +#define DPORT_IC_PRELOAD_MISS_CNT_OVF_ST_V 0x1 +#define DPORT_IC_PRELOAD_MISS_CNT_OVF_ST_S 16 +/* DPORT_IBUS3_ABANDON_CNT_OVF_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS3_ABANDON_CNT_OVF_ST (BIT(15)) +#define DPORT_IBUS3_ABANDON_CNT_OVF_ST_M (BIT(15)) +#define DPORT_IBUS3_ABANDON_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS3_ABANDON_CNT_OVF_ST_S 15 +/* DPORT_IBUS2_ABANDON_CNT_OVF_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS2_ABANDON_CNT_OVF_ST (BIT(14)) +#define DPORT_IBUS2_ABANDON_CNT_OVF_ST_M (BIT(14)) +#define DPORT_IBUS2_ABANDON_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS2_ABANDON_CNT_OVF_ST_S 14 +/* DPORT_IBUS1_ABANDON_CNT_OVF_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS1_ABANDON_CNT_OVF_ST (BIT(13)) +#define DPORT_IBUS1_ABANDON_CNT_OVF_ST_M (BIT(13)) +#define DPORT_IBUS1_ABANDON_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS1_ABANDON_CNT_OVF_ST_S 13 +/* DPORT_IBUS0_ABANDON_CNT_OVF_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS0_ABANDON_CNT_OVF_ST (BIT(12)) +#define DPORT_IBUS0_ABANDON_CNT_OVF_ST_M (BIT(12)) +#define DPORT_IBUS0_ABANDON_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS0_ABANDON_CNT_OVF_ST_S 12 +/* DPORT_IBUS3_ACS_MISS_CNT_OVF_ST : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS3_ACS_MISS_CNT_OVF_ST (BIT(11)) +#define DPORT_IBUS3_ACS_MISS_CNT_OVF_ST_M (BIT(11)) +#define DPORT_IBUS3_ACS_MISS_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS3_ACS_MISS_CNT_OVF_ST_S 11 +/* DPORT_IBUS2_ACS_MISS_CNT_OVF_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS2_ACS_MISS_CNT_OVF_ST (BIT(10)) +#define DPORT_IBUS2_ACS_MISS_CNT_OVF_ST_M (BIT(10)) +#define DPORT_IBUS2_ACS_MISS_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS2_ACS_MISS_CNT_OVF_ST_S 10 +/* DPORT_IBUS1_ACS_MISS_CNT_OVF_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS1_ACS_MISS_CNT_OVF_ST (BIT(9)) +#define DPORT_IBUS1_ACS_MISS_CNT_OVF_ST_M (BIT(9)) +#define DPORT_IBUS1_ACS_MISS_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS1_ACS_MISS_CNT_OVF_ST_S 9 +/* DPORT_IBUS0_ACS_MISS_CNT_OVF_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS0_ACS_MISS_CNT_OVF_ST (BIT(8)) +#define DPORT_IBUS0_ACS_MISS_CNT_OVF_ST_M (BIT(8)) +#define DPORT_IBUS0_ACS_MISS_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS0_ACS_MISS_CNT_OVF_ST_S 8 +/* DPORT_IBUS3_ACS_CNT_OVF_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS3_ACS_CNT_OVF_ST (BIT(7)) +#define DPORT_IBUS3_ACS_CNT_OVF_ST_M (BIT(7)) +#define DPORT_IBUS3_ACS_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS3_ACS_CNT_OVF_ST_S 7 +/* DPORT_IBUS2_ACS_CNT_OVF_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS2_ACS_CNT_OVF_ST (BIT(6)) +#define DPORT_IBUS2_ACS_CNT_OVF_ST_M (BIT(6)) +#define DPORT_IBUS2_ACS_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS2_ACS_CNT_OVF_ST_S 6 +/* DPORT_IBUS1_ACS_CNT_OVF_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS1_ACS_CNT_OVF_ST (BIT(5)) +#define DPORT_IBUS1_ACS_CNT_OVF_ST_M (BIT(5)) +#define DPORT_IBUS1_ACS_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS1_ACS_CNT_OVF_ST_S 5 +/* DPORT_IBUS0_ACS_CNT_OVF_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS0_ACS_CNT_OVF_ST (BIT(4)) +#define DPORT_IBUS0_ACS_CNT_OVF_ST_M (BIT(4)) +#define DPORT_IBUS0_ACS_CNT_OVF_ST_V 0x1 +#define DPORT_IBUS0_ACS_CNT_OVF_ST_S 4 +/* DPORT_IBUS3_ACS_MSK_ICACHE_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS3_ACS_MSK_ICACHE_ST (BIT(3)) +#define DPORT_IBUS3_ACS_MSK_ICACHE_ST_M (BIT(3)) +#define DPORT_IBUS3_ACS_MSK_ICACHE_ST_V 0x1 +#define DPORT_IBUS3_ACS_MSK_ICACHE_ST_S 3 +/* DPORT_IBUS2_ACS_MSK_ICACHE_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS2_ACS_MSK_ICACHE_ST (BIT(2)) +#define DPORT_IBUS2_ACS_MSK_ICACHE_ST_M (BIT(2)) +#define DPORT_IBUS2_ACS_MSK_ICACHE_ST_V 0x1 +#define DPORT_IBUS2_ACS_MSK_ICACHE_ST_S 2 +/* DPORT_IBUS1_ACS_MSK_ICACHE_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS1_ACS_MSK_ICACHE_ST (BIT(1)) +#define DPORT_IBUS1_ACS_MSK_ICACHE_ST_M (BIT(1)) +#define DPORT_IBUS1_ACS_MSK_ICACHE_ST_V 0x1 +#define DPORT_IBUS1_ACS_MSK_ICACHE_ST_S 1 +/* DPORT_IBUS0_ACS_MSK_ICACHE_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_IBUS0_ACS_MSK_ICACHE_ST (BIT(0)) +#define DPORT_IBUS0_ACS_MSK_ICACHE_ST_M (BIT(0)) +#define DPORT_IBUS0_ACS_MSK_ICACHE_ST_V 0x1 +#define DPORT_IBUS0_ACS_MSK_ICACHE_ST_S 0 + +#define DPORT_CACHE_DBG_STATUS1_REG (DR_REG_EXTMEM_BASE + 0x110) +/* DPORT_MMU_ENTRY_FAULT_ST : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_MMU_ENTRY_FAULT_ST (BIT(27)) +#define DPORT_MMU_ENTRY_FAULT_ST_M (BIT(27)) +#define DPORT_MMU_ENTRY_FAULT_ST_V 0x1 +#define DPORT_MMU_ENTRY_FAULT_ST_S 27 +/* DPORT_DCACHE_REJECT_ST : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DCACHE_REJECT_ST (BIT(26)) +#define DPORT_DCACHE_REJECT_ST_M (BIT(26)) +#define DPORT_DCACHE_REJECT_ST_V 0x1 +#define DPORT_DCACHE_REJECT_ST_S 26 +/* DPORT_DCACHE_WRITE_FLASH_ST : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DCACHE_WRITE_FLASH_ST (BIT(25)) +#define DPORT_DCACHE_WRITE_FLASH_ST_M (BIT(25)) +#define DPORT_DCACHE_WRITE_FLASH_ST_V 0x1 +#define DPORT_DCACHE_WRITE_FLASH_ST_S 25 +/* DPORT_DC_PRELOAD_SIZE_FAULT_ST : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DC_PRELOAD_SIZE_FAULT_ST (BIT(24)) +#define DPORT_DC_PRELOAD_SIZE_FAULT_ST_M (BIT(24)) +#define DPORT_DC_PRELOAD_SIZE_FAULT_ST_V 0x1 +#define DPORT_DC_PRELOAD_SIZE_FAULT_ST_S 24 +/* DPORT_DC_SYNC_SIZE_FAULT_ST : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DC_SYNC_SIZE_FAULT_ST (BIT(23)) +#define DPORT_DC_SYNC_SIZE_FAULT_ST_M (BIT(23)) +#define DPORT_DC_SYNC_SIZE_FAULT_ST_V 0x1 +#define DPORT_DC_SYNC_SIZE_FAULT_ST_S 23 +/* DPORT_DC_PRELOAD_CNT_OVF_ST : RO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DC_PRELOAD_CNT_OVF_ST (BIT(22)) +#define DPORT_DC_PRELOAD_CNT_OVF_ST_M (BIT(22)) +#define DPORT_DC_PRELOAD_CNT_OVF_ST_V 0x1 +#define DPORT_DC_PRELOAD_CNT_OVF_ST_S 22 +/* DPORT_DC_PRELOAD_EVICT_CNT_OVF_ST : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DC_PRELOAD_EVICT_CNT_OVF_ST (BIT(21)) +#define DPORT_DC_PRELOAD_EVICT_CNT_OVF_ST_M (BIT(21)) +#define DPORT_DC_PRELOAD_EVICT_CNT_OVF_ST_V 0x1 +#define DPORT_DC_PRELOAD_EVICT_CNT_OVF_ST_S 21 +/* DPORT_DC_PRELOAD_MISS_CNT_OVF_ST : RO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DC_PRELOAD_MISS_CNT_OVF_ST (BIT(20)) +#define DPORT_DC_PRELOAD_MISS_CNT_OVF_ST_M (BIT(20)) +#define DPORT_DC_PRELOAD_MISS_CNT_OVF_ST_V 0x1 +#define DPORT_DC_PRELOAD_MISS_CNT_OVF_ST_S 20 +/* DPORT_DBUS3_ABANDON_CNT_OVF_ST : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS3_ABANDON_CNT_OVF_ST (BIT(19)) +#define DPORT_DBUS3_ABANDON_CNT_OVF_ST_M (BIT(19)) +#define DPORT_DBUS3_ABANDON_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS3_ABANDON_CNT_OVF_ST_S 19 +/* DPORT_DBUS2_ABANDON_CNT_OVF_ST : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS2_ABANDON_CNT_OVF_ST (BIT(18)) +#define DPORT_DBUS2_ABANDON_CNT_OVF_ST_M (BIT(18)) +#define DPORT_DBUS2_ABANDON_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS2_ABANDON_CNT_OVF_ST_S 18 +/* DPORT_DBUS1_ABANDON_CNT_OVF_ST : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS1_ABANDON_CNT_OVF_ST (BIT(17)) +#define DPORT_DBUS1_ABANDON_CNT_OVF_ST_M (BIT(17)) +#define DPORT_DBUS1_ABANDON_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS1_ABANDON_CNT_OVF_ST_S 17 +/* DPORT_DBUS0_ABANDON_CNT_OVF_ST : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS0_ABANDON_CNT_OVF_ST (BIT(16)) +#define DPORT_DBUS0_ABANDON_CNT_OVF_ST_M (BIT(16)) +#define DPORT_DBUS0_ABANDON_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS0_ABANDON_CNT_OVF_ST_S 16 +/* DPORT_DBUS3_ACS_WB_CNT_OVF_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS3_ACS_WB_CNT_OVF_ST (BIT(15)) +#define DPORT_DBUS3_ACS_WB_CNT_OVF_ST_M (BIT(15)) +#define DPORT_DBUS3_ACS_WB_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS3_ACS_WB_CNT_OVF_ST_S 15 +/* DPORT_DBUS2_ACS_WB_CNT_OVF_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS2_ACS_WB_CNT_OVF_ST (BIT(14)) +#define DPORT_DBUS2_ACS_WB_CNT_OVF_ST_M (BIT(14)) +#define DPORT_DBUS2_ACS_WB_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS2_ACS_WB_CNT_OVF_ST_S 14 +/* DPORT_DBUS1_ACS_WB_CNT_OVF_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS1_ACS_WB_CNT_OVF_ST (BIT(13)) +#define DPORT_DBUS1_ACS_WB_CNT_OVF_ST_M (BIT(13)) +#define DPORT_DBUS1_ACS_WB_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS1_ACS_WB_CNT_OVF_ST_S 13 +/* DPORT_DBUS0_ACS_WB_CNT_OVF_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS0_ACS_WB_CNT_OVF_ST (BIT(12)) +#define DPORT_DBUS0_ACS_WB_CNT_OVF_ST_M (BIT(12)) +#define DPORT_DBUS0_ACS_WB_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS0_ACS_WB_CNT_OVF_ST_S 12 +/* DPORT_DBUS3_ACS_MISS_CNT_OVF_ST : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS3_ACS_MISS_CNT_OVF_ST (BIT(11)) +#define DPORT_DBUS3_ACS_MISS_CNT_OVF_ST_M (BIT(11)) +#define DPORT_DBUS3_ACS_MISS_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS3_ACS_MISS_CNT_OVF_ST_S 11 +/* DPORT_DBUS2_ACS_MISS_CNT_OVF_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS2_ACS_MISS_CNT_OVF_ST (BIT(10)) +#define DPORT_DBUS2_ACS_MISS_CNT_OVF_ST_M (BIT(10)) +#define DPORT_DBUS2_ACS_MISS_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS2_ACS_MISS_CNT_OVF_ST_S 10 +/* DPORT_DBUS1_ACS_MISS_CNT_OVF_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS1_ACS_MISS_CNT_OVF_ST (BIT(9)) +#define DPORT_DBUS1_ACS_MISS_CNT_OVF_ST_M (BIT(9)) +#define DPORT_DBUS1_ACS_MISS_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS1_ACS_MISS_CNT_OVF_ST_S 9 +/* DPORT_DBUS0_ACS_MISS_CNT_OVF_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS0_ACS_MISS_CNT_OVF_ST (BIT(8)) +#define DPORT_DBUS0_ACS_MISS_CNT_OVF_ST_M (BIT(8)) +#define DPORT_DBUS0_ACS_MISS_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS0_ACS_MISS_CNT_OVF_ST_S 8 +/* DPORT_DBUS3_ACS_CNT_OVF_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS3_ACS_CNT_OVF_ST (BIT(7)) +#define DPORT_DBUS3_ACS_CNT_OVF_ST_M (BIT(7)) +#define DPORT_DBUS3_ACS_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS3_ACS_CNT_OVF_ST_S 7 +/* DPORT_DBUS2_ACS_CNT_OVF_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS2_ACS_CNT_OVF_ST (BIT(6)) +#define DPORT_DBUS2_ACS_CNT_OVF_ST_M (BIT(6)) +#define DPORT_DBUS2_ACS_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS2_ACS_CNT_OVF_ST_S 6 +/* DPORT_DBUS1_ACS_CNT_OVF_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS1_ACS_CNT_OVF_ST (BIT(5)) +#define DPORT_DBUS1_ACS_CNT_OVF_ST_M (BIT(5)) +#define DPORT_DBUS1_ACS_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS1_ACS_CNT_OVF_ST_S 5 +/* DPORT_DBUS0_ACS_CNT_OVF_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS0_ACS_CNT_OVF_ST (BIT(4)) +#define DPORT_DBUS0_ACS_CNT_OVF_ST_M (BIT(4)) +#define DPORT_DBUS0_ACS_CNT_OVF_ST_V 0x1 +#define DPORT_DBUS0_ACS_CNT_OVF_ST_S 4 +/* DPORT_DBUS3_ACS_MSK_DCACHE_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS3_ACS_MSK_DCACHE_ST (BIT(3)) +#define DPORT_DBUS3_ACS_MSK_DCACHE_ST_M (BIT(3)) +#define DPORT_DBUS3_ACS_MSK_DCACHE_ST_V 0x1 +#define DPORT_DBUS3_ACS_MSK_DCACHE_ST_S 3 +/* DPORT_DBUS2_ACS_MSK_DCACHE_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS2_ACS_MSK_DCACHE_ST (BIT(2)) +#define DPORT_DBUS2_ACS_MSK_DCACHE_ST_M (BIT(2)) +#define DPORT_DBUS2_ACS_MSK_DCACHE_ST_V 0x1 +#define DPORT_DBUS2_ACS_MSK_DCACHE_ST_S 2 +/* DPORT_DBUS1_ACS_MSK_DCACHE_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS1_ACS_MSK_DCACHE_ST (BIT(1)) +#define DPORT_DBUS1_ACS_MSK_DCACHE_ST_M (BIT(1)) +#define DPORT_DBUS1_ACS_MSK_DCACHE_ST_V 0x1 +#define DPORT_DBUS1_ACS_MSK_DCACHE_ST_S 1 +/* DPORT_DBUS0_ACS_MSK_DCACHE_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_DBUS0_ACS_MSK_DCACHE_ST (BIT(0)) +#define DPORT_DBUS0_ACS_MSK_DCACHE_ST_M (BIT(0)) +#define DPORT_DBUS0_ACS_MSK_DCACHE_ST_V 0x1 +#define DPORT_DBUS0_ACS_MSK_DCACHE_ST_S 0 + +#define DPORT_PRO_CACHE_ACS_CNT_CLR_REG (DR_REG_EXTMEM_BASE + 0x114) +/* DPORT_PRO_ICACHE_ACS_CNT_CLR : WOD ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_ACS_CNT_CLR (BIT(1)) +#define DPORT_PRO_ICACHE_ACS_CNT_CLR_M (BIT(1)) +#define DPORT_PRO_ICACHE_ACS_CNT_CLR_V 0x1 +#define DPORT_PRO_ICACHE_ACS_CNT_CLR_S 1 +/* DPORT_PRO_DCACHE_ACS_CNT_CLR : WOD ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_ACS_CNT_CLR (BIT(0)) +#define DPORT_PRO_DCACHE_ACS_CNT_CLR_M (BIT(0)) +#define DPORT_PRO_DCACHE_ACS_CNT_CLR_V 0x1 +#define DPORT_PRO_DCACHE_ACS_CNT_CLR_S 0 + +#define DPORT_PRO_DCACHE_REJECT_ST_REG (DR_REG_EXTMEM_BASE + 0x118) +/* DPORT_PRO_DCACHE_CPU_ATTR : RO ;bitpos:[5:3] ;default: 3'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_CPU_ATTR 0x00000007 +#define DPORT_PRO_DCACHE_CPU_ATTR_M ((DPORT_PRO_DCACHE_CPU_ATTR_V)<<(DPORT_PRO_DCACHE_CPU_ATTR_S)) +#define DPORT_PRO_DCACHE_CPU_ATTR_V 0x7 +#define DPORT_PRO_DCACHE_CPU_ATTR_S 3 +/* DPORT_PRO_DCACHE_TAG_ATTR : RO ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_TAG_ATTR 0x00000007 +#define DPORT_PRO_DCACHE_TAG_ATTR_M ((DPORT_PRO_DCACHE_TAG_ATTR_V)<<(DPORT_PRO_DCACHE_TAG_ATTR_S)) +#define DPORT_PRO_DCACHE_TAG_ATTR_V 0x7 +#define DPORT_PRO_DCACHE_TAG_ATTR_S 0 + +#define DPORT_PRO_DCACHE_REJECT_VADDR_REG (DR_REG_EXTMEM_BASE + 0x11C) +/* DPORT_PRO_DCACHE_CPU_VADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_CPU_VADDR 0xFFFFFFFF +#define DPORT_PRO_DCACHE_CPU_VADDR_M ((DPORT_PRO_DCACHE_CPU_VADDR_V)<<(DPORT_PRO_DCACHE_CPU_VADDR_S)) +#define DPORT_PRO_DCACHE_CPU_VADDR_V 0xFFFFFFFF +#define DPORT_PRO_DCACHE_CPU_VADDR_S 0 + +#define DPORT_PRO_ICACHE_REJECT_ST_REG (DR_REG_EXTMEM_BASE + 0x120) +/* DPORT_PRO_ICACHE_CPU_ATTR : RO ;bitpos:[5:3] ;default: 3'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_CPU_ATTR 0x00000007 +#define DPORT_PRO_ICACHE_CPU_ATTR_M ((DPORT_PRO_ICACHE_CPU_ATTR_V)<<(DPORT_PRO_ICACHE_CPU_ATTR_S)) +#define DPORT_PRO_ICACHE_CPU_ATTR_V 0x7 +#define DPORT_PRO_ICACHE_CPU_ATTR_S 3 +/* DPORT_PRO_ICACHE_TAG_ATTR : RO ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_TAG_ATTR 0x00000007 +#define DPORT_PRO_ICACHE_TAG_ATTR_M ((DPORT_PRO_ICACHE_TAG_ATTR_V)<<(DPORT_PRO_ICACHE_TAG_ATTR_S)) +#define DPORT_PRO_ICACHE_TAG_ATTR_V 0x7 +#define DPORT_PRO_ICACHE_TAG_ATTR_S 0 + +#define DPORT_PRO_ICACHE_REJECT_VADDR_REG (DR_REG_EXTMEM_BASE + 0x124) +/* DPORT_PRO_ICACHE_CPU_VADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_CPU_VADDR 0xFFFFFFFF +#define DPORT_PRO_ICACHE_CPU_VADDR_M ((DPORT_PRO_ICACHE_CPU_VADDR_V)<<(DPORT_PRO_ICACHE_CPU_VADDR_S)) +#define DPORT_PRO_ICACHE_CPU_VADDR_V 0xFFFFFFFF +#define DPORT_PRO_ICACHE_CPU_VADDR_S 0 + +#define DPORT_PRO_CACHE_MMU_ERROR_CONTENT_REG (DR_REG_EXTMEM_BASE + 0x128) +/* DPORT_PRO_CACHE_MMU_ERROR_CONTENT : RO ;bitpos:[16:0] ;default: 17'h0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_MMU_ERROR_CONTENT 0x0001FFFF +#define DPORT_PRO_CACHE_MMU_ERROR_CONTENT_M ((DPORT_PRO_CACHE_MMU_ERROR_CONTENT_V)<<(DPORT_PRO_CACHE_MMU_ERROR_CONTENT_S)) +#define DPORT_PRO_CACHE_MMU_ERROR_CONTENT_V 0x1FFFF +#define DPORT_PRO_CACHE_MMU_ERROR_CONTENT_S 0 + +#define DPORT_PRO_CACHE_MMU_ERROR_VADDR_REG (DR_REG_EXTMEM_BASE + 0x12C) +/* DPORT_PRO_CACHE_MMU_ERROR_VADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_MMU_ERROR_VADDR 0xFFFFFFFF +#define DPORT_PRO_CACHE_MMU_ERROR_VADDR_M ((DPORT_PRO_CACHE_MMU_ERROR_VADDR_V)<<(DPORT_PRO_CACHE_MMU_ERROR_VADDR_S)) +#define DPORT_PRO_CACHE_MMU_ERROR_VADDR_V 0xFFFFFFFF +#define DPORT_PRO_CACHE_MMU_ERROR_VADDR_S 0 + +#define DPORT_PRO_CACHE_WRAP_AROUND_CTRL_REG (DR_REG_EXTMEM_BASE + 0x130) +/* DPORT_PRO_CACHE_SRAM_RD_WRAP_AROUND : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_SRAM_RD_WRAP_AROUND (BIT(1)) +#define DPORT_PRO_CACHE_SRAM_RD_WRAP_AROUND_M (BIT(1)) +#define DPORT_PRO_CACHE_SRAM_RD_WRAP_AROUND_V 0x1 +#define DPORT_PRO_CACHE_SRAM_RD_WRAP_AROUND_S 1 +/* DPORT_PRO_CACHE_FLASH_WRAP_AROUND : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_FLASH_WRAP_AROUND (BIT(0)) +#define DPORT_PRO_CACHE_FLASH_WRAP_AROUND_M (BIT(0)) +#define DPORT_PRO_CACHE_FLASH_WRAP_AROUND_V 0x1 +#define DPORT_PRO_CACHE_FLASH_WRAP_AROUND_S 0 + +#define DPORT_PRO_CACHE_MMU_POWER_CTRL_REG (DR_REG_EXTMEM_BASE + 0x134) +/* DPORT_PRO_CACHE_MMU_MEM_PD : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_MMU_MEM_PD (BIT(1)) +#define DPORT_PRO_CACHE_MMU_MEM_PD_M (BIT(1)) +#define DPORT_PRO_CACHE_MMU_MEM_PD_V 0x1 +#define DPORT_PRO_CACHE_MMU_MEM_PD_S 1 +/* DPORT_PRO_CACHE_MMU_MEM_FORCE_ON : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_CACHE_MMU_MEM_FORCE_ON (BIT(0)) +#define DPORT_PRO_CACHE_MMU_MEM_FORCE_ON_M (BIT(0)) +#define DPORT_PRO_CACHE_MMU_MEM_FORCE_ON_V 0x1 +#define DPORT_PRO_CACHE_MMU_MEM_FORCE_ON_S 0 + +#define DPORT_PRO_CACHE_STATE_REG (DR_REG_EXTMEM_BASE + 0x138) +/* DPORT_PRO_DCACHE_STATE : RO ;bitpos:[23:12] ;default: 12'h0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_STATE 0x00000FFF +#define DPORT_PRO_DCACHE_STATE_M ((DPORT_PRO_DCACHE_STATE_V)<<(DPORT_PRO_DCACHE_STATE_S)) +#define DPORT_PRO_DCACHE_STATE_V 0xFFF +#define DPORT_PRO_DCACHE_STATE_S 12 +/* DPORT_PRO_ICACHE_STATE : RO ;bitpos:[11:0] ;default: 12'h0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_STATE 0x00000FFF +#define DPORT_PRO_ICACHE_STATE_M ((DPORT_PRO_ICACHE_STATE_V)<<(DPORT_PRO_ICACHE_STATE_S)) +#define DPORT_PRO_ICACHE_STATE_V 0xFFF +#define DPORT_PRO_ICACHE_STATE_S 0 + +#define DPORT_CACHE_ENCRYPT_DECRYPT_RECORD_DISABLE_REG (DR_REG_EXTMEM_BASE + 0x13C) +/* DPORT_RECORD_DISABLE_G0CB_DECRYPT : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_RECORD_DISABLE_G0CB_DECRYPT (BIT(1)) +#define DPORT_RECORD_DISABLE_G0CB_DECRYPT_M (BIT(1)) +#define DPORT_RECORD_DISABLE_G0CB_DECRYPT_V 0x1 +#define DPORT_RECORD_DISABLE_G0CB_DECRYPT_S 1 +/* DPORT_RECORD_DISABLE_DB_ENCRYPT : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_RECORD_DISABLE_DB_ENCRYPT (BIT(0)) +#define DPORT_RECORD_DISABLE_DB_ENCRYPT_M (BIT(0)) +#define DPORT_RECORD_DISABLE_DB_ENCRYPT_V 0x1 +#define DPORT_RECORD_DISABLE_DB_ENCRYPT_S 0 + +#define DPORT_CACHE_ENCRYPT_DECRYPT_CLK_FORCE_ON_REG (DR_REG_EXTMEM_BASE + 0x140) +/* DPORT_CLK_FORCE_ON_AUTOMATIC_ENCRYPT_DECRYPT : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_CLK_FORCE_ON_AUTOMATIC_ENCRYPT_DECRYPT (BIT(2)) +#define DPORT_CLK_FORCE_ON_AUTOMATIC_ENCRYPT_DECRYPT_M (BIT(2)) +#define DPORT_CLK_FORCE_ON_AUTOMATIC_ENCRYPT_DECRYPT_V 0x1 +#define DPORT_CLK_FORCE_ON_AUTOMATIC_ENCRYPT_DECRYPT_S 2 +/* DPORT_CLK_FORCE_ON_G0CB_DECRYPT : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_CLK_FORCE_ON_G0CB_DECRYPT (BIT(1)) +#define DPORT_CLK_FORCE_ON_G0CB_DECRYPT_M (BIT(1)) +#define DPORT_CLK_FORCE_ON_G0CB_DECRYPT_V 0x1 +#define DPORT_CLK_FORCE_ON_G0CB_DECRYPT_S 1 +/* DPORT_CLK_FORCE_ON_DB_ENCRYPT : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_CLK_FORCE_ON_DB_ENCRYPT (BIT(0)) +#define DPORT_CLK_FORCE_ON_DB_ENCRYPT_M (BIT(0)) +#define DPORT_CLK_FORCE_ON_DB_ENCRYPT_V 0x1 +#define DPORT_CLK_FORCE_ON_DB_ENCRYPT_S 0 + +#define DPORT_CACHE_BRIDGE_ARBITER_CTRL_REG (DR_REG_EXTMEM_BASE + 0x144) +/* DPORT_ALLOC_WB_HOLD_ARBITER : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_ALLOC_WB_HOLD_ARBITER (BIT(0)) +#define DPORT_ALLOC_WB_HOLD_ARBITER_M (BIT(0)) +#define DPORT_ALLOC_WB_HOLD_ARBITER_V 0x1 +#define DPORT_ALLOC_WB_HOLD_ARBITER_S 0 + +#define DPORT_CACHE_PRELOAD_INT_CTRL_REG (DR_REG_EXTMEM_BASE + 0x148) +/* DPORT_PRO_DCACHE_PRELOAD_INT_CLR : WOD ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_PRELOAD_INT_CLR (BIT(5)) +#define DPORT_PRO_DCACHE_PRELOAD_INT_CLR_M (BIT(5)) +#define DPORT_PRO_DCACHE_PRELOAD_INT_CLR_V 0x1 +#define DPORT_PRO_DCACHE_PRELOAD_INT_CLR_S 5 +/* DPORT_PRO_DCACHE_PRELOAD_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_PRELOAD_INT_ENA (BIT(4)) +#define DPORT_PRO_DCACHE_PRELOAD_INT_ENA_M (BIT(4)) +#define DPORT_PRO_DCACHE_PRELOAD_INT_ENA_V 0x1 +#define DPORT_PRO_DCACHE_PRELOAD_INT_ENA_S 4 +/* DPORT_PRO_DCACHE_PRELOAD_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_PRELOAD_INT_ST (BIT(3)) +#define DPORT_PRO_DCACHE_PRELOAD_INT_ST_M (BIT(3)) +#define DPORT_PRO_DCACHE_PRELOAD_INT_ST_V 0x1 +#define DPORT_PRO_DCACHE_PRELOAD_INT_ST_S 3 +/* DPORT_PRO_ICACHE_PRELOAD_INT_CLR : WOD ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_PRELOAD_INT_CLR (BIT(2)) +#define DPORT_PRO_ICACHE_PRELOAD_INT_CLR_M (BIT(2)) +#define DPORT_PRO_ICACHE_PRELOAD_INT_CLR_V 0x1 +#define DPORT_PRO_ICACHE_PRELOAD_INT_CLR_S 2 +/* DPORT_PRO_ICACHE_PRELOAD_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_PRELOAD_INT_ENA (BIT(1)) +#define DPORT_PRO_ICACHE_PRELOAD_INT_ENA_M (BIT(1)) +#define DPORT_PRO_ICACHE_PRELOAD_INT_ENA_V 0x1 +#define DPORT_PRO_ICACHE_PRELOAD_INT_ENA_S 1 +/* DPORT_PRO_ICACHE_PRELOAD_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_PRELOAD_INT_ST (BIT(0)) +#define DPORT_PRO_ICACHE_PRELOAD_INT_ST_M (BIT(0)) +#define DPORT_PRO_ICACHE_PRELOAD_INT_ST_V 0x1 +#define DPORT_PRO_ICACHE_PRELOAD_INT_ST_S 0 + +#define EXTMEM_CLOCK_GATE_REG (DR_REG_EXTMEM_BASE + 0x14C) +/* EXTMEM_CLK_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define EXTMEM_CLK_EN (BIT(0)) +#define EXTMEM_CLK_EN_M (BIT(0)) +#define EXTMEM_CLK_EN_V 0x1 +#define EXTMEM_CLK_EN_S 0 + +#define EXTMEM_DATE_REG (DR_REG_EXTMEM_BASE + 0x3FC) +/* EXTMEM_DATE : R/W ;bitpos:[27:0] ;default: 28'h1810250 ; */ +/*description: */ +#define EXTMEM_DATE 0x0FFFFFFF +#define EXTMEM_DATE_M ((EXTMEM_DATE_V)<<(EXTMEM_DATE_S)) +#define EXTMEM_DATE_V 0xFFFFFFF +#define EXTMEM_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_EXTMEM_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/fe_reg.h b/components/soc/esp32s2beta/include/soc/fe_reg.h new file mode 100644 index 0000000000..7705586d7c --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/fe_reg.h @@ -0,0 +1,41 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include "soc/soc.h" + +/* Some of the RF frontend control registers. + * PU/PD fields defined here are used in sleep related functions. + */ + +#define FE_GEN_CTRL (DR_REG_FE_BASE + 0x0090) +#define FE_IQ_EST_FORCE_PU (BIT(5)) +#define FE_IQ_EST_FORCE_PU_M (BIT(5)) +#define FE_IQ_EST_FORCE_PU_V 1 +#define FE_IQ_EST_FORCE_PU_S 5 +#define FE_IQ_EST_FORCE_PD (BIT(4)) +#define FE_IQ_EST_FORCE_PD_M (BIT(4)) +#define FE_IQ_EST_FORCE_PD_V 1 +#define FE_IQ_EST_FORCE_PD_S 4 + +#define FE2_TX_INTERP_CTRL (DR_REG_FE2_BASE + 0x00f0) +#define FE2_TX_INF_FORCE_PU (BIT(10)) +#define FE2_TX_INF_FORCE_PU_M (BIT(10)) +#define FE2_TX_INF_FORCE_PU_V 1 +#define FE2_TX_INF_FORCE_PU_S 10 +#define FE2_TX_INF_FORCE_PD (BIT(9)) +#define FE2_TX_INF_FORCE_PD_M (BIT(9)) +#define FE2_TX_INF_FORCE_PD_V 1 +#define FE2_TX_INF_FORCE_PD_S 9 diff --git a/components/soc/esp32s2beta/include/soc/frc_timer_reg.h b/components/soc/esp32s2beta/include/soc/frc_timer_reg.h new file mode 100644 index 0000000000..a2152c5c91 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/frc_timer_reg.h @@ -0,0 +1,52 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _SOC_FRC_TIMER_REG_H_ +#define _SOC_FRC_TIMER_REG_H_ + +#include "soc.h" + +/** + * These are the register definitions for "legacy" timers + */ + +#define REG_FRC_TIMER_BASE(i) (DR_REG_FRC_TIMER_BASE + i*0x20) + +#define FRC_TIMER_LOAD_REG(i) (REG_FRC_TIMER_BASE(i) + 0x0) // timer load value (23 bit for i==0, 32 bit for i==1) +#define FRC_TIMER_LOAD_VALUE(i) ((i == 0)?0x007FFFFF:0xffffffff) +#define FRC_TIMER_LOAD_VALUE_S 0 + +#define FRC_TIMER_COUNT_REG(i) (REG_FRC_TIMER_BASE(i) + 0x4) // timer count value (23 bit for i==0, 32 bit for i==1) +#define FRC_TIMER_COUNT ((i == 0)?0x007FFFFF:0xffffffff) +#define FRC_TIMER_COUNT_S 0 + +#define FRC_TIMER_CTRL_REG(i) (REG_FRC_TIMER_BASE(i) + 0x8) +#define FRC_TIMER_INT_STATUS (BIT(8)) // interrupt status (RO) +#define FRC_TIMER_ENABLE (BIT(7)) // enable timer +#define FRC_TIMER_AUTOLOAD (BIT(6)) // enable autoload +#define FRC_TIMER_PRESCALER 0x00000007 +#define FRC_TIMER_PRESCALER_S 1 +#define FRC_TIMER_PRESCALER_1 (0 << FRC_TIMER_PRESCALER_S) +#define FRC_TIMER_PRESCALER_16 (2 << FRC_TIMER_PRESCALER_S) +#define FRC_TIMER_PRESCALER_256 (4 << FRC_TIMER_PRESCALER_S) +#define FRC_TIMER_LEVEL_INT (BIT(0)) // 1: level, 0: edge + +#define FRC_TIMER_INT_REG(i) (REG_FRC_TIMER_BASE(i) + 0xC) +#define FRC_TIMER_INT_CLR (BIT(0)) // clear interrupt + +#define FRC_TIMER_ALARM_REG(i) (REG_FRC_TIMER_BASE(i) + 0x10) // timer alarm value; register only present for i == 1 +#define FRC_TIMER_ALARM 0xFFFFFFFF +#define FRC_TIMER_ALARM_S 0 + +#endif //_SOC_FRC_TIMER_REG_H_ diff --git a/components/soc/esp32s2beta/include/soc/gpio_pins.h b/components/soc/esp32s2beta/include/soc/gpio_pins.h new file mode 100644 index 0000000000..da8cd2ebe6 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/gpio_pins.h @@ -0,0 +1,28 @@ +// Copyright 2018 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _GPIO_PINS_H +#define _GPIO_PINS_H +#ifdef __cplusplus +extern "C" +{ +#endif + +#define GPIO_PIN_COUNT 48 + +#ifdef __cplusplus +} +#endif + +#endif // _GPIO_PINS_H diff --git a/components/soc/esp32s2beta/include/soc/gpio_reg.h b/components/soc/esp32s2beta/include/soc/gpio_reg.h new file mode 100644 index 0000000000..03ed89292d --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/gpio_reg.h @@ -0,0 +1,9222 @@ +// Copyright 2017-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_GPIO_REG_H_ +#define _SOC_GPIO_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define GPIO_PIN_CONFIG_MSB 12 +#define GPIO_PIN_CONFIG_LSB 11 +#define GPIO_PIN_CONFIG_MASK 0x00001800 +#define GPIO_PIN_CONFIG_GET(x) (((x) & GPIO_PIN_CONFIG_MASK) >> GPIO_PIN_CONFIG_LSB) +#define GPIO_PIN_CONFIG_SET(x) (((x) << GPIO_PIN_CONFIG_LSB) & GPIO_PIN_CONFIG_MASK) + +#define GPIO_WAKEUP_ENABLE 1 +#define GPIO_WAKEUP_DISABLE (~GPIO_WAKEUP_ENABLE) +#define GPIO_PIN_WAKEUP_ENABLE_MSB 10 +#define GPIO_PIN_WAKEUP_ENABLE_LSB 10 +#define GPIO_PIN_WAKEUP_ENABLE_MASK 0x00000400 +#define GPIO_PIN_WAKEUP_ENABLE_GET(x) (((x) & GPIO_PIN_WAKEUP_ENABLE_MASK) >> GPIO_PIN_WAKEUP_ENABLE_LSB) +#define GPIO_PIN_WAKEUP_ENABLE_SET(x) (((x) << GPIO_PIN_WAKEUP_ENABLE_LSB) & GPIO_PIN_WAKEUP_ENABLE_MASK) + +#define GPIO_PIN_INT_TYPE_MASK 0x380 +#define GPIO_PIN_INT_TYPE_MSB 9 +#define GPIO_PIN_INT_TYPE_LSB 7 +#define GPIO_PIN_INT_TYPE_GET(x) (((x) & GPIO_PIN_INT_TYPE_MASK) >> GPIO_PIN_INT_TYPE_LSB) +#define GPIO_PIN_INT_TYPE_SET(x) (((x) << GPIO_PIN_INT_TYPE_LSB) & GPIO_PIN_INT_TYPE_MASK) + +#define GPIO_PAD_DRIVER_ENABLE 1 +#define GPIO_PAD_DRIVER_DISABLE (~GPIO_PAD_DRIVER_ENABLE) +#define GPIO_PIN_PAD_DRIVER_MSB 2 +#define GPIO_PIN_PAD_DRIVER_LSB 2 +#define GPIO_PIN_PAD_DRIVER_MASK 0x00000004 +#define GPIO_PIN_PAD_DRIVER_GET(x) (((x) & GPIO_PIN_PAD_DRIVER_MASK) >> GPIO_PIN_PAD_DRIVER_LSB) +#define GPIO_PIN_PAD_DRIVER_SET(x) (((x) << GPIO_PIN_PAD_DRIVER_LSB) & GPIO_PIN_PAD_DRIVER_MASK) + +#define GPIO_BT_SELECT_REG (DR_REG_GPIO_BASE + 0x0) +/* GPIO_BT_SEL : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_BT_SEL 0xFFFFFFFF +#define GPIO_BT_SEL_M ((GPIO_BT_SEL_V)<<(GPIO_BT_SEL_S)) +#define GPIO_BT_SEL_V 0xFFFFFFFF +#define GPIO_BT_SEL_S 0 + +#define GPIO_OUT_REG (DR_REG_GPIO_BASE + 0x4) +/* GPIO_OUT_DATA : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_OUT_DATA 0xFFFFFFFF +#define GPIO_OUT_DATA_M ((GPIO_OUT_DATA_V)<<(GPIO_OUT_DATA_S)) +#define GPIO_OUT_DATA_V 0xFFFFFFFF +#define GPIO_OUT_DATA_S 0 + +#define GPIO_OUT_W1TS_REG (DR_REG_GPIO_BASE + 0x8) +/* GPIO_OUT_W1TS : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_OUT_W1TS 0xFFFFFFFF +#define GPIO_OUT_W1TS_M ((GPIO_OUT_W1TS_V)<<(GPIO_OUT_W1TS_S)) +#define GPIO_OUT_W1TS_V 0xFFFFFFFF +#define GPIO_OUT_W1TS_S 0 + +#define GPIO_OUT_W1TC_REG (DR_REG_GPIO_BASE + 0xC) +/* GPIO_OUT_W1TC : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_OUT_W1TC 0xFFFFFFFF +#define GPIO_OUT_W1TC_M ((GPIO_OUT_W1TC_V)<<(GPIO_OUT_W1TC_S)) +#define GPIO_OUT_W1TC_V 0xFFFFFFFF +#define GPIO_OUT_W1TC_S 0 + +#define GPIO_OUT1_REG (DR_REG_GPIO_BASE + 0x10) +/* GPIO_OUT1_DATA : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_OUT1_DATA 0x003FFFFF +#define GPIO_OUT1_DATA_M ((GPIO_OUT_DATA_V)<<(GPIO_OUT_DATA_S)) +#define GPIO_OUT1_DATA_V 0x3FFFFF +#define GPIO_OUT1_DATA_S 0 + +#define GPIO_OUT1_W1TS_REG (DR_REG_GPIO_BASE + 0x14) +/* GPIO_OUT1_W1TS : WO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_OUT1_W1TS 0x003FFFFF +#define GPIO_OUT1_W1TS_M ((GPIO_OUT1_W1TS_V)<<(GPIO_OUT1_W1TS_S)) +#define GPIO_OUT1_W1TS_V 0x3FFFFF +#define GPIO_OUT1_W1TS_S 0 + +#define GPIO_OUT1_W1TC_REG (DR_REG_GPIO_BASE + 0x18) +/* GPIO_OUT1_W1TC : WO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_OUT1_W1TC 0x003FFFFF +#define GPIO_OUT1_W1TC_M ((GPIO_OUT1_W1TC_V)<<(GPIO_OUT1_W1TC_S)) +#define GPIO_OUT1_W1TC_V 0x3FFFFF +#define GPIO_OUT1_W1TC_S 0 + +#define GPIO_SDIO_SELECT_REG (DR_REG_GPIO_BASE + 0x1C) +/* GPIO_SDIO_SEL : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define GPIO_SDIO_SEL 0x000000FF +#define GPIO_SDIO_SEL_M ((GPIO_SDIO_SEL_V)<<(GPIO_SDIO_SEL_S)) +#define GPIO_SDIO_SEL_V 0xFF +#define GPIO_SDIO_SEL_S 0 + +#define GPIO_ENABLE_REG (DR_REG_GPIO_BASE + 0x20) +/* GPIO_ENABLE_DATA : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_ENABLE_DATA 0xFFFFFFFF +#define GPIO_ENABLE_DATA_M ((GPIO_ENABLE_DATA_V)<<(GPIO_ENABLE_DATA_S)) +#define GPIO_ENABLE_DATA_V 0xFFFFFFFF +#define GPIO_ENABLE_DATA_S 0 + +#define GPIO_ENABLE_W1TS_REG (DR_REG_GPIO_BASE + 0x24) +/* GPIO_ENABLE_W1TS : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_ENABLE_W1TS 0xFFFFFFFF +#define GPIO_ENABLE_W1TS_M ((GPIO_ENABLE_W1TS_V)<<(GPIO_ENABLE_W1TS_S)) +#define GPIO_ENABLE_W1TS_V 0xFFFFFFFF +#define GPIO_ENABLE_W1TS_S 0 + +#define GPIO_ENABLE_W1TC_REG (DR_REG_GPIO_BASE + 0x28) +/* GPIO_ENABLE_W1TC : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_ENABLE_W1TC 0xFFFFFFFF +#define GPIO_ENABLE_W1TC_M ((GPIO_ENABLE_W1TC_V)<<(GPIO_ENABLE_W1TC_S)) +#define GPIO_ENABLE_W1TC_V 0xFFFFFFFF +#define GPIO_ENABLE_W1TC_S 0 + +#define GPIO_ENABLE1_REG (DR_REG_GPIO_BASE + 0x2C) +/* GPIO_ENABLE1_DATA : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_ENABLE1_DATA 0x003FFFFF +#define GPIO_ENABLE1_DATA_M ((GPIO_ENABLE1_DATA_V)<<(GPIO_ENABLE1_DATA_S)) +#define GPIO_ENABLE1_DATA_V 0x3FFFFF +#define GPIO_ENABLE1_DATA_S 0 + +#define GPIO_ENABLE1_W1TS_REG (DR_REG_GPIO_BASE + 0x30) +/* GPIO_ENABLE1_W1TS : WO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_ENABLE1_W1TS 0x003FFFFF +#define GPIO_ENABLE1_W1TS_M ((GPIO_ENABLE1_W1TS_V)<<(GPIO_ENABLE1_W1TS_S)) +#define GPIO_ENABLE1_W1TS_V 0x3FFFFF +#define GPIO_ENABLE1_W1TS_S 0 + +#define GPIO_ENABLE1_W1TC_REG (DR_REG_GPIO_BASE + 0x34) +/* GPIO_ENABLE1_W1TC : WO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_ENABLE1_W1TC 0x003FFFFF +#define GPIO_ENABLE1_W1TC_M ((GPIO_ENABLE1_W1TC_V)<<(GPIO_ENABLE1_W1TC_S)) +#define GPIO_ENABLE1_W1TC_V 0x3FFFFF +#define GPIO_ENABLE1_W1TC_S 0 + +#define GPIO_STRAP_REG (DR_REG_GPIO_BASE + 0x38) +/* GPIO_STRAPPING : RO ;bitpos:[15:0] ;default: ; */ +/*description: */ +#define GPIO_STRAPPING 0x0000FFFF +#define GPIO_STRAPPING_M ((GPIO_STRAPPING_V)<<(GPIO_STRAPPING_S)) +#define GPIO_STRAPPING_V 0xFFFF +#define GPIO_STRAPPING_S 0 + +#define GPIO_IN_REG (DR_REG_GPIO_BASE + 0x3C) +/* GPIO_IN_DATA : RO ;bitpos:[31:0] ;default: ; */ +/*description: */ +#define GPIO_IN_DATA 0xFFFFFFFF +#define GPIO_IN_DATA_M ((GPIO_IN_DATA_V)<<(GPIO_IN_DATA_S)) +#define GPIO_IN_DATA_V 0xFFFFFFFF +#define GPIO_IN_DATA_S 0 + +#define GPIO_IN1_REG (DR_REG_GPIO_BASE + 0x40) +/* GPIO_IN1_DATA : RO ;bitpos:[21:0] ;default: ; */ +/*description: */ +#define GPIO_IN1_DATA 0x003FFFFF +#define GPIO_IN1_DATA_M ((GPIO_IN1_DATA_V)<<(GPIO_IN1_DATA_S)) +#define GPIO_IN1_DATA_V 0x3FFFFF +#define GPIO_IN1_DATA_S 0 + +#define GPIO_STATUS_REG (DR_REG_GPIO_BASE + 0x44) +/* GPIO_STATUS_INT : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_STATUS_INT 0xFFFFFFFF +#define GPIO_STATUS_INT_M ((GPIO_STATUS_INT_V)<<(GPIO_STATUS_INT_S)) +#define GPIO_STATUS_INT_V 0xFFFFFFFF +#define GPIO_STATUS_INT_S 0 + +#define GPIO_STATUS_W1TS_REG (DR_REG_GPIO_BASE + 0x48) +/* GPIO_STATUS_W1TS : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_STATUS_W1TS 0xFFFFFFFF +#define GPIO_STATUS_W1TS_M ((GPIO_STATUS_W1TS_V)<<(GPIO_STATUS_W1TS_S)) +#define GPIO_STATUS_W1TS_V 0xFFFFFFFF +#define GPIO_STATUS_W1TS_S 0 + +#define GPIO_STATUS_W1TC_REG (DR_REG_GPIO_BASE + 0x4C) +/* GPIO_STATUS_W1TC : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_STATUS_W1TC 0xFFFFFFFF +#define GPIO_STATUS_W1TC_M ((GPIO_STATUS_W1TC_V)<<(GPIO_STATUS_W1TC_S)) +#define GPIO_STATUS_W1TC_V 0xFFFFFFFF +#define GPIO_STATUS_W1TC_S 0 + +#define GPIO_STATUS1_REG (DR_REG_GPIO_BASE + 0x50) +/* GPIO_STATUS1_INT : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_STATUS1_INT 0x003FFFFF +#define GPIO_STATUS1_INT_M ((GPIO_STATUS1_INT_V)<<(GPIO_STATUS1_INT_S)) +#define GPIO_STATUS1_INT_V 0x3FFFFF +#define GPIO_STATUS1_INT_S 0 + +#define GPIO_STATUS1_W1TS_REG (DR_REG_GPIO_BASE + 0x54) +/* GPIO_STATUS1_W1TS : WO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_STATUS1_W1TS 0x003FFFFF +#define GPIO_STATUS1_W1TS_M ((GPIO_STATUS1_W1TS_V)<<(GPIO_STATUS1_W1TS_S)) +#define GPIO_STATUS1_W1TS_V 0x3FFFFF +#define GPIO_STATUS1_W1TS_S 0 + +#define GPIO_STATUS1_W1TC_REG (DR_REG_GPIO_BASE + 0x58) +/* GPIO_STATUS1_W1TC : WO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_STATUS1_W1TC 0x003FFFFF +#define GPIO_STATUS1_W1TC_M ((GPIO_STATUS1_W1TC_V)<<(GPIO_STATUS1_W1TC_S)) +#define GPIO_STATUS1_W1TC_V 0x3FFFFF +#define GPIO_STATUS1_W1TC_S 0 + +#define GPIO_PCPU_INT_REG (DR_REG_GPIO_BASE + 0x5C) +/* GPIO_PROCPU_INT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_PROCPU_INT 0xFFFFFFFF +#define GPIO_PROCPU_INT_M ((GPIO_PROCPU_INT_V)<<(GPIO_PROCPU_INT_S)) +#define GPIO_PROCPU_INT_V 0xFFFFFFFF +#define GPIO_PROCPU_INT_S 0 + +#define GPIO_PCPU_NMI_INT_REG (DR_REG_GPIO_BASE + 0x60) +/* GPIO_PROCPU_NMI_INT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_PROCPU_NMI_INT 0xFFFFFFFF +#define GPIO_PROCPU_NMI_INT_M ((GPIO_PROCPU_NMI_INT_V)<<(GPIO_PROCPU_NMI_INT_S)) +#define GPIO_PROCPU_NMI_INT_V 0xFFFFFFFF +#define GPIO_PROCPU_NMI_INT_S 0 + +#define GPIO_CPUSDIO_INT_REG (DR_REG_GPIO_BASE + 0x64) +/* GPIO_SDIO_INT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_SDIO_INT 0xFFFFFFFF +#define GPIO_SDIO_INT_M ((GPIO_SDIO_INT_V)<<(GPIO_SDIO_INT_S)) +#define GPIO_SDIO_INT_V 0xFFFFFFFF +#define GPIO_SDIO_INT_S 0 + +#define GPIO_PCPU_INT1_REG (DR_REG_GPIO_BASE + 0x68) +/* GPIO_PROCPU_INT_H : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_PROCPU_INT_H 0x003FFFFF +#define GPIO_PROCPU_INT_H_M ((GPIO_PROCPU_INT_H_V)<<(GPIO_PROCPU_INT_H_S)) +#define GPIO_PROCPU_INT_H_V 0x3FFFFF +#define GPIO_PROCPU_INT_H_S 0 + +#define GPIO_PCPU_NMI_INT1_REG (DR_REG_GPIO_BASE + 0x6C) +/* GPIO_PROCPU_NMI_INT_H : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_PROCPU_NMI_INT_H 0x003FFFFF +#define GPIO_PROCPU_NMI_INT_H_M ((GPIO_PROCPU_NMI_INT_H_V)<<(GPIO_PROCPU_NMI_INT_H_S)) +#define GPIO_PROCPU_NMI_INT_H_V 0x3FFFFF +#define GPIO_PROCPU_NMI_INT_H_S 0 + +#define GPIO_CPUSDIO_INT1_REG (DR_REG_GPIO_BASE + 0x70) +/* GPIO_SDIO_INT_H : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_SDIO_INT_H 0x003FFFFF +#define GPIO_SDIO_INT_H_M ((GPIO_SDIO_INT_H_V)<<(GPIO_SDIO_INT_H_S)) +#define GPIO_SDIO_INT_H_V 0x3FFFFF +#define GPIO_SDIO_INT_H_S 0 + +#define GPIO_PIN0_REG (DR_REG_GPIO_BASE + 0x74) +/* GPIO_PIN0_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN0_INT_ENA 0x0000001F +#define GPIO_PIN0_INT_ENA_M ((GPIO_PIN0_INT_ENA_V)<<(GPIO_PIN0_INT_ENA_S)) +#define GPIO_PIN0_INT_ENA_V 0x1F +#define GPIO_PIN0_INT_ENA_S 13 +/* GPIO_PIN0_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN0_CONFIG 0x00000003 +#define GPIO_PIN0_CONFIG_M ((GPIO_PIN0_CONFIG_V)<<(GPIO_PIN0_CONFIG_S)) +#define GPIO_PIN0_CONFIG_V 0x3 +#define GPIO_PIN0_CONFIG_S 11 +/* GPIO_PIN0_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN0_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN0_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN0_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN0_WAKEUP_ENABLE_S 10 +/* GPIO_PIN0_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN0_INT_TYPE 0x00000007 +#define GPIO_PIN0_INT_TYPE_M ((GPIO_PIN0_INT_TYPE_V)<<(GPIO_PIN0_INT_TYPE_S)) +#define GPIO_PIN0_INT_TYPE_V 0x7 +#define GPIO_PIN0_INT_TYPE_S 7 +/* GPIO_PIN0_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN0_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN0_SYNC1_BYPASS_M ((GPIO_PIN0_SYNC1_BYPASS_V)<<(GPIO_PIN0_SYNC1_BYPASS_S)) +#define GPIO_PIN0_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN0_SYNC1_BYPASS_S 3 +/* GPIO_PIN0_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN0_PAD_DRIVER (BIT(2)) +#define GPIO_PIN0_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN0_PAD_DRIVER_V 0x1 +#define GPIO_PIN0_PAD_DRIVER_S 2 +/* GPIO_PIN0_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN0_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN0_SYNC2_BYPASS_M ((GPIO_PIN0_SYNC2_BYPASS_V)<<(GPIO_PIN0_SYNC2_BYPASS_S)) +#define GPIO_PIN0_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN0_SYNC2_BYPASS_S 0 + +#define GPIO_PIN1_REG (DR_REG_GPIO_BASE + 0x78) +/* GPIO_PIN1_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN1_INT_ENA 0x0000001F +#define GPIO_PIN1_INT_ENA_M ((GPIO_PIN1_INT_ENA_V)<<(GPIO_PIN1_INT_ENA_S)) +#define GPIO_PIN1_INT_ENA_V 0x1F +#define GPIO_PIN1_INT_ENA_S 13 +/* GPIO_PIN1_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN1_CONFIG 0x00000003 +#define GPIO_PIN1_CONFIG_M ((GPIO_PIN1_CONFIG_V)<<(GPIO_PIN1_CONFIG_S)) +#define GPIO_PIN1_CONFIG_V 0x3 +#define GPIO_PIN1_CONFIG_S 11 +/* GPIO_PIN1_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN1_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN1_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN1_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN1_WAKEUP_ENABLE_S 10 +/* GPIO_PIN1_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN1_INT_TYPE 0x00000007 +#define GPIO_PIN1_INT_TYPE_M ((GPIO_PIN1_INT_TYPE_V)<<(GPIO_PIN1_INT_TYPE_S)) +#define GPIO_PIN1_INT_TYPE_V 0x7 +#define GPIO_PIN1_INT_TYPE_S 7 +/* GPIO_PIN1_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN1_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN1_SYNC1_BYPASS_M ((GPIO_PIN1_SYNC1_BYPASS_V)<<(GPIO_PIN1_SYNC1_BYPASS_S)) +#define GPIO_PIN1_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN1_SYNC1_BYPASS_S 3 +/* GPIO_PIN1_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN1_PAD_DRIVER (BIT(2)) +#define GPIO_PIN1_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN1_PAD_DRIVER_V 0x1 +#define GPIO_PIN1_PAD_DRIVER_S 2 +/* GPIO_PIN1_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN1_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN1_SYNC2_BYPASS_M ((GPIO_PIN1_SYNC2_BYPASS_V)<<(GPIO_PIN1_SYNC2_BYPASS_S)) +#define GPIO_PIN1_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN1_SYNC2_BYPASS_S 0 + +#define GPIO_PIN2_REG (DR_REG_GPIO_BASE + 0x7C) +/* GPIO_PIN2_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN2_INT_ENA 0x0000001F +#define GPIO_PIN2_INT_ENA_M ((GPIO_PIN2_INT_ENA_V)<<(GPIO_PIN2_INT_ENA_S)) +#define GPIO_PIN2_INT_ENA_V 0x1F +#define GPIO_PIN2_INT_ENA_S 13 +/* GPIO_PIN2_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN2_CONFIG 0x00000003 +#define GPIO_PIN2_CONFIG_M ((GPIO_PIN2_CONFIG_V)<<(GPIO_PIN2_CONFIG_S)) +#define GPIO_PIN2_CONFIG_V 0x3 +#define GPIO_PIN2_CONFIG_S 11 +/* GPIO_PIN2_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN2_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN2_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN2_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN2_WAKEUP_ENABLE_S 10 +/* GPIO_PIN2_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN2_INT_TYPE 0x00000007 +#define GPIO_PIN2_INT_TYPE_M ((GPIO_PIN2_INT_TYPE_V)<<(GPIO_PIN2_INT_TYPE_S)) +#define GPIO_PIN2_INT_TYPE_V 0x7 +#define GPIO_PIN2_INT_TYPE_S 7 +/* GPIO_PIN2_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN2_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN2_SYNC1_BYPASS_M ((GPIO_PIN2_SYNC1_BYPASS_V)<<(GPIO_PIN2_SYNC1_BYPASS_S)) +#define GPIO_PIN2_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN2_SYNC1_BYPASS_S 3 +/* GPIO_PIN2_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN2_PAD_DRIVER (BIT(2)) +#define GPIO_PIN2_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN2_PAD_DRIVER_V 0x1 +#define GPIO_PIN2_PAD_DRIVER_S 2 +/* GPIO_PIN2_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN2_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN2_SYNC2_BYPASS_M ((GPIO_PIN2_SYNC2_BYPASS_V)<<(GPIO_PIN2_SYNC2_BYPASS_S)) +#define GPIO_PIN2_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN2_SYNC2_BYPASS_S 0 + +#define GPIO_PIN3_REG (DR_REG_GPIO_BASE + 0x80) +/* GPIO_PIN3_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN3_INT_ENA 0x0000001F +#define GPIO_PIN3_INT_ENA_M ((GPIO_PIN3_INT_ENA_V)<<(GPIO_PIN3_INT_ENA_S)) +#define GPIO_PIN3_INT_ENA_V 0x1F +#define GPIO_PIN3_INT_ENA_S 13 +/* GPIO_PIN3_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN3_CONFIG 0x00000003 +#define GPIO_PIN3_CONFIG_M ((GPIO_PIN3_CONFIG_V)<<(GPIO_PIN3_CONFIG_S)) +#define GPIO_PIN3_CONFIG_V 0x3 +#define GPIO_PIN3_CONFIG_S 11 +/* GPIO_PIN3_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN3_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN3_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN3_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN3_WAKEUP_ENABLE_S 10 +/* GPIO_PIN3_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN3_INT_TYPE 0x00000007 +#define GPIO_PIN3_INT_TYPE_M ((GPIO_PIN3_INT_TYPE_V)<<(GPIO_PIN3_INT_TYPE_S)) +#define GPIO_PIN3_INT_TYPE_V 0x7 +#define GPIO_PIN3_INT_TYPE_S 7 +/* GPIO_PIN3_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN3_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN3_SYNC1_BYPASS_M ((GPIO_PIN3_SYNC1_BYPASS_V)<<(GPIO_PIN3_SYNC1_BYPASS_S)) +#define GPIO_PIN3_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN3_SYNC1_BYPASS_S 3 +/* GPIO_PIN3_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN3_PAD_DRIVER (BIT(2)) +#define GPIO_PIN3_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN3_PAD_DRIVER_V 0x1 +#define GPIO_PIN3_PAD_DRIVER_S 2 +/* GPIO_PIN3_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN3_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN3_SYNC2_BYPASS_M ((GPIO_PIN3_SYNC2_BYPASS_V)<<(GPIO_PIN3_SYNC2_BYPASS_S)) +#define GPIO_PIN3_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN3_SYNC2_BYPASS_S 0 + +#define GPIO_PIN4_REG (DR_REG_GPIO_BASE + 0x84) +/* GPIO_PIN4_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN4_INT_ENA 0x0000001F +#define GPIO_PIN4_INT_ENA_M ((GPIO_PIN4_INT_ENA_V)<<(GPIO_PIN4_INT_ENA_S)) +#define GPIO_PIN4_INT_ENA_V 0x1F +#define GPIO_PIN4_INT_ENA_S 13 +/* GPIO_PIN4_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN4_CONFIG 0x00000003 +#define GPIO_PIN4_CONFIG_M ((GPIO_PIN4_CONFIG_V)<<(GPIO_PIN4_CONFIG_S)) +#define GPIO_PIN4_CONFIG_V 0x3 +#define GPIO_PIN4_CONFIG_S 11 +/* GPIO_PIN4_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN4_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN4_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN4_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN4_WAKEUP_ENABLE_S 10 +/* GPIO_PIN4_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN4_INT_TYPE 0x00000007 +#define GPIO_PIN4_INT_TYPE_M ((GPIO_PIN4_INT_TYPE_V)<<(GPIO_PIN4_INT_TYPE_S)) +#define GPIO_PIN4_INT_TYPE_V 0x7 +#define GPIO_PIN4_INT_TYPE_S 7 +/* GPIO_PIN4_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN4_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN4_SYNC1_BYPASS_M ((GPIO_PIN4_SYNC1_BYPASS_V)<<(GPIO_PIN4_SYNC1_BYPASS_S)) +#define GPIO_PIN4_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN4_SYNC1_BYPASS_S 3 +/* GPIO_PIN4_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN4_PAD_DRIVER (BIT(2)) +#define GPIO_PIN4_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN4_PAD_DRIVER_V 0x1 +#define GPIO_PIN4_PAD_DRIVER_S 2 +/* GPIO_PIN4_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN4_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN4_SYNC2_BYPASS_M ((GPIO_PIN4_SYNC2_BYPASS_V)<<(GPIO_PIN4_SYNC2_BYPASS_S)) +#define GPIO_PIN4_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN4_SYNC2_BYPASS_S 0 + +#define GPIO_PIN5_REG (DR_REG_GPIO_BASE + 0x88) +/* GPIO_PIN5_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN5_INT_ENA 0x0000001F +#define GPIO_PIN5_INT_ENA_M ((GPIO_PIN5_INT_ENA_V)<<(GPIO_PIN5_INT_ENA_S)) +#define GPIO_PIN5_INT_ENA_V 0x1F +#define GPIO_PIN5_INT_ENA_S 13 +/* GPIO_PIN5_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN5_CONFIG 0x00000003 +#define GPIO_PIN5_CONFIG_M ((GPIO_PIN5_CONFIG_V)<<(GPIO_PIN5_CONFIG_S)) +#define GPIO_PIN5_CONFIG_V 0x3 +#define GPIO_PIN5_CONFIG_S 11 +/* GPIO_PIN5_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN5_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN5_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN5_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN5_WAKEUP_ENABLE_S 10 +/* GPIO_PIN5_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN5_INT_TYPE 0x00000007 +#define GPIO_PIN5_INT_TYPE_M ((GPIO_PIN5_INT_TYPE_V)<<(GPIO_PIN5_INT_TYPE_S)) +#define GPIO_PIN5_INT_TYPE_V 0x7 +#define GPIO_PIN5_INT_TYPE_S 7 +/* GPIO_PIN5_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN5_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN5_SYNC1_BYPASS_M ((GPIO_PIN5_SYNC1_BYPASS_V)<<(GPIO_PIN5_SYNC1_BYPASS_S)) +#define GPIO_PIN5_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN5_SYNC1_BYPASS_S 3 +/* GPIO_PIN5_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN5_PAD_DRIVER (BIT(2)) +#define GPIO_PIN5_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN5_PAD_DRIVER_V 0x1 +#define GPIO_PIN5_PAD_DRIVER_S 2 +/* GPIO_PIN5_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN5_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN5_SYNC2_BYPASS_M ((GPIO_PIN5_SYNC2_BYPASS_V)<<(GPIO_PIN5_SYNC2_BYPASS_S)) +#define GPIO_PIN5_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN5_SYNC2_BYPASS_S 0 + +#define GPIO_PIN6_REG (DR_REG_GPIO_BASE + 0x8C) +/* GPIO_PIN6_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN6_INT_ENA 0x0000001F +#define GPIO_PIN6_INT_ENA_M ((GPIO_PIN6_INT_ENA_V)<<(GPIO_PIN6_INT_ENA_S)) +#define GPIO_PIN6_INT_ENA_V 0x1F +#define GPIO_PIN6_INT_ENA_S 13 +/* GPIO_PIN6_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN6_CONFIG 0x00000003 +#define GPIO_PIN6_CONFIG_M ((GPIO_PIN6_CONFIG_V)<<(GPIO_PIN6_CONFIG_S)) +#define GPIO_PIN6_CONFIG_V 0x3 +#define GPIO_PIN6_CONFIG_S 11 +/* GPIO_PIN6_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN6_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN6_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN6_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN6_WAKEUP_ENABLE_S 10 +/* GPIO_PIN6_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN6_INT_TYPE 0x00000007 +#define GPIO_PIN6_INT_TYPE_M ((GPIO_PIN6_INT_TYPE_V)<<(GPIO_PIN6_INT_TYPE_S)) +#define GPIO_PIN6_INT_TYPE_V 0x7 +#define GPIO_PIN6_INT_TYPE_S 7 +/* GPIO_PIN6_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN6_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN6_SYNC1_BYPASS_M ((GPIO_PIN6_SYNC1_BYPASS_V)<<(GPIO_PIN6_SYNC1_BYPASS_S)) +#define GPIO_PIN6_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN6_SYNC1_BYPASS_S 3 +/* GPIO_PIN6_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN6_PAD_DRIVER (BIT(2)) +#define GPIO_PIN6_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN6_PAD_DRIVER_V 0x1 +#define GPIO_PIN6_PAD_DRIVER_S 2 +/* GPIO_PIN6_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN6_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN6_SYNC2_BYPASS_M ((GPIO_PIN6_SYNC2_BYPASS_V)<<(GPIO_PIN6_SYNC2_BYPASS_S)) +#define GPIO_PIN6_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN6_SYNC2_BYPASS_S 0 + +#define GPIO_PIN7_REG (DR_REG_GPIO_BASE + 0x90) +/* GPIO_PIN7_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN7_INT_ENA 0x0000001F +#define GPIO_PIN7_INT_ENA_M ((GPIO_PIN7_INT_ENA_V)<<(GPIO_PIN7_INT_ENA_S)) +#define GPIO_PIN7_INT_ENA_V 0x1F +#define GPIO_PIN7_INT_ENA_S 13 +/* GPIO_PIN7_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN7_CONFIG 0x00000003 +#define GPIO_PIN7_CONFIG_M ((GPIO_PIN7_CONFIG_V)<<(GPIO_PIN7_CONFIG_S)) +#define GPIO_PIN7_CONFIG_V 0x3 +#define GPIO_PIN7_CONFIG_S 11 +/* GPIO_PIN7_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN7_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN7_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN7_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN7_WAKEUP_ENABLE_S 10 +/* GPIO_PIN7_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN7_INT_TYPE 0x00000007 +#define GPIO_PIN7_INT_TYPE_M ((GPIO_PIN7_INT_TYPE_V)<<(GPIO_PIN7_INT_TYPE_S)) +#define GPIO_PIN7_INT_TYPE_V 0x7 +#define GPIO_PIN7_INT_TYPE_S 7 +/* GPIO_PIN7_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN7_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN7_SYNC1_BYPASS_M ((GPIO_PIN7_SYNC1_BYPASS_V)<<(GPIO_PIN7_SYNC1_BYPASS_S)) +#define GPIO_PIN7_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN7_SYNC1_BYPASS_S 3 +/* GPIO_PIN7_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN7_PAD_DRIVER (BIT(2)) +#define GPIO_PIN7_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN7_PAD_DRIVER_V 0x1 +#define GPIO_PIN7_PAD_DRIVER_S 2 +/* GPIO_PIN7_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN7_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN7_SYNC2_BYPASS_M ((GPIO_PIN7_SYNC2_BYPASS_V)<<(GPIO_PIN7_SYNC2_BYPASS_S)) +#define GPIO_PIN7_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN7_SYNC2_BYPASS_S 0 + +#define GPIO_PIN8_REG (DR_REG_GPIO_BASE + 0x94) +/* GPIO_PIN8_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN8_INT_ENA 0x0000001F +#define GPIO_PIN8_INT_ENA_M ((GPIO_PIN8_INT_ENA_V)<<(GPIO_PIN8_INT_ENA_S)) +#define GPIO_PIN8_INT_ENA_V 0x1F +#define GPIO_PIN8_INT_ENA_S 13 +/* GPIO_PIN8_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN8_CONFIG 0x00000003 +#define GPIO_PIN8_CONFIG_M ((GPIO_PIN8_CONFIG_V)<<(GPIO_PIN8_CONFIG_S)) +#define GPIO_PIN8_CONFIG_V 0x3 +#define GPIO_PIN8_CONFIG_S 11 +/* GPIO_PIN8_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN8_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN8_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN8_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN8_WAKEUP_ENABLE_S 10 +/* GPIO_PIN8_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN8_INT_TYPE 0x00000007 +#define GPIO_PIN8_INT_TYPE_M ((GPIO_PIN8_INT_TYPE_V)<<(GPIO_PIN8_INT_TYPE_S)) +#define GPIO_PIN8_INT_TYPE_V 0x7 +#define GPIO_PIN8_INT_TYPE_S 7 +/* GPIO_PIN8_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN8_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN8_SYNC1_BYPASS_M ((GPIO_PIN8_SYNC1_BYPASS_V)<<(GPIO_PIN8_SYNC1_BYPASS_S)) +#define GPIO_PIN8_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN8_SYNC1_BYPASS_S 3 +/* GPIO_PIN8_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN8_PAD_DRIVER (BIT(2)) +#define GPIO_PIN8_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN8_PAD_DRIVER_V 0x1 +#define GPIO_PIN8_PAD_DRIVER_S 2 +/* GPIO_PIN8_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN8_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN8_SYNC2_BYPASS_M ((GPIO_PIN8_SYNC2_BYPASS_V)<<(GPIO_PIN8_SYNC2_BYPASS_S)) +#define GPIO_PIN8_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN8_SYNC2_BYPASS_S 0 + +#define GPIO_PIN9_REG (DR_REG_GPIO_BASE + 0x98) +/* GPIO_PIN9_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN9_INT_ENA 0x0000001F +#define GPIO_PIN9_INT_ENA_M ((GPIO_PIN9_INT_ENA_V)<<(GPIO_PIN9_INT_ENA_S)) +#define GPIO_PIN9_INT_ENA_V 0x1F +#define GPIO_PIN9_INT_ENA_S 13 +/* GPIO_PIN9_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN9_CONFIG 0x00000003 +#define GPIO_PIN9_CONFIG_M ((GPIO_PIN9_CONFIG_V)<<(GPIO_PIN9_CONFIG_S)) +#define GPIO_PIN9_CONFIG_V 0x3 +#define GPIO_PIN9_CONFIG_S 11 +/* GPIO_PIN9_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN9_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN9_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN9_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN9_WAKEUP_ENABLE_S 10 +/* GPIO_PIN9_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN9_INT_TYPE 0x00000007 +#define GPIO_PIN9_INT_TYPE_M ((GPIO_PIN9_INT_TYPE_V)<<(GPIO_PIN9_INT_TYPE_S)) +#define GPIO_PIN9_INT_TYPE_V 0x7 +#define GPIO_PIN9_INT_TYPE_S 7 +/* GPIO_PIN9_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN9_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN9_SYNC1_BYPASS_M ((GPIO_PIN9_SYNC1_BYPASS_V)<<(GPIO_PIN9_SYNC1_BYPASS_S)) +#define GPIO_PIN9_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN9_SYNC1_BYPASS_S 3 +/* GPIO_PIN9_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN9_PAD_DRIVER (BIT(2)) +#define GPIO_PIN9_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN9_PAD_DRIVER_V 0x1 +#define GPIO_PIN9_PAD_DRIVER_S 2 +/* GPIO_PIN9_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN9_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN9_SYNC2_BYPASS_M ((GPIO_PIN9_SYNC2_BYPASS_V)<<(GPIO_PIN9_SYNC2_BYPASS_S)) +#define GPIO_PIN9_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN9_SYNC2_BYPASS_S 0 + +#define GPIO_PIN10_REG (DR_REG_GPIO_BASE + 0x9C) +/* GPIO_PIN10_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN10_INT_ENA 0x0000001F +#define GPIO_PIN10_INT_ENA_M ((GPIO_PIN10_INT_ENA_V)<<(GPIO_PIN10_INT_ENA_S)) +#define GPIO_PIN10_INT_ENA_V 0x1F +#define GPIO_PIN10_INT_ENA_S 13 +/* GPIO_PIN10_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN10_CONFIG 0x00000003 +#define GPIO_PIN10_CONFIG_M ((GPIO_PIN10_CONFIG_V)<<(GPIO_PIN10_CONFIG_S)) +#define GPIO_PIN10_CONFIG_V 0x3 +#define GPIO_PIN10_CONFIG_S 11 +/* GPIO_PIN10_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN10_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN10_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN10_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN10_WAKEUP_ENABLE_S 10 +/* GPIO_PIN10_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN10_INT_TYPE 0x00000007 +#define GPIO_PIN10_INT_TYPE_M ((GPIO_PIN10_INT_TYPE_V)<<(GPIO_PIN10_INT_TYPE_S)) +#define GPIO_PIN10_INT_TYPE_V 0x7 +#define GPIO_PIN10_INT_TYPE_S 7 +/* GPIO_PIN10_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN10_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN10_SYNC1_BYPASS_M ((GPIO_PIN10_SYNC1_BYPASS_V)<<(GPIO_PIN10_SYNC1_BYPASS_S)) +#define GPIO_PIN10_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN10_SYNC1_BYPASS_S 3 +/* GPIO_PIN10_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN10_PAD_DRIVER (BIT(2)) +#define GPIO_PIN10_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN10_PAD_DRIVER_V 0x1 +#define GPIO_PIN10_PAD_DRIVER_S 2 +/* GPIO_PIN10_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN10_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN10_SYNC2_BYPASS_M ((GPIO_PIN10_SYNC2_BYPASS_V)<<(GPIO_PIN10_SYNC2_BYPASS_S)) +#define GPIO_PIN10_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN10_SYNC2_BYPASS_S 0 + +#define GPIO_PIN11_REG (DR_REG_GPIO_BASE + 0xA0) +/* GPIO_PIN11_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN11_INT_ENA 0x0000001F +#define GPIO_PIN11_INT_ENA_M ((GPIO_PIN11_INT_ENA_V)<<(GPIO_PIN11_INT_ENA_S)) +#define GPIO_PIN11_INT_ENA_V 0x1F +#define GPIO_PIN11_INT_ENA_S 13 +/* GPIO_PIN11_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN11_CONFIG 0x00000003 +#define GPIO_PIN11_CONFIG_M ((GPIO_PIN11_CONFIG_V)<<(GPIO_PIN11_CONFIG_S)) +#define GPIO_PIN11_CONFIG_V 0x3 +#define GPIO_PIN11_CONFIG_S 11 +/* GPIO_PIN11_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN11_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN11_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN11_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN11_WAKEUP_ENABLE_S 10 +/* GPIO_PIN11_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN11_INT_TYPE 0x00000007 +#define GPIO_PIN11_INT_TYPE_M ((GPIO_PIN11_INT_TYPE_V)<<(GPIO_PIN11_INT_TYPE_S)) +#define GPIO_PIN11_INT_TYPE_V 0x7 +#define GPIO_PIN11_INT_TYPE_S 7 +/* GPIO_PIN11_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN11_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN11_SYNC1_BYPASS_M ((GPIO_PIN11_SYNC1_BYPASS_V)<<(GPIO_PIN11_SYNC1_BYPASS_S)) +#define GPIO_PIN11_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN11_SYNC1_BYPASS_S 3 +/* GPIO_PIN11_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN11_PAD_DRIVER (BIT(2)) +#define GPIO_PIN11_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN11_PAD_DRIVER_V 0x1 +#define GPIO_PIN11_PAD_DRIVER_S 2 +/* GPIO_PIN11_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN11_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN11_SYNC2_BYPASS_M ((GPIO_PIN11_SYNC2_BYPASS_V)<<(GPIO_PIN11_SYNC2_BYPASS_S)) +#define GPIO_PIN11_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN11_SYNC2_BYPASS_S 0 + +#define GPIO_PIN12_REG (DR_REG_GPIO_BASE + 0xA4) +/* GPIO_PIN12_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN12_INT_ENA 0x0000001F +#define GPIO_PIN12_INT_ENA_M ((GPIO_PIN12_INT_ENA_V)<<(GPIO_PIN12_INT_ENA_S)) +#define GPIO_PIN12_INT_ENA_V 0x1F +#define GPIO_PIN12_INT_ENA_S 13 +/* GPIO_PIN12_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN12_CONFIG 0x00000003 +#define GPIO_PIN12_CONFIG_M ((GPIO_PIN12_CONFIG_V)<<(GPIO_PIN12_CONFIG_S)) +#define GPIO_PIN12_CONFIG_V 0x3 +#define GPIO_PIN12_CONFIG_S 11 +/* GPIO_PIN12_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN12_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN12_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN12_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN12_WAKEUP_ENABLE_S 10 +/* GPIO_PIN12_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN12_INT_TYPE 0x00000007 +#define GPIO_PIN12_INT_TYPE_M ((GPIO_PIN12_INT_TYPE_V)<<(GPIO_PIN12_INT_TYPE_S)) +#define GPIO_PIN12_INT_TYPE_V 0x7 +#define GPIO_PIN12_INT_TYPE_S 7 +/* GPIO_PIN12_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN12_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN12_SYNC1_BYPASS_M ((GPIO_PIN12_SYNC1_BYPASS_V)<<(GPIO_PIN12_SYNC1_BYPASS_S)) +#define GPIO_PIN12_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN12_SYNC1_BYPASS_S 3 +/* GPIO_PIN12_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN12_PAD_DRIVER (BIT(2)) +#define GPIO_PIN12_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN12_PAD_DRIVER_V 0x1 +#define GPIO_PIN12_PAD_DRIVER_S 2 +/* GPIO_PIN12_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN12_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN12_SYNC2_BYPASS_M ((GPIO_PIN12_SYNC2_BYPASS_V)<<(GPIO_PIN12_SYNC2_BYPASS_S)) +#define GPIO_PIN12_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN12_SYNC2_BYPASS_S 0 + +#define GPIO_PIN13_REG (DR_REG_GPIO_BASE + 0xA8) +/* GPIO_PIN13_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN13_INT_ENA 0x0000001F +#define GPIO_PIN13_INT_ENA_M ((GPIO_PIN13_INT_ENA_V)<<(GPIO_PIN13_INT_ENA_S)) +#define GPIO_PIN13_INT_ENA_V 0x1F +#define GPIO_PIN13_INT_ENA_S 13 +/* GPIO_PIN13_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN13_CONFIG 0x00000003 +#define GPIO_PIN13_CONFIG_M ((GPIO_PIN13_CONFIG_V)<<(GPIO_PIN13_CONFIG_S)) +#define GPIO_PIN13_CONFIG_V 0x3 +#define GPIO_PIN13_CONFIG_S 11 +/* GPIO_PIN13_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN13_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN13_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN13_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN13_WAKEUP_ENABLE_S 10 +/* GPIO_PIN13_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN13_INT_TYPE 0x00000007 +#define GPIO_PIN13_INT_TYPE_M ((GPIO_PIN13_INT_TYPE_V)<<(GPIO_PIN13_INT_TYPE_S)) +#define GPIO_PIN13_INT_TYPE_V 0x7 +#define GPIO_PIN13_INT_TYPE_S 7 +/* GPIO_PIN13_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN13_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN13_SYNC1_BYPASS_M ((GPIO_PIN13_SYNC1_BYPASS_V)<<(GPIO_PIN13_SYNC1_BYPASS_S)) +#define GPIO_PIN13_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN13_SYNC1_BYPASS_S 3 +/* GPIO_PIN13_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN13_PAD_DRIVER (BIT(2)) +#define GPIO_PIN13_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN13_PAD_DRIVER_V 0x1 +#define GPIO_PIN13_PAD_DRIVER_S 2 +/* GPIO_PIN13_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN13_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN13_SYNC2_BYPASS_M ((GPIO_PIN13_SYNC2_BYPASS_V)<<(GPIO_PIN13_SYNC2_BYPASS_S)) +#define GPIO_PIN13_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN13_SYNC2_BYPASS_S 0 + +#define GPIO_PIN14_REG (DR_REG_GPIO_BASE + 0xAC) +/* GPIO_PIN14_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN14_INT_ENA 0x0000001F +#define GPIO_PIN14_INT_ENA_M ((GPIO_PIN14_INT_ENA_V)<<(GPIO_PIN14_INT_ENA_S)) +#define GPIO_PIN14_INT_ENA_V 0x1F +#define GPIO_PIN14_INT_ENA_S 13 +/* GPIO_PIN14_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN14_CONFIG 0x00000003 +#define GPIO_PIN14_CONFIG_M ((GPIO_PIN14_CONFIG_V)<<(GPIO_PIN14_CONFIG_S)) +#define GPIO_PIN14_CONFIG_V 0x3 +#define GPIO_PIN14_CONFIG_S 11 +/* GPIO_PIN14_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN14_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN14_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN14_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN14_WAKEUP_ENABLE_S 10 +/* GPIO_PIN14_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN14_INT_TYPE 0x00000007 +#define GPIO_PIN14_INT_TYPE_M ((GPIO_PIN14_INT_TYPE_V)<<(GPIO_PIN14_INT_TYPE_S)) +#define GPIO_PIN14_INT_TYPE_V 0x7 +#define GPIO_PIN14_INT_TYPE_S 7 +/* GPIO_PIN14_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN14_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN14_SYNC1_BYPASS_M ((GPIO_PIN14_SYNC1_BYPASS_V)<<(GPIO_PIN14_SYNC1_BYPASS_S)) +#define GPIO_PIN14_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN14_SYNC1_BYPASS_S 3 +/* GPIO_PIN14_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN14_PAD_DRIVER (BIT(2)) +#define GPIO_PIN14_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN14_PAD_DRIVER_V 0x1 +#define GPIO_PIN14_PAD_DRIVER_S 2 +/* GPIO_PIN14_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN14_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN14_SYNC2_BYPASS_M ((GPIO_PIN14_SYNC2_BYPASS_V)<<(GPIO_PIN14_SYNC2_BYPASS_S)) +#define GPIO_PIN14_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN14_SYNC2_BYPASS_S 0 + +#define GPIO_PIN15_REG (DR_REG_GPIO_BASE + 0xB0) +/* GPIO_PIN15_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN15_INT_ENA 0x0000001F +#define GPIO_PIN15_INT_ENA_M ((GPIO_PIN15_INT_ENA_V)<<(GPIO_PIN15_INT_ENA_S)) +#define GPIO_PIN15_INT_ENA_V 0x1F +#define GPIO_PIN15_INT_ENA_S 13 +/* GPIO_PIN15_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN15_CONFIG 0x00000003 +#define GPIO_PIN15_CONFIG_M ((GPIO_PIN15_CONFIG_V)<<(GPIO_PIN15_CONFIG_S)) +#define GPIO_PIN15_CONFIG_V 0x3 +#define GPIO_PIN15_CONFIG_S 11 +/* GPIO_PIN15_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN15_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN15_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN15_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN15_WAKEUP_ENABLE_S 10 +/* GPIO_PIN15_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN15_INT_TYPE 0x00000007 +#define GPIO_PIN15_INT_TYPE_M ((GPIO_PIN15_INT_TYPE_V)<<(GPIO_PIN15_INT_TYPE_S)) +#define GPIO_PIN15_INT_TYPE_V 0x7 +#define GPIO_PIN15_INT_TYPE_S 7 +/* GPIO_PIN15_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN15_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN15_SYNC1_BYPASS_M ((GPIO_PIN15_SYNC1_BYPASS_V)<<(GPIO_PIN15_SYNC1_BYPASS_S)) +#define GPIO_PIN15_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN15_SYNC1_BYPASS_S 3 +/* GPIO_PIN15_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN15_PAD_DRIVER (BIT(2)) +#define GPIO_PIN15_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN15_PAD_DRIVER_V 0x1 +#define GPIO_PIN15_PAD_DRIVER_S 2 +/* GPIO_PIN15_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN15_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN15_SYNC2_BYPASS_M ((GPIO_PIN15_SYNC2_BYPASS_V)<<(GPIO_PIN15_SYNC2_BYPASS_S)) +#define GPIO_PIN15_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN15_SYNC2_BYPASS_S 0 + +#define GPIO_PIN16_REG (DR_REG_GPIO_BASE + 0xB4) +/* GPIO_PIN16_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN16_INT_ENA 0x0000001F +#define GPIO_PIN16_INT_ENA_M ((GPIO_PIN16_INT_ENA_V)<<(GPIO_PIN16_INT_ENA_S)) +#define GPIO_PIN16_INT_ENA_V 0x1F +#define GPIO_PIN16_INT_ENA_S 13 +/* GPIO_PIN16_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN16_CONFIG 0x00000003 +#define GPIO_PIN16_CONFIG_M ((GPIO_PIN16_CONFIG_V)<<(GPIO_PIN16_CONFIG_S)) +#define GPIO_PIN16_CONFIG_V 0x3 +#define GPIO_PIN16_CONFIG_S 11 +/* GPIO_PIN16_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN16_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN16_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN16_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN16_WAKEUP_ENABLE_S 10 +/* GPIO_PIN16_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN16_INT_TYPE 0x00000007 +#define GPIO_PIN16_INT_TYPE_M ((GPIO_PIN16_INT_TYPE_V)<<(GPIO_PIN16_INT_TYPE_S)) +#define GPIO_PIN16_INT_TYPE_V 0x7 +#define GPIO_PIN16_INT_TYPE_S 7 +/* GPIO_PIN16_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN16_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN16_SYNC1_BYPASS_M ((GPIO_PIN16_SYNC1_BYPASS_V)<<(GPIO_PIN16_SYNC1_BYPASS_S)) +#define GPIO_PIN16_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN16_SYNC1_BYPASS_S 3 +/* GPIO_PIN16_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN16_PAD_DRIVER (BIT(2)) +#define GPIO_PIN16_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN16_PAD_DRIVER_V 0x1 +#define GPIO_PIN16_PAD_DRIVER_S 2 +/* GPIO_PIN16_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN16_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN16_SYNC2_BYPASS_M ((GPIO_PIN16_SYNC2_BYPASS_V)<<(GPIO_PIN16_SYNC2_BYPASS_S)) +#define GPIO_PIN16_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN16_SYNC2_BYPASS_S 0 + +#define GPIO_PIN17_REG (DR_REG_GPIO_BASE + 0xB8) +/* GPIO_PIN17_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN17_INT_ENA 0x0000001F +#define GPIO_PIN17_INT_ENA_M ((GPIO_PIN17_INT_ENA_V)<<(GPIO_PIN17_INT_ENA_S)) +#define GPIO_PIN17_INT_ENA_V 0x1F +#define GPIO_PIN17_INT_ENA_S 13 +/* GPIO_PIN17_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN17_CONFIG 0x00000003 +#define GPIO_PIN17_CONFIG_M ((GPIO_PIN17_CONFIG_V)<<(GPIO_PIN17_CONFIG_S)) +#define GPIO_PIN17_CONFIG_V 0x3 +#define GPIO_PIN17_CONFIG_S 11 +/* GPIO_PIN17_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN17_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN17_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN17_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN17_WAKEUP_ENABLE_S 10 +/* GPIO_PIN17_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN17_INT_TYPE 0x00000007 +#define GPIO_PIN17_INT_TYPE_M ((GPIO_PIN17_INT_TYPE_V)<<(GPIO_PIN17_INT_TYPE_S)) +#define GPIO_PIN17_INT_TYPE_V 0x7 +#define GPIO_PIN17_INT_TYPE_S 7 +/* GPIO_PIN17_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN17_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN17_SYNC1_BYPASS_M ((GPIO_PIN17_SYNC1_BYPASS_V)<<(GPIO_PIN17_SYNC1_BYPASS_S)) +#define GPIO_PIN17_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN17_SYNC1_BYPASS_S 3 +/* GPIO_PIN17_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN17_PAD_DRIVER (BIT(2)) +#define GPIO_PIN17_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN17_PAD_DRIVER_V 0x1 +#define GPIO_PIN17_PAD_DRIVER_S 2 +/* GPIO_PIN17_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN17_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN17_SYNC2_BYPASS_M ((GPIO_PIN17_SYNC2_BYPASS_V)<<(GPIO_PIN17_SYNC2_BYPASS_S)) +#define GPIO_PIN17_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN17_SYNC2_BYPASS_S 0 + +#define GPIO_PIN18_REG (DR_REG_GPIO_BASE + 0xBC) +/* GPIO_PIN18_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN18_INT_ENA 0x0000001F +#define GPIO_PIN18_INT_ENA_M ((GPIO_PIN18_INT_ENA_V)<<(GPIO_PIN18_INT_ENA_S)) +#define GPIO_PIN18_INT_ENA_V 0x1F +#define GPIO_PIN18_INT_ENA_S 13 +/* GPIO_PIN18_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN18_CONFIG 0x00000003 +#define GPIO_PIN18_CONFIG_M ((GPIO_PIN18_CONFIG_V)<<(GPIO_PIN18_CONFIG_S)) +#define GPIO_PIN18_CONFIG_V 0x3 +#define GPIO_PIN18_CONFIG_S 11 +/* GPIO_PIN18_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN18_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN18_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN18_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN18_WAKEUP_ENABLE_S 10 +/* GPIO_PIN18_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN18_INT_TYPE 0x00000007 +#define GPIO_PIN18_INT_TYPE_M ((GPIO_PIN18_INT_TYPE_V)<<(GPIO_PIN18_INT_TYPE_S)) +#define GPIO_PIN18_INT_TYPE_V 0x7 +#define GPIO_PIN18_INT_TYPE_S 7 +/* GPIO_PIN18_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN18_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN18_SYNC1_BYPASS_M ((GPIO_PIN18_SYNC1_BYPASS_V)<<(GPIO_PIN18_SYNC1_BYPASS_S)) +#define GPIO_PIN18_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN18_SYNC1_BYPASS_S 3 +/* GPIO_PIN18_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN18_PAD_DRIVER (BIT(2)) +#define GPIO_PIN18_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN18_PAD_DRIVER_V 0x1 +#define GPIO_PIN18_PAD_DRIVER_S 2 +/* GPIO_PIN18_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN18_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN18_SYNC2_BYPASS_M ((GPIO_PIN18_SYNC2_BYPASS_V)<<(GPIO_PIN18_SYNC2_BYPASS_S)) +#define GPIO_PIN18_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN18_SYNC2_BYPASS_S 0 + +#define GPIO_PIN19_REG (DR_REG_GPIO_BASE + 0xC0) +/* GPIO_PIN19_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN19_INT_ENA 0x0000001F +#define GPIO_PIN19_INT_ENA_M ((GPIO_PIN19_INT_ENA_V)<<(GPIO_PIN19_INT_ENA_S)) +#define GPIO_PIN19_INT_ENA_V 0x1F +#define GPIO_PIN19_INT_ENA_S 13 +/* GPIO_PIN19_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN19_CONFIG 0x00000003 +#define GPIO_PIN19_CONFIG_M ((GPIO_PIN19_CONFIG_V)<<(GPIO_PIN19_CONFIG_S)) +#define GPIO_PIN19_CONFIG_V 0x3 +#define GPIO_PIN19_CONFIG_S 11 +/* GPIO_PIN19_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN19_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN19_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN19_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN19_WAKEUP_ENABLE_S 10 +/* GPIO_PIN19_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN19_INT_TYPE 0x00000007 +#define GPIO_PIN19_INT_TYPE_M ((GPIO_PIN19_INT_TYPE_V)<<(GPIO_PIN19_INT_TYPE_S)) +#define GPIO_PIN19_INT_TYPE_V 0x7 +#define GPIO_PIN19_INT_TYPE_S 7 +/* GPIO_PIN19_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN19_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN19_SYNC1_BYPASS_M ((GPIO_PIN19_SYNC1_BYPASS_V)<<(GPIO_PIN19_SYNC1_BYPASS_S)) +#define GPIO_PIN19_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN19_SYNC1_BYPASS_S 3 +/* GPIO_PIN19_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN19_PAD_DRIVER (BIT(2)) +#define GPIO_PIN19_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN19_PAD_DRIVER_V 0x1 +#define GPIO_PIN19_PAD_DRIVER_S 2 +/* GPIO_PIN19_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN19_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN19_SYNC2_BYPASS_M ((GPIO_PIN19_SYNC2_BYPASS_V)<<(GPIO_PIN19_SYNC2_BYPASS_S)) +#define GPIO_PIN19_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN19_SYNC2_BYPASS_S 0 + +#define GPIO_PIN20_REG (DR_REG_GPIO_BASE + 0xC4) +/* GPIO_PIN20_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN20_INT_ENA 0x0000001F +#define GPIO_PIN20_INT_ENA_M ((GPIO_PIN20_INT_ENA_V)<<(GPIO_PIN20_INT_ENA_S)) +#define GPIO_PIN20_INT_ENA_V 0x1F +#define GPIO_PIN20_INT_ENA_S 13 +/* GPIO_PIN20_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN20_CONFIG 0x00000003 +#define GPIO_PIN20_CONFIG_M ((GPIO_PIN20_CONFIG_V)<<(GPIO_PIN20_CONFIG_S)) +#define GPIO_PIN20_CONFIG_V 0x3 +#define GPIO_PIN20_CONFIG_S 11 +/* GPIO_PIN20_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN20_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN20_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN20_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN20_WAKEUP_ENABLE_S 10 +/* GPIO_PIN20_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN20_INT_TYPE 0x00000007 +#define GPIO_PIN20_INT_TYPE_M ((GPIO_PIN20_INT_TYPE_V)<<(GPIO_PIN20_INT_TYPE_S)) +#define GPIO_PIN20_INT_TYPE_V 0x7 +#define GPIO_PIN20_INT_TYPE_S 7 +/* GPIO_PIN20_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN20_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN20_SYNC1_BYPASS_M ((GPIO_PIN20_SYNC1_BYPASS_V)<<(GPIO_PIN20_SYNC1_BYPASS_S)) +#define GPIO_PIN20_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN20_SYNC1_BYPASS_S 3 +/* GPIO_PIN20_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN20_PAD_DRIVER (BIT(2)) +#define GPIO_PIN20_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN20_PAD_DRIVER_V 0x1 +#define GPIO_PIN20_PAD_DRIVER_S 2 +/* GPIO_PIN20_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN20_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN20_SYNC2_BYPASS_M ((GPIO_PIN20_SYNC2_BYPASS_V)<<(GPIO_PIN20_SYNC2_BYPASS_S)) +#define GPIO_PIN20_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN20_SYNC2_BYPASS_S 0 + +#define GPIO_PIN21_REG (DR_REG_GPIO_BASE + 0xC8) +/* GPIO_PIN21_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN21_INT_ENA 0x0000001F +#define GPIO_PIN21_INT_ENA_M ((GPIO_PIN21_INT_ENA_V)<<(GPIO_PIN21_INT_ENA_S)) +#define GPIO_PIN21_INT_ENA_V 0x1F +#define GPIO_PIN21_INT_ENA_S 13 +/* GPIO_PIN21_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN21_CONFIG 0x00000003 +#define GPIO_PIN21_CONFIG_M ((GPIO_PIN21_CONFIG_V)<<(GPIO_PIN21_CONFIG_S)) +#define GPIO_PIN21_CONFIG_V 0x3 +#define GPIO_PIN21_CONFIG_S 11 +/* GPIO_PIN21_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN21_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN21_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN21_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN21_WAKEUP_ENABLE_S 10 +/* GPIO_PIN21_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN21_INT_TYPE 0x00000007 +#define GPIO_PIN21_INT_TYPE_M ((GPIO_PIN21_INT_TYPE_V)<<(GPIO_PIN21_INT_TYPE_S)) +#define GPIO_PIN21_INT_TYPE_V 0x7 +#define GPIO_PIN21_INT_TYPE_S 7 +/* GPIO_PIN21_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN21_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN21_SYNC1_BYPASS_M ((GPIO_PIN21_SYNC1_BYPASS_V)<<(GPIO_PIN21_SYNC1_BYPASS_S)) +#define GPIO_PIN21_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN21_SYNC1_BYPASS_S 3 +/* GPIO_PIN21_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN21_PAD_DRIVER (BIT(2)) +#define GPIO_PIN21_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN21_PAD_DRIVER_V 0x1 +#define GPIO_PIN21_PAD_DRIVER_S 2 +/* GPIO_PIN21_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN21_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN21_SYNC2_BYPASS_M ((GPIO_PIN21_SYNC2_BYPASS_V)<<(GPIO_PIN21_SYNC2_BYPASS_S)) +#define GPIO_PIN21_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN21_SYNC2_BYPASS_S 0 + +#define GPIO_PIN22_REG (DR_REG_GPIO_BASE + 0xCC) +/* GPIO_PIN22_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN22_INT_ENA 0x0000001F +#define GPIO_PIN22_INT_ENA_M ((GPIO_PIN22_INT_ENA_V)<<(GPIO_PIN22_INT_ENA_S)) +#define GPIO_PIN22_INT_ENA_V 0x1F +#define GPIO_PIN22_INT_ENA_S 13 +/* GPIO_PIN22_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN22_CONFIG 0x00000003 +#define GPIO_PIN22_CONFIG_M ((GPIO_PIN22_CONFIG_V)<<(GPIO_PIN22_CONFIG_S)) +#define GPIO_PIN22_CONFIG_V 0x3 +#define GPIO_PIN22_CONFIG_S 11 +/* GPIO_PIN22_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN22_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN22_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN22_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN22_WAKEUP_ENABLE_S 10 +/* GPIO_PIN22_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN22_INT_TYPE 0x00000007 +#define GPIO_PIN22_INT_TYPE_M ((GPIO_PIN22_INT_TYPE_V)<<(GPIO_PIN22_INT_TYPE_S)) +#define GPIO_PIN22_INT_TYPE_V 0x7 +#define GPIO_PIN22_INT_TYPE_S 7 +/* GPIO_PIN22_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN22_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN22_SYNC1_BYPASS_M ((GPIO_PIN22_SYNC1_BYPASS_V)<<(GPIO_PIN22_SYNC1_BYPASS_S)) +#define GPIO_PIN22_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN22_SYNC1_BYPASS_S 3 +/* GPIO_PIN22_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN22_PAD_DRIVER (BIT(2)) +#define GPIO_PIN22_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN22_PAD_DRIVER_V 0x1 +#define GPIO_PIN22_PAD_DRIVER_S 2 +/* GPIO_PIN22_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN22_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN22_SYNC2_BYPASS_M ((GPIO_PIN22_SYNC2_BYPASS_V)<<(GPIO_PIN22_SYNC2_BYPASS_S)) +#define GPIO_PIN22_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN22_SYNC2_BYPASS_S 0 + +#define GPIO_PIN23_REG (DR_REG_GPIO_BASE + 0xD0) +/* GPIO_PIN23_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN23_INT_ENA 0x0000001F +#define GPIO_PIN23_INT_ENA_M ((GPIO_PIN23_INT_ENA_V)<<(GPIO_PIN23_INT_ENA_S)) +#define GPIO_PIN23_INT_ENA_V 0x1F +#define GPIO_PIN23_INT_ENA_S 13 +/* GPIO_PIN23_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN23_CONFIG 0x00000003 +#define GPIO_PIN23_CONFIG_M ((GPIO_PIN23_CONFIG_V)<<(GPIO_PIN23_CONFIG_S)) +#define GPIO_PIN23_CONFIG_V 0x3 +#define GPIO_PIN23_CONFIG_S 11 +/* GPIO_PIN23_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN23_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN23_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN23_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN23_WAKEUP_ENABLE_S 10 +/* GPIO_PIN23_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN23_INT_TYPE 0x00000007 +#define GPIO_PIN23_INT_TYPE_M ((GPIO_PIN23_INT_TYPE_V)<<(GPIO_PIN23_INT_TYPE_S)) +#define GPIO_PIN23_INT_TYPE_V 0x7 +#define GPIO_PIN23_INT_TYPE_S 7 +/* GPIO_PIN23_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN23_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN23_SYNC1_BYPASS_M ((GPIO_PIN23_SYNC1_BYPASS_V)<<(GPIO_PIN23_SYNC1_BYPASS_S)) +#define GPIO_PIN23_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN23_SYNC1_BYPASS_S 3 +/* GPIO_PIN23_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN23_PAD_DRIVER (BIT(2)) +#define GPIO_PIN23_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN23_PAD_DRIVER_V 0x1 +#define GPIO_PIN23_PAD_DRIVER_S 2 +/* GPIO_PIN23_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN23_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN23_SYNC2_BYPASS_M ((GPIO_PIN23_SYNC2_BYPASS_V)<<(GPIO_PIN23_SYNC2_BYPASS_S)) +#define GPIO_PIN23_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN23_SYNC2_BYPASS_S 0 + +#define GPIO_PIN24_REG (DR_REG_GPIO_BASE + 0xD4) +/* GPIO_PIN24_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN24_INT_ENA 0x0000001F +#define GPIO_PIN24_INT_ENA_M ((GPIO_PIN24_INT_ENA_V)<<(GPIO_PIN24_INT_ENA_S)) +#define GPIO_PIN24_INT_ENA_V 0x1F +#define GPIO_PIN24_INT_ENA_S 13 +/* GPIO_PIN24_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN24_CONFIG 0x00000003 +#define GPIO_PIN24_CONFIG_M ((GPIO_PIN24_CONFIG_V)<<(GPIO_PIN24_CONFIG_S)) +#define GPIO_PIN24_CONFIG_V 0x3 +#define GPIO_PIN24_CONFIG_S 11 +/* GPIO_PIN24_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN24_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN24_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN24_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN24_WAKEUP_ENABLE_S 10 +/* GPIO_PIN24_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN24_INT_TYPE 0x00000007 +#define GPIO_PIN24_INT_TYPE_M ((GPIO_PIN24_INT_TYPE_V)<<(GPIO_PIN24_INT_TYPE_S)) +#define GPIO_PIN24_INT_TYPE_V 0x7 +#define GPIO_PIN24_INT_TYPE_S 7 +/* GPIO_PIN24_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN24_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN24_SYNC1_BYPASS_M ((GPIO_PIN24_SYNC1_BYPASS_V)<<(GPIO_PIN24_SYNC1_BYPASS_S)) +#define GPIO_PIN24_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN24_SYNC1_BYPASS_S 3 +/* GPIO_PIN24_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN24_PAD_DRIVER (BIT(2)) +#define GPIO_PIN24_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN24_PAD_DRIVER_V 0x1 +#define GPIO_PIN24_PAD_DRIVER_S 2 +/* GPIO_PIN24_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN24_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN24_SYNC2_BYPASS_M ((GPIO_PIN24_SYNC2_BYPASS_V)<<(GPIO_PIN24_SYNC2_BYPASS_S)) +#define GPIO_PIN24_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN24_SYNC2_BYPASS_S 0 + +#define GPIO_PIN25_REG (DR_REG_GPIO_BASE + 0xD8) +/* GPIO_PIN25_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN25_INT_ENA 0x0000001F +#define GPIO_PIN25_INT_ENA_M ((GPIO_PIN25_INT_ENA_V)<<(GPIO_PIN25_INT_ENA_S)) +#define GPIO_PIN25_INT_ENA_V 0x1F +#define GPIO_PIN25_INT_ENA_S 13 +/* GPIO_PIN25_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN25_CONFIG 0x00000003 +#define GPIO_PIN25_CONFIG_M ((GPIO_PIN25_CONFIG_V)<<(GPIO_PIN25_CONFIG_S)) +#define GPIO_PIN25_CONFIG_V 0x3 +#define GPIO_PIN25_CONFIG_S 11 +/* GPIO_PIN25_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN25_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN25_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN25_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN25_WAKEUP_ENABLE_S 10 +/* GPIO_PIN25_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN25_INT_TYPE 0x00000007 +#define GPIO_PIN25_INT_TYPE_M ((GPIO_PIN25_INT_TYPE_V)<<(GPIO_PIN25_INT_TYPE_S)) +#define GPIO_PIN25_INT_TYPE_V 0x7 +#define GPIO_PIN25_INT_TYPE_S 7 +/* GPIO_PIN25_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN25_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN25_SYNC1_BYPASS_M ((GPIO_PIN25_SYNC1_BYPASS_V)<<(GPIO_PIN25_SYNC1_BYPASS_S)) +#define GPIO_PIN25_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN25_SYNC1_BYPASS_S 3 +/* GPIO_PIN25_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN25_PAD_DRIVER (BIT(2)) +#define GPIO_PIN25_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN25_PAD_DRIVER_V 0x1 +#define GPIO_PIN25_PAD_DRIVER_S 2 +/* GPIO_PIN25_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN25_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN25_SYNC2_BYPASS_M ((GPIO_PIN25_SYNC2_BYPASS_V)<<(GPIO_PIN25_SYNC2_BYPASS_S)) +#define GPIO_PIN25_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN25_SYNC2_BYPASS_S 0 + +#define GPIO_PIN26_REG (DR_REG_GPIO_BASE + 0xDC) +/* GPIO_PIN26_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN26_INT_ENA 0x0000001F +#define GPIO_PIN26_INT_ENA_M ((GPIO_PIN26_INT_ENA_V)<<(GPIO_PIN26_INT_ENA_S)) +#define GPIO_PIN26_INT_ENA_V 0x1F +#define GPIO_PIN26_INT_ENA_S 13 +/* GPIO_PIN26_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN26_CONFIG 0x00000003 +#define GPIO_PIN26_CONFIG_M ((GPIO_PIN26_CONFIG_V)<<(GPIO_PIN26_CONFIG_S)) +#define GPIO_PIN26_CONFIG_V 0x3 +#define GPIO_PIN26_CONFIG_S 11 +/* GPIO_PIN26_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN26_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN26_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN26_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN26_WAKEUP_ENABLE_S 10 +/* GPIO_PIN26_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN26_INT_TYPE 0x00000007 +#define GPIO_PIN26_INT_TYPE_M ((GPIO_PIN26_INT_TYPE_V)<<(GPIO_PIN26_INT_TYPE_S)) +#define GPIO_PIN26_INT_TYPE_V 0x7 +#define GPIO_PIN26_INT_TYPE_S 7 +/* GPIO_PIN26_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN26_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN26_SYNC1_BYPASS_M ((GPIO_PIN26_SYNC1_BYPASS_V)<<(GPIO_PIN26_SYNC1_BYPASS_S)) +#define GPIO_PIN26_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN26_SYNC1_BYPASS_S 3 +/* GPIO_PIN26_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN26_PAD_DRIVER (BIT(2)) +#define GPIO_PIN26_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN26_PAD_DRIVER_V 0x1 +#define GPIO_PIN26_PAD_DRIVER_S 2 +/* GPIO_PIN26_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN26_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN26_SYNC2_BYPASS_M ((GPIO_PIN26_SYNC2_BYPASS_V)<<(GPIO_PIN26_SYNC2_BYPASS_S)) +#define GPIO_PIN26_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN26_SYNC2_BYPASS_S 0 + +#define GPIO_PIN27_REG (DR_REG_GPIO_BASE + 0xE0) +/* GPIO_PIN27_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN27_INT_ENA 0x0000001F +#define GPIO_PIN27_INT_ENA_M ((GPIO_PIN27_INT_ENA_V)<<(GPIO_PIN27_INT_ENA_S)) +#define GPIO_PIN27_INT_ENA_V 0x1F +#define GPIO_PIN27_INT_ENA_S 13 +/* GPIO_PIN27_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN27_CONFIG 0x00000003 +#define GPIO_PIN27_CONFIG_M ((GPIO_PIN27_CONFIG_V)<<(GPIO_PIN27_CONFIG_S)) +#define GPIO_PIN27_CONFIG_V 0x3 +#define GPIO_PIN27_CONFIG_S 11 +/* GPIO_PIN27_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN27_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN27_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN27_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN27_WAKEUP_ENABLE_S 10 +/* GPIO_PIN27_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN27_INT_TYPE 0x00000007 +#define GPIO_PIN27_INT_TYPE_M ((GPIO_PIN27_INT_TYPE_V)<<(GPIO_PIN27_INT_TYPE_S)) +#define GPIO_PIN27_INT_TYPE_V 0x7 +#define GPIO_PIN27_INT_TYPE_S 7 +/* GPIO_PIN27_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN27_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN27_SYNC1_BYPASS_M ((GPIO_PIN27_SYNC1_BYPASS_V)<<(GPIO_PIN27_SYNC1_BYPASS_S)) +#define GPIO_PIN27_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN27_SYNC1_BYPASS_S 3 +/* GPIO_PIN27_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN27_PAD_DRIVER (BIT(2)) +#define GPIO_PIN27_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN27_PAD_DRIVER_V 0x1 +#define GPIO_PIN27_PAD_DRIVER_S 2 +/* GPIO_PIN27_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN27_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN27_SYNC2_BYPASS_M ((GPIO_PIN27_SYNC2_BYPASS_V)<<(GPIO_PIN27_SYNC2_BYPASS_S)) +#define GPIO_PIN27_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN27_SYNC2_BYPASS_S 0 + +#define GPIO_PIN28_REG (DR_REG_GPIO_BASE + 0xE4) +/* GPIO_PIN28_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN28_INT_ENA 0x0000001F +#define GPIO_PIN28_INT_ENA_M ((GPIO_PIN28_INT_ENA_V)<<(GPIO_PIN28_INT_ENA_S)) +#define GPIO_PIN28_INT_ENA_V 0x1F +#define GPIO_PIN28_INT_ENA_S 13 +/* GPIO_PIN28_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN28_CONFIG 0x00000003 +#define GPIO_PIN28_CONFIG_M ((GPIO_PIN28_CONFIG_V)<<(GPIO_PIN28_CONFIG_S)) +#define GPIO_PIN28_CONFIG_V 0x3 +#define GPIO_PIN28_CONFIG_S 11 +/* GPIO_PIN28_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN28_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN28_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN28_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN28_WAKEUP_ENABLE_S 10 +/* GPIO_PIN28_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN28_INT_TYPE 0x00000007 +#define GPIO_PIN28_INT_TYPE_M ((GPIO_PIN28_INT_TYPE_V)<<(GPIO_PIN28_INT_TYPE_S)) +#define GPIO_PIN28_INT_TYPE_V 0x7 +#define GPIO_PIN28_INT_TYPE_S 7 +/* GPIO_PIN28_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN28_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN28_SYNC1_BYPASS_M ((GPIO_PIN28_SYNC1_BYPASS_V)<<(GPIO_PIN28_SYNC1_BYPASS_S)) +#define GPIO_PIN28_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN28_SYNC1_BYPASS_S 3 +/* GPIO_PIN28_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN28_PAD_DRIVER (BIT(2)) +#define GPIO_PIN28_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN28_PAD_DRIVER_V 0x1 +#define GPIO_PIN28_PAD_DRIVER_S 2 +/* GPIO_PIN28_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN28_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN28_SYNC2_BYPASS_M ((GPIO_PIN28_SYNC2_BYPASS_V)<<(GPIO_PIN28_SYNC2_BYPASS_S)) +#define GPIO_PIN28_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN28_SYNC2_BYPASS_S 0 + +#define GPIO_PIN29_REG (DR_REG_GPIO_BASE + 0xE8) +/* GPIO_PIN29_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN29_INT_ENA 0x0000001F +#define GPIO_PIN29_INT_ENA_M ((GPIO_PIN29_INT_ENA_V)<<(GPIO_PIN29_INT_ENA_S)) +#define GPIO_PIN29_INT_ENA_V 0x1F +#define GPIO_PIN29_INT_ENA_S 13 +/* GPIO_PIN29_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN29_CONFIG 0x00000003 +#define GPIO_PIN29_CONFIG_M ((GPIO_PIN29_CONFIG_V)<<(GPIO_PIN29_CONFIG_S)) +#define GPIO_PIN29_CONFIG_V 0x3 +#define GPIO_PIN29_CONFIG_S 11 +/* GPIO_PIN29_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN29_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN29_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN29_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN29_WAKEUP_ENABLE_S 10 +/* GPIO_PIN29_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN29_INT_TYPE 0x00000007 +#define GPIO_PIN29_INT_TYPE_M ((GPIO_PIN29_INT_TYPE_V)<<(GPIO_PIN29_INT_TYPE_S)) +#define GPIO_PIN29_INT_TYPE_V 0x7 +#define GPIO_PIN29_INT_TYPE_S 7 +/* GPIO_PIN29_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN29_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN29_SYNC1_BYPASS_M ((GPIO_PIN29_SYNC1_BYPASS_V)<<(GPIO_PIN29_SYNC1_BYPASS_S)) +#define GPIO_PIN29_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN29_SYNC1_BYPASS_S 3 +/* GPIO_PIN29_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN29_PAD_DRIVER (BIT(2)) +#define GPIO_PIN29_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN29_PAD_DRIVER_V 0x1 +#define GPIO_PIN29_PAD_DRIVER_S 2 +/* GPIO_PIN29_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN29_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN29_SYNC2_BYPASS_M ((GPIO_PIN29_SYNC2_BYPASS_V)<<(GPIO_PIN29_SYNC2_BYPASS_S)) +#define GPIO_PIN29_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN29_SYNC2_BYPASS_S 0 + +#define GPIO_PIN30_REG (DR_REG_GPIO_BASE + 0xEC) +/* GPIO_PIN30_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN30_INT_ENA 0x0000001F +#define GPIO_PIN30_INT_ENA_M ((GPIO_PIN30_INT_ENA_V)<<(GPIO_PIN30_INT_ENA_S)) +#define GPIO_PIN30_INT_ENA_V 0x1F +#define GPIO_PIN30_INT_ENA_S 13 +/* GPIO_PIN30_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN30_CONFIG 0x00000003 +#define GPIO_PIN30_CONFIG_M ((GPIO_PIN30_CONFIG_V)<<(GPIO_PIN30_CONFIG_S)) +#define GPIO_PIN30_CONFIG_V 0x3 +#define GPIO_PIN30_CONFIG_S 11 +/* GPIO_PIN30_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN30_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN30_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN30_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN30_WAKEUP_ENABLE_S 10 +/* GPIO_PIN30_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN30_INT_TYPE 0x00000007 +#define GPIO_PIN30_INT_TYPE_M ((GPIO_PIN30_INT_TYPE_V)<<(GPIO_PIN30_INT_TYPE_S)) +#define GPIO_PIN30_INT_TYPE_V 0x7 +#define GPIO_PIN30_INT_TYPE_S 7 +/* GPIO_PIN30_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN30_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN30_SYNC1_BYPASS_M ((GPIO_PIN30_SYNC1_BYPASS_V)<<(GPIO_PIN30_SYNC1_BYPASS_S)) +#define GPIO_PIN30_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN30_SYNC1_BYPASS_S 3 +/* GPIO_PIN30_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN30_PAD_DRIVER (BIT(2)) +#define GPIO_PIN30_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN30_PAD_DRIVER_V 0x1 +#define GPIO_PIN30_PAD_DRIVER_S 2 +/* GPIO_PIN30_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN30_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN30_SYNC2_BYPASS_M ((GPIO_PIN30_SYNC2_BYPASS_V)<<(GPIO_PIN30_SYNC2_BYPASS_S)) +#define GPIO_PIN30_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN30_SYNC2_BYPASS_S 0 + +#define GPIO_PIN31_REG (DR_REG_GPIO_BASE + 0xF0) +/* GPIO_PIN31_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN31_INT_ENA 0x0000001F +#define GPIO_PIN31_INT_ENA_M ((GPIO_PIN31_INT_ENA_V)<<(GPIO_PIN31_INT_ENA_S)) +#define GPIO_PIN31_INT_ENA_V 0x1F +#define GPIO_PIN31_INT_ENA_S 13 +/* GPIO_PIN31_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN31_CONFIG 0x00000003 +#define GPIO_PIN31_CONFIG_M ((GPIO_PIN31_CONFIG_V)<<(GPIO_PIN31_CONFIG_S)) +#define GPIO_PIN31_CONFIG_V 0x3 +#define GPIO_PIN31_CONFIG_S 11 +/* GPIO_PIN31_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN31_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN31_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN31_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN31_WAKEUP_ENABLE_S 10 +/* GPIO_PIN31_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN31_INT_TYPE 0x00000007 +#define GPIO_PIN31_INT_TYPE_M ((GPIO_PIN31_INT_TYPE_V)<<(GPIO_PIN31_INT_TYPE_S)) +#define GPIO_PIN31_INT_TYPE_V 0x7 +#define GPIO_PIN31_INT_TYPE_S 7 +/* GPIO_PIN31_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN31_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN31_SYNC1_BYPASS_M ((GPIO_PIN31_SYNC1_BYPASS_V)<<(GPIO_PIN31_SYNC1_BYPASS_S)) +#define GPIO_PIN31_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN31_SYNC1_BYPASS_S 3 +/* GPIO_PIN31_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN31_PAD_DRIVER (BIT(2)) +#define GPIO_PIN31_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN31_PAD_DRIVER_V 0x1 +#define GPIO_PIN31_PAD_DRIVER_S 2 +/* GPIO_PIN31_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN31_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN31_SYNC2_BYPASS_M ((GPIO_PIN31_SYNC2_BYPASS_V)<<(GPIO_PIN31_SYNC2_BYPASS_S)) +#define GPIO_PIN31_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN31_SYNC2_BYPASS_S 0 + +#define GPIO_PIN32_REG (DR_REG_GPIO_BASE + 0xF4) +/* GPIO_PIN32_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN32_INT_ENA 0x0000001F +#define GPIO_PIN32_INT_ENA_M ((GPIO_PIN32_INT_ENA_V)<<(GPIO_PIN32_INT_ENA_S)) +#define GPIO_PIN32_INT_ENA_V 0x1F +#define GPIO_PIN32_INT_ENA_S 13 +/* GPIO_PIN32_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN32_CONFIG 0x00000003 +#define GPIO_PIN32_CONFIG_M ((GPIO_PIN32_CONFIG_V)<<(GPIO_PIN32_CONFIG_S)) +#define GPIO_PIN32_CONFIG_V 0x3 +#define GPIO_PIN32_CONFIG_S 11 +/* GPIO_PIN32_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN32_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN32_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN32_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN32_WAKEUP_ENABLE_S 10 +/* GPIO_PIN32_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN32_INT_TYPE 0x00000007 +#define GPIO_PIN32_INT_TYPE_M ((GPIO_PIN32_INT_TYPE_V)<<(GPIO_PIN32_INT_TYPE_S)) +#define GPIO_PIN32_INT_TYPE_V 0x7 +#define GPIO_PIN32_INT_TYPE_S 7 +/* GPIO_PIN32_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN32_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN32_SYNC1_BYPASS_M ((GPIO_PIN32_SYNC1_BYPASS_V)<<(GPIO_PIN32_SYNC1_BYPASS_S)) +#define GPIO_PIN32_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN32_SYNC1_BYPASS_S 3 +/* GPIO_PIN32_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN32_PAD_DRIVER (BIT(2)) +#define GPIO_PIN32_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN32_PAD_DRIVER_V 0x1 +#define GPIO_PIN32_PAD_DRIVER_S 2 +/* GPIO_PIN32_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN32_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN32_SYNC2_BYPASS_M ((GPIO_PIN32_SYNC2_BYPASS_V)<<(GPIO_PIN32_SYNC2_BYPASS_S)) +#define GPIO_PIN32_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN32_SYNC2_BYPASS_S 0 + +#define GPIO_PIN33_REG (DR_REG_GPIO_BASE + 0xF8) +/* GPIO_PIN33_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN33_INT_ENA 0x0000001F +#define GPIO_PIN33_INT_ENA_M ((GPIO_PIN33_INT_ENA_V)<<(GPIO_PIN33_INT_ENA_S)) +#define GPIO_PIN33_INT_ENA_V 0x1F +#define GPIO_PIN33_INT_ENA_S 13 +/* GPIO_PIN33_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN33_CONFIG 0x00000003 +#define GPIO_PIN33_CONFIG_M ((GPIO_PIN33_CONFIG_V)<<(GPIO_PIN33_CONFIG_S)) +#define GPIO_PIN33_CONFIG_V 0x3 +#define GPIO_PIN33_CONFIG_S 11 +/* GPIO_PIN33_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN33_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN33_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN33_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN33_WAKEUP_ENABLE_S 10 +/* GPIO_PIN33_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN33_INT_TYPE 0x00000007 +#define GPIO_PIN33_INT_TYPE_M ((GPIO_PIN33_INT_TYPE_V)<<(GPIO_PIN33_INT_TYPE_S)) +#define GPIO_PIN33_INT_TYPE_V 0x7 +#define GPIO_PIN33_INT_TYPE_S 7 +/* GPIO_PIN33_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN33_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN33_SYNC1_BYPASS_M ((GPIO_PIN33_SYNC1_BYPASS_V)<<(GPIO_PIN33_SYNC1_BYPASS_S)) +#define GPIO_PIN33_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN33_SYNC1_BYPASS_S 3 +/* GPIO_PIN33_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN33_PAD_DRIVER (BIT(2)) +#define GPIO_PIN33_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN33_PAD_DRIVER_V 0x1 +#define GPIO_PIN33_PAD_DRIVER_S 2 +/* GPIO_PIN33_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN33_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN33_SYNC2_BYPASS_M ((GPIO_PIN33_SYNC2_BYPASS_V)<<(GPIO_PIN33_SYNC2_BYPASS_S)) +#define GPIO_PIN33_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN33_SYNC2_BYPASS_S 0 + +#define GPIO_PIN34_REG (DR_REG_GPIO_BASE + 0xFC) +/* GPIO_PIN34_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN34_INT_ENA 0x0000001F +#define GPIO_PIN34_INT_ENA_M ((GPIO_PIN34_INT_ENA_V)<<(GPIO_PIN34_INT_ENA_S)) +#define GPIO_PIN34_INT_ENA_V 0x1F +#define GPIO_PIN34_INT_ENA_S 13 +/* GPIO_PIN34_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN34_CONFIG 0x00000003 +#define GPIO_PIN34_CONFIG_M ((GPIO_PIN34_CONFIG_V)<<(GPIO_PIN34_CONFIG_S)) +#define GPIO_PIN34_CONFIG_V 0x3 +#define GPIO_PIN34_CONFIG_S 11 +/* GPIO_PIN34_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN34_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN34_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN34_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN34_WAKEUP_ENABLE_S 10 +/* GPIO_PIN34_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN34_INT_TYPE 0x00000007 +#define GPIO_PIN34_INT_TYPE_M ((GPIO_PIN34_INT_TYPE_V)<<(GPIO_PIN34_INT_TYPE_S)) +#define GPIO_PIN34_INT_TYPE_V 0x7 +#define GPIO_PIN34_INT_TYPE_S 7 +/* GPIO_PIN34_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN34_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN34_SYNC1_BYPASS_M ((GPIO_PIN34_SYNC1_BYPASS_V)<<(GPIO_PIN34_SYNC1_BYPASS_S)) +#define GPIO_PIN34_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN34_SYNC1_BYPASS_S 3 +/* GPIO_PIN34_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN34_PAD_DRIVER (BIT(2)) +#define GPIO_PIN34_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN34_PAD_DRIVER_V 0x1 +#define GPIO_PIN34_PAD_DRIVER_S 2 +/* GPIO_PIN34_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN34_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN34_SYNC2_BYPASS_M ((GPIO_PIN34_SYNC2_BYPASS_V)<<(GPIO_PIN34_SYNC2_BYPASS_S)) +#define GPIO_PIN34_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN34_SYNC2_BYPASS_S 0 + +#define GPIO_PIN35_REG (DR_REG_GPIO_BASE + 0x100) +/* GPIO_PIN35_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN35_INT_ENA 0x0000001F +#define GPIO_PIN35_INT_ENA_M ((GPIO_PIN35_INT_ENA_V)<<(GPIO_PIN35_INT_ENA_S)) +#define GPIO_PIN35_INT_ENA_V 0x1F +#define GPIO_PIN35_INT_ENA_S 13 +/* GPIO_PIN35_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN35_CONFIG 0x00000003 +#define GPIO_PIN35_CONFIG_M ((GPIO_PIN35_CONFIG_V)<<(GPIO_PIN35_CONFIG_S)) +#define GPIO_PIN35_CONFIG_V 0x3 +#define GPIO_PIN35_CONFIG_S 11 +/* GPIO_PIN35_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN35_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN35_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN35_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN35_WAKEUP_ENABLE_S 10 +/* GPIO_PIN35_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN35_INT_TYPE 0x00000007 +#define GPIO_PIN35_INT_TYPE_M ((GPIO_PIN35_INT_TYPE_V)<<(GPIO_PIN35_INT_TYPE_S)) +#define GPIO_PIN35_INT_TYPE_V 0x7 +#define GPIO_PIN35_INT_TYPE_S 7 +/* GPIO_PIN35_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN35_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN35_SYNC1_BYPASS_M ((GPIO_PIN35_SYNC1_BYPASS_V)<<(GPIO_PIN35_SYNC1_BYPASS_S)) +#define GPIO_PIN35_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN35_SYNC1_BYPASS_S 3 +/* GPIO_PIN35_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN35_PAD_DRIVER (BIT(2)) +#define GPIO_PIN35_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN35_PAD_DRIVER_V 0x1 +#define GPIO_PIN35_PAD_DRIVER_S 2 +/* GPIO_PIN35_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN35_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN35_SYNC2_BYPASS_M ((GPIO_PIN35_SYNC2_BYPASS_V)<<(GPIO_PIN35_SYNC2_BYPASS_S)) +#define GPIO_PIN35_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN35_SYNC2_BYPASS_S 0 + +#define GPIO_PIN36_REG (DR_REG_GPIO_BASE + 0x104) +/* GPIO_PIN36_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN36_INT_ENA 0x0000001F +#define GPIO_PIN36_INT_ENA_M ((GPIO_PIN36_INT_ENA_V)<<(GPIO_PIN36_INT_ENA_S)) +#define GPIO_PIN36_INT_ENA_V 0x1F +#define GPIO_PIN36_INT_ENA_S 13 +/* GPIO_PIN36_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN36_CONFIG 0x00000003 +#define GPIO_PIN36_CONFIG_M ((GPIO_PIN36_CONFIG_V)<<(GPIO_PIN36_CONFIG_S)) +#define GPIO_PIN36_CONFIG_V 0x3 +#define GPIO_PIN36_CONFIG_S 11 +/* GPIO_PIN36_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN36_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN36_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN36_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN36_WAKEUP_ENABLE_S 10 +/* GPIO_PIN36_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN36_INT_TYPE 0x00000007 +#define GPIO_PIN36_INT_TYPE_M ((GPIO_PIN36_INT_TYPE_V)<<(GPIO_PIN36_INT_TYPE_S)) +#define GPIO_PIN36_INT_TYPE_V 0x7 +#define GPIO_PIN36_INT_TYPE_S 7 +/* GPIO_PIN36_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN36_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN36_SYNC1_BYPASS_M ((GPIO_PIN36_SYNC1_BYPASS_V)<<(GPIO_PIN36_SYNC1_BYPASS_S)) +#define GPIO_PIN36_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN36_SYNC1_BYPASS_S 3 +/* GPIO_PIN36_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN36_PAD_DRIVER (BIT(2)) +#define GPIO_PIN36_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN36_PAD_DRIVER_V 0x1 +#define GPIO_PIN36_PAD_DRIVER_S 2 +/* GPIO_PIN36_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN36_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN36_SYNC2_BYPASS_M ((GPIO_PIN36_SYNC2_BYPASS_V)<<(GPIO_PIN36_SYNC2_BYPASS_S)) +#define GPIO_PIN36_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN36_SYNC2_BYPASS_S 0 + +#define GPIO_PIN37_REG (DR_REG_GPIO_BASE + 0x108) +/* GPIO_PIN37_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN37_INT_ENA 0x0000001F +#define GPIO_PIN37_INT_ENA_M ((GPIO_PIN37_INT_ENA_V)<<(GPIO_PIN37_INT_ENA_S)) +#define GPIO_PIN37_INT_ENA_V 0x1F +#define GPIO_PIN37_INT_ENA_S 13 +/* GPIO_PIN37_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN37_CONFIG 0x00000003 +#define GPIO_PIN37_CONFIG_M ((GPIO_PIN37_CONFIG_V)<<(GPIO_PIN37_CONFIG_S)) +#define GPIO_PIN37_CONFIG_V 0x3 +#define GPIO_PIN37_CONFIG_S 11 +/* GPIO_PIN37_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN37_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN37_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN37_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN37_WAKEUP_ENABLE_S 10 +/* GPIO_PIN37_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN37_INT_TYPE 0x00000007 +#define GPIO_PIN37_INT_TYPE_M ((GPIO_PIN37_INT_TYPE_V)<<(GPIO_PIN37_INT_TYPE_S)) +#define GPIO_PIN37_INT_TYPE_V 0x7 +#define GPIO_PIN37_INT_TYPE_S 7 +/* GPIO_PIN37_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN37_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN37_SYNC1_BYPASS_M ((GPIO_PIN37_SYNC1_BYPASS_V)<<(GPIO_PIN37_SYNC1_BYPASS_S)) +#define GPIO_PIN37_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN37_SYNC1_BYPASS_S 3 +/* GPIO_PIN37_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN37_PAD_DRIVER (BIT(2)) +#define GPIO_PIN37_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN37_PAD_DRIVER_V 0x1 +#define GPIO_PIN37_PAD_DRIVER_S 2 +/* GPIO_PIN37_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN37_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN37_SYNC2_BYPASS_M ((GPIO_PIN37_SYNC2_BYPASS_V)<<(GPIO_PIN37_SYNC2_BYPASS_S)) +#define GPIO_PIN37_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN37_SYNC2_BYPASS_S 0 + +#define GPIO_PIN38_REG (DR_REG_GPIO_BASE + 0x10C) +/* GPIO_PIN38_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN38_INT_ENA 0x0000001F +#define GPIO_PIN38_INT_ENA_M ((GPIO_PIN38_INT_ENA_V)<<(GPIO_PIN38_INT_ENA_S)) +#define GPIO_PIN38_INT_ENA_V 0x1F +#define GPIO_PIN38_INT_ENA_S 13 +/* GPIO_PIN38_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN38_CONFIG 0x00000003 +#define GPIO_PIN38_CONFIG_M ((GPIO_PIN38_CONFIG_V)<<(GPIO_PIN38_CONFIG_S)) +#define GPIO_PIN38_CONFIG_V 0x3 +#define GPIO_PIN38_CONFIG_S 11 +/* GPIO_PIN38_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN38_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN38_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN38_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN38_WAKEUP_ENABLE_S 10 +/* GPIO_PIN38_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN38_INT_TYPE 0x00000007 +#define GPIO_PIN38_INT_TYPE_M ((GPIO_PIN38_INT_TYPE_V)<<(GPIO_PIN38_INT_TYPE_S)) +#define GPIO_PIN38_INT_TYPE_V 0x7 +#define GPIO_PIN38_INT_TYPE_S 7 +/* GPIO_PIN38_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN38_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN38_SYNC1_BYPASS_M ((GPIO_PIN38_SYNC1_BYPASS_V)<<(GPIO_PIN38_SYNC1_BYPASS_S)) +#define GPIO_PIN38_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN38_SYNC1_BYPASS_S 3 +/* GPIO_PIN38_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN38_PAD_DRIVER (BIT(2)) +#define GPIO_PIN38_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN38_PAD_DRIVER_V 0x1 +#define GPIO_PIN38_PAD_DRIVER_S 2 +/* GPIO_PIN38_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN38_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN38_SYNC2_BYPASS_M ((GPIO_PIN38_SYNC2_BYPASS_V)<<(GPIO_PIN38_SYNC2_BYPASS_S)) +#define GPIO_PIN38_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN38_SYNC2_BYPASS_S 0 + +#define GPIO_PIN39_REG (DR_REG_GPIO_BASE + 0x110) +/* GPIO_PIN39_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN39_INT_ENA 0x0000001F +#define GPIO_PIN39_INT_ENA_M ((GPIO_PIN39_INT_ENA_V)<<(GPIO_PIN39_INT_ENA_S)) +#define GPIO_PIN39_INT_ENA_V 0x1F +#define GPIO_PIN39_INT_ENA_S 13 +/* GPIO_PIN39_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN39_CONFIG 0x00000003 +#define GPIO_PIN39_CONFIG_M ((GPIO_PIN39_CONFIG_V)<<(GPIO_PIN39_CONFIG_S)) +#define GPIO_PIN39_CONFIG_V 0x3 +#define GPIO_PIN39_CONFIG_S 11 +/* GPIO_PIN39_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN39_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN39_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN39_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN39_WAKEUP_ENABLE_S 10 +/* GPIO_PIN39_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN39_INT_TYPE 0x00000007 +#define GPIO_PIN39_INT_TYPE_M ((GPIO_PIN39_INT_TYPE_V)<<(GPIO_PIN39_INT_TYPE_S)) +#define GPIO_PIN39_INT_TYPE_V 0x7 +#define GPIO_PIN39_INT_TYPE_S 7 +/* GPIO_PIN39_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN39_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN39_SYNC1_BYPASS_M ((GPIO_PIN39_SYNC1_BYPASS_V)<<(GPIO_PIN39_SYNC1_BYPASS_S)) +#define GPIO_PIN39_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN39_SYNC1_BYPASS_S 3 +/* GPIO_PIN39_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN39_PAD_DRIVER (BIT(2)) +#define GPIO_PIN39_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN39_PAD_DRIVER_V 0x1 +#define GPIO_PIN39_PAD_DRIVER_S 2 +/* GPIO_PIN39_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN39_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN39_SYNC2_BYPASS_M ((GPIO_PIN39_SYNC2_BYPASS_V)<<(GPIO_PIN39_SYNC2_BYPASS_S)) +#define GPIO_PIN39_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN39_SYNC2_BYPASS_S 0 + +#define GPIO_PIN40_REG (DR_REG_GPIO_BASE + 0x114) +/* GPIO_PIN40_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN40_INT_ENA 0x0000001F +#define GPIO_PIN40_INT_ENA_M ((GPIO_PIN40_INT_ENA_V)<<(GPIO_PIN40_INT_ENA_S)) +#define GPIO_PIN40_INT_ENA_V 0x1F +#define GPIO_PIN40_INT_ENA_S 13 +/* GPIO_PIN40_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN40_CONFIG 0x00000003 +#define GPIO_PIN40_CONFIG_M ((GPIO_PIN40_CONFIG_V)<<(GPIO_PIN40_CONFIG_S)) +#define GPIO_PIN40_CONFIG_V 0x3 +#define GPIO_PIN40_CONFIG_S 11 +/* GPIO_PIN40_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN40_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN40_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN40_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN40_WAKEUP_ENABLE_S 10 +/* GPIO_PIN40_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN40_INT_TYPE 0x00000007 +#define GPIO_PIN40_INT_TYPE_M ((GPIO_PIN40_INT_TYPE_V)<<(GPIO_PIN40_INT_TYPE_S)) +#define GPIO_PIN40_INT_TYPE_V 0x7 +#define GPIO_PIN40_INT_TYPE_S 7 +/* GPIO_PIN40_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN40_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN40_SYNC1_BYPASS_M ((GPIO_PIN40_SYNC1_BYPASS_V)<<(GPIO_PIN40_SYNC1_BYPASS_S)) +#define GPIO_PIN40_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN40_SYNC1_BYPASS_S 3 +/* GPIO_PIN40_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN40_PAD_DRIVER (BIT(2)) +#define GPIO_PIN40_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN40_PAD_DRIVER_V 0x1 +#define GPIO_PIN40_PAD_DRIVER_S 2 +/* GPIO_PIN40_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN40_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN40_SYNC2_BYPASS_M ((GPIO_PIN40_SYNC2_BYPASS_V)<<(GPIO_PIN40_SYNC2_BYPASS_S)) +#define GPIO_PIN40_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN40_SYNC2_BYPASS_S 0 + +#define GPIO_PIN41_REG (DR_REG_GPIO_BASE + 0x118) +/* GPIO_PIN41_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN41_INT_ENA 0x0000001F +#define GPIO_PIN41_INT_ENA_M ((GPIO_PIN41_INT_ENA_V)<<(GPIO_PIN41_INT_ENA_S)) +#define GPIO_PIN41_INT_ENA_V 0x1F +#define GPIO_PIN41_INT_ENA_S 13 +/* GPIO_PIN41_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN41_CONFIG 0x00000003 +#define GPIO_PIN41_CONFIG_M ((GPIO_PIN41_CONFIG_V)<<(GPIO_PIN41_CONFIG_S)) +#define GPIO_PIN41_CONFIG_V 0x3 +#define GPIO_PIN41_CONFIG_S 11 +/* GPIO_PIN41_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN41_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN41_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN41_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN41_WAKEUP_ENABLE_S 10 +/* GPIO_PIN41_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN41_INT_TYPE 0x00000007 +#define GPIO_PIN41_INT_TYPE_M ((GPIO_PIN41_INT_TYPE_V)<<(GPIO_PIN41_INT_TYPE_S)) +#define GPIO_PIN41_INT_TYPE_V 0x7 +#define GPIO_PIN41_INT_TYPE_S 7 +/* GPIO_PIN41_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN41_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN41_SYNC1_BYPASS_M ((GPIO_PIN41_SYNC1_BYPASS_V)<<(GPIO_PIN41_SYNC1_BYPASS_S)) +#define GPIO_PIN41_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN41_SYNC1_BYPASS_S 3 +/* GPIO_PIN41_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN41_PAD_DRIVER (BIT(2)) +#define GPIO_PIN41_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN41_PAD_DRIVER_V 0x1 +#define GPIO_PIN41_PAD_DRIVER_S 2 +/* GPIO_PIN41_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN41_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN41_SYNC2_BYPASS_M ((GPIO_PIN41_SYNC2_BYPASS_V)<<(GPIO_PIN41_SYNC2_BYPASS_S)) +#define GPIO_PIN41_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN41_SYNC2_BYPASS_S 0 + +#define GPIO_PIN42_REG (DR_REG_GPIO_BASE + 0x11C) +/* GPIO_PIN42_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN42_INT_ENA 0x0000001F +#define GPIO_PIN42_INT_ENA_M ((GPIO_PIN42_INT_ENA_V)<<(GPIO_PIN42_INT_ENA_S)) +#define GPIO_PIN42_INT_ENA_V 0x1F +#define GPIO_PIN42_INT_ENA_S 13 +/* GPIO_PIN42_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN42_CONFIG 0x00000003 +#define GPIO_PIN42_CONFIG_M ((GPIO_PIN42_CONFIG_V)<<(GPIO_PIN42_CONFIG_S)) +#define GPIO_PIN42_CONFIG_V 0x3 +#define GPIO_PIN42_CONFIG_S 11 +/* GPIO_PIN42_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN42_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN42_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN42_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN42_WAKEUP_ENABLE_S 10 +/* GPIO_PIN42_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN42_INT_TYPE 0x00000007 +#define GPIO_PIN42_INT_TYPE_M ((GPIO_PIN42_INT_TYPE_V)<<(GPIO_PIN42_INT_TYPE_S)) +#define GPIO_PIN42_INT_TYPE_V 0x7 +#define GPIO_PIN42_INT_TYPE_S 7 +/* GPIO_PIN42_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN42_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN42_SYNC1_BYPASS_M ((GPIO_PIN42_SYNC1_BYPASS_V)<<(GPIO_PIN42_SYNC1_BYPASS_S)) +#define GPIO_PIN42_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN42_SYNC1_BYPASS_S 3 +/* GPIO_PIN42_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN42_PAD_DRIVER (BIT(2)) +#define GPIO_PIN42_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN42_PAD_DRIVER_V 0x1 +#define GPIO_PIN42_PAD_DRIVER_S 2 +/* GPIO_PIN42_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN42_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN42_SYNC2_BYPASS_M ((GPIO_PIN42_SYNC2_BYPASS_V)<<(GPIO_PIN42_SYNC2_BYPASS_S)) +#define GPIO_PIN42_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN42_SYNC2_BYPASS_S 0 + +#define GPIO_PIN43_REG (DR_REG_GPIO_BASE + 0x120) +/* GPIO_PIN43_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN43_INT_ENA 0x0000001F +#define GPIO_PIN43_INT_ENA_M ((GPIO_PIN43_INT_ENA_V)<<(GPIO_PIN43_INT_ENA_S)) +#define GPIO_PIN43_INT_ENA_V 0x1F +#define GPIO_PIN43_INT_ENA_S 13 +/* GPIO_PIN43_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN43_CONFIG 0x00000003 +#define GPIO_PIN43_CONFIG_M ((GPIO_PIN43_CONFIG_V)<<(GPIO_PIN43_CONFIG_S)) +#define GPIO_PIN43_CONFIG_V 0x3 +#define GPIO_PIN43_CONFIG_S 11 +/* GPIO_PIN43_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN43_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN43_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN43_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN43_WAKEUP_ENABLE_S 10 +/* GPIO_PIN43_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN43_INT_TYPE 0x00000007 +#define GPIO_PIN43_INT_TYPE_M ((GPIO_PIN43_INT_TYPE_V)<<(GPIO_PIN43_INT_TYPE_S)) +#define GPIO_PIN43_INT_TYPE_V 0x7 +#define GPIO_PIN43_INT_TYPE_S 7 +/* GPIO_PIN43_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN43_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN43_SYNC1_BYPASS_M ((GPIO_PIN43_SYNC1_BYPASS_V)<<(GPIO_PIN43_SYNC1_BYPASS_S)) +#define GPIO_PIN43_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN43_SYNC1_BYPASS_S 3 +/* GPIO_PIN43_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN43_PAD_DRIVER (BIT(2)) +#define GPIO_PIN43_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN43_PAD_DRIVER_V 0x1 +#define GPIO_PIN43_PAD_DRIVER_S 2 +/* GPIO_PIN43_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN43_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN43_SYNC2_BYPASS_M ((GPIO_PIN43_SYNC2_BYPASS_V)<<(GPIO_PIN43_SYNC2_BYPASS_S)) +#define GPIO_PIN43_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN43_SYNC2_BYPASS_S 0 + +#define GPIO_PIN44_REG (DR_REG_GPIO_BASE + 0x124) +/* GPIO_PIN44_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN44_INT_ENA 0x0000001F +#define GPIO_PIN44_INT_ENA_M ((GPIO_PIN44_INT_ENA_V)<<(GPIO_PIN44_INT_ENA_S)) +#define GPIO_PIN44_INT_ENA_V 0x1F +#define GPIO_PIN44_INT_ENA_S 13 +/* GPIO_PIN44_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN44_CONFIG 0x00000003 +#define GPIO_PIN44_CONFIG_M ((GPIO_PIN44_CONFIG_V)<<(GPIO_PIN44_CONFIG_S)) +#define GPIO_PIN44_CONFIG_V 0x3 +#define GPIO_PIN44_CONFIG_S 11 +/* GPIO_PIN44_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN44_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN44_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN44_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN44_WAKEUP_ENABLE_S 10 +/* GPIO_PIN44_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN44_INT_TYPE 0x00000007 +#define GPIO_PIN44_INT_TYPE_M ((GPIO_PIN44_INT_TYPE_V)<<(GPIO_PIN44_INT_TYPE_S)) +#define GPIO_PIN44_INT_TYPE_V 0x7 +#define GPIO_PIN44_INT_TYPE_S 7 +/* GPIO_PIN44_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN44_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN44_SYNC1_BYPASS_M ((GPIO_PIN44_SYNC1_BYPASS_V)<<(GPIO_PIN44_SYNC1_BYPASS_S)) +#define GPIO_PIN44_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN44_SYNC1_BYPASS_S 3 +/* GPIO_PIN44_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN44_PAD_DRIVER (BIT(2)) +#define GPIO_PIN44_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN44_PAD_DRIVER_V 0x1 +#define GPIO_PIN44_PAD_DRIVER_S 2 +/* GPIO_PIN44_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN44_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN44_SYNC2_BYPASS_M ((GPIO_PIN44_SYNC2_BYPASS_V)<<(GPIO_PIN44_SYNC2_BYPASS_S)) +#define GPIO_PIN44_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN44_SYNC2_BYPASS_S 0 + +#define GPIO_PIN45_REG (DR_REG_GPIO_BASE + 0x128) +/* GPIO_PIN45_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN45_INT_ENA 0x0000001F +#define GPIO_PIN45_INT_ENA_M ((GPIO_PIN45_INT_ENA_V)<<(GPIO_PIN45_INT_ENA_S)) +#define GPIO_PIN45_INT_ENA_V 0x1F +#define GPIO_PIN45_INT_ENA_S 13 +/* GPIO_PIN45_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN45_CONFIG 0x00000003 +#define GPIO_PIN45_CONFIG_M ((GPIO_PIN45_CONFIG_V)<<(GPIO_PIN45_CONFIG_S)) +#define GPIO_PIN45_CONFIG_V 0x3 +#define GPIO_PIN45_CONFIG_S 11 +/* GPIO_PIN45_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN45_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN45_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN45_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN45_WAKEUP_ENABLE_S 10 +/* GPIO_PIN45_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN45_INT_TYPE 0x00000007 +#define GPIO_PIN45_INT_TYPE_M ((GPIO_PIN45_INT_TYPE_V)<<(GPIO_PIN45_INT_TYPE_S)) +#define GPIO_PIN45_INT_TYPE_V 0x7 +#define GPIO_PIN45_INT_TYPE_S 7 +/* GPIO_PIN45_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN45_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN45_SYNC1_BYPASS_M ((GPIO_PIN45_SYNC1_BYPASS_V)<<(GPIO_PIN45_SYNC1_BYPASS_S)) +#define GPIO_PIN45_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN45_SYNC1_BYPASS_S 3 +/* GPIO_PIN45_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN45_PAD_DRIVER (BIT(2)) +#define GPIO_PIN45_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN45_PAD_DRIVER_V 0x1 +#define GPIO_PIN45_PAD_DRIVER_S 2 +/* GPIO_PIN45_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN45_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN45_SYNC2_BYPASS_M ((GPIO_PIN45_SYNC2_BYPASS_V)<<(GPIO_PIN45_SYNC2_BYPASS_S)) +#define GPIO_PIN45_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN45_SYNC2_BYPASS_S 0 + +#define GPIO_PIN46_REG (DR_REG_GPIO_BASE + 0x12C) +/* GPIO_PIN46_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN46_INT_ENA 0x0000001F +#define GPIO_PIN46_INT_ENA_M ((GPIO_PIN46_INT_ENA_V)<<(GPIO_PIN46_INT_ENA_S)) +#define GPIO_PIN46_INT_ENA_V 0x1F +#define GPIO_PIN46_INT_ENA_S 13 +/* GPIO_PIN46_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN46_CONFIG 0x00000003 +#define GPIO_PIN46_CONFIG_M ((GPIO_PIN46_CONFIG_V)<<(GPIO_PIN46_CONFIG_S)) +#define GPIO_PIN46_CONFIG_V 0x3 +#define GPIO_PIN46_CONFIG_S 11 +/* GPIO_PIN46_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN46_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN46_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN46_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN46_WAKEUP_ENABLE_S 10 +/* GPIO_PIN46_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN46_INT_TYPE 0x00000007 +#define GPIO_PIN46_INT_TYPE_M ((GPIO_PIN46_INT_TYPE_V)<<(GPIO_PIN46_INT_TYPE_S)) +#define GPIO_PIN46_INT_TYPE_V 0x7 +#define GPIO_PIN46_INT_TYPE_S 7 +/* GPIO_PIN46_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN46_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN46_SYNC1_BYPASS_M ((GPIO_PIN46_SYNC1_BYPASS_V)<<(GPIO_PIN46_SYNC1_BYPASS_S)) +#define GPIO_PIN46_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN46_SYNC1_BYPASS_S 3 +/* GPIO_PIN46_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN46_PAD_DRIVER (BIT(2)) +#define GPIO_PIN46_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN46_PAD_DRIVER_V 0x1 +#define GPIO_PIN46_PAD_DRIVER_S 2 +/* GPIO_PIN46_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN46_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN46_SYNC2_BYPASS_M ((GPIO_PIN46_SYNC2_BYPASS_V)<<(GPIO_PIN46_SYNC2_BYPASS_S)) +#define GPIO_PIN46_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN46_SYNC2_BYPASS_S 0 + +#define GPIO_PIN47_REG (DR_REG_GPIO_BASE + 0x130) +/* GPIO_PIN47_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN47_INT_ENA 0x0000001F +#define GPIO_PIN47_INT_ENA_M ((GPIO_PIN47_INT_ENA_V)<<(GPIO_PIN47_INT_ENA_S)) +#define GPIO_PIN47_INT_ENA_V 0x1F +#define GPIO_PIN47_INT_ENA_S 13 +/* GPIO_PIN47_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN47_CONFIG 0x00000003 +#define GPIO_PIN47_CONFIG_M ((GPIO_PIN47_CONFIG_V)<<(GPIO_PIN47_CONFIG_S)) +#define GPIO_PIN47_CONFIG_V 0x3 +#define GPIO_PIN47_CONFIG_S 11 +/* GPIO_PIN47_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN47_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN47_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN47_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN47_WAKEUP_ENABLE_S 10 +/* GPIO_PIN47_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN47_INT_TYPE 0x00000007 +#define GPIO_PIN47_INT_TYPE_M ((GPIO_PIN47_INT_TYPE_V)<<(GPIO_PIN47_INT_TYPE_S)) +#define GPIO_PIN47_INT_TYPE_V 0x7 +#define GPIO_PIN47_INT_TYPE_S 7 +/* GPIO_PIN47_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN47_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN47_SYNC1_BYPASS_M ((GPIO_PIN47_SYNC1_BYPASS_V)<<(GPIO_PIN47_SYNC1_BYPASS_S)) +#define GPIO_PIN47_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN47_SYNC1_BYPASS_S 3 +/* GPIO_PIN47_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN47_PAD_DRIVER (BIT(2)) +#define GPIO_PIN47_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN47_PAD_DRIVER_V 0x1 +#define GPIO_PIN47_PAD_DRIVER_S 2 +/* GPIO_PIN47_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN47_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN47_SYNC2_BYPASS_M ((GPIO_PIN47_SYNC2_BYPASS_V)<<(GPIO_PIN47_SYNC2_BYPASS_S)) +#define GPIO_PIN47_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN47_SYNC2_BYPASS_S 0 + +#define GPIO_PIN48_REG (DR_REG_GPIO_BASE + 0x134) +/* GPIO_PIN48_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN48_INT_ENA 0x0000001F +#define GPIO_PIN48_INT_ENA_M ((GPIO_PIN48_INT_ENA_V)<<(GPIO_PIN48_INT_ENA_S)) +#define GPIO_PIN48_INT_ENA_V 0x1F +#define GPIO_PIN48_INT_ENA_S 13 +/* GPIO_PIN48_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN48_CONFIG 0x00000003 +#define GPIO_PIN48_CONFIG_M ((GPIO_PIN48_CONFIG_V)<<(GPIO_PIN48_CONFIG_S)) +#define GPIO_PIN48_CONFIG_V 0x3 +#define GPIO_PIN48_CONFIG_S 11 +/* GPIO_PIN48_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN48_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN48_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN48_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN48_WAKEUP_ENABLE_S 10 +/* GPIO_PIN48_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN48_INT_TYPE 0x00000007 +#define GPIO_PIN48_INT_TYPE_M ((GPIO_PIN48_INT_TYPE_V)<<(GPIO_PIN48_INT_TYPE_S)) +#define GPIO_PIN48_INT_TYPE_V 0x7 +#define GPIO_PIN48_INT_TYPE_S 7 +/* GPIO_PIN48_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN48_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN48_SYNC1_BYPASS_M ((GPIO_PIN48_SYNC1_BYPASS_V)<<(GPIO_PIN48_SYNC1_BYPASS_S)) +#define GPIO_PIN48_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN48_SYNC1_BYPASS_S 3 +/* GPIO_PIN48_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN48_PAD_DRIVER (BIT(2)) +#define GPIO_PIN48_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN48_PAD_DRIVER_V 0x1 +#define GPIO_PIN48_PAD_DRIVER_S 2 +/* GPIO_PIN48_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN48_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN48_SYNC2_BYPASS_M ((GPIO_PIN48_SYNC2_BYPASS_V)<<(GPIO_PIN48_SYNC2_BYPASS_S)) +#define GPIO_PIN48_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN48_SYNC2_BYPASS_S 0 + +#define GPIO_PIN49_REG (DR_REG_GPIO_BASE + 0x138) +/* GPIO_PIN49_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN49_INT_ENA 0x0000001F +#define GPIO_PIN49_INT_ENA_M ((GPIO_PIN49_INT_ENA_V)<<(GPIO_PIN49_INT_ENA_S)) +#define GPIO_PIN49_INT_ENA_V 0x1F +#define GPIO_PIN49_INT_ENA_S 13 +/* GPIO_PIN49_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN49_CONFIG 0x00000003 +#define GPIO_PIN49_CONFIG_M ((GPIO_PIN49_CONFIG_V)<<(GPIO_PIN49_CONFIG_S)) +#define GPIO_PIN49_CONFIG_V 0x3 +#define GPIO_PIN49_CONFIG_S 11 +/* GPIO_PIN49_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN49_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN49_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN49_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN49_WAKEUP_ENABLE_S 10 +/* GPIO_PIN49_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN49_INT_TYPE 0x00000007 +#define GPIO_PIN49_INT_TYPE_M ((GPIO_PIN49_INT_TYPE_V)<<(GPIO_PIN49_INT_TYPE_S)) +#define GPIO_PIN49_INT_TYPE_V 0x7 +#define GPIO_PIN49_INT_TYPE_S 7 +/* GPIO_PIN49_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN49_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN49_SYNC1_BYPASS_M ((GPIO_PIN49_SYNC1_BYPASS_V)<<(GPIO_PIN49_SYNC1_BYPASS_S)) +#define GPIO_PIN49_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN49_SYNC1_BYPASS_S 3 +/* GPIO_PIN49_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN49_PAD_DRIVER (BIT(2)) +#define GPIO_PIN49_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN49_PAD_DRIVER_V 0x1 +#define GPIO_PIN49_PAD_DRIVER_S 2 +/* GPIO_PIN49_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN49_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN49_SYNC2_BYPASS_M ((GPIO_PIN49_SYNC2_BYPASS_V)<<(GPIO_PIN49_SYNC2_BYPASS_S)) +#define GPIO_PIN49_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN49_SYNC2_BYPASS_S 0 + +#define GPIO_PIN50_REG (DR_REG_GPIO_BASE + 0x13C) +/* GPIO_PIN50_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN50_INT_ENA 0x0000001F +#define GPIO_PIN50_INT_ENA_M ((GPIO_PIN50_INT_ENA_V)<<(GPIO_PIN50_INT_ENA_S)) +#define GPIO_PIN50_INT_ENA_V 0x1F +#define GPIO_PIN50_INT_ENA_S 13 +/* GPIO_PIN50_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN50_CONFIG 0x00000003 +#define GPIO_PIN50_CONFIG_M ((GPIO_PIN50_CONFIG_V)<<(GPIO_PIN50_CONFIG_S)) +#define GPIO_PIN50_CONFIG_V 0x3 +#define GPIO_PIN50_CONFIG_S 11 +/* GPIO_PIN50_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN50_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN50_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN50_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN50_WAKEUP_ENABLE_S 10 +/* GPIO_PIN50_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN50_INT_TYPE 0x00000007 +#define GPIO_PIN50_INT_TYPE_M ((GPIO_PIN50_INT_TYPE_V)<<(GPIO_PIN50_INT_TYPE_S)) +#define GPIO_PIN50_INT_TYPE_V 0x7 +#define GPIO_PIN50_INT_TYPE_S 7 +/* GPIO_PIN50_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN50_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN50_SYNC1_BYPASS_M ((GPIO_PIN50_SYNC1_BYPASS_V)<<(GPIO_PIN50_SYNC1_BYPASS_S)) +#define GPIO_PIN50_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN50_SYNC1_BYPASS_S 3 +/* GPIO_PIN50_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN50_PAD_DRIVER (BIT(2)) +#define GPIO_PIN50_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN50_PAD_DRIVER_V 0x1 +#define GPIO_PIN50_PAD_DRIVER_S 2 +/* GPIO_PIN50_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN50_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN50_SYNC2_BYPASS_M ((GPIO_PIN50_SYNC2_BYPASS_V)<<(GPIO_PIN50_SYNC2_BYPASS_S)) +#define GPIO_PIN50_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN50_SYNC2_BYPASS_S 0 + +#define GPIO_PIN51_REG (DR_REG_GPIO_BASE + 0x140) +/* GPIO_PIN51_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN51_INT_ENA 0x0000001F +#define GPIO_PIN51_INT_ENA_M ((GPIO_PIN51_INT_ENA_V)<<(GPIO_PIN51_INT_ENA_S)) +#define GPIO_PIN51_INT_ENA_V 0x1F +#define GPIO_PIN51_INT_ENA_S 13 +/* GPIO_PIN51_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN51_CONFIG 0x00000003 +#define GPIO_PIN51_CONFIG_M ((GPIO_PIN51_CONFIG_V)<<(GPIO_PIN51_CONFIG_S)) +#define GPIO_PIN51_CONFIG_V 0x3 +#define GPIO_PIN51_CONFIG_S 11 +/* GPIO_PIN51_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN51_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN51_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN51_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN51_WAKEUP_ENABLE_S 10 +/* GPIO_PIN51_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN51_INT_TYPE 0x00000007 +#define GPIO_PIN51_INT_TYPE_M ((GPIO_PIN51_INT_TYPE_V)<<(GPIO_PIN51_INT_TYPE_S)) +#define GPIO_PIN51_INT_TYPE_V 0x7 +#define GPIO_PIN51_INT_TYPE_S 7 +/* GPIO_PIN51_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN51_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN51_SYNC1_BYPASS_M ((GPIO_PIN51_SYNC1_BYPASS_V)<<(GPIO_PIN51_SYNC1_BYPASS_S)) +#define GPIO_PIN51_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN51_SYNC1_BYPASS_S 3 +/* GPIO_PIN51_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN51_PAD_DRIVER (BIT(2)) +#define GPIO_PIN51_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN51_PAD_DRIVER_V 0x1 +#define GPIO_PIN51_PAD_DRIVER_S 2 +/* GPIO_PIN51_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN51_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN51_SYNC2_BYPASS_M ((GPIO_PIN51_SYNC2_BYPASS_V)<<(GPIO_PIN51_SYNC2_BYPASS_S)) +#define GPIO_PIN51_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN51_SYNC2_BYPASS_S 0 + +#define GPIO_PIN52_REG (DR_REG_GPIO_BASE + 0x144) +/* GPIO_PIN52_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN52_INT_ENA 0x0000001F +#define GPIO_PIN52_INT_ENA_M ((GPIO_PIN52_INT_ENA_V)<<(GPIO_PIN52_INT_ENA_S)) +#define GPIO_PIN52_INT_ENA_V 0x1F +#define GPIO_PIN52_INT_ENA_S 13 +/* GPIO_PIN52_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN52_CONFIG 0x00000003 +#define GPIO_PIN52_CONFIG_M ((GPIO_PIN52_CONFIG_V)<<(GPIO_PIN52_CONFIG_S)) +#define GPIO_PIN52_CONFIG_V 0x3 +#define GPIO_PIN52_CONFIG_S 11 +/* GPIO_PIN52_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN52_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN52_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN52_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN52_WAKEUP_ENABLE_S 10 +/* GPIO_PIN52_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN52_INT_TYPE 0x00000007 +#define GPIO_PIN52_INT_TYPE_M ((GPIO_PIN52_INT_TYPE_V)<<(GPIO_PIN52_INT_TYPE_S)) +#define GPIO_PIN52_INT_TYPE_V 0x7 +#define GPIO_PIN52_INT_TYPE_S 7 +/* GPIO_PIN52_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN52_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN52_SYNC1_BYPASS_M ((GPIO_PIN52_SYNC1_BYPASS_V)<<(GPIO_PIN52_SYNC1_BYPASS_S)) +#define GPIO_PIN52_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN52_SYNC1_BYPASS_S 3 +/* GPIO_PIN52_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN52_PAD_DRIVER (BIT(2)) +#define GPIO_PIN52_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN52_PAD_DRIVER_V 0x1 +#define GPIO_PIN52_PAD_DRIVER_S 2 +/* GPIO_PIN52_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN52_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN52_SYNC2_BYPASS_M ((GPIO_PIN52_SYNC2_BYPASS_V)<<(GPIO_PIN52_SYNC2_BYPASS_S)) +#define GPIO_PIN52_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN52_SYNC2_BYPASS_S 0 + +#define GPIO_PIN53_REG (DR_REG_GPIO_BASE + 0x148) +/* GPIO_PIN53_INT_ENA : R/W ;bitpos:[17:13] ;default: 5'h0 ; */ +/*description: */ +#define GPIO_PIN53_INT_ENA 0x0000001F +#define GPIO_PIN53_INT_ENA_M ((GPIO_PIN53_INT_ENA_V)<<(GPIO_PIN53_INT_ENA_S)) +#define GPIO_PIN53_INT_ENA_V 0x1F +#define GPIO_PIN53_INT_ENA_S 13 +/* GPIO_PIN53_CONFIG : R/W ;bitpos:[12:11] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN53_CONFIG 0x00000003 +#define GPIO_PIN53_CONFIG_M ((GPIO_PIN53_CONFIG_V)<<(GPIO_PIN53_CONFIG_S)) +#define GPIO_PIN53_CONFIG_V 0x3 +#define GPIO_PIN53_CONFIG_S 11 +/* GPIO_PIN53_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN53_WAKEUP_ENABLE (BIT(10)) +#define GPIO_PIN53_WAKEUP_ENABLE_M (BIT(10)) +#define GPIO_PIN53_WAKEUP_ENABLE_V 0x1 +#define GPIO_PIN53_WAKEUP_ENABLE_S 10 +/* GPIO_PIN53_INT_TYPE : R/W ;bitpos:[9:7] ;default: 3'h0 ; */ +/*description: */ +#define GPIO_PIN53_INT_TYPE 0x00000007 +#define GPIO_PIN53_INT_TYPE_M ((GPIO_PIN53_INT_TYPE_V)<<(GPIO_PIN53_INT_TYPE_S)) +#define GPIO_PIN53_INT_TYPE_V 0x7 +#define GPIO_PIN53_INT_TYPE_S 7 +/* GPIO_PIN53_SYNC1_BYPASS : R/W ;bitpos:[4:3] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN53_SYNC1_BYPASS 0x00000003 +#define GPIO_PIN53_SYNC1_BYPASS_M ((GPIO_PIN53_SYNC1_BYPASS_V)<<(GPIO_PIN53_SYNC1_BYPASS_S)) +#define GPIO_PIN53_SYNC1_BYPASS_V 0x3 +#define GPIO_PIN53_SYNC1_BYPASS_S 3 +/* GPIO_PIN53_PAD_DRIVER : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_PIN53_PAD_DRIVER (BIT(2)) +#define GPIO_PIN53_PAD_DRIVER_M (BIT(2)) +#define GPIO_PIN53_PAD_DRIVER_V 0x1 +#define GPIO_PIN53_PAD_DRIVER_S 2 +/* GPIO_PIN53_SYNC2_BYPASS : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: */ +#define GPIO_PIN53_SYNC2_BYPASS 0x00000003 +#define GPIO_PIN53_SYNC2_BYPASS_M ((GPIO_PIN53_SYNC2_BYPASS_V)<<(GPIO_PIN53_SYNC2_BYPASS_S)) +#define GPIO_PIN53_SYNC2_BYPASS_V 0x3 +#define GPIO_PIN53_SYNC2_BYPASS_S 0 + +#define GPIO_STATUS_NEXT_REG (DR_REG_GPIO_BASE + 0x14C) +/* GPIO_STATUS_INTERRUPT_NEXT : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define GPIO_STATUS_INTERRUPT_NEXT 0xFFFFFFFF +#define GPIO_STATUS_INTERRUPT_NEXT_M ((GPIO_STATUS_INTERRUPT_NEXT_V)<<(GPIO_STATUS_INTERRUPT_NEXT_S)) +#define GPIO_STATUS_INTERRUPT_NEXT_V 0xFFFFFFFF +#define GPIO_STATUS_INTERRUPT_NEXT_S 0 + +#define GPIO_STATUS_NEXT1_REG (DR_REG_GPIO_BASE + 0x150) +/* GPIO_STATUS_INTERRUPT_NEXT : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define GPIO_STATUS_INTERRUPT_NEXT1 0x003FFFFF +#define GPIO_STATUS_INTERRUPT_NEXT1_M ((GPIO_STATUS_INTERRUPT_NEXT1_V)<<(GPIO_STATUS_INTERRUPT_NEXT1_S)) +#define GPIO_STATUS_INTERRUPT_NEXT1_V 0x3FFFFF +#define GPIO_STATUS_INTERRUPT_NEXT1_S 0 + +#define GPIO_FUNC0_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x154) +/* GPIO_SIG0_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG0_IN_SEL (BIT(7)) +#define GPIO_SIG0_IN_SEL_M (BIT(7)) +#define GPIO_SIG0_IN_SEL_V 0x1 +#define GPIO_SIG0_IN_SEL_S 7 +/* GPIO_FUNC0_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC0_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC0_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC0_IN_INV_SEL_V 0x1 +#define GPIO_FUNC0_IN_INV_SEL_S 6 +/* GPIO_FUNC0_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC0_IN_SEL 0x0000003F +#define GPIO_FUNC0_IN_SEL_M ((GPIO_FUNC0_IN_SEL_V)<<(GPIO_FUNC0_IN_SEL_S)) +#define GPIO_FUNC0_IN_SEL_V 0x3F +#define GPIO_FUNC0_IN_SEL_S 0 + +#define GPIO_FUNC1_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x158) +/* GPIO_SIG1_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG1_IN_SEL (BIT(7)) +#define GPIO_SIG1_IN_SEL_M (BIT(7)) +#define GPIO_SIG1_IN_SEL_V 0x1 +#define GPIO_SIG1_IN_SEL_S 7 +/* GPIO_FUNC1_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC1_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC1_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC1_IN_INV_SEL_V 0x1 +#define GPIO_FUNC1_IN_INV_SEL_S 6 +/* GPIO_FUNC1_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC1_IN_SEL 0x0000003F +#define GPIO_FUNC1_IN_SEL_M ((GPIO_FUNC1_IN_SEL_V)<<(GPIO_FUNC1_IN_SEL_S)) +#define GPIO_FUNC1_IN_SEL_V 0x3F +#define GPIO_FUNC1_IN_SEL_S 0 + +#define GPIO_FUNC2_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x15C) +/* GPIO_SIG2_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG2_IN_SEL (BIT(7)) +#define GPIO_SIG2_IN_SEL_M (BIT(7)) +#define GPIO_SIG2_IN_SEL_V 0x1 +#define GPIO_SIG2_IN_SEL_S 7 +/* GPIO_FUNC2_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC2_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC2_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC2_IN_INV_SEL_V 0x1 +#define GPIO_FUNC2_IN_INV_SEL_S 6 +/* GPIO_FUNC2_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC2_IN_SEL 0x0000003F +#define GPIO_FUNC2_IN_SEL_M ((GPIO_FUNC2_IN_SEL_V)<<(GPIO_FUNC2_IN_SEL_S)) +#define GPIO_FUNC2_IN_SEL_V 0x3F +#define GPIO_FUNC2_IN_SEL_S 0 + +#define GPIO_FUNC3_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x160) +/* GPIO_SIG3_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG3_IN_SEL (BIT(7)) +#define GPIO_SIG3_IN_SEL_M (BIT(7)) +#define GPIO_SIG3_IN_SEL_V 0x1 +#define GPIO_SIG3_IN_SEL_S 7 +/* GPIO_FUNC3_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC3_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC3_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC3_IN_INV_SEL_V 0x1 +#define GPIO_FUNC3_IN_INV_SEL_S 6 +/* GPIO_FUNC3_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC3_IN_SEL 0x0000003F +#define GPIO_FUNC3_IN_SEL_M ((GPIO_FUNC3_IN_SEL_V)<<(GPIO_FUNC3_IN_SEL_S)) +#define GPIO_FUNC3_IN_SEL_V 0x3F +#define GPIO_FUNC3_IN_SEL_S 0 + +#define GPIO_FUNC4_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x164) +/* GPIO_SIG4_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG4_IN_SEL (BIT(7)) +#define GPIO_SIG4_IN_SEL_M (BIT(7)) +#define GPIO_SIG4_IN_SEL_V 0x1 +#define GPIO_SIG4_IN_SEL_S 7 +/* GPIO_FUNC4_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC4_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC4_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC4_IN_INV_SEL_V 0x1 +#define GPIO_FUNC4_IN_INV_SEL_S 6 +/* GPIO_FUNC4_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC4_IN_SEL 0x0000003F +#define GPIO_FUNC4_IN_SEL_M ((GPIO_FUNC4_IN_SEL_V)<<(GPIO_FUNC4_IN_SEL_S)) +#define GPIO_FUNC4_IN_SEL_V 0x3F +#define GPIO_FUNC4_IN_SEL_S 0 + +#define GPIO_FUNC5_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x168) +/* GPIO_SIG5_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG5_IN_SEL (BIT(7)) +#define GPIO_SIG5_IN_SEL_M (BIT(7)) +#define GPIO_SIG5_IN_SEL_V 0x1 +#define GPIO_SIG5_IN_SEL_S 7 +/* GPIO_FUNC5_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC5_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC5_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC5_IN_INV_SEL_V 0x1 +#define GPIO_FUNC5_IN_INV_SEL_S 6 +/* GPIO_FUNC5_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC5_IN_SEL 0x0000003F +#define GPIO_FUNC5_IN_SEL_M ((GPIO_FUNC5_IN_SEL_V)<<(GPIO_FUNC5_IN_SEL_S)) +#define GPIO_FUNC5_IN_SEL_V 0x3F +#define GPIO_FUNC5_IN_SEL_S 0 + +#define GPIO_FUNC6_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x16C) +/* GPIO_SIG6_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG6_IN_SEL (BIT(7)) +#define GPIO_SIG6_IN_SEL_M (BIT(7)) +#define GPIO_SIG6_IN_SEL_V 0x1 +#define GPIO_SIG6_IN_SEL_S 7 +/* GPIO_FUNC6_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC6_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC6_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC6_IN_INV_SEL_V 0x1 +#define GPIO_FUNC6_IN_INV_SEL_S 6 +/* GPIO_FUNC6_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC6_IN_SEL 0x0000003F +#define GPIO_FUNC6_IN_SEL_M ((GPIO_FUNC6_IN_SEL_V)<<(GPIO_FUNC6_IN_SEL_S)) +#define GPIO_FUNC6_IN_SEL_V 0x3F +#define GPIO_FUNC6_IN_SEL_S 0 + +#define GPIO_FUNC7_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x170) +/* GPIO_SIG7_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG7_IN_SEL (BIT(7)) +#define GPIO_SIG7_IN_SEL_M (BIT(7)) +#define GPIO_SIG7_IN_SEL_V 0x1 +#define GPIO_SIG7_IN_SEL_S 7 +/* GPIO_FUNC7_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC7_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC7_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC7_IN_INV_SEL_V 0x1 +#define GPIO_FUNC7_IN_INV_SEL_S 6 +/* GPIO_FUNC7_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC7_IN_SEL 0x0000003F +#define GPIO_FUNC7_IN_SEL_M ((GPIO_FUNC7_IN_SEL_V)<<(GPIO_FUNC7_IN_SEL_S)) +#define GPIO_FUNC7_IN_SEL_V 0x3F +#define GPIO_FUNC7_IN_SEL_S 0 + +#define GPIO_FUNC8_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x174) +/* GPIO_SIG8_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG8_IN_SEL (BIT(7)) +#define GPIO_SIG8_IN_SEL_M (BIT(7)) +#define GPIO_SIG8_IN_SEL_V 0x1 +#define GPIO_SIG8_IN_SEL_S 7 +/* GPIO_FUNC8_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC8_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC8_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC8_IN_INV_SEL_V 0x1 +#define GPIO_FUNC8_IN_INV_SEL_S 6 +/* GPIO_FUNC8_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC8_IN_SEL 0x0000003F +#define GPIO_FUNC8_IN_SEL_M ((GPIO_FUNC8_IN_SEL_V)<<(GPIO_FUNC8_IN_SEL_S)) +#define GPIO_FUNC8_IN_SEL_V 0x3F +#define GPIO_FUNC8_IN_SEL_S 0 + +#define GPIO_FUNC9_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x178) +/* GPIO_SIG9_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG9_IN_SEL (BIT(7)) +#define GPIO_SIG9_IN_SEL_M (BIT(7)) +#define GPIO_SIG9_IN_SEL_V 0x1 +#define GPIO_SIG9_IN_SEL_S 7 +/* GPIO_FUNC9_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC9_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC9_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC9_IN_INV_SEL_V 0x1 +#define GPIO_FUNC9_IN_INV_SEL_S 6 +/* GPIO_FUNC9_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC9_IN_SEL 0x0000003F +#define GPIO_FUNC9_IN_SEL_M ((GPIO_FUNC9_IN_SEL_V)<<(GPIO_FUNC9_IN_SEL_S)) +#define GPIO_FUNC9_IN_SEL_V 0x3F +#define GPIO_FUNC9_IN_SEL_S 0 + +#define GPIO_FUNC10_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x17C) +/* GPIO_SIG10_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG10_IN_SEL (BIT(7)) +#define GPIO_SIG10_IN_SEL_M (BIT(7)) +#define GPIO_SIG10_IN_SEL_V 0x1 +#define GPIO_SIG10_IN_SEL_S 7 +/* GPIO_FUNC10_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC10_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC10_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC10_IN_INV_SEL_V 0x1 +#define GPIO_FUNC10_IN_INV_SEL_S 6 +/* GPIO_FUNC10_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC10_IN_SEL 0x0000003F +#define GPIO_FUNC10_IN_SEL_M ((GPIO_FUNC10_IN_SEL_V)<<(GPIO_FUNC10_IN_SEL_S)) +#define GPIO_FUNC10_IN_SEL_V 0x3F +#define GPIO_FUNC10_IN_SEL_S 0 + +#define GPIO_FUNC11_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x180) +/* GPIO_SIG11_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG11_IN_SEL (BIT(7)) +#define GPIO_SIG11_IN_SEL_M (BIT(7)) +#define GPIO_SIG11_IN_SEL_V 0x1 +#define GPIO_SIG11_IN_SEL_S 7 +/* GPIO_FUNC11_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC11_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC11_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC11_IN_INV_SEL_V 0x1 +#define GPIO_FUNC11_IN_INV_SEL_S 6 +/* GPIO_FUNC11_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC11_IN_SEL 0x0000003F +#define GPIO_FUNC11_IN_SEL_M ((GPIO_FUNC11_IN_SEL_V)<<(GPIO_FUNC11_IN_SEL_S)) +#define GPIO_FUNC11_IN_SEL_V 0x3F +#define GPIO_FUNC11_IN_SEL_S 0 + +#define GPIO_FUNC12_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x184) +/* GPIO_SIG12_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG12_IN_SEL (BIT(7)) +#define GPIO_SIG12_IN_SEL_M (BIT(7)) +#define GPIO_SIG12_IN_SEL_V 0x1 +#define GPIO_SIG12_IN_SEL_S 7 +/* GPIO_FUNC12_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC12_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC12_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC12_IN_INV_SEL_V 0x1 +#define GPIO_FUNC12_IN_INV_SEL_S 6 +/* GPIO_FUNC12_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC12_IN_SEL 0x0000003F +#define GPIO_FUNC12_IN_SEL_M ((GPIO_FUNC12_IN_SEL_V)<<(GPIO_FUNC12_IN_SEL_S)) +#define GPIO_FUNC12_IN_SEL_V 0x3F +#define GPIO_FUNC12_IN_SEL_S 0 + +#define GPIO_FUNC13_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x188) +/* GPIO_SIG13_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG13_IN_SEL (BIT(7)) +#define GPIO_SIG13_IN_SEL_M (BIT(7)) +#define GPIO_SIG13_IN_SEL_V 0x1 +#define GPIO_SIG13_IN_SEL_S 7 +/* GPIO_FUNC13_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC13_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC13_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC13_IN_INV_SEL_V 0x1 +#define GPIO_FUNC13_IN_INV_SEL_S 6 +/* GPIO_FUNC13_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC13_IN_SEL 0x0000003F +#define GPIO_FUNC13_IN_SEL_M ((GPIO_FUNC13_IN_SEL_V)<<(GPIO_FUNC13_IN_SEL_S)) +#define GPIO_FUNC13_IN_SEL_V 0x3F +#define GPIO_FUNC13_IN_SEL_S 0 + +#define GPIO_FUNC14_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x18C) +/* GPIO_SIG14_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG14_IN_SEL (BIT(7)) +#define GPIO_SIG14_IN_SEL_M (BIT(7)) +#define GPIO_SIG14_IN_SEL_V 0x1 +#define GPIO_SIG14_IN_SEL_S 7 +/* GPIO_FUNC14_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC14_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC14_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC14_IN_INV_SEL_V 0x1 +#define GPIO_FUNC14_IN_INV_SEL_S 6 +/* GPIO_FUNC14_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC14_IN_SEL 0x0000003F +#define GPIO_FUNC14_IN_SEL_M ((GPIO_FUNC14_IN_SEL_V)<<(GPIO_FUNC14_IN_SEL_S)) +#define GPIO_FUNC14_IN_SEL_V 0x3F +#define GPIO_FUNC14_IN_SEL_S 0 + +#define GPIO_FUNC15_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x190) +/* GPIO_SIG15_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG15_IN_SEL (BIT(7)) +#define GPIO_SIG15_IN_SEL_M (BIT(7)) +#define GPIO_SIG15_IN_SEL_V 0x1 +#define GPIO_SIG15_IN_SEL_S 7 +/* GPIO_FUNC15_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC15_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC15_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC15_IN_INV_SEL_V 0x1 +#define GPIO_FUNC15_IN_INV_SEL_S 6 +/* GPIO_FUNC15_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC15_IN_SEL 0x0000003F +#define GPIO_FUNC15_IN_SEL_M ((GPIO_FUNC15_IN_SEL_V)<<(GPIO_FUNC15_IN_SEL_S)) +#define GPIO_FUNC15_IN_SEL_V 0x3F +#define GPIO_FUNC15_IN_SEL_S 0 + +#define GPIO_FUNC16_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x194) +/* GPIO_SIG16_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG16_IN_SEL (BIT(7)) +#define GPIO_SIG16_IN_SEL_M (BIT(7)) +#define GPIO_SIG16_IN_SEL_V 0x1 +#define GPIO_SIG16_IN_SEL_S 7 +/* GPIO_FUNC16_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC16_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC16_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC16_IN_INV_SEL_V 0x1 +#define GPIO_FUNC16_IN_INV_SEL_S 6 +/* GPIO_FUNC16_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC16_IN_SEL 0x0000003F +#define GPIO_FUNC16_IN_SEL_M ((GPIO_FUNC16_IN_SEL_V)<<(GPIO_FUNC16_IN_SEL_S)) +#define GPIO_FUNC16_IN_SEL_V 0x3F +#define GPIO_FUNC16_IN_SEL_S 0 + +#define GPIO_FUNC17_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x198) +/* GPIO_SIG17_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG17_IN_SEL (BIT(7)) +#define GPIO_SIG17_IN_SEL_M (BIT(7)) +#define GPIO_SIG17_IN_SEL_V 0x1 +#define GPIO_SIG17_IN_SEL_S 7 +/* GPIO_FUNC17_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC17_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC17_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC17_IN_INV_SEL_V 0x1 +#define GPIO_FUNC17_IN_INV_SEL_S 6 +/* GPIO_FUNC17_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC17_IN_SEL 0x0000003F +#define GPIO_FUNC17_IN_SEL_M ((GPIO_FUNC17_IN_SEL_V)<<(GPIO_FUNC17_IN_SEL_S)) +#define GPIO_FUNC17_IN_SEL_V 0x3F +#define GPIO_FUNC17_IN_SEL_S 0 + +#define GPIO_FUNC18_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x19C) +/* GPIO_SIG18_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG18_IN_SEL (BIT(7)) +#define GPIO_SIG18_IN_SEL_M (BIT(7)) +#define GPIO_SIG18_IN_SEL_V 0x1 +#define GPIO_SIG18_IN_SEL_S 7 +/* GPIO_FUNC18_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC18_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC18_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC18_IN_INV_SEL_V 0x1 +#define GPIO_FUNC18_IN_INV_SEL_S 6 +/* GPIO_FUNC18_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC18_IN_SEL 0x0000003F +#define GPIO_FUNC18_IN_SEL_M ((GPIO_FUNC18_IN_SEL_V)<<(GPIO_FUNC18_IN_SEL_S)) +#define GPIO_FUNC18_IN_SEL_V 0x3F +#define GPIO_FUNC18_IN_SEL_S 0 + +#define GPIO_FUNC19_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1A0) +/* GPIO_SIG19_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG19_IN_SEL (BIT(7)) +#define GPIO_SIG19_IN_SEL_M (BIT(7)) +#define GPIO_SIG19_IN_SEL_V 0x1 +#define GPIO_SIG19_IN_SEL_S 7 +/* GPIO_FUNC19_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC19_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC19_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC19_IN_INV_SEL_V 0x1 +#define GPIO_FUNC19_IN_INV_SEL_S 6 +/* GPIO_FUNC19_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC19_IN_SEL 0x0000003F +#define GPIO_FUNC19_IN_SEL_M ((GPIO_FUNC19_IN_SEL_V)<<(GPIO_FUNC19_IN_SEL_S)) +#define GPIO_FUNC19_IN_SEL_V 0x3F +#define GPIO_FUNC19_IN_SEL_S 0 + +#define GPIO_FUNC20_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1A4) +/* GPIO_SIG20_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG20_IN_SEL (BIT(7)) +#define GPIO_SIG20_IN_SEL_M (BIT(7)) +#define GPIO_SIG20_IN_SEL_V 0x1 +#define GPIO_SIG20_IN_SEL_S 7 +/* GPIO_FUNC20_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC20_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC20_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC20_IN_INV_SEL_V 0x1 +#define GPIO_FUNC20_IN_INV_SEL_S 6 +/* GPIO_FUNC20_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC20_IN_SEL 0x0000003F +#define GPIO_FUNC20_IN_SEL_M ((GPIO_FUNC20_IN_SEL_V)<<(GPIO_FUNC20_IN_SEL_S)) +#define GPIO_FUNC20_IN_SEL_V 0x3F +#define GPIO_FUNC20_IN_SEL_S 0 + +#define GPIO_FUNC21_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1A8) +/* GPIO_SIG21_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG21_IN_SEL (BIT(7)) +#define GPIO_SIG21_IN_SEL_M (BIT(7)) +#define GPIO_SIG21_IN_SEL_V 0x1 +#define GPIO_SIG21_IN_SEL_S 7 +/* GPIO_FUNC21_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC21_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC21_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC21_IN_INV_SEL_V 0x1 +#define GPIO_FUNC21_IN_INV_SEL_S 6 +/* GPIO_FUNC21_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC21_IN_SEL 0x0000003F +#define GPIO_FUNC21_IN_SEL_M ((GPIO_FUNC21_IN_SEL_V)<<(GPIO_FUNC21_IN_SEL_S)) +#define GPIO_FUNC21_IN_SEL_V 0x3F +#define GPIO_FUNC21_IN_SEL_S 0 + +#define GPIO_FUNC22_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1AC) +/* GPIO_SIG22_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG22_IN_SEL (BIT(7)) +#define GPIO_SIG22_IN_SEL_M (BIT(7)) +#define GPIO_SIG22_IN_SEL_V 0x1 +#define GPIO_SIG22_IN_SEL_S 7 +/* GPIO_FUNC22_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC22_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC22_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC22_IN_INV_SEL_V 0x1 +#define GPIO_FUNC22_IN_INV_SEL_S 6 +/* GPIO_FUNC22_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC22_IN_SEL 0x0000003F +#define GPIO_FUNC22_IN_SEL_M ((GPIO_FUNC22_IN_SEL_V)<<(GPIO_FUNC22_IN_SEL_S)) +#define GPIO_FUNC22_IN_SEL_V 0x3F +#define GPIO_FUNC22_IN_SEL_S 0 + +#define GPIO_FUNC23_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1B0) +/* GPIO_SIG23_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG23_IN_SEL (BIT(7)) +#define GPIO_SIG23_IN_SEL_M (BIT(7)) +#define GPIO_SIG23_IN_SEL_V 0x1 +#define GPIO_SIG23_IN_SEL_S 7 +/* GPIO_FUNC23_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC23_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC23_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC23_IN_INV_SEL_V 0x1 +#define GPIO_FUNC23_IN_INV_SEL_S 6 +/* GPIO_FUNC23_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC23_IN_SEL 0x0000003F +#define GPIO_FUNC23_IN_SEL_M ((GPIO_FUNC23_IN_SEL_V)<<(GPIO_FUNC23_IN_SEL_S)) +#define GPIO_FUNC23_IN_SEL_V 0x3F +#define GPIO_FUNC23_IN_SEL_S 0 + +#define GPIO_FUNC24_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1B4) +/* GPIO_SIG24_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG24_IN_SEL (BIT(7)) +#define GPIO_SIG24_IN_SEL_M (BIT(7)) +#define GPIO_SIG24_IN_SEL_V 0x1 +#define GPIO_SIG24_IN_SEL_S 7 +/* GPIO_FUNC24_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC24_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC24_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC24_IN_INV_SEL_V 0x1 +#define GPIO_FUNC24_IN_INV_SEL_S 6 +/* GPIO_FUNC24_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC24_IN_SEL 0x0000003F +#define GPIO_FUNC24_IN_SEL_M ((GPIO_FUNC24_IN_SEL_V)<<(GPIO_FUNC24_IN_SEL_S)) +#define GPIO_FUNC24_IN_SEL_V 0x3F +#define GPIO_FUNC24_IN_SEL_S 0 + +#define GPIO_FUNC25_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1B8) +/* GPIO_SIG25_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG25_IN_SEL (BIT(7)) +#define GPIO_SIG25_IN_SEL_M (BIT(7)) +#define GPIO_SIG25_IN_SEL_V 0x1 +#define GPIO_SIG25_IN_SEL_S 7 +/* GPIO_FUNC25_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC25_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC25_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC25_IN_INV_SEL_V 0x1 +#define GPIO_FUNC25_IN_INV_SEL_S 6 +/* GPIO_FUNC25_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC25_IN_SEL 0x0000003F +#define GPIO_FUNC25_IN_SEL_M ((GPIO_FUNC25_IN_SEL_V)<<(GPIO_FUNC25_IN_SEL_S)) +#define GPIO_FUNC25_IN_SEL_V 0x3F +#define GPIO_FUNC25_IN_SEL_S 0 + +#define GPIO_FUNC26_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1BC) +/* GPIO_SIG26_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG26_IN_SEL (BIT(7)) +#define GPIO_SIG26_IN_SEL_M (BIT(7)) +#define GPIO_SIG26_IN_SEL_V 0x1 +#define GPIO_SIG26_IN_SEL_S 7 +/* GPIO_FUNC26_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC26_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC26_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC26_IN_INV_SEL_V 0x1 +#define GPIO_FUNC26_IN_INV_SEL_S 6 +/* GPIO_FUNC26_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC26_IN_SEL 0x0000003F +#define GPIO_FUNC26_IN_SEL_M ((GPIO_FUNC26_IN_SEL_V)<<(GPIO_FUNC26_IN_SEL_S)) +#define GPIO_FUNC26_IN_SEL_V 0x3F +#define GPIO_FUNC26_IN_SEL_S 0 + +#define GPIO_FUNC27_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1C0) +/* GPIO_SIG27_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG27_IN_SEL (BIT(7)) +#define GPIO_SIG27_IN_SEL_M (BIT(7)) +#define GPIO_SIG27_IN_SEL_V 0x1 +#define GPIO_SIG27_IN_SEL_S 7 +/* GPIO_FUNC27_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC27_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC27_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC27_IN_INV_SEL_V 0x1 +#define GPIO_FUNC27_IN_INV_SEL_S 6 +/* GPIO_FUNC27_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC27_IN_SEL 0x0000003F +#define GPIO_FUNC27_IN_SEL_M ((GPIO_FUNC27_IN_SEL_V)<<(GPIO_FUNC27_IN_SEL_S)) +#define GPIO_FUNC27_IN_SEL_V 0x3F +#define GPIO_FUNC27_IN_SEL_S 0 + +#define GPIO_FUNC28_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1C4) +/* GPIO_SIG28_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG28_IN_SEL (BIT(7)) +#define GPIO_SIG28_IN_SEL_M (BIT(7)) +#define GPIO_SIG28_IN_SEL_V 0x1 +#define GPIO_SIG28_IN_SEL_S 7 +/* GPIO_FUNC28_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC28_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC28_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC28_IN_INV_SEL_V 0x1 +#define GPIO_FUNC28_IN_INV_SEL_S 6 +/* GPIO_FUNC28_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC28_IN_SEL 0x0000003F +#define GPIO_FUNC28_IN_SEL_M ((GPIO_FUNC28_IN_SEL_V)<<(GPIO_FUNC28_IN_SEL_S)) +#define GPIO_FUNC28_IN_SEL_V 0x3F +#define GPIO_FUNC28_IN_SEL_S 0 + +#define GPIO_FUNC29_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1C8) +/* GPIO_SIG29_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG29_IN_SEL (BIT(7)) +#define GPIO_SIG29_IN_SEL_M (BIT(7)) +#define GPIO_SIG29_IN_SEL_V 0x1 +#define GPIO_SIG29_IN_SEL_S 7 +/* GPIO_FUNC29_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC29_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC29_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC29_IN_INV_SEL_V 0x1 +#define GPIO_FUNC29_IN_INV_SEL_S 6 +/* GPIO_FUNC29_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC29_IN_SEL 0x0000003F +#define GPIO_FUNC29_IN_SEL_M ((GPIO_FUNC29_IN_SEL_V)<<(GPIO_FUNC29_IN_SEL_S)) +#define GPIO_FUNC29_IN_SEL_V 0x3F +#define GPIO_FUNC29_IN_SEL_S 0 + +#define GPIO_FUNC30_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1CC) +/* GPIO_SIG30_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG30_IN_SEL (BIT(7)) +#define GPIO_SIG30_IN_SEL_M (BIT(7)) +#define GPIO_SIG30_IN_SEL_V 0x1 +#define GPIO_SIG30_IN_SEL_S 7 +/* GPIO_FUNC30_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC30_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC30_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC30_IN_INV_SEL_V 0x1 +#define GPIO_FUNC30_IN_INV_SEL_S 6 +/* GPIO_FUNC30_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC30_IN_SEL 0x0000003F +#define GPIO_FUNC30_IN_SEL_M ((GPIO_FUNC30_IN_SEL_V)<<(GPIO_FUNC30_IN_SEL_S)) +#define GPIO_FUNC30_IN_SEL_V 0x3F +#define GPIO_FUNC30_IN_SEL_S 0 + +#define GPIO_FUNC31_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1D0) +/* GPIO_SIG31_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG31_IN_SEL (BIT(7)) +#define GPIO_SIG31_IN_SEL_M (BIT(7)) +#define GPIO_SIG31_IN_SEL_V 0x1 +#define GPIO_SIG31_IN_SEL_S 7 +/* GPIO_FUNC31_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC31_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC31_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC31_IN_INV_SEL_V 0x1 +#define GPIO_FUNC31_IN_INV_SEL_S 6 +/* GPIO_FUNC31_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC31_IN_SEL 0x0000003F +#define GPIO_FUNC31_IN_SEL_M ((GPIO_FUNC31_IN_SEL_V)<<(GPIO_FUNC31_IN_SEL_S)) +#define GPIO_FUNC31_IN_SEL_V 0x3F +#define GPIO_FUNC31_IN_SEL_S 0 + +#define GPIO_FUNC32_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1D4) +/* GPIO_SIG32_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG32_IN_SEL (BIT(7)) +#define GPIO_SIG32_IN_SEL_M (BIT(7)) +#define GPIO_SIG32_IN_SEL_V 0x1 +#define GPIO_SIG32_IN_SEL_S 7 +/* GPIO_FUNC32_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC32_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC32_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC32_IN_INV_SEL_V 0x1 +#define GPIO_FUNC32_IN_INV_SEL_S 6 +/* GPIO_FUNC32_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC32_IN_SEL 0x0000003F +#define GPIO_FUNC32_IN_SEL_M ((GPIO_FUNC32_IN_SEL_V)<<(GPIO_FUNC32_IN_SEL_S)) +#define GPIO_FUNC32_IN_SEL_V 0x3F +#define GPIO_FUNC32_IN_SEL_S 0 + +#define GPIO_FUNC33_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1D8) +/* GPIO_SIG33_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG33_IN_SEL (BIT(7)) +#define GPIO_SIG33_IN_SEL_M (BIT(7)) +#define GPIO_SIG33_IN_SEL_V 0x1 +#define GPIO_SIG33_IN_SEL_S 7 +/* GPIO_FUNC33_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC33_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC33_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC33_IN_INV_SEL_V 0x1 +#define GPIO_FUNC33_IN_INV_SEL_S 6 +/* GPIO_FUNC33_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC33_IN_SEL 0x0000003F +#define GPIO_FUNC33_IN_SEL_M ((GPIO_FUNC33_IN_SEL_V)<<(GPIO_FUNC33_IN_SEL_S)) +#define GPIO_FUNC33_IN_SEL_V 0x3F +#define GPIO_FUNC33_IN_SEL_S 0 + +#define GPIO_FUNC34_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1DC) +/* GPIO_SIG34_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG34_IN_SEL (BIT(7)) +#define GPIO_SIG34_IN_SEL_M (BIT(7)) +#define GPIO_SIG34_IN_SEL_V 0x1 +#define GPIO_SIG34_IN_SEL_S 7 +/* GPIO_FUNC34_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC34_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC34_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC34_IN_INV_SEL_V 0x1 +#define GPIO_FUNC34_IN_INV_SEL_S 6 +/* GPIO_FUNC34_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC34_IN_SEL 0x0000003F +#define GPIO_FUNC34_IN_SEL_M ((GPIO_FUNC34_IN_SEL_V)<<(GPIO_FUNC34_IN_SEL_S)) +#define GPIO_FUNC34_IN_SEL_V 0x3F +#define GPIO_FUNC34_IN_SEL_S 0 + +#define GPIO_FUNC35_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1E0) +/* GPIO_SIG35_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG35_IN_SEL (BIT(7)) +#define GPIO_SIG35_IN_SEL_M (BIT(7)) +#define GPIO_SIG35_IN_SEL_V 0x1 +#define GPIO_SIG35_IN_SEL_S 7 +/* GPIO_FUNC35_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC35_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC35_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC35_IN_INV_SEL_V 0x1 +#define GPIO_FUNC35_IN_INV_SEL_S 6 +/* GPIO_FUNC35_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC35_IN_SEL 0x0000003F +#define GPIO_FUNC35_IN_SEL_M ((GPIO_FUNC35_IN_SEL_V)<<(GPIO_FUNC35_IN_SEL_S)) +#define GPIO_FUNC35_IN_SEL_V 0x3F +#define GPIO_FUNC35_IN_SEL_S 0 + +#define GPIO_FUNC36_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1E4) +/* GPIO_SIG36_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG36_IN_SEL (BIT(7)) +#define GPIO_SIG36_IN_SEL_M (BIT(7)) +#define GPIO_SIG36_IN_SEL_V 0x1 +#define GPIO_SIG36_IN_SEL_S 7 +/* GPIO_FUNC36_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC36_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC36_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC36_IN_INV_SEL_V 0x1 +#define GPIO_FUNC36_IN_INV_SEL_S 6 +/* GPIO_FUNC36_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC36_IN_SEL 0x0000003F +#define GPIO_FUNC36_IN_SEL_M ((GPIO_FUNC36_IN_SEL_V)<<(GPIO_FUNC36_IN_SEL_S)) +#define GPIO_FUNC36_IN_SEL_V 0x3F +#define GPIO_FUNC36_IN_SEL_S 0 + +#define GPIO_FUNC37_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1E8) +/* GPIO_SIG37_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG37_IN_SEL (BIT(7)) +#define GPIO_SIG37_IN_SEL_M (BIT(7)) +#define GPIO_SIG37_IN_SEL_V 0x1 +#define GPIO_SIG37_IN_SEL_S 7 +/* GPIO_FUNC37_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC37_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC37_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC37_IN_INV_SEL_V 0x1 +#define GPIO_FUNC37_IN_INV_SEL_S 6 +/* GPIO_FUNC37_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC37_IN_SEL 0x0000003F +#define GPIO_FUNC37_IN_SEL_M ((GPIO_FUNC37_IN_SEL_V)<<(GPIO_FUNC37_IN_SEL_S)) +#define GPIO_FUNC37_IN_SEL_V 0x3F +#define GPIO_FUNC37_IN_SEL_S 0 + +#define GPIO_FUNC38_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1EC) +/* GPIO_SIG38_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG38_IN_SEL (BIT(7)) +#define GPIO_SIG38_IN_SEL_M (BIT(7)) +#define GPIO_SIG38_IN_SEL_V 0x1 +#define GPIO_SIG38_IN_SEL_S 7 +/* GPIO_FUNC38_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC38_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC38_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC38_IN_INV_SEL_V 0x1 +#define GPIO_FUNC38_IN_INV_SEL_S 6 +/* GPIO_FUNC38_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC38_IN_SEL 0x0000003F +#define GPIO_FUNC38_IN_SEL_M ((GPIO_FUNC38_IN_SEL_V)<<(GPIO_FUNC38_IN_SEL_S)) +#define GPIO_FUNC38_IN_SEL_V 0x3F +#define GPIO_FUNC38_IN_SEL_S 0 + +#define GPIO_FUNC39_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1F0) +/* GPIO_SIG39_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG39_IN_SEL (BIT(7)) +#define GPIO_SIG39_IN_SEL_M (BIT(7)) +#define GPIO_SIG39_IN_SEL_V 0x1 +#define GPIO_SIG39_IN_SEL_S 7 +/* GPIO_FUNC39_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC39_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC39_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC39_IN_INV_SEL_V 0x1 +#define GPIO_FUNC39_IN_INV_SEL_S 6 +/* GPIO_FUNC39_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC39_IN_SEL 0x0000003F +#define GPIO_FUNC39_IN_SEL_M ((GPIO_FUNC39_IN_SEL_V)<<(GPIO_FUNC39_IN_SEL_S)) +#define GPIO_FUNC39_IN_SEL_V 0x3F +#define GPIO_FUNC39_IN_SEL_S 0 + +#define GPIO_FUNC40_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1F4) +/* GPIO_SIG40_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG40_IN_SEL (BIT(7)) +#define GPIO_SIG40_IN_SEL_M (BIT(7)) +#define GPIO_SIG40_IN_SEL_V 0x1 +#define GPIO_SIG40_IN_SEL_S 7 +/* GPIO_FUNC40_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC40_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC40_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC40_IN_INV_SEL_V 0x1 +#define GPIO_FUNC40_IN_INV_SEL_S 6 +/* GPIO_FUNC40_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC40_IN_SEL 0x0000003F +#define GPIO_FUNC40_IN_SEL_M ((GPIO_FUNC40_IN_SEL_V)<<(GPIO_FUNC40_IN_SEL_S)) +#define GPIO_FUNC40_IN_SEL_V 0x3F +#define GPIO_FUNC40_IN_SEL_S 0 + +#define GPIO_FUNC41_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1F8) +/* GPIO_SIG41_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG41_IN_SEL (BIT(7)) +#define GPIO_SIG41_IN_SEL_M (BIT(7)) +#define GPIO_SIG41_IN_SEL_V 0x1 +#define GPIO_SIG41_IN_SEL_S 7 +/* GPIO_FUNC41_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC41_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC41_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC41_IN_INV_SEL_V 0x1 +#define GPIO_FUNC41_IN_INV_SEL_S 6 +/* GPIO_FUNC41_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC41_IN_SEL 0x0000003F +#define GPIO_FUNC41_IN_SEL_M ((GPIO_FUNC41_IN_SEL_V)<<(GPIO_FUNC41_IN_SEL_S)) +#define GPIO_FUNC41_IN_SEL_V 0x3F +#define GPIO_FUNC41_IN_SEL_S 0 + +#define GPIO_FUNC42_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x1FC) +/* GPIO_SIG42_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG42_IN_SEL (BIT(7)) +#define GPIO_SIG42_IN_SEL_M (BIT(7)) +#define GPIO_SIG42_IN_SEL_V 0x1 +#define GPIO_SIG42_IN_SEL_S 7 +/* GPIO_FUNC42_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC42_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC42_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC42_IN_INV_SEL_V 0x1 +#define GPIO_FUNC42_IN_INV_SEL_S 6 +/* GPIO_FUNC42_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC42_IN_SEL 0x0000003F +#define GPIO_FUNC42_IN_SEL_M ((GPIO_FUNC42_IN_SEL_V)<<(GPIO_FUNC42_IN_SEL_S)) +#define GPIO_FUNC42_IN_SEL_V 0x3F +#define GPIO_FUNC42_IN_SEL_S 0 + +#define GPIO_FUNC43_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x200) +/* GPIO_SIG43_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG43_IN_SEL (BIT(7)) +#define GPIO_SIG43_IN_SEL_M (BIT(7)) +#define GPIO_SIG43_IN_SEL_V 0x1 +#define GPIO_SIG43_IN_SEL_S 7 +/* GPIO_FUNC43_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC43_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC43_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC43_IN_INV_SEL_V 0x1 +#define GPIO_FUNC43_IN_INV_SEL_S 6 +/* GPIO_FUNC43_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC43_IN_SEL 0x0000003F +#define GPIO_FUNC43_IN_SEL_M ((GPIO_FUNC43_IN_SEL_V)<<(GPIO_FUNC43_IN_SEL_S)) +#define GPIO_FUNC43_IN_SEL_V 0x3F +#define GPIO_FUNC43_IN_SEL_S 0 + +#define GPIO_FUNC44_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x204) +/* GPIO_SIG44_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG44_IN_SEL (BIT(7)) +#define GPIO_SIG44_IN_SEL_M (BIT(7)) +#define GPIO_SIG44_IN_SEL_V 0x1 +#define GPIO_SIG44_IN_SEL_S 7 +/* GPIO_FUNC44_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC44_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC44_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC44_IN_INV_SEL_V 0x1 +#define GPIO_FUNC44_IN_INV_SEL_S 6 +/* GPIO_FUNC44_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC44_IN_SEL 0x0000003F +#define GPIO_FUNC44_IN_SEL_M ((GPIO_FUNC44_IN_SEL_V)<<(GPIO_FUNC44_IN_SEL_S)) +#define GPIO_FUNC44_IN_SEL_V 0x3F +#define GPIO_FUNC44_IN_SEL_S 0 + +#define GPIO_FUNC45_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x208) +/* GPIO_SIG45_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG45_IN_SEL (BIT(7)) +#define GPIO_SIG45_IN_SEL_M (BIT(7)) +#define GPIO_SIG45_IN_SEL_V 0x1 +#define GPIO_SIG45_IN_SEL_S 7 +/* GPIO_FUNC45_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC45_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC45_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC45_IN_INV_SEL_V 0x1 +#define GPIO_FUNC45_IN_INV_SEL_S 6 +/* GPIO_FUNC45_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC45_IN_SEL 0x0000003F +#define GPIO_FUNC45_IN_SEL_M ((GPIO_FUNC45_IN_SEL_V)<<(GPIO_FUNC45_IN_SEL_S)) +#define GPIO_FUNC45_IN_SEL_V 0x3F +#define GPIO_FUNC45_IN_SEL_S 0 + +#define GPIO_FUNC46_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x20C) +/* GPIO_SIG46_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG46_IN_SEL (BIT(7)) +#define GPIO_SIG46_IN_SEL_M (BIT(7)) +#define GPIO_SIG46_IN_SEL_V 0x1 +#define GPIO_SIG46_IN_SEL_S 7 +/* GPIO_FUNC46_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC46_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC46_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC46_IN_INV_SEL_V 0x1 +#define GPIO_FUNC46_IN_INV_SEL_S 6 +/* GPIO_FUNC46_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC46_IN_SEL 0x0000003F +#define GPIO_FUNC46_IN_SEL_M ((GPIO_FUNC46_IN_SEL_V)<<(GPIO_FUNC46_IN_SEL_S)) +#define GPIO_FUNC46_IN_SEL_V 0x3F +#define GPIO_FUNC46_IN_SEL_S 0 + +#define GPIO_FUNC47_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x210) +/* GPIO_SIG47_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG47_IN_SEL (BIT(7)) +#define GPIO_SIG47_IN_SEL_M (BIT(7)) +#define GPIO_SIG47_IN_SEL_V 0x1 +#define GPIO_SIG47_IN_SEL_S 7 +/* GPIO_FUNC47_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC47_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC47_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC47_IN_INV_SEL_V 0x1 +#define GPIO_FUNC47_IN_INV_SEL_S 6 +/* GPIO_FUNC47_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC47_IN_SEL 0x0000003F +#define GPIO_FUNC47_IN_SEL_M ((GPIO_FUNC47_IN_SEL_V)<<(GPIO_FUNC47_IN_SEL_S)) +#define GPIO_FUNC47_IN_SEL_V 0x3F +#define GPIO_FUNC47_IN_SEL_S 0 + +#define GPIO_FUNC48_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x214) +/* GPIO_SIG48_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG48_IN_SEL (BIT(7)) +#define GPIO_SIG48_IN_SEL_M (BIT(7)) +#define GPIO_SIG48_IN_SEL_V 0x1 +#define GPIO_SIG48_IN_SEL_S 7 +/* GPIO_FUNC48_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC48_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC48_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC48_IN_INV_SEL_V 0x1 +#define GPIO_FUNC48_IN_INV_SEL_S 6 +/* GPIO_FUNC48_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC48_IN_SEL 0x0000003F +#define GPIO_FUNC48_IN_SEL_M ((GPIO_FUNC48_IN_SEL_V)<<(GPIO_FUNC48_IN_SEL_S)) +#define GPIO_FUNC48_IN_SEL_V 0x3F +#define GPIO_FUNC48_IN_SEL_S 0 + +#define GPIO_FUNC49_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x218) +/* GPIO_SIG49_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG49_IN_SEL (BIT(7)) +#define GPIO_SIG49_IN_SEL_M (BIT(7)) +#define GPIO_SIG49_IN_SEL_V 0x1 +#define GPIO_SIG49_IN_SEL_S 7 +/* GPIO_FUNC49_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC49_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC49_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC49_IN_INV_SEL_V 0x1 +#define GPIO_FUNC49_IN_INV_SEL_S 6 +/* GPIO_FUNC49_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC49_IN_SEL 0x0000003F +#define GPIO_FUNC49_IN_SEL_M ((GPIO_FUNC49_IN_SEL_V)<<(GPIO_FUNC49_IN_SEL_S)) +#define GPIO_FUNC49_IN_SEL_V 0x3F +#define GPIO_FUNC49_IN_SEL_S 0 + +#define GPIO_FUNC50_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x21C) +/* GPIO_SIG50_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG50_IN_SEL (BIT(7)) +#define GPIO_SIG50_IN_SEL_M (BIT(7)) +#define GPIO_SIG50_IN_SEL_V 0x1 +#define GPIO_SIG50_IN_SEL_S 7 +/* GPIO_FUNC50_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC50_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC50_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC50_IN_INV_SEL_V 0x1 +#define GPIO_FUNC50_IN_INV_SEL_S 6 +/* GPIO_FUNC50_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC50_IN_SEL 0x0000003F +#define GPIO_FUNC50_IN_SEL_M ((GPIO_FUNC50_IN_SEL_V)<<(GPIO_FUNC50_IN_SEL_S)) +#define GPIO_FUNC50_IN_SEL_V 0x3F +#define GPIO_FUNC50_IN_SEL_S 0 + +#define GPIO_FUNC51_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x220) +/* GPIO_SIG51_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG51_IN_SEL (BIT(7)) +#define GPIO_SIG51_IN_SEL_M (BIT(7)) +#define GPIO_SIG51_IN_SEL_V 0x1 +#define GPIO_SIG51_IN_SEL_S 7 +/* GPIO_FUNC51_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC51_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC51_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC51_IN_INV_SEL_V 0x1 +#define GPIO_FUNC51_IN_INV_SEL_S 6 +/* GPIO_FUNC51_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC51_IN_SEL 0x0000003F +#define GPIO_FUNC51_IN_SEL_M ((GPIO_FUNC51_IN_SEL_V)<<(GPIO_FUNC51_IN_SEL_S)) +#define GPIO_FUNC51_IN_SEL_V 0x3F +#define GPIO_FUNC51_IN_SEL_S 0 + +#define GPIO_FUNC52_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x224) +/* GPIO_SIG52_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG52_IN_SEL (BIT(7)) +#define GPIO_SIG52_IN_SEL_M (BIT(7)) +#define GPIO_SIG52_IN_SEL_V 0x1 +#define GPIO_SIG52_IN_SEL_S 7 +/* GPIO_FUNC52_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC52_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC52_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC52_IN_INV_SEL_V 0x1 +#define GPIO_FUNC52_IN_INV_SEL_S 6 +/* GPIO_FUNC52_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC52_IN_SEL 0x0000003F +#define GPIO_FUNC52_IN_SEL_M ((GPIO_FUNC52_IN_SEL_V)<<(GPIO_FUNC52_IN_SEL_S)) +#define GPIO_FUNC52_IN_SEL_V 0x3F +#define GPIO_FUNC52_IN_SEL_S 0 + +#define GPIO_FUNC53_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x228) +/* GPIO_SIG53_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG53_IN_SEL (BIT(7)) +#define GPIO_SIG53_IN_SEL_M (BIT(7)) +#define GPIO_SIG53_IN_SEL_V 0x1 +#define GPIO_SIG53_IN_SEL_S 7 +/* GPIO_FUNC53_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC53_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC53_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC53_IN_INV_SEL_V 0x1 +#define GPIO_FUNC53_IN_INV_SEL_S 6 +/* GPIO_FUNC53_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC53_IN_SEL 0x0000003F +#define GPIO_FUNC53_IN_SEL_M ((GPIO_FUNC53_IN_SEL_V)<<(GPIO_FUNC53_IN_SEL_S)) +#define GPIO_FUNC53_IN_SEL_V 0x3F +#define GPIO_FUNC53_IN_SEL_S 0 + +#define GPIO_FUNC54_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x22C) +/* GPIO_SIG54_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG54_IN_SEL (BIT(7)) +#define GPIO_SIG54_IN_SEL_M (BIT(7)) +#define GPIO_SIG54_IN_SEL_V 0x1 +#define GPIO_SIG54_IN_SEL_S 7 +/* GPIO_FUNC54_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC54_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC54_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC54_IN_INV_SEL_V 0x1 +#define GPIO_FUNC54_IN_INV_SEL_S 6 +/* GPIO_FUNC54_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC54_IN_SEL 0x0000003F +#define GPIO_FUNC54_IN_SEL_M ((GPIO_FUNC54_IN_SEL_V)<<(GPIO_FUNC54_IN_SEL_S)) +#define GPIO_FUNC54_IN_SEL_V 0x3F +#define GPIO_FUNC54_IN_SEL_S 0 + +#define GPIO_FUNC55_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x230) +/* GPIO_SIG55_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG55_IN_SEL (BIT(7)) +#define GPIO_SIG55_IN_SEL_M (BIT(7)) +#define GPIO_SIG55_IN_SEL_V 0x1 +#define GPIO_SIG55_IN_SEL_S 7 +/* GPIO_FUNC55_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC55_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC55_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC55_IN_INV_SEL_V 0x1 +#define GPIO_FUNC55_IN_INV_SEL_S 6 +/* GPIO_FUNC55_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC55_IN_SEL 0x0000003F +#define GPIO_FUNC55_IN_SEL_M ((GPIO_FUNC55_IN_SEL_V)<<(GPIO_FUNC55_IN_SEL_S)) +#define GPIO_FUNC55_IN_SEL_V 0x3F +#define GPIO_FUNC55_IN_SEL_S 0 + +#define GPIO_FUNC56_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x234) +/* GPIO_SIG56_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG56_IN_SEL (BIT(7)) +#define GPIO_SIG56_IN_SEL_M (BIT(7)) +#define GPIO_SIG56_IN_SEL_V 0x1 +#define GPIO_SIG56_IN_SEL_S 7 +/* GPIO_FUNC56_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC56_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC56_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC56_IN_INV_SEL_V 0x1 +#define GPIO_FUNC56_IN_INV_SEL_S 6 +/* GPIO_FUNC56_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC56_IN_SEL 0x0000003F +#define GPIO_FUNC56_IN_SEL_M ((GPIO_FUNC56_IN_SEL_V)<<(GPIO_FUNC56_IN_SEL_S)) +#define GPIO_FUNC56_IN_SEL_V 0x3F +#define GPIO_FUNC56_IN_SEL_S 0 + +#define GPIO_FUNC57_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x238) +/* GPIO_SIG57_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG57_IN_SEL (BIT(7)) +#define GPIO_SIG57_IN_SEL_M (BIT(7)) +#define GPIO_SIG57_IN_SEL_V 0x1 +#define GPIO_SIG57_IN_SEL_S 7 +/* GPIO_FUNC57_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC57_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC57_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC57_IN_INV_SEL_V 0x1 +#define GPIO_FUNC57_IN_INV_SEL_S 6 +/* GPIO_FUNC57_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC57_IN_SEL 0x0000003F +#define GPIO_FUNC57_IN_SEL_M ((GPIO_FUNC57_IN_SEL_V)<<(GPIO_FUNC57_IN_SEL_S)) +#define GPIO_FUNC57_IN_SEL_V 0x3F +#define GPIO_FUNC57_IN_SEL_S 0 + +#define GPIO_FUNC58_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x23C) +/* GPIO_SIG58_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG58_IN_SEL (BIT(7)) +#define GPIO_SIG58_IN_SEL_M (BIT(7)) +#define GPIO_SIG58_IN_SEL_V 0x1 +#define GPIO_SIG58_IN_SEL_S 7 +/* GPIO_FUNC58_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC58_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC58_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC58_IN_INV_SEL_V 0x1 +#define GPIO_FUNC58_IN_INV_SEL_S 6 +/* GPIO_FUNC58_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC58_IN_SEL 0x0000003F +#define GPIO_FUNC58_IN_SEL_M ((GPIO_FUNC58_IN_SEL_V)<<(GPIO_FUNC58_IN_SEL_S)) +#define GPIO_FUNC58_IN_SEL_V 0x3F +#define GPIO_FUNC58_IN_SEL_S 0 + +#define GPIO_FUNC59_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x240) +/* GPIO_SIG59_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG59_IN_SEL (BIT(7)) +#define GPIO_SIG59_IN_SEL_M (BIT(7)) +#define GPIO_SIG59_IN_SEL_V 0x1 +#define GPIO_SIG59_IN_SEL_S 7 +/* GPIO_FUNC59_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC59_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC59_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC59_IN_INV_SEL_V 0x1 +#define GPIO_FUNC59_IN_INV_SEL_S 6 +/* GPIO_FUNC59_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC59_IN_SEL 0x0000003F +#define GPIO_FUNC59_IN_SEL_M ((GPIO_FUNC59_IN_SEL_V)<<(GPIO_FUNC59_IN_SEL_S)) +#define GPIO_FUNC59_IN_SEL_V 0x3F +#define GPIO_FUNC59_IN_SEL_S 0 + +#define GPIO_FUNC60_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x244) +/* GPIO_SIG60_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG60_IN_SEL (BIT(7)) +#define GPIO_SIG60_IN_SEL_M (BIT(7)) +#define GPIO_SIG60_IN_SEL_V 0x1 +#define GPIO_SIG60_IN_SEL_S 7 +/* GPIO_FUNC60_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC60_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC60_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC60_IN_INV_SEL_V 0x1 +#define GPIO_FUNC60_IN_INV_SEL_S 6 +/* GPIO_FUNC60_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC60_IN_SEL 0x0000003F +#define GPIO_FUNC60_IN_SEL_M ((GPIO_FUNC60_IN_SEL_V)<<(GPIO_FUNC60_IN_SEL_S)) +#define GPIO_FUNC60_IN_SEL_V 0x3F +#define GPIO_FUNC60_IN_SEL_S 0 + +#define GPIO_FUNC61_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x248) +/* GPIO_SIG61_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG61_IN_SEL (BIT(7)) +#define GPIO_SIG61_IN_SEL_M (BIT(7)) +#define GPIO_SIG61_IN_SEL_V 0x1 +#define GPIO_SIG61_IN_SEL_S 7 +/* GPIO_FUNC61_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC61_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC61_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC61_IN_INV_SEL_V 0x1 +#define GPIO_FUNC61_IN_INV_SEL_S 6 +/* GPIO_FUNC61_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC61_IN_SEL 0x0000003F +#define GPIO_FUNC61_IN_SEL_M ((GPIO_FUNC61_IN_SEL_V)<<(GPIO_FUNC61_IN_SEL_S)) +#define GPIO_FUNC61_IN_SEL_V 0x3F +#define GPIO_FUNC61_IN_SEL_S 0 + +#define GPIO_FUNC62_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x24C) +/* GPIO_SIG62_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG62_IN_SEL (BIT(7)) +#define GPIO_SIG62_IN_SEL_M (BIT(7)) +#define GPIO_SIG62_IN_SEL_V 0x1 +#define GPIO_SIG62_IN_SEL_S 7 +/* GPIO_FUNC62_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC62_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC62_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC62_IN_INV_SEL_V 0x1 +#define GPIO_FUNC62_IN_INV_SEL_S 6 +/* GPIO_FUNC62_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC62_IN_SEL 0x0000003F +#define GPIO_FUNC62_IN_SEL_M ((GPIO_FUNC62_IN_SEL_V)<<(GPIO_FUNC62_IN_SEL_S)) +#define GPIO_FUNC62_IN_SEL_V 0x3F +#define GPIO_FUNC62_IN_SEL_S 0 + +#define GPIO_FUNC63_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x250) +/* GPIO_SIG63_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG63_IN_SEL (BIT(7)) +#define GPIO_SIG63_IN_SEL_M (BIT(7)) +#define GPIO_SIG63_IN_SEL_V 0x1 +#define GPIO_SIG63_IN_SEL_S 7 +/* GPIO_FUNC63_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC63_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC63_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC63_IN_INV_SEL_V 0x1 +#define GPIO_FUNC63_IN_INV_SEL_S 6 +/* GPIO_FUNC63_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC63_IN_SEL 0x0000003F +#define GPIO_FUNC63_IN_SEL_M ((GPIO_FUNC63_IN_SEL_V)<<(GPIO_FUNC63_IN_SEL_S)) +#define GPIO_FUNC63_IN_SEL_V 0x3F +#define GPIO_FUNC63_IN_SEL_S 0 + +#define GPIO_FUNC64_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x254) +/* GPIO_SIG64_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG64_IN_SEL (BIT(7)) +#define GPIO_SIG64_IN_SEL_M (BIT(7)) +#define GPIO_SIG64_IN_SEL_V 0x1 +#define GPIO_SIG64_IN_SEL_S 7 +/* GPIO_FUNC64_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC64_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC64_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC64_IN_INV_SEL_V 0x1 +#define GPIO_FUNC64_IN_INV_SEL_S 6 +/* GPIO_FUNC64_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC64_IN_SEL 0x0000003F +#define GPIO_FUNC64_IN_SEL_M ((GPIO_FUNC64_IN_SEL_V)<<(GPIO_FUNC64_IN_SEL_S)) +#define GPIO_FUNC64_IN_SEL_V 0x3F +#define GPIO_FUNC64_IN_SEL_S 0 + +#define GPIO_FUNC65_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x258) +/* GPIO_SIG65_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG65_IN_SEL (BIT(7)) +#define GPIO_SIG65_IN_SEL_M (BIT(7)) +#define GPIO_SIG65_IN_SEL_V 0x1 +#define GPIO_SIG65_IN_SEL_S 7 +/* GPIO_FUNC65_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC65_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC65_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC65_IN_INV_SEL_V 0x1 +#define GPIO_FUNC65_IN_INV_SEL_S 6 +/* GPIO_FUNC65_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC65_IN_SEL 0x0000003F +#define GPIO_FUNC65_IN_SEL_M ((GPIO_FUNC65_IN_SEL_V)<<(GPIO_FUNC65_IN_SEL_S)) +#define GPIO_FUNC65_IN_SEL_V 0x3F +#define GPIO_FUNC65_IN_SEL_S 0 + +#define GPIO_FUNC66_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x25C) +/* GPIO_SIG66_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG66_IN_SEL (BIT(7)) +#define GPIO_SIG66_IN_SEL_M (BIT(7)) +#define GPIO_SIG66_IN_SEL_V 0x1 +#define GPIO_SIG66_IN_SEL_S 7 +/* GPIO_FUNC66_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC66_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC66_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC66_IN_INV_SEL_V 0x1 +#define GPIO_FUNC66_IN_INV_SEL_S 6 +/* GPIO_FUNC66_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC66_IN_SEL 0x0000003F +#define GPIO_FUNC66_IN_SEL_M ((GPIO_FUNC66_IN_SEL_V)<<(GPIO_FUNC66_IN_SEL_S)) +#define GPIO_FUNC66_IN_SEL_V 0x3F +#define GPIO_FUNC66_IN_SEL_S 0 + +#define GPIO_FUNC67_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x260) +/* GPIO_SIG67_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG67_IN_SEL (BIT(7)) +#define GPIO_SIG67_IN_SEL_M (BIT(7)) +#define GPIO_SIG67_IN_SEL_V 0x1 +#define GPIO_SIG67_IN_SEL_S 7 +/* GPIO_FUNC67_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC67_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC67_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC67_IN_INV_SEL_V 0x1 +#define GPIO_FUNC67_IN_INV_SEL_S 6 +/* GPIO_FUNC67_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC67_IN_SEL 0x0000003F +#define GPIO_FUNC67_IN_SEL_M ((GPIO_FUNC67_IN_SEL_V)<<(GPIO_FUNC67_IN_SEL_S)) +#define GPIO_FUNC67_IN_SEL_V 0x3F +#define GPIO_FUNC67_IN_SEL_S 0 + +#define GPIO_FUNC68_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x264) +/* GPIO_SIG68_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG68_IN_SEL (BIT(7)) +#define GPIO_SIG68_IN_SEL_M (BIT(7)) +#define GPIO_SIG68_IN_SEL_V 0x1 +#define GPIO_SIG68_IN_SEL_S 7 +/* GPIO_FUNC68_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC68_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC68_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC68_IN_INV_SEL_V 0x1 +#define GPIO_FUNC68_IN_INV_SEL_S 6 +/* GPIO_FUNC68_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC68_IN_SEL 0x0000003F +#define GPIO_FUNC68_IN_SEL_M ((GPIO_FUNC68_IN_SEL_V)<<(GPIO_FUNC68_IN_SEL_S)) +#define GPIO_FUNC68_IN_SEL_V 0x3F +#define GPIO_FUNC68_IN_SEL_S 0 + +#define GPIO_FUNC69_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x268) +/* GPIO_SIG69_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG69_IN_SEL (BIT(7)) +#define GPIO_SIG69_IN_SEL_M (BIT(7)) +#define GPIO_SIG69_IN_SEL_V 0x1 +#define GPIO_SIG69_IN_SEL_S 7 +/* GPIO_FUNC69_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC69_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC69_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC69_IN_INV_SEL_V 0x1 +#define GPIO_FUNC69_IN_INV_SEL_S 6 +/* GPIO_FUNC69_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC69_IN_SEL 0x0000003F +#define GPIO_FUNC69_IN_SEL_M ((GPIO_FUNC69_IN_SEL_V)<<(GPIO_FUNC69_IN_SEL_S)) +#define GPIO_FUNC69_IN_SEL_V 0x3F +#define GPIO_FUNC69_IN_SEL_S 0 + +#define GPIO_FUNC70_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x26C) +/* GPIO_SIG70_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG70_IN_SEL (BIT(7)) +#define GPIO_SIG70_IN_SEL_M (BIT(7)) +#define GPIO_SIG70_IN_SEL_V 0x1 +#define GPIO_SIG70_IN_SEL_S 7 +/* GPIO_FUNC70_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC70_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC70_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC70_IN_INV_SEL_V 0x1 +#define GPIO_FUNC70_IN_INV_SEL_S 6 +/* GPIO_FUNC70_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC70_IN_SEL 0x0000003F +#define GPIO_FUNC70_IN_SEL_M ((GPIO_FUNC70_IN_SEL_V)<<(GPIO_FUNC70_IN_SEL_S)) +#define GPIO_FUNC70_IN_SEL_V 0x3F +#define GPIO_FUNC70_IN_SEL_S 0 + +#define GPIO_FUNC71_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x270) +/* GPIO_SIG71_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG71_IN_SEL (BIT(7)) +#define GPIO_SIG71_IN_SEL_M (BIT(7)) +#define GPIO_SIG71_IN_SEL_V 0x1 +#define GPIO_SIG71_IN_SEL_S 7 +/* GPIO_FUNC71_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC71_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC71_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC71_IN_INV_SEL_V 0x1 +#define GPIO_FUNC71_IN_INV_SEL_S 6 +/* GPIO_FUNC71_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC71_IN_SEL 0x0000003F +#define GPIO_FUNC71_IN_SEL_M ((GPIO_FUNC71_IN_SEL_V)<<(GPIO_FUNC71_IN_SEL_S)) +#define GPIO_FUNC71_IN_SEL_V 0x3F +#define GPIO_FUNC71_IN_SEL_S 0 + +#define GPIO_FUNC72_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x274) +/* GPIO_SIG72_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG72_IN_SEL (BIT(7)) +#define GPIO_SIG72_IN_SEL_M (BIT(7)) +#define GPIO_SIG72_IN_SEL_V 0x1 +#define GPIO_SIG72_IN_SEL_S 7 +/* GPIO_FUNC72_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC72_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC72_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC72_IN_INV_SEL_V 0x1 +#define GPIO_FUNC72_IN_INV_SEL_S 6 +/* GPIO_FUNC72_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC72_IN_SEL 0x0000003F +#define GPIO_FUNC72_IN_SEL_M ((GPIO_FUNC72_IN_SEL_V)<<(GPIO_FUNC72_IN_SEL_S)) +#define GPIO_FUNC72_IN_SEL_V 0x3F +#define GPIO_FUNC72_IN_SEL_S 0 + +#define GPIO_FUNC73_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x278) +/* GPIO_SIG73_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG73_IN_SEL (BIT(7)) +#define GPIO_SIG73_IN_SEL_M (BIT(7)) +#define GPIO_SIG73_IN_SEL_V 0x1 +#define GPIO_SIG73_IN_SEL_S 7 +/* GPIO_FUNC73_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC73_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC73_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC73_IN_INV_SEL_V 0x1 +#define GPIO_FUNC73_IN_INV_SEL_S 6 +/* GPIO_FUNC73_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC73_IN_SEL 0x0000003F +#define GPIO_FUNC73_IN_SEL_M ((GPIO_FUNC73_IN_SEL_V)<<(GPIO_FUNC73_IN_SEL_S)) +#define GPIO_FUNC73_IN_SEL_V 0x3F +#define GPIO_FUNC73_IN_SEL_S 0 + +#define GPIO_FUNC74_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x27C) +/* GPIO_SIG74_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG74_IN_SEL (BIT(7)) +#define GPIO_SIG74_IN_SEL_M (BIT(7)) +#define GPIO_SIG74_IN_SEL_V 0x1 +#define GPIO_SIG74_IN_SEL_S 7 +/* GPIO_FUNC74_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC74_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC74_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC74_IN_INV_SEL_V 0x1 +#define GPIO_FUNC74_IN_INV_SEL_S 6 +/* GPIO_FUNC74_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC74_IN_SEL 0x0000003F +#define GPIO_FUNC74_IN_SEL_M ((GPIO_FUNC74_IN_SEL_V)<<(GPIO_FUNC74_IN_SEL_S)) +#define GPIO_FUNC74_IN_SEL_V 0x3F +#define GPIO_FUNC74_IN_SEL_S 0 + +#define GPIO_FUNC75_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x280) +/* GPIO_SIG75_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG75_IN_SEL (BIT(7)) +#define GPIO_SIG75_IN_SEL_M (BIT(7)) +#define GPIO_SIG75_IN_SEL_V 0x1 +#define GPIO_SIG75_IN_SEL_S 7 +/* GPIO_FUNC75_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC75_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC75_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC75_IN_INV_SEL_V 0x1 +#define GPIO_FUNC75_IN_INV_SEL_S 6 +/* GPIO_FUNC75_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC75_IN_SEL 0x0000003F +#define GPIO_FUNC75_IN_SEL_M ((GPIO_FUNC75_IN_SEL_V)<<(GPIO_FUNC75_IN_SEL_S)) +#define GPIO_FUNC75_IN_SEL_V 0x3F +#define GPIO_FUNC75_IN_SEL_S 0 + +#define GPIO_FUNC76_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x284) +/* GPIO_SIG76_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG76_IN_SEL (BIT(7)) +#define GPIO_SIG76_IN_SEL_M (BIT(7)) +#define GPIO_SIG76_IN_SEL_V 0x1 +#define GPIO_SIG76_IN_SEL_S 7 +/* GPIO_FUNC76_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC76_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC76_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC76_IN_INV_SEL_V 0x1 +#define GPIO_FUNC76_IN_INV_SEL_S 6 +/* GPIO_FUNC76_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC76_IN_SEL 0x0000003F +#define GPIO_FUNC76_IN_SEL_M ((GPIO_FUNC76_IN_SEL_V)<<(GPIO_FUNC76_IN_SEL_S)) +#define GPIO_FUNC76_IN_SEL_V 0x3F +#define GPIO_FUNC76_IN_SEL_S 0 + +#define GPIO_FUNC77_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x288) +/* GPIO_SIG77_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG77_IN_SEL (BIT(7)) +#define GPIO_SIG77_IN_SEL_M (BIT(7)) +#define GPIO_SIG77_IN_SEL_V 0x1 +#define GPIO_SIG77_IN_SEL_S 7 +/* GPIO_FUNC77_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC77_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC77_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC77_IN_INV_SEL_V 0x1 +#define GPIO_FUNC77_IN_INV_SEL_S 6 +/* GPIO_FUNC77_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC77_IN_SEL 0x0000003F +#define GPIO_FUNC77_IN_SEL_M ((GPIO_FUNC77_IN_SEL_V)<<(GPIO_FUNC77_IN_SEL_S)) +#define GPIO_FUNC77_IN_SEL_V 0x3F +#define GPIO_FUNC77_IN_SEL_S 0 + +#define GPIO_FUNC78_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x28C) +/* GPIO_SIG78_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG78_IN_SEL (BIT(7)) +#define GPIO_SIG78_IN_SEL_M (BIT(7)) +#define GPIO_SIG78_IN_SEL_V 0x1 +#define GPIO_SIG78_IN_SEL_S 7 +/* GPIO_FUNC78_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC78_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC78_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC78_IN_INV_SEL_V 0x1 +#define GPIO_FUNC78_IN_INV_SEL_S 6 +/* GPIO_FUNC78_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC78_IN_SEL 0x0000003F +#define GPIO_FUNC78_IN_SEL_M ((GPIO_FUNC78_IN_SEL_V)<<(GPIO_FUNC78_IN_SEL_S)) +#define GPIO_FUNC78_IN_SEL_V 0x3F +#define GPIO_FUNC78_IN_SEL_S 0 + +#define GPIO_FUNC79_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x290) +/* GPIO_SIG79_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG79_IN_SEL (BIT(7)) +#define GPIO_SIG79_IN_SEL_M (BIT(7)) +#define GPIO_SIG79_IN_SEL_V 0x1 +#define GPIO_SIG79_IN_SEL_S 7 +/* GPIO_FUNC79_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC79_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC79_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC79_IN_INV_SEL_V 0x1 +#define GPIO_FUNC79_IN_INV_SEL_S 6 +/* GPIO_FUNC79_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC79_IN_SEL 0x0000003F +#define GPIO_FUNC79_IN_SEL_M ((GPIO_FUNC79_IN_SEL_V)<<(GPIO_FUNC79_IN_SEL_S)) +#define GPIO_FUNC79_IN_SEL_V 0x3F +#define GPIO_FUNC79_IN_SEL_S 0 + +#define GPIO_FUNC80_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x294) +/* GPIO_SIG80_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG80_IN_SEL (BIT(7)) +#define GPIO_SIG80_IN_SEL_M (BIT(7)) +#define GPIO_SIG80_IN_SEL_V 0x1 +#define GPIO_SIG80_IN_SEL_S 7 +/* GPIO_FUNC80_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC80_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC80_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC80_IN_INV_SEL_V 0x1 +#define GPIO_FUNC80_IN_INV_SEL_S 6 +/* GPIO_FUNC80_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC80_IN_SEL 0x0000003F +#define GPIO_FUNC80_IN_SEL_M ((GPIO_FUNC80_IN_SEL_V)<<(GPIO_FUNC80_IN_SEL_S)) +#define GPIO_FUNC80_IN_SEL_V 0x3F +#define GPIO_FUNC80_IN_SEL_S 0 + +#define GPIO_FUNC81_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x298) +/* GPIO_SIG81_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG81_IN_SEL (BIT(7)) +#define GPIO_SIG81_IN_SEL_M (BIT(7)) +#define GPIO_SIG81_IN_SEL_V 0x1 +#define GPIO_SIG81_IN_SEL_S 7 +/* GPIO_FUNC81_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC81_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC81_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC81_IN_INV_SEL_V 0x1 +#define GPIO_FUNC81_IN_INV_SEL_S 6 +/* GPIO_FUNC81_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC81_IN_SEL 0x0000003F +#define GPIO_FUNC81_IN_SEL_M ((GPIO_FUNC81_IN_SEL_V)<<(GPIO_FUNC81_IN_SEL_S)) +#define GPIO_FUNC81_IN_SEL_V 0x3F +#define GPIO_FUNC81_IN_SEL_S 0 + +#define GPIO_FUNC82_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x29C) +/* GPIO_SIG82_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG82_IN_SEL (BIT(7)) +#define GPIO_SIG82_IN_SEL_M (BIT(7)) +#define GPIO_SIG82_IN_SEL_V 0x1 +#define GPIO_SIG82_IN_SEL_S 7 +/* GPIO_FUNC82_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC82_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC82_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC82_IN_INV_SEL_V 0x1 +#define GPIO_FUNC82_IN_INV_SEL_S 6 +/* GPIO_FUNC82_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC82_IN_SEL 0x0000003F +#define GPIO_FUNC82_IN_SEL_M ((GPIO_FUNC82_IN_SEL_V)<<(GPIO_FUNC82_IN_SEL_S)) +#define GPIO_FUNC82_IN_SEL_V 0x3F +#define GPIO_FUNC82_IN_SEL_S 0 + +#define GPIO_FUNC83_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2A0) +/* GPIO_SIG83_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG83_IN_SEL (BIT(7)) +#define GPIO_SIG83_IN_SEL_M (BIT(7)) +#define GPIO_SIG83_IN_SEL_V 0x1 +#define GPIO_SIG83_IN_SEL_S 7 +/* GPIO_FUNC83_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC83_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC83_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC83_IN_INV_SEL_V 0x1 +#define GPIO_FUNC83_IN_INV_SEL_S 6 +/* GPIO_FUNC83_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC83_IN_SEL 0x0000003F +#define GPIO_FUNC83_IN_SEL_M ((GPIO_FUNC83_IN_SEL_V)<<(GPIO_FUNC83_IN_SEL_S)) +#define GPIO_FUNC83_IN_SEL_V 0x3F +#define GPIO_FUNC83_IN_SEL_S 0 + +#define GPIO_FUNC84_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2A4) +/* GPIO_SIG84_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG84_IN_SEL (BIT(7)) +#define GPIO_SIG84_IN_SEL_M (BIT(7)) +#define GPIO_SIG84_IN_SEL_V 0x1 +#define GPIO_SIG84_IN_SEL_S 7 +/* GPIO_FUNC84_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC84_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC84_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC84_IN_INV_SEL_V 0x1 +#define GPIO_FUNC84_IN_INV_SEL_S 6 +/* GPIO_FUNC84_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC84_IN_SEL 0x0000003F +#define GPIO_FUNC84_IN_SEL_M ((GPIO_FUNC84_IN_SEL_V)<<(GPIO_FUNC84_IN_SEL_S)) +#define GPIO_FUNC84_IN_SEL_V 0x3F +#define GPIO_FUNC84_IN_SEL_S 0 + +#define GPIO_FUNC85_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2A8) +/* GPIO_SIG85_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG85_IN_SEL (BIT(7)) +#define GPIO_SIG85_IN_SEL_M (BIT(7)) +#define GPIO_SIG85_IN_SEL_V 0x1 +#define GPIO_SIG85_IN_SEL_S 7 +/* GPIO_FUNC85_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC85_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC85_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC85_IN_INV_SEL_V 0x1 +#define GPIO_FUNC85_IN_INV_SEL_S 6 +/* GPIO_FUNC85_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC85_IN_SEL 0x0000003F +#define GPIO_FUNC85_IN_SEL_M ((GPIO_FUNC85_IN_SEL_V)<<(GPIO_FUNC85_IN_SEL_S)) +#define GPIO_FUNC85_IN_SEL_V 0x3F +#define GPIO_FUNC85_IN_SEL_S 0 + +#define GPIO_FUNC86_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2AC) +/* GPIO_SIG86_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG86_IN_SEL (BIT(7)) +#define GPIO_SIG86_IN_SEL_M (BIT(7)) +#define GPIO_SIG86_IN_SEL_V 0x1 +#define GPIO_SIG86_IN_SEL_S 7 +/* GPIO_FUNC86_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC86_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC86_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC86_IN_INV_SEL_V 0x1 +#define GPIO_FUNC86_IN_INV_SEL_S 6 +/* GPIO_FUNC86_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC86_IN_SEL 0x0000003F +#define GPIO_FUNC86_IN_SEL_M ((GPIO_FUNC86_IN_SEL_V)<<(GPIO_FUNC86_IN_SEL_S)) +#define GPIO_FUNC86_IN_SEL_V 0x3F +#define GPIO_FUNC86_IN_SEL_S 0 + +#define GPIO_FUNC87_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2B0) +/* GPIO_SIG87_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG87_IN_SEL (BIT(7)) +#define GPIO_SIG87_IN_SEL_M (BIT(7)) +#define GPIO_SIG87_IN_SEL_V 0x1 +#define GPIO_SIG87_IN_SEL_S 7 +/* GPIO_FUNC87_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC87_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC87_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC87_IN_INV_SEL_V 0x1 +#define GPIO_FUNC87_IN_INV_SEL_S 6 +/* GPIO_FUNC87_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC87_IN_SEL 0x0000003F +#define GPIO_FUNC87_IN_SEL_M ((GPIO_FUNC87_IN_SEL_V)<<(GPIO_FUNC87_IN_SEL_S)) +#define GPIO_FUNC87_IN_SEL_V 0x3F +#define GPIO_FUNC87_IN_SEL_S 0 + +#define GPIO_FUNC88_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2B4) +/* GPIO_SIG88_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG88_IN_SEL (BIT(7)) +#define GPIO_SIG88_IN_SEL_M (BIT(7)) +#define GPIO_SIG88_IN_SEL_V 0x1 +#define GPIO_SIG88_IN_SEL_S 7 +/* GPIO_FUNC88_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC88_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC88_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC88_IN_INV_SEL_V 0x1 +#define GPIO_FUNC88_IN_INV_SEL_S 6 +/* GPIO_FUNC88_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC88_IN_SEL 0x0000003F +#define GPIO_FUNC88_IN_SEL_M ((GPIO_FUNC88_IN_SEL_V)<<(GPIO_FUNC88_IN_SEL_S)) +#define GPIO_FUNC88_IN_SEL_V 0x3F +#define GPIO_FUNC88_IN_SEL_S 0 + +#define GPIO_FUNC89_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2B8) +/* GPIO_SIG89_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG89_IN_SEL (BIT(7)) +#define GPIO_SIG89_IN_SEL_M (BIT(7)) +#define GPIO_SIG89_IN_SEL_V 0x1 +#define GPIO_SIG89_IN_SEL_S 7 +/* GPIO_FUNC89_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC89_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC89_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC89_IN_INV_SEL_V 0x1 +#define GPIO_FUNC89_IN_INV_SEL_S 6 +/* GPIO_FUNC89_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC89_IN_SEL 0x0000003F +#define GPIO_FUNC89_IN_SEL_M ((GPIO_FUNC89_IN_SEL_V)<<(GPIO_FUNC89_IN_SEL_S)) +#define GPIO_FUNC89_IN_SEL_V 0x3F +#define GPIO_FUNC89_IN_SEL_S 0 + +#define GPIO_FUNC90_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2BC) +/* GPIO_SIG90_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG90_IN_SEL (BIT(7)) +#define GPIO_SIG90_IN_SEL_M (BIT(7)) +#define GPIO_SIG90_IN_SEL_V 0x1 +#define GPIO_SIG90_IN_SEL_S 7 +/* GPIO_FUNC90_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC90_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC90_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC90_IN_INV_SEL_V 0x1 +#define GPIO_FUNC90_IN_INV_SEL_S 6 +/* GPIO_FUNC90_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC90_IN_SEL 0x0000003F +#define GPIO_FUNC90_IN_SEL_M ((GPIO_FUNC90_IN_SEL_V)<<(GPIO_FUNC90_IN_SEL_S)) +#define GPIO_FUNC90_IN_SEL_V 0x3F +#define GPIO_FUNC90_IN_SEL_S 0 + +#define GPIO_FUNC91_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2C0) +/* GPIO_SIG91_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG91_IN_SEL (BIT(7)) +#define GPIO_SIG91_IN_SEL_M (BIT(7)) +#define GPIO_SIG91_IN_SEL_V 0x1 +#define GPIO_SIG91_IN_SEL_S 7 +/* GPIO_FUNC91_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC91_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC91_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC91_IN_INV_SEL_V 0x1 +#define GPIO_FUNC91_IN_INV_SEL_S 6 +/* GPIO_FUNC91_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC91_IN_SEL 0x0000003F +#define GPIO_FUNC91_IN_SEL_M ((GPIO_FUNC91_IN_SEL_V)<<(GPIO_FUNC91_IN_SEL_S)) +#define GPIO_FUNC91_IN_SEL_V 0x3F +#define GPIO_FUNC91_IN_SEL_S 0 + +#define GPIO_FUNC92_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2C4) +/* GPIO_SIG92_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG92_IN_SEL (BIT(7)) +#define GPIO_SIG92_IN_SEL_M (BIT(7)) +#define GPIO_SIG92_IN_SEL_V 0x1 +#define GPIO_SIG92_IN_SEL_S 7 +/* GPIO_FUNC92_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC92_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC92_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC92_IN_INV_SEL_V 0x1 +#define GPIO_FUNC92_IN_INV_SEL_S 6 +/* GPIO_FUNC92_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC92_IN_SEL 0x0000003F +#define GPIO_FUNC92_IN_SEL_M ((GPIO_FUNC92_IN_SEL_V)<<(GPIO_FUNC92_IN_SEL_S)) +#define GPIO_FUNC92_IN_SEL_V 0x3F +#define GPIO_FUNC92_IN_SEL_S 0 + +#define GPIO_FUNC93_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2C8) +/* GPIO_SIG93_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG93_IN_SEL (BIT(7)) +#define GPIO_SIG93_IN_SEL_M (BIT(7)) +#define GPIO_SIG93_IN_SEL_V 0x1 +#define GPIO_SIG93_IN_SEL_S 7 +/* GPIO_FUNC93_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC93_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC93_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC93_IN_INV_SEL_V 0x1 +#define GPIO_FUNC93_IN_INV_SEL_S 6 +/* GPIO_FUNC93_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC93_IN_SEL 0x0000003F +#define GPIO_FUNC93_IN_SEL_M ((GPIO_FUNC93_IN_SEL_V)<<(GPIO_FUNC93_IN_SEL_S)) +#define GPIO_FUNC93_IN_SEL_V 0x3F +#define GPIO_FUNC93_IN_SEL_S 0 + +#define GPIO_FUNC94_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2CC) +/* GPIO_SIG94_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG94_IN_SEL (BIT(7)) +#define GPIO_SIG94_IN_SEL_M (BIT(7)) +#define GPIO_SIG94_IN_SEL_V 0x1 +#define GPIO_SIG94_IN_SEL_S 7 +/* GPIO_FUNC94_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC94_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC94_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC94_IN_INV_SEL_V 0x1 +#define GPIO_FUNC94_IN_INV_SEL_S 6 +/* GPIO_FUNC94_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC94_IN_SEL 0x0000003F +#define GPIO_FUNC94_IN_SEL_M ((GPIO_FUNC94_IN_SEL_V)<<(GPIO_FUNC94_IN_SEL_S)) +#define GPIO_FUNC94_IN_SEL_V 0x3F +#define GPIO_FUNC94_IN_SEL_S 0 + +#define GPIO_FUNC95_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2D0) +/* GPIO_SIG95_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG95_IN_SEL (BIT(7)) +#define GPIO_SIG95_IN_SEL_M (BIT(7)) +#define GPIO_SIG95_IN_SEL_V 0x1 +#define GPIO_SIG95_IN_SEL_S 7 +/* GPIO_FUNC95_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC95_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC95_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC95_IN_INV_SEL_V 0x1 +#define GPIO_FUNC95_IN_INV_SEL_S 6 +/* GPIO_FUNC95_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC95_IN_SEL 0x0000003F +#define GPIO_FUNC95_IN_SEL_M ((GPIO_FUNC95_IN_SEL_V)<<(GPIO_FUNC95_IN_SEL_S)) +#define GPIO_FUNC95_IN_SEL_V 0x3F +#define GPIO_FUNC95_IN_SEL_S 0 + +#define GPIO_FUNC96_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2D4) +/* GPIO_SIG96_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG96_IN_SEL (BIT(7)) +#define GPIO_SIG96_IN_SEL_M (BIT(7)) +#define GPIO_SIG96_IN_SEL_V 0x1 +#define GPIO_SIG96_IN_SEL_S 7 +/* GPIO_FUNC96_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC96_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC96_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC96_IN_INV_SEL_V 0x1 +#define GPIO_FUNC96_IN_INV_SEL_S 6 +/* GPIO_FUNC96_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC96_IN_SEL 0x0000003F +#define GPIO_FUNC96_IN_SEL_M ((GPIO_FUNC96_IN_SEL_V)<<(GPIO_FUNC96_IN_SEL_S)) +#define GPIO_FUNC96_IN_SEL_V 0x3F +#define GPIO_FUNC96_IN_SEL_S 0 + +#define GPIO_FUNC97_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2D8) +/* GPIO_SIG97_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG97_IN_SEL (BIT(7)) +#define GPIO_SIG97_IN_SEL_M (BIT(7)) +#define GPIO_SIG97_IN_SEL_V 0x1 +#define GPIO_SIG97_IN_SEL_S 7 +/* GPIO_FUNC97_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC97_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC97_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC97_IN_INV_SEL_V 0x1 +#define GPIO_FUNC97_IN_INV_SEL_S 6 +/* GPIO_FUNC97_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC97_IN_SEL 0x0000003F +#define GPIO_FUNC97_IN_SEL_M ((GPIO_FUNC97_IN_SEL_V)<<(GPIO_FUNC97_IN_SEL_S)) +#define GPIO_FUNC97_IN_SEL_V 0x3F +#define GPIO_FUNC97_IN_SEL_S 0 + +#define GPIO_FUNC98_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2DC) +/* GPIO_SIG98_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG98_IN_SEL (BIT(7)) +#define GPIO_SIG98_IN_SEL_M (BIT(7)) +#define GPIO_SIG98_IN_SEL_V 0x1 +#define GPIO_SIG98_IN_SEL_S 7 +/* GPIO_FUNC98_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC98_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC98_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC98_IN_INV_SEL_V 0x1 +#define GPIO_FUNC98_IN_INV_SEL_S 6 +/* GPIO_FUNC98_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC98_IN_SEL 0x0000003F +#define GPIO_FUNC98_IN_SEL_M ((GPIO_FUNC98_IN_SEL_V)<<(GPIO_FUNC98_IN_SEL_S)) +#define GPIO_FUNC98_IN_SEL_V 0x3F +#define GPIO_FUNC98_IN_SEL_S 0 + +#define GPIO_FUNC99_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2E0) +/* GPIO_SIG99_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG99_IN_SEL (BIT(7)) +#define GPIO_SIG99_IN_SEL_M (BIT(7)) +#define GPIO_SIG99_IN_SEL_V 0x1 +#define GPIO_SIG99_IN_SEL_S 7 +/* GPIO_FUNC99_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC99_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC99_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC99_IN_INV_SEL_V 0x1 +#define GPIO_FUNC99_IN_INV_SEL_S 6 +/* GPIO_FUNC99_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC99_IN_SEL 0x0000003F +#define GPIO_FUNC99_IN_SEL_M ((GPIO_FUNC99_IN_SEL_V)<<(GPIO_FUNC99_IN_SEL_S)) +#define GPIO_FUNC99_IN_SEL_V 0x3F +#define GPIO_FUNC99_IN_SEL_S 0 + +#define GPIO_FUNC100_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2E4) +/* GPIO_SIG100_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG100_IN_SEL (BIT(7)) +#define GPIO_SIG100_IN_SEL_M (BIT(7)) +#define GPIO_SIG100_IN_SEL_V 0x1 +#define GPIO_SIG100_IN_SEL_S 7 +/* GPIO_FUNC100_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC100_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC100_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC100_IN_INV_SEL_V 0x1 +#define GPIO_FUNC100_IN_INV_SEL_S 6 +/* GPIO_FUNC100_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC100_IN_SEL 0x0000003F +#define GPIO_FUNC100_IN_SEL_M ((GPIO_FUNC100_IN_SEL_V)<<(GPIO_FUNC100_IN_SEL_S)) +#define GPIO_FUNC100_IN_SEL_V 0x3F +#define GPIO_FUNC100_IN_SEL_S 0 + +#define GPIO_FUNC101_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2E8) +/* GPIO_SIG101_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG101_IN_SEL (BIT(7)) +#define GPIO_SIG101_IN_SEL_M (BIT(7)) +#define GPIO_SIG101_IN_SEL_V 0x1 +#define GPIO_SIG101_IN_SEL_S 7 +/* GPIO_FUNC101_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC101_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC101_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC101_IN_INV_SEL_V 0x1 +#define GPIO_FUNC101_IN_INV_SEL_S 6 +/* GPIO_FUNC101_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC101_IN_SEL 0x0000003F +#define GPIO_FUNC101_IN_SEL_M ((GPIO_FUNC101_IN_SEL_V)<<(GPIO_FUNC101_IN_SEL_S)) +#define GPIO_FUNC101_IN_SEL_V 0x3F +#define GPIO_FUNC101_IN_SEL_S 0 + +#define GPIO_FUNC102_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2EC) +/* GPIO_SIG102_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG102_IN_SEL (BIT(7)) +#define GPIO_SIG102_IN_SEL_M (BIT(7)) +#define GPIO_SIG102_IN_SEL_V 0x1 +#define GPIO_SIG102_IN_SEL_S 7 +/* GPIO_FUNC102_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC102_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC102_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC102_IN_INV_SEL_V 0x1 +#define GPIO_FUNC102_IN_INV_SEL_S 6 +/* GPIO_FUNC102_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC102_IN_SEL 0x0000003F +#define GPIO_FUNC102_IN_SEL_M ((GPIO_FUNC102_IN_SEL_V)<<(GPIO_FUNC102_IN_SEL_S)) +#define GPIO_FUNC102_IN_SEL_V 0x3F +#define GPIO_FUNC102_IN_SEL_S 0 + +#define GPIO_FUNC103_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2F0) +/* GPIO_SIG103_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG103_IN_SEL (BIT(7)) +#define GPIO_SIG103_IN_SEL_M (BIT(7)) +#define GPIO_SIG103_IN_SEL_V 0x1 +#define GPIO_SIG103_IN_SEL_S 7 +/* GPIO_FUNC103_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC103_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC103_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC103_IN_INV_SEL_V 0x1 +#define GPIO_FUNC103_IN_INV_SEL_S 6 +/* GPIO_FUNC103_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC103_IN_SEL 0x0000003F +#define GPIO_FUNC103_IN_SEL_M ((GPIO_FUNC103_IN_SEL_V)<<(GPIO_FUNC103_IN_SEL_S)) +#define GPIO_FUNC103_IN_SEL_V 0x3F +#define GPIO_FUNC103_IN_SEL_S 0 + +#define GPIO_FUNC104_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2F4) +/* GPIO_SIG104_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG104_IN_SEL (BIT(7)) +#define GPIO_SIG104_IN_SEL_M (BIT(7)) +#define GPIO_SIG104_IN_SEL_V 0x1 +#define GPIO_SIG104_IN_SEL_S 7 +/* GPIO_FUNC104_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC104_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC104_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC104_IN_INV_SEL_V 0x1 +#define GPIO_FUNC104_IN_INV_SEL_S 6 +/* GPIO_FUNC104_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC104_IN_SEL 0x0000003F +#define GPIO_FUNC104_IN_SEL_M ((GPIO_FUNC104_IN_SEL_V)<<(GPIO_FUNC104_IN_SEL_S)) +#define GPIO_FUNC104_IN_SEL_V 0x3F +#define GPIO_FUNC104_IN_SEL_S 0 + +#define GPIO_FUNC105_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2F8) +/* GPIO_SIG105_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG105_IN_SEL (BIT(7)) +#define GPIO_SIG105_IN_SEL_M (BIT(7)) +#define GPIO_SIG105_IN_SEL_V 0x1 +#define GPIO_SIG105_IN_SEL_S 7 +/* GPIO_FUNC105_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC105_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC105_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC105_IN_INV_SEL_V 0x1 +#define GPIO_FUNC105_IN_INV_SEL_S 6 +/* GPIO_FUNC105_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC105_IN_SEL 0x0000003F +#define GPIO_FUNC105_IN_SEL_M ((GPIO_FUNC105_IN_SEL_V)<<(GPIO_FUNC105_IN_SEL_S)) +#define GPIO_FUNC105_IN_SEL_V 0x3F +#define GPIO_FUNC105_IN_SEL_S 0 + +#define GPIO_FUNC106_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x2FC) +/* GPIO_SIG106_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG106_IN_SEL (BIT(7)) +#define GPIO_SIG106_IN_SEL_M (BIT(7)) +#define GPIO_SIG106_IN_SEL_V 0x1 +#define GPIO_SIG106_IN_SEL_S 7 +/* GPIO_FUNC106_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC106_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC106_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC106_IN_INV_SEL_V 0x1 +#define GPIO_FUNC106_IN_INV_SEL_S 6 +/* GPIO_FUNC106_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC106_IN_SEL 0x0000003F +#define GPIO_FUNC106_IN_SEL_M ((GPIO_FUNC106_IN_SEL_V)<<(GPIO_FUNC106_IN_SEL_S)) +#define GPIO_FUNC106_IN_SEL_V 0x3F +#define GPIO_FUNC106_IN_SEL_S 0 + +#define GPIO_FUNC107_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x300) +/* GPIO_SIG107_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG107_IN_SEL (BIT(7)) +#define GPIO_SIG107_IN_SEL_M (BIT(7)) +#define GPIO_SIG107_IN_SEL_V 0x1 +#define GPIO_SIG107_IN_SEL_S 7 +/* GPIO_FUNC107_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC107_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC107_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC107_IN_INV_SEL_V 0x1 +#define GPIO_FUNC107_IN_INV_SEL_S 6 +/* GPIO_FUNC107_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC107_IN_SEL 0x0000003F +#define GPIO_FUNC107_IN_SEL_M ((GPIO_FUNC107_IN_SEL_V)<<(GPIO_FUNC107_IN_SEL_S)) +#define GPIO_FUNC107_IN_SEL_V 0x3F +#define GPIO_FUNC107_IN_SEL_S 0 + +#define GPIO_FUNC108_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x304) +/* GPIO_SIG108_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG108_IN_SEL (BIT(7)) +#define GPIO_SIG108_IN_SEL_M (BIT(7)) +#define GPIO_SIG108_IN_SEL_V 0x1 +#define GPIO_SIG108_IN_SEL_S 7 +/* GPIO_FUNC108_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC108_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC108_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC108_IN_INV_SEL_V 0x1 +#define GPIO_FUNC108_IN_INV_SEL_S 6 +/* GPIO_FUNC108_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC108_IN_SEL 0x0000003F +#define GPIO_FUNC108_IN_SEL_M ((GPIO_FUNC108_IN_SEL_V)<<(GPIO_FUNC108_IN_SEL_S)) +#define GPIO_FUNC108_IN_SEL_V 0x3F +#define GPIO_FUNC108_IN_SEL_S 0 + +#define GPIO_FUNC109_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x308) +/* GPIO_SIG109_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG109_IN_SEL (BIT(7)) +#define GPIO_SIG109_IN_SEL_M (BIT(7)) +#define GPIO_SIG109_IN_SEL_V 0x1 +#define GPIO_SIG109_IN_SEL_S 7 +/* GPIO_FUNC109_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC109_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC109_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC109_IN_INV_SEL_V 0x1 +#define GPIO_FUNC109_IN_INV_SEL_S 6 +/* GPIO_FUNC109_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC109_IN_SEL 0x0000003F +#define GPIO_FUNC109_IN_SEL_M ((GPIO_FUNC109_IN_SEL_V)<<(GPIO_FUNC109_IN_SEL_S)) +#define GPIO_FUNC109_IN_SEL_V 0x3F +#define GPIO_FUNC109_IN_SEL_S 0 + +#define GPIO_FUNC110_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x30C) +/* GPIO_SIG110_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG110_IN_SEL (BIT(7)) +#define GPIO_SIG110_IN_SEL_M (BIT(7)) +#define GPIO_SIG110_IN_SEL_V 0x1 +#define GPIO_SIG110_IN_SEL_S 7 +/* GPIO_FUNC110_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC110_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC110_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC110_IN_INV_SEL_V 0x1 +#define GPIO_FUNC110_IN_INV_SEL_S 6 +/* GPIO_FUNC110_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC110_IN_SEL 0x0000003F +#define GPIO_FUNC110_IN_SEL_M ((GPIO_FUNC110_IN_SEL_V)<<(GPIO_FUNC110_IN_SEL_S)) +#define GPIO_FUNC110_IN_SEL_V 0x3F +#define GPIO_FUNC110_IN_SEL_S 0 + +#define GPIO_FUNC111_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x310) +/* GPIO_SIG111_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG111_IN_SEL (BIT(7)) +#define GPIO_SIG111_IN_SEL_M (BIT(7)) +#define GPIO_SIG111_IN_SEL_V 0x1 +#define GPIO_SIG111_IN_SEL_S 7 +/* GPIO_FUNC111_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC111_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC111_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC111_IN_INV_SEL_V 0x1 +#define GPIO_FUNC111_IN_INV_SEL_S 6 +/* GPIO_FUNC111_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC111_IN_SEL 0x0000003F +#define GPIO_FUNC111_IN_SEL_M ((GPIO_FUNC111_IN_SEL_V)<<(GPIO_FUNC111_IN_SEL_S)) +#define GPIO_FUNC111_IN_SEL_V 0x3F +#define GPIO_FUNC111_IN_SEL_S 0 + +#define GPIO_FUNC112_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x314) +/* GPIO_SIG112_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG112_IN_SEL (BIT(7)) +#define GPIO_SIG112_IN_SEL_M (BIT(7)) +#define GPIO_SIG112_IN_SEL_V 0x1 +#define GPIO_SIG112_IN_SEL_S 7 +/* GPIO_FUNC112_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC112_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC112_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC112_IN_INV_SEL_V 0x1 +#define GPIO_FUNC112_IN_INV_SEL_S 6 +/* GPIO_FUNC112_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC112_IN_SEL 0x0000003F +#define GPIO_FUNC112_IN_SEL_M ((GPIO_FUNC112_IN_SEL_V)<<(GPIO_FUNC112_IN_SEL_S)) +#define GPIO_FUNC112_IN_SEL_V 0x3F +#define GPIO_FUNC112_IN_SEL_S 0 + +#define GPIO_FUNC113_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x318) +/* GPIO_SIG113_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG113_IN_SEL (BIT(7)) +#define GPIO_SIG113_IN_SEL_M (BIT(7)) +#define GPIO_SIG113_IN_SEL_V 0x1 +#define GPIO_SIG113_IN_SEL_S 7 +/* GPIO_FUNC113_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC113_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC113_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC113_IN_INV_SEL_V 0x1 +#define GPIO_FUNC113_IN_INV_SEL_S 6 +/* GPIO_FUNC113_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC113_IN_SEL 0x0000003F +#define GPIO_FUNC113_IN_SEL_M ((GPIO_FUNC113_IN_SEL_V)<<(GPIO_FUNC113_IN_SEL_S)) +#define GPIO_FUNC113_IN_SEL_V 0x3F +#define GPIO_FUNC113_IN_SEL_S 0 + +#define GPIO_FUNC114_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x31C) +/* GPIO_SIG114_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG114_IN_SEL (BIT(7)) +#define GPIO_SIG114_IN_SEL_M (BIT(7)) +#define GPIO_SIG114_IN_SEL_V 0x1 +#define GPIO_SIG114_IN_SEL_S 7 +/* GPIO_FUNC114_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC114_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC114_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC114_IN_INV_SEL_V 0x1 +#define GPIO_FUNC114_IN_INV_SEL_S 6 +/* GPIO_FUNC114_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC114_IN_SEL 0x0000003F +#define GPIO_FUNC114_IN_SEL_M ((GPIO_FUNC114_IN_SEL_V)<<(GPIO_FUNC114_IN_SEL_S)) +#define GPIO_FUNC114_IN_SEL_V 0x3F +#define GPIO_FUNC114_IN_SEL_S 0 + +#define GPIO_FUNC115_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x320) +/* GPIO_SIG115_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG115_IN_SEL (BIT(7)) +#define GPIO_SIG115_IN_SEL_M (BIT(7)) +#define GPIO_SIG115_IN_SEL_V 0x1 +#define GPIO_SIG115_IN_SEL_S 7 +/* GPIO_FUNC115_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC115_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC115_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC115_IN_INV_SEL_V 0x1 +#define GPIO_FUNC115_IN_INV_SEL_S 6 +/* GPIO_FUNC115_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC115_IN_SEL 0x0000003F +#define GPIO_FUNC115_IN_SEL_M ((GPIO_FUNC115_IN_SEL_V)<<(GPIO_FUNC115_IN_SEL_S)) +#define GPIO_FUNC115_IN_SEL_V 0x3F +#define GPIO_FUNC115_IN_SEL_S 0 + +#define GPIO_FUNC116_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x324) +/* GPIO_SIG116_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG116_IN_SEL (BIT(7)) +#define GPIO_SIG116_IN_SEL_M (BIT(7)) +#define GPIO_SIG116_IN_SEL_V 0x1 +#define GPIO_SIG116_IN_SEL_S 7 +/* GPIO_FUNC116_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC116_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC116_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC116_IN_INV_SEL_V 0x1 +#define GPIO_FUNC116_IN_INV_SEL_S 6 +/* GPIO_FUNC116_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC116_IN_SEL 0x0000003F +#define GPIO_FUNC116_IN_SEL_M ((GPIO_FUNC116_IN_SEL_V)<<(GPIO_FUNC116_IN_SEL_S)) +#define GPIO_FUNC116_IN_SEL_V 0x3F +#define GPIO_FUNC116_IN_SEL_S 0 + +#define GPIO_FUNC117_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x328) +/* GPIO_SIG117_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG117_IN_SEL (BIT(7)) +#define GPIO_SIG117_IN_SEL_M (BIT(7)) +#define GPIO_SIG117_IN_SEL_V 0x1 +#define GPIO_SIG117_IN_SEL_S 7 +/* GPIO_FUNC117_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC117_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC117_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC117_IN_INV_SEL_V 0x1 +#define GPIO_FUNC117_IN_INV_SEL_S 6 +/* GPIO_FUNC117_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC117_IN_SEL 0x0000003F +#define GPIO_FUNC117_IN_SEL_M ((GPIO_FUNC117_IN_SEL_V)<<(GPIO_FUNC117_IN_SEL_S)) +#define GPIO_FUNC117_IN_SEL_V 0x3F +#define GPIO_FUNC117_IN_SEL_S 0 + +#define GPIO_FUNC118_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x32C) +/* GPIO_SIG118_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG118_IN_SEL (BIT(7)) +#define GPIO_SIG118_IN_SEL_M (BIT(7)) +#define GPIO_SIG118_IN_SEL_V 0x1 +#define GPIO_SIG118_IN_SEL_S 7 +/* GPIO_FUNC118_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC118_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC118_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC118_IN_INV_SEL_V 0x1 +#define GPIO_FUNC118_IN_INV_SEL_S 6 +/* GPIO_FUNC118_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC118_IN_SEL 0x0000003F +#define GPIO_FUNC118_IN_SEL_M ((GPIO_FUNC118_IN_SEL_V)<<(GPIO_FUNC118_IN_SEL_S)) +#define GPIO_FUNC118_IN_SEL_V 0x3F +#define GPIO_FUNC118_IN_SEL_S 0 + +#define GPIO_FUNC119_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x330) +/* GPIO_SIG119_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG119_IN_SEL (BIT(7)) +#define GPIO_SIG119_IN_SEL_M (BIT(7)) +#define GPIO_SIG119_IN_SEL_V 0x1 +#define GPIO_SIG119_IN_SEL_S 7 +/* GPIO_FUNC119_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC119_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC119_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC119_IN_INV_SEL_V 0x1 +#define GPIO_FUNC119_IN_INV_SEL_S 6 +/* GPIO_FUNC119_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC119_IN_SEL 0x0000003F +#define GPIO_FUNC119_IN_SEL_M ((GPIO_FUNC119_IN_SEL_V)<<(GPIO_FUNC119_IN_SEL_S)) +#define GPIO_FUNC119_IN_SEL_V 0x3F +#define GPIO_FUNC119_IN_SEL_S 0 + +#define GPIO_FUNC120_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x334) +/* GPIO_SIG120_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG120_IN_SEL (BIT(7)) +#define GPIO_SIG120_IN_SEL_M (BIT(7)) +#define GPIO_SIG120_IN_SEL_V 0x1 +#define GPIO_SIG120_IN_SEL_S 7 +/* GPIO_FUNC120_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC120_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC120_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC120_IN_INV_SEL_V 0x1 +#define GPIO_FUNC120_IN_INV_SEL_S 6 +/* GPIO_FUNC120_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC120_IN_SEL 0x0000003F +#define GPIO_FUNC120_IN_SEL_M ((GPIO_FUNC120_IN_SEL_V)<<(GPIO_FUNC120_IN_SEL_S)) +#define GPIO_FUNC120_IN_SEL_V 0x3F +#define GPIO_FUNC120_IN_SEL_S 0 + +#define GPIO_FUNC121_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x338) +/* GPIO_SIG121_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG121_IN_SEL (BIT(7)) +#define GPIO_SIG121_IN_SEL_M (BIT(7)) +#define GPIO_SIG121_IN_SEL_V 0x1 +#define GPIO_SIG121_IN_SEL_S 7 +/* GPIO_FUNC121_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC121_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC121_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC121_IN_INV_SEL_V 0x1 +#define GPIO_FUNC121_IN_INV_SEL_S 6 +/* GPIO_FUNC121_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC121_IN_SEL 0x0000003F +#define GPIO_FUNC121_IN_SEL_M ((GPIO_FUNC121_IN_SEL_V)<<(GPIO_FUNC121_IN_SEL_S)) +#define GPIO_FUNC121_IN_SEL_V 0x3F +#define GPIO_FUNC121_IN_SEL_S 0 + +#define GPIO_FUNC122_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x33C) +/* GPIO_SIG122_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG122_IN_SEL (BIT(7)) +#define GPIO_SIG122_IN_SEL_M (BIT(7)) +#define GPIO_SIG122_IN_SEL_V 0x1 +#define GPIO_SIG122_IN_SEL_S 7 +/* GPIO_FUNC122_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC122_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC122_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC122_IN_INV_SEL_V 0x1 +#define GPIO_FUNC122_IN_INV_SEL_S 6 +/* GPIO_FUNC122_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC122_IN_SEL 0x0000003F +#define GPIO_FUNC122_IN_SEL_M ((GPIO_FUNC122_IN_SEL_V)<<(GPIO_FUNC122_IN_SEL_S)) +#define GPIO_FUNC122_IN_SEL_V 0x3F +#define GPIO_FUNC122_IN_SEL_S 0 + +#define GPIO_FUNC123_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x340) +/* GPIO_SIG123_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG123_IN_SEL (BIT(7)) +#define GPIO_SIG123_IN_SEL_M (BIT(7)) +#define GPIO_SIG123_IN_SEL_V 0x1 +#define GPIO_SIG123_IN_SEL_S 7 +/* GPIO_FUNC123_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC123_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC123_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC123_IN_INV_SEL_V 0x1 +#define GPIO_FUNC123_IN_INV_SEL_S 6 +/* GPIO_FUNC123_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC123_IN_SEL 0x0000003F +#define GPIO_FUNC123_IN_SEL_M ((GPIO_FUNC123_IN_SEL_V)<<(GPIO_FUNC123_IN_SEL_S)) +#define GPIO_FUNC123_IN_SEL_V 0x3F +#define GPIO_FUNC123_IN_SEL_S 0 + +#define GPIO_FUNC124_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x344) +/* GPIO_SIG124_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG124_IN_SEL (BIT(7)) +#define GPIO_SIG124_IN_SEL_M (BIT(7)) +#define GPIO_SIG124_IN_SEL_V 0x1 +#define GPIO_SIG124_IN_SEL_S 7 +/* GPIO_FUNC124_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC124_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC124_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC124_IN_INV_SEL_V 0x1 +#define GPIO_FUNC124_IN_INV_SEL_S 6 +/* GPIO_FUNC124_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC124_IN_SEL 0x0000003F +#define GPIO_FUNC124_IN_SEL_M ((GPIO_FUNC124_IN_SEL_V)<<(GPIO_FUNC124_IN_SEL_S)) +#define GPIO_FUNC124_IN_SEL_V 0x3F +#define GPIO_FUNC124_IN_SEL_S 0 + +#define GPIO_FUNC125_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x348) +/* GPIO_SIG125_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG125_IN_SEL (BIT(7)) +#define GPIO_SIG125_IN_SEL_M (BIT(7)) +#define GPIO_SIG125_IN_SEL_V 0x1 +#define GPIO_SIG125_IN_SEL_S 7 +/* GPIO_FUNC125_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC125_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC125_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC125_IN_INV_SEL_V 0x1 +#define GPIO_FUNC125_IN_INV_SEL_S 6 +/* GPIO_FUNC125_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC125_IN_SEL 0x0000003F +#define GPIO_FUNC125_IN_SEL_M ((GPIO_FUNC125_IN_SEL_V)<<(GPIO_FUNC125_IN_SEL_S)) +#define GPIO_FUNC125_IN_SEL_V 0x3F +#define GPIO_FUNC125_IN_SEL_S 0 + +#define GPIO_FUNC126_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x34C) +/* GPIO_SIG126_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG126_IN_SEL (BIT(7)) +#define GPIO_SIG126_IN_SEL_M (BIT(7)) +#define GPIO_SIG126_IN_SEL_V 0x1 +#define GPIO_SIG126_IN_SEL_S 7 +/* GPIO_FUNC126_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC126_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC126_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC126_IN_INV_SEL_V 0x1 +#define GPIO_FUNC126_IN_INV_SEL_S 6 +/* GPIO_FUNC126_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC126_IN_SEL 0x0000003F +#define GPIO_FUNC126_IN_SEL_M ((GPIO_FUNC126_IN_SEL_V)<<(GPIO_FUNC126_IN_SEL_S)) +#define GPIO_FUNC126_IN_SEL_V 0x3F +#define GPIO_FUNC126_IN_SEL_S 0 + +#define GPIO_FUNC127_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x350) +/* GPIO_SIG127_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG127_IN_SEL (BIT(7)) +#define GPIO_SIG127_IN_SEL_M (BIT(7)) +#define GPIO_SIG127_IN_SEL_V 0x1 +#define GPIO_SIG127_IN_SEL_S 7 +/* GPIO_FUNC127_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC127_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC127_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC127_IN_INV_SEL_V 0x1 +#define GPIO_FUNC127_IN_INV_SEL_S 6 +/* GPIO_FUNC127_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC127_IN_SEL 0x0000003F +#define GPIO_FUNC127_IN_SEL_M ((GPIO_FUNC127_IN_SEL_V)<<(GPIO_FUNC127_IN_SEL_S)) +#define GPIO_FUNC127_IN_SEL_V 0x3F +#define GPIO_FUNC127_IN_SEL_S 0 + +#define GPIO_FUNC128_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x354) +/* GPIO_SIG128_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG128_IN_SEL (BIT(7)) +#define GPIO_SIG128_IN_SEL_M (BIT(7)) +#define GPIO_SIG128_IN_SEL_V 0x1 +#define GPIO_SIG128_IN_SEL_S 7 +/* GPIO_FUNC128_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC128_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC128_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC128_IN_INV_SEL_V 0x1 +#define GPIO_FUNC128_IN_INV_SEL_S 6 +/* GPIO_FUNC128_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC128_IN_SEL 0x0000003F +#define GPIO_FUNC128_IN_SEL_M ((GPIO_FUNC128_IN_SEL_V)<<(GPIO_FUNC128_IN_SEL_S)) +#define GPIO_FUNC128_IN_SEL_V 0x3F +#define GPIO_FUNC128_IN_SEL_S 0 + +#define GPIO_FUNC129_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x358) +/* GPIO_SIG129_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG129_IN_SEL (BIT(7)) +#define GPIO_SIG129_IN_SEL_M (BIT(7)) +#define GPIO_SIG129_IN_SEL_V 0x1 +#define GPIO_SIG129_IN_SEL_S 7 +/* GPIO_FUNC129_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC129_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC129_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC129_IN_INV_SEL_V 0x1 +#define GPIO_FUNC129_IN_INV_SEL_S 6 +/* GPIO_FUNC129_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC129_IN_SEL 0x0000003F +#define GPIO_FUNC129_IN_SEL_M ((GPIO_FUNC129_IN_SEL_V)<<(GPIO_FUNC129_IN_SEL_S)) +#define GPIO_FUNC129_IN_SEL_V 0x3F +#define GPIO_FUNC129_IN_SEL_S 0 + +#define GPIO_FUNC130_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x35C) +/* GPIO_SIG130_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG130_IN_SEL (BIT(7)) +#define GPIO_SIG130_IN_SEL_M (BIT(7)) +#define GPIO_SIG130_IN_SEL_V 0x1 +#define GPIO_SIG130_IN_SEL_S 7 +/* GPIO_FUNC130_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC130_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC130_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC130_IN_INV_SEL_V 0x1 +#define GPIO_FUNC130_IN_INV_SEL_S 6 +/* GPIO_FUNC130_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC130_IN_SEL 0x0000003F +#define GPIO_FUNC130_IN_SEL_M ((GPIO_FUNC130_IN_SEL_V)<<(GPIO_FUNC130_IN_SEL_S)) +#define GPIO_FUNC130_IN_SEL_V 0x3F +#define GPIO_FUNC130_IN_SEL_S 0 + +#define GPIO_FUNC131_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x360) +/* GPIO_SIG131_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG131_IN_SEL (BIT(7)) +#define GPIO_SIG131_IN_SEL_M (BIT(7)) +#define GPIO_SIG131_IN_SEL_V 0x1 +#define GPIO_SIG131_IN_SEL_S 7 +/* GPIO_FUNC131_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC131_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC131_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC131_IN_INV_SEL_V 0x1 +#define GPIO_FUNC131_IN_INV_SEL_S 6 +/* GPIO_FUNC131_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC131_IN_SEL 0x0000003F +#define GPIO_FUNC131_IN_SEL_M ((GPIO_FUNC131_IN_SEL_V)<<(GPIO_FUNC131_IN_SEL_S)) +#define GPIO_FUNC131_IN_SEL_V 0x3F +#define GPIO_FUNC131_IN_SEL_S 0 + +#define GPIO_FUNC132_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x364) +/* GPIO_SIG132_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG132_IN_SEL (BIT(7)) +#define GPIO_SIG132_IN_SEL_M (BIT(7)) +#define GPIO_SIG132_IN_SEL_V 0x1 +#define GPIO_SIG132_IN_SEL_S 7 +/* GPIO_FUNC132_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC132_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC132_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC132_IN_INV_SEL_V 0x1 +#define GPIO_FUNC132_IN_INV_SEL_S 6 +/* GPIO_FUNC132_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC132_IN_SEL 0x0000003F +#define GPIO_FUNC132_IN_SEL_M ((GPIO_FUNC132_IN_SEL_V)<<(GPIO_FUNC132_IN_SEL_S)) +#define GPIO_FUNC132_IN_SEL_V 0x3F +#define GPIO_FUNC132_IN_SEL_S 0 + +#define GPIO_FUNC133_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x368) +/* GPIO_SIG133_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG133_IN_SEL (BIT(7)) +#define GPIO_SIG133_IN_SEL_M (BIT(7)) +#define GPIO_SIG133_IN_SEL_V 0x1 +#define GPIO_SIG133_IN_SEL_S 7 +/* GPIO_FUNC133_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC133_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC133_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC133_IN_INV_SEL_V 0x1 +#define GPIO_FUNC133_IN_INV_SEL_S 6 +/* GPIO_FUNC133_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC133_IN_SEL 0x0000003F +#define GPIO_FUNC133_IN_SEL_M ((GPIO_FUNC133_IN_SEL_V)<<(GPIO_FUNC133_IN_SEL_S)) +#define GPIO_FUNC133_IN_SEL_V 0x3F +#define GPIO_FUNC133_IN_SEL_S 0 + +#define GPIO_FUNC134_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x36C) +/* GPIO_SIG134_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG134_IN_SEL (BIT(7)) +#define GPIO_SIG134_IN_SEL_M (BIT(7)) +#define GPIO_SIG134_IN_SEL_V 0x1 +#define GPIO_SIG134_IN_SEL_S 7 +/* GPIO_FUNC134_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC134_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC134_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC134_IN_INV_SEL_V 0x1 +#define GPIO_FUNC134_IN_INV_SEL_S 6 +/* GPIO_FUNC134_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC134_IN_SEL 0x0000003F +#define GPIO_FUNC134_IN_SEL_M ((GPIO_FUNC134_IN_SEL_V)<<(GPIO_FUNC134_IN_SEL_S)) +#define GPIO_FUNC134_IN_SEL_V 0x3F +#define GPIO_FUNC134_IN_SEL_S 0 + +#define GPIO_FUNC135_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x370) +/* GPIO_SIG135_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG135_IN_SEL (BIT(7)) +#define GPIO_SIG135_IN_SEL_M (BIT(7)) +#define GPIO_SIG135_IN_SEL_V 0x1 +#define GPIO_SIG135_IN_SEL_S 7 +/* GPIO_FUNC135_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC135_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC135_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC135_IN_INV_SEL_V 0x1 +#define GPIO_FUNC135_IN_INV_SEL_S 6 +/* GPIO_FUNC135_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC135_IN_SEL 0x0000003F +#define GPIO_FUNC135_IN_SEL_M ((GPIO_FUNC135_IN_SEL_V)<<(GPIO_FUNC135_IN_SEL_S)) +#define GPIO_FUNC135_IN_SEL_V 0x3F +#define GPIO_FUNC135_IN_SEL_S 0 + +#define GPIO_FUNC136_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x374) +/* GPIO_SIG136_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG136_IN_SEL (BIT(7)) +#define GPIO_SIG136_IN_SEL_M (BIT(7)) +#define GPIO_SIG136_IN_SEL_V 0x1 +#define GPIO_SIG136_IN_SEL_S 7 +/* GPIO_FUNC136_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC136_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC136_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC136_IN_INV_SEL_V 0x1 +#define GPIO_FUNC136_IN_INV_SEL_S 6 +/* GPIO_FUNC136_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC136_IN_SEL 0x0000003F +#define GPIO_FUNC136_IN_SEL_M ((GPIO_FUNC136_IN_SEL_V)<<(GPIO_FUNC136_IN_SEL_S)) +#define GPIO_FUNC136_IN_SEL_V 0x3F +#define GPIO_FUNC136_IN_SEL_S 0 + +#define GPIO_FUNC137_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x378) +/* GPIO_SIG137_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG137_IN_SEL (BIT(7)) +#define GPIO_SIG137_IN_SEL_M (BIT(7)) +#define GPIO_SIG137_IN_SEL_V 0x1 +#define GPIO_SIG137_IN_SEL_S 7 +/* GPIO_FUNC137_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC137_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC137_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC137_IN_INV_SEL_V 0x1 +#define GPIO_FUNC137_IN_INV_SEL_S 6 +/* GPIO_FUNC137_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC137_IN_SEL 0x0000003F +#define GPIO_FUNC137_IN_SEL_M ((GPIO_FUNC137_IN_SEL_V)<<(GPIO_FUNC137_IN_SEL_S)) +#define GPIO_FUNC137_IN_SEL_V 0x3F +#define GPIO_FUNC137_IN_SEL_S 0 + +#define GPIO_FUNC138_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x37C) +/* GPIO_SIG138_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG138_IN_SEL (BIT(7)) +#define GPIO_SIG138_IN_SEL_M (BIT(7)) +#define GPIO_SIG138_IN_SEL_V 0x1 +#define GPIO_SIG138_IN_SEL_S 7 +/* GPIO_FUNC138_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC138_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC138_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC138_IN_INV_SEL_V 0x1 +#define GPIO_FUNC138_IN_INV_SEL_S 6 +/* GPIO_FUNC138_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC138_IN_SEL 0x0000003F +#define GPIO_FUNC138_IN_SEL_M ((GPIO_FUNC138_IN_SEL_V)<<(GPIO_FUNC138_IN_SEL_S)) +#define GPIO_FUNC138_IN_SEL_V 0x3F +#define GPIO_FUNC138_IN_SEL_S 0 + +#define GPIO_FUNC139_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x380) +/* GPIO_SIG139_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG139_IN_SEL (BIT(7)) +#define GPIO_SIG139_IN_SEL_M (BIT(7)) +#define GPIO_SIG139_IN_SEL_V 0x1 +#define GPIO_SIG139_IN_SEL_S 7 +/* GPIO_FUNC139_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC139_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC139_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC139_IN_INV_SEL_V 0x1 +#define GPIO_FUNC139_IN_INV_SEL_S 6 +/* GPIO_FUNC139_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC139_IN_SEL 0x0000003F +#define GPIO_FUNC139_IN_SEL_M ((GPIO_FUNC139_IN_SEL_V)<<(GPIO_FUNC139_IN_SEL_S)) +#define GPIO_FUNC139_IN_SEL_V 0x3F +#define GPIO_FUNC139_IN_SEL_S 0 + +#define GPIO_FUNC140_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x384) +/* GPIO_SIG140_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG140_IN_SEL (BIT(7)) +#define GPIO_SIG140_IN_SEL_M (BIT(7)) +#define GPIO_SIG140_IN_SEL_V 0x1 +#define GPIO_SIG140_IN_SEL_S 7 +/* GPIO_FUNC140_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC140_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC140_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC140_IN_INV_SEL_V 0x1 +#define GPIO_FUNC140_IN_INV_SEL_S 6 +/* GPIO_FUNC140_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC140_IN_SEL 0x0000003F +#define GPIO_FUNC140_IN_SEL_M ((GPIO_FUNC140_IN_SEL_V)<<(GPIO_FUNC140_IN_SEL_S)) +#define GPIO_FUNC140_IN_SEL_V 0x3F +#define GPIO_FUNC140_IN_SEL_S 0 + +#define GPIO_FUNC141_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x388) +/* GPIO_SIG141_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG141_IN_SEL (BIT(7)) +#define GPIO_SIG141_IN_SEL_M (BIT(7)) +#define GPIO_SIG141_IN_SEL_V 0x1 +#define GPIO_SIG141_IN_SEL_S 7 +/* GPIO_FUNC141_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC141_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC141_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC141_IN_INV_SEL_V 0x1 +#define GPIO_FUNC141_IN_INV_SEL_S 6 +/* GPIO_FUNC141_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC141_IN_SEL 0x0000003F +#define GPIO_FUNC141_IN_SEL_M ((GPIO_FUNC141_IN_SEL_V)<<(GPIO_FUNC141_IN_SEL_S)) +#define GPIO_FUNC141_IN_SEL_V 0x3F +#define GPIO_FUNC141_IN_SEL_S 0 + +#define GPIO_FUNC142_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x38C) +/* GPIO_SIG142_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG142_IN_SEL (BIT(7)) +#define GPIO_SIG142_IN_SEL_M (BIT(7)) +#define GPIO_SIG142_IN_SEL_V 0x1 +#define GPIO_SIG142_IN_SEL_S 7 +/* GPIO_FUNC142_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC142_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC142_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC142_IN_INV_SEL_V 0x1 +#define GPIO_FUNC142_IN_INV_SEL_S 6 +/* GPIO_FUNC142_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC142_IN_SEL 0x0000003F +#define GPIO_FUNC142_IN_SEL_M ((GPIO_FUNC142_IN_SEL_V)<<(GPIO_FUNC142_IN_SEL_S)) +#define GPIO_FUNC142_IN_SEL_V 0x3F +#define GPIO_FUNC142_IN_SEL_S 0 + +#define GPIO_FUNC143_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x390) +/* GPIO_SIG143_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG143_IN_SEL (BIT(7)) +#define GPIO_SIG143_IN_SEL_M (BIT(7)) +#define GPIO_SIG143_IN_SEL_V 0x1 +#define GPIO_SIG143_IN_SEL_S 7 +/* GPIO_FUNC143_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC143_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC143_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC143_IN_INV_SEL_V 0x1 +#define GPIO_FUNC143_IN_INV_SEL_S 6 +/* GPIO_FUNC143_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC143_IN_SEL 0x0000003F +#define GPIO_FUNC143_IN_SEL_M ((GPIO_FUNC143_IN_SEL_V)<<(GPIO_FUNC143_IN_SEL_S)) +#define GPIO_FUNC143_IN_SEL_V 0x3F +#define GPIO_FUNC143_IN_SEL_S 0 + +#define GPIO_FUNC144_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x394) +/* GPIO_SIG144_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG144_IN_SEL (BIT(7)) +#define GPIO_SIG144_IN_SEL_M (BIT(7)) +#define GPIO_SIG144_IN_SEL_V 0x1 +#define GPIO_SIG144_IN_SEL_S 7 +/* GPIO_FUNC144_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC144_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC144_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC144_IN_INV_SEL_V 0x1 +#define GPIO_FUNC144_IN_INV_SEL_S 6 +/* GPIO_FUNC144_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC144_IN_SEL 0x0000003F +#define GPIO_FUNC144_IN_SEL_M ((GPIO_FUNC144_IN_SEL_V)<<(GPIO_FUNC144_IN_SEL_S)) +#define GPIO_FUNC144_IN_SEL_V 0x3F +#define GPIO_FUNC144_IN_SEL_S 0 + +#define GPIO_FUNC145_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x398) +/* GPIO_SIG145_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG145_IN_SEL (BIT(7)) +#define GPIO_SIG145_IN_SEL_M (BIT(7)) +#define GPIO_SIG145_IN_SEL_V 0x1 +#define GPIO_SIG145_IN_SEL_S 7 +/* GPIO_FUNC145_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC145_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC145_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC145_IN_INV_SEL_V 0x1 +#define GPIO_FUNC145_IN_INV_SEL_S 6 +/* GPIO_FUNC145_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC145_IN_SEL 0x0000003F +#define GPIO_FUNC145_IN_SEL_M ((GPIO_FUNC145_IN_SEL_V)<<(GPIO_FUNC145_IN_SEL_S)) +#define GPIO_FUNC145_IN_SEL_V 0x3F +#define GPIO_FUNC145_IN_SEL_S 0 + +#define GPIO_FUNC146_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x39C) +/* GPIO_SIG146_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG146_IN_SEL (BIT(7)) +#define GPIO_SIG146_IN_SEL_M (BIT(7)) +#define GPIO_SIG146_IN_SEL_V 0x1 +#define GPIO_SIG146_IN_SEL_S 7 +/* GPIO_FUNC146_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC146_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC146_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC146_IN_INV_SEL_V 0x1 +#define GPIO_FUNC146_IN_INV_SEL_S 6 +/* GPIO_FUNC146_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC146_IN_SEL 0x0000003F +#define GPIO_FUNC146_IN_SEL_M ((GPIO_FUNC146_IN_SEL_V)<<(GPIO_FUNC146_IN_SEL_S)) +#define GPIO_FUNC146_IN_SEL_V 0x3F +#define GPIO_FUNC146_IN_SEL_S 0 + +#define GPIO_FUNC147_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3A0) +/* GPIO_SIG147_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG147_IN_SEL (BIT(7)) +#define GPIO_SIG147_IN_SEL_M (BIT(7)) +#define GPIO_SIG147_IN_SEL_V 0x1 +#define GPIO_SIG147_IN_SEL_S 7 +/* GPIO_FUNC147_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC147_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC147_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC147_IN_INV_SEL_V 0x1 +#define GPIO_FUNC147_IN_INV_SEL_S 6 +/* GPIO_FUNC147_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC147_IN_SEL 0x0000003F +#define GPIO_FUNC147_IN_SEL_M ((GPIO_FUNC147_IN_SEL_V)<<(GPIO_FUNC147_IN_SEL_S)) +#define GPIO_FUNC147_IN_SEL_V 0x3F +#define GPIO_FUNC147_IN_SEL_S 0 + +#define GPIO_FUNC148_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3A4) +/* GPIO_SIG148_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG148_IN_SEL (BIT(7)) +#define GPIO_SIG148_IN_SEL_M (BIT(7)) +#define GPIO_SIG148_IN_SEL_V 0x1 +#define GPIO_SIG148_IN_SEL_S 7 +/* GPIO_FUNC148_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC148_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC148_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC148_IN_INV_SEL_V 0x1 +#define GPIO_FUNC148_IN_INV_SEL_S 6 +/* GPIO_FUNC148_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC148_IN_SEL 0x0000003F +#define GPIO_FUNC148_IN_SEL_M ((GPIO_FUNC148_IN_SEL_V)<<(GPIO_FUNC148_IN_SEL_S)) +#define GPIO_FUNC148_IN_SEL_V 0x3F +#define GPIO_FUNC148_IN_SEL_S 0 + +#define GPIO_FUNC149_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3A8) +/* GPIO_SIG149_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG149_IN_SEL (BIT(7)) +#define GPIO_SIG149_IN_SEL_M (BIT(7)) +#define GPIO_SIG149_IN_SEL_V 0x1 +#define GPIO_SIG149_IN_SEL_S 7 +/* GPIO_FUNC149_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC149_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC149_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC149_IN_INV_SEL_V 0x1 +#define GPIO_FUNC149_IN_INV_SEL_S 6 +/* GPIO_FUNC149_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC149_IN_SEL 0x0000003F +#define GPIO_FUNC149_IN_SEL_M ((GPIO_FUNC149_IN_SEL_V)<<(GPIO_FUNC149_IN_SEL_S)) +#define GPIO_FUNC149_IN_SEL_V 0x3F +#define GPIO_FUNC149_IN_SEL_S 0 + +#define GPIO_FUNC150_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3AC) +/* GPIO_SIG150_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG150_IN_SEL (BIT(7)) +#define GPIO_SIG150_IN_SEL_M (BIT(7)) +#define GPIO_SIG150_IN_SEL_V 0x1 +#define GPIO_SIG150_IN_SEL_S 7 +/* GPIO_FUNC150_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC150_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC150_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC150_IN_INV_SEL_V 0x1 +#define GPIO_FUNC150_IN_INV_SEL_S 6 +/* GPIO_FUNC150_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC150_IN_SEL 0x0000003F +#define GPIO_FUNC150_IN_SEL_M ((GPIO_FUNC150_IN_SEL_V)<<(GPIO_FUNC150_IN_SEL_S)) +#define GPIO_FUNC150_IN_SEL_V 0x3F +#define GPIO_FUNC150_IN_SEL_S 0 + +#define GPIO_FUNC151_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3B0) +/* GPIO_SIG151_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG151_IN_SEL (BIT(7)) +#define GPIO_SIG151_IN_SEL_M (BIT(7)) +#define GPIO_SIG151_IN_SEL_V 0x1 +#define GPIO_SIG151_IN_SEL_S 7 +/* GPIO_FUNC151_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC151_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC151_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC151_IN_INV_SEL_V 0x1 +#define GPIO_FUNC151_IN_INV_SEL_S 6 +/* GPIO_FUNC151_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC151_IN_SEL 0x0000003F +#define GPIO_FUNC151_IN_SEL_M ((GPIO_FUNC151_IN_SEL_V)<<(GPIO_FUNC151_IN_SEL_S)) +#define GPIO_FUNC151_IN_SEL_V 0x3F +#define GPIO_FUNC151_IN_SEL_S 0 + +#define GPIO_FUNC152_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3B4) +/* GPIO_SIG152_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG152_IN_SEL (BIT(7)) +#define GPIO_SIG152_IN_SEL_M (BIT(7)) +#define GPIO_SIG152_IN_SEL_V 0x1 +#define GPIO_SIG152_IN_SEL_S 7 +/* GPIO_FUNC152_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC152_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC152_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC152_IN_INV_SEL_V 0x1 +#define GPIO_FUNC152_IN_INV_SEL_S 6 +/* GPIO_FUNC152_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC152_IN_SEL 0x0000003F +#define GPIO_FUNC152_IN_SEL_M ((GPIO_FUNC152_IN_SEL_V)<<(GPIO_FUNC152_IN_SEL_S)) +#define GPIO_FUNC152_IN_SEL_V 0x3F +#define GPIO_FUNC152_IN_SEL_S 0 + +#define GPIO_FUNC153_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3B8) +/* GPIO_SIG153_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG153_IN_SEL (BIT(7)) +#define GPIO_SIG153_IN_SEL_M (BIT(7)) +#define GPIO_SIG153_IN_SEL_V 0x1 +#define GPIO_SIG153_IN_SEL_S 7 +/* GPIO_FUNC153_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC153_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC153_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC153_IN_INV_SEL_V 0x1 +#define GPIO_FUNC153_IN_INV_SEL_S 6 +/* GPIO_FUNC153_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC153_IN_SEL 0x0000003F +#define GPIO_FUNC153_IN_SEL_M ((GPIO_FUNC153_IN_SEL_V)<<(GPIO_FUNC153_IN_SEL_S)) +#define GPIO_FUNC153_IN_SEL_V 0x3F +#define GPIO_FUNC153_IN_SEL_S 0 + +#define GPIO_FUNC154_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3BC) +/* GPIO_SIG154_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG154_IN_SEL (BIT(7)) +#define GPIO_SIG154_IN_SEL_M (BIT(7)) +#define GPIO_SIG154_IN_SEL_V 0x1 +#define GPIO_SIG154_IN_SEL_S 7 +/* GPIO_FUNC154_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC154_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC154_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC154_IN_INV_SEL_V 0x1 +#define GPIO_FUNC154_IN_INV_SEL_S 6 +/* GPIO_FUNC154_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC154_IN_SEL 0x0000003F +#define GPIO_FUNC154_IN_SEL_M ((GPIO_FUNC154_IN_SEL_V)<<(GPIO_FUNC154_IN_SEL_S)) +#define GPIO_FUNC154_IN_SEL_V 0x3F +#define GPIO_FUNC154_IN_SEL_S 0 + +#define GPIO_FUNC155_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3C0) +/* GPIO_SIG155_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG155_IN_SEL (BIT(7)) +#define GPIO_SIG155_IN_SEL_M (BIT(7)) +#define GPIO_SIG155_IN_SEL_V 0x1 +#define GPIO_SIG155_IN_SEL_S 7 +/* GPIO_FUNC155_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC155_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC155_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC155_IN_INV_SEL_V 0x1 +#define GPIO_FUNC155_IN_INV_SEL_S 6 +/* GPIO_FUNC155_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC155_IN_SEL 0x0000003F +#define GPIO_FUNC155_IN_SEL_M ((GPIO_FUNC155_IN_SEL_V)<<(GPIO_FUNC155_IN_SEL_S)) +#define GPIO_FUNC155_IN_SEL_V 0x3F +#define GPIO_FUNC155_IN_SEL_S 0 + +#define GPIO_FUNC156_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3C4) +/* GPIO_SIG156_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG156_IN_SEL (BIT(7)) +#define GPIO_SIG156_IN_SEL_M (BIT(7)) +#define GPIO_SIG156_IN_SEL_V 0x1 +#define GPIO_SIG156_IN_SEL_S 7 +/* GPIO_FUNC156_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC156_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC156_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC156_IN_INV_SEL_V 0x1 +#define GPIO_FUNC156_IN_INV_SEL_S 6 +/* GPIO_FUNC156_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC156_IN_SEL 0x0000003F +#define GPIO_FUNC156_IN_SEL_M ((GPIO_FUNC156_IN_SEL_V)<<(GPIO_FUNC156_IN_SEL_S)) +#define GPIO_FUNC156_IN_SEL_V 0x3F +#define GPIO_FUNC156_IN_SEL_S 0 + +#define GPIO_FUNC157_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3C8) +/* GPIO_SIG157_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG157_IN_SEL (BIT(7)) +#define GPIO_SIG157_IN_SEL_M (BIT(7)) +#define GPIO_SIG157_IN_SEL_V 0x1 +#define GPIO_SIG157_IN_SEL_S 7 +/* GPIO_FUNC157_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC157_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC157_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC157_IN_INV_SEL_V 0x1 +#define GPIO_FUNC157_IN_INV_SEL_S 6 +/* GPIO_FUNC157_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC157_IN_SEL 0x0000003F +#define GPIO_FUNC157_IN_SEL_M ((GPIO_FUNC157_IN_SEL_V)<<(GPIO_FUNC157_IN_SEL_S)) +#define GPIO_FUNC157_IN_SEL_V 0x3F +#define GPIO_FUNC157_IN_SEL_S 0 + +#define GPIO_FUNC158_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3CC) +/* GPIO_SIG158_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG158_IN_SEL (BIT(7)) +#define GPIO_SIG158_IN_SEL_M (BIT(7)) +#define GPIO_SIG158_IN_SEL_V 0x1 +#define GPIO_SIG158_IN_SEL_S 7 +/* GPIO_FUNC158_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC158_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC158_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC158_IN_INV_SEL_V 0x1 +#define GPIO_FUNC158_IN_INV_SEL_S 6 +/* GPIO_FUNC158_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC158_IN_SEL 0x0000003F +#define GPIO_FUNC158_IN_SEL_M ((GPIO_FUNC158_IN_SEL_V)<<(GPIO_FUNC158_IN_SEL_S)) +#define GPIO_FUNC158_IN_SEL_V 0x3F +#define GPIO_FUNC158_IN_SEL_S 0 + +#define GPIO_FUNC159_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3D0) +/* GPIO_SIG159_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG159_IN_SEL (BIT(7)) +#define GPIO_SIG159_IN_SEL_M (BIT(7)) +#define GPIO_SIG159_IN_SEL_V 0x1 +#define GPIO_SIG159_IN_SEL_S 7 +/* GPIO_FUNC159_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC159_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC159_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC159_IN_INV_SEL_V 0x1 +#define GPIO_FUNC159_IN_INV_SEL_S 6 +/* GPIO_FUNC159_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC159_IN_SEL 0x0000003F +#define GPIO_FUNC159_IN_SEL_M ((GPIO_FUNC159_IN_SEL_V)<<(GPIO_FUNC159_IN_SEL_S)) +#define GPIO_FUNC159_IN_SEL_V 0x3F +#define GPIO_FUNC159_IN_SEL_S 0 + +#define GPIO_FUNC160_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3D4) +/* GPIO_SIG160_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG160_IN_SEL (BIT(7)) +#define GPIO_SIG160_IN_SEL_M (BIT(7)) +#define GPIO_SIG160_IN_SEL_V 0x1 +#define GPIO_SIG160_IN_SEL_S 7 +/* GPIO_FUNC160_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC160_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC160_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC160_IN_INV_SEL_V 0x1 +#define GPIO_FUNC160_IN_INV_SEL_S 6 +/* GPIO_FUNC160_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC160_IN_SEL 0x0000003F +#define GPIO_FUNC160_IN_SEL_M ((GPIO_FUNC160_IN_SEL_V)<<(GPIO_FUNC160_IN_SEL_S)) +#define GPIO_FUNC160_IN_SEL_V 0x3F +#define GPIO_FUNC160_IN_SEL_S 0 + +#define GPIO_FUNC161_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3D8) +/* GPIO_SIG161_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG161_IN_SEL (BIT(7)) +#define GPIO_SIG161_IN_SEL_M (BIT(7)) +#define GPIO_SIG161_IN_SEL_V 0x1 +#define GPIO_SIG161_IN_SEL_S 7 +/* GPIO_FUNC161_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC161_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC161_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC161_IN_INV_SEL_V 0x1 +#define GPIO_FUNC161_IN_INV_SEL_S 6 +/* GPIO_FUNC161_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC161_IN_SEL 0x0000003F +#define GPIO_FUNC161_IN_SEL_M ((GPIO_FUNC161_IN_SEL_V)<<(GPIO_FUNC161_IN_SEL_S)) +#define GPIO_FUNC161_IN_SEL_V 0x3F +#define GPIO_FUNC161_IN_SEL_S 0 + +#define GPIO_FUNC162_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3DC) +/* GPIO_SIG162_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG162_IN_SEL (BIT(7)) +#define GPIO_SIG162_IN_SEL_M (BIT(7)) +#define GPIO_SIG162_IN_SEL_V 0x1 +#define GPIO_SIG162_IN_SEL_S 7 +/* GPIO_FUNC162_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC162_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC162_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC162_IN_INV_SEL_V 0x1 +#define GPIO_FUNC162_IN_INV_SEL_S 6 +/* GPIO_FUNC162_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC162_IN_SEL 0x0000003F +#define GPIO_FUNC162_IN_SEL_M ((GPIO_FUNC162_IN_SEL_V)<<(GPIO_FUNC162_IN_SEL_S)) +#define GPIO_FUNC162_IN_SEL_V 0x3F +#define GPIO_FUNC162_IN_SEL_S 0 + +#define GPIO_FUNC163_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3E0) +/* GPIO_SIG163_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG163_IN_SEL (BIT(7)) +#define GPIO_SIG163_IN_SEL_M (BIT(7)) +#define GPIO_SIG163_IN_SEL_V 0x1 +#define GPIO_SIG163_IN_SEL_S 7 +/* GPIO_FUNC163_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC163_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC163_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC163_IN_INV_SEL_V 0x1 +#define GPIO_FUNC163_IN_INV_SEL_S 6 +/* GPIO_FUNC163_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC163_IN_SEL 0x0000003F +#define GPIO_FUNC163_IN_SEL_M ((GPIO_FUNC163_IN_SEL_V)<<(GPIO_FUNC163_IN_SEL_S)) +#define GPIO_FUNC163_IN_SEL_V 0x3F +#define GPIO_FUNC163_IN_SEL_S 0 + +#define GPIO_FUNC164_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3E4) +/* GPIO_SIG164_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG164_IN_SEL (BIT(7)) +#define GPIO_SIG164_IN_SEL_M (BIT(7)) +#define GPIO_SIG164_IN_SEL_V 0x1 +#define GPIO_SIG164_IN_SEL_S 7 +/* GPIO_FUNC164_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC164_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC164_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC164_IN_INV_SEL_V 0x1 +#define GPIO_FUNC164_IN_INV_SEL_S 6 +/* GPIO_FUNC164_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC164_IN_SEL 0x0000003F +#define GPIO_FUNC164_IN_SEL_M ((GPIO_FUNC164_IN_SEL_V)<<(GPIO_FUNC164_IN_SEL_S)) +#define GPIO_FUNC164_IN_SEL_V 0x3F +#define GPIO_FUNC164_IN_SEL_S 0 + +#define GPIO_FUNC165_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3E8) +/* GPIO_SIG165_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG165_IN_SEL (BIT(7)) +#define GPIO_SIG165_IN_SEL_M (BIT(7)) +#define GPIO_SIG165_IN_SEL_V 0x1 +#define GPIO_SIG165_IN_SEL_S 7 +/* GPIO_FUNC165_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC165_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC165_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC165_IN_INV_SEL_V 0x1 +#define GPIO_FUNC165_IN_INV_SEL_S 6 +/* GPIO_FUNC165_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC165_IN_SEL 0x0000003F +#define GPIO_FUNC165_IN_SEL_M ((GPIO_FUNC165_IN_SEL_V)<<(GPIO_FUNC165_IN_SEL_S)) +#define GPIO_FUNC165_IN_SEL_V 0x3F +#define GPIO_FUNC165_IN_SEL_S 0 + +#define GPIO_FUNC166_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3EC) +/* GPIO_SIG166_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG166_IN_SEL (BIT(7)) +#define GPIO_SIG166_IN_SEL_M (BIT(7)) +#define GPIO_SIG166_IN_SEL_V 0x1 +#define GPIO_SIG166_IN_SEL_S 7 +/* GPIO_FUNC166_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC166_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC166_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC166_IN_INV_SEL_V 0x1 +#define GPIO_FUNC166_IN_INV_SEL_S 6 +/* GPIO_FUNC166_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC166_IN_SEL 0x0000003F +#define GPIO_FUNC166_IN_SEL_M ((GPIO_FUNC166_IN_SEL_V)<<(GPIO_FUNC166_IN_SEL_S)) +#define GPIO_FUNC166_IN_SEL_V 0x3F +#define GPIO_FUNC166_IN_SEL_S 0 + +#define GPIO_FUNC167_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3F0) +/* GPIO_SIG167_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG167_IN_SEL (BIT(7)) +#define GPIO_SIG167_IN_SEL_M (BIT(7)) +#define GPIO_SIG167_IN_SEL_V 0x1 +#define GPIO_SIG167_IN_SEL_S 7 +/* GPIO_FUNC167_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC167_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC167_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC167_IN_INV_SEL_V 0x1 +#define GPIO_FUNC167_IN_INV_SEL_S 6 +/* GPIO_FUNC167_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC167_IN_SEL 0x0000003F +#define GPIO_FUNC167_IN_SEL_M ((GPIO_FUNC167_IN_SEL_V)<<(GPIO_FUNC167_IN_SEL_S)) +#define GPIO_FUNC167_IN_SEL_V 0x3F +#define GPIO_FUNC167_IN_SEL_S 0 + +#define GPIO_FUNC168_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3F4) +/* GPIO_SIG168_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG168_IN_SEL (BIT(7)) +#define GPIO_SIG168_IN_SEL_M (BIT(7)) +#define GPIO_SIG168_IN_SEL_V 0x1 +#define GPIO_SIG168_IN_SEL_S 7 +/* GPIO_FUNC168_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC168_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC168_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC168_IN_INV_SEL_V 0x1 +#define GPIO_FUNC168_IN_INV_SEL_S 6 +/* GPIO_FUNC168_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC168_IN_SEL 0x0000003F +#define GPIO_FUNC168_IN_SEL_M ((GPIO_FUNC168_IN_SEL_V)<<(GPIO_FUNC168_IN_SEL_S)) +#define GPIO_FUNC168_IN_SEL_V 0x3F +#define GPIO_FUNC168_IN_SEL_S 0 + +#define GPIO_FUNC169_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3F8) +/* GPIO_SIG169_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG169_IN_SEL (BIT(7)) +#define GPIO_SIG169_IN_SEL_M (BIT(7)) +#define GPIO_SIG169_IN_SEL_V 0x1 +#define GPIO_SIG169_IN_SEL_S 7 +/* GPIO_FUNC169_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC169_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC169_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC169_IN_INV_SEL_V 0x1 +#define GPIO_FUNC169_IN_INV_SEL_S 6 +/* GPIO_FUNC169_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC169_IN_SEL 0x0000003F +#define GPIO_FUNC169_IN_SEL_M ((GPIO_FUNC169_IN_SEL_V)<<(GPIO_FUNC169_IN_SEL_S)) +#define GPIO_FUNC169_IN_SEL_V 0x3F +#define GPIO_FUNC169_IN_SEL_S 0 + +#define GPIO_FUNC170_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x3FC) +/* GPIO_SIG170_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG170_IN_SEL (BIT(7)) +#define GPIO_SIG170_IN_SEL_M (BIT(7)) +#define GPIO_SIG170_IN_SEL_V 0x1 +#define GPIO_SIG170_IN_SEL_S 7 +/* GPIO_FUNC170_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC170_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC170_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC170_IN_INV_SEL_V 0x1 +#define GPIO_FUNC170_IN_INV_SEL_S 6 +/* GPIO_FUNC170_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC170_IN_SEL 0x0000003F +#define GPIO_FUNC170_IN_SEL_M ((GPIO_FUNC170_IN_SEL_V)<<(GPIO_FUNC170_IN_SEL_S)) +#define GPIO_FUNC170_IN_SEL_V 0x3F +#define GPIO_FUNC170_IN_SEL_S 0 + +#define GPIO_FUNC171_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x400) +/* GPIO_SIG171_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG171_IN_SEL (BIT(7)) +#define GPIO_SIG171_IN_SEL_M (BIT(7)) +#define GPIO_SIG171_IN_SEL_V 0x1 +#define GPIO_SIG171_IN_SEL_S 7 +/* GPIO_FUNC171_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC171_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC171_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC171_IN_INV_SEL_V 0x1 +#define GPIO_FUNC171_IN_INV_SEL_S 6 +/* GPIO_FUNC171_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC171_IN_SEL 0x0000003F +#define GPIO_FUNC171_IN_SEL_M ((GPIO_FUNC171_IN_SEL_V)<<(GPIO_FUNC171_IN_SEL_S)) +#define GPIO_FUNC171_IN_SEL_V 0x3F +#define GPIO_FUNC171_IN_SEL_S 0 + +#define GPIO_FUNC172_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x404) +/* GPIO_SIG172_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG172_IN_SEL (BIT(7)) +#define GPIO_SIG172_IN_SEL_M (BIT(7)) +#define GPIO_SIG172_IN_SEL_V 0x1 +#define GPIO_SIG172_IN_SEL_S 7 +/* GPIO_FUNC172_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC172_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC172_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC172_IN_INV_SEL_V 0x1 +#define GPIO_FUNC172_IN_INV_SEL_S 6 +/* GPIO_FUNC172_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC172_IN_SEL 0x0000003F +#define GPIO_FUNC172_IN_SEL_M ((GPIO_FUNC172_IN_SEL_V)<<(GPIO_FUNC172_IN_SEL_S)) +#define GPIO_FUNC172_IN_SEL_V 0x3F +#define GPIO_FUNC172_IN_SEL_S 0 + +#define GPIO_FUNC173_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x408) +/* GPIO_SIG173_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG173_IN_SEL (BIT(7)) +#define GPIO_SIG173_IN_SEL_M (BIT(7)) +#define GPIO_SIG173_IN_SEL_V 0x1 +#define GPIO_SIG173_IN_SEL_S 7 +/* GPIO_FUNC173_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC173_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC173_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC173_IN_INV_SEL_V 0x1 +#define GPIO_FUNC173_IN_INV_SEL_S 6 +/* GPIO_FUNC173_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC173_IN_SEL 0x0000003F +#define GPIO_FUNC173_IN_SEL_M ((GPIO_FUNC173_IN_SEL_V)<<(GPIO_FUNC173_IN_SEL_S)) +#define GPIO_FUNC173_IN_SEL_V 0x3F +#define GPIO_FUNC173_IN_SEL_S 0 + +#define GPIO_FUNC174_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x40C) +/* GPIO_SIG174_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG174_IN_SEL (BIT(7)) +#define GPIO_SIG174_IN_SEL_M (BIT(7)) +#define GPIO_SIG174_IN_SEL_V 0x1 +#define GPIO_SIG174_IN_SEL_S 7 +/* GPIO_FUNC174_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC174_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC174_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC174_IN_INV_SEL_V 0x1 +#define GPIO_FUNC174_IN_INV_SEL_S 6 +/* GPIO_FUNC174_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC174_IN_SEL 0x0000003F +#define GPIO_FUNC174_IN_SEL_M ((GPIO_FUNC174_IN_SEL_V)<<(GPIO_FUNC174_IN_SEL_S)) +#define GPIO_FUNC174_IN_SEL_V 0x3F +#define GPIO_FUNC174_IN_SEL_S 0 + +#define GPIO_FUNC175_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x410) +/* GPIO_SIG175_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG175_IN_SEL (BIT(7)) +#define GPIO_SIG175_IN_SEL_M (BIT(7)) +#define GPIO_SIG175_IN_SEL_V 0x1 +#define GPIO_SIG175_IN_SEL_S 7 +/* GPIO_FUNC175_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC175_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC175_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC175_IN_INV_SEL_V 0x1 +#define GPIO_FUNC175_IN_INV_SEL_S 6 +/* GPIO_FUNC175_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC175_IN_SEL 0x0000003F +#define GPIO_FUNC175_IN_SEL_M ((GPIO_FUNC175_IN_SEL_V)<<(GPIO_FUNC175_IN_SEL_S)) +#define GPIO_FUNC175_IN_SEL_V 0x3F +#define GPIO_FUNC175_IN_SEL_S 0 + +#define GPIO_FUNC176_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x414) +/* GPIO_SIG176_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG176_IN_SEL (BIT(7)) +#define GPIO_SIG176_IN_SEL_M (BIT(7)) +#define GPIO_SIG176_IN_SEL_V 0x1 +#define GPIO_SIG176_IN_SEL_S 7 +/* GPIO_FUNC176_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC176_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC176_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC176_IN_INV_SEL_V 0x1 +#define GPIO_FUNC176_IN_INV_SEL_S 6 +/* GPIO_FUNC176_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC176_IN_SEL 0x0000003F +#define GPIO_FUNC176_IN_SEL_M ((GPIO_FUNC176_IN_SEL_V)<<(GPIO_FUNC176_IN_SEL_S)) +#define GPIO_FUNC176_IN_SEL_V 0x3F +#define GPIO_FUNC176_IN_SEL_S 0 + +#define GPIO_FUNC177_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x418) +/* GPIO_SIG177_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG177_IN_SEL (BIT(7)) +#define GPIO_SIG177_IN_SEL_M (BIT(7)) +#define GPIO_SIG177_IN_SEL_V 0x1 +#define GPIO_SIG177_IN_SEL_S 7 +/* GPIO_FUNC177_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC177_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC177_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC177_IN_INV_SEL_V 0x1 +#define GPIO_FUNC177_IN_INV_SEL_S 6 +/* GPIO_FUNC177_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC177_IN_SEL 0x0000003F +#define GPIO_FUNC177_IN_SEL_M ((GPIO_FUNC177_IN_SEL_V)<<(GPIO_FUNC177_IN_SEL_S)) +#define GPIO_FUNC177_IN_SEL_V 0x3F +#define GPIO_FUNC177_IN_SEL_S 0 + +#define GPIO_FUNC178_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x41C) +/* GPIO_SIG178_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG178_IN_SEL (BIT(7)) +#define GPIO_SIG178_IN_SEL_M (BIT(7)) +#define GPIO_SIG178_IN_SEL_V 0x1 +#define GPIO_SIG178_IN_SEL_S 7 +/* GPIO_FUNC178_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC178_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC178_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC178_IN_INV_SEL_V 0x1 +#define GPIO_FUNC178_IN_INV_SEL_S 6 +/* GPIO_FUNC178_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC178_IN_SEL 0x0000003F +#define GPIO_FUNC178_IN_SEL_M ((GPIO_FUNC178_IN_SEL_V)<<(GPIO_FUNC178_IN_SEL_S)) +#define GPIO_FUNC178_IN_SEL_V 0x3F +#define GPIO_FUNC178_IN_SEL_S 0 + +#define GPIO_FUNC179_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x420) +/* GPIO_SIG179_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG179_IN_SEL (BIT(7)) +#define GPIO_SIG179_IN_SEL_M (BIT(7)) +#define GPIO_SIG179_IN_SEL_V 0x1 +#define GPIO_SIG179_IN_SEL_S 7 +/* GPIO_FUNC179_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC179_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC179_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC179_IN_INV_SEL_V 0x1 +#define GPIO_FUNC179_IN_INV_SEL_S 6 +/* GPIO_FUNC179_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC179_IN_SEL 0x0000003F +#define GPIO_FUNC179_IN_SEL_M ((GPIO_FUNC179_IN_SEL_V)<<(GPIO_FUNC179_IN_SEL_S)) +#define GPIO_FUNC179_IN_SEL_V 0x3F +#define GPIO_FUNC179_IN_SEL_S 0 + +#define GPIO_FUNC180_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x424) +/* GPIO_SIG180_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG180_IN_SEL (BIT(7)) +#define GPIO_SIG180_IN_SEL_M (BIT(7)) +#define GPIO_SIG180_IN_SEL_V 0x1 +#define GPIO_SIG180_IN_SEL_S 7 +/* GPIO_FUNC180_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC180_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC180_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC180_IN_INV_SEL_V 0x1 +#define GPIO_FUNC180_IN_INV_SEL_S 6 +/* GPIO_FUNC180_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC180_IN_SEL 0x0000003F +#define GPIO_FUNC180_IN_SEL_M ((GPIO_FUNC180_IN_SEL_V)<<(GPIO_FUNC180_IN_SEL_S)) +#define GPIO_FUNC180_IN_SEL_V 0x3F +#define GPIO_FUNC180_IN_SEL_S 0 + +#define GPIO_FUNC181_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x428) +/* GPIO_SIG181_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG181_IN_SEL (BIT(7)) +#define GPIO_SIG181_IN_SEL_M (BIT(7)) +#define GPIO_SIG181_IN_SEL_V 0x1 +#define GPIO_SIG181_IN_SEL_S 7 +/* GPIO_FUNC181_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC181_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC181_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC181_IN_INV_SEL_V 0x1 +#define GPIO_FUNC181_IN_INV_SEL_S 6 +/* GPIO_FUNC181_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC181_IN_SEL 0x0000003F +#define GPIO_FUNC181_IN_SEL_M ((GPIO_FUNC181_IN_SEL_V)<<(GPIO_FUNC181_IN_SEL_S)) +#define GPIO_FUNC181_IN_SEL_V 0x3F +#define GPIO_FUNC181_IN_SEL_S 0 + +#define GPIO_FUNC182_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x42C) +/* GPIO_SIG182_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG182_IN_SEL (BIT(7)) +#define GPIO_SIG182_IN_SEL_M (BIT(7)) +#define GPIO_SIG182_IN_SEL_V 0x1 +#define GPIO_SIG182_IN_SEL_S 7 +/* GPIO_FUNC182_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC182_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC182_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC182_IN_INV_SEL_V 0x1 +#define GPIO_FUNC182_IN_INV_SEL_S 6 +/* GPIO_FUNC182_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC182_IN_SEL 0x0000003F +#define GPIO_FUNC182_IN_SEL_M ((GPIO_FUNC182_IN_SEL_V)<<(GPIO_FUNC182_IN_SEL_S)) +#define GPIO_FUNC182_IN_SEL_V 0x3F +#define GPIO_FUNC182_IN_SEL_S 0 + +#define GPIO_FUNC183_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x430) +/* GPIO_SIG183_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG183_IN_SEL (BIT(7)) +#define GPIO_SIG183_IN_SEL_M (BIT(7)) +#define GPIO_SIG183_IN_SEL_V 0x1 +#define GPIO_SIG183_IN_SEL_S 7 +/* GPIO_FUNC183_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC183_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC183_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC183_IN_INV_SEL_V 0x1 +#define GPIO_FUNC183_IN_INV_SEL_S 6 +/* GPIO_FUNC183_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC183_IN_SEL 0x0000003F +#define GPIO_FUNC183_IN_SEL_M ((GPIO_FUNC183_IN_SEL_V)<<(GPIO_FUNC183_IN_SEL_S)) +#define GPIO_FUNC183_IN_SEL_V 0x3F +#define GPIO_FUNC183_IN_SEL_S 0 + +#define GPIO_FUNC184_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x434) +/* GPIO_SIG184_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG184_IN_SEL (BIT(7)) +#define GPIO_SIG184_IN_SEL_M (BIT(7)) +#define GPIO_SIG184_IN_SEL_V 0x1 +#define GPIO_SIG184_IN_SEL_S 7 +/* GPIO_FUNC184_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC184_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC184_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC184_IN_INV_SEL_V 0x1 +#define GPIO_FUNC184_IN_INV_SEL_S 6 +/* GPIO_FUNC184_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC184_IN_SEL 0x0000003F +#define GPIO_FUNC184_IN_SEL_M ((GPIO_FUNC184_IN_SEL_V)<<(GPIO_FUNC184_IN_SEL_S)) +#define GPIO_FUNC184_IN_SEL_V 0x3F +#define GPIO_FUNC184_IN_SEL_S 0 + +#define GPIO_FUNC185_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x438) +/* GPIO_SIG185_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG185_IN_SEL (BIT(7)) +#define GPIO_SIG185_IN_SEL_M (BIT(7)) +#define GPIO_SIG185_IN_SEL_V 0x1 +#define GPIO_SIG185_IN_SEL_S 7 +/* GPIO_FUNC185_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC185_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC185_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC185_IN_INV_SEL_V 0x1 +#define GPIO_FUNC185_IN_INV_SEL_S 6 +/* GPIO_FUNC185_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC185_IN_SEL 0x0000003F +#define GPIO_FUNC185_IN_SEL_M ((GPIO_FUNC185_IN_SEL_V)<<(GPIO_FUNC185_IN_SEL_S)) +#define GPIO_FUNC185_IN_SEL_V 0x3F +#define GPIO_FUNC185_IN_SEL_S 0 + +#define GPIO_FUNC186_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x43C) +/* GPIO_SIG186_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG186_IN_SEL (BIT(7)) +#define GPIO_SIG186_IN_SEL_M (BIT(7)) +#define GPIO_SIG186_IN_SEL_V 0x1 +#define GPIO_SIG186_IN_SEL_S 7 +/* GPIO_FUNC186_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC186_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC186_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC186_IN_INV_SEL_V 0x1 +#define GPIO_FUNC186_IN_INV_SEL_S 6 +/* GPIO_FUNC186_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC186_IN_SEL 0x0000003F +#define GPIO_FUNC186_IN_SEL_M ((GPIO_FUNC186_IN_SEL_V)<<(GPIO_FUNC186_IN_SEL_S)) +#define GPIO_FUNC186_IN_SEL_V 0x3F +#define GPIO_FUNC186_IN_SEL_S 0 + +#define GPIO_FUNC187_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x440) +/* GPIO_SIG187_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG187_IN_SEL (BIT(7)) +#define GPIO_SIG187_IN_SEL_M (BIT(7)) +#define GPIO_SIG187_IN_SEL_V 0x1 +#define GPIO_SIG187_IN_SEL_S 7 +/* GPIO_FUNC187_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC187_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC187_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC187_IN_INV_SEL_V 0x1 +#define GPIO_FUNC187_IN_INV_SEL_S 6 +/* GPIO_FUNC187_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC187_IN_SEL 0x0000003F +#define GPIO_FUNC187_IN_SEL_M ((GPIO_FUNC187_IN_SEL_V)<<(GPIO_FUNC187_IN_SEL_S)) +#define GPIO_FUNC187_IN_SEL_V 0x3F +#define GPIO_FUNC187_IN_SEL_S 0 + +#define GPIO_FUNC188_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x444) +/* GPIO_SIG188_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG188_IN_SEL (BIT(7)) +#define GPIO_SIG188_IN_SEL_M (BIT(7)) +#define GPIO_SIG188_IN_SEL_V 0x1 +#define GPIO_SIG188_IN_SEL_S 7 +/* GPIO_FUNC188_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC188_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC188_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC188_IN_INV_SEL_V 0x1 +#define GPIO_FUNC188_IN_INV_SEL_S 6 +/* GPIO_FUNC188_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC188_IN_SEL 0x0000003F +#define GPIO_FUNC188_IN_SEL_M ((GPIO_FUNC188_IN_SEL_V)<<(GPIO_FUNC188_IN_SEL_S)) +#define GPIO_FUNC188_IN_SEL_V 0x3F +#define GPIO_FUNC188_IN_SEL_S 0 + +#define GPIO_FUNC189_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x448) +/* GPIO_SIG189_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG189_IN_SEL (BIT(7)) +#define GPIO_SIG189_IN_SEL_M (BIT(7)) +#define GPIO_SIG189_IN_SEL_V 0x1 +#define GPIO_SIG189_IN_SEL_S 7 +/* GPIO_FUNC189_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC189_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC189_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC189_IN_INV_SEL_V 0x1 +#define GPIO_FUNC189_IN_INV_SEL_S 6 +/* GPIO_FUNC189_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC189_IN_SEL 0x0000003F +#define GPIO_FUNC189_IN_SEL_M ((GPIO_FUNC189_IN_SEL_V)<<(GPIO_FUNC189_IN_SEL_S)) +#define GPIO_FUNC189_IN_SEL_V 0x3F +#define GPIO_FUNC189_IN_SEL_S 0 + +#define GPIO_FUNC190_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x44C) +/* GPIO_SIG190_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG190_IN_SEL (BIT(7)) +#define GPIO_SIG190_IN_SEL_M (BIT(7)) +#define GPIO_SIG190_IN_SEL_V 0x1 +#define GPIO_SIG190_IN_SEL_S 7 +/* GPIO_FUNC190_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC190_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC190_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC190_IN_INV_SEL_V 0x1 +#define GPIO_FUNC190_IN_INV_SEL_S 6 +/* GPIO_FUNC190_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC190_IN_SEL 0x0000003F +#define GPIO_FUNC190_IN_SEL_M ((GPIO_FUNC190_IN_SEL_V)<<(GPIO_FUNC190_IN_SEL_S)) +#define GPIO_FUNC190_IN_SEL_V 0x3F +#define GPIO_FUNC190_IN_SEL_S 0 + +#define GPIO_FUNC191_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x450) +/* GPIO_SIG191_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG191_IN_SEL (BIT(7)) +#define GPIO_SIG191_IN_SEL_M (BIT(7)) +#define GPIO_SIG191_IN_SEL_V 0x1 +#define GPIO_SIG191_IN_SEL_S 7 +/* GPIO_FUNC191_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC191_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC191_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC191_IN_INV_SEL_V 0x1 +#define GPIO_FUNC191_IN_INV_SEL_S 6 +/* GPIO_FUNC191_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC191_IN_SEL 0x0000003F +#define GPIO_FUNC191_IN_SEL_M ((GPIO_FUNC191_IN_SEL_V)<<(GPIO_FUNC191_IN_SEL_S)) +#define GPIO_FUNC191_IN_SEL_V 0x3F +#define GPIO_FUNC191_IN_SEL_S 0 + +#define GPIO_FUNC192_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x454) +/* GPIO_SIG192_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG192_IN_SEL (BIT(7)) +#define GPIO_SIG192_IN_SEL_M (BIT(7)) +#define GPIO_SIG192_IN_SEL_V 0x1 +#define GPIO_SIG192_IN_SEL_S 7 +/* GPIO_FUNC192_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC192_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC192_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC192_IN_INV_SEL_V 0x1 +#define GPIO_FUNC192_IN_INV_SEL_S 6 +/* GPIO_FUNC192_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC192_IN_SEL 0x0000003F +#define GPIO_FUNC192_IN_SEL_M ((GPIO_FUNC192_IN_SEL_V)<<(GPIO_FUNC192_IN_SEL_S)) +#define GPIO_FUNC192_IN_SEL_V 0x3F +#define GPIO_FUNC192_IN_SEL_S 0 + +#define GPIO_FUNC193_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x458) +/* GPIO_SIG193_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG193_IN_SEL (BIT(7)) +#define GPIO_SIG193_IN_SEL_M (BIT(7)) +#define GPIO_SIG193_IN_SEL_V 0x1 +#define GPIO_SIG193_IN_SEL_S 7 +/* GPIO_FUNC193_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC193_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC193_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC193_IN_INV_SEL_V 0x1 +#define GPIO_FUNC193_IN_INV_SEL_S 6 +/* GPIO_FUNC193_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC193_IN_SEL 0x0000003F +#define GPIO_FUNC193_IN_SEL_M ((GPIO_FUNC193_IN_SEL_V)<<(GPIO_FUNC193_IN_SEL_S)) +#define GPIO_FUNC193_IN_SEL_V 0x3F +#define GPIO_FUNC193_IN_SEL_S 0 + +#define GPIO_FUNC194_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x45C) +/* GPIO_SIG194_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG194_IN_SEL (BIT(7)) +#define GPIO_SIG194_IN_SEL_M (BIT(7)) +#define GPIO_SIG194_IN_SEL_V 0x1 +#define GPIO_SIG194_IN_SEL_S 7 +/* GPIO_FUNC194_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC194_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC194_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC194_IN_INV_SEL_V 0x1 +#define GPIO_FUNC194_IN_INV_SEL_S 6 +/* GPIO_FUNC194_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC194_IN_SEL 0x0000003F +#define GPIO_FUNC194_IN_SEL_M ((GPIO_FUNC194_IN_SEL_V)<<(GPIO_FUNC194_IN_SEL_S)) +#define GPIO_FUNC194_IN_SEL_V 0x3F +#define GPIO_FUNC194_IN_SEL_S 0 + +#define GPIO_FUNC195_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x460) +/* GPIO_SIG195_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG195_IN_SEL (BIT(7)) +#define GPIO_SIG195_IN_SEL_M (BIT(7)) +#define GPIO_SIG195_IN_SEL_V 0x1 +#define GPIO_SIG195_IN_SEL_S 7 +/* GPIO_FUNC195_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC195_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC195_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC195_IN_INV_SEL_V 0x1 +#define GPIO_FUNC195_IN_INV_SEL_S 6 +/* GPIO_FUNC195_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC195_IN_SEL 0x0000003F +#define GPIO_FUNC195_IN_SEL_M ((GPIO_FUNC195_IN_SEL_V)<<(GPIO_FUNC195_IN_SEL_S)) +#define GPIO_FUNC195_IN_SEL_V 0x3F +#define GPIO_FUNC195_IN_SEL_S 0 + +#define GPIO_FUNC196_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x464) +/* GPIO_SIG196_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG196_IN_SEL (BIT(7)) +#define GPIO_SIG196_IN_SEL_M (BIT(7)) +#define GPIO_SIG196_IN_SEL_V 0x1 +#define GPIO_SIG196_IN_SEL_S 7 +/* GPIO_FUNC196_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC196_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC196_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC196_IN_INV_SEL_V 0x1 +#define GPIO_FUNC196_IN_INV_SEL_S 6 +/* GPIO_FUNC196_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC196_IN_SEL 0x0000003F +#define GPIO_FUNC196_IN_SEL_M ((GPIO_FUNC196_IN_SEL_V)<<(GPIO_FUNC196_IN_SEL_S)) +#define GPIO_FUNC196_IN_SEL_V 0x3F +#define GPIO_FUNC196_IN_SEL_S 0 + +#define GPIO_FUNC197_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x468) +/* GPIO_SIG197_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG197_IN_SEL (BIT(7)) +#define GPIO_SIG197_IN_SEL_M (BIT(7)) +#define GPIO_SIG197_IN_SEL_V 0x1 +#define GPIO_SIG197_IN_SEL_S 7 +/* GPIO_FUNC197_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC197_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC197_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC197_IN_INV_SEL_V 0x1 +#define GPIO_FUNC197_IN_INV_SEL_S 6 +/* GPIO_FUNC197_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC197_IN_SEL 0x0000003F +#define GPIO_FUNC197_IN_SEL_M ((GPIO_FUNC197_IN_SEL_V)<<(GPIO_FUNC197_IN_SEL_S)) +#define GPIO_FUNC197_IN_SEL_V 0x3F +#define GPIO_FUNC197_IN_SEL_S 0 + +#define GPIO_FUNC198_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x46C) +/* GPIO_SIG198_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG198_IN_SEL (BIT(7)) +#define GPIO_SIG198_IN_SEL_M (BIT(7)) +#define GPIO_SIG198_IN_SEL_V 0x1 +#define GPIO_SIG198_IN_SEL_S 7 +/* GPIO_FUNC198_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC198_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC198_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC198_IN_INV_SEL_V 0x1 +#define GPIO_FUNC198_IN_INV_SEL_S 6 +/* GPIO_FUNC198_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC198_IN_SEL 0x0000003F +#define GPIO_FUNC198_IN_SEL_M ((GPIO_FUNC198_IN_SEL_V)<<(GPIO_FUNC198_IN_SEL_S)) +#define GPIO_FUNC198_IN_SEL_V 0x3F +#define GPIO_FUNC198_IN_SEL_S 0 + +#define GPIO_FUNC199_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x470) +/* GPIO_SIG199_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG199_IN_SEL (BIT(7)) +#define GPIO_SIG199_IN_SEL_M (BIT(7)) +#define GPIO_SIG199_IN_SEL_V 0x1 +#define GPIO_SIG199_IN_SEL_S 7 +/* GPIO_FUNC199_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC199_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC199_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC199_IN_INV_SEL_V 0x1 +#define GPIO_FUNC199_IN_INV_SEL_S 6 +/* GPIO_FUNC199_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC199_IN_SEL 0x0000003F +#define GPIO_FUNC199_IN_SEL_M ((GPIO_FUNC199_IN_SEL_V)<<(GPIO_FUNC199_IN_SEL_S)) +#define GPIO_FUNC199_IN_SEL_V 0x3F +#define GPIO_FUNC199_IN_SEL_S 0 + +#define GPIO_FUNC200_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x474) +/* GPIO_SIG200_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG200_IN_SEL (BIT(7)) +#define GPIO_SIG200_IN_SEL_M (BIT(7)) +#define GPIO_SIG200_IN_SEL_V 0x1 +#define GPIO_SIG200_IN_SEL_S 7 +/* GPIO_FUNC200_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC200_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC200_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC200_IN_INV_SEL_V 0x1 +#define GPIO_FUNC200_IN_INV_SEL_S 6 +/* GPIO_FUNC200_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC200_IN_SEL 0x0000003F +#define GPIO_FUNC200_IN_SEL_M ((GPIO_FUNC200_IN_SEL_V)<<(GPIO_FUNC200_IN_SEL_S)) +#define GPIO_FUNC200_IN_SEL_V 0x3F +#define GPIO_FUNC200_IN_SEL_S 0 + +#define GPIO_FUNC201_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x478) +/* GPIO_SIG201_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG201_IN_SEL (BIT(7)) +#define GPIO_SIG201_IN_SEL_M (BIT(7)) +#define GPIO_SIG201_IN_SEL_V 0x1 +#define GPIO_SIG201_IN_SEL_S 7 +/* GPIO_FUNC201_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC201_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC201_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC201_IN_INV_SEL_V 0x1 +#define GPIO_FUNC201_IN_INV_SEL_S 6 +/* GPIO_FUNC201_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC201_IN_SEL 0x0000003F +#define GPIO_FUNC201_IN_SEL_M ((GPIO_FUNC201_IN_SEL_V)<<(GPIO_FUNC201_IN_SEL_S)) +#define GPIO_FUNC201_IN_SEL_V 0x3F +#define GPIO_FUNC201_IN_SEL_S 0 + +#define GPIO_FUNC202_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x47C) +/* GPIO_SIG202_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG202_IN_SEL (BIT(7)) +#define GPIO_SIG202_IN_SEL_M (BIT(7)) +#define GPIO_SIG202_IN_SEL_V 0x1 +#define GPIO_SIG202_IN_SEL_S 7 +/* GPIO_FUNC202_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC202_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC202_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC202_IN_INV_SEL_V 0x1 +#define GPIO_FUNC202_IN_INV_SEL_S 6 +/* GPIO_FUNC202_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC202_IN_SEL 0x0000003F +#define GPIO_FUNC202_IN_SEL_M ((GPIO_FUNC202_IN_SEL_V)<<(GPIO_FUNC202_IN_SEL_S)) +#define GPIO_FUNC202_IN_SEL_V 0x3F +#define GPIO_FUNC202_IN_SEL_S 0 + +#define GPIO_FUNC203_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x480) +/* GPIO_SIG203_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG203_IN_SEL (BIT(7)) +#define GPIO_SIG203_IN_SEL_M (BIT(7)) +#define GPIO_SIG203_IN_SEL_V 0x1 +#define GPIO_SIG203_IN_SEL_S 7 +/* GPIO_FUNC203_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC203_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC203_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC203_IN_INV_SEL_V 0x1 +#define GPIO_FUNC203_IN_INV_SEL_S 6 +/* GPIO_FUNC203_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC203_IN_SEL 0x0000003F +#define GPIO_FUNC203_IN_SEL_M ((GPIO_FUNC203_IN_SEL_V)<<(GPIO_FUNC203_IN_SEL_S)) +#define GPIO_FUNC203_IN_SEL_V 0x3F +#define GPIO_FUNC203_IN_SEL_S 0 + +#define GPIO_FUNC204_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x484) +/* GPIO_SIG204_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG204_IN_SEL (BIT(7)) +#define GPIO_SIG204_IN_SEL_M (BIT(7)) +#define GPIO_SIG204_IN_SEL_V 0x1 +#define GPIO_SIG204_IN_SEL_S 7 +/* GPIO_FUNC204_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC204_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC204_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC204_IN_INV_SEL_V 0x1 +#define GPIO_FUNC204_IN_INV_SEL_S 6 +/* GPIO_FUNC204_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC204_IN_SEL 0x0000003F +#define GPIO_FUNC204_IN_SEL_M ((GPIO_FUNC204_IN_SEL_V)<<(GPIO_FUNC204_IN_SEL_S)) +#define GPIO_FUNC204_IN_SEL_V 0x3F +#define GPIO_FUNC204_IN_SEL_S 0 + +#define GPIO_FUNC205_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x488) +/* GPIO_SIG205_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG205_IN_SEL (BIT(7)) +#define GPIO_SIG205_IN_SEL_M (BIT(7)) +#define GPIO_SIG205_IN_SEL_V 0x1 +#define GPIO_SIG205_IN_SEL_S 7 +/* GPIO_FUNC205_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC205_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC205_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC205_IN_INV_SEL_V 0x1 +#define GPIO_FUNC205_IN_INV_SEL_S 6 +/* GPIO_FUNC205_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC205_IN_SEL 0x0000003F +#define GPIO_FUNC205_IN_SEL_M ((GPIO_FUNC205_IN_SEL_V)<<(GPIO_FUNC205_IN_SEL_S)) +#define GPIO_FUNC205_IN_SEL_V 0x3F +#define GPIO_FUNC205_IN_SEL_S 0 + +#define GPIO_FUNC206_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x48C) +/* GPIO_SIG206_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG206_IN_SEL (BIT(7)) +#define GPIO_SIG206_IN_SEL_M (BIT(7)) +#define GPIO_SIG206_IN_SEL_V 0x1 +#define GPIO_SIG206_IN_SEL_S 7 +/* GPIO_FUNC206_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC206_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC206_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC206_IN_INV_SEL_V 0x1 +#define GPIO_FUNC206_IN_INV_SEL_S 6 +/* GPIO_FUNC206_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC206_IN_SEL 0x0000003F +#define GPIO_FUNC206_IN_SEL_M ((GPIO_FUNC206_IN_SEL_V)<<(GPIO_FUNC206_IN_SEL_S)) +#define GPIO_FUNC206_IN_SEL_V 0x3F +#define GPIO_FUNC206_IN_SEL_S 0 + +#define GPIO_FUNC207_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x490) +/* GPIO_SIG207_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG207_IN_SEL (BIT(7)) +#define GPIO_SIG207_IN_SEL_M (BIT(7)) +#define GPIO_SIG207_IN_SEL_V 0x1 +#define GPIO_SIG207_IN_SEL_S 7 +/* GPIO_FUNC207_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC207_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC207_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC207_IN_INV_SEL_V 0x1 +#define GPIO_FUNC207_IN_INV_SEL_S 6 +/* GPIO_FUNC207_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC207_IN_SEL 0x0000003F +#define GPIO_FUNC207_IN_SEL_M ((GPIO_FUNC207_IN_SEL_V)<<(GPIO_FUNC207_IN_SEL_S)) +#define GPIO_FUNC207_IN_SEL_V 0x3F +#define GPIO_FUNC207_IN_SEL_S 0 + +#define GPIO_FUNC208_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x494) +/* GPIO_SIG208_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG208_IN_SEL (BIT(7)) +#define GPIO_SIG208_IN_SEL_M (BIT(7)) +#define GPIO_SIG208_IN_SEL_V 0x1 +#define GPIO_SIG208_IN_SEL_S 7 +/* GPIO_FUNC208_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC208_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC208_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC208_IN_INV_SEL_V 0x1 +#define GPIO_FUNC208_IN_INV_SEL_S 6 +/* GPIO_FUNC208_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC208_IN_SEL 0x0000003F +#define GPIO_FUNC208_IN_SEL_M ((GPIO_FUNC208_IN_SEL_V)<<(GPIO_FUNC208_IN_SEL_S)) +#define GPIO_FUNC208_IN_SEL_V 0x3F +#define GPIO_FUNC208_IN_SEL_S 0 + +#define GPIO_FUNC209_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x498) +/* GPIO_SIG209_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG209_IN_SEL (BIT(7)) +#define GPIO_SIG209_IN_SEL_M (BIT(7)) +#define GPIO_SIG209_IN_SEL_V 0x1 +#define GPIO_SIG209_IN_SEL_S 7 +/* GPIO_FUNC209_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC209_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC209_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC209_IN_INV_SEL_V 0x1 +#define GPIO_FUNC209_IN_INV_SEL_S 6 +/* GPIO_FUNC209_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC209_IN_SEL 0x0000003F +#define GPIO_FUNC209_IN_SEL_M ((GPIO_FUNC209_IN_SEL_V)<<(GPIO_FUNC209_IN_SEL_S)) +#define GPIO_FUNC209_IN_SEL_V 0x3F +#define GPIO_FUNC209_IN_SEL_S 0 + +#define GPIO_FUNC210_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x49C) +/* GPIO_SIG210_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG210_IN_SEL (BIT(7)) +#define GPIO_SIG210_IN_SEL_M (BIT(7)) +#define GPIO_SIG210_IN_SEL_V 0x1 +#define GPIO_SIG210_IN_SEL_S 7 +/* GPIO_FUNC210_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC210_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC210_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC210_IN_INV_SEL_V 0x1 +#define GPIO_FUNC210_IN_INV_SEL_S 6 +/* GPIO_FUNC210_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC210_IN_SEL 0x0000003F +#define GPIO_FUNC210_IN_SEL_M ((GPIO_FUNC210_IN_SEL_V)<<(GPIO_FUNC210_IN_SEL_S)) +#define GPIO_FUNC210_IN_SEL_V 0x3F +#define GPIO_FUNC210_IN_SEL_S 0 + +#define GPIO_FUNC211_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4A0) +/* GPIO_SIG211_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG211_IN_SEL (BIT(7)) +#define GPIO_SIG211_IN_SEL_M (BIT(7)) +#define GPIO_SIG211_IN_SEL_V 0x1 +#define GPIO_SIG211_IN_SEL_S 7 +/* GPIO_FUNC211_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC211_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC211_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC211_IN_INV_SEL_V 0x1 +#define GPIO_FUNC211_IN_INV_SEL_S 6 +/* GPIO_FUNC211_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC211_IN_SEL 0x0000003F +#define GPIO_FUNC211_IN_SEL_M ((GPIO_FUNC211_IN_SEL_V)<<(GPIO_FUNC211_IN_SEL_S)) +#define GPIO_FUNC211_IN_SEL_V 0x3F +#define GPIO_FUNC211_IN_SEL_S 0 + +#define GPIO_FUNC212_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4A4) +/* GPIO_SIG212_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG212_IN_SEL (BIT(7)) +#define GPIO_SIG212_IN_SEL_M (BIT(7)) +#define GPIO_SIG212_IN_SEL_V 0x1 +#define GPIO_SIG212_IN_SEL_S 7 +/* GPIO_FUNC212_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC212_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC212_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC212_IN_INV_SEL_V 0x1 +#define GPIO_FUNC212_IN_INV_SEL_S 6 +/* GPIO_FUNC212_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC212_IN_SEL 0x0000003F +#define GPIO_FUNC212_IN_SEL_M ((GPIO_FUNC212_IN_SEL_V)<<(GPIO_FUNC212_IN_SEL_S)) +#define GPIO_FUNC212_IN_SEL_V 0x3F +#define GPIO_FUNC212_IN_SEL_S 0 + +#define GPIO_FUNC213_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4A8) +/* GPIO_SIG213_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG213_IN_SEL (BIT(7)) +#define GPIO_SIG213_IN_SEL_M (BIT(7)) +#define GPIO_SIG213_IN_SEL_V 0x1 +#define GPIO_SIG213_IN_SEL_S 7 +/* GPIO_FUNC213_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC213_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC213_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC213_IN_INV_SEL_V 0x1 +#define GPIO_FUNC213_IN_INV_SEL_S 6 +/* GPIO_FUNC213_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC213_IN_SEL 0x0000003F +#define GPIO_FUNC213_IN_SEL_M ((GPIO_FUNC213_IN_SEL_V)<<(GPIO_FUNC213_IN_SEL_S)) +#define GPIO_FUNC213_IN_SEL_V 0x3F +#define GPIO_FUNC213_IN_SEL_S 0 + +#define GPIO_FUNC214_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4AC) +/* GPIO_SIG214_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG214_IN_SEL (BIT(7)) +#define GPIO_SIG214_IN_SEL_M (BIT(7)) +#define GPIO_SIG214_IN_SEL_V 0x1 +#define GPIO_SIG214_IN_SEL_S 7 +/* GPIO_FUNC214_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC214_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC214_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC214_IN_INV_SEL_V 0x1 +#define GPIO_FUNC214_IN_INV_SEL_S 6 +/* GPIO_FUNC214_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC214_IN_SEL 0x0000003F +#define GPIO_FUNC214_IN_SEL_M ((GPIO_FUNC214_IN_SEL_V)<<(GPIO_FUNC214_IN_SEL_S)) +#define GPIO_FUNC214_IN_SEL_V 0x3F +#define GPIO_FUNC214_IN_SEL_S 0 + +#define GPIO_FUNC215_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4B0) +/* GPIO_SIG215_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG215_IN_SEL (BIT(7)) +#define GPIO_SIG215_IN_SEL_M (BIT(7)) +#define GPIO_SIG215_IN_SEL_V 0x1 +#define GPIO_SIG215_IN_SEL_S 7 +/* GPIO_FUNC215_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC215_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC215_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC215_IN_INV_SEL_V 0x1 +#define GPIO_FUNC215_IN_INV_SEL_S 6 +/* GPIO_FUNC215_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC215_IN_SEL 0x0000003F +#define GPIO_FUNC215_IN_SEL_M ((GPIO_FUNC215_IN_SEL_V)<<(GPIO_FUNC215_IN_SEL_S)) +#define GPIO_FUNC215_IN_SEL_V 0x3F +#define GPIO_FUNC215_IN_SEL_S 0 + +#define GPIO_FUNC216_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4B4) +/* GPIO_SIG216_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG216_IN_SEL (BIT(7)) +#define GPIO_SIG216_IN_SEL_M (BIT(7)) +#define GPIO_SIG216_IN_SEL_V 0x1 +#define GPIO_SIG216_IN_SEL_S 7 +/* GPIO_FUNC216_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC216_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC216_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC216_IN_INV_SEL_V 0x1 +#define GPIO_FUNC216_IN_INV_SEL_S 6 +/* GPIO_FUNC216_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC216_IN_SEL 0x0000003F +#define GPIO_FUNC216_IN_SEL_M ((GPIO_FUNC216_IN_SEL_V)<<(GPIO_FUNC216_IN_SEL_S)) +#define GPIO_FUNC216_IN_SEL_V 0x3F +#define GPIO_FUNC216_IN_SEL_S 0 + +#define GPIO_FUNC217_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4B8) +/* GPIO_SIG217_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG217_IN_SEL (BIT(7)) +#define GPIO_SIG217_IN_SEL_M (BIT(7)) +#define GPIO_SIG217_IN_SEL_V 0x1 +#define GPIO_SIG217_IN_SEL_S 7 +/* GPIO_FUNC217_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC217_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC217_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC217_IN_INV_SEL_V 0x1 +#define GPIO_FUNC217_IN_INV_SEL_S 6 +/* GPIO_FUNC217_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC217_IN_SEL 0x0000003F +#define GPIO_FUNC217_IN_SEL_M ((GPIO_FUNC217_IN_SEL_V)<<(GPIO_FUNC217_IN_SEL_S)) +#define GPIO_FUNC217_IN_SEL_V 0x3F +#define GPIO_FUNC217_IN_SEL_S 0 + +#define GPIO_FUNC218_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4BC) +/* GPIO_SIG218_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG218_IN_SEL (BIT(7)) +#define GPIO_SIG218_IN_SEL_M (BIT(7)) +#define GPIO_SIG218_IN_SEL_V 0x1 +#define GPIO_SIG218_IN_SEL_S 7 +/* GPIO_FUNC218_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC218_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC218_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC218_IN_INV_SEL_V 0x1 +#define GPIO_FUNC218_IN_INV_SEL_S 6 +/* GPIO_FUNC218_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC218_IN_SEL 0x0000003F +#define GPIO_FUNC218_IN_SEL_M ((GPIO_FUNC218_IN_SEL_V)<<(GPIO_FUNC218_IN_SEL_S)) +#define GPIO_FUNC218_IN_SEL_V 0x3F +#define GPIO_FUNC218_IN_SEL_S 0 + +#define GPIO_FUNC219_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4C0) +/* GPIO_SIG219_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG219_IN_SEL (BIT(7)) +#define GPIO_SIG219_IN_SEL_M (BIT(7)) +#define GPIO_SIG219_IN_SEL_V 0x1 +#define GPIO_SIG219_IN_SEL_S 7 +/* GPIO_FUNC219_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC219_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC219_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC219_IN_INV_SEL_V 0x1 +#define GPIO_FUNC219_IN_INV_SEL_S 6 +/* GPIO_FUNC219_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC219_IN_SEL 0x0000003F +#define GPIO_FUNC219_IN_SEL_M ((GPIO_FUNC219_IN_SEL_V)<<(GPIO_FUNC219_IN_SEL_S)) +#define GPIO_FUNC219_IN_SEL_V 0x3F +#define GPIO_FUNC219_IN_SEL_S 0 + +#define GPIO_FUNC220_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4C4) +/* GPIO_SIG220_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG220_IN_SEL (BIT(7)) +#define GPIO_SIG220_IN_SEL_M (BIT(7)) +#define GPIO_SIG220_IN_SEL_V 0x1 +#define GPIO_SIG220_IN_SEL_S 7 +/* GPIO_FUNC220_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC220_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC220_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC220_IN_INV_SEL_V 0x1 +#define GPIO_FUNC220_IN_INV_SEL_S 6 +/* GPIO_FUNC220_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC220_IN_SEL 0x0000003F +#define GPIO_FUNC220_IN_SEL_M ((GPIO_FUNC220_IN_SEL_V)<<(GPIO_FUNC220_IN_SEL_S)) +#define GPIO_FUNC220_IN_SEL_V 0x3F +#define GPIO_FUNC220_IN_SEL_S 0 + +#define GPIO_FUNC221_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4C8) +/* GPIO_SIG221_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG221_IN_SEL (BIT(7)) +#define GPIO_SIG221_IN_SEL_M (BIT(7)) +#define GPIO_SIG221_IN_SEL_V 0x1 +#define GPIO_SIG221_IN_SEL_S 7 +/* GPIO_FUNC221_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC221_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC221_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC221_IN_INV_SEL_V 0x1 +#define GPIO_FUNC221_IN_INV_SEL_S 6 +/* GPIO_FUNC221_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC221_IN_SEL 0x0000003F +#define GPIO_FUNC221_IN_SEL_M ((GPIO_FUNC221_IN_SEL_V)<<(GPIO_FUNC221_IN_SEL_S)) +#define GPIO_FUNC221_IN_SEL_V 0x3F +#define GPIO_FUNC221_IN_SEL_S 0 + +#define GPIO_FUNC222_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4CC) +/* GPIO_SIG222_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG222_IN_SEL (BIT(7)) +#define GPIO_SIG222_IN_SEL_M (BIT(7)) +#define GPIO_SIG222_IN_SEL_V 0x1 +#define GPIO_SIG222_IN_SEL_S 7 +/* GPIO_FUNC222_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC222_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC222_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC222_IN_INV_SEL_V 0x1 +#define GPIO_FUNC222_IN_INV_SEL_S 6 +/* GPIO_FUNC222_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC222_IN_SEL 0x0000003F +#define GPIO_FUNC222_IN_SEL_M ((GPIO_FUNC222_IN_SEL_V)<<(GPIO_FUNC222_IN_SEL_S)) +#define GPIO_FUNC222_IN_SEL_V 0x3F +#define GPIO_FUNC222_IN_SEL_S 0 + +#define GPIO_FUNC223_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4D0) +/* GPIO_SIG223_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG223_IN_SEL (BIT(7)) +#define GPIO_SIG223_IN_SEL_M (BIT(7)) +#define GPIO_SIG223_IN_SEL_V 0x1 +#define GPIO_SIG223_IN_SEL_S 7 +/* GPIO_FUNC223_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC223_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC223_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC223_IN_INV_SEL_V 0x1 +#define GPIO_FUNC223_IN_INV_SEL_S 6 +/* GPIO_FUNC223_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC223_IN_SEL 0x0000003F +#define GPIO_FUNC223_IN_SEL_M ((GPIO_FUNC223_IN_SEL_V)<<(GPIO_FUNC223_IN_SEL_S)) +#define GPIO_FUNC223_IN_SEL_V 0x3F +#define GPIO_FUNC223_IN_SEL_S 0 + +#define GPIO_FUNC224_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4D4) +/* GPIO_SIG224_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG224_IN_SEL (BIT(7)) +#define GPIO_SIG224_IN_SEL_M (BIT(7)) +#define GPIO_SIG224_IN_SEL_V 0x1 +#define GPIO_SIG224_IN_SEL_S 7 +/* GPIO_FUNC224_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC224_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC224_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC224_IN_INV_SEL_V 0x1 +#define GPIO_FUNC224_IN_INV_SEL_S 6 +/* GPIO_FUNC224_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC224_IN_SEL 0x0000003F +#define GPIO_FUNC224_IN_SEL_M ((GPIO_FUNC224_IN_SEL_V)<<(GPIO_FUNC224_IN_SEL_S)) +#define GPIO_FUNC224_IN_SEL_V 0x3F +#define GPIO_FUNC224_IN_SEL_S 0 + +#define GPIO_FUNC225_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4D8) +/* GPIO_SIG225_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG225_IN_SEL (BIT(7)) +#define GPIO_SIG225_IN_SEL_M (BIT(7)) +#define GPIO_SIG225_IN_SEL_V 0x1 +#define GPIO_SIG225_IN_SEL_S 7 +/* GPIO_FUNC225_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC225_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC225_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC225_IN_INV_SEL_V 0x1 +#define GPIO_FUNC225_IN_INV_SEL_S 6 +/* GPIO_FUNC225_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC225_IN_SEL 0x0000003F +#define GPIO_FUNC225_IN_SEL_M ((GPIO_FUNC225_IN_SEL_V)<<(GPIO_FUNC225_IN_SEL_S)) +#define GPIO_FUNC225_IN_SEL_V 0x3F +#define GPIO_FUNC225_IN_SEL_S 0 + +#define GPIO_FUNC226_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4DC) +/* GPIO_SIG226_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG226_IN_SEL (BIT(7)) +#define GPIO_SIG226_IN_SEL_M (BIT(7)) +#define GPIO_SIG226_IN_SEL_V 0x1 +#define GPIO_SIG226_IN_SEL_S 7 +/* GPIO_FUNC226_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC226_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC226_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC226_IN_INV_SEL_V 0x1 +#define GPIO_FUNC226_IN_INV_SEL_S 6 +/* GPIO_FUNC226_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC226_IN_SEL 0x0000003F +#define GPIO_FUNC226_IN_SEL_M ((GPIO_FUNC226_IN_SEL_V)<<(GPIO_FUNC226_IN_SEL_S)) +#define GPIO_FUNC226_IN_SEL_V 0x3F +#define GPIO_FUNC226_IN_SEL_S 0 + +#define GPIO_FUNC227_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4E0) +/* GPIO_SIG227_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG227_IN_SEL (BIT(7)) +#define GPIO_SIG227_IN_SEL_M (BIT(7)) +#define GPIO_SIG227_IN_SEL_V 0x1 +#define GPIO_SIG227_IN_SEL_S 7 +/* GPIO_FUNC227_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC227_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC227_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC227_IN_INV_SEL_V 0x1 +#define GPIO_FUNC227_IN_INV_SEL_S 6 +/* GPIO_FUNC227_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC227_IN_SEL 0x0000003F +#define GPIO_FUNC227_IN_SEL_M ((GPIO_FUNC227_IN_SEL_V)<<(GPIO_FUNC227_IN_SEL_S)) +#define GPIO_FUNC227_IN_SEL_V 0x3F +#define GPIO_FUNC227_IN_SEL_S 0 + +#define GPIO_FUNC228_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4E4) +/* GPIO_SIG228_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG228_IN_SEL (BIT(7)) +#define GPIO_SIG228_IN_SEL_M (BIT(7)) +#define GPIO_SIG228_IN_SEL_V 0x1 +#define GPIO_SIG228_IN_SEL_S 7 +/* GPIO_FUNC228_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC228_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC228_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC228_IN_INV_SEL_V 0x1 +#define GPIO_FUNC228_IN_INV_SEL_S 6 +/* GPIO_FUNC228_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC228_IN_SEL 0x0000003F +#define GPIO_FUNC228_IN_SEL_M ((GPIO_FUNC228_IN_SEL_V)<<(GPIO_FUNC228_IN_SEL_S)) +#define GPIO_FUNC228_IN_SEL_V 0x3F +#define GPIO_FUNC228_IN_SEL_S 0 + +#define GPIO_FUNC229_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4E8) +/* GPIO_SIG229_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG229_IN_SEL (BIT(7)) +#define GPIO_SIG229_IN_SEL_M (BIT(7)) +#define GPIO_SIG229_IN_SEL_V 0x1 +#define GPIO_SIG229_IN_SEL_S 7 +/* GPIO_FUNC229_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC229_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC229_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC229_IN_INV_SEL_V 0x1 +#define GPIO_FUNC229_IN_INV_SEL_S 6 +/* GPIO_FUNC229_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC229_IN_SEL 0x0000003F +#define GPIO_FUNC229_IN_SEL_M ((GPIO_FUNC229_IN_SEL_V)<<(GPIO_FUNC229_IN_SEL_S)) +#define GPIO_FUNC229_IN_SEL_V 0x3F +#define GPIO_FUNC229_IN_SEL_S 0 + +#define GPIO_FUNC230_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4EC) +/* GPIO_SIG230_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG230_IN_SEL (BIT(7)) +#define GPIO_SIG230_IN_SEL_M (BIT(7)) +#define GPIO_SIG230_IN_SEL_V 0x1 +#define GPIO_SIG230_IN_SEL_S 7 +/* GPIO_FUNC230_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC230_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC230_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC230_IN_INV_SEL_V 0x1 +#define GPIO_FUNC230_IN_INV_SEL_S 6 +/* GPIO_FUNC230_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC230_IN_SEL 0x0000003F +#define GPIO_FUNC230_IN_SEL_M ((GPIO_FUNC230_IN_SEL_V)<<(GPIO_FUNC230_IN_SEL_S)) +#define GPIO_FUNC230_IN_SEL_V 0x3F +#define GPIO_FUNC230_IN_SEL_S 0 + +#define GPIO_FUNC231_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4F0) +/* GPIO_SIG231_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG231_IN_SEL (BIT(7)) +#define GPIO_SIG231_IN_SEL_M (BIT(7)) +#define GPIO_SIG231_IN_SEL_V 0x1 +#define GPIO_SIG231_IN_SEL_S 7 +/* GPIO_FUNC231_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC231_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC231_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC231_IN_INV_SEL_V 0x1 +#define GPIO_FUNC231_IN_INV_SEL_S 6 +/* GPIO_FUNC231_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC231_IN_SEL 0x0000003F +#define GPIO_FUNC231_IN_SEL_M ((GPIO_FUNC231_IN_SEL_V)<<(GPIO_FUNC231_IN_SEL_S)) +#define GPIO_FUNC231_IN_SEL_V 0x3F +#define GPIO_FUNC231_IN_SEL_S 0 + +#define GPIO_FUNC232_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4F4) +/* GPIO_SIG232_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG232_IN_SEL (BIT(7)) +#define GPIO_SIG232_IN_SEL_M (BIT(7)) +#define GPIO_SIG232_IN_SEL_V 0x1 +#define GPIO_SIG232_IN_SEL_S 7 +/* GPIO_FUNC232_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC232_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC232_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC232_IN_INV_SEL_V 0x1 +#define GPIO_FUNC232_IN_INV_SEL_S 6 +/* GPIO_FUNC232_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC232_IN_SEL 0x0000003F +#define GPIO_FUNC232_IN_SEL_M ((GPIO_FUNC232_IN_SEL_V)<<(GPIO_FUNC232_IN_SEL_S)) +#define GPIO_FUNC232_IN_SEL_V 0x3F +#define GPIO_FUNC232_IN_SEL_S 0 + +#define GPIO_FUNC233_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4F8) +/* GPIO_SIG233_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG233_IN_SEL (BIT(7)) +#define GPIO_SIG233_IN_SEL_M (BIT(7)) +#define GPIO_SIG233_IN_SEL_V 0x1 +#define GPIO_SIG233_IN_SEL_S 7 +/* GPIO_FUNC233_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC233_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC233_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC233_IN_INV_SEL_V 0x1 +#define GPIO_FUNC233_IN_INV_SEL_S 6 +/* GPIO_FUNC233_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC233_IN_SEL 0x0000003F +#define GPIO_FUNC233_IN_SEL_M ((GPIO_FUNC233_IN_SEL_V)<<(GPIO_FUNC233_IN_SEL_S)) +#define GPIO_FUNC233_IN_SEL_V 0x3F +#define GPIO_FUNC233_IN_SEL_S 0 + +#define GPIO_FUNC234_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x4FC) +/* GPIO_SIG234_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG234_IN_SEL (BIT(7)) +#define GPIO_SIG234_IN_SEL_M (BIT(7)) +#define GPIO_SIG234_IN_SEL_V 0x1 +#define GPIO_SIG234_IN_SEL_S 7 +/* GPIO_FUNC234_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC234_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC234_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC234_IN_INV_SEL_V 0x1 +#define GPIO_FUNC234_IN_INV_SEL_S 6 +/* GPIO_FUNC234_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC234_IN_SEL 0x0000003F +#define GPIO_FUNC234_IN_SEL_M ((GPIO_FUNC234_IN_SEL_V)<<(GPIO_FUNC234_IN_SEL_S)) +#define GPIO_FUNC234_IN_SEL_V 0x3F +#define GPIO_FUNC234_IN_SEL_S 0 + +#define GPIO_FUNC235_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x500) +/* GPIO_SIG235_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG235_IN_SEL (BIT(7)) +#define GPIO_SIG235_IN_SEL_M (BIT(7)) +#define GPIO_SIG235_IN_SEL_V 0x1 +#define GPIO_SIG235_IN_SEL_S 7 +/* GPIO_FUNC235_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC235_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC235_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC235_IN_INV_SEL_V 0x1 +#define GPIO_FUNC235_IN_INV_SEL_S 6 +/* GPIO_FUNC235_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC235_IN_SEL 0x0000003F +#define GPIO_FUNC235_IN_SEL_M ((GPIO_FUNC235_IN_SEL_V)<<(GPIO_FUNC235_IN_SEL_S)) +#define GPIO_FUNC235_IN_SEL_V 0x3F +#define GPIO_FUNC235_IN_SEL_S 0 + +#define GPIO_FUNC236_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x504) +/* GPIO_SIG236_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG236_IN_SEL (BIT(7)) +#define GPIO_SIG236_IN_SEL_M (BIT(7)) +#define GPIO_SIG236_IN_SEL_V 0x1 +#define GPIO_SIG236_IN_SEL_S 7 +/* GPIO_FUNC236_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC236_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC236_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC236_IN_INV_SEL_V 0x1 +#define GPIO_FUNC236_IN_INV_SEL_S 6 +/* GPIO_FUNC236_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC236_IN_SEL 0x0000003F +#define GPIO_FUNC236_IN_SEL_M ((GPIO_FUNC236_IN_SEL_V)<<(GPIO_FUNC236_IN_SEL_S)) +#define GPIO_FUNC236_IN_SEL_V 0x3F +#define GPIO_FUNC236_IN_SEL_S 0 + +#define GPIO_FUNC237_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x508) +/* GPIO_SIG237_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG237_IN_SEL (BIT(7)) +#define GPIO_SIG237_IN_SEL_M (BIT(7)) +#define GPIO_SIG237_IN_SEL_V 0x1 +#define GPIO_SIG237_IN_SEL_S 7 +/* GPIO_FUNC237_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC237_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC237_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC237_IN_INV_SEL_V 0x1 +#define GPIO_FUNC237_IN_INV_SEL_S 6 +/* GPIO_FUNC237_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC237_IN_SEL 0x0000003F +#define GPIO_FUNC237_IN_SEL_M ((GPIO_FUNC237_IN_SEL_V)<<(GPIO_FUNC237_IN_SEL_S)) +#define GPIO_FUNC237_IN_SEL_V 0x3F +#define GPIO_FUNC237_IN_SEL_S 0 + +#define GPIO_FUNC238_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x50C) +/* GPIO_SIG238_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG238_IN_SEL (BIT(7)) +#define GPIO_SIG238_IN_SEL_M (BIT(7)) +#define GPIO_SIG238_IN_SEL_V 0x1 +#define GPIO_SIG238_IN_SEL_S 7 +/* GPIO_FUNC238_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC238_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC238_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC238_IN_INV_SEL_V 0x1 +#define GPIO_FUNC238_IN_INV_SEL_S 6 +/* GPIO_FUNC238_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC238_IN_SEL 0x0000003F +#define GPIO_FUNC238_IN_SEL_M ((GPIO_FUNC238_IN_SEL_V)<<(GPIO_FUNC238_IN_SEL_S)) +#define GPIO_FUNC238_IN_SEL_V 0x3F +#define GPIO_FUNC238_IN_SEL_S 0 + +#define GPIO_FUNC239_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x510) +/* GPIO_SIG239_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG239_IN_SEL (BIT(7)) +#define GPIO_SIG239_IN_SEL_M (BIT(7)) +#define GPIO_SIG239_IN_SEL_V 0x1 +#define GPIO_SIG239_IN_SEL_S 7 +/* GPIO_FUNC239_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC239_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC239_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC239_IN_INV_SEL_V 0x1 +#define GPIO_FUNC239_IN_INV_SEL_S 6 +/* GPIO_FUNC239_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC239_IN_SEL 0x0000003F +#define GPIO_FUNC239_IN_SEL_M ((GPIO_FUNC239_IN_SEL_V)<<(GPIO_FUNC239_IN_SEL_S)) +#define GPIO_FUNC239_IN_SEL_V 0x3F +#define GPIO_FUNC239_IN_SEL_S 0 + +#define GPIO_FUNC240_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x514) +/* GPIO_SIG240_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG240_IN_SEL (BIT(7)) +#define GPIO_SIG240_IN_SEL_M (BIT(7)) +#define GPIO_SIG240_IN_SEL_V 0x1 +#define GPIO_SIG240_IN_SEL_S 7 +/* GPIO_FUNC240_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC240_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC240_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC240_IN_INV_SEL_V 0x1 +#define GPIO_FUNC240_IN_INV_SEL_S 6 +/* GPIO_FUNC240_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC240_IN_SEL 0x0000003F +#define GPIO_FUNC240_IN_SEL_M ((GPIO_FUNC240_IN_SEL_V)<<(GPIO_FUNC240_IN_SEL_S)) +#define GPIO_FUNC240_IN_SEL_V 0x3F +#define GPIO_FUNC240_IN_SEL_S 0 + +#define GPIO_FUNC241_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x518) +/* GPIO_SIG241_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG241_IN_SEL (BIT(7)) +#define GPIO_SIG241_IN_SEL_M (BIT(7)) +#define GPIO_SIG241_IN_SEL_V 0x1 +#define GPIO_SIG241_IN_SEL_S 7 +/* GPIO_FUNC241_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC241_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC241_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC241_IN_INV_SEL_V 0x1 +#define GPIO_FUNC241_IN_INV_SEL_S 6 +/* GPIO_FUNC241_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC241_IN_SEL 0x0000003F +#define GPIO_FUNC241_IN_SEL_M ((GPIO_FUNC241_IN_SEL_V)<<(GPIO_FUNC241_IN_SEL_S)) +#define GPIO_FUNC241_IN_SEL_V 0x3F +#define GPIO_FUNC241_IN_SEL_S 0 + +#define GPIO_FUNC242_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x51C) +/* GPIO_SIG242_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG242_IN_SEL (BIT(7)) +#define GPIO_SIG242_IN_SEL_M (BIT(7)) +#define GPIO_SIG242_IN_SEL_V 0x1 +#define GPIO_SIG242_IN_SEL_S 7 +/* GPIO_FUNC242_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC242_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC242_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC242_IN_INV_SEL_V 0x1 +#define GPIO_FUNC242_IN_INV_SEL_S 6 +/* GPIO_FUNC242_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC242_IN_SEL 0x0000003F +#define GPIO_FUNC242_IN_SEL_M ((GPIO_FUNC242_IN_SEL_V)<<(GPIO_FUNC242_IN_SEL_S)) +#define GPIO_FUNC242_IN_SEL_V 0x3F +#define GPIO_FUNC242_IN_SEL_S 0 + +#define GPIO_FUNC243_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x520) +/* GPIO_SIG243_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG243_IN_SEL (BIT(7)) +#define GPIO_SIG243_IN_SEL_M (BIT(7)) +#define GPIO_SIG243_IN_SEL_V 0x1 +#define GPIO_SIG243_IN_SEL_S 7 +/* GPIO_FUNC243_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC243_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC243_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC243_IN_INV_SEL_V 0x1 +#define GPIO_FUNC243_IN_INV_SEL_S 6 +/* GPIO_FUNC243_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC243_IN_SEL 0x0000003F +#define GPIO_FUNC243_IN_SEL_M ((GPIO_FUNC243_IN_SEL_V)<<(GPIO_FUNC243_IN_SEL_S)) +#define GPIO_FUNC243_IN_SEL_V 0x3F +#define GPIO_FUNC243_IN_SEL_S 0 + +#define GPIO_FUNC244_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x524) +/* GPIO_SIG244_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG244_IN_SEL (BIT(7)) +#define GPIO_SIG244_IN_SEL_M (BIT(7)) +#define GPIO_SIG244_IN_SEL_V 0x1 +#define GPIO_SIG244_IN_SEL_S 7 +/* GPIO_FUNC244_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC244_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC244_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC244_IN_INV_SEL_V 0x1 +#define GPIO_FUNC244_IN_INV_SEL_S 6 +/* GPIO_FUNC244_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC244_IN_SEL 0x0000003F +#define GPIO_FUNC244_IN_SEL_M ((GPIO_FUNC244_IN_SEL_V)<<(GPIO_FUNC244_IN_SEL_S)) +#define GPIO_FUNC244_IN_SEL_V 0x3F +#define GPIO_FUNC244_IN_SEL_S 0 + +#define GPIO_FUNC245_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x528) +/* GPIO_SIG245_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG245_IN_SEL (BIT(7)) +#define GPIO_SIG245_IN_SEL_M (BIT(7)) +#define GPIO_SIG245_IN_SEL_V 0x1 +#define GPIO_SIG245_IN_SEL_S 7 +/* GPIO_FUNC245_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC245_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC245_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC245_IN_INV_SEL_V 0x1 +#define GPIO_FUNC245_IN_INV_SEL_S 6 +/* GPIO_FUNC245_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC245_IN_SEL 0x0000003F +#define GPIO_FUNC245_IN_SEL_M ((GPIO_FUNC245_IN_SEL_V)<<(GPIO_FUNC245_IN_SEL_S)) +#define GPIO_FUNC245_IN_SEL_V 0x3F +#define GPIO_FUNC245_IN_SEL_S 0 + +#define GPIO_FUNC246_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x52C) +/* GPIO_SIG246_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG246_IN_SEL (BIT(7)) +#define GPIO_SIG246_IN_SEL_M (BIT(7)) +#define GPIO_SIG246_IN_SEL_V 0x1 +#define GPIO_SIG246_IN_SEL_S 7 +/* GPIO_FUNC246_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC246_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC246_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC246_IN_INV_SEL_V 0x1 +#define GPIO_FUNC246_IN_INV_SEL_S 6 +/* GPIO_FUNC246_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC246_IN_SEL 0x0000003F +#define GPIO_FUNC246_IN_SEL_M ((GPIO_FUNC246_IN_SEL_V)<<(GPIO_FUNC246_IN_SEL_S)) +#define GPIO_FUNC246_IN_SEL_V 0x3F +#define GPIO_FUNC246_IN_SEL_S 0 + +#define GPIO_FUNC247_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x530) +/* GPIO_SIG247_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG247_IN_SEL (BIT(7)) +#define GPIO_SIG247_IN_SEL_M (BIT(7)) +#define GPIO_SIG247_IN_SEL_V 0x1 +#define GPIO_SIG247_IN_SEL_S 7 +/* GPIO_FUNC247_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC247_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC247_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC247_IN_INV_SEL_V 0x1 +#define GPIO_FUNC247_IN_INV_SEL_S 6 +/* GPIO_FUNC247_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC247_IN_SEL 0x0000003F +#define GPIO_FUNC247_IN_SEL_M ((GPIO_FUNC247_IN_SEL_V)<<(GPIO_FUNC247_IN_SEL_S)) +#define GPIO_FUNC247_IN_SEL_V 0x3F +#define GPIO_FUNC247_IN_SEL_S 0 + +#define GPIO_FUNC248_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x534) +/* GPIO_SIG248_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG248_IN_SEL (BIT(7)) +#define GPIO_SIG248_IN_SEL_M (BIT(7)) +#define GPIO_SIG248_IN_SEL_V 0x1 +#define GPIO_SIG248_IN_SEL_S 7 +/* GPIO_FUNC248_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC248_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC248_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC248_IN_INV_SEL_V 0x1 +#define GPIO_FUNC248_IN_INV_SEL_S 6 +/* GPIO_FUNC248_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC248_IN_SEL 0x0000003F +#define GPIO_FUNC248_IN_SEL_M ((GPIO_FUNC248_IN_SEL_V)<<(GPIO_FUNC248_IN_SEL_S)) +#define GPIO_FUNC248_IN_SEL_V 0x3F +#define GPIO_FUNC248_IN_SEL_S 0 + +#define GPIO_FUNC249_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x538) +/* GPIO_SIG249_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG249_IN_SEL (BIT(7)) +#define GPIO_SIG249_IN_SEL_M (BIT(7)) +#define GPIO_SIG249_IN_SEL_V 0x1 +#define GPIO_SIG249_IN_SEL_S 7 +/* GPIO_FUNC249_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC249_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC249_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC249_IN_INV_SEL_V 0x1 +#define GPIO_FUNC249_IN_INV_SEL_S 6 +/* GPIO_FUNC249_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC249_IN_SEL 0x0000003F +#define GPIO_FUNC249_IN_SEL_M ((GPIO_FUNC249_IN_SEL_V)<<(GPIO_FUNC249_IN_SEL_S)) +#define GPIO_FUNC249_IN_SEL_V 0x3F +#define GPIO_FUNC249_IN_SEL_S 0 + +#define GPIO_FUNC250_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x53C) +/* GPIO_SIG250_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG250_IN_SEL (BIT(7)) +#define GPIO_SIG250_IN_SEL_M (BIT(7)) +#define GPIO_SIG250_IN_SEL_V 0x1 +#define GPIO_SIG250_IN_SEL_S 7 +/* GPIO_FUNC250_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC250_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC250_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC250_IN_INV_SEL_V 0x1 +#define GPIO_FUNC250_IN_INV_SEL_S 6 +/* GPIO_FUNC250_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC250_IN_SEL 0x0000003F +#define GPIO_FUNC250_IN_SEL_M ((GPIO_FUNC250_IN_SEL_V)<<(GPIO_FUNC250_IN_SEL_S)) +#define GPIO_FUNC250_IN_SEL_V 0x3F +#define GPIO_FUNC250_IN_SEL_S 0 + +#define GPIO_FUNC251_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x540) +/* GPIO_SIG251_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG251_IN_SEL (BIT(7)) +#define GPIO_SIG251_IN_SEL_M (BIT(7)) +#define GPIO_SIG251_IN_SEL_V 0x1 +#define GPIO_SIG251_IN_SEL_S 7 +/* GPIO_FUNC251_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC251_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC251_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC251_IN_INV_SEL_V 0x1 +#define GPIO_FUNC251_IN_INV_SEL_S 6 +/* GPIO_FUNC251_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC251_IN_SEL 0x0000003F +#define GPIO_FUNC251_IN_SEL_M ((GPIO_FUNC251_IN_SEL_V)<<(GPIO_FUNC251_IN_SEL_S)) +#define GPIO_FUNC251_IN_SEL_V 0x3F +#define GPIO_FUNC251_IN_SEL_S 0 + +#define GPIO_FUNC252_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x544) +/* GPIO_SIG252_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG252_IN_SEL (BIT(7)) +#define GPIO_SIG252_IN_SEL_M (BIT(7)) +#define GPIO_SIG252_IN_SEL_V 0x1 +#define GPIO_SIG252_IN_SEL_S 7 +/* GPIO_FUNC252_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC252_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC252_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC252_IN_INV_SEL_V 0x1 +#define GPIO_FUNC252_IN_INV_SEL_S 6 +/* GPIO_FUNC252_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC252_IN_SEL 0x0000003F +#define GPIO_FUNC252_IN_SEL_M ((GPIO_FUNC252_IN_SEL_V)<<(GPIO_FUNC252_IN_SEL_S)) +#define GPIO_FUNC252_IN_SEL_V 0x3F +#define GPIO_FUNC252_IN_SEL_S 0 + +#define GPIO_FUNC253_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x548) +/* GPIO_SIG253_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG253_IN_SEL (BIT(7)) +#define GPIO_SIG253_IN_SEL_M (BIT(7)) +#define GPIO_SIG253_IN_SEL_V 0x1 +#define GPIO_SIG253_IN_SEL_S 7 +/* GPIO_FUNC253_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC253_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC253_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC253_IN_INV_SEL_V 0x1 +#define GPIO_FUNC253_IN_INV_SEL_S 6 +/* GPIO_FUNC253_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC253_IN_SEL 0x0000003F +#define GPIO_FUNC253_IN_SEL_M ((GPIO_FUNC253_IN_SEL_V)<<(GPIO_FUNC253_IN_SEL_S)) +#define GPIO_FUNC253_IN_SEL_V 0x3F +#define GPIO_FUNC253_IN_SEL_S 0 + +#define GPIO_FUNC254_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x54C) +/* GPIO_SIG254_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG254_IN_SEL (BIT(7)) +#define GPIO_SIG254_IN_SEL_M (BIT(7)) +#define GPIO_SIG254_IN_SEL_V 0x1 +#define GPIO_SIG254_IN_SEL_S 7 +/* GPIO_FUNC254_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC254_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC254_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC254_IN_INV_SEL_V 0x1 +#define GPIO_FUNC254_IN_INV_SEL_S 6 +/* GPIO_FUNC254_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC254_IN_SEL 0x0000003F +#define GPIO_FUNC254_IN_SEL_M ((GPIO_FUNC254_IN_SEL_V)<<(GPIO_FUNC254_IN_SEL_S)) +#define GPIO_FUNC254_IN_SEL_V 0x3F +#define GPIO_FUNC254_IN_SEL_S 0 + +#define GPIO_FUNC255_IN_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x550) +/* GPIO_SIG255_IN_SEL : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SIG255_IN_SEL (BIT(7)) +#define GPIO_SIG255_IN_SEL_M (BIT(7)) +#define GPIO_SIG255_IN_SEL_V 0x1 +#define GPIO_SIG255_IN_SEL_S 7 +/* GPIO_FUNC255_IN_INV_SEL : R/W ;bitpos:[6] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC255_IN_INV_SEL (BIT(6)) +#define GPIO_FUNC255_IN_INV_SEL_M (BIT(6)) +#define GPIO_FUNC255_IN_INV_SEL_V 0x1 +#define GPIO_FUNC255_IN_INV_SEL_S 6 +/* GPIO_FUNC255_IN_SEL : R/W ;bitpos:[5:0] ;default: 6'h0 ; */ +/*description: */ +#define GPIO_FUNC255_IN_SEL 0x0000003F +#define GPIO_FUNC255_IN_SEL_M ((GPIO_FUNC255_IN_SEL_V)<<(GPIO_FUNC255_IN_SEL_S)) +#define GPIO_FUNC255_IN_SEL_V 0x3F +#define GPIO_FUNC255_IN_SEL_S 0 + +#define GPIO_FUNC0_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x554) +/* GPIO_FUNC0_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC0_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC0_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC0_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC0_OEN_INV_SEL_S 11 +/* GPIO_FUNC0_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC0_OEN_SEL (BIT(10)) +#define GPIO_FUNC0_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC0_OEN_SEL_V 0x1 +#define GPIO_FUNC0_OEN_SEL_S 10 +/* GPIO_FUNC0_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC0_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC0_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC0_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC0_OUT_INV_SEL_S 9 +/* GPIO_FUNC0_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC0_OUT_SEL 0x000001FF +#define GPIO_FUNC0_OUT_SEL_M ((GPIO_FUNC0_OUT_SEL_V)<<(GPIO_FUNC0_OUT_SEL_S)) +#define GPIO_FUNC0_OUT_SEL_V 0x1FF +#define GPIO_FUNC0_OUT_SEL_S 0 + +#define GPIO_FUNC1_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x558) +/* GPIO_FUNC1_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC1_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC1_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC1_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC1_OEN_INV_SEL_S 11 +/* GPIO_FUNC1_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC1_OEN_SEL (BIT(10)) +#define GPIO_FUNC1_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC1_OEN_SEL_V 0x1 +#define GPIO_FUNC1_OEN_SEL_S 10 +/* GPIO_FUNC1_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC1_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC1_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC1_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC1_OUT_INV_SEL_S 9 +/* GPIO_FUNC1_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC1_OUT_SEL 0x000001FF +#define GPIO_FUNC1_OUT_SEL_M ((GPIO_FUNC1_OUT_SEL_V)<<(GPIO_FUNC1_OUT_SEL_S)) +#define GPIO_FUNC1_OUT_SEL_V 0x1FF +#define GPIO_FUNC1_OUT_SEL_S 0 + +#define GPIO_FUNC2_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x55C) +/* GPIO_FUNC2_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC2_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC2_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC2_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC2_OEN_INV_SEL_S 11 +/* GPIO_FUNC2_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC2_OEN_SEL (BIT(10)) +#define GPIO_FUNC2_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC2_OEN_SEL_V 0x1 +#define GPIO_FUNC2_OEN_SEL_S 10 +/* GPIO_FUNC2_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC2_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC2_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC2_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC2_OUT_INV_SEL_S 9 +/* GPIO_FUNC2_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC2_OUT_SEL 0x000001FF +#define GPIO_FUNC2_OUT_SEL_M ((GPIO_FUNC2_OUT_SEL_V)<<(GPIO_FUNC2_OUT_SEL_S)) +#define GPIO_FUNC2_OUT_SEL_V 0x1FF +#define GPIO_FUNC2_OUT_SEL_S 0 + +#define GPIO_FUNC3_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x560) +/* GPIO_FUNC3_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC3_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC3_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC3_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC3_OEN_INV_SEL_S 11 +/* GPIO_FUNC3_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC3_OEN_SEL (BIT(10)) +#define GPIO_FUNC3_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC3_OEN_SEL_V 0x1 +#define GPIO_FUNC3_OEN_SEL_S 10 +/* GPIO_FUNC3_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC3_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC3_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC3_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC3_OUT_INV_SEL_S 9 +/* GPIO_FUNC3_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC3_OUT_SEL 0x000001FF +#define GPIO_FUNC3_OUT_SEL_M ((GPIO_FUNC3_OUT_SEL_V)<<(GPIO_FUNC3_OUT_SEL_S)) +#define GPIO_FUNC3_OUT_SEL_V 0x1FF +#define GPIO_FUNC3_OUT_SEL_S 0 + +#define GPIO_FUNC4_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x564) +/* GPIO_FUNC4_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC4_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC4_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC4_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC4_OEN_INV_SEL_S 11 +/* GPIO_FUNC4_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC4_OEN_SEL (BIT(10)) +#define GPIO_FUNC4_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC4_OEN_SEL_V 0x1 +#define GPIO_FUNC4_OEN_SEL_S 10 +/* GPIO_FUNC4_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC4_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC4_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC4_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC4_OUT_INV_SEL_S 9 +/* GPIO_FUNC4_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC4_OUT_SEL 0x000001FF +#define GPIO_FUNC4_OUT_SEL_M ((GPIO_FUNC4_OUT_SEL_V)<<(GPIO_FUNC4_OUT_SEL_S)) +#define GPIO_FUNC4_OUT_SEL_V 0x1FF +#define GPIO_FUNC4_OUT_SEL_S 0 + +#define GPIO_FUNC5_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x568) +/* GPIO_FUNC5_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC5_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC5_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC5_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC5_OEN_INV_SEL_S 11 +/* GPIO_FUNC5_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC5_OEN_SEL (BIT(10)) +#define GPIO_FUNC5_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC5_OEN_SEL_V 0x1 +#define GPIO_FUNC5_OEN_SEL_S 10 +/* GPIO_FUNC5_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC5_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC5_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC5_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC5_OUT_INV_SEL_S 9 +/* GPIO_FUNC5_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC5_OUT_SEL 0x000001FF +#define GPIO_FUNC5_OUT_SEL_M ((GPIO_FUNC5_OUT_SEL_V)<<(GPIO_FUNC5_OUT_SEL_S)) +#define GPIO_FUNC5_OUT_SEL_V 0x1FF +#define GPIO_FUNC5_OUT_SEL_S 0 + +#define GPIO_FUNC6_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x56C) +/* GPIO_FUNC6_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC6_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC6_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC6_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC6_OEN_INV_SEL_S 11 +/* GPIO_FUNC6_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC6_OEN_SEL (BIT(10)) +#define GPIO_FUNC6_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC6_OEN_SEL_V 0x1 +#define GPIO_FUNC6_OEN_SEL_S 10 +/* GPIO_FUNC6_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC6_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC6_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC6_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC6_OUT_INV_SEL_S 9 +/* GPIO_FUNC6_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC6_OUT_SEL 0x000001FF +#define GPIO_FUNC6_OUT_SEL_M ((GPIO_FUNC6_OUT_SEL_V)<<(GPIO_FUNC6_OUT_SEL_S)) +#define GPIO_FUNC6_OUT_SEL_V 0x1FF +#define GPIO_FUNC6_OUT_SEL_S 0 + +#define GPIO_FUNC7_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x570) +/* GPIO_FUNC7_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC7_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC7_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC7_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC7_OEN_INV_SEL_S 11 +/* GPIO_FUNC7_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC7_OEN_SEL (BIT(10)) +#define GPIO_FUNC7_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC7_OEN_SEL_V 0x1 +#define GPIO_FUNC7_OEN_SEL_S 10 +/* GPIO_FUNC7_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC7_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC7_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC7_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC7_OUT_INV_SEL_S 9 +/* GPIO_FUNC7_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC7_OUT_SEL 0x000001FF +#define GPIO_FUNC7_OUT_SEL_M ((GPIO_FUNC7_OUT_SEL_V)<<(GPIO_FUNC7_OUT_SEL_S)) +#define GPIO_FUNC7_OUT_SEL_V 0x1FF +#define GPIO_FUNC7_OUT_SEL_S 0 + +#define GPIO_FUNC8_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x574) +/* GPIO_FUNC8_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC8_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC8_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC8_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC8_OEN_INV_SEL_S 11 +/* GPIO_FUNC8_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC8_OEN_SEL (BIT(10)) +#define GPIO_FUNC8_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC8_OEN_SEL_V 0x1 +#define GPIO_FUNC8_OEN_SEL_S 10 +/* GPIO_FUNC8_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC8_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC8_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC8_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC8_OUT_INV_SEL_S 9 +/* GPIO_FUNC8_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC8_OUT_SEL 0x000001FF +#define GPIO_FUNC8_OUT_SEL_M ((GPIO_FUNC8_OUT_SEL_V)<<(GPIO_FUNC8_OUT_SEL_S)) +#define GPIO_FUNC8_OUT_SEL_V 0x1FF +#define GPIO_FUNC8_OUT_SEL_S 0 + +#define GPIO_FUNC9_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x578) +/* GPIO_FUNC9_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC9_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC9_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC9_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC9_OEN_INV_SEL_S 11 +/* GPIO_FUNC9_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC9_OEN_SEL (BIT(10)) +#define GPIO_FUNC9_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC9_OEN_SEL_V 0x1 +#define GPIO_FUNC9_OEN_SEL_S 10 +/* GPIO_FUNC9_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC9_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC9_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC9_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC9_OUT_INV_SEL_S 9 +/* GPIO_FUNC9_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC9_OUT_SEL 0x000001FF +#define GPIO_FUNC9_OUT_SEL_M ((GPIO_FUNC9_OUT_SEL_V)<<(GPIO_FUNC9_OUT_SEL_S)) +#define GPIO_FUNC9_OUT_SEL_V 0x1FF +#define GPIO_FUNC9_OUT_SEL_S 0 + +#define GPIO_FUNC10_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x57C) +/* GPIO_FUNC10_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC10_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC10_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC10_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC10_OEN_INV_SEL_S 11 +/* GPIO_FUNC10_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC10_OEN_SEL (BIT(10)) +#define GPIO_FUNC10_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC10_OEN_SEL_V 0x1 +#define GPIO_FUNC10_OEN_SEL_S 10 +/* GPIO_FUNC10_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC10_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC10_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC10_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC10_OUT_INV_SEL_S 9 +/* GPIO_FUNC10_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC10_OUT_SEL 0x000001FF +#define GPIO_FUNC10_OUT_SEL_M ((GPIO_FUNC10_OUT_SEL_V)<<(GPIO_FUNC10_OUT_SEL_S)) +#define GPIO_FUNC10_OUT_SEL_V 0x1FF +#define GPIO_FUNC10_OUT_SEL_S 0 + +#define GPIO_FUNC11_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x580) +/* GPIO_FUNC11_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC11_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC11_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC11_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC11_OEN_INV_SEL_S 11 +/* GPIO_FUNC11_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC11_OEN_SEL (BIT(10)) +#define GPIO_FUNC11_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC11_OEN_SEL_V 0x1 +#define GPIO_FUNC11_OEN_SEL_S 10 +/* GPIO_FUNC11_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC11_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC11_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC11_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC11_OUT_INV_SEL_S 9 +/* GPIO_FUNC11_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC11_OUT_SEL 0x000001FF +#define GPIO_FUNC11_OUT_SEL_M ((GPIO_FUNC11_OUT_SEL_V)<<(GPIO_FUNC11_OUT_SEL_S)) +#define GPIO_FUNC11_OUT_SEL_V 0x1FF +#define GPIO_FUNC11_OUT_SEL_S 0 + +#define GPIO_FUNC12_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x584) +/* GPIO_FUNC12_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC12_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC12_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC12_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC12_OEN_INV_SEL_S 11 +/* GPIO_FUNC12_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC12_OEN_SEL (BIT(10)) +#define GPIO_FUNC12_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC12_OEN_SEL_V 0x1 +#define GPIO_FUNC12_OEN_SEL_S 10 +/* GPIO_FUNC12_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC12_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC12_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC12_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC12_OUT_INV_SEL_S 9 +/* GPIO_FUNC12_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC12_OUT_SEL 0x000001FF +#define GPIO_FUNC12_OUT_SEL_M ((GPIO_FUNC12_OUT_SEL_V)<<(GPIO_FUNC12_OUT_SEL_S)) +#define GPIO_FUNC12_OUT_SEL_V 0x1FF +#define GPIO_FUNC12_OUT_SEL_S 0 + +#define GPIO_FUNC13_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x588) +/* GPIO_FUNC13_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC13_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC13_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC13_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC13_OEN_INV_SEL_S 11 +/* GPIO_FUNC13_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC13_OEN_SEL (BIT(10)) +#define GPIO_FUNC13_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC13_OEN_SEL_V 0x1 +#define GPIO_FUNC13_OEN_SEL_S 10 +/* GPIO_FUNC13_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC13_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC13_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC13_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC13_OUT_INV_SEL_S 9 +/* GPIO_FUNC13_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC13_OUT_SEL 0x000001FF +#define GPIO_FUNC13_OUT_SEL_M ((GPIO_FUNC13_OUT_SEL_V)<<(GPIO_FUNC13_OUT_SEL_S)) +#define GPIO_FUNC13_OUT_SEL_V 0x1FF +#define GPIO_FUNC13_OUT_SEL_S 0 + +#define GPIO_FUNC14_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x58C) +/* GPIO_FUNC14_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC14_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC14_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC14_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC14_OEN_INV_SEL_S 11 +/* GPIO_FUNC14_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC14_OEN_SEL (BIT(10)) +#define GPIO_FUNC14_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC14_OEN_SEL_V 0x1 +#define GPIO_FUNC14_OEN_SEL_S 10 +/* GPIO_FUNC14_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC14_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC14_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC14_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC14_OUT_INV_SEL_S 9 +/* GPIO_FUNC14_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC14_OUT_SEL 0x000001FF +#define GPIO_FUNC14_OUT_SEL_M ((GPIO_FUNC14_OUT_SEL_V)<<(GPIO_FUNC14_OUT_SEL_S)) +#define GPIO_FUNC14_OUT_SEL_V 0x1FF +#define GPIO_FUNC14_OUT_SEL_S 0 + +#define GPIO_FUNC15_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x590) +/* GPIO_FUNC15_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC15_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC15_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC15_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC15_OEN_INV_SEL_S 11 +/* GPIO_FUNC15_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC15_OEN_SEL (BIT(10)) +#define GPIO_FUNC15_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC15_OEN_SEL_V 0x1 +#define GPIO_FUNC15_OEN_SEL_S 10 +/* GPIO_FUNC15_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC15_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC15_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC15_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC15_OUT_INV_SEL_S 9 +/* GPIO_FUNC15_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC15_OUT_SEL 0x000001FF +#define GPIO_FUNC15_OUT_SEL_M ((GPIO_FUNC15_OUT_SEL_V)<<(GPIO_FUNC15_OUT_SEL_S)) +#define GPIO_FUNC15_OUT_SEL_V 0x1FF +#define GPIO_FUNC15_OUT_SEL_S 0 + +#define GPIO_FUNC16_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x594) +/* GPIO_FUNC16_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC16_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC16_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC16_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC16_OEN_INV_SEL_S 11 +/* GPIO_FUNC16_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC16_OEN_SEL (BIT(10)) +#define GPIO_FUNC16_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC16_OEN_SEL_V 0x1 +#define GPIO_FUNC16_OEN_SEL_S 10 +/* GPIO_FUNC16_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC16_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC16_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC16_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC16_OUT_INV_SEL_S 9 +/* GPIO_FUNC16_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC16_OUT_SEL 0x000001FF +#define GPIO_FUNC16_OUT_SEL_M ((GPIO_FUNC16_OUT_SEL_V)<<(GPIO_FUNC16_OUT_SEL_S)) +#define GPIO_FUNC16_OUT_SEL_V 0x1FF +#define GPIO_FUNC16_OUT_SEL_S 0 + +#define GPIO_FUNC17_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x598) +/* GPIO_FUNC17_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC17_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC17_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC17_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC17_OEN_INV_SEL_S 11 +/* GPIO_FUNC17_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC17_OEN_SEL (BIT(10)) +#define GPIO_FUNC17_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC17_OEN_SEL_V 0x1 +#define GPIO_FUNC17_OEN_SEL_S 10 +/* GPIO_FUNC17_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC17_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC17_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC17_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC17_OUT_INV_SEL_S 9 +/* GPIO_FUNC17_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC17_OUT_SEL 0x000001FF +#define GPIO_FUNC17_OUT_SEL_M ((GPIO_FUNC17_OUT_SEL_V)<<(GPIO_FUNC17_OUT_SEL_S)) +#define GPIO_FUNC17_OUT_SEL_V 0x1FF +#define GPIO_FUNC17_OUT_SEL_S 0 + +#define GPIO_FUNC18_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x59C) +/* GPIO_FUNC18_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC18_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC18_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC18_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC18_OEN_INV_SEL_S 11 +/* GPIO_FUNC18_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC18_OEN_SEL (BIT(10)) +#define GPIO_FUNC18_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC18_OEN_SEL_V 0x1 +#define GPIO_FUNC18_OEN_SEL_S 10 +/* GPIO_FUNC18_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC18_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC18_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC18_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC18_OUT_INV_SEL_S 9 +/* GPIO_FUNC18_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC18_OUT_SEL 0x000001FF +#define GPIO_FUNC18_OUT_SEL_M ((GPIO_FUNC18_OUT_SEL_V)<<(GPIO_FUNC18_OUT_SEL_S)) +#define GPIO_FUNC18_OUT_SEL_V 0x1FF +#define GPIO_FUNC18_OUT_SEL_S 0 + +#define GPIO_FUNC19_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5A0) +/* GPIO_FUNC19_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC19_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC19_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC19_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC19_OEN_INV_SEL_S 11 +/* GPIO_FUNC19_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC19_OEN_SEL (BIT(10)) +#define GPIO_FUNC19_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC19_OEN_SEL_V 0x1 +#define GPIO_FUNC19_OEN_SEL_S 10 +/* GPIO_FUNC19_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC19_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC19_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC19_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC19_OUT_INV_SEL_S 9 +/* GPIO_FUNC19_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC19_OUT_SEL 0x000001FF +#define GPIO_FUNC19_OUT_SEL_M ((GPIO_FUNC19_OUT_SEL_V)<<(GPIO_FUNC19_OUT_SEL_S)) +#define GPIO_FUNC19_OUT_SEL_V 0x1FF +#define GPIO_FUNC19_OUT_SEL_S 0 + +#define GPIO_FUNC20_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5A4) +/* GPIO_FUNC20_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC20_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC20_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC20_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC20_OEN_INV_SEL_S 11 +/* GPIO_FUNC20_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC20_OEN_SEL (BIT(10)) +#define GPIO_FUNC20_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC20_OEN_SEL_V 0x1 +#define GPIO_FUNC20_OEN_SEL_S 10 +/* GPIO_FUNC20_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC20_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC20_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC20_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC20_OUT_INV_SEL_S 9 +/* GPIO_FUNC20_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC20_OUT_SEL 0x000001FF +#define GPIO_FUNC20_OUT_SEL_M ((GPIO_FUNC20_OUT_SEL_V)<<(GPIO_FUNC20_OUT_SEL_S)) +#define GPIO_FUNC20_OUT_SEL_V 0x1FF +#define GPIO_FUNC20_OUT_SEL_S 0 + +#define GPIO_FUNC21_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5A8) +/* GPIO_FUNC21_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC21_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC21_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC21_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC21_OEN_INV_SEL_S 11 +/* GPIO_FUNC21_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC21_OEN_SEL (BIT(10)) +#define GPIO_FUNC21_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC21_OEN_SEL_V 0x1 +#define GPIO_FUNC21_OEN_SEL_S 10 +/* GPIO_FUNC21_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC21_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC21_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC21_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC21_OUT_INV_SEL_S 9 +/* GPIO_FUNC21_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC21_OUT_SEL 0x000001FF +#define GPIO_FUNC21_OUT_SEL_M ((GPIO_FUNC21_OUT_SEL_V)<<(GPIO_FUNC21_OUT_SEL_S)) +#define GPIO_FUNC21_OUT_SEL_V 0x1FF +#define GPIO_FUNC21_OUT_SEL_S 0 + +#define GPIO_FUNC22_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5AC) +/* GPIO_FUNC22_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC22_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC22_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC22_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC22_OEN_INV_SEL_S 11 +/* GPIO_FUNC22_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC22_OEN_SEL (BIT(10)) +#define GPIO_FUNC22_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC22_OEN_SEL_V 0x1 +#define GPIO_FUNC22_OEN_SEL_S 10 +/* GPIO_FUNC22_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC22_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC22_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC22_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC22_OUT_INV_SEL_S 9 +/* GPIO_FUNC22_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC22_OUT_SEL 0x000001FF +#define GPIO_FUNC22_OUT_SEL_M ((GPIO_FUNC22_OUT_SEL_V)<<(GPIO_FUNC22_OUT_SEL_S)) +#define GPIO_FUNC22_OUT_SEL_V 0x1FF +#define GPIO_FUNC22_OUT_SEL_S 0 + +#define GPIO_FUNC23_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5B0) +/* GPIO_FUNC23_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC23_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC23_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC23_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC23_OEN_INV_SEL_S 11 +/* GPIO_FUNC23_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC23_OEN_SEL (BIT(10)) +#define GPIO_FUNC23_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC23_OEN_SEL_V 0x1 +#define GPIO_FUNC23_OEN_SEL_S 10 +/* GPIO_FUNC23_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC23_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC23_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC23_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC23_OUT_INV_SEL_S 9 +/* GPIO_FUNC23_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC23_OUT_SEL 0x000001FF +#define GPIO_FUNC23_OUT_SEL_M ((GPIO_FUNC23_OUT_SEL_V)<<(GPIO_FUNC23_OUT_SEL_S)) +#define GPIO_FUNC23_OUT_SEL_V 0x1FF +#define GPIO_FUNC23_OUT_SEL_S 0 + +#define GPIO_FUNC24_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5B4) +/* GPIO_FUNC24_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC24_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC24_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC24_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC24_OEN_INV_SEL_S 11 +/* GPIO_FUNC24_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC24_OEN_SEL (BIT(10)) +#define GPIO_FUNC24_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC24_OEN_SEL_V 0x1 +#define GPIO_FUNC24_OEN_SEL_S 10 +/* GPIO_FUNC24_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC24_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC24_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC24_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC24_OUT_INV_SEL_S 9 +/* GPIO_FUNC24_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC24_OUT_SEL 0x000001FF +#define GPIO_FUNC24_OUT_SEL_M ((GPIO_FUNC24_OUT_SEL_V)<<(GPIO_FUNC24_OUT_SEL_S)) +#define GPIO_FUNC24_OUT_SEL_V 0x1FF +#define GPIO_FUNC24_OUT_SEL_S 0 + +#define GPIO_FUNC25_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5B8) +/* GPIO_FUNC25_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC25_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC25_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC25_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC25_OEN_INV_SEL_S 11 +/* GPIO_FUNC25_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC25_OEN_SEL (BIT(10)) +#define GPIO_FUNC25_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC25_OEN_SEL_V 0x1 +#define GPIO_FUNC25_OEN_SEL_S 10 +/* GPIO_FUNC25_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC25_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC25_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC25_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC25_OUT_INV_SEL_S 9 +/* GPIO_FUNC25_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC25_OUT_SEL 0x000001FF +#define GPIO_FUNC25_OUT_SEL_M ((GPIO_FUNC25_OUT_SEL_V)<<(GPIO_FUNC25_OUT_SEL_S)) +#define GPIO_FUNC25_OUT_SEL_V 0x1FF +#define GPIO_FUNC25_OUT_SEL_S 0 + +#define GPIO_FUNC26_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5BC) +/* GPIO_FUNC26_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC26_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC26_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC26_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC26_OEN_INV_SEL_S 11 +/* GPIO_FUNC26_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC26_OEN_SEL (BIT(10)) +#define GPIO_FUNC26_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC26_OEN_SEL_V 0x1 +#define GPIO_FUNC26_OEN_SEL_S 10 +/* GPIO_FUNC26_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC26_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC26_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC26_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC26_OUT_INV_SEL_S 9 +/* GPIO_FUNC26_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC26_OUT_SEL 0x000001FF +#define GPIO_FUNC26_OUT_SEL_M ((GPIO_FUNC26_OUT_SEL_V)<<(GPIO_FUNC26_OUT_SEL_S)) +#define GPIO_FUNC26_OUT_SEL_V 0x1FF +#define GPIO_FUNC26_OUT_SEL_S 0 + +#define GPIO_FUNC27_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5C0) +/* GPIO_FUNC27_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC27_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC27_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC27_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC27_OEN_INV_SEL_S 11 +/* GPIO_FUNC27_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC27_OEN_SEL (BIT(10)) +#define GPIO_FUNC27_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC27_OEN_SEL_V 0x1 +#define GPIO_FUNC27_OEN_SEL_S 10 +/* GPIO_FUNC27_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC27_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC27_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC27_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC27_OUT_INV_SEL_S 9 +/* GPIO_FUNC27_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC27_OUT_SEL 0x000001FF +#define GPIO_FUNC27_OUT_SEL_M ((GPIO_FUNC27_OUT_SEL_V)<<(GPIO_FUNC27_OUT_SEL_S)) +#define GPIO_FUNC27_OUT_SEL_V 0x1FF +#define GPIO_FUNC27_OUT_SEL_S 0 + +#define GPIO_FUNC28_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5C4) +/* GPIO_FUNC28_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC28_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC28_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC28_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC28_OEN_INV_SEL_S 11 +/* GPIO_FUNC28_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC28_OEN_SEL (BIT(10)) +#define GPIO_FUNC28_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC28_OEN_SEL_V 0x1 +#define GPIO_FUNC28_OEN_SEL_S 10 +/* GPIO_FUNC28_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC28_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC28_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC28_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC28_OUT_INV_SEL_S 9 +/* GPIO_FUNC28_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC28_OUT_SEL 0x000001FF +#define GPIO_FUNC28_OUT_SEL_M ((GPIO_FUNC28_OUT_SEL_V)<<(GPIO_FUNC28_OUT_SEL_S)) +#define GPIO_FUNC28_OUT_SEL_V 0x1FF +#define GPIO_FUNC28_OUT_SEL_S 0 + +#define GPIO_FUNC29_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5C8) +/* GPIO_FUNC29_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC29_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC29_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC29_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC29_OEN_INV_SEL_S 11 +/* GPIO_FUNC29_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC29_OEN_SEL (BIT(10)) +#define GPIO_FUNC29_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC29_OEN_SEL_V 0x1 +#define GPIO_FUNC29_OEN_SEL_S 10 +/* GPIO_FUNC29_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC29_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC29_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC29_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC29_OUT_INV_SEL_S 9 +/* GPIO_FUNC29_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC29_OUT_SEL 0x000001FF +#define GPIO_FUNC29_OUT_SEL_M ((GPIO_FUNC29_OUT_SEL_V)<<(GPIO_FUNC29_OUT_SEL_S)) +#define GPIO_FUNC29_OUT_SEL_V 0x1FF +#define GPIO_FUNC29_OUT_SEL_S 0 + +#define GPIO_FUNC30_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5CC) +/* GPIO_FUNC30_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC30_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC30_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC30_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC30_OEN_INV_SEL_S 11 +/* GPIO_FUNC30_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC30_OEN_SEL (BIT(10)) +#define GPIO_FUNC30_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC30_OEN_SEL_V 0x1 +#define GPIO_FUNC30_OEN_SEL_S 10 +/* GPIO_FUNC30_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC30_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC30_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC30_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC30_OUT_INV_SEL_S 9 +/* GPIO_FUNC30_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC30_OUT_SEL 0x000001FF +#define GPIO_FUNC30_OUT_SEL_M ((GPIO_FUNC30_OUT_SEL_V)<<(GPIO_FUNC30_OUT_SEL_S)) +#define GPIO_FUNC30_OUT_SEL_V 0x1FF +#define GPIO_FUNC30_OUT_SEL_S 0 + +#define GPIO_FUNC31_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5D0) +/* GPIO_FUNC31_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC31_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC31_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC31_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC31_OEN_INV_SEL_S 11 +/* GPIO_FUNC31_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC31_OEN_SEL (BIT(10)) +#define GPIO_FUNC31_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC31_OEN_SEL_V 0x1 +#define GPIO_FUNC31_OEN_SEL_S 10 +/* GPIO_FUNC31_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC31_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC31_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC31_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC31_OUT_INV_SEL_S 9 +/* GPIO_FUNC31_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC31_OUT_SEL 0x000001FF +#define GPIO_FUNC31_OUT_SEL_M ((GPIO_FUNC31_OUT_SEL_V)<<(GPIO_FUNC31_OUT_SEL_S)) +#define GPIO_FUNC31_OUT_SEL_V 0x1FF +#define GPIO_FUNC31_OUT_SEL_S 0 + +#define GPIO_FUNC32_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5D4) +/* GPIO_FUNC32_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC32_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC32_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC32_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC32_OEN_INV_SEL_S 11 +/* GPIO_FUNC32_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC32_OEN_SEL (BIT(10)) +#define GPIO_FUNC32_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC32_OEN_SEL_V 0x1 +#define GPIO_FUNC32_OEN_SEL_S 10 +/* GPIO_FUNC32_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC32_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC32_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC32_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC32_OUT_INV_SEL_S 9 +/* GPIO_FUNC32_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC32_OUT_SEL 0x000001FF +#define GPIO_FUNC32_OUT_SEL_M ((GPIO_FUNC32_OUT_SEL_V)<<(GPIO_FUNC32_OUT_SEL_S)) +#define GPIO_FUNC32_OUT_SEL_V 0x1FF +#define GPIO_FUNC32_OUT_SEL_S 0 + +#define GPIO_FUNC33_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5D8) +/* GPIO_FUNC33_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC33_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC33_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC33_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC33_OEN_INV_SEL_S 11 +/* GPIO_FUNC33_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC33_OEN_SEL (BIT(10)) +#define GPIO_FUNC33_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC33_OEN_SEL_V 0x1 +#define GPIO_FUNC33_OEN_SEL_S 10 +/* GPIO_FUNC33_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC33_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC33_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC33_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC33_OUT_INV_SEL_S 9 +/* GPIO_FUNC33_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC33_OUT_SEL 0x000001FF +#define GPIO_FUNC33_OUT_SEL_M ((GPIO_FUNC33_OUT_SEL_V)<<(GPIO_FUNC33_OUT_SEL_S)) +#define GPIO_FUNC33_OUT_SEL_V 0x1FF +#define GPIO_FUNC33_OUT_SEL_S 0 + +#define GPIO_FUNC34_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5DC) +/* GPIO_FUNC34_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC34_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC34_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC34_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC34_OEN_INV_SEL_S 11 +/* GPIO_FUNC34_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC34_OEN_SEL (BIT(10)) +#define GPIO_FUNC34_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC34_OEN_SEL_V 0x1 +#define GPIO_FUNC34_OEN_SEL_S 10 +/* GPIO_FUNC34_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC34_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC34_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC34_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC34_OUT_INV_SEL_S 9 +/* GPIO_FUNC34_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC34_OUT_SEL 0x000001FF +#define GPIO_FUNC34_OUT_SEL_M ((GPIO_FUNC34_OUT_SEL_V)<<(GPIO_FUNC34_OUT_SEL_S)) +#define GPIO_FUNC34_OUT_SEL_V 0x1FF +#define GPIO_FUNC34_OUT_SEL_S 0 + +#define GPIO_FUNC35_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5E0) +/* GPIO_FUNC35_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC35_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC35_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC35_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC35_OEN_INV_SEL_S 11 +/* GPIO_FUNC35_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC35_OEN_SEL (BIT(10)) +#define GPIO_FUNC35_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC35_OEN_SEL_V 0x1 +#define GPIO_FUNC35_OEN_SEL_S 10 +/* GPIO_FUNC35_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC35_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC35_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC35_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC35_OUT_INV_SEL_S 9 +/* GPIO_FUNC35_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC35_OUT_SEL 0x000001FF +#define GPIO_FUNC35_OUT_SEL_M ((GPIO_FUNC35_OUT_SEL_V)<<(GPIO_FUNC35_OUT_SEL_S)) +#define GPIO_FUNC35_OUT_SEL_V 0x1FF +#define GPIO_FUNC35_OUT_SEL_S 0 + +#define GPIO_FUNC36_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5E4) +/* GPIO_FUNC36_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC36_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC36_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC36_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC36_OEN_INV_SEL_S 11 +/* GPIO_FUNC36_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC36_OEN_SEL (BIT(10)) +#define GPIO_FUNC36_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC36_OEN_SEL_V 0x1 +#define GPIO_FUNC36_OEN_SEL_S 10 +/* GPIO_FUNC36_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC36_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC36_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC36_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC36_OUT_INV_SEL_S 9 +/* GPIO_FUNC36_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC36_OUT_SEL 0x000001FF +#define GPIO_FUNC36_OUT_SEL_M ((GPIO_FUNC36_OUT_SEL_V)<<(GPIO_FUNC36_OUT_SEL_S)) +#define GPIO_FUNC36_OUT_SEL_V 0x1FF +#define GPIO_FUNC36_OUT_SEL_S 0 + +#define GPIO_FUNC37_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5E8) +/* GPIO_FUNC37_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC37_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC37_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC37_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC37_OEN_INV_SEL_S 11 +/* GPIO_FUNC37_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC37_OEN_SEL (BIT(10)) +#define GPIO_FUNC37_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC37_OEN_SEL_V 0x1 +#define GPIO_FUNC37_OEN_SEL_S 10 +/* GPIO_FUNC37_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC37_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC37_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC37_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC37_OUT_INV_SEL_S 9 +/* GPIO_FUNC37_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC37_OUT_SEL 0x000001FF +#define GPIO_FUNC37_OUT_SEL_M ((GPIO_FUNC37_OUT_SEL_V)<<(GPIO_FUNC37_OUT_SEL_S)) +#define GPIO_FUNC37_OUT_SEL_V 0x1FF +#define GPIO_FUNC37_OUT_SEL_S 0 + +#define GPIO_FUNC38_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5EC) +/* GPIO_FUNC38_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC38_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC38_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC38_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC38_OEN_INV_SEL_S 11 +/* GPIO_FUNC38_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC38_OEN_SEL (BIT(10)) +#define GPIO_FUNC38_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC38_OEN_SEL_V 0x1 +#define GPIO_FUNC38_OEN_SEL_S 10 +/* GPIO_FUNC38_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC38_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC38_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC38_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC38_OUT_INV_SEL_S 9 +/* GPIO_FUNC38_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC38_OUT_SEL 0x000001FF +#define GPIO_FUNC38_OUT_SEL_M ((GPIO_FUNC38_OUT_SEL_V)<<(GPIO_FUNC38_OUT_SEL_S)) +#define GPIO_FUNC38_OUT_SEL_V 0x1FF +#define GPIO_FUNC38_OUT_SEL_S 0 + +#define GPIO_FUNC39_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5F0) +/* GPIO_FUNC39_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC39_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC39_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC39_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC39_OEN_INV_SEL_S 11 +/* GPIO_FUNC39_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC39_OEN_SEL (BIT(10)) +#define GPIO_FUNC39_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC39_OEN_SEL_V 0x1 +#define GPIO_FUNC39_OEN_SEL_S 10 +/* GPIO_FUNC39_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC39_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC39_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC39_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC39_OUT_INV_SEL_S 9 +/* GPIO_FUNC39_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC39_OUT_SEL 0x000001FF +#define GPIO_FUNC39_OUT_SEL_M ((GPIO_FUNC39_OUT_SEL_V)<<(GPIO_FUNC39_OUT_SEL_S)) +#define GPIO_FUNC39_OUT_SEL_V 0x1FF +#define GPIO_FUNC39_OUT_SEL_S 0 + +#define GPIO_FUNC40_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5F4) +/* GPIO_FUNC40_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC40_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC40_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC40_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC40_OEN_INV_SEL_S 11 +/* GPIO_FUNC40_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC40_OEN_SEL (BIT(10)) +#define GPIO_FUNC40_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC40_OEN_SEL_V 0x1 +#define GPIO_FUNC40_OEN_SEL_S 10 +/* GPIO_FUNC40_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC40_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC40_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC40_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC40_OUT_INV_SEL_S 9 +/* GPIO_FUNC40_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC40_OUT_SEL 0x000001FF +#define GPIO_FUNC40_OUT_SEL_M ((GPIO_FUNC40_OUT_SEL_V)<<(GPIO_FUNC40_OUT_SEL_S)) +#define GPIO_FUNC40_OUT_SEL_V 0x1FF +#define GPIO_FUNC40_OUT_SEL_S 0 + +#define GPIO_FUNC41_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5F8) +/* GPIO_FUNC41_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC41_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC41_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC41_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC41_OEN_INV_SEL_S 11 +/* GPIO_FUNC41_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC41_OEN_SEL (BIT(10)) +#define GPIO_FUNC41_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC41_OEN_SEL_V 0x1 +#define GPIO_FUNC41_OEN_SEL_S 10 +/* GPIO_FUNC41_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC41_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC41_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC41_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC41_OUT_INV_SEL_S 9 +/* GPIO_FUNC41_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC41_OUT_SEL 0x000001FF +#define GPIO_FUNC41_OUT_SEL_M ((GPIO_FUNC41_OUT_SEL_V)<<(GPIO_FUNC41_OUT_SEL_S)) +#define GPIO_FUNC41_OUT_SEL_V 0x1FF +#define GPIO_FUNC41_OUT_SEL_S 0 + +#define GPIO_FUNC42_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x5FC) +/* GPIO_FUNC42_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC42_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC42_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC42_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC42_OEN_INV_SEL_S 11 +/* GPIO_FUNC42_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC42_OEN_SEL (BIT(10)) +#define GPIO_FUNC42_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC42_OEN_SEL_V 0x1 +#define GPIO_FUNC42_OEN_SEL_S 10 +/* GPIO_FUNC42_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC42_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC42_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC42_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC42_OUT_INV_SEL_S 9 +/* GPIO_FUNC42_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC42_OUT_SEL 0x000001FF +#define GPIO_FUNC42_OUT_SEL_M ((GPIO_FUNC42_OUT_SEL_V)<<(GPIO_FUNC42_OUT_SEL_S)) +#define GPIO_FUNC42_OUT_SEL_V 0x1FF +#define GPIO_FUNC42_OUT_SEL_S 0 + +#define GPIO_FUNC43_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x600) +/* GPIO_FUNC43_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC43_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC43_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC43_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC43_OEN_INV_SEL_S 11 +/* GPIO_FUNC43_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC43_OEN_SEL (BIT(10)) +#define GPIO_FUNC43_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC43_OEN_SEL_V 0x1 +#define GPIO_FUNC43_OEN_SEL_S 10 +/* GPIO_FUNC43_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC43_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC43_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC43_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC43_OUT_INV_SEL_S 9 +/* GPIO_FUNC43_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC43_OUT_SEL 0x000001FF +#define GPIO_FUNC43_OUT_SEL_M ((GPIO_FUNC43_OUT_SEL_V)<<(GPIO_FUNC43_OUT_SEL_S)) +#define GPIO_FUNC43_OUT_SEL_V 0x1FF +#define GPIO_FUNC43_OUT_SEL_S 0 + +#define GPIO_FUNC44_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x604) +/* GPIO_FUNC44_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC44_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC44_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC44_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC44_OEN_INV_SEL_S 11 +/* GPIO_FUNC44_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC44_OEN_SEL (BIT(10)) +#define GPIO_FUNC44_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC44_OEN_SEL_V 0x1 +#define GPIO_FUNC44_OEN_SEL_S 10 +/* GPIO_FUNC44_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC44_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC44_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC44_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC44_OUT_INV_SEL_S 9 +/* GPIO_FUNC44_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC44_OUT_SEL 0x000001FF +#define GPIO_FUNC44_OUT_SEL_M ((GPIO_FUNC44_OUT_SEL_V)<<(GPIO_FUNC44_OUT_SEL_S)) +#define GPIO_FUNC44_OUT_SEL_V 0x1FF +#define GPIO_FUNC44_OUT_SEL_S 0 + +#define GPIO_FUNC45_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x608) +/* GPIO_FUNC45_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC45_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC45_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC45_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC45_OEN_INV_SEL_S 11 +/* GPIO_FUNC45_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC45_OEN_SEL (BIT(10)) +#define GPIO_FUNC45_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC45_OEN_SEL_V 0x1 +#define GPIO_FUNC45_OEN_SEL_S 10 +/* GPIO_FUNC45_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC45_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC45_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC45_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC45_OUT_INV_SEL_S 9 +/* GPIO_FUNC45_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC45_OUT_SEL 0x000001FF +#define GPIO_FUNC45_OUT_SEL_M ((GPIO_FUNC45_OUT_SEL_V)<<(GPIO_FUNC45_OUT_SEL_S)) +#define GPIO_FUNC45_OUT_SEL_V 0x1FF +#define GPIO_FUNC45_OUT_SEL_S 0 + +#define GPIO_FUNC46_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x60C) +/* GPIO_FUNC46_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC46_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC46_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC46_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC46_OEN_INV_SEL_S 11 +/* GPIO_FUNC46_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC46_OEN_SEL (BIT(10)) +#define GPIO_FUNC46_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC46_OEN_SEL_V 0x1 +#define GPIO_FUNC46_OEN_SEL_S 10 +/* GPIO_FUNC46_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC46_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC46_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC46_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC46_OUT_INV_SEL_S 9 +/* GPIO_FUNC46_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC46_OUT_SEL 0x000001FF +#define GPIO_FUNC46_OUT_SEL_M ((GPIO_FUNC46_OUT_SEL_V)<<(GPIO_FUNC46_OUT_SEL_S)) +#define GPIO_FUNC46_OUT_SEL_V 0x1FF +#define GPIO_FUNC46_OUT_SEL_S 0 + +#define GPIO_FUNC47_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x610) +/* GPIO_FUNC47_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC47_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC47_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC47_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC47_OEN_INV_SEL_S 11 +/* GPIO_FUNC47_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC47_OEN_SEL (BIT(10)) +#define GPIO_FUNC47_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC47_OEN_SEL_V 0x1 +#define GPIO_FUNC47_OEN_SEL_S 10 +/* GPIO_FUNC47_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC47_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC47_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC47_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC47_OUT_INV_SEL_S 9 +/* GPIO_FUNC47_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC47_OUT_SEL 0x000001FF +#define GPIO_FUNC47_OUT_SEL_M ((GPIO_FUNC47_OUT_SEL_V)<<(GPIO_FUNC47_OUT_SEL_S)) +#define GPIO_FUNC47_OUT_SEL_V 0x1FF +#define GPIO_FUNC47_OUT_SEL_S 0 + +#define GPIO_FUNC48_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x614) +/* GPIO_FUNC48_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC48_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC48_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC48_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC48_OEN_INV_SEL_S 11 +/* GPIO_FUNC48_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC48_OEN_SEL (BIT(10)) +#define GPIO_FUNC48_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC48_OEN_SEL_V 0x1 +#define GPIO_FUNC48_OEN_SEL_S 10 +/* GPIO_FUNC48_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC48_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC48_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC48_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC48_OUT_INV_SEL_S 9 +/* GPIO_FUNC48_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC48_OUT_SEL 0x000001FF +#define GPIO_FUNC48_OUT_SEL_M ((GPIO_FUNC48_OUT_SEL_V)<<(GPIO_FUNC48_OUT_SEL_S)) +#define GPIO_FUNC48_OUT_SEL_V 0x1FF +#define GPIO_FUNC48_OUT_SEL_S 0 + +#define GPIO_FUNC49_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x618) +/* GPIO_FUNC49_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC49_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC49_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC49_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC49_OEN_INV_SEL_S 11 +/* GPIO_FUNC49_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC49_OEN_SEL (BIT(10)) +#define GPIO_FUNC49_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC49_OEN_SEL_V 0x1 +#define GPIO_FUNC49_OEN_SEL_S 10 +/* GPIO_FUNC49_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC49_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC49_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC49_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC49_OUT_INV_SEL_S 9 +/* GPIO_FUNC49_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC49_OUT_SEL 0x000001FF +#define GPIO_FUNC49_OUT_SEL_M ((GPIO_FUNC49_OUT_SEL_V)<<(GPIO_FUNC49_OUT_SEL_S)) +#define GPIO_FUNC49_OUT_SEL_V 0x1FF +#define GPIO_FUNC49_OUT_SEL_S 0 + +#define GPIO_FUNC50_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x61C) +/* GPIO_FUNC50_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC50_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC50_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC50_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC50_OEN_INV_SEL_S 11 +/* GPIO_FUNC50_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC50_OEN_SEL (BIT(10)) +#define GPIO_FUNC50_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC50_OEN_SEL_V 0x1 +#define GPIO_FUNC50_OEN_SEL_S 10 +/* GPIO_FUNC50_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC50_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC50_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC50_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC50_OUT_INV_SEL_S 9 +/* GPIO_FUNC50_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC50_OUT_SEL 0x000001FF +#define GPIO_FUNC50_OUT_SEL_M ((GPIO_FUNC50_OUT_SEL_V)<<(GPIO_FUNC50_OUT_SEL_S)) +#define GPIO_FUNC50_OUT_SEL_V 0x1FF +#define GPIO_FUNC50_OUT_SEL_S 0 + +#define GPIO_FUNC51_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x620) +/* GPIO_FUNC51_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC51_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC51_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC51_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC51_OEN_INV_SEL_S 11 +/* GPIO_FUNC51_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC51_OEN_SEL (BIT(10)) +#define GPIO_FUNC51_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC51_OEN_SEL_V 0x1 +#define GPIO_FUNC51_OEN_SEL_S 10 +/* GPIO_FUNC51_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC51_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC51_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC51_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC51_OUT_INV_SEL_S 9 +/* GPIO_FUNC51_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC51_OUT_SEL 0x000001FF +#define GPIO_FUNC51_OUT_SEL_M ((GPIO_FUNC51_OUT_SEL_V)<<(GPIO_FUNC51_OUT_SEL_S)) +#define GPIO_FUNC51_OUT_SEL_V 0x1FF +#define GPIO_FUNC51_OUT_SEL_S 0 + +#define GPIO_FUNC52_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x624) +/* GPIO_FUNC52_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC52_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC52_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC52_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC52_OEN_INV_SEL_S 11 +/* GPIO_FUNC52_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC52_OEN_SEL (BIT(10)) +#define GPIO_FUNC52_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC52_OEN_SEL_V 0x1 +#define GPIO_FUNC52_OEN_SEL_S 10 +/* GPIO_FUNC52_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC52_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC52_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC52_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC52_OUT_INV_SEL_S 9 +/* GPIO_FUNC52_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC52_OUT_SEL 0x000001FF +#define GPIO_FUNC52_OUT_SEL_M ((GPIO_FUNC52_OUT_SEL_V)<<(GPIO_FUNC52_OUT_SEL_S)) +#define GPIO_FUNC52_OUT_SEL_V 0x1FF +#define GPIO_FUNC52_OUT_SEL_S 0 + +#define GPIO_FUNC53_OUT_SEL_CFG_REG (DR_REG_GPIO_BASE + 0x628) +/* GPIO_FUNC53_OEN_INV_SEL : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC53_OEN_INV_SEL (BIT(11)) +#define GPIO_FUNC53_OEN_INV_SEL_M (BIT(11)) +#define GPIO_FUNC53_OEN_INV_SEL_V 0x1 +#define GPIO_FUNC53_OEN_INV_SEL_S 11 +/* GPIO_FUNC53_OEN_SEL : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC53_OEN_SEL (BIT(10)) +#define GPIO_FUNC53_OEN_SEL_M (BIT(10)) +#define GPIO_FUNC53_OEN_SEL_V 0x1 +#define GPIO_FUNC53_OEN_SEL_S 10 +/* GPIO_FUNC53_OUT_INV_SEL : R/W ;bitpos:[9] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_FUNC53_OUT_INV_SEL (BIT(9)) +#define GPIO_FUNC53_OUT_INV_SEL_M (BIT(9)) +#define GPIO_FUNC53_OUT_INV_SEL_V 0x1 +#define GPIO_FUNC53_OUT_INV_SEL_S 9 +/* GPIO_FUNC53_OUT_SEL : R/W ;bitpos:[8:0] ;default: 9'h100 ; */ +/*description: */ +#define GPIO_FUNC53_OUT_SEL 0x000001FF +#define GPIO_FUNC53_OUT_SEL_M ((GPIO_FUNC53_OUT_SEL_V)<<(GPIO_FUNC53_OUT_SEL_S)) +#define GPIO_FUNC53_OUT_SEL_V 0x1FF +#define GPIO_FUNC53_OUT_SEL_S 0 + +#define GPIO_CLOCK_GATE_REG (DR_REG_GPIO_BASE + 0x62C) +/* GPIO_CLK_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define GPIO_CLK_EN (BIT(0)) +#define GPIO_CLK_EN_M (BIT(0)) +#define GPIO_CLK_EN_V 0x1 +#define GPIO_CLK_EN_S 0 + +#define GPIO_DATE_REG (DR_REG_GPIO_BASE + 0x6FC) +/* GPIO_DATE : R/W ;bitpos:[27:0] ;default: 28'h1809040 ; */ +/*description: */ +#define GPIO_DATE 0x0FFFFFFF +#define GPIO_DATE_M ((GPIO_DATE_V)<<(GPIO_DATE_S)) +#define GPIO_DATE_V 0xFFFFFFF +#define GPIO_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_GPIO_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/gpio_sd_reg.h b/components/soc/esp32s2beta/include/soc/gpio_sd_reg.h new file mode 100644 index 0000000000..f2bd9115f7 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/gpio_sd_reg.h @@ -0,0 +1,172 @@ +// Copyright 2017-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_GPIO_SD_REG_H_ +#define _SOC_GPIO_SD_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define GPIO_SIGMADELTA0_REG (DR_REG_GPIO_SD_BASE + 0x0000) +/* GPIO_SD0_PRESCALE : R/W ;bitpos:[15:8] ;default: 8'hff ; */ +/*description: */ +#define GPIO_SD0_PRESCALE 0x000000FF +#define GPIO_SD0_PRESCALE_M ((GPIO_SD0_PRESCALE_V)<<(GPIO_SD0_PRESCALE_S)) +#define GPIO_SD0_PRESCALE_V 0xFF +#define GPIO_SD0_PRESCALE_S 8 +/* GPIO_SD0_IN : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define GPIO_SD0_IN 0x000000FF +#define GPIO_SD0_IN_M ((GPIO_SD0_IN_V)<<(GPIO_SD0_IN_S)) +#define GPIO_SD0_IN_V 0xFF +#define GPIO_SD0_IN_S 0 + +#define GPIO_SIGMADELTA1_REG (DR_REG_GPIO_SD_BASE + 0x0004) +/* GPIO_SD1_PRESCALE : R/W ;bitpos:[15:8] ;default: 8'hff ; */ +/*description: */ +#define GPIO_SD1_PRESCALE 0x000000FF +#define GPIO_SD1_PRESCALE_M ((GPIO_SD1_PRESCALE_V)<<(GPIO_SD1_PRESCALE_S)) +#define GPIO_SD1_PRESCALE_V 0xFF +#define GPIO_SD1_PRESCALE_S 8 +/* GPIO_SD1_IN : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define GPIO_SD1_IN 0x000000FF +#define GPIO_SD1_IN_M ((GPIO_SD1_IN_V)<<(GPIO_SD1_IN_S)) +#define GPIO_SD1_IN_V 0xFF +#define GPIO_SD1_IN_S 0 + +#define GPIO_SIGMADELTA2_REG (DR_REG_GPIO_SD_BASE + 0x0008) +/* GPIO_SD2_PRESCALE : R/W ;bitpos:[15:8] ;default: 8'hff ; */ +/*description: */ +#define GPIO_SD2_PRESCALE 0x000000FF +#define GPIO_SD2_PRESCALE_M ((GPIO_SD2_PRESCALE_V)<<(GPIO_SD2_PRESCALE_S)) +#define GPIO_SD2_PRESCALE_V 0xFF +#define GPIO_SD2_PRESCALE_S 8 +/* GPIO_SD2_IN : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define GPIO_SD2_IN 0x000000FF +#define GPIO_SD2_IN_M ((GPIO_SD2_IN_V)<<(GPIO_SD2_IN_S)) +#define GPIO_SD2_IN_V 0xFF +#define GPIO_SD2_IN_S 0 + +#define GPIO_SIGMADELTA3_REG (DR_REG_GPIO_SD_BASE + 0x000c) +/* GPIO_SD3_PRESCALE : R/W ;bitpos:[15:8] ;default: 8'hff ; */ +/*description: */ +#define GPIO_SD3_PRESCALE 0x000000FF +#define GPIO_SD3_PRESCALE_M ((GPIO_SD3_PRESCALE_V)<<(GPIO_SD3_PRESCALE_S)) +#define GPIO_SD3_PRESCALE_V 0xFF +#define GPIO_SD3_PRESCALE_S 8 +/* GPIO_SD3_IN : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define GPIO_SD3_IN 0x000000FF +#define GPIO_SD3_IN_M ((GPIO_SD3_IN_V)<<(GPIO_SD3_IN_S)) +#define GPIO_SD3_IN_V 0xFF +#define GPIO_SD3_IN_S 0 + +#define GPIO_SIGMADELTA4_REG (DR_REG_GPIO_SD_BASE + 0x0010) +/* GPIO_SD4_PRESCALE : R/W ;bitpos:[15:8] ;default: 8'hff ; */ +/*description: */ +#define GPIO_SD4_PRESCALE 0x000000FF +#define GPIO_SD4_PRESCALE_M ((GPIO_SD4_PRESCALE_V)<<(GPIO_SD4_PRESCALE_S)) +#define GPIO_SD4_PRESCALE_V 0xFF +#define GPIO_SD4_PRESCALE_S 8 +/* GPIO_SD4_IN : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define GPIO_SD4_IN 0x000000FF +#define GPIO_SD4_IN_M ((GPIO_SD4_IN_V)<<(GPIO_SD4_IN_S)) +#define GPIO_SD4_IN_V 0xFF +#define GPIO_SD4_IN_S 0 + +#define GPIO_SIGMADELTA5_REG (DR_REG_GPIO_SD_BASE + 0x0014) +/* GPIO_SD5_PRESCALE : R/W ;bitpos:[15:8] ;default: 8'hff ; */ +/*description: */ +#define GPIO_SD5_PRESCALE 0x000000FF +#define GPIO_SD5_PRESCALE_M ((GPIO_SD5_PRESCALE_V)<<(GPIO_SD5_PRESCALE_S)) +#define GPIO_SD5_PRESCALE_V 0xFF +#define GPIO_SD5_PRESCALE_S 8 +/* GPIO_SD5_IN : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define GPIO_SD5_IN 0x000000FF +#define GPIO_SD5_IN_M ((GPIO_SD5_IN_V)<<(GPIO_SD5_IN_S)) +#define GPIO_SD5_IN_V 0xFF +#define GPIO_SD5_IN_S 0 + +#define GPIO_SIGMADELTA6_REG (DR_REG_GPIO_SD_BASE + 0x0018) +/* GPIO_SD6_PRESCALE : R/W ;bitpos:[15:8] ;default: 8'hff ; */ +/*description: */ +#define GPIO_SD6_PRESCALE 0x000000FF +#define GPIO_SD6_PRESCALE_M ((GPIO_SD6_PRESCALE_V)<<(GPIO_SD6_PRESCALE_S)) +#define GPIO_SD6_PRESCALE_V 0xFF +#define GPIO_SD6_PRESCALE_S 8 +/* GPIO_SD6_IN : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define GPIO_SD6_IN 0x000000FF +#define GPIO_SD6_IN_M ((GPIO_SD6_IN_V)<<(GPIO_SD6_IN_S)) +#define GPIO_SD6_IN_V 0xFF +#define GPIO_SD6_IN_S 0 + +#define GPIO_SIGMADELTA7_REG (DR_REG_GPIO_SD_BASE + 0x001c) +/* GPIO_SD7_PRESCALE : R/W ;bitpos:[15:8] ;default: 8'hff ; */ +/*description: */ +#define GPIO_SD7_PRESCALE 0x000000FF +#define GPIO_SD7_PRESCALE_M ((GPIO_SD7_PRESCALE_V)<<(GPIO_SD7_PRESCALE_S)) +#define GPIO_SD7_PRESCALE_V 0xFF +#define GPIO_SD7_PRESCALE_S 8 +/* GPIO_SD7_IN : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define GPIO_SD7_IN 0x000000FF +#define GPIO_SD7_IN_M ((GPIO_SD7_IN_V)<<(GPIO_SD7_IN_S)) +#define GPIO_SD7_IN_V 0xFF +#define GPIO_SD7_IN_S 0 + +#define GPIO_SIGMADELTA_CG_REG (DR_REG_GPIO_SD_BASE + 0x0020) +/* GPIO_SD_CLK_EN : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SD_CLK_EN (BIT(31)) +#define GPIO_SD_CLK_EN_M (BIT(31)) +#define GPIO_SD_CLK_EN_V 0x1 +#define GPIO_SD_CLK_EN_S 31 + +#define GPIO_SIGMADELTA_MISC_REG (DR_REG_GPIO_SD_BASE + 0x0024) +/* GPIO_SPI_SWAP : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define GPIO_SPI_SWAP (BIT(31)) +#define GPIO_SPI_SWAP_M (BIT(31)) +#define GPIO_SPI_SWAP_V 0x1 +#define GPIO_SPI_SWAP_S 31 +/* GPIO_FUNCTION_CLK_EN : R/W ;bitpos:[30] ;default: 1'd0 ; */ +/*description: */ +#define GPIO_FUNCTION_CLK_EN (BIT(30)) +#define GPIO_FUNCTION_CLK_EN_M (BIT(30)) +#define GPIO_FUNCTION_CLK_EN_V 0x1 +#define GPIO_FUNCTION_CLK_EN_S 30 + +#define GPIO_SIGMADELTA_VERSION_REG (DR_REG_GPIO_SD_BASE + 0x0028) +/* GPIO_SD_DATE : R/W ;bitpos:[27:0] ;default: 28'h1802260 ; */ +/*description: */ +#define GPIO_SD_DATE 0x0FFFFFFF +#define GPIO_SD_DATE_M ((GPIO_SD_DATE_V)<<(GPIO_SD_DATE_S)) +#define GPIO_SD_DATE_V 0xFFFFFFF +#define GPIO_SD_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_GPIO_SD_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/gpio_sd_struct.h b/components/soc/esp32s2beta/include/soc/gpio_sd_struct.h new file mode 100644 index 0000000000..6c28df52a8 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/gpio_sd_struct.h @@ -0,0 +1,57 @@ +// Copyright 2017-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_GPIO_SD_STRUCT_H_ +#define _SOC_GPIO_SD_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t duty: 8; + uint32_t prescale: 8; + uint32_t reserved16: 16; + }; + uint32_t val; + } channel[8]; + union { + struct { + uint32_t reserved0: 31; + uint32_t clk_en: 1; + }; + uint32_t val; + } cg; + union { + struct { + uint32_t reserved0: 30; + uint32_t function_clk_en: 1; + uint32_t spi_swap: 1; + }; + uint32_t val; + } misc; + union { + struct { + uint32_t date: 28; + uint32_t reserved28: 4; + }; + uint32_t val; + } version; +} gpio_sd_dev_t; +extern gpio_sd_dev_t SIGMADELTA; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_GPIO_SD_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/gpio_sig_map.h b/components/soc/esp32s2beta/include/soc/gpio_sig_map.h new file mode 100644 index 0000000000..6215328d18 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/gpio_sig_map.h @@ -0,0 +1,288 @@ +// Copyright 2017-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 + +#define SPICLK_OUT_IDX SPICLK_OUT_MUX_IDX +#define CLK_I2S_IDX CLK_I2S_MUX_IDX + +#define SPIQ_IN_IDX 0 +#define SPIQ_OUT_IDX 0 +#define SPID_IN_IDX 1 +#define SPID_OUT_IDX 1 +#define SPIHD_IN_IDX 2 +#define SPIHD_OUT_IDX 2 +#define SPIWP_IN_IDX 3 +#define SPIWP_OUT_IDX 3 +#define SPICLK_OUT_MUX_IDX 4 +#define SPICS0_OUT_IDX 5 +#define SPICS1_OUT_IDX 6 +#define FSPICD_OUT_IDX 9 +#define SPI3_CD_OUT_IDX 10 +#define SPI4_CD_OUT_IDX 11 +#define U0RXD_IN_IDX 14 +#define U0TXD_OUT_IDX 14 +#define U0CTS_IN_IDX 15 +#define U0RTS_OUT_IDX 15 +#define U0DSR_IN_IDX 16 +#define U0DTR_OUT_IDX 16 +#define U1RXD_IN_IDX 17 +#define U1TXD_OUT_IDX 17 +#define U1CTS_IN_IDX 18 +#define U1RTS_OUT_IDX 18 +#define U1DSR_IN_IDX 21 +#define U1DTR_OUT_IDX 21 +#define I2S0O_BCK_IN_IDX 23 +#define I2S0O_BCK_OUT_IDX 23 +#define I2S0O_WS_IN_IDX 25 +#define I2S0O_WS_OUT_IDX 25 +#define I2S0I_BCK_IN_IDX 27 +#define I2S0I_BCK_OUT_IDX 27 +#define I2S0I_WS_IN_IDX 28 +#define I2S0I_WS_OUT_IDX 28 +#define I2CEXT0_SCL_IN_IDX 29 +#define I2CEXT0_SCL_OUT_IDX 29 +#define I2CEXT0_SDA_IN_IDX 30 +#define I2CEXT0_SDA_OUT_IDX 30 +#define SDIO_TOHOST_INT_OUT_IDX 31 +#define GPIO_BT_ACTIVE_IDX 37 +#define GPIO_BT_PRIORITY_IDX 38 +#define PCNT_SIG_CH0_IN0_IDX 39 +#define GPIO_WLAN_PRIO_IDX 39 +#define PCNT_SIG_CH1_IN0_IDX 40 +#define GPIO_WLAN_ACTIVE_IDX 40 +#define PCNT_CTRL_CH0_IN0_IDX 41 +#define BB_DIAG0_IDX 41 +#define PCNT_CTRL_CH1_IN0_IDX 42 +#define BB_DIAG1_IDX 42 +#define PCNT_SIG_CH0_IN1_IDX 43 +#define BB_DIAG2_IDX 43 +#define PCNT_SIG_CH1_IN1_IDX 44 +#define BB_DIAG3_IDX 44 +#define PCNT_CTRL_CH0_IN1_IDX 45 +#define BB_DIAG4_IDX 45 +#define PCNT_CTRL_CH1_IN1_IDX 46 +#define BB_DIAG5_IDX 46 +#define PCNT_SIG_CH0_IN2_IDX 47 +#define BB_DIAG6_IDX 47 +#define PCNT_SIG_CH1_IN2_IDX 48 +#define BB_DIAG7_IDX 48 +#define PCNT_CTRL_CH0_IN2_IDX 49 +#define BB_DIAG8_IDX 49 +#define PCNT_CTRL_CH1_IN2_IDX 50 +#define BB_DIAG9_IDX 50 +#define PCNT_SIG_CH0_IN3_IDX 51 +#define BB_DIAG10_IDX 51 +#define PCNT_SIG_CH1_IN3_IDX 52 +#define BB_DIAG11_IDX 52 +#define PCNT_CTRL_CH0_IN3_IDX 53 +#define BB_DIAG12_IDX 53 +#define PCNT_CTRL_CH1_IN3_IDX 54 +#define BB_DIAG13_IDX 54 +#define BB_DIAG14_IDX 55 +#define BB_DIAG15_IDX 56 +#define BB_DIAG16_IDX 57 +#define BB_DIAG17_IDX 58 +#define BB_DIAG18_IDX 59 +#define BB_DIAG19_IDX 60 +#define USB_EXTPHY_VP_IDX 61 +#define USB_EXTPHY_OEN_IDX 61 +#define USB_EXTPHY_VM_IDX 62 +#define USB_EXTPHY_SPEED_IDX 62 +#define USB_EXTPHY_RCV_IDX 63 +#define USB_EXTPHY_VPO_IDX 63 +#define USB_OTG_IDDIG_IN_IDX 64 +#define USB_EXTPHY_VMO_IDX 64 +#define USB_OTG_AVALID_IN_IDX 65 +#define USB_EXTPHY_SUSPND_IDX 65 +#define USB_SRP_BVALID_IN_IDX 66 +#define USB_OTG_IDPULLUP_IDX 66 +#define USB_OTG_VBUSVALID_IN_IDX 67 +#define USB_OTG_DPPULLDOWN_IDX 67 +#define USB_SRP_SESSEND_IN_IDX 68 +#define USB_OTG_DMPULLDOWN_IDX 68 +#define USB_OTG_DRVVBUS_IDX 69 +#define USB_SRP_CHRGVBUS_IDX 70 +#define USB_SRP_DISCHRGVBUS_IDX 71 +#define SPI3_CLK_IN_IDX 72 +#define SPI3_CLK_OUT_MUX_IDX 72 +#define SPI3_Q_IN_IDX 73 +#define SPI3_Q_OUT_IDX 73 +#define SPI3_D_IN_IDX 74 +#define SPI3_D_OUT_IDX 74 +#define SPI3_HD_IN_IDX 75 +#define SPI3_HD_OUT_IDX 75 +#define SPI3_CS0_IN_IDX 76 +#define SPI3_CS0_OUT_IDX 76 +#define SPI3_CS1_OUT_IDX 77 +#define SPI3_CS2_OUT_IDX 78 +#define LEDC_LS_SIG_OUT0_IDX 79 +#define LEDC_LS_SIG_OUT1_IDX 80 +#define LEDC_LS_SIG_OUT2_IDX 81 +#define LEDC_LS_SIG_OUT3_IDX 82 +#define RMT_SIG_IN0_IDX 83 +#define LEDC_LS_SIG_OUT4_IDX 83 +#define RMT_SIG_IN1_IDX 84 +#define LEDC_LS_SIG_OUT5_IDX 84 +#define RMT_SIG_IN2_IDX 85 +#define LEDC_LS_SIG_OUT6_IDX 85 +#define RMT_SIG_IN3_IDX 86 +#define LEDC_LS_SIG_OUT7_IDX 86 +#define RMT_SIG_OUT0_IDX 87 +#define RMT_SIG_OUT1_IDX 88 +#define RMT_SIG_OUT2_IDX 89 +#define RMT_SIG_OUT3_IDX 90 +#define EXT_ADC_START_IDX 93 +#define I2CEXT1_SCL_IN_IDX 95 +#define I2CEXT1_SCL_OUT_IDX 95 +#define I2CEXT1_SDA_IN_IDX 96 +#define I2CEXT1_SDA_OUT_IDX 96 +#define GPIO_SD0_OUT_IDX 100 +#define GPIO_SD1_OUT_IDX 101 +#define GPIO_SD2_OUT_IDX 102 +#define GPIO_SD3_OUT_IDX 103 +#define GPIO_SD4_OUT_IDX 104 +#define GPIO_SD5_OUT_IDX 105 +#define GPIO_SD6_OUT_IDX 106 +#define GPIO_SD7_OUT_IDX 107 +#define SPI4_CLK_IN_IDX 108 +#define SPI4_CLK_OUT_MUX_IDX 108 +#define SPI4_Q_IN_IDX 109 +#define SPI4_Q_OUT_IDX 109 +#define SPI4_D_IN_IDX 110 +#define SPI4_D_OUT_IDX 110 +#define SPI4_HD_IN_IDX 111 +#define SPI4_HD_OUT_IDX 111 +#define SPI4_CS0_IN_IDX 112 +#define SPI4_CS0_OUT_IDX 112 +#define SPI4_CS1_OUT_IDX 113 +#define SPI4_CS2_OUT_IDX 114 +#define FSPICLK_IN_IDX 115 +#define FSPICLK_OUT_MUX_IDX 115 +#define FSPIQ_IN_IDX 116 +#define FSPIQ_OUT_IDX 116 +#define FSPID_IN_IDX 117 +#define FSPID_OUT_IDX 117 +#define FSPIHD_IN_IDX 118 +#define FSPIHD_OUT_IDX 118 +#define FSPIWP_IN_IDX 119 +#define FSPIWP_OUT_IDX 119 +#define FSPICS0_IN_IDX 120 +#define FSPICS0_OUT_IDX 120 +#define FSPICS1_OUT_IDX 121 +#define FSPICS2_OUT_IDX 122 +#define CAN_RX_IDX 123 +#define CAN_TX_IDX 123 +#define CAN_BUS_OFF_ON_IDX 124 +#define CAN_CLKOUT_IDX 125 +#define SUBSPICLK_OUT_MUX_IDX 126 +#define SUBSPIQ_IN_IDX 127 +#define SUBSPIQ_OUT_IDX 127 +#define SUBSPID_IN_IDX 128 +#define SUBSPID_OUT_IDX 128 +#define SUBSPIHD_IN_IDX 129 +#define SUBSPIHD_OUT_IDX 129 +#define SUBSPIWP_IN_IDX 130 +#define SUBSPIWP_OUT_IDX 130 +#define SUBSPICS0_OUT_IDX 131 +#define SUBSPICS1_OUT_IDX 132 +#define FSPIDQS_OUT_IDX 133 +#define SPI3_DQS_OUT_IDX 134 +#define SPI4_DQS_OUT_IDX 135 +#define I2S0I_DATA_IN0_IDX 143 +#define I2S0O_DATA_OUT0_IDX 143 +#define I2S0I_DATA_IN1_IDX 144 +#define I2S0O_DATA_OUT1_IDX 144 +#define I2S0I_DATA_IN2_IDX 145 +#define I2S0O_DATA_OUT2_IDX 145 +#define I2S0I_DATA_IN3_IDX 146 +#define I2S0O_DATA_OUT3_IDX 146 +#define I2S0I_DATA_IN4_IDX 147 +#define I2S0O_DATA_OUT4_IDX 147 +#define I2S0I_DATA_IN5_IDX 148 +#define I2S0O_DATA_OUT5_IDX 148 +#define I2S0I_DATA_IN6_IDX 149 +#define I2S0O_DATA_OUT6_IDX 149 +#define I2S0I_DATA_IN7_IDX 150 +#define I2S0O_DATA_OUT7_IDX 150 +#define I2S0I_DATA_IN8_IDX 151 +#define I2S0O_DATA_OUT8_IDX 151 +#define I2S0I_DATA_IN9_IDX 152 +#define I2S0O_DATA_OUT9_IDX 152 +#define I2S0I_DATA_IN10_IDX 153 +#define I2S0O_DATA_OUT10_IDX 153 +#define I2S0I_DATA_IN11_IDX 154 +#define I2S0O_DATA_OUT11_IDX 154 +#define I2S0I_DATA_IN12_IDX 155 +#define I2S0O_DATA_OUT12_IDX 155 +#define I2S0I_DATA_IN13_IDX 156 +#define I2S0O_DATA_OUT13_IDX 156 +#define I2S0I_DATA_IN14_IDX 157 +#define I2S0O_DATA_OUT14_IDX 157 +#define I2S0I_DATA_IN15_IDX 158 +#define I2S0O_DATA_OUT15_IDX 158 +#define I2S0O_DATA_OUT16_IDX 159 +#define I2S0O_DATA_OUT17_IDX 160 +#define I2S0O_DATA_OUT18_IDX 161 +#define I2S0O_DATA_OUT19_IDX 162 +#define I2S0O_DATA_OUT20_IDX 163 +#define I2S0O_DATA_OUT21_IDX 164 +#define I2S0O_DATA_OUT22_IDX 165 +#define I2S0O_DATA_OUT23_IDX 166 +#define I2S0I_H_SYNC_IDX 193 +#define I2S0I_V_SYNC_IDX 194 +#define I2S0I_H_ENABLE_IDX 195 +#define PCMFSYNC_IN_IDX 203 +#define BT_AUDIO0_IRQ_IDX 203 +#define PCMCLK_IN_IDX 204 +#define BT_AUDIO1_IRQ_IDX 204 +#define PCMDIN_IDX 205 +#define BT_AUDIO2_IRQ_IDX 205 +#define RW_WAKEUP_REQ_IDX 206 +#define BLE_AUDIO0_IRQ_IDX 206 +#define BLE_AUDIO1_IRQ_IDX 207 +#define BLE_AUDIO2_IRQ_IDX 208 +#define PCMFSYNC_OUT_IDX 209 +#define PCMCLK_OUT_IDX 210 +#define PCMDOUT_IDX 211 +#define BLE_AUDIO_SYNC0_P_IDX 212 +#define BLE_AUDIO_SYNC1_P_IDX 213 +#define BLE_AUDIO_SYNC2_P_IDX 214 +#define ANT_SEL0_IDX 215 +#define ANT_SEL1_IDX 216 +#define ANT_SEL2_IDX 217 +#define ANT_SEL3_IDX 218 +#define ANT_SEL4_IDX 219 +#define ANT_SEL5_IDX 220 +#define ANT_SEL6_IDX 221 +#define ANT_SEL7_IDX 222 +#define SIG_IN_FUNC_223_IDX 223 +#define SIG_IN_FUNC223_IDX 223 +#define SIG_IN_FUNC_224_IDX 224 +#define SIG_IN_FUNC224_IDX 224 +#define SIG_IN_FUNC_225_IDX 225 +#define SIG_IN_FUNC225_IDX 225 +#define SIG_IN_FUNC_226_IDX 226 +#define SIG_IN_FUNC226_IDX 226 +#define SIG_IN_FUNC_227_IDX 227 +#define SIG_IN_FUNC227_IDX 227 +#define PRO_ALONEGPIO_IN0_IDX 235 +#define PRO_ALONEGPIO_OUT0_IDX 235 +#define PRO_ALONEGPIO_IN1_IDX 236 +#define PRO_ALONEGPIO_OUT1_IDX 236 +#define PRO_ALONEGPIO_IN2_IDX 237 +#define PRO_ALONEGPIO_OUT2_IDX 237 +#define PRO_ALONEGPIO_IN3_IDX 238 +#define PRO_ALONEGPIO_OUT3_IDX 238 +#define PRO_ALONEGPIO_IN4_IDX 239 +#define PRO_ALONEGPIO_OUT4_IDX 239 +#define PRO_ALONEGPIO_IN5_IDX 240 +#define PRO_ALONEGPIO_OUT5_IDX 240 +#define PRO_ALONEGPIO_IN6_IDX 241 +#define PRO_ALONEGPIO_OUT6_IDX 241 +#define PRO_ALONEGPIO_IN7_IDX 242 +#define PRO_ALONEGPIO_OUT7_IDX 242 +#define CLK_I2S_MUX_IDX 251 +#define SIG_GPIO_OUT_IDX 256 +#define GPIO_MAP_DATE_IDX 0x18102600 diff --git a/components/soc/esp32s2beta/include/soc/gpio_struct.h b/components/soc/esp32s2beta/include/soc/gpio_struct.h new file mode 100644 index 0000000000..cb6f2f5e28 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/gpio_struct.h @@ -0,0 +1,252 @@ +// Copyright 2017-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_GPIO_STRUCT_H_ +#define _SOC_GPIO_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + uint32_t bt_select; /**/ + uint32_t out; /**/ + uint32_t out_w1ts; /**/ + uint32_t out_w1tc; /**/ + union { + struct { + uint32_t data: 22; + uint32_t reserved22:10; + }; + uint32_t val; + } out1; + union { + struct { + uint32_t data: 22; + uint32_t reserved22:10; + }; + uint32_t val; + } out1_w1ts; + union { + struct { + uint32_t data: 22; + uint32_t reserved22:10; + }; + uint32_t val; + } out1_w1tc; + union { + struct { + uint32_t sel: 8; + uint32_t reserved8: 24; + }; + uint32_t val; + } sdio_select; + uint32_t enable; /**/ + uint32_t enable_w1ts; /**/ + uint32_t enable_w1tc; /**/ + union { + struct { + uint32_t data: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } enable1; + union { + struct { + uint32_t data: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } enable1_w1ts; + union { + struct { + uint32_t data: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } enable1_w1tc; + union { + struct { + uint32_t strapping: 16; + uint32_t reserved16:16; + }; + uint32_t val; + } strap; + uint32_t in; /**/ + union { + struct { + uint32_t data: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } in1; + uint32_t status; /**/ + uint32_t status_w1ts; /**/ + uint32_t status_w1tc; /**/ + union { + struct { + uint32_t intr_st: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } status1; + union { + struct { + uint32_t intr_st: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } status1_w1ts; + union { + struct { + uint32_t intr_st: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } status1_w1tc; + uint32_t pcpu_int; /**/ + uint32_t pcpu_nmi_int; /**/ + uint32_t cpusdio_int; /**/ + union { + struct { + uint32_t intr: 22; + uint32_t reserved22:10; + }; + uint32_t val; + } pcpu_int1; + union { + struct { + uint32_t intr: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } pcpu_nmi_int1; + union { + struct { + uint32_t intr: 22; + uint32_t reserved22:10; + }; + uint32_t val; + } cpusdio_int1; + union { + struct { + uint32_t sync2_bypass: 2; + uint32_t pad_driver: 1; + uint32_t sync1_bypass: 2; + uint32_t reserved5: 2; + uint32_t int_type: 3; + uint32_t wakeup_enable: 1; + uint32_t config: 2; + uint32_t int_ena: 5; + uint32_t reserved18: 14; + }; + uint32_t val; + } pin[54]; + uint32_t status_next; /**/ + union { + struct { + uint32_t intr_st_next: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } status_next1; + union { + struct { + uint32_t func_sel: 6; + uint32_t sig_in_inv: 1; + uint32_t sig_in_sel: 1; + uint32_t reserved8: 24; + }; + uint32_t val; + } func_in_sel_cfg[256]; + union { + struct { + uint32_t func_sel: 9; + uint32_t inv_sel: 1; + uint32_t oen_sel: 1; + uint32_t oen_inv_sel: 1; + uint32_t reserved12: 20; + }; + uint32_t val; + } func_out_sel_cfg[54]; + union { + struct { + uint32_t clk_en: 1; + uint32_t reserved1: 31; + }; + uint32_t val; + } clock_gate; + uint32_t reserved_630; + uint32_t reserved_634; + uint32_t reserved_638; + uint32_t reserved_63c; + uint32_t reserved_640; + uint32_t reserved_644; + uint32_t reserved_648; + uint32_t reserved_64c; + uint32_t reserved_650; + uint32_t reserved_654; + uint32_t reserved_658; + uint32_t reserved_65c; + uint32_t reserved_660; + uint32_t reserved_664; + uint32_t reserved_668; + uint32_t reserved_66c; + uint32_t reserved_670; + uint32_t reserved_674; + uint32_t reserved_678; + uint32_t reserved_67c; + uint32_t reserved_680; + uint32_t reserved_684; + uint32_t reserved_688; + uint32_t reserved_68c; + uint32_t reserved_690; + uint32_t reserved_694; + uint32_t reserved_698; + uint32_t reserved_69c; + uint32_t reserved_6a0; + uint32_t reserved_6a4; + uint32_t reserved_6a8; + uint32_t reserved_6ac; + uint32_t reserved_6b0; + uint32_t reserved_6b4; + uint32_t reserved_6b8; + uint32_t reserved_6bc; + uint32_t reserved_6c0; + uint32_t reserved_6c4; + uint32_t reserved_6c8; + uint32_t reserved_6cc; + uint32_t reserved_6d0; + uint32_t reserved_6d4; + uint32_t reserved_6d8; + uint32_t reserved_6dc; + uint32_t reserved_6e0; + uint32_t reserved_6e4; + uint32_t reserved_6e8; + uint32_t reserved_6ec; + uint32_t reserved_6f0; + uint32_t reserved_6f4; + uint32_t reserved_6f8; + union { + struct { + uint32_t date: 28; + uint32_t reserved28: 4; + }; + uint32_t val; + } date; +} gpio_dev_t; +extern gpio_dev_t GPIO; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_GPIO_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/hinf_reg.h b/components/soc/esp32s2beta/include/soc/hinf_reg.h new file mode 100644 index 0000000000..aad357864e --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/hinf_reg.h @@ -0,0 +1,248 @@ +// 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_HINF_REG_H_ +#define _SOC_HINF_REG_H_ + + +#include "soc.h" +#define HINF_CFG_DATA0_REG (DR_REG_HINF_BASE + 0x0) +/* HINF_DEVICE_ID_FN1 : R/W ;bitpos:[31:16] ;default: 16'h2222 ; */ +/*description: */ +#define HINF_DEVICE_ID_FN1 0x0000FFFF +#define HINF_DEVICE_ID_FN1_M ((HINF_DEVICE_ID_FN1_V)<<(HINF_DEVICE_ID_FN1_S)) +#define HINF_DEVICE_ID_FN1_V 0xFFFF +#define HINF_DEVICE_ID_FN1_S 16 +/* HINF_USER_ID_FN1 : R/W ;bitpos:[15:0] ;default: 16'h6666 ; */ +/*description: */ +#define HINF_USER_ID_FN1 0x0000FFFF +#define HINF_USER_ID_FN1_M ((HINF_USER_ID_FN1_V)<<(HINF_USER_ID_FN1_S)) +#define HINF_USER_ID_FN1_V 0xFFFF +#define HINF_USER_ID_FN1_S 0 + +#define HINF_CFG_DATA1_REG (DR_REG_HINF_BASE + 0x4) +/* HINF_SDIO20_CONF1 : R/W ;bitpos:[31:29] ;default: 3'h0 ; */ +/*description: */ +#define HINF_SDIO20_CONF1 0x00000007 +#define HINF_SDIO20_CONF1_M ((HINF_SDIO20_CONF1_V)<<(HINF_SDIO20_CONF1_S)) +#define HINF_SDIO20_CONF1_V 0x7 +#define HINF_SDIO20_CONF1_S 29 +/* HINF_FUNC2_EPS : RO ;bitpos:[28] ;default: 1'b0 ; */ +/*description: */ +#define HINF_FUNC2_EPS (BIT(28)) +#define HINF_FUNC2_EPS_M (BIT(28)) +#define HINF_FUNC2_EPS_V 0x1 +#define HINF_FUNC2_EPS_S 28 +/* HINF_SDIO_VER : R/W ;bitpos:[27:16] ;default: 12'h111 ; */ +/*description: */ +#define HINF_SDIO_VER 0x00000FFF +#define HINF_SDIO_VER_M ((HINF_SDIO_VER_V)<<(HINF_SDIO_VER_S)) +#define HINF_SDIO_VER_V 0xFFF +#define HINF_SDIO_VER_S 16 +/* HINF_SDIO20_CONF0 : R/W ;bitpos:[15:12] ;default: 4'b0 ; */ +/*description: */ +#define HINF_SDIO20_CONF0 0x0000000F +#define HINF_SDIO20_CONF0_M ((HINF_SDIO20_CONF0_V)<<(HINF_SDIO20_CONF0_S)) +#define HINF_SDIO20_CONF0_V 0xF +#define HINF_SDIO20_CONF0_S 12 +/* HINF_IOENABLE1 : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define HINF_IOENABLE1 (BIT(11)) +#define HINF_IOENABLE1_M (BIT(11)) +#define HINF_IOENABLE1_V 0x1 +#define HINF_IOENABLE1_S 11 +/* HINF_EMP : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define HINF_EMP (BIT(10)) +#define HINF_EMP_M (BIT(10)) +#define HINF_EMP_V 0x1 +#define HINF_EMP_S 10 +/* HINF_FUNC1_EPS : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define HINF_FUNC1_EPS (BIT(9)) +#define HINF_FUNC1_EPS_M (BIT(9)) +#define HINF_FUNC1_EPS_V 0x1 +#define HINF_FUNC1_EPS_S 9 +/* HINF_CD_DISABLE : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define HINF_CD_DISABLE (BIT(8)) +#define HINF_CD_DISABLE_M (BIT(8)) +#define HINF_CD_DISABLE_V 0x1 +#define HINF_CD_DISABLE_S 8 +/* HINF_IOENABLE2 : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define HINF_IOENABLE2 (BIT(7)) +#define HINF_IOENABLE2_M (BIT(7)) +#define HINF_IOENABLE2_V 0x1 +#define HINF_IOENABLE2_S 7 +/* HINF_SDIO_INT_MASK : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define HINF_SDIO_INT_MASK (BIT(6)) +#define HINF_SDIO_INT_MASK_M (BIT(6)) +#define HINF_SDIO_INT_MASK_V 0x1 +#define HINF_SDIO_INT_MASK_S 6 +/* HINF_SDIO_IOREADY2 : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define HINF_SDIO_IOREADY2 (BIT(5)) +#define HINF_SDIO_IOREADY2_M (BIT(5)) +#define HINF_SDIO_IOREADY2_V 0x1 +#define HINF_SDIO_IOREADY2_S 5 +/* HINF_SDIO_CD_ENABLE : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define HINF_SDIO_CD_ENABLE (BIT(4)) +#define HINF_SDIO_CD_ENABLE_M (BIT(4)) +#define HINF_SDIO_CD_ENABLE_V 0x1 +#define HINF_SDIO_CD_ENABLE_S 4 +/* HINF_HIGHSPEED_MODE : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define HINF_HIGHSPEED_MODE (BIT(3)) +#define HINF_HIGHSPEED_MODE_M (BIT(3)) +#define HINF_HIGHSPEED_MODE_V 0x1 +#define HINF_HIGHSPEED_MODE_S 3 +/* HINF_HIGHSPEED_ENABLE : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define HINF_HIGHSPEED_ENABLE (BIT(2)) +#define HINF_HIGHSPEED_ENABLE_M (BIT(2)) +#define HINF_HIGHSPEED_ENABLE_V 0x1 +#define HINF_HIGHSPEED_ENABLE_S 2 +/* HINF_SDIO_IOREADY1 : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define HINF_SDIO_IOREADY1 (BIT(1)) +#define HINF_SDIO_IOREADY1_M (BIT(1)) +#define HINF_SDIO_IOREADY1_V 0x1 +#define HINF_SDIO_IOREADY1_S 1 +/* HINF_SDIO_ENABLE : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define HINF_SDIO_ENABLE (BIT(0)) +#define HINF_SDIO_ENABLE_M (BIT(0)) +#define HINF_SDIO_ENABLE_V 0x1 +#define HINF_SDIO_ENABLE_S 0 + +#define HINF_CFG_DATA7_REG (DR_REG_HINF_BASE + 0x1C) +/* HINF_SDIO_IOREADY0 : R/W ;bitpos:[17] ;default: 1'b1 ; */ +/*description: */ +#define HINF_SDIO_IOREADY0 (BIT(17)) +#define HINF_SDIO_IOREADY0_M (BIT(17)) +#define HINF_SDIO_IOREADY0_V 0x1 +#define HINF_SDIO_IOREADY0_S 17 +/* HINF_SDIO_RST : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define HINF_SDIO_RST (BIT(16)) +#define HINF_SDIO_RST_M (BIT(16)) +#define HINF_SDIO_RST_V 0x1 +#define HINF_SDIO_RST_S 16 +/* HINF_CHIP_STATE : R/W ;bitpos:[15:8] ;default: 8'b0 ; */ +/*description: */ +#define HINF_CHIP_STATE 0x000000FF +#define HINF_CHIP_STATE_M ((HINF_CHIP_STATE_V)<<(HINF_CHIP_STATE_S)) +#define HINF_CHIP_STATE_V 0xFF +#define HINF_CHIP_STATE_S 8 +/* HINF_PIN_STATE : R/W ;bitpos:[7:0] ;default: 8'b0 ; */ +/*description: */ +#define HINF_PIN_STATE 0x000000FF +#define HINF_PIN_STATE_M ((HINF_PIN_STATE_V)<<(HINF_PIN_STATE_S)) +#define HINF_PIN_STATE_V 0xFF +#define HINF_PIN_STATE_S 0 + +#define HINF_CIS_CONF0_REG (DR_REG_HINF_BASE + 0x20) +/* HINF_CIS_CONF_W0 : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ +/*description: */ +#define HINF_CIS_CONF_W0 0xFFFFFFFF +#define HINF_CIS_CONF_W0_M ((HINF_CIS_CONF_W0_V)<<(HINF_CIS_CONF_W0_S)) +#define HINF_CIS_CONF_W0_V 0xFFFFFFFF +#define HINF_CIS_CONF_W0_S 0 + +#define HINF_CIS_CONF1_REG (DR_REG_HINF_BASE + 0x24) +/* HINF_CIS_CONF_W1 : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ +/*description: */ +#define HINF_CIS_CONF_W1 0xFFFFFFFF +#define HINF_CIS_CONF_W1_M ((HINF_CIS_CONF_W1_V)<<(HINF_CIS_CONF_W1_S)) +#define HINF_CIS_CONF_W1_V 0xFFFFFFFF +#define HINF_CIS_CONF_W1_S 0 + +#define HINF_CIS_CONF2_REG (DR_REG_HINF_BASE + 0x28) +/* HINF_CIS_CONF_W2 : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ +/*description: */ +#define HINF_CIS_CONF_W2 0xFFFFFFFF +#define HINF_CIS_CONF_W2_M ((HINF_CIS_CONF_W2_V)<<(HINF_CIS_CONF_W2_S)) +#define HINF_CIS_CONF_W2_V 0xFFFFFFFF +#define HINF_CIS_CONF_W2_S 0 + +#define HINF_CIS_CONF3_REG (DR_REG_HINF_BASE + 0x2C) +/* HINF_CIS_CONF_W3 : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ +/*description: */ +#define HINF_CIS_CONF_W3 0xFFFFFFFF +#define HINF_CIS_CONF_W3_M ((HINF_CIS_CONF_W3_V)<<(HINF_CIS_CONF_W3_S)) +#define HINF_CIS_CONF_W3_V 0xFFFFFFFF +#define HINF_CIS_CONF_W3_S 0 + +#define HINF_CIS_CONF4_REG (DR_REG_HINF_BASE + 0x30) +/* HINF_CIS_CONF_W4 : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ +/*description: */ +#define HINF_CIS_CONF_W4 0xFFFFFFFF +#define HINF_CIS_CONF_W4_M ((HINF_CIS_CONF_W4_V)<<(HINF_CIS_CONF_W4_S)) +#define HINF_CIS_CONF_W4_V 0xFFFFFFFF +#define HINF_CIS_CONF_W4_S 0 + +#define HINF_CIS_CONF5_REG (DR_REG_HINF_BASE + 0x34) +/* HINF_CIS_CONF_W5 : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ +/*description: */ +#define HINF_CIS_CONF_W5 0xFFFFFFFF +#define HINF_CIS_CONF_W5_M ((HINF_CIS_CONF_W5_V)<<(HINF_CIS_CONF_W5_S)) +#define HINF_CIS_CONF_W5_V 0xFFFFFFFF +#define HINF_CIS_CONF_W5_S 0 + +#define HINF_CIS_CONF6_REG (DR_REG_HINF_BASE + 0x38) +/* HINF_CIS_CONF_W6 : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ +/*description: */ +#define HINF_CIS_CONF_W6 0xFFFFFFFF +#define HINF_CIS_CONF_W6_M ((HINF_CIS_CONF_W6_V)<<(HINF_CIS_CONF_W6_S)) +#define HINF_CIS_CONF_W6_V 0xFFFFFFFF +#define HINF_CIS_CONF_W6_S 0 + +#define HINF_CIS_CONF7_REG (DR_REG_HINF_BASE + 0x3C) +/* HINF_CIS_CONF_W7 : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ +/*description: */ +#define HINF_CIS_CONF_W7 0xFFFFFFFF +#define HINF_CIS_CONF_W7_M ((HINF_CIS_CONF_W7_V)<<(HINF_CIS_CONF_W7_S)) +#define HINF_CIS_CONF_W7_V 0xFFFFFFFF +#define HINF_CIS_CONF_W7_S 0 + +#define HINF_CFG_DATA16_REG (DR_REG_HINF_BASE + 0x40) +/* HINF_DEVICE_ID_FN2 : R/W ;bitpos:[31:16] ;default: 16'h3333 ; */ +/*description: */ +#define HINF_DEVICE_ID_FN2 0x0000FFFF +#define HINF_DEVICE_ID_FN2_M ((HINF_DEVICE_ID_FN2_V)<<(HINF_DEVICE_ID_FN2_S)) +#define HINF_DEVICE_ID_FN2_V 0xFFFF +#define HINF_DEVICE_ID_FN2_S 16 +/* HINF_USER_ID_FN2 : R/W ;bitpos:[15:0] ;default: 16'h6666 ; */ +/*description: */ +#define HINF_USER_ID_FN2 0x0000FFFF +#define HINF_USER_ID_FN2_M ((HINF_USER_ID_FN2_V)<<(HINF_USER_ID_FN2_S)) +#define HINF_USER_ID_FN2_V 0xFFFF +#define HINF_USER_ID_FN2_S 0 + +#define HINF_DATE_REG (DR_REG_HINF_BASE + 0xFC) +/* HINF_SDIO_DATE : R/W ;bitpos:[31:0] ;default: 32'h15030200 ; */ +/*description: */ +#define HINF_SDIO_DATE 0xFFFFFFFF +#define HINF_SDIO_DATE_M ((HINF_SDIO_DATE_V)<<(HINF_SDIO_DATE_S)) +#define HINF_SDIO_DATE_V 0xFFFFFFFF +#define HINF_SDIO_DATE_S 0 + + + + +#endif /*_SOC_HINF_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/hinf_struct.h b/components/soc/esp32s2beta/include/soc/hinf_struct.h new file mode 100644 index 0000000000..1c2d9e3b78 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/hinf_struct.h @@ -0,0 +1,134 @@ +// 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_HINF_STRUCT_H_ +#define _SOC_HINF_STRUCT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t user_id_fn1: 16; + uint32_t device_id_fn1:16; + }; + uint32_t val; + } cfg_data0; + union { + struct { + uint32_t sdio_enable: 1; + uint32_t sdio_ioready1: 1; + uint32_t highspeed_enable: 1; + uint32_t highspeed_mode: 1; + uint32_t sdio_cd_enable: 1; + uint32_t sdio_ioready2: 1; + uint32_t sdio_int_mask: 1; + uint32_t ioenable2: 1; + uint32_t cd_disable: 1; + uint32_t func1_eps: 1; + uint32_t emp: 1; + uint32_t ioenable1: 1; + uint32_t sdio20_conf0: 4; + uint32_t sdio_ver: 12; + uint32_t func2_eps: 1; + uint32_t sdio20_conf1: 3; + }; + uint32_t val; + } cfg_data1; + uint32_t reserved_8; + uint32_t reserved_c; + uint32_t reserved_10; + uint32_t reserved_14; + uint32_t reserved_18; + union { + struct { + uint32_t pin_state: 8; + uint32_t chip_state: 8; + uint32_t sdio_rst: 1; + uint32_t sdio_ioready0: 1; + uint32_t reserved18: 14; + }; + uint32_t val; + } cfg_data7; + uint32_t cis_conf0; /**/ + uint32_t cis_conf1; /**/ + uint32_t cis_conf2; /**/ + uint32_t cis_conf3; /**/ + uint32_t cis_conf4; /**/ + uint32_t cis_conf5; /**/ + uint32_t cis_conf6; /**/ + uint32_t cis_conf7; /**/ + union { + struct { + uint32_t user_id_fn2: 16; + uint32_t device_id_fn2:16; + }; + uint32_t val; + } cfg_data16; + uint32_t reserved_44; + uint32_t reserved_48; + uint32_t reserved_4c; + uint32_t reserved_50; + uint32_t reserved_54; + uint32_t reserved_58; + uint32_t reserved_5c; + uint32_t reserved_60; + uint32_t reserved_64; + uint32_t reserved_68; + uint32_t reserved_6c; + uint32_t reserved_70; + uint32_t reserved_74; + uint32_t reserved_78; + uint32_t reserved_7c; + uint32_t reserved_80; + uint32_t reserved_84; + uint32_t reserved_88; + uint32_t reserved_8c; + uint32_t reserved_90; + uint32_t reserved_94; + uint32_t reserved_98; + uint32_t reserved_9c; + uint32_t reserved_a0; + uint32_t reserved_a4; + uint32_t reserved_a8; + uint32_t reserved_ac; + uint32_t reserved_b0; + uint32_t reserved_b4; + uint32_t reserved_b8; + uint32_t reserved_bc; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t date; /**/ +} hinf_dev_t; +extern hinf_dev_t HINF; + +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_HINF_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/host_reg.h b/components/soc/esp32s2beta/include/soc/host_reg.h new file mode 100644 index 0000000000..37aa621467 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/host_reg.h @@ -0,0 +1,1806 @@ +// Copyright 2017-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_HOST_REG_H_ +#define _SOC_HOST_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define HOST_SLCHOST_FUNC2_2_REG (DR_REG_SLCHOST_BASE + 0x20) +/* HOST_SLC_FUNC1_MDSTAT : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define HOST_SLC_FUNC1_MDSTAT (BIT(0)) +#define HOST_SLC_FUNC1_MDSTAT_M (BIT(0)) +#define HOST_SLC_FUNC1_MDSTAT_V 0x1 +#define HOST_SLC_FUNC1_MDSTAT_S 0 + +#define HOST_SLCHOST_GPIO_STATUS0_REG (DR_REG_SLCHOST_BASE + 0x34) +/* HOST_GPIO_SDIO_INT0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define HOST_GPIO_SDIO_INT0 0xFFFFFFFF +#define HOST_GPIO_SDIO_INT0_M ((HOST_GPIO_SDIO_INT0_V)<<(HOST_GPIO_SDIO_INT0_S)) +#define HOST_GPIO_SDIO_INT0_V 0xFFFFFFFF +#define HOST_GPIO_SDIO_INT0_S 0 + +#define HOST_SLCHOST_GPIO_STATUS1_REG (DR_REG_SLCHOST_BASE + 0x38) +/* HOST_GPIO_SDIO_INT1 : RO ;bitpos:[21:0] ;default: 22'b0 ; */ +/*description: */ +#define HOST_GPIO_SDIO_INT1 0x003FFFFF +#define HOST_GPIO_SDIO_INT1_M ((HOST_GPIO_SDIO_INT1_V)<<(HOST_GPIO_SDIO_INT1_S)) +#define HOST_GPIO_SDIO_INT1_V 0x3FFFFF +#define HOST_GPIO_SDIO_INT1_S 0 + +#define HOST_SLCHOST_GPIO_IN0_REG (DR_REG_SLCHOST_BASE + 0x3C) +/* HOST_GPIO_SDIO_IN0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define HOST_GPIO_SDIO_IN0 0xFFFFFFFF +#define HOST_GPIO_SDIO_IN0_M ((HOST_GPIO_SDIO_IN0_V)<<(HOST_GPIO_SDIO_IN0_S)) +#define HOST_GPIO_SDIO_IN0_V 0xFFFFFFFF +#define HOST_GPIO_SDIO_IN0_S 0 + +#define HOST_SLCHOST_GPIO_IN1_REG (DR_REG_SLCHOST_BASE + 0x40) +/* HOST_GPIO_SDIO_IN1 : RO ;bitpos:[21:0] ;default: 22'b0 ; */ +/*description: */ +#define HOST_GPIO_SDIO_IN1 0x003FFFFF +#define HOST_GPIO_SDIO_IN1_M ((HOST_GPIO_SDIO_IN1_V)<<(HOST_GPIO_SDIO_IN1_S)) +#define HOST_GPIO_SDIO_IN1_V 0x3FFFFF +#define HOST_GPIO_SDIO_IN1_S 0 + +#define HOST_SLC0HOST_TOKEN_RDATA_REG (DR_REG_SLCHOST_BASE + 0x44) +/* HOST_SLC0_RX_PF_EOF : RO ;bitpos:[31:28] ;default: 4'h0 ; */ +/*description: */ +#define HOST_SLC0_RX_PF_EOF 0x0000000F +#define HOST_SLC0_RX_PF_EOF_M ((HOST_SLC0_RX_PF_EOF_V)<<(HOST_SLC0_RX_PF_EOF_S)) +#define HOST_SLC0_RX_PF_EOF_V 0xF +#define HOST_SLC0_RX_PF_EOF_S 28 +/* HOST_HOSTSLC0_TOKEN1 : RO ;bitpos:[27:16] ;default: 12'h0 ; */ +/*description: */ +#define HOST_HOSTSLC0_TOKEN1 0x00000FFF +#define HOST_HOSTSLC0_TOKEN1_M ((HOST_HOSTSLC0_TOKEN1_V)<<(HOST_HOSTSLC0_TOKEN1_S)) +#define HOST_HOSTSLC0_TOKEN1_V 0xFFF +#define HOST_HOSTSLC0_TOKEN1_S 16 +/* HOST_SLC0_RX_PF_VALID : RO ;bitpos:[12] ;default: 4'h0 ; */ +/*description: */ +#define HOST_SLC0_RX_PF_VALID (BIT(12)) +#define HOST_SLC0_RX_PF_VALID_M (BIT(12)) +#define HOST_SLC0_RX_PF_VALID_V 0x1 +#define HOST_SLC0_RX_PF_VALID_S 12 +/* HOST_SLC0_TOKEN0 : RO ;bitpos:[11:0] ;default: 12'h0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0 0x00000FFF +#define HOST_SLC0_TOKEN0_M ((HOST_SLC0_TOKEN0_V)<<(HOST_SLC0_TOKEN0_S)) +#define HOST_SLC0_TOKEN0_V 0xFFF +#define HOST_SLC0_TOKEN0_S 0 + +#define HOST_SLC0_HOST_PF_REG (DR_REG_SLCHOST_BASE + 0x48) +/* HOST_SLC0_PF_DATA : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define HOST_SLC0_PF_DATA 0xFFFFFFFF +#define HOST_SLC0_PF_DATA_M ((HOST_SLC0_PF_DATA_V)<<(HOST_SLC0_PF_DATA_S)) +#define HOST_SLC0_PF_DATA_V 0xFFFFFFFF +#define HOST_SLC0_PF_DATA_S 0 + +#define HOST_SLC0HOST_INT_RAW_REG (DR_REG_SLCHOST_BASE + 0x50) +/* HOST_GPIO_SDIO_INT_RAW : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define HOST_GPIO_SDIO_INT_RAW (BIT(25)) +#define HOST_GPIO_SDIO_INT_RAW_M (BIT(25)) +#define HOST_GPIO_SDIO_INT_RAW_V 0x1 +#define HOST_GPIO_SDIO_INT_RAW_S 25 +/* HOST_SLC0_HOST_RD_RETRY_INT_RAW : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_HOST_RD_RETRY_INT_RAW (BIT(24)) +#define HOST_SLC0_HOST_RD_RETRY_INT_RAW_M (BIT(24)) +#define HOST_SLC0_HOST_RD_RETRY_INT_RAW_V 0x1 +#define HOST_SLC0_HOST_RD_RETRY_INT_RAW_S 24 +/* HOST_SLC0_RX_NEW_PACKET_INT_RAW : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_NEW_PACKET_INT_RAW (BIT(23)) +#define HOST_SLC0_RX_NEW_PACKET_INT_RAW_M (BIT(23)) +#define HOST_SLC0_RX_NEW_PACKET_INT_RAW_V 0x1 +#define HOST_SLC0_RX_NEW_PACKET_INT_RAW_S 23 +/* HOST_SLC0_EXT_BIT3_INT_RAW : RO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT3_INT_RAW (BIT(22)) +#define HOST_SLC0_EXT_BIT3_INT_RAW_M (BIT(22)) +#define HOST_SLC0_EXT_BIT3_INT_RAW_V 0x1 +#define HOST_SLC0_EXT_BIT3_INT_RAW_S 22 +/* HOST_SLC0_EXT_BIT2_INT_RAW : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT2_INT_RAW (BIT(21)) +#define HOST_SLC0_EXT_BIT2_INT_RAW_M (BIT(21)) +#define HOST_SLC0_EXT_BIT2_INT_RAW_V 0x1 +#define HOST_SLC0_EXT_BIT2_INT_RAW_S 21 +/* HOST_SLC0_EXT_BIT1_INT_RAW : RO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT1_INT_RAW (BIT(20)) +#define HOST_SLC0_EXT_BIT1_INT_RAW_M (BIT(20)) +#define HOST_SLC0_EXT_BIT1_INT_RAW_V 0x1 +#define HOST_SLC0_EXT_BIT1_INT_RAW_S 20 +/* HOST_SLC0_EXT_BIT0_INT_RAW : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT0_INT_RAW (BIT(19)) +#define HOST_SLC0_EXT_BIT0_INT_RAW_M (BIT(19)) +#define HOST_SLC0_EXT_BIT0_INT_RAW_V 0x1 +#define HOST_SLC0_EXT_BIT0_INT_RAW_S 19 +/* HOST_SLC0_RX_PF_VALID_INT_RAW : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_PF_VALID_INT_RAW (BIT(18)) +#define HOST_SLC0_RX_PF_VALID_INT_RAW_M (BIT(18)) +#define HOST_SLC0_RX_PF_VALID_INT_RAW_V 0x1 +#define HOST_SLC0_RX_PF_VALID_INT_RAW_S 18 +/* HOST_SLC0_TX_OVF_INT_RAW : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TX_OVF_INT_RAW (BIT(17)) +#define HOST_SLC0_TX_OVF_INT_RAW_M (BIT(17)) +#define HOST_SLC0_TX_OVF_INT_RAW_V 0x1 +#define HOST_SLC0_TX_OVF_INT_RAW_S 17 +/* HOST_SLC0_RX_UDF_INT_RAW : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_UDF_INT_RAW (BIT(16)) +#define HOST_SLC0_RX_UDF_INT_RAW_M (BIT(16)) +#define HOST_SLC0_RX_UDF_INT_RAW_V 0x1 +#define HOST_SLC0_RX_UDF_INT_RAW_S 16 +/* HOST_SLC0HOST_TX_START_INT_RAW : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_TX_START_INT_RAW (BIT(15)) +#define HOST_SLC0HOST_TX_START_INT_RAW_M (BIT(15)) +#define HOST_SLC0HOST_TX_START_INT_RAW_V 0x1 +#define HOST_SLC0HOST_TX_START_INT_RAW_S 15 +/* HOST_SLC0HOST_RX_START_INT_RAW : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_START_INT_RAW (BIT(14)) +#define HOST_SLC0HOST_RX_START_INT_RAW_M (BIT(14)) +#define HOST_SLC0HOST_RX_START_INT_RAW_V 0x1 +#define HOST_SLC0HOST_RX_START_INT_RAW_S 14 +/* HOST_SLC0HOST_RX_EOF_INT_RAW : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_EOF_INT_RAW (BIT(13)) +#define HOST_SLC0HOST_RX_EOF_INT_RAW_M (BIT(13)) +#define HOST_SLC0HOST_RX_EOF_INT_RAW_V 0x1 +#define HOST_SLC0HOST_RX_EOF_INT_RAW_S 13 +/* HOST_SLC0HOST_RX_SOF_INT_RAW : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_SOF_INT_RAW (BIT(12)) +#define HOST_SLC0HOST_RX_SOF_INT_RAW_M (BIT(12)) +#define HOST_SLC0HOST_RX_SOF_INT_RAW_V 0x1 +#define HOST_SLC0HOST_RX_SOF_INT_RAW_S 12 +/* HOST_SLC0_TOKEN1_0TO1_INT_RAW : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN1_0TO1_INT_RAW (BIT(11)) +#define HOST_SLC0_TOKEN1_0TO1_INT_RAW_M (BIT(11)) +#define HOST_SLC0_TOKEN1_0TO1_INT_RAW_V 0x1 +#define HOST_SLC0_TOKEN1_0TO1_INT_RAW_S 11 +/* HOST_SLC0_TOKEN0_0TO1_INT_RAW : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0_0TO1_INT_RAW (BIT(10)) +#define HOST_SLC0_TOKEN0_0TO1_INT_RAW_M (BIT(10)) +#define HOST_SLC0_TOKEN0_0TO1_INT_RAW_V 0x1 +#define HOST_SLC0_TOKEN0_0TO1_INT_RAW_S 10 +/* HOST_SLC0_TOKEN1_1TO0_INT_RAW : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN1_1TO0_INT_RAW (BIT(9)) +#define HOST_SLC0_TOKEN1_1TO0_INT_RAW_M (BIT(9)) +#define HOST_SLC0_TOKEN1_1TO0_INT_RAW_V 0x1 +#define HOST_SLC0_TOKEN1_1TO0_INT_RAW_S 9 +/* HOST_SLC0_TOKEN0_1TO0_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0_1TO0_INT_RAW (BIT(8)) +#define HOST_SLC0_TOKEN0_1TO0_INT_RAW_M (BIT(8)) +#define HOST_SLC0_TOKEN0_1TO0_INT_RAW_V 0x1 +#define HOST_SLC0_TOKEN0_1TO0_INT_RAW_S 8 +/* HOST_SLC0_TOHOST_BIT7_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT7_INT_RAW (BIT(7)) +#define HOST_SLC0_TOHOST_BIT7_INT_RAW_M (BIT(7)) +#define HOST_SLC0_TOHOST_BIT7_INT_RAW_V 0x1 +#define HOST_SLC0_TOHOST_BIT7_INT_RAW_S 7 +/* HOST_SLC0_TOHOST_BIT6_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT6_INT_RAW (BIT(6)) +#define HOST_SLC0_TOHOST_BIT6_INT_RAW_M (BIT(6)) +#define HOST_SLC0_TOHOST_BIT6_INT_RAW_V 0x1 +#define HOST_SLC0_TOHOST_BIT6_INT_RAW_S 6 +/* HOST_SLC0_TOHOST_BIT5_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT5_INT_RAW (BIT(5)) +#define HOST_SLC0_TOHOST_BIT5_INT_RAW_M (BIT(5)) +#define HOST_SLC0_TOHOST_BIT5_INT_RAW_V 0x1 +#define HOST_SLC0_TOHOST_BIT5_INT_RAW_S 5 +/* HOST_SLC0_TOHOST_BIT4_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT4_INT_RAW (BIT(4)) +#define HOST_SLC0_TOHOST_BIT4_INT_RAW_M (BIT(4)) +#define HOST_SLC0_TOHOST_BIT4_INT_RAW_V 0x1 +#define HOST_SLC0_TOHOST_BIT4_INT_RAW_S 4 +/* HOST_SLC0_TOHOST_BIT3_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT3_INT_RAW (BIT(3)) +#define HOST_SLC0_TOHOST_BIT3_INT_RAW_M (BIT(3)) +#define HOST_SLC0_TOHOST_BIT3_INT_RAW_V 0x1 +#define HOST_SLC0_TOHOST_BIT3_INT_RAW_S 3 +/* HOST_SLC0_TOHOST_BIT2_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT2_INT_RAW (BIT(2)) +#define HOST_SLC0_TOHOST_BIT2_INT_RAW_M (BIT(2)) +#define HOST_SLC0_TOHOST_BIT2_INT_RAW_V 0x1 +#define HOST_SLC0_TOHOST_BIT2_INT_RAW_S 2 +/* HOST_SLC0_TOHOST_BIT1_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT1_INT_RAW (BIT(1)) +#define HOST_SLC0_TOHOST_BIT1_INT_RAW_M (BIT(1)) +#define HOST_SLC0_TOHOST_BIT1_INT_RAW_V 0x1 +#define HOST_SLC0_TOHOST_BIT1_INT_RAW_S 1 +/* HOST_SLC0_TOHOST_BIT0_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT0_INT_RAW (BIT(0)) +#define HOST_SLC0_TOHOST_BIT0_INT_RAW_M (BIT(0)) +#define HOST_SLC0_TOHOST_BIT0_INT_RAW_V 0x1 +#define HOST_SLC0_TOHOST_BIT0_INT_RAW_S 0 + +#define HOST_SLC0HOST_INT_ST_REG (DR_REG_SLCHOST_BASE + 0x58) +/* HOST_GPIO_SDIO_INT_ST : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define HOST_GPIO_SDIO_INT_ST (BIT(25)) +#define HOST_GPIO_SDIO_INT_ST_M (BIT(25)) +#define HOST_GPIO_SDIO_INT_ST_V 0x1 +#define HOST_GPIO_SDIO_INT_ST_S 25 +/* HOST_SLC0_HOST_RD_RETRY_INT_ST : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_HOST_RD_RETRY_INT_ST (BIT(24)) +#define HOST_SLC0_HOST_RD_RETRY_INT_ST_M (BIT(24)) +#define HOST_SLC0_HOST_RD_RETRY_INT_ST_V 0x1 +#define HOST_SLC0_HOST_RD_RETRY_INT_ST_S 24 +/* HOST_SLC0_RX_NEW_PACKET_INT_ST : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_NEW_PACKET_INT_ST (BIT(23)) +#define HOST_SLC0_RX_NEW_PACKET_INT_ST_M (BIT(23)) +#define HOST_SLC0_RX_NEW_PACKET_INT_ST_V 0x1 +#define HOST_SLC0_RX_NEW_PACKET_INT_ST_S 23 +/* HOST_SLC0_EXT_BIT3_INT_ST : RO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT3_INT_ST (BIT(22)) +#define HOST_SLC0_EXT_BIT3_INT_ST_M (BIT(22)) +#define HOST_SLC0_EXT_BIT3_INT_ST_V 0x1 +#define HOST_SLC0_EXT_BIT3_INT_ST_S 22 +/* HOST_SLC0_EXT_BIT2_INT_ST : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT2_INT_ST (BIT(21)) +#define HOST_SLC0_EXT_BIT2_INT_ST_M (BIT(21)) +#define HOST_SLC0_EXT_BIT2_INT_ST_V 0x1 +#define HOST_SLC0_EXT_BIT2_INT_ST_S 21 +/* HOST_SLC0_EXT_BIT1_INT_ST : RO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT1_INT_ST (BIT(20)) +#define HOST_SLC0_EXT_BIT1_INT_ST_M (BIT(20)) +#define HOST_SLC0_EXT_BIT1_INT_ST_V 0x1 +#define HOST_SLC0_EXT_BIT1_INT_ST_S 20 +/* HOST_SLC0_EXT_BIT0_INT_ST : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT0_INT_ST (BIT(19)) +#define HOST_SLC0_EXT_BIT0_INT_ST_M (BIT(19)) +#define HOST_SLC0_EXT_BIT0_INT_ST_V 0x1 +#define HOST_SLC0_EXT_BIT0_INT_ST_S 19 +/* HOST_SLC0_RX_PF_VALID_INT_ST : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_PF_VALID_INT_ST (BIT(18)) +#define HOST_SLC0_RX_PF_VALID_INT_ST_M (BIT(18)) +#define HOST_SLC0_RX_PF_VALID_INT_ST_V 0x1 +#define HOST_SLC0_RX_PF_VALID_INT_ST_S 18 +/* HOST_SLC0_TX_OVF_INT_ST : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TX_OVF_INT_ST (BIT(17)) +#define HOST_SLC0_TX_OVF_INT_ST_M (BIT(17)) +#define HOST_SLC0_TX_OVF_INT_ST_V 0x1 +#define HOST_SLC0_TX_OVF_INT_ST_S 17 +/* HOST_SLC0_RX_UDF_INT_ST : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_UDF_INT_ST (BIT(16)) +#define HOST_SLC0_RX_UDF_INT_ST_M (BIT(16)) +#define HOST_SLC0_RX_UDF_INT_ST_V 0x1 +#define HOST_SLC0_RX_UDF_INT_ST_S 16 +/* HOST_SLC0HOST_TX_START_INT_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_TX_START_INT_ST (BIT(15)) +#define HOST_SLC0HOST_TX_START_INT_ST_M (BIT(15)) +#define HOST_SLC0HOST_TX_START_INT_ST_V 0x1 +#define HOST_SLC0HOST_TX_START_INT_ST_S 15 +/* HOST_SLC0HOST_RX_START_INT_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_START_INT_ST (BIT(14)) +#define HOST_SLC0HOST_RX_START_INT_ST_M (BIT(14)) +#define HOST_SLC0HOST_RX_START_INT_ST_V 0x1 +#define HOST_SLC0HOST_RX_START_INT_ST_S 14 +/* HOST_SLC0HOST_RX_EOF_INT_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_EOF_INT_ST (BIT(13)) +#define HOST_SLC0HOST_RX_EOF_INT_ST_M (BIT(13)) +#define HOST_SLC0HOST_RX_EOF_INT_ST_V 0x1 +#define HOST_SLC0HOST_RX_EOF_INT_ST_S 13 +/* HOST_SLC0HOST_RX_SOF_INT_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_SOF_INT_ST (BIT(12)) +#define HOST_SLC0HOST_RX_SOF_INT_ST_M (BIT(12)) +#define HOST_SLC0HOST_RX_SOF_INT_ST_V 0x1 +#define HOST_SLC0HOST_RX_SOF_INT_ST_S 12 +/* HOST_SLC0_TOKEN1_0TO1_INT_ST : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN1_0TO1_INT_ST (BIT(11)) +#define HOST_SLC0_TOKEN1_0TO1_INT_ST_M (BIT(11)) +#define HOST_SLC0_TOKEN1_0TO1_INT_ST_V 0x1 +#define HOST_SLC0_TOKEN1_0TO1_INT_ST_S 11 +/* HOST_SLC0_TOKEN0_0TO1_INT_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0_0TO1_INT_ST (BIT(10)) +#define HOST_SLC0_TOKEN0_0TO1_INT_ST_M (BIT(10)) +#define HOST_SLC0_TOKEN0_0TO1_INT_ST_V 0x1 +#define HOST_SLC0_TOKEN0_0TO1_INT_ST_S 10 +/* HOST_SLC0_TOKEN1_1TO0_INT_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN1_1TO0_INT_ST (BIT(9)) +#define HOST_SLC0_TOKEN1_1TO0_INT_ST_M (BIT(9)) +#define HOST_SLC0_TOKEN1_1TO0_INT_ST_V 0x1 +#define HOST_SLC0_TOKEN1_1TO0_INT_ST_S 9 +/* HOST_SLC0_TOKEN0_1TO0_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0_1TO0_INT_ST (BIT(8)) +#define HOST_SLC0_TOKEN0_1TO0_INT_ST_M (BIT(8)) +#define HOST_SLC0_TOKEN0_1TO0_INT_ST_V 0x1 +#define HOST_SLC0_TOKEN0_1TO0_INT_ST_S 8 +/* HOST_SLC0_TOHOST_BIT7_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT7_INT_ST (BIT(7)) +#define HOST_SLC0_TOHOST_BIT7_INT_ST_M (BIT(7)) +#define HOST_SLC0_TOHOST_BIT7_INT_ST_V 0x1 +#define HOST_SLC0_TOHOST_BIT7_INT_ST_S 7 +/* HOST_SLC0_TOHOST_BIT6_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT6_INT_ST (BIT(6)) +#define HOST_SLC0_TOHOST_BIT6_INT_ST_M (BIT(6)) +#define HOST_SLC0_TOHOST_BIT6_INT_ST_V 0x1 +#define HOST_SLC0_TOHOST_BIT6_INT_ST_S 6 +/* HOST_SLC0_TOHOST_BIT5_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT5_INT_ST (BIT(5)) +#define HOST_SLC0_TOHOST_BIT5_INT_ST_M (BIT(5)) +#define HOST_SLC0_TOHOST_BIT5_INT_ST_V 0x1 +#define HOST_SLC0_TOHOST_BIT5_INT_ST_S 5 +/* HOST_SLC0_TOHOST_BIT4_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT4_INT_ST (BIT(4)) +#define HOST_SLC0_TOHOST_BIT4_INT_ST_M (BIT(4)) +#define HOST_SLC0_TOHOST_BIT4_INT_ST_V 0x1 +#define HOST_SLC0_TOHOST_BIT4_INT_ST_S 4 +/* HOST_SLC0_TOHOST_BIT3_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT3_INT_ST (BIT(3)) +#define HOST_SLC0_TOHOST_BIT3_INT_ST_M (BIT(3)) +#define HOST_SLC0_TOHOST_BIT3_INT_ST_V 0x1 +#define HOST_SLC0_TOHOST_BIT3_INT_ST_S 3 +/* HOST_SLC0_TOHOST_BIT2_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT2_INT_ST (BIT(2)) +#define HOST_SLC0_TOHOST_BIT2_INT_ST_M (BIT(2)) +#define HOST_SLC0_TOHOST_BIT2_INT_ST_V 0x1 +#define HOST_SLC0_TOHOST_BIT2_INT_ST_S 2 +/* HOST_SLC0_TOHOST_BIT1_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT1_INT_ST (BIT(1)) +#define HOST_SLC0_TOHOST_BIT1_INT_ST_M (BIT(1)) +#define HOST_SLC0_TOHOST_BIT1_INT_ST_V 0x1 +#define HOST_SLC0_TOHOST_BIT1_INT_ST_S 1 +/* HOST_SLC0_TOHOST_BIT0_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT0_INT_ST (BIT(0)) +#define HOST_SLC0_TOHOST_BIT0_INT_ST_M (BIT(0)) +#define HOST_SLC0_TOHOST_BIT0_INT_ST_V 0x1 +#define HOST_SLC0_TOHOST_BIT0_INT_ST_S 0 + +#define HOST_SLCHOST_PKT_LEN_REG (DR_REG_SLCHOST_BASE + 0x60) +/* HOST_HOSTSLC0_LEN_CHECK : RO ;bitpos:[31:20] ;default: 10'h0 ; */ +/*description: */ +#define HOST_HOSTSLC0_LEN_CHECK 0x00000FFF +#define HOST_HOSTSLC0_LEN_CHECK_M ((HOST_HOSTSLC0_LEN_CHECK_V)<<(HOST_HOSTSLC0_LEN_CHECK_S)) +#define HOST_HOSTSLC0_LEN_CHECK_V 0xFFF +#define HOST_HOSTSLC0_LEN_CHECK_S 20 +/* HOST_HOSTSLC0_LEN : RO ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define HOST_HOSTSLC0_LEN 0x000FFFFF +#define HOST_HOSTSLC0_LEN_M ((HOST_HOSTSLC0_LEN_V)<<(HOST_HOSTSLC0_LEN_S)) +#define HOST_HOSTSLC0_LEN_V 0xFFFFF +#define HOST_HOSTSLC0_LEN_S 0 + +#define HOST_SLCHOST_STATE_W0_REG (DR_REG_SLCHOST_BASE + 0x64) +/* HOST_SLCHOST_STATE3 : RO ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_STATE3 0x000000FF +#define HOST_SLCHOST_STATE3_M ((HOST_SLCHOST_STATE3_V)<<(HOST_SLCHOST_STATE3_S)) +#define HOST_SLCHOST_STATE3_V 0xFF +#define HOST_SLCHOST_STATE3_S 24 +/* HOST_SLCHOST_STATE2 : RO ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_STATE2 0x000000FF +#define HOST_SLCHOST_STATE2_M ((HOST_SLCHOST_STATE2_V)<<(HOST_SLCHOST_STATE2_S)) +#define HOST_SLCHOST_STATE2_V 0xFF +#define HOST_SLCHOST_STATE2_S 16 +/* HOST_SLCHOST_STATE1 : RO ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_STATE1 0x000000FF +#define HOST_SLCHOST_STATE1_M ((HOST_SLCHOST_STATE1_V)<<(HOST_SLCHOST_STATE1_S)) +#define HOST_SLCHOST_STATE1_V 0xFF +#define HOST_SLCHOST_STATE1_S 8 +/* HOST_SLCHOST_STATE0 : RO ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_STATE0 0x000000FF +#define HOST_SLCHOST_STATE0_M ((HOST_SLCHOST_STATE0_V)<<(HOST_SLCHOST_STATE0_S)) +#define HOST_SLCHOST_STATE0_V 0xFF +#define HOST_SLCHOST_STATE0_S 0 + +#define HOST_SLCHOST_STATE_W1_REG (DR_REG_SLCHOST_BASE + 0x68) +/* HOST_SLCHOST_STATE7 : RO ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_STATE7 0x000000FF +#define HOST_SLCHOST_STATE7_M ((HOST_SLCHOST_STATE7_V)<<(HOST_SLCHOST_STATE7_S)) +#define HOST_SLCHOST_STATE7_V 0xFF +#define HOST_SLCHOST_STATE7_S 24 +/* HOST_SLCHOST_STATE6 : RO ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_STATE6 0x000000FF +#define HOST_SLCHOST_STATE6_M ((HOST_SLCHOST_STATE6_V)<<(HOST_SLCHOST_STATE6_S)) +#define HOST_SLCHOST_STATE6_V 0xFF +#define HOST_SLCHOST_STATE6_S 16 +/* HOST_SLCHOST_STATE5 : RO ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_STATE5 0x000000FF +#define HOST_SLCHOST_STATE5_M ((HOST_SLCHOST_STATE5_V)<<(HOST_SLCHOST_STATE5_S)) +#define HOST_SLCHOST_STATE5_V 0xFF +#define HOST_SLCHOST_STATE5_S 8 +/* HOST_SLCHOST_STATE4 : RO ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_STATE4 0x000000FF +#define HOST_SLCHOST_STATE4_M ((HOST_SLCHOST_STATE4_V)<<(HOST_SLCHOST_STATE4_S)) +#define HOST_SLCHOST_STATE4_V 0xFF +#define HOST_SLCHOST_STATE4_S 0 + +#define HOST_SLCHOST_CONF_W_REG(pos) (HOST_SLCHOST_CONF_W0_REG+pos+(pos>23?4:0)+(pos>31?12:0)) + +#define HOST_SLCHOST_CONF_W0_REG (DR_REG_SLCHOST_BASE + 0x6C) +/* HOST_SLCHOST_CONF3 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF3 0x000000FF +#define HOST_SLCHOST_CONF3_M ((HOST_SLCHOST_CONF3_V)<<(HOST_SLCHOST_CONF3_S)) +#define HOST_SLCHOST_CONF3_V 0xFF +#define HOST_SLCHOST_CONF3_S 24 +/* HOST_SLCHOST_CONF2 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF2 0x000000FF +#define HOST_SLCHOST_CONF2_M ((HOST_SLCHOST_CONF2_V)<<(HOST_SLCHOST_CONF2_S)) +#define HOST_SLCHOST_CONF2_V 0xFF +#define HOST_SLCHOST_CONF2_S 16 +/* HOST_SLCHOST_CONF1 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF1 0x000000FF +#define HOST_SLCHOST_CONF1_M ((HOST_SLCHOST_CONF1_V)<<(HOST_SLCHOST_CONF1_S)) +#define HOST_SLCHOST_CONF1_V 0xFF +#define HOST_SLCHOST_CONF1_S 8 +/* HOST_SLCHOST_CONF0 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF0 0x000000FF +#define HOST_SLCHOST_CONF0_M ((HOST_SLCHOST_CONF0_V)<<(HOST_SLCHOST_CONF0_S)) +#define HOST_SLCHOST_CONF0_V 0xFF +#define HOST_SLCHOST_CONF0_S 0 + +#define HOST_SLCHOST_CONF_W1_REG (DR_REG_SLCHOST_BASE + 0x70) +/* HOST_SLCHOST_CONF7 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF7 0x000000FF +#define HOST_SLCHOST_CONF7_M ((HOST_SLCHOST_CONF7_V)<<(HOST_SLCHOST_CONF7_S)) +#define HOST_SLCHOST_CONF7_V 0xFF +#define HOST_SLCHOST_CONF7_S 24 +/* HOST_SLCHOST_CONF6 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF6 0x000000FF +#define HOST_SLCHOST_CONF6_M ((HOST_SLCHOST_CONF6_V)<<(HOST_SLCHOST_CONF6_S)) +#define HOST_SLCHOST_CONF6_V 0xFF +#define HOST_SLCHOST_CONF6_S 16 +/* HOST_SLCHOST_CONF5 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF5 0x000000FF +#define HOST_SLCHOST_CONF5_M ((HOST_SLCHOST_CONF5_V)<<(HOST_SLCHOST_CONF5_S)) +#define HOST_SLCHOST_CONF5_V 0xFF +#define HOST_SLCHOST_CONF5_S 8 +/* HOST_SLCHOST_CONF4 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF4 0x000000FF +#define HOST_SLCHOST_CONF4_M ((HOST_SLCHOST_CONF4_V)<<(HOST_SLCHOST_CONF4_S)) +#define HOST_SLCHOST_CONF4_V 0xFF +#define HOST_SLCHOST_CONF4_S 0 + +#define HOST_SLCHOST_CONF_W2_REG (DR_REG_SLCHOST_BASE + 0x74) +/* HOST_SLCHOST_CONF11 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF11 0x000000FF +#define HOST_SLCHOST_CONF11_M ((HOST_SLCHOST_CONF11_V)<<(HOST_SLCHOST_CONF11_S)) +#define HOST_SLCHOST_CONF11_V 0xFF +#define HOST_SLCHOST_CONF11_S 24 +/* HOST_SLCHOST_CONF10 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF10 0x000000FF +#define HOST_SLCHOST_CONF10_M ((HOST_SLCHOST_CONF10_V)<<(HOST_SLCHOST_CONF10_S)) +#define HOST_SLCHOST_CONF10_V 0xFF +#define HOST_SLCHOST_CONF10_S 16 +/* HOST_SLCHOST_CONF9 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF9 0x000000FF +#define HOST_SLCHOST_CONF9_M ((HOST_SLCHOST_CONF9_V)<<(HOST_SLCHOST_CONF9_S)) +#define HOST_SLCHOST_CONF9_V 0xFF +#define HOST_SLCHOST_CONF9_S 8 +/* HOST_SLCHOST_CONF8 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF8 0x000000FF +#define HOST_SLCHOST_CONF8_M ((HOST_SLCHOST_CONF8_V)<<(HOST_SLCHOST_CONF8_S)) +#define HOST_SLCHOST_CONF8_V 0xFF +#define HOST_SLCHOST_CONF8_S 0 + +#define HOST_SLCHOST_CONF_W3_REG (DR_REG_SLCHOST_BASE + 0x78) +/* HOST_SLCHOST_CONF15 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF15 0x000000FF +#define HOST_SLCHOST_CONF15_M ((HOST_SLCHOST_CONF15_V)<<(HOST_SLCHOST_CONF15_S)) +#define HOST_SLCHOST_CONF15_V 0xFF +#define HOST_SLCHOST_CONF15_S 24 +/* HOST_SLCHOST_CONF14 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF14 0x000000FF +#define HOST_SLCHOST_CONF14_M ((HOST_SLCHOST_CONF14_V)<<(HOST_SLCHOST_CONF14_S)) +#define HOST_SLCHOST_CONF14_V 0xFF +#define HOST_SLCHOST_CONF14_S 16 +/* HOST_SLCHOST_CONF13 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF13 0x000000FF +#define HOST_SLCHOST_CONF13_M ((HOST_SLCHOST_CONF13_V)<<(HOST_SLCHOST_CONF13_S)) +#define HOST_SLCHOST_CONF13_V 0xFF +#define HOST_SLCHOST_CONF13_S 8 +/* HOST_SLCHOST_CONF12 : R/W ;bitpos:[7:0] ;default: 8'hc0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF12 0x000000FF +#define HOST_SLCHOST_CONF12_M ((HOST_SLCHOST_CONF12_V)<<(HOST_SLCHOST_CONF12_S)) +#define HOST_SLCHOST_CONF12_V 0xFF +#define HOST_SLCHOST_CONF12_S 0 + +#define HOST_SLCHOST_CONF_W4_REG (DR_REG_SLCHOST_BASE + 0x7C) +/* HOST_SLCHOST_CONF19 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: Interrupt to target CPU*/ +#define HOST_SLCHOST_CONF19 0x000000FF +#define HOST_SLCHOST_CONF19_M ((HOST_SLCHOST_CONF19_V)<<(HOST_SLCHOST_CONF19_S)) +#define HOST_SLCHOST_CONF19_V 0xFF +#define HOST_SLCHOST_CONF19_S 24 +/* HOST_SLCHOST_CONF18 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF18 0x000000FF +#define HOST_SLCHOST_CONF18_M ((HOST_SLCHOST_CONF18_V)<<(HOST_SLCHOST_CONF18_S)) +#define HOST_SLCHOST_CONF18_V 0xFF +#define HOST_SLCHOST_CONF18_S 16 +/* HOST_SLCHOST_CONF17 : R/W ;bitpos:[15:8] ;default: 8'h1 ; */ +/*description: SLC timeout enable*/ +#define HOST_SLCHOST_CONF17 0x000000FF +#define HOST_SLCHOST_CONF17_M ((HOST_SLCHOST_CONF17_V)<<(HOST_SLCHOST_CONF17_S)) +#define HOST_SLCHOST_CONF17_V 0xFF +#define HOST_SLCHOST_CONF17_S 8 +/* HOST_SLCHOST_CONF16 : R/W ;bitpos:[7:0] ;default: 8'hFF ; */ +/*description: SLC timeout value*/ +#define HOST_SLCHOST_CONF16 0x000000FF +#define HOST_SLCHOST_CONF16_M ((HOST_SLCHOST_CONF16_V)<<(HOST_SLCHOST_CONF16_S)) +#define HOST_SLCHOST_CONF16_V 0xFF +#define HOST_SLCHOST_CONF16_S 0 + +#define HOST_SLCHOST_CONF_W5_REG (DR_REG_SLCHOST_BASE + 0x80) +/* HOST_SLCHOST_CONF23 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF23 0x000000FF +#define HOST_SLCHOST_CONF23_M ((HOST_SLCHOST_CONF23_V)<<(HOST_SLCHOST_CONF23_S)) +#define HOST_SLCHOST_CONF23_V 0xFF +#define HOST_SLCHOST_CONF23_S 24 +/* HOST_SLCHOST_CONF22 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF22 0x000000FF +#define HOST_SLCHOST_CONF22_M ((HOST_SLCHOST_CONF22_V)<<(HOST_SLCHOST_CONF22_S)) +#define HOST_SLCHOST_CONF22_V 0xFF +#define HOST_SLCHOST_CONF22_S 16 +/* HOST_SLCHOST_CONF21 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF21 0x000000FF +#define HOST_SLCHOST_CONF21_M ((HOST_SLCHOST_CONF21_V)<<(HOST_SLCHOST_CONF21_S)) +#define HOST_SLCHOST_CONF21_V 0xFF +#define HOST_SLCHOST_CONF21_S 8 +/* HOST_SLCHOST_CONF20 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF20 0x000000FF +#define HOST_SLCHOST_CONF20_M ((HOST_SLCHOST_CONF20_V)<<(HOST_SLCHOST_CONF20_S)) +#define HOST_SLCHOST_CONF20_V 0xFF +#define HOST_SLCHOST_CONF20_S 0 + +#define HOST_SLCHOST_WIN_CMD_REG (DR_REG_SLCHOST_BASE + 0x84) +/* HOST_SLCHOST_WIN_CMD : R/W ;bitpos:[15:0] ;default: 16'b0 ; */ +/*description: */ +#define HOST_SLCHOST_WIN_CMD 0x0000FFFF +#define HOST_SLCHOST_WIN_CMD_M ((HOST_SLCHOST_WIN_CMD_V)<<(HOST_SLCHOST_WIN_CMD_S)) +#define HOST_SLCHOST_WIN_CMD_V 0xFFFF +#define HOST_SLCHOST_WIN_CMD_S 0 + +#define HOST_SLCHOST_CONF_W6_REG (DR_REG_SLCHOST_BASE + 0x88) +/* HOST_SLCHOST_CONF27 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF27 0x000000FF +#define HOST_SLCHOST_CONF27_M ((HOST_SLCHOST_CONF27_V)<<(HOST_SLCHOST_CONF27_S)) +#define HOST_SLCHOST_CONF27_V 0xFF +#define HOST_SLCHOST_CONF27_S 24 +/* HOST_SLCHOST_CONF26 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF26 0x000000FF +#define HOST_SLCHOST_CONF26_M ((HOST_SLCHOST_CONF26_V)<<(HOST_SLCHOST_CONF26_S)) +#define HOST_SLCHOST_CONF26_V 0xFF +#define HOST_SLCHOST_CONF26_S 16 +/* HOST_SLCHOST_CONF25 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF25 0x000000FF +#define HOST_SLCHOST_CONF25_M ((HOST_SLCHOST_CONF25_V)<<(HOST_SLCHOST_CONF25_S)) +#define HOST_SLCHOST_CONF25_V 0xFF +#define HOST_SLCHOST_CONF25_S 8 +/* HOST_SLCHOST_CONF24 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF24 0x000000FF +#define HOST_SLCHOST_CONF24_M ((HOST_SLCHOST_CONF24_V)<<(HOST_SLCHOST_CONF24_S)) +#define HOST_SLCHOST_CONF24_V 0xFF +#define HOST_SLCHOST_CONF24_S 0 + +#define HOST_SLCHOST_CONF_W7_REG (DR_REG_SLCHOST_BASE + 0x8C) +/* HOST_SLCHOST_CONF31 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF31 0x000000FF +#define HOST_SLCHOST_CONF31_M ((HOST_SLCHOST_CONF31_V)<<(HOST_SLCHOST_CONF31_S)) +#define HOST_SLCHOST_CONF31_V 0xFF +#define HOST_SLCHOST_CONF31_S 24 +/* HOST_SLCHOST_CONF30 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF30 0x000000FF +#define HOST_SLCHOST_CONF30_M ((HOST_SLCHOST_CONF30_V)<<(HOST_SLCHOST_CONF30_S)) +#define HOST_SLCHOST_CONF30_V 0xFF +#define HOST_SLCHOST_CONF30_S 16 +/* HOST_SLCHOST_CONF29 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF29 0x000000FF +#define HOST_SLCHOST_CONF29_M ((HOST_SLCHOST_CONF29_V)<<(HOST_SLCHOST_CONF29_S)) +#define HOST_SLCHOST_CONF29_V 0xFF +#define HOST_SLCHOST_CONF29_S 8 +/* HOST_SLCHOST_CONF28 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF28 0x000000FF +#define HOST_SLCHOST_CONF28_M ((HOST_SLCHOST_CONF28_V)<<(HOST_SLCHOST_CONF28_S)) +#define HOST_SLCHOST_CONF28_V 0xFF +#define HOST_SLCHOST_CONF28_S 0 + +#define HOST_SLCHOST_PKT_LEN0_REG (DR_REG_SLCHOST_BASE + 0x90) +/* HOST_HOSTSLC0_LEN0_CHECK : RO ;bitpos:[31:20] ;default: 12'h0 ; */ +/*description: */ +#define HOST_HOSTSLC0_LEN0_CHECK 0x00000FFF +#define HOST_HOSTSLC0_LEN0_CHECK_M ((HOST_HOSTSLC0_LEN0_CHECK_V)<<(HOST_HOSTSLC0_LEN0_CHECK_S)) +#define HOST_HOSTSLC0_LEN0_CHECK_V 0xFFF +#define HOST_HOSTSLC0_LEN0_CHECK_S 20 +/* HOST_HOSTSLC0_LEN0 : RO ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define HOST_HOSTSLC0_LEN0 0x000FFFFF +#define HOST_HOSTSLC0_LEN0_M ((HOST_HOSTSLC0_LEN0_V)<<(HOST_HOSTSLC0_LEN0_S)) +#define HOST_HOSTSLC0_LEN0_V 0xFFFFF +#define HOST_HOSTSLC0_LEN0_S 0 + +#define HOST_SLCHOST_PKT_LEN1_REG (DR_REG_SLCHOST_BASE + 0x94) +/* HOST_HOSTSLC0_LEN1_CHECK : RO ;bitpos:[31:20] ;default: 10'h0 ; */ +/*description: */ +#define HOST_HOSTSLC0_LEN1_CHECK 0x00000FFF +#define HOST_HOSTSLC0_LEN1_CHECK_M ((HOST_HOSTSLC0_LEN1_CHECK_V)<<(HOST_HOSTSLC0_LEN1_CHECK_S)) +#define HOST_HOSTSLC0_LEN1_CHECK_V 0xFFF +#define HOST_HOSTSLC0_LEN1_CHECK_S 20 +/* HOST_HOSTSLC0_LEN1 : RO ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define HOST_HOSTSLC0_LEN1 0x000FFFFF +#define HOST_HOSTSLC0_LEN1_M ((HOST_HOSTSLC0_LEN1_V)<<(HOST_HOSTSLC0_LEN1_S)) +#define HOST_HOSTSLC0_LEN1_V 0xFFFFF +#define HOST_HOSTSLC0_LEN1_S 0 + +#define HOST_SLCHOST_PKT_LEN2_REG (DR_REG_SLCHOST_BASE + 0x98) +/* HOST_HOSTSLC0_LEN2_CHECK : RO ;bitpos:[31:20] ;default: 10'h0 ; */ +/*description: */ +#define HOST_HOSTSLC0_LEN2_CHECK 0x00000FFF +#define HOST_HOSTSLC0_LEN2_CHECK_M ((HOST_HOSTSLC0_LEN2_CHECK_V)<<(HOST_HOSTSLC0_LEN2_CHECK_S)) +#define HOST_HOSTSLC0_LEN2_CHECK_V 0xFFF +#define HOST_HOSTSLC0_LEN2_CHECK_S 20 +/* HOST_HOSTSLC0_LEN2 : RO ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define HOST_HOSTSLC0_LEN2 0x000FFFFF +#define HOST_HOSTSLC0_LEN2_M ((HOST_HOSTSLC0_LEN2_V)<<(HOST_HOSTSLC0_LEN2_S)) +#define HOST_HOSTSLC0_LEN2_V 0xFFFFF +#define HOST_HOSTSLC0_LEN2_S 0 + +#define HOST_SLCHOST_CONF_W8_REG (DR_REG_SLCHOST_BASE + 0x9C) +/* HOST_SLCHOST_CONF35 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF35 0x000000FF +#define HOST_SLCHOST_CONF35_M ((HOST_SLCHOST_CONF35_V)<<(HOST_SLCHOST_CONF35_S)) +#define HOST_SLCHOST_CONF35_V 0xFF +#define HOST_SLCHOST_CONF35_S 24 +/* HOST_SLCHOST_CONF34 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF34 0x000000FF +#define HOST_SLCHOST_CONF34_M ((HOST_SLCHOST_CONF34_V)<<(HOST_SLCHOST_CONF34_S)) +#define HOST_SLCHOST_CONF34_V 0xFF +#define HOST_SLCHOST_CONF34_S 16 +/* HOST_SLCHOST_CONF33 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF33 0x000000FF +#define HOST_SLCHOST_CONF33_M ((HOST_SLCHOST_CONF33_V)<<(HOST_SLCHOST_CONF33_S)) +#define HOST_SLCHOST_CONF33_V 0xFF +#define HOST_SLCHOST_CONF33_S 8 +/* HOST_SLCHOST_CONF32 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF32 0x000000FF +#define HOST_SLCHOST_CONF32_M ((HOST_SLCHOST_CONF32_V)<<(HOST_SLCHOST_CONF32_S)) +#define HOST_SLCHOST_CONF32_V 0xFF +#define HOST_SLCHOST_CONF32_S 0 + +#define HOST_SLCHOST_CONF_W9_REG (DR_REG_SLCHOST_BASE + 0xA0) +/* HOST_SLCHOST_CONF39 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF39 0x000000FF +#define HOST_SLCHOST_CONF39_M ((HOST_SLCHOST_CONF39_V)<<(HOST_SLCHOST_CONF39_S)) +#define HOST_SLCHOST_CONF39_V 0xFF +#define HOST_SLCHOST_CONF39_S 24 +/* HOST_SLCHOST_CONF38 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF38 0x000000FF +#define HOST_SLCHOST_CONF38_M ((HOST_SLCHOST_CONF38_V)<<(HOST_SLCHOST_CONF38_S)) +#define HOST_SLCHOST_CONF38_V 0xFF +#define HOST_SLCHOST_CONF38_S 16 +/* HOST_SLCHOST_CONF37 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF37 0x000000FF +#define HOST_SLCHOST_CONF37_M ((HOST_SLCHOST_CONF37_V)<<(HOST_SLCHOST_CONF37_S)) +#define HOST_SLCHOST_CONF37_V 0xFF +#define HOST_SLCHOST_CONF37_S 8 +/* HOST_SLCHOST_CONF36 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF36 0x000000FF +#define HOST_SLCHOST_CONF36_M ((HOST_SLCHOST_CONF36_V)<<(HOST_SLCHOST_CONF36_S)) +#define HOST_SLCHOST_CONF36_V 0xFF +#define HOST_SLCHOST_CONF36_S 0 + +#define HOST_SLCHOST_CONF_W10_REG (DR_REG_SLCHOST_BASE + 0xA4) +/* HOST_SLCHOST_CONF43 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF43 0x000000FF +#define HOST_SLCHOST_CONF43_M ((HOST_SLCHOST_CONF43_V)<<(HOST_SLCHOST_CONF43_S)) +#define HOST_SLCHOST_CONF43_V 0xFF +#define HOST_SLCHOST_CONF43_S 24 +/* HOST_SLCHOST_CONF42 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF42 0x000000FF +#define HOST_SLCHOST_CONF42_M ((HOST_SLCHOST_CONF42_V)<<(HOST_SLCHOST_CONF42_S)) +#define HOST_SLCHOST_CONF42_V 0xFF +#define HOST_SLCHOST_CONF42_S 16 +/* HOST_SLCHOST_CONF41 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF41 0x000000FF +#define HOST_SLCHOST_CONF41_M ((HOST_SLCHOST_CONF41_V)<<(HOST_SLCHOST_CONF41_S)) +#define HOST_SLCHOST_CONF41_V 0xFF +#define HOST_SLCHOST_CONF41_S 8 +/* HOST_SLCHOST_CONF40 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF40 0x000000FF +#define HOST_SLCHOST_CONF40_M ((HOST_SLCHOST_CONF40_V)<<(HOST_SLCHOST_CONF40_S)) +#define HOST_SLCHOST_CONF40_V 0xFF +#define HOST_SLCHOST_CONF40_S 0 + +#define HOST_SLCHOST_CONF_W11_REG (DR_REG_SLCHOST_BASE + 0xA8) +/* HOST_SLCHOST_CONF47 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF47 0x000000FF +#define HOST_SLCHOST_CONF47_M ((HOST_SLCHOST_CONF47_V)<<(HOST_SLCHOST_CONF47_S)) +#define HOST_SLCHOST_CONF47_V 0xFF +#define HOST_SLCHOST_CONF47_S 24 +/* HOST_SLCHOST_CONF46 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF46 0x000000FF +#define HOST_SLCHOST_CONF46_M ((HOST_SLCHOST_CONF46_V)<<(HOST_SLCHOST_CONF46_S)) +#define HOST_SLCHOST_CONF46_V 0xFF +#define HOST_SLCHOST_CONF46_S 16 +/* HOST_SLCHOST_CONF45 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF45 0x000000FF +#define HOST_SLCHOST_CONF45_M ((HOST_SLCHOST_CONF45_V)<<(HOST_SLCHOST_CONF45_S)) +#define HOST_SLCHOST_CONF45_V 0xFF +#define HOST_SLCHOST_CONF45_S 8 +/* HOST_SLCHOST_CONF44 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF44 0x000000FF +#define HOST_SLCHOST_CONF44_M ((HOST_SLCHOST_CONF44_V)<<(HOST_SLCHOST_CONF44_S)) +#define HOST_SLCHOST_CONF44_V 0xFF +#define HOST_SLCHOST_CONF44_S 0 + +#define HOST_SLCHOST_CONF_W12_REG (DR_REG_SLCHOST_BASE + 0xAC) +/* HOST_SLCHOST_CONF51 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF51 0x000000FF +#define HOST_SLCHOST_CONF51_M ((HOST_SLCHOST_CONF51_V)<<(HOST_SLCHOST_CONF51_S)) +#define HOST_SLCHOST_CONF51_V 0xFF +#define HOST_SLCHOST_CONF51_S 24 +/* HOST_SLCHOST_CONF50 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF50 0x000000FF +#define HOST_SLCHOST_CONF50_M ((HOST_SLCHOST_CONF50_V)<<(HOST_SLCHOST_CONF50_S)) +#define HOST_SLCHOST_CONF50_V 0xFF +#define HOST_SLCHOST_CONF50_S 16 +/* HOST_SLCHOST_CONF49 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF49 0x000000FF +#define HOST_SLCHOST_CONF49_M ((HOST_SLCHOST_CONF49_V)<<(HOST_SLCHOST_CONF49_S)) +#define HOST_SLCHOST_CONF49_V 0xFF +#define HOST_SLCHOST_CONF49_S 8 +/* HOST_SLCHOST_CONF48 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF48 0x000000FF +#define HOST_SLCHOST_CONF48_M ((HOST_SLCHOST_CONF48_V)<<(HOST_SLCHOST_CONF48_S)) +#define HOST_SLCHOST_CONF48_V 0xFF +#define HOST_SLCHOST_CONF48_S 0 + +#define HOST_SLCHOST_CONF_W13_REG (DR_REG_SLCHOST_BASE + 0xB0) +/* HOST_SLCHOST_CONF55 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF55 0x000000FF +#define HOST_SLCHOST_CONF55_M ((HOST_SLCHOST_CONF55_V)<<(HOST_SLCHOST_CONF55_S)) +#define HOST_SLCHOST_CONF55_V 0xFF +#define HOST_SLCHOST_CONF55_S 24 +/* HOST_SLCHOST_CONF54 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF54 0x000000FF +#define HOST_SLCHOST_CONF54_M ((HOST_SLCHOST_CONF54_V)<<(HOST_SLCHOST_CONF54_S)) +#define HOST_SLCHOST_CONF54_V 0xFF +#define HOST_SLCHOST_CONF54_S 16 +/* HOST_SLCHOST_CONF53 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF53 0x000000FF +#define HOST_SLCHOST_CONF53_M ((HOST_SLCHOST_CONF53_V)<<(HOST_SLCHOST_CONF53_S)) +#define HOST_SLCHOST_CONF53_V 0xFF +#define HOST_SLCHOST_CONF53_S 8 +/* HOST_SLCHOST_CONF52 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF52 0x000000FF +#define HOST_SLCHOST_CONF52_M ((HOST_SLCHOST_CONF52_V)<<(HOST_SLCHOST_CONF52_S)) +#define HOST_SLCHOST_CONF52_V 0xFF +#define HOST_SLCHOST_CONF52_S 0 + +#define HOST_SLCHOST_CONF_W14_REG (DR_REG_SLCHOST_BASE + 0xB4) +/* HOST_SLCHOST_CONF59 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF59 0x000000FF +#define HOST_SLCHOST_CONF59_M ((HOST_SLCHOST_CONF59_V)<<(HOST_SLCHOST_CONF59_S)) +#define HOST_SLCHOST_CONF59_V 0xFF +#define HOST_SLCHOST_CONF59_S 24 +/* HOST_SLCHOST_CONF58 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF58 0x000000FF +#define HOST_SLCHOST_CONF58_M ((HOST_SLCHOST_CONF58_V)<<(HOST_SLCHOST_CONF58_S)) +#define HOST_SLCHOST_CONF58_V 0xFF +#define HOST_SLCHOST_CONF58_S 16 +/* HOST_SLCHOST_CONF57 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF57 0x000000FF +#define HOST_SLCHOST_CONF57_M ((HOST_SLCHOST_CONF57_V)<<(HOST_SLCHOST_CONF57_S)) +#define HOST_SLCHOST_CONF57_V 0xFF +#define HOST_SLCHOST_CONF57_S 8 +/* HOST_SLCHOST_CONF56 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF56 0x000000FF +#define HOST_SLCHOST_CONF56_M ((HOST_SLCHOST_CONF56_V)<<(HOST_SLCHOST_CONF56_S)) +#define HOST_SLCHOST_CONF56_V 0xFF +#define HOST_SLCHOST_CONF56_S 0 + +#define HOST_SLCHOST_CONF_W15_REG (DR_REG_SLCHOST_BASE + 0xB8) +/* HOST_SLCHOST_CONF63 : R/W ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF63 0x000000FF +#define HOST_SLCHOST_CONF63_M ((HOST_SLCHOST_CONF63_V)<<(HOST_SLCHOST_CONF63_S)) +#define HOST_SLCHOST_CONF63_V 0xFF +#define HOST_SLCHOST_CONF63_S 24 +/* HOST_SLCHOST_CONF62 : R/W ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF62 0x000000FF +#define HOST_SLCHOST_CONF62_M ((HOST_SLCHOST_CONF62_V)<<(HOST_SLCHOST_CONF62_S)) +#define HOST_SLCHOST_CONF62_V 0xFF +#define HOST_SLCHOST_CONF62_S 16 +/* HOST_SLCHOST_CONF61 : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF61 0x000000FF +#define HOST_SLCHOST_CONF61_M ((HOST_SLCHOST_CONF61_V)<<(HOST_SLCHOST_CONF61_S)) +#define HOST_SLCHOST_CONF61_V 0xFF +#define HOST_SLCHOST_CONF61_S 8 +/* HOST_SLCHOST_CONF60 : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define HOST_SLCHOST_CONF60 0x000000FF +#define HOST_SLCHOST_CONF60_M ((HOST_SLCHOST_CONF60_V)<<(HOST_SLCHOST_CONF60_S)) +#define HOST_SLCHOST_CONF60_V 0xFF +#define HOST_SLCHOST_CONF60_S 0 + +#define HOST_SLCHOST_CHECK_SUM0_REG (DR_REG_SLCHOST_BASE + 0xBC) +/* HOST_SLCHOST_CHECK_SUM0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define HOST_SLCHOST_CHECK_SUM0 0xFFFFFFFF +#define HOST_SLCHOST_CHECK_SUM0_M ((HOST_SLCHOST_CHECK_SUM0_V)<<(HOST_SLCHOST_CHECK_SUM0_S)) +#define HOST_SLCHOST_CHECK_SUM0_V 0xFFFFFFFF +#define HOST_SLCHOST_CHECK_SUM0_S 0 + +#define HOST_SLCHOST_CHECK_SUM1_REG (DR_REG_SLCHOST_BASE + 0xC0) +/* HOST_SLCHOST_CHECK_SUM1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define HOST_SLCHOST_CHECK_SUM1 0xFFFFFFFF +#define HOST_SLCHOST_CHECK_SUM1_M ((HOST_SLCHOST_CHECK_SUM1_V)<<(HOST_SLCHOST_CHECK_SUM1_S)) +#define HOST_SLCHOST_CHECK_SUM1_V 0xFFFFFFFF +#define HOST_SLCHOST_CHECK_SUM1_S 0 + +#define HOST_SLC0HOST_TOKEN_WDATA_REG (DR_REG_SLCHOST_BASE + 0xC8) +/* HOST_SLC0HOST_TOKEN1_WD : R/W ;bitpos:[27:16] ;default: 12'h0 ; */ +/*description: */ +#define HOST_SLC0HOST_TOKEN1_WD 0x00000FFF +#define HOST_SLC0HOST_TOKEN1_WD_M ((HOST_SLC0HOST_TOKEN1_WD_V)<<(HOST_SLC0HOST_TOKEN1_WD_S)) +#define HOST_SLC0HOST_TOKEN1_WD_V 0xFFF +#define HOST_SLC0HOST_TOKEN1_WD_S 16 +/* HOST_SLC0HOST_TOKEN0_WD : R/W ;bitpos:[11:0] ;default: 12'h0 ; */ +/*description: */ +#define HOST_SLC0HOST_TOKEN0_WD 0x00000FFF +#define HOST_SLC0HOST_TOKEN0_WD_M ((HOST_SLC0HOST_TOKEN0_WD_V)<<(HOST_SLC0HOST_TOKEN0_WD_S)) +#define HOST_SLC0HOST_TOKEN0_WD_V 0xFFF +#define HOST_SLC0HOST_TOKEN0_WD_S 0 + +#define HOST_SLCHOST_TOKEN_CON_REG (DR_REG_SLCHOST_BASE + 0xD0) +/* HOST_SLC0HOST_LEN_WR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_LEN_WR (BIT(8)) +#define HOST_SLC0HOST_LEN_WR_M (BIT(8)) +#define HOST_SLC0HOST_LEN_WR_V 0x1 +#define HOST_SLC0HOST_LEN_WR_S 8 +/* HOST_SLC0HOST_TOKEN1_WR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_TOKEN1_WR (BIT(3)) +#define HOST_SLC0HOST_TOKEN1_WR_M (BIT(3)) +#define HOST_SLC0HOST_TOKEN1_WR_V 0x1 +#define HOST_SLC0HOST_TOKEN1_WR_S 3 +/* HOST_SLC0HOST_TOKEN0_WR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_TOKEN0_WR (BIT(2)) +#define HOST_SLC0HOST_TOKEN0_WR_M (BIT(2)) +#define HOST_SLC0HOST_TOKEN0_WR_V 0x1 +#define HOST_SLC0HOST_TOKEN0_WR_S 2 +/* HOST_SLC0HOST_TOKEN1_DEC : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_TOKEN1_DEC (BIT(1)) +#define HOST_SLC0HOST_TOKEN1_DEC_M (BIT(1)) +#define HOST_SLC0HOST_TOKEN1_DEC_V 0x1 +#define HOST_SLC0HOST_TOKEN1_DEC_S 1 +/* HOST_SLC0HOST_TOKEN0_DEC : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_TOKEN0_DEC (BIT(0)) +#define HOST_SLC0HOST_TOKEN0_DEC_M (BIT(0)) +#define HOST_SLC0HOST_TOKEN0_DEC_V 0x1 +#define HOST_SLC0HOST_TOKEN0_DEC_S 0 + +#define HOST_SLC0HOST_INT_CLR_REG (DR_REG_SLCHOST_BASE + 0xD4) +/* HOST_GPIO_SDIO_INT_CLR : WO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define HOST_GPIO_SDIO_INT_CLR (BIT(25)) +#define HOST_GPIO_SDIO_INT_CLR_M (BIT(25)) +#define HOST_GPIO_SDIO_INT_CLR_V 0x1 +#define HOST_GPIO_SDIO_INT_CLR_S 25 +/* HOST_SLC0_HOST_RD_RETRY_INT_CLR : WO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_HOST_RD_RETRY_INT_CLR (BIT(24)) +#define HOST_SLC0_HOST_RD_RETRY_INT_CLR_M (BIT(24)) +#define HOST_SLC0_HOST_RD_RETRY_INT_CLR_V 0x1 +#define HOST_SLC0_HOST_RD_RETRY_INT_CLR_S 24 +/* HOST_SLC0_RX_NEW_PACKET_INT_CLR : WO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_NEW_PACKET_INT_CLR (BIT(23)) +#define HOST_SLC0_RX_NEW_PACKET_INT_CLR_M (BIT(23)) +#define HOST_SLC0_RX_NEW_PACKET_INT_CLR_V 0x1 +#define HOST_SLC0_RX_NEW_PACKET_INT_CLR_S 23 +/* HOST_SLC0_EXT_BIT3_INT_CLR : WO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT3_INT_CLR (BIT(22)) +#define HOST_SLC0_EXT_BIT3_INT_CLR_M (BIT(22)) +#define HOST_SLC0_EXT_BIT3_INT_CLR_V 0x1 +#define HOST_SLC0_EXT_BIT3_INT_CLR_S 22 +/* HOST_SLC0_EXT_BIT2_INT_CLR : WO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT2_INT_CLR (BIT(21)) +#define HOST_SLC0_EXT_BIT2_INT_CLR_M (BIT(21)) +#define HOST_SLC0_EXT_BIT2_INT_CLR_V 0x1 +#define HOST_SLC0_EXT_BIT2_INT_CLR_S 21 +/* HOST_SLC0_EXT_BIT1_INT_CLR : WO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT1_INT_CLR (BIT(20)) +#define HOST_SLC0_EXT_BIT1_INT_CLR_M (BIT(20)) +#define HOST_SLC0_EXT_BIT1_INT_CLR_V 0x1 +#define HOST_SLC0_EXT_BIT1_INT_CLR_S 20 +/* HOST_SLC0_EXT_BIT0_INT_CLR : WO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT0_INT_CLR (BIT(19)) +#define HOST_SLC0_EXT_BIT0_INT_CLR_M (BIT(19)) +#define HOST_SLC0_EXT_BIT0_INT_CLR_V 0x1 +#define HOST_SLC0_EXT_BIT0_INT_CLR_S 19 +/* HOST_SLC0_RX_PF_VALID_INT_CLR : WO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_PF_VALID_INT_CLR (BIT(18)) +#define HOST_SLC0_RX_PF_VALID_INT_CLR_M (BIT(18)) +#define HOST_SLC0_RX_PF_VALID_INT_CLR_V 0x1 +#define HOST_SLC0_RX_PF_VALID_INT_CLR_S 18 +/* HOST_SLC0_TX_OVF_INT_CLR : WO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TX_OVF_INT_CLR (BIT(17)) +#define HOST_SLC0_TX_OVF_INT_CLR_M (BIT(17)) +#define HOST_SLC0_TX_OVF_INT_CLR_V 0x1 +#define HOST_SLC0_TX_OVF_INT_CLR_S 17 +/* HOST_SLC0_RX_UDF_INT_CLR : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_UDF_INT_CLR (BIT(16)) +#define HOST_SLC0_RX_UDF_INT_CLR_M (BIT(16)) +#define HOST_SLC0_RX_UDF_INT_CLR_V 0x1 +#define HOST_SLC0_RX_UDF_INT_CLR_S 16 +/* HOST_SLC0HOST_TX_START_INT_CLR : WO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_TX_START_INT_CLR (BIT(15)) +#define HOST_SLC0HOST_TX_START_INT_CLR_M (BIT(15)) +#define HOST_SLC0HOST_TX_START_INT_CLR_V 0x1 +#define HOST_SLC0HOST_TX_START_INT_CLR_S 15 +/* HOST_SLC0HOST_RX_START_INT_CLR : WO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_START_INT_CLR (BIT(14)) +#define HOST_SLC0HOST_RX_START_INT_CLR_M (BIT(14)) +#define HOST_SLC0HOST_RX_START_INT_CLR_V 0x1 +#define HOST_SLC0HOST_RX_START_INT_CLR_S 14 +/* HOST_SLC0HOST_RX_EOF_INT_CLR : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_EOF_INT_CLR (BIT(13)) +#define HOST_SLC0HOST_RX_EOF_INT_CLR_M (BIT(13)) +#define HOST_SLC0HOST_RX_EOF_INT_CLR_V 0x1 +#define HOST_SLC0HOST_RX_EOF_INT_CLR_S 13 +/* HOST_SLC0HOST_RX_SOF_INT_CLR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_SOF_INT_CLR (BIT(12)) +#define HOST_SLC0HOST_RX_SOF_INT_CLR_M (BIT(12)) +#define HOST_SLC0HOST_RX_SOF_INT_CLR_V 0x1 +#define HOST_SLC0HOST_RX_SOF_INT_CLR_S 12 +/* HOST_SLC0_TOKEN1_0TO1_INT_CLR : WO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN1_0TO1_INT_CLR (BIT(11)) +#define HOST_SLC0_TOKEN1_0TO1_INT_CLR_M (BIT(11)) +#define HOST_SLC0_TOKEN1_0TO1_INT_CLR_V 0x1 +#define HOST_SLC0_TOKEN1_0TO1_INT_CLR_S 11 +/* HOST_SLC0_TOKEN0_0TO1_INT_CLR : WO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0_0TO1_INT_CLR (BIT(10)) +#define HOST_SLC0_TOKEN0_0TO1_INT_CLR_M (BIT(10)) +#define HOST_SLC0_TOKEN0_0TO1_INT_CLR_V 0x1 +#define HOST_SLC0_TOKEN0_0TO1_INT_CLR_S 10 +/* HOST_SLC0_TOKEN1_1TO0_INT_CLR : WO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN1_1TO0_INT_CLR (BIT(9)) +#define HOST_SLC0_TOKEN1_1TO0_INT_CLR_M (BIT(9)) +#define HOST_SLC0_TOKEN1_1TO0_INT_CLR_V 0x1 +#define HOST_SLC0_TOKEN1_1TO0_INT_CLR_S 9 +/* HOST_SLC0_TOKEN0_1TO0_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0_1TO0_INT_CLR (BIT(8)) +#define HOST_SLC0_TOKEN0_1TO0_INT_CLR_M (BIT(8)) +#define HOST_SLC0_TOKEN0_1TO0_INT_CLR_V 0x1 +#define HOST_SLC0_TOKEN0_1TO0_INT_CLR_S 8 +/* HOST_SLC0_TOHOST_BIT7_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT7_INT_CLR (BIT(7)) +#define HOST_SLC0_TOHOST_BIT7_INT_CLR_M (BIT(7)) +#define HOST_SLC0_TOHOST_BIT7_INT_CLR_V 0x1 +#define HOST_SLC0_TOHOST_BIT7_INT_CLR_S 7 +/* HOST_SLC0_TOHOST_BIT6_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT6_INT_CLR (BIT(6)) +#define HOST_SLC0_TOHOST_BIT6_INT_CLR_M (BIT(6)) +#define HOST_SLC0_TOHOST_BIT6_INT_CLR_V 0x1 +#define HOST_SLC0_TOHOST_BIT6_INT_CLR_S 6 +/* HOST_SLC0_TOHOST_BIT5_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT5_INT_CLR (BIT(5)) +#define HOST_SLC0_TOHOST_BIT5_INT_CLR_M (BIT(5)) +#define HOST_SLC0_TOHOST_BIT5_INT_CLR_V 0x1 +#define HOST_SLC0_TOHOST_BIT5_INT_CLR_S 5 +/* HOST_SLC0_TOHOST_BIT4_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT4_INT_CLR (BIT(4)) +#define HOST_SLC0_TOHOST_BIT4_INT_CLR_M (BIT(4)) +#define HOST_SLC0_TOHOST_BIT4_INT_CLR_V 0x1 +#define HOST_SLC0_TOHOST_BIT4_INT_CLR_S 4 +/* HOST_SLC0_TOHOST_BIT3_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT3_INT_CLR (BIT(3)) +#define HOST_SLC0_TOHOST_BIT3_INT_CLR_M (BIT(3)) +#define HOST_SLC0_TOHOST_BIT3_INT_CLR_V 0x1 +#define HOST_SLC0_TOHOST_BIT3_INT_CLR_S 3 +/* HOST_SLC0_TOHOST_BIT2_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT2_INT_CLR (BIT(2)) +#define HOST_SLC0_TOHOST_BIT2_INT_CLR_M (BIT(2)) +#define HOST_SLC0_TOHOST_BIT2_INT_CLR_V 0x1 +#define HOST_SLC0_TOHOST_BIT2_INT_CLR_S 2 +/* HOST_SLC0_TOHOST_BIT1_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT1_INT_CLR (BIT(1)) +#define HOST_SLC0_TOHOST_BIT1_INT_CLR_M (BIT(1)) +#define HOST_SLC0_TOHOST_BIT1_INT_CLR_V 0x1 +#define HOST_SLC0_TOHOST_BIT1_INT_CLR_S 1 +/* HOST_SLC0_TOHOST_BIT0_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT0_INT_CLR (BIT(0)) +#define HOST_SLC0_TOHOST_BIT0_INT_CLR_M (BIT(0)) +#define HOST_SLC0_TOHOST_BIT0_INT_CLR_V 0x1 +#define HOST_SLC0_TOHOST_BIT0_INT_CLR_S 0 + +#define HOST_SLC0HOST_FUNC1_INT_ENA_REG (DR_REG_SLCHOST_BASE + 0xDC) +/* HOST_FN1_GPIO_SDIO_INT_ENA : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_GPIO_SDIO_INT_ENA (BIT(25)) +#define HOST_FN1_GPIO_SDIO_INT_ENA_M (BIT(25)) +#define HOST_FN1_GPIO_SDIO_INT_ENA_V 0x1 +#define HOST_FN1_GPIO_SDIO_INT_ENA_S 25 +/* HOST_FN1_SLC0_HOST_RD_RETRY_INT_ENA : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_HOST_RD_RETRY_INT_ENA (BIT(24)) +#define HOST_FN1_SLC0_HOST_RD_RETRY_INT_ENA_M (BIT(24)) +#define HOST_FN1_SLC0_HOST_RD_RETRY_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_HOST_RD_RETRY_INT_ENA_S 24 +/* HOST_FN1_SLC0_RX_NEW_PACKET_INT_ENA : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_RX_NEW_PACKET_INT_ENA (BIT(23)) +#define HOST_FN1_SLC0_RX_NEW_PACKET_INT_ENA_M (BIT(23)) +#define HOST_FN1_SLC0_RX_NEW_PACKET_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_RX_NEW_PACKET_INT_ENA_S 23 +/* HOST_FN1_SLC0_EXT_BIT3_INT_ENA : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_EXT_BIT3_INT_ENA (BIT(22)) +#define HOST_FN1_SLC0_EXT_BIT3_INT_ENA_M (BIT(22)) +#define HOST_FN1_SLC0_EXT_BIT3_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_EXT_BIT3_INT_ENA_S 22 +/* HOST_FN1_SLC0_EXT_BIT2_INT_ENA : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_EXT_BIT2_INT_ENA (BIT(21)) +#define HOST_FN1_SLC0_EXT_BIT2_INT_ENA_M (BIT(21)) +#define HOST_FN1_SLC0_EXT_BIT2_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_EXT_BIT2_INT_ENA_S 21 +/* HOST_FN1_SLC0_EXT_BIT1_INT_ENA : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_EXT_BIT1_INT_ENA (BIT(20)) +#define HOST_FN1_SLC0_EXT_BIT1_INT_ENA_M (BIT(20)) +#define HOST_FN1_SLC0_EXT_BIT1_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_EXT_BIT1_INT_ENA_S 20 +/* HOST_FN1_SLC0_EXT_BIT0_INT_ENA : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_EXT_BIT0_INT_ENA (BIT(19)) +#define HOST_FN1_SLC0_EXT_BIT0_INT_ENA_M (BIT(19)) +#define HOST_FN1_SLC0_EXT_BIT0_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_EXT_BIT0_INT_ENA_S 19 +/* HOST_FN1_SLC0_RX_PF_VALID_INT_ENA : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_RX_PF_VALID_INT_ENA (BIT(18)) +#define HOST_FN1_SLC0_RX_PF_VALID_INT_ENA_M (BIT(18)) +#define HOST_FN1_SLC0_RX_PF_VALID_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_RX_PF_VALID_INT_ENA_S 18 +/* HOST_FN1_SLC0_TX_OVF_INT_ENA : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TX_OVF_INT_ENA (BIT(17)) +#define HOST_FN1_SLC0_TX_OVF_INT_ENA_M (BIT(17)) +#define HOST_FN1_SLC0_TX_OVF_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TX_OVF_INT_ENA_S 17 +/* HOST_FN1_SLC0_RX_UDF_INT_ENA : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_RX_UDF_INT_ENA (BIT(16)) +#define HOST_FN1_SLC0_RX_UDF_INT_ENA_M (BIT(16)) +#define HOST_FN1_SLC0_RX_UDF_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_RX_UDF_INT_ENA_S 16 +/* HOST_FN1_SLC0HOST_TX_START_INT_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0HOST_TX_START_INT_ENA (BIT(15)) +#define HOST_FN1_SLC0HOST_TX_START_INT_ENA_M (BIT(15)) +#define HOST_FN1_SLC0HOST_TX_START_INT_ENA_V 0x1 +#define HOST_FN1_SLC0HOST_TX_START_INT_ENA_S 15 +/* HOST_FN1_SLC0HOST_RX_START_INT_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0HOST_RX_START_INT_ENA (BIT(14)) +#define HOST_FN1_SLC0HOST_RX_START_INT_ENA_M (BIT(14)) +#define HOST_FN1_SLC0HOST_RX_START_INT_ENA_V 0x1 +#define HOST_FN1_SLC0HOST_RX_START_INT_ENA_S 14 +/* HOST_FN1_SLC0HOST_RX_EOF_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0HOST_RX_EOF_INT_ENA (BIT(13)) +#define HOST_FN1_SLC0HOST_RX_EOF_INT_ENA_M (BIT(13)) +#define HOST_FN1_SLC0HOST_RX_EOF_INT_ENA_V 0x1 +#define HOST_FN1_SLC0HOST_RX_EOF_INT_ENA_S 13 +/* HOST_FN1_SLC0HOST_RX_SOF_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0HOST_RX_SOF_INT_ENA (BIT(12)) +#define HOST_FN1_SLC0HOST_RX_SOF_INT_ENA_M (BIT(12)) +#define HOST_FN1_SLC0HOST_RX_SOF_INT_ENA_V 0x1 +#define HOST_FN1_SLC0HOST_RX_SOF_INT_ENA_S 12 +/* HOST_FN1_SLC0_TOKEN1_0TO1_INT_ENA : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOKEN1_0TO1_INT_ENA (BIT(11)) +#define HOST_FN1_SLC0_TOKEN1_0TO1_INT_ENA_M (BIT(11)) +#define HOST_FN1_SLC0_TOKEN1_0TO1_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOKEN1_0TO1_INT_ENA_S 11 +/* HOST_FN1_SLC0_TOKEN0_0TO1_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOKEN0_0TO1_INT_ENA (BIT(10)) +#define HOST_FN1_SLC0_TOKEN0_0TO1_INT_ENA_M (BIT(10)) +#define HOST_FN1_SLC0_TOKEN0_0TO1_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOKEN0_0TO1_INT_ENA_S 10 +/* HOST_FN1_SLC0_TOKEN1_1TO0_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOKEN1_1TO0_INT_ENA (BIT(9)) +#define HOST_FN1_SLC0_TOKEN1_1TO0_INT_ENA_M (BIT(9)) +#define HOST_FN1_SLC0_TOKEN1_1TO0_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOKEN1_1TO0_INT_ENA_S 9 +/* HOST_FN1_SLC0_TOKEN0_1TO0_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOKEN0_1TO0_INT_ENA (BIT(8)) +#define HOST_FN1_SLC0_TOKEN0_1TO0_INT_ENA_M (BIT(8)) +#define HOST_FN1_SLC0_TOKEN0_1TO0_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOKEN0_1TO0_INT_ENA_S 8 +/* HOST_FN1_SLC0_TOHOST_BIT7_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOHOST_BIT7_INT_ENA (BIT(7)) +#define HOST_FN1_SLC0_TOHOST_BIT7_INT_ENA_M (BIT(7)) +#define HOST_FN1_SLC0_TOHOST_BIT7_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOHOST_BIT7_INT_ENA_S 7 +/* HOST_FN1_SLC0_TOHOST_BIT6_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOHOST_BIT6_INT_ENA (BIT(6)) +#define HOST_FN1_SLC0_TOHOST_BIT6_INT_ENA_M (BIT(6)) +#define HOST_FN1_SLC0_TOHOST_BIT6_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOHOST_BIT6_INT_ENA_S 6 +/* HOST_FN1_SLC0_TOHOST_BIT5_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOHOST_BIT5_INT_ENA (BIT(5)) +#define HOST_FN1_SLC0_TOHOST_BIT5_INT_ENA_M (BIT(5)) +#define HOST_FN1_SLC0_TOHOST_BIT5_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOHOST_BIT5_INT_ENA_S 5 +/* HOST_FN1_SLC0_TOHOST_BIT4_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOHOST_BIT4_INT_ENA (BIT(4)) +#define HOST_FN1_SLC0_TOHOST_BIT4_INT_ENA_M (BIT(4)) +#define HOST_FN1_SLC0_TOHOST_BIT4_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOHOST_BIT4_INT_ENA_S 4 +/* HOST_FN1_SLC0_TOHOST_BIT3_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOHOST_BIT3_INT_ENA (BIT(3)) +#define HOST_FN1_SLC0_TOHOST_BIT3_INT_ENA_M (BIT(3)) +#define HOST_FN1_SLC0_TOHOST_BIT3_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOHOST_BIT3_INT_ENA_S 3 +/* HOST_FN1_SLC0_TOHOST_BIT2_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOHOST_BIT2_INT_ENA (BIT(2)) +#define HOST_FN1_SLC0_TOHOST_BIT2_INT_ENA_M (BIT(2)) +#define HOST_FN1_SLC0_TOHOST_BIT2_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOHOST_BIT2_INT_ENA_S 2 +/* HOST_FN1_SLC0_TOHOST_BIT1_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOHOST_BIT1_INT_ENA (BIT(1)) +#define HOST_FN1_SLC0_TOHOST_BIT1_INT_ENA_M (BIT(1)) +#define HOST_FN1_SLC0_TOHOST_BIT1_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOHOST_BIT1_INT_ENA_S 1 +/* HOST_FN1_SLC0_TOHOST_BIT0_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define HOST_FN1_SLC0_TOHOST_BIT0_INT_ENA (BIT(0)) +#define HOST_FN1_SLC0_TOHOST_BIT0_INT_ENA_M (BIT(0)) +#define HOST_FN1_SLC0_TOHOST_BIT0_INT_ENA_V 0x1 +#define HOST_FN1_SLC0_TOHOST_BIT0_INT_ENA_S 0 + +#define HOST_SLC0HOST_INT_ENA_REG (DR_REG_SLCHOST_BASE + 0xEC) +/* HOST_GPIO_SDIO_INT_ENA : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define HOST_GPIO_SDIO_INT_ENA (BIT(25)) +#define HOST_GPIO_SDIO_INT_ENA_M (BIT(25)) +#define HOST_GPIO_SDIO_INT_ENA_V 0x1 +#define HOST_GPIO_SDIO_INT_ENA_S 25 +/* HOST_SLC0_HOST_RD_RETRY_INT_ENA : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_HOST_RD_RETRY_INT_ENA (BIT(24)) +#define HOST_SLC0_HOST_RD_RETRY_INT_ENA_M (BIT(24)) +#define HOST_SLC0_HOST_RD_RETRY_INT_ENA_V 0x1 +#define HOST_SLC0_HOST_RD_RETRY_INT_ENA_S 24 +/* HOST_SLC0_RX_NEW_PACKET_INT_ENA : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_NEW_PACKET_INT_ENA (BIT(23)) +#define HOST_SLC0_RX_NEW_PACKET_INT_ENA_M (BIT(23)) +#define HOST_SLC0_RX_NEW_PACKET_INT_ENA_V 0x1 +#define HOST_SLC0_RX_NEW_PACKET_INT_ENA_S 23 +/* HOST_SLC0_EXT_BIT3_INT_ENA : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT3_INT_ENA (BIT(22)) +#define HOST_SLC0_EXT_BIT3_INT_ENA_M (BIT(22)) +#define HOST_SLC0_EXT_BIT3_INT_ENA_V 0x1 +#define HOST_SLC0_EXT_BIT3_INT_ENA_S 22 +/* HOST_SLC0_EXT_BIT2_INT_ENA : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT2_INT_ENA (BIT(21)) +#define HOST_SLC0_EXT_BIT2_INT_ENA_M (BIT(21)) +#define HOST_SLC0_EXT_BIT2_INT_ENA_V 0x1 +#define HOST_SLC0_EXT_BIT2_INT_ENA_S 21 +/* HOST_SLC0_EXT_BIT1_INT_ENA : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT1_INT_ENA (BIT(20)) +#define HOST_SLC0_EXT_BIT1_INT_ENA_M (BIT(20)) +#define HOST_SLC0_EXT_BIT1_INT_ENA_V 0x1 +#define HOST_SLC0_EXT_BIT1_INT_ENA_S 20 +/* HOST_SLC0_EXT_BIT0_INT_ENA : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT0_INT_ENA (BIT(19)) +#define HOST_SLC0_EXT_BIT0_INT_ENA_M (BIT(19)) +#define HOST_SLC0_EXT_BIT0_INT_ENA_V 0x1 +#define HOST_SLC0_EXT_BIT0_INT_ENA_S 19 +/* HOST_SLC0_RX_PF_VALID_INT_ENA : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_PF_VALID_INT_ENA (BIT(18)) +#define HOST_SLC0_RX_PF_VALID_INT_ENA_M (BIT(18)) +#define HOST_SLC0_RX_PF_VALID_INT_ENA_V 0x1 +#define HOST_SLC0_RX_PF_VALID_INT_ENA_S 18 +/* HOST_SLC0_TX_OVF_INT_ENA : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TX_OVF_INT_ENA (BIT(17)) +#define HOST_SLC0_TX_OVF_INT_ENA_M (BIT(17)) +#define HOST_SLC0_TX_OVF_INT_ENA_V 0x1 +#define HOST_SLC0_TX_OVF_INT_ENA_S 17 +/* HOST_SLC0_RX_UDF_INT_ENA : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_UDF_INT_ENA (BIT(16)) +#define HOST_SLC0_RX_UDF_INT_ENA_M (BIT(16)) +#define HOST_SLC0_RX_UDF_INT_ENA_V 0x1 +#define HOST_SLC0_RX_UDF_INT_ENA_S 16 +/* HOST_SLC0HOST_TX_START_INT_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_TX_START_INT_ENA (BIT(15)) +#define HOST_SLC0HOST_TX_START_INT_ENA_M (BIT(15)) +#define HOST_SLC0HOST_TX_START_INT_ENA_V 0x1 +#define HOST_SLC0HOST_TX_START_INT_ENA_S 15 +/* HOST_SLC0HOST_RX_START_INT_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_START_INT_ENA (BIT(14)) +#define HOST_SLC0HOST_RX_START_INT_ENA_M (BIT(14)) +#define HOST_SLC0HOST_RX_START_INT_ENA_V 0x1 +#define HOST_SLC0HOST_RX_START_INT_ENA_S 14 +/* HOST_SLC0HOST_RX_EOF_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_EOF_INT_ENA (BIT(13)) +#define HOST_SLC0HOST_RX_EOF_INT_ENA_M (BIT(13)) +#define HOST_SLC0HOST_RX_EOF_INT_ENA_V 0x1 +#define HOST_SLC0HOST_RX_EOF_INT_ENA_S 13 +/* HOST_SLC0HOST_RX_SOF_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_SOF_INT_ENA (BIT(12)) +#define HOST_SLC0HOST_RX_SOF_INT_ENA_M (BIT(12)) +#define HOST_SLC0HOST_RX_SOF_INT_ENA_V 0x1 +#define HOST_SLC0HOST_RX_SOF_INT_ENA_S 12 +/* HOST_SLC0_TOKEN1_0TO1_INT_ENA : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN1_0TO1_INT_ENA (BIT(11)) +#define HOST_SLC0_TOKEN1_0TO1_INT_ENA_M (BIT(11)) +#define HOST_SLC0_TOKEN1_0TO1_INT_ENA_V 0x1 +#define HOST_SLC0_TOKEN1_0TO1_INT_ENA_S 11 +/* HOST_SLC0_TOKEN0_0TO1_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0_0TO1_INT_ENA (BIT(10)) +#define HOST_SLC0_TOKEN0_0TO1_INT_ENA_M (BIT(10)) +#define HOST_SLC0_TOKEN0_0TO1_INT_ENA_V 0x1 +#define HOST_SLC0_TOKEN0_0TO1_INT_ENA_S 10 +/* HOST_SLC0_TOKEN1_1TO0_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN1_1TO0_INT_ENA (BIT(9)) +#define HOST_SLC0_TOKEN1_1TO0_INT_ENA_M (BIT(9)) +#define HOST_SLC0_TOKEN1_1TO0_INT_ENA_V 0x1 +#define HOST_SLC0_TOKEN1_1TO0_INT_ENA_S 9 +/* HOST_SLC0_TOKEN0_1TO0_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0_1TO0_INT_ENA (BIT(8)) +#define HOST_SLC0_TOKEN0_1TO0_INT_ENA_M (BIT(8)) +#define HOST_SLC0_TOKEN0_1TO0_INT_ENA_V 0x1 +#define HOST_SLC0_TOKEN0_1TO0_INT_ENA_S 8 +/* HOST_SLC0_TOHOST_BIT7_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT7_INT_ENA (BIT(7)) +#define HOST_SLC0_TOHOST_BIT7_INT_ENA_M (BIT(7)) +#define HOST_SLC0_TOHOST_BIT7_INT_ENA_V 0x1 +#define HOST_SLC0_TOHOST_BIT7_INT_ENA_S 7 +/* HOST_SLC0_TOHOST_BIT6_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT6_INT_ENA (BIT(6)) +#define HOST_SLC0_TOHOST_BIT6_INT_ENA_M (BIT(6)) +#define HOST_SLC0_TOHOST_BIT6_INT_ENA_V 0x1 +#define HOST_SLC0_TOHOST_BIT6_INT_ENA_S 6 +/* HOST_SLC0_TOHOST_BIT5_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT5_INT_ENA (BIT(5)) +#define HOST_SLC0_TOHOST_BIT5_INT_ENA_M (BIT(5)) +#define HOST_SLC0_TOHOST_BIT5_INT_ENA_V 0x1 +#define HOST_SLC0_TOHOST_BIT5_INT_ENA_S 5 +/* HOST_SLC0_TOHOST_BIT4_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT4_INT_ENA (BIT(4)) +#define HOST_SLC0_TOHOST_BIT4_INT_ENA_M (BIT(4)) +#define HOST_SLC0_TOHOST_BIT4_INT_ENA_V 0x1 +#define HOST_SLC0_TOHOST_BIT4_INT_ENA_S 4 +/* HOST_SLC0_TOHOST_BIT3_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT3_INT_ENA (BIT(3)) +#define HOST_SLC0_TOHOST_BIT3_INT_ENA_M (BIT(3)) +#define HOST_SLC0_TOHOST_BIT3_INT_ENA_V 0x1 +#define HOST_SLC0_TOHOST_BIT3_INT_ENA_S 3 +/* HOST_SLC0_TOHOST_BIT2_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT2_INT_ENA (BIT(2)) +#define HOST_SLC0_TOHOST_BIT2_INT_ENA_M (BIT(2)) +#define HOST_SLC0_TOHOST_BIT2_INT_ENA_V 0x1 +#define HOST_SLC0_TOHOST_BIT2_INT_ENA_S 2 +/* HOST_SLC0_TOHOST_BIT1_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT1_INT_ENA (BIT(1)) +#define HOST_SLC0_TOHOST_BIT1_INT_ENA_M (BIT(1)) +#define HOST_SLC0_TOHOST_BIT1_INT_ENA_V 0x1 +#define HOST_SLC0_TOHOST_BIT1_INT_ENA_S 1 +/* HOST_SLC0_TOHOST_BIT0_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT0_INT_ENA (BIT(0)) +#define HOST_SLC0_TOHOST_BIT0_INT_ENA_M (BIT(0)) +#define HOST_SLC0_TOHOST_BIT0_INT_ENA_V 0x1 +#define HOST_SLC0_TOHOST_BIT0_INT_ENA_S 0 + +#define HOST_SLC0HOST_RX_INFOR_REG (DR_REG_SLCHOST_BASE + 0xF4) +/* HOST_SLC0HOST_RX_INFOR : R/W ;bitpos:[19:0] ;default: 20'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_INFOR 0x000FFFFF +#define HOST_SLC0HOST_RX_INFOR_M ((HOST_SLC0HOST_RX_INFOR_V)<<(HOST_SLC0HOST_RX_INFOR_S)) +#define HOST_SLC0HOST_RX_INFOR_V 0xFFFFF +#define HOST_SLC0HOST_RX_INFOR_S 0 + +#define HOST_SLC0HOST_LEN_WD_REG (DR_REG_SLCHOST_BASE + 0xFC) +/* HOST_SLC0HOST_LEN_WD : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_LEN_WD 0xFFFFFFFF +#define HOST_SLC0HOST_LEN_WD_M ((HOST_SLC0HOST_LEN_WD_V)<<(HOST_SLC0HOST_LEN_WD_S)) +#define HOST_SLC0HOST_LEN_WD_V 0xFFFFFFFF +#define HOST_SLC0HOST_LEN_WD_S 0 + +#define HOST_SLC_APBWIN_WDATA_REG (DR_REG_SLCHOST_BASE + 0x100) +/* HOST_SLC_APBWIN_WDATA : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define HOST_SLC_APBWIN_WDATA 0xFFFFFFFF +#define HOST_SLC_APBWIN_WDATA_M ((HOST_SLC_APBWIN_WDATA_V)<<(HOST_SLC_APBWIN_WDATA_S)) +#define HOST_SLC_APBWIN_WDATA_V 0xFFFFFFFF +#define HOST_SLC_APBWIN_WDATA_S 0 + +#define HOST_SLC_APBWIN_CONF_REG (DR_REG_SLCHOST_BASE + 0x104) +/* HOST_SLC_APBWIN_BUS : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC_APBWIN_BUS (BIT(30)) +#define HOST_SLC_APBWIN_BUS_M (BIT(30)) +#define HOST_SLC_APBWIN_BUS_V 0x1 +#define HOST_SLC_APBWIN_BUS_S 30 +/* HOST_SLC_APBWIN_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC_APBWIN_START (BIT(29)) +#define HOST_SLC_APBWIN_START_M (BIT(29)) +#define HOST_SLC_APBWIN_START_V 0x1 +#define HOST_SLC_APBWIN_START_S 29 +/* HOST_SLC_APBWIN_WR : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC_APBWIN_WR (BIT(28)) +#define HOST_SLC_APBWIN_WR_M (BIT(28)) +#define HOST_SLC_APBWIN_WR_V 0x1 +#define HOST_SLC_APBWIN_WR_S 28 +/* HOST_SLC_APBWIN_ADDR : R/W ;bitpos:[27:0] ;default: 28'b0 ; */ +/*description: */ +#define HOST_SLC_APBWIN_ADDR 0x0FFFFFFF +#define HOST_SLC_APBWIN_ADDR_M ((HOST_SLC_APBWIN_ADDR_V)<<(HOST_SLC_APBWIN_ADDR_S)) +#define HOST_SLC_APBWIN_ADDR_V 0xFFFFFFF +#define HOST_SLC_APBWIN_ADDR_S 0 + +#define HOST_SLC_APBWIN_RDATA_REG (DR_REG_SLCHOST_BASE + 0x108) +/* HOST_SLC_APBWIN_RDATA : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define HOST_SLC_APBWIN_RDATA 0xFFFFFFFF +#define HOST_SLC_APBWIN_RDATA_M ((HOST_SLC_APBWIN_RDATA_V)<<(HOST_SLC_APBWIN_RDATA_S)) +#define HOST_SLC_APBWIN_RDATA_V 0xFFFFFFFF +#define HOST_SLC_APBWIN_RDATA_S 0 + +#define HOST_SLCHOST_RDCLR0_REG (DR_REG_SLCHOST_BASE + 0x10C) +/* HOST_SLCHOST_SLC0_BIT6_CLRADDR : R/W ;bitpos:[17:9] ;default: 9'h1e0 ; */ +/*description: */ +#define HOST_SLCHOST_SLC0_BIT6_CLRADDR 0x000001FF +#define HOST_SLCHOST_SLC0_BIT6_CLRADDR_M ((HOST_SLCHOST_SLC0_BIT6_CLRADDR_V)<<(HOST_SLCHOST_SLC0_BIT6_CLRADDR_S)) +#define HOST_SLCHOST_SLC0_BIT6_CLRADDR_V 0x1FF +#define HOST_SLCHOST_SLC0_BIT6_CLRADDR_S 9 +/* HOST_SLCHOST_SLC0_BIT7_CLRADDR : R/W ;bitpos:[8:0] ;default: 9'h44 ; */ +/*description: */ +#define HOST_SLCHOST_SLC0_BIT7_CLRADDR 0x000001FF +#define HOST_SLCHOST_SLC0_BIT7_CLRADDR_M ((HOST_SLCHOST_SLC0_BIT7_CLRADDR_V)<<(HOST_SLCHOST_SLC0_BIT7_CLRADDR_S)) +#define HOST_SLCHOST_SLC0_BIT7_CLRADDR_V 0x1FF +#define HOST_SLCHOST_SLC0_BIT7_CLRADDR_S 0 + +#define HOST_SLC0HOST_INT_ENA1_REG (DR_REG_SLCHOST_BASE + 0x114) +/* HOST_GPIO_SDIO_INT_ENA1 : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define HOST_GPIO_SDIO_INT_ENA1 (BIT(25)) +#define HOST_GPIO_SDIO_INT_ENA1_M (BIT(25)) +#define HOST_GPIO_SDIO_INT_ENA1_V 0x1 +#define HOST_GPIO_SDIO_INT_ENA1_S 25 +/* HOST_SLC0_HOST_RD_RETRY_INT_ENA1 : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_HOST_RD_RETRY_INT_ENA1 (BIT(24)) +#define HOST_SLC0_HOST_RD_RETRY_INT_ENA1_M (BIT(24)) +#define HOST_SLC0_HOST_RD_RETRY_INT_ENA1_V 0x1 +#define HOST_SLC0_HOST_RD_RETRY_INT_ENA1_S 24 +/* HOST_SLC0_RX_NEW_PACKET_INT_ENA1 : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_NEW_PACKET_INT_ENA1 (BIT(23)) +#define HOST_SLC0_RX_NEW_PACKET_INT_ENA1_M (BIT(23)) +#define HOST_SLC0_RX_NEW_PACKET_INT_ENA1_V 0x1 +#define HOST_SLC0_RX_NEW_PACKET_INT_ENA1_S 23 +/* HOST_SLC0_EXT_BIT3_INT_ENA1 : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT3_INT_ENA1 (BIT(22)) +#define HOST_SLC0_EXT_BIT3_INT_ENA1_M (BIT(22)) +#define HOST_SLC0_EXT_BIT3_INT_ENA1_V 0x1 +#define HOST_SLC0_EXT_BIT3_INT_ENA1_S 22 +/* HOST_SLC0_EXT_BIT2_INT_ENA1 : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT2_INT_ENA1 (BIT(21)) +#define HOST_SLC0_EXT_BIT2_INT_ENA1_M (BIT(21)) +#define HOST_SLC0_EXT_BIT2_INT_ENA1_V 0x1 +#define HOST_SLC0_EXT_BIT2_INT_ENA1_S 21 +/* HOST_SLC0_EXT_BIT1_INT_ENA1 : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT1_INT_ENA1 (BIT(20)) +#define HOST_SLC0_EXT_BIT1_INT_ENA1_M (BIT(20)) +#define HOST_SLC0_EXT_BIT1_INT_ENA1_V 0x1 +#define HOST_SLC0_EXT_BIT1_INT_ENA1_S 20 +/* HOST_SLC0_EXT_BIT0_INT_ENA1 : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_EXT_BIT0_INT_ENA1 (BIT(19)) +#define HOST_SLC0_EXT_BIT0_INT_ENA1_M (BIT(19)) +#define HOST_SLC0_EXT_BIT0_INT_ENA1_V 0x1 +#define HOST_SLC0_EXT_BIT0_INT_ENA1_S 19 +/* HOST_SLC0_RX_PF_VALID_INT_ENA1 : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_PF_VALID_INT_ENA1 (BIT(18)) +#define HOST_SLC0_RX_PF_VALID_INT_ENA1_M (BIT(18)) +#define HOST_SLC0_RX_PF_VALID_INT_ENA1_V 0x1 +#define HOST_SLC0_RX_PF_VALID_INT_ENA1_S 18 +/* HOST_SLC0_TX_OVF_INT_ENA1 : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TX_OVF_INT_ENA1 (BIT(17)) +#define HOST_SLC0_TX_OVF_INT_ENA1_M (BIT(17)) +#define HOST_SLC0_TX_OVF_INT_ENA1_V 0x1 +#define HOST_SLC0_TX_OVF_INT_ENA1_S 17 +/* HOST_SLC0_RX_UDF_INT_ENA1 : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_RX_UDF_INT_ENA1 (BIT(16)) +#define HOST_SLC0_RX_UDF_INT_ENA1_M (BIT(16)) +#define HOST_SLC0_RX_UDF_INT_ENA1_V 0x1 +#define HOST_SLC0_RX_UDF_INT_ENA1_S 16 +/* HOST_SLC0HOST_TX_START_INT_ENA1 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_TX_START_INT_ENA1 (BIT(15)) +#define HOST_SLC0HOST_TX_START_INT_ENA1_M (BIT(15)) +#define HOST_SLC0HOST_TX_START_INT_ENA1_V 0x1 +#define HOST_SLC0HOST_TX_START_INT_ENA1_S 15 +/* HOST_SLC0HOST_RX_START_INT_ENA1 : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_START_INT_ENA1 (BIT(14)) +#define HOST_SLC0HOST_RX_START_INT_ENA1_M (BIT(14)) +#define HOST_SLC0HOST_RX_START_INT_ENA1_V 0x1 +#define HOST_SLC0HOST_RX_START_INT_ENA1_S 14 +/* HOST_SLC0HOST_RX_EOF_INT_ENA1 : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_EOF_INT_ENA1 (BIT(13)) +#define HOST_SLC0HOST_RX_EOF_INT_ENA1_M (BIT(13)) +#define HOST_SLC0HOST_RX_EOF_INT_ENA1_V 0x1 +#define HOST_SLC0HOST_RX_EOF_INT_ENA1_S 13 +/* HOST_SLC0HOST_RX_SOF_INT_ENA1 : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0HOST_RX_SOF_INT_ENA1 (BIT(12)) +#define HOST_SLC0HOST_RX_SOF_INT_ENA1_M (BIT(12)) +#define HOST_SLC0HOST_RX_SOF_INT_ENA1_V 0x1 +#define HOST_SLC0HOST_RX_SOF_INT_ENA1_S 12 +/* HOST_SLC0_TOKEN1_0TO1_INT_ENA1 : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN1_0TO1_INT_ENA1 (BIT(11)) +#define HOST_SLC0_TOKEN1_0TO1_INT_ENA1_M (BIT(11)) +#define HOST_SLC0_TOKEN1_0TO1_INT_ENA1_V 0x1 +#define HOST_SLC0_TOKEN1_0TO1_INT_ENA1_S 11 +/* HOST_SLC0_TOKEN0_0TO1_INT_ENA1 : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0_0TO1_INT_ENA1 (BIT(10)) +#define HOST_SLC0_TOKEN0_0TO1_INT_ENA1_M (BIT(10)) +#define HOST_SLC0_TOKEN0_0TO1_INT_ENA1_V 0x1 +#define HOST_SLC0_TOKEN0_0TO1_INT_ENA1_S 10 +/* HOST_SLC0_TOKEN1_1TO0_INT_ENA1 : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN1_1TO0_INT_ENA1 (BIT(9)) +#define HOST_SLC0_TOKEN1_1TO0_INT_ENA1_M (BIT(9)) +#define HOST_SLC0_TOKEN1_1TO0_INT_ENA1_V 0x1 +#define HOST_SLC0_TOKEN1_1TO0_INT_ENA1_S 9 +/* HOST_SLC0_TOKEN0_1TO0_INT_ENA1 : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOKEN0_1TO0_INT_ENA1 (BIT(8)) +#define HOST_SLC0_TOKEN0_1TO0_INT_ENA1_M (BIT(8)) +#define HOST_SLC0_TOKEN0_1TO0_INT_ENA1_V 0x1 +#define HOST_SLC0_TOKEN0_1TO0_INT_ENA1_S 8 +/* HOST_SLC0_TOHOST_BIT7_INT_ENA1 : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT7_INT_ENA1 (BIT(7)) +#define HOST_SLC0_TOHOST_BIT7_INT_ENA1_M (BIT(7)) +#define HOST_SLC0_TOHOST_BIT7_INT_ENA1_V 0x1 +#define HOST_SLC0_TOHOST_BIT7_INT_ENA1_S 7 +/* HOST_SLC0_TOHOST_BIT6_INT_ENA1 : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT6_INT_ENA1 (BIT(6)) +#define HOST_SLC0_TOHOST_BIT6_INT_ENA1_M (BIT(6)) +#define HOST_SLC0_TOHOST_BIT6_INT_ENA1_V 0x1 +#define HOST_SLC0_TOHOST_BIT6_INT_ENA1_S 6 +/* HOST_SLC0_TOHOST_BIT5_INT_ENA1 : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT5_INT_ENA1 (BIT(5)) +#define HOST_SLC0_TOHOST_BIT5_INT_ENA1_M (BIT(5)) +#define HOST_SLC0_TOHOST_BIT5_INT_ENA1_V 0x1 +#define HOST_SLC0_TOHOST_BIT5_INT_ENA1_S 5 +/* HOST_SLC0_TOHOST_BIT4_INT_ENA1 : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT4_INT_ENA1 (BIT(4)) +#define HOST_SLC0_TOHOST_BIT4_INT_ENA1_M (BIT(4)) +#define HOST_SLC0_TOHOST_BIT4_INT_ENA1_V 0x1 +#define HOST_SLC0_TOHOST_BIT4_INT_ENA1_S 4 +/* HOST_SLC0_TOHOST_BIT3_INT_ENA1 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT3_INT_ENA1 (BIT(3)) +#define HOST_SLC0_TOHOST_BIT3_INT_ENA1_M (BIT(3)) +#define HOST_SLC0_TOHOST_BIT3_INT_ENA1_V 0x1 +#define HOST_SLC0_TOHOST_BIT3_INT_ENA1_S 3 +/* HOST_SLC0_TOHOST_BIT2_INT_ENA1 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT2_INT_ENA1 (BIT(2)) +#define HOST_SLC0_TOHOST_BIT2_INT_ENA1_M (BIT(2)) +#define HOST_SLC0_TOHOST_BIT2_INT_ENA1_V 0x1 +#define HOST_SLC0_TOHOST_BIT2_INT_ENA1_S 2 +/* HOST_SLC0_TOHOST_BIT1_INT_ENA1 : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT1_INT_ENA1 (BIT(1)) +#define HOST_SLC0_TOHOST_BIT1_INT_ENA1_M (BIT(1)) +#define HOST_SLC0_TOHOST_BIT1_INT_ENA1_V 0x1 +#define HOST_SLC0_TOHOST_BIT1_INT_ENA1_S 1 +/* HOST_SLC0_TOHOST_BIT0_INT_ENA1 : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SLC0_TOHOST_BIT0_INT_ENA1 (BIT(0)) +#define HOST_SLC0_TOHOST_BIT0_INT_ENA1_M (BIT(0)) +#define HOST_SLC0_TOHOST_BIT0_INT_ENA1_V 0x1 +#define HOST_SLC0_TOHOST_BIT0_INT_ENA1_S 0 + +#define HOST_SLCHOSTDATE_REG (DR_REG_SLCHOST_BASE + 0x178) +/* HOST_SLCHOST_DATE : R/W ;bitpos:[31:0] ;default: 32'h18080700 ; */ +/*description: */ +#define HOST_SLCHOST_DATE 0xFFFFFFFF +#define HOST_SLCHOST_DATE_M ((HOST_SLCHOST_DATE_V)<<(HOST_SLCHOST_DATE_S)) +#define HOST_SLCHOST_DATE_V 0xFFFFFFFF +#define HOST_SLCHOST_DATE_S 0 + +#define HOST_SLCHOSTID_REG (DR_REG_SLCHOST_BASE + 0x17C) +/* HOST_SLCHOST_ID : R/W ;bitpos:[31:0] ;default: 32'h0600 ; */ +/*description: */ +#define HOST_SLCHOST_ID 0xFFFFFFFF +#define HOST_SLCHOST_ID_M ((HOST_SLCHOST_ID_V)<<(HOST_SLCHOST_ID_S)) +#define HOST_SLCHOST_ID_V 0xFFFFFFFF +#define HOST_SLCHOST_ID_S 0 + +#define HOST_SLCHOST_CONF_REG (DR_REG_SLCHOST_BASE + 0x1F0) +/* HOST_HSPEED_CON_EN : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define HOST_HSPEED_CON_EN (BIT(27)) +#define HOST_HSPEED_CON_EN_M (BIT(27)) +#define HOST_HSPEED_CON_EN_V 0x1 +#define HOST_HSPEED_CON_EN_S 27 +/* HOST_SDIO_PAD_PULLUP : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SDIO_PAD_PULLUP (BIT(26)) +#define HOST_SDIO_PAD_PULLUP_M (BIT(26)) +#define HOST_SDIO_PAD_PULLUP_V 0x1 +#define HOST_SDIO_PAD_PULLUP_S 26 +/* HOST_SDIO20_INT_DELAY : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define HOST_SDIO20_INT_DELAY (BIT(25)) +#define HOST_SDIO20_INT_DELAY_M (BIT(25)) +#define HOST_SDIO20_INT_DELAY_V 0x1 +#define HOST_SDIO20_INT_DELAY_S 25 +/* HOST_FRC_QUICK_IN : R/W ;bitpos:[24:20] ;default: 5'b0 ; */ +/*description: */ +#define HOST_FRC_QUICK_IN 0x0000001F +#define HOST_FRC_QUICK_IN_M ((HOST_FRC_QUICK_IN_V)<<(HOST_FRC_QUICK_IN_S)) +#define HOST_FRC_QUICK_IN_V 0x1F +#define HOST_FRC_QUICK_IN_S 20 +/* HOST_FRC_POS_SAMP : R/W ;bitpos:[19:15] ;default: 5'b0 ; */ +/*description: */ +#define HOST_FRC_POS_SAMP 0x0000001F +#define HOST_FRC_POS_SAMP_M ((HOST_FRC_POS_SAMP_V)<<(HOST_FRC_POS_SAMP_S)) +#define HOST_FRC_POS_SAMP_V 0x1F +#define HOST_FRC_POS_SAMP_S 15 +/* HOST_FRC_NEG_SAMP : R/W ;bitpos:[14:10] ;default: 5'b0 ; */ +/*description: */ +#define HOST_FRC_NEG_SAMP 0x0000001F +#define HOST_FRC_NEG_SAMP_M ((HOST_FRC_NEG_SAMP_V)<<(HOST_FRC_NEG_SAMP_S)) +#define HOST_FRC_NEG_SAMP_V 0x1F +#define HOST_FRC_NEG_SAMP_S 10 +/* HOST_FRC_SDIO20 : R/W ;bitpos:[9:5] ;default: 5'b0 ; */ +/*description: */ +#define HOST_FRC_SDIO20 0x0000001F +#define HOST_FRC_SDIO20_M ((HOST_FRC_SDIO20_V)<<(HOST_FRC_SDIO20_S)) +#define HOST_FRC_SDIO20_V 0x1F +#define HOST_FRC_SDIO20_S 5 +/* HOST_FRC_SDIO11 : R/W ;bitpos:[4:0] ;default: 5'b0 ; */ +/*description: */ +#define HOST_FRC_SDIO11 0x0000001F +#define HOST_FRC_SDIO11_M ((HOST_FRC_SDIO11_V)<<(HOST_FRC_SDIO11_S)) +#define HOST_FRC_SDIO11_V 0x1F +#define HOST_FRC_SDIO11_S 0 + +#define HOST_SLCHOST_INF_ST_REG (DR_REG_SLCHOST_BASE + 0x1F4) +/* HOST_SDIO_QUICK_IN : RO ;bitpos:[14:10] ;default: 5'b0 ; */ +/*description: */ +#define HOST_SDIO_QUICK_IN 0x0000001F +#define HOST_SDIO_QUICK_IN_M ((HOST_SDIO_QUICK_IN_V)<<(HOST_SDIO_QUICK_IN_S)) +#define HOST_SDIO_QUICK_IN_V 0x1F +#define HOST_SDIO_QUICK_IN_S 10 +/* HOST_SDIO_NEG_SAMP : RO ;bitpos:[9:5] ;default: 5'b0 ; */ +/*description: */ +#define HOST_SDIO_NEG_SAMP 0x0000001F +#define HOST_SDIO_NEG_SAMP_M ((HOST_SDIO_NEG_SAMP_V)<<(HOST_SDIO_NEG_SAMP_S)) +#define HOST_SDIO_NEG_SAMP_V 0x1F +#define HOST_SDIO_NEG_SAMP_S 5 +/* HOST_SDIO20_MODE : RO ;bitpos:[4:0] ;default: 5'b0 ; */ +/*description: */ +#define HOST_SDIO20_MODE 0x0000001F +#define HOST_SDIO20_MODE_M ((HOST_SDIO20_MODE_V)<<(HOST_SDIO20_MODE_S)) +#define HOST_SDIO20_MODE_V 0x1F +#define HOST_SDIO20_MODE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_HOST_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/host_struct.h b/components/soc/esp32s2beta/include/soc/host_struct.h new file mode 100644 index 0000000000..fd7844c384 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/host_struct.h @@ -0,0 +1,602 @@ +// Copyright 2017-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_HOST_STRUCT_H_ +#define _SOC_HOST_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + uint32_t reserved_0; + uint32_t reserved_4; + uint32_t reserved_8; + uint32_t reserved_c; + uint32_t reserved_10; + uint32_t reserved_14; + uint32_t reserved_18; + uint32_t reserved_1c; + union { + struct { + uint32_t func1_mdstat: 1; + uint32_t reserved1: 31; + }; + uint32_t val; + } func2_2; + uint32_t reserved_24; + uint32_t reserved_28; + uint32_t reserved_2c; + uint32_t reserved_30; + uint32_t gpio_status0; /**/ + union { + struct { + uint32_t sdio_int1: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } gpio_status1; + uint32_t gpio_in0; /**/ + union { + struct { + uint32_t sdio_in1: 22; + uint32_t reserved22: 10; + }; + uint32_t val; + } gpio_in1; + union { + struct { + uint32_t token0: 12; + uint32_t rx_pf_valid: 1; + uint32_t reserved13: 3; + uint32_t reg_token1: 12; + uint32_t rx_pf_eof: 4; + }; + uint32_t val; + } slc0_token_rdata; + uint32_t slc0_pf; /**/ + uint32_t reserved_4c; + union { + struct { + uint32_t tohost_bit0: 1; + uint32_t tohost_bit1: 1; + uint32_t tohost_bit2: 1; + uint32_t tohost_bit3: 1; + uint32_t tohost_bit4: 1; + uint32_t tohost_bit5: 1; + uint32_t tohost_bit6: 1; + uint32_t tohost_bit7: 1; + uint32_t token0_1to0: 1; + uint32_t token1_1to0: 1; + uint32_t token0_0to1: 1; + uint32_t token1_0to1: 1; + uint32_t rx_sof: 1; + uint32_t rx_eof: 1; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_udf: 1; + uint32_t tx_ovf: 1; + uint32_t rx_pf_valid: 1; + uint32_t ext_bit0: 1; + uint32_t ext_bit1: 1; + uint32_t ext_bit2: 1; + uint32_t ext_bit3: 1; + uint32_t rx_new_packet: 1; + uint32_t rd_retry: 1; + uint32_t gpio_sdio: 1; + uint32_t reserved26: 6; + }; + uint32_t val; + } slc0_int_raw; + uint32_t reserved_54; + union { + struct { + uint32_t tohost_bit0: 1; + uint32_t tohost_bit1: 1; + uint32_t tohost_bit2: 1; + uint32_t tohost_bit3: 1; + uint32_t tohost_bit4: 1; + uint32_t tohost_bit5: 1; + uint32_t tohost_bit6: 1; + uint32_t tohost_bit7: 1; + uint32_t token0_1to0: 1; + uint32_t token1_1to0: 1; + uint32_t token0_0to1: 1; + uint32_t token1_0to1: 1; + uint32_t rx_sof: 1; + uint32_t rx_eof: 1; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_udf: 1; + uint32_t tx_ovf: 1; + uint32_t rx_pf_valid: 1; + uint32_t ext_bit0: 1; + uint32_t ext_bit1: 1; + uint32_t ext_bit2: 1; + uint32_t ext_bit3: 1; + uint32_t rx_new_packet: 1; + uint32_t rd_retry: 1; + uint32_t gpio_sdio: 1; + uint32_t reserved26: 6; + }; + uint32_t val; + } slc0_int_st; + uint32_t reserved_5c; + union { + struct { + uint32_t reg_slc0_len: 20; + uint32_t reg_slc0_len_check:12; + }; + uint32_t val; + } pkt_len; + union { + struct { + uint32_t state0: 8; + uint32_t state1: 8; + uint32_t state2: 8; + uint32_t state3: 8; + }; + uint32_t val; + } state_w0; + union { + struct { + uint32_t state4: 8; + uint32_t state5: 8; + uint32_t state6: 8; + uint32_t state7: 8; + }; + uint32_t val; + } state_w1; + union { + struct { + uint32_t conf0: 8; + uint32_t conf1: 8; + uint32_t conf2: 8; + uint32_t conf3: 8; + }; + uint32_t val; + } conf_w0; + union { + struct { + uint32_t conf4: 8; + uint32_t conf5: 8; + uint32_t conf6: 8; + uint32_t conf7: 8; + }; + uint32_t val; + } conf_w1; + union { + struct { + uint32_t conf8: 8; + uint32_t conf9: 8; + uint32_t conf10: 8; + uint32_t conf11: 8; + }; + uint32_t val; + } conf_w2; + union { + struct { + uint32_t conf12: 8; + uint32_t conf13: 8; + uint32_t conf14: 8; + uint32_t conf15: 8; + }; + uint32_t val; + } conf_w3; + union { + struct { + uint32_t conf16: 8; /*SLC timeout value*/ + uint32_t conf17: 8; /*SLC timeout enable*/ + uint32_t conf18: 8; + uint32_t conf19: 8; /*Interrupt to target CPU*/ + }; + uint32_t val; + } conf_w4; + union { + struct { + uint32_t conf20: 8; + uint32_t conf21: 8; + uint32_t conf22: 8; + uint32_t conf23: 8; + }; + uint32_t val; + } conf_w5; + union { + struct { + uint32_t win_cmd: 16; + uint32_t reserved16: 16; + }; + uint32_t val; + } win_cmd; + union { + struct { + uint32_t conf24: 8; + uint32_t conf25: 8; + uint32_t conf26: 8; + uint32_t conf27: 8; + }; + uint32_t val; + } conf_w6; + union { + struct { + uint32_t conf28: 8; + uint32_t conf29: 8; + uint32_t conf30: 8; + uint32_t conf31: 8; + }; + uint32_t val; + } conf_w7; + union { + struct { + uint32_t reg_slc0_len0: 20; + uint32_t reg_slc0_len0_check:12; + }; + uint32_t val; + } pkt_len0; + union { + struct { + uint32_t reg_slc0_len1: 20; + uint32_t reg_slc0_len1_check:12; + }; + uint32_t val; + } pkt_len1; + union { + struct { + uint32_t reg_slc0_len2: 20; + uint32_t reg_slc0_len2_check:12; + }; + uint32_t val; + } pkt_len2; + union { + struct { + uint32_t conf32: 8; + uint32_t conf33: 8; + uint32_t conf34: 8; + uint32_t conf35: 8; + }; + uint32_t val; + } conf_w8; + union { + struct { + uint32_t conf36: 8; + uint32_t conf37: 8; + uint32_t conf38: 8; + uint32_t conf39: 8; + }; + uint32_t val; + } conf_w9; + union { + struct { + uint32_t conf40: 8; + uint32_t conf41: 8; + uint32_t conf42: 8; + uint32_t conf43: 8; + }; + uint32_t val; + } conf_w10; + union { + struct { + uint32_t conf44: 8; + uint32_t conf45: 8; + uint32_t conf46: 8; + uint32_t conf47: 8; + }; + uint32_t val; + } conf_w11; + union { + struct { + uint32_t conf48: 8; + uint32_t conf49: 8; + uint32_t conf50: 8; + uint32_t conf51: 8; + }; + uint32_t val; + } conf_w12; + union { + struct { + uint32_t conf52: 8; + uint32_t conf53: 8; + uint32_t conf54: 8; + uint32_t conf55: 8; + }; + uint32_t val; + } conf_w13; + union { + struct { + uint32_t conf56: 8; + uint32_t conf57: 8; + uint32_t conf58: 8; + uint32_t conf59: 8; + }; + uint32_t val; + } conf_w14; + union { + struct { + uint32_t conf60: 8; + uint32_t conf61: 8; + uint32_t conf62: 8; + uint32_t conf63: 8; + }; + uint32_t val; + } conf_w15; + uint32_t check_sum0; /**/ + uint32_t check_sum1; /**/ + uint32_t reserved_c4; + union { + struct { + uint32_t token0_wd: 12; + uint32_t reserved12: 4; + uint32_t token1_wd: 12; + uint32_t reserved28: 4; + }; + uint32_t val; + } slc0_token_wdata; + uint32_t reserved_cc; + union { + struct { + uint32_t slc0_token0_dec: 1; + uint32_t slc0_token1_dec: 1; + uint32_t slc0_token0_wr: 1; + uint32_t slc0_token1_wr: 1; + uint32_t reserved4: 4; + uint32_t slc0_len_wr: 1; + uint32_t reserved9: 23; + }; + uint32_t val; + } token_con; + union { + struct { + uint32_t tohost_bit0: 1; + uint32_t tohost_bit1: 1; + uint32_t tohost_bit2: 1; + uint32_t tohost_bit3: 1; + uint32_t tohost_bit4: 1; + uint32_t tohost_bit5: 1; + uint32_t tohost_bit6: 1; + uint32_t tohost_bit7: 1; + uint32_t token0_1to0: 1; + uint32_t token1_1to0: 1; + uint32_t token0_0to1: 1; + uint32_t token1_0to1: 1; + uint32_t rx_sof: 1; + uint32_t rx_eof: 1; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_udf: 1; + uint32_t tx_ovf: 1; + uint32_t rx_pf_valid: 1; + uint32_t ext_bit0: 1; + uint32_t ext_bit1: 1; + uint32_t ext_bit2: 1; + uint32_t ext_bit3: 1; + uint32_t rx_new_packet: 1; + uint32_t rd_retry: 1; + uint32_t gpio_sdio: 1; + uint32_t reserved26: 6; + }; + uint32_t val; + } slc0_int_clr; + uint32_t reserved_d8; + union { + struct { + uint32_t tohost_bit0: 1; + uint32_t tohost_bit1: 1; + uint32_t tohost_bit2: 1; + uint32_t tohost_bit3: 1; + uint32_t tohost_bit4: 1; + uint32_t tohost_bit5: 1; + uint32_t tohost_bit6: 1; + uint32_t tohost_bit7: 1; + uint32_t token0_1to0: 1; + uint32_t token1_1to0: 1; + uint32_t token0_0to1: 1; + uint32_t token1_0to1: 1; + uint32_t rx_sof: 1; + uint32_t rx_eof: 1; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_udf: 1; + uint32_t tx_ovf: 1; + uint32_t rx_pf_valid: 1; + uint32_t ext_bit0: 1; + uint32_t ext_bit1: 1; + uint32_t ext_bit2: 1; + uint32_t ext_bit3: 1; + uint32_t rx_new_packet: 1; + uint32_t rd_retry: 1; + uint32_t gpio_sdio: 1; + uint32_t reserved26: 6; + }; + uint32_t val; + } slc0_func1_int_ena; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + union { + struct { + uint32_t tohost_bit0: 1; + uint32_t tohost_bit1: 1; + uint32_t tohost_bit2: 1; + uint32_t tohost_bit3: 1; + uint32_t tohost_bit4: 1; + uint32_t tohost_bit5: 1; + uint32_t tohost_bit6: 1; + uint32_t tohost_bit7: 1; + uint32_t token0_1to0: 1; + uint32_t token1_1to0: 1; + uint32_t token0_0to1: 1; + uint32_t token1_0to1: 1; + uint32_t rx_sof: 1; + uint32_t rx_eof: 1; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_udf: 1; + uint32_t tx_ovf: 1; + uint32_t rx_pf_valid: 1; + uint32_t ext_bit0: 1; + uint32_t ext_bit1: 1; + uint32_t ext_bit2: 1; + uint32_t ext_bit3: 1; + uint32_t rx_new_packet: 1; + uint32_t rd_retry: 1; + uint32_t gpio_sdio: 1; + uint32_t reserved26: 6; + }; + uint32_t val; + } slc0_int_ena; + uint32_t reserved_f0; + union { + struct { + uint32_t infor: 20; + uint32_t reserved20: 12; + }; + uint32_t val; + } slc0_rx_infor; + uint32_t reserved_f8; + uint32_t slc0_len_wd; /**/ + uint32_t apbwin_wdata; /**/ + union { + struct { + uint32_t addr: 28; + uint32_t wr: 1; + uint32_t start: 1; + uint32_t bus: 1; + uint32_t reserved31: 1; + }; + uint32_t val; + } apbwin_conf; + uint32_t apbwin_rdata; /**/ + union { + struct { + uint32_t bit7_clraddr: 9; + uint32_t bit6_clraddr: 9; + uint32_t reserved18: 14; + }; + uint32_t val; + } slc0_rdclr; + uint32_t reserved_110; + union { + struct { + uint32_t tohost_bit01: 1; + uint32_t tohost_bit11: 1; + uint32_t tohost_bit21: 1; + uint32_t tohost_bit31: 1; + uint32_t tohost_bit41: 1; + uint32_t tohost_bit51: 1; + uint32_t tohost_bit61: 1; + uint32_t tohost_bit71: 1; + uint32_t token0_1to01: 1; + uint32_t token1_1to01: 1; + uint32_t token0_0to11: 1; + uint32_t token1_0to11: 1; + uint32_t rx_sof1: 1; + uint32_t rx_eof1: 1; + uint32_t rx_start1: 1; + uint32_t tx_start1: 1; + uint32_t rx_udf1: 1; + uint32_t tx_ovf1: 1; + uint32_t rx_pf_valid1: 1; + uint32_t ext_bit01: 1; + uint32_t ext_bit11: 1; + uint32_t ext_bit21: 1; + uint32_t ext_bit31: 1; + uint32_t rx_new_packet1: 1; + uint32_t rd_retry1: 1; + uint32_t gpio_sdio1: 1; + uint32_t reserved26: 6; + }; + uint32_t val; + } slc0_int_ena1; + uint32_t reserved_118; + uint32_t reserved_11c; + uint32_t reserved_120; + uint32_t reserved_124; + uint32_t reserved_128; + uint32_t reserved_12c; + uint32_t reserved_130; + uint32_t reserved_134; + uint32_t reserved_138; + uint32_t reserved_13c; + uint32_t reserved_140; + uint32_t reserved_144; + uint32_t reserved_148; + uint32_t reserved_14c; + uint32_t reserved_150; + uint32_t reserved_154; + uint32_t reserved_158; + uint32_t reserved_15c; + uint32_t reserved_160; + uint32_t reserved_164; + uint32_t reserved_168; + uint32_t reserved_16c; + uint32_t reserved_170; + uint32_t reserved_174; + uint32_t date; /**/ + uint32_t id; /**/ + uint32_t reserved_180; + uint32_t reserved_184; + uint32_t reserved_188; + uint32_t reserved_18c; + uint32_t reserved_190; + uint32_t reserved_194; + uint32_t reserved_198; + uint32_t reserved_19c; + uint32_t reserved_1a0; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + union { + struct { + uint32_t frc_sdio11: 5; + uint32_t frc_sdio20: 5; + uint32_t frc_neg_samp: 5; + uint32_t frc_pos_samp: 5; + uint32_t frc_quick_in: 5; + uint32_t sdio20_int_delay: 1; + uint32_t sdio_pad_pullup: 1; + uint32_t hspeed_con_en: 1; + uint32_t reserved28: 4; + }; + uint32_t val; + } conf; + union { + struct { + uint32_t sdio20_mode: 5; + uint32_t sdio_neg_samp: 5; + uint32_t sdio_quick_in: 5; + uint32_t reserved15: 17; + }; + uint32_t val; + } inf_st; +} host_dev_t; +extern host_dev_t HOST; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_HOST_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/hwcrypto_reg.h b/components/soc/esp32s2beta/include/soc/hwcrypto_reg.h new file mode 100644 index 0000000000..cccd2fbeef --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/hwcrypto_reg.h @@ -0,0 +1,107 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef __HWCRYPTO_REG_H__ +#define __HWCRYPTO_REG_H__ + +#include "soc.h" + +/* registers for RSA acceleration via Multiple Precision Integer ops */ +#define RSA_MEM_M_BLOCK_BASE ((DR_REG_RSA_BASE)+0x000) +/* RB & Z use the same memory block, depending on phase of operation */ +#define RSA_MEM_RB_BLOCK_BASE ((DR_REG_RSA_BASE)+0x200) +#define RSA_MEM_Z_BLOCK_BASE ((DR_REG_RSA_BASE)+0x200) +#define RSA_MEM_Y_BLOCK_BASE ((DR_REG_RSA_BASE)+0x400) +#define RSA_MEM_X_BLOCK_BASE ((DR_REG_RSA_BASE)+0x600) + +/* Configuration registers */ +#define RSA_M_DASH_REG (DR_REG_RSA_BASE + 0x800) +#define RSA_LENGTH_REG (DR_REG_RSA_BASE + 0x804) +#define RSA_CONSTANT_TIME_REG (DR_REG_RSA_BASE + 0x820) +#define RSA_SEARCH_OPEN_REG (DR_REG_RSA_BASE + 0x824) +#define RSA_SEARCH_POS_REG (DR_REG_RSA_BASE + 0x828) + +/* Initialization registers */ +#define RSA_QUERY_CLEAN_REG (DR_REG_RSA_BASE + 0x808) + +/* Calculation start registers */ +#define RSA_MODEXP_START_REG (DR_REG_RSA_BASE + 0x80c) +#define RSA_MOD_MULT_START_REG (DR_REG_RSA_BASE + 0x810) +#define RSA_MULT_START_REG (DR_REG_RSA_BASE + 0x814) + +/* Interrupt registers */ +#define RSA_QUERY_INTERRUPT_REG (DR_REG_RSA_BASE + 0x818) +#define RSA_CLEAR_INTERRUPT_REG (DR_REG_RSA_BASE + 0x81C) + +/* SHA acceleration registers */ +#define SHA_MODE_REG ((DR_REG_SHA_BASE) + 0x00) + +#define SHA_MODE_SHA1 0 +#define SHA_MODE_SHA224 1 +#define SHA_MODE_SHA256 2 +#define SHA_MODE_SHA384 3 +#define SHA_MODE_SHA512 4 +#define SHA_MODE_SHA512_224 5 +#define SHA_MODE_SHA512_256 6 +#define SHA_MODE_SHA512_T 7 + +#define SHA_T_STRING_REG ((DR_REG_SHA_BASE) + 0x04) +#define SHA_T_LENGTH_REG ((DR_REG_SHA_BASE) + 0x08) +#define SHA_START_REG ((DR_REG_SHA_BASE) + 0x0c) +#define SHA_CONTINUE_REG ((DR_REG_SHA_BASE) + 0x10) +#define SHA_BUSY_REG ((DR_REG_SHA_BASE) + 0x14) + +#define SHA_H_BASE ((DR_REG_SHA_BASE) + 0x40) +#define SHA_M_BASE ((DR_REG_SHA_BASE) + 0x80) + +/* AES acceleration registers */ +#define AES_MODE_REG ((DR_REG_AES_BASE) + 0x40) +#define AES_ENDIAN_REG ((DR_REG_AES_BASE) + 0x44) +#define AES_TRIGGER_REG ((DR_REG_AES_BASE) + 0x48) +#define AES_STATE_REG ((DR_REG_AES_BASE) + 0x4c) + +#define AES_KEY_BASE ((DR_REG_AES_BASE) + 0x00) +#define AES_TEXT_IN_BASE ((DR_REG_AES_BASE) + 0x20) +#define AES_TEXT_OUT_BASE ((DR_REG_AES_BASE) + 0x30) + +/* HMAC Module */ +#define HMAC_SET_START_REG ((DR_REG_HMAC_BASE) + 0x40) +#define HMAC_SET_PARA_PURPOSE_REG ((DR_REG_HMAC_BASE) + 0x44) +#define HMAC_SET_PARA_KEY_REG ((DR_REG_HMAC_BASE) + 0x48) +#define HMAC_SET_PARA_FINISH_REG ((DR_REG_HMAC_BASE) + 0x4c) +#define HMAC_SET_MESSAGE_ONE_REG ((DR_REG_HMAC_BASE) + 0x50) +#define HMAC_SET_MESSAGE_ING_REG ((DR_REG_HMAC_BASE) + 0x54) +#define HMAC_SET_MESSAGE_END_REG ((DR_REG_HMAC_BASE) + 0x58) +#define HMAC_SET_RESULT_FINISH_REG ((DR_REG_HMAC_BASE) + 0x5c) +#define HMAC_SET_INVALIDATE_JTAG_REG ((DR_REG_HMAC_BASE) + 0x60) +#define HMAC_SET_INVALIDATE_DS_REG ((DR_REG_HMAC_BASE) + 0x64) +#define HMAC_QUERY_ERROR_REG ((DR_REG_HMAC_BASE) + 0x68) +#define HMAC_QUERY_BUSY_REG ((DR_REG_HMAC_BASE) + 0x6c) + + +#define HMAC_WDATA_BASE ((DR_REG_HMAC_BASE) + 0x80) +#define HMAC_RDATA_BASE ((DR_REG_HMAC_BASE) + 0xC0) +#define HMAC_SET_MESSAGE_PAD_REG ((DR_REG_HMAC_BASE) + 0xF0) + +/* AES-XTS registers */ +#define AES_XTS_PLAIN_BASE ((DR_REG_AES_BASE) + 0x80) +#define AES_XTS_SIZE_REG ((DR_REG_AES_BASE) + 0xC0) +#define AES_XTS_DESTINATION_REG ((DR_REG_AES_BASE) + 0xC4) +#define AES_XTS_PHYSICAL_ADDR_REG ((DR_REG_AES_BASE) + 0xC8) + +#define AES_XTS_TRIGGER_REG ((DR_REG_AES_BASE) + 0xCC) +#define AES_XTS_RELEASE_REG ((DR_REG_AES_BASE) + 0xD0) +#define AES_XTS_DESTROY_REG ((DR_REG_AES_BASE) + 0xD4) +#define AES_XTS_STATE_REG ((DR_REG_AES_BASE) + 0xD8) + +#endif diff --git a/components/soc/esp32s2beta/include/soc/i2c_reg.h b/components/soc/esp32s2beta/include/soc/i2c_reg.h new file mode 100644 index 0000000000..66f04502a2 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/i2c_reg.h @@ -0,0 +1,1128 @@ +// Copyright 2017-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_I2C_REG_H_ +#define _SOC_I2C_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define I2C_SCL_LOW_PERIOD_REG(i) (REG_I2C_BASE(i) + 0x0000) +/* I2C_SCL_LOW_PERIOD : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This register is used to configure the low level width of SCL clock.*/ +#define I2C_SCL_LOW_PERIOD 0x00003FFF +#define I2C_SCL_LOW_PERIOD_M ((I2C_SCL_LOW_PERIOD_V)<<(I2C_SCL_LOW_PERIOD_S)) +#define I2C_SCL_LOW_PERIOD_V 0x3FFF +#define I2C_SCL_LOW_PERIOD_S 0 + +#define I2C_CTR_REG(i) (REG_I2C_BASE(i) + 0x0004) +/* I2C_REF_ALWAYS_ON : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define I2C_REF_ALWAYS_ON (BIT(11)) +#define I2C_REF_ALWAYS_ON_M (BIT(11)) +#define I2C_REF_ALWAYS_ON_V 0x1 +#define I2C_REF_ALWAYS_ON_S 11 +/* I2C_FSM_RST : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define I2C_FSM_RST (BIT(10)) +#define I2C_FSM_RST_M (BIT(10)) +#define I2C_FSM_RST_V 0x1 +#define I2C_FSM_RST_S 10 +/* I2C_ARBITRATION_EN : R/W ;bitpos:[9] ;default: 1'b1 ; */ +/*description: */ +#define I2C_ARBITRATION_EN (BIT(9)) +#define I2C_ARBITRATION_EN_M (BIT(9)) +#define I2C_ARBITRATION_EN_V 0x1 +#define I2C_ARBITRATION_EN_S 9 +/* I2C_CLK_EN : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: This is the clock gating control bit for reading or writing registers.*/ +#define I2C_CLK_EN (BIT(8)) +#define I2C_CLK_EN_M (BIT(8)) +#define I2C_CLK_EN_V 0x1 +#define I2C_CLK_EN_S 8 +/* I2C_RX_LSB_FIRST : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: This bit is used to control the storage mode for received datas. + 1: receive data from most significant bit 0: receive data from least significant bit*/ +#define I2C_RX_LSB_FIRST (BIT(7)) +#define I2C_RX_LSB_FIRST_M (BIT(7)) +#define I2C_RX_LSB_FIRST_V 0x1 +#define I2C_RX_LSB_FIRST_S 7 +/* I2C_TX_LSB_FIRST : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: This bit is used to control the sending mode for data need to + be send. 1: receive data from most significant bit 0: receive data from least significant bit*/ +#define I2C_TX_LSB_FIRST (BIT(6)) +#define I2C_TX_LSB_FIRST_M (BIT(6)) +#define I2C_TX_LSB_FIRST_V 0x1 +#define I2C_TX_LSB_FIRST_S 6 +/* I2C_TRANS_START : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: Set this bit to start sending data in txfifo.*/ +#define I2C_TRANS_START (BIT(5)) +#define I2C_TRANS_START_M (BIT(5)) +#define I2C_TRANS_START_V 0x1 +#define I2C_TRANS_START_S 5 +/* I2C_MS_MODE : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: Set this bit to configure the module as i2c master clear this + bit to configure the module as i2c slave.*/ +#define I2C_MS_MODE (BIT(4)) +#define I2C_MS_MODE_M (BIT(4)) +#define I2C_MS_MODE_V 0x1 +#define I2C_MS_MODE_S 4 +/* I2C_ACK_LEVEL : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define I2C_ACK_LEVEL (BIT(3)) +#define I2C_ACK_LEVEL_M (BIT(3)) +#define I2C_ACK_LEVEL_V 0x1 +#define I2C_ACK_LEVEL_S 3 +/* I2C_SAMPLE_SCL_LEVEL : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: Set this bit to sample data in SCL low level. clear this bit + to sample data in SCL high level.*/ +#define I2C_SAMPLE_SCL_LEVEL (BIT(2)) +#define I2C_SAMPLE_SCL_LEVEL_M (BIT(2)) +#define I2C_SAMPLE_SCL_LEVEL_V 0x1 +#define I2C_SAMPLE_SCL_LEVEL_S 2 +/* I2C_SCL_FORCE_OUT : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: 1: normally ouput scl clock 0: exchange the function of scl_o + and scl_oe (scl_o is the original internal output scl signal scl_oe is the enable bit for the internal output scl signal)*/ +#define I2C_SCL_FORCE_OUT (BIT(1)) +#define I2C_SCL_FORCE_OUT_M (BIT(1)) +#define I2C_SCL_FORCE_OUT_V 0x1 +#define I2C_SCL_FORCE_OUT_S 1 +/* I2C_SDA_FORCE_OUT : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: 1: normally ouput sda data 0: exchange the function of sda_o + and sda_oe (sda_o is the original internal output sda signal sda_oe is the enable bit for the internal output sda signal)*/ +#define I2C_SDA_FORCE_OUT (BIT(0)) +#define I2C_SDA_FORCE_OUT_M (BIT(0)) +#define I2C_SDA_FORCE_OUT_V 0x1 +#define I2C_SDA_FORCE_OUT_S 0 + +#define I2C_SR_REG(i) (REG_I2C_BASE(i) + 0x0008) +/* I2C_SCL_STATE_LAST : RO ;bitpos:[30:28] ;default: 3'b0 ; */ +/*description: This register stores the value of state machine to produce SCL. + 3'h0: SCL_IDLE 3'h1:SCL_START 3'h2:SCL_LOW_EDGE 3'h3: SCL_LOW 3'h4:SCL_HIGH_EDGE 3'h5:SCL_HIGH 3'h6:SCL_STOP*/ +#define I2C_SCL_STATE_LAST 0x00000007 +#define I2C_SCL_STATE_LAST_M ((I2C_SCL_STATE_LAST_V)<<(I2C_SCL_STATE_LAST_S)) +#define I2C_SCL_STATE_LAST_V 0x7 +#define I2C_SCL_STATE_LAST_S 28 +/* I2C_SCL_MAIN_STATE_LAST : RO ;bitpos:[26:24] ;default: 3'b0 ; */ +/*description: This register stores the value of state machine for i2c module. + 3'h0: SCL_MAIN_IDLE 3'h1: SCL_ADDRESS_SHIFT 3'h2: SCL_ACK_ADDRESS 3'h3: SCL_RX_DATA 3'h4 SCL_TX_DATA 3'h5:SCL_SEND_ACK 3'h6:SCL_WAIT_ACK*/ +#define I2C_SCL_MAIN_STATE_LAST 0x00000007 +#define I2C_SCL_MAIN_STATE_LAST_M ((I2C_SCL_MAIN_STATE_LAST_V)<<(I2C_SCL_MAIN_STATE_LAST_S)) +#define I2C_SCL_MAIN_STATE_LAST_V 0x7 +#define I2C_SCL_MAIN_STATE_LAST_S 24 +/* I2C_TXFIFO_CNT : RO ;bitpos:[23:18] ;default: 6'b0 ; */ +/*description: This register stores the amount of received data in ram.*/ +#define I2C_TXFIFO_CNT 0x0000003F +#define I2C_TXFIFO_CNT_M ((I2C_TXFIFO_CNT_V)<<(I2C_TXFIFO_CNT_S)) +#define I2C_TXFIFO_CNT_V 0x3F +#define I2C_TXFIFO_CNT_S 18 +/* I2C_RXFIFO_CNT : RO ;bitpos:[13:8] ;default: 6'b0 ; */ +/*description: This register represent the amount of data need to send.*/ +#define I2C_RXFIFO_CNT 0x0000003F +#define I2C_RXFIFO_CNT_M ((I2C_RXFIFO_CNT_V)<<(I2C_RXFIFO_CNT_S)) +#define I2C_RXFIFO_CNT_V 0x3F +#define I2C_RXFIFO_CNT_S 8 +/* I2C_BYTE_TRANS : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: This register changes to high level when one byte is transferred.*/ +#define I2C_BYTE_TRANS (BIT(6)) +#define I2C_BYTE_TRANS_M (BIT(6)) +#define I2C_BYTE_TRANS_V 0x1 +#define I2C_BYTE_TRANS_S 6 +/* I2C_SLAVE_ADDRESSED : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: when configured as i2c slave and the address send by master + is equal to slave's address then this bit will be high level.*/ +#define I2C_SLAVE_ADDRESSED (BIT(5)) +#define I2C_SLAVE_ADDRESSED_M (BIT(5)) +#define I2C_SLAVE_ADDRESSED_V 0x1 +#define I2C_SLAVE_ADDRESSED_S 5 +/* I2C_BUS_BUSY : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: 1:I2C bus is busy transferring data. 0:I2C bus is in idle state.*/ +#define I2C_BUS_BUSY (BIT(4)) +#define I2C_BUS_BUSY_M (BIT(4)) +#define I2C_BUS_BUSY_V 0x1 +#define I2C_BUS_BUSY_S 4 +/* I2C_ARB_LOST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: when I2C lost control of SDA line this register changes to high level.*/ +#define I2C_ARB_LOST (BIT(3)) +#define I2C_ARB_LOST_M (BIT(3)) +#define I2C_ARB_LOST_V 0x1 +#define I2C_ARB_LOST_S 3 +/* I2C_TIME_OUT : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: when I2C takes more than time_out_reg clocks to receive a data + then this register changes to high level.*/ +#define I2C_TIME_OUT (BIT(2)) +#define I2C_TIME_OUT_M (BIT(2)) +#define I2C_TIME_OUT_V 0x1 +#define I2C_TIME_OUT_S 2 +/* I2C_SLAVE_RW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: when in slave mode 1: master read slave 0: master write slave.*/ +#define I2C_SLAVE_RW (BIT(1)) +#define I2C_SLAVE_RW_M (BIT(1)) +#define I2C_SLAVE_RW_V 0x1 +#define I2C_SLAVE_RW_S 1 +/* I2C_ACK_REC : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: This register stores the value of ACK bit.*/ +#define I2C_ACK_REC (BIT(0)) +#define I2C_ACK_REC_M (BIT(0)) +#define I2C_ACK_REC_V 0x1 +#define I2C_ACK_REC_S 0 + +#define I2C_TO_REG(i) (REG_I2C_BASE(i) + 0x000c) +/* I2C_TIME_OUT_EN : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define I2C_TIME_OUT_EN (BIT(24)) +#define I2C_TIME_OUT_EN_M (BIT(24)) +#define I2C_TIME_OUT_EN_V 0x1 +#define I2C_TIME_OUT_EN_S 24 +/* I2C_TIME_OUT_REG : R/W ;bitpos:[23:0] ;default: 24'b0 ; */ +/*description: */ +#define I2C_TIME_OUT_REG 0x00FFFFFF +#define I2C_TIME_OUT_REG_M ((I2C_TIME_OUT_REG_V)<<(I2C_TIME_OUT_REG_S)) +#define I2C_TIME_OUT_REG_V 0xFFFFFF +#define I2C_TIME_OUT_REG_S 0 + +#define I2C_SLAVE_ADDR_REG(i) (REG_I2C_BASE(i) + 0x0010) +/* I2C_ADDR_10BIT_EN : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: This register is used to enable slave 10bit address mode.*/ +#define I2C_ADDR_10BIT_EN (BIT(31)) +#define I2C_ADDR_10BIT_EN_M (BIT(31)) +#define I2C_ADDR_10BIT_EN_V 0x1 +#define I2C_ADDR_10BIT_EN_S 31 +/* I2C_SLAVE_ADDR : R/W ;bitpos:[14:0] ;default: 15'b0 ; */ +/*description: when configured as i2c slave this register is used to configure + slave's address.*/ +#define I2C_SLAVE_ADDR 0x00007FFF +#define I2C_SLAVE_ADDR_M ((I2C_SLAVE_ADDR_V)<<(I2C_SLAVE_ADDR_S)) +#define I2C_SLAVE_ADDR_V 0x7FFF +#define I2C_SLAVE_ADDR_S 0 + +#define I2C_RXFIFO_ST_REG(i) (REG_I2C_BASE(i) + 0x0014) +/* I2C_RXFIFO_INIT_WADDR : RO ;bitpos:[31:27] ;default: 5'b0 ; */ +/*description: */ +#define I2C_RXFIFO_INIT_WADDR 0x0000001F +#define I2C_RXFIFO_INIT_WADDR_M ((I2C_RXFIFO_INIT_WADDR_V)<<(I2C_RXFIFO_INIT_WADDR_S)) +#define I2C_RXFIFO_INIT_WADDR_V 0x1F +#define I2C_RXFIFO_INIT_WADDR_S 27 +/* I2C_TXFIFO_INIT_RADDR : RO ;bitpos:[26:22] ;default: 5'b0 ; */ +/*description: */ +#define I2C_TXFIFO_INIT_RADDR 0x0000001F +#define I2C_TXFIFO_INIT_RADDR_M ((I2C_TXFIFO_INIT_RADDR_V)<<(I2C_TXFIFO_INIT_RADDR_S)) +#define I2C_TXFIFO_INIT_RADDR_V 0x1F +#define I2C_TXFIFO_INIT_RADDR_S 22 +/* I2C_TX_UPDATE : WO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define I2C_TX_UPDATE (BIT(21)) +#define I2C_TX_UPDATE_M (BIT(21)) +#define I2C_TX_UPDATE_V 0x1 +#define I2C_TX_UPDATE_S 21 +/* I2C_RX_UPDATE : WO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define I2C_RX_UPDATE (BIT(20)) +#define I2C_RX_UPDATE_M (BIT(20)) +#define I2C_RX_UPDATE_V 0x1 +#define I2C_RX_UPDATE_S 20 +/* I2C_TXFIFO_END_ADDR : RO ;bitpos:[19:15] ;default: 5'b0 ; */ +/*description: This is the offset address of the last sending data as described + in nonfifo_tx_thres register.*/ +#define I2C_TXFIFO_END_ADDR 0x0000001F +#define I2C_TXFIFO_END_ADDR_M ((I2C_TXFIFO_END_ADDR_V)<<(I2C_TXFIFO_END_ADDR_S)) +#define I2C_TXFIFO_END_ADDR_V 0x1F +#define I2C_TXFIFO_END_ADDR_S 15 +/* I2C_TXFIFO_START_ADDR : RO ;bitpos:[14:10] ;default: 5'b0 ; */ +/*description: This is the offset address of the first sending data as described + in nonfifo_tx_thres register.*/ +#define I2C_TXFIFO_START_ADDR 0x0000001F +#define I2C_TXFIFO_START_ADDR_M ((I2C_TXFIFO_START_ADDR_V)<<(I2C_TXFIFO_START_ADDR_S)) +#define I2C_TXFIFO_START_ADDR_V 0x1F +#define I2C_TXFIFO_START_ADDR_S 10 +/* I2C_RXFIFO_END_ADDR : RO ;bitpos:[9:5] ;default: 5'b0 ; */ +/*description: This is the offset address of the first receiving data as described + in nonfifo_rx_thres_register.*/ +#define I2C_RXFIFO_END_ADDR 0x0000001F +#define I2C_RXFIFO_END_ADDR_M ((I2C_RXFIFO_END_ADDR_V)<<(I2C_RXFIFO_END_ADDR_S)) +#define I2C_RXFIFO_END_ADDR_V 0x1F +#define I2C_RXFIFO_END_ADDR_S 5 +/* I2C_RXFIFO_START_ADDR : RO ;bitpos:[4:0] ;default: 5'b0 ; */ +/*description: This is the offset address of the last receiving data as described + in nonfifo_rx_thres_register.*/ +#define I2C_RXFIFO_START_ADDR 0x0000001F +#define I2C_RXFIFO_START_ADDR_M ((I2C_RXFIFO_START_ADDR_V)<<(I2C_RXFIFO_START_ADDR_S)) +#define I2C_RXFIFO_START_ADDR_V 0x1F +#define I2C_RXFIFO_START_ADDR_S 0 + +#define I2C_FIFO_CONF_REG(i) (REG_I2C_BASE(i) + 0x0018) +/* I2C_NONFIFO_TX_THRES : R/W ;bitpos:[25:20] ;default: 6'h15 ; */ +/*description: when I2C sends more than nonfifo_tx_thres data it will produce + tx_send_empty_int_raw interrupt and update the current offset address of the sending data.*/ +#define I2C_NONFIFO_TX_THRES 0x0000003F +#define I2C_NONFIFO_TX_THRES_M ((I2C_NONFIFO_TX_THRES_V)<<(I2C_NONFIFO_TX_THRES_S)) +#define I2C_NONFIFO_TX_THRES_V 0x3F +#define I2C_NONFIFO_TX_THRES_S 20 +/* I2C_NONFIFO_RX_THRES : R/W ;bitpos:[19:14] ;default: 6'h15 ; */ +/*description: when I2C receives more than nonfifo_rx_thres data it will produce + rx_send_full_int_raw interrupt and update the current offset address of the receiving data.*/ +#define I2C_NONFIFO_RX_THRES 0x0000003F +#define I2C_NONFIFO_RX_THRES_M ((I2C_NONFIFO_RX_THRES_V)<<(I2C_NONFIFO_RX_THRES_S)) +#define I2C_NONFIFO_RX_THRES_V 0x3F +#define I2C_NONFIFO_RX_THRES_S 14 +/* I2C_TX_FIFO_RST : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: Set this bit to reset tx fifo when using apb fifo access.*/ +#define I2C_TX_FIFO_RST (BIT(13)) +#define I2C_TX_FIFO_RST_M (BIT(13)) +#define I2C_TX_FIFO_RST_V 0x1 +#define I2C_TX_FIFO_RST_S 13 +/* I2C_RX_FIFO_RST : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: Set this bit to reset rx fifo when using apb fifo access.*/ +#define I2C_RX_FIFO_RST (BIT(12)) +#define I2C_RX_FIFO_RST_M (BIT(12)) +#define I2C_RX_FIFO_RST_V 0x1 +#define I2C_RX_FIFO_RST_S 12 +/* I2C_FIFO_ADDR_CFG_EN : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: When this bit is set to 1 then the byte after address represent + the offset address of I2C Slave's ram.*/ +#define I2C_FIFO_ADDR_CFG_EN (BIT(11)) +#define I2C_FIFO_ADDR_CFG_EN_M (BIT(11)) +#define I2C_FIFO_ADDR_CFG_EN_V 0x1 +#define I2C_FIFO_ADDR_CFG_EN_S 11 +/* I2C_NONFIFO_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: Set this bit to enble apb nonfifo access.*/ +#define I2C_NONFIFO_EN (BIT(10)) +#define I2C_NONFIFO_EN_M (BIT(10)) +#define I2C_NONFIFO_EN_V 0x1 +#define I2C_NONFIFO_EN_S 10 +/* I2C_TXFIFO_EMPTY_THRHD : R/W ;bitpos:[9:5] ;default: 5'h4 ; */ +/*description: Config txfifo empty threhd value when using apb fifo access*/ +#define I2C_TXFIFO_EMPTY_THRHD 0x0000001F +#define I2C_TXFIFO_EMPTY_THRHD_M ((I2C_TXFIFO_EMPTY_THRHD_V)<<(I2C_TXFIFO_EMPTY_THRHD_S)) +#define I2C_TXFIFO_EMPTY_THRHD_V 0x1F +#define I2C_TXFIFO_EMPTY_THRHD_S 5 +/* I2C_RXFIFO_FULL_THRHD : R/W ;bitpos:[4:0] ;default: 5'hb ; */ +/*description: */ +#define I2C_RXFIFO_FULL_THRHD 0x0000001F +#define I2C_RXFIFO_FULL_THRHD_M ((I2C_RXFIFO_FULL_THRHD_V)<<(I2C_RXFIFO_FULL_THRHD_S)) +#define I2C_RXFIFO_FULL_THRHD_V 0x1F +#define I2C_RXFIFO_FULL_THRHD_S 0 + +#define I2C_DATA_APB_REG(i) (0x60013000 + (i) * 0x14000 + 0x001c) + +#define I2C_DATA_REG(i) (REG_I2C_BASE(i) + 0x001c) +/* I2C_FIFO_RDATA : RO ;bitpos:[7:0] ;default: 8'b0 ; */ +/*description: The register represent the byte data read from rxfifo when use apb fifo access*/ +#define I2C_FIFO_RDATA 0x000000FF +#define I2C_FIFO_RDATA_M ((I2C_FIFO_RDATA_V)<<(I2C_FIFO_RDATA_S)) +#define I2C_FIFO_RDATA_V 0xFF +#define I2C_FIFO_RDATA_S 0 + +#define I2C_INT_RAW_REG(i) (REG_I2C_BASE(i) + 0x0020) +/* I2C_DET_START_INT_RAW : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define I2C_DET_START_INT_RAW (BIT(15)) +#define I2C_DET_START_INT_RAW_M (BIT(15)) +#define I2C_DET_START_INT_RAW_V 0x1 +#define I2C_DET_START_INT_RAW_S 15 +/* I2C_SCL_MAIN_ST_TO_INT_RAW : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SCL_MAIN_ST_TO_INT_RAW (BIT(14)) +#define I2C_SCL_MAIN_ST_TO_INT_RAW_M (BIT(14)) +#define I2C_SCL_MAIN_ST_TO_INT_RAW_V 0x1 +#define I2C_SCL_MAIN_ST_TO_INT_RAW_S 14 +/* I2C_SCL_ST_TO_INT_RAW : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SCL_ST_TO_INT_RAW (BIT(13)) +#define I2C_SCL_ST_TO_INT_RAW_M (BIT(13)) +#define I2C_SCL_ST_TO_INT_RAW_V 0x1 +#define I2C_SCL_ST_TO_INT_RAW_S 13 +/* I2C_TX_SEND_EMPTY_INT_RAW : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for tx_send_empty_int interrupt.when + I2C sends more data than nonfifo_tx_thres it will produce tx_send_empty_int interrupt..*/ +#define I2C_TX_SEND_EMPTY_INT_RAW (BIT(12)) +#define I2C_TX_SEND_EMPTY_INT_RAW_M (BIT(12)) +#define I2C_TX_SEND_EMPTY_INT_RAW_V 0x1 +#define I2C_TX_SEND_EMPTY_INT_RAW_S 12 +/* I2C_RX_REC_FULL_INT_RAW : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for rx_rec_full_int interrupt. when + I2C receives more data than nonfifo_rx_thres it will produce rx_rec_full_int interrupt.*/ +#define I2C_RX_REC_FULL_INT_RAW (BIT(11)) +#define I2C_RX_REC_FULL_INT_RAW_M (BIT(11)) +#define I2C_RX_REC_FULL_INT_RAW_V 0x1 +#define I2C_RX_REC_FULL_INT_RAW_S 11 +/* I2C_ACK_ERR_INT_RAW : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for ack_err_int interrupt. when + I2C receives a wrong ACK bit it will produce ack_err_int interrupt..*/ +#define I2C_ACK_ERR_INT_RAW (BIT(10)) +#define I2C_ACK_ERR_INT_RAW_M (BIT(10)) +#define I2C_ACK_ERR_INT_RAW_V 0x1 +#define I2C_ACK_ERR_INT_RAW_S 10 +/* I2C_TRANS_START_INT_RAW : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for trans_start_int interrupt. when + I2C sends the START bit it will produce trans_start_int interrupt.*/ +#define I2C_TRANS_START_INT_RAW (BIT(9)) +#define I2C_TRANS_START_INT_RAW_M (BIT(9)) +#define I2C_TRANS_START_INT_RAW_V 0x1 +#define I2C_TRANS_START_INT_RAW_S 9 +/* I2C_TIME_OUT_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for time_out_int interrupt. when + I2C takes a lot of time to receive a data it will produce time_out_int interrupt.*/ +#define I2C_TIME_OUT_INT_RAW (BIT(8)) +#define I2C_TIME_OUT_INT_RAW_M (BIT(8)) +#define I2C_TIME_OUT_INT_RAW_V 0x1 +#define I2C_TIME_OUT_INT_RAW_S 8 +/* I2C_TRANS_COMPLETE_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for trans_complete_int interrupt. + when I2C Master finished STOP command it will produce trans_complete_int interrupt.*/ +#define I2C_TRANS_COMPLETE_INT_RAW (BIT(7)) +#define I2C_TRANS_COMPLETE_INT_RAW_M (BIT(7)) +#define I2C_TRANS_COMPLETE_INT_RAW_V 0x1 +#define I2C_TRANS_COMPLETE_INT_RAW_S 7 +/* I2C_MASTER_TRAN_COMP_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for master_tra_comp_int interrupt. + when I2C Master sends or receives a byte it will produce master_tran_comp_int interrupt.*/ +#define I2C_MASTER_TRAN_COMP_INT_RAW (BIT(6)) +#define I2C_MASTER_TRAN_COMP_INT_RAW_M (BIT(6)) +#define I2C_MASTER_TRAN_COMP_INT_RAW_V 0x1 +#define I2C_MASTER_TRAN_COMP_INT_RAW_S 6 +/* I2C_ARBITRATION_LOST_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for arbitration_lost_int interrupt.when + I2C lost the usage right of I2C BUS it will produce arbitration_lost_int interrupt.*/ +#define I2C_ARBITRATION_LOST_INT_RAW (BIT(5)) +#define I2C_ARBITRATION_LOST_INT_RAW_M (BIT(5)) +#define I2C_ARBITRATION_LOST_INT_RAW_V 0x1 +#define I2C_ARBITRATION_LOST_INT_RAW_S 5 +/* I2C_SLAVE_TRAN_COMP_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for slave_tran_comp_int interrupt. + when I2C Slave detectsthe STOP bit it will produce slave_tran_comp_int interrupt.*/ +#define I2C_SLAVE_TRAN_COMP_INT_RAW (BIT(4)) +#define I2C_SLAVE_TRAN_COMP_INT_RAW_M (BIT(4)) +#define I2C_SLAVE_TRAN_COMP_INT_RAW_V 0x1 +#define I2C_SLAVE_TRAN_COMP_INT_RAW_S 4 +/* I2C_END_DETECT_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for end_detect_int interrupt. when + I2C deals with the END command it will produce end_detect_int interrupt.*/ +#define I2C_END_DETECT_INT_RAW (BIT(3)) +#define I2C_END_DETECT_INT_RAW_M (BIT(3)) +#define I2C_END_DETECT_INT_RAW_V 0x1 +#define I2C_END_DETECT_INT_RAW_S 3 +/* I2C_RXFIFO_OVF_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for receiving data overflow when + use apb fifo access.*/ +#define I2C_RXFIFO_OVF_INT_RAW (BIT(2)) +#define I2C_RXFIFO_OVF_INT_RAW_M (BIT(2)) +#define I2C_RXFIFO_OVF_INT_RAW_V 0x1 +#define I2C_RXFIFO_OVF_INT_RAW_S 2 +/* I2C_TXFIFO_EMPTY_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for txfifo empty when use apb fifo access.*/ +#define I2C_TXFIFO_EMPTY_INT_RAW (BIT(1)) +#define I2C_TXFIFO_EMPTY_INT_RAW_M (BIT(1)) +#define I2C_TXFIFO_EMPTY_INT_RAW_V 0x1 +#define I2C_TXFIFO_EMPTY_INT_RAW_S 1 +/* I2C_RXFIFO_FULL_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for rxfifo full when use apb fifo access.*/ +#define I2C_RXFIFO_FULL_INT_RAW (BIT(0)) +#define I2C_RXFIFO_FULL_INT_RAW_M (BIT(0)) +#define I2C_RXFIFO_FULL_INT_RAW_V 0x1 +#define I2C_RXFIFO_FULL_INT_RAW_S 0 + +#define I2C_INT_CLR_REG(i) (REG_I2C_BASE(i) + 0x0024) +/* I2C_DET_START_INT_CLR : WO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define I2C_DET_START_INT_CLR (BIT(15)) +#define I2C_DET_START_INT_CLR_M (BIT(15)) +#define I2C_DET_START_INT_CLR_V 0x1 +#define I2C_DET_START_INT_CLR_S 15 +/* I2C_SCL_MAIN_ST_TO_INT_CLR : WO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SCL_MAIN_ST_TO_INT_CLR (BIT(14)) +#define I2C_SCL_MAIN_ST_TO_INT_CLR_M (BIT(14)) +#define I2C_SCL_MAIN_ST_TO_INT_CLR_V 0x1 +#define I2C_SCL_MAIN_ST_TO_INT_CLR_S 14 +/* I2C_SCL_ST_TO_INT_CLR : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SCL_ST_TO_INT_CLR (BIT(13)) +#define I2C_SCL_ST_TO_INT_CLR_M (BIT(13)) +#define I2C_SCL_ST_TO_INT_CLR_V 0x1 +#define I2C_SCL_ST_TO_INT_CLR_S 13 +/* I2C_TX_SEND_EMPTY_INT_CLR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: Set this bit to clear the tx_send_empty_int interrupt.*/ +#define I2C_TX_SEND_EMPTY_INT_CLR (BIT(12)) +#define I2C_TX_SEND_EMPTY_INT_CLR_M (BIT(12)) +#define I2C_TX_SEND_EMPTY_INT_CLR_V 0x1 +#define I2C_TX_SEND_EMPTY_INT_CLR_S 12 +/* I2C_RX_REC_FULL_INT_CLR : WO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: Set this bit to clear the rx_rec_full_int interrupt.*/ +#define I2C_RX_REC_FULL_INT_CLR (BIT(11)) +#define I2C_RX_REC_FULL_INT_CLR_M (BIT(11)) +#define I2C_RX_REC_FULL_INT_CLR_V 0x1 +#define I2C_RX_REC_FULL_INT_CLR_S 11 +/* I2C_ACK_ERR_INT_CLR : WO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: Set this bit to clear the ack_err_int interrupt.*/ +#define I2C_ACK_ERR_INT_CLR (BIT(10)) +#define I2C_ACK_ERR_INT_CLR_M (BIT(10)) +#define I2C_ACK_ERR_INT_CLR_V 0x1 +#define I2C_ACK_ERR_INT_CLR_S 10 +/* I2C_TRANS_START_INT_CLR : WO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: Set this bit to clear the trans_start_int interrupt.*/ +#define I2C_TRANS_START_INT_CLR (BIT(9)) +#define I2C_TRANS_START_INT_CLR_M (BIT(9)) +#define I2C_TRANS_START_INT_CLR_V 0x1 +#define I2C_TRANS_START_INT_CLR_S 9 +/* I2C_TIME_OUT_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: Set this bit to clear the time_out_int interrupt.*/ +#define I2C_TIME_OUT_INT_CLR (BIT(8)) +#define I2C_TIME_OUT_INT_CLR_M (BIT(8)) +#define I2C_TIME_OUT_INT_CLR_V 0x1 +#define I2C_TIME_OUT_INT_CLR_S 8 +/* I2C_TRANS_COMPLETE_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: Set this bit to clear the trans_complete_int interrupt.*/ +#define I2C_TRANS_COMPLETE_INT_CLR (BIT(7)) +#define I2C_TRANS_COMPLETE_INT_CLR_M (BIT(7)) +#define I2C_TRANS_COMPLETE_INT_CLR_V 0x1 +#define I2C_TRANS_COMPLETE_INT_CLR_S 7 +/* I2C_MASTER_TRAN_COMP_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: Set this bit to clear the master_tran_comp interrupt.*/ +#define I2C_MASTER_TRAN_COMP_INT_CLR (BIT(6)) +#define I2C_MASTER_TRAN_COMP_INT_CLR_M (BIT(6)) +#define I2C_MASTER_TRAN_COMP_INT_CLR_V 0x1 +#define I2C_MASTER_TRAN_COMP_INT_CLR_S 6 +/* I2C_ARBITRATION_LOST_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: Set this bit to clear the arbitration_lost_int interrupt.*/ +#define I2C_ARBITRATION_LOST_INT_CLR (BIT(5)) +#define I2C_ARBITRATION_LOST_INT_CLR_M (BIT(5)) +#define I2C_ARBITRATION_LOST_INT_CLR_V 0x1 +#define I2C_ARBITRATION_LOST_INT_CLR_S 5 +/* I2C_SLAVE_TRAN_COMP_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: Set this bit to clear the slave_tran_comp_int interrupt.*/ +#define I2C_SLAVE_TRAN_COMP_INT_CLR (BIT(4)) +#define I2C_SLAVE_TRAN_COMP_INT_CLR_M (BIT(4)) +#define I2C_SLAVE_TRAN_COMP_INT_CLR_V 0x1 +#define I2C_SLAVE_TRAN_COMP_INT_CLR_S 4 +/* I2C_END_DETECT_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: Set this bit to clear the end_detect_int interrupt.*/ +#define I2C_END_DETECT_INT_CLR (BIT(3)) +#define I2C_END_DETECT_INT_CLR_M (BIT(3)) +#define I2C_END_DETECT_INT_CLR_V 0x1 +#define I2C_END_DETECT_INT_CLR_S 3 +/* I2C_RXFIFO_OVF_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: Set this bit to clear the rxfifo_ovf_int interrupt.*/ +#define I2C_RXFIFO_OVF_INT_CLR (BIT(2)) +#define I2C_RXFIFO_OVF_INT_CLR_M (BIT(2)) +#define I2C_RXFIFO_OVF_INT_CLR_V 0x1 +#define I2C_RXFIFO_OVF_INT_CLR_S 2 +/* I2C_TXFIFO_EMPTY_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: Set this bit to clear the txfifo_empty_int interrupt.*/ +#define I2C_TXFIFO_EMPTY_INT_CLR (BIT(1)) +#define I2C_TXFIFO_EMPTY_INT_CLR_M (BIT(1)) +#define I2C_TXFIFO_EMPTY_INT_CLR_V 0x1 +#define I2C_TXFIFO_EMPTY_INT_CLR_S 1 +/* I2C_RXFIFO_FULL_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: Set this bit to clear the rxfifo_full_int interrupt.*/ +#define I2C_RXFIFO_FULL_INT_CLR (BIT(0)) +#define I2C_RXFIFO_FULL_INT_CLR_M (BIT(0)) +#define I2C_RXFIFO_FULL_INT_CLR_V 0x1 +#define I2C_RXFIFO_FULL_INT_CLR_S 0 + +#define I2C_INT_ENA_REG(i) (REG_I2C_BASE(i) + 0x0028) +/* I2C_DET_START_INT_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define I2C_DET_START_INT_ENA (BIT(15)) +#define I2C_DET_START_INT_ENA_M (BIT(15)) +#define I2C_DET_START_INT_ENA_V 0x1 +#define I2C_DET_START_INT_ENA_S 15 +/* I2C_SCL_MAIN_ST_TO_INT_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SCL_MAIN_ST_TO_INT_ENA (BIT(14)) +#define I2C_SCL_MAIN_ST_TO_INT_ENA_M (BIT(14)) +#define I2C_SCL_MAIN_ST_TO_INT_ENA_V 0x1 +#define I2C_SCL_MAIN_ST_TO_INT_ENA_S 14 +/* I2C_SCL_ST_TO_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SCL_ST_TO_INT_ENA (BIT(13)) +#define I2C_SCL_ST_TO_INT_ENA_M (BIT(13)) +#define I2C_SCL_ST_TO_INT_ENA_V 0x1 +#define I2C_SCL_ST_TO_INT_ENA_S 13 +/* I2C_TX_SEND_EMPTY_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: The enable bit for tx_send_empty_int interrupt.*/ +#define I2C_TX_SEND_EMPTY_INT_ENA (BIT(12)) +#define I2C_TX_SEND_EMPTY_INT_ENA_M (BIT(12)) +#define I2C_TX_SEND_EMPTY_INT_ENA_V 0x1 +#define I2C_TX_SEND_EMPTY_INT_ENA_S 12 +/* I2C_RX_REC_FULL_INT_ENA : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: The enable bit for rx_rec_full_int interrupt.*/ +#define I2C_RX_REC_FULL_INT_ENA (BIT(11)) +#define I2C_RX_REC_FULL_INT_ENA_M (BIT(11)) +#define I2C_RX_REC_FULL_INT_ENA_V 0x1 +#define I2C_RX_REC_FULL_INT_ENA_S 11 +/* I2C_ACK_ERR_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: The enable bit for ack_err_int interrupt.*/ +#define I2C_ACK_ERR_INT_ENA (BIT(10)) +#define I2C_ACK_ERR_INT_ENA_M (BIT(10)) +#define I2C_ACK_ERR_INT_ENA_V 0x1 +#define I2C_ACK_ERR_INT_ENA_S 10 +/* I2C_TRANS_START_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: The enable bit for trans_start_int interrupt.*/ +#define I2C_TRANS_START_INT_ENA (BIT(9)) +#define I2C_TRANS_START_INT_ENA_M (BIT(9)) +#define I2C_TRANS_START_INT_ENA_V 0x1 +#define I2C_TRANS_START_INT_ENA_S 9 +/* I2C_TIME_OUT_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The enable bit for time_out_int interrupt.*/ +#define I2C_TIME_OUT_INT_ENA (BIT(8)) +#define I2C_TIME_OUT_INT_ENA_M (BIT(8)) +#define I2C_TIME_OUT_INT_ENA_V 0x1 +#define I2C_TIME_OUT_INT_ENA_S 8 +/* I2C_TRANS_COMPLETE_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The enable bit for trans_complete_int interrupt.*/ +#define I2C_TRANS_COMPLETE_INT_ENA (BIT(7)) +#define I2C_TRANS_COMPLETE_INT_ENA_M (BIT(7)) +#define I2C_TRANS_COMPLETE_INT_ENA_V 0x1 +#define I2C_TRANS_COMPLETE_INT_ENA_S 7 +/* I2C_MASTER_TRAN_COMP_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The enable bit for master_tran_comp_int interrupt.*/ +#define I2C_MASTER_TRAN_COMP_INT_ENA (BIT(6)) +#define I2C_MASTER_TRAN_COMP_INT_ENA_M (BIT(6)) +#define I2C_MASTER_TRAN_COMP_INT_ENA_V 0x1 +#define I2C_MASTER_TRAN_COMP_INT_ENA_S 6 +/* I2C_ARBITRATION_LOST_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The enable bit for arbitration_lost_int interrupt.*/ +#define I2C_ARBITRATION_LOST_INT_ENA (BIT(5)) +#define I2C_ARBITRATION_LOST_INT_ENA_M (BIT(5)) +#define I2C_ARBITRATION_LOST_INT_ENA_V 0x1 +#define I2C_ARBITRATION_LOST_INT_ENA_S 5 +/* I2C_SLAVE_TRAN_COMP_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The enable bit for slave_tran_comp_int interrupt.*/ +#define I2C_SLAVE_TRAN_COMP_INT_ENA (BIT(4)) +#define I2C_SLAVE_TRAN_COMP_INT_ENA_M (BIT(4)) +#define I2C_SLAVE_TRAN_COMP_INT_ENA_V 0x1 +#define I2C_SLAVE_TRAN_COMP_INT_ENA_S 4 +/* I2C_END_DETECT_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The enable bit for end_detect_int interrupt.*/ +#define I2C_END_DETECT_INT_ENA (BIT(3)) +#define I2C_END_DETECT_INT_ENA_M (BIT(3)) +#define I2C_END_DETECT_INT_ENA_V 0x1 +#define I2C_END_DETECT_INT_ENA_S 3 +/* I2C_RXFIFO_OVF_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The enable bit for rxfifo_ovf_int interrupt.*/ +#define I2C_RXFIFO_OVF_INT_ENA (BIT(2)) +#define I2C_RXFIFO_OVF_INT_ENA_M (BIT(2)) +#define I2C_RXFIFO_OVF_INT_ENA_V 0x1 +#define I2C_RXFIFO_OVF_INT_ENA_S 2 +/* I2C_TXFIFO_EMPTY_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The enable bit for txfifo_empty_int interrupt.*/ +#define I2C_TXFIFO_EMPTY_INT_ENA (BIT(1)) +#define I2C_TXFIFO_EMPTY_INT_ENA_M (BIT(1)) +#define I2C_TXFIFO_EMPTY_INT_ENA_V 0x1 +#define I2C_TXFIFO_EMPTY_INT_ENA_S 1 +/* I2C_RXFIFO_FULL_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The enable bit for rxfifo_full_int interrupt.*/ +#define I2C_RXFIFO_FULL_INT_ENA (BIT(0)) +#define I2C_RXFIFO_FULL_INT_ENA_M (BIT(0)) +#define I2C_RXFIFO_FULL_INT_ENA_V 0x1 +#define I2C_RXFIFO_FULL_INT_ENA_S 0 + +#define I2C_INT_STATUS_REG(i) (REG_I2C_BASE(i) + 0x002c) +/* I2C_DET_START_INT_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define I2C_DET_START_INT_ST (BIT(15)) +#define I2C_DET_START_INT_ST_M (BIT(15)) +#define I2C_DET_START_INT_ST_V 0x1 +#define I2C_DET_START_INT_ST_S 15 +/* I2C_SCL_MAIN_ST_TO_INT_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SCL_MAIN_ST_TO_INT_ST (BIT(14)) +#define I2C_SCL_MAIN_ST_TO_INT_ST_M (BIT(14)) +#define I2C_SCL_MAIN_ST_TO_INT_ST_V 0x1 +#define I2C_SCL_MAIN_ST_TO_INT_ST_S 14 +/* I2C_SCL_ST_TO_INT_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SCL_ST_TO_INT_ST (BIT(13)) +#define I2C_SCL_ST_TO_INT_ST_M (BIT(13)) +#define I2C_SCL_ST_TO_INT_ST_V 0x1 +#define I2C_SCL_ST_TO_INT_ST_S 13 +/* I2C_TX_SEND_EMPTY_INT_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: The masked interrupt status for tx_send_empty_int interrupt.*/ +#define I2C_TX_SEND_EMPTY_INT_ST (BIT(12)) +#define I2C_TX_SEND_EMPTY_INT_ST_M (BIT(12)) +#define I2C_TX_SEND_EMPTY_INT_ST_V 0x1 +#define I2C_TX_SEND_EMPTY_INT_ST_S 12 +/* I2C_RX_REC_FULL_INT_ST : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: The masked interrupt status for rx_rec_full_int interrupt.*/ +#define I2C_RX_REC_FULL_INT_ST (BIT(11)) +#define I2C_RX_REC_FULL_INT_ST_M (BIT(11)) +#define I2C_RX_REC_FULL_INT_ST_V 0x1 +#define I2C_RX_REC_FULL_INT_ST_S 11 +/* I2C_ACK_ERR_INT_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: The masked interrupt status for ack_err_int interrupt.*/ +#define I2C_ACK_ERR_INT_ST (BIT(10)) +#define I2C_ACK_ERR_INT_ST_M (BIT(10)) +#define I2C_ACK_ERR_INT_ST_V 0x1 +#define I2C_ACK_ERR_INT_ST_S 10 +/* I2C_TRANS_START_INT_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: The masked interrupt status for trans_start_int interrupt.*/ +#define I2C_TRANS_START_INT_ST (BIT(9)) +#define I2C_TRANS_START_INT_ST_M (BIT(9)) +#define I2C_TRANS_START_INT_ST_V 0x1 +#define I2C_TRANS_START_INT_ST_S 9 +/* I2C_TIME_OUT_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The masked interrupt status for time_out_int interrupt.*/ +#define I2C_TIME_OUT_INT_ST (BIT(8)) +#define I2C_TIME_OUT_INT_ST_M (BIT(8)) +#define I2C_TIME_OUT_INT_ST_V 0x1 +#define I2C_TIME_OUT_INT_ST_S 8 +/* I2C_TRANS_COMPLETE_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The masked interrupt status for trans_complete_int interrupt.*/ +#define I2C_TRANS_COMPLETE_INT_ST (BIT(7)) +#define I2C_TRANS_COMPLETE_INT_ST_M (BIT(7)) +#define I2C_TRANS_COMPLETE_INT_ST_V 0x1 +#define I2C_TRANS_COMPLETE_INT_ST_S 7 +/* I2C_MASTER_TRAN_COMP_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The masked interrupt status for master_tran_comp_int interrupt.*/ +#define I2C_MASTER_TRAN_COMP_INT_ST (BIT(6)) +#define I2C_MASTER_TRAN_COMP_INT_ST_M (BIT(6)) +#define I2C_MASTER_TRAN_COMP_INT_ST_V 0x1 +#define I2C_MASTER_TRAN_COMP_INT_ST_S 6 +/* I2C_ARBITRATION_LOST_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The masked interrupt status for arbitration_lost_int interrupt.*/ +#define I2C_ARBITRATION_LOST_INT_ST (BIT(5)) +#define I2C_ARBITRATION_LOST_INT_ST_M (BIT(5)) +#define I2C_ARBITRATION_LOST_INT_ST_V 0x1 +#define I2C_ARBITRATION_LOST_INT_ST_S 5 +/* I2C_SLAVE_TRAN_COMP_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The masked interrupt status for slave_tran_comp_int interrupt.*/ +#define I2C_SLAVE_TRAN_COMP_INT_ST (BIT(4)) +#define I2C_SLAVE_TRAN_COMP_INT_ST_M (BIT(4)) +#define I2C_SLAVE_TRAN_COMP_INT_ST_V 0x1 +#define I2C_SLAVE_TRAN_COMP_INT_ST_S 4 +/* I2C_END_DETECT_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The masked interrupt status for end_detect_int interrupt.*/ +#define I2C_END_DETECT_INT_ST (BIT(3)) +#define I2C_END_DETECT_INT_ST_M (BIT(3)) +#define I2C_END_DETECT_INT_ST_V 0x1 +#define I2C_END_DETECT_INT_ST_S 3 +/* I2C_RXFIFO_OVF_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The masked interrupt status for rxfifo_ovf_int interrupt.*/ +#define I2C_RXFIFO_OVF_INT_ST (BIT(2)) +#define I2C_RXFIFO_OVF_INT_ST_M (BIT(2)) +#define I2C_RXFIFO_OVF_INT_ST_V 0x1 +#define I2C_RXFIFO_OVF_INT_ST_S 2 +/* I2C_TXFIFO_EMPTY_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The masked interrupt status for txfifo_empty_int interrupt.*/ +#define I2C_TXFIFO_EMPTY_INT_ST (BIT(1)) +#define I2C_TXFIFO_EMPTY_INT_ST_M (BIT(1)) +#define I2C_TXFIFO_EMPTY_INT_ST_V 0x1 +#define I2C_TXFIFO_EMPTY_INT_ST_S 1 +/* I2C_RXFIFO_FULL_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The masked interrupt status for rxfifo_full_int interrupt.*/ +#define I2C_RXFIFO_FULL_INT_ST (BIT(0)) +#define I2C_RXFIFO_FULL_INT_ST_M (BIT(0)) +#define I2C_RXFIFO_FULL_INT_ST_V 0x1 +#define I2C_RXFIFO_FULL_INT_ST_S 0 + +#define I2C_SDA_HOLD_REG(i) (REG_I2C_BASE(i) + 0x0030) +/* I2C_SDA_HOLD_TIME : R/W ;bitpos:[9:0] ;default: 10'b0 ; */ +/*description: This register is used to configure the clock num I2C used to + hold the data after the negedge of SCL.*/ +#define I2C_SDA_HOLD_TIME 0x000003FF +#define I2C_SDA_HOLD_TIME_M ((I2C_SDA_HOLD_TIME_V)<<(I2C_SDA_HOLD_TIME_S)) +#define I2C_SDA_HOLD_TIME_V 0x3FF +#define I2C_SDA_HOLD_TIME_S 0 + +#define I2C_SDA_SAMPLE_REG(i) (REG_I2C_BASE(i) + 0x0034) +/* I2C_SDA_SAMPLE_TIME : R/W ;bitpos:[9:0] ;default: 10'b0 ; */ +/*description: This register is used to configure the clock num I2C used to + sample data on SDA after the posedge of SCL*/ +#define I2C_SDA_SAMPLE_TIME 0x000003FF +#define I2C_SDA_SAMPLE_TIME_M ((I2C_SDA_SAMPLE_TIME_V)<<(I2C_SDA_SAMPLE_TIME_S)) +#define I2C_SDA_SAMPLE_TIME_V 0x3FF +#define I2C_SDA_SAMPLE_TIME_S 0 + +#define I2C_SCL_HIGH_PERIOD_REG(i) (REG_I2C_BASE(i) + 0x0038) +/* I2C_SCL_WAIT_HIGH_PERIOD : R/W ;bitpos:[27:14] ;default: 14'b0 ; */ +/*description: */ +#define I2C_SCL_WAIT_HIGH_PERIOD 0x00003FFF +#define I2C_SCL_WAIT_HIGH_PERIOD_M ((I2C_SCL_WAIT_HIGH_PERIOD_V)<<(I2C_SCL_WAIT_HIGH_PERIOD_S)) +#define I2C_SCL_WAIT_HIGH_PERIOD_V 0x3FFF +#define I2C_SCL_WAIT_HIGH_PERIOD_S 14 +/* I2C_SCL_HIGH_PERIOD : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This register is used to configure the clock num during SCL is low level.*/ +#define I2C_SCL_HIGH_PERIOD 0x00003FFF +#define I2C_SCL_HIGH_PERIOD_M ((I2C_SCL_HIGH_PERIOD_V)<<(I2C_SCL_HIGH_PERIOD_S)) +#define I2C_SCL_HIGH_PERIOD_V 0x3FFF +#define I2C_SCL_HIGH_PERIOD_S 0 + +#define I2C_SCL_START_HOLD_REG(i) (REG_I2C_BASE(i) + 0x0040) +/* I2C_SCL_START_HOLD_TIME : R/W ;bitpos:[9:0] ;default: 10'b1000 ; */ +/*description: This register is used to configure the clock num between the + negedge of SDA and negedge of SCL for start mark.*/ +#define I2C_SCL_START_HOLD_TIME 0x000003FF +#define I2C_SCL_START_HOLD_TIME_M ((I2C_SCL_START_HOLD_TIME_V)<<(I2C_SCL_START_HOLD_TIME_S)) +#define I2C_SCL_START_HOLD_TIME_V 0x3FF +#define I2C_SCL_START_HOLD_TIME_S 0 + +#define I2C_SCL_RSTART_SETUP_REG(i) (REG_I2C_BASE(i) + 0x0044) +/* I2C_SCL_RSTART_SETUP_TIME : R/W ;bitpos:[9:0] ;default: 10'b1000 ; */ +/*description: This register is used to configure the clock num between the + posedge of SCL and the negedge of SDA for restart mark.*/ +#define I2C_SCL_RSTART_SETUP_TIME 0x000003FF +#define I2C_SCL_RSTART_SETUP_TIME_M ((I2C_SCL_RSTART_SETUP_TIME_V)<<(I2C_SCL_RSTART_SETUP_TIME_S)) +#define I2C_SCL_RSTART_SETUP_TIME_V 0x3FF +#define I2C_SCL_RSTART_SETUP_TIME_S 0 + +#define I2C_SCL_STOP_HOLD_REG(i) (REG_I2C_BASE(i) + 0x0048) +/* I2C_SCL_STOP_HOLD_TIME : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This register is used to configure the clock num after the STOP bit's posedge.*/ +#define I2C_SCL_STOP_HOLD_TIME 0x00003FFF +#define I2C_SCL_STOP_HOLD_TIME_M ((I2C_SCL_STOP_HOLD_TIME_V)<<(I2C_SCL_STOP_HOLD_TIME_S)) +#define I2C_SCL_STOP_HOLD_TIME_V 0x3FFF +#define I2C_SCL_STOP_HOLD_TIME_S 0 + +#define I2C_SCL_STOP_SETUP_REG(i) (REG_I2C_BASE(i) + 0x004C) +/* I2C_SCL_STOP_SETUP_TIME : R/W ;bitpos:[9:0] ;default: 10'b0 ; */ +/*description: This register is used to configure the clock num between the + posedge of SCL and the posedge of SDA.*/ +#define I2C_SCL_STOP_SETUP_TIME 0x000003FF +#define I2C_SCL_STOP_SETUP_TIME_M ((I2C_SCL_STOP_SETUP_TIME_V)<<(I2C_SCL_STOP_SETUP_TIME_S)) +#define I2C_SCL_STOP_SETUP_TIME_V 0x3FF +#define I2C_SCL_STOP_SETUP_TIME_S 0 + +#define I2C_SCL_FILTER_CFG_REG(i) (REG_I2C_BASE(i) + 0x0050) +/* I2C_SCL_FILTER_EN : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: This is the filter enable bit for SCL.*/ +#define I2C_SCL_FILTER_EN (BIT(3)) +#define I2C_SCL_FILTER_EN_M (BIT(3)) +#define I2C_SCL_FILTER_EN_V 0x1 +#define I2C_SCL_FILTER_EN_S 3 +/* I2C_SCL_FILTER_THRES : R/W ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: When input SCL's pulse width is smaller than this register value + I2C ignores this pulse.*/ +#define I2C_SCL_FILTER_THRES 0x00000007 +#define I2C_SCL_FILTER_THRES_M ((I2C_SCL_FILTER_THRES_V)<<(I2C_SCL_FILTER_THRES_S)) +#define I2C_SCL_FILTER_THRES_V 0x7 +#define I2C_SCL_FILTER_THRES_S 0 + +#define I2C_SDA_FILTER_CFG_REG(i) (REG_I2C_BASE(i) + 0x0054) +/* I2C_SDA_FILTER_EN : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: This is the filter enable bit for SDA.*/ +#define I2C_SDA_FILTER_EN (BIT(3)) +#define I2C_SDA_FILTER_EN_M (BIT(3)) +#define I2C_SDA_FILTER_EN_V 0x1 +#define I2C_SDA_FILTER_EN_S 3 +/* I2C_SDA_FILTER_THRES : R/W ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: When input SCL's pulse width is smaller than this register value + I2C ignores this pulse.*/ +#define I2C_SDA_FILTER_THRES 0x00000007 +#define I2C_SDA_FILTER_THRES_M ((I2C_SDA_FILTER_THRES_V)<<(I2C_SDA_FILTER_THRES_S)) +#define I2C_SDA_FILTER_THRES_V 0x7 +#define I2C_SDA_FILTER_THRES_S 0 + +#define I2C_COMD0_REG(i) (REG_I2C_BASE(i) + 0x0058) +/* I2C_COMMAND0_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command0 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND0_DONE (BIT(31)) +#define I2C_COMMAND0_DONE_M (BIT(31)) +#define I2C_COMMAND0_DONE_V 0x1 +#define I2C_COMMAND0_DONE_S 31 +/* I2C_COMMAND0 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command0. It consists of three part. op_code + is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND0 0x00003FFF +#define I2C_COMMAND0_M ((I2C_COMMAND0_V)<<(I2C_COMMAND0_S)) +#define I2C_COMMAND0_V 0x3FFF +#define I2C_COMMAND0_S 0 + +#define I2C_COMD1_REG(i) (REG_I2C_BASE(i) + 0x005C) +/* I2C_COMMAND1_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command1 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND1_DONE (BIT(31)) +#define I2C_COMMAND1_DONE_M (BIT(31)) +#define I2C_COMMAND1_DONE_V 0x1 +#define I2C_COMMAND1_DONE_S 31 +/* I2C_COMMAND1 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command1. It consists of three part. op_code + is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND1 0x00003FFF +#define I2C_COMMAND1_M ((I2C_COMMAND1_V)<<(I2C_COMMAND1_S)) +#define I2C_COMMAND1_V 0x3FFF +#define I2C_COMMAND1_S 0 + +#define I2C_COMD2_REG(i) (REG_I2C_BASE(i) + 0x0060) +/* I2C_COMMAND2_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command2 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND2_DONE (BIT(31)) +#define I2C_COMMAND2_DONE_M (BIT(31)) +#define I2C_COMMAND2_DONE_V 0x1 +#define I2C_COMMAND2_DONE_S 31 +/* I2C_COMMAND2 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command2. It consists of three part. op_code + is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND2 0x00003FFF +#define I2C_COMMAND2_M ((I2C_COMMAND2_V)<<(I2C_COMMAND2_S)) +#define I2C_COMMAND2_V 0x3FFF +#define I2C_COMMAND2_S 0 + +#define I2C_COMD3_REG(i) (REG_I2C_BASE(i) + 0x0064) +/* I2C_COMMAND3_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command3 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND3_DONE (BIT(31)) +#define I2C_COMMAND3_DONE_M (BIT(31)) +#define I2C_COMMAND3_DONE_V 0x1 +#define I2C_COMMAND3_DONE_S 31 +/* I2C_COMMAND3 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command3. It consists of three part. op_code + is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND3 0x00003FFF +#define I2C_COMMAND3_M ((I2C_COMMAND3_V)<<(I2C_COMMAND3_S)) +#define I2C_COMMAND3_V 0x3FFF +#define I2C_COMMAND3_S 0 + +#define I2C_COMD4_REG(i) (REG_I2C_BASE(i) + 0x0068) +/* I2C_COMMAND4_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command4 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND4_DONE (BIT(31)) +#define I2C_COMMAND4_DONE_M (BIT(31)) +#define I2C_COMMAND4_DONE_V 0x1 +#define I2C_COMMAND4_DONE_S 31 +/* I2C_COMMAND4 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command4. It consists of three part. op_code + is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND4 0x00003FFF +#define I2C_COMMAND4_M ((I2C_COMMAND4_V)<<(I2C_COMMAND4_S)) +#define I2C_COMMAND4_V 0x3FFF +#define I2C_COMMAND4_S 0 + +#define I2C_COMD5_REG(i) (REG_I2C_BASE(i) + 0x006C) +/* I2C_COMMAND5_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command5 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND5_DONE (BIT(31)) +#define I2C_COMMAND5_DONE_M (BIT(31)) +#define I2C_COMMAND5_DONE_V 0x1 +#define I2C_COMMAND5_DONE_S 31 +/* I2C_COMMAND5 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command5. It consists of three part. op_code + is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND5 0x00003FFF +#define I2C_COMMAND5_M ((I2C_COMMAND5_V)<<(I2C_COMMAND5_S)) +#define I2C_COMMAND5_V 0x3FFF +#define I2C_COMMAND5_S 0 + +#define I2C_COMD6_REG(i) (REG_I2C_BASE(i) + 0x0070) +/* I2C_COMMAND6_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command6 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND6_DONE (BIT(31)) +#define I2C_COMMAND6_DONE_M (BIT(31)) +#define I2C_COMMAND6_DONE_V 0x1 +#define I2C_COMMAND6_DONE_S 31 +/* I2C_COMMAND6 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command6. It consists of three part. op_code + is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND6 0x00003FFF +#define I2C_COMMAND6_M ((I2C_COMMAND6_V)<<(I2C_COMMAND6_S)) +#define I2C_COMMAND6_V 0x3FFF +#define I2C_COMMAND6_S 0 + +#define I2C_COMD7_REG(i) (REG_I2C_BASE(i) + 0x0074) +/* I2C_COMMAND7_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command7 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND7_DONE (BIT(31)) +#define I2C_COMMAND7_DONE_M (BIT(31)) +#define I2C_COMMAND7_DONE_V 0x1 +#define I2C_COMMAND7_DONE_S 31 +/* I2C_COMMAND7 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command7. It consists of three part. op_code + is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND7 0x00003FFF +#define I2C_COMMAND7_M ((I2C_COMMAND7_V)<<(I2C_COMMAND7_S)) +#define I2C_COMMAND7_V 0x3FFF +#define I2C_COMMAND7_S 0 + +#define I2C_COMD8_REG(i) (REG_I2C_BASE(i) + 0x0078) +/* I2C_COMMAND8_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command8 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND8_DONE (BIT(31)) +#define I2C_COMMAND8_DONE_M (BIT(31)) +#define I2C_COMMAND8_DONE_V 0x1 +#define I2C_COMMAND8_DONE_S 31 +/* I2C_COMMAND8 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command8. It consists of three part. op_code + is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND8 0x00003FFF +#define I2C_COMMAND8_M ((I2C_COMMAND8_V)<<(I2C_COMMAND8_S)) +#define I2C_COMMAND8_V 0x3FFF +#define I2C_COMMAND8_S 0 + +#define I2C_COMD9_REG(i) (REG_I2C_BASE(i) + 0x007C) +/* I2C_COMMAND9_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command9 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND9_DONE (BIT(31)) +#define I2C_COMMAND9_DONE_M (BIT(31)) +#define I2C_COMMAND9_DONE_V 0x1 +#define I2C_COMMAND9_DONE_S 31 +/* I2C_COMMAND9 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command9. It consists of three part. op_code + is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND9 0x00003FFF +#define I2C_COMMAND9_M ((I2C_COMMAND9_V)<<(I2C_COMMAND9_S)) +#define I2C_COMMAND9_V 0x3FFF +#define I2C_COMMAND9_S 0 + +#define I2C_COMD10_REG(i) (REG_I2C_BASE(i) + 0x0080) +/* I2C_COMMAND10_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command10 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND10_DONE (BIT(31)) +#define I2C_COMMAND10_DONE_M (BIT(31)) +#define I2C_COMMAND10_DONE_V 0x1 +#define I2C_COMMAND10_DONE_S 31 +/* I2C_COMMAND10 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command10. It consists of three part. + op_code is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND10 0x00003FFF +#define I2C_COMMAND10_M ((I2C_COMMAND10_V)<<(I2C_COMMAND10_S)) +#define I2C_COMMAND10_V 0x3FFF +#define I2C_COMMAND10_S 0 + +#define I2C_COMD11_REG(i) (REG_I2C_BASE(i) + 0x0084) +/* I2C_COMMAND11_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command11 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND11_DONE (BIT(31)) +#define I2C_COMMAND11_DONE_M (BIT(31)) +#define I2C_COMMAND11_DONE_V 0x1 +#define I2C_COMMAND11_DONE_S 31 +/* I2C_COMMAND11 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command11. It consists of three part. + op_code is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND11 0x00003FFF +#define I2C_COMMAND11_M ((I2C_COMMAND11_V)<<(I2C_COMMAND11_S)) +#define I2C_COMMAND11_V 0x3FFF +#define I2C_COMMAND11_S 0 + +#define I2C_COMD12_REG(i) (REG_I2C_BASE(i) + 0x0088) +/* I2C_COMMAND12_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command12 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND12_DONE (BIT(31)) +#define I2C_COMMAND12_DONE_M (BIT(31)) +#define I2C_COMMAND12_DONE_V 0x1 +#define I2C_COMMAND12_DONE_S 31 +/* I2C_COMMAND12 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command12. It consists of three part. + op_code is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND12 0x00003FFF +#define I2C_COMMAND12_M ((I2C_COMMAND12_V)<<(I2C_COMMAND12_S)) +#define I2C_COMMAND12_V 0x3FFF +#define I2C_COMMAND12_S 0 + +#define I2C_COMD13_REG(i) (REG_I2C_BASE(i) + 0x008C) +/* I2C_COMMAND13_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command13 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND13_DONE (BIT(31)) +#define I2C_COMMAND13_DONE_M (BIT(31)) +#define I2C_COMMAND13_DONE_V 0x1 +#define I2C_COMMAND13_DONE_S 31 +/* I2C_COMMAND13 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command13. It consists of three part. + op_code is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND13 0x00003FFF +#define I2C_COMMAND13_M ((I2C_COMMAND13_V)<<(I2C_COMMAND13_S)) +#define I2C_COMMAND13_V 0x3FFF +#define I2C_COMMAND13_S 0 + +#define I2C_COMD14_REG(i) (REG_I2C_BASE(i) + 0x0090) +/* I2C_COMMAND14_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command14 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND14_DONE (BIT(31)) +#define I2C_COMMAND14_DONE_M (BIT(31)) +#define I2C_COMMAND14_DONE_V 0x1 +#define I2C_COMMAND14_DONE_S 31 +/* I2C_COMMAND14 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command14. It consists of three part. + op_code is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND14 0x00003FFF +#define I2C_COMMAND14_M ((I2C_COMMAND14_V)<<(I2C_COMMAND14_S)) +#define I2C_COMMAND14_V 0x3FFF +#define I2C_COMMAND14_S 0 + +#define I2C_COMD15_REG(i) (REG_I2C_BASE(i) + 0x0094) +/* I2C_COMMAND15_DONE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: When command15 is done in I2C Master mode this bit changes to high level.*/ +#define I2C_COMMAND15_DONE (BIT(31)) +#define I2C_COMMAND15_DONE_M (BIT(31)) +#define I2C_COMMAND15_DONE_V 0x1 +#define I2C_COMMAND15_DONE_S 31 +/* I2C_COMMAND15 : R/W ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: This is the content of command15. It consists of three part. + op_code is the command 0: RSTART 1: WRITE 2: READ 3: STOP . 4:END. Byte_num represent the number of data need to be send or data need to be received. ack_check_en ack_exp and ack value are used to control the ack bit.*/ +#define I2C_COMMAND15 0x00003FFF +#define I2C_COMMAND15_M ((I2C_COMMAND15_V)<<(I2C_COMMAND15_S)) +#define I2C_COMMAND15_V 0x3FFF +#define I2C_COMMAND15_S 0 + +#define I2C_SCL_ST_TIME_OUT_REG(i) (REG_I2C_BASE(i) + 0x0098) +/* I2C_SCL_ST_TO_REG : R/W ;bitpos:[23:0] ;default: 24'h100 ; */ +/*description: */ +#define I2C_SCL_ST_TO_REG 0x00FFFFFF +#define I2C_SCL_ST_TO_REG_M ((I2C_SCL_ST_TO_REG_V)<<(I2C_SCL_ST_TO_REG_S)) +#define I2C_SCL_ST_TO_REG_V 0xFFFFFF +#define I2C_SCL_ST_TO_REG_S 0 + +#define I2C_SCL_MAIN_ST_TIME_OUT_REG(i) (REG_I2C_BASE(i) + 0x009c) +/* I2C_SCL_MAIN_ST_TO_REG : R/W ;bitpos:[23:0] ;default: 24'h100 ; */ +/*description: */ +#define I2C_SCL_MAIN_ST_TO_REG 0x00FFFFFF +#define I2C_SCL_MAIN_ST_TO_REG_M ((I2C_SCL_MAIN_ST_TO_REG_V)<<(I2C_SCL_MAIN_ST_TO_REG_S)) +#define I2C_SCL_MAIN_ST_TO_REG_V 0xFFFFFF +#define I2C_SCL_MAIN_ST_TO_REG_S 0 + +#define I2C_SCL_SP_CONF_REG(i) (REG_I2C_BASE(i) + 0x00a0) +/* I2C_SDA_PD_EN : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SDA_PD_EN (BIT(7)) +#define I2C_SDA_PD_EN_M (BIT(7)) +#define I2C_SDA_PD_EN_V 0x1 +#define I2C_SDA_PD_EN_S 7 +/* I2C_SCL_PD_EN : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SCL_PD_EN (BIT(6)) +#define I2C_SCL_PD_EN_M (BIT(6)) +#define I2C_SCL_PD_EN_V 0x1 +#define I2C_SCL_PD_EN_S 6 +/* I2C_SCL_RST_SLV_NUM : R/W ;bitpos:[5:1] ;default: 5'b0 ; */ +/*description: */ +#define I2C_SCL_RST_SLV_NUM 0x0000001F +#define I2C_SCL_RST_SLV_NUM_M ((I2C_SCL_RST_SLV_NUM_V)<<(I2C_SCL_RST_SLV_NUM_S)) +#define I2C_SCL_RST_SLV_NUM_V 0x1F +#define I2C_SCL_RST_SLV_NUM_S 1 +/* I2C_SCL_RST_SLV_EN : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define I2C_SCL_RST_SLV_EN (BIT(0)) +#define I2C_SCL_RST_SLV_EN_M (BIT(0)) +#define I2C_SCL_RST_SLV_EN_V 0x1 +#define I2C_SCL_RST_SLV_EN_S 0 + +#define I2C_DATE_REG(i) (REG_I2C_BASE(i) + 0x00F8) +/* I2C_DATE : R/W ;bitpos:[31:0] ;default: 32'h18073100 ; */ +/*description: */ +#define I2C_DATE 0xFFFFFFFF +#define I2C_DATE_M ((I2C_DATE_V)<<(I2C_DATE_S)) +#define I2C_DATE_V 0xFFFFFFFF +#define I2C_DATE_S 0 + +#define I2C_FIFO_START_ADDR_REG(i) (REG_I2C_BASE(i) + 0x0100) + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_I2C_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/i2c_struct.h b/components/soc/esp32s2beta/include/soc/i2c_struct.h new file mode 100644 index 0000000000..f14269eb1d --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/i2c_struct.h @@ -0,0 +1,338 @@ +// Copyright 2017-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_I2C_STRUCT_H_ +#define _SOC_I2C_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t period: 14; + uint32_t reserved14: 18; + }; + uint32_t val; + } scl_low_period; + union { + struct { + uint32_t sda_force_out: 1; + uint32_t scl_force_out: 1; + uint32_t sample_scl_level: 1; + uint32_t ack_level: 1; + uint32_t ms_mode: 1; + uint32_t trans_start: 1; + uint32_t tx_lsb_first: 1; + uint32_t rx_lsb_first: 1; + uint32_t clk_en: 1; + uint32_t arbitration_en: 1; + uint32_t fsm_rst: 1; + uint32_t ref_always_on: 1; + uint32_t reserved12: 20; + }; + uint32_t val; + } ctr; + union { + struct { + uint32_t ack_rec: 1; + uint32_t slave_rw: 1; + uint32_t time_out: 1; + uint32_t arb_lost: 1; + uint32_t bus_busy: 1; + uint32_t slave_addressed: 1; + uint32_t byte_trans: 1; + uint32_t reserved7: 1; + uint32_t rx_fifo_cnt: 6; + uint32_t reserved14: 4; + uint32_t tx_fifo_cnt: 6; + uint32_t scl_main_state_last: 3; + uint32_t reserved27: 1; + uint32_t scl_state_last: 3; + uint32_t reserved31: 1; + }; + uint32_t val; + } status_reg; + union { + struct { + uint32_t tout: 24; + uint32_t time_out_en: 1; + uint32_t reserved25: 7; + }; + uint32_t val; + } timeout; + union { + struct { + uint32_t addr: 15; + uint32_t reserved15: 16; + uint32_t en_10bit: 1; + }; + uint32_t val; + } slave_addr; + union { + struct { + uint32_t rx_fifo_start_addr: 5; + uint32_t rx_fifo_end_addr: 5; + uint32_t tx_fifo_start_addr: 5; + uint32_t tx_fifo_end_addr: 5; + uint32_t rx_update: 1; + uint32_t tx_update: 1; + uint32_t tx_fifo_init_raddr: 5; + uint32_t rx_fifo_init_waddr: 5; + }; + uint32_t val; + } fifo_st; + union { + struct { + uint32_t rx_fifo_full_thrhd: 5; + uint32_t tx_fifo_empty_thrhd: 5; + uint32_t nonfifo_en: 1; + uint32_t fifo_addr_cfg_en: 1; + uint32_t rx_fifo_rst: 1; + uint32_t tx_fifo_rst: 1; + uint32_t nonfifo_rx_thres: 6; + uint32_t nonfifo_tx_thres: 6; + uint32_t reserved26: 6; + }; + uint32_t val; + } fifo_conf; + union { + struct { + uint8_t data; + uint8_t reserved[3]; + }; + uint32_t val; + } fifo_data; + union { + struct { + uint32_t rx_fifo_full: 1; + uint32_t tx_fifo_empty: 1; + uint32_t rx_fifo_ovf: 1; + uint32_t end_detect: 1; + uint32_t slave_tran_comp: 1; + uint32_t arbitration_lost: 1; + uint32_t master_tran_comp: 1; + uint32_t trans_complete: 1; + uint32_t time_out: 1; + uint32_t trans_start: 1; + uint32_t ack_err: 1; + uint32_t rx_rec_full: 1; + uint32_t tx_send_empty: 1; + uint32_t scl_st_to: 1; + uint32_t scl_main_st_to: 1; + uint32_t det_start: 1; + uint32_t reserved16: 16; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t rx_fifo_full: 1; + uint32_t tx_fifo_empty: 1; + uint32_t rx_fifo_ovf: 1; + uint32_t end_detect: 1; + uint32_t slave_tran_comp: 1; + uint32_t arbitration_lost: 1; + uint32_t master_tran_comp: 1; + uint32_t trans_complete: 1; + uint32_t time_out: 1; + uint32_t trans_start: 1; + uint32_t ack_err: 1; + uint32_t rx_rec_full: 1; + uint32_t tx_send_empty: 1; + uint32_t scl_st_to: 1; + uint32_t scl_main_st_to: 1; + uint32_t det_start: 1; + uint32_t reserved16: 16; + }; + uint32_t val; + } int_clr; + union { + struct { + uint32_t rx_fifo_full: 1; + uint32_t tx_fifo_empty: 1; + uint32_t rx_fifo_ovf: 1; + uint32_t end_detect: 1; + uint32_t slave_tran_comp: 1; + uint32_t arbitration_lost: 1; + uint32_t master_tran_comp: 1; + uint32_t trans_complete: 1; + uint32_t time_out: 1; + uint32_t trans_start: 1; + uint32_t ack_err: 1; + uint32_t rx_rec_full: 1; + uint32_t tx_send_empty: 1; + uint32_t scl_st_to: 1; + uint32_t scl_main_st_to: 1; + uint32_t det_start: 1; + uint32_t reserved16: 16; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t rx_fifo_full: 1; + uint32_t tx_fifo_empty: 1; + uint32_t rx_fifo_ovf: 1; + uint32_t end_detect: 1; + uint32_t slave_tran_comp: 1; + uint32_t arbitration_lost: 1; + uint32_t master_tran_comp: 1; + uint32_t trans_complete: 1; + uint32_t time_out: 1; + uint32_t trans_start: 1; + uint32_t ack_err: 1; + uint32_t rx_rec_full: 1; + uint32_t tx_send_empty: 1; + uint32_t scl_st_to: 1; + uint32_t scl_main_st_to: 1; + uint32_t det_start: 1; + uint32_t reserved16: 16; + }; + uint32_t val; + } int_status; + union { + struct { + uint32_t time: 10; + uint32_t reserved10: 22; + }; + uint32_t val; + } sda_hold; + union { + struct { + uint32_t time: 10; + uint32_t reserved10: 22; + }; + uint32_t val; + } sda_sample; + union { + struct { + uint32_t period: 14; + uint32_t scl_wait_high_period:14; + uint32_t reserved28: 4; + }; + uint32_t val; + } scl_high_period; + uint32_t reserved_3c; + union { + struct { + uint32_t time: 10; + uint32_t reserved10: 22; + }; + uint32_t val; + } scl_start_hold; + union { + struct { + uint32_t time: 10; + uint32_t reserved10: 22; + }; + uint32_t val; + } scl_rstart_setup; + union { + struct { + uint32_t time: 14; + uint32_t reserved14: 18; + }; + uint32_t val; + } scl_stop_hold; + union { + struct { + uint32_t time: 10; + uint32_t reserved10: 22; + }; + uint32_t val; + } scl_stop_setup; + union { + struct { + uint32_t thres: 3; + uint32_t en: 1; + uint32_t reserved4: 28; + }; + uint32_t val; + } scl_filter_cfg; + union { + struct { + uint32_t thres: 3; + uint32_t en: 1; + uint32_t reserved4: 28; + }; + uint32_t val; + } sda_filter_cfg; + union { + struct { + uint32_t byte_num: 8; /*Byte_num represent the number of data need to be send or data need to be received.*/ + uint32_t ack_en: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ + uint32_t ack_exp: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ + uint32_t ack_val: 1; /*ack_check_en ack_exp and ack value are used to control the ack bit.*/ + uint32_t op_code: 3; /*op_code is the command 0:RSTART 1:WRITE 2:READ 3:STOP . 4:END.*/ + uint32_t reserved14: 17; + uint32_t done: 1; /*When command0 is done in I2C Master mode this bit changes to high level.*/ + }; + uint32_t val; + } command[16]; + union { + struct { + uint32_t scl_st_to: 24; + uint32_t reserved24: 8; + }; + uint32_t val; + } scl_st_time_out; + union { + struct { + uint32_t scl_main_st_to:24; + uint32_t reserved24: 8; + }; + uint32_t val; + } scl_main_st_time_out; + union { + struct { + uint32_t scl_rst_slv_en: 1; + uint32_t scl_rst_slv_num: 5; + uint32_t scl_pd_en: 1; + uint32_t sda_pd_en: 1; + uint32_t reserved8: 24; + }; + uint32_t val; + } scl_sp_conf; + uint32_t reserved_a4; + uint32_t reserved_a8; + uint32_t reserved_ac; + uint32_t reserved_b0; + uint32_t reserved_b4; + uint32_t reserved_b8; + uint32_t reserved_bc; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t date; /**/ + uint32_t reserved_fc; + uint32_t ram_data[32]; /**/ +} i2c_dev_t; +extern i2c_dev_t I2C0; +extern i2c_dev_t I2C1; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_I2C_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/i2s_caps.h b/components/soc/esp32s2beta/include/soc/i2s_caps.h new file mode 100644 index 0000000000..9dfa5bb6dc --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/i2s_caps.h @@ -0,0 +1,18 @@ +// 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. + +#pragma once + +#define SOC_I2S_PERIPH_NUM (1) //ESP32-S2 have 1 I2S +#define SOC_I2S_SUPPORT_PDM (0) //ESP32-S2 do not support PDM diff --git a/components/soc/esp32s2beta/include/soc/i2s_reg.h b/components/soc/esp32s2beta/include/soc/i2s_reg.h new file mode 100644 index 0000000000..aa64b2ba1a --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/i2s_reg.h @@ -0,0 +1,1728 @@ +// Copyright 2017-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. +#ifndef _SOC_I2S_REG_H_ +#define _SOC_I2S_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define I2S_CONF_REG(i) (REG_I2S_BASE(i) + 0x0008) +/* I2S_RX_RESET_ST : RO ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define I2S_RX_RESET_ST (BIT(29)) +#define I2S_RX_RESET_ST_M (BIT(29)) +#define I2S_RX_RESET_ST_V 0x1 +#define I2S_RX_RESET_ST_S 29 +/* I2S_RX_BIG_ENDIAN : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: */ +#define I2S_RX_BIG_ENDIAN (BIT(28)) +#define I2S_RX_BIG_ENDIAN_M (BIT(28)) +#define I2S_RX_BIG_ENDIAN_V 0x1 +#define I2S_RX_BIG_ENDIAN_S 28 +/* I2S_TX_BIG_ENDIAN : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define I2S_TX_BIG_ENDIAN (BIT(27)) +#define I2S_TX_BIG_ENDIAN_M (BIT(27)) +#define I2S_TX_BIG_ENDIAN_V 0x1 +#define I2S_TX_BIG_ENDIAN_S 27 +/* I2S_PRE_REQ_EN : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: set this bit to enable i2s to prepare data earlier*/ +#define I2S_PRE_REQ_EN (BIT(26)) +#define I2S_PRE_REQ_EN_M (BIT(26)) +#define I2S_PRE_REQ_EN_V 0x1 +#define I2S_PRE_REQ_EN_S 26 +/* I2S_RX_DMA_EQUAL : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: 1:data in left channel is equal to data in right channel*/ +#define I2S_RX_DMA_EQUAL (BIT(25)) +#define I2S_RX_DMA_EQUAL_M (BIT(25)) +#define I2S_RX_DMA_EQUAL_V 0x1 +#define I2S_RX_DMA_EQUAL_S 25 +/* I2S_TX_DMA_EQUAL : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: 1:data in left channel is equal to data in right channel*/ +#define I2S_TX_DMA_EQUAL (BIT(24)) +#define I2S_TX_DMA_EQUAL_M (BIT(24)) +#define I2S_TX_DMA_EQUAL_V 0x1 +#define I2S_TX_DMA_EQUAL_S 24 +/* I2S_TX_RESET_ST : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: 1: i2s_tx_reset is not ok 0: i2s_tx_reset is ok*/ +#define I2S_TX_RESET_ST (BIT(23)) +#define I2S_TX_RESET_ST_M (BIT(23)) +#define I2S_TX_RESET_ST_V 0x1 +#define I2S_TX_RESET_ST_S 23 +/* I2S_RX_FIFO_RESET_ST : RO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: 1:i2s_rx_fifo_reset is not ok 0:i2s_rx_fifo reset is ok*/ +#define I2S_RX_FIFO_RESET_ST (BIT(22)) +#define I2S_RX_FIFO_RESET_ST_M (BIT(22)) +#define I2S_RX_FIFO_RESET_ST_V 0x1 +#define I2S_RX_FIFO_RESET_ST_S 22 +/* I2S_TX_FIFO_RESET_ST : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: 1:i2s_tx_fifo reset is not ok 0:i2s_tx_fifo_reset is ok*/ +#define I2S_TX_FIFO_RESET_ST (BIT(21)) +#define I2S_TX_FIFO_RESET_ST_M (BIT(21)) +#define I2S_TX_FIFO_RESET_ST_V 0x1 +#define I2S_TX_FIFO_RESET_ST_S 21 +/* I2S_SIG_LOOPBACK : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: Enable signal loopback mode with transmitter module and receiver + module sharing the same WS and BCK signals.*/ +#define I2S_SIG_LOOPBACK (BIT(20)) +#define I2S_SIG_LOOPBACK_M (BIT(20)) +#define I2S_SIG_LOOPBACK_V 0x1 +#define I2S_SIG_LOOPBACK_S 20 +/* I2S_RX_LSB_FIRST_DMA : R/W ;bitpos:[19] ;default: 1'b1 ; */ +/*description: 1:the data in DMA/APB transform from low bits*/ +#define I2S_RX_LSB_FIRST_DMA (BIT(19)) +#define I2S_RX_LSB_FIRST_DMA_M (BIT(19)) +#define I2S_RX_LSB_FIRST_DMA_V 0x1 +#define I2S_RX_LSB_FIRST_DMA_S 19 +/* I2S_TX_LSB_FIRST_DMA : R/W ;bitpos:[18] ;default: 1'b1 ; */ +/*description: 1:the data in DMA/APB transform from low bits*/ +#define I2S_TX_LSB_FIRST_DMA (BIT(18)) +#define I2S_TX_LSB_FIRST_DMA_M (BIT(18)) +#define I2S_TX_LSB_FIRST_DMA_V 0x1 +#define I2S_TX_LSB_FIRST_DMA_S 18 +/* I2S_RX_MSB_RIGHT : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: Set this bit to place right channel data at the MSB in the receive FIFO.*/ +#define I2S_RX_MSB_RIGHT (BIT(17)) +#define I2S_RX_MSB_RIGHT_M (BIT(17)) +#define I2S_RX_MSB_RIGHT_V 0x1 +#define I2S_RX_MSB_RIGHT_S 17 +/* I2S_TX_MSB_RIGHT : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: Set this bit to place right channel data at the MSB in the transmit FIFO.*/ +#define I2S_TX_MSB_RIGHT (BIT(16)) +#define I2S_TX_MSB_RIGHT_M (BIT(16)) +#define I2S_TX_MSB_RIGHT_V 0x1 +#define I2S_TX_MSB_RIGHT_S 16 +/* I2S_RX_MONO : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: Set this bit to enable receiver in mono mode*/ +#define I2S_RX_MONO (BIT(15)) +#define I2S_RX_MONO_M (BIT(15)) +#define I2S_RX_MONO_V 0x1 +#define I2S_RX_MONO_S 15 +/* I2S_TX_MONO : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: Set this bit to enable transmitter in mono mode*/ +#define I2S_TX_MONO (BIT(14)) +#define I2S_TX_MONO_M (BIT(14)) +#define I2S_TX_MONO_V 0x1 +#define I2S_TX_MONO_S 14 +/* I2S_RX_SHORT_SYNC : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: Set this bit to enable receiver in PCM standard mode*/ +#define I2S_RX_SHORT_SYNC (BIT(13)) +#define I2S_RX_SHORT_SYNC_M (BIT(13)) +#define I2S_RX_SHORT_SYNC_V 0x1 +#define I2S_RX_SHORT_SYNC_S 13 +/* I2S_TX_SHORT_SYNC : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: Set this bit to enable transmitter in PCM standard mode*/ +#define I2S_TX_SHORT_SYNC (BIT(12)) +#define I2S_TX_SHORT_SYNC_M (BIT(12)) +#define I2S_TX_SHORT_SYNC_V 0x1 +#define I2S_TX_SHORT_SYNC_S 12 +/* I2S_RX_MSB_SHIFT : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: Set this bit to enable receiver in Phillips standard mode*/ +#define I2S_RX_MSB_SHIFT (BIT(11)) +#define I2S_RX_MSB_SHIFT_M (BIT(11)) +#define I2S_RX_MSB_SHIFT_V 0x1 +#define I2S_RX_MSB_SHIFT_S 11 +/* I2S_TX_MSB_SHIFT : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: Set this bit to enable transmitter in Phillips standard mode*/ +#define I2S_TX_MSB_SHIFT (BIT(10)) +#define I2S_TX_MSB_SHIFT_M (BIT(10)) +#define I2S_TX_MSB_SHIFT_V 0x1 +#define I2S_TX_MSB_SHIFT_S 10 +/* I2S_RX_RIGHT_FIRST : R/W ;bitpos:[9] ;default: 1'b1 ; */ +/*description: Set this bit to receive right channel data first*/ +#define I2S_RX_RIGHT_FIRST (BIT(9)) +#define I2S_RX_RIGHT_FIRST_M (BIT(9)) +#define I2S_RX_RIGHT_FIRST_V 0x1 +#define I2S_RX_RIGHT_FIRST_S 9 +/* I2S_TX_RIGHT_FIRST : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: Set this bit to transmit right channel data first*/ +#define I2S_TX_RIGHT_FIRST (BIT(8)) +#define I2S_TX_RIGHT_FIRST_M (BIT(8)) +#define I2S_TX_RIGHT_FIRST_V 0x1 +#define I2S_TX_RIGHT_FIRST_S 8 +/* I2S_RX_SLAVE_MOD : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: Set this bit to enable slave receiver mode*/ +#define I2S_RX_SLAVE_MOD (BIT(7)) +#define I2S_RX_SLAVE_MOD_M (BIT(7)) +#define I2S_RX_SLAVE_MOD_V 0x1 +#define I2S_RX_SLAVE_MOD_S 7 +/* I2S_TX_SLAVE_MOD : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: Set this bit to enable slave transmitter mode*/ +#define I2S_TX_SLAVE_MOD (BIT(6)) +#define I2S_TX_SLAVE_MOD_M (BIT(6)) +#define I2S_TX_SLAVE_MOD_V 0x1 +#define I2S_TX_SLAVE_MOD_S 6 +/* I2S_RX_START : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: Set this bit to start receiving data*/ +#define I2S_RX_START (BIT(5)) +#define I2S_RX_START_M (BIT(5)) +#define I2S_RX_START_V 0x1 +#define I2S_RX_START_S 5 +/* I2S_TX_START : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: Set this bit to start transmitting data*/ +#define I2S_TX_START (BIT(4)) +#define I2S_TX_START_M (BIT(4)) +#define I2S_TX_START_V 0x1 +#define I2S_TX_START_S 4 +/* I2S_RX_FIFO_RESET : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: Set this bit to reset rxFIFO*/ +#define I2S_RX_FIFO_RESET (BIT(3)) +#define I2S_RX_FIFO_RESET_M (BIT(3)) +#define I2S_RX_FIFO_RESET_V 0x1 +#define I2S_RX_FIFO_RESET_S 3 +/* I2S_TX_FIFO_RESET : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: Set this bit to reset txFIFO*/ +#define I2S_TX_FIFO_RESET (BIT(2)) +#define I2S_TX_FIFO_RESET_M (BIT(2)) +#define I2S_TX_FIFO_RESET_V 0x1 +#define I2S_TX_FIFO_RESET_S 2 +/* I2S_RX_RESET : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: Set this bit to reset receiver*/ +#define I2S_RX_RESET (BIT(1)) +#define I2S_RX_RESET_M (BIT(1)) +#define I2S_RX_RESET_V 0x1 +#define I2S_RX_RESET_S 1 +/* I2S_TX_RESET : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: Set this bit to reset transmitter*/ +#define I2S_TX_RESET (BIT(0)) +#define I2S_TX_RESET_M (BIT(0)) +#define I2S_TX_RESET_V 0x1 +#define I2S_TX_RESET_S 0 + +#define I2S_INT_RAW_REG(i) (REG_I2S_BASE(i) + 0x000c) +/* I2S_OUT_TOTAL_EOF_INT_RAW : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_out_total_eof_int interrupt*/ +#define I2S_OUT_TOTAL_EOF_INT_RAW (BIT(16)) +#define I2S_OUT_TOTAL_EOF_INT_RAW_M (BIT(16)) +#define I2S_OUT_TOTAL_EOF_INT_RAW_V 0x1 +#define I2S_OUT_TOTAL_EOF_INT_RAW_S 16 +/* I2S_IN_DSCR_EMPTY_INT_RAW : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_in_dscr_empty_int interrupt*/ +#define I2S_IN_DSCR_EMPTY_INT_RAW (BIT(15)) +#define I2S_IN_DSCR_EMPTY_INT_RAW_M (BIT(15)) +#define I2S_IN_DSCR_EMPTY_INT_RAW_V 0x1 +#define I2S_IN_DSCR_EMPTY_INT_RAW_S 15 +/* I2S_OUT_DSCR_ERR_INT_RAW : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_out_dscr_err_int interrupt*/ +#define I2S_OUT_DSCR_ERR_INT_RAW (BIT(14)) +#define I2S_OUT_DSCR_ERR_INT_RAW_M (BIT(14)) +#define I2S_OUT_DSCR_ERR_INT_RAW_V 0x1 +#define I2S_OUT_DSCR_ERR_INT_RAW_S 14 +/* I2S_IN_DSCR_ERR_INT_RAW : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_in_dscr_err_int interrupt*/ +#define I2S_IN_DSCR_ERR_INT_RAW (BIT(13)) +#define I2S_IN_DSCR_ERR_INT_RAW_M (BIT(13)) +#define I2S_IN_DSCR_ERR_INT_RAW_V 0x1 +#define I2S_IN_DSCR_ERR_INT_RAW_S 13 +/* I2S_OUT_EOF_INT_RAW : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_out_eof_int interrupt*/ +#define I2S_OUT_EOF_INT_RAW (BIT(12)) +#define I2S_OUT_EOF_INT_RAW_M (BIT(12)) +#define I2S_OUT_EOF_INT_RAW_V 0x1 +#define I2S_OUT_EOF_INT_RAW_S 12 +/* I2S_OUT_DONE_INT_RAW : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_out_done_int interrupt*/ +#define I2S_OUT_DONE_INT_RAW (BIT(11)) +#define I2S_OUT_DONE_INT_RAW_M (BIT(11)) +#define I2S_OUT_DONE_INT_RAW_V 0x1 +#define I2S_OUT_DONE_INT_RAW_S 11 +/* I2S_IN_ERR_EOF_INT_RAW : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_IN_ERR_EOF_INT_RAW (BIT(10)) +#define I2S_IN_ERR_EOF_INT_RAW_M (BIT(10)) +#define I2S_IN_ERR_EOF_INT_RAW_V 0x1 +#define I2S_IN_ERR_EOF_INT_RAW_S 10 +/* I2S_IN_SUC_EOF_INT_RAW : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_in_suc_eof_int interrupt*/ +#define I2S_IN_SUC_EOF_INT_RAW (BIT(9)) +#define I2S_IN_SUC_EOF_INT_RAW_M (BIT(9)) +#define I2S_IN_SUC_EOF_INT_RAW_V 0x1 +#define I2S_IN_SUC_EOF_INT_RAW_S 9 +/* I2S_IN_DONE_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_in_done_int interrupt*/ +#define I2S_IN_DONE_INT_RAW (BIT(8)) +#define I2S_IN_DONE_INT_RAW_M (BIT(8)) +#define I2S_IN_DONE_INT_RAW_V 0x1 +#define I2S_IN_DONE_INT_RAW_S 8 +/* I2S_TX_HUNG_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_tx_hung_int interrupt*/ +#define I2S_TX_HUNG_INT_RAW (BIT(7)) +#define I2S_TX_HUNG_INT_RAW_M (BIT(7)) +#define I2S_TX_HUNG_INT_RAW_V 0x1 +#define I2S_TX_HUNG_INT_RAW_S 7 +/* I2S_RX_HUNG_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_rx_hung_int interrupt*/ +#define I2S_RX_HUNG_INT_RAW (BIT(6)) +#define I2S_RX_HUNG_INT_RAW_M (BIT(6)) +#define I2S_RX_HUNG_INT_RAW_V 0x1 +#define I2S_RX_HUNG_INT_RAW_S 6 +/* I2S_TX_REMPTY_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_tx_rempty_int interrupt*/ +#define I2S_TX_REMPTY_INT_RAW (BIT(5)) +#define I2S_TX_REMPTY_INT_RAW_M (BIT(5)) +#define I2S_TX_REMPTY_INT_RAW_V 0x1 +#define I2S_TX_REMPTY_INT_RAW_S 5 +/* I2S_TX_WFULL_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_tx_wfull_int interrupt*/ +#define I2S_TX_WFULL_INT_RAW (BIT(4)) +#define I2S_TX_WFULL_INT_RAW_M (BIT(4)) +#define I2S_TX_WFULL_INT_RAW_V 0x1 +#define I2S_TX_WFULL_INT_RAW_S 4 +/* I2S_RX_REMPTY_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_rx_rempty_int interrupt*/ +#define I2S_RX_REMPTY_INT_RAW (BIT(3)) +#define I2S_RX_REMPTY_INT_RAW_M (BIT(3)) +#define I2S_RX_REMPTY_INT_RAW_V 0x1 +#define I2S_RX_REMPTY_INT_RAW_S 3 +/* I2S_RX_WFULL_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_rx_wfull_int interrupt*/ +#define I2S_RX_WFULL_INT_RAW (BIT(2)) +#define I2S_RX_WFULL_INT_RAW_M (BIT(2)) +#define I2S_RX_WFULL_INT_RAW_V 0x1 +#define I2S_RX_WFULL_INT_RAW_S 2 +/* I2S_TX_PUT_DATA_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_tx_put_data_int interrupt*/ +#define I2S_TX_PUT_DATA_INT_RAW (BIT(1)) +#define I2S_TX_PUT_DATA_INT_RAW_M (BIT(1)) +#define I2S_TX_PUT_DATA_INT_RAW_V 0x1 +#define I2S_TX_PUT_DATA_INT_RAW_S 1 +/* I2S_RX_TAKE_DATA_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The raw interrupt status bit for the i2s_rx_take_data_int interrupt*/ +#define I2S_RX_TAKE_DATA_INT_RAW (BIT(0)) +#define I2S_RX_TAKE_DATA_INT_RAW_M (BIT(0)) +#define I2S_RX_TAKE_DATA_INT_RAW_V 0x1 +#define I2S_RX_TAKE_DATA_INT_RAW_S 0 + +#define I2S_INT_ST_REG(i) (REG_I2S_BASE(i) + 0x0010) +/* I2S_OUT_TOTAL_EOF_INT_ST : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_out_total_eof_int interrupt*/ +#define I2S_OUT_TOTAL_EOF_INT_ST (BIT(16)) +#define I2S_OUT_TOTAL_EOF_INT_ST_M (BIT(16)) +#define I2S_OUT_TOTAL_EOF_INT_ST_V 0x1 +#define I2S_OUT_TOTAL_EOF_INT_ST_S 16 +/* I2S_IN_DSCR_EMPTY_INT_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_in_dscr_empty_int interrupt*/ +#define I2S_IN_DSCR_EMPTY_INT_ST (BIT(15)) +#define I2S_IN_DSCR_EMPTY_INT_ST_M (BIT(15)) +#define I2S_IN_DSCR_EMPTY_INT_ST_V 0x1 +#define I2S_IN_DSCR_EMPTY_INT_ST_S 15 +/* I2S_OUT_DSCR_ERR_INT_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_out_dscr_err_int interrupt*/ +#define I2S_OUT_DSCR_ERR_INT_ST (BIT(14)) +#define I2S_OUT_DSCR_ERR_INT_ST_M (BIT(14)) +#define I2S_OUT_DSCR_ERR_INT_ST_V 0x1 +#define I2S_OUT_DSCR_ERR_INT_ST_S 14 +/* I2S_IN_DSCR_ERR_INT_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_in_dscr_err_int interrupt*/ +#define I2S_IN_DSCR_ERR_INT_ST (BIT(13)) +#define I2S_IN_DSCR_ERR_INT_ST_M (BIT(13)) +#define I2S_IN_DSCR_ERR_INT_ST_V 0x1 +#define I2S_IN_DSCR_ERR_INT_ST_S 13 +/* I2S_OUT_EOF_INT_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_out_eof_int interrupt*/ +#define I2S_OUT_EOF_INT_ST (BIT(12)) +#define I2S_OUT_EOF_INT_ST_M (BIT(12)) +#define I2S_OUT_EOF_INT_ST_V 0x1 +#define I2S_OUT_EOF_INT_ST_S 12 +/* I2S_OUT_DONE_INT_ST : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_out_done_int interrupt*/ +#define I2S_OUT_DONE_INT_ST (BIT(11)) +#define I2S_OUT_DONE_INT_ST_M (BIT(11)) +#define I2S_OUT_DONE_INT_ST_V 0x1 +#define I2S_OUT_DONE_INT_ST_S 11 +/* I2S_IN_ERR_EOF_INT_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_IN_ERR_EOF_INT_ST (BIT(10)) +#define I2S_IN_ERR_EOF_INT_ST_M (BIT(10)) +#define I2S_IN_ERR_EOF_INT_ST_V 0x1 +#define I2S_IN_ERR_EOF_INT_ST_S 10 +/* I2S_IN_SUC_EOF_INT_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_in_suc_eof_int interrupt*/ +#define I2S_IN_SUC_EOF_INT_ST (BIT(9)) +#define I2S_IN_SUC_EOF_INT_ST_M (BIT(9)) +#define I2S_IN_SUC_EOF_INT_ST_V 0x1 +#define I2S_IN_SUC_EOF_INT_ST_S 9 +/* I2S_IN_DONE_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_in_done_int interrupt*/ +#define I2S_IN_DONE_INT_ST (BIT(8)) +#define I2S_IN_DONE_INT_ST_M (BIT(8)) +#define I2S_IN_DONE_INT_ST_V 0x1 +#define I2S_IN_DONE_INT_ST_S 8 +/* I2S_TX_HUNG_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_tx_hung_int interrupt*/ +#define I2S_TX_HUNG_INT_ST (BIT(7)) +#define I2S_TX_HUNG_INT_ST_M (BIT(7)) +#define I2S_TX_HUNG_INT_ST_V 0x1 +#define I2S_TX_HUNG_INT_ST_S 7 +/* I2S_RX_HUNG_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_rx_hung_int interrupt*/ +#define I2S_RX_HUNG_INT_ST (BIT(6)) +#define I2S_RX_HUNG_INT_ST_M (BIT(6)) +#define I2S_RX_HUNG_INT_ST_V 0x1 +#define I2S_RX_HUNG_INT_ST_S 6 +/* I2S_TX_REMPTY_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_tx_rempty_int interrupt*/ +#define I2S_TX_REMPTY_INT_ST (BIT(5)) +#define I2S_TX_REMPTY_INT_ST_M (BIT(5)) +#define I2S_TX_REMPTY_INT_ST_V 0x1 +#define I2S_TX_REMPTY_INT_ST_S 5 +/* I2S_TX_WFULL_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_tx_wfull_int interrupt*/ +#define I2S_TX_WFULL_INT_ST (BIT(4)) +#define I2S_TX_WFULL_INT_ST_M (BIT(4)) +#define I2S_TX_WFULL_INT_ST_V 0x1 +#define I2S_TX_WFULL_INT_ST_S 4 +/* I2S_RX_REMPTY_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_rx_rempty_int interrupt*/ +#define I2S_RX_REMPTY_INT_ST (BIT(3)) +#define I2S_RX_REMPTY_INT_ST_M (BIT(3)) +#define I2S_RX_REMPTY_INT_ST_V 0x1 +#define I2S_RX_REMPTY_INT_ST_S 3 +/* I2S_RX_WFULL_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_rx_wfull_int interrupt*/ +#define I2S_RX_WFULL_INT_ST (BIT(2)) +#define I2S_RX_WFULL_INT_ST_M (BIT(2)) +#define I2S_RX_WFULL_INT_ST_V 0x1 +#define I2S_RX_WFULL_INT_ST_S 2 +/* I2S_TX_PUT_DATA_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_tx_put_data_int interrupt*/ +#define I2S_TX_PUT_DATA_INT_ST (BIT(1)) +#define I2S_TX_PUT_DATA_INT_ST_M (BIT(1)) +#define I2S_TX_PUT_DATA_INT_ST_V 0x1 +#define I2S_TX_PUT_DATA_INT_ST_S 1 +/* I2S_RX_TAKE_DATA_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The masked interrupt status bit for the i2s_rx_take_data_int interrupt*/ +#define I2S_RX_TAKE_DATA_INT_ST (BIT(0)) +#define I2S_RX_TAKE_DATA_INT_ST_M (BIT(0)) +#define I2S_RX_TAKE_DATA_INT_ST_V 0x1 +#define I2S_RX_TAKE_DATA_INT_ST_S 0 + +#define I2S_INT_ENA_REG(i) (REG_I2S_BASE(i) + 0x0014) +/* I2S_OUT_TOTAL_EOF_INT_ENA : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_out_total_eof_int interrupt*/ +#define I2S_OUT_TOTAL_EOF_INT_ENA (BIT(16)) +#define I2S_OUT_TOTAL_EOF_INT_ENA_M (BIT(16)) +#define I2S_OUT_TOTAL_EOF_INT_ENA_V 0x1 +#define I2S_OUT_TOTAL_EOF_INT_ENA_S 16 +/* I2S_IN_DSCR_EMPTY_INT_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_in_dscr_empty_int interrupt*/ +#define I2S_IN_DSCR_EMPTY_INT_ENA (BIT(15)) +#define I2S_IN_DSCR_EMPTY_INT_ENA_M (BIT(15)) +#define I2S_IN_DSCR_EMPTY_INT_ENA_V 0x1 +#define I2S_IN_DSCR_EMPTY_INT_ENA_S 15 +/* I2S_OUT_DSCR_ERR_INT_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_out_dscr_err_int interrupt*/ +#define I2S_OUT_DSCR_ERR_INT_ENA (BIT(14)) +#define I2S_OUT_DSCR_ERR_INT_ENA_M (BIT(14)) +#define I2S_OUT_DSCR_ERR_INT_ENA_V 0x1 +#define I2S_OUT_DSCR_ERR_INT_ENA_S 14 +/* I2S_IN_DSCR_ERR_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_in_dscr_err_int interrupt*/ +#define I2S_IN_DSCR_ERR_INT_ENA (BIT(13)) +#define I2S_IN_DSCR_ERR_INT_ENA_M (BIT(13)) +#define I2S_IN_DSCR_ERR_INT_ENA_V 0x1 +#define I2S_IN_DSCR_ERR_INT_ENA_S 13 +/* I2S_OUT_EOF_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_out_eof_int interrupt*/ +#define I2S_OUT_EOF_INT_ENA (BIT(12)) +#define I2S_OUT_EOF_INT_ENA_M (BIT(12)) +#define I2S_OUT_EOF_INT_ENA_V 0x1 +#define I2S_OUT_EOF_INT_ENA_S 12 +/* I2S_OUT_DONE_INT_ENA : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_out_done_int interrupt*/ +#define I2S_OUT_DONE_INT_ENA (BIT(11)) +#define I2S_OUT_DONE_INT_ENA_M (BIT(11)) +#define I2S_OUT_DONE_INT_ENA_V 0x1 +#define I2S_OUT_DONE_INT_ENA_S 11 +/* I2S_IN_ERR_EOF_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_IN_ERR_EOF_INT_ENA (BIT(10)) +#define I2S_IN_ERR_EOF_INT_ENA_M (BIT(10)) +#define I2S_IN_ERR_EOF_INT_ENA_V 0x1 +#define I2S_IN_ERR_EOF_INT_ENA_S 10 +/* I2S_IN_SUC_EOF_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_in_suc_eof_int interrupt*/ +#define I2S_IN_SUC_EOF_INT_ENA (BIT(9)) +#define I2S_IN_SUC_EOF_INT_ENA_M (BIT(9)) +#define I2S_IN_SUC_EOF_INT_ENA_V 0x1 +#define I2S_IN_SUC_EOF_INT_ENA_S 9 +/* I2S_IN_DONE_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_in_done_int interrupt*/ +#define I2S_IN_DONE_INT_ENA (BIT(8)) +#define I2S_IN_DONE_INT_ENA_M (BIT(8)) +#define I2S_IN_DONE_INT_ENA_V 0x1 +#define I2S_IN_DONE_INT_ENA_S 8 +/* I2S_TX_HUNG_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_tx_hung_int interrupt*/ +#define I2S_TX_HUNG_INT_ENA (BIT(7)) +#define I2S_TX_HUNG_INT_ENA_M (BIT(7)) +#define I2S_TX_HUNG_INT_ENA_V 0x1 +#define I2S_TX_HUNG_INT_ENA_S 7 +/* I2S_RX_HUNG_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_rx_hung_int interrupt*/ +#define I2S_RX_HUNG_INT_ENA (BIT(6)) +#define I2S_RX_HUNG_INT_ENA_M (BIT(6)) +#define I2S_RX_HUNG_INT_ENA_V 0x1 +#define I2S_RX_HUNG_INT_ENA_S 6 +/* I2S_TX_REMPTY_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_tx_rempty_int interrupt*/ +#define I2S_TX_REMPTY_INT_ENA (BIT(5)) +#define I2S_TX_REMPTY_INT_ENA_M (BIT(5)) +#define I2S_TX_REMPTY_INT_ENA_V 0x1 +#define I2S_TX_REMPTY_INT_ENA_S 5 +/* I2S_TX_WFULL_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_tx_wfull_int interrupt*/ +#define I2S_TX_WFULL_INT_ENA (BIT(4)) +#define I2S_TX_WFULL_INT_ENA_M (BIT(4)) +#define I2S_TX_WFULL_INT_ENA_V 0x1 +#define I2S_TX_WFULL_INT_ENA_S 4 +/* I2S_RX_REMPTY_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_rx_rempty_int interrupt*/ +#define I2S_RX_REMPTY_INT_ENA (BIT(3)) +#define I2S_RX_REMPTY_INT_ENA_M (BIT(3)) +#define I2S_RX_REMPTY_INT_ENA_V 0x1 +#define I2S_RX_REMPTY_INT_ENA_S 3 +/* I2S_RX_WFULL_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_rx_wfull_int interrupt*/ +#define I2S_RX_WFULL_INT_ENA (BIT(2)) +#define I2S_RX_WFULL_INT_ENA_M (BIT(2)) +#define I2S_RX_WFULL_INT_ENA_V 0x1 +#define I2S_RX_WFULL_INT_ENA_S 2 +/* I2S_TX_PUT_DATA_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_tx_put_data_int interrupt*/ +#define I2S_TX_PUT_DATA_INT_ENA (BIT(1)) +#define I2S_TX_PUT_DATA_INT_ENA_M (BIT(1)) +#define I2S_TX_PUT_DATA_INT_ENA_V 0x1 +#define I2S_TX_PUT_DATA_INT_ENA_S 1 +/* I2S_RX_TAKE_DATA_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The interrupt enable bit for the i2s_rx_take_data_int interrupt*/ +#define I2S_RX_TAKE_DATA_INT_ENA (BIT(0)) +#define I2S_RX_TAKE_DATA_INT_ENA_M (BIT(0)) +#define I2S_RX_TAKE_DATA_INT_ENA_V 0x1 +#define I2S_RX_TAKE_DATA_INT_ENA_S 0 + +#define I2S_INT_CLR_REG(i) (REG_I2S_BASE(i) + 0x0018) +/* I2S_OUT_TOTAL_EOF_INT_CLR : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_out_total_eof_int interrupt*/ +#define I2S_OUT_TOTAL_EOF_INT_CLR (BIT(16)) +#define I2S_OUT_TOTAL_EOF_INT_CLR_M (BIT(16)) +#define I2S_OUT_TOTAL_EOF_INT_CLR_V 0x1 +#define I2S_OUT_TOTAL_EOF_INT_CLR_S 16 +/* I2S_IN_DSCR_EMPTY_INT_CLR : WO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_in_dscr_empty_int interrupt*/ +#define I2S_IN_DSCR_EMPTY_INT_CLR (BIT(15)) +#define I2S_IN_DSCR_EMPTY_INT_CLR_M (BIT(15)) +#define I2S_IN_DSCR_EMPTY_INT_CLR_V 0x1 +#define I2S_IN_DSCR_EMPTY_INT_CLR_S 15 +/* I2S_OUT_DSCR_ERR_INT_CLR : WO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_out_dscr_err_int interrupt*/ +#define I2S_OUT_DSCR_ERR_INT_CLR (BIT(14)) +#define I2S_OUT_DSCR_ERR_INT_CLR_M (BIT(14)) +#define I2S_OUT_DSCR_ERR_INT_CLR_V 0x1 +#define I2S_OUT_DSCR_ERR_INT_CLR_S 14 +/* I2S_IN_DSCR_ERR_INT_CLR : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_in_dscr_err_int interrupt*/ +#define I2S_IN_DSCR_ERR_INT_CLR (BIT(13)) +#define I2S_IN_DSCR_ERR_INT_CLR_M (BIT(13)) +#define I2S_IN_DSCR_ERR_INT_CLR_V 0x1 +#define I2S_IN_DSCR_ERR_INT_CLR_S 13 +/* I2S_OUT_EOF_INT_CLR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_out_eof_int interrupt*/ +#define I2S_OUT_EOF_INT_CLR (BIT(12)) +#define I2S_OUT_EOF_INT_CLR_M (BIT(12)) +#define I2S_OUT_EOF_INT_CLR_V 0x1 +#define I2S_OUT_EOF_INT_CLR_S 12 +/* I2S_OUT_DONE_INT_CLR : WO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_out_done_int interrupt*/ +#define I2S_OUT_DONE_INT_CLR (BIT(11)) +#define I2S_OUT_DONE_INT_CLR_M (BIT(11)) +#define I2S_OUT_DONE_INT_CLR_V 0x1 +#define I2S_OUT_DONE_INT_CLR_S 11 +/* I2S_IN_ERR_EOF_INT_CLR : WO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_IN_ERR_EOF_INT_CLR (BIT(10)) +#define I2S_IN_ERR_EOF_INT_CLR_M (BIT(10)) +#define I2S_IN_ERR_EOF_INT_CLR_V 0x1 +#define I2S_IN_ERR_EOF_INT_CLR_S 10 +/* I2S_IN_SUC_EOF_INT_CLR : WO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_in_suc_eof_int interrupt*/ +#define I2S_IN_SUC_EOF_INT_CLR (BIT(9)) +#define I2S_IN_SUC_EOF_INT_CLR_M (BIT(9)) +#define I2S_IN_SUC_EOF_INT_CLR_V 0x1 +#define I2S_IN_SUC_EOF_INT_CLR_S 9 +/* I2S_IN_DONE_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_in_done_int interrupt*/ +#define I2S_IN_DONE_INT_CLR (BIT(8)) +#define I2S_IN_DONE_INT_CLR_M (BIT(8)) +#define I2S_IN_DONE_INT_CLR_V 0x1 +#define I2S_IN_DONE_INT_CLR_S 8 +/* I2S_TX_HUNG_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_tx_hung_int interrupt*/ +#define I2S_TX_HUNG_INT_CLR (BIT(7)) +#define I2S_TX_HUNG_INT_CLR_M (BIT(7)) +#define I2S_TX_HUNG_INT_CLR_V 0x1 +#define I2S_TX_HUNG_INT_CLR_S 7 +/* I2S_RX_HUNG_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_rx_hung_int interrupt*/ +#define I2S_RX_HUNG_INT_CLR (BIT(6)) +#define I2S_RX_HUNG_INT_CLR_M (BIT(6)) +#define I2S_RX_HUNG_INT_CLR_V 0x1 +#define I2S_RX_HUNG_INT_CLR_S 6 +/* I2S_TX_REMPTY_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_tx_rempty_int interrupt*/ +#define I2S_TX_REMPTY_INT_CLR (BIT(5)) +#define I2S_TX_REMPTY_INT_CLR_M (BIT(5)) +#define I2S_TX_REMPTY_INT_CLR_V 0x1 +#define I2S_TX_REMPTY_INT_CLR_S 5 +/* I2S_TX_WFULL_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_tx_wfull_int interrupt*/ +#define I2S_TX_WFULL_INT_CLR (BIT(4)) +#define I2S_TX_WFULL_INT_CLR_M (BIT(4)) +#define I2S_TX_WFULL_INT_CLR_V 0x1 +#define I2S_TX_WFULL_INT_CLR_S 4 +/* I2S_RX_REMPTY_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_rx_rempty_int interrupt*/ +#define I2S_RX_REMPTY_INT_CLR (BIT(3)) +#define I2S_RX_REMPTY_INT_CLR_M (BIT(3)) +#define I2S_RX_REMPTY_INT_CLR_V 0x1 +#define I2S_RX_REMPTY_INT_CLR_S 3 +/* I2S_RX_WFULL_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_rx_wfull_int interrupt*/ +#define I2S_RX_WFULL_INT_CLR (BIT(2)) +#define I2S_RX_WFULL_INT_CLR_M (BIT(2)) +#define I2S_RX_WFULL_INT_CLR_V 0x1 +#define I2S_RX_WFULL_INT_CLR_S 2 +/* I2S_PUT_DATA_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_tx_put_data_int interrupt*/ +#define I2S_PUT_DATA_INT_CLR (BIT(1)) +#define I2S_PUT_DATA_INT_CLR_M (BIT(1)) +#define I2S_PUT_DATA_INT_CLR_V 0x1 +#define I2S_PUT_DATA_INT_CLR_S 1 +/* I2S_TAKE_DATA_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: Set this bit to clear the i2s_rx_take_data_int interrupt*/ +#define I2S_TAKE_DATA_INT_CLR (BIT(0)) +#define I2S_TAKE_DATA_INT_CLR_M (BIT(0)) +#define I2S_TAKE_DATA_INT_CLR_V 0x1 +#define I2S_TAKE_DATA_INT_CLR_S 0 + +#define I2S_TIMING_REG(i) (REG_I2S_BASE(i) + 0x001c) +/* I2S_TX_BCK_IN_INV : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: Set this bit to invert BCK signal input to the slave transmitter*/ +#define I2S_TX_BCK_IN_INV (BIT(24)) +#define I2S_TX_BCK_IN_INV_M (BIT(24)) +#define I2S_TX_BCK_IN_INV_V 0x1 +#define I2S_TX_BCK_IN_INV_S 24 +/* I2S_DATA_ENABLE_DELAY : R/W ;bitpos:[23:22] ;default: 2'b0 ; */ +/*description: Number of delay cycles for data valid flag.*/ +#define I2S_DATA_ENABLE_DELAY 0x00000003 +#define I2S_DATA_ENABLE_DELAY_M ((I2S_DATA_ENABLE_DELAY_V)<<(I2S_DATA_ENABLE_DELAY_S)) +#define I2S_DATA_ENABLE_DELAY_V 0x3 +#define I2S_DATA_ENABLE_DELAY_S 22 +/* I2S_RX_DSYNC_SW : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: Set this bit to synchronize signals with the double sync method + into the receiver*/ +#define I2S_RX_DSYNC_SW (BIT(21)) +#define I2S_RX_DSYNC_SW_M (BIT(21)) +#define I2S_RX_DSYNC_SW_V 0x1 +#define I2S_RX_DSYNC_SW_S 21 +/* I2S_TX_DSYNC_SW : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: Set this bit to synchronize signals with the double sync method + into the transmitter*/ +#define I2S_TX_DSYNC_SW (BIT(20)) +#define I2S_TX_DSYNC_SW_M (BIT(20)) +#define I2S_TX_DSYNC_SW_V 0x1 +#define I2S_TX_DSYNC_SW_S 20 +/* I2S_RX_BCK_OUT_DELAY : R/W ;bitpos:[19:18] ;default: 2'b0 ; */ +/*description: Number of delay cycles for BCK out of the receiver*/ +#define I2S_RX_BCK_OUT_DELAY 0x00000003 +#define I2S_RX_BCK_OUT_DELAY_M ((I2S_RX_BCK_OUT_DELAY_V)<<(I2S_RX_BCK_OUT_DELAY_S)) +#define I2S_RX_BCK_OUT_DELAY_V 0x3 +#define I2S_RX_BCK_OUT_DELAY_S 18 +/* I2S_RX_WS_OUT_DELAY : R/W ;bitpos:[17:16] ;default: 2'b0 ; */ +/*description: Number of delay cycles for WS out of the receiver*/ +#define I2S_RX_WS_OUT_DELAY 0x00000003 +#define I2S_RX_WS_OUT_DELAY_M ((I2S_RX_WS_OUT_DELAY_V)<<(I2S_RX_WS_OUT_DELAY_S)) +#define I2S_RX_WS_OUT_DELAY_V 0x3 +#define I2S_RX_WS_OUT_DELAY_S 16 +/* I2S_TX_SD_OUT_DELAY : R/W ;bitpos:[15:14] ;default: 2'b0 ; */ +/*description: Number of delay cycles for SD out of the transmitter*/ +#define I2S_TX_SD_OUT_DELAY 0x00000003 +#define I2S_TX_SD_OUT_DELAY_M ((I2S_TX_SD_OUT_DELAY_V)<<(I2S_TX_SD_OUT_DELAY_S)) +#define I2S_TX_SD_OUT_DELAY_V 0x3 +#define I2S_TX_SD_OUT_DELAY_S 14 +/* I2S_TX_WS_OUT_DELAY : R/W ;bitpos:[13:12] ;default: 2'b0 ; */ +/*description: Number of delay cycles for WS out of the transmitter*/ +#define I2S_TX_WS_OUT_DELAY 0x00000003 +#define I2S_TX_WS_OUT_DELAY_M ((I2S_TX_WS_OUT_DELAY_V)<<(I2S_TX_WS_OUT_DELAY_S)) +#define I2S_TX_WS_OUT_DELAY_V 0x3 +#define I2S_TX_WS_OUT_DELAY_S 12 +/* I2S_TX_BCK_OUT_DELAY : R/W ;bitpos:[11:10] ;default: 2'b0 ; */ +/*description: Number of delay cycles for BCK out of the transmitter*/ +#define I2S_TX_BCK_OUT_DELAY 0x00000003 +#define I2S_TX_BCK_OUT_DELAY_M ((I2S_TX_BCK_OUT_DELAY_V)<<(I2S_TX_BCK_OUT_DELAY_S)) +#define I2S_TX_BCK_OUT_DELAY_V 0x3 +#define I2S_TX_BCK_OUT_DELAY_S 10 +/* I2S_RX_SD_IN_DELAY : R/W ;bitpos:[9:8] ;default: 2'b0 ; */ +/*description: Number of delay cycles for SD into the receiver*/ +#define I2S_RX_SD_IN_DELAY 0x00000003 +#define I2S_RX_SD_IN_DELAY_M ((I2S_RX_SD_IN_DELAY_V)<<(I2S_RX_SD_IN_DELAY_S)) +#define I2S_RX_SD_IN_DELAY_V 0x3 +#define I2S_RX_SD_IN_DELAY_S 8 +/* I2S_RX_WS_IN_DELAY : R/W ;bitpos:[7:6] ;default: 2'b0 ; */ +/*description: Number of delay cycles for WS into the receiver*/ +#define I2S_RX_WS_IN_DELAY 0x00000003 +#define I2S_RX_WS_IN_DELAY_M ((I2S_RX_WS_IN_DELAY_V)<<(I2S_RX_WS_IN_DELAY_S)) +#define I2S_RX_WS_IN_DELAY_V 0x3 +#define I2S_RX_WS_IN_DELAY_S 6 +/* I2S_RX_BCK_IN_DELAY : R/W ;bitpos:[5:4] ;default: 2'b0 ; */ +/*description: Number of delay cycles for BCK into the receiver*/ +#define I2S_RX_BCK_IN_DELAY 0x00000003 +#define I2S_RX_BCK_IN_DELAY_M ((I2S_RX_BCK_IN_DELAY_V)<<(I2S_RX_BCK_IN_DELAY_S)) +#define I2S_RX_BCK_IN_DELAY_V 0x3 +#define I2S_RX_BCK_IN_DELAY_S 4 +/* I2S_TX_WS_IN_DELAY : R/W ;bitpos:[3:2] ;default: 2'b0 ; */ +/*description: Number of delay cycles for WS into the transmitter*/ +#define I2S_TX_WS_IN_DELAY 0x00000003 +#define I2S_TX_WS_IN_DELAY_M ((I2S_TX_WS_IN_DELAY_V)<<(I2S_TX_WS_IN_DELAY_S)) +#define I2S_TX_WS_IN_DELAY_V 0x3 +#define I2S_TX_WS_IN_DELAY_S 2 +/* I2S_TX_BCK_IN_DELAY : R/W ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: Number of delay cycles for BCK into the transmitter*/ +#define I2S_TX_BCK_IN_DELAY 0x00000003 +#define I2S_TX_BCK_IN_DELAY_M ((I2S_TX_BCK_IN_DELAY_V)<<(I2S_TX_BCK_IN_DELAY_S)) +#define I2S_TX_BCK_IN_DELAY_V 0x3 +#define I2S_TX_BCK_IN_DELAY_S 0 + +#define I2S_FIFO_CONF_REG(i) (REG_I2S_BASE(i) + 0x0020) +/* I2S_TX_24MSB_EN : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: Only useful in tx 24bit mode. 1: the high 24 bits are effective + in i2s fifo 0: the low 24 bits are effective in i2s fifo*/ +#define I2S_TX_24MSB_EN (BIT(23)) +#define I2S_TX_24MSB_EN_M (BIT(23)) +#define I2S_TX_24MSB_EN_V 0x1 +#define I2S_TX_24MSB_EN_S 23 +/* I2S_RX_24MSB_EN : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: Only useful in rx 24bit mode. 1: the high 24 bits are effective + in i2s fifo 0: the low 24 bits are effective in i2s fifo*/ +#define I2S_RX_24MSB_EN (BIT(22)) +#define I2S_RX_24MSB_EN_M (BIT(22)) +#define I2S_RX_24MSB_EN_V 0x1 +#define I2S_RX_24MSB_EN_S 22 +/* I2S_RX_FIFO_SYNC : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: force write back rx data to memory*/ +#define I2S_RX_FIFO_SYNC (BIT(21)) +#define I2S_RX_FIFO_SYNC_M (BIT(21)) +#define I2S_RX_FIFO_SYNC_V 0x1 +#define I2S_RX_FIFO_SYNC_S 21 +/* I2S_RX_FIFO_MOD_FORCE_EN : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: The bit should always be set to 1*/ +#define I2S_RX_FIFO_MOD_FORCE_EN (BIT(20)) +#define I2S_RX_FIFO_MOD_FORCE_EN_M (BIT(20)) +#define I2S_RX_FIFO_MOD_FORCE_EN_V 0x1 +#define I2S_RX_FIFO_MOD_FORCE_EN_S 20 +/* I2S_TX_FIFO_MOD_FORCE_EN : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: The bit should always be set to 1*/ +#define I2S_TX_FIFO_MOD_FORCE_EN (BIT(19)) +#define I2S_TX_FIFO_MOD_FORCE_EN_M (BIT(19)) +#define I2S_TX_FIFO_MOD_FORCE_EN_V 0x1 +#define I2S_TX_FIFO_MOD_FORCE_EN_S 19 +/* I2S_RX_FIFO_MOD : R/W ;bitpos:[18:16] ;default: 3'b0 ; */ +/*description: Receiver FIFO mode configuration bits*/ +#define I2S_RX_FIFO_MOD 0x00000007 +#define I2S_RX_FIFO_MOD_M ((I2S_RX_FIFO_MOD_V)<<(I2S_RX_FIFO_MOD_S)) +#define I2S_RX_FIFO_MOD_V 0x7 +#define I2S_RX_FIFO_MOD_S 16 +/* I2S_TX_FIFO_MOD : R/W ;bitpos:[15:13] ;default: 3'b0 ; */ +/*description: Transmitter FIFO mode configuration bits*/ +#define I2S_TX_FIFO_MOD 0x00000007 +#define I2S_TX_FIFO_MOD_M ((I2S_TX_FIFO_MOD_V)<<(I2S_TX_FIFO_MOD_S)) +#define I2S_TX_FIFO_MOD_V 0x7 +#define I2S_TX_FIFO_MOD_S 13 +/* I2S_DSCR_EN : R/W ;bitpos:[12] ;default: 1'd1 ; */ +/*description: Set this bit to enable I2S DMA mode*/ +#define I2S_DSCR_EN (BIT(12)) +#define I2S_DSCR_EN_M (BIT(12)) +#define I2S_DSCR_EN_V 0x1 +#define I2S_DSCR_EN_S 12 +/* I2S_TX_DATA_NUM : R/W ;bitpos:[11:6] ;default: 6'd32 ; */ +/*description: Threshold of data length in transmitter FIFO*/ +#define I2S_TX_DATA_NUM 0x0000003F +#define I2S_TX_DATA_NUM_M ((I2S_TX_DATA_NUM_V)<<(I2S_TX_DATA_NUM_S)) +#define I2S_TX_DATA_NUM_V 0x3F +#define I2S_TX_DATA_NUM_S 6 +/* I2S_RX_DATA_NUM : R/W ;bitpos:[5:0] ;default: 6'd32 ; */ +/*description: Threshold of data length in receiver FIFO*/ +#define I2S_RX_DATA_NUM 0x0000003F +#define I2S_RX_DATA_NUM_M ((I2S_RX_DATA_NUM_V)<<(I2S_RX_DATA_NUM_S)) +#define I2S_RX_DATA_NUM_V 0x3F +#define I2S_RX_DATA_NUM_S 0 + +#define I2S_RXEOF_NUM_REG(i) (REG_I2S_BASE(i) + 0x0024) +/* I2S_RX_EOF_NUM : R/W ;bitpos:[31:0] ;default: 32'd64 ; */ +/*description: the length of data to be received. It will trigger i2s_in_suc_eof_int.*/ +#define I2S_RX_EOF_NUM 0xFFFFFFFF +#define I2S_RX_EOF_NUM_M ((I2S_RX_EOF_NUM_V)<<(I2S_RX_EOF_NUM_S)) +#define I2S_RX_EOF_NUM_V 0xFFFFFFFF +#define I2S_RX_EOF_NUM_S 0 + +#define I2S_CONF_SIGLE_DATA_REG(i) (REG_I2S_BASE(i) + 0x0028) +/* I2S_SIGLE_DATA : R/W ;bitpos:[31:0] ;default: 32'd0 ; */ +/*description: the right channel or left channel put out constant value stored + in this register according to tx_chan_mod and reg_tx_msb_right*/ +#define I2S_SIGLE_DATA 0xFFFFFFFF +#define I2S_SIGLE_DATA_M ((I2S_SIGLE_DATA_V)<<(I2S_SIGLE_DATA_S)) +#define I2S_SIGLE_DATA_V 0xFFFFFFFF +#define I2S_SIGLE_DATA_S 0 + +#define I2S_CONF_CHAN_REG(i) (REG_I2S_BASE(i) + 0x002c) +/* I2S_RX_CHAN_MOD : R/W ;bitpos:[4:3] ;default: 2'b0 ; */ +/*description: I2S receiver channel mode configuration bits.*/ +#define I2S_RX_CHAN_MOD 0x00000003 +#define I2S_RX_CHAN_MOD_M ((I2S_RX_CHAN_MOD_V)<<(I2S_RX_CHAN_MOD_S)) +#define I2S_RX_CHAN_MOD_V 0x3 +#define I2S_RX_CHAN_MOD_S 3 +/* I2S_TX_CHAN_MOD : R/W ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: I2S transmitter channel mode configuration bits.*/ +#define I2S_TX_CHAN_MOD 0x00000007 +#define I2S_TX_CHAN_MOD_M ((I2S_TX_CHAN_MOD_V)<<(I2S_TX_CHAN_MOD_S)) +#define I2S_TX_CHAN_MOD_V 0x7 +#define I2S_TX_CHAN_MOD_S 0 + +#define I2S_OUT_LINK_REG(i) (REG_I2S_BASE(i) + 0x0030) +/* I2S_OUTLINK_PARK : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define I2S_OUTLINK_PARK (BIT(31)) +#define I2S_OUTLINK_PARK_M (BIT(31)) +#define I2S_OUTLINK_PARK_V 0x1 +#define I2S_OUTLINK_PARK_S 31 +/* I2S_OUTLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: Set this bit to restart outlink descriptor*/ +#define I2S_OUTLINK_RESTART (BIT(30)) +#define I2S_OUTLINK_RESTART_M (BIT(30)) +#define I2S_OUTLINK_RESTART_V 0x1 +#define I2S_OUTLINK_RESTART_S 30 +/* I2S_OUTLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: Set this bit to start outlink descriptor*/ +#define I2S_OUTLINK_START (BIT(29)) +#define I2S_OUTLINK_START_M (BIT(29)) +#define I2S_OUTLINK_START_V 0x1 +#define I2S_OUTLINK_START_S 29 +/* I2S_OUTLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: Set this bit to stop outlink descriptor*/ +#define I2S_OUTLINK_STOP (BIT(28)) +#define I2S_OUTLINK_STOP_M (BIT(28)) +#define I2S_OUTLINK_STOP_V 0x1 +#define I2S_OUTLINK_STOP_S 28 +/* I2S_OUTLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: The address of first outlink descriptor*/ +#define I2S_OUTLINK_ADDR 0x000FFFFF +#define I2S_OUTLINK_ADDR_M ((I2S_OUTLINK_ADDR_V)<<(I2S_OUTLINK_ADDR_S)) +#define I2S_OUTLINK_ADDR_V 0xFFFFF +#define I2S_OUTLINK_ADDR_S 0 + +#define I2S_IN_LINK_REG(i) (REG_I2S_BASE(i) + 0x0034) +/* I2S_INLINK_PARK : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define I2S_INLINK_PARK (BIT(31)) +#define I2S_INLINK_PARK_M (BIT(31)) +#define I2S_INLINK_PARK_V 0x1 +#define I2S_INLINK_PARK_S 31 +/* I2S_INLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: Set this bit to restart inlink descriptor*/ +#define I2S_INLINK_RESTART (BIT(30)) +#define I2S_INLINK_RESTART_M (BIT(30)) +#define I2S_INLINK_RESTART_V 0x1 +#define I2S_INLINK_RESTART_S 30 +/* I2S_INLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: Set this bit to start inlink descriptor*/ +#define I2S_INLINK_START (BIT(29)) +#define I2S_INLINK_START_M (BIT(29)) +#define I2S_INLINK_START_V 0x1 +#define I2S_INLINK_START_S 29 +/* I2S_INLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: Set this bit to stop inlink descriptor*/ +#define I2S_INLINK_STOP (BIT(28)) +#define I2S_INLINK_STOP_M (BIT(28)) +#define I2S_INLINK_STOP_V 0x1 +#define I2S_INLINK_STOP_S 28 +/* I2S_INLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: The address of first inlink descriptor*/ +#define I2S_INLINK_ADDR 0x000FFFFF +#define I2S_INLINK_ADDR_M ((I2S_INLINK_ADDR_V)<<(I2S_INLINK_ADDR_S)) +#define I2S_INLINK_ADDR_V 0xFFFFF +#define I2S_INLINK_ADDR_S 0 + +#define I2S_OUT_EOF_DES_ADDR_REG(i) (REG_I2S_BASE(i) + 0x0038) +/* I2S_OUT_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: The address of outlink descriptor that produces EOF*/ +#define I2S_OUT_EOF_DES_ADDR 0xFFFFFFFF +#define I2S_OUT_EOF_DES_ADDR_M ((I2S_OUT_EOF_DES_ADDR_V)<<(I2S_OUT_EOF_DES_ADDR_S)) +#define I2S_OUT_EOF_DES_ADDR_V 0xFFFFFFFF +#define I2S_OUT_EOF_DES_ADDR_S 0 + +#define I2S_IN_EOF_DES_ADDR_REG(i) (REG_I2S_BASE(i) + 0x003c) +/* I2S_IN_SUC_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: The address of inlink descriptor that produces EOF*/ +#define I2S_IN_SUC_EOF_DES_ADDR 0xFFFFFFFF +#define I2S_IN_SUC_EOF_DES_ADDR_M ((I2S_IN_SUC_EOF_DES_ADDR_V)<<(I2S_IN_SUC_EOF_DES_ADDR_S)) +#define I2S_IN_SUC_EOF_DES_ADDR_V 0xFFFFFFFF +#define I2S_IN_SUC_EOF_DES_ADDR_S 0 + +#define I2S_OUT_EOF_BFR_DES_ADDR_REG(i) (REG_I2S_BASE(i) + 0x0040) +/* I2S_OUT_EOF_BFR_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: The address of buffer relative to the outlink descriptor that produces EOF*/ +#define I2S_OUT_EOF_BFR_DES_ADDR 0xFFFFFFFF +#define I2S_OUT_EOF_BFR_DES_ADDR_M ((I2S_OUT_EOF_BFR_DES_ADDR_V)<<(I2S_OUT_EOF_BFR_DES_ADDR_S)) +#define I2S_OUT_EOF_BFR_DES_ADDR_V 0xFFFFFFFF +#define I2S_OUT_EOF_BFR_DES_ADDR_S 0 + +#define I2S_AHB_TEST_REG(i) (REG_I2S_BASE(i) + 0x0044) +/* I2S_AHB_TESTADDR : R/W ;bitpos:[5:4] ;default: 2'b0 ; */ +/*description: */ +#define I2S_AHB_TESTADDR 0x00000003 +#define I2S_AHB_TESTADDR_M ((I2S_AHB_TESTADDR_V)<<(I2S_AHB_TESTADDR_S)) +#define I2S_AHB_TESTADDR_V 0x3 +#define I2S_AHB_TESTADDR_S 4 +/* I2S_AHB_TESTMODE : R/W ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: */ +#define I2S_AHB_TESTMODE 0x00000007 +#define I2S_AHB_TESTMODE_M ((I2S_AHB_TESTMODE_V)<<(I2S_AHB_TESTMODE_S)) +#define I2S_AHB_TESTMODE_V 0x7 +#define I2S_AHB_TESTMODE_S 0 + +#define I2S_INLINK_DSCR_REG(i) (REG_I2S_BASE(i) + 0x0048) +/* I2S_INLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The address of current inlink descriptor*/ +#define I2S_INLINK_DSCR 0xFFFFFFFF +#define I2S_INLINK_DSCR_M ((I2S_INLINK_DSCR_V)<<(I2S_INLINK_DSCR_S)) +#define I2S_INLINK_DSCR_V 0xFFFFFFFF +#define I2S_INLINK_DSCR_S 0 + +#define I2S_INLINK_DSCR_BF0_REG(i) (REG_I2S_BASE(i) + 0x004C) +/* I2S_INLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The address of next inlink descriptor*/ +#define I2S_INLINK_DSCR_BF0 0xFFFFFFFF +#define I2S_INLINK_DSCR_BF0_M ((I2S_INLINK_DSCR_BF0_V)<<(I2S_INLINK_DSCR_BF0_S)) +#define I2S_INLINK_DSCR_BF0_V 0xFFFFFFFF +#define I2S_INLINK_DSCR_BF0_S 0 + +#define I2S_INLINK_DSCR_BF1_REG(i) (REG_I2S_BASE(i) + 0x0050) +/* I2S_INLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The address of next inlink data buffer*/ +#define I2S_INLINK_DSCR_BF1 0xFFFFFFFF +#define I2S_INLINK_DSCR_BF1_M ((I2S_INLINK_DSCR_BF1_V)<<(I2S_INLINK_DSCR_BF1_S)) +#define I2S_INLINK_DSCR_BF1_V 0xFFFFFFFF +#define I2S_INLINK_DSCR_BF1_S 0 + +#define I2S_OUTLINK_DSCR_REG(i) (REG_I2S_BASE(i) + 0x0054) +/* I2S_OUTLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The address of current outlink descriptor*/ +#define I2S_OUTLINK_DSCR 0xFFFFFFFF +#define I2S_OUTLINK_DSCR_M ((I2S_OUTLINK_DSCR_V)<<(I2S_OUTLINK_DSCR_S)) +#define I2S_OUTLINK_DSCR_V 0xFFFFFFFF +#define I2S_OUTLINK_DSCR_S 0 + +#define I2S_OUTLINK_DSCR_BF0_REG(i) (REG_I2S_BASE(i) + 0x0058) +/* I2S_OUTLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The address of next outlink descriptor*/ +#define I2S_OUTLINK_DSCR_BF0 0xFFFFFFFF +#define I2S_OUTLINK_DSCR_BF0_M ((I2S_OUTLINK_DSCR_BF0_V)<<(I2S_OUTLINK_DSCR_BF0_S)) +#define I2S_OUTLINK_DSCR_BF0_V 0xFFFFFFFF +#define I2S_OUTLINK_DSCR_BF0_S 0 + +#define I2S_OUTLINK_DSCR_BF1_REG(i) (REG_I2S_BASE(i) + 0x005C) +/* I2S_OUTLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The address of next outlink data buffer*/ +#define I2S_OUTLINK_DSCR_BF1 0xFFFFFFFF +#define I2S_OUTLINK_DSCR_BF1_M ((I2S_OUTLINK_DSCR_BF1_V)<<(I2S_OUTLINK_DSCR_BF1_S)) +#define I2S_OUTLINK_DSCR_BF1_V 0xFFFFFFFF +#define I2S_OUTLINK_DSCR_BF1_S 0 + +#define I2S_LC_CONF_REG(i) (REG_I2S_BASE(i) + 0x0060) +/* I2S_MEM_TRANS_EN : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_MEM_TRANS_EN (BIT(13)) +#define I2S_MEM_TRANS_EN_M (BIT(13)) +#define I2S_MEM_TRANS_EN_V 0x1 +#define I2S_MEM_TRANS_EN_S 13 +/* I2S_CHECK_OWNER : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: Set this bit to enable check owner bit by hardware*/ +#define I2S_CHECK_OWNER (BIT(12)) +#define I2S_CHECK_OWNER_M (BIT(12)) +#define I2S_CHECK_OWNER_V 0x1 +#define I2S_CHECK_OWNER_S 12 +/* I2S_OUT_DATA_BURST_EN : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: Transmitter data transfer mode configuration bit. 1: to prepare + out data with burst mode 0: to prepare out data with byte mode*/ +#define I2S_OUT_DATA_BURST_EN (BIT(11)) +#define I2S_OUT_DATA_BURST_EN_M (BIT(11)) +#define I2S_OUT_DATA_BURST_EN_V 0x1 +#define I2S_OUT_DATA_BURST_EN_S 11 +/* I2S_INDSCR_BURST_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: DMA inlink descriptor transfer mode configuration bit. 1: to + prepare inlink descriptor with burst mode 0: to prepare inlink descriptor with byte mode*/ +#define I2S_INDSCR_BURST_EN (BIT(10)) +#define I2S_INDSCR_BURST_EN_M (BIT(10)) +#define I2S_INDSCR_BURST_EN_V 0x1 +#define I2S_INDSCR_BURST_EN_S 10 +/* I2S_OUTDSCR_BURST_EN : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: DMA outlink descriptor transfer mode configuration bit. 1: to + prepare outlink descriptor with burst mode 0: to prepare outlink descriptor with byte mode*/ +#define I2S_OUTDSCR_BURST_EN (BIT(9)) +#define I2S_OUTDSCR_BURST_EN_M (BIT(9)) +#define I2S_OUTDSCR_BURST_EN_V 0x1 +#define I2S_OUTDSCR_BURST_EN_S 9 +/* I2S_OUT_EOF_MODE : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: DMA out EOF flag generation mode . 1: when dma has popped all + data from the FIFO 0:when ahb has pushed all data to the FIFO*/ +#define I2S_OUT_EOF_MODE (BIT(8)) +#define I2S_OUT_EOF_MODE_M (BIT(8)) +#define I2S_OUT_EOF_MODE_V 0x1 +#define I2S_OUT_EOF_MODE_S 8 +/* I2S_OUT_NO_RESTART_CLR : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_OUT_NO_RESTART_CLR (BIT(7)) +#define I2S_OUT_NO_RESTART_CLR_M (BIT(7)) +#define I2S_OUT_NO_RESTART_CLR_V 0x1 +#define I2S_OUT_NO_RESTART_CLR_S 7 +/* I2S_OUT_AUTO_WRBACK : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: Set this bit to enable outlink-written-back automatically when + out buffer is transmitted done.*/ +#define I2S_OUT_AUTO_WRBACK (BIT(6)) +#define I2S_OUT_AUTO_WRBACK_M (BIT(6)) +#define I2S_OUT_AUTO_WRBACK_V 0x1 +#define I2S_OUT_AUTO_WRBACK_S 6 +/* I2S_IN_LOOP_TEST : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: Set this bit to loop test outlink*/ +#define I2S_IN_LOOP_TEST (BIT(5)) +#define I2S_IN_LOOP_TEST_M (BIT(5)) +#define I2S_IN_LOOP_TEST_V 0x1 +#define I2S_IN_LOOP_TEST_S 5 +/* I2S_OUT_LOOP_TEST : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: Set this bit to loop test inlink*/ +#define I2S_OUT_LOOP_TEST (BIT(4)) +#define I2S_OUT_LOOP_TEST_M (BIT(4)) +#define I2S_OUT_LOOP_TEST_V 0x1 +#define I2S_OUT_LOOP_TEST_S 4 +/* I2S_AHBM_RST : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: Set this bit to reset ahb interface of DMA*/ +#define I2S_AHBM_RST (BIT(3)) +#define I2S_AHBM_RST_M (BIT(3)) +#define I2S_AHBM_RST_V 0x1 +#define I2S_AHBM_RST_S 3 +/* I2S_AHBM_FIFO_RST : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: Set this bit to reset ahb interface cmdFIFO of DMA*/ +#define I2S_AHBM_FIFO_RST (BIT(2)) +#define I2S_AHBM_FIFO_RST_M (BIT(2)) +#define I2S_AHBM_FIFO_RST_V 0x1 +#define I2S_AHBM_FIFO_RST_S 2 +/* I2S_OUT_RST : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: Set this bit to reset out dma FSM*/ +#define I2S_OUT_RST (BIT(1)) +#define I2S_OUT_RST_M (BIT(1)) +#define I2S_OUT_RST_V 0x1 +#define I2S_OUT_RST_S 1 +/* I2S_IN_RST : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: Set this bit to reset in dma FSM*/ +#define I2S_IN_RST (BIT(0)) +#define I2S_IN_RST_M (BIT(0)) +#define I2S_IN_RST_V 0x1 +#define I2S_IN_RST_S 0 + +#define I2S_OUTFIFO_PUSH_REG(i) (REG_I2S_BASE(i) + 0x0064) +/* I2S_OUTFIFO_PUSH : R/W ;bitpos:[16] ;default: 1'h0 ; */ +/*description: */ +#define I2S_OUTFIFO_PUSH (BIT(16)) +#define I2S_OUTFIFO_PUSH_M (BIT(16)) +#define I2S_OUTFIFO_PUSH_V 0x1 +#define I2S_OUTFIFO_PUSH_S 16 +/* I2S_OUTFIFO_WDATA : R/W ;bitpos:[8:0] ;default: 9'h0 ; */ +/*description: */ +#define I2S_OUTFIFO_WDATA 0x000001FF +#define I2S_OUTFIFO_WDATA_M ((I2S_OUTFIFO_WDATA_V)<<(I2S_OUTFIFO_WDATA_S)) +#define I2S_OUTFIFO_WDATA_V 0x1FF +#define I2S_OUTFIFO_WDATA_S 0 + +#define I2S_INFIFO_POP_REG(i) (REG_I2S_BASE(i) + 0x0068) +/* I2S_INFIFO_POP : R/W ;bitpos:[16] ;default: 1'h0 ; */ +/*description: */ +#define I2S_INFIFO_POP (BIT(16)) +#define I2S_INFIFO_POP_M (BIT(16)) +#define I2S_INFIFO_POP_V 0x1 +#define I2S_INFIFO_POP_S 16 +/* I2S_INFIFO_RDATA : RO ;bitpos:[11:0] ;default: 12'h0 ; */ +/*description: */ +#define I2S_INFIFO_RDATA 0x00000FFF +#define I2S_INFIFO_RDATA_M ((I2S_INFIFO_RDATA_V)<<(I2S_INFIFO_RDATA_S)) +#define I2S_INFIFO_RDATA_V 0xFFF +#define I2S_INFIFO_RDATA_S 0 + +#define I2S_LC_STATE0_REG(i) (REG_I2S_BASE(i) + 0x006C) +/* I2S_OUT_EMPTY : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: DMA transmitter status register*/ +#define I2S_OUT_EMPTY (BIT(31)) +#define I2S_OUT_EMPTY_M (BIT(31)) +#define I2S_OUT_EMPTY_V 0x1 +#define I2S_OUT_EMPTY_S 31 +/* I2S_OUT_FULL : RO ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define I2S_OUT_FULL (BIT(30)) +#define I2S_OUT_FULL_M (BIT(30)) +#define I2S_OUT_FULL_V 0x1 +#define I2S_OUT_FULL_S 30 +/* I2S_OUTFIFO_CNT : RO ;bitpos:[29:23] ;default: 7'b0 ; */ +/*description: */ +#define I2S_OUTFIFO_CNT 0x0000007F +#define I2S_OUTFIFO_CNT_M ((I2S_OUTFIFO_CNT_V)<<(I2S_OUTFIFO_CNT_S)) +#define I2S_OUTFIFO_CNT_V 0x7F +#define I2S_OUTFIFO_CNT_S 23 +/* I2S_OUT_STATE : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: */ +#define I2S_OUT_STATE 0x00000007 +#define I2S_OUT_STATE_M ((I2S_OUT_STATE_V)<<(I2S_OUT_STATE_S)) +#define I2S_OUT_STATE_V 0x7 +#define I2S_OUT_STATE_S 20 +/* I2S_OUT_DSCR_STATE : RO ;bitpos:[19:18] ;default: 2'b0 ; */ +/*description: */ +#define I2S_OUT_DSCR_STATE 0x00000003 +#define I2S_OUT_DSCR_STATE_M ((I2S_OUT_DSCR_STATE_V)<<(I2S_OUT_DSCR_STATE_S)) +#define I2S_OUT_DSCR_STATE_V 0x3 +#define I2S_OUT_DSCR_STATE_S 18 +/* I2S_OUTLINK_DSCR_ADDR : RO ;bitpos:[17:0] ;default: 18'h0 ; */ +/*description: */ +#define I2S_OUTLINK_DSCR_ADDR 0x0003FFFF +#define I2S_OUTLINK_DSCR_ADDR_M ((I2S_OUTLINK_DSCR_ADDR_V)<<(I2S_OUTLINK_DSCR_ADDR_S)) +#define I2S_OUTLINK_DSCR_ADDR_V 0x3FFFF +#define I2S_OUTLINK_DSCR_ADDR_S 0 + +#define I2S_LC_STATE1_REG(i) (REG_I2S_BASE(i) + 0x0070) +/* I2S_IN_EMPTY : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: DMA receiver status register*/ +#define I2S_IN_EMPTY (BIT(31)) +#define I2S_IN_EMPTY_M (BIT(31)) +#define I2S_IN_EMPTY_V 0x1 +#define I2S_IN_EMPTY_S 31 +/* I2S_IN_FULL : RO ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define I2S_IN_FULL (BIT(30)) +#define I2S_IN_FULL_M (BIT(30)) +#define I2S_IN_FULL_V 0x1 +#define I2S_IN_FULL_S 30 +/* I2S_INFIFO_CNT_DEBUG : RO ;bitpos:[29:23] ;default: 7'b0 ; */ +/*description: */ +#define I2S_INFIFO_CNT_DEBUG 0x0000007F +#define I2S_INFIFO_CNT_DEBUG_M ((I2S_INFIFO_CNT_DEBUG_V)<<(I2S_INFIFO_CNT_DEBUG_S)) +#define I2S_INFIFO_CNT_DEBUG_V 0x7F +#define I2S_INFIFO_CNT_DEBUG_S 23 +/* I2S_IN_STATE : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: */ +#define I2S_IN_STATE 0x00000007 +#define I2S_IN_STATE_M ((I2S_IN_STATE_V)<<(I2S_IN_STATE_S)) +#define I2S_IN_STATE_V 0x7 +#define I2S_IN_STATE_S 20 +/* I2S_IN_DSCR_STATE : RO ;bitpos:[19:18] ;default: 2'b0 ; */ +/*description: */ +#define I2S_IN_DSCR_STATE 0x00000003 +#define I2S_IN_DSCR_STATE_M ((I2S_IN_DSCR_STATE_V)<<(I2S_IN_DSCR_STATE_S)) +#define I2S_IN_DSCR_STATE_V 0x3 +#define I2S_IN_DSCR_STATE_S 18 +/* I2S_INLINK_DSCR_ADDR : RO ;bitpos:[17:0] ;default: 18'h0 ; */ +/*description: */ +#define I2S_INLINK_DSCR_ADDR 0x0003FFFF +#define I2S_INLINK_DSCR_ADDR_M ((I2S_INLINK_DSCR_ADDR_V)<<(I2S_INLINK_DSCR_ADDR_S)) +#define I2S_INLINK_DSCR_ADDR_V 0x3FFFF +#define I2S_INLINK_DSCR_ADDR_S 0 + +#define I2S_LC_HUNG_CONF_REG(i) (REG_I2S_BASE(i) + 0x0074) +/* I2S_LC_FIFO_TIMEOUT_ENA : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: The enable bit for FIFO timeout*/ +#define I2S_LC_FIFO_TIMEOUT_ENA (BIT(11)) +#define I2S_LC_FIFO_TIMEOUT_ENA_M (BIT(11)) +#define I2S_LC_FIFO_TIMEOUT_ENA_V 0x1 +#define I2S_LC_FIFO_TIMEOUT_ENA_S 11 +/* I2S_LC_FIFO_TIMEOUT_SHIFT : R/W ;bitpos:[10:8] ;default: 3'b0 ; */ +/*description: The bits are used to scale tick counter threshold. The tick counter + is reset when counter value >= 88000/2^i2s_lc_fifo_timeout_shift*/ +#define I2S_LC_FIFO_TIMEOUT_SHIFT 0x00000007 +#define I2S_LC_FIFO_TIMEOUT_SHIFT_M ((I2S_LC_FIFO_TIMEOUT_SHIFT_V)<<(I2S_LC_FIFO_TIMEOUT_SHIFT_S)) +#define I2S_LC_FIFO_TIMEOUT_SHIFT_V 0x7 +#define I2S_LC_FIFO_TIMEOUT_SHIFT_S 8 +/* I2S_LC_FIFO_TIMEOUT : R/W ;bitpos:[7:0] ;default: 8'h10 ; */ +/*description: the i2s_tx_hung_int interrupt or the i2s_rx_hung_int interrupt + will be triggered when fifo hung counter is equal to this value*/ +#define I2S_LC_FIFO_TIMEOUT 0x000000FF +#define I2S_LC_FIFO_TIMEOUT_M ((I2S_LC_FIFO_TIMEOUT_V)<<(I2S_LC_FIFO_TIMEOUT_S)) +#define I2S_LC_FIFO_TIMEOUT_V 0xFF +#define I2S_LC_FIFO_TIMEOUT_S 0 + +#define I2S_CVSD_CONF0_REG(i) (REG_I2S_BASE(i) + 0x0080) +/* I2S_CVSD_Y_MIN : R/W ;bitpos:[31:16] ;default: 16'h8000 ; */ +/*description: don't use*/ +#define I2S_CVSD_Y_MIN 0x0000FFFF +#define I2S_CVSD_Y_MIN_M ((I2S_CVSD_Y_MIN_V)<<(I2S_CVSD_Y_MIN_S)) +#define I2S_CVSD_Y_MIN_V 0xFFFF +#define I2S_CVSD_Y_MIN_S 16 +/* I2S_CVSD_Y_MAX : R/W ;bitpos:[15:0] ;default: 16'h7fff ; */ +/*description: don't use*/ +#define I2S_CVSD_Y_MAX 0x0000FFFF +#define I2S_CVSD_Y_MAX_M ((I2S_CVSD_Y_MAX_V)<<(I2S_CVSD_Y_MAX_S)) +#define I2S_CVSD_Y_MAX_V 0xFFFF +#define I2S_CVSD_Y_MAX_S 0 + +#define I2S_CVSD_CONF1_REG(i) (REG_I2S_BASE(i) + 0x0084) +/* I2S_CVSD_SIGMA_MIN : R/W ;bitpos:[31:16] ;default: 16'd10 ; */ +/*description: don't use*/ +#define I2S_CVSD_SIGMA_MIN 0x0000FFFF +#define I2S_CVSD_SIGMA_MIN_M ((I2S_CVSD_SIGMA_MIN_V)<<(I2S_CVSD_SIGMA_MIN_S)) +#define I2S_CVSD_SIGMA_MIN_V 0xFFFF +#define I2S_CVSD_SIGMA_MIN_S 16 +/* I2S_CVSD_SIGMA_MAX : R/W ;bitpos:[15:0] ;default: 16'd1280 ; */ +/*description: don't use*/ +#define I2S_CVSD_SIGMA_MAX 0x0000FFFF +#define I2S_CVSD_SIGMA_MAX_M ((I2S_CVSD_SIGMA_MAX_V)<<(I2S_CVSD_SIGMA_MAX_S)) +#define I2S_CVSD_SIGMA_MAX_V 0xFFFF +#define I2S_CVSD_SIGMA_MAX_S 0 + +#define I2S_CVSD_CONF2_REG(i) (REG_I2S_BASE(i) + 0x0088) +/* I2S_CVSD_H : R/W ;bitpos:[18:16] ;default: 3'd5 ; */ +/*description: don't use*/ +#define I2S_CVSD_H 0x00000007 +#define I2S_CVSD_H_M ((I2S_CVSD_H_V)<<(I2S_CVSD_H_S)) +#define I2S_CVSD_H_V 0x7 +#define I2S_CVSD_H_S 16 +/* I2S_CVSD_BETA : R/W ;bitpos:[15:6] ;default: 10'd10 ; */ +/*description: don't use*/ +#define I2S_CVSD_BETA 0x000003FF +#define I2S_CVSD_BETA_M ((I2S_CVSD_BETA_V)<<(I2S_CVSD_BETA_S)) +#define I2S_CVSD_BETA_V 0x3FF +#define I2S_CVSD_BETA_S 6 +/* I2S_CVSD_J : R/W ;bitpos:[5:3] ;default: 3'h4 ; */ +/*description: don't use*/ +#define I2S_CVSD_J 0x00000007 +#define I2S_CVSD_J_M ((I2S_CVSD_J_V)<<(I2S_CVSD_J_S)) +#define I2S_CVSD_J_V 0x7 +#define I2S_CVSD_J_S 3 +/* I2S_CVSD_K : R/W ;bitpos:[2:0] ;default: 3'h4 ; */ +/*description: don't use*/ +#define I2S_CVSD_K 0x00000007 +#define I2S_CVSD_K_M ((I2S_CVSD_K_V)<<(I2S_CVSD_K_S)) +#define I2S_CVSD_K_V 0x7 +#define I2S_CVSD_K_S 0 + +#define I2S_PLC_CONF0_REG(i) (REG_I2S_BASE(i) + 0x008C) +/* I2S_N_MIN_ERR : R/W ;bitpos:[27:25] ;default: 3'd4 ; */ +/*description: don't use*/ +#define I2S_N_MIN_ERR 0x00000007 +#define I2S_N_MIN_ERR_M ((I2S_N_MIN_ERR_V)<<(I2S_N_MIN_ERR_S)) +#define I2S_N_MIN_ERR_V 0x7 +#define I2S_N_MIN_ERR_S 25 +/* I2S_PACK_LEN_8K : R/W ;bitpos:[24:20] ;default: 5'd10 ; */ +/*description: don't use*/ +#define I2S_PACK_LEN_8K 0x0000001F +#define I2S_PACK_LEN_8K_M ((I2S_PACK_LEN_8K_V)<<(I2S_PACK_LEN_8K_S)) +#define I2S_PACK_LEN_8K_V 0x1F +#define I2S_PACK_LEN_8K_S 20 +/* I2S_MAX_SLIDE_SAMPLE : R/W ;bitpos:[19:12] ;default: 8'd128 ; */ +/*description: don't use*/ +#define I2S_MAX_SLIDE_SAMPLE 0x000000FF +#define I2S_MAX_SLIDE_SAMPLE_M ((I2S_MAX_SLIDE_SAMPLE_V)<<(I2S_MAX_SLIDE_SAMPLE_S)) +#define I2S_MAX_SLIDE_SAMPLE_V 0xFF +#define I2S_MAX_SLIDE_SAMPLE_S 12 +/* I2S_SHIFT_RATE : R/W ;bitpos:[11:9] ;default: 3'h1 ; */ +/*description: don't use*/ +#define I2S_SHIFT_RATE 0x00000007 +#define I2S_SHIFT_RATE_M ((I2S_SHIFT_RATE_V)<<(I2S_SHIFT_RATE_S)) +#define I2S_SHIFT_RATE_V 0x7 +#define I2S_SHIFT_RATE_S 9 +/* I2S_N_ERR_SEG : R/W ;bitpos:[8:6] ;default: 3'h4 ; */ +/*description: don't use*/ +#define I2S_N_ERR_SEG 0x00000007 +#define I2S_N_ERR_SEG_M ((I2S_N_ERR_SEG_V)<<(I2S_N_ERR_SEG_S)) +#define I2S_N_ERR_SEG_V 0x7 +#define I2S_N_ERR_SEG_S 6 +/* I2S_GOOD_PACK_MAX : R/W ;bitpos:[5:0] ;default: 6'h39 ; */ +/*description: don't use*/ +#define I2S_GOOD_PACK_MAX 0x0000003F +#define I2S_GOOD_PACK_MAX_M ((I2S_GOOD_PACK_MAX_V)<<(I2S_GOOD_PACK_MAX_S)) +#define I2S_GOOD_PACK_MAX_V 0x3F +#define I2S_GOOD_PACK_MAX_S 0 + +#define I2S_PLC_CONF1_REG(i) (REG_I2S_BASE(i) + 0x0090) +/* I2S_SLIDE_WIN_LEN : R/W ;bitpos:[31:24] ;default: 8'd160 ; */ +/*description: don't use*/ +#define I2S_SLIDE_WIN_LEN 0x000000FF +#define I2S_SLIDE_WIN_LEN_M ((I2S_SLIDE_WIN_LEN_V)<<(I2S_SLIDE_WIN_LEN_S)) +#define I2S_SLIDE_WIN_LEN_V 0xFF +#define I2S_SLIDE_WIN_LEN_S 24 +/* I2S_BAD_OLA_WIN2_PARA : R/W ;bitpos:[23:16] ;default: 8'd23 ; */ +/*description: don't use*/ +#define I2S_BAD_OLA_WIN2_PARA 0x000000FF +#define I2S_BAD_OLA_WIN2_PARA_M ((I2S_BAD_OLA_WIN2_PARA_V)<<(I2S_BAD_OLA_WIN2_PARA_S)) +#define I2S_BAD_OLA_WIN2_PARA_V 0xFF +#define I2S_BAD_OLA_WIN2_PARA_S 16 +/* I2S_BAD_OLA_WIN2_PARA_SHIFT : R/W ;bitpos:[15:12] ;default: 4'd8 ; */ +/*description: don't use*/ +#define I2S_BAD_OLA_WIN2_PARA_SHIFT 0x0000000F +#define I2S_BAD_OLA_WIN2_PARA_SHIFT_M ((I2S_BAD_OLA_WIN2_PARA_SHIFT_V)<<(I2S_BAD_OLA_WIN2_PARA_SHIFT_S)) +#define I2S_BAD_OLA_WIN2_PARA_SHIFT_V 0xF +#define I2S_BAD_OLA_WIN2_PARA_SHIFT_S 12 +/* I2S_BAD_CEF_ATTEN_PARA_SHIFT : R/W ;bitpos:[11:8] ;default: 4'd10 ; */ +/*description: don't use*/ +#define I2S_BAD_CEF_ATTEN_PARA_SHIFT 0x0000000F +#define I2S_BAD_CEF_ATTEN_PARA_SHIFT_M ((I2S_BAD_CEF_ATTEN_PARA_SHIFT_V)<<(I2S_BAD_CEF_ATTEN_PARA_SHIFT_S)) +#define I2S_BAD_CEF_ATTEN_PARA_SHIFT_V 0xF +#define I2S_BAD_CEF_ATTEN_PARA_SHIFT_S 8 +/* I2S_BAD_CEF_ATTEN_PARA : R/W ;bitpos:[7:0] ;default: 8'd5 ; */ +/*description: don't use*/ +#define I2S_BAD_CEF_ATTEN_PARA 0x000000FF +#define I2S_BAD_CEF_ATTEN_PARA_M ((I2S_BAD_CEF_ATTEN_PARA_V)<<(I2S_BAD_CEF_ATTEN_PARA_S)) +#define I2S_BAD_CEF_ATTEN_PARA_V 0xFF +#define I2S_BAD_CEF_ATTEN_PARA_S 0 + +#define I2S_PLC_CONF2_REG(i) (REG_I2S_BASE(i) + 0x0094) +/* I2S_MIN_PERIOD : R/W ;bitpos:[6:2] ;default: 5'd10 ; */ +/*description: don't use*/ +#define I2S_MIN_PERIOD 0x0000001F +#define I2S_MIN_PERIOD_M ((I2S_MIN_PERIOD_V)<<(I2S_MIN_PERIOD_S)) +#define I2S_MIN_PERIOD_V 0x1F +#define I2S_MIN_PERIOD_S 2 +/* I2S_CVSD_SEG_MOD : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: don't use*/ +#define I2S_CVSD_SEG_MOD 0x00000003 +#define I2S_CVSD_SEG_MOD_M ((I2S_CVSD_SEG_MOD_V)<<(I2S_CVSD_SEG_MOD_S)) +#define I2S_CVSD_SEG_MOD_V 0x3 +#define I2S_CVSD_SEG_MOD_S 0 + +#define I2S_ESCO_CONF0_REG(i) (REG_I2S_BASE(i) + 0x0098) +/* I2S_PLC2DMA_EN : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_PLC2DMA_EN (BIT(12)) +#define I2S_PLC2DMA_EN_M (BIT(12)) +#define I2S_PLC2DMA_EN_V 0x1 +#define I2S_PLC2DMA_EN_S 12 +/* I2S_PLC_EN : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_PLC_EN (BIT(11)) +#define I2S_PLC_EN_M (BIT(11)) +#define I2S_PLC_EN_V 0x1 +#define I2S_PLC_EN_S 11 +/* I2S_CVSD_DEC_RESET : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_CVSD_DEC_RESET (BIT(10)) +#define I2S_CVSD_DEC_RESET_M (BIT(10)) +#define I2S_CVSD_DEC_RESET_V 0x1 +#define I2S_CVSD_DEC_RESET_S 10 +/* I2S_CVSD_DEC_START : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_CVSD_DEC_START (BIT(9)) +#define I2S_CVSD_DEC_START_M (BIT(9)) +#define I2S_CVSD_DEC_START_V 0x1 +#define I2S_CVSD_DEC_START_S 9 +/* I2S_ESCO_CVSD_INF_EN : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_ESCO_CVSD_INF_EN (BIT(8)) +#define I2S_ESCO_CVSD_INF_EN_M (BIT(8)) +#define I2S_ESCO_CVSD_INF_EN_V 0x1 +#define I2S_ESCO_CVSD_INF_EN_S 8 +/* I2S_ESCO_CVSD_PACK_LEN_8K : R/W ;bitpos:[7:3] ;default: 5'b0 ; */ +/*description: don't use*/ +#define I2S_ESCO_CVSD_PACK_LEN_8K 0x0000001F +#define I2S_ESCO_CVSD_PACK_LEN_8K_M ((I2S_ESCO_CVSD_PACK_LEN_8K_V)<<(I2S_ESCO_CVSD_PACK_LEN_8K_S)) +#define I2S_ESCO_CVSD_PACK_LEN_8K_V 0x1F +#define I2S_ESCO_CVSD_PACK_LEN_8K_S 3 +/* I2S_ESCO_CVSD_DEC_PACK_ERR : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: don't use*/ +#define I2S_ESCO_CVSD_DEC_PACK_ERR (BIT(2)) +#define I2S_ESCO_CVSD_DEC_PACK_ERR_M (BIT(2)) +#define I2S_ESCO_CVSD_DEC_PACK_ERR_V 0x1 +#define I2S_ESCO_CVSD_DEC_PACK_ERR_S 2 +/* I2S_ESCO_CHAN_MOD : R/W ;bitpos:[1] ;default: 1'd0 ; */ +/*description: don't use*/ +#define I2S_ESCO_CHAN_MOD (BIT(1)) +#define I2S_ESCO_CHAN_MOD_M (BIT(1)) +#define I2S_ESCO_CHAN_MOD_V 0x1 +#define I2S_ESCO_CHAN_MOD_S 1 +/* I2S_ESCO_EN : R/W ;bitpos:[0] ;default: 1'd0 ; */ +/*description: don't use*/ +#define I2S_ESCO_EN (BIT(0)) +#define I2S_ESCO_EN_M (BIT(0)) +#define I2S_ESCO_EN_V 0x1 +#define I2S_ESCO_EN_S 0 + +#define I2S_SCO_CONF0_REG(i) (REG_I2S_BASE(i) + 0x009c) +/* I2S_CVSD_ENC_RESET : R/W ;bitpos:[3] ;default: 1'd0 ; */ +/*description: don't use*/ +#define I2S_CVSD_ENC_RESET (BIT(3)) +#define I2S_CVSD_ENC_RESET_M (BIT(3)) +#define I2S_CVSD_ENC_RESET_V 0x1 +#define I2S_CVSD_ENC_RESET_S 3 +/* I2S_CVSD_ENC_START : R/W ;bitpos:[2] ;default: 1'd0 ; */ +/*description: don't use*/ +#define I2S_CVSD_ENC_START (BIT(2)) +#define I2S_CVSD_ENC_START_M (BIT(2)) +#define I2S_CVSD_ENC_START_V 0x1 +#define I2S_CVSD_ENC_START_S 2 +/* I2S_SCO_NO_I2S_EN : R/W ;bitpos:[1] ;default: 1'd0 ; */ +/*description: don't use*/ +#define I2S_SCO_NO_I2S_EN (BIT(1)) +#define I2S_SCO_NO_I2S_EN_M (BIT(1)) +#define I2S_SCO_NO_I2S_EN_V 0x1 +#define I2S_SCO_NO_I2S_EN_S 1 +/* I2S_SCO_WITH_I2S_EN : R/W ;bitpos:[0] ;default: 1'd0 ; */ +/*description: don't use*/ +#define I2S_SCO_WITH_I2S_EN (BIT(0)) +#define I2S_SCO_WITH_I2S_EN_M (BIT(0)) +#define I2S_SCO_WITH_I2S_EN_V 0x1 +#define I2S_SCO_WITH_I2S_EN_S 0 + +#define I2S_CONF1_REG(i) (REG_I2S_BASE(i) + 0x00a0) +/* I2S_TX_ZEROS_RM_EN : R/W ;bitpos:[9] ;default: 1'd0 ; */ +/*description: don't use*/ +#define I2S_TX_ZEROS_RM_EN (BIT(9)) +#define I2S_TX_ZEROS_RM_EN_M (BIT(9)) +#define I2S_TX_ZEROS_RM_EN_V 0x1 +#define I2S_TX_ZEROS_RM_EN_S 9 +/* I2S_TX_STOP_EN : R/W ;bitpos:[8] ;default: 1'd0 ; */ +/*description: Set this bit to stop disable output BCK signal and WS signal + when tx FIFO is emtpy*/ +#define I2S_TX_STOP_EN (BIT(8)) +#define I2S_TX_STOP_EN_M (BIT(8)) +#define I2S_TX_STOP_EN_V 0x1 +#define I2S_TX_STOP_EN_S 8 +/* I2S_RX_PCM_BYPASS : R/W ;bitpos:[7] ;default: 1'h1 ; */ +/*description: Set this bit to bypass Compress/Decompress module for received data.*/ +#define I2S_RX_PCM_BYPASS (BIT(7)) +#define I2S_RX_PCM_BYPASS_M (BIT(7)) +#define I2S_RX_PCM_BYPASS_V 0x1 +#define I2S_RX_PCM_BYPASS_S 7 +/* I2S_RX_PCM_CONF : R/W ;bitpos:[6:4] ;default: 3'h0 ; */ +/*description: Compress/Decompress module configuration bits. 0: decompress + received data 1:compress received data*/ +#define I2S_RX_PCM_CONF 0x00000007 +#define I2S_RX_PCM_CONF_M ((I2S_RX_PCM_CONF_V)<<(I2S_RX_PCM_CONF_S)) +#define I2S_RX_PCM_CONF_V 0x7 +#define I2S_RX_PCM_CONF_S 4 +/* I2S_TX_PCM_BYPASS : R/W ;bitpos:[3] ;default: 1'h1 ; */ +/*description: Set this bit to bypass Compress/Decompress module for transmitted data.*/ +#define I2S_TX_PCM_BYPASS (BIT(3)) +#define I2S_TX_PCM_BYPASS_M (BIT(3)) +#define I2S_TX_PCM_BYPASS_V 0x1 +#define I2S_TX_PCM_BYPASS_S 3 +/* I2S_TX_PCM_CONF : R/W ;bitpos:[2:0] ;default: 3'h1 ; */ +/*description: Compress/Decompress module configuration bits. 0: decompress + transmitted data 1:compress transmitted data*/ +#define I2S_TX_PCM_CONF 0x00000007 +#define I2S_TX_PCM_CONF_M ((I2S_TX_PCM_CONF_V)<<(I2S_TX_PCM_CONF_S)) +#define I2S_TX_PCM_CONF_V 0x7 +#define I2S_TX_PCM_CONF_S 0 + +#define I2S_PD_CONF_REG(i) (REG_I2S_BASE(i) + 0x00a4) +/* I2S_PLC_MEM_FORCE_PU : R/W ;bitpos:[3] ;default: 1'h1 ; */ +/*description: */ +#define I2S_PLC_MEM_FORCE_PU (BIT(3)) +#define I2S_PLC_MEM_FORCE_PU_M (BIT(3)) +#define I2S_PLC_MEM_FORCE_PU_V 0x1 +#define I2S_PLC_MEM_FORCE_PU_S 3 +/* I2S_PLC_MEM_FORCE_PD : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define I2S_PLC_MEM_FORCE_PD (BIT(2)) +#define I2S_PLC_MEM_FORCE_PD_M (BIT(2)) +#define I2S_PLC_MEM_FORCE_PD_V 0x1 +#define I2S_PLC_MEM_FORCE_PD_S 2 +/* I2S_FIFO_FORCE_PU : R/W ;bitpos:[1] ;default: 1'h1 ; */ +/*description: Force FIFO power-up*/ +#define I2S_FIFO_FORCE_PU (BIT(1)) +#define I2S_FIFO_FORCE_PU_M (BIT(1)) +#define I2S_FIFO_FORCE_PU_V 0x1 +#define I2S_FIFO_FORCE_PU_S 1 +/* I2S_FIFO_FORCE_PD : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: Force FIFO power-down*/ +#define I2S_FIFO_FORCE_PD (BIT(0)) +#define I2S_FIFO_FORCE_PD_M (BIT(0)) +#define I2S_FIFO_FORCE_PD_V 0x1 +#define I2S_FIFO_FORCE_PD_S 0 + +#define I2S_CONF2_REG(i) (REG_I2S_BASE(i) + 0x00a8) +/* I2S_I2SI_V_SYNC_FILTER_THRES : R/W ;bitpos:[13:11] ;default: 3'b0 ; */ +/*description: */ +#define I2S_I2SI_V_SYNC_FILTER_THRES 0x00000007 +#define I2S_I2SI_V_SYNC_FILTER_THRES_M ((I2S_I2SI_V_SYNC_FILTER_THRES_V)<<(I2S_I2SI_V_SYNC_FILTER_THRES_S)) +#define I2S_I2SI_V_SYNC_FILTER_THRES_V 0x7 +#define I2S_I2SI_V_SYNC_FILTER_THRES_S 11 +/* I2S_I2SI_V_SYNC_FILTER_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define I2S_I2SI_V_SYNC_FILTER_EN (BIT(10)) +#define I2S_I2SI_V_SYNC_FILTER_EN_M (BIT(10)) +#define I2S_I2SI_V_SYNC_FILTER_EN_V 0x1 +#define I2S_I2SI_V_SYNC_FILTER_EN_S 10 +/* I2S_CAM_CLK_LOOPBACK : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: Set this bit to loopback cam_clk from i2s_rx*/ +#define I2S_CAM_CLK_LOOPBACK (BIT(9)) +#define I2S_CAM_CLK_LOOPBACK_M (BIT(9)) +#define I2S_CAM_CLK_LOOPBACK_V 0x1 +#define I2S_CAM_CLK_LOOPBACK_S 9 +/* I2S_CAM_SYNC_FIFO_RESET : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: Set this bit to reset cam_sync_fifo*/ +#define I2S_CAM_SYNC_FIFO_RESET (BIT(8)) +#define I2S_CAM_SYNC_FIFO_RESET_M (BIT(8)) +#define I2S_CAM_SYNC_FIFO_RESET_V 0x1 +#define I2S_CAM_SYNC_FIFO_RESET_S 8 +/* I2S_INTER_VALID_EN : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: Set this bit to enable camera internal valid*/ +#define I2S_INTER_VALID_EN (BIT(7)) +#define I2S_INTER_VALID_EN_M (BIT(7)) +#define I2S_INTER_VALID_EN_V 0x1 +#define I2S_INTER_VALID_EN_S 7 +/* I2S_EXT_ADC_START_EN : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: Set this bit to enable the function that ADC mode is triggered + by external signal.*/ +#define I2S_EXT_ADC_START_EN (BIT(6)) +#define I2S_EXT_ADC_START_EN_M (BIT(6)) +#define I2S_EXT_ADC_START_EN_V 0x1 +#define I2S_EXT_ADC_START_EN_S 6 +/* I2S_LCD_EN : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: Set this bit to enable LCD mode*/ +#define I2S_LCD_EN (BIT(5)) +#define I2S_LCD_EN_M (BIT(5)) +#define I2S_LCD_EN_V 0x1 +#define I2S_LCD_EN_S 5 +/* I2S_DATA_ENABLE : R/W ;bitpos:[4] ;default: 1'h0 ; */ +/*description: for debug camera mode enable*/ +#define I2S_DATA_ENABLE (BIT(4)) +#define I2S_DATA_ENABLE_M (BIT(4)) +#define I2S_DATA_ENABLE_V 0x1 +#define I2S_DATA_ENABLE_S 4 +/* I2S_DATA_ENABLE_TEST_EN : R/W ;bitpos:[3] ;default: 1'h0 ; */ +/*description: for debug camera mode enable*/ +#define I2S_DATA_ENABLE_TEST_EN (BIT(3)) +#define I2S_DATA_ENABLE_TEST_EN_M (BIT(3)) +#define I2S_DATA_ENABLE_TEST_EN_V 0x1 +#define I2S_DATA_ENABLE_TEST_EN_S 3 +/* I2S_LCD_TX_SDX2_EN : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: Set this bit to duplicate data pairs (Frame Form 2) in LCD mode.*/ +#define I2S_LCD_TX_SDX2_EN (BIT(2)) +#define I2S_LCD_TX_SDX2_EN_M (BIT(2)) +#define I2S_LCD_TX_SDX2_EN_V 0x1 +#define I2S_LCD_TX_SDX2_EN_S 2 +/* I2S_LCD_TX_WRX2_EN : R/W ;bitpos:[1] ;default: 1'h0 ; */ +/*description: LCD WR double for one datum.*/ +#define I2S_LCD_TX_WRX2_EN (BIT(1)) +#define I2S_LCD_TX_WRX2_EN_M (BIT(1)) +#define I2S_LCD_TX_WRX2_EN_V 0x1 +#define I2S_LCD_TX_WRX2_EN_S 1 +/* I2S_CAMERA_EN : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: Set this bit to enable camera mode*/ +#define I2S_CAMERA_EN (BIT(0)) +#define I2S_CAMERA_EN_M (BIT(0)) +#define I2S_CAMERA_EN_V 0x1 +#define I2S_CAMERA_EN_S 0 + +#define I2S_CLKM_CONF_REG(i) (REG_I2S_BASE(i) + 0x00ac) +/* I2S_CLK_SEL : R/W ;bitpos:[22:21] ;default: 2'b0 ; */ +/*description: Set this bit to enable clk_apll*/ +#define I2S_CLK_SEL 0x00000003 +#define I2S_CLK_SEL_M ((I2S_CLK_SEL_V)<<(I2S_CLK_SEL_S)) +#define I2S_CLK_SEL_V 0x3 +#define I2S_CLK_SEL_S 21 +#define I2S_CLK_AUDIO_PLL 1 +#define I2S_CLK_160M_PLL 2 +/* I2S_CLK_EN : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: Set this bit to enable clk gate*/ +#define I2S_CLK_EN (BIT(20)) +#define I2S_CLK_EN_M (BIT(20)) +#define I2S_CLK_EN_V 0x1 +#define I2S_CLK_EN_S 20 +/* I2S_CLKM_DIV_A : R/W ;bitpos:[19:14] ;default: 6'h0 ; */ +/*description: Fractional clock divider denominator value*/ +#define I2S_CLKM_DIV_A 0x0000003F +#define I2S_CLKM_DIV_A_M ((I2S_CLKM_DIV_A_V)<<(I2S_CLKM_DIV_A_S)) +#define I2S_CLKM_DIV_A_V 0x3F +#define I2S_CLKM_DIV_A_S 14 +/* I2S_CLKM_DIV_B : R/W ;bitpos:[13:8] ;default: 6'h0 ; */ +/*description: Fractional clock divider numerator value*/ +#define I2S_CLKM_DIV_B 0x0000003F +#define I2S_CLKM_DIV_B_M ((I2S_CLKM_DIV_B_V)<<(I2S_CLKM_DIV_B_S)) +#define I2S_CLKM_DIV_B_V 0x3F +#define I2S_CLKM_DIV_B_S 8 +/* I2S_CLKM_DIV_NUM : R/W ;bitpos:[7:0] ;default: 8'd4 ; */ +/*description: Integral I2S clock divider value*/ +#define I2S_CLKM_DIV_NUM 0x000000FF +#define I2S_CLKM_DIV_NUM_M ((I2S_CLKM_DIV_NUM_V)<<(I2S_CLKM_DIV_NUM_S)) +#define I2S_CLKM_DIV_NUM_V 0xFF +#define I2S_CLKM_DIV_NUM_S 0 + +#define I2S_SAMPLE_RATE_CONF_REG(i) (REG_I2S_BASE(i) + 0x00b0) +/* I2S_RX_BITS_MOD : R/W ;bitpos:[23:18] ;default: 6'd16 ; */ +/*description: Set the bits to configure bit length of I2S receiver channel.*/ +#define I2S_RX_BITS_MOD 0x0000003F +#define I2S_RX_BITS_MOD_M ((I2S_RX_BITS_MOD_V)<<(I2S_RX_BITS_MOD_S)) +#define I2S_RX_BITS_MOD_V 0x3F +#define I2S_RX_BITS_MOD_S 18 +/* I2S_TX_BITS_MOD : R/W ;bitpos:[17:12] ;default: 6'd16 ; */ +/*description: Set the bits to configure bit length of I2S transmitter channel.*/ +#define I2S_TX_BITS_MOD 0x0000003F +#define I2S_TX_BITS_MOD_M ((I2S_TX_BITS_MOD_V)<<(I2S_TX_BITS_MOD_S)) +#define I2S_TX_BITS_MOD_V 0x3F +#define I2S_TX_BITS_MOD_S 12 +/* I2S_RX_BCK_DIV_NUM : R/W ;bitpos:[11:6] ;default: 6'd6 ; */ +/*description: Bit clock configuration bits in receiver mode.*/ +#define I2S_RX_BCK_DIV_NUM 0x0000003F +#define I2S_RX_BCK_DIV_NUM_M ((I2S_RX_BCK_DIV_NUM_V)<<(I2S_RX_BCK_DIV_NUM_S)) +#define I2S_RX_BCK_DIV_NUM_V 0x3F +#define I2S_RX_BCK_DIV_NUM_S 6 +/* I2S_TX_BCK_DIV_NUM : R/W ;bitpos:[5:0] ;default: 6'd6 ; */ +/*description: Bit clock configuration bits in transmitter mode.*/ +#define I2S_TX_BCK_DIV_NUM 0x0000003F +#define I2S_TX_BCK_DIV_NUM_M ((I2S_TX_BCK_DIV_NUM_V)<<(I2S_TX_BCK_DIV_NUM_S)) +#define I2S_TX_BCK_DIV_NUM_V 0x3F +#define I2S_TX_BCK_DIV_NUM_S 0 + +#define I2S_PDM_CONF_REG(i) (REG_I2S_BASE(i) + 0x00b4) +/* I2S_RX_PDM_WAY_MODE : R/W ;bitpos:[31:30] ;default: 2'h0 ; */ +/*description: 0/1 pdm rx use one-way*/ +#define I2S_RX_PDM_WAY_MODE 0x00000003 +#define I2S_RX_PDM_WAY_MODE_M ((I2S_RX_PDM_WAY_MODE_V)<<(I2S_RX_PDM_WAY_MODE_S)) +#define I2S_RX_PDM_WAY_MODE_V 0x3 +#define I2S_RX_PDM_WAY_MODE_S 30 +/* I2S_TX_PDM_WAY_MODE : R/W ;bitpos:[29:28] ;default: 2'b0 ; */ +/*description: 0/1 pdm rx use one-way*/ +#define I2S_TX_PDM_WAY_MODE 0x00000003 +#define I2S_TX_PDM_WAY_MODE_M ((I2S_TX_PDM_WAY_MODE_V)<<(I2S_TX_PDM_WAY_MODE_S)) +#define I2S_TX_PDM_WAY_MODE_V 0x3 +#define I2S_TX_PDM_WAY_MODE_S 28 +/* I2S_TX_PDM_CHAN_MOD : R/W ;bitpos:[27:26] ;default: 2'h0 ; */ +/*description: pdm tx channel mode*/ +#define I2S_TX_PDM_CHAN_MOD 0x00000003 +#define I2S_TX_PDM_CHAN_MOD_M ((I2S_TX_PDM_CHAN_MOD_V)<<(I2S_TX_PDM_CHAN_MOD_S)) +#define I2S_TX_PDM_CHAN_MOD_V 0x3 +#define I2S_TX_PDM_CHAN_MOD_S 26 +/* I2S_TX_PDM_HP_BYPASS : R/W ;bitpos:[25] ;default: 1'h0 ; */ +/*description: Set this bit to enable tx pdm hp filter bypass*/ +#define I2S_TX_PDM_HP_BYPASS (BIT(25)) +#define I2S_TX_PDM_HP_BYPASS_M (BIT(25)) +#define I2S_TX_PDM_HP_BYPASS_V 0x1 +#define I2S_TX_PDM_HP_BYPASS_S 25 +/* I2S_RX_PDM_SINC_DSR_16_EN : R/W ;bitpos:[24] ;default: 1'h1 ; */ +/*description: PDM down-sampling rate for filter group1 in receiver mode. 0: + downsample rate = 64 1:downsample rate = 128*/ +#define I2S_RX_PDM_SINC_DSR_16_EN (BIT(24)) +#define I2S_RX_PDM_SINC_DSR_16_EN_M (BIT(24)) +#define I2S_RX_PDM_SINC_DSR_16_EN_V 0x1 +#define I2S_RX_PDM_SINC_DSR_16_EN_S 24 +/* I2S_TX_PDM_SIGMADELTA_IN_SHIFT : R/W ;bitpos:[23:22] ;default: 2'h1 ; */ +/*description: Adjust size of input signal to filter module. 0: divided by 2 + 1:multiplied by 1 2:multiplied by 2 3:multiplied by 4*/ +#define I2S_TX_PDM_SIGMADELTA_IN_SHIFT 0x00000003 +#define I2S_TX_PDM_SIGMADELTA_IN_SHIFT_M ((I2S_TX_PDM_SIGMADELTA_IN_SHIFT_V)<<(I2S_TX_PDM_SIGMADELTA_IN_SHIFT_S)) +#define I2S_TX_PDM_SIGMADELTA_IN_SHIFT_V 0x3 +#define I2S_TX_PDM_SIGMADELTA_IN_SHIFT_S 22 +/* I2S_TX_PDM_SINC_IN_SHIFT : R/W ;bitpos:[21:20] ;default: 2'h1 ; */ +/*description: Adjust size of input signal to filter module. 0: divided by 2 + 1:multiplied by 1 2:multiplied by 2 3:multiplied by 4*/ +#define I2S_TX_PDM_SINC_IN_SHIFT 0x00000003 +#define I2S_TX_PDM_SINC_IN_SHIFT_M ((I2S_TX_PDM_SINC_IN_SHIFT_V)<<(I2S_TX_PDM_SINC_IN_SHIFT_S)) +#define I2S_TX_PDM_SINC_IN_SHIFT_V 0x3 +#define I2S_TX_PDM_SINC_IN_SHIFT_S 20 +/* I2S_TX_PDM_LP_IN_SHIFT : R/W ;bitpos:[19:18] ;default: 2'h1 ; */ +/*description: Adjust size of input signal to filter module. 0: divided by 2 + 1:multiplied by 1 2:multiplied by 2 3:multiplied by 4*/ +#define I2S_TX_PDM_LP_IN_SHIFT 0x00000003 +#define I2S_TX_PDM_LP_IN_SHIFT_M ((I2S_TX_PDM_LP_IN_SHIFT_V)<<(I2S_TX_PDM_LP_IN_SHIFT_S)) +#define I2S_TX_PDM_LP_IN_SHIFT_V 0x3 +#define I2S_TX_PDM_LP_IN_SHIFT_S 18 +/* I2S_TX_PDM_HP_IN_SHIFT : R/W ;bitpos:[17:16] ;default: 2'h1 ; */ +/*description: Adjust size of input signal to filter module. 0: divided by 2 + 1:multiplied by 1 2:multiplied by 2 3:multiplied by 4*/ +#define I2S_TX_PDM_HP_IN_SHIFT 0x00000003 +#define I2S_TX_PDM_HP_IN_SHIFT_M ((I2S_TX_PDM_HP_IN_SHIFT_V)<<(I2S_TX_PDM_HP_IN_SHIFT_S)) +#define I2S_TX_PDM_HP_IN_SHIFT_V 0x3 +#define I2S_TX_PDM_HP_IN_SHIFT_S 16 +/* I2S_TX_PDM_PRESCALE : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: set to 0*/ +#define I2S_TX_PDM_PRESCALE 0x000000FF +#define I2S_TX_PDM_PRESCALE_M ((I2S_TX_PDM_PRESCALE_V)<<(I2S_TX_PDM_PRESCALE_S)) +#define I2S_TX_PDM_PRESCALE_V 0xFF +#define I2S_TX_PDM_PRESCALE_S 8 +/* I2S_TX_PDM_SINC_OSR2 : R/W ;bitpos:[7:4] ;default: 4'h2 ; */ +/*description: upsample rate = 64 * reg_tx_pdm_sinc_osr2*/ +#define I2S_TX_PDM_SINC_OSR2 0x0000000F +#define I2S_TX_PDM_SINC_OSR2_M ((I2S_TX_PDM_SINC_OSR2_V)<<(I2S_TX_PDM_SINC_OSR2_S)) +#define I2S_TX_PDM_SINC_OSR2_V 0xF +#define I2S_TX_PDM_SINC_OSR2_S 4 +/* I2S_PDM2PCM_CONV_EN : R/W ;bitpos:[3] ;default: 1'h0 ; */ +/*description: Set this bit to enable PDM-to-PCM converter*/ +#define I2S_PDM2PCM_CONV_EN (BIT(3)) +#define I2S_PDM2PCM_CONV_EN_M (BIT(3)) +#define I2S_PDM2PCM_CONV_EN_V 0x1 +#define I2S_PDM2PCM_CONV_EN_S 3 +/* I2S_PCM2PDM_CONV_EN : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: Set this bit to enable PCM-to-PDM converter*/ +#define I2S_PCM2PDM_CONV_EN (BIT(2)) +#define I2S_PCM2PDM_CONV_EN_M (BIT(2)) +#define I2S_PCM2PDM_CONV_EN_V 0x1 +#define I2S_PCM2PDM_CONV_EN_S 2 +/* I2S_RX_PDM_EN : R/W ;bitpos:[1] ;default: 1'h0 ; */ +/*description: Set this bit to enable receiver PDM mode*/ +#define I2S_RX_PDM_EN (BIT(1)) +#define I2S_RX_PDM_EN_M (BIT(1)) +#define I2S_RX_PDM_EN_V 0x1 +#define I2S_RX_PDM_EN_S 1 +/* I2S_TX_PDM_EN : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: Set this bit to enable transmitter PDM mode*/ +#define I2S_TX_PDM_EN (BIT(0)) +#define I2S_TX_PDM_EN_M (BIT(0)) +#define I2S_TX_PDM_EN_V 0x1 +#define I2S_TX_PDM_EN_S 0 + +#define I2S_PDM_FREQ_CONF_REG(i) (REG_I2S_BASE(i) + 0x00b8) +/* I2S_TX_PDM_FP : R/W ;bitpos:[19:10] ;default: 10'd960 ; */ +/*description: PCM-to-PDM converter PDM frequency parameter*/ +#define I2S_TX_PDM_FP 0x000003FF +#define I2S_TX_PDM_FP_M ((I2S_TX_PDM_FP_V)<<(I2S_TX_PDM_FP_S)) +#define I2S_TX_PDM_FP_V 0x3FF +#define I2S_TX_PDM_FP_S 10 +/* I2S_TX_PDM_FS : R/W ;bitpos:[9:0] ;default: 10'd480 ; */ +/*description: PCM-to-PDM converter PCM frequency parameter*/ +#define I2S_TX_PDM_FS 0x000003FF +#define I2S_TX_PDM_FS_M ((I2S_TX_PDM_FS_V)<<(I2S_TX_PDM_FS_S)) +#define I2S_TX_PDM_FS_V 0x3FF +#define I2S_TX_PDM_FS_S 0 + +#define I2S_STATE_REG(i) (REG_I2S_BASE(i) + 0x00bc) +/* I2S_TX_IDLE : RO ;bitpos:[0] ;default: 1'b1 ; */ +/*description: 1: i2s_tx is idle state*/ +#define I2S_TX_IDLE (BIT(0)) +#define I2S_TX_IDLE_M (BIT(0)) +#define I2S_TX_IDLE_V 0x1 +#define I2S_TX_IDLE_S 0 + +#define I2S_DATE_REG(i) (REG_I2S_BASE(i) + 0x00fc) +/* I2S_I2SDATE : R/W ;bitpos:[31:0] ;default: 32'h18092900 ; */ +/*description: */ +#define I2S_I2SDATE 0xFFFFFFFF +#define I2S_I2SDATE_M ((I2S_I2SDATE_V)<<(I2S_I2SDATE_S)) +#define I2S_I2SDATE_V 0xFFFFFFFF +#define I2S_I2SDATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_I2S_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/i2s_struct.h b/components/soc/esp32s2beta/include/soc/i2s_struct.h new file mode 100644 index 0000000000..5be4b18d9e --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/i2s_struct.h @@ -0,0 +1,506 @@ +// Copyright 2017-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. +#ifndef _SOC_I2S_STRUCT_H_ +#define _SOC_I2S_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + uint32_t reserved_0; + uint32_t reserved_4; + union { + struct { + uint32_t tx_reset: 1; /*Set this bit to reset transmitter*/ + uint32_t rx_reset: 1; /*Set this bit to reset receiver*/ + uint32_t tx_fifo_reset: 1; /*Set this bit to reset txFIFO*/ + uint32_t rx_fifo_reset: 1; /*Set this bit to reset rxFIFO*/ + uint32_t tx_start: 1; /*Set this bit to start transmitting data*/ + uint32_t rx_start: 1; /*Set this bit to start receiving data*/ + uint32_t tx_slave_mod: 1; /*Set this bit to enable slave transmitter mode*/ + uint32_t rx_slave_mod: 1; /*Set this bit to enable slave receiver mode*/ + uint32_t tx_right_first: 1; /*Set this bit to transmit right channel data first*/ + uint32_t rx_right_first: 1; /*Set this bit to receive right channel data first*/ + uint32_t tx_msb_shift: 1; /*Set this bit to enable transmitter in Phillips standard mode*/ + uint32_t rx_msb_shift: 1; /*Set this bit to enable receiver in Phillips standard mode*/ + uint32_t tx_short_sync: 1; /*Set this bit to enable transmitter in PCM standard mode*/ + uint32_t rx_short_sync: 1; /*Set this bit to enable receiver in PCM standard mode*/ + uint32_t tx_mono: 1; /*Set this bit to enable transmitter in mono mode*/ + uint32_t rx_mono: 1; /*Set this bit to enable receiver in mono mode*/ + uint32_t tx_msb_right: 1; /*Set this bit to place right channel data at the MSB in the transmit FIFO.*/ + uint32_t rx_msb_right: 1; /*Set this bit to place right channel data at the MSB in the receive FIFO.*/ + uint32_t tx_lsb_first_dma: 1; /*1:the data in DMA/APB transform from low bits*/ + uint32_t rx_lsb_first_dma: 1; /*1:the data in DMA/APB transform from low bits*/ + uint32_t sig_loopback: 1; /*Enable signal loopback mode with transmitter module and receiver module sharing the same WS and BCK signals.*/ + uint32_t tx_fifo_reset_st: 1; /*1:i2s_tx_fifo reset is not ok 0:i2s_tx_fifo_reset is ok*/ + uint32_t rx_fifo_reset_st: 1; /*1:i2s_rx_fifo_reset is not ok 0:i2s_rx_fifo reset is ok*/ + uint32_t tx_reset_st: 1; /*1: i2s_tx_reset is not ok 0: i2s_tx_reset is ok*/ + uint32_t tx_dma_equal: 1; /*1:data in left channel is equal to data in right channel*/ + uint32_t rx_dma_equal: 1; /*1:data in left channel is equal to data in right channel*/ + uint32_t pre_req_en: 1; /*set this bit to enable i2s to prepare data earlier*/ + uint32_t tx_big_endian: 1; + uint32_t rx_big_endian: 1; + uint32_t rx_reset_st: 1; + uint32_t reserved30: 2; + }; + uint32_t val; + } conf; + union { + struct { + uint32_t rx_take_data: 1; /*The raw interrupt status bit for the i2s_rx_take_data_int interrupt*/ + uint32_t tx_put_data: 1; /*The raw interrupt status bit for the i2s_tx_put_data_int interrupt*/ + uint32_t rx_wfull: 1; /*The raw interrupt status bit for the i2s_rx_wfull_int interrupt*/ + uint32_t rx_rempty: 1; /*The raw interrupt status bit for the i2s_rx_rempty_int interrupt*/ + uint32_t tx_wfull: 1; /*The raw interrupt status bit for the i2s_tx_wfull_int interrupt*/ + uint32_t tx_rempty: 1; /*The raw interrupt status bit for the i2s_tx_rempty_int interrupt*/ + uint32_t rx_hung: 1; /*The raw interrupt status bit for the i2s_rx_hung_int interrupt*/ + uint32_t tx_hung: 1; /*The raw interrupt status bit for the i2s_tx_hung_int interrupt*/ + uint32_t in_done: 1; /*The raw interrupt status bit for the i2s_in_done_int interrupt*/ + uint32_t in_suc_eof: 1; /*The raw interrupt status bit for the i2s_in_suc_eof_int interrupt*/ + uint32_t in_err_eof: 1; /*don't use*/ + uint32_t out_done: 1; /*The raw interrupt status bit for the i2s_out_done_int interrupt*/ + uint32_t out_eof: 1; /*The raw interrupt status bit for the i2s_out_eof_int interrupt*/ + uint32_t in_dscr_err: 1; /*The raw interrupt status bit for the i2s_in_dscr_err_int interrupt*/ + uint32_t out_dscr_err: 1; /*The raw interrupt status bit for the i2s_out_dscr_err_int interrupt*/ + uint32_t in_dscr_empty: 1; /*The raw interrupt status bit for the i2s_in_dscr_empty_int interrupt*/ + uint32_t out_total_eof: 1; /*The raw interrupt status bit for the i2s_out_total_eof_int interrupt*/ + uint32_t reserved17: 15; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t rx_take_data: 1; /*The masked interrupt status bit for the i2s_rx_take_data_int interrupt*/ + uint32_t tx_put_data: 1; /*The masked interrupt status bit for the i2s_tx_put_data_int interrupt*/ + uint32_t rx_wfull: 1; /*The masked interrupt status bit for the i2s_rx_wfull_int interrupt*/ + uint32_t rx_rempty: 1; /*The masked interrupt status bit for the i2s_rx_rempty_int interrupt*/ + uint32_t tx_wfull: 1; /*The masked interrupt status bit for the i2s_tx_wfull_int interrupt*/ + uint32_t tx_rempty: 1; /*The masked interrupt status bit for the i2s_tx_rempty_int interrupt*/ + uint32_t rx_hung: 1; /*The masked interrupt status bit for the i2s_rx_hung_int interrupt*/ + uint32_t tx_hung: 1; /*The masked interrupt status bit for the i2s_tx_hung_int interrupt*/ + uint32_t in_done: 1; /*The masked interrupt status bit for the i2s_in_done_int interrupt*/ + uint32_t in_suc_eof: 1; /*The masked interrupt status bit for the i2s_in_suc_eof_int interrupt*/ + uint32_t in_err_eof: 1; /*don't use*/ + uint32_t out_done: 1; /*The masked interrupt status bit for the i2s_out_done_int interrupt*/ + uint32_t out_eof: 1; /*The masked interrupt status bit for the i2s_out_eof_int interrupt*/ + uint32_t in_dscr_err: 1; /*The masked interrupt status bit for the i2s_in_dscr_err_int interrupt*/ + uint32_t out_dscr_err: 1; /*The masked interrupt status bit for the i2s_out_dscr_err_int interrupt*/ + uint32_t in_dscr_empty: 1; /*The masked interrupt status bit for the i2s_in_dscr_empty_int interrupt*/ + uint32_t out_total_eof: 1; /*The masked interrupt status bit for the i2s_out_total_eof_int interrupt*/ + uint32_t reserved17: 15; + }; + uint32_t val; + } int_st; + union { + struct { + uint32_t rx_take_data: 1; /*The interrupt enable bit for the i2s_rx_take_data_int interrupt*/ + uint32_t tx_put_data: 1; /*The interrupt enable bit for the i2s_tx_put_data_int interrupt*/ + uint32_t rx_wfull: 1; /*The interrupt enable bit for the i2s_rx_wfull_int interrupt*/ + uint32_t rx_rempty: 1; /*The interrupt enable bit for the i2s_rx_rempty_int interrupt*/ + uint32_t tx_wfull: 1; /*The interrupt enable bit for the i2s_tx_wfull_int interrupt*/ + uint32_t tx_rempty: 1; /*The interrupt enable bit for the i2s_tx_rempty_int interrupt*/ + uint32_t rx_hung: 1; /*The interrupt enable bit for the i2s_rx_hung_int interrupt*/ + uint32_t tx_hung: 1; /*The interrupt enable bit for the i2s_tx_hung_int interrupt*/ + uint32_t in_done: 1; /*The interrupt enable bit for the i2s_in_done_int interrupt*/ + uint32_t in_suc_eof: 1; /*The interrupt enable bit for the i2s_in_suc_eof_int interrupt*/ + uint32_t in_err_eof: 1; /*don't use*/ + uint32_t out_done: 1; /*The interrupt enable bit for the i2s_out_done_int interrupt*/ + uint32_t out_eof: 1; /*The interrupt enable bit for the i2s_out_eof_int interrupt*/ + uint32_t in_dscr_err: 1; /*The interrupt enable bit for the i2s_in_dscr_err_int interrupt*/ + uint32_t out_dscr_err: 1; /*The interrupt enable bit for the i2s_out_dscr_err_int interrupt*/ + uint32_t in_dscr_empty: 1; /*The interrupt enable bit for the i2s_in_dscr_empty_int interrupt*/ + uint32_t out_total_eof: 1; /*The interrupt enable bit for the i2s_out_total_eof_int interrupt*/ + uint32_t reserved17: 15; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t take_data: 1; /*Set this bit to clear the i2s_rx_take_data_int interrupt*/ + uint32_t put_data: 1; /*Set this bit to clear the i2s_tx_put_data_int interrupt*/ + uint32_t rx_wfull: 1; /*Set this bit to clear the i2s_rx_wfull_int interrupt*/ + uint32_t rx_rempty: 1; /*Set this bit to clear the i2s_rx_rempty_int interrupt*/ + uint32_t tx_wfull: 1; /*Set this bit to clear the i2s_tx_wfull_int interrupt*/ + uint32_t tx_rempty: 1; /*Set this bit to clear the i2s_tx_rempty_int interrupt*/ + uint32_t rx_hung: 1; /*Set this bit to clear the i2s_rx_hung_int interrupt*/ + uint32_t tx_hung: 1; /*Set this bit to clear the i2s_tx_hung_int interrupt*/ + uint32_t in_done: 1; /*Set this bit to clear the i2s_in_done_int interrupt*/ + uint32_t in_suc_eof: 1; /*Set this bit to clear the i2s_in_suc_eof_int interrupt*/ + uint32_t in_err_eof: 1; /*don't use*/ + uint32_t out_done: 1; /*Set this bit to clear the i2s_out_done_int interrupt*/ + uint32_t out_eof: 1; /*Set this bit to clear the i2s_out_eof_int interrupt*/ + uint32_t in_dscr_err: 1; /*Set this bit to clear the i2s_in_dscr_err_int interrupt*/ + uint32_t out_dscr_err: 1; /*Set this bit to clear the i2s_out_dscr_err_int interrupt*/ + uint32_t in_dscr_empty: 1; /*Set this bit to clear the i2s_in_dscr_empty_int interrupt*/ + uint32_t out_total_eof: 1; /*Set this bit to clear the i2s_out_total_eof_int interrupt*/ + uint32_t reserved17: 15; + }; + uint32_t val; + } int_clr; + union { + struct { + uint32_t tx_bck_in_delay: 2; /*Number of delay cycles for BCK into the transmitter*/ + uint32_t tx_ws_in_delay: 2; /*Number of delay cycles for WS into the transmitter*/ + uint32_t rx_bck_in_delay: 2; /*Number of delay cycles for BCK into the receiver*/ + uint32_t rx_ws_in_delay: 2; /*Number of delay cycles for WS into the receiver*/ + uint32_t rx_sd_in_delay: 2; /*Number of delay cycles for SD into the receiver*/ + uint32_t tx_bck_out_delay: 2; /*Number of delay cycles for BCK out of the transmitter*/ + uint32_t tx_ws_out_delay: 2; /*Number of delay cycles for WS out of the transmitter*/ + uint32_t tx_sd_out_delay: 2; /*Number of delay cycles for SD out of the transmitter*/ + uint32_t rx_ws_out_delay: 2; /*Number of delay cycles for WS out of the receiver*/ + uint32_t rx_bck_out_delay: 2; /*Number of delay cycles for BCK out of the receiver*/ + uint32_t tx_dsync_sw: 1; /*Set this bit to synchronize signals with the double sync method into the transmitter*/ + uint32_t rx_dsync_sw: 1; /*Set this bit to synchronize signals with the double sync method into the receiver*/ + uint32_t data_enable_delay: 2; /*Number of delay cycles for data valid flag.*/ + uint32_t tx_bck_in_inv: 1; /*Set this bit to invert BCK signal input to the slave transmitter*/ + uint32_t reserved25: 7; + }; + uint32_t val; + } timing; + union { + struct { + uint32_t rx_data_num: 6; /*Threshold of data length in receiver FIFO*/ + uint32_t tx_data_num: 6; /*Threshold of data length in transmitter FIFO*/ + uint32_t dscr_en: 1; /*Set this bit to enable I2S DMA mode*/ + uint32_t tx_fifo_mod: 3; /*Transmitter FIFO mode configuration bits*/ + uint32_t rx_fifo_mod: 3; /*Receiver FIFO mode configuration bits*/ + uint32_t tx_fifo_mod_force_en: 1; /*The bit should always be set to 1*/ + uint32_t rx_fifo_mod_force_en: 1; /*The bit should always be set to 1*/ + uint32_t rx_fifo_sync: 1; /*force write back rx data to memory*/ + uint32_t rx_24msb_en: 1; /*Only useful in rx 24bit mode. 1: the high 24 bits are effective in i2s fifo 0: the low 24 bits are effective in i2s fifo*/ + uint32_t tx_24msb_en: 1; /*Only useful in tx 24bit mode. 1: the high 24 bits are effective in i2s fifo 0: the low 24 bits are effective in i2s fifo*/ + uint32_t reserved24: 8; + }; + uint32_t val; + } fifo_conf; + uint32_t rx_eof_num; /*the length of data to be received. It will trigger i2s_in_suc_eof_int.*/ + uint32_t conf_single_data; /*the right channel or left channel put out constant value stored in this register according to tx_chan_mod and reg_tx_msb_right*/ + union { + struct { + uint32_t tx_chan_mod: 3; /*I2S transmitter channel mode configuration bits.*/ + uint32_t rx_chan_mod: 2; /*I2S receiver channel mode configuration bits.*/ + uint32_t reserved5: 27; + }; + uint32_t val; + } conf_chan; + union { + struct { + uint32_t addr: 20; /*The address of first outlink descriptor*/ + uint32_t reserved20: 8; + uint32_t stop: 1; /*Set this bit to stop outlink descriptor*/ + uint32_t start: 1; /*Set this bit to start outlink descriptor*/ + uint32_t restart: 1; /*Set this bit to restart outlink descriptor*/ + uint32_t park: 1; + }; + uint32_t val; + } out_link; + union { + struct { + uint32_t addr: 20; /*The address of first inlink descriptor*/ + uint32_t reserved20: 8; + uint32_t stop: 1; /*Set this bit to stop inlink descriptor*/ + uint32_t start: 1; /*Set this bit to start inlink descriptor*/ + uint32_t restart: 1; /*Set this bit to restart inlink descriptor*/ + uint32_t park: 1; + }; + uint32_t val; + } in_link; + uint32_t out_eof_des_addr; /*The address of outlink descriptor that produces EOF*/ + uint32_t in_eof_des_addr; /*The address of inlink descriptor that produces EOF*/ + uint32_t out_eof_bfr_des_addr; /*The address of buffer relative to the outlink descriptor that produces EOF*/ + union { + struct { + uint32_t mode: 3; + uint32_t reserved3: 1; + uint32_t addr: 2; + uint32_t reserved6: 26; + }; + uint32_t val; + } ahb_test; + uint32_t in_link_dscr; /*The address of current inlink descriptor*/ + uint32_t in_link_dscr_bf0; /*The address of next inlink descriptor*/ + uint32_t in_link_dscr_bf1; /*The address of next inlink data buffer*/ + uint32_t out_link_dscr; /*The address of current outlink descriptor*/ + uint32_t out_link_dscr_bf0; /*The address of next outlink descriptor*/ + uint32_t out_link_dscr_bf1; /*The address of next outlink data buffer*/ + union { + struct { + uint32_t in_rst: 1; /*Set this bit to reset in dma FSM*/ + uint32_t out_rst: 1; /*Set this bit to reset out dma FSM*/ + uint32_t ahbm_fifo_rst: 1; /*Set this bit to reset ahb interface cmdFIFO of DMA*/ + uint32_t ahbm_rst: 1; /*Set this bit to reset ahb interface of DMA*/ + uint32_t out_loop_test: 1; /*Set this bit to loop test inlink*/ + uint32_t in_loop_test: 1; /*Set this bit to loop test outlink*/ + uint32_t out_auto_wrback: 1; /*Set this bit to enable outlink-written-back automatically when out buffer is transmitted done.*/ + uint32_t out_no_restart_clr: 1; /*don't use*/ + uint32_t out_eof_mode: 1; /*DMA out EOF flag generation mode . 1: when dma has popped all data from the FIFO 0:when ahb has pushed all data to the FIFO*/ + uint32_t outdscr_burst_en: 1; /*DMA outlink descriptor transfer mode configuration bit. 1: to prepare outlink descriptor with burst mode 0: to prepare outlink descriptor with byte mode*/ + uint32_t indscr_burst_en: 1; /*DMA inlink descriptor transfer mode configuration bit. 1: to prepare inlink descriptor with burst mode 0: to prepare inlink descriptor with byte mode*/ + uint32_t out_data_burst_en: 1; /*Transmitter data transfer mode configuration bit. 1: to prepare out data with burst mode 0: to prepare out data with byte mode*/ + uint32_t check_owner: 1; /*Set this bit to enable check owner bit by hardware*/ + uint32_t mem_trans_en: 1; /*don't use*/ + uint32_t reserved14: 18; + }; + uint32_t val; + } lc_conf; + union { + struct { + uint32_t wdata: 9; + uint32_t reserved9: 7; + uint32_t push: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } out_fifo_push; + union { + struct { + uint32_t rdata: 12; + uint32_t reserved12: 4; + uint32_t pop: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } in_fifo_pop; + union { + struct { + uint32_t dscr_addr: 18; + uint32_t out_dscr_state: 2; + uint32_t out_state: 3; + uint32_t cnt: 7; + uint32_t out_full: 1; + uint32_t out_empty: 1; /*DMA transmitter status register*/ + }; + uint32_t val; + } lc_state0; + union { + struct { + uint32_t dscr_addr: 18; + uint32_t in_dscr_state: 2; + uint32_t in_state: 3; + uint32_t cnt_debug: 7; + uint32_t in_full: 1; + uint32_t in_empty: 1; /*DMA receiver status register*/ + }; + uint32_t val; + } lc_state1; + union { + struct { + uint32_t fifo_timeout: 8; /*the i2s_tx_hung_int interrupt or the i2s_rx_hung_int interrupt will be triggered when fifo hung counter is equal to this value*/ + uint32_t fifo_timeout_shift: 3; /*The bits are used to scale tick counter threshold. The tick counter is reset when counter value >= 88000/2^i2s_lc_fifo_timeout_shift*/ + uint32_t fifo_timeout_ena: 1; /*The enable bit for FIFO timeout*/ + uint32_t reserved12: 20; + }; + uint32_t val; + } lc_hung_conf; + uint32_t reserved_78; + uint32_t reserved_7c; + union { + struct { + uint32_t y_max: 16; /*don't use*/ + uint32_t y_min: 16; /*don't use*/ + }; + uint32_t val; + } cvsd_conf0; + union { + struct { + uint32_t sigma_max: 16; /*don't use*/ + uint32_t sigma_min: 16; /*don't use*/ + }; + uint32_t val; + } cvsd_conf1; + union { + struct { + uint32_t cvsd_k: 3; /*don't use*/ + uint32_t cvsd_j: 3; /*don't use*/ + uint32_t cvsd_beta: 10; /*don't use*/ + uint32_t cvsd_h: 3; /*don't use*/ + uint32_t reserved19:13; /*don't use*/ + }; + uint32_t val; + } cvsd_conf2; + union { + struct { + uint32_t good_pack_max: 6; /*don't use*/ + uint32_t n_err_seg: 3; /*don't use*/ + uint32_t shift_rate: 3; /*don't use*/ + uint32_t max_slide_sample: 8; /*don't use*/ + uint32_t pack_len_8k: 5; /*don't use*/ + uint32_t n_min_err: 3; /*don't use*/ + uint32_t reserved28: 4; /*don't use*/ + }; + uint32_t val; + } plc_conf0; + union { + struct { + uint32_t bad_cef_atten_para: 8; /*don't use*/ + uint32_t bad_cef_atten_para_shift: 4; /*don't use*/ + uint32_t bad_ola_win2_para_shift: 4; /*don't use*/ + uint32_t bad_ola_win2_para: 8; /*don't use*/ + uint32_t slide_win_len: 8; /*don't use*/ + }; + uint32_t val; + } plc_conf1; + union { + struct { + uint32_t cvsd_seg_mod: 2; /*don't use*/ + uint32_t min_period: 5; /*don't use*/ + uint32_t reserved7: 25; /*don't use*/ + }; + uint32_t val; + } plc_conf2; + union { + struct { + uint32_t en: 1; /*don't use*/ + uint32_t chan_mod: 1; /*don't use*/ + uint32_t cvsd_dec_pack_err: 1; /*don't use*/ + uint32_t cvsd_pack_len_8k: 5; /*don't use*/ + uint32_t cvsd_inf_en: 1; /*don't use*/ + uint32_t cvsd_dec_start: 1; /*don't use*/ + uint32_t cvsd_dec_reset: 1; /*don't use*/ + uint32_t plc_en: 1; /*don't use*/ + uint32_t plc2dma_en: 1; /*don't use*/ + uint32_t reserved13: 19; /*don't use*/ + }; + uint32_t val; + } esco_conf0; + union { + struct { + uint32_t with_en: 1; /*don't use*/ + uint32_t no_en: 1; /*don't use*/ + uint32_t cvsd_enc_start: 1; /*don't use*/ + uint32_t cvsd_enc_reset: 1; /*don't use*/ + uint32_t reserved4: 28; /*don't use*/ + }; + uint32_t val; + } sco_conf0; + union { + struct { + uint32_t tx_pcm_conf: 3; /*Compress/Decompress module configuration bits. 0: decompress transmitted data 1:compress transmitted data*/ + uint32_t tx_pcm_bypass: 1; /*Set this bit to bypass Compress/Decompress module for transmitted data.*/ + uint32_t rx_pcm_conf: 3; /*Compress/Decompress module configuration bits. 0: decompress received data 1:compress received data*/ + uint32_t rx_pcm_bypass: 1; /*Set this bit to bypass Compress/Decompress module for received data.*/ + uint32_t tx_stop_en: 1; /*Set this bit to stop disable output BCK signal and WS signal when tx FIFO is emtpy*/ + uint32_t tx_zeros_rm_en: 1; /*don't use*/ + uint32_t reserved10: 22; + }; + uint32_t val; + } conf1; + union { + struct { + uint32_t fifo_force_pd: 1; /*Force FIFO power-down*/ + uint32_t fifo_force_pu: 1; /*Force FIFO power-up*/ + uint32_t plc_mem_force_pd: 1; + uint32_t plc_mem_force_pu: 1; + uint32_t reserved4: 28; + }; + uint32_t val; + } pd_conf; + union { + struct { + uint32_t camera_en: 1; /*Set this bit to enable camera mode*/ + uint32_t lcd_tx_wrx2_en: 1; /*LCD WR double for one datum.*/ + uint32_t lcd_tx_sdx2_en: 1; /*Set this bit to duplicate data pairs (Frame Form 2) in LCD mode.*/ + uint32_t data_enable_test_en: 1; /*for debug camera mode enable*/ + uint32_t data_enable: 1; /*for debug camera mode enable*/ + uint32_t lcd_en: 1; /*Set this bit to enable LCD mode*/ + uint32_t ext_adc_start_en: 1; /*Set this bit to enable the function that ADC mode is triggered by external signal.*/ + uint32_t inter_valid_en: 1; /*Set this bit to enable camera internal valid*/ + uint32_t cam_sync_fifo_reset: 1; /*Set this bit to reset cam_sync_fifo*/ + uint32_t cam_clk_loopback: 1; /*Set this bit to loopback cam_clk from i2s_rx*/ + uint32_t i_v_sync_filter_en: 1; + uint32_t i_v_sync_filter_thres: 3; + uint32_t reserved14: 18; + }; + uint32_t val; + } conf2; + union { + struct { + uint32_t clkm_div_num: 8; /*Integral I2S clock divider value*/ + uint32_t clkm_div_b: 6; /*Fractional clock divider numerator value*/ + uint32_t clkm_div_a: 6; /*Fractional clock divider denominator value*/ + uint32_t clk_en: 1; /*Set this bit to enable clk gate*/ + uint32_t clk_sel: 2; /*Set this bit to enable clk_apll*/ + uint32_t reserved23: 9; + }; + uint32_t val; + } clkm_conf; + union { + struct { + uint32_t tx_bck_div_num: 6; /*Bit clock configuration bits in transmitter mode.*/ + uint32_t rx_bck_div_num: 6; /*Bit clock configuration bits in receiver mode.*/ + uint32_t tx_bits_mod: 6; /*Set the bits to configure bit length of I2S transmitter channel.*/ + uint32_t rx_bits_mod: 6; /*Set the bits to configure bit length of I2S receiver channel.*/ + uint32_t reserved24: 8; + }; + uint32_t val; + } sample_rate_conf; + union { + struct { + uint32_t tx_pdm_en: 1; /*Set this bit to enable transmitter PDM mode*/ + uint32_t rx_pdm_en: 1; /*Set this bit to enable receiver PDM mode*/ + uint32_t pcm2pdm_conv_en: 1; /*Set this bit to enable PCM-to-PDM converter*/ + uint32_t pdm2pcm_conv_en: 1; /*Set this bit to enable PDM-to-PCM converter*/ + uint32_t tx_sinc_osr2: 4; /*upsample rate = 64 * reg_tx_pdm_sinc_osr2*/ + uint32_t tx_prescale: 8; /*set to 0*/ + uint32_t tx_hp_in_shift: 2; /*Adjust size of input signal to filter module. 0: divided by 2 1:multiplied by 1 2:multiplied by 2 3:multiplied by 4*/ + uint32_t tx_lp_in_shift: 2; /*Adjust size of input signal to filter module. 0: divided by 2 1:multiplied by 1 2:multiplied by 2 3:multiplied by 4*/ + uint32_t tx_sinc_in_shift: 2; /*Adjust size of input signal to filter module. 0: divided by 2 1:multiplied by 1 2:multiplied by 2 3:multiplied by 4*/ + uint32_t tx_sigmadelta_in_shift: 2; /*Adjust size of input signal to filter module. 0: divided by 2 1:multiplied by 1 2:multiplied by 2 3:multiplied by 4*/ + uint32_t rx_sinc_dsr_16_en: 1; /*PDM down-sampling rate for filter group1 in receiver mode. 0: downsample rate = 64 1:downsample rate = 128*/ + uint32_t txhp_bypass: 1; /*Set this bit to enable tx pdm hp filter bypass*/ + uint32_t tx_chan_mod: 2; /*pdm tx channel mode*/ + uint32_t tx_way_mode: 2; /*0/1 pdm rx use one-way*/ + uint32_t rx_way_mode: 2; /*0/1 pdm rx use one-way*/ + }; + uint32_t val; + } pdm_conf; + union { + struct { + uint32_t tx_pdm_fs: 10; /*PCM-to-PDM converter PCM frequency parameter*/ + uint32_t tx_pdm_fp: 10; /*PCM-to-PDM converter PDM frequency parameter*/ + uint32_t reserved20:12; + }; + uint32_t val; + } pdm_freq_conf; + union { + struct { + uint32_t tx_idle: 1; /*1: i2s_tx is idle state*/ + uint32_t reserved1: 31; + }; + uint32_t val; + } state; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t date; /**/ +} i2s_dev_t; +extern i2s_dev_t I2S0; +extern i2s_dev_t I2S1; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_I2S_STRUCT_H_ */ \ No newline at end of file diff --git a/components/soc/esp32s2beta/include/soc/interrupt_reg.h b/components/soc/esp32s2beta/include/soc/interrupt_reg.h new file mode 100644 index 0000000000..d04f22928b --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/interrupt_reg.h @@ -0,0 +1,772 @@ +// Copyright 2017-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_INTERRUPT_REG_H_ +#define _SOC_INTERRUPT_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define DPORT_PRO_MAC_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x000) +/* DPORT_PRO_MAC_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_MAC_INTR_MAP 0x0000001F +#define DPORT_PRO_MAC_INTR_MAP_M ((DPORT_PRO_MAC_INTR_MAP_V)<<(DPORT_PRO_MAC_INTR_MAP_S)) +#define DPORT_PRO_MAC_INTR_MAP_V 0x1F +#define DPORT_PRO_MAC_INTR_MAP_S 0 + +#define DPORT_PRO_MAC_NMI_MAP_REG (DR_REG_INTERRUPT_BASE + 0x004) +/* DPORT_PRO_MAC_NMI_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_MAC_NMI_MAP 0x0000001F +#define DPORT_PRO_MAC_NMI_MAP_M ((DPORT_PRO_MAC_NMI_MAP_V)<<(DPORT_PRO_MAC_NMI_MAP_S)) +#define DPORT_PRO_MAC_NMI_MAP_V 0x1F +#define DPORT_PRO_MAC_NMI_MAP_S 0 + +#define DPORT_PRO_PWR_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x008) +/* DPORT_PRO_PWR_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PWR_INTR_MAP 0x0000001F +#define DPORT_PRO_PWR_INTR_MAP_M ((DPORT_PRO_PWR_INTR_MAP_V)<<(DPORT_PRO_PWR_INTR_MAP_S)) +#define DPORT_PRO_PWR_INTR_MAP_V 0x1F +#define DPORT_PRO_PWR_INTR_MAP_S 0 + +#define DPORT_PRO_BB_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x00C) +/* DPORT_PRO_BB_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_BB_INT_MAP 0x0000001F +#define DPORT_PRO_BB_INT_MAP_M ((DPORT_PRO_BB_INT_MAP_V)<<(DPORT_PRO_BB_INT_MAP_S)) +#define DPORT_PRO_BB_INT_MAP_V 0x1F +#define DPORT_PRO_BB_INT_MAP_S 0 + +#define DPORT_PRO_BT_MAC_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x010) +/* DPORT_PRO_BT_MAC_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_BT_MAC_INT_MAP 0x0000001F +#define DPORT_PRO_BT_MAC_INT_MAP_M ((DPORT_PRO_BT_MAC_INT_MAP_V)<<(DPORT_PRO_BT_MAC_INT_MAP_S)) +#define DPORT_PRO_BT_MAC_INT_MAP_V 0x1F +#define DPORT_PRO_BT_MAC_INT_MAP_S 0 + +#define DPORT_PRO_BT_BB_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x014) +/* DPORT_PRO_BT_BB_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_BT_BB_INT_MAP 0x0000001F +#define DPORT_PRO_BT_BB_INT_MAP_M ((DPORT_PRO_BT_BB_INT_MAP_V)<<(DPORT_PRO_BT_BB_INT_MAP_S)) +#define DPORT_PRO_BT_BB_INT_MAP_V 0x1F +#define DPORT_PRO_BT_BB_INT_MAP_S 0 + +#define DPORT_PRO_BT_BB_NMI_MAP_REG (DR_REG_INTERRUPT_BASE + 0x018) +/* DPORT_PRO_BT_BB_NMI_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_BT_BB_NMI_MAP 0x0000001F +#define DPORT_PRO_BT_BB_NMI_MAP_M ((DPORT_PRO_BT_BB_NMI_MAP_V)<<(DPORT_PRO_BT_BB_NMI_MAP_S)) +#define DPORT_PRO_BT_BB_NMI_MAP_V 0x1F +#define DPORT_PRO_BT_BB_NMI_MAP_S 0 + +#define DPORT_PRO_RWBT_IRQ_MAP_REG (DR_REG_INTERRUPT_BASE + 0x01C) +/* DPORT_PRO_RWBT_IRQ_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_RWBT_IRQ_MAP 0x0000001F +#define DPORT_PRO_RWBT_IRQ_MAP_M ((DPORT_PRO_RWBT_IRQ_MAP_V)<<(DPORT_PRO_RWBT_IRQ_MAP_S)) +#define DPORT_PRO_RWBT_IRQ_MAP_V 0x1F +#define DPORT_PRO_RWBT_IRQ_MAP_S 0 + +#define DPORT_PRO_RWBLE_IRQ_MAP_REG (DR_REG_INTERRUPT_BASE + 0x020) +/* DPORT_PRO_RWBLE_IRQ_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_RWBLE_IRQ_MAP 0x0000001F +#define DPORT_PRO_RWBLE_IRQ_MAP_M ((DPORT_PRO_RWBLE_IRQ_MAP_V)<<(DPORT_PRO_RWBLE_IRQ_MAP_S)) +#define DPORT_PRO_RWBLE_IRQ_MAP_V 0x1F +#define DPORT_PRO_RWBLE_IRQ_MAP_S 0 + +#define DPORT_PRO_RWBT_NMI_MAP_REG (DR_REG_INTERRUPT_BASE + 0x024) +/* DPORT_PRO_RWBT_NMI_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_RWBT_NMI_MAP 0x0000001F +#define DPORT_PRO_RWBT_NMI_MAP_M ((DPORT_PRO_RWBT_NMI_MAP_V)<<(DPORT_PRO_RWBT_NMI_MAP_S)) +#define DPORT_PRO_RWBT_NMI_MAP_V 0x1F +#define DPORT_PRO_RWBT_NMI_MAP_S 0 + +#define DPORT_PRO_RWBLE_NMI_MAP_REG (DR_REG_INTERRUPT_BASE + 0x028) +/* DPORT_PRO_RWBLE_NMI_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_RWBLE_NMI_MAP 0x0000001F +#define DPORT_PRO_RWBLE_NMI_MAP_M ((DPORT_PRO_RWBLE_NMI_MAP_V)<<(DPORT_PRO_RWBLE_NMI_MAP_S)) +#define DPORT_PRO_RWBLE_NMI_MAP_V 0x1F +#define DPORT_PRO_RWBLE_NMI_MAP_S 0 + +#define DPORT_PRO_SLC0_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x02C) +/* DPORT_PRO_SLC0_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SLC0_INTR_MAP 0x0000001F +#define DPORT_PRO_SLC0_INTR_MAP_M ((DPORT_PRO_SLC0_INTR_MAP_V)<<(DPORT_PRO_SLC0_INTR_MAP_S)) +#define DPORT_PRO_SLC0_INTR_MAP_V 0x1F +#define DPORT_PRO_SLC0_INTR_MAP_S 0 + +#define DPORT_PRO_SLC1_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x030) +/* DPORT_PRO_SLC1_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SLC1_INTR_MAP 0x0000001F +#define DPORT_PRO_SLC1_INTR_MAP_M ((DPORT_PRO_SLC1_INTR_MAP_V)<<(DPORT_PRO_SLC1_INTR_MAP_S)) +#define DPORT_PRO_SLC1_INTR_MAP_V 0x1F +#define DPORT_PRO_SLC1_INTR_MAP_S 0 + +#define DPORT_PRO_UHCI0_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x034) +/* DPORT_PRO_UHCI0_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_UHCI0_INTR_MAP 0x0000001F +#define DPORT_PRO_UHCI0_INTR_MAP_M ((DPORT_PRO_UHCI0_INTR_MAP_V)<<(DPORT_PRO_UHCI0_INTR_MAP_S)) +#define DPORT_PRO_UHCI0_INTR_MAP_V 0x1F +#define DPORT_PRO_UHCI0_INTR_MAP_S 0 + +#define DPORT_PRO_UHCI1_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x038) +/* DPORT_PRO_UHCI1_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_UHCI1_INTR_MAP 0x0000001F +#define DPORT_PRO_UHCI1_INTR_MAP_M ((DPORT_PRO_UHCI1_INTR_MAP_V)<<(DPORT_PRO_UHCI1_INTR_MAP_S)) +#define DPORT_PRO_UHCI1_INTR_MAP_V 0x1F +#define DPORT_PRO_UHCI1_INTR_MAP_S 0 + +#define DPORT_PRO_TG_T0_LEVEL_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x03C) +/* DPORT_PRO_TG_T0_LEVEL_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG_T0_LEVEL_INT_MAP 0x0000001F +#define DPORT_PRO_TG_T0_LEVEL_INT_MAP_M ((DPORT_PRO_TG_T0_LEVEL_INT_MAP_V)<<(DPORT_PRO_TG_T0_LEVEL_INT_MAP_S)) +#define DPORT_PRO_TG_T0_LEVEL_INT_MAP_V 0x1F +#define DPORT_PRO_TG_T0_LEVEL_INT_MAP_S 0 + +#define DPORT_PRO_TG_T1_LEVEL_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x040) +/* DPORT_PRO_TG_T1_LEVEL_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG_T1_LEVEL_INT_MAP 0x0000001F +#define DPORT_PRO_TG_T1_LEVEL_INT_MAP_M ((DPORT_PRO_TG_T1_LEVEL_INT_MAP_V)<<(DPORT_PRO_TG_T1_LEVEL_INT_MAP_S)) +#define DPORT_PRO_TG_T1_LEVEL_INT_MAP_V 0x1F +#define DPORT_PRO_TG_T1_LEVEL_INT_MAP_S 0 + +#define DPORT_PRO_TG_WDT_LEVEL_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x044) +/* DPORT_PRO_TG_WDT_LEVEL_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG_WDT_LEVEL_INT_MAP 0x0000001F +#define DPORT_PRO_TG_WDT_LEVEL_INT_MAP_M ((DPORT_PRO_TG_WDT_LEVEL_INT_MAP_V)<<(DPORT_PRO_TG_WDT_LEVEL_INT_MAP_S)) +#define DPORT_PRO_TG_WDT_LEVEL_INT_MAP_V 0x1F +#define DPORT_PRO_TG_WDT_LEVEL_INT_MAP_S 0 + +#define DPORT_PRO_TG_LACT_LEVEL_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x048) +/* DPORT_PRO_TG_LACT_LEVEL_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG_LACT_LEVEL_INT_MAP 0x0000001F +#define DPORT_PRO_TG_LACT_LEVEL_INT_MAP_M ((DPORT_PRO_TG_LACT_LEVEL_INT_MAP_V)<<(DPORT_PRO_TG_LACT_LEVEL_INT_MAP_S)) +#define DPORT_PRO_TG_LACT_LEVEL_INT_MAP_V 0x1F +#define DPORT_PRO_TG_LACT_LEVEL_INT_MAP_S 0 + +#define DPORT_PRO_TG1_T0_LEVEL_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x04C) +/* DPORT_PRO_TG1_T0_LEVEL_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG1_T0_LEVEL_INT_MAP 0x0000001F +#define DPORT_PRO_TG1_T0_LEVEL_INT_MAP_M ((DPORT_PRO_TG1_T0_LEVEL_INT_MAP_V)<<(DPORT_PRO_TG1_T0_LEVEL_INT_MAP_S)) +#define DPORT_PRO_TG1_T0_LEVEL_INT_MAP_V 0x1F +#define DPORT_PRO_TG1_T0_LEVEL_INT_MAP_S 0 + +#define DPORT_PRO_TG1_T1_LEVEL_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x050) +/* DPORT_PRO_TG1_T1_LEVEL_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG1_T1_LEVEL_INT_MAP 0x0000001F +#define DPORT_PRO_TG1_T1_LEVEL_INT_MAP_M ((DPORT_PRO_TG1_T1_LEVEL_INT_MAP_V)<<(DPORT_PRO_TG1_T1_LEVEL_INT_MAP_S)) +#define DPORT_PRO_TG1_T1_LEVEL_INT_MAP_V 0x1F +#define DPORT_PRO_TG1_T1_LEVEL_INT_MAP_S 0 + +#define DPORT_PRO_TG1_WDT_LEVEL_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x054) +/* DPORT_PRO_TG1_WDT_LEVEL_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG1_WDT_LEVEL_INT_MAP 0x0000001F +#define DPORT_PRO_TG1_WDT_LEVEL_INT_MAP_M ((DPORT_PRO_TG1_WDT_LEVEL_INT_MAP_V)<<(DPORT_PRO_TG1_WDT_LEVEL_INT_MAP_S)) +#define DPORT_PRO_TG1_WDT_LEVEL_INT_MAP_V 0x1F +#define DPORT_PRO_TG1_WDT_LEVEL_INT_MAP_S 0 + +#define DPORT_PRO_TG1_LACT_LEVEL_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x058) +/* DPORT_PRO_TG1_LACT_LEVEL_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG1_LACT_LEVEL_INT_MAP 0x0000001F +#define DPORT_PRO_TG1_LACT_LEVEL_INT_MAP_M ((DPORT_PRO_TG1_LACT_LEVEL_INT_MAP_V)<<(DPORT_PRO_TG1_LACT_LEVEL_INT_MAP_S)) +#define DPORT_PRO_TG1_LACT_LEVEL_INT_MAP_V 0x1F +#define DPORT_PRO_TG1_LACT_LEVEL_INT_MAP_S 0 + +#define DPORT_PRO_GPIO_DPORT_PRO_MAP_REG (DR_REG_INTERRUPT_BASE + 0x05C) +/* DPORT_PRO_GPIO_DPORT_PRO_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_GPIO_DPORT_PRO_MAP 0x0000001F +#define DPORT_PRO_GPIO_DPORT_PRO_MAP_M ((DPORT_PRO_GPIO_DPORT_PRO_MAP_V)<<(DPORT_PRO_GPIO_DPORT_PRO_MAP_S)) +#define DPORT_PRO_GPIO_DPORT_PRO_MAP_V 0x1F +#define DPORT_PRO_GPIO_DPORT_PRO_MAP_S 0 + +#define DPORT_PRO_GPIO_DPORT_PRO_NMI_MAP_REG (DR_REG_INTERRUPT_BASE + 0x060) +/* DPORT_PRO_GPIO_DPORT_PRO_NMI_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_GPIO_DPORT_PRO_NMI_MAP 0x0000001F +#define DPORT_PRO_GPIO_DPORT_PRO_NMI_MAP_M ((DPORT_PRO_GPIO_DPORT_PRO_NMI_MAP_V)<<(DPORT_PRO_GPIO_DPORT_PRO_NMI_MAP_S)) +#define DPORT_PRO_GPIO_DPORT_PRO_NMI_MAP_V 0x1F +#define DPORT_PRO_GPIO_DPORT_PRO_NMI_MAP_S 0 + +#define DPORT_PRO_GPIO_DPORT_APP_MAP_REG (DR_REG_INTERRUPT_BASE + 0x064) +/* DPORT_PRO_GPIO_DPORT_APP_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_GPIO_DPORT_APP_MAP 0x0000001F +#define DPORT_PRO_GPIO_DPORT_APP_MAP_M ((DPORT_PRO_GPIO_DPORT_APP_MAP_V)<<(DPORT_PRO_GPIO_DPORT_APP_MAP_S)) +#define DPORT_PRO_GPIO_DPORT_APP_MAP_V 0x1F +#define DPORT_PRO_GPIO_DPORT_APP_MAP_S 0 + +#define DPORT_PRO_GPIO_DPORT_APP_NMI_MAP_REG (DR_REG_INTERRUPT_BASE + 0x068) +/* DPORT_PRO_GPIO_DPORT_APP_NMI_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_GPIO_DPORT_APP_NMI_MAP 0x0000001F +#define DPORT_PRO_GPIO_DPORT_APP_NMI_MAP_M ((DPORT_PRO_GPIO_DPORT_APP_NMI_MAP_V)<<(DPORT_PRO_GPIO_DPORT_APP_NMI_MAP_S)) +#define DPORT_PRO_GPIO_DPORT_APP_NMI_MAP_V 0x1F +#define DPORT_PRO_GPIO_DPORT_APP_NMI_MAP_S 0 + +#define DPORT_PRO_DEDICATED_GPIO_IN_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x06C) +/* DPORT_PRO_DEDICATED_GPIO_IN_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_DEDICATED_GPIO_IN_INTR_MAP 0x0000001F +#define DPORT_PRO_DEDICATED_GPIO_IN_INTR_MAP_M ((DPORT_PRO_DEDICATED_GPIO_IN_INTR_MAP_V)<<(DPORT_PRO_DEDICATED_GPIO_IN_INTR_MAP_S)) +#define DPORT_PRO_DEDICATED_GPIO_IN_INTR_MAP_V 0x1F +#define DPORT_PRO_DEDICATED_GPIO_IN_INTR_MAP_S 0 + +#define DPORT_PRO_CPU_INTR_FROM_CPU_0_MAP_REG (DR_REG_INTERRUPT_BASE + 0x070) +/* DPORT_PRO_CPU_INTR_FROM_CPU_0_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_CPU_INTR_FROM_CPU_0_MAP 0x0000001F +#define DPORT_PRO_CPU_INTR_FROM_CPU_0_MAP_M ((DPORT_PRO_CPU_INTR_FROM_CPU_0_MAP_V)<<(DPORT_PRO_CPU_INTR_FROM_CPU_0_MAP_S)) +#define DPORT_PRO_CPU_INTR_FROM_CPU_0_MAP_V 0x1F +#define DPORT_PRO_CPU_INTR_FROM_CPU_0_MAP_S 0 + +#define DPORT_PRO_CPU_INTR_FROM_CPU_1_MAP_REG (DR_REG_INTERRUPT_BASE + 0x074) +/* DPORT_PRO_CPU_INTR_FROM_CPU_1_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_CPU_INTR_FROM_CPU_1_MAP 0x0000001F +#define DPORT_PRO_CPU_INTR_FROM_CPU_1_MAP_M ((DPORT_PRO_CPU_INTR_FROM_CPU_1_MAP_V)<<(DPORT_PRO_CPU_INTR_FROM_CPU_1_MAP_S)) +#define DPORT_PRO_CPU_INTR_FROM_CPU_1_MAP_V 0x1F +#define DPORT_PRO_CPU_INTR_FROM_CPU_1_MAP_S 0 + +#define DPORT_PRO_CPU_INTR_FROM_CPU_2_MAP_REG (DR_REG_INTERRUPT_BASE + 0x078) +/* DPORT_PRO_CPU_INTR_FROM_CPU_2_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_CPU_INTR_FROM_CPU_2_MAP 0x0000001F +#define DPORT_PRO_CPU_INTR_FROM_CPU_2_MAP_M ((DPORT_PRO_CPU_INTR_FROM_CPU_2_MAP_V)<<(DPORT_PRO_CPU_INTR_FROM_CPU_2_MAP_S)) +#define DPORT_PRO_CPU_INTR_FROM_CPU_2_MAP_V 0x1F +#define DPORT_PRO_CPU_INTR_FROM_CPU_2_MAP_S 0 + +#define DPORT_PRO_CPU_INTR_FROM_CPU_3_MAP_REG (DR_REG_INTERRUPT_BASE + 0x07C) +/* DPORT_PRO_CPU_INTR_FROM_CPU_3_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_CPU_INTR_FROM_CPU_3_MAP 0x0000001F +#define DPORT_PRO_CPU_INTR_FROM_CPU_3_MAP_M ((DPORT_PRO_CPU_INTR_FROM_CPU_3_MAP_V)<<(DPORT_PRO_CPU_INTR_FROM_CPU_3_MAP_S)) +#define DPORT_PRO_CPU_INTR_FROM_CPU_3_MAP_V 0x1F +#define DPORT_PRO_CPU_INTR_FROM_CPU_3_MAP_S 0 + +#define DPORT_PRO_SPI_INTR_1_MAP_REG (DR_REG_INTERRUPT_BASE + 0x080) +/* DPORT_PRO_SPI_INTR_1_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SPI_INTR_1_MAP 0x0000001F +#define DPORT_PRO_SPI_INTR_1_MAP_M ((DPORT_PRO_SPI_INTR_1_MAP_V)<<(DPORT_PRO_SPI_INTR_1_MAP_S)) +#define DPORT_PRO_SPI_INTR_1_MAP_V 0x1F +#define DPORT_PRO_SPI_INTR_1_MAP_S 0 + +#define DPORT_PRO_SPI_INTR_2_MAP_REG (DR_REG_INTERRUPT_BASE + 0x084) +/* DPORT_PRO_SPI_INTR_2_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SPI_INTR_2_MAP 0x0000001F +#define DPORT_PRO_SPI_INTR_2_MAP_M ((DPORT_PRO_SPI_INTR_2_MAP_V)<<(DPORT_PRO_SPI_INTR_2_MAP_S)) +#define DPORT_PRO_SPI_INTR_2_MAP_V 0x1F +#define DPORT_PRO_SPI_INTR_2_MAP_S 0 + +#define DPORT_PRO_SPI_INTR_3_MAP_REG (DR_REG_INTERRUPT_BASE + 0x088) +/* DPORT_PRO_SPI_INTR_3_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SPI_INTR_3_MAP 0x0000001F +#define DPORT_PRO_SPI_INTR_3_MAP_M ((DPORT_PRO_SPI_INTR_3_MAP_V)<<(DPORT_PRO_SPI_INTR_3_MAP_S)) +#define DPORT_PRO_SPI_INTR_3_MAP_V 0x1F +#define DPORT_PRO_SPI_INTR_3_MAP_S 0 + +#define DPORT_PRO_I2S0_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x08C) +/* DPORT_PRO_I2S0_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_I2S0_INT_MAP 0x0000001F +#define DPORT_PRO_I2S0_INT_MAP_M ((DPORT_PRO_I2S0_INT_MAP_V)<<(DPORT_PRO_I2S0_INT_MAP_S)) +#define DPORT_PRO_I2S0_INT_MAP_V 0x1F +#define DPORT_PRO_I2S0_INT_MAP_S 0 + +#define DPORT_PRO_I2S1_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x090) +/* DPORT_PRO_I2S1_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_I2S1_INT_MAP 0x0000001F +#define DPORT_PRO_I2S1_INT_MAP_M ((DPORT_PRO_I2S1_INT_MAP_V)<<(DPORT_PRO_I2S1_INT_MAP_S)) +#define DPORT_PRO_I2S1_INT_MAP_V 0x1F +#define DPORT_PRO_I2S1_INT_MAP_S 0 + +#define DPORT_PRO_UART_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x094) +/* DPORT_PRO_UART_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_UART_INTR_MAP 0x0000001F +#define DPORT_PRO_UART_INTR_MAP_M ((DPORT_PRO_UART_INTR_MAP_V)<<(DPORT_PRO_UART_INTR_MAP_S)) +#define DPORT_PRO_UART_INTR_MAP_V 0x1F +#define DPORT_PRO_UART_INTR_MAP_S 0 + +#define DPORT_PRO_UART1_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x098) +/* DPORT_PRO_UART1_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_UART1_INTR_MAP 0x0000001F +#define DPORT_PRO_UART1_INTR_MAP_M ((DPORT_PRO_UART1_INTR_MAP_V)<<(DPORT_PRO_UART1_INTR_MAP_S)) +#define DPORT_PRO_UART1_INTR_MAP_V 0x1F +#define DPORT_PRO_UART1_INTR_MAP_S 0 + +#define DPORT_PRO_UART2_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x09C) +/* DPORT_PRO_UART2_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_UART2_INTR_MAP 0x0000001F +#define DPORT_PRO_UART2_INTR_MAP_M ((DPORT_PRO_UART2_INTR_MAP_V)<<(DPORT_PRO_UART2_INTR_MAP_S)) +#define DPORT_PRO_UART2_INTR_MAP_V 0x1F +#define DPORT_PRO_UART2_INTR_MAP_S 0 + +#define DPORT_PRO_SDIO_HOST_DPORT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0A0) +/* DPORT_PRO_SDIO_HOST_DPORT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SDIO_HOST_DPORT_MAP 0x0000001F +#define DPORT_PRO_SDIO_HOST_DPORT_MAP_M ((DPORT_PRO_SDIO_HOST_DPORT_MAP_V)<<(DPORT_PRO_SDIO_HOST_DPORT_MAP_S)) +#define DPORT_PRO_SDIO_HOST_DPORT_MAP_V 0x1F +#define DPORT_PRO_SDIO_HOST_DPORT_MAP_S 0 + +#define DPORT_PRO_PWM0_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0A4) +/* DPORT_PRO_PWM0_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PWM0_INTR_MAP 0x0000001F +#define DPORT_PRO_PWM0_INTR_MAP_M ((DPORT_PRO_PWM0_INTR_MAP_V)<<(DPORT_PRO_PWM0_INTR_MAP_S)) +#define DPORT_PRO_PWM0_INTR_MAP_V 0x1F +#define DPORT_PRO_PWM0_INTR_MAP_S 0 + +#define DPORT_PRO_PWM1_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0A8) +/* DPORT_PRO_PWM1_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PWM1_INTR_MAP 0x0000001F +#define DPORT_PRO_PWM1_INTR_MAP_M ((DPORT_PRO_PWM1_INTR_MAP_V)<<(DPORT_PRO_PWM1_INTR_MAP_S)) +#define DPORT_PRO_PWM1_INTR_MAP_V 0x1F +#define DPORT_PRO_PWM1_INTR_MAP_S 0 + +#define DPORT_PRO_PWM2_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0AC) +/* DPORT_PRO_PWM2_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PWM2_INTR_MAP 0x0000001F +#define DPORT_PRO_PWM2_INTR_MAP_M ((DPORT_PRO_PWM2_INTR_MAP_V)<<(DPORT_PRO_PWM2_INTR_MAP_S)) +#define DPORT_PRO_PWM2_INTR_MAP_V 0x1F +#define DPORT_PRO_PWM2_INTR_MAP_S 0 + +#define DPORT_PRO_PWM3_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0B0) +/* DPORT_PRO_PWM3_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PWM3_INTR_MAP 0x0000001F +#define DPORT_PRO_PWM3_INTR_MAP_M ((DPORT_PRO_PWM3_INTR_MAP_V)<<(DPORT_PRO_PWM3_INTR_MAP_S)) +#define DPORT_PRO_PWM3_INTR_MAP_V 0x1F +#define DPORT_PRO_PWM3_INTR_MAP_S 0 + +#define DPORT_PRO_LEDC_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0B4) +/* DPORT_PRO_LEDC_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_LEDC_INT_MAP 0x0000001F +#define DPORT_PRO_LEDC_INT_MAP_M ((DPORT_PRO_LEDC_INT_MAP_V)<<(DPORT_PRO_LEDC_INT_MAP_S)) +#define DPORT_PRO_LEDC_INT_MAP_V 0x1F +#define DPORT_PRO_LEDC_INT_MAP_S 0 + +#define DPORT_PRO_EFUSE_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0B8) +/* DPORT_PRO_EFUSE_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_EFUSE_INT_MAP 0x0000001F +#define DPORT_PRO_EFUSE_INT_MAP_M ((DPORT_PRO_EFUSE_INT_MAP_V)<<(DPORT_PRO_EFUSE_INT_MAP_S)) +#define DPORT_PRO_EFUSE_INT_MAP_V 0x1F +#define DPORT_PRO_EFUSE_INT_MAP_S 0 + +#define DPORT_PRO_CAN_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0BC) +/* DPORT_PRO_CAN_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_CAN_INT_MAP 0x0000001F +#define DPORT_PRO_CAN_INT_MAP_M ((DPORT_PRO_CAN_INT_MAP_V)<<(DPORT_PRO_CAN_INT_MAP_S)) +#define DPORT_PRO_CAN_INT_MAP_V 0x1F +#define DPORT_PRO_CAN_INT_MAP_S 0 + +#define DPORT_PRO_USB_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0C0) +/* DPORT_PRO_USB_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_USB_INTR_MAP 0x0000001F +#define DPORT_PRO_USB_INTR_MAP_M ((DPORT_PRO_USB_INTR_MAP_V)<<(DPORT_PRO_USB_INTR_MAP_S)) +#define DPORT_PRO_USB_INTR_MAP_V 0x1F +#define DPORT_PRO_USB_INTR_MAP_S 0 + +#define DPORT_PRO_RTC_CORE_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0C4) +/* DPORT_PRO_RTC_CORE_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_RTC_CORE_INTR_MAP 0x0000001F +#define DPORT_PRO_RTC_CORE_INTR_MAP_M ((DPORT_PRO_RTC_CORE_INTR_MAP_V)<<(DPORT_PRO_RTC_CORE_INTR_MAP_S)) +#define DPORT_PRO_RTC_CORE_INTR_MAP_V 0x1F +#define DPORT_PRO_RTC_CORE_INTR_MAP_S 0 + +#define DPORT_PRO_RMT_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0C8) +/* DPORT_PRO_RMT_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_RMT_INTR_MAP 0x0000001F +#define DPORT_PRO_RMT_INTR_MAP_M ((DPORT_PRO_RMT_INTR_MAP_V)<<(DPORT_PRO_RMT_INTR_MAP_S)) +#define DPORT_PRO_RMT_INTR_MAP_V 0x1F +#define DPORT_PRO_RMT_INTR_MAP_S 0 + +#define DPORT_PRO_PCNT_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0CC) +/* DPORT_PRO_PCNT_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PCNT_INTR_MAP 0x0000001F +#define DPORT_PRO_PCNT_INTR_MAP_M ((DPORT_PRO_PCNT_INTR_MAP_V)<<(DPORT_PRO_PCNT_INTR_MAP_S)) +#define DPORT_PRO_PCNT_INTR_MAP_V 0x1F +#define DPORT_PRO_PCNT_INTR_MAP_S 0 + +#define DPORT_PRO_I2C_EXT0_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0D0) +/* DPORT_PRO_I2C_EXT0_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_I2C_EXT0_INTR_MAP 0x0000001F +#define DPORT_PRO_I2C_EXT0_INTR_MAP_M ((DPORT_PRO_I2C_EXT0_INTR_MAP_V)<<(DPORT_PRO_I2C_EXT0_INTR_MAP_S)) +#define DPORT_PRO_I2C_EXT0_INTR_MAP_V 0x1F +#define DPORT_PRO_I2C_EXT0_INTR_MAP_S 0 + +#define DPORT_PRO_I2C_EXT1_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0D4) +/* DPORT_PRO_I2C_EXT1_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_I2C_EXT1_INTR_MAP 0x0000001F +#define DPORT_PRO_I2C_EXT1_INTR_MAP_M ((DPORT_PRO_I2C_EXT1_INTR_MAP_V)<<(DPORT_PRO_I2C_EXT1_INTR_MAP_S)) +#define DPORT_PRO_I2C_EXT1_INTR_MAP_V 0x1F +#define DPORT_PRO_I2C_EXT1_INTR_MAP_S 0 + +#define DPORT_PRO_RSA_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0D8) +/* DPORT_PRO_RSA_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_RSA_INTR_MAP 0x0000001F +#define DPORT_PRO_RSA_INTR_MAP_M ((DPORT_PRO_RSA_INTR_MAP_V)<<(DPORT_PRO_RSA_INTR_MAP_S)) +#define DPORT_PRO_RSA_INTR_MAP_V 0x1F +#define DPORT_PRO_RSA_INTR_MAP_S 0 + +#define DPORT_PRO_SPI1_DMA_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0DC) +/* DPORT_PRO_SPI1_DMA_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SPI1_DMA_INT_MAP 0x0000001F +#define DPORT_PRO_SPI1_DMA_INT_MAP_M ((DPORT_PRO_SPI1_DMA_INT_MAP_V)<<(DPORT_PRO_SPI1_DMA_INT_MAP_S)) +#define DPORT_PRO_SPI1_DMA_INT_MAP_V 0x1F +#define DPORT_PRO_SPI1_DMA_INT_MAP_S 0 + +#define DPORT_PRO_SPI2_DMA_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0E0) +/* DPORT_PRO_SPI2_DMA_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SPI2_DMA_INT_MAP 0x0000001F +#define DPORT_PRO_SPI2_DMA_INT_MAP_M ((DPORT_PRO_SPI2_DMA_INT_MAP_V)<<(DPORT_PRO_SPI2_DMA_INT_MAP_S)) +#define DPORT_PRO_SPI2_DMA_INT_MAP_V 0x1F +#define DPORT_PRO_SPI2_DMA_INT_MAP_S 0 + +#define DPORT_PRO_SPI3_DMA_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0E4) +/* DPORT_PRO_SPI3_DMA_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SPI3_DMA_INT_MAP 0x0000001F +#define DPORT_PRO_SPI3_DMA_INT_MAP_M ((DPORT_PRO_SPI3_DMA_INT_MAP_V)<<(DPORT_PRO_SPI3_DMA_INT_MAP_S)) +#define DPORT_PRO_SPI3_DMA_INT_MAP_V 0x1F +#define DPORT_PRO_SPI3_DMA_INT_MAP_S 0 + +#define DPORT_PRO_WDG_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0E8) +/* DPORT_PRO_WDG_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_WDG_INT_MAP 0x0000001F +#define DPORT_PRO_WDG_INT_MAP_M ((DPORT_PRO_WDG_INT_MAP_V)<<(DPORT_PRO_WDG_INT_MAP_S)) +#define DPORT_PRO_WDG_INT_MAP_V 0x1F +#define DPORT_PRO_WDG_INT_MAP_S 0 + +#define DPORT_PRO_TIMER_INT1_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0EC) +/* DPORT_PRO_TIMER_INT1_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TIMER_INT1_MAP 0x0000001F +#define DPORT_PRO_TIMER_INT1_MAP_M ((DPORT_PRO_TIMER_INT1_MAP_V)<<(DPORT_PRO_TIMER_INT1_MAP_S)) +#define DPORT_PRO_TIMER_INT1_MAP_V 0x1F +#define DPORT_PRO_TIMER_INT1_MAP_S 0 + +#define DPORT_PRO_TIMER_INT2_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0F0) +/* DPORT_PRO_TIMER_INT2_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TIMER_INT2_MAP 0x0000001F +#define DPORT_PRO_TIMER_INT2_MAP_M ((DPORT_PRO_TIMER_INT2_MAP_V)<<(DPORT_PRO_TIMER_INT2_MAP_S)) +#define DPORT_PRO_TIMER_INT2_MAP_V 0x1F +#define DPORT_PRO_TIMER_INT2_MAP_S 0 + +#define DPORT_PRO_TG_T0_EDGE_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0F4) +/* DPORT_PRO_TG_T0_EDGE_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG_T0_EDGE_INT_MAP 0x0000001F +#define DPORT_PRO_TG_T0_EDGE_INT_MAP_M ((DPORT_PRO_TG_T0_EDGE_INT_MAP_V)<<(DPORT_PRO_TG_T0_EDGE_INT_MAP_S)) +#define DPORT_PRO_TG_T0_EDGE_INT_MAP_V 0x1F +#define DPORT_PRO_TG_T0_EDGE_INT_MAP_S 0 + +#define DPORT_PRO_TG_T1_EDGE_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0F8) +/* DPORT_PRO_TG_T1_EDGE_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG_T1_EDGE_INT_MAP 0x0000001F +#define DPORT_PRO_TG_T1_EDGE_INT_MAP_M ((DPORT_PRO_TG_T1_EDGE_INT_MAP_V)<<(DPORT_PRO_TG_T1_EDGE_INT_MAP_S)) +#define DPORT_PRO_TG_T1_EDGE_INT_MAP_V 0x1F +#define DPORT_PRO_TG_T1_EDGE_INT_MAP_S 0 + +#define DPORT_PRO_TG_WDT_EDGE_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x0FC) +/* DPORT_PRO_TG_WDT_EDGE_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG_WDT_EDGE_INT_MAP 0x0000001F +#define DPORT_PRO_TG_WDT_EDGE_INT_MAP_M ((DPORT_PRO_TG_WDT_EDGE_INT_MAP_V)<<(DPORT_PRO_TG_WDT_EDGE_INT_MAP_S)) +#define DPORT_PRO_TG_WDT_EDGE_INT_MAP_V 0x1F +#define DPORT_PRO_TG_WDT_EDGE_INT_MAP_S 0 + +#define DPORT_PRO_TG_LACT_EDGE_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x100) +/* DPORT_PRO_TG_LACT_EDGE_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG_LACT_EDGE_INT_MAP 0x0000001F +#define DPORT_PRO_TG_LACT_EDGE_INT_MAP_M ((DPORT_PRO_TG_LACT_EDGE_INT_MAP_V)<<(DPORT_PRO_TG_LACT_EDGE_INT_MAP_S)) +#define DPORT_PRO_TG_LACT_EDGE_INT_MAP_V 0x1F +#define DPORT_PRO_TG_LACT_EDGE_INT_MAP_S 0 + +#define DPORT_PRO_TG1_T0_EDGE_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x104) +/* DPORT_PRO_TG1_T0_EDGE_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG1_T0_EDGE_INT_MAP 0x0000001F +#define DPORT_PRO_TG1_T0_EDGE_INT_MAP_M ((DPORT_PRO_TG1_T0_EDGE_INT_MAP_V)<<(DPORT_PRO_TG1_T0_EDGE_INT_MAP_S)) +#define DPORT_PRO_TG1_T0_EDGE_INT_MAP_V 0x1F +#define DPORT_PRO_TG1_T0_EDGE_INT_MAP_S 0 + +#define DPORT_PRO_TG1_T1_EDGE_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x108) +/* DPORT_PRO_TG1_T1_EDGE_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG1_T1_EDGE_INT_MAP 0x0000001F +#define DPORT_PRO_TG1_T1_EDGE_INT_MAP_M ((DPORT_PRO_TG1_T1_EDGE_INT_MAP_V)<<(DPORT_PRO_TG1_T1_EDGE_INT_MAP_S)) +#define DPORT_PRO_TG1_T1_EDGE_INT_MAP_V 0x1F +#define DPORT_PRO_TG1_T1_EDGE_INT_MAP_S 0 + +#define DPORT_PRO_TG1_WDT_EDGE_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x10C) +/* DPORT_PRO_TG1_WDT_EDGE_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG1_WDT_EDGE_INT_MAP 0x0000001F +#define DPORT_PRO_TG1_WDT_EDGE_INT_MAP_M ((DPORT_PRO_TG1_WDT_EDGE_INT_MAP_V)<<(DPORT_PRO_TG1_WDT_EDGE_INT_MAP_S)) +#define DPORT_PRO_TG1_WDT_EDGE_INT_MAP_V 0x1F +#define DPORT_PRO_TG1_WDT_EDGE_INT_MAP_S 0 + +#define DPORT_PRO_TG1_LACT_EDGE_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x110) +/* DPORT_PRO_TG1_LACT_EDGE_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_TG1_LACT_EDGE_INT_MAP 0x0000001F +#define DPORT_PRO_TG1_LACT_EDGE_INT_MAP_M ((DPORT_PRO_TG1_LACT_EDGE_INT_MAP_V)<<(DPORT_PRO_TG1_LACT_EDGE_INT_MAP_S)) +#define DPORT_PRO_TG1_LACT_EDGE_INT_MAP_V 0x1F +#define DPORT_PRO_TG1_LACT_EDGE_INT_MAP_S 0 + +#define DPORT_PRO_CACHE_IA_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x114) +/* DPORT_PRO_CACHE_IA_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_CACHE_IA_INT_MAP 0x0000001F +#define DPORT_PRO_CACHE_IA_INT_MAP_M ((DPORT_PRO_CACHE_IA_INT_MAP_V)<<(DPORT_PRO_CACHE_IA_INT_MAP_S)) +#define DPORT_PRO_CACHE_IA_INT_MAP_V 0x1F +#define DPORT_PRO_CACHE_IA_INT_MAP_S 0 + +#define DPORT_PRO_SYSTIMER_TARGET0_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x118) +/* DPORT_PRO_SYSTIMER_TARGET0_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SYSTIMER_TARGET0_INT_MAP 0x0000001F +#define DPORT_PRO_SYSTIMER_TARGET0_INT_MAP_M ((DPORT_PRO_SYSTIMER_TARGET0_INT_MAP_V)<<(DPORT_PRO_SYSTIMER_TARGET0_INT_MAP_S)) +#define DPORT_PRO_SYSTIMER_TARGET0_INT_MAP_V 0x1F +#define DPORT_PRO_SYSTIMER_TARGET0_INT_MAP_S 0 + +#define DPORT_PRO_SYSTIMER_TARGET1_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x11C) +/* DPORT_PRO_SYSTIMER_TARGET1_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SYSTIMER_TARGET1_INT_MAP 0x0000001F +#define DPORT_PRO_SYSTIMER_TARGET1_INT_MAP_M ((DPORT_PRO_SYSTIMER_TARGET1_INT_MAP_V)<<(DPORT_PRO_SYSTIMER_TARGET1_INT_MAP_S)) +#define DPORT_PRO_SYSTIMER_TARGET1_INT_MAP_V 0x1F +#define DPORT_PRO_SYSTIMER_TARGET1_INT_MAP_S 0 + +#define DPORT_PRO_SYSTIMER_TARGET2_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x120) +/* DPORT_PRO_SYSTIMER_TARGET2_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SYSTIMER_TARGET2_INT_MAP 0x0000001F +#define DPORT_PRO_SYSTIMER_TARGET2_INT_MAP_M ((DPORT_PRO_SYSTIMER_TARGET2_INT_MAP_V)<<(DPORT_PRO_SYSTIMER_TARGET2_INT_MAP_S)) +#define DPORT_PRO_SYSTIMER_TARGET2_INT_MAP_V 0x1F +#define DPORT_PRO_SYSTIMER_TARGET2_INT_MAP_S 0 + +#define DPORT_PRO_ASSIST_DEBUG_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x124) +/* DPORT_PRO_ASSIST_DEBUG_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_ASSIST_DEBUG_INTR_MAP 0x0000001F +#define DPORT_PRO_ASSIST_DEBUG_INTR_MAP_M ((DPORT_PRO_ASSIST_DEBUG_INTR_MAP_V)<<(DPORT_PRO_ASSIST_DEBUG_INTR_MAP_S)) +#define DPORT_PRO_ASSIST_DEBUG_INTR_MAP_V 0x1F +#define DPORT_PRO_ASSIST_DEBUG_INTR_MAP_S 0 + +#define DPORT_PRO_PMS_PRO_IRAM0_ILG_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x128) +/* DPORT_PRO_PMS_PRO_IRAM0_ILG_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PMS_PRO_IRAM0_ILG_INTR_MAP 0x0000001F +#define DPORT_PRO_PMS_PRO_IRAM0_ILG_INTR_MAP_M ((DPORT_PRO_PMS_PRO_IRAM0_ILG_INTR_MAP_V)<<(DPORT_PRO_PMS_PRO_IRAM0_ILG_INTR_MAP_S)) +#define DPORT_PRO_PMS_PRO_IRAM0_ILG_INTR_MAP_V 0x1F +#define DPORT_PRO_PMS_PRO_IRAM0_ILG_INTR_MAP_S 0 + +#define DPORT_PRO_PMS_PRO_DRAM0_ILG_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x12C) +/* DPORT_PRO_PMS_PRO_DRAM0_ILG_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PMS_PRO_DRAM0_ILG_INTR_MAP 0x0000001F +#define DPORT_PRO_PMS_PRO_DRAM0_ILG_INTR_MAP_M ((DPORT_PRO_PMS_PRO_DRAM0_ILG_INTR_MAP_V)<<(DPORT_PRO_PMS_PRO_DRAM0_ILG_INTR_MAP_S)) +#define DPORT_PRO_PMS_PRO_DRAM0_ILG_INTR_MAP_V 0x1F +#define DPORT_PRO_PMS_PRO_DRAM0_ILG_INTR_MAP_S 0 + +#define DPORT_PRO_PMS_PRO_DPORT_ILG_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x130) +/* DPORT_PRO_PMS_PRO_DPORT_ILG_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PMS_PRO_DPORT_ILG_INTR_MAP 0x0000001F +#define DPORT_PRO_PMS_PRO_DPORT_ILG_INTR_MAP_M ((DPORT_PRO_PMS_PRO_DPORT_ILG_INTR_MAP_V)<<(DPORT_PRO_PMS_PRO_DPORT_ILG_INTR_MAP_S)) +#define DPORT_PRO_PMS_PRO_DPORT_ILG_INTR_MAP_V 0x1F +#define DPORT_PRO_PMS_PRO_DPORT_ILG_INTR_MAP_S 0 + +#define DPORT_PRO_PMS_PRO_AHB_ILG_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x134) +/* DPORT_PRO_PMS_PRO_AHB_ILG_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PMS_PRO_AHB_ILG_INTR_MAP 0x0000001F +#define DPORT_PRO_PMS_PRO_AHB_ILG_INTR_MAP_M ((DPORT_PRO_PMS_PRO_AHB_ILG_INTR_MAP_V)<<(DPORT_PRO_PMS_PRO_AHB_ILG_INTR_MAP_S)) +#define DPORT_PRO_PMS_PRO_AHB_ILG_INTR_MAP_V 0x1F +#define DPORT_PRO_PMS_PRO_AHB_ILG_INTR_MAP_S 0 + +#define DPORT_PRO_PMS_PRO_CACHE_ILG_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x138) +/* DPORT_PRO_PMS_PRO_CACHE_ILG_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PMS_PRO_CACHE_ILG_INTR_MAP 0x0000001F +#define DPORT_PRO_PMS_PRO_CACHE_ILG_INTR_MAP_M ((DPORT_PRO_PMS_PRO_CACHE_ILG_INTR_MAP_V)<<(DPORT_PRO_PMS_PRO_CACHE_ILG_INTR_MAP_S)) +#define DPORT_PRO_PMS_PRO_CACHE_ILG_INTR_MAP_V 0x1F +#define DPORT_PRO_PMS_PRO_CACHE_ILG_INTR_MAP_S 0 + +#define DPORT_PRO_PMS_DMA_APB_I_ILG_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x13C) +/* DPORT_PRO_PMS_DMA_APB_I_ILG_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PMS_DMA_APB_I_ILG_INTR_MAP 0x0000001F +#define DPORT_PRO_PMS_DMA_APB_I_ILG_INTR_MAP_M ((DPORT_PRO_PMS_DMA_APB_I_ILG_INTR_MAP_V)<<(DPORT_PRO_PMS_DMA_APB_I_ILG_INTR_MAP_S)) +#define DPORT_PRO_PMS_DMA_APB_I_ILG_INTR_MAP_V 0x1F +#define DPORT_PRO_PMS_DMA_APB_I_ILG_INTR_MAP_S 0 + +#define DPORT_PRO_PMS_DMA_RX_I_ILG_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x140) +/* DPORT_PRO_PMS_DMA_RX_I_ILG_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PMS_DMA_RX_I_ILG_INTR_MAP 0x0000001F +#define DPORT_PRO_PMS_DMA_RX_I_ILG_INTR_MAP_M ((DPORT_PRO_PMS_DMA_RX_I_ILG_INTR_MAP_V)<<(DPORT_PRO_PMS_DMA_RX_I_ILG_INTR_MAP_S)) +#define DPORT_PRO_PMS_DMA_RX_I_ILG_INTR_MAP_V 0x1F +#define DPORT_PRO_PMS_DMA_RX_I_ILG_INTR_MAP_S 0 + +#define DPORT_PRO_PMS_DMA_TX_I_ILG_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x144) +/* DPORT_PRO_PMS_DMA_TX_I_ILG_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_PMS_DMA_TX_I_ILG_INTR_MAP 0x0000001F +#define DPORT_PRO_PMS_DMA_TX_I_ILG_INTR_MAP_M ((DPORT_PRO_PMS_DMA_TX_I_ILG_INTR_MAP_V)<<(DPORT_PRO_PMS_DMA_TX_I_ILG_INTR_MAP_S)) +#define DPORT_PRO_PMS_DMA_TX_I_ILG_INTR_MAP_V 0x1F +#define DPORT_PRO_PMS_DMA_TX_I_ILG_INTR_MAP_S 0 + +#define DPORT_PRO_SPI0_REJECT_CACHE_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x148) +/* DPORT_PRO_SPI0_REJECT_CACHE_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SPI0_REJECT_CACHE_INTR_MAP 0x0000001F +#define DPORT_PRO_SPI0_REJECT_CACHE_INTR_MAP_M ((DPORT_PRO_SPI0_REJECT_CACHE_INTR_MAP_V)<<(DPORT_PRO_SPI0_REJECT_CACHE_INTR_MAP_S)) +#define DPORT_PRO_SPI0_REJECT_CACHE_INTR_MAP_V 0x1F +#define DPORT_PRO_SPI0_REJECT_CACHE_INTR_MAP_S 0 + +#define DPORT_PRO_SPI1_REJECT_CPU_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x14C) +/* DPORT_PRO_SPI1_REJECT_CPU_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SPI1_REJECT_CPU_INTR_MAP 0x0000001F +#define DPORT_PRO_SPI1_REJECT_CPU_INTR_MAP_M ((DPORT_PRO_SPI1_REJECT_CPU_INTR_MAP_V)<<(DPORT_PRO_SPI1_REJECT_CPU_INTR_MAP_S)) +#define DPORT_PRO_SPI1_REJECT_CPU_INTR_MAP_V 0x1F +#define DPORT_PRO_SPI1_REJECT_CPU_INTR_MAP_S 0 + +#define DPORT_PRO_DMA_COPY_INTR_MAP_REG (DR_REG_INTERRUPT_BASE + 0x150) +/* DPORT_PRO_DMA_COPY_INTR_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_DMA_COPY_INTR_MAP 0x0000001F +#define DPORT_PRO_DMA_COPY_INTR_MAP_M ((DPORT_PRO_DMA_COPY_INTR_MAP_V)<<(DPORT_PRO_DMA_COPY_INTR_MAP_S)) +#define DPORT_PRO_DMA_COPY_INTR_MAP_V 0x1F +#define DPORT_PRO_DMA_COPY_INTR_MAP_S 0 + +#define DPORT_PRO_SPI4_DMA_INT_MAP_REG (DR_REG_INTERRUPT_BASE + 0x154) +/* DPORT_PRO_SPI4_DMA_INT_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SPI4_DMA_INT_MAP 0x0000001F +#define DPORT_PRO_SPI4_DMA_INT_MAP_M ((DPORT_PRO_SPI4_DMA_INT_MAP_V)<<(DPORT_PRO_SPI4_DMA_INT_MAP_S)) +#define DPORT_PRO_SPI4_DMA_INT_MAP_V 0x1F +#define DPORT_PRO_SPI4_DMA_INT_MAP_S 0 + +#define DPORT_PRO_SPI_INTR_4_MAP_REG (DR_REG_INTERRUPT_BASE + 0x158) +/* DPORT_PRO_SPI_INTR_4_MAP : R/W ;bitpos:[4:0] ;default: 5'd16 ; */ +/*description: */ +#define DPORT_PRO_SPI_INTR_4_MAP 0x0000001F +#define DPORT_PRO_SPI_INTR_4_MAP_M ((DPORT_PRO_SPI_INTR_4_MAP_V)<<(DPORT_PRO_SPI_INTR_4_MAP_S)) +#define DPORT_PRO_SPI_INTR_4_MAP_V 0x1F +#define DPORT_PRO_SPI_INTR_4_MAP_S 0 + +#define DPORT_PRO_INTR_STATUS_0_REG (DR_REG_INTERRUPT_BASE + 0x15C) +/* DPORT_PRO_INTR_STATUS_0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_PRO_INTR_STATUS_0 0xFFFFFFFF +#define DPORT_PRO_INTR_STATUS_0_M ((DPORT_PRO_INTR_STATUS_0_V)<<(DPORT_PRO_INTR_STATUS_0_S)) +#define DPORT_PRO_INTR_STATUS_0_V 0xFFFFFFFF +#define DPORT_PRO_INTR_STATUS_0_S 0 + +#define DPORT_PRO_INTR_STATUS_1_REG (DR_REG_INTERRUPT_BASE + 0x160) +/* DPORT_PRO_INTR_STATUS_1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_PRO_INTR_STATUS_1 0xFFFFFFFF +#define DPORT_PRO_INTR_STATUS_1_M ((DPORT_PRO_INTR_STATUS_1_V)<<(DPORT_PRO_INTR_STATUS_1_S)) +#define DPORT_PRO_INTR_STATUS_1_V 0xFFFFFFFF +#define DPORT_PRO_INTR_STATUS_1_S 0 + +#define DPORT_PRO_INTR_STATUS_2_REG (DR_REG_INTERRUPT_BASE + 0x164) +/* DPORT_PRO_INTR_STATUS_2 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_PRO_INTR_STATUS_2 0xFFFFFFFF +#define DPORT_PRO_INTR_STATUS_2_M ((DPORT_PRO_INTR_STATUS_2_V)<<(DPORT_PRO_INTR_STATUS_2_S)) +#define DPORT_PRO_INTR_STATUS_2_V 0xFFFFFFFF +#define DPORT_PRO_INTR_STATUS_2_S 0 + +#define INTERRUPT_CLOCK_GATE_REG (DR_REG_INTERRUPT_BASE + 0x168) +/* DPORT_PRO_NMI_MASK_HW : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_NMI_MASK_HW (BIT(1)) +#define DPORT_PRO_NMI_MASK_HW_M (BIT(1)) +#define DPORT_PRO_NMI_MASK_HW_V 0x1 +#define DPORT_PRO_NMI_MASK_HW_S 1 +/* INTERRUPT_CLK_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define INTERRUPT_CLK_EN (BIT(0)) +#define INTERRUPT_CLK_EN_M (BIT(0)) +#define INTERRUPT_CLK_EN_V 0x1 +#define INTERRUPT_CLK_EN_S 0 + +#define INTERRUPT_DATE_REG (DR_REG_INTERRUPT_BASE + 0xFFC) +/* INTERRUPT_DATE : R/W ;bitpos:[27:0] ;default: 28'h1809110 ; */ +/*description: */ +#define INTERRUPT_DATE 0x0FFFFFFF +#define INTERRUPT_DATE_M ((INTERRUPT_DATE_V)<<(INTERRUPT_DATE_S)) +#define INTERRUPT_DATE_V 0xFFFFFFF +#define INTERRUPT_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_INTERRUPT_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/io_mux_reg.h b/components/soc/esp32s2beta/include/soc/io_mux_reg.h new file mode 100644 index 0000000000..da10d62d9d --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/io_mux_reg.h @@ -0,0 +1,391 @@ +// Copyright 2017-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_IO_MUX_REG_H_ +#define _SOC_IO_MUX_REG_H_ + +#include "soc.h" + +/* The following are the bit fields for PERIPHS_IO_MUX_x_U registers */ +/* Output enable in sleep mode */ +#define SLP_OE (BIT(0)) +#define SLP_OE_M (BIT(0)) +#define SLP_OE_V 1 +#define SLP_OE_S 0 +/* Pin used for wakeup from sleep */ +#define SLP_SEL (BIT(1)) +#define SLP_SEL_M (BIT(1)) +#define SLP_SEL_V 1 +#define SLP_SEL_S 1 +/* Pulldown enable in sleep mode */ +#define SLP_PD (BIT(2)) +#define SLP_PD_M (BIT(2)) +#define SLP_PD_V 1 +#define SLP_PD_S 2 +/* Pullup enable in sleep mode */ +#define SLP_PU (BIT(3)) +#define SLP_PU_M (BIT(3)) +#define SLP_PU_V 1 +#define SLP_PU_S 3 +/* Input enable in sleep mode */ +#define SLP_IE (BIT(4)) +#define SLP_IE_M (BIT(4)) +#define SLP_IE_V 1 +#define SLP_IE_S 4 +/* Drive strength in sleep mode */ +#define SLP_DRV 0x3 +#define SLP_DRV_M (SLP_DRV_V << SLP_DRV_S) +#define SLP_DRV_V 0x3 +#define SLP_DRV_S 5 +/* Pulldown enable */ +#define FUN_PD (BIT(7)) +#define FUN_PD_M (BIT(7)) +#define FUN_PD_V 1 +#define FUN_PD_S 7 +/* Pullup enable */ +#define FUN_PU (BIT(8)) +#define FUN_PU_M (BIT(8)) +#define FUN_PU_V 1 +#define FUN_PU_S 8 +/* Input enable */ +#define FUN_IE (BIT(9)) +#define FUN_IE_M (FUN_IE_V << FUN_IE_S) +#define FUN_IE_V 1 +#define FUN_IE_S 9 +/* Drive strength */ +#define FUN_DRV 0x3 +#define FUN_DRV_M (FUN_DRV_V << FUN_DRV_S) +#define FUN_DRV_V 0x3 +#define FUN_DRV_S 10 +/* Function select (possible values are defined for each pin as FUNC_pinname_function below) */ +#define MCU_SEL 0x7 +#define MCU_SEL_M (MCU_SEL_V << MCU_SEL_S) +#define MCU_SEL_V 0x7 +#define MCU_SEL_S 12 + +#define PIN_INPUT_ENABLE(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME,FUN_IE) +#define PIN_INPUT_DISABLE(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME,FUN_IE) +#define PIN_SET_DRV(PIN_NAME, drv) REG_SET_FIELD(PIN_NAME, FUN_DRV, (drv)); +#define PIN_PULLUP_DIS(PIN_NAME) REG_CLR_BIT(PIN_NAME, FUN_PU) +#define PIN_PULLUP_EN(PIN_NAME) REG_SET_BIT(PIN_NAME, FUN_PU) +#define PIN_PULLDWN_DIS(PIN_NAME) REG_CLR_BIT(PIN_NAME, FUN_PD) +#define PIN_PULLDWN_EN(PIN_NAME) REG_SET_BIT(PIN_NAME, FUN_PD) +#define PIN_FUNC_SELECT(PIN_NAME, FUNC) REG_SET_FIELD(PIN_NAME, MCU_SEL, FUNC) + +#define IO_MUX_GPIO0_REG PERIPHS_IO_MUX_GPIO0_U +#define IO_MUX_GPIO1_REG PERIPHS_IO_MUX_GPIO1_U +#define IO_MUX_GPIO2_REG PERIPHS_IO_MUX_GPIO2_U +#define IO_MUX_GPIO3_REG PERIPHS_IO_MUX_GPIO3_U +#define IO_MUX_GPIO4_REG PERIPHS_IO_MUX_GPIO4_U +#define IO_MUX_GPIO5_REG PERIPHS_IO_MUX_GPIO5_U +#define IO_MUX_GPIO6_REG PERIPHS_IO_MUX_GPIO6_U +#define IO_MUX_GPIO7_REG PERIPHS_IO_MUX_GPIO7_U +#define IO_MUX_GPIO8_REG PERIPHS_IO_MUX_GPIO8_U +#define IO_MUX_GPIO9_REG PERIPHS_IO_MUX_GPIO9_U +#define IO_MUX_GPIO10_REG PERIPHS_IO_MUX_GPIO10_U +#define IO_MUX_GPIO11_REG PERIPHS_IO_MUX_GPIO11_U +#define IO_MUX_GPIO12_REG PERIPHS_IO_MUX_GPIO12_U +#define IO_MUX_GPIO13_REG PERIPHS_IO_MUX_GPIO13_U +#define IO_MUX_GPIO14_REG PERIPHS_IO_MUX_GPIO14_U +#define IO_MUX_GPIO15_REG PERIPHS_IO_MUX_XTAL_32K_P_U +#define IO_MUX_GPIO16_REG PERIPHS_IO_MUX_XTAL_32K_N_U +#define IO_MUX_GPIO17_REG PERIPHS_IO_MUX_DAC_1_U +#define IO_MUX_GPIO18_REG PERIPHS_IO_MUX_DAC_2_U +#define IO_MUX_GPIO19_REG PERIPHS_IO_MUX_GPIO19_U +#define IO_MUX_GPIO20_REG PERIPHS_IO_MUX_GPIO20_U +#define IO_MUX_GPIO21_REG PERIPHS_IO_MUX_GPIO21_U +#define IO_MUX_GPIO26_REG PERIPHS_IO_MUX_SPICS1_U +#define IO_MUX_GPIO27_REG PERIPHS_IO_MUX_SPIHD_U +#define IO_MUX_GPIO28_REG PERIPHS_IO_MUX_SPIWP_U +#define IO_MUX_GPIO29_REG PERIPHS_IO_MUX_SPICS0_U +#define IO_MUX_GPIO30_REG PERIPHS_IO_MUX_SPICLK_U +#define IO_MUX_GPIO31_REG PERIPHS_IO_MUX_SPIQ_U +#define IO_MUX_GPIO32_REG PERIPHS_IO_MUX_SPID_U +#define IO_MUX_GPIO33_REG PERIPHS_IO_MUX_GPIO33_U +#define IO_MUX_GPIO34_REG PERIPHS_IO_MUX_GPIO34_U +#define IO_MUX_GPIO35_REG PERIPHS_IO_MUX_GPIO35_U +#define IO_MUX_GPIO36_REG PERIPHS_IO_MUX_GPIO36_U +#define IO_MUX_GPIO37_REG PERIPHS_IO_MUX_GPIO37_U +#define IO_MUX_GPIO38_REG PERIPHS_IO_MUX_GPIO38_U +#define IO_MUX_GPIO39_REG PERIPHS_IO_MUX_MTCK_U +#define IO_MUX_GPIO40_REG PERIPHS_IO_MUX_MTDO_U +#define IO_MUX_GPIO41_REG PERIPHS_IO_MUX_MTDI_U +#define IO_MUX_GPIO42_REG PERIPHS_IO_MUX_MTMS_U +#define IO_MUX_GPIO43_REG PERIPHS_IO_MUX_U0TXD_U +#define IO_MUX_GPIO44_REG PERIPHS_IO_MUX_U0RXD_U +#define IO_MUX_GPIO45_REG PERIPHS_IO_MUX_GPIO45_U +#define IO_MUX_GPIO46_REG PERIPHS_IO_MUX_GPIO46_U + + +#define FUNC_GPIO_GPIO 1 +#define PIN_FUNC_GPIO 1 + +#define GPIO_PAD_PULLDOWN(num) do{PIN_PULLDWN_DIS(IOMUX_REG_GPIO##num);PIN_PULLUP_EN(IOMUX_REG_GPIO##num);}while(0) +#define GPIO_PAD_PULLUP(num) do{PIN_PULLUP_DIS(IOMUX_REG_GPIO##num);PIN_PULLDOWN_EN(IOMUX_REG_GPIO##num);}while(0) +#define GPIO_PAD_SET_DRV(num, drv) PIN_SET_DRV(IOMUX_REG_GPIO##num, drv) + +#define U1RXD_GPIO_NUM 18 +#define U1TXD_GPIO_NUM 17 +#define U0RXD_GPIO_NUM 44 +#define U0TXD_GPIO_NUM 43 + +#define SPI_CLK_GPIO_NUM 30 +#define SPI_Q_GPIO_NUM 31 +#define SPI_D_GPIO_NUM 32 +#define SPI_CS0_GPIO_NUM 29 +#define SPI_HD_GPIO_NUM 27 +#define SPI_WP_GPIO_NUM 28 +#define SD_CLK_GPIO_NUM 12 +#define SD_CMD_GPIO_NUM 11 +#define SD_DATA0_GPIO_NUM 13 +#define SD_DATA1_GPIO_NUM 14 +#define SD_DATA2_GPIO_NUM 9 +#define SD_DATA3_GPIO_NUM 10 + +#define MAX_RTC_GPIO_NUM 21 +#define MAX_PAD_GPIO_NUM 46 +#define MAX_GPIO_NUM 53 + +#define REG_IO_MUX_BASE DR_REG_IO_MUX_BASE +#define PIN_CTRL (REG_IO_MUX_BASE +0x00) +#define CLK_OUT3 0xf +#define CLK_OUT3_V CLK_OUT3 +#define CLK_OUT3_S 8 +#define CLK_OUT3_M (CLK_OUT3_V << CLK_OUT3_S) +#define CLK_OUT2 0xf +#define CLK_OUT2_V CLK_OUT2 +#define CLK_OUT2_S 4 +#define CLK_OUT2_M (CLK_OUT2_V << CLK_OUT2_S) +#define CLK_OUT1 0xf +#define CLK_OUT1_V CLK_OUT1 +#define CLK_OUT1_S 0 +#define CLK_OUT1_M (CLK_OUT1_V << CLK_OUT1_S) + +#define PERIPHS_IO_MUX_GPIO0_U (REG_IO_MUX_BASE +0x04) +#define FUNC_GPIO0_GPIO0 1 +#define FUNC_GPIO0_GPIO0_0 0 + +#define PERIPHS_IO_MUX_GPIO1_U (REG_IO_MUX_BASE +0x08) +#define FUNC_GPIO1_GPIO1 1 +#define FUNC_GPIO1_GPIO1_0 0 + +#define PERIPHS_IO_MUX_GPIO2_U (REG_IO_MUX_BASE +0x0c) +#define FUNC_GPIO2_GPIO2 1 +#define FUNC_GPIO2_GPIO2_0 0 + +#define PERIPHS_IO_MUX_GPIO3_U (REG_IO_MUX_BASE +0x10) +#define FUNC_GPIO3_GPIO3 1 +#define FUNC_GPIO3_GPIO3_0 0 + +#define PERIPHS_IO_MUX_GPIO4_U (REG_IO_MUX_BASE +0x14) +#define FUNC_GPIO4_GPIO4 1 +#define FUNC_GPIO4_GPIO4_0 0 + +#define PERIPHS_IO_MUX_GPIO5_U (REG_IO_MUX_BASE +0x18) +#define FUNC_GPIO5_GPIO5 1 +#define FUNC_GPIO5_GPIO5_0 0 + +#define PERIPHS_IO_MUX_GPIO6_U (REG_IO_MUX_BASE +0x1c) +#define FUNC_GPIO6_GPIO6 1 +#define FUNC_GPIO6_GPIO6_0 0 + +#define PERIPHS_IO_MUX_GPIO7_U (REG_IO_MUX_BASE +0x20) +#define FUNC_GPIO7_GPIO7 1 +#define FUNC_GPIO7_GPIO7_0 0 + +#define PERIPHS_IO_MUX_GPIO8_U (REG_IO_MUX_BASE +0x24) +#define FUNC_GPIO8_SUBSPICS1 3 +#define FUNC_GPIO8_GPIO8 1 +#define FUNC_GPIO8_GPIO8_0 0 + +#define PERIPHS_IO_MUX_GPIO9_U (REG_IO_MUX_BASE +0x28) +#define FUNC_GPIO9_SUBSPIHD 3 +#define FUNC_GPIO9_FSPIHD 2 +#define FUNC_GPIO9_GPIO9 1 +#define FUNC_GPIO9_SD_DATA2 0 + +#define PERIPHS_IO_MUX_GPIO10_U (REG_IO_MUX_BASE +0x2c) +#define FUNC_GPIO10_SUBSPICS0 3 +#define FUNC_GPIO10_FSPICS0 2 +#define FUNC_GPIO10_GPIO10 1 +#define FUNC_GPIO10_SD_DATA3 0 + +#define PERIPHS_IO_MUX_GPIO11_U (REG_IO_MUX_BASE +0x30) +#define FUNC_GPIO11_SUBSPID 3 +#define FUNC_GPIO11_FSPID 2 +#define FUNC_GPIO11_GPIO11 1 +#define FUNC_GPIO11_SD_CMD 0 + +#define PERIPHS_IO_MUX_GPIO12_U (REG_IO_MUX_BASE +0x34) +#define FUNC_GPIO12_SUBSPICLK 3 +#define FUNC_GPIO12_FSPICLK 2 +#define FUNC_GPIO12_GPIO12 1 +#define FUNC_GPIO12_SD_CLK 0 + +#define PERIPHS_IO_MUX_GPIO13_U (REG_IO_MUX_BASE +0x38) +#define FUNC_GPIO13_SUBSPIQ 3 +#define FUNC_GPIO13_FSPIQ 2 +#define FUNC_GPIO13_GPIO13 1 +#define FUNC_GPIO13_SD_DATA0 0 + +#define PERIPHS_IO_MUX_GPIO14_U (REG_IO_MUX_BASE +0x3c) +#define FUNC_GPIO14_SUBSPIWP 3 +#define FUNC_GPIO14_FSPIWP 2 +#define FUNC_GPIO14_GPIO14 1 +#define FUNC_GPIO14_SD_DATA1 0 + +#define PERIPHS_IO_MUX_XTAL_32K_P_U (REG_IO_MUX_BASE +0x40) +#define FUNC_XTAL_32K_P_U0RTS 2 +#define FUNC_XTAL_32K_P_GPIO15 1 +#define FUNC_XTAL_32K_P_GPIO15_0 0 + +#define PERIPHS_IO_MUX_XTAL_32K_N_U (REG_IO_MUX_BASE +0x44) +#define FUNC_XTAL_32K_N_U0CTS 2 +#define FUNC_XTAL_32K_N_GPIO16 1 +#define FUNC_XTAL_32K_N_GPIO16_0 0 + +#define PERIPHS_IO_MUX_DAC_1_U (REG_IO_MUX_BASE +0x48) +#define FUNC_DAC_1_U1TXD 2 +#define FUNC_DAC_1_GPIO17 1 +#define FUNC_DAC_1_GPIO17_0 0 + +#define PERIPHS_IO_MUX_DAC_2_U (REG_IO_MUX_BASE +0x4c) +#define FUNC_DAC_2_CLK_OUT3 3 +#define FUNC_DAC_2_U1RXD 2 +#define FUNC_DAC_2_GPIO18 1 +#define FUNC_DAC_2_GPIO18_0 0 + +#define PERIPHS_IO_MUX_GPIO19_U (REG_IO_MUX_BASE +0x50) +#define FUNC_GPIO19_CLK_OUT2 3 +#define FUNC_GPIO19_U1RTS 2 +#define FUNC_GPIO19_GPIO19 1 +#define FUNC_GPIO19_GPIO19_0 0 + +#define PERIPHS_IO_MUX_GPIO20_U (REG_IO_MUX_BASE +0x54) +#define FUNC_GPIO20_CLK_OUT1 3 +#define FUNC_GPIO20_U1CTS 2 +#define FUNC_GPIO20_GPIO20 1 +#define FUNC_GPIO20_GPIO20_0 0 + +#define PERIPHS_IO_MUX_GPIO21_U (REG_IO_MUX_BASE +0x58) +#define FUNC_GPIO21_GPIO21 1 +#define FUNC_GPIO21_GPIO21_0 0 + +#define PERIPHS_IO_MUX_SPICS1_U (REG_IO_MUX_BASE +0x6c) +#define FUNC_SPICS1_GPIO26 1 +#define FUNC_SPICS1_SPICS1 0 + +#define PERIPHS_IO_MUX_SPIHD_U (REG_IO_MUX_BASE +0x70) +#define FUNC_SPIHD_GPIO27 1 +#define FUNC_SPIHD_SPIHD 0 + +#define PERIPHS_IO_MUX_SPIWP_U (REG_IO_MUX_BASE +0x74) +#define FUNC_SPIWP_GPIO28 1 +#define FUNC_SPIWP_SPIWP 0 + +#define PERIPHS_IO_MUX_SPICS0_U (REG_IO_MUX_BASE +0x78) +#define FUNC_SPICS0_GPIO29 1 +#define FUNC_SPICS0_SPICS0 0 + +#define PERIPHS_IO_MUX_SPICLK_U (REG_IO_MUX_BASE +0x7c) +#define FUNC_SPICLK_GPIO30 1 +#define FUNC_SPICLK_SPICLK 0 + +#define PERIPHS_IO_MUX_SPIQ_U (REG_IO_MUX_BASE +0x80) +#define FUNC_SPIQ_GPIO31 1 +#define FUNC_SPIQ_SPIQ 0 + +#define PERIPHS_IO_MUX_SPID_U (REG_IO_MUX_BASE +0x84) +#define FUNC_SPID_GPIO32 1 +#define FUNC_SPID_SPID 0 + +#define PERIPHS_IO_MUX_GPIO33_U (REG_IO_MUX_BASE +0x88) +#define FUNC_GPIO33_SUBSPIHD 3 +#define FUNC_GPIO33_SD_DATA2 2 +#define FUNC_GPIO33_GPIO33 1 +#define FUNC_GPIO33_FSPIHD 0 + +#define PERIPHS_IO_MUX_GPIO34_U (REG_IO_MUX_BASE +0x8c) +#define FUNC_GPIO34_SUBSPICS0 3 +#define FUNC_GPIO34_SD_DATA3 2 +#define FUNC_GPIO34_GPIO34 1 +#define FUNC_GPIO34_FSPICS0 0 + +#define PERIPHS_IO_MUX_GPIO35_U (REG_IO_MUX_BASE +0x90) +#define FUNC_GPIO35_SUBSPID 3 +#define FUNC_GPIO35_SD_CMD 2 +#define FUNC_GPIO35_GPIO35 1 +#define FUNC_GPIO35_FSPID 0 + +#define PERIPHS_IO_MUX_GPIO36_U (REG_IO_MUX_BASE +0x94) +#define FUNC_GPIO36_SUBSPICLK 3 +#define FUNC_GPIO36_SD_CLK 2 +#define FUNC_GPIO36_GPIO36 1 +#define FUNC_GPIO36_FSPICLK 0 + +#define PERIPHS_IO_MUX_GPIO37_U (REG_IO_MUX_BASE +0x98) +#define FUNC_GPIO37_SUBSPIQ 3 +#define FUNC_GPIO37_SD_DATA0 2 +#define FUNC_GPIO37_GPIO37 1 +#define FUNC_GPIO37_FSPIQ 0 + +#define PERIPHS_IO_MUX_GPIO38_U (REG_IO_MUX_BASE +0x9c) +#define FUNC_GPIO38_SUBSPIWP 3 +#define FUNC_GPIO38_SD_DATA1 2 +#define FUNC_GPIO38_GPIO38 1 +#define FUNC_GPIO38_FSPIWP 0 + +#define PERIPHS_IO_MUX_MTCK_U (REG_IO_MUX_BASE +0xa0) +#define FUNC_MTCK_SUBSPICS1 3 +#define FUNC_MTCK_CLK_OUT3 2 +#define FUNC_MTCK_GPIO39 1 +#define FUNC_MTCK_MTCK 0 + +#define PERIPHS_IO_MUX_MTDO_U (REG_IO_MUX_BASE +0xa4) +#define FUNC_MTDO_CLK_OUT2 2 +#define FUNC_MTDO_GPIO40 1 +#define FUNC_MTDO_MTDO 0 + +#define PERIPHS_IO_MUX_MTDI_U (REG_IO_MUX_BASE +0xa8) +#define FUNC_MTDI_CLK_OUT1 2 +#define FUNC_MTDI_GPIO41 1 +#define FUNC_MTDI_MTDI 0 + +#define PERIPHS_IO_MUX_MTMS_U (REG_IO_MUX_BASE +0xac) +#define FUNC_MTMS_GPIO42 1 +#define FUNC_MTMS_MTMS 0 + +#define PERIPHS_IO_MUX_U0TXD_U (REG_IO_MUX_BASE +0xb0) +#define FUNC_U0TXD_CLK_OUT1 2 +#define FUNC_U0TXD_GPIO43 1 +#define FUNC_U0TXD_U0TXD 0 + +#define PERIPHS_IO_MUX_U0RXD_U (REG_IO_MUX_BASE +0xb4) +#define FUNC_U0RXD_CLK_OUT2 2 +#define FUNC_U0RXD_GPIO44 1 +#define FUNC_U0RXD_U0RXD 0 + +#define PERIPHS_IO_MUX_GPIO45_U (REG_IO_MUX_BASE +0xb8) +#define FUNC_GPIO45_GPIO45 1 +#define FUNC_GPIO45_GPIO45_0 0 + +#define PERIPHS_IO_MUX_GPIO46_U (REG_IO_MUX_BASE +0xbc) +#define FUNC_GPIO46_GPIO46 1 +#define FUNC_GPIO46_GPIO46_0 0 + +#define IO_MUX_DATE_REG (REG_IO_MUX_BASE + 0xfc) +#define IO_MUX_DATE 0xFFFFFFFF +#define IO_MUX_DATE_S 0 +#define IO_MUX_DATE_VERSION 0x1809060 + +#endif diff --git a/components/soc/esp32s2beta/include/soc/ledc_reg.h b/components/soc/esp32s2beta/include/soc/ledc_reg.h new file mode 100644 index 0000000000..1110b9987f --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/ledc_reg.h @@ -0,0 +1,1568 @@ +// Copyright 2017-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. +#ifndef _SOC_LEDC_REG_H_ +#define _SOC_LEDC_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define LEDC_LSCH0_CONF0_REG (DR_REG_LEDC_BASE + 0x0000) +/* LEDC_CLK_EN : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define LEDC_CLK_EN (BIT(31)) +#define LEDC_CLK_EN_M (BIT(31)) +#define LEDC_CLK_EN_V 0x1 +#define LEDC_CLK_EN_S 31 +/* LEDC_OVF_CNT_RESET_ST_LSCH0 : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_ST_LSCH0 (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH0_M (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH0_V 0x1 +#define LEDC_OVF_CNT_RESET_ST_LSCH0_S 17 +/* LEDC_OVF_CNT_RESET_LSCH0 : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_LSCH0 (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH0_M (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH0_V 0x1 +#define LEDC_OVF_CNT_RESET_LSCH0_S 16 +/* LEDC_OVF_CNT_EN_LSCH0 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_EN_LSCH0 (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH0_M (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH0_V 0x1 +#define LEDC_OVF_CNT_EN_LSCH0_S 15 +/* LEDC_OVF_NUM_LSCH0 : R/W ;bitpos:[14:5] ;default: 10'b0 ; */ +/*description: */ +#define LEDC_OVF_NUM_LSCH0 0x000003FF +#define LEDC_OVF_NUM_LSCH0_M ((LEDC_OVF_NUM_LSCH0_V)<<(LEDC_OVF_NUM_LSCH0_S)) +#define LEDC_OVF_NUM_LSCH0_V 0x3FF +#define LEDC_OVF_NUM_LSCH0_S 5 +/* LEDC_PARA_UP_LSCH0 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_PARA_UP_LSCH0 (BIT(4)) +#define LEDC_PARA_UP_LSCH0_M (BIT(4)) +#define LEDC_PARA_UP_LSCH0_V 0x1 +#define LEDC_PARA_UP_LSCH0_S 4 +/* LEDC_IDLE_LV_LSCH0 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_IDLE_LV_LSCH0 (BIT(3)) +#define LEDC_IDLE_LV_LSCH0_M (BIT(3)) +#define LEDC_IDLE_LV_LSCH0_V 0x1 +#define LEDC_IDLE_LV_LSCH0_S 3 +/* LEDC_SIG_OUT_EN_LSCH0 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_SIG_OUT_EN_LSCH0 (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH0_M (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH0_V 0x1 +#define LEDC_SIG_OUT_EN_LSCH0_S 2 +/* LEDC_TIMER_SEL_LSCH0 : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: */ +#define LEDC_TIMER_SEL_LSCH0 0x00000003 +#define LEDC_TIMER_SEL_LSCH0_M ((LEDC_TIMER_SEL_LSCH0_V)<<(LEDC_TIMER_SEL_LSCH0_S)) +#define LEDC_TIMER_SEL_LSCH0_V 0x3 +#define LEDC_TIMER_SEL_LSCH0_S 0 + +#define LEDC_LSCH0_HPOINT_REG (DR_REG_LEDC_BASE + 0x0004) +/* LEDC_HPOINT_LSCH0 : R/W ;bitpos:[13:0] ;default: 14'h0 ; */ +/*description: */ +#define LEDC_HPOINT_LSCH0 0x00003FFF +#define LEDC_HPOINT_LSCH0_M ((LEDC_HPOINT_LSCH0_V)<<(LEDC_HPOINT_LSCH0_S)) +#define LEDC_HPOINT_LSCH0_V 0x3FFF +#define LEDC_HPOINT_LSCH0_S 0 + +#define LEDC_LSCH0_DUTY_REG (DR_REG_LEDC_BASE + 0x0008) +/* LEDC_DUTY_LSCH0 : R/W ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH0 0x0007FFFF +#define LEDC_DUTY_LSCH0_M ((LEDC_DUTY_LSCH0_V)<<(LEDC_DUTY_LSCH0_S)) +#define LEDC_DUTY_LSCH0_V 0x7FFFF +#define LEDC_DUTY_LSCH0_S 0 + +#define LEDC_LSCH0_CONF1_REG (DR_REG_LEDC_BASE + 0x000C) +/* LEDC_DUTY_START_LSCH0 : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_START_LSCH0 (BIT(31)) +#define LEDC_DUTY_START_LSCH0_M (BIT(31)) +#define LEDC_DUTY_START_LSCH0_V 0x1 +#define LEDC_DUTY_START_LSCH0_S 31 +/* LEDC_DUTY_INC_LSCH0 : R/W ;bitpos:[30] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_DUTY_INC_LSCH0 (BIT(30)) +#define LEDC_DUTY_INC_LSCH0_M (BIT(30)) +#define LEDC_DUTY_INC_LSCH0_V 0x1 +#define LEDC_DUTY_INC_LSCH0_S 30 +/* LEDC_DUTY_NUM_LSCH0 : R/W ;bitpos:[29:20] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_NUM_LSCH0 0x000003FF +#define LEDC_DUTY_NUM_LSCH0_M ((LEDC_DUTY_NUM_LSCH0_V)<<(LEDC_DUTY_NUM_LSCH0_S)) +#define LEDC_DUTY_NUM_LSCH0_V 0x3FF +#define LEDC_DUTY_NUM_LSCH0_S 20 +/* LEDC_DUTY_CYCLE_LSCH0 : R/W ;bitpos:[19:10] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_CYCLE_LSCH0 0x000003FF +#define LEDC_DUTY_CYCLE_LSCH0_M ((LEDC_DUTY_CYCLE_LSCH0_V)<<(LEDC_DUTY_CYCLE_LSCH0_S)) +#define LEDC_DUTY_CYCLE_LSCH0_V 0x3FF +#define LEDC_DUTY_CYCLE_LSCH0_S 10 +/* LEDC_DUTY_SCALE_LSCH0 : R/W ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_SCALE_LSCH0 0x000003FF +#define LEDC_DUTY_SCALE_LSCH0_M ((LEDC_DUTY_SCALE_LSCH0_V)<<(LEDC_DUTY_SCALE_LSCH0_S)) +#define LEDC_DUTY_SCALE_LSCH0_V 0x3FF +#define LEDC_DUTY_SCALE_LSCH0_S 0 + +#define LEDC_LSCH0_DUTY_R_REG (DR_REG_LEDC_BASE + 0x0010) +/* LEDC_DUTY_LSCH0 : RO ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH0 0x0007FFFF +#define LEDC_DUTY_LSCH0_M ((LEDC_DUTY_LSCH0_V)<<(LEDC_DUTY_LSCH0_S)) +#define LEDC_DUTY_LSCH0_V 0x7FFFF +#define LEDC_DUTY_LSCH0_S 0 + +#define LEDC_LSCH1_CONF0_REG (DR_REG_LEDC_BASE + 0x0014) +/* LEDC_OVF_CNT_RESET_ST_LSCH1 : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_ST_LSCH1 (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH1_M (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH1_V 0x1 +#define LEDC_OVF_CNT_RESET_ST_LSCH1_S 17 +/* LEDC_OVF_CNT_RESET_LSCH1 : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_LSCH1 (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH1_M (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH1_V 0x1 +#define LEDC_OVF_CNT_RESET_LSCH1_S 16 +/* LEDC_OVF_CNT_EN_LSCH1 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_EN_LSCH1 (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH1_M (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH1_V 0x1 +#define LEDC_OVF_CNT_EN_LSCH1_S 15 +/* LEDC_OVF_NUM_LSCH1 : R/W ;bitpos:[14:5] ;default: 10'b0 ; */ +/*description: */ +#define LEDC_OVF_NUM_LSCH1 0x000003FF +#define LEDC_OVF_NUM_LSCH1_M ((LEDC_OVF_NUM_LSCH1_V)<<(LEDC_OVF_NUM_LSCH1_S)) +#define LEDC_OVF_NUM_LSCH1_V 0x3FF +#define LEDC_OVF_NUM_LSCH1_S 5 +/* LEDC_PARA_UP_LSCH1 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_PARA_UP_LSCH1 (BIT(4)) +#define LEDC_PARA_UP_LSCH1_M (BIT(4)) +#define LEDC_PARA_UP_LSCH1_V 0x1 +#define LEDC_PARA_UP_LSCH1_S 4 +/* LEDC_IDLE_LV_LSCH1 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_IDLE_LV_LSCH1 (BIT(3)) +#define LEDC_IDLE_LV_LSCH1_M (BIT(3)) +#define LEDC_IDLE_LV_LSCH1_V 0x1 +#define LEDC_IDLE_LV_LSCH1_S 3 +/* LEDC_SIG_OUT_EN_LSCH1 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_SIG_OUT_EN_LSCH1 (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH1_M (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH1_V 0x1 +#define LEDC_SIG_OUT_EN_LSCH1_S 2 +/* LEDC_TIMER_SEL_LSCH1 : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: */ +#define LEDC_TIMER_SEL_LSCH1 0x00000003 +#define LEDC_TIMER_SEL_LSCH1_M ((LEDC_TIMER_SEL_LSCH1_V)<<(LEDC_TIMER_SEL_LSCH1_S)) +#define LEDC_TIMER_SEL_LSCH1_V 0x3 +#define LEDC_TIMER_SEL_LSCH1_S 0 + +#define LEDC_LSCH1_HPOINT_REG (DR_REG_LEDC_BASE + 0x0018) +/* LEDC_HPOINT_LSCH1 : R/W ;bitpos:[13:0] ;default: 14'h0 ; */ +/*description: */ +#define LEDC_HPOINT_LSCH1 0x00003FFF +#define LEDC_HPOINT_LSCH1_M ((LEDC_HPOINT_LSCH1_V)<<(LEDC_HPOINT_LSCH1_S)) +#define LEDC_HPOINT_LSCH1_V 0x3FFF +#define LEDC_HPOINT_LSCH1_S 0 + +#define LEDC_LSCH1_DUTY_REG (DR_REG_LEDC_BASE + 0x001C) +/* LEDC_DUTY_LSCH1 : R/W ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH1 0x0007FFFF +#define LEDC_DUTY_LSCH1_M ((LEDC_DUTY_LSCH1_V)<<(LEDC_DUTY_LSCH1_S)) +#define LEDC_DUTY_LSCH1_V 0x7FFFF +#define LEDC_DUTY_LSCH1_S 0 + +#define LEDC_LSCH1_CONF1_REG (DR_REG_LEDC_BASE + 0x0020) +/* LEDC_DUTY_START_LSCH1 : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_START_LSCH1 (BIT(31)) +#define LEDC_DUTY_START_LSCH1_M (BIT(31)) +#define LEDC_DUTY_START_LSCH1_V 0x1 +#define LEDC_DUTY_START_LSCH1_S 31 +/* LEDC_DUTY_INC_LSCH1 : R/W ;bitpos:[30] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_DUTY_INC_LSCH1 (BIT(30)) +#define LEDC_DUTY_INC_LSCH1_M (BIT(30)) +#define LEDC_DUTY_INC_LSCH1_V 0x1 +#define LEDC_DUTY_INC_LSCH1_S 30 +/* LEDC_DUTY_NUM_LSCH1 : R/W ;bitpos:[29:20] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_NUM_LSCH1 0x000003FF +#define LEDC_DUTY_NUM_LSCH1_M ((LEDC_DUTY_NUM_LSCH1_V)<<(LEDC_DUTY_NUM_LSCH1_S)) +#define LEDC_DUTY_NUM_LSCH1_V 0x3FF +#define LEDC_DUTY_NUM_LSCH1_S 20 +/* LEDC_DUTY_CYCLE_LSCH1 : R/W ;bitpos:[19:10] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_CYCLE_LSCH1 0x000003FF +#define LEDC_DUTY_CYCLE_LSCH1_M ((LEDC_DUTY_CYCLE_LSCH1_V)<<(LEDC_DUTY_CYCLE_LSCH1_S)) +#define LEDC_DUTY_CYCLE_LSCH1_V 0x3FF +#define LEDC_DUTY_CYCLE_LSCH1_S 10 +/* LEDC_DUTY_SCALE_LSCH1 : R/W ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_SCALE_LSCH1 0x000003FF +#define LEDC_DUTY_SCALE_LSCH1_M ((LEDC_DUTY_SCALE_LSCH1_V)<<(LEDC_DUTY_SCALE_LSCH1_S)) +#define LEDC_DUTY_SCALE_LSCH1_V 0x3FF +#define LEDC_DUTY_SCALE_LSCH1_S 0 + +#define LEDC_LSCH1_DUTY_R_REG (DR_REG_LEDC_BASE + 0x0024) +/* LEDC_DUTY_LSCH1 : RO ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH1 0x0007FFFF +#define LEDC_DUTY_LSCH1_M ((LEDC_DUTY_LSCH1_V)<<(LEDC_DUTY_LSCH1_S)) +#define LEDC_DUTY_LSCH1_V 0x7FFFF +#define LEDC_DUTY_LSCH1_S 0 + +#define LEDC_LSCH2_CONF0_REG (DR_REG_LEDC_BASE + 0x0028) +/* LEDC_OVF_CNT_RESET_ST_LSCH2 : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_ST_LSCH2 (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH2_M (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH2_V 0x1 +#define LEDC_OVF_CNT_RESET_ST_LSCH2_S 17 +/* LEDC_OVF_CNT_RESET_LSCH2 : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_LSCH2 (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH2_M (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH2_V 0x1 +#define LEDC_OVF_CNT_RESET_LSCH2_S 16 +/* LEDC_OVF_CNT_EN_LSCH2 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_EN_LSCH2 (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH2_M (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH2_V 0x1 +#define LEDC_OVF_CNT_EN_LSCH2_S 15 +/* LEDC_OVF_NUM_LSCH2 : R/W ;bitpos:[14:5] ;default: 10'b0 ; */ +/*description: */ +#define LEDC_OVF_NUM_LSCH2 0x000003FF +#define LEDC_OVF_NUM_LSCH2_M ((LEDC_OVF_NUM_LSCH2_V)<<(LEDC_OVF_NUM_LSCH2_S)) +#define LEDC_OVF_NUM_LSCH2_V 0x3FF +#define LEDC_OVF_NUM_LSCH2_S 5 +/* LEDC_PARA_UP_LSCH2 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_PARA_UP_LSCH2 (BIT(4)) +#define LEDC_PARA_UP_LSCH2_M (BIT(4)) +#define LEDC_PARA_UP_LSCH2_V 0x1 +#define LEDC_PARA_UP_LSCH2_S 4 +/* LEDC_IDLE_LV_LSCH2 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_IDLE_LV_LSCH2 (BIT(3)) +#define LEDC_IDLE_LV_LSCH2_M (BIT(3)) +#define LEDC_IDLE_LV_LSCH2_V 0x1 +#define LEDC_IDLE_LV_LSCH2_S 3 +/* LEDC_SIG_OUT_EN_LSCH2 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_SIG_OUT_EN_LSCH2 (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH2_M (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH2_V 0x1 +#define LEDC_SIG_OUT_EN_LSCH2_S 2 +/* LEDC_TIMER_SEL_LSCH2 : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: */ +#define LEDC_TIMER_SEL_LSCH2 0x00000003 +#define LEDC_TIMER_SEL_LSCH2_M ((LEDC_TIMER_SEL_LSCH2_V)<<(LEDC_TIMER_SEL_LSCH2_S)) +#define LEDC_TIMER_SEL_LSCH2_V 0x3 +#define LEDC_TIMER_SEL_LSCH2_S 0 + +#define LEDC_LSCH2_HPOINT_REG (DR_REG_LEDC_BASE + 0x002C) +/* LEDC_HPOINT_LSCH2 : R/W ;bitpos:[13:0] ;default: 14'h0 ; */ +/*description: */ +#define LEDC_HPOINT_LSCH2 0x00003FFF +#define LEDC_HPOINT_LSCH2_M ((LEDC_HPOINT_LSCH2_V)<<(LEDC_HPOINT_LSCH2_S)) +#define LEDC_HPOINT_LSCH2_V 0x3FFF +#define LEDC_HPOINT_LSCH2_S 0 + +#define LEDC_LSCH2_DUTY_REG (DR_REG_LEDC_BASE + 0x0030) +/* LEDC_DUTY_LSCH2 : R/W ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH2 0x0007FFFF +#define LEDC_DUTY_LSCH2_M ((LEDC_DUTY_LSCH2_V)<<(LEDC_DUTY_LSCH2_S)) +#define LEDC_DUTY_LSCH2_V 0x7FFFF +#define LEDC_DUTY_LSCH2_S 0 + +#define LEDC_LSCH2_CONF1_REG (DR_REG_LEDC_BASE + 0x0034) +/* LEDC_DUTY_START_LSCH2 : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_START_LSCH2 (BIT(31)) +#define LEDC_DUTY_START_LSCH2_M (BIT(31)) +#define LEDC_DUTY_START_LSCH2_V 0x1 +#define LEDC_DUTY_START_LSCH2_S 31 +/* LEDC_DUTY_INC_LSCH2 : R/W ;bitpos:[30] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_DUTY_INC_LSCH2 (BIT(30)) +#define LEDC_DUTY_INC_LSCH2_M (BIT(30)) +#define LEDC_DUTY_INC_LSCH2_V 0x1 +#define LEDC_DUTY_INC_LSCH2_S 30 +/* LEDC_DUTY_NUM_LSCH2 : R/W ;bitpos:[29:20] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_NUM_LSCH2 0x000003FF +#define LEDC_DUTY_NUM_LSCH2_M ((LEDC_DUTY_NUM_LSCH2_V)<<(LEDC_DUTY_NUM_LSCH2_S)) +#define LEDC_DUTY_NUM_LSCH2_V 0x3FF +#define LEDC_DUTY_NUM_LSCH2_S 20 +/* LEDC_DUTY_CYCLE_LSCH2 : R/W ;bitpos:[19:10] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_CYCLE_LSCH2 0x000003FF +#define LEDC_DUTY_CYCLE_LSCH2_M ((LEDC_DUTY_CYCLE_LSCH2_V)<<(LEDC_DUTY_CYCLE_LSCH2_S)) +#define LEDC_DUTY_CYCLE_LSCH2_V 0x3FF +#define LEDC_DUTY_CYCLE_LSCH2_S 10 +/* LEDC_DUTY_SCALE_LSCH2 : R/W ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_SCALE_LSCH2 0x000003FF +#define LEDC_DUTY_SCALE_LSCH2_M ((LEDC_DUTY_SCALE_LSCH2_V)<<(LEDC_DUTY_SCALE_LSCH2_S)) +#define LEDC_DUTY_SCALE_LSCH2_V 0x3FF +#define LEDC_DUTY_SCALE_LSCH2_S 0 + +#define LEDC_LSCH2_DUTY_R_REG (DR_REG_LEDC_BASE + 0x0038) +/* LEDC_DUTY_LSCH2 : RO ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH2 0x0007FFFF +#define LEDC_DUTY_LSCH2_M ((LEDC_DUTY_LSCH2_V)<<(LEDC_DUTY_LSCH2_S)) +#define LEDC_DUTY_LSCH2_V 0x7FFFF +#define LEDC_DUTY_LSCH2_S 0 + +#define LEDC_LSCH3_CONF0_REG (DR_REG_LEDC_BASE + 0x003C) +/* LEDC_OVF_CNT_RESET_ST_LSCH3 : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_ST_LSCH3 (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH3_M (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH3_V 0x1 +#define LEDC_OVF_CNT_RESET_ST_LSCH3_S 17 +/* LEDC_OVF_CNT_RESET_LSCH3 : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_LSCH3 (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH3_M (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH3_V 0x1 +#define LEDC_OVF_CNT_RESET_LSCH3_S 16 +/* LEDC_OVF_CNT_EN_LSCH3 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_EN_LSCH3 (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH3_M (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH3_V 0x1 +#define LEDC_OVF_CNT_EN_LSCH3_S 15 +/* LEDC_OVF_NUM_LSCH3 : R/W ;bitpos:[14:5] ;default: 10'b0 ; */ +/*description: */ +#define LEDC_OVF_NUM_LSCH3 0x000003FF +#define LEDC_OVF_NUM_LSCH3_M ((LEDC_OVF_NUM_LSCH3_V)<<(LEDC_OVF_NUM_LSCH3_S)) +#define LEDC_OVF_NUM_LSCH3_V 0x3FF +#define LEDC_OVF_NUM_LSCH3_S 5 +/* LEDC_PARA_UP_LSCH3 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_PARA_UP_LSCH3 (BIT(4)) +#define LEDC_PARA_UP_LSCH3_M (BIT(4)) +#define LEDC_PARA_UP_LSCH3_V 0x1 +#define LEDC_PARA_UP_LSCH3_S 4 +/* LEDC_IDLE_LV_LSCH3 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_IDLE_LV_LSCH3 (BIT(3)) +#define LEDC_IDLE_LV_LSCH3_M (BIT(3)) +#define LEDC_IDLE_LV_LSCH3_V 0x1 +#define LEDC_IDLE_LV_LSCH3_S 3 +/* LEDC_SIG_OUT_EN_LSCH3 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_SIG_OUT_EN_LSCH3 (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH3_M (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH3_V 0x1 +#define LEDC_SIG_OUT_EN_LSCH3_S 2 +/* LEDC_TIMER_SEL_LSCH3 : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: */ +#define LEDC_TIMER_SEL_LSCH3 0x00000003 +#define LEDC_TIMER_SEL_LSCH3_M ((LEDC_TIMER_SEL_LSCH3_V)<<(LEDC_TIMER_SEL_LSCH3_S)) +#define LEDC_TIMER_SEL_LSCH3_V 0x3 +#define LEDC_TIMER_SEL_LSCH3_S 0 + +#define LEDC_LSCH3_HPOINT_REG (DR_REG_LEDC_BASE + 0x0040) +/* LEDC_HPOINT_LSCH3 : R/W ;bitpos:[13:0] ;default: 14'h0 ; */ +/*description: */ +#define LEDC_HPOINT_LSCH3 0x00003FFF +#define LEDC_HPOINT_LSCH3_M ((LEDC_HPOINT_LSCH3_V)<<(LEDC_HPOINT_LSCH3_S)) +#define LEDC_HPOINT_LSCH3_V 0x3FFF +#define LEDC_HPOINT_LSCH3_S 0 + +#define LEDC_LSCH3_DUTY_REG (DR_REG_LEDC_BASE + 0x0044) +/* LEDC_DUTY_LSCH3 : R/W ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH3 0x0007FFFF +#define LEDC_DUTY_LSCH3_M ((LEDC_DUTY_LSCH3_V)<<(LEDC_DUTY_LSCH3_S)) +#define LEDC_DUTY_LSCH3_V 0x7FFFF +#define LEDC_DUTY_LSCH3_S 0 + +#define LEDC_LSCH3_CONF1_REG (DR_REG_LEDC_BASE + 0x0048) +/* LEDC_DUTY_START_LSCH3 : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_START_LSCH3 (BIT(31)) +#define LEDC_DUTY_START_LSCH3_M (BIT(31)) +#define LEDC_DUTY_START_LSCH3_V 0x1 +#define LEDC_DUTY_START_LSCH3_S 31 +/* LEDC_DUTY_INC_LSCH3 : R/W ;bitpos:[30] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_DUTY_INC_LSCH3 (BIT(30)) +#define LEDC_DUTY_INC_LSCH3_M (BIT(30)) +#define LEDC_DUTY_INC_LSCH3_V 0x1 +#define LEDC_DUTY_INC_LSCH3_S 30 +/* LEDC_DUTY_NUM_LSCH3 : R/W ;bitpos:[29:20] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_NUM_LSCH3 0x000003FF +#define LEDC_DUTY_NUM_LSCH3_M ((LEDC_DUTY_NUM_LSCH3_V)<<(LEDC_DUTY_NUM_LSCH3_S)) +#define LEDC_DUTY_NUM_LSCH3_V 0x3FF +#define LEDC_DUTY_NUM_LSCH3_S 20 +/* LEDC_DUTY_CYCLE_LSCH3 : R/W ;bitpos:[19:10] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_CYCLE_LSCH3 0x000003FF +#define LEDC_DUTY_CYCLE_LSCH3_M ((LEDC_DUTY_CYCLE_LSCH3_V)<<(LEDC_DUTY_CYCLE_LSCH3_S)) +#define LEDC_DUTY_CYCLE_LSCH3_V 0x3FF +#define LEDC_DUTY_CYCLE_LSCH3_S 10 +/* LEDC_DUTY_SCALE_LSCH3 : R/W ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_SCALE_LSCH3 0x000003FF +#define LEDC_DUTY_SCALE_LSCH3_M ((LEDC_DUTY_SCALE_LSCH3_V)<<(LEDC_DUTY_SCALE_LSCH3_S)) +#define LEDC_DUTY_SCALE_LSCH3_V 0x3FF +#define LEDC_DUTY_SCALE_LSCH3_S 0 + +#define LEDC_LSCH3_DUTY_R_REG (DR_REG_LEDC_BASE + 0x004C) +/* LEDC_DUTY_LSCH3 : RO ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH3 0x0007FFFF +#define LEDC_DUTY_LSCH3_M ((LEDC_DUTY_LSCH3_V)<<(LEDC_DUTY_LSCH3_S)) +#define LEDC_DUTY_LSCH3_V 0x7FFFF +#define LEDC_DUTY_LSCH3_S 0 + +#define LEDC_LSCH4_CONF0_REG (DR_REG_LEDC_BASE + 0x0050) +/* LEDC_OVF_CNT_RESET_ST_LSCH4 : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_ST_LSCH4 (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH4_M (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH4_V 0x1 +#define LEDC_OVF_CNT_RESET_ST_LSCH4_S 17 +/* LEDC_OVF_CNT_RESET_LSCH4 : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_LSCH4 (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH4_M (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH4_V 0x1 +#define LEDC_OVF_CNT_RESET_LSCH4_S 16 +/* LEDC_OVF_CNT_EN_LSCH4 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_EN_LSCH4 (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH4_M (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH4_V 0x1 +#define LEDC_OVF_CNT_EN_LSCH4_S 15 +/* LEDC_OVF_NUM_LSCH4 : R/W ;bitpos:[14:5] ;default: 10'b0 ; */ +/*description: */ +#define LEDC_OVF_NUM_LSCH4 0x000003FF +#define LEDC_OVF_NUM_LSCH4_M ((LEDC_OVF_NUM_LSCH4_V)<<(LEDC_OVF_NUM_LSCH4_S)) +#define LEDC_OVF_NUM_LSCH4_V 0x3FF +#define LEDC_OVF_NUM_LSCH4_S 5 +/* LEDC_PARA_UP_LSCH4 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_PARA_UP_LSCH4 (BIT(4)) +#define LEDC_PARA_UP_LSCH4_M (BIT(4)) +#define LEDC_PARA_UP_LSCH4_V 0x1 +#define LEDC_PARA_UP_LSCH4_S 4 +/* LEDC_IDLE_LV_LSCH4 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_IDLE_LV_LSCH4 (BIT(3)) +#define LEDC_IDLE_LV_LSCH4_M (BIT(3)) +#define LEDC_IDLE_LV_LSCH4_V 0x1 +#define LEDC_IDLE_LV_LSCH4_S 3 +/* LEDC_SIG_OUT_EN_LSCH4 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_SIG_OUT_EN_LSCH4 (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH4_M (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH4_V 0x1 +#define LEDC_SIG_OUT_EN_LSCH4_S 2 +/* LEDC_TIMER_SEL_LSCH4 : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: */ +#define LEDC_TIMER_SEL_LSCH4 0x00000003 +#define LEDC_TIMER_SEL_LSCH4_M ((LEDC_TIMER_SEL_LSCH4_V)<<(LEDC_TIMER_SEL_LSCH4_S)) +#define LEDC_TIMER_SEL_LSCH4_V 0x3 +#define LEDC_TIMER_SEL_LSCH4_S 0 + +#define LEDC_LSCH4_HPOINT_REG (DR_REG_LEDC_BASE + 0x0054) +/* LEDC_HPOINT_LSCH4 : R/W ;bitpos:[13:0] ;default: 14'h0 ; */ +/*description: */ +#define LEDC_HPOINT_LSCH4 0x00003FFF +#define LEDC_HPOINT_LSCH4_M ((LEDC_HPOINT_LSCH4_V)<<(LEDC_HPOINT_LSCH4_S)) +#define LEDC_HPOINT_LSCH4_V 0x3FFF +#define LEDC_HPOINT_LSCH4_S 0 + +#define LEDC_LSCH4_DUTY_REG (DR_REG_LEDC_BASE + 0x0058) +/* LEDC_DUTY_LSCH4 : R/W ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH4 0x0007FFFF +#define LEDC_DUTY_LSCH4_M ((LEDC_DUTY_LSCH4_V)<<(LEDC_DUTY_LSCH4_S)) +#define LEDC_DUTY_LSCH4_V 0x7FFFF +#define LEDC_DUTY_LSCH4_S 0 + +#define LEDC_LSCH4_CONF1_REG (DR_REG_LEDC_BASE + 0x005C) +/* LEDC_DUTY_START_LSCH4 : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_START_LSCH4 (BIT(31)) +#define LEDC_DUTY_START_LSCH4_M (BIT(31)) +#define LEDC_DUTY_START_LSCH4_V 0x1 +#define LEDC_DUTY_START_LSCH4_S 31 +/* LEDC_DUTY_INC_LSCH4 : R/W ;bitpos:[30] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_DUTY_INC_LSCH4 (BIT(30)) +#define LEDC_DUTY_INC_LSCH4_M (BIT(30)) +#define LEDC_DUTY_INC_LSCH4_V 0x1 +#define LEDC_DUTY_INC_LSCH4_S 30 +/* LEDC_DUTY_NUM_LSCH4 : R/W ;bitpos:[29:20] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_NUM_LSCH4 0x000003FF +#define LEDC_DUTY_NUM_LSCH4_M ((LEDC_DUTY_NUM_LSCH4_V)<<(LEDC_DUTY_NUM_LSCH4_S)) +#define LEDC_DUTY_NUM_LSCH4_V 0x3FF +#define LEDC_DUTY_NUM_LSCH4_S 20 +/* LEDC_DUTY_CYCLE_LSCH4 : R/W ;bitpos:[19:10] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_CYCLE_LSCH4 0x000003FF +#define LEDC_DUTY_CYCLE_LSCH4_M ((LEDC_DUTY_CYCLE_LSCH4_V)<<(LEDC_DUTY_CYCLE_LSCH4_S)) +#define LEDC_DUTY_CYCLE_LSCH4_V 0x3FF +#define LEDC_DUTY_CYCLE_LSCH4_S 10 +/* LEDC_DUTY_SCALE_LSCH4 : R/W ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_SCALE_LSCH4 0x000003FF +#define LEDC_DUTY_SCALE_LSCH4_M ((LEDC_DUTY_SCALE_LSCH4_V)<<(LEDC_DUTY_SCALE_LSCH4_S)) +#define LEDC_DUTY_SCALE_LSCH4_V 0x3FF +#define LEDC_DUTY_SCALE_LSCH4_S 0 + +#define LEDC_LSCH4_DUTY_R_REG (DR_REG_LEDC_BASE + 0x0060) +/* LEDC_DUTY_LSCH4 : RO ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH4 0x0007FFFF +#define LEDC_DUTY_LSCH4_M ((LEDC_DUTY_LSCH4_V)<<(LEDC_DUTY_LSCH4_S)) +#define LEDC_DUTY_LSCH4_V 0x7FFFF +#define LEDC_DUTY_LSCH4_S 0 + +#define LEDC_LSCH5_CONF0_REG (DR_REG_LEDC_BASE + 0x0064) +/* LEDC_OVF_CNT_RESET_ST_LSCH5 : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_ST_LSCH5 (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH5_M (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH5_V 0x1 +#define LEDC_OVF_CNT_RESET_ST_LSCH5_S 17 +/* LEDC_OVF_CNT_RESET_LSCH5 : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_LSCH5 (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH5_M (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH5_V 0x1 +#define LEDC_OVF_CNT_RESET_LSCH5_S 16 +/* LEDC_OVF_CNT_EN_LSCH5 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_EN_LSCH5 (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH5_M (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH5_V 0x1 +#define LEDC_OVF_CNT_EN_LSCH5_S 15 +/* LEDC_OVF_NUM_LSCH5 : R/W ;bitpos:[14:5] ;default: 10'b0 ; */ +/*description: */ +#define LEDC_OVF_NUM_LSCH5 0x000003FF +#define LEDC_OVF_NUM_LSCH5_M ((LEDC_OVF_NUM_LSCH5_V)<<(LEDC_OVF_NUM_LSCH5_S)) +#define LEDC_OVF_NUM_LSCH5_V 0x3FF +#define LEDC_OVF_NUM_LSCH5_S 5 +/* LEDC_PARA_UP_LSCH5 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_PARA_UP_LSCH5 (BIT(4)) +#define LEDC_PARA_UP_LSCH5_M (BIT(4)) +#define LEDC_PARA_UP_LSCH5_V 0x1 +#define LEDC_PARA_UP_LSCH5_S 4 +/* LEDC_IDLE_LV_LSCH5 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_IDLE_LV_LSCH5 (BIT(3)) +#define LEDC_IDLE_LV_LSCH5_M (BIT(3)) +#define LEDC_IDLE_LV_LSCH5_V 0x1 +#define LEDC_IDLE_LV_LSCH5_S 3 +/* LEDC_SIG_OUT_EN_LSCH5 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_SIG_OUT_EN_LSCH5 (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH5_M (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH5_V 0x1 +#define LEDC_SIG_OUT_EN_LSCH5_S 2 +/* LEDC_TIMER_SEL_LSCH5 : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: */ +#define LEDC_TIMER_SEL_LSCH5 0x00000003 +#define LEDC_TIMER_SEL_LSCH5_M ((LEDC_TIMER_SEL_LSCH5_V)<<(LEDC_TIMER_SEL_LSCH5_S)) +#define LEDC_TIMER_SEL_LSCH5_V 0x3 +#define LEDC_TIMER_SEL_LSCH5_S 0 + +#define LEDC_LSCH5_HPOINT_REG (DR_REG_LEDC_BASE + 0x0068) +/* LEDC_HPOINT_LSCH5 : R/W ;bitpos:[13:0] ;default: 14'h0 ; */ +/*description: */ +#define LEDC_HPOINT_LSCH5 0x00003FFF +#define LEDC_HPOINT_LSCH5_M ((LEDC_HPOINT_LSCH5_V)<<(LEDC_HPOINT_LSCH5_S)) +#define LEDC_HPOINT_LSCH5_V 0x3FFF +#define LEDC_HPOINT_LSCH5_S 0 + +#define LEDC_LSCH5_DUTY_REG (DR_REG_LEDC_BASE + 0x006C) +/* LEDC_DUTY_LSCH5 : R/W ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH5 0x0007FFFF +#define LEDC_DUTY_LSCH5_M ((LEDC_DUTY_LSCH5_V)<<(LEDC_DUTY_LSCH5_S)) +#define LEDC_DUTY_LSCH5_V 0x7FFFF +#define LEDC_DUTY_LSCH5_S 0 + +#define LEDC_LSCH5_CONF1_REG (DR_REG_LEDC_BASE + 0x0070) +/* LEDC_DUTY_START_LSCH5 : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_START_LSCH5 (BIT(31)) +#define LEDC_DUTY_START_LSCH5_M (BIT(31)) +#define LEDC_DUTY_START_LSCH5_V 0x1 +#define LEDC_DUTY_START_LSCH5_S 31 +/* LEDC_DUTY_INC_LSCH5 : R/W ;bitpos:[30] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_DUTY_INC_LSCH5 (BIT(30)) +#define LEDC_DUTY_INC_LSCH5_M (BIT(30)) +#define LEDC_DUTY_INC_LSCH5_V 0x1 +#define LEDC_DUTY_INC_LSCH5_S 30 +/* LEDC_DUTY_NUM_LSCH5 : R/W ;bitpos:[29:20] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_NUM_LSCH5 0x000003FF +#define LEDC_DUTY_NUM_LSCH5_M ((LEDC_DUTY_NUM_LSCH5_V)<<(LEDC_DUTY_NUM_LSCH5_S)) +#define LEDC_DUTY_NUM_LSCH5_V 0x3FF +#define LEDC_DUTY_NUM_LSCH5_S 20 +/* LEDC_DUTY_CYCLE_LSCH5 : R/W ;bitpos:[19:10] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_CYCLE_LSCH5 0x000003FF +#define LEDC_DUTY_CYCLE_LSCH5_M ((LEDC_DUTY_CYCLE_LSCH5_V)<<(LEDC_DUTY_CYCLE_LSCH5_S)) +#define LEDC_DUTY_CYCLE_LSCH5_V 0x3FF +#define LEDC_DUTY_CYCLE_LSCH5_S 10 +/* LEDC_DUTY_SCALE_LSCH5 : R/W ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_SCALE_LSCH5 0x000003FF +#define LEDC_DUTY_SCALE_LSCH5_M ((LEDC_DUTY_SCALE_LSCH5_V)<<(LEDC_DUTY_SCALE_LSCH5_S)) +#define LEDC_DUTY_SCALE_LSCH5_V 0x3FF +#define LEDC_DUTY_SCALE_LSCH5_S 0 + +#define LEDC_LSCH5_DUTY_R_REG (DR_REG_LEDC_BASE + 0x0074) +/* LEDC_DUTY_LSCH5 : RO ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH5 0x0007FFFF +#define LEDC_DUTY_LSCH5_M ((LEDC_DUTY_LSCH5_V)<<(LEDC_DUTY_LSCH5_S)) +#define LEDC_DUTY_LSCH5_V 0x7FFFF +#define LEDC_DUTY_LSCH5_S 0 + +#define LEDC_LSCH6_CONF0_REG (DR_REG_LEDC_BASE + 0x0078) +/* LEDC_OVF_CNT_RESET_ST_LSCH6 : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_ST_LSCH6 (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH6_M (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH6_V 0x1 +#define LEDC_OVF_CNT_RESET_ST_LSCH6_S 17 +/* LEDC_OVF_CNT_RESET_LSCH6 : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_LSCH6 (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH6_M (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH6_V 0x1 +#define LEDC_OVF_CNT_RESET_LSCH6_S 16 +/* LEDC_OVF_CNT_EN_LSCH6 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_EN_LSCH6 (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH6_M (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH6_V 0x1 +#define LEDC_OVF_CNT_EN_LSCH6_S 15 +/* LEDC_OVF_NUM_LSCH6 : R/W ;bitpos:[14:5] ;default: 10'b0 ; */ +/*description: */ +#define LEDC_OVF_NUM_LSCH6 0x000003FF +#define LEDC_OVF_NUM_LSCH6_M ((LEDC_OVF_NUM_LSCH6_V)<<(LEDC_OVF_NUM_LSCH6_S)) +#define LEDC_OVF_NUM_LSCH6_V 0x3FF +#define LEDC_OVF_NUM_LSCH6_S 5 +/* LEDC_PARA_UP_LSCH6 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_PARA_UP_LSCH6 (BIT(4)) +#define LEDC_PARA_UP_LSCH6_M (BIT(4)) +#define LEDC_PARA_UP_LSCH6_V 0x1 +#define LEDC_PARA_UP_LSCH6_S 4 +/* LEDC_IDLE_LV_LSCH6 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_IDLE_LV_LSCH6 (BIT(3)) +#define LEDC_IDLE_LV_LSCH6_M (BIT(3)) +#define LEDC_IDLE_LV_LSCH6_V 0x1 +#define LEDC_IDLE_LV_LSCH6_S 3 +/* LEDC_SIG_OUT_EN_LSCH6 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_SIG_OUT_EN_LSCH6 (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH6_M (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH6_V 0x1 +#define LEDC_SIG_OUT_EN_LSCH6_S 2 +/* LEDC_TIMER_SEL_LSCH6 : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: */ +#define LEDC_TIMER_SEL_LSCH6 0x00000003 +#define LEDC_TIMER_SEL_LSCH6_M ((LEDC_TIMER_SEL_LSCH6_V)<<(LEDC_TIMER_SEL_LSCH6_S)) +#define LEDC_TIMER_SEL_LSCH6_V 0x3 +#define LEDC_TIMER_SEL_LSCH6_S 0 + +#define LEDC_LSCH6_HPOINT_REG (DR_REG_LEDC_BASE + 0x007C) +/* LEDC_HPOINT_LSCH6 : R/W ;bitpos:[13:0] ;default: 14'h0 ; */ +/*description: */ +#define LEDC_HPOINT_LSCH6 0x00003FFF +#define LEDC_HPOINT_LSCH6_M ((LEDC_HPOINT_LSCH6_V)<<(LEDC_HPOINT_LSCH6_S)) +#define LEDC_HPOINT_LSCH6_V 0x3FFF +#define LEDC_HPOINT_LSCH6_S 0 + +#define LEDC_LSCH6_DUTY_REG (DR_REG_LEDC_BASE + 0x0080) +/* LEDC_DUTY_LSCH6 : R/W ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH6 0x0007FFFF +#define LEDC_DUTY_LSCH6_M ((LEDC_DUTY_LSCH6_V)<<(LEDC_DUTY_LSCH6_S)) +#define LEDC_DUTY_LSCH6_V 0x7FFFF +#define LEDC_DUTY_LSCH6_S 0 + +#define LEDC_LSCH6_CONF1_REG (DR_REG_LEDC_BASE + 0x0084) +/* LEDC_DUTY_START_LSCH6 : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_START_LSCH6 (BIT(31)) +#define LEDC_DUTY_START_LSCH6_M (BIT(31)) +#define LEDC_DUTY_START_LSCH6_V 0x1 +#define LEDC_DUTY_START_LSCH6_S 31 +/* LEDC_DUTY_INC_LSCH6 : R/W ;bitpos:[30] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_DUTY_INC_LSCH6 (BIT(30)) +#define LEDC_DUTY_INC_LSCH6_M (BIT(30)) +#define LEDC_DUTY_INC_LSCH6_V 0x1 +#define LEDC_DUTY_INC_LSCH6_S 30 +/* LEDC_DUTY_NUM_LSCH6 : R/W ;bitpos:[29:20] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_NUM_LSCH6 0x000003FF +#define LEDC_DUTY_NUM_LSCH6_M ((LEDC_DUTY_NUM_LSCH6_V)<<(LEDC_DUTY_NUM_LSCH6_S)) +#define LEDC_DUTY_NUM_LSCH6_V 0x3FF +#define LEDC_DUTY_NUM_LSCH6_S 20 +/* LEDC_DUTY_CYCLE_LSCH6 : R/W ;bitpos:[19:10] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_CYCLE_LSCH6 0x000003FF +#define LEDC_DUTY_CYCLE_LSCH6_M ((LEDC_DUTY_CYCLE_LSCH6_V)<<(LEDC_DUTY_CYCLE_LSCH6_S)) +#define LEDC_DUTY_CYCLE_LSCH6_V 0x3FF +#define LEDC_DUTY_CYCLE_LSCH6_S 10 +/* LEDC_DUTY_SCALE_LSCH6 : R/W ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_SCALE_LSCH6 0x000003FF +#define LEDC_DUTY_SCALE_LSCH6_M ((LEDC_DUTY_SCALE_LSCH6_V)<<(LEDC_DUTY_SCALE_LSCH6_S)) +#define LEDC_DUTY_SCALE_LSCH6_V 0x3FF +#define LEDC_DUTY_SCALE_LSCH6_S 0 + +#define LEDC_LSCH6_DUTY_R_REG (DR_REG_LEDC_BASE + 0x0088) +/* LEDC_DUTY_LSCH6 : RO ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH6 0x0007FFFF +#define LEDC_DUTY_LSCH6_M ((LEDC_DUTY_LSCH6_V)<<(LEDC_DUTY_LSCH6_S)) +#define LEDC_DUTY_LSCH6_V 0x7FFFF +#define LEDC_DUTY_LSCH6_S 0 + +#define LEDC_LSCH7_CONF0_REG (DR_REG_LEDC_BASE + 0x008C) +/* LEDC_OVF_CNT_RESET_ST_LSCH7 : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_ST_LSCH7 (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH7_M (BIT(17)) +#define LEDC_OVF_CNT_RESET_ST_LSCH7_V 0x1 +#define LEDC_OVF_CNT_RESET_ST_LSCH7_S 17 +/* LEDC_OVF_CNT_RESET_LSCH7 : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_RESET_LSCH7 (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH7_M (BIT(16)) +#define LEDC_OVF_CNT_RESET_LSCH7_V 0x1 +#define LEDC_OVF_CNT_RESET_LSCH7_S 16 +/* LEDC_OVF_CNT_EN_LSCH7 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_EN_LSCH7 (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH7_M (BIT(15)) +#define LEDC_OVF_CNT_EN_LSCH7_V 0x1 +#define LEDC_OVF_CNT_EN_LSCH7_S 15 +/* LEDC_OVF_NUM_LSCH7 : R/W ;bitpos:[14:5] ;default: 10'b0 ; */ +/*description: */ +#define LEDC_OVF_NUM_LSCH7 0x000003FF +#define LEDC_OVF_NUM_LSCH7_M ((LEDC_OVF_NUM_LSCH7_V)<<(LEDC_OVF_NUM_LSCH7_S)) +#define LEDC_OVF_NUM_LSCH7_V 0x3FF +#define LEDC_OVF_NUM_LSCH7_S 5 +/* LEDC_PARA_UP_LSCH7 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_PARA_UP_LSCH7 (BIT(4)) +#define LEDC_PARA_UP_LSCH7_M (BIT(4)) +#define LEDC_PARA_UP_LSCH7_V 0x1 +#define LEDC_PARA_UP_LSCH7_S 4 +/* LEDC_IDLE_LV_LSCH7 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_IDLE_LV_LSCH7 (BIT(3)) +#define LEDC_IDLE_LV_LSCH7_M (BIT(3)) +#define LEDC_IDLE_LV_LSCH7_V 0x1 +#define LEDC_IDLE_LV_LSCH7_S 3 +/* LEDC_SIG_OUT_EN_LSCH7 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_SIG_OUT_EN_LSCH7 (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH7_M (BIT(2)) +#define LEDC_SIG_OUT_EN_LSCH7_V 0x1 +#define LEDC_SIG_OUT_EN_LSCH7_S 2 +/* LEDC_TIMER_SEL_LSCH7 : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: */ +#define LEDC_TIMER_SEL_LSCH7 0x00000003 +#define LEDC_TIMER_SEL_LSCH7_M ((LEDC_TIMER_SEL_LSCH7_V)<<(LEDC_TIMER_SEL_LSCH7_S)) +#define LEDC_TIMER_SEL_LSCH7_V 0x3 +#define LEDC_TIMER_SEL_LSCH7_S 0 + +#define LEDC_LSCH7_HPOINT_REG (DR_REG_LEDC_BASE + 0x0090) +/* LEDC_HPOINT_LSCH7 : R/W ;bitpos:[13:0] ;default: 14'h0 ; */ +/*description: */ +#define LEDC_HPOINT_LSCH7 0x00003FFF +#define LEDC_HPOINT_LSCH7_M ((LEDC_HPOINT_LSCH7_V)<<(LEDC_HPOINT_LSCH7_S)) +#define LEDC_HPOINT_LSCH7_V 0x3FFF +#define LEDC_HPOINT_LSCH7_S 0 + +#define LEDC_LSCH7_DUTY_REG (DR_REG_LEDC_BASE + 0x0094) +/* LEDC_DUTY_LSCH7 : R/W ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH7 0x0007FFFF +#define LEDC_DUTY_LSCH7_M ((LEDC_DUTY_LSCH7_V)<<(LEDC_DUTY_LSCH7_S)) +#define LEDC_DUTY_LSCH7_V 0x7FFFF +#define LEDC_DUTY_LSCH7_S 0 + +#define LEDC_LSCH7_CONF1_REG (DR_REG_LEDC_BASE + 0x0098) +/* LEDC_DUTY_START_LSCH7 : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_START_LSCH7 (BIT(31)) +#define LEDC_DUTY_START_LSCH7_M (BIT(31)) +#define LEDC_DUTY_START_LSCH7_V 0x1 +#define LEDC_DUTY_START_LSCH7_S 31 +/* LEDC_DUTY_INC_LSCH7 : R/W ;bitpos:[30] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_DUTY_INC_LSCH7 (BIT(30)) +#define LEDC_DUTY_INC_LSCH7_M (BIT(30)) +#define LEDC_DUTY_INC_LSCH7_V 0x1 +#define LEDC_DUTY_INC_LSCH7_S 30 +/* LEDC_DUTY_NUM_LSCH7 : R/W ;bitpos:[29:20] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_NUM_LSCH7 0x000003FF +#define LEDC_DUTY_NUM_LSCH7_M ((LEDC_DUTY_NUM_LSCH7_V)<<(LEDC_DUTY_NUM_LSCH7_S)) +#define LEDC_DUTY_NUM_LSCH7_V 0x3FF +#define LEDC_DUTY_NUM_LSCH7_S 20 +/* LEDC_DUTY_CYCLE_LSCH7 : R/W ;bitpos:[19:10] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_CYCLE_LSCH7 0x000003FF +#define LEDC_DUTY_CYCLE_LSCH7_M ((LEDC_DUTY_CYCLE_LSCH7_V)<<(LEDC_DUTY_CYCLE_LSCH7_S)) +#define LEDC_DUTY_CYCLE_LSCH7_V 0x3FF +#define LEDC_DUTY_CYCLE_LSCH7_S 10 +/* LEDC_DUTY_SCALE_LSCH7 : R/W ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define LEDC_DUTY_SCALE_LSCH7 0x000003FF +#define LEDC_DUTY_SCALE_LSCH7_M ((LEDC_DUTY_SCALE_LSCH7_V)<<(LEDC_DUTY_SCALE_LSCH7_S)) +#define LEDC_DUTY_SCALE_LSCH7_V 0x3FF +#define LEDC_DUTY_SCALE_LSCH7_S 0 + +#define LEDC_LSCH7_DUTY_R_REG (DR_REG_LEDC_BASE + 0x009C) +/* LEDC_DUTY_LSCH7 : RO ;bitpos:[18:0] ;default: 19'h0 ; */ +/*description: */ +#define LEDC_DUTY_LSCH7 0x0007FFFF +#define LEDC_DUTY_LSCH7_M ((LEDC_DUTY_LSCH7_V)<<(LEDC_DUTY_LSCH7_S)) +#define LEDC_DUTY_LSCH7_V 0x7FFFF +#define LEDC_DUTY_LSCH7_S 0 + +#define LEDC_LSTIMER0_CONF_REG (DR_REG_LEDC_BASE + 0x00a0) +/* LEDC_LSTIMER0_PARA_UP : WO ;bitpos:[25] ;default: 1'h0 ; */ +/*description: */ +#define LEDC_LSTIMER0_PARA_UP (BIT(25)) +#define LEDC_LSTIMER0_PARA_UP_M (BIT(25)) +#define LEDC_LSTIMER0_PARA_UP_V 0x1 +#define LEDC_LSTIMER0_PARA_UP_S 25 +/* LEDC_TICK_SEL_LSTIMER0 : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_TICK_SEL_LSTIMER0 (BIT(24)) +#define LEDC_TICK_SEL_LSTIMER0_M (BIT(24)) +#define LEDC_TICK_SEL_LSTIMER0_V 0x1 +#define LEDC_TICK_SEL_LSTIMER0_S 24 +/* LEDC_LSTIMER0_RST : R/W ;bitpos:[23] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_LSTIMER0_RST (BIT(23)) +#define LEDC_LSTIMER0_RST_M (BIT(23)) +#define LEDC_LSTIMER0_RST_V 0x1 +#define LEDC_LSTIMER0_RST_S 23 +/* LEDC_LSTIMER0_PAUSE : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER0_PAUSE (BIT(22)) +#define LEDC_LSTIMER0_PAUSE_M (BIT(22)) +#define LEDC_LSTIMER0_PAUSE_V 0x1 +#define LEDC_LSTIMER0_PAUSE_S 22 +/* LEDC_CLK_DIV_LSTIMER0 : R/W ;bitpos:[21:4] ;default: 18'h0 ; */ +/*description: */ +#define LEDC_CLK_DIV_LSTIMER0 0x0003FFFF +#define LEDC_CLK_DIV_LSTIMER0_M ((LEDC_CLK_DIV_LSTIMER0_V)<<(LEDC_CLK_DIV_LSTIMER0_S)) +#define LEDC_CLK_DIV_LSTIMER0_V 0x3FFFF +#define LEDC_CLK_DIV_LSTIMER0_S 4 +/* LEDC_LSTIMER0_DUTY_RES : R/W ;bitpos:[3:0] ;default: 4'h0 ; */ +/*description: */ +#define LEDC_LSTIMER0_DUTY_RES 0x0000000F +#define LEDC_LSTIMER0_DUTY_RES_M ((LEDC_LSTIMER0_DUTY_RES_V)<<(LEDC_LSTIMER0_DUTY_RES_S)) +#define LEDC_LSTIMER0_DUTY_RES_V 0xF +#define LEDC_LSTIMER0_DUTY_RES_S 0 + +#define LEDC_LSTIMER0_VALUE_REG (DR_REG_LEDC_BASE + 0x00a4) +/* LEDC_LSTIMER0_CNT : RO ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: */ +#define LEDC_LSTIMER0_CNT 0x00003FFF +#define LEDC_LSTIMER0_CNT_M ((LEDC_LSTIMER0_CNT_V)<<(LEDC_LSTIMER0_CNT_S)) +#define LEDC_LSTIMER0_CNT_V 0x3FFF +#define LEDC_LSTIMER0_CNT_S 0 + +#define LEDC_LSTIMER1_CONF_REG (DR_REG_LEDC_BASE + 0x00a8) +/* LEDC_LSTIMER1_PARA_UP : WO ;bitpos:[25] ;default: 1'h0 ; */ +/*description: */ +#define LEDC_LSTIMER1_PARA_UP (BIT(25)) +#define LEDC_LSTIMER1_PARA_UP_M (BIT(25)) +#define LEDC_LSTIMER1_PARA_UP_V 0x1 +#define LEDC_LSTIMER1_PARA_UP_S 25 +/* LEDC_TICK_SEL_LSTIMER1 : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_TICK_SEL_LSTIMER1 (BIT(24)) +#define LEDC_TICK_SEL_LSTIMER1_M (BIT(24)) +#define LEDC_TICK_SEL_LSTIMER1_V 0x1 +#define LEDC_TICK_SEL_LSTIMER1_S 24 +/* LEDC_LSTIMER1_RST : R/W ;bitpos:[23] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_LSTIMER1_RST (BIT(23)) +#define LEDC_LSTIMER1_RST_M (BIT(23)) +#define LEDC_LSTIMER1_RST_V 0x1 +#define LEDC_LSTIMER1_RST_S 23 +/* LEDC_LSTIMER1_PAUSE : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER1_PAUSE (BIT(22)) +#define LEDC_LSTIMER1_PAUSE_M (BIT(22)) +#define LEDC_LSTIMER1_PAUSE_V 0x1 +#define LEDC_LSTIMER1_PAUSE_S 22 +/* LEDC_CLK_DIV_LSTIMER1 : R/W ;bitpos:[21:4] ;default: 18'h0 ; */ +/*description: */ +#define LEDC_CLK_DIV_LSTIMER1 0x0003FFFF +#define LEDC_CLK_DIV_LSTIMER1_M ((LEDC_CLK_DIV_LSTIMER1_V)<<(LEDC_CLK_DIV_LSTIMER1_S)) +#define LEDC_CLK_DIV_LSTIMER1_V 0x3FFFF +#define LEDC_CLK_DIV_LSTIMER1_S 4 +/* LEDC_LSTIMER1_DUTY_RES : R/W ;bitpos:[3:0] ;default: 4'h0 ; */ +/*description: */ +#define LEDC_LSTIMER1_DUTY_RES 0x0000000F +#define LEDC_LSTIMER1_DUTY_RES_M ((LEDC_LSTIMER1_DUTY_RES_V)<<(LEDC_LSTIMER1_DUTY_RES_S)) +#define LEDC_LSTIMER1_DUTY_RES_V 0xF +#define LEDC_LSTIMER1_DUTY_RES_S 0 + +#define LEDC_LSTIMER1_VALUE_REG (DR_REG_LEDC_BASE + 0x00aC) +/* LEDC_LSTIMER1_CNT : RO ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: */ +#define LEDC_LSTIMER1_CNT 0x00003FFF +#define LEDC_LSTIMER1_CNT_M ((LEDC_LSTIMER1_CNT_V)<<(LEDC_LSTIMER1_CNT_S)) +#define LEDC_LSTIMER1_CNT_V 0x3FFF +#define LEDC_LSTIMER1_CNT_S 0 + +#define LEDC_LSTIMER2_CONF_REG (DR_REG_LEDC_BASE + 0x00b0) +/* LEDC_LSTIMER2_PARA_UP : WO ;bitpos:[25] ;default: 1'h0 ; */ +/*description: */ +#define LEDC_LSTIMER2_PARA_UP (BIT(25)) +#define LEDC_LSTIMER2_PARA_UP_M (BIT(25)) +#define LEDC_LSTIMER2_PARA_UP_V 0x1 +#define LEDC_LSTIMER2_PARA_UP_S 25 +/* LEDC_TICK_SEL_LSTIMER2 : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_TICK_SEL_LSTIMER2 (BIT(24)) +#define LEDC_TICK_SEL_LSTIMER2_M (BIT(24)) +#define LEDC_TICK_SEL_LSTIMER2_V 0x1 +#define LEDC_TICK_SEL_LSTIMER2_S 24 +/* LEDC_LSTIMER2_RST : R/W ;bitpos:[23] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_LSTIMER2_RST (BIT(23)) +#define LEDC_LSTIMER2_RST_M (BIT(23)) +#define LEDC_LSTIMER2_RST_V 0x1 +#define LEDC_LSTIMER2_RST_S 23 +/* LEDC_LSTIMER2_PAUSE : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER2_PAUSE (BIT(22)) +#define LEDC_LSTIMER2_PAUSE_M (BIT(22)) +#define LEDC_LSTIMER2_PAUSE_V 0x1 +#define LEDC_LSTIMER2_PAUSE_S 22 +/* LEDC_CLK_DIV_LSTIMER2 : R/W ;bitpos:[21:4] ;default: 18'h0 ; */ +/*description: */ +#define LEDC_CLK_DIV_LSTIMER2 0x0003FFFF +#define LEDC_CLK_DIV_LSTIMER2_M ((LEDC_CLK_DIV_LSTIMER2_V)<<(LEDC_CLK_DIV_LSTIMER2_S)) +#define LEDC_CLK_DIV_LSTIMER2_V 0x3FFFF +#define LEDC_CLK_DIV_LSTIMER2_S 4 +/* LEDC_LSTIMER2_DUTY_RES : R/W ;bitpos:[3:0] ;default: 4'h0 ; */ +/*description: */ +#define LEDC_LSTIMER2_DUTY_RES 0x0000000F +#define LEDC_LSTIMER2_DUTY_RES_M ((LEDC_LSTIMER2_DUTY_RES_V)<<(LEDC_LSTIMER2_DUTY_RES_S)) +#define LEDC_LSTIMER2_DUTY_RES_V 0xF +#define LEDC_LSTIMER2_DUTY_RES_S 0 + +#define LEDC_LSTIMER2_VALUE_REG (DR_REG_LEDC_BASE + 0x00b4) +/* LEDC_LSTIMER2_CNT : RO ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: */ +#define LEDC_LSTIMER2_CNT 0x00003FFF +#define LEDC_LSTIMER2_CNT_M ((LEDC_LSTIMER2_CNT_V)<<(LEDC_LSTIMER2_CNT_S)) +#define LEDC_LSTIMER2_CNT_V 0x3FFF +#define LEDC_LSTIMER2_CNT_S 0 + +#define LEDC_LSTIMER3_CONF_REG (DR_REG_LEDC_BASE + 0x00b8) +/* LEDC_LSTIMER3_PARA_UP : WO ;bitpos:[25] ;default: 1'h0 ; */ +/*description: */ +#define LEDC_LSTIMER3_PARA_UP (BIT(25)) +#define LEDC_LSTIMER3_PARA_UP_M (BIT(25)) +#define LEDC_LSTIMER3_PARA_UP_V 0x1 +#define LEDC_LSTIMER3_PARA_UP_S 25 +/* LEDC_TICK_SEL_LSTIMER3 : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_TICK_SEL_LSTIMER3 (BIT(24)) +#define LEDC_TICK_SEL_LSTIMER3_M (BIT(24)) +#define LEDC_TICK_SEL_LSTIMER3_V 0x1 +#define LEDC_TICK_SEL_LSTIMER3_S 24 +/* LEDC_LSTIMER3_RST : R/W ;bitpos:[23] ;default: 1'b1 ; */ +/*description: */ +#define LEDC_LSTIMER3_RST (BIT(23)) +#define LEDC_LSTIMER3_RST_M (BIT(23)) +#define LEDC_LSTIMER3_RST_V 0x1 +#define LEDC_LSTIMER3_RST_S 23 +/* LEDC_LSTIMER3_PAUSE : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER3_PAUSE (BIT(22)) +#define LEDC_LSTIMER3_PAUSE_M (BIT(22)) +#define LEDC_LSTIMER3_PAUSE_V 0x1 +#define LEDC_LSTIMER3_PAUSE_S 22 +/* LEDC_CLK_DIV_LSTIMER3 : R/W ;bitpos:[21:4] ;default: 18'h0 ; */ +/*description: */ +#define LEDC_CLK_DIV_LSTIMER3 0x0003FFFF +#define LEDC_CLK_DIV_LSTIMER3_M ((LEDC_CLK_DIV_LSTIMER3_V)<<(LEDC_CLK_DIV_LSTIMER3_S)) +#define LEDC_CLK_DIV_LSTIMER3_V 0x3FFFF +#define LEDC_CLK_DIV_LSTIMER3_S 4 +/* LEDC_LSTIMER3_DUTY_RES : R/W ;bitpos:[3:0] ;default: 4'h0 ; */ +/*description: */ +#define LEDC_LSTIMER3_DUTY_RES 0x0000000F +#define LEDC_LSTIMER3_DUTY_RES_M ((LEDC_LSTIMER3_DUTY_RES_V)<<(LEDC_LSTIMER3_DUTY_RES_S)) +#define LEDC_LSTIMER3_DUTY_RES_V 0xF +#define LEDC_LSTIMER3_DUTY_RES_S 0 + +#define LEDC_LSTIMER3_VALUE_REG (DR_REG_LEDC_BASE + 0x00bC) +/* LEDC_LSTIMER3_CNT : RO ;bitpos:[13:0] ;default: 14'b0 ; */ +/*description: */ +#define LEDC_LSTIMER3_CNT 0x00003FFF +#define LEDC_LSTIMER3_CNT_M ((LEDC_LSTIMER3_CNT_V)<<(LEDC_LSTIMER3_CNT_S)) +#define LEDC_LSTIMER3_CNT_V 0x3FFF +#define LEDC_LSTIMER3_CNT_S 0 + +#define LEDC_INT_RAW_REG (DR_REG_LEDC_BASE + 0x00c0) +/* LEDC_OVF_CNT_LSCH7_INT_RAW : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH7_INT_RAW (BIT(19)) +#define LEDC_OVF_CNT_LSCH7_INT_RAW_M (BIT(19)) +#define LEDC_OVF_CNT_LSCH7_INT_RAW_V 0x1 +#define LEDC_OVF_CNT_LSCH7_INT_RAW_S 19 +/* LEDC_OVF_CNT_LSCH6_INT_RAW : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH6_INT_RAW (BIT(18)) +#define LEDC_OVF_CNT_LSCH6_INT_RAW_M (BIT(18)) +#define LEDC_OVF_CNT_LSCH6_INT_RAW_V 0x1 +#define LEDC_OVF_CNT_LSCH6_INT_RAW_S 18 +/* LEDC_OVF_CNT_LSCH5_INT_RAW : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH5_INT_RAW (BIT(17)) +#define LEDC_OVF_CNT_LSCH5_INT_RAW_M (BIT(17)) +#define LEDC_OVF_CNT_LSCH5_INT_RAW_V 0x1 +#define LEDC_OVF_CNT_LSCH5_INT_RAW_S 17 +/* LEDC_OVF_CNT_LSCH4_INT_RAW : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH4_INT_RAW (BIT(16)) +#define LEDC_OVF_CNT_LSCH4_INT_RAW_M (BIT(16)) +#define LEDC_OVF_CNT_LSCH4_INT_RAW_V 0x1 +#define LEDC_OVF_CNT_LSCH4_INT_RAW_S 16 +/* LEDC_OVF_CNT_LSCH3_INT_RAW : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH3_INT_RAW (BIT(15)) +#define LEDC_OVF_CNT_LSCH3_INT_RAW_M (BIT(15)) +#define LEDC_OVF_CNT_LSCH3_INT_RAW_V 0x1 +#define LEDC_OVF_CNT_LSCH3_INT_RAW_S 15 +/* LEDC_OVF_CNT_LSCH2_INT_RAW : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH2_INT_RAW (BIT(14)) +#define LEDC_OVF_CNT_LSCH2_INT_RAW_M (BIT(14)) +#define LEDC_OVF_CNT_LSCH2_INT_RAW_V 0x1 +#define LEDC_OVF_CNT_LSCH2_INT_RAW_S 14 +/* LEDC_OVF_CNT_LSCH1_INT_RAW : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH1_INT_RAW (BIT(13)) +#define LEDC_OVF_CNT_LSCH1_INT_RAW_M (BIT(13)) +#define LEDC_OVF_CNT_LSCH1_INT_RAW_V 0x1 +#define LEDC_OVF_CNT_LSCH1_INT_RAW_S 13 +/* LEDC_OVF_CNT_LSCH0_INT_RAW : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH0_INT_RAW (BIT(12)) +#define LEDC_OVF_CNT_LSCH0_INT_RAW_M (BIT(12)) +#define LEDC_OVF_CNT_LSCH0_INT_RAW_V 0x1 +#define LEDC_OVF_CNT_LSCH0_INT_RAW_S 12 +/* LEDC_DUTY_CHNG_END_LSCH7_INT_RAW : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH7_INT_RAW (BIT(11)) +#define LEDC_DUTY_CHNG_END_LSCH7_INT_RAW_M (BIT(11)) +#define LEDC_DUTY_CHNG_END_LSCH7_INT_RAW_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH7_INT_RAW_S 11 +/* LEDC_DUTY_CHNG_END_LSCH6_INT_RAW : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH6_INT_RAW (BIT(10)) +#define LEDC_DUTY_CHNG_END_LSCH6_INT_RAW_M (BIT(10)) +#define LEDC_DUTY_CHNG_END_LSCH6_INT_RAW_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH6_INT_RAW_S 10 +/* LEDC_DUTY_CHNG_END_LSCH5_INT_RAW : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH5_INT_RAW (BIT(9)) +#define LEDC_DUTY_CHNG_END_LSCH5_INT_RAW_M (BIT(9)) +#define LEDC_DUTY_CHNG_END_LSCH5_INT_RAW_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH5_INT_RAW_S 9 +/* LEDC_DUTY_CHNG_END_LSCH4_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH4_INT_RAW (BIT(8)) +#define LEDC_DUTY_CHNG_END_LSCH4_INT_RAW_M (BIT(8)) +#define LEDC_DUTY_CHNG_END_LSCH4_INT_RAW_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH4_INT_RAW_S 8 +/* LEDC_DUTY_CHNG_END_LSCH3_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH3_INT_RAW (BIT(7)) +#define LEDC_DUTY_CHNG_END_LSCH3_INT_RAW_M (BIT(7)) +#define LEDC_DUTY_CHNG_END_LSCH3_INT_RAW_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH3_INT_RAW_S 7 +/* LEDC_DUTY_CHNG_END_LSCH2_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH2_INT_RAW (BIT(6)) +#define LEDC_DUTY_CHNG_END_LSCH2_INT_RAW_M (BIT(6)) +#define LEDC_DUTY_CHNG_END_LSCH2_INT_RAW_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH2_INT_RAW_S 6 +/* LEDC_DUTY_CHNG_END_LSCH1_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH1_INT_RAW (BIT(5)) +#define LEDC_DUTY_CHNG_END_LSCH1_INT_RAW_M (BIT(5)) +#define LEDC_DUTY_CHNG_END_LSCH1_INT_RAW_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH1_INT_RAW_S 5 +/* LEDC_DUTY_CHNG_END_LSCH0_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH0_INT_RAW (BIT(4)) +#define LEDC_DUTY_CHNG_END_LSCH0_INT_RAW_M (BIT(4)) +#define LEDC_DUTY_CHNG_END_LSCH0_INT_RAW_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH0_INT_RAW_S 4 +/* LEDC_LSTIMER3_OVF_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER3_OVF_INT_RAW (BIT(3)) +#define LEDC_LSTIMER3_OVF_INT_RAW_M (BIT(3)) +#define LEDC_LSTIMER3_OVF_INT_RAW_V 0x1 +#define LEDC_LSTIMER3_OVF_INT_RAW_S 3 +/* LEDC_LSTIMER2_OVF_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER2_OVF_INT_RAW (BIT(2)) +#define LEDC_LSTIMER2_OVF_INT_RAW_M (BIT(2)) +#define LEDC_LSTIMER2_OVF_INT_RAW_V 0x1 +#define LEDC_LSTIMER2_OVF_INT_RAW_S 2 +/* LEDC_LSTIMER1_OVF_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER1_OVF_INT_RAW (BIT(1)) +#define LEDC_LSTIMER1_OVF_INT_RAW_M (BIT(1)) +#define LEDC_LSTIMER1_OVF_INT_RAW_V 0x1 +#define LEDC_LSTIMER1_OVF_INT_RAW_S 1 +/* LEDC_LSTIMER0_OVF_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER0_OVF_INT_RAW (BIT(0)) +#define LEDC_LSTIMER0_OVF_INT_RAW_M (BIT(0)) +#define LEDC_LSTIMER0_OVF_INT_RAW_V 0x1 +#define LEDC_LSTIMER0_OVF_INT_RAW_S 0 + +#define LEDC_INT_ST_REG (DR_REG_LEDC_BASE + 0x00c4) +/* LEDC_OVF_CNT_LSCH7_INT_ST : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH7_INT_ST (BIT(19)) +#define LEDC_OVF_CNT_LSCH7_INT_ST_M (BIT(19)) +#define LEDC_OVF_CNT_LSCH7_INT_ST_V 0x1 +#define LEDC_OVF_CNT_LSCH7_INT_ST_S 19 +/* LEDC_OVF_CNT_LSCH6_INT_ST : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH6_INT_ST (BIT(18)) +#define LEDC_OVF_CNT_LSCH6_INT_ST_M (BIT(18)) +#define LEDC_OVF_CNT_LSCH6_INT_ST_V 0x1 +#define LEDC_OVF_CNT_LSCH6_INT_ST_S 18 +/* LEDC_OVF_CNT_LSCH5_INT_ST : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH5_INT_ST (BIT(17)) +#define LEDC_OVF_CNT_LSCH5_INT_ST_M (BIT(17)) +#define LEDC_OVF_CNT_LSCH5_INT_ST_V 0x1 +#define LEDC_OVF_CNT_LSCH5_INT_ST_S 17 +/* LEDC_OVF_CNT_LSCH4_INT_ST : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH4_INT_ST (BIT(16)) +#define LEDC_OVF_CNT_LSCH4_INT_ST_M (BIT(16)) +#define LEDC_OVF_CNT_LSCH4_INT_ST_V 0x1 +#define LEDC_OVF_CNT_LSCH4_INT_ST_S 16 +/* LEDC_OVF_CNT_LSCH3_INT_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH3_INT_ST (BIT(15)) +#define LEDC_OVF_CNT_LSCH3_INT_ST_M (BIT(15)) +#define LEDC_OVF_CNT_LSCH3_INT_ST_V 0x1 +#define LEDC_OVF_CNT_LSCH3_INT_ST_S 15 +/* LEDC_OVF_CNT_LSCH2_INT_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH2_INT_ST (BIT(14)) +#define LEDC_OVF_CNT_LSCH2_INT_ST_M (BIT(14)) +#define LEDC_OVF_CNT_LSCH2_INT_ST_V 0x1 +#define LEDC_OVF_CNT_LSCH2_INT_ST_S 14 +/* LEDC_OVF_CNT_LSCH1_INT_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH1_INT_ST (BIT(13)) +#define LEDC_OVF_CNT_LSCH1_INT_ST_M (BIT(13)) +#define LEDC_OVF_CNT_LSCH1_INT_ST_V 0x1 +#define LEDC_OVF_CNT_LSCH1_INT_ST_S 13 +/* LEDC_OVF_CNT_LSCH0_INT_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH0_INT_ST (BIT(12)) +#define LEDC_OVF_CNT_LSCH0_INT_ST_M (BIT(12)) +#define LEDC_OVF_CNT_LSCH0_INT_ST_V 0x1 +#define LEDC_OVF_CNT_LSCH0_INT_ST_S 12 +/* LEDC_DUTY_CHNG_END_LSCH7_INT_ST : RO ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH7_INT_ST (BIT(11)) +#define LEDC_DUTY_CHNG_END_LSCH7_INT_ST_M (BIT(11)) +#define LEDC_DUTY_CHNG_END_LSCH7_INT_ST_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH7_INT_ST_S 11 +/* LEDC_DUTY_CHNG_END_LSCH6_INT_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH6_INT_ST (BIT(10)) +#define LEDC_DUTY_CHNG_END_LSCH6_INT_ST_M (BIT(10)) +#define LEDC_DUTY_CHNG_END_LSCH6_INT_ST_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH6_INT_ST_S 10 +/* LEDC_DUTY_CHNG_END_LSCH5_INT_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH5_INT_ST (BIT(9)) +#define LEDC_DUTY_CHNG_END_LSCH5_INT_ST_M (BIT(9)) +#define LEDC_DUTY_CHNG_END_LSCH5_INT_ST_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH5_INT_ST_S 9 +/* LEDC_DUTY_CHNG_END_LSCH4_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH4_INT_ST (BIT(8)) +#define LEDC_DUTY_CHNG_END_LSCH4_INT_ST_M (BIT(8)) +#define LEDC_DUTY_CHNG_END_LSCH4_INT_ST_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH4_INT_ST_S 8 +/* LEDC_DUTY_CHNG_END_LSCH3_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH3_INT_ST (BIT(7)) +#define LEDC_DUTY_CHNG_END_LSCH3_INT_ST_M (BIT(7)) +#define LEDC_DUTY_CHNG_END_LSCH3_INT_ST_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH3_INT_ST_S 7 +/* LEDC_DUTY_CHNG_END_LSCH2_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH2_INT_ST (BIT(6)) +#define LEDC_DUTY_CHNG_END_LSCH2_INT_ST_M (BIT(6)) +#define LEDC_DUTY_CHNG_END_LSCH2_INT_ST_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH2_INT_ST_S 6 +/* LEDC_DUTY_CHNG_END_LSCH1_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH1_INT_ST (BIT(5)) +#define LEDC_DUTY_CHNG_END_LSCH1_INT_ST_M (BIT(5)) +#define LEDC_DUTY_CHNG_END_LSCH1_INT_ST_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH1_INT_ST_S 5 +/* LEDC_DUTY_CHNG_END_LSCH0_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH0_INT_ST (BIT(4)) +#define LEDC_DUTY_CHNG_END_LSCH0_INT_ST_M (BIT(4)) +#define LEDC_DUTY_CHNG_END_LSCH0_INT_ST_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH0_INT_ST_S 4 +/* LEDC_LSTIMER3_OVF_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER3_OVF_INT_ST (BIT(3)) +#define LEDC_LSTIMER3_OVF_INT_ST_M (BIT(3)) +#define LEDC_LSTIMER3_OVF_INT_ST_V 0x1 +#define LEDC_LSTIMER3_OVF_INT_ST_S 3 +/* LEDC_LSTIMER2_OVF_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER2_OVF_INT_ST (BIT(2)) +#define LEDC_LSTIMER2_OVF_INT_ST_M (BIT(2)) +#define LEDC_LSTIMER2_OVF_INT_ST_V 0x1 +#define LEDC_LSTIMER2_OVF_INT_ST_S 2 +/* LEDC_LSTIMER1_OVF_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER1_OVF_INT_ST (BIT(1)) +#define LEDC_LSTIMER1_OVF_INT_ST_M (BIT(1)) +#define LEDC_LSTIMER1_OVF_INT_ST_V 0x1 +#define LEDC_LSTIMER1_OVF_INT_ST_S 1 +/* LEDC_LSTIMER0_OVF_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER0_OVF_INT_ST (BIT(0)) +#define LEDC_LSTIMER0_OVF_INT_ST_M (BIT(0)) +#define LEDC_LSTIMER0_OVF_INT_ST_V 0x1 +#define LEDC_LSTIMER0_OVF_INT_ST_S 0 + +#define LEDC_INT_ENA_REG (DR_REG_LEDC_BASE + 0x00c8) +/* LEDC_OVF_CNT_LSCH7_INT_ENA : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH7_INT_ENA (BIT(19)) +#define LEDC_OVF_CNT_LSCH7_INT_ENA_M (BIT(19)) +#define LEDC_OVF_CNT_LSCH7_INT_ENA_V 0x1 +#define LEDC_OVF_CNT_LSCH7_INT_ENA_S 19 +/* LEDC_OVF_CNT_LSCH6_INT_ENA : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH6_INT_ENA (BIT(18)) +#define LEDC_OVF_CNT_LSCH6_INT_ENA_M (BIT(18)) +#define LEDC_OVF_CNT_LSCH6_INT_ENA_V 0x1 +#define LEDC_OVF_CNT_LSCH6_INT_ENA_S 18 +/* LEDC_OVF_CNT_LSCH5_INT_ENA : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH5_INT_ENA (BIT(17)) +#define LEDC_OVF_CNT_LSCH5_INT_ENA_M (BIT(17)) +#define LEDC_OVF_CNT_LSCH5_INT_ENA_V 0x1 +#define LEDC_OVF_CNT_LSCH5_INT_ENA_S 17 +/* LEDC_OVF_CNT_LSCH4_INT_ENA : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH4_INT_ENA (BIT(16)) +#define LEDC_OVF_CNT_LSCH4_INT_ENA_M (BIT(16)) +#define LEDC_OVF_CNT_LSCH4_INT_ENA_V 0x1 +#define LEDC_OVF_CNT_LSCH4_INT_ENA_S 16 +/* LEDC_OVF_CNT_LSCH3_INT_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH3_INT_ENA (BIT(15)) +#define LEDC_OVF_CNT_LSCH3_INT_ENA_M (BIT(15)) +#define LEDC_OVF_CNT_LSCH3_INT_ENA_V 0x1 +#define LEDC_OVF_CNT_LSCH3_INT_ENA_S 15 +/* LEDC_OVF_CNT_LSCH2_INT_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH2_INT_ENA (BIT(14)) +#define LEDC_OVF_CNT_LSCH2_INT_ENA_M (BIT(14)) +#define LEDC_OVF_CNT_LSCH2_INT_ENA_V 0x1 +#define LEDC_OVF_CNT_LSCH2_INT_ENA_S 14 +/* LEDC_OVF_CNT_LSCH1_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH1_INT_ENA (BIT(13)) +#define LEDC_OVF_CNT_LSCH1_INT_ENA_M (BIT(13)) +#define LEDC_OVF_CNT_LSCH1_INT_ENA_V 0x1 +#define LEDC_OVF_CNT_LSCH1_INT_ENA_S 13 +/* LEDC_OVF_CNT_LSCH0_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH0_INT_ENA (BIT(12)) +#define LEDC_OVF_CNT_LSCH0_INT_ENA_M (BIT(12)) +#define LEDC_OVF_CNT_LSCH0_INT_ENA_V 0x1 +#define LEDC_OVF_CNT_LSCH0_INT_ENA_S 12 +/* LEDC_DUTY_CHNG_END_LSCH7_INT_ENA : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH7_INT_ENA (BIT(11)) +#define LEDC_DUTY_CHNG_END_LSCH7_INT_ENA_M (BIT(11)) +#define LEDC_DUTY_CHNG_END_LSCH7_INT_ENA_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH7_INT_ENA_S 11 +/* LEDC_DUTY_CHNG_END_LSCH6_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH6_INT_ENA (BIT(10)) +#define LEDC_DUTY_CHNG_END_LSCH6_INT_ENA_M (BIT(10)) +#define LEDC_DUTY_CHNG_END_LSCH6_INT_ENA_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH6_INT_ENA_S 10 +/* LEDC_DUTY_CHNG_END_LSCH5_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH5_INT_ENA (BIT(9)) +#define LEDC_DUTY_CHNG_END_LSCH5_INT_ENA_M (BIT(9)) +#define LEDC_DUTY_CHNG_END_LSCH5_INT_ENA_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH5_INT_ENA_S 9 +/* LEDC_DUTY_CHNG_END_LSCH4_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH4_INT_ENA (BIT(8)) +#define LEDC_DUTY_CHNG_END_LSCH4_INT_ENA_M (BIT(8)) +#define LEDC_DUTY_CHNG_END_LSCH4_INT_ENA_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH4_INT_ENA_S 8 +/* LEDC_DUTY_CHNG_END_LSCH3_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH3_INT_ENA (BIT(7)) +#define LEDC_DUTY_CHNG_END_LSCH3_INT_ENA_M (BIT(7)) +#define LEDC_DUTY_CHNG_END_LSCH3_INT_ENA_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH3_INT_ENA_S 7 +/* LEDC_DUTY_CHNG_END_LSCH2_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH2_INT_ENA (BIT(6)) +#define LEDC_DUTY_CHNG_END_LSCH2_INT_ENA_M (BIT(6)) +#define LEDC_DUTY_CHNG_END_LSCH2_INT_ENA_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH2_INT_ENA_S 6 +/* LEDC_DUTY_CHNG_END_LSCH1_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH1_INT_ENA (BIT(5)) +#define LEDC_DUTY_CHNG_END_LSCH1_INT_ENA_M (BIT(5)) +#define LEDC_DUTY_CHNG_END_LSCH1_INT_ENA_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH1_INT_ENA_S 5 +/* LEDC_DUTY_CHNG_END_LSCH0_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH0_INT_ENA (BIT(4)) +#define LEDC_DUTY_CHNG_END_LSCH0_INT_ENA_M (BIT(4)) +#define LEDC_DUTY_CHNG_END_LSCH0_INT_ENA_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH0_INT_ENA_S 4 +/* LEDC_LSTIMER3_OVF_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER3_OVF_INT_ENA (BIT(3)) +#define LEDC_LSTIMER3_OVF_INT_ENA_M (BIT(3)) +#define LEDC_LSTIMER3_OVF_INT_ENA_V 0x1 +#define LEDC_LSTIMER3_OVF_INT_ENA_S 3 +/* LEDC_LSTIMER2_OVF_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER2_OVF_INT_ENA (BIT(2)) +#define LEDC_LSTIMER2_OVF_INT_ENA_M (BIT(2)) +#define LEDC_LSTIMER2_OVF_INT_ENA_V 0x1 +#define LEDC_LSTIMER2_OVF_INT_ENA_S 2 +/* LEDC_LSTIMER1_OVF_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER1_OVF_INT_ENA (BIT(1)) +#define LEDC_LSTIMER1_OVF_INT_ENA_M (BIT(1)) +#define LEDC_LSTIMER1_OVF_INT_ENA_V 0x1 +#define LEDC_LSTIMER1_OVF_INT_ENA_S 1 +/* LEDC_LSTIMER0_OVF_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER0_OVF_INT_ENA (BIT(0)) +#define LEDC_LSTIMER0_OVF_INT_ENA_M (BIT(0)) +#define LEDC_LSTIMER0_OVF_INT_ENA_V 0x1 +#define LEDC_LSTIMER0_OVF_INT_ENA_S 0 + +#define LEDC_INT_CLR_REG (DR_REG_LEDC_BASE + 0x00cC) +/* LEDC_OVF_CNT_LSCH7_INT_CLR : WO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH7_INT_CLR (BIT(19)) +#define LEDC_OVF_CNT_LSCH7_INT_CLR_M (BIT(19)) +#define LEDC_OVF_CNT_LSCH7_INT_CLR_V 0x1 +#define LEDC_OVF_CNT_LSCH7_INT_CLR_S 19 +/* LEDC_OVF_CNT_LSCH6_INT_CLR : WO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH6_INT_CLR (BIT(18)) +#define LEDC_OVF_CNT_LSCH6_INT_CLR_M (BIT(18)) +#define LEDC_OVF_CNT_LSCH6_INT_CLR_V 0x1 +#define LEDC_OVF_CNT_LSCH6_INT_CLR_S 18 +/* LEDC_OVF_CNT_LSCH5_INT_CLR : WO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH5_INT_CLR (BIT(17)) +#define LEDC_OVF_CNT_LSCH5_INT_CLR_M (BIT(17)) +#define LEDC_OVF_CNT_LSCH5_INT_CLR_V 0x1 +#define LEDC_OVF_CNT_LSCH5_INT_CLR_S 17 +/* LEDC_OVF_CNT_LSCH4_INT_CLR : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH4_INT_CLR (BIT(16)) +#define LEDC_OVF_CNT_LSCH4_INT_CLR_M (BIT(16)) +#define LEDC_OVF_CNT_LSCH4_INT_CLR_V 0x1 +#define LEDC_OVF_CNT_LSCH4_INT_CLR_S 16 +/* LEDC_OVF_CNT_LSCH3_INT_CLR : WO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH3_INT_CLR (BIT(15)) +#define LEDC_OVF_CNT_LSCH3_INT_CLR_M (BIT(15)) +#define LEDC_OVF_CNT_LSCH3_INT_CLR_V 0x1 +#define LEDC_OVF_CNT_LSCH3_INT_CLR_S 15 +/* LEDC_OVF_CNT_LSCH2_INT_CLR : WO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH2_INT_CLR (BIT(14)) +#define LEDC_OVF_CNT_LSCH2_INT_CLR_M (BIT(14)) +#define LEDC_OVF_CNT_LSCH2_INT_CLR_V 0x1 +#define LEDC_OVF_CNT_LSCH2_INT_CLR_S 14 +/* LEDC_OVF_CNT_LSCH1_INT_CLR : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH1_INT_CLR (BIT(13)) +#define LEDC_OVF_CNT_LSCH1_INT_CLR_M (BIT(13)) +#define LEDC_OVF_CNT_LSCH1_INT_CLR_V 0x1 +#define LEDC_OVF_CNT_LSCH1_INT_CLR_S 13 +/* LEDC_OVF_CNT_LSCH0_INT_CLR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_OVF_CNT_LSCH0_INT_CLR (BIT(12)) +#define LEDC_OVF_CNT_LSCH0_INT_CLR_M (BIT(12)) +#define LEDC_OVF_CNT_LSCH0_INT_CLR_V 0x1 +#define LEDC_OVF_CNT_LSCH0_INT_CLR_S 12 +/* LEDC_DUTY_CHNG_END_LSCH7_INT_CLR : WO ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH7_INT_CLR (BIT(11)) +#define LEDC_DUTY_CHNG_END_LSCH7_INT_CLR_M (BIT(11)) +#define LEDC_DUTY_CHNG_END_LSCH7_INT_CLR_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH7_INT_CLR_S 11 +/* LEDC_DUTY_CHNG_END_LSCH6_INT_CLR : WO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH6_INT_CLR (BIT(10)) +#define LEDC_DUTY_CHNG_END_LSCH6_INT_CLR_M (BIT(10)) +#define LEDC_DUTY_CHNG_END_LSCH6_INT_CLR_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH6_INT_CLR_S 10 +/* LEDC_DUTY_CHNG_END_LSCH5_INT_CLR : WO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH5_INT_CLR (BIT(9)) +#define LEDC_DUTY_CHNG_END_LSCH5_INT_CLR_M (BIT(9)) +#define LEDC_DUTY_CHNG_END_LSCH5_INT_CLR_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH5_INT_CLR_S 9 +/* LEDC_DUTY_CHNG_END_LSCH4_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH4_INT_CLR (BIT(8)) +#define LEDC_DUTY_CHNG_END_LSCH4_INT_CLR_M (BIT(8)) +#define LEDC_DUTY_CHNG_END_LSCH4_INT_CLR_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH4_INT_CLR_S 8 +/* LEDC_DUTY_CHNG_END_LSCH3_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH3_INT_CLR (BIT(7)) +#define LEDC_DUTY_CHNG_END_LSCH3_INT_CLR_M (BIT(7)) +#define LEDC_DUTY_CHNG_END_LSCH3_INT_CLR_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH3_INT_CLR_S 7 +/* LEDC_DUTY_CHNG_END_LSCH2_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH2_INT_CLR (BIT(6)) +#define LEDC_DUTY_CHNG_END_LSCH2_INT_CLR_M (BIT(6)) +#define LEDC_DUTY_CHNG_END_LSCH2_INT_CLR_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH2_INT_CLR_S 6 +/* LEDC_DUTY_CHNG_END_LSCH1_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH1_INT_CLR (BIT(5)) +#define LEDC_DUTY_CHNG_END_LSCH1_INT_CLR_M (BIT(5)) +#define LEDC_DUTY_CHNG_END_LSCH1_INT_CLR_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH1_INT_CLR_S 5 +/* LEDC_DUTY_CHNG_END_LSCH0_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_DUTY_CHNG_END_LSCH0_INT_CLR (BIT(4)) +#define LEDC_DUTY_CHNG_END_LSCH0_INT_CLR_M (BIT(4)) +#define LEDC_DUTY_CHNG_END_LSCH0_INT_CLR_V 0x1 +#define LEDC_DUTY_CHNG_END_LSCH0_INT_CLR_S 4 +/* LEDC_LSTIMER3_OVF_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER3_OVF_INT_CLR (BIT(3)) +#define LEDC_LSTIMER3_OVF_INT_CLR_M (BIT(3)) +#define LEDC_LSTIMER3_OVF_INT_CLR_V 0x1 +#define LEDC_LSTIMER3_OVF_INT_CLR_S 3 +/* LEDC_LSTIMER2_OVF_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER2_OVF_INT_CLR (BIT(2)) +#define LEDC_LSTIMER2_OVF_INT_CLR_M (BIT(2)) +#define LEDC_LSTIMER2_OVF_INT_CLR_V 0x1 +#define LEDC_LSTIMER2_OVF_INT_CLR_S 2 +/* LEDC_LSTIMER1_OVF_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER1_OVF_INT_CLR (BIT(1)) +#define LEDC_LSTIMER1_OVF_INT_CLR_M (BIT(1)) +#define LEDC_LSTIMER1_OVF_INT_CLR_V 0x1 +#define LEDC_LSTIMER1_OVF_INT_CLR_S 1 +/* LEDC_LSTIMER0_OVF_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define LEDC_LSTIMER0_OVF_INT_CLR (BIT(0)) +#define LEDC_LSTIMER0_OVF_INT_CLR_M (BIT(0)) +#define LEDC_LSTIMER0_OVF_INT_CLR_V 0x1 +#define LEDC_LSTIMER0_OVF_INT_CLR_S 0 + +#define LEDC_CONF_REG (DR_REG_LEDC_BASE + 0x00d0) +/* LEDC_APB_CLK_SEL : R/W ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: */ +#define LEDC_APB_CLK_SEL 0x00000003 +#define LEDC_APB_CLK_SEL_M ((LEDC_APB_CLK_SEL_V)<<(LEDC_APB_CLK_SEL_S)) +#define LEDC_APB_CLK_SEL_V 0x3 +#define LEDC_APB_CLK_SEL_S 0 + +#define LEDC_DATE_REG (DR_REG_LEDC_BASE + 0x00FC) +/* LEDC_DATE : R/W ;bitpos:[31:0] ;default: 32'h18072700 ; */ +/*description: */ +#define LEDC_DATE 0xFFFFFFFF +#define LEDC_DATE_M ((LEDC_DATE_V)<<(LEDC_DATE_S)) +#define LEDC_DATE_V 0xFFFFFFFF +#define LEDC_DATE_S 0 + +#ifdef __cplusplus +} +#endif + +#endif /*_SOC_LEDC_REG_H_ */ \ No newline at end of file diff --git a/components/soc/esp32s2beta/include/soc/ledc_struct.h b/components/soc/esp32s2beta/include/soc/ledc_struct.h new file mode 100644 index 0000000000..aedaeefaf0 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/ledc_struct.h @@ -0,0 +1,236 @@ +// 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. +#ifndef _SOC_LEDC_STRUCT_H_ +#define _SOC_LEDC_STRUCT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + struct { + struct { + union { + struct { + uint32_t timer_sel: 2; /*There are four high speed timers the two bits are used to select one of them for high speed channel. 2'b00: seletc hstimer0. 2'b01: select hstimer1. 2'b10: select hstimer2. 2'b11: select hstimer3.*/ + uint32_t sig_out_en: 1; /*This is the output enable control bit for high speed channel*/ + uint32_t idle_lv: 1; /*This bit is used to control the output value when high speed channel is off.*/ + uint32_t low_speed_update: 1; /*This bit is only useful for low speed timer channels, reserved for high speed timers*/ + uint32_t ovf_num: 10; + uint32_t ovf_cnt_en: 1; + uint32_t ovf_cnt_rst: 1; + uint32_t ovf_cnt_rst_st: 1; + uint32_t reserved18: 13; + uint32_t clk_en: 1; /*This bit is clock gating control signal. when software configure LED_PWM internal registers it controls the register clock.*/ + }; + uint32_t val; + } conf0; + union { + struct { + uint32_t hpoint: 14; /*The output value changes to high when htimerx(x=[0 3]) selected by high speed channel has reached reg_hpoint_hsch0[19:0]*/ + uint32_t reserved14: 16; + }; + uint32_t val; + } hpoint; + union { + struct { + uint32_t duty: 19; /*The register is used to control output duty. When hstimerx(x=[0 3]) chosen by high speed channel has reached reg_lpoint_hsch0 the output signal changes to low. reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4]) (1) reg_lpoint_hsch0=(reg_hpoint_hsch0[19:0]+reg_duty_hsch0[24:4] +1) (2) The least four bits in this register represent the decimal part and determines when to choose (1) or (2)*/ + uint32_t reserved19: 11; + }; + uint32_t val; + } duty; + union { + struct { + uint32_t duty_scale:10; /*This register controls the increase or decrease step scale for high speed channel.*/ + uint32_t duty_cycle:10; /*This register is used to increase or decrease the duty every reg_duty_cycle_hsch0 cycles for high speed channel.*/ + uint32_t duty_num: 10; /*This register is used to control the number of increased or decreased times for high speed channel.*/ + uint32_t duty_inc: 1; /*This register is used to increase the duty of output signal or decrease the duty of output signal for high speed channel.*/ + uint32_t duty_start: 1; /*When reg_duty_num_hsch0 reg_duty_cycle_hsch0 and reg_duty_scale_hsch0 has been configured. these register won't take effect until set reg_duty_start_hsch0. this bit is automatically cleared by hardware.*/ + }; + uint32_t val; + } conf1; + union { + struct { + uint32_t duty_read: 19; /*This register represents the current duty of the output signal for high speed channel.*/ + uint32_t reserved19: 11; + }; + uint32_t val; + } duty_rd; + } channel[8]; + } channel_group[1]; /*two channel groups : 0: high-speed channels; 1: low-speed channels*/ + struct { + struct { + union { + struct { + uint32_t duty_resolution: 4; + uint32_t clock_divider: 18; + uint32_t pause: 1; + uint32_t rst: 1; + uint32_t tick_sel: 1; + uint32_t low_speed_update: 1; + uint32_t reserved26: 6; + }; + uint32_t val; + } conf; + union { + struct { + uint32_t timer_cnt: 14; /*software can read this register to get the current counter value in high speed timer*/ + uint32_t reserved14: 16; + }; + uint32_t val; + } value; + } timer[4]; + } timer_group[1]; /*two channel groups : 0: high-speed channels; 1: low-speed channels*/ + union { + struct { + uint32_t lstimer0_ovf: 1; /*The interrupt raw bit for low speed channel0 counter overflow.*/ + uint32_t lstimer1_ovf: 1; /*The interrupt raw bit for low speed channel1 counter overflow.*/ + uint32_t lstimer2_ovf: 1; /*The interrupt raw bit for low speed channel2 counter overflow.*/ + uint32_t lstimer3_ovf: 1; /*The interrupt raw bit for low speed channel3 counter overflow.*/ + uint32_t duty_chng_end_lsch0: 1; /*The interrupt raw bit for low speed channel 0 duty change done.*/ + uint32_t duty_chng_end_lsch1: 1; /*The interrupt raw bit for low speed channel 1 duty change done.*/ + uint32_t duty_chng_end_lsch2: 1; /*The interrupt raw bit for low speed channel 2 duty change done.*/ + uint32_t duty_chng_end_lsch3: 1; /*The interrupt raw bit for low speed channel 3 duty change done.*/ + uint32_t duty_chng_end_lsch4: 1; /*The interrupt raw bit for low speed channel 4 duty change done.*/ + uint32_t duty_chng_end_lsch5: 1; /*The interrupt raw bit for low speed channel 5 duty change done.*/ + uint32_t duty_chng_end_lsch6: 1; /*The interrupt raw bit for low speed channel 6 duty change done.*/ + uint32_t duty_chng_end_lsch7: 1; /*The interrupt raw bit for low speed channel 7 duty change done.*/ + uint32_t ovf_cnt_lsch0: 1; + uint32_t ovf_cnt_lsch1: 1; + uint32_t ovf_cnt_lsch2: 1; + uint32_t ovf_cnt_lsch3: 1; + uint32_t ovf_cnt_lsch4: 1; + uint32_t ovf_cnt_lsch5: 1; + uint32_t ovf_cnt_lsch6: 1; + uint32_t ovf_cnt_lsch7: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t lstimer0_ovf: 1; + uint32_t lstimer1_ovf: 1; + uint32_t lstimer2_ovf: 1; + uint32_t lstimer3_ovf: 1; + uint32_t duty_chng_end_lsch0: 1; + uint32_t duty_chng_end_lsch1: 1; + uint32_t duty_chng_end_lsch2: 1; + uint32_t duty_chng_end_lsch3: 1; + uint32_t duty_chng_end_lsch4: 1; + uint32_t duty_chng_end_lsch5: 1; + uint32_t duty_chng_end_lsch6: 1; + uint32_t duty_chng_end_lsch7: 1; + uint32_t ovf_cnt_lsch0: 1; + uint32_t ovf_cnt_lsch1: 1; + uint32_t ovf_cnt_lsch2: 1; + uint32_t ovf_cnt_lsch3: 1; + uint32_t ovf_cnt_lsch4: 1; + uint32_t ovf_cnt_lsch5: 1; + uint32_t ovf_cnt_lsch6: 1; + uint32_t ovf_cnt_lsch7: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_st; + union { + struct { + uint32_t lstimer0_ovf: 1; + uint32_t lstimer1_ovf: 1; + uint32_t lstimer2_ovf: 1; + uint32_t lstimer3_ovf: 1; + uint32_t duty_chng_end_lsch0: 1; + uint32_t duty_chng_end_lsch1: 1; + uint32_t duty_chng_end_lsch2: 1; + uint32_t duty_chng_end_lsch3: 1; + uint32_t duty_chng_end_lsch4: 1; + uint32_t duty_chng_end_lsch5: 1; + uint32_t duty_chng_end_lsch6: 1; + uint32_t duty_chng_end_lsch7: 1; + uint32_t ovf_cnt_lsch0: 1; + uint32_t ovf_cnt_lsch1: 1; + uint32_t ovf_cnt_lsch2: 1; + uint32_t ovf_cnt_lsch3: 1; + uint32_t ovf_cnt_lsch4: 1; + uint32_t ovf_cnt_lsch5: 1; + uint32_t ovf_cnt_lsch6: 1; + uint32_t ovf_cnt_lsch7: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t lstimer0_ovf: 1; + uint32_t lstimer1_ovf: 1; + uint32_t lstimer2_ovf: 1; + uint32_t lstimer3_ovf: 1; + uint32_t duty_chng_end_lsch0: 1; + uint32_t duty_chng_end_lsch1: 1; + uint32_t duty_chng_end_lsch2: 1; + uint32_t duty_chng_end_lsch3: 1; + uint32_t duty_chng_end_lsch4: 1; + uint32_t duty_chng_end_lsch5: 1; + uint32_t duty_chng_end_lsch6: 1; + uint32_t duty_chng_end_lsch7: 1; + uint32_t ovf_cnt_lsch0: 1; + uint32_t ovf_cnt_lsch1: 1; + uint32_t ovf_cnt_lsch2: 1; + uint32_t ovf_cnt_lsch3: 1; + uint32_t ovf_cnt_lsch4: 1; + uint32_t ovf_cnt_lsch5: 1; + uint32_t ovf_cnt_lsch6: 1; + uint32_t ovf_cnt_lsch7: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_clr; + union { + struct { + uint32_t apb_clk_sel: 2; + uint32_t reserved2: 30; + }; + uint32_t val; + } conf; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + uint32_t reserved_1f0; + uint32_t reserved_1f4; + uint32_t reserved_1f8; + uint32_t date; /*This register represents the version .*/ +} ledc_dev_t; +extern ledc_dev_t LEDC; + +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_LEDC_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/nrx_reg.h b/components/soc/esp32s2beta/include/soc/nrx_reg.h new file mode 100644 index 0000000000..ca338b89ab --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/nrx_reg.h @@ -0,0 +1,55 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include "soc/soc.h" + +/* Some of the WiFi RX control registers. + * PU/PD fields defined here are used in sleep related functions. + */ + +#define NRXPD_CTRL (DR_REG_NRX_BASE + 0x00d4) +#define NRX_CHAN_EST_FORCE_PU (BIT(7)) +#define NRX_CHAN_EST_FORCE_PU_M (BIT(7)) +#define NRX_CHAN_EST_FORCE_PU_V 1 +#define NRX_CHAN_EST_FORCE_PU_S 7 +#define NRX_CHAN_EST_FORCE_PD (BIT(6)) +#define NRX_CHAN_EST_FORCE_PD_M (BIT(6)) +#define NRX_CHAN_EST_FORCE_PD_V 1 +#define NRX_CHAN_EST_FORCE_PD_S 6 +#define NRX_RX_ROT_FORCE_PU (BIT(5)) +#define NRX_RX_ROT_FORCE_PU_M (BIT(5)) +#define NRX_RX_ROT_FORCE_PU_V 1 +#define NRX_RX_ROT_FORCE_PU_S 5 +#define NRX_RX_ROT_FORCE_PD (BIT(4)) +#define NRX_RX_ROT_FORCE_PD_M (BIT(4)) +#define NRX_RX_ROT_FORCE_PD_V 1 +#define NRX_RX_ROT_FORCE_PD_S 4 +#define NRX_VIT_FORCE_PU (BIT(3)) +#define NRX_VIT_FORCE_PU_M (BIT(3)) +#define NRX_VIT_FORCE_PU_V 1 +#define NRX_VIT_FORCE_PU_S 3 +#define NRX_VIT_FORCE_PD (BIT(2)) +#define NRX_VIT_FORCE_PD_M (BIT(2)) +#define NRX_VIT_FORCE_PD_V 1 +#define NRX_VIT_FORCE_PD_S 2 +#define NRX_DEMAP_FORCE_PU (BIT(1)) +#define NRX_DEMAP_FORCE_PU_M (BIT(1)) +#define NRX_DEMAP_FORCE_PU_V 1 +#define NRX_DEMAP_FORCE_PU_S 1 +#define NRX_DEMAP_FORCE_PD (BIT(0)) +#define NRX_DEMAP_FORCE_PD_M (BIT(0)) +#define NRX_DEMAP_FORCE_PD_V 1 +#define NRX_DEMAP_FORCE_PD_S 0 diff --git a/components/soc/esp32s2beta/include/soc/pcnt_reg.h b/components/soc/esp32s2beta/include/soc/pcnt_reg.h new file mode 100644 index 0000000000..f28fc40eac --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/pcnt_reg.h @@ -0,0 +1,862 @@ +// Copyright 2017-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. +#ifndef _SOC_PCNT_REG_H_ +#define _SOC_PCNT_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define PCNT_U0_CONF0_REG (DR_REG_PCNT_BASE + 0x0000) +/* PCNT_CH1_LCTRL_MODE_U0 : R/W ;bitpos:[31:30] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_LCTRL_MODE_U0 0x00000003 +#define PCNT_CH1_LCTRL_MODE_U0_M ((PCNT_CH1_LCTRL_MODE_U0_V)<<(PCNT_CH1_LCTRL_MODE_U0_S)) +#define PCNT_CH1_LCTRL_MODE_U0_V 0x3 +#define PCNT_CH1_LCTRL_MODE_U0_S 30 +/* PCNT_CH1_HCTRL_MODE_U0 : R/W ;bitpos:[29:28] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_HCTRL_MODE_U0 0x00000003 +#define PCNT_CH1_HCTRL_MODE_U0_M ((PCNT_CH1_HCTRL_MODE_U0_V)<<(PCNT_CH1_HCTRL_MODE_U0_S)) +#define PCNT_CH1_HCTRL_MODE_U0_V 0x3 +#define PCNT_CH1_HCTRL_MODE_U0_S 28 +/* PCNT_CH1_POS_MODE_U0 : R/W ;bitpos:[27:26] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_POS_MODE_U0 0x00000003 +#define PCNT_CH1_POS_MODE_U0_M ((PCNT_CH1_POS_MODE_U0_V)<<(PCNT_CH1_POS_MODE_U0_S)) +#define PCNT_CH1_POS_MODE_U0_V 0x3 +#define PCNT_CH1_POS_MODE_U0_S 26 +/* PCNT_CH1_NEG_MODE_U0 : R/W ;bitpos:[25:24] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_NEG_MODE_U0 0x00000003 +#define PCNT_CH1_NEG_MODE_U0_M ((PCNT_CH1_NEG_MODE_U0_V)<<(PCNT_CH1_NEG_MODE_U0_S)) +#define PCNT_CH1_NEG_MODE_U0_V 0x3 +#define PCNT_CH1_NEG_MODE_U0_S 24 +/* PCNT_CH0_LCTRL_MODE_U0 : R/W ;bitpos:[23:22] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_LCTRL_MODE_U0 0x00000003 +#define PCNT_CH0_LCTRL_MODE_U0_M ((PCNT_CH0_LCTRL_MODE_U0_V)<<(PCNT_CH0_LCTRL_MODE_U0_S)) +#define PCNT_CH0_LCTRL_MODE_U0_V 0x3 +#define PCNT_CH0_LCTRL_MODE_U0_S 22 +/* PCNT_CH0_HCTRL_MODE_U0 : R/W ;bitpos:[21:20] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_HCTRL_MODE_U0 0x00000003 +#define PCNT_CH0_HCTRL_MODE_U0_M ((PCNT_CH0_HCTRL_MODE_U0_V)<<(PCNT_CH0_HCTRL_MODE_U0_S)) +#define PCNT_CH0_HCTRL_MODE_U0_V 0x3 +#define PCNT_CH0_HCTRL_MODE_U0_S 20 +/* PCNT_CH0_POS_MODE_U0 : R/W ;bitpos:[19:18] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_POS_MODE_U0 0x00000003 +#define PCNT_CH0_POS_MODE_U0_M ((PCNT_CH0_POS_MODE_U0_V)<<(PCNT_CH0_POS_MODE_U0_S)) +#define PCNT_CH0_POS_MODE_U0_V 0x3 +#define PCNT_CH0_POS_MODE_U0_S 18 +/* PCNT_CH0_NEG_MODE_U0 : R/W ;bitpos:[17:16] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_NEG_MODE_U0 0x00000003 +#define PCNT_CH0_NEG_MODE_U0_M ((PCNT_CH0_NEG_MODE_U0_V)<<(PCNT_CH0_NEG_MODE_U0_S)) +#define PCNT_CH0_NEG_MODE_U0_V 0x3 +#define PCNT_CH0_NEG_MODE_U0_S 16 +/* PCNT_THR_THRES1_EN_U0 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_THR_THRES1_EN_U0 (BIT(15)) +#define PCNT_THR_THRES1_EN_U0_M (BIT(15)) +#define PCNT_THR_THRES1_EN_U0_V 0x1 +#define PCNT_THR_THRES1_EN_U0_S 15 +/* PCNT_THR_THRES0_EN_U0 : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_THR_THRES0_EN_U0 (BIT(14)) +#define PCNT_THR_THRES0_EN_U0_M (BIT(14)) +#define PCNT_THR_THRES0_EN_U0_V 0x1 +#define PCNT_THR_THRES0_EN_U0_S 14 +/* PCNT_THR_L_LIM_EN_U0 : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_L_LIM_EN_U0 (BIT(13)) +#define PCNT_THR_L_LIM_EN_U0_M (BIT(13)) +#define PCNT_THR_L_LIM_EN_U0_V 0x1 +#define PCNT_THR_L_LIM_EN_U0_S 13 +/* PCNT_THR_H_LIM_EN_U0 : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_H_LIM_EN_U0 (BIT(12)) +#define PCNT_THR_H_LIM_EN_U0_M (BIT(12)) +#define PCNT_THR_H_LIM_EN_U0_V 0x1 +#define PCNT_THR_H_LIM_EN_U0_S 12 +/* PCNT_THR_ZERO_EN_U0 : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_ZERO_EN_U0 (BIT(11)) +#define PCNT_THR_ZERO_EN_U0_M (BIT(11)) +#define PCNT_THR_ZERO_EN_U0_V 0x1 +#define PCNT_THR_ZERO_EN_U0_S 11 +/* PCNT_FILTER_EN_U0 : R/W ;bitpos:[10] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_FILTER_EN_U0 (BIT(10)) +#define PCNT_FILTER_EN_U0_M (BIT(10)) +#define PCNT_FILTER_EN_U0_V 0x1 +#define PCNT_FILTER_EN_U0_S 10 +/* PCNT_FILTER_THRES_U0 : R/W ;bitpos:[9:0] ;default: 10'h10 ; */ +/*description: */ +#define PCNT_FILTER_THRES_U0 0x000003FF +#define PCNT_FILTER_THRES_U0_M ((PCNT_FILTER_THRES_U0_V)<<(PCNT_FILTER_THRES_U0_S)) +#define PCNT_FILTER_THRES_U0_V 0x3FF +#define PCNT_FILTER_THRES_U0_S 0 + +#define PCNT_U0_CONF1_REG (DR_REG_PCNT_BASE + 0x0004) +/* PCNT_CNT_THRES1_U0 : R/W ;bitpos:[31:16] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_THRES1_U0 0x0000FFFF +#define PCNT_CNT_THRES1_U0_M ((PCNT_CNT_THRES1_U0_V)<<(PCNT_CNT_THRES1_U0_S)) +#define PCNT_CNT_THRES1_U0_V 0xFFFF +#define PCNT_CNT_THRES1_U0_S 16 +/* PCNT_CNT_THRES0_U0 : R/W ;bitpos:[15:0] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_THRES0_U0 0x0000FFFF +#define PCNT_CNT_THRES0_U0_M ((PCNT_CNT_THRES0_U0_V)<<(PCNT_CNT_THRES0_U0_S)) +#define PCNT_CNT_THRES0_U0_V 0xFFFF +#define PCNT_CNT_THRES0_U0_S 0 + +#define PCNT_U0_CONF2_REG (DR_REG_PCNT_BASE + 0x0008) +/* PCNT_CNT_L_LIM_U0 : R/W ;bitpos:[31:16] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_L_LIM_U0 0x0000FFFF +#define PCNT_CNT_L_LIM_U0_M ((PCNT_CNT_L_LIM_U0_V)<<(PCNT_CNT_L_LIM_U0_S)) +#define PCNT_CNT_L_LIM_U0_V 0xFFFF +#define PCNT_CNT_L_LIM_U0_S 16 +/* PCNT_CNT_H_LIM_U0 : R/W ;bitpos:[15:0] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_H_LIM_U0 0x0000FFFF +#define PCNT_CNT_H_LIM_U0_M ((PCNT_CNT_H_LIM_U0_V)<<(PCNT_CNT_H_LIM_U0_S)) +#define PCNT_CNT_H_LIM_U0_V 0xFFFF +#define PCNT_CNT_H_LIM_U0_S 0 + +#define PCNT_U1_CONF0_REG (DR_REG_PCNT_BASE + 0x000c) +/* PCNT_CH1_LCTRL_MODE_U1 : R/W ;bitpos:[31:30] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_LCTRL_MODE_U1 0x00000003 +#define PCNT_CH1_LCTRL_MODE_U1_M ((PCNT_CH1_LCTRL_MODE_U1_V)<<(PCNT_CH1_LCTRL_MODE_U1_S)) +#define PCNT_CH1_LCTRL_MODE_U1_V 0x3 +#define PCNT_CH1_LCTRL_MODE_U1_S 30 +/* PCNT_CH1_HCTRL_MODE_U1 : R/W ;bitpos:[29:28] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_HCTRL_MODE_U1 0x00000003 +#define PCNT_CH1_HCTRL_MODE_U1_M ((PCNT_CH1_HCTRL_MODE_U1_V)<<(PCNT_CH1_HCTRL_MODE_U1_S)) +#define PCNT_CH1_HCTRL_MODE_U1_V 0x3 +#define PCNT_CH1_HCTRL_MODE_U1_S 28 +/* PCNT_CH1_POS_MODE_U1 : R/W ;bitpos:[27:26] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_POS_MODE_U1 0x00000003 +#define PCNT_CH1_POS_MODE_U1_M ((PCNT_CH1_POS_MODE_U1_V)<<(PCNT_CH1_POS_MODE_U1_S)) +#define PCNT_CH1_POS_MODE_U1_V 0x3 +#define PCNT_CH1_POS_MODE_U1_S 26 +/* PCNT_CH1_NEG_MODE_U1 : R/W ;bitpos:[25:24] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_NEG_MODE_U1 0x00000003 +#define PCNT_CH1_NEG_MODE_U1_M ((PCNT_CH1_NEG_MODE_U1_V)<<(PCNT_CH1_NEG_MODE_U1_S)) +#define PCNT_CH1_NEG_MODE_U1_V 0x3 +#define PCNT_CH1_NEG_MODE_U1_S 24 +/* PCNT_CH0_LCTRL_MODE_U1 : R/W ;bitpos:[23:22] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_LCTRL_MODE_U1 0x00000003 +#define PCNT_CH0_LCTRL_MODE_U1_M ((PCNT_CH0_LCTRL_MODE_U1_V)<<(PCNT_CH0_LCTRL_MODE_U1_S)) +#define PCNT_CH0_LCTRL_MODE_U1_V 0x3 +#define PCNT_CH0_LCTRL_MODE_U1_S 22 +/* PCNT_CH0_HCTRL_MODE_U1 : R/W ;bitpos:[21:20] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_HCTRL_MODE_U1 0x00000003 +#define PCNT_CH0_HCTRL_MODE_U1_M ((PCNT_CH0_HCTRL_MODE_U1_V)<<(PCNT_CH0_HCTRL_MODE_U1_S)) +#define PCNT_CH0_HCTRL_MODE_U1_V 0x3 +#define PCNT_CH0_HCTRL_MODE_U1_S 20 +/* PCNT_CH0_POS_MODE_U1 : R/W ;bitpos:[19:18] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_POS_MODE_U1 0x00000003 +#define PCNT_CH0_POS_MODE_U1_M ((PCNT_CH0_POS_MODE_U1_V)<<(PCNT_CH0_POS_MODE_U1_S)) +#define PCNT_CH0_POS_MODE_U1_V 0x3 +#define PCNT_CH0_POS_MODE_U1_S 18 +/* PCNT_CH0_NEG_MODE_U1 : R/W ;bitpos:[17:16] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_NEG_MODE_U1 0x00000003 +#define PCNT_CH0_NEG_MODE_U1_M ((PCNT_CH0_NEG_MODE_U1_V)<<(PCNT_CH0_NEG_MODE_U1_S)) +#define PCNT_CH0_NEG_MODE_U1_V 0x3 +#define PCNT_CH0_NEG_MODE_U1_S 16 +/* PCNT_THR_THRES1_EN_U1 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_THR_THRES1_EN_U1 (BIT(15)) +#define PCNT_THR_THRES1_EN_U1_M (BIT(15)) +#define PCNT_THR_THRES1_EN_U1_V 0x1 +#define PCNT_THR_THRES1_EN_U1_S 15 +/* PCNT_THR_THRES0_EN_U1 : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_THR_THRES0_EN_U1 (BIT(14)) +#define PCNT_THR_THRES0_EN_U1_M (BIT(14)) +#define PCNT_THR_THRES0_EN_U1_V 0x1 +#define PCNT_THR_THRES0_EN_U1_S 14 +/* PCNT_THR_L_LIM_EN_U1 : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_L_LIM_EN_U1 (BIT(13)) +#define PCNT_THR_L_LIM_EN_U1_M (BIT(13)) +#define PCNT_THR_L_LIM_EN_U1_V 0x1 +#define PCNT_THR_L_LIM_EN_U1_S 13 +/* PCNT_THR_H_LIM_EN_U1 : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_H_LIM_EN_U1 (BIT(12)) +#define PCNT_THR_H_LIM_EN_U1_M (BIT(12)) +#define PCNT_THR_H_LIM_EN_U1_V 0x1 +#define PCNT_THR_H_LIM_EN_U1_S 12 +/* PCNT_THR_ZERO_EN_U1 : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_ZERO_EN_U1 (BIT(11)) +#define PCNT_THR_ZERO_EN_U1_M (BIT(11)) +#define PCNT_THR_ZERO_EN_U1_V 0x1 +#define PCNT_THR_ZERO_EN_U1_S 11 +/* PCNT_FILTER_EN_U1 : R/W ;bitpos:[10] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_FILTER_EN_U1 (BIT(10)) +#define PCNT_FILTER_EN_U1_M (BIT(10)) +#define PCNT_FILTER_EN_U1_V 0x1 +#define PCNT_FILTER_EN_U1_S 10 +/* PCNT_FILTER_THRES_U1 : R/W ;bitpos:[9:0] ;default: 10'h10 ; */ +/*description: */ +#define PCNT_FILTER_THRES_U1 0x000003FF +#define PCNT_FILTER_THRES_U1_M ((PCNT_FILTER_THRES_U1_V)<<(PCNT_FILTER_THRES_U1_S)) +#define PCNT_FILTER_THRES_U1_V 0x3FF +#define PCNT_FILTER_THRES_U1_S 0 + +#define PCNT_U1_CONF1_REG (DR_REG_PCNT_BASE + 0x0010) +/* PCNT_CNT_THRES1_U1 : R/W ;bitpos:[31:16] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_THRES1_U1 0x0000FFFF +#define PCNT_CNT_THRES1_U1_M ((PCNT_CNT_THRES1_U1_V)<<(PCNT_CNT_THRES1_U1_S)) +#define PCNT_CNT_THRES1_U1_V 0xFFFF +#define PCNT_CNT_THRES1_U1_S 16 +/* PCNT_CNT_THRES0_U1 : R/W ;bitpos:[15:0] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_THRES0_U1 0x0000FFFF +#define PCNT_CNT_THRES0_U1_M ((PCNT_CNT_THRES0_U1_V)<<(PCNT_CNT_THRES0_U1_S)) +#define PCNT_CNT_THRES0_U1_V 0xFFFF +#define PCNT_CNT_THRES0_U1_S 0 + +#define PCNT_U1_CONF2_REG (DR_REG_PCNT_BASE + 0x0014) +/* PCNT_CNT_L_LIM_U1 : R/W ;bitpos:[31:16] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_L_LIM_U1 0x0000FFFF +#define PCNT_CNT_L_LIM_U1_M ((PCNT_CNT_L_LIM_U1_V)<<(PCNT_CNT_L_LIM_U1_S)) +#define PCNT_CNT_L_LIM_U1_V 0xFFFF +#define PCNT_CNT_L_LIM_U1_S 16 +/* PCNT_CNT_H_LIM_U1 : R/W ;bitpos:[15:0] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_H_LIM_U1 0x0000FFFF +#define PCNT_CNT_H_LIM_U1_M ((PCNT_CNT_H_LIM_U1_V)<<(PCNT_CNT_H_LIM_U1_S)) +#define PCNT_CNT_H_LIM_U1_V 0xFFFF +#define PCNT_CNT_H_LIM_U1_S 0 + +#define PCNT_U2_CONF0_REG (DR_REG_PCNT_BASE + 0x0018) +/* PCNT_CH1_LCTRL_MODE_U2 : R/W ;bitpos:[31:30] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_LCTRL_MODE_U2 0x00000003 +#define PCNT_CH1_LCTRL_MODE_U2_M ((PCNT_CH1_LCTRL_MODE_U2_V)<<(PCNT_CH1_LCTRL_MODE_U2_S)) +#define PCNT_CH1_LCTRL_MODE_U2_V 0x3 +#define PCNT_CH1_LCTRL_MODE_U2_S 30 +/* PCNT_CH1_HCTRL_MODE_U2 : R/W ;bitpos:[29:28] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_HCTRL_MODE_U2 0x00000003 +#define PCNT_CH1_HCTRL_MODE_U2_M ((PCNT_CH1_HCTRL_MODE_U2_V)<<(PCNT_CH1_HCTRL_MODE_U2_S)) +#define PCNT_CH1_HCTRL_MODE_U2_V 0x3 +#define PCNT_CH1_HCTRL_MODE_U2_S 28 +/* PCNT_CH1_POS_MODE_U2 : R/W ;bitpos:[27:26] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_POS_MODE_U2 0x00000003 +#define PCNT_CH1_POS_MODE_U2_M ((PCNT_CH1_POS_MODE_U2_V)<<(PCNT_CH1_POS_MODE_U2_S)) +#define PCNT_CH1_POS_MODE_U2_V 0x3 +#define PCNT_CH1_POS_MODE_U2_S 26 +/* PCNT_CH1_NEG_MODE_U2 : R/W ;bitpos:[25:24] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_NEG_MODE_U2 0x00000003 +#define PCNT_CH1_NEG_MODE_U2_M ((PCNT_CH1_NEG_MODE_U2_V)<<(PCNT_CH1_NEG_MODE_U2_S)) +#define PCNT_CH1_NEG_MODE_U2_V 0x3 +#define PCNT_CH1_NEG_MODE_U2_S 24 +/* PCNT_CH0_LCTRL_MODE_U2 : R/W ;bitpos:[23:22] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_LCTRL_MODE_U2 0x00000003 +#define PCNT_CH0_LCTRL_MODE_U2_M ((PCNT_CH0_LCTRL_MODE_U2_V)<<(PCNT_CH0_LCTRL_MODE_U2_S)) +#define PCNT_CH0_LCTRL_MODE_U2_V 0x3 +#define PCNT_CH0_LCTRL_MODE_U2_S 22 +/* PCNT_CH0_HCTRL_MODE_U2 : R/W ;bitpos:[21:20] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_HCTRL_MODE_U2 0x00000003 +#define PCNT_CH0_HCTRL_MODE_U2_M ((PCNT_CH0_HCTRL_MODE_U2_V)<<(PCNT_CH0_HCTRL_MODE_U2_S)) +#define PCNT_CH0_HCTRL_MODE_U2_V 0x3 +#define PCNT_CH0_HCTRL_MODE_U2_S 20 +/* PCNT_CH0_POS_MODE_U2 : R/W ;bitpos:[19:18] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_POS_MODE_U2 0x00000003 +#define PCNT_CH0_POS_MODE_U2_M ((PCNT_CH0_POS_MODE_U2_V)<<(PCNT_CH0_POS_MODE_U2_S)) +#define PCNT_CH0_POS_MODE_U2_V 0x3 +#define PCNT_CH0_POS_MODE_U2_S 18 +/* PCNT_CH0_NEG_MODE_U2 : R/W ;bitpos:[17:16] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_NEG_MODE_U2 0x00000003 +#define PCNT_CH0_NEG_MODE_U2_M ((PCNT_CH0_NEG_MODE_U2_V)<<(PCNT_CH0_NEG_MODE_U2_S)) +#define PCNT_CH0_NEG_MODE_U2_V 0x3 +#define PCNT_CH0_NEG_MODE_U2_S 16 +/* PCNT_THR_THRES1_EN_U2 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_THR_THRES1_EN_U2 (BIT(15)) +#define PCNT_THR_THRES1_EN_U2_M (BIT(15)) +#define PCNT_THR_THRES1_EN_U2_V 0x1 +#define PCNT_THR_THRES1_EN_U2_S 15 +/* PCNT_THR_THRES0_EN_U2 : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_THR_THRES0_EN_U2 (BIT(14)) +#define PCNT_THR_THRES0_EN_U2_M (BIT(14)) +#define PCNT_THR_THRES0_EN_U2_V 0x1 +#define PCNT_THR_THRES0_EN_U2_S 14 +/* PCNT_THR_L_LIM_EN_U2 : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_L_LIM_EN_U2 (BIT(13)) +#define PCNT_THR_L_LIM_EN_U2_M (BIT(13)) +#define PCNT_THR_L_LIM_EN_U2_V 0x1 +#define PCNT_THR_L_LIM_EN_U2_S 13 +/* PCNT_THR_H_LIM_EN_U2 : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_H_LIM_EN_U2 (BIT(12)) +#define PCNT_THR_H_LIM_EN_U2_M (BIT(12)) +#define PCNT_THR_H_LIM_EN_U2_V 0x1 +#define PCNT_THR_H_LIM_EN_U2_S 12 +/* PCNT_THR_ZERO_EN_U2 : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_ZERO_EN_U2 (BIT(11)) +#define PCNT_THR_ZERO_EN_U2_M (BIT(11)) +#define PCNT_THR_ZERO_EN_U2_V 0x1 +#define PCNT_THR_ZERO_EN_U2_S 11 +/* PCNT_FILTER_EN_U2 : R/W ;bitpos:[10] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_FILTER_EN_U2 (BIT(10)) +#define PCNT_FILTER_EN_U2_M (BIT(10)) +#define PCNT_FILTER_EN_U2_V 0x1 +#define PCNT_FILTER_EN_U2_S 10 +/* PCNT_FILTER_THRES_U2 : R/W ;bitpos:[9:0] ;default: 10'h10 ; */ +/*description: */ +#define PCNT_FILTER_THRES_U2 0x000003FF +#define PCNT_FILTER_THRES_U2_M ((PCNT_FILTER_THRES_U2_V)<<(PCNT_FILTER_THRES_U2_S)) +#define PCNT_FILTER_THRES_U2_V 0x3FF +#define PCNT_FILTER_THRES_U2_S 0 + +#define PCNT_U2_CONF1_REG (DR_REG_PCNT_BASE + 0x001c) +/* PCNT_CNT_THRES1_U2 : R/W ;bitpos:[31:16] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_THRES1_U2 0x0000FFFF +#define PCNT_CNT_THRES1_U2_M ((PCNT_CNT_THRES1_U2_V)<<(PCNT_CNT_THRES1_U2_S)) +#define PCNT_CNT_THRES1_U2_V 0xFFFF +#define PCNT_CNT_THRES1_U2_S 16 +/* PCNT_CNT_THRES0_U2 : R/W ;bitpos:[15:0] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_THRES0_U2 0x0000FFFF +#define PCNT_CNT_THRES0_U2_M ((PCNT_CNT_THRES0_U2_V)<<(PCNT_CNT_THRES0_U2_S)) +#define PCNT_CNT_THRES0_U2_V 0xFFFF +#define PCNT_CNT_THRES0_U2_S 0 + +#define PCNT_U2_CONF2_REG (DR_REG_PCNT_BASE + 0x0020) +/* PCNT_CNT_L_LIM_U2 : R/W ;bitpos:[31:16] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_L_LIM_U2 0x0000FFFF +#define PCNT_CNT_L_LIM_U2_M ((PCNT_CNT_L_LIM_U2_V)<<(PCNT_CNT_L_LIM_U2_S)) +#define PCNT_CNT_L_LIM_U2_V 0xFFFF +#define PCNT_CNT_L_LIM_U2_S 16 +/* PCNT_CNT_H_LIM_U2 : R/W ;bitpos:[15:0] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_H_LIM_U2 0x0000FFFF +#define PCNT_CNT_H_LIM_U2_M ((PCNT_CNT_H_LIM_U2_V)<<(PCNT_CNT_H_LIM_U2_S)) +#define PCNT_CNT_H_LIM_U2_V 0xFFFF +#define PCNT_CNT_H_LIM_U2_S 0 + +#define PCNT_U3_CONF0_REG (DR_REG_PCNT_BASE + 0x0024) +/* PCNT_CH1_LCTRL_MODE_U3 : R/W ;bitpos:[31:30] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_LCTRL_MODE_U3 0x00000003 +#define PCNT_CH1_LCTRL_MODE_U3_M ((PCNT_CH1_LCTRL_MODE_U3_V)<<(PCNT_CH1_LCTRL_MODE_U3_S)) +#define PCNT_CH1_LCTRL_MODE_U3_V 0x3 +#define PCNT_CH1_LCTRL_MODE_U3_S 30 +/* PCNT_CH1_HCTRL_MODE_U3 : R/W ;bitpos:[29:28] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_HCTRL_MODE_U3 0x00000003 +#define PCNT_CH1_HCTRL_MODE_U3_M ((PCNT_CH1_HCTRL_MODE_U3_V)<<(PCNT_CH1_HCTRL_MODE_U3_S)) +#define PCNT_CH1_HCTRL_MODE_U3_V 0x3 +#define PCNT_CH1_HCTRL_MODE_U3_S 28 +/* PCNT_CH1_POS_MODE_U3 : R/W ;bitpos:[27:26] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_POS_MODE_U3 0x00000003 +#define PCNT_CH1_POS_MODE_U3_M ((PCNT_CH1_POS_MODE_U3_V)<<(PCNT_CH1_POS_MODE_U3_S)) +#define PCNT_CH1_POS_MODE_U3_V 0x3 +#define PCNT_CH1_POS_MODE_U3_S 26 +/* PCNT_CH1_NEG_MODE_U3 : R/W ;bitpos:[25:24] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH1_NEG_MODE_U3 0x00000003 +#define PCNT_CH1_NEG_MODE_U3_M ((PCNT_CH1_NEG_MODE_U3_V)<<(PCNT_CH1_NEG_MODE_U3_S)) +#define PCNT_CH1_NEG_MODE_U3_V 0x3 +#define PCNT_CH1_NEG_MODE_U3_S 24 +/* PCNT_CH0_LCTRL_MODE_U3 : R/W ;bitpos:[23:22] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_LCTRL_MODE_U3 0x00000003 +#define PCNT_CH0_LCTRL_MODE_U3_M ((PCNT_CH0_LCTRL_MODE_U3_V)<<(PCNT_CH0_LCTRL_MODE_U3_S)) +#define PCNT_CH0_LCTRL_MODE_U3_V 0x3 +#define PCNT_CH0_LCTRL_MODE_U3_S 22 +/* PCNT_CH0_HCTRL_MODE_U3 : R/W ;bitpos:[21:20] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_HCTRL_MODE_U3 0x00000003 +#define PCNT_CH0_HCTRL_MODE_U3_M ((PCNT_CH0_HCTRL_MODE_U3_V)<<(PCNT_CH0_HCTRL_MODE_U3_S)) +#define PCNT_CH0_HCTRL_MODE_U3_V 0x3 +#define PCNT_CH0_HCTRL_MODE_U3_S 20 +/* PCNT_CH0_POS_MODE_U3 : R/W ;bitpos:[19:18] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_POS_MODE_U3 0x00000003 +#define PCNT_CH0_POS_MODE_U3_M ((PCNT_CH0_POS_MODE_U3_V)<<(PCNT_CH0_POS_MODE_U3_S)) +#define PCNT_CH0_POS_MODE_U3_V 0x3 +#define PCNT_CH0_POS_MODE_U3_S 18 +/* PCNT_CH0_NEG_MODE_U3 : R/W ;bitpos:[17:16] ;default: 2'd0 ; */ +/*description: */ +#define PCNT_CH0_NEG_MODE_U3 0x00000003 +#define PCNT_CH0_NEG_MODE_U3_M ((PCNT_CH0_NEG_MODE_U3_V)<<(PCNT_CH0_NEG_MODE_U3_S)) +#define PCNT_CH0_NEG_MODE_U3_V 0x3 +#define PCNT_CH0_NEG_MODE_U3_S 16 +/* PCNT_THR_THRES1_EN_U3 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_THR_THRES1_EN_U3 (BIT(15)) +#define PCNT_THR_THRES1_EN_U3_M (BIT(15)) +#define PCNT_THR_THRES1_EN_U3_V 0x1 +#define PCNT_THR_THRES1_EN_U3_S 15 +/* PCNT_THR_THRES0_EN_U3 : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_THR_THRES0_EN_U3 (BIT(14)) +#define PCNT_THR_THRES0_EN_U3_M (BIT(14)) +#define PCNT_THR_THRES0_EN_U3_V 0x1 +#define PCNT_THR_THRES0_EN_U3_S 14 +/* PCNT_THR_L_LIM_EN_U3 : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_L_LIM_EN_U3 (BIT(13)) +#define PCNT_THR_L_LIM_EN_U3_M (BIT(13)) +#define PCNT_THR_L_LIM_EN_U3_V 0x1 +#define PCNT_THR_L_LIM_EN_U3_S 13 +/* PCNT_THR_H_LIM_EN_U3 : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_H_LIM_EN_U3 (BIT(12)) +#define PCNT_THR_H_LIM_EN_U3_M (BIT(12)) +#define PCNT_THR_H_LIM_EN_U3_V 0x1 +#define PCNT_THR_H_LIM_EN_U3_S 12 +/* PCNT_THR_ZERO_EN_U3 : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_THR_ZERO_EN_U3 (BIT(11)) +#define PCNT_THR_ZERO_EN_U3_M (BIT(11)) +#define PCNT_THR_ZERO_EN_U3_V 0x1 +#define PCNT_THR_ZERO_EN_U3_S 11 +/* PCNT_FILTER_EN_U3 : R/W ;bitpos:[10] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_FILTER_EN_U3 (BIT(10)) +#define PCNT_FILTER_EN_U3_M (BIT(10)) +#define PCNT_FILTER_EN_U3_V 0x1 +#define PCNT_FILTER_EN_U3_S 10 +/* PCNT_FILTER_THRES_U3 : R/W ;bitpos:[9:0] ;default: 10'h10 ; */ +/*description: */ +#define PCNT_FILTER_THRES_U3 0x000003FF +#define PCNT_FILTER_THRES_U3_M ((PCNT_FILTER_THRES_U3_V)<<(PCNT_FILTER_THRES_U3_S)) +#define PCNT_FILTER_THRES_U3_V 0x3FF +#define PCNT_FILTER_THRES_U3_S 0 + +#define PCNT_U3_CONF1_REG (DR_REG_PCNT_BASE + 0x0028) +/* PCNT_CNT_THRES1_U3 : R/W ;bitpos:[31:16] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_THRES1_U3 0x0000FFFF +#define PCNT_CNT_THRES1_U3_M ((PCNT_CNT_THRES1_U3_V)<<(PCNT_CNT_THRES1_U3_S)) +#define PCNT_CNT_THRES1_U3_V 0xFFFF +#define PCNT_CNT_THRES1_U3_S 16 +/* PCNT_CNT_THRES0_U3 : R/W ;bitpos:[15:0] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_THRES0_U3 0x0000FFFF +#define PCNT_CNT_THRES0_U3_M ((PCNT_CNT_THRES0_U3_V)<<(PCNT_CNT_THRES0_U3_S)) +#define PCNT_CNT_THRES0_U3_V 0xFFFF +#define PCNT_CNT_THRES0_U3_S 0 + +#define PCNT_U3_CONF2_REG (DR_REG_PCNT_BASE + 0x002c) +/* PCNT_CNT_L_LIM_U3 : R/W ;bitpos:[31:16] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_L_LIM_U3 0x0000FFFF +#define PCNT_CNT_L_LIM_U3_M ((PCNT_CNT_L_LIM_U3_V)<<(PCNT_CNT_L_LIM_U3_S)) +#define PCNT_CNT_L_LIM_U3_V 0xFFFF +#define PCNT_CNT_L_LIM_U3_S 16 +/* PCNT_CNT_H_LIM_U3 : R/W ;bitpos:[15:0] ;default: 10'h0 ; */ +/*description: */ +#define PCNT_CNT_H_LIM_U3 0x0000FFFF +#define PCNT_CNT_H_LIM_U3_M ((PCNT_CNT_H_LIM_U3_V)<<(PCNT_CNT_H_LIM_U3_S)) +#define PCNT_CNT_H_LIM_U3_V 0xFFFF +#define PCNT_CNT_H_LIM_U3_S 0 + +#define PCNT_U0_CNT_REG (DR_REG_PCNT_BASE + 0x0030) +/* PCNT_PULSE_CNT_U0 : RO ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: */ +#define PCNT_PULSE_CNT_U0 0x0000FFFF +#define PCNT_PULSE_CNT_U0_M ((PCNT_PULSE_CNT_U0_V)<<(PCNT_PULSE_CNT_U0_S)) +#define PCNT_PULSE_CNT_U0_V 0xFFFF +#define PCNT_PULSE_CNT_U0_S 0 + +#define PCNT_U1_CNT_REG (DR_REG_PCNT_BASE + 0x0034) +/* PCNT_PULSE_CNT_U1 : RO ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: */ +#define PCNT_PULSE_CNT_U1 0x0000FFFF +#define PCNT_PULSE_CNT_U1_M ((PCNT_PULSE_CNT_U1_V)<<(PCNT_PULSE_CNT_U1_S)) +#define PCNT_PULSE_CNT_U1_V 0xFFFF +#define PCNT_PULSE_CNT_U1_S 0 + +#define PCNT_U2_CNT_REG (DR_REG_PCNT_BASE + 0x0038) +/* PCNT_PULSE_CNT_U2 : RO ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: */ +#define PCNT_PULSE_CNT_U2 0x0000FFFF +#define PCNT_PULSE_CNT_U2_M ((PCNT_PULSE_CNT_U2_V)<<(PCNT_PULSE_CNT_U2_S)) +#define PCNT_PULSE_CNT_U2_V 0xFFFF +#define PCNT_PULSE_CNT_U2_S 0 + +#define PCNT_U3_CNT_REG (DR_REG_PCNT_BASE + 0x003c) +/* PCNT_PULSE_CNT_U3 : RO ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: */ +#define PCNT_PULSE_CNT_U3 0x0000FFFF +#define PCNT_PULSE_CNT_U3_M ((PCNT_PULSE_CNT_U3_V)<<(PCNT_PULSE_CNT_U3_S)) +#define PCNT_PULSE_CNT_U3_V 0xFFFF +#define PCNT_PULSE_CNT_U3_S 0 + +#define PCNT_INT_RAW_REG (DR_REG_PCNT_BASE + 0x0040) +/* PCNT_CNT_THR_EVENT_U3_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U3_INT_RAW (BIT(3)) +#define PCNT_CNT_THR_EVENT_U3_INT_RAW_M (BIT(3)) +#define PCNT_CNT_THR_EVENT_U3_INT_RAW_V 0x1 +#define PCNT_CNT_THR_EVENT_U3_INT_RAW_S 3 +/* PCNT_CNT_THR_EVENT_U2_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U2_INT_RAW (BIT(2)) +#define PCNT_CNT_THR_EVENT_U2_INT_RAW_M (BIT(2)) +#define PCNT_CNT_THR_EVENT_U2_INT_RAW_V 0x1 +#define PCNT_CNT_THR_EVENT_U2_INT_RAW_S 2 +/* PCNT_CNT_THR_EVENT_U1_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U1_INT_RAW (BIT(1)) +#define PCNT_CNT_THR_EVENT_U1_INT_RAW_M (BIT(1)) +#define PCNT_CNT_THR_EVENT_U1_INT_RAW_V 0x1 +#define PCNT_CNT_THR_EVENT_U1_INT_RAW_S 1 +/* PCNT_CNT_THR_EVENT_U0_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U0_INT_RAW (BIT(0)) +#define PCNT_CNT_THR_EVENT_U0_INT_RAW_M (BIT(0)) +#define PCNT_CNT_THR_EVENT_U0_INT_RAW_V 0x1 +#define PCNT_CNT_THR_EVENT_U0_INT_RAW_S 0 + +#define PCNT_INT_ST_REG (DR_REG_PCNT_BASE + 0x0044) +/* PCNT_CNT_THR_EVENT_U3_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U3_INT_ST (BIT(3)) +#define PCNT_CNT_THR_EVENT_U3_INT_ST_M (BIT(3)) +#define PCNT_CNT_THR_EVENT_U3_INT_ST_V 0x1 +#define PCNT_CNT_THR_EVENT_U3_INT_ST_S 3 +/* PCNT_CNT_THR_EVENT_U2_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U2_INT_ST (BIT(2)) +#define PCNT_CNT_THR_EVENT_U2_INT_ST_M (BIT(2)) +#define PCNT_CNT_THR_EVENT_U2_INT_ST_V 0x1 +#define PCNT_CNT_THR_EVENT_U2_INT_ST_S 2 +/* PCNT_CNT_THR_EVENT_U1_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U1_INT_ST (BIT(1)) +#define PCNT_CNT_THR_EVENT_U1_INT_ST_M (BIT(1)) +#define PCNT_CNT_THR_EVENT_U1_INT_ST_V 0x1 +#define PCNT_CNT_THR_EVENT_U1_INT_ST_S 1 +/* PCNT_CNT_THR_EVENT_U0_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U0_INT_ST (BIT(0)) +#define PCNT_CNT_THR_EVENT_U0_INT_ST_M (BIT(0)) +#define PCNT_CNT_THR_EVENT_U0_INT_ST_V 0x1 +#define PCNT_CNT_THR_EVENT_U0_INT_ST_S 0 + +#define PCNT_INT_ENA_REG (DR_REG_PCNT_BASE + 0x0048) +/* PCNT_CNT_THR_EVENT_U3_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U3_INT_ENA (BIT(3)) +#define PCNT_CNT_THR_EVENT_U3_INT_ENA_M (BIT(3)) +#define PCNT_CNT_THR_EVENT_U3_INT_ENA_V 0x1 +#define PCNT_CNT_THR_EVENT_U3_INT_ENA_S 3 +/* PCNT_CNT_THR_EVENT_U2_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U2_INT_ENA (BIT(2)) +#define PCNT_CNT_THR_EVENT_U2_INT_ENA_M (BIT(2)) +#define PCNT_CNT_THR_EVENT_U2_INT_ENA_V 0x1 +#define PCNT_CNT_THR_EVENT_U2_INT_ENA_S 2 +/* PCNT_CNT_THR_EVENT_U1_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U1_INT_ENA (BIT(1)) +#define PCNT_CNT_THR_EVENT_U1_INT_ENA_M (BIT(1)) +#define PCNT_CNT_THR_EVENT_U1_INT_ENA_V 0x1 +#define PCNT_CNT_THR_EVENT_U1_INT_ENA_S 1 +/* PCNT_CNT_THR_EVENT_U0_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U0_INT_ENA (BIT(0)) +#define PCNT_CNT_THR_EVENT_U0_INT_ENA_M (BIT(0)) +#define PCNT_CNT_THR_EVENT_U0_INT_ENA_V 0x1 +#define PCNT_CNT_THR_EVENT_U0_INT_ENA_S 0 + +#define PCNT_INT_CLR_REG (DR_REG_PCNT_BASE + 0x004c) +/* PCNT_CNT_THR_EVENT_U3_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U3_INT_CLR (BIT(3)) +#define PCNT_CNT_THR_EVENT_U3_INT_CLR_M (BIT(3)) +#define PCNT_CNT_THR_EVENT_U3_INT_CLR_V 0x1 +#define PCNT_CNT_THR_EVENT_U3_INT_CLR_S 3 +/* PCNT_CNT_THR_EVENT_U2_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U2_INT_CLR (BIT(2)) +#define PCNT_CNT_THR_EVENT_U2_INT_CLR_M (BIT(2)) +#define PCNT_CNT_THR_EVENT_U2_INT_CLR_V 0x1 +#define PCNT_CNT_THR_EVENT_U2_INT_CLR_S 2 +/* PCNT_CNT_THR_EVENT_U1_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U1_INT_CLR (BIT(1)) +#define PCNT_CNT_THR_EVENT_U1_INT_CLR_M (BIT(1)) +#define PCNT_CNT_THR_EVENT_U1_INT_CLR_V 0x1 +#define PCNT_CNT_THR_EVENT_U1_INT_CLR_S 1 +/* PCNT_CNT_THR_EVENT_U0_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_EVENT_U0_INT_CLR (BIT(0)) +#define PCNT_CNT_THR_EVENT_U0_INT_CLR_M (BIT(0)) +#define PCNT_CNT_THR_EVENT_U0_INT_CLR_V 0x1 +#define PCNT_CNT_THR_EVENT_U0_INT_CLR_S 0 + +#define PCNT_U0_STATUS_REG (DR_REG_PCNT_BASE + 0x0050) +/* PCNT_CNT_THR_ZERO_LAT_U0 : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_ZERO_LAT_U0 (BIT(6)) +#define PCNT_CNT_THR_ZERO_LAT_U0_M (BIT(6)) +#define PCNT_CNT_THR_ZERO_LAT_U0_V 0x1 +#define PCNT_CNT_THR_ZERO_LAT_U0_S 6 +/* PCNT_CNT_THR_H_LIM_LAT_U0 : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_H_LIM_LAT_U0 (BIT(5)) +#define PCNT_CNT_THR_H_LIM_LAT_U0_M (BIT(5)) +#define PCNT_CNT_THR_H_LIM_LAT_U0_V 0x1 +#define PCNT_CNT_THR_H_LIM_LAT_U0_S 5 +/* PCNT_CNT_THR_L_LIM_LAT_U0 : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_L_LIM_LAT_U0 (BIT(4)) +#define PCNT_CNT_THR_L_LIM_LAT_U0_M (BIT(4)) +#define PCNT_CNT_THR_L_LIM_LAT_U0_V 0x1 +#define PCNT_CNT_THR_L_LIM_LAT_U0_S 4 +/* PCNT_CNT_THR_THRES0_LAT_U0 : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_THRES0_LAT_U0 (BIT(3)) +#define PCNT_CNT_THR_THRES0_LAT_U0_M (BIT(3)) +#define PCNT_CNT_THR_THRES0_LAT_U0_V 0x1 +#define PCNT_CNT_THR_THRES0_LAT_U0_S 3 +/* PCNT_CNT_THR_THRES1_LAT_U0 : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_THRES1_LAT_U0 (BIT(2)) +#define PCNT_CNT_THR_THRES1_LAT_U0_M (BIT(2)) +#define PCNT_CNT_THR_THRES1_LAT_U0_V 0x1 +#define PCNT_CNT_THR_THRES1_LAT_U0_S 2 +/* PCNT_CNT_THR_ZERO_MODE_U0 : RO ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_ZERO_MODE_U0 0x00000003 +#define PCNT_CNT_THR_ZERO_MODE_U0_M ((PCNT_CNT_THR_ZERO_MODE_U0_V)<<(PCNT_CNT_THR_ZERO_MODE_U0_S)) +#define PCNT_CNT_THR_ZERO_MODE_U0_V 0x3 +#define PCNT_CNT_THR_ZERO_MODE_U0_S 0 + +#define PCNT_U1_STATUS_REG (DR_REG_PCNT_BASE + 0x0054) +/* PCNT_CNT_THR_ZERO_LAT_U1 : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_ZERO_LAT_U1 (BIT(6)) +#define PCNT_CNT_THR_ZERO_LAT_U1_M (BIT(6)) +#define PCNT_CNT_THR_ZERO_LAT_U1_V 0x1 +#define PCNT_CNT_THR_ZERO_LAT_U1_S 6 +/* PCNT_CNT_THR_H_LIM_LAT_U1 : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_H_LIM_LAT_U1 (BIT(5)) +#define PCNT_CNT_THR_H_LIM_LAT_U1_M (BIT(5)) +#define PCNT_CNT_THR_H_LIM_LAT_U1_V 0x1 +#define PCNT_CNT_THR_H_LIM_LAT_U1_S 5 +/* PCNT_CNT_THR_L_LIM_LAT_U1 : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_L_LIM_LAT_U1 (BIT(4)) +#define PCNT_CNT_THR_L_LIM_LAT_U1_M (BIT(4)) +#define PCNT_CNT_THR_L_LIM_LAT_U1_V 0x1 +#define PCNT_CNT_THR_L_LIM_LAT_U1_S 4 +/* PCNT_CNT_THR_THRES0_LAT_U1 : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_THRES0_LAT_U1 (BIT(3)) +#define PCNT_CNT_THR_THRES0_LAT_U1_M (BIT(3)) +#define PCNT_CNT_THR_THRES0_LAT_U1_V 0x1 +#define PCNT_CNT_THR_THRES0_LAT_U1_S 3 +/* PCNT_CNT_THR_THRES1_LAT_U1 : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_THRES1_LAT_U1 (BIT(2)) +#define PCNT_CNT_THR_THRES1_LAT_U1_M (BIT(2)) +#define PCNT_CNT_THR_THRES1_LAT_U1_V 0x1 +#define PCNT_CNT_THR_THRES1_LAT_U1_S 2 +/* PCNT_CNT_THR_ZERO_MODE_U1 : RO ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_ZERO_MODE_U1 0x00000003 +#define PCNT_CNT_THR_ZERO_MODE_U1_M ((PCNT_CNT_THR_ZERO_MODE_U1_V)<<(PCNT_CNT_THR_ZERO_MODE_U1_S)) +#define PCNT_CNT_THR_ZERO_MODE_U1_V 0x3 +#define PCNT_CNT_THR_ZERO_MODE_U1_S 0 + +#define PCNT_U2_STATUS_REG (DR_REG_PCNT_BASE + 0x0058) +/* PCNT_CNT_THR_ZERO_LAT_U2 : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_ZERO_LAT_U2 (BIT(6)) +#define PCNT_CNT_THR_ZERO_LAT_U2_M (BIT(6)) +#define PCNT_CNT_THR_ZERO_LAT_U2_V 0x1 +#define PCNT_CNT_THR_ZERO_LAT_U2_S 6 +/* PCNT_CNT_THR_H_LIM_LAT_U2 : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_H_LIM_LAT_U2 (BIT(5)) +#define PCNT_CNT_THR_H_LIM_LAT_U2_M (BIT(5)) +#define PCNT_CNT_THR_H_LIM_LAT_U2_V 0x1 +#define PCNT_CNT_THR_H_LIM_LAT_U2_S 5 +/* PCNT_CNT_THR_L_LIM_LAT_U2 : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_L_LIM_LAT_U2 (BIT(4)) +#define PCNT_CNT_THR_L_LIM_LAT_U2_M (BIT(4)) +#define PCNT_CNT_THR_L_LIM_LAT_U2_V 0x1 +#define PCNT_CNT_THR_L_LIM_LAT_U2_S 4 +/* PCNT_CNT_THR_THRES0_LAT_U2 : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_THRES0_LAT_U2 (BIT(3)) +#define PCNT_CNT_THR_THRES0_LAT_U2_M (BIT(3)) +#define PCNT_CNT_THR_THRES0_LAT_U2_V 0x1 +#define PCNT_CNT_THR_THRES0_LAT_U2_S 3 +/* PCNT_CNT_THR_THRES1_LAT_U2 : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_THRES1_LAT_U2 (BIT(2)) +#define PCNT_CNT_THR_THRES1_LAT_U2_M (BIT(2)) +#define PCNT_CNT_THR_THRES1_LAT_U2_V 0x1 +#define PCNT_CNT_THR_THRES1_LAT_U2_S 2 +/* PCNT_CNT_THR_ZERO_MODE_U2 : RO ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_ZERO_MODE_U2 0x00000003 +#define PCNT_CNT_THR_ZERO_MODE_U2_M ((PCNT_CNT_THR_ZERO_MODE_U2_V)<<(PCNT_CNT_THR_ZERO_MODE_U2_S)) +#define PCNT_CNT_THR_ZERO_MODE_U2_V 0x3 +#define PCNT_CNT_THR_ZERO_MODE_U2_S 0 + +#define PCNT_U3_STATUS_REG (DR_REG_PCNT_BASE + 0x005c) +/* PCNT_CNT_THR_ZERO_LAT_U3 : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_ZERO_LAT_U3 (BIT(6)) +#define PCNT_CNT_THR_ZERO_LAT_U3_M (BIT(6)) +#define PCNT_CNT_THR_ZERO_LAT_U3_V 0x1 +#define PCNT_CNT_THR_ZERO_LAT_U3_S 6 +/* PCNT_CNT_THR_H_LIM_LAT_U3 : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_H_LIM_LAT_U3 (BIT(5)) +#define PCNT_CNT_THR_H_LIM_LAT_U3_M (BIT(5)) +#define PCNT_CNT_THR_H_LIM_LAT_U3_V 0x1 +#define PCNT_CNT_THR_H_LIM_LAT_U3_S 5 +/* PCNT_CNT_THR_L_LIM_LAT_U3 : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_L_LIM_LAT_U3 (BIT(4)) +#define PCNT_CNT_THR_L_LIM_LAT_U3_M (BIT(4)) +#define PCNT_CNT_THR_L_LIM_LAT_U3_V 0x1 +#define PCNT_CNT_THR_L_LIM_LAT_U3_S 4 +/* PCNT_CNT_THR_THRES0_LAT_U3 : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_THRES0_LAT_U3 (BIT(3)) +#define PCNT_CNT_THR_THRES0_LAT_U3_M (BIT(3)) +#define PCNT_CNT_THR_THRES0_LAT_U3_V 0x1 +#define PCNT_CNT_THR_THRES0_LAT_U3_S 3 +/* PCNT_CNT_THR_THRES1_LAT_U3 : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_THRES1_LAT_U3 (BIT(2)) +#define PCNT_CNT_THR_THRES1_LAT_U3_M (BIT(2)) +#define PCNT_CNT_THR_THRES1_LAT_U3_V 0x1 +#define PCNT_CNT_THR_THRES1_LAT_U3_S 2 +/* PCNT_CNT_THR_ZERO_MODE_U3 : RO ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: */ +#define PCNT_CNT_THR_ZERO_MODE_U3 0x00000003 +#define PCNT_CNT_THR_ZERO_MODE_U3_M ((PCNT_CNT_THR_ZERO_MODE_U3_V)<<(PCNT_CNT_THR_ZERO_MODE_U3_S)) +#define PCNT_CNT_THR_ZERO_MODE_U3_V 0x3 +#define PCNT_CNT_THR_ZERO_MODE_U3_S 0 + +#define PCNT_CTRL_REG (DR_REG_PCNT_BASE + 0x0060) +/* PCNT_CLK_EN : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CLK_EN (BIT(16)) +#define PCNT_CLK_EN_M (BIT(16)) +#define PCNT_CLK_EN_V 0x1 +#define PCNT_CLK_EN_S 16 +/* PCNT_CNT_PAUSE_U3 : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_PAUSE_U3 (BIT(7)) +#define PCNT_CNT_PAUSE_U3_M (BIT(7)) +#define PCNT_CNT_PAUSE_U3_V 0x1 +#define PCNT_CNT_PAUSE_U3_S 7 +/* PCNT_PULSE_CNT_RST_U3 : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_PULSE_CNT_RST_U3 (BIT(6)) +#define PCNT_PULSE_CNT_RST_U3_M (BIT(6)) +#define PCNT_PULSE_CNT_RST_U3_V 0x1 +#define PCNT_PULSE_CNT_RST_U3_S 6 +/* PCNT_CNT_PAUSE_U2 : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_PAUSE_U2 (BIT(5)) +#define PCNT_CNT_PAUSE_U2_M (BIT(5)) +#define PCNT_CNT_PAUSE_U2_V 0x1 +#define PCNT_CNT_PAUSE_U2_S 5 +/* PCNT_PULSE_CNT_RST_U2 : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_PULSE_CNT_RST_U2 (BIT(4)) +#define PCNT_PULSE_CNT_RST_U2_M (BIT(4)) +#define PCNT_PULSE_CNT_RST_U2_V 0x1 +#define PCNT_PULSE_CNT_RST_U2_S 4 +/* PCNT_CNT_PAUSE_U1 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_PAUSE_U1 (BIT(3)) +#define PCNT_CNT_PAUSE_U1_M (BIT(3)) +#define PCNT_CNT_PAUSE_U1_V 0x1 +#define PCNT_CNT_PAUSE_U1_S 3 +/* PCNT_PULSE_CNT_RST_U1 : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_PULSE_CNT_RST_U1 (BIT(2)) +#define PCNT_PULSE_CNT_RST_U1_M (BIT(2)) +#define PCNT_PULSE_CNT_RST_U1_V 0x1 +#define PCNT_PULSE_CNT_RST_U1_S 2 +/* PCNT_CNT_PAUSE_U0 : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define PCNT_CNT_PAUSE_U0 (BIT(1)) +#define PCNT_CNT_PAUSE_U0_M (BIT(1)) +#define PCNT_CNT_PAUSE_U0_V 0x1 +#define PCNT_CNT_PAUSE_U0_S 1 +/* PCNT_PULSE_CNT_RST_U0 : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define PCNT_PULSE_CNT_RST_U0 (BIT(0)) +#define PCNT_PULSE_CNT_RST_U0_M (BIT(0)) +#define PCNT_PULSE_CNT_RST_U0_V 0x1 +#define PCNT_PULSE_CNT_RST_U0_S 0 + +#define PCNT_DATE_REG (DR_REG_PCNT_BASE + 0x00fc) +/* PCNT_DATE : R/W ;bitpos:[31:0] ;default: 32'h18072600 ; */ +/*description: */ +#define PCNT_DATE 0xFFFFFFFF +#define PCNT_DATE_M ((PCNT_DATE_V)<<(PCNT_DATE_S)) +#define PCNT_DATE_V 0xFFFFFFFF +#define PCNT_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_PCNT_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/pcnt_struct.h b/components/soc/esp32s2beta/include/soc/pcnt_struct.h new file mode 100644 index 0000000000..3b986cb1bd --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/pcnt_struct.h @@ -0,0 +1,156 @@ +// Copyright 2017-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. +#ifndef _SOC_PCNT_STRUCT_H_ +#define _SOC_PCNT_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + struct{ + union { + struct { + uint32_t filter_thres: 10; /*This register is used to filter pulse whose width is smaller than this value for unit0.*/ + uint32_t filter_en: 1; /*This is the enable bit for filtering input signals for unit0.*/ + uint32_t thr_zero_en: 1; /*This is the enable bit for comparing unit0's count with 0 value.*/ + uint32_t thr_h_lim_en: 1; /*This is the enable bit for comparing unit0's count with thr_h_lim value.*/ + uint32_t thr_l_lim_en: 1; /*This is the enable bit for comparing unit0's count with thr_l_lim value.*/ + uint32_t thr_thres0_en: 1; /*This is the enable bit for comparing unit0's count with thres0 value.*/ + uint32_t thr_thres1_en: 1; /*This is the enable bit for comparing unit0's count with thres1 value .*/ + uint32_t ch0_neg_mode: 2; /*This register is used to control the mode of channel0's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/ + uint32_t ch0_pos_mode: 2; /*This register is used to control the mode of channel0's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/ + uint32_t ch0_hctrl_mode: 2; /*This register is used to control the mode of channel0's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + uint32_t ch0_lctrl_mode: 2; /*This register is used to control the mode of channel0's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + uint32_t ch1_neg_mode: 2; /*This register is used to control the mode of channel1's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/ + uint32_t ch1_pos_mode: 2; /*This register is used to control the mode of channel1's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/ + uint32_t ch1_hctrl_mode: 2; /*This register is used to control the mode of channel1's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + uint32_t ch1_lctrl_mode: 2; /*This register is used to control the mode of channel1's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/ + }; + uint32_t val; + } conf0; + union { + struct { + uint32_t cnt_thres0:16; /*This register is used to configure thres0 value for unit0.*/ + uint32_t cnt_thres1:16; /*This register is used to configure thres1 value for unit0.*/ + }; + uint32_t val; + } conf1; + union { + struct { + uint32_t cnt_h_lim:16; /*This register is used to configure thr_h_lim value for unit0.*/ + uint32_t cnt_l_lim:16; /*This register is used to configure thr_l_lim value for unit0.*/ + }; + uint32_t val; + } conf2; + } conf_unit[4]; + union { + struct { + uint32_t cnt_val : 16; /*This register stores the current pulse count value for unit0.*/ + uint32_t reserved16: 16; + }; + uint32_t val; + } cnt_unit[4]; + union { + struct { + uint32_t cnt_thr_event_u0: 1; /*This is the interrupt raw bit for channel0 event.*/ + uint32_t cnt_thr_event_u1: 1; /*This is the interrupt raw bit for channel1 event.*/ + uint32_t cnt_thr_event_u2: 1; /*This is the interrupt raw bit for channel2 event.*/ + uint32_t cnt_thr_event_u3: 1; /*This is the interrupt raw bit for channel3 event.*/ + uint32_t reserved4: 28; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t cnt_thr_event_u0: 1; /*This is the interrupt status bit for channel0 event.*/ + uint32_t cnt_thr_event_u1: 1; /*This is the interrupt status bit for channel1 event.*/ + uint32_t cnt_thr_event_u2: 1; /*This is the interrupt status bit for channel2 event.*/ + uint32_t cnt_thr_event_u3: 1; /*This is the interrupt status bit for channel3 event.*/ + uint32_t reserved4: 28; + }; + uint32_t val; + } int_st; + union { + struct { + uint32_t cnt_thr_event_u0: 1; /*This is the interrupt enable bit for channel0 event.*/ + uint32_t cnt_thr_event_u1: 1; /*This is the interrupt enable bit for channel1 event.*/ + uint32_t cnt_thr_event_u2: 1; /*This is the interrupt enable bit for channel2 event.*/ + uint32_t cnt_thr_event_u3: 1; /*This is the interrupt enable bit for channel3 event.*/ + uint32_t reserved4: 28; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t cnt_thr_event_u0: 1; /*Set this bit to clear channel0 event interrupt.*/ + uint32_t cnt_thr_event_u1: 1; /*Set this bit to clear channel1 event interrupt.*/ + uint32_t cnt_thr_event_u2: 1; /*Set this bit to clear channel2 event interrupt.*/ + uint32_t cnt_thr_event_u3: 1; /*Set this bit to clear channel3 event interrupt.*/ + uint32_t reserved4: 28; + }; + uint32_t val; + } int_clr; + union { + struct { + uint32_t cnt_mode:2; /*0: positive value to zero; 1: negative value to zero; 2: counter value negative ; 3: counter value positive*/ + uint32_t thres1_lat:1; /* counter value equals to thresh1*/ + uint32_t thres0_lat:1; /* counter value equals to thresh0*/ + uint32_t l_lim_lat:1; /* counter value reaches h_lim*/ + uint32_t h_lim_lat:1; /* counter value reaches l_lim*/ + uint32_t zero_lat:1; /* counter value equals zero*/ + uint32_t reserved7:25; + }; + uint32_t val; + } status_unit[4]; + union { + struct { + uint32_t cnt_rst_u0: 1; /*Set this bit to clear unit0's counter.*/ + uint32_t cnt_pause_u0: 1; /*Set this bit to pause unit0's counter.*/ + uint32_t cnt_rst_u1: 1; /*Set this bit to clear unit1's counter.*/ + uint32_t cnt_pause_u1: 1; /*Set this bit to pause unit1's counter.*/ + uint32_t cnt_rst_u2: 1; /*Set this bit to clear unit2's counter.*/ + uint32_t cnt_pause_u2: 1; /*Set this bit to pause unit2's counter.*/ + uint32_t cnt_rst_u3: 1; /*Set this bit to clear unit3's counter.*/ + uint32_t cnt_pause_u3: 1; /*Set this bit to pause unit3's counter.*/ + uint32_t clk_en: 1; + uint32_t reserved9: 13; + }; + uint32_t val; + } ctrl; + uint32_t reserved_b4; + uint32_t reserved_b8; + uint32_t reserved_bc; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t date; /**/ +} pcnt_dev_t; +extern pcnt_dev_t PCNT; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_PCNT_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/periph_defs.h b/components/soc/esp32s2beta/include/soc/periph_defs.h new file mode 100644 index 0000000000..099c28845b --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/periph_defs.h @@ -0,0 +1,64 @@ +// 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_PERIPH_DEFS_H_ +#define _SOC_PERIPH_DEFS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + PERIPH_LEDC_MODULE = 0, + PERIPH_UART0_MODULE, + PERIPH_UART1_MODULE, + PERIPH_USB_MODULE, + PERIPH_I2C0_MODULE, + PERIPH_I2C1_MODULE, + PERIPH_I2S0_MODULE, + PERIPH_I2S1_MODULE, + PERIPH_TIMG0_MODULE, + PERIPH_TIMG1_MODULE, + PERIPH_PWM0_MODULE, + PERIPH_PWM1_MODULE, + PERIPH_PWM2_MODULE, + PERIPH_PWM3_MODULE, + PERIPH_UHCI0_MODULE, + PERIPH_UHCI1_MODULE, + PERIPH_RMT_MODULE, + PERIPH_PCNT_MODULE, + PERIPH_SPI_MODULE, //SPI1 + PERIPH_FSPI_MODULE, //SPI2 + PERIPH_HSPI_MODULE, //SPI3 + PERIPH_VSPI_MODULE, //SPI4 + PERIPH_SPI2_DMA_MODULE, + PERIPH_SPI3_DMA_MODULE, + PERIPH_SPI_SHARED_DMA_MODULE, //this DMA is shared by SPI1 and SPI4 + PERIPH_SDMMC_MODULE, + PERIPH_SDIO_SLAVE_MODULE, + PERIPH_CAN_MODULE, + PERIPH_EMAC_MODULE, + PERIPH_RNG_MODULE, + PERIPH_WIFI_MODULE, + PERIPH_BT_MODULE, + PERIPH_WIFI_BT_COMMON_MODULE, + PERIPH_BT_BASEBAND_MODULE, + PERIPH_BT_LC_MODULE, +} periph_module_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_PERIPH_DEFS_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/rmt_reg.h b/components/soc/esp32s2beta/include/soc/rmt_reg.h new file mode 100644 index 0000000000..1beeac4fd5 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/rmt_reg.h @@ -0,0 +1,1482 @@ +// Copyright 2017-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. +#ifndef _SOC_RMT_REG_H_ +#define _SOC_RMT_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define RMT_CH0DATA_REG (DR_REG_RMT_BASE + 0x0000) + +#define RMT_CH1DATA_REG (DR_REG_RMT_BASE + 0x0004) + +#define RMT_CH2DATA_REG (DR_REG_RMT_BASE + 0x0008) + +#define RMT_CH3DATA_REG (DR_REG_RMT_BASE + 0x000c) + +#define RMT_CH0CONF0_REG (DR_REG_RMT_BASE + 0x0010) +/* RMT_CLK_EN : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define RMT_CLK_EN (BIT(31)) +#define RMT_CLK_EN_M (BIT(31)) +#define RMT_CLK_EN_V 0x1 +#define RMT_CLK_EN_S 31 +/* RMT_MEM_PD : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_PD (BIT(30)) +#define RMT_MEM_PD_M (BIT(30)) +#define RMT_MEM_PD_V 0x1 +#define RMT_MEM_PD_S 30 +/* RMT_CARRIER_OUT_LV_CH0 : R/W ;bitpos:[29] ;default: 1'b1 ; */ +/*description: */ +#define RMT_CARRIER_OUT_LV_CH0 (BIT(29)) +#define RMT_CARRIER_OUT_LV_CH0_M (BIT(29)) +#define RMT_CARRIER_OUT_LV_CH0_V 0x1 +#define RMT_CARRIER_OUT_LV_CH0_S 29 +/* RMT_CARRIER_EN_CH0 : R/W ;bitpos:[28] ;default: 1'b1 ; */ +/*description: */ +#define RMT_CARRIER_EN_CH0 (BIT(28)) +#define RMT_CARRIER_EN_CH0_M (BIT(28)) +#define RMT_CARRIER_EN_CH0_V 0x1 +#define RMT_CARRIER_EN_CH0_S 28 +/* RMT_MEM_SIZE_CH0 : R/W ;bitpos:[26:24] ;default: 3'h1 ; */ +/*description: */ +#define RMT_MEM_SIZE_CH0 0x00000007 +#define RMT_MEM_SIZE_CH0_M ((RMT_MEM_SIZE_CH0_V)<<(RMT_MEM_SIZE_CH0_S)) +#define RMT_MEM_SIZE_CH0_V 0x7 +#define RMT_MEM_SIZE_CH0_S 24 +/* RMT_IDLE_THRES_CH0 : R/W ;bitpos:[23:8] ;default: 16'h1000 ; */ +/*description: */ +#define RMT_IDLE_THRES_CH0 0x0000FFFF +#define RMT_IDLE_THRES_CH0_M ((RMT_IDLE_THRES_CH0_V)<<(RMT_IDLE_THRES_CH0_S)) +#define RMT_IDLE_THRES_CH0_V 0xFFFF +#define RMT_IDLE_THRES_CH0_S 8 +/* RMT_DIV_CNT_CH0 : R/W ;bitpos:[7:0] ;default: 8'h2 ; */ +/*description: */ +#define RMT_DIV_CNT_CH0 0x000000FF +#define RMT_DIV_CNT_CH0_M ((RMT_DIV_CNT_CH0_V)<<(RMT_DIV_CNT_CH0_S)) +#define RMT_DIV_CNT_CH0_V 0xFF +#define RMT_DIV_CNT_CH0_S 0 + +#define RMT_CH0CONF1_REG (DR_REG_RMT_BASE + 0x0014) +/* RMT_TX_STOP_CH0 : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_STOP_CH0 (BIT(20)) +#define RMT_TX_STOP_CH0_M (BIT(20)) +#define RMT_TX_STOP_CH0_V 0x1 +#define RMT_TX_STOP_CH0_S 20 +/* RMT_IDLE_OUT_EN_CH0 : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_IDLE_OUT_EN_CH0 (BIT(19)) +#define RMT_IDLE_OUT_EN_CH0_M (BIT(19)) +#define RMT_IDLE_OUT_EN_CH0_V 0x1 +#define RMT_IDLE_OUT_EN_CH0_S 19 +/* RMT_IDLE_OUT_LV_CH0 : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define RMT_IDLE_OUT_LV_CH0 (BIT(18)) +#define RMT_IDLE_OUT_LV_CH0_M (BIT(18)) +#define RMT_IDLE_OUT_LV_CH0_V 0x1 +#define RMT_IDLE_OUT_LV_CH0_S 18 +/* RMT_REF_ALWAYS_ON_CH0 : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define RMT_REF_ALWAYS_ON_CH0 (BIT(17)) +#define RMT_REF_ALWAYS_ON_CH0_M (BIT(17)) +#define RMT_REF_ALWAYS_ON_CH0_V 0x1 +#define RMT_REF_ALWAYS_ON_CH0_S 17 +/* RMT_RX_FILTER_THRES_CH0 : R/W ;bitpos:[15:8] ;default: 8'hf ; */ +/*description: */ +#define RMT_RX_FILTER_THRES_CH0 0x000000FF +#define RMT_RX_FILTER_THRES_CH0_M ((RMT_RX_FILTER_THRES_CH0_V)<<(RMT_RX_FILTER_THRES_CH0_S)) +#define RMT_RX_FILTER_THRES_CH0_V 0xFF +#define RMT_RX_FILTER_THRES_CH0_S 8 +/* RMT_RX_FILTER_EN_CH0 : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define RMT_RX_FILTER_EN_CH0 (BIT(7)) +#define RMT_RX_FILTER_EN_CH0_M (BIT(7)) +#define RMT_RX_FILTER_EN_CH0_V 0x1 +#define RMT_RX_FILTER_EN_CH0_S 7 +/* RMT_TX_CONTI_MODE_CH0 : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_CONTI_MODE_CH0 (BIT(6)) +#define RMT_TX_CONTI_MODE_CH0_M (BIT(6)) +#define RMT_TX_CONTI_MODE_CH0_V 0x1 +#define RMT_TX_CONTI_MODE_CH0_S 6 +/* RMT_MEM_OWNER_CH0 : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define RMT_MEM_OWNER_CH0 (BIT(5)) +#define RMT_MEM_OWNER_CH0_M (BIT(5)) +#define RMT_MEM_OWNER_CH0_V 0x1 +#define RMT_MEM_OWNER_CH0_S 5 +/* RMT_APB_MEM_RST_CH0 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RST_CH0 (BIT(4)) +#define RMT_APB_MEM_RST_CH0_M (BIT(4)) +#define RMT_APB_MEM_RST_CH0_V 0x1 +#define RMT_APB_MEM_RST_CH0_S 4 +/* RMT_MEM_RD_RST_CH0 : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_RD_RST_CH0 (BIT(3)) +#define RMT_MEM_RD_RST_CH0_M (BIT(3)) +#define RMT_MEM_RD_RST_CH0_V 0x1 +#define RMT_MEM_RD_RST_CH0_S 3 +/* RMT_MEM_WR_RST_CH0 : WO ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define RMT_MEM_WR_RST_CH0 (BIT(2)) +#define RMT_MEM_WR_RST_CH0_M (BIT(2)) +#define RMT_MEM_WR_RST_CH0_V 0x1 +#define RMT_MEM_WR_RST_CH0_S 2 +/* RMT_RX_EN_CH0 : R/W ;bitpos:[1] ;default: 1'h0 ; */ +/*description: */ +#define RMT_RX_EN_CH0 (BIT(1)) +#define RMT_RX_EN_CH0_M (BIT(1)) +#define RMT_RX_EN_CH0_V 0x1 +#define RMT_RX_EN_CH0_S 1 +/* RMT_TX_START_CH0 : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define RMT_TX_START_CH0 (BIT(0)) +#define RMT_TX_START_CH0_M (BIT(0)) +#define RMT_TX_START_CH0_V 0x1 +#define RMT_TX_START_CH0_S 0 + +#define RMT_CH1CONF0_REG (DR_REG_RMT_BASE + 0x0018) +/* RMT_CARRIER_OUT_LV_CH1 : R/W ;bitpos:[29] ;default: 1'b1 ; */ +/*description: */ +#define RMT_CARRIER_OUT_LV_CH1 (BIT(29)) +#define RMT_CARRIER_OUT_LV_CH1_M (BIT(29)) +#define RMT_CARRIER_OUT_LV_CH1_V 0x1 +#define RMT_CARRIER_OUT_LV_CH1_S 29 +/* RMT_CARRIER_EN_CH1 : R/W ;bitpos:[28] ;default: 1'b1 ; */ +/*description: */ +#define RMT_CARRIER_EN_CH1 (BIT(28)) +#define RMT_CARRIER_EN_CH1_M (BIT(28)) +#define RMT_CARRIER_EN_CH1_V 0x1 +#define RMT_CARRIER_EN_CH1_S 28 +/* RMT_MEM_SIZE_CH1 : R/W ;bitpos:[26:24] ;default: 3'h1 ; */ +/*description: */ +#define RMT_MEM_SIZE_CH1 0x00000007 +#define RMT_MEM_SIZE_CH1_M ((RMT_MEM_SIZE_CH1_V)<<(RMT_MEM_SIZE_CH1_S)) +#define RMT_MEM_SIZE_CH1_V 0x7 +#define RMT_MEM_SIZE_CH1_S 24 +/* RMT_IDLE_THRES_CH1 : R/W ;bitpos:[23:8] ;default: 16'h1000 ; */ +/*description: */ +#define RMT_IDLE_THRES_CH1 0x0000FFFF +#define RMT_IDLE_THRES_CH1_M ((RMT_IDLE_THRES_CH1_V)<<(RMT_IDLE_THRES_CH1_S)) +#define RMT_IDLE_THRES_CH1_V 0xFFFF +#define RMT_IDLE_THRES_CH1_S 8 +/* RMT_DIV_CNT_CH1 : R/W ;bitpos:[7:0] ;default: 8'h2 ; */ +/*description: */ +#define RMT_DIV_CNT_CH1 0x000000FF +#define RMT_DIV_CNT_CH1_M ((RMT_DIV_CNT_CH1_V)<<(RMT_DIV_CNT_CH1_S)) +#define RMT_DIV_CNT_CH1_V 0xFF +#define RMT_DIV_CNT_CH1_S 0 + +#define RMT_CH1CONF1_REG (DR_REG_RMT_BASE + 0x001c) +/* RMT_TX_STOP_CH1 : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_STOP_CH1 (BIT(20)) +#define RMT_TX_STOP_CH1_M (BIT(20)) +#define RMT_TX_STOP_CH1_V 0x1 +#define RMT_TX_STOP_CH1_S 20 +/* RMT_IDLE_OUT_EN_CH1 : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_IDLE_OUT_EN_CH1 (BIT(19)) +#define RMT_IDLE_OUT_EN_CH1_M (BIT(19)) +#define RMT_IDLE_OUT_EN_CH1_V 0x1 +#define RMT_IDLE_OUT_EN_CH1_S 19 +/* RMT_IDLE_OUT_LV_CH1 : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define RMT_IDLE_OUT_LV_CH1 (BIT(18)) +#define RMT_IDLE_OUT_LV_CH1_M (BIT(18)) +#define RMT_IDLE_OUT_LV_CH1_V 0x1 +#define RMT_IDLE_OUT_LV_CH1_S 18 +/* RMT_REF_ALWAYS_ON_CH1 : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define RMT_REF_ALWAYS_ON_CH1 (BIT(17)) +#define RMT_REF_ALWAYS_ON_CH1_M (BIT(17)) +#define RMT_REF_ALWAYS_ON_CH1_V 0x1 +#define RMT_REF_ALWAYS_ON_CH1_S 17 +/* RMT_RX_FILTER_THRES_CH1 : R/W ;bitpos:[15:8] ;default: 8'hf ; */ +/*description: */ +#define RMT_RX_FILTER_THRES_CH1 0x000000FF +#define RMT_RX_FILTER_THRES_CH1_M ((RMT_RX_FILTER_THRES_CH1_V)<<(RMT_RX_FILTER_THRES_CH1_S)) +#define RMT_RX_FILTER_THRES_CH1_V 0xFF +#define RMT_RX_FILTER_THRES_CH1_S 8 +/* RMT_RX_FILTER_EN_CH1 : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define RMT_RX_FILTER_EN_CH1 (BIT(7)) +#define RMT_RX_FILTER_EN_CH1_M (BIT(7)) +#define RMT_RX_FILTER_EN_CH1_V 0x1 +#define RMT_RX_FILTER_EN_CH1_S 7 +/* RMT_TX_CONTI_MODE_CH1 : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_CONTI_MODE_CH1 (BIT(6)) +#define RMT_TX_CONTI_MODE_CH1_M (BIT(6)) +#define RMT_TX_CONTI_MODE_CH1_V 0x1 +#define RMT_TX_CONTI_MODE_CH1_S 6 +/* RMT_MEM_OWNER_CH1 : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define RMT_MEM_OWNER_CH1 (BIT(5)) +#define RMT_MEM_OWNER_CH1_M (BIT(5)) +#define RMT_MEM_OWNER_CH1_V 0x1 +#define RMT_MEM_OWNER_CH1_S 5 +/* RMT_APB_MEM_RST_CH1 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RST_CH1 (BIT(4)) +#define RMT_APB_MEM_RST_CH1_M (BIT(4)) +#define RMT_APB_MEM_RST_CH1_V 0x1 +#define RMT_APB_MEM_RST_CH1_S 4 +/* RMT_MEM_RD_RST_CH1 : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_RD_RST_CH1 (BIT(3)) +#define RMT_MEM_RD_RST_CH1_M (BIT(3)) +#define RMT_MEM_RD_RST_CH1_V 0x1 +#define RMT_MEM_RD_RST_CH1_S 3 +/* RMT_MEM_WR_RST_CH1 : WO ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define RMT_MEM_WR_RST_CH1 (BIT(2)) +#define RMT_MEM_WR_RST_CH1_M (BIT(2)) +#define RMT_MEM_WR_RST_CH1_V 0x1 +#define RMT_MEM_WR_RST_CH1_S 2 +/* RMT_RX_EN_CH1 : R/W ;bitpos:[1] ;default: 1'h0 ; */ +/*description: */ +#define RMT_RX_EN_CH1 (BIT(1)) +#define RMT_RX_EN_CH1_M (BIT(1)) +#define RMT_RX_EN_CH1_V 0x1 +#define RMT_RX_EN_CH1_S 1 +/* RMT_TX_START_CH1 : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define RMT_TX_START_CH1 (BIT(0)) +#define RMT_TX_START_CH1_M (BIT(0)) +#define RMT_TX_START_CH1_V 0x1 +#define RMT_TX_START_CH1_S 0 + +#define RMT_CH2CONF0_REG (DR_REG_RMT_BASE + 0x0020) +/* RMT_CARRIER_OUT_LV_CH2 : R/W ;bitpos:[29] ;default: 1'b1 ; */ +/*description: */ +#define RMT_CARRIER_OUT_LV_CH2 (BIT(29)) +#define RMT_CARRIER_OUT_LV_CH2_M (BIT(29)) +#define RMT_CARRIER_OUT_LV_CH2_V 0x1 +#define RMT_CARRIER_OUT_LV_CH2_S 29 +/* RMT_CARRIER_EN_CH2 : R/W ;bitpos:[28] ;default: 1'b1 ; */ +/*description: */ +#define RMT_CARRIER_EN_CH2 (BIT(28)) +#define RMT_CARRIER_EN_CH2_M (BIT(28)) +#define RMT_CARRIER_EN_CH2_V 0x1 +#define RMT_CARRIER_EN_CH2_S 28 +/* RMT_MEM_SIZE_CH2 : R/W ;bitpos:[26:24] ;default: 3'h1 ; */ +/*description: */ +#define RMT_MEM_SIZE_CH2 0x00000007 +#define RMT_MEM_SIZE_CH2_M ((RMT_MEM_SIZE_CH2_V)<<(RMT_MEM_SIZE_CH2_S)) +#define RMT_MEM_SIZE_CH2_V 0x7 +#define RMT_MEM_SIZE_CH2_S 24 +/* RMT_IDLE_THRES_CH2 : R/W ;bitpos:[23:8] ;default: 16'h1000 ; */ +/*description: */ +#define RMT_IDLE_THRES_CH2 0x0000FFFF +#define RMT_IDLE_THRES_CH2_M ((RMT_IDLE_THRES_CH2_V)<<(RMT_IDLE_THRES_CH2_S)) +#define RMT_IDLE_THRES_CH2_V 0xFFFF +#define RMT_IDLE_THRES_CH2_S 8 +/* RMT_DIV_CNT_CH2 : R/W ;bitpos:[7:0] ;default: 8'h2 ; */ +/*description: */ +#define RMT_DIV_CNT_CH2 0x000000FF +#define RMT_DIV_CNT_CH2_M ((RMT_DIV_CNT_CH2_V)<<(RMT_DIV_CNT_CH2_S)) +#define RMT_DIV_CNT_CH2_V 0xFF +#define RMT_DIV_CNT_CH2_S 0 + +#define RMT_CH2CONF1_REG (DR_REG_RMT_BASE + 0x0024) +/* RMT_TX_STOP_CH2 : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_STOP_CH2 (BIT(20)) +#define RMT_TX_STOP_CH2_M (BIT(20)) +#define RMT_TX_STOP_CH2_V 0x1 +#define RMT_TX_STOP_CH2_S 20 +/* RMT_IDLE_OUT_EN_CH2 : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_IDLE_OUT_EN_CH2 (BIT(19)) +#define RMT_IDLE_OUT_EN_CH2_M (BIT(19)) +#define RMT_IDLE_OUT_EN_CH2_V 0x1 +#define RMT_IDLE_OUT_EN_CH2_S 19 +/* RMT_IDLE_OUT_LV_CH2 : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define RMT_IDLE_OUT_LV_CH2 (BIT(18)) +#define RMT_IDLE_OUT_LV_CH2_M (BIT(18)) +#define RMT_IDLE_OUT_LV_CH2_V 0x1 +#define RMT_IDLE_OUT_LV_CH2_S 18 +/* RMT_REF_ALWAYS_ON_CH2 : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define RMT_REF_ALWAYS_ON_CH2 (BIT(17)) +#define RMT_REF_ALWAYS_ON_CH2_M (BIT(17)) +#define RMT_REF_ALWAYS_ON_CH2_V 0x1 +#define RMT_REF_ALWAYS_ON_CH2_S 17 +/* RMT_RX_FILTER_THRES_CH2 : R/W ;bitpos:[15:8] ;default: 8'hf ; */ +/*description: */ +#define RMT_RX_FILTER_THRES_CH2 0x000000FF +#define RMT_RX_FILTER_THRES_CH2_M ((RMT_RX_FILTER_THRES_CH2_V)<<(RMT_RX_FILTER_THRES_CH2_S)) +#define RMT_RX_FILTER_THRES_CH2_V 0xFF +#define RMT_RX_FILTER_THRES_CH2_S 8 +/* RMT_RX_FILTER_EN_CH2 : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define RMT_RX_FILTER_EN_CH2 (BIT(7)) +#define RMT_RX_FILTER_EN_CH2_M (BIT(7)) +#define RMT_RX_FILTER_EN_CH2_V 0x1 +#define RMT_RX_FILTER_EN_CH2_S 7 +/* RMT_TX_CONTI_MODE_CH2 : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_CONTI_MODE_CH2 (BIT(6)) +#define RMT_TX_CONTI_MODE_CH2_M (BIT(6)) +#define RMT_TX_CONTI_MODE_CH2_V 0x1 +#define RMT_TX_CONTI_MODE_CH2_S 6 +/* RMT_MEM_OWNER_CH2 : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define RMT_MEM_OWNER_CH2 (BIT(5)) +#define RMT_MEM_OWNER_CH2_M (BIT(5)) +#define RMT_MEM_OWNER_CH2_V 0x1 +#define RMT_MEM_OWNER_CH2_S 5 +/* RMT_APB_MEM_RST_CH2 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RST_CH2 (BIT(4)) +#define RMT_APB_MEM_RST_CH2_M (BIT(4)) +#define RMT_APB_MEM_RST_CH2_V 0x1 +#define RMT_APB_MEM_RST_CH2_S 4 +/* RMT_MEM_RD_RST_CH2 : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_RD_RST_CH2 (BIT(3)) +#define RMT_MEM_RD_RST_CH2_M (BIT(3)) +#define RMT_MEM_RD_RST_CH2_V 0x1 +#define RMT_MEM_RD_RST_CH2_S 3 +/* RMT_MEM_WR_RST_CH2 : WO ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define RMT_MEM_WR_RST_CH2 (BIT(2)) +#define RMT_MEM_WR_RST_CH2_M (BIT(2)) +#define RMT_MEM_WR_RST_CH2_V 0x1 +#define RMT_MEM_WR_RST_CH2_S 2 +/* RMT_RX_EN_CH2 : R/W ;bitpos:[1] ;default: 1'h0 ; */ +/*description: */ +#define RMT_RX_EN_CH2 (BIT(1)) +#define RMT_RX_EN_CH2_M (BIT(1)) +#define RMT_RX_EN_CH2_V 0x1 +#define RMT_RX_EN_CH2_S 1 +/* RMT_TX_START_CH2 : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define RMT_TX_START_CH2 (BIT(0)) +#define RMT_TX_START_CH2_M (BIT(0)) +#define RMT_TX_START_CH2_V 0x1 +#define RMT_TX_START_CH2_S 0 + +#define RMT_CH3CONF0_REG (DR_REG_RMT_BASE + 0x0028) +/* RMT_CARRIER_OUT_LV_CH3 : R/W ;bitpos:[29] ;default: 1'b1 ; */ +/*description: */ +#define RMT_CARRIER_OUT_LV_CH3 (BIT(29)) +#define RMT_CARRIER_OUT_LV_CH3_M (BIT(29)) +#define RMT_CARRIER_OUT_LV_CH3_V 0x1 +#define RMT_CARRIER_OUT_LV_CH3_S 29 +/* RMT_CARRIER_EN_CH3 : R/W ;bitpos:[28] ;default: 1'b1 ; */ +/*description: */ +#define RMT_CARRIER_EN_CH3 (BIT(28)) +#define RMT_CARRIER_EN_CH3_M (BIT(28)) +#define RMT_CARRIER_EN_CH3_V 0x1 +#define RMT_CARRIER_EN_CH3_S 28 +/* RMT_MEM_SIZE_CH3 : R/W ;bitpos:[26:24] ;default: 3'h1 ; */ +/*description: */ +#define RMT_MEM_SIZE_CH3 0x00000007 +#define RMT_MEM_SIZE_CH3_M ((RMT_MEM_SIZE_CH3_V)<<(RMT_MEM_SIZE_CH3_S)) +#define RMT_MEM_SIZE_CH3_V 0x7 +#define RMT_MEM_SIZE_CH3_S 24 +/* RMT_IDLE_THRES_CH3 : R/W ;bitpos:[23:8] ;default: 16'h1000 ; */ +/*description: */ +#define RMT_IDLE_THRES_CH3 0x0000FFFF +#define RMT_IDLE_THRES_CH3_M ((RMT_IDLE_THRES_CH3_V)<<(RMT_IDLE_THRES_CH3_S)) +#define RMT_IDLE_THRES_CH3_V 0xFFFF +#define RMT_IDLE_THRES_CH3_S 8 +/* RMT_DIV_CNT_CH3 : R/W ;bitpos:[7:0] ;default: 8'h2 ; */ +/*description: */ +#define RMT_DIV_CNT_CH3 0x000000FF +#define RMT_DIV_CNT_CH3_M ((RMT_DIV_CNT_CH3_V)<<(RMT_DIV_CNT_CH3_S)) +#define RMT_DIV_CNT_CH3_V 0xFF +#define RMT_DIV_CNT_CH3_S 0 + +#define RMT_CH3CONF1_REG (DR_REG_RMT_BASE + 0x002c) +/* RMT_TX_STOP_CH3 : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_STOP_CH3 (BIT(20)) +#define RMT_TX_STOP_CH3_M (BIT(20)) +#define RMT_TX_STOP_CH3_V 0x1 +#define RMT_TX_STOP_CH3_S 20 +/* RMT_IDLE_OUT_EN_CH3 : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_IDLE_OUT_EN_CH3 (BIT(19)) +#define RMT_IDLE_OUT_EN_CH3_M (BIT(19)) +#define RMT_IDLE_OUT_EN_CH3_V 0x1 +#define RMT_IDLE_OUT_EN_CH3_S 19 +/* RMT_IDLE_OUT_LV_CH3 : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define RMT_IDLE_OUT_LV_CH3 (BIT(18)) +#define RMT_IDLE_OUT_LV_CH3_M (BIT(18)) +#define RMT_IDLE_OUT_LV_CH3_V 0x1 +#define RMT_IDLE_OUT_LV_CH3_S 18 +/* RMT_REF_ALWAYS_ON_CH3 : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define RMT_REF_ALWAYS_ON_CH3 (BIT(17)) +#define RMT_REF_ALWAYS_ON_CH3_M (BIT(17)) +#define RMT_REF_ALWAYS_ON_CH3_V 0x1 +#define RMT_REF_ALWAYS_ON_CH3_S 17 +/* RMT_RX_FILTER_THRES_CH3 : R/W ;bitpos:[15:8] ;default: 8'hf ; */ +/*description: */ +#define RMT_RX_FILTER_THRES_CH3 0x000000FF +#define RMT_RX_FILTER_THRES_CH3_M ((RMT_RX_FILTER_THRES_CH3_V)<<(RMT_RX_FILTER_THRES_CH3_S)) +#define RMT_RX_FILTER_THRES_CH3_V 0xFF +#define RMT_RX_FILTER_THRES_CH3_S 8 +/* RMT_RX_FILTER_EN_CH3 : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define RMT_RX_FILTER_EN_CH3 (BIT(7)) +#define RMT_RX_FILTER_EN_CH3_M (BIT(7)) +#define RMT_RX_FILTER_EN_CH3_V 0x1 +#define RMT_RX_FILTER_EN_CH3_S 7 +/* RMT_TX_CONTI_MODE_CH3 : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_CONTI_MODE_CH3 (BIT(6)) +#define RMT_TX_CONTI_MODE_CH3_M (BIT(6)) +#define RMT_TX_CONTI_MODE_CH3_V 0x1 +#define RMT_TX_CONTI_MODE_CH3_S 6 +/* RMT_MEM_OWNER_CH3 : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define RMT_MEM_OWNER_CH3 (BIT(5)) +#define RMT_MEM_OWNER_CH3_M (BIT(5)) +#define RMT_MEM_OWNER_CH3_V 0x1 +#define RMT_MEM_OWNER_CH3_S 5 +/* RMT_APB_MEM_RST_CH3 : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RST_CH3 (BIT(4)) +#define RMT_APB_MEM_RST_CH3_M (BIT(4)) +#define RMT_APB_MEM_RST_CH3_V 0x1 +#define RMT_APB_MEM_RST_CH3_S 4 +/* RMT_MEM_RD_RST_CH3 : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_RD_RST_CH3 (BIT(3)) +#define RMT_MEM_RD_RST_CH3_M (BIT(3)) +#define RMT_MEM_RD_RST_CH3_V 0x1 +#define RMT_MEM_RD_RST_CH3_S 3 +/* RMT_MEM_WR_RST_CH3 : WO ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define RMT_MEM_WR_RST_CH3 (BIT(2)) +#define RMT_MEM_WR_RST_CH3_M (BIT(2)) +#define RMT_MEM_WR_RST_CH3_V 0x1 +#define RMT_MEM_WR_RST_CH3_S 2 +/* RMT_RX_EN_CH3 : R/W ;bitpos:[1] ;default: 1'h0 ; */ +/*description: */ +#define RMT_RX_EN_CH3 (BIT(1)) +#define RMT_RX_EN_CH3_M (BIT(1)) +#define RMT_RX_EN_CH3_V 0x1 +#define RMT_RX_EN_CH3_S 1 +/* RMT_TX_START_CH3 : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define RMT_TX_START_CH3 (BIT(0)) +#define RMT_TX_START_CH3_M (BIT(0)) +#define RMT_TX_START_CH3_V 0x1 +#define RMT_TX_START_CH3_S 0 + +#define RMT_CH0STATUS_REG (DR_REG_RMT_BASE + 0x0030) +/* RMT_APB_MEM_RD_ERR_CH0 : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RD_ERR_CH0 (BIT(27)) +#define RMT_APB_MEM_RD_ERR_CH0_M (BIT(27)) +#define RMT_APB_MEM_RD_ERR_CH0_V 0x1 +#define RMT_APB_MEM_RD_ERR_CH0_S 27 +/* RMT_APB_MEM_WR_ERR_CH0 : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_WR_ERR_CH0 (BIT(26)) +#define RMT_APB_MEM_WR_ERR_CH0_M (BIT(26)) +#define RMT_APB_MEM_WR_ERR_CH0_V 0x1 +#define RMT_APB_MEM_WR_ERR_CH0_S 26 +/* RMT_MEM_EMPTY_CH0 : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_EMPTY_CH0 (BIT(25)) +#define RMT_MEM_EMPTY_CH0_M (BIT(25)) +#define RMT_MEM_EMPTY_CH0_V 0x1 +#define RMT_MEM_EMPTY_CH0_S 25 +/* RMT_MEM_FULL_CH0 : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_FULL_CH0 (BIT(24)) +#define RMT_MEM_FULL_CH0_M (BIT(24)) +#define RMT_MEM_FULL_CH0_V 0x1 +#define RMT_MEM_FULL_CH0_S 24 +/* RMT_MEM_OWNER_ERR_CH0 : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_OWNER_ERR_CH0 (BIT(23)) +#define RMT_MEM_OWNER_ERR_CH0_M (BIT(23)) +#define RMT_MEM_OWNER_ERR_CH0_V 0x1 +#define RMT_MEM_OWNER_ERR_CH0_S 23 +/* RMT_STATE_CH0 : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: */ +#define RMT_STATE_CH0 0x00000007 +#define RMT_STATE_CH0_M ((RMT_STATE_CH0_V)<<(RMT_STATE_CH0_S)) +#define RMT_STATE_CH0_V 0x7 +#define RMT_STATE_CH0_S 20 +/* RMT_MEM_RADDR_EX_CH0 : RO ;bitpos:[18:10] ;default: 9'b0 ; */ +/*description: */ +#define RMT_MEM_RADDR_EX_CH0 0x000001FF +#define RMT_MEM_RADDR_EX_CH0_M ((RMT_MEM_RADDR_EX_CH0_V)<<(RMT_MEM_RADDR_EX_CH0_S)) +#define RMT_MEM_RADDR_EX_CH0_V 0x1FF +#define RMT_MEM_RADDR_EX_CH0_S 10 +/* RMT_MEM_WADDR_EX_CH0 : RO ;bitpos:[8:0] ;default: 9'b0 ; */ +/*description: */ +#define RMT_MEM_WADDR_EX_CH0 0x000001FF +#define RMT_MEM_WADDR_EX_CH0_M ((RMT_MEM_WADDR_EX_CH0_V)<<(RMT_MEM_WADDR_EX_CH0_S)) +#define RMT_MEM_WADDR_EX_CH0_V 0x1FF +#define RMT_MEM_WADDR_EX_CH0_S 0 + +#define RMT_CH1STATUS_REG (DR_REG_RMT_BASE + 0x0034) +/* RMT_APB_MEM_RD_ERR_CH1 : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RD_ERR_CH1 (BIT(27)) +#define RMT_APB_MEM_RD_ERR_CH1_M (BIT(27)) +#define RMT_APB_MEM_RD_ERR_CH1_V 0x1 +#define RMT_APB_MEM_RD_ERR_CH1_S 27 +/* RMT_APB_MEM_WR_ERR_CH1 : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_WR_ERR_CH1 (BIT(26)) +#define RMT_APB_MEM_WR_ERR_CH1_M (BIT(26)) +#define RMT_APB_MEM_WR_ERR_CH1_V 0x1 +#define RMT_APB_MEM_WR_ERR_CH1_S 26 +/* RMT_MEM_EMPTY_CH1 : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_EMPTY_CH1 (BIT(25)) +#define RMT_MEM_EMPTY_CH1_M (BIT(25)) +#define RMT_MEM_EMPTY_CH1_V 0x1 +#define RMT_MEM_EMPTY_CH1_S 25 +/* RMT_MEM_FULL_CH1 : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_FULL_CH1 (BIT(24)) +#define RMT_MEM_FULL_CH1_M (BIT(24)) +#define RMT_MEM_FULL_CH1_V 0x1 +#define RMT_MEM_FULL_CH1_S 24 +/* RMT_MEM_OWNER_ERR_CH1 : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_OWNER_ERR_CH1 (BIT(23)) +#define RMT_MEM_OWNER_ERR_CH1_M (BIT(23)) +#define RMT_MEM_OWNER_ERR_CH1_V 0x1 +#define RMT_MEM_OWNER_ERR_CH1_S 23 +/* RMT_STATE_CH1 : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: */ +#define RMT_STATE_CH1 0x00000007 +#define RMT_STATE_CH1_M ((RMT_STATE_CH1_V)<<(RMT_STATE_CH1_S)) +#define RMT_STATE_CH1_V 0x7 +#define RMT_STATE_CH1_S 20 +/* RMT_MEM_RADDR_EX_CH1 : RO ;bitpos:[18:10] ;default: 9'b0 ; */ +/*description: */ +#define RMT_MEM_RADDR_EX_CH1 0x000001FF +#define RMT_MEM_RADDR_EX_CH1_M ((RMT_MEM_RADDR_EX_CH1_V)<<(RMT_MEM_RADDR_EX_CH1_S)) +#define RMT_MEM_RADDR_EX_CH1_V 0x1FF +#define RMT_MEM_RADDR_EX_CH1_S 10 +/* RMT_MEM_WADDR_EX_CH1 : RO ;bitpos:[8:0] ;default: 9'b0 ; */ +/*description: */ +#define RMT_MEM_WADDR_EX_CH1 0x000001FF +#define RMT_MEM_WADDR_EX_CH1_M ((RMT_MEM_WADDR_EX_CH1_V)<<(RMT_MEM_WADDR_EX_CH1_S)) +#define RMT_MEM_WADDR_EX_CH1_V 0x1FF +#define RMT_MEM_WADDR_EX_CH1_S 0 + +#define RMT_CH2STATUS_REG (DR_REG_RMT_BASE + 0x0038) +/* RMT_APB_MEM_RD_ERR_CH2 : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RD_ERR_CH2 (BIT(27)) +#define RMT_APB_MEM_RD_ERR_CH2_M (BIT(27)) +#define RMT_APB_MEM_RD_ERR_CH2_V 0x1 +#define RMT_APB_MEM_RD_ERR_CH2_S 27 +/* RMT_APB_MEM_WR_ERR_CH2 : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_WR_ERR_CH2 (BIT(26)) +#define RMT_APB_MEM_WR_ERR_CH2_M (BIT(26)) +#define RMT_APB_MEM_WR_ERR_CH2_V 0x1 +#define RMT_APB_MEM_WR_ERR_CH2_S 26 +/* RMT_MEM_EMPTY_CH2 : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_EMPTY_CH2 (BIT(25)) +#define RMT_MEM_EMPTY_CH2_M (BIT(25)) +#define RMT_MEM_EMPTY_CH2_V 0x1 +#define RMT_MEM_EMPTY_CH2_S 25 +/* RMT_MEM_FULL_CH2 : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_FULL_CH2 (BIT(24)) +#define RMT_MEM_FULL_CH2_M (BIT(24)) +#define RMT_MEM_FULL_CH2_V 0x1 +#define RMT_MEM_FULL_CH2_S 24 +/* RMT_MEM_OWNER_ERR_CH2 : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_OWNER_ERR_CH2 (BIT(23)) +#define RMT_MEM_OWNER_ERR_CH2_M (BIT(23)) +#define RMT_MEM_OWNER_ERR_CH2_V 0x1 +#define RMT_MEM_OWNER_ERR_CH2_S 23 +/* RMT_STATE_CH2 : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: */ +#define RMT_STATE_CH2 0x00000007 +#define RMT_STATE_CH2_M ((RMT_STATE_CH2_V)<<(RMT_STATE_CH2_S)) +#define RMT_STATE_CH2_V 0x7 +#define RMT_STATE_CH2_S 20 +/* RMT_MEM_RADDR_EX_CH2 : RO ;bitpos:[18:10] ;default: 9'b0 ; */ +/*description: */ +#define RMT_MEM_RADDR_EX_CH2 0x000001FF +#define RMT_MEM_RADDR_EX_CH2_M ((RMT_MEM_RADDR_EX_CH2_V)<<(RMT_MEM_RADDR_EX_CH2_S)) +#define RMT_MEM_RADDR_EX_CH2_V 0x1FF +#define RMT_MEM_RADDR_EX_CH2_S 10 +/* RMT_MEM_WADDR_EX_CH2 : RO ;bitpos:[8:0] ;default: 9'b0 ; */ +/*description: */ +#define RMT_MEM_WADDR_EX_CH2 0x000001FF +#define RMT_MEM_WADDR_EX_CH2_M ((RMT_MEM_WADDR_EX_CH2_V)<<(RMT_MEM_WADDR_EX_CH2_S)) +#define RMT_MEM_WADDR_EX_CH2_V 0x1FF +#define RMT_MEM_WADDR_EX_CH2_S 0 + +#define RMT_CH3STATUS_REG (DR_REG_RMT_BASE + 0x003c) +/* RMT_APB_MEM_RD_ERR_CH3 : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RD_ERR_CH3 (BIT(27)) +#define RMT_APB_MEM_RD_ERR_CH3_M (BIT(27)) +#define RMT_APB_MEM_RD_ERR_CH3_V 0x1 +#define RMT_APB_MEM_RD_ERR_CH3_S 27 +/* RMT_APB_MEM_WR_ERR_CH3 : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define RMT_APB_MEM_WR_ERR_CH3 (BIT(26)) +#define RMT_APB_MEM_WR_ERR_CH3_M (BIT(26)) +#define RMT_APB_MEM_WR_ERR_CH3_V 0x1 +#define RMT_APB_MEM_WR_ERR_CH3_S 26 +/* RMT_MEM_EMPTY_CH3 : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_EMPTY_CH3 (BIT(25)) +#define RMT_MEM_EMPTY_CH3_M (BIT(25)) +#define RMT_MEM_EMPTY_CH3_V 0x1 +#define RMT_MEM_EMPTY_CH3_S 25 +/* RMT_MEM_FULL_CH3 : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_FULL_CH3 (BIT(24)) +#define RMT_MEM_FULL_CH3_M (BIT(24)) +#define RMT_MEM_FULL_CH3_V 0x1 +#define RMT_MEM_FULL_CH3_S 24 +/* RMT_MEM_OWNER_ERR_CH3 : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_OWNER_ERR_CH3 (BIT(23)) +#define RMT_MEM_OWNER_ERR_CH3_M (BIT(23)) +#define RMT_MEM_OWNER_ERR_CH3_V 0x1 +#define RMT_MEM_OWNER_ERR_CH3_S 23 +/* RMT_STATE_CH3 : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: */ +#define RMT_STATE_CH3 0x00000007 +#define RMT_STATE_CH3_M ((RMT_STATE_CH3_V)<<(RMT_STATE_CH3_S)) +#define RMT_STATE_CH3_V 0x7 +#define RMT_STATE_CH3_S 20 +/* RMT_MEM_RADDR_EX_CH3 : RO ;bitpos:[18:10] ;default: 9'b0 ; */ +/*description: */ +#define RMT_MEM_RADDR_EX_CH3 0x000001FF +#define RMT_MEM_RADDR_EX_CH3_M ((RMT_MEM_RADDR_EX_CH3_V)<<(RMT_MEM_RADDR_EX_CH3_S)) +#define RMT_MEM_RADDR_EX_CH3_V 0x1FF +#define RMT_MEM_RADDR_EX_CH3_S 10 +/* RMT_MEM_WADDR_EX_CH3 : RO ;bitpos:[8:0] ;default: 9'b0 ; */ +/*description: */ +#define RMT_MEM_WADDR_EX_CH3 0x000001FF +#define RMT_MEM_WADDR_EX_CH3_M ((RMT_MEM_WADDR_EX_CH3_V)<<(RMT_MEM_WADDR_EX_CH3_S)) +#define RMT_MEM_WADDR_EX_CH3_V 0x1FF +#define RMT_MEM_WADDR_EX_CH3_S 0 + +#define RMT_CH0ADDR_REG (DR_REG_RMT_BASE + 0x0040) +/* RMT_APB_MEM_RADDR_CH0 : RO ;bitpos:[18:10] ;default: 9'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RADDR_CH0 0x000001FF +#define RMT_APB_MEM_RADDR_CH0_M ((RMT_APB_MEM_RADDR_CH0_V)<<(RMT_APB_MEM_RADDR_CH0_S)) +#define RMT_APB_MEM_RADDR_CH0_V 0x1FF +#define RMT_APB_MEM_RADDR_CH0_S 10 +/* RMT_APB_MEM_WADDR_CH0 : RO ;bitpos:[8:0] ;default: 9'b0 ; */ +/*description: */ +#define RMT_APB_MEM_WADDR_CH0 0x000001FF +#define RMT_APB_MEM_WADDR_CH0_M ((RMT_APB_MEM_WADDR_CH0_V)<<(RMT_APB_MEM_WADDR_CH0_S)) +#define RMT_APB_MEM_WADDR_CH0_V 0x1FF +#define RMT_APB_MEM_WADDR_CH0_S 0 + +#define RMT_CH1ADDR_REG (DR_REG_RMT_BASE + 0x0044) +/* RMT_APB_MEM_RADDR_CH1 : RO ;bitpos:[18:10] ;default: 9'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RADDR_CH1 0x000001FF +#define RMT_APB_MEM_RADDR_CH1_M ((RMT_APB_MEM_RADDR_CH1_V)<<(RMT_APB_MEM_RADDR_CH1_S)) +#define RMT_APB_MEM_RADDR_CH1_V 0x1FF +#define RMT_APB_MEM_RADDR_CH1_S 10 +/* RMT_APB_MEM_WADDR_CH1 : RO ;bitpos:[8:0] ;default: 9'b0 ; */ +/*description: */ +#define RMT_APB_MEM_WADDR_CH1 0x000001FF +#define RMT_APB_MEM_WADDR_CH1_M ((RMT_APB_MEM_WADDR_CH1_V)<<(RMT_APB_MEM_WADDR_CH1_S)) +#define RMT_APB_MEM_WADDR_CH1_V 0x1FF +#define RMT_APB_MEM_WADDR_CH1_S 0 + +#define RMT_CH2ADDR_REG (DR_REG_RMT_BASE + 0x0048) +/* RMT_APB_MEM_RADDR_CH2 : RO ;bitpos:[18:10] ;default: 9'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RADDR_CH2 0x000001FF +#define RMT_APB_MEM_RADDR_CH2_M ((RMT_APB_MEM_RADDR_CH2_V)<<(RMT_APB_MEM_RADDR_CH2_S)) +#define RMT_APB_MEM_RADDR_CH2_V 0x1FF +#define RMT_APB_MEM_RADDR_CH2_S 10 +/* RMT_APB_MEM_WADDR_CH2 : RO ;bitpos:[8:0] ;default: 9'b0 ; */ +/*description: */ +#define RMT_APB_MEM_WADDR_CH2 0x000001FF +#define RMT_APB_MEM_WADDR_CH2_M ((RMT_APB_MEM_WADDR_CH2_V)<<(RMT_APB_MEM_WADDR_CH2_S)) +#define RMT_APB_MEM_WADDR_CH2_V 0x1FF +#define RMT_APB_MEM_WADDR_CH2_S 0 + +#define RMT_CH3ADDR_REG (DR_REG_RMT_BASE + 0x004c) +/* RMT_APB_MEM_RADDR_CH3 : RO ;bitpos:[18:10] ;default: 9'b0 ; */ +/*description: */ +#define RMT_APB_MEM_RADDR_CH3 0x000001FF +#define RMT_APB_MEM_RADDR_CH3_M ((RMT_APB_MEM_RADDR_CH3_V)<<(RMT_APB_MEM_RADDR_CH3_S)) +#define RMT_APB_MEM_RADDR_CH3_V 0x1FF +#define RMT_APB_MEM_RADDR_CH3_S 10 +/* RMT_APB_MEM_WADDR_CH3 : RO ;bitpos:[8:0] ;default: 9'b0 ; */ +/*description: */ +#define RMT_APB_MEM_WADDR_CH3 0x000001FF +#define RMT_APB_MEM_WADDR_CH3_M ((RMT_APB_MEM_WADDR_CH3_V)<<(RMT_APB_MEM_WADDR_CH3_S)) +#define RMT_APB_MEM_WADDR_CH3_V 0x1FF +#define RMT_APB_MEM_WADDR_CH3_S 0 + +#define RMT_INT_RAW_REG (DR_REG_RMT_BASE + 0x0050) +/* RMT_CH3_TX_LOOP_INT_RAW : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_LOOP_INT_RAW (BIT(19)) +#define RMT_CH3_TX_LOOP_INT_RAW_M (BIT(19)) +#define RMT_CH3_TX_LOOP_INT_RAW_V 0x1 +#define RMT_CH3_TX_LOOP_INT_RAW_S 19 +/* RMT_CH2_TX_LOOP_INT_RAW : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_LOOP_INT_RAW (BIT(18)) +#define RMT_CH2_TX_LOOP_INT_RAW_M (BIT(18)) +#define RMT_CH2_TX_LOOP_INT_RAW_V 0x1 +#define RMT_CH2_TX_LOOP_INT_RAW_S 18 +/* RMT_CH1_TX_LOOP_INT_RAW : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_LOOP_INT_RAW (BIT(17)) +#define RMT_CH1_TX_LOOP_INT_RAW_M (BIT(17)) +#define RMT_CH1_TX_LOOP_INT_RAW_V 0x1 +#define RMT_CH1_TX_LOOP_INT_RAW_S 17 +/* RMT_CH0_TX_LOOP_INT_RAW : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_LOOP_INT_RAW (BIT(16)) +#define RMT_CH0_TX_LOOP_INT_RAW_M (BIT(16)) +#define RMT_CH0_TX_LOOP_INT_RAW_V 0x1 +#define RMT_CH0_TX_LOOP_INT_RAW_S 16 +/* RMT_CH3_TX_THR_EVENT_INT_RAW : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_THR_EVENT_INT_RAW (BIT(15)) +#define RMT_CH3_TX_THR_EVENT_INT_RAW_M (BIT(15)) +#define RMT_CH3_TX_THR_EVENT_INT_RAW_V 0x1 +#define RMT_CH3_TX_THR_EVENT_INT_RAW_S 15 +/* RMT_CH2_TX_THR_EVENT_INT_RAW : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_THR_EVENT_INT_RAW (BIT(14)) +#define RMT_CH2_TX_THR_EVENT_INT_RAW_M (BIT(14)) +#define RMT_CH2_TX_THR_EVENT_INT_RAW_V 0x1 +#define RMT_CH2_TX_THR_EVENT_INT_RAW_S 14 +/* RMT_CH1_TX_THR_EVENT_INT_RAW : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_THR_EVENT_INT_RAW (BIT(13)) +#define RMT_CH1_TX_THR_EVENT_INT_RAW_M (BIT(13)) +#define RMT_CH1_TX_THR_EVENT_INT_RAW_V 0x1 +#define RMT_CH1_TX_THR_EVENT_INT_RAW_S 13 +/* RMT_CH0_TX_THR_EVENT_INT_RAW : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_THR_EVENT_INT_RAW (BIT(12)) +#define RMT_CH0_TX_THR_EVENT_INT_RAW_M (BIT(12)) +#define RMT_CH0_TX_THR_EVENT_INT_RAW_V 0x1 +#define RMT_CH0_TX_THR_EVENT_INT_RAW_S 12 +/* RMT_CH3_ERR_INT_RAW : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_ERR_INT_RAW (BIT(11)) +#define RMT_CH3_ERR_INT_RAW_M (BIT(11)) +#define RMT_CH3_ERR_INT_RAW_V 0x1 +#define RMT_CH3_ERR_INT_RAW_S 11 +/* RMT_CH3_RX_END_INT_RAW : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_RX_END_INT_RAW (BIT(10)) +#define RMT_CH3_RX_END_INT_RAW_M (BIT(10)) +#define RMT_CH3_RX_END_INT_RAW_V 0x1 +#define RMT_CH3_RX_END_INT_RAW_S 10 +/* RMT_CH3_TX_END_INT_RAW : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_END_INT_RAW (BIT(9)) +#define RMT_CH3_TX_END_INT_RAW_M (BIT(9)) +#define RMT_CH3_TX_END_INT_RAW_V 0x1 +#define RMT_CH3_TX_END_INT_RAW_S 9 +/* RMT_CH2_ERR_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_ERR_INT_RAW (BIT(8)) +#define RMT_CH2_ERR_INT_RAW_M (BIT(8)) +#define RMT_CH2_ERR_INT_RAW_V 0x1 +#define RMT_CH2_ERR_INT_RAW_S 8 +/* RMT_CH2_RX_END_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_RX_END_INT_RAW (BIT(7)) +#define RMT_CH2_RX_END_INT_RAW_M (BIT(7)) +#define RMT_CH2_RX_END_INT_RAW_V 0x1 +#define RMT_CH2_RX_END_INT_RAW_S 7 +/* RMT_CH2_TX_END_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_END_INT_RAW (BIT(6)) +#define RMT_CH2_TX_END_INT_RAW_M (BIT(6)) +#define RMT_CH2_TX_END_INT_RAW_V 0x1 +#define RMT_CH2_TX_END_INT_RAW_S 6 +/* RMT_CH1_ERR_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_ERR_INT_RAW (BIT(5)) +#define RMT_CH1_ERR_INT_RAW_M (BIT(5)) +#define RMT_CH1_ERR_INT_RAW_V 0x1 +#define RMT_CH1_ERR_INT_RAW_S 5 +/* RMT_CH1_RX_END_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_RX_END_INT_RAW (BIT(4)) +#define RMT_CH1_RX_END_INT_RAW_M (BIT(4)) +#define RMT_CH1_RX_END_INT_RAW_V 0x1 +#define RMT_CH1_RX_END_INT_RAW_S 4 +/* RMT_CH1_TX_END_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_END_INT_RAW (BIT(3)) +#define RMT_CH1_TX_END_INT_RAW_M (BIT(3)) +#define RMT_CH1_TX_END_INT_RAW_V 0x1 +#define RMT_CH1_TX_END_INT_RAW_S 3 +/* RMT_CH0_ERR_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_ERR_INT_RAW (BIT(2)) +#define RMT_CH0_ERR_INT_RAW_M (BIT(2)) +#define RMT_CH0_ERR_INT_RAW_V 0x1 +#define RMT_CH0_ERR_INT_RAW_S 2 +/* RMT_CH0_RX_END_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_RX_END_INT_RAW (BIT(1)) +#define RMT_CH0_RX_END_INT_RAW_M (BIT(1)) +#define RMT_CH0_RX_END_INT_RAW_V 0x1 +#define RMT_CH0_RX_END_INT_RAW_S 1 +/* RMT_CH0_TX_END_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_END_INT_RAW (BIT(0)) +#define RMT_CH0_TX_END_INT_RAW_M (BIT(0)) +#define RMT_CH0_TX_END_INT_RAW_V 0x1 +#define RMT_CH0_TX_END_INT_RAW_S 0 + +#define RMT_INT_ST_REG (DR_REG_RMT_BASE + 0x0054) +/* RMT_CH3_TX_LOOP_INT_ST : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_LOOP_INT_ST (BIT(19)) +#define RMT_CH3_TX_LOOP_INT_ST_M (BIT(19)) +#define RMT_CH3_TX_LOOP_INT_ST_V 0x1 +#define RMT_CH3_TX_LOOP_INT_ST_S 19 +/* RMT_CH2_TX_LOOP_INT_ST : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_LOOP_INT_ST (BIT(18)) +#define RMT_CH2_TX_LOOP_INT_ST_M (BIT(18)) +#define RMT_CH2_TX_LOOP_INT_ST_V 0x1 +#define RMT_CH2_TX_LOOP_INT_ST_S 18 +/* RMT_CH1_TX_LOOP_INT_ST : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_LOOP_INT_ST (BIT(17)) +#define RMT_CH1_TX_LOOP_INT_ST_M (BIT(17)) +#define RMT_CH1_TX_LOOP_INT_ST_V 0x1 +#define RMT_CH1_TX_LOOP_INT_ST_S 17 +/* RMT_CH0_TX_LOOP_INT_ST : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_LOOP_INT_ST (BIT(16)) +#define RMT_CH0_TX_LOOP_INT_ST_M (BIT(16)) +#define RMT_CH0_TX_LOOP_INT_ST_V 0x1 +#define RMT_CH0_TX_LOOP_INT_ST_S 16 +/* RMT_CH3_TX_THR_EVENT_INT_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_THR_EVENT_INT_ST (BIT(15)) +#define RMT_CH3_TX_THR_EVENT_INT_ST_M (BIT(15)) +#define RMT_CH3_TX_THR_EVENT_INT_ST_V 0x1 +#define RMT_CH3_TX_THR_EVENT_INT_ST_S 15 +/* RMT_CH2_TX_THR_EVENT_INT_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_THR_EVENT_INT_ST (BIT(14)) +#define RMT_CH2_TX_THR_EVENT_INT_ST_M (BIT(14)) +#define RMT_CH2_TX_THR_EVENT_INT_ST_V 0x1 +#define RMT_CH2_TX_THR_EVENT_INT_ST_S 14 +/* RMT_CH1_TX_THR_EVENT_INT_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_THR_EVENT_INT_ST (BIT(13)) +#define RMT_CH1_TX_THR_EVENT_INT_ST_M (BIT(13)) +#define RMT_CH1_TX_THR_EVENT_INT_ST_V 0x1 +#define RMT_CH1_TX_THR_EVENT_INT_ST_S 13 +/* RMT_CH0_TX_THR_EVENT_INT_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_THR_EVENT_INT_ST (BIT(12)) +#define RMT_CH0_TX_THR_EVENT_INT_ST_M (BIT(12)) +#define RMT_CH0_TX_THR_EVENT_INT_ST_V 0x1 +#define RMT_CH0_TX_THR_EVENT_INT_ST_S 12 +/* RMT_CH3_ERR_INT_ST : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_ERR_INT_ST (BIT(11)) +#define RMT_CH3_ERR_INT_ST_M (BIT(11)) +#define RMT_CH3_ERR_INT_ST_V 0x1 +#define RMT_CH3_ERR_INT_ST_S 11 +/* RMT_CH3_RX_END_INT_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_RX_END_INT_ST (BIT(10)) +#define RMT_CH3_RX_END_INT_ST_M (BIT(10)) +#define RMT_CH3_RX_END_INT_ST_V 0x1 +#define RMT_CH3_RX_END_INT_ST_S 10 +/* RMT_CH3_TX_END_INT_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_END_INT_ST (BIT(9)) +#define RMT_CH3_TX_END_INT_ST_M (BIT(9)) +#define RMT_CH3_TX_END_INT_ST_V 0x1 +#define RMT_CH3_TX_END_INT_ST_S 9 +/* RMT_CH2_ERR_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_ERR_INT_ST (BIT(8)) +#define RMT_CH2_ERR_INT_ST_M (BIT(8)) +#define RMT_CH2_ERR_INT_ST_V 0x1 +#define RMT_CH2_ERR_INT_ST_S 8 +/* RMT_CH2_RX_END_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_RX_END_INT_ST (BIT(7)) +#define RMT_CH2_RX_END_INT_ST_M (BIT(7)) +#define RMT_CH2_RX_END_INT_ST_V 0x1 +#define RMT_CH2_RX_END_INT_ST_S 7 +/* RMT_CH2_TX_END_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_END_INT_ST (BIT(6)) +#define RMT_CH2_TX_END_INT_ST_M (BIT(6)) +#define RMT_CH2_TX_END_INT_ST_V 0x1 +#define RMT_CH2_TX_END_INT_ST_S 6 +/* RMT_CH1_ERR_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_ERR_INT_ST (BIT(5)) +#define RMT_CH1_ERR_INT_ST_M (BIT(5)) +#define RMT_CH1_ERR_INT_ST_V 0x1 +#define RMT_CH1_ERR_INT_ST_S 5 +/* RMT_CH1_RX_END_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_RX_END_INT_ST (BIT(4)) +#define RMT_CH1_RX_END_INT_ST_M (BIT(4)) +#define RMT_CH1_RX_END_INT_ST_V 0x1 +#define RMT_CH1_RX_END_INT_ST_S 4 +/* RMT_CH1_TX_END_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_END_INT_ST (BIT(3)) +#define RMT_CH1_TX_END_INT_ST_M (BIT(3)) +#define RMT_CH1_TX_END_INT_ST_V 0x1 +#define RMT_CH1_TX_END_INT_ST_S 3 +/* RMT_CH0_ERR_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_ERR_INT_ST (BIT(2)) +#define RMT_CH0_ERR_INT_ST_M (BIT(2)) +#define RMT_CH0_ERR_INT_ST_V 0x1 +#define RMT_CH0_ERR_INT_ST_S 2 +/* RMT_CH0_RX_END_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_RX_END_INT_ST (BIT(1)) +#define RMT_CH0_RX_END_INT_ST_M (BIT(1)) +#define RMT_CH0_RX_END_INT_ST_V 0x1 +#define RMT_CH0_RX_END_INT_ST_S 1 +/* RMT_CH0_TX_END_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_END_INT_ST (BIT(0)) +#define RMT_CH0_TX_END_INT_ST_M (BIT(0)) +#define RMT_CH0_TX_END_INT_ST_V 0x1 +#define RMT_CH0_TX_END_INT_ST_S 0 + +#define RMT_INT_ENA_REG (DR_REG_RMT_BASE + 0x0058) +/* RMT_CH3_TX_LOOP_INT_ENA : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_LOOP_INT_ENA (BIT(19)) +#define RMT_CH3_TX_LOOP_INT_ENA_M (BIT(19)) +#define RMT_CH3_TX_LOOP_INT_ENA_V 0x1 +#define RMT_CH3_TX_LOOP_INT_ENA_S 19 +/* RMT_CH2_TX_LOOP_INT_ENA : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_LOOP_INT_ENA (BIT(18)) +#define RMT_CH2_TX_LOOP_INT_ENA_M (BIT(18)) +#define RMT_CH2_TX_LOOP_INT_ENA_V 0x1 +#define RMT_CH2_TX_LOOP_INT_ENA_S 18 +/* RMT_CH1_TX_LOOP_INT_ENA : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_LOOP_INT_ENA (BIT(17)) +#define RMT_CH1_TX_LOOP_INT_ENA_M (BIT(17)) +#define RMT_CH1_TX_LOOP_INT_ENA_V 0x1 +#define RMT_CH1_TX_LOOP_INT_ENA_S 17 +/* RMT_CH0_TX_LOOP_INT_ENA : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_LOOP_INT_ENA (BIT(16)) +#define RMT_CH0_TX_LOOP_INT_ENA_M (BIT(16)) +#define RMT_CH0_TX_LOOP_INT_ENA_V 0x1 +#define RMT_CH0_TX_LOOP_INT_ENA_S 16 +/* RMT_CH3_TX_THR_EVENT_INT_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_THR_EVENT_INT_ENA (BIT(15)) +#define RMT_CH3_TX_THR_EVENT_INT_ENA_M (BIT(15)) +#define RMT_CH3_TX_THR_EVENT_INT_ENA_V 0x1 +#define RMT_CH3_TX_THR_EVENT_INT_ENA_S 15 +/* RMT_CH2_TX_THR_EVENT_INT_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_THR_EVENT_INT_ENA (BIT(14)) +#define RMT_CH2_TX_THR_EVENT_INT_ENA_M (BIT(14)) +#define RMT_CH2_TX_THR_EVENT_INT_ENA_V 0x1 +#define RMT_CH2_TX_THR_EVENT_INT_ENA_S 14 +/* RMT_CH1_TX_THR_EVENT_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_THR_EVENT_INT_ENA (BIT(13)) +#define RMT_CH1_TX_THR_EVENT_INT_ENA_M (BIT(13)) +#define RMT_CH1_TX_THR_EVENT_INT_ENA_V 0x1 +#define RMT_CH1_TX_THR_EVENT_INT_ENA_S 13 +/* RMT_CH0_TX_THR_EVENT_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_THR_EVENT_INT_ENA (BIT(12)) +#define RMT_CH0_TX_THR_EVENT_INT_ENA_M (BIT(12)) +#define RMT_CH0_TX_THR_EVENT_INT_ENA_V 0x1 +#define RMT_CH0_TX_THR_EVENT_INT_ENA_S 12 +/* RMT_CH3_ERR_INT_ENA : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_ERR_INT_ENA (BIT(11)) +#define RMT_CH3_ERR_INT_ENA_M (BIT(11)) +#define RMT_CH3_ERR_INT_ENA_V 0x1 +#define RMT_CH3_ERR_INT_ENA_S 11 +/* RMT_CH3_RX_END_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_RX_END_INT_ENA (BIT(10)) +#define RMT_CH3_RX_END_INT_ENA_M (BIT(10)) +#define RMT_CH3_RX_END_INT_ENA_V 0x1 +#define RMT_CH3_RX_END_INT_ENA_S 10 +/* RMT_CH3_TX_END_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_END_INT_ENA (BIT(9)) +#define RMT_CH3_TX_END_INT_ENA_M (BIT(9)) +#define RMT_CH3_TX_END_INT_ENA_V 0x1 +#define RMT_CH3_TX_END_INT_ENA_S 9 +/* RMT_CH2_ERR_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_ERR_INT_ENA (BIT(8)) +#define RMT_CH2_ERR_INT_ENA_M (BIT(8)) +#define RMT_CH2_ERR_INT_ENA_V 0x1 +#define RMT_CH2_ERR_INT_ENA_S 8 +/* RMT_CH2_RX_END_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_RX_END_INT_ENA (BIT(7)) +#define RMT_CH2_RX_END_INT_ENA_M (BIT(7)) +#define RMT_CH2_RX_END_INT_ENA_V 0x1 +#define RMT_CH2_RX_END_INT_ENA_S 7 +/* RMT_CH2_TX_END_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_END_INT_ENA (BIT(6)) +#define RMT_CH2_TX_END_INT_ENA_M (BIT(6)) +#define RMT_CH2_TX_END_INT_ENA_V 0x1 +#define RMT_CH2_TX_END_INT_ENA_S 6 +/* RMT_CH1_ERR_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_ERR_INT_ENA (BIT(5)) +#define RMT_CH1_ERR_INT_ENA_M (BIT(5)) +#define RMT_CH1_ERR_INT_ENA_V 0x1 +#define RMT_CH1_ERR_INT_ENA_S 5 +/* RMT_CH1_RX_END_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_RX_END_INT_ENA (BIT(4)) +#define RMT_CH1_RX_END_INT_ENA_M (BIT(4)) +#define RMT_CH1_RX_END_INT_ENA_V 0x1 +#define RMT_CH1_RX_END_INT_ENA_S 4 +/* RMT_CH1_TX_END_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_END_INT_ENA (BIT(3)) +#define RMT_CH1_TX_END_INT_ENA_M (BIT(3)) +#define RMT_CH1_TX_END_INT_ENA_V 0x1 +#define RMT_CH1_TX_END_INT_ENA_S 3 +/* RMT_CH0_ERR_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_ERR_INT_ENA (BIT(2)) +#define RMT_CH0_ERR_INT_ENA_M (BIT(2)) +#define RMT_CH0_ERR_INT_ENA_V 0x1 +#define RMT_CH0_ERR_INT_ENA_S 2 +/* RMT_CH0_RX_END_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_RX_END_INT_ENA (BIT(1)) +#define RMT_CH0_RX_END_INT_ENA_M (BIT(1)) +#define RMT_CH0_RX_END_INT_ENA_V 0x1 +#define RMT_CH0_RX_END_INT_ENA_S 1 +/* RMT_CH0_TX_END_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_END_INT_ENA (BIT(0)) +#define RMT_CH0_TX_END_INT_ENA_M (BIT(0)) +#define RMT_CH0_TX_END_INT_ENA_V 0x1 +#define RMT_CH0_TX_END_INT_ENA_S 0 + +#define RMT_INT_CLR_REG (DR_REG_RMT_BASE + 0x005c) +/* RMT_CH3_TX_LOOP_INT_CLR : WO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_LOOP_INT_CLR (BIT(19)) +#define RMT_CH3_TX_LOOP_INT_CLR_M (BIT(19)) +#define RMT_CH3_TX_LOOP_INT_CLR_V 0x1 +#define RMT_CH3_TX_LOOP_INT_CLR_S 19 +/* RMT_CH2_TX_LOOP_INT_CLR : WO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_LOOP_INT_CLR (BIT(18)) +#define RMT_CH2_TX_LOOP_INT_CLR_M (BIT(18)) +#define RMT_CH2_TX_LOOP_INT_CLR_V 0x1 +#define RMT_CH2_TX_LOOP_INT_CLR_S 18 +/* RMT_CH1_TX_LOOP_INT_CLR : WO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_LOOP_INT_CLR (BIT(17)) +#define RMT_CH1_TX_LOOP_INT_CLR_M (BIT(17)) +#define RMT_CH1_TX_LOOP_INT_CLR_V 0x1 +#define RMT_CH1_TX_LOOP_INT_CLR_S 17 +/* RMT_CH0_TX_LOOP_INT_CLR : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_LOOP_INT_CLR (BIT(16)) +#define RMT_CH0_TX_LOOP_INT_CLR_M (BIT(16)) +#define RMT_CH0_TX_LOOP_INT_CLR_V 0x1 +#define RMT_CH0_TX_LOOP_INT_CLR_S 16 +/* RMT_CH3_TX_THR_EVENT_INT_CLR : WO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_THR_EVENT_INT_CLR (BIT(15)) +#define RMT_CH3_TX_THR_EVENT_INT_CLR_M (BIT(15)) +#define RMT_CH3_TX_THR_EVENT_INT_CLR_V 0x1 +#define RMT_CH3_TX_THR_EVENT_INT_CLR_S 15 +/* RMT_CH2_TX_THR_EVENT_INT_CLR : WO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_THR_EVENT_INT_CLR (BIT(14)) +#define RMT_CH2_TX_THR_EVENT_INT_CLR_M (BIT(14)) +#define RMT_CH2_TX_THR_EVENT_INT_CLR_V 0x1 +#define RMT_CH2_TX_THR_EVENT_INT_CLR_S 14 +/* RMT_CH1_TX_THR_EVENT_INT_CLR : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_THR_EVENT_INT_CLR (BIT(13)) +#define RMT_CH1_TX_THR_EVENT_INT_CLR_M (BIT(13)) +#define RMT_CH1_TX_THR_EVENT_INT_CLR_V 0x1 +#define RMT_CH1_TX_THR_EVENT_INT_CLR_S 13 +/* RMT_CH0_TX_THR_EVENT_INT_CLR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_THR_EVENT_INT_CLR (BIT(12)) +#define RMT_CH0_TX_THR_EVENT_INT_CLR_M (BIT(12)) +#define RMT_CH0_TX_THR_EVENT_INT_CLR_V 0x1 +#define RMT_CH0_TX_THR_EVENT_INT_CLR_S 12 +/* RMT_CH3_ERR_INT_CLR : WO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_ERR_INT_CLR (BIT(11)) +#define RMT_CH3_ERR_INT_CLR_M (BIT(11)) +#define RMT_CH3_ERR_INT_CLR_V 0x1 +#define RMT_CH3_ERR_INT_CLR_S 11 +/* RMT_CH3_RX_END_INT_CLR : WO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_RX_END_INT_CLR (BIT(10)) +#define RMT_CH3_RX_END_INT_CLR_M (BIT(10)) +#define RMT_CH3_RX_END_INT_CLR_V 0x1 +#define RMT_CH3_RX_END_INT_CLR_S 10 +/* RMT_CH3_TX_END_INT_CLR : WO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH3_TX_END_INT_CLR (BIT(9)) +#define RMT_CH3_TX_END_INT_CLR_M (BIT(9)) +#define RMT_CH3_TX_END_INT_CLR_V 0x1 +#define RMT_CH3_TX_END_INT_CLR_S 9 +/* RMT_CH2_ERR_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_ERR_INT_CLR (BIT(8)) +#define RMT_CH2_ERR_INT_CLR_M (BIT(8)) +#define RMT_CH2_ERR_INT_CLR_V 0x1 +#define RMT_CH2_ERR_INT_CLR_S 8 +/* RMT_CH2_RX_END_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_RX_END_INT_CLR (BIT(7)) +#define RMT_CH2_RX_END_INT_CLR_M (BIT(7)) +#define RMT_CH2_RX_END_INT_CLR_V 0x1 +#define RMT_CH2_RX_END_INT_CLR_S 7 +/* RMT_CH2_TX_END_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH2_TX_END_INT_CLR (BIT(6)) +#define RMT_CH2_TX_END_INT_CLR_M (BIT(6)) +#define RMT_CH2_TX_END_INT_CLR_V 0x1 +#define RMT_CH2_TX_END_INT_CLR_S 6 +/* RMT_CH1_ERR_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_ERR_INT_CLR (BIT(5)) +#define RMT_CH1_ERR_INT_CLR_M (BIT(5)) +#define RMT_CH1_ERR_INT_CLR_V 0x1 +#define RMT_CH1_ERR_INT_CLR_S 5 +/* RMT_CH1_RX_END_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_RX_END_INT_CLR (BIT(4)) +#define RMT_CH1_RX_END_INT_CLR_M (BIT(4)) +#define RMT_CH1_RX_END_INT_CLR_V 0x1 +#define RMT_CH1_RX_END_INT_CLR_S 4 +/* RMT_CH1_TX_END_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH1_TX_END_INT_CLR (BIT(3)) +#define RMT_CH1_TX_END_INT_CLR_M (BIT(3)) +#define RMT_CH1_TX_END_INT_CLR_V 0x1 +#define RMT_CH1_TX_END_INT_CLR_S 3 +/* RMT_CH0_ERR_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_ERR_INT_CLR (BIT(2)) +#define RMT_CH0_ERR_INT_CLR_M (BIT(2)) +#define RMT_CH0_ERR_INT_CLR_V 0x1 +#define RMT_CH0_ERR_INT_CLR_S 2 +/* RMT_CH0_RX_END_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_RX_END_INT_CLR (BIT(1)) +#define RMT_CH0_RX_END_INT_CLR_M (BIT(1)) +#define RMT_CH0_RX_END_INT_CLR_V 0x1 +#define RMT_CH0_RX_END_INT_CLR_S 1 +/* RMT_CH0_TX_END_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define RMT_CH0_TX_END_INT_CLR (BIT(0)) +#define RMT_CH0_TX_END_INT_CLR_M (BIT(0)) +#define RMT_CH0_TX_END_INT_CLR_V 0x1 +#define RMT_CH0_TX_END_INT_CLR_S 0 + +#define RMT_CH0CARRIER_DUTY_REG (DR_REG_RMT_BASE + 0x0060) +/* RMT_CARRIER_HIGH_CH0 : R/W ;bitpos:[31:16] ;default: 16'h40 ; */ +/*description: */ +#define RMT_CARRIER_HIGH_CH0 0x0000FFFF +#define RMT_CARRIER_HIGH_CH0_M ((RMT_CARRIER_HIGH_CH0_V)<<(RMT_CARRIER_HIGH_CH0_S)) +#define RMT_CARRIER_HIGH_CH0_V 0xFFFF +#define RMT_CARRIER_HIGH_CH0_S 16 +/* RMT_CARRIER_LOW_CH0 : R/W ;bitpos:[15:0] ;default: 16'h40 ; */ +/*description: */ +#define RMT_CARRIER_LOW_CH0 0x0000FFFF +#define RMT_CARRIER_LOW_CH0_M ((RMT_CARRIER_LOW_CH0_V)<<(RMT_CARRIER_LOW_CH0_S)) +#define RMT_CARRIER_LOW_CH0_V 0xFFFF +#define RMT_CARRIER_LOW_CH0_S 0 + +#define RMT_CH1CARRIER_DUTY_REG (DR_REG_RMT_BASE + 0x0064) +/* RMT_CARRIER_HIGH_CH1 : R/W ;bitpos:[31:16] ;default: 16'h40 ; */ +/*description: */ +#define RMT_CARRIER_HIGH_CH1 0x0000FFFF +#define RMT_CARRIER_HIGH_CH1_M ((RMT_CARRIER_HIGH_CH1_V)<<(RMT_CARRIER_HIGH_CH1_S)) +#define RMT_CARRIER_HIGH_CH1_V 0xFFFF +#define RMT_CARRIER_HIGH_CH1_S 16 +/* RMT_CARRIER_LOW_CH1 : R/W ;bitpos:[15:0] ;default: 16'h40 ; */ +/*description: */ +#define RMT_CARRIER_LOW_CH1 0x0000FFFF +#define RMT_CARRIER_LOW_CH1_M ((RMT_CARRIER_LOW_CH1_V)<<(RMT_CARRIER_LOW_CH1_S)) +#define RMT_CARRIER_LOW_CH1_V 0xFFFF +#define RMT_CARRIER_LOW_CH1_S 0 + +#define RMT_CH2CARRIER_DUTY_REG (DR_REG_RMT_BASE + 0x0068) +/* RMT_CARRIER_HIGH_CH2 : R/W ;bitpos:[31:16] ;default: 16'h40 ; */ +/*description: */ +#define RMT_CARRIER_HIGH_CH2 0x0000FFFF +#define RMT_CARRIER_HIGH_CH2_M ((RMT_CARRIER_HIGH_CH2_V)<<(RMT_CARRIER_HIGH_CH2_S)) +#define RMT_CARRIER_HIGH_CH2_V 0xFFFF +#define RMT_CARRIER_HIGH_CH2_S 16 +/* RMT_CARRIER_LOW_CH2 : R/W ;bitpos:[15:0] ;default: 16'h40 ; */ +/*description: */ +#define RMT_CARRIER_LOW_CH2 0x0000FFFF +#define RMT_CARRIER_LOW_CH2_M ((RMT_CARRIER_LOW_CH2_V)<<(RMT_CARRIER_LOW_CH2_S)) +#define RMT_CARRIER_LOW_CH2_V 0xFFFF +#define RMT_CARRIER_LOW_CH2_S 0 + +#define RMT_CH3CARRIER_DUTY_REG (DR_REG_RMT_BASE + 0x006c) +/* RMT_CARRIER_HIGH_CH3 : R/W ;bitpos:[31:16] ;default: 16'h40 ; */ +/*description: */ +#define RMT_CARRIER_HIGH_CH3 0x0000FFFF +#define RMT_CARRIER_HIGH_CH3_M ((RMT_CARRIER_HIGH_CH3_V)<<(RMT_CARRIER_HIGH_CH3_S)) +#define RMT_CARRIER_HIGH_CH3_V 0xFFFF +#define RMT_CARRIER_HIGH_CH3_S 16 +/* RMT_CARRIER_LOW_CH3 : R/W ;bitpos:[15:0] ;default: 16'h40 ; */ +/*description: */ +#define RMT_CARRIER_LOW_CH3 0x0000FFFF +#define RMT_CARRIER_LOW_CH3_M ((RMT_CARRIER_LOW_CH3_V)<<(RMT_CARRIER_LOW_CH3_S)) +#define RMT_CARRIER_LOW_CH3_V 0xFFFF +#define RMT_CARRIER_LOW_CH3_S 0 + +#define RMT_CH0_TX_LIM_REG (DR_REG_RMT_BASE + 0x0070) +/* RMT_LOOP_COUNT_RESET_CH0 : WO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define RMT_LOOP_COUNT_RESET_CH0 (BIT(20)) +#define RMT_LOOP_COUNT_RESET_CH0_M (BIT(20)) +#define RMT_LOOP_COUNT_RESET_CH0_V 0x1 +#define RMT_LOOP_COUNT_RESET_CH0_S 20 +/* RMT_TX_LOOP_CNT_EN_CH0 : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_LOOP_CNT_EN_CH0 (BIT(19)) +#define RMT_TX_LOOP_CNT_EN_CH0_M (BIT(19)) +#define RMT_TX_LOOP_CNT_EN_CH0_V 0x1 +#define RMT_TX_LOOP_CNT_EN_CH0_S 19 +/* RMT_TX_LOOP_NUM_CH0 : R/W ;bitpos:[18:9] ;default: 10'b0 ; */ +/*description: */ +#define RMT_TX_LOOP_NUM_CH0 0x000003FF +#define RMT_TX_LOOP_NUM_CH0_M ((RMT_TX_LOOP_NUM_CH0_V)<<(RMT_TX_LOOP_NUM_CH0_S)) +#define RMT_TX_LOOP_NUM_CH0_V 0x3FF +#define RMT_TX_LOOP_NUM_CH0_S 9 +/* RMT_TX_LIM_CH0 : R/W ;bitpos:[8:0] ;default: 9'h80 ; */ +/*description: */ +#define RMT_TX_LIM_CH0 0x000001FF +#define RMT_TX_LIM_CH0_M ((RMT_TX_LIM_CH0_V)<<(RMT_TX_LIM_CH0_S)) +#define RMT_TX_LIM_CH0_V 0x1FF +#define RMT_TX_LIM_CH0_S 0 + +#define RMT_CH1_TX_LIM_REG (DR_REG_RMT_BASE + 0x0074) +/* RMT_LOOP_COUNT_RESET_CH1 : WO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define RMT_LOOP_COUNT_RESET_CH1 (BIT(20)) +#define RMT_LOOP_COUNT_RESET_CH1_M (BIT(20)) +#define RMT_LOOP_COUNT_RESET_CH1_V 0x1 +#define RMT_LOOP_COUNT_RESET_CH1_S 20 +/* RMT_TX_LOOP_CNT_EN_CH1 : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_LOOP_CNT_EN_CH1 (BIT(19)) +#define RMT_TX_LOOP_CNT_EN_CH1_M (BIT(19)) +#define RMT_TX_LOOP_CNT_EN_CH1_V 0x1 +#define RMT_TX_LOOP_CNT_EN_CH1_S 19 +/* RMT_TX_LOOP_NUM_CH1 : R/W ;bitpos:[18:9] ;default: 10'b0 ; */ +/*description: */ +#define RMT_TX_LOOP_NUM_CH1 0x000003FF +#define RMT_TX_LOOP_NUM_CH1_M ((RMT_TX_LOOP_NUM_CH1_V)<<(RMT_TX_LOOP_NUM_CH1_S)) +#define RMT_TX_LOOP_NUM_CH1_V 0x3FF +#define RMT_TX_LOOP_NUM_CH1_S 9 +/* RMT_TX_LIM_CH1 : R/W ;bitpos:[8:0] ;default: 9'h80 ; */ +/*description: */ +#define RMT_TX_LIM_CH1 0x000001FF +#define RMT_TX_LIM_CH1_M ((RMT_TX_LIM_CH1_V)<<(RMT_TX_LIM_CH1_S)) +#define RMT_TX_LIM_CH1_V 0x1FF +#define RMT_TX_LIM_CH1_S 0 + +#define RMT_CH2_TX_LIM_REG (DR_REG_RMT_BASE + 0x0078) +/* RMT_LOOP_COUNT_RESET_CH2 : WO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define RMT_LOOP_COUNT_RESET_CH2 (BIT(20)) +#define RMT_LOOP_COUNT_RESET_CH2_M (BIT(20)) +#define RMT_LOOP_COUNT_RESET_CH2_V 0x1 +#define RMT_LOOP_COUNT_RESET_CH2_S 20 +/* RMT_TX_LOOP_CNT_EN_CH2 : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_LOOP_CNT_EN_CH2 (BIT(19)) +#define RMT_TX_LOOP_CNT_EN_CH2_M (BIT(19)) +#define RMT_TX_LOOP_CNT_EN_CH2_V 0x1 +#define RMT_TX_LOOP_CNT_EN_CH2_S 19 +/* RMT_TX_LOOP_NUM_CH2 : R/W ;bitpos:[18:9] ;default: 10'b0 ; */ +/*description: */ +#define RMT_TX_LOOP_NUM_CH2 0x000003FF +#define RMT_TX_LOOP_NUM_CH2_M ((RMT_TX_LOOP_NUM_CH2_V)<<(RMT_TX_LOOP_NUM_CH2_S)) +#define RMT_TX_LOOP_NUM_CH2_V 0x3FF +#define RMT_TX_LOOP_NUM_CH2_S 9 +/* RMT_TX_LIM_CH2 : R/W ;bitpos:[8:0] ;default: 9'h80 ; */ +/*description: */ +#define RMT_TX_LIM_CH2 0x000001FF +#define RMT_TX_LIM_CH2_M ((RMT_TX_LIM_CH2_V)<<(RMT_TX_LIM_CH2_S)) +#define RMT_TX_LIM_CH2_V 0x1FF +#define RMT_TX_LIM_CH2_S 0 + +#define RMT_CH3_TX_LIM_REG (DR_REG_RMT_BASE + 0x007c) +/* RMT_LOOP_COUNT_RESET_CH3 : WO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define RMT_LOOP_COUNT_RESET_CH3 (BIT(20)) +#define RMT_LOOP_COUNT_RESET_CH3_M (BIT(20)) +#define RMT_LOOP_COUNT_RESET_CH3_V 0x1 +#define RMT_LOOP_COUNT_RESET_CH3_S 20 +/* RMT_TX_LOOP_CNT_EN_CH3 : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_LOOP_CNT_EN_CH3 (BIT(19)) +#define RMT_TX_LOOP_CNT_EN_CH3_M (BIT(19)) +#define RMT_TX_LOOP_CNT_EN_CH3_V 0x1 +#define RMT_TX_LOOP_CNT_EN_CH3_S 19 +/* RMT_TX_LOOP_NUM_CH3 : R/W ;bitpos:[18:9] ;default: 10'b0 ; */ +/*description: */ +#define RMT_TX_LOOP_NUM_CH3 0x000003FF +#define RMT_TX_LOOP_NUM_CH3_M ((RMT_TX_LOOP_NUM_CH3_V)<<(RMT_TX_LOOP_NUM_CH3_S)) +#define RMT_TX_LOOP_NUM_CH3_V 0x3FF +#define RMT_TX_LOOP_NUM_CH3_S 9 +/* RMT_TX_LIM_CH3 : R/W ;bitpos:[8:0] ;default: 9'h80 ; */ +/*description: */ +#define RMT_TX_LIM_CH3 0x000001FF +#define RMT_TX_LIM_CH3_M ((RMT_TX_LIM_CH3_V)<<(RMT_TX_LIM_CH3_S)) +#define RMT_TX_LIM_CH3_V 0x1FF +#define RMT_TX_LIM_CH3_S 0 + +#define RMT_APB_CONF_REG (DR_REG_RMT_BASE + 0x0080) +/* RMT_MEM_TX_WRAP_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define RMT_MEM_TX_WRAP_EN (BIT(1)) +#define RMT_MEM_TX_WRAP_EN_M (BIT(1)) +#define RMT_MEM_TX_WRAP_EN_V 0x1 +#define RMT_MEM_TX_WRAP_EN_S 1 +/* RMT_APB_FIFO_MASK : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define RMT_APB_FIFO_MASK (BIT(0)) +#define RMT_APB_FIFO_MASK_M (BIT(0)) +#define RMT_APB_FIFO_MASK_V 0x1 +#define RMT_APB_FIFO_MASK_S 0 + +#define RMT_TX_SIM_REG (DR_REG_RMT_BASE + 0x0084) +/* RMT_TX_SIM_EN : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_SIM_EN (BIT(4)) +#define RMT_TX_SIM_EN_M (BIT(4)) +#define RMT_TX_SIM_EN_V 0x1 +#define RMT_TX_SIM_EN_S 4 +/* RMT_TX_SIM_CH3 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_SIM_CH3 (BIT(3)) +#define RMT_TX_SIM_CH3_M (BIT(3)) +#define RMT_TX_SIM_CH3_V 0x1 +#define RMT_TX_SIM_CH3_S 3 +/* RMT_TX_SIM_CH2 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_SIM_CH2 (BIT(2)) +#define RMT_TX_SIM_CH2_M (BIT(2)) +#define RMT_TX_SIM_CH2_V 0x1 +#define RMT_TX_SIM_CH2_S 2 +/* RMT_TX_SIM_CH1 : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_SIM_CH1 (BIT(1)) +#define RMT_TX_SIM_CH1_M (BIT(1)) +#define RMT_TX_SIM_CH1_V 0x1 +#define RMT_TX_SIM_CH1_S 1 +/* RMT_TX_SIM_CH0 : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define RMT_TX_SIM_CH0 (BIT(0)) +#define RMT_TX_SIM_CH0_M (BIT(0)) +#define RMT_TX_SIM_CH0_V 0x1 +#define RMT_TX_SIM_CH0_S 0 + +#define RMT_REF_CNT_RST_REG (DR_REG_RMT_BASE + 0x0088) +/* RMT_REF_CNT_RST_CH3 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RMT_REF_CNT_RST_CH3 (BIT(3)) +#define RMT_REF_CNT_RST_CH3_M (BIT(3)) +#define RMT_REF_CNT_RST_CH3_V 0x1 +#define RMT_REF_CNT_RST_CH3_S 3 +/* RMT_REF_CNT_RST_CH2 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define RMT_REF_CNT_RST_CH2 (BIT(2)) +#define RMT_REF_CNT_RST_CH2_M (BIT(2)) +#define RMT_REF_CNT_RST_CH2_V 0x1 +#define RMT_REF_CNT_RST_CH2_S 2 +/* RMT_REF_CNT_RST_CH1 : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define RMT_REF_CNT_RST_CH1 (BIT(1)) +#define RMT_REF_CNT_RST_CH1_M (BIT(1)) +#define RMT_REF_CNT_RST_CH1_V 0x1 +#define RMT_REF_CNT_RST_CH1_S 1 +/* RMT_REF_CNT_RST_CH0 : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define RMT_REF_CNT_RST_CH0 (BIT(0)) +#define RMT_REF_CNT_RST_CH0_M (BIT(0)) +#define RMT_REF_CNT_RST_CH0_V 0x1 +#define RMT_REF_CNT_RST_CH0_S 0 + +#define RMT_DATE_REG (DR_REG_RMT_BASE + 0x0fc) +/* RMT_DATE : R/W ;bitpos:[31:0] ;default: 32'h18072600 ; */ +/*description: */ +#define RMT_DATE 0xFFFFFFFF +#define RMT_DATE_M ((RMT_DATE_V)<<(RMT_DATE_S)) +#define RMT_DATE_V 0xFFFFFFFF +#define RMT_DATE_S 0 + +#ifdef __cplusplus +} +#endif +#define RMT_CHANNEL_MEM(i) (DR_REG_RMT_BASE + 0x400 + 64 * 4 * (i)) + + +#endif /*_SOC_RMT_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/rmt_struct.h b/components/soc/esp32s2beta/include/soc/rmt_struct.h new file mode 100644 index 0000000000..75418b1ba6 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/rmt_struct.h @@ -0,0 +1,301 @@ +// Copyright 2017-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. +#ifndef _SOC_RMT_STRUCT_H_ +#define _SOC_RMT_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + uint32_t data_ch[4]; /**/ + struct { + union { + struct { + uint32_t div_cnt: 8; + uint32_t idle_thres: 16; + uint32_t mem_size: 3; + uint32_t reserved27: 1; + uint32_t carrier_en: 1; + uint32_t carrier_out_lv: 1; + uint32_t mem_pd: 1; + uint32_t clk_en: 1; + }; + uint32_t val; + } conf0; + union { + struct { + uint32_t tx_start: 1; + uint32_t rx_en: 1; + uint32_t mem_wr_rst: 1; + uint32_t mem_rd_rst: 1; + uint32_t apb_mem_rst: 1; + uint32_t mem_owner: 1; + uint32_t tx_conti_mode: 1; + uint32_t rx_filter_en: 1; + uint32_t rx_filter_thres: 8; + uint32_t reserved16: 1; + uint32_t ref_always_on: 1; + uint32_t idle_out_lv: 1; + uint32_t idle_out_en: 1; + uint32_t tx_stop: 1; + uint32_t reserved21: 11; + }; + uint32_t val; + } conf1; + } conf_ch[4]; + union { + struct { + uint32_t mem_waddr_ex: 9; + uint32_t reserved9: 1; + uint32_t mem_raddr_ex: 9; + uint32_t reserved19: 1; + uint32_t state: 3; + uint32_t mem_owner_err: 1; + uint32_t mem_full: 1; + uint32_t mem_empty: 1; + uint32_t apb_mem_wr_err: 1; + uint32_t apb_mem_rd_err: 1; + uint32_t reserved28: 4; + }; + uint32_t val; + } status_ch[4]; + union { + struct { + uint32_t waddr: 9; + uint32_t reserved9: 1; + uint32_t raddr: 9; + uint32_t reserved19: 13; + }; + uint32_t val; + } apb_mem_addr_ch[4]; + union { + struct { + uint32_t ch0_tx_end: 1; + uint32_t ch0_rx_end: 1; + uint32_t ch0_err: 1; + uint32_t ch1_tx_end: 1; + uint32_t ch1_rx_end: 1; + uint32_t ch1_err: 1; + uint32_t ch2_tx_end: 1; + uint32_t ch2_rx_end: 1; + uint32_t ch2_err: 1; + uint32_t ch3_tx_end: 1; + uint32_t ch3_rx_end: 1; + uint32_t ch3_err: 1; + uint32_t ch0_tx_thr_event: 1; + uint32_t ch1_tx_thr_event: 1; + uint32_t ch2_tx_thr_event: 1; + uint32_t ch3_tx_thr_event: 1; + uint32_t ch0_tx_loop: 1; + uint32_t ch1_tx_loop: 1; + uint32_t ch2_tx_loop: 1; + uint32_t ch3_tx_loop: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t ch0_tx_end: 1; + uint32_t ch0_rx_end: 1; + uint32_t ch0_err: 1; + uint32_t ch1_tx_end: 1; + uint32_t ch1_rx_end: 1; + uint32_t ch1_err: 1; + uint32_t ch2_tx_end: 1; + uint32_t ch2_rx_end: 1; + uint32_t ch2_err: 1; + uint32_t ch3_tx_end: 1; + uint32_t ch3_rx_end: 1; + uint32_t ch3_err: 1; + uint32_t ch0_tx_thr_event: 1; + uint32_t ch1_tx_thr_event: 1; + uint32_t ch2_tx_thr_event: 1; + uint32_t ch3_tx_thr_event: 1; + uint32_t ch0_tx_loop: 1; + uint32_t ch1_tx_loop: 1; + uint32_t ch2_tx_loop: 1; + uint32_t ch3_tx_loop: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_st; + union { + struct { + uint32_t ch0_tx_end: 1; + uint32_t ch0_rx_end: 1; + uint32_t ch0_err: 1; + uint32_t ch1_tx_end: 1; + uint32_t ch1_rx_end: 1; + uint32_t ch1_err: 1; + uint32_t ch2_tx_end: 1; + uint32_t ch2_rx_end: 1; + uint32_t ch2_err: 1; + uint32_t ch3_tx_end: 1; + uint32_t ch3_rx_end: 1; + uint32_t ch3_err: 1; + uint32_t ch0_tx_thr_event: 1; + uint32_t ch1_tx_thr_event: 1; + uint32_t ch2_tx_thr_event: 1; + uint32_t ch3_tx_thr_event: 1; + uint32_t ch0_tx_loop: 1; + uint32_t ch1_tx_loop: 1; + uint32_t ch2_tx_loop: 1; + uint32_t ch3_tx_loop: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t ch0_tx_end: 1; + uint32_t ch0_rx_end: 1; + uint32_t ch0_err: 1; + uint32_t ch1_tx_end: 1; + uint32_t ch1_rx_end: 1; + uint32_t ch1_err: 1; + uint32_t ch2_tx_end: 1; + uint32_t ch2_rx_end: 1; + uint32_t ch2_err: 1; + uint32_t ch3_tx_end: 1; + uint32_t ch3_rx_end: 1; + uint32_t ch3_err: 1; + uint32_t ch0_tx_thr_event: 1; + uint32_t ch1_tx_thr_event: 1; + uint32_t ch2_tx_thr_event: 1; + uint32_t ch3_tx_thr_event: 1; + uint32_t ch0_tx_loop: 1; + uint32_t ch1_tx_loop: 1; + uint32_t ch2_tx_loop: 1; + uint32_t ch3_tx_loop: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_clr; + union { + struct { + uint32_t low: 16; + uint32_t high: 16; + }; + uint32_t val; + } carrier_duty_ch[4]; + union { + struct { + uint32_t limit: 9; + uint32_t tx_loop_num: 10; + uint32_t tx_loop_cnt_en: 1; + uint32_t loop_count_reset: 1; + uint32_t reserved21: 11; + }; + uint32_t val; + } tx_lim_ch[4]; + union { + struct { + uint32_t fifo_mask: 1; + uint32_t mem_tx_wrap_en: 1; + uint32_t reserved2: 30; + }; + uint32_t val; + } apb_conf; + union { + struct { + uint32_t ch0: 1; + uint32_t ch1: 1; + uint32_t ch2: 1; + uint32_t ch3: 1; + uint32_t en: 1; + uint32_t reserved5: 27; + }; + uint32_t val; + } tx_sim; + union { + struct { + uint32_t ch0: 1; + uint32_t ch1: 1; + uint32_t ch2: 1; + uint32_t ch3: 1; + uint32_t reserved4: 28; + }; + uint32_t val; + } ref_cnt_rst; + uint32_t reserved_8c; + uint32_t reserved_90; + uint32_t reserved_94; + uint32_t reserved_98; + uint32_t reserved_9c; + uint32_t reserved_a0; + uint32_t reserved_a4; + uint32_t reserved_a8; + uint32_t reserved_ac; + uint32_t reserved_b0; + uint32_t reserved_b4; + uint32_t reserved_b8; + uint32_t reserved_bc; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t date; /**/ +} rmt_dev_t; +extern rmt_dev_t RMT; + +typedef struct { + union { + struct { + uint32_t duration0 :15; + uint32_t level0 :1; + uint32_t duration1 :15; + uint32_t level1 :1; + }; + uint32_t val; + }; +} rmt_item32_t; + +typedef struct { + union { + struct { + uint16_t duration :15; + uint16_t level :1; + }; + uint16_t val; + }; +} rmt_item16_t; + +//Allow access to RMT memory using RMTMEM.chan[0].data32[8] +typedef volatile struct { + struct { + union { + rmt_item32_t data32[64]; + rmt_item16_t data16[128]; + }; + } chan[4]; +} rmt_mem_t; +extern rmt_mem_t RMTMEM; + +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_RMT_STRUCT_H_ */ \ No newline at end of file diff --git a/components/soc/esp32s2beta/include/soc/rtc.h b/components/soc/esp32s2beta/include/soc/rtc.h new file mode 100644 index 0000000000..c8e7136967 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/rtc.h @@ -0,0 +1,669 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#pragma once + +#include +#include +#include +#include "soc/soc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file rtc.h + * @brief Low-level RTC power, clock, and sleep functions. + * + * Functions in this file facilitate configuration of ESP32's RTC_CNTL peripheral. + * RTC_CNTL peripheral handles many functions: + * - enables/disables clocks and power to various parts of the chip; this is + * done using direct register access (forcing power up or power down) or by + * allowing state machines to control power and clocks automatically + * - handles sleep and wakeup functions + * - maintains a 48-bit counter which can be used for timekeeping + * + * These functions are not thread safe, and should not be viewed as high level + * APIs. For example, while this file provides a function which can switch + * CPU frequency, this function is on its own is not sufficient to implement + * frequency switching in ESP-IDF context: some coordination with RTOS, + * peripheral drivers, and WiFi/BT stacks is also required. + * + * These functions will normally not be used in applications directly. + * ESP-IDF provides, or will provide, drivers and other facilities to use + * RTC subsystem functionality. + * + * The functions are loosely split into the following groups: + * - rtc_clk: clock switching, calibration + * - rtc_time: reading RTC counter, conversion between counter values and time + * - rtc_sleep: entry into sleep modes + * - rtc_init: initialization + */ + + +/** + * @brief Possible main XTAL frequency values. + * + * Enum values should be equal to frequency in MHz. + */ +typedef enum { + RTC_XTAL_FREQ_AUTO = 0, //!< Automatic XTAL frequency detection + RTC_XTAL_FREQ_40M = 40, //!< 40 MHz XTAL + RTC_XTAL_FREQ_26M = 26, //!< 26 MHz XTAL + RTC_XTAL_FREQ_24M = 24, //!< 24 MHz XTAL +} rtc_xtal_freq_t; + +/** + * @brief CPU frequency values + */ +typedef enum { + RTC_CPU_FREQ_XTAL = 0, //!< Main XTAL frequency + RTC_CPU_FREQ_80M = 1, //!< 80 MHz + RTC_CPU_FREQ_160M = 2, //!< 160 MHz + RTC_CPU_FREQ_240M = 3, //!< 240 MHz + RTC_CPU_FREQ_2M = 4, //!< 2 MHz + RTC_CPU_320M_80M = 5, //!< for test + RTC_CPU_320M_160M = 6, //!< for test +} rtc_cpu_freq_t; + +/** + * @brief RTC SLOW_CLK frequency values + */ +typedef enum { + RTC_SLOW_FREQ_RTC = 0, //!< Internal 150 kHz RC oscillator + RTC_SLOW_FREQ_32K_XTAL = 1, //!< External 32 kHz XTAL + RTC_SLOW_FREQ_8MD256 = 2, //!< Internal 8 MHz RC oscillator, divided by 256 +} rtc_slow_freq_t; + +/** + * @brief RTC FAST_CLK frequency values + */ +typedef enum { + RTC_FAST_FREQ_XTALD4 = 0, //!< Main XTAL, divided by 4 + RTC_FAST_FREQ_8M = 1, //!< Internal 8 MHz RC oscillator +} rtc_fast_freq_t; + +/* With the default value of CK8M_DFREQ, 8M clock frequency is 8.5 MHz +/- 7% */ +#define RTC_FAST_CLK_FREQ_APPROX 8500000 + +/** + * @brief Clock source to be calibrated using rtc_clk_cal function + */ +typedef enum { + RTC_CAL_RTC_MUX = 0, //!< Currently selected RTC SLOW_CLK + RTC_CAL_8MD256 = 1, //!< Internal 8 MHz RC oscillator, divided by 256 + RTC_CAL_32K_XTAL = 2 //!< External 32 kHz XTAL +} rtc_cal_sel_t; + +/** + * Initialization parameters for rtc_clk_init + */ +typedef struct { + rtc_xtal_freq_t xtal_freq : 8; //!< Main XTAL frequency + rtc_cpu_freq_t cpu_freq : 3; //!< CPU frequency to set + rtc_fast_freq_t fast_freq : 1; //!< RTC_FAST_CLK frequency to set + rtc_slow_freq_t slow_freq : 2; //!< RTC_SLOW_CLK frequency to set + uint32_t clk_rtc_clk_div : 8; + uint32_t clk_8m_clk_div : 3; //!< RTC 8M clock divider (division is by clk_8m_div+1, i.e. 0 means 8MHz frequency) + uint32_t slow_clk_dcap : 8; //!< RTC 150k clock adjustment parameter (higher value leads to lower frequency) + uint32_t clk_8m_dfreq : 8; //!< RTC 8m clock adjustment parameter (higher value leads to higher frequency) +} rtc_clk_config_t; + +/** + * Default initializer for rtc_clk_config_t + */ +#define RTC_CLK_CONFIG_DEFAULT() { \ + .xtal_freq = RTC_XTAL_FREQ_AUTO, \ + .cpu_freq = RTC_CPU_FREQ_80M, \ + .fast_freq = RTC_FAST_FREQ_8M, \ + .slow_freq = RTC_SLOW_FREQ_RTC, \ + .clk_rtc_clk_div = 0, \ + .clk_8m_clk_div = 0, \ + .slow_clk_dcap = RTC_CNTL_SCK_DCAP_DEFAULT, \ + .clk_8m_dfreq = RTC_CNTL_CK8M_DFREQ_DEFAULT, \ +} + +void rtc_clk_divider_set(uint32_t div); + +void rtc_clk_8m_divider_set(uint32_t div); + +/** + * Initialize clocks and set CPU frequency + * + * If cfg.xtal_freq is set to RTC_XTAL_FREQ_AUTO, this function will attempt + * to auto detect XTAL frequency. Auto detection is performed by comparing + * XTAL frequency with the frequency of internal 8MHz oscillator. Note that at + * high temperatures the frequency of the internal 8MHz oscillator may drift + * enough for auto detection to be unreliable. + * Auto detection code will attempt to distinguish between 26MHz and 40MHz + * crystals. 24 MHz crystals are not supported by auto detection code. + * If XTAL frequency can not be auto detected, this 26MHz frequency will be used. + * + * @param cfg clock configuration as rtc_clk_config_t + */ +void rtc_clk_init(rtc_clk_config_t cfg); + +/** + * @brief Get main XTAL frequency + * + * This is the value stored in RTC register RTC_XTAL_FREQ_REG by the bootloader. As passed to + * rtc_clk_init function, or if the value was RTC_XTAL_FREQ_AUTO, the detected + * XTAL frequency. + * + * @return XTAL frequency, one of rtc_xtal_freq_t + */ +rtc_xtal_freq_t rtc_clk_xtal_freq_get(void); + +/** + * @brief Update XTAL frequency + * + * Updates the XTAL value stored in RTC_XTAL_FREQ_REG. Usually this value is ignored + * after startup. + * + * @param xtal_freq New frequency value + */ +void rtc_clk_xtal_freq_update(rtc_xtal_freq_t xtal_freq); + +/** + * @brief Enable or disable 32 kHz XTAL oscillator + * @param en true to enable, false to disable + */ +void rtc_clk_32k_enable(bool en); + +/** + * @brief Get the state of 32k XTAL oscillator + * @return true if 32k XTAL oscillator has been enabled + */ +bool rtc_clk_32k_enabled(void); + +/** + * @brief Enable 32k oscillator, configuring it for fast startup time. + * Note: to achieve higher frequency stability, rtc_clk_32k_enable function + * must be called one the 32k XTAL oscillator has started up. This function + * will initially disable the 32k XTAL oscillator, so it should not be called + * when the system is using 32k XTAL as RTC_SLOW_CLK. + * + * @param cycle Number of 32kHz cycles to bootstrap external crystal. + * If 0, no square wave will be used to bootstrap crystal oscillation. + */ +void rtc_clk_32k_bootstrap(uint32_t cycle); + +/** + * @brief Enable or disable 8 MHz internal oscillator + * + * Output from 8 MHz internal oscillator is passed into a configurable + * divider, which by default divides the input clock frequency by 256. + * Output of the divider may be used as RTC_SLOW_CLK source. + * Output of the divider is referred to in register descriptions and code as + * 8md256 or simply d256. Divider values other than 256 may be configured, but + * this facility is not currently needed, so is not exposed in the code. + * + * When 8MHz/256 divided output is not needed, the divider should be disabled + * to reduce power consumption. + * + * @param clk_8m_en true to enable 8MHz generator + * @param d256_en true to enable /256 divider + */ +void rtc_clk_8m_enable(bool clk_8m_en, bool d256_en); + +/** + * @brief Get the state of 8 MHz internal oscillator + * @return true if the oscillator is enabled + */ +bool rtc_clk_8m_enabled(void); + +/** + * @brief Get the state of /256 divider which is applied to 8MHz clock + * @return true if the divided output is enabled + */ +bool rtc_clk_8md256_enabled(void); + +/** + * @brief Enable or disable APLL + * + * Output frequency is given by the formula: + * apll_freq = xtal_freq * (4 + sdm2 + sdm1/256 + sdm0/65536)/((o_div + 2) * 2) + * + * The dividend in this expression should be in the range of 240 - 600 MHz. + * + * In rev. 0 of ESP32, sdm0 and sdm1 are unused and always set to 0. + * + * @param enable true to enable, false to disable + * @param sdm0 frequency adjustment parameter, 0..255 + * @param sdm1 frequency adjustment parameter, 0..255 + * @param sdm2 frequency adjustment parameter, 0..63 + * @param o_div frequency divider, 0..31 + */ +void rtc_clk_apll_enable(bool enable, uint32_t sdm0, uint32_t sdm1, uint32_t sdm2, uint32_t o_div); + +/** + * @brief Set XTAL wait cycles by RTC slow clock's period + */ +void rtc_clk_set_xtal_wait(void); + +/** + * @brief Select source for RTC_SLOW_CLK + * @param slow_freq clock source (one of rtc_slow_freq_t values) + */ +void rtc_clk_slow_freq_set(rtc_slow_freq_t slow_freq); + +/** + * @brief Get the RTC_SLOW_CLK source + * @return currently selected clock source (one of rtc_slow_freq_t values) + */ +rtc_slow_freq_t rtc_clk_slow_freq_get(void); + +/** + * @brief Get the approximate frequency of RTC_SLOW_CLK, in Hz + * + * - if RTC_SLOW_FREQ_RTC is selected, returns ~150000 + * - if RTC_SLOW_FREQ_32K_XTAL is selected, returns 32768 + * - if RTC_SLOW_FREQ_8MD256 is selected, returns ~33000 + * + * rtc_clk_cal function can be used to get more precise value by comparing + * RTC_SLOW_CLK frequency to the frequency of main XTAL. + * + * @return RTC_SLOW_CLK frequency, in Hz + */ +uint32_t rtc_clk_slow_freq_get_hz(void); + +/** + * @brief Select source for RTC_FAST_CLK + * @param fast_freq clock source (one of rtc_fast_freq_t values) + */ +void rtc_clk_fast_freq_set(rtc_fast_freq_t fast_freq); + +/** + * @brief Get the RTC_FAST_CLK source + * @return currently selected clock source (one of rtc_fast_freq_t values) + */ +rtc_fast_freq_t rtc_clk_fast_freq_get(void); + +/** + * @brief Switch CPU frequency + * + * If a PLL-derived frequency is requested (80, 160, 240 MHz), this function + * will enable the PLL. Otherwise, PLL will be disabled. + * Note: this function is not optimized for switching speed. It may take several + * hundred microseconds to perform frequency switch. + * + * @param cpu_freq new CPU frequency + */ +void rtc_clk_cpu_freq_set(rtc_cpu_freq_t cpu_freq); + +/** + * @brief Switch CPU frequency + * + * This is a faster version of rtc_clk_cpu_freq_set, which can handle some of + * the frequency switch paths (XTAL -> PLL, PLL -> XTAL). + * When switching from PLL to XTAL, PLL is not disabled (unlike rtc_clk_cpu_freq_set). + * When switching back from XTAL to PLL, only the same PLL can be used. + * Therefore it is not possible to switch 240 -> XTAL -> (80 or 160) using this + * function. + * + * For unsupported cases, this function falls back to rtc_clk_cpu_freq_set. + * + * Unlike rtc_clk_cpu_freq_set, this function relies on static data, so it is + * less safe to use it e.g. from a panic handler (when memory might be corrupted). + * + * @param cpu_freq new CPU frequency + */ +void rtc_clk_cpu_freq_set_fast(rtc_cpu_freq_t cpu_freq); + +/** + * @brief Get the currently selected CPU frequency + * + * Although CPU can be clocked by APLL and RTC 8M sources, such support is not + * exposed through this library. As such, this function will not return + * meaningful values when these clock sources are configured (e.g. using direct + * access to clock selection registers). In debug builds, it will assert; in + * release builds, it will return RTC_CPU_FREQ_XTAL. + * + * @return CPU frequency (one of rtc_cpu_freq_t values) + */ +rtc_cpu_freq_t rtc_clk_cpu_freq_get(void); + +/** + * @brief Get corresponding frequency value for rtc_cpu_freq_t enum value + * @param cpu_freq CPU frequency, on of rtc_cpu_freq_t values + * @return CPU frequency, in HZ + */ +uint32_t rtc_clk_cpu_freq_value(rtc_cpu_freq_t cpu_freq); + +/** + * @brief Get rtc_cpu_freq_t enum value for given CPU frequency + * @param cpu_freq_mhz CPU frequency, one of 80, 160, 240, 2, and XTAL frequency + * @param[out] out_val output, rtc_cpu_freq_t value corresponding to the frequency + * @return true if the given frequency value matches one of enum values + */ + bool rtc_clk_cpu_freq_from_mhz(int cpu_freq_mhz, rtc_cpu_freq_t* out_val); + +/** + * @brief Store new APB frequency value into RTC_APB_FREQ_REG + * + * This function doesn't change any hardware clocks. + * + * Functions which perform frequency switching and change APB frequency call + * this function to update the value of APB frequency stored in RTC_APB_FREQ_REG + * (one of RTC general purpose retention registers). This should not normally + * be called from application code. + * + * @param apb_freq new APB frequency, in Hz + */ +void rtc_clk_apb_freq_update(uint32_t apb_freq); + +/** + * @brief Get the current stored APB frequency. + * @return The APB frequency value as last set via rtc_clk_apb_freq_update(), in Hz. + */ +uint32_t rtc_clk_apb_freq_get(void); + +#define RTC_CLK_CAL_FRACT 19 //!< Number of fractional bits in values returned by rtc_clk_cal + +uint32_t rtc_clk_cal_internal(rtc_cal_sel_t cal_clk, uint32_t slowclk_cycles); + +/** + * @brief Measure RTC slow clock's period, based on main XTAL frequency + * + * This function will time out and return 0 if the time for the given number + * of cycles to be counted exceeds the expected time twice. This may happen if + * 32k XTAL is being calibrated, but the oscillator has not started up (due to + * incorrect loading capacitance, board design issue, or lack of 32 XTAL on board). + * + * @param cal_clk clock to be measured + * @param slow_clk_cycles number of slow clock cycles to average + * @return average slow clock period in microseconds, Q13.19 fixed point format, + * or 0 if calibration has timed out + */ +uint32_t rtc_clk_cal(rtc_cal_sel_t cal_clk, uint32_t slow_clk_cycles); + +/** + * @brief Measure ratio between XTAL frequency and RTC slow clock frequency + * @param cal_clk slow clock to be measured + * @param slow_clk_cycles number of slow clock cycles to average + * @return average ratio between XTAL frequency and slow clock frequency, + * Q13.19 fixed point format, or 0 if calibration has timed out. + */ +uint32_t rtc_clk_cal_ratio(rtc_cal_sel_t cal_clk, uint32_t slow_clk_cycles); + +/** + * @brief Convert time interval from microseconds to RTC_SLOW_CLK cycles + * @param time_in_us Time interval in microseconds + * @param slow_clk_period Period of slow clock in microseconds, Q13.19 + * fixed point format (as returned by rtc_slowck_cali). + * @return number of slow clock cycles + */ +uint64_t rtc_time_us_to_slowclk(uint64_t time_in_us, uint32_t period); + +/** + * @brief Convert time interval from RTC_SLOW_CLK to microseconds + * @param time_in_us Time interval in RTC_SLOW_CLK cycles + * @param slow_clk_period Period of slow clock in microseconds, Q13.19 + * fixed point format (as returned by rtc_slowck_cali). + * @return time interval in microseconds + */ +uint64_t rtc_time_slowclk_to_us(uint64_t rtc_cycles, uint32_t period); + +/** + * @brief Get current value of RTC counter + * + * RTC has a 48-bit counter which is incremented by 2 every 2 RTC_SLOW_CLK + * cycles. Counter value is not writable by software. The value is not adjusted + * when switching to a different RTC_SLOW_CLK source. + * + * Note: this function may take up to 1 RTC_SLOW_CLK cycle to execute + * + * @return current value of RTC counter + */ +uint64_t rtc_time_get(void); + +uint64_t rtc_light_slp_time_get(void); + +uint64_t rtc_deep_slp_time_get(void); + +/** + * @brief Busy loop until next RTC_SLOW_CLK cycle + * + * This function returns not earlier than the next RTC_SLOW_CLK clock cycle. + * In some cases (e.g. when RTC_SLOW_CLK cycle is very close), it may return + * one RTC_SLOW_CLK cycle later. + */ +void rtc_clk_wait_for_slow_cycle(void); + +/** + * @brief Power down flags for rtc_sleep_pd function + */ +typedef struct { + uint32_t dig_fpu : 1; //!< Set to 1 to power down digital part in sleep + uint32_t rtc_fpu : 1; //!< Set to 1 to power down RTC memories in sleep + uint32_t cpu_fpu : 1; //!< Set to 1 to power down digital memories and CPU in sleep + uint32_t i2s_fpu : 1; //!< Set to 1 to power down I2S in sleep + uint32_t bb_fpu : 1; //!< Set to 1 to power down WiFi in sleep + uint32_t nrx_fpu : 1; //!< Set to 1 to power down WiFi in sleep + uint32_t fe_fpu : 1; //!< Set to 1 to power down WiFi in sleep +} rtc_sleep_pd_config_t; + +/** + * Initializer for rtc_sleep_pd_config_t which sets all flags to the same value + */ +#define RTC_SLEEP_PD_CONFIG_ALL(val) {\ + .dig_fpu = (val), \ + .rtc_fpu = (val), \ + .cpu_fpu = (val), \ + .i2s_fpu = (val), \ + .bb_fpu = (val), \ + .nrx_fpu = (val), \ + .fe_fpu = (val), \ +} + +void rtc_sleep_pd(rtc_sleep_pd_config_t cfg); + +/** + * @brief sleep configuration for rtc_sleep_init function + */ +typedef struct { + uint32_t lslp_mem_inf_fpu : 1; //!< force normal voltage in sleep mode (digital domain memory) + uint32_t rtc_mem_inf_follow_cpu : 1;//!< keep low voltage in sleep mode (even if ULP/touch is used) + uint32_t rtc_fastmem_pd_en : 1; //!< power down RTC fast memory + uint32_t rtc_slowmem_pd_en : 1; //!< power down RTC slow memory + uint32_t rtc_peri_pd_en : 1; //!< power down RTC peripherals + uint32_t wifi_pd_en : 1; //!< power down WiFi + uint32_t deep_slp : 1; //!< power down digital domain + uint32_t wdt_flashboot_mod_en : 1; //!< enable WDT flashboot mode + uint32_t dig_dbias_wak : 3; //!< set bias for digital domain, in active mode + uint32_t dig_dbias_slp : 3; //!< set bias for digital domain, in sleep mode + uint32_t rtc_dbias_wak : 3; //!< set bias for RTC domain, in active mode + uint32_t rtc_dbias_slp : 3; //!< set bias for RTC domain, in sleep mode + uint32_t vddsdio_pd_en : 1; //!< power down VDDSDIO regulator + uint32_t deep_slp_reject : 1; + uint32_t light_slp_reject : 1; +} rtc_sleep_config_t; + +/** + * Default initializer for rtc_sleep_config_t + * + * This initializer sets all fields to "reasonable" values (e.g. suggested for + * production use) based on a combination of RTC_SLEEP_PD_x flags. + * + * @param RTC_SLEEP_PD_x flags combined using bitwise OR + */ +#define RTC_SLEEP_CONFIG_DEFAULT(sleep_flags) { \ + .lslp_mem_inf_fpu = 0, \ + .rtc_mem_inf_follow_cpu = ((sleep_flags) & RTC_SLEEP_PD_RTC_MEM_FOLLOW_CPU) ? 1 : 0, \ + .rtc_fastmem_pd_en = ((sleep_flags) & RTC_SLEEP_PD_RTC_FAST_MEM) ? 1 : 0, \ + .rtc_slowmem_pd_en = ((sleep_flags) & RTC_SLEEP_PD_RTC_SLOW_MEM) ? 1 : 0, \ + .rtc_peri_pd_en = ((sleep_flags) & RTC_SLEEP_PD_RTC_PERIPH) ? 1 : 0, \ + .wifi_pd_en = ((sleep_flags) & RTC_SLEEP_PD_WIFI) ? 1 : 0, \ + .deep_slp = ((sleep_flags) & RTC_SLEEP_PD_DIG) ? 1 : 0, \ + .wdt_flashboot_mod_en = 0, \ + .dig_dbias_wak = RTC_CNTL_DBIAS_1V10, \ + .dig_dbias_slp = RTC_CNTL_DBIAS_0V90, \ + .rtc_dbias_wak = RTC_CNTL_DBIAS_1V10, \ + .rtc_dbias_slp = RTC_CNTL_DBIAS_0V90, \ + .vddsdio_pd_en = ((sleep_flags) & RTC_SLEEP_PD_VDDSDIO) ? 1 : 0, \ + .deep_slp_reject = 1, \ + .light_slp_reject = 1 \ +}; + +#define RTC_SLEEP_PD_DIG BIT(0) //!< Deep sleep (power down digital domain) +#define RTC_SLEEP_PD_RTC_PERIPH BIT(1) //!< Power down RTC peripherals +#define RTC_SLEEP_PD_RTC_SLOW_MEM BIT(2) //!< Power down RTC SLOW memory +#define RTC_SLEEP_PD_RTC_FAST_MEM BIT(3) //!< Power down RTC FAST memory +#define RTC_SLEEP_PD_RTC_MEM_FOLLOW_CPU BIT(4) //!< RTC FAST and SLOW memories are automatically powered up and down along with the CPU +#define RTC_SLEEP_PD_VDDSDIO BIT(5) //!< Power down VDDSDIO regulator +#define RTC_SLEEP_PD_WIFI BIT(6) + +/** + * @brief Prepare the chip to enter sleep mode + * + * This function configures various power control state machines to handle + * entry into light sleep or deep sleep mode, switches APB and CPU clock source + * (usually to XTAL), and sets bias voltages for digital and RTC power domains. + * + * This function does not actually enter sleep mode; this is done using + * rtc_sleep_start function. Software may do some other actions between + * rtc_sleep_init and rtc_sleep_start, such as set wakeup timer and configure + * wakeup sources. + * @param cfg sleep mode configuration + */ +void rtc_sleep_init(rtc_sleep_config_t cfg); + + +/** + * @brief Set target value of RTC counter for RTC_TIMER_TRIG_EN wakeup source + * @param t value of RTC counter at which wakeup from sleep will happen; + * only the lower 48 bits are used + */ +void rtc_sleep_set_wakeup_time(uint64_t t); + + +#define RTC_EXT0_TRIG_EN BIT(0) //!< EXT0 GPIO wakeup +#define RTC_EXT1_TRIG_EN BIT(1) //!< EXT1 GPIO wakeup +#define RTC_GPIO_TRIG_EN BIT(2) //!< GPIO wakeup (light sleep only) +#define RTC_TIMER_TRIG_EN BIT(3) //!< Timer wakeup +#define RTC_SDIO_TRIG_EN BIT(4) //!< SDIO wakeup (light sleep only) +#define RTC_MAC_TRIG_EN BIT(5) //!< MAC wakeup (light sleep only) +#define RTC_UART0_TRIG_EN BIT(6) //!< UART0 wakeup (light sleep only) +#define RTC_UART1_TRIG_EN BIT(7) //!< UART1 wakeup (light sleep only) +#define RTC_TOUCH_TRIG_EN BIT(8) //!< Touch wakeup +#define RTC_ULP_TRIG_EN BIT(9) //!< ULP wakeup +#define RTC_BT_TRIG_EN BIT(10) //!< BT wakeup (light sleep only) +#define RTC_COCPU_TRIG_EN BIT(11) +#define RTC_XTAL32K_DEAD_TRIG_EN BIT(12) +#define RTC_COCPU_TRAP_TRIG_EN BIT(13) +#define RTC_USB_TRIG_EN BIT(14) + +/** + * @brief Enter deep or light sleep mode + * + * This function enters the sleep mode previously configured using rtc_sleep_init + * function. Before entering sleep, software should configure wake up sources + * appropriately (set up GPIO wakeup registers, timer wakeup registers, + * and so on). + * + * If deep sleep mode was configured using rtc_sleep_init, and sleep is not + * rejected by hardware (based on reject_opt flags), this function never returns. + * When the chip wakes up from deep sleep, CPU is reset and execution starts + * from ROM bootloader. + * + * If light sleep mode was configured using rtc_sleep_init, this function + * returns on wakeup, or if sleep is rejected by hardware. + * + * @param wakeup_opt bit mask wake up reasons to enable (RTC_xxx_TRIG_EN flags + * combined with OR) + * @param reject_opt bit mask of sleep reject reasons: + * - RTC_CNTL_GPIO_REJECT_EN + * - RTC_CNTL_SDIO_REJECT_EN + * These flags are used to prevent entering sleep when e.g. + * an external host is communicating via SDIO slave + * @return non-zero if sleep was rejected by hardware + */ +uint32_t rtc_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt, uint32_t lslp_mem_inf_fpu); + +/** + * RTC power and clock control initialization settings + */ +typedef struct { + uint32_t ck8m_wait : 8; //!< Number of rtc_fast_clk cycles to wait for 8M clock to be ready + uint32_t xtal_wait : 8; //!< Number of rtc_fast_clk cycles to wait for XTAL clock to be ready + uint32_t pll_wait : 8; //!< Number of rtc_fast_clk cycles to wait for PLL to be ready + uint32_t clkctl_init : 1; //!< Perform clock control related initialization + uint32_t pwrctl_init : 1; //!< Perform power control related initialization + uint32_t rtc_dboost_fpd : 1; //!< Force power down RTC_DBOOST + uint32_t xtal_fpu : 1; + uint32_t bbpll_fpu : 1; + uint32_t cpu_waiti_clk_gate : 1; +} rtc_config_t; + +/** + * Default initializer of rtc_config_t. + * + * This initializer sets all fields to "reasonable" values (e.g. suggested for + * production use). + */ +#define RTC_CONFIG_DEFAULT() {\ + .ck8m_wait = RTC_CNTL_CK8M_WAIT_DEFAULT, \ + .xtal_wait = RTC_CNTL_XTL_BUF_WAIT_DEFAULT, \ + .pll_wait = RTC_CNTL_PLL_BUF_WAIT_DEFAULT, \ + .clkctl_init = 1, \ + .pwrctl_init = 1, \ + .rtc_dboost_fpd = 1, \ + .xtal_fpu = 0, \ + .bbpll_fpu = 0, \ + .cpu_waiti_clk_gate = 1\ +} + +/** + * Initialize RTC clock and power control related functions + * @param cfg configuration options as rtc_config_t + */ +void rtc_init(rtc_config_t cfg); + +#define RTC_VDDSDIO_TIEH_1_8V 0 //!< TIEH field value for 1.8V VDDSDIO +#define RTC_VDDSDIO_TIEH_3_3V 1 //!< TIEH field value for 3.3V VDDSDIO + +/** + * Structure describing vddsdio configuration + */ +typedef struct { + uint32_t force : 1; //!< If 1, use configuration from RTC registers; if 0, use EFUSE/bootstrapping pins. + uint32_t enable : 1; //!< Enable VDDSDIO regulator + uint32_t tieh : 1; //!< Select VDDSDIO voltage. One of RTC_VDDSDIO_TIEH_1_8V, RTC_VDDSDIO_TIEH_3_3V + uint32_t drefh : 2; //!< Tuning parameter for VDDSDIO regulator + uint32_t drefm : 2; //!< Tuning parameter for VDDSDIO regulator + uint32_t drefl : 2; //!< Tuning parameter for VDDSDIO regulator +} rtc_vddsdio_config_t; + +/** + * Get current VDDSDIO configuration + * If VDDSDIO configuration is overridden by RTC, get values from RTC + * Otherwise, if VDDSDIO is configured by EFUSE, get values from EFUSE + * Otherwise, use default values and the level of MTDI bootstrapping pin. + * @return currently used VDDSDIO configuration + */ +rtc_vddsdio_config_t rtc_vddsdio_get_config(void); + +/** + * Set new VDDSDIO configuration using RTC registers. + * If config.force == 1, this overrides configuration done using bootstrapping + * pins and EFUSE. + * + * @param config new VDDSDIO configuration + */ +void rtc_vddsdio_set_config(rtc_vddsdio_config_t config); + +#ifdef __cplusplus +} +#endif + diff --git a/components/soc/esp32s2beta/include/soc/rtc_cntl_reg.h b/components/soc/esp32s2beta/include/soc/rtc_cntl_reg.h new file mode 100644 index 0000000000..bdf0d5bbc8 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/rtc_cntl_reg.h @@ -0,0 +1,3182 @@ +// Copyright 2017-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_RTC_CNTL_REG_H_ +#define _SOC_RTC_CNTL_REG_H_ + +/* The value that needs to be written to RTC_CNTL_WDT_WKEY to write-enable the wdt registers */ +#define RTC_CNTL_WDT_WKEY_VALUE 0x50D83AA1 + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define RTC_CNTL_TIME0_REG RTC_CNTL_TIME_LOW0_REG +#define RTC_CNTL_TIME1_REG RTC_CNTL_TIME_HIGH0_REG + +#define RTC_CNTL_OPTIONS0_REG (DR_REG_RTCCNTL_BASE + 0x0000) +/* RTC_CNTL_SW_SYS_RST : WO ;bitpos:[31] ;default: 1'd0 ; */ +/*description: SW system reset*/ +#define RTC_CNTL_SW_SYS_RST (BIT(31)) +#define RTC_CNTL_SW_SYS_RST_M (BIT(31)) +#define RTC_CNTL_SW_SYS_RST_V 0x1 +#define RTC_CNTL_SW_SYS_RST_S 31 +/* RTC_CNTL_DG_WRAP_FORCE_NORST : R/W ;bitpos:[30] ;default: 1'd0 ; */ +/*description: digital core force no reset in deep sleep*/ +#define RTC_CNTL_DG_WRAP_FORCE_NORST (BIT(30)) +#define RTC_CNTL_DG_WRAP_FORCE_NORST_M (BIT(30)) +#define RTC_CNTL_DG_WRAP_FORCE_NORST_V 0x1 +#define RTC_CNTL_DG_WRAP_FORCE_NORST_S 30 +/* RTC_CNTL_DG_WRAP_FORCE_RST : R/W ;bitpos:[29] ;default: 1'd0 ; */ +/*description: digital wrap force reset in deep sleep*/ +#define RTC_CNTL_DG_WRAP_FORCE_RST (BIT(29)) +#define RTC_CNTL_DG_WRAP_FORCE_RST_M (BIT(29)) +#define RTC_CNTL_DG_WRAP_FORCE_RST_V 0x1 +#define RTC_CNTL_DG_WRAP_FORCE_RST_S 29 +/* RTC_CNTL_ANALOG_FORCE_NOISO : R/W ;bitpos:[28] ;default: 1'd1 ; */ +/*description: */ +#define RTC_CNTL_ANALOG_FORCE_NOISO (BIT(28)) +#define RTC_CNTL_ANALOG_FORCE_NOISO_M (BIT(28)) +#define RTC_CNTL_ANALOG_FORCE_NOISO_V 0x1 +#define RTC_CNTL_ANALOG_FORCE_NOISO_S 28 +/* RTC_CNTL_PLL_FORCE_NOISO : R/W ;bitpos:[27] ;default: 1'd1 ; */ +/*description: */ +#define RTC_CNTL_PLL_FORCE_NOISO (BIT(27)) +#define RTC_CNTL_PLL_FORCE_NOISO_M (BIT(27)) +#define RTC_CNTL_PLL_FORCE_NOISO_V 0x1 +#define RTC_CNTL_PLL_FORCE_NOISO_S 27 +/* RTC_CNTL_XTL_FORCE_NOISO : R/W ;bitpos:[26] ;default: 1'd1 ; */ +/*description: */ +#define RTC_CNTL_XTL_FORCE_NOISO (BIT(26)) +#define RTC_CNTL_XTL_FORCE_NOISO_M (BIT(26)) +#define RTC_CNTL_XTL_FORCE_NOISO_V 0x1 +#define RTC_CNTL_XTL_FORCE_NOISO_S 26 +/* RTC_CNTL_ANALOG_FORCE_ISO : R/W ;bitpos:[25] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_ANALOG_FORCE_ISO (BIT(25)) +#define RTC_CNTL_ANALOG_FORCE_ISO_M (BIT(25)) +#define RTC_CNTL_ANALOG_FORCE_ISO_V 0x1 +#define RTC_CNTL_ANALOG_FORCE_ISO_S 25 +/* RTC_CNTL_PLL_FORCE_ISO : R/W ;bitpos:[24] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_PLL_FORCE_ISO (BIT(24)) +#define RTC_CNTL_PLL_FORCE_ISO_M (BIT(24)) +#define RTC_CNTL_PLL_FORCE_ISO_V 0x1 +#define RTC_CNTL_PLL_FORCE_ISO_S 24 +/* RTC_CNTL_XTL_FORCE_ISO : R/W ;bitpos:[23] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_XTL_FORCE_ISO (BIT(23)) +#define RTC_CNTL_XTL_FORCE_ISO_M (BIT(23)) +#define RTC_CNTL_XTL_FORCE_ISO_V 0x1 +#define RTC_CNTL_XTL_FORCE_ISO_S 23 +/* RTC_CNTL_BIAS_CORE_FORCE_PU : R/W ;bitpos:[22] ;default: 1'd1 ; */ +/*description: BIAS_CORE force power up*/ +#define RTC_CNTL_BIAS_CORE_FORCE_PU (BIT(22)) +#define RTC_CNTL_BIAS_CORE_FORCE_PU_M (BIT(22)) +#define RTC_CNTL_BIAS_CORE_FORCE_PU_V 0x1 +#define RTC_CNTL_BIAS_CORE_FORCE_PU_S 22 +/* RTC_CNTL_BIAS_CORE_FORCE_PD : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: BIAS_CORE force power down*/ +#define RTC_CNTL_BIAS_CORE_FORCE_PD (BIT(21)) +#define RTC_CNTL_BIAS_CORE_FORCE_PD_M (BIT(21)) +#define RTC_CNTL_BIAS_CORE_FORCE_PD_V 0x1 +#define RTC_CNTL_BIAS_CORE_FORCE_PD_S 21 +/* RTC_CNTL_BIAS_CORE_FOLW_8M : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: BIAS_CORE follow CK8M*/ +#define RTC_CNTL_BIAS_CORE_FOLW_8M (BIT(20)) +#define RTC_CNTL_BIAS_CORE_FOLW_8M_M (BIT(20)) +#define RTC_CNTL_BIAS_CORE_FOLW_8M_V 0x1 +#define RTC_CNTL_BIAS_CORE_FOLW_8M_S 20 +/* RTC_CNTL_BIAS_I2C_FORCE_PU : R/W ;bitpos:[19] ;default: 1'd1 ; */ +/*description: BIAS_I2C force power up*/ +#define RTC_CNTL_BIAS_I2C_FORCE_PU (BIT(19)) +#define RTC_CNTL_BIAS_I2C_FORCE_PU_M (BIT(19)) +#define RTC_CNTL_BIAS_I2C_FORCE_PU_V 0x1 +#define RTC_CNTL_BIAS_I2C_FORCE_PU_S 19 +/* RTC_CNTL_BIAS_I2C_FORCE_PD : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: BIAS_I2C force power down*/ +#define RTC_CNTL_BIAS_I2C_FORCE_PD (BIT(18)) +#define RTC_CNTL_BIAS_I2C_FORCE_PD_M (BIT(18)) +#define RTC_CNTL_BIAS_I2C_FORCE_PD_V 0x1 +#define RTC_CNTL_BIAS_I2C_FORCE_PD_S 18 +/* RTC_CNTL_BIAS_I2C_FOLW_8M : R/W ;bitpos:[17] ;default: 1'd0 ; */ +/*description: BIAS_I2C follow CK8M*/ +#define RTC_CNTL_BIAS_I2C_FOLW_8M (BIT(17)) +#define RTC_CNTL_BIAS_I2C_FOLW_8M_M (BIT(17)) +#define RTC_CNTL_BIAS_I2C_FOLW_8M_V 0x1 +#define RTC_CNTL_BIAS_I2C_FOLW_8M_S 17 +/* RTC_CNTL_BIAS_FORCE_NOSLEEP : R/W ;bitpos:[16] ;default: 1'd1 ; */ +/*description: BIAS_SLEEP force no sleep*/ +#define RTC_CNTL_BIAS_FORCE_NOSLEEP (BIT(16)) +#define RTC_CNTL_BIAS_FORCE_NOSLEEP_M (BIT(16)) +#define RTC_CNTL_BIAS_FORCE_NOSLEEP_V 0x1 +#define RTC_CNTL_BIAS_FORCE_NOSLEEP_S 16 +/* RTC_CNTL_BIAS_FORCE_SLEEP : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: BIAS_SLEEP force sleep*/ +#define RTC_CNTL_BIAS_FORCE_SLEEP (BIT(15)) +#define RTC_CNTL_BIAS_FORCE_SLEEP_M (BIT(15)) +#define RTC_CNTL_BIAS_FORCE_SLEEP_V 0x1 +#define RTC_CNTL_BIAS_FORCE_SLEEP_S 15 +/* RTC_CNTL_BIAS_SLEEP_FOLW_8M : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: BIAS_SLEEP follow CK8M*/ +#define RTC_CNTL_BIAS_SLEEP_FOLW_8M (BIT(14)) +#define RTC_CNTL_BIAS_SLEEP_FOLW_8M_M (BIT(14)) +#define RTC_CNTL_BIAS_SLEEP_FOLW_8M_V 0x1 +#define RTC_CNTL_BIAS_SLEEP_FOLW_8M_S 14 +/* RTC_CNTL_XTL_FORCE_PU : R/W ;bitpos:[13] ;default: 1'd1 ; */ +/*description: crystall force power up*/ +#define RTC_CNTL_XTL_FORCE_PU (BIT(13)) +#define RTC_CNTL_XTL_FORCE_PU_M (BIT(13)) +#define RTC_CNTL_XTL_FORCE_PU_V 0x1 +#define RTC_CNTL_XTL_FORCE_PU_S 13 +/* RTC_CNTL_XTL_FORCE_PD : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: crystall force power down*/ +#define RTC_CNTL_XTL_FORCE_PD (BIT(12)) +#define RTC_CNTL_XTL_FORCE_PD_M (BIT(12)) +#define RTC_CNTL_XTL_FORCE_PD_V 0x1 +#define RTC_CNTL_XTL_FORCE_PD_S 12 +/* RTC_CNTL_BBPLL_FORCE_PU : R/W ;bitpos:[11] ;default: 1'd0 ; */ +/*description: BB_PLL force power up*/ +#define RTC_CNTL_BBPLL_FORCE_PU (BIT(11)) +#define RTC_CNTL_BBPLL_FORCE_PU_M (BIT(11)) +#define RTC_CNTL_BBPLL_FORCE_PU_V 0x1 +#define RTC_CNTL_BBPLL_FORCE_PU_S 11 +/* RTC_CNTL_BBPLL_FORCE_PD : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: BB_PLL force power down*/ +#define RTC_CNTL_BBPLL_FORCE_PD (BIT(10)) +#define RTC_CNTL_BBPLL_FORCE_PD_M (BIT(10)) +#define RTC_CNTL_BBPLL_FORCE_PD_V 0x1 +#define RTC_CNTL_BBPLL_FORCE_PD_S 10 +/* RTC_CNTL_BBPLL_I2C_FORCE_PU : R/W ;bitpos:[9] ;default: 1'd0 ; */ +/*description: BB_PLL_I2C force power up*/ +#define RTC_CNTL_BBPLL_I2C_FORCE_PU (BIT(9)) +#define RTC_CNTL_BBPLL_I2C_FORCE_PU_M (BIT(9)) +#define RTC_CNTL_BBPLL_I2C_FORCE_PU_V 0x1 +#define RTC_CNTL_BBPLL_I2C_FORCE_PU_S 9 +/* RTC_CNTL_BBPLL_I2C_FORCE_PD : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: BB_PLL _I2C force power down*/ +#define RTC_CNTL_BBPLL_I2C_FORCE_PD (BIT(8)) +#define RTC_CNTL_BBPLL_I2C_FORCE_PD_M (BIT(8)) +#define RTC_CNTL_BBPLL_I2C_FORCE_PD_V 0x1 +#define RTC_CNTL_BBPLL_I2C_FORCE_PD_S 8 +/* RTC_CNTL_BB_I2C_FORCE_PU : R/W ;bitpos:[7] ;default: 1'd0 ; */ +/*description: BB_I2C force power up*/ +#define RTC_CNTL_BB_I2C_FORCE_PU (BIT(7)) +#define RTC_CNTL_BB_I2C_FORCE_PU_M (BIT(7)) +#define RTC_CNTL_BB_I2C_FORCE_PU_V 0x1 +#define RTC_CNTL_BB_I2C_FORCE_PU_S 7 +/* RTC_CNTL_BB_I2C_FORCE_PD : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: BB_I2C force power down*/ +#define RTC_CNTL_BB_I2C_FORCE_PD (BIT(6)) +#define RTC_CNTL_BB_I2C_FORCE_PD_M (BIT(6)) +#define RTC_CNTL_BB_I2C_FORCE_PD_V 0x1 +#define RTC_CNTL_BB_I2C_FORCE_PD_S 6 +/* RTC_CNTL_SW_PROCPU_RST : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: PRO CPU SW reset*/ +#define RTC_CNTL_SW_PROCPU_RST (BIT(5)) +#define RTC_CNTL_SW_PROCPU_RST_M (BIT(5)) +#define RTC_CNTL_SW_PROCPU_RST_V 0x1 +#define RTC_CNTL_SW_PROCPU_RST_S 5 +/* RTC_CNTL_SW_APPCPU_RST : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: APP CPU SW reset*/ +#define RTC_CNTL_SW_APPCPU_RST (BIT(4)) +#define RTC_CNTL_SW_APPCPU_RST_M (BIT(4)) +#define RTC_CNTL_SW_APPCPU_RST_V 0x1 +#define RTC_CNTL_SW_APPCPU_RST_S 4 +/* RTC_CNTL_SW_STALL_PROCPU_C0 : R/W ;bitpos:[3:2] ;default: 2'b0 ; */ +/*description: {reg_sw_stall_procpu_c1[5:0] reg_sw_stall_procpu_c0[1:0]} == + 0x86 will stall PRO CPU*/ +#define RTC_CNTL_SW_STALL_PROCPU_C0 0x00000003 +#define RTC_CNTL_SW_STALL_PROCPU_C0_M ((RTC_CNTL_SW_STALL_PROCPU_C0_V)<<(RTC_CNTL_SW_STALL_PROCPU_C0_S)) +#define RTC_CNTL_SW_STALL_PROCPU_C0_V 0x3 +#define RTC_CNTL_SW_STALL_PROCPU_C0_S 2 +/* RTC_CNTL_SW_STALL_APPCPU_C0 : R/W ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: {reg_sw_stall_appcpu_c1[5:0] reg_sw_stall_appcpu_c0[1:0]} == + 0x86 will stall APP CPU*/ +#define RTC_CNTL_SW_STALL_APPCPU_C0 0x00000003 +#define RTC_CNTL_SW_STALL_APPCPU_C0_M ((RTC_CNTL_SW_STALL_APPCPU_C0_V)<<(RTC_CNTL_SW_STALL_APPCPU_C0_S)) +#define RTC_CNTL_SW_STALL_APPCPU_C0_V 0x3 +#define RTC_CNTL_SW_STALL_APPCPU_C0_S 0 + +#define RTC_CNTL_SLP_TIMER0_REG (DR_REG_RTCCNTL_BASE + 0x0004) +/* RTC_CNTL_SLP_VAL_LO : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: RTC sleep timer low 32 bits*/ +#define RTC_CNTL_SLP_VAL_LO 0xFFFFFFFF +#define RTC_CNTL_SLP_VAL_LO_M ((RTC_CNTL_SLP_VAL_LO_V)<<(RTC_CNTL_SLP_VAL_LO_S)) +#define RTC_CNTL_SLP_VAL_LO_V 0xFFFFFFFF +#define RTC_CNTL_SLP_VAL_LO_S 0 + +#define RTC_CNTL_SLP_TIMER1_REG (DR_REG_RTCCNTL_BASE + 0x0008) +/* RTC_CNTL_MAIN_TIMER_ALARM_EN : R/W ;bitpos:[16] ;default: 1'h0 ; */ +/*description: timer alarm enable bit*/ +#define RTC_CNTL_MAIN_TIMER_ALARM_EN (BIT(16)) +#define RTC_CNTL_MAIN_TIMER_ALARM_EN_M (BIT(16)) +#define RTC_CNTL_MAIN_TIMER_ALARM_EN_V 0x1 +#define RTC_CNTL_MAIN_TIMER_ALARM_EN_S 16 +/* RTC_CNTL_SLP_VAL_HI : R/W ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: RTC sleep timer high 16 bits*/ +#define RTC_CNTL_SLP_VAL_HI 0x0000FFFF +#define RTC_CNTL_SLP_VAL_HI_M ((RTC_CNTL_SLP_VAL_HI_V)<<(RTC_CNTL_SLP_VAL_HI_S)) +#define RTC_CNTL_SLP_VAL_HI_V 0xFFFF +#define RTC_CNTL_SLP_VAL_HI_S 0 + +#define RTC_CNTL_TIME_UPDATE_REG (DR_REG_RTCCNTL_BASE + 0x000c) +/* RTC_CNTL_TIME_UPDATE : WO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: Set 1: to update register with RTC timer*/ +#define RTC_CNTL_TIME_UPDATE (BIT(31)) +#define RTC_CNTL_TIME_UPDATE_M (BIT(31)) +#define RTC_CNTL_TIME_UPDATE_V 0x1 +#define RTC_CNTL_TIME_UPDATE_S 31 +/* RTC_CNTL_TIME_VALID : RO ;bitpos:[30] ;default: 1'b0 ; */ +/*description: To indicate the register is updated*/ +#define RTC_CNTL_TIME_VALID (BIT(30)) +#define RTC_CNTL_TIME_VALID_M (BIT(30)) +#define RTC_CNTL_TIME_VALID_V 0x1 +#define RTC_CNTL_TIME_VALID_S 30 +/* RTC_CNTL_TIMER_SYS_RST : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: enable to record system reset time*/ +#define RTC_CNTL_TIMER_SYS_RST (BIT(29)) +#define RTC_CNTL_TIMER_SYS_RST_M (BIT(29)) +#define RTC_CNTL_TIMER_SYS_RST_V 0x1 +#define RTC_CNTL_TIMER_SYS_RST_S 29 +/* RTC_CNTL_TIMER_XTL_OFF : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: Enable to record 40M XTAL OFF time*/ +#define RTC_CNTL_TIMER_XTL_OFF (BIT(28)) +#define RTC_CNTL_TIMER_XTL_OFF_M (BIT(28)) +#define RTC_CNTL_TIMER_XTL_OFF_V 0x1 +#define RTC_CNTL_TIMER_XTL_OFF_S 28 +/* RTC_CNTL_TIMER_SYS_STALL : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: Enable to record system stall time*/ +#define RTC_CNTL_TIMER_SYS_STALL (BIT(27)) +#define RTC_CNTL_TIMER_SYS_STALL_M (BIT(27)) +#define RTC_CNTL_TIMER_SYS_STALL_V 0x1 +#define RTC_CNTL_TIMER_SYS_STALL_S 27 + +#define RTC_CNTL_TIME_LOW0_REG (DR_REG_RTCCNTL_BASE + 0x0010) +/* RTC_CNTL_TIMER_VALUE0_LOW : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: RTC timer low 32 bits*/ +#define RTC_CNTL_TIMER_VALUE0_LOW 0xFFFFFFFF +#define RTC_CNTL_TIMER_VALUE0_LOW_M ((RTC_CNTL_TIMER_VALUE0_LOW_V)<<(RTC_CNTL_TIMER_VALUE0_LOW_S)) +#define RTC_CNTL_TIMER_VALUE0_LOW_V 0xFFFFFFFF +#define RTC_CNTL_TIMER_VALUE0_LOW_S 0 + +#define RTC_CNTL_TIME_HIGH0_REG (DR_REG_RTCCNTL_BASE + 0x0014) +/* RTC_CNTL_TIMER_VALUE0_HIGH : RO ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: RTC timer high 16 bits*/ +#define RTC_CNTL_TIMER_VALUE0_HIGH 0x0000FFFF +#define RTC_CNTL_TIMER_VALUE0_HIGH_M ((RTC_CNTL_TIMER_VALUE0_HIGH_V)<<(RTC_CNTL_TIMER_VALUE0_HIGH_S)) +#define RTC_CNTL_TIMER_VALUE0_HIGH_V 0xFFFF +#define RTC_CNTL_TIMER_VALUE0_HIGH_S 0 + +#define RTC_CNTL_STATE0_REG (DR_REG_RTCCNTL_BASE + 0x0018) +/* RTC_CNTL_SLEEP_EN : R/W ;bitpos:[31] ;default: 1'd0 ; */ +/*description: sleep enable bit*/ +#define RTC_CNTL_SLEEP_EN (BIT(31)) +#define RTC_CNTL_SLEEP_EN_M (BIT(31)) +#define RTC_CNTL_SLEEP_EN_V 0x1 +#define RTC_CNTL_SLEEP_EN_S 31 +/* RTC_CNTL_SLP_REJECT : R/W ;bitpos:[30] ;default: 1'd0 ; */ +/*description: leep reject bit*/ +#define RTC_CNTL_SLP_REJECT (BIT(30)) +#define RTC_CNTL_SLP_REJECT_M (BIT(30)) +#define RTC_CNTL_SLP_REJECT_V 0x1 +#define RTC_CNTL_SLP_REJECT_S 30 +/* RTC_CNTL_SLP_WAKEUP : R/W ;bitpos:[29] ;default: 1'd0 ; */ +/*description: leep wakeup bit*/ +#define RTC_CNTL_SLP_WAKEUP (BIT(29)) +#define RTC_CNTL_SLP_WAKEUP_M (BIT(29)) +#define RTC_CNTL_SLP_WAKEUP_V 0x1 +#define RTC_CNTL_SLP_WAKEUP_S 29 +/* RTC_CNTL_SDIO_ACTIVE_IND : RO ;bitpos:[28] ;default: 1'd0 ; */ +/*description: SDIO active indication*/ +#define RTC_CNTL_SDIO_ACTIVE_IND (BIT(28)) +#define RTC_CNTL_SDIO_ACTIVE_IND_M (BIT(28)) +#define RTC_CNTL_SDIO_ACTIVE_IND_V 0x1 +#define RTC_CNTL_SDIO_ACTIVE_IND_S 28 +/* RTC_CNTL_APB2RTC_BRIDGE_SEL : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: 1: APB to RTC using bridge 0: APB to RTC using sync*/ +#define RTC_CNTL_APB2RTC_BRIDGE_SEL (BIT(22)) +#define RTC_CNTL_APB2RTC_BRIDGE_SEL_M (BIT(22)) +#define RTC_CNTL_APB2RTC_BRIDGE_SEL_V 0x1 +#define RTC_CNTL_APB2RTC_BRIDGE_SEL_S 22 +/* RTC_CNTL_SLP_REJECT_CAUSE_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: clear rtc sleep reject cause*/ +#define RTC_CNTL_SLP_REJECT_CAUSE_CLR (BIT(1)) +#define RTC_CNTL_SLP_REJECT_CAUSE_CLR_M (BIT(1)) +#define RTC_CNTL_SLP_REJECT_CAUSE_CLR_V 0x1 +#define RTC_CNTL_SLP_REJECT_CAUSE_CLR_S 1 +/* RTC_CNTL_SW_CPU_INT : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: rtc software interrupt to main cpu*/ +#define RTC_CNTL_SW_CPU_INT (BIT(0)) +#define RTC_CNTL_SW_CPU_INT_M (BIT(0)) +#define RTC_CNTL_SW_CPU_INT_V 0x1 +#define RTC_CNTL_SW_CPU_INT_S 0 + +#define RTC_CNTL_TIMER1_REG (DR_REG_RTCCNTL_BASE + 0x001c) +/* RTC_CNTL_PLL_BUF_WAIT : R/W ;bitpos:[31:24] ;default: 8'd40 ; */ +/*description: PLL wait cycles in slow_clk_rtc*/ +#define RTC_CNTL_PLL_BUF_WAIT 0x000000FF +#define RTC_CNTL_PLL_BUF_WAIT_M ((RTC_CNTL_PLL_BUF_WAIT_V)<<(RTC_CNTL_PLL_BUF_WAIT_S)) +#define RTC_CNTL_PLL_BUF_WAIT_V 0xFF +#define RTC_CNTL_PLL_BUF_WAIT_S 24 +#define RTC_CNTL_PLL_BUF_WAIT_DEFAULT 100 +/* RTC_CNTL_XTL_BUF_WAIT : R/W ;bitpos:[23:14] ;default: 10'd80 ; */ +/*description: XTAL wait cycles in slow_clk_rtc*/ +#define RTC_CNTL_XTL_BUF_WAIT 0x000003FF +#define RTC_CNTL_XTL_BUF_WAIT_M ((RTC_CNTL_XTL_BUF_WAIT_V)<<(RTC_CNTL_XTL_BUF_WAIT_S)) +#define RTC_CNTL_XTL_BUF_WAIT_V 0x3FF +#define RTC_CNTL_XTL_BUF_WAIT_S 14 +#define RTC_CNTL_XTL_BUF_WAIT_DEFAULT 100 +/* RTC_CNTL_CK8M_WAIT : R/W ;bitpos:[13:6] ;default: 8'h10 ; */ +/*description: CK8M wait cycles in slow_clk_rtc*/ +#define RTC_CNTL_CK8M_WAIT 0x000000FF +#define RTC_CNTL_CK8M_WAIT_M ((RTC_CNTL_CK8M_WAIT_V)<<(RTC_CNTL_CK8M_WAIT_S)) +#define RTC_CNTL_CK8M_WAIT_V 0xFF +#define RTC_CNTL_CK8M_WAIT_S 6 +#define RTC_CNTL_CK8M_WAIT_DEFAULT 20 +/* RTC_CNTL_CPU_STALL_WAIT : R/W ;bitpos:[5:1] ;default: 5'd1 ; */ +/*description: CPU stall wait cycles in fast_clk_rtc*/ +#define RTC_CNTL_CPU_STALL_WAIT 0x0000001F +#define RTC_CNTL_CPU_STALL_WAIT_M ((RTC_CNTL_CPU_STALL_WAIT_V)<<(RTC_CNTL_CPU_STALL_WAIT_S)) +#define RTC_CNTL_CPU_STALL_WAIT_V 0x1F +#define RTC_CNTL_CPU_STALL_WAIT_S 1 +/* RTC_CNTL_CPU_STALL_EN : R/W ;bitpos:[0] ;default: 1'd1 ; */ +/*description: CPU stall enable bit*/ +#define RTC_CNTL_CPU_STALL_EN (BIT(0)) +#define RTC_CNTL_CPU_STALL_EN_M (BIT(0)) +#define RTC_CNTL_CPU_STALL_EN_V 0x1 +#define RTC_CNTL_CPU_STALL_EN_S 0 + +#define RTC_CNTL_TIMER2_REG (DR_REG_RTCCNTL_BASE + 0x0020) +/* RTC_CNTL_MIN_TIME_CK8M_OFF : R/W ;bitpos:[31:24] ;default: 8'h1 ; */ +/*description: minimal cycles in slow_clk_rtc for CK8M in power down state*/ +#define RTC_CNTL_MIN_TIME_CK8M_OFF 0x000000FF +#define RTC_CNTL_MIN_TIME_CK8M_OFF_M ((RTC_CNTL_MIN_TIME_CK8M_OFF_V)<<(RTC_CNTL_MIN_TIME_CK8M_OFF_S)) +#define RTC_CNTL_MIN_TIME_CK8M_OFF_V 0xFF +#define RTC_CNTL_MIN_TIME_CK8M_OFF_S 24 +/* RTC_CNTL_ULPCP_TOUCH_START_WAIT : R/W ;bitpos:[23:15] ;default: 9'h10 ; */ +/*description: wait cycles in slow_clk_rtc before ULP-coprocessor / touch controller + start to work*/ +#define RTC_CNTL_ULPCP_TOUCH_START_WAIT 0x000001FF +#define RTC_CNTL_ULPCP_TOUCH_START_WAIT_M ((RTC_CNTL_ULPCP_TOUCH_START_WAIT_V)<<(RTC_CNTL_ULPCP_TOUCH_START_WAIT_S)) +#define RTC_CNTL_ULPCP_TOUCH_START_WAIT_V 0x1FF +#define RTC_CNTL_ULPCP_TOUCH_START_WAIT_S 15 + +#define RTC_CNTL_TIMER3_REG (DR_REG_RTCCNTL_BASE + 0x0024) +/* RTC_CNTL_ROM_RAM_POWERUP_TIMER : R/W ;bitpos:[31:25] ;default: 7'd10 ; */ +/*description: */ +#define RTC_CNTL_ROM_RAM_POWERUP_TIMER 0x0000007F +#define RTC_CNTL_ROM_RAM_POWERUP_TIMER_M ((RTC_CNTL_ROM_RAM_POWERUP_TIMER_V)<<(RTC_CNTL_ROM_RAM_POWERUP_TIMER_S)) +#define RTC_CNTL_ROM_RAM_POWERUP_TIMER_V 0x7F +#define RTC_CNTL_ROM_RAM_POWERUP_TIMER_S 25 +/* RTC_CNTL_ROM_RAM_WAIT_TIMER : R/W ;bitpos:[24:16] ;default: 9'h16 ; */ +/*description: */ +#define RTC_CNTL_ROM_RAM_WAIT_TIMER 0x000001FF +#define RTC_CNTL_ROM_RAM_WAIT_TIMER_M ((RTC_CNTL_ROM_RAM_WAIT_TIMER_V)<<(RTC_CNTL_ROM_RAM_WAIT_TIMER_S)) +#define RTC_CNTL_ROM_RAM_WAIT_TIMER_V 0x1FF +#define RTC_CNTL_ROM_RAM_WAIT_TIMER_S 16 +/* RTC_CNTL_WIFI_POWERUP_TIMER : R/W ;bitpos:[15:9] ;default: 7'h5 ; */ +/*description: */ +#define RTC_CNTL_WIFI_POWERUP_TIMER 0x0000007F +#define RTC_CNTL_WIFI_POWERUP_TIMER_M ((RTC_CNTL_WIFI_POWERUP_TIMER_V)<<(RTC_CNTL_WIFI_POWERUP_TIMER_S)) +#define RTC_CNTL_WIFI_POWERUP_TIMER_V 0x7F +#define RTC_CNTL_WIFI_POWERUP_TIMER_S 9 +/* RTC_CNTL_WIFI_WAIT_TIMER : R/W ;bitpos:[8:0] ;default: 9'h8 ; */ +/*description: */ +#define RTC_CNTL_WIFI_WAIT_TIMER 0x000001FF +#define RTC_CNTL_WIFI_WAIT_TIMER_M ((RTC_CNTL_WIFI_WAIT_TIMER_V)<<(RTC_CNTL_WIFI_WAIT_TIMER_S)) +#define RTC_CNTL_WIFI_WAIT_TIMER_V 0x1FF +#define RTC_CNTL_WIFI_WAIT_TIMER_S 0 + +#define RTC_CNTL_TIMER4_REG (DR_REG_RTCCNTL_BASE + 0x0028) +/* RTC_CNTL_DG_WRAP_POWERUP_TIMER : R/W ;bitpos:[31:25] ;default: 7'h8 ; */ +/*description: */ +#define RTC_CNTL_DG_WRAP_POWERUP_TIMER 0x0000007F +#define RTC_CNTL_DG_WRAP_POWERUP_TIMER_M ((RTC_CNTL_DG_WRAP_POWERUP_TIMER_V)<<(RTC_CNTL_DG_WRAP_POWERUP_TIMER_S)) +#define RTC_CNTL_DG_WRAP_POWERUP_TIMER_V 0x7F +#define RTC_CNTL_DG_WRAP_POWERUP_TIMER_S 25 +/* RTC_CNTL_DG_WRAP_WAIT_TIMER : R/W ;bitpos:[24:16] ;default: 9'h20 ; */ +/*description: */ +#define RTC_CNTL_DG_WRAP_WAIT_TIMER 0x000001FF +#define RTC_CNTL_DG_WRAP_WAIT_TIMER_M ((RTC_CNTL_DG_WRAP_WAIT_TIMER_V)<<(RTC_CNTL_DG_WRAP_WAIT_TIMER_S)) +#define RTC_CNTL_DG_WRAP_WAIT_TIMER_V 0x1FF +#define RTC_CNTL_DG_WRAP_WAIT_TIMER_S 16 +/* RTC_CNTL_POWERUP_TIMER : R/W ;bitpos:[15:9] ;default: 7'h5 ; */ +/*description: */ +#define RTC_CNTL_POWERUP_TIMER 0x0000007F +#define RTC_CNTL_POWERUP_TIMER_M ((RTC_CNTL_POWERUP_TIMER_V)<<(RTC_CNTL_POWERUP_TIMER_S)) +#define RTC_CNTL_POWERUP_TIMER_V 0x7F +#define RTC_CNTL_POWERUP_TIMER_S 9 +/* RTC_CNTL_WAIT_TIMER : R/W ;bitpos:[8:0] ;default: 9'h8 ; */ +/*description: */ +#define RTC_CNTL_WAIT_TIMER 0x000001FF +#define RTC_CNTL_WAIT_TIMER_M ((RTC_CNTL_WAIT_TIMER_V)<<(RTC_CNTL_WAIT_TIMER_S)) +#define RTC_CNTL_WAIT_TIMER_V 0x1FF +#define RTC_CNTL_WAIT_TIMER_S 0 + +#define RTC_CNTL_TIMER5_REG (DR_REG_RTCCNTL_BASE + 0x002c) +/* RTC_CNTL_RTCMEM_POWERUP_TIMER : R/W ;bitpos:[31:25] ;default: 7'h9 ; */ +/*description: */ +#define RTC_CNTL_RTCMEM_POWERUP_TIMER 0x0000007F +#define RTC_CNTL_RTCMEM_POWERUP_TIMER_M ((RTC_CNTL_RTCMEM_POWERUP_TIMER_V)<<(RTC_CNTL_RTCMEM_POWERUP_TIMER_S)) +#define RTC_CNTL_RTCMEM_POWERUP_TIMER_V 0x7F +#define RTC_CNTL_RTCMEM_POWERUP_TIMER_S 25 +/* RTC_CNTL_RTCMEM_WAIT_TIMER : R/W ;bitpos:[24:16] ;default: 9'h14 ; */ +/*description: */ +#define RTC_CNTL_RTCMEM_WAIT_TIMER 0x000001FF +#define RTC_CNTL_RTCMEM_WAIT_TIMER_M ((RTC_CNTL_RTCMEM_WAIT_TIMER_V)<<(RTC_CNTL_RTCMEM_WAIT_TIMER_S)) +#define RTC_CNTL_RTCMEM_WAIT_TIMER_V 0x1FF +#define RTC_CNTL_RTCMEM_WAIT_TIMER_S 16 +/* RTC_CNTL_MIN_SLP_VAL : R/W ;bitpos:[15:8] ;default: 8'h80 ; */ +/*description: minimal sleep cycles in slow_clk_rtc*/ +#define RTC_CNTL_MIN_SLP_VAL 0x000000FF +#define RTC_CNTL_MIN_SLP_VAL_M ((RTC_CNTL_MIN_SLP_VAL_V)<<(RTC_CNTL_MIN_SLP_VAL_S)) +#define RTC_CNTL_MIN_SLP_VAL_V 0xFF +#define RTC_CNTL_MIN_SLP_VAL_S 8 +#define RTC_CNTL_MIN_SLP_VAL_MIN 2 + +#define RTC_CNTL_TIMER6_REG (DR_REG_RTCCNTL_BASE + 0x0030) +/* RTC_CNTL_DG_DCDC_POWERUP_TIMER : R/W ;bitpos:[31:25] ;default: 7'h8 ; */ +/*description: */ +#define RTC_CNTL_DG_DCDC_POWERUP_TIMER 0x0000007F +#define RTC_CNTL_DG_DCDC_POWERUP_TIMER_M ((RTC_CNTL_DG_DCDC_POWERUP_TIMER_V)<<(RTC_CNTL_DG_DCDC_POWERUP_TIMER_S)) +#define RTC_CNTL_DG_DCDC_POWERUP_TIMER_V 0x7F +#define RTC_CNTL_DG_DCDC_POWERUP_TIMER_S 25 +/* RTC_CNTL_DG_DCDC_WAIT_TIMER : R/W ;bitpos:[24:16] ;default: 9'h20 ; */ +/*description: */ +#define RTC_CNTL_DG_DCDC_WAIT_TIMER 0x000001FF +#define RTC_CNTL_DG_DCDC_WAIT_TIMER_M ((RTC_CNTL_DG_DCDC_WAIT_TIMER_V)<<(RTC_CNTL_DG_DCDC_WAIT_TIMER_S)) +#define RTC_CNTL_DG_DCDC_WAIT_TIMER_V 0x1FF +#define RTC_CNTL_DG_DCDC_WAIT_TIMER_S 16 + +#define RTC_CNTL_ANA_CONF_REG (DR_REG_RTCCNTL_BASE + 0x0034) +/* RTC_CNTL_PLL_I2C_PU : R/W ;bitpos:[31] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_PLL_I2C_PU (BIT(31)) +#define RTC_CNTL_PLL_I2C_PU_M (BIT(31)) +#define RTC_CNTL_PLL_I2C_PU_V 0x1 +#define RTC_CNTL_PLL_I2C_PU_S 31 +/* RTC_CNTL_CKGEN_I2C_PU : R/W ;bitpos:[30] ;default: 1'd0 ; */ +/*description: 1: CKGEN_I2C power up otherwise power down*/ +#define RTC_CNTL_CKGEN_I2C_PU (BIT(30)) +#define RTC_CNTL_CKGEN_I2C_PU_M (BIT(30)) +#define RTC_CNTL_CKGEN_I2C_PU_V 0x1 +#define RTC_CNTL_CKGEN_I2C_PU_S 30 +/* RTC_CNTL_RFRX_PBUS_PU : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: 1: RFRX_PBUS power up otherwise power down*/ +#define RTC_CNTL_RFRX_PBUS_PU (BIT(28)) +#define RTC_CNTL_RFRX_PBUS_PU_M (BIT(28)) +#define RTC_CNTL_RFRX_PBUS_PU_V 0x1 +#define RTC_CNTL_RFRX_PBUS_PU_S 28 +/* RTC_CNTL_TXRF_I2C_PU : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: 1: TXRF_I2C power up otherwise power down*/ +#define RTC_CNTL_TXRF_I2C_PU (BIT(27)) +#define RTC_CNTL_TXRF_I2C_PU_M (BIT(27)) +#define RTC_CNTL_TXRF_I2C_PU_V 0x1 +#define RTC_CNTL_TXRF_I2C_PU_S 27 +/* RTC_CNTL_PVTMON_PU : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: 1: PVTMON power up otherwise power down*/ +#define RTC_CNTL_PVTMON_PU (BIT(26)) +#define RTC_CNTL_PVTMON_PU_M (BIT(26)) +#define RTC_CNTL_PVTMON_PU_V 0x1 +#define RTC_CNTL_PVTMON_PU_S 26 +/* RTC_CNTL_BBPLL_CAL_SLP_START : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: start BBPLL calibration during sleep*/ +#define RTC_CNTL_BBPLL_CAL_SLP_START (BIT(25)) +#define RTC_CNTL_BBPLL_CAL_SLP_START_M (BIT(25)) +#define RTC_CNTL_BBPLL_CAL_SLP_START_V 0x1 +#define RTC_CNTL_BBPLL_CAL_SLP_START_S 25 +/* RTC_CNTL_PLLA_FORCE_PU : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: PLLA force power up*/ +#define RTC_CNTL_PLLA_FORCE_PU (BIT(24)) +#define RTC_CNTL_PLLA_FORCE_PU_M (BIT(24)) +#define RTC_CNTL_PLLA_FORCE_PU_V 0x1 +#define RTC_CNTL_PLLA_FORCE_PU_S 24 +/* RTC_CNTL_PLLA_FORCE_PD : R/W ;bitpos:[23] ;default: 1'b1 ; */ +/*description: PLLA force power down*/ +#define RTC_CNTL_PLLA_FORCE_PD (BIT(23)) +#define RTC_CNTL_PLLA_FORCE_PD_M (BIT(23)) +#define RTC_CNTL_PLLA_FORCE_PD_V 0x1 +#define RTC_CNTL_PLLA_FORCE_PD_S 23 + +#define RTC_CNTL_RESET_STATE_REG (DR_REG_RTCCNTL_BASE + 0x0038) +/* RTC_CNTL_PROCPU_STAT_VECTOR_SEL : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: PRO CPU state vector sel*/ +#define RTC_CNTL_PROCPU_STAT_VECTOR_SEL (BIT(13)) +#define RTC_CNTL_PROCPU_STAT_VECTOR_SEL_M (BIT(13)) +#define RTC_CNTL_PROCPU_STAT_VECTOR_SEL_V 0x1 +#define RTC_CNTL_PROCPU_STAT_VECTOR_SEL_S 13 +/* RTC_CNTL_APPCPU_STAT_VECTOR_SEL : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: APP CPU state vector sel*/ +#define RTC_CNTL_APPCPU_STAT_VECTOR_SEL (BIT(12)) +#define RTC_CNTL_APPCPU_STAT_VECTOR_SEL_M (BIT(12)) +#define RTC_CNTL_APPCPU_STAT_VECTOR_SEL_V 0x1 +#define RTC_CNTL_APPCPU_STAT_VECTOR_SEL_S 12 +/* RTC_CNTL_RESET_CAUSE_APPCPU : RO ;bitpos:[11:6] ;default: 0 ; */ +/*description: reset cause of APP CPU*/ +#define RTC_CNTL_RESET_CAUSE_APPCPU 0x0000003F +#define RTC_CNTL_RESET_CAUSE_APPCPU_M ((RTC_CNTL_RESET_CAUSE_APPCPU_V)<<(RTC_CNTL_RESET_CAUSE_APPCPU_S)) +#define RTC_CNTL_RESET_CAUSE_APPCPU_V 0x3F +#define RTC_CNTL_RESET_CAUSE_APPCPU_S 6 +/* RTC_CNTL_RESET_CAUSE_PROCPU : RO ;bitpos:[5:0] ;default: 0 ; */ +/*description: reset cause of PRO CPU*/ +#define RTC_CNTL_RESET_CAUSE_PROCPU 0x0000003F +#define RTC_CNTL_RESET_CAUSE_PROCPU_M ((RTC_CNTL_RESET_CAUSE_PROCPU_V)<<(RTC_CNTL_RESET_CAUSE_PROCPU_S)) +#define RTC_CNTL_RESET_CAUSE_PROCPU_V 0x3F +#define RTC_CNTL_RESET_CAUSE_PROCPU_S 0 + +#define RTC_CNTL_WAKEUP_STATE_REG (DR_REG_RTCCNTL_BASE + 0x003c) +/* RTC_CNTL_GPIO_WAKEUP_FILTER : R/W ;bitpos:[30] ;default: 1'd0 ; */ +/*description: enable filter for gpio wakeup event*/ +#define RTC_CNTL_GPIO_WAKEUP_FILTER (BIT(30)) +#define RTC_CNTL_GPIO_WAKEUP_FILTER_M (BIT(30)) +#define RTC_CNTL_GPIO_WAKEUP_FILTER_V 0x1 +#define RTC_CNTL_GPIO_WAKEUP_FILTER_S 30 +/* RTC_CNTL_WAKEUP_ENA : R/W ;bitpos:[29:15] ;default: 15'b1100 ; */ +/*description: wakeup enable bitmap*/ +#define RTC_CNTL_WAKEUP_ENA 0x00007FFF +#define RTC_CNTL_WAKEUP_ENA_M ((RTC_CNTL_WAKEUP_ENA_V)<<(RTC_CNTL_WAKEUP_ENA_S)) +#define RTC_CNTL_WAKEUP_ENA_V 0x7FFF +#define RTC_CNTL_WAKEUP_ENA_S 15 +/* RTC_CNTL_WAKEUP_CAUSE : RO ;bitpos:[14:0] ;default: 15'h0 ; */ +/*description: wakeup cause*/ +#define RTC_CNTL_WAKEUP_CAUSE 0x00007FFF +#define RTC_CNTL_WAKEUP_CAUSE_M ((RTC_CNTL_WAKEUP_CAUSE_V)<<(RTC_CNTL_WAKEUP_CAUSE_S)) +#define RTC_CNTL_WAKEUP_CAUSE_V 0x7FFF +#define RTC_CNTL_WAKEUP_CAUSE_S 0 + +#define RTC_CNTL_INT_ENA_REG (DR_REG_RTCCNTL_BASE + 0x0040) +/* RTC_CNTL_COCPU_TRAP_INT_ENA : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_COCPU_TRAP_INT_ENA (BIT(17)) +#define RTC_CNTL_COCPU_TRAP_INT_ENA_M (BIT(17)) +#define RTC_CNTL_COCPU_TRAP_INT_ENA_V 0x1 +#define RTC_CNTL_COCPU_TRAP_INT_ENA_S 17 +/* RTC_CNTL_XTAL32K_DEAD_INT_ENA : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: enable cocpu trap interrupt*/ +#define RTC_CNTL_XTAL32K_DEAD_INT_ENA (BIT(16)) +#define RTC_CNTL_XTAL32K_DEAD_INT_ENA_M (BIT(16)) +#define RTC_CNTL_XTAL32K_DEAD_INT_ENA_V 0x1 +#define RTC_CNTL_XTAL32K_DEAD_INT_ENA_S 16 +/* RTC_CNTL_SWD_INT_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: enable super watch dog interrupt*/ +#define RTC_CNTL_SWD_INT_ENA (BIT(15)) +#define RTC_CNTL_SWD_INT_ENA_M (BIT(15)) +#define RTC_CNTL_SWD_INT_ENA_V 0x1 +#define RTC_CNTL_SWD_INT_ENA_S 15 +/* RTC_CNTL_SARADC2_INT_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: enable saradc2 interrupt*/ +#define RTC_CNTL_SARADC2_INT_ENA (BIT(14)) +#define RTC_CNTL_SARADC2_INT_ENA_M (BIT(14)) +#define RTC_CNTL_SARADC2_INT_ENA_V 0x1 +#define RTC_CNTL_SARADC2_INT_ENA_S 14 +/* RTC_CNTL_COCPU_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: enable riscV cocpu interrupt*/ +#define RTC_CNTL_COCPU_INT_ENA (BIT(13)) +#define RTC_CNTL_COCPU_INT_ENA_M (BIT(13)) +#define RTC_CNTL_COCPU_INT_ENA_V 0x1 +#define RTC_CNTL_COCPU_INT_ENA_S 13 +/* RTC_CNTL_TSENS_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: enable tsens interrupt*/ +#define RTC_CNTL_TSENS_INT_ENA (BIT(12)) +#define RTC_CNTL_TSENS_INT_ENA_M (BIT(12)) +#define RTC_CNTL_TSENS_INT_ENA_V 0x1 +#define RTC_CNTL_TSENS_INT_ENA_S 12 +/* RTC_CNTL_SARADC1_INT_ENA : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: enable saradc1 interrupt*/ +#define RTC_CNTL_SARADC1_INT_ENA (BIT(11)) +#define RTC_CNTL_SARADC1_INT_ENA_M (BIT(11)) +#define RTC_CNTL_SARADC1_INT_ENA_V 0x1 +#define RTC_CNTL_SARADC1_INT_ENA_S 11 +/* RTC_CNTL_MAIN_TIMER_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: enable RTC main timer interrupt*/ +#define RTC_CNTL_MAIN_TIMER_INT_ENA (BIT(10)) +#define RTC_CNTL_MAIN_TIMER_INT_ENA_M (BIT(10)) +#define RTC_CNTL_MAIN_TIMER_INT_ENA_V 0x1 +#define RTC_CNTL_MAIN_TIMER_INT_ENA_S 10 +/* RTC_CNTL_BROWN_OUT_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: enable brown out interrupt*/ +#define RTC_CNTL_BROWN_OUT_INT_ENA (BIT(9)) +#define RTC_CNTL_BROWN_OUT_INT_ENA_M (BIT(9)) +#define RTC_CNTL_BROWN_OUT_INT_ENA_V 0x1 +#define RTC_CNTL_BROWN_OUT_INT_ENA_S 9 +/* RTC_CNTL_TOUCH_INACTIVE_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: enable touch inactive interrupt*/ +#define RTC_CNTL_TOUCH_INACTIVE_INT_ENA (BIT(8)) +#define RTC_CNTL_TOUCH_INACTIVE_INT_ENA_M (BIT(8)) +#define RTC_CNTL_TOUCH_INACTIVE_INT_ENA_V 0x1 +#define RTC_CNTL_TOUCH_INACTIVE_INT_ENA_S 8 +/* RTC_CNTL_TOUCH_ACTIVE_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: enable touch active interrupt*/ +#define RTC_CNTL_TOUCH_ACTIVE_INT_ENA (BIT(7)) +#define RTC_CNTL_TOUCH_ACTIVE_INT_ENA_M (BIT(7)) +#define RTC_CNTL_TOUCH_ACTIVE_INT_ENA_V 0x1 +#define RTC_CNTL_TOUCH_ACTIVE_INT_ENA_S 7 +/* RTC_CNTL_TOUCH_DONE_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: enable touch done interrupt*/ +#define RTC_CNTL_TOUCH_DONE_INT_ENA (BIT(6)) +#define RTC_CNTL_TOUCH_DONE_INT_ENA_M (BIT(6)) +#define RTC_CNTL_TOUCH_DONE_INT_ENA_V 0x1 +#define RTC_CNTL_TOUCH_DONE_INT_ENA_S 6 +/* RTC_CNTL_ULP_CP_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: enable ULP-coprocessor interrupt*/ +#define RTC_CNTL_ULP_CP_INT_ENA (BIT(5)) +#define RTC_CNTL_ULP_CP_INT_ENA_M (BIT(5)) +#define RTC_CNTL_ULP_CP_INT_ENA_V 0x1 +#define RTC_CNTL_ULP_CP_INT_ENA_S 5 +/* RTC_CNTL_TIME_VALID_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: enable RTC time valid interrupt*/ +#define RTC_CNTL_TIME_VALID_INT_ENA (BIT(4)) +#define RTC_CNTL_TIME_VALID_INT_ENA_M (BIT(4)) +#define RTC_CNTL_TIME_VALID_INT_ENA_V 0x1 +#define RTC_CNTL_TIME_VALID_INT_ENA_S 4 +/* RTC_CNTL_WDT_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: enable RTC WDT interrupt*/ +#define RTC_CNTL_WDT_INT_ENA (BIT(3)) +#define RTC_CNTL_WDT_INT_ENA_M (BIT(3)) +#define RTC_CNTL_WDT_INT_ENA_V 0x1 +#define RTC_CNTL_WDT_INT_ENA_S 3 +/* RTC_CNTL_SDIO_IDLE_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: enable SDIO idle interrupt*/ +#define RTC_CNTL_SDIO_IDLE_INT_ENA (BIT(2)) +#define RTC_CNTL_SDIO_IDLE_INT_ENA_M (BIT(2)) +#define RTC_CNTL_SDIO_IDLE_INT_ENA_V 0x1 +#define RTC_CNTL_SDIO_IDLE_INT_ENA_S 2 +/* RTC_CNTL_SLP_REJECT_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: enable sleep reject interrupt*/ +#define RTC_CNTL_SLP_REJECT_INT_ENA (BIT(1)) +#define RTC_CNTL_SLP_REJECT_INT_ENA_M (BIT(1)) +#define RTC_CNTL_SLP_REJECT_INT_ENA_V 0x1 +#define RTC_CNTL_SLP_REJECT_INT_ENA_S 1 +/* RTC_CNTL_SLP_WAKEUP_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: enable sleep wakeup interrupt*/ +#define RTC_CNTL_SLP_WAKEUP_INT_ENA (BIT(0)) +#define RTC_CNTL_SLP_WAKEUP_INT_ENA_M (BIT(0)) +#define RTC_CNTL_SLP_WAKEUP_INT_ENA_V 0x1 +#define RTC_CNTL_SLP_WAKEUP_INT_ENA_S 0 + +#define RTC_CNTL_INT_RAW_REG (DR_REG_RTCCNTL_BASE + 0x0044) +/* RTC_CNTL_COCPU_TRAP_INT_RAW : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: cocpu trap interrupt raw*/ +#define RTC_CNTL_COCPU_TRAP_INT_RAW (BIT(17)) +#define RTC_CNTL_COCPU_TRAP_INT_RAW_M (BIT(17)) +#define RTC_CNTL_COCPU_TRAP_INT_RAW_V 0x1 +#define RTC_CNTL_COCPU_TRAP_INT_RAW_S 17 +/* RTC_CNTL_XTAL32K_DEAD_INT_RAW : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: xtal32k dead detection interrupt raw*/ +#define RTC_CNTL_XTAL32K_DEAD_INT_RAW (BIT(16)) +#define RTC_CNTL_XTAL32K_DEAD_INT_RAW_M (BIT(16)) +#define RTC_CNTL_XTAL32K_DEAD_INT_RAW_V 0x1 +#define RTC_CNTL_XTAL32K_DEAD_INT_RAW_S 16 +/* RTC_CNTL_SWD_INT_RAW : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: super watch dog interrupt raw*/ +#define RTC_CNTL_SWD_INT_RAW (BIT(15)) +#define RTC_CNTL_SWD_INT_RAW_M (BIT(15)) +#define RTC_CNTL_SWD_INT_RAW_V 0x1 +#define RTC_CNTL_SWD_INT_RAW_S 15 +/* RTC_CNTL_SARADC2_INT_RAW : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: saradc2 interrupt raw*/ +#define RTC_CNTL_SARADC2_INT_RAW (BIT(14)) +#define RTC_CNTL_SARADC2_INT_RAW_M (BIT(14)) +#define RTC_CNTL_SARADC2_INT_RAW_V 0x1 +#define RTC_CNTL_SARADC2_INT_RAW_S 14 +/* RTC_CNTL_COCPU_INT_RAW : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: riscV cocpu interrupt raw*/ +#define RTC_CNTL_COCPU_INT_RAW (BIT(13)) +#define RTC_CNTL_COCPU_INT_RAW_M (BIT(13)) +#define RTC_CNTL_COCPU_INT_RAW_V 0x1 +#define RTC_CNTL_COCPU_INT_RAW_S 13 +/* RTC_CNTL_TSENS_INT_RAW : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: tsens interrupt raw*/ +#define RTC_CNTL_TSENS_INT_RAW (BIT(12)) +#define RTC_CNTL_TSENS_INT_RAW_M (BIT(12)) +#define RTC_CNTL_TSENS_INT_RAW_V 0x1 +#define RTC_CNTL_TSENS_INT_RAW_S 12 +/* RTC_CNTL_SARADC1_INT_RAW : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: saradc1 interrupt raw*/ +#define RTC_CNTL_SARADC1_INT_RAW (BIT(11)) +#define RTC_CNTL_SARADC1_INT_RAW_M (BIT(11)) +#define RTC_CNTL_SARADC1_INT_RAW_V 0x1 +#define RTC_CNTL_SARADC1_INT_RAW_S 11 +/* RTC_CNTL_MAIN_TIMER_INT_RAW : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: RTC main timer interrupt raw*/ +#define RTC_CNTL_MAIN_TIMER_INT_RAW (BIT(10)) +#define RTC_CNTL_MAIN_TIMER_INT_RAW_M (BIT(10)) +#define RTC_CNTL_MAIN_TIMER_INT_RAW_V 0x1 +#define RTC_CNTL_MAIN_TIMER_INT_RAW_S 10 +/* RTC_CNTL_BROWN_OUT_INT_RAW : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: brown out interrupt raw*/ +#define RTC_CNTL_BROWN_OUT_INT_RAW (BIT(9)) +#define RTC_CNTL_BROWN_OUT_INT_RAW_M (BIT(9)) +#define RTC_CNTL_BROWN_OUT_INT_RAW_V 0x1 +#define RTC_CNTL_BROWN_OUT_INT_RAW_S 9 +/* RTC_CNTL_TOUCH_INACTIVE_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: touch inactive interrupt raw*/ +#define RTC_CNTL_TOUCH_INACTIVE_INT_RAW (BIT(8)) +#define RTC_CNTL_TOUCH_INACTIVE_INT_RAW_M (BIT(8)) +#define RTC_CNTL_TOUCH_INACTIVE_INT_RAW_V 0x1 +#define RTC_CNTL_TOUCH_INACTIVE_INT_RAW_S 8 +/* RTC_CNTL_TOUCH_ACTIVE_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: touch active interrupt raw*/ +#define RTC_CNTL_TOUCH_ACTIVE_INT_RAW (BIT(7)) +#define RTC_CNTL_TOUCH_ACTIVE_INT_RAW_M (BIT(7)) +#define RTC_CNTL_TOUCH_ACTIVE_INT_RAW_V 0x1 +#define RTC_CNTL_TOUCH_ACTIVE_INT_RAW_S 7 +/* RTC_CNTL_TOUCH_DONE_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: touch interrupt raw*/ +#define RTC_CNTL_TOUCH_DONE_INT_RAW (BIT(6)) +#define RTC_CNTL_TOUCH_DONE_INT_RAW_M (BIT(6)) +#define RTC_CNTL_TOUCH_DONE_INT_RAW_V 0x1 +#define RTC_CNTL_TOUCH_DONE_INT_RAW_S 6 +/* RTC_CNTL_ULP_CP_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: ULP-coprocessor interrupt raw*/ +#define RTC_CNTL_ULP_CP_INT_RAW (BIT(5)) +#define RTC_CNTL_ULP_CP_INT_RAW_M (BIT(5)) +#define RTC_CNTL_ULP_CP_INT_RAW_V 0x1 +#define RTC_CNTL_ULP_CP_INT_RAW_S 5 +/* RTC_CNTL_TIME_VALID_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: RTC time valid interrupt raw*/ +#define RTC_CNTL_TIME_VALID_INT_RAW (BIT(4)) +#define RTC_CNTL_TIME_VALID_INT_RAW_M (BIT(4)) +#define RTC_CNTL_TIME_VALID_INT_RAW_V 0x1 +#define RTC_CNTL_TIME_VALID_INT_RAW_S 4 +/* RTC_CNTL_WDT_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: RTC WDT interrupt raw*/ +#define RTC_CNTL_WDT_INT_RAW (BIT(3)) +#define RTC_CNTL_WDT_INT_RAW_M (BIT(3)) +#define RTC_CNTL_WDT_INT_RAW_V 0x1 +#define RTC_CNTL_WDT_INT_RAW_S 3 +/* RTC_CNTL_SDIO_IDLE_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: SDIO idle interrupt raw*/ +#define RTC_CNTL_SDIO_IDLE_INT_RAW (BIT(2)) +#define RTC_CNTL_SDIO_IDLE_INT_RAW_M (BIT(2)) +#define RTC_CNTL_SDIO_IDLE_INT_RAW_V 0x1 +#define RTC_CNTL_SDIO_IDLE_INT_RAW_S 2 +/* RTC_CNTL_SLP_REJECT_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: sleep reject interrupt raw*/ +#define RTC_CNTL_SLP_REJECT_INT_RAW (BIT(1)) +#define RTC_CNTL_SLP_REJECT_INT_RAW_M (BIT(1)) +#define RTC_CNTL_SLP_REJECT_INT_RAW_V 0x1 +#define RTC_CNTL_SLP_REJECT_INT_RAW_S 1 +/* RTC_CNTL_SLP_WAKEUP_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: sleep wakeup interrupt raw*/ +#define RTC_CNTL_SLP_WAKEUP_INT_RAW (BIT(0)) +#define RTC_CNTL_SLP_WAKEUP_INT_RAW_M (BIT(0)) +#define RTC_CNTL_SLP_WAKEUP_INT_RAW_V 0x1 +#define RTC_CNTL_SLP_WAKEUP_INT_RAW_S 0 + +#define RTC_CNTL_INT_ST_REG (DR_REG_RTCCNTL_BASE + 0x0048) +/* RTC_CNTL_COCPU_TRAP_INT_ST : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: cocpu trap interrupt state*/ +#define RTC_CNTL_COCPU_TRAP_INT_ST (BIT(17)) +#define RTC_CNTL_COCPU_TRAP_INT_ST_M (BIT(17)) +#define RTC_CNTL_COCPU_TRAP_INT_ST_V 0x1 +#define RTC_CNTL_COCPU_TRAP_INT_ST_S 17 +/* RTC_CNTL_XTAL32K_DEAD_INT_ST : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: xtal32k dead detection interrupt state*/ +#define RTC_CNTL_XTAL32K_DEAD_INT_ST (BIT(16)) +#define RTC_CNTL_XTAL32K_DEAD_INT_ST_M (BIT(16)) +#define RTC_CNTL_XTAL32K_DEAD_INT_ST_V 0x1 +#define RTC_CNTL_XTAL32K_DEAD_INT_ST_S 16 +/* RTC_CNTL_SWD_INT_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: super watch dog interrupt state*/ +#define RTC_CNTL_SWD_INT_ST (BIT(15)) +#define RTC_CNTL_SWD_INT_ST_M (BIT(15)) +#define RTC_CNTL_SWD_INT_ST_V 0x1 +#define RTC_CNTL_SWD_INT_ST_S 15 +/* RTC_CNTL_SARADC2_INT_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: saradc2 interrupt state*/ +#define RTC_CNTL_SARADC2_INT_ST (BIT(14)) +#define RTC_CNTL_SARADC2_INT_ST_M (BIT(14)) +#define RTC_CNTL_SARADC2_INT_ST_V 0x1 +#define RTC_CNTL_SARADC2_INT_ST_S 14 +/* RTC_CNTL_COCPU_INT_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: riscV cocpu interrupt state*/ +#define RTC_CNTL_COCPU_INT_ST (BIT(13)) +#define RTC_CNTL_COCPU_INT_ST_M (BIT(13)) +#define RTC_CNTL_COCPU_INT_ST_V 0x1 +#define RTC_CNTL_COCPU_INT_ST_S 13 +/* RTC_CNTL_TSENS_INT_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: tsens interrupt state*/ +#define RTC_CNTL_TSENS_INT_ST (BIT(12)) +#define RTC_CNTL_TSENS_INT_ST_M (BIT(12)) +#define RTC_CNTL_TSENS_INT_ST_V 0x1 +#define RTC_CNTL_TSENS_INT_ST_S 12 +/* RTC_CNTL_SARADC1_INT_ST : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: saradc1 interrupt state*/ +#define RTC_CNTL_SARADC1_INT_ST (BIT(11)) +#define RTC_CNTL_SARADC1_INT_ST_M (BIT(11)) +#define RTC_CNTL_SARADC1_INT_ST_V 0x1 +#define RTC_CNTL_SARADC1_INT_ST_S 11 +/* RTC_CNTL_MAIN_TIMER_INT_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: RTC main timer interrupt state*/ +#define RTC_CNTL_MAIN_TIMER_INT_ST (BIT(10)) +#define RTC_CNTL_MAIN_TIMER_INT_ST_M (BIT(10)) +#define RTC_CNTL_MAIN_TIMER_INT_ST_V 0x1 +#define RTC_CNTL_MAIN_TIMER_INT_ST_S 10 +/* RTC_CNTL_BROWN_OUT_INT_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: brown out interrupt state*/ +#define RTC_CNTL_BROWN_OUT_INT_ST (BIT(9)) +#define RTC_CNTL_BROWN_OUT_INT_ST_M (BIT(9)) +#define RTC_CNTL_BROWN_OUT_INT_ST_V 0x1 +#define RTC_CNTL_BROWN_OUT_INT_ST_S 9 +/* RTC_CNTL_TOUCH_INACTIVE_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: touch inactive interrupt state*/ +#define RTC_CNTL_TOUCH_INACTIVE_INT_ST (BIT(8)) +#define RTC_CNTL_TOUCH_INACTIVE_INT_ST_M (BIT(8)) +#define RTC_CNTL_TOUCH_INACTIVE_INT_ST_V 0x1 +#define RTC_CNTL_TOUCH_INACTIVE_INT_ST_S 8 +/* RTC_CNTL_TOUCH_ACTIVE_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: touch active interrupt state*/ +#define RTC_CNTL_TOUCH_ACTIVE_INT_ST (BIT(7)) +#define RTC_CNTL_TOUCH_ACTIVE_INT_ST_M (BIT(7)) +#define RTC_CNTL_TOUCH_ACTIVE_INT_ST_V 0x1 +#define RTC_CNTL_TOUCH_ACTIVE_INT_ST_S 7 +/* RTC_CNTL_TOUCH_DONE_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: touch done interrupt state*/ +#define RTC_CNTL_TOUCH_DONE_INT_ST (BIT(6)) +#define RTC_CNTL_TOUCH_DONE_INT_ST_M (BIT(6)) +#define RTC_CNTL_TOUCH_DONE_INT_ST_V 0x1 +#define RTC_CNTL_TOUCH_DONE_INT_ST_S 6 +/* RTC_CNTL_ULP_CP_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: ULP-coprocessor interrupt state*/ +#define RTC_CNTL_ULP_CP_INT_ST (BIT(5)) +#define RTC_CNTL_ULP_CP_INT_ST_M (BIT(5)) +#define RTC_CNTL_ULP_CP_INT_ST_V 0x1 +#define RTC_CNTL_ULP_CP_INT_ST_S 5 +/* RTC_CNTL_TIME_VALID_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: RTC time valid interrupt state*/ +#define RTC_CNTL_TIME_VALID_INT_ST (BIT(4)) +#define RTC_CNTL_TIME_VALID_INT_ST_M (BIT(4)) +#define RTC_CNTL_TIME_VALID_INT_ST_V 0x1 +#define RTC_CNTL_TIME_VALID_INT_ST_S 4 +/* RTC_CNTL_WDT_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: RTC WDT interrupt state*/ +#define RTC_CNTL_WDT_INT_ST (BIT(3)) +#define RTC_CNTL_WDT_INT_ST_M (BIT(3)) +#define RTC_CNTL_WDT_INT_ST_V 0x1 +#define RTC_CNTL_WDT_INT_ST_S 3 +/* RTC_CNTL_SDIO_IDLE_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: SDIO idle interrupt state*/ +#define RTC_CNTL_SDIO_IDLE_INT_ST (BIT(2)) +#define RTC_CNTL_SDIO_IDLE_INT_ST_M (BIT(2)) +#define RTC_CNTL_SDIO_IDLE_INT_ST_V 0x1 +#define RTC_CNTL_SDIO_IDLE_INT_ST_S 2 +/* RTC_CNTL_SLP_REJECT_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: sleep reject interrupt state*/ +#define RTC_CNTL_SLP_REJECT_INT_ST (BIT(1)) +#define RTC_CNTL_SLP_REJECT_INT_ST_M (BIT(1)) +#define RTC_CNTL_SLP_REJECT_INT_ST_V 0x1 +#define RTC_CNTL_SLP_REJECT_INT_ST_S 1 +/* RTC_CNTL_SLP_WAKEUP_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: sleep wakeup interrupt state*/ +#define RTC_CNTL_SLP_WAKEUP_INT_ST (BIT(0)) +#define RTC_CNTL_SLP_WAKEUP_INT_ST_M (BIT(0)) +#define RTC_CNTL_SLP_WAKEUP_INT_ST_V 0x1 +#define RTC_CNTL_SLP_WAKEUP_INT_ST_S 0 + +#define RTC_CNTL_INT_CLR_REG (DR_REG_RTCCNTL_BASE + 0x004c) +/* RTC_CNTL_COCPU_TRAP_INT_CLR : WO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: Clear cocpu trap interrupt state*/ +#define RTC_CNTL_COCPU_TRAP_INT_CLR (BIT(17)) +#define RTC_CNTL_COCPU_TRAP_INT_CLR_M (BIT(17)) +#define RTC_CNTL_COCPU_TRAP_INT_CLR_V 0x1 +#define RTC_CNTL_COCPU_TRAP_INT_CLR_S 17 +/* RTC_CNTL_XTAL32K_DEAD_INT_CLR : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: Clear RTC WDT interrupt state*/ +#define RTC_CNTL_XTAL32K_DEAD_INT_CLR (BIT(16)) +#define RTC_CNTL_XTAL32K_DEAD_INT_CLR_M (BIT(16)) +#define RTC_CNTL_XTAL32K_DEAD_INT_CLR_V 0x1 +#define RTC_CNTL_XTAL32K_DEAD_INT_CLR_S 16 +/* RTC_CNTL_SWD_INT_CLR : WO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: Clear super watch dog interrupt state*/ +#define RTC_CNTL_SWD_INT_CLR (BIT(15)) +#define RTC_CNTL_SWD_INT_CLR_M (BIT(15)) +#define RTC_CNTL_SWD_INT_CLR_V 0x1 +#define RTC_CNTL_SWD_INT_CLR_S 15 +/* RTC_CNTL_SARADC2_INT_CLR : WO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: Clear saradc2 interrupt state*/ +#define RTC_CNTL_SARADC2_INT_CLR (BIT(14)) +#define RTC_CNTL_SARADC2_INT_CLR_M (BIT(14)) +#define RTC_CNTL_SARADC2_INT_CLR_V 0x1 +#define RTC_CNTL_SARADC2_INT_CLR_S 14 +/* RTC_CNTL_COCPU_INT_CLR : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: Clear riscV cocpu interrupt state*/ +#define RTC_CNTL_COCPU_INT_CLR (BIT(13)) +#define RTC_CNTL_COCPU_INT_CLR_M (BIT(13)) +#define RTC_CNTL_COCPU_INT_CLR_V 0x1 +#define RTC_CNTL_COCPU_INT_CLR_S 13 +/* RTC_CNTL_TSENS_INT_CLR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: Clear tsens interrupt state*/ +#define RTC_CNTL_TSENS_INT_CLR (BIT(12)) +#define RTC_CNTL_TSENS_INT_CLR_M (BIT(12)) +#define RTC_CNTL_TSENS_INT_CLR_V 0x1 +#define RTC_CNTL_TSENS_INT_CLR_S 12 +/* RTC_CNTL_SARADC1_INT_CLR : WO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: Clear saradc1 interrupt state*/ +#define RTC_CNTL_SARADC1_INT_CLR (BIT(11)) +#define RTC_CNTL_SARADC1_INT_CLR_M (BIT(11)) +#define RTC_CNTL_SARADC1_INT_CLR_V 0x1 +#define RTC_CNTL_SARADC1_INT_CLR_S 11 +/* RTC_CNTL_MAIN_TIMER_INT_CLR : WO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: Clear RTC main timer interrupt state*/ +#define RTC_CNTL_MAIN_TIMER_INT_CLR (BIT(10)) +#define RTC_CNTL_MAIN_TIMER_INT_CLR_M (BIT(10)) +#define RTC_CNTL_MAIN_TIMER_INT_CLR_V 0x1 +#define RTC_CNTL_MAIN_TIMER_INT_CLR_S 10 +/* RTC_CNTL_BROWN_OUT_INT_CLR : WO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: Clear brown out interrupt state*/ +#define RTC_CNTL_BROWN_OUT_INT_CLR (BIT(9)) +#define RTC_CNTL_BROWN_OUT_INT_CLR_M (BIT(9)) +#define RTC_CNTL_BROWN_OUT_INT_CLR_V 0x1 +#define RTC_CNTL_BROWN_OUT_INT_CLR_S 9 +/* RTC_CNTL_TOUCH_INACTIVE_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: Clear touch inactive interrupt state*/ +#define RTC_CNTL_TOUCH_INACTIVE_INT_CLR (BIT(8)) +#define RTC_CNTL_TOUCH_INACTIVE_INT_CLR_M (BIT(8)) +#define RTC_CNTL_TOUCH_INACTIVE_INT_CLR_V 0x1 +#define RTC_CNTL_TOUCH_INACTIVE_INT_CLR_S 8 +/* RTC_CNTL_TOUCH_ACTIVE_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: Clear touch active interrupt state*/ +#define RTC_CNTL_TOUCH_ACTIVE_INT_CLR (BIT(7)) +#define RTC_CNTL_TOUCH_ACTIVE_INT_CLR_M (BIT(7)) +#define RTC_CNTL_TOUCH_ACTIVE_INT_CLR_V 0x1 +#define RTC_CNTL_TOUCH_ACTIVE_INT_CLR_S 7 +/* RTC_CNTL_TOUCH_DONE_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: Clear touch done interrupt state*/ +#define RTC_CNTL_TOUCH_DONE_INT_CLR (BIT(6)) +#define RTC_CNTL_TOUCH_DONE_INT_CLR_M (BIT(6)) +#define RTC_CNTL_TOUCH_DONE_INT_CLR_V 0x1 +#define RTC_CNTL_TOUCH_DONE_INT_CLR_S 6 +/* RTC_CNTL_ULP_CP_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: Clear ULP-coprocessor interrupt state*/ +#define RTC_CNTL_ULP_CP_INT_CLR (BIT(5)) +#define RTC_CNTL_ULP_CP_INT_CLR_M (BIT(5)) +#define RTC_CNTL_ULP_CP_INT_CLR_V 0x1 +#define RTC_CNTL_ULP_CP_INT_CLR_S 5 +/* RTC_CNTL_TIME_VALID_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: Clear RTC time valid interrupt state*/ +#define RTC_CNTL_TIME_VALID_INT_CLR (BIT(4)) +#define RTC_CNTL_TIME_VALID_INT_CLR_M (BIT(4)) +#define RTC_CNTL_TIME_VALID_INT_CLR_V 0x1 +#define RTC_CNTL_TIME_VALID_INT_CLR_S 4 +/* RTC_CNTL_WDT_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: Clear RTC WDT interrupt state*/ +#define RTC_CNTL_WDT_INT_CLR (BIT(3)) +#define RTC_CNTL_WDT_INT_CLR_M (BIT(3)) +#define RTC_CNTL_WDT_INT_CLR_V 0x1 +#define RTC_CNTL_WDT_INT_CLR_S 3 +/* RTC_CNTL_SDIO_IDLE_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: Clear SDIO idle interrupt state*/ +#define RTC_CNTL_SDIO_IDLE_INT_CLR (BIT(2)) +#define RTC_CNTL_SDIO_IDLE_INT_CLR_M (BIT(2)) +#define RTC_CNTL_SDIO_IDLE_INT_CLR_V 0x1 +#define RTC_CNTL_SDIO_IDLE_INT_CLR_S 2 +/* RTC_CNTL_SLP_REJECT_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: Clear sleep reject interrupt state*/ +#define RTC_CNTL_SLP_REJECT_INT_CLR (BIT(1)) +#define RTC_CNTL_SLP_REJECT_INT_CLR_M (BIT(1)) +#define RTC_CNTL_SLP_REJECT_INT_CLR_V 0x1 +#define RTC_CNTL_SLP_REJECT_INT_CLR_S 1 +/* RTC_CNTL_SLP_WAKEUP_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: Clear sleep wakeup interrupt state*/ +#define RTC_CNTL_SLP_WAKEUP_INT_CLR (BIT(0)) +#define RTC_CNTL_SLP_WAKEUP_INT_CLR_M (BIT(0)) +#define RTC_CNTL_SLP_WAKEUP_INT_CLR_V 0x1 +#define RTC_CNTL_SLP_WAKEUP_INT_CLR_S 0 + +#define RTC_CNTL_STORE0_REG (DR_REG_RTCCNTL_BASE + 0x0050) +/* RTC_CNTL_SCRATCH0 : R/W ;bitpos:[31:0] ;default: 0 ; */ +/*description: */ +#define RTC_CNTL_SCRATCH0 0xFFFFFFFF +#define RTC_CNTL_SCRATCH0_M ((RTC_CNTL_SCRATCH0_V)<<(RTC_CNTL_SCRATCH0_S)) +#define RTC_CNTL_SCRATCH0_V 0xFFFFFFFF +#define RTC_CNTL_SCRATCH0_S 0 + +#define RTC_CNTL_STORE1_REG (DR_REG_RTCCNTL_BASE + 0x0054) +/* RTC_CNTL_SCRATCH1 : R/W ;bitpos:[31:0] ;default: 0 ; */ +/*description: */ +#define RTC_CNTL_SCRATCH1 0xFFFFFFFF +#define RTC_CNTL_SCRATCH1_M ((RTC_CNTL_SCRATCH1_V)<<(RTC_CNTL_SCRATCH1_S)) +#define RTC_CNTL_SCRATCH1_V 0xFFFFFFFF +#define RTC_CNTL_SCRATCH1_S 0 + +#define RTC_CNTL_STORE2_REG (DR_REG_RTCCNTL_BASE + 0x0058) +/* RTC_CNTL_SCRATCH2 : R/W ;bitpos:[31:0] ;default: 0 ; */ +/*description: */ +#define RTC_CNTL_SCRATCH2 0xFFFFFFFF +#define RTC_CNTL_SCRATCH2_M ((RTC_CNTL_SCRATCH2_V)<<(RTC_CNTL_SCRATCH2_S)) +#define RTC_CNTL_SCRATCH2_V 0xFFFFFFFF +#define RTC_CNTL_SCRATCH2_S 0 + +#define RTC_CNTL_STORE3_REG (DR_REG_RTCCNTL_BASE + 0x005c) +/* RTC_CNTL_SCRATCH3 : R/W ;bitpos:[31:0] ;default: 0 ; */ +/*description: */ +#define RTC_CNTL_SCRATCH3 0xFFFFFFFF +#define RTC_CNTL_SCRATCH3_M ((RTC_CNTL_SCRATCH3_V)<<(RTC_CNTL_SCRATCH3_S)) +#define RTC_CNTL_SCRATCH3_V 0xFFFFFFFF +#define RTC_CNTL_SCRATCH3_S 0 + +#define RTC_CNTL_EXT_XTL_CONF_REG (DR_REG_RTCCNTL_BASE + 0x0060) +/* RTC_CNTL_XTL_EXT_CTR_EN : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_XTL_EXT_CTR_EN (BIT(31)) +#define RTC_CNTL_XTL_EXT_CTR_EN_M (BIT(31)) +#define RTC_CNTL_XTL_EXT_CTR_EN_V 0x1 +#define RTC_CNTL_XTL_EXT_CTR_EN_S 31 +/* RTC_CNTL_XTL_EXT_CTR_LV : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: 0: power down XTAL at high level 1: power down XTAL at low level*/ +#define RTC_CNTL_XTL_EXT_CTR_LV (BIT(30)) +#define RTC_CNTL_XTL_EXT_CTR_LV_M (BIT(30)) +#define RTC_CNTL_XTL_EXT_CTR_LV_V 0x1 +#define RTC_CNTL_XTL_EXT_CTR_LV_S 30 +/* RTC_CNTL_XTAL32K_GPIO_SEL : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: XTAL_32K sel. 0: external XTAL_32K 1: CLK from RTC pad X32P_C*/ +#define RTC_CNTL_XTAL32K_GPIO_SEL (BIT(23)) +#define RTC_CNTL_XTAL32K_GPIO_SEL_M (BIT(23)) +#define RTC_CNTL_XTAL32K_GPIO_SEL_V 0x1 +#define RTC_CNTL_XTAL32K_GPIO_SEL_S 23 +/* RTC_CNTL_DAC_XTAL_32K : R/W ;bitpos:[22:17] ;default: 6'd3 ; */ +/*description: DAC_XTAL_32K*/ +#define RTC_CNTL_DAC_XTAL_32K 0x0000003F +#define RTC_CNTL_DAC_XTAL_32K_M ((RTC_CNTL_DAC_XTAL_32K_V)<<(RTC_CNTL_DAC_XTAL_32K_S)) +#define RTC_CNTL_DAC_XTAL_32K_V 0x3F +#define RTC_CNTL_DAC_XTAL_32K_S 17 +/* RTC_CNTL_XPD_XTAL_32K : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: XPD_XTAL_32K*/ +#define RTC_CNTL_XPD_XTAL_32K (BIT(16)) +#define RTC_CNTL_XPD_XTAL_32K_M (BIT(16)) +#define RTC_CNTL_XPD_XTAL_32K_V 0x1 +#define RTC_CNTL_XPD_XTAL_32K_S 16 +/* RTC_CNTL_DRES_XTAL_32K : R/W ;bitpos:[15:13] ;default: 3'd3 ; */ +/*description: DRES_XTAL_32K*/ +#define RTC_CNTL_DRES_XTAL_32K 0x00000007 +#define RTC_CNTL_DRES_XTAL_32K_M ((RTC_CNTL_DRES_XTAL_32K_V)<<(RTC_CNTL_DRES_XTAL_32K_S)) +#define RTC_CNTL_DRES_XTAL_32K_V 0x7 +#define RTC_CNTL_DRES_XTAL_32K_S 13 +/* RTC_CNTL_DGM_XTAL_32K : R/W ;bitpos:[12:10] ;default: 3'd3 ; */ +/*description: xtal_32k gm control*/ +#define RTC_CNTL_DGM_XTAL_32K 0x00000007 +#define RTC_CNTL_DGM_XTAL_32K_M ((RTC_CNTL_DGM_XTAL_32K_V)<<(RTC_CNTL_DGM_XTAL_32K_S)) +#define RTC_CNTL_DGM_XTAL_32K_V 0x7 +#define RTC_CNTL_DGM_XTAL_32K_S 10 +/* RTC_CNTL_DBUF_XTAL_32K : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: 0: single-end buffer 1: differential buffer*/ +#define RTC_CNTL_DBUF_XTAL_32K (BIT(9)) +#define RTC_CNTL_DBUF_XTAL_32K_M (BIT(9)) +#define RTC_CNTL_DBUF_XTAL_32K_V 0x1 +#define RTC_CNTL_DBUF_XTAL_32K_S 9 +/* RTC_CNTL_ENCKINIT_XTAL_32K : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: apply an internal clock to help xtal 32k to start*/ +#define RTC_CNTL_ENCKINIT_XTAL_32K (BIT(8)) +#define RTC_CNTL_ENCKINIT_XTAL_32K_M (BIT(8)) +#define RTC_CNTL_ENCKINIT_XTAL_32K_V 0x1 +#define RTC_CNTL_ENCKINIT_XTAL_32K_S 8 +/* RTC_CNTL_XTAL32K_XPD_FORCE : R/W ;bitpos:[7] ;default: 1'b1 ; */ +/*description: Xtal 32k xpd control by sw or fsm*/ +#define RTC_CNTL_XTAL32K_XPD_FORCE (BIT(7)) +#define RTC_CNTL_XTAL32K_XPD_FORCE_M (BIT(7)) +#define RTC_CNTL_XTAL32K_XPD_FORCE_V 0x1 +#define RTC_CNTL_XTAL32K_XPD_FORCE_S 7 +/* RTC_CNTL_XTAL32K_AUTO_RETURN : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: xtal 32k switch back xtal when xtal is restarted*/ +#define RTC_CNTL_XTAL32K_AUTO_RETURN (BIT(6)) +#define RTC_CNTL_XTAL32K_AUTO_RETURN_M (BIT(6)) +#define RTC_CNTL_XTAL32K_AUTO_RETURN_V 0x1 +#define RTC_CNTL_XTAL32K_AUTO_RETURN_S 6 +/* RTC_CNTL_XTAL32K_AUTO_RESTART : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: xtal 32k restart xtal when xtal is dead*/ +#define RTC_CNTL_XTAL32K_AUTO_RESTART (BIT(5)) +#define RTC_CNTL_XTAL32K_AUTO_RESTART_M (BIT(5)) +#define RTC_CNTL_XTAL32K_AUTO_RESTART_V 0x1 +#define RTC_CNTL_XTAL32K_AUTO_RESTART_S 5 +/* RTC_CNTL_XTAL32K_AUTO_BACKUP : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: xtal 32k switch to back up clock when xtal is dead*/ +#define RTC_CNTL_XTAL32K_AUTO_BACKUP (BIT(4)) +#define RTC_CNTL_XTAL32K_AUTO_BACKUP_M (BIT(4)) +#define RTC_CNTL_XTAL32K_AUTO_BACKUP_V 0x1 +#define RTC_CNTL_XTAL32K_AUTO_BACKUP_S 4 +/* RTC_CNTL_XTAL32K_EXT_CLK_FO : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: xtal 32k external xtal clock force on*/ +#define RTC_CNTL_XTAL32K_EXT_CLK_FO (BIT(3)) +#define RTC_CNTL_XTAL32K_EXT_CLK_FO_M (BIT(3)) +#define RTC_CNTL_XTAL32K_EXT_CLK_FO_V 0x1 +#define RTC_CNTL_XTAL32K_EXT_CLK_FO_S 3 +/* RTC_CNTL_XTAL32K_WDT_RESET : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: xtal 32k watch dog sw reset*/ +#define RTC_CNTL_XTAL32K_WDT_RESET (BIT(2)) +#define RTC_CNTL_XTAL32K_WDT_RESET_M (BIT(2)) +#define RTC_CNTL_XTAL32K_WDT_RESET_V 0x1 +#define RTC_CNTL_XTAL32K_WDT_RESET_S 2 +/* RTC_CNTL_XTAL32K_WDT_CLK_FO : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: xtal 32k watch dog clock force on*/ +#define RTC_CNTL_XTAL32K_WDT_CLK_FO (BIT(1)) +#define RTC_CNTL_XTAL32K_WDT_CLK_FO_M (BIT(1)) +#define RTC_CNTL_XTAL32K_WDT_CLK_FO_V 0x1 +#define RTC_CNTL_XTAL32K_WDT_CLK_FO_S 1 +/* RTC_CNTL_XTAL32K_WDT_EN : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: xtal 32k watch dog enable*/ +#define RTC_CNTL_XTAL32K_WDT_EN (BIT(0)) +#define RTC_CNTL_XTAL32K_WDT_EN_M (BIT(0)) +#define RTC_CNTL_XTAL32K_WDT_EN_V 0x1 +#define RTC_CNTL_XTAL32K_WDT_EN_S 0 + +#define RTC_CNTL_EXT_WAKEUP_CONF_REG (DR_REG_RTCCNTL_BASE + 0x0064) +/* RTC_CNTL_EXT_WAKEUP1_LV : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_EXT_WAKEUP1_LV (BIT(31)) +#define RTC_CNTL_EXT_WAKEUP1_LV_M (BIT(31)) +#define RTC_CNTL_EXT_WAKEUP1_LV_V 0x1 +#define RTC_CNTL_EXT_WAKEUP1_LV_S 31 +/* RTC_CNTL_EXT_WAKEUP0_LV : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: 0: external wakeup at low level 1: external wakeup at high level*/ +#define RTC_CNTL_EXT_WAKEUP0_LV (BIT(30)) +#define RTC_CNTL_EXT_WAKEUP0_LV_M (BIT(30)) +#define RTC_CNTL_EXT_WAKEUP0_LV_V 0x1 +#define RTC_CNTL_EXT_WAKEUP0_LV_S 30 + +#define RTC_CNTL_SLP_REJECT_CONF_REG (DR_REG_RTCCNTL_BASE + 0x0068) +/* RTC_CNTL_DEEP_SLP_REJECT_EN : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: enable reject for deep sleep*/ +#define RTC_CNTL_DEEP_SLP_REJECT_EN (BIT(31)) +#define RTC_CNTL_DEEP_SLP_REJECT_EN_M (BIT(31)) +#define RTC_CNTL_DEEP_SLP_REJECT_EN_V 0x1 +#define RTC_CNTL_DEEP_SLP_REJECT_EN_S 31 +/* RTC_CNTL_LIGHT_SLP_REJECT_EN : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: enable reject for light sleep*/ +#define RTC_CNTL_LIGHT_SLP_REJECT_EN (BIT(30)) +#define RTC_CNTL_LIGHT_SLP_REJECT_EN_M (BIT(30)) +#define RTC_CNTL_LIGHT_SLP_REJECT_EN_V 0x1 +#define RTC_CNTL_LIGHT_SLP_REJECT_EN_S 30 +/* RTC_CNTL_SLEEP_REJECT_ENA : R/W ;bitpos:[29:15] ;default: 15'd0 ; */ +/*description: sleep reject enable*/ +#define RTC_CNTL_SLEEP_REJECT_ENA 0x00007FFF +#define RTC_CNTL_SLEEP_REJECT_ENA_M ((RTC_CNTL_SLEEP_REJECT_ENA_V)<<(RTC_CNTL_SLEEP_REJECT_ENA_S)) +#define RTC_CNTL_SLEEP_REJECT_ENA_V 0x7FFF +#define RTC_CNTL_SLEEP_REJECT_ENA_S 15 +/* RTC_CNTL_REJECT_CAUSE : RO ;bitpos:[14:0] ;default: 15'd0 ; */ +/*description: sleep reject cause*/ +#define RTC_CNTL_REJECT_CAUSE 0x00007FFF +#define RTC_CNTL_REJECT_CAUSE_M ((RTC_CNTL_REJECT_CAUSE_V)<<(RTC_CNTL_REJECT_CAUSE_S)) +#define RTC_CNTL_REJECT_CAUSE_V 0x7FFF +#define RTC_CNTL_REJECT_CAUSE_S 0 + +#define RTC_CNTL_CPU_PERIOD_CONF_REG (DR_REG_RTCCNTL_BASE + 0x006c) +/* RTC_CNTL_CPUPERIOD_SEL : R/W ;bitpos:[31:30] ;default: 2'b00 ; */ +/*description: */ +#define RTC_CNTL_CPUPERIOD_SEL 0x00000003 +#define RTC_CNTL_CPUPERIOD_SEL_M ((RTC_CNTL_CPUPERIOD_SEL_V)<<(RTC_CNTL_CPUPERIOD_SEL_S)) +#define RTC_CNTL_CPUPERIOD_SEL_V 0x3 +#define RTC_CNTL_CPUPERIOD_SEL_S 30 +/* RTC_CNTL_CPUSEL_CONF : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: CPU sel option*/ +#define RTC_CNTL_CPUSEL_CONF (BIT(29)) +#define RTC_CNTL_CPUSEL_CONF_M (BIT(29)) +#define RTC_CNTL_CPUSEL_CONF_V 0x1 +#define RTC_CNTL_CPUSEL_CONF_S 29 + +#define RTC_CNTL_SDIO_ACT_CONF_REG (DR_REG_RTCCNTL_BASE + 0x0070) +/* RTC_CNTL_SDIO_ACT_DNUM : R/W ;bitpos:[31:22] ;default: 10'b0 ; */ +/*description: */ +#define RTC_CNTL_SDIO_ACT_DNUM 0x000003FF +#define RTC_CNTL_SDIO_ACT_DNUM_M ((RTC_CNTL_SDIO_ACT_DNUM_V)<<(RTC_CNTL_SDIO_ACT_DNUM_S)) +#define RTC_CNTL_SDIO_ACT_DNUM_V 0x3FF +#define RTC_CNTL_SDIO_ACT_DNUM_S 22 + +#define RTC_CNTL_CLK_CONF_REG (DR_REG_RTCCNTL_BASE + 0x0074) +/* RTC_CNTL_ANA_CLK_RTC_SEL : R/W ;bitpos:[31:30] ;default: 2'd0 ; */ +/*description: */ +#define RTC_CNTL_ANA_CLK_RTC_SEL 0x00000003 +#define RTC_CNTL_ANA_CLK_RTC_SEL_M ((RTC_CNTL_ANA_CLK_RTC_SEL_V)<<(RTC_CNTL_ANA_CLK_RTC_SEL_S)) +#define RTC_CNTL_ANA_CLK_RTC_SEL_V 0x3 +#define RTC_CNTL_ANA_CLK_RTC_SEL_S 30 +/* RTC_CNTL_FAST_CLK_RTC_SEL : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: fast_clk_rtc sel. 0: XTAL div 4 1: CK8M*/ +#define RTC_CNTL_FAST_CLK_RTC_SEL (BIT(29)) +#define RTC_CNTL_FAST_CLK_RTC_SEL_M (BIT(29)) +#define RTC_CNTL_FAST_CLK_RTC_SEL_V 0x1 +#define RTC_CNTL_FAST_CLK_RTC_SEL_S 29 +/* RTC_CNTL_CK8M_FORCE_PU : R/W ;bitpos:[26] ;default: 1'd0 ; */ +/*description: CK8M force power up*/ +#define RTC_CNTL_CK8M_FORCE_PU (BIT(26)) +#define RTC_CNTL_CK8M_FORCE_PU_M (BIT(26)) +#define RTC_CNTL_CK8M_FORCE_PU_V 0x1 +#define RTC_CNTL_CK8M_FORCE_PU_S 26 +/* RTC_CNTL_CK8M_FORCE_PD : R/W ;bitpos:[25] ;default: 1'd0 ; */ +/*description: CK8M force power down*/ +#define RTC_CNTL_CK8M_FORCE_PD (BIT(25)) +#define RTC_CNTL_CK8M_FORCE_PD_M (BIT(25)) +#define RTC_CNTL_CK8M_FORCE_PD_V 0x1 +#define RTC_CNTL_CK8M_FORCE_PD_S 25 +/* RTC_CNTL_CK8M_DFREQ : R/W ;bitpos:[24:17] ;default: 8'd172 ; */ +/*description: CK8M_DFREQ*/ +#define RTC_CNTL_CK8M_DFREQ 0x000000FF +#define RTC_CNTL_CK8M_DFREQ_M ((RTC_CNTL_CK8M_DFREQ_V)<<(RTC_CNTL_CK8M_DFREQ_S)) +#define RTC_CNTL_CK8M_DFREQ_V 0xFF +#define RTC_CNTL_CK8M_DFREQ_S 17 +#define RTC_CNTL_CK8M_DFREQ_DEFAULT 172 //TODO, may change in chip7.2.2 +/* RTC_CNTL_CK8M_FORCE_NOGATING : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: CK8M force no gating during sleep*/ +#define RTC_CNTL_CK8M_FORCE_NOGATING (BIT(16)) +#define RTC_CNTL_CK8M_FORCE_NOGATING_M (BIT(16)) +#define RTC_CNTL_CK8M_FORCE_NOGATING_V 0x1 +#define RTC_CNTL_CK8M_FORCE_NOGATING_S 16 +/* RTC_CNTL_XTAL_FORCE_NOGATING : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: XTAL force no gating during sleep*/ +#define RTC_CNTL_XTAL_FORCE_NOGATING (BIT(15)) +#define RTC_CNTL_XTAL_FORCE_NOGATING_M (BIT(15)) +#define RTC_CNTL_XTAL_FORCE_NOGATING_V 0x1 +#define RTC_CNTL_XTAL_FORCE_NOGATING_S 15 +/* RTC_CNTL_CK8M_DIV_SEL : R/W ;bitpos:[14:12] ;default: 3'd3 ; */ +/*description: divider = reg_ck8m_div_sel + 1*/ +#define RTC_CNTL_CK8M_DIV_SEL 0x00000007 +#define RTC_CNTL_CK8M_DIV_SEL_M ((RTC_CNTL_CK8M_DIV_SEL_V)<<(RTC_CNTL_CK8M_DIV_SEL_S)) +#define RTC_CNTL_CK8M_DIV_SEL_V 0x7 +#define RTC_CNTL_CK8M_DIV_SEL_S 12 +/* RTC_CNTL_DIG_CLK8M_EN : R/W ;bitpos:[10] ;default: 1'd0 ; */ +/*description: enable CK8M for digital core (no relationship with RTC core)*/ +#define RTC_CNTL_DIG_CLK8M_EN (BIT(10)) +#define RTC_CNTL_DIG_CLK8M_EN_M (BIT(10)) +#define RTC_CNTL_DIG_CLK8M_EN_V 0x1 +#define RTC_CNTL_DIG_CLK8M_EN_S 10 +/* RTC_CNTL_DIG_CLK8M_D256_EN : R/W ;bitpos:[9] ;default: 1'd1 ; */ +/*description: enable CK8M_D256_OUT for digital core (no relationship with RTC core)*/ +#define RTC_CNTL_DIG_CLK8M_D256_EN (BIT(9)) +#define RTC_CNTL_DIG_CLK8M_D256_EN_M (BIT(9)) +#define RTC_CNTL_DIG_CLK8M_D256_EN_V 0x1 +#define RTC_CNTL_DIG_CLK8M_D256_EN_S 9 +/* RTC_CNTL_DIG_XTAL32K_EN : R/W ;bitpos:[8] ;default: 1'd0 ; */ +/*description: enable CK_XTAL_32K for digital core (no relationship with RTC core)*/ +#define RTC_CNTL_DIG_XTAL32K_EN (BIT(8)) +#define RTC_CNTL_DIG_XTAL32K_EN_M (BIT(8)) +#define RTC_CNTL_DIG_XTAL32K_EN_V 0x1 +#define RTC_CNTL_DIG_XTAL32K_EN_S 8 +/* RTC_CNTL_ENB_CK8M_DIV : R/W ;bitpos:[7] ;default: 1'd0 ; */ +/*description: 1: CK8M_D256_OUT is actually CK8M 0: CK8M_D256_OUT is CK8M divided by 256*/ +#define RTC_CNTL_ENB_CK8M_DIV (BIT(7)) +#define RTC_CNTL_ENB_CK8M_DIV_M (BIT(7)) +#define RTC_CNTL_ENB_CK8M_DIV_V 0x1 +#define RTC_CNTL_ENB_CK8M_DIV_S 7 +/* RTC_CNTL_ENB_CK8M : R/W ;bitpos:[6] ;default: 1'd0 ; */ +/*description: disable CK8M and CK8M_D256_OUT*/ +#define RTC_CNTL_ENB_CK8M (BIT(6)) +#define RTC_CNTL_ENB_CK8M_M (BIT(6)) +#define RTC_CNTL_ENB_CK8M_V 0x1 +#define RTC_CNTL_ENB_CK8M_S 6 +/* RTC_CNTL_CK8M_DIV : R/W ;bitpos:[5:4] ;default: 2'b01 ; */ +/*description: CK8M_D256_OUT divider. 00: div128 01: div256 10: div512 11: div1024.*/ +#define RTC_CNTL_CK8M_DIV 0x00000003 +#define RTC_CNTL_CK8M_DIV_M ((RTC_CNTL_CK8M_DIV_V)<<(RTC_CNTL_CK8M_DIV_S)) +#define RTC_CNTL_CK8M_DIV_V 0x3 +#define RTC_CNTL_CK8M_DIV_S 4 +/* RTC_CNTL_CK8M_DIV_SEL_VLD : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: used to sync reg_ck8m_div_sel bus. Clear vld before set reg_ck8m_div_sel + then set vld to actually switch the clk*/ +#define RTC_CNTL_CK8M_DIV_SEL_VLD (BIT(3)) +#define RTC_CNTL_CK8M_DIV_SEL_VLD_M (BIT(3)) +#define RTC_CNTL_CK8M_DIV_SEL_VLD_V 0x1 +#define RTC_CNTL_CK8M_DIV_SEL_VLD_S 3 + +#define RTC_CNTL_SLOW_CLK_CONF_REG (DR_REG_RTCCNTL_BASE + 0x0078) +/* RTC_CNTL_SLOW_CLK_NEXT_EDGE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_SLOW_CLK_NEXT_EDGE (BIT(31)) +#define RTC_CNTL_SLOW_CLK_NEXT_EDGE_M (BIT(31)) +#define RTC_CNTL_SLOW_CLK_NEXT_EDGE_V 0x1 +#define RTC_CNTL_SLOW_CLK_NEXT_EDGE_S 31 +/* RTC_CNTL_ANA_CLK_DIV : R/W ;bitpos:[30:23] ;default: 8'd0 ; */ +/*description: */ +#define RTC_CNTL_ANA_CLK_DIV 0x000000FF +#define RTC_CNTL_ANA_CLK_DIV_M ((RTC_CNTL_ANA_CLK_DIV_V)<<(RTC_CNTL_ANA_CLK_DIV_S)) +#define RTC_CNTL_ANA_CLK_DIV_V 0xFF +#define RTC_CNTL_ANA_CLK_DIV_S 23 +/* RTC_CNTL_ANA_CLK_DIV_VLD : R/W ;bitpos:[22] ;default: 1'b1 ; */ +/*description: used to sync div bus. clear vld before set reg_rtc_ana_clk_div + then set vld to actually switch the clk*/ +#define RTC_CNTL_ANA_CLK_DIV_VLD (BIT(22)) +#define RTC_CNTL_ANA_CLK_DIV_VLD_M (BIT(22)) +#define RTC_CNTL_ANA_CLK_DIV_VLD_V 0x1 +#define RTC_CNTL_ANA_CLK_DIV_VLD_S 22 + +#define RTC_CNTL_SDIO_CONF_REG (DR_REG_RTCCNTL_BASE + 0x007c) +/* RTC_CNTL_XPD_SDIO_REG : R/W ;bitpos:[31] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_XPD_SDIO_REG (BIT(31)) +#define RTC_CNTL_XPD_SDIO_REG_M (BIT(31)) +#define RTC_CNTL_XPD_SDIO_REG_V 0x1 +#define RTC_CNTL_XPD_SDIO_REG_S 31 +/* RTC_CNTL_DREFH_SDIO : R/W ;bitpos:[30:29] ;default: 2'b00 ; */ +/*description: SW option for DREFH_SDIO. Only active when reg_sdio_force = 1*/ +#define RTC_CNTL_DREFH_SDIO 0x00000003 +#define RTC_CNTL_DREFH_SDIO_M ((RTC_CNTL_DREFH_SDIO_V)<<(RTC_CNTL_DREFH_SDIO_S)) +#define RTC_CNTL_DREFH_SDIO_V 0x3 +#define RTC_CNTL_DREFH_SDIO_S 29 +/* RTC_CNTL_DREFM_SDIO : R/W ;bitpos:[28:27] ;default: 2'b00 ; */ +/*description: SW option for DREFM_SDIO. Only active when reg_sdio_force = 1*/ +#define RTC_CNTL_DREFM_SDIO 0x00000003 +#define RTC_CNTL_DREFM_SDIO_M ((RTC_CNTL_DREFM_SDIO_V)<<(RTC_CNTL_DREFM_SDIO_S)) +#define RTC_CNTL_DREFM_SDIO_V 0x3 +#define RTC_CNTL_DREFM_SDIO_S 27 +/* RTC_CNTL_DREFL_SDIO : R/W ;bitpos:[26:25] ;default: 2'b01 ; */ +/*description: SW option for DREFL_SDIO. Only active when reg_sdio_force = 1*/ +#define RTC_CNTL_DREFL_SDIO 0x00000003 +#define RTC_CNTL_DREFL_SDIO_M ((RTC_CNTL_DREFL_SDIO_V)<<(RTC_CNTL_DREFL_SDIO_S)) +#define RTC_CNTL_DREFL_SDIO_V 0x3 +#define RTC_CNTL_DREFL_SDIO_S 25 +/* RTC_CNTL_REG1P8_READY : RO ;bitpos:[24] ;default: 1'd0 ; */ +/*description: read only register for REG1P8_READY*/ +#define RTC_CNTL_REG1P8_READY (BIT(24)) +#define RTC_CNTL_REG1P8_READY_M (BIT(24)) +#define RTC_CNTL_REG1P8_READY_V 0x1 +#define RTC_CNTL_REG1P8_READY_S 24 +/* RTC_CNTL_SDIO_TIEH : R/W ;bitpos:[23] ;default: 1'd1 ; */ +/*description: SW option for SDIO_TIEH. Only active when reg_sdio_force = 1*/ +#define RTC_CNTL_SDIO_TIEH (BIT(23)) +#define RTC_CNTL_SDIO_TIEH_M (BIT(23)) +#define RTC_CNTL_SDIO_TIEH_V 0x1 +#define RTC_CNTL_SDIO_TIEH_S 23 +/* RTC_CNTL_SDIO_FORCE : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: 1: use SW option to control SDIO_REG 0: use state machine*/ +#define RTC_CNTL_SDIO_FORCE (BIT(22)) +#define RTC_CNTL_SDIO_FORCE_M (BIT(22)) +#define RTC_CNTL_SDIO_FORCE_V 0x1 +#define RTC_CNTL_SDIO_FORCE_S 22 +/* RTC_CNTL_SDIO_PD_EN : R/W ;bitpos:[21] ;default: 1'd1 ; */ +/*description: power down SDIO_REG in sleep. Only active when reg_sdio_force = 0*/ +#define RTC_CNTL_SDIO_PD_EN (BIT(21)) +#define RTC_CNTL_SDIO_PD_EN_M (BIT(21)) +#define RTC_CNTL_SDIO_PD_EN_V 0x1 +#define RTC_CNTL_SDIO_PD_EN_S 21 +/* RTC_CNTL_SDIO_ENCURLIM : R/W ;bitpos:[20] ;default: 1'd1 ; */ +/*description: enable current limit*/ +#define RTC_CNTL_SDIO_ENCURLIM (BIT(20)) +#define RTC_CNTL_SDIO_ENCURLIM_M (BIT(20)) +#define RTC_CNTL_SDIO_ENCURLIM_V 0x1 +#define RTC_CNTL_SDIO_ENCURLIM_S 20 +/* RTC_CNTL_SDIO_MODECURLIM : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: select current limit mode*/ +#define RTC_CNTL_SDIO_MODECURLIM (BIT(19)) +#define RTC_CNTL_SDIO_MODECURLIM_M (BIT(19)) +#define RTC_CNTL_SDIO_MODECURLIM_V 0x1 +#define RTC_CNTL_SDIO_MODECURLIM_S 19 +/* RTC_CNTL_SDIO_DCURLIM : R/W ;bitpos:[18:16] ;default: 3'd0 ; */ +/*description: tune current limit threshold when tieh = 0. About 800mA/(8+d)*/ +#define RTC_CNTL_SDIO_DCURLIM 0x00000007 +#define RTC_CNTL_SDIO_DCURLIM_M ((RTC_CNTL_SDIO_DCURLIM_V)<<(RTC_CNTL_SDIO_DCURLIM_S)) +#define RTC_CNTL_SDIO_DCURLIM_V 0x7 +#define RTC_CNTL_SDIO_DCURLIM_S 16 +/* RTC_CNTL_SDIO_EN_INITI : R/W ;bitpos:[15] ;default: 1'd1 ; */ +/*description: 0 to set init[1:0]=0*/ +#define RTC_CNTL_SDIO_EN_INITI (BIT(15)) +#define RTC_CNTL_SDIO_EN_INITI_M (BIT(15)) +#define RTC_CNTL_SDIO_EN_INITI_V 0x1 +#define RTC_CNTL_SDIO_EN_INITI_S 15 +/* RTC_CNTL_SDIO_INITI : R/W ;bitpos:[14:13] ;default: 2'd1 ; */ +/*description: add resistor from ldo output to ground. 0: no res 1: 6k 2: 4k 3: 2k*/ +#define RTC_CNTL_SDIO_INITI 0x00000003 +#define RTC_CNTL_SDIO_INITI_M ((RTC_CNTL_SDIO_INITI_V)<<(RTC_CNTL_SDIO_INITI_S)) +#define RTC_CNTL_SDIO_INITI_V 0x3 +#define RTC_CNTL_SDIO_INITI_S 13 +/* RTC_CNTL_SDIO_DCAP : R/W ;bitpos:[12:11] ;default: 2'b11 ; */ +/*description: ability to prevent LDO from overshoot*/ +#define RTC_CNTL_SDIO_DCAP 0x00000003 +#define RTC_CNTL_SDIO_DCAP_M ((RTC_CNTL_SDIO_DCAP_V)<<(RTC_CNTL_SDIO_DCAP_S)) +#define RTC_CNTL_SDIO_DCAP_V 0x3 +#define RTC_CNTL_SDIO_DCAP_S 11 +/* RTC_CNTL_SDIO_DTHDRV : R/W ;bitpos:[10:9] ;default: 2'b11 ; */ +/*description: Tieh = 1 mode drive ability. Initially set to 0 to limit charge + current set to 3 after several us.*/ +#define RTC_CNTL_SDIO_DTHDRV 0x00000003 +#define RTC_CNTL_SDIO_DTHDRV_M ((RTC_CNTL_SDIO_DTHDRV_V)<<(RTC_CNTL_SDIO_DTHDRV_S)) +#define RTC_CNTL_SDIO_DTHDRV_V 0x3 +#define RTC_CNTL_SDIO_DTHDRV_S 9 +/* RTC_CNTL_SDIO_TIMER_TARGET : R/W ;bitpos:[7:0] ;default: 8'd10 ; */ +/*description: timer count to apply reg_sdio_dcap after sdio power on*/ +#define RTC_CNTL_SDIO_TIMER_TARGET 0x000000FF +#define RTC_CNTL_SDIO_TIMER_TARGET_M ((RTC_CNTL_SDIO_TIMER_TARGET_V)<<(RTC_CNTL_SDIO_TIMER_TARGET_S)) +#define RTC_CNTL_SDIO_TIMER_TARGET_V 0xFF +#define RTC_CNTL_SDIO_TIMER_TARGET_S 0 + +#define RTC_CNTL_BIAS_CONF_REG (DR_REG_RTCCNTL_BASE + 0x0080) +/* RTC_CNTL_RST_BIAS_I2C : R/W ;bitpos:[31] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_RST_BIAS_I2C (BIT(31)) +#define RTC_CNTL_RST_BIAS_I2C_M (BIT(31)) +#define RTC_CNTL_RST_BIAS_I2C_V 0x1 +#define RTC_CNTL_RST_BIAS_I2C_S 31 +/* RTC_CNTL_DEC_HEARTBEAT_WIDTH : R/W ;bitpos:[30] ;default: 1'd0 ; */ +/*description: DEC_HEARTBEAT_WIDTH*/ +#define RTC_CNTL_DEC_HEARTBEAT_WIDTH (BIT(30)) +#define RTC_CNTL_DEC_HEARTBEAT_WIDTH_M (BIT(30)) +#define RTC_CNTL_DEC_HEARTBEAT_WIDTH_V 0x1 +#define RTC_CNTL_DEC_HEARTBEAT_WIDTH_S 30 +/* RTC_CNTL_INC_HEARTBEAT_PERIOD : R/W ;bitpos:[29] ;default: 1'd0 ; */ +/*description: INC_HEARTBEAT_PERIOD*/ +#define RTC_CNTL_INC_HEARTBEAT_PERIOD (BIT(29)) +#define RTC_CNTL_INC_HEARTBEAT_PERIOD_M (BIT(29)) +#define RTC_CNTL_INC_HEARTBEAT_PERIOD_V 0x1 +#define RTC_CNTL_INC_HEARTBEAT_PERIOD_S 29 +/* RTC_CNTL_DEC_HEARTBEAT_PERIOD : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: DEC_HEARTBEAT_PERIOD*/ +#define RTC_CNTL_DEC_HEARTBEAT_PERIOD (BIT(28)) +#define RTC_CNTL_DEC_HEARTBEAT_PERIOD_M (BIT(28)) +#define RTC_CNTL_DEC_HEARTBEAT_PERIOD_V 0x1 +#define RTC_CNTL_DEC_HEARTBEAT_PERIOD_S 28 +/* RTC_CNTL_INC_HEARTBEAT_REFRESH : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: INC_HEARTBEAT_REFRESH*/ +#define RTC_CNTL_INC_HEARTBEAT_REFRESH (BIT(27)) +#define RTC_CNTL_INC_HEARTBEAT_REFRESH_M (BIT(27)) +#define RTC_CNTL_INC_HEARTBEAT_REFRESH_V 0x1 +#define RTC_CNTL_INC_HEARTBEAT_REFRESH_S 27 +/* RTC_CNTL_ENB_SCK_XTAL : R/W ;bitpos:[26] ;default: 1'd0 ; */ +/*description: ENB_SCK_XTAL*/ +#define RTC_CNTL_ENB_SCK_XTAL (BIT(26)) +#define RTC_CNTL_ENB_SCK_XTAL_M (BIT(26)) +#define RTC_CNTL_ENB_SCK_XTAL_V 0x1 +#define RTC_CNTL_ENB_SCK_XTAL_S 26 +/* RTC_CNTL_DBG_ATTEN : R/W ;bitpos:[25:22] ;default: 4'd0 ; */ +/*description: DBG_ATTEN*/ +#define RTC_CNTL_DBG_ATTEN 0x0000000F +#define RTC_CNTL_DBG_ATTEN_M ((RTC_CNTL_DBG_ATTEN_V)<<(RTC_CNTL_DBG_ATTEN_S)) +#define RTC_CNTL_DBG_ATTEN_V 0xF +#define RTC_CNTL_DBG_ATTEN_S 22 +/* reserved for driver to check */ +#define RTC_CNTL_DBG_ATTEN_DEFAULT 15 + +#define RTC_CNTL_REG (DR_REG_RTCCNTL_BASE + 0x0084) +/* RTC_CNTL_REGULATOR_FORCE_PU : R/W ;bitpos:[31] ;default: 1'd1 ; */ +/*description: */ +#define RTC_CNTL_REGULATOR_FORCE_PU (BIT(31)) +#define RTC_CNTL_REGULATOR_FORCE_PU_M (BIT(31)) +#define RTC_CNTL_REGULATOR_FORCE_PU_V 0x1 +#define RTC_CNTL_REGULATOR_FORCE_PU_S 31 +/* RTC_CNTL_REGULATOR_FORCE_PD : R/W ;bitpos:[30] ;default: 1'd0 ; */ +/*description: RTC_REG force power down (for RTC_REG power down means decrease + the voltage to 0.8v or lower )*/ +#define RTC_CNTL_REGULATOR_FORCE_PD (BIT(30)) +#define RTC_CNTL_REGULATOR_FORCE_PD_M (BIT(30)) +#define RTC_CNTL_REGULATOR_FORCE_PD_V 0x1 +#define RTC_CNTL_REGULATOR_FORCE_PD_S 30 +/* RTC_CNTL_DBOOST_FORCE_PU : R/W ;bitpos:[29] ;default: 1'd1 ; */ +/*description: RTC_DBOOST force power up*/ +#define RTC_CNTL_DBOOST_FORCE_PU (BIT(29)) +#define RTC_CNTL_DBOOST_FORCE_PU_M (BIT(29)) +#define RTC_CNTL_DBOOST_FORCE_PU_V 0x1 +#define RTC_CNTL_DBOOST_FORCE_PU_S 29 +/* RTC_CNTL_DBOOST_FORCE_PD : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RTC_DBOOST force power down*/ +#define RTC_CNTL_DBOOST_FORCE_PD (BIT(28)) +#define RTC_CNTL_DBOOST_FORCE_PD_M (BIT(28)) +#define RTC_CNTL_DBOOST_FORCE_PD_V 0x1 +#define RTC_CNTL_DBOOST_FORCE_PD_S 28 +/* RTC_CNTL_DBIAS_WAK : R/W ;bitpos:[27:25] ;default: 3'd4 ; */ +/*description: RTC_DBIAS during wakeup*/ +#define RTC_CNTL_DBIAS_WAK 0x00000007 +#define RTC_CNTL_DBIAS_WAK_M ((RTC_CNTL_DBIAS_WAK_V)<<(RTC_CNTL_DBIAS_WAK_S)) +#define RTC_CNTL_DBIAS_WAK_V 0x7 +#define RTC_CNTL_DBIAS_WAK_S 25 +/* Approximate mapping of voltages to RTC_CNTL_DBIAS_WAK, RTC_CNTL_DBIAS_SLP, + * RTC_CNTL_DIG_DBIAS_WAK, RTC_CNTL_DIG_DBIAS_SLP values. + * Valid if RTC_CNTL_DBG_ATTEN is 0. + */ +#define RTC_CNTL_DBIAS_0V90 0 +#define RTC_CNTL_DBIAS_0V95 1 +#define RTC_CNTL_DBIAS_1V00 2 +#define RTC_CNTL_DBIAS_1V05 3 +#define RTC_CNTL_DBIAS_1V10 4 +#define RTC_CNTL_DBIAS_1V15 5 +#define RTC_CNTL_DBIAS_1V20 6 +#define RTC_CNTL_DBIAS_1V25 7 + +/* RTC_CNTL_DBIAS_SLP : R/W ;bitpos:[24:22] ;default: 3'd4 ; */ +/*description: RTC_DBIAS during sleep*/ +#define RTC_CNTL_DBIAS_SLP 0x00000007 +#define RTC_CNTL_DBIAS_SLP_M ((RTC_CNTL_DBIAS_SLP_V)<<(RTC_CNTL_DBIAS_SLP_S)) +#define RTC_CNTL_DBIAS_SLP_V 0x7 +#define RTC_CNTL_DBIAS_SLP_S 22 +/* RTC_CNTL_SCK_DCAP : R/W ;bitpos:[21:14] ;default: 8'd0 ; */ +/*description: SCK_DCAP*/ +#define RTC_CNTL_SCK_DCAP 0x000000FF +#define RTC_CNTL_SCK_DCAP_M ((RTC_CNTL_SCK_DCAP_V)<<(RTC_CNTL_SCK_DCAP_S)) +#define RTC_CNTL_SCK_DCAP_V 0xFF +#define RTC_CNTL_SCK_DCAP_S 14 +#define RTC_CNTL_SCK_DCAP_DEFAULT 255 +/* RTC_CNTL_DIG_DBIAS_WAK : R/W ;bitpos:[13:11] ;default: 3'd4 ; */ +/*description: DIG_REG_DBIAS during wakeup*/ +#define RTC_CNTL_DIG_DBIAS_WAK 0x00000007 +#define RTC_CNTL_DIG_DBIAS_WAK_M ((RTC_CNTL_DIG_DBIAS_WAK_V)<<(RTC_CNTL_DIG_DBIAS_WAK_S)) +#define RTC_CNTL_DIG_DBIAS_WAK_V 0x7 +#define RTC_CNTL_DIG_DBIAS_WAK_S 11 +/* RTC_CNTL_DIG_DBIAS_SLP : R/W ;bitpos:[10:8] ;default: 3'd4 ; */ +/*description: DIG_REG_DBIAS during sleep*/ +#define RTC_CNTL_DIG_DBIAS_SLP 0x00000007 +#define RTC_CNTL_DIG_DBIAS_SLP_M ((RTC_CNTL_DIG_DBIAS_SLP_V)<<(RTC_CNTL_DIG_DBIAS_SLP_S)) +#define RTC_CNTL_DIG_DBIAS_SLP_V 0x7 +#define RTC_CNTL_DIG_DBIAS_SLP_S 8 + +#define RTC_CNTL_PWC_REG (DR_REG_RTCCNTL_BASE + 0x0088) +/* RTC_CNTL_PAD_FORCE_HOLD : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: rtc pad force hold*/ +#define RTC_CNTL_PAD_FORCE_HOLD (BIT(21)) +#define RTC_CNTL_PAD_FORCE_HOLD_M (BIT(21)) +#define RTC_CNTL_PAD_FORCE_HOLD_V 0x1 +#define RTC_CNTL_PAD_FORCE_HOLD_S 21 +/* RTC_CNTL_PD_EN : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: enable power down rtc_peri in sleep*/ +#define RTC_CNTL_PD_EN (BIT(20)) +#define RTC_CNTL_PD_EN_M (BIT(20)) +#define RTC_CNTL_PD_EN_V 0x1 +#define RTC_CNTL_PD_EN_S 20 +/* RTC_CNTL_FORCE_PU : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: rtc_peri force power up*/ +#define RTC_CNTL_PWC_FORCE_PU (BIT(19)) +#define RTC_CNTL_PWC_FORCE_PU_M (BIT(19)) +#define RTC_CNTL_PWC_FORCE_PU_V 0x1 +#define RTC_CNTL_PWC_FORCE_PU_S 19 +/* RTC_CNTL_FORCE_PD : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: rtc_peri force power down*/ +#define RTC_CNTL_PWC_FORCE_PD (BIT(18)) +#define RTC_CNTL_PWC_FORCE_PD_M (BIT(18)) +#define RTC_CNTL_PWC_FORCE_PD_V 0x1 +#define RTC_CNTL_PWC_FORCE_PD_S 18 +/* RTC_CNTL_SLOWMEM_PD_EN : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: enable power down RTC memory in sleep*/ +#define RTC_CNTL_SLOWMEM_PD_EN (BIT(17)) +#define RTC_CNTL_SLOWMEM_PD_EN_M (BIT(17)) +#define RTC_CNTL_SLOWMEM_PD_EN_V 0x1 +#define RTC_CNTL_SLOWMEM_PD_EN_S 17 +/* RTC_CNTL_SLOWMEM_FORCE_PU : R/W ;bitpos:[16] ;default: 1'b1 ; */ +/*description: RTC memory force power up*/ +#define RTC_CNTL_SLOWMEM_FORCE_PU (BIT(16)) +#define RTC_CNTL_SLOWMEM_FORCE_PU_M (BIT(16)) +#define RTC_CNTL_SLOWMEM_FORCE_PU_V 0x1 +#define RTC_CNTL_SLOWMEM_FORCE_PU_S 16 +/* RTC_CNTL_SLOWMEM_FORCE_PD : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: RTC memory force power down*/ +#define RTC_CNTL_SLOWMEM_FORCE_PD (BIT(15)) +#define RTC_CNTL_SLOWMEM_FORCE_PD_M (BIT(15)) +#define RTC_CNTL_SLOWMEM_FORCE_PD_V 0x1 +#define RTC_CNTL_SLOWMEM_FORCE_PD_S 15 +/* RTC_CNTL_FASTMEM_PD_EN : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: enable power down fast RTC memory in sleep*/ +#define RTC_CNTL_FASTMEM_PD_EN (BIT(14)) +#define RTC_CNTL_FASTMEM_PD_EN_M (BIT(14)) +#define RTC_CNTL_FASTMEM_PD_EN_V 0x1 +#define RTC_CNTL_FASTMEM_PD_EN_S 14 +/* RTC_CNTL_FASTMEM_FORCE_PU : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: Fast RTC memory force power up*/ +#define RTC_CNTL_FASTMEM_FORCE_PU (BIT(13)) +#define RTC_CNTL_FASTMEM_FORCE_PU_M (BIT(13)) +#define RTC_CNTL_FASTMEM_FORCE_PU_V 0x1 +#define RTC_CNTL_FASTMEM_FORCE_PU_S 13 +/* RTC_CNTL_FASTMEM_FORCE_PD : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: Fast RTC memory force power down*/ +#define RTC_CNTL_FASTMEM_FORCE_PD (BIT(12)) +#define RTC_CNTL_FASTMEM_FORCE_PD_M (BIT(12)) +#define RTC_CNTL_FASTMEM_FORCE_PD_V 0x1 +#define RTC_CNTL_FASTMEM_FORCE_PD_S 12 +/* RTC_CNTL_SLOWMEM_FORCE_LPU : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: RTC memory force no PD*/ +#define RTC_CNTL_SLOWMEM_FORCE_LPU (BIT(11)) +#define RTC_CNTL_SLOWMEM_FORCE_LPU_M (BIT(11)) +#define RTC_CNTL_SLOWMEM_FORCE_LPU_V 0x1 +#define RTC_CNTL_SLOWMEM_FORCE_LPU_S 11 +/* RTC_CNTL_SLOWMEM_FORCE_LPD : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: RTC memory force PD*/ +#define RTC_CNTL_SLOWMEM_FORCE_LPD (BIT(10)) +#define RTC_CNTL_SLOWMEM_FORCE_LPD_M (BIT(10)) +#define RTC_CNTL_SLOWMEM_FORCE_LPD_V 0x1 +#define RTC_CNTL_SLOWMEM_FORCE_LPD_S 10 +/* RTC_CNTL_SLOWMEM_FOLW_CPU : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: 1: RTC memory PD following CPU 0: RTC memory PD following RTC state machine*/ +#define RTC_CNTL_SLOWMEM_FOLW_CPU (BIT(9)) +#define RTC_CNTL_SLOWMEM_FOLW_CPU_M (BIT(9)) +#define RTC_CNTL_SLOWMEM_FOLW_CPU_V 0x1 +#define RTC_CNTL_SLOWMEM_FOLW_CPU_S 9 +/* RTC_CNTL_FASTMEM_FORCE_LPU : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: Fast RTC memory force no PD*/ +#define RTC_CNTL_FASTMEM_FORCE_LPU (BIT(8)) +#define RTC_CNTL_FASTMEM_FORCE_LPU_M (BIT(8)) +#define RTC_CNTL_FASTMEM_FORCE_LPU_V 0x1 +#define RTC_CNTL_FASTMEM_FORCE_LPU_S 8 +/* RTC_CNTL_FASTMEM_FORCE_LPD : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: Fast RTC memory force PD*/ +#define RTC_CNTL_FASTMEM_FORCE_LPD (BIT(7)) +#define RTC_CNTL_FASTMEM_FORCE_LPD_M (BIT(7)) +#define RTC_CNTL_FASTMEM_FORCE_LPD_V 0x1 +#define RTC_CNTL_FASTMEM_FORCE_LPD_S 7 +/* RTC_CNTL_FASTMEM_FOLW_CPU : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: 1: Fast RTC memory PD following CPU 0: fast RTC memory PD following + RTC state machine*/ +#define RTC_CNTL_FASTMEM_FOLW_CPU (BIT(6)) +#define RTC_CNTL_FASTMEM_FOLW_CPU_M (BIT(6)) +#define RTC_CNTL_FASTMEM_FOLW_CPU_V 0x1 +#define RTC_CNTL_FASTMEM_FOLW_CPU_S 6 +/* RTC_CNTL_FORCE_NOISO : R/W ;bitpos:[5] ;default: 1'd1 ; */ +/*description: rtc_peri force no ISO*/ +#define RTC_CNTL_FORCE_NOISO (BIT(5)) +#define RTC_CNTL_FORCE_NOISO_M (BIT(5)) +#define RTC_CNTL_FORCE_NOISO_V 0x1 +#define RTC_CNTL_FORCE_NOISO_S 5 +/* RTC_CNTL_FORCE_ISO : R/W ;bitpos:[4] ;default: 1'd0 ; */ +/*description: rtc_peri force ISO*/ +#define RTC_CNTL_FORCE_ISO (BIT(4)) +#define RTC_CNTL_FORCE_ISO_M (BIT(4)) +#define RTC_CNTL_FORCE_ISO_V 0x1 +#define RTC_CNTL_FORCE_ISO_S 4 +/* RTC_CNTL_SLOWMEM_FORCE_ISO : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: RTC memory force ISO*/ +#define RTC_CNTL_SLOWMEM_FORCE_ISO (BIT(3)) +#define RTC_CNTL_SLOWMEM_FORCE_ISO_M (BIT(3)) +#define RTC_CNTL_SLOWMEM_FORCE_ISO_V 0x1 +#define RTC_CNTL_SLOWMEM_FORCE_ISO_S 3 +/* RTC_CNTL_SLOWMEM_FORCE_NOISO : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: RTC memory force no ISO*/ +#define RTC_CNTL_SLOWMEM_FORCE_NOISO (BIT(2)) +#define RTC_CNTL_SLOWMEM_FORCE_NOISO_M (BIT(2)) +#define RTC_CNTL_SLOWMEM_FORCE_NOISO_V 0x1 +#define RTC_CNTL_SLOWMEM_FORCE_NOISO_S 2 +/* RTC_CNTL_FASTMEM_FORCE_ISO : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: Fast RTC memory force ISO*/ +#define RTC_CNTL_FASTMEM_FORCE_ISO (BIT(1)) +#define RTC_CNTL_FASTMEM_FORCE_ISO_M (BIT(1)) +#define RTC_CNTL_FASTMEM_FORCE_ISO_V 0x1 +#define RTC_CNTL_FASTMEM_FORCE_ISO_S 1 +/* RTC_CNTL_FASTMEM_FORCE_NOISO : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: Fast RTC memory force no ISO*/ +#define RTC_CNTL_FASTMEM_FORCE_NOISO (BIT(0)) +#define RTC_CNTL_FASTMEM_FORCE_NOISO_M (BIT(0)) +#define RTC_CNTL_FASTMEM_FORCE_NOISO_V 0x1 +#define RTC_CNTL_FASTMEM_FORCE_NOISO_S 0 +/* Useful groups of RTC_CNTL_PWC_REG bits */ +#define RTC_CNTL_MEM_FORCE_ISO \ + (RTC_CNTL_SLOWMEM_FORCE_ISO | RTC_CNTL_FASTMEM_FORCE_ISO) +#define RTC_CNTL_MEM_FORCE_NOISO \ + (RTC_CNTL_SLOWMEM_FORCE_NOISO | RTC_CNTL_FASTMEM_FORCE_NOISO) +#define RTC_CNTL_MEM_PD_EN \ + (RTC_CNTL_SLOWMEM_PD_EN | RTC_CNTL_FASTMEM_PD_EN) +#define RTC_CNTL_MEM_FORCE_PU \ + (RTC_CNTL_SLOWMEM_FORCE_PU | RTC_CNTL_FASTMEM_FORCE_PU) +#define RTC_CNTL_MEM_FORCE_PD \ + (RTC_CNTL_SLOWMEM_FORCE_PD | RTC_CNTL_FASTMEM_FORCE_PD) +#define RTC_CNTL_MEM_FOLW_CPU \ + (RTC_CNTL_SLOWMEM_FOLW_CPU | RTC_CNTL_FASTMEM_FOLW_CPU) +#define RTC_CNTL_MEM_FORCE_LPU \ + (RTC_CNTL_SLOWMEM_FORCE_LPU | RTC_CNTL_FASTMEM_FORCE_LPU) +#define RTC_CNTL_MEM_FORCE_LPD \ + (RTC_CNTL_SLOWMEM_FORCE_LPD | RTC_CNTL_FASTMEM_FORCE_LPD) + +#define RTC_CNTL_DIG_PWC_REG (DR_REG_RTCCNTL_BASE + 0x008c) +/* RTC_CNTL_DG_WRAP_PD_EN : R/W ;bitpos:[31] ;default: 0 ; */ +/*description: */ +#define RTC_CNTL_DG_WRAP_PD_EN (BIT(31)) +#define RTC_CNTL_DG_WRAP_PD_EN_M (BIT(31)) +#define RTC_CNTL_DG_WRAP_PD_EN_V 0x1 +#define RTC_CNTL_DG_WRAP_PD_EN_S 31 +/* RTC_CNTL_WIFI_PD_EN : R/W ;bitpos:[30] ;default: 0 ; */ +/*description: enable power down wifi in sleep*/ +#define RTC_CNTL_WIFI_PD_EN (BIT(30)) +#define RTC_CNTL_WIFI_PD_EN_M (BIT(30)) +#define RTC_CNTL_WIFI_PD_EN_V 0x1 +#define RTC_CNTL_WIFI_PD_EN_S 30 +/* RTC_CNTL_INTER_RAM4_PD_EN : R/W ;bitpos:[29] ;default: 0 ; */ +/*description: enable power down internal SRAM 4 in sleep*/ +#define RTC_CNTL_INTER_RAM4_PD_EN (BIT(29)) +#define RTC_CNTL_INTER_RAM4_PD_EN_M (BIT(29)) +#define RTC_CNTL_INTER_RAM4_PD_EN_V 0x1 +#define RTC_CNTL_INTER_RAM4_PD_EN_S 29 +/* RTC_CNTL_INTER_RAM3_PD_EN : R/W ;bitpos:[28] ;default: 0 ; */ +/*description: enable power down internal SRAM 3 in sleep*/ +#define RTC_CNTL_INTER_RAM3_PD_EN (BIT(28)) +#define RTC_CNTL_INTER_RAM3_PD_EN_M (BIT(28)) +#define RTC_CNTL_INTER_RAM3_PD_EN_V 0x1 +#define RTC_CNTL_INTER_RAM3_PD_EN_S 28 +/* RTC_CNTL_INTER_RAM2_PD_EN : R/W ;bitpos:[27] ;default: 0 ; */ +/*description: enable power down internal SRAM 2 in sleep*/ +#define RTC_CNTL_INTER_RAM2_PD_EN (BIT(27)) +#define RTC_CNTL_INTER_RAM2_PD_EN_M (BIT(27)) +#define RTC_CNTL_INTER_RAM2_PD_EN_V 0x1 +#define RTC_CNTL_INTER_RAM2_PD_EN_S 27 +/* RTC_CNTL_INTER_RAM1_PD_EN : R/W ;bitpos:[26] ;default: 0 ; */ +/*description: enable power down internal SRAM 1 in sleep*/ +#define RTC_CNTL_INTER_RAM1_PD_EN (BIT(26)) +#define RTC_CNTL_INTER_RAM1_PD_EN_M (BIT(26)) +#define RTC_CNTL_INTER_RAM1_PD_EN_V 0x1 +#define RTC_CNTL_INTER_RAM1_PD_EN_S 26 +/* RTC_CNTL_INTER_RAM0_PD_EN : R/W ;bitpos:[25] ;default: 0 ; */ +/*description: enable power down internal SRAM 0 in sleep*/ +#define RTC_CNTL_INTER_RAM0_PD_EN (BIT(25)) +#define RTC_CNTL_INTER_RAM0_PD_EN_M (BIT(25)) +#define RTC_CNTL_INTER_RAM0_PD_EN_V 0x1 +#define RTC_CNTL_INTER_RAM0_PD_EN_S 25 +/* RTC_CNTL_ROM0_PD_EN : R/W ;bitpos:[24] ;default: 0 ; */ +/*description: enable power down ROM in sleep*/ +#define RTC_CNTL_ROM0_PD_EN (BIT(24)) +#define RTC_CNTL_ROM0_PD_EN_M (BIT(24)) +#define RTC_CNTL_ROM0_PD_EN_V 0x1 +#define RTC_CNTL_ROM0_PD_EN_S 24 +/* RTC_CNTL_DG_DCDC_PD_EN : R/W ;bitpos:[23] ;default: 0 ; */ +/*description: enable power down digital dcdc in sleep*/ +#define RTC_CNTL_DG_DCDC_PD_EN (BIT(23)) +#define RTC_CNTL_DG_DCDC_PD_EN_M (BIT(23)) +#define RTC_CNTL_DG_DCDC_PD_EN_V 0x1 +#define RTC_CNTL_DG_DCDC_PD_EN_S 23 +/* RTC_CNTL_DG_DCDC_FORCE_PU : R/W ;bitpos:[22] ;default: 1'd1 ; */ +/*description: digital dcdc force power up*/ +#define RTC_CNTL_DG_DCDC_FORCE_PU (BIT(22)) +#define RTC_CNTL_DG_DCDC_FORCE_PU_M (BIT(22)) +#define RTC_CNTL_DG_DCDC_FORCE_PU_V 0x1 +#define RTC_CNTL_DG_DCDC_FORCE_PU_S 22 +/* RTC_CNTL_DG_DCDC_FORCE_PD : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: digital dcdc force power down*/ +#define RTC_CNTL_DG_DCDC_FORCE_PD (BIT(21)) +#define RTC_CNTL_DG_DCDC_FORCE_PD_M (BIT(21)) +#define RTC_CNTL_DG_DCDC_FORCE_PD_V 0x1 +#define RTC_CNTL_DG_DCDC_FORCE_PD_S 21 +/* RTC_CNTL_DG_WRAP_FORCE_PU : R/W ;bitpos:[20] ;default: 1'd1 ; */ +/*description: digital core force power up*/ +#define RTC_CNTL_DG_WRAP_FORCE_PU (BIT(20)) +#define RTC_CNTL_DG_WRAP_FORCE_PU_M (BIT(20)) +#define RTC_CNTL_DG_WRAP_FORCE_PU_V 0x1 +#define RTC_CNTL_DG_WRAP_FORCE_PU_S 20 +/* RTC_CNTL_DG_WRAP_FORCE_PD : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: digital core force power down*/ +#define RTC_CNTL_DG_WRAP_FORCE_PD (BIT(19)) +#define RTC_CNTL_DG_WRAP_FORCE_PD_M (BIT(19)) +#define RTC_CNTL_DG_WRAP_FORCE_PD_V 0x1 +#define RTC_CNTL_DG_WRAP_FORCE_PD_S 19 +/* RTC_CNTL_WIFI_FORCE_PU : R/W ;bitpos:[18] ;default: 1'd1 ; */ +/*description: wifi force power up*/ +#define RTC_CNTL_WIFI_FORCE_PU (BIT(18)) +#define RTC_CNTL_WIFI_FORCE_PU_M (BIT(18)) +#define RTC_CNTL_WIFI_FORCE_PU_V 0x1 +#define RTC_CNTL_WIFI_FORCE_PU_S 18 +/* RTC_CNTL_WIFI_FORCE_PD : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: wifi force power down*/ +#define RTC_CNTL_WIFI_FORCE_PD (BIT(17)) +#define RTC_CNTL_WIFI_FORCE_PD_M (BIT(17)) +#define RTC_CNTL_WIFI_FORCE_PD_V 0x1 +#define RTC_CNTL_WIFI_FORCE_PD_S 17 +/* RTC_CNTL_INTER_RAM4_FORCE_PU : R/W ;bitpos:[16] ;default: 1'd1 ; */ +/*description: internal SRAM 4 force power up*/ +#define RTC_CNTL_INTER_RAM4_FORCE_PU (BIT(16)) +#define RTC_CNTL_INTER_RAM4_FORCE_PU_M (BIT(16)) +#define RTC_CNTL_INTER_RAM4_FORCE_PU_V 0x1 +#define RTC_CNTL_INTER_RAM4_FORCE_PU_S 16 +/* RTC_CNTL_INTER_RAM4_FORCE_PD : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: internal SRAM 4 force power down*/ +#define RTC_CNTL_INTER_RAM4_FORCE_PD (BIT(15)) +#define RTC_CNTL_INTER_RAM4_FORCE_PD_M (BIT(15)) +#define RTC_CNTL_INTER_RAM4_FORCE_PD_V 0x1 +#define RTC_CNTL_INTER_RAM4_FORCE_PD_S 15 +/* RTC_CNTL_INTER_RAM3_FORCE_PU : R/W ;bitpos:[14] ;default: 1'd1 ; */ +/*description: internal SRAM 3 force power up*/ +#define RTC_CNTL_INTER_RAM3_FORCE_PU (BIT(14)) +#define RTC_CNTL_INTER_RAM3_FORCE_PU_M (BIT(14)) +#define RTC_CNTL_INTER_RAM3_FORCE_PU_V 0x1 +#define RTC_CNTL_INTER_RAM3_FORCE_PU_S 14 +/* RTC_CNTL_INTER_RAM3_FORCE_PD : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: internal SRAM 3 force power down*/ +#define RTC_CNTL_INTER_RAM3_FORCE_PD (BIT(13)) +#define RTC_CNTL_INTER_RAM3_FORCE_PD_M (BIT(13)) +#define RTC_CNTL_INTER_RAM3_FORCE_PD_V 0x1 +#define RTC_CNTL_INTER_RAM3_FORCE_PD_S 13 +/* RTC_CNTL_INTER_RAM2_FORCE_PU : R/W ;bitpos:[12] ;default: 1'd1 ; */ +/*description: internal SRAM 2 force power up*/ +#define RTC_CNTL_INTER_RAM2_FORCE_PU (BIT(12)) +#define RTC_CNTL_INTER_RAM2_FORCE_PU_M (BIT(12)) +#define RTC_CNTL_INTER_RAM2_FORCE_PU_V 0x1 +#define RTC_CNTL_INTER_RAM2_FORCE_PU_S 12 +/* RTC_CNTL_INTER_RAM2_FORCE_PD : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: internal SRAM 2 force power down*/ +#define RTC_CNTL_INTER_RAM2_FORCE_PD (BIT(11)) +#define RTC_CNTL_INTER_RAM2_FORCE_PD_M (BIT(11)) +#define RTC_CNTL_INTER_RAM2_FORCE_PD_V 0x1 +#define RTC_CNTL_INTER_RAM2_FORCE_PD_S 11 +/* RTC_CNTL_INTER_RAM1_FORCE_PU : R/W ;bitpos:[10] ;default: 1'd1 ; */ +/*description: internal SRAM 1 force power up*/ +#define RTC_CNTL_INTER_RAM1_FORCE_PU (BIT(10)) +#define RTC_CNTL_INTER_RAM1_FORCE_PU_M (BIT(10)) +#define RTC_CNTL_INTER_RAM1_FORCE_PU_V 0x1 +#define RTC_CNTL_INTER_RAM1_FORCE_PU_S 10 +/* RTC_CNTL_INTER_RAM1_FORCE_PD : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: internal SRAM 1 force power down*/ +#define RTC_CNTL_INTER_RAM1_FORCE_PD (BIT(9)) +#define RTC_CNTL_INTER_RAM1_FORCE_PD_M (BIT(9)) +#define RTC_CNTL_INTER_RAM1_FORCE_PD_V 0x1 +#define RTC_CNTL_INTER_RAM1_FORCE_PD_S 9 +/* RTC_CNTL_INTER_RAM0_FORCE_PU : R/W ;bitpos:[8] ;default: 1'd1 ; */ +/*description: internal SRAM 0 force power up*/ +#define RTC_CNTL_INTER_RAM0_FORCE_PU (BIT(8)) +#define RTC_CNTL_INTER_RAM0_FORCE_PU_M (BIT(8)) +#define RTC_CNTL_INTER_RAM0_FORCE_PU_V 0x1 +#define RTC_CNTL_INTER_RAM0_FORCE_PU_S 8 +/* RTC_CNTL_INTER_RAM0_FORCE_PD : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: internal SRAM 0 force power down*/ +#define RTC_CNTL_INTER_RAM0_FORCE_PD (BIT(7)) +#define RTC_CNTL_INTER_RAM0_FORCE_PD_M (BIT(7)) +#define RTC_CNTL_INTER_RAM0_FORCE_PD_V 0x1 +#define RTC_CNTL_INTER_RAM0_FORCE_PD_S 7 +/* RTC_CNTL_ROM0_FORCE_PU : R/W ;bitpos:[6] ;default: 1'd1 ; */ +/*description: ROM force power up*/ +#define RTC_CNTL_ROM0_FORCE_PU (BIT(6)) +#define RTC_CNTL_ROM0_FORCE_PU_M (BIT(6)) +#define RTC_CNTL_ROM0_FORCE_PU_V 0x1 +#define RTC_CNTL_ROM0_FORCE_PU_S 6 +/* RTC_CNTL_ROM0_FORCE_PD : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: ROM force power down*/ +#define RTC_CNTL_ROM0_FORCE_PD (BIT(5)) +#define RTC_CNTL_ROM0_FORCE_PD_M (BIT(5)) +#define RTC_CNTL_ROM0_FORCE_PD_V 0x1 +#define RTC_CNTL_ROM0_FORCE_PD_S 5 +/* RTC_CNTL_LSLP_MEM_FORCE_PU : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: memories in digital core force no PD in sleep*/ +#define RTC_CNTL_LSLP_MEM_FORCE_PU (BIT(4)) +#define RTC_CNTL_LSLP_MEM_FORCE_PU_M (BIT(4)) +#define RTC_CNTL_LSLP_MEM_FORCE_PU_V 0x1 +#define RTC_CNTL_LSLP_MEM_FORCE_PU_S 4 +/* RTC_CNTL_LSLP_MEM_FORCE_PD : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: memories in digital core force PD in sleep*/ +#define RTC_CNTL_LSLP_MEM_FORCE_PD (BIT(3)) +#define RTC_CNTL_LSLP_MEM_FORCE_PD_M (BIT(3)) +#define RTC_CNTL_LSLP_MEM_FORCE_PD_V 0x1 +#define RTC_CNTL_LSLP_MEM_FORCE_PD_S 3 + +#define RTC_CNTL_DIG_ISO_REG (DR_REG_RTCCNTL_BASE + 0x0090) +/* RTC_CNTL_DG_WRAP_FORCE_NOISO : R/W ;bitpos:[31] ;default: 1'd1 ; */ +/*description: */ +#define RTC_CNTL_DG_WRAP_FORCE_NOISO (BIT(31)) +#define RTC_CNTL_DG_WRAP_FORCE_NOISO_M (BIT(31)) +#define RTC_CNTL_DG_WRAP_FORCE_NOISO_V 0x1 +#define RTC_CNTL_DG_WRAP_FORCE_NOISO_S 31 +/* RTC_CNTL_DG_WRAP_FORCE_ISO : R/W ;bitpos:[30] ;default: 1'd0 ; */ +/*description: digital core force ISO*/ +#define RTC_CNTL_DG_WRAP_FORCE_ISO (BIT(30)) +#define RTC_CNTL_DG_WRAP_FORCE_ISO_M (BIT(30)) +#define RTC_CNTL_DG_WRAP_FORCE_ISO_V 0x1 +#define RTC_CNTL_DG_WRAP_FORCE_ISO_S 30 +/* RTC_CNTL_WIFI_FORCE_NOISO : R/W ;bitpos:[29] ;default: 1'd1 ; */ +/*description: wifi force no ISO*/ +#define RTC_CNTL_WIFI_FORCE_NOISO (BIT(29)) +#define RTC_CNTL_WIFI_FORCE_NOISO_M (BIT(29)) +#define RTC_CNTL_WIFI_FORCE_NOISO_V 0x1 +#define RTC_CNTL_WIFI_FORCE_NOISO_S 29 +/* RTC_CNTL_WIFI_FORCE_ISO : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: wifi force ISO*/ +#define RTC_CNTL_WIFI_FORCE_ISO (BIT(28)) +#define RTC_CNTL_WIFI_FORCE_ISO_M (BIT(28)) +#define RTC_CNTL_WIFI_FORCE_ISO_V 0x1 +#define RTC_CNTL_WIFI_FORCE_ISO_S 28 +/* RTC_CNTL_INTER_RAM4_FORCE_NOISO : R/W ;bitpos:[27] ;default: 1'd1 ; */ +/*description: internal SRAM 4 force no ISO*/ +#define RTC_CNTL_INTER_RAM4_FORCE_NOISO (BIT(27)) +#define RTC_CNTL_INTER_RAM4_FORCE_NOISO_M (BIT(27)) +#define RTC_CNTL_INTER_RAM4_FORCE_NOISO_V 0x1 +#define RTC_CNTL_INTER_RAM4_FORCE_NOISO_S 27 +/* RTC_CNTL_INTER_RAM4_FORCE_ISO : R/W ;bitpos:[26] ;default: 1'd0 ; */ +/*description: internal SRAM 4 force ISO*/ +#define RTC_CNTL_INTER_RAM4_FORCE_ISO (BIT(26)) +#define RTC_CNTL_INTER_RAM4_FORCE_ISO_M (BIT(26)) +#define RTC_CNTL_INTER_RAM4_FORCE_ISO_V 0x1 +#define RTC_CNTL_INTER_RAM4_FORCE_ISO_S 26 +/* RTC_CNTL_INTER_RAM3_FORCE_NOISO : R/W ;bitpos:[25] ;default: 1'd1 ; */ +/*description: internal SRAM 3 force no ISO*/ +#define RTC_CNTL_INTER_RAM3_FORCE_NOISO (BIT(25)) +#define RTC_CNTL_INTER_RAM3_FORCE_NOISO_M (BIT(25)) +#define RTC_CNTL_INTER_RAM3_FORCE_NOISO_V 0x1 +#define RTC_CNTL_INTER_RAM3_FORCE_NOISO_S 25 +/* RTC_CNTL_INTER_RAM3_FORCE_ISO : R/W ;bitpos:[24] ;default: 1'd0 ; */ +/*description: internal SRAM 3 force ISO*/ +#define RTC_CNTL_INTER_RAM3_FORCE_ISO (BIT(24)) +#define RTC_CNTL_INTER_RAM3_FORCE_ISO_M (BIT(24)) +#define RTC_CNTL_INTER_RAM3_FORCE_ISO_V 0x1 +#define RTC_CNTL_INTER_RAM3_FORCE_ISO_S 24 +/* RTC_CNTL_INTER_RAM2_FORCE_NOISO : R/W ;bitpos:[23] ;default: 1'd1 ; */ +/*description: internal SRAM 2 force no ISO*/ +#define RTC_CNTL_INTER_RAM2_FORCE_NOISO (BIT(23)) +#define RTC_CNTL_INTER_RAM2_FORCE_NOISO_M (BIT(23)) +#define RTC_CNTL_INTER_RAM2_FORCE_NOISO_V 0x1 +#define RTC_CNTL_INTER_RAM2_FORCE_NOISO_S 23 +/* RTC_CNTL_INTER_RAM2_FORCE_ISO : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: internal SRAM 2 force ISO*/ +#define RTC_CNTL_INTER_RAM2_FORCE_ISO (BIT(22)) +#define RTC_CNTL_INTER_RAM2_FORCE_ISO_M (BIT(22)) +#define RTC_CNTL_INTER_RAM2_FORCE_ISO_V 0x1 +#define RTC_CNTL_INTER_RAM2_FORCE_ISO_S 22 +/* RTC_CNTL_INTER_RAM1_FORCE_NOISO : R/W ;bitpos:[21] ;default: 1'd1 ; */ +/*description: internal SRAM 1 force no ISO*/ +#define RTC_CNTL_INTER_RAM1_FORCE_NOISO (BIT(21)) +#define RTC_CNTL_INTER_RAM1_FORCE_NOISO_M (BIT(21)) +#define RTC_CNTL_INTER_RAM1_FORCE_NOISO_V 0x1 +#define RTC_CNTL_INTER_RAM1_FORCE_NOISO_S 21 +/* RTC_CNTL_INTER_RAM1_FORCE_ISO : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: internal SRAM 1 force ISO*/ +#define RTC_CNTL_INTER_RAM1_FORCE_ISO (BIT(20)) +#define RTC_CNTL_INTER_RAM1_FORCE_ISO_M (BIT(20)) +#define RTC_CNTL_INTER_RAM1_FORCE_ISO_V 0x1 +#define RTC_CNTL_INTER_RAM1_FORCE_ISO_S 20 +/* RTC_CNTL_INTER_RAM0_FORCE_NOISO : R/W ;bitpos:[19] ;default: 1'd1 ; */ +/*description: internal SRAM 0 force no ISO*/ +#define RTC_CNTL_INTER_RAM0_FORCE_NOISO (BIT(19)) +#define RTC_CNTL_INTER_RAM0_FORCE_NOISO_M (BIT(19)) +#define RTC_CNTL_INTER_RAM0_FORCE_NOISO_V 0x1 +#define RTC_CNTL_INTER_RAM0_FORCE_NOISO_S 19 +/* RTC_CNTL_INTER_RAM0_FORCE_ISO : R/W ;bitpos:[18] ;default: 1'd0 ; */ +/*description: internal SRAM 0 force ISO*/ +#define RTC_CNTL_INTER_RAM0_FORCE_ISO (BIT(18)) +#define RTC_CNTL_INTER_RAM0_FORCE_ISO_M (BIT(18)) +#define RTC_CNTL_INTER_RAM0_FORCE_ISO_V 0x1 +#define RTC_CNTL_INTER_RAM0_FORCE_ISO_S 18 +/* RTC_CNTL_ROM0_FORCE_NOISO : R/W ;bitpos:[17] ;default: 1'd1 ; */ +/*description: ROM force no ISO*/ +#define RTC_CNTL_ROM0_FORCE_NOISO (BIT(17)) +#define RTC_CNTL_ROM0_FORCE_NOISO_M (BIT(17)) +#define RTC_CNTL_ROM0_FORCE_NOISO_V 0x1 +#define RTC_CNTL_ROM0_FORCE_NOISO_S 17 +/* RTC_CNTL_ROM0_FORCE_ISO : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: ROM force ISO*/ +#define RTC_CNTL_ROM0_FORCE_ISO (BIT(16)) +#define RTC_CNTL_ROM0_FORCE_ISO_M (BIT(16)) +#define RTC_CNTL_ROM0_FORCE_ISO_V 0x1 +#define RTC_CNTL_ROM0_FORCE_ISO_S 16 +/* RTC_CNTL_DG_PAD_FORCE_HOLD : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: digital pad force hold*/ +#define RTC_CNTL_DG_PAD_FORCE_HOLD (BIT(15)) +#define RTC_CNTL_DG_PAD_FORCE_HOLD_M (BIT(15)) +#define RTC_CNTL_DG_PAD_FORCE_HOLD_V 0x1 +#define RTC_CNTL_DG_PAD_FORCE_HOLD_S 15 +/* RTC_CNTL_DG_PAD_FORCE_UNHOLD : R/W ;bitpos:[14] ;default: 1'd1 ; */ +/*description: digital pad force un-hold*/ +#define RTC_CNTL_DG_PAD_FORCE_UNHOLD (BIT(14)) +#define RTC_CNTL_DG_PAD_FORCE_UNHOLD_M (BIT(14)) +#define RTC_CNTL_DG_PAD_FORCE_UNHOLD_V 0x1 +#define RTC_CNTL_DG_PAD_FORCE_UNHOLD_S 14 +/* RTC_CNTL_DG_PAD_FORCE_ISO : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: digital pad force ISO*/ +#define RTC_CNTL_DG_PAD_FORCE_ISO (BIT(13)) +#define RTC_CNTL_DG_PAD_FORCE_ISO_M (BIT(13)) +#define RTC_CNTL_DG_PAD_FORCE_ISO_V 0x1 +#define RTC_CNTL_DG_PAD_FORCE_ISO_S 13 +/* RTC_CNTL_DG_PAD_FORCE_NOISO : R/W ;bitpos:[12] ;default: 1'd1 ; */ +/*description: digital pad force no ISO*/ +#define RTC_CNTL_DG_PAD_FORCE_NOISO (BIT(12)) +#define RTC_CNTL_DG_PAD_FORCE_NOISO_M (BIT(12)) +#define RTC_CNTL_DG_PAD_FORCE_NOISO_V 0x1 +#define RTC_CNTL_DG_PAD_FORCE_NOISO_S 12 +/* RTC_CNTL_DG_PAD_AUTOHOLD_EN : R/W ;bitpos:[11] ;default: 1'd0 ; */ +/*description: digital pad enable auto-hold*/ +#define RTC_CNTL_DG_PAD_AUTOHOLD_EN (BIT(11)) +#define RTC_CNTL_DG_PAD_AUTOHOLD_EN_M (BIT(11)) +#define RTC_CNTL_DG_PAD_AUTOHOLD_EN_V 0x1 +#define RTC_CNTL_DG_PAD_AUTOHOLD_EN_S 11 +/* RTC_CNTL_CLR_DG_PAD_AUTOHOLD : WO ;bitpos:[10] ;default: 1'd0 ; */ +/*description: wtite only register to clear digital pad auto-hold*/ +#define RTC_CNTL_CLR_DG_PAD_AUTOHOLD (BIT(10)) +#define RTC_CNTL_CLR_DG_PAD_AUTOHOLD_M (BIT(10)) +#define RTC_CNTL_CLR_DG_PAD_AUTOHOLD_V 0x1 +#define RTC_CNTL_CLR_DG_PAD_AUTOHOLD_S 10 +/* RTC_CNTL_DG_PAD_AUTOHOLD : RO ;bitpos:[9] ;default: 1'd0 ; */ +/*description: read only register to indicate digital pad auto-hold status*/ +#define RTC_CNTL_DG_PAD_AUTOHOLD (BIT(9)) +#define RTC_CNTL_DG_PAD_AUTOHOLD_M (BIT(9)) +#define RTC_CNTL_DG_PAD_AUTOHOLD_V 0x1 +#define RTC_CNTL_DG_PAD_AUTOHOLD_S 9 +/* RTC_CNTL_DIG_ISO_FORCE_ON : R/W ;bitpos:[8] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_DIG_ISO_FORCE_ON (BIT(8)) +#define RTC_CNTL_DIG_ISO_FORCE_ON_M (BIT(8)) +#define RTC_CNTL_DIG_ISO_FORCE_ON_V 0x1 +#define RTC_CNTL_DIG_ISO_FORCE_ON_S 8 +/* RTC_CNTL_DIG_ISO_FORCE_OFF : R/W ;bitpos:[7] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_DIG_ISO_FORCE_OFF (BIT(7)) +#define RTC_CNTL_DIG_ISO_FORCE_OFF_M (BIT(7)) +#define RTC_CNTL_DIG_ISO_FORCE_OFF_V 0x1 +#define RTC_CNTL_DIG_ISO_FORCE_OFF_S 7 + +#define RTC_CNTL_WDTCONFIG0_REG (DR_REG_RTCCNTL_BASE + 0x0094) +/* RTC_CNTL_WDT_EN : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define RTC_CNTL_WDT_EN (BIT(31)) +#define RTC_CNTL_WDT_EN_M (BIT(31)) +#define RTC_CNTL_WDT_EN_V 0x1 +#define RTC_CNTL_WDT_EN_S 31 +/* RTC_CNTL_WDT_STG0 : R/W ;bitpos:[30:28] ;default: 3'h0 ; */ +/*description: 1: interrupt stage en 2: CPU reset stage en 3: system reset + stage en 4: RTC reset stage en*/ +#define RTC_CNTL_WDT_STG0 0x00000007 +#define RTC_CNTL_WDT_STG0_M ((RTC_CNTL_WDT_STG0_V)<<(RTC_CNTL_WDT_STG0_S)) +#define RTC_CNTL_WDT_STG0_V 0x7 +#define RTC_CNTL_WDT_STG0_S 28 +/* RTC_CNTL_WDT_STG1 : R/W ;bitpos:[27:25] ;default: 3'h0 ; */ +/*description: 1: interrupt stage en 2: CPU reset stage en 3: system reset + stage en 4: RTC reset stage en*/ +#define RTC_CNTL_WDT_STG1 0x00000007 +#define RTC_CNTL_WDT_STG1_M ((RTC_CNTL_WDT_STG1_V)<<(RTC_CNTL_WDT_STG1_S)) +#define RTC_CNTL_WDT_STG1_V 0x7 +#define RTC_CNTL_WDT_STG1_S 25 +/* RTC_CNTL_WDT_STG2 : R/W ;bitpos:[24:22] ;default: 3'h0 ; */ +/*description: 1: interrupt stage en 2: CPU reset stage en 3: system reset + stage en 4: RTC reset stage en*/ +#define RTC_CNTL_WDT_STG2 0x00000007 +#define RTC_CNTL_WDT_STG2_M ((RTC_CNTL_WDT_STG2_V)<<(RTC_CNTL_WDT_STG2_S)) +#define RTC_CNTL_WDT_STG2_V 0x7 +#define RTC_CNTL_WDT_STG2_S 22 +/* RTC_CNTL_WDT_STG3 : R/W ;bitpos:[21:19] ;default: 3'h0 ; */ +/*description: 1: interrupt stage en 2: CPU reset stage en 3: system reset + stage en 4: RTC reset stage en*/ +#define RTC_CNTL_WDT_STG3 0x00000007 +#define RTC_CNTL_WDT_STG3_M ((RTC_CNTL_WDT_STG3_V)<<(RTC_CNTL_WDT_STG3_S)) +#define RTC_CNTL_WDT_STG3_V 0x7 +#define RTC_CNTL_WDT_STG3_S 19 +/* RTC_CNTL_WDT_STGX : */ +/*description: stage action selection values */ +#define RTC_WDT_STG_SEL_OFF 0 +#define RTC_WDT_STG_SEL_INT 1 +#define RTC_WDT_STG_SEL_RESET_CPU 2 +#define RTC_WDT_STG_SEL_RESET_SYSTEM 3 +#define RTC_WDT_STG_SEL_RESET_RTC 4 + +/* RTC_CNTL_WDT_CPU_RESET_LENGTH : R/W ;bitpos:[18:16] ;default: 3'h1 ; */ +/*description: CPU reset counter length*/ +#define RTC_CNTL_WDT_CPU_RESET_LENGTH 0x00000007 +#define RTC_CNTL_WDT_CPU_RESET_LENGTH_M ((RTC_CNTL_WDT_CPU_RESET_LENGTH_V)<<(RTC_CNTL_WDT_CPU_RESET_LENGTH_S)) +#define RTC_CNTL_WDT_CPU_RESET_LENGTH_V 0x7 +#define RTC_CNTL_WDT_CPU_RESET_LENGTH_S 16 +/* RTC_CNTL_WDT_SYS_RESET_LENGTH : R/W ;bitpos:[15:13] ;default: 3'h1 ; */ +/*description: system reset counter length*/ +#define RTC_CNTL_WDT_SYS_RESET_LENGTH 0x00000007 +#define RTC_CNTL_WDT_SYS_RESET_LENGTH_M ((RTC_CNTL_WDT_SYS_RESET_LENGTH_V)<<(RTC_CNTL_WDT_SYS_RESET_LENGTH_S)) +#define RTC_CNTL_WDT_SYS_RESET_LENGTH_V 0x7 +#define RTC_CNTL_WDT_SYS_RESET_LENGTH_S 13 +/* RTC_CNTL_WDT_FLASHBOOT_MOD_EN : R/W ;bitpos:[12] ;default: 1'h1 ; */ +/*description: enable WDT in flash boot*/ +#define RTC_CNTL_WDT_FLASHBOOT_MOD_EN (BIT(12)) +#define RTC_CNTL_WDT_FLASHBOOT_MOD_EN_M (BIT(12)) +#define RTC_CNTL_WDT_FLASHBOOT_MOD_EN_V 0x1 +#define RTC_CNTL_WDT_FLASHBOOT_MOD_EN_S 12 +/* RTC_CNTL_WDT_PROCPU_RESET_EN : R/W ;bitpos:[11] ;default: 1'd0 ; */ +/*description: enable WDT reset PRO CPU*/ +#define RTC_CNTL_WDT_PROCPU_RESET_EN (BIT(11)) +#define RTC_CNTL_WDT_PROCPU_RESET_EN_M (BIT(11)) +#define RTC_CNTL_WDT_PROCPU_RESET_EN_V 0x1 +#define RTC_CNTL_WDT_PROCPU_RESET_EN_S 11 +/* RTC_CNTL_WDT_APPCPU_RESET_EN : R/W ;bitpos:[10] ;default: 1'd0 ; */ +/*description: enable WDT reset APP CPU*/ +#define RTC_CNTL_WDT_APPCPU_RESET_EN (BIT(10)) +#define RTC_CNTL_WDT_APPCPU_RESET_EN_M (BIT(10)) +#define RTC_CNTL_WDT_APPCPU_RESET_EN_V 0x1 +#define RTC_CNTL_WDT_APPCPU_RESET_EN_S 10 +/* RTC_CNTL_WDT_PAUSE_IN_SLP : R/W ;bitpos:[9] ;default: 1'd1 ; */ +/*description: pause WDT in sleep*/ +#define RTC_CNTL_WDT_PAUSE_IN_SLP (BIT(9)) +#define RTC_CNTL_WDT_PAUSE_IN_SLP_M (BIT(9)) +#define RTC_CNTL_WDT_PAUSE_IN_SLP_V 0x1 +#define RTC_CNTL_WDT_PAUSE_IN_SLP_S 9 +/* RTC_CNTL_WDT_CHIP_RESET_EN : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: wdt reset whole chip enable*/ +#define RTC_CNTL_WDT_CHIP_RESET_EN (BIT(8)) +#define RTC_CNTL_WDT_CHIP_RESET_EN_M (BIT(8)) +#define RTC_CNTL_WDT_CHIP_RESET_EN_V 0x1 +#define RTC_CNTL_WDT_CHIP_RESET_EN_S 8 +/* RTC_CNTL_WDT_CHIP_RESET_WIDTH : R/W ;bitpos:[7:0] ;default: 8'd20 ; */ +/*description: chip reset siginal pulse width*/ +#define RTC_CNTL_WDT_CHIP_RESET_WIDTH 0x000000FF +#define RTC_CNTL_WDT_CHIP_RESET_WIDTH_M ((RTC_CNTL_WDT_CHIP_RESET_WIDTH_V)<<(RTC_CNTL_WDT_CHIP_RESET_WIDTH_S)) +#define RTC_CNTL_WDT_CHIP_RESET_WIDTH_V 0xFF +#define RTC_CNTL_WDT_CHIP_RESET_WIDTH_S 0 + +#define RTC_CNTL_WDTCONFIG1_REG (DR_REG_RTCCNTL_BASE + 0x0098) +/* RTC_CNTL_WDT_STG0_HOLD : R/W ;bitpos:[31:0] ;default: 32'd200000 ; */ +/*description: */ +#define RTC_CNTL_WDT_STG0_HOLD 0xFFFFFFFF +#define RTC_CNTL_WDT_STG0_HOLD_M ((RTC_CNTL_WDT_STG0_HOLD_V)<<(RTC_CNTL_WDT_STG0_HOLD_S)) +#define RTC_CNTL_WDT_STG0_HOLD_V 0xFFFFFFFF +#define RTC_CNTL_WDT_STG0_HOLD_S 0 + +#define RTC_CNTL_WDTCONFIG2_REG (DR_REG_RTCCNTL_BASE + 0x009c) +/* RTC_CNTL_WDT_STG1_HOLD : R/W ;bitpos:[31:0] ;default: 32'd80000 ; */ +/*description: */ +#define RTC_CNTL_WDT_STG1_HOLD 0xFFFFFFFF +#define RTC_CNTL_WDT_STG1_HOLD_M ((RTC_CNTL_WDT_STG1_HOLD_V)<<(RTC_CNTL_WDT_STG1_HOLD_S)) +#define RTC_CNTL_WDT_STG1_HOLD_V 0xFFFFFFFF +#define RTC_CNTL_WDT_STG1_HOLD_S 0 + +#define RTC_CNTL_WDTCONFIG3_REG (DR_REG_RTCCNTL_BASE + 0x00a0) +/* RTC_CNTL_WDT_STG2_HOLD : R/W ;bitpos:[31:0] ;default: 32'hfff ; */ +/*description: */ +#define RTC_CNTL_WDT_STG2_HOLD 0xFFFFFFFF +#define RTC_CNTL_WDT_STG2_HOLD_M ((RTC_CNTL_WDT_STG2_HOLD_V)<<(RTC_CNTL_WDT_STG2_HOLD_S)) +#define RTC_CNTL_WDT_STG2_HOLD_V 0xFFFFFFFF +#define RTC_CNTL_WDT_STG2_HOLD_S 0 + +#define RTC_CNTL_WDTCONFIG4_REG (DR_REG_RTCCNTL_BASE + 0x00a4) +/* RTC_CNTL_WDT_STG3_HOLD : R/W ;bitpos:[31:0] ;default: 32'hfff ; */ +/*description: */ +#define RTC_CNTL_WDT_STG3_HOLD 0xFFFFFFFF +#define RTC_CNTL_WDT_STG3_HOLD_M ((RTC_CNTL_WDT_STG3_HOLD_V)<<(RTC_CNTL_WDT_STG3_HOLD_S)) +#define RTC_CNTL_WDT_STG3_HOLD_V 0xFFFFFFFF +#define RTC_CNTL_WDT_STG3_HOLD_S 0 + +#define RTC_CNTL_WDTFEED_REG (DR_REG_RTCCNTL_BASE + 0x00a8) +/* RTC_CNTL_WDT_FEED : WO ;bitpos:[31] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_WDT_FEED (BIT(31)) +#define RTC_CNTL_WDT_FEED_M (BIT(31)) +#define RTC_CNTL_WDT_FEED_V 0x1 +#define RTC_CNTL_WDT_FEED_S 31 + +#define RTC_CNTL_WDTWPROTECT_REG (DR_REG_RTCCNTL_BASE + 0x00ac) +/* RTC_CNTL_WDT_WKEY : R/W ;bitpos:[31:0] ;default: 32'h50d83aa1 ; */ +/*description: */ +#define RTC_CNTL_WDT_WKEY 0xFFFFFFFF +#define RTC_CNTL_WDT_WKEY_M ((RTC_CNTL_WDT_WKEY_V)<<(RTC_CNTL_WDT_WKEY_S)) +#define RTC_CNTL_WDT_WKEY_V 0xFFFFFFFF +#define RTC_CNTL_WDT_WKEY_S 0 + +#define RTC_CNTL_SWD_CONF_REG (DR_REG_RTCCNTL_BASE + 0x00b0) +/* RTC_CNTL_SWD_AUTO_FEED_EN : R/W ;bitpos:[31] ;default: 1'b1 ; */ +/*description: automatically feed swd when int comes*/ +#define RTC_CNTL_SWD_AUTO_FEED_EN (BIT(31)) +#define RTC_CNTL_SWD_AUTO_FEED_EN_M (BIT(31)) +#define RTC_CNTL_SWD_AUTO_FEED_EN_V 0x1 +#define RTC_CNTL_SWD_AUTO_FEED_EN_S 31 +/* RTC_CNTL_SWD_DISABLE : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: disabel SWD*/ +#define RTC_CNTL_SWD_DISABLE (BIT(30)) +#define RTC_CNTL_SWD_DISABLE_M (BIT(30)) +#define RTC_CNTL_SWD_DISABLE_V 0x1 +#define RTC_CNTL_SWD_DISABLE_S 30 +/* RTC_CNTL_SWD_FEED : WO ;bitpos:[29] ;default: 1'b0 ; */ +/*description: Sw feed swd*/ +#define RTC_CNTL_SWD_FEED (BIT(29)) +#define RTC_CNTL_SWD_FEED_M (BIT(29)) +#define RTC_CNTL_SWD_FEED_V 0x1 +#define RTC_CNTL_SWD_FEED_S 29 +/* RTC_CNTL_SWD_RST_FLAG_CLR : WO ;bitpos:[28] ;default: 1'b0 ; */ +/*description: reset swd reset flag*/ +#define RTC_CNTL_SWD_RST_FLAG_CLR (BIT(28)) +#define RTC_CNTL_SWD_RST_FLAG_CLR_M (BIT(28)) +#define RTC_CNTL_SWD_RST_FLAG_CLR_V 0x1 +#define RTC_CNTL_SWD_RST_FLAG_CLR_S 28 +/* RTC_CNTL_SWD_SIGNAL_WIDTH : R/W ;bitpos:[27:18] ;default: 10'd300 ; */ +/*description: adjust signal width send to swd*/ +#define RTC_CNTL_SWD_SIGNAL_WIDTH 0x000003FF +#define RTC_CNTL_SWD_SIGNAL_WIDTH_M ((RTC_CNTL_SWD_SIGNAL_WIDTH_V)<<(RTC_CNTL_SWD_SIGNAL_WIDTH_S)) +#define RTC_CNTL_SWD_SIGNAL_WIDTH_V 0x3FF +#define RTC_CNTL_SWD_SIGNAL_WIDTH_S 18 +/* RTC_CNTL_SWD_FEED_INT : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: swd interrupt for feeding*/ +#define RTC_CNTL_SWD_FEED_INT (BIT(1)) +#define RTC_CNTL_SWD_FEED_INT_M (BIT(1)) +#define RTC_CNTL_SWD_FEED_INT_V 0x1 +#define RTC_CNTL_SWD_FEED_INT_S 1 +/* RTC_CNTL_SWD_RESET_FLAG : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: swd reset flag*/ +#define RTC_CNTL_SWD_RESET_FLAG (BIT(0)) +#define RTC_CNTL_SWD_RESET_FLAG_M (BIT(0)) +#define RTC_CNTL_SWD_RESET_FLAG_V 0x1 +#define RTC_CNTL_SWD_RESET_FLAG_S 0 + +#define RTC_CNTL_SWD_WPROTECT_REG (DR_REG_RTCCNTL_BASE + 0x00b4) +/* RTC_CNTL_SWD_WKEY : R/W ;bitpos:[31:0] ;default: 32'h8f1d312a ; */ +/*description: swd write protect*/ +#define RTC_CNTL_SWD_WKEY 0xFFFFFFFF +#define RTC_CNTL_SWD_WKEY_M ((RTC_CNTL_SWD_WKEY_V)<<(RTC_CNTL_SWD_WKEY_S)) +#define RTC_CNTL_SWD_WKEY_V 0xFFFFFFFF +#define RTC_CNTL_SWD_WKEY_S 0 + +#define RTC_CNTL_TEST_MUX_REG (DR_REG_RTCCNTL_BASE + 0x00b8) +/* RTC_CNTL_DTEST_RTC : R/W ;bitpos:[31:30] ;default: 2'd0 ; */ +/*description: */ +#define RTC_CNTL_DTEST_RTC 0x00000003 +#define RTC_CNTL_DTEST_RTC_M ((RTC_CNTL_DTEST_RTC_V)<<(RTC_CNTL_DTEST_RTC_S)) +#define RTC_CNTL_DTEST_RTC_V 0x3 +#define RTC_CNTL_DTEST_RTC_S 30 +/* RTC_CNTL_ENT_RTC : R/W ;bitpos:[29] ;default: 1'd0 ; */ +/*description: ENT_RTC*/ +#define RTC_CNTL_ENT_RTC (BIT(29)) +#define RTC_CNTL_ENT_RTC_M (BIT(29)) +#define RTC_CNTL_ENT_RTC_V 0x1 +#define RTC_CNTL_ENT_RTC_S 29 +/* RTC_CNTL_ENT_TSENS : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: ENT_TSENS*/ +#define RTC_CNTL_ENT_TSENS (BIT(28)) +#define RTC_CNTL_ENT_TSENS_M (BIT(28)) +#define RTC_CNTL_ENT_TSENS_V 0x1 +#define RTC_CNTL_ENT_TSENS_S 28 + +#define RTC_CNTL_SW_CPU_STALL_REG (DR_REG_RTCCNTL_BASE + 0x00bc) +/* RTC_CNTL_SW_STALL_PROCPU_C1 : R/W ;bitpos:[31:26] ;default: 6'b0 ; */ +/*description: */ +#define RTC_CNTL_SW_STALL_PROCPU_C1 0x0000003F +#define RTC_CNTL_SW_STALL_PROCPU_C1_M ((RTC_CNTL_SW_STALL_PROCPU_C1_V)<<(RTC_CNTL_SW_STALL_PROCPU_C1_S)) +#define RTC_CNTL_SW_STALL_PROCPU_C1_V 0x3F +#define RTC_CNTL_SW_STALL_PROCPU_C1_S 26 +/* RTC_CNTL_SW_STALL_APPCPU_C1 : R/W ;bitpos:[25:20] ;default: 6'b0 ; */ +/*description: {reg_sw_stall_appcpu_c1[5:0] reg_sw_stall_appcpu_c0[1:0]} == + 0x86 will stall APP CPU*/ +#define RTC_CNTL_SW_STALL_APPCPU_C1 0x0000003F +#define RTC_CNTL_SW_STALL_APPCPU_C1_M ((RTC_CNTL_SW_STALL_APPCPU_C1_V)<<(RTC_CNTL_SW_STALL_APPCPU_C1_S)) +#define RTC_CNTL_SW_STALL_APPCPU_C1_V 0x3F +#define RTC_CNTL_SW_STALL_APPCPU_C1_S 20 + +#define RTC_CNTL_STORE4_REG (DR_REG_RTCCNTL_BASE + 0x00c0) +/* RTC_CNTL_SCRATCH4 : R/W ;bitpos:[31:0] ;default: 0 ; */ +/*description: */ +#define RTC_CNTL_SCRATCH4 0xFFFFFFFF +#define RTC_CNTL_SCRATCH4_M ((RTC_CNTL_SCRATCH4_V)<<(RTC_CNTL_SCRATCH4_S)) +#define RTC_CNTL_SCRATCH4_V 0xFFFFFFFF +#define RTC_CNTL_SCRATCH4_S 0 + +#define RTC_CNTL_STORE5_REG (DR_REG_RTCCNTL_BASE + 0x00c4) +/* RTC_CNTL_SCRATCH5 : R/W ;bitpos:[31:0] ;default: 0 ; */ +/*description: */ +#define RTC_CNTL_SCRATCH5 0xFFFFFFFF +#define RTC_CNTL_SCRATCH5_M ((RTC_CNTL_SCRATCH5_V)<<(RTC_CNTL_SCRATCH5_S)) +#define RTC_CNTL_SCRATCH5_V 0xFFFFFFFF +#define RTC_CNTL_SCRATCH5_S 0 + +#define RTC_CNTL_STORE6_REG (DR_REG_RTCCNTL_BASE + 0x00c8) +/* RTC_CNTL_SCRATCH6 : R/W ;bitpos:[31:0] ;default: 0 ; */ +/*description: */ +#define RTC_CNTL_SCRATCH6 0xFFFFFFFF +#define RTC_CNTL_SCRATCH6_M ((RTC_CNTL_SCRATCH6_V)<<(RTC_CNTL_SCRATCH6_S)) +#define RTC_CNTL_SCRATCH6_V 0xFFFFFFFF +#define RTC_CNTL_SCRATCH6_S 0 + +#define RTC_CNTL_STORE7_REG (DR_REG_RTCCNTL_BASE + 0x00cc) +/* RTC_CNTL_SCRATCH7 : R/W ;bitpos:[31:0] ;default: 0 ; */ +/*description: */ +#define RTC_CNTL_SCRATCH7 0xFFFFFFFF +#define RTC_CNTL_SCRATCH7_M ((RTC_CNTL_SCRATCH7_V)<<(RTC_CNTL_SCRATCH7_S)) +#define RTC_CNTL_SCRATCH7_V 0xFFFFFFFF +#define RTC_CNTL_SCRATCH7_S 0 + +#define RTC_CNTL_LOW_POWER_ST_REG (DR_REG_RTCCNTL_BASE + 0x00d0) +/* RTC_CNTL_MAIN_STATE : RO ;bitpos:[31:28] ;default: 4'd0 ; */ +/*description: rtc main state machine status*/ +#define RTC_CNTL_MAIN_STATE 0x0000000F +#define RTC_CNTL_MAIN_STATE_M ((RTC_CNTL_MAIN_STATE_V)<<(RTC_CNTL_MAIN_STATE_S)) +#define RTC_CNTL_MAIN_STATE_V 0xF +#define RTC_CNTL_MAIN_STATE_S 28 +/* RTC_CNTL_MAIN_STATE_IN_IDLE : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: rtc main state machine is in idle state*/ +#define RTC_CNTL_MAIN_STATE_IN_IDLE (BIT(27)) +#define RTC_CNTL_MAIN_STATE_IN_IDLE_M (BIT(27)) +#define RTC_CNTL_MAIN_STATE_IN_IDLE_V 0x1 +#define RTC_CNTL_MAIN_STATE_IN_IDLE_S 27 +/* RTC_CNTL_MAIN_STATE_IN_SLP : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: rtc main state machine is in sleep state*/ +#define RTC_CNTL_MAIN_STATE_IN_SLP (BIT(26)) +#define RTC_CNTL_MAIN_STATE_IN_SLP_M (BIT(26)) +#define RTC_CNTL_MAIN_STATE_IN_SLP_V 0x1 +#define RTC_CNTL_MAIN_STATE_IN_SLP_S 26 +/* RTC_CNTL_MAIN_STATE_IN_WAIT_XTL : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: rtc main state machine is in wait xtal state*/ +#define RTC_CNTL_MAIN_STATE_IN_WAIT_XTL (BIT(25)) +#define RTC_CNTL_MAIN_STATE_IN_WAIT_XTL_M (BIT(25)) +#define RTC_CNTL_MAIN_STATE_IN_WAIT_XTL_V 0x1 +#define RTC_CNTL_MAIN_STATE_IN_WAIT_XTL_S 25 +/* RTC_CNTL_MAIN_STATE_IN_WAIT_PLL : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: rtc main state machine is in wait pll state*/ +#define RTC_CNTL_MAIN_STATE_IN_WAIT_PLL (BIT(24)) +#define RTC_CNTL_MAIN_STATE_IN_WAIT_PLL_M (BIT(24)) +#define RTC_CNTL_MAIN_STATE_IN_WAIT_PLL_V 0x1 +#define RTC_CNTL_MAIN_STATE_IN_WAIT_PLL_S 24 +/* RTC_CNTL_MAIN_STATE_IN_WAIT_8M : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: rtc main state machine is in wait 8m state*/ +#define RTC_CNTL_MAIN_STATE_IN_WAIT_8M (BIT(23)) +#define RTC_CNTL_MAIN_STATE_IN_WAIT_8M_M (BIT(23)) +#define RTC_CNTL_MAIN_STATE_IN_WAIT_8M_V 0x1 +#define RTC_CNTL_MAIN_STATE_IN_WAIT_8M_S 23 +/* RTC_CNTL_IN_LOW_POWER_STATE : RO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: rtc main state machine is in the states of low power*/ +#define RTC_CNTL_IN_LOW_POWER_STATE (BIT(22)) +#define RTC_CNTL_IN_LOW_POWER_STATE_M (BIT(22)) +#define RTC_CNTL_IN_LOW_POWER_STATE_V 0x1 +#define RTC_CNTL_IN_LOW_POWER_STATE_S 22 +/* RTC_CNTL_IN_WAKEUP_STATE : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: rtc main state machine is in the states of wakeup process*/ +#define RTC_CNTL_IN_WAKEUP_STATE (BIT(21)) +#define RTC_CNTL_IN_WAKEUP_STATE_M (BIT(21)) +#define RTC_CNTL_IN_WAKEUP_STATE_V 0x1 +#define RTC_CNTL_IN_WAKEUP_STATE_S 21 +/* RTC_CNTL_MAIN_STATE_WAIT_END : RO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: rtc main state machine has been waited for some cycles*/ +#define RTC_CNTL_MAIN_STATE_WAIT_END (BIT(20)) +#define RTC_CNTL_MAIN_STATE_WAIT_END_M (BIT(20)) +#define RTC_CNTL_MAIN_STATE_WAIT_END_V 0x1 +#define RTC_CNTL_MAIN_STATE_WAIT_END_S 20 +/* RTC_CNTL_RDY_FOR_WAKEUP : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: rtc is ready to receive wake up trigger from wake up source*/ +#define RTC_CNTL_RDY_FOR_WAKEUP (BIT(19)) +#define RTC_CNTL_RDY_FOR_WAKEUP_M (BIT(19)) +#define RTC_CNTL_RDY_FOR_WAKEUP_V 0x1 +#define RTC_CNTL_RDY_FOR_WAKEUP_S 19 +/* RTC_CNTL_MAIN_STATE_PLL_ON : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: rtc main state machine is in states that pll should be running*/ +#define RTC_CNTL_MAIN_STATE_PLL_ON (BIT(18)) +#define RTC_CNTL_MAIN_STATE_PLL_ON_M (BIT(18)) +#define RTC_CNTL_MAIN_STATE_PLL_ON_V 0x1 +#define RTC_CNTL_MAIN_STATE_PLL_ON_S 18 +/* RTC_CNTL_MAIN_STATE_XTAL_ISO : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: no use any more*/ +#define RTC_CNTL_MAIN_STATE_XTAL_ISO (BIT(17)) +#define RTC_CNTL_MAIN_STATE_XTAL_ISO_M (BIT(17)) +#define RTC_CNTL_MAIN_STATE_XTAL_ISO_V 0x1 +#define RTC_CNTL_MAIN_STATE_XTAL_ISO_S 17 +/* RTC_CNTL_COCPU_STATE_DONE : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: ulp/cocpu is done*/ +#define RTC_CNTL_COCPU_STATE_DONE (BIT(16)) +#define RTC_CNTL_COCPU_STATE_DONE_M (BIT(16)) +#define RTC_CNTL_COCPU_STATE_DONE_V 0x1 +#define RTC_CNTL_COCPU_STATE_DONE_S 16 +/* RTC_CNTL_COCPU_STATE_SLP : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: ulp/cocpu is in sleep state*/ +#define RTC_CNTL_COCPU_STATE_SLP (BIT(15)) +#define RTC_CNTL_COCPU_STATE_SLP_M (BIT(15)) +#define RTC_CNTL_COCPU_STATE_SLP_V 0x1 +#define RTC_CNTL_COCPU_STATE_SLP_S 15 +/* RTC_CNTL_COCPU_STATE_SWITCH : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: ulp/cocpu is about to working. Switch rtc main state*/ +#define RTC_CNTL_COCPU_STATE_SWITCH (BIT(14)) +#define RTC_CNTL_COCPU_STATE_SWITCH_M (BIT(14)) +#define RTC_CNTL_COCPU_STATE_SWITCH_V 0x1 +#define RTC_CNTL_COCPU_STATE_SWITCH_S 14 +/* RTC_CNTL_COCPU_STATE_START : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: ulp/cocpu should start to work*/ +#define RTC_CNTL_COCPU_STATE_START (BIT(13)) +#define RTC_CNTL_COCPU_STATE_START_M (BIT(13)) +#define RTC_CNTL_COCPU_STATE_START_V 0x1 +#define RTC_CNTL_COCPU_STATE_START_S 13 +/* RTC_CNTL_TOUCH_STATE_DONE : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: touch is done*/ +#define RTC_CNTL_TOUCH_STATE_DONE (BIT(12)) +#define RTC_CNTL_TOUCH_STATE_DONE_M (BIT(12)) +#define RTC_CNTL_TOUCH_STATE_DONE_V 0x1 +#define RTC_CNTL_TOUCH_STATE_DONE_S 12 +/* RTC_CNTL_TOUCH_STATE_SLP : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: touch is in sleep state*/ +#define RTC_CNTL_TOUCH_STATE_SLP (BIT(11)) +#define RTC_CNTL_TOUCH_STATE_SLP_M (BIT(11)) +#define RTC_CNTL_TOUCH_STATE_SLP_V 0x1 +#define RTC_CNTL_TOUCH_STATE_SLP_S 11 +/* RTC_CNTL_TOUCH_STATE_SWITCH : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: touch is about to working. Switch rtc main state*/ +#define RTC_CNTL_TOUCH_STATE_SWITCH (BIT(10)) +#define RTC_CNTL_TOUCH_STATE_SWITCH_M (BIT(10)) +#define RTC_CNTL_TOUCH_STATE_SWITCH_V 0x1 +#define RTC_CNTL_TOUCH_STATE_SWITCH_S 10 +/* RTC_CNTL_TOUCH_STATE_START : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: touch should start to work*/ +#define RTC_CNTL_TOUCH_STATE_START (BIT(9)) +#define RTC_CNTL_TOUCH_STATE_START_M (BIT(9)) +#define RTC_CNTL_TOUCH_STATE_START_V 0x1 +#define RTC_CNTL_TOUCH_STATE_START_S 9 +/* RTC_CNTL_XPD_DIG : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: digital wrap power down*/ +#define RTC_CNTL_XPD_DIG (BIT(8)) +#define RTC_CNTL_XPD_DIG_M (BIT(8)) +#define RTC_CNTL_XPD_DIG_V 0x1 +#define RTC_CNTL_XPD_DIG_S 8 +/* RTC_CNTL_DIG_ISO : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: digital wrap iso*/ +#define RTC_CNTL_DIG_ISO (BIT(7)) +#define RTC_CNTL_DIG_ISO_M (BIT(7)) +#define RTC_CNTL_DIG_ISO_V 0x1 +#define RTC_CNTL_DIG_ISO_S 7 +/* RTC_CNTL_XPD_WIFI : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: wifi wrap power down*/ +#define RTC_CNTL_XPD_WIFI (BIT(6)) +#define RTC_CNTL_XPD_WIFI_M (BIT(6)) +#define RTC_CNTL_XPD_WIFI_V 0x1 +#define RTC_CNTL_XPD_WIFI_S 6 +/* RTC_CNTL_WIFI_ISO : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: wifi iso*/ +#define RTC_CNTL_WIFI_ISO (BIT(5)) +#define RTC_CNTL_WIFI_ISO_M (BIT(5)) +#define RTC_CNTL_WIFI_ISO_V 0x1 +#define RTC_CNTL_WIFI_ISO_S 5 +/* RTC_CNTL_XPD_RTC_PERI : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: rtc peripheral power down*/ +#define RTC_CNTL_XPD_RTC_PERI (BIT(4)) +#define RTC_CNTL_XPD_RTC_PERI_M (BIT(4)) +#define RTC_CNTL_XPD_RTC_PERI_V 0x1 +#define RTC_CNTL_XPD_RTC_PERI_S 4 +/* RTC_CNTL_PERI_ISO : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: rtc peripheral iso*/ +#define RTC_CNTL_PERI_ISO (BIT(3)) +#define RTC_CNTL_PERI_ISO_M (BIT(3)) +#define RTC_CNTL_PERI_ISO_V 0x1 +#define RTC_CNTL_PERI_ISO_S 3 +/* RTC_CNTL_XPD_DIG_DCDC : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: External DCDC power down*/ +#define RTC_CNTL_XPD_DIG_DCDC (BIT(2)) +#define RTC_CNTL_XPD_DIG_DCDC_M (BIT(2)) +#define RTC_CNTL_XPD_DIG_DCDC_V 0x1 +#define RTC_CNTL_XPD_DIG_DCDC_S 2 +/* RTC_CNTL_XPD_ROM0 : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: rom0 power down*/ +#define RTC_CNTL_XPD_ROM0 (BIT(0)) +#define RTC_CNTL_XPD_ROM0_M (BIT(0)) +#define RTC_CNTL_XPD_ROM0_V 0x1 +#define RTC_CNTL_XPD_ROM0_S 0 + +#define RTC_CNTL_DIAG0_REG (DR_REG_RTCCNTL_BASE + 0x00d4) +/* RTC_CNTL_LOW_POWER_DIAG1 : RO ;bitpos:[31:0] ;default: 0 ; */ +/*description: */ +#define RTC_CNTL_LOW_POWER_DIAG1 0xFFFFFFFF +#define RTC_CNTL_LOW_POWER_DIAG1_M ((RTC_CNTL_LOW_POWER_DIAG1_V)<<(RTC_CNTL_LOW_POWER_DIAG1_S)) +#define RTC_CNTL_LOW_POWER_DIAG1_V 0xFFFFFFFF +#define RTC_CNTL_LOW_POWER_DIAG1_S 0 + +#define RTC_CNTL_PAD_HOLD_REG (DR_REG_RTCCNTL_BASE + 0x00d8) +/* RTC_CNTL_PAD21_HOLD : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_PAD21_HOLD (BIT(21)) +#define RTC_CNTL_PAD21_HOLD_M (BIT(21)) +#define RTC_CNTL_PAD21_HOLD_V 0x1 +#define RTC_CNTL_PAD21_HOLD_S 21 +/* RTC_CNTL_PAD20_HOLD : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_PAD20_HOLD (BIT(20)) +#define RTC_CNTL_PAD20_HOLD_M (BIT(20)) +#define RTC_CNTL_PAD20_HOLD_V 0x1 +#define RTC_CNTL_PAD20_HOLD_S 20 +/* RTC_CNTL_PAD19_HOLD : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_PAD19_HOLD (BIT(19)) +#define RTC_CNTL_PAD19_HOLD_M (BIT(19)) +#define RTC_CNTL_PAD19_HOLD_V 0x1 +#define RTC_CNTL_PAD19_HOLD_S 19 +/* RTC_CNTL_PDAC2_HOLD : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_PDAC2_HOLD (BIT(18)) +#define RTC_CNTL_PDAC2_HOLD_M (BIT(18)) +#define RTC_CNTL_PDAC2_HOLD_V 0x1 +#define RTC_CNTL_PDAC2_HOLD_S 18 +/* RTC_CNTL_PDAC1_HOLD : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_PDAC1_HOLD (BIT(17)) +#define RTC_CNTL_PDAC1_HOLD_M (BIT(17)) +#define RTC_CNTL_PDAC1_HOLD_V 0x1 +#define RTC_CNTL_PDAC1_HOLD_S 17 +/* RTC_CNTL_X32N_HOLD : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_X32N_HOLD (BIT(16)) +#define RTC_CNTL_X32N_HOLD_M (BIT(16)) +#define RTC_CNTL_X32N_HOLD_V 0x1 +#define RTC_CNTL_X32N_HOLD_S 16 +/* RTC_CNTL_X32P_HOLD : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_X32P_HOLD (BIT(15)) +#define RTC_CNTL_X32P_HOLD_M (BIT(15)) +#define RTC_CNTL_X32P_HOLD_V 0x1 +#define RTC_CNTL_X32P_HOLD_S 15 +/* RTC_CNTL_TOUCH_PAD14_HOLD : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD14_HOLD (BIT(14)) +#define RTC_CNTL_TOUCH_PAD14_HOLD_M (BIT(14)) +#define RTC_CNTL_TOUCH_PAD14_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD14_HOLD_S 14 +/* RTC_CNTL_TOUCH_PAD13_HOLD : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD13_HOLD (BIT(13)) +#define RTC_CNTL_TOUCH_PAD13_HOLD_M (BIT(13)) +#define RTC_CNTL_TOUCH_PAD13_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD13_HOLD_S 13 +/* RTC_CNTL_TOUCH_PAD12_HOLD : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD12_HOLD (BIT(12)) +#define RTC_CNTL_TOUCH_PAD12_HOLD_M (BIT(12)) +#define RTC_CNTL_TOUCH_PAD12_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD12_HOLD_S 12 +/* RTC_CNTL_TOUCH_PAD11_HOLD : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD11_HOLD (BIT(11)) +#define RTC_CNTL_TOUCH_PAD11_HOLD_M (BIT(11)) +#define RTC_CNTL_TOUCH_PAD11_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD11_HOLD_S 11 +/* RTC_CNTL_TOUCH_PAD10_HOLD : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD10_HOLD (BIT(10)) +#define RTC_CNTL_TOUCH_PAD10_HOLD_M (BIT(10)) +#define RTC_CNTL_TOUCH_PAD10_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD10_HOLD_S 10 +/* RTC_CNTL_TOUCH_PAD9_HOLD : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD9_HOLD (BIT(9)) +#define RTC_CNTL_TOUCH_PAD9_HOLD_M (BIT(9)) +#define RTC_CNTL_TOUCH_PAD9_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD9_HOLD_S 9 +/* RTC_CNTL_TOUCH_PAD8_HOLD : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD8_HOLD (BIT(8)) +#define RTC_CNTL_TOUCH_PAD8_HOLD_M (BIT(8)) +#define RTC_CNTL_TOUCH_PAD8_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD8_HOLD_S 8 +/* RTC_CNTL_TOUCH_PAD7_HOLD : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD7_HOLD (BIT(7)) +#define RTC_CNTL_TOUCH_PAD7_HOLD_M (BIT(7)) +#define RTC_CNTL_TOUCH_PAD7_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD7_HOLD_S 7 +/* RTC_CNTL_TOUCH_PAD6_HOLD : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD6_HOLD (BIT(6)) +#define RTC_CNTL_TOUCH_PAD6_HOLD_M (BIT(6)) +#define RTC_CNTL_TOUCH_PAD6_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD6_HOLD_S 6 +/* RTC_CNTL_TOUCH_PAD5_HOLD : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD5_HOLD (BIT(5)) +#define RTC_CNTL_TOUCH_PAD5_HOLD_M (BIT(5)) +#define RTC_CNTL_TOUCH_PAD5_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD5_HOLD_S 5 +/* RTC_CNTL_TOUCH_PAD4_HOLD : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD4_HOLD (BIT(4)) +#define RTC_CNTL_TOUCH_PAD4_HOLD_M (BIT(4)) +#define RTC_CNTL_TOUCH_PAD4_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD4_HOLD_S 4 +/* RTC_CNTL_TOUCH_PAD3_HOLD : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD3_HOLD (BIT(3)) +#define RTC_CNTL_TOUCH_PAD3_HOLD_M (BIT(3)) +#define RTC_CNTL_TOUCH_PAD3_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD3_HOLD_S 3 +/* RTC_CNTL_TOUCH_PAD2_HOLD : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD2_HOLD (BIT(2)) +#define RTC_CNTL_TOUCH_PAD2_HOLD_M (BIT(2)) +#define RTC_CNTL_TOUCH_PAD2_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD2_HOLD_S 2 +/* RTC_CNTL_TOUCH_PAD1_HOLD : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD1_HOLD (BIT(1)) +#define RTC_CNTL_TOUCH_PAD1_HOLD_M (BIT(1)) +#define RTC_CNTL_TOUCH_PAD1_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD1_HOLD_S 1 +/* RTC_CNTL_TOUCH_PAD0_HOLD : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_PAD0_HOLD (BIT(0)) +#define RTC_CNTL_TOUCH_PAD0_HOLD_M (BIT(0)) +#define RTC_CNTL_TOUCH_PAD0_HOLD_V 0x1 +#define RTC_CNTL_TOUCH_PAD0_HOLD_S 0 + +#define RTC_CNTL_DIG_PAD_HOLD_REG (DR_REG_RTCCNTL_BASE + 0x00dc) +/* RTC_CNTL_DIG_PAD_HOLD : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define RTC_CNTL_DIG_PAD_HOLD 0xFFFFFFFF +#define RTC_CNTL_DIG_PAD_HOLD_M ((RTC_CNTL_DIG_PAD_HOLD_V)<<(RTC_CNTL_DIG_PAD_HOLD_S)) +#define RTC_CNTL_DIG_PAD_HOLD_V 0xFFFFFFFF +#define RTC_CNTL_DIG_PAD_HOLD_S 0 + +#define RTC_CNTL_EXT_WAKEUP1_REG (DR_REG_RTCCNTL_BASE + 0x00e0) +/* RTC_CNTL_EXT_WAKEUP1_STATUS_CLR : WO ;bitpos:[22] ;default: 1'd0 ; */ +/*description: clear ext wakeup1 status*/ +#define RTC_CNTL_EXT_WAKEUP1_STATUS_CLR (BIT(22)) +#define RTC_CNTL_EXT_WAKEUP1_STATUS_CLR_M (BIT(22)) +#define RTC_CNTL_EXT_WAKEUP1_STATUS_CLR_V 0x1 +#define RTC_CNTL_EXT_WAKEUP1_STATUS_CLR_S 22 +/* RTC_CNTL_EXT_WAKEUP1_SEL : R/W ;bitpos:[21:0] ;default: 22'd0 ; */ +/*description: Bitmap to select RTC pads for ext wakeup1*/ +#define RTC_CNTL_EXT_WAKEUP1_SEL 0x003FFFFF +#define RTC_CNTL_EXT_WAKEUP1_SEL_M ((RTC_CNTL_EXT_WAKEUP1_SEL_V)<<(RTC_CNTL_EXT_WAKEUP1_SEL_S)) +#define RTC_CNTL_EXT_WAKEUP1_SEL_V 0x3FFFFF +#define RTC_CNTL_EXT_WAKEUP1_SEL_S 0 + +#define RTC_CNTL_EXT_WAKEUP1_STATUS_REG (DR_REG_RTCCNTL_BASE + 0x00e4) +/* RTC_CNTL_EXT_WAKEUP1_STATUS : RO ;bitpos:[21:0] ;default: 22'd0 ; */ +/*description: ext wakeup1 status*/ +#define RTC_CNTL_EXT_WAKEUP1_STATUS 0x003FFFFF +#define RTC_CNTL_EXT_WAKEUP1_STATUS_M ((RTC_CNTL_EXT_WAKEUP1_STATUS_V)<<(RTC_CNTL_EXT_WAKEUP1_STATUS_S)) +#define RTC_CNTL_EXT_WAKEUP1_STATUS_V 0x3FFFFF +#define RTC_CNTL_EXT_WAKEUP1_STATUS_S 0 + +#define RTC_CNTL_BROWN_OUT_REG (DR_REG_RTCCNTL_BASE + 0x00e8) +/* RTC_CNTL_BROWN_OUT_DET : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define RTC_CNTL_BROWN_OUT_DET (BIT(31)) +#define RTC_CNTL_BROWN_OUT_DET_M (BIT(31)) +#define RTC_CNTL_BROWN_OUT_DET_V 0x1 +#define RTC_CNTL_BROWN_OUT_DET_S 31 +/* RTC_CNTL_BROWN_OUT_ENA : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: enable brown out*/ +#define RTC_CNTL_BROWN_OUT_ENA (BIT(30)) +#define RTC_CNTL_BROWN_OUT_ENA_M (BIT(30)) +#define RTC_CNTL_BROWN_OUT_ENA_V 0x1 +#define RTC_CNTL_BROWN_OUT_ENA_S 30 +/* RTC_CNTL_BROWN_OUT_CNT_CLR : WO ;bitpos:[29] ;default: 1'b0 ; */ +/*description: clear brown out counter*/ +#define RTC_CNTL_BROWN_OUT_CNT_CLR (BIT(29)) +#define RTC_CNTL_BROWN_OUT_CNT_CLR_M (BIT(29)) +#define RTC_CNTL_BROWN_OUT_CNT_CLR_V 0x1 +#define RTC_CNTL_BROWN_OUT_CNT_CLR_S 29 +/* RTC_CNTL_BROWN_OUT_RST_ENA : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: enable brown out reset*/ +#define RTC_CNTL_BROWN_OUT_RST_ENA (BIT(26)) +#define RTC_CNTL_BROWN_OUT_RST_ENA_M (BIT(26)) +#define RTC_CNTL_BROWN_OUT_RST_ENA_V 0x1 +#define RTC_CNTL_BROWN_OUT_RST_ENA_S 26 +/* RTC_CNTL_BROWN_OUT_RST_WAIT : R/W ;bitpos:[25:16] ;default: 10'h3ff ; */ +/*description: brown out reset wait cycles*/ +#define RTC_CNTL_BROWN_OUT_RST_WAIT 0x000003FF +#define RTC_CNTL_BROWN_OUT_RST_WAIT_M ((RTC_CNTL_BROWN_OUT_RST_WAIT_V)<<(RTC_CNTL_BROWN_OUT_RST_WAIT_S)) +#define RTC_CNTL_BROWN_OUT_RST_WAIT_V 0x3FF +#define RTC_CNTL_BROWN_OUT_RST_WAIT_S 16 +/* RTC_CNTL_BROWN_OUT_PD_RF_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: enable power down RF when brown out happens*/ +#define RTC_CNTL_BROWN_OUT_PD_RF_ENA (BIT(15)) +#define RTC_CNTL_BROWN_OUT_PD_RF_ENA_M (BIT(15)) +#define RTC_CNTL_BROWN_OUT_PD_RF_ENA_V 0x1 +#define RTC_CNTL_BROWN_OUT_PD_RF_ENA_S 15 +/* RTC_CNTL_BROWN_OUT_CLOSE_FLASH_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: enable close flash when brown out happens*/ +#define RTC_CNTL_BROWN_OUT_CLOSE_FLASH_ENA (BIT(14)) +#define RTC_CNTL_BROWN_OUT_CLOSE_FLASH_ENA_M (BIT(14)) +#define RTC_CNTL_BROWN_OUT_CLOSE_FLASH_ENA_V 0x1 +#define RTC_CNTL_BROWN_OUT_CLOSE_FLASH_ENA_S 14 +/* RTC_CNTL_BROWN_OUT_INT_WAIT : R/W ;bitpos:[13:4] ;default: 10'h2ff ; */ +/*description: brown out interrupt wait cycles*/ +#define RTC_CNTL_BROWN_OUT_INT_WAIT 0x000003FF +#define RTC_CNTL_BROWN_OUT_INT_WAIT_M ((RTC_CNTL_BROWN_OUT_INT_WAIT_V)<<(RTC_CNTL_BROWN_OUT_INT_WAIT_S)) +#define RTC_CNTL_BROWN_OUT_INT_WAIT_V 0x3FF +#define RTC_CNTL_BROWN_OUT_INT_WAIT_S 4 + +#define RTC_CNTL_TIME_LOW1_REG (DR_REG_RTCCNTL_BASE + 0x00ec) +/* RTC_CNTL_TIMER_VALUE1_LOW : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: RTC timer low 32 bits*/ +#define RTC_CNTL_TIMER_VALUE1_LOW 0xFFFFFFFF +#define RTC_CNTL_TIMER_VALUE1_LOW_M ((RTC_CNTL_TIMER_VALUE1_LOW_V)<<(RTC_CNTL_TIMER_VALUE1_LOW_S)) +#define RTC_CNTL_TIMER_VALUE1_LOW_V 0xFFFFFFFF +#define RTC_CNTL_TIMER_VALUE1_LOW_S 0 + +#define RTC_CNTL_TIME_HIGH1_REG (DR_REG_RTCCNTL_BASE + 0x00f0) +/* RTC_CNTL_TIMER_VALUE1_HIGH : RO ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: RTC timer high 16 bits*/ +#define RTC_CNTL_TIMER_VALUE1_HIGH 0x0000FFFF +#define RTC_CNTL_TIMER_VALUE1_HIGH_M ((RTC_CNTL_TIMER_VALUE1_HIGH_V)<<(RTC_CNTL_TIMER_VALUE1_HIGH_S)) +#define RTC_CNTL_TIMER_VALUE1_HIGH_V 0xFFFF +#define RTC_CNTL_TIMER_VALUE1_HIGH_S 0 + +#define RTC_CNTL_XTAL32K_CLK_FACTOR_REG (DR_REG_RTCCNTL_BASE + 0x00f4) +/* RTC_CNTL_XTAL32K_CLK_FACTOR : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: xtal 32k watch dog backup clock factor*/ +#define RTC_CNTL_XTAL32K_CLK_FACTOR 0xFFFFFFFF +#define RTC_CNTL_XTAL32K_CLK_FACTOR_M ((RTC_CNTL_XTAL32K_CLK_FACTOR_V)<<(RTC_CNTL_XTAL32K_CLK_FACTOR_S)) +#define RTC_CNTL_XTAL32K_CLK_FACTOR_V 0xFFFFFFFF +#define RTC_CNTL_XTAL32K_CLK_FACTOR_S 0 + +#define RTC_CNTL_XTAL32K_CONF_REG (DR_REG_RTCCNTL_BASE + 0x00f8) +/* RTC_CNTL_XTAL32K_STABLE_THRES : R/W ;bitpos:[31:28] ;default: 4'h0 ; */ +/*description: if restarted xtal32k period is smaller than this it is regarded as stable*/ +#define RTC_CNTL_XTAL32K_STABLE_THRES 0x0000000F +#define RTC_CNTL_XTAL32K_STABLE_THRES_M ((RTC_CNTL_XTAL32K_STABLE_THRES_V)<<(RTC_CNTL_XTAL32K_STABLE_THRES_S)) +#define RTC_CNTL_XTAL32K_STABLE_THRES_V 0xF +#define RTC_CNTL_XTAL32K_STABLE_THRES_S 28 +/* RTC_CNTL_XTAL32K_WDT_TIMEOUT : R/W ;bitpos:[27:20] ;default: 8'hff ; */ +/*description: If no clock detected for this amount of time 32k is regarded as dead*/ +#define RTC_CNTL_XTAL32K_WDT_TIMEOUT 0x000000FF +#define RTC_CNTL_XTAL32K_WDT_TIMEOUT_M ((RTC_CNTL_XTAL32K_WDT_TIMEOUT_V)<<(RTC_CNTL_XTAL32K_WDT_TIMEOUT_S)) +#define RTC_CNTL_XTAL32K_WDT_TIMEOUT_V 0xFF +#define RTC_CNTL_XTAL32K_WDT_TIMEOUT_S 20 +/* RTC_CNTL_XTAL32K_RESTART_WAIT : R/W ;bitpos:[19:4] ;default: 16'h0 ; */ +/*description: cycles to wait to repower on xtal 32k*/ +#define RTC_CNTL_XTAL32K_RESTART_WAIT 0x0000FFFF +#define RTC_CNTL_XTAL32K_RESTART_WAIT_M ((RTC_CNTL_XTAL32K_RESTART_WAIT_V)<<(RTC_CNTL_XTAL32K_RESTART_WAIT_S)) +#define RTC_CNTL_XTAL32K_RESTART_WAIT_V 0xFFFF +#define RTC_CNTL_XTAL32K_RESTART_WAIT_S 4 +/* RTC_CNTL_XTAL32K_RETURN_WAIT : R/W ;bitpos:[3:0] ;default: 4'h0 ; */ +/*description: cycles to wait to return noral xtal 32k*/ +#define RTC_CNTL_XTAL32K_RETURN_WAIT 0x0000000F +#define RTC_CNTL_XTAL32K_RETURN_WAIT_M ((RTC_CNTL_XTAL32K_RETURN_WAIT_V)<<(RTC_CNTL_XTAL32K_RETURN_WAIT_S)) +#define RTC_CNTL_XTAL32K_RETURN_WAIT_V 0xF +#define RTC_CNTL_XTAL32K_RETURN_WAIT_S 0 + +#define RTC_CNTL_ULP_CP_TIMER_REG (DR_REG_RTCCNTL_BASE + 0x00fc) +/* RTC_CNTL_ULP_CP_SLP_TIMER_EN : R/W ;bitpos:[31] ;default: 1'd0 ; */ +/*description: ULP-coprocessor timer enable bit*/ +#define RTC_CNTL_ULP_CP_SLP_TIMER_EN (BIT(31)) +#define RTC_CNTL_ULP_CP_SLP_TIMER_EN_M (BIT(31)) +#define RTC_CNTL_ULP_CP_SLP_TIMER_EN_V 0x1 +#define RTC_CNTL_ULP_CP_SLP_TIMER_EN_S 31 +/* RTC_CNTL_ULP_CP_GPIO_WAKEUP_CLR : WO ;bitpos:[30] ;default: 1'd0 ; */ +/*description: ULP-coprocessor wakeup by GPIO state clear*/ +#define RTC_CNTL_ULP_CP_GPIO_WAKEUP_CLR (BIT(30)) +#define RTC_CNTL_ULP_CP_GPIO_WAKEUP_CLR_M (BIT(30)) +#define RTC_CNTL_ULP_CP_GPIO_WAKEUP_CLR_V 0x1 +#define RTC_CNTL_ULP_CP_GPIO_WAKEUP_CLR_S 30 +/* RTC_CNTL_ULP_CP_GPIO_WAKEUP_ENA : R/W ;bitpos:[29] ;default: 1'd0 ; */ +/*description: ULP-coprocessor wakeup by GPIO enable*/ +#define RTC_CNTL_ULP_CP_GPIO_WAKEUP_ENA (BIT(29)) +#define RTC_CNTL_ULP_CP_GPIO_WAKEUP_ENA_M (BIT(29)) +#define RTC_CNTL_ULP_CP_GPIO_WAKEUP_ENA_V 0x1 +#define RTC_CNTL_ULP_CP_GPIO_WAKEUP_ENA_S 29 +/* RTC_CNTL_ULP_CP_TIMER_SLP_CYCLE : R/W ;bitpos:[27:12] ;default: 16'd200 ; */ +/*description: sleep cycles for ULP-coprocessor timer*/ +#define RTC_CNTL_ULP_CP_TIMER_SLP_CYCLE 0x0000FFFF +#define RTC_CNTL_ULP_CP_TIMER_SLP_CYCLE_M ((RTC_CNTL_ULP_CP_TIMER_SLP_CYCLE_V)<<(RTC_CNTL_ULP_CP_TIMER_SLP_CYCLE_S)) +#define RTC_CNTL_ULP_CP_TIMER_SLP_CYCLE_V 0xFFFF +#define RTC_CNTL_ULP_CP_TIMER_SLP_CYCLE_S 12 +/* RTC_CNTL_ULP_CP_PC_INIT : R/W ;bitpos:[10:0] ;default: 11'b0 ; */ +/*description: ULP-coprocessor PC initial address*/ +#define RTC_CNTL_ULP_CP_PC_INIT 0x000007FF +#define RTC_CNTL_ULP_CP_PC_INIT_M ((RTC_CNTL_ULP_CP_PC_INIT_V)<<(RTC_CNTL_ULP_CP_PC_INIT_S)) +#define RTC_CNTL_ULP_CP_PC_INIT_V 0x7FF +#define RTC_CNTL_ULP_CP_PC_INIT_S 0 + +#define RTC_CNTL_ULP_CP_CTRL_REG (DR_REG_RTCCNTL_BASE + 0x0100) +/* RTC_CNTL_ULP_CP_START_TOP : R/W ;bitpos:[31] ;default: 1'd0 ; */ +/*description: Write 1 to start ULP-coprocessor*/ +#define RTC_CNTL_ULP_CP_START_TOP (BIT(31)) +#define RTC_CNTL_ULP_CP_START_TOP_M (BIT(31)) +#define RTC_CNTL_ULP_CP_START_TOP_V 0x1 +#define RTC_CNTL_ULP_CP_START_TOP_S 31 +/* RTC_CNTL_ULP_CP_FORCE_START_TOP : R/W ;bitpos:[30] ;default: 1'd0 ; */ +/*description: 1: ULP-coprocessor is started by SW*/ +#define RTC_CNTL_ULP_CP_FORCE_START_TOP (BIT(30)) +#define RTC_CNTL_ULP_CP_FORCE_START_TOP_M (BIT(30)) +#define RTC_CNTL_ULP_CP_FORCE_START_TOP_V 0x1 +#define RTC_CNTL_ULP_CP_FORCE_START_TOP_S 30 +/* RTC_CNTL_ULP_CP_RESET : R/W ;bitpos:[29] ;default: 1'd0 ; */ +/*description: ulp coprocessor clk software reset*/ +#define RTC_CNTL_ULP_CP_RESET (BIT(29)) +#define RTC_CNTL_ULP_CP_RESET_M (BIT(29)) +#define RTC_CNTL_ULP_CP_RESET_V 0x1 +#define RTC_CNTL_ULP_CP_RESET_S 29 +/* RTC_CNTL_ULP_CP_CLK_FO : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: ulp coprocessor clk force on*/ +#define RTC_CNTL_ULP_CP_CLK_FO (BIT(28)) +#define RTC_CNTL_ULP_CP_CLK_FO_M (BIT(28)) +#define RTC_CNTL_ULP_CP_CLK_FO_V 0x1 +#define RTC_CNTL_ULP_CP_CLK_FO_S 28 +/* RTC_CNTL_ULP_CP_MEM_OFFST_CLR : WO ;bitpos:[22] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_ULP_CP_MEM_OFFST_CLR (BIT(22)) +#define RTC_CNTL_ULP_CP_MEM_OFFST_CLR_M (BIT(22)) +#define RTC_CNTL_ULP_CP_MEM_OFFST_CLR_V 0x1 +#define RTC_CNTL_ULP_CP_MEM_OFFST_CLR_S 22 +/* RTC_CNTL_ULP_CP_MEM_ADDR_SIZE : R/W ;bitpos:[21:11] ;default: 11'd512 ; */ +/*description: */ +#define RTC_CNTL_ULP_CP_MEM_ADDR_SIZE 0x000007FF +#define RTC_CNTL_ULP_CP_MEM_ADDR_SIZE_M ((RTC_CNTL_ULP_CP_MEM_ADDR_SIZE_V)<<(RTC_CNTL_ULP_CP_MEM_ADDR_SIZE_S)) +#define RTC_CNTL_ULP_CP_MEM_ADDR_SIZE_V 0x7FF +#define RTC_CNTL_ULP_CP_MEM_ADDR_SIZE_S 11 +/* RTC_CNTL_ULP_CP_MEM_ADDR_INIT : R/W ;bitpos:[10:0] ;default: 11'd512 ; */ +/*description: */ +#define RTC_CNTL_ULP_CP_MEM_ADDR_INIT 0x000007FF +#define RTC_CNTL_ULP_CP_MEM_ADDR_INIT_M ((RTC_CNTL_ULP_CP_MEM_ADDR_INIT_V)<<(RTC_CNTL_ULP_CP_MEM_ADDR_INIT_S)) +#define RTC_CNTL_ULP_CP_MEM_ADDR_INIT_V 0x7FF +#define RTC_CNTL_ULP_CP_MEM_ADDR_INIT_S 0 + +#define RTC_CNTL_COCPU_CTRL_REG (DR_REG_RTCCNTL_BASE + 0x0104) +/* RTC_CNTL_COCPU_SW_INT_TRIGGER : WO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: trigger cocpu register interrupt*/ +#define RTC_CNTL_COCPU_SW_INT_TRIGGER (BIT(24)) +#define RTC_CNTL_COCPU_SW_INT_TRIGGER_M (BIT(24)) +#define RTC_CNTL_COCPU_SW_INT_TRIGGER_V 0x1 +#define RTC_CNTL_COCPU_SW_INT_TRIGGER_S 24 +/* RTC_CNTL_COCPU_DONE : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: done signal used by riscv to control timer.*/ +#define RTC_CNTL_COCPU_DONE (BIT(23)) +#define RTC_CNTL_COCPU_DONE_M (BIT(23)) +#define RTC_CNTL_COCPU_DONE_V 0x1 +#define RTC_CNTL_COCPU_DONE_S 23 +/* RTC_CNTL_COCPU_DONE_FORCE : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: 1: select riscv done 0: select ulp done*/ +#define RTC_CNTL_COCPU_DONE_FORCE (BIT(22)) +#define RTC_CNTL_COCPU_DONE_FORCE_M (BIT(22)) +#define RTC_CNTL_COCPU_DONE_FORCE_V 0x1 +#define RTC_CNTL_COCPU_DONE_FORCE_S 22 +/* RTC_CNTL_COCPU_SEL : R/W ;bitpos:[21] ;default: 1'b1 ; */ +/*description: 1: old ULP 0: new riscV*/ +#define RTC_CNTL_COCPU_SEL (BIT(21)) +#define RTC_CNTL_COCPU_SEL_M (BIT(21)) +#define RTC_CNTL_COCPU_SEL_V 0x1 +#define RTC_CNTL_COCPU_SEL_S 21 +/* RTC_CNTL_COCPU_SHUT_RESET_EN : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: to reset cocpu*/ +#define RTC_CNTL_COCPU_SHUT_RESET_EN (BIT(20)) +#define RTC_CNTL_COCPU_SHUT_RESET_EN_M (BIT(20)) +#define RTC_CNTL_COCPU_SHUT_RESET_EN_V 0x1 +#define RTC_CNTL_COCPU_SHUT_RESET_EN_S 20 +/* RTC_CNTL_COCPU_SHUT_2_CLK_DIS : R/W ;bitpos:[19:14] ;default: 6'd24 ; */ +/*description: time from shut cocpu to disable clk*/ +#define RTC_CNTL_COCPU_SHUT_2_CLK_DIS 0x0000003F +#define RTC_CNTL_COCPU_SHUT_2_CLK_DIS_M ((RTC_CNTL_COCPU_SHUT_2_CLK_DIS_V)<<(RTC_CNTL_COCPU_SHUT_2_CLK_DIS_S)) +#define RTC_CNTL_COCPU_SHUT_2_CLK_DIS_V 0x3F +#define RTC_CNTL_COCPU_SHUT_2_CLK_DIS_S 14 +/* RTC_CNTL_COCPU_SHUT : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: to shut cocpu*/ +#define RTC_CNTL_COCPU_SHUT (BIT(13)) +#define RTC_CNTL_COCPU_SHUT_M (BIT(13)) +#define RTC_CNTL_COCPU_SHUT_V 0x1 +#define RTC_CNTL_COCPU_SHUT_S 13 +/* RTC_CNTL_COCPU_START_2_INTR_EN : R/W ;bitpos:[12:7] ;default: 6'd16 ; */ +/*description: time from start cocpu to give start interrupt*/ +#define RTC_CNTL_COCPU_START_2_INTR_EN 0x0000003F +#define RTC_CNTL_COCPU_START_2_INTR_EN_M ((RTC_CNTL_COCPU_START_2_INTR_EN_V)<<(RTC_CNTL_COCPU_START_2_INTR_EN_S)) +#define RTC_CNTL_COCPU_START_2_INTR_EN_V 0x3F +#define RTC_CNTL_COCPU_START_2_INTR_EN_S 7 +/* RTC_CNTL_COCPU_START_2_RESET_DIS : R/W ;bitpos:[6:1] ;default: 6'd8 ; */ +/*description: time from start cocpu to pull down reset*/ +#define RTC_CNTL_COCPU_START_2_RESET_DIS 0x0000003F +#define RTC_CNTL_COCPU_START_2_RESET_DIS_M ((RTC_CNTL_COCPU_START_2_RESET_DIS_V)<<(RTC_CNTL_COCPU_START_2_RESET_DIS_S)) +#define RTC_CNTL_COCPU_START_2_RESET_DIS_V 0x3F +#define RTC_CNTL_COCPU_START_2_RESET_DIS_S 1 +/* RTC_CNTL_COCPU_CLK_FO : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: cocpu clk force on*/ +#define RTC_CNTL_COCPU_CLK_FO (BIT(0)) +#define RTC_CNTL_COCPU_CLK_FO_M (BIT(0)) +#define RTC_CNTL_COCPU_CLK_FO_V 0x1 +#define RTC_CNTL_COCPU_CLK_FO_S 0 + +#define RTC_CNTL_TOUCH_CTRL1_REG (DR_REG_RTCCNTL_BASE + 0x0108) +/* RTC_CNTL_TOUCH_MEAS_NUM : R/W ;bitpos:[31:16] ;default: 16'h1000 ; */ +/*description: the meas length (in 8MHz)*/ +#define RTC_CNTL_TOUCH_MEAS_NUM 0x0000FFFF +#define RTC_CNTL_TOUCH_MEAS_NUM_M ((RTC_CNTL_TOUCH_MEAS_NUM_V)<<(RTC_CNTL_TOUCH_MEAS_NUM_S)) +#define RTC_CNTL_TOUCH_MEAS_NUM_V 0xFFFF +#define RTC_CNTL_TOUCH_MEAS_NUM_S 16 +/* RTC_CNTL_TOUCH_SLEEP_CYCLES : R/W ;bitpos:[15:0] ;default: 16'h100 ; */ +/*description: sleep cycles for timer*/ +#define RTC_CNTL_TOUCH_SLEEP_CYCLES 0x0000FFFF +#define RTC_CNTL_TOUCH_SLEEP_CYCLES_M ((RTC_CNTL_TOUCH_SLEEP_CYCLES_V)<<(RTC_CNTL_TOUCH_SLEEP_CYCLES_S)) +#define RTC_CNTL_TOUCH_SLEEP_CYCLES_V 0xFFFF +#define RTC_CNTL_TOUCH_SLEEP_CYCLES_S 0 + +#define RTC_CNTL_TOUCH_CTRL2_REG (DR_REG_RTCCNTL_BASE + 0x010c) +/* RTC_CNTL_TOUCH_CLKGATE_EN : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: touch clock enable*/ +#define RTC_CNTL_TOUCH_CLKGATE_EN (BIT(31)) +#define RTC_CNTL_TOUCH_CLKGATE_EN_M (BIT(31)) +#define RTC_CNTL_TOUCH_CLKGATE_EN_V 0x1 +#define RTC_CNTL_TOUCH_CLKGATE_EN_S 31 +/* RTC_CNTL_TOUCH_CLK_FO : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: touch clock force on*/ +#define RTC_CNTL_TOUCH_CLK_FO (BIT(30)) +#define RTC_CNTL_TOUCH_CLK_FO_M (BIT(30)) +#define RTC_CNTL_TOUCH_CLK_FO_V 0x1 +#define RTC_CNTL_TOUCH_CLK_FO_S 30 +/* RTC_CNTL_TOUCH_RESET : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: reset upgrade touch*/ +#define RTC_CNTL_TOUCH_RESET (BIT(29)) +#define RTC_CNTL_TOUCH_RESET_M (BIT(29)) +#define RTC_CNTL_TOUCH_RESET_V 0x1 +#define RTC_CNTL_TOUCH_RESET_S 29 +/* RTC_CNTL_TOUCH_SLP_CYC_DIV : R/W ;bitpos:[26:25] ;default: 2'd0 ; */ +/*description: when a touch pad is active sleep cycle could be divided by this number*/ +#define RTC_CNTL_TOUCH_SLP_CYC_DIV 0x00000003 +#define RTC_CNTL_TOUCH_SLP_CYC_DIV_M ((RTC_CNTL_TOUCH_SLP_CYC_DIV_V)<<(RTC_CNTL_TOUCH_SLP_CYC_DIV_S)) +#define RTC_CNTL_TOUCH_SLP_CYC_DIV_V 0x3 +#define RTC_CNTL_TOUCH_SLP_CYC_DIV_S 25 +/* RTC_CNTL_TOUCH_XPD_WAIT : R/W ;bitpos:[24:17] ;default: 8'h4 ; */ +/*description: the waiting cycles (in 8MHz) between TOUCH_START and TOUCH_XPD*/ +#define RTC_CNTL_TOUCH_XPD_WAIT 0x000000FF +#define RTC_CNTL_TOUCH_XPD_WAIT_M ((RTC_CNTL_TOUCH_XPD_WAIT_V)<<(RTC_CNTL_TOUCH_XPD_WAIT_S)) +#define RTC_CNTL_TOUCH_XPD_WAIT_V 0xFF +#define RTC_CNTL_TOUCH_XPD_WAIT_S 17 +/* RTC_CNTL_TOUCH_START_FORCE : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: 1: to start touch fsm by SW*/ +#define RTC_CNTL_TOUCH_START_FORCE (BIT(16)) +#define RTC_CNTL_TOUCH_START_FORCE_M (BIT(16)) +#define RTC_CNTL_TOUCH_START_FORCE_V 0x1 +#define RTC_CNTL_TOUCH_START_FORCE_S 16 +/* RTC_CNTL_TOUCH_START_EN : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: 1: start touch fsm*/ +#define RTC_CNTL_TOUCH_START_EN (BIT(15)) +#define RTC_CNTL_TOUCH_START_EN_M (BIT(15)) +#define RTC_CNTL_TOUCH_START_EN_V 0x1 +#define RTC_CNTL_TOUCH_START_EN_S 15 +/* RTC_CNTL_TOUCH_START_FSM_EN : R/W ;bitpos:[14] ;default: 1'b1 ; */ +/*description: 1: TOUCH_START & TOUCH_XPD is controlled by touch fsm*/ +#define RTC_CNTL_TOUCH_START_FSM_EN (BIT(14)) +#define RTC_CNTL_TOUCH_START_FSM_EN_M (BIT(14)) +#define RTC_CNTL_TOUCH_START_FSM_EN_V 0x1 +#define RTC_CNTL_TOUCH_START_FSM_EN_S 14 +/* RTC_CNTL_TOUCH_SLP_TIMER_EN : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: touch timer enable bit*/ +#define RTC_CNTL_TOUCH_SLP_TIMER_EN (BIT(13)) +#define RTC_CNTL_TOUCH_SLP_TIMER_EN_M (BIT(13)) +#define RTC_CNTL_TOUCH_SLP_TIMER_EN_V 0x1 +#define RTC_CNTL_TOUCH_SLP_TIMER_EN_S 13 +/* RTC_CNTL_TOUCH_REFC : R/W ;bitpos:[11:9] ;default: 3'h4 ; */ +/*description: TOUCH pad0 reference cap*/ +#define RTC_CNTL_TOUCH_REFC 0x00000007 +#define RTC_CNTL_TOUCH_REFC_M ((RTC_CNTL_TOUCH_REFC_V)<<(RTC_CNTL_TOUCH_REFC_S)) +#define RTC_CNTL_TOUCH_REFC_V 0x7 +#define RTC_CNTL_TOUCH_REFC_S 9 +/* RTC_CNTL_TOUCH_XPD_BIAS : R/W ;bitpos:[8] ;default: 1'd0 ; */ +/*description: TOUCH_XPD_BIAS*/ +#define RTC_CNTL_TOUCH_XPD_BIAS (BIT(8)) +#define RTC_CNTL_TOUCH_XPD_BIAS_M (BIT(8)) +#define RTC_CNTL_TOUCH_XPD_BIAS_V 0x1 +#define RTC_CNTL_TOUCH_XPD_BIAS_S 8 +/* RTC_CNTL_TOUCH_DREFH : R/W ;bitpos:[7:6] ;default: 2'b11 ; */ +/*description: TOUCH_DREFH*/ +#define RTC_CNTL_TOUCH_DREFH 0x00000003 +#define RTC_CNTL_TOUCH_DREFH_M ((RTC_CNTL_TOUCH_DREFH_V)<<(RTC_CNTL_TOUCH_DREFH_S)) +#define RTC_CNTL_TOUCH_DREFH_V 0x3 +#define RTC_CNTL_TOUCH_DREFH_S 6 +/* RTC_CNTL_TOUCH_DREFL : R/W ;bitpos:[5:4] ;default: 2'b00 ; */ +/*description: TOUCH_DREFL*/ +#define RTC_CNTL_TOUCH_DREFL 0x00000003 +#define RTC_CNTL_TOUCH_DREFL_M ((RTC_CNTL_TOUCH_DREFL_V)<<(RTC_CNTL_TOUCH_DREFL_S)) +#define RTC_CNTL_TOUCH_DREFL_V 0x3 +#define RTC_CNTL_TOUCH_DREFL_S 4 +/* RTC_CNTL_TOUCH_DRANGE : R/W ;bitpos:[3:2] ;default: 2'b11 ; */ +/*description: TOUCH_DRANGE*/ +#define RTC_CNTL_TOUCH_DRANGE 0x00000003 +#define RTC_CNTL_TOUCH_DRANGE_M ((RTC_CNTL_TOUCH_DRANGE_V)<<(RTC_CNTL_TOUCH_DRANGE_S)) +#define RTC_CNTL_TOUCH_DRANGE_V 0x3 +#define RTC_CNTL_TOUCH_DRANGE_S 2 + +#define RTC_CNTL_TOUCH_SCAN_CTRL_REG (DR_REG_RTCCNTL_BASE + 0x0110) +/* RTC_CNTL_TOUCH_OUT_RING : R/W ;bitpos:[31:28] ;default: 4'hf ; */ +/*description: select out ring pad*/ +#define RTC_CNTL_TOUCH_OUT_RING 0x0000000F +#define RTC_CNTL_TOUCH_OUT_RING_M ((RTC_CNTL_TOUCH_OUT_RING_V)<<(RTC_CNTL_TOUCH_OUT_RING_S)) +#define RTC_CNTL_TOUCH_OUT_RING_V 0xF +#define RTC_CNTL_TOUCH_OUT_RING_S 28 +/* RTC_CNTL_TOUCH_BUFDRV : R/W ;bitpos:[27:25] ;default: 3'h4 ; */ +/*description: touch7 buffer driver strength*/ +#define RTC_CNTL_TOUCH_BUFDRV 0x00000007 +#define RTC_CNTL_TOUCH_BUFDRV_M ((RTC_CNTL_TOUCH_BUFDRV_V)<<(RTC_CNTL_TOUCH_BUFDRV_S)) +#define RTC_CNTL_TOUCH_BUFDRV_V 0x7 +#define RTC_CNTL_TOUCH_BUFDRV_S 25 +/* RTC_CNTL_TOUCH_SCAN_PAD_MAP : R/W ;bitpos:[24:10] ;default: 15'h0 ; */ +/*description: touch scan mode pad enable map*/ +#define RTC_CNTL_TOUCH_SCAN_PAD_MAP 0x00007FFF +#define RTC_CNTL_TOUCH_SCAN_PAD_MAP_M ((RTC_CNTL_TOUCH_SCAN_PAD_MAP_V)<<(RTC_CNTL_TOUCH_SCAN_PAD_MAP_S)) +#define RTC_CNTL_TOUCH_SCAN_PAD_MAP_V 0x7FFF +#define RTC_CNTL_TOUCH_SCAN_PAD_MAP_S 10 +/* RTC_CNTL_TOUCH_SHIELD_PAD_EN : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: touch pad14 will be used as shield*/ +#define RTC_CNTL_TOUCH_SHIELD_PAD_EN (BIT(9)) +#define RTC_CNTL_TOUCH_SHIELD_PAD_EN_M (BIT(9)) +#define RTC_CNTL_TOUCH_SHIELD_PAD_EN_V 0x1 +#define RTC_CNTL_TOUCH_SHIELD_PAD_EN_S 9 +/* RTC_CNTL_TOUCH_INACTIVE_CONNECTION : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: inactive touch pads connect to 1: gnd 0: HighZ*/ +#define RTC_CNTL_TOUCH_INACTIVE_CONNECTION (BIT(8)) +#define RTC_CNTL_TOUCH_INACTIVE_CONNECTION_M (BIT(8)) +#define RTC_CNTL_TOUCH_INACTIVE_CONNECTION_V 0x1 +#define RTC_CNTL_TOUCH_INACTIVE_CONNECTION_S 8 +/* RTC_CNTL_TOUCH_DENOISE_EN : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: touch pad0 will be used to de-noise*/ +#define RTC_CNTL_TOUCH_DENOISE_EN (BIT(2)) +#define RTC_CNTL_TOUCH_DENOISE_EN_M (BIT(2)) +#define RTC_CNTL_TOUCH_DENOISE_EN_V 0x1 +#define RTC_CNTL_TOUCH_DENOISE_EN_S 2 +/* RTC_CNTL_TOUCH_DENOISE_RES : R/W ;bitpos:[1:0] ;default: 2'd2 ; */ +/*description: De-noise resolution: 12/10/8/4 bit*/ +#define RTC_CNTL_TOUCH_DENOISE_RES 0x00000003 +#define RTC_CNTL_TOUCH_DENOISE_RES_M ((RTC_CNTL_TOUCH_DENOISE_RES_V)<<(RTC_CNTL_TOUCH_DENOISE_RES_S)) +#define RTC_CNTL_TOUCH_DENOISE_RES_V 0x3 +#define RTC_CNTL_TOUCH_DENOISE_RES_S 0 + +#define RTC_CNTL_TOUCH_SLP_THRES_REG (DR_REG_RTCCNTL_BASE + 0x0114) +/* RTC_CNTL_TOUCH_SLP_PAD : R/W ;bitpos:[31:27] ;default: 4'hF ; */ +/*description: */ +#define RTC_CNTL_TOUCH_SLP_PAD 0x0000001F +#define RTC_CNTL_TOUCH_SLP_PAD_M ((RTC_CNTL_TOUCH_SLP_PAD_V)<<(RTC_CNTL_TOUCH_SLP_PAD_S)) +#define RTC_CNTL_TOUCH_SLP_PAD_V 0x1F +#define RTC_CNTL_TOUCH_SLP_PAD_S 27 +/* RTC_CNTL_TOUCH_SLP_APPROACH_EN : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: sleep pad approach function enable*/ +#define RTC_CNTL_TOUCH_SLP_APPROACH_EN (BIT(26)) +#define RTC_CNTL_TOUCH_SLP_APPROACH_EN_M (BIT(26)) +#define RTC_CNTL_TOUCH_SLP_APPROACH_EN_V 0x1 +#define RTC_CNTL_TOUCH_SLP_APPROACH_EN_S 26 +/* RTC_CNTL_TOUCH_SLP_TH : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the threshold for sleep touch pad*/ +#define RTC_CNTL_TOUCH_SLP_TH 0x003FFFFF +#define RTC_CNTL_TOUCH_SLP_TH_M ((RTC_CNTL_TOUCH_SLP_TH_V)<<(RTC_CNTL_TOUCH_SLP_TH_S)) +#define RTC_CNTL_TOUCH_SLP_TH_V 0x3FFFFF +#define RTC_CNTL_TOUCH_SLP_TH_S 0 + +#define RTC_CNTL_TOUCH_APPROACH_REG (DR_REG_RTCCNTL_BASE + 0x0118) +/* RTC_CNTL_TOUCH_APPROACH_MEAS_TIME : R/W ;bitpos:[31:24] ;default: 8'd80 ; */ +/*description: approach pads total meas times*/ +#define RTC_CNTL_TOUCH_APPROACH_MEAS_TIME 0x000000FF +#define RTC_CNTL_TOUCH_APPROACH_MEAS_TIME_M ((RTC_CNTL_TOUCH_APPROACH_MEAS_TIME_V)<<(RTC_CNTL_TOUCH_APPROACH_MEAS_TIME_S)) +#define RTC_CNTL_TOUCH_APPROACH_MEAS_TIME_V 0xFF +#define RTC_CNTL_TOUCH_APPROACH_MEAS_TIME_S 24 +/* RTC_CNTL_TOUCH_SLP_CHANNEL_CLR : WO ;bitpos:[23] ;default: 1'd0 ; */ +/*description: clear touch slp channel*/ +#define RTC_CNTL_TOUCH_SLP_CHANNEL_CLR (BIT(23)) +#define RTC_CNTL_TOUCH_SLP_CHANNEL_CLR_M (BIT(23)) +#define RTC_CNTL_TOUCH_SLP_CHANNEL_CLR_V 0x1 +#define RTC_CNTL_TOUCH_SLP_CHANNEL_CLR_S 23 + +#define RTC_CNTL_TOUCH_FILTER_CTRL_REG (DR_REG_RTCCNTL_BASE + 0x011c) +/* RTC_CNTL_TOUCH_FILTER_EN : R/W ;bitpos:[31] ;default: 1'b1 ; */ +/*description: touch filter enable*/ +#define RTC_CNTL_TOUCH_FILTER_EN (BIT(31)) +#define RTC_CNTL_TOUCH_FILTER_EN_M (BIT(31)) +#define RTC_CNTL_TOUCH_FILTER_EN_V 0x1 +#define RTC_CNTL_TOUCH_FILTER_EN_S 31 +/* RTC_CNTL_TOUCH_FILTER_MODE : R/W ;bitpos:[30:29] ;default: 2'd1 ; */ +/*description: 0: IIR ? 1: IIR ? 2: IIR 1/8 3: Jitter*/ +#define RTC_CNTL_TOUCH_FILTER_MODE 0x00000003 +#define RTC_CNTL_TOUCH_FILTER_MODE_M ((RTC_CNTL_TOUCH_FILTER_MODE_V)<<(RTC_CNTL_TOUCH_FILTER_MODE_S)) +#define RTC_CNTL_TOUCH_FILTER_MODE_V 0x3 +#define RTC_CNTL_TOUCH_FILTER_MODE_S 29 +/* RTC_CNTL_TOUCH_DEBOUNCE : R/W ;bitpos:[28:26] ;default: 3'd3 ; */ +/*description: debounce counter*/ +#define RTC_CNTL_TOUCH_DEBOUNCE 0x00000007 +#define RTC_CNTL_TOUCH_DEBOUNCE_M ((RTC_CNTL_TOUCH_DEBOUNCE_V)<<(RTC_CNTL_TOUCH_DEBOUNCE_S)) +#define RTC_CNTL_TOUCH_DEBOUNCE_V 0x7 +#define RTC_CNTL_TOUCH_DEBOUNCE_S 26 +/* RTC_CNTL_TOUCH_HYSTERESIS : R/W ;bitpos:[25:24] ;default: 2'd1 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_HYSTERESIS 0x00000003 +#define RTC_CNTL_TOUCH_HYSTERESIS_M ((RTC_CNTL_TOUCH_HYSTERESIS_V)<<(RTC_CNTL_TOUCH_HYSTERESIS_S)) +#define RTC_CNTL_TOUCH_HYSTERESIS_V 0x3 +#define RTC_CNTL_TOUCH_HYSTERESIS_S 24 +/* RTC_CNTL_TOUCH_NOISE_THRES : R/W ;bitpos:[23:22] ;default: 2'd1 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_NOISE_THRES 0x00000003 +#define RTC_CNTL_TOUCH_NOISE_THRES_M ((RTC_CNTL_TOUCH_NOISE_THRES_V)<<(RTC_CNTL_TOUCH_NOISE_THRES_S)) +#define RTC_CNTL_TOUCH_NOISE_THRES_V 0x3 +#define RTC_CNTL_TOUCH_NOISE_THRES_S 22 +/* RTC_CNTL_TOUCH_NEG_NOISE_THRES : R/W ;bitpos:[21:20] ;default: 2'd1 ; */ +/*description: */ +#define RTC_CNTL_TOUCH_NEG_NOISE_THRES 0x00000003 +#define RTC_CNTL_TOUCH_NEG_NOISE_THRES_M ((RTC_CNTL_TOUCH_NEG_NOISE_THRES_V)<<(RTC_CNTL_TOUCH_NEG_NOISE_THRES_S)) +#define RTC_CNTL_TOUCH_NEG_NOISE_THRES_V 0x3 +#define RTC_CNTL_TOUCH_NEG_NOISE_THRES_S 20 +/* RTC_CNTL_TOUCH_NEG_NOISE_LIMIT : R/W ;bitpos:[19:16] ;default: 4'd5 ; */ +/*description: negative threshold counter limit*/ +#define RTC_CNTL_TOUCH_NEG_NOISE_LIMIT 0x0000000F +#define RTC_CNTL_TOUCH_NEG_NOISE_LIMIT_M ((RTC_CNTL_TOUCH_NEG_NOISE_LIMIT_V)<<(RTC_CNTL_TOUCH_NEG_NOISE_LIMIT_S)) +#define RTC_CNTL_TOUCH_NEG_NOISE_LIMIT_V 0xF +#define RTC_CNTL_TOUCH_NEG_NOISE_LIMIT_S 16 +/* RTC_CNTL_TOUCH_JITTER_STEP : R/W ;bitpos:[15:12] ;default: 4'd1 ; */ +/*description: touch jitter step*/ +#define RTC_CNTL_TOUCH_JITTER_STEP 0x0000000F +#define RTC_CNTL_TOUCH_JITTER_STEP_M ((RTC_CNTL_TOUCH_JITTER_STEP_V)<<(RTC_CNTL_TOUCH_JITTER_STEP_S)) +#define RTC_CNTL_TOUCH_JITTER_STEP_V 0xF +#define RTC_CNTL_TOUCH_JITTER_STEP_S 12 + +#define RTC_CNTL_USB_CONF_REG (DR_REG_RTCCNTL_BASE + 0x0120) +/* RTC_CNTL_USB_TX_EN_OVERRIDE : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_TX_EN_OVERRIDE (BIT(16)) +#define RTC_CNTL_USB_TX_EN_OVERRIDE_M (BIT(16)) +#define RTC_CNTL_USB_TX_EN_OVERRIDE_V 0x1 +#define RTC_CNTL_USB_TX_EN_OVERRIDE_S 16 +/* RTC_CNTL_USB_TX_EN : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_TX_EN (BIT(15)) +#define RTC_CNTL_USB_TX_EN_M (BIT(15)) +#define RTC_CNTL_USB_TX_EN_V 0x1 +#define RTC_CNTL_USB_TX_EN_S 15 +/* RTC_CNTL_USB_TXP : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_TXP (BIT(14)) +#define RTC_CNTL_USB_TXP_M (BIT(14)) +#define RTC_CNTL_USB_TXP_V 0x1 +#define RTC_CNTL_USB_TXP_S 14 +/* RTC_CNTL_USB_TXM : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_TXM (BIT(13)) +#define RTC_CNTL_USB_TXM_M (BIT(13)) +#define RTC_CNTL_USB_TXM_V 0x1 +#define RTC_CNTL_USB_TXM_S 13 +/* RTC_CNTL_USB_PAD_ENABLE : R/W ;bitpos:[12] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_PAD_ENABLE (BIT(12)) +#define RTC_CNTL_USB_PAD_ENABLE_M (BIT(12)) +#define RTC_CNTL_USB_PAD_ENABLE_V 0x1 +#define RTC_CNTL_USB_PAD_ENABLE_S 12 +/* RTC_CNTL_USB_PAD_ENABLE_OVERRIDE : R/W ;bitpos:[11] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_PAD_ENABLE_OVERRIDE (BIT(11)) +#define RTC_CNTL_USB_PAD_ENABLE_OVERRIDE_M (BIT(11)) +#define RTC_CNTL_USB_PAD_ENABLE_OVERRIDE_V 0x1 +#define RTC_CNTL_USB_PAD_ENABLE_OVERRIDE_S 11 +/* RTC_CNTL_USB_PULLUP_VALUE : R/W ;bitpos:[10] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_PULLUP_VALUE (BIT(10)) +#define RTC_CNTL_USB_PULLUP_VALUE_M (BIT(10)) +#define RTC_CNTL_USB_PULLUP_VALUE_V 0x1 +#define RTC_CNTL_USB_PULLUP_VALUE_S 10 +/* RTC_CNTL_USB_DM_PULLDOWN : R/W ;bitpos:[9] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_DM_PULLDOWN (BIT(9)) +#define RTC_CNTL_USB_DM_PULLDOWN_M (BIT(9)) +#define RTC_CNTL_USB_DM_PULLDOWN_V 0x1 +#define RTC_CNTL_USB_DM_PULLDOWN_S 9 +/* RTC_CNTL_USB_DM_PULLUP : R/W ;bitpos:[8] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_DM_PULLUP (BIT(8)) +#define RTC_CNTL_USB_DM_PULLUP_M (BIT(8)) +#define RTC_CNTL_USB_DM_PULLUP_V 0x1 +#define RTC_CNTL_USB_DM_PULLUP_S 8 +/* RTC_CNTL_USB_DP_PULLDOWN : R/W ;bitpos:[7] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_DP_PULLDOWN (BIT(7)) +#define RTC_CNTL_USB_DP_PULLDOWN_M (BIT(7)) +#define RTC_CNTL_USB_DP_PULLDOWN_V 0x1 +#define RTC_CNTL_USB_DP_PULLDOWN_S 7 +/* RTC_CNTL_USB_DP_PULLUP : R/W ;bitpos:[6] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_DP_PULLUP (BIT(6)) +#define RTC_CNTL_USB_DP_PULLUP_M (BIT(6)) +#define RTC_CNTL_USB_DP_PULLUP_V 0x1 +#define RTC_CNTL_USB_DP_PULLUP_S 6 +/* RTC_CNTL_USB_PAD_PULL_OVERRIDE : R/W ;bitpos:[5] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_PAD_PULL_OVERRIDE (BIT(5)) +#define RTC_CNTL_USB_PAD_PULL_OVERRIDE_M (BIT(5)) +#define RTC_CNTL_USB_PAD_PULL_OVERRIDE_V 0x1 +#define RTC_CNTL_USB_PAD_PULL_OVERRIDE_S 5 +/* RTC_CNTL_USB_VREF_OVERRIDE : R/W ;bitpos:[4] ;default: 1'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_VREF_OVERRIDE (BIT(4)) +#define RTC_CNTL_USB_VREF_OVERRIDE_M (BIT(4)) +#define RTC_CNTL_USB_VREF_OVERRIDE_V 0x1 +#define RTC_CNTL_USB_VREF_OVERRIDE_S 4 +/* RTC_CNTL_USB_VREFL : R/W ;bitpos:[3:2] ;default: 2'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_VREFL 0x00000003 +#define RTC_CNTL_USB_VREFL_M ((RTC_CNTL_USB_VREFL_V)<<(RTC_CNTL_USB_VREFL_S)) +#define RTC_CNTL_USB_VREFL_V 0x3 +#define RTC_CNTL_USB_VREFL_S 2 +/* RTC_CNTL_USB_VREFH : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: */ +#define RTC_CNTL_USB_VREFH 0x00000003 +#define RTC_CNTL_USB_VREFH_M ((RTC_CNTL_USB_VREFH_V)<<(RTC_CNTL_USB_VREFH_S)) +#define RTC_CNTL_USB_VREFH_V 0x3 +#define RTC_CNTL_USB_VREFH_S 0 + +#define RTC_CNTL_DATE_REG (DR_REG_RTCCNTL_BASE + 0x0124) +/* RTC_CNTL_CNTL_DATE : R/W ;bitpos:[27:0] ;default: 28'h1810310 ; */ +/*description: */ +#define RTC_CNTL_CNTL_DATE 0x0FFFFFFF +#define RTC_CNTL_CNTL_DATE_M ((RTC_CNTL_CNTL_DATE_V)<<(RTC_CNTL_CNTL_DATE_S)) +#define RTC_CNTL_CNTL_DATE_V 0xFFFFFFF +#define RTC_CNTL_CNTL_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_RTC_CNTL_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/rtc_cntl_struct.h b/components/soc/esp32s2beta/include/soc/rtc_cntl_struct.h new file mode 100644 index 0000000000..03f2ec0f58 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/rtc_cntl_struct.h @@ -0,0 +1,838 @@ +// Copyright 2017-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_RTC_CNTL_STRUCT_H_ +#define _SOC_RTC_CNTL_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t sw_stall_appcpu_c0: 2; /*{reg_sw_stall_appcpu_c1[5:0] reg_sw_stall_appcpu_c0[1:0]} == 0x86 will stall APP CPU*/ + uint32_t sw_stall_procpu_c0: 2; /*{reg_sw_stall_procpu_c1[5:0] reg_sw_stall_procpu_c0[1:0]} == 0x86 will stall PRO CPU*/ + uint32_t sw_appcpu_rst: 1; /*APP CPU SW reset*/ + uint32_t sw_procpu_rst: 1; /*PRO CPU SW reset*/ + uint32_t bb_i2c_force_pd: 1; /*BB_I2C force power down*/ + uint32_t bb_i2c_force_pu: 1; /*BB_I2C force power up*/ + uint32_t bbpll_i2c_force_pd: 1; /*BB_PLL _I2C force power down*/ + uint32_t bbpll_i2c_force_pu: 1; /*BB_PLL_I2C force power up*/ + uint32_t bbpll_force_pd: 1; /*BB_PLL force power down*/ + uint32_t bbpll_force_pu: 1; /*BB_PLL force power up*/ + uint32_t xtl_force_pd: 1; /*crystall force power down*/ + uint32_t xtl_force_pu: 1; /*crystall force power up*/ + uint32_t bias_sleep_folw_8m: 1; /*BIAS_SLEEP follow CK8M*/ + uint32_t bias_force_sleep: 1; /*BIAS_SLEEP force sleep*/ + uint32_t bias_force_nosleep: 1; /*BIAS_SLEEP force no sleep*/ + uint32_t bias_i2c_folw_8m: 1; /*BIAS_I2C follow CK8M*/ + uint32_t bias_i2c_force_pd: 1; /*BIAS_I2C force power down*/ + uint32_t bias_i2c_force_pu: 1; /*BIAS_I2C force power up*/ + uint32_t bias_core_folw_8m: 1; /*BIAS_CORE follow CK8M*/ + uint32_t bias_core_force_pd: 1; /*BIAS_CORE force power down*/ + uint32_t bias_core_force_pu: 1; /*BIAS_CORE force power up*/ + uint32_t xtl_force_iso: 1; + uint32_t pll_force_iso: 1; + uint32_t analog_force_iso: 1; + uint32_t xtl_force_noiso: 1; + uint32_t pll_force_noiso: 1; + uint32_t analog_force_noiso: 1; + uint32_t dg_wrap_force_rst: 1; /*digital wrap force reset in deep sleep*/ + uint32_t dg_wrap_force_norst: 1; /*digital core force no reset in deep sleep*/ + uint32_t sw_sys_rst: 1; /*SW system reset*/ + }; + uint32_t val; + } options0; + uint32_t slp_timer0; /*RTC sleep timer low 32 bits*/ + union { + struct { + uint32_t slp_val_hi: 16; /*RTC sleep timer high 16 bits*/ + uint32_t main_timer_alarm_en: 1; /*timer alarm enable bit*/ + uint32_t reserved17: 15; + }; + uint32_t val; + } slp_timer1; + union { + struct { + uint32_t reserved0: 27; + uint32_t timer_sys_stall: 1; /*Enable to record system stall time*/ + uint32_t timer_xtl_off: 1; /*Enable to record 40M XTAL OFF time*/ + uint32_t timer_sys_rst: 1; /*enable to record system reset time*/ + uint32_t valid: 1; /*To indicate the register is updated*/ + uint32_t update: 1; /*Set 1: to update register with RTC timer*/ + }; + uint32_t val; + } time_update; + uint32_t time_low0; /*RTC timer low 32 bits*/ + union { + struct { + uint32_t rtc_timer_value0_high:16; /*RTC timer high 16 bits*/ + uint32_t reserved16: 16; + }; + uint32_t val; + } time_high0; + union { + struct { + uint32_t rtc_sw_cpu_int: 1; /*rtc software interrupt to main cpu*/ + uint32_t rtc_slp_reject_cause_clr: 1; /*clear rtc sleep reject cause*/ + uint32_t reserved2: 20; + uint32_t apb2rtc_bridge_sel: 1; /*1: APB to RTC using bridge 0: APB to RTC using sync*/ + uint32_t reserved23: 5; + uint32_t sdio_active_ind: 1; /*SDIO active indication*/ + uint32_t slp_wakeup: 1; /*leep wakeup bit*/ + uint32_t slp_reject: 1; /*leep reject bit*/ + uint32_t sleep_en: 1; /*sleep enable bit*/ + }; + uint32_t val; + } state0; + union { + struct { + uint32_t cpu_stall_en: 1; /*CPU stall enable bit*/ + uint32_t cpu_stall_wait: 5; /*CPU stall wait cycles in fast_clk_rtc*/ + uint32_t ck8m_wait: 8; /*CK8M wait cycles in slow_clk_rtc*/ + uint32_t xtl_buf_wait: 10; /*XTAL wait cycles in slow_clk_rtc*/ + uint32_t pll_buf_wait: 8; /*PLL wait cycles in slow_clk_rtc*/ + }; + uint32_t val; + } timer1; + union { + struct { + uint32_t reserved0: 15; + uint32_t ulpcp_touch_start_wait: 9; /*wait cycles in slow_clk_rtc before ULP-coprocessor / touch controller start to work*/ + uint32_t min_time_ck8m_off: 8; /*minimal cycles in slow_clk_rtc for CK8M in power down state*/ + }; + uint32_t val; + } timer2; + union { + struct { + uint32_t wifi_wait_timer: 9; + uint32_t wifi_powerup_timer: 7; + uint32_t rom_ram_wait_timer: 9; + uint32_t rom_ram_powerup_timer: 7; + }; + uint32_t val; + } timer3; + union { + struct { + uint32_t rtc_wait_timer: 9; + uint32_t rtc_powerup_timer: 7; + uint32_t dg_wrap_wait_timer: 9; + uint32_t dg_wrap_powerup_timer: 7; + }; + uint32_t val; + } timer4; + union { + struct { + uint32_t reserved0: 8; + uint32_t min_slp_val: 8; /*minimal sleep cycles in slow_clk_rtc*/ + uint32_t rtcmem_wait_timer: 9; + uint32_t rtcmem_powerup_timer: 7; + }; + uint32_t val; + } timer5; + union { + struct { + uint32_t reserved0: 16; + uint32_t dg_dcdc_wait_timer: 9; + uint32_t dg_dcdc_powerup_timer: 7; + }; + uint32_t val; + } timer6; + union { + struct { + uint32_t reserved0: 23; + uint32_t plla_force_pd: 1; /*PLLA force power down*/ + uint32_t plla_force_pu: 1; /*PLLA force power up*/ + uint32_t bbpll_cal_slp_start: 1; /*start BBPLL calibration during sleep*/ + uint32_t pvtmon_pu: 1; /*1: PVTMON power up otherwise power down*/ + uint32_t txrf_i2c_pu: 1; /*1: TXRF_I2C power up otherwise power down*/ + uint32_t rfrx_pbus_pu: 1; /*1: RFRX_PBUS power up otherwise power down*/ + uint32_t reserved29: 1; + uint32_t ckgen_i2c_pu: 1; /*1: CKGEN_I2C power up otherwise power down*/ + uint32_t pll_i2c_pu: 1; + }; + uint32_t val; + } ana_conf; + union { + struct { + uint32_t reset_cause_procpu: 6; /*reset cause of PRO CPU*/ + uint32_t reset_cause_appcpu: 6; /*reset cause of APP CPU*/ + uint32_t appcpu_stat_vector_sel: 1; /*APP CPU state vector sel*/ + uint32_t procpu_stat_vector_sel: 1; /*PRO CPU state vector sel*/ + uint32_t reserved14: 18; + }; + uint32_t val; + } reset_state; + union { + struct { + uint32_t wakeup_cause: 15; /*wakeup cause*/ + uint32_t rtc_wakeup_ena: 15; /*wakeup enable bitmap*/ + uint32_t gpio_wakeup_filter: 1; /*enable filter for gpio wakeup event*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } wakeup_state; + union { + struct { + uint32_t slp_wakeup: 1; /*enable sleep wakeup interrupt*/ + uint32_t slp_reject: 1; /*enable sleep reject interrupt*/ + uint32_t sdio_idle: 1; /*enable SDIO idle interrupt*/ + uint32_t rtc_wdt: 1; /*enable RTC WDT interrupt*/ + uint32_t rtc_time_valid: 1; /*enable RTC time valid interrupt*/ + uint32_t rtc_ulp_cp: 1; /*enable ULP-coprocessor interrupt*/ + uint32_t rtc_touch_done: 1; /*enable touch done interrupt*/ + uint32_t rtc_touch_active: 1; /*enable touch active interrupt*/ + uint32_t rtc_touch_inactive: 1; /*enable touch inactive interrupt*/ + uint32_t rtc_brown_out: 1; /*enable brown out interrupt*/ + uint32_t rtc_main_timer: 1; /*enable RTC main timer interrupt*/ + uint32_t rtc_saradc1: 1; /*enable saradc1 interrupt*/ + uint32_t rtc_tsens: 1; /*enable tsens interrupt*/ + uint32_t rtc_cocpu: 1; /*enable riscV cocpu interrupt*/ + uint32_t rtc_saradc2: 1; /*enable saradc2 interrupt*/ + uint32_t rtc_swd: 1; /*enable super watch dog interrupt*/ + uint32_t rtc_xtal32k_dead: 1; /*enable cocpu trap interrupt*/ + uint32_t rtc_cocpu_trap: 1; + uint32_t reserved18: 14; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t slp_wakeup: 1; /*sleep wakeup interrupt raw*/ + uint32_t slp_reject: 1; /*sleep reject interrupt raw*/ + uint32_t sdio_idle: 1; /*SDIO idle interrupt raw*/ + uint32_t rtc_wdt: 1; /*RTC WDT interrupt raw*/ + uint32_t rtc_time_valid: 1; /*RTC time valid interrupt raw*/ + uint32_t rtc_ulp_cp: 1; /*ULP-coprocessor interrupt raw*/ + uint32_t rtc_touch_done: 1; /*touch interrupt raw*/ + uint32_t rtc_touch_active: 1; /*touch active interrupt raw*/ + uint32_t rtc_touch_inactive: 1; /*touch inactive interrupt raw*/ + uint32_t rtc_brown_out: 1; /*brown out interrupt raw*/ + uint32_t rtc_main_timer: 1; /*RTC main timer interrupt raw*/ + uint32_t rtc_saradc1: 1; /*saradc1 interrupt raw*/ + uint32_t rtc_tsens: 1; /*tsens interrupt raw*/ + uint32_t rtc_cocpu: 1; /*riscV cocpu interrupt raw*/ + uint32_t rtc_saradc2: 1; /*saradc2 interrupt raw*/ + uint32_t rtc_swd: 1; /*super watch dog interrupt raw*/ + uint32_t rtc_xtal32k_dead: 1; /*xtal32k dead detection interrupt raw*/ + uint32_t rtc_cocpu_trap: 1; /*cocpu trap interrupt raw*/ + uint32_t reserved18: 14; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t slp_wakeup: 1; /*sleep wakeup interrupt state*/ + uint32_t slp_reject: 1; /*sleep reject interrupt state*/ + uint32_t sdio_idle: 1; /*SDIO idle interrupt state*/ + uint32_t rtc_wdt: 1; /*RTC WDT interrupt state*/ + uint32_t rtc_time_valid: 1; /*RTC time valid interrupt state*/ + uint32_t rtc_ulp_cp: 1; /*ULP-coprocessor interrupt state*/ + uint32_t rtc_touch_done: 1; /*touch done interrupt state*/ + uint32_t rtc_touch_active: 1; /*touch active interrupt state*/ + uint32_t rtc_touch_inactive: 1; /*touch inactive interrupt state*/ + uint32_t rtc_brown_out: 1; /*brown out interrupt state*/ + uint32_t rtc_main_timer: 1; /*RTC main timer interrupt state*/ + uint32_t rtc_saradc1: 1; /*saradc1 interrupt state*/ + uint32_t rtc_tsens: 1; /*tsens interrupt state*/ + uint32_t rtc_cocpu: 1; /*riscV cocpu interrupt state*/ + uint32_t rtc_saradc2: 1; /*saradc2 interrupt state*/ + uint32_t rtc_swd: 1; /*super watch dog interrupt state*/ + uint32_t rtc_xtal32k_dead: 1; /*xtal32k dead detection interrupt state*/ + uint32_t rtc_cocpu_trap: 1; /*cocpu trap interrupt state*/ + uint32_t reserved18: 14; + }; + uint32_t val; + } int_st; + union { + struct { + uint32_t slp_wakeup: 1; /*Clear sleep wakeup interrupt state*/ + uint32_t slp_reject: 1; /*Clear sleep reject interrupt state*/ + uint32_t sdio_idle: 1; /*Clear SDIO idle interrupt state*/ + uint32_t rtc_wdt: 1; /*Clear RTC WDT interrupt state*/ + uint32_t rtc_time_valid: 1; /*Clear RTC time valid interrupt state*/ + uint32_t rtc_ulp_cp: 1; /*Clear ULP-coprocessor interrupt state*/ + uint32_t rtc_touch_done: 1; /*Clear touch done interrupt state*/ + uint32_t rtc_touch_active: 1; /*Clear touch active interrupt state*/ + uint32_t rtc_touch_inactive: 1; /*Clear touch inactive interrupt state*/ + uint32_t rtc_brown_out: 1; /*Clear brown out interrupt state*/ + uint32_t rtc_main_timer: 1; /*Clear RTC main timer interrupt state*/ + uint32_t rtc_saradc1: 1; /*Clear saradc1 interrupt state*/ + uint32_t rtc_tsens: 1; /*Clear tsens interrupt state*/ + uint32_t rtc_cocpu: 1; /*Clear riscV cocpu interrupt state*/ + uint32_t rtc_saradc2: 1; /*Clear saradc2 interrupt state*/ + uint32_t rtc_swd: 1; /*Clear super watch dog interrupt state*/ + uint32_t rtc_xtal32k_dead: 1; /*Clear RTC WDT interrupt state*/ + uint32_t rtc_cocpu_trap: 1; /*Clear cocpu trap interrupt state*/ + uint32_t reserved18: 14; + }; + uint32_t val; + } int_clr; + uint32_t store[4]; /**/ + union { + struct { + uint32_t xtal32k_wdt_en: 1; /*xtal 32k watch dog enable*/ + uint32_t xtal32k_wdt_clk_fo: 1; /*xtal 32k watch dog clock force on*/ + uint32_t xtal32k_wdt_reset: 1; /*xtal 32k watch dog sw reset*/ + uint32_t xtal32k_ext_clk_fo: 1; /*xtal 32k external xtal clock force on*/ + uint32_t xtal32k_auto_backup: 1; /*xtal 32k switch to back up clock when xtal is dead*/ + uint32_t xtal32k_auto_restart: 1; /*xtal 32k restart xtal when xtal is dead*/ + uint32_t xtal32k_auto_return: 1; /*xtal 32k switch back xtal when xtal is restarted*/ + uint32_t xtal32k_xpd_force: 1; /*Xtal 32k xpd control by sw or fsm*/ + uint32_t enckinit_xtal_32k: 1; /*apply an internal clock to help xtal 32k to start*/ + uint32_t dbuf_xtal_32k: 1; /*0: single-end buffer 1: differential buffer*/ + uint32_t dgm_xtal_32k: 3; /*xtal_32k gm control*/ + uint32_t dres_xtal_32k: 3; /*DRES_XTAL_32K*/ + uint32_t xpd_xtal_32k: 1; /*XPD_XTAL_32K*/ + uint32_t dac_xtal_32k: 6; /*DAC_XTAL_32K*/ + uint32_t rtc_xtal32k_gpio_sel: 1; /*XTAL_32K sel. 0: external XTAL_32K 1: CLK from RTC pad X32P_C*/ + uint32_t reserved24: 6; + uint32_t ctr_lv: 1; /*0: power down XTAL at high level 1: power down XTAL at low level*/ + uint32_t ctr_en: 1; + }; + uint32_t val; + } ext_xtl_conf; + union { + struct { + uint32_t reserved0: 30; + uint32_t wakeup0_lv: 1; /*0: external wakeup at low level 1: external wakeup at high level*/ + uint32_t wakeup1_lv: 1; + }; + uint32_t val; + } ext_wakeup_conf; + union { + struct { + uint32_t reject_cause: 15; /*sleep reject cause*/ + uint32_t rtc_sleep_reject_ena:15; /*sleep reject enable*/ + uint32_t light_slp_reject_en: 1; /*enable reject for light sleep*/ + uint32_t deep_slp_reject_en: 1; /*enable reject for deep sleep*/ + }; + uint32_t val; + } slp_reject_conf; + union { + struct { + uint32_t reserved0: 29; + uint32_t cpusel_conf: 1; /*CPU sel option*/ + uint32_t cpuperiod_sel: 2; + }; + uint32_t val; + } cpu_period_conf; + union { + struct { + uint32_t reserved0: 22; + uint32_t sdio_act_dnum:10; + }; + uint32_t val; + } sdio_act_conf; + union { + struct { + uint32_t reserved0: 3; + uint32_t ck8m_div_sel_vld: 1; /*used to sync reg_ck8m_div_sel bus. Clear vld before set reg_ck8m_div_sel then set vld to actually switch the clk*/ + uint32_t ck8m_div: 2; /*CK8M_D256_OUT divider. 00: div128 01: div256 10: div512 11: div1024.*/ + uint32_t enb_ck8m: 1; /*disable CK8M and CK8M_D256_OUT*/ + uint32_t enb_ck8m_div: 1; /*1: CK8M_D256_OUT is actually CK8M 0: CK8M_D256_OUT is CK8M divided by 256*/ + uint32_t dig_xtal32k_en: 1; /*enable CK_XTAL_32K for digital core (no relationship with RTC core)*/ + uint32_t dig_clk8m_d256_en: 1; /*enable CK8M_D256_OUT for digital core (no relationship with RTC core)*/ + uint32_t dig_clk8m_en: 1; /*enable CK8M for digital core (no relationship with RTC core)*/ + uint32_t reserved11: 1; + uint32_t ck8m_div_sel: 3; /*divider = reg_ck8m_div_sel + 1*/ + uint32_t xtal_force_nogating: 1; /*XTAL force no gating during sleep*/ + uint32_t ck8m_force_nogating: 1; /*CK8M force no gating during sleep*/ + uint32_t ck8m_dfreq: 8; /*CK8M_DFREQ*/ + uint32_t ck8m_force_pd: 1; /*CK8M force power down*/ + uint32_t ck8m_force_pu: 1; /*CK8M force power up*/ + uint32_t reserved27: 2; + uint32_t fast_clk_rtc_sel: 1; /*fast_clk_rtc sel. 0: XTAL div 4 1: CK8M*/ + uint32_t ana_clk_rtc_sel: 2; + }; + uint32_t val; + } clk_conf; + union { + struct { + uint32_t reserved0: 22; + uint32_t rtc_ana_clk_div_vld: 1; /*used to sync div bus. clear vld before set reg_rtc_ana_clk_div then set vld to actually switch the clk*/ + uint32_t rtc_ana_clk_div: 8; + uint32_t slow_clk_next_edge: 1; + }; + uint32_t val; + } slow_clk_conf; + union { + struct { + uint32_t sdio_timer_target: 8; /*timer count to apply reg_sdio_dcap after sdio power on*/ + uint32_t reserved8: 1; + uint32_t sdio_dthdrv: 2; /*Tieh = 1 mode drive ability. Initially set to 0 to limit charge current set to 3 after several us.*/ + uint32_t sdio_dcap: 2; /*ability to prevent LDO from overshoot*/ + uint32_t sdio_initi: 2; /*add resistor from ldo output to ground. 0: no res 1: 6k 2: 4k 3: 2k*/ + uint32_t sdio_en_initi: 1; /*0 to set init[1:0]=0*/ + uint32_t sdio_dcurlim: 3; /*tune current limit threshold when tieh = 0. About 800mA/(8+d)*/ + uint32_t sdio_modecurlim: 1; /*select current limit mode*/ + uint32_t sdio_encurlim: 1; /*enable current limit*/ + uint32_t sdio_pd_en: 1; /*power down SDIO_REG in sleep. Only active when reg_sdio_force = 0*/ + uint32_t sdio_force: 1; /*1: use SW option to control SDIO_REG 0: use state machine*/ + uint32_t sdio_tieh: 1; /*SW option for SDIO_TIEH. Only active when reg_sdio_force = 1*/ + uint32_t reg1p8_ready: 1; /*read only register for REG1P8_READY*/ + uint32_t drefl_sdio: 2; /*SW option for DREFL_SDIO. Only active when reg_sdio_force = 1*/ + uint32_t drefm_sdio: 2; /*SW option for DREFM_SDIO. Only active when reg_sdio_force = 1*/ + uint32_t drefh_sdio: 2; /*SW option for DREFH_SDIO. Only active when reg_sdio_force = 1*/ + uint32_t xpd_sdio: 1; + }; + uint32_t val; + } sdio_conf; + union { + struct { + uint32_t reserved0: 22; + uint32_t dbg_atten: 4; /*DBG_ATTEN*/ + uint32_t enb_sck_xtal: 1; /*ENB_SCK_XTAL*/ + uint32_t inc_heartbeat_refresh: 1; /*INC_HEARTBEAT_REFRESH*/ + uint32_t dec_heartbeat_period: 1; /*DEC_HEARTBEAT_PERIOD*/ + uint32_t inc_heartbeat_period: 1; /*INC_HEARTBEAT_PERIOD*/ + uint32_t dec_heartbeat_width: 1; /*DEC_HEARTBEAT_WIDTH*/ + uint32_t rst_bias_i2c: 1; + }; + uint32_t val; + } bias_conf; + union { + struct { + uint32_t reserved0: 8; + uint32_t dig_dbias_slp: 3; /*DIG_REG_DBIAS during sleep*/ + uint32_t dig_dbias_wak: 3; /*DIG_REG_DBIAS during wakeup*/ + uint32_t sck_dcap: 8; /*SCK_DCAP*/ + uint32_t rtc_dbias_slp: 3; /*RTC_DBIAS during sleep*/ + uint32_t rtc_dbias_wak: 3; /*RTC_DBIAS during wakeup*/ + uint32_t rtc_dboost_force_pd: 1; /*RTC_DBOOST force power down*/ + uint32_t rtc_dboost_force_pu: 1; /*RTC_DBOOST force power up*/ + uint32_t rtculator_force_pd: 1; /*RTC_REG force power down (for RTC_REG power down means decrease the voltage to 0.8v or lower )*/ + uint32_t rtculator_force_pu: 1; + }; + uint32_t val; + } rtc; + union { + struct { + uint32_t fastmem_force_noiso: 1; /*Fast RTC memory force no ISO*/ + uint32_t fastmem_force_iso: 1; /*Fast RTC memory force ISO*/ + uint32_t slowmem_force_noiso: 1; /*RTC memory force no ISO*/ + uint32_t slowmem_force_iso: 1; /*RTC memory force ISO*/ + uint32_t rtc_force_iso: 1; /*rtc_peri force ISO*/ + uint32_t rtc_force_noiso: 1; /*rtc_peri force no ISO*/ + uint32_t fastmem_folw_cpu: 1; /*1: Fast RTC memory PD following CPU 0: fast RTC memory PD following RTC state machine*/ + uint32_t fastmem_force_lpd: 1; /*Fast RTC memory force PD*/ + uint32_t fastmem_force_lpu: 1; /*Fast RTC memory force no PD*/ + uint32_t slowmem_folw_cpu: 1; /*1: RTC memory PD following CPU 0: RTC memory PD following RTC state machine*/ + uint32_t slowmem_force_lpd: 1; /*RTC memory force PD*/ + uint32_t slowmem_force_lpu: 1; /*RTC memory force no PD*/ + uint32_t fastmem_force_pd: 1; /*Fast RTC memory force power down*/ + uint32_t fastmem_force_pu: 1; /*Fast RTC memory force power up*/ + uint32_t fastmem_pd_en: 1; /*enable power down fast RTC memory in sleep*/ + uint32_t slowmem_force_pd: 1; /*RTC memory force power down*/ + uint32_t slowmem_force_pu: 1; /*RTC memory force power up*/ + uint32_t slowmem_pd_en: 1; /*enable power down RTC memory in sleep*/ + uint32_t rtc_force_pd: 1; /*rtc_peri force power down*/ + uint32_t rtc_force_pu: 1; /*rtc_peri force power up*/ + uint32_t rtc_pd_en: 1; /*enable power down rtc_peri in sleep*/ + uint32_t rtc_pad_force_hold: 1; /*rtc pad force hold*/ + uint32_t reserved22: 10; + }; + uint32_t val; + } rtc_pwc; + union { + struct { + uint32_t reserved0: 3; + uint32_t lslp_mem_force_pd: 1; /*memories in digital core force PD in sleep*/ + uint32_t lslp_mem_force_pu: 1; /*memories in digital core force no PD in sleep*/ + uint32_t rom0_force_pd: 1; /*ROM force power down*/ + uint32_t rom0_force_pu: 1; /*ROM force power up*/ + uint32_t inter_ram0_force_pd: 1; /*internal SRAM 0 force power down*/ + uint32_t inter_ram0_force_pu: 1; /*internal SRAM 0 force power up*/ + uint32_t inter_ram1_force_pd: 1; /*internal SRAM 1 force power down*/ + uint32_t inter_ram1_force_pu: 1; /*internal SRAM 1 force power up*/ + uint32_t inter_ram2_force_pd: 1; /*internal SRAM 2 force power down*/ + uint32_t inter_ram2_force_pu: 1; /*internal SRAM 2 force power up*/ + uint32_t inter_ram3_force_pd: 1; /*internal SRAM 3 force power down*/ + uint32_t inter_ram3_force_pu: 1; /*internal SRAM 3 force power up*/ + uint32_t inter_ram4_force_pd: 1; /*internal SRAM 4 force power down*/ + uint32_t inter_ram4_force_pu: 1; /*internal SRAM 4 force power up*/ + uint32_t wifi_force_pd: 1; /*wifi force power down*/ + uint32_t wifi_force_pu: 1; /*wifi force power up*/ + uint32_t dg_wrap_force_pd: 1; /*digital core force power down*/ + uint32_t dg_wrap_force_pu: 1; /*digital core force power up*/ + uint32_t dg_dcdc_force_pd: 1; /*digital dcdc force power down*/ + uint32_t dg_dcdc_force_pu: 1; /*digital dcdc force power up*/ + uint32_t dg_dcdc_pd_en: 1; /*enable power down digital dcdc in sleep*/ + uint32_t rom0_pd_en: 1; /*enable power down ROM in sleep*/ + uint32_t inter_ram0_pd_en: 1; /*enable power down internal SRAM 0 in sleep*/ + uint32_t inter_ram1_pd_en: 1; /*enable power down internal SRAM 1 in sleep*/ + uint32_t inter_ram2_pd_en: 1; /*enable power down internal SRAM 2 in sleep*/ + uint32_t inter_ram3_pd_en: 1; /*enable power down internal SRAM 3 in sleep*/ + uint32_t inter_ram4_pd_en: 1; /*enable power down internal SRAM 4 in sleep*/ + uint32_t wifi_pd_en: 1; /*enable power down wifi in sleep*/ + uint32_t dg_wrap_pd_en: 1; + }; + uint32_t val; + } dig_pwc; + union { + struct { + uint32_t reserved0: 7; + uint32_t dig_iso_force_off: 1; + uint32_t dig_iso_force_on: 1; + uint32_t dg_pad_autohold: 1; /*read only register to indicate digital pad auto-hold status*/ + uint32_t clr_dg_pad_autohold: 1; /*wtite only register to clear digital pad auto-hold*/ + uint32_t dg_pad_autohold_en: 1; /*digital pad enable auto-hold*/ + uint32_t dg_pad_force_noiso: 1; /*digital pad force no ISO*/ + uint32_t dg_pad_force_iso: 1; /*digital pad force ISO*/ + uint32_t dg_pad_force_unhold: 1; /*digital pad force un-hold*/ + uint32_t dg_pad_force_hold: 1; /*digital pad force hold*/ + uint32_t rom0_force_iso: 1; /*ROM force ISO*/ + uint32_t rom0_force_noiso: 1; /*ROM force no ISO*/ + uint32_t inter_ram0_force_iso: 1; /*internal SRAM 0 force ISO*/ + uint32_t inter_ram0_force_noiso: 1; /*internal SRAM 0 force no ISO*/ + uint32_t inter_ram1_force_iso: 1; /*internal SRAM 1 force ISO*/ + uint32_t inter_ram1_force_noiso: 1; /*internal SRAM 1 force no ISO*/ + uint32_t inter_ram2_force_iso: 1; /*internal SRAM 2 force ISO*/ + uint32_t inter_ram2_force_noiso: 1; /*internal SRAM 2 force no ISO*/ + uint32_t inter_ram3_force_iso: 1; /*internal SRAM 3 force ISO*/ + uint32_t inter_ram3_force_noiso: 1; /*internal SRAM 3 force no ISO*/ + uint32_t inter_ram4_force_iso: 1; /*internal SRAM 4 force ISO*/ + uint32_t inter_ram4_force_noiso: 1; /*internal SRAM 4 force no ISO*/ + uint32_t wifi_force_iso: 1; /*wifi force ISO*/ + uint32_t wifi_force_noiso: 1; /*wifi force no ISO*/ + uint32_t dg_wrap_force_iso: 1; /*digital core force ISO*/ + uint32_t dg_wrap_force_noiso: 1; + }; + uint32_t val; + } dig_iso; + union { + struct { + uint32_t chip_reset_width: 8; /*chip reset siginal pulse width*/ + uint32_t chip_reset_en: 1; /*wdt reset whole chip enable*/ + uint32_t pause_in_slp: 1; /*pause WDT in sleep*/ + uint32_t appcpu_reset_en: 1; /*enable WDT reset APP CPU*/ + uint32_t procpu_reset_en: 1; /*enable WDT reset PRO CPU*/ + uint32_t flashboot_mod_en: 1; /*enable WDT in flash boot*/ + uint32_t sys_reset_length: 3; /*system reset counter length*/ + uint32_t cpu_reset_length: 3; /*CPU reset counter length*/ + uint32_t stg3: 3; /*1: interrupt stage en 2: CPU reset stage en 3: system reset stage en 4: RTC reset stage en*/ + uint32_t stg2: 3; /*1: interrupt stage en 2: CPU reset stage en 3: system reset stage en 4: RTC reset stage en*/ + uint32_t stg1: 3; /*1: interrupt stage en 2: CPU reset stage en 3: system reset stage en 4: RTC reset stage en*/ + uint32_t stg0: 3; /*1: interrupt stage en 2: CPU reset stage en 3: system reset stage en 4: RTC reset stage en*/ + uint32_t en: 1; + }; + uint32_t val; + } wdt_config0; + uint32_t wdt_config1; /**/ + uint32_t wdt_config2; /**/ + uint32_t wdt_config3; /**/ + uint32_t wdt_config4; /**/ + union { + struct { + uint32_t reserved0: 31; + uint32_t feed: 1; + }; + uint32_t val; + } wdt_feed; + uint32_t wdt_wprotect; /**/ + union { + struct { + uint32_t swd_reset_flag: 1; /*swd reset flag*/ + uint32_t swd_feed_int: 1; /*swd interrupt for feeding*/ + uint32_t reserved2: 16; + uint32_t swd_signal_width:10; /*adjust signal width send to swd*/ + uint32_t swd_rst_flag_clr: 1; /*reset swd reset flag*/ + uint32_t swd_feed: 1; /*Sw feed swd*/ + uint32_t swd_disable: 1; /*disabel SWD*/ + uint32_t swd_auto_feed_en: 1; /*automatically feed swd when int comes*/ + }; + uint32_t val; + } swd_conf; + uint32_t swd_wprotect; /*swd write protect*/ + union { + struct { + uint32_t reserved0: 28; + uint32_t ent_tsens: 1; /*ENT_TSENS*/ + uint32_t ent_rtc: 1; /*ENT_RTC*/ + uint32_t dtest_rtc: 2; + }; + uint32_t val; + } test_mux; + union { + struct { + uint32_t reserved0: 20; + uint32_t appcpu_c1: 6; /*{reg_sw_stall_appcpu_c1[5:0] reg_sw_stall_appcpu_c0[1:0]} == 0x86 will stall APP CPU*/ + uint32_t procpu_c1: 6; + }; + uint32_t val; + } sw_cpu_stall; + uint32_t store4; /**/ + uint32_t store5; /**/ + uint32_t store6; /**/ + uint32_t store7; /**/ + union { + struct { + uint32_t xpd_rom0: 1; /*rom0 power down*/ + uint32_t reserved1: 1; + uint32_t xpd_dig_dcdc: 1; /*External DCDC power down*/ + uint32_t rtc_peri_iso: 1; /*rtc peripheral iso*/ + uint32_t xpd_rtc_peri: 1; /*rtc peripheral power down*/ + uint32_t wifi_iso: 1; /*wifi iso*/ + uint32_t xpd_wifi: 1; /*wifi wrap power down*/ + uint32_t dig_iso: 1; /*digital wrap iso*/ + uint32_t xpd_dig: 1; /*digital wrap power down*/ + uint32_t rtc_touch_state_start: 1; /*touch should start to work*/ + uint32_t rtc_touch_state_switch: 1; /*touch is about to working. Switch rtc main state*/ + uint32_t rtc_touch_state_slp: 1; /*touch is in sleep state*/ + uint32_t rtc_touch_state_done: 1; /*touch is done*/ + uint32_t rtc_cocpu_state_start: 1; /*ulp/cocpu should start to work*/ + uint32_t rtc_cocpu_state_switch: 1; /*ulp/cocpu is about to working. Switch rtc main state*/ + uint32_t rtc_cocpu_state_slp: 1; /*ulp/cocpu is in sleep state*/ + uint32_t rtc_cocpu_state_done: 1; /*ulp/cocpu is done*/ + uint32_t rtc_main_state_xtal_iso: 1; /*no use any more*/ + uint32_t rtc_main_state_pll_on: 1; /*rtc main state machine is in states that pll should be running*/ + uint32_t rtc_rdy_for_wakeup: 1; /*rtc is ready to receive wake up trigger from wake up source*/ + uint32_t rtc_main_state_wait_end: 1; /*rtc main state machine has been waited for some cycles*/ + uint32_t rtc_in_wakeup_state: 1; /*rtc main state machine is in the states of wakeup process*/ + uint32_t rtc_in_low_power_state: 1; /*rtc main state machine is in the states of low power*/ + uint32_t rtc_main_state_in_wait_8m: 1; /*rtc main state machine is in wait 8m state*/ + uint32_t rtc_main_state_in_wait_pll: 1; /*rtc main state machine is in wait pll state*/ + uint32_t rtc_main_state_in_wait_xtl: 1; /*rtc main state machine is in wait xtal state*/ + uint32_t rtc_main_state_in_slp: 1; /*rtc main state machine is in sleep state*/ + uint32_t rtc_main_state_in_idle: 1; /*rtc main state machine is in idle state*/ + uint32_t rtc_main_state: 4; /*rtc main state machine status*/ + }; + uint32_t val; + } low_power_st; + uint32_t diag0; /**/ + union { + struct { + uint32_t touch_pad0_hold: 1; + uint32_t touch_pad1_hold: 1; + uint32_t touch_pad2_hold: 1; + uint32_t touch_pad3_hold: 1; + uint32_t touch_pad4_hold: 1; + uint32_t touch_pad5_hold: 1; + uint32_t touch_pad6_hold: 1; + uint32_t touch_pad7_hold: 1; + uint32_t touch_pad8_hold: 1; + uint32_t touch_pad9_hold: 1; + uint32_t touch_pad10_hold: 1; + uint32_t touch_pad11_hold: 1; + uint32_t touch_pad12_hold: 1; + uint32_t touch_pad13_hold: 1; + uint32_t touch_pad14_hold: 1; + uint32_t x32p_hold: 1; + uint32_t x32n_hold: 1; + uint32_t pdac1_hold: 1; + uint32_t pdac2_hold: 1; + uint32_t rtc_pad19_hold: 1; + uint32_t rtc_pad20_hold: 1; + uint32_t rtc_pad21_hold: 1; + uint32_t reserved22: 10; + }; + uint32_t val; + } pad_hold; + uint32_t dig_pad_hold; /**/ + union { + struct { + uint32_t sel: 22; /*Bitmap to select RTC pads for ext wakeup1*/ + uint32_t status_clr: 1; /*clear ext wakeup1 status*/ + uint32_t reserved23: 9; + }; + uint32_t val; + } ext_wakeup1; + union { + struct { + uint32_t status: 22; /*ext wakeup1 status*/ + uint32_t reserved22: 10; + }; + uint32_t val; + } ext_wakeup1_status; + union { + struct { + uint32_t reserved0: 4; + uint32_t int_wait: 10; /*brown out interrupt wait cycles*/ + uint32_t close_flash_ena: 1; /*enable close flash when brown out happens*/ + uint32_t pd_rf_ena: 1; /*enable power down RF when brown out happens*/ + uint32_t rst_wait: 10; /*brown out reset wait cycles*/ + uint32_t rst_ena: 1; /*enable brown out reset*/ + uint32_t reserved27: 2; + uint32_t cnt_clr: 1; /*clear brown out counter*/ + uint32_t ena: 1; /*enable brown out*/ + uint32_t det: 1; + }; + uint32_t val; + } brown_out; + uint32_t time_low1; /*RTC timer low 32 bits*/ + union { + struct { + uint32_t rtc_timer_value1_high:16; /*RTC timer high 16 bits*/ + uint32_t reserved16: 16; + }; + uint32_t val; + } time_high1; + uint32_t xtal32k_clk_factor; /*xtal 32k watch dog backup clock factor*/ + union { + struct { + uint32_t xtal32k_return_wait: 4; /*cycles to wait to return noral xtal 32k*/ + uint32_t xtal32k_restart_wait:16; /*cycles to wait to repower on xtal 32k*/ + uint32_t xtal32k_wdt_timeout: 8; /*If no clock detected for this amount of time 32k is regarded as dead*/ + uint32_t xtal32k_stable_thres: 4; /*if restarted xtal32k period is smaller than this it is regarded as stable*/ + }; + uint32_t val; + } xtal32k_conf; + union { + struct { + uint32_t ulp_cp_pc_init: 11; /*ULP-coprocessor PC initial address*/ + uint32_t reserved11: 1; + uint32_t ulp_cp_timer_slp_cycle:16; /*sleep cycles for ULP-coprocessor timer*/ + uint32_t reserved28: 1; + uint32_t ulp_cp_gpio_wakeup_ena: 1; /*ULP-coprocessor wakeup by GPIO enable*/ + uint32_t ulp_cp_gpio_wakeup_clr: 1; /*ULP-coprocessor wakeup by GPIO state clear*/ + uint32_t ulp_cp_slp_timer_en: 1; /*ULP-coprocessor timer enable bit*/ + }; + uint32_t val; + } ulp_cp_timer; + union { + struct { + uint32_t ulp_cp_mem_addr_init: 11; + uint32_t ulp_cp_mem_addr_size: 11; + uint32_t ulp_cp_mem_offst_clr: 1; + uint32_t reserved23: 5; + uint32_t ulp_cp_clk_fo: 1; /*ulp coprocessor clk force on*/ + uint32_t ulp_cp_reset: 1; /*ulp coprocessor clk software reset*/ + uint32_t ulp_cp_force_start_top: 1; /*1: ULP-coprocessor is started by SW*/ + uint32_t ulp_cp_start_top: 1; /*Write 1 to start ULP-coprocessor*/ + }; + uint32_t val; + } ulp_cp_ctrl; + union { + struct { + uint32_t cocpu_clk_fo: 1; /*cocpu clk force on*/ + uint32_t cocpu_start_2_reset_dis: 6; /*time from start cocpu to pull down reset*/ + uint32_t cocpu_start_2_intr_en: 6; /*time from start cocpu to give start interrupt*/ + uint32_t cocpu_shut: 1; /*to shut cocpu*/ + uint32_t cocpu_shut_2_clk_dis: 6; /*time from shut cocpu to disable clk*/ + uint32_t cocpu_shut_reset_en: 1; /*to reset cocpu*/ + uint32_t cocpu_sel: 1; /*1: old ULP 0: new riscV*/ + uint32_t cocpu_done_force: 1; /*1: select riscv done 0: select ulp done*/ + uint32_t cocpu_done: 1; /*done signal used by riscv to control timer.*/ + uint32_t cocpu_sw_int_trigger: 1; /*trigger cocpu register interrupt*/ + uint32_t reserved25: 7; + }; + uint32_t val; + } cocpu_ctrl; + union { + struct { + uint32_t touch_sleep_cycles:16; /*sleep cycles for timer*/ + uint32_t touch_meas_num: 16; /*the meas length (in 8MHz)*/ + }; + uint32_t val; + } touch_ctrl1; + union { + struct { + uint32_t reserved0: 2; + uint32_t touch_drange: 2; /*TOUCH_DRANGE*/ + uint32_t touch_drefl: 2; /*TOUCH_DREFL*/ + uint32_t touch_drefh: 2; /*TOUCH_DREFH*/ + uint32_t touch_xpd_bias: 1; /*TOUCH_XPD_BIAS*/ + uint32_t touch_refc: 3; /*TOUCH pad0 reference cap*/ + uint32_t reserved12: 1; + uint32_t touch_slp_timer_en: 1; /*touch timer enable bit*/ + uint32_t touch_start_fsm_en: 1; /*1: TOUCH_START & TOUCH_XPD is controlled by touch fsm*/ + uint32_t touch_start_en: 1; /*1: start touch fsm*/ + uint32_t touch_start_force: 1; /*1: to start touch fsm by SW*/ + uint32_t touch_xpd_wait: 8; /*the waiting cycles (in 8MHz) between TOUCH_START and TOUCH_XPD*/ + uint32_t touch_slp_cyc_div: 2; /*when a touch pad is active sleep cycle could be divided by this number*/ + uint32_t reserved27: 2; + uint32_t touch_reset: 1; /*reset upgrade touch*/ + uint32_t touch_clk_fo: 1; /*touch clock force on*/ + uint32_t touch_clkgate_en: 1; /*touch clock enable*/ + }; + uint32_t val; + } touch_ctrl2; + union { + struct { + uint32_t touch_denoise_res: 2; /*De-noise resolution: 12/10/8/4 bit*/ + uint32_t touch_denoise_en: 1; /*touch pad0 will be used to de-noise*/ + uint32_t reserved3: 5; + uint32_t touch_inactive_connection: 1; /*inactive touch pads connect to 1: gnd 0: HighZ*/ + uint32_t touch_shield_pad_en: 1; /*touch pad14 will be used as shield*/ + uint32_t touch_scan_pad_map: 15; /*touch scan mode pad enable map*/ + uint32_t touch_bufdrv: 3; /*touch7 buffer driver strength*/ + uint32_t touch_out_ring: 4; /*select out ring pad*/ + }; + uint32_t val; + } touch_scan_ctrl; + union { + struct { + uint32_t touch_slp_th: 22; /*the threshold for sleep touch pad*/ + uint32_t reserved22: 4; + uint32_t touch_slp_approach_en: 1; /*sleep pad approach function enable*/ + uint32_t touch_slp_pad: 5; + }; + uint32_t val; + } touch_slp_thres; + union { + struct { + uint32_t reserved0: 23; + uint32_t touch_slp_channel_clr: 1; /*clear touch slp channel*/ + uint32_t touch_approach_meas_time: 8; /*approach pads total meas times*/ + }; + uint32_t val; + } touch_approach; + union { + struct { + uint32_t reserved0: 12; + uint32_t touch_jitter_step: 4; /*touch jitter step*/ + uint32_t touch_neg_noise_limit: 4; /*negative threshold counter limit*/ + uint32_t touch_neg_noise_thres: 2; + uint32_t touch_noise_thres: 2; + uint32_t touch_hysteresis: 2; + uint32_t touch_debounce: 3; /*debounce counter*/ + uint32_t touch_filter_mode: 2; /*0: IIR ? 1: IIR ? 2: IIR 1/8 3: Jitter*/ + uint32_t touch_filter_en: 1; /*touch filter enable*/ + }; + uint32_t val; + } touch_filter_ctrl; + union { + struct { + uint32_t usb_vrefh: 2; + uint32_t usb_vrefl: 2; + uint32_t usb_vref_override: 1; + uint32_t usb_pad_pull_override: 1; + uint32_t usb_dp_pullup: 1; + uint32_t usb_dp_pulldown: 1; + uint32_t usb_dm_pullup: 1; + uint32_t usb_dm_pulldown: 1; + uint32_t usb_pullup_value: 1; + uint32_t usb_pad_enable_override: 1; + uint32_t usb_pad_enable: 1; + uint32_t usb_txm: 1; + uint32_t usb_txp: 1; + uint32_t usb_tx_en: 1; + uint32_t usb_tx_en_override: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } usb_conf; + union { + struct { + uint32_t date: 28; + uint32_t reserved28: 4; + }; + uint32_t val; + } date; +} rtc_cntl_dev_t; +extern rtc_cntl_dev_t RTCCNTL; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_RTC_CNTL_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/rtc_gpio_channel.h b/components/soc/esp32s2beta/include/soc/rtc_gpio_channel.h new file mode 100644 index 0000000000..2c0286611e --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/rtc_gpio_channel.h @@ -0,0 +1,87 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _SOC_RTC_GPIO_CHANNEL_H +#define _SOC_RTC_GPIO_CHANNEL_H + +#define RTC_GPIO_NUMBER 22 + +//RTC GPIO channels +#define RTCIO_GPIO0_CHANNEL 0 //RTCIO_CHANNEL_0 +#define RTCIO_CHANNEL_0_GPIO_NUM 0 + +#define RTCIO_GPIO1_CHANNEL 1 //RTCIO_CHANNEL_1 +#define RTCIO_CHANNEL_1_GPIO_NUM 1 + +#define RTCIO_GPIO2_CHANNEL 2 //RTCIO_CHANNEL_2 +#define RTCIO_CHANNEL_2_GPIO_NUM 2 + +#define RTCIO_GPIO3_CHANNEL 3 //RTCIO_CHANNEL_3 +#define RTCIO_CHANNEL_3_GPIO_NUM 3 + +#define RTCIO_GPIO4_CHANNEL 4 //RTCIO_CHANNEL_4 +#define RTCIO_CHANNEL_4_GPIO_NUM 4 + +#define RTCIO_GPIO5_CHANNEL 5 //RTCIO_CHANNEL_5 +#define RTCIO_CHANNEL_5_GPIO_NUM 5 + +#define RTCIO_GPIO6_CHANNEL 6 //RTCIO_CHANNEL_6 +#define RTCIO_CHANNEL_6_GPIO_NUM 6 + +#define RTCIO_GPIO7_CHANNEL 7 //RTCIO_CHANNEL_7 +#define RTCIO_CHANNEL_7_GPIO_NUM 7 + +#define RTCIO_GPIO8_CHANNEL 8 //RTCIO_CHANNEL_8 +#define RTCIO_CHANNEL_8_GPIO_NUM 8 + +#define RTCIO_GPIO9_CHANNEL 9 //RTCIO_CHANNEL_9 +#define RTCIO_CHANNEL_9_GPIO_NUM 9 + +#define RTCIO_GPIO10_CHANNEL 10 //RTCIO_CHANNEL_10 +#define RTCIO_CHANNEL_10_GPIO_NUM 10 + +#define RTCIO_GPIO11_CHANNEL 11 //RTCIO_CHANNEL_11 +#define RTCIO_CHANNEL_11_GPIO_NUM 11 + +#define RTCIO_GPIO12_CHANNEL 12 //RTCIO_CHANNEL_12 +#define RTCIO_CHANNEL_12_GPIO_NUM 12 + +#define RTCIO_GPIO13_CHANNEL 13 //RTCIO_CHANNEL_13 +#define RTCIO_CHANNEL_13_GPIO_NUM 13 + +#define RTCIO_GPIO14_CHANNEL 14 //RTCIO_CHANNEL_14 +#define RTCIO_CHANNEL_14_GPIO_NUM 14 + +#define RTCIO_GPIO15_CHANNEL 15 //RTCIO_CHANNEL_15 +#define RTCIO_CHANNEL_15_GPIO_NUM 15 + +#define RTCIO_GPIO16_CHANNEL 16 //RTCIO_CHANNEL_16 +#define RTCIO_CHANNEL_16_GPIO_NUM 16 + +#define RTCIO_GPIO17_CHANNEL 17 //RTCIO_CHANNEL_17 +#define RTCIO_CHANNEL_17_GPIO_NUM 17 + +#define RTCIO_GPIO18_CHANNEL 18 //RTCIO_CHANNEL_18 +#define RTCIO_CHANNEL_18_GPIO_NUM 18 + +#define RTCIO_GPIO19_CHANNEL 19 //RTCIO_CHANNEL_19 +#define RTCIO_CHANNEL_19_GPIO_NUM 19 + +#define RTCIO_GPIO20_CHANNEL 20 //RTCIO_CHANNEL_20 +#define RTCIO_CHANNEL_20_GPIO_NUM 20 + +#define RTCIO_GPIO21_CHANNEL 21 //RTCIO_CHANNEL_21 +#define RTCIO_CHANNEL_21_GPIO_NUM 21 + +#endif diff --git a/components/soc/esp32s2beta/include/soc/rtc_i2c_reg.h b/components/soc/esp32s2beta/include/soc/rtc_i2c_reg.h new file mode 100644 index 0000000000..2a05740c08 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/rtc_i2c_reg.h @@ -0,0 +1,690 @@ +// Copyright 2017-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_RTC_I2C_REG_H_ +#define _SOC_RTC_I2C_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" + +/** + * This file lists peripheral registers of an I2C controller which is part of the RTC. + * ULP coprocessor uses this controller to implement I2C_RD and I2C_WR instructions. + * + * Part of the functionality of this controller (such as slave mode, and multi-byte + * transfers) is not wired to the ULP, and is such, is not available to the + * ULP programs. + */ + +#define RTC_I2C_SCL_LOW_PERIOD_REG (DR_REG_RTC_I2C_BASE + 0x0000) +/* RTC_I2C_SCL_LOW_PERIOD : R/W ;bitpos:[19:0] ;default: 20'h100 ; */ +/*description: time period that scl = 0*/ +#define RTC_I2C_SCL_LOW_PERIOD 0x000FFFFF +#define RTC_I2C_SCL_LOW_PERIOD_M ((RTC_I2C_SCL_LOW_PERIOD_V)<<(RTC_I2C_SCL_LOW_PERIOD_S)) +#define RTC_I2C_SCL_LOW_PERIOD_V 0xFFFFF +#define RTC_I2C_SCL_LOW_PERIOD_S 0 + +#define RTC_I2C_CTRL_REG (DR_REG_RTC_I2C_BASE + 0x0004) +/* RTC_I2C_CLK_EN : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: rtc i2c reg clk gating*/ +#define RTC_I2C_CLK_EN (BIT(31)) +#define RTC_I2C_CLK_EN_M (BIT(31)) +#define RTC_I2C_CLK_EN_V 0x1 +#define RTC_I2C_CLK_EN_S 31 +/* RTC_I2C_RESET : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: rtc i2c sw reset*/ +#define RTC_I2C_RESET (BIT(30)) +#define RTC_I2C_RESET_M (BIT(30)) +#define RTC_I2C_RESET_V 0x1 +#define RTC_I2C_RESET_S 30 +/* RTC_I2C_RX_LSB_FIRST : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: receive lsb first*/ +#define RTC_I2C_RX_LSB_FIRST (BIT(5)) +#define RTC_I2C_RX_LSB_FIRST_M (BIT(5)) +#define RTC_I2C_RX_LSB_FIRST_V 0x1 +#define RTC_I2C_RX_LSB_FIRST_S 5 +/* RTC_I2C_TX_LSB_FIRST : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: transit lsb first*/ +#define RTC_I2C_TX_LSB_FIRST (BIT(4)) +#define RTC_I2C_TX_LSB_FIRST_M (BIT(4)) +#define RTC_I2C_TX_LSB_FIRST_V 0x1 +#define RTC_I2C_TX_LSB_FIRST_S 4 +/* RTC_I2C_TRANS_START : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: force start*/ +#define RTC_I2C_TRANS_START (BIT(3)) +#define RTC_I2C_TRANS_START_M (BIT(3)) +#define RTC_I2C_TRANS_START_V 0x1 +#define RTC_I2C_TRANS_START_S 3 +/* RTC_I2C_MS_MODE : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: 1=master 0=slave*/ +#define RTC_I2C_MS_MODE (BIT(2)) +#define RTC_I2C_MS_MODE_M (BIT(2)) +#define RTC_I2C_MS_MODE_V 0x1 +#define RTC_I2C_MS_MODE_S 2 +/* RTC_I2C_SCL_FORCE_OUT : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: 1=push pull 0=open drain*/ +#define RTC_I2C_SCL_FORCE_OUT (BIT(1)) +#define RTC_I2C_SCL_FORCE_OUT_M (BIT(1)) +#define RTC_I2C_SCL_FORCE_OUT_V 0x1 +#define RTC_I2C_SCL_FORCE_OUT_S 1 +/* RTC_I2C_SDA_FORCE_OUT : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: 1=push pull 0=open drain*/ +#define RTC_I2C_SDA_FORCE_OUT (BIT(0)) +#define RTC_I2C_SDA_FORCE_OUT_M (BIT(0)) +#define RTC_I2C_SDA_FORCE_OUT_V 0x1 +#define RTC_I2C_SDA_FORCE_OUT_S 0 + +#define RTC_I2C_STATUS_REG (DR_REG_RTC_I2C_BASE + 0x0008) +/* RTC_I2C_SCL_STATE_LAST : RO ;bitpos:[30:28] ;default: 3'b0 ; */ +/*description: scl last status*/ +#define RTC_I2C_SCL_STATE_LAST 0x00000007 +#define RTC_I2C_SCL_STATE_LAST_M ((RTC_I2C_SCL_STATE_LAST_V)<<(RTC_I2C_SCL_STATE_LAST_S)) +#define RTC_I2C_SCL_STATE_LAST_V 0x7 +#define RTC_I2C_SCL_STATE_LAST_S 28 +/* RTC_I2C_SCL_MAIN_STATE_LAST : RO ;bitpos:[26:24] ;default: 3'b0 ; */ +/*description: i2c last main status*/ +#define RTC_I2C_SCL_MAIN_STATE_LAST 0x00000007 +#define RTC_I2C_SCL_MAIN_STATE_LAST_M ((RTC_I2C_SCL_MAIN_STATE_LAST_V)<<(RTC_I2C_SCL_MAIN_STATE_LAST_S)) +#define RTC_I2C_SCL_MAIN_STATE_LAST_V 0x7 +#define RTC_I2C_SCL_MAIN_STATE_LAST_S 24 +/* RTC_I2C_SHIFT : RO ;bitpos:[23:16] ;default: 8'b0 ; */ +/*description: shifter content*/ +#define RTC_I2C_SHIFT 0x000000FF +#define RTC_I2C_SHIFT_M ((RTC_I2C_SHIFT_V)<<(RTC_I2C_SHIFT_S)) +#define RTC_I2C_SHIFT_V 0xFF +#define RTC_I2C_SHIFT_S 16 +/* RTC_I2C_OP_CNT : RO ;bitpos:[7:6] ;default: 2'b0 ; */ +/*description: which operation is working*/ +#define RTC_I2C_OP_CNT 0x00000003 +#define RTC_I2C_OP_CNT_M ((RTC_I2C_OP_CNT_V)<<(RTC_I2C_OP_CNT_S)) +#define RTC_I2C_OP_CNT_V 0x3 +#define RTC_I2C_OP_CNT_S 6 +/* RTC_I2C_BYTE_TRANS : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: One byte transit done*/ +#define RTC_I2C_BYTE_TRANS (BIT(5)) +#define RTC_I2C_BYTE_TRANS_M (BIT(5)) +#define RTC_I2C_BYTE_TRANS_V 0x1 +#define RTC_I2C_BYTE_TRANS_S 5 +/* RTC_I2C_SLAVE_ADDRESSED : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: slave reg sub address*/ +#define RTC_I2C_SLAVE_ADDRESSED (BIT(4)) +#define RTC_I2C_SLAVE_ADDRESSED_M (BIT(4)) +#define RTC_I2C_SLAVE_ADDRESSED_V 0x1 +#define RTC_I2C_SLAVE_ADDRESSED_S 4 +/* RTC_I2C_BUS_BUSY : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: bus is busy*/ +#define RTC_I2C_BUS_BUSY (BIT(3)) +#define RTC_I2C_BUS_BUSY_M (BIT(3)) +#define RTC_I2C_BUS_BUSY_V 0x1 +#define RTC_I2C_BUS_BUSY_S 3 +/* RTC_I2C_ARB_LOST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: arbitration is lost*/ +#define RTC_I2C_ARB_LOST (BIT(2)) +#define RTC_I2C_ARB_LOST_M (BIT(2)) +#define RTC_I2C_ARB_LOST_V 0x1 +#define RTC_I2C_ARB_LOST_S 2 +/* RTC_I2C_SLAVE_RW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: slave read or write*/ +#define RTC_I2C_SLAVE_RW (BIT(1)) +#define RTC_I2C_SLAVE_RW_M (BIT(1)) +#define RTC_I2C_SLAVE_RW_V 0x1 +#define RTC_I2C_SLAVE_RW_S 1 +/* RTC_I2C_ACK_REC : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: ack response*/ +#define RTC_I2C_ACK_REC (BIT(0)) +#define RTC_I2C_ACK_REC_M (BIT(0)) +#define RTC_I2C_ACK_REC_V 0x1 +#define RTC_I2C_ACK_REC_S 0 + +#define RTC_I2C_TIMEOUT_REG (DR_REG_RTC_I2C_BASE + 0x000c) +/* RTC_I2C_TIMEOUT : R/W ;bitpos:[19:0] ;default: 20'h10000 ; */ +/*description: time out threshold*/ +#define RTC_I2C_TIMEOUT 0x000FFFFF +#define RTC_I2C_TIMEOUT_M ((RTC_I2C_TIMEOUT_V)<<(RTC_I2C_TIMEOUT_S)) +#define RTC_I2C_TIMEOUT_V 0xFFFFF +#define RTC_I2C_TIMEOUT_S 0 + +#define RTC_I2C_SLAVE_ADDR_REG (DR_REG_RTC_I2C_BASE + 0x0010) +/* RTC_I2C_ADDR_10BIT_EN : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: i2c 10bit mode enable*/ +#define RTC_I2C_ADDR_10BIT_EN (BIT(31)) +#define RTC_I2C_ADDR_10BIT_EN_M (BIT(31)) +#define RTC_I2C_ADDR_10BIT_EN_V 0x1 +#define RTC_I2C_ADDR_10BIT_EN_S 31 +/* RTC_I2C_SLAVE_ADDR : R/W ;bitpos:[14:0] ;default: 15'b0 ; */ +/*description: slave address*/ +#define RTC_I2C_SLAVE_ADDR 0x00007FFF +#define RTC_I2C_SLAVE_ADDR_M ((RTC_I2C_SLAVE_ADDR_V)<<(RTC_I2C_SLAVE_ADDR_S)) +#define RTC_I2C_SLAVE_ADDR_V 0x7FFF +#define RTC_I2C_SLAVE_ADDR_S 0 + +#define RTC_I2C_SCL_HIGH_REG (DR_REG_RTC_I2C_BASE + 0x0014) +/* RTC_I2C_SCL_HIGH_PERIOD : R/W ;bitpos:[19:0] ;default: 20'h100 ; */ +/*description: time period that scl = 1*/ +#define RTC_I2C_SCL_HIGH_PERIOD 0x000FFFFF +#define RTC_I2C_SCL_HIGH_PERIOD_M ((RTC_I2C_SCL_HIGH_PERIOD_V)<<(RTC_I2C_SCL_HIGH_PERIOD_S)) +#define RTC_I2C_SCL_HIGH_PERIOD_V 0xFFFFF +#define RTC_I2C_SCL_HIGH_PERIOD_S 0 + +#define RTC_I2C_SDA_DUTY_REG (DR_REG_RTC_I2C_BASE + 0x0018) +/* RTC_I2C_SDA_DUTY_NUM : R/W ;bitpos:[19:0] ;default: 20'h10 ; */ +/*description: time period for SDA to toggle after SCL goes low*/ +#define RTC_I2C_SDA_DUTY_NUM 0x000FFFFF +#define RTC_I2C_SDA_DUTY_NUM_M ((RTC_I2C_SDA_DUTY_NUM_V)<<(RTC_I2C_SDA_DUTY_NUM_S)) +#define RTC_I2C_SDA_DUTY_NUM_V 0xFFFFF +#define RTC_I2C_SDA_DUTY_NUM_S 0 + +#define RTC_I2C_SCL_START_PERIOD_REG (DR_REG_RTC_I2C_BASE + 0x001c) +/* RTC_I2C_SCL_START_PERIOD : R/W ;bitpos:[19:0] ;default: 20'b1000 ; */ +/*description: time period for SCL to toggle after I2C start is triggered*/ +#define RTC_I2C_SCL_START_PERIOD 0x000FFFFF +#define RTC_I2C_SCL_START_PERIOD_M ((RTC_I2C_SCL_START_PERIOD_V)<<(RTC_I2C_SCL_START_PERIOD_S)) +#define RTC_I2C_SCL_START_PERIOD_V 0xFFFFF +#define RTC_I2C_SCL_START_PERIOD_S 0 + +#define RTC_I2C_SCL_STOP_PERIOD_REG (DR_REG_RTC_I2C_BASE + 0x0020) +/* RTC_I2C_SCL_STOP_PERIOD : R/W ;bitpos:[19:0] ;default: 20'b1000 ; */ +/*description: time period for SCL to stop after I2C end is triggered*/ +#define RTC_I2C_SCL_STOP_PERIOD 0x000FFFFF +#define RTC_I2C_SCL_STOP_PERIOD_M ((RTC_I2C_SCL_STOP_PERIOD_V)<<(RTC_I2C_SCL_STOP_PERIOD_S)) +#define RTC_I2C_SCL_STOP_PERIOD_V 0xFFFFF +#define RTC_I2C_SCL_STOP_PERIOD_S 0 + +#define RTC_I2C_INT_CLR_REG (DR_REG_RTC_I2C_BASE + 0x0024) +/* RTC_I2C_DETECT_START_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: clear detect start interrupt*/ +#define RTC_I2C_DETECT_START_INT_CLR (BIT(8)) +#define RTC_I2C_DETECT_START_INT_CLR_M (BIT(8)) +#define RTC_I2C_DETECT_START_INT_CLR_V 0x1 +#define RTC_I2C_DETECT_START_INT_CLR_S 8 +/* RTC_I2C_TX_DATA_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: clear transit load data complete interrupt*/ +#define RTC_I2C_TX_DATA_INT_CLR (BIT(7)) +#define RTC_I2C_TX_DATA_INT_CLR_M (BIT(7)) +#define RTC_I2C_TX_DATA_INT_CLR_V 0x1 +#define RTC_I2C_TX_DATA_INT_CLR_S 7 +/* RTC_I2C_RX_DATA_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: clear receive data interrupt*/ +#define RTC_I2C_RX_DATA_INT_CLR (BIT(6)) +#define RTC_I2C_RX_DATA_INT_CLR_M (BIT(6)) +#define RTC_I2C_RX_DATA_INT_CLR_V 0x1 +#define RTC_I2C_RX_DATA_INT_CLR_S 6 +/* RTC_I2C_ACK_ERR_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: clear ack error interrupt*/ +#define RTC_I2C_ACK_ERR_INT_CLR (BIT(5)) +#define RTC_I2C_ACK_ERR_INT_CLR_M (BIT(5)) +#define RTC_I2C_ACK_ERR_INT_CLR_V 0x1 +#define RTC_I2C_ACK_ERR_INT_CLR_S 5 +/* RTC_I2C_TIMEOUT_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: clear time out interrupt*/ +#define RTC_I2C_TIMEOUT_INT_CLR (BIT(4)) +#define RTC_I2C_TIMEOUT_INT_CLR_M (BIT(4)) +#define RTC_I2C_TIMEOUT_INT_CLR_V 0x1 +#define RTC_I2C_TIMEOUT_INT_CLR_S 4 +/* RTC_I2C_TRANS_COMPLETE_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: clear transit complete interrupt*/ +#define RTC_I2C_TRANS_COMPLETE_INT_CLR (BIT(3)) +#define RTC_I2C_TRANS_COMPLETE_INT_CLR_M (BIT(3)) +#define RTC_I2C_TRANS_COMPLETE_INT_CLR_V 0x1 +#define RTC_I2C_TRANS_COMPLETE_INT_CLR_S 3 +/* RTC_I2C_MASTER_TRAN_COMP_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: clear master transit complete interrupt*/ +#define RTC_I2C_MASTER_TRAN_COMP_INT_CLR (BIT(2)) +#define RTC_I2C_MASTER_TRAN_COMP_INT_CLR_M (BIT(2)) +#define RTC_I2C_MASTER_TRAN_COMP_INT_CLR_V 0x1 +#define RTC_I2C_MASTER_TRAN_COMP_INT_CLR_S 2 +/* RTC_I2C_ARBITRATION_LOST_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: clear arbitration lost interrupt*/ +#define RTC_I2C_ARBITRATION_LOST_INT_CLR (BIT(1)) +#define RTC_I2C_ARBITRATION_LOST_INT_CLR_M (BIT(1)) +#define RTC_I2C_ARBITRATION_LOST_INT_CLR_V 0x1 +#define RTC_I2C_ARBITRATION_LOST_INT_CLR_S 1 +/* RTC_I2C_SLAVE_TRAN_COMP_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: clear slave transit complete interrupt*/ +#define RTC_I2C_SLAVE_TRAN_COMP_INT_CLR (BIT(0)) +#define RTC_I2C_SLAVE_TRAN_COMP_INT_CLR_M (BIT(0)) +#define RTC_I2C_SLAVE_TRAN_COMP_INT_CLR_V 0x1 +#define RTC_I2C_SLAVE_TRAN_COMP_INT_CLR_S 0 + +#define RTC_I2C_INT_RAW_REG (DR_REG_RTC_I2C_BASE + 0x0028) +/* RTC_I2C_DETECT_START_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: detect start interrupt raw*/ +#define RTC_I2C_DETECT_START_INT_RAW (BIT(8)) +#define RTC_I2C_DETECT_START_INT_RAW_M (BIT(8)) +#define RTC_I2C_DETECT_START_INT_RAW_V 0x1 +#define RTC_I2C_DETECT_START_INT_RAW_S 8 +/* RTC_I2C_TX_DATA_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: transit data interrupt raw*/ +#define RTC_I2C_TX_DATA_INT_RAW (BIT(7)) +#define RTC_I2C_TX_DATA_INT_RAW_M (BIT(7)) +#define RTC_I2C_TX_DATA_INT_RAW_V 0x1 +#define RTC_I2C_TX_DATA_INT_RAW_S 7 +/* RTC_I2C_RX_DATA_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: receive data interrupt raw*/ +#define RTC_I2C_RX_DATA_INT_RAW (BIT(6)) +#define RTC_I2C_RX_DATA_INT_RAW_M (BIT(6)) +#define RTC_I2C_RX_DATA_INT_RAW_V 0x1 +#define RTC_I2C_RX_DATA_INT_RAW_S 6 +/* RTC_I2C_ACK_ERR_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: ack error interrupt raw*/ +#define RTC_I2C_ACK_ERR_INT_RAW (BIT(5)) +#define RTC_I2C_ACK_ERR_INT_RAW_M (BIT(5)) +#define RTC_I2C_ACK_ERR_INT_RAW_V 0x1 +#define RTC_I2C_ACK_ERR_INT_RAW_S 5 +/* RTC_I2C_TIMEOUT_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: time out interrupt raw*/ +#define RTC_I2C_TIMEOUT_INT_RAW (BIT(4)) +#define RTC_I2C_TIMEOUT_INT_RAW_M (BIT(4)) +#define RTC_I2C_TIMEOUT_INT_RAW_V 0x1 +#define RTC_I2C_TIMEOUT_INT_RAW_S 4 +/* RTC_I2C_TRANS_COMPLETE_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: transit complete interrupt raw*/ +#define RTC_I2C_TRANS_COMPLETE_INT_RAW (BIT(3)) +#define RTC_I2C_TRANS_COMPLETE_INT_RAW_M (BIT(3)) +#define RTC_I2C_TRANS_COMPLETE_INT_RAW_V 0x1 +#define RTC_I2C_TRANS_COMPLETE_INT_RAW_S 3 +/* RTC_I2C_MASTER_TRAN_COMP_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: master transit complete interrupt raw*/ +#define RTC_I2C_MASTER_TRAN_COMP_INT_RAW (BIT(2)) +#define RTC_I2C_MASTER_TRAN_COMP_INT_RAW_M (BIT(2)) +#define RTC_I2C_MASTER_TRAN_COMP_INT_RAW_V 0x1 +#define RTC_I2C_MASTER_TRAN_COMP_INT_RAW_S 2 +/* RTC_I2C_ARBITRATION_LOST_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: arbitration lost interrupt raw*/ +#define RTC_I2C_ARBITRATION_LOST_INT_RAW (BIT(1)) +#define RTC_I2C_ARBITRATION_LOST_INT_RAW_M (BIT(1)) +#define RTC_I2C_ARBITRATION_LOST_INT_RAW_V 0x1 +#define RTC_I2C_ARBITRATION_LOST_INT_RAW_S 1 +/* RTC_I2C_SLAVE_TRAN_COMP_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: slave transit complete interrupt raw*/ +#define RTC_I2C_SLAVE_TRAN_COMP_INT_RAW (BIT(0)) +#define RTC_I2C_SLAVE_TRAN_COMP_INT_RAW_M (BIT(0)) +#define RTC_I2C_SLAVE_TRAN_COMP_INT_RAW_V 0x1 +#define RTC_I2C_SLAVE_TRAN_COMP_INT_RAW_S 0 + +#define RTC_I2C_INT_ST_REG (DR_REG_RTC_I2C_BASE + 0x002c) +/* RTC_I2C_DETECT_START_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: detect start interrupt state*/ +#define RTC_I2C_DETECT_START_INT_ST (BIT(8)) +#define RTC_I2C_DETECT_START_INT_ST_M (BIT(8)) +#define RTC_I2C_DETECT_START_INT_ST_V 0x1 +#define RTC_I2C_DETECT_START_INT_ST_S 8 +/* RTC_I2C_TX_DATA_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: transit data interrupt state*/ +#define RTC_I2C_TX_DATA_INT_ST (BIT(7)) +#define RTC_I2C_TX_DATA_INT_ST_M (BIT(7)) +#define RTC_I2C_TX_DATA_INT_ST_V 0x1 +#define RTC_I2C_TX_DATA_INT_ST_S 7 +/* RTC_I2C_RX_DATA_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: receive data interrupt state*/ +#define RTC_I2C_RX_DATA_INT_ST (BIT(6)) +#define RTC_I2C_RX_DATA_INT_ST_M (BIT(6)) +#define RTC_I2C_RX_DATA_INT_ST_V 0x1 +#define RTC_I2C_RX_DATA_INT_ST_S 6 +/* RTC_I2C_ACK_ERR_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: ack error interrupt state*/ +#define RTC_I2C_ACK_ERR_INT_ST (BIT(5)) +#define RTC_I2C_ACK_ERR_INT_ST_M (BIT(5)) +#define RTC_I2C_ACK_ERR_INT_ST_V 0x1 +#define RTC_I2C_ACK_ERR_INT_ST_S 5 +/* RTC_I2C_TIMEOUT_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: time out interrupt state*/ +#define RTC_I2C_TIMEOUT_INT_ST (BIT(4)) +#define RTC_I2C_TIMEOUT_INT_ST_M (BIT(4)) +#define RTC_I2C_TIMEOUT_INT_ST_V 0x1 +#define RTC_I2C_TIMEOUT_INT_ST_S 4 +/* RTC_I2C_TRANS_COMPLETE_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: transit complete interrupt state*/ +#define RTC_I2C_TRANS_COMPLETE_INT_ST (BIT(3)) +#define RTC_I2C_TRANS_COMPLETE_INT_ST_M (BIT(3)) +#define RTC_I2C_TRANS_COMPLETE_INT_ST_V 0x1 +#define RTC_I2C_TRANS_COMPLETE_INT_ST_S 3 +/* RTC_I2C_MASTER_TRAN_COMP_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: master transit complete interrupt state*/ +#define RTC_I2C_MASTER_TRAN_COMP_INT_ST (BIT(2)) +#define RTC_I2C_MASTER_TRAN_COMP_INT_ST_M (BIT(2)) +#define RTC_I2C_MASTER_TRAN_COMP_INT_ST_V 0x1 +#define RTC_I2C_MASTER_TRAN_COMP_INT_ST_S 2 +/* RTC_I2C_ARBITRATION_LOST_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: arbitration lost interrupt state*/ +#define RTC_I2C_ARBITRATION_LOST_INT_ST (BIT(1)) +#define RTC_I2C_ARBITRATION_LOST_INT_ST_M (BIT(1)) +#define RTC_I2C_ARBITRATION_LOST_INT_ST_V 0x1 +#define RTC_I2C_ARBITRATION_LOST_INT_ST_S 1 +/* RTC_I2C_SLAVE_TRAN_COMP_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: slave transit complete interrupt state*/ +#define RTC_I2C_SLAVE_TRAN_COMP_INT_ST (BIT(0)) +#define RTC_I2C_SLAVE_TRAN_COMP_INT_ST_M (BIT(0)) +#define RTC_I2C_SLAVE_TRAN_COMP_INT_ST_V 0x1 +#define RTC_I2C_SLAVE_TRAN_COMP_INT_ST_S 0 + +#define RTC_I2C_INT_ENA_REG (DR_REG_RTC_I2C_BASE + 0x0030) +/* RTC_I2C_DETECT_START_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: enable detect start interrupt*/ +#define RTC_I2C_DETECT_START_INT_ENA (BIT(8)) +#define RTC_I2C_DETECT_START_INT_ENA_M (BIT(8)) +#define RTC_I2C_DETECT_START_INT_ENA_V 0x1 +#define RTC_I2C_DETECT_START_INT_ENA_S 8 +/* RTC_I2C_TX_DATA_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: enable transit data interrupt*/ +#define RTC_I2C_TX_DATA_INT_ENA (BIT(7)) +#define RTC_I2C_TX_DATA_INT_ENA_M (BIT(7)) +#define RTC_I2C_TX_DATA_INT_ENA_V 0x1 +#define RTC_I2C_TX_DATA_INT_ENA_S 7 +/* RTC_I2C_RX_DATA_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: enable receive data interrupt*/ +#define RTC_I2C_RX_DATA_INT_ENA (BIT(6)) +#define RTC_I2C_RX_DATA_INT_ENA_M (BIT(6)) +#define RTC_I2C_RX_DATA_INT_ENA_V 0x1 +#define RTC_I2C_RX_DATA_INT_ENA_S 6 +/* RTC_I2C_ACK_ERR_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: enable eack error interrupt*/ +#define RTC_I2C_ACK_ERR_INT_ENA (BIT(5)) +#define RTC_I2C_ACK_ERR_INT_ENA_M (BIT(5)) +#define RTC_I2C_ACK_ERR_INT_ENA_V 0x1 +#define RTC_I2C_ACK_ERR_INT_ENA_S 5 +/* RTC_I2C_TIMEOUT_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: enable time out interrupt*/ +#define RTC_I2C_TIMEOUT_INT_ENA (BIT(4)) +#define RTC_I2C_TIMEOUT_INT_ENA_M (BIT(4)) +#define RTC_I2C_TIMEOUT_INT_ENA_V 0x1 +#define RTC_I2C_TIMEOUT_INT_ENA_S 4 +/* RTC_I2C_TRANS_COMPLETE_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: enable transit complete interrupt*/ +#define RTC_I2C_TRANS_COMPLETE_INT_ENA (BIT(3)) +#define RTC_I2C_TRANS_COMPLETE_INT_ENA_M (BIT(3)) +#define RTC_I2C_TRANS_COMPLETE_INT_ENA_V 0x1 +#define RTC_I2C_TRANS_COMPLETE_INT_ENA_S 3 +/* RTC_I2C_MASTER_TRAN_COMP_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: enable master transit complete interrupt*/ +#define RTC_I2C_MASTER_TRAN_COMP_INT_ENA (BIT(2)) +#define RTC_I2C_MASTER_TRAN_COMP_INT_ENA_M (BIT(2)) +#define RTC_I2C_MASTER_TRAN_COMP_INT_ENA_V 0x1 +#define RTC_I2C_MASTER_TRAN_COMP_INT_ENA_S 2 +/* RTC_I2C_ARBITRATION_LOST_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: enable arbitration lost interrupt*/ +#define RTC_I2C_ARBITRATION_LOST_INT_ENA (BIT(1)) +#define RTC_I2C_ARBITRATION_LOST_INT_ENA_M (BIT(1)) +#define RTC_I2C_ARBITRATION_LOST_INT_ENA_V 0x1 +#define RTC_I2C_ARBITRATION_LOST_INT_ENA_S 1 +/* RTC_I2C_SLAVE_TRAN_COMP_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: enable slave transit complete interrupt*/ +#define RTC_I2C_SLAVE_TRAN_COMP_INT_ENA (BIT(0)) +#define RTC_I2C_SLAVE_TRAN_COMP_INT_ENA_M (BIT(0)) +#define RTC_I2C_SLAVE_TRAN_COMP_INT_ENA_V 0x1 +#define RTC_I2C_SLAVE_TRAN_COMP_INT_ENA_S 0 + +#define RTC_I2C_DATA_REG (DR_REG_RTC_I2C_BASE + 0x0034) +/* RTC_I2C_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: i2c done*/ +#define RTC_I2C_DONE (BIT(31)) +#define RTC_I2C_DONE_M (BIT(31)) +#define RTC_I2C_DONE_V 0x1 +#define RTC_I2C_DONE_S 31 +/* RTC_I2C_SLAVE_TX_DATA : R/W ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: data sent by slave*/ +#define RTC_I2C_SLAVE_TX_DATA 0x000000FF +#define RTC_I2C_SLAVE_TX_DATA_M ((RTC_I2C_SLAVE_TX_DATA_V)<<(RTC_I2C_SLAVE_TX_DATA_S)) +#define RTC_I2C_SLAVE_TX_DATA_V 0xFF +#define RTC_I2C_SLAVE_TX_DATA_S 8 +/* RTC_I2C_RDATA : RO ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: data received*/ +#define RTC_I2C_RDATA 0x000000FF +#define RTC_I2C_RDATA_M ((RTC_I2C_RDATA_V)<<(RTC_I2C_RDATA_S)) +#define RTC_I2C_RDATA_V 0xFF +#define RTC_I2C_RDATA_S 0 + +#define RTC_I2C_CMD0_REG (DR_REG_RTC_I2C_BASE + 0x0038) +/* RTC_I2C_COMMAND0_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command0_done*/ +#define RTC_I2C_COMMAND0_DONE (BIT(31)) +#define RTC_I2C_COMMAND0_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND0_DONE_V 0x1 +#define RTC_I2C_COMMAND0_DONE_S 31 +/* RTC_I2C_COMMAND0 : R/W ;bitpos:[13:0] ;default: 14'h0903 ; */ +/*description: command0*/ +#define RTC_I2C_COMMAND0 0x00003FFF +#define RTC_I2C_COMMAND0_M ((RTC_I2C_COMMAND0_V)<<(RTC_I2C_COMMAND0_S)) +#define RTC_I2C_COMMAND0_V 0x3FFF +#define RTC_I2C_COMMAND0_S 0 + +#define RTC_I2C_CMD1_REG (DR_REG_RTC_I2C_BASE + 0x003c) +/* RTC_I2C_COMMAND1_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command1_done*/ +#define RTC_I2C_COMMAND1_DONE (BIT(31)) +#define RTC_I2C_COMMAND1_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND1_DONE_V 0x1 +#define RTC_I2C_COMMAND1_DONE_S 31 +/* RTC_I2C_COMMAND1 : R/W ;bitpos:[13:0] ;default: 14'h1901 ; */ +/*description: command1*/ +#define RTC_I2C_COMMAND1 0x00003FFF +#define RTC_I2C_COMMAND1_M ((RTC_I2C_COMMAND1_V)<<(RTC_I2C_COMMAND1_S)) +#define RTC_I2C_COMMAND1_V 0x3FFF +#define RTC_I2C_COMMAND1_S 0 + +#define RTC_I2C_CMD2_REG (DR_REG_RTC_I2C_BASE + 0x0040) +/* RTC_I2C_COMMAND2_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command2_done*/ +#define RTC_I2C_COMMAND2_DONE (BIT(31)) +#define RTC_I2C_COMMAND2_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND2_DONE_V 0x1 +#define RTC_I2C_COMMAND2_DONE_S 31 +/* RTC_I2C_COMMAND2 : R/W ;bitpos:[13:0] ;default: 14'h0902 ; */ +/*description: command2*/ +#define RTC_I2C_COMMAND2 0x00003FFF +#define RTC_I2C_COMMAND2_M ((RTC_I2C_COMMAND2_V)<<(RTC_I2C_COMMAND2_S)) +#define RTC_I2C_COMMAND2_V 0x3FFF +#define RTC_I2C_COMMAND2_S 0 + +#define RTC_I2C_CMD3_REG (DR_REG_RTC_I2C_BASE + 0x0044) +/* RTC_I2C_COMMAND3_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command3_done*/ +#define RTC_I2C_COMMAND3_DONE (BIT(31)) +#define RTC_I2C_COMMAND3_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND3_DONE_V 0x1 +#define RTC_I2C_COMMAND3_DONE_S 31 +/* RTC_I2C_COMMAND3 : R/W ;bitpos:[13:0] ;default: 14'h0101 ; */ +/*description: command3*/ +#define RTC_I2C_COMMAND3 0x00003FFF +#define RTC_I2C_COMMAND3_M ((RTC_I2C_COMMAND3_V)<<(RTC_I2C_COMMAND3_S)) +#define RTC_I2C_COMMAND3_V 0x3FFF +#define RTC_I2C_COMMAND3_S 0 + +#define RTC_I2C_CMD4_REG (DR_REG_RTC_I2C_BASE + 0x0048) +/* RTC_I2C_COMMAND4_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command4_done*/ +#define RTC_I2C_COMMAND4_DONE (BIT(31)) +#define RTC_I2C_COMMAND4_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND4_DONE_V 0x1 +#define RTC_I2C_COMMAND4_DONE_S 31 +/* RTC_I2C_COMMAND4 : R/W ;bitpos:[13:0] ;default: 14'h0901 ; */ +/*description: command4*/ +#define RTC_I2C_COMMAND4 0x00003FFF +#define RTC_I2C_COMMAND4_M ((RTC_I2C_COMMAND4_V)<<(RTC_I2C_COMMAND4_S)) +#define RTC_I2C_COMMAND4_V 0x3FFF +#define RTC_I2C_COMMAND4_S 0 + +#define RTC_I2C_CMD5_REG (DR_REG_RTC_I2C_BASE + 0x004c) +/* RTC_I2C_COMMAND5_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command5_done*/ +#define RTC_I2C_COMMAND5_DONE (BIT(31)) +#define RTC_I2C_COMMAND5_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND5_DONE_V 0x1 +#define RTC_I2C_COMMAND5_DONE_S 31 +/* RTC_I2C_COMMAND5 : R/W ;bitpos:[13:0] ;default: 14'h1701 ; */ +/*description: command5*/ +#define RTC_I2C_COMMAND5 0x00003FFF +#define RTC_I2C_COMMAND5_M ((RTC_I2C_COMMAND5_V)<<(RTC_I2C_COMMAND5_S)) +#define RTC_I2C_COMMAND5_V 0x3FFF +#define RTC_I2C_COMMAND5_S 0 + +#define RTC_I2C_CMD6_REG (DR_REG_RTC_I2C_BASE + 0x0050) +/* RTC_I2C_COMMAND6_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command6_done*/ +#define RTC_I2C_COMMAND6_DONE (BIT(31)) +#define RTC_I2C_COMMAND6_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND6_DONE_V 0x1 +#define RTC_I2C_COMMAND6_DONE_S 31 +/* RTC_I2C_COMMAND6 : R/W ;bitpos:[13:0] ;default: 14'h1901 ; */ +/*description: command6*/ +#define RTC_I2C_COMMAND6 0x00003FFF +#define RTC_I2C_COMMAND6_M ((RTC_I2C_COMMAND6_V)<<(RTC_I2C_COMMAND6_S)) +#define RTC_I2C_COMMAND6_V 0x3FFF +#define RTC_I2C_COMMAND6_S 0 + +#define RTC_I2C_CMD7_REG (DR_REG_RTC_I2C_BASE + 0x0054) +/* RTC_I2C_COMMAND7_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command7_done*/ +#define RTC_I2C_COMMAND7_DONE (BIT(31)) +#define RTC_I2C_COMMAND7_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND7_DONE_V 0x1 +#define RTC_I2C_COMMAND7_DONE_S 31 +/* RTC_I2C_COMMAND7 : R/W ;bitpos:[13:0] ;default: 14'h0904 ; */ +/*description: command7*/ +#define RTC_I2C_COMMAND7 0x00003FFF +#define RTC_I2C_COMMAND7_M ((RTC_I2C_COMMAND7_V)<<(RTC_I2C_COMMAND7_S)) +#define RTC_I2C_COMMAND7_V 0x3FFF +#define RTC_I2C_COMMAND7_S 0 + +#define RTC_I2C_CMD8_REG (DR_REG_RTC_I2C_BASE + 0x0058) +/* RTC_I2C_COMMAND8_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command8_done*/ +#define RTC_I2C_COMMAND8_DONE (BIT(31)) +#define RTC_I2C_COMMAND8_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND8_DONE_V 0x1 +#define RTC_I2C_COMMAND8_DONE_S 31 +/* RTC_I2C_COMMAND8 : R/W ;bitpos:[13:0] ;default: 14'h1901 ; */ +/*description: command8*/ +#define RTC_I2C_COMMAND8 0x00003FFF +#define RTC_I2C_COMMAND8_M ((RTC_I2C_COMMAND8_V)<<(RTC_I2C_COMMAND8_S)) +#define RTC_I2C_COMMAND8_V 0x3FFF +#define RTC_I2C_COMMAND8_S 0 + +#define RTC_I2C_CMD9_REG (DR_REG_RTC_I2C_BASE + 0x005c) +/* RTC_I2C_COMMAND9_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command9_done*/ +#define RTC_I2C_COMMAND9_DONE (BIT(31)) +#define RTC_I2C_COMMAND9_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND9_DONE_V 0x1 +#define RTC_I2C_COMMAND9_DONE_S 31 +/* RTC_I2C_COMMAND9 : R/W ;bitpos:[13:0] ;default: 14'h0903 ; */ +/*description: command9*/ +#define RTC_I2C_COMMAND9 0x00003FFF +#define RTC_I2C_COMMAND9_M ((RTC_I2C_COMMAND9_V)<<(RTC_I2C_COMMAND9_S)) +#define RTC_I2C_COMMAND9_V 0x3FFF +#define RTC_I2C_COMMAND9_S 0 + +#define RTC_I2C_CMD10_REG (DR_REG_RTC_I2C_BASE + 0x0060) +/* RTC_I2C_COMMAND10_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command10_done*/ +#define RTC_I2C_COMMAND10_DONE (BIT(31)) +#define RTC_I2C_COMMAND10_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND10_DONE_V 0x1 +#define RTC_I2C_COMMAND10_DONE_S 31 +/* RTC_I2C_COMMAND10 : R/W ;bitpos:[13:0] ;default: 14'h0101 ; */ +/*description: command10*/ +#define RTC_I2C_COMMAND10 0x00003FFF +#define RTC_I2C_COMMAND10_M ((RTC_I2C_COMMAND10_V)<<(RTC_I2C_COMMAND10_S)) +#define RTC_I2C_COMMAND10_V 0x3FFF +#define RTC_I2C_COMMAND10_S 0 + +#define RTC_I2C_CMD11_REG (DR_REG_RTC_I2C_BASE + 0x0064) +/* RTC_I2C_COMMAND11_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command11_done*/ +#define RTC_I2C_COMMAND11_DONE (BIT(31)) +#define RTC_I2C_COMMAND11_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND11_DONE_V 0x1 +#define RTC_I2C_COMMAND11_DONE_S 31 +/* RTC_I2C_COMMAND11 : R/W ;bitpos:[13:0] ;default: 14'h0901 ; */ +/*description: command11*/ +#define RTC_I2C_COMMAND11 0x00003FFF +#define RTC_I2C_COMMAND11_M ((RTC_I2C_COMMAND11_V)<<(RTC_I2C_COMMAND11_S)) +#define RTC_I2C_COMMAND11_V 0x3FFF +#define RTC_I2C_COMMAND11_S 0 + +#define RTC_I2C_CMD12_REG (DR_REG_RTC_I2C_BASE + 0x0068) +/* RTC_I2C_COMMAND12_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command12_done*/ +#define RTC_I2C_COMMAND12_DONE (BIT(31)) +#define RTC_I2C_COMMAND12_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND12_DONE_V 0x1 +#define RTC_I2C_COMMAND12_DONE_S 31 +/* RTC_I2C_COMMAND12 : R/W ;bitpos:[13:0] ;default: 14'h1701 ; */ +/*description: command12*/ +#define RTC_I2C_COMMAND12 0x00003FFF +#define RTC_I2C_COMMAND12_M ((RTC_I2C_COMMAND12_V)<<(RTC_I2C_COMMAND12_S)) +#define RTC_I2C_COMMAND12_V 0x3FFF +#define RTC_I2C_COMMAND12_S 0 + +#define RTC_I2C_CMD13_REG (DR_REG_RTC_I2C_BASE + 0x006c) +/* RTC_I2C_COMMAND13_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command13_done*/ +#define RTC_I2C_COMMAND13_DONE (BIT(31)) +#define RTC_I2C_COMMAND13_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND13_DONE_V 0x1 +#define RTC_I2C_COMMAND13_DONE_S 31 +/* RTC_I2C_COMMAND13 : R/W ;bitpos:[13:0] ;default: 14'h1901 ; */ +/*description: command13*/ +#define RTC_I2C_COMMAND13 0x00003FFF +#define RTC_I2C_COMMAND13_M ((RTC_I2C_COMMAND13_V)<<(RTC_I2C_COMMAND13_S)) +#define RTC_I2C_COMMAND13_V 0x3FFF +#define RTC_I2C_COMMAND13_S 0 + +#define RTC_I2C_CMD14_REG (DR_REG_RTC_I2C_BASE + 0x0070) +/* RTC_I2C_COMMAND14_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command14_done*/ +#define RTC_I2C_COMMAND14_DONE (BIT(31)) +#define RTC_I2C_COMMAND14_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND14_DONE_V 0x1 +#define RTC_I2C_COMMAND14_DONE_S 31 +/* RTC_I2C_COMMAND14 : R/W ;bitpos:[13:0] ;default: 14'h0 ; */ +/*description: command14*/ +#define RTC_I2C_COMMAND14 0x00003FFF +#define RTC_I2C_COMMAND14_M ((RTC_I2C_COMMAND14_V)<<(RTC_I2C_COMMAND14_S)) +#define RTC_I2C_COMMAND14_V 0x3FFF +#define RTC_I2C_COMMAND14_S 0 + +#define RTC_I2C_CMD15_REG (DR_REG_RTC_I2C_BASE + 0x0074) +/* RTC_I2C_COMMAND15_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: command15_done*/ +#define RTC_I2C_COMMAND15_DONE (BIT(31)) +#define RTC_I2C_COMMAND15_DONE_M (BIT(31)) +#define RTC_I2C_COMMAND15_DONE_V 0x1 +#define RTC_I2C_COMMAND15_DONE_S 31 +/* RTC_I2C_COMMAND15 : R/W ;bitpos:[13:0] ;default: 14'h0 ; */ +/*description: command15*/ +#define RTC_I2C_COMMAND15 0x00003FFF +#define RTC_I2C_COMMAND15_M ((RTC_I2C_COMMAND15_V)<<(RTC_I2C_COMMAND15_S)) +#define RTC_I2C_COMMAND15_V 0x3FFF +#define RTC_I2C_COMMAND15_S 0 + +#define RTC_I2C_DATE_REG (DR_REG_RTC_I2C_BASE + 0x00FC) +/* RTC_I2C_DATE : R/W ;bitpos:[27:0] ;default: 28'h1711170 ; */ +/*description: */ +#define RTC_I2C_DATE 0x0FFFFFFF +#define RTC_I2C_DATE_M ((RTC_I2C_DATE_V)<<(RTC_I2C_DATE_S)) +#define RTC_I2C_DATE_V 0xFFFFFFF +#define RTC_I2C_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_RTC_I2C_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/rtc_i2c_struct.h b/components/soc/esp32s2beta/include/soc/rtc_i2c_struct.h new file mode 100644 index 0000000000..7f6193c17b --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/rtc_i2c_struct.h @@ -0,0 +1,226 @@ +// Copyright 2017-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_RTC_I2C_STRUCT_H_ +#define _SOC_RTC_I2C_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t period: 20; /*time period that scl = 0*/ + uint32_t reserved20: 12; + }; + uint32_t val; + } scl_low; + union { + struct { + uint32_t sda_force_out: 1; /*1=push pull 0=open drain*/ + uint32_t scl_force_out: 1; /*1=push pull 0=open drain*/ + uint32_t ms_mode: 1; /*1=master 0=slave*/ + uint32_t trans_start: 1; /*force start*/ + uint32_t tx_lsb_first: 1; /*transit lsb first*/ + uint32_t rx_lsb_first: 1; /*receive lsb first*/ + uint32_t reserved6: 24; + uint32_t i2c_reset: 1; /*rtc i2c sw reset*/ + uint32_t i2cclk_en: 1; /*rtc i2c reg clk gating*/ + }; + uint32_t val; + } ctrl; + union { + struct { + uint32_t ack_rec: 1; /*ack response*/ + uint32_t slave_rw: 1; /*slave read or write*/ + uint32_t arb_lost: 1; /*arbitration is lost*/ + uint32_t bus_busy: 1; /*bus is busy*/ + uint32_t slave_addressed: 1; /*slave reg sub address*/ + uint32_t byte_trans: 1; /*One byte transit done*/ + uint32_t op_cnt: 2; /*which operation is working*/ + uint32_t reserved8: 8; + uint32_t shift: 8; /*shifter content*/ + uint32_t scl_main_state_last: 3; /*i2c last main status*/ + uint32_t reserved27: 1; + uint32_t scl_state_last: 3; /*scl last status*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } status; + union { + struct { + uint32_t time_out: 20; /*time out threshold*/ + uint32_t reserved20:12; + }; + uint32_t val; + } timeout; + union { + struct { + uint32_t addr: 15; /*slave address*/ + uint32_t reserved15: 16; + uint32_t en_10bit: 1; /*i2c 10bit mode enable*/ + }; + uint32_t val; + } slave_addr; + union { + struct { + uint32_t period: 20; /*time period that scl = 1*/ + uint32_t reserved20: 12; + }; + uint32_t val; + } scl_high; + union { + struct { + uint32_t sda_duty_num:20; /*time period for SDA to toggle after SCL goes low*/ + uint32_t reserved20: 12; + }; + uint32_t val; + } sda_duty; + union { + struct { + uint32_t scl_start_period:20; /*time period for SCL to toggle after I2C start is triggered*/ + uint32_t reserved20: 12; + }; + uint32_t val; + } scl_start_period; + union { + struct { + uint32_t scl_stop_period:20; /*time period for SCL to stop after I2C end is triggered*/ + uint32_t reserved20: 12; + }; + uint32_t val; + } scl_stop_period; + union { + struct { + uint32_t slave_tran_comp: 1; /*clear slave transit complete interrupt*/ + uint32_t arbitration_lost: 1; /*clear arbitration lost interrupt*/ + uint32_t master_tran_comp: 1; /*clear master transit complete interrupt*/ + uint32_t trans_complete: 1; /*clear transit complete interrupt*/ + uint32_t time_out: 1; /*clear time out interrupt*/ + uint32_t ack_err: 1; /*clear ack error interrupt*/ + uint32_t rx_data: 1; /*clear receive data interrupt*/ + uint32_t tx_data: 1; /*clear transit load data complete interrupt*/ + uint32_t detect_start: 1; /*clear detect start interrupt*/ + uint32_t reserved9: 23; + }; + uint32_t val; + } int_clr; + union { + struct { + uint32_t slave_tran_comp: 1; /*slave transit complete interrupt raw*/ + uint32_t arbitration_lost: 1; /*arbitration lost interrupt raw*/ + uint32_t master_tran_comp: 1; /*master transit complete interrupt raw*/ + uint32_t trans_complete: 1; /*transit complete interrupt raw*/ + uint32_t time_out: 1; /*time out interrupt raw*/ + uint32_t ack_err: 1; /*ack error interrupt raw*/ + uint32_t rx_data: 1; /*receive data interrupt raw*/ + uint32_t tx_data: 1; /*transit data interrupt raw*/ + uint32_t detect_start: 1; /*detect start interrupt raw*/ + uint32_t reserved9: 23; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t slave_tran_comp: 1; /*slave transit complete interrupt state*/ + uint32_t arbitration_lost: 1; /*arbitration lost interrupt state*/ + uint32_t master_tran_comp: 1; /*master transit complete interrupt state*/ + uint32_t trans_complete: 1; /*transit complete interrupt state*/ + uint32_t time_out: 1; /*time out interrupt state*/ + uint32_t ack_err: 1; /*ack error interrupt state*/ + uint32_t rx_data: 1; /*receive data interrupt state*/ + uint32_t tx_data: 1; /*transit data interrupt state*/ + uint32_t detect_start: 1; /*detect start interrupt state*/ + uint32_t reserved9: 23; + }; + uint32_t val; + } int_st; + union { + struct { + uint32_t slave_tran_comp: 1; /*enable slave transit complete interrupt*/ + uint32_t arbitration_lost: 1; /*enable arbitration lost interrupt*/ + uint32_t master_tran_comp: 1; /*enable master transit complete interrupt*/ + uint32_t trans_complete: 1; /*enable transit complete interrupt*/ + uint32_t time_out: 1; /*enable time out interrupt*/ + uint32_t ack_err: 1; /*enable eack error interrupt*/ + uint32_t rx_data: 1; /*enable receive data interrupt*/ + uint32_t tx_data: 1; /*enable transit data interrupt*/ + uint32_t detect_start: 1; /*enable detect start interrupt*/ + uint32_t reserved9: 23; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t i2c_rdata: 8; /*data received*/ + uint32_t slave_tx_data: 8; /*data sent by slave*/ + uint32_t reserved16: 15; + uint32_t i2c_done: 1; /*i2c done*/ + }; + uint32_t val; + } fifo_data; + union { + struct { + uint32_t command: 14; /*command*/ + uint32_t reserved14: 17; + uint32_t done: 1; /*command_done*/ + }; + uint32_t val; + } command[16]; + uint32_t reserved_78; + uint32_t reserved_7c; + uint32_t reserved_80; + uint32_t reserved_84; + uint32_t reserved_88; + uint32_t reserved_8c; + uint32_t reserved_90; + uint32_t reserved_94; + uint32_t reserved_98; + uint32_t reserved_9c; + uint32_t reserved_a0; + uint32_t reserved_a4; + uint32_t reserved_a8; + uint32_t reserved_ac; + uint32_t reserved_b0; + uint32_t reserved_b4; + uint32_t reserved_b8; + uint32_t reserved_bc; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + union { + struct { + uint32_t i2c_date: 28; + uint32_t reserved28: 4; + }; + uint32_t val; + } date; +} rtc_i2c_dev_t; +extern rtc_i2c_dev_t RTC_I2C; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_RTC_I2C_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/rtc_io_reg.h b/components/soc/esp32s2beta/include/soc/rtc_io_reg.h new file mode 100644 index 0000000000..3b5167f4e8 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/rtc_io_reg.h @@ -0,0 +1,2284 @@ +// Copyright 2017-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_RTC_IO_REG_H_ +#define _SOC_RTC_IO_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define RTC_GPIO_OUT_REG (DR_REG_RTCIO_BASE + 0x0) +/* RTC_GPIO_OUT_DATA : R/W ;bitpos:[31:10] ;default: 0 ; */ +/*description: RTC GPIO 0 ~ 21 output data*/ +#define RTC_GPIO_OUT_DATA 0x003FFFFF +#define RTC_GPIO_OUT_DATA_M ((RTC_GPIO_OUT_DATA_V)<<(RTC_GPIO_OUT_DATA_S)) +#define RTC_GPIO_OUT_DATA_V 0x3FFFFF +#define RTC_GPIO_OUT_DATA_S 10 + +#define RTC_GPIO_OUT_W1TS_REG (DR_REG_RTCIO_BASE + 0x4) +/* RTC_GPIO_OUT_DATA_W1TS : WO ;bitpos:[31:10] ;default: 0 ; */ +/*description: RTC GPIO 0 ~ 21 output data write 1 to set*/ +#define RTC_GPIO_OUT_DATA_W1TS 0x003FFFFF +#define RTC_GPIO_OUT_DATA_W1TS_M ((RTC_GPIO_OUT_DATA_W1TS_V)<<(RTC_GPIO_OUT_DATA_W1TS_S)) +#define RTC_GPIO_OUT_DATA_W1TS_V 0x3FFFFF +#define RTC_GPIO_OUT_DATA_W1TS_S 10 + +#define RTC_GPIO_OUT_W1TC_REG (DR_REG_RTCIO_BASE + 0x8) +/* RTC_GPIO_OUT_DATA_W1TC : WO ;bitpos:[31:10] ;default: 0 ; */ +/*description: RTC GPIO 0 ~ 21 output data write 1 to clear*/ +#define RTC_GPIO_OUT_DATA_W1TC 0x003FFFFF +#define RTC_GPIO_OUT_DATA_W1TC_M ((RTC_GPIO_OUT_DATA_W1TC_V)<<(RTC_GPIO_OUT_DATA_W1TC_S)) +#define RTC_GPIO_OUT_DATA_W1TC_V 0x3FFFFF +#define RTC_GPIO_OUT_DATA_W1TC_S 10 + +#define RTC_GPIO_ENABLE_REG (DR_REG_RTCIO_BASE + 0xC) +/* RTC_GPIO_ENABLE : R/W ;bitpos:[31:10] ;default: 0 ; */ +/*description: RTC GPIO 0 ~ 21 enable*/ +#define RTC_GPIO_ENABLE 0x003FFFFF +#define RTC_GPIO_ENABLE_M ((RTC_GPIO_ENABLE_V)<<(RTC_GPIO_ENABLE_S)) +#define RTC_GPIO_ENABLE_V 0x3FFFFF +#define RTC_GPIO_ENABLE_S 10 + +#define RTC_GPIO_ENABLE_W1TS_REG (DR_REG_RTCIO_BASE + 0x10) +/* RTC_GPIO_ENABLE_W1TS : WO ;bitpos:[31:10] ;default: 0 ; */ +/*description: RTC GPIO 0 ~ 21 enable write 1 to set*/ +#define RTC_GPIO_ENABLE_W1TS 0x003FFFFF +#define RTC_GPIO_ENABLE_W1TS_M ((RTC_GPIO_ENABLE_W1TS_V)<<(RTC_GPIO_ENABLE_W1TS_S)) +#define RTC_GPIO_ENABLE_W1TS_V 0x3FFFFF +#define RTC_GPIO_ENABLE_W1TS_S 10 + +#define RTC_GPIO_ENABLE_W1TC_REG (DR_REG_RTCIO_BASE + 0x14) +/* RTC_GPIO_ENABLE_W1TC : WO ;bitpos:[31:10] ;default: 0 ; */ +/*description: RTC GPIO 0 ~ 21 enable write 1 to clear*/ +#define RTC_GPIO_ENABLE_W1TC 0x003FFFFF +#define RTC_GPIO_ENABLE_W1TC_M ((RTC_GPIO_ENABLE_W1TC_V)<<(RTC_GPIO_ENABLE_W1TC_S)) +#define RTC_GPIO_ENABLE_W1TC_V 0x3FFFFF +#define RTC_GPIO_ENABLE_W1TC_S 10 + +#define RTC_GPIO_STATUS_REG (DR_REG_RTCIO_BASE + 0x18) +/* RTC_GPIO_STATUS_INT : R/W ;bitpos:[31:10] ;default: 0 ; */ +/*description: RTC GPIO 0 ~ 21 interrupt status*/ +#define RTC_GPIO_STATUS_INT 0x003FFFFF +#define RTC_GPIO_STATUS_INT_M ((RTC_GPIO_STATUS_INT_V)<<(RTC_GPIO_STATUS_INT_S)) +#define RTC_GPIO_STATUS_INT_V 0x3FFFFF +#define RTC_GPIO_STATUS_INT_S 10 + +#define RTC_GPIO_STATUS_W1TS_REG (DR_REG_RTCIO_BASE + 0x1C) +/* RTC_GPIO_STATUS_INT_W1TS : WO ;bitpos:[31:10] ;default: 0 ; */ +/*description: RTC GPIO 0 ~ 21 interrupt status write 1 to set*/ +#define RTC_GPIO_STATUS_INT_W1TS 0x003FFFFF +#define RTC_GPIO_STATUS_INT_W1TS_M ((RTC_GPIO_STATUS_INT_W1TS_V)<<(RTC_GPIO_STATUS_INT_W1TS_S)) +#define RTC_GPIO_STATUS_INT_W1TS_V 0x3FFFFF +#define RTC_GPIO_STATUS_INT_W1TS_S 10 + +#define RTC_GPIO_STATUS_W1TC_REG (DR_REG_RTCIO_BASE + 0x20) +/* RTC_GPIO_STATUS_INT_W1TC : WO ;bitpos:[31:10] ;default: 0 ; */ +/*description: RTC GPIO 0 ~ 21 interrupt status write 1 to clear*/ +#define RTC_GPIO_STATUS_INT_W1TC 0x003FFFFF +#define RTC_GPIO_STATUS_INT_W1TC_M ((RTC_GPIO_STATUS_INT_W1TC_V)<<(RTC_GPIO_STATUS_INT_W1TC_S)) +#define RTC_GPIO_STATUS_INT_W1TC_V 0x3FFFFF +#define RTC_GPIO_STATUS_INT_W1TC_S 10 + +#define RTC_GPIO_IN_REG (DR_REG_RTCIO_BASE + 0x24) +/* RTC_GPIO_IN_NEXT : RO ;bitpos:[31:10] ;default: ; */ +/*description: RTC GPIO input data*/ +#define RTC_GPIO_IN_NEXT 0x003FFFFF +#define RTC_GPIO_IN_NEXT_M ((RTC_GPIO_IN_NEXT_V)<<(RTC_GPIO_IN_NEXT_S)) +#define RTC_GPIO_IN_NEXT_V 0x3FFFFF +#define RTC_GPIO_IN_NEXT_S 10 + +#define RTC_GPIO_PIN0_REG (DR_REG_RTCIO_BASE + 0x28) +/* RTC_GPIO_PIN0_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN0_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN0_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN0_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN0_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN0_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN0_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN0_INT_TYPE_M ((RTC_GPIO_PIN0_INT_TYPE_V)<<(RTC_GPIO_PIN0_INT_TYPE_S)) +#define RTC_GPIO_PIN0_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN0_INT_TYPE_S 7 +/* RTC_GPIO_PIN0_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN0_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN0_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN0_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN0_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN1_REG (DR_REG_RTCIO_BASE + 0x2C) +/* RTC_GPIO_PIN1_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN1_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN1_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN1_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN1_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN1_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN1_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN1_INT_TYPE_M ((RTC_GPIO_PIN1_INT_TYPE_V)<<(RTC_GPIO_PIN1_INT_TYPE_S)) +#define RTC_GPIO_PIN1_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN1_INT_TYPE_S 7 +/* RTC_GPIO_PIN1_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN1_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN1_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN1_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN1_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN2_REG (DR_REG_RTCIO_BASE + 0x30) +/* RTC_GPIO_PIN2_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN2_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN2_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN2_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN2_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN2_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN2_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN2_INT_TYPE_M ((RTC_GPIO_PIN2_INT_TYPE_V)<<(RTC_GPIO_PIN2_INT_TYPE_S)) +#define RTC_GPIO_PIN2_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN2_INT_TYPE_S 7 +/* RTC_GPIO_PIN2_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN2_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN2_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN2_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN2_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN3_REG (DR_REG_RTCIO_BASE + 0x34) +/* RTC_GPIO_PIN3_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN3_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN3_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN3_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN3_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN3_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN3_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN3_INT_TYPE_M ((RTC_GPIO_PIN3_INT_TYPE_V)<<(RTC_GPIO_PIN3_INT_TYPE_S)) +#define RTC_GPIO_PIN3_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN3_INT_TYPE_S 7 +/* RTC_GPIO_PIN3_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN3_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN3_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN3_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN3_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN4_REG (DR_REG_RTCIO_BASE + 0x38) +/* RTC_GPIO_PIN4_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN4_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN4_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN4_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN4_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN4_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN4_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN4_INT_TYPE_M ((RTC_GPIO_PIN4_INT_TYPE_V)<<(RTC_GPIO_PIN4_INT_TYPE_S)) +#define RTC_GPIO_PIN4_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN4_INT_TYPE_S 7 +/* RTC_GPIO_PIN4_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN4_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN4_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN4_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN4_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN5_REG (DR_REG_RTCIO_BASE + 0x3C) +/* RTC_GPIO_PIN5_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN5_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN5_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN5_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN5_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN5_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN5_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN5_INT_TYPE_M ((RTC_GPIO_PIN5_INT_TYPE_V)<<(RTC_GPIO_PIN5_INT_TYPE_S)) +#define RTC_GPIO_PIN5_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN5_INT_TYPE_S 7 +/* RTC_GPIO_PIN5_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN5_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN5_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN5_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN5_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN6_REG (DR_REG_RTCIO_BASE + 0x40) +/* RTC_GPIO_PIN6_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN6_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN6_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN6_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN6_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN6_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN6_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN6_INT_TYPE_M ((RTC_GPIO_PIN6_INT_TYPE_V)<<(RTC_GPIO_PIN6_INT_TYPE_S)) +#define RTC_GPIO_PIN6_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN6_INT_TYPE_S 7 +/* RTC_GPIO_PIN6_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN6_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN6_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN6_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN6_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN7_REG (DR_REG_RTCIO_BASE + 0x44) +/* RTC_GPIO_PIN7_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN7_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN7_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN7_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN7_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN7_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN7_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN7_INT_TYPE_M ((RTC_GPIO_PIN7_INT_TYPE_V)<<(RTC_GPIO_PIN7_INT_TYPE_S)) +#define RTC_GPIO_PIN7_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN7_INT_TYPE_S 7 +/* RTC_GPIO_PIN7_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN7_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN7_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN7_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN7_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN8_REG (DR_REG_RTCIO_BASE + 0x48) +/* RTC_GPIO_PIN8_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN8_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN8_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN8_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN8_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN8_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN8_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN8_INT_TYPE_M ((RTC_GPIO_PIN8_INT_TYPE_V)<<(RTC_GPIO_PIN8_INT_TYPE_S)) +#define RTC_GPIO_PIN8_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN8_INT_TYPE_S 7 +/* RTC_GPIO_PIN8_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN8_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN8_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN8_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN8_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN9_REG (DR_REG_RTCIO_BASE + 0x4C) +/* RTC_GPIO_PIN9_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN9_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN9_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN9_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN9_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN9_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN9_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN9_INT_TYPE_M ((RTC_GPIO_PIN9_INT_TYPE_V)<<(RTC_GPIO_PIN9_INT_TYPE_S)) +#define RTC_GPIO_PIN9_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN9_INT_TYPE_S 7 +/* RTC_GPIO_PIN9_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN9_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN9_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN9_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN9_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN10_REG (DR_REG_RTCIO_BASE + 0x50) +/* RTC_GPIO_PIN10_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN10_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN10_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN10_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN10_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN10_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN10_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN10_INT_TYPE_M ((RTC_GPIO_PIN10_INT_TYPE_V)<<(RTC_GPIO_PIN10_INT_TYPE_S)) +#define RTC_GPIO_PIN10_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN10_INT_TYPE_S 7 +/* RTC_GPIO_PIN10_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN10_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN10_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN10_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN10_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN11_REG (DR_REG_RTCIO_BASE + 0x54) +/* RTC_GPIO_PIN11_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN11_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN11_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN11_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN11_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN11_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN11_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN11_INT_TYPE_M ((RTC_GPIO_PIN11_INT_TYPE_V)<<(RTC_GPIO_PIN11_INT_TYPE_S)) +#define RTC_GPIO_PIN11_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN11_INT_TYPE_S 7 +/* RTC_GPIO_PIN11_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN11_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN11_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN11_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN11_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN12_REG (DR_REG_RTCIO_BASE + 0x58) +/* RTC_GPIO_PIN12_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN12_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN12_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN12_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN12_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN12_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN12_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN12_INT_TYPE_M ((RTC_GPIO_PIN12_INT_TYPE_V)<<(RTC_GPIO_PIN12_INT_TYPE_S)) +#define RTC_GPIO_PIN12_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN12_INT_TYPE_S 7 +/* RTC_GPIO_PIN12_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN12_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN12_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN12_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN12_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN13_REG (DR_REG_RTCIO_BASE + 0x5C) +/* RTC_GPIO_PIN13_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN13_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN13_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN13_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN13_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN13_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN13_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN13_INT_TYPE_M ((RTC_GPIO_PIN13_INT_TYPE_V)<<(RTC_GPIO_PIN13_INT_TYPE_S)) +#define RTC_GPIO_PIN13_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN13_INT_TYPE_S 7 +/* RTC_GPIO_PIN13_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN13_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN13_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN13_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN13_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN14_REG (DR_REG_RTCIO_BASE + 0x60) +/* RTC_GPIO_PIN14_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN14_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN14_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN14_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN14_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN14_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN14_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN14_INT_TYPE_M ((RTC_GPIO_PIN14_INT_TYPE_V)<<(RTC_GPIO_PIN14_INT_TYPE_S)) +#define RTC_GPIO_PIN14_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN14_INT_TYPE_S 7 +/* RTC_GPIO_PIN14_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN14_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN14_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN14_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN14_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN15_REG (DR_REG_RTCIO_BASE + 0x64) +/* RTC_GPIO_PIN15_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN15_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN15_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN15_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN15_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN15_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN15_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN15_INT_TYPE_M ((RTC_GPIO_PIN15_INT_TYPE_V)<<(RTC_GPIO_PIN15_INT_TYPE_S)) +#define RTC_GPIO_PIN15_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN15_INT_TYPE_S 7 +/* RTC_GPIO_PIN15_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN15_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN15_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN15_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN15_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN16_REG (DR_REG_RTCIO_BASE + 0x68) +/* RTC_GPIO_PIN16_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN16_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN16_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN16_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN16_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN16_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN16_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN16_INT_TYPE_M ((RTC_GPIO_PIN16_INT_TYPE_V)<<(RTC_GPIO_PIN16_INT_TYPE_S)) +#define RTC_GPIO_PIN16_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN16_INT_TYPE_S 7 +/* RTC_GPIO_PIN16_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN16_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN16_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN16_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN16_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN17_REG (DR_REG_RTCIO_BASE + 0x6C) +/* RTC_GPIO_PIN17_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN17_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN17_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN17_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN17_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN17_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN17_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN17_INT_TYPE_M ((RTC_GPIO_PIN17_INT_TYPE_V)<<(RTC_GPIO_PIN17_INT_TYPE_S)) +#define RTC_GPIO_PIN17_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN17_INT_TYPE_S 7 +/* RTC_GPIO_PIN17_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN17_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN17_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN17_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN17_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN18_REG (DR_REG_RTCIO_BASE + 0x70) +/* RTC_GPIO_PIN18_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN18_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN18_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN18_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN18_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN18_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN18_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN18_INT_TYPE_M ((RTC_GPIO_PIN18_INT_TYPE_V)<<(RTC_GPIO_PIN18_INT_TYPE_S)) +#define RTC_GPIO_PIN18_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN18_INT_TYPE_S 7 +/* RTC_GPIO_PIN18_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN18_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN18_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN18_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN18_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN19_REG (DR_REG_RTCIO_BASE + 0x74) +/* RTC_GPIO_PIN19_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN19_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN19_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN19_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN19_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN19_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN19_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN19_INT_TYPE_M ((RTC_GPIO_PIN19_INT_TYPE_V)<<(RTC_GPIO_PIN19_INT_TYPE_S)) +#define RTC_GPIO_PIN19_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN19_INT_TYPE_S 7 +/* RTC_GPIO_PIN19_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN19_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN19_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN19_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN19_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN20_REG (DR_REG_RTCIO_BASE + 0x78) +/* RTC_GPIO_PIN20_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN20_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN20_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN20_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN20_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN20_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN20_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN20_INT_TYPE_M ((RTC_GPIO_PIN20_INT_TYPE_V)<<(RTC_GPIO_PIN20_INT_TYPE_S)) +#define RTC_GPIO_PIN20_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN20_INT_TYPE_S 7 +/* RTC_GPIO_PIN20_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN20_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN20_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN20_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN20_PAD_DRIVER_S 2 + +#define RTC_GPIO_PIN21_REG (DR_REG_RTCIO_BASE + 0x7C) +/* RTC_GPIO_PIN21_WAKEUP_ENABLE : R/W ;bitpos:[10] ;default: 0 ; */ +/*description: RTC GPIO wakeup enable bit*/ +#define RTC_GPIO_PIN21_WAKEUP_ENABLE (BIT(10)) +#define RTC_GPIO_PIN21_WAKEUP_ENABLE_M (BIT(10)) +#define RTC_GPIO_PIN21_WAKEUP_ENABLE_V 0x1 +#define RTC_GPIO_PIN21_WAKEUP_ENABLE_S 10 +/* RTC_GPIO_PIN21_INT_TYPE : R/W ;bitpos:[9:7] ;default: 0 ; */ +/*description: if set to 0: GPIO interrupt disable if set to 1: rising edge + trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ +#define RTC_GPIO_PIN21_INT_TYPE 0x00000007 +#define RTC_GPIO_PIN21_INT_TYPE_M ((RTC_GPIO_PIN21_INT_TYPE_V)<<(RTC_GPIO_PIN21_INT_TYPE_S)) +#define RTC_GPIO_PIN21_INT_TYPE_V 0x7 +#define RTC_GPIO_PIN21_INT_TYPE_S 7 +/* RTC_GPIO_PIN21_PAD_DRIVER : R/W ;bitpos:[2] ;default: 0 ; */ +/*description: if set to 0: normal output if set to 1: open drain*/ +#define RTC_GPIO_PIN21_PAD_DRIVER (BIT(2)) +#define RTC_GPIO_PIN21_PAD_DRIVER_M (BIT(2)) +#define RTC_GPIO_PIN21_PAD_DRIVER_V 0x1 +#define RTC_GPIO_PIN21_PAD_DRIVER_S 2 + +#define RTC_IO_RTC_DEBUG_SEL_REG (DR_REG_RTCIO_BASE + 0x80) +/* RTC_IO_DEBUG_12M_NO_GATING : R/W ;bitpos:[25] ;default: 1'd0 ; */ +/*description: */ +#define RTC_IO_DEBUG_12M_NO_GATING (BIT(25)) +#define RTC_IO_DEBUG_12M_NO_GATING_M (BIT(25)) +#define RTC_IO_DEBUG_12M_NO_GATING_V 0x1 +#define RTC_IO_DEBUG_12M_NO_GATING_S 25 +/* RTC_IO_DEBUG_SEL4 : R/W ;bitpos:[24:20] ;default: 5'd0 ; */ +/*description: */ +#define RTC_IO_DEBUG_SEL4 0x0000001F +#define RTC_IO_DEBUG_SEL4_M ((RTC_IO_DEBUG_SEL4_V)<<(RTC_IO_DEBUG_SEL4_S)) +#define RTC_IO_DEBUG_SEL4_V 0x1F +#define RTC_IO_DEBUG_SEL4_S 20 +/* RTC_IO_DEBUG_SEL3 : R/W ;bitpos:[19:15] ;default: 5'd0 ; */ +/*description: */ +#define RTC_IO_DEBUG_SEL3 0x0000001F +#define RTC_IO_DEBUG_SEL3_M ((RTC_IO_DEBUG_SEL3_V)<<(RTC_IO_DEBUG_SEL3_S)) +#define RTC_IO_DEBUG_SEL3_V 0x1F +#define RTC_IO_DEBUG_SEL3_S 15 +/* RTC_IO_DEBUG_SEL2 : R/W ;bitpos:[14:10] ;default: 5'd0 ; */ +/*description: */ +#define RTC_IO_DEBUG_SEL2 0x0000001F +#define RTC_IO_DEBUG_SEL2_M ((RTC_IO_DEBUG_SEL2_V)<<(RTC_IO_DEBUG_SEL2_S)) +#define RTC_IO_DEBUG_SEL2_V 0x1F +#define RTC_IO_DEBUG_SEL2_S 10 +/* RTC_IO_DEBUG_SEL1 : R/W ;bitpos:[9:5] ;default: 5'd0 ; */ +/*description: */ +#define RTC_IO_DEBUG_SEL1 0x0000001F +#define RTC_IO_DEBUG_SEL1_M ((RTC_IO_DEBUG_SEL1_V)<<(RTC_IO_DEBUG_SEL1_S)) +#define RTC_IO_DEBUG_SEL1_V 0x1F +#define RTC_IO_DEBUG_SEL1_S 5 +/* RTC_IO_DEBUG_SEL0 : R/W ;bitpos:[4:0] ;default: 5'd0 ; */ +/*description: */ +#define RTC_IO_DEBUG_SEL0 0x0000001F +#define RTC_IO_DEBUG_SEL0_M ((RTC_IO_DEBUG_SEL0_V)<<(RTC_IO_DEBUG_SEL0_S)) +#define RTC_IO_DEBUG_SEL0_V 0x1F +#define RTC_IO_DEBUG_SEL0_S 0 + +#define RTC_IO_TOUCH_PAD0_REG (DR_REG_RTCIO_BASE + 0x84) +/* RTC_IO_TOUCH_PAD0_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD0_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD0_DRV_M ((RTC_IO_TOUCH_PAD0_DRV_V)<<(RTC_IO_TOUCH_PAD0_DRV_S)) +#define RTC_IO_TOUCH_PAD0_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD0_DRV_S 29 +/* RTC_IO_TOUCH_PAD0_RDE : R/W ;bitpos:[28] ;default: 1'd1 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD0_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD0_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD0_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD0_RDE_S 28 +/* RTC_IO_TOUCH_PAD0_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD0_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD0_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD0_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD0_RUE_S 27 +/* RTC_IO_TOUCH_PAD0_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD0_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD0_DAC_M ((RTC_IO_TOUCH_PAD0_DAC_V)<<(RTC_IO_TOUCH_PAD0_DAC_S)) +#define RTC_IO_TOUCH_PAD0_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD0_DAC_S 23 +/* RTC_IO_TOUCH_PAD0_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD0_START (BIT(22)) +#define RTC_IO_TOUCH_PAD0_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD0_START_V 0x1 +#define RTC_IO_TOUCH_PAD0_START_S 22 +/* RTC_IO_TOUCH_PAD0_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD0_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD0_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD0_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD0_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD0_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD0_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD0_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD0_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD0_XPD_S 20 +/* RTC_IO_TOUCH_PAD0_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD0_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD0_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD0_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD0_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD0_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD0_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD0_FUN_SEL_M ((RTC_IO_TOUCH_PAD0_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD0_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD0_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD0_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD0_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD0_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD0_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD0_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD0_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD0_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD0_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD0_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD0_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD0_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD0_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD0_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD0_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD0_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD0_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD0_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD0_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD0_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD0_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD0_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD1_REG (DR_REG_RTCIO_BASE + 0x88) +/* RTC_IO_TOUCH_PAD1_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD1_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD1_DRV_M ((RTC_IO_TOUCH_PAD1_DRV_V)<<(RTC_IO_TOUCH_PAD1_DRV_S)) +#define RTC_IO_TOUCH_PAD1_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD1_DRV_S 29 +/* RTC_IO_TOUCH_PAD1_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD1_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD1_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD1_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD1_RDE_S 28 +/* RTC_IO_TOUCH_PAD1_RUE : R/W ;bitpos:[27] ;default: 1'd1 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD1_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD1_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD1_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD1_RUE_S 27 +/* RTC_IO_TOUCH_PAD1_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD1_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD1_DAC_M ((RTC_IO_TOUCH_PAD1_DAC_V)<<(RTC_IO_TOUCH_PAD1_DAC_S)) +#define RTC_IO_TOUCH_PAD1_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD1_DAC_S 23 +/* RTC_IO_TOUCH_PAD1_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD1_START (BIT(22)) +#define RTC_IO_TOUCH_PAD1_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD1_START_V 0x1 +#define RTC_IO_TOUCH_PAD1_START_S 22 +/* RTC_IO_TOUCH_PAD1_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD1_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD1_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD1_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD1_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD1_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD1_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD1_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD1_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD1_XPD_S 20 +/* RTC_IO_TOUCH_PAD1_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD1_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD1_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD1_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD1_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD1_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD1_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD1_FUN_SEL_M ((RTC_IO_TOUCH_PAD1_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD1_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD1_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD1_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD1_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD1_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD1_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD1_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD1_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD1_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD1_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD1_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD1_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD1_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD1_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD1_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD1_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD1_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD1_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD1_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD1_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD1_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD1_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD1_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD2_REG (DR_REG_RTCIO_BASE + 0x8C) +/* RTC_IO_TOUCH_PAD2_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD2_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD2_DRV_M ((RTC_IO_TOUCH_PAD2_DRV_V)<<(RTC_IO_TOUCH_PAD2_DRV_S)) +#define RTC_IO_TOUCH_PAD2_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD2_DRV_S 29 +/* RTC_IO_TOUCH_PAD2_RDE : R/W ;bitpos:[28] ;default: 1'd1 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD2_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD2_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD2_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD2_RDE_S 28 +/* RTC_IO_TOUCH_PAD2_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD2_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD2_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD2_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD2_RUE_S 27 +/* RTC_IO_TOUCH_PAD2_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD2_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD2_DAC_M ((RTC_IO_TOUCH_PAD2_DAC_V)<<(RTC_IO_TOUCH_PAD2_DAC_S)) +#define RTC_IO_TOUCH_PAD2_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD2_DAC_S 23 +/* RTC_IO_TOUCH_PAD2_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD2_START (BIT(22)) +#define RTC_IO_TOUCH_PAD2_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD2_START_V 0x1 +#define RTC_IO_TOUCH_PAD2_START_S 22 +/* RTC_IO_TOUCH_PAD2_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD2_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD2_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD2_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD2_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD2_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD2_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD2_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD2_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD2_XPD_S 20 +/* RTC_IO_TOUCH_PAD2_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD2_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD2_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD2_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD2_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD2_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD2_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD2_FUN_SEL_M ((RTC_IO_TOUCH_PAD2_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD2_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD2_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD2_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD2_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD2_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD2_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD2_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD2_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD2_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD2_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD2_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD2_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD2_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD2_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD2_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD2_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD2_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD2_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD2_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD2_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD2_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD2_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD2_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD3_REG (DR_REG_RTCIO_BASE + 0x90) +/* RTC_IO_TOUCH_PAD3_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD3_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD3_DRV_M ((RTC_IO_TOUCH_PAD3_DRV_V)<<(RTC_IO_TOUCH_PAD3_DRV_S)) +#define RTC_IO_TOUCH_PAD3_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD3_DRV_S 29 +/* RTC_IO_TOUCH_PAD3_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD3_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD3_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD3_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD3_RDE_S 28 +/* RTC_IO_TOUCH_PAD3_RUE : R/W ;bitpos:[27] ;default: 1'd1 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD3_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD3_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD3_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD3_RUE_S 27 +/* RTC_IO_TOUCH_PAD3_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD3_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD3_DAC_M ((RTC_IO_TOUCH_PAD3_DAC_V)<<(RTC_IO_TOUCH_PAD3_DAC_S)) +#define RTC_IO_TOUCH_PAD3_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD3_DAC_S 23 +/* RTC_IO_TOUCH_PAD3_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD3_START (BIT(22)) +#define RTC_IO_TOUCH_PAD3_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD3_START_V 0x1 +#define RTC_IO_TOUCH_PAD3_START_S 22 +/* RTC_IO_TOUCH_PAD3_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD3_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD3_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD3_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD3_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD3_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD3_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD3_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD3_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD3_XPD_S 20 +/* RTC_IO_TOUCH_PAD3_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD3_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD3_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD3_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD3_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD3_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD3_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD3_FUN_SEL_M ((RTC_IO_TOUCH_PAD3_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD3_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD3_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD3_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD3_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD3_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD3_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD3_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD3_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD3_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD3_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD3_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD3_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD3_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD3_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD3_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD3_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD3_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD3_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD3_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD3_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD3_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD3_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD3_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD4_REG (DR_REG_RTCIO_BASE + 0x94) +/* RTC_IO_TOUCH_PAD4_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD4_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD4_DRV_M ((RTC_IO_TOUCH_PAD4_DRV_V)<<(RTC_IO_TOUCH_PAD4_DRV_S)) +#define RTC_IO_TOUCH_PAD4_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD4_DRV_S 29 +/* RTC_IO_TOUCH_PAD4_RDE : R/W ;bitpos:[28] ;default: 1'd1 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD4_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD4_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD4_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD4_RDE_S 28 +/* RTC_IO_TOUCH_PAD4_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD4_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD4_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD4_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD4_RUE_S 27 +/* RTC_IO_TOUCH_PAD4_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD4_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD4_DAC_M ((RTC_IO_TOUCH_PAD4_DAC_V)<<(RTC_IO_TOUCH_PAD4_DAC_S)) +#define RTC_IO_TOUCH_PAD4_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD4_DAC_S 23 +/* RTC_IO_TOUCH_PAD4_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD4_START (BIT(22)) +#define RTC_IO_TOUCH_PAD4_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD4_START_V 0x1 +#define RTC_IO_TOUCH_PAD4_START_S 22 +/* RTC_IO_TOUCH_PAD4_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD4_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD4_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD4_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD4_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD4_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD4_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD4_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD4_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD4_XPD_S 20 +/* RTC_IO_TOUCH_PAD4_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD4_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD4_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD4_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD4_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD4_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD4_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD4_FUN_SEL_M ((RTC_IO_TOUCH_PAD4_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD4_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD4_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD4_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD4_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD4_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD4_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD4_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD4_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD4_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD4_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD4_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD4_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD4_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD4_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD4_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD4_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD4_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD4_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD4_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD4_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD4_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD4_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD4_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD5_REG (DR_REG_RTCIO_BASE + 0x98) +/* RTC_IO_TOUCH_PAD5_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD5_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD5_DRV_M ((RTC_IO_TOUCH_PAD5_DRV_V)<<(RTC_IO_TOUCH_PAD5_DRV_S)) +#define RTC_IO_TOUCH_PAD5_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD5_DRV_S 29 +/* RTC_IO_TOUCH_PAD5_RDE : R/W ;bitpos:[28] ;default: 1'd1 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD5_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD5_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD5_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD5_RDE_S 28 +/* RTC_IO_TOUCH_PAD5_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD5_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD5_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD5_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD5_RUE_S 27 +/* RTC_IO_TOUCH_PAD5_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD5_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD5_DAC_M ((RTC_IO_TOUCH_PAD5_DAC_V)<<(RTC_IO_TOUCH_PAD5_DAC_S)) +#define RTC_IO_TOUCH_PAD5_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD5_DAC_S 23 +/* RTC_IO_TOUCH_PAD5_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD5_START (BIT(22)) +#define RTC_IO_TOUCH_PAD5_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD5_START_V 0x1 +#define RTC_IO_TOUCH_PAD5_START_S 22 +/* RTC_IO_TOUCH_PAD5_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD5_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD5_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD5_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD5_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD5_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD5_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD5_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD5_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD5_XPD_S 20 +/* RTC_IO_TOUCH_PAD5_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD5_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD5_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD5_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD5_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD5_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD5_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD5_FUN_SEL_M ((RTC_IO_TOUCH_PAD5_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD5_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD5_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD5_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD5_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD5_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD5_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD5_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD5_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD5_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD5_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD5_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD5_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD5_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD5_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD5_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD5_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD5_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD5_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD5_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD5_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD5_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD5_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD5_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD6_REG (DR_REG_RTCIO_BASE + 0x9C) +/* RTC_IO_TOUCH_PAD6_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD6_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD6_DRV_M ((RTC_IO_TOUCH_PAD6_DRV_V)<<(RTC_IO_TOUCH_PAD6_DRV_S)) +#define RTC_IO_TOUCH_PAD6_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD6_DRV_S 29 +/* RTC_IO_TOUCH_PAD6_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD6_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD6_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD6_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD6_RDE_S 28 +/* RTC_IO_TOUCH_PAD6_RUE : R/W ;bitpos:[27] ;default: 1'd1 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD6_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD6_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD6_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD6_RUE_S 27 +/* RTC_IO_TOUCH_PAD6_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD6_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD6_DAC_M ((RTC_IO_TOUCH_PAD6_DAC_V)<<(RTC_IO_TOUCH_PAD6_DAC_S)) +#define RTC_IO_TOUCH_PAD6_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD6_DAC_S 23 +/* RTC_IO_TOUCH_PAD6_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD6_START (BIT(22)) +#define RTC_IO_TOUCH_PAD6_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD6_START_V 0x1 +#define RTC_IO_TOUCH_PAD6_START_S 22 +/* RTC_IO_TOUCH_PAD6_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD6_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD6_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD6_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD6_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD6_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD6_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD6_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD6_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD6_XPD_S 20 +/* RTC_IO_TOUCH_PAD6_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD6_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD6_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD6_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD6_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD6_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD6_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD6_FUN_SEL_M ((RTC_IO_TOUCH_PAD6_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD6_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD6_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD6_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD6_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD6_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD6_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD6_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD6_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD6_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD6_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD6_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD6_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD6_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD6_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD6_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD6_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD6_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD6_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD6_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD6_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD6_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD6_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD6_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD7_REG (DR_REG_RTCIO_BASE + 0xA0) +/* RTC_IO_TOUCH_PAD7_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD7_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD7_DRV_M ((RTC_IO_TOUCH_PAD7_DRV_V)<<(RTC_IO_TOUCH_PAD7_DRV_S)) +#define RTC_IO_TOUCH_PAD7_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD7_DRV_S 29 +/* RTC_IO_TOUCH_PAD7_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD7_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD7_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD7_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD7_RDE_S 28 +/* RTC_IO_TOUCH_PAD7_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD7_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD7_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD7_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD7_RUE_S 27 +/* RTC_IO_TOUCH_PAD7_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD7_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD7_DAC_M ((RTC_IO_TOUCH_PAD7_DAC_V)<<(RTC_IO_TOUCH_PAD7_DAC_S)) +#define RTC_IO_TOUCH_PAD7_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD7_DAC_S 23 +/* RTC_IO_TOUCH_PAD7_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD7_START (BIT(22)) +#define RTC_IO_TOUCH_PAD7_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD7_START_V 0x1 +#define RTC_IO_TOUCH_PAD7_START_S 22 +/* RTC_IO_TOUCH_PAD7_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD7_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD7_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD7_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD7_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD7_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD7_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD7_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD7_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD7_XPD_S 20 +/* RTC_IO_TOUCH_PAD7_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD7_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD7_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD7_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD7_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD7_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD7_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD7_FUN_SEL_M ((RTC_IO_TOUCH_PAD7_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD7_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD7_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD7_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD7_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD7_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD7_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD7_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD7_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD7_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD7_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD7_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD7_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD7_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD7_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD7_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD7_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD7_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD7_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD7_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD7_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD7_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD7_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD7_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD8_REG (DR_REG_RTCIO_BASE + 0xA4) +/* RTC_IO_TOUCH_PAD8_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD8_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD8_DRV_M ((RTC_IO_TOUCH_PAD8_DRV_V)<<(RTC_IO_TOUCH_PAD8_DRV_S)) +#define RTC_IO_TOUCH_PAD8_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD8_DRV_S 29 +/* RTC_IO_TOUCH_PAD8_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD8_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD8_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD8_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD8_RDE_S 28 +/* RTC_IO_TOUCH_PAD8_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD8_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD8_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD8_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD8_RUE_S 27 +/* RTC_IO_TOUCH_PAD8_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD8_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD8_DAC_M ((RTC_IO_TOUCH_PAD8_DAC_V)<<(RTC_IO_TOUCH_PAD8_DAC_S)) +#define RTC_IO_TOUCH_PAD8_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD8_DAC_S 23 +/* RTC_IO_TOUCH_PAD8_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD8_START (BIT(22)) +#define RTC_IO_TOUCH_PAD8_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD8_START_V 0x1 +#define RTC_IO_TOUCH_PAD8_START_S 22 +/* RTC_IO_TOUCH_PAD8_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD8_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD8_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD8_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD8_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD8_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD8_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD8_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD8_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD8_XPD_S 20 +/* RTC_IO_TOUCH_PAD8_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD8_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD8_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD8_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD8_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD8_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD8_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD8_FUN_SEL_M ((RTC_IO_TOUCH_PAD8_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD8_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD8_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD8_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD8_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD8_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD8_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD8_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD8_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD8_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD8_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD8_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD8_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD8_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD8_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD8_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD8_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD8_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD8_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD8_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD8_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD8_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD8_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD8_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD9_REG (DR_REG_RTCIO_BASE + 0xA8) +/* RTC_IO_TOUCH_PAD9_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD9_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD9_DRV_M ((RTC_IO_TOUCH_PAD9_DRV_V)<<(RTC_IO_TOUCH_PAD9_DRV_S)) +#define RTC_IO_TOUCH_PAD9_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD9_DRV_S 29 +/* RTC_IO_TOUCH_PAD9_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD9_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD9_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD9_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD9_RDE_S 28 +/* RTC_IO_TOUCH_PAD9_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD9_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD9_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD9_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD9_RUE_S 27 +/* RTC_IO_TOUCH_PAD9_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD9_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD9_DAC_M ((RTC_IO_TOUCH_PAD9_DAC_V)<<(RTC_IO_TOUCH_PAD9_DAC_S)) +#define RTC_IO_TOUCH_PAD9_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD9_DAC_S 23 +/* RTC_IO_TOUCH_PAD9_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD9_START (BIT(22)) +#define RTC_IO_TOUCH_PAD9_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD9_START_V 0x1 +#define RTC_IO_TOUCH_PAD9_START_S 22 +/* RTC_IO_TOUCH_PAD9_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD9_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD9_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD9_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD9_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD9_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD9_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD9_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD9_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD9_XPD_S 20 +/* RTC_IO_TOUCH_PAD9_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD9_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD9_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD9_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD9_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD9_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD9_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD9_FUN_SEL_M ((RTC_IO_TOUCH_PAD9_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD9_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD9_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD9_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD9_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD9_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD9_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD9_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD9_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD9_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD9_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD9_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD9_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD9_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD9_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD9_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD9_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD9_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD9_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD9_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD9_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD9_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD9_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD9_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD10_REG (DR_REG_RTCIO_BASE + 0xAC) +/* RTC_IO_TOUCH_PAD10_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD10_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD10_DRV_M ((RTC_IO_TOUCH_PAD10_DRV_V)<<(RTC_IO_TOUCH_PAD10_DRV_S)) +#define RTC_IO_TOUCH_PAD10_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD10_DRV_S 29 +/* RTC_IO_TOUCH_PAD10_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD10_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD10_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD10_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD10_RDE_S 28 +/* RTC_IO_TOUCH_PAD10_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD10_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD10_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD10_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD10_RUE_S 27 +/* RTC_IO_TOUCH_PAD10_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD10_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD10_DAC_M ((RTC_IO_TOUCH_PAD10_DAC_V)<<(RTC_IO_TOUCH_PAD10_DAC_S)) +#define RTC_IO_TOUCH_PAD10_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD10_DAC_S 23 +/* RTC_IO_TOUCH_PAD10_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD10_START (BIT(22)) +#define RTC_IO_TOUCH_PAD10_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD10_START_V 0x1 +#define RTC_IO_TOUCH_PAD10_START_S 22 +/* RTC_IO_TOUCH_PAD10_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD10_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD10_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD10_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD10_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD10_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD10_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD10_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD10_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD10_XPD_S 20 +/* RTC_IO_TOUCH_PAD10_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD10_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD10_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD10_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD10_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD10_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD10_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD10_FUN_SEL_M ((RTC_IO_TOUCH_PAD10_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD10_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD10_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD10_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD10_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD10_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD10_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD10_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD10_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD10_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD10_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD10_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD10_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD10_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD10_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD10_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD10_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD10_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD10_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD10_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD10_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD10_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD10_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD10_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD11_REG (DR_REG_RTCIO_BASE + 0xB0) +/* RTC_IO_TOUCH_PAD11_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD11_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD11_DRV_M ((RTC_IO_TOUCH_PAD11_DRV_V)<<(RTC_IO_TOUCH_PAD11_DRV_S)) +#define RTC_IO_TOUCH_PAD11_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD11_DRV_S 29 +/* RTC_IO_TOUCH_PAD11_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD11_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD11_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD11_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD11_RDE_S 28 +/* RTC_IO_TOUCH_PAD11_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD11_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD11_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD11_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD11_RUE_S 27 +/* RTC_IO_TOUCH_PAD11_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD11_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD11_DAC_M ((RTC_IO_TOUCH_PAD11_DAC_V)<<(RTC_IO_TOUCH_PAD11_DAC_S)) +#define RTC_IO_TOUCH_PAD11_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD11_DAC_S 23 +/* RTC_IO_TOUCH_PAD11_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD11_START (BIT(22)) +#define RTC_IO_TOUCH_PAD11_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD11_START_V 0x1 +#define RTC_IO_TOUCH_PAD11_START_S 22 +/* RTC_IO_TOUCH_PAD11_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD11_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD11_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD11_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD11_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD11_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD11_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD11_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD11_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD11_XPD_S 20 +/* RTC_IO_TOUCH_PAD11_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD11_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD11_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD11_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD11_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD11_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD11_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD11_FUN_SEL_M ((RTC_IO_TOUCH_PAD11_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD11_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD11_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD11_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD11_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD11_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD11_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD11_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD11_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD11_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD11_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD11_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD11_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD11_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD11_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD11_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD11_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD11_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD11_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD11_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD11_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD11_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD11_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD11_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD12_REG (DR_REG_RTCIO_BASE + 0xB4) +/* RTC_IO_TOUCH_PAD12_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD12_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD12_DRV_M ((RTC_IO_TOUCH_PAD12_DRV_V)<<(RTC_IO_TOUCH_PAD12_DRV_S)) +#define RTC_IO_TOUCH_PAD12_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD12_DRV_S 29 +/* RTC_IO_TOUCH_PAD12_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD12_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD12_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD12_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD12_RDE_S 28 +/* RTC_IO_TOUCH_PAD12_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD12_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD12_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD12_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD12_RUE_S 27 +/* RTC_IO_TOUCH_PAD12_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD12_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD12_DAC_M ((RTC_IO_TOUCH_PAD12_DAC_V)<<(RTC_IO_TOUCH_PAD12_DAC_S)) +#define RTC_IO_TOUCH_PAD12_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD12_DAC_S 23 +/* RTC_IO_TOUCH_PAD12_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD12_START (BIT(22)) +#define RTC_IO_TOUCH_PAD12_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD12_START_V 0x1 +#define RTC_IO_TOUCH_PAD12_START_S 22 +/* RTC_IO_TOUCH_PAD12_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD12_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD12_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD12_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD12_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD12_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD12_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD12_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD12_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD12_XPD_S 20 +/* RTC_IO_TOUCH_PAD12_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD12_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD12_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD12_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD12_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD12_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD12_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD12_FUN_SEL_M ((RTC_IO_TOUCH_PAD12_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD12_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD12_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD12_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD12_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD12_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD12_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD12_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD12_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD12_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD12_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD12_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD12_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD12_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD12_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD12_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD12_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD12_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD12_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD12_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD12_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD12_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD12_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD12_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD13_REG (DR_REG_RTCIO_BASE + 0xB8) +/* RTC_IO_TOUCH_PAD13_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD13_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD13_DRV_M ((RTC_IO_TOUCH_PAD13_DRV_V)<<(RTC_IO_TOUCH_PAD13_DRV_S)) +#define RTC_IO_TOUCH_PAD13_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD13_DRV_S 29 +/* RTC_IO_TOUCH_PAD13_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD13_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD13_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD13_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD13_RDE_S 28 +/* RTC_IO_TOUCH_PAD13_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD13_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD13_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD13_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD13_RUE_S 27 +/* RTC_IO_TOUCH_PAD13_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD13_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD13_DAC_M ((RTC_IO_TOUCH_PAD13_DAC_V)<<(RTC_IO_TOUCH_PAD13_DAC_S)) +#define RTC_IO_TOUCH_PAD13_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD13_DAC_S 23 +/* RTC_IO_TOUCH_PAD13_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD13_START (BIT(22)) +#define RTC_IO_TOUCH_PAD13_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD13_START_V 0x1 +#define RTC_IO_TOUCH_PAD13_START_S 22 +/* RTC_IO_TOUCH_PAD13_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD13_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD13_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD13_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD13_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD13_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD13_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD13_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD13_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD13_XPD_S 20 +/* RTC_IO_TOUCH_PAD13_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD13_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD13_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD13_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD13_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD13_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD13_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD13_FUN_SEL_M ((RTC_IO_TOUCH_PAD13_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD13_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD13_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD13_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD13_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD13_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD13_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD13_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD13_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD13_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD13_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD13_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD13_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD13_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD13_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD13_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD13_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD13_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD13_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD13_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD13_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD13_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD13_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD13_FUN_IE_S 13 + +#define RTC_IO_TOUCH_PAD14_REG (DR_REG_RTCIO_BASE + 0xBC) +/* RTC_IO_TOUCH_PAD14_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_TOUCH_PAD14_DRV 0x00000003 +#define RTC_IO_TOUCH_PAD14_DRV_M ((RTC_IO_TOUCH_PAD14_DRV_V)<<(RTC_IO_TOUCH_PAD14_DRV_S)) +#define RTC_IO_TOUCH_PAD14_DRV_V 0x3 +#define RTC_IO_TOUCH_PAD14_DRV_S 29 +/* RTC_IO_TOUCH_PAD14_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_TOUCH_PAD14_RDE (BIT(28)) +#define RTC_IO_TOUCH_PAD14_RDE_M (BIT(28)) +#define RTC_IO_TOUCH_PAD14_RDE_V 0x1 +#define RTC_IO_TOUCH_PAD14_RDE_S 28 +/* RTC_IO_TOUCH_PAD14_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_TOUCH_PAD14_RUE (BIT(27)) +#define RTC_IO_TOUCH_PAD14_RUE_M (BIT(27)) +#define RTC_IO_TOUCH_PAD14_RUE_V 0x1 +#define RTC_IO_TOUCH_PAD14_RUE_S 27 +/* RTC_IO_TOUCH_PAD14_DAC : R/W ;bitpos:[25:23] ;default: 3'h4 ; */ +/*description: TOUCH_DAC*/ +#define RTC_IO_TOUCH_PAD14_DAC 0x00000007 +#define RTC_IO_TOUCH_PAD14_DAC_M ((RTC_IO_TOUCH_PAD14_DAC_V)<<(RTC_IO_TOUCH_PAD14_DAC_S)) +#define RTC_IO_TOUCH_PAD14_DAC_V 0x7 +#define RTC_IO_TOUCH_PAD14_DAC_S 23 +/* RTC_IO_TOUCH_PAD14_START : R/W ;bitpos:[22] ;default: 1'd0 ; */ +/*description: TOUCH_START*/ +#define RTC_IO_TOUCH_PAD14_START (BIT(22)) +#define RTC_IO_TOUCH_PAD14_START_M (BIT(22)) +#define RTC_IO_TOUCH_PAD14_START_V 0x1 +#define RTC_IO_TOUCH_PAD14_START_S 22 +/* RTC_IO_TOUCH_PAD14_TIE_OPT : R/W ;bitpos:[21] ;default: 1'd0 ; */ +/*description: TOUCH_TIE_OPT*/ +#define RTC_IO_TOUCH_PAD14_TIE_OPT (BIT(21)) +#define RTC_IO_TOUCH_PAD14_TIE_OPT_M (BIT(21)) +#define RTC_IO_TOUCH_PAD14_TIE_OPT_V 0x1 +#define RTC_IO_TOUCH_PAD14_TIE_OPT_S 21 +/* RTC_IO_TOUCH_PAD14_XPD : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: TOUCH_XPD*/ +#define RTC_IO_TOUCH_PAD14_XPD (BIT(20)) +#define RTC_IO_TOUCH_PAD14_XPD_M (BIT(20)) +#define RTC_IO_TOUCH_PAD14_XPD_V 0x1 +#define RTC_IO_TOUCH_PAD14_XPD_S 20 +/* RTC_IO_TOUCH_PAD14_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_TOUCH_PAD14_MUX_SEL (BIT(19)) +#define RTC_IO_TOUCH_PAD14_MUX_SEL_M (BIT(19)) +#define RTC_IO_TOUCH_PAD14_MUX_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD14_MUX_SEL_S 19 +/* RTC_IO_TOUCH_PAD14_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_TOUCH_PAD14_FUN_SEL 0x00000003 +#define RTC_IO_TOUCH_PAD14_FUN_SEL_M ((RTC_IO_TOUCH_PAD14_FUN_SEL_V)<<(RTC_IO_TOUCH_PAD14_FUN_SEL_S)) +#define RTC_IO_TOUCH_PAD14_FUN_SEL_V 0x3 +#define RTC_IO_TOUCH_PAD14_FUN_SEL_S 17 +/* RTC_IO_TOUCH_PAD14_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_TOUCH_PAD14_SLP_SEL (BIT(16)) +#define RTC_IO_TOUCH_PAD14_SLP_SEL_M (BIT(16)) +#define RTC_IO_TOUCH_PAD14_SLP_SEL_V 0x1 +#define RTC_IO_TOUCH_PAD14_SLP_SEL_S 16 +/* RTC_IO_TOUCH_PAD14_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD14_SLP_IE (BIT(15)) +#define RTC_IO_TOUCH_PAD14_SLP_IE_M (BIT(15)) +#define RTC_IO_TOUCH_PAD14_SLP_IE_V 0x1 +#define RTC_IO_TOUCH_PAD14_SLP_IE_S 15 +/* RTC_IO_TOUCH_PAD14_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_TOUCH_PAD14_SLP_OE (BIT(14)) +#define RTC_IO_TOUCH_PAD14_SLP_OE_M (BIT(14)) +#define RTC_IO_TOUCH_PAD14_SLP_OE_V 0x1 +#define RTC_IO_TOUCH_PAD14_SLP_OE_S 14 +/* RTC_IO_TOUCH_PAD14_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_TOUCH_PAD14_FUN_IE (BIT(13)) +#define RTC_IO_TOUCH_PAD14_FUN_IE_M (BIT(13)) +#define RTC_IO_TOUCH_PAD14_FUN_IE_V 0x1 +#define RTC_IO_TOUCH_PAD14_FUN_IE_S 13 + +#define RTC_IO_XTAL_32P_PAD_REG (DR_REG_RTCIO_BASE + 0xC0) +/* RTC_IO_X32P_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_X32P_DRV 0x00000003 +#define RTC_IO_X32P_DRV_M ((RTC_IO_X32P_DRV_V)<<(RTC_IO_X32P_DRV_S)) +#define RTC_IO_X32P_DRV_V 0x3 +#define RTC_IO_X32P_DRV_S 29 +/* RTC_IO_X32P_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_X32P_RDE (BIT(28)) +#define RTC_IO_X32P_RDE_M (BIT(28)) +#define RTC_IO_X32P_RDE_V 0x1 +#define RTC_IO_X32P_RDE_S 28 +/* RTC_IO_X32P_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_X32P_RUE (BIT(27)) +#define RTC_IO_X32P_RUE_M (BIT(27)) +#define RTC_IO_X32P_RUE_V 0x1 +#define RTC_IO_X32P_RUE_S 27 +/* RTC_IO_X32P_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_X32P_MUX_SEL (BIT(19)) +#define RTC_IO_X32P_MUX_SEL_M (BIT(19)) +#define RTC_IO_X32P_MUX_SEL_V 0x1 +#define RTC_IO_X32P_MUX_SEL_S 19 +/* RTC_IO_X32P_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_X32P_FUN_SEL 0x00000003 +#define RTC_IO_X32P_FUN_SEL_M ((RTC_IO_X32P_FUN_SEL_V)<<(RTC_IO_X32P_FUN_SEL_S)) +#define RTC_IO_X32P_FUN_SEL_V 0x3 +#define RTC_IO_X32P_FUN_SEL_S 17 +/* RTC_IO_X32P_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_X32P_SLP_SEL (BIT(16)) +#define RTC_IO_X32P_SLP_SEL_M (BIT(16)) +#define RTC_IO_X32P_SLP_SEL_V 0x1 +#define RTC_IO_X32P_SLP_SEL_S 16 +/* RTC_IO_X32P_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_X32P_SLP_IE (BIT(15)) +#define RTC_IO_X32P_SLP_IE_M (BIT(15)) +#define RTC_IO_X32P_SLP_IE_V 0x1 +#define RTC_IO_X32P_SLP_IE_S 15 +/* RTC_IO_X32P_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_X32P_SLP_OE (BIT(14)) +#define RTC_IO_X32P_SLP_OE_M (BIT(14)) +#define RTC_IO_X32P_SLP_OE_V 0x1 +#define RTC_IO_X32P_SLP_OE_S 14 +/* RTC_IO_X32P_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_X32P_FUN_IE (BIT(13)) +#define RTC_IO_X32P_FUN_IE_M (BIT(13)) +#define RTC_IO_X32P_FUN_IE_V 0x1 +#define RTC_IO_X32P_FUN_IE_S 13 + +#define RTC_IO_XTAL_32N_PAD_REG (DR_REG_RTCIO_BASE + 0xC4) +/* RTC_IO_X32N_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_X32N_DRV 0x00000003 +#define RTC_IO_X32N_DRV_M ((RTC_IO_X32N_DRV_V)<<(RTC_IO_X32N_DRV_S)) +#define RTC_IO_X32N_DRV_V 0x3 +#define RTC_IO_X32N_DRV_S 29 +/* RTC_IO_X32N_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: RDE*/ +#define RTC_IO_X32N_RDE (BIT(28)) +#define RTC_IO_X32N_RDE_M (BIT(28)) +#define RTC_IO_X32N_RDE_V 0x1 +#define RTC_IO_X32N_RDE_S 28 +/* RTC_IO_X32N_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_X32N_RUE (BIT(27)) +#define RTC_IO_X32N_RUE_M (BIT(27)) +#define RTC_IO_X32N_RUE_V 0x1 +#define RTC_IO_X32N_RUE_S 27 +/* RTC_IO_X32N_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_X32N_MUX_SEL (BIT(19)) +#define RTC_IO_X32N_MUX_SEL_M (BIT(19)) +#define RTC_IO_X32N_MUX_SEL_V 0x1 +#define RTC_IO_X32N_MUX_SEL_S 19 +/* RTC_IO_X32N_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_X32N_FUN_SEL 0x00000003 +#define RTC_IO_X32N_FUN_SEL_M ((RTC_IO_X32N_FUN_SEL_V)<<(RTC_IO_X32N_FUN_SEL_S)) +#define RTC_IO_X32N_FUN_SEL_V 0x3 +#define RTC_IO_X32N_FUN_SEL_S 17 +/* RTC_IO_X32N_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_X32N_SLP_SEL (BIT(16)) +#define RTC_IO_X32N_SLP_SEL_M (BIT(16)) +#define RTC_IO_X32N_SLP_SEL_V 0x1 +#define RTC_IO_X32N_SLP_SEL_S 16 +/* RTC_IO_X32N_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_X32N_SLP_IE (BIT(15)) +#define RTC_IO_X32N_SLP_IE_M (BIT(15)) +#define RTC_IO_X32N_SLP_IE_V 0x1 +#define RTC_IO_X32N_SLP_IE_S 15 +/* RTC_IO_X32N_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_X32N_SLP_OE (BIT(14)) +#define RTC_IO_X32N_SLP_OE_M (BIT(14)) +#define RTC_IO_X32N_SLP_OE_V 0x1 +#define RTC_IO_X32N_SLP_OE_S 14 +/* RTC_IO_X32N_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_X32N_FUN_IE (BIT(13)) +#define RTC_IO_X32N_FUN_IE_M (BIT(13)) +#define RTC_IO_X32N_FUN_IE_V 0x1 +#define RTC_IO_X32N_FUN_IE_S 13 + +#define RTC_IO_PAD_DAC1_REG (DR_REG_RTCIO_BASE + 0xC8) +/* RTC_IO_PDAC1_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: PDAC1_DRV*/ +#define RTC_IO_PDAC1_DRV 0x00000003 +#define RTC_IO_PDAC1_DRV_M ((RTC_IO_PDAC1_DRV_V)<<(RTC_IO_PDAC1_DRV_S)) +#define RTC_IO_PDAC1_DRV_V 0x3 +#define RTC_IO_PDAC1_DRV_S 29 +/* RTC_IO_PDAC1_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: PDAC1_RDE*/ +#define RTC_IO_PDAC1_RDE (BIT(28)) +#define RTC_IO_PDAC1_RDE_M (BIT(28)) +#define RTC_IO_PDAC1_RDE_V 0x1 +#define RTC_IO_PDAC1_RDE_S 28 +/* RTC_IO_PDAC1_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: PDAC1_RUE*/ +#define RTC_IO_PDAC1_RUE (BIT(27)) +#define RTC_IO_PDAC1_RUE_M (BIT(27)) +#define RTC_IO_PDAC1_RUE_V 0x1 +#define RTC_IO_PDAC1_RUE_S 27 +/* RTC_IO_PDAC1_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_PDAC1_MUX_SEL (BIT(19)) +#define RTC_IO_PDAC1_MUX_SEL_M (BIT(19)) +#define RTC_IO_PDAC1_MUX_SEL_V 0x1 +#define RTC_IO_PDAC1_MUX_SEL_S 19 +/* RTC_IO_PDAC1_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: PDAC1 function sel*/ +#define RTC_IO_PDAC1_FUN_SEL 0x00000003 +#define RTC_IO_PDAC1_FUN_SEL_M ((RTC_IO_PDAC1_FUN_SEL_V)<<(RTC_IO_PDAC1_FUN_SEL_S)) +#define RTC_IO_PDAC1_FUN_SEL_V 0x3 +#define RTC_IO_PDAC1_FUN_SEL_S 17 +/* RTC_IO_PDAC1_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_PDAC1_SLP_SEL (BIT(16)) +#define RTC_IO_PDAC1_SLP_SEL_M (BIT(16)) +#define RTC_IO_PDAC1_SLP_SEL_V 0x1 +#define RTC_IO_PDAC1_SLP_SEL_S 16 +/* RTC_IO_PDAC1_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_PDAC1_SLP_IE (BIT(15)) +#define RTC_IO_PDAC1_SLP_IE_M (BIT(15)) +#define RTC_IO_PDAC1_SLP_IE_V 0x1 +#define RTC_IO_PDAC1_SLP_IE_S 15 +/* RTC_IO_PDAC1_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_PDAC1_SLP_OE (BIT(14)) +#define RTC_IO_PDAC1_SLP_OE_M (BIT(14)) +#define RTC_IO_PDAC1_SLP_OE_V 0x1 +#define RTC_IO_PDAC1_SLP_OE_S 14 +/* RTC_IO_PDAC1_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_PDAC1_FUN_IE (BIT(13)) +#define RTC_IO_PDAC1_FUN_IE_M (BIT(13)) +#define RTC_IO_PDAC1_FUN_IE_V 0x1 +#define RTC_IO_PDAC1_FUN_IE_S 13 +/* RTC_IO_PDAC1_DAC_XPD_FORCE : R/W ;bitpos:[12] ;default: 1'd0 ; */ +/*description: 1: use reg_pdac1_xpd_dac to control PDAC1_XPD_DAC 0: use SAR + ADC FSM to control PDAC1_XPD_DAC*/ +#define RTC_IO_PDAC1_DAC_XPD_FORCE (BIT(12)) +#define RTC_IO_PDAC1_DAC_XPD_FORCE_M (BIT(12)) +#define RTC_IO_PDAC1_DAC_XPD_FORCE_V 0x1 +#define RTC_IO_PDAC1_DAC_XPD_FORCE_S 12 +/* RTC_IO_PDAC1_XPD_DAC : R/W ;bitpos:[11] ;default: 1'd0 ; */ +/*description: PDAC1_XPD_DAC*/ +#define RTC_IO_PDAC1_XPD_DAC (BIT(11)) +#define RTC_IO_PDAC1_XPD_DAC_M (BIT(11)) +#define RTC_IO_PDAC1_XPD_DAC_V 0x1 +#define RTC_IO_PDAC1_XPD_DAC_S 11 +/* RTC_IO_PDAC1_DAC : R/W ;bitpos:[10:3] ;default: 8'd0 ; */ +/*description: PDAC1_DAC*/ +#define RTC_IO_PDAC1_DAC 0x000000FF +#define RTC_IO_PDAC1_DAC_M ((RTC_IO_PDAC1_DAC_V)<<(RTC_IO_PDAC1_DAC_S)) +#define RTC_IO_PDAC1_DAC_V 0xFF +#define RTC_IO_PDAC1_DAC_S 3 + +#define RTC_IO_PAD_DAC2_REG (DR_REG_RTCIO_BASE + 0xCC) +/* RTC_IO_PDAC2_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: PDAC2_DRV*/ +#define RTC_IO_PDAC2_DRV 0x00000003 +#define RTC_IO_PDAC2_DRV_M ((RTC_IO_PDAC2_DRV_V)<<(RTC_IO_PDAC2_DRV_S)) +#define RTC_IO_PDAC2_DRV_V 0x3 +#define RTC_IO_PDAC2_DRV_S 29 +/* RTC_IO_PDAC2_RDE : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: PDAC2_RDE*/ +#define RTC_IO_PDAC2_RDE (BIT(28)) +#define RTC_IO_PDAC2_RDE_M (BIT(28)) +#define RTC_IO_PDAC2_RDE_V 0x1 +#define RTC_IO_PDAC2_RDE_S 28 +/* RTC_IO_PDAC2_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: PDAC2_RUE*/ +#define RTC_IO_PDAC2_RUE (BIT(27)) +#define RTC_IO_PDAC2_RUE_M (BIT(27)) +#define RTC_IO_PDAC2_RUE_V 0x1 +#define RTC_IO_PDAC2_RUE_S 27 +/* RTC_IO_PDAC2_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_PDAC2_MUX_SEL (BIT(19)) +#define RTC_IO_PDAC2_MUX_SEL_M (BIT(19)) +#define RTC_IO_PDAC2_MUX_SEL_V 0x1 +#define RTC_IO_PDAC2_MUX_SEL_S 19 +/* RTC_IO_PDAC2_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: PDAC1 function sel*/ +#define RTC_IO_PDAC2_FUN_SEL 0x00000003 +#define RTC_IO_PDAC2_FUN_SEL_M ((RTC_IO_PDAC2_FUN_SEL_V)<<(RTC_IO_PDAC2_FUN_SEL_S)) +#define RTC_IO_PDAC2_FUN_SEL_V 0x3 +#define RTC_IO_PDAC2_FUN_SEL_S 17 +/* RTC_IO_PDAC2_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_PDAC2_SLP_SEL (BIT(16)) +#define RTC_IO_PDAC2_SLP_SEL_M (BIT(16)) +#define RTC_IO_PDAC2_SLP_SEL_V 0x1 +#define RTC_IO_PDAC2_SLP_SEL_S 16 +/* RTC_IO_PDAC2_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_PDAC2_SLP_IE (BIT(15)) +#define RTC_IO_PDAC2_SLP_IE_M (BIT(15)) +#define RTC_IO_PDAC2_SLP_IE_V 0x1 +#define RTC_IO_PDAC2_SLP_IE_S 15 +/* RTC_IO_PDAC2_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_PDAC2_SLP_OE (BIT(14)) +#define RTC_IO_PDAC2_SLP_OE_M (BIT(14)) +#define RTC_IO_PDAC2_SLP_OE_V 0x1 +#define RTC_IO_PDAC2_SLP_OE_S 14 +/* RTC_IO_PDAC2_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_PDAC2_FUN_IE (BIT(13)) +#define RTC_IO_PDAC2_FUN_IE_M (BIT(13)) +#define RTC_IO_PDAC2_FUN_IE_V 0x1 +#define RTC_IO_PDAC2_FUN_IE_S 13 +/* RTC_IO_PDAC2_DAC_XPD_FORCE : R/W ;bitpos:[12] ;default: 1'd0 ; */ +/*description: 1: use reg_pdac2_xpd_dac to control PDAC2_XPD_DAC 0: use SAR + ADC FSM to control PDAC2_XPD_DAC*/ +#define RTC_IO_PDAC2_DAC_XPD_FORCE (BIT(12)) +#define RTC_IO_PDAC2_DAC_XPD_FORCE_M (BIT(12)) +#define RTC_IO_PDAC2_DAC_XPD_FORCE_V 0x1 +#define RTC_IO_PDAC2_DAC_XPD_FORCE_S 12 +/* RTC_IO_PDAC2_XPD_DAC : R/W ;bitpos:[11] ;default: 1'd0 ; */ +/*description: PDAC2_XPD_DAC*/ +#define RTC_IO_PDAC2_XPD_DAC (BIT(11)) +#define RTC_IO_PDAC2_XPD_DAC_M (BIT(11)) +#define RTC_IO_PDAC2_XPD_DAC_V 0x1 +#define RTC_IO_PDAC2_XPD_DAC_S 11 +/* RTC_IO_PDAC2_DAC : R/W ;bitpos:[10:3] ;default: 8'd0 ; */ +/*description: PDAC2_DAC*/ +#define RTC_IO_PDAC2_DAC 0x000000FF +#define RTC_IO_PDAC2_DAC_M ((RTC_IO_PDAC2_DAC_V)<<(RTC_IO_PDAC2_DAC_S)) +#define RTC_IO_PDAC2_DAC_V 0xFF +#define RTC_IO_PDAC2_DAC_S 3 + +#define RTC_IO_RTC_PAD19_REG (DR_REG_RTCIO_BASE + 0xD0) +/* RTC_IO_PAD19_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_PAD19_DRV 0x00000003 +#define RTC_IO_PAD19_DRV_M ((RTC_IO_PAD19_DRV_V)<<(RTC_IO_PAD19_DRV_S)) +#define RTC_IO_PAD19_DRV_V 0x3 +#define RTC_IO_PAD19_DRV_S 29 +/* RTC_IO_PAD19_RDE : R/W ;bitpos:[28] ;default: 1'd1 ; */ +/*description: RDE*/ +#define RTC_IO_PAD19_RDE (BIT(28)) +#define RTC_IO_PAD19_RDE_M (BIT(28)) +#define RTC_IO_PAD19_RDE_V 0x1 +#define RTC_IO_PAD19_RDE_S 28 +/* RTC_IO_PAD19_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_PAD19_RUE (BIT(27)) +#define RTC_IO_PAD19_RUE_M (BIT(27)) +#define RTC_IO_PAD19_RUE_V 0x1 +#define RTC_IO_PAD19_RUE_S 27 +/* RTC_IO_PAD19_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_PAD19_MUX_SEL (BIT(19)) +#define RTC_IO_PAD19_MUX_SEL_M (BIT(19)) +#define RTC_IO_PAD19_MUX_SEL_V 0x1 +#define RTC_IO_PAD19_MUX_SEL_S 19 +/* RTC_IO_PAD19_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_PAD19_FUN_SEL 0x00000003 +#define RTC_IO_PAD19_FUN_SEL_M ((RTC_IO_PAD19_FUN_SEL_V)<<(RTC_IO_PAD19_FUN_SEL_S)) +#define RTC_IO_PAD19_FUN_SEL_V 0x3 +#define RTC_IO_PAD19_FUN_SEL_S 17 +/* RTC_IO_PAD19_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_PAD19_SLP_SEL (BIT(16)) +#define RTC_IO_PAD19_SLP_SEL_M (BIT(16)) +#define RTC_IO_PAD19_SLP_SEL_V 0x1 +#define RTC_IO_PAD19_SLP_SEL_S 16 +/* RTC_IO_PAD19_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_PAD19_SLP_IE (BIT(15)) +#define RTC_IO_PAD19_SLP_IE_M (BIT(15)) +#define RTC_IO_PAD19_SLP_IE_V 0x1 +#define RTC_IO_PAD19_SLP_IE_S 15 +/* RTC_IO_PAD19_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_PAD19_SLP_OE (BIT(14)) +#define RTC_IO_PAD19_SLP_OE_M (BIT(14)) +#define RTC_IO_PAD19_SLP_OE_V 0x1 +#define RTC_IO_PAD19_SLP_OE_S 14 +/* RTC_IO_PAD19_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_PAD19_FUN_IE (BIT(13)) +#define RTC_IO_PAD19_FUN_IE_M (BIT(13)) +#define RTC_IO_PAD19_FUN_IE_V 0x1 +#define RTC_IO_PAD19_FUN_IE_S 13 + +#define RTC_IO_RTC_PAD20_REG (DR_REG_RTCIO_BASE + 0xD4) +/* RTC_IO_PAD20_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_PAD20_DRV 0x00000003 +#define RTC_IO_PAD20_DRV_M ((RTC_IO_PAD20_DRV_V)<<(RTC_IO_PAD20_DRV_S)) +#define RTC_IO_PAD20_DRV_V 0x3 +#define RTC_IO_PAD20_DRV_S 29 +/* RTC_IO_PAD20_RDE : R/W ;bitpos:[28] ;default: 1'd1 ; */ +/*description: RDE*/ +#define RTC_IO_PAD20_RDE (BIT(28)) +#define RTC_IO_PAD20_RDE_M (BIT(28)) +#define RTC_IO_PAD20_RDE_V 0x1 +#define RTC_IO_PAD20_RDE_S 28 +/* RTC_IO_PAD20_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_PAD20_RUE (BIT(27)) +#define RTC_IO_PAD20_RUE_M (BIT(27)) +#define RTC_IO_PAD20_RUE_V 0x1 +#define RTC_IO_PAD20_RUE_S 27 +/* RTC_IO_PAD20_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_PAD20_MUX_SEL (BIT(19)) +#define RTC_IO_PAD20_MUX_SEL_M (BIT(19)) +#define RTC_IO_PAD20_MUX_SEL_V 0x1 +#define RTC_IO_PAD20_MUX_SEL_S 19 +/* RTC_IO_PAD20_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_PAD20_FUN_SEL 0x00000003 +#define RTC_IO_PAD20_FUN_SEL_M ((RTC_IO_PAD20_FUN_SEL_V)<<(RTC_IO_PAD20_FUN_SEL_S)) +#define RTC_IO_PAD20_FUN_SEL_V 0x3 +#define RTC_IO_PAD20_FUN_SEL_S 17 +/* RTC_IO_PAD20_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_PAD20_SLP_SEL (BIT(16)) +#define RTC_IO_PAD20_SLP_SEL_M (BIT(16)) +#define RTC_IO_PAD20_SLP_SEL_V 0x1 +#define RTC_IO_PAD20_SLP_SEL_S 16 +/* RTC_IO_PAD20_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_PAD20_SLP_IE (BIT(15)) +#define RTC_IO_PAD20_SLP_IE_M (BIT(15)) +#define RTC_IO_PAD20_SLP_IE_V 0x1 +#define RTC_IO_PAD20_SLP_IE_S 15 +/* RTC_IO_PAD20_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_PAD20_SLP_OE (BIT(14)) +#define RTC_IO_PAD20_SLP_OE_M (BIT(14)) +#define RTC_IO_PAD20_SLP_OE_V 0x1 +#define RTC_IO_PAD20_SLP_OE_S 14 +/* RTC_IO_PAD20_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_PAD20_FUN_IE (BIT(13)) +#define RTC_IO_PAD20_FUN_IE_M (BIT(13)) +#define RTC_IO_PAD20_FUN_IE_V 0x1 +#define RTC_IO_PAD20_FUN_IE_S 13 + +#define RTC_IO_RTC_PAD21_REG (DR_REG_RTCIO_BASE + 0xD8) +/* RTC_IO_PAD21_DRV : R/W ;bitpos:[30:29] ;default: 2'd2 ; */ +/*description: DRV*/ +#define RTC_IO_PAD21_DRV 0x00000003 +#define RTC_IO_PAD21_DRV_M ((RTC_IO_PAD21_DRV_V)<<(RTC_IO_PAD21_DRV_S)) +#define RTC_IO_PAD21_DRV_V 0x3 +#define RTC_IO_PAD21_DRV_S 29 +/* RTC_IO_PAD21_RDE : R/W ;bitpos:[28] ;default: 1'd1 ; */ +/*description: RDE*/ +#define RTC_IO_PAD21_RDE (BIT(28)) +#define RTC_IO_PAD21_RDE_M (BIT(28)) +#define RTC_IO_PAD21_RDE_V 0x1 +#define RTC_IO_PAD21_RDE_S 28 +/* RTC_IO_PAD21_RUE : R/W ;bitpos:[27] ;default: 1'd0 ; */ +/*description: RUE*/ +#define RTC_IO_PAD21_RUE (BIT(27)) +#define RTC_IO_PAD21_RUE_M (BIT(27)) +#define RTC_IO_PAD21_RUE_V 0x1 +#define RTC_IO_PAD21_RUE_S 27 +/* RTC_IO_PAD21_MUX_SEL : R/W ;bitpos:[19] ;default: 1'd0 ; */ +/*description: 1: use RTC GPIO 0: use digital GPIO*/ +#define RTC_IO_PAD21_MUX_SEL (BIT(19)) +#define RTC_IO_PAD21_MUX_SEL_M (BIT(19)) +#define RTC_IO_PAD21_MUX_SEL_V 0x1 +#define RTC_IO_PAD21_MUX_SEL_S 19 +/* RTC_IO_PAD21_FUN_SEL : R/W ;bitpos:[18:17] ;default: 2'd0 ; */ +/*description: function sel*/ +#define RTC_IO_PAD21_FUN_SEL 0x00000003 +#define RTC_IO_PAD21_FUN_SEL_M ((RTC_IO_PAD21_FUN_SEL_V)<<(RTC_IO_PAD21_FUN_SEL_S)) +#define RTC_IO_PAD21_FUN_SEL_V 0x3 +#define RTC_IO_PAD21_FUN_SEL_S 17 +/* RTC_IO_PAD21_SLP_SEL : R/W ;bitpos:[16] ;default: 1'd0 ; */ +/*description: 1: enable sleep mode during sleep 0: no sleep mode*/ +#define RTC_IO_PAD21_SLP_SEL (BIT(16)) +#define RTC_IO_PAD21_SLP_SEL_M (BIT(16)) +#define RTC_IO_PAD21_SLP_SEL_V 0x1 +#define RTC_IO_PAD21_SLP_SEL_S 16 +/* RTC_IO_PAD21_SLP_IE : R/W ;bitpos:[15] ;default: 1'd0 ; */ +/*description: input enable in sleep mode*/ +#define RTC_IO_PAD21_SLP_IE (BIT(15)) +#define RTC_IO_PAD21_SLP_IE_M (BIT(15)) +#define RTC_IO_PAD21_SLP_IE_V 0x1 +#define RTC_IO_PAD21_SLP_IE_S 15 +/* RTC_IO_PAD21_SLP_OE : R/W ;bitpos:[14] ;default: 1'd0 ; */ +/*description: output enable in sleep mode*/ +#define RTC_IO_PAD21_SLP_OE (BIT(14)) +#define RTC_IO_PAD21_SLP_OE_M (BIT(14)) +#define RTC_IO_PAD21_SLP_OE_V 0x1 +#define RTC_IO_PAD21_SLP_OE_S 14 +/* RTC_IO_PAD21_FUN_IE : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: input enable in work mode*/ +#define RTC_IO_PAD21_FUN_IE (BIT(13)) +#define RTC_IO_PAD21_FUN_IE_M (BIT(13)) +#define RTC_IO_PAD21_FUN_IE_V 0x1 +#define RTC_IO_PAD21_FUN_IE_S 13 + +#define RTC_IO_EXT_WAKEUP0_REG (DR_REG_RTCIO_BASE + 0xDC) +/* RTC_IO_EXT_WAKEUP0_SEL : R/W ;bitpos:[31:27] ;default: 5'd0 ; */ +/*description: */ +#define RTC_IO_EXT_WAKEUP0_SEL 0x0000001F +#define RTC_IO_EXT_WAKEUP0_SEL_M ((RTC_IO_EXT_WAKEUP0_SEL_V)<<(RTC_IO_EXT_WAKEUP0_SEL_S)) +#define RTC_IO_EXT_WAKEUP0_SEL_V 0x1F +#define RTC_IO_EXT_WAKEUP0_SEL_S 27 + +#define RTC_IO_XTL_EXT_CTR_REG (DR_REG_RTCIO_BASE + 0xE0) +/* RTC_IO_XTL_EXT_CTR_SEL : R/W ;bitpos:[31:27] ;default: 5'd0 ; */ +/*description: select RTC GPIO 0 ~ 17 to control XTAL*/ +#define RTC_IO_XTL_EXT_CTR_SEL 0x0000001F +#define RTC_IO_XTL_EXT_CTR_SEL_M ((RTC_IO_XTL_EXT_CTR_SEL_V)<<(RTC_IO_XTL_EXT_CTR_SEL_S)) +#define RTC_IO_XTL_EXT_CTR_SEL_V 0x1F +#define RTC_IO_XTL_EXT_CTR_SEL_S 27 + +#define RTC_IO_SAR_I2C_IO_REG (DR_REG_RTCIO_BASE + 0xE4) +/* RTC_IO_SAR_I2C_SDA_SEL : R/W ;bitpos:[31:30] ;default: 2'd0 ; */ +/*description: */ +#define RTC_IO_SAR_I2C_SDA_SEL 0x00000003 +#define RTC_IO_SAR_I2C_SDA_SEL_M ((RTC_IO_SAR_I2C_SDA_SEL_V)<<(RTC_IO_SAR_I2C_SDA_SEL_S)) +#define RTC_IO_SAR_I2C_SDA_SEL_V 0x3 +#define RTC_IO_SAR_I2C_SDA_SEL_S 30 +/* RTC_IO_SAR_I2C_SCL_SEL : R/W ;bitpos:[29:28] ;default: 2'd0 ; */ +/*description: */ +#define RTC_IO_SAR_I2C_SCL_SEL 0x00000003 +#define RTC_IO_SAR_I2C_SCL_SEL_M ((RTC_IO_SAR_I2C_SCL_SEL_V)<<(RTC_IO_SAR_I2C_SCL_SEL_S)) +#define RTC_IO_SAR_I2C_SCL_SEL_V 0x3 +#define RTC_IO_SAR_I2C_SCL_SEL_S 28 +/* RTC_IO_SAR_DEBUG_BIT_SEL : R/W ;bitpos:[27:23] ;default: 5'h0 ; */ +/*description: */ +#define RTC_IO_SAR_DEBUG_BIT_SEL 0x0000001F +#define RTC_IO_SAR_DEBUG_BIT_SEL_M ((RTC_IO_SAR_DEBUG_BIT_SEL_V)<<(RTC_IO_SAR_DEBUG_BIT_SEL_S)) +#define RTC_IO_SAR_DEBUG_BIT_SEL_V 0x1F +#define RTC_IO_SAR_DEBUG_BIT_SEL_S 23 + +#define RTC_IO_DATE_REG (DR_REG_RTCIO_BASE + 0x1FC) +/* RTC_IO_IO_DATE : R/W ;bitpos:[27:0] ;default: 28'h1903170 ; */ +/*description: */ +#define RTC_IO_IO_DATE 0x0FFFFFFF +#define RTC_IO_IO_DATE_M ((RTC_IO_IO_DATE_V)<<(RTC_IO_IO_DATE_S)) +#define RTC_IO_IO_DATE_V 0xFFFFFFF +#define RTC_IO_IO_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_RTC_IO_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/rtc_io_struct.h b/components/soc/esp32s2beta/include/soc/rtc_io_struct.h new file mode 100644 index 0000000000..251832f303 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/rtc_io_struct.h @@ -0,0 +1,345 @@ +// Copyright 2017-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_RTC_IO_STRUCT_H_ +#define _SOC_RTC_IO_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t reserved0: 10; + uint32_t data: 22; /*RTC GPIO 0 ~ 21 output data*/ + }; + uint32_t val; + } out; + union { + struct { + uint32_t reserved0: 10; + uint32_t w1ts: 22; /*RTC GPIO 0 ~ 21 output data write 1 to set*/ + }; + uint32_t val; + } out_w1ts; + union { + struct { + uint32_t reserved0: 10; + uint32_t w1tc: 22; /*RTC GPIO 0 ~ 21 output data write 1 to clear*/ + }; + uint32_t val; + } out_w1tc; + union { + struct { + uint32_t reserved0: 10; + uint32_t enable: 22; /*RTC GPIO 0 ~ 21 enable*/ + }; + uint32_t val; + } enable; + union { + struct { + uint32_t reserved0: 10; + uint32_t w1ts: 22; /*RTC GPIO 0 ~ 21 enable write 1 to set*/ + }; + uint32_t val; + } enable_w1ts; + union { + struct { + uint32_t reserved0: 10; + uint32_t w1tc: 22; /*RTC GPIO 0 ~ 21 enable write 1 to clear*/ + }; + uint32_t val; + } enable_w1tc; + union { + struct { + uint32_t reserved0: 10; + uint32_t status: 22; /*RTC GPIO 0 ~ 21 interrupt status*/ + }; + uint32_t val; + } status; + union { + struct { + uint32_t reserved0: 10; + uint32_t w1ts: 22; /*RTC GPIO 0 ~ 21 interrupt status write 1 to set*/ + }; + uint32_t val; + } status_w1ts; + union { + struct { + uint32_t reserved0: 10; + uint32_t w1tc: 22; /*RTC GPIO 0 ~ 21 interrupt status write 1 to clear*/ + }; + uint32_t val; + } status_w1tc; + union { + struct { + uint32_t reserved0: 10; + uint32_t in: 22; /*RTC GPIO input data*/ + }; + uint32_t val; + } in_val; + union { + struct { + uint32_t reserved0: 2; + uint32_t pad_driver: 1; /*if set to 0: normal output if set to 1: open drain*/ + uint32_t reserved3: 4; + uint32_t int_type: 3; /*if set to 0: GPIO interrupt disable if set to 1: rising edge trigger if set to 2: falling edge trigger if set to 3: any edge trigger if set to 4: low level trigger if set to 5: high level trigger*/ + uint32_t wakeup_enable: 1; /*RTC GPIO wakeup enable bit*/ + uint32_t reserved11: 21; + }; + uint32_t val; + } pin[22]; + union { + struct { + uint32_t sel0: 5; + uint32_t sel1: 5; + uint32_t sel2: 5; + uint32_t sel3: 5; + uint32_t sel4: 5; + uint32_t no_gating_12m: 1; + uint32_t reserved26: 6; + }; + uint32_t val; + } debug_sel; + union { + struct { + uint32_t reserved0: 13; + uint32_t fun_ie: 1; /*input enable in work mode*/ + uint32_t slp_oe: 1; /*output enable in sleep mode*/ + uint32_t slp_ie: 1; /*input enable in sleep mode*/ + uint32_t slp_sel: 1; /*1: enable sleep mode during sleep 0: no sleep mode*/ + uint32_t fun_sel: 2; /*function sel*/ + uint32_t mux_sel: 1; /*1: use RTC GPIO 0: use digital GPIO*/ + uint32_t xpd: 1; /*TOUCH_XPD*/ + uint32_t tie_opt: 1; /*TOUCH_TIE_OPT*/ + uint32_t start: 1; /*TOUCH_START*/ + uint32_t dac: 3; /*TOUCH_DAC*/ + uint32_t reserved26: 1; + uint32_t rue: 1; /*RUE*/ + uint32_t rde: 1; /*RDE*/ + uint32_t drv: 2; /*DRV*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } touch_pad[15]; + union { + struct { + uint32_t reserved0: 13; + uint32_t x32p_fun_ie: 1; /*input enable in work mode*/ + uint32_t x32p_slp_oe: 1; /*output enable in sleep mode*/ + uint32_t x32p_slp_ie: 1; /*input enable in sleep mode*/ + uint32_t x32p_slp_sel: 1; /*1: enable sleep mode during sleep 0: no sleep mode*/ + uint32_t x32p_fun_sel: 2; /*function sel*/ + uint32_t x32p_mux_sel: 1; /*1: use RTC GPIO 0: use digital GPIO*/ + uint32_t reserved20: 7; + uint32_t x32p_rue: 1; /*RUE*/ + uint32_t x32p_rde: 1; /*RDE*/ + uint32_t x32p_drv: 2; /*DRV*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } xtal_32p_pad; + union { + struct { + uint32_t reserved0: 13; + uint32_t x32n_fun_ie: 1; /*input enable in work mode*/ + uint32_t x32n_slp_oe: 1; /*output enable in sleep mode*/ + uint32_t x32n_slp_ie: 1; /*input enable in sleep mode*/ + uint32_t x32n_slp_sel: 1; /*1: enable sleep mode during sleep 0: no sleep mode*/ + uint32_t x32n_fun_sel: 2; /*function sel*/ + uint32_t x32n_mux_sel: 1; /*1: use RTC GPIO 0: use digital GPIO*/ + uint32_t reserved20: 7; + uint32_t x32n_rue: 1; /*RUE*/ + uint32_t x32n_rde: 1; /*RDE*/ + uint32_t x32n_drv: 2; /*DRV*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } xtal_32n_pad; + union { + struct { + uint32_t reserved0: 3; + uint32_t dac: 8; /*PDAC1_DAC*/ + uint32_t xpd_dac: 1; /*PDAC1_XPD_DAC*/ + uint32_t dac_xpd_force: 1; /*1: use reg_pdac1_xpd_dac to control PDAC1_XPD_DAC 0: use SAR ADC FSM to control PDAC1_XPD_DAC*/ + uint32_t fun_ie: 1; /*input enable in work mode*/ + uint32_t slp_oe: 1; /*output enable in sleep mode*/ + uint32_t slp_ie: 1; /*input enable in sleep mode*/ + uint32_t slp_sel: 1; /*1: enable sleep mode during sleep 0: no sleep mode*/ + uint32_t fun_sel: 2; /*PDAC1 function sel*/ + uint32_t mux_sel: 1; /*1: use RTC GPIO 0: use digital GPIO*/ + uint32_t reserved20: 7; + uint32_t rue: 1; /*PDAC1_RUE*/ + uint32_t rde: 1; /*PDAC1_RDE*/ + uint32_t drv: 2; /*PDAC1_DRV*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } pad_dac[2]; + union { + struct { + uint32_t reserved0: 13; + uint32_t rtc_pad19_fun_ie: 1; /*input enable in work mode*/ + uint32_t rtc_pad19_slp_oe: 1; /*output enable in sleep mode*/ + uint32_t rtc_pad19_slp_ie: 1; /*input enable in sleep mode*/ + uint32_t rtc_pad19_slp_sel: 1; /*1: enable sleep mode during sleep 0: no sleep mode*/ + uint32_t rtc_pad19_fun_sel: 2; /*function sel*/ + uint32_t rtc_pad19_mux_sel: 1; /*1: use RTC GPIO 0: use digital GPIO*/ + uint32_t reserved20: 7; + uint32_t rtc_pad19_rue: 1; /*RUE*/ + uint32_t rtc_pad19_rde: 1; /*RDE*/ + uint32_t rtc_pad19_drv: 2; /*DRV*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } rtc_pad19; + union { + struct { + uint32_t reserved0: 13; + uint32_t rtc_pad20_fun_ie: 1; /*input enable in work mode*/ + uint32_t rtc_pad20_slp_oe: 1; /*output enable in sleep mode*/ + uint32_t rtc_pad20_slp_ie: 1; /*input enable in sleep mode*/ + uint32_t rtc_pad20_slp_sel: 1; /*1: enable sleep mode during sleep 0: no sleep mode*/ + uint32_t rtc_pad20_fun_sel: 2; /*function sel*/ + uint32_t rtc_pad20_mux_sel: 1; /*1: use RTC GPIO 0: use digital GPIO*/ + uint32_t reserved20: 7; + uint32_t rtc_pad20_rue: 1; /*RUE*/ + uint32_t rtc_pad20_rde: 1; /*RDE*/ + uint32_t rtc_pad20_drv: 2; /*DRV*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } rtc_pad20; + union { + struct { + uint32_t reserved0: 13; + uint32_t rtc_pad21_fun_ie: 1; /*input enable in work mode*/ + uint32_t rtc_pad21_slp_oe: 1; /*output enable in sleep mode*/ + uint32_t rtc_pad21_slp_ie: 1; /*input enable in sleep mode*/ + uint32_t rtc_pad21_slp_sel: 1; /*1: enable sleep mode during sleep 0: no sleep mode*/ + uint32_t rtc_pad21_fun_sel: 2; /*function sel*/ + uint32_t rtc_pad21_mux_sel: 1; /*1: use RTC GPIO 0: use digital GPIO*/ + uint32_t reserved20: 7; + uint32_t rtc_pad21_rue: 1; /*RUE*/ + uint32_t rtc_pad21_rde: 1; /*RDE*/ + uint32_t rtc_pad21_drv: 2; /*DRV*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } rtc_pad21; + union { + struct { + uint32_t reserved0: 27; + uint32_t sel: 5; + }; + uint32_t val; + } ext_wakeup0; + union { + struct { + uint32_t reserved0: 27; + uint32_t sel: 5; /*select RTC GPIO 0 ~ 17 to control XTAL*/ + }; + uint32_t val; + } xtl_ext_ctr; + union { + struct { + uint32_t reserved0: 23; + uint32_t debug_bit_sel: 5; + uint32_t scl_sel: 2; + uint32_t sda_sel: 2; + }; + uint32_t val; + } sar_i2c_io; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t reserved_fc; + uint32_t reserved_100; + uint32_t reserved_104; + uint32_t reserved_108; + uint32_t reserved_10c; + uint32_t reserved_110; + uint32_t reserved_114; + uint32_t reserved_118; + uint32_t reserved_11c; + uint32_t reserved_120; + uint32_t reserved_124; + uint32_t reserved_128; + uint32_t reserved_12c; + uint32_t reserved_130; + uint32_t reserved_134; + uint32_t reserved_138; + uint32_t reserved_13c; + uint32_t reserved_140; + uint32_t reserved_144; + uint32_t reserved_148; + uint32_t reserved_14c; + uint32_t reserved_150; + uint32_t reserved_154; + uint32_t reserved_158; + uint32_t reserved_15c; + uint32_t reserved_160; + uint32_t reserved_164; + uint32_t reserved_168; + uint32_t reserved_16c; + uint32_t reserved_170; + uint32_t reserved_174; + uint32_t reserved_178; + uint32_t reserved_17c; + uint32_t reserved_180; + uint32_t reserved_184; + uint32_t reserved_188; + uint32_t reserved_18c; + uint32_t reserved_190; + uint32_t reserved_194; + uint32_t reserved_198; + uint32_t reserved_19c; + uint32_t reserved_1a0; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + uint32_t reserved_1f0; + uint32_t reserved_1f4; + uint32_t reserved_1f8; + union { + struct { + uint32_t date: 28; + uint32_t reserved28: 4; + }; + uint32_t val; + } date; +} rtc_io_dev_t; +extern rtc_io_dev_t RTCIO; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_RTC_IO_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/sdio_slave_pins.h b/components/soc/esp32s2beta/include/soc/sdio_slave_pins.h new file mode 100644 index 0000000000..d55bf246b4 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/sdio_slave_pins.h @@ -0,0 +1,34 @@ +// 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_SDIO_SLAVE_PINS_H_ +#define _SOC_SDIO_SLAVE_PINS_H_ + +#define SDIO_SLAVE_SLOT0_IOMUX_PIN_NUM_CLK 12 +#define SDIO_SLAVE_SLOT0_IOMUX_PIN_NUM_CMD 11 +#define SDIO_SLAVE_SLOT0_IOMUX_PIN_NUM_D0 13 +#define SDIO_SLAVE_SLOT0_IOMUX_PIN_NUM_D1 14 +#define SDIO_SLAVE_SLOT0_IOMUX_PIN_NUM_D2 9 +#define SDIO_SLAVE_SLOT0_IOMUX_PIN_NUM_D3 10 +#define SDIO_SLAVE_SLOT0_FUNC 0 + +#define SDIO_SLAVE_SLOT1_IOMUX_PIN_NUM_CLK 36 +#define SDIO_SLAVE_SLOT1_IOMUX_PIN_NUM_CMD 35 +#define SDIO_SLAVE_SLOT1_IOMUX_PIN_NUM_D0 37 +#define SDIO_SLAVE_SLOT1_IOMUX_PIN_NUM_D1 38 +#define SDIO_SLAVE_SLOT1_IOMUX_PIN_NUM_D2 33 +#define SDIO_SLAVE_SLOT1_IOMUX_PIN_NUM_D3 34 +#define SDIO_SLAVE_SLOT1_FUNC 3 + +#endif /* _SOC_SDIO_SLAVE_PINS_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/sdmmc_pins.h b/components/soc/esp32s2beta/include/soc/sdmmc_pins.h new file mode 100644 index 0000000000..48d5894abe --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/sdmmc_pins.h @@ -0,0 +1,38 @@ +// 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_SDMMC_PINS_H_ +#define _SOC_SDMMC_PINS_H_ + +#define SDMMC_SLOT0_IOMUX_PIN_NUM_CLK 12 +#define SDMMC_SLOT0_IOMUX_PIN_NUM_CMD 11 +#define SDMMC_SLOT0_IOMUX_PIN_NUM_D0 13 +#define SDMMC_SLOT0_IOMUX_PIN_NUM_D1 14 +#define SDMMC_SLOT0_IOMUX_PIN_NUM_D2 9 +#define SDMMC_SLOT0_IOMUX_PIN_NUM_D3 10 +#define SDMMC_SLOT0_IOMUX_PIN_NUM_D4 16 +#define SDMMC_SLOT0_IOMUX_PIN_NUM_D5 17 +#define SDMMC_SLOT0_IOMUX_PIN_NUM_D6 5 +#define SDMMC_SLOT0_IOMUX_PIN_NUM_D7 18 +#define SDMMC_SLOT0_FUNC 0 + +#define SDMMC_SLOT1_IOMUX_PIN_NUM_CLK 36 +#define SDMMC_SLOT1_IOMUX_PIN_NUM_CMD 35 +#define SDMMC_SLOT1_IOMUX_PIN_NUM_D0 37 +#define SDMMC_SLOT1_IOMUX_PIN_NUM_D1 38 +#define SDMMC_SLOT1_IOMUX_PIN_NUM_D2 33 +#define SDMMC_SLOT1_IOMUX_PIN_NUM_D3 34 +#define SDMMC_SLOT1_FUNC 3 + +#endif /* _SOC_SDMMC_PINS_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/sdmmc_reg.h b/components/soc/esp32s2beta/include/soc/sdmmc_reg.h new file mode 100644 index 0000000000..2f9c68f80b --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/sdmmc_reg.h @@ -0,0 +1,96 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef _SOC_SDMMC_REG_H_ +#define _SOC_SDMMC_REG_H_ +#include "soc.h" + +#define SDMMC_CTRL_REG (DR_REG_SDMMC_BASE + 0x00) +#define SDMMC_PWREN_REG (DR_REG_SDMMC_BASE + 0x04) +#define SDMMC_CLKDIV_REG (DR_REG_SDMMC_BASE + 0x08) +#define SDMMC_CLKSRC_REG (DR_REG_SDMMC_BASE + 0x0c) +#define SDMMC_CLKENA_REG (DR_REG_SDMMC_BASE + 0x10) +#define SDMMC_TMOUT_REG (DR_REG_SDMMC_BASE + 0x14) +#define SDMMC_CTYPE_REG (DR_REG_SDMMC_BASE + 0x18) +#define SDMMC_BLKSIZ_REG (DR_REG_SDMMC_BASE + 0x1c) +#define SDMMC_BYTCNT_REG (DR_REG_SDMMC_BASE + 0x20) +#define SDMMC_INTMASK_REG (DR_REG_SDMMC_BASE + 0x24) +#define SDMMC_CMDARG_REG (DR_REG_SDMMC_BASE + 0x28) +#define SDMMC_CMD_REG (DR_REG_SDMMC_BASE + 0x2c) +#define SDMMC_RESP0_REG (DR_REG_SDMMC_BASE + 0x30) +#define SDMMC_RESP1_REG (DR_REG_SDMMC_BASE + 0x34) +#define SDMMC_RESP2_REG (DR_REG_SDMMC_BASE + 0x38) +#define SDMMC_RESP3_REG (DR_REG_SDMMC_BASE + 0x3c) + +#define SDMMC_MINTSTS_REG (DR_REG_SDMMC_BASE + 0x40) +#define SDMMC_RINTSTS_REG (DR_REG_SDMMC_BASE + 0x44) +#define SDMMC_STATUS_REG (DR_REG_SDMMC_BASE + 0x48) +#define SDMMC_FIFOTH_REG (DR_REG_SDMMC_BASE + 0x4c) +#define SDMMC_CDETECT_REG (DR_REG_SDMMC_BASE + 0x50) +#define SDMMC_WRTPRT_REG (DR_REG_SDMMC_BASE + 0x54) +#define SDMMC_GPIO_REG (DR_REG_SDMMC_BASE + 0x58) +#define SDMMC_TCBCNT_REG (DR_REG_SDMMC_BASE + 0x5c) +#define SDMMC_TBBCNT_REG (DR_REG_SDMMC_BASE + 0x60) +#define SDMMC_DEBNCE_REG (DR_REG_SDMMC_BASE + 0x64) +#define SDMMC_USRID_REG (DR_REG_SDMMC_BASE + 0x68) +#define SDMMC_VERID_REG (DR_REG_SDMMC_BASE + 0x6c) +#define SDMMC_HCON_REG (DR_REG_SDMMC_BASE + 0x70) +#define SDMMC_UHS_REG_REG (DR_REG_SDMMC_BASE + 0x74) +#define SDMMC_RST_N_REG (DR_REG_SDMMC_BASE + 0x78) +#define SDMMC_BMOD_REG (DR_REG_SDMMC_BASE + 0x80) +#define SDMMC_PLDMND_REG (DR_REG_SDMMC_BASE + 0x84) +#define SDMMC_DBADDR_REG (DR_REG_SDMMC_BASE + 0x88) +#define SDMMC_DBADDRU_REG (DR_REG_SDMMC_BASE + 0x8c) +#define SDMMC_IDSTS_REG (DR_REG_SDMMC_BASE + 0x8c) +#define SDMMC_IDINTEN_REG (DR_REG_SDMMC_BASE + 0x90) +#define SDMMC_DSCADDR_REG (DR_REG_SDMMC_BASE + 0x94) +#define SDMMC_DSCADDRL_REG (DR_REG_SDMMC_BASE + 0x98) +#define SDMMC_DSCADDRU_REG (DR_REG_SDMMC_BASE + 0x9c) +#define SDMMC_BUFADDRL_REG (DR_REG_SDMMC_BASE + 0xa0) +#define SDMMC_BUFADDRU_REG (DR_REG_SDMMC_BASE + 0xa4) +#define SDMMC_CARDTHRCTL_REG (DR_REG_SDMMC_BASE + 0x100) +#define SDMMC_BACK_END_POWER_REG (DR_REG_SDMMC_BASE + 0x104) +#define SDMMC_UHS_REG_EXT_REG (DR_REG_SDMMC_BASE + 0x108) +#define SDMMC_EMMC_DDR_REG_REG (DR_REG_SDMMC_BASE + 0x10c) +#define SDMMC_ENABLE_SHIFT_REG (DR_REG_SDMMC_BASE + 0x110) + +#define SDMMC_CLOCK_REG (DR_REG_SDMMC_BASE + 0x800) + +#define SDMMC_INTMASK_IO_SLOT1 BIT(17) +#define SDMMC_INTMASK_IO_SLOT0 BIT(16) +#define SDMMC_INTMASK_EBE BIT(15) +#define SDMMC_INTMASK_ACD BIT(14) +#define SDMMC_INTMASK_SBE BIT(13) +#define SDMMC_INTMASK_HLE BIT(12) +#define SDMMC_INTMASK_FRUN BIT(11) +#define SDMMC_INTMASK_HTO BIT(10) +#define SDMMC_INTMASK_DTO BIT(9) +#define SDMMC_INTMASK_RTO BIT(8) +#define SDMMC_INTMASK_DCRC BIT(7) +#define SDMMC_INTMASK_RCRC BIT(6) +#define SDMMC_INTMASK_RXDR BIT(5) +#define SDMMC_INTMASK_TXDR BIT(4) +#define SDMMC_INTMASK_DATA_OVER BIT(3) +#define SDMMC_INTMASK_CMD_DONE BIT(2) +#define SDMMC_INTMASK_RESP_ERR BIT(1) +#define SDMMC_INTMASK_CD BIT(0) + +#define SDMMC_IDMAC_INTMASK_AI BIT(9) +#define SDMMC_IDMAC_INTMASK_NI BIT(8) +#define SDMMC_IDMAC_INTMASK_CES BIT(5) +#define SDMMC_IDMAC_INTMASK_DU BIT(4) +#define SDMMC_IDMAC_INTMASK_FBE BIT(2) +#define SDMMC_IDMAC_INTMASK_RI BIT(1) +#define SDMMC_IDMAC_INTMASK_TI BIT(0) + +#endif /* _SOC_SDMMC_REG_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/sdmmc_struct.h b/components/soc/esp32s2beta/include/soc/sdmmc_struct.h new file mode 100644 index 0000000000..7e3c6912eb --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/sdmmc_struct.h @@ -0,0 +1,377 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef _SOC_SDMMC_STRUCT_H_ +#define _SOC_SDMMC_STRUCT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + uint32_t reserved1: 1; + uint32_t disable_int_on_completion: 1; + uint32_t last_descriptor: 1; + uint32_t first_descriptor: 1; + uint32_t second_address_chained: 1; + uint32_t end_of_ring: 1; + uint32_t reserved2: 24; + uint32_t card_error_summary: 1; + uint32_t owned_by_idmac: 1; + uint32_t buffer1_size: 13; + uint32_t buffer2_size: 13; + uint32_t reserved3: 6; + void* buffer1_ptr; + union { + void* buffer2_ptr; + void* next_desc_ptr; + }; +} sdmmc_desc_t; + +#define SDMMC_DMA_MAX_BUF_LEN 4096 + +_Static_assert(sizeof(sdmmc_desc_t) == 16, "invalid size of sdmmc_desc_t structure"); + + +typedef struct { + uint32_t cmd_index: 6; ///< Command index + uint32_t response_expect: 1; ///< set if response is expected + uint32_t response_long: 1; ///< 0: short response expected, 1: long response expected + uint32_t check_response_crc: 1; ///< set if controller should check response CRC + uint32_t data_expected: 1; ///< 0: no data expected, 1: data expected + uint32_t rw: 1; ///< 0: read from card, 1: write to card (don't care if no data expected) + uint32_t stream_mode: 1; ///< 0: block transfer, 1: stream transfer (don't care if no data expected) + uint32_t send_auto_stop: 1; ///< set to send stop at the end of the transfer + uint32_t wait_complete: 1; ///< 0: send command at once, 1: wait for previous command to complete + uint32_t stop_abort_cmd: 1; ///< set if this is a stop or abort command intended to stop current transfer + uint32_t send_init: 1; ///< set to send init sequence (80 clocks of 1) + uint32_t card_num: 5; ///< card number + uint32_t update_clk_reg: 1; ///< 0: normal command, 1: don't send command, just update clock registers + uint32_t read_ceata: 1; ///< set if performing read from CE-ATA device + uint32_t ccs_expected: 1; ///< set if CCS is expected from CE-ATA device + uint32_t enable_boot: 1; ///< set for mandatory boot mode + uint32_t expect_boot_ack: 1; ///< when set along with enable_boot, controller expects boot ack pattern + uint32_t disable_boot: 1; ///< set to terminate boot operation (don't set along with enable_boot) + uint32_t boot_mode: 1; ///< 0: mandatory boot operation, 1: alternate boot operation + uint32_t volt_switch: 1; ///< set to enable voltage switching (for CMD11 only) + uint32_t use_hold_reg: 1; ///< clear to bypass HOLD register + uint32_t reserved: 1; + uint32_t start_command: 1; ///< Start command; once command is sent to the card, bit is cleared. +} sdmmc_hw_cmd_t; ///< command format used in cmd register; this structure is defined to make it easier to build command values + +_Static_assert(sizeof(sdmmc_hw_cmd_t) == 4, "invalid size of sdmmc_cmd_t structure"); + + +typedef volatile struct { + union { + struct { + uint32_t controller_reset: 1; + uint32_t fifo_reset: 1; + uint32_t dma_reset: 1; + uint32_t reserved1: 1; + uint32_t int_enable: 1; + uint32_t dma_enable: 1; + uint32_t read_wait: 1; + uint32_t send_irq_response: 1; + uint32_t abort_read_data: 1; + uint32_t send_ccsd: 1; + uint32_t send_auto_stop_ccsd: 1; + uint32_t ceata_device_interrupt_status: 1; + uint32_t reserved2: 4; + uint32_t card_voltage_a: 4; + uint32_t card_voltage_b: 4; + uint32_t enable_od_pullup: 1; + uint32_t use_internal_dma: 1; + uint32_t reserved3: 6; + }; + uint32_t val; + } ctrl; + + uint32_t pwren; ///< 1: enable power to card, 0: disable power to card + + union { + struct { + uint32_t div0: 8; ///< 0: bypass, 1-255: divide clock by (2*div0). + uint32_t div1: 8; ///< 0: bypass, 1-255: divide clock by (2*div0). + uint32_t div2: 8; ///< 0: bypass, 1-255: divide clock by (2*div0). + uint32_t div3: 8; ///< 0: bypass, 1-255: divide clock by (2*div0). + }; + uint32_t val; + } clkdiv; + + union { + struct { + uint32_t card0: 2; ///< 0-3: select clock divider for card 0 among div0-div3 + uint32_t card1: 2; ///< 0-3: select clock divider for card 1 among div0-div3 + uint32_t reserved: 28; + }; + uint32_t val; + } clksrc; + + union { + struct { + uint32_t cclk_enable: 16; ///< 1: enable clock to card, 0: disable clock + uint32_t cclk_low_power: 16; ///< 1: enable clock gating when card is idle, 0: disable clock gating + }; + uint32_t val; + } clkena; + + union { + struct { + uint32_t response: 8; ///< response timeout, in card output clock cycles + uint32_t data: 24; ///< data read timeout, in card output clock cycles + }; + uint32_t val; + } tmout; + + union { + struct { + uint32_t card_width: 16; ///< one bit for each card: 0: 1-bit mode, 1: 4-bit mode + uint32_t card_width_8: 16; ///< one bit for each card: 0: not 8-bit mode (corresponding card_width bit is used), 1: 8-bit mode (card_width bit is ignored) + }; + uint32_t val; + } ctype; + + uint32_t blksiz: 16; ///< block size, default 0x200 + uint32_t : 16; + + uint32_t bytcnt; ///< number of bytes to be transferred + + union { + struct { + uint32_t cd: 1; ///< Card detect interrupt enable + uint32_t re: 1; ///< Response error interrupt enable + uint32_t cmd_done: 1; ///< Command done interrupt enable + uint32_t dto: 1; ///< Data transfer over interrupt enable + uint32_t txdr: 1; ///< Transmit FIFO data request interrupt enable + uint32_t rxdr: 1; ///< Receive FIFO data request interrupt enable + uint32_t rcrc: 1; ///< Response CRC error interrupt enable + uint32_t dcrc: 1; ///< Data CRC error interrupt enable + uint32_t rto: 1; ///< Response timeout interrupt enable + uint32_t drto: 1; ///< Data read timeout interrupt enable + uint32_t hto: 1; ///< Data starvation-by-host timeout interrupt enable + uint32_t frun: 1; ///< FIFO underrun/overrun error interrupt enable + uint32_t hle: 1; ///< Hardware locked write error interrupt enable + uint32_t sbi_bci: 1; ///< Start bit error / busy clear interrupt enable + uint32_t acd: 1; ///< Auto command done interrupt enable + uint32_t ebe: 1; ///< End bit error / write no CRC interrupt enable + uint32_t sdio: 16; ///< SDIO interrupt enable + }; + uint32_t val; + } intmask; + + uint32_t cmdarg; ///< Command argument to be passed to card + + sdmmc_hw_cmd_t cmd; + + uint32_t resp[4]; ///< Response from card + + union { + struct { + uint32_t cd: 1; ///< Card detect interrupt masked status + uint32_t re: 1; ///< Response error interrupt masked status + uint32_t cmd_done: 1; ///< Command done interrupt masked status + uint32_t dto: 1; ///< Data transfer over interrupt masked status + uint32_t txdr: 1; ///< Transmit FIFO data request interrupt masked status + uint32_t rxdr: 1; ///< Receive FIFO data request interrupt masked status + uint32_t rcrc: 1; ///< Response CRC error interrupt masked status + uint32_t dcrc: 1; ///< Data CRC error interrupt masked status + uint32_t rto: 1; ///< Response timeout interrupt masked status + uint32_t drto: 1; ///< Data read timeout interrupt masked status + uint32_t hto: 1; ///< Data starvation-by-host timeout interrupt masked status + uint32_t frun: 1; ///< FIFO underrun/overrun error interrupt masked status + uint32_t hle: 1; ///< Hardware locked write error interrupt masked status + uint32_t sbi_bci: 1; ///< Start bit error / busy clear interrupt masked status + uint32_t acd: 1; ///< Auto command done interrupt masked status + uint32_t ebe: 1; ///< End bit error / write no CRC interrupt masked status + uint32_t sdio: 16; ///< SDIO interrupt masked status + }; + uint32_t val; + } mintsts; + + union { + struct { + uint32_t cd: 1; ///< Card detect raw interrupt status + uint32_t re: 1; ///< Response error raw interrupt status + uint32_t cmd_done: 1; ///< Command done raw interrupt status + uint32_t dto: 1; ///< Data transfer over raw interrupt status + uint32_t txdr: 1; ///< Transmit FIFO data request raw interrupt status + uint32_t rxdr: 1; ///< Receive FIFO data request raw interrupt status + uint32_t rcrc: 1; ///< Response CRC error raw interrupt status + uint32_t dcrc: 1; ///< Data CRC error raw interrupt status + uint32_t rto: 1; ///< Response timeout raw interrupt status + uint32_t drto: 1; ///< Data read timeout raw interrupt status + uint32_t hto: 1; ///< Data starvation-by-host timeout raw interrupt status + uint32_t frun: 1; ///< FIFO underrun/overrun error raw interrupt status + uint32_t hle: 1; ///< Hardware locked write error raw interrupt status + uint32_t sbi_bci: 1; ///< Start bit error / busy clear raw interrupt status + uint32_t acd: 1; ///< Auto command done raw interrupt status + uint32_t ebe: 1; ///< End bit error / write no CRC raw interrupt status + uint32_t sdio: 16; ///< SDIO raw interrupt status + }; + uint32_t val; + } rintsts; ///< interrupts can be cleared by writing this register + + union { + struct { + uint32_t fifo_rx_watermark: 1; ///< FIFO reached receive watermark level + uint32_t fifo_tx_watermark: 1; ///< FIFO reached transmit watermark level + uint32_t fifo_empty: 1; ///< FIFO is empty + uint32_t fifo_full: 1; ///< FIFO is full + uint32_t cmd_fsm_state: 4; ///< command FSM state + uint32_t data3_status: 1; ///< this bit reads 1 if card is present + uint32_t data_busy: 1; ///< this bit reads 1 if card is busy + uint32_t data_fsm_busy: 1; ///< this bit reads 1 if transmit/receive FSM is busy + uint32_t response_index: 6; ///< index of the previous response + uint32_t fifo_count: 13; ///< number of filled locations in the FIFO + uint32_t dma_ack: 1; ///< DMA acknowledge signal + uint32_t dma_req: 1; ///< DMA request signal + }; + uint32_t val; + } status; + + union { + struct { + uint32_t tx_watermark: 12; ///< FIFO TX watermark level + uint32_t reserved1: 4; + uint32_t rx_watermark: 12; ///< FIFO RX watermark level + uint32_t dw_dma_mts: 3; + uint32_t reserved2: 1; + }; + uint32_t val; + } fifoth; + + union { + struct { + uint32_t cards: 2; ///< bit N reads 0 if card N is present + uint32_t reserved: 30; + }; + uint32_t val; + } cdetect; + + union { + struct { + uint32_t cards: 2; ///< bit N reads 1 if card N is write protected + uint32_t reserved: 30; + }; + uint32_t val; + } wrtprt; + + uint32_t gpio; ///< unused + uint32_t tcbcnt; ///< transferred (to card) byte count + uint32_t tbbcnt; ///< transferred from host to FIFO byte count + + union { + struct { + uint32_t debounce_count: 24; ///< number of host cycles used by debounce filter, typical time should be 5-25ms + uint32_t reserved: 8; + }; + } debnce; + + uint32_t usrid; ///< user ID + uint32_t verid; ///< IP block version + uint32_t hcon; ///< compile-time IP configuration + uint32_t uhs; ///< TBD + + union { + struct { + uint32_t cards: 2; ///< bit N resets card N, active low + uint32_t reserved: 30; + }; + } rst_n; + + uint32_t reserved_7c; + + union { + struct { + uint32_t sw_reset: 1; ///< set to reset DMA controller + uint32_t fb: 1; ///< set if AHB master performs fixed burst transfers + uint32_t dsl: 5; ///< descriptor skip length: number of words to skip between two unchained descriptors + uint32_t enable: 1; ///< set to enable IDMAC + uint32_t pbl: 3; ///< programmable burst length + uint32_t reserved: 21; + }; + uint32_t val; + } bmod; + + uint32_t pldmnd; ///< set any bit to resume IDMAC FSM from suspended state + sdmmc_desc_t* dbaddr; ///< descriptor list base + + union { + struct { + uint32_t ti: 1; ///< transmit interrupt status + uint32_t ri: 1; ///< receive interrupt status + uint32_t fbe: 1; ///< fatal bus error + uint32_t reserved1: 1; + uint32_t du: 1; ///< descriptor unavailable + uint32_t ces: 1; ///< card error summary + uint32_t reserved2: 2; + uint32_t nis: 1; ///< normal interrupt summary + uint32_t fbe_code: 3; ///< code of fatal bus error + uint32_t fsm: 4; ///< DMAC FSM state + uint32_t reserved3: 15; + }; + uint32_t val; + } idsts; + + union { + struct { + uint32_t ti: 1; ///< transmit interrupt enable + uint32_t ri: 1; ///< receive interrupt enable + uint32_t fbe: 1; ///< fatal bus error interrupt enable + uint32_t reserved1: 1; + uint32_t du: 1; ///< descriptor unavailable interrupt enable + uint32_t ces: 1; ///< card error interrupt enable + uint32_t reserved2: 2; + uint32_t ni: 1; ///< normal interrupt interrupt enable + uint32_t ai: 1; ///< abnormal interrupt enable + uint32_t reserved3: 22; + }; + uint32_t val; + } idinten; + + uint32_t dscaddr; ///< current host descriptor address + uint32_t dscaddrl; ///< unused + uint32_t dscaddru; ///< unused + uint32_t bufaddrl; ///< unused + uint32_t bufaddru; ///< unused + uint32_t reserved_a8[22]; + uint32_t cardthrctl; + uint32_t back_end_power; + uint32_t uhs_reg_ext; + uint32_t emmc_ddr_reg; + uint32_t enable_shift; + uint32_t reserved_114[443]; + union { + struct { + uint32_t phase_dout: 3; ///< phase of data output clock (0x0: 0, 0x1: 90, 0x4: 180, 0x6: 270) + uint32_t phase_din: 3; ///< phase of data input clock + uint32_t phase_core: 3; ///< phase of the clock to SDMMC peripheral + uint32_t div_factor_p: 4; ///< controls clock period; it will be (div_factor_p + 1) / 160MHz + uint32_t div_factor_h: 4; ///< controls length of high pulse; it will be (div_factor_h + 1) / 160MHz + uint32_t div_factor_m: 4; ///< should be equal to div_factor_p + }; + uint32_t val; + } clock; +} sdmmc_dev_t; +extern sdmmc_dev_t SDMMC; + +_Static_assert(sizeof(sdmmc_dev_t) == 0x804, "invalid size of sdmmc_dev_t structure"); + +#ifdef __cplusplus +} +#endif + +#endif //_SOC_SDMMC_STRUCT_H_ diff --git a/components/soc/esp32s2beta/include/soc/sens_reg.h b/components/soc/esp32s2beta/include/soc/sens_reg.h new file mode 100644 index 0000000000..13c454ae08 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/sens_reg.h @@ -0,0 +1,1626 @@ +// Copyright 2017-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_SENS_REG_H_ +#define _SOC_SENS_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define SENS_SAR_READER1_CTRL_REG (DR_REG_SENS_BASE + 0x0000) +/* SENS_SAR1_INT_EN : R/W ;bitpos:[29] ;default: 1'b1 ; */ +/*description: enable saradc1 to send out interrupt*/ +#define SENS_SAR1_INT_EN (BIT(29)) +#define SENS_SAR1_INT_EN_M (BIT(29)) +#define SENS_SAR1_INT_EN_V 0x1 +#define SENS_SAR1_INT_EN_S 29 +/* SENS_SAR1_DATA_INV : R/W ;bitpos:[28] ;default: 1'd0 ; */ +/*description: Invert SAR ADC1 data*/ +#define SENS_SAR1_DATA_INV (BIT(28)) +#define SENS_SAR1_DATA_INV_M (BIT(28)) +#define SENS_SAR1_DATA_INV_V 0x1 +#define SENS_SAR1_DATA_INV_S 28 +/* SENS_SAR1_SAMPLE_NUM : R/W ;bitpos:[26:19] ;default: 8'd0 ; */ +/*description: */ +#define SENS_SAR1_SAMPLE_NUM 0x000000FF +#define SENS_SAR1_SAMPLE_NUM_M ((SENS_SAR1_SAMPLE_NUM_V)<<(SENS_SAR1_SAMPLE_NUM_S)) +#define SENS_SAR1_SAMPLE_NUM_V 0xFF +#define SENS_SAR1_SAMPLE_NUM_S 19 +/* SENS_SAR1_CLK_GATED : R/W ;bitpos:[18] ;default: 1'b1 ; */ +/*description: */ +#define SENS_SAR1_CLK_GATED (BIT(18)) +#define SENS_SAR1_CLK_GATED_M (BIT(18)) +#define SENS_SAR1_CLK_GATED_V 0x1 +#define SENS_SAR1_CLK_GATED_S 18 +/* SENS_SAR1_SAMPLE_BIT : R/W ;bitpos:[17:16] ;default: 2'd3 ; */ +/*description: 00: for 9-bit width*/ +#define SENS_SAR1_SAMPLE_BIT 0x00000003 +#define SENS_SAR1_SAMPLE_BIT_M ((SENS_SAR1_SAMPLE_BIT_V)<<(SENS_SAR1_SAMPLE_BIT_S)) +#define SENS_SAR1_SAMPLE_BIT_V 0x3 +#define SENS_SAR1_SAMPLE_BIT_S 16 +/* SENS_SAR1_SAMPLE_CYCLE : R/W ;bitpos:[15:8] ;default: 8'd9 ; */ +/*description: sample cycles for SAR ADC1*/ +#define SENS_SAR1_SAMPLE_CYCLE 0x000000FF +#define SENS_SAR1_SAMPLE_CYCLE_M ((SENS_SAR1_SAMPLE_CYCLE_V)<<(SENS_SAR1_SAMPLE_CYCLE_S)) +#define SENS_SAR1_SAMPLE_CYCLE_V 0xFF +#define SENS_SAR1_SAMPLE_CYCLE_S 8 +/* SENS_SAR1_CLK_DIV : R/W ;bitpos:[7:0] ;default: 8'd2 ; */ +/*description: clock divider*/ +#define SENS_SAR1_CLK_DIV 0x000000FF +#define SENS_SAR1_CLK_DIV_M ((SENS_SAR1_CLK_DIV_V)<<(SENS_SAR1_CLK_DIV_S)) +#define SENS_SAR1_CLK_DIV_V 0xFF +#define SENS_SAR1_CLK_DIV_S 0 + +#define SENS_SAR_READER1_STATUS_REG (DR_REG_SENS_BASE + 0x0004) +/* SENS_SAR1_READER_STATUS : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SENS_SAR1_READER_STATUS 0xFFFFFFFF +#define SENS_SAR1_READER_STATUS_M ((SENS_SAR1_READER_STATUS_V)<<(SENS_SAR1_READER_STATUS_S)) +#define SENS_SAR1_READER_STATUS_V 0xFFFFFFFF +#define SENS_SAR1_READER_STATUS_S 0 + +#define SENS_SAR_MEAS1_CTRL1_REG (DR_REG_SENS_BASE + 0x0008) +/* SENS_AMP_SHORT_REF_GND_FORCE : R/W ;bitpos:[31:30] ;default: 2'b0 ; */ +/*description: */ +#define SENS_AMP_SHORT_REF_GND_FORCE 0x00000003 +#define SENS_AMP_SHORT_REF_GND_FORCE_M ((SENS_AMP_SHORT_REF_GND_FORCE_V)<<(SENS_AMP_SHORT_REF_GND_FORCE_S)) +#define SENS_AMP_SHORT_REF_GND_FORCE_V 0x3 +#define SENS_AMP_SHORT_REF_GND_FORCE_S 30 +/* SENS_AMP_SHORT_REF_FORCE : R/W ;bitpos:[29:28] ;default: 2'b0 ; */ +/*description: */ +#define SENS_AMP_SHORT_REF_FORCE 0x00000003 +#define SENS_AMP_SHORT_REF_FORCE_M ((SENS_AMP_SHORT_REF_FORCE_V)<<(SENS_AMP_SHORT_REF_FORCE_S)) +#define SENS_AMP_SHORT_REF_FORCE_V 0x3 +#define SENS_AMP_SHORT_REF_FORCE_S 28 +/* SENS_AMP_RST_FB_FORCE : R/W ;bitpos:[27:26] ;default: 2'b0 ; */ +/*description: */ +#define SENS_AMP_RST_FB_FORCE 0x00000003 +#define SENS_AMP_RST_FB_FORCE_M ((SENS_AMP_RST_FB_FORCE_V)<<(SENS_AMP_RST_FB_FORCE_S)) +#define SENS_AMP_RST_FB_FORCE_V 0x3 +#define SENS_AMP_RST_FB_FORCE_S 26 +/* SENS_FORCE_XPD_AMP : R/W ;bitpos:[25:24] ;default: 2'd0 ; */ +/*description: */ +#define SENS_FORCE_XPD_AMP 0x00000003 +#define SENS_FORCE_XPD_AMP_M ((SENS_FORCE_XPD_AMP_V)<<(SENS_FORCE_XPD_AMP_S)) +#define SENS_FORCE_XPD_AMP_V 0x3 +#define SENS_FORCE_XPD_AMP_S 24 +/* SENS_SAR1_STOP : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: stop SAR ADC1 conversion*/ +#define SENS_SAR1_STOP (BIT(2)) +#define SENS_SAR1_STOP_M (BIT(2)) +#define SENS_SAR1_STOP_V 0x1 +#define SENS_SAR1_STOP_S 2 +/* SENS_SAR1_BIT_WIDTH : R/W ;bitpos:[1:0] ;default: 2'b11 ; */ +/*description: 00: 9 bit*/ +#define SENS_SAR1_BIT_WIDTH 0x00000003 +#define SENS_SAR1_BIT_WIDTH_M ((SENS_SAR1_BIT_WIDTH_V)<<(SENS_SAR1_BIT_WIDTH_S)) +#define SENS_SAR1_BIT_WIDTH_V 0x3 +#define SENS_SAR1_BIT_WIDTH_S 0 + +#define SENS_SAR_MEAS1_CTRL2_REG (DR_REG_SENS_BASE + 0x000c) +/* SENS_SAR1_EN_PAD_FORCE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: 1: SAR ADC1 pad enable bitmap is controlled by SW*/ +#define SENS_SAR1_EN_PAD_FORCE (BIT(31)) +#define SENS_SAR1_EN_PAD_FORCE_M (BIT(31)) +#define SENS_SAR1_EN_PAD_FORCE_V 0x1 +#define SENS_SAR1_EN_PAD_FORCE_S 31 +/* SENS_SAR1_EN_PAD : R/W ;bitpos:[30:19] ;default: 12'b0 ; */ +/*description: SAR ADC1 pad enable bitmap*/ +#define SENS_SAR1_EN_PAD 0x00000FFF +#define SENS_SAR1_EN_PAD_M ((SENS_SAR1_EN_PAD_V)<<(SENS_SAR1_EN_PAD_S)) +#define SENS_SAR1_EN_PAD_V 0xFFF +#define SENS_SAR1_EN_PAD_S 19 +/* SENS_MEAS1_START_FORCE : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: 1: SAR ADC1 controller (in RTC) is started by SW*/ +#define SENS_MEAS1_START_FORCE (BIT(18)) +#define SENS_MEAS1_START_FORCE_M (BIT(18)) +#define SENS_MEAS1_START_FORCE_V 0x1 +#define SENS_MEAS1_START_FORCE_S 18 +/* SENS_MEAS1_START_SAR : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: SAR ADC1 controller (in RTC) starts conversion*/ +#define SENS_MEAS1_START_SAR (BIT(17)) +#define SENS_MEAS1_START_SAR_M (BIT(17)) +#define SENS_MEAS1_START_SAR_V 0x1 +#define SENS_MEAS1_START_SAR_S 17 +/* SENS_MEAS1_DONE_SAR : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: SAR ADC1 conversion done indication*/ +#define SENS_MEAS1_DONE_SAR (BIT(16)) +#define SENS_MEAS1_DONE_SAR_M (BIT(16)) +#define SENS_MEAS1_DONE_SAR_V 0x1 +#define SENS_MEAS1_DONE_SAR_S 16 +/* SENS_MEAS1_DATA_SAR : RO ;bitpos:[15:0] ;default: 16'b0 ; */ +/*description: SAR ADC1 data*/ +#define SENS_MEAS1_DATA_SAR 0x0000FFFF +#define SENS_MEAS1_DATA_SAR_M ((SENS_MEAS1_DATA_SAR_V)<<(SENS_MEAS1_DATA_SAR_S)) +#define SENS_MEAS1_DATA_SAR_V 0xFFFF +#define SENS_MEAS1_DATA_SAR_S 0 + +#define SENS_SAR_MEAS1_MUX_REG (DR_REG_SENS_BASE + 0x0010) +/* SENS_SAR1_DIG_FORCE : R/W ;bitpos:[31] ;default: 1'd0 ; */ +/*description: 1: SAR ADC1 controlled by DIG ADC1 CTRL*/ +#define SENS_SAR1_DIG_FORCE (BIT(31)) +#define SENS_SAR1_DIG_FORCE_M (BIT(31)) +#define SENS_SAR1_DIG_FORCE_V 0x1 +#define SENS_SAR1_DIG_FORCE_S 31 + +#define SENS_SAR_ATTEN1_REG (DR_REG_SENS_BASE + 0x0014) +/* SENS_SAR1_ATTEN : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ +/*description: 2-bit attenuation for each pad*/ +#define SENS_SAR1_ATTEN 0xFFFFFFFF +#define SENS_SAR1_ATTEN_M ((SENS_SAR1_ATTEN_V)<<(SENS_SAR1_ATTEN_S)) +#define SENS_SAR1_ATTEN_V 0xFFFFFFFF +#define SENS_SAR1_ATTEN_S 0 + +#define SENS_SAR_AMP_CTRL1_REG (DR_REG_SENS_BASE + 0x0018) +/* SENS_SAR_AMP_WAIT2 : R/W ;bitpos:[31:16] ;default: 16'd10 ; */ +/*description: */ +#define SENS_SAR_AMP_WAIT2 0x0000FFFF +#define SENS_SAR_AMP_WAIT2_M ((SENS_SAR_AMP_WAIT2_V)<<(SENS_SAR_AMP_WAIT2_S)) +#define SENS_SAR_AMP_WAIT2_V 0xFFFF +#define SENS_SAR_AMP_WAIT2_S 16 +/* SENS_SAR_AMP_WAIT1 : R/W ;bitpos:[15:0] ;default: 16'd10 ; */ +/*description: */ +#define SENS_SAR_AMP_WAIT1 0x0000FFFF +#define SENS_SAR_AMP_WAIT1_M ((SENS_SAR_AMP_WAIT1_V)<<(SENS_SAR_AMP_WAIT1_S)) +#define SENS_SAR_AMP_WAIT1_V 0xFFFF +#define SENS_SAR_AMP_WAIT1_S 0 + +#define SENS_SAR_AMP_CTRL2_REG (DR_REG_SENS_BASE + 0x001c) +/* SENS_SAR_AMP_WAIT3 : R/W ;bitpos:[31:16] ;default: 16'd10 ; */ +/*description: */ +#define SENS_SAR_AMP_WAIT3 0x0000FFFF +#define SENS_SAR_AMP_WAIT3_M ((SENS_SAR_AMP_WAIT3_V)<<(SENS_SAR_AMP_WAIT3_S)) +#define SENS_SAR_AMP_WAIT3_V 0xFFFF +#define SENS_SAR_AMP_WAIT3_S 16 +/* SENS_SAR_RSTB_FSM_IDLE : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SENS_SAR_RSTB_FSM_IDLE (BIT(6)) +#define SENS_SAR_RSTB_FSM_IDLE_M (BIT(6)) +#define SENS_SAR_RSTB_FSM_IDLE_V 0x1 +#define SENS_SAR_RSTB_FSM_IDLE_S 6 +/* SENS_XPD_SAR_FSM_IDLE : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SENS_XPD_SAR_FSM_IDLE (BIT(5)) +#define SENS_XPD_SAR_FSM_IDLE_M (BIT(5)) +#define SENS_XPD_SAR_FSM_IDLE_V 0x1 +#define SENS_XPD_SAR_FSM_IDLE_S 5 +/* SENS_AMP_SHORT_REF_GND_FSM_IDLE : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define SENS_AMP_SHORT_REF_GND_FSM_IDLE (BIT(4)) +#define SENS_AMP_SHORT_REF_GND_FSM_IDLE_M (BIT(4)) +#define SENS_AMP_SHORT_REF_GND_FSM_IDLE_V 0x1 +#define SENS_AMP_SHORT_REF_GND_FSM_IDLE_S 4 +/* SENS_AMP_SHORT_REF_FSM_IDLE : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SENS_AMP_SHORT_REF_FSM_IDLE (BIT(3)) +#define SENS_AMP_SHORT_REF_FSM_IDLE_M (BIT(3)) +#define SENS_AMP_SHORT_REF_FSM_IDLE_V 0x1 +#define SENS_AMP_SHORT_REF_FSM_IDLE_S 3 +/* SENS_AMP_RST_FB_FSM_IDLE : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SENS_AMP_RST_FB_FSM_IDLE (BIT(2)) +#define SENS_AMP_RST_FB_FSM_IDLE_M (BIT(2)) +#define SENS_AMP_RST_FB_FSM_IDLE_V 0x1 +#define SENS_AMP_RST_FB_FSM_IDLE_S 2 +/* SENS_XPD_SAR_AMP_FSM_IDLE : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SENS_XPD_SAR_AMP_FSM_IDLE (BIT(1)) +#define SENS_XPD_SAR_AMP_FSM_IDLE_M (BIT(1)) +#define SENS_XPD_SAR_AMP_FSM_IDLE_V 0x1 +#define SENS_XPD_SAR_AMP_FSM_IDLE_S 1 +/* SENS_SAR1_DAC_XPD_FSM_IDLE : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SENS_SAR1_DAC_XPD_FSM_IDLE (BIT(0)) +#define SENS_SAR1_DAC_XPD_FSM_IDLE_M (BIT(0)) +#define SENS_SAR1_DAC_XPD_FSM_IDLE_V 0x1 +#define SENS_SAR1_DAC_XPD_FSM_IDLE_S 0 + +#define SENS_SAR_AMP_CTRL3_REG (DR_REG_SENS_BASE + 0x0020) +/* SENS_SAR_RSTB_FSM : R/W ;bitpos:[27:24] ;default: 4'b0000 ; */ +/*description: */ +#define SENS_SAR_RSTB_FSM 0x0000000F +#define SENS_SAR_RSTB_FSM_M ((SENS_SAR_RSTB_FSM_V)<<(SENS_SAR_RSTB_FSM_S)) +#define SENS_SAR_RSTB_FSM_V 0xF +#define SENS_SAR_RSTB_FSM_S 24 +/* SENS_XPD_SAR_FSM : R/W ;bitpos:[23:20] ;default: 4'b0111 ; */ +/*description: */ +#define SENS_XPD_SAR_FSM 0x0000000F +#define SENS_XPD_SAR_FSM_M ((SENS_XPD_SAR_FSM_V)<<(SENS_XPD_SAR_FSM_S)) +#define SENS_XPD_SAR_FSM_V 0xF +#define SENS_XPD_SAR_FSM_S 20 +/* SENS_AMP_SHORT_REF_GND_FSM : R/W ;bitpos:[19:16] ;default: 4'b0011 ; */ +/*description: */ +#define SENS_AMP_SHORT_REF_GND_FSM 0x0000000F +#define SENS_AMP_SHORT_REF_GND_FSM_M ((SENS_AMP_SHORT_REF_GND_FSM_V)<<(SENS_AMP_SHORT_REF_GND_FSM_S)) +#define SENS_AMP_SHORT_REF_GND_FSM_V 0xF +#define SENS_AMP_SHORT_REF_GND_FSM_S 16 +/* SENS_AMP_SHORT_REF_FSM : R/W ;bitpos:[15:12] ;default: 4'b0011 ; */ +/*description: */ +#define SENS_AMP_SHORT_REF_FSM 0x0000000F +#define SENS_AMP_SHORT_REF_FSM_M ((SENS_AMP_SHORT_REF_FSM_V)<<(SENS_AMP_SHORT_REF_FSM_S)) +#define SENS_AMP_SHORT_REF_FSM_V 0xF +#define SENS_AMP_SHORT_REF_FSM_S 12 +/* SENS_AMP_RST_FB_FSM : R/W ;bitpos:[11:8] ;default: 4'b1000 ; */ +/*description: */ +#define SENS_AMP_RST_FB_FSM 0x0000000F +#define SENS_AMP_RST_FB_FSM_M ((SENS_AMP_RST_FB_FSM_V)<<(SENS_AMP_RST_FB_FSM_S)) +#define SENS_AMP_RST_FB_FSM_V 0xF +#define SENS_AMP_RST_FB_FSM_S 8 +/* SENS_XPD_SAR_AMP_FSM : R/W ;bitpos:[7:4] ;default: 4'b1111 ; */ +/*description: */ +#define SENS_XPD_SAR_AMP_FSM 0x0000000F +#define SENS_XPD_SAR_AMP_FSM_M ((SENS_XPD_SAR_AMP_FSM_V)<<(SENS_XPD_SAR_AMP_FSM_S)) +#define SENS_XPD_SAR_AMP_FSM_V 0xF +#define SENS_XPD_SAR_AMP_FSM_S 4 +/* SENS_SAR1_DAC_XPD_FSM : R/W ;bitpos:[3:0] ;default: 4'b0011 ; */ +/*description: */ +#define SENS_SAR1_DAC_XPD_FSM 0x0000000F +#define SENS_SAR1_DAC_XPD_FSM_M ((SENS_SAR1_DAC_XPD_FSM_V)<<(SENS_SAR1_DAC_XPD_FSM_S)) +#define SENS_SAR1_DAC_XPD_FSM_V 0xF +#define SENS_SAR1_DAC_XPD_FSM_S 0 + +#define SENS_SAR_READER2_CTRL_REG (DR_REG_SENS_BASE + 0x0024) +/* SENS_SAR2_INT_EN : R/W ;bitpos:[30] ;default: 1'b1 ; */ +/*description: enable saradc2 to send out interrupt*/ +#define SENS_SAR2_INT_EN (BIT(30)) +#define SENS_SAR2_INT_EN_M (BIT(30)) +#define SENS_SAR2_INT_EN_V 0x1 +#define SENS_SAR2_INT_EN_S 30 +/* SENS_SAR2_DATA_INV : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: Invert SAR ADC2 data*/ +#define SENS_SAR2_DATA_INV (BIT(29)) +#define SENS_SAR2_DATA_INV_M (BIT(29)) +#define SENS_SAR2_DATA_INV_V 0x1 +#define SENS_SAR2_DATA_INV_S 29 +/* SENS_SAR2_SAMPLE_NUM : R/W ;bitpos:[26:19] ;default: 8'd0 ; */ +/*description: */ +#define SENS_SAR2_SAMPLE_NUM 0x000000FF +#define SENS_SAR2_SAMPLE_NUM_M ((SENS_SAR2_SAMPLE_NUM_V)<<(SENS_SAR2_SAMPLE_NUM_S)) +#define SENS_SAR2_SAMPLE_NUM_V 0xFF +#define SENS_SAR2_SAMPLE_NUM_S 19 +/* SENS_SAR2_CLK_GATED : R/W ;bitpos:[18] ;default: 1'b1 ; */ +/*description: */ +#define SENS_SAR2_CLK_GATED (BIT(18)) +#define SENS_SAR2_CLK_GATED_M (BIT(18)) +#define SENS_SAR2_CLK_GATED_V 0x1 +#define SENS_SAR2_CLK_GATED_S 18 +/* SENS_SAR2_SAMPLE_BIT : R/W ;bitpos:[17:16] ;default: 2'd3 ; */ +/*description: 00: for 9-bit width*/ +#define SENS_SAR2_SAMPLE_BIT 0x00000003 +#define SENS_SAR2_SAMPLE_BIT_M ((SENS_SAR2_SAMPLE_BIT_V)<<(SENS_SAR2_SAMPLE_BIT_S)) +#define SENS_SAR2_SAMPLE_BIT_V 0x3 +#define SENS_SAR2_SAMPLE_BIT_S 16 +/* SENS_SAR2_SAMPLE_CYCLE : R/W ;bitpos:[15:8] ;default: 8'd9 ; */ +/*description: sample cycles for SAR ADC2*/ +#define SENS_SAR2_SAMPLE_CYCLE 0x000000FF +#define SENS_SAR2_SAMPLE_CYCLE_M ((SENS_SAR2_SAMPLE_CYCLE_V)<<(SENS_SAR2_SAMPLE_CYCLE_S)) +#define SENS_SAR2_SAMPLE_CYCLE_V 0xFF +#define SENS_SAR2_SAMPLE_CYCLE_S 8 +/* SENS_SAR2_CLK_DIV : R/W ;bitpos:[7:0] ;default: 8'd2 ; */ +/*description: clock divider*/ +#define SENS_SAR2_CLK_DIV 0x000000FF +#define SENS_SAR2_CLK_DIV_M ((SENS_SAR2_CLK_DIV_V)<<(SENS_SAR2_CLK_DIV_S)) +#define SENS_SAR2_CLK_DIV_V 0xFF +#define SENS_SAR2_CLK_DIV_S 0 + +#define SENS_SAR_READER2_STATUS_REG (DR_REG_SENS_BASE + 0x0028) +/* SENS_SAR2_READER_STATUS : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SENS_SAR2_READER_STATUS 0xFFFFFFFF +#define SENS_SAR2_READER_STATUS_M ((SENS_SAR2_READER_STATUS_V)<<(SENS_SAR2_READER_STATUS_S)) +#define SENS_SAR2_READER_STATUS_V 0xFFFFFFFF +#define SENS_SAR2_READER_STATUS_S 0 + +#define SENS_SAR_MEAS2_CTRL1_REG (DR_REG_SENS_BASE + 0x002c) +/* SENS_SAR2_XPD_WAIT : R/W ;bitpos:[31:24] ;default: 8'h7 ; */ +/*description: */ +#define SENS_SAR2_XPD_WAIT 0x000000FF +#define SENS_SAR2_XPD_WAIT_M ((SENS_SAR2_XPD_WAIT_V)<<(SENS_SAR2_XPD_WAIT_S)) +#define SENS_SAR2_XPD_WAIT_V 0xFF +#define SENS_SAR2_XPD_WAIT_S 24 +/* SENS_SAR2_RSTB_WAIT : R/W ;bitpos:[23:16] ;default: 8'd2 ; */ +/*description: */ +#define SENS_SAR2_RSTB_WAIT 0x000000FF +#define SENS_SAR2_RSTB_WAIT_M ((SENS_SAR2_RSTB_WAIT_V)<<(SENS_SAR2_RSTB_WAIT_S)) +#define SENS_SAR2_RSTB_WAIT_V 0xFF +#define SENS_SAR2_RSTB_WAIT_S 16 +/* SENS_SAR2_STANDBY_WAIT : R/W ;bitpos:[15:8] ;default: 8'd2 ; */ +/*description: */ +#define SENS_SAR2_STANDBY_WAIT 0x000000FF +#define SENS_SAR2_STANDBY_WAIT_M ((SENS_SAR2_STANDBY_WAIT_V)<<(SENS_SAR2_STANDBY_WAIT_S)) +#define SENS_SAR2_STANDBY_WAIT_V 0xFF +#define SENS_SAR2_STANDBY_WAIT_S 8 +/* SENS_SAR2_RSTB_FORCE : R/W ;bitpos:[7:6] ;default: 2'b0 ; */ +/*description: */ +#define SENS_SAR2_RSTB_FORCE 0x00000003 +#define SENS_SAR2_RSTB_FORCE_M ((SENS_SAR2_RSTB_FORCE_V)<<(SENS_SAR2_RSTB_FORCE_S)) +#define SENS_SAR2_RSTB_FORCE_V 0x3 +#define SENS_SAR2_RSTB_FORCE_S 6 +/* SENS_SAR2_EN_TEST : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: SAR2_EN_TEST*/ +#define SENS_SAR2_EN_TEST (BIT(5)) +#define SENS_SAR2_EN_TEST_M (BIT(5)) +#define SENS_SAR2_EN_TEST_V 0x1 +#define SENS_SAR2_EN_TEST_S 5 +/* SENS_SAR2_PKDET_CAL_EN : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: rtc control pkdet enable*/ +#define SENS_SAR2_PKDET_CAL_EN (BIT(4)) +#define SENS_SAR2_PKDET_CAL_EN_M (BIT(4)) +#define SENS_SAR2_PKDET_CAL_EN_V 0x1 +#define SENS_SAR2_PKDET_CAL_EN_S 4 +/* SENS_SAR2_PWDET_CAL_EN : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: rtc control pwdet enable*/ +#define SENS_SAR2_PWDET_CAL_EN (BIT(3)) +#define SENS_SAR2_PWDET_CAL_EN_M (BIT(3)) +#define SENS_SAR2_PWDET_CAL_EN_V 0x1 +#define SENS_SAR2_PWDET_CAL_EN_S 3 +/* SENS_SAR2_STOP : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: stop SAR ADC2 conversion*/ +#define SENS_SAR2_STOP (BIT(2)) +#define SENS_SAR2_STOP_M (BIT(2)) +#define SENS_SAR2_STOP_V 0x1 +#define SENS_SAR2_STOP_S 2 +/* SENS_SAR2_BIT_WIDTH : R/W ;bitpos:[1:0] ;default: 2'b11 ; */ +/*description: 00: 9 bit*/ +#define SENS_SAR2_BIT_WIDTH 0x00000003 +#define SENS_SAR2_BIT_WIDTH_M ((SENS_SAR2_BIT_WIDTH_V)<<(SENS_SAR2_BIT_WIDTH_S)) +#define SENS_SAR2_BIT_WIDTH_V 0x3 +#define SENS_SAR2_BIT_WIDTH_S 0 + +#define SENS_SAR_MEAS2_CTRL2_REG (DR_REG_SENS_BASE + 0x0030) +/* SENS_SAR2_EN_PAD_FORCE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: 1: SAR ADC2 pad enable bitmap is controlled by SW*/ +#define SENS_SAR2_EN_PAD_FORCE (BIT(31)) +#define SENS_SAR2_EN_PAD_FORCE_M (BIT(31)) +#define SENS_SAR2_EN_PAD_FORCE_V 0x1 +#define SENS_SAR2_EN_PAD_FORCE_S 31 +/* SENS_SAR2_EN_PAD : R/W ;bitpos:[30:19] ;default: 12'b0 ; */ +/*description: SAR ADC2 pad enable bitmap*/ +#define SENS_SAR2_EN_PAD 0x00000FFF +#define SENS_SAR2_EN_PAD_M ((SENS_SAR2_EN_PAD_V)<<(SENS_SAR2_EN_PAD_S)) +#define SENS_SAR2_EN_PAD_V 0xFFF +#define SENS_SAR2_EN_PAD_S 19 +/* SENS_MEAS2_START_FORCE : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: 1: SAR ADC2 controller (in RTC) is started by SW*/ +#define SENS_MEAS2_START_FORCE (BIT(18)) +#define SENS_MEAS2_START_FORCE_M (BIT(18)) +#define SENS_MEAS2_START_FORCE_V 0x1 +#define SENS_MEAS2_START_FORCE_S 18 +/* SENS_MEAS2_START_SAR : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: SAR ADC2 controller (in RTC) starts conversion*/ +#define SENS_MEAS2_START_SAR (BIT(17)) +#define SENS_MEAS2_START_SAR_M (BIT(17)) +#define SENS_MEAS2_START_SAR_V 0x1 +#define SENS_MEAS2_START_SAR_S 17 +/* SENS_MEAS2_DONE_SAR : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: SAR ADC2 conversion done indication*/ +#define SENS_MEAS2_DONE_SAR (BIT(16)) +#define SENS_MEAS2_DONE_SAR_M (BIT(16)) +#define SENS_MEAS2_DONE_SAR_V 0x1 +#define SENS_MEAS2_DONE_SAR_S 16 +/* SENS_MEAS2_DATA_SAR : RO ;bitpos:[15:0] ;default: 16'b0 ; */ +/*description: SAR ADC2 data*/ +#define SENS_MEAS2_DATA_SAR 0x0000FFFF +#define SENS_MEAS2_DATA_SAR_M ((SENS_MEAS2_DATA_SAR_V)<<(SENS_MEAS2_DATA_SAR_S)) +#define SENS_MEAS2_DATA_SAR_V 0xFFFF +#define SENS_MEAS2_DATA_SAR_S 0 + +#define SENS_SAR_MEAS2_MUX_REG (DR_REG_SENS_BASE + 0x0034) +/* SENS_SAR2_RTC_FORCE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: in sleep force to use rtc to control ADC*/ +#define SENS_SAR2_RTC_FORCE (BIT(31)) +#define SENS_SAR2_RTC_FORCE_M (BIT(31)) +#define SENS_SAR2_RTC_FORCE_V 0x1 +#define SENS_SAR2_RTC_FORCE_S 31 +/* SENS_SAR2_PWDET_CCT : R/W ;bitpos:[30:28] ;default: 3'b0 ; */ +/*description: SAR2_PWDET_CCT*/ +#define SENS_SAR2_PWDET_CCT 0x00000007 +#define SENS_SAR2_PWDET_CCT_M ((SENS_SAR2_PWDET_CCT_V)<<(SENS_SAR2_PWDET_CCT_S)) +#define SENS_SAR2_PWDET_CCT_V 0x7 +#define SENS_SAR2_PWDET_CCT_S 28 + +#define SENS_SAR_ATTEN2_REG (DR_REG_SENS_BASE + 0x0038) +/* SENS_SAR2_ATTEN : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ +/*description: 2-bit attenuation for each pad*/ +#define SENS_SAR2_ATTEN 0xFFFFFFFF +#define SENS_SAR2_ATTEN_M ((SENS_SAR2_ATTEN_V)<<(SENS_SAR2_ATTEN_S)) +#define SENS_SAR2_ATTEN_V 0xFFFFFFFF +#define SENS_SAR2_ATTEN_S 0 + +#define SENS_SAR_POWER_XPD_SAR_REG (DR_REG_SENS_BASE + 0x003c) +/* SENS_SARCLK_EN : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define SENS_SARCLK_EN (BIT(31)) +#define SENS_SARCLK_EN_M (BIT(31)) +#define SENS_SARCLK_EN_V 0x1 +#define SENS_SARCLK_EN_S 31 +/* SENS_FORCE_XPD_SAR : R/W ;bitpos:[30:29] ;default: 2'd0 ; */ +/*description: */ +#define SENS_FORCE_XPD_SAR 0x00000003 +#define SENS_FORCE_XPD_SAR_M ((SENS_FORCE_XPD_SAR_V)<<(SENS_FORCE_XPD_SAR_S)) +#define SENS_FORCE_XPD_SAR_V 0x3 +#define SENS_FORCE_XPD_SAR_S 29 +/* SENS_SAR1_DREF : R/W ;bitpos:[28:26] ;default: 3'd0 ; */ +/*description: Adjust saradc1 offset*/ +#define SENS_SAR1_DREF 0x00000007 +#define SENS_SAR1_DREF_M ((SENS_SAR1_DREF_V)<<(SENS_SAR1_DREF_S)) +#define SENS_SAR1_DREF_V 0x7 +#define SENS_SAR1_DREF_S 26 +/* SENS_SAR2_DREF : R/W ;bitpos:[25:23] ;default: 3'd0 ; */ +/*description: Adjust saradc2 offset*/ +#define SENS_SAR2_DREF 0x00000007 +#define SENS_SAR2_DREF_M ((SENS_SAR2_DREF_V)<<(SENS_SAR2_DREF_S)) +#define SENS_SAR2_DREF_V 0x7 +#define SENS_SAR2_DREF_S 23 + +#define SENS_SAR_SLAVE_ADDR1_REG (DR_REG_SENS_BASE + 0x0040) +/* SENS_MEAS_STATUS : RO ;bitpos:[29:22] ;default: 8'h0 ; */ +/*description: */ +#define SENS_MEAS_STATUS 0x000000FF +#define SENS_MEAS_STATUS_M ((SENS_MEAS_STATUS_V)<<(SENS_MEAS_STATUS_S)) +#define SENS_MEAS_STATUS_V 0xFF +#define SENS_MEAS_STATUS_S 22 +/* SENS_I2C_SLAVE_ADDR0 : R/W ;bitpos:[21:11] ;default: 11'h0 ; */ +/*description: */ +#define SENS_I2C_SLAVE_ADDR0 0x000007FF +#define SENS_I2C_SLAVE_ADDR0_M ((SENS_I2C_SLAVE_ADDR0_V)<<(SENS_I2C_SLAVE_ADDR0_S)) +#define SENS_I2C_SLAVE_ADDR0_V 0x7FF +#define SENS_I2C_SLAVE_ADDR0_S 11 +/* SENS_I2C_SLAVE_ADDR1 : R/W ;bitpos:[10:0] ;default: 11'h0 ; */ +/*description: */ +#define SENS_I2C_SLAVE_ADDR1 0x000007FF +#define SENS_I2C_SLAVE_ADDR1_M ((SENS_I2C_SLAVE_ADDR1_V)<<(SENS_I2C_SLAVE_ADDR1_S)) +#define SENS_I2C_SLAVE_ADDR1_V 0x7FF +#define SENS_I2C_SLAVE_ADDR1_S 0 + +#define SENS_SAR_SLAVE_ADDR2_REG (DR_REG_SENS_BASE + 0x0044) +/* SENS_I2C_SLAVE_ADDR2 : R/W ;bitpos:[21:11] ;default: 11'h0 ; */ +/*description: */ +#define SENS_I2C_SLAVE_ADDR2 0x000007FF +#define SENS_I2C_SLAVE_ADDR2_M ((SENS_I2C_SLAVE_ADDR2_V)<<(SENS_I2C_SLAVE_ADDR2_S)) +#define SENS_I2C_SLAVE_ADDR2_V 0x7FF +#define SENS_I2C_SLAVE_ADDR2_S 11 +/* SENS_I2C_SLAVE_ADDR3 : R/W ;bitpos:[10:0] ;default: 11'h0 ; */ +/*description: */ +#define SENS_I2C_SLAVE_ADDR3 0x000007FF +#define SENS_I2C_SLAVE_ADDR3_M ((SENS_I2C_SLAVE_ADDR3_V)<<(SENS_I2C_SLAVE_ADDR3_S)) +#define SENS_I2C_SLAVE_ADDR3_V 0x7FF +#define SENS_I2C_SLAVE_ADDR3_S 0 + +#define SENS_SAR_SLAVE_ADDR3_REG (DR_REG_SENS_BASE + 0x0048) +/* SENS_I2C_SLAVE_ADDR4 : R/W ;bitpos:[21:11] ;default: 11'h0 ; */ +/*description: */ +#define SENS_I2C_SLAVE_ADDR4 0x000007FF +#define SENS_I2C_SLAVE_ADDR4_M ((SENS_I2C_SLAVE_ADDR4_V)<<(SENS_I2C_SLAVE_ADDR4_S)) +#define SENS_I2C_SLAVE_ADDR4_V 0x7FF +#define SENS_I2C_SLAVE_ADDR4_S 11 +/* SENS_I2C_SLAVE_ADDR5 : R/W ;bitpos:[10:0] ;default: 11'h0 ; */ +/*description: */ +#define SENS_I2C_SLAVE_ADDR5 0x000007FF +#define SENS_I2C_SLAVE_ADDR5_M ((SENS_I2C_SLAVE_ADDR5_V)<<(SENS_I2C_SLAVE_ADDR5_S)) +#define SENS_I2C_SLAVE_ADDR5_V 0x7FF +#define SENS_I2C_SLAVE_ADDR5_S 0 + +#define SENS_SAR_SLAVE_ADDR4_REG (DR_REG_SENS_BASE + 0x004c) +/* SENS_I2C_SLAVE_ADDR6 : R/W ;bitpos:[21:11] ;default: 11'h0 ; */ +/*description: */ +#define SENS_I2C_SLAVE_ADDR6 0x000007FF +#define SENS_I2C_SLAVE_ADDR6_M ((SENS_I2C_SLAVE_ADDR6_V)<<(SENS_I2C_SLAVE_ADDR6_S)) +#define SENS_I2C_SLAVE_ADDR6_V 0x7FF +#define SENS_I2C_SLAVE_ADDR6_S 11 +/* SENS_I2C_SLAVE_ADDR7 : R/W ;bitpos:[10:0] ;default: 11'h0 ; */ +/*description: */ +#define SENS_I2C_SLAVE_ADDR7 0x000007FF +#define SENS_I2C_SLAVE_ADDR7_M ((SENS_I2C_SLAVE_ADDR7_V)<<(SENS_I2C_SLAVE_ADDR7_S)) +#define SENS_I2C_SLAVE_ADDR7_V 0x7FF +#define SENS_I2C_SLAVE_ADDR7_S 0 + +#define SENS_SAR_TSENS_CTRL_REG (DR_REG_SENS_BASE + 0x0050) +/* SENS_TSENS_DAC : R/W ;bitpos:[31:28] ;default: 4'hF ; */ +/*description: Temperature sensor offset dac. 15 for 0 offset 5 for -2 7 for + -1 11 for 1 10 for 2*/ +#define SENS_TSENS_DAC 0x0000000F +#define SENS_TSENS_DAC_M ((SENS_TSENS_DAC_V)<<(SENS_TSENS_DAC_S)) +#define SENS_TSENS_DAC_V 0xF +#define SENS_TSENS_DAC_S 28 +/* SENS_TSENS_DIV_CHOP : R/W ;bitpos:[27:26] ;default: 2'b10 ; */ +/*description: 0 for steady phase 0 1 for steady phase 1 2 for chopping with + ½ frequency of TSENS_CK 3 for chopping with ¼*/ +#define SENS_TSENS_DIV_CHOP 0x00000003 +#define SENS_TSENS_DIV_CHOP_M ((SENS_TSENS_DIV_CHOP_V)<<(SENS_TSENS_DIV_CHOP_S)) +#define SENS_TSENS_DIV_CHOP_V 0x3 +#define SENS_TSENS_DIV_CHOP_S 26 +/* SENS_TSENS_DIZ : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: ADC input short*/ +#define SENS_TSENS_DIZ (BIT(25)) +#define SENS_TSENS_DIZ_M (BIT(25)) +#define SENS_TSENS_DIZ_V 0x1 +#define SENS_TSENS_DIZ_S 25 +/* SENS_TSENS_DUMP_OUT : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: temperature sensor dump out*/ +#define SENS_TSENS_DUMP_OUT (BIT(24)) +#define SENS_TSENS_DUMP_OUT_M (BIT(24)) +#define SENS_TSENS_DUMP_OUT_V 0x1 +#define SENS_TSENS_DUMP_OUT_S 24 +/* SENS_TSENS_POWER_UP_FORCE : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: 1: dump out & power up controlled by SW*/ +#define SENS_TSENS_POWER_UP_FORCE (BIT(23)) +#define SENS_TSENS_POWER_UP_FORCE_M (BIT(23)) +#define SENS_TSENS_POWER_UP_FORCE_V 0x1 +#define SENS_TSENS_POWER_UP_FORCE_S 23 +/* SENS_TSENS_POWER_UP : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: temperature sensor power up*/ +#define SENS_TSENS_POWER_UP (BIT(22)) +#define SENS_TSENS_POWER_UP_M (BIT(22)) +#define SENS_TSENS_POWER_UP_V 0x1 +#define SENS_TSENS_POWER_UP_S 22 +/* SENS_TSENS_CLK_DIV : R/W ;bitpos:[21:14] ;default: 8'd6 ; */ +/*description: temperature sensor clock divider*/ +#define SENS_TSENS_CLK_DIV 0x000000FF +#define SENS_TSENS_CLK_DIV_M ((SENS_TSENS_CLK_DIV_V)<<(SENS_TSENS_CLK_DIV_S)) +#define SENS_TSENS_CLK_DIV_V 0xFF +#define SENS_TSENS_CLK_DIV_S 14 +/* SENS_TSENS_IN_INV : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: invert temperature sensor data*/ +#define SENS_TSENS_IN_INV (BIT(13)) +#define SENS_TSENS_IN_INV_M (BIT(13)) +#define SENS_TSENS_IN_INV_V 0x1 +#define SENS_TSENS_IN_INV_S 13 +/* SENS_TSENS_INT_EN : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: enable temperature sensor to send out interrupt*/ +#define SENS_TSENS_INT_EN (BIT(12)) +#define SENS_TSENS_INT_EN_M (BIT(12)) +#define SENS_TSENS_INT_EN_V 0x1 +#define SENS_TSENS_INT_EN_S 12 +/* SENS_TSENS_READY : RO ;bitpos:[8] ;default: 1'h0 ; */ +/*description: indicate temperature sensor out ready*/ +#define SENS_TSENS_READY (BIT(8)) +#define SENS_TSENS_READY_M (BIT(8)) +#define SENS_TSENS_READY_V 0x1 +#define SENS_TSENS_READY_S 8 +/* SENS_TSENS_OUT : RO ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: temperature sensor data out*/ +#define SENS_TSENS_OUT 0x000000FF +#define SENS_TSENS_OUT_M ((SENS_TSENS_OUT_V)<<(SENS_TSENS_OUT_S)) +#define SENS_TSENS_OUT_V 0xFF +#define SENS_TSENS_OUT_S 0 + +#define SENS_SAR_TSENS_CTRL2_REG (DR_REG_SENS_BASE + 0x0054) +/* SENS_TSENS_RESET : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: temperature sensor reset*/ +#define SENS_TSENS_RESET (BIT(16)) +#define SENS_TSENS_RESET_M (BIT(16)) +#define SENS_TSENS_RESET_V 0x1 +#define SENS_TSENS_RESET_S 16 +/* SENS_TSENS_CLKGATE_EN : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: temperature sensor clock enable*/ +#define SENS_TSENS_CLKGATE_EN (BIT(15)) +#define SENS_TSENS_CLKGATE_EN_M (BIT(15)) +#define SENS_TSENS_CLKGATE_EN_V 0x1 +#define SENS_TSENS_CLKGATE_EN_S 15 +/* SENS_TSENS_CLK_INV : R/W ;bitpos:[14] ;default: 1'b1 ; */ +/*description: */ +#define SENS_TSENS_CLK_INV (BIT(14)) +#define SENS_TSENS_CLK_INV_M (BIT(14)) +#define SENS_TSENS_CLK_INV_V 0x1 +#define SENS_TSENS_CLK_INV_S 14 +/* SENS_TSENS_XPD_FORCE : R/W ;bitpos:[13:12] ;default: 2'b0 ; */ +/*description: */ +#define SENS_TSENS_XPD_FORCE 0x00000003 +#define SENS_TSENS_XPD_FORCE_M ((SENS_TSENS_XPD_FORCE_V)<<(SENS_TSENS_XPD_FORCE_S)) +#define SENS_TSENS_XPD_FORCE_V 0x3 +#define SENS_TSENS_XPD_FORCE_S 12 +/* SENS_TSENS_XPD_WAIT : R/W ;bitpos:[11:0] ;default: 12'h2 ; */ +/*description: */ +#define SENS_TSENS_XPD_WAIT 0x00000FFF +#define SENS_TSENS_XPD_WAIT_M ((SENS_TSENS_XPD_WAIT_V)<<(SENS_TSENS_XPD_WAIT_S)) +#define SENS_TSENS_XPD_WAIT_V 0xFFF +#define SENS_TSENS_XPD_WAIT_S 0 + +#define SENS_SAR_I2C_CTRL_REG (DR_REG_SENS_BASE + 0x0058) +/* SENS_SAR_I2C_START_FORCE : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: 1: I2C started by SW*/ +#define SENS_SAR_I2C_START_FORCE (BIT(29)) +#define SENS_SAR_I2C_START_FORCE_M (BIT(29)) +#define SENS_SAR_I2C_START_FORCE_V 0x1 +#define SENS_SAR_I2C_START_FORCE_S 29 +/* SENS_SAR_I2C_START : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: start I2C*/ +#define SENS_SAR_I2C_START (BIT(28)) +#define SENS_SAR_I2C_START_M (BIT(28)) +#define SENS_SAR_I2C_START_V 0x1 +#define SENS_SAR_I2C_START_S 28 +/* SENS_SAR_I2C_CTRL : R/W ;bitpos:[27:0] ;default: 28'b0 ; */ +/*description: I2C control data*/ +#define SENS_SAR_I2C_CTRL 0x0FFFFFFF +#define SENS_SAR_I2C_CTRL_M ((SENS_SAR_I2C_CTRL_V)<<(SENS_SAR_I2C_CTRL_S)) +#define SENS_SAR_I2C_CTRL_V 0xFFFFFFF +#define SENS_SAR_I2C_CTRL_S 0 + +#define SENS_SAR_TOUCH_CONF_REG (DR_REG_SENS_BASE + 0x005c) +/* SENS_TOUCH_APPROACH_PAD0 : R/W ;bitpos:[31:28] ;default: 4'hF ; */ +/*description: indicate which pad is approach pad0*/ +#define SENS_TOUCH_APPROACH_PAD0 0x0000000F +#define SENS_TOUCH_APPROACH_PAD0_M ((SENS_TOUCH_APPROACH_PAD0_V)<<(SENS_TOUCH_APPROACH_PAD0_S)) +#define SENS_TOUCH_APPROACH_PAD0_V 0xF +#define SENS_TOUCH_APPROACH_PAD0_S 28 +/* SENS_TOUCH_APPROACH_PAD1 : R/W ;bitpos:[27:24] ;default: 4'hF ; */ +/*description: indicate which pad is approach pad1*/ +#define SENS_TOUCH_APPROACH_PAD1 0x0000000F +#define SENS_TOUCH_APPROACH_PAD1_M ((SENS_TOUCH_APPROACH_PAD1_V)<<(SENS_TOUCH_APPROACH_PAD1_S)) +#define SENS_TOUCH_APPROACH_PAD1_V 0xF +#define SENS_TOUCH_APPROACH_PAD1_S 24 +/* SENS_TOUCH_APPROACH_PAD2 : R/W ;bitpos:[23:20] ;default: 4'hF ; */ +/*description: indicate which pad is approach pad2*/ +#define SENS_TOUCH_APPROACH_PAD2 0x0000000F +#define SENS_TOUCH_APPROACH_PAD2_M ((SENS_TOUCH_APPROACH_PAD2_V)<<(SENS_TOUCH_APPROACH_PAD2_S)) +#define SENS_TOUCH_APPROACH_PAD2_V 0xF +#define SENS_TOUCH_APPROACH_PAD2_S 20 +/* SENS_TOUCH_STATUS_CLR : WO ;bitpos:[15] ;default: 1'd0 ; */ +/*description: clear all touch active status*/ +#define SENS_TOUCH_STATUS_CLR (BIT(15)) +#define SENS_TOUCH_STATUS_CLR_M (BIT(15)) +#define SENS_TOUCH_STATUS_CLR_V 0x1 +#define SENS_TOUCH_STATUS_CLR_S 15 +/* SENS_TOUCH_OUTEN : R/W ;bitpos:[14:0] ;default: 15'h7FFF ; */ +/*description: touch controller output enable*/ +#define SENS_TOUCH_OUTEN 0x00007FFF +#define SENS_TOUCH_OUTEN_M ((SENS_TOUCH_OUTEN_V)<<(SENS_TOUCH_OUTEN_S)) +#define SENS_TOUCH_OUTEN_V 0x7FFF +#define SENS_TOUCH_OUTEN_S 0 + +#define SENS_SAR_TOUCH_THRES1_REG (DR_REG_SENS_BASE + 0x0060) +/* SENS_TOUCH_OUT_TH1 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 1*/ +#define SENS_TOUCH_OUT_TH1 0x003FFFFF +#define SENS_TOUCH_OUT_TH1_M ((SENS_TOUCH_OUT_TH1_V)<<(SENS_TOUCH_OUT_TH1_S)) +#define SENS_TOUCH_OUT_TH1_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH1_S 0 + +#define SENS_SAR_TOUCH_THRES2_REG (DR_REG_SENS_BASE + 0x0064) +/* SENS_TOUCH_OUT_TH2 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 2*/ +#define SENS_TOUCH_OUT_TH2 0x003FFFFF +#define SENS_TOUCH_OUT_TH2_M ((SENS_TOUCH_OUT_TH2_V)<<(SENS_TOUCH_OUT_TH2_S)) +#define SENS_TOUCH_OUT_TH2_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH2_S 0 + +#define SENS_SAR_TOUCH_THRES3_REG (DR_REG_SENS_BASE + 0x0068) +/* SENS_TOUCH_OUT_TH3 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 3*/ +#define SENS_TOUCH_OUT_TH3 0x003FFFFF +#define SENS_TOUCH_OUT_TH3_M ((SENS_TOUCH_OUT_TH3_V)<<(SENS_TOUCH_OUT_TH3_S)) +#define SENS_TOUCH_OUT_TH3_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH3_S 0 + +#define SENS_SAR_TOUCH_THRES4_REG (DR_REG_SENS_BASE + 0x006c) +/* SENS_TOUCH_OUT_TH4 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 4*/ +#define SENS_TOUCH_OUT_TH4 0x003FFFFF +#define SENS_TOUCH_OUT_TH4_M ((SENS_TOUCH_OUT_TH4_V)<<(SENS_TOUCH_OUT_TH4_S)) +#define SENS_TOUCH_OUT_TH4_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH4_S 0 + +#define SENS_SAR_TOUCH_THRES5_REG (DR_REG_SENS_BASE + 0x0070) +/* SENS_TOUCH_OUT_TH5 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 5*/ +#define SENS_TOUCH_OUT_TH5 0x003FFFFF +#define SENS_TOUCH_OUT_TH5_M ((SENS_TOUCH_OUT_TH5_V)<<(SENS_TOUCH_OUT_TH5_S)) +#define SENS_TOUCH_OUT_TH5_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH5_S 0 + +#define SENS_SAR_TOUCH_THRES6_REG (DR_REG_SENS_BASE + 0x0074) +/* SENS_TOUCH_OUT_TH6 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 6*/ +#define SENS_TOUCH_OUT_TH6 0x003FFFFF +#define SENS_TOUCH_OUT_TH6_M ((SENS_TOUCH_OUT_TH6_V)<<(SENS_TOUCH_OUT_TH6_S)) +#define SENS_TOUCH_OUT_TH6_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH6_S 0 + +#define SENS_SAR_TOUCH_THRES7_REG (DR_REG_SENS_BASE + 0x0078) +/* SENS_TOUCH_OUT_TH7 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 7*/ +#define SENS_TOUCH_OUT_TH7 0x003FFFFF +#define SENS_TOUCH_OUT_TH7_M ((SENS_TOUCH_OUT_TH7_V)<<(SENS_TOUCH_OUT_TH7_S)) +#define SENS_TOUCH_OUT_TH7_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH7_S 0 + +#define SENS_SAR_TOUCH_THRES8_REG (DR_REG_SENS_BASE + 0x007c) +/* SENS_TOUCH_OUT_TH8 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 8*/ +#define SENS_TOUCH_OUT_TH8 0x003FFFFF +#define SENS_TOUCH_OUT_TH8_M ((SENS_TOUCH_OUT_TH8_V)<<(SENS_TOUCH_OUT_TH8_S)) +#define SENS_TOUCH_OUT_TH8_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH8_S 0 + +#define SENS_SAR_TOUCH_THRES9_REG (DR_REG_SENS_BASE + 0x0080) +/* SENS_TOUCH_OUT_TH9 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 9*/ +#define SENS_TOUCH_OUT_TH9 0x003FFFFF +#define SENS_TOUCH_OUT_TH9_M ((SENS_TOUCH_OUT_TH9_V)<<(SENS_TOUCH_OUT_TH9_S)) +#define SENS_TOUCH_OUT_TH9_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH9_S 0 + +#define SENS_SAR_TOUCH_THRES10_REG (DR_REG_SENS_BASE + 0x0084) +/* SENS_TOUCH_OUT_TH10 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 10*/ +#define SENS_TOUCH_OUT_TH10 0x003FFFFF +#define SENS_TOUCH_OUT_TH10_M ((SENS_TOUCH_OUT_TH10_V)<<(SENS_TOUCH_OUT_TH10_S)) +#define SENS_TOUCH_OUT_TH10_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH10_S 0 + +#define SENS_SAR_TOUCH_THRES11_REG (DR_REG_SENS_BASE + 0x0088) +/* SENS_TOUCH_OUT_TH11 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 11*/ +#define SENS_TOUCH_OUT_TH11 0x003FFFFF +#define SENS_TOUCH_OUT_TH11_M ((SENS_TOUCH_OUT_TH11_V)<<(SENS_TOUCH_OUT_TH11_S)) +#define SENS_TOUCH_OUT_TH11_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH11_S 0 + +#define SENS_SAR_TOUCH_THRES12_REG (DR_REG_SENS_BASE + 0x008c) +/* SENS_TOUCH_OUT_TH12 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 12*/ +#define SENS_TOUCH_OUT_TH12 0x003FFFFF +#define SENS_TOUCH_OUT_TH12_M ((SENS_TOUCH_OUT_TH12_V)<<(SENS_TOUCH_OUT_TH12_S)) +#define SENS_TOUCH_OUT_TH12_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH12_S 0 + +#define SENS_SAR_TOUCH_THRES13_REG (DR_REG_SENS_BASE + 0x0090) +/* SENS_TOUCH_OUT_TH13 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 13*/ +#define SENS_TOUCH_OUT_TH13 0x003FFFFF +#define SENS_TOUCH_OUT_TH13_M ((SENS_TOUCH_OUT_TH13_V)<<(SENS_TOUCH_OUT_TH13_S)) +#define SENS_TOUCH_OUT_TH13_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH13_S 0 + +#define SENS_SAR_TOUCH_THRES14_REG (DR_REG_SENS_BASE + 0x0094) +/* SENS_TOUCH_OUT_TH14 : R/W ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: Finger threshold for touch pad 14*/ +#define SENS_TOUCH_OUT_TH14 0x003FFFFF +#define SENS_TOUCH_OUT_TH14_M ((SENS_TOUCH_OUT_TH14_V)<<(SENS_TOUCH_OUT_TH14_S)) +#define SENS_TOUCH_OUT_TH14_V 0x3FFFFF +#define SENS_TOUCH_OUT_TH14_S 0 + +#define SENS_SAR_TOUCH_OUT0_REG (DR_REG_SENS_BASE + 0x0098) +/* SENS_TOUCH_MEAS_OUT0 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 0*/ +#define SENS_TOUCH_MEAS_OUT0 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT0_M ((SENS_TOUCH_MEAS_OUT0_V)<<(SENS_TOUCH_MEAS_OUT0_S)) +#define SENS_TOUCH_MEAS_OUT0_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT0_S 0 + +#define SENS_SAR_TOUCH_OUT1_REG (DR_REG_SENS_BASE + 0x009c) +/* SENS_TOUCH_MEAS_OUT1 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 1*/ +#define SENS_TOUCH_MEAS_OUT1 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT1_M ((SENS_TOUCH_MEAS_OUT1_V)<<(SENS_TOUCH_MEAS_OUT1_S)) +#define SENS_TOUCH_MEAS_OUT1_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT1_S 0 + +#define SENS_SAR_TOUCH_OUT2_REG (DR_REG_SENS_BASE + 0x00a0) +/* SENS_TOUCH_MEAS_OUT2 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 2*/ +#define SENS_TOUCH_MEAS_OUT2 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT2_M ((SENS_TOUCH_MEAS_OUT2_V)<<(SENS_TOUCH_MEAS_OUT2_S)) +#define SENS_TOUCH_MEAS_OUT2_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT2_S 0 + +#define SENS_SAR_TOUCH_OUT3_REG (DR_REG_SENS_BASE + 0x00a4) +/* SENS_TOUCH_MEAS_OUT3 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 3*/ +#define SENS_TOUCH_MEAS_OUT3 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT3_M ((SENS_TOUCH_MEAS_OUT3_V)<<(SENS_TOUCH_MEAS_OUT3_S)) +#define SENS_TOUCH_MEAS_OUT3_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT3_S 0 + +#define SENS_SAR_TOUCH_OUT4_REG (DR_REG_SENS_BASE + 0x00a8) +/* SENS_TOUCH_MEAS_OUT4 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 4*/ +#define SENS_TOUCH_MEAS_OUT4 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT4_M ((SENS_TOUCH_MEAS_OUT4_V)<<(SENS_TOUCH_MEAS_OUT4_S)) +#define SENS_TOUCH_MEAS_OUT4_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT4_S 0 + +#define SENS_SAR_TOUCH_OUT5_REG (DR_REG_SENS_BASE + 0x00ac) +/* SENS_TOUCH_MEAS_OUT5 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 5*/ +#define SENS_TOUCH_MEAS_OUT5 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT5_M ((SENS_TOUCH_MEAS_OUT5_V)<<(SENS_TOUCH_MEAS_OUT5_S)) +#define SENS_TOUCH_MEAS_OUT5_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT5_S 0 + +#define SENS_SAR_TOUCH_OUT6_REG (DR_REG_SENS_BASE + 0x00b0) +/* SENS_TOUCH_MEAS_OUT6 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 6*/ +#define SENS_TOUCH_MEAS_OUT6 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT6_M ((SENS_TOUCH_MEAS_OUT6_V)<<(SENS_TOUCH_MEAS_OUT6_S)) +#define SENS_TOUCH_MEAS_OUT6_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT6_S 0 + +#define SENS_SAR_TOUCH_OUT7_REG (DR_REG_SENS_BASE + 0x00b4) +/* SENS_TOUCH_MEAS_OUT7 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 7*/ +#define SENS_TOUCH_MEAS_OUT7 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT7_M ((SENS_TOUCH_MEAS_OUT7_V)<<(SENS_TOUCH_MEAS_OUT7_S)) +#define SENS_TOUCH_MEAS_OUT7_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT7_S 0 + +#define SENS_SAR_TOUCH_OUT8_REG (DR_REG_SENS_BASE + 0x00b8) +/* SENS_TOUCH_MEAS_OUT8 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 8*/ +#define SENS_TOUCH_MEAS_OUT8 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT8_M ((SENS_TOUCH_MEAS_OUT8_V)<<(SENS_TOUCH_MEAS_OUT8_S)) +#define SENS_TOUCH_MEAS_OUT8_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT8_S 0 + +#define SENS_SAR_TOUCH_OUT9_REG (DR_REG_SENS_BASE + 0x00bc) +/* SENS_TOUCH_MEAS_OUT9 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 9*/ +#define SENS_TOUCH_MEAS_OUT9 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT9_M ((SENS_TOUCH_MEAS_OUT9_V)<<(SENS_TOUCH_MEAS_OUT9_S)) +#define SENS_TOUCH_MEAS_OUT9_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT9_S 0 + +#define SENS_SAR_TOUCH_OUT10_REG (DR_REG_SENS_BASE + 0x00c0) +/* SENS_TOUCH_MEAS_OUT10 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 10*/ +#define SENS_TOUCH_MEAS_OUT10 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT10_M ((SENS_TOUCH_MEAS_OUT10_V)<<(SENS_TOUCH_MEAS_OUT10_S)) +#define SENS_TOUCH_MEAS_OUT10_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT10_S 0 + +#define SENS_SAR_TOUCH_OUT11_REG (DR_REG_SENS_BASE + 0x00c4) +/* SENS_TOUCH_MEAS_OUT11 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 11*/ +#define SENS_TOUCH_MEAS_OUT11 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT11_M ((SENS_TOUCH_MEAS_OUT11_V)<<(SENS_TOUCH_MEAS_OUT11_S)) +#define SENS_TOUCH_MEAS_OUT11_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT11_S 0 + +#define SENS_SAR_TOUCH_OUT12_REG (DR_REG_SENS_BASE + 0x00c8) +/* SENS_TOUCH_MEAS_OUT12 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 12*/ +#define SENS_TOUCH_MEAS_OUT12 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT12_M ((SENS_TOUCH_MEAS_OUT12_V)<<(SENS_TOUCH_MEAS_OUT12_S)) +#define SENS_TOUCH_MEAS_OUT12_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT12_S 0 + +#define SENS_SAR_TOUCH_OUT13_REG (DR_REG_SENS_BASE + 0x00cc) +/* SENS_TOUCH_MEAS_OUT13 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 13*/ +#define SENS_TOUCH_MEAS_OUT13 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT13_M ((SENS_TOUCH_MEAS_OUT13_V)<<(SENS_TOUCH_MEAS_OUT13_S)) +#define SENS_TOUCH_MEAS_OUT13_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT13_S 0 + +#define SENS_SAR_TOUCH_OUT14_REG (DR_REG_SENS_BASE + 0x00d0) +/* SENS_TOUCH_MEAS_OUT14 : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 14*/ +#define SENS_TOUCH_MEAS_OUT14 0x003FFFFF +#define SENS_TOUCH_MEAS_OUT14_M ((SENS_TOUCH_MEAS_OUT14_V)<<(SENS_TOUCH_MEAS_OUT14_S)) +#define SENS_TOUCH_MEAS_OUT14_V 0x3FFFFF +#define SENS_TOUCH_MEAS_OUT14_S 0 + +#define SENS_SAR_TOUCH_CHN_ST_REG (DR_REG_SENS_BASE + 0x00d4) +/* SENS_TOUCH_MEAS_DONE : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define SENS_TOUCH_MEAS_DONE (BIT(31)) +#define SENS_TOUCH_MEAS_DONE_M (BIT(31)) +#define SENS_TOUCH_MEAS_DONE_V 0x1 +#define SENS_TOUCH_MEAS_DONE_S 31 +/* SENS_TOUCH_CHANNEL_CLR : WO ;bitpos:[29:15] ;default: 15'd0 ; */ +/*description: Clear touch channel*/ +#define SENS_TOUCH_CHANNEL_CLR 0x00007FFF +#define SENS_TOUCH_CHANNEL_CLR_M ((SENS_TOUCH_CHANNEL_CLR_V)<<(SENS_TOUCH_CHANNEL_CLR_S)) +#define SENS_TOUCH_CHANNEL_CLR_V 0x7FFF +#define SENS_TOUCH_CHANNEL_CLR_S 15 +/* SENS_TOUCH_PAD_ACTIVE : RO ;bitpos:[14:0] ;default: 15'd0 ; */ +/*description: touch active status*/ +#define SENS_TOUCH_PAD_ACTIVE 0x00007FFF +#define SENS_TOUCH_PAD_ACTIVE_M ((SENS_TOUCH_PAD_ACTIVE_V)<<(SENS_TOUCH_PAD_ACTIVE_S)) +#define SENS_TOUCH_PAD_ACTIVE_V 0x7FFF +#define SENS_TOUCH_PAD_ACTIVE_S 0 + +#define SENS_SAR_TOUCH_STATUS0_REG (DR_REG_SENS_BASE + 0x00d8) +/* SENS_TOUCH_SCAN_CURR : RO ;bitpos:[25:22] ;default: 4'd0 ; */ +/*description: */ +#define SENS_TOUCH_SCAN_CURR 0x0000000F +#define SENS_TOUCH_SCAN_CURR_M ((SENS_TOUCH_SCAN_CURR_V)<<(SENS_TOUCH_SCAN_CURR_S)) +#define SENS_TOUCH_SCAN_CURR_V 0xF +#define SENS_TOUCH_SCAN_CURR_S 22 +/* SENS_TOUCH_DENOISE_DATA : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: the counter for touch pad 0*/ +#define SENS_TOUCH_DENOISE_DATA 0x003FFFFF +#define SENS_TOUCH_DENOISE_DATA_M ((SENS_TOUCH_DENOISE_DATA_V)<<(SENS_TOUCH_DENOISE_DATA_S)) +#define SENS_TOUCH_DENOISE_DATA_V 0x3FFFFF +#define SENS_TOUCH_DENOISE_DATA_S 0 + +#define SENS_SAR_TOUCH_STATUS1_REG (DR_REG_SENS_BASE + 0x00dc) +/* SENS_TOUCH_PAD1_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD1_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD1_DEBOUNCE_M ((SENS_TOUCH_PAD1_DEBOUNCE_V)<<(SENS_TOUCH_PAD1_DEBOUNCE_S)) +#define SENS_TOUCH_PAD1_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD1_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD1_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD1_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD1_BASELINE_M ((SENS_TOUCH_PAD1_BASELINE_V)<<(SENS_TOUCH_PAD1_BASELINE_S)) +#define SENS_TOUCH_PAD1_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD1_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS2_REG (DR_REG_SENS_BASE + 0x00e0) +/* SENS_TOUCH_PAD2_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD2_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD2_DEBOUNCE_M ((SENS_TOUCH_PAD2_DEBOUNCE_V)<<(SENS_TOUCH_PAD2_DEBOUNCE_S)) +#define SENS_TOUCH_PAD2_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD2_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD2_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD2_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD2_BASELINE_M ((SENS_TOUCH_PAD2_BASELINE_V)<<(SENS_TOUCH_PAD2_BASELINE_S)) +#define SENS_TOUCH_PAD2_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD2_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS3_REG (DR_REG_SENS_BASE + 0x00e4) +/* SENS_TOUCH_PAD3_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD3_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD3_DEBOUNCE_M ((SENS_TOUCH_PAD3_DEBOUNCE_V)<<(SENS_TOUCH_PAD3_DEBOUNCE_S)) +#define SENS_TOUCH_PAD3_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD3_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD3_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD3_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD3_BASELINE_M ((SENS_TOUCH_PAD3_BASELINE_V)<<(SENS_TOUCH_PAD3_BASELINE_S)) +#define SENS_TOUCH_PAD3_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD3_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS4_REG (DR_REG_SENS_BASE + 0x00e8) +/* SENS_TOUCH_PAD4_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD4_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD4_DEBOUNCE_M ((SENS_TOUCH_PAD4_DEBOUNCE_V)<<(SENS_TOUCH_PAD4_DEBOUNCE_S)) +#define SENS_TOUCH_PAD4_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD4_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD4_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD4_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD4_BASELINE_M ((SENS_TOUCH_PAD4_BASELINE_V)<<(SENS_TOUCH_PAD4_BASELINE_S)) +#define SENS_TOUCH_PAD4_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD4_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS5_REG (DR_REG_SENS_BASE + 0x00ec) +/* SENS_TOUCH_PAD5_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD5_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD5_DEBOUNCE_M ((SENS_TOUCH_PAD5_DEBOUNCE_V)<<(SENS_TOUCH_PAD5_DEBOUNCE_S)) +#define SENS_TOUCH_PAD5_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD5_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD5_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD5_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD5_BASELINE_M ((SENS_TOUCH_PAD5_BASELINE_V)<<(SENS_TOUCH_PAD5_BASELINE_S)) +#define SENS_TOUCH_PAD5_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD5_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS6_REG (DR_REG_SENS_BASE + 0x00f0) +/* SENS_TOUCH_PAD6_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD6_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD6_DEBOUNCE_M ((SENS_TOUCH_PAD6_DEBOUNCE_V)<<(SENS_TOUCH_PAD6_DEBOUNCE_S)) +#define SENS_TOUCH_PAD6_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD6_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD6_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD6_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD6_BASELINE_M ((SENS_TOUCH_PAD6_BASELINE_V)<<(SENS_TOUCH_PAD6_BASELINE_S)) +#define SENS_TOUCH_PAD6_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD6_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS7_REG (DR_REG_SENS_BASE + 0x00f4) +/* SENS_TOUCH_PAD7_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD7_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD7_DEBOUNCE_M ((SENS_TOUCH_PAD7_DEBOUNCE_V)<<(SENS_TOUCH_PAD7_DEBOUNCE_S)) +#define SENS_TOUCH_PAD7_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD7_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD7_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD7_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD7_BASELINE_M ((SENS_TOUCH_PAD7_BASELINE_V)<<(SENS_TOUCH_PAD7_BASELINE_S)) +#define SENS_TOUCH_PAD7_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD7_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS8_REG (DR_REG_SENS_BASE + 0x00f8) +/* SENS_TOUCH_PAD8_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD8_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD8_DEBOUNCE_M ((SENS_TOUCH_PAD8_DEBOUNCE_V)<<(SENS_TOUCH_PAD8_DEBOUNCE_S)) +#define SENS_TOUCH_PAD8_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD8_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD8_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD8_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD8_BASELINE_M ((SENS_TOUCH_PAD8_BASELINE_V)<<(SENS_TOUCH_PAD8_BASELINE_S)) +#define SENS_TOUCH_PAD8_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD8_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS9_REG (DR_REG_SENS_BASE + 0x00fc) +/* SENS_TOUCH_PAD9_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD9_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD9_DEBOUNCE_M ((SENS_TOUCH_PAD9_DEBOUNCE_V)<<(SENS_TOUCH_PAD9_DEBOUNCE_S)) +#define SENS_TOUCH_PAD9_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD9_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD9_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD9_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD9_BASELINE_M ((SENS_TOUCH_PAD9_BASELINE_V)<<(SENS_TOUCH_PAD9_BASELINE_S)) +#define SENS_TOUCH_PAD9_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD9_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS10_REG (DR_REG_SENS_BASE + 0x0100) +/* SENS_TOUCH_PAD10_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD10_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD10_DEBOUNCE_M ((SENS_TOUCH_PAD10_DEBOUNCE_V)<<(SENS_TOUCH_PAD10_DEBOUNCE_S)) +#define SENS_TOUCH_PAD10_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD10_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD10_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD10_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD10_BASELINE_M ((SENS_TOUCH_PAD10_BASELINE_V)<<(SENS_TOUCH_PAD10_BASELINE_S)) +#define SENS_TOUCH_PAD10_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD10_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS11_REG (DR_REG_SENS_BASE + 0x0104) +/* SENS_TOUCH_PAD11_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD11_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD11_DEBOUNCE_M ((SENS_TOUCH_PAD11_DEBOUNCE_V)<<(SENS_TOUCH_PAD11_DEBOUNCE_S)) +#define SENS_TOUCH_PAD11_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD11_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD11_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD11_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD11_BASELINE_M ((SENS_TOUCH_PAD11_BASELINE_V)<<(SENS_TOUCH_PAD11_BASELINE_S)) +#define SENS_TOUCH_PAD11_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD11_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS12_REG (DR_REG_SENS_BASE + 0x0108) +/* SENS_TOUCH_PAD12_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD12_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD12_DEBOUNCE_M ((SENS_TOUCH_PAD12_DEBOUNCE_V)<<(SENS_TOUCH_PAD12_DEBOUNCE_S)) +#define SENS_TOUCH_PAD12_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD12_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD12_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD12_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD12_BASELINE_M ((SENS_TOUCH_PAD12_BASELINE_V)<<(SENS_TOUCH_PAD12_BASELINE_S)) +#define SENS_TOUCH_PAD12_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD12_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS13_REG (DR_REG_SENS_BASE + 0x010c) +/* SENS_TOUCH_PAD13_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD13_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD13_DEBOUNCE_M ((SENS_TOUCH_PAD13_DEBOUNCE_V)<<(SENS_TOUCH_PAD13_DEBOUNCE_S)) +#define SENS_TOUCH_PAD13_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD13_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD13_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD13_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD13_BASELINE_M ((SENS_TOUCH_PAD13_BASELINE_V)<<(SENS_TOUCH_PAD13_BASELINE_S)) +#define SENS_TOUCH_PAD13_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD13_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS14_REG (DR_REG_SENS_BASE + 0x0110) +/* SENS_TOUCH_PAD14_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_PAD14_DEBOUNCE 0x00000007 +#define SENS_TOUCH_PAD14_DEBOUNCE_M ((SENS_TOUCH_PAD14_DEBOUNCE_V)<<(SENS_TOUCH_PAD14_DEBOUNCE_S)) +#define SENS_TOUCH_PAD14_DEBOUNCE_V 0x7 +#define SENS_TOUCH_PAD14_DEBOUNCE_S 29 +/* SENS_TOUCH_PAD14_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_PAD14_BASELINE 0x003FFFFF +#define SENS_TOUCH_PAD14_BASELINE_M ((SENS_TOUCH_PAD14_BASELINE_V)<<(SENS_TOUCH_PAD14_BASELINE_S)) +#define SENS_TOUCH_PAD14_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_PAD14_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS15_REG (DR_REG_SENS_BASE + 0x0114) +/* SENS_TOUCH_SLP_DEBOUNCE : RO ;bitpos:[31:29] ;default: 3'd0 ; */ +/*description: */ +#define SENS_TOUCH_SLP_DEBOUNCE 0x00000007 +#define SENS_TOUCH_SLP_DEBOUNCE_M ((SENS_TOUCH_SLP_DEBOUNCE_V)<<(SENS_TOUCH_SLP_DEBOUNCE_S)) +#define SENS_TOUCH_SLP_DEBOUNCE_V 0x7 +#define SENS_TOUCH_SLP_DEBOUNCE_S 29 +/* SENS_TOUCH_SLP_BASELINE : RO ;bitpos:[21:0] ;default: 22'h0 ; */ +/*description: */ +#define SENS_TOUCH_SLP_BASELINE 0x003FFFFF +#define SENS_TOUCH_SLP_BASELINE_M ((SENS_TOUCH_SLP_BASELINE_V)<<(SENS_TOUCH_SLP_BASELINE_S)) +#define SENS_TOUCH_SLP_BASELINE_V 0x3FFFFF +#define SENS_TOUCH_SLP_BASELINE_S 0 + +#define SENS_SAR_TOUCH_STATUS16_REG (DR_REG_SENS_BASE + 0x0118) +/* SENS_TOUCH_SLP_APPROACH_CNT : RO ;bitpos:[31:24] ;default: 8'd0 ; */ +/*description: */ +#define SENS_TOUCH_SLP_APPROACH_CNT 0x000000FF +#define SENS_TOUCH_SLP_APPROACH_CNT_M ((SENS_TOUCH_SLP_APPROACH_CNT_V)<<(SENS_TOUCH_SLP_APPROACH_CNT_S)) +#define SENS_TOUCH_SLP_APPROACH_CNT_V 0xFF +#define SENS_TOUCH_SLP_APPROACH_CNT_S 24 +/* SENS_TOUCH_APPROACH_PAD0_CNT : RO ;bitpos:[23:16] ;default: 8'd0 ; */ +/*description: */ +#define SENS_TOUCH_APPROACH_PAD0_CNT 0x000000FF +#define SENS_TOUCH_APPROACH_PAD0_CNT_M ((SENS_TOUCH_APPROACH_PAD0_CNT_V)<<(SENS_TOUCH_APPROACH_PAD0_CNT_S)) +#define SENS_TOUCH_APPROACH_PAD0_CNT_V 0xFF +#define SENS_TOUCH_APPROACH_PAD0_CNT_S 16 +/* SENS_TOUCH_APPROACH_PAD1_CNT : RO ;bitpos:[15:8] ;default: 8'd0 ; */ +/*description: */ +#define SENS_TOUCH_APPROACH_PAD1_CNT 0x000000FF +#define SENS_TOUCH_APPROACH_PAD1_CNT_M ((SENS_TOUCH_APPROACH_PAD1_CNT_V)<<(SENS_TOUCH_APPROACH_PAD1_CNT_S)) +#define SENS_TOUCH_APPROACH_PAD1_CNT_V 0xFF +#define SENS_TOUCH_APPROACH_PAD1_CNT_S 8 +/* SENS_TOUCH_APPROACH_PAD2_CNT : RO ;bitpos:[7:0] ;default: 8'd0 ; */ +/*description: */ +#define SENS_TOUCH_APPROACH_PAD2_CNT 0x000000FF +#define SENS_TOUCH_APPROACH_PAD2_CNT_M ((SENS_TOUCH_APPROACH_PAD2_CNT_V)<<(SENS_TOUCH_APPROACH_PAD2_CNT_S)) +#define SENS_TOUCH_APPROACH_PAD2_CNT_V 0xFF +#define SENS_TOUCH_APPROACH_PAD2_CNT_S 0 + +#define SENS_SAR_DAC_CTRL1_REG (DR_REG_SENS_BASE + 0x011c) +/* SENS_DAC_CLK_INV : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: 1: invert PDAC_CLK*/ +#define SENS_DAC_CLK_INV (BIT(25)) +#define SENS_DAC_CLK_INV_M (BIT(25)) +#define SENS_DAC_CLK_INV_V 0x1 +#define SENS_DAC_CLK_INV_S 25 +/* SENS_DAC_CLK_FORCE_HIGH : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: 1: force PDAC_CLK to high*/ +#define SENS_DAC_CLK_FORCE_HIGH (BIT(24)) +#define SENS_DAC_CLK_FORCE_HIGH_M (BIT(24)) +#define SENS_DAC_CLK_FORCE_HIGH_V 0x1 +#define SENS_DAC_CLK_FORCE_HIGH_S 24 +/* SENS_DAC_CLK_FORCE_LOW : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: 1: force PDAC_CLK to low*/ +#define SENS_DAC_CLK_FORCE_LOW (BIT(23)) +#define SENS_DAC_CLK_FORCE_LOW_M (BIT(23)) +#define SENS_DAC_CLK_FORCE_LOW_V 0x1 +#define SENS_DAC_CLK_FORCE_LOW_S 23 +/* SENS_DAC_DIG_FORCE : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: 1: DAC1 & DAC2 use DMA*/ +#define SENS_DAC_DIG_FORCE (BIT(22)) +#define SENS_DAC_DIG_FORCE_M (BIT(22)) +#define SENS_DAC_DIG_FORCE_V 0x1 +#define SENS_DAC_DIG_FORCE_S 22 +/* SENS_DEBUG_BIT_SEL : R/W ;bitpos:[21:17] ;default: 5'b0 ; */ +/*description: */ +#define SENS_DEBUG_BIT_SEL 0x0000001F +#define SENS_DEBUG_BIT_SEL_M ((SENS_DEBUG_BIT_SEL_V)<<(SENS_DEBUG_BIT_SEL_S)) +#define SENS_DEBUG_BIT_SEL_V 0x1F +#define SENS_DEBUG_BIT_SEL_S 17 +/* SENS_SW_TONE_EN : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: 1: enable CW generator*/ +#define SENS_SW_TONE_EN (BIT(16)) +#define SENS_SW_TONE_EN_M (BIT(16)) +#define SENS_SW_TONE_EN_V 0x1 +#define SENS_SW_TONE_EN_S 16 +/* SENS_SW_FSTEP : R/W ;bitpos:[15:0] ;default: 16'b0 ; */ +/*description: frequency step for CW generator*/ +#define SENS_SW_FSTEP 0x0000FFFF +#define SENS_SW_FSTEP_M ((SENS_SW_FSTEP_V)<<(SENS_SW_FSTEP_S)) +#define SENS_SW_FSTEP_V 0xFFFF +#define SENS_SW_FSTEP_S 0 + +#define SENS_SAR_DAC_CTRL2_REG (DR_REG_SENS_BASE + 0x0120) +/* SENS_DAC_CW_EN2 : R/W ;bitpos:[25] ;default: 1'b1 ; */ +/*description: 1: to select CW generator as source to PDAC2_DAC[7:0]*/ +#define SENS_DAC_CW_EN2 (BIT(25)) +#define SENS_DAC_CW_EN2_M (BIT(25)) +#define SENS_DAC_CW_EN2_V 0x1 +#define SENS_DAC_CW_EN2_S 25 +/* SENS_DAC_CW_EN1 : R/W ;bitpos:[24] ;default: 1'b1 ; */ +/*description: 1: to select CW generator as source to PDAC1_DAC[7:0]*/ +#define SENS_DAC_CW_EN1 (BIT(24)) +#define SENS_DAC_CW_EN1_M (BIT(24)) +#define SENS_DAC_CW_EN1_V 0x1 +#define SENS_DAC_CW_EN1_S 24 +/* SENS_DAC_INV2 : R/W ;bitpos:[23:22] ;default: 2'b0 ; */ +/*description: 00: do not invert any bits*/ +#define SENS_DAC_INV2 0x00000003 +#define SENS_DAC_INV2_M ((SENS_DAC_INV2_V)<<(SENS_DAC_INV2_S)) +#define SENS_DAC_INV2_V 0x3 +#define SENS_DAC_INV2_S 22 +/* SENS_DAC_INV1 : R/W ;bitpos:[21:20] ;default: 2'b0 ; */ +/*description: 00: do not invert any bits*/ +#define SENS_DAC_INV1 0x00000003 +#define SENS_DAC_INV1_M ((SENS_DAC_INV1_V)<<(SENS_DAC_INV1_S)) +#define SENS_DAC_INV1_V 0x3 +#define SENS_DAC_INV1_S 20 +/* SENS_DAC_SCALE2 : R/W ;bitpos:[19:18] ;default: 2'b0 ; */ +/*description: 00: no scale*/ +#define SENS_DAC_SCALE2 0x00000003 +#define SENS_DAC_SCALE2_M ((SENS_DAC_SCALE2_V)<<(SENS_DAC_SCALE2_S)) +#define SENS_DAC_SCALE2_V 0x3 +#define SENS_DAC_SCALE2_S 18 +/* SENS_DAC_SCALE1 : R/W ;bitpos:[17:16] ;default: 2'b0 ; */ +/*description: 00: no scale*/ +#define SENS_DAC_SCALE1 0x00000003 +#define SENS_DAC_SCALE1_M ((SENS_DAC_SCALE1_V)<<(SENS_DAC_SCALE1_S)) +#define SENS_DAC_SCALE1_V 0x3 +#define SENS_DAC_SCALE1_S 16 +/* SENS_DAC_DC2 : R/W ;bitpos:[15:8] ;default: 8'b0 ; */ +/*description: DC offset for DAC2 CW generator*/ +#define SENS_DAC_DC2 0x000000FF +#define SENS_DAC_DC2_M ((SENS_DAC_DC2_V)<<(SENS_DAC_DC2_S)) +#define SENS_DAC_DC2_V 0xFF +#define SENS_DAC_DC2_S 8 +/* SENS_DAC_DC1 : R/W ;bitpos:[7:0] ;default: 8'b0 ; */ +/*description: DC offset for DAC1 CW generator*/ +#define SENS_DAC_DC1 0x000000FF +#define SENS_DAC_DC1_M ((SENS_DAC_DC1_V)<<(SENS_DAC_DC1_S)) +#define SENS_DAC_DC1_V 0xFF +#define SENS_DAC_DC1_S 0 + +#define SENS_SAR_COCPU_STATE_REG (DR_REG_SENS_BASE + 0x0124) +/* SENS_COCPU_EBREAK : RO ;bitpos:[30] ;default: 1'b0 ; */ +/*description: check cocpu whether in ebreak*/ +#define SENS_COCPU_EBREAK (BIT(30)) +#define SENS_COCPU_EBREAK_M (BIT(30)) +#define SENS_COCPU_EBREAK_V 0x1 +#define SENS_COCPU_EBREAK_S 30 +/* SENS_COCPU_TRAP : RO ;bitpos:[29] ;default: 1'b0 ; */ +/*description: check cocpu whether in trap state*/ +#define SENS_COCPU_TRAP (BIT(29)) +#define SENS_COCPU_TRAP_M (BIT(29)) +#define SENS_COCPU_TRAP_V 0x1 +#define SENS_COCPU_TRAP_S 29 +/* SENS_COCPU_EOI : RO ;bitpos:[28] ;default: 1'b0 ; */ +/*description: check cocpu whether in interrupt state*/ +#define SENS_COCPU_EOI (BIT(28)) +#define SENS_COCPU_EOI_M (BIT(28)) +#define SENS_COCPU_EOI_V 0x1 +#define SENS_COCPU_EOI_S 28 +/* SENS_COCPU_RESET_N : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: check cocpu whether in reset state*/ +#define SENS_COCPU_RESET_N (BIT(27)) +#define SENS_COCPU_RESET_N_M (BIT(27)) +#define SENS_COCPU_RESET_N_V 0x1 +#define SENS_COCPU_RESET_N_S 27 +/* SENS_COCPU_CLK_EN : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: check cocpu whether clk on*/ +#define SENS_COCPU_CLK_EN (BIT(26)) +#define SENS_COCPU_CLK_EN_M (BIT(26)) +#define SENS_COCPU_CLK_EN_V 0x1 +#define SENS_COCPU_CLK_EN_S 26 +/* SENS_COCPU_DBG_TRIGGER : WO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: trigger cocpu debug registers*/ +#define SENS_COCPU_DBG_TRIGGER (BIT(25)) +#define SENS_COCPU_DBG_TRIGGER_M (BIT(25)) +#define SENS_COCPU_DBG_TRIGGER_V 0x1 +#define SENS_COCPU_DBG_TRIGGER_S 25 + +#define SENS_SAR_COCPU_INT_RAW_REG (DR_REG_SENS_BASE + 0x0128) +/* SENS_COCPU_SWD_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: int from super watch dog*/ +#define SENS_COCPU_SWD_INT_RAW (BIT(8)) +#define SENS_COCPU_SWD_INT_RAW_M (BIT(8)) +#define SENS_COCPU_SWD_INT_RAW_V 0x1 +#define SENS_COCPU_SWD_INT_RAW_S 8 +/* SENS_COCPU_SW_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: int from software*/ +#define SENS_COCPU_SW_INT_RAW (BIT(7)) +#define SENS_COCPU_SW_INT_RAW_M (BIT(7)) +#define SENS_COCPU_SW_INT_RAW_V 0x1 +#define SENS_COCPU_SW_INT_RAW_S 7 +/* SENS_COCPU_START_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: int from start*/ +#define SENS_COCPU_START_INT_RAW (BIT(6)) +#define SENS_COCPU_START_INT_RAW_M (BIT(6)) +#define SENS_COCPU_START_INT_RAW_V 0x1 +#define SENS_COCPU_START_INT_RAW_S 6 +/* SENS_COCPU_TSENS_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: int from tsens*/ +#define SENS_COCPU_TSENS_INT_RAW (BIT(5)) +#define SENS_COCPU_TSENS_INT_RAW_M (BIT(5)) +#define SENS_COCPU_TSENS_INT_RAW_V 0x1 +#define SENS_COCPU_TSENS_INT_RAW_S 5 +/* SENS_COCPU_SENS2_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: int from saradc2*/ +#define SENS_COCPU_SENS2_INT_RAW (BIT(4)) +#define SENS_COCPU_SENS2_INT_RAW_M (BIT(4)) +#define SENS_COCPU_SENS2_INT_RAW_V 0x1 +#define SENS_COCPU_SENS2_INT_RAW_S 4 +/* SENS_COCPU_SENS1_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: int from saradc1*/ +#define SENS_COCPU_SENS1_INT_RAW (BIT(3)) +#define SENS_COCPU_SENS1_INT_RAW_M (BIT(3)) +#define SENS_COCPU_SENS1_INT_RAW_V 0x1 +#define SENS_COCPU_SENS1_INT_RAW_S 3 +/* SENS_COCPU_TOUCH_ACTIVE_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: int from touch active*/ +#define SENS_COCPU_TOUCH_ACTIVE_INT_RAW (BIT(2)) +#define SENS_COCPU_TOUCH_ACTIVE_INT_RAW_M (BIT(2)) +#define SENS_COCPU_TOUCH_ACTIVE_INT_RAW_V 0x1 +#define SENS_COCPU_TOUCH_ACTIVE_INT_RAW_S 2 +/* SENS_COCPU_TOUCH_INACTIVE_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: int from touch inactive*/ +#define SENS_COCPU_TOUCH_INACTIVE_INT_RAW (BIT(1)) +#define SENS_COCPU_TOUCH_INACTIVE_INT_RAW_M (BIT(1)) +#define SENS_COCPU_TOUCH_INACTIVE_INT_RAW_V 0x1 +#define SENS_COCPU_TOUCH_INACTIVE_INT_RAW_S 1 +/* SENS_COCPU_TOUCH_DONE_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: int from touch done*/ +#define SENS_COCPU_TOUCH_DONE_INT_RAW (BIT(0)) +#define SENS_COCPU_TOUCH_DONE_INT_RAW_M (BIT(0)) +#define SENS_COCPU_TOUCH_DONE_INT_RAW_V 0x1 +#define SENS_COCPU_TOUCH_DONE_INT_RAW_S 0 + +#define SENS_SAR_COCPU_INT_ENA_REG (DR_REG_SENS_BASE + 0x012c) +/* SENS_COCPU_SWD_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_SWD_INT_ENA (BIT(8)) +#define SENS_COCPU_SWD_INT_ENA_M (BIT(8)) +#define SENS_COCPU_SWD_INT_ENA_V 0x1 +#define SENS_COCPU_SWD_INT_ENA_S 8 +/* SENS_COCPU_SW_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: cocpu int enable*/ +#define SENS_COCPU_SW_INT_ENA (BIT(7)) +#define SENS_COCPU_SW_INT_ENA_M (BIT(7)) +#define SENS_COCPU_SW_INT_ENA_V 0x1 +#define SENS_COCPU_SW_INT_ENA_S 7 +/* SENS_COCPU_START_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_START_INT_ENA (BIT(6)) +#define SENS_COCPU_START_INT_ENA_M (BIT(6)) +#define SENS_COCPU_START_INT_ENA_V 0x1 +#define SENS_COCPU_START_INT_ENA_S 6 +/* SENS_COCPU_TSENS_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TSENS_INT_ENA (BIT(5)) +#define SENS_COCPU_TSENS_INT_ENA_M (BIT(5)) +#define SENS_COCPU_TSENS_INT_ENA_V 0x1 +#define SENS_COCPU_TSENS_INT_ENA_S 5 +/* SENS_COCPU_SENS2_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_SENS2_INT_ENA (BIT(4)) +#define SENS_COCPU_SENS2_INT_ENA_M (BIT(4)) +#define SENS_COCPU_SENS2_INT_ENA_V 0x1 +#define SENS_COCPU_SENS2_INT_ENA_S 4 +/* SENS_COCPU_SENS1_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_SENS1_INT_ENA (BIT(3)) +#define SENS_COCPU_SENS1_INT_ENA_M (BIT(3)) +#define SENS_COCPU_SENS1_INT_ENA_V 0x1 +#define SENS_COCPU_SENS1_INT_ENA_S 3 +/* SENS_COCPU_TOUCH_ACTIVE_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TOUCH_ACTIVE_INT_ENA (BIT(2)) +#define SENS_COCPU_TOUCH_ACTIVE_INT_ENA_M (BIT(2)) +#define SENS_COCPU_TOUCH_ACTIVE_INT_ENA_V 0x1 +#define SENS_COCPU_TOUCH_ACTIVE_INT_ENA_S 2 +/* SENS_COCPU_TOUCH_INACTIVE_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TOUCH_INACTIVE_INT_ENA (BIT(1)) +#define SENS_COCPU_TOUCH_INACTIVE_INT_ENA_M (BIT(1)) +#define SENS_COCPU_TOUCH_INACTIVE_INT_ENA_V 0x1 +#define SENS_COCPU_TOUCH_INACTIVE_INT_ENA_S 1 +/* SENS_COCPU_TOUCH_DONE_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TOUCH_DONE_INT_ENA (BIT(0)) +#define SENS_COCPU_TOUCH_DONE_INT_ENA_M (BIT(0)) +#define SENS_COCPU_TOUCH_DONE_INT_ENA_V 0x1 +#define SENS_COCPU_TOUCH_DONE_INT_ENA_S 0 + +#define SENS_SAR_COCPU_INT_ST_REG (DR_REG_SENS_BASE + 0x0130) +/* SENS_COCPU_SWD_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_SWD_INT_ST (BIT(8)) +#define SENS_COCPU_SWD_INT_ST_M (BIT(8)) +#define SENS_COCPU_SWD_INT_ST_V 0x1 +#define SENS_COCPU_SWD_INT_ST_S 8 +/* SENS_COCPU_SW_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: cocpu int status*/ +#define SENS_COCPU_SW_INT_ST (BIT(7)) +#define SENS_COCPU_SW_INT_ST_M (BIT(7)) +#define SENS_COCPU_SW_INT_ST_V 0x1 +#define SENS_COCPU_SW_INT_ST_S 7 +/* SENS_COCPU_START_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_START_INT_ST (BIT(6)) +#define SENS_COCPU_START_INT_ST_M (BIT(6)) +#define SENS_COCPU_START_INT_ST_V 0x1 +#define SENS_COCPU_START_INT_ST_S 6 +/* SENS_COCPU_TSENS_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TSENS_INT_ST (BIT(5)) +#define SENS_COCPU_TSENS_INT_ST_M (BIT(5)) +#define SENS_COCPU_TSENS_INT_ST_V 0x1 +#define SENS_COCPU_TSENS_INT_ST_S 5 +/* SENS_COCPU_SENS2_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_SENS2_INT_ST (BIT(4)) +#define SENS_COCPU_SENS2_INT_ST_M (BIT(4)) +#define SENS_COCPU_SENS2_INT_ST_V 0x1 +#define SENS_COCPU_SENS2_INT_ST_S 4 +/* SENS_COCPU_SENS1_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_SENS1_INT_ST (BIT(3)) +#define SENS_COCPU_SENS1_INT_ST_M (BIT(3)) +#define SENS_COCPU_SENS1_INT_ST_V 0x1 +#define SENS_COCPU_SENS1_INT_ST_S 3 +/* SENS_COCPU_TOUCH_ACTIVE_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TOUCH_ACTIVE_INT_ST (BIT(2)) +#define SENS_COCPU_TOUCH_ACTIVE_INT_ST_M (BIT(2)) +#define SENS_COCPU_TOUCH_ACTIVE_INT_ST_V 0x1 +#define SENS_COCPU_TOUCH_ACTIVE_INT_ST_S 2 +/* SENS_COCPU_TOUCH_INACTIVE_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TOUCH_INACTIVE_INT_ST (BIT(1)) +#define SENS_COCPU_TOUCH_INACTIVE_INT_ST_M (BIT(1)) +#define SENS_COCPU_TOUCH_INACTIVE_INT_ST_V 0x1 +#define SENS_COCPU_TOUCH_INACTIVE_INT_ST_S 1 +/* SENS_COCPU_TOUCH_DONE_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TOUCH_DONE_INT_ST (BIT(0)) +#define SENS_COCPU_TOUCH_DONE_INT_ST_M (BIT(0)) +#define SENS_COCPU_TOUCH_DONE_INT_ST_V 0x1 +#define SENS_COCPU_TOUCH_DONE_INT_ST_S 0 + +#define SENS_SAR_COCPU_INT_CLR_REG (DR_REG_SENS_BASE + 0x0134) +/* SENS_COCPU_SWD_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_SWD_INT_CLR (BIT(8)) +#define SENS_COCPU_SWD_INT_CLR_M (BIT(8)) +#define SENS_COCPU_SWD_INT_CLR_V 0x1 +#define SENS_COCPU_SWD_INT_CLR_S 8 +/* SENS_COCPU_SW_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: cocpu int clear*/ +#define SENS_COCPU_SW_INT_CLR (BIT(7)) +#define SENS_COCPU_SW_INT_CLR_M (BIT(7)) +#define SENS_COCPU_SW_INT_CLR_V 0x1 +#define SENS_COCPU_SW_INT_CLR_S 7 +/* SENS_COCPU_START_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_START_INT_CLR (BIT(6)) +#define SENS_COCPU_START_INT_CLR_M (BIT(6)) +#define SENS_COCPU_START_INT_CLR_V 0x1 +#define SENS_COCPU_START_INT_CLR_S 6 +/* SENS_COCPU_TSENS_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TSENS_INT_CLR (BIT(5)) +#define SENS_COCPU_TSENS_INT_CLR_M (BIT(5)) +#define SENS_COCPU_TSENS_INT_CLR_V 0x1 +#define SENS_COCPU_TSENS_INT_CLR_S 5 +/* SENS_COCPU_SENS2_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_SENS2_INT_CLR (BIT(4)) +#define SENS_COCPU_SENS2_INT_CLR_M (BIT(4)) +#define SENS_COCPU_SENS2_INT_CLR_V 0x1 +#define SENS_COCPU_SENS2_INT_CLR_S 4 +/* SENS_COCPU_SENS1_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_SENS1_INT_CLR (BIT(3)) +#define SENS_COCPU_SENS1_INT_CLR_M (BIT(3)) +#define SENS_COCPU_SENS1_INT_CLR_V 0x1 +#define SENS_COCPU_SENS1_INT_CLR_S 3 +/* SENS_COCPU_TOUCH_ACTIVE_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TOUCH_ACTIVE_INT_CLR (BIT(2)) +#define SENS_COCPU_TOUCH_ACTIVE_INT_CLR_M (BIT(2)) +#define SENS_COCPU_TOUCH_ACTIVE_INT_CLR_V 0x1 +#define SENS_COCPU_TOUCH_ACTIVE_INT_CLR_S 2 +/* SENS_COCPU_TOUCH_INACTIVE_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TOUCH_INACTIVE_INT_CLR (BIT(1)) +#define SENS_COCPU_TOUCH_INACTIVE_INT_CLR_M (BIT(1)) +#define SENS_COCPU_TOUCH_INACTIVE_INT_CLR_V 0x1 +#define SENS_COCPU_TOUCH_INACTIVE_INT_CLR_S 1 +/* SENS_COCPU_TOUCH_DONE_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SENS_COCPU_TOUCH_DONE_INT_CLR (BIT(0)) +#define SENS_COCPU_TOUCH_DONE_INT_CLR_M (BIT(0)) +#define SENS_COCPU_TOUCH_DONE_INT_CLR_V 0x1 +#define SENS_COCPU_TOUCH_DONE_INT_CLR_S 0 + +#define SENS_SAR_COCPU_DEBUG_REG (DR_REG_SENS_BASE + 0x0138) +/* SENS_COCPU_MEM_ADDR : RO ;bitpos:[31:19] ;default: 13'd0 ; */ +/*description: cocpu mem address output*/ +#define SENS_COCPU_MEM_ADDR 0x00001FFF +#define SENS_COCPU_MEM_ADDR_M ((SENS_COCPU_MEM_ADDR_V)<<(SENS_COCPU_MEM_ADDR_S)) +#define SENS_COCPU_MEM_ADDR_V 0x1FFF +#define SENS_COCPU_MEM_ADDR_S 19 +/* SENS_COCPU_MEM_WEN : RO ;bitpos:[18:15] ;default: 4'd0 ; */ +/*description: cocpu mem write enable output*/ +#define SENS_COCPU_MEM_WEN 0x0000000F +#define SENS_COCPU_MEM_WEN_M ((SENS_COCPU_MEM_WEN_V)<<(SENS_COCPU_MEM_WEN_S)) +#define SENS_COCPU_MEM_WEN_V 0xF +#define SENS_COCPU_MEM_WEN_S 15 +/* SENS_COCPU_MEM_RDY : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: cocpu mem ready input*/ +#define SENS_COCPU_MEM_RDY (BIT(14)) +#define SENS_COCPU_MEM_RDY_M (BIT(14)) +#define SENS_COCPU_MEM_RDY_V 0x1 +#define SENS_COCPU_MEM_RDY_S 14 +/* SENS_COCPU_MEM_VLD : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: cocpu mem valid output*/ +#define SENS_COCPU_MEM_VLD (BIT(13)) +#define SENS_COCPU_MEM_VLD_M (BIT(13)) +#define SENS_COCPU_MEM_VLD_V 0x1 +#define SENS_COCPU_MEM_VLD_S 13 +/* SENS_COCPU_PC : RO ;bitpos:[12:0] ;default: 13'd0 ; */ +/*description: cocpu Program counter*/ +#define SENS_COCPU_PC 0x00001FFF +#define SENS_COCPU_PC_M ((SENS_COCPU_PC_V)<<(SENS_COCPU_PC_S)) +#define SENS_COCPU_PC_V 0x1FFF +#define SENS_COCPU_PC_S 0 + +#define SENS_SAR_HALL_CTRL_REG (DR_REG_SENS_BASE + 0x013c) +/* SENS_HALL_PHASE_FORCE : R/W ;bitpos:[31] ;default: 1'b1 ; */ +/*description: 1: HALL PHASE is controlled by SW 0: HALL PHASE is controlled + by FSM in ULP-coprocessor*/ +#define SENS_HALL_PHASE_FORCE (BIT(31)) +#define SENS_HALL_PHASE_FORCE_M (BIT(31)) +#define SENS_HALL_PHASE_FORCE_V 0x1 +#define SENS_HALL_PHASE_FORCE_S 31 +/* SENS_HALL_PHASE : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: Reverse phase of hall sensor*/ +#define SENS_HALL_PHASE (BIT(30)) +#define SENS_HALL_PHASE_M (BIT(30)) +#define SENS_HALL_PHASE_V 0x1 +#define SENS_HALL_PHASE_S 30 +/* SENS_XPD_HALL_FORCE : R/W ;bitpos:[29] ;default: 1'b1 ; */ +/*description: 1: XPD HALL is controlled by SW. 0: XPD HALL is controlled by + FSM in ULP-coprocessor*/ +#define SENS_XPD_HALL_FORCE (BIT(29)) +#define SENS_XPD_HALL_FORCE_M (BIT(29)) +#define SENS_XPD_HALL_FORCE_V 0x1 +#define SENS_XPD_HALL_FORCE_S 29 +/* SENS_XPD_HALL : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: Power on hall sensor and connect to VP and VN*/ +#define SENS_XPD_HALL (BIT(28)) +#define SENS_XPD_HALL_M (BIT(28)) +#define SENS_XPD_HALL_V 0x1 +#define SENS_XPD_HALL_S 28 + +#define SENS_SAR_NOUSE_REG (DR_REG_SENS_BASE + 0x0140) +/* SENS_SAR_NOUSE : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SENS_SAR_NOUSE 0xFFFFFFFF +#define SENS_SAR_NOUSE_M ((SENS_SAR_NOUSE_V)<<(SENS_SAR_NOUSE_S)) +#define SENS_SAR_NOUSE_V 0xFFFFFFFF +#define SENS_SAR_NOUSE_S 0 + +#define SENS_SARDATE_REG (DR_REG_SENS_BASE + 0x0144) +/* SENS_SAR_DATE : R/W ;bitpos:[27:0] ;default: 28'h1809210 ; */ +/*description: */ +#define SENS_SAR_DATE 0x0FFFFFFF +#define SENS_SAR_DATE_M ((SENS_SAR_DATE_V)<<(SENS_SAR_DATE_S)) +#define SENS_SAR_DATE_V 0xFFFFFFF +#define SENS_SAR_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_SENS_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/sens_struct.h b/components/soc/esp32s2beta/include/soc/sens_struct.h new file mode 100644 index 0000000000..98808fc618 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/sens_struct.h @@ -0,0 +1,423 @@ +// Copyright 2017-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_SENS_STRUCT_H_ +#define _SOC_SENS_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t sar1_clk_div: 8; /*clock divider*/ + uint32_t sar1_sample_cycle: 8; /*sample cycles for SAR ADC1*/ + uint32_t sar1_sample_bit: 2; /*00: for 9-bit width*/ + uint32_t sar1_clk_gated: 1; + uint32_t sar1_sample_num: 8; + uint32_t reserved27: 1; + uint32_t sar1_data_inv: 1; /*Invert SAR ADC1 data*/ + uint32_t sar1_int_en: 1; /*enable saradc1 to send out interrupt*/ + uint32_t reserved30: 2; + }; + uint32_t val; + } sar_reader1_ctrl; + uint32_t sar_reader1_status; /**/ + union { + struct { + uint32_t sar1_bit_width: 2; /*00: 9 bit*/ + uint32_t sar1_stop: 1; /*stop SAR ADC1 conversion*/ + uint32_t reserved3: 21; + uint32_t force_xpd_amp: 2; + uint32_t amp_rst_fb_force: 2; + uint32_t amp_short_ref_force: 2; + uint32_t amp_short_ref_gnd_force: 2; + }; + uint32_t val; + } sar_meas1_ctrl1; + union { + struct { + uint32_t meas1_data_sar: 16; /*SAR ADC1 data*/ + uint32_t meas1_done_sar: 1; /*SAR ADC1 conversion done indication*/ + uint32_t meas1_start_sar: 1; /*SAR ADC1 controller (in RTC) starts conversion*/ + uint32_t meas1_start_force: 1; /*1: SAR ADC1 controller (in RTC) is started by SW*/ + uint32_t sar1_en_pad: 12; /*SAR ADC1 pad enable bitmap*/ + uint32_t sar1_en_pad_force: 1; /*1: SAR ADC1 pad enable bitmap is controlled by SW*/ + }; + uint32_t val; + } sar_meas1_ctrl2; + union { + struct { + uint32_t reserved0: 31; + uint32_t sar1_dig_force: 1; /*1: SAR ADC1 controlled by DIG ADC1 CTRL*/ + }; + uint32_t val; + } sar_meas1_mux; + uint32_t sar_atten1; /*2-bit attenuation for each pad*/ + union { + struct { + uint32_t sar_amp_wait1:16; + uint32_t sar_amp_wait2:16; + }; + uint32_t val; + } sar_amp_ctrl1; + union { + struct { + uint32_t sar1_dac_xpd_fsm_idle: 1; + uint32_t xpd_sar_amp_fsm_idle: 1; + uint32_t amp_rst_fb_fsm_idle: 1; + uint32_t amp_short_ref_fsm_idle: 1; + uint32_t amp_short_ref_gnd_fsm_idle: 1; + uint32_t xpd_sar_fsm_idle: 1; + uint32_t sar_rstb_fsm_idle: 1; + uint32_t reserved7: 9; + uint32_t sar_amp_wait3: 16; + }; + uint32_t val; + } sar_amp_ctrl2; + union { + struct { + uint32_t sar1_dac_xpd_fsm: 4; + uint32_t xpd_sar_amp_fsm: 4; + uint32_t amp_rst_fb_fsm: 4; + uint32_t amp_short_ref_fsm: 4; + uint32_t amp_short_ref_gnd_fsm: 4; + uint32_t xpd_sar_fsm: 4; + uint32_t sar_rstb_fsm: 4; + uint32_t reserved28: 4; + }; + uint32_t val; + } sar_amp_ctrl3; + union { + struct { + uint32_t sar2_clk_div: 8; /*clock divider*/ + uint32_t sar2_sample_cycle: 8; /*sample cycles for SAR ADC2*/ + uint32_t sar2_sample_bit: 2; /*00: for 9-bit width*/ + uint32_t sar2_clk_gated: 1; + uint32_t sar2_sample_num: 8; + uint32_t reserved27: 2; + uint32_t sar2_data_inv: 1; /*Invert SAR ADC2 data*/ + uint32_t sar2_int_en: 1; /*enable saradc2 to send out interrupt*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } sar_reader2_ctrl; + uint32_t sar_reader2_status; /**/ + union { + struct { + uint32_t sar2_bit_width: 2; /*00: 9 bit*/ + uint32_t sar2_stop: 1; /*stop SAR ADC2 conversion*/ + uint32_t sar2_pwdet_cal_en: 1; /*rtc control pwdet enable*/ + uint32_t sar2_pkdet_cal_en: 1; /*rtc control pkdet enable*/ + uint32_t sar2_en_test: 1; /*SAR2_EN_TEST*/ + uint32_t sar2_rstb_force: 2; + uint32_t sar2_standby_wait: 8; + uint32_t sar2_rstb_wait: 8; + uint32_t sar2_xpd_wait: 8; + }; + uint32_t val; + } sar_meas2_ctrl1; + union { + struct { + uint32_t meas2_data_sar: 16; /*SAR ADC2 data*/ + uint32_t meas2_done_sar: 1; /*SAR ADC2 conversion done indication*/ + uint32_t meas2_start_sar: 1; /*SAR ADC2 controller (in RTC) starts conversion*/ + uint32_t meas2_start_force: 1; /*1: SAR ADC2 controller (in RTC) is started by SW*/ + uint32_t sar2_en_pad: 12; /*SAR ADC2 pad enable bitmap*/ + uint32_t sar2_en_pad_force: 1; /*1: SAR ADC2 pad enable bitmap is controlled by SW*/ + }; + uint32_t val; + } sar_meas2_ctrl2; + union { + struct { + uint32_t reserved0: 28; + uint32_t sar2_pwdet_cct: 3; /*SAR2_PWDET_CCT*/ + uint32_t sar2_rtc_force: 1; /*in sleep force to use rtc to control ADC*/ + }; + uint32_t val; + } sar_meas2_mux; + uint32_t sar_atten2; /*2-bit attenuation for each pad*/ + union { + struct { + uint32_t reserved0: 23; + uint32_t sar2_dref: 3; /*Adjust saradc2 offset*/ + uint32_t sar1_dref: 3; /*Adjust saradc1 offset*/ + uint32_t force_xpd_sar: 2; + uint32_t sarclk_en: 1; + }; + uint32_t val; + } sar_power_xpd_sar; + union { + struct { + uint32_t i2c_slave_addr1: 11; + uint32_t i2c_slave_addr0: 11; + uint32_t meas_status: 8; + uint32_t reserved30: 2; + }; + uint32_t val; + } sar_slave_addr1; + union { + struct { + uint32_t i2c_slave_addr3:11; + uint32_t i2c_slave_addr2:11; + uint32_t reserved22: 10; + }; + uint32_t val; + } sar_slave_addr2; + union { + struct { + uint32_t i2c_slave_addr5:11; + uint32_t i2c_slave_addr4:11; + uint32_t reserved22: 10; + }; + uint32_t val; + } sar_slave_addr3; + union { + struct { + uint32_t i2c_slave_addr7:11; + uint32_t i2c_slave_addr6:11; + uint32_t reserved22: 10; + }; + uint32_t val; + } sar_slave_addr4; + union { + struct { + uint32_t tsens_out: 8; /*temperature sensor data out*/ + uint32_t tsens_ready: 1; /*indicate temperature sensor out ready*/ + uint32_t reserved9: 3; + uint32_t tsens_int_en: 1; /*enable temperature sensor to send out interrupt*/ + uint32_t tsens_in_inv: 1; /*invert temperature sensor data*/ + uint32_t tsens_clk_div: 8; /*temperature sensor clock divider*/ + uint32_t tsens_power_up: 1; /*temperature sensor power up*/ + uint32_t tsens_power_up_force: 1; /*1: dump out & power up controlled by SW*/ + uint32_t tsens_dump_out: 1; /*temperature sensor dump out*/ + uint32_t tsens_diz: 1; /*ADC input short*/ + uint32_t tsens_div_chop: 2; /*0 for steady phase 0 1 for steady phase 1 2 for chopping with ½ frequency of TSENS_CK 3 for chopping with ¼*/ + uint32_t tsens_dac: 4; /*Temperature sensor offset dac. 15 for 0 offset 5 for -2 7 for -1 11 for 1 10 for 2*/ + }; + uint32_t val; + } sar_tctrl; + union { + struct { + uint32_t tsens_xpd_wait: 12; + uint32_t tsens_xpd_force: 2; + uint32_t tsens_clk_inv: 1; + uint32_t tsens_clkgate_en: 1; /*temperature sensor clock enable*/ + uint32_t tsens_reset: 1; /*temperature sensor reset*/ + uint32_t reserved17: 15; + }; + uint32_t val; + } sar_tctrl2; + union { + struct { + uint32_t sar_i2c_ctrl: 28; /*I2C control data*/ + uint32_t sar_i2c_start: 1; /*start I2C*/ + uint32_t sar_i2c_start_force: 1; /*1: I2C started by SW*/ + uint32_t reserved30: 2; + }; + uint32_t val; + } sar_i2c_ctrl; + union { + struct { + uint32_t touch_outen: 15; /*touch controller output enable*/ + uint32_t touch_status_clr: 1; /*clear all touch active status*/ + uint32_t reserved16: 4; + uint32_t touch_approach_pad2: 4; /*indicate which pad is approach pad2*/ + uint32_t touch_approach_pad1: 4; /*indicate which pad is approach pad1*/ + uint32_t touch_approach_pad0: 4; /*indicate which pad is approach pad0*/ + }; + uint32_t val; + } sar_touch_conf; + union { + struct { + uint32_t thresh: 22; /*Finger threshold for touch pad 1*/ + uint32_t reserved22: 10; + }; + uint32_t val; + } touch_thresh[14]; + union { + struct { + uint32_t meas_out: 22; /*the counter for touch pad 1*/ + uint32_t reserved22: 10; + }; + uint32_t val; + } touch_meas[15]; + union { + struct { + uint32_t touch_pad_active: 15; /*touch active status*/ + uint32_t touch_channel_clr:15; /*Clear touch channel*/ + uint32_t reserved30: 1; + uint32_t touch_meas_done: 1; + }; + uint32_t val; + } sar_touch_chn_st; + union { + struct { + uint32_t touch_denoise_data:22; /*the counter for touch pad 0*/ + uint32_t touch_scan_curr: 4; + uint32_t reserved26: 6; + }; + uint32_t val; + } sar_touch_status0; + union { + struct { + uint32_t touch_pad_baseline: 22; + uint32_t reserved22: 7; + uint32_t touch_pad_debounce: 3; + }; + uint32_t val; + } sar_touch_status[14]; + union { + struct { + uint32_t touch_approach_pad2_cnt: 8; + uint32_t touch_approach_pad1_cnt: 8; + uint32_t touch_approach_pad0_cnt: 8; + uint32_t touch_slp_approach_cnt: 8; + }; + uint32_t val; + } sar_touch_status16; + union { + struct { + uint32_t sw_fstep: 16; /*frequency step for CW generator*/ + uint32_t sw_tone_en: 1; /*1: enable CW generator*/ + uint32_t debug_bit_sel: 5; + uint32_t dac_dig_force: 1; /*1: DAC1 & DAC2 use DMA*/ + uint32_t dac_clk_force_low: 1; /*1: force PDAC_CLK to low*/ + uint32_t dac_clk_force_high: 1; /*1: force PDAC_CLK to high*/ + uint32_t dac_clk_inv: 1; /*1: invert PDAC_CLK*/ + uint32_t reserved26: 6; + }; + uint32_t val; + } sar_dac_ctrl1; + union { + struct { + uint32_t dac_dc1: 8; /*DC offset for DAC1 CW generator*/ + uint32_t dac_dc2: 8; /*DC offset for DAC2 CW generator*/ + uint32_t dac_scale1: 2; /*00: no scale*/ + uint32_t dac_scale2: 2; /*00: no scale*/ + uint32_t dac_inv1: 2; /*00: do not invert any bits*/ + uint32_t dac_inv2: 2; /*00: do not invert any bits*/ + uint32_t dac_cw_en1: 1; /*1: to select CW generator as source to PDAC1_DAC[7:0]*/ + uint32_t dac_cw_en2: 1; /*1: to select CW generator as source to PDAC2_DAC[7:0]*/ + uint32_t reserved26: 6; + }; + uint32_t val; + } sar_dac_ctrl2; + union { + struct { + uint32_t reserved0: 25; + uint32_t dbg_trigger: 1; /*trigger cocpu debug registers*/ + uint32_t clk_en: 1; /*check cocpu whether clk on*/ + uint32_t reset_n: 1; /*check cocpu whether in reset state*/ + uint32_t eoi: 1; /*check cocpu whether in interrupt state*/ + uint32_t trap: 1; /*check cocpu whether in trap state*/ + uint32_t ebreak: 1; /*check cocpu whether in ebreak*/ + uint32_t reserved31: 1; + }; + uint32_t val; + } sar_cocpu_state; + union { + struct { + uint32_t touch_done: 1; /*int from touch done*/ + uint32_t touch_inactive: 1; /*int from touch inactive*/ + uint32_t touch_active: 1; /*int from touch active*/ + uint32_t saradc1: 1; /*int from saradc1*/ + uint32_t saradc2: 1; /*int from saradc2*/ + uint32_t tsens: 1; /*int from tsens*/ + uint32_t start: 1; /*int from start*/ + uint32_t sw: 1; /*int from software*/ + uint32_t swd: 1; /*int from super watch dog*/ + uint32_t reserved9: 23; + }; + uint32_t val; + } sar_cocpu_int_raw; + union { + struct { + uint32_t touch_done: 1; + uint32_t touch_inactive: 1; + uint32_t touch_active: 1; + uint32_t saradc1: 1; + uint32_t saradc2: 1; + uint32_t tsens: 1; + uint32_t start: 1; + uint32_t sw: 1; /*cocpu int enable*/ + uint32_t swd: 1; + uint32_t reserved9: 23; + }; + uint32_t val; + } sar_cocpu_int_ena; + union { + struct { + uint32_t touch_done: 1; + uint32_t touch_inactive: 1; + uint32_t touch_active: 1; + uint32_t saradc1: 1; + uint32_t saradc2: 1; + uint32_t tsens: 1; + uint32_t start: 1; + uint32_t sw: 1; /*cocpu int status*/ + uint32_t swd: 1; + uint32_t reserved9: 23; + }; + uint32_t val; + } sar_cocpu_int_st; + union { + struct { + uint32_t touch_done: 1; + uint32_t touch_inactive: 1; + uint32_t touch_active: 1; + uint32_t saradc1: 1; + uint32_t saradc2: 1; + uint32_t tsens: 1; + uint32_t start: 1; + uint32_t sw: 1; /*cocpu int clear*/ + uint32_t swd: 1; + uint32_t reserved9: 23; + }; + uint32_t val; + } sar_cocpu_int_clr; + union { + struct { + uint32_t pc: 13; /*cocpu Program counter*/ + uint32_t mem_vld: 1; /*cocpu mem valid output*/ + uint32_t mem_rdy: 1; /*cocpu mem ready input*/ + uint32_t mem_wen: 4; /*cocpu mem write enable output*/ + uint32_t mem_addr: 13; /*cocpu mem address output*/ + }; + uint32_t val; + } sar_cocpu_debug; + union { + struct { + uint32_t reserved0: 28; + uint32_t xpd_hall: 1; /*Power on hall sensor and connect to VP and VN*/ + uint32_t xpd_hall_force: 1; /*1: XPD HALL is controlled by SW. 0: XPD HALL is controlled by FSM in ULP-coprocessor*/ + uint32_t hall_phase: 1; /*Reverse phase of hall sensor*/ + uint32_t hall_phase_force: 1; /*1: HALL PHASE is controlled by SW 0: HALL PHASE is controlled by FSM in ULP-coprocessor*/ + }; + uint32_t val; + } sar_hall_ctrl; + uint32_t sar_nouse; /**/ + union { + struct { + uint32_t sar_date: 28; + uint32_t reserved28: 4; + }; + uint32_t val; + } sardate; +} sens_dev_t; +extern sens_dev_t SENS; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_SENS_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/sensitive_reg.h b/components/soc/esp32s2beta/include/soc/sensitive_reg.h new file mode 100644 index 0000000000..cceee7bd83 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/sensitive_reg.h @@ -0,0 +1,1220 @@ +// Copyright 2017-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_SENSITIVE_REG_H_ +#define _SOC_SENSITIVE_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define DPORT_PMS_SDIO_0_REG (DR_REG_SENSITIVE_BASE + 0x000) +/* DPORT_PMS_SDIO_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_SDIO_LOCK (BIT(0)) +#define DPORT_PMS_SDIO_LOCK_M (BIT(0)) +#define DPORT_PMS_SDIO_LOCK_V 0x1 +#define DPORT_PMS_SDIO_LOCK_S 0 + +#define DPORT_PMS_SDIO_1_REG (DR_REG_SENSITIVE_BASE + 0x004) +/* DPORT_PMS_SDIO_DISABLE : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_SDIO_DISABLE (BIT(0)) +#define DPORT_PMS_SDIO_DISABLE_M (BIT(0)) +#define DPORT_PMS_SDIO_DISABLE_V 0x1 +#define DPORT_PMS_SDIO_DISABLE_S 0 + +#define DPORT_PMS_MAC_DUMP_0_REG (DR_REG_SENSITIVE_BASE + 0x008) +/* DPORT_PMS_MAC_DUMP_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_MAC_DUMP_LOCK (BIT(0)) +#define DPORT_PMS_MAC_DUMP_LOCK_M (BIT(0)) +#define DPORT_PMS_MAC_DUMP_LOCK_V 0x1 +#define DPORT_PMS_MAC_DUMP_LOCK_S 0 + +#define DPORT_PMS_MAC_DUMP_1_REG (DR_REG_SENSITIVE_BASE + 0x00C) +/* DPORT_PMS_MAC_DUMP_CONNECT : R/W ;bitpos:[11:0] ;default: 12'b000011100100 ; */ +/*description: */ +#define DPORT_PMS_MAC_DUMP_CONNECT 0x00000FFF +#define DPORT_PMS_MAC_DUMP_CONNECT_M ((DPORT_PMS_MAC_DUMP_CONNECT_V)<<(DPORT_PMS_MAC_DUMP_CONNECT_S)) +#define DPORT_PMS_MAC_DUMP_CONNECT_V 0xFFF +#define DPORT_PMS_MAC_DUMP_CONNECT_S 0 + +#define DPORT_PMS_PRO_IRAM0_0_REG (DR_REG_SENSITIVE_BASE + 0x010) +/* DPORT_PMS_PRO_IRAM0_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_LOCK (BIT(0)) +#define DPORT_PMS_PRO_IRAM0_LOCK_M (BIT(0)) +#define DPORT_PMS_PRO_IRAM0_LOCK_V 0x1 +#define DPORT_PMS_PRO_IRAM0_LOCK_S 0 + +#define DPORT_PMS_PRO_IRAM0_1_REG (DR_REG_SENSITIVE_BASE + 0x014) +/* DPORT_PMS_PRO_IRAM0_SRAM_3_W : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_3_W (BIT(11)) +#define DPORT_PMS_PRO_IRAM0_SRAM_3_W_M (BIT(11)) +#define DPORT_PMS_PRO_IRAM0_SRAM_3_W_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_3_W_S 11 +/* DPORT_PMS_PRO_IRAM0_SRAM_3_R : R/W ;bitpos:[10] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_3_R (BIT(10)) +#define DPORT_PMS_PRO_IRAM0_SRAM_3_R_M (BIT(10)) +#define DPORT_PMS_PRO_IRAM0_SRAM_3_R_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_3_R_S 10 +/* DPORT_PMS_PRO_IRAM0_SRAM_3_F : R/W ;bitpos:[9] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_3_F (BIT(9)) +#define DPORT_PMS_PRO_IRAM0_SRAM_3_F_M (BIT(9)) +#define DPORT_PMS_PRO_IRAM0_SRAM_3_F_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_3_F_S 9 +/* DPORT_PMS_PRO_IRAM0_SRAM_2_W : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_2_W (BIT(8)) +#define DPORT_PMS_PRO_IRAM0_SRAM_2_W_M (BIT(8)) +#define DPORT_PMS_PRO_IRAM0_SRAM_2_W_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_2_W_S 8 +/* DPORT_PMS_PRO_IRAM0_SRAM_2_R : R/W ;bitpos:[7] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_2_R (BIT(7)) +#define DPORT_PMS_PRO_IRAM0_SRAM_2_R_M (BIT(7)) +#define DPORT_PMS_PRO_IRAM0_SRAM_2_R_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_2_R_S 7 +/* DPORT_PMS_PRO_IRAM0_SRAM_2_F : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_2_F (BIT(6)) +#define DPORT_PMS_PRO_IRAM0_SRAM_2_F_M (BIT(6)) +#define DPORT_PMS_PRO_IRAM0_SRAM_2_F_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_2_F_S 6 +/* DPORT_PMS_PRO_IRAM0_SRAM_1_W : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_1_W (BIT(5)) +#define DPORT_PMS_PRO_IRAM0_SRAM_1_W_M (BIT(5)) +#define DPORT_PMS_PRO_IRAM0_SRAM_1_W_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_1_W_S 5 +/* DPORT_PMS_PRO_IRAM0_SRAM_1_R : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_1_R (BIT(4)) +#define DPORT_PMS_PRO_IRAM0_SRAM_1_R_M (BIT(4)) +#define DPORT_PMS_PRO_IRAM0_SRAM_1_R_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_1_R_S 4 +/* DPORT_PMS_PRO_IRAM0_SRAM_1_F : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_1_F (BIT(3)) +#define DPORT_PMS_PRO_IRAM0_SRAM_1_F_M (BIT(3)) +#define DPORT_PMS_PRO_IRAM0_SRAM_1_F_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_1_F_S 3 +/* DPORT_PMS_PRO_IRAM0_SRAM_0_W : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_0_W (BIT(2)) +#define DPORT_PMS_PRO_IRAM0_SRAM_0_W_M (BIT(2)) +#define DPORT_PMS_PRO_IRAM0_SRAM_0_W_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_0_W_S 2 +/* DPORT_PMS_PRO_IRAM0_SRAM_0_R : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_0_R (BIT(1)) +#define DPORT_PMS_PRO_IRAM0_SRAM_0_R_M (BIT(1)) +#define DPORT_PMS_PRO_IRAM0_SRAM_0_R_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_0_R_S 1 +/* DPORT_PMS_PRO_IRAM0_SRAM_0_F : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_0_F (BIT(0)) +#define DPORT_PMS_PRO_IRAM0_SRAM_0_F_M (BIT(0)) +#define DPORT_PMS_PRO_IRAM0_SRAM_0_F_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_0_F_S 0 + +#define DPORT_PMS_PRO_IRAM0_2_REG (DR_REG_SENSITIVE_BASE + 0x018) +/* DPORT_PMS_PRO_IRAM0_SRAM_4_H_W : R/W ;bitpos:[22] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_W (BIT(22)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_W_M (BIT(22)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_W_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_W_S 22 +/* DPORT_PMS_PRO_IRAM0_SRAM_4_H_R : R/W ;bitpos:[21] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_R (BIT(21)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_R_M (BIT(21)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_R_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_R_S 21 +/* DPORT_PMS_PRO_IRAM0_SRAM_4_H_F : R/W ;bitpos:[20] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_F (BIT(20)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_F_M (BIT(20)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_F_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_4_H_F_S 20 +/* DPORT_PMS_PRO_IRAM0_SRAM_4_L_W : R/W ;bitpos:[19] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_W (BIT(19)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_W_M (BIT(19)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_W_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_W_S 19 +/* DPORT_PMS_PRO_IRAM0_SRAM_4_L_R : R/W ;bitpos:[18] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_R (BIT(18)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_R_M (BIT(18)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_R_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_R_S 18 +/* DPORT_PMS_PRO_IRAM0_SRAM_4_L_F : R/W ;bitpos:[17] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_F (BIT(17)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_F_M (BIT(17)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_F_V 0x1 +#define DPORT_PMS_PRO_IRAM0_SRAM_4_L_F_S 17 +/* DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR : R/W ;bitpos:[16:0] ;default: 17'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR 0x0001FFFF +#define DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR_M ((DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR_V)<<(DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR_S)) +#define DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR_V 0x1FFFF +#define DPORT_PMS_PRO_IRAM0_SRAM_4_SPLTADDR_S 0 + +#define DPORT_PMS_PRO_IRAM0_3_REG (DR_REG_SENSITIVE_BASE + 0x01C) +/* DPORT_PMS_PRO_IRAM0_RTCFAST_H_W : R/W ;bitpos:[16] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_W (BIT(16)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_W_M (BIT(16)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_W_V 0x1 +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_W_S 16 +/* DPORT_PMS_PRO_IRAM0_RTCFAST_H_R : R/W ;bitpos:[15] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_R (BIT(15)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_R_M (BIT(15)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_R_V 0x1 +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_R_S 15 +/* DPORT_PMS_PRO_IRAM0_RTCFAST_H_F : R/W ;bitpos:[14] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_F (BIT(14)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_F_M (BIT(14)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_F_V 0x1 +#define DPORT_PMS_PRO_IRAM0_RTCFAST_H_F_S 14 +/* DPORT_PMS_PRO_IRAM0_RTCFAST_L_W : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_W (BIT(13)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_W_M (BIT(13)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_W_V 0x1 +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_W_S 13 +/* DPORT_PMS_PRO_IRAM0_RTCFAST_L_R : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_R (BIT(12)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_R_M (BIT(12)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_R_V 0x1 +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_R_S 12 +/* DPORT_PMS_PRO_IRAM0_RTCFAST_L_F : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_F (BIT(11)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_F_M (BIT(11)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_F_V 0x1 +#define DPORT_PMS_PRO_IRAM0_RTCFAST_L_F_S 11 +/* DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR : R/W ;bitpos:[10:0] ;default: 11'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR 0x000007FF +#define DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR_M ((DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR_V)<<(DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR_S)) +#define DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR_V 0x7FF +#define DPORT_PMS_PRO_IRAM0_RTCFAST_SPLTADDR_S 0 + +#define DPORT_PMS_PRO_IRAM0_4_REG (DR_REG_SENSITIVE_BASE + 0x020) +/* DPORT_PMS_PRO_IRAM0_ILG_INTR : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_ILG_INTR (BIT(2)) +#define DPORT_PMS_PRO_IRAM0_ILG_INTR_M (BIT(2)) +#define DPORT_PMS_PRO_IRAM0_ILG_INTR_V 0x1 +#define DPORT_PMS_PRO_IRAM0_ILG_INTR_S 2 +/* DPORT_PMS_PRO_IRAM0_ILG_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_ILG_EN (BIT(1)) +#define DPORT_PMS_PRO_IRAM0_ILG_EN_M (BIT(1)) +#define DPORT_PMS_PRO_IRAM0_ILG_EN_V 0x1 +#define DPORT_PMS_PRO_IRAM0_ILG_EN_S 1 +/* DPORT_PMS_PRO_IRAM0_ILG_CLR : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_ILG_CLR (BIT(0)) +#define DPORT_PMS_PRO_IRAM0_ILG_CLR_M (BIT(0)) +#define DPORT_PMS_PRO_IRAM0_ILG_CLR_V 0x1 +#define DPORT_PMS_PRO_IRAM0_ILG_CLR_S 0 + +#define DPORT_PMS_PRO_IRAM0_5_REG (DR_REG_SENSITIVE_BASE + 0x024) +/* DPORT_PMS_PRO_IRAM0_ILG_ST : RO ;bitpos:[21:0] ;default: 22'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_IRAM0_ILG_ST 0x003FFFFF +#define DPORT_PMS_PRO_IRAM0_ILG_ST_M ((DPORT_PMS_PRO_IRAM0_ILG_ST_V)<<(DPORT_PMS_PRO_IRAM0_ILG_ST_S)) +#define DPORT_PMS_PRO_IRAM0_ILG_ST_V 0x3FFFFF +#define DPORT_PMS_PRO_IRAM0_ILG_ST_S 0 + +#define DPORT_PMS_PRO_DRAM0_0_REG (DR_REG_SENSITIVE_BASE + 0x028) +/* DPORT_PMS_PRO_DRAM0_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_LOCK (BIT(0)) +#define DPORT_PMS_PRO_DRAM0_LOCK_M (BIT(0)) +#define DPORT_PMS_PRO_DRAM0_LOCK_V 0x1 +#define DPORT_PMS_PRO_DRAM0_LOCK_S 0 + +#define DPORT_PMS_PRO_DRAM0_1_REG (DR_REG_SENSITIVE_BASE + 0x02C) +/* DPORT_PMS_PRO_DRAM0_SRAM_4_H_W : R/W ;bitpos:[28] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_4_H_W (BIT(28)) +#define DPORT_PMS_PRO_DRAM0_SRAM_4_H_W_M (BIT(28)) +#define DPORT_PMS_PRO_DRAM0_SRAM_4_H_W_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_4_H_W_S 28 +/* DPORT_PMS_PRO_DRAM0_SRAM_4_H_R : R/W ;bitpos:[27] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_4_H_R (BIT(27)) +#define DPORT_PMS_PRO_DRAM0_SRAM_4_H_R_M (BIT(27)) +#define DPORT_PMS_PRO_DRAM0_SRAM_4_H_R_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_4_H_R_S 27 +/* DPORT_PMS_PRO_DRAM0_SRAM_4_L_W : R/W ;bitpos:[26] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_4_L_W (BIT(26)) +#define DPORT_PMS_PRO_DRAM0_SRAM_4_L_W_M (BIT(26)) +#define DPORT_PMS_PRO_DRAM0_SRAM_4_L_W_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_4_L_W_S 26 +/* DPORT_PMS_PRO_DRAM0_SRAM_4_L_R : R/W ;bitpos:[25] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_4_L_R (BIT(25)) +#define DPORT_PMS_PRO_DRAM0_SRAM_4_L_R_M (BIT(25)) +#define DPORT_PMS_PRO_DRAM0_SRAM_4_L_R_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_4_L_R_S 25 +/* DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR : R/W ;bitpos:[24:8] ;default: 17'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR 0x0001FFFF +#define DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR_M ((DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR_V)<<(DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR_S)) +#define DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR_V 0x1FFFF +#define DPORT_PMS_PRO_DRAM0_SRAM_4_SPLTADDR_S 8 +/* DPORT_PMS_PRO_DRAM0_SRAM_3_W : R/W ;bitpos:[7] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_3_W (BIT(7)) +#define DPORT_PMS_PRO_DRAM0_SRAM_3_W_M (BIT(7)) +#define DPORT_PMS_PRO_DRAM0_SRAM_3_W_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_3_W_S 7 +/* DPORT_PMS_PRO_DRAM0_SRAM_3_R : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_3_R (BIT(6)) +#define DPORT_PMS_PRO_DRAM0_SRAM_3_R_M (BIT(6)) +#define DPORT_PMS_PRO_DRAM0_SRAM_3_R_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_3_R_S 6 +/* DPORT_PMS_PRO_DRAM0_SRAM_2_W : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_2_W (BIT(5)) +#define DPORT_PMS_PRO_DRAM0_SRAM_2_W_M (BIT(5)) +#define DPORT_PMS_PRO_DRAM0_SRAM_2_W_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_2_W_S 5 +/* DPORT_PMS_PRO_DRAM0_SRAM_2_R : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_2_R (BIT(4)) +#define DPORT_PMS_PRO_DRAM0_SRAM_2_R_M (BIT(4)) +#define DPORT_PMS_PRO_DRAM0_SRAM_2_R_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_2_R_S 4 +/* DPORT_PMS_PRO_DRAM0_SRAM_1_W : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_1_W (BIT(3)) +#define DPORT_PMS_PRO_DRAM0_SRAM_1_W_M (BIT(3)) +#define DPORT_PMS_PRO_DRAM0_SRAM_1_W_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_1_W_S 3 +/* DPORT_PMS_PRO_DRAM0_SRAM_1_R : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_1_R (BIT(2)) +#define DPORT_PMS_PRO_DRAM0_SRAM_1_R_M (BIT(2)) +#define DPORT_PMS_PRO_DRAM0_SRAM_1_R_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_1_R_S 2 +/* DPORT_PMS_PRO_DRAM0_SRAM_0_W : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_0_W (BIT(1)) +#define DPORT_PMS_PRO_DRAM0_SRAM_0_W_M (BIT(1)) +#define DPORT_PMS_PRO_DRAM0_SRAM_0_W_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_0_W_S 1 +/* DPORT_PMS_PRO_DRAM0_SRAM_0_R : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_SRAM_0_R (BIT(0)) +#define DPORT_PMS_PRO_DRAM0_SRAM_0_R_M (BIT(0)) +#define DPORT_PMS_PRO_DRAM0_SRAM_0_R_V 0x1 +#define DPORT_PMS_PRO_DRAM0_SRAM_0_R_S 0 + +#define DPORT_PMS_PRO_DRAM0_2_REG (DR_REG_SENSITIVE_BASE + 0x030) +/* DPORT_PMS_PRO_DRAM0_RTCFAST_H_W : R/W ;bitpos:[14] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_RTCFAST_H_W (BIT(14)) +#define DPORT_PMS_PRO_DRAM0_RTCFAST_H_W_M (BIT(14)) +#define DPORT_PMS_PRO_DRAM0_RTCFAST_H_W_V 0x1 +#define DPORT_PMS_PRO_DRAM0_RTCFAST_H_W_S 14 +/* DPORT_PMS_PRO_DRAM0_RTCFAST_H_R : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_RTCFAST_H_R (BIT(13)) +#define DPORT_PMS_PRO_DRAM0_RTCFAST_H_R_M (BIT(13)) +#define DPORT_PMS_PRO_DRAM0_RTCFAST_H_R_V 0x1 +#define DPORT_PMS_PRO_DRAM0_RTCFAST_H_R_S 13 +/* DPORT_PMS_PRO_DRAM0_RTCFAST_L_W : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_RTCFAST_L_W (BIT(12)) +#define DPORT_PMS_PRO_DRAM0_RTCFAST_L_W_M (BIT(12)) +#define DPORT_PMS_PRO_DRAM0_RTCFAST_L_W_V 0x1 +#define DPORT_PMS_PRO_DRAM0_RTCFAST_L_W_S 12 +/* DPORT_PMS_PRO_DRAM0_RTCFAST_L_R : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_RTCFAST_L_R (BIT(11)) +#define DPORT_PMS_PRO_DRAM0_RTCFAST_L_R_M (BIT(11)) +#define DPORT_PMS_PRO_DRAM0_RTCFAST_L_R_V 0x1 +#define DPORT_PMS_PRO_DRAM0_RTCFAST_L_R_S 11 +/* DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR : R/W ;bitpos:[10:0] ;default: 11'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR 0x000007FF +#define DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR_M ((DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR_V)<<(DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR_S)) +#define DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR_V 0x7FF +#define DPORT_PMS_PRO_DRAM0_RTCFAST_SPLTADDR_S 0 + +#define DPORT_PMS_PRO_DRAM0_3_REG (DR_REG_SENSITIVE_BASE + 0x034) +/* DPORT_PMS_PRO_DRAM0_ILG_INTR : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_ILG_INTR (BIT(2)) +#define DPORT_PMS_PRO_DRAM0_ILG_INTR_M (BIT(2)) +#define DPORT_PMS_PRO_DRAM0_ILG_INTR_V 0x1 +#define DPORT_PMS_PRO_DRAM0_ILG_INTR_S 2 +/* DPORT_PMS_PRO_DRAM0_ILG_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_ILG_EN (BIT(1)) +#define DPORT_PMS_PRO_DRAM0_ILG_EN_M (BIT(1)) +#define DPORT_PMS_PRO_DRAM0_ILG_EN_V 0x1 +#define DPORT_PMS_PRO_DRAM0_ILG_EN_S 1 +/* DPORT_PMS_PRO_DRAM0_ILG_CLR : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_ILG_CLR (BIT(0)) +#define DPORT_PMS_PRO_DRAM0_ILG_CLR_M (BIT(0)) +#define DPORT_PMS_PRO_DRAM0_ILG_CLR_V 0x1 +#define DPORT_PMS_PRO_DRAM0_ILG_CLR_S 0 + +#define DPORT_PMS_PRO_DRAM0_4_REG (DR_REG_SENSITIVE_BASE + 0x038) +/* DPORT_PMS_PRO_DRAM0_ILG_ST : RO ;bitpos:[25:0] ;default: 26'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DRAM0_ILG_ST 0x03FFFFFF +#define DPORT_PMS_PRO_DRAM0_ILG_ST_M ((DPORT_PMS_PRO_DRAM0_ILG_ST_V)<<(DPORT_PMS_PRO_DRAM0_ILG_ST_S)) +#define DPORT_PMS_PRO_DRAM0_ILG_ST_V 0x3FFFFFF +#define DPORT_PMS_PRO_DRAM0_ILG_ST_S 0 + +#define DPORT_PMS_PRO_DPORT_0_REG (DR_REG_SENSITIVE_BASE + 0x03C) +/* DPORT_PMS_PRO_DPORT_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_LOCK (BIT(0)) +#define DPORT_PMS_PRO_DPORT_LOCK_M (BIT(0)) +#define DPORT_PMS_PRO_DPORT_LOCK_V 0x1 +#define DPORT_PMS_PRO_DPORT_LOCK_S 0 + +#define DPORT_PMS_PRO_DPORT_1_REG (DR_REG_SENSITIVE_BASE + 0x040) +/* DPORT_PMS_PRO_DPORT_RESERVE_FIFO_VALID : R/W ;bitpos:[19:16] ;default: 4'b0000 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_VALID 0x0000000F +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_VALID_M ((DPORT_PMS_PRO_DPORT_RESERVE_FIFO_VALID_V)<<(DPORT_PMS_PRO_DPORT_RESERVE_FIFO_VALID_S)) +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_VALID_V 0xF +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_VALID_S 16 +/* DPORT_PMS_PRO_DPORT_RTCSLOW_H_W : R/W ;bitpos:[15] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_RTCSLOW_H_W (BIT(15)) +#define DPORT_PMS_PRO_DPORT_RTCSLOW_H_W_M (BIT(15)) +#define DPORT_PMS_PRO_DPORT_RTCSLOW_H_W_V 0x1 +#define DPORT_PMS_PRO_DPORT_RTCSLOW_H_W_S 15 +/* DPORT_PMS_PRO_DPORT_RTCSLOW_H_R : R/W ;bitpos:[14] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_RTCSLOW_H_R (BIT(14)) +#define DPORT_PMS_PRO_DPORT_RTCSLOW_H_R_M (BIT(14)) +#define DPORT_PMS_PRO_DPORT_RTCSLOW_H_R_V 0x1 +#define DPORT_PMS_PRO_DPORT_RTCSLOW_H_R_S 14 +/* DPORT_PMS_PRO_DPORT_RTCSLOW_L_W : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_RTCSLOW_L_W (BIT(13)) +#define DPORT_PMS_PRO_DPORT_RTCSLOW_L_W_M (BIT(13)) +#define DPORT_PMS_PRO_DPORT_RTCSLOW_L_W_V 0x1 +#define DPORT_PMS_PRO_DPORT_RTCSLOW_L_W_S 13 +/* DPORT_PMS_PRO_DPORT_RTCSLOW_L_R : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_RTCSLOW_L_R (BIT(12)) +#define DPORT_PMS_PRO_DPORT_RTCSLOW_L_R_M (BIT(12)) +#define DPORT_PMS_PRO_DPORT_RTCSLOW_L_R_V 0x1 +#define DPORT_PMS_PRO_DPORT_RTCSLOW_L_R_S 12 +/* DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR : R/W ;bitpos:[11:1] ;default: 11'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR 0x000007FF +#define DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR_M ((DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR_V)<<(DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR_S)) +#define DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR_V 0x7FF +#define DPORT_PMS_PRO_DPORT_RTCSLOW_SPLTADDR_S 1 +/* DPORT_PMS_PRO_DPORT_APB_PERIPHERAL_FORBID : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_APB_PERIPHERAL_FORBID (BIT(0)) +#define DPORT_PMS_PRO_DPORT_APB_PERIPHERAL_FORBID_M (BIT(0)) +#define DPORT_PMS_PRO_DPORT_APB_PERIPHERAL_FORBID_V 0x1 +#define DPORT_PMS_PRO_DPORT_APB_PERIPHERAL_FORBID_S 0 + +#define DPORT_PMS_PRO_DPORT_2_REG (DR_REG_SENSITIVE_BASE + 0x044) +/* DPORT_PMS_PRO_DPORT_RESERVE_FIFO_0 : R/W ;bitpos:[17:0] ;default: 18'h0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_0 0x0003FFFF +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_0_M ((DPORT_PMS_PRO_DPORT_RESERVE_FIFO_0_V)<<(DPORT_PMS_PRO_DPORT_RESERVE_FIFO_0_S)) +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_0_V 0x3FFFF +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_0_S 0 + +#define DPORT_PMS_PRO_DPORT_3_REG (DR_REG_SENSITIVE_BASE + 0x048) +/* DPORT_PMS_PRO_DPORT_RESERVE_FIFO_1 : R/W ;bitpos:[17:0] ;default: 18'h0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_1 0x0003FFFF +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_1_M ((DPORT_PMS_PRO_DPORT_RESERVE_FIFO_1_V)<<(DPORT_PMS_PRO_DPORT_RESERVE_FIFO_1_S)) +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_1_V 0x3FFFF +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_1_S 0 + +#define DPORT_PMS_PRO_DPORT_4_REG (DR_REG_SENSITIVE_BASE + 0x04C) +/* DPORT_PMS_PRO_DPORT_RESERVE_FIFO_2 : R/W ;bitpos:[17:0] ;default: 18'h0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_2 0x0003FFFF +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_2_M ((DPORT_PMS_PRO_DPORT_RESERVE_FIFO_2_V)<<(DPORT_PMS_PRO_DPORT_RESERVE_FIFO_2_S)) +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_2_V 0x3FFFF +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_2_S 0 + +#define DPORT_PMS_PRO_DPORT_5_REG (DR_REG_SENSITIVE_BASE + 0x050) +/* DPORT_PMS_PRO_DPORT_RESERVE_FIFO_3 : R/W ;bitpos:[17:0] ;default: 18'h0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_3 0x0003FFFF +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_3_M ((DPORT_PMS_PRO_DPORT_RESERVE_FIFO_3_V)<<(DPORT_PMS_PRO_DPORT_RESERVE_FIFO_3_S)) +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_3_V 0x3FFFF +#define DPORT_PMS_PRO_DPORT_RESERVE_FIFO_3_S 0 + +#define DPORT_PMS_PRO_DPORT_6_REG (DR_REG_SENSITIVE_BASE + 0x054) +/* DPORT_PMS_PRO_DPORT_ILG_INTR : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_ILG_INTR (BIT(2)) +#define DPORT_PMS_PRO_DPORT_ILG_INTR_M (BIT(2)) +#define DPORT_PMS_PRO_DPORT_ILG_INTR_V 0x1 +#define DPORT_PMS_PRO_DPORT_ILG_INTR_S 2 +/* DPORT_PMS_PRO_DPORT_ILG_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_ILG_EN (BIT(1)) +#define DPORT_PMS_PRO_DPORT_ILG_EN_M (BIT(1)) +#define DPORT_PMS_PRO_DPORT_ILG_EN_V 0x1 +#define DPORT_PMS_PRO_DPORT_ILG_EN_S 1 +/* DPORT_PMS_PRO_DPORT_ILG_CLR : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_ILG_CLR (BIT(0)) +#define DPORT_PMS_PRO_DPORT_ILG_CLR_M (BIT(0)) +#define DPORT_PMS_PRO_DPORT_ILG_CLR_V 0x1 +#define DPORT_PMS_PRO_DPORT_ILG_CLR_S 0 + +#define DPORT_PMS_PRO_DPORT_7_REG (DR_REG_SENSITIVE_BASE + 0x058) +/* DPORT_PMS_PRO_DPORT_ILG_ST : RO ;bitpos:[25:0] ;default: 26'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_DPORT_ILG_ST 0x03FFFFFF +#define DPORT_PMS_PRO_DPORT_ILG_ST_M ((DPORT_PMS_PRO_DPORT_ILG_ST_V)<<(DPORT_PMS_PRO_DPORT_ILG_ST_S)) +#define DPORT_PMS_PRO_DPORT_ILG_ST_V 0x3FFFFFF +#define DPORT_PMS_PRO_DPORT_ILG_ST_S 0 + +#define DPORT_PMS_PRO_AHB_0_REG (DR_REG_SENSITIVE_BASE + 0x05C) +/* DPORT_PMS_PRO_AHB_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_LOCK (BIT(0)) +#define DPORT_PMS_PRO_AHB_LOCK_M (BIT(0)) +#define DPORT_PMS_PRO_AHB_LOCK_V 0x1 +#define DPORT_PMS_PRO_AHB_LOCK_S 0 + +#define DPORT_PMS_PRO_AHB_1_REG (DR_REG_SENSITIVE_BASE + 0x060) +/* DPORT_PMS_PRO_AHB_RTCSLOW_0_H_W : R/W ;bitpos:[16] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_W (BIT(16)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_W_M (BIT(16)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_W_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_W_S 16 +/* DPORT_PMS_PRO_AHB_RTCSLOW_0_H_R : R/W ;bitpos:[15] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_R (BIT(15)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_R_M (BIT(15)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_R_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_R_S 15 +/* DPORT_PMS_PRO_AHB_RTCSLOW_0_H_F : R/W ;bitpos:[14] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_F (BIT(14)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_F_M (BIT(14)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_F_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_H_F_S 14 +/* DPORT_PMS_PRO_AHB_RTCSLOW_0_L_W : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_W (BIT(13)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_W_M (BIT(13)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_W_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_W_S 13 +/* DPORT_PMS_PRO_AHB_RTCSLOW_0_L_R : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_R (BIT(12)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_R_M (BIT(12)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_R_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_R_S 12 +/* DPORT_PMS_PRO_AHB_RTCSLOW_0_L_F : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_F (BIT(11)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_F_M (BIT(11)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_F_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_L_F_S 11 +/* DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR : R/W ;bitpos:[10:0] ;default: 11'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR 0x000007FF +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR_M ((DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR_V)<<(DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR_S)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR_V 0x7FF +#define DPORT_PMS_PRO_AHB_RTCSLOW_0_SPLTADDR_S 0 + +#define DPORT_PMS_PRO_AHB_2_REG (DR_REG_SENSITIVE_BASE + 0x064) +/* DPORT_PMS_PRO_AHB_RTCSLOW_1_H_W : R/W ;bitpos:[16] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_W (BIT(16)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_W_M (BIT(16)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_W_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_W_S 16 +/* DPORT_PMS_PRO_AHB_RTCSLOW_1_H_R : R/W ;bitpos:[15] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_R (BIT(15)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_R_M (BIT(15)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_R_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_R_S 15 +/* DPORT_PMS_PRO_AHB_RTCSLOW_1_H_F : R/W ;bitpos:[14] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_F (BIT(14)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_F_M (BIT(14)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_F_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_H_F_S 14 +/* DPORT_PMS_PRO_AHB_RTCSLOW_1_L_W : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_W (BIT(13)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_W_M (BIT(13)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_W_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_W_S 13 +/* DPORT_PMS_PRO_AHB_RTCSLOW_1_L_R : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_R (BIT(12)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_R_M (BIT(12)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_R_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_R_S 12 +/* DPORT_PMS_PRO_AHB_RTCSLOW_1_L_F : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_F (BIT(11)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_F_M (BIT(11)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_F_V 0x1 +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_L_F_S 11 +/* DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR : R/W ;bitpos:[10:0] ;default: 11'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR 0x000007FF +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR_M ((DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR_V)<<(DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR_S)) +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR_V 0x7FF +#define DPORT_PMS_PRO_AHB_RTCSLOW_1_SPLTADDR_S 0 + +#define DPORT_PMS_PRO_AHB_3_REG (DR_REG_SENSITIVE_BASE + 0x068) +/* DPORT_PMS_PRO_AHB_ILG_INTR : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_ILG_INTR (BIT(2)) +#define DPORT_PMS_PRO_AHB_ILG_INTR_M (BIT(2)) +#define DPORT_PMS_PRO_AHB_ILG_INTR_V 0x1 +#define DPORT_PMS_PRO_AHB_ILG_INTR_S 2 +/* DPORT_PMS_PRO_AHB_ILG_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_ILG_EN (BIT(1)) +#define DPORT_PMS_PRO_AHB_ILG_EN_M (BIT(1)) +#define DPORT_PMS_PRO_AHB_ILG_EN_V 0x1 +#define DPORT_PMS_PRO_AHB_ILG_EN_S 1 +/* DPORT_PMS_PRO_AHB_ILG_CLR : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_ILG_CLR (BIT(0)) +#define DPORT_PMS_PRO_AHB_ILG_CLR_M (BIT(0)) +#define DPORT_PMS_PRO_AHB_ILG_CLR_V 0x1 +#define DPORT_PMS_PRO_AHB_ILG_CLR_S 0 + +#define DPORT_PMS_PRO_AHB_4_REG (DR_REG_SENSITIVE_BASE + 0x06C) +/* DPORT_PMS_PRO_AHB_ILG_ST : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_AHB_ILG_ST 0xFFFFFFFF +#define DPORT_PMS_PRO_AHB_ILG_ST_M ((DPORT_PMS_PRO_AHB_ILG_ST_V)<<(DPORT_PMS_PRO_AHB_ILG_ST_S)) +#define DPORT_PMS_PRO_AHB_ILG_ST_V 0xFFFFFFFF +#define DPORT_PMS_PRO_AHB_ILG_ST_S 0 + +#define DPORT_PMS_PRO_TRACE_0_REG (DR_REG_SENSITIVE_BASE + 0x070) +/* DPORT_PMS_PRO_TRACE_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_TRACE_LOCK (BIT(0)) +#define DPORT_PMS_PRO_TRACE_LOCK_M (BIT(0)) +#define DPORT_PMS_PRO_TRACE_LOCK_V 0x1 +#define DPORT_PMS_PRO_TRACE_LOCK_S 0 + +#define DPORT_PMS_PRO_TRACE_1_REG (DR_REG_SENSITIVE_BASE + 0x074) +/* DPORT_PMS_PRO_TRACE_DISABLE : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_TRACE_DISABLE (BIT(0)) +#define DPORT_PMS_PRO_TRACE_DISABLE_M (BIT(0)) +#define DPORT_PMS_PRO_TRACE_DISABLE_V 0x1 +#define DPORT_PMS_PRO_TRACE_DISABLE_S 0 + +#define DPORT_PMS_PRO_CACHE_0_REG (DR_REG_SENSITIVE_BASE + 0x078) +/* DPORT_PMS_PRO_CACHE_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_CACHE_LOCK (BIT(0)) +#define DPORT_PMS_PRO_CACHE_LOCK_M (BIT(0)) +#define DPORT_PMS_PRO_CACHE_LOCK_V 0x1 +#define DPORT_PMS_PRO_CACHE_LOCK_S 0 + +#define DPORT_PMS_PRO_CACHE_1_REG (DR_REG_SENSITIVE_BASE + 0x07C) +/* DPORT_PMS_PRO_CACHE_CONNECT : R/W ;bitpos:[15:0] ;default: 16'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_CACHE_CONNECT 0x0000FFFF +#define DPORT_PMS_PRO_CACHE_CONNECT_M ((DPORT_PMS_PRO_CACHE_CONNECT_V)<<(DPORT_PMS_PRO_CACHE_CONNECT_S)) +#define DPORT_PMS_PRO_CACHE_CONNECT_V 0xFFFF +#define DPORT_PMS_PRO_CACHE_CONNECT_S 0 + +#define DPORT_PMS_PRO_CACHE_2_REG (DR_REG_SENSITIVE_BASE + 0x080) +/* DPORT_PMS_PRO_CACHE_ILG_INTR : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_CACHE_ILG_INTR (BIT(2)) +#define DPORT_PMS_PRO_CACHE_ILG_INTR_M (BIT(2)) +#define DPORT_PMS_PRO_CACHE_ILG_INTR_V 0x1 +#define DPORT_PMS_PRO_CACHE_ILG_INTR_S 2 +/* DPORT_PMS_PRO_CACHE_ILG_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_CACHE_ILG_EN (BIT(1)) +#define DPORT_PMS_PRO_CACHE_ILG_EN_M (BIT(1)) +#define DPORT_PMS_PRO_CACHE_ILG_EN_V 0x1 +#define DPORT_PMS_PRO_CACHE_ILG_EN_S 1 +/* DPORT_PMS_PRO_CACHE_ILG_CLR : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_CACHE_ILG_CLR (BIT(0)) +#define DPORT_PMS_PRO_CACHE_ILG_CLR_M (BIT(0)) +#define DPORT_PMS_PRO_CACHE_ILG_CLR_V 0x1 +#define DPORT_PMS_PRO_CACHE_ILG_CLR_S 0 + +#define DPORT_PMS_PRO_CACHE_3_REG (DR_REG_SENSITIVE_BASE + 0x084) +/* DPORT_PMS_PRO_CACHE_ILG_ST_I : RO ;bitpos:[16:0] ;default: 17'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_CACHE_ILG_ST_I 0x0001FFFF +#define DPORT_PMS_PRO_CACHE_ILG_ST_I_M ((DPORT_PMS_PRO_CACHE_ILG_ST_I_V)<<(DPORT_PMS_PRO_CACHE_ILG_ST_I_S)) +#define DPORT_PMS_PRO_CACHE_ILG_ST_I_V 0x1FFFF +#define DPORT_PMS_PRO_CACHE_ILG_ST_I_S 0 + +#define DPORT_PMS_PRO_CACHE_4_REG (DR_REG_SENSITIVE_BASE + 0x088) +/* DPORT_PMS_PRO_CACHE_ILG_ST_D : RO ;bitpos:[16:0] ;default: 17'b0 ; */ +/*description: */ +#define DPORT_PMS_PRO_CACHE_ILG_ST_D 0x0001FFFF +#define DPORT_PMS_PRO_CACHE_ILG_ST_D_M ((DPORT_PMS_PRO_CACHE_ILG_ST_D_V)<<(DPORT_PMS_PRO_CACHE_ILG_ST_D_S)) +#define DPORT_PMS_PRO_CACHE_ILG_ST_D_V 0x1FFFF +#define DPORT_PMS_PRO_CACHE_ILG_ST_D_S 0 + +#define DPORT_PMS_DMA_APB_I_0_REG (DR_REG_SENSITIVE_BASE + 0x08C) +/* DPORT_PMS_DMA_APB_I_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_LOCK (BIT(0)) +#define DPORT_PMS_DMA_APB_I_LOCK_M (BIT(0)) +#define DPORT_PMS_DMA_APB_I_LOCK_V 0x1 +#define DPORT_PMS_DMA_APB_I_LOCK_S 0 + +#define DPORT_PMS_DMA_APB_I_1_REG (DR_REG_SENSITIVE_BASE + 0x090) +/* DPORT_PMS_DMA_APB_I_SRAM_4_H_W : R/W ;bitpos:[28] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_4_H_W (BIT(28)) +#define DPORT_PMS_DMA_APB_I_SRAM_4_H_W_M (BIT(28)) +#define DPORT_PMS_DMA_APB_I_SRAM_4_H_W_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_4_H_W_S 28 +/* DPORT_PMS_DMA_APB_I_SRAM_4_H_R : R/W ;bitpos:[27] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_4_H_R (BIT(27)) +#define DPORT_PMS_DMA_APB_I_SRAM_4_H_R_M (BIT(27)) +#define DPORT_PMS_DMA_APB_I_SRAM_4_H_R_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_4_H_R_S 27 +/* DPORT_PMS_DMA_APB_I_SRAM_4_L_W : R/W ;bitpos:[26] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_4_L_W (BIT(26)) +#define DPORT_PMS_DMA_APB_I_SRAM_4_L_W_M (BIT(26)) +#define DPORT_PMS_DMA_APB_I_SRAM_4_L_W_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_4_L_W_S 26 +/* DPORT_PMS_DMA_APB_I_SRAM_4_L_R : R/W ;bitpos:[25] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_4_L_R (BIT(25)) +#define DPORT_PMS_DMA_APB_I_SRAM_4_L_R_M (BIT(25)) +#define DPORT_PMS_DMA_APB_I_SRAM_4_L_R_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_4_L_R_S 25 +/* DPORT_PMS_DMA_APB_I_SRAM_4_SPLTADDR : R/W ;bitpos:[24:8] ;default: 17'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_4_SPLTADDR 0x0001FFFF +#define DPORT_PMS_DMA_APB_I_SRAM_4_SPLTADDR_M ((DPORT_PMS_DMA_APB_I_SRAM_4_SPLTADDR_V)<<(DPORT_PMS_DMA_APB_I_SRAM_4_SPLTADDR_S)) +#define DPORT_PMS_DMA_APB_I_SRAM_4_SPLTADDR_V 0x1FFFF +#define DPORT_PMS_DMA_APB_I_SRAM_4_SPLTADDR_S 8 +/* DPORT_PMS_DMA_APB_I_SRAM_3_W : R/W ;bitpos:[7] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_3_W (BIT(7)) +#define DPORT_PMS_DMA_APB_I_SRAM_3_W_M (BIT(7)) +#define DPORT_PMS_DMA_APB_I_SRAM_3_W_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_3_W_S 7 +/* DPORT_PMS_DMA_APB_I_SRAM_3_R : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_3_R (BIT(6)) +#define DPORT_PMS_DMA_APB_I_SRAM_3_R_M (BIT(6)) +#define DPORT_PMS_DMA_APB_I_SRAM_3_R_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_3_R_S 6 +/* DPORT_PMS_DMA_APB_I_SRAM_2_W : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_2_W (BIT(5)) +#define DPORT_PMS_DMA_APB_I_SRAM_2_W_M (BIT(5)) +#define DPORT_PMS_DMA_APB_I_SRAM_2_W_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_2_W_S 5 +/* DPORT_PMS_DMA_APB_I_SRAM_2_R : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_2_R (BIT(4)) +#define DPORT_PMS_DMA_APB_I_SRAM_2_R_M (BIT(4)) +#define DPORT_PMS_DMA_APB_I_SRAM_2_R_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_2_R_S 4 +/* DPORT_PMS_DMA_APB_I_SRAM_1_W : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_1_W (BIT(3)) +#define DPORT_PMS_DMA_APB_I_SRAM_1_W_M (BIT(3)) +#define DPORT_PMS_DMA_APB_I_SRAM_1_W_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_1_W_S 3 +/* DPORT_PMS_DMA_APB_I_SRAM_1_R : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_1_R (BIT(2)) +#define DPORT_PMS_DMA_APB_I_SRAM_1_R_M (BIT(2)) +#define DPORT_PMS_DMA_APB_I_SRAM_1_R_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_1_R_S 2 +/* DPORT_PMS_DMA_APB_I_SRAM_0_W : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_0_W (BIT(1)) +#define DPORT_PMS_DMA_APB_I_SRAM_0_W_M (BIT(1)) +#define DPORT_PMS_DMA_APB_I_SRAM_0_W_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_0_W_S 1 +/* DPORT_PMS_DMA_APB_I_SRAM_0_R : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_SRAM_0_R (BIT(0)) +#define DPORT_PMS_DMA_APB_I_SRAM_0_R_M (BIT(0)) +#define DPORT_PMS_DMA_APB_I_SRAM_0_R_V 0x1 +#define DPORT_PMS_DMA_APB_I_SRAM_0_R_S 0 + +#define DPORT_PMS_DMA_APB_I_2_REG (DR_REG_SENSITIVE_BASE + 0x094) +/* DPORT_PMS_DMA_APB_I_ILG_INTR : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_ILG_INTR (BIT(2)) +#define DPORT_PMS_DMA_APB_I_ILG_INTR_M (BIT(2)) +#define DPORT_PMS_DMA_APB_I_ILG_INTR_V 0x1 +#define DPORT_PMS_DMA_APB_I_ILG_INTR_S 2 +/* DPORT_PMS_DMA_APB_I_ILG_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_ILG_EN (BIT(1)) +#define DPORT_PMS_DMA_APB_I_ILG_EN_M (BIT(1)) +#define DPORT_PMS_DMA_APB_I_ILG_EN_V 0x1 +#define DPORT_PMS_DMA_APB_I_ILG_EN_S 1 +/* DPORT_PMS_DMA_APB_I_ILG_CLR : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_ILG_CLR (BIT(0)) +#define DPORT_PMS_DMA_APB_I_ILG_CLR_M (BIT(0)) +#define DPORT_PMS_DMA_APB_I_ILG_CLR_V 0x1 +#define DPORT_PMS_DMA_APB_I_ILG_CLR_S 0 + +#define DPORT_PMS_DMA_APB_I_3_REG (DR_REG_SENSITIVE_BASE + 0x098) +/* DPORT_PMS_DMA_APB_I_ILG_ST : RO ;bitpos:[22:0] ;default: 23'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_APB_I_ILG_ST 0x007FFFFF +#define DPORT_PMS_DMA_APB_I_ILG_ST_M ((DPORT_PMS_DMA_APB_I_ILG_ST_V)<<(DPORT_PMS_DMA_APB_I_ILG_ST_S)) +#define DPORT_PMS_DMA_APB_I_ILG_ST_V 0x7FFFFF +#define DPORT_PMS_DMA_APB_I_ILG_ST_S 0 + +#define DPORT_PMS_DMA_RX_I_0_REG (DR_REG_SENSITIVE_BASE + 0x09C) +/* DPORT_PMS_DMA_RX_I_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_LOCK (BIT(0)) +#define DPORT_PMS_DMA_RX_I_LOCK_M (BIT(0)) +#define DPORT_PMS_DMA_RX_I_LOCK_V 0x1 +#define DPORT_PMS_DMA_RX_I_LOCK_S 0 + +#define DPORT_PMS_DMA_RX_I_1_REG (DR_REG_SENSITIVE_BASE + 0x0A0) +/* DPORT_PMS_DMA_RX_I_SRAM_4_H_W : R/W ;bitpos:[28] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_4_H_W (BIT(28)) +#define DPORT_PMS_DMA_RX_I_SRAM_4_H_W_M (BIT(28)) +#define DPORT_PMS_DMA_RX_I_SRAM_4_H_W_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_4_H_W_S 28 +/* DPORT_PMS_DMA_RX_I_SRAM_4_H_R : R/W ;bitpos:[27] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_4_H_R (BIT(27)) +#define DPORT_PMS_DMA_RX_I_SRAM_4_H_R_M (BIT(27)) +#define DPORT_PMS_DMA_RX_I_SRAM_4_H_R_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_4_H_R_S 27 +/* DPORT_PMS_DMA_RX_I_SRAM_4_L_W : R/W ;bitpos:[26] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_4_L_W (BIT(26)) +#define DPORT_PMS_DMA_RX_I_SRAM_4_L_W_M (BIT(26)) +#define DPORT_PMS_DMA_RX_I_SRAM_4_L_W_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_4_L_W_S 26 +/* DPORT_PMS_DMA_RX_I_SRAM_4_L_R : R/W ;bitpos:[25] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_4_L_R (BIT(25)) +#define DPORT_PMS_DMA_RX_I_SRAM_4_L_R_M (BIT(25)) +#define DPORT_PMS_DMA_RX_I_SRAM_4_L_R_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_4_L_R_S 25 +/* DPORT_PMS_DMA_RX_I_SRAM_4_SPLTADDR : R/W ;bitpos:[24:8] ;default: 17'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_4_SPLTADDR 0x0001FFFF +#define DPORT_PMS_DMA_RX_I_SRAM_4_SPLTADDR_M ((DPORT_PMS_DMA_RX_I_SRAM_4_SPLTADDR_V)<<(DPORT_PMS_DMA_RX_I_SRAM_4_SPLTADDR_S)) +#define DPORT_PMS_DMA_RX_I_SRAM_4_SPLTADDR_V 0x1FFFF +#define DPORT_PMS_DMA_RX_I_SRAM_4_SPLTADDR_S 8 +/* DPORT_PMS_DMA_RX_I_SRAM_3_W : R/W ;bitpos:[7] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_3_W (BIT(7)) +#define DPORT_PMS_DMA_RX_I_SRAM_3_W_M (BIT(7)) +#define DPORT_PMS_DMA_RX_I_SRAM_3_W_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_3_W_S 7 +/* DPORT_PMS_DMA_RX_I_SRAM_3_R : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_3_R (BIT(6)) +#define DPORT_PMS_DMA_RX_I_SRAM_3_R_M (BIT(6)) +#define DPORT_PMS_DMA_RX_I_SRAM_3_R_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_3_R_S 6 +/* DPORT_PMS_DMA_RX_I_SRAM_2_W : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_2_W (BIT(5)) +#define DPORT_PMS_DMA_RX_I_SRAM_2_W_M (BIT(5)) +#define DPORT_PMS_DMA_RX_I_SRAM_2_W_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_2_W_S 5 +/* DPORT_PMS_DMA_RX_I_SRAM_2_R : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_2_R (BIT(4)) +#define DPORT_PMS_DMA_RX_I_SRAM_2_R_M (BIT(4)) +#define DPORT_PMS_DMA_RX_I_SRAM_2_R_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_2_R_S 4 +/* DPORT_PMS_DMA_RX_I_SRAM_1_W : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_1_W (BIT(3)) +#define DPORT_PMS_DMA_RX_I_SRAM_1_W_M (BIT(3)) +#define DPORT_PMS_DMA_RX_I_SRAM_1_W_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_1_W_S 3 +/* DPORT_PMS_DMA_RX_I_SRAM_1_R : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_1_R (BIT(2)) +#define DPORT_PMS_DMA_RX_I_SRAM_1_R_M (BIT(2)) +#define DPORT_PMS_DMA_RX_I_SRAM_1_R_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_1_R_S 2 +/* DPORT_PMS_DMA_RX_I_SRAM_0_W : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_0_W (BIT(1)) +#define DPORT_PMS_DMA_RX_I_SRAM_0_W_M (BIT(1)) +#define DPORT_PMS_DMA_RX_I_SRAM_0_W_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_0_W_S 1 +/* DPORT_PMS_DMA_RX_I_SRAM_0_R : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_SRAM_0_R (BIT(0)) +#define DPORT_PMS_DMA_RX_I_SRAM_0_R_M (BIT(0)) +#define DPORT_PMS_DMA_RX_I_SRAM_0_R_V 0x1 +#define DPORT_PMS_DMA_RX_I_SRAM_0_R_S 0 + +#define DPORT_PMS_DMA_RX_I_2_REG (DR_REG_SENSITIVE_BASE + 0x0A4) +/* DPORT_PMS_DMA_RX_I_ILG_INTR : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_ILG_INTR (BIT(2)) +#define DPORT_PMS_DMA_RX_I_ILG_INTR_M (BIT(2)) +#define DPORT_PMS_DMA_RX_I_ILG_INTR_V 0x1 +#define DPORT_PMS_DMA_RX_I_ILG_INTR_S 2 +/* DPORT_PMS_DMA_RX_I_ILG_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_ILG_EN (BIT(1)) +#define DPORT_PMS_DMA_RX_I_ILG_EN_M (BIT(1)) +#define DPORT_PMS_DMA_RX_I_ILG_EN_V 0x1 +#define DPORT_PMS_DMA_RX_I_ILG_EN_S 1 +/* DPORT_PMS_DMA_RX_I_ILG_CLR : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_ILG_CLR (BIT(0)) +#define DPORT_PMS_DMA_RX_I_ILG_CLR_M (BIT(0)) +#define DPORT_PMS_DMA_RX_I_ILG_CLR_V 0x1 +#define DPORT_PMS_DMA_RX_I_ILG_CLR_S 0 + +#define DPORT_PMS_DMA_RX_I_3_REG (DR_REG_SENSITIVE_BASE + 0x0A8) +/* DPORT_PMS_DMA_RX_I_ILG_ST : RO ;bitpos:[22:0] ;default: 23'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_RX_I_ILG_ST 0x007FFFFF +#define DPORT_PMS_DMA_RX_I_ILG_ST_M ((DPORT_PMS_DMA_RX_I_ILG_ST_V)<<(DPORT_PMS_DMA_RX_I_ILG_ST_S)) +#define DPORT_PMS_DMA_RX_I_ILG_ST_V 0x7FFFFF +#define DPORT_PMS_DMA_RX_I_ILG_ST_S 0 + +#define DPORT_PMS_DMA_TX_I_0_REG (DR_REG_SENSITIVE_BASE + 0x0AC) +/* DPORT_PMS_DMA_TX_I_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_LOCK (BIT(0)) +#define DPORT_PMS_DMA_TX_I_LOCK_M (BIT(0)) +#define DPORT_PMS_DMA_TX_I_LOCK_V 0x1 +#define DPORT_PMS_DMA_TX_I_LOCK_S 0 + +#define DPORT_PMS_DMA_TX_I_1_REG (DR_REG_SENSITIVE_BASE + 0x0B0) +/* DPORT_PMS_DMA_TX_I_SRAM_4_H_W : R/W ;bitpos:[28] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_4_H_W (BIT(28)) +#define DPORT_PMS_DMA_TX_I_SRAM_4_H_W_M (BIT(28)) +#define DPORT_PMS_DMA_TX_I_SRAM_4_H_W_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_4_H_W_S 28 +/* DPORT_PMS_DMA_TX_I_SRAM_4_H_R : R/W ;bitpos:[27] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_4_H_R (BIT(27)) +#define DPORT_PMS_DMA_TX_I_SRAM_4_H_R_M (BIT(27)) +#define DPORT_PMS_DMA_TX_I_SRAM_4_H_R_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_4_H_R_S 27 +/* DPORT_PMS_DMA_TX_I_SRAM_4_L_W : R/W ;bitpos:[26] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_4_L_W (BIT(26)) +#define DPORT_PMS_DMA_TX_I_SRAM_4_L_W_M (BIT(26)) +#define DPORT_PMS_DMA_TX_I_SRAM_4_L_W_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_4_L_W_S 26 +/* DPORT_PMS_DMA_TX_I_SRAM_4_L_R : R/W ;bitpos:[25] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_4_L_R (BIT(25)) +#define DPORT_PMS_DMA_TX_I_SRAM_4_L_R_M (BIT(25)) +#define DPORT_PMS_DMA_TX_I_SRAM_4_L_R_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_4_L_R_S 25 +/* DPORT_PMS_DMA_TX_I_SRAM_4_SPLTADDR : R/W ;bitpos:[24:8] ;default: 17'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_4_SPLTADDR 0x0001FFFF +#define DPORT_PMS_DMA_TX_I_SRAM_4_SPLTADDR_M ((DPORT_PMS_DMA_TX_I_SRAM_4_SPLTADDR_V)<<(DPORT_PMS_DMA_TX_I_SRAM_4_SPLTADDR_S)) +#define DPORT_PMS_DMA_TX_I_SRAM_4_SPLTADDR_V 0x1FFFF +#define DPORT_PMS_DMA_TX_I_SRAM_4_SPLTADDR_S 8 +/* DPORT_PMS_DMA_TX_I_SRAM_3_W : R/W ;bitpos:[7] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_3_W (BIT(7)) +#define DPORT_PMS_DMA_TX_I_SRAM_3_W_M (BIT(7)) +#define DPORT_PMS_DMA_TX_I_SRAM_3_W_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_3_W_S 7 +/* DPORT_PMS_DMA_TX_I_SRAM_3_R : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_3_R (BIT(6)) +#define DPORT_PMS_DMA_TX_I_SRAM_3_R_M (BIT(6)) +#define DPORT_PMS_DMA_TX_I_SRAM_3_R_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_3_R_S 6 +/* DPORT_PMS_DMA_TX_I_SRAM_2_W : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_2_W (BIT(5)) +#define DPORT_PMS_DMA_TX_I_SRAM_2_W_M (BIT(5)) +#define DPORT_PMS_DMA_TX_I_SRAM_2_W_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_2_W_S 5 +/* DPORT_PMS_DMA_TX_I_SRAM_2_R : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_2_R (BIT(4)) +#define DPORT_PMS_DMA_TX_I_SRAM_2_R_M (BIT(4)) +#define DPORT_PMS_DMA_TX_I_SRAM_2_R_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_2_R_S 4 +/* DPORT_PMS_DMA_TX_I_SRAM_1_W : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_1_W (BIT(3)) +#define DPORT_PMS_DMA_TX_I_SRAM_1_W_M (BIT(3)) +#define DPORT_PMS_DMA_TX_I_SRAM_1_W_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_1_W_S 3 +/* DPORT_PMS_DMA_TX_I_SRAM_1_R : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_1_R (BIT(2)) +#define DPORT_PMS_DMA_TX_I_SRAM_1_R_M (BIT(2)) +#define DPORT_PMS_DMA_TX_I_SRAM_1_R_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_1_R_S 2 +/* DPORT_PMS_DMA_TX_I_SRAM_0_W : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_0_W (BIT(1)) +#define DPORT_PMS_DMA_TX_I_SRAM_0_W_M (BIT(1)) +#define DPORT_PMS_DMA_TX_I_SRAM_0_W_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_0_W_S 1 +/* DPORT_PMS_DMA_TX_I_SRAM_0_R : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_SRAM_0_R (BIT(0)) +#define DPORT_PMS_DMA_TX_I_SRAM_0_R_M (BIT(0)) +#define DPORT_PMS_DMA_TX_I_SRAM_0_R_V 0x1 +#define DPORT_PMS_DMA_TX_I_SRAM_0_R_S 0 + +#define DPORT_PMS_DMA_TX_I_2_REG (DR_REG_SENSITIVE_BASE + 0x0B4) +/* DPORT_PMS_DMA_TX_I_ILG_INTR : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_ILG_INTR (BIT(2)) +#define DPORT_PMS_DMA_TX_I_ILG_INTR_M (BIT(2)) +#define DPORT_PMS_DMA_TX_I_ILG_INTR_V 0x1 +#define DPORT_PMS_DMA_TX_I_ILG_INTR_S 2 +/* DPORT_PMS_DMA_TX_I_ILG_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_ILG_EN (BIT(1)) +#define DPORT_PMS_DMA_TX_I_ILG_EN_M (BIT(1)) +#define DPORT_PMS_DMA_TX_I_ILG_EN_V 0x1 +#define DPORT_PMS_DMA_TX_I_ILG_EN_S 1 +/* DPORT_PMS_DMA_TX_I_ILG_CLR : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_ILG_CLR (BIT(0)) +#define DPORT_PMS_DMA_TX_I_ILG_CLR_M (BIT(0)) +#define DPORT_PMS_DMA_TX_I_ILG_CLR_V 0x1 +#define DPORT_PMS_DMA_TX_I_ILG_CLR_S 0 + +#define DPORT_PMS_DMA_TX_I_3_REG (DR_REG_SENSITIVE_BASE + 0x0B8) +/* DPORT_PMS_DMA_TX_I_ILG_ST : RO ;bitpos:[22:0] ;default: 23'b0 ; */ +/*description: */ +#define DPORT_PMS_DMA_TX_I_ILG_ST 0x007FFFFF +#define DPORT_PMS_DMA_TX_I_ILG_ST_M ((DPORT_PMS_DMA_TX_I_ILG_ST_V)<<(DPORT_PMS_DMA_TX_I_ILG_ST_S)) +#define DPORT_PMS_DMA_TX_I_ILG_ST_V 0x7FFFFF +#define DPORT_PMS_DMA_TX_I_ILG_ST_S 0 + +#define DPORT_PRO_BOOT_LOCATION_0_REG (DR_REG_SENSITIVE_BASE + 0x0BC) +/* DPORT_PRO_BOOT_LOCATION_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_BOOT_LOCATION_LOCK (BIT(0)) +#define DPORT_PRO_BOOT_LOCATION_LOCK_M (BIT(0)) +#define DPORT_PRO_BOOT_LOCATION_LOCK_V 0x1 +#define DPORT_PRO_BOOT_LOCATION_LOCK_S 0 + +#define DPORT_PRO_BOOT_LOCATION_1_REG (DR_REG_SENSITIVE_BASE + 0x0C0) +/* DPORT_PRO_BOOT_REMAP : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_BOOT_REMAP (BIT(0)) +#define DPORT_PRO_BOOT_REMAP_M (BIT(0)) +#define DPORT_PRO_BOOT_REMAP_V 0x1 +#define DPORT_PRO_BOOT_REMAP_S 0 + +#define DPORT_CACHE_SOURCE_0_REG (DR_REG_SENSITIVE_BASE + 0x0C4) +/* DPORT_CACHE_SOURCE_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CACHE_SOURCE_LOCK (BIT(0)) +#define DPORT_CACHE_SOURCE_LOCK_M (BIT(0)) +#define DPORT_CACHE_SOURCE_LOCK_V 0x1 +#define DPORT_CACHE_SOURCE_LOCK_S 0 + +#define DPORT_CACHE_SOURCE_1_REG (DR_REG_SENSITIVE_BASE + 0x0C8) +/* DPORT_PRO_CACHE_D_SOURCE_PRO_DROM0 : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DROM0 (BIT(5)) +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DROM0_M (BIT(5)) +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DROM0_V 0x1 +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DROM0_S 5 +/* DPORT_PRO_CACHE_D_SOURCE_PRO_DPORT : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DPORT (BIT(4)) +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DPORT_M (BIT(4)) +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DPORT_V 0x1 +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DPORT_S 4 +/* DPORT_PRO_CACHE_D_SOURCE_PRO_DRAM0 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DRAM0 (BIT(3)) +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DRAM0_M (BIT(3)) +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DRAM0_V 0x1 +#define DPORT_PRO_CACHE_D_SOURCE_PRO_DRAM0_S 3 +/* DPORT_PRO_CACHE_I_SOURCE_PRO_DROM0 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_I_SOURCE_PRO_DROM0 (BIT(2)) +#define DPORT_PRO_CACHE_I_SOURCE_PRO_DROM0_M (BIT(2)) +#define DPORT_PRO_CACHE_I_SOURCE_PRO_DROM0_V 0x1 +#define DPORT_PRO_CACHE_I_SOURCE_PRO_DROM0_S 2 +/* DPORT_PRO_CACHE_I_SOURCE_PRO_IROM0 : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_I_SOURCE_PRO_IROM0 (BIT(1)) +#define DPORT_PRO_CACHE_I_SOURCE_PRO_IROM0_M (BIT(1)) +#define DPORT_PRO_CACHE_I_SOURCE_PRO_IROM0_V 0x1 +#define DPORT_PRO_CACHE_I_SOURCE_PRO_IROM0_S 1 +/* DPORT_PRO_CACHE_I_SOURCE_PRO_IRAM1 : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_I_SOURCE_PRO_IRAM1 (BIT(0)) +#define DPORT_PRO_CACHE_I_SOURCE_PRO_IRAM1_M (BIT(0)) +#define DPORT_PRO_CACHE_I_SOURCE_PRO_IRAM1_V 0x1 +#define DPORT_PRO_CACHE_I_SOURCE_PRO_IRAM1_S 0 + +#define DPORT_APB_PERIPHERAL_0_REG (DR_REG_SENSITIVE_BASE + 0x0CC) +/* DPORT_APB_PERIPHERAL_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_APB_PERIPHERAL_LOCK (BIT(0)) +#define DPORT_APB_PERIPHERAL_LOCK_M (BIT(0)) +#define DPORT_APB_PERIPHERAL_LOCK_V 0x1 +#define DPORT_APB_PERIPHERAL_LOCK_S 0 + +#define DPORT_APB_PERIPHERAL_1_REG (DR_REG_SENSITIVE_BASE + 0x0D0) +/* DPORT_APB_PERIPHERAL_SPLIT_BURST : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_APB_PERIPHERAL_SPLIT_BURST (BIT(0)) +#define DPORT_APB_PERIPHERAL_SPLIT_BURST_M (BIT(0)) +#define DPORT_APB_PERIPHERAL_SPLIT_BURST_V 0x1 +#define DPORT_APB_PERIPHERAL_SPLIT_BURST_S 0 + +#define DPORT_PMS_OCCUPY_0_REG (DR_REG_SENSITIVE_BASE + 0x0D4) +/* DPORT_PMS_OCCUPY_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PMS_OCCUPY_LOCK (BIT(0)) +#define DPORT_PMS_OCCUPY_LOCK_M (BIT(0)) +#define DPORT_PMS_OCCUPY_LOCK_V 0x1 +#define DPORT_PMS_OCCUPY_LOCK_S 0 + +#define DPORT_PMS_OCCUPY_1_REG (DR_REG_SENSITIVE_BASE + 0x0D8) +/* DPORT_PMS_OCCUPY_CACHE : R/W ;bitpos:[3:0] ;default: 4'b0000 ; */ +/*description: */ +#define DPORT_PMS_OCCUPY_CACHE 0x0000000F +#define DPORT_PMS_OCCUPY_CACHE_M ((DPORT_PMS_OCCUPY_CACHE_V)<<(DPORT_PMS_OCCUPY_CACHE_S)) +#define DPORT_PMS_OCCUPY_CACHE_V 0xF +#define DPORT_PMS_OCCUPY_CACHE_S 0 + +#define DPORT_PMS_OCCUPY_2_REG (DR_REG_SENSITIVE_BASE + 0x0DC) +/* DPORT_PMS_OCCUPY_MAC_DUMP : R/W ;bitpos:[3:0] ;default: 4'b0000 ; */ +/*description: */ +#define DPORT_PMS_OCCUPY_MAC_DUMP 0x0000000F +#define DPORT_PMS_OCCUPY_MAC_DUMP_M ((DPORT_PMS_OCCUPY_MAC_DUMP_V)<<(DPORT_PMS_OCCUPY_MAC_DUMP_S)) +#define DPORT_PMS_OCCUPY_MAC_DUMP_V 0xF +#define DPORT_PMS_OCCUPY_MAC_DUMP_S 0 + +#define DPORT_PMS_OCCUPY_3_REG (DR_REG_SENSITIVE_BASE + 0x0E0) +/* DPORT_PMS_OCCUPY_PRO_TRACE : R/W ;bitpos:[17:0] ;default: 18'b0 ; */ +/*description: */ +#define DPORT_PMS_OCCUPY_PRO_TRACE 0x0003FFFF +#define DPORT_PMS_OCCUPY_PRO_TRACE_M ((DPORT_PMS_OCCUPY_PRO_TRACE_V)<<(DPORT_PMS_OCCUPY_PRO_TRACE_S)) +#define DPORT_PMS_OCCUPY_PRO_TRACE_V 0x3FFFF +#define DPORT_PMS_OCCUPY_PRO_TRACE_S 0 + +#define DPORT_CACHE_TAG_ACCESS_0_REG (DR_REG_SENSITIVE_BASE + 0x0E4) +/* DPORT_CACHE_TAG_ACCESS_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CACHE_TAG_ACCESS_LOCK (BIT(0)) +#define DPORT_CACHE_TAG_ACCESS_LOCK_M (BIT(0)) +#define DPORT_CACHE_TAG_ACCESS_LOCK_V 0x1 +#define DPORT_CACHE_TAG_ACCESS_LOCK_S 0 + +#define DPORT_CACHE_TAG_ACCESS_1_REG (DR_REG_SENSITIVE_BASE + 0x0E8) +/* DPORT_PRO_D_TAG_WR_ACS : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_D_TAG_WR_ACS (BIT(3)) +#define DPORT_PRO_D_TAG_WR_ACS_M (BIT(3)) +#define DPORT_PRO_D_TAG_WR_ACS_V 0x1 +#define DPORT_PRO_D_TAG_WR_ACS_S 3 +/* DPORT_PRO_D_TAG_RD_ACS : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_D_TAG_RD_ACS (BIT(2)) +#define DPORT_PRO_D_TAG_RD_ACS_M (BIT(2)) +#define DPORT_PRO_D_TAG_RD_ACS_V 0x1 +#define DPORT_PRO_D_TAG_RD_ACS_S 2 +/* DPORT_PRO_I_TAG_WR_ACS : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_I_TAG_WR_ACS (BIT(1)) +#define DPORT_PRO_I_TAG_WR_ACS_M (BIT(1)) +#define DPORT_PRO_I_TAG_WR_ACS_V 0x1 +#define DPORT_PRO_I_TAG_WR_ACS_S 1 +/* DPORT_PRO_I_TAG_RD_ACS : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_I_TAG_RD_ACS (BIT(0)) +#define DPORT_PRO_I_TAG_RD_ACS_M (BIT(0)) +#define DPORT_PRO_I_TAG_RD_ACS_V 0x1 +#define DPORT_PRO_I_TAG_RD_ACS_S 0 + +#define SENSITIVE_CLOCK_GATE_REG (DR_REG_SENSITIVE_BASE + 0x0EC) +/* SENSITIVE_CLK_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define SENSITIVE_CLK_EN (BIT(0)) +#define SENSITIVE_CLK_EN_M (BIT(0)) +#define SENSITIVE_CLK_EN_V 0x1 +#define SENSITIVE_CLK_EN_S 0 + +#define SENSITIVE_DATE_REG (DR_REG_SENSITIVE_BASE + 0xFFC) +/* SENSITIVE_DATE : R/W ;bitpos:[27:0] ;default: 28'h1809042 ; */ +/*description: */ +#define SENSITIVE_DATE 0x0FFFFFFF +#define SENSITIVE_DATE_M ((SENSITIVE_DATE_V)<<(SENSITIVE_DATE_S)) +#define SENSITIVE_DATE_V 0xFFFFFFF +#define SENSITIVE_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_SENSITIVE_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/slc_reg.h b/components/soc/esp32s2beta/include/soc/slc_reg.h new file mode 100644 index 0000000000..a4f59af991 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/slc_reg.h @@ -0,0 +1,1914 @@ +// Copyright 2017-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_SLC_REG_H_ +#define _SOC_SLC_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define SLC_CONF0_REG (DR_REG_SLC_BASE + 0x0) +/* SLC_SLC0_WR_RETRY_MASK_EN : R/W ;bitpos:[18] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_WR_RETRY_MASK_EN (BIT(18)) +#define SLC_SLC0_WR_RETRY_MASK_EN_M (BIT(18)) +#define SLC_SLC0_WR_RETRY_MASK_EN_V 0x1 +#define SLC_SLC0_WR_RETRY_MASK_EN_S 18 +/* SLC_SLC0_TOKEN_SEL : R/W ;bitpos:[15] ;default: 1'h1 ; */ +/*description: */ +#define SLC_SLC0_TOKEN_SEL (BIT(15)) +#define SLC_SLC0_TOKEN_SEL_M (BIT(15)) +#define SLC_SLC0_TOKEN_SEL_V 0x1 +#define SLC_SLC0_TOKEN_SEL_S 15 +/* SLC_SLC0_TOKEN_AUTO_CLR : R/W ;bitpos:[14] ;default: 1'h1 ; */ +/*description: */ +#define SLC_SLC0_TOKEN_AUTO_CLR (BIT(14)) +#define SLC_SLC0_TOKEN_AUTO_CLR_M (BIT(14)) +#define SLC_SLC0_TOKEN_AUTO_CLR_V 0x1 +#define SLC_SLC0_TOKEN_AUTO_CLR_S 14 +/* SLC_SLC0_TXDATA_BURST_EN : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_TXDATA_BURST_EN (BIT(13)) +#define SLC_SLC0_TXDATA_BURST_EN_M (BIT(13)) +#define SLC_SLC0_TXDATA_BURST_EN_V 0x1 +#define SLC_SLC0_TXDATA_BURST_EN_S 13 +/* SLC_SLC0_TXDSCR_BURST_EN : R/W ;bitpos:[12] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_TXDSCR_BURST_EN (BIT(12)) +#define SLC_SLC0_TXDSCR_BURST_EN_M (BIT(12)) +#define SLC_SLC0_TXDSCR_BURST_EN_V 0x1 +#define SLC_SLC0_TXDSCR_BURST_EN_S 12 +/* SLC_SLC0_TXLINK_AUTO_RET : R/W ;bitpos:[11] ;default: 1'h1 ; */ +/*description: */ +#define SLC_SLC0_TXLINK_AUTO_RET (BIT(11)) +#define SLC_SLC0_TXLINK_AUTO_RET_M (BIT(11)) +#define SLC_SLC0_TXLINK_AUTO_RET_V 0x1 +#define SLC_SLC0_TXLINK_AUTO_RET_S 11 +/* SLC_SLC0_RXLINK_AUTO_RET : R/W ;bitpos:[10] ;default: 1'h1 ; */ +/*description: */ +#define SLC_SLC0_RXLINK_AUTO_RET (BIT(10)) +#define SLC_SLC0_RXLINK_AUTO_RET_M (BIT(10)) +#define SLC_SLC0_RXLINK_AUTO_RET_V 0x1 +#define SLC_SLC0_RXLINK_AUTO_RET_S 10 +/* SLC_SLC0_RXDATA_BURST_EN : R/W ;bitpos:[9] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_RXDATA_BURST_EN (BIT(9)) +#define SLC_SLC0_RXDATA_BURST_EN_M (BIT(9)) +#define SLC_SLC0_RXDATA_BURST_EN_V 0x1 +#define SLC_SLC0_RXDATA_BURST_EN_S 9 +/* SLC_SLC0_RXDSCR_BURST_EN : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_RXDSCR_BURST_EN (BIT(8)) +#define SLC_SLC0_RXDSCR_BURST_EN_M (BIT(8)) +#define SLC_SLC0_RXDSCR_BURST_EN_V 0x1 +#define SLC_SLC0_RXDSCR_BURST_EN_S 8 +/* SLC_SLC0_RX_NO_RESTART_CLR : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_NO_RESTART_CLR (BIT(7)) +#define SLC_SLC0_RX_NO_RESTART_CLR_M (BIT(7)) +#define SLC_SLC0_RX_NO_RESTART_CLR_V 0x1 +#define SLC_SLC0_RX_NO_RESTART_CLR_S 7 +/* SLC_SLC0_RX_AUTO_WRBACK : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_AUTO_WRBACK (BIT(6)) +#define SLC_SLC0_RX_AUTO_WRBACK_M (BIT(6)) +#define SLC_SLC0_RX_AUTO_WRBACK_V 0x1 +#define SLC_SLC0_RX_AUTO_WRBACK_S 6 +/* SLC_SLC0_RX_LOOP_TEST : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_RX_LOOP_TEST (BIT(5)) +#define SLC_SLC0_RX_LOOP_TEST_M (BIT(5)) +#define SLC_SLC0_RX_LOOP_TEST_V 0x1 +#define SLC_SLC0_RX_LOOP_TEST_S 5 +/* SLC_SLC0_TX_LOOP_TEST : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_TX_LOOP_TEST (BIT(4)) +#define SLC_SLC0_TX_LOOP_TEST_M (BIT(4)) +#define SLC_SLC0_TX_LOOP_TEST_V 0x1 +#define SLC_SLC0_TX_LOOP_TEST_S 4 +/* SLC_AHBM_RST : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SLC_AHBM_RST (BIT(3)) +#define SLC_AHBM_RST_M (BIT(3)) +#define SLC_AHBM_RST_V 0x1 +#define SLC_AHBM_RST_S 3 +/* SLC_AHBM_FIFO_RST : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SLC_AHBM_FIFO_RST (BIT(2)) +#define SLC_AHBM_FIFO_RST_M (BIT(2)) +#define SLC_AHBM_FIFO_RST_V 0x1 +#define SLC_AHBM_FIFO_RST_S 2 +/* SLC_SLC0_RX_RST : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_RST (BIT(1)) +#define SLC_SLC0_RX_RST_M (BIT(1)) +#define SLC_SLC0_RX_RST_V 0x1 +#define SLC_SLC0_RX_RST_S 1 +/* SLC_SLC0_TX_RST : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define SLC_SLC0_TX_RST (BIT(0)) +#define SLC_SLC0_TX_RST_M (BIT(0)) +#define SLC_SLC0_TX_RST_V 0x1 +#define SLC_SLC0_TX_RST_S 0 + +#define SLC_0INT_RAW_REG (DR_REG_SLC_BASE + 0x4) +/* SLC_SLC0_HOST_POP_EOF_ERR_INT_RAW : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_RAW (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_RAW_M (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_RAW_V 0x1 +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_RAW_S 27 +/* SLC_SLC0_RX_QUICK_EOF_INT_RAW : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_QUICK_EOF_INT_RAW (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_RAW_M (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_RAW_V 0x1 +#define SLC_SLC0_RX_QUICK_EOF_INT_RAW_S 26 +/* SLC_CMD_DTC_INT_RAW : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define SLC_CMD_DTC_INT_RAW (BIT(25)) +#define SLC_CMD_DTC_INT_RAW_M (BIT(25)) +#define SLC_CMD_DTC_INT_RAW_V 0x1 +#define SLC_CMD_DTC_INT_RAW_S 25 +/* SLC_SLC0_TX_ERR_EOF_INT_RAW : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_ERR_EOF_INT_RAW (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_RAW_M (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_RAW_V 0x1 +#define SLC_SLC0_TX_ERR_EOF_INT_RAW_S 24 +/* SLC_SLC0_WR_RETRY_DONE_INT_RAW : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_WR_RETRY_DONE_INT_RAW (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_RAW_M (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_RAW_V 0x1 +#define SLC_SLC0_WR_RETRY_DONE_INT_RAW_S 23 +/* SLC_SLC0_HOST_RD_ACK_INT_RAW : RO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_RD_ACK_INT_RAW (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_RAW_M (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_RAW_V 0x1 +#define SLC_SLC0_HOST_RD_ACK_INT_RAW_S 22 +/* SLC_SLC0_TX_DSCR_EMPTY_INT_RAW : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_EMPTY_INT_RAW (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_RAW_M (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_RAW_V 0x1 +#define SLC_SLC0_TX_DSCR_EMPTY_INT_RAW_S 21 +/* SLC_SLC0_RX_DSCR_ERR_INT_RAW : RO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DSCR_ERR_INT_RAW (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_RAW_M (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_RAW_V 0x1 +#define SLC_SLC0_RX_DSCR_ERR_INT_RAW_S 20 +/* SLC_SLC0_TX_DSCR_ERR_INT_RAW : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_ERR_INT_RAW (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_RAW_M (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_RAW_V 0x1 +#define SLC_SLC0_TX_DSCR_ERR_INT_RAW_S 19 +/* SLC_SLC0_TOHOST_INT_RAW : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOHOST_INT_RAW (BIT(18)) +#define SLC_SLC0_TOHOST_INT_RAW_M (BIT(18)) +#define SLC_SLC0_TOHOST_INT_RAW_V 0x1 +#define SLC_SLC0_TOHOST_INT_RAW_S 18 +/* SLC_SLC0_RX_EOF_INT_RAW : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_EOF_INT_RAW (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_RAW_M (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_RAW_V 0x1 +#define SLC_SLC0_RX_EOF_INT_RAW_S 17 +/* SLC_SLC0_RX_DONE_INT_RAW : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DONE_INT_RAW (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_RAW_M (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_RAW_V 0x1 +#define SLC_SLC0_RX_DONE_INT_RAW_S 16 +/* SLC_SLC0_TX_SUC_EOF_INT_RAW : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_SUC_EOF_INT_RAW (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_RAW_M (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_RAW_V 0x1 +#define SLC_SLC0_TX_SUC_EOF_INT_RAW_S 15 +/* SLC_SLC0_TX_DONE_INT_RAW : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DONE_INT_RAW (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_RAW_M (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_RAW_V 0x1 +#define SLC_SLC0_TX_DONE_INT_RAW_S 14 +/* SLC_SLC0_TOKEN1_1TO0_INT_RAW : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1_1TO0_INT_RAW (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_RAW_M (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_RAW_V 0x1 +#define SLC_SLC0_TOKEN1_1TO0_INT_RAW_S 13 +/* SLC_SLC0_TOKEN0_1TO0_INT_RAW : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0_1TO0_INT_RAW (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_RAW_M (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_RAW_V 0x1 +#define SLC_SLC0_TOKEN0_1TO0_INT_RAW_S 12 +/* SLC_SLC0_TX_OVF_INT_RAW : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_OVF_INT_RAW (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_RAW_M (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_RAW_V 0x1 +#define SLC_SLC0_TX_OVF_INT_RAW_S 11 +/* SLC_SLC0_RX_UDF_INT_RAW : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_UDF_INT_RAW (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_RAW_M (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_RAW_V 0x1 +#define SLC_SLC0_RX_UDF_INT_RAW_S 10 +/* SLC_SLC0_TX_START_INT_RAW : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_START_INT_RAW (BIT(9)) +#define SLC_SLC0_TX_START_INT_RAW_M (BIT(9)) +#define SLC_SLC0_TX_START_INT_RAW_V 0x1 +#define SLC_SLC0_TX_START_INT_RAW_S 9 +/* SLC_SLC0_RX_START_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_START_INT_RAW (BIT(8)) +#define SLC_SLC0_RX_START_INT_RAW_M (BIT(8)) +#define SLC_SLC0_RX_START_INT_RAW_V 0x1 +#define SLC_SLC0_RX_START_INT_RAW_S 8 +/* SLC_FRHOST_BIT7_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT7_INT_RAW (BIT(7)) +#define SLC_FRHOST_BIT7_INT_RAW_M (BIT(7)) +#define SLC_FRHOST_BIT7_INT_RAW_V 0x1 +#define SLC_FRHOST_BIT7_INT_RAW_S 7 +/* SLC_FRHOST_BIT6_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT6_INT_RAW (BIT(6)) +#define SLC_FRHOST_BIT6_INT_RAW_M (BIT(6)) +#define SLC_FRHOST_BIT6_INT_RAW_V 0x1 +#define SLC_FRHOST_BIT6_INT_RAW_S 6 +/* SLC_FRHOST_BIT5_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT5_INT_RAW (BIT(5)) +#define SLC_FRHOST_BIT5_INT_RAW_M (BIT(5)) +#define SLC_FRHOST_BIT5_INT_RAW_V 0x1 +#define SLC_FRHOST_BIT5_INT_RAW_S 5 +/* SLC_FRHOST_BIT4_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT4_INT_RAW (BIT(4)) +#define SLC_FRHOST_BIT4_INT_RAW_M (BIT(4)) +#define SLC_FRHOST_BIT4_INT_RAW_V 0x1 +#define SLC_FRHOST_BIT4_INT_RAW_S 4 +/* SLC_FRHOST_BIT3_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT3_INT_RAW (BIT(3)) +#define SLC_FRHOST_BIT3_INT_RAW_M (BIT(3)) +#define SLC_FRHOST_BIT3_INT_RAW_V 0x1 +#define SLC_FRHOST_BIT3_INT_RAW_S 3 +/* SLC_FRHOST_BIT2_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT2_INT_RAW (BIT(2)) +#define SLC_FRHOST_BIT2_INT_RAW_M (BIT(2)) +#define SLC_FRHOST_BIT2_INT_RAW_V 0x1 +#define SLC_FRHOST_BIT2_INT_RAW_S 2 +/* SLC_FRHOST_BIT1_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT1_INT_RAW (BIT(1)) +#define SLC_FRHOST_BIT1_INT_RAW_M (BIT(1)) +#define SLC_FRHOST_BIT1_INT_RAW_V 0x1 +#define SLC_FRHOST_BIT1_INT_RAW_S 1 +/* SLC_FRHOST_BIT0_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT0_INT_RAW (BIT(0)) +#define SLC_FRHOST_BIT0_INT_RAW_M (BIT(0)) +#define SLC_FRHOST_BIT0_INT_RAW_V 0x1 +#define SLC_FRHOST_BIT0_INT_RAW_S 0 + +#define SLC_0INT_ST_REG (DR_REG_SLC_BASE + 0x8) +/* SLC_SLC0_HOST_POP_EOF_ERR_INT_ST : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ST (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ST_M (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ST_V 0x1 +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ST_S 27 +/* SLC_SLC0_RX_QUICK_EOF_INT_ST : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_QUICK_EOF_INT_ST (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_ST_M (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_ST_V 0x1 +#define SLC_SLC0_RX_QUICK_EOF_INT_ST_S 26 +/* SLC_CMD_DTC_INT_ST : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define SLC_CMD_DTC_INT_ST (BIT(25)) +#define SLC_CMD_DTC_INT_ST_M (BIT(25)) +#define SLC_CMD_DTC_INT_ST_V 0x1 +#define SLC_CMD_DTC_INT_ST_S 25 +/* SLC_SLC0_TX_ERR_EOF_INT_ST : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_ERR_EOF_INT_ST (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_ST_M (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_ST_V 0x1 +#define SLC_SLC0_TX_ERR_EOF_INT_ST_S 24 +/* SLC_SLC0_WR_RETRY_DONE_INT_ST : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_WR_RETRY_DONE_INT_ST (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_ST_M (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_ST_V 0x1 +#define SLC_SLC0_WR_RETRY_DONE_INT_ST_S 23 +/* SLC_SLC0_HOST_RD_ACK_INT_ST : RO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_RD_ACK_INT_ST (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_ST_M (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_ST_V 0x1 +#define SLC_SLC0_HOST_RD_ACK_INT_ST_S 22 +/* SLC_SLC0_TX_DSCR_EMPTY_INT_ST : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ST (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ST_M (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ST_V 0x1 +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ST_S 21 +/* SLC_SLC0_RX_DSCR_ERR_INT_ST : RO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DSCR_ERR_INT_ST (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_ST_M (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_ST_V 0x1 +#define SLC_SLC0_RX_DSCR_ERR_INT_ST_S 20 +/* SLC_SLC0_TX_DSCR_ERR_INT_ST : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_ERR_INT_ST (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_ST_M (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_ST_V 0x1 +#define SLC_SLC0_TX_DSCR_ERR_INT_ST_S 19 +/* SLC_SLC0_TOHOST_INT_ST : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOHOST_INT_ST (BIT(18)) +#define SLC_SLC0_TOHOST_INT_ST_M (BIT(18)) +#define SLC_SLC0_TOHOST_INT_ST_V 0x1 +#define SLC_SLC0_TOHOST_INT_ST_S 18 +/* SLC_SLC0_RX_EOF_INT_ST : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_EOF_INT_ST (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_ST_M (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_ST_V 0x1 +#define SLC_SLC0_RX_EOF_INT_ST_S 17 +/* SLC_SLC0_RX_DONE_INT_ST : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DONE_INT_ST (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_ST_M (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_ST_V 0x1 +#define SLC_SLC0_RX_DONE_INT_ST_S 16 +/* SLC_SLC0_TX_SUC_EOF_INT_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_SUC_EOF_INT_ST (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_ST_M (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_ST_V 0x1 +#define SLC_SLC0_TX_SUC_EOF_INT_ST_S 15 +/* SLC_SLC0_TX_DONE_INT_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DONE_INT_ST (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_ST_M (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_ST_V 0x1 +#define SLC_SLC0_TX_DONE_INT_ST_S 14 +/* SLC_SLC0_TOKEN1_1TO0_INT_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1_1TO0_INT_ST (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_ST_M (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_ST_V 0x1 +#define SLC_SLC0_TOKEN1_1TO0_INT_ST_S 13 +/* SLC_SLC0_TOKEN0_1TO0_INT_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0_1TO0_INT_ST (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_ST_M (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_ST_V 0x1 +#define SLC_SLC0_TOKEN0_1TO0_INT_ST_S 12 +/* SLC_SLC0_TX_OVF_INT_ST : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_OVF_INT_ST (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_ST_M (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_ST_V 0x1 +#define SLC_SLC0_TX_OVF_INT_ST_S 11 +/* SLC_SLC0_RX_UDF_INT_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_UDF_INT_ST (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_ST_M (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_ST_V 0x1 +#define SLC_SLC0_RX_UDF_INT_ST_S 10 +/* SLC_SLC0_TX_START_INT_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_START_INT_ST (BIT(9)) +#define SLC_SLC0_TX_START_INT_ST_M (BIT(9)) +#define SLC_SLC0_TX_START_INT_ST_V 0x1 +#define SLC_SLC0_TX_START_INT_ST_S 9 +/* SLC_SLC0_RX_START_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_START_INT_ST (BIT(8)) +#define SLC_SLC0_RX_START_INT_ST_M (BIT(8)) +#define SLC_SLC0_RX_START_INT_ST_V 0x1 +#define SLC_SLC0_RX_START_INT_ST_S 8 +/* SLC_FRHOST_BIT7_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT7_INT_ST (BIT(7)) +#define SLC_FRHOST_BIT7_INT_ST_M (BIT(7)) +#define SLC_FRHOST_BIT7_INT_ST_V 0x1 +#define SLC_FRHOST_BIT7_INT_ST_S 7 +/* SLC_FRHOST_BIT6_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT6_INT_ST (BIT(6)) +#define SLC_FRHOST_BIT6_INT_ST_M (BIT(6)) +#define SLC_FRHOST_BIT6_INT_ST_V 0x1 +#define SLC_FRHOST_BIT6_INT_ST_S 6 +/* SLC_FRHOST_BIT5_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT5_INT_ST (BIT(5)) +#define SLC_FRHOST_BIT5_INT_ST_M (BIT(5)) +#define SLC_FRHOST_BIT5_INT_ST_V 0x1 +#define SLC_FRHOST_BIT5_INT_ST_S 5 +/* SLC_FRHOST_BIT4_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT4_INT_ST (BIT(4)) +#define SLC_FRHOST_BIT4_INT_ST_M (BIT(4)) +#define SLC_FRHOST_BIT4_INT_ST_V 0x1 +#define SLC_FRHOST_BIT4_INT_ST_S 4 +/* SLC_FRHOST_BIT3_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT3_INT_ST (BIT(3)) +#define SLC_FRHOST_BIT3_INT_ST_M (BIT(3)) +#define SLC_FRHOST_BIT3_INT_ST_V 0x1 +#define SLC_FRHOST_BIT3_INT_ST_S 3 +/* SLC_FRHOST_BIT2_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT2_INT_ST (BIT(2)) +#define SLC_FRHOST_BIT2_INT_ST_M (BIT(2)) +#define SLC_FRHOST_BIT2_INT_ST_V 0x1 +#define SLC_FRHOST_BIT2_INT_ST_S 2 +/* SLC_FRHOST_BIT1_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT1_INT_ST (BIT(1)) +#define SLC_FRHOST_BIT1_INT_ST_M (BIT(1)) +#define SLC_FRHOST_BIT1_INT_ST_V 0x1 +#define SLC_FRHOST_BIT1_INT_ST_S 1 +/* SLC_FRHOST_BIT0_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT0_INT_ST (BIT(0)) +#define SLC_FRHOST_BIT0_INT_ST_M (BIT(0)) +#define SLC_FRHOST_BIT0_INT_ST_V 0x1 +#define SLC_FRHOST_BIT0_INT_ST_S 0 + +#define SLC_0INT_ENA_REG (DR_REG_SLC_BASE + 0xC) +/* SLC_SLC0_HOST_POP_EOF_ERR_INT_ENA : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ENA (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ENA_M (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ENA_V 0x1 +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ENA_S 27 +/* SLC_SLC0_RX_QUICK_EOF_INT_ENA : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_QUICK_EOF_INT_ENA (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_ENA_M (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_ENA_V 0x1 +#define SLC_SLC0_RX_QUICK_EOF_INT_ENA_S 26 +/* SLC_CMD_DTC_INT_ENA : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define SLC_CMD_DTC_INT_ENA (BIT(25)) +#define SLC_CMD_DTC_INT_ENA_M (BIT(25)) +#define SLC_CMD_DTC_INT_ENA_V 0x1 +#define SLC_CMD_DTC_INT_ENA_S 25 +/* SLC_SLC0_TX_ERR_EOF_INT_ENA : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_ERR_EOF_INT_ENA (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_ENA_M (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_ENA_V 0x1 +#define SLC_SLC0_TX_ERR_EOF_INT_ENA_S 24 +/* SLC_SLC0_WR_RETRY_DONE_INT_ENA : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_WR_RETRY_DONE_INT_ENA (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_ENA_M (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_ENA_V 0x1 +#define SLC_SLC0_WR_RETRY_DONE_INT_ENA_S 23 +/* SLC_SLC0_HOST_RD_ACK_INT_ENA : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_RD_ACK_INT_ENA (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_ENA_M (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_ENA_V 0x1 +#define SLC_SLC0_HOST_RD_ACK_INT_ENA_S 22 +/* SLC_SLC0_TX_DSCR_EMPTY_INT_ENA : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ENA (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ENA_M (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ENA_V 0x1 +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ENA_S 21 +/* SLC_SLC0_RX_DSCR_ERR_INT_ENA : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DSCR_ERR_INT_ENA (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_ENA_M (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_ENA_V 0x1 +#define SLC_SLC0_RX_DSCR_ERR_INT_ENA_S 20 +/* SLC_SLC0_TX_DSCR_ERR_INT_ENA : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_ERR_INT_ENA (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_ENA_M (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_ENA_V 0x1 +#define SLC_SLC0_TX_DSCR_ERR_INT_ENA_S 19 +/* SLC_SLC0_TOHOST_INT_ENA : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOHOST_INT_ENA (BIT(18)) +#define SLC_SLC0_TOHOST_INT_ENA_M (BIT(18)) +#define SLC_SLC0_TOHOST_INT_ENA_V 0x1 +#define SLC_SLC0_TOHOST_INT_ENA_S 18 +/* SLC_SLC0_RX_EOF_INT_ENA : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_EOF_INT_ENA (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_ENA_M (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_ENA_V 0x1 +#define SLC_SLC0_RX_EOF_INT_ENA_S 17 +/* SLC_SLC0_RX_DONE_INT_ENA : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DONE_INT_ENA (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_ENA_M (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_ENA_V 0x1 +#define SLC_SLC0_RX_DONE_INT_ENA_S 16 +/* SLC_SLC0_TX_SUC_EOF_INT_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_SUC_EOF_INT_ENA (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_ENA_M (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_ENA_V 0x1 +#define SLC_SLC0_TX_SUC_EOF_INT_ENA_S 15 +/* SLC_SLC0_TX_DONE_INT_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DONE_INT_ENA (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_ENA_M (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_ENA_V 0x1 +#define SLC_SLC0_TX_DONE_INT_ENA_S 14 +/* SLC_SLC0_TOKEN1_1TO0_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1_1TO0_INT_ENA (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_ENA_M (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_ENA_V 0x1 +#define SLC_SLC0_TOKEN1_1TO0_INT_ENA_S 13 +/* SLC_SLC0_TOKEN0_1TO0_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0_1TO0_INT_ENA (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_ENA_M (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_ENA_V 0x1 +#define SLC_SLC0_TOKEN0_1TO0_INT_ENA_S 12 +/* SLC_SLC0_TX_OVF_INT_ENA : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_OVF_INT_ENA (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_ENA_M (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_ENA_V 0x1 +#define SLC_SLC0_TX_OVF_INT_ENA_S 11 +/* SLC_SLC0_RX_UDF_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_UDF_INT_ENA (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_ENA_M (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_ENA_V 0x1 +#define SLC_SLC0_RX_UDF_INT_ENA_S 10 +/* SLC_SLC0_TX_START_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_START_INT_ENA (BIT(9)) +#define SLC_SLC0_TX_START_INT_ENA_M (BIT(9)) +#define SLC_SLC0_TX_START_INT_ENA_V 0x1 +#define SLC_SLC0_TX_START_INT_ENA_S 9 +/* SLC_SLC0_RX_START_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_START_INT_ENA (BIT(8)) +#define SLC_SLC0_RX_START_INT_ENA_M (BIT(8)) +#define SLC_SLC0_RX_START_INT_ENA_V 0x1 +#define SLC_SLC0_RX_START_INT_ENA_S 8 +/* SLC_FRHOST_BIT7_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT7_INT_ENA (BIT(7)) +#define SLC_FRHOST_BIT7_INT_ENA_M (BIT(7)) +#define SLC_FRHOST_BIT7_INT_ENA_V 0x1 +#define SLC_FRHOST_BIT7_INT_ENA_S 7 +/* SLC_FRHOST_BIT6_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT6_INT_ENA (BIT(6)) +#define SLC_FRHOST_BIT6_INT_ENA_M (BIT(6)) +#define SLC_FRHOST_BIT6_INT_ENA_V 0x1 +#define SLC_FRHOST_BIT6_INT_ENA_S 6 +/* SLC_FRHOST_BIT5_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT5_INT_ENA (BIT(5)) +#define SLC_FRHOST_BIT5_INT_ENA_M (BIT(5)) +#define SLC_FRHOST_BIT5_INT_ENA_V 0x1 +#define SLC_FRHOST_BIT5_INT_ENA_S 5 +/* SLC_FRHOST_BIT4_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT4_INT_ENA (BIT(4)) +#define SLC_FRHOST_BIT4_INT_ENA_M (BIT(4)) +#define SLC_FRHOST_BIT4_INT_ENA_V 0x1 +#define SLC_FRHOST_BIT4_INT_ENA_S 4 +/* SLC_FRHOST_BIT3_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT3_INT_ENA (BIT(3)) +#define SLC_FRHOST_BIT3_INT_ENA_M (BIT(3)) +#define SLC_FRHOST_BIT3_INT_ENA_V 0x1 +#define SLC_FRHOST_BIT3_INT_ENA_S 3 +/* SLC_FRHOST_BIT2_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT2_INT_ENA (BIT(2)) +#define SLC_FRHOST_BIT2_INT_ENA_M (BIT(2)) +#define SLC_FRHOST_BIT2_INT_ENA_V 0x1 +#define SLC_FRHOST_BIT2_INT_ENA_S 2 +/* SLC_FRHOST_BIT1_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT1_INT_ENA (BIT(1)) +#define SLC_FRHOST_BIT1_INT_ENA_M (BIT(1)) +#define SLC_FRHOST_BIT1_INT_ENA_V 0x1 +#define SLC_FRHOST_BIT1_INT_ENA_S 1 +/* SLC_FRHOST_BIT0_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT0_INT_ENA (BIT(0)) +#define SLC_FRHOST_BIT0_INT_ENA_M (BIT(0)) +#define SLC_FRHOST_BIT0_INT_ENA_V 0x1 +#define SLC_FRHOST_BIT0_INT_ENA_S 0 + +#define SLC_0INT_CLR_REG (DR_REG_SLC_BASE + 0x10) +/* SLC_SLC0_HOST_POP_EOF_ERR_INT_CLR : WO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_CLR (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_CLR_M (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_CLR_V 0x1 +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_CLR_S 27 +/* SLC_SLC0_RX_QUICK_EOF_INT_CLR : WO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_QUICK_EOF_INT_CLR (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_CLR_M (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_CLR_V 0x1 +#define SLC_SLC0_RX_QUICK_EOF_INT_CLR_S 26 +/* SLC_CMD_DTC_INT_CLR : WO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define SLC_CMD_DTC_INT_CLR (BIT(25)) +#define SLC_CMD_DTC_INT_CLR_M (BIT(25)) +#define SLC_CMD_DTC_INT_CLR_V 0x1 +#define SLC_CMD_DTC_INT_CLR_S 25 +/* SLC_SLC0_TX_ERR_EOF_INT_CLR : WO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_ERR_EOF_INT_CLR (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_CLR_M (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_CLR_V 0x1 +#define SLC_SLC0_TX_ERR_EOF_INT_CLR_S 24 +/* SLC_SLC0_WR_RETRY_DONE_INT_CLR : WO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_WR_RETRY_DONE_INT_CLR (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_CLR_M (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_CLR_V 0x1 +#define SLC_SLC0_WR_RETRY_DONE_INT_CLR_S 23 +/* SLC_SLC0_HOST_RD_ACK_INT_CLR : WO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_RD_ACK_INT_CLR (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_CLR_M (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_CLR_V 0x1 +#define SLC_SLC0_HOST_RD_ACK_INT_CLR_S 22 +/* SLC_SLC0_TX_DSCR_EMPTY_INT_CLR : WO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_EMPTY_INT_CLR (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_CLR_M (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_CLR_V 0x1 +#define SLC_SLC0_TX_DSCR_EMPTY_INT_CLR_S 21 +/* SLC_SLC0_RX_DSCR_ERR_INT_CLR : WO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DSCR_ERR_INT_CLR (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_CLR_M (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_CLR_V 0x1 +#define SLC_SLC0_RX_DSCR_ERR_INT_CLR_S 20 +/* SLC_SLC0_TX_DSCR_ERR_INT_CLR : WO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_ERR_INT_CLR (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_CLR_M (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_CLR_V 0x1 +#define SLC_SLC0_TX_DSCR_ERR_INT_CLR_S 19 +/* SLC_SLC0_TOHOST_INT_CLR : WO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOHOST_INT_CLR (BIT(18)) +#define SLC_SLC0_TOHOST_INT_CLR_M (BIT(18)) +#define SLC_SLC0_TOHOST_INT_CLR_V 0x1 +#define SLC_SLC0_TOHOST_INT_CLR_S 18 +/* SLC_SLC0_RX_EOF_INT_CLR : WO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_EOF_INT_CLR (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_CLR_M (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_CLR_V 0x1 +#define SLC_SLC0_RX_EOF_INT_CLR_S 17 +/* SLC_SLC0_RX_DONE_INT_CLR : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DONE_INT_CLR (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_CLR_M (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_CLR_V 0x1 +#define SLC_SLC0_RX_DONE_INT_CLR_S 16 +/* SLC_SLC0_TX_SUC_EOF_INT_CLR : WO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_SUC_EOF_INT_CLR (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_CLR_M (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_CLR_V 0x1 +#define SLC_SLC0_TX_SUC_EOF_INT_CLR_S 15 +/* SLC_SLC0_TX_DONE_INT_CLR : WO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DONE_INT_CLR (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_CLR_M (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_CLR_V 0x1 +#define SLC_SLC0_TX_DONE_INT_CLR_S 14 +/* SLC_SLC0_TOKEN1_1TO0_INT_CLR : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1_1TO0_INT_CLR (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_CLR_M (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_CLR_V 0x1 +#define SLC_SLC0_TOKEN1_1TO0_INT_CLR_S 13 +/* SLC_SLC0_TOKEN0_1TO0_INT_CLR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0_1TO0_INT_CLR (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_CLR_M (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_CLR_V 0x1 +#define SLC_SLC0_TOKEN0_1TO0_INT_CLR_S 12 +/* SLC_SLC0_TX_OVF_INT_CLR : WO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_OVF_INT_CLR (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_CLR_M (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_CLR_V 0x1 +#define SLC_SLC0_TX_OVF_INT_CLR_S 11 +/* SLC_SLC0_RX_UDF_INT_CLR : WO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_UDF_INT_CLR (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_CLR_M (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_CLR_V 0x1 +#define SLC_SLC0_RX_UDF_INT_CLR_S 10 +/* SLC_SLC0_TX_START_INT_CLR : WO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_START_INT_CLR (BIT(9)) +#define SLC_SLC0_TX_START_INT_CLR_M (BIT(9)) +#define SLC_SLC0_TX_START_INT_CLR_V 0x1 +#define SLC_SLC0_TX_START_INT_CLR_S 9 +/* SLC_SLC0_RX_START_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_START_INT_CLR (BIT(8)) +#define SLC_SLC0_RX_START_INT_CLR_M (BIT(8)) +#define SLC_SLC0_RX_START_INT_CLR_V 0x1 +#define SLC_SLC0_RX_START_INT_CLR_S 8 +/* SLC_FRHOST_BIT7_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT7_INT_CLR (BIT(7)) +#define SLC_FRHOST_BIT7_INT_CLR_M (BIT(7)) +#define SLC_FRHOST_BIT7_INT_CLR_V 0x1 +#define SLC_FRHOST_BIT7_INT_CLR_S 7 +/* SLC_FRHOST_BIT6_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT6_INT_CLR (BIT(6)) +#define SLC_FRHOST_BIT6_INT_CLR_M (BIT(6)) +#define SLC_FRHOST_BIT6_INT_CLR_V 0x1 +#define SLC_FRHOST_BIT6_INT_CLR_S 6 +/* SLC_FRHOST_BIT5_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT5_INT_CLR (BIT(5)) +#define SLC_FRHOST_BIT5_INT_CLR_M (BIT(5)) +#define SLC_FRHOST_BIT5_INT_CLR_V 0x1 +#define SLC_FRHOST_BIT5_INT_CLR_S 5 +/* SLC_FRHOST_BIT4_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT4_INT_CLR (BIT(4)) +#define SLC_FRHOST_BIT4_INT_CLR_M (BIT(4)) +#define SLC_FRHOST_BIT4_INT_CLR_V 0x1 +#define SLC_FRHOST_BIT4_INT_CLR_S 4 +/* SLC_FRHOST_BIT3_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT3_INT_CLR (BIT(3)) +#define SLC_FRHOST_BIT3_INT_CLR_M (BIT(3)) +#define SLC_FRHOST_BIT3_INT_CLR_V 0x1 +#define SLC_FRHOST_BIT3_INT_CLR_S 3 +/* SLC_FRHOST_BIT2_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT2_INT_CLR (BIT(2)) +#define SLC_FRHOST_BIT2_INT_CLR_M (BIT(2)) +#define SLC_FRHOST_BIT2_INT_CLR_V 0x1 +#define SLC_FRHOST_BIT2_INT_CLR_S 2 +/* SLC_FRHOST_BIT1_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT1_INT_CLR (BIT(1)) +#define SLC_FRHOST_BIT1_INT_CLR_M (BIT(1)) +#define SLC_FRHOST_BIT1_INT_CLR_V 0x1 +#define SLC_FRHOST_BIT1_INT_CLR_S 1 +/* SLC_FRHOST_BIT0_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT0_INT_CLR (BIT(0)) +#define SLC_FRHOST_BIT0_INT_CLR_M (BIT(0)) +#define SLC_FRHOST_BIT0_INT_CLR_V 0x1 +#define SLC_FRHOST_BIT0_INT_CLR_S 0 + +#define SLC_RX_STATUS_REG (DR_REG_SLC_BASE + 0x24) +/* SLC_SLC0_RX_BUF_LEN : RO ;bitpos:[13:2] ;default: 12'h0 ; */ +/*description: */ +#define SLC_SLC0_RX_BUF_LEN 0x00000FFF +#define SLC_SLC0_RX_BUF_LEN_M ((SLC_SLC0_RX_BUF_LEN_V)<<(SLC_SLC0_RX_BUF_LEN_S)) +#define SLC_SLC0_RX_BUF_LEN_V 0xFFF +#define SLC_SLC0_RX_BUF_LEN_S 2 +/* SLC_SLC0_RX_EMPTY : RO ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_RX_EMPTY (BIT(1)) +#define SLC_SLC0_RX_EMPTY_M (BIT(1)) +#define SLC_SLC0_RX_EMPTY_V 0x1 +#define SLC_SLC0_RX_EMPTY_S 1 +/* SLC_SLC0_RX_FULL : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_FULL (BIT(0)) +#define SLC_SLC0_RX_FULL_M (BIT(0)) +#define SLC_SLC0_RX_FULL_V 0x1 +#define SLC_SLC0_RX_FULL_S 0 + +#define SLC_0RXFIFO_PUSH_REG (DR_REG_SLC_BASE + 0x28) +/* SLC_SLC0_RXFIFO_PUSH : R/W ;bitpos:[16] ;default: 1'h0 ; */ +/*description: */ +#define SLC_SLC0_RXFIFO_PUSH (BIT(16)) +#define SLC_SLC0_RXFIFO_PUSH_M (BIT(16)) +#define SLC_SLC0_RXFIFO_PUSH_V 0x1 +#define SLC_SLC0_RXFIFO_PUSH_S 16 +/* SLC_SLC0_RXFIFO_WDATA : R/W ;bitpos:[8:0] ;default: 9'h0 ; */ +/*description: */ +#define SLC_SLC0_RXFIFO_WDATA 0x000001FF +#define SLC_SLC0_RXFIFO_WDATA_M ((SLC_SLC0_RXFIFO_WDATA_V)<<(SLC_SLC0_RXFIFO_WDATA_S)) +#define SLC_SLC0_RXFIFO_WDATA_V 0x1FF +#define SLC_SLC0_RXFIFO_WDATA_S 0 + +#define SLC_TX_STATUS_REG (DR_REG_SLC_BASE + 0x30) +/* SLC_SLC0_TX_EMPTY : RO ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_TX_EMPTY (BIT(1)) +#define SLC_SLC0_TX_EMPTY_M (BIT(1)) +#define SLC_SLC0_TX_EMPTY_V 0x1 +#define SLC_SLC0_TX_EMPTY_S 1 +/* SLC_SLC0_TX_FULL : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_FULL (BIT(0)) +#define SLC_SLC0_TX_FULL_M (BIT(0)) +#define SLC_SLC0_TX_FULL_V 0x1 +#define SLC_SLC0_TX_FULL_S 0 + +#define SLC_0TXFIFO_POP_REG (DR_REG_SLC_BASE + 0x34) +/* SLC_SLC0_TXFIFO_POP : R/W ;bitpos:[16] ;default: 1'h0 ; */ +/*description: */ +#define SLC_SLC0_TXFIFO_POP (BIT(16)) +#define SLC_SLC0_TXFIFO_POP_M (BIT(16)) +#define SLC_SLC0_TXFIFO_POP_V 0x1 +#define SLC_SLC0_TXFIFO_POP_S 16 +/* SLC_SLC0_TXFIFO_RDATA : RO ;bitpos:[10:0] ;default: 11'h0 ; */ +/*description: */ +#define SLC_SLC0_TXFIFO_RDATA 0x000007FF +#define SLC_SLC0_TXFIFO_RDATA_M ((SLC_SLC0_TXFIFO_RDATA_V)<<(SLC_SLC0_TXFIFO_RDATA_S)) +#define SLC_SLC0_TXFIFO_RDATA_V 0x7FF +#define SLC_SLC0_TXFIFO_RDATA_S 0 + +#define SLC_0RX_LINK_REG (DR_REG_SLC_BASE + 0x3C) +/* SLC_SLC0_RXLINK_PARK : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define SLC_SLC0_RXLINK_PARK (BIT(31)) +#define SLC_SLC0_RXLINK_PARK_M (BIT(31)) +#define SLC_SLC0_RXLINK_PARK_V 0x1 +#define SLC_SLC0_RXLINK_PARK_S 31 +/* SLC_SLC0_RXLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RXLINK_RESTART (BIT(30)) +#define SLC_SLC0_RXLINK_RESTART_M (BIT(30)) +#define SLC_SLC0_RXLINK_RESTART_V 0x1 +#define SLC_SLC0_RXLINK_RESTART_S 30 +/* SLC_SLC0_RXLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RXLINK_START (BIT(29)) +#define SLC_SLC0_RXLINK_START_M (BIT(29)) +#define SLC_SLC0_RXLINK_START_V 0x1 +#define SLC_SLC0_RXLINK_START_S 29 +/* SLC_SLC0_RXLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RXLINK_STOP (BIT(28)) +#define SLC_SLC0_RXLINK_STOP_M (BIT(28)) +#define SLC_SLC0_RXLINK_STOP_V 0x1 +#define SLC_SLC0_RXLINK_STOP_S 28 +/* SLC_SLC0_RXLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define SLC_SLC0_RXLINK_ADDR 0x000FFFFF +#define SLC_SLC0_RXLINK_ADDR_M ((SLC_SLC0_RXLINK_ADDR_V)<<(SLC_SLC0_RXLINK_ADDR_S)) +#define SLC_SLC0_RXLINK_ADDR_V 0xFFFFF +#define SLC_SLC0_RXLINK_ADDR_S 0 + +#define SLC_0TX_LINK_REG (DR_REG_SLC_BASE + 0x40) +/* SLC_SLC0_TXLINK_PARK : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define SLC_SLC0_TXLINK_PARK (BIT(31)) +#define SLC_SLC0_TXLINK_PARK_M (BIT(31)) +#define SLC_SLC0_TXLINK_PARK_V 0x1 +#define SLC_SLC0_TXLINK_PARK_S 31 +/* SLC_SLC0_TXLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TXLINK_RESTART (BIT(30)) +#define SLC_SLC0_TXLINK_RESTART_M (BIT(30)) +#define SLC_SLC0_TXLINK_RESTART_V 0x1 +#define SLC_SLC0_TXLINK_RESTART_S 30 +/* SLC_SLC0_TXLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TXLINK_START (BIT(29)) +#define SLC_SLC0_TXLINK_START_M (BIT(29)) +#define SLC_SLC0_TXLINK_START_V 0x1 +#define SLC_SLC0_TXLINK_START_S 29 +/* SLC_SLC0_TXLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TXLINK_STOP (BIT(28)) +#define SLC_SLC0_TXLINK_STOP_M (BIT(28)) +#define SLC_SLC0_TXLINK_STOP_V 0x1 +#define SLC_SLC0_TXLINK_STOP_S 28 +/* SLC_SLC0_TXLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define SLC_SLC0_TXLINK_ADDR 0x000FFFFF +#define SLC_SLC0_TXLINK_ADDR_M ((SLC_SLC0_TXLINK_ADDR_V)<<(SLC_SLC0_TXLINK_ADDR_S)) +#define SLC_SLC0_TXLINK_ADDR_V 0xFFFFF +#define SLC_SLC0_TXLINK_ADDR_S 0 + +#define SLC_INTVEC_TOHOST_REG (DR_REG_SLC_BASE + 0x4C) +/* SLC_SLC0_TOHOST_INTVEC : WO ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define SLC_SLC0_TOHOST_INTVEC 0x000000FF +#define SLC_SLC0_TOHOST_INTVEC_M ((SLC_SLC0_TOHOST_INTVEC_V)<<(SLC_SLC0_TOHOST_INTVEC_S)) +#define SLC_SLC0_TOHOST_INTVEC_V 0xFF +#define SLC_SLC0_TOHOST_INTVEC_S 0 + +#define SLC_0TOKEN0_REG (DR_REG_SLC_BASE + 0x50) +/* SLC_SLC0_TOKEN0 : RO ;bitpos:[27:16] ;default: 12'h0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0 0x00000FFF +#define SLC_SLC0_TOKEN0_M ((SLC_SLC0_TOKEN0_V)<<(SLC_SLC0_TOKEN0_S)) +#define SLC_SLC0_TOKEN0_V 0xFFF +#define SLC_SLC0_TOKEN0_S 16 +/* SLC_SLC0_TOKEN0_INC_MORE : WO ;bitpos:[14] ;default: 1'h0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0_INC_MORE (BIT(14)) +#define SLC_SLC0_TOKEN0_INC_MORE_M (BIT(14)) +#define SLC_SLC0_TOKEN0_INC_MORE_V 0x1 +#define SLC_SLC0_TOKEN0_INC_MORE_S 14 +/* SLC_SLC0_TOKEN0_INC : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0_INC (BIT(13)) +#define SLC_SLC0_TOKEN0_INC_M (BIT(13)) +#define SLC_SLC0_TOKEN0_INC_V 0x1 +#define SLC_SLC0_TOKEN0_INC_S 13 +/* SLC_SLC0_TOKEN0_WR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0_WR (BIT(12)) +#define SLC_SLC0_TOKEN0_WR_M (BIT(12)) +#define SLC_SLC0_TOKEN0_WR_V 0x1 +#define SLC_SLC0_TOKEN0_WR_S 12 +/* SLC_SLC0_TOKEN0_WDATA : WO ;bitpos:[11:0] ;default: 12'h0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0_WDATA 0x00000FFF +#define SLC_SLC0_TOKEN0_WDATA_M ((SLC_SLC0_TOKEN0_WDATA_V)<<(SLC_SLC0_TOKEN0_WDATA_S)) +#define SLC_SLC0_TOKEN0_WDATA_V 0xFFF +#define SLC_SLC0_TOKEN0_WDATA_S 0 + +#define SLC_0TOKEN1_REG (DR_REG_SLC_BASE + 0x54) +/* SLC_SLC0_TOKEN1 : RO ;bitpos:[27:16] ;default: 12'h0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1 0x00000FFF +#define SLC_SLC0_TOKEN1_M ((SLC_SLC0_TOKEN1_V)<<(SLC_SLC0_TOKEN1_S)) +#define SLC_SLC0_TOKEN1_V 0xFFF +#define SLC_SLC0_TOKEN1_S 16 +/* SLC_SLC0_TOKEN1_INC_MORE : WO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1_INC_MORE (BIT(14)) +#define SLC_SLC0_TOKEN1_INC_MORE_M (BIT(14)) +#define SLC_SLC0_TOKEN1_INC_MORE_V 0x1 +#define SLC_SLC0_TOKEN1_INC_MORE_S 14 +/* SLC_SLC0_TOKEN1_INC : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1_INC (BIT(13)) +#define SLC_SLC0_TOKEN1_INC_M (BIT(13)) +#define SLC_SLC0_TOKEN1_INC_V 0x1 +#define SLC_SLC0_TOKEN1_INC_S 13 +/* SLC_SLC0_TOKEN1_WR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1_WR (BIT(12)) +#define SLC_SLC0_TOKEN1_WR_M (BIT(12)) +#define SLC_SLC0_TOKEN1_WR_V 0x1 +#define SLC_SLC0_TOKEN1_WR_S 12 +/* SLC_SLC0_TOKEN1_WDATA : WO ;bitpos:[11:0] ;default: 12'h0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1_WDATA 0x00000FFF +#define SLC_SLC0_TOKEN1_WDATA_M ((SLC_SLC0_TOKEN1_WDATA_V)<<(SLC_SLC0_TOKEN1_WDATA_S)) +#define SLC_SLC0_TOKEN1_WDATA_V 0xFFF +#define SLC_SLC0_TOKEN1_WDATA_S 0 + +#define SLC_CONF1_REG (DR_REG_SLC_BASE + 0x60) +/* SLC_CLK_EN : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define SLC_CLK_EN (BIT(22)) +#define SLC_CLK_EN_M (BIT(22)) +#define SLC_CLK_EN_V 0x1 +#define SLC_CLK_EN_S 22 +/* SLC_HOST_INT_LEVEL_SEL : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define SLC_HOST_INT_LEVEL_SEL (BIT(19)) +#define SLC_HOST_INT_LEVEL_SEL_M (BIT(19)) +#define SLC_HOST_INT_LEVEL_SEL_V 0x1 +#define SLC_HOST_INT_LEVEL_SEL_S 19 +/* SLC_SLC0_RX_STITCH_EN : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_RX_STITCH_EN (BIT(6)) +#define SLC_SLC0_RX_STITCH_EN_M (BIT(6)) +#define SLC_SLC0_RX_STITCH_EN_V 0x1 +#define SLC_SLC0_RX_STITCH_EN_S 6 +/* SLC_SLC0_TX_STITCH_EN : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_TX_STITCH_EN (BIT(5)) +#define SLC_SLC0_TX_STITCH_EN_M (BIT(5)) +#define SLC_SLC0_TX_STITCH_EN_V 0x1 +#define SLC_SLC0_TX_STITCH_EN_S 5 +/* SLC_SLC0_LEN_AUTO_CLR : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_LEN_AUTO_CLR (BIT(4)) +#define SLC_SLC0_LEN_AUTO_CLR_M (BIT(4)) +#define SLC_SLC0_LEN_AUTO_CLR_V 0x1 +#define SLC_SLC0_LEN_AUTO_CLR_S 4 +/* SLC_CMD_HOLD_EN : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define SLC_CMD_HOLD_EN (BIT(3)) +#define SLC_CMD_HOLD_EN_M (BIT(3)) +#define SLC_CMD_HOLD_EN_V 0x1 +#define SLC_CMD_HOLD_EN_S 3 +/* SLC_SLC0_RX_CHECK_SUM_EN : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_CHECK_SUM_EN (BIT(2)) +#define SLC_SLC0_RX_CHECK_SUM_EN_M (BIT(2)) +#define SLC_SLC0_RX_CHECK_SUM_EN_V 0x1 +#define SLC_SLC0_RX_CHECK_SUM_EN_S 2 +/* SLC_SLC0_TX_CHECK_SUM_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_CHECK_SUM_EN (BIT(1)) +#define SLC_SLC0_TX_CHECK_SUM_EN_M (BIT(1)) +#define SLC_SLC0_TX_CHECK_SUM_EN_V 0x1 +#define SLC_SLC0_TX_CHECK_SUM_EN_S 1 +/* SLC_SLC0_CHECK_OWNER : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_CHECK_OWNER (BIT(0)) +#define SLC_SLC0_CHECK_OWNER_M (BIT(0)) +#define SLC_SLC0_CHECK_OWNER_V 0x1 +#define SLC_SLC0_CHECK_OWNER_S 0 + +#define SLC_0_STATE0_REG (DR_REG_SLC_BASE + 0x64) +/* SLC_SLC0_STATE0 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_STATE0 0xFFFFFFFF +#define SLC_SLC0_STATE0_M ((SLC_SLC0_STATE0_V)<<(SLC_SLC0_STATE0_S)) +#define SLC_SLC0_STATE0_V 0xFFFFFFFF +#define SLC_SLC0_STATE0_S 0 + +#define SLC_0_STATE1_REG (DR_REG_SLC_BASE + 0x68) +/* SLC_SLC0_STATE1 : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_STATE1 0xFFFFFFFF +#define SLC_SLC0_STATE1_M ((SLC_SLC0_STATE1_V)<<(SLC_SLC0_STATE1_S)) +#define SLC_SLC0_STATE1_V 0xFFFFFFFF +#define SLC_SLC0_STATE1_S 0 + +#define SLC_BRIDGE_CONF_REG (DR_REG_SLC_BASE + 0x74) +/* SLC_TX_PUSH_IDLE_NUM : R/W ;bitpos:[31:16] ;default: 16'ha ; */ +/*description: */ +#define SLC_TX_PUSH_IDLE_NUM 0x0000FFFF +#define SLC_TX_PUSH_IDLE_NUM_M ((SLC_TX_PUSH_IDLE_NUM_V)<<(SLC_TX_PUSH_IDLE_NUM_S)) +#define SLC_TX_PUSH_IDLE_NUM_V 0xFFFF +#define SLC_TX_PUSH_IDLE_NUM_S 16 +/* SLC_HDA_MAP_128K : R/W ;bitpos:[13] ;default: 1'h1 ; */ +/*description: */ +#define SLC_HDA_MAP_128K (BIT(13)) +#define SLC_HDA_MAP_128K_M (BIT(13)) +#define SLC_HDA_MAP_128K_V 0x1 +#define SLC_HDA_MAP_128K_S 13 +/* SLC_SLC0_TX_DUMMY_MODE : R/W ;bitpos:[12] ;default: 1'h1 ; */ +/*description: */ +#define SLC_SLC0_TX_DUMMY_MODE (BIT(12)) +#define SLC_SLC0_TX_DUMMY_MODE_M (BIT(12)) +#define SLC_SLC0_TX_DUMMY_MODE_V 0x1 +#define SLC_SLC0_TX_DUMMY_MODE_S 12 +/* SLC_FIFO_MAP_ENA : R/W ;bitpos:[11:8] ;default: 4'h7 ; */ +/*description: */ +#define SLC_FIFO_MAP_ENA 0x0000000F +#define SLC_FIFO_MAP_ENA_M ((SLC_FIFO_MAP_ENA_V)<<(SLC_FIFO_MAP_ENA_S)) +#define SLC_FIFO_MAP_ENA_V 0xF +#define SLC_FIFO_MAP_ENA_S 8 +/* SLC_TXEOF_ENA : R/W ;bitpos:[5:0] ;default: 6'h20 ; */ +/*description: */ +#define SLC_TXEOF_ENA 0x0000003F +#define SLC_TXEOF_ENA_M ((SLC_TXEOF_ENA_V)<<(SLC_TXEOF_ENA_S)) +#define SLC_TXEOF_ENA_V 0x3F +#define SLC_TXEOF_ENA_S 0 + +#define SLC_0_TO_EOF_DES_ADDR_REG (DR_REG_SLC_BASE + 0x78) +/* SLC_SLC0_TO_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_TO_EOF_DES_ADDR 0xFFFFFFFF +#define SLC_SLC0_TO_EOF_DES_ADDR_M ((SLC_SLC0_TO_EOF_DES_ADDR_V)<<(SLC_SLC0_TO_EOF_DES_ADDR_S)) +#define SLC_SLC0_TO_EOF_DES_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_TO_EOF_DES_ADDR_S 0 + +#define SLC_0_TX_EOF_DES_ADDR_REG (DR_REG_SLC_BASE + 0x7C) +/* SLC_SLC0_TX_SUC_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_TX_SUC_EOF_DES_ADDR 0xFFFFFFFF +#define SLC_SLC0_TX_SUC_EOF_DES_ADDR_M ((SLC_SLC0_TX_SUC_EOF_DES_ADDR_V)<<(SLC_SLC0_TX_SUC_EOF_DES_ADDR_S)) +#define SLC_SLC0_TX_SUC_EOF_DES_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_TX_SUC_EOF_DES_ADDR_S 0 + +#define SLC_0_TO_EOF_BFR_DES_ADDR_REG (DR_REG_SLC_BASE + 0x80) +/* SLC_SLC0_TO_EOF_BFR_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_TO_EOF_BFR_DES_ADDR 0xFFFFFFFF +#define SLC_SLC0_TO_EOF_BFR_DES_ADDR_M ((SLC_SLC0_TO_EOF_BFR_DES_ADDR_V)<<(SLC_SLC0_TO_EOF_BFR_DES_ADDR_S)) +#define SLC_SLC0_TO_EOF_BFR_DES_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_TO_EOF_BFR_DES_ADDR_S 0 + +#define SLC_AHB_TEST_REG (DR_REG_SLC_BASE + 0x90) +/* SLC_AHB_TESTADDR : R/W ;bitpos:[5:4] ;default: 2'b0 ; */ +/*description: */ +#define SLC_AHB_TESTADDR 0x00000003 +#define SLC_AHB_TESTADDR_M ((SLC_AHB_TESTADDR_V)<<(SLC_AHB_TESTADDR_S)) +#define SLC_AHB_TESTADDR_V 0x3 +#define SLC_AHB_TESTADDR_S 4 +/* SLC_AHB_TESTMODE : R/W ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: */ +#define SLC_AHB_TESTMODE 0x00000007 +#define SLC_AHB_TESTMODE_M ((SLC_AHB_TESTMODE_V)<<(SLC_AHB_TESTMODE_S)) +#define SLC_AHB_TESTMODE_V 0x7 +#define SLC_AHB_TESTMODE_S 0 + +#define SLC_SDIO_ST_REG (DR_REG_SLC_BASE + 0x94) +/* SLC_FUNC1_ACC_STATE : RO ;bitpos:[20:16] ;default: 5'b0 ; */ +/*description: */ +#define SLC_FUNC1_ACC_STATE 0x0000001F +#define SLC_FUNC1_ACC_STATE_M ((SLC_FUNC1_ACC_STATE_V)<<(SLC_FUNC1_ACC_STATE_S)) +#define SLC_FUNC1_ACC_STATE_V 0x1F +#define SLC_FUNC1_ACC_STATE_S 16 +/* SLC_BUS_ST : RO ;bitpos:[14:12] ;default: 3'b0 ; */ +/*description: */ +#define SLC_BUS_ST 0x00000007 +#define SLC_BUS_ST_M ((SLC_BUS_ST_V)<<(SLC_BUS_ST_S)) +#define SLC_BUS_ST_V 0x7 +#define SLC_BUS_ST_S 12 +/* SLC_SDIO_WAKEUP : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SDIO_WAKEUP (BIT(8)) +#define SLC_SDIO_WAKEUP_M (BIT(8)) +#define SLC_SDIO_WAKEUP_V 0x1 +#define SLC_SDIO_WAKEUP_S 8 +/* SLC_FUNC_ST : RO ;bitpos:[7:4] ;default: 4'b0 ; */ +/*description: */ +#define SLC_FUNC_ST 0x0000000F +#define SLC_FUNC_ST_M ((SLC_FUNC_ST_V)<<(SLC_FUNC_ST_S)) +#define SLC_FUNC_ST_V 0xF +#define SLC_FUNC_ST_S 4 +#define SLC_FUNC_ST_IDLE 2 +/* SLC_CMD_ST : RO ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: */ +#define SLC_CMD_ST 0x00000007 +#define SLC_CMD_ST_M ((SLC_CMD_ST_V)<<(SLC_CMD_ST_S)) +#define SLC_CMD_ST_V 0x7 +#define SLC_CMD_ST_S 0 +#define SLC_CMD_ST_IDLE 1 + +#define SLC_RX_DSCR_CONF_REG (DR_REG_SLC_BASE + 0x98) +/* SLC_SLC0_RD_RETRY_THRESHOLD : R/W ;bitpos:[15:5] ;default: 11'h80 ; */ +/*description: */ +#define SLC_SLC0_RD_RETRY_THRESHOLD 0x000007FF +#define SLC_SLC0_RD_RETRY_THRESHOLD_M ((SLC_SLC0_RD_RETRY_THRESHOLD_V)<<(SLC_SLC0_RD_RETRY_THRESHOLD_S)) +#define SLC_SLC0_RD_RETRY_THRESHOLD_V 0x7FF +#define SLC_SLC0_RD_RETRY_THRESHOLD_S 5 +/* SLC_SLC0_RX_FILL_EN : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_RX_FILL_EN (BIT(4)) +#define SLC_SLC0_RX_FILL_EN_M (BIT(4)) +#define SLC_SLC0_RX_FILL_EN_V 0x1 +#define SLC_SLC0_RX_FILL_EN_S 4 +/* SLC_SLC0_RX_EOF_MODE : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_RX_EOF_MODE (BIT(3)) +#define SLC_SLC0_RX_EOF_MODE_M (BIT(3)) +#define SLC_SLC0_RX_EOF_MODE_V 0x1 +#define SLC_SLC0_RX_EOF_MODE_S 3 +/* SLC_SLC0_RX_FILL_MODE : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_FILL_MODE (BIT(2)) +#define SLC_SLC0_RX_FILL_MODE_M (BIT(2)) +#define SLC_SLC0_RX_FILL_MODE_V 0x1 +#define SLC_SLC0_RX_FILL_MODE_S 2 +/* SLC_SLC0_INFOR_NO_REPLACE : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define SLC_SLC0_INFOR_NO_REPLACE (BIT(1)) +#define SLC_SLC0_INFOR_NO_REPLACE_M (BIT(1)) +#define SLC_SLC0_INFOR_NO_REPLACE_V 0x1 +#define SLC_SLC0_INFOR_NO_REPLACE_S 1 +/* SLC_SLC0_TOKEN_NO_REPLACE : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN_NO_REPLACE (BIT(0)) +#define SLC_SLC0_TOKEN_NO_REPLACE_M (BIT(0)) +#define SLC_SLC0_TOKEN_NO_REPLACE_V 0x1 +#define SLC_SLC0_TOKEN_NO_REPLACE_S 0 + +#define SLC_0_TXLINK_DSCR_REG (DR_REG_SLC_BASE + 0x9C) +/* SLC_SLC0_TXLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_SLC0_TXLINK_DSCR 0xFFFFFFFF +#define SLC_SLC0_TXLINK_DSCR_M ((SLC_SLC0_TXLINK_DSCR_V)<<(SLC_SLC0_TXLINK_DSCR_S)) +#define SLC_SLC0_TXLINK_DSCR_V 0xFFFFFFFF +#define SLC_SLC0_TXLINK_DSCR_S 0 + +#define SLC_0_TXLINK_DSCR_BF0_REG (DR_REG_SLC_BASE + 0xA0) +/* SLC_SLC0_TXLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_SLC0_TXLINK_DSCR_BF0 0xFFFFFFFF +#define SLC_SLC0_TXLINK_DSCR_BF0_M ((SLC_SLC0_TXLINK_DSCR_BF0_V)<<(SLC_SLC0_TXLINK_DSCR_BF0_S)) +#define SLC_SLC0_TXLINK_DSCR_BF0_V 0xFFFFFFFF +#define SLC_SLC0_TXLINK_DSCR_BF0_S 0 + +#define SLC_0_TXLINK_DSCR_BF1_REG (DR_REG_SLC_BASE + 0xA4) +/* SLC_SLC0_TXLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_SLC0_TXLINK_DSCR_BF1 0xFFFFFFFF +#define SLC_SLC0_TXLINK_DSCR_BF1_M ((SLC_SLC0_TXLINK_DSCR_BF1_V)<<(SLC_SLC0_TXLINK_DSCR_BF1_S)) +#define SLC_SLC0_TXLINK_DSCR_BF1_V 0xFFFFFFFF +#define SLC_SLC0_TXLINK_DSCR_BF1_S 0 + +#define SLC_0_RXLINK_DSCR_REG (DR_REG_SLC_BASE + 0xA8) +/* SLC_SLC0_RXLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_SLC0_RXLINK_DSCR 0xFFFFFFFF +#define SLC_SLC0_RXLINK_DSCR_M ((SLC_SLC0_RXLINK_DSCR_V)<<(SLC_SLC0_RXLINK_DSCR_S)) +#define SLC_SLC0_RXLINK_DSCR_V 0xFFFFFFFF +#define SLC_SLC0_RXLINK_DSCR_S 0 + +#define SLC_0_RXLINK_DSCR_BF0_REG (DR_REG_SLC_BASE + 0xAC) +/* SLC_SLC0_RXLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_SLC0_RXLINK_DSCR_BF0 0xFFFFFFFF +#define SLC_SLC0_RXLINK_DSCR_BF0_M ((SLC_SLC0_RXLINK_DSCR_BF0_V)<<(SLC_SLC0_RXLINK_DSCR_BF0_S)) +#define SLC_SLC0_RXLINK_DSCR_BF0_V 0xFFFFFFFF +#define SLC_SLC0_RXLINK_DSCR_BF0_S 0 + +#define SLC_0_RXLINK_DSCR_BF1_REG (DR_REG_SLC_BASE + 0xB0) +/* SLC_SLC0_RXLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_SLC0_RXLINK_DSCR_BF1 0xFFFFFFFF +#define SLC_SLC0_RXLINK_DSCR_BF1_M ((SLC_SLC0_RXLINK_DSCR_BF1_V)<<(SLC_SLC0_RXLINK_DSCR_BF1_S)) +#define SLC_SLC0_RXLINK_DSCR_BF1_V 0xFFFFFFFF +#define SLC_SLC0_RXLINK_DSCR_BF1_S 0 + +#define SLC_0_TX_ERREOF_DES_ADDR_REG (DR_REG_SLC_BASE + 0xCC) +/* SLC_SLC0_TX_ERR_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_TX_ERR_EOF_DES_ADDR 0xFFFFFFFF +#define SLC_SLC0_TX_ERR_EOF_DES_ADDR_M ((SLC_SLC0_TX_ERR_EOF_DES_ADDR_V)<<(SLC_SLC0_TX_ERR_EOF_DES_ADDR_S)) +#define SLC_SLC0_TX_ERR_EOF_DES_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_TX_ERR_EOF_DES_ADDR_S 0 + +#define SLC_TOKEN_LAT_REG (DR_REG_SLC_BASE + 0xD4) +/* SLC_SLC0_TOKEN : RO ;bitpos:[11:0] ;default: 12'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN 0x00000FFF +#define SLC_SLC0_TOKEN_M ((SLC_SLC0_TOKEN_V)<<(SLC_SLC0_TOKEN_S)) +#define SLC_SLC0_TOKEN_V 0xFFF +#define SLC_SLC0_TOKEN_S 0 + +#define SLC_TX_DSCR_CONF_REG (DR_REG_SLC_BASE + 0xD8) +/* SLC_WR_RETRY_THRESHOLD : R/W ;bitpos:[10:0] ;default: 11'h80 ; */ +/*description: */ +#define SLC_WR_RETRY_THRESHOLD 0x000007FF +#define SLC_WR_RETRY_THRESHOLD_M ((SLC_WR_RETRY_THRESHOLD_V)<<(SLC_WR_RETRY_THRESHOLD_S)) +#define SLC_WR_RETRY_THRESHOLD_V 0x7FF +#define SLC_WR_RETRY_THRESHOLD_S 0 + +#define SLC_CMD_INFOR0_REG (DR_REG_SLC_BASE + 0xDC) +/* SLC_CMD_CONTENT0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_CMD_CONTENT0 0xFFFFFFFF +#define SLC_CMD_CONTENT0_M ((SLC_CMD_CONTENT0_V)<<(SLC_CMD_CONTENT0_S)) +#define SLC_CMD_CONTENT0_V 0xFFFFFFFF +#define SLC_CMD_CONTENT0_S 0 + +#define SLC_CMD_INFOR1_REG (DR_REG_SLC_BASE + 0xE0) +/* SLC_CMD_CONTENT1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_CMD_CONTENT1 0xFFFFFFFF +#define SLC_CMD_CONTENT1_M ((SLC_CMD_CONTENT1_V)<<(SLC_CMD_CONTENT1_S)) +#define SLC_CMD_CONTENT1_V 0xFFFFFFFF +#define SLC_CMD_CONTENT1_S 0 + +#define SLC_0_LEN_CONF_REG (DR_REG_SLC_BASE + 0xE4) +/* SLC_SLC0_TX_NEW_PKT_IND : RO ;bitpos:[28] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_NEW_PKT_IND (BIT(28)) +#define SLC_SLC0_TX_NEW_PKT_IND_M (BIT(28)) +#define SLC_SLC0_TX_NEW_PKT_IND_V 0x1 +#define SLC_SLC0_TX_NEW_PKT_IND_S 28 +/* SLC_SLC0_RX_NEW_PKT_IND : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_NEW_PKT_IND (BIT(27)) +#define SLC_SLC0_RX_NEW_PKT_IND_M (BIT(27)) +#define SLC_SLC0_RX_NEW_PKT_IND_V 0x1 +#define SLC_SLC0_RX_NEW_PKT_IND_S 27 +/* SLC_SLC0_TX_GET_USED_DSCR : WO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_GET_USED_DSCR (BIT(26)) +#define SLC_SLC0_TX_GET_USED_DSCR_M (BIT(26)) +#define SLC_SLC0_TX_GET_USED_DSCR_V 0x1 +#define SLC_SLC0_TX_GET_USED_DSCR_S 26 +/* SLC_SLC0_RX_GET_USED_DSCR : WO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_GET_USED_DSCR (BIT(25)) +#define SLC_SLC0_RX_GET_USED_DSCR_M (BIT(25)) +#define SLC_SLC0_RX_GET_USED_DSCR_V 0x1 +#define SLC_SLC0_RX_GET_USED_DSCR_S 25 +/* SLC_SLC0_TX_PACKET_LOAD_EN : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_PACKET_LOAD_EN (BIT(24)) +#define SLC_SLC0_TX_PACKET_LOAD_EN_M (BIT(24)) +#define SLC_SLC0_TX_PACKET_LOAD_EN_V 0x1 +#define SLC_SLC0_TX_PACKET_LOAD_EN_S 24 +/* SLC_SLC0_RX_PACKET_LOAD_EN : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_PACKET_LOAD_EN (BIT(23)) +#define SLC_SLC0_RX_PACKET_LOAD_EN_M (BIT(23)) +#define SLC_SLC0_RX_PACKET_LOAD_EN_V 0x1 +#define SLC_SLC0_RX_PACKET_LOAD_EN_S 23 +/* SLC_SLC0_LEN_INC_MORE : WO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_LEN_INC_MORE (BIT(22)) +#define SLC_SLC0_LEN_INC_MORE_M (BIT(22)) +#define SLC_SLC0_LEN_INC_MORE_V 0x1 +#define SLC_SLC0_LEN_INC_MORE_S 22 +/* SLC_SLC0_LEN_INC : WO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_LEN_INC (BIT(21)) +#define SLC_SLC0_LEN_INC_M (BIT(21)) +#define SLC_SLC0_LEN_INC_V 0x1 +#define SLC_SLC0_LEN_INC_S 21 +/* SLC_SLC0_LEN_WR : WO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_LEN_WR (BIT(20)) +#define SLC_SLC0_LEN_WR_M (BIT(20)) +#define SLC_SLC0_LEN_WR_V 0x1 +#define SLC_SLC0_LEN_WR_S 20 +/* SLC_SLC0_LEN_WDATA : WO ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define SLC_SLC0_LEN_WDATA 0x000FFFFF +#define SLC_SLC0_LEN_WDATA_M ((SLC_SLC0_LEN_WDATA_V)<<(SLC_SLC0_LEN_WDATA_S)) +#define SLC_SLC0_LEN_WDATA_V 0xFFFFF +#define SLC_SLC0_LEN_WDATA_S 0 + +#define SLC_0_LENGTH_REG (DR_REG_SLC_BASE + 0xE8) +/* SLC_SLC0_LEN : RO ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define SLC_SLC0_LEN 0x000FFFFF +#define SLC_SLC0_LEN_M ((SLC_SLC0_LEN_V)<<(SLC_SLC0_LEN_S)) +#define SLC_SLC0_LEN_V 0xFFFFF +#define SLC_SLC0_LEN_S 0 + +#define SLC_0_TXPKT_H_DSCR_REG (DR_REG_SLC_BASE + 0xEC) +/* SLC_SLC0_TX_PKT_H_DSCR_ADDR : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_TX_PKT_H_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_TX_PKT_H_DSCR_ADDR_M ((SLC_SLC0_TX_PKT_H_DSCR_ADDR_V)<<(SLC_SLC0_TX_PKT_H_DSCR_ADDR_S)) +#define SLC_SLC0_TX_PKT_H_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_TX_PKT_H_DSCR_ADDR_S 0 + +#define SLC_0_TXPKT_E_DSCR_REG (DR_REG_SLC_BASE + 0xF0) +/* SLC_SLC0_TX_PKT_E_DSCR_ADDR : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_TX_PKT_E_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_TX_PKT_E_DSCR_ADDR_M ((SLC_SLC0_TX_PKT_E_DSCR_ADDR_V)<<(SLC_SLC0_TX_PKT_E_DSCR_ADDR_S)) +#define SLC_SLC0_TX_PKT_E_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_TX_PKT_E_DSCR_ADDR_S 0 + +#define SLC_0_RXPKT_H_DSCR_REG (DR_REG_SLC_BASE + 0xF4) +/* SLC_SLC0_RX_PKT_H_DSCR_ADDR : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_RX_PKT_H_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_RX_PKT_H_DSCR_ADDR_M ((SLC_SLC0_RX_PKT_H_DSCR_ADDR_V)<<(SLC_SLC0_RX_PKT_H_DSCR_ADDR_S)) +#define SLC_SLC0_RX_PKT_H_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_RX_PKT_H_DSCR_ADDR_S 0 + +#define SLC_0_RXPKT_E_DSCR_REG (DR_REG_SLC_BASE + 0xF8) +/* SLC_SLC0_RX_PKT_E_DSCR_ADDR : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_RX_PKT_E_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_RX_PKT_E_DSCR_ADDR_M ((SLC_SLC0_RX_PKT_E_DSCR_ADDR_V)<<(SLC_SLC0_RX_PKT_E_DSCR_ADDR_S)) +#define SLC_SLC0_RX_PKT_E_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_RX_PKT_E_DSCR_ADDR_S 0 + +#define SLC_0_TXPKTU_H_DSCR_REG (DR_REG_SLC_BASE + 0xFC) +/* SLC_SLC0_TX_PKT_START_DSCR_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_TX_PKT_START_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_TX_PKT_START_DSCR_ADDR_M ((SLC_SLC0_TX_PKT_START_DSCR_ADDR_V)<<(SLC_SLC0_TX_PKT_START_DSCR_ADDR_S)) +#define SLC_SLC0_TX_PKT_START_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_TX_PKT_START_DSCR_ADDR_S 0 + +#define SLC_0_TXPKTU_E_DSCR_REG (DR_REG_SLC_BASE + 0x100) +/* SLC_SLC0_TX_PKT_END_DSCR_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_TX_PKT_END_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_TX_PKT_END_DSCR_ADDR_M ((SLC_SLC0_TX_PKT_END_DSCR_ADDR_V)<<(SLC_SLC0_TX_PKT_END_DSCR_ADDR_S)) +#define SLC_SLC0_TX_PKT_END_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_TX_PKT_END_DSCR_ADDR_S 0 + +#define SLC_0_RXPKTU_H_DSCR_REG (DR_REG_SLC_BASE + 0x104) +/* SLC_SLC0_RX_PKT_START_DSCR_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_RX_PKT_START_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_RX_PKT_START_DSCR_ADDR_M ((SLC_SLC0_RX_PKT_START_DSCR_ADDR_V)<<(SLC_SLC0_RX_PKT_START_DSCR_ADDR_S)) +#define SLC_SLC0_RX_PKT_START_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_RX_PKT_START_DSCR_ADDR_S 0 + +#define SLC_0_RXPKTU_E_DSCR_REG (DR_REG_SLC_BASE + 0x108) +/* SLC_SLC0_RX_PKT_END_DSCR_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SLC_SLC0_RX_PKT_END_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_RX_PKT_END_DSCR_ADDR_M ((SLC_SLC0_RX_PKT_END_DSCR_ADDR_V)<<(SLC_SLC0_RX_PKT_END_DSCR_ADDR_S)) +#define SLC_SLC0_RX_PKT_END_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_RX_PKT_END_DSCR_ADDR_S 0 + +#define SLC_SEQ_POSITION_REG (DR_REG_SLC_BASE + 0x114) +/* SLC_SLC0_SEQ_POSITION : R/W ;bitpos:[7:0] ;default: 8'h9 ; */ +/*description: */ +#define SLC_SLC0_SEQ_POSITION 0x000000FF +#define SLC_SLC0_SEQ_POSITION_M ((SLC_SLC0_SEQ_POSITION_V)<<(SLC_SLC0_SEQ_POSITION_S)) +#define SLC_SLC0_SEQ_POSITION_V 0xFF +#define SLC_SLC0_SEQ_POSITION_S 0 + +#define SLC_0_DSCR_REC_CONF_REG (DR_REG_SLC_BASE + 0x118) +/* SLC_SLC0_RX_DSCR_REC_LIM : R/W ;bitpos:[9:0] ;default: 10'h3ff ; */ +/*description: */ +#define SLC_SLC0_RX_DSCR_REC_LIM 0x000003FF +#define SLC_SLC0_RX_DSCR_REC_LIM_M ((SLC_SLC0_RX_DSCR_REC_LIM_V)<<(SLC_SLC0_RX_DSCR_REC_LIM_S)) +#define SLC_SLC0_RX_DSCR_REC_LIM_V 0x3FF +#define SLC_SLC0_RX_DSCR_REC_LIM_S 0 + +#define SLC_SDIO_CRC_ST0_REG (DR_REG_SLC_BASE + 0x11C) +/* SLC_DAT3_CRC_ERR_CNT : RO ;bitpos:[31:24] ;default: 8'h0 ; */ +/*description: */ +#define SLC_DAT3_CRC_ERR_CNT 0x000000FF +#define SLC_DAT3_CRC_ERR_CNT_M ((SLC_DAT3_CRC_ERR_CNT_V)<<(SLC_DAT3_CRC_ERR_CNT_S)) +#define SLC_DAT3_CRC_ERR_CNT_V 0xFF +#define SLC_DAT3_CRC_ERR_CNT_S 24 +/* SLC_DAT2_CRC_ERR_CNT : RO ;bitpos:[23:16] ;default: 8'h0 ; */ +/*description: */ +#define SLC_DAT2_CRC_ERR_CNT 0x000000FF +#define SLC_DAT2_CRC_ERR_CNT_M ((SLC_DAT2_CRC_ERR_CNT_V)<<(SLC_DAT2_CRC_ERR_CNT_S)) +#define SLC_DAT2_CRC_ERR_CNT_V 0xFF +#define SLC_DAT2_CRC_ERR_CNT_S 16 +/* SLC_DAT1_CRC_ERR_CNT : RO ;bitpos:[15:8] ;default: 8'h0 ; */ +/*description: */ +#define SLC_DAT1_CRC_ERR_CNT 0x000000FF +#define SLC_DAT1_CRC_ERR_CNT_M ((SLC_DAT1_CRC_ERR_CNT_V)<<(SLC_DAT1_CRC_ERR_CNT_S)) +#define SLC_DAT1_CRC_ERR_CNT_V 0xFF +#define SLC_DAT1_CRC_ERR_CNT_S 8 +/* SLC_DAT0_CRC_ERR_CNT : RO ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define SLC_DAT0_CRC_ERR_CNT 0x000000FF +#define SLC_DAT0_CRC_ERR_CNT_M ((SLC_DAT0_CRC_ERR_CNT_V)<<(SLC_DAT0_CRC_ERR_CNT_S)) +#define SLC_DAT0_CRC_ERR_CNT_V 0xFF +#define SLC_DAT0_CRC_ERR_CNT_S 0 + +#define SLC_SDIO_CRC_ST1_REG (DR_REG_SLC_BASE + 0x120) +/* SLC_ERR_CNT_CLR : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define SLC_ERR_CNT_CLR (BIT(31)) +#define SLC_ERR_CNT_CLR_M (BIT(31)) +#define SLC_ERR_CNT_CLR_V 0x1 +#define SLC_ERR_CNT_CLR_S 31 +/* SLC_CMD_CRC_ERR_CNT : RO ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define SLC_CMD_CRC_ERR_CNT 0x000000FF +#define SLC_CMD_CRC_ERR_CNT_M ((SLC_CMD_CRC_ERR_CNT_V)<<(SLC_CMD_CRC_ERR_CNT_S)) +#define SLC_CMD_CRC_ERR_CNT_V 0xFF +#define SLC_CMD_CRC_ERR_CNT_S 0 + +#define SLC_0_EOF_START_DES_REG (DR_REG_SLC_BASE + 0x124) +/* SLC_SLC0_EOF_START_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_SLC0_EOF_START_DES_ADDR 0xFFFFFFFF +#define SLC_SLC0_EOF_START_DES_ADDR_M ((SLC_SLC0_EOF_START_DES_ADDR_V)<<(SLC_SLC0_EOF_START_DES_ADDR_S)) +#define SLC_SLC0_EOF_START_DES_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_EOF_START_DES_ADDR_S 0 + +#define SLC_0_PUSH_DSCR_ADDR_REG (DR_REG_SLC_BASE + 0x128) +/* SLC_SLC0_RX_PUSH_DSCR_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_PUSH_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_RX_PUSH_DSCR_ADDR_M ((SLC_SLC0_RX_PUSH_DSCR_ADDR_V)<<(SLC_SLC0_RX_PUSH_DSCR_ADDR_S)) +#define SLC_SLC0_RX_PUSH_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_RX_PUSH_DSCR_ADDR_S 0 + +#define SLC_0_DONE_DSCR_ADDR_REG (DR_REG_SLC_BASE + 0x12C) +/* SLC_SLC0_RX_DONE_DSCR_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DONE_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_RX_DONE_DSCR_ADDR_M ((SLC_SLC0_RX_DONE_DSCR_ADDR_V)<<(SLC_SLC0_RX_DONE_DSCR_ADDR_S)) +#define SLC_SLC0_RX_DONE_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_RX_DONE_DSCR_ADDR_S 0 + +#define SLC_0_SUB_START_DES_REG (DR_REG_SLC_BASE + 0x130) +/* SLC_SLC0_SUB_PAC_START_DSCR_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define SLC_SLC0_SUB_PAC_START_DSCR_ADDR 0xFFFFFFFF +#define SLC_SLC0_SUB_PAC_START_DSCR_ADDR_M ((SLC_SLC0_SUB_PAC_START_DSCR_ADDR_V)<<(SLC_SLC0_SUB_PAC_START_DSCR_ADDR_S)) +#define SLC_SLC0_SUB_PAC_START_DSCR_ADDR_V 0xFFFFFFFF +#define SLC_SLC0_SUB_PAC_START_DSCR_ADDR_S 0 + +#define SLC_0_DSCR_CNT_REG (DR_REG_SLC_BASE + 0x134) +/* SLC_SLC0_RX_GET_EOF_OCC : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_GET_EOF_OCC (BIT(16)) +#define SLC_SLC0_RX_GET_EOF_OCC_M (BIT(16)) +#define SLC_SLC0_RX_GET_EOF_OCC_V 0x1 +#define SLC_SLC0_RX_GET_EOF_OCC_S 16 +/* SLC_SLC0_RX_DSCR_CNT_LAT : RO ;bitpos:[9:0] ;default: 10'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DSCR_CNT_LAT 0x000003FF +#define SLC_SLC0_RX_DSCR_CNT_LAT_M ((SLC_SLC0_RX_DSCR_CNT_LAT_V)<<(SLC_SLC0_RX_DSCR_CNT_LAT_S)) +#define SLC_SLC0_RX_DSCR_CNT_LAT_V 0x3FF +#define SLC_SLC0_RX_DSCR_CNT_LAT_S 0 + +#define SLC_0_LEN_LIM_CONF_REG (DR_REG_SLC_BASE + 0x138) +/* SLC_SLC0_LEN_LIM : R/W ;bitpos:[19:0] ;default: 20'h5400 ; */ +/*description: */ +#define SLC_SLC0_LEN_LIM 0x000FFFFF +#define SLC_SLC0_LEN_LIM_M ((SLC_SLC0_LEN_LIM_V)<<(SLC_SLC0_LEN_LIM_S)) +#define SLC_SLC0_LEN_LIM_V 0xFFFFF +#define SLC_SLC0_LEN_LIM_S 0 + +#define SLC_0INT_ST1_REG (DR_REG_SLC_BASE + 0x13C) +/* SLC_SLC0_HOST_POP_EOF_ERR_INT_ST1 : RO ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ST1 (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ST1_M (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ST1_V 0x1 +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ST1_S 27 +/* SLC_SLC0_RX_QUICK_EOF_INT_ST1 : RO ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_QUICK_EOF_INT_ST1 (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_ST1_M (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_ST1_V 0x1 +#define SLC_SLC0_RX_QUICK_EOF_INT_ST1_S 26 +/* SLC_CMD_DTC_INT_ST1 : RO ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define SLC_CMD_DTC_INT_ST1 (BIT(25)) +#define SLC_CMD_DTC_INT_ST1_M (BIT(25)) +#define SLC_CMD_DTC_INT_ST1_V 0x1 +#define SLC_CMD_DTC_INT_ST1_S 25 +/* SLC_SLC0_TX_ERR_EOF_INT_ST1 : RO ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_ERR_EOF_INT_ST1 (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_ST1_M (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_ST1_V 0x1 +#define SLC_SLC0_TX_ERR_EOF_INT_ST1_S 24 +/* SLC_SLC0_WR_RETRY_DONE_INT_ST1 : RO ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_WR_RETRY_DONE_INT_ST1 (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_ST1_M (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_ST1_V 0x1 +#define SLC_SLC0_WR_RETRY_DONE_INT_ST1_S 23 +/* SLC_SLC0_HOST_RD_ACK_INT_ST1 : RO ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_RD_ACK_INT_ST1 (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_ST1_M (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_ST1_V 0x1 +#define SLC_SLC0_HOST_RD_ACK_INT_ST1_S 22 +/* SLC_SLC0_TX_DSCR_EMPTY_INT_ST1 : RO ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ST1 (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ST1_M (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ST1_V 0x1 +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ST1_S 21 +/* SLC_SLC0_RX_DSCR_ERR_INT_ST1 : RO ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DSCR_ERR_INT_ST1 (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_ST1_M (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_ST1_V 0x1 +#define SLC_SLC0_RX_DSCR_ERR_INT_ST1_S 20 +/* SLC_SLC0_TX_DSCR_ERR_INT_ST1 : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_ERR_INT_ST1 (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_ST1_M (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_ST1_V 0x1 +#define SLC_SLC0_TX_DSCR_ERR_INT_ST1_S 19 +/* SLC_SLC0_TOHOST_INT_ST1 : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOHOST_INT_ST1 (BIT(18)) +#define SLC_SLC0_TOHOST_INT_ST1_M (BIT(18)) +#define SLC_SLC0_TOHOST_INT_ST1_V 0x1 +#define SLC_SLC0_TOHOST_INT_ST1_S 18 +/* SLC_SLC0_RX_EOF_INT_ST1 : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_EOF_INT_ST1 (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_ST1_M (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_ST1_V 0x1 +#define SLC_SLC0_RX_EOF_INT_ST1_S 17 +/* SLC_SLC0_RX_DONE_INT_ST1 : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DONE_INT_ST1 (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_ST1_M (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_ST1_V 0x1 +#define SLC_SLC0_RX_DONE_INT_ST1_S 16 +/* SLC_SLC0_TX_SUC_EOF_INT_ST1 : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_SUC_EOF_INT_ST1 (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_ST1_M (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_ST1_V 0x1 +#define SLC_SLC0_TX_SUC_EOF_INT_ST1_S 15 +/* SLC_SLC0_TX_DONE_INT_ST1 : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DONE_INT_ST1 (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_ST1_M (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_ST1_V 0x1 +#define SLC_SLC0_TX_DONE_INT_ST1_S 14 +/* SLC_SLC0_TOKEN1_1TO0_INT_ST1 : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1_1TO0_INT_ST1 (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_ST1_M (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_ST1_V 0x1 +#define SLC_SLC0_TOKEN1_1TO0_INT_ST1_S 13 +/* SLC_SLC0_TOKEN0_1TO0_INT_ST1 : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0_1TO0_INT_ST1 (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_ST1_M (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_ST1_V 0x1 +#define SLC_SLC0_TOKEN0_1TO0_INT_ST1_S 12 +/* SLC_SLC0_TX_OVF_INT_ST1 : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_OVF_INT_ST1 (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_ST1_M (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_ST1_V 0x1 +#define SLC_SLC0_TX_OVF_INT_ST1_S 11 +/* SLC_SLC0_RX_UDF_INT_ST1 : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_UDF_INT_ST1 (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_ST1_M (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_ST1_V 0x1 +#define SLC_SLC0_RX_UDF_INT_ST1_S 10 +/* SLC_SLC0_TX_START_INT_ST1 : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_START_INT_ST1 (BIT(9)) +#define SLC_SLC0_TX_START_INT_ST1_M (BIT(9)) +#define SLC_SLC0_TX_START_INT_ST1_V 0x1 +#define SLC_SLC0_TX_START_INT_ST1_S 9 +/* SLC_SLC0_RX_START_INT_ST1 : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_START_INT_ST1 (BIT(8)) +#define SLC_SLC0_RX_START_INT_ST1_M (BIT(8)) +#define SLC_SLC0_RX_START_INT_ST1_V 0x1 +#define SLC_SLC0_RX_START_INT_ST1_S 8 +/* SLC_FRHOST_BIT7_INT_ST1 : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT7_INT_ST1 (BIT(7)) +#define SLC_FRHOST_BIT7_INT_ST1_M (BIT(7)) +#define SLC_FRHOST_BIT7_INT_ST1_V 0x1 +#define SLC_FRHOST_BIT7_INT_ST1_S 7 +/* SLC_FRHOST_BIT6_INT_ST1 : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT6_INT_ST1 (BIT(6)) +#define SLC_FRHOST_BIT6_INT_ST1_M (BIT(6)) +#define SLC_FRHOST_BIT6_INT_ST1_V 0x1 +#define SLC_FRHOST_BIT6_INT_ST1_S 6 +/* SLC_FRHOST_BIT5_INT_ST1 : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT5_INT_ST1 (BIT(5)) +#define SLC_FRHOST_BIT5_INT_ST1_M (BIT(5)) +#define SLC_FRHOST_BIT5_INT_ST1_V 0x1 +#define SLC_FRHOST_BIT5_INT_ST1_S 5 +/* SLC_FRHOST_BIT4_INT_ST1 : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT4_INT_ST1 (BIT(4)) +#define SLC_FRHOST_BIT4_INT_ST1_M (BIT(4)) +#define SLC_FRHOST_BIT4_INT_ST1_V 0x1 +#define SLC_FRHOST_BIT4_INT_ST1_S 4 +/* SLC_FRHOST_BIT3_INT_ST1 : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT3_INT_ST1 (BIT(3)) +#define SLC_FRHOST_BIT3_INT_ST1_M (BIT(3)) +#define SLC_FRHOST_BIT3_INT_ST1_V 0x1 +#define SLC_FRHOST_BIT3_INT_ST1_S 3 +/* SLC_FRHOST_BIT2_INT_ST1 : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT2_INT_ST1 (BIT(2)) +#define SLC_FRHOST_BIT2_INT_ST1_M (BIT(2)) +#define SLC_FRHOST_BIT2_INT_ST1_V 0x1 +#define SLC_FRHOST_BIT2_INT_ST1_S 2 +/* SLC_FRHOST_BIT1_INT_ST1 : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT1_INT_ST1 (BIT(1)) +#define SLC_FRHOST_BIT1_INT_ST1_M (BIT(1)) +#define SLC_FRHOST_BIT1_INT_ST1_V 0x1 +#define SLC_FRHOST_BIT1_INT_ST1_S 1 +/* SLC_FRHOST_BIT0_INT_ST1 : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT0_INT_ST1 (BIT(0)) +#define SLC_FRHOST_BIT0_INT_ST1_M (BIT(0)) +#define SLC_FRHOST_BIT0_INT_ST1_V 0x1 +#define SLC_FRHOST_BIT0_INT_ST1_S 0 + +#define SLC_0INT_ENA1_REG (DR_REG_SLC_BASE + 0x140) +/* SLC_SLC0_HOST_POP_EOF_ERR_INT_ENA1 : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ENA1 (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ENA1_M (BIT(27)) +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ENA1_V 0x1 +#define SLC_SLC0_HOST_POP_EOF_ERR_INT_ENA1_S 27 +/* SLC_SLC0_RX_QUICK_EOF_INT_ENA1 : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_QUICK_EOF_INT_ENA1 (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_ENA1_M (BIT(26)) +#define SLC_SLC0_RX_QUICK_EOF_INT_ENA1_V 0x1 +#define SLC_SLC0_RX_QUICK_EOF_INT_ENA1_S 26 +/* SLC_CMD_DTC_INT_ENA1 : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define SLC_CMD_DTC_INT_ENA1 (BIT(25)) +#define SLC_CMD_DTC_INT_ENA1_M (BIT(25)) +#define SLC_CMD_DTC_INT_ENA1_V 0x1 +#define SLC_CMD_DTC_INT_ENA1_S 25 +/* SLC_SLC0_TX_ERR_EOF_INT_ENA1 : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_ERR_EOF_INT_ENA1 (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_ENA1_M (BIT(24)) +#define SLC_SLC0_TX_ERR_EOF_INT_ENA1_V 0x1 +#define SLC_SLC0_TX_ERR_EOF_INT_ENA1_S 24 +/* SLC_SLC0_WR_RETRY_DONE_INT_ENA1 : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_WR_RETRY_DONE_INT_ENA1 (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_ENA1_M (BIT(23)) +#define SLC_SLC0_WR_RETRY_DONE_INT_ENA1_V 0x1 +#define SLC_SLC0_WR_RETRY_DONE_INT_ENA1_S 23 +/* SLC_SLC0_HOST_RD_ACK_INT_ENA1 : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_HOST_RD_ACK_INT_ENA1 (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_ENA1_M (BIT(22)) +#define SLC_SLC0_HOST_RD_ACK_INT_ENA1_V 0x1 +#define SLC_SLC0_HOST_RD_ACK_INT_ENA1_S 22 +/* SLC_SLC0_TX_DSCR_EMPTY_INT_ENA1 : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ENA1 (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ENA1_M (BIT(21)) +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ENA1_V 0x1 +#define SLC_SLC0_TX_DSCR_EMPTY_INT_ENA1_S 21 +/* SLC_SLC0_RX_DSCR_ERR_INT_ENA1 : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DSCR_ERR_INT_ENA1 (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_ENA1_M (BIT(20)) +#define SLC_SLC0_RX_DSCR_ERR_INT_ENA1_V 0x1 +#define SLC_SLC0_RX_DSCR_ERR_INT_ENA1_S 20 +/* SLC_SLC0_TX_DSCR_ERR_INT_ENA1 : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DSCR_ERR_INT_ENA1 (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_ENA1_M (BIT(19)) +#define SLC_SLC0_TX_DSCR_ERR_INT_ENA1_V 0x1 +#define SLC_SLC0_TX_DSCR_ERR_INT_ENA1_S 19 +/* SLC_SLC0_TOHOST_INT_ENA1 : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOHOST_INT_ENA1 (BIT(18)) +#define SLC_SLC0_TOHOST_INT_ENA1_M (BIT(18)) +#define SLC_SLC0_TOHOST_INT_ENA1_V 0x1 +#define SLC_SLC0_TOHOST_INT_ENA1_S 18 +/* SLC_SLC0_RX_EOF_INT_ENA1 : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_EOF_INT_ENA1 (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_ENA1_M (BIT(17)) +#define SLC_SLC0_RX_EOF_INT_ENA1_V 0x1 +#define SLC_SLC0_RX_EOF_INT_ENA1_S 17 +/* SLC_SLC0_RX_DONE_INT_ENA1 : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_DONE_INT_ENA1 (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_ENA1_M (BIT(16)) +#define SLC_SLC0_RX_DONE_INT_ENA1_V 0x1 +#define SLC_SLC0_RX_DONE_INT_ENA1_S 16 +/* SLC_SLC0_TX_SUC_EOF_INT_ENA1 : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_SUC_EOF_INT_ENA1 (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_ENA1_M (BIT(15)) +#define SLC_SLC0_TX_SUC_EOF_INT_ENA1_V 0x1 +#define SLC_SLC0_TX_SUC_EOF_INT_ENA1_S 15 +/* SLC_SLC0_TX_DONE_INT_ENA1 : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_DONE_INT_ENA1 (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_ENA1_M (BIT(14)) +#define SLC_SLC0_TX_DONE_INT_ENA1_V 0x1 +#define SLC_SLC0_TX_DONE_INT_ENA1_S 14 +/* SLC_SLC0_TOKEN1_1TO0_INT_ENA1 : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN1_1TO0_INT_ENA1 (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_ENA1_M (BIT(13)) +#define SLC_SLC0_TOKEN1_1TO0_INT_ENA1_V 0x1 +#define SLC_SLC0_TOKEN1_1TO0_INT_ENA1_S 13 +/* SLC_SLC0_TOKEN0_1TO0_INT_ENA1 : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TOKEN0_1TO0_INT_ENA1 (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_ENA1_M (BIT(12)) +#define SLC_SLC0_TOKEN0_1TO0_INT_ENA1_V 0x1 +#define SLC_SLC0_TOKEN0_1TO0_INT_ENA1_S 12 +/* SLC_SLC0_TX_OVF_INT_ENA1 : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_OVF_INT_ENA1 (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_ENA1_M (BIT(11)) +#define SLC_SLC0_TX_OVF_INT_ENA1_V 0x1 +#define SLC_SLC0_TX_OVF_INT_ENA1_S 11 +/* SLC_SLC0_RX_UDF_INT_ENA1 : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_UDF_INT_ENA1 (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_ENA1_M (BIT(10)) +#define SLC_SLC0_RX_UDF_INT_ENA1_V 0x1 +#define SLC_SLC0_RX_UDF_INT_ENA1_S 10 +/* SLC_SLC0_TX_START_INT_ENA1 : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_TX_START_INT_ENA1 (BIT(9)) +#define SLC_SLC0_TX_START_INT_ENA1_M (BIT(9)) +#define SLC_SLC0_TX_START_INT_ENA1_V 0x1 +#define SLC_SLC0_TX_START_INT_ENA1_S 9 +/* SLC_SLC0_RX_START_INT_ENA1 : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SLC_SLC0_RX_START_INT_ENA1 (BIT(8)) +#define SLC_SLC0_RX_START_INT_ENA1_M (BIT(8)) +#define SLC_SLC0_RX_START_INT_ENA1_V 0x1 +#define SLC_SLC0_RX_START_INT_ENA1_S 8 +/* SLC_FRHOST_BIT7_INT_ENA1 : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT7_INT_ENA1 (BIT(7)) +#define SLC_FRHOST_BIT7_INT_ENA1_M (BIT(7)) +#define SLC_FRHOST_BIT7_INT_ENA1_V 0x1 +#define SLC_FRHOST_BIT7_INT_ENA1_S 7 +/* SLC_FRHOST_BIT6_INT_ENA1 : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT6_INT_ENA1 (BIT(6)) +#define SLC_FRHOST_BIT6_INT_ENA1_M (BIT(6)) +#define SLC_FRHOST_BIT6_INT_ENA1_V 0x1 +#define SLC_FRHOST_BIT6_INT_ENA1_S 6 +/* SLC_FRHOST_BIT5_INT_ENA1 : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT5_INT_ENA1 (BIT(5)) +#define SLC_FRHOST_BIT5_INT_ENA1_M (BIT(5)) +#define SLC_FRHOST_BIT5_INT_ENA1_V 0x1 +#define SLC_FRHOST_BIT5_INT_ENA1_S 5 +/* SLC_FRHOST_BIT4_INT_ENA1 : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT4_INT_ENA1 (BIT(4)) +#define SLC_FRHOST_BIT4_INT_ENA1_M (BIT(4)) +#define SLC_FRHOST_BIT4_INT_ENA1_V 0x1 +#define SLC_FRHOST_BIT4_INT_ENA1_S 4 +/* SLC_FRHOST_BIT3_INT_ENA1 : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT3_INT_ENA1 (BIT(3)) +#define SLC_FRHOST_BIT3_INT_ENA1_M (BIT(3)) +#define SLC_FRHOST_BIT3_INT_ENA1_V 0x1 +#define SLC_FRHOST_BIT3_INT_ENA1_S 3 +/* SLC_FRHOST_BIT2_INT_ENA1 : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT2_INT_ENA1 (BIT(2)) +#define SLC_FRHOST_BIT2_INT_ENA1_M (BIT(2)) +#define SLC_FRHOST_BIT2_INT_ENA1_V 0x1 +#define SLC_FRHOST_BIT2_INT_ENA1_S 2 +/* SLC_FRHOST_BIT1_INT_ENA1 : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT1_INT_ENA1 (BIT(1)) +#define SLC_FRHOST_BIT1_INT_ENA1_M (BIT(1)) +#define SLC_FRHOST_BIT1_INT_ENA1_V 0x1 +#define SLC_FRHOST_BIT1_INT_ENA1_S 1 +/* SLC_FRHOST_BIT0_INT_ENA1 : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SLC_FRHOST_BIT0_INT_ENA1 (BIT(0)) +#define SLC_FRHOST_BIT0_INT_ENA1_M (BIT(0)) +#define SLC_FRHOST_BIT0_INT_ENA1_V 0x1 +#define SLC_FRHOST_BIT0_INT_ENA1_S 0 + +#define SLC_DATE_REG (DR_REG_SLC_BASE + 0x1F8) +/* SLC_DATE : R/W ;bitpos:[31:0] ;default: 32'h18080700 ; */ +/*description: */ +#define SLC_DATE 0xFFFFFFFF +#define SLC_DATE_M ((SLC_DATE_V)<<(SLC_DATE_S)) +#define SLC_DATE_V 0xFFFFFFFF +#define SLC_DATE_S 0 + +#define SLC_ID_REG (DR_REG_SLC_BASE + 0x1FC) +/* SLC_ID : R/W ;bitpos:[31:0] ;default: 32'h0100 ; */ +/*description: */ +#define SLC_ID 0xFFFFFFFF +#define SLC_ID_M ((SLC_ID_V)<<(SLC_ID_S)) +#define SLC_ID_V 0xFFFFFFFF +#define SLC_ID_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_SLC_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/slc_struct.h b/components/soc/esp32s2beta/include/soc/slc_struct.h new file mode 100644 index 0000000000..74cb22c37d --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/slc_struct.h @@ -0,0 +1,588 @@ +// Copyright 2017-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_SLC_STRUCT_H_ +#define _SOC_SLC_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t slc0_tx_rst: 1; + uint32_t slc0_rx_rst: 1; + uint32_t ahbm_fifo_rst: 1; + uint32_t ahbm_rst: 1; + uint32_t slc0_tx_loop_test: 1; + uint32_t slc0_rx_loop_test: 1; + uint32_t slc0_rx_auto_wrback: 1; + uint32_t slc0_rx_no_restart_clr: 1; + uint32_t slc0_rxdscr_burst_en: 1; + uint32_t slc0_rxdata_burst_en: 1; + uint32_t slc0_rxlink_auto_ret: 1; + uint32_t slc0_txlink_auto_ret: 1; + uint32_t slc0_txdscr_burst_en: 1; + uint32_t slc0_txdata_burst_en: 1; + uint32_t slc0_token_auto_clr: 1; + uint32_t slc0_token_sel: 1; + uint32_t reserved16: 2; + uint32_t slc0_wr_retry_mask_en: 1; + uint32_t reserved19: 13; + }; + uint32_t val; + } conf0; + union { + struct { + uint32_t frhost_bit0: 1; + uint32_t frhost_bit1: 1; + uint32_t frhost_bit2: 1; + uint32_t frhost_bit3: 1; + uint32_t frhost_bit4: 1; + uint32_t frhost_bit5: 1; + uint32_t frhost_bit6: 1; + uint32_t frhost_bit7: 1; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_udf: 1; + uint32_t tx_ovf: 1; + uint32_t token0_1to0: 1; + uint32_t token1_1to0: 1; + uint32_t tx_done: 1; + uint32_t tx_suc_eof: 1; + uint32_t rx_done: 1; + uint32_t rx_eof: 1; + uint32_t tohost: 1; + uint32_t tx_dscr_err: 1; + uint32_t rx_dscr_err: 1; + uint32_t tx_dscr_empty: 1; + uint32_t host_rd_ack: 1; + uint32_t wr_retry_done: 1; + uint32_t tx_err_eof: 1; + uint32_t cmd_dtc: 1; + uint32_t rx_quick_eof: 1; + uint32_t host_pop_eof_err: 1; + uint32_t reserved28: 4; + }; + uint32_t val; + } slc0_int_raw; + union { + struct { + uint32_t frhost_bit0: 1; + uint32_t frhost_bit1: 1; + uint32_t frhost_bit2: 1; + uint32_t frhost_bit3: 1; + uint32_t frhost_bit4: 1; + uint32_t frhost_bit5: 1; + uint32_t frhost_bit6: 1; + uint32_t frhost_bit7: 1; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_udf: 1; + uint32_t tx_ovf: 1; + uint32_t token0_1to0: 1; + uint32_t token1_1to0: 1; + uint32_t tx_done: 1; + uint32_t tx_suc_eof: 1; + uint32_t rx_done: 1; + uint32_t rx_eof: 1; + uint32_t tohost: 1; + uint32_t tx_dscr_err: 1; + uint32_t rx_dscr_err: 1; + uint32_t tx_dscr_empty: 1; + uint32_t host_rd_ack: 1; + uint32_t wr_retry_done: 1; + uint32_t tx_err_eof: 1; + uint32_t cmd_dtc: 1; + uint32_t rx_quick_eof: 1; + uint32_t host_pop_eof_err: 1; + uint32_t reserved28: 4; + }; + uint32_t val; + } slc0_int_st; + union { + struct { + uint32_t frhost_bit0: 1; + uint32_t frhost_bit1: 1; + uint32_t frhost_bit2: 1; + uint32_t frhost_bit3: 1; + uint32_t frhost_bit4: 1; + uint32_t frhost_bit5: 1; + uint32_t frhost_bit6: 1; + uint32_t frhost_bit7: 1; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_udf: 1; + uint32_t tx_ovf: 1; + uint32_t token0_1to0: 1; + uint32_t token1_1to0: 1; + uint32_t tx_done: 1; + uint32_t tx_suc_eof: 1; + uint32_t rx_done: 1; + uint32_t rx_eof: 1; + uint32_t tohost: 1; + uint32_t tx_dscr_err: 1; + uint32_t rx_dscr_err: 1; + uint32_t tx_dscr_empty: 1; + uint32_t host_rd_ack: 1; + uint32_t wr_retry_done: 1; + uint32_t tx_err_eof: 1; + uint32_t cmd_dtc: 1; + uint32_t rx_quick_eof: 1; + uint32_t host_pop_eof_err: 1; + uint32_t reserved28: 4; + }; + uint32_t val; + } slc0_int_ena; + union { + struct { + uint32_t frhost_bit0: 1; + uint32_t frhost_bit1: 1; + uint32_t frhost_bit2: 1; + uint32_t frhost_bit3: 1; + uint32_t frhost_bit4: 1; + uint32_t frhost_bit5: 1; + uint32_t frhost_bit6: 1; + uint32_t frhost_bit7: 1; + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_udf: 1; + uint32_t tx_ovf: 1; + uint32_t token0_1to0: 1; + uint32_t token1_1to0: 1; + uint32_t tx_done: 1; + uint32_t tx_suc_eof: 1; + uint32_t rx_done: 1; + uint32_t rx_eof: 1; + uint32_t tohost: 1; + uint32_t tx_dscr_err: 1; + uint32_t rx_dscr_err: 1; + uint32_t tx_dscr_empty: 1; + uint32_t host_rd_ack: 1; + uint32_t wr_retry_done: 1; + uint32_t tx_err_eof: 1; + uint32_t cmd_dtc: 1; + uint32_t rx_quick_eof: 1; + uint32_t host_pop_eof_err: 1; + uint32_t reserved28: 4; + }; + uint32_t val; + } slc0_int_clr; + uint32_t reserved_14; + uint32_t reserved_18; + uint32_t reserved_1c; + uint32_t reserved_20; + union { + struct { + uint32_t slc0_rx_full: 1; + uint32_t slc0_rx_empty: 1; + uint32_t slc0_rx_buf_len:12; + uint32_t reserved14: 18; + }; + uint32_t val; + } rx_status; + union { + struct { + uint32_t rxfifo_wdata: 9; + uint32_t reserved9: 7; + uint32_t rxfifo_push: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } slc0_rxfifo_push; + uint32_t reserved_2c; + union { + struct { + uint32_t slc0_tx_full: 1; + uint32_t slc0_tx_empty: 1; + uint32_t reserved2: 30; + }; + uint32_t val; + } tx_status; + union { + struct { + uint32_t txfifo_rdata: 11; + uint32_t reserved11: 5; + uint32_t txfifo_pop: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } slc0_txfifo_pop; + uint32_t reserved_38; + union { + struct { + uint32_t addr: 20; + uint32_t reserved20: 8; + uint32_t stop: 1; + uint32_t start: 1; + uint32_t restart: 1; + uint32_t park: 1; + }; + uint32_t val; + } slc0_rx_link; + union { + struct { + uint32_t addr: 20; + uint32_t reserved20: 8; + uint32_t stop: 1; + uint32_t start: 1; + uint32_t restart: 1; + uint32_t park: 1; + }; + uint32_t val; + } slc0_tx_link; + uint32_t reserved_44; + uint32_t reserved_48; + union { + struct { + uint32_t slc0_intvec: 8; + uint32_t reserved8: 24; + }; + uint32_t val; + } intvec_tohost; + union { + struct { + uint32_t wdata: 12; + uint32_t wr: 1; + uint32_t inc: 1; + uint32_t inc_more: 1; + uint32_t reserved15: 1; + uint32_t token0: 12; + uint32_t reserved28: 4; + }; + uint32_t val; + } slc0_token0; + union { + struct { + uint32_t wdata: 12; + uint32_t wr: 1; + uint32_t inc: 1; + uint32_t inc_more: 1; + uint32_t reserved15: 1; + uint32_t token1: 12; + uint32_t reserved28: 4; + }; + uint32_t val; + } slc0_token1; + uint32_t reserved_58; + uint32_t reserved_5c; + union { + struct { + uint32_t slc0_check_owner: 1; + uint32_t slc0_tx_check_sum_en: 1; + uint32_t slc0_rx_check_sum_en: 1; + uint32_t cmd_hold_en: 1; + uint32_t slc0_len_auto_clr: 1; + uint32_t slc0_tx_stitch_en: 1; + uint32_t slc0_rx_stitch_en: 1; + uint32_t reserved7: 12; + uint32_t host_int_level_sel: 1; + uint32_t reserved20: 2; + uint32_t clk_en: 1; + uint32_t reserved23: 9; + }; + uint32_t val; + } conf1; + uint32_t slc0_state0; /**/ + uint32_t slc0_state1; /**/ + uint32_t reserved_6c; + uint32_t reserved_70; + union { + struct { + uint32_t txeof_ena: 6; + uint32_t reserved6: 2; + uint32_t fifo_map_ena: 4; + uint32_t slc0_tx_dummy_mode: 1; + uint32_t hda_map_128k: 1; + uint32_t reserved14: 2; + uint32_t tx_push_idle_num: 16; + }; + uint32_t val; + } bridge_conf; + uint32_t slc0_to_eof_des_addr; /**/ + uint32_t slc0_tx_eof_des_addr; /**/ + uint32_t slc0_to_eof_bfr_des_addr; /**/ + uint32_t reserved_84; + uint32_t reserved_88; + uint32_t reserved_8c; + union { + struct { + uint32_t mode: 3; + uint32_t reserved3: 1; + uint32_t addr: 2; + uint32_t reserved6: 26; + }; + uint32_t val; + } ahb_test; + union { + struct { + uint32_t cmd_st: 3; + uint32_t reserved3: 1; + uint32_t func_st: 4; + uint32_t sdio_wakeup: 1; + uint32_t reserved9: 3; + uint32_t bus_st: 3; + uint32_t reserved15: 1; + uint32_t func1_acc_state: 5; + uint32_t reserved21: 11; + }; + uint32_t val; + } sdio_st; + union { + struct { + uint32_t slc0_token_no_replace: 1; + uint32_t slc0_infor_no_replace: 1; + uint32_t slc0_rx_fill_mode: 1; + uint32_t slc0_rx_eof_mode: 1; + uint32_t slc0_rx_fill_en: 1; + uint32_t slc0_rd_retry_threshold:11; + uint32_t reserved16: 16; + }; + uint32_t val; + } rx_dscr_conf; + uint32_t slc0_txlink_dscr; /**/ + uint32_t slc0_txlink_dscr_bf0; /**/ + uint32_t slc0_txlink_dscr_bf1; /**/ + uint32_t slc0_rxlink_dscr; /**/ + uint32_t slc0_rxlink_dscr_bf0; /**/ + uint32_t slc0_rxlink_dscr_bf1; /**/ + uint32_t reserved_b4; + uint32_t reserved_b8; + uint32_t reserved_bc; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t slc0_tx_erreof_des_addr; /**/ + uint32_t reserved_d0; + union { + struct { + uint32_t slc0_token:12; + uint32_t reserved12:20; + }; + uint32_t val; + } token_lat; + union { + struct { + uint32_t wr_retry_threshold:11; + uint32_t reserved11: 21; + }; + uint32_t val; + } tx_dscr_conf; + uint32_t cmd_infor0; /**/ + uint32_t cmd_infor1; /**/ + union { + struct { + uint32_t len_wdata: 20; + uint32_t len_wr: 1; + uint32_t len_inc: 1; + uint32_t len_inc_more: 1; + uint32_t rx_packet_load_en: 1; + uint32_t tx_packet_load_en: 1; + uint32_t rx_get_used_dscr: 1; + uint32_t tx_get_used_dscr: 1; + uint32_t rx_new_pkt_ind: 1; + uint32_t tx_new_pkt_ind: 1; + uint32_t reserved29: 3; + }; + uint32_t val; + } slc0_len_conf; + union { + struct { + uint32_t len: 20; + uint32_t reserved20:12; + }; + uint32_t val; + } slc0_length; + uint32_t slc0_txpkt_h_dscr; /**/ + uint32_t slc0_txpkt_e_dscr; /**/ + uint32_t slc0_rxpkt_h_dscr; /**/ + uint32_t slc0_rxpkt_e_dscr; /**/ + uint32_t slc0_txpktu_h_dscr; /**/ + uint32_t slc0_txpktu_e_dscr; /**/ + uint32_t slc0_rxpktu_h_dscr; /**/ + uint32_t slc0_rxpktu_e_dscr; /**/ + uint32_t reserved_10c; + uint32_t reserved_110; + union { + struct { + uint32_t slc0_position: 8; + uint32_t reserved8: 24; + }; + uint32_t val; + } seq_position; + union { + struct { + uint32_t rx_dscr_rec_lim: 10; + uint32_t reserved10: 22; + }; + uint32_t val; + } slc0_dscr_rec_conf; + union { + struct { + uint32_t dat0_crc_err_cnt: 8; + uint32_t dat1_crc_err_cnt: 8; + uint32_t dat2_crc_err_cnt: 8; + uint32_t dat3_crc_err_cnt: 8; + }; + uint32_t val; + } sdio_crc_st0; + union { + struct { + uint32_t cmd_crc_err_cnt: 8; + uint32_t reserved8: 23; + uint32_t err_cnt_clr: 1; + }; + uint32_t val; + } sdio_crc_st1; + uint32_t slc0_eof_start_des; /**/ + uint32_t slc0_push_dscr_addr; /**/ + uint32_t slc0_done_dscr_addr; /**/ + uint32_t slc0_sub_start_des; /**/ + union { + struct { + uint32_t rx_dscr_cnt_lat: 10; + uint32_t reserved10: 6; + uint32_t rx_get_eof_occ: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } slc0_dscr_cnt; + union { + struct { + uint32_t len_lim: 20; + uint32_t reserved20: 12; + }; + uint32_t val; + } slc0_len_lim_conf; + union { + struct { + uint32_t frhost_bit01: 1; + uint32_t frhost_bit11: 1; + uint32_t frhost_bit21: 1; + uint32_t frhost_bit31: 1; + uint32_t frhost_bit41: 1; + uint32_t frhost_bit51: 1; + uint32_t frhost_bit61: 1; + uint32_t frhost_bit71: 1; + uint32_t rx_start1: 1; + uint32_t tx_start1: 1; + uint32_t rx_udf1: 1; + uint32_t tx_ovf1: 1; + uint32_t token0_1to01: 1; + uint32_t token1_1to01: 1; + uint32_t tx_done1: 1; + uint32_t tx_suc_eof1: 1; + uint32_t rx_done1: 1; + uint32_t rx_eof1: 1; + uint32_t tohost1: 1; + uint32_t tx_dscr_err1: 1; + uint32_t rx_dscr_err1: 1; + uint32_t tx_dscr_empty1: 1; + uint32_t host_rd_ack1: 1; + uint32_t wr_retry_done1: 1; + uint32_t tx_err_eof1: 1; + uint32_t cmd_dtc1: 1; + uint32_t rx_quick_eof1: 1; + uint32_t host_pop_eof_err1: 1; + uint32_t reserved28: 4; + }; + uint32_t val; + } slc0_int_st1; + union { + struct { + uint32_t frhost_bit01: 1; + uint32_t frhost_bit11: 1; + uint32_t frhost_bit21: 1; + uint32_t frhost_bit31: 1; + uint32_t frhost_bit41: 1; + uint32_t frhost_bit51: 1; + uint32_t frhost_bit61: 1; + uint32_t frhost_bit71: 1; + uint32_t rx_start1: 1; + uint32_t tx_start1: 1; + uint32_t rx_udf1: 1; + uint32_t tx_ovf1: 1; + uint32_t token0_1to01: 1; + uint32_t token1_1to01: 1; + uint32_t tx_done1: 1; + uint32_t tx_suc_eof1: 1; + uint32_t rx_done1: 1; + uint32_t rx_eof1: 1; + uint32_t tohost1: 1; + uint32_t tx_dscr_err1: 1; + uint32_t rx_dscr_err1: 1; + uint32_t tx_dscr_empty1: 1; + uint32_t host_rd_ack1: 1; + uint32_t wr_retry_done1: 1; + uint32_t tx_err_eof1: 1; + uint32_t cmd_dtc1: 1; + uint32_t rx_quick_eof1: 1; + uint32_t host_pop_eof_err1: 1; + uint32_t reserved28: 4; + }; + uint32_t val; + } slc0_int_ena1; + uint32_t reserved_144; + uint32_t reserved_148; + uint32_t reserved_14c; + uint32_t reserved_150; + uint32_t reserved_154; + uint32_t reserved_158; + uint32_t reserved_15c; + uint32_t reserved_160; + uint32_t reserved_164; + uint32_t reserved_168; + uint32_t reserved_16c; + uint32_t reserved_170; + uint32_t reserved_174; + uint32_t reserved_178; + uint32_t reserved_17c; + uint32_t reserved_180; + uint32_t reserved_184; + uint32_t reserved_188; + uint32_t reserved_18c; + uint32_t reserved_190; + uint32_t reserved_194; + uint32_t reserved_198; + uint32_t reserved_19c; + uint32_t reserved_1a0; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + uint32_t reserved_1f0; + uint32_t reserved_1f4; + uint32_t date; /**/ + uint32_t id; /**/ +} slc_dev_t; +extern slc_dev_t SLC; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_SLC_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/soc.h b/components/soc/esp32s2beta/include/soc/soc.h new file mode 100644 index 0000000000..2f48dd7f5a --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/soc.h @@ -0,0 +1,370 @@ +// Copyright 2010-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. + +#pragma once + +#ifndef __ASSEMBLER__ +#include +#include "esp_assert.h" +#endif + +#include + +#define PRO_CPU_NUM (0) + +#define SOC_MAX_CONTIGUOUS_RAM_SIZE (SOC_EXTRAM_DATA_HIGH - SOC_EXTRAM_DATA_LOW) ///< Largest span of contiguous memory (DRAM or IRAM) in the address space + +#define DR_REG_SYSTEM_BASE 0x3f4c0000 +#define DR_REG_SENSITIVE_BASE 0x3f4c1000 +#define DR_REG_INTERRUPT_BASE 0x3f4c2000 +#define DR_REG_DMA_COPY_BASE 0x3f4c3000 +#define DR_REG_EXTMEM_BASE 0x3f4c4000 +#define DR_REG_MMU_TABLE 0x3f4c5000 +#define DR_REG_ITAG_TABLE 0x3f4c6000 +#define DR_REG_DTAG_TABLE 0x3f4c7000 +#define DR_REG_AES_BASE 0x3f4c8000 +#define DR_REG_SHA_BASE 0x3f4c9000 +#define DR_REG_RSA_BASE 0x3f4ca000 +#define DR_REG_SECURE_BOOT_BASE 0x3f4cb000 +#define DR_REG_HMAC_BASE 0x3f4cc000 +#define DR_REG_DIGITAL_SINGNATURE_BASE 0x3f4cd000 +#define DR_REG_ASSIST_DEBUG_BASE 0x3f4ce000 +#define DR_REG_DEDICATED_GPIO_BASE 0x3f4cf000 +#define DR_REG_INTRUSION_BASE 0x3f4d0000 +#define DR_REG_DPORT_END 0x3f4d3FFC +#define DR_REG_UART_BASE 0x3f400000 +#define DR_REG_SPI1_BASE 0x3f402000 +#define DR_REG_SPI0_BASE 0x3f403000 +#define DR_REG_GPIO_BASE 0x3f404000 +#define DR_REG_GPIO_SD_BASE 0x3f404f00 +#define DR_REG_FE2_BASE 0x3f405000 +#define DR_REG_FE_BASE 0x3f406000 +#define DR_REG_FRC_TIMER_BASE 0x3f407000 +#define DR_REG_RTCCNTL_BASE 0x3f408000 +#define DR_REG_RTCIO_BASE 0x3f408400 +#define DR_REG_SENS_BASE 0x3f408800 +#define DR_REG_RTC_I2C_BASE 0x3f408C00 +#define DR_REG_IO_MUX_BASE 0x3f409000 +#define DR_REG_HINF_BASE 0x3f40B000 +#define DR_REG_I2S_BASE 0x3f40F000 +#define DR_REG_UART1_BASE 0x3f410000 +#define DR_REG_I2C_EXT_BASE 0x3f413000 +#define DR_REG_UHCI0_BASE 0x3f414000 +#define DR_REG_SLCHOST_BASE 0x3f415000 +#define DR_REG_RMT_BASE 0x3f416000 +#define DR_REG_PCNT_BASE 0x3f417000 +#define DR_REG_SLC_BASE 0x3f418000 +#define DR_REG_LEDC_BASE 0x3f419000 +#define DR_REG_EFUSE_BASE 0x3f41A000 +#define DR_REG_NRX_BASE 0x3f41CC00 +#define DR_REG_BB_BASE 0x3f41D000 +#define DR_REG_TIMERGROUP0_BASE 0x3f41F000 +#define DR_REG_TIMERGROUP1_BASE 0x3f420000 +#define DR_REG_RTC_SLOWMEM_BASE 0x3f421000 +#define DR_REG_SPI2_BASE 0x3f424000 +#define DR_REG_SPI3_BASE 0x3f425000 +#define DR_REG_SYSCON_BASE 0x3f426000 +#define DR_REG_APB_CTRL_BASE 0x3f426000 /* Old name for SYSCON, to be removed */ +#define DR_REG_I2C1_EXT_BASE 0x3f427000 +#define DR_REG_SPI4_BASE 0x3f437000 +#define DR_REG_USB_WRAP_BASE 0x3f439000 + +#define REG_UHCI_BASE(i) (DR_REG_UHCI0_BASE) +#define REG_UART_BASE( i ) (DR_REG_UART_BASE + (i) * 0x10000 ) +#define REG_UART_AHB_BASE(i) (0x60000000 + (i) * 0x10000 ) +#define UART_FIFO_AHB_REG(i) (REG_UART_AHB_BASE(i) + 0x0) +#define REG_I2S_BASE( i ) (DR_REG_I2S_BASE) +#define REG_TIMG_BASE(i) (DR_REG_TIMERGROUP0_BASE + (i)*0x1000) +#define REG_SPI_MEM_BASE(i) (DR_REG_SPI0_BASE - (i) * 0x1000) +#define REG_I2C_BASE(i) (DR_REG_I2C_EXT_BASE + (i) * 0x14000 ) + +//Registers Operation {{ +#define ETS_UNCACHED_ADDR(addr) (addr) +#define ETS_CACHED_ADDR(addr) (addr) + +#ifndef __ASSEMBLER__ + +//write value to register +#define REG_WRITE(_r, _v) (*(volatile uint32_t *)(_r)) = (_v) + +//read value from register +#define REG_READ(_r) (*(volatile uint32_t *)(_r)) + +//get bit or get bits from register +#define REG_GET_BIT(_r, _b) (*(volatile uint32_t*)(_r) & (_b)) + +//set bit or set bits to register +#define REG_SET_BIT(_r, _b) (*(volatile uint32_t*)(_r) |= (_b)) + +//clear bit or clear bits of register +#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t*)(_r) &= ~(_b)) + +//set bits of register controlled by mask +#define REG_SET_BITS(_r, _b, _m) (*(volatile uint32_t*)(_r) = (*(volatile uint32_t*)(_r) & ~(_m)) | ((_b) & (_m))) + +//get field from register, uses field _S & _V to determine mask +#define REG_GET_FIELD(_r, _f) ((REG_READ(_r) >> (_f##_S)) & (_f##_V)) + +//set field of a register from variable, uses field _S & _V to determine mask +#define REG_SET_FIELD(_r, _f, _v) (REG_WRITE((_r),((REG_READ(_r) & ~((_f##_V) << (_f##_S)))|(((_v) & (_f##_V))<<(_f##_S))))) + +//get field value from a variable, used when _f is not left shifted by _f##_S +#define VALUE_GET_FIELD(_r, _f) (((_r) >> (_f##_S)) & (_f)) + +//get field value from a variable, used when _f is left shifted by _f##_S +#define VALUE_GET_FIELD2(_r, _f) (((_r) & (_f))>> (_f##_S)) + +//set field value to a variable, used when _f is not left shifted by _f##_S +#define VALUE_SET_FIELD(_r, _f, _v) ((_r)=(((_r) & ~((_f) << (_f##_S)))|((_v)<<(_f##_S)))) + +//set field value to a variable, used when _f is left shifted by _f##_S +#define VALUE_SET_FIELD2(_r, _f, _v) ((_r)=(((_r) & ~(_f))|((_v)<<(_f##_S)))) + +//generate a value from a field value, used when _f is not left shifted by _f##_S +#define FIELD_TO_VALUE(_f, _v) (((_v)&(_f))<<_f##_S) + +//generate a value from a field value, used when _f is left shifted by _f##_S +#define FIELD_TO_VALUE2(_f, _v) (((_v)<<_f##_S) & (_f)) + +//read value from register +#define READ_PERI_REG(addr) (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) + +//write value to register +#define WRITE_PERI_REG(addr, val) (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val) + +//clear bits of register controlled by mask +#define CLEAR_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg)&(~(mask)))) + +//set bits of register controlled by mask +#define SET_PERI_REG_MASK(reg, mask) WRITE_PERI_REG((reg), (READ_PERI_REG(reg)|(mask))) + +//get bits of register controlled by mask +#define GET_PERI_REG_MASK(reg, mask) (READ_PERI_REG(reg) & (mask)) + +//get bits of register controlled by highest bit and lowest bit +#define GET_PERI_REG_BITS(reg, hipos,lowpos) ((READ_PERI_REG(reg)>>(lowpos))&((1<<((hipos)-(lowpos)+1))-1)) + +//set bits of register controlled by mask and shift +#define SET_PERI_REG_BITS(reg,bit_map,value,shift) (WRITE_PERI_REG((reg),(READ_PERI_REG(reg)&(~((bit_map)<<(shift))))|(((value) & bit_map)<<(shift)) )) + +//get field of register +#define GET_PERI_REG_BITS2(reg, mask,shift) ((READ_PERI_REG(reg)>>(shift))&(mask)) + +#endif /* !__ASSEMBLER__ */ +//}} + +//Periheral Clock {{ +#define APB_CLK_FREQ_ROM ( 40*1000000 ) +#define CPU_CLK_FREQ_ROM APB_CLK_FREQ_ROM +#define UART_CLK_FREQ_ROM APB_CLK_FREQ_ROM +#define CPU_CLK_FREQ APB_CLK_FREQ +#define APB_CLK_FREQ ( 80*1000000 ) //unit: Hz +#define REF_CLK_FREQ ( 1000000 ) +#define UART_CLK_FREQ APB_CLK_FREQ +#define WDT_CLK_FREQ APB_CLK_FREQ +#define TIMER_CLK_FREQ (80000000>>4) //80MHz divided by 16 +#define SPI_CLK_DIV 4 +#define TICKS_PER_US_ROM 40 // CPU is 80MHz +#define GPIO_MATRIX_DELAY_NS 25 +//}} + +/* Overall memory map */ +#define SOC_DROM_LOW 0x3F000000 +#define SOC_DROM_HIGH 0x3F400000 +#define SOC_IROM_LOW 0x40080000 +#define SOC_IROM_HIGH 0x40c00000 +#define SOC_IRAM_LOW 0x40020000 +#define SOC_IRAM_HIGH 0x40070000 +#define SOC_DRAM_LOW 0x3FFB0000 +#define SOC_DRAM_HIGH 0x40000000 +#define SOC_RTC_IRAM_LOW 0x40070000 +#define SOC_RTC_IRAM_HIGH 0x40072000 +#define SOC_RTC_DRAM_LOW 0x3ff9e000 +#define SOC_RTC_DRAM_HIGH 0x3ffa0000 +#define SOC_RTC_DATA_LOW 0x50000000 +#define SOC_RTC_DATA_HIGH 0x50002000 +#define SOC_EXTRAM_DATA_LOW 0x3F500000 +#define SOC_EXTRAM_DATA_HIGH 0x3FF90000 +#define SOC_SLOW_EXTRAM_DATA_LOW 0x61800000 +#define SOC_SLOW_EXTRAM_DATA_HIGH 0x61c00000 + +//First and last words of the D/IRAM region, for both the DRAM address as well as the IRAM alias. +#define SOC_DIRAM_IRAM_LOW 0x40020000 +#define SOC_DIRAM_IRAM_HIGH 0x40070000 +#define SOC_DIRAM_DRAM_LOW 0x3FFB0000 +#define SOC_DIRAM_DRAM_HIGH 0x40000000 + +// Region of memory accessible via DMA. See esp_ptr_dma_capable(). +#define SOC_DMA_LOW 0x3FFB0000 +#define SOC_DMA_HIGH 0x40000000 + +// Region of memory that is byte-accessible. See esp_ptr_byte_accessible(). +#define SOC_BYTE_ACCESSIBLE_LOW 0x3FF9E000 +#define SOC_BYTE_ACCESSIBLE_HIGH 0x40000000 + +//Region of memory that is internal, as in on the same silicon die as the ESP32 CPUs +//(excluding RTC data region, that's checked separately.) See esp_ptr_internal(). +#define SOC_MEM_INTERNAL_LOW 0x3FF9E000 +#define SOC_MEM_INTERNAL_HIGH 0x40072000 + +//Interrupt hardware source table +//This table is decided by hardware, don't touch this. +#define ETS_WIFI_MAC_INTR_SOURCE 0/**< interrupt of WiFi MAC, level*/ +#define ETS_WIFI_MAC_NMI_SOURCE 1/**< interrupt of WiFi MAC, NMI, use if MAC have bug to fix in NMI*/ +#define ETS_WIFI_PWR_INTR_SOURCE 2/**< */ +#define ETS_WIFI_BB_INTR_SOURCE 3/**< interrupt of WiFi BB, level, we can do some calibartion*/ +#define ETS_BT_MAC_INTR_SOURCE 4/**< will be cancelled*/ +#define ETS_BT_BB_INTR_SOURCE 5/**< interrupt of BT BB, level*/ +#define ETS_BT_BB_NMI_SOURCE 6/**< interrupt of BT BB, NMI, use if BB have bug to fix in NMI*/ +#define ETS_RWBT_INTR_SOURCE 7/**< interrupt of RWBT, level*/ +#define ETS_RWBLE_INTR_SOURCE 8/**< interrupt of RWBLE, level*/ +#define ETS_RWBT_NMI_SOURCE 9/**< interrupt of RWBT, NMI, use if RWBT have bug to fix in NMI*/ +#define ETS_RWBLE_NMI_SOURCE 10/**< interrupt of RWBLE, NMI, use if RWBT have bug to fix in NMI*/ +#define ETS_SLC0_INTR_SOURCE 11/**< interrupt of SLC0, level*/ +#define ETS_SLC1_INTR_SOURCE 12/**< interrupt of SLC1, level*/ +#define ETS_UHCI0_INTR_SOURCE 13/**< interrupt of UHCI0, level*/ +#define ETS_UHCI1_INTR_SOURCE 14/**< interrupt of UHCI1, level*/ +#define ETS_TG0_T0_LEVEL_INTR_SOURCE 15/**< interrupt of TIMER_GROUP0, TIMER0, level, we would like use EDGE for timer if permission*/ +#define ETS_TG0_T1_LEVEL_INTR_SOURCE 16/**< interrupt of TIMER_GROUP0, TIMER1, level, we would like use EDGE for timer if permission*/ +#define ETS_TG0_WDT_LEVEL_INTR_SOURCE 17/**< interrupt of TIMER_GROUP0, WATCHDOG, level*/ +#define ETS_TG0_LACT_LEVEL_INTR_SOURCE 18/**< interrupt of TIMER_GROUP0, LACT, level*/ +#define ETS_TG1_T0_LEVEL_INTR_SOURCE 19/**< interrupt of TIMER_GROUP1, TIMER0, level, we would like use EDGE for timer if permission*/ +#define ETS_TG1_T1_LEVEL_INTR_SOURCE 20/**< interrupt of TIMER_GROUP1, TIMER1, level, we would like use EDGE for timer if permission*/ +#define ETS_TG1_WDT_LEVEL_INTR_SOURCE 21/**< interrupt of TIMER_GROUP1, WATCHDOG, level*/ +#define ETS_TG1_LACT_LEVEL_INTR_SOURCE 22/**< interrupt of TIMER_GROUP1, LACT, level*/ +#define ETS_GPIO_INTR_SOURCE 23/**< interrupt of GPIO, level*/ +#define ETS_GPIO_NMI_SOURCE 24/**< interrupt of GPIO, NMI*/ +#define ETS_GPIO_INTR_SOURCE2 25/**< interrupt of GPIO, level*/ +#define ETS_GPIO_NMI_SOURCE2 26/**< interrupt of GPIO, NMI*/ +#define ETS_DEDICATED_GPIO_INTR_SOURCE 27/**< interrupt of dedicated GPIO, level*/ +#define ETS_FROM_CPU_INTR0_SOURCE 28/**< interrupt0 generated from a CPU, level*/ /* Used for FreeRTOS */ +#define ETS_FROM_CPU_INTR1_SOURCE 29/**< interrupt1 generated from a CPU, level*/ /* Used for FreeRTOS */ +#define ETS_FROM_CPU_INTR2_SOURCE 30/**< interrupt2 generated from a CPU, level*/ /* Used for DPORT Access */ +#define ETS_FROM_CPU_INTR3_SOURCE 31/**< interrupt3 generated from a CPU, level*/ /* Used for DPORT Access */ +#define ETS_SPI1_INTR_SOURCE 32/**< interrupt of SPI1, level, SPI1 is for flash read/write, do not use this*/ +#define ETS_SPI2_INTR_SOURCE 33/**< interrupt of SPI2, level*/ +#define ETS_SPI3_INTR_SOURCE 34/**< interrupt of SPI3, level*/ +#define ETS_I2S0_INTR_SOURCE 35/**< interrupt of I2S0, level*/ +#define ETS_I2S1_INTR_SOURCE 36/**< interrupt of I2S1, level*/ +#define ETS_UART0_INTR_SOURCE 37/**< interrupt of UART0, level*/ +#define ETS_UART1_INTR_SOURCE 38/**< interrupt of UART1, level*/ +#define ETS_UART2_INTR_SOURCE 39/**< interrupt of UART2, level*/ +#define ETS_SDIO_HOST_INTR_SOURCE 40/**< interrupt of SD/SDIO/MMC HOST, level*/ +#define ETS_PWM0_INTR_SOURCE 41/**< interrupt of PWM0, level, Reserved*/ +#define ETS_PWM1_INTR_SOURCE 42/**< interrupt of PWM1, level, Reserved*/ +#define ETS_PWM2_INTR_SOURCE 43/**< interrupt of PWM2, level*/ +#define ETS_PWM3_INTR_SOURCE 44/**< interruot of PWM3, level*/ +#define ETS_LEDC_INTR_SOURCE 45/**< interrupt of LED PWM, level*/ +#define ETS_EFUSE_INTR_SOURCE 46/**< interrupt of efuse, level, not likely to use*/ +#define ETS_CAN_INTR_SOURCE 47/**< interrupt of can, level*/ +#define ETS_USB_INTR_SOURCE 48/**< interrupt of USB, level*/ +#define ETS_RTC_CORE_INTR_SOURCE 49/**< interrupt of rtc core, level, include rtc watchdog*/ +#define ETS_RMT_INTR_SOURCE 50/**< interrupt of remote controller, level*/ +#define ETS_PCNT_INTR_SOURCE 51/**< interrupt of pluse count, level*/ +#define ETS_I2C_EXT0_INTR_SOURCE 52/**< interrupt of I2C controller1, level*/ +#define ETS_I2C_EXT1_INTR_SOURCE 53/**< interrupt of I2C controller0, level*/ +#define ETS_RSA_INTR_SOURCE 54/**< interrupt of RSA accelerator, level*/ +#define ETS_SPI1_DMA_INTR_SOURCE 55/**< interrupt of SPI1 DMA, SPI1 is for flash read/write, do not use this*/ +#define ETS_SPI2_DMA_INTR_SOURCE 56/**< interrupt of SPI2 DMA, level*/ +#define ETS_SPI3_DMA_INTR_SOURCE 57/**< interrupt of SPI3 DMA, level*/ +#define ETS_WDT_INTR_SOURCE 58/**< will be cancelled*/ +#define ETS_TIMER1_INTR_SOURCE 59/**< will be cancelled*/ +#define ETS_TIMER2_INTR_SOURCE 60/**< will be cancelled*/ +#define ETS_TG0_T0_EDGE_INTR_SOURCE 61/**< interrupt of TIMER_GROUP0, TIMER0, EDGE*/ +#define ETS_TG0_T1_EDGE_INTR_SOURCE 62/**< interrupt of TIMER_GROUP0, TIMER1, EDGE*/ +#define ETS_TG0_WDT_EDGE_INTR_SOURCE 63/**< interrupt of TIMER_GROUP0, WATCH DOG, EDGE*/ +#define ETS_TG0_LACT_EDGE_INTR_SOURCE 64/**< interrupt of TIMER_GROUP0, LACT, EDGE*/ +#define ETS_TG1_T0_EDGE_INTR_SOURCE 65/**< interrupt of TIMER_GROUP1, TIMER0, EDGE*/ +#define ETS_TG1_T1_EDGE_INTR_SOURCE 66/**< interrupt of TIMER_GROUP1, TIMER1, EDGE*/ +#define ETS_TG1_WDT_EDGE_INTR_SOURCE 67/**< interrupt of TIMER_GROUP1, WATCHDOG, EDGE*/ +#define ETS_TG1_LACT_EDGE_INTR_SOURCE 68/**< interrupt of TIMER_GROUP0, LACT, EDGE*/ +#define ETS_CACHE_IA_INTR_SOURCE 69/**< interrupt of Cache Invalied Access, LEVEL*/ +#define ETS_SYSTIMER_TARGET0_EDGE_INTR_SOURCE 70/**< interrupt of system timer 0, EDGE*/ +#define ETS_SYSTIMER_TARGET1_EDGE_INTR_SOURCE 71/**< interrupt of system timer 1, EDGE*/ +#define ETS_SYSTIMER_TARGET2_EDGE_INTR_SOURCE 72/**< interrupt of system timer 2, EDGE*/ +#define ETS_ASSIST_DEBUG_INTR_SOURCE 73/**< interrupt of Assist debug module, LEVEL*/ +#define ETS_PMS_PRO_IRAM0_ILG_INTR_SOURCE 74/**< interrupt of illegal IRAM1 access, LEVEL*/ +#define ETS_PMS_PRO_DRAM0_ILG_INTR_SOURCE 75/**< interrupt of illegal DRAM0 access, LEVEL*/ +#define ETS_PMS_PRO_DPORT_ILG_INTR_SOURCE 76/**< interrupt of illegal DPORT access, LEVEL*/ +#define ETS_PMS_PRO_AHB_ILG_INTR_SOURCE 77/**< interrupt of illegal AHB access, LEVEL*/ +#define ETS_PMS_PRO_CACHE_ILG_INTR_SOURCE 78/**< interrupt of illegal CACHE access, LEVEL*/ +#define ETS_PMS_DMA_APB_I_ILG_INTR_SOURCE 79/**< interrupt of illegal APB access, LEVEL*/ +#define ETS_PMS_DMA_RX_I_ILG_INTR_SOURCE 80/**< interrupt of illegal DMA RX access, LEVEL*/ +#define ETS_PMS_DMA_TX_I_ILG_INTR_SOURCE 81/**< interrupt of illegal DMA TX access, LEVEL*/ +#define ETS_SPI0_REJECT_CACHE_INTR_SOURCE 82/**< interrupt of SPI0 Cache access rejected, LEVEL*/ +#define ETS_SPI1_REJECT_CPU_INTR_SOURCE 83/**< interrupt of SPI1 access rejected, LEVEL*/ +#define ETS_DMA_COPY_INTR_SOURCE 84/**< interrupt of DMA copy, LEVEL*/ +#define ETS_SPI4_DMA_INTR_SOURCE 85/**< interrupt of SPI4 DMA, LEVEL*/ +#define ETS_SPI4_INTR_SOURCE 86/**< interrupt of SPI4, LEVEL*/ +#define ETS_MAX_INTR_SOURCE 87/**< number of interrupt sources */ + +//interrupt cpu using table, Please see the core-isa.h +/************************************************************************************************************* + * Intr num Level Type PRO CPU usage APP CPU uasge + * 0 1 extern level WMAC Reserved + * 1 1 extern level BT/BLE Host HCI DMA BT/BLE Host HCI DMA + * 2 1 extern level + * 3 1 extern level + * 4 1 extern level WBB + * 5 1 extern level BT/BLE Controller BT/BLE Controller + * 6 1 timer FreeRTOS Tick(L1) FreeRTOS Tick(L1) + * 7 1 software BT/BLE VHCI BT/BLE VHCI + * 8 1 extern level BT/BLE BB(RX/TX) BT/BLE BB(RX/TX) + * 9 1 extern level + * 10 1 extern edge + * 11 3 profiling + * 12 1 extern level + * 13 1 extern level + * 14 7 nmi Reserved Reserved + * 15 3 timer FreeRTOS Tick(L3) FreeRTOS Tick(L3) + * 16 5 timer + * 17 1 extern level + * 18 1 extern level + * 19 2 extern level + * 20 2 extern level + * 21 2 extern level + * 22 3 extern edge + * 23 3 extern level + * 24 4 extern level TG1_WDT + * 25 4 extern level CACHEERR + * 26 5 extern level + * 27 3 extern level Reserved Reserved + * 28 4 extern edge + * 29 3 software Reserved Reserved + * 30 4 extern edge Reserved Reserved + * 31 5 extern level + ************************************************************************************************************* + */ + +//CPU0 Interrupt number reserved, not touch this. +#define ETS_WMAC_INUM 0 +#define ETS_BT_HOST_INUM 1 +#define ETS_WBB_INUM 4 +#define ETS_TG0_T1_INUM 10 /**< use edge interrupt*/ +#define ETS_FRC1_INUM 22 +#define ETS_T1_WDT_INUM 24 +#define ETS_CACHEERR_INUM 25 + +//CPU0 Interrupt number used in ROM, should be cancelled in SDK +#define ETS_SLC_INUM 1 +#define ETS_UART0_INUM 5 +#define ETS_UART1_INUM 5 +//CPU0 Interrupt number used in ROM code only when module init function called, should pay attention here. +#define ETS_FRC_TIMER2_INUM 10 /* use edge*/ +#define ETS_GPIO_INUM 4 + +//Other interrupt number should be managed by the user + +//Invalid interrupt for number interrupt matrix +#define ETS_INVALID_INUM 6 diff --git a/components/soc/esp32s2beta/include/soc/soc_caps.h b/components/soc/esp32s2beta/include/soc/soc_caps.h new file mode 100644 index 0000000000..fc6db81782 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/soc_caps.h @@ -0,0 +1,4 @@ +// The long term plan is to have a single soc_caps.h for each peripheral. +// During the refactoring and multichip support development process, we +// seperate these information into periph_caps.h for each peripheral and +// include them here. diff --git a/components/soc/esp32s2beta/include/soc/soc_ulp.h b/components/soc/esp32s2beta/include/soc/soc_ulp.h new file mode 100644 index 0000000000..e8c20d2b56 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/soc_ulp.h @@ -0,0 +1,46 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#pragma once + +// This file contains various convenience macros to be used in ULP programs. + +// Helper macros to calculate bit field width from mask, using the preprocessor. +// Used later in READ_RTC_FIELD and WRITE_RTC_FIELD. +#define IS_BIT_SET(m, i) (((m) >> (i)) & 1) +#define MASK_TO_WIDTH_HELPER1(m, i) IS_BIT_SET(m, i) +#define MASK_TO_WIDTH_HELPER2(m, i) (MASK_TO_WIDTH_HELPER1(m, i) + MASK_TO_WIDTH_HELPER1(m, i + 1)) +#define MASK_TO_WIDTH_HELPER4(m, i) (MASK_TO_WIDTH_HELPER2(m, i) + MASK_TO_WIDTH_HELPER2(m, i + 2)) +#define MASK_TO_WIDTH_HELPER8(m, i) (MASK_TO_WIDTH_HELPER4(m, i) + MASK_TO_WIDTH_HELPER4(m, i + 4)) +#define MASK_TO_WIDTH_HELPER16(m, i) (MASK_TO_WIDTH_HELPER8(m, i) + MASK_TO_WIDTH_HELPER8(m, i + 8)) +#define MASK_TO_WIDTH_HELPER32(m, i) (MASK_TO_WIDTH_HELPER16(m, i) + MASK_TO_WIDTH_HELPER16(m, i + 16)) + +// Peripheral register access macros, build around REG_RD and REG_WR instructions. +// Registers defined in rtc_cntl_reg.h, rtc_io_reg.h, sens_reg.h, and rtc_i2c_reg.h are usable with these macros. + +// Read from rtc_reg[low_bit + bit_width - 1 : low_bit] into R0, bit_width <= 16 +#define READ_RTC_REG(rtc_reg, low_bit, bit_width) \ + REG_RD (((rtc_reg) - DR_REG_RTCCNTL_BASE) / 4), ((low_bit) + (bit_width) - 1), (low_bit) + +// Write immediate value into rtc_reg[low_bit + bit_width - 1 : low_bit], bit_width <= 8 +#define WRITE_RTC_REG(rtc_reg, low_bit, bit_width, value) \ + REG_WR (((rtc_reg) - DR_REG_RTCCNTL_BASE) / 4), ((low_bit) + (bit_width) - 1), (low_bit), ((value) & 0xff) + +// Read from a field in rtc_reg into R0, up to 16 bits +#define READ_RTC_FIELD(rtc_reg, field) \ + READ_RTC_REG(rtc_reg, field ## _S, MASK_TO_WIDTH_HELPER16(field ## _V, 0)) + +// Write immediate value into a field in rtc_reg, up to 8 bits +#define WRITE_RTC_FIELD(rtc_reg, field, value) \ + WRITE_RTC_REG(rtc_reg, field ## _S, MASK_TO_WIDTH_HELPER8(field ## _V, 0), ((value) & field ## _V)) + diff --git a/components/soc/esp32s2beta/include/soc/spi_caps.h b/components/soc/esp32s2beta/include/soc/spi_caps.h new file mode 100644 index 0000000000..eeeb5ac655 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/spi_caps.h @@ -0,0 +1,45 @@ +// 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. + +#pragma once + +#define SOC_SPI_PERIPH_NUM 4 +#define SOC_SPI_DMA_CHAN_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 + +#define SOC_SPI_MAXIMUM_BUFFER_SIZE 72 + +//#define SOC_SPI_SUPPORT_AS_CS //don't support to toggle the CS while the clock toggles +#define SOC_SPI_SUPPORT_DDRCLK 1 +#define SOC_SPI_SLAVE_SUPPORT_SEG_TRANS 1 +#define SOC_SPI_SUPPORT_CD_SIG 1 diff --git a/components/soc/esp32s2beta/include/soc/spi_mem_reg.h b/components/soc/esp32s2beta/include/soc/spi_mem_reg.h new file mode 100644 index 0000000000..dfe4be5ce8 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/spi_mem_reg.h @@ -0,0 +1,1893 @@ +// Copyright 2017-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_MEM_REG_H_ +#define _SOC_SPI_MEM_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define REG_SPI_MEM_BASE(i) (DR_REG_SPI0_BASE - (i) * 0x1000) + +#define SPI_MEM_CMD_REG(i) (REG_SPI_MEM_BASE(i) + 0x000) +/* SPI_MEM_FLASH_READ : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: Read flash enable. Read flash operation will be triggered when + the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ +#define SPI_MEM_FLASH_READ (BIT(31)) +#define SPI_MEM_FLASH_READ_M (BIT(31)) +#define SPI_MEM_FLASH_READ_V 0x1 +#define SPI_MEM_FLASH_READ_S 31 +/* SPI_MEM_FLASH_WREN : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: Write flash enable. Write enable command will be sent when the + bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ +#define SPI_MEM_FLASH_WREN (BIT(30)) +#define SPI_MEM_FLASH_WREN_M (BIT(30)) +#define SPI_MEM_FLASH_WREN_V 0x1 +#define SPI_MEM_FLASH_WREN_S 30 +/* SPI_MEM_FLASH_WRDI : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: Write flash disable. Write disable command will be sent when + the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ +#define SPI_MEM_FLASH_WRDI (BIT(29)) +#define SPI_MEM_FLASH_WRDI_M (BIT(29)) +#define SPI_MEM_FLASH_WRDI_V 0x1 +#define SPI_MEM_FLASH_WRDI_S 29 +/* SPI_MEM_FLASH_RDID : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: Read JEDEC ID . Read ID command will be sent when the bit is + set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ +#define SPI_MEM_FLASH_RDID (BIT(28)) +#define SPI_MEM_FLASH_RDID_M (BIT(28)) +#define SPI_MEM_FLASH_RDID_V 0x1 +#define SPI_MEM_FLASH_RDID_S 28 +/* SPI_MEM_FLASH_RDSR : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: Read status register-1. Read status operation will be triggered + when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_RDSR (BIT(27)) +#define SPI_MEM_FLASH_RDSR_M (BIT(27)) +#define SPI_MEM_FLASH_RDSR_V 0x1 +#define SPI_MEM_FLASH_RDSR_S 27 +/* SPI_MEM_FLASH_WRSR : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: Write status register enable. Write status operation will + be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_WRSR (BIT(26)) +#define SPI_MEM_FLASH_WRSR_M (BIT(26)) +#define SPI_MEM_FLASH_WRSR_V 0x1 +#define SPI_MEM_FLASH_WRSR_S 26 +/* SPI_MEM_FLASH_PP : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: Page program enable(1 byte ~256 bytes data to be programmed). + Page program operation will be triggered when the bit is set. The bit will be cleared once the operation done .1: enable 0: disable.*/ +#define SPI_MEM_FLASH_PP (BIT(25)) +#define SPI_MEM_FLASH_PP_M (BIT(25)) +#define SPI_MEM_FLASH_PP_V 0x1 +#define SPI_MEM_FLASH_PP_S 25 +/* SPI_MEM_FLASH_SE : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: Sector erase enable(4KB). Sector erase operation will be triggered + when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_SE (BIT(24)) +#define SPI_MEM_FLASH_SE_M (BIT(24)) +#define SPI_MEM_FLASH_SE_V 0x1 +#define SPI_MEM_FLASH_SE_S 24 +/* SPI_MEM_FLASH_BE : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: Block erase enable(32KB) . Block erase operation will be triggered + when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_BE (BIT(23)) +#define SPI_MEM_FLASH_BE_M (BIT(23)) +#define SPI_MEM_FLASH_BE_V 0x1 +#define SPI_MEM_FLASH_BE_S 23 +/* SPI_MEM_FLASH_CE : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: Chip erase enable. Chip erase operation will be triggered when + the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_CE (BIT(22)) +#define SPI_MEM_FLASH_CE_M (BIT(22)) +#define SPI_MEM_FLASH_CE_V 0x1 +#define SPI_MEM_FLASH_CE_S 22 +/* SPI_MEM_FLASH_DP : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: Drive Flash into power down. An operation will be triggered + when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_DP (BIT(21)) +#define SPI_MEM_FLASH_DP_M (BIT(21)) +#define SPI_MEM_FLASH_DP_V 0x1 +#define SPI_MEM_FLASH_DP_S 21 +/* SPI_MEM_FLASH_RES : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: This bit combined with reg_resandres bit releases Flash from + the power-down state or high performance mode and obtains the devices ID. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_RES (BIT(20)) +#define SPI_MEM_FLASH_RES_M (BIT(20)) +#define SPI_MEM_FLASH_RES_V 0x1 +#define SPI_MEM_FLASH_RES_S 20 +/* SPI_MEM_FLASH_HPM : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: Drive Flash into high performance mode. The bit will be cleared + once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_HPM (BIT(19)) +#define SPI_MEM_FLASH_HPM_M (BIT(19)) +#define SPI_MEM_FLASH_HPM_V 0x1 +#define SPI_MEM_FLASH_HPM_S 19 +/* SPI_MEM_USR : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: User define command enable. An operation will be triggered when + the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_USR (BIT(18)) +#define SPI_MEM_USR_M (BIT(18)) +#define SPI_MEM_USR_V 0x1 +#define SPI_MEM_USR_S 18 +/* SPI_MEM_FLASH_PE : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: In user mode it is set to indicate that program/erase operation + will be triggered. The bit is combined with spi_mem_usr bit. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_PE (BIT(17)) +#define SPI_MEM_FLASH_PE_M (BIT(17)) +#define SPI_MEM_FLASH_PE_V 0x1 +#define SPI_MEM_FLASH_PE_S 17 + +#define SPI_MEM_ADDR_REG(i) (REG_SPI_MEM_BASE(i) + 0x004) +/* SPI_MEM_USR_ADDR_VALUE : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: In user mode it is the memory address. other then the bit0-bit23 + is the memory address the bit24-bit31 are the byte length of a transfer.*/ +#define SPI_MEM_USR_ADDR_VALUE 0xFFFFFFFF +#define SPI_MEM_USR_ADDR_VALUE_M ((SPI_MEM_USR_ADDR_VALUE_V)<<(SPI_MEM_USR_ADDR_VALUE_S)) +#define SPI_MEM_USR_ADDR_VALUE_V 0xFFFFFFFF +#define SPI_MEM_USR_ADDR_VALUE_S 0 + +#define SPI_MEM_CTRL_REG(i) (REG_SPI_MEM_BASE(i) + 0x008) +/* SPI_MEM_FREAD_QIO : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: In the read operations address phase and read-data phase apply + 4 signals. 1: enable 0: disable.*/ +#define SPI_MEM_FREAD_QIO (BIT(24)) +#define SPI_MEM_FREAD_QIO_M (BIT(24)) +#define SPI_MEM_FREAD_QIO_V 0x1 +#define SPI_MEM_FREAD_QIO_S 24 +/* SPI_MEM_FREAD_DIO : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: In the read operations address phase and read-data phase apply + 2 signals. 1: enable 0: disable.*/ +#define SPI_MEM_FREAD_DIO (BIT(23)) +#define SPI_MEM_FREAD_DIO_M (BIT(23)) +#define SPI_MEM_FREAD_DIO_V 0x1 +#define SPI_MEM_FREAD_DIO_S 23 +/* SPI_MEM_WRSR_2B : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: two bytes data will be written to status register when it is + set. 1: enable 0: disable.*/ +#define SPI_MEM_WRSR_2B (BIT(22)) +#define SPI_MEM_WRSR_2B_M (BIT(22)) +#define SPI_MEM_WRSR_2B_V 0x1 +#define SPI_MEM_WRSR_2B_S 22 +/* SPI_MEM_WP_REG : R/W ;bitpos:[21] ;default: 1'b1 ; */ +/*description: Write protect signal output when SPI is idle. 1: output high 0: output low.*/ +#define SPI_MEM_WP_REG (BIT(21)) +#define SPI_MEM_WP_REG_M (BIT(21)) +#define SPI_MEM_WP_REG_V 0x1 +#define SPI_MEM_WP_REG_S 21 +/* SPI_MEM_FREAD_QUAD : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: In the read operations read-data phase apply 4 signals. 1: enable 0: disable.*/ +#define SPI_MEM_FREAD_QUAD (BIT(20)) +#define SPI_MEM_FREAD_QUAD_M (BIT(20)) +#define SPI_MEM_FREAD_QUAD_V 0x1 +#define SPI_MEM_FREAD_QUAD_S 20 +/* SPI_MEM_D_POL : R/W ;bitpos:[19] ;default: 1'b1 ; */ +/*description: The bit is used to set MOSI line polarity 1: high 0 low*/ +#define SPI_MEM_D_POL (BIT(19)) +#define SPI_MEM_D_POL_M (BIT(19)) +#define SPI_MEM_D_POL_V 0x1 +#define SPI_MEM_D_POL_S 19 +/* SPI_MEM_Q_POL : R/W ;bitpos:[18] ;default: 1'b1 ; */ +/*description: The bit is used to set MISO line polarity 1: high 0 low*/ +#define SPI_MEM_Q_POL (BIT(18)) +#define SPI_MEM_Q_POL_M (BIT(18)) +#define SPI_MEM_Q_POL_V 0x1 +#define SPI_MEM_Q_POL_S 18 +/* SPI_MEM_RESANDRES : R/W ;bitpos:[15] ;default: 1'b1 ; */ +/*description: The Device ID is read out to SPI_MEM_RD_STATUS register this + bit combine with spi_mem_flash_res bit. 1: enable 0: disable.*/ +#define SPI_MEM_RESANDRES (BIT(15)) +#define SPI_MEM_RESANDRES_M (BIT(15)) +#define SPI_MEM_RESANDRES_V 0x1 +#define SPI_MEM_RESANDRES_S 15 +/* SPI_MEM_FREAD_DUAL : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: In the read operations read-data phase apply 2 signals. 1: enable 0: disable.*/ +#define SPI_MEM_FREAD_DUAL (BIT(14)) +#define SPI_MEM_FREAD_DUAL_M (BIT(14)) +#define SPI_MEM_FREAD_DUAL_V 0x1 +#define SPI_MEM_FREAD_DUAL_S 14 +/* SPI_MEM_FASTRD_MODE : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: This bit enable the bits: spi_mem_fread_qio spi_mem_fread_dio + spi_mem_fread_qout and spi_mem_fread_dout. 1: enable 0: disable.*/ +#define SPI_MEM_FASTRD_MODE (BIT(13)) +#define SPI_MEM_FASTRD_MODE_M (BIT(13)) +#define SPI_MEM_FASTRD_MODE_V 0x1 +#define SPI_MEM_FASTRD_MODE_S 13 +/* SPI_MEM_TX_CRC_EN : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: For SPI1 enable crc32 when writing encrypted data to flash. + 1: enable 0:disable*/ +#define SPI_MEM_TX_CRC_EN (BIT(11)) +#define SPI_MEM_TX_CRC_EN_M (BIT(11)) +#define SPI_MEM_TX_CRC_EN_V 0x1 +#define SPI_MEM_TX_CRC_EN_S 11 +/* SPI_MEM_FCS_CRC_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: For SPI1 initialize crc32 module before writing encrypted data + to flash. Active low.*/ +#define SPI_MEM_FCS_CRC_EN (BIT(10)) +#define SPI_MEM_FCS_CRC_EN_M (BIT(10)) +#define SPI_MEM_FCS_CRC_EN_V 0x1 +#define SPI_MEM_FCS_CRC_EN_S 10 +/* SPI_MEM_FCMD_QUAD : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: Apply 4 signals during command phase 1:enable 0: disable*/ +#define SPI_MEM_FCMD_QUAD (BIT(8)) +#define SPI_MEM_FCMD_QUAD_M (BIT(8)) +#define SPI_MEM_FCMD_QUAD_V 0x1 +#define SPI_MEM_FCMD_QUAD_S 8 +/* SPI_MEM_FCMD_DUAL : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: Apply 2 signals during command phase 1:enable 0: disable*/ +#define SPI_MEM_FCMD_DUAL (BIT(7)) +#define SPI_MEM_FCMD_DUAL_M (BIT(7)) +#define SPI_MEM_FCMD_DUAL_V 0x1 +#define SPI_MEM_FCMD_DUAL_S 7 +/* SPI_MEM_DUMMY_OUT : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: In the dummy phase the signal level of spi is output by the spi controller.*/ +#define SPI_MEM_DUMMY_OUT (BIT(3)) +#define SPI_MEM_DUMMY_OUT_M (BIT(3)) +#define SPI_MEM_DUMMY_OUT_V 0x1 +#define SPI_MEM_DUMMY_OUT_S 3 + +#define SPI_MEM_CTRL1_REG(i) (REG_SPI_MEM_BASE(i) + 0x00C) +/* SPI_MEM_CS_DLY_EDGE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: The bit is used to select the spi clock edge to modify CS line timing.*/ +#define SPI_MEM_CS_DLY_EDGE (BIT(31)) +#define SPI_MEM_CS_DLY_EDGE_M (BIT(31)) +#define SPI_MEM_CS_DLY_EDGE_V 0x1 +#define SPI_MEM_CS_DLY_EDGE_S 31 +/* SPI_MEM_CS_DLY_MODE : R/W ;bitpos:[30:28] ;default: 3'h0 ; */ +/*description: The cs signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the posedge of clk_160 4 output with the negedge of clk_160 5: output with the spi_clk*/ +#define SPI_MEM_CS_DLY_MODE 0x00000007 +#define SPI_MEM_CS_DLY_MODE_M ((SPI_MEM_CS_DLY_MODE_V)<<(SPI_MEM_CS_DLY_MODE_S)) +#define SPI_MEM_CS_DLY_MODE_V 0x7 +#define SPI_MEM_CS_DLY_MODE_S 28 +/* SPI_MEM_CS_DLY_NUM : R/W ;bitpos:[27:26] ;default: 2'h0 ; */ +/*description: spi_mem_cs signal is delayed by system clock cycles*/ +#define SPI_MEM_CS_DLY_NUM 0x00000003 +#define SPI_MEM_CS_DLY_NUM_M ((SPI_MEM_CS_DLY_NUM_V)<<(SPI_MEM_CS_DLY_NUM_S)) +#define SPI_MEM_CS_DLY_NUM_V 0x3 +#define SPI_MEM_CS_DLY_NUM_S 26 +/* SPI_MEM_CS_HOLD_DLY : R/W ;bitpos:[25:14] ;default: 12'h1 ; */ +/*description: SPI fsm is delayed to idle by spi clock cycles.*/ +#define SPI_MEM_CS_HOLD_DLY 0x00000FFF +#define SPI_MEM_CS_HOLD_DLY_M ((SPI_MEM_CS_HOLD_DLY_V)<<(SPI_MEM_CS_HOLD_DLY_S)) +#define SPI_MEM_CS_HOLD_DLY_V 0xFFF +#define SPI_MEM_CS_HOLD_DLY_S 14 +/* SPI_MEM_CS_HOLD_DLY_RES : R/W ;bitpos:[13:2] ;default: 12'hfff ; */ +/*description: Delay cycles of resume Flash when resume Flash from standby mode + is enable by spi clock.*/ +#define SPI_MEM_CS_HOLD_DLY_RES 0x00000FFF +#define SPI_MEM_CS_HOLD_DLY_RES_M ((SPI_MEM_CS_HOLD_DLY_RES_V)<<(SPI_MEM_CS_HOLD_DLY_RES_S)) +#define SPI_MEM_CS_HOLD_DLY_RES_V 0xFFF +#define SPI_MEM_CS_HOLD_DLY_RES_S 2 +/* SPI_MEM_CLK_MODE : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: SPI clock mode bits. 0: SPI clock is off when CS inactive 1: + SPI clock is delayed one cycle after CS inactive 2: SPI clock is delayed two cycles after CS inactive 3: SPI clock is alwasy on.*/ +#define SPI_MEM_CLK_MODE 0x00000003 +#define SPI_MEM_CLK_MODE_M ((SPI_MEM_CLK_MODE_V)<<(SPI_MEM_CLK_MODE_S)) +#define SPI_MEM_CLK_MODE_V 0x3 +#define SPI_MEM_CLK_MODE_S 0 + +#define SPI_MEM_CTRL2_REG(i) (REG_SPI_MEM_BASE(i) + 0x010) +/* SPI_MEM_SYNC_RESET : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: The FSM will be reset.*/ +#define SPI_MEM_SYNC_RESET (BIT(31)) +#define SPI_MEM_SYNC_RESET_M (BIT(31)) +#define SPI_MEM_SYNC_RESET_V 0x1 +#define SPI_MEM_SYNC_RESET_S 31 +/* SPI_MEM_CS_HOLD_TIME : R/W ;bitpos:[25:13] ;default: 13'h1 ; */ +/*description: Spi cs signal is delayed to inactive by spi clock this bits are + combined with spi_mem_cs_hold bit.*/ +#define SPI_MEM_CS_HOLD_TIME 0x00001FFF +#define SPI_MEM_CS_HOLD_TIME_M ((SPI_MEM_CS_HOLD_TIME_V)<<(SPI_MEM_CS_HOLD_TIME_S)) +#define SPI_MEM_CS_HOLD_TIME_V 0x1FFF +#define SPI_MEM_CS_HOLD_TIME_S 13 +/* SPI_MEM_CS_SETUP_TIME : R/W ;bitpos:[12:0] ;default: 13'h1 ; */ +/*description: (cycles-1) of prepare phase by spi clock this bits are combined + with spi_mem_cs_setup bit.*/ +#define SPI_MEM_CS_SETUP_TIME 0x00001FFF +#define SPI_MEM_CS_SETUP_TIME_M ((SPI_MEM_CS_SETUP_TIME_V)<<(SPI_MEM_CS_SETUP_TIME_S)) +#define SPI_MEM_CS_SETUP_TIME_V 0x1FFF +#define SPI_MEM_CS_SETUP_TIME_S 0 + +#define SPI_MEM_CLOCK_REG(i) (REG_SPI_MEM_BASE(i) + 0x014) +/* SPI_MEM_CLK_EQU_SYSCLK : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: reserved*/ +#define SPI_MEM_CLK_EQU_SYSCLK (BIT(31)) +#define SPI_MEM_CLK_EQU_SYSCLK_M (BIT(31)) +#define SPI_MEM_CLK_EQU_SYSCLK_V 0x1 +#define SPI_MEM_CLK_EQU_SYSCLK_S 31 +/* SPI_MEM_CLKCNT_N : R/W ;bitpos:[23:16] ;default: 8'h3 ; */ +/*description: In the master mode it is the divider of spi_mem_clk. So spi_mem_clk + frequency is system/(spi_mem_clkcnt_N+1)*/ +#define SPI_MEM_CLKCNT_N 0x000000FF +#define SPI_MEM_CLKCNT_N_M ((SPI_MEM_CLKCNT_N_V)<<(SPI_MEM_CLKCNT_N_S)) +#define SPI_MEM_CLKCNT_N_V 0xFF +#define SPI_MEM_CLKCNT_N_S 16 +/* SPI_MEM_CLKCNT_H : R/W ;bitpos:[15:8] ;default: 8'h1 ; */ +/*description: In the master mode it must be floor((spi_mem_clkcnt_N+1)/2-1).*/ +#define SPI_MEM_CLKCNT_H 0x000000FF +#define SPI_MEM_CLKCNT_H_M ((SPI_MEM_CLKCNT_H_V)<<(SPI_MEM_CLKCNT_H_S)) +#define SPI_MEM_CLKCNT_H_V 0xFF +#define SPI_MEM_CLKCNT_H_S 8 +/* SPI_MEM_CLKCNT_L : R/W ;bitpos:[7:0] ;default: 8'h3 ; */ +/*description: In the master mode it must be equal to spi_mem_clkcnt_N.*/ +#define SPI_MEM_CLKCNT_L 0x000000FF +#define SPI_MEM_CLKCNT_L_M ((SPI_MEM_CLKCNT_L_V)<<(SPI_MEM_CLKCNT_L_S)) +#define SPI_MEM_CLKCNT_L_V 0xFF +#define SPI_MEM_CLKCNT_L_S 0 + +#define SPI_MEM_USER_REG(i) (REG_SPI_MEM_BASE(i) + 0x018) +/* SPI_MEM_USR_COMMAND : R/W ;bitpos:[31] ;default: 1'b1 ; */ +/*description: This bit enable the command phase of an operation.*/ +#define SPI_MEM_USR_COMMAND (BIT(31)) +#define SPI_MEM_USR_COMMAND_M (BIT(31)) +#define SPI_MEM_USR_COMMAND_V 0x1 +#define SPI_MEM_USR_COMMAND_S 31 +/* SPI_MEM_USR_ADDR : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: This bit enable the address phase of an operation.*/ +#define SPI_MEM_USR_ADDR (BIT(30)) +#define SPI_MEM_USR_ADDR_M (BIT(30)) +#define SPI_MEM_USR_ADDR_V 0x1 +#define SPI_MEM_USR_ADDR_S 30 +/* SPI_MEM_USR_DUMMY : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: This bit enable the dummy phase of an operation.*/ +#define SPI_MEM_USR_DUMMY (BIT(29)) +#define SPI_MEM_USR_DUMMY_M (BIT(29)) +#define SPI_MEM_USR_DUMMY_V 0x1 +#define SPI_MEM_USR_DUMMY_S 29 +/* SPI_MEM_USR_MISO : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: This bit enable the read-data phase of an operation.*/ +#define SPI_MEM_USR_MISO (BIT(28)) +#define SPI_MEM_USR_MISO_M (BIT(28)) +#define SPI_MEM_USR_MISO_V 0x1 +#define SPI_MEM_USR_MISO_S 28 +/* SPI_MEM_USR_MOSI : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: This bit enable the write-data phase of an operation.*/ +#define SPI_MEM_USR_MOSI (BIT(27)) +#define SPI_MEM_USR_MOSI_M (BIT(27)) +#define SPI_MEM_USR_MOSI_V 0x1 +#define SPI_MEM_USR_MOSI_S 27 +/* SPI_MEM_USR_DUMMY_IDLE : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: spi clock is disable in dummy phase when the bit is enable.*/ +#define SPI_MEM_USR_DUMMY_IDLE (BIT(26)) +#define SPI_MEM_USR_DUMMY_IDLE_M (BIT(26)) +#define SPI_MEM_USR_DUMMY_IDLE_V 0x1 +#define SPI_MEM_USR_DUMMY_IDLE_S 26 +/* SPI_MEM_USR_MOSI_HIGHPART : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: write-data phase only access to high-part of the buffer spi_mem_w8~spi_mem_w15. + 1: enable 0: disable.*/ +#define SPI_MEM_USR_MOSI_HIGHPART (BIT(25)) +#define SPI_MEM_USR_MOSI_HIGHPART_M (BIT(25)) +#define SPI_MEM_USR_MOSI_HIGHPART_V 0x1 +#define SPI_MEM_USR_MOSI_HIGHPART_S 25 +/* SPI_MEM_USR_MISO_HIGHPART : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: read-data phase only access to high-part of the buffer spi_mem_w8~spi_mem_w15. + 1: enable 0: disable.*/ +#define SPI_MEM_USR_MISO_HIGHPART (BIT(24)) +#define SPI_MEM_USR_MISO_HIGHPART_M (BIT(24)) +#define SPI_MEM_USR_MISO_HIGHPART_V 0x1 +#define SPI_MEM_USR_MISO_HIGHPART_S 24 +/* SPI_MEM_FWRITE_QIO : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: In the write operations address phase and read-data phase apply 4 signals.*/ +#define SPI_MEM_FWRITE_QIO (BIT(15)) +#define SPI_MEM_FWRITE_QIO_M (BIT(15)) +#define SPI_MEM_FWRITE_QIO_V 0x1 +#define SPI_MEM_FWRITE_QIO_S 15 +/* SPI_MEM_FWRITE_DIO : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: In the write operations address phase and read-data phase apply 2 signals.*/ +#define SPI_MEM_FWRITE_DIO (BIT(14)) +#define SPI_MEM_FWRITE_DIO_M (BIT(14)) +#define SPI_MEM_FWRITE_DIO_V 0x1 +#define SPI_MEM_FWRITE_DIO_S 14 +/* SPI_MEM_FWRITE_QUAD : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: In the write operations read-data phase apply 4 signals*/ +#define SPI_MEM_FWRITE_QUAD (BIT(13)) +#define SPI_MEM_FWRITE_QUAD_M (BIT(13)) +#define SPI_MEM_FWRITE_QUAD_V 0x1 +#define SPI_MEM_FWRITE_QUAD_S 13 +/* SPI_MEM_FWRITE_DUAL : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: In the write operations read-data phase apply 2 signals*/ +#define SPI_MEM_FWRITE_DUAL (BIT(12)) +#define SPI_MEM_FWRITE_DUAL_M (BIT(12)) +#define SPI_MEM_FWRITE_DUAL_V 0x1 +#define SPI_MEM_FWRITE_DUAL_S 12 +/* SPI_MEM_CK_OUT_EDGE : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: the bit combined with spi_mem_mosi_delay_mode bits to set mosi + signal delay mode.*/ +#define SPI_MEM_CK_OUT_EDGE (BIT(9)) +#define SPI_MEM_CK_OUT_EDGE_M (BIT(9)) +#define SPI_MEM_CK_OUT_EDGE_V 0x1 +#define SPI_MEM_CK_OUT_EDGE_S 9 +/* SPI_MEM_CS_SETUP : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: spi cs is enable when spi is in prepare phase. 1: enable 0: disable.*/ +#define SPI_MEM_CS_SETUP (BIT(7)) +#define SPI_MEM_CS_SETUP_M (BIT(7)) +#define SPI_MEM_CS_SETUP_V 0x1 +#define SPI_MEM_CS_SETUP_S 7 +/* SPI_MEM_CS_HOLD : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: spi cs keep low when spi is in done phase. 1: enable 0: disable.*/ +#define SPI_MEM_CS_HOLD (BIT(6)) +#define SPI_MEM_CS_HOLD_M (BIT(6)) +#define SPI_MEM_CS_HOLD_V 0x1 +#define SPI_MEM_CS_HOLD_S 6 + +#define SPI_MEM_USER1_REG(i) (REG_SPI_MEM_BASE(i) + 0x01C) +/* SPI_MEM_USR_ADDR_BITLEN : R/W ;bitpos:[31:26] ;default: 6'd23 ; */ +/*description: The length in bits of address phase. The register value shall be (bit_num-1).*/ +#define SPI_MEM_USR_ADDR_BITLEN 0x0000003F +#define SPI_MEM_USR_ADDR_BITLEN_M ((SPI_MEM_USR_ADDR_BITLEN_V)<<(SPI_MEM_USR_ADDR_BITLEN_S)) +#define SPI_MEM_USR_ADDR_BITLEN_V 0x3F +#define SPI_MEM_USR_ADDR_BITLEN_S 26 +/* SPI_MEM_USR_DUMMY_CYCLELEN : R/W ;bitpos:[7:0] ;default: 8'd7 ; */ +/*description: The length in spi_mem_clk cycles of dummy phase. The register + value shall be (cycle_num-1).*/ +#define SPI_MEM_USR_DUMMY_CYCLELEN 0x000000FF +#define SPI_MEM_USR_DUMMY_CYCLELEN_M ((SPI_MEM_USR_DUMMY_CYCLELEN_V)<<(SPI_MEM_USR_DUMMY_CYCLELEN_S)) +#define SPI_MEM_USR_DUMMY_CYCLELEN_V 0xFF +#define SPI_MEM_USR_DUMMY_CYCLELEN_S 0 + +#define SPI_MEM_USER2_REG(i) (REG_SPI_MEM_BASE(i) + 0x020) +/* SPI_MEM_USR_COMMAND_BITLEN : R/W ;bitpos:[31:28] ;default: 4'd7 ; */ +/*description: The length in bits of command phase. The register value shall be (bit_num-1)*/ +#define SPI_MEM_USR_COMMAND_BITLEN 0x0000000F +#define SPI_MEM_USR_COMMAND_BITLEN_M ((SPI_MEM_USR_COMMAND_BITLEN_V)<<(SPI_MEM_USR_COMMAND_BITLEN_S)) +#define SPI_MEM_USR_COMMAND_BITLEN_V 0xF +#define SPI_MEM_USR_COMMAND_BITLEN_S 28 +/* SPI_MEM_USR_COMMAND_VALUE : R/W ;bitpos:[15:0] ;default: 16'b0 ; */ +/*description: The value of command.*/ +#define SPI_MEM_USR_COMMAND_VALUE 0x0000FFFF +#define SPI_MEM_USR_COMMAND_VALUE_M ((SPI_MEM_USR_COMMAND_VALUE_V)<<(SPI_MEM_USR_COMMAND_VALUE_S)) +#define SPI_MEM_USR_COMMAND_VALUE_V 0xFFFF +#define SPI_MEM_USR_COMMAND_VALUE_S 0 + +#define SPI_MEM_MOSI_DLEN_REG(i) (REG_SPI_MEM_BASE(i) + 0x024) +/* SPI_MEM_USR_MOSI_DBITLEN : R/W ;bitpos:[10:0] ;default: 11'h0 ; */ +/*description: The length in bits of write-data. The register value shall be (bit_num-1).*/ +#define SPI_MEM_USR_MOSI_DBITLEN 0x000007FF +#define SPI_MEM_USR_MOSI_DBITLEN_M ((SPI_MEM_USR_MOSI_DBITLEN_V)<<(SPI_MEM_USR_MOSI_DBITLEN_S)) +#define SPI_MEM_USR_MOSI_DBITLEN_V 0x7FF +#define SPI_MEM_USR_MOSI_DBITLEN_S 0 + +#define SPI_MEM_MISO_DLEN_REG(i) (REG_SPI_MEM_BASE(i) + 0x028) +/* SPI_MEM_USR_MISO_DBITLEN : R/W ;bitpos:[10:0] ;default: 11'h0 ; */ +/*description: The length in bits of read-data. The register value shall be (bit_num-1).*/ +#define SPI_MEM_USR_MISO_DBITLEN 0x000007FF +#define SPI_MEM_USR_MISO_DBITLEN_M ((SPI_MEM_USR_MISO_DBITLEN_V)<<(SPI_MEM_USR_MISO_DBITLEN_S)) +#define SPI_MEM_USR_MISO_DBITLEN_V 0x7FF +#define SPI_MEM_USR_MISO_DBITLEN_S 0 + +#define SPI_MEM_RD_STATUS_REG(i) (REG_SPI_MEM_BASE(i) + 0x02C) +/* SPI_MEM_WB_MODE : R/W ;bitpos:[23:16] ;default: 8'h00 ; */ +/*description: Mode bits in the flash fast read mode it is combined with spi_mem_fastrd_mode + bit.*/ +#define SPI_MEM_WB_MODE 0x000000FF +#define SPI_MEM_WB_MODE_M ((SPI_MEM_WB_MODE_V)<<(SPI_MEM_WB_MODE_S)) +#define SPI_MEM_WB_MODE_V 0xFF +#define SPI_MEM_WB_MODE_S 16 +/* SPI_MEM_STATUS : R/W ;bitpos:[15:0] ;default: 16'b0 ; */ +/*description: The value is stored when set spi_mem_flash_rdsr bit and spi_mem_flash_res bit.*/ +#define SPI_MEM_STATUS 0x0000FFFF +#define SPI_MEM_STATUS_M ((SPI_MEM_STATUS_V)<<(SPI_MEM_STATUS_S)) +#define SPI_MEM_STATUS_V 0xFFFF +#define SPI_MEM_STATUS_S 0 + +#define SPI_MEM_EXT_ADDR_REG(i) (REG_SPI_MEM_BASE(i) + 0x030) +/* SPI_MEM_EXT_ADDR : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The register are the higher 32bits in the 64 bits address mode.*/ +#define SPI_MEM_EXT_ADDR 0xFFFFFFFF +#define SPI_MEM_EXT_ADDR_M ((SPI_MEM_EXT_ADDR_V)<<(SPI_MEM_EXT_ADDR_S)) +#define SPI_MEM_EXT_ADDR_V 0xFFFFFFFF +#define SPI_MEM_EXT_ADDR_S 0 + +#define SPI_MEM_MISC_REG(i) (REG_SPI_MEM_BASE(i) + 0x034) +/* SPI_MEM_AUTO_PER : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: reserved*/ +#define SPI_MEM_AUTO_PER (BIT(11)) +#define SPI_MEM_AUTO_PER_M (BIT(11)) +#define SPI_MEM_AUTO_PER_V 0x1 +#define SPI_MEM_AUTO_PER_S 11 +/* SPI_MEM_CS_KEEP_ACTIVE : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: spi cs line keep low when the bit is set.*/ +#define SPI_MEM_CS_KEEP_ACTIVE (BIT(10)) +#define SPI_MEM_CS_KEEP_ACTIVE_M (BIT(10)) +#define SPI_MEM_CS_KEEP_ACTIVE_V 0x1 +#define SPI_MEM_CS_KEEP_ACTIVE_S 10 +/* SPI_MEM_CK_IDLE_EDGE : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: 1: spi clk line is high when idle 0: spi clk line is low when idle*/ +#define SPI_MEM_CK_IDLE_EDGE (BIT(9)) +#define SPI_MEM_CK_IDLE_EDGE_M (BIT(9)) +#define SPI_MEM_CK_IDLE_EDGE_V 0x1 +#define SPI_MEM_CK_IDLE_EDGE_S 9 +/* SPI_MEM_SSUB_PIN : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: For SPI0 sram is connected to SUBPINs.*/ +#define SPI_MEM_SSUB_PIN (BIT(8)) +#define SPI_MEM_SSUB_PIN_M (BIT(8)) +#define SPI_MEM_SSUB_PIN_V 0x1 +#define SPI_MEM_SSUB_PIN_S 8 +/* SPI_MEM_FSUB_PIN : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: For SPI0 flash is connected to SUBPINs.*/ +#define SPI_MEM_FSUB_PIN (BIT(7)) +#define SPI_MEM_FSUB_PIN_M (BIT(7)) +#define SPI_MEM_FSUB_PIN_V 0x1 +#define SPI_MEM_FSUB_PIN_S 7 +/* SPI_MEM_CS_POL : R/W ;bitpos:[6:5] ;default: 2'b0 ; */ +/*description: In the master mode the bits are the polarity of spi cs line + the value is equivalent to spi_mem_cs ^ spi_mem_master_cs_pol.*/ +#define SPI_MEM_CS_POL 0x00000003 +#define SPI_MEM_CS_POL_M ((SPI_MEM_CS_POL_V)<<(SPI_MEM_CS_POL_S)) +#define SPI_MEM_CS_POL_V 0x3 +#define SPI_MEM_CS_POL_S 5 +/* SPI_MEM_TRANS_END_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The bit is used to enable the intterrupt of SPI transmitting done.*/ +#define SPI_MEM_TRANS_END_INT_ENA (BIT(4)) +#define SPI_MEM_TRANS_END_INT_ENA_M (BIT(4)) +#define SPI_MEM_TRANS_END_INT_ENA_V 0x1 +#define SPI_MEM_TRANS_END_INT_ENA_S 4 +/* SPI_MEM_TRANS_END : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The bit is used to indicate the transimitting is done.*/ +#define SPI_MEM_TRANS_END (BIT(3)) +#define SPI_MEM_TRANS_END_M (BIT(3)) +#define SPI_MEM_TRANS_END_V 0x1 +#define SPI_MEM_TRANS_END_S 3 +/* SPI_MEM_CS1_DIS : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: SPI CS1 pin enable 1: disable CS1 0: spi_mem_cs1 signal is from/to CS1 pin*/ +#define SPI_MEM_CS1_DIS (BIT(1)) +#define SPI_MEM_CS1_DIS_M (BIT(1)) +#define SPI_MEM_CS1_DIS_V 0x1 +#define SPI_MEM_CS1_DIS_S 1 +/* SPI_MEM_CS0_DIS : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: SPI CS0 pin enable 1: disable CS0 0: spi_mem_cs0 signal is from/to CS0 pin*/ +#define SPI_MEM_CS0_DIS (BIT(0)) +#define SPI_MEM_CS0_DIS_M (BIT(0)) +#define SPI_MEM_CS0_DIS_V 0x1 +#define SPI_MEM_CS0_DIS_S 0 + +#define SPI_MEM_TX_CRC_REG(i) (REG_SPI_MEM_BASE(i) + 0x038) +/* SPI_MEM_TX_CRC_DATA : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: For SPI1 the value of crc32.*/ +#define SPI_MEM_TX_CRC_DATA 0xFFFFFFFF +#define SPI_MEM_TX_CRC_DATA_M ((SPI_MEM_TX_CRC_DATA_V)<<(SPI_MEM_TX_CRC_DATA_S)) +#define SPI_MEM_TX_CRC_DATA_V 0xFFFFFFFF +#define SPI_MEM_TX_CRC_DATA_S 0 + +#define SPI_MEM_CACHE_FCTRL_REG(i) (REG_SPI_MEM_BASE(i) + 0x03C) +/* SPI_MEM_FADDR_QUAD : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: For SPI0 flash address phase apply 4 signals. 1: enable 0: disable. + The bit is the same with spi_mem_fread_qio.*/ +#define SPI_MEM_FADDR_QUAD (BIT(8)) +#define SPI_MEM_FADDR_QUAD_M (BIT(8)) +#define SPI_MEM_FADDR_QUAD_V 0x1 +#define SPI_MEM_FADDR_QUAD_S 8 +/* SPI_MEM_FDOUT_QUAD : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: For SPI0 flash dout phase apply 4 signals. 1: enable 0: disable. + The bit is the same with spi_mem_fread_qio.*/ +#define SPI_MEM_FDOUT_QUAD (BIT(7)) +#define SPI_MEM_FDOUT_QUAD_M (BIT(7)) +#define SPI_MEM_FDOUT_QUAD_V 0x1 +#define SPI_MEM_FDOUT_QUAD_S 7 +/* SPI_MEM_FDIN_QUAD : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: For SPI0 flash din phase apply 4 signals. 1: enable 0: disable. + The bit is the same with spi_mem_fread_qio.*/ +#define SPI_MEM_FDIN_QUAD (BIT(6)) +#define SPI_MEM_FDIN_QUAD_M (BIT(6)) +#define SPI_MEM_FDIN_QUAD_V 0x1 +#define SPI_MEM_FDIN_QUAD_S 6 +/* SPI_MEM_FADDR_DUAL : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: For SPI0 flash address phase apply 2 signals. 1: enable 0: disable. + The bit is the same with spi_mem_fread_dio.*/ +#define SPI_MEM_FADDR_DUAL (BIT(5)) +#define SPI_MEM_FADDR_DUAL_M (BIT(5)) +#define SPI_MEM_FADDR_DUAL_V 0x1 +#define SPI_MEM_FADDR_DUAL_S 5 +/* SPI_MEM_FDOUT_DUAL : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: For SPI0 flash dout phase apply 2 signals. 1: enable 0: disable. + The bit is the same with spi_mem_fread_dio.*/ +#define SPI_MEM_FDOUT_DUAL (BIT(4)) +#define SPI_MEM_FDOUT_DUAL_M (BIT(4)) +#define SPI_MEM_FDOUT_DUAL_V 0x1 +#define SPI_MEM_FDOUT_DUAL_S 4 +/* SPI_MEM_FDIN_DUAL : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: For SPI0 flash din phase apply 2 signals. 1: enable 0: disable. + The bit is the same with spi_mem_fread_dio.*/ +#define SPI_MEM_FDIN_DUAL (BIT(3)) +#define SPI_MEM_FDIN_DUAL_M (BIT(3)) +#define SPI_MEM_FDIN_DUAL_V 0x1 +#define SPI_MEM_FDIN_DUAL_S 3 +/* SPI_MEM_CACHE_FLASH_USR_CMD : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: For SPI0 cache read flash for user define command 1: enable 0:disable.*/ +#define SPI_MEM_CACHE_FLASH_USR_CMD (BIT(2)) +#define SPI_MEM_CACHE_FLASH_USR_CMD_M (BIT(2)) +#define SPI_MEM_CACHE_FLASH_USR_CMD_V 0x1 +#define SPI_MEM_CACHE_FLASH_USR_CMD_S 2 +/* SPI_MEM_CACHE_USR_CMD_4BYTE : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: For SPI0 cache read flash with 4 bytes command 1: enable 0:disable.*/ +#define SPI_MEM_CACHE_USR_CMD_4BYTE (BIT(1)) +#define SPI_MEM_CACHE_USR_CMD_4BYTE_M (BIT(1)) +#define SPI_MEM_CACHE_USR_CMD_4BYTE_V 0x1 +#define SPI_MEM_CACHE_USR_CMD_4BYTE_S 1 +/* SPI_MEM_CACHE_REQ_EN : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: For SPI0 Cache access enable 1: enable 0:disable.*/ +#define SPI_MEM_CACHE_REQ_EN (BIT(0)) +#define SPI_MEM_CACHE_REQ_EN_M (BIT(0)) +#define SPI_MEM_CACHE_REQ_EN_V 0x1 +#define SPI_MEM_CACHE_REQ_EN_S 0 + +#define SPI_MEM_CACHE_SCTRL_REG(i) (REG_SPI_MEM_BASE(i) + 0x040) +/* SPI_MEM_SRAM_WDUMMY_CYCLELEN : R/W ;bitpos:[29:22] ;default: 8'b1 ; */ +/*description: For SPI0 In the sram mode it is the length in bits of write + dummy phase. The register value shall be (bit_num-1).*/ +#define SPI_MEM_SRAM_WDUMMY_CYCLELEN 0x000000FF +#define SPI_MEM_SRAM_WDUMMY_CYCLELEN_M ((SPI_MEM_SRAM_WDUMMY_CYCLELEN_V)<<(SPI_MEM_SRAM_WDUMMY_CYCLELEN_S)) +#define SPI_MEM_SRAM_WDUMMY_CYCLELEN_V 0xFF +#define SPI_MEM_SRAM_WDUMMY_CYCLELEN_S 22 +/* SPI_MEM_CACHE_SRAM_USR_WCMD : R/W ;bitpos:[20] ;default: 1'b1 ; */ +/*description: For SPI0 In the spi sram mode cache write sram for user define command*/ +#define SPI_MEM_CACHE_SRAM_USR_WCMD (BIT(20)) +#define SPI_MEM_CACHE_SRAM_USR_WCMD_M (BIT(20)) +#define SPI_MEM_CACHE_SRAM_USR_WCMD_V 0x1 +#define SPI_MEM_CACHE_SRAM_USR_WCMD_S 20 +/* SPI_MEM_SRAM_ADDR_BITLEN : R/W ;bitpos:[19:14] ;default: 6'd23 ; */ +/*description: For SPI0 In the sram mode it is the length in bits of address + phase. The register value shall be (bit_num-1).*/ +#define SPI_MEM_SRAM_ADDR_BITLEN 0x0000003F +#define SPI_MEM_SRAM_ADDR_BITLEN_M ((SPI_MEM_SRAM_ADDR_BITLEN_V)<<(SPI_MEM_SRAM_ADDR_BITLEN_S)) +#define SPI_MEM_SRAM_ADDR_BITLEN_V 0x3F +#define SPI_MEM_SRAM_ADDR_BITLEN_S 14 +/* SPI_MEM_SRAM_RDUMMY_CYCLELEN : R/W ;bitpos:[13:6] ;default: 8'b1 ; */ +/*description: For SPI0 In the sram mode it is the length in bits of read + dummy phase. The register value shall be (bit_num-1).*/ +#define SPI_MEM_SRAM_RDUMMY_CYCLELEN 0x000000FF +#define SPI_MEM_SRAM_RDUMMY_CYCLELEN_M ((SPI_MEM_SRAM_RDUMMY_CYCLELEN_V)<<(SPI_MEM_SRAM_RDUMMY_CYCLELEN_S)) +#define SPI_MEM_SRAM_RDUMMY_CYCLELEN_V 0xFF +#define SPI_MEM_SRAM_RDUMMY_CYCLELEN_S 6 +/* SPI_MEM_CACHE_SRAM_USR_RCMD : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: For SPI0 In the spi sram mode cache read sram for user define command.*/ +#define SPI_MEM_CACHE_SRAM_USR_RCMD (BIT(5)) +#define SPI_MEM_CACHE_SRAM_USR_RCMD_M (BIT(5)) +#define SPI_MEM_CACHE_SRAM_USR_RCMD_V 0x1 +#define SPI_MEM_CACHE_SRAM_USR_RCMD_S 5 +/* SPI_MEM_USR_RD_SRAM_DUMMY : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: For SPI0 In the spi sram mode it is the enable bit of dummy + phase for read operations.*/ +#define SPI_MEM_USR_RD_SRAM_DUMMY (BIT(4)) +#define SPI_MEM_USR_RD_SRAM_DUMMY_M (BIT(4)) +#define SPI_MEM_USR_RD_SRAM_DUMMY_V 0x1 +#define SPI_MEM_USR_RD_SRAM_DUMMY_S 4 +/* SPI_MEM_USR_WR_SRAM_DUMMY : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: For SPI0 In the spi sram mode it is the enable bit of dummy + phase for write operations.*/ +#define SPI_MEM_USR_WR_SRAM_DUMMY (BIT(3)) +#define SPI_MEM_USR_WR_SRAM_DUMMY_M (BIT(3)) +#define SPI_MEM_USR_WR_SRAM_DUMMY_V 0x1 +#define SPI_MEM_USR_WR_SRAM_DUMMY_S 3 +/* SPI_MEM_USR_SRAM_QIO : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: For SPI0 In the spi sram mode spi quad I/O mode enable 1: enable 0:disable*/ +#define SPI_MEM_USR_SRAM_QIO (BIT(2)) +#define SPI_MEM_USR_SRAM_QIO_M (BIT(2)) +#define SPI_MEM_USR_SRAM_QIO_V 0x1 +#define SPI_MEM_USR_SRAM_QIO_S 2 +/* SPI_MEM_USR_SRAM_DIO : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: For SPI0 In the spi sram mode spi dual I/O mode enable 1: enable 0:disable*/ +#define SPI_MEM_USR_SRAM_DIO (BIT(1)) +#define SPI_MEM_USR_SRAM_DIO_M (BIT(1)) +#define SPI_MEM_USR_SRAM_DIO_V 0x1 +#define SPI_MEM_USR_SRAM_DIO_S 1 +/* SPI_MEM_CACHE_USR_SCMD_4BYTE : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: For SPI0 In the spi sram mode cache read flash with 4 bytes + command 1: enable 0:disable.*/ +#define SPI_MEM_CACHE_USR_SCMD_4BYTE (BIT(0)) +#define SPI_MEM_CACHE_USR_SCMD_4BYTE_M (BIT(0)) +#define SPI_MEM_CACHE_USR_SCMD_4BYTE_V 0x1 +#define SPI_MEM_CACHE_USR_SCMD_4BYTE_S 0 + +#define SPI_MEM_SRAM_CMD_REG(i) (REG_SPI_MEM_BASE(i) + 0x044) +/* SPI_MEM_SCMD_QUAD : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: For SPI0 sram cmd phase apply 4 signals. 1: enable 0: disable. + The bit is the same with spi_mem_usr_sram_qio.*/ +#define SPI_MEM_SCMD_QUAD (BIT(17)) +#define SPI_MEM_SCMD_QUAD_M (BIT(17)) +#define SPI_MEM_SCMD_QUAD_V 0x1 +#define SPI_MEM_SCMD_QUAD_S 17 +/* SPI_MEM_SADDR_QUAD : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: For SPI0 sram address phase apply 4 signals. 1: enable 0: disable. + The bit is the same with spi_mem_usr_sram_qio.*/ +#define SPI_MEM_SADDR_QUAD (BIT(16)) +#define SPI_MEM_SADDR_QUAD_M (BIT(16)) +#define SPI_MEM_SADDR_QUAD_V 0x1 +#define SPI_MEM_SADDR_QUAD_S 16 +/* SPI_MEM_SDOUT_QUAD : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: For SPI0 sram dout phase apply 4 signals. 1: enable 0: disable. + The bit is the same with spi_mem_usr_sram_qio.*/ +#define SPI_MEM_SDOUT_QUAD (BIT(15)) +#define SPI_MEM_SDOUT_QUAD_M (BIT(15)) +#define SPI_MEM_SDOUT_QUAD_V 0x1 +#define SPI_MEM_SDOUT_QUAD_S 15 +/* SPI_MEM_SDIN_QUAD : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: For SPI0 sram din phase apply 4 signals. 1: enable 0: disable. + The bit is the same with spi_mem_usr_sram_qio.*/ +#define SPI_MEM_SDIN_QUAD (BIT(14)) +#define SPI_MEM_SDIN_QUAD_M (BIT(14)) +#define SPI_MEM_SDIN_QUAD_V 0x1 +#define SPI_MEM_SDIN_QUAD_S 14 +/* SPI_MEM_SCMD_DUAL : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: For SPI0 sram cmd phase apply 2 signals. 1: enable 0: disable. + The bit is the same with spi_mem_usr_sram_dio.*/ +#define SPI_MEM_SCMD_DUAL (BIT(13)) +#define SPI_MEM_SCMD_DUAL_M (BIT(13)) +#define SPI_MEM_SCMD_DUAL_V 0x1 +#define SPI_MEM_SCMD_DUAL_S 13 +/* SPI_MEM_SADDR_DUAL : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: For SPI0 sram address phase apply 2 signals. 1: enable 0: disable. + The bit is the same with spi_mem_usr_sram_dio.*/ +#define SPI_MEM_SADDR_DUAL (BIT(12)) +#define SPI_MEM_SADDR_DUAL_M (BIT(12)) +#define SPI_MEM_SADDR_DUAL_V 0x1 +#define SPI_MEM_SADDR_DUAL_S 12 +/* SPI_MEM_SDOUT_DUAL : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: For SPI0 sram dout phase apply 2 signals. 1: enable 0: disable. + The bit is the same with spi_mem_usr_sram_dio.*/ +#define SPI_MEM_SDOUT_DUAL (BIT(11)) +#define SPI_MEM_SDOUT_DUAL_M (BIT(11)) +#define SPI_MEM_SDOUT_DUAL_V 0x1 +#define SPI_MEM_SDOUT_DUAL_S 11 +/* SPI_MEM_SDIN_DUAL : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: For SPI0 sram din phase apply 2 signals. 1: enable 0: disable. + The bit is the same with spi_mem_usr_sram_dio.*/ +#define SPI_MEM_SDIN_DUAL (BIT(10)) +#define SPI_MEM_SDIN_DUAL_M (BIT(10)) +#define SPI_MEM_SDIN_DUAL_V 0x1 +#define SPI_MEM_SDIN_DUAL_S 10 +/* SPI_MEM_SWB_MODE : R/W ;bitpos:[9:2] ;default: 8'b0 ; */ +/*description: Mode bits in the psram fast read mode it is combined with spi_mem_fastrd_mode + bit.*/ +#define SPI_MEM_SWB_MODE 0x000000FF +#define SPI_MEM_SWB_MODE_M ((SPI_MEM_SWB_MODE_V)<<(SPI_MEM_SWB_MODE_S)) +#define SPI_MEM_SWB_MODE_V 0xFF +#define SPI_MEM_SWB_MODE_S 2 +/* SPI_MEM_SCLK_MODE : R/W ;bitpos:[1:0] ;default: 2'd0 ; */ +/*description: SPI clock mode bits. 0: SPI clock is off when CS inactive 1: + SPI clock is delayed one cycle after CS inactive 2: SPI clock is delayed two cycles after CS inactive 3: SPI clock is alwasy on.*/ +#define SPI_MEM_SCLK_MODE 0x00000003 +#define SPI_MEM_SCLK_MODE_M ((SPI_MEM_SCLK_MODE_V)<<(SPI_MEM_SCLK_MODE_S)) +#define SPI_MEM_SCLK_MODE_V 0x3 +#define SPI_MEM_SCLK_MODE_S 0 + +#define SPI_MEM_SRAM_DRD_CMD_REG(i) (REG_SPI_MEM_BASE(i) + 0x048) +/* SPI_MEM_CACHE_SRAM_USR_RD_CMD_BITLEN : R/W ;bitpos:[31:28] ;default: 4'h0 ; */ +/*description: For SPI0 When cache mode is enable it is the length in bits of + command phase for sram. The register value shall be (bit_num-1).*/ +#define SPI_MEM_CACHE_SRAM_USR_RD_CMD_BITLEN 0x0000000F +#define SPI_MEM_CACHE_SRAM_USR_RD_CMD_BITLEN_M ((SPI_MEM_CACHE_SRAM_USR_RD_CMD_BITLEN_V)<<(SPI_MEM_CACHE_SRAM_USR_RD_CMD_BITLEN_S)) +#define SPI_MEM_CACHE_SRAM_USR_RD_CMD_BITLEN_V 0xF +#define SPI_MEM_CACHE_SRAM_USR_RD_CMD_BITLEN_S 28 +/* SPI_MEM_CACHE_SRAM_USR_RD_CMD_VALUE : R/W ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: For SPI0 When cache mode is enable it is the read command value + of command phase for sram.*/ +#define SPI_MEM_CACHE_SRAM_USR_RD_CMD_VALUE 0x0000FFFF +#define SPI_MEM_CACHE_SRAM_USR_RD_CMD_VALUE_M ((SPI_MEM_CACHE_SRAM_USR_RD_CMD_VALUE_V)<<(SPI_MEM_CACHE_SRAM_USR_RD_CMD_VALUE_S)) +#define SPI_MEM_CACHE_SRAM_USR_RD_CMD_VALUE_V 0xFFFF +#define SPI_MEM_CACHE_SRAM_USR_RD_CMD_VALUE_S 0 + +#define SPI_MEM_SRAM_DWR_CMD_REG(i) (REG_SPI_MEM_BASE(i) + 0x04C) +/* SPI_MEM_CACHE_SRAM_USR_WR_CMD_BITLEN : R/W ;bitpos:[31:28] ;default: 4'h0 ; */ +/*description: For SPI0 When cache mode is enable it is the in bits of command + phase for sram. The register value shall be (bit_num-1).*/ +#define SPI_MEM_CACHE_SRAM_USR_WR_CMD_BITLEN 0x0000000F +#define SPI_MEM_CACHE_SRAM_USR_WR_CMD_BITLEN_M ((SPI_MEM_CACHE_SRAM_USR_WR_CMD_BITLEN_V)<<(SPI_MEM_CACHE_SRAM_USR_WR_CMD_BITLEN_S)) +#define SPI_MEM_CACHE_SRAM_USR_WR_CMD_BITLEN_V 0xF +#define SPI_MEM_CACHE_SRAM_USR_WR_CMD_BITLEN_S 28 +/* SPI_MEM_CACHE_SRAM_USR_WR_CMD_VALUE : R/W ;bitpos:[15:0] ;default: 16'h0 ; */ +/*description: For SPI0 When cache mode is enable it is the write command value + of command phase for sram.*/ +#define SPI_MEM_CACHE_SRAM_USR_WR_CMD_VALUE 0x0000FFFF +#define SPI_MEM_CACHE_SRAM_USR_WR_CMD_VALUE_M ((SPI_MEM_CACHE_SRAM_USR_WR_CMD_VALUE_V)<<(SPI_MEM_CACHE_SRAM_USR_WR_CMD_VALUE_S)) +#define SPI_MEM_CACHE_SRAM_USR_WR_CMD_VALUE_V 0xFFFF +#define SPI_MEM_CACHE_SRAM_USR_WR_CMD_VALUE_S 0 + +#define SPI_MEM_SRAM_CLK_REG(i) (REG_SPI_MEM_BASE(i) + 0x050) +/* SPI_MEM_SCLK_EQU_SYSCLK : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: For SPI0 sram interface 1: spi_mem_clk is eqaul to system 0: + spi_mem_clk is divided from system clock.*/ +#define SPI_MEM_SCLK_EQU_SYSCLK (BIT(31)) +#define SPI_MEM_SCLK_EQU_SYSCLK_M (BIT(31)) +#define SPI_MEM_SCLK_EQU_SYSCLK_V 0x1 +#define SPI_MEM_SCLK_EQU_SYSCLK_S 31 +/* SPI_MEM_SCLKCNT_N : R/W ;bitpos:[23:16] ;default: 8'h3 ; */ +/*description: For SPI0 sram interface it is the divider of spi_mem_clk. So + spi_mem_clk frequency is system/(spi_mem_clkcnt_N+1)*/ +#define SPI_MEM_SCLKCNT_N 0x000000FF +#define SPI_MEM_SCLKCNT_N_M ((SPI_MEM_SCLKCNT_N_V)<<(SPI_MEM_SCLKCNT_N_S)) +#define SPI_MEM_SCLKCNT_N_V 0xFF +#define SPI_MEM_SCLKCNT_N_S 16 +/* SPI_MEM_SCLKCNT_H : R/W ;bitpos:[15:8] ;default: 8'h1 ; */ +/*description: For SPI0 sram interface it must be floor((spi_mem_clkcnt_N+1)/2-1).*/ +#define SPI_MEM_SCLKCNT_H 0x000000FF +#define SPI_MEM_SCLKCNT_H_M ((SPI_MEM_SCLKCNT_H_V)<<(SPI_MEM_SCLKCNT_H_S)) +#define SPI_MEM_SCLKCNT_H_V 0xFF +#define SPI_MEM_SCLKCNT_H_S 8 +/* SPI_MEM_SCLKCNT_L : R/W ;bitpos:[7:0] ;default: 8'h3 ; */ +/*description: For SPI0 sram interface it must be equal to spi_mem_clkcnt_N.*/ +#define SPI_MEM_SCLKCNT_L 0x000000FF +#define SPI_MEM_SCLKCNT_L_M ((SPI_MEM_SCLKCNT_L_V)<<(SPI_MEM_SCLKCNT_L_S)) +#define SPI_MEM_SCLKCNT_L_V 0xFF +#define SPI_MEM_SCLKCNT_L_S 0 + +#define SPI_MEM_FSM_REG(i) (REG_SPI_MEM_BASE(i) + 0x054) +/* SPI_MEM_ST : RO ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: The status of spi state machine. 0: idle state 1: preparation + state 2: send command state 3: send data state 4: red data state 5:write data state 6: wait state 7: done state.*/ +#define SPI_MEM_ST 0x00000007 +#define SPI_MEM_ST_M ((SPI_MEM_ST_V)<<(SPI_MEM_ST_S)) +#define SPI_MEM_ST_V 0x7 +#define SPI_MEM_ST_S 0 + +#define SPI_MEM_HOLD_REG(i) (REG_SPI_MEM_BASE(i) + 0x058) +/* SPI_MEM_HOLD_ENA : R/W ;bitpos:[1:0] ;default: 2'd3 ; */ +/*description: This register is for two SPI masters to share the same cs clock + and data signals. The bits of one SPI are set if the other SPI is busy the SPI will be hold. 1(3): hold at idle phase 2: hold at prepare phase.*/ +#define SPI_MEM_HOLD_ENA 0x00000003 +#define SPI_MEM_HOLD_ENA_M ((SPI_MEM_HOLD_ENA_V)<<(SPI_MEM_HOLD_ENA_S)) +#define SPI_MEM_HOLD_ENA_V 0x3 +#define SPI_MEM_HOLD_ENA_S 0 + +#define SPI_MEM_DMA_CONF_REG(i) (REG_SPI_MEM_BASE(i) + 0x05C) +/* SPI_MEM_DMA_CONTINUE : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: spi dma continue tx/rx data.*/ +#define SPI_MEM_DMA_CONTINUE (BIT(16)) +#define SPI_MEM_DMA_CONTINUE_M (BIT(16)) +#define SPI_MEM_DMA_CONTINUE_V 0x1 +#define SPI_MEM_DMA_CONTINUE_S 16 +/* SPI_MEM_DMA_TX_STOP : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: spi dma write data stop when in continue tx/rx mode.*/ +#define SPI_MEM_DMA_TX_STOP (BIT(15)) +#define SPI_MEM_DMA_TX_STOP_M (BIT(15)) +#define SPI_MEM_DMA_TX_STOP_V 0x1 +#define SPI_MEM_DMA_TX_STOP_S 15 +/* SPI_MEM_DMA_RX_STOP : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: spi dma read data stop when in continue tx/rx mode.*/ +#define SPI_MEM_DMA_RX_STOP (BIT(14)) +#define SPI_MEM_DMA_RX_STOP_M (BIT(14)) +#define SPI_MEM_DMA_RX_STOP_V 0x1 +#define SPI_MEM_DMA_RX_STOP_S 14 +/* SPI_MEM_DMA_MEM_TRANS_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: reserved*/ +#define SPI_MEM_DMA_MEM_TRANS_ENA (BIT(13)) +#define SPI_MEM_DMA_MEM_TRANS_ENA_M (BIT(13)) +#define SPI_MEM_DMA_MEM_TRANS_ENA_V 0x1 +#define SPI_MEM_DMA_MEM_TRANS_ENA_S 13 +/* SPI_MEM_OUT_DATA_BURST_EN : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: spi dma read data from memory in burst mode.*/ +#define SPI_MEM_OUT_DATA_BURST_EN (BIT(12)) +#define SPI_MEM_OUT_DATA_BURST_EN_M (BIT(12)) +#define SPI_MEM_OUT_DATA_BURST_EN_V 0x1 +#define SPI_MEM_OUT_DATA_BURST_EN_S 12 +/* SPI_MEM_INDSCR_BURST_EN : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: read descriptor use burst mode when write data to memory.*/ +#define SPI_MEM_INDSCR_BURST_EN (BIT(11)) +#define SPI_MEM_INDSCR_BURST_EN_M (BIT(11)) +#define SPI_MEM_INDSCR_BURST_EN_V 0x1 +#define SPI_MEM_INDSCR_BURST_EN_S 11 +/* SPI_MEM_OUTDSCR_BURST_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: read descriptor use burst mode when read data for memory.*/ +#define SPI_MEM_OUTDSCR_BURST_EN (BIT(10)) +#define SPI_MEM_OUTDSCR_BURST_EN_M (BIT(10)) +#define SPI_MEM_OUTDSCR_BURST_EN_V 0x1 +#define SPI_MEM_OUTDSCR_BURST_EN_S 10 +/* SPI_MEM_OUT_EOF_MODE : R/W ;bitpos:[9] ;default: 1'b1 ; */ +/*description: out eof flag generation mode . 1: when dma pop all data from + fifo 0:when ahb push all data to fifo.*/ +#define SPI_MEM_OUT_EOF_MODE (BIT(9)) +#define SPI_MEM_OUT_EOF_MODE_M (BIT(9)) +#define SPI_MEM_OUT_EOF_MODE_V 0x1 +#define SPI_MEM_OUT_EOF_MODE_S 9 +/* SPI_MEM_OUT_AUTO_WRBACK : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: when the bit is set DMA continue to use the next inlink node + when the length of inlink is 0.*/ +#define SPI_MEM_OUT_AUTO_WRBACK (BIT(8)) +#define SPI_MEM_OUT_AUTO_WRBACK_M (BIT(8)) +#define SPI_MEM_OUT_AUTO_WRBACK_V 0x1 +#define SPI_MEM_OUT_AUTO_WRBACK_S 8 +/* SPI_MEM_OUT_LOOP_TEST : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: Set bit to test out link.*/ +#define SPI_MEM_OUT_LOOP_TEST (BIT(7)) +#define SPI_MEM_OUT_LOOP_TEST_M (BIT(7)) +#define SPI_MEM_OUT_LOOP_TEST_V 0x1 +#define SPI_MEM_OUT_LOOP_TEST_S 7 +/* SPI_MEM_IN_LOOP_TEST : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: Set bit to test in link.*/ +#define SPI_MEM_IN_LOOP_TEST (BIT(6)) +#define SPI_MEM_IN_LOOP_TEST_M (BIT(6)) +#define SPI_MEM_IN_LOOP_TEST_V 0x1 +#define SPI_MEM_IN_LOOP_TEST_S 6 +/* SPI_MEM_AHBM_RST : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: Reset spi dma ahb master.*/ +#define SPI_MEM_AHBM_RST (BIT(5)) +#define SPI_MEM_AHBM_RST_M (BIT(5)) +#define SPI_MEM_AHBM_RST_V 0x1 +#define SPI_MEM_AHBM_RST_S 5 +/* SPI_MEM_AHBM_FIFO_RST : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: Reset spi dma ahb master fifo pointer.*/ +#define SPI_MEM_AHBM_FIFO_RST (BIT(4)) +#define SPI_MEM_AHBM_FIFO_RST_M (BIT(4)) +#define SPI_MEM_AHBM_FIFO_RST_V 0x1 +#define SPI_MEM_AHBM_FIFO_RST_S 4 +/* SPI_MEM_OUT_RST : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The bit is used to reset out dma fsm and out data fifo pointer.*/ +#define SPI_MEM_OUT_RST (BIT(3)) +#define SPI_MEM_OUT_RST_M (BIT(3)) +#define SPI_MEM_OUT_RST_V 0x1 +#define SPI_MEM_OUT_RST_S 3 +/* SPI_MEM_IN_RST : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The bit is used to reset in dma fsm and in data fifo pointer.*/ +#define SPI_MEM_IN_RST (BIT(2)) +#define SPI_MEM_IN_RST_M (BIT(2)) +#define SPI_MEM_IN_RST_V 0x1 +#define SPI_MEM_IN_RST_S 2 +/* SPI_MEM_DMA_TX_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: spi dma tx data enable.*/ +#define SPI_MEM_DMA_TX_ENA (BIT(1)) +#define SPI_MEM_DMA_TX_ENA_M (BIT(1)) +#define SPI_MEM_DMA_TX_ENA_V 0x1 +#define SPI_MEM_DMA_TX_ENA_S 1 +/* SPI_MEM_DMA_RX_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: spi dma rx data enable.*/ +#define SPI_MEM_DMA_RX_ENA (BIT(0)) +#define SPI_MEM_DMA_RX_ENA_M (BIT(0)) +#define SPI_MEM_DMA_RX_ENA_V 0x1 +#define SPI_MEM_DMA_RX_ENA_S 0 + +#define SPI_MEM_DMA_OUT_LINK_REG(i) (REG_SPI_MEM_BASE(i) + 0x060) +/* SPI_MEM_OUTLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: Set the bit to mount on new outlink descriptors.*/ +#define SPI_MEM_OUTLINK_RESTART (BIT(30)) +#define SPI_MEM_OUTLINK_RESTART_M (BIT(30)) +#define SPI_MEM_OUTLINK_RESTART_V 0x1 +#define SPI_MEM_OUTLINK_RESTART_S 30 +/* SPI_MEM_OUTLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: Set the bit to start to use outlink descriptor.*/ +#define SPI_MEM_OUTLINK_START (BIT(29)) +#define SPI_MEM_OUTLINK_START_M (BIT(29)) +#define SPI_MEM_OUTLINK_START_V 0x1 +#define SPI_MEM_OUTLINK_START_S 29 +/* SPI_MEM_OUTLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: Set the bit to stop to use outlink descriptor.*/ +#define SPI_MEM_OUTLINK_STOP (BIT(28)) +#define SPI_MEM_OUTLINK_STOP_M (BIT(28)) +#define SPI_MEM_OUTLINK_STOP_V 0x1 +#define SPI_MEM_OUTLINK_STOP_S 28 +/* SPI_MEM_OUTLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: The address of the first outlink descriptor.*/ +#define SPI_MEM_OUTLINK_ADDR 0x000FFFFF +#define SPI_MEM_OUTLINK_ADDR_M ((SPI_MEM_OUTLINK_ADDR_V)<<(SPI_MEM_OUTLINK_ADDR_S)) +#define SPI_MEM_OUTLINK_ADDR_V 0xFFFFF +#define SPI_MEM_OUTLINK_ADDR_S 0 + +#define SPI_MEM_DMA_IN_LINK_REG(i) (REG_SPI_MEM_BASE(i) + 0x064) +/* SPI_MEM_INLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: Set the bit to mount on new inlink descriptors.*/ +#define SPI_MEM_INLINK_RESTART (BIT(30)) +#define SPI_MEM_INLINK_RESTART_M (BIT(30)) +#define SPI_MEM_INLINK_RESTART_V 0x1 +#define SPI_MEM_INLINK_RESTART_S 30 +/* SPI_MEM_INLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: Set the bit to start to use inlink descriptor.*/ +#define SPI_MEM_INLINK_START (BIT(29)) +#define SPI_MEM_INLINK_START_M (BIT(29)) +#define SPI_MEM_INLINK_START_V 0x1 +#define SPI_MEM_INLINK_START_S 29 +/* SPI_MEM_INLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: Set the bit to stop to use inlink descriptor.*/ +#define SPI_MEM_INLINK_STOP (BIT(28)) +#define SPI_MEM_INLINK_STOP_M (BIT(28)) +#define SPI_MEM_INLINK_STOP_V 0x1 +#define SPI_MEM_INLINK_STOP_S 28 +/* SPI_MEM_INLINK_AUTO_RET : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: when the bit is set the inlink descriptor returns to the first + link node when a packet is error.*/ +#define SPI_MEM_INLINK_AUTO_RET (BIT(20)) +#define SPI_MEM_INLINK_AUTO_RET_M (BIT(20)) +#define SPI_MEM_INLINK_AUTO_RET_V 0x1 +#define SPI_MEM_INLINK_AUTO_RET_S 20 +/* SPI_MEM_INLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: The address of the first inlink descriptor.*/ +#define SPI_MEM_INLINK_ADDR 0x000FFFFF +#define SPI_MEM_INLINK_ADDR_M ((SPI_MEM_INLINK_ADDR_V)<<(SPI_MEM_INLINK_ADDR_S)) +#define SPI_MEM_INLINK_ADDR_V 0xFFFFF +#define SPI_MEM_INLINK_ADDR_S 0 + +#define SPI_MEM_DMA_INT_ENA_REG(i) (REG_SPI_MEM_BASE(i) + 0x068) +/* SPI_MEM_OUT_TOTAL_EOF_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The enable bit for sending all the packets to host done.*/ +#define SPI_MEM_OUT_TOTAL_EOF_INT_ENA (BIT(8)) +#define SPI_MEM_OUT_TOTAL_EOF_INT_ENA_M (BIT(8)) +#define SPI_MEM_OUT_TOTAL_EOF_INT_ENA_V 0x1 +#define SPI_MEM_OUT_TOTAL_EOF_INT_ENA_S 8 +/* SPI_MEM_OUT_EOF_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The enable bit for sending a packet to host done.*/ +#define SPI_MEM_OUT_EOF_INT_ENA (BIT(7)) +#define SPI_MEM_OUT_EOF_INT_ENA_M (BIT(7)) +#define SPI_MEM_OUT_EOF_INT_ENA_V 0x1 +#define SPI_MEM_OUT_EOF_INT_ENA_S 7 +/* SPI_MEM_OUT_DONE_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The enable bit for completing usage of a outlink descriptor .*/ +#define SPI_MEM_OUT_DONE_INT_ENA (BIT(6)) +#define SPI_MEM_OUT_DONE_INT_ENA_M (BIT(6)) +#define SPI_MEM_OUT_DONE_INT_ENA_V 0x1 +#define SPI_MEM_OUT_DONE_INT_ENA_S 6 +/* SPI_MEM_IN_SUC_EOF_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The enable bit for completing receiving all the packets from host.*/ +#define SPI_MEM_IN_SUC_EOF_INT_ENA (BIT(5)) +#define SPI_MEM_IN_SUC_EOF_INT_ENA_M (BIT(5)) +#define SPI_MEM_IN_SUC_EOF_INT_ENA_V 0x1 +#define SPI_MEM_IN_SUC_EOF_INT_ENA_S 5 +/* SPI_MEM_IN_ERR_EOF_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The enable bit for receiving error.*/ +#define SPI_MEM_IN_ERR_EOF_INT_ENA (BIT(4)) +#define SPI_MEM_IN_ERR_EOF_INT_ENA_M (BIT(4)) +#define SPI_MEM_IN_ERR_EOF_INT_ENA_V 0x1 +#define SPI_MEM_IN_ERR_EOF_INT_ENA_S 4 +/* SPI_MEM_IN_DONE_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The enable bit for completing usage of a inlink descriptor.*/ +#define SPI_MEM_IN_DONE_INT_ENA (BIT(3)) +#define SPI_MEM_IN_DONE_INT_ENA_M (BIT(3)) +#define SPI_MEM_IN_DONE_INT_ENA_V 0x1 +#define SPI_MEM_IN_DONE_INT_ENA_S 3 +/* SPI_MEM_INLINK_DSCR_ERROR_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The enable bit for inlink descriptor error.*/ +#define SPI_MEM_INLINK_DSCR_ERROR_INT_ENA (BIT(2)) +#define SPI_MEM_INLINK_DSCR_ERROR_INT_ENA_M (BIT(2)) +#define SPI_MEM_INLINK_DSCR_ERROR_INT_ENA_V 0x1 +#define SPI_MEM_INLINK_DSCR_ERROR_INT_ENA_S 2 +/* SPI_MEM_OUTLINK_DSCR_ERROR_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The enable bit for outlink descriptor error.*/ +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_ENA (BIT(1)) +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_ENA_M (BIT(1)) +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_ENA_V 0x1 +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_ENA_S 1 +/* SPI_MEM_INLINK_DSCR_EMPTY_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The enable bit for lack of enough inlink descriptors.*/ +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_ENA (BIT(0)) +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_ENA_M (BIT(0)) +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_ENA_V 0x1 +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_ENA_S 0 + +#define SPI_MEM_DMA_INT_RAW_REG(i) (REG_SPI_MEM_BASE(i) + 0x06C) +/* SPI_MEM_OUT_TOTAL_EOF_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The raw bit for sending all the packets to host done.*/ +#define SPI_MEM_OUT_TOTAL_EOF_INT_RAW (BIT(8)) +#define SPI_MEM_OUT_TOTAL_EOF_INT_RAW_M (BIT(8)) +#define SPI_MEM_OUT_TOTAL_EOF_INT_RAW_V 0x1 +#define SPI_MEM_OUT_TOTAL_EOF_INT_RAW_S 8 +/* SPI_MEM_OUT_EOF_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The raw bit for sending a packet to host done.*/ +#define SPI_MEM_OUT_EOF_INT_RAW (BIT(7)) +#define SPI_MEM_OUT_EOF_INT_RAW_M (BIT(7)) +#define SPI_MEM_OUT_EOF_INT_RAW_V 0x1 +#define SPI_MEM_OUT_EOF_INT_RAW_S 7 +/* SPI_MEM_OUT_DONE_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The raw bit for completing usage of a outlink descriptor.*/ +#define SPI_MEM_OUT_DONE_INT_RAW (BIT(6)) +#define SPI_MEM_OUT_DONE_INT_RAW_M (BIT(6)) +#define SPI_MEM_OUT_DONE_INT_RAW_V 0x1 +#define SPI_MEM_OUT_DONE_INT_RAW_S 6 +/* SPI_MEM_IN_SUC_EOF_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The raw bit for completing receiving all the packets from host.*/ +#define SPI_MEM_IN_SUC_EOF_INT_RAW (BIT(5)) +#define SPI_MEM_IN_SUC_EOF_INT_RAW_M (BIT(5)) +#define SPI_MEM_IN_SUC_EOF_INT_RAW_V 0x1 +#define SPI_MEM_IN_SUC_EOF_INT_RAW_S 5 +/* SPI_MEM_IN_ERR_EOF_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The raw bit for receiving error.*/ +#define SPI_MEM_IN_ERR_EOF_INT_RAW (BIT(4)) +#define SPI_MEM_IN_ERR_EOF_INT_RAW_M (BIT(4)) +#define SPI_MEM_IN_ERR_EOF_INT_RAW_V 0x1 +#define SPI_MEM_IN_ERR_EOF_INT_RAW_S 4 +/* SPI_MEM_IN_DONE_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The raw bit for completing usage of a inlink descriptor.*/ +#define SPI_MEM_IN_DONE_INT_RAW (BIT(3)) +#define SPI_MEM_IN_DONE_INT_RAW_M (BIT(3)) +#define SPI_MEM_IN_DONE_INT_RAW_V 0x1 +#define SPI_MEM_IN_DONE_INT_RAW_S 3 +/* SPI_MEM_INLINK_DSCR_ERROR_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The raw bit for inlink descriptor error.*/ +#define SPI_MEM_INLINK_DSCR_ERROR_INT_RAW (BIT(2)) +#define SPI_MEM_INLINK_DSCR_ERROR_INT_RAW_M (BIT(2)) +#define SPI_MEM_INLINK_DSCR_ERROR_INT_RAW_V 0x1 +#define SPI_MEM_INLINK_DSCR_ERROR_INT_RAW_S 2 +/* SPI_MEM_OUTLINK_DSCR_ERROR_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The raw bit for outlink descriptor error.*/ +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_RAW (BIT(1)) +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_RAW_M (BIT(1)) +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_RAW_V 0x1 +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_RAW_S 1 +/* SPI_MEM_INLINK_DSCR_EMPTY_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The raw bit for lack of enough inlink descriptors.*/ +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_RAW (BIT(0)) +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_RAW_M (BIT(0)) +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_RAW_V 0x1 +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_RAW_S 0 + +#define SPI_MEM_DMA_INT_ST_REG(i) (REG_SPI_MEM_BASE(i) + 0x070) +/* SPI_MEM_OUT_TOTAL_EOF_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The status bit for sending all the packets to host done.*/ +#define SPI_MEM_OUT_TOTAL_EOF_INT_ST (BIT(8)) +#define SPI_MEM_OUT_TOTAL_EOF_INT_ST_M (BIT(8)) +#define SPI_MEM_OUT_TOTAL_EOF_INT_ST_V 0x1 +#define SPI_MEM_OUT_TOTAL_EOF_INT_ST_S 8 +/* SPI_MEM_OUT_EOF_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The status bit for sending a packet to host done.*/ +#define SPI_MEM_OUT_EOF_INT_ST (BIT(7)) +#define SPI_MEM_OUT_EOF_INT_ST_M (BIT(7)) +#define SPI_MEM_OUT_EOF_INT_ST_V 0x1 +#define SPI_MEM_OUT_EOF_INT_ST_S 7 +/* SPI_MEM_OUT_DONE_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The status bit for completing usage of a outlink descriptor.*/ +#define SPI_MEM_OUT_DONE_INT_ST (BIT(6)) +#define SPI_MEM_OUT_DONE_INT_ST_M (BIT(6)) +#define SPI_MEM_OUT_DONE_INT_ST_V 0x1 +#define SPI_MEM_OUT_DONE_INT_ST_S 6 +/* SPI_MEM_IN_SUC_EOF_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The status bit for completing receiving all the packets from host.*/ +#define SPI_MEM_IN_SUC_EOF_INT_ST (BIT(5)) +#define SPI_MEM_IN_SUC_EOF_INT_ST_M (BIT(5)) +#define SPI_MEM_IN_SUC_EOF_INT_ST_V 0x1 +#define SPI_MEM_IN_SUC_EOF_INT_ST_S 5 +/* SPI_MEM_IN_ERR_EOF_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The status bit for receiving error.*/ +#define SPI_MEM_IN_ERR_EOF_INT_ST (BIT(4)) +#define SPI_MEM_IN_ERR_EOF_INT_ST_M (BIT(4)) +#define SPI_MEM_IN_ERR_EOF_INT_ST_V 0x1 +#define SPI_MEM_IN_ERR_EOF_INT_ST_S 4 +/* SPI_MEM_IN_DONE_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The status bit for completing usage of a inlink descriptor.*/ +#define SPI_MEM_IN_DONE_INT_ST (BIT(3)) +#define SPI_MEM_IN_DONE_INT_ST_M (BIT(3)) +#define SPI_MEM_IN_DONE_INT_ST_V 0x1 +#define SPI_MEM_IN_DONE_INT_ST_S 3 +/* SPI_MEM_INLINK_DSCR_ERROR_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The status bit for inlink descriptor error.*/ +#define SPI_MEM_INLINK_DSCR_ERROR_INT_ST (BIT(2)) +#define SPI_MEM_INLINK_DSCR_ERROR_INT_ST_M (BIT(2)) +#define SPI_MEM_INLINK_DSCR_ERROR_INT_ST_V 0x1 +#define SPI_MEM_INLINK_DSCR_ERROR_INT_ST_S 2 +/* SPI_MEM_OUTLINK_DSCR_ERROR_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The status bit for outlink descriptor error.*/ +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_ST (BIT(1)) +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_ST_M (BIT(1)) +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_ST_V 0x1 +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_ST_S 1 +/* SPI_MEM_INLINK_DSCR_EMPTY_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The status bit for lack of enough inlink descriptors.*/ +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_ST (BIT(0)) +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_ST_M (BIT(0)) +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_ST_V 0x1 +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_ST_S 0 + +#define SPI_MEM_DMA_INT_CLR_REG(i) (REG_SPI_MEM_BASE(i) + 0x074) +/* SPI_MEM_OUT_TOTAL_EOF_INT_CLR : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The clear bit for sending all the packets to host done.*/ +#define SPI_MEM_OUT_TOTAL_EOF_INT_CLR (BIT(8)) +#define SPI_MEM_OUT_TOTAL_EOF_INT_CLR_M (BIT(8)) +#define SPI_MEM_OUT_TOTAL_EOF_INT_CLR_V 0x1 +#define SPI_MEM_OUT_TOTAL_EOF_INT_CLR_S 8 +/* SPI_MEM_OUT_EOF_INT_CLR : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The clear bit for sending a packet to host done.*/ +#define SPI_MEM_OUT_EOF_INT_CLR (BIT(7)) +#define SPI_MEM_OUT_EOF_INT_CLR_M (BIT(7)) +#define SPI_MEM_OUT_EOF_INT_CLR_V 0x1 +#define SPI_MEM_OUT_EOF_INT_CLR_S 7 +/* SPI_MEM_OUT_DONE_INT_CLR : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The clear bit for completing usage of a outlink descriptor.*/ +#define SPI_MEM_OUT_DONE_INT_CLR (BIT(6)) +#define SPI_MEM_OUT_DONE_INT_CLR_M (BIT(6)) +#define SPI_MEM_OUT_DONE_INT_CLR_V 0x1 +#define SPI_MEM_OUT_DONE_INT_CLR_S 6 +/* SPI_MEM_IN_SUC_EOF_INT_CLR : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The clear bit for completing receiving all the packets from host.*/ +#define SPI_MEM_IN_SUC_EOF_INT_CLR (BIT(5)) +#define SPI_MEM_IN_SUC_EOF_INT_CLR_M (BIT(5)) +#define SPI_MEM_IN_SUC_EOF_INT_CLR_V 0x1 +#define SPI_MEM_IN_SUC_EOF_INT_CLR_S 5 +/* SPI_MEM_IN_ERR_EOF_INT_CLR : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The clear bit for receiving error.*/ +#define SPI_MEM_IN_ERR_EOF_INT_CLR (BIT(4)) +#define SPI_MEM_IN_ERR_EOF_INT_CLR_M (BIT(4)) +#define SPI_MEM_IN_ERR_EOF_INT_CLR_V 0x1 +#define SPI_MEM_IN_ERR_EOF_INT_CLR_S 4 +/* SPI_MEM_IN_DONE_INT_CLR : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The clear bit for completing usage of a inlink descriptor.*/ +#define SPI_MEM_IN_DONE_INT_CLR (BIT(3)) +#define SPI_MEM_IN_DONE_INT_CLR_M (BIT(3)) +#define SPI_MEM_IN_DONE_INT_CLR_V 0x1 +#define SPI_MEM_IN_DONE_INT_CLR_S 3 +/* SPI_MEM_INLINK_DSCR_ERROR_INT_CLR : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The clear bit for inlink descriptor error.*/ +#define SPI_MEM_INLINK_DSCR_ERROR_INT_CLR (BIT(2)) +#define SPI_MEM_INLINK_DSCR_ERROR_INT_CLR_M (BIT(2)) +#define SPI_MEM_INLINK_DSCR_ERROR_INT_CLR_V 0x1 +#define SPI_MEM_INLINK_DSCR_ERROR_INT_CLR_S 2 +/* SPI_MEM_OUTLINK_DSCR_ERROR_INT_CLR : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The clear bit for outlink descriptor error.*/ +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_CLR (BIT(1)) +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_CLR_M (BIT(1)) +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_CLR_V 0x1 +#define SPI_MEM_OUTLINK_DSCR_ERROR_INT_CLR_S 1 +/* SPI_MEM_INLINK_DSCR_EMPTY_INT_CLR : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The clear bit for lack of enough inlink descriptors.*/ +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_CLR (BIT(0)) +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_CLR_M (BIT(0)) +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_CLR_V 0x1 +#define SPI_MEM_INLINK_DSCR_EMPTY_INT_CLR_S 0 + +#define SPI_MEM_IN_ERR_EOF_DES_ADDR_REG(i) (REG_SPI_MEM_BASE(i) + 0x078) +/* SPI_MEM_DMA_IN_ERR_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The inlink descriptor address when spi dma produce receiving error.*/ +#define SPI_MEM_DMA_IN_ERR_EOF_DES_ADDR 0xFFFFFFFF +#define SPI_MEM_DMA_IN_ERR_EOF_DES_ADDR_M ((SPI_MEM_DMA_IN_ERR_EOF_DES_ADDR_V)<<(SPI_MEM_DMA_IN_ERR_EOF_DES_ADDR_S)) +#define SPI_MEM_DMA_IN_ERR_EOF_DES_ADDR_V 0xFFFFFFFF +#define SPI_MEM_DMA_IN_ERR_EOF_DES_ADDR_S 0 + +#define SPI_MEM_IN_SUC_EOF_DES_ADDR_REG(i) (REG_SPI_MEM_BASE(i) + 0x07C) +/* SPI_MEM_DMA_IN_SUC_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The last inlink descriptor address when spi dma produce from_suc_eof.*/ +#define SPI_MEM_DMA_IN_SUC_EOF_DES_ADDR 0xFFFFFFFF +#define SPI_MEM_DMA_IN_SUC_EOF_DES_ADDR_M ((SPI_MEM_DMA_IN_SUC_EOF_DES_ADDR_V)<<(SPI_MEM_DMA_IN_SUC_EOF_DES_ADDR_S)) +#define SPI_MEM_DMA_IN_SUC_EOF_DES_ADDR_V 0xFFFFFFFF +#define SPI_MEM_DMA_IN_SUC_EOF_DES_ADDR_S 0 + +#define SPI_MEM_INLINK_DSCR_REG(i) (REG_SPI_MEM_BASE(i) + 0x080) +/* SPI_MEM_DMA_INLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of current in descriptor pointer.*/ +#define SPI_MEM_DMA_INLINK_DSCR 0xFFFFFFFF +#define SPI_MEM_DMA_INLINK_DSCR_M ((SPI_MEM_DMA_INLINK_DSCR_V)<<(SPI_MEM_DMA_INLINK_DSCR_S)) +#define SPI_MEM_DMA_INLINK_DSCR_V 0xFFFFFFFF +#define SPI_MEM_DMA_INLINK_DSCR_S 0 + +#define SPI_MEM_INLINK_DSCR_BF0_REG(i) (REG_SPI_MEM_BASE(i) + 0x084) +/* SPI_MEM_DMA_INLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of next in descriptor pointer.*/ +#define SPI_MEM_DMA_INLINK_DSCR_BF0 0xFFFFFFFF +#define SPI_MEM_DMA_INLINK_DSCR_BF0_M ((SPI_MEM_DMA_INLINK_DSCR_BF0_V)<<(SPI_MEM_DMA_INLINK_DSCR_BF0_S)) +#define SPI_MEM_DMA_INLINK_DSCR_BF0_V 0xFFFFFFFF +#define SPI_MEM_DMA_INLINK_DSCR_BF0_S 0 + +#define SPI_MEM_INLINK_DSCR_BF1_REG(i) (REG_SPI_MEM_BASE(i) + 0x088) +/* SPI_MEM_DMA_INLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of current in descriptor data buffer pointer.*/ +#define SPI_MEM_DMA_INLINK_DSCR_BF1 0xFFFFFFFF +#define SPI_MEM_DMA_INLINK_DSCR_BF1_M ((SPI_MEM_DMA_INLINK_DSCR_BF1_V)<<(SPI_MEM_DMA_INLINK_DSCR_BF1_S)) +#define SPI_MEM_DMA_INLINK_DSCR_BF1_V 0xFFFFFFFF +#define SPI_MEM_DMA_INLINK_DSCR_BF1_S 0 + +#define SPI_MEM_OUT_EOF_BFR_DES_ADDR_REG(i) (REG_SPI_MEM_BASE(i) + 0x08C) +/* SPI_MEM_DMA_OUT_EOF_BFR_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The address of buffer relative to the outlink descriptor that produce eof.*/ +#define SPI_MEM_DMA_OUT_EOF_BFR_DES_ADDR 0xFFFFFFFF +#define SPI_MEM_DMA_OUT_EOF_BFR_DES_ADDR_M ((SPI_MEM_DMA_OUT_EOF_BFR_DES_ADDR_V)<<(SPI_MEM_DMA_OUT_EOF_BFR_DES_ADDR_S)) +#define SPI_MEM_DMA_OUT_EOF_BFR_DES_ADDR_V 0xFFFFFFFF +#define SPI_MEM_DMA_OUT_EOF_BFR_DES_ADDR_S 0 + +#define SPI_MEM_OUT_EOF_DES_ADDR_REG(i) (REG_SPI_MEM_BASE(i) + 0x090) +/* SPI_MEM_DMA_OUT_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The last outlink descriptor address when spi dma produce to_eof.*/ +#define SPI_MEM_DMA_OUT_EOF_DES_ADDR 0xFFFFFFFF +#define SPI_MEM_DMA_OUT_EOF_DES_ADDR_M ((SPI_MEM_DMA_OUT_EOF_DES_ADDR_V)<<(SPI_MEM_DMA_OUT_EOF_DES_ADDR_S)) +#define SPI_MEM_DMA_OUT_EOF_DES_ADDR_V 0xFFFFFFFF +#define SPI_MEM_DMA_OUT_EOF_DES_ADDR_S 0 + +#define SPI_MEM_OUTLINK_DSCR_REG(i) (REG_SPI_MEM_BASE(i) + 0x094) +/* SPI_MEM_DMA_OUTLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of current out descriptor pointer.*/ +#define SPI_MEM_DMA_OUTLINK_DSCR 0xFFFFFFFF +#define SPI_MEM_DMA_OUTLINK_DSCR_M ((SPI_MEM_DMA_OUTLINK_DSCR_V)<<(SPI_MEM_DMA_OUTLINK_DSCR_S)) +#define SPI_MEM_DMA_OUTLINK_DSCR_V 0xFFFFFFFF +#define SPI_MEM_DMA_OUTLINK_DSCR_S 0 + +#define SPI_MEM_OUTLINK_DSCR_BF0_REG(i) (REG_SPI_MEM_BASE(i) + 0x098) +/* SPI_MEM_DMA_OUTLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of next out descriptor pointer.*/ +#define SPI_MEM_DMA_OUTLINK_DSCR_BF0 0xFFFFFFFF +#define SPI_MEM_DMA_OUTLINK_DSCR_BF0_M ((SPI_MEM_DMA_OUTLINK_DSCR_BF0_V)<<(SPI_MEM_DMA_OUTLINK_DSCR_BF0_S)) +#define SPI_MEM_DMA_OUTLINK_DSCR_BF0_V 0xFFFFFFFF +#define SPI_MEM_DMA_OUTLINK_DSCR_BF0_S 0 + +#define SPI_MEM_OUTLINK_DSCR_BF1_REG(i) (REG_SPI_MEM_BASE(i) + 0x09C) +/* SPI_MEM_DMA_OUTLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of current out descriptor data buffer pointer.*/ +#define SPI_MEM_DMA_OUTLINK_DSCR_BF1 0xFFFFFFFF +#define SPI_MEM_DMA_OUTLINK_DSCR_BF1_M ((SPI_MEM_DMA_OUTLINK_DSCR_BF1_V)<<(SPI_MEM_DMA_OUTLINK_DSCR_BF1_S)) +#define SPI_MEM_DMA_OUTLINK_DSCR_BF1_V 0xFFFFFFFF +#define SPI_MEM_DMA_OUTLINK_DSCR_BF1_S 0 + +#define SPI_MEM_DMA_OUTSTATUS_REG(i) (REG_SPI_MEM_BASE(i) + 0x0A0) +/* SPI_MEM_DMA_OUTFIFO_EMPTY : RO ;bitpos:[31] ;default: 1'b1 ; */ +/*description: SPI dma outfifo is empty.*/ +#define SPI_MEM_DMA_OUTFIFO_EMPTY (BIT(31)) +#define SPI_MEM_DMA_OUTFIFO_EMPTY_M (BIT(31)) +#define SPI_MEM_DMA_OUTFIFO_EMPTY_V 0x1 +#define SPI_MEM_DMA_OUTFIFO_EMPTY_S 31 +/* SPI_MEM_DMA_OUTFIFO_FULL : RO ;bitpos:[30] ;default: 1'b0 ; */ +/*description: SPI dma outfifo is full.*/ +#define SPI_MEM_DMA_OUTFIFO_FULL (BIT(30)) +#define SPI_MEM_DMA_OUTFIFO_FULL_M (BIT(30)) +#define SPI_MEM_DMA_OUTFIFO_FULL_V 0x1 +#define SPI_MEM_DMA_OUTFIFO_FULL_S 30 +/* SPI_MEM_DMA_OUTFIFO_CNT : RO ;bitpos:[29:23] ;default: 7'b0 ; */ +/*description: The remains of SPI dma outfifo data.*/ +#define SPI_MEM_DMA_OUTFIFO_CNT 0x0000007F +#define SPI_MEM_DMA_OUTFIFO_CNT_M ((SPI_MEM_DMA_OUTFIFO_CNT_V)<<(SPI_MEM_DMA_OUTFIFO_CNT_S)) +#define SPI_MEM_DMA_OUTFIFO_CNT_V 0x7F +#define SPI_MEM_DMA_OUTFIFO_CNT_S 23 +/* SPI_MEM_DMA_OUT_STATE : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: SPI dma out data state.*/ +#define SPI_MEM_DMA_OUT_STATE 0x00000007 +#define SPI_MEM_DMA_OUT_STATE_M ((SPI_MEM_DMA_OUT_STATE_V)<<(SPI_MEM_DMA_OUT_STATE_S)) +#define SPI_MEM_DMA_OUT_STATE_V 0x7 +#define SPI_MEM_DMA_OUT_STATE_S 20 +/* SPI_MEM_DMA_OUTDSCR_STATE : RO ;bitpos:[19:18] ;default: 2'b0 ; */ +/*description: SPI dma out descriptor state.*/ +#define SPI_MEM_DMA_OUTDSCR_STATE 0x00000003 +#define SPI_MEM_DMA_OUTDSCR_STATE_M ((SPI_MEM_DMA_OUTDSCR_STATE_V)<<(SPI_MEM_DMA_OUTDSCR_STATE_S)) +#define SPI_MEM_DMA_OUTDSCR_STATE_V 0x3 +#define SPI_MEM_DMA_OUTDSCR_STATE_S 18 +/* SPI_MEM_DMA_OUTDSCR_ADDR : RO ;bitpos:[17:0] ;default: 18'b0 ; */ +/*description: SPI dma out descriptor address.*/ +#define SPI_MEM_DMA_OUTDSCR_ADDR 0x0003FFFF +#define SPI_MEM_DMA_OUTDSCR_ADDR_M ((SPI_MEM_DMA_OUTDSCR_ADDR_V)<<(SPI_MEM_DMA_OUTDSCR_ADDR_S)) +#define SPI_MEM_DMA_OUTDSCR_ADDR_V 0x3FFFF +#define SPI_MEM_DMA_OUTDSCR_ADDR_S 0 + +#define SPI_MEM_DMA_INSTATUS_REG(i) (REG_SPI_MEM_BASE(i) + 0x0A4) +/* SPI_MEM_DMA_INFIFO_EMPTY : RO ;bitpos:[31] ;default: 1'b1 ; */ +/*description: SPI dma infifo is empty.*/ +#define SPI_MEM_DMA_INFIFO_EMPTY (BIT(31)) +#define SPI_MEM_DMA_INFIFO_EMPTY_M (BIT(31)) +#define SPI_MEM_DMA_INFIFO_EMPTY_V 0x1 +#define SPI_MEM_DMA_INFIFO_EMPTY_S 31 +/* SPI_MEM_DMA_INFIFO_FULL : RO ;bitpos:[30] ;default: 1'b0 ; */ +/*description: SPI dma infifo is full.*/ +#define SPI_MEM_DMA_INFIFO_FULL (BIT(30)) +#define SPI_MEM_DMA_INFIFO_FULL_M (BIT(30)) +#define SPI_MEM_DMA_INFIFO_FULL_V 0x1 +#define SPI_MEM_DMA_INFIFO_FULL_S 30 +/* SPI_MEM_DMA_INFIFO_CNT : RO ;bitpos:[29:23] ;default: 7'b0 ; */ +/*description: The remains of SPI dma infifo data.*/ +#define SPI_MEM_DMA_INFIFO_CNT 0x0000007F +#define SPI_MEM_DMA_INFIFO_CNT_M ((SPI_MEM_DMA_INFIFO_CNT_V)<<(SPI_MEM_DMA_INFIFO_CNT_S)) +#define SPI_MEM_DMA_INFIFO_CNT_V 0x7F +#define SPI_MEM_DMA_INFIFO_CNT_S 23 +/* SPI_MEM_DMA_IN_STATE : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: SPI dma in data state.*/ +#define SPI_MEM_DMA_IN_STATE 0x00000007 +#define SPI_MEM_DMA_IN_STATE_M ((SPI_MEM_DMA_IN_STATE_V)<<(SPI_MEM_DMA_IN_STATE_S)) +#define SPI_MEM_DMA_IN_STATE_V 0x7 +#define SPI_MEM_DMA_IN_STATE_S 20 +/* SPI_MEM_DMA_INDSCR_STATE : RO ;bitpos:[19:18] ;default: 2'b0 ; */ +/*description: SPI dma in descriptor state.*/ +#define SPI_MEM_DMA_INDSCR_STATE 0x00000003 +#define SPI_MEM_DMA_INDSCR_STATE_M ((SPI_MEM_DMA_INDSCR_STATE_V)<<(SPI_MEM_DMA_INDSCR_STATE_S)) +#define SPI_MEM_DMA_INDSCR_STATE_V 0x3 +#define SPI_MEM_DMA_INDSCR_STATE_S 18 +/* SPI_MEM_DMA_INDSCR_ADDR : RO ;bitpos:[17:0] ;default: 18'b0 ; */ +/*description: SPI dma in descriptor address.*/ +#define SPI_MEM_DMA_INDSCR_ADDR 0x0003FFFF +#define SPI_MEM_DMA_INDSCR_ADDR_M ((SPI_MEM_DMA_INDSCR_ADDR_V)<<(SPI_MEM_DMA_INDSCR_ADDR_S)) +#define SPI_MEM_DMA_INDSCR_ADDR_V 0x3FFFF +#define SPI_MEM_DMA_INDSCR_ADDR_S 0 + +#define SPI_MEM_W0_REG(i) (REG_SPI_MEM_BASE(i) + 0x0A8) +/* SPI_MEM_BUF0 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF0 0xFFFFFFFF +#define SPI_MEM_BUF0_M ((SPI_MEM_BUF0_V)<<(SPI_MEM_BUF0_S)) +#define SPI_MEM_BUF0_V 0xFFFFFFFF +#define SPI_MEM_BUF0_S 0 + +#define SPI_MEM_W1_REG(i) (REG_SPI_MEM_BASE(i) + 0x0AC) +/* SPI_MEM_BUF1 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF1 0xFFFFFFFF +#define SPI_MEM_BUF1_M ((SPI_MEM_BUF1_V)<<(SPI_MEM_BUF1_S)) +#define SPI_MEM_BUF1_V 0xFFFFFFFF +#define SPI_MEM_BUF1_S 0 + +#define SPI_MEM_W2_REG(i) (REG_SPI_MEM_BASE(i) + 0x0B0) +/* SPI_MEM_BUF2 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF2 0xFFFFFFFF +#define SPI_MEM_BUF2_M ((SPI_MEM_BUF2_V)<<(SPI_MEM_BUF2_S)) +#define SPI_MEM_BUF2_V 0xFFFFFFFF +#define SPI_MEM_BUF2_S 0 + +#define SPI_MEM_W3_REG(i) (REG_SPI_MEM_BASE(i) + 0x0B4) +/* SPI_MEM_BUF3 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF3 0xFFFFFFFF +#define SPI_MEM_BUF3_M ((SPI_MEM_BUF3_V)<<(SPI_MEM_BUF3_S)) +#define SPI_MEM_BUF3_V 0xFFFFFFFF +#define SPI_MEM_BUF3_S 0 + +#define SPI_MEM_W4_REG(i) (REG_SPI_MEM_BASE(i) + 0x0B8) +/* SPI_MEM_BUF4 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF4 0xFFFFFFFF +#define SPI_MEM_BUF4_M ((SPI_MEM_BUF4_V)<<(SPI_MEM_BUF4_S)) +#define SPI_MEM_BUF4_V 0xFFFFFFFF +#define SPI_MEM_BUF4_S 0 + +#define SPI_MEM_W5_REG(i) (REG_SPI_MEM_BASE(i) + 0x0BC) +/* SPI_MEM_BUF5 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF5 0xFFFFFFFF +#define SPI_MEM_BUF5_M ((SPI_MEM_BUF5_V)<<(SPI_MEM_BUF5_S)) +#define SPI_MEM_BUF5_V 0xFFFFFFFF +#define SPI_MEM_BUF5_S 0 + +#define SPI_MEM_W6_REG(i) (REG_SPI_MEM_BASE(i) + 0x0C0) +/* SPI_MEM_BUF6 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF6 0xFFFFFFFF +#define SPI_MEM_BUF6_M ((SPI_MEM_BUF6_V)<<(SPI_MEM_BUF6_S)) +#define SPI_MEM_BUF6_V 0xFFFFFFFF +#define SPI_MEM_BUF6_S 0 + +#define SPI_MEM_W7_REG(i) (REG_SPI_MEM_BASE(i) + 0x0C4) +/* SPI_MEM_BUF7 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF7 0xFFFFFFFF +#define SPI_MEM_BUF7_M ((SPI_MEM_BUF7_V)<<(SPI_MEM_BUF7_S)) +#define SPI_MEM_BUF7_V 0xFFFFFFFF +#define SPI_MEM_BUF7_S 0 + +#define SPI_MEM_W8_REG(i) (REG_SPI_MEM_BASE(i) + 0x0C8) +/* SPI_MEM_BUF8 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF8 0xFFFFFFFF +#define SPI_MEM_BUF8_M ((SPI_MEM_BUF8_V)<<(SPI_MEM_BUF8_S)) +#define SPI_MEM_BUF8_V 0xFFFFFFFF +#define SPI_MEM_BUF8_S 0 + +#define SPI_MEM_W9_REG(i) (REG_SPI_MEM_BASE(i) + 0x0CC) +/* SPI_MEM_BUF9 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF9 0xFFFFFFFF +#define SPI_MEM_BUF9_M ((SPI_MEM_BUF9_V)<<(SPI_MEM_BUF9_S)) +#define SPI_MEM_BUF9_V 0xFFFFFFFF +#define SPI_MEM_BUF9_S 0 + +#define SPI_MEM_W10_REG(i) (REG_SPI_MEM_BASE(i) + 0x0D0) +/* SPI_MEM_BUF10 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF10 0xFFFFFFFF +#define SPI_MEM_BUF10_M ((SPI_MEM_BUF10_V)<<(SPI_MEM_BUF10_S)) +#define SPI_MEM_BUF10_V 0xFFFFFFFF +#define SPI_MEM_BUF10_S 0 + +#define SPI_MEM_W11_REG(i) (REG_SPI_MEM_BASE(i) + 0x0D4) +/* SPI_MEM_BUF11 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF11 0xFFFFFFFF +#define SPI_MEM_BUF11_M ((SPI_MEM_BUF11_V)<<(SPI_MEM_BUF11_S)) +#define SPI_MEM_BUF11_V 0xFFFFFFFF +#define SPI_MEM_BUF11_S 0 + +#define SPI_MEM_W12_REG(i) (REG_SPI_MEM_BASE(i) + 0x0D8) +/* SPI_MEM_BUF12 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF12 0xFFFFFFFF +#define SPI_MEM_BUF12_M ((SPI_MEM_BUF12_V)<<(SPI_MEM_BUF12_S)) +#define SPI_MEM_BUF12_V 0xFFFFFFFF +#define SPI_MEM_BUF12_S 0 + +#define SPI_MEM_W13_REG(i) (REG_SPI_MEM_BASE(i) + 0x0DC) +/* SPI_MEM_BUF13 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF13 0xFFFFFFFF +#define SPI_MEM_BUF13_M ((SPI_MEM_BUF13_V)<<(SPI_MEM_BUF13_S)) +#define SPI_MEM_BUF13_V 0xFFFFFFFF +#define SPI_MEM_BUF13_S 0 + +#define SPI_MEM_W14_REG(i) (REG_SPI_MEM_BASE(i) + 0x0E0) +/* SPI_MEM_BUF14 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF14 0xFFFFFFFF +#define SPI_MEM_BUF14_M ((SPI_MEM_BUF14_V)<<(SPI_MEM_BUF14_S)) +#define SPI_MEM_BUF14_V 0xFFFFFFFF +#define SPI_MEM_BUF14_S 0 + +#define SPI_MEM_W15_REG(i) (REG_SPI_MEM_BASE(i) + 0x0E4) +/* SPI_MEM_BUF15 : SRW ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_MEM_BUF15 0xFFFFFFFF +#define SPI_MEM_BUF15_M ((SPI_MEM_BUF15_V)<<(SPI_MEM_BUF15_S)) +#define SPI_MEM_BUF15_V 0xFFFFFFFF +#define SPI_MEM_BUF15_S 0 + +#define SPI_MEM_FLASH_WAITI_CTRL_REG(i) (REG_SPI_MEM_BASE(i) + 0x0E8) +/* SPI_MEM_WAITI_DUMMY_CYCLELEN : R/W ;bitpos:[17:10] ;default: 8'h0 ; */ +/*description: The dummy cycle length when auto wait flash idle*/ +#define SPI_MEM_WAITI_DUMMY_CYCLELEN 0x000000FF +#define SPI_MEM_WAITI_DUMMY_CYCLELEN_M ((SPI_MEM_WAITI_DUMMY_CYCLELEN_V)<<(SPI_MEM_WAITI_DUMMY_CYCLELEN_S)) +#define SPI_MEM_WAITI_DUMMY_CYCLELEN_V 0xFF +#define SPI_MEM_WAITI_DUMMY_CYCLELEN_S 10 +/* SPI_MEM_WAITI_CMD : R/W ;bitpos:[9:2] ;default: 8'h05 ; */ +/*description: The command to auto wait idle*/ +#define SPI_MEM_WAITI_CMD 0x000000FF +#define SPI_MEM_WAITI_CMD_M ((SPI_MEM_WAITI_CMD_V)<<(SPI_MEM_WAITI_CMD_S)) +#define SPI_MEM_WAITI_CMD_V 0xFF +#define SPI_MEM_WAITI_CMD_S 2 +/* SPI_MEM_WAITI_DUMMY : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The dummy phase enable when auto wait flash idle*/ +#define SPI_MEM_WAITI_DUMMY (BIT(1)) +#define SPI_MEM_WAITI_DUMMY_M (BIT(1)) +#define SPI_MEM_WAITI_DUMMY_V 0x1 +#define SPI_MEM_WAITI_DUMMY_S 1 +/* SPI_MEM_WAITI_EN : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: auto-waiting flash idle operation when program flash or erase + flash. 1: enable 0: disable.*/ +#define SPI_MEM_WAITI_EN (BIT(0)) +#define SPI_MEM_WAITI_EN_M (BIT(0)) +#define SPI_MEM_WAITI_EN_V 0x1 +#define SPI_MEM_WAITI_EN_S 0 + +#define SPI_MEM_FLASH_SUS_CMD_REG(i) (REG_SPI_MEM_BASE(i) + 0x0EC) +/* SPI_MEM_FLASH_PES : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: program erase suspend bit program erase suspend operation will + be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_PES (BIT(1)) +#define SPI_MEM_FLASH_PES_M (BIT(1)) +#define SPI_MEM_FLASH_PES_V 0x1 +#define SPI_MEM_FLASH_PES_S 1 +/* SPI_MEM_FLASH_PER : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: program erase resume bit program erase suspend operation will + be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_MEM_FLASH_PER (BIT(0)) +#define SPI_MEM_FLASH_PER_M (BIT(0)) +#define SPI_MEM_FLASH_PER_V 0x1 +#define SPI_MEM_FLASH_PER_S 0 + +#define SPI_MEM_FLASH_SUS_CTRL_REG(i) (REG_SPI_MEM_BASE(i) + 0x0F0) +/* SPI_MEM_FLASH_PES_COMMAND : R/W ;bitpos:[16:9] ;default: 8'h75 ; */ +/*description: Program/Erase suspend command.*/ +#define SPI_MEM_FLASH_PES_COMMAND 0x000000FF +#define SPI_MEM_FLASH_PES_COMMAND_M ((SPI_MEM_FLASH_PES_COMMAND_V)<<(SPI_MEM_FLASH_PES_COMMAND_S)) +#define SPI_MEM_FLASH_PES_COMMAND_V 0xFF +#define SPI_MEM_FLASH_PES_COMMAND_S 9 +/* SPI_MEM_FLASH_PER_COMMAND : R/W ;bitpos:[8:1] ;default: 8'h7a ; */ +/*description: Program/Erase resume command.*/ +#define SPI_MEM_FLASH_PER_COMMAND 0x000000FF +#define SPI_MEM_FLASH_PER_COMMAND_M ((SPI_MEM_FLASH_PER_COMMAND_V)<<(SPI_MEM_FLASH_PER_COMMAND_S)) +#define SPI_MEM_FLASH_PER_COMMAND_V 0xFF +#define SPI_MEM_FLASH_PER_COMMAND_S 1 +/* SPI_MEM_FLASH_PES_EN : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: Auto-suspending enable*/ +#define SPI_MEM_FLASH_PES_EN (BIT(0)) +#define SPI_MEM_FLASH_PES_EN_M (BIT(0)) +#define SPI_MEM_FLASH_PES_EN_V 0x1 +#define SPI_MEM_FLASH_PES_EN_S 0 + +#define SPI_MEM_SUS_STATUS_REG(i) (REG_SPI_MEM_BASE(i) + 0x0F4) +/* SPI_MEM_FLASH_SUS : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: The status of flash suspend only used in SPI1.*/ +#define SPI_MEM_FLASH_SUS (BIT(0)) +#define SPI_MEM_FLASH_SUS_M (BIT(0)) +#define SPI_MEM_FLASH_SUS_V 0x1 +#define SPI_MEM_FLASH_SUS_S 0 + +#define SPI_MEM_TIMING_CALI_REG(i) (REG_SPI_MEM_BASE(i) + 0x0F8) +/* SPI_MEM_EXTRA_DUMMY_CYCLELEN : R/W ;bitpos:[3:2] ;default: 2'd0 ; */ +/*description: add extra dummy spi clock cycle length for spi clock calibration.*/ +#define SPI_MEM_EXTRA_DUMMY_CYCLELEN 0x00000003 +#define SPI_MEM_EXTRA_DUMMY_CYCLELEN_M ((SPI_MEM_EXTRA_DUMMY_CYCLELEN_V)<<(SPI_MEM_EXTRA_DUMMY_CYCLELEN_S)) +#define SPI_MEM_EXTRA_DUMMY_CYCLELEN_V 0x3 +#define SPI_MEM_EXTRA_DUMMY_CYCLELEN_S 2 +/* SPI_MEM_TIMING_CALI : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The bit is used to enable timing auto-calibration for all reading operations.*/ +#define SPI_MEM_TIMING_CALI (BIT(1)) +#define SPI_MEM_TIMING_CALI_M (BIT(1)) +#define SPI_MEM_TIMING_CALI_V 0x1 +#define SPI_MEM_TIMING_CALI_S 1 +/* SPI_MEM_TIMING_CLK_ENA : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: The bit is used to enable timing adjust clock for all reading operations.*/ +#define SPI_MEM_TIMING_CLK_ENA (BIT(0)) +#define SPI_MEM_TIMING_CLK_ENA_M (BIT(0)) +#define SPI_MEM_TIMING_CLK_ENA_V 0x1 +#define SPI_MEM_TIMING_CLK_ENA_S 0 + +#define SPI_MEM_DIN_MODE_REG(i) (REG_SPI_MEM_BASE(i) + 0x0FC) +/* SPI_MEM_DIN3_MODE : R/W ;bitpos:[11:9] ;default: 3'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the posedge of clk_160 4 input with the negedge of clk_160 5: input with the spi_clk high edge 6: input with the spi_clk low edge*/ +#define SPI_MEM_DIN3_MODE 0x00000007 +#define SPI_MEM_DIN3_MODE_M ((SPI_MEM_DIN3_MODE_V)<<(SPI_MEM_DIN3_MODE_S)) +#define SPI_MEM_DIN3_MODE_V 0x7 +#define SPI_MEM_DIN3_MODE_S 9 +/* SPI_MEM_DIN2_MODE : R/W ;bitpos:[8:6] ;default: 3'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the posedge of clk_160 4 input with the negedge of clk_160 5: input with the spi_clk high edge 6: input with the spi_clk low edge*/ +#define SPI_MEM_DIN2_MODE 0x00000007 +#define SPI_MEM_DIN2_MODE_M ((SPI_MEM_DIN2_MODE_V)<<(SPI_MEM_DIN2_MODE_S)) +#define SPI_MEM_DIN2_MODE_V 0x7 +#define SPI_MEM_DIN2_MODE_S 6 +/* SPI_MEM_DIN1_MODE : R/W ;bitpos:[5:3] ;default: 3'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the posedge of clk_160 4 input with the negedge of clk_160 5: input with the spi_clk high edge 6: input with the spi_clk low edge*/ +#define SPI_MEM_DIN1_MODE 0x00000007 +#define SPI_MEM_DIN1_MODE_M ((SPI_MEM_DIN1_MODE_V)<<(SPI_MEM_DIN1_MODE_S)) +#define SPI_MEM_DIN1_MODE_V 0x7 +#define SPI_MEM_DIN1_MODE_S 3 +/* SPI_MEM_DIN0_MODE : R/W ;bitpos:[2:0] ;default: 3'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the posedge of clk_160 4 input with the negedge of clk_160 5: input with the spi_clk high edge 6: input with the spi_clk low edge*/ +#define SPI_MEM_DIN0_MODE 0x00000007 +#define SPI_MEM_DIN0_MODE_M ((SPI_MEM_DIN0_MODE_V)<<(SPI_MEM_DIN0_MODE_S)) +#define SPI_MEM_DIN0_MODE_V 0x7 +#define SPI_MEM_DIN0_MODE_S 0 + +#define SPI_MEM_DIN_NUM_REG(i) (REG_SPI_MEM_BASE(i) + 0x100) +/* SPI_MEM_DIN3_NUM : R/W ;bitpos:[7:6] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_MEM_DIN3_NUM 0x00000003 +#define SPI_MEM_DIN3_NUM_M ((SPI_MEM_DIN3_NUM_V)<<(SPI_MEM_DIN3_NUM_S)) +#define SPI_MEM_DIN3_NUM_V 0x3 +#define SPI_MEM_DIN3_NUM_S 6 +/* SPI_MEM_DIN2_NUM : R/W ;bitpos:[5:4] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_MEM_DIN2_NUM 0x00000003 +#define SPI_MEM_DIN2_NUM_M ((SPI_MEM_DIN2_NUM_V)<<(SPI_MEM_DIN2_NUM_S)) +#define SPI_MEM_DIN2_NUM_V 0x3 +#define SPI_MEM_DIN2_NUM_S 4 +/* SPI_MEM_DIN1_NUM : R/W ;bitpos:[3:2] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_MEM_DIN1_NUM 0x00000003 +#define SPI_MEM_DIN1_NUM_M ((SPI_MEM_DIN1_NUM_V)<<(SPI_MEM_DIN1_NUM_S)) +#define SPI_MEM_DIN1_NUM_V 0x3 +#define SPI_MEM_DIN1_NUM_S 2 +/* SPI_MEM_DIN0_NUM : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_MEM_DIN0_NUM 0x00000003 +#define SPI_MEM_DIN0_NUM_M ((SPI_MEM_DIN0_NUM_V)<<(SPI_MEM_DIN0_NUM_S)) +#define SPI_MEM_DIN0_NUM_V 0x3 +#define SPI_MEM_DIN0_NUM_S 0 + +#define SPI_MEM_DOUT_MODE_REG(i) (REG_SPI_MEM_BASE(i) + 0x104) +/* SPI_MEM_DOUT3_MODE : R/W ;bitpos:[11:9] ;default: 3'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the posedge of clk_160 4 output with the negedge of clk_160 5: output with the spi_clk high edge 6: output with the spi_clk low edge*/ +#define SPI_MEM_DOUT3_MODE 0x00000007 +#define SPI_MEM_DOUT3_MODE_M ((SPI_MEM_DOUT3_MODE_V)<<(SPI_MEM_DOUT3_MODE_S)) +#define SPI_MEM_DOUT3_MODE_V 0x7 +#define SPI_MEM_DOUT3_MODE_S 9 +/* SPI_MEM_DOUT2_MODE : R/W ;bitpos:[8:6] ;default: 3'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the posedge of clk_160 4 output with the negedge of clk_160 5: output with the spi_clk high edge 6: output with the spi_clk low edge*/ +#define SPI_MEM_DOUT2_MODE 0x00000007 +#define SPI_MEM_DOUT2_MODE_M ((SPI_MEM_DOUT2_MODE_V)<<(SPI_MEM_DOUT2_MODE_S)) +#define SPI_MEM_DOUT2_MODE_V 0x7 +#define SPI_MEM_DOUT2_MODE_S 6 +/* SPI_MEM_DOUT1_MODE : R/W ;bitpos:[5:3] ;default: 3'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the posedge of clk_160 4 output with the negedge of clk_160 5: output with the spi_clk high edge 6: output with the spi_clk low edge*/ +#define SPI_MEM_DOUT1_MODE 0x00000007 +#define SPI_MEM_DOUT1_MODE_M ((SPI_MEM_DOUT1_MODE_V)<<(SPI_MEM_DOUT1_MODE_S)) +#define SPI_MEM_DOUT1_MODE_V 0x7 +#define SPI_MEM_DOUT1_MODE_S 3 +/* SPI_MEM_DOUT0_MODE : R/W ;bitpos:[2:0] ;default: 3'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the posedge of clk_160 4 output with the negedge of clk_160 5: output with the spi_clk high edge 6: output with the spi_clk low edge*/ +#define SPI_MEM_DOUT0_MODE 0x00000007 +#define SPI_MEM_DOUT0_MODE_M ((SPI_MEM_DOUT0_MODE_V)<<(SPI_MEM_DOUT0_MODE_S)) +#define SPI_MEM_DOUT0_MODE_V 0x7 +#define SPI_MEM_DOUT0_MODE_S 0 + +#define SPI_MEM_DOUT_NUM_REG(i) (REG_SPI_MEM_BASE(i) + 0x108) +/* SPI_MEM_DOUT3_NUM : R/W ;bitpos:[7:6] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_MEM_DOUT3_NUM 0x00000003 +#define SPI_MEM_DOUT3_NUM_M ((SPI_MEM_DOUT3_NUM_V)<<(SPI_MEM_DOUT3_NUM_S)) +#define SPI_MEM_DOUT3_NUM_V 0x3 +#define SPI_MEM_DOUT3_NUM_S 6 +/* SPI_MEM_DOUT2_NUM : R/W ;bitpos:[5:4] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_MEM_DOUT2_NUM 0x00000003 +#define SPI_MEM_DOUT2_NUM_M ((SPI_MEM_DOUT2_NUM_V)<<(SPI_MEM_DOUT2_NUM_S)) +#define SPI_MEM_DOUT2_NUM_V 0x3 +#define SPI_MEM_DOUT2_NUM_S 4 +/* SPI_MEM_DOUT1_NUM : R/W ;bitpos:[3:2] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_MEM_DOUT1_NUM 0x00000003 +#define SPI_MEM_DOUT1_NUM_M ((SPI_MEM_DOUT1_NUM_V)<<(SPI_MEM_DOUT1_NUM_S)) +#define SPI_MEM_DOUT1_NUM_V 0x3 +#define SPI_MEM_DOUT1_NUM_S 2 +/* SPI_MEM_DOUT0_NUM : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_MEM_DOUT0_NUM 0x00000003 +#define SPI_MEM_DOUT0_NUM_M ((SPI_MEM_DOUT0_NUM_V)<<(SPI_MEM_DOUT0_NUM_S)) +#define SPI_MEM_DOUT0_NUM_V 0x3 +#define SPI_MEM_DOUT0_NUM_S 0 + +#define SPI_SMEM_TIMING_CALI_REG(i) (REG_SPI_MEM_BASE(i) + 0x10C) +/* SPI_SMEM_EXTRA_DUMMY_CYCLELEN : R/W ;bitpos:[3:2] ;default: 2'd0 ; */ +/*description: For sram add extra dummy spi clock cycle length for spi clock calibration.*/ +#define SPI_SMEM_EXTRA_DUMMY_CYCLELEN 0x00000003 +#define SPI_SMEM_EXTRA_DUMMY_CYCLELEN_M ((SPI_SMEM_EXTRA_DUMMY_CYCLELEN_V)<<(SPI_SMEM_EXTRA_DUMMY_CYCLELEN_S)) +#define SPI_SMEM_EXTRA_DUMMY_CYCLELEN_V 0x3 +#define SPI_SMEM_EXTRA_DUMMY_CYCLELEN_S 2 +/* SPI_SMEM_TIMING_CALI : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: For sram the bit is used to enable timing auto-calibration for + all reading operations.*/ +#define SPI_SMEM_TIMING_CALI (BIT(1)) +#define SPI_SMEM_TIMING_CALI_M (BIT(1)) +#define SPI_SMEM_TIMING_CALI_V 0x1 +#define SPI_SMEM_TIMING_CALI_S 1 +/* SPI_SMEM_TIMING_CLK_ENA : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: For sram the bit is used to enable timing adjust clock for all + reading operations.*/ +#define SPI_SMEM_TIMING_CLK_ENA (BIT(0)) +#define SPI_SMEM_TIMING_CLK_ENA_M (BIT(0)) +#define SPI_SMEM_TIMING_CLK_ENA_V 0x1 +#define SPI_SMEM_TIMING_CLK_ENA_S 0 + +#define SPI_SMEM_DIN_MODE_REG(i) (REG_SPI_MEM_BASE(i) + 0x110) +/* SPI_SMEM_DIN3_MODE : R/W ;bitpos:[11:9] ;default: 3'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the posedge of clk_160 4 input with the negedge of clk_160 5: input with the spi_clk high edge 6: input with the spi_clk low edge*/ +#define SPI_SMEM_DIN3_MODE 0x00000007 +#define SPI_SMEM_DIN3_MODE_M ((SPI_SMEM_DIN3_MODE_V)<<(SPI_SMEM_DIN3_MODE_S)) +#define SPI_SMEM_DIN3_MODE_V 0x7 +#define SPI_SMEM_DIN3_MODE_S 9 +/* SPI_SMEM_DIN2_MODE : R/W ;bitpos:[8:6] ;default: 3'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the posedge of clk_160 4 input with the negedge of clk_160 5: input with the spi_clk high edge 6: input with the spi_clk low edge*/ +#define SPI_SMEM_DIN2_MODE 0x00000007 +#define SPI_SMEM_DIN2_MODE_M ((SPI_SMEM_DIN2_MODE_V)<<(SPI_SMEM_DIN2_MODE_S)) +#define SPI_SMEM_DIN2_MODE_V 0x7 +#define SPI_SMEM_DIN2_MODE_S 6 +/* SPI_SMEM_DIN1_MODE : R/W ;bitpos:[5:3] ;default: 3'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the posedge of clk_160 4 input with the negedge of clk_160 5: input with the spi_clk high edge 6: input with the spi_clk low edge*/ +#define SPI_SMEM_DIN1_MODE 0x00000007 +#define SPI_SMEM_DIN1_MODE_M ((SPI_SMEM_DIN1_MODE_V)<<(SPI_SMEM_DIN1_MODE_S)) +#define SPI_SMEM_DIN1_MODE_V 0x7 +#define SPI_SMEM_DIN1_MODE_S 3 +/* SPI_SMEM_DIN0_MODE : R/W ;bitpos:[2:0] ;default: 3'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the posedge of clk_160 4 input with the negedge of clk_160 5: input with the spi_clk high edge 6: input with the spi_clk low edge*/ +#define SPI_SMEM_DIN0_MODE 0x00000007 +#define SPI_SMEM_DIN0_MODE_M ((SPI_SMEM_DIN0_MODE_V)<<(SPI_SMEM_DIN0_MODE_S)) +#define SPI_SMEM_DIN0_MODE_V 0x7 +#define SPI_SMEM_DIN0_MODE_S 0 + +#define SPI_SMEM_DIN_NUM_REG(i) (REG_SPI_MEM_BASE(i) + 0x114) +/* SPI_SMEM_DIN3_NUM : R/W ;bitpos:[7:6] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_SMEM_DIN3_NUM 0x00000003 +#define SPI_SMEM_DIN3_NUM_M ((SPI_SMEM_DIN3_NUM_V)<<(SPI_SMEM_DIN3_NUM_S)) +#define SPI_SMEM_DIN3_NUM_V 0x3 +#define SPI_SMEM_DIN3_NUM_S 6 +/* SPI_SMEM_DIN2_NUM : R/W ;bitpos:[5:4] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_SMEM_DIN2_NUM 0x00000003 +#define SPI_SMEM_DIN2_NUM_M ((SPI_SMEM_DIN2_NUM_V)<<(SPI_SMEM_DIN2_NUM_S)) +#define SPI_SMEM_DIN2_NUM_V 0x3 +#define SPI_SMEM_DIN2_NUM_S 4 +/* SPI_SMEM_DIN1_NUM : R/W ;bitpos:[3:2] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_SMEM_DIN1_NUM 0x00000003 +#define SPI_SMEM_DIN1_NUM_M ((SPI_SMEM_DIN1_NUM_V)<<(SPI_SMEM_DIN1_NUM_S)) +#define SPI_SMEM_DIN1_NUM_V 0x3 +#define SPI_SMEM_DIN1_NUM_S 2 +/* SPI_SMEM_DIN0_NUM : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_SMEM_DIN0_NUM 0x00000003 +#define SPI_SMEM_DIN0_NUM_M ((SPI_SMEM_DIN0_NUM_V)<<(SPI_SMEM_DIN0_NUM_S)) +#define SPI_SMEM_DIN0_NUM_V 0x3 +#define SPI_SMEM_DIN0_NUM_S 0 + +#define SPI_SMEM_DOUT_MODE_REG(i) (REG_SPI_MEM_BASE(i) + 0x118) +/* SPI_SMEM_DOUT3_MODE : R/W ;bitpos:[11:9] ;default: 3'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the posedge of clk_160 4 output with the negedge of clk_160 5: output with the spi_clk high edge 6: output with the spi_clk low edge*/ +#define SPI_SMEM_DOUT3_MODE 0x00000007 +#define SPI_SMEM_DOUT3_MODE_M ((SPI_SMEM_DOUT3_MODE_V)<<(SPI_SMEM_DOUT3_MODE_S)) +#define SPI_SMEM_DOUT3_MODE_V 0x7 +#define SPI_SMEM_DOUT3_MODE_S 9 +/* SPI_SMEM_DOUT2_MODE : R/W ;bitpos:[8:6] ;default: 3'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the posedge of clk_160 4 output with the negedge of clk_160 5: output with the spi_clk high edge 6: output with the spi_clk low edge*/ +#define SPI_SMEM_DOUT2_MODE 0x00000007 +#define SPI_SMEM_DOUT2_MODE_M ((SPI_SMEM_DOUT2_MODE_V)<<(SPI_SMEM_DOUT2_MODE_S)) +#define SPI_SMEM_DOUT2_MODE_V 0x7 +#define SPI_SMEM_DOUT2_MODE_S 6 +/* SPI_SMEM_DOUT1_MODE : R/W ;bitpos:[5:3] ;default: 3'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the posedge of clk_160 4 output with the negedge of clk_160 5: output with the spi_clk high edge 6: output with the spi_clk low edge*/ +#define SPI_SMEM_DOUT1_MODE 0x00000007 +#define SPI_SMEM_DOUT1_MODE_M ((SPI_SMEM_DOUT1_MODE_V)<<(SPI_SMEM_DOUT1_MODE_S)) +#define SPI_SMEM_DOUT1_MODE_V 0x7 +#define SPI_SMEM_DOUT1_MODE_S 3 +/* SPI_SMEM_DOUT0_MODE : R/W ;bitpos:[2:0] ;default: 3'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the posedge of clk_160 4 output with the negedge of clk_160 5: output with the spi_clk high edge 6: output with the spi_clk low edge*/ +#define SPI_SMEM_DOUT0_MODE 0x00000007 +#define SPI_SMEM_DOUT0_MODE_M ((SPI_SMEM_DOUT0_MODE_V)<<(SPI_SMEM_DOUT0_MODE_S)) +#define SPI_SMEM_DOUT0_MODE_V 0x7 +#define SPI_SMEM_DOUT0_MODE_S 0 + +#define SPI_SMEM_DOUT_NUM_REG(i) (REG_SPI_MEM_BASE(i) + 0x11C) +/* SPI_SMEM_DOUT3_NUM : R/W ;bitpos:[7:6] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_SMEM_DOUT3_NUM 0x00000003 +#define SPI_SMEM_DOUT3_NUM_M ((SPI_SMEM_DOUT3_NUM_V)<<(SPI_SMEM_DOUT3_NUM_S)) +#define SPI_SMEM_DOUT3_NUM_V 0x3 +#define SPI_SMEM_DOUT3_NUM_S 6 +/* SPI_SMEM_DOUT2_NUM : R/W ;bitpos:[5:4] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_SMEM_DOUT2_NUM 0x00000003 +#define SPI_SMEM_DOUT2_NUM_M ((SPI_SMEM_DOUT2_NUM_V)<<(SPI_SMEM_DOUT2_NUM_S)) +#define SPI_SMEM_DOUT2_NUM_V 0x3 +#define SPI_SMEM_DOUT2_NUM_S 4 +/* SPI_SMEM_DOUT1_NUM : R/W ;bitpos:[3:2] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_SMEM_DOUT1_NUM 0x00000003 +#define SPI_SMEM_DOUT1_NUM_M ((SPI_SMEM_DOUT1_NUM_V)<<(SPI_SMEM_DOUT1_NUM_S)) +#define SPI_SMEM_DOUT1_NUM_V 0x3 +#define SPI_SMEM_DOUT1_NUM_S 2 +/* SPI_SMEM_DOUT0_NUM : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_SMEM_DOUT0_NUM 0x00000003 +#define SPI_SMEM_DOUT0_NUM_M ((SPI_SMEM_DOUT0_NUM_V)<<(SPI_SMEM_DOUT0_NUM_S)) +#define SPI_SMEM_DOUT0_NUM_V 0x3 +#define SPI_SMEM_DOUT0_NUM_S 0 + +#define SPI_MEM_CLOCK_GATE_REG(i) (REG_SPI_MEM_BASE(i) + 0x120) +/* SPI_MEM_CLK_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define SPI_MEM_CLK_EN (BIT(0)) +#define SPI_MEM_CLK_EN_M (BIT(0)) +#define SPI_MEM_CLK_EN_V 0x1 +#define SPI_MEM_CLK_EN_S 0 + +#define SPI_MEM_DATE_REG(i) (REG_SPI_MEM_BASE(i) + 0x3FC) +/* SPI_MEM_DATE : R/W ;bitpos:[27:0] ;default: 28'h1810250 ; */ +/*description: SPI register version.*/ +#define SPI_MEM_DATE 0x0FFFFFFF +#define SPI_MEM_DATE_M ((SPI_MEM_DATE_V)<<(SPI_MEM_DATE_S)) +#define SPI_MEM_DATE_V 0xFFFFFFF +#define SPI_MEM_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_SPI_MEM_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/spi_mem_struct.h b/components/soc/esp32s2beta/include/soc/spi_mem_struct.h new file mode 100644 index 0000000000..30d47c8b9c --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/spi_mem_struct.h @@ -0,0 +1,741 @@ +// Copyright 2017-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_MEM_STRUCT_H_ +#define _SOC_SPI_MEM_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t reserved0: 17; /*reserved*/ + uint32_t flash_pe: 1; /*In user mode it is set to indicate that program/erase operation will be triggered. The bit is combined with spi_mem_usr bit. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t usr: 1; /*User define command enable. An operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_hpm: 1; /*Drive Flash into high performance mode. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_res: 1; /*This bit combined with reg_resandres bit releases Flash from the power-down state or high performance mode and obtains the devices ID. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_dp: 1; /*Drive Flash into power down. An operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_ce: 1; /*Chip erase enable. Chip erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_be: 1; /*Block erase enable(32KB) . Block erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_se: 1; /*Sector erase enable(4KB). Sector erase operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_pp: 1; /*Page program enable(1 byte ~256 bytes data to be programmed). Page program operation will be triggered when the bit is set. The bit will be cleared once the operation done .1: enable 0: disable.*/ + uint32_t flash_wrsr: 1; /*Write status register enable. Write status operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_rdsr: 1; /*Read status register-1. Read status operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_rdid: 1; /*Read JEDEC ID . Read ID command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + uint32_t flash_wrdi: 1; /*Write flash disable. Write disable command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + uint32_t flash_wren: 1; /*Write flash enable. Write enable command will be sent when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + uint32_t flash_read: 1; /*Read flash enable. Read flash operation will be triggered when the bit is set. The bit will be cleared once the operation done. 1: enable 0: disable.*/ + }; + uint32_t val; + } cmd; + uint32_t addr; /*In user mode it is the memory address. other then the bit0-bit23 is the memory address the bit24-bit31 are the byte length of a transfer.*/ + union { + struct { + uint32_t reserved0: 3; /*reserved*/ + uint32_t dummy_out: 1; /*In the dummy phase the signal level of spi is output by the spi controller.*/ + uint32_t reserved4: 3; /*reserved*/ + uint32_t fcmd_dual: 1; /*Apply 2 signals during command phase 1:enable 0: disable*/ + uint32_t fcmd_quad: 1; /*Apply 4 signals during command phase 1:enable 0: disable*/ + uint32_t reserved9: 1; /*reserved*/ + uint32_t fcs_crc_en: 1; /*For SPI1 initialize crc32 module before writing encrypted data to flash. Active low.*/ + uint32_t tx_crc_en: 1; /*For SPI1 enable crc32 when writing encrypted data to flash. 1: enable 0:disable*/ + uint32_t reserved12: 1; /*reserved*/ + uint32_t fastrd_mode: 1; /*This bit enable the bits: spi_mem_fread_qio spi_mem_fread_dio spi_mem_fread_qout and spi_mem_fread_dout. 1: enable 0: disable.*/ + uint32_t fread_dual: 1; /*In the read operations read-data phase apply 2 signals. 1: enable 0: disable.*/ + uint32_t resandres: 1; /*The Device ID is read out to SPI_MEM_RD_STATUS register this bit combine with spi_mem_flash_res bit. 1: enable 0: disable.*/ + uint32_t reserved16: 1; /*reserved*/ + uint32_t flash_suspending: 1; /*The status of flash suspend only used in SPI1.*/ + uint32_t q_pol: 1; /*The bit is used to set MISO line polarity 1: high 0 low*/ + uint32_t d_pol: 1; /*The bit is used to set MOSI line polarity 1: high 0 low*/ + uint32_t fread_quad: 1; /*In the read operations read-data phase apply 4 signals. 1: enable 0: disable.*/ + uint32_t wp: 1; /*Write protect signal output when SPI is idle. 1: output high 0: output low.*/ + uint32_t wrsr_2b: 1; /*two bytes data will be written to status register when it is set. 1: enable 0: disable.*/ + uint32_t fread_dio: 1; /*In the read operations address phase and read-data phase apply 2 signals. 1: enable 0: disable.*/ + uint32_t fread_qio: 1; /*In the read operations address phase and read-data phase apply 4 signals. 1: enable 0: disable.*/ + uint32_t reserved25: 7; /*reserved*/ + }; + uint32_t val; + } ctrl; + union { + struct { + uint32_t clk_mode: 2; /*SPI clock mode bits. 0: SPI clock is off when CS inactive 1: SPI clock is delayed one cycle after CS inactive 2: SPI clock is delayed two cycles after CS inactive 3: SPI clock is alwasy on.*/ + uint32_t cs_hold_delay_res:12; /*Delay cycles of resume Flash when resume Flash is enable by spi clock.*/ + uint32_t cs_hold_delay: 6; /*SPI cs signal is delayed by spi clock cycles.*/ + uint32_t reserved20: 12; /*reserved*/ + }; + uint32_t val; + } ctrl1; + union { + struct { + uint32_t cs_setup_time:13; /*(cycles-1) of prepare phase by spi clock this bits are combined with spi_mem_cs_setup bit.*/ + uint32_t cs_hold_time: 13; /*delay cycles of cs pin by spi clock this bits are combined with spi_mem_cs_hold bit.*/ + uint32_t cs_delay_mode: 2; /*spi_mem_cs signal is delayed by spi_mem_clk . 0: zero 1: if spi_mem_ck_out_edge or spi_mem_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_mem_ck_out_edge or spi_mem_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ + uint32_t cs_delay_num: 2; /*spi_mem_cs signal is delayed by system clock cycles*/ + uint32_t cs_delay_edge: 1; /*The bit is used to select the spi clock edge to modify CS line timing.*/ + uint32_t sync_reset: 1; /*The FSM will be reset.*/ + }; + uint32_t val; + } ctrl2; + union { + struct { + uint32_t clkcnt_l: 8; /*In the master mode it must be equal to spi_mem_clkcnt_N. In the slave mode it must be 0.*/ + uint32_t clkcnt_h: 8; /*In the master mode it must be floor((spi_mem_clkcnt_N+1)/2-1). In the slave mode it must be 0.*/ + uint32_t clkcnt_n: 8; /*In the master mode it is the divider of spi_mem_clk. So spi_mem_clk frequency is system/(spi_mem_clkcnt_N+1)*/ + uint32_t reserved24: 7; /*In the master mode it is pre-divider of spi_mem_clk.*/ + uint32_t clk_equ_sysclk: 1; /*reserved*/ + }; + uint32_t val; + } clock; + union { + struct { + uint32_t reserved0: 6; /*reserved*/ + uint32_t cs_hold: 1; /*spi cs keep low when spi is in done phase. 1: enable 0: disable.*/ + uint32_t cs_setup: 1; /*spi cs is enable when spi is in prepare phase. 1: enable 0: disable.*/ + uint32_t ck_i_edge: 1; /*In the slave mode the bit is same as spi_mem_ck_out_edge in master mode. It is combined with spi_mem_miso_delay_mode bits.*/ + uint32_t ck_out_edge: 1; /*the bit combined with spi_mem_mosi_delay_mode bits to set mosi signal delay mode.*/ + uint32_t reserved10: 2; /*reserved*/ + uint32_t fwrite_dual: 1; /*In the write operations read-data phase apply 2 signals*/ + uint32_t fwrite_quad: 1; /*In the write operations read-data phase apply 4 signals*/ + uint32_t fwrite_dio: 1; /*In the write operations address phase and read-data phase apply 2 signals.*/ + uint32_t fwrite_qio: 1; /*In the write operations address phase and read-data phase apply 4 signals.*/ + uint32_t reserved16: 8; /*reserved*/ + uint32_t usr_miso_highpart: 1; /*read-data phase only access to high-part of the buffer spi_mem_w8~spi_mem_w15. 1: enable 0: disable.*/ + uint32_t usr_mosi_highpart: 1; /*write-data phase only access to high-part of the buffer spi_mem_w8~spi_mem_w15. 1: enable 0: disable.*/ + uint32_t usr_dummy_idle: 1; /*spi clock is disable in dummy phase when the bit is enable.*/ + uint32_t usr_mosi: 1; /*This bit enable the write-data phase of an operation.*/ + uint32_t usr_miso: 1; /*This bit enable the read-data phase of an operation.*/ + uint32_t usr_dummy: 1; /*This bit enable the dummy phase of an operation.*/ + uint32_t usr_addr: 1; /*This bit enable the address phase of an operation.*/ + uint32_t usr_command: 1; /*This bit enable the command phase of an operation.*/ + }; + uint32_t val; + } user; + union { + struct { + uint32_t usr_dummy_cyclelen: 8; /*The length in spi_mem_clk cycles of dummy phase. The register value shall be (cycle_num-1).*/ + uint32_t reserved8: 18; /*reserved*/ + uint32_t usr_addr_bitlen: 6; /*The length in bits of address phase. The register value shall be (bit_num-1).*/ + }; + uint32_t val; + } user1; + union { + struct { + uint32_t usr_command_value: 16; /*The value of command.*/ + uint32_t reserved16: 12; /*reserved*/ + uint32_t usr_command_bitlen: 4; /*The length in bits of command phase. The register value shall be (bit_num-1)*/ + }; + uint32_t val; + } user2; + union { + struct { + uint32_t usr_mosi_bit_len:11; /*The length in bits of write-data. The register value shall be (bit_num-1).*/ + uint32_t reserved11: 21; /*reserved*/ + }; + uint32_t val; + } mosi_dlen; + union { + struct { + uint32_t usr_miso_bit_len:11; /*The length in bits of read-data. The register value shall be (bit_num-1).*/ + uint32_t reserved11: 21; /*reserved*/ + }; + uint32_t val; + } miso_dlen; + union { + struct { + uint32_t status: 16; /*The value is stored when set spi_mem_flash_rdsr bit and spi_mem_flash_res bit.*/ + uint32_t wb_mode: 8; /*Mode bits in the flash fast read mode it is combined with spi_mem_fastrd_mode bit.*/ + uint32_t reserved24: 8; /*reserved*/ + }; + uint32_t val; + } rd_status; + uint32_t ext_addr; /*The register are the higher 32bits in the 64 bits address mode.*/ + union { + struct { + uint32_t cs0_dis: 1; /*SPI CS0 pin enable 1: disable CS0 0: spi_mem_cs0 signal is from/to CS0 pin*/ + uint32_t cs1_dis: 1; /*SPI CS1 pin enable 1: disable CS1 0: spi_mem_cs1 signal is from/to CS1 pin*/ + uint32_t reserved2: 1; /*reserved*/ + uint32_t trans_end: 1; /*The bit is used to indicate the transimitting is done.*/ + uint32_t trans_end_en: 1; /*The bit is used to enable the intterrupt of SPI transmitting done.*/ + uint32_t cs_pol: 2; /*In the master mode the bits are the polarity of spi cs line the value is equivalent to spi_mem_cs ^ spi_mem_master_cs_pol.*/ + uint32_t fsub_pin: 1; /*For SPI0 flash is connected to SUBPINs.*/ + uint32_t ssub_pin: 1; /*For SPI0 sram is connected to SUBPINs.*/ + uint32_t ck_idle_edge: 1; /*1: spi clk line is high when idle 0: spi clk line is low when idle*/ + uint32_t cs_keep_active: 1; /*spi cs line keep low when the bit is set.*/ + uint32_t auto_per: 1; /*reserved*/ + uint32_t reserved12: 20; /*reserved*/ + }; + uint32_t val; + } misc; + uint32_t tx_crc; /*For SPI1 the value of crc32.*/ + union { + struct { + uint32_t req_en: 1; /*For SPI0 Cache access enable 1: enable 0:disable.*/ + uint32_t usr_cmd_4byte: 1; /*For SPI0 cache read flash with 4 bytes command 1: enable 0:disable.*/ + uint32_t flash_usr_cmd: 1; /*For SPI0 cache read flash for user define command 1: enable 0:disable.*/ + uint32_t fdin_dual: 1; /*For SPI0 flash din phase apply 2 signals. 1: enable 0: disable. The bit is the same with spi_mem_fread_dio.*/ + uint32_t fdout_dual: 1; /*For SPI0 flash dout phase apply 2 signals. 1: enable 0: disable. The bit is the same with spi_mem_fread_dio.*/ + uint32_t faddr_dual: 1; /*For SPI0 flash address phase apply 2 signals. 1: enable 0: disable. The bit is the same with spi_mem_fread_dio.*/ + uint32_t fdin_quad: 1; /*For SPI0 flash din phase apply 4 signals. 1: enable 0: disable. The bit is the same with spi_mem_fread_qio.*/ + uint32_t fdout_quad: 1; /*For SPI0 flash dout phase apply 4 signals. 1: enable 0: disable. The bit is the same with spi_mem_fread_qio.*/ + uint32_t faddr_quad: 1; /*For SPI0 flash address phase apply 4 signals. 1: enable 0: disable. The bit is the same with spi_mem_fread_qio.*/ + uint32_t reserved9: 23; /*reserved*/ + }; + uint32_t val; + } cache_fctrl; + union { + struct { + uint32_t usr_scmd_4byte: 1; /*For SPI0 In the spi sram mode cache read flash with 4 bytes command 1: enable 0:disable.*/ + uint32_t usr_sram_dio: 1; /*For SPI0 In the spi sram mode spi dual I/O mode enable 1: enable 0:disable*/ + uint32_t usr_sram_qio: 1; /*For SPI0 In the spi sram mode spi quad I/O mode enable 1: enable 0:disable*/ + uint32_t usr_wr_sram_dummy: 1; /*For SPI0 In the spi sram mode it is the enable bit of dummy phase for write operations.*/ + uint32_t usr_rd_sram_dummy: 1; /*For SPI0 In the spi sram mode it is the enable bit of dummy phase for read operations.*/ + uint32_t cache_sram_usr_rcmd: 1; /*For SPI0 In the spi sram mode cache read sram for user define command.*/ + uint32_t sram_rdummy_cyclelen: 8; /*For SPI0 In the sram mode it is the length in bits of read dummy phase. The register value shall be (bit_num-1).*/ + uint32_t sram_addr_bitlen: 6; /*For SPI0 In the sram mode it is the length in bits of address phase. The register value shall be (bit_num-1).*/ + uint32_t cache_sram_usr_wcmd: 1; /*For SPI0 In the spi sram mode cache write sram for user define command*/ + uint32_t reserved21: 1; /*reserved*/ + uint32_t sram_wdummy_cyclelen: 8; /*For SPI0 In the sram mode it is the length in bits of write dummy phase. The register value shall be (bit_num-1).*/ + uint32_t reserved30: 2; /*reserved*/ + }; + uint32_t val; + } cache_sctrl; + union { + struct { + uint32_t sclk_mode: 2; /*SPI clock mode bits. 0: SPI clock is off when CS inactive 1: SPI clock is delayed one cycle after CS inactive 2: SPI clock is delayed two cycles after CS inactive 3: SPI clock is alwasy on.*/ + uint32_t swb_mode: 8; /*Mode bits in the psram fast read mode it is combined with spi_mem_fastrd_mode bit.*/ + uint32_t sdin_dual: 1; /*For SPI0 sram din phase apply 2 signals. 1: enable 0: disable. The bit is the same with spi_mem_usr_sram_dio.*/ + uint32_t sdout_dual: 1; /*For SPI0 sram dout phase apply 2 signals. 1: enable 0: disable. The bit is the same with spi_mem_usr_sram_dio.*/ + uint32_t saddr_dual: 1; /*For SPI0 sram address phase apply 2 signals. 1: enable 0: disable. The bit is the same with spi_mem_usr_sram_dio.*/ + uint32_t scmd_dual: 1; /*For SPI0 sram cmd phase apply 2 signals. 1: enable 0: disable. The bit is the same with spi_mem_usr_sram_dio.*/ + uint32_t sdin_quad: 1; /*For SPI0 sram din phase apply 4 signals. 1: enable 0: disable. The bit is the same with spi_mem_usr_sram_qio.*/ + uint32_t sdout_quad: 1; /*For SPI0 sram dout phase apply 4 signals. 1: enable 0: disable. The bit is the same with spi_mem_usr_sram_qio.*/ + uint32_t saddr_quad: 1; /*For SPI0 sram address phase apply 4 signals. 1: enable 0: disable. The bit is the same with spi_mem_usr_sram_qio.*/ + uint32_t scmd_quad: 1; /*For SPI0 sram cmd phase apply 4 signals. 1: enable 0: disable. The bit is the same with spi_mem_usr_sram_qio.*/ + uint32_t reserved18:14; /*reserved*/ + }; + uint32_t val; + } sram_cmd; + union { + struct { + uint32_t usr_rd_cmd_value: 16; /*For SPI0 When cache mode is enable it is the read command value of command phase for sram.*/ + uint32_t reserved16: 12; /*reserved*/ + uint32_t usr_rd_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the length in bits of command phase for sram. The register value shall be (bit_num-1).*/ + }; + uint32_t val; + } sram_drd_cmd; + union { + struct { + uint32_t usr_wr_cmd_value: 16; /*For SPI0 When cache mode is enable it is the write command value of command phase for sram.*/ + uint32_t reserved16: 12; /*reserved*/ + uint32_t usr_wr_cmd_bitlen: 4; /*For SPI0 When cache mode is enable it is the in bits of command phase for sram. The register value shall be (bit_num-1).*/ + }; + uint32_t val; + } sram_dwr_cmd; + union { + struct { + uint32_t cnt_l: 8; /*For SPI0 sram interface it must be equal to spi_mem_clkcnt_N. In the slave mode it must be 0.*/ + uint32_t cnt_h: 8; /*For SPI0 sram interface it must be floor((spi_mem_clkcnt_N+1)/2-1). In the slave mode it must be 0.*/ + uint32_t cnt_n: 8; /*For SPI0 sram interface it is the divider of spi_mem_clk. So spi_mem_clk frequency is system/(spi_mem_clkcnt_N+1)*/ + uint32_t reserved24: 7; /*reserved*/ + uint32_t equ_sysclk: 1; /*For SPI0 sram interface 1: spi_mem_clk is eqaul to system 0: spi_mem_clk is divided from system clock.*/ + }; + uint32_t val; + } sram_clk; + union { + struct { + uint32_t st: 3; /*The status of spi state machine. 0: idle state 1: preparation state 2: send command state 3: send data state 4: red data state 5:write data state 6: wait state 7: done state.*/ + uint32_t reserved3: 29; /*reserved*/ + }; + uint32_t val; + } fsm; + union { + struct { + uint32_t hold_ena: 2; /*This register is for two SPI masters to share the same cs clock and data signals. The bits of one SPI are set if the other SPI is busy the SPI will be hold. 1(3): hold at idle phase 2: hold at prepare phase.*/ + uint32_t reserved2: 30; /*reserved*/ + }; + uint32_t val; + } hold; + union { + struct { + uint32_t dma_rx_ena: 1; /*spi dma rx data enable.*/ + uint32_t dma_tx_ena: 1; /*spi dma tx data enable.*/ + uint32_t in_rst: 1; /*The bit is used to reset in dma fsm and in data fifo pointer.*/ + uint32_t out_rst: 1; /*The bit is used to reset out dma fsm and out data fifo pointer.*/ + uint32_t ahbm_fifo_rst: 1; /*Reset spi dma ahb master fifo pointer.*/ + uint32_t ahbm_rst: 1; /*Reset spi dma ahb master.*/ + uint32_t in_loop_test: 1; /*Set bit to test in link.*/ + uint32_t out_loop_test: 1; /*Set bit to test out link.*/ + uint32_t out_auto_wrback: 1; /*when the bit is set DMA continue to use the next inlink node when the length of inlink is 0.*/ + uint32_t out_eof_mode: 1; /*out eof flag generation mode . 1: when dma pop all data from fifo 0:when ahb push all data to fifo.*/ + uint32_t outdscr_burst_en: 1; /*read descriptor use burst mode when read data for memory.*/ + uint32_t indscr_burst_en: 1; /*read descriptor use burst mode when write data to memory.*/ + uint32_t out_data_burst_en: 1; /*spi dma read data from memory in burst mode.*/ + uint32_t dma_mem_trans_ena: 1; /*reserved*/ + uint32_t dma_rx_stop: 1; /*spi dma read data stop when in continue tx/rx mode.*/ + uint32_t dma_tx_stop: 1; /*spi dma write data stop when in continue tx/rx mode.*/ + uint32_t dma_continue: 1; /*spi dma continue tx/rx data.*/ + uint32_t reserved17: 15; /*reserved*/ + }; + uint32_t val; + } dma_conf; + union { + struct { + uint32_t addr: 20; /*The address of the first outlink descriptor.*/ + uint32_t reserved20: 8; /*reserved*/ + uint32_t stop: 1; /*Set the bit to stop to use outlink descriptor.*/ + uint32_t start: 1; /*Set the bit to start to use outlink descriptor.*/ + uint32_t restart: 1; /*Set the bit to mount on new outlink descriptors.*/ + uint32_t reserved31: 1; /*reserved*/ + }; + uint32_t val; + } dma_out_link; + union { + struct { + uint32_t addr: 20; /*The address of the first inlink descriptor.*/ + uint32_t auto_ret: 1; /*when the bit is set the inlink descriptor returns to the first link node when a packet is error.*/ + uint32_t reserved21: 7; /*reserved*/ + uint32_t stop: 1; /*Set the bit to stop to use inlink descriptor.*/ + uint32_t start: 1; /*Set the bit to start to use inlink descriptor.*/ + uint32_t restart: 1; /*Set the bit to mount on new inlink descriptors.*/ + uint32_t reserved31: 1; /*reserved*/ + }; + uint32_t val; + } dma_in_link; + union { + struct { + uint32_t inlink_dscr_empty: 1; /*The enable bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The enable bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The enable bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The enable bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The enable bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The enable bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The enable bit for completing usage of a outlink descriptor .*/ + uint32_t out_eof: 1; /*The enable bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The enable bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ + }; + uint32_t val; + } dma_int_ena; + union { + struct { + uint32_t inlink_dscr_empty: 1; /*The raw bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The raw bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The raw bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The raw bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The raw bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The raw bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The raw bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof: 1; /*The raw bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The raw bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ + }; + uint32_t val; + } dma_int_raw; + union { + struct { + uint32_t inlink_dscr_empty: 1; /*The status bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The status bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The status bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The status bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The status bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The status bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The status bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof: 1; /*The status bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The status bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ + }; + uint32_t val; + } dma_int_st; + union { + struct { + uint32_t inlink_dscr_empty: 1; /*The clear bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The clear bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The clear bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The clear bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The clear bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The clear bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The clear bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof: 1; /*The clear bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The clear bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ + }; + uint32_t val; + } dma_int_clr; + uint32_t dma_in_err_eof_des_addr; /*The inlink descriptor address when spi dma produce receiving error.*/ + uint32_t dma_in_suc_eof_des_addr; /*The last inlink descriptor address when spi dma produce from_suc_eof.*/ + uint32_t dma_inlink_dscr; /*The content of current in descriptor pointer.*/ + uint32_t dma_inlink_dscr_bf0; /*The content of next in descriptor pointer.*/ + uint32_t dma_inlink_dscr_bf1; /*The content of current in descriptor data buffer pointer.*/ + uint32_t dma_out_eof_bfr_des_addr; /*The address of buffer relative to the outlink descriptor that produce eof.*/ + uint32_t dma_out_eof_des_addr; /*The last outlink descriptor address when spi dma produce to_eof.*/ + uint32_t dma_outlink_dscr; /*The content of current out descriptor pointer.*/ + uint32_t dma_outlink_dscr_bf0; /*The content of next out descriptor pointer.*/ + uint32_t dma_outlink_dscr_bf1; /*The content of current out descriptor data buffer pointer.*/ + union { + struct { + uint32_t out_dscr_addr: 18; /*SPI dma out descriptor address.*/ + uint32_t out_dscr_state: 2; /*SPI dma out descriptor state.*/ + uint32_t out_state: 3; /*SPI dma out data state.*/ + uint32_t out_fifo_cnt: 7; /*The remains of SPI dma outfifo data.*/ + uint32_t out_fifo_full: 1; /*SPI dma outfifo is full.*/ + uint32_t out_fifo_empty: 1; /*SPI dma outfifo is empty.*/ + }; + uint32_t val; + } dma_out_status; + union { + struct { + uint32_t in_dscr_addr: 18; /*SPI dma in descriptor address.*/ + uint32_t in_dscr_state: 2; /*SPI dma in descriptor state.*/ + uint32_t in_state: 3; /*SPI dma in data state.*/ + uint32_t in_fifo_cnt: 7; /*The remains of SPI dma infifo data.*/ + uint32_t in_fifo_full: 1; /*SPI dma infifo is full.*/ + uint32_t in_fifo_empty: 1; /*SPI dma infifo is empty.*/ + }; + uint32_t val; + } dma_in_status; + uint32_t data_buf[16]; /*data buffer*/ + union { + struct { + uint32_t waiti_en: 1; /*auto-waiting flash idle operation when program flash or erase flash. 1: enable 0: disable.*/ + uint32_t waiti_dummy: 1; /*The dummy phase enable when auto wait flash idle*/ + uint32_t waiti_cmd: 8; /*The command to auto wait idle*/ + uint32_t waiti_dummy_cyclelen: 8; /*The dummy cycle length when auto wait flash idle*/ + uint32_t reserved18: 14; /*reserved*/ + }; + uint32_t val; + } flash_waiti_ctrl; + union { + struct { + uint32_t flash_per: 1; /*program erase resume bit program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t flash_pes: 1; /*program erase suspend bit program erase suspend operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t reserved2: 30; + }; + uint32_t val; + } flash_sus_cmd; + union { + struct { + uint32_t flash_pes_en: 1; /*Auto-suspending enable*/ + uint32_t flash_per_command: 8; /*Program/Erase resume command.*/ + uint32_t flash_pes_command: 8; /*Program/Erase suspend command.*/ + uint32_t reserved17: 15; + }; + uint32_t val; + } flash_sus_ctrl; + union { + struct { + uint32_t din0_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t din1_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t din2_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t din3_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t reserved8: 10; /*reserved*/ + uint32_t din0_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t din1_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t din2_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t din3_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t reserved22: 10; /*reserved*/ + }; + uint32_t val; + } din_mode; + union { + struct { + uint32_t din0_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t din1_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t din2_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t din3_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t reserved8: 24; /*reserved*/ + }; + uint32_t val; + } din_num; + union { + struct { + uint32_t dout0_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t dout1_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t dout2_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t dout3_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t reserved8: 10; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t dout0_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t dout1_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t dout2_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t dout3_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t reserved22: 10; /*reserved*/ + }; + uint32_t val; + } dout_mode; + union { + struct { + uint32_t dout0_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t dout1_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t dout2_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t dout3_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t reserved8: 24; /*reserved*/ + }; + uint32_t val; + } dout_num; + union { + struct { + uint32_t sdin0_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t sdin1_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t sdin2_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t sdin3_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t reserved8: 10; + uint32_t sdin0_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t sdin1_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t sdin2_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t sdin3_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t reserved22: 10; /*reserved*/ + }; + uint32_t val; + } sdin_mode; + union { + struct { + uint32_t sdin0_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t sdin1_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t sdin2_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t sdin3_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t reserved8: 24; /*reserved*/ + }; + uint32_t val; + } sdin_num; + union { + struct { + uint32_t sdout0_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t sdout1_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t sdout2_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t sdout3_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t reserved8: 10; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t sdout0_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t sdout1_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t sdout2_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t sdout3_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t reserved22: 10; /*reserved*/ + }; + uint32_t val; + } sdout_mode; + union { + struct { + uint32_t sdout0_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t sdout1_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t sdout2_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t sdout3_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t reserved8: 24; /*reserved*/ + }; + uint32_t val; + } sdout_num; + union { + struct { + uint32_t clk_en: 1; + uint32_t reserved1: 31; + }; + uint32_t val; + } clock_gate; + uint32_t reserved_118; + uint32_t reserved_11c; + uint32_t reserved_120; + uint32_t reserved_124; + uint32_t reserved_128; + uint32_t reserved_12c; + uint32_t reserved_130; + uint32_t reserved_134; + uint32_t reserved_138; + uint32_t reserved_13c; + uint32_t reserved_140; + uint32_t reserved_144; + uint32_t reserved_148; + uint32_t reserved_14c; + uint32_t reserved_150; + uint32_t reserved_154; + uint32_t reserved_158; + uint32_t reserved_15c; + uint32_t reserved_160; + uint32_t reserved_164; + uint32_t reserved_168; + uint32_t reserved_16c; + uint32_t reserved_170; + uint32_t reserved_174; + uint32_t reserved_178; + uint32_t reserved_17c; + uint32_t reserved_180; + uint32_t reserved_184; + uint32_t reserved_188; + uint32_t reserved_18c; + uint32_t reserved_190; + uint32_t reserved_194; + uint32_t reserved_198; + uint32_t reserved_19c; + uint32_t reserved_1a0; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + uint32_t reserved_1f0; + uint32_t reserved_1f4; + uint32_t reserved_1f8; + uint32_t reserved_1fc; + uint32_t reserved_200; + uint32_t reserved_204; + uint32_t reserved_208; + uint32_t reserved_20c; + uint32_t reserved_210; + uint32_t reserved_214; + uint32_t reserved_218; + uint32_t reserved_21c; + uint32_t reserved_220; + uint32_t reserved_224; + uint32_t reserved_228; + uint32_t reserved_22c; + uint32_t reserved_230; + uint32_t reserved_234; + uint32_t reserved_238; + uint32_t reserved_23c; + uint32_t reserved_240; + uint32_t reserved_244; + uint32_t reserved_248; + uint32_t reserved_24c; + uint32_t reserved_250; + uint32_t reserved_254; + uint32_t reserved_258; + uint32_t reserved_25c; + uint32_t reserved_260; + uint32_t reserved_264; + uint32_t reserved_268; + uint32_t reserved_26c; + uint32_t reserved_270; + uint32_t reserved_274; + uint32_t reserved_278; + uint32_t reserved_27c; + uint32_t reserved_280; + uint32_t reserved_284; + uint32_t reserved_288; + uint32_t reserved_28c; + uint32_t reserved_290; + uint32_t reserved_294; + uint32_t reserved_298; + uint32_t reserved_29c; + uint32_t reserved_2a0; + uint32_t reserved_2a4; + uint32_t reserved_2a8; + uint32_t reserved_2ac; + uint32_t reserved_2b0; + uint32_t reserved_2b4; + uint32_t reserved_2b8; + uint32_t reserved_2bc; + uint32_t reserved_2c0; + uint32_t reserved_2c4; + uint32_t reserved_2c8; + uint32_t reserved_2cc; + uint32_t reserved_2d0; + uint32_t reserved_2d4; + uint32_t reserved_2d8; + uint32_t reserved_2dc; + uint32_t reserved_2e0; + uint32_t reserved_2e4; + uint32_t reserved_2e8; + uint32_t reserved_2ec; + uint32_t reserved_2f0; + uint32_t reserved_2f4; + uint32_t reserved_2f8; + uint32_t reserved_2fc; + uint32_t reserved_300; + uint32_t reserved_304; + uint32_t reserved_308; + uint32_t reserved_30c; + uint32_t reserved_310; + uint32_t reserved_314; + uint32_t reserved_318; + uint32_t reserved_31c; + uint32_t reserved_320; + uint32_t reserved_324; + uint32_t reserved_328; + uint32_t reserved_32c; + uint32_t reserved_330; + uint32_t reserved_334; + uint32_t reserved_338; + uint32_t reserved_33c; + uint32_t reserved_340; + uint32_t reserved_344; + uint32_t reserved_348; + uint32_t reserved_34c; + uint32_t reserved_350; + uint32_t reserved_354; + uint32_t reserved_358; + uint32_t reserved_35c; + uint32_t reserved_360; + uint32_t reserved_364; + uint32_t reserved_368; + uint32_t reserved_36c; + uint32_t reserved_370; + uint32_t reserved_374; + uint32_t reserved_378; + uint32_t reserved_37c; + uint32_t reserved_380; + uint32_t reserved_384; + uint32_t reserved_388; + uint32_t reserved_38c; + uint32_t reserved_390; + uint32_t reserved_394; + uint32_t reserved_398; + uint32_t reserved_39c; + uint32_t reserved_3a0; + uint32_t reserved_3a4; + uint32_t reserved_3a8; + uint32_t reserved_3ac; + uint32_t reserved_3b0; + uint32_t reserved_3b4; + uint32_t reserved_3b8; + uint32_t reserved_3bc; + uint32_t reserved_3c0; + uint32_t reserved_3c4; + uint32_t reserved_3c8; + uint32_t reserved_3cc; + uint32_t reserved_3d0; + uint32_t reserved_3d4; + uint32_t reserved_3d8; + uint32_t reserved_3dc; + uint32_t reserved_3e0; + uint32_t reserved_3e4; + uint32_t reserved_3e8; + uint32_t reserved_3ec; + uint32_t reserved_3f0; + uint32_t reserved_3f4; + uint32_t reserved_3f8; + union { + struct { + uint32_t date: 28; /*SPI register version.*/ + uint32_t reserved28: 4; /*reserved*/ + }; + uint32_t val; + } date; +} spi_mem_dev_t; +extern spi_mem_dev_t SPIMEM0; +extern spi_mem_dev_t SPIMEM1; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_SPI_MEM_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/spi_reg.h b/components/soc/esp32s2beta/include/soc/spi_reg.h new file mode 100644 index 0000000000..6a05e98fd8 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/spi_reg.h @@ -0,0 +1,1677 @@ +// Copyright 2017-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_REG_H_ +#define _SOC_SPI_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define REG_SPI_BASE(i) (DR_REG_SPI2_BASE + (((i)>3) ? (((i-2)* 0x1000) + 0x10000) : ((i - 2)* 0x1000 ))) + +#define SPI_CMD_REG(i) (REG_SPI_BASE(i) + 0x000) +/* SPI_USR : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: User define command enable. An operation will be triggered when + the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ +#define SPI_USR (BIT(18)) +#define SPI_USR_M (BIT(18)) +#define SPI_USR_V 0x1 +#define SPI_USR_S 18 + +#define SPI_ADDR_REG(i) (REG_SPI_BASE(i) + 0x004) +/* SPI_USR_ADDR_VALUE : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: [31:8]:address to slave [7:0]:Reserved.*/ +#define SPI_USR_ADDR_VALUE 0xFFFFFFFF +#define SPI_USR_ADDR_VALUE_M ((SPI_USR_ADDR_VALUE_V)<<(SPI_USR_ADDR_VALUE_S)) +#define SPI_USR_ADDR_VALUE_V 0xFFFFFFFF +#define SPI_USR_ADDR_VALUE_S 0 + +#define SPI_CTRL_REG(i) (REG_SPI_BASE(i) + 0x008) +/* SPI_DEFINE_SLV_ADDR : R/W ;bitpos:[27] ;default: 1'b1 ; */ +/*description: set spi_usr_addr and spi_usr_addr_value in spi defined slave + mode. 1: disable 0:enable.*/ +#define SPI_DEFINE_SLV_ADDR (BIT(27)) +#define SPI_DEFINE_SLV_ADDR_M (BIT(27)) +#define SPI_DEFINE_SLV_ADDR_V 0x1 +#define SPI_DEFINE_SLV_ADDR_S 27 +/* SPI_WR_BIT_ORDER : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: In command address write-data (MOSI) phases 1: LSB firs 0: MSB first*/ +#define SPI_WR_BIT_ORDER (BIT(26)) +#define SPI_WR_BIT_ORDER_M (BIT(26)) +#define SPI_WR_BIT_ORDER_V 0x1 +#define SPI_WR_BIT_ORDER_S 26 +/* SPI_RD_BIT_ORDER : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: In read-data (MISO) phase 1: LSB first 0: MSB first*/ +#define SPI_RD_BIT_ORDER (BIT(25)) +#define SPI_RD_BIT_ORDER_M (BIT(25)) +#define SPI_RD_BIT_ORDER_V 0x1 +#define SPI_RD_BIT_ORDER_S 25 +/* SPI_WP_REG : R/W ;bitpos:[21] ;default: 1'b1 ; */ +/*description: Write protect signal output when SPI is idle. 1: output high 0: output low.*/ +#define SPI_WP_REG (BIT(21)) +#define SPI_WP_REG_M (BIT(21)) +#define SPI_WP_REG_V 0x1 +#define SPI_WP_REG_S 21 +/* SPI_FREAD_QUAD : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: In the read operations read-data phase apply 4 signals. 1: enable 0: disable.*/ +#define SPI_FREAD_QUAD (BIT(20)) +#define SPI_FREAD_QUAD_M (BIT(20)) +#define SPI_FREAD_QUAD_V 0x1 +#define SPI_FREAD_QUAD_S 20 +/* SPI_D_POL : R/W ;bitpos:[19] ;default: 1'b1 ; */ +/*description: The bit is used to set MOSI line polarity 1: high 0 low*/ +#define SPI_D_POL (BIT(19)) +#define SPI_D_POL_M (BIT(19)) +#define SPI_D_POL_V 0x1 +#define SPI_D_POL_S 19 +/* SPI_Q_POL : R/W ;bitpos:[18] ;default: 1'b1 ; */ +/*description: The bit is used to set MISO line polarity 1: high 0 low*/ +#define SPI_Q_POL (BIT(18)) +#define SPI_Q_POL_M (BIT(18)) +#define SPI_Q_POL_V 0x1 +#define SPI_Q_POL_S 18 +/* SPI_FREAD_DUAL : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: In the read operations read-data phase apply 2 signals. 1: enable 0: disable.*/ +#define SPI_FREAD_DUAL (BIT(14)) +#define SPI_FREAD_DUAL_M (BIT(14)) +#define SPI_FREAD_DUAL_V 0x1 +#define SPI_FREAD_DUAL_S 14 +/* SPI_FAST_RD_MODE : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: Enable 2/4 lines addr command including read and write command.*/ +#define SPI_FAST_RD_MODE (BIT(13)) +#define SPI_FAST_RD_MODE_M (BIT(13)) +#define SPI_FAST_RD_MODE_V 0x1 +#define SPI_FAST_RD_MODE_S 13 +/* SPI_FCMD_QUAD : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: Apply 4 signals during command phase 1:enable 0: disable*/ +#define SPI_FCMD_QUAD (BIT(8)) +#define SPI_FCMD_QUAD_M (BIT(8)) +#define SPI_FCMD_QUAD_V 0x1 +#define SPI_FCMD_QUAD_S 8 +/* SPI_FCMD_DUAL : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: Apply 2 signals during command phase 1:enable 0: disable*/ +#define SPI_FCMD_DUAL (BIT(7)) +#define SPI_FCMD_DUAL_M (BIT(7)) +#define SPI_FCMD_DUAL_V 0x1 +#define SPI_FCMD_DUAL_S 7 +/* SPI_FADDR_QUAD : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: Apply 4 signals during addr phase 1:enable 0: disable*/ +#define SPI_FADDR_QUAD (BIT(6)) +#define SPI_FADDR_QUAD_M (BIT(6)) +#define SPI_FADDR_QUAD_V 0x1 +#define SPI_FADDR_QUAD_S 6 +/* SPI_FADDR_DUAL : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: Apply 2 signals during addr phase 1:enable 0: disable*/ +#define SPI_FADDR_DUAL (BIT(5)) +#define SPI_FADDR_DUAL_M (BIT(5)) +#define SPI_FADDR_DUAL_V 0x1 +#define SPI_FADDR_DUAL_S 5 +/* SPI_DUMMY_OUT : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: In the dummy phase the signal level of spi is output by the spi controller.*/ +#define SPI_DUMMY_OUT (BIT(3)) +#define SPI_DUMMY_OUT_M (BIT(3)) +#define SPI_DUMMY_OUT_V 0x1 +#define SPI_DUMMY_OUT_S 3 +/* SPI_EXT_HOLD_EN : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: Set the bit to hold spi. The bit is combined with spi_usr_prep_hold + spi_usr_cmd_hold spi_usr_addr_hold spi_usr_dummy_hold spi_usr_din_hold spi_usr_dout_hold and spi_usr_hold_pol.*/ +#define SPI_EXT_HOLD_EN (BIT(2)) +#define SPI_EXT_HOLD_EN_M (BIT(2)) +#define SPI_EXT_HOLD_EN_V 0x1 +#define SPI_EXT_HOLD_EN_S 2 + +#define SPI_CTRL1_REG(i) (REG_SPI_BASE(i) + 0x00C) +/* SPI_CS_HOLD_DELAY : R/W ;bitpos:[19:14] ;default: 6'h1 ; */ +/*description: SPI cs signal is delayed by spi clock cycles.*/ +#define SPI_CS_HOLD_DELAY 0x0000003F +#define SPI_CS_HOLD_DELAY_M ((SPI_CS_HOLD_DELAY_V)<<(SPI_CS_HOLD_DELAY_S)) +#define SPI_CS_HOLD_DELAY_V 0x3F +#define SPI_CS_HOLD_DELAY_S 14 +/* SPI_W16_17_WR_ENA : R/W ;bitpos:[4] ;default: 1'h1 ; */ +/*description: 1:reg_buf[16] [17] can be written 0:reg_buf[16] [17] can not be written.*/ +#define SPI_W16_17_WR_ENA (BIT(4)) +#define SPI_W16_17_WR_ENA_M (BIT(4)) +#define SPI_W16_17_WR_ENA_V 0x1 +#define SPI_W16_17_WR_ENA_S 4 +/* SPI_RSCK_DATA_OUT : R/W ;bitpos:[3] ;default: 1'h0 ; */ +/*description: It saves half a cycle when tsck is the same as rsck. 1: output + data at rsck posedge 0: output data at tsck posedge*/ +#define SPI_RSCK_DATA_OUT (BIT(3)) +#define SPI_RSCK_DATA_OUT_M (BIT(3)) +#define SPI_RSCK_DATA_OUT_V 0x1 +#define SPI_RSCK_DATA_OUT_S 3 +/* SPI_CLK_MODE_13 : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: {CPOL CPHA} 1: support spi clk mode 1 and 3 first edge output data B[0]/B[7]*/ +#define SPI_CLK_MODE_13 (BIT(2)) +#define SPI_CLK_MODE_13_M (BIT(2)) +#define SPI_CLK_MODE_13_V 0x1 +#define SPI_CLK_MODE_13_S 2 +/* SPI_CLK_MODE : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: SPI clock mode bits. 0: SPI clock is off when CS inactive 1: + SPI clock is delayed one cycle after CS inactive 2: SPI clock is delayed two cycles after CS inactive 3: SPI clock is alwasy on.*/ +#define SPI_CLK_MODE 0x00000003 +#define SPI_CLK_MODE_M ((SPI_CLK_MODE_V)<<(SPI_CLK_MODE_S)) +#define SPI_CLK_MODE_V 0x3 +#define SPI_CLK_MODE_S 0 + +#define SPI_CTRL2_REG(i) (REG_SPI_BASE(i) + 0x010) +/* SPI_CS_DELAY_EDGE : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define SPI_CS_DELAY_EDGE (BIT(31)) +#define SPI_CS_DELAY_EDGE_M (BIT(31)) +#define SPI_CS_DELAY_EDGE_V 0x1 +#define SPI_CS_DELAY_EDGE_S 31 +/* SPI_CS_DELAY_NUM : R/W ;bitpos:[29:28] ;default: 2'h0 ; */ +/*description: spi_cs signal is delayed by system clock cycles*/ +#define SPI_CS_DELAY_NUM 0x00000003 +#define SPI_CS_DELAY_NUM_M ((SPI_CS_DELAY_NUM_V)<<(SPI_CS_DELAY_NUM_S)) +#define SPI_CS_DELAY_NUM_V 0x3 +#define SPI_CS_DELAY_NUM_S 28 +/* SPI_CS_DELAY_MODE : R/W ;bitpos:[27:26] ;default: 2'h0 ; */ +/*description: spi_cs signal is delayed by spi_clk . 0: zero 1: if spi_ck_out_edge + or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ +#define SPI_CS_DELAY_MODE 0x00000003 +#define SPI_CS_DELAY_MODE_M ((SPI_CS_DELAY_MODE_V)<<(SPI_CS_DELAY_MODE_S)) +#define SPI_CS_DELAY_MODE_V 0x3 +#define SPI_CS_DELAY_MODE_S 26 +/* SPI_CS_HOLD_TIME : R/W ;bitpos:[25:13] ;default: 13'h1 ; */ +/*description: delay cycles of cs pin by spi clock this bits are combined with spi_cs_hold bit.*/ +#define SPI_CS_HOLD_TIME 0x00001FFF +#define SPI_CS_HOLD_TIME_M ((SPI_CS_HOLD_TIME_V)<<(SPI_CS_HOLD_TIME_S)) +#define SPI_CS_HOLD_TIME_V 0x1FFF +#define SPI_CS_HOLD_TIME_S 13 +/* SPI_CS_SETUP_TIME : R/W ;bitpos:[12:0] ;default: 13'h1 ; */ +/*description: (cycles-1) of prepare phase by spi clock this bits are combined + with spi_cs_setup bit.*/ +#define SPI_CS_SETUP_TIME 0x00001FFF +#define SPI_CS_SETUP_TIME_M ((SPI_CS_SETUP_TIME_V)<<(SPI_CS_SETUP_TIME_S)) +#define SPI_CS_SETUP_TIME_V 0x1FFF +#define SPI_CS_SETUP_TIME_S 0 + +#define SPI_CLOCK_REG(i) (REG_SPI_BASE(i) + 0x014) +/* SPI_CLK_EQU_SYSCLK : R/W ;bitpos:[31] ;default: 1'b1 ; */ +/*description: In the master mode 1: spi_clk is eqaul to system 0: spi_clk is + divided from system clock.*/ +#define SPI_CLK_EQU_SYSCLK (BIT(31)) +#define SPI_CLK_EQU_SYSCLK_M (BIT(31)) +#define SPI_CLK_EQU_SYSCLK_V 0x1 +#define SPI_CLK_EQU_SYSCLK_S 31 +/* SPI_CLKDIV_PRE : R/W ;bitpos:[30:18] ;default: 13'b0 ; */ +/*description: In the master mode it is pre-divider of spi_clk.*/ +#define SPI_CLKDIV_PRE 0x00001FFF +#define SPI_CLKDIV_PRE_M ((SPI_CLKDIV_PRE_V)<<(SPI_CLKDIV_PRE_S)) +#define SPI_CLKDIV_PRE_V 0x1FFF +#define SPI_CLKDIV_PRE_S 18 +/* SPI_CLKCNT_N : R/W ;bitpos:[17:12] ;default: 6'h3 ; */ +/*description: In the master mode it is the divider of spi_clk. So spi_clk frequency + is system/(spi_clkdiv_pre+1)/(spi_clkcnt_N+1)*/ +#define SPI_CLKCNT_N 0x0000003F +#define SPI_CLKCNT_N_M ((SPI_CLKCNT_N_V)<<(SPI_CLKCNT_N_S)) +#define SPI_CLKCNT_N_V 0x3F +#define SPI_CLKCNT_N_S 12 +/* SPI_CLKCNT_H : R/W ;bitpos:[11:6] ;default: 6'h1 ; */ +/*description: In the master mode it must be floor((spi_clkcnt_N+1)/2-1). In + the slave mode it must be 0.*/ +#define SPI_CLKCNT_H 0x0000003F +#define SPI_CLKCNT_H_M ((SPI_CLKCNT_H_V)<<(SPI_CLKCNT_H_S)) +#define SPI_CLKCNT_H_V 0x3F +#define SPI_CLKCNT_H_S 6 +/* SPI_CLKCNT_L : R/W ;bitpos:[5:0] ;default: 6'h3 ; */ +/*description: In the master mode it must be equal to spi_clkcnt_N. In the slave + mode it must be 0.*/ +#define SPI_CLKCNT_L 0x0000003F +#define SPI_CLKCNT_L_M ((SPI_CLKCNT_L_V)<<(SPI_CLKCNT_L_S)) +#define SPI_CLKCNT_L_V 0x3F +#define SPI_CLKCNT_L_S 0 + +#define SPI_USER_REG(i) (REG_SPI_BASE(i) + 0x018) +/* SPI_USR_COMMAND : R/W ;bitpos:[31] ;default: 1'b1 ; */ +/*description: This bit enable the command phase of an operation.*/ +#define SPI_USR_COMMAND (BIT(31)) +#define SPI_USR_COMMAND_M (BIT(31)) +#define SPI_USR_COMMAND_V 0x1 +#define SPI_USR_COMMAND_S 31 +/* SPI_USR_ADDR : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: This bit enable the address phase of an operation.*/ +#define SPI_USR_ADDR (BIT(30)) +#define SPI_USR_ADDR_M (BIT(30)) +#define SPI_USR_ADDR_V 0x1 +#define SPI_USR_ADDR_S 30 +/* SPI_USR_DUMMY : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: This bit enable the dummy phase of an operation.*/ +#define SPI_USR_DUMMY (BIT(29)) +#define SPI_USR_DUMMY_M (BIT(29)) +#define SPI_USR_DUMMY_V 0x1 +#define SPI_USR_DUMMY_S 29 +/* SPI_USR_MISO : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: This bit enable the read-data phase of an operation.*/ +#define SPI_USR_MISO (BIT(28)) +#define SPI_USR_MISO_M (BIT(28)) +#define SPI_USR_MISO_V 0x1 +#define SPI_USR_MISO_S 28 +/* SPI_USR_MOSI : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: This bit enable the write-data phase of an operation.*/ +#define SPI_USR_MOSI (BIT(27)) +#define SPI_USR_MOSI_M (BIT(27)) +#define SPI_USR_MOSI_V 0x1 +#define SPI_USR_MOSI_S 27 +/* SPI_USR_DUMMY_IDLE : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: spi clock is disable in dummy phase when the bit is enable.*/ +#define SPI_USR_DUMMY_IDLE (BIT(26)) +#define SPI_USR_DUMMY_IDLE_M (BIT(26)) +#define SPI_USR_DUMMY_IDLE_V 0x1 +#define SPI_USR_DUMMY_IDLE_S 26 +/* SPI_USR_MOSI_HIGHPART : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: write-data phase only access to high-part of the buffer spi_w8~spi_w15. + 1: enable 0: disable.*/ +#define SPI_USR_MOSI_HIGHPART (BIT(25)) +#define SPI_USR_MOSI_HIGHPART_M (BIT(25)) +#define SPI_USR_MOSI_HIGHPART_V 0x1 +#define SPI_USR_MOSI_HIGHPART_S 25 +/* SPI_USR_MISO_HIGHPART : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: read-data phase only access to high-part of the buffer spi_w8~spi_w15. + 1: enable 0: disable.*/ +#define SPI_USR_MISO_HIGHPART (BIT(24)) +#define SPI_USR_MISO_HIGHPART_M (BIT(24)) +#define SPI_USR_MISO_HIGHPART_V 0x1 +#define SPI_USR_MISO_HIGHPART_S 24 +/* SPI_USR_PREP_HOLD : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: spi is hold at prepare state the bit are combined with spi_usr_hold_pol bit.*/ +#define SPI_USR_PREP_HOLD (BIT(23)) +#define SPI_USR_PREP_HOLD_M (BIT(23)) +#define SPI_USR_PREP_HOLD_V 0x1 +#define SPI_USR_PREP_HOLD_S 23 +/* SPI_USR_CMD_HOLD : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: spi is hold at command state the bit are combined with spi_usr_hold_pol bit.*/ +#define SPI_USR_CMD_HOLD (BIT(22)) +#define SPI_USR_CMD_HOLD_M (BIT(22)) +#define SPI_USR_CMD_HOLD_V 0x1 +#define SPI_USR_CMD_HOLD_S 22 +/* SPI_USR_ADDR_HOLD : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: spi is hold at address state the bit are combined with spi_usr_hold_pol bit.*/ +#define SPI_USR_ADDR_HOLD (BIT(21)) +#define SPI_USR_ADDR_HOLD_M (BIT(21)) +#define SPI_USR_ADDR_HOLD_V 0x1 +#define SPI_USR_ADDR_HOLD_S 21 +/* SPI_USR_DUMMY_HOLD : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: spi is hold at dummy state the bit are combined with spi_usr_hold_pol bit.*/ +#define SPI_USR_DUMMY_HOLD (BIT(20)) +#define SPI_USR_DUMMY_HOLD_M (BIT(20)) +#define SPI_USR_DUMMY_HOLD_V 0x1 +#define SPI_USR_DUMMY_HOLD_S 20 +/* SPI_USR_DIN_HOLD : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: spi is hold at data in state the bit are combined with spi_usr_hold_pol bit.*/ +#define SPI_USR_DIN_HOLD (BIT(19)) +#define SPI_USR_DIN_HOLD_M (BIT(19)) +#define SPI_USR_DIN_HOLD_V 0x1 +#define SPI_USR_DIN_HOLD_S 19 +/* SPI_USR_DOUT_HOLD : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: spi is hold at data out state the bit are combined with spi_usr_hold_pol bit.*/ +#define SPI_USR_DOUT_HOLD (BIT(18)) +#define SPI_USR_DOUT_HOLD_M (BIT(18)) +#define SPI_USR_DOUT_HOLD_V 0x1 +#define SPI_USR_DOUT_HOLD_S 18 +/* SPI_USR_HOLD_POL : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: It is combined with hold bits to set the polarity of spi hold + line 1: spi will be held when spi hold line is high 0: spi will be held when spi hold line is low*/ +#define SPI_USR_HOLD_POL (BIT(17)) +#define SPI_USR_HOLD_POL_M (BIT(17)) +#define SPI_USR_HOLD_POL_V 0x1 +#define SPI_USR_HOLD_POL_S 17 +/* SPI_SIO : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: Set the bit to enable 3-line half duplex communication mosi and + miso signals share the same pin. 1: enable 0: disable.*/ +#define SPI_SIO (BIT(16)) +#define SPI_SIO_M (BIT(16)) +#define SPI_SIO_V 0x1 +#define SPI_SIO_S 16 +/* SPI_FWRITE_QUAD : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: In the write operations read-data phase apply 4 signals*/ +#define SPI_FWRITE_QUAD (BIT(13)) +#define SPI_FWRITE_QUAD_M (BIT(13)) +#define SPI_FWRITE_QUAD_V 0x1 +#define SPI_FWRITE_QUAD_S 13 +/* SPI_FWRITE_DUAL : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: In the write operations read-data phase apply 2 signals*/ +#define SPI_FWRITE_DUAL (BIT(12)) +#define SPI_FWRITE_DUAL_M (BIT(12)) +#define SPI_FWRITE_DUAL_V 0x1 +#define SPI_FWRITE_DUAL_S 12 +/* SPI_WR_BYTE_ORDER : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: In command address write-data (MOSI) phases 1: big-endian 0: litte_endian*/ +#define SPI_WR_BYTE_ORDER (BIT(11)) +#define SPI_WR_BYTE_ORDER_M (BIT(11)) +#define SPI_WR_BYTE_ORDER_V 0x1 +#define SPI_WR_BYTE_ORDER_S 11 +/* SPI_RD_BYTE_ORDER : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: In read-data (MISO) phase 1: big-endian 0: little_endian*/ +#define SPI_RD_BYTE_ORDER (BIT(10)) +#define SPI_RD_BYTE_ORDER_M (BIT(10)) +#define SPI_RD_BYTE_ORDER_V 0x1 +#define SPI_RD_BYTE_ORDER_S 10 +/* SPI_CK_OUT_EDGE : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: the bit combined with spi_mosi_delay_mode bits to set mosi signal delay mode.*/ +#define SPI_CK_OUT_EDGE (BIT(9)) +#define SPI_CK_OUT_EDGE_M (BIT(9)) +#define SPI_CK_OUT_EDGE_V 0x1 +#define SPI_CK_OUT_EDGE_S 9 +/* SPI_RSCK_I_EDGE : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: In the slave mode this bit can be used to change the polarity + of rsck. 0: rsck = !spi_ck_i. 1:rsck = spi_ck_i.*/ +#define SPI_RSCK_I_EDGE (BIT(8)) +#define SPI_RSCK_I_EDGE_M (BIT(8)) +#define SPI_RSCK_I_EDGE_V 0x1 +#define SPI_RSCK_I_EDGE_S 8 +/* SPI_CS_SETUP : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: spi cs is enable when spi is in prepare phase. 1: enable 0: disable.*/ +#define SPI_CS_SETUP (BIT(7)) +#define SPI_CS_SETUP_M (BIT(7)) +#define SPI_CS_SETUP_V 0x1 +#define SPI_CS_SETUP_S 7 +/* SPI_CS_HOLD : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: spi cs keep low when spi is in done phase. 1: enable 0: disable.*/ +#define SPI_CS_HOLD (BIT(6)) +#define SPI_CS_HOLD_M (BIT(6)) +#define SPI_CS_HOLD_V 0x1 +#define SPI_CS_HOLD_S 6 +/* SPI_TSCK_I_EDGE : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: In the slave mode this bit can be used to change the polarity + of tsck. 0: tsck = spi_ck_i. 1:tsck = !spi_ck_i.*/ +#define SPI_TSCK_I_EDGE (BIT(5)) +#define SPI_TSCK_I_EDGE_M (BIT(5)) +#define SPI_TSCK_I_EDGE_V 0x1 +#define SPI_TSCK_I_EDGE_S 5 +/* SPI_TX_START_BIT : R/W ;bitpos:[3:1] ;default: 3'd7 ; */ +/*description: It determines the start time of tx output data. It can be used + for timing adjustment in MISO slave mode.*/ +#define SPI_TX_START_BIT 0x00000007 +#define SPI_TX_START_BIT_M ((SPI_TX_START_BIT_V)<<(SPI_TX_START_BIT_S)) +#define SPI_TX_START_BIT_V 0x7 +#define SPI_TX_START_BIT_S 1 +/* SPI_DOUTDIN : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: Set the bit to enable full duplex communication. 1: enable 0: disable.*/ +#define SPI_DOUTDIN (BIT(0)) +#define SPI_DOUTDIN_M (BIT(0)) +#define SPI_DOUTDIN_V 0x1 +#define SPI_DOUTDIN_S 0 + +#define SPI_USER1_REG(i) (REG_SPI_BASE(i) + 0x01C) +/* SPI_USR_ADDR_BITLEN : R/W ;bitpos:[31:26] ;default: 6'd23 ; */ +/*description: The length in bits of address phase. The register value shall be (bit_num-1).*/ +#define SPI_USR_ADDR_BITLEN 0x0000003F +#define SPI_USR_ADDR_BITLEN_M ((SPI_USR_ADDR_BITLEN_V)<<(SPI_USR_ADDR_BITLEN_S)) +#define SPI_USR_ADDR_BITLEN_V 0x3F +#define SPI_USR_ADDR_BITLEN_S 26 +/* SPI_USR_DUMMY_CYCLELEN : R/W ;bitpos:[7:0] ;default: 8'd7 ; */ +/*description: The length in spi_clk cycles of dummy phase. The register value + shall be (cycle_num-1).*/ +#define SPI_USR_DUMMY_CYCLELEN 0x000000FF +#define SPI_USR_DUMMY_CYCLELEN_M ((SPI_USR_DUMMY_CYCLELEN_V)<<(SPI_USR_DUMMY_CYCLELEN_S)) +#define SPI_USR_DUMMY_CYCLELEN_V 0xFF +#define SPI_USR_DUMMY_CYCLELEN_S 0 + +#define SPI_USER2_REG(i) (REG_SPI_BASE(i) + 0x020) +/* SPI_USR_COMMAND_BITLEN : R/W ;bitpos:[31:28] ;default: 4'd7 ; */ +/*description: The length in bits of command phase. The register value shall be (bit_num-1)*/ +#define SPI_USR_COMMAND_BITLEN 0x0000000F +#define SPI_USR_COMMAND_BITLEN_M ((SPI_USR_COMMAND_BITLEN_V)<<(SPI_USR_COMMAND_BITLEN_S)) +#define SPI_USR_COMMAND_BITLEN_V 0xF +#define SPI_USR_COMMAND_BITLEN_S 28 +/* SPI_USR_COMMAND_VALUE : R/W ;bitpos:[15:0] ;default: 16'b0 ; */ +/*description: The value of command.*/ +#define SPI_USR_COMMAND_VALUE 0x0000FFFF +#define SPI_USR_COMMAND_VALUE_M ((SPI_USR_COMMAND_VALUE_V)<<(SPI_USR_COMMAND_VALUE_S)) +#define SPI_USR_COMMAND_VALUE_V 0xFFFF +#define SPI_USR_COMMAND_VALUE_S 0 + +#define SPI_MOSI_DLEN_REG(i) (REG_SPI_BASE(i) + 0x024) +/* SPI_USR_MOSI_DBITLEN : R/W ;bitpos:[23:0] ;default: 24'h0 ; */ +/*description: The length in bits of write-data. The register value shall be (bit_num-1).*/ +#define SPI_USR_MOSI_DBITLEN 0x00FFFFFF +#define SPI_USR_MOSI_DBITLEN_M ((SPI_USR_MOSI_DBITLEN_V)<<(SPI_USR_MOSI_DBITLEN_S)) +#define SPI_USR_MOSI_DBITLEN_V 0xFFFFFF +#define SPI_USR_MOSI_DBITLEN_S 0 + +#define SPI_MISO_DLEN_REG(i) (REG_SPI_BASE(i) + 0x028) +/* SPI_USR_MISO_DBITLEN : R/W ;bitpos:[23:0] ;default: 24'h0 ; */ +/*description: The length in bits of read-data. The register value shall be (bit_num-1).*/ +#define SPI_USR_MISO_DBITLEN 0x00FFFFFF +#define SPI_USR_MISO_DBITLEN_M ((SPI_USR_MISO_DBITLEN_V)<<(SPI_USR_MISO_DBITLEN_S)) +#define SPI_USR_MISO_DBITLEN_V 0xFFFFFF +#define SPI_USR_MISO_DBITLEN_S 0 + +#define SPI_SLV_WR_STATUS_REG(i) (REG_SPI_BASE(i) + 0x02C) +/* SPI_SLV_WR_STATUS : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: In the master mode this register are the higher 32bits in the + 64 bits address condition.*/ +#define SPI_SLV_WR_STATUS 0xFFFFFFFF +#define SPI_SLV_WR_STATUS_M ((SPI_SLV_WR_STATUS_V)<<(SPI_SLV_WR_STATUS_S)) +#define SPI_SLV_WR_STATUS_V 0xFFFFFFFF +#define SPI_SLV_WR_STATUS_S 0 + +#define SPI_MISC_REG(i) (REG_SPI_BASE(i) + 0x030) +/* SPI_QUAD_DIN_PIN_SWAP : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: 1: spi quad input swap enable 0: spi quad input swap disable*/ +#define SPI_QUAD_DIN_PIN_SWAP (BIT(31)) +#define SPI_QUAD_DIN_PIN_SWAP_M (BIT(31)) +#define SPI_QUAD_DIN_PIN_SWAP_V 0x1 +#define SPI_QUAD_DIN_PIN_SWAP_S 31 +/* SPI_CS_KEEP_ACTIVE : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: spi cs line keep low when the bit is set.*/ +#define SPI_CS_KEEP_ACTIVE (BIT(30)) +#define SPI_CS_KEEP_ACTIVE_M (BIT(30)) +#define SPI_CS_KEEP_ACTIVE_V 0x1 +#define SPI_CS_KEEP_ACTIVE_S 30 +/* SPI_CK_IDLE_EDGE : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: 1: spi clk line is high when idle 0: spi clk line is low when idle*/ +#define SPI_CK_IDLE_EDGE (BIT(29)) +#define SPI_CK_IDLE_EDGE_M (BIT(29)) +#define SPI_CK_IDLE_EDGE_V 0x1 +#define SPI_CK_IDLE_EDGE_S 29 +/* SPI_Q_IDLE_OUT : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: The idle output value of spi_q.*/ +#define SPI_Q_IDLE_OUT (BIT(27)) +#define SPI_Q_IDLE_OUT_M (BIT(27)) +#define SPI_Q_IDLE_OUT_V 0x1 +#define SPI_Q_IDLE_OUT_S 27 +/* SPI_SLAVE_CS_POL : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: spi slave input cs polarity select. 1: inv 0: not change*/ +#define SPI_SLAVE_CS_POL (BIT(23)) +#define SPI_SLAVE_CS_POL_M (BIT(23)) +#define SPI_SLAVE_CS_POL_V 0x1 +#define SPI_SLAVE_CS_POL_S 23 +/* SPI_MASTER_CS_POL : R/W ;bitpos:[8:6] ;default: 3'b0 ; */ +/*description: In the master mode the bits are the polarity of spi cs line + the value is equivalent to spi_cs ^ spi_master_cs_pol.*/ +#define SPI_MASTER_CS_POL 0x00000007 +#define SPI_MASTER_CS_POL_M ((SPI_MASTER_CS_POL_V)<<(SPI_MASTER_CS_POL_S)) +#define SPI_MASTER_CS_POL_V 0x7 +#define SPI_MASTER_CS_POL_S 6 +/* SPI_CK_DIS : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: 1: spi clk out disable 0: spi clk out enable*/ +#define SPI_CK_DIS (BIT(5)) +#define SPI_CK_DIS_M (BIT(5)) +#define SPI_CK_DIS_V 0x1 +#define SPI_CK_DIS_S 5 +/* SPI_CS2_DIS : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: SPI CS2 pin enable 1: disable CS2 0: spi_cs2 signal is from/to CS2 pin*/ +#define SPI_CS2_DIS (BIT(2)) +#define SPI_CS2_DIS_M (BIT(2)) +#define SPI_CS2_DIS_V 0x1 +#define SPI_CS2_DIS_S 2 +/* SPI_CS1_DIS : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: SPI CS1 pin enable 1: disable CS1 0: spi_cs1 signal is from/to CS1 pin*/ +#define SPI_CS1_DIS (BIT(1)) +#define SPI_CS1_DIS_M (BIT(1)) +#define SPI_CS1_DIS_V 0x1 +#define SPI_CS1_DIS_S 1 +/* SPI_CS0_DIS : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: SPI CS0 pin enable 1: disable CS0 0: spi_cs0 signal is from/to CS0 pin*/ +#define SPI_CS0_DIS (BIT(0)) +#define SPI_CS0_DIS_M (BIT(0)) +#define SPI_CS0_DIS_V 0x1 +#define SPI_CS0_DIS_S 0 + +#define SPI_SLAVE_REG(i) (REG_SPI_BASE(i) + 0x034) +/* SPI_SYNC_RESET : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: Software reset enable reset the spi clock line cs line and data lines.*/ +#define SPI_SYNC_RESET (BIT(31)) +#define SPI_SYNC_RESET_M (BIT(31)) +#define SPI_SYNC_RESET_V 0x1 +#define SPI_SYNC_RESET_S 31 +/* SPI_SLAVE_MODE : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: Set SPI work mode. 1: slave mode 0: master mode.*/ +#define SPI_SLAVE_MODE (BIT(30)) +#define SPI_SLAVE_MODE_M (BIT(30)) +#define SPI_SLAVE_MODE_V 0x1 +#define SPI_SLAVE_MODE_S 30 +/* SPI_TRANS_CNT : RO ;bitpos:[26:23] ;default: 4'b0 ; */ +/*description: The operations counter in both the master mode and the slave mode.*/ +#define SPI_TRANS_CNT 0x0000000F +#define SPI_TRANS_CNT_M ((SPI_TRANS_CNT_V)<<(SPI_TRANS_CNT_S)) +#define SPI_TRANS_CNT_V 0xF +#define SPI_TRANS_CNT_S 23 +/* SPI_INT_TRANS_DONE_EN : R/W ;bitpos:[9] ;default: 1'b1 ; */ +/*description: spi_trans_done Interrupt enable. 1: enable 0: disable*/ +#define SPI_INT_TRANS_DONE_EN (BIT(9)) +#define SPI_INT_TRANS_DONE_EN_M (BIT(9)) +#define SPI_INT_TRANS_DONE_EN_V 0x1 +#define SPI_INT_TRANS_DONE_EN_S 9 +/* SPI_INT_WR_DMA_DONE_EN : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: spi_slv_wr_dma Interrupt enable. 1: enable 0: disable*/ +#define SPI_INT_WR_DMA_DONE_EN (BIT(8)) +#define SPI_INT_WR_DMA_DONE_EN_M (BIT(8)) +#define SPI_INT_WR_DMA_DONE_EN_V 0x1 +#define SPI_INT_WR_DMA_DONE_EN_S 8 +/* SPI_INT_RD_DMA_DONE_EN : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: spi_slv_rd_dma Interrupt enable. 1: enable 0: disable*/ +#define SPI_INT_RD_DMA_DONE_EN (BIT(7)) +#define SPI_INT_RD_DMA_DONE_EN_M (BIT(7)) +#define SPI_INT_RD_DMA_DONE_EN_V 0x1 +#define SPI_INT_RD_DMA_DONE_EN_S 7 +/* SPI_INT_WR_BUF_DONE_EN : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: spi_slv_wr_buf Interrupt enable. 1: enable 0: disable*/ +#define SPI_INT_WR_BUF_DONE_EN (BIT(6)) +#define SPI_INT_WR_BUF_DONE_EN_M (BIT(6)) +#define SPI_INT_WR_BUF_DONE_EN_V 0x1 +#define SPI_INT_WR_BUF_DONE_EN_S 6 +/* SPI_INT_RD_BUF_DONE_EN : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: spi_slv_rd_buf Interrupt enable. 1: enable 0: disable*/ +#define SPI_INT_RD_BUF_DONE_EN (BIT(5)) +#define SPI_INT_RD_BUF_DONE_EN_M (BIT(5)) +#define SPI_INT_RD_BUF_DONE_EN_V 0x1 +#define SPI_INT_RD_BUF_DONE_EN_S 5 +/* SPI_TRANS_DONE : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The interrupt raw bit for the completion of any operation in + both the master mode and the slave mode.*/ +#define SPI_TRANS_DONE (BIT(4)) +#define SPI_TRANS_DONE_M (BIT(4)) +#define SPI_TRANS_DONE_V 0x1 +#define SPI_TRANS_DONE_S 4 + +#define SPI_SLAVE1_REG(i) (REG_SPI_BASE(i) + 0x038) +/* SPI_SLV_LAST_ADDR : R/W ;bitpos:[21:15] ;default: 7'b0 ; */ +/*description: In the slave mode it is the value of address.*/ +#define SPI_SLV_LAST_ADDR 0x0000007F +#define SPI_SLV_LAST_ADDR_M ((SPI_SLV_LAST_ADDR_V)<<(SPI_SLV_LAST_ADDR_S)) +#define SPI_SLV_LAST_ADDR_V 0x7F +#define SPI_SLV_LAST_ADDR_S 15 +/* SPI_SLV_LAST_COMMAND : R/W ;bitpos:[14:12] ;default: 3'b0 ; */ +/*description: In the slave mode it is the value of command.*/ +#define SPI_SLV_LAST_COMMAND 0x00000007 +#define SPI_SLV_LAST_COMMAND_M ((SPI_SLV_LAST_COMMAND_V)<<(SPI_SLV_LAST_COMMAND_S)) +#define SPI_SLV_LAST_COMMAND_V 0x7 +#define SPI_SLV_LAST_COMMAND_S 12 +/* SPI_SLV_WR_DMA_DONE : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: The interrupt raw bit for the completion of dma write operation + in the slave mode.*/ +#define SPI_SLV_WR_DMA_DONE (BIT(11)) +#define SPI_SLV_WR_DMA_DONE_M (BIT(11)) +#define SPI_SLV_WR_DMA_DONE_V 0x1 +#define SPI_SLV_WR_DMA_DONE_S 11 +/* SPI_SLV_WR_ADDR_BYTELEN : R/W ;bitpos:[7:4] ;default: 4'h0 ; */ +/*description: In the slave mode it is the address length in bytes for write-buffer + operation. The register value shall be byte_num.*/ +#define SPI_SLV_WR_ADDR_BYTELEN 0x0000000F +#define SPI_SLV_WR_ADDR_BYTELEN_M ((SPI_SLV_WR_ADDR_BYTELEN_V)<<(SPI_SLV_WR_ADDR_BYTELEN_S)) +#define SPI_SLV_WR_ADDR_BYTELEN_V 0xF +#define SPI_SLV_WR_ADDR_BYTELEN_S 4 +/* SPI_SLV_RD_ADDR_BYTELEN : R/W ;bitpos:[3:0] ;default: 4'h0 ; */ +/*description: In the slave mode it is the address length in bytes for read-buffer + operation. The register value shall be byte_num.*/ +#define SPI_SLV_RD_ADDR_BYTELEN 0x0000000F +#define SPI_SLV_RD_ADDR_BYTELEN_M ((SPI_SLV_RD_ADDR_BYTELEN_V)<<(SPI_SLV_RD_ADDR_BYTELEN_S)) +#define SPI_SLV_RD_ADDR_BYTELEN_V 0xF +#define SPI_SLV_RD_ADDR_BYTELEN_S 0 + +#define SPI_SLAVE2_REG(i) (REG_SPI_BASE(i) + 0x03C) +/* SPI_SLV_RD_DMA_DONE : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The interrupt raw bit for the completion of dma read operation + in the slave mode.*/ +#define SPI_SLV_RD_DMA_DONE (BIT(8)) +#define SPI_SLV_RD_DMA_DONE_M (BIT(8)) +#define SPI_SLV_RD_DMA_DONE_V 0x1 +#define SPI_SLV_RD_DMA_DONE_S 8 +/* SPI_SLV_WR_DUMMY_BYTELEN : R/W ;bitpos:[7:4] ;default: 4'h0 ; */ +/*description: In the slave mode it is the length in spi_clk byte cycles of + dummy phase for write operations.*/ +#define SPI_SLV_WR_DUMMY_BYTELEN 0x0000000F +#define SPI_SLV_WR_DUMMY_BYTELEN_M ((SPI_SLV_WR_DUMMY_BYTELEN_V)<<(SPI_SLV_WR_DUMMY_BYTELEN_S)) +#define SPI_SLV_WR_DUMMY_BYTELEN_V 0xF +#define SPI_SLV_WR_DUMMY_BYTELEN_S 4 +/* SPI_SLV_RD_DUMMY_BYTELEN : R/W ;bitpos:[3:0] ;default: 4'h0 ; */ +/*description: In the slave mode it is the length in spi_clk byte cycles of + dummy phase for read operations.*/ +#define SPI_SLV_RD_DUMMY_BYTELEN 0x0000000F +#define SPI_SLV_RD_DUMMY_BYTELEN_M ((SPI_SLV_RD_DUMMY_BYTELEN_V)<<(SPI_SLV_RD_DUMMY_BYTELEN_S)) +#define SPI_SLV_RD_DUMMY_BYTELEN_V 0xF +#define SPI_SLV_RD_DUMMY_BYTELEN_S 0 + +#define SPI_SLV_WRBUF_DLEN_REG(i) (REG_SPI_BASE(i) + 0x040) +/* SPI_SLV_WR_BUF_DONE : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: The interrupt raw bit for the completion of write-buffer operation + in the slave mode.*/ +#define SPI_SLV_WR_BUF_DONE (BIT(24)) +#define SPI_SLV_WR_BUF_DONE_M (BIT(24)) +#define SPI_SLV_WR_BUF_DONE_V 0x1 +#define SPI_SLV_WR_BUF_DONE_S 24 +/* SPI_SLV_WRBUF_DBITLEN : R/W ;bitpos:[23:0] ;default: 24'h0 ; */ +/*description: In the slave mode it is the length in bits for write-buffer operations. + The register value shall be (bit_num-1).*/ +#define SPI_SLV_WRBUF_DBITLEN 0x00FFFFFF +#define SPI_SLV_WRBUF_DBITLEN_M ((SPI_SLV_WRBUF_DBITLEN_V)<<(SPI_SLV_WRBUF_DBITLEN_S)) +#define SPI_SLV_WRBUF_DBITLEN_V 0xFFFFFF +#define SPI_SLV_WRBUF_DBITLEN_S 0 + +#define SPI_SLV_RDBUF_DLEN_REG(i) (REG_SPI_BASE(i) + 0x044) +/* SPI_SLV_RD_BUF_DONE : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: The interrupt raw bit for the completion of read-buffer operation + in the slave mode.*/ +#define SPI_SLV_RD_BUF_DONE (BIT(24)) +#define SPI_SLV_RD_BUF_DONE_M (BIT(24)) +#define SPI_SLV_RD_BUF_DONE_V 0x1 +#define SPI_SLV_RD_BUF_DONE_S 24 +/* SPI_SLV_RDBUF_DBITLEN : R/W ;bitpos:[23:0] ;default: 24'h0 ; */ +/*description: In the slave mode it is the length in bits for read-buffer operations. + The register value shall be (bit_num-1).*/ +#define SPI_SLV_RDBUF_DBITLEN 0x00FFFFFF +#define SPI_SLV_RDBUF_DBITLEN_M ((SPI_SLV_RDBUF_DBITLEN_V)<<(SPI_SLV_RDBUF_DBITLEN_S)) +#define SPI_SLV_RDBUF_DBITLEN_V 0xFFFFFF +#define SPI_SLV_RDBUF_DBITLEN_S 0 + +#define SPI_SLV_RD_BYTE_REG(i) (REG_SPI_BASE(i) + 0x048) +/* SPI_SLV_RDATA_BIT : RW ;bitpos:[23:0] ;default: 24'b0 ; */ +/*description: In the slave mode it is the byte number of read data.*/ +#define SPI_SLV_RDATA_BIT 0x00FFFFFF +#define SPI_SLV_RDATA_BIT_M ((SPI_SLV_RDATA_BIT_V)<<(SPI_SLV_RDATA_BIT_S)) +#define SPI_SLV_RDATA_BIT_V 0xFFFFFF +#define SPI_SLV_RDATA_BIT_S 0 + +#define SPI_FSM_REG(i) (REG_SPI_BASE(i) + 0x050) +/* SPI_ST : RO ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: The status of spi state machine. 0: idle state 1: preparation + state 2: send command state 3: send data state 4: red data state 5:write data state 6: wait state 7: done state.*/ +#define SPI_ST 0x00000007 +#define SPI_ST_M ((SPI_ST_V)<<(SPI_ST_S)) +#define SPI_ST_V 0x7 +#define SPI_ST_S 0 + +#define SPI_HOLD_REG(i) (REG_SPI_BASE(i) + 0x054) +/* SPI_HOLD_OUT_TIME : R/W ;bitpos:[6:4] ;default: 3'b0 ; */ +/*description: set the hold cycles of output spi_hold signal when spi_hold_out_en is enable.*/ +#define SPI_HOLD_OUT_TIME 0x00000007 +#define SPI_HOLD_OUT_TIME_M ((SPI_HOLD_OUT_TIME_V)<<(SPI_HOLD_OUT_TIME_S)) +#define SPI_HOLD_OUT_TIME_V 0x7 +#define SPI_HOLD_OUT_TIME_S 4 +/* SPI_HOLD_OUT_EN : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: Enable set spi output hold value to spi_hold_reg. It can be used + to hold spi state machine with spi_ext_hold_en and other usr hold signals.*/ +#define SPI_HOLD_OUT_EN (BIT(3)) +#define SPI_HOLD_OUT_EN_M (BIT(3)) +#define SPI_HOLD_OUT_EN_V 0x1 +#define SPI_HOLD_OUT_EN_S 3 +/* SPI_HOLD_VAL_REG : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: spi hold output value which should be used with spi_hold_out_en.*/ +#define SPI_HOLD_VAL_REG (BIT(2)) +#define SPI_HOLD_VAL_REG_M (BIT(2)) +#define SPI_HOLD_VAL_REG_V 0x1 +#define SPI_HOLD_VAL_REG_S 2 +/* SPI_INT_HOLD_ENA : R/W ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: This register is for two SPI masters to share the same cs clock + and data signals. The bits of one SPI are set if the other SPI is busy the SPI will be hold. 1(3): hold at idle phase 2: hold at prepare phase.*/ +#define SPI_INT_HOLD_ENA 0x00000003 +#define SPI_INT_HOLD_ENA_M ((SPI_INT_HOLD_ENA_V)<<(SPI_INT_HOLD_ENA_S)) +#define SPI_INT_HOLD_ENA_V 0x3 +#define SPI_INT_HOLD_ENA_S 0 + +#define SPI_DMA_CONF_REG(i) (REG_SPI_BASE(i) + 0x058) +/* SPI_CONTINUE_POP_DATA_CLR : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: Disable spi slave dma to pop data continuously in next transmission + in dma half duplex slave mode. 1: disable continue transmit. 0: enable continue transmit.*/ +#define SPI_CONTINUE_POP_DATA_CLR (BIT(17)) +#define SPI_CONTINUE_POP_DATA_CLR_M (BIT(17)) +#define SPI_CONTINUE_POP_DATA_CLR_V 0x1 +#define SPI_CONTINUE_POP_DATA_CLR_S 17 +/* SPI_DMA_CONTINUE : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: spi dma continue tx/rx data.*/ +#define SPI_DMA_CONTINUE (BIT(16)) +#define SPI_DMA_CONTINUE_M (BIT(16)) +#define SPI_DMA_CONTINUE_V 0x1 +#define SPI_DMA_CONTINUE_S 16 +/* SPI_DMA_TX_STOP : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: spi dma write data stop when in continue tx/rx mode.*/ +#define SPI_DMA_TX_STOP (BIT(15)) +#define SPI_DMA_TX_STOP_M (BIT(15)) +#define SPI_DMA_TX_STOP_V 0x1 +#define SPI_DMA_TX_STOP_S 15 +/* SPI_DMA_RX_STOP : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: spi dma read data stop when in continue tx/rx mode.*/ +#define SPI_DMA_RX_STOP (BIT(14)) +#define SPI_DMA_RX_STOP_M (BIT(14)) +#define SPI_DMA_RX_STOP_V 0x1 +#define SPI_DMA_RX_STOP_S 14 +/* SPI_MEM_TRANS_EN : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define SPI_MEM_TRANS_EN (BIT(13)) +#define SPI_MEM_TRANS_EN_M (BIT(13)) +#define SPI_MEM_TRANS_EN_V 0x1 +#define SPI_MEM_TRANS_EN_S 13 +/* SPI_OUT_DATA_BURST_EN : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: spi dma read data from memory in burst mode.*/ +#define SPI_OUT_DATA_BURST_EN (BIT(12)) +#define SPI_OUT_DATA_BURST_EN_M (BIT(12)) +#define SPI_OUT_DATA_BURST_EN_V 0x1 +#define SPI_OUT_DATA_BURST_EN_S 12 +/* SPI_INDSCR_BURST_EN : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: read descriptor use burst mode when write data to memory.*/ +#define SPI_INDSCR_BURST_EN (BIT(11)) +#define SPI_INDSCR_BURST_EN_M (BIT(11)) +#define SPI_INDSCR_BURST_EN_V 0x1 +#define SPI_INDSCR_BURST_EN_S 11 +/* SPI_OUTDSCR_BURST_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: read descriptor use burst mode when read data for memory.*/ +#define SPI_OUTDSCR_BURST_EN (BIT(10)) +#define SPI_OUTDSCR_BURST_EN_M (BIT(10)) +#define SPI_OUTDSCR_BURST_EN_V 0x1 +#define SPI_OUTDSCR_BURST_EN_S 10 +/* SPI_OUT_EOF_MODE : R/W ;bitpos:[9] ;default: 1'b1 ; */ +/*description: out eof flag generation mode . 1: when dma pop all data from + fifo 0:when ahb push all data to fifo.*/ +#define SPI_OUT_EOF_MODE (BIT(9)) +#define SPI_OUT_EOF_MODE_M (BIT(9)) +#define SPI_OUT_EOF_MODE_V 0x1 +#define SPI_OUT_EOF_MODE_S 9 +/* SPI_OUT_AUTO_WRBACK : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: when the bit is set DMA continue to use the next inlink node + when the length of inlink is 0.*/ +#define SPI_OUT_AUTO_WRBACK (BIT(8)) +#define SPI_OUT_AUTO_WRBACK_M (BIT(8)) +#define SPI_OUT_AUTO_WRBACK_V 0x1 +#define SPI_OUT_AUTO_WRBACK_S 8 +/* SPI_OUT_LOOP_TEST : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: Set bit to test out link.*/ +#define SPI_OUT_LOOP_TEST (BIT(7)) +#define SPI_OUT_LOOP_TEST_M (BIT(7)) +#define SPI_OUT_LOOP_TEST_V 0x1 +#define SPI_OUT_LOOP_TEST_S 7 +/* SPI_IN_LOOP_TEST : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: Set bit to test in link.*/ +#define SPI_IN_LOOP_TEST (BIT(6)) +#define SPI_IN_LOOP_TEST_M (BIT(6)) +#define SPI_IN_LOOP_TEST_V 0x1 +#define SPI_IN_LOOP_TEST_S 6 +/* SPI_AHBM_RST : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: Reset spi dma ahb master.*/ +#define SPI_AHBM_RST (BIT(5)) +#define SPI_AHBM_RST_M (BIT(5)) +#define SPI_AHBM_RST_V 0x1 +#define SPI_AHBM_RST_S 5 +/* SPI_AHBM_FIFO_RST : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: Reset spi dma ahb master fifo pointer.*/ +#define SPI_AHBM_FIFO_RST (BIT(4)) +#define SPI_AHBM_FIFO_RST_M (BIT(4)) +#define SPI_AHBM_FIFO_RST_V 0x1 +#define SPI_AHBM_FIFO_RST_S 4 +/* SPI_OUT_RST : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The bit is used to reset out dma fsm and out data fifo pointer.*/ +#define SPI_OUT_RST (BIT(3)) +#define SPI_OUT_RST_M (BIT(3)) +#define SPI_OUT_RST_V 0x1 +#define SPI_OUT_RST_S 3 +/* SPI_IN_RST : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The bit is used to reset in dma fsm and in data fifo pointer.*/ +#define SPI_IN_RST (BIT(2)) +#define SPI_IN_RST_M (BIT(2)) +#define SPI_IN_RST_V 0x1 +#define SPI_IN_RST_S 2 + +#define SPI_DMA_OUT_LINK_REG(i) (REG_SPI_BASE(i) + 0x05C) +/* SPI_DMA_TX_ENA : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: spi dma write data status bit.*/ +#define SPI_DMA_TX_ENA (BIT(31)) +#define SPI_DMA_TX_ENA_M (BIT(31)) +#define SPI_DMA_TX_ENA_V 0x1 +#define SPI_DMA_TX_ENA_S 31 +/* SPI_OUTLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: Set the bit to mount on new outlink descriptors.*/ +#define SPI_OUTLINK_RESTART (BIT(30)) +#define SPI_OUTLINK_RESTART_M (BIT(30)) +#define SPI_OUTLINK_RESTART_V 0x1 +#define SPI_OUTLINK_RESTART_S 30 +/* SPI_OUTLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: Set the bit to start to use outlink descriptor.*/ +#define SPI_OUTLINK_START (BIT(29)) +#define SPI_OUTLINK_START_M (BIT(29)) +#define SPI_OUTLINK_START_V 0x1 +#define SPI_OUTLINK_START_S 29 +/* SPI_OUTLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: Set the bit to stop to use outlink descriptor.*/ +#define SPI_OUTLINK_STOP (BIT(28)) +#define SPI_OUTLINK_STOP_M (BIT(28)) +#define SPI_OUTLINK_STOP_V 0x1 +#define SPI_OUTLINK_STOP_S 28 +/* SPI_OUTLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: The address of the first outlink descriptor.*/ +#define SPI_OUTLINK_ADDR 0x000FFFFF +#define SPI_OUTLINK_ADDR_M ((SPI_OUTLINK_ADDR_V)<<(SPI_OUTLINK_ADDR_S)) +#define SPI_OUTLINK_ADDR_V 0xFFFFF +#define SPI_OUTLINK_ADDR_S 0 + +#define SPI_DMA_IN_LINK_REG(i) (REG_SPI_BASE(i) + 0x060) +/* SPI_DMA_RX_ENA : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: spi dma read data status bit.*/ +#define SPI_DMA_RX_ENA (BIT(31)) +#define SPI_DMA_RX_ENA_M (BIT(31)) +#define SPI_DMA_RX_ENA_V 0x1 +#define SPI_DMA_RX_ENA_S 31 +/* SPI_INLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: Set the bit to mount on new inlink descriptors.*/ +#define SPI_INLINK_RESTART (BIT(30)) +#define SPI_INLINK_RESTART_M (BIT(30)) +#define SPI_INLINK_RESTART_V 0x1 +#define SPI_INLINK_RESTART_S 30 +/* SPI_INLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: Set the bit to start to use inlink descriptor.*/ +#define SPI_INLINK_START (BIT(29)) +#define SPI_INLINK_START_M (BIT(29)) +#define SPI_INLINK_START_V 0x1 +#define SPI_INLINK_START_S 29 +/* SPI_INLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: Set the bit to stop to use inlink descriptor.*/ +#define SPI_INLINK_STOP (BIT(28)) +#define SPI_INLINK_STOP_M (BIT(28)) +#define SPI_INLINK_STOP_V 0x1 +#define SPI_INLINK_STOP_S 28 +/* SPI_INLINK_AUTO_RET : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: when the bit is set the inlink descriptor returns to the first + link node when a packet is error.*/ +#define SPI_INLINK_AUTO_RET (BIT(20)) +#define SPI_INLINK_AUTO_RET_M (BIT(20)) +#define SPI_INLINK_AUTO_RET_V 0x1 +#define SPI_INLINK_AUTO_RET_S 20 +/* SPI_INLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: The address of the first inlink descriptor.*/ +#define SPI_INLINK_ADDR 0x000FFFFF +#define SPI_INLINK_ADDR_M ((SPI_INLINK_ADDR_V)<<(SPI_INLINK_ADDR_S)) +#define SPI_INLINK_ADDR_V 0xFFFFF +#define SPI_INLINK_ADDR_S 0 + +#define SPI_DMA_INT_ENA_REG(i) (REG_SPI_BASE(i) + 0x064) +/* SPI_OUT_TOTAL_EOF_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The enable bit for sending all the packets to host done.*/ +#define SPI_OUT_TOTAL_EOF_INT_ENA (BIT(8)) +#define SPI_OUT_TOTAL_EOF_INT_ENA_M (BIT(8)) +#define SPI_OUT_TOTAL_EOF_INT_ENA_V 0x1 +#define SPI_OUT_TOTAL_EOF_INT_ENA_S 8 +/* SPI_OUT_EOF_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The enable bit for sending a packet to host done.*/ +#define SPI_OUT_EOF_INT_ENA (BIT(7)) +#define SPI_OUT_EOF_INT_ENA_M (BIT(7)) +#define SPI_OUT_EOF_INT_ENA_V 0x1 +#define SPI_OUT_EOF_INT_ENA_S 7 +/* SPI_OUT_DONE_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The enable bit for completing usage of a outlink descriptor .*/ +#define SPI_OUT_DONE_INT_ENA (BIT(6)) +#define SPI_OUT_DONE_INT_ENA_M (BIT(6)) +#define SPI_OUT_DONE_INT_ENA_V 0x1 +#define SPI_OUT_DONE_INT_ENA_S 6 +/* SPI_IN_SUC_EOF_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The enable bit for completing receiving all the packets from host.*/ +#define SPI_IN_SUC_EOF_INT_ENA (BIT(5)) +#define SPI_IN_SUC_EOF_INT_ENA_M (BIT(5)) +#define SPI_IN_SUC_EOF_INT_ENA_V 0x1 +#define SPI_IN_SUC_EOF_INT_ENA_S 5 +/* SPI_IN_ERR_EOF_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The enable bit for receiving error.*/ +#define SPI_IN_ERR_EOF_INT_ENA (BIT(4)) +#define SPI_IN_ERR_EOF_INT_ENA_M (BIT(4)) +#define SPI_IN_ERR_EOF_INT_ENA_V 0x1 +#define SPI_IN_ERR_EOF_INT_ENA_S 4 +/* SPI_IN_DONE_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The enable bit for completing usage of a inlink descriptor.*/ +#define SPI_IN_DONE_INT_ENA (BIT(3)) +#define SPI_IN_DONE_INT_ENA_M (BIT(3)) +#define SPI_IN_DONE_INT_ENA_V 0x1 +#define SPI_IN_DONE_INT_ENA_S 3 +/* SPI_INLINK_DSCR_ERROR_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The enable bit for inlink descriptor error.*/ +#define SPI_INLINK_DSCR_ERROR_INT_ENA (BIT(2)) +#define SPI_INLINK_DSCR_ERROR_INT_ENA_M (BIT(2)) +#define SPI_INLINK_DSCR_ERROR_INT_ENA_V 0x1 +#define SPI_INLINK_DSCR_ERROR_INT_ENA_S 2 +/* SPI_OUTLINK_DSCR_ERROR_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The enable bit for outlink descriptor error.*/ +#define SPI_OUTLINK_DSCR_ERROR_INT_ENA (BIT(1)) +#define SPI_OUTLINK_DSCR_ERROR_INT_ENA_M (BIT(1)) +#define SPI_OUTLINK_DSCR_ERROR_INT_ENA_V 0x1 +#define SPI_OUTLINK_DSCR_ERROR_INT_ENA_S 1 +/* SPI_INLINK_DSCR_EMPTY_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The enable bit for lack of enough inlink descriptors.*/ +#define SPI_INLINK_DSCR_EMPTY_INT_ENA (BIT(0)) +#define SPI_INLINK_DSCR_EMPTY_INT_ENA_M (BIT(0)) +#define SPI_INLINK_DSCR_EMPTY_INT_ENA_V 0x1 +#define SPI_INLINK_DSCR_EMPTY_INT_ENA_S 0 + +#define SPI_DMA_INT_RAW_REG(i) (REG_SPI_BASE(i) + 0x068) +/* SPI_OUT_TOTAL_EOF_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The raw bit for sending all the packets to host done.*/ +#define SPI_OUT_TOTAL_EOF_INT_RAW (BIT(8)) +#define SPI_OUT_TOTAL_EOF_INT_RAW_M (BIT(8)) +#define SPI_OUT_TOTAL_EOF_INT_RAW_V 0x1 +#define SPI_OUT_TOTAL_EOF_INT_RAW_S 8 +/* SPI_OUT_EOF_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The raw bit for sending a packet to host done.*/ +#define SPI_OUT_EOF_INT_RAW (BIT(7)) +#define SPI_OUT_EOF_INT_RAW_M (BIT(7)) +#define SPI_OUT_EOF_INT_RAW_V 0x1 +#define SPI_OUT_EOF_INT_RAW_S 7 +/* SPI_OUT_DONE_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The raw bit for completing usage of a outlink descriptor.*/ +#define SPI_OUT_DONE_INT_RAW (BIT(6)) +#define SPI_OUT_DONE_INT_RAW_M (BIT(6)) +#define SPI_OUT_DONE_INT_RAW_V 0x1 +#define SPI_OUT_DONE_INT_RAW_S 6 +/* SPI_IN_SUC_EOF_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The raw bit for completing receiving all the packets from host.*/ +#define SPI_IN_SUC_EOF_INT_RAW (BIT(5)) +#define SPI_IN_SUC_EOF_INT_RAW_M (BIT(5)) +#define SPI_IN_SUC_EOF_INT_RAW_V 0x1 +#define SPI_IN_SUC_EOF_INT_RAW_S 5 +/* SPI_IN_ERR_EOF_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The raw bit for receiving error.*/ +#define SPI_IN_ERR_EOF_INT_RAW (BIT(4)) +#define SPI_IN_ERR_EOF_INT_RAW_M (BIT(4)) +#define SPI_IN_ERR_EOF_INT_RAW_V 0x1 +#define SPI_IN_ERR_EOF_INT_RAW_S 4 +/* SPI_IN_DONE_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The raw bit for completing usage of a inlink descriptor.*/ +#define SPI_IN_DONE_INT_RAW (BIT(3)) +#define SPI_IN_DONE_INT_RAW_M (BIT(3)) +#define SPI_IN_DONE_INT_RAW_V 0x1 +#define SPI_IN_DONE_INT_RAW_S 3 +/* SPI_INLINK_DSCR_ERROR_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The raw bit for inlink descriptor error.*/ +#define SPI_INLINK_DSCR_ERROR_INT_RAW (BIT(2)) +#define SPI_INLINK_DSCR_ERROR_INT_RAW_M (BIT(2)) +#define SPI_INLINK_DSCR_ERROR_INT_RAW_V 0x1 +#define SPI_INLINK_DSCR_ERROR_INT_RAW_S 2 +/* SPI_OUTLINK_DSCR_ERROR_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The raw bit for outlink descriptor error.*/ +#define SPI_OUTLINK_DSCR_ERROR_INT_RAW (BIT(1)) +#define SPI_OUTLINK_DSCR_ERROR_INT_RAW_M (BIT(1)) +#define SPI_OUTLINK_DSCR_ERROR_INT_RAW_V 0x1 +#define SPI_OUTLINK_DSCR_ERROR_INT_RAW_S 1 +/* SPI_INLINK_DSCR_EMPTY_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The raw bit for lack of enough inlink descriptors.*/ +#define SPI_INLINK_DSCR_EMPTY_INT_RAW (BIT(0)) +#define SPI_INLINK_DSCR_EMPTY_INT_RAW_M (BIT(0)) +#define SPI_INLINK_DSCR_EMPTY_INT_RAW_V 0x1 +#define SPI_INLINK_DSCR_EMPTY_INT_RAW_S 0 + +#define SPI_DMA_INT_ST_REG(i) (REG_SPI_BASE(i) + 0x06C) +/* SPI_OUT_TOTAL_EOF_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The status bit for sending all the packets to host done.*/ +#define SPI_OUT_TOTAL_EOF_INT_ST (BIT(8)) +#define SPI_OUT_TOTAL_EOF_INT_ST_M (BIT(8)) +#define SPI_OUT_TOTAL_EOF_INT_ST_V 0x1 +#define SPI_OUT_TOTAL_EOF_INT_ST_S 8 +/* SPI_OUT_EOF_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The status bit for sending a packet to host done.*/ +#define SPI_OUT_EOF_INT_ST (BIT(7)) +#define SPI_OUT_EOF_INT_ST_M (BIT(7)) +#define SPI_OUT_EOF_INT_ST_V 0x1 +#define SPI_OUT_EOF_INT_ST_S 7 +/* SPI_OUT_DONE_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The status bit for completing usage of a outlink descriptor.*/ +#define SPI_OUT_DONE_INT_ST (BIT(6)) +#define SPI_OUT_DONE_INT_ST_M (BIT(6)) +#define SPI_OUT_DONE_INT_ST_V 0x1 +#define SPI_OUT_DONE_INT_ST_S 6 +/* SPI_IN_SUC_EOF_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The status bit for completing receiving all the packets from host.*/ +#define SPI_IN_SUC_EOF_INT_ST (BIT(5)) +#define SPI_IN_SUC_EOF_INT_ST_M (BIT(5)) +#define SPI_IN_SUC_EOF_INT_ST_V 0x1 +#define SPI_IN_SUC_EOF_INT_ST_S 5 +/* SPI_IN_ERR_EOF_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The status bit for receiving error.*/ +#define SPI_IN_ERR_EOF_INT_ST (BIT(4)) +#define SPI_IN_ERR_EOF_INT_ST_M (BIT(4)) +#define SPI_IN_ERR_EOF_INT_ST_V 0x1 +#define SPI_IN_ERR_EOF_INT_ST_S 4 +/* SPI_IN_DONE_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The status bit for completing usage of a inlink descriptor.*/ +#define SPI_IN_DONE_INT_ST (BIT(3)) +#define SPI_IN_DONE_INT_ST_M (BIT(3)) +#define SPI_IN_DONE_INT_ST_V 0x1 +#define SPI_IN_DONE_INT_ST_S 3 +/* SPI_INLINK_DSCR_ERROR_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The status bit for inlink descriptor error.*/ +#define SPI_INLINK_DSCR_ERROR_INT_ST (BIT(2)) +#define SPI_INLINK_DSCR_ERROR_INT_ST_M (BIT(2)) +#define SPI_INLINK_DSCR_ERROR_INT_ST_V 0x1 +#define SPI_INLINK_DSCR_ERROR_INT_ST_S 2 +/* SPI_OUTLINK_DSCR_ERROR_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The status bit for outlink descriptor error.*/ +#define SPI_OUTLINK_DSCR_ERROR_INT_ST (BIT(1)) +#define SPI_OUTLINK_DSCR_ERROR_INT_ST_M (BIT(1)) +#define SPI_OUTLINK_DSCR_ERROR_INT_ST_V 0x1 +#define SPI_OUTLINK_DSCR_ERROR_INT_ST_S 1 +/* SPI_INLINK_DSCR_EMPTY_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The status bit for lack of enough inlink descriptors.*/ +#define SPI_INLINK_DSCR_EMPTY_INT_ST (BIT(0)) +#define SPI_INLINK_DSCR_EMPTY_INT_ST_M (BIT(0)) +#define SPI_INLINK_DSCR_EMPTY_INT_ST_V 0x1 +#define SPI_INLINK_DSCR_EMPTY_INT_ST_S 0 + +#define SPI_DMA_INT_CLR_REG(i) (REG_SPI_BASE(i) + 0x070) +/* SPI_OUT_TOTAL_EOF_INT_CLR : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: The clear bit for sending all the packets to host done.*/ +#define SPI_OUT_TOTAL_EOF_INT_CLR (BIT(8)) +#define SPI_OUT_TOTAL_EOF_INT_CLR_M (BIT(8)) +#define SPI_OUT_TOTAL_EOF_INT_CLR_V 0x1 +#define SPI_OUT_TOTAL_EOF_INT_CLR_S 8 +/* SPI_OUT_EOF_INT_CLR : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: The clear bit for sending a packet to host done.*/ +#define SPI_OUT_EOF_INT_CLR (BIT(7)) +#define SPI_OUT_EOF_INT_CLR_M (BIT(7)) +#define SPI_OUT_EOF_INT_CLR_V 0x1 +#define SPI_OUT_EOF_INT_CLR_S 7 +/* SPI_OUT_DONE_INT_CLR : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: The clear bit for completing usage of a outlink descriptor.*/ +#define SPI_OUT_DONE_INT_CLR (BIT(6)) +#define SPI_OUT_DONE_INT_CLR_M (BIT(6)) +#define SPI_OUT_DONE_INT_CLR_V 0x1 +#define SPI_OUT_DONE_INT_CLR_S 6 +/* SPI_IN_SUC_EOF_INT_CLR : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: The clear bit for completing receiving all the packets from host.*/ +#define SPI_IN_SUC_EOF_INT_CLR (BIT(5)) +#define SPI_IN_SUC_EOF_INT_CLR_M (BIT(5)) +#define SPI_IN_SUC_EOF_INT_CLR_V 0x1 +#define SPI_IN_SUC_EOF_INT_CLR_S 5 +/* SPI_IN_ERR_EOF_INT_CLR : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: The clear bit for receiving error.*/ +#define SPI_IN_ERR_EOF_INT_CLR (BIT(4)) +#define SPI_IN_ERR_EOF_INT_CLR_M (BIT(4)) +#define SPI_IN_ERR_EOF_INT_CLR_V 0x1 +#define SPI_IN_ERR_EOF_INT_CLR_S 4 +/* SPI_IN_DONE_INT_CLR : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: The clear bit for completing usage of a inlink descriptor.*/ +#define SPI_IN_DONE_INT_CLR (BIT(3)) +#define SPI_IN_DONE_INT_CLR_M (BIT(3)) +#define SPI_IN_DONE_INT_CLR_V 0x1 +#define SPI_IN_DONE_INT_CLR_S 3 +/* SPI_INLINK_DSCR_ERROR_INT_CLR : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: The clear bit for inlink descriptor error.*/ +#define SPI_INLINK_DSCR_ERROR_INT_CLR (BIT(2)) +#define SPI_INLINK_DSCR_ERROR_INT_CLR_M (BIT(2)) +#define SPI_INLINK_DSCR_ERROR_INT_CLR_V 0x1 +#define SPI_INLINK_DSCR_ERROR_INT_CLR_S 2 +/* SPI_OUTLINK_DSCR_ERROR_INT_CLR : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: The clear bit for outlink descriptor error.*/ +#define SPI_OUTLINK_DSCR_ERROR_INT_CLR (BIT(1)) +#define SPI_OUTLINK_DSCR_ERROR_INT_CLR_M (BIT(1)) +#define SPI_OUTLINK_DSCR_ERROR_INT_CLR_V 0x1 +#define SPI_OUTLINK_DSCR_ERROR_INT_CLR_S 1 +/* SPI_INLINK_DSCR_EMPTY_INT_CLR : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: The clear bit for lack of enough inlink descriptors.*/ +#define SPI_INLINK_DSCR_EMPTY_INT_CLR (BIT(0)) +#define SPI_INLINK_DSCR_EMPTY_INT_CLR_M (BIT(0)) +#define SPI_INLINK_DSCR_EMPTY_INT_CLR_V 0x1 +#define SPI_INLINK_DSCR_EMPTY_INT_CLR_S 0 + +#define SPI_IN_ERR_EOF_DES_ADDR_REG(i) (REG_SPI_BASE(i) + 0x074) +/* SPI_DMA_IN_ERR_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The inlink descriptor address when spi dma produce receiving error.*/ +#define SPI_DMA_IN_ERR_EOF_DES_ADDR 0xFFFFFFFF +#define SPI_DMA_IN_ERR_EOF_DES_ADDR_M ((SPI_DMA_IN_ERR_EOF_DES_ADDR_V)<<(SPI_DMA_IN_ERR_EOF_DES_ADDR_S)) +#define SPI_DMA_IN_ERR_EOF_DES_ADDR_V 0xFFFFFFFF +#define SPI_DMA_IN_ERR_EOF_DES_ADDR_S 0 + +#define SPI_IN_SUC_EOF_DES_ADDR_REG(i) (REG_SPI_BASE(i) + 0x078) +/* SPI_DMA_IN_SUC_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The last inlink descriptor address when spi dma produce from_suc_eof.*/ +#define SPI_DMA_IN_SUC_EOF_DES_ADDR 0xFFFFFFFF +#define SPI_DMA_IN_SUC_EOF_DES_ADDR_M ((SPI_DMA_IN_SUC_EOF_DES_ADDR_V)<<(SPI_DMA_IN_SUC_EOF_DES_ADDR_S)) +#define SPI_DMA_IN_SUC_EOF_DES_ADDR_V 0xFFFFFFFF +#define SPI_DMA_IN_SUC_EOF_DES_ADDR_S 0 + +#define SPI_INLINK_DSCR_REG(i) (REG_SPI_BASE(i) + 0x07C) +/* SPI_DMA_INLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of current in descriptor pointer.*/ +#define SPI_DMA_INLINK_DSCR 0xFFFFFFFF +#define SPI_DMA_INLINK_DSCR_M ((SPI_DMA_INLINK_DSCR_V)<<(SPI_DMA_INLINK_DSCR_S)) +#define SPI_DMA_INLINK_DSCR_V 0xFFFFFFFF +#define SPI_DMA_INLINK_DSCR_S 0 + +#define SPI_INLINK_DSCR_BF0_REG(i) (REG_SPI_BASE(i) + 0x080) +/* SPI_DMA_INLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of next in descriptor pointer.*/ +#define SPI_DMA_INLINK_DSCR_BF0 0xFFFFFFFF +#define SPI_DMA_INLINK_DSCR_BF0_M ((SPI_DMA_INLINK_DSCR_BF0_V)<<(SPI_DMA_INLINK_DSCR_BF0_S)) +#define SPI_DMA_INLINK_DSCR_BF0_V 0xFFFFFFFF +#define SPI_DMA_INLINK_DSCR_BF0_S 0 + +#define SPI_INLINK_DSCR_BF1_REG(i) (REG_SPI_BASE(i) + 0x084) +/* SPI_DMA_INLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of current in descriptor data buffer pointer.*/ +#define SPI_DMA_INLINK_DSCR_BF1 0xFFFFFFFF +#define SPI_DMA_INLINK_DSCR_BF1_M ((SPI_DMA_INLINK_DSCR_BF1_V)<<(SPI_DMA_INLINK_DSCR_BF1_S)) +#define SPI_DMA_INLINK_DSCR_BF1_V 0xFFFFFFFF +#define SPI_DMA_INLINK_DSCR_BF1_S 0 + +#define SPI_OUT_EOF_BFR_DES_ADDR_REG(i) (REG_SPI_BASE(i) + 0x088) +/* SPI_DMA_OUT_EOF_BFR_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The address of buffer relative to the outlink descriptor that produce eof.*/ +#define SPI_DMA_OUT_EOF_BFR_DES_ADDR 0xFFFFFFFF +#define SPI_DMA_OUT_EOF_BFR_DES_ADDR_M ((SPI_DMA_OUT_EOF_BFR_DES_ADDR_V)<<(SPI_DMA_OUT_EOF_BFR_DES_ADDR_S)) +#define SPI_DMA_OUT_EOF_BFR_DES_ADDR_V 0xFFFFFFFF +#define SPI_DMA_OUT_EOF_BFR_DES_ADDR_S 0 + +#define SPI_OUT_EOF_DES_ADDR_REG(i) (REG_SPI_BASE(i) + 0x08C) +/* SPI_DMA_OUT_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The last outlink descriptor address when spi dma produce to_eof.*/ +#define SPI_DMA_OUT_EOF_DES_ADDR 0xFFFFFFFF +#define SPI_DMA_OUT_EOF_DES_ADDR_M ((SPI_DMA_OUT_EOF_DES_ADDR_V)<<(SPI_DMA_OUT_EOF_DES_ADDR_S)) +#define SPI_DMA_OUT_EOF_DES_ADDR_V 0xFFFFFFFF +#define SPI_DMA_OUT_EOF_DES_ADDR_S 0 + +#define SPI_OUTLINK_DSCR_REG(i) (REG_SPI_BASE(i) + 0x090) +/* SPI_DMA_OUTLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of current out descriptor pointer.*/ +#define SPI_DMA_OUTLINK_DSCR 0xFFFFFFFF +#define SPI_DMA_OUTLINK_DSCR_M ((SPI_DMA_OUTLINK_DSCR_V)<<(SPI_DMA_OUTLINK_DSCR_S)) +#define SPI_DMA_OUTLINK_DSCR_V 0xFFFFFFFF +#define SPI_DMA_OUTLINK_DSCR_S 0 + +#define SPI_OUTLINK_DSCR_BF0_REG(i) (REG_SPI_BASE(i) + 0x094) +/* SPI_DMA_OUTLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of next out descriptor pointer.*/ +#define SPI_DMA_OUTLINK_DSCR_BF0 0xFFFFFFFF +#define SPI_DMA_OUTLINK_DSCR_BF0_M ((SPI_DMA_OUTLINK_DSCR_BF0_V)<<(SPI_DMA_OUTLINK_DSCR_BF0_S)) +#define SPI_DMA_OUTLINK_DSCR_BF0_V 0xFFFFFFFF +#define SPI_DMA_OUTLINK_DSCR_BF0_S 0 + +#define SPI_OUTLINK_DSCR_BF1_REG(i) (REG_SPI_BASE(i) + 0x098) +/* SPI_DMA_OUTLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: The content of current out descriptor data buffer pointer.*/ +#define SPI_DMA_OUTLINK_DSCR_BF1 0xFFFFFFFF +#define SPI_DMA_OUTLINK_DSCR_BF1_M ((SPI_DMA_OUTLINK_DSCR_BF1_V)<<(SPI_DMA_OUTLINK_DSCR_BF1_S)) +#define SPI_DMA_OUTLINK_DSCR_BF1_V 0xFFFFFFFF +#define SPI_DMA_OUTLINK_DSCR_BF1_S 0 + +#define SPI_DMA_OUTSTATUS_REG(i) (REG_SPI_BASE(i) + 0x09C) +/* SPI_DMA_OUTFIFO_EMPTY : RO ;bitpos:[31] ;default: 1'b1 ; */ +/*description: SPI dma outfifo is empty.*/ +#define SPI_DMA_OUTFIFO_EMPTY (BIT(31)) +#define SPI_DMA_OUTFIFO_EMPTY_M (BIT(31)) +#define SPI_DMA_OUTFIFO_EMPTY_V 0x1 +#define SPI_DMA_OUTFIFO_EMPTY_S 31 +/* SPI_DMA_OUTFIFO_FULL : RO ;bitpos:[30] ;default: 1'b0 ; */ +/*description: SPI dma outfifo is full.*/ +#define SPI_DMA_OUTFIFO_FULL (BIT(30)) +#define SPI_DMA_OUTFIFO_FULL_M (BIT(30)) +#define SPI_DMA_OUTFIFO_FULL_V 0x1 +#define SPI_DMA_OUTFIFO_FULL_S 30 +/* SPI_DMA_OUTFIFO_CNT : RO ;bitpos:[29:23] ;default: 7'b0 ; */ +/*description: The remains of SPI dma outfifo data.*/ +#define SPI_DMA_OUTFIFO_CNT 0x0000007F +#define SPI_DMA_OUTFIFO_CNT_M ((SPI_DMA_OUTFIFO_CNT_V)<<(SPI_DMA_OUTFIFO_CNT_S)) +#define SPI_DMA_OUTFIFO_CNT_V 0x7F +#define SPI_DMA_OUTFIFO_CNT_S 23 +/* SPI_DMA_OUT_STATE : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: SPI dma out data state.*/ +#define SPI_DMA_OUT_STATE 0x00000007 +#define SPI_DMA_OUT_STATE_M ((SPI_DMA_OUT_STATE_V)<<(SPI_DMA_OUT_STATE_S)) +#define SPI_DMA_OUT_STATE_V 0x7 +#define SPI_DMA_OUT_STATE_S 20 +/* SPI_DMA_OUTDSCR_STATE : RO ;bitpos:[19:18] ;default: 2'b0 ; */ +/*description: SPI dma out descriptor state.*/ +#define SPI_DMA_OUTDSCR_STATE 0x00000003 +#define SPI_DMA_OUTDSCR_STATE_M ((SPI_DMA_OUTDSCR_STATE_V)<<(SPI_DMA_OUTDSCR_STATE_S)) +#define SPI_DMA_OUTDSCR_STATE_V 0x3 +#define SPI_DMA_OUTDSCR_STATE_S 18 +/* SPI_DMA_OUTDSCR_ADDR : RO ;bitpos:[17:0] ;default: 18'b0 ; */ +/*description: SPI dma out descriptor address.*/ +#define SPI_DMA_OUTDSCR_ADDR 0x0003FFFF +#define SPI_DMA_OUTDSCR_ADDR_M ((SPI_DMA_OUTDSCR_ADDR_V)<<(SPI_DMA_OUTDSCR_ADDR_S)) +#define SPI_DMA_OUTDSCR_ADDR_V 0x3FFFF +#define SPI_DMA_OUTDSCR_ADDR_S 0 + +#define SPI_DMA_INSTATUS_REG(i) (REG_SPI_BASE(i) + 0x0A0) +/* SPI_DMA_INFIFO_EMPTY : RO ;bitpos:[31] ;default: 1'b1 ; */ +/*description: SPI dma infifo is empty.*/ +#define SPI_DMA_INFIFO_EMPTY (BIT(31)) +#define SPI_DMA_INFIFO_EMPTY_M (BIT(31)) +#define SPI_DMA_INFIFO_EMPTY_V 0x1 +#define SPI_DMA_INFIFO_EMPTY_S 31 +/* SPI_DMA_INFIFO_FULL : RO ;bitpos:[30] ;default: 1'b0 ; */ +/*description: SPI dma infifo is full.*/ +#define SPI_DMA_INFIFO_FULL (BIT(30)) +#define SPI_DMA_INFIFO_FULL_M (BIT(30)) +#define SPI_DMA_INFIFO_FULL_V 0x1 +#define SPI_DMA_INFIFO_FULL_S 30 +/* SPI_DMA_INFIFO_CNT : RO ;bitpos:[29:23] ;default: 7'b0 ; */ +/*description: The remains of SPI dma infifo data.*/ +#define SPI_DMA_INFIFO_CNT 0x0000007F +#define SPI_DMA_INFIFO_CNT_M ((SPI_DMA_INFIFO_CNT_V)<<(SPI_DMA_INFIFO_CNT_S)) +#define SPI_DMA_INFIFO_CNT_V 0x7F +#define SPI_DMA_INFIFO_CNT_S 23 +/* SPI_DMA_IN_STATE : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: SPI dma in data state.*/ +#define SPI_DMA_IN_STATE 0x00000007 +#define SPI_DMA_IN_STATE_M ((SPI_DMA_IN_STATE_V)<<(SPI_DMA_IN_STATE_S)) +#define SPI_DMA_IN_STATE_V 0x7 +#define SPI_DMA_IN_STATE_S 20 +/* SPI_DMA_INDSCR_STATE : RO ;bitpos:[19:18] ;default: 2'b0 ; */ +/*description: SPI dma in descriptor state.*/ +#define SPI_DMA_INDSCR_STATE 0x00000003 +#define SPI_DMA_INDSCR_STATE_M ((SPI_DMA_INDSCR_STATE_V)<<(SPI_DMA_INDSCR_STATE_S)) +#define SPI_DMA_INDSCR_STATE_V 0x3 +#define SPI_DMA_INDSCR_STATE_S 18 +/* SPI_DMA_INDSCR_ADDR : RO ;bitpos:[17:0] ;default: 18'b0 ; */ +/*description: SPI dma in descriptor address.*/ +#define SPI_DMA_INDSCR_ADDR 0x0003FFFF +#define SPI_DMA_INDSCR_ADDR_M ((SPI_DMA_INDSCR_ADDR_V)<<(SPI_DMA_INDSCR_ADDR_S)) +#define SPI_DMA_INDSCR_ADDR_V 0x3FFFF +#define SPI_DMA_INDSCR_ADDR_S 0 + +#define SPI_W0_REG(i) (REG_SPI_BASE(i) + 0x0A4) +/* SPI_BUF0 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF0 0xFFFFFFFF +#define SPI_BUF0_M ((SPI_BUF0_V)<<(SPI_BUF0_S)) +#define SPI_BUF0_V 0xFFFFFFFF +#define SPI_BUF0_S 0 + +#define SPI_W1_REG(i) (REG_SPI_BASE(i) + 0x0A8) +/* SPI_BUF1 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF1 0xFFFFFFFF +#define SPI_BUF1_M ((SPI_BUF1_V)<<(SPI_BUF1_S)) +#define SPI_BUF1_V 0xFFFFFFFF +#define SPI_BUF1_S 0 + +#define SPI_W2_REG(i) (REG_SPI_BASE(i) + 0x0AC) +/* SPI_BUF2 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF2 0xFFFFFFFF +#define SPI_BUF2_M ((SPI_BUF2_V)<<(SPI_BUF2_S)) +#define SPI_BUF2_V 0xFFFFFFFF +#define SPI_BUF2_S 0 + +#define SPI_W3_REG(i) (REG_SPI_BASE(i) + 0x0B0) +/* SPI_BUF3 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF3 0xFFFFFFFF +#define SPI_BUF3_M ((SPI_BUF3_V)<<(SPI_BUF3_S)) +#define SPI_BUF3_V 0xFFFFFFFF +#define SPI_BUF3_S 0 + +#define SPI_W4_REG(i) (REG_SPI_BASE(i) + 0x0B4) +/* SPI_BUF4 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF4 0xFFFFFFFF +#define SPI_BUF4_M ((SPI_BUF4_V)<<(SPI_BUF4_S)) +#define SPI_BUF4_V 0xFFFFFFFF +#define SPI_BUF4_S 0 + +#define SPI_W5_REG(i) (REG_SPI_BASE(i) + 0x0B8) +/* SPI_BUF5 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF5 0xFFFFFFFF +#define SPI_BUF5_M ((SPI_BUF5_V)<<(SPI_BUF5_S)) +#define SPI_BUF5_V 0xFFFFFFFF +#define SPI_BUF5_S 0 + +#define SPI_W6_REG(i) (REG_SPI_BASE(i) + 0x0BC) +/* SPI_BUF6 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF6 0xFFFFFFFF +#define SPI_BUF6_M ((SPI_BUF6_V)<<(SPI_BUF6_S)) +#define SPI_BUF6_V 0xFFFFFFFF +#define SPI_BUF6_S 0 + +#define SPI_W7_REG(i) (REG_SPI_BASE(i) + 0x0C0) +/* SPI_BUF7 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF7 0xFFFFFFFF +#define SPI_BUF7_M ((SPI_BUF7_V)<<(SPI_BUF7_S)) +#define SPI_BUF7_V 0xFFFFFFFF +#define SPI_BUF7_S 0 + +#define SPI_W8_REG(i) (REG_SPI_BASE(i) + 0x0C4) +/* SPI_BUF8 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF8 0xFFFFFFFF +#define SPI_BUF8_M ((SPI_BUF8_V)<<(SPI_BUF8_S)) +#define SPI_BUF8_V 0xFFFFFFFF +#define SPI_BUF8_S 0 + +#define SPI_W9_REG(i) (REG_SPI_BASE(i) + 0x0C8) +/* SPI_BUF9 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF9 0xFFFFFFFF +#define SPI_BUF9_M ((SPI_BUF9_V)<<(SPI_BUF9_S)) +#define SPI_BUF9_V 0xFFFFFFFF +#define SPI_BUF9_S 0 + +#define SPI_W10_REG(i) (REG_SPI_BASE(i) + 0x0CC) +/* SPI_BUF10 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF10 0xFFFFFFFF +#define SPI_BUF10_M ((SPI_BUF10_V)<<(SPI_BUF10_S)) +#define SPI_BUF10_V 0xFFFFFFFF +#define SPI_BUF10_S 0 + +#define SPI_W11_REG(i) (REG_SPI_BASE(i) + 0x0D0) +/* SPI_BUF11 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF11 0xFFFFFFFF +#define SPI_BUF11_M ((SPI_BUF11_V)<<(SPI_BUF11_S)) +#define SPI_BUF11_V 0xFFFFFFFF +#define SPI_BUF11_S 0 + +#define SPI_W12_REG(i) (REG_SPI_BASE(i) + 0x0D4) +/* SPI_BUF12 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF12 0xFFFFFFFF +#define SPI_BUF12_M ((SPI_BUF12_V)<<(SPI_BUF12_S)) +#define SPI_BUF12_V 0xFFFFFFFF +#define SPI_BUF12_S 0 + +#define SPI_W13_REG(i) (REG_SPI_BASE(i) + 0x0D8) +/* SPI_BUF13 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF13 0xFFFFFFFF +#define SPI_BUF13_M ((SPI_BUF13_V)<<(SPI_BUF13_S)) +#define SPI_BUF13_V 0xFFFFFFFF +#define SPI_BUF13_S 0 + +#define SPI_W14_REG(i) (REG_SPI_BASE(i) + 0x0DC) +/* SPI_BUF14 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF14 0xFFFFFFFF +#define SPI_BUF14_M ((SPI_BUF14_V)<<(SPI_BUF14_S)) +#define SPI_BUF14_V 0xFFFFFFFF +#define SPI_BUF14_S 0 + +#define SPI_W15_REG(i) (REG_SPI_BASE(i) + 0x0E0) +/* SPI_BUF15 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF15 0xFFFFFFFF +#define SPI_BUF15_M ((SPI_BUF15_V)<<(SPI_BUF15_S)) +#define SPI_BUF15_V 0xFFFFFFFF +#define SPI_BUF15_S 0 + +#define SPI_W16_REG(i) (REG_SPI_BASE(i) + 0x0E4) +/* SPI_BUF16 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF16 0xFFFFFFFF +#define SPI_BUF16_M ((SPI_BUF16_V)<<(SPI_BUF16_S)) +#define SPI_BUF16_V 0xFFFFFFFF +#define SPI_BUF16_S 0 + +#define SPI_W17_REG(i) (REG_SPI_BASE(i) + 0x0E8) +/* SPI_BUF17 : R/W ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: data buffer*/ +#define SPI_BUF17 0xFFFFFFFF +#define SPI_BUF17_M ((SPI_BUF17_V)<<(SPI_BUF17_S)) +#define SPI_BUF17_V 0xFFFFFFFF +#define SPI_BUF17_S 0 + +#define SPI_DIN_MODE_REG(i) (REG_SPI_BASE(i) + 0x0EC) +/* SPI_DIN3_DLY_EDGE : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: The bit is used to select the spi clock edge to modify input line timing.*/ +#define SPI_DIN3_DLY_EDGE (BIT(21)) +#define SPI_DIN3_DLY_EDGE_M (BIT(21)) +#define SPI_DIN3_DLY_EDGE_V 0x1 +#define SPI_DIN3_DLY_EDGE_S 21 +/* SPI_DIN2_DLY_EDGE : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: The bit is used to select the spi clock edge to modify input line timing.*/ +#define SPI_DIN2_DLY_EDGE (BIT(20)) +#define SPI_DIN2_DLY_EDGE_M (BIT(20)) +#define SPI_DIN2_DLY_EDGE_V 0x1 +#define SPI_DIN2_DLY_EDGE_S 20 +/* SPI_DIN1_DLY_EDGE : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: The bit is used to select the spi clock edge to modify input line timing.*/ +#define SPI_DIN1_DLY_EDGE (BIT(19)) +#define SPI_DIN1_DLY_EDGE_M (BIT(19)) +#define SPI_DIN1_DLY_EDGE_V 0x1 +#define SPI_DIN1_DLY_EDGE_S 19 +/* SPI_DIN0_DLY_EDGE : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: The bit is used to select the spi clock edge to modify input line timing.*/ +#define SPI_DIN0_DLY_EDGE (BIT(18)) +#define SPI_DIN0_DLY_EDGE_M (BIT(18)) +#define SPI_DIN0_DLY_EDGE_V 0x1 +#define SPI_DIN0_DLY_EDGE_S 18 +/* SPI_DIN3_MODE : R/W ;bitpos:[7:6] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ +#define SPI_DIN3_MODE 0x00000003 +#define SPI_DIN3_MODE_M ((SPI_DIN3_MODE_V)<<(SPI_DIN3_MODE_S)) +#define SPI_DIN3_MODE_V 0x3 +#define SPI_DIN3_MODE_S 6 +/* SPI_DIN2_MODE : R/W ;bitpos:[5:4] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ +#define SPI_DIN2_MODE 0x00000003 +#define SPI_DIN2_MODE_M ((SPI_DIN2_MODE_V)<<(SPI_DIN2_MODE_S)) +#define SPI_DIN2_MODE_V 0x3 +#define SPI_DIN2_MODE_S 4 +/* SPI_DIN1_MODE : R/W ;bitpos:[3:2] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ +#define SPI_DIN1_MODE 0x00000003 +#define SPI_DIN1_MODE_M ((SPI_DIN1_MODE_V)<<(SPI_DIN1_MODE_S)) +#define SPI_DIN1_MODE_V 0x3 +#define SPI_DIN1_MODE_S 2 +/* SPI_DIN0_MODE : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: input + without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ +#define SPI_DIN0_MODE 0x00000003 +#define SPI_DIN0_MODE_M ((SPI_DIN0_MODE_V)<<(SPI_DIN0_MODE_S)) +#define SPI_DIN0_MODE_V 0x3 +#define SPI_DIN0_MODE_S 0 + +#define SPI_DIN_NUM_REG(i) (REG_SPI_BASE(i) + 0x0F0) +/* SPI_DIN3_NUM : R/W ;bitpos:[7:6] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_DIN3_NUM 0x00000003 +#define SPI_DIN3_NUM_M ((SPI_DIN3_NUM_V)<<(SPI_DIN3_NUM_S)) +#define SPI_DIN3_NUM_V 0x3 +#define SPI_DIN3_NUM_S 6 +/* SPI_DIN2_NUM : R/W ;bitpos:[5:4] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_DIN2_NUM 0x00000003 +#define SPI_DIN2_NUM_M ((SPI_DIN2_NUM_V)<<(SPI_DIN2_NUM_S)) +#define SPI_DIN2_NUM_V 0x3 +#define SPI_DIN2_NUM_S 4 +/* SPI_DIN1_NUM : R/W ;bitpos:[3:2] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_DIN1_NUM 0x00000003 +#define SPI_DIN1_NUM_M ((SPI_DIN1_NUM_V)<<(SPI_DIN1_NUM_S)) +#define SPI_DIN1_NUM_V 0x3 +#define SPI_DIN1_NUM_S 2 +/* SPI_DIN0_NUM : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: the input signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_DIN0_NUM 0x00000003 +#define SPI_DIN0_NUM_M ((SPI_DIN0_NUM_V)<<(SPI_DIN0_NUM_S)) +#define SPI_DIN0_NUM_V 0x3 +#define SPI_DIN0_NUM_S 0 + +#define SPI_DOUT_MODE_REG(i) (REG_SPI_BASE(i) + 0x0F4) +/* SPI_DOUT4_DLY_EDGE : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: The bit is used to select the spi clock edge to modify output line timing.*/ +#define SPI_DOUT4_DLY_EDGE (BIT(22)) +#define SPI_DOUT4_DLY_EDGE_M (BIT(22)) +#define SPI_DOUT4_DLY_EDGE_V 0x1 +#define SPI_DOUT4_DLY_EDGE_S 22 +/* SPI_DOUT3_DLY_EDGE : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: The bit is used to select the spi clock edge to modify output line timing.*/ +#define SPI_DOUT3_DLY_EDGE (BIT(21)) +#define SPI_DOUT3_DLY_EDGE_M (BIT(21)) +#define SPI_DOUT3_DLY_EDGE_V 0x1 +#define SPI_DOUT3_DLY_EDGE_S 21 +/* SPI_DOUT2_DLY_EDGE : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: The bit is used to select the spi clock edge to modify output line timing.*/ +#define SPI_DOUT2_DLY_EDGE (BIT(20)) +#define SPI_DOUT2_DLY_EDGE_M (BIT(20)) +#define SPI_DOUT2_DLY_EDGE_V 0x1 +#define SPI_DOUT2_DLY_EDGE_S 20 +/* SPI_DOUT1_DLY_EDGE : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: The bit is used to select the spi clock edge to modify output line timing.*/ +#define SPI_DOUT1_DLY_EDGE (BIT(19)) +#define SPI_DOUT1_DLY_EDGE_M (BIT(19)) +#define SPI_DOUT1_DLY_EDGE_V 0x1 +#define SPI_DOUT1_DLY_EDGE_S 19 +/* SPI_DOUT0_DLY_EDGE : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: The bit is used to select the spi clock edge to modify output line timing.*/ +#define SPI_DOUT0_DLY_EDGE (BIT(18)) +#define SPI_DOUT0_DLY_EDGE_M (BIT(18)) +#define SPI_DOUT0_DLY_EDGE_V 0x1 +#define SPI_DOUT0_DLY_EDGE_S 18 +/* SPI_DOUT4_MODE : R/W ;bitpos:[9:8] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ +#define SPI_DOUT4_MODE 0x00000003 +#define SPI_DOUT4_MODE_M ((SPI_DOUT4_MODE_V)<<(SPI_DOUT4_MODE_S)) +#define SPI_DOUT4_MODE_V 0x3 +#define SPI_DOUT4_MODE_S 8 +/* SPI_DOUT3_MODE : R/W ;bitpos:[7:6] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ +#define SPI_DOUT3_MODE 0x00000003 +#define SPI_DOUT3_MODE_M ((SPI_DOUT3_MODE_V)<<(SPI_DOUT3_MODE_S)) +#define SPI_DOUT3_MODE_V 0x3 +#define SPI_DOUT3_MODE_S 6 +/* SPI_DOUT2_MODE : R/W ;bitpos:[5:4] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ +#define SPI_DOUT2_MODE 0x00000003 +#define SPI_DOUT2_MODE_M ((SPI_DOUT2_MODE_V)<<(SPI_DOUT2_MODE_S)) +#define SPI_DOUT2_MODE_V 0x3 +#define SPI_DOUT2_MODE_S 4 +/* SPI_DOUT1_MODE : R/W ;bitpos:[3:2] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ +#define SPI_DOUT1_MODE 0x00000003 +#define SPI_DOUT1_MODE_M ((SPI_DOUT1_MODE_V)<<(SPI_DOUT1_MODE_S)) +#define SPI_DOUT1_MODE_V 0x3 +#define SPI_DOUT1_MODE_S 2 +/* SPI_DOUT0_MODE : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: output + without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ +#define SPI_DOUT0_MODE 0x00000003 +#define SPI_DOUT0_MODE_M ((SPI_DOUT0_MODE_V)<<(SPI_DOUT0_MODE_S)) +#define SPI_DOUT0_MODE_V 0x3 +#define SPI_DOUT0_MODE_S 0 + +#define SPI_DOUT_NUM_REG(i) (REG_SPI_BASE(i) + 0x0F8) +/* SPI_DOUT4_NUM : R/W ;bitpos:[9:8] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_DOUT4_NUM 0x00000003 +#define SPI_DOUT4_NUM_M ((SPI_DOUT4_NUM_V)<<(SPI_DOUT4_NUM_S)) +#define SPI_DOUT4_NUM_V 0x3 +#define SPI_DOUT4_NUM_S 8 +/* SPI_DOUT3_NUM : R/W ;bitpos:[7:6] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_DOUT3_NUM 0x00000003 +#define SPI_DOUT3_NUM_M ((SPI_DOUT3_NUM_V)<<(SPI_DOUT3_NUM_S)) +#define SPI_DOUT3_NUM_V 0x3 +#define SPI_DOUT3_NUM_S 6 +/* SPI_DOUT2_NUM : R/W ;bitpos:[5:4] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_DOUT2_NUM 0x00000003 +#define SPI_DOUT2_NUM_M ((SPI_DOUT2_NUM_V)<<(SPI_DOUT2_NUM_S)) +#define SPI_DOUT2_NUM_V 0x3 +#define SPI_DOUT2_NUM_S 4 +/* SPI_DOUT1_NUM : R/W ;bitpos:[3:2] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_DOUT1_NUM 0x00000003 +#define SPI_DOUT1_NUM_M ((SPI_DOUT1_NUM_V)<<(SPI_DOUT1_NUM_S)) +#define SPI_DOUT1_NUM_V 0x3 +#define SPI_DOUT1_NUM_S 2 +/* SPI_DOUT0_NUM : R/W ;bitpos:[1:0] ;default: 2'h0 ; */ +/*description: the output signals are delayed by system clock cycles 0: delayed + by 1 cycle 1: delayed by 2 cycles ...*/ +#define SPI_DOUT0_NUM 0x00000003 +#define SPI_DOUT0_NUM_M ((SPI_DOUT0_NUM_V)<<(SPI_DOUT0_NUM_S)) +#define SPI_DOUT0_NUM_V 0x3 +#define SPI_DOUT0_NUM_S 0 + +#define SPI_SPR_CFG0_REG(i) (REG_SPI_BASE(i) + 0x0FC) +/* SPI_SOP_DQS_EDGE : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define SPI_SOP_DQS_EDGE (BIT(21)) +#define SPI_SOP_DQS_EDGE_M (BIT(21)) +#define SPI_SOP_DQS_EDGE_V 0x1 +#define SPI_SOP_DQS_EDGE_S 21 +/* SPI_SOP_WCMD : R/W ;bitpos:[20:13] ;default: 8'd2 ; */ +/*description: */ +#define SPI_SOP_WCMD 0x000000FF +#define SPI_SOP_WCMD_M ((SPI_SOP_WCMD_V)<<(SPI_SOP_WCMD_S)) +#define SPI_SOP_WCMD_V 0xFF +#define SPI_SOP_WCMD_S 13 +/* SPI_SOP_RCMD : R/W ;bitpos:[12:5] ;default: 8'd3 ; */ +/*description: */ +#define SPI_SOP_RCMD 0x000000FF +#define SPI_SOP_RCMD_M ((SPI_SOP_RCMD_V)<<(SPI_SOP_RCMD_S)) +#define SPI_SOP_RCMD_V 0xFF +#define SPI_SOP_RCMD_S 5 +/* SPI_SOP_MODE : R/W ;bitpos:[4:1] ;default: 4'd0 ; */ +/*description: */ +#define SPI_SOP_MODE 0x0000000F +#define SPI_SOP_MODE_M ((SPI_SOP_MODE_V)<<(SPI_SOP_MODE_S)) +#define SPI_SOP_MODE_V 0xF +#define SPI_SOP_MODE_S 1 +/* SPI_SOP_EN : R/W ;bitpos:[0] ;default: 1'd0 ; */ +/*description: */ +#define SPI_SOP_EN (BIT(0)) +#define SPI_SOP_EN_M (BIT(0)) +#define SPI_SOP_EN_V 0x1 +#define SPI_SOP_EN_S 0 + +#define SPI_SPR_CFG1_REG(i) (REG_SPI_BASE(i) + 0x100) +/* SPI_SOP_DC_MODE : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define SPI_SOP_DC_MODE (BIT(24)) +#define SPI_SOP_DC_MODE_M (BIT(24)) +#define SPI_SOP_DC_MODE_V 0x1 +#define SPI_SOP_DC_MODE_S 24 +/* SPI_SOP_DLEN : R/W ;bitpos:[23:18] ;default: 6'd0 ; */ +/*description: */ +#define SPI_SOP_DLEN 0x0000003F +#define SPI_SOP_DLEN_M ((SPI_SOP_DLEN_V)<<(SPI_SOP_DLEN_S)) +#define SPI_SOP_DLEN_V 0x3F +#define SPI_SOP_DLEN_S 18 +/* SPI_SOP_LEN : R/W ;bitpos:[17:12] ;default: 6'd0 ; */ +/*description: */ +#define SPI_SOP_LEN 0x0000003F +#define SPI_SOP_LEN_M ((SPI_SOP_LEN_V)<<(SPI_SOP_LEN_S)) +#define SPI_SOP_LEN_V 0x3F +#define SPI_SOP_LEN_S 12 +/* SPI_SOP_ITL : R/W ;bitpos:[11:0] ;default: 12'd0 ; */ +/*description: */ +#define SPI_SOP_ITL 0x00000FFF +#define SPI_SOP_ITL_M ((SPI_SOP_ITL_V)<<(SPI_SOP_ITL_S)) +#define SPI_SOP_ITL_V 0xFFF +#define SPI_SOP_ITL_S 0 + +#define SPI_DATE_REG(i) (REG_SPI_BASE(i) + 0x3FC) +/* SPI_DATE : RW ;bitpos:[27:0] ;default: 32'h1810100 ; */ +/*description: SPI register version.*/ +#define SPI_DATE 0x0FFFFFFF +#define SPI_DATE_M ((SPI_DATE_V)<<(SPI_DATE_S)) +#define SPI_DATE_V 0xFFFFFFF +#define SPI_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_SPI_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/spi_struct.h b/components/soc/esp32s2beta/include/soc/spi_struct.h new file mode 100644 index 0000000000..9a87736973 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/spi_struct.h @@ -0,0 +1,682 @@ +// Copyright 2017-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_STRUCT_H_ +#define _SOC_SPI_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t reserved0: 18; /*reserved*/ + uint32_t usr: 1; /*User define command enable. An operation will be triggered when the bit is set. The bit will be cleared once the operation done.1: enable 0: disable.*/ + uint32_t reserved19:13; + }; + uint32_t val; + } cmd; + uint32_t addr; /*[31:8]:address to slave [7:0]:Reserved.*/ + union { + struct { + uint32_t reserved0: 2; /*reserved*/ + uint32_t ext_hold_en: 1; /*Set the bit to hold spi. The bit is combined with spi_usr_prep_hold spi_usr_cmd_hold spi_usr_addr_hold spi_usr_dummy_hold spi_usr_din_hold spi_usr_dout_hold and spi_usr_hold_pol.*/ + uint32_t dummy_out: 1; /*In the dummy phase the signal level of spi is output by the spi controller.*/ + uint32_t reserved4: 1; /*reserved*/ + uint32_t faddr_dual: 1; /*Apply 2 signals during addr phase 1:enable 0: disable*/ + uint32_t faddr_quad: 1; /*Apply 4 signals during addr phase 1:enable 0: disable*/ + uint32_t fcmd_dual: 1; /*Apply 2 signals during command phase 1:enable 0: disable*/ + uint32_t fcmd_quad: 1; /*Apply 4 signals during command phase 1:enable 0: disable*/ + uint32_t reserved9: 4; + uint32_t fast_rd_mode: 1; /*Enable 2/4 lines addr command including read and write command.*/ + uint32_t fread_dual: 1; /*In the read operations read-data phase apply 2 signals. 1: enable 0: disable.*/ + uint32_t reserved15: 3; + uint32_t q_pol: 1; /*The bit is used to set MISO line polarity 1: high 0 low*/ + uint32_t d_pol: 1; /*The bit is used to set MOSI line polarity 1: high 0 low*/ + uint32_t fread_quad: 1; /*In the read operations read-data phase apply 4 signals. 1: enable 0: disable.*/ + uint32_t wp: 1; /*Write protect signal output when SPI is idle. 1: output high 0: output low.*/ + uint32_t reserved22: 3; /*reserved*/ + uint32_t rd_bit_order: 1; /*In read-data (MISO) phase 1: LSB first 0: MSB first*/ + uint32_t wr_bit_order: 1; /*In command address write-data (MOSI) phases 1: LSB firs 0: MSB first*/ + uint32_t define_addr: 1; /*set spi_usr_addr and spi_usr_addr_value in spi defined slave mode. 1: disable 0:enable.*/ + uint32_t reserved28: 4; /*reserved*/ + }; + uint32_t val; + } ctrl; + union { + struct { + uint32_t clk_mode: 2; /*SPI clock mode bits. 0: SPI clock is off when CS inactive 1: SPI clock is delayed one cycle after CS inactive 2: SPI clock is delayed two cycles after CS inactive 3: SPI clock is alwasy on.*/ + uint32_t clk_mode_13: 1; /*{CPOL CPHA} 1: support spi clk mode 1 and 3 first edge output data B[0]/B[7]*/ + uint32_t rsck_data_out: 1; /*It saves half a cycle when tsck is the same as rsck. 1: output data at rsck posedge 0: output data at tsck posedge*/ + uint32_t w16_17_wr_ena: 1; /*1:reg_buf[16] [17] can be written 0:reg_buf[16] [17] can not be written.*/ + uint32_t reserved5: 9; /*reserved*/ + uint32_t cs_hold_delay: 6; /*SPI cs signal is delayed by spi clock cycles.*/ + uint32_t reserved20: 12; + }; + uint32_t val; + } ctrl1; + union { + struct { + uint32_t cs_setup_time:13; /*(cycles-1) of prepare phase by spi clock this bits are combined with spi_cs_setup bit.*/ + uint32_t cs_hold_time: 13; /*delay cycles of cs pin by spi clock this bits are combined with spi_cs_hold bit.*/ + uint32_t cs_delay_mode: 2; /*spi_cs signal is delayed by spi_clk . 0: zero 1: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by half cycle else delayed by one cycle 2: if spi_ck_out_edge or spi_ck_i_edge is set 1 delayed by one cycle else delayed by half cycle 3: delayed one cycle*/ + uint32_t cs_delay_num: 2; /*spi_cs signal is delayed by system clock cycles*/ + uint32_t reserved30: 1; /*reserved*/ + uint32_t cs_delay_edge: 1; + }; + uint32_t val; + } ctrl2; + union { + struct { + uint32_t clkcnt_l: 6; /*In the master mode it must be equal to spi_clkcnt_N. In the slave mode it must be 0.*/ + uint32_t clkcnt_h: 6; /*In the master mode it must be floor((spi_clkcnt_N+1)/2-1). In the slave mode it must be 0.*/ + uint32_t clkcnt_n: 6; /*In the master mode it is the divider of spi_clk. So spi_clk frequency is system/(spi_clkdiv_pre+1)/(spi_clkcnt_N+1)*/ + uint32_t clkdiv_pre: 13; /*In the master mode it is pre-divider of spi_clk.*/ + uint32_t clk_equ_sysclk: 1; /*In the master mode 1: spi_clk is eqaul to system 0: spi_clk is divided from system clock.*/ + }; + uint32_t val; + } clock; + union { + struct { + uint32_t doutdin: 1; /*Set the bit to enable full duplex communication. 1: enable 0: disable.*/ + uint32_t tx_start_bit: 3; /*It determines the start time of tx output data. It can be used for timing adjustment in MISO slave mode.*/ + uint32_t reserved4: 1; /*reserved*/ + uint32_t tsck_i_edge: 1; /*In the slave mode this bit can be used to change the polarity of tsck. 0: tsck = spi_ck_i. 1:tsck = !spi_ck_i.*/ + uint32_t cs_hold: 1; /*spi cs keep low when spi is in done phase. 1: enable 0: disable.*/ + uint32_t cs_setup: 1; /*spi cs is enable when spi is in prepare phase. 1: enable 0: disable.*/ + uint32_t rsck_i_edge: 1; /*In the slave mode this bit can be used to change the polarity of rsck. 0: rsck = !spi_ck_i. 1:rsck = spi_ck_i.*/ + uint32_t ck_out_edge: 1; /*the bit combined with spi_mosi_delay_mode bits to set mosi signal delay mode.*/ + uint32_t rd_byte_order: 1; /*In read-data (MISO) phase 1: big-endian 0: little_endian*/ + uint32_t wr_byte_order: 1; /*In command address write-data (MOSI) phases 1: big-endian 0: litte_endian*/ + uint32_t fwrite_dual: 1; /*In the write operations read-data phase apply 2 signals*/ + uint32_t fwrite_quad: 1; /*In the write operations read-data phase apply 4 signals*/ + uint32_t reserved14: 1; /*reserved*/ + uint32_t reserved15: 1; /*reserved*/ + uint32_t sio: 1; /*Set the bit to enable 3-line half duplex communication mosi and miso signals share the same pin. 1: enable 0: disable.*/ + uint32_t usr_hold_pol: 1; /*It is combined with hold bits to set the polarity of spi hold line 1: spi will be held when spi hold line is high 0: spi will be held when spi hold line is low*/ + uint32_t usr_dout_hold: 1; /*spi is hold at data out state the bit are combined with spi_usr_hold_pol bit.*/ + uint32_t usr_din_hold: 1; /*spi is hold at data in state the bit are combined with spi_usr_hold_pol bit.*/ + uint32_t usr_dummy_hold: 1; /*spi is hold at dummy state the bit are combined with spi_usr_hold_pol bit.*/ + uint32_t usr_addr_hold: 1; /*spi is hold at address state the bit are combined with spi_usr_hold_pol bit.*/ + uint32_t usr_cmd_hold: 1; /*spi is hold at command state the bit are combined with spi_usr_hold_pol bit.*/ + uint32_t usr_prep_hold: 1; /*spi is hold at prepare state the bit are combined with spi_usr_hold_pol bit.*/ + uint32_t usr_miso_highpart: 1; /*read-data phase only access to high-part of the buffer spi_w8~spi_w15. 1: enable 0: disable.*/ + uint32_t usr_mosi_highpart: 1; /*write-data phase only access to high-part of the buffer spi_w8~spi_w15. 1: enable 0: disable.*/ + uint32_t usr_dummy_idle: 1; /*spi clock is disable in dummy phase when the bit is enable.*/ + uint32_t usr_mosi: 1; /*This bit enable the write-data phase of an operation.*/ + uint32_t usr_miso: 1; /*This bit enable the read-data phase of an operation.*/ + uint32_t usr_dummy: 1; /*This bit enable the dummy phase of an operation.*/ + uint32_t usr_addr: 1; /*This bit enable the address phase of an operation.*/ + uint32_t usr_command: 1; /*This bit enable the command phase of an operation.*/ + }; + uint32_t val; + } user; + union { + struct { + uint32_t usr_dummy_cyclelen: 8; /*The length in spi_clk cycles of dummy phase. The register value shall be (cycle_num-1).*/ + uint32_t reserved8: 18; /*reserved*/ + uint32_t usr_addr_bitlen: 6; /*The length in bits of address phase. The register value shall be (bit_num-1).*/ + }; + uint32_t val; + } user1; + union { + struct { + uint32_t usr_command_value: 16; /*The value of command.*/ + uint32_t reserved16: 12; /*reserved*/ + uint32_t usr_command_bitlen: 4; /*The length in bits of command phase. The register value shall be (bit_num-1)*/ + }; + uint32_t val; + } user2; + union { + struct { + uint32_t usr_mosi_bit_len:24; /*The length in bits of write-data. The register value shall be (bit_num-1).*/ + uint32_t reserved24: 8; /*reserved*/ + }; + uint32_t val; + } mosi_dlen; + union { + struct { + uint32_t usr_miso_bit_len:24; /*The length in bits of read-data. The register value shall be (bit_num-1).*/ + uint32_t reserved24: 8; /*reserved*/ + }; + uint32_t val; + } miso_dlen; + uint32_t slv_wr_status; /*In the master mode this register are the higher 32bits in the 64 bits address condition.*/ + union { + struct { + uint32_t cs0_dis: 1; /*SPI CS0 pin enable 1: disable CS0 0: spi_cs0 signal is from/to CS0 pin*/ + uint32_t cs1_dis: 1; /*SPI CS1 pin enable 1: disable CS1 0: spi_cs1 signal is from/to CS1 pin*/ + uint32_t cs2_dis: 1; /*SPI CS2 pin enable 1: disable CS2 0: spi_cs2 signal is from/to CS2 pin*/ + uint32_t reserved3: 2; /*reserved*/ + uint32_t ck_dis: 1; /*1: spi clk out disable 0: spi clk out enable*/ + uint32_t master_cs_pol: 3; /*In the master mode the bits are the polarity of spi cs line the value is equivalent to spi_cs ^ spi_master_cs_pol.*/ + uint32_t reserved9: 14; /*reserved*/ + uint32_t slave_cs_pol: 1; /*spi slave input cs polarity select. 1: inv 0: not change*/ + uint32_t reserved24: 3; /*reserved*/ + uint32_t q_idle_out: 1; /*The idle output value of spi_q.*/ + uint32_t reserved28: 1; /*reserved*/ + uint32_t ck_idle_edge: 1; /*1: spi clk line is high when idle 0: spi clk line is low when idle*/ + uint32_t cs_keep_active: 1; /*spi cs line keep low when the bit is set.*/ + uint32_t quad_din_pin_swap: 1; /*1: spi quad input swap enable 0: spi quad input swap disable*/ + }; + uint32_t val; + } misc; + union { + struct { + uint32_t reserved0: 4; /*reserved*/ + uint32_t trans_done: 1; /*The interrupt raw bit for the completion of any operation in both the master mode and the slave mode.*/ + uint32_t int_rd_buf_done_en: 1; /*spi_slv_rd_buf Interrupt enable. 1: enable 0: disable*/ + uint32_t int_wr_buf_done_en: 1; /*spi_slv_wr_buf Interrupt enable. 1: enable 0: disable*/ + uint32_t int_rd_dma_done_en: 1; /*spi_slv_rd_dma Interrupt enable. 1: enable 0: disable*/ + uint32_t int_wr_dma_done_en: 1; /*spi_slv_wr_dma Interrupt enable. 1: enable 0: disable*/ + uint32_t int_trans_done_en: 1; /*spi_trans_done Interrupt enable. 1: enable 0: disable*/ + uint32_t reserved10: 13; /*reserved*/ + uint32_t trans_cnt: 4; /*The operations counter in both the master mode and the slave mode.*/ + uint32_t reserved27: 1; /*reserved*/ + uint32_t reserved28: 1; /*reserved*/ + uint32_t reserved29: 1; /*reserved*/ + uint32_t slave_mode: 1; /*Set SPI work mode. 1: slave mode 0: master mode.*/ + uint32_t sync_reset: 1; /*Software reset enable reset the spi clock line cs line and data lines.*/ + }; + uint32_t val; + } slave; + union { + struct { + uint32_t rd_addr_bytelen: 4; /*In the slave mode it is the address length in bytes for read-buffer operation. The register value shall be byte_num.*/ + uint32_t wr_addr_bytelen: 4; /*In the slave mode it is the address length in bytes for write-buffer operation. The register value shall be byte_num.*/ + uint32_t reserved8: 3; /*reserved*/ + uint32_t wr_dma_done: 1; /*The interrupt raw bit for the completion of dma write operation in the slave mode.*/ + uint32_t last_command: 3; /*In the slave mode it is the value of command.*/ + uint32_t last_addr: 7; /*In the slave mode it is the value of address.*/ + uint32_t reserved22: 10; /*reserved*/ + }; + uint32_t val; + } slave1; + union { + struct { + uint32_t rd_dummy_bytelen: 4; /*In the slave mode it is the length in spi_clk byte cycles of dummy phase for read operations.*/ + uint32_t wr_dummy_bytelen: 4; /*In the slave mode it is the length in spi_clk byte cycles of dummy phase for write operations.*/ + uint32_t rd_dma_done: 1; /*The interrupt raw bit for the completion of dma read operation in the slave mode.*/ + uint32_t reserved9: 23; /*reserved*/ + }; + uint32_t val; + } slave2; + union { + struct { + uint32_t bit_len: 24; /*In the slave mode it is the length in bits for write-buffer operations. The register value shall be (bit_num-1).*/ + uint32_t wr_buf_done: 1; /*The interrupt raw bit for the completion of write-buffer operation in the slave mode.*/ + uint32_t reserved25: 7; /*reserved*/ + }; + uint32_t val; + } slv_wrbuf_dlen; + union { + struct { + uint32_t bit_len: 24; /*In the slave mode it is the length in bits for read-buffer operations. The register value shall be (bit_num-1).*/ + uint32_t rd_buf_done: 1; /*The interrupt raw bit for the completion of read-buffer operation in the slave mode.*/ + uint32_t reserved25: 7; /*reserved*/ + }; + uint32_t val; + } slv_rdbuf_dlen; + union { + struct { + uint32_t slv_rdata_bit:24; /*In the slave mode it is the byte number of read data.*/ + uint32_t reserved24: 8; /*reserved*/ + }; + uint32_t val; + } slv_rd_byte; + uint32_t reserved_4c; + union { + struct { + uint32_t st: 3; /*The status of spi state machine. 0: idle state 1: preparation state 2: send command state 3: send data state 4: red data state 5:write data state 6: wait state 7: done state.*/ + uint32_t reserved3: 29; /*reserved*/ + }; + uint32_t val; + } fsm; + union { + struct { + uint32_t int_hold_ena: 2; /*This register is for two SPI masters to share the same cs clock and data signals. The bits of one SPI are set if the other SPI is busy the SPI will be hold. 1(3): hold at idle phase 2: hold at prepare phase.*/ + uint32_t hold_val: 1; /*spi hold output value which should be used with spi_hold_out_en.*/ + uint32_t hold_out_en: 1; /*Enable set spi output hold value to spi_hold_reg. It can be used to hold spi state machine with spi_ext_hold_en and other usr hold signals.*/ + uint32_t hold_out_time: 3; /*set the hold cycles of output spi_hold signal when spi_hold_out_en is enable.*/ + uint32_t reserved7: 25; /*reserved*/ + }; + uint32_t val; + } hold; + union { + struct { + uint32_t reserved0: 2; /*reserved*/ + uint32_t in_rst: 1; /*The bit is used to reset in dma fsm and in data fifo pointer.*/ + uint32_t out_rst: 1; /*The bit is used to reset out dma fsm and out data fifo pointer.*/ + uint32_t ahbm_fifo_rst: 1; /*Reset spi dma ahb master fifo pointer.*/ + uint32_t ahbm_rst: 1; /*Reset spi dma ahb master.*/ + uint32_t in_loop_test: 1; /*Set bit to test in link.*/ + uint32_t out_loop_test: 1; /*Set bit to test out link.*/ + uint32_t out_auto_wrback: 1; /*when the bit is set DMA continue to use the next inlink node when the length of inlink is 0.*/ + uint32_t out_eof_mode: 1; /*out eof flag generation mode . 1: when dma pop all data from fifo 0:when ahb push all data to fifo.*/ + uint32_t outdscr_burst_en: 1; /*read descriptor use burst mode when read data for memory.*/ + uint32_t indscr_burst_en: 1; /*read descriptor use burst mode when write data to memory.*/ + uint32_t out_data_burst_en: 1; /*spi dma read data from memory in burst mode.*/ + uint32_t mem_trans_en: 1; + uint32_t dma_rx_stop: 1; /*spi dma read data stop when in continue tx/rx mode.*/ + uint32_t dma_tx_stop: 1; /*spi dma write data stop when in continue tx/rx mode.*/ + uint32_t dma_continue: 1; /*spi dma continue tx/rx data.*/ + uint32_t continue_pop_data_clr: 1; /*Disable spi slave dma to pop data continuously in next transmission in dma half duplex slave mode. 1: disable continue transmit. 0: enable continue transmit.*/ + uint32_t slv_rx_seg_trans_en: 1; /*enable DMA segment transfer in slave mode*/ + uint32_t reserved19: 3; /*reserved*/ + uint32_t infifo_full_clr: 1; + uint32_t outfifo_empty_clr: 1; + uint32_t reserved24: 8; + }; + uint32_t val; + } dma_conf; + union { + struct { + uint32_t addr: 20; /*The address of the first outlink descriptor.*/ + uint32_t reserved20: 8; /*reserved*/ + uint32_t stop: 1; /*Set the bit to stop to use outlink descriptor.*/ + uint32_t start: 1; /*Set the bit to start to use outlink descriptor.*/ + uint32_t restart: 1; /*Set the bit to mount on new outlink descriptors.*/ + uint32_t dma_tx_ena: 1; /*spi dma write data status bit.*/ + }; + uint32_t val; + } dma_out_link; + union { + struct { + uint32_t addr: 20; /*The address of the first inlink descriptor.*/ + uint32_t auto_ret: 1; /*when the bit is set the inlink descriptor returns to the first link node when a packet is error.*/ + uint32_t reserved21: 7; /*reserved*/ + uint32_t stop: 1; /*Set the bit to stop to use inlink descriptor.*/ + uint32_t start: 1; /*Set the bit to start to use inlink descriptor.*/ + uint32_t restart: 1; /*Set the bit to mount on new inlink descriptors.*/ + uint32_t dma_rx_ena: 1; /*spi dma read data status bit.*/ + }; + uint32_t val; + } dma_in_link; + union { + struct { + uint32_t inlink_dscr_empty: 1; /*The enable bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The enable bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The enable bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The enable bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The enable bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The enable bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The enable bit for completing usage of a outlink descriptor .*/ + uint32_t out_eof: 1; /*The enable bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The enable bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ + }; + uint32_t val; + } dma_int_ena; + union { + struct { + uint32_t inlink_dscr_empty: 1; /*The raw bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The raw bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The raw bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The raw bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The raw bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The raw bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The raw bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof: 1; /*The raw bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The raw bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ + }; + uint32_t val; + } dma_int_raw; + union { + struct { + uint32_t inlink_dscr_empty: 1; /*The status bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The status bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The status bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The status bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The status bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The status bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The status bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof: 1; /*The status bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The status bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ + }; + uint32_t val; + } dma_int_st; + union { + struct { + uint32_t inlink_dscr_empty: 1; /*The clear bit for lack of enough inlink descriptors.*/ + uint32_t outlink_dscr_error: 1; /*The clear bit for outlink descriptor error.*/ + uint32_t inlink_dscr_error: 1; /*The clear bit for inlink descriptor error.*/ + uint32_t in_done: 1; /*The clear bit for completing usage of a inlink descriptor.*/ + uint32_t in_err_eof: 1; /*The clear bit for receiving error.*/ + uint32_t in_suc_eof: 1; /*The clear bit for completing receiving all the packets from host.*/ + uint32_t out_done: 1; /*The clear bit for completing usage of a outlink descriptor.*/ + uint32_t out_eof: 1; /*The clear bit for sending a packet to host done.*/ + uint32_t out_total_eof: 1; /*The clear bit for sending all the packets to host done.*/ + uint32_t reserved9: 23; /*reserved*/ + }; + uint32_t val; + } dma_int_clr; + uint32_t dma_in_err_eof_des_addr; /*The inlink descriptor address when spi dma produce receiving error.*/ + uint32_t dma_in_suc_eof_des_addr; /*The last inlink descriptor address when spi dma produce from_suc_eof.*/ + uint32_t dma_inlink_dscr; /*The content of current in descriptor pointer.*/ + uint32_t dma_inlink_dscr_bf0; /*The content of next in descriptor pointer.*/ + uint32_t dma_inlink_dscr_bf1; /*The content of current in descriptor data buffer pointer.*/ + uint32_t dma_out_eof_bfr_des_addr; /*The address of buffer relative to the outlink descriptor that produce eof.*/ + uint32_t dma_out_eof_des_addr; /*The last outlink descriptor address when spi dma produce to_eof.*/ + uint32_t dma_outlink_dscr; /*The content of current out descriptor pointer.*/ + uint32_t dma_outlink_dscr_bf0; /*The content of next out descriptor pointer.*/ + uint32_t dma_outlink_dscr_bf1; /*The content of current out descriptor data buffer pointer.*/ + union { + struct { + uint32_t out_dscr_addr: 18; /*SPI dma out descriptor address.*/ + uint32_t out_dscr_state: 2; /*SPI dma out descriptor state.*/ + uint32_t out_state: 3; /*SPI dma out data state.*/ + uint32_t out_fifo_cnt: 7; /*The remains of SPI dma outfifo data.*/ + uint32_t out_fifo_full: 1; /*SPI dma outfifo is full.*/ + uint32_t out_fifo_empty: 1; /*SPI dma outfifo is empty.*/ + }; + uint32_t val; + } dma_out_status; + union { + struct { + uint32_t in_dscr_addr: 18; /*SPI dma in descriptor address.*/ + uint32_t in_dscr_state: 2; /*SPI dma in descriptor state.*/ + uint32_t in_state: 3; /*SPI dma in data state.*/ + uint32_t in_fifo_cnt: 7; /*The remains of SPI dma infifo data.*/ + uint32_t in_fifo_full: 1; /*SPI dma infifo is full.*/ + uint32_t in_fifo_empty: 1; /*SPI dma infifo is empty.*/ + }; + uint32_t val; + } dma_in_status; + uint32_t data_buf[18]; /*data buffer*/ + union { + struct { + uint32_t din0_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t din1_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t din2_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t din3_mode: 2; /*the input signals are delayed by system clock cycles 0: input without delayed 1: input with the posedge of clk_apb 2 input with the negedge of clk_apb 3: input with the spi_clk*/ + uint32_t reserved8: 10; + uint32_t din0_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t din1_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t din2_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t din3_dly_edge: 1; /*The bit is used to select the spi clock edge to modify input line timing.*/ + uint32_t reserved22: 10; /*reserved*/ + }; + uint32_t val; + } din_mode; + union { + struct { + uint32_t din0_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t din1_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t din2_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t din3_num: 2; /*the input signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t reserved8: 24; /*reserved*/ + }; + uint32_t val; + } din_num; + union { + struct { + uint32_t dout0_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t dout1_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t dout2_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t dout3_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t dout4_mode: 2; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t reserved10: 8; /*the output signals are delayed by system clock cycles 0: output without delayed 1: output with the posedge of clk_apb 2 output with the negedge of clk_apb 3: output with the spi_clk*/ + uint32_t dout0_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t dout1_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t dout2_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t dout3_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t dout4_dly_edge: 1; /*The bit is used to select the spi clock edge to modify output line timing.*/ + uint32_t reserved23: 9; /*reserved*/ + }; + uint32_t val; + } dout_mode; + union { + struct { + uint32_t dout0_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t dout1_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t dout2_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t dout3_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t dout4_num: 2; /*the output signals are delayed by system clock cycles 0: delayed by 1 cycle 1: delayed by 2 cycles ...*/ + uint32_t reserved10:22; /*reserved*/ + }; + uint32_t val; + } dout_num; + union { + struct { + uint32_t sop_en: 1; + uint32_t sop_mode: 4; + uint32_t sop_rcmd: 8; + uint32_t sop_wcmd: 8; + uint32_t sop_dqs_edge: 1; + uint32_t reserved22: 10; + }; + uint32_t val; + } spr_cfg0; + union { + struct { + uint32_t sop_itl: 12; + uint32_t sop_len: 6; + uint32_t sop_dlen: 6; + uint32_t sop_dc_mode: 1; + uint32_t reserved25: 7; + }; + uint32_t val; + } spr_cfg1; + uint32_t reserved_104; + uint32_t reserved_108; + uint32_t reserved_10c; + uint32_t reserved_110; + uint32_t reserved_114; + uint32_t reserved_118; + uint32_t reserved_11c; + uint32_t reserved_120; + uint32_t reserved_124; + uint32_t reserved_128; + uint32_t reserved_12c; + uint32_t reserved_130; + uint32_t reserved_134; + uint32_t reserved_138; + uint32_t reserved_13c; + uint32_t reserved_140; + uint32_t reserved_144; + uint32_t reserved_148; + uint32_t reserved_14c; + uint32_t reserved_150; + uint32_t reserved_154; + uint32_t reserved_158; + uint32_t reserved_15c; + uint32_t reserved_160; + uint32_t reserved_164; + uint32_t reserved_168; + uint32_t reserved_16c; + uint32_t reserved_170; + uint32_t reserved_174; + uint32_t reserved_178; + uint32_t reserved_17c; + uint32_t reserved_180; + uint32_t reserved_184; + uint32_t reserved_188; + uint32_t reserved_18c; + uint32_t reserved_190; + uint32_t reserved_194; + uint32_t reserved_198; + uint32_t reserved_19c; + uint32_t reserved_1a0; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + uint32_t reserved_1f0; + uint32_t reserved_1f4; + uint32_t reserved_1f8; + uint32_t reserved_1fc; + uint32_t reserved_200; + uint32_t reserved_204; + uint32_t reserved_208; + uint32_t reserved_20c; + uint32_t reserved_210; + uint32_t reserved_214; + uint32_t reserved_218; + uint32_t reserved_21c; + uint32_t reserved_220; + uint32_t reserved_224; + uint32_t reserved_228; + uint32_t reserved_22c; + uint32_t reserved_230; + uint32_t reserved_234; + uint32_t reserved_238; + uint32_t reserved_23c; + uint32_t reserved_240; + uint32_t reserved_244; + uint32_t reserved_248; + uint32_t reserved_24c; + uint32_t reserved_250; + uint32_t reserved_254; + uint32_t reserved_258; + uint32_t reserved_25c; + uint32_t reserved_260; + uint32_t reserved_264; + uint32_t reserved_268; + uint32_t reserved_26c; + uint32_t reserved_270; + uint32_t reserved_274; + uint32_t reserved_278; + uint32_t reserved_27c; + uint32_t reserved_280; + uint32_t reserved_284; + uint32_t reserved_288; + uint32_t reserved_28c; + uint32_t reserved_290; + uint32_t reserved_294; + uint32_t reserved_298; + uint32_t reserved_29c; + uint32_t reserved_2a0; + uint32_t reserved_2a4; + uint32_t reserved_2a8; + uint32_t reserved_2ac; + uint32_t reserved_2b0; + uint32_t reserved_2b4; + uint32_t reserved_2b8; + uint32_t reserved_2bc; + uint32_t reserved_2c0; + uint32_t reserved_2c4; + uint32_t reserved_2c8; + uint32_t reserved_2cc; + uint32_t reserved_2d0; + uint32_t reserved_2d4; + uint32_t reserved_2d8; + uint32_t reserved_2dc; + uint32_t reserved_2e0; + uint32_t reserved_2e4; + uint32_t reserved_2e8; + uint32_t reserved_2ec; + uint32_t reserved_2f0; + uint32_t reserved_2f4; + uint32_t reserved_2f8; + uint32_t reserved_2fc; + uint32_t reserved_300; + uint32_t reserved_304; + uint32_t reserved_308; + uint32_t reserved_30c; + uint32_t reserved_310; + uint32_t reserved_314; + uint32_t reserved_318; + uint32_t reserved_31c; + uint32_t reserved_320; + uint32_t reserved_324; + uint32_t reserved_328; + uint32_t reserved_32c; + uint32_t reserved_330; + uint32_t reserved_334; + uint32_t reserved_338; + uint32_t reserved_33c; + uint32_t reserved_340; + uint32_t reserved_344; + uint32_t reserved_348; + uint32_t reserved_34c; + uint32_t reserved_350; + uint32_t reserved_354; + uint32_t reserved_358; + uint32_t reserved_35c; + uint32_t reserved_360; + uint32_t reserved_364; + uint32_t reserved_368; + uint32_t reserved_36c; + uint32_t reserved_370; + uint32_t reserved_374; + uint32_t reserved_378; + uint32_t reserved_37c; + uint32_t reserved_380; + uint32_t reserved_384; + uint32_t reserved_388; + uint32_t reserved_38c; + uint32_t reserved_390; + uint32_t reserved_394; + uint32_t reserved_398; + uint32_t reserved_39c; + uint32_t reserved_3a0; + uint32_t reserved_3a4; + uint32_t reserved_3a8; + uint32_t reserved_3ac; + uint32_t reserved_3b0; + uint32_t reserved_3b4; + uint32_t reserved_3b8; + uint32_t reserved_3bc; + uint32_t reserved_3c0; + uint32_t reserved_3c4; + uint32_t reserved_3c8; + uint32_t reserved_3cc; + uint32_t reserved_3d0; + uint32_t reserved_3d4; + uint32_t reserved_3d8; + uint32_t reserved_3dc; + uint32_t reserved_3e0; + uint32_t reserved_3e4; + uint32_t reserved_3e8; + uint32_t reserved_3ec; + uint32_t reserved_3f0; + uint32_t reserved_3f4; + uint32_t reserved_3f8; + union { + struct { + uint32_t date: 28; /*SPI register version.*/ + uint32_t reserved28: 4; /*reserved*/ + }; + uint32_t val; + } date; +} spi_dev_t; +extern spi_dev_t GPSPI2; //FSPI +extern spi_dev_t GPSPI3; //HSPI +extern spi_dev_t GPSPI4; //VSPI + + +_Static_assert(sizeof(spi_dev_t)==0x400, "***invalid spi"); + + +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_SPI_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/syscon_reg.h b/components/soc/esp32s2beta/include/soc/syscon_reg.h new file mode 100644 index 0000000000..efa9a0ba78 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/syscon_reg.h @@ -0,0 +1,896 @@ +// Copyright 2017-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_SYSCON_REG_H_ +#define _SOC_SYSCON_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define SYSCON_SYSCLK_CONF_REG (DR_REG_SYSCON_BASE + 0x000) +/* SYSCON_SOC_CLK_SEL : R/W ;bitpos:[15:14] ;default: 2'd0 ; */ +/*description: */ +#define SYSCON_SOC_CLK_SEL 0x00000003 +#define SYSCON_SOC_CLK_SEL_M ((SYSCON_SOC_CLK_SEL_V)<<(SYSCON_SOC_CLK_SEL_S)) +#define SYSCON_SOC_CLK_SEL_V 0x3 +#define SYSCON_SOC_CLK_SEL_S 14 +#define SYSCON_SOC_CLK_SEL_XTL 0 +#define SYSCON_SOC_CLK_SEL_PLL 1 +#define SYSCON_SOC_CLK_SEL_8M 2 +#define SYSCON_SOC_CLK_SEL_APLL 3 +/* SYSCON_RST_TICK_CNT : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_RST_TICK_CNT (BIT(12)) +#define SYSCON_RST_TICK_CNT_M (BIT(12)) +#define SYSCON_RST_TICK_CNT_V 0x1 +#define SYSCON_RST_TICK_CNT_S 12 +/* SYSCON_CLK_EN : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_CLK_EN (BIT(11)) +#define SYSCON_CLK_EN_M (BIT(11)) +#define SYSCON_CLK_EN_V 0x1 +#define SYSCON_CLK_EN_S 11 +/* SYSCON_CLK_320M_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_CLK_320M_EN (BIT(10)) +#define SYSCON_CLK_320M_EN_M (BIT(10)) +#define SYSCON_CLK_320M_EN_V 0x1 +#define SYSCON_CLK_320M_EN_S 10 +/* SYSCON_PRE_DIV_CNT : R/W ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define SYSCON_PRE_DIV_CNT 0x000003FF +#define SYSCON_PRE_DIV_CNT_M ((SYSCON_PRE_DIV_CNT_V)<<(SYSCON_PRE_DIV_CNT_S)) +#define SYSCON_PRE_DIV_CNT_V 0x3FF +#define SYSCON_PRE_DIV_CNT_S 0 + +#define SYSCON_TICK_CONF_REG (DR_REG_SYSCON_BASE + 0x004) +/* SYSCON_TICK_ENABLE : R/W ;bitpos:[16] ;default: 1'd1 ; */ +/*description: */ +#define SYSCON_TICK_ENABLE (BIT(16)) +#define SYSCON_TICK_ENABLE_M (BIT(16)) +#define SYSCON_TICK_ENABLE_V 0x1 +#define SYSCON_TICK_ENABLE_S 16 +/* SYSCON_CK8M_TICK_NUM : R/W ;bitpos:[15:8] ;default: 8'd7 ; */ +/*description: */ +#define SYSCON_CK8M_TICK_NUM 0x000000FF +#define SYSCON_CK8M_TICK_NUM_M ((SYSCON_CK8M_TICK_NUM_V)<<(SYSCON_CK8M_TICK_NUM_S)) +#define SYSCON_CK8M_TICK_NUM_V 0xFF +#define SYSCON_CK8M_TICK_NUM_S 8 +/* SYSCON_XTAL_TICK_NUM : R/W ;bitpos:[7:0] ;default: 8'd39 ; */ +/*description: */ +#define SYSCON_XTAL_TICK_NUM 0x000000FF +#define SYSCON_XTAL_TICK_NUM_M ((SYSCON_XTAL_TICK_NUM_V)<<(SYSCON_XTAL_TICK_NUM_S)) +#define SYSCON_XTAL_TICK_NUM_V 0xFF +#define SYSCON_XTAL_TICK_NUM_S 0 + +#define SYSCON_SARADC_CTRL_REG (DR_REG_SYSCON_BASE + 0x008) +/* SYSCON_SARADC_XPD_SAR_FORCE : R/W ;bitpos:[28:27] ;default: 2'd0 ; */ +/*description: force option to xpd sar blocks*/ +#define SYSCON_SARADC_XPD_SAR_FORCE 0x00000003 +#define SYSCON_SARADC_XPD_SAR_FORCE_M ((SYSCON_SARADC_XPD_SAR_FORCE_V)<<(SYSCON_SARADC_XPD_SAR_FORCE_S)) +#define SYSCON_SARADC_XPD_SAR_FORCE_V 0x3 +#define SYSCON_SARADC_XPD_SAR_FORCE_S 27 +/* SYSCON_SARADC_DATA_TO_I2S : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: 1: I2S input data is from SAR ADC (for DMA) 0: I2S input data + is from GPIO matrix*/ +#define SYSCON_SARADC_DATA_TO_I2S (BIT(26)) +#define SYSCON_SARADC_DATA_TO_I2S_M (BIT(26)) +#define SYSCON_SARADC_DATA_TO_I2S_V 0x1 +#define SYSCON_SARADC_DATA_TO_I2S_S 26 +/* SYSCON_SARADC_DATA_SAR_SEL : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: 1: sar_sel will be coded by the MSB of the 16-bit output data + in this case the resolution should not be larger than 11 bits.*/ +#define SYSCON_SARADC_DATA_SAR_SEL (BIT(25)) +#define SYSCON_SARADC_DATA_SAR_SEL_M (BIT(25)) +#define SYSCON_SARADC_DATA_SAR_SEL_V 0x1 +#define SYSCON_SARADC_DATA_SAR_SEL_S 25 +/* SYSCON_SARADC_SAR2_PATT_P_CLEAR : R/W ;bitpos:[24] ;default: 1'd0 ; */ +/*description: clear the pointer of pattern table for DIG ADC2 CTRL*/ +#define SYSCON_SARADC_SAR2_PATT_P_CLEAR (BIT(24)) +#define SYSCON_SARADC_SAR2_PATT_P_CLEAR_M (BIT(24)) +#define SYSCON_SARADC_SAR2_PATT_P_CLEAR_V 0x1 +#define SYSCON_SARADC_SAR2_PATT_P_CLEAR_S 24 +/* SYSCON_SARADC_SAR1_PATT_P_CLEAR : R/W ;bitpos:[23] ;default: 1'd0 ; */ +/*description: clear the pointer of pattern table for DIG ADC1 CTRL*/ +#define SYSCON_SARADC_SAR1_PATT_P_CLEAR (BIT(23)) +#define SYSCON_SARADC_SAR1_PATT_P_CLEAR_M (BIT(23)) +#define SYSCON_SARADC_SAR1_PATT_P_CLEAR_V 0x1 +#define SYSCON_SARADC_SAR1_PATT_P_CLEAR_S 23 +/* SYSCON_SARADC_SAR2_PATT_LEN : R/W ;bitpos:[22:19] ;default: 4'd15 ; */ +/*description: 0 ~ 15 means length 1 ~ 16*/ +#define SYSCON_SARADC_SAR2_PATT_LEN 0x0000000F +#define SYSCON_SARADC_SAR2_PATT_LEN_M ((SYSCON_SARADC_SAR2_PATT_LEN_V)<<(SYSCON_SARADC_SAR2_PATT_LEN_S)) +#define SYSCON_SARADC_SAR2_PATT_LEN_V 0xF +#define SYSCON_SARADC_SAR2_PATT_LEN_S 19 +/* SYSCON_SARADC_SAR1_PATT_LEN : R/W ;bitpos:[18:15] ;default: 4'd15 ; */ +/*description: 0 ~ 15 means length 1 ~ 16*/ +#define SYSCON_SARADC_SAR1_PATT_LEN 0x0000000F +#define SYSCON_SARADC_SAR1_PATT_LEN_M ((SYSCON_SARADC_SAR1_PATT_LEN_V)<<(SYSCON_SARADC_SAR1_PATT_LEN_S)) +#define SYSCON_SARADC_SAR1_PATT_LEN_V 0xF +#define SYSCON_SARADC_SAR1_PATT_LEN_S 15 +/* SYSCON_SARADC_SAR_CLK_DIV : R/W ;bitpos:[14:7] ;default: 8'd4 ; */ +/*description: SAR clock divider*/ +#define SYSCON_SARADC_SAR_CLK_DIV 0x000000FF +#define SYSCON_SARADC_SAR_CLK_DIV_M ((SYSCON_SARADC_SAR_CLK_DIV_V)<<(SYSCON_SARADC_SAR_CLK_DIV_S)) +#define SYSCON_SARADC_SAR_CLK_DIV_V 0xFF +#define SYSCON_SARADC_SAR_CLK_DIV_S 7 +/* SYSCON_SARADC_SAR_CLK_GATED : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_SARADC_SAR_CLK_GATED (BIT(6)) +#define SYSCON_SARADC_SAR_CLK_GATED_M (BIT(6)) +#define SYSCON_SARADC_SAR_CLK_GATED_V 0x1 +#define SYSCON_SARADC_SAR_CLK_GATED_S 6 +/* SYSCON_SARADC_SAR_SEL : R/W ;bitpos:[5] ;default: 1'd0 ; */ +/*description: 0: SAR1 1: SAR2 only work for single SAR mode*/ +#define SYSCON_SARADC_SAR_SEL (BIT(5)) +#define SYSCON_SARADC_SAR_SEL_M (BIT(5)) +#define SYSCON_SARADC_SAR_SEL_V 0x1 +#define SYSCON_SARADC_SAR_SEL_S 5 +/* SYSCON_SARADC_WORK_MODE : R/W ;bitpos:[4:3] ;default: 2'd0 ; */ +/*description: 0: single mode 1: double mode 2: alternate mode*/ +#define SYSCON_SARADC_WORK_MODE 0x00000003 +#define SYSCON_SARADC_WORK_MODE_M ((SYSCON_SARADC_WORK_MODE_V)<<(SYSCON_SARADC_WORK_MODE_S)) +#define SYSCON_SARADC_WORK_MODE_V 0x3 +#define SYSCON_SARADC_WORK_MODE_S 3 +/* SYSCON_SARADC_START : R/W ;bitpos:[1] ;default: 1'd0 ; */ +/*description: */ +#define SYSCON_SARADC_START (BIT(1)) +#define SYSCON_SARADC_START_M (BIT(1)) +#define SYSCON_SARADC_START_V 0x1 +#define SYSCON_SARADC_START_S 1 +/* SYSCON_SARADC_START_FORCE : R/W ;bitpos:[0] ;default: 1'd0 ; */ +/*description: */ +#define SYSCON_SARADC_START_FORCE (BIT(0)) +#define SYSCON_SARADC_START_FORCE_M (BIT(0)) +#define SYSCON_SARADC_START_FORCE_V 0x1 +#define SYSCON_SARADC_START_FORCE_S 0 + +#define SYSCON_SARADC_CTRL2_REG (DR_REG_SYSCON_BASE + 0x00C) +/* SYSCON_SARADC_TIMER_EN : R/W ;bitpos:[20] ;default: 1'd0 ; */ +/*description: to enable saradc timer trigger*/ +#define SYSCON_SARADC_TIMER_EN (BIT(20)) +#define SYSCON_SARADC_TIMER_EN_M (BIT(20)) +#define SYSCON_SARADC_TIMER_EN_V 0x1 +#define SYSCON_SARADC_TIMER_EN_S 20 +/* SYSCON_SARADC_TIMER_TARGET : R/W ;bitpos:[19:12] ;default: 8'd10 ; */ +/*description: to set saradc timer target*/ +#define SYSCON_SARADC_TIMER_TARGET 0x000000FF +#define SYSCON_SARADC_TIMER_TARGET_M ((SYSCON_SARADC_TIMER_TARGET_V)<<(SYSCON_SARADC_TIMER_TARGET_S)) +#define SYSCON_SARADC_TIMER_TARGET_V 0xFF +#define SYSCON_SARADC_TIMER_TARGET_S 12 +/* SYSCON_SARADC_TIMER_SEL : R/W ;bitpos:[11] ;default: 1'd0 ; */ +/*description: 1: select saradc timer 0: i2s_ws trigger*/ +#define SYSCON_SARADC_TIMER_SEL (BIT(11)) +#define SYSCON_SARADC_TIMER_SEL_M (BIT(11)) +#define SYSCON_SARADC_TIMER_SEL_V 0x1 +#define SYSCON_SARADC_TIMER_SEL_S 11 +/* SYSCON_SARADC_SAR2_INV : R/W ;bitpos:[10] ;default: 1'd0 ; */ +/*description: 1: data to DIG ADC2 CTRL is inverted otherwise not*/ +#define SYSCON_SARADC_SAR2_INV (BIT(10)) +#define SYSCON_SARADC_SAR2_INV_M (BIT(10)) +#define SYSCON_SARADC_SAR2_INV_V 0x1 +#define SYSCON_SARADC_SAR2_INV_S 10 +/* SYSCON_SARADC_SAR1_INV : R/W ;bitpos:[9] ;default: 1'd0 ; */ +/*description: 1: data to DIG ADC1 CTRL is inverted otherwise not*/ +#define SYSCON_SARADC_SAR1_INV (BIT(9)) +#define SYSCON_SARADC_SAR1_INV_M (BIT(9)) +#define SYSCON_SARADC_SAR1_INV_V 0x1 +#define SYSCON_SARADC_SAR1_INV_S 9 +/* SYSCON_SARADC_MAX_MEAS_NUM : R/W ;bitpos:[8:1] ;default: 8'd255 ; */ +/*description: max conversion number*/ +#define SYSCON_SARADC_MAX_MEAS_NUM 0x000000FF +#define SYSCON_SARADC_MAX_MEAS_NUM_M ((SYSCON_SARADC_MAX_MEAS_NUM_V)<<(SYSCON_SARADC_MAX_MEAS_NUM_S)) +#define SYSCON_SARADC_MAX_MEAS_NUM_V 0xFF +#define SYSCON_SARADC_MAX_MEAS_NUM_S 1 +/* SYSCON_SARADC_MEAS_NUM_LIMIT : R/W ;bitpos:[0] ;default: 1'd0 ; */ +/*description: */ +#define SYSCON_SARADC_MEAS_NUM_LIMIT (BIT(0)) +#define SYSCON_SARADC_MEAS_NUM_LIMIT_M (BIT(0)) +#define SYSCON_SARADC_MEAS_NUM_LIMIT_V 0x1 +#define SYSCON_SARADC_MEAS_NUM_LIMIT_S 0 + +#define SYSCON_SARADC_FSM_REG (DR_REG_SYSCON_BASE + 0x010) +/* SYSCON_SARADC_SAMPLE_CYCLE : R/W ;bitpos:[31:24] ;default: 8'd2 ; */ +/*description: sample cycles*/ +#define SYSCON_SARADC_SAMPLE_CYCLE 0x000000FF +#define SYSCON_SARADC_SAMPLE_CYCLE_M ((SYSCON_SARADC_SAMPLE_CYCLE_V)<<(SYSCON_SARADC_SAMPLE_CYCLE_S)) +#define SYSCON_SARADC_SAMPLE_CYCLE_V 0xFF +#define SYSCON_SARADC_SAMPLE_CYCLE_S 24 +/* SYSCON_SARADC_SAMPLE_NUM : R/W ;bitpos:[23:16] ;default: 8'd0 ; */ +/*description: sample number*/ +#define SYSCON_SARADC_SAMPLE_NUM 0x000000FF +#define SYSCON_SARADC_SAMPLE_NUM_M ((SYSCON_SARADC_SAMPLE_NUM_V)<<(SYSCON_SARADC_SAMPLE_NUM_S)) +#define SYSCON_SARADC_SAMPLE_NUM_V 0xFF +#define SYSCON_SARADC_SAMPLE_NUM_S 16 + +#define SYSCON_SARADC_FSM_WAIT_REG (DR_REG_SYSCON_BASE + 0x014) +/* SYSCON_SARADC_STANDBY_WAIT : R/W ;bitpos:[23:16] ;default: 8'd255 ; */ +/*description: */ +#define SYSCON_SARADC_STANDBY_WAIT 0x000000FF +#define SYSCON_SARADC_STANDBY_WAIT_M ((SYSCON_SARADC_STANDBY_WAIT_V)<<(SYSCON_SARADC_STANDBY_WAIT_S)) +#define SYSCON_SARADC_STANDBY_WAIT_V 0xFF +#define SYSCON_SARADC_STANDBY_WAIT_S 16 +/* SYSCON_SARADC_RSTB_WAIT : R/W ;bitpos:[15:8] ;default: 8'd8 ; */ +/*description: */ +#define SYSCON_SARADC_RSTB_WAIT 0x000000FF +#define SYSCON_SARADC_RSTB_WAIT_M ((SYSCON_SARADC_RSTB_WAIT_V)<<(SYSCON_SARADC_RSTB_WAIT_S)) +#define SYSCON_SARADC_RSTB_WAIT_V 0xFF +#define SYSCON_SARADC_RSTB_WAIT_S 8 +/* SYSCON_SARADC_XPD_WAIT : R/W ;bitpos:[7:0] ;default: 8'd8 ; */ +/*description: */ +#define SYSCON_SARADC_XPD_WAIT 0x000000FF +#define SYSCON_SARADC_XPD_WAIT_M ((SYSCON_SARADC_XPD_WAIT_V)<<(SYSCON_SARADC_XPD_WAIT_S)) +#define SYSCON_SARADC_XPD_WAIT_V 0xFF +#define SYSCON_SARADC_XPD_WAIT_S 0 + +#define SYSCON_SARADC_SAR1_STATUS_REG (DR_REG_SYSCON_BASE + 0x018) +/* SYSCON_SARADC_SAR1_STATUS : RO ;bitpos:[31:0] ;default: 32'd0 ; */ +/*description: */ +#define SYSCON_SARADC_SAR1_STATUS 0xFFFFFFFF +#define SYSCON_SARADC_SAR1_STATUS_M ((SYSCON_SARADC_SAR1_STATUS_V)<<(SYSCON_SARADC_SAR1_STATUS_S)) +#define SYSCON_SARADC_SAR1_STATUS_V 0xFFFFFFFF +#define SYSCON_SARADC_SAR1_STATUS_S 0 + +#define SYSCON_SARADC_SAR2_STATUS_REG (DR_REG_SYSCON_BASE + 0x01C) +/* SYSCON_SARADC_SAR2_STATUS : RO ;bitpos:[31:0] ;default: 32'd0 ; */ +/*description: */ +#define SYSCON_SARADC_SAR2_STATUS 0xFFFFFFFF +#define SYSCON_SARADC_SAR2_STATUS_M ((SYSCON_SARADC_SAR2_STATUS_V)<<(SYSCON_SARADC_SAR2_STATUS_S)) +#define SYSCON_SARADC_SAR2_STATUS_V 0xFFFFFFFF +#define SYSCON_SARADC_SAR2_STATUS_S 0 + +#define SYSCON_SARADC_SAR1_PATT_TAB1_REG (DR_REG_SYSCON_BASE + 0x020) +/* SYSCON_SARADC_SAR1_PATT_TAB1 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: item 0 ~ 3 for pattern table 1 (each item one byte)*/ +#define SYSCON_SARADC_SAR1_PATT_TAB1 0xFFFFFFFF +#define SYSCON_SARADC_SAR1_PATT_TAB1_M ((SYSCON_SARADC_SAR1_PATT_TAB1_V)<<(SYSCON_SARADC_SAR1_PATT_TAB1_S)) +#define SYSCON_SARADC_SAR1_PATT_TAB1_V 0xFFFFFFFF +#define SYSCON_SARADC_SAR1_PATT_TAB1_S 0 + +#define SYSCON_SARADC_SAR1_PATT_TAB2_REG (DR_REG_SYSCON_BASE + 0x024) +/* SYSCON_SARADC_SAR1_PATT_TAB2 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 4 ~ 7 for pattern table 1 (each item one byte)*/ +#define SYSCON_SARADC_SAR1_PATT_TAB2 0xFFFFFFFF +#define SYSCON_SARADC_SAR1_PATT_TAB2_M ((SYSCON_SARADC_SAR1_PATT_TAB2_V)<<(SYSCON_SARADC_SAR1_PATT_TAB2_S)) +#define SYSCON_SARADC_SAR1_PATT_TAB2_V 0xFFFFFFFF +#define SYSCON_SARADC_SAR1_PATT_TAB2_S 0 + +#define SYSCON_SARADC_SAR1_PATT_TAB3_REG (DR_REG_SYSCON_BASE + 0x028) +/* SYSCON_SARADC_SAR1_PATT_TAB3 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 8 ~ 11 for pattern table 1 (each item one byte)*/ +#define SYSCON_SARADC_SAR1_PATT_TAB3 0xFFFFFFFF +#define SYSCON_SARADC_SAR1_PATT_TAB3_M ((SYSCON_SARADC_SAR1_PATT_TAB3_V)<<(SYSCON_SARADC_SAR1_PATT_TAB3_S)) +#define SYSCON_SARADC_SAR1_PATT_TAB3_V 0xFFFFFFFF +#define SYSCON_SARADC_SAR1_PATT_TAB3_S 0 + +#define SYSCON_SARADC_SAR1_PATT_TAB4_REG (DR_REG_SYSCON_BASE + 0x02C) +/* SYSCON_SARADC_SAR1_PATT_TAB4 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 12 ~ 15 for pattern table 1 (each item one byte)*/ +#define SYSCON_SARADC_SAR1_PATT_TAB4 0xFFFFFFFF +#define SYSCON_SARADC_SAR1_PATT_TAB4_M ((SYSCON_SARADC_SAR1_PATT_TAB4_V)<<(SYSCON_SARADC_SAR1_PATT_TAB4_S)) +#define SYSCON_SARADC_SAR1_PATT_TAB4_V 0xFFFFFFFF +#define SYSCON_SARADC_SAR1_PATT_TAB4_S 0 + +#define SYSCON_SARADC_SAR2_PATT_TAB1_REG (DR_REG_SYSCON_BASE + 0x030) +/* SYSCON_SARADC_SAR2_PATT_TAB1 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: item 0 ~ 3 for pattern table 2 (each item one byte)*/ +#define SYSCON_SARADC_SAR2_PATT_TAB1 0xFFFFFFFF +#define SYSCON_SARADC_SAR2_PATT_TAB1_M ((SYSCON_SARADC_SAR2_PATT_TAB1_V)<<(SYSCON_SARADC_SAR2_PATT_TAB1_S)) +#define SYSCON_SARADC_SAR2_PATT_TAB1_V 0xFFFFFFFF +#define SYSCON_SARADC_SAR2_PATT_TAB1_S 0 + +#define SYSCON_SARADC_SAR2_PATT_TAB2_REG (DR_REG_SYSCON_BASE + 0x034) +/* SYSCON_SARADC_SAR2_PATT_TAB2 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 4 ~ 7 for pattern table 2 (each item one byte)*/ +#define SYSCON_SARADC_SAR2_PATT_TAB2 0xFFFFFFFF +#define SYSCON_SARADC_SAR2_PATT_TAB2_M ((SYSCON_SARADC_SAR2_PATT_TAB2_V)<<(SYSCON_SARADC_SAR2_PATT_TAB2_S)) +#define SYSCON_SARADC_SAR2_PATT_TAB2_V 0xFFFFFFFF +#define SYSCON_SARADC_SAR2_PATT_TAB2_S 0 + +#define SYSCON_SARADC_SAR2_PATT_TAB3_REG (DR_REG_SYSCON_BASE + 0x038) +/* SYSCON_SARADC_SAR2_PATT_TAB3 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 8 ~ 11 for pattern table 2 (each item one byte)*/ +#define SYSCON_SARADC_SAR2_PATT_TAB3 0xFFFFFFFF +#define SYSCON_SARADC_SAR2_PATT_TAB3_M ((SYSCON_SARADC_SAR2_PATT_TAB3_V)<<(SYSCON_SARADC_SAR2_PATT_TAB3_S)) +#define SYSCON_SARADC_SAR2_PATT_TAB3_V 0xFFFFFFFF +#define SYSCON_SARADC_SAR2_PATT_TAB3_S 0 + +#define SYSCON_SARADC_SAR2_PATT_TAB4_REG (DR_REG_SYSCON_BASE + 0x03C) +/* SYSCON_SARADC_SAR2_PATT_TAB4 : R/W ;bitpos:[31:0] ;default: 32'hf0f0f0f ; */ +/*description: Item 12 ~ 15 for pattern table 2 (each item one byte)*/ +#define SYSCON_SARADC_SAR2_PATT_TAB4 0xFFFFFFFF +#define SYSCON_SARADC_SAR2_PATT_TAB4_M ((SYSCON_SARADC_SAR2_PATT_TAB4_V)<<(SYSCON_SARADC_SAR2_PATT_TAB4_S)) +#define SYSCON_SARADC_SAR2_PATT_TAB4_V 0xFFFFFFFF +#define SYSCON_SARADC_SAR2_PATT_TAB4_S 0 + +#define SYSCON_ADC_ARB_CTRL_REG (DR_REG_SYSCON_BASE + 0x040) +/* SYSCON_ADC_ARB_FIX_PRIORITY : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: adc2 arbiter uses fixed priority*/ +#define SYSCON_ADC_ARB_FIX_PRIORITY (BIT(12)) +#define SYSCON_ADC_ARB_FIX_PRIORITY_M (BIT(12)) +#define SYSCON_ADC_ARB_FIX_PRIORITY_V 0x1 +#define SYSCON_ADC_ARB_FIX_PRIORITY_S 12 +/* SYSCON_ADC_ARB_WIFI_PRIORITY : R/W ;bitpos:[11:10] ;default: 2'd2 ; */ +/*description: Set adc2 arbiter wifi priority*/ +#define SYSCON_ADC_ARB_WIFI_PRIORITY 0x00000003 +#define SYSCON_ADC_ARB_WIFI_PRIORITY_M ((SYSCON_ADC_ARB_WIFI_PRIORITY_V)<<(SYSCON_ADC_ARB_WIFI_PRIORITY_S)) +#define SYSCON_ADC_ARB_WIFI_PRIORITY_V 0x3 +#define SYSCON_ADC_ARB_WIFI_PRIORITY_S 10 +/* SYSCON_ADC_ARB_RTC_PRIORITY : R/W ;bitpos:[9:8] ;default: 2'd1 ; */ +/*description: Set adc2 arbiter rtc priority*/ +#define SYSCON_ADC_ARB_RTC_PRIORITY 0x00000003 +#define SYSCON_ADC_ARB_RTC_PRIORITY_M ((SYSCON_ADC_ARB_RTC_PRIORITY_V)<<(SYSCON_ADC_ARB_RTC_PRIORITY_S)) +#define SYSCON_ADC_ARB_RTC_PRIORITY_V 0x3 +#define SYSCON_ADC_ARB_RTC_PRIORITY_S 8 +/* SYSCON_ADC_ARB_APB_PRIORITY : R/W ;bitpos:[7:6] ;default: 2'd0 ; */ +/*description: Set adc2 arbiter apb priority*/ +#define SYSCON_ADC_ARB_APB_PRIORITY 0x00000003 +#define SYSCON_ADC_ARB_APB_PRIORITY_M ((SYSCON_ADC_ARB_APB_PRIORITY_V)<<(SYSCON_ADC_ARB_APB_PRIORITY_S)) +#define SYSCON_ADC_ARB_APB_PRIORITY_V 0x3 +#define SYSCON_ADC_ARB_APB_PRIORITY_S 6 +/* SYSCON_ADC_ARB_GRANT_FORCE : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: adc2 arbiter force grant*/ +#define SYSCON_ADC_ARB_GRANT_FORCE (BIT(5)) +#define SYSCON_ADC_ARB_GRANT_FORCE_M (BIT(5)) +#define SYSCON_ADC_ARB_GRANT_FORCE_V 0x1 +#define SYSCON_ADC_ARB_GRANT_FORCE_S 5 +/* SYSCON_ADC_ARB_WIFI_FORCE : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: adc2 arbiter force to enable wifi controller*/ +#define SYSCON_ADC_ARB_WIFI_FORCE (BIT(4)) +#define SYSCON_ADC_ARB_WIFI_FORCE_M (BIT(4)) +#define SYSCON_ADC_ARB_WIFI_FORCE_V 0x1 +#define SYSCON_ADC_ARB_WIFI_FORCE_S 4 +/* SYSCON_ADC_ARB_RTC_FORCE : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: adc2 arbiter force to enable rtc controller*/ +#define SYSCON_ADC_ARB_RTC_FORCE (BIT(3)) +#define SYSCON_ADC_ARB_RTC_FORCE_M (BIT(3)) +#define SYSCON_ADC_ARB_RTC_FORCE_V 0x1 +#define SYSCON_ADC_ARB_RTC_FORCE_S 3 +/* SYSCON_ADC_ARB_APB_FORCE : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: adc2 arbiter force to enableapb controller*/ +#define SYSCON_ADC_ARB_APB_FORCE (BIT(2)) +#define SYSCON_ADC_ARB_APB_FORCE_M (BIT(2)) +#define SYSCON_ADC_ARB_APB_FORCE_V 0x1 +#define SYSCON_ADC_ARB_APB_FORCE_S 2 + +#define SYSCON_CLK_OUT_EN_REG (DR_REG_SYSCON_BASE + 0x044) +/* SYSCON_CLK_XTAL_OEN : R/W ;bitpos:[10] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK_XTAL_OEN (BIT(10)) +#define SYSCON_CLK_XTAL_OEN_M (BIT(10)) +#define SYSCON_CLK_XTAL_OEN_V 0x1 +#define SYSCON_CLK_XTAL_OEN_S 10 +/* SYSCON_CLK40X_BB_OEN : R/W ;bitpos:[9] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK40X_BB_OEN (BIT(9)) +#define SYSCON_CLK40X_BB_OEN_M (BIT(9)) +#define SYSCON_CLK40X_BB_OEN_V 0x1 +#define SYSCON_CLK40X_BB_OEN_S 9 +/* SYSCON_CLK_DAC_CPU_OEN : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK_DAC_CPU_OEN (BIT(8)) +#define SYSCON_CLK_DAC_CPU_OEN_M (BIT(8)) +#define SYSCON_CLK_DAC_CPU_OEN_V 0x1 +#define SYSCON_CLK_DAC_CPU_OEN_S 8 +/* SYSCON_CLK_ADC_INF_OEN : R/W ;bitpos:[7] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK_ADC_INF_OEN (BIT(7)) +#define SYSCON_CLK_ADC_INF_OEN_M (BIT(7)) +#define SYSCON_CLK_ADC_INF_OEN_V 0x1 +#define SYSCON_CLK_ADC_INF_OEN_S 7 +/* SYSCON_CLK_320M_OEN : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK_320M_OEN (BIT(6)) +#define SYSCON_CLK_320M_OEN_M (BIT(6)) +#define SYSCON_CLK_320M_OEN_V 0x1 +#define SYSCON_CLK_320M_OEN_S 6 +/* SYSCON_CLK160_OEN : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK160_OEN (BIT(5)) +#define SYSCON_CLK160_OEN_M (BIT(5)) +#define SYSCON_CLK160_OEN_V 0x1 +#define SYSCON_CLK160_OEN_S 5 +/* SYSCON_CLK80_OEN : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK80_OEN (BIT(4)) +#define SYSCON_CLK80_OEN_M (BIT(4)) +#define SYSCON_CLK80_OEN_V 0x1 +#define SYSCON_CLK80_OEN_S 4 +/* SYSCON_CLK_BB_OEN : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK_BB_OEN (BIT(3)) +#define SYSCON_CLK_BB_OEN_M (BIT(3)) +#define SYSCON_CLK_BB_OEN_V 0x1 +#define SYSCON_CLK_BB_OEN_S 3 +/* SYSCON_CLK44_OEN : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK44_OEN (BIT(2)) +#define SYSCON_CLK44_OEN_M (BIT(2)) +#define SYSCON_CLK44_OEN_V 0x1 +#define SYSCON_CLK44_OEN_S 2 +/* SYSCON_CLK22_OEN : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK22_OEN (BIT(1)) +#define SYSCON_CLK22_OEN_M (BIT(1)) +#define SYSCON_CLK22_OEN_V 0x1 +#define SYSCON_CLK22_OEN_S 1 +/* SYSCON_CLK20_OEN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_CLK20_OEN (BIT(0)) +#define SYSCON_CLK20_OEN_M (BIT(0)) +#define SYSCON_CLK20_OEN_V 0x1 +#define SYSCON_CLK20_OEN_S 0 + +#define SYSCON_HOST_INF_SEL_REG (DR_REG_SYSCON_BASE + 0x048) +/* SYSCON_SPI_PRIOR : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_SPI_PRIOR (BIT(13)) +#define SYSCON_SPI_PRIOR_M (BIT(13)) +#define SYSCON_SPI_PRIOR_V 0x1 +#define SYSCON_SPI_PRIOR_S 13 +/* SYSCON_SPI1_HOLD : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_SPI1_HOLD (BIT(9)) +#define SYSCON_SPI1_HOLD_M (BIT(9)) +#define SYSCON_SPI1_HOLD_V 0x1 +#define SYSCON_SPI1_HOLD_S 9 +/* SYSCON_SPI0_HOLD : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_SPI0_HOLD (BIT(8)) +#define SYSCON_SPI0_HOLD_M (BIT(8)) +#define SYSCON_SPI0_HOLD_V 0x1 +#define SYSCON_SPI0_HOLD_S 8 +/* SYSCON_PERI_IO_SWAP : R/W ;bitpos:[7:0] ;default: 8'h0 ; */ +/*description: */ +#define SYSCON_PERI_IO_SWAP 0x000000FF +#define SYSCON_PERI_IO_SWAP_M ((SYSCON_PERI_IO_SWAP_V)<<(SYSCON_PERI_IO_SWAP_S)) +#define SYSCON_PERI_IO_SWAP_V 0xFF +#define SYSCON_PERI_IO_SWAP_S 0 + +#define SYSCON_EXT_MEM_PMS_LOCK_REG (DR_REG_SYSCON_BASE + 0x04C) +/* SYSCON_EXT_MEM_PMS_LOCK : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_EXT_MEM_PMS_LOCK (BIT(0)) +#define SYSCON_EXT_MEM_PMS_LOCK_M (BIT(0)) +#define SYSCON_EXT_MEM_PMS_LOCK_V 0x1 +#define SYSCON_EXT_MEM_PMS_LOCK_S 0 + +#define SYSCON_FLASH_ACE0_ATTR_REG (DR_REG_SYSCON_BASE + 0x050) +/* SYSCON_FLASH_ACE0_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define SYSCON_FLASH_ACE0_ATTR 0x00000007 +#define SYSCON_FLASH_ACE0_ATTR_M ((SYSCON_FLASH_ACE0_ATTR_V)<<(SYSCON_FLASH_ACE0_ATTR_S)) +#define SYSCON_FLASH_ACE0_ATTR_V 0x7 +#define SYSCON_FLASH_ACE0_ATTR_S 0 + +#define SYSCON_FLASH_ACE1_ATTR_REG (DR_REG_SYSCON_BASE + 0x054) +/* SYSCON_FLASH_ACE1_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define SYSCON_FLASH_ACE1_ATTR 0x00000007 +#define SYSCON_FLASH_ACE1_ATTR_M ((SYSCON_FLASH_ACE1_ATTR_V)<<(SYSCON_FLASH_ACE1_ATTR_S)) +#define SYSCON_FLASH_ACE1_ATTR_V 0x7 +#define SYSCON_FLASH_ACE1_ATTR_S 0 + +#define SYSCON_FLASH_ACE2_ATTR_REG (DR_REG_SYSCON_BASE + 0x058) +/* SYSCON_FLASH_ACE2_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define SYSCON_FLASH_ACE2_ATTR 0x00000007 +#define SYSCON_FLASH_ACE2_ATTR_M ((SYSCON_FLASH_ACE2_ATTR_V)<<(SYSCON_FLASH_ACE2_ATTR_S)) +#define SYSCON_FLASH_ACE2_ATTR_V 0x7 +#define SYSCON_FLASH_ACE2_ATTR_S 0 + +#define SYSCON_FLASH_ACE3_ATTR_REG (DR_REG_SYSCON_BASE + 0x05C) +/* SYSCON_FLASH_ACE3_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define SYSCON_FLASH_ACE3_ATTR 0x00000007 +#define SYSCON_FLASH_ACE3_ATTR_M ((SYSCON_FLASH_ACE3_ATTR_V)<<(SYSCON_FLASH_ACE3_ATTR_S)) +#define SYSCON_FLASH_ACE3_ATTR_V 0x7 +#define SYSCON_FLASH_ACE3_ATTR_S 0 + +#define SYSCON_FLASH_ACE0_ADDR_REG (DR_REG_SYSCON_BASE + 0x060) +/* SYSCON_FLASH_ACE0_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SYSCON_FLASH_ACE0_ADDR_S 0xFFFFFFFF +#define SYSCON_FLASH_ACE0_ADDR_S_M ((SYSCON_FLASH_ACE0_ADDR_S_V)<<(SYSCON_FLASH_ACE0_ADDR_S_S)) +#define SYSCON_FLASH_ACE0_ADDR_S_V 0xFFFFFFFF +#define SYSCON_FLASH_ACE0_ADDR_S_S 0 + +#define SYSCON_FLASH_ACE1_ADDR_REG (DR_REG_SYSCON_BASE + 0x064) +/* SYSCON_FLASH_ACE1_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h10000000 ; */ +/*description: */ +#define SYSCON_FLASH_ACE1_ADDR_S 0xFFFFFFFF +#define SYSCON_FLASH_ACE1_ADDR_S_M ((SYSCON_FLASH_ACE1_ADDR_S_V)<<(SYSCON_FLASH_ACE1_ADDR_S_S)) +#define SYSCON_FLASH_ACE1_ADDR_S_V 0xFFFFFFFF +#define SYSCON_FLASH_ACE1_ADDR_S_S 0 + +#define SYSCON_FLASH_ACE2_ADDR_REG (DR_REG_SYSCON_BASE + 0x068) +/* SYSCON_FLASH_ACE2_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h20000000 ; */ +/*description: */ +#define SYSCON_FLASH_ACE2_ADDR_S 0xFFFFFFFF +#define SYSCON_FLASH_ACE2_ADDR_S_M ((SYSCON_FLASH_ACE2_ADDR_S_V)<<(SYSCON_FLASH_ACE2_ADDR_S_S)) +#define SYSCON_FLASH_ACE2_ADDR_S_V 0xFFFFFFFF +#define SYSCON_FLASH_ACE2_ADDR_S_S 0 + +#define SYSCON_FLASH_ACE3_ADDR_REG (DR_REG_SYSCON_BASE + 0x06C) +/* SYSCON_FLASH_ACE3_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h30000000 ; */ +/*description: */ +#define SYSCON_FLASH_ACE3_ADDR_S 0xFFFFFFFF +#define SYSCON_FLASH_ACE3_ADDR_S_M ((SYSCON_FLASH_ACE3_ADDR_S_V)<<(SYSCON_FLASH_ACE3_ADDR_S_S)) +#define SYSCON_FLASH_ACE3_ADDR_S_V 0xFFFFFFFF +#define SYSCON_FLASH_ACE3_ADDR_S_S 0 + +#define SYSCON_FLASH_ACE0_SIZE_REG (DR_REG_SYSCON_BASE + 0x070) +/* SYSCON_FLASH_ACE0_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define SYSCON_FLASH_ACE0_SIZE 0x0000FFFF +#define SYSCON_FLASH_ACE0_SIZE_M ((SYSCON_FLASH_ACE0_SIZE_V)<<(SYSCON_FLASH_ACE0_SIZE_S)) +#define SYSCON_FLASH_ACE0_SIZE_V 0xFFFF +#define SYSCON_FLASH_ACE0_SIZE_S 0 + +#define SYSCON_FLASH_ACE1_SIZE_REG (DR_REG_SYSCON_BASE + 0x074) +/* SYSCON_FLASH_ACE1_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define SYSCON_FLASH_ACE1_SIZE 0x0000FFFF +#define SYSCON_FLASH_ACE1_SIZE_M ((SYSCON_FLASH_ACE1_SIZE_V)<<(SYSCON_FLASH_ACE1_SIZE_S)) +#define SYSCON_FLASH_ACE1_SIZE_V 0xFFFF +#define SYSCON_FLASH_ACE1_SIZE_S 0 + +#define SYSCON_FLASH_ACE2_SIZE_REG (DR_REG_SYSCON_BASE + 0x078) +/* SYSCON_FLASH_ACE2_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define SYSCON_FLASH_ACE2_SIZE 0x0000FFFF +#define SYSCON_FLASH_ACE2_SIZE_M ((SYSCON_FLASH_ACE2_SIZE_V)<<(SYSCON_FLASH_ACE2_SIZE_S)) +#define SYSCON_FLASH_ACE2_SIZE_V 0xFFFF +#define SYSCON_FLASH_ACE2_SIZE_S 0 + +#define SYSCON_FLASH_ACE3_SIZE_REG (DR_REG_SYSCON_BASE + 0x07C) +/* SYSCON_FLASH_ACE3_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define SYSCON_FLASH_ACE3_SIZE 0x0000FFFF +#define SYSCON_FLASH_ACE3_SIZE_M ((SYSCON_FLASH_ACE3_SIZE_V)<<(SYSCON_FLASH_ACE3_SIZE_S)) +#define SYSCON_FLASH_ACE3_SIZE_V 0xFFFF +#define SYSCON_FLASH_ACE3_SIZE_S 0 + +#define SYSCON_SRAM_ACE0_ATTR_REG (DR_REG_SYSCON_BASE + 0x080) +/* SYSCON_SRAM_ACE0_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define SYSCON_SRAM_ACE0_ATTR 0x00000007 +#define SYSCON_SRAM_ACE0_ATTR_M ((SYSCON_SRAM_ACE0_ATTR_V)<<(SYSCON_SRAM_ACE0_ATTR_S)) +#define SYSCON_SRAM_ACE0_ATTR_V 0x7 +#define SYSCON_SRAM_ACE0_ATTR_S 0 + +#define SYSCON_SRAM_ACE1_ATTR_REG (DR_REG_SYSCON_BASE + 0x084) +/* SYSCON_SRAM_ACE1_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define SYSCON_SRAM_ACE1_ATTR 0x00000007 +#define SYSCON_SRAM_ACE1_ATTR_M ((SYSCON_SRAM_ACE1_ATTR_V)<<(SYSCON_SRAM_ACE1_ATTR_S)) +#define SYSCON_SRAM_ACE1_ATTR_V 0x7 +#define SYSCON_SRAM_ACE1_ATTR_S 0 + +#define SYSCON_SRAM_ACE2_ATTR_REG (DR_REG_SYSCON_BASE + 0x088) +/* SYSCON_SRAM_ACE2_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define SYSCON_SRAM_ACE2_ATTR 0x00000007 +#define SYSCON_SRAM_ACE2_ATTR_M ((SYSCON_SRAM_ACE2_ATTR_V)<<(SYSCON_SRAM_ACE2_ATTR_S)) +#define SYSCON_SRAM_ACE2_ATTR_V 0x7 +#define SYSCON_SRAM_ACE2_ATTR_S 0 + +#define SYSCON_SRAM_ACE3_ATTR_REG (DR_REG_SYSCON_BASE + 0x08C) +/* SYSCON_SRAM_ACE3_ATTR : R/W ;bitpos:[2:0] ;default: 3'h7 ; */ +/*description: */ +#define SYSCON_SRAM_ACE3_ATTR 0x00000007 +#define SYSCON_SRAM_ACE3_ATTR_M ((SYSCON_SRAM_ACE3_ATTR_V)<<(SYSCON_SRAM_ACE3_ATTR_S)) +#define SYSCON_SRAM_ACE3_ATTR_V 0x7 +#define SYSCON_SRAM_ACE3_ATTR_S 0 + +#define SYSCON_SRAM_ACE0_ADDR_REG (DR_REG_SYSCON_BASE + 0x090) +/* SYSCON_SRAM_ACE0_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SYSCON_SRAM_ACE0_ADDR_S 0xFFFFFFFF +#define SYSCON_SRAM_ACE0_ADDR_S_M ((SYSCON_SRAM_ACE0_ADDR_S_V)<<(SYSCON_SRAM_ACE0_ADDR_S_S)) +#define SYSCON_SRAM_ACE0_ADDR_S_V 0xFFFFFFFF +#define SYSCON_SRAM_ACE0_ADDR_S_S 0 + +#define SYSCON_SRAM_ACE1_ADDR_REG (DR_REG_SYSCON_BASE + 0x094) +/* SYSCON_SRAM_ACE1_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h10000000 ; */ +/*description: */ +#define SYSCON_SRAM_ACE1_ADDR_S 0xFFFFFFFF +#define SYSCON_SRAM_ACE1_ADDR_S_M ((SYSCON_SRAM_ACE1_ADDR_S_V)<<(SYSCON_SRAM_ACE1_ADDR_S_S)) +#define SYSCON_SRAM_ACE1_ADDR_S_V 0xFFFFFFFF +#define SYSCON_SRAM_ACE1_ADDR_S_S 0 + +#define SYSCON_SRAM_ACE2_ADDR_REG (DR_REG_SYSCON_BASE + 0x098) +/* SYSCON_SRAM_ACE2_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h20000000 ; */ +/*description: */ +#define SYSCON_SRAM_ACE2_ADDR_S 0xFFFFFFFF +#define SYSCON_SRAM_ACE2_ADDR_S_M ((SYSCON_SRAM_ACE2_ADDR_S_V)<<(SYSCON_SRAM_ACE2_ADDR_S_S)) +#define SYSCON_SRAM_ACE2_ADDR_S_V 0xFFFFFFFF +#define SYSCON_SRAM_ACE2_ADDR_S_S 0 + +#define SYSCON_SRAM_ACE3_ADDR_REG (DR_REG_SYSCON_BASE + 0x09C) +/* SYSCON_SRAM_ACE3_ADDR_S : R/W ;bitpos:[31:0] ;default: 32'h30000000 ; */ +/*description: */ +#define SYSCON_SRAM_ACE3_ADDR_S 0xFFFFFFFF +#define SYSCON_SRAM_ACE3_ADDR_S_M ((SYSCON_SRAM_ACE3_ADDR_S_V)<<(SYSCON_SRAM_ACE3_ADDR_S_S)) +#define SYSCON_SRAM_ACE3_ADDR_S_V 0xFFFFFFFF +#define SYSCON_SRAM_ACE3_ADDR_S_S 0 + +#define SYSCON_SRAM_ACE0_SIZE_REG (DR_REG_SYSCON_BASE + 0x0A0) +/* SYSCON_SRAM_ACE0_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define SYSCON_SRAM_ACE0_SIZE 0x0000FFFF +#define SYSCON_SRAM_ACE0_SIZE_M ((SYSCON_SRAM_ACE0_SIZE_V)<<(SYSCON_SRAM_ACE0_SIZE_S)) +#define SYSCON_SRAM_ACE0_SIZE_V 0xFFFF +#define SYSCON_SRAM_ACE0_SIZE_S 0 + +#define SYSCON_SRAM_ACE1_SIZE_REG (DR_REG_SYSCON_BASE + 0x0A4) +/* SYSCON_SRAM_ACE1_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define SYSCON_SRAM_ACE1_SIZE 0x0000FFFF +#define SYSCON_SRAM_ACE1_SIZE_M ((SYSCON_SRAM_ACE1_SIZE_V)<<(SYSCON_SRAM_ACE1_SIZE_S)) +#define SYSCON_SRAM_ACE1_SIZE_V 0xFFFF +#define SYSCON_SRAM_ACE1_SIZE_S 0 + +#define SYSCON_SRAM_ACE2_SIZE_REG (DR_REG_SYSCON_BASE + 0x0A8) +/* SYSCON_SRAM_ACE2_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define SYSCON_SRAM_ACE2_SIZE 0x0000FFFF +#define SYSCON_SRAM_ACE2_SIZE_M ((SYSCON_SRAM_ACE2_SIZE_V)<<(SYSCON_SRAM_ACE2_SIZE_S)) +#define SYSCON_SRAM_ACE2_SIZE_V 0xFFFF +#define SYSCON_SRAM_ACE2_SIZE_S 0 + +#define SYSCON_SRAM_ACE3_SIZE_REG (DR_REG_SYSCON_BASE + 0x0AC) +/* SYSCON_SRAM_ACE3_SIZE : R/W ;bitpos:[15:0] ;default: 16'h1000 ; */ +/*description: */ +#define SYSCON_SRAM_ACE3_SIZE 0x0000FFFF +#define SYSCON_SRAM_ACE3_SIZE_M ((SYSCON_SRAM_ACE3_SIZE_V)<<(SYSCON_SRAM_ACE3_SIZE_S)) +#define SYSCON_SRAM_ACE3_SIZE_V 0xFFFF +#define SYSCON_SRAM_ACE3_SIZE_S 0 + +#define SYSCON_SPI0_PMS_CTRL_REG (DR_REG_SYSCON_BASE + 0x0B0) +/* SYSCON_SPI0_REJECT_CDE : RO ;bitpos:[6:2] ;default: 5'h0 ; */ +/*description: */ +#define SYSCON_SPI0_REJECT_CDE 0x0000001F +#define SYSCON_SPI0_REJECT_CDE_M ((SYSCON_SPI0_REJECT_CDE_V)<<(SYSCON_SPI0_REJECT_CDE_S)) +#define SYSCON_SPI0_REJECT_CDE_V 0x1F +#define SYSCON_SPI0_REJECT_CDE_S 2 +/* SYSCON_SPI0_REJECT_CLR : WOD ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_SPI0_REJECT_CLR (BIT(1)) +#define SYSCON_SPI0_REJECT_CLR_M (BIT(1)) +#define SYSCON_SPI0_REJECT_CLR_V 0x1 +#define SYSCON_SPI0_REJECT_CLR_S 1 +/* SYSCON_SPI0_REJECT_INT : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_SPI0_REJECT_INT (BIT(0)) +#define SYSCON_SPI0_REJECT_INT_M (BIT(0)) +#define SYSCON_SPI0_REJECT_INT_V 0x1 +#define SYSCON_SPI0_REJECT_INT_S 0 + +#define SYSCON_SPI0_REJECT_ADDR_REG (DR_REG_SYSCON_BASE + 0x0B4) +/* SYSCON_SPI0_REJECT_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SYSCON_SPI0_REJECT_ADDR 0xFFFFFFFF +#define SYSCON_SPI0_REJECT_ADDR_M ((SYSCON_SPI0_REJECT_ADDR_V)<<(SYSCON_SPI0_REJECT_ADDR_S)) +#define SYSCON_SPI0_REJECT_ADDR_V 0xFFFFFFFF +#define SYSCON_SPI0_REJECT_ADDR_S 0 + +#define SYSCON_SPI1_PMS_CTRL_REG (DR_REG_SYSCON_BASE + 0x0B8) +/* SYSCON_SPI1_REJECT_CDE : RO ;bitpos:[6:2] ;default: 5'h0 ; */ +/*description: */ +#define SYSCON_SPI1_REJECT_CDE 0x0000001F +#define SYSCON_SPI1_REJECT_CDE_M ((SYSCON_SPI1_REJECT_CDE_V)<<(SYSCON_SPI1_REJECT_CDE_S)) +#define SYSCON_SPI1_REJECT_CDE_V 0x1F +#define SYSCON_SPI1_REJECT_CDE_S 2 +/* SYSCON_SPI1_REJECT_CLR : WOD ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_SPI1_REJECT_CLR (BIT(1)) +#define SYSCON_SPI1_REJECT_CLR_M (BIT(1)) +#define SYSCON_SPI1_REJECT_CLR_V 0x1 +#define SYSCON_SPI1_REJECT_CLR_S 1 +/* SYSCON_SPI1_REJECT_INT : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_SPI1_REJECT_INT (BIT(0)) +#define SYSCON_SPI1_REJECT_INT_M (BIT(0)) +#define SYSCON_SPI1_REJECT_INT_V 0x1 +#define SYSCON_SPI1_REJECT_INT_S 0 + +#define SYSCON_SPI1_REJECT_ADDR_REG (DR_REG_SYSCON_BASE + 0x0BC) +/* SYSCON_SPI1_REJECT_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SYSCON_SPI1_REJECT_ADDR 0xFFFFFFFF +#define SYSCON_SPI1_REJECT_ADDR_M ((SYSCON_SPI1_REJECT_ADDR_V)<<(SYSCON_SPI1_REJECT_ADDR_S)) +#define SYSCON_SPI1_REJECT_ADDR_V 0xFFFFFFFF +#define SYSCON_SPI1_REJECT_ADDR_S 0 + +#define SYSCON_SDIO_CTRL_REG (DR_REG_SYSCON_BASE + 0x0C0) +/* SYSCON_SDIO_WIN_ACCESS_EN : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define SYSCON_SDIO_WIN_ACCESS_EN (BIT(0)) +#define SYSCON_SDIO_WIN_ACCESS_EN_M (BIT(0)) +#define SYSCON_SDIO_WIN_ACCESS_EN_V 0x1 +#define SYSCON_SDIO_WIN_ACCESS_EN_S 0 + +#define SYSCON_REDCY_SIG0_REG (DR_REG_SYSCON_BASE + 0x0C4) +/* SYSCON_REDCY_ANDOR : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define SYSCON_REDCY_ANDOR (BIT(31)) +#define SYSCON_REDCY_ANDOR_M (BIT(31)) +#define SYSCON_REDCY_ANDOR_V 0x1 +#define SYSCON_REDCY_ANDOR_S 31 +/* SYSCON_REDCY_SIG0 : R/W ;bitpos:[30:0] ;default: 31'h0 ; */ +/*description: */ +#define SYSCON_REDCY_SIG0 0x7FFFFFFF +#define SYSCON_REDCY_SIG0_M ((SYSCON_REDCY_SIG0_V)<<(SYSCON_REDCY_SIG0_S)) +#define SYSCON_REDCY_SIG0_V 0x7FFFFFFF +#define SYSCON_REDCY_SIG0_S 0 + +#define SYSCON_REDCY_SIG1_REG (DR_REG_SYSCON_BASE + 0x0C8) +/* SYSCON_REDCY_NANDOR : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define SYSCON_REDCY_NANDOR (BIT(31)) +#define SYSCON_REDCY_NANDOR_M (BIT(31)) +#define SYSCON_REDCY_NANDOR_V 0x1 +#define SYSCON_REDCY_NANDOR_S 31 +/* SYSCON_REDCY_SIG1 : R/W ;bitpos:[30:0] ;default: 31'h0 ; */ +/*description: */ +#define SYSCON_REDCY_SIG1 0x7FFFFFFF +#define SYSCON_REDCY_SIG1_M ((SYSCON_REDCY_SIG1_V)<<(SYSCON_REDCY_SIG1_S)) +#define SYSCON_REDCY_SIG1_V 0x7FFFFFFF +#define SYSCON_REDCY_SIG1_S 0 + +#define SYSCON_WIFI_BB_CFG_REG (DR_REG_SYSCON_BASE + 0x0CC) +/* SYSCON_WIFI_BB_CFG : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SYSCON_WIFI_BB_CFG 0xFFFFFFFF +#define SYSCON_WIFI_BB_CFG_M ((SYSCON_WIFI_BB_CFG_V)<<(SYSCON_WIFI_BB_CFG_S)) +#define SYSCON_WIFI_BB_CFG_V 0xFFFFFFFF +#define SYSCON_WIFI_BB_CFG_S 0 + +#define SYSCON_WIFI_BB_CFG_2_REG (DR_REG_SYSCON_BASE + 0x0D0) +/* SYSCON_WIFI_BB_CFG_2 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SYSCON_WIFI_BB_CFG_2 0xFFFFFFFF +#define SYSCON_WIFI_BB_CFG_2_M ((SYSCON_WIFI_BB_CFG_2_V)<<(SYSCON_WIFI_BB_CFG_2_S)) +#define SYSCON_WIFI_BB_CFG_2_V 0xFFFFFFFF +#define SYSCON_WIFI_BB_CFG_2_S 0 + +#define SYSCON_WIFI_CLK_EN_REG (DR_REG_SYSCON_BASE + 0x0D4) +/* SYSCON_WIFI_CLK_EN : R/W ;bitpos:[31:0] ;default: 32'hfffce030 ; */ +/*description: */ +#define SYSCON_WIFI_CLK_EN 0xFFFFFFFF +#define SYSCON_WIFI_CLK_EN_M ((SYSCON_WIFI_CLK_EN_V)<<(SYSCON_WIFI_CLK_EN_S)) +#define SYSCON_WIFI_CLK_EN_V 0xFFFFFFFF +#define SYSCON_WIFI_CLK_EN_S 0 + +#define SYSCON_WIFI_RST_EN_REG (DR_REG_SYSCON_BASE + 0x0D8) +/* SYSCON_WIFI_RST : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define SYSCON_WIFI_RST 0xFFFFFFFF +#define SYSCON_WIFI_RST_M ((SYSCON_WIFI_RST_V)<<(SYSCON_WIFI_RST_S)) +#define SYSCON_WIFI_RST_V 0xFFFFFFFF +#define SYSCON_WIFI_RST_S 0 + +#define DPORT_WIFI_CLK_EN_REG SYSCON_WIFI_CLK_EN_REG +/* DPORT_WIFI_CLK_EN : R/W ;bitpos:[31:0] ;default: 32'hfffce030 ; */ +/*description: */ +#define DPORT_WIFI_CLK_EN 0xFFFFFFFF +#define DPORT_WIFI_CLK_EN_M ((DPORT_WIFI_CLK_EN_V)<<(DPORT_WIFI_CLK_EN_S)) +#define DPORT_WIFI_CLK_EN_V 0xFFFFFFFF +#define DPORT_WIFI_CLK_EN_S 0 + +/* Mask for all Wifi clock bits - 0, 1, 2, 3, 6, 7, 8, 9, 10, 15, 19, 20, 21 + Bit15 not included here because of the bit now can't be cleared */ +#define DPORT_WIFI_CLK_WIFI_EN 0x00008040 +#define DPORT_WIFI_CLK_WIFI_EN_M ((DPORT_WIFI_CLK_WIFI_EN_V)<<(DPORT_WIFI_CLK_WIFI_EN_S)) +#define DPORT_WIFI_CLK_WIFI_EN_V 0x0804 +#define DPORT_WIFI_CLK_WIFI_EN_S 0 +/* Mask for all Bluetooth clock bits - 11, 16, 17 */ +#define DPORT_WIFI_CLK_BT_EN 0x61 +#define DPORT_WIFI_CLK_BT_EN_M ((DPORT_WIFI_CLK_BT_EN_V)<<(DPORT_WIFI_CLK_BT_EN_S)) +#define DPORT_WIFI_CLK_BT_EN_V 0x61 +#define DPORT_WIFI_CLK_BT_EN_S 11 +/* Mask for clock bits used by both WIFI and Bluetooth, bit 0, 3, 6, 7, 8, 9 */ +#define DPORT_WIFI_CLK_WIFI_BT_COMMON_M 0x0038078f + +/* Digital team to check */ +//bluetooth baseband bit11 +#define DPORT_BT_BASEBAND_EN BIT(11) +//bluetooth LC bit16 and bit17 +#define DPORT_BT_LC_EN (BIT(16)|BIT(17)) + +/* Remaining single bit clock masks */ +#define DPORT_WIFI_CLK_SDIOSLAVE_EN BIT(4) +#define DPORT_WIFI_CLK_UNUSED_BIT5 BIT(5) +#define DPORT_WIFI_CLK_UNUSED_BIT12 BIT(12) +#define DPORT_WIFI_CLK_SDIO_HOST_EN BIT(13) +#define DPORT_WIFI_CLK_EMAC_EN BIT(14) +#define DPORT_WIFI_CLK_RNG_EN BIT(15) + +#define DPORT_CORE_RST_EN_REG DPORT_WIFI_RST_EN_REG +#define DPORT_WIFI_RST_EN_REG SYSCON_WIFI_RST_EN_REG +/* DPORT_WIFI_RST : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define DPORT_WIFI_RST 0xFFFFFFFF +#define DPORT_WIFI_RST_M ((DPORT_WIFI_RST_V)<<(DPORT_WIFI_RST_S)) +#define DPORT_WIFI_RST_V 0xFFFFFFFF +#define DPORT_WIFI_RST_S 0 +#define DPORT_RW_BTLP_RST (BIT(10)) +#define DPORT_RW_BTMAC_RST (BIT(9)) +#define DPORT_MACPWR_RST (BIT(8)) +#define DPORT_EMAC_RST (BIT(7)) +#define DPORT_SDIO_HOST_RST (BIT(6)) +#define DPORT_SDIO_RST (BIT(5)) +#define DPORT_BTMAC_RST (BIT(4)) +#define DPORT_BT_RST (BIT(3)) +#define DPORT_MAC_RST (BIT(2)) +#define DPORT_FE_RST (BIT(1)) +#define DPORT_BB_RST (BIT(0)) + +#define SYSCON_FRONT_END_MEM_PD_REG (DR_REG_SYSCON_BASE + 0x0DC) +/* SYSCON_DC_MEM_FORCE_PD : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_DC_MEM_FORCE_PD (BIT(5)) +#define SYSCON_DC_MEM_FORCE_PD_M (BIT(5)) +#define SYSCON_DC_MEM_FORCE_PD_V 0x1 +#define SYSCON_DC_MEM_FORCE_PD_S 5 +/* SYSCON_DC_MEM_FORCE_PU : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_DC_MEM_FORCE_PU (BIT(4)) +#define SYSCON_DC_MEM_FORCE_PU_M (BIT(4)) +#define SYSCON_DC_MEM_FORCE_PU_V 0x1 +#define SYSCON_DC_MEM_FORCE_PU_S 4 +/* SYSCON_PBUS_MEM_FORCE_PD : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_PBUS_MEM_FORCE_PD (BIT(3)) +#define SYSCON_PBUS_MEM_FORCE_PD_M (BIT(3)) +#define SYSCON_PBUS_MEM_FORCE_PD_V 0x1 +#define SYSCON_PBUS_MEM_FORCE_PD_S 3 +/* SYSCON_PBUS_MEM_FORCE_PU : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_PBUS_MEM_FORCE_PU (BIT(2)) +#define SYSCON_PBUS_MEM_FORCE_PU_M (BIT(2)) +#define SYSCON_PBUS_MEM_FORCE_PU_V 0x1 +#define SYSCON_PBUS_MEM_FORCE_PU_S 2 +/* SYSCON_AGC_MEM_FORCE_PD : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define SYSCON_AGC_MEM_FORCE_PD (BIT(1)) +#define SYSCON_AGC_MEM_FORCE_PD_M (BIT(1)) +#define SYSCON_AGC_MEM_FORCE_PD_V 0x1 +#define SYSCON_AGC_MEM_FORCE_PD_S 1 +/* SYSCON_AGC_MEM_FORCE_PU : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define SYSCON_AGC_MEM_FORCE_PU (BIT(0)) +#define SYSCON_AGC_MEM_FORCE_PU_M (BIT(0)) +#define SYSCON_AGC_MEM_FORCE_PU_V 0x1 +#define SYSCON_AGC_MEM_FORCE_PU_S 0 + +#define SYSCON_DATE_REG (DR_REG_SYSCON_BASE + 0x3FC) +/* SYSCON_DATE : R/W ;bitpos:[31:0] ;default: 32'h18102500 ; */ +/*description: */ +#define SYSCON_DATE 0xFFFFFFFF +#define SYSCON_DATE_M ((SYSCON_DATE_V)<<(SYSCON_DATE_S)) +#define SYSCON_DATE_V 0xFFFFFFFF +#define SYSCON_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_SYSCON_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/syscon_struct.h b/components/soc/esp32s2beta/include/soc/syscon_struct.h new file mode 100644 index 0000000000..8278a82008 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/syscon_struct.h @@ -0,0 +1,530 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef _SOC_SYSCON_STRUCT_H_ +#define _SOC_SYSCON_STRUCT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t pre_div: 10; + uint32_t clk_320m_en: 1; + uint32_t clk_en: 1; + uint32_t rst_tick: 1; + uint32_t reserved13: 1; + uint32_t soc_clk_sel: 2; + uint32_t reserved16: 16; + }; + uint32_t val; + } clk_conf; + union { + struct { + uint32_t xtal_tick: 8; + uint32_t ck8m_tick: 8; + uint32_t tick_enable: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } tick_conf; + union { + struct { + uint32_t start_force: 1; + uint32_t start: 1; + uint32_t reserved2: 1; + uint32_t work_mode: 2; /*0: single mode 1: double mode 2: alternate mode*/ + uint32_t sar_sel: 1; /*0: SAR1 1: SAR2 only work for single SAR mode*/ + uint32_t sar_clk_gated: 1; + uint32_t sar_clk_div: 8; /*SAR clock divider*/ + uint32_t sar1_patt_len: 4; /*0 ~ 15 means length 1 ~ 16*/ + uint32_t sar2_patt_len: 4; /*0 ~ 15 means length 1 ~ 16*/ + uint32_t sar1_patt_p_clear: 1; /*clear the pointer of pattern table for DIG ADC1 CTRL*/ + uint32_t sar2_patt_p_clear: 1; /*clear the pointer of pattern table for DIG ADC2 CTRL*/ + uint32_t data_sar_sel: 1; /*1: sar_sel will be coded by the MSB of the 16-bit output data in this case the resolution should not be larger than 11 bits.*/ + uint32_t data_to_i2s: 1; /*1: I2S input data is from SAR ADC (for DMA) 0: I2S input data is from GPIO matrix*/ + uint32_t xpd_sar_force: 2; /*force option to xpd sar blocks*/ + uint32_t reserved29: 3; + }; + uint32_t val; + } saradc_ctrl; + union { + struct { + uint32_t meas_num_limit: 1; + uint32_t max_meas_num: 8; /*max conversion number*/ + uint32_t sar1_inv: 1; /*1: data to DIG ADC1 CTRL is inverted otherwise not*/ + uint32_t sar2_inv: 1; /*1: data to DIG ADC2 CTRL is inverted otherwise not*/ + uint32_t timer_sel: 1; /*1: select saradc timer 0: i2s_ws trigger*/ + uint32_t timer_target: 8; /*to set saradc timer target*/ + uint32_t timer_en: 1; /*to enable saradc timer trigger*/ + uint32_t reserved21: 11; + }; + uint32_t val; + } saradc_ctrl2; + union { + struct { + uint32_t reserved0: 16; + uint32_t sample_num: 8; /*sample number*/ + uint32_t sample_cycle: 8; /*sample cycles*/ + }; + uint32_t val; + } saradc_fsm; + union { + struct { + uint32_t xpd_wait: 8; + uint32_t rstb_wait: 8; + uint32_t standby_wait: 8; + uint32_t reserved24: 8; + }; + uint32_t val; + } saradc_fsm_wait; + uint32_t saradc_sar1_status; /**/ + uint32_t saradc_sar2_status; /**/ + uint32_t saradc_sar1_patt_tab[4]; /*item 0 ~ 15 for pattern table 1 (each item one byte)*/ + uint32_t saradc_sar2_patt_tab[4]; /*item 0 ~ 15 for pattern table 2 (each item one byte)*/ + union { + struct { + uint32_t reserved0: 2; + uint32_t adc_arb_apb_force: 1; /*adc2 arbiter force to enableapb controller*/ + uint32_t adc_arb_rtc_force: 1; /*adc2 arbiter force to enable rtc controller*/ + uint32_t adc_arb_wifi_force: 1; /*adc2 arbiter force to enable wifi controller*/ + uint32_t adc_arb_grant_force: 1; /*adc2 arbiter force grant*/ + uint32_t adc_arb_apb_priority: 2; /*Set adc2 arbiterapb priority*/ + uint32_t adc_arb_rtc_priority: 2; /*Set adc2 arbiter rtc priority*/ + uint32_t adc_arb_wifi_priority: 2; /*Set adc2 arbiter wifi priority*/ + uint32_t adc_arb_fix_priority: 1; /*adc2 arbiter uses fixed priority*/ + uint32_t reserved13: 19; + }; + uint32_t val; + } adc_arb_ctrl; + union { + struct { + uint32_t clk20_oen: 1; + uint32_t clk22_oen: 1; + uint32_t clk44_oen: 1; + uint32_t clk_bb_oen: 1; + uint32_t clk80_oen: 1; + uint32_t clk160_oen: 1; + uint32_t clk_320m_oen: 1; + uint32_t clk_adc_inf_oen: 1; + uint32_t clk_dac_cpu_oen: 1; + uint32_t clk40x_bb_oen: 1; + uint32_t clk_xtal_oen: 1; + uint32_t reserved11: 21; + }; + uint32_t val; + } clk_out_en; + union { + struct { + uint32_t peri_io_swap: 8; + uint32_t spi0_hold: 1; + uint32_t spi1_hold: 1; + uint32_t reserved10: 3; + uint32_t spi_prior: 1; + uint32_t reserved14: 18; + }; + uint32_t val; + } host_inf_sel; + union { + struct { + uint32_t ext_mem_pms_lock: 1; + uint32_t reserved1: 31; + }; + uint32_t val; + } ext_mem_pms_lock; + union { + struct { + uint32_t flash_ace0_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } flash_ace0_attr; + union { + struct { + uint32_t flash_ace1_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } flash_ace1_attr; + union { + struct { + uint32_t flash_ace2_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } flash_ace2_attr; + union { + struct { + uint32_t flash_ace3_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } flash_ace3_attr; + uint32_t flash_ace0_addr; /**/ + uint32_t flash_ace1_addr; /**/ + uint32_t flash_ace2_addr; /**/ + uint32_t flash_ace3_addr; /**/ + union { + struct { + uint32_t flash_ace0_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } flash_ace0_size; + union { + struct { + uint32_t flash_ace1_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } flash_ace1_size; + union { + struct { + uint32_t flash_ace2_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } flash_ace2_size; + union { + struct { + uint32_t flash_ace3_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } flash_ace3_size; + union { + struct { + uint32_t sram_ace0_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } sram_ace0_attr; + union { + struct { + uint32_t sram_ace1_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } sram_ace1_attr; + union { + struct { + uint32_t sram_ace2_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } sram_ace2_attr; + union { + struct { + uint32_t sram_ace3_attr: 3; + uint32_t reserved3: 29; + }; + uint32_t val; + } sram_ace3_attr; + uint32_t sram_ace0_addr; /**/ + uint32_t sram_ace1_addr; /**/ + uint32_t sram_ace2_addr; /**/ + uint32_t sram_ace3_addr; /**/ + union { + struct { + uint32_t sram_ace0_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } sram_ace0_size; + union { + struct { + uint32_t sram_ace1_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } sram_ace1_size; + union { + struct { + uint32_t sram_ace2_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } sram_ace2_size; + union { + struct { + uint32_t sram_ace3_size:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } sram_ace3_size; + union { + struct { + uint32_t spi0_reject_int: 1; + uint32_t spi0_reject_clr: 1; + uint32_t spi0_reject_cde: 5; + uint32_t reserved7: 25; + }; + uint32_t val; + } spi0_pms_ctrl; + uint32_t spi0_reject_addr; /**/ + union { + struct { + uint32_t spi1_reject_int: 1; + uint32_t spi1_reject_clr: 1; + uint32_t spi1_reject_cde: 5; + uint32_t reserved7: 25; + }; + uint32_t val; + } spi1_pms_ctrl; + uint32_t spi1_reject_addr; /**/ + union { + struct { + uint32_t sdio_win_access_en: 1; + uint32_t reserved1: 31; + }; + uint32_t val; + } sdio_ctrl; + union { + struct { + uint32_t redcy_sig0: 31; + uint32_t redcy_andor: 1; + }; + uint32_t val; + } redcy_sig0; + union { + struct { + uint32_t redcy_sig1: 31; + uint32_t redcy_nandor: 1; + }; + uint32_t val; + } redcy_sig1; + uint32_t wifi_bb_cfg; /**/ + uint32_t wifi_bb_cfg_2; /**/ + uint32_t wifi_clk_en; /**/ + uint32_t wifi_rst_en; /**/ + union { + struct { + uint32_t agc_mem_force_pu: 1; + uint32_t agc_mem_force_pd: 1; + uint32_t pbus_mem_force_pu: 1; + uint32_t pbus_mem_force_pd: 1; + uint32_t dc_mem_force_pu: 1; + uint32_t dc_mem_force_pd: 1; + uint32_t reserved6: 26; + }; + uint32_t val; + } front_end_mem_pd; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t reserved_fc; + uint32_t reserved_100; + uint32_t reserved_104; + uint32_t reserved_108; + uint32_t reserved_10c; + uint32_t reserved_110; + uint32_t reserved_114; + uint32_t reserved_118; + uint32_t reserved_11c; + uint32_t reserved_120; + uint32_t reserved_124; + uint32_t reserved_128; + uint32_t reserved_12c; + uint32_t reserved_130; + uint32_t reserved_134; + uint32_t reserved_138; + uint32_t reserved_13c; + uint32_t reserved_140; + uint32_t reserved_144; + uint32_t reserved_148; + uint32_t reserved_14c; + uint32_t reserved_150; + uint32_t reserved_154; + uint32_t reserved_158; + uint32_t reserved_15c; + uint32_t reserved_160; + uint32_t reserved_164; + uint32_t reserved_168; + uint32_t reserved_16c; + uint32_t reserved_170; + uint32_t reserved_174; + uint32_t reserved_178; + uint32_t reserved_17c; + uint32_t reserved_180; + uint32_t reserved_184; + uint32_t reserved_188; + uint32_t reserved_18c; + uint32_t reserved_190; + uint32_t reserved_194; + uint32_t reserved_198; + uint32_t reserved_19c; + uint32_t reserved_1a0; + uint32_t reserved_1a4; + uint32_t reserved_1a8; + uint32_t reserved_1ac; + uint32_t reserved_1b0; + uint32_t reserved_1b4; + uint32_t reserved_1b8; + uint32_t reserved_1bc; + uint32_t reserved_1c0; + uint32_t reserved_1c4; + uint32_t reserved_1c8; + uint32_t reserved_1cc; + uint32_t reserved_1d0; + uint32_t reserved_1d4; + uint32_t reserved_1d8; + uint32_t reserved_1dc; + uint32_t reserved_1e0; + uint32_t reserved_1e4; + uint32_t reserved_1e8; + uint32_t reserved_1ec; + uint32_t reserved_1f0; + uint32_t reserved_1f4; + uint32_t reserved_1f8; + uint32_t reserved_1fc; + uint32_t reserved_200; + uint32_t reserved_204; + uint32_t reserved_208; + uint32_t reserved_20c; + uint32_t reserved_210; + uint32_t reserved_214; + uint32_t reserved_218; + uint32_t reserved_21c; + uint32_t reserved_220; + uint32_t reserved_224; + uint32_t reserved_228; + uint32_t reserved_22c; + uint32_t reserved_230; + uint32_t reserved_234; + uint32_t reserved_238; + uint32_t reserved_23c; + uint32_t reserved_240; + uint32_t reserved_244; + uint32_t reserved_248; + uint32_t reserved_24c; + uint32_t reserved_250; + uint32_t reserved_254; + uint32_t reserved_258; + uint32_t reserved_25c; + uint32_t reserved_260; + uint32_t reserved_264; + uint32_t reserved_268; + uint32_t reserved_26c; + uint32_t reserved_270; + uint32_t reserved_274; + uint32_t reserved_278; + uint32_t reserved_27c; + uint32_t reserved_280; + uint32_t reserved_284; + uint32_t reserved_288; + uint32_t reserved_28c; + uint32_t reserved_290; + uint32_t reserved_294; + uint32_t reserved_298; + uint32_t reserved_29c; + uint32_t reserved_2a0; + uint32_t reserved_2a4; + uint32_t reserved_2a8; + uint32_t reserved_2ac; + uint32_t reserved_2b0; + uint32_t reserved_2b4; + uint32_t reserved_2b8; + uint32_t reserved_2bc; + uint32_t reserved_2c0; + uint32_t reserved_2c4; + uint32_t reserved_2c8; + uint32_t reserved_2cc; + uint32_t reserved_2d0; + uint32_t reserved_2d4; + uint32_t reserved_2d8; + uint32_t reserved_2dc; + uint32_t reserved_2e0; + uint32_t reserved_2e4; + uint32_t reserved_2e8; + uint32_t reserved_2ec; + uint32_t reserved_2f0; + uint32_t reserved_2f4; + uint32_t reserved_2f8; + uint32_t reserved_2fc; + uint32_t reserved_300; + uint32_t reserved_304; + uint32_t reserved_308; + uint32_t reserved_30c; + uint32_t reserved_310; + uint32_t reserved_314; + uint32_t reserved_318; + uint32_t reserved_31c; + uint32_t reserved_320; + uint32_t reserved_324; + uint32_t reserved_328; + uint32_t reserved_32c; + uint32_t reserved_330; + uint32_t reserved_334; + uint32_t reserved_338; + uint32_t reserved_33c; + uint32_t reserved_340; + uint32_t reserved_344; + uint32_t reserved_348; + uint32_t reserved_34c; + uint32_t reserved_350; + uint32_t reserved_354; + uint32_t reserved_358; + uint32_t reserved_35c; + uint32_t reserved_360; + uint32_t reserved_364; + uint32_t reserved_368; + uint32_t reserved_36c; + uint32_t reserved_370; + uint32_t reserved_374; + uint32_t reserved_378; + uint32_t reserved_37c; + uint32_t reserved_380; + uint32_t reserved_384; + uint32_t reserved_388; + uint32_t reserved_38c; + uint32_t reserved_390; + uint32_t reserved_394; + uint32_t reserved_398; + uint32_t reserved_39c; + uint32_t reserved_3a0; + uint32_t reserved_3a4; + uint32_t reserved_3a8; + uint32_t reserved_3ac; + uint32_t reserved_3b0; + uint32_t reserved_3b4; + uint32_t reserved_3b8; + uint32_t reserved_3bc; + uint32_t reserved_3c0; + uint32_t reserved_3c4; + uint32_t reserved_3c8; + uint32_t reserved_3cc; + uint32_t reserved_3d0; + uint32_t reserved_3d4; + uint32_t reserved_3d8; + uint32_t reserved_3dc; + uint32_t reserved_3e0; + uint32_t reserved_3e4; + uint32_t reserved_3e8; + uint32_t reserved_3ec; + uint32_t reserved_3f0; + uint32_t reserved_3f4; + uint32_t reserved_3f8; + uint32_t date; /**/ +} syscon_dev_t; + +#ifdef __cplusplus +} +#endif +extern syscon_dev_t SYSCON; +#endif /* _SOC_SYSCON_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/system_reg.h b/components/soc/esp32s2beta/include/soc/system_reg.h new file mode 100644 index 0000000000..2fc5512e07 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/system_reg.h @@ -0,0 +1,891 @@ +// Copyright 2017-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_SYSTEM_REG_H_ +#define _SOC_SYSTEM_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define DPORT_ROM_CTRL_0_REG (DR_REG_SYSTEM_BASE + 0x000) +/* DPORT_ROM_FO : R/W ;bitpos:[1:0] ;default: ~2'b0 ; */ +/*description: */ +#define DPORT_ROM_FO 0x00000003 +#define DPORT_ROM_FO_M ((DPORT_ROM_FO_V)<<(DPORT_ROM_FO_S)) +#define DPORT_ROM_FO_V 0x3 +#define DPORT_ROM_FO_S 0 + +#define DPORT_ROM_CTRL_1_REG (DR_REG_SYSTEM_BASE + 0x004) +/* DPORT_ROM_PD : R/W ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: */ +#define DPORT_ROM_PD 0x00000003 +#define DPORT_ROM_PD_M ((DPORT_ROM_PD_V)<<(DPORT_ROM_PD_S)) +#define DPORT_ROM_PD_V 0x3 +#define DPORT_ROM_PD_S 0 + +#define DPORT_SRAM_CTRL_0_REG (DR_REG_SYSTEM_BASE + 0x008) +/* DPORT_SRAM_FO : R/W ;bitpos:[21:0] ;default: ~22'b0 ; */ +/*description: */ +#define DPORT_SRAM_FO 0x003FFFFF +#define DPORT_SRAM_FO_M ((DPORT_SRAM_FO_V)<<(DPORT_SRAM_FO_S)) +#define DPORT_SRAM_FO_V 0x3FFFFF +#define DPORT_SRAM_FO_S 0 + +#define DPORT_SRAM_CTRL_1_REG (DR_REG_SYSTEM_BASE + 0x00C) +/* DPORT_SRAM_PD : R/W ;bitpos:[21:0] ;default: 22'b0 ; */ +/*description: */ +#define DPORT_SRAM_PD 0x003FFFFF +#define DPORT_SRAM_PD_M ((DPORT_SRAM_PD_V)<<(DPORT_SRAM_PD_S)) +#define DPORT_SRAM_PD_V 0x3FFFFF +#define DPORT_SRAM_PD_S 0 + +#define DPORT_PERI_CLK_EN_REG DPORT_CPU_PERI_CLK_EN_REG +#define DPORT_CPU_PERI_CLK_EN_REG (DR_REG_SYSTEM_BASE + 0x010) +/* DPORT_CLK_EN_DEDICATED_GPIO : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CLK_EN_DEDICATED_GPIO (BIT(7)) +#define DPORT_CLK_EN_DEDICATED_GPIO_M (BIT(7)) +#define DPORT_CLK_EN_DEDICATED_GPIO_V 0x1 +#define DPORT_CLK_EN_DEDICATED_GPIO_S 7 +/* DPORT_CLK_EN_ASSIST_DEBUG : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CLK_EN_ASSIST_DEBUG (BIT(6)) +#define DPORT_CLK_EN_ASSIST_DEBUG_M (BIT(6)) +#define DPORT_CLK_EN_ASSIST_DEBUG_V 0x1 +#define DPORT_CLK_EN_ASSIST_DEBUG_S 6 +/* DPORT_CLK_EN_DIGITAL_SIGNATURE : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CLK_EN_DIGITAL_SIGNATURE (BIT(5)) +#define DPORT_CLK_EN_DIGITAL_SIGNATURE_M (BIT(5)) +#define DPORT_CLK_EN_DIGITAL_SIGNATURE_V 0x1 +#define DPORT_CLK_EN_DIGITAL_SIGNATURE_S 5 +/* DPORT_CLK_EN_HMAC : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CLK_EN_HMAC (BIT(4)) +#define DPORT_CLK_EN_HMAC_M (BIT(4)) +#define DPORT_CLK_EN_HMAC_V 0x1 +#define DPORT_CLK_EN_HMAC_S 4 +/* DPORT_CLK_EN_SECURE_BOOT : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CLK_EN_SECURE_BOOT (BIT(3)) +#define DPORT_CLK_EN_SECURE_BOOT_M (BIT(3)) +#define DPORT_CLK_EN_SECURE_BOOT_V 0x1 +#define DPORT_CLK_EN_SECURE_BOOT_S 3 +/* DPORT_CLK_EN_RSA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CLK_EN_RSA (BIT(2)) +#define DPORT_CLK_EN_RSA_M (BIT(2)) +#define DPORT_CLK_EN_RSA_V 0x1 +#define DPORT_CLK_EN_RSA_S 2 +/* DPORT_CLK_EN_SHA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CLK_EN_SHA (BIT(1)) +#define DPORT_CLK_EN_SHA_M (BIT(1)) +#define DPORT_CLK_EN_SHA_V 0x1 +#define DPORT_CLK_EN_SHA_S 1 +/* DPORT_CLK_EN_AES : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CLK_EN_AES (BIT(0)) +#define DPORT_CLK_EN_AES_M (BIT(0)) +#define DPORT_CLK_EN_AES_V 0x1 +#define DPORT_CLK_EN_AES_S 0 + +#define DPORT_PERI_EN_AES DPORT_CLK_EN_AES +#define DPORT_PERI_EN_SHA DPORT_CLK_EN_SHA +#define DPORT_PERI_EN_RSA DPORT_CLK_EN_RSA +/* NB: Secure boot reset will hold SHA & AES in reset */ +#define DPORT_PERI_EN_SECUREBOOT DPORT_CLK_EN_SECURE_BOOT +/* NB: Digital signature reset will hold AES & RSA in reset */ +#define DPORT_PERI_EN_DIGITAL_SIGNATURE DPORT_CLK_EN_DIGITAL_SIGNATURE +#define DPORT_PERI_EN_ASSIST_DEBUG DPORT_CLK_EN_ASSIST_DEBUG + +#define DPORT_PERI_RST_EN_REG DPORT_CPU_PERI_RST_EN_REG +#define DPORT_CPU_PERI_RST_EN_REG (DR_REG_SYSTEM_BASE + 0x014) +/* DPORT_RST_EN_DEDICATED_GPIO : R/W ;bitpos:[7] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_RST_EN_DEDICATED_GPIO (BIT(7)) +#define DPORT_RST_EN_DEDICATED_GPIO_M (BIT(7)) +#define DPORT_RST_EN_DEDICATED_GPIO_V 0x1 +#define DPORT_RST_EN_DEDICATED_GPIO_S 7 +/* DPORT_RST_EN_ASSIST_DEBUG : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_RST_EN_ASSIST_DEBUG (BIT(6)) +#define DPORT_RST_EN_ASSIST_DEBUG_M (BIT(6)) +#define DPORT_RST_EN_ASSIST_DEBUG_V 0x1 +#define DPORT_RST_EN_ASSIST_DEBUG_S 6 +/* DPORT_RST_EN_DIGITAL_SIGNATURE : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_RST_EN_DIGITAL_SIGNATURE (BIT(5)) +#define DPORT_RST_EN_DIGITAL_SIGNATURE_M (BIT(5)) +#define DPORT_RST_EN_DIGITAL_SIGNATURE_V 0x1 +#define DPORT_RST_EN_DIGITAL_SIGNATURE_S 5 +/* DPORT_RST_EN_HMAC : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_RST_EN_HMAC (BIT(4)) +#define DPORT_RST_EN_HMAC_M (BIT(4)) +#define DPORT_RST_EN_HMAC_V 0x1 +#define DPORT_RST_EN_HMAC_S 4 +/* DPORT_RST_EN_SECURE_BOOT : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_RST_EN_SECURE_BOOT (BIT(3)) +#define DPORT_RST_EN_SECURE_BOOT_M (BIT(3)) +#define DPORT_RST_EN_SECURE_BOOT_V 0x1 +#define DPORT_RST_EN_SECURE_BOOT_S 3 +/* DPORT_RST_EN_RSA : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_RST_EN_RSA (BIT(2)) +#define DPORT_RST_EN_RSA_M (BIT(2)) +#define DPORT_RST_EN_RSA_V 0x1 +#define DPORT_RST_EN_RSA_S 2 +/* DPORT_RST_EN_SHA : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_RST_EN_SHA (BIT(1)) +#define DPORT_RST_EN_SHA_M (BIT(1)) +#define DPORT_RST_EN_SHA_V 0x1 +#define DPORT_RST_EN_SHA_S 1 +/* DPORT_RST_EN_AES : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_RST_EN_AES (BIT(0)) +#define DPORT_RST_EN_AES_M (BIT(0)) +#define DPORT_RST_EN_AES_V 0x1 +#define DPORT_RST_EN_AES_S 0 + +#define DPORT_CPU_PER_CONF_REG (DR_REG_SYSTEM_BASE + 0x018) +/* DPORT_CPU_WAIT_MODE_FORCE_ON : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_CPU_WAIT_MODE_FORCE_ON (BIT(3)) +#define DPORT_CPU_WAIT_MODE_FORCE_ON_M (BIT(3)) +#define DPORT_CPU_WAIT_MODE_FORCE_ON_V 0x1 +#define DPORT_CPU_WAIT_MODE_FORCE_ON_S 3 +/* DPORT_PLL_FREQ_SEL : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PLL_FREQ_SEL (BIT(2)) +#define DPORT_PLL_FREQ_SEL_M (BIT(2)) +#define DPORT_PLL_FREQ_SEL_V 0x1 +#define DPORT_PLL_FREQ_SEL_S 2 +/* DPORT_CPUPERIOD_SEL : R/W ;bitpos:[1:0] ;default: 2'b0 ; */ +/*description: */ +#define DPORT_CPUPERIOD_SEL 0x00000003 +#define DPORT_CPUPERIOD_SEL_M ((DPORT_CPUPERIOD_SEL_V)<<(DPORT_CPUPERIOD_SEL_S)) +#define DPORT_CPUPERIOD_SEL_V 0x3 +#define DPORT_CPUPERIOD_SEL_S 0 + +#define DPORT_JTAG_CTRL_0_REG (DR_REG_SYSTEM_BASE + 0x01C) +/* DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_0 : WOR ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_0 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_0_M ((DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_0_V)<<(DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_0_S)) +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_0_V 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_0_S 0 + +#define DPORT_JTAG_CTRL_1_REG (DR_REG_SYSTEM_BASE + 0x020) +/* DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_1 : WOR ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_1 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_1_M ((DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_1_V)<<(DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_1_S)) +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_1_V 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_1_S 0 + +#define DPORT_JTAG_CTRL_2_REG (DR_REG_SYSTEM_BASE + 0x024) +/* DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_2 : WOR ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_2 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_2_M ((DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_2_V)<<(DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_2_S)) +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_2_V 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_2_S 0 + +#define DPORT_JTAG_CTRL_3_REG (DR_REG_SYSTEM_BASE + 0x028) +/* DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_3 : WOR ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_3 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_3_M ((DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_3_V)<<(DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_3_S)) +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_3_V 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_3_S 0 + +#define DPORT_JTAG_CTRL_4_REG (DR_REG_SYSTEM_BASE + 0x02C) +/* DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_4 : WOR ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_4 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_4_M ((DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_4_V)<<(DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_4_S)) +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_4_V 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_4_S 0 + +#define DPORT_JTAG_CTRL_5_REG (DR_REG_SYSTEM_BASE + 0x030) +/* DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_5 : WOR ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_5 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_5_M ((DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_5_V)<<(DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_5_S)) +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_5_V 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_5_S 0 + +#define DPORT_JTAG_CTRL_6_REG (DR_REG_SYSTEM_BASE + 0x034) +/* DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_6 : WOR ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_6 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_6_M ((DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_6_V)<<(DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_6_S)) +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_6_V 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_6_S 0 + +#define DPORT_JTAG_CTRL_7_REG (DR_REG_SYSTEM_BASE + 0x038) +/* DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_7 : WOR ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_7 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_7_M ((DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_7_V)<<(DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_7_S)) +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_7_V 0xFFFFFFFF +#define DPORT_CANCEL_EFUSE_DISABLE_JTAG_TEMPORARY_7_S 0 + +#define DPORT_MEM_PD_MASK_REG (DR_REG_SYSTEM_BASE + 0x03C) +/* DPORT_LSLP_MEM_PD_MASK : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_LSLP_MEM_PD_MASK (BIT(0)) +#define DPORT_LSLP_MEM_PD_MASK_M (BIT(0)) +#define DPORT_LSLP_MEM_PD_MASK_V 0x1 +#define DPORT_LSLP_MEM_PD_MASK_S 0 + +#define DPORT_PERIP_CLK_EN_REG DPORT_PERIP_CLK_EN0_REG +#define DPORT_PERIP_CLK_EN0_REG (DR_REG_SYSTEM_BASE + 0x040) +/* DPORT_SPI4_CLK_EN : R/W ;bitpos:[31] ;default: 1'h1 ; */ +/*description: */ +#define DPORT_SPI4_CLK_EN (BIT(31)) +#define DPORT_SPI4_CLK_EN_M (BIT(31)) +#define DPORT_SPI4_CLK_EN_V 0x1 +#define DPORT_SPI4_CLK_EN_S 31 +/* DPORT_ADC2_ARB_CLK_EN : R/W ;bitpos:[30] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_ADC2_ARB_CLK_EN (BIT(30)) +#define DPORT_ADC2_ARB_CLK_EN_M (BIT(30)) +#define DPORT_ADC2_ARB_CLK_EN_V 0x1 +#define DPORT_ADC2_ARB_CLK_EN_S 30 +/* DPORT_SYSTIMER_CLK_EN : R/W ;bitpos:[29] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_SYSTIMER_CLK_EN (BIT(29)) +#define DPORT_SYSTIMER_CLK_EN_M (BIT(29)) +#define DPORT_SYSTIMER_CLK_EN_V 0x1 +#define DPORT_SYSTIMER_CLK_EN_S 29 +/* DPORT_APB_SARADC_CLK_EN : R/W ;bitpos:[28] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_APB_SARADC_CLK_EN (BIT(28)) +#define DPORT_APB_SARADC_CLK_EN_M (BIT(28)) +#define DPORT_APB_SARADC_CLK_EN_V 0x1 +#define DPORT_APB_SARADC_CLK_EN_S 28 +/* DPORT_SPI3_DMA_CLK_EN : R/W ;bitpos:[27] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_SPI3_DMA_CLK_EN (BIT(27)) +#define DPORT_SPI3_DMA_CLK_EN_M (BIT(27)) +#define DPORT_SPI3_DMA_CLK_EN_V 0x1 +#define DPORT_SPI3_DMA_CLK_EN_S 27 +/* DPORT_PWM3_CLK_EN : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PWM3_CLK_EN (BIT(26)) +#define DPORT_PWM3_CLK_EN_M (BIT(26)) +#define DPORT_PWM3_CLK_EN_V 0x1 +#define DPORT_PWM3_CLK_EN_S 26 +/* DPORT_PWM2_CLK_EN : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PWM2_CLK_EN (BIT(25)) +#define DPORT_PWM2_CLK_EN_M (BIT(25)) +#define DPORT_PWM2_CLK_EN_V 0x1 +#define DPORT_PWM2_CLK_EN_S 25 +/* DPORT_UART_MEM_CLK_EN : R/W ;bitpos:[24] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_UART_MEM_CLK_EN (BIT(24)) +#define DPORT_UART_MEM_CLK_EN_M (BIT(24)) +#define DPORT_UART_MEM_CLK_EN_V 0x1 +#define DPORT_UART_MEM_CLK_EN_S 24 +/* DPORT_USB_CLK_EN : R/W ;bitpos:[23] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_USB_CLK_EN (BIT(23)) +#define DPORT_USB_CLK_EN_M (BIT(23)) +#define DPORT_USB_CLK_EN_V 0x1 +#define DPORT_USB_CLK_EN_S 23 +/* DPORT_SPI2_DMA_CLK_EN : R/W ;bitpos:[22] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_SPI2_DMA_CLK_EN (BIT(22)) +#define DPORT_SPI2_DMA_CLK_EN_M (BIT(22)) +#define DPORT_SPI2_DMA_CLK_EN_V 0x1 +#define DPORT_SPI2_DMA_CLK_EN_S 22 +/* DPORT_I2S1_CLK_EN : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_I2S1_CLK_EN (BIT(21)) +#define DPORT_I2S1_CLK_EN_M (BIT(21)) +#define DPORT_I2S1_CLK_EN_V 0x1 +#define DPORT_I2S1_CLK_EN_S 21 +/* DPORT_PWM1_CLK_EN : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PWM1_CLK_EN (BIT(20)) +#define DPORT_PWM1_CLK_EN_M (BIT(20)) +#define DPORT_PWM1_CLK_EN_V 0x1 +#define DPORT_PWM1_CLK_EN_S 20 +/* DPORT_CAN_CLK_EN : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CAN_CLK_EN (BIT(19)) +#define DPORT_CAN_CLK_EN_M (BIT(19)) +#define DPORT_CAN_CLK_EN_V 0x1 +#define DPORT_CAN_CLK_EN_S 19 +/* DPORT_I2C_EXT1_CLK_EN : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_I2C_EXT1_CLK_EN (BIT(18)) +#define DPORT_I2C_EXT1_CLK_EN_M (BIT(18)) +#define DPORT_I2C_EXT1_CLK_EN_V 0x1 +#define DPORT_I2C_EXT1_CLK_EN_S 18 +/* DPORT_PWM0_CLK_EN : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PWM0_CLK_EN (BIT(17)) +#define DPORT_PWM0_CLK_EN_M (BIT(17)) +#define DPORT_PWM0_CLK_EN_V 0x1 +#define DPORT_PWM0_CLK_EN_S 17 +/* DPORT_SPI3_CLK_EN : R/W ;bitpos:[16] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_SPI3_CLK_EN (BIT(16)) +#define DPORT_SPI3_CLK_EN_M (BIT(16)) +#define DPORT_SPI3_CLK_EN_V 0x1 +#define DPORT_SPI3_CLK_EN_S 16 +/* DPORT_TIMERGROUP1_CLK_EN : R/W ;bitpos:[15] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_TIMERGROUP1_CLK_EN (BIT(15)) +#define DPORT_TIMERGROUP1_CLK_EN_M (BIT(15)) +#define DPORT_TIMERGROUP1_CLK_EN_V 0x1 +#define DPORT_TIMERGROUP1_CLK_EN_S 15 +/* DPORT_EFUSE_CLK_EN : R/W ;bitpos:[14] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_EFUSE_CLK_EN (BIT(14)) +#define DPORT_EFUSE_CLK_EN_M (BIT(14)) +#define DPORT_EFUSE_CLK_EN_V 0x1 +#define DPORT_EFUSE_CLK_EN_S 14 +/* DPORT_TIMERGROUP_CLK_EN : R/W ;bitpos:[13] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_TIMERGROUP_CLK_EN (BIT(13)) +#define DPORT_TIMERGROUP_CLK_EN_M (BIT(13)) +#define DPORT_TIMERGROUP_CLK_EN_V 0x1 +#define DPORT_TIMERGROUP_CLK_EN_S 13 +/* DPORT_UHCI1_CLK_EN : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_UHCI1_CLK_EN (BIT(12)) +#define DPORT_UHCI1_CLK_EN_M (BIT(12)) +#define DPORT_UHCI1_CLK_EN_V 0x1 +#define DPORT_UHCI1_CLK_EN_S 12 +/* DPORT_LEDC_CLK_EN : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_LEDC_CLK_EN (BIT(11)) +#define DPORT_LEDC_CLK_EN_M (BIT(11)) +#define DPORT_LEDC_CLK_EN_V 0x1 +#define DPORT_LEDC_CLK_EN_S 11 +/* DPORT_PCNT_CLK_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PCNT_CLK_EN (BIT(10)) +#define DPORT_PCNT_CLK_EN_M (BIT(10)) +#define DPORT_PCNT_CLK_EN_V 0x1 +#define DPORT_PCNT_CLK_EN_S 10 +/* DPORT_RMT_CLK_EN : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_RMT_CLK_EN (BIT(9)) +#define DPORT_RMT_CLK_EN_M (BIT(9)) +#define DPORT_RMT_CLK_EN_V 0x1 +#define DPORT_RMT_CLK_EN_S 9 +/* DPORT_UHCI0_CLK_EN : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_UHCI0_CLK_EN (BIT(8)) +#define DPORT_UHCI0_CLK_EN_M (BIT(8)) +#define DPORT_UHCI0_CLK_EN_V 0x1 +#define DPORT_UHCI0_CLK_EN_S 8 +/* DPORT_I2C_EXT0_CLK_EN : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_I2C_EXT0_CLK_EN (BIT(7)) +#define DPORT_I2C_EXT0_CLK_EN_M (BIT(7)) +#define DPORT_I2C_EXT0_CLK_EN_V 0x1 +#define DPORT_I2C_EXT0_CLK_EN_S 7 +/* DPORT_SPI2_CLK_EN : R/W ;bitpos:[6] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_SPI2_CLK_EN (BIT(6)) +#define DPORT_SPI2_CLK_EN_M (BIT(6)) +#define DPORT_SPI2_CLK_EN_V 0x1 +#define DPORT_SPI2_CLK_EN_S 6 +/* DPORT_UART1_CLK_EN : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_UART1_CLK_EN (BIT(5)) +#define DPORT_UART1_CLK_EN_M (BIT(5)) +#define DPORT_UART1_CLK_EN_V 0x1 +#define DPORT_UART1_CLK_EN_S 5 +/* DPORT_I2S0_CLK_EN : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_I2S0_CLK_EN (BIT(4)) +#define DPORT_I2S0_CLK_EN_M (BIT(4)) +#define DPORT_I2S0_CLK_EN_V 0x1 +#define DPORT_I2S0_CLK_EN_S 4 +/* DPORT_WDG_CLK_EN : R/W ;bitpos:[3] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_WDG_CLK_EN (BIT(3)) +#define DPORT_WDG_CLK_EN_M (BIT(3)) +#define DPORT_WDG_CLK_EN_V 0x1 +#define DPORT_WDG_CLK_EN_S 3 +/* DPORT_UART_CLK_EN : R/W ;bitpos:[2] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_UART_CLK_EN (BIT(2)) +#define DPORT_UART_CLK_EN_M (BIT(2)) +#define DPORT_UART_CLK_EN_V 0x1 +#define DPORT_UART_CLK_EN_S 2 +/* DPORT_SPI01_CLK_EN : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_SPI01_CLK_EN (BIT(1)) +#define DPORT_SPI01_CLK_EN_M (BIT(1)) +#define DPORT_SPI01_CLK_EN_V 0x1 +#define DPORT_SPI01_CLK_EN_S 1 +/* DPORT_TIMERS_CLK_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_TIMERS_CLK_EN (BIT(0)) +#define DPORT_TIMERS_CLK_EN_M (BIT(0)) +#define DPORT_TIMERS_CLK_EN_V 0x1 +#define DPORT_TIMERS_CLK_EN_S 0 + +#define DPORT_PERIP_CLK_EN1_REG (DR_REG_SYSTEM_BASE + 0x044) +/* DPORT_SPI_SHARED_DMA_CLK_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_SPI_SHARED_DMA_CLK_EN (BIT(0)) +#define DPORT_SPI_SHARED_DMA_CLK_EN_M (BIT(0)) +#define DPORT_SPI_SHARED_DMA_CLK_EN_V 0x1 +#define DPORT_SPI_SHARED_DMA_CLK_EN_S 0 + +#define DPORT_PERIP_RST_EN_REG DPORT_PERIP_RST_EN0_REG +#define DPORT_PERIP_RST_EN0_REG (DR_REG_SYSTEM_BASE + 0x048) +/* DPORT_SPI4_RST : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define DPORT_SPI4_RST (BIT(31)) +#define DPORT_SPI4_RST_M (BIT(31)) +#define DPORT_SPI4_RST_V 0x1 +#define DPORT_SPI4_RST_S 31 +/* DPORT_ADC2_ARB_RST : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_ADC2_ARB_RST (BIT(30)) +#define DPORT_ADC2_ARB_RST_M (BIT(30)) +#define DPORT_ADC2_ARB_RST_V 0x1 +#define DPORT_ADC2_ARB_RST_S 30 +/* DPORT_SYSTIMER_RST : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_SYSTIMER_RST (BIT(29)) +#define DPORT_SYSTIMER_RST_M (BIT(29)) +#define DPORT_SYSTIMER_RST_V 0x1 +#define DPORT_SYSTIMER_RST_S 29 +/* DPORT_APB_SARADC_RST : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_APB_SARADC_RST (BIT(28)) +#define DPORT_APB_SARADC_RST_M (BIT(28)) +#define DPORT_APB_SARADC_RST_V 0x1 +#define DPORT_APB_SARADC_RST_S 28 +/* DPORT_SPI3_DMA_RST : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_SPI3_DMA_RST (BIT(27)) +#define DPORT_SPI3_DMA_RST_M (BIT(27)) +#define DPORT_SPI3_DMA_RST_V 0x1 +#define DPORT_SPI3_DMA_RST_S 27 +/* DPORT_PWM3_RST : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PWM3_RST (BIT(26)) +#define DPORT_PWM3_RST_M (BIT(26)) +#define DPORT_PWM3_RST_V 0x1 +#define DPORT_PWM3_RST_S 26 +/* DPORT_PWM2_RST : R/W ;bitpos:[25] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PWM2_RST (BIT(25)) +#define DPORT_PWM2_RST_M (BIT(25)) +#define DPORT_PWM2_RST_V 0x1 +#define DPORT_PWM2_RST_S 25 +/* DPORT_UART_MEM_RST : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_UART_MEM_RST (BIT(24)) +#define DPORT_UART_MEM_RST_M (BIT(24)) +#define DPORT_UART_MEM_RST_V 0x1 +#define DPORT_UART_MEM_RST_S 24 +/* DPORT_USB_RST : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_USB_RST (BIT(23)) +#define DPORT_USB_RST_M (BIT(23)) +#define DPORT_USB_RST_V 0x1 +#define DPORT_USB_RST_S 23 +/* DPORT_SPI2_DMA_RST : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_SPI2_DMA_RST (BIT(22)) +#define DPORT_SPI2_DMA_RST_M (BIT(22)) +#define DPORT_SPI2_DMA_RST_V 0x1 +#define DPORT_SPI2_DMA_RST_S 22 +/* DPORT_I2S1_RST : R/W ;bitpos:[21] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_I2S1_RST (BIT(21)) +#define DPORT_I2S1_RST_M (BIT(21)) +#define DPORT_I2S1_RST_V 0x1 +#define DPORT_I2S1_RST_S 21 +/* DPORT_PWM1_RST : R/W ;bitpos:[20] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PWM1_RST (BIT(20)) +#define DPORT_PWM1_RST_M (BIT(20)) +#define DPORT_PWM1_RST_V 0x1 +#define DPORT_PWM1_RST_S 20 +/* DPORT_CAN_RST : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CAN_RST (BIT(19)) +#define DPORT_CAN_RST_M (BIT(19)) +#define DPORT_CAN_RST_V 0x1 +#define DPORT_CAN_RST_S 19 +/* DPORT_I2C_EXT1_RST : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_I2C_EXT1_RST (BIT(18)) +#define DPORT_I2C_EXT1_RST_M (BIT(18)) +#define DPORT_I2C_EXT1_RST_V 0x1 +#define DPORT_I2C_EXT1_RST_S 18 +/* DPORT_PWM0_RST : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PWM0_RST (BIT(17)) +#define DPORT_PWM0_RST_M (BIT(17)) +#define DPORT_PWM0_RST_V 0x1 +#define DPORT_PWM0_RST_S 17 +/* DPORT_SPI3_RST : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_SPI3_RST (BIT(16)) +#define DPORT_SPI3_RST_M (BIT(16)) +#define DPORT_SPI3_RST_V 0x1 +#define DPORT_SPI3_RST_S 16 +/* DPORT_TIMERGROUP1_RST : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_TIMERGROUP1_RST (BIT(15)) +#define DPORT_TIMERGROUP1_RST_M (BIT(15)) +#define DPORT_TIMERGROUP1_RST_V 0x1 +#define DPORT_TIMERGROUP1_RST_S 15 +/* DPORT_EFUSE_RST : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_EFUSE_RST (BIT(14)) +#define DPORT_EFUSE_RST_M (BIT(14)) +#define DPORT_EFUSE_RST_V 0x1 +#define DPORT_EFUSE_RST_S 14 +/* DPORT_TIMERGROUP_RST : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_TIMERGROUP_RST (BIT(13)) +#define DPORT_TIMERGROUP_RST_M (BIT(13)) +#define DPORT_TIMERGROUP_RST_V 0x1 +#define DPORT_TIMERGROUP_RST_S 13 +/* DPORT_UHCI1_RST : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_UHCI1_RST (BIT(12)) +#define DPORT_UHCI1_RST_M (BIT(12)) +#define DPORT_UHCI1_RST_V 0x1 +#define DPORT_UHCI1_RST_S 12 +/* DPORT_LEDC_RST : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_LEDC_RST (BIT(11)) +#define DPORT_LEDC_RST_M (BIT(11)) +#define DPORT_LEDC_RST_V 0x1 +#define DPORT_LEDC_RST_S 11 +/* DPORT_PCNT_RST : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PCNT_RST (BIT(10)) +#define DPORT_PCNT_RST_M (BIT(10)) +#define DPORT_PCNT_RST_V 0x1 +#define DPORT_PCNT_RST_S 10 +/* DPORT_RMT_RST : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_RMT_RST (BIT(9)) +#define DPORT_RMT_RST_M (BIT(9)) +#define DPORT_RMT_RST_V 0x1 +#define DPORT_RMT_RST_S 9 +/* DPORT_UHCI0_RST : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_UHCI0_RST (BIT(8)) +#define DPORT_UHCI0_RST_M (BIT(8)) +#define DPORT_UHCI0_RST_V 0x1 +#define DPORT_UHCI0_RST_S 8 +/* DPORT_I2C_EXT0_RST : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_I2C_EXT0_RST (BIT(7)) +#define DPORT_I2C_EXT0_RST_M (BIT(7)) +#define DPORT_I2C_EXT0_RST_V 0x1 +#define DPORT_I2C_EXT0_RST_S 7 +/* DPORT_SPI2_RST : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_SPI2_RST (BIT(6)) +#define DPORT_SPI2_RST_M (BIT(6)) +#define DPORT_SPI2_RST_V 0x1 +#define DPORT_SPI2_RST_S 6 +/* DPORT_UART1_RST : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_UART1_RST (BIT(5)) +#define DPORT_UART1_RST_M (BIT(5)) +#define DPORT_UART1_RST_V 0x1 +#define DPORT_UART1_RST_S 5 +/* DPORT_I2S0_RST : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_I2S0_RST (BIT(4)) +#define DPORT_I2S0_RST_M (BIT(4)) +#define DPORT_I2S0_RST_V 0x1 +#define DPORT_I2S0_RST_S 4 +/* DPORT_WDG_RST : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_WDG_RST (BIT(3)) +#define DPORT_WDG_RST_M (BIT(3)) +#define DPORT_WDG_RST_V 0x1 +#define DPORT_WDG_RST_S 3 +/* DPORT_UART_RST : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_UART_RST (BIT(2)) +#define DPORT_UART_RST_M (BIT(2)) +#define DPORT_UART_RST_V 0x1 +#define DPORT_UART_RST_S 2 +/* DPORT_SPI01_RST : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_SPI01_RST (BIT(1)) +#define DPORT_SPI01_RST_M (BIT(1)) +#define DPORT_SPI01_RST_V 0x1 +#define DPORT_SPI01_RST_S 1 +/* DPORT_TIMERS_RST : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_TIMERS_RST (BIT(0)) +#define DPORT_TIMERS_RST_M (BIT(0)) +#define DPORT_TIMERS_RST_V 0x1 +#define DPORT_TIMERS_RST_S 0 + +#define DPORT_PERIP_RST_EN1_REG (DR_REG_SYSTEM_BASE + 0x04C) +/* DPORT_SPI_SHARED_DMA_RST : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_SPI_SHARED_DMA_RST (BIT(0)) +#define DPORT_SPI_SHARED_DMA_RST_M (BIT(0)) +#define DPORT_SPI_SHARED_DMA_RST_V 0x1 +#define DPORT_SPI_SHARED_DMA_RST_S 0 + +#define DPORT_BT_LPCK_DIV_INT_REG (DR_REG_SYSTEM_BASE + 0x050) +/* DPORT_BT_LPCK_DIV_NUM : R/W ;bitpos:[11:0] ;default: 12'd255 ; */ +/*description: */ +#define DPORT_BT_LPCK_DIV_NUM 0x00000FFF +#define DPORT_BT_LPCK_DIV_NUM_M ((DPORT_BT_LPCK_DIV_NUM_V)<<(DPORT_BT_LPCK_DIV_NUM_S)) +#define DPORT_BT_LPCK_DIV_NUM_V 0xFFF +#define DPORT_BT_LPCK_DIV_NUM_S 0 + +#define DPORT_BT_LPCK_DIV_FRAC_REG (DR_REG_SYSTEM_BASE + 0x054) +/* DPORT_LPCLK_RTC_EN : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_LPCLK_RTC_EN (BIT(28)) +#define DPORT_LPCLK_RTC_EN_M (BIT(28)) +#define DPORT_LPCLK_RTC_EN_V 0x1 +#define DPORT_LPCLK_RTC_EN_S 28 +/* DPORT_LPCLK_SEL_XTAL32K : R/W ;bitpos:[27] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_LPCLK_SEL_XTAL32K (BIT(27)) +#define DPORT_LPCLK_SEL_XTAL32K_M (BIT(27)) +#define DPORT_LPCLK_SEL_XTAL32K_V 0x1 +#define DPORT_LPCLK_SEL_XTAL32K_S 27 +/* DPORT_LPCLK_SEL_XTAL : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_LPCLK_SEL_XTAL (BIT(26)) +#define DPORT_LPCLK_SEL_XTAL_M (BIT(26)) +#define DPORT_LPCLK_SEL_XTAL_V 0x1 +#define DPORT_LPCLK_SEL_XTAL_S 26 +/* DPORT_LPCLK_SEL_8M : R/W ;bitpos:[25] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_LPCLK_SEL_8M (BIT(25)) +#define DPORT_LPCLK_SEL_8M_M (BIT(25)) +#define DPORT_LPCLK_SEL_8M_V 0x1 +#define DPORT_LPCLK_SEL_8M_S 25 +/* DPORT_LPCLK_SEL_RTC_SLOW : R/W ;bitpos:[24] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_LPCLK_SEL_RTC_SLOW (BIT(24)) +#define DPORT_LPCLK_SEL_RTC_SLOW_M (BIT(24)) +#define DPORT_LPCLK_SEL_RTC_SLOW_V 0x1 +#define DPORT_LPCLK_SEL_RTC_SLOW_S 24 +/* DPORT_BT_LPCK_DIV_A : R/W ;bitpos:[23:12] ;default: 12'd1 ; */ +/*description: */ +#define DPORT_BT_LPCK_DIV_A 0x00000FFF +#define DPORT_BT_LPCK_DIV_A_M ((DPORT_BT_LPCK_DIV_A_V)<<(DPORT_BT_LPCK_DIV_A_S)) +#define DPORT_BT_LPCK_DIV_A_V 0xFFF +#define DPORT_BT_LPCK_DIV_A_S 12 +/* DPORT_BT_LPCK_DIV_B : R/W ;bitpos:[11:0] ;default: 12'd1 ; */ +/*description: */ +#define DPORT_BT_LPCK_DIV_B 0x00000FFF +#define DPORT_BT_LPCK_DIV_B_M ((DPORT_BT_LPCK_DIV_B_V)<<(DPORT_BT_LPCK_DIV_B_S)) +#define DPORT_BT_LPCK_DIV_B_V 0xFFF +#define DPORT_BT_LPCK_DIV_B_S 0 + +#define DPORT_CPU_INTR_FROM_CPU_0_REG (DR_REG_SYSTEM_BASE + 0x058) +/* DPORT_CPU_INTR_FROM_CPU_0 : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CPU_INTR_FROM_CPU_0 (BIT(0)) +#define DPORT_CPU_INTR_FROM_CPU_0_M (BIT(0)) +#define DPORT_CPU_INTR_FROM_CPU_0_V 0x1 +#define DPORT_CPU_INTR_FROM_CPU_0_S 0 + +#define DPORT_CPU_INTR_FROM_CPU_1_REG (DR_REG_SYSTEM_BASE + 0x05C) +/* DPORT_CPU_INTR_FROM_CPU_1 : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CPU_INTR_FROM_CPU_1 (BIT(0)) +#define DPORT_CPU_INTR_FROM_CPU_1_M (BIT(0)) +#define DPORT_CPU_INTR_FROM_CPU_1_V 0x1 +#define DPORT_CPU_INTR_FROM_CPU_1_S 0 + +#define DPORT_CPU_INTR_FROM_CPU_2_REG (DR_REG_SYSTEM_BASE + 0x060) +/* DPORT_CPU_INTR_FROM_CPU_2 : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CPU_INTR_FROM_CPU_2 (BIT(0)) +#define DPORT_CPU_INTR_FROM_CPU_2_M (BIT(0)) +#define DPORT_CPU_INTR_FROM_CPU_2_V 0x1 +#define DPORT_CPU_INTR_FROM_CPU_2_S 0 + +#define DPORT_CPU_INTR_FROM_CPU_3_REG (DR_REG_SYSTEM_BASE + 0x064) +/* DPORT_CPU_INTR_FROM_CPU_3 : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_CPU_INTR_FROM_CPU_3 (BIT(0)) +#define DPORT_CPU_INTR_FROM_CPU_3_M (BIT(0)) +#define DPORT_CPU_INTR_FROM_CPU_3_V 0x1 +#define DPORT_CPU_INTR_FROM_CPU_3_S 0 + +#define DPORT_RSA_PD_CTRL_REG (DR_REG_SYSTEM_BASE + 0x068) +/* DPORT_RSA_MEM_PD : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_RSA_MEM_PD (BIT(0)) +#define DPORT_RSA_MEM_PD_M (BIT(0)) +#define DPORT_RSA_MEM_PD_V 0x1 +#define DPORT_RSA_MEM_PD_S 0 +#define DPORT_RSA_PD DPORT_RSA_MEM_PD + +#define DPORT_SPI_DMA_CHAN_SEL_REG DPORT_SPI_SHARED_DMA_SEL_REG +#define DPORT_SPI_SHARED_DMA_SEL_REG (DR_REG_SYSTEM_BASE + 0x06C) +/* DPORT_SPI_SHARED_DMA_SEL : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_SPI_SHARED_DMA_SEL (BIT(0)) +#define DPORT_SPI_SHARED_DMA_SEL_M (BIT(0)) +#define DPORT_SPI_SHARED_DMA_SEL_V 0x1 +#define DPORT_SPI_SHARED_DMA_SEL_S 0 + +#define DPORT_BUSTOEXTMEM_ENA_REG (DR_REG_SYSTEM_BASE + 0x070) +/* DPORT_BUSTOEXTMEM_ENA : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_BUSTOEXTMEM_ENA (BIT(0)) +#define DPORT_BUSTOEXTMEM_ENA_M (BIT(0)) +#define DPORT_BUSTOEXTMEM_ENA_V 0x1 +#define DPORT_BUSTOEXTMEM_ENA_S 0 + +#define DPORT_CACHE_CONTROL_REG (DR_REG_SYSTEM_BASE + 0x074) +/* DPORT_PRO_CACHE_RESET : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_PRO_CACHE_RESET (BIT(2)) +#define DPORT_PRO_CACHE_RESET_M (BIT(2)) +#define DPORT_PRO_CACHE_RESET_V 0x1 +#define DPORT_PRO_CACHE_RESET_S 2 +/* DPORT_PRO_DCACHE_CLK_ON : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_DCACHE_CLK_ON (BIT(1)) +#define DPORT_PRO_DCACHE_CLK_ON_M (BIT(1)) +#define DPORT_PRO_DCACHE_CLK_ON_V 0x1 +#define DPORT_PRO_DCACHE_CLK_ON_S 1 +/* DPORT_PRO_ICACHE_CLK_ON : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define DPORT_PRO_ICACHE_CLK_ON (BIT(0)) +#define DPORT_PRO_ICACHE_CLK_ON_M (BIT(0)) +#define DPORT_PRO_ICACHE_CLK_ON_V 0x1 +#define DPORT_PRO_ICACHE_CLK_ON_S 0 + +#define DPORT_EXTERNAL_DEVICE_ENCRYPT_DECRYPT_CONTROL_REG (DR_REG_SYSTEM_BASE + 0x078) +/* DPORT_ENABLE_DOWNLOAD_MANUAL_ENCRYPT : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_ENABLE_DOWNLOAD_MANUAL_ENCRYPT (BIT(3)) +#define DPORT_ENABLE_DOWNLOAD_MANUAL_ENCRYPT_M (BIT(3)) +#define DPORT_ENABLE_DOWNLOAD_MANUAL_ENCRYPT_V 0x1 +#define DPORT_ENABLE_DOWNLOAD_MANUAL_ENCRYPT_S 3 +/* DPORT_ENABLE_DOWNLOAD_G0CB_DECRYPT : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_ENABLE_DOWNLOAD_G0CB_DECRYPT (BIT(2)) +#define DPORT_ENABLE_DOWNLOAD_G0CB_DECRYPT_M (BIT(2)) +#define DPORT_ENABLE_DOWNLOAD_G0CB_DECRYPT_V 0x1 +#define DPORT_ENABLE_DOWNLOAD_G0CB_DECRYPT_S 2 +/* DPORT_ENABLE_DOWNLOAD_DB_ENCRYPT : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_ENABLE_DOWNLOAD_DB_ENCRYPT (BIT(1)) +#define DPORT_ENABLE_DOWNLOAD_DB_ENCRYPT_M (BIT(1)) +#define DPORT_ENABLE_DOWNLOAD_DB_ENCRYPT_V 0x1 +#define DPORT_ENABLE_DOWNLOAD_DB_ENCRYPT_S 1 +/* DPORT_ENABLE_SPI_MANUAL_ENCRYPT : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_ENABLE_SPI_MANUAL_ENCRYPT (BIT(0)) +#define DPORT_ENABLE_SPI_MANUAL_ENCRYPT_M (BIT(0)) +#define DPORT_ENABLE_SPI_MANUAL_ENCRYPT_V 0x1 +#define DPORT_ENABLE_SPI_MANUAL_ENCRYPT_S 0 + +#define DPORT_RTC_FASTMEM_CONFIG_REG (DR_REG_SYSTEM_BASE + 0x07C) +/* DPORT_RTC_MEM_CRC_FINISH : RO ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_RTC_MEM_CRC_FINISH (BIT(31)) +#define DPORT_RTC_MEM_CRC_FINISH_M (BIT(31)) +#define DPORT_RTC_MEM_CRC_FINISH_V 0x1 +#define DPORT_RTC_MEM_CRC_FINISH_S 31 +/* DPORT_RTC_MEM_CRC_LEN : R/W ;bitpos:[30:20] ;default: 11'h7ff ; */ +/*description: */ +#define DPORT_RTC_MEM_CRC_LEN 0x000007FF +#define DPORT_RTC_MEM_CRC_LEN_M ((DPORT_RTC_MEM_CRC_LEN_V)<<(DPORT_RTC_MEM_CRC_LEN_S)) +#define DPORT_RTC_MEM_CRC_LEN_V 0x7FF +#define DPORT_RTC_MEM_CRC_LEN_S 20 +/* DPORT_RTC_MEM_CRC_ADDR : R/W ;bitpos:[19:9] ;default: 11'h0 ; */ +/*description: */ +#define DPORT_RTC_MEM_CRC_ADDR 0x000007FF +#define DPORT_RTC_MEM_CRC_ADDR_M ((DPORT_RTC_MEM_CRC_ADDR_V)<<(DPORT_RTC_MEM_CRC_ADDR_S)) +#define DPORT_RTC_MEM_CRC_ADDR_V 0x7FF +#define DPORT_RTC_MEM_CRC_ADDR_S 9 +/* DPORT_RTC_MEM_CRC_START : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_RTC_MEM_CRC_START (BIT(8)) +#define DPORT_RTC_MEM_CRC_START_M (BIT(8)) +#define DPORT_RTC_MEM_CRC_START_V 0x1 +#define DPORT_RTC_MEM_CRC_START_S 8 + +#define DPORT_RTC_FASTMEM_CRC_REG (DR_REG_SYSTEM_BASE + 0x080) +/* DPORT_RTC_MEM_CRC_RES : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define DPORT_RTC_MEM_CRC_RES 0xFFFFFFFF +#define DPORT_RTC_MEM_CRC_RES_M ((DPORT_RTC_MEM_CRC_RES_V)<<(DPORT_RTC_MEM_CRC_RES_S)) +#define DPORT_RTC_MEM_CRC_RES_V 0xFFFFFFFF +#define DPORT_RTC_MEM_CRC_RES_S 0 + +#define DPORT_REDUNDANT_ECO_CTRL_REG (DR_REG_SYSTEM_BASE + 0x084) +/* DPORT_REDUNDANT_ECO_RESULT : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_REDUNDANT_ECO_RESULT (BIT(1)) +#define DPORT_REDUNDANT_ECO_RESULT_M (BIT(1)) +#define DPORT_REDUNDANT_ECO_RESULT_V 0x1 +#define DPORT_REDUNDANT_ECO_RESULT_S 1 +/* DPORT_REDUNDANT_ECO_DRIVE : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define DPORT_REDUNDANT_ECO_DRIVE (BIT(0)) +#define DPORT_REDUNDANT_ECO_DRIVE_M (BIT(0)) +#define DPORT_REDUNDANT_ECO_DRIVE_V 0x1 +#define DPORT_REDUNDANT_ECO_DRIVE_S 0 + +#define SYSTEM_CLOCK_GATE_REG (DR_REG_SYSTEM_BASE + 0x088) +/* SYSTEM_CLK_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define SYSTEM_CLK_EN (BIT(0)) +#define SYSTEM_CLK_EN_M (BIT(0)) +#define SYSTEM_CLK_EN_V 0x1 +#define SYSTEM_CLK_EN_S 0 + +#define SYSTEM_DATE_REG (DR_REG_SYSTEM_BASE + 0xFFC) +/* SYSTEM_DATE : R/W ;bitpos:[27:0] ;default: 28'h1810300 ; */ +/*description: */ +#define SYSTEM_DATE 0x0FFFFFFF +#define SYSTEM_DATE_M ((SYSTEM_DATE_V)<<(SYSTEM_DATE_S)) +#define SYSTEM_DATE_V 0xFFFFFFF +#define SYSTEM_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_SYSTEM_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/timer_group_reg.h b/components/soc/esp32s2beta/include/soc/timer_group_reg.h new file mode 100644 index 0000000000..1f016a96ff --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/timer_group_reg.h @@ -0,0 +1,724 @@ +// Copyright 2017-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. +#ifndef _SOC_TIMG_REG_H_ +#define _SOC_TIMG_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" + +/* The value that needs to be written to TIMG_WDT_WKEY to write-enable the wdt registers */ +#define TIMG_WDT_WKEY_VALUE 0x50D83AA1 + +/* Possible values for TIMG_WDT_STGx */ +#define TIMG_WDT_STG_SEL_OFF 0 +#define TIMG_WDT_STG_SEL_INT 1 +#define TIMG_WDT_STG_SEL_RESET_CPU 2 +#define TIMG_WDT_STG_SEL_RESET_SYSTEM 3 + +#define TIMG_T0CONFIG_REG(i) (REG_TIMG_BASE(i) + 0x0000) +/* TIMG_T0_EN : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T0_EN (BIT(31)) +#define TIMG_T0_EN_M (BIT(31)) +#define TIMG_T0_EN_V 0x1 +#define TIMG_T0_EN_S 31 +/* TIMG_T0_INCREASE : R/W ;bitpos:[30] ;default: 1'h1 ; */ +/*description: */ +#define TIMG_T0_INCREASE (BIT(30)) +#define TIMG_T0_INCREASE_M (BIT(30)) +#define TIMG_T0_INCREASE_V 0x1 +#define TIMG_T0_INCREASE_S 30 +/* TIMG_T0_AUTORELOAD : R/W ;bitpos:[29] ;default: 1'h1 ; */ +/*description: */ +#define TIMG_T0_AUTORELOAD (BIT(29)) +#define TIMG_T0_AUTORELOAD_M (BIT(29)) +#define TIMG_T0_AUTORELOAD_V 0x1 +#define TIMG_T0_AUTORELOAD_S 29 +/* TIMG_T0_DIVIDER : R/W ;bitpos:[28:13] ;default: 16'h1 ; */ +/*description: */ +#define TIMG_T0_DIVIDER 0x0000FFFF +#define TIMG_T0_DIVIDER_M ((TIMG_T0_DIVIDER_V)<<(TIMG_T0_DIVIDER_S)) +#define TIMG_T0_DIVIDER_V 0xFFFF +#define TIMG_T0_DIVIDER_S 13 +/* TIMG_T0_EDGE_INT_EN : R/W ;bitpos:[12] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T0_EDGE_INT_EN (BIT(12)) +#define TIMG_T0_EDGE_INT_EN_M (BIT(12)) +#define TIMG_T0_EDGE_INT_EN_V 0x1 +#define TIMG_T0_EDGE_INT_EN_S 12 +/* TIMG_T0_LEVEL_INT_EN : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T0_LEVEL_INT_EN (BIT(11)) +#define TIMG_T0_LEVEL_INT_EN_M (BIT(11)) +#define TIMG_T0_LEVEL_INT_EN_V 0x1 +#define TIMG_T0_LEVEL_INT_EN_S 11 +/* TIMG_T0_ALARM_EN : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T0_ALARM_EN (BIT(10)) +#define TIMG_T0_ALARM_EN_M (BIT(10)) +#define TIMG_T0_ALARM_EN_V 0x1 +#define TIMG_T0_ALARM_EN_S 10 +/* TIMG_T0_USE_XTAL : R/W ;bitpos:[9] ;default: 1'd0 ; */ +/*description: */ +#define TIMG_T0_USE_XTAL (BIT(9)) +#define TIMG_T0_USE_XTAL_M (BIT(9)) +#define TIMG_T0_USE_XTAL_V 0x1 +#define TIMG_T0_USE_XTAL_S 9 + +#define TIMG_T0LO_REG(i) (REG_TIMG_BASE(i) + 0x0004) +/* TIMG_T0_LO : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T0_LO 0xFFFFFFFF +#define TIMG_T0_LO_M ((TIMG_T0_LO_V)<<(TIMG_T0_LO_S)) +#define TIMG_T0_LO_V 0xFFFFFFFF +#define TIMG_T0_LO_S 0 + +#define TIMG_T0HI_REG(i) (REG_TIMG_BASE(i) + 0x0008) +/* TIMG_T0_HI : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T0_HI 0xFFFFFFFF +#define TIMG_T0_HI_M ((TIMG_T0_HI_V)<<(TIMG_T0_HI_S)) +#define TIMG_T0_HI_V 0xFFFFFFFF +#define TIMG_T0_HI_S 0 + +#define TIMG_T0UPDATE_REG(i) (REG_TIMG_BASE(i) + 0x000c) +/* TIMG_T0_UPDATE : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T0_UPDATE (BIT(31)) +#define TIMG_T0_UPDATE_M (BIT(31)) +#define TIMG_T0_UPDATE_V 0x1 +#define TIMG_T0_UPDATE_S 31 + +#define TIMG_T0ALARMLO_REG(i) (REG_TIMG_BASE(i) + 0x0010) +/* TIMG_T0_ALARM_LO : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T0_ALARM_LO 0xFFFFFFFF +#define TIMG_T0_ALARM_LO_M ((TIMG_T0_ALARM_LO_V)<<(TIMG_T0_ALARM_LO_S)) +#define TIMG_T0_ALARM_LO_V 0xFFFFFFFF +#define TIMG_T0_ALARM_LO_S 0 + +#define TIMG_T0ALARMHI_REG(i) (REG_TIMG_BASE(i) + 0x0014) +/* TIMG_T0_ALARM_HI : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T0_ALARM_HI 0xFFFFFFFF +#define TIMG_T0_ALARM_HI_M ((TIMG_T0_ALARM_HI_V)<<(TIMG_T0_ALARM_HI_S)) +#define TIMG_T0_ALARM_HI_V 0xFFFFFFFF +#define TIMG_T0_ALARM_HI_S 0 + +#define TIMG_T0LOADLO_REG(i) (REG_TIMG_BASE(i) + 0x0018) +/* TIMG_T0_LOAD_LO : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T0_LOAD_LO 0xFFFFFFFF +#define TIMG_T0_LOAD_LO_M ((TIMG_T0_LOAD_LO_V)<<(TIMG_T0_LOAD_LO_S)) +#define TIMG_T0_LOAD_LO_V 0xFFFFFFFF +#define TIMG_T0_LOAD_LO_S 0 + +#define TIMG_T0LOADHI_REG(i) (REG_TIMG_BASE(i) + 0x001c) +/* TIMG_T0_LOAD_HI : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T0_LOAD_HI 0xFFFFFFFF +#define TIMG_T0_LOAD_HI_M ((TIMG_T0_LOAD_HI_V)<<(TIMG_T0_LOAD_HI_S)) +#define TIMG_T0_LOAD_HI_V 0xFFFFFFFF +#define TIMG_T0_LOAD_HI_S 0 + +#define TIMG_T0LOAD_REG(i) (REG_TIMG_BASE(i) + 0x0020) +/* TIMG_T0_LOAD : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T0_LOAD 0xFFFFFFFF +#define TIMG_T0_LOAD_M ((TIMG_T0_LOAD_V)<<(TIMG_T0_LOAD_S)) +#define TIMG_T0_LOAD_V 0xFFFFFFFF +#define TIMG_T0_LOAD_S 0 + +#define TIMG_T1CONFIG_REG(i) (REG_TIMG_BASE(i) + 0x0024) +/* TIMG_T1_EN : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T1_EN (BIT(31)) +#define TIMG_T1_EN_M (BIT(31)) +#define TIMG_T1_EN_V 0x1 +#define TIMG_T1_EN_S 31 +/* TIMG_T1_INCREASE : R/W ;bitpos:[30] ;default: 1'h1 ; */ +/*description: */ +#define TIMG_T1_INCREASE (BIT(30)) +#define TIMG_T1_INCREASE_M (BIT(30)) +#define TIMG_T1_INCREASE_V 0x1 +#define TIMG_T1_INCREASE_S 30 +/* TIMG_T1_AUTORELOAD : R/W ;bitpos:[29] ;default: 1'h1 ; */ +/*description: */ +#define TIMG_T1_AUTORELOAD (BIT(29)) +#define TIMG_T1_AUTORELOAD_M (BIT(29)) +#define TIMG_T1_AUTORELOAD_V 0x1 +#define TIMG_T1_AUTORELOAD_S 29 +/* TIMG_T1_DIVIDER : R/W ;bitpos:[28:13] ;default: 16'h1 ; */ +/*description: */ +#define TIMG_T1_DIVIDER 0x0000FFFF +#define TIMG_T1_DIVIDER_M ((TIMG_T1_DIVIDER_V)<<(TIMG_T1_DIVIDER_S)) +#define TIMG_T1_DIVIDER_V 0xFFFF +#define TIMG_T1_DIVIDER_S 13 +/* TIMG_T1_EDGE_INT_EN : R/W ;bitpos:[12] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T1_EDGE_INT_EN (BIT(12)) +#define TIMG_T1_EDGE_INT_EN_M (BIT(12)) +#define TIMG_T1_EDGE_INT_EN_V 0x1 +#define TIMG_T1_EDGE_INT_EN_S 12 +/* TIMG_T1_LEVEL_INT_EN : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T1_LEVEL_INT_EN (BIT(11)) +#define TIMG_T1_LEVEL_INT_EN_M (BIT(11)) +#define TIMG_T1_LEVEL_INT_EN_V 0x1 +#define TIMG_T1_LEVEL_INT_EN_S 11 +/* TIMG_T1_ALARM_EN : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T1_ALARM_EN (BIT(10)) +#define TIMG_T1_ALARM_EN_M (BIT(10)) +#define TIMG_T1_ALARM_EN_V 0x1 +#define TIMG_T1_ALARM_EN_S 10 +/* TIMG_T1_USE_XTAL : R/W ;bitpos:[9] ;default: 1'd0 ; */ +/*description: */ +#define TIMG_T1_USE_XTAL (BIT(9)) +#define TIMG_T1_USE_XTAL_M (BIT(9)) +#define TIMG_T1_USE_XTAL_V 0x1 +#define TIMG_T1_USE_XTAL_S 9 + +#define TIMG_T1LO_REG(i) (REG_TIMG_BASE(i) + 0x0028) +/* TIMG_T1_LO : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T1_LO 0xFFFFFFFF +#define TIMG_T1_LO_M ((TIMG_T1_LO_V)<<(TIMG_T1_LO_S)) +#define TIMG_T1_LO_V 0xFFFFFFFF +#define TIMG_T1_LO_S 0 + +#define TIMG_T1HI_REG(i) (REG_TIMG_BASE(i) + 0x002c) +/* TIMG_T1_HI : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T1_HI 0xFFFFFFFF +#define TIMG_T1_HI_M ((TIMG_T1_HI_V)<<(TIMG_T1_HI_S)) +#define TIMG_T1_HI_V 0xFFFFFFFF +#define TIMG_T1_HI_S 0 + +#define TIMG_T1UPDATE_REG(i) (REG_TIMG_BASE(i) + 0x0030) +/* TIMG_T1_UPDATE : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T1_UPDATE (BIT(31)) +#define TIMG_T1_UPDATE_M (BIT(31)) +#define TIMG_T1_UPDATE_V 0x1 +#define TIMG_T1_UPDATE_S 31 + +#define TIMG_T1ALARMLO_REG(i) (REG_TIMG_BASE(i) + 0x0034) +/* TIMG_T1_ALARM_LO : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T1_ALARM_LO 0xFFFFFFFF +#define TIMG_T1_ALARM_LO_M ((TIMG_T1_ALARM_LO_V)<<(TIMG_T1_ALARM_LO_S)) +#define TIMG_T1_ALARM_LO_V 0xFFFFFFFF +#define TIMG_T1_ALARM_LO_S 0 + +#define TIMG_T1ALARMHI_REG(i) (REG_TIMG_BASE(i) + 0x0038) +/* TIMG_T1_ALARM_HI : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T1_ALARM_HI 0xFFFFFFFF +#define TIMG_T1_ALARM_HI_M ((TIMG_T1_ALARM_HI_V)<<(TIMG_T1_ALARM_HI_S)) +#define TIMG_T1_ALARM_HI_V 0xFFFFFFFF +#define TIMG_T1_ALARM_HI_S 0 + +#define TIMG_T1LOADLO_REG(i) (REG_TIMG_BASE(i) + 0x003c) +/* TIMG_T1_LOAD_LO : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T1_LOAD_LO 0xFFFFFFFF +#define TIMG_T1_LOAD_LO_M ((TIMG_T1_LOAD_LO_V)<<(TIMG_T1_LOAD_LO_S)) +#define TIMG_T1_LOAD_LO_V 0xFFFFFFFF +#define TIMG_T1_LOAD_LO_S 0 + +#define TIMG_T1LOADHI_REG(i) (REG_TIMG_BASE(i) + 0x0040) +/* TIMG_T1_LOAD_HI : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T1_LOAD_HI 0xFFFFFFFF +#define TIMG_T1_LOAD_HI_M ((TIMG_T1_LOAD_HI_V)<<(TIMG_T1_LOAD_HI_S)) +#define TIMG_T1_LOAD_HI_V 0xFFFFFFFF +#define TIMG_T1_LOAD_HI_S 0 + +#define TIMG_T1LOAD_REG(i) (REG_TIMG_BASE(i) + 0x0044) +/* TIMG_T1_LOAD : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_T1_LOAD 0xFFFFFFFF +#define TIMG_T1_LOAD_M ((TIMG_T1_LOAD_V)<<(TIMG_T1_LOAD_S)) +#define TIMG_T1_LOAD_V 0xFFFFFFFF +#define TIMG_T1_LOAD_S 0 + +#define TIMG_WDTCONFIG0_REG(i) (REG_TIMG_BASE(i) + 0x0048) +/* TIMG_WDT_EN : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_WDT_EN (BIT(31)) +#define TIMG_WDT_EN_M (BIT(31)) +#define TIMG_WDT_EN_V 0x1 +#define TIMG_WDT_EN_S 31 +/* TIMG_WDT_STG0 : R/W ;bitpos:[30:29] ;default: 1'd0 ; */ +/*description: */ +#define TIMG_WDT_STG0 0x00000003 +#define TIMG_WDT_STG0_M ((TIMG_WDT_STG0_V)<<(TIMG_WDT_STG0_S)) +#define TIMG_WDT_STG0_V 0x3 +#define TIMG_WDT_STG0_S 29 +/* TIMG_WDT_STG1 : R/W ;bitpos:[28:27] ;default: 1'd0 ; */ +/*description: */ +#define TIMG_WDT_STG1 0x00000003 +#define TIMG_WDT_STG1_M ((TIMG_WDT_STG1_V)<<(TIMG_WDT_STG1_S)) +#define TIMG_WDT_STG1_V 0x3 +#define TIMG_WDT_STG1_S 27 +/* TIMG_WDT_STG2 : R/W ;bitpos:[26:25] ;default: 1'd0 ; */ +/*description: */ +#define TIMG_WDT_STG2 0x00000003 +#define TIMG_WDT_STG2_M ((TIMG_WDT_STG2_V)<<(TIMG_WDT_STG2_S)) +#define TIMG_WDT_STG2_V 0x3 +#define TIMG_WDT_STG2_S 25 +/* TIMG_WDT_STG3 : R/W ;bitpos:[24:23] ;default: 1'd0 ; */ +/*description: */ +#define TIMG_WDT_STG3 0x00000003 +#define TIMG_WDT_STG3_M ((TIMG_WDT_STG3_V)<<(TIMG_WDT_STG3_S)) +#define TIMG_WDT_STG3_V 0x3 +#define TIMG_WDT_STG3_S 23 +/* TIMG_WDT_EDGE_INT_EN : R/W ;bitpos:[22] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_WDT_EDGE_INT_EN (BIT(22)) +#define TIMG_WDT_EDGE_INT_EN_M (BIT(22)) +#define TIMG_WDT_EDGE_INT_EN_V 0x1 +#define TIMG_WDT_EDGE_INT_EN_S 22 +/* TIMG_WDT_LEVEL_INT_EN : R/W ;bitpos:[21] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_WDT_LEVEL_INT_EN (BIT(21)) +#define TIMG_WDT_LEVEL_INT_EN_M (BIT(21)) +#define TIMG_WDT_LEVEL_INT_EN_V 0x1 +#define TIMG_WDT_LEVEL_INT_EN_S 21 +/* TIMG_WDT_CPU_RESET_LENGTH : R/W ;bitpos:[20:18] ;default: 3'h1 ; */ +/*description: */ +#define TIMG_WDT_CPU_RESET_LENGTH 0x00000007 +#define TIMG_WDT_CPU_RESET_LENGTH_M ((TIMG_WDT_CPU_RESET_LENGTH_V)<<(TIMG_WDT_CPU_RESET_LENGTH_S)) +#define TIMG_WDT_CPU_RESET_LENGTH_V 0x7 +#define TIMG_WDT_CPU_RESET_LENGTH_S 18 +/* TIMG_WDT_SYS_RESET_LENGTH : R/W ;bitpos:[17:15] ;default: 3'h1 ; */ +/*description: */ +#define TIMG_WDT_SYS_RESET_LENGTH 0x00000007 +#define TIMG_WDT_SYS_RESET_LENGTH_M ((TIMG_WDT_SYS_RESET_LENGTH_V)<<(TIMG_WDT_SYS_RESET_LENGTH_S)) +#define TIMG_WDT_SYS_RESET_LENGTH_V 0x7 +#define TIMG_WDT_SYS_RESET_LENGTH_S 15 +/* TIMG_WDT_FLASHBOOT_MOD_EN : R/W ;bitpos:[14] ;default: 1'h1 ; */ +/*description: */ +#define TIMG_WDT_FLASHBOOT_MOD_EN (BIT(14)) +#define TIMG_WDT_FLASHBOOT_MOD_EN_M (BIT(14)) +#define TIMG_WDT_FLASHBOOT_MOD_EN_V 0x1 +#define TIMG_WDT_FLASHBOOT_MOD_EN_S 14 +/* TIMG_WDT_PROCPU_RESET_EN : R/W ;bitpos:[13] ;default: 1'd0 ; */ +/*description: */ +#define TIMG_WDT_PROCPU_RESET_EN (BIT(13)) +#define TIMG_WDT_PROCPU_RESET_EN_M (BIT(13)) +#define TIMG_WDT_PROCPU_RESET_EN_V 0x1 +#define TIMG_WDT_PROCPU_RESET_EN_S 13 +/* TIMG_WDT_APPCPU_RESET_EN : R/W ;bitpos:[12] ;default: 1'd0 ; */ +/*description: */ +#define TIMG_WDT_APPCPU_RESET_EN (BIT(12)) +#define TIMG_WDT_APPCPU_RESET_EN_M (BIT(12)) +#define TIMG_WDT_APPCPU_RESET_EN_V 0x1 +#define TIMG_WDT_APPCPU_RESET_EN_S 12 + +#define TIMG_WDTCONFIG1_REG(i) (REG_TIMG_BASE(i) + 0x004c) +/* TIMG_WDT_CLK_PRESCALE : R/W ;bitpos:[31:16] ;default: 16'h1 ; */ +/*description: */ +#define TIMG_WDT_CLK_PRESCALE 0x0000FFFF +#define TIMG_WDT_CLK_PRESCALE_M ((TIMG_WDT_CLK_PRESCALE_V)<<(TIMG_WDT_CLK_PRESCALE_S)) +#define TIMG_WDT_CLK_PRESCALE_V 0xFFFF +#define TIMG_WDT_CLK_PRESCALE_S 16 + +#define TIMG_WDTCONFIG2_REG(i) (REG_TIMG_BASE(i) + 0x0050) +/* TIMG_WDT_STG0_HOLD : R/W ;bitpos:[31:0] ;default: 32'd26000000 ; */ +/*description: */ +#define TIMG_WDT_STG0_HOLD 0xFFFFFFFF +#define TIMG_WDT_STG0_HOLD_M ((TIMG_WDT_STG0_HOLD_V)<<(TIMG_WDT_STG0_HOLD_S)) +#define TIMG_WDT_STG0_HOLD_V 0xFFFFFFFF +#define TIMG_WDT_STG0_HOLD_S 0 + +#define TIMG_WDTCONFIG3_REG(i) (REG_TIMG_BASE(i) + 0x0054) +/* TIMG_WDT_STG1_HOLD : R/W ;bitpos:[31:0] ;default: 32'h7ffffff ; */ +/*description: */ +#define TIMG_WDT_STG1_HOLD 0xFFFFFFFF +#define TIMG_WDT_STG1_HOLD_M ((TIMG_WDT_STG1_HOLD_V)<<(TIMG_WDT_STG1_HOLD_S)) +#define TIMG_WDT_STG1_HOLD_V 0xFFFFFFFF +#define TIMG_WDT_STG1_HOLD_S 0 + +#define TIMG_WDTCONFIG4_REG(i) (REG_TIMG_BASE(i) + 0x0058) +/* TIMG_WDT_STG2_HOLD : R/W ;bitpos:[31:0] ;default: 32'hfffff ; */ +/*description: */ +#define TIMG_WDT_STG2_HOLD 0xFFFFFFFF +#define TIMG_WDT_STG2_HOLD_M ((TIMG_WDT_STG2_HOLD_V)<<(TIMG_WDT_STG2_HOLD_S)) +#define TIMG_WDT_STG2_HOLD_V 0xFFFFFFFF +#define TIMG_WDT_STG2_HOLD_S 0 + +#define TIMG_WDTCONFIG5_REG(i) (REG_TIMG_BASE(i) + 0x005c) +/* TIMG_WDT_STG3_HOLD : R/W ;bitpos:[31:0] ;default: 32'hfffff ; */ +/*description: */ +#define TIMG_WDT_STG3_HOLD 0xFFFFFFFF +#define TIMG_WDT_STG3_HOLD_M ((TIMG_WDT_STG3_HOLD_V)<<(TIMG_WDT_STG3_HOLD_S)) +#define TIMG_WDT_STG3_HOLD_V 0xFFFFFFFF +#define TIMG_WDT_STG3_HOLD_S 0 + +#define TIMG_WDTFEED_REG(i) (REG_TIMG_BASE(i) + 0x0060) +/* TIMG_WDT_FEED : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_WDT_FEED 0xFFFFFFFF +#define TIMG_WDT_FEED_M ((TIMG_WDT_FEED_V)<<(TIMG_WDT_FEED_S)) +#define TIMG_WDT_FEED_V 0xFFFFFFFF +#define TIMG_WDT_FEED_S 0 + +#define TIMG_WDTWPROTECT_REG(i) (REG_TIMG_BASE(i) + 0x0064) +/* TIMG_WDT_WKEY : R/W ;bitpos:[31:0] ;default: 32'h50d83aa1 ; */ +/*description: */ +#define TIMG_WDT_WKEY 0xFFFFFFFF +#define TIMG_WDT_WKEY_M ((TIMG_WDT_WKEY_V)<<(TIMG_WDT_WKEY_S)) +#define TIMG_WDT_WKEY_V 0xFFFFFFFF +#define TIMG_WDT_WKEY_S 0 + +#define TIMG_RTCCALICFG_REG(i) (REG_TIMG_BASE(i) + 0x0068) +/* TIMG_RTC_CALI_START : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_RTC_CALI_START (BIT(31)) +#define TIMG_RTC_CALI_START_M (BIT(31)) +#define TIMG_RTC_CALI_START_V 0x1 +#define TIMG_RTC_CALI_START_S 31 +/* TIMG_RTC_CALI_MAX : R/W ;bitpos:[30:16] ;default: 15'h1 ; */ +/*description: */ +#define TIMG_RTC_CALI_MAX 0x00007FFF +#define TIMG_RTC_CALI_MAX_M ((TIMG_RTC_CALI_MAX_V)<<(TIMG_RTC_CALI_MAX_S)) +#define TIMG_RTC_CALI_MAX_V 0x7FFF +#define TIMG_RTC_CALI_MAX_S 16 +/* TIMG_RTC_CALI_RDY : RO ;bitpos:[15] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_RTC_CALI_RDY (BIT(15)) +#define TIMG_RTC_CALI_RDY_M (BIT(15)) +#define TIMG_RTC_CALI_RDY_V 0x1 +#define TIMG_RTC_CALI_RDY_S 15 +/* TIMG_RTC_CALI_CLK_SEL : R/W ;bitpos:[14:13] ;default: 2'h1 ; */ +/*description: */ +#define TIMG_RTC_CALI_CLK_SEL 0x00000003 +#define TIMG_RTC_CALI_CLK_SEL_M ((TIMG_RTC_CALI_CLK_SEL_V)<<(TIMG_RTC_CALI_CLK_SEL_S)) +#define TIMG_RTC_CALI_CLK_SEL_V 0x3 +#define TIMG_RTC_CALI_CLK_SEL_S 13 +/* TIMG_RTC_CALI_START_CYCLING : R/W ;bitpos:[12] ;default: 1'd1 ; */ +/*description: */ +#define TIMG_RTC_CALI_START_CYCLING (BIT(12)) +#define TIMG_RTC_CALI_START_CYCLING_M (BIT(12)) +#define TIMG_RTC_CALI_START_CYCLING_V 0x1 +#define TIMG_RTC_CALI_START_CYCLING_S 12 + +#define TIMG_RTCCALICFG1_REG(i) (REG_TIMG_BASE(i) + 0x006c) +/* TIMG_RTC_CALI_VALUE : RO ;bitpos:[31:7] ;default: 25'h0 ; */ +/*description: */ +#define TIMG_RTC_CALI_VALUE 0x01FFFFFF +#define TIMG_RTC_CALI_VALUE_M ((TIMG_RTC_CALI_VALUE_V)<<(TIMG_RTC_CALI_VALUE_S)) +#define TIMG_RTC_CALI_VALUE_V 0x1FFFFFF +#define TIMG_RTC_CALI_VALUE_S 7 +/* TIMG_RTC_CALI_CYCLING_DATA_VLD : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define TIMG_RTC_CALI_CYCLING_DATA_VLD (BIT(0)) +#define TIMG_RTC_CALI_CYCLING_DATA_VLD_M (BIT(0)) +#define TIMG_RTC_CALI_CYCLING_DATA_VLD_V 0x1 +#define TIMG_RTC_CALI_CYCLING_DATA_VLD_S 0 + +#define TIMG_LACTCONFIG_REG(i) (REG_TIMG_BASE(i) + 0x0070) +/* TIMG_LACT_EN : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_LACT_EN (BIT(31)) +#define TIMG_LACT_EN_M (BIT(31)) +#define TIMG_LACT_EN_V 0x1 +#define TIMG_LACT_EN_S 31 +/* TIMG_LACT_INCREASE : R/W ;bitpos:[30] ;default: 1'h1 ; */ +/*description: */ +#define TIMG_LACT_INCREASE (BIT(30)) +#define TIMG_LACT_INCREASE_M (BIT(30)) +#define TIMG_LACT_INCREASE_V 0x1 +#define TIMG_LACT_INCREASE_S 30 +/* TIMG_LACT_AUTORELOAD : R/W ;bitpos:[29] ;default: 1'h1 ; */ +/*description: */ +#define TIMG_LACT_AUTORELOAD (BIT(29)) +#define TIMG_LACT_AUTORELOAD_M (BIT(29)) +#define TIMG_LACT_AUTORELOAD_V 0x1 +#define TIMG_LACT_AUTORELOAD_S 29 +/* TIMG_LACT_DIVIDER : R/W ;bitpos:[28:13] ;default: 16'h1 ; */ +/*description: */ +#define TIMG_LACT_DIVIDER 0x0000FFFF +#define TIMG_LACT_DIVIDER_M ((TIMG_LACT_DIVIDER_V)<<(TIMG_LACT_DIVIDER_S)) +#define TIMG_LACT_DIVIDER_V 0xFFFF +#define TIMG_LACT_DIVIDER_S 13 +/* TIMG_LACT_EDGE_INT_EN : R/W ;bitpos:[12] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_LACT_EDGE_INT_EN (BIT(12)) +#define TIMG_LACT_EDGE_INT_EN_M (BIT(12)) +#define TIMG_LACT_EDGE_INT_EN_V 0x1 +#define TIMG_LACT_EDGE_INT_EN_S 12 +/* TIMG_LACT_LEVEL_INT_EN : R/W ;bitpos:[11] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_LACT_LEVEL_INT_EN (BIT(11)) +#define TIMG_LACT_LEVEL_INT_EN_M (BIT(11)) +#define TIMG_LACT_LEVEL_INT_EN_V 0x1 +#define TIMG_LACT_LEVEL_INT_EN_S 11 +/* TIMG_LACT_ALARM_EN : R/W ;bitpos:[10] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_LACT_ALARM_EN (BIT(10)) +#define TIMG_LACT_ALARM_EN_M (BIT(10)) +#define TIMG_LACT_ALARM_EN_V 0x1 +#define TIMG_LACT_ALARM_EN_S 10 +/* TIMG_LACT_LAC_EN : R/W ;bitpos:[9] ;default: 1'h1 ; */ +/*description: */ +#define TIMG_LACT_LAC_EN (BIT(9)) +#define TIMG_LACT_LAC_EN_M (BIT(9)) +#define TIMG_LACT_LAC_EN_V 0x1 +#define TIMG_LACT_LAC_EN_S 9 +/* TIMG_LACT_CPST_EN : R/W ;bitpos:[8] ;default: 1'h1 ; */ +/*description: */ +#define TIMG_LACT_CPST_EN (BIT(8)) +#define TIMG_LACT_CPST_EN_M (BIT(8)) +#define TIMG_LACT_CPST_EN_V 0x1 +#define TIMG_LACT_CPST_EN_S 8 +/* TIMG_LACT_RTC_ONLY : R/W ;bitpos:[7] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_LACT_RTC_ONLY (BIT(7)) +#define TIMG_LACT_RTC_ONLY_M (BIT(7)) +#define TIMG_LACT_RTC_ONLY_V 0x1 +#define TIMG_LACT_RTC_ONLY_S 7 +/* TIMG_LACT_USE_REFTICK : R/W ;bitpos:[6] ;default: 1'd0 ; */ +/*description: */ +#define TIMG_LACT_USE_REFTICK (BIT(6)) +#define TIMG_LACT_USE_REFTICK_M (BIT(6)) +#define TIMG_LACT_USE_REFTICK_V 0x1 +#define TIMG_LACT_USE_REFTICK_S 6 + +#define TIMG_LACTRTC_REG(i) (REG_TIMG_BASE(i) + 0x0074) +/* TIMG_LACT_RTC_STEP_LEN : R/W ;bitpos:[31:6] ;default: 26'h0 ; */ +/*description: */ +#define TIMG_LACT_RTC_STEP_LEN 0x03FFFFFF +#define TIMG_LACT_RTC_STEP_LEN_M ((TIMG_LACT_RTC_STEP_LEN_V)<<(TIMG_LACT_RTC_STEP_LEN_S)) +#define TIMG_LACT_RTC_STEP_LEN_V 0x3FFFFFF +#define TIMG_LACT_RTC_STEP_LEN_S 6 + +#define TIMG_LACTLO_REG(i) (REG_TIMG_BASE(i) + 0x0078) +/* TIMG_LACT_LO : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_LACT_LO 0xFFFFFFFF +#define TIMG_LACT_LO_M ((TIMG_LACT_LO_V)<<(TIMG_LACT_LO_S)) +#define TIMG_LACT_LO_V 0xFFFFFFFF +#define TIMG_LACT_LO_S 0 + +#define TIMG_LACTHI_REG(i) (REG_TIMG_BASE(i) + 0x007c) +/* TIMG_LACT_HI : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_LACT_HI 0xFFFFFFFF +#define TIMG_LACT_HI_M ((TIMG_LACT_HI_V)<<(TIMG_LACT_HI_S)) +#define TIMG_LACT_HI_V 0xFFFFFFFF +#define TIMG_LACT_HI_S 0 + +#define TIMG_LACTUPDATE_REG(i) (REG_TIMG_BASE(i) + 0x0080) +/* TIMG_LACT_UPDATE : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_LACT_UPDATE 0xFFFFFFFF +#define TIMG_LACT_UPDATE_M ((TIMG_LACT_UPDATE_V)<<(TIMG_LACT_UPDATE_S)) +#define TIMG_LACT_UPDATE_V 0xFFFFFFFF +#define TIMG_LACT_UPDATE_S 0 + +#define TIMG_LACTALARMLO_REG(i) (REG_TIMG_BASE(i) + 0x0084) +/* TIMG_LACT_ALARM_LO : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_LACT_ALARM_LO 0xFFFFFFFF +#define TIMG_LACT_ALARM_LO_M ((TIMG_LACT_ALARM_LO_V)<<(TIMG_LACT_ALARM_LO_S)) +#define TIMG_LACT_ALARM_LO_V 0xFFFFFFFF +#define TIMG_LACT_ALARM_LO_S 0 + +#define TIMG_LACTALARMHI_REG(i) (REG_TIMG_BASE(i) + 0x0088) +/* TIMG_LACT_ALARM_HI : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_LACT_ALARM_HI 0xFFFFFFFF +#define TIMG_LACT_ALARM_HI_M ((TIMG_LACT_ALARM_HI_V)<<(TIMG_LACT_ALARM_HI_S)) +#define TIMG_LACT_ALARM_HI_V 0xFFFFFFFF +#define TIMG_LACT_ALARM_HI_S 0 + +#define TIMG_LACTLOADLO_REG(i) (REG_TIMG_BASE(i) + 0x008c) +/* TIMG_LACT_LOAD_LO : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_LACT_LOAD_LO 0xFFFFFFFF +#define TIMG_LACT_LOAD_LO_M ((TIMG_LACT_LOAD_LO_V)<<(TIMG_LACT_LOAD_LO_S)) +#define TIMG_LACT_LOAD_LO_V 0xFFFFFFFF +#define TIMG_LACT_LOAD_LO_S 0 + +#define TIMG_LACTLOADHI_REG(i) (REG_TIMG_BASE(i) + 0x0090) +/* TIMG_LACT_LOAD_HI : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_LACT_LOAD_HI 0xFFFFFFFF +#define TIMG_LACT_LOAD_HI_M ((TIMG_LACT_LOAD_HI_V)<<(TIMG_LACT_LOAD_HI_S)) +#define TIMG_LACT_LOAD_HI_V 0xFFFFFFFF +#define TIMG_LACT_LOAD_HI_S 0 + +#define TIMG_LACTLOAD_REG(i) (REG_TIMG_BASE(i) + 0x0094) +/* TIMG_LACT_LOAD : WO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define TIMG_LACT_LOAD 0xFFFFFFFF +#define TIMG_LACT_LOAD_M ((TIMG_LACT_LOAD_V)<<(TIMG_LACT_LOAD_S)) +#define TIMG_LACT_LOAD_V 0xFFFFFFFF +#define TIMG_LACT_LOAD_S 0 + +#define TIMG_INT_ENA_TIMERS_REG(i) (REG_TIMG_BASE(i) + 0x0098) +/* TIMG_LACT_INT_ENA : R/W ;bitpos:[3] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_LACT_INT_ENA (BIT(3)) +#define TIMG_LACT_INT_ENA_M (BIT(3)) +#define TIMG_LACT_INT_ENA_V 0x1 +#define TIMG_LACT_INT_ENA_S 3 +/* TIMG_WDT_INT_ENA : R/W ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_WDT_INT_ENA (BIT(2)) +#define TIMG_WDT_INT_ENA_M (BIT(2)) +#define TIMG_WDT_INT_ENA_V 0x1 +#define TIMG_WDT_INT_ENA_S 2 +/* TIMG_T1_INT_ENA : R/W ;bitpos:[1] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T1_INT_ENA (BIT(1)) +#define TIMG_T1_INT_ENA_M (BIT(1)) +#define TIMG_T1_INT_ENA_V 0x1 +#define TIMG_T1_INT_ENA_S 1 +/* TIMG_T0_INT_ENA : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T0_INT_ENA (BIT(0)) +#define TIMG_T0_INT_ENA_M (BIT(0)) +#define TIMG_T0_INT_ENA_V 0x1 +#define TIMG_T0_INT_ENA_S 0 + +#define TIMG_INT_RAW_TIMERS_REG(i) (REG_TIMG_BASE(i) + 0x009c) +/* TIMG_LACT_INT_RAW : RO ;bitpos:[3] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_LACT_INT_RAW (BIT(3)) +#define TIMG_LACT_INT_RAW_M (BIT(3)) +#define TIMG_LACT_INT_RAW_V 0x1 +#define TIMG_LACT_INT_RAW_S 3 +/* TIMG_WDT_INT_RAW : RO ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_WDT_INT_RAW (BIT(2)) +#define TIMG_WDT_INT_RAW_M (BIT(2)) +#define TIMG_WDT_INT_RAW_V 0x1 +#define TIMG_WDT_INT_RAW_S 2 +/* TIMG_T1_INT_RAW : RO ;bitpos:[1] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T1_INT_RAW (BIT(1)) +#define TIMG_T1_INT_RAW_M (BIT(1)) +#define TIMG_T1_INT_RAW_V 0x1 +#define TIMG_T1_INT_RAW_S 1 +/* TIMG_T0_INT_RAW : RO ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T0_INT_RAW (BIT(0)) +#define TIMG_T0_INT_RAW_M (BIT(0)) +#define TIMG_T0_INT_RAW_V 0x1 +#define TIMG_T0_INT_RAW_S 0 + +#define TIMG_INT_ST_TIMERS_REG(i) (REG_TIMG_BASE(i) + 0x00a0) +/* TIMG_LACT_INT_ST : RO ;bitpos:[3] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_LACT_INT_ST (BIT(3)) +#define TIMG_LACT_INT_ST_M (BIT(3)) +#define TIMG_LACT_INT_ST_V 0x1 +#define TIMG_LACT_INT_ST_S 3 +/* TIMG_WDT_INT_ST : RO ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_WDT_INT_ST (BIT(2)) +#define TIMG_WDT_INT_ST_M (BIT(2)) +#define TIMG_WDT_INT_ST_V 0x1 +#define TIMG_WDT_INT_ST_S 2 +/* TIMG_T1_INT_ST : RO ;bitpos:[1] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T1_INT_ST (BIT(1)) +#define TIMG_T1_INT_ST_M (BIT(1)) +#define TIMG_T1_INT_ST_V 0x1 +#define TIMG_T1_INT_ST_S 1 +/* TIMG_T0_INT_ST : RO ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T0_INT_ST (BIT(0)) +#define TIMG_T0_INT_ST_M (BIT(0)) +#define TIMG_T0_INT_ST_V 0x1 +#define TIMG_T0_INT_ST_S 0 + +#define TIMG_INT_CLR_TIMERS_REG(i) (REG_TIMG_BASE(i) + 0x00a4) +/* TIMG_LACT_INT_CLR : WO ;bitpos:[3] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_LACT_INT_CLR (BIT(3)) +#define TIMG_LACT_INT_CLR_M (BIT(3)) +#define TIMG_LACT_INT_CLR_V 0x1 +#define TIMG_LACT_INT_CLR_S 3 +/* TIMG_WDT_INT_CLR : WO ;bitpos:[2] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_WDT_INT_CLR (BIT(2)) +#define TIMG_WDT_INT_CLR_M (BIT(2)) +#define TIMG_WDT_INT_CLR_V 0x1 +#define TIMG_WDT_INT_CLR_S 2 +/* TIMG_T1_INT_CLR : WO ;bitpos:[1] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T1_INT_CLR (BIT(1)) +#define TIMG_T1_INT_CLR_M (BIT(1)) +#define TIMG_T1_INT_CLR_V 0x1 +#define TIMG_T1_INT_CLR_S 1 +/* TIMG_T0_INT_CLR : WO ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_T0_INT_CLR (BIT(0)) +#define TIMG_T0_INT_CLR_M (BIT(0)) +#define TIMG_T0_INT_CLR_V 0x1 +#define TIMG_T0_INT_CLR_S 0 + +#define TIMG_RTCCALICFG2_REG(i) (REG_TIMG_BASE(i) + 0x00a8) +/* TIMG_RTC_CALI_TIMEOUT_THRES : R/W ;bitpos:[31:7] ;default: 25'h1ffffff ; */ +/*description: timeout if cali value counts over threshold*/ +#define TIMG_RTC_CALI_TIMEOUT_THRES 0x01FFFFFF +#define TIMG_RTC_CALI_TIMEOUT_THRES_M ((TIMG_RTC_CALI_TIMEOUT_THRES_V)<<(TIMG_RTC_CALI_TIMEOUT_THRES_S)) +#define TIMG_RTC_CALI_TIMEOUT_THRES_V 0x1FFFFFF +#define TIMG_RTC_CALI_TIMEOUT_THRES_S 7 +/* TIMG_RTC_CALI_TIMEOUT_RST_CNT : R/W ;bitpos:[6:3] ;default: 4'd3 ; */ +/*description: Cycles that release calibration timeout reset*/ +#define TIMG_RTC_CALI_TIMEOUT_RST_CNT 0x0000000F +#define TIMG_RTC_CALI_TIMEOUT_RST_CNT_M ((TIMG_RTC_CALI_TIMEOUT_RST_CNT_V)<<(TIMG_RTC_CALI_TIMEOUT_RST_CNT_S)) +#define TIMG_RTC_CALI_TIMEOUT_RST_CNT_V 0xF +#define TIMG_RTC_CALI_TIMEOUT_RST_CNT_S 3 +/* TIMG_RTC_CALI_TIMEOUT : RO ;bitpos:[0] ;default: 1'h0 ; */ +/*description: timeout indicator*/ +#define TIMG_RTC_CALI_TIMEOUT (BIT(0)) +#define TIMG_RTC_CALI_TIMEOUT_M (BIT(0)) +#define TIMG_RTC_CALI_TIMEOUT_V 0x1 +#define TIMG_RTC_CALI_TIMEOUT_S 0 + +#define TIMG_NTIMERS_DATE_REG(i) (REG_TIMG_BASE(i) + 0x00f8) +/* TIMG_NTIMERS_DATE : R/W ;bitpos:[27:0] ;default: 28'h1810190 ; */ +/*description: */ +#define TIMG_NTIMERS_DATE 0x0FFFFFFF +#define TIMG_NTIMERS_DATE_M ((TIMG_NTIMERS_DATE_V)<<(TIMG_NTIMERS_DATE_S)) +#define TIMG_NTIMERS_DATE_V 0xFFFFFFF +#define TIMG_NTIMERS_DATE_S 0 + +#define TIMG_CLK_REG(i) (REG_TIMG_BASE(i) + 0x00fc) +/* TIMG_CLK_EN : R/W ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define TIMG_CLK_EN (BIT(31)) +#define TIMG_CLK_EN_M (BIT(31)) +#define TIMG_CLK_EN_V 0x1 +#define TIMG_CLK_EN_S 31 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_TIMG_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/timer_group_struct.h b/components/soc/esp32s2beta/include/soc/timer_group_struct.h new file mode 100644 index 0000000000..4240d41cf3 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/timer_group_struct.h @@ -0,0 +1,221 @@ +// Copyright 2017-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. +#ifndef _SOC_TIMG_STRUCT_H_ +#define _SOC_TIMG_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + struct { + union { + struct { + uint32_t reserved0: 9; + uint32_t use_xtal: 1; + uint32_t alarm_en: 1; + uint32_t level_int_en: 1; + uint32_t edge_int_en: 1; + uint32_t divider: 16; + uint32_t autoreload: 1; + uint32_t increase: 1; + uint32_t enable: 1; + }; + uint32_t val; + } config; + uint32_t cnt_low; /**/ + uint32_t cnt_high; /**/ + union { + struct { + uint32_t reserved0: 31; + uint32_t update: 1; + }; + uint32_t val; + } update; + uint32_t alarm_low; /**/ + uint32_t alarm_high; /**/ + uint32_t load_low; /**/ + uint32_t load_high; /**/ + uint32_t reload; /**/ + } hw_timer[2]; + union { + struct { + uint32_t reserved0: 12; + uint32_t appcpu_reset_en: 1; + uint32_t procpu_reset_en: 1; + uint32_t flashboot_mod_en: 1; + uint32_t sys_reset_length: 3; + uint32_t cpu_reset_length: 3; + uint32_t level_int_en: 1; + uint32_t edge_int_en: 1; + uint32_t stg3: 2; + uint32_t stg2: 2; + uint32_t stg1: 2; + uint32_t stg0: 2; + uint32_t en: 1; + }; + uint32_t val; + } wdt_config0; + union { + struct { + uint32_t reserved0: 16; + uint32_t clk_prescale: 16; + }; + uint32_t val; + } wdt_config1; + uint32_t wdt_config2; /**/ + uint32_t wdt_config3; /**/ + uint32_t wdt_config4; /**/ + uint32_t wdt_config5; /**/ + uint32_t wdt_feed; /**/ + uint32_t wdt_wprotect; /**/ + union { + struct { + uint32_t reserved0: 12; + uint32_t start_cycling: 1; + uint32_t clk_sel: 2; + uint32_t rdy: 1; + uint32_t max: 15; + uint32_t start: 1; + }; + uint32_t val; + } rtc_cali_cfg; + union { + struct { + uint32_t reserved0: 7; + uint32_t value: 25; + }; + uint32_t val; + } rtc_cali_cfg1; + union { + struct { + uint32_t reserved0: 6; + uint32_t use_reftick: 1; + uint32_t rtc_only: 1; + uint32_t cpst_en: 1; + uint32_t lac_en: 1; + uint32_t alarm_en: 1; + uint32_t level_int_en: 1; + uint32_t edge_int_en: 1; + uint32_t divider: 16; + uint32_t autoreload: 1; + uint32_t increase: 1; + uint32_t en: 1; + }; + uint32_t val; + } lactconfig; + union { + struct { + uint32_t reserved0: 6; + uint32_t step_len: 26; + }; + uint32_t val; + } lactrtc; + uint32_t lactlo; /**/ + uint32_t lacthi; /**/ + uint32_t lactupdate; /**/ + uint32_t lactalarmlo; /**/ + uint32_t lactalarmhi; /**/ + uint32_t lactloadlo; /**/ + uint32_t lactloadhi; /**/ + uint32_t lactload; /**/ + union { + struct { + uint32_t t0: 1; + uint32_t t1: 1; + uint32_t wdt: 1; + uint32_t lact: 1; + uint32_t reserved4: 28; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t t0: 1; + uint32_t t1: 1; + uint32_t wdt: 1; + uint32_t lact: 1; + uint32_t reserved4: 28; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t t0: 1; + uint32_t t1: 1; + uint32_t wdt: 1; + uint32_t lact: 1; + uint32_t reserved4: 28; + }; + uint32_t val; + } int_st; + union { + struct { + uint32_t t0: 1; + uint32_t t1: 1; + uint32_t wdt: 1; + uint32_t lact: 1; + uint32_t reserved4: 28; + }; + uint32_t val; + } int_clr; + union { + struct { + uint32_t timeout: 1; /*timeout indicator*/ + uint32_t reserved1: 2; + uint32_t timeout_rst_cnt: 4; /*Cycles that release calibration timeout reset*/ + uint32_t timeout_thres: 25; /*timeout if cali value counts over threshold*/ + }; + uint32_t val; + } rtc_cali_cfg2; + uint32_t reserved_ac; + uint32_t reserved_b0; + uint32_t reserved_b4; + uint32_t reserved_b8; + uint32_t reserved_bc; + uint32_t reserved_c0; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + union { + struct { + uint32_t date: 28; + uint32_t reserved28: 4; + }; + uint32_t val; + } timg_date; + union { + struct { + uint32_t reserved0: 31; + uint32_t en: 1; + }; + uint32_t val; + } clk; +} timg_dev_t; +extern timg_dev_t TIMERG0; +extern timg_dev_t TIMERG1; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_TIMG_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/touch_channel.h b/components/soc/esp32s2beta/include/soc/touch_channel.h new file mode 100644 index 0000000000..0ee4389118 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/touch_channel.h @@ -0,0 +1,61 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _SOC_TOUCH_CHANNEL_H +#define _SOC_TOUCH_CHANNEL_H + +//Touch channels +#define TOUCH_PAD_GPIO1_CHANNEL TOUCH_PAD_NUM1 +#define TOUCH_PAD_NUM1_GPIO_NUM 1 + +#define TOUCH_PAD_GPIO2_CHANNEL TOUCH_PAD_NUM2 +#define TOUCH_PAD_NUM2_GPIO_NUM 2 + +#define TOUCH_PAD_GPIO3_CHANNEL TOUCH_PAD_NUM3 +#define TOUCH_PAD_NUM3_GPIO_NUM 3 + +#define TOUCH_PAD_GPIO4_CHANNEL TOUCH_PAD_NUM4 +#define TOUCH_PAD_NUM4_GPIO_NUM 4 + +#define TOUCH_PAD_GPIO5_CHANNEL TOUCH_PAD_NUM5 +#define TOUCH_PAD_NUM5_GPIO_NUM 5 + +#define TOUCH_PAD_GPIO6_CHANNEL TOUCH_PAD_NUM6 +#define TOUCH_PAD_NUM6_GPIO_NUM 6 + +#define TOUCH_PAD_GPIO7_CHANNEL TOUCH_PAD_NUM7 +#define TOUCH_PAD_NUM7_GPIO_NUM 7 + +#define TOUCH_PAD_GPIO8_CHANNEL TOUCH_PAD_NUM8 +#define TOUCH_PAD_NUM8_GPIO_NUM 8 + +#define TOUCH_PAD_GPIO9_CHANNEL TOUCH_PAD_NUM9 +#define TOUCH_PAD_NUM9_GPIO_NUM 9 + +#define TOUCH_PAD_GPIO10_CHANNEL TOUCH_PAD_NUM10 +#define TOUCH_PAD_NUM10_GPIO_NUM 10 + +#define TOUCH_PAD_GPIO11_CHANNEL TOUCH_PAD_NUM11 +#define TOUCH_PAD_NUM11_GPIO_NUM 11 + +#define TOUCH_PAD_GPIO12_CHANNEL TOUCH_PAD_NUM12 +#define TOUCH_PAD_NUM12_GPIO_NUM 12 + +#define TOUCH_PAD_GPIO13_CHANNEL TOUCH_PAD_NUM13 +#define TOUCH_PAD_NUM13_GPIO_NUM 13 + +#define TOUCH_PAD_GPIO14_CHANNEL TOUCH_PAD_NUM14 +#define TOUCH_PAD_NUM14_GPIO_NUM 14 + +#endif diff --git a/components/soc/esp32s2beta/include/soc/uart_caps.h b/components/soc/esp32s2beta/include/soc/uart_caps.h new file mode 100644 index 0000000000..1981f7ebf1 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/uart_caps.h @@ -0,0 +1,25 @@ +// Copyright 2017-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. + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#define SOC_UART_NUM 2 + +#ifdef __cplusplus +} +#endif diff --git a/components/soc/esp32s2beta/include/soc/uart_channel.h b/components/soc/esp32s2beta/include/soc/uart_channel.h new file mode 100644 index 0000000000..5b8dc56d5a --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/uart_channel.h @@ -0,0 +1,61 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef _SOC_UART_CHANNEL_H +#define _SOC_UART_CHANNEL_H + +//UART channels +#define UART_GPIO1_DIRECT_CHANNEL UART_NUM_0 +#define UART_NUM_0_TXD_DIRECT_GPIO_NUM 1 +#define UART_GPIO3_DIRECT_CHANNEL UART_NUM_0 +#define UART_NUM_0_RXD_DIRECT_GPIO_NUM 3 +#define UART_GPIO19_DIRECT_CHANNEL UART_NUM_0 +#define UART_NUM_0_CTS_DIRECT_GPIO_NUM 19 +#define UART_GPIO22_DIRECT_CHANNEL UART_NUM_0 +#define UART_NUM_0_RTS_DIRECT_GPIO_NUM 22 + +#define UART_TXD_GPIO1_DIRECT_CHANNEL UART_GPIO1_DIRECT_CHANNEL +#define UART_RXD_GPIO3_DIRECT_CHANNEL UART_GPIO3_DIRECT_CHANNEL +#define UART_CTS_GPIO19_DIRECT_CHANNEL UART_GPIO19_DIRECT_CHANNEL +#define UART_RTS_GPIO22_DIRECT_CHANNEL UART_GPIO22_DIRECT_CHANNEL + +#define UART_GPIO10_DIRECT_CHANNEL UART_NUM_1 +#define UART_NUM_1_TXD_DIRECT_GPIO_NUM 10 +#define UART_GPIO9_DIRECT_CHANNEL UART_NUM_1 +#define UART_NUM_1_RXD_DIRECT_GPIO_NUM 9 +#define UART_GPIO6_DIRECT_CHANNEL UART_NUM_1 +#define UART_NUM_1_CTS_DIRECT_GPIO_NUM 6 +#define UART_GPIO11_DIRECT_CHANNEL UART_NUM_1 +#define UART_NUM_1_RTS_DIRECT_GPIO_NUM 11 + +#define UART_TXD_GPIO10_DIRECT_CHANNEL UART_GPIO10_DIRECT_CHANNEL +#define UART_RXD_GPIO9_DIRECT_CHANNEL UART_GPIO9_DIRECT_CHANNEL +#define UART_CTS_GPIO6_DIRECT_CHANNEL UART_GPIO6_DIRECT_CHANNEL +#define UART_RTS_GPIO11_DIRECT_CHANNEL UART_GPIO11_DIRECT_CHANNEL + +#define UART_GPIO17_DIRECT_CHANNEL UART_NUM_2 +#define UART_NUM_2_TXD_DIRECT_GPIO_NUM 17 +#define UART_GPIO16_DIRECT_CHANNEL UART_NUM_2 +#define UART_NUM_2_RXD_DIRECT_GPIO_NUM 16 +#define UART_GPIO8_DIRECT_CHANNEL UART_NUM_2 +#define UART_NUM_2_CTS_DIRECT_GPIO_NUM 8 +#define UART_GPIO7_DIRECT_CHANNEL UART_NUM_2 +#define UART_NUM_2_RTS_DIRECT_GPIO_NUM 7 + +#define UART_TXD_GPIO17_DIRECT_CHANNEL UART_GPIO17_DIRECT_CHANNEL +#define UART_RXD_GPIO16_DIRECT_CHANNEL UART_GPIO16_DIRECT_CHANNEL +#define UART_CTS_GPIO8_DIRECT_CHANNEL UART_GPIO8_DIRECT_CHANNEL +#define UART_RTS_GPIO7_DIRECT_CHANNEL UART_GPIO7_DIRECT_CHANNEL + +#endif diff --git a/components/soc/esp32s2beta/include/soc/uart_reg.h b/components/soc/esp32s2beta/include/soc/uart_reg.h new file mode 100644 index 0000000000..ee6ffdd421 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/uart_reg.h @@ -0,0 +1,1100 @@ +// Copyright 2017-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_UART_REG_H_ +#define _SOC_UART_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define UART_FIFO_REG(i) (REG_UART_BASE(i) + 0x0) +/* UART_RXFIFO_RD_BYTE : RO ;bitpos:[7:0] ;default: 8'b0 ; */ +/*description: */ +#define UART_RXFIFO_RD_BYTE 0x000000FF +#define UART_RXFIFO_RD_BYTE_M ((UART_RXFIFO_RD_BYTE_V)<<(UART_RXFIFO_RD_BYTE_S)) +#define UART_RXFIFO_RD_BYTE_V 0xFF +#define UART_RXFIFO_RD_BYTE_S 0 + +#define UART_INT_RAW_REG(i) (REG_UART_BASE(i) + 0x4) +/* UART_WAKEUP_INT_RAW : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define UART_WAKEUP_INT_RAW (BIT(19)) +#define UART_WAKEUP_INT_RAW_M (BIT(19)) +#define UART_WAKEUP_INT_RAW_V 0x1 +#define UART_WAKEUP_INT_RAW_S 19 +/* UART_AT_CMD_CHAR_DET_INT_RAW : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define UART_AT_CMD_CHAR_DET_INT_RAW (BIT(18)) +#define UART_AT_CMD_CHAR_DET_INT_RAW_M (BIT(18)) +#define UART_AT_CMD_CHAR_DET_INT_RAW_V 0x1 +#define UART_AT_CMD_CHAR_DET_INT_RAW_S 18 +/* UART_RS485_CLASH_INT_RAW : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_CLASH_INT_RAW (BIT(17)) +#define UART_RS485_CLASH_INT_RAW_M (BIT(17)) +#define UART_RS485_CLASH_INT_RAW_V 0x1 +#define UART_RS485_CLASH_INT_RAW_S 17 +/* UART_RS485_FRM_ERR_INT_RAW : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_FRM_ERR_INT_RAW (BIT(16)) +#define UART_RS485_FRM_ERR_INT_RAW_M (BIT(16)) +#define UART_RS485_FRM_ERR_INT_RAW_V 0x1 +#define UART_RS485_FRM_ERR_INT_RAW_S 16 +/* UART_RS485_PARITY_ERR_INT_RAW : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_PARITY_ERR_INT_RAW (BIT(15)) +#define UART_RS485_PARITY_ERR_INT_RAW_M (BIT(15)) +#define UART_RS485_PARITY_ERR_INT_RAW_V 0x1 +#define UART_RS485_PARITY_ERR_INT_RAW_S 15 +/* UART_TX_DONE_INT_RAW : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_DONE_INT_RAW (BIT(14)) +#define UART_TX_DONE_INT_RAW_M (BIT(14)) +#define UART_TX_DONE_INT_RAW_V 0x1 +#define UART_TX_DONE_INT_RAW_S 14 +/* UART_TX_BRK_IDLE_DONE_INT_RAW : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_BRK_IDLE_DONE_INT_RAW (BIT(13)) +#define UART_TX_BRK_IDLE_DONE_INT_RAW_M (BIT(13)) +#define UART_TX_BRK_IDLE_DONE_INT_RAW_V 0x1 +#define UART_TX_BRK_IDLE_DONE_INT_RAW_S 13 +/* UART_TX_BRK_DONE_INT_RAW : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_BRK_DONE_INT_RAW (BIT(12)) +#define UART_TX_BRK_DONE_INT_RAW_M (BIT(12)) +#define UART_TX_BRK_DONE_INT_RAW_V 0x1 +#define UART_TX_BRK_DONE_INT_RAW_S 12 +/* UART_GLITCH_DET_INT_RAW : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define UART_GLITCH_DET_INT_RAW (BIT(11)) +#define UART_GLITCH_DET_INT_RAW_M (BIT(11)) +#define UART_GLITCH_DET_INT_RAW_V 0x1 +#define UART_GLITCH_DET_INT_RAW_S 11 +/* UART_SW_XOFF_INT_RAW : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_XOFF_INT_RAW (BIT(10)) +#define UART_SW_XOFF_INT_RAW_M (BIT(10)) +#define UART_SW_XOFF_INT_RAW_V 0x1 +#define UART_SW_XOFF_INT_RAW_S 10 +/* UART_SW_XON_INT_RAW : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_XON_INT_RAW (BIT(9)) +#define UART_SW_XON_INT_RAW_M (BIT(9)) +#define UART_SW_XON_INT_RAW_V 0x1 +#define UART_SW_XON_INT_RAW_S 9 +/* UART_RXFIFO_TOUT_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_TOUT_INT_RAW (BIT(8)) +#define UART_RXFIFO_TOUT_INT_RAW_M (BIT(8)) +#define UART_RXFIFO_TOUT_INT_RAW_V 0x1 +#define UART_RXFIFO_TOUT_INT_RAW_S 8 +/* UART_BRK_DET_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UART_BRK_DET_INT_RAW (BIT(7)) +#define UART_BRK_DET_INT_RAW_M (BIT(7)) +#define UART_BRK_DET_INT_RAW_V 0x1 +#define UART_BRK_DET_INT_RAW_S 7 +/* UART_CTS_CHG_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UART_CTS_CHG_INT_RAW (BIT(6)) +#define UART_CTS_CHG_INT_RAW_M (BIT(6)) +#define UART_CTS_CHG_INT_RAW_V 0x1 +#define UART_CTS_CHG_INT_RAW_S 6 +/* UART_DSR_CHG_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UART_DSR_CHG_INT_RAW (BIT(5)) +#define UART_DSR_CHG_INT_RAW_M (BIT(5)) +#define UART_DSR_CHG_INT_RAW_V 0x1 +#define UART_DSR_CHG_INT_RAW_S 5 +/* UART_RXFIFO_OVF_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_OVF_INT_RAW (BIT(4)) +#define UART_RXFIFO_OVF_INT_RAW_M (BIT(4)) +#define UART_RXFIFO_OVF_INT_RAW_V 0x1 +#define UART_RXFIFO_OVF_INT_RAW_S 4 +/* UART_FRM_ERR_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UART_FRM_ERR_INT_RAW (BIT(3)) +#define UART_FRM_ERR_INT_RAW_M (BIT(3)) +#define UART_FRM_ERR_INT_RAW_V 0x1 +#define UART_FRM_ERR_INT_RAW_S 3 +/* UART_PARITY_ERR_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UART_PARITY_ERR_INT_RAW (BIT(2)) +#define UART_PARITY_ERR_INT_RAW_M (BIT(2)) +#define UART_PARITY_ERR_INT_RAW_V 0x1 +#define UART_PARITY_ERR_INT_RAW_S 2 +/* UART_TXFIFO_EMPTY_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UART_TXFIFO_EMPTY_INT_RAW (BIT(1)) +#define UART_TXFIFO_EMPTY_INT_RAW_M (BIT(1)) +#define UART_TXFIFO_EMPTY_INT_RAW_V 0x1 +#define UART_TXFIFO_EMPTY_INT_RAW_S 1 +/* UART_RXFIFO_FULL_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_FULL_INT_RAW (BIT(0)) +#define UART_RXFIFO_FULL_INT_RAW_M (BIT(0)) +#define UART_RXFIFO_FULL_INT_RAW_V 0x1 +#define UART_RXFIFO_FULL_INT_RAW_S 0 + +#define UART_INT_ST_REG(i) (REG_UART_BASE(i) + 0x8) +/* UART_WAKEUP_INT_ST : RO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define UART_WAKEUP_INT_ST (BIT(19)) +#define UART_WAKEUP_INT_ST_M (BIT(19)) +#define UART_WAKEUP_INT_ST_V 0x1 +#define UART_WAKEUP_INT_ST_S 19 +/* UART_AT_CMD_CHAR_DET_INT_ST : RO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define UART_AT_CMD_CHAR_DET_INT_ST (BIT(18)) +#define UART_AT_CMD_CHAR_DET_INT_ST_M (BIT(18)) +#define UART_AT_CMD_CHAR_DET_INT_ST_V 0x1 +#define UART_AT_CMD_CHAR_DET_INT_ST_S 18 +/* UART_RS485_CLASH_INT_ST : RO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_CLASH_INT_ST (BIT(17)) +#define UART_RS485_CLASH_INT_ST_M (BIT(17)) +#define UART_RS485_CLASH_INT_ST_V 0x1 +#define UART_RS485_CLASH_INT_ST_S 17 +/* UART_RS485_FRM_ERR_INT_ST : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_FRM_ERR_INT_ST (BIT(16)) +#define UART_RS485_FRM_ERR_INT_ST_M (BIT(16)) +#define UART_RS485_FRM_ERR_INT_ST_V 0x1 +#define UART_RS485_FRM_ERR_INT_ST_S 16 +/* UART_RS485_PARITY_ERR_INT_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_PARITY_ERR_INT_ST (BIT(15)) +#define UART_RS485_PARITY_ERR_INT_ST_M (BIT(15)) +#define UART_RS485_PARITY_ERR_INT_ST_V 0x1 +#define UART_RS485_PARITY_ERR_INT_ST_S 15 +/* UART_TX_DONE_INT_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_DONE_INT_ST (BIT(14)) +#define UART_TX_DONE_INT_ST_M (BIT(14)) +#define UART_TX_DONE_INT_ST_V 0x1 +#define UART_TX_DONE_INT_ST_S 14 +/* UART_TX_BRK_IDLE_DONE_INT_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_BRK_IDLE_DONE_INT_ST (BIT(13)) +#define UART_TX_BRK_IDLE_DONE_INT_ST_M (BIT(13)) +#define UART_TX_BRK_IDLE_DONE_INT_ST_V 0x1 +#define UART_TX_BRK_IDLE_DONE_INT_ST_S 13 +/* UART_TX_BRK_DONE_INT_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_BRK_DONE_INT_ST (BIT(12)) +#define UART_TX_BRK_DONE_INT_ST_M (BIT(12)) +#define UART_TX_BRK_DONE_INT_ST_V 0x1 +#define UART_TX_BRK_DONE_INT_ST_S 12 +/* UART_GLITCH_DET_INT_ST : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define UART_GLITCH_DET_INT_ST (BIT(11)) +#define UART_GLITCH_DET_INT_ST_M (BIT(11)) +#define UART_GLITCH_DET_INT_ST_V 0x1 +#define UART_GLITCH_DET_INT_ST_S 11 +/* UART_SW_XOFF_INT_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_XOFF_INT_ST (BIT(10)) +#define UART_SW_XOFF_INT_ST_M (BIT(10)) +#define UART_SW_XOFF_INT_ST_V 0x1 +#define UART_SW_XOFF_INT_ST_S 10 +/* UART_SW_XON_INT_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_XON_INT_ST (BIT(9)) +#define UART_SW_XON_INT_ST_M (BIT(9)) +#define UART_SW_XON_INT_ST_V 0x1 +#define UART_SW_XON_INT_ST_S 9 +/* UART_RXFIFO_TOUT_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_TOUT_INT_ST (BIT(8)) +#define UART_RXFIFO_TOUT_INT_ST_M (BIT(8)) +#define UART_RXFIFO_TOUT_INT_ST_V 0x1 +#define UART_RXFIFO_TOUT_INT_ST_S 8 +/* UART_BRK_DET_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UART_BRK_DET_INT_ST (BIT(7)) +#define UART_BRK_DET_INT_ST_M (BIT(7)) +#define UART_BRK_DET_INT_ST_V 0x1 +#define UART_BRK_DET_INT_ST_S 7 +/* UART_CTS_CHG_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UART_CTS_CHG_INT_ST (BIT(6)) +#define UART_CTS_CHG_INT_ST_M (BIT(6)) +#define UART_CTS_CHG_INT_ST_V 0x1 +#define UART_CTS_CHG_INT_ST_S 6 +/* UART_DSR_CHG_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UART_DSR_CHG_INT_ST (BIT(5)) +#define UART_DSR_CHG_INT_ST_M (BIT(5)) +#define UART_DSR_CHG_INT_ST_V 0x1 +#define UART_DSR_CHG_INT_ST_S 5 +/* UART_RXFIFO_OVF_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_OVF_INT_ST (BIT(4)) +#define UART_RXFIFO_OVF_INT_ST_M (BIT(4)) +#define UART_RXFIFO_OVF_INT_ST_V 0x1 +#define UART_RXFIFO_OVF_INT_ST_S 4 +/* UART_FRM_ERR_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UART_FRM_ERR_INT_ST (BIT(3)) +#define UART_FRM_ERR_INT_ST_M (BIT(3)) +#define UART_FRM_ERR_INT_ST_V 0x1 +#define UART_FRM_ERR_INT_ST_S 3 +/* UART_PARITY_ERR_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UART_PARITY_ERR_INT_ST (BIT(2)) +#define UART_PARITY_ERR_INT_ST_M (BIT(2)) +#define UART_PARITY_ERR_INT_ST_V 0x1 +#define UART_PARITY_ERR_INT_ST_S 2 +/* UART_TXFIFO_EMPTY_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UART_TXFIFO_EMPTY_INT_ST (BIT(1)) +#define UART_TXFIFO_EMPTY_INT_ST_M (BIT(1)) +#define UART_TXFIFO_EMPTY_INT_ST_V 0x1 +#define UART_TXFIFO_EMPTY_INT_ST_S 1 +/* UART_RXFIFO_FULL_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_FULL_INT_ST (BIT(0)) +#define UART_RXFIFO_FULL_INT_ST_M (BIT(0)) +#define UART_RXFIFO_FULL_INT_ST_V 0x1 +#define UART_RXFIFO_FULL_INT_ST_S 0 + +#define UART_INT_ENA_REG(i) (REG_UART_BASE(i) + 0xC) +/* UART_WAKEUP_INT_ENA : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define UART_WAKEUP_INT_ENA (BIT(19)) +#define UART_WAKEUP_INT_ENA_M (BIT(19)) +#define UART_WAKEUP_INT_ENA_V 0x1 +#define UART_WAKEUP_INT_ENA_S 19 +/* UART_AT_CMD_CHAR_DET_INT_ENA : R/W ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define UART_AT_CMD_CHAR_DET_INT_ENA (BIT(18)) +#define UART_AT_CMD_CHAR_DET_INT_ENA_M (BIT(18)) +#define UART_AT_CMD_CHAR_DET_INT_ENA_V 0x1 +#define UART_AT_CMD_CHAR_DET_INT_ENA_S 18 +/* UART_RS485_CLASH_INT_ENA : R/W ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_CLASH_INT_ENA (BIT(17)) +#define UART_RS485_CLASH_INT_ENA_M (BIT(17)) +#define UART_RS485_CLASH_INT_ENA_V 0x1 +#define UART_RS485_CLASH_INT_ENA_S 17 +/* UART_RS485_FRM_ERR_INT_ENA : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_FRM_ERR_INT_ENA (BIT(16)) +#define UART_RS485_FRM_ERR_INT_ENA_M (BIT(16)) +#define UART_RS485_FRM_ERR_INT_ENA_V 0x1 +#define UART_RS485_FRM_ERR_INT_ENA_S 16 +/* UART_RS485_PARITY_ERR_INT_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_PARITY_ERR_INT_ENA (BIT(15)) +#define UART_RS485_PARITY_ERR_INT_ENA_M (BIT(15)) +#define UART_RS485_PARITY_ERR_INT_ENA_V 0x1 +#define UART_RS485_PARITY_ERR_INT_ENA_S 15 +/* UART_TX_DONE_INT_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_DONE_INT_ENA (BIT(14)) +#define UART_TX_DONE_INT_ENA_M (BIT(14)) +#define UART_TX_DONE_INT_ENA_V 0x1 +#define UART_TX_DONE_INT_ENA_S 14 +/* UART_TX_BRK_IDLE_DONE_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_BRK_IDLE_DONE_INT_ENA (BIT(13)) +#define UART_TX_BRK_IDLE_DONE_INT_ENA_M (BIT(13)) +#define UART_TX_BRK_IDLE_DONE_INT_ENA_V 0x1 +#define UART_TX_BRK_IDLE_DONE_INT_ENA_S 13 +/* UART_TX_BRK_DONE_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_BRK_DONE_INT_ENA (BIT(12)) +#define UART_TX_BRK_DONE_INT_ENA_M (BIT(12)) +#define UART_TX_BRK_DONE_INT_ENA_V 0x1 +#define UART_TX_BRK_DONE_INT_ENA_S 12 +/* UART_GLITCH_DET_INT_ENA : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define UART_GLITCH_DET_INT_ENA (BIT(11)) +#define UART_GLITCH_DET_INT_ENA_M (BIT(11)) +#define UART_GLITCH_DET_INT_ENA_V 0x1 +#define UART_GLITCH_DET_INT_ENA_S 11 +/* UART_SW_XOFF_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_XOFF_INT_ENA (BIT(10)) +#define UART_SW_XOFF_INT_ENA_M (BIT(10)) +#define UART_SW_XOFF_INT_ENA_V 0x1 +#define UART_SW_XOFF_INT_ENA_S 10 +/* UART_SW_XON_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_XON_INT_ENA (BIT(9)) +#define UART_SW_XON_INT_ENA_M (BIT(9)) +#define UART_SW_XON_INT_ENA_V 0x1 +#define UART_SW_XON_INT_ENA_S 9 +/* UART_RXFIFO_TOUT_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_TOUT_INT_ENA (BIT(8)) +#define UART_RXFIFO_TOUT_INT_ENA_M (BIT(8)) +#define UART_RXFIFO_TOUT_INT_ENA_V 0x1 +#define UART_RXFIFO_TOUT_INT_ENA_S 8 +/* UART_BRK_DET_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UART_BRK_DET_INT_ENA (BIT(7)) +#define UART_BRK_DET_INT_ENA_M (BIT(7)) +#define UART_BRK_DET_INT_ENA_V 0x1 +#define UART_BRK_DET_INT_ENA_S 7 +/* UART_CTS_CHG_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UART_CTS_CHG_INT_ENA (BIT(6)) +#define UART_CTS_CHG_INT_ENA_M (BIT(6)) +#define UART_CTS_CHG_INT_ENA_V 0x1 +#define UART_CTS_CHG_INT_ENA_S 6 +/* UART_DSR_CHG_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UART_DSR_CHG_INT_ENA (BIT(5)) +#define UART_DSR_CHG_INT_ENA_M (BIT(5)) +#define UART_DSR_CHG_INT_ENA_V 0x1 +#define UART_DSR_CHG_INT_ENA_S 5 +/* UART_RXFIFO_OVF_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_OVF_INT_ENA (BIT(4)) +#define UART_RXFIFO_OVF_INT_ENA_M (BIT(4)) +#define UART_RXFIFO_OVF_INT_ENA_V 0x1 +#define UART_RXFIFO_OVF_INT_ENA_S 4 +/* UART_FRM_ERR_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UART_FRM_ERR_INT_ENA (BIT(3)) +#define UART_FRM_ERR_INT_ENA_M (BIT(3)) +#define UART_FRM_ERR_INT_ENA_V 0x1 +#define UART_FRM_ERR_INT_ENA_S 3 +/* UART_PARITY_ERR_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UART_PARITY_ERR_INT_ENA (BIT(2)) +#define UART_PARITY_ERR_INT_ENA_M (BIT(2)) +#define UART_PARITY_ERR_INT_ENA_V 0x1 +#define UART_PARITY_ERR_INT_ENA_S 2 +/* UART_TXFIFO_EMPTY_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UART_TXFIFO_EMPTY_INT_ENA (BIT(1)) +#define UART_TXFIFO_EMPTY_INT_ENA_M (BIT(1)) +#define UART_TXFIFO_EMPTY_INT_ENA_V 0x1 +#define UART_TXFIFO_EMPTY_INT_ENA_S 1 +/* UART_RXFIFO_FULL_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_FULL_INT_ENA (BIT(0)) +#define UART_RXFIFO_FULL_INT_ENA_M (BIT(0)) +#define UART_RXFIFO_FULL_INT_ENA_V 0x1 +#define UART_RXFIFO_FULL_INT_ENA_S 0 + +#define UART_INT_CLR_REG(i) (REG_UART_BASE(i) + 0x10) +/* UART_WAKEUP_INT_CLR : WO ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define UART_WAKEUP_INT_CLR (BIT(19)) +#define UART_WAKEUP_INT_CLR_M (BIT(19)) +#define UART_WAKEUP_INT_CLR_V 0x1 +#define UART_WAKEUP_INT_CLR_S 19 +/* UART_AT_CMD_CHAR_DET_INT_CLR : WO ;bitpos:[18] ;default: 1'b0 ; */ +/*description: */ +#define UART_AT_CMD_CHAR_DET_INT_CLR (BIT(18)) +#define UART_AT_CMD_CHAR_DET_INT_CLR_M (BIT(18)) +#define UART_AT_CMD_CHAR_DET_INT_CLR_V 0x1 +#define UART_AT_CMD_CHAR_DET_INT_CLR_S 18 +/* UART_RS485_CLASH_INT_CLR : WO ;bitpos:[17] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_CLASH_INT_CLR (BIT(17)) +#define UART_RS485_CLASH_INT_CLR_M (BIT(17)) +#define UART_RS485_CLASH_INT_CLR_V 0x1 +#define UART_RS485_CLASH_INT_CLR_S 17 +/* UART_RS485_FRM_ERR_INT_CLR : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_FRM_ERR_INT_CLR (BIT(16)) +#define UART_RS485_FRM_ERR_INT_CLR_M (BIT(16)) +#define UART_RS485_FRM_ERR_INT_CLR_V 0x1 +#define UART_RS485_FRM_ERR_INT_CLR_S 16 +/* UART_RS485_PARITY_ERR_INT_CLR : WO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_PARITY_ERR_INT_CLR (BIT(15)) +#define UART_RS485_PARITY_ERR_INT_CLR_M (BIT(15)) +#define UART_RS485_PARITY_ERR_INT_CLR_V 0x1 +#define UART_RS485_PARITY_ERR_INT_CLR_S 15 +/* UART_TX_DONE_INT_CLR : WO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_DONE_INT_CLR (BIT(14)) +#define UART_TX_DONE_INT_CLR_M (BIT(14)) +#define UART_TX_DONE_INT_CLR_V 0x1 +#define UART_TX_DONE_INT_CLR_S 14 +/* UART_TX_BRK_IDLE_DONE_INT_CLR : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_BRK_IDLE_DONE_INT_CLR (BIT(13)) +#define UART_TX_BRK_IDLE_DONE_INT_CLR_M (BIT(13)) +#define UART_TX_BRK_IDLE_DONE_INT_CLR_V 0x1 +#define UART_TX_BRK_IDLE_DONE_INT_CLR_S 13 +/* UART_TX_BRK_DONE_INT_CLR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_BRK_DONE_INT_CLR (BIT(12)) +#define UART_TX_BRK_DONE_INT_CLR_M (BIT(12)) +#define UART_TX_BRK_DONE_INT_CLR_V 0x1 +#define UART_TX_BRK_DONE_INT_CLR_S 12 +/* UART_GLITCH_DET_INT_CLR : WO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define UART_GLITCH_DET_INT_CLR (BIT(11)) +#define UART_GLITCH_DET_INT_CLR_M (BIT(11)) +#define UART_GLITCH_DET_INT_CLR_V 0x1 +#define UART_GLITCH_DET_INT_CLR_S 11 +/* UART_SW_XOFF_INT_CLR : WO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_XOFF_INT_CLR (BIT(10)) +#define UART_SW_XOFF_INT_CLR_M (BIT(10)) +#define UART_SW_XOFF_INT_CLR_V 0x1 +#define UART_SW_XOFF_INT_CLR_S 10 +/* UART_SW_XON_INT_CLR : WO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_XON_INT_CLR (BIT(9)) +#define UART_SW_XON_INT_CLR_M (BIT(9)) +#define UART_SW_XON_INT_CLR_V 0x1 +#define UART_SW_XON_INT_CLR_S 9 +/* UART_RXFIFO_TOUT_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_TOUT_INT_CLR (BIT(8)) +#define UART_RXFIFO_TOUT_INT_CLR_M (BIT(8)) +#define UART_RXFIFO_TOUT_INT_CLR_V 0x1 +#define UART_RXFIFO_TOUT_INT_CLR_S 8 +/* UART_BRK_DET_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UART_BRK_DET_INT_CLR (BIT(7)) +#define UART_BRK_DET_INT_CLR_M (BIT(7)) +#define UART_BRK_DET_INT_CLR_V 0x1 +#define UART_BRK_DET_INT_CLR_S 7 +/* UART_CTS_CHG_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UART_CTS_CHG_INT_CLR (BIT(6)) +#define UART_CTS_CHG_INT_CLR_M (BIT(6)) +#define UART_CTS_CHG_INT_CLR_V 0x1 +#define UART_CTS_CHG_INT_CLR_S 6 +/* UART_DSR_CHG_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UART_DSR_CHG_INT_CLR (BIT(5)) +#define UART_DSR_CHG_INT_CLR_M (BIT(5)) +#define UART_DSR_CHG_INT_CLR_V 0x1 +#define UART_DSR_CHG_INT_CLR_S 5 +/* UART_RXFIFO_OVF_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_OVF_INT_CLR (BIT(4)) +#define UART_RXFIFO_OVF_INT_CLR_M (BIT(4)) +#define UART_RXFIFO_OVF_INT_CLR_V 0x1 +#define UART_RXFIFO_OVF_INT_CLR_S 4 +/* UART_FRM_ERR_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UART_FRM_ERR_INT_CLR (BIT(3)) +#define UART_FRM_ERR_INT_CLR_M (BIT(3)) +#define UART_FRM_ERR_INT_CLR_V 0x1 +#define UART_FRM_ERR_INT_CLR_S 3 +/* UART_PARITY_ERR_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UART_PARITY_ERR_INT_CLR (BIT(2)) +#define UART_PARITY_ERR_INT_CLR_M (BIT(2)) +#define UART_PARITY_ERR_INT_CLR_V 0x1 +#define UART_PARITY_ERR_INT_CLR_S 2 +/* UART_TXFIFO_EMPTY_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UART_TXFIFO_EMPTY_INT_CLR (BIT(1)) +#define UART_TXFIFO_EMPTY_INT_CLR_M (BIT(1)) +#define UART_TXFIFO_EMPTY_INT_CLR_V 0x1 +#define UART_TXFIFO_EMPTY_INT_CLR_S 1 +/* UART_RXFIFO_FULL_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXFIFO_FULL_INT_CLR (BIT(0)) +#define UART_RXFIFO_FULL_INT_CLR_M (BIT(0)) +#define UART_RXFIFO_FULL_INT_CLR_V 0x1 +#define UART_RXFIFO_FULL_INT_CLR_S 0 + +#define UART_CLKDIV_REG(i) (REG_UART_BASE(i) + 0x14) +/* UART_CLKDIV_FRAG : R/W ;bitpos:[23:20] ;default: 4'h0 ; */ +/*description: */ +#define UART_CLKDIV_FRAG 0x0000000F +#define UART_CLKDIV_FRAG_M ((UART_CLKDIV_FRAG_V)<<(UART_CLKDIV_FRAG_S)) +#define UART_CLKDIV_FRAG_V 0xF +#define UART_CLKDIV_FRAG_S 20 +/* UART_CLKDIV : R/W ;bitpos:[19:0] ;default: 20'h2B6 ; */ +/*description: */ +#define UART_CLKDIV 0x000FFFFF +#define UART_CLKDIV_M ((UART_CLKDIV_V)<<(UART_CLKDIV_S)) +#define UART_CLKDIV_V 0xFFFFF +#define UART_CLKDIV_S 0 + +#define UART_AUTOBAUD_REG(i) (REG_UART_BASE(i) + 0x18) +/* UART_GLITCH_FILT : R/W ;bitpos:[15:8] ;default: 8'h10 ; */ +/*description: */ +#define UART_GLITCH_FILT 0x000000FF +#define UART_GLITCH_FILT_M ((UART_GLITCH_FILT_V)<<(UART_GLITCH_FILT_S)) +#define UART_GLITCH_FILT_V 0xFF +#define UART_GLITCH_FILT_S 8 +/* UART_AUTOBAUD_EN : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UART_AUTOBAUD_EN (BIT(0)) +#define UART_AUTOBAUD_EN_M (BIT(0)) +#define UART_AUTOBAUD_EN_V 0x1 +#define UART_AUTOBAUD_EN_S 0 + +#define UART_STATUS_REG(i) (REG_UART_BASE(i) + 0x1C) +/* UART_TXD : RO ;bitpos:[31] ;default: 8'h0 ; */ +/*description: */ +#define UART_TXD (BIT(31)) +#define UART_TXD_M (BIT(31)) +#define UART_TXD_V 0x1 +#define UART_TXD_S 31 +/* UART_RTSN : RO ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define UART_RTSN (BIT(30)) +#define UART_RTSN_M (BIT(30)) +#define UART_RTSN_V 0x1 +#define UART_RTSN_S 30 +/* UART_DTRN : RO ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define UART_DTRN (BIT(29)) +#define UART_DTRN_M (BIT(29)) +#define UART_DTRN_V 0x1 +#define UART_DTRN_S 29 +/* UART_TXFIFO_CNT : RO ;bitpos:[25:16] ;default: 10'b0 ; */ +/*description: */ +#define UART_TXFIFO_CNT 0x000003FF +#define UART_TXFIFO_CNT_M ((UART_TXFIFO_CNT_V)<<(UART_TXFIFO_CNT_S)) +#define UART_TXFIFO_CNT_V 0x3FF +#define UART_TXFIFO_CNT_S 16 +/* UART_RXD : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UART_RXD (BIT(15)) +#define UART_RXD_M (BIT(15)) +#define UART_RXD_V 0x1 +#define UART_RXD_S 15 +/* UART_CTSN : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UART_CTSN (BIT(14)) +#define UART_CTSN_M (BIT(14)) +#define UART_CTSN_V 0x1 +#define UART_CTSN_S 14 +/* UART_DSRN : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UART_DSRN (BIT(13)) +#define UART_DSRN_M (BIT(13)) +#define UART_DSRN_V 0x1 +#define UART_DSRN_S 13 +/* UART_RXFIFO_CNT : RO ;bitpos:[9:0] ;default: 10'b0 ; */ +/*description: */ +#define UART_RXFIFO_CNT 0x000003FF +#define UART_RXFIFO_CNT_M ((UART_RXFIFO_CNT_V)<<(UART_RXFIFO_CNT_S)) +#define UART_RXFIFO_CNT_V 0x3FF +#define UART_RXFIFO_CNT_S 0 + +#define UART_CONF0_REG(i) (REG_UART_BASE(i) + 0x20) +/* UART_TICK_REF_ALWAYS_ON : R/W ;bitpos:[27] ;default: 1'b1 ; */ +/*description: */ +#define UART_TICK_REF_ALWAYS_ON (BIT(27)) +#define UART_TICK_REF_ALWAYS_ON_M (BIT(27)) +#define UART_TICK_REF_ALWAYS_ON_V 0x1 +#define UART_TICK_REF_ALWAYS_ON_S 27 +/* UART_ERR_WR_MASK : R/W ;bitpos:[26] ;default: 1'b0 ; */ +/*description: */ +#define UART_ERR_WR_MASK (BIT(26)) +#define UART_ERR_WR_MASK_M (BIT(26)) +#define UART_ERR_WR_MASK_V 0x1 +#define UART_ERR_WR_MASK_S 26 +/* UART_CLK_EN : R/W ;bitpos:[25] ;default: 1'h0 ; */ +/*description: */ +#define UART_CLK_EN (BIT(25)) +#define UART_CLK_EN_M (BIT(25)) +#define UART_CLK_EN_V 0x1 +#define UART_CLK_EN_S 25 +/* UART_DTR_INV : R/W ;bitpos:[24] ;default: 1'h0 ; */ +/*description: */ +#define UART_DTR_INV (BIT(24)) +#define UART_DTR_INV_M (BIT(24)) +#define UART_DTR_INV_V 0x1 +#define UART_DTR_INV_S 24 +/* UART_RTS_INV : R/W ;bitpos:[23] ;default: 1'h0 ; */ +/*description: */ +#define UART_RTS_INV (BIT(23)) +#define UART_RTS_INV_M (BIT(23)) +#define UART_RTS_INV_V 0x1 +#define UART_RTS_INV_S 23 +/* UART_TXD_INV : R/W ;bitpos:[22] ;default: 1'h0 ; */ +/*description: */ +#define UART_TXD_INV (BIT(22)) +#define UART_TXD_INV_M (BIT(22)) +#define UART_TXD_INV_V 0x1 +#define UART_TXD_INV_S 22 +/* UART_DSR_INV : R/W ;bitpos:[21] ;default: 1'h0 ; */ +/*description: */ +#define UART_DSR_INV (BIT(21)) +#define UART_DSR_INV_M (BIT(21)) +#define UART_DSR_INV_V 0x1 +#define UART_DSR_INV_S 21 +/* UART_CTS_INV : R/W ;bitpos:[20] ;default: 1'h0 ; */ +/*description: */ +#define UART_CTS_INV (BIT(20)) +#define UART_CTS_INV_M (BIT(20)) +#define UART_CTS_INV_V 0x1 +#define UART_CTS_INV_S 20 +/* UART_RXD_INV : R/W ;bitpos:[19] ;default: 1'h0 ; */ +/*description: */ +#define UART_RXD_INV (BIT(19)) +#define UART_RXD_INV_M (BIT(19)) +#define UART_RXD_INV_V 0x1 +#define UART_RXD_INV_S 19 +/* UART_TXFIFO_RST : R/W ;bitpos:[18] ;default: 1'h0 ; */ +/*description: */ +#define UART_TXFIFO_RST (BIT(18)) +#define UART_TXFIFO_RST_M (BIT(18)) +#define UART_TXFIFO_RST_V 0x1 +#define UART_TXFIFO_RST_S 18 +/* UART_RXFIFO_RST : R/W ;bitpos:[17] ;default: 1'h0 ; */ +/*description: */ +#define UART_RXFIFO_RST (BIT(17)) +#define UART_RXFIFO_RST_M (BIT(17)) +#define UART_RXFIFO_RST_V 0x1 +#define UART_RXFIFO_RST_S 17 +/* UART_IRDA_EN : R/W ;bitpos:[16] ;default: 1'h0 ; */ +/*description: */ +#define UART_IRDA_EN (BIT(16)) +#define UART_IRDA_EN_M (BIT(16)) +#define UART_IRDA_EN_V 0x1 +#define UART_IRDA_EN_S 16 +/* UART_TX_FLOW_EN : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UART_TX_FLOW_EN (BIT(15)) +#define UART_TX_FLOW_EN_M (BIT(15)) +#define UART_TX_FLOW_EN_V 0x1 +#define UART_TX_FLOW_EN_S 15 +/* UART_LOOPBACK : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UART_LOOPBACK (BIT(14)) +#define UART_LOOPBACK_M (BIT(14)) +#define UART_LOOPBACK_V 0x1 +#define UART_LOOPBACK_S 14 +/* UART_IRDA_RX_INV : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UART_IRDA_RX_INV (BIT(13)) +#define UART_IRDA_RX_INV_M (BIT(13)) +#define UART_IRDA_RX_INV_V 0x1 +#define UART_IRDA_RX_INV_S 13 +/* UART_IRDA_TX_INV : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define UART_IRDA_TX_INV (BIT(12)) +#define UART_IRDA_TX_INV_M (BIT(12)) +#define UART_IRDA_TX_INV_V 0x1 +#define UART_IRDA_TX_INV_S 12 +/* UART_IRDA_WCTL : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define UART_IRDA_WCTL (BIT(11)) +#define UART_IRDA_WCTL_M (BIT(11)) +#define UART_IRDA_WCTL_V 0x1 +#define UART_IRDA_WCTL_S 11 +/* UART_IRDA_TX_EN : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define UART_IRDA_TX_EN (BIT(10)) +#define UART_IRDA_TX_EN_M (BIT(10)) +#define UART_IRDA_TX_EN_V 0x1 +#define UART_IRDA_TX_EN_S 10 +/* UART_IRDA_DPLX : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define UART_IRDA_DPLX (BIT(9)) +#define UART_IRDA_DPLX_M (BIT(9)) +#define UART_IRDA_DPLX_V 0x1 +#define UART_IRDA_DPLX_S 9 +/* UART_TXD_BRK : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define UART_TXD_BRK (BIT(8)) +#define UART_TXD_BRK_M (BIT(8)) +#define UART_TXD_BRK_V 0x1 +#define UART_TXD_BRK_S 8 +/* UART_SW_DTR : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_DTR (BIT(7)) +#define UART_SW_DTR_M (BIT(7)) +#define UART_SW_DTR_V 0x1 +#define UART_SW_DTR_S 7 +/* UART_SW_RTS : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_RTS (BIT(6)) +#define UART_SW_RTS_M (BIT(6)) +#define UART_SW_RTS_V 0x1 +#define UART_SW_RTS_S 6 +/* UART_STOP_BIT_NUM : R/W ;bitpos:[5:4] ;default: 2'd1 ; */ +/*description: */ +#define UART_STOP_BIT_NUM 0x00000003 +#define UART_STOP_BIT_NUM_M ((UART_STOP_BIT_NUM_V)<<(UART_STOP_BIT_NUM_S)) +#define UART_STOP_BIT_NUM_V 0x3 +#define UART_STOP_BIT_NUM_S 4 +/* UART_BIT_NUM : R/W ;bitpos:[3:2] ;default: 2'd3 ; */ +/*description: */ +#define UART_BIT_NUM 0x00000003 +#define UART_BIT_NUM_M ((UART_BIT_NUM_V)<<(UART_BIT_NUM_S)) +#define UART_BIT_NUM_V 0x3 +#define UART_BIT_NUM_S 2 +/* UART_PARITY_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UART_PARITY_EN (BIT(1)) +#define UART_PARITY_EN_M (BIT(1)) +#define UART_PARITY_EN_V 0x1 +#define UART_PARITY_EN_S 1 +/* UART_PARITY : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UART_PARITY (BIT(0)) +#define UART_PARITY_M (BIT(0)) +#define UART_PARITY_V 0x1 +#define UART_PARITY_S 0 + +#define UART_CONF1_REG(i) (REG_UART_BASE(i) + 0x24) +/* UART_RX_TOUT_EN : R/W ;bitpos:[31] ;default: 1'b0 ; */ +/*description: */ +#define UART_RX_TOUT_EN (BIT(31)) +#define UART_RX_TOUT_EN_M (BIT(31)) +#define UART_RX_TOUT_EN_V 0x1 +#define UART_RX_TOUT_EN_S 31 +/* UART_RX_FLOW_EN : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define UART_RX_FLOW_EN (BIT(30)) +#define UART_RX_FLOW_EN_M (BIT(30)) +#define UART_RX_FLOW_EN_V 0x1 +#define UART_RX_FLOW_EN_S 30 +/* UART_RX_TOUT_FLOW_DIS : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define UART_RX_TOUT_FLOW_DIS (BIT(29)) +#define UART_RX_TOUT_FLOW_DIS_M (BIT(29)) +#define UART_RX_TOUT_FLOW_DIS_V 0x1 +#define UART_RX_TOUT_FLOW_DIS_S 29 +/* UART_TXFIFO_EMPTY_THRHD : R/W ;bitpos:[17:9] ;default: 9'h60 ; */ +/*description: */ +#define UART_TXFIFO_EMPTY_THRHD 0x000001FF +#define UART_TXFIFO_EMPTY_THRHD_M ((UART_TXFIFO_EMPTY_THRHD_V)<<(UART_TXFIFO_EMPTY_THRHD_S)) +#define UART_TXFIFO_EMPTY_THRHD_V 0x1FF +#define UART_TXFIFO_EMPTY_THRHD_S 9 +/* UART_RXFIFO_FULL_THRHD : R/W ;bitpos:[8:0] ;default: 9'h60 ; */ +/*description: */ +#define UART_RXFIFO_FULL_THRHD 0x000001FF +#define UART_RXFIFO_FULL_THRHD_M ((UART_RXFIFO_FULL_THRHD_V)<<(UART_RXFIFO_FULL_THRHD_S)) +#define UART_RXFIFO_FULL_THRHD_V 0x1FF +#define UART_RXFIFO_FULL_THRHD_S 0 + +#define UART_LOWPULSE_REG(i) (REG_UART_BASE(i) + 0x28) +/* UART_LOWPULSE_MIN_CNT : RO ;bitpos:[19:0] ;default: 20'hFFFFF ; */ +/*description: */ +#define UART_LOWPULSE_MIN_CNT 0x000FFFFF +#define UART_LOWPULSE_MIN_CNT_M ((UART_LOWPULSE_MIN_CNT_V)<<(UART_LOWPULSE_MIN_CNT_S)) +#define UART_LOWPULSE_MIN_CNT_V 0xFFFFF +#define UART_LOWPULSE_MIN_CNT_S 0 + +#define UART_HIGHPULSE_REG(i) (REG_UART_BASE(i) + 0x2C) +/* UART_HIGHPULSE_MIN_CNT : RO ;bitpos:[19:0] ;default: 20'hFFFFF ; */ +/*description: */ +#define UART_HIGHPULSE_MIN_CNT 0x000FFFFF +#define UART_HIGHPULSE_MIN_CNT_M ((UART_HIGHPULSE_MIN_CNT_V)<<(UART_HIGHPULSE_MIN_CNT_S)) +#define UART_HIGHPULSE_MIN_CNT_V 0xFFFFF +#define UART_HIGHPULSE_MIN_CNT_S 0 + +#define UART_RXD_CNT_REG(i) (REG_UART_BASE(i) + 0x30) +/* UART_RXD_EDGE_CNT : RO ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define UART_RXD_EDGE_CNT 0x000003FF +#define UART_RXD_EDGE_CNT_M ((UART_RXD_EDGE_CNT_V)<<(UART_RXD_EDGE_CNT_S)) +#define UART_RXD_EDGE_CNT_V 0x3FF +#define UART_RXD_EDGE_CNT_S 0 + +#define UART_FLOW_CONF_REG(i) (REG_UART_BASE(i) + 0x34) +/* UART_SEND_XOFF : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UART_SEND_XOFF (BIT(5)) +#define UART_SEND_XOFF_M (BIT(5)) +#define UART_SEND_XOFF_V 0x1 +#define UART_SEND_XOFF_S 5 +/* UART_SEND_XON : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UART_SEND_XON (BIT(4)) +#define UART_SEND_XON_M (BIT(4)) +#define UART_SEND_XON_V 0x1 +#define UART_SEND_XON_S 4 +/* UART_FORCE_XOFF : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UART_FORCE_XOFF (BIT(3)) +#define UART_FORCE_XOFF_M (BIT(3)) +#define UART_FORCE_XOFF_V 0x1 +#define UART_FORCE_XOFF_S 3 +/* UART_FORCE_XON : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UART_FORCE_XON (BIT(2)) +#define UART_FORCE_XON_M (BIT(2)) +#define UART_FORCE_XON_V 0x1 +#define UART_FORCE_XON_S 2 +/* UART_XONOFF_DEL : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UART_XONOFF_DEL (BIT(1)) +#define UART_XONOFF_DEL_M (BIT(1)) +#define UART_XONOFF_DEL_V 0x1 +#define UART_XONOFF_DEL_S 1 +/* UART_SW_FLOW_CON_EN : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UART_SW_FLOW_CON_EN (BIT(0)) +#define UART_SW_FLOW_CON_EN_M (BIT(0)) +#define UART_SW_FLOW_CON_EN_V 0x1 +#define UART_SW_FLOW_CON_EN_S 0 + +#define UART_SLEEP_CONF_REG(i) (REG_UART_BASE(i) + 0x38) +/* UART_ACTIVE_THRESHOLD : R/W ;bitpos:[9:0] ;default: 10'hf0 ; */ +/*description: */ +#define UART_ACTIVE_THRESHOLD 0x000003FF +#define UART_ACTIVE_THRESHOLD_M ((UART_ACTIVE_THRESHOLD_V)<<(UART_ACTIVE_THRESHOLD_S)) +#define UART_ACTIVE_THRESHOLD_V 0x3FF +#define UART_ACTIVE_THRESHOLD_S 0 + +#define UART_SWFC_CONF0_REG(i) (REG_UART_BASE(i) + 0x3C) +/* UART_XOFF_CHAR : R/W ;bitpos:[16:9] ;default: 8'h13 ; */ +/*description: */ +#define UART_XOFF_CHAR 0x000000FF +#define UART_XOFF_CHAR_M ((UART_XOFF_CHAR_V)<<(UART_XOFF_CHAR_S)) +#define UART_XOFF_CHAR_V 0xFF +#define UART_XOFF_CHAR_S 9 +/* UART_XOFF_THRESHOLD : R/W ;bitpos:[8:0] ;default: 9'he0 ; */ +/*description: */ +#define UART_XOFF_THRESHOLD 0x000001FF +#define UART_XOFF_THRESHOLD_M ((UART_XOFF_THRESHOLD_V)<<(UART_XOFF_THRESHOLD_S)) +#define UART_XOFF_THRESHOLD_V 0x1FF +#define UART_XOFF_THRESHOLD_S 0 + +#define UART_SWFC_CONF1_REG(i) (REG_UART_BASE(i) + 0x40) +/* UART_XON_CHAR : R/W ;bitpos:[16:9] ;default: 8'h11 ; */ +/*description: */ +#define UART_XON_CHAR 0x000000FF +#define UART_XON_CHAR_M ((UART_XON_CHAR_V)<<(UART_XON_CHAR_S)) +#define UART_XON_CHAR_V 0xFF +#define UART_XON_CHAR_S 9 +/* UART_XON_THRESHOLD : R/W ;bitpos:[8:0] ;default: 9'h0 ; */ +/*description: */ +#define UART_XON_THRESHOLD 0x000001FF +#define UART_XON_THRESHOLD_M ((UART_XON_THRESHOLD_V)<<(UART_XON_THRESHOLD_S)) +#define UART_XON_THRESHOLD_V 0x1FF +#define UART_XON_THRESHOLD_S 0 + +#define UART_IDLE_CONF_REG(i) (REG_UART_BASE(i) + 0x44) +/* UART_TX_BRK_NUM : R/W ;bitpos:[27:20] ;default: 8'ha ; */ +/*description: */ +#define UART_TX_BRK_NUM 0x000000FF +#define UART_TX_BRK_NUM_M ((UART_TX_BRK_NUM_V)<<(UART_TX_BRK_NUM_S)) +#define UART_TX_BRK_NUM_V 0xFF +#define UART_TX_BRK_NUM_S 20 +/* UART_TX_IDLE_NUM : R/W ;bitpos:[19:10] ;default: 10'h100 ; */ +/*description: */ +#define UART_TX_IDLE_NUM 0x000003FF +#define UART_TX_IDLE_NUM_M ((UART_TX_IDLE_NUM_V)<<(UART_TX_IDLE_NUM_S)) +#define UART_TX_IDLE_NUM_V 0x3FF +#define UART_TX_IDLE_NUM_S 10 +/* UART_RX_IDLE_THRHD : R/W ;bitpos:[9:0] ;default: 10'h100 ; */ +/*description: */ +#define UART_RX_IDLE_THRHD 0x000003FF +#define UART_RX_IDLE_THRHD_M ((UART_RX_IDLE_THRHD_V)<<(UART_RX_IDLE_THRHD_S)) +#define UART_RX_IDLE_THRHD_V 0x3FF +#define UART_RX_IDLE_THRHD_S 0 + +#define UART_RS485_CONF_REG(i) (REG_UART_BASE(i) + 0x48) +/* UART_RS485_TX_DLY_NUM : R/W ;bitpos:[9:6] ;default: 4'b0 ; */ +/*description: */ +#define UART_RS485_TX_DLY_NUM 0x0000000F +#define UART_RS485_TX_DLY_NUM_M ((UART_RS485_TX_DLY_NUM_V)<<(UART_RS485_TX_DLY_NUM_S)) +#define UART_RS485_TX_DLY_NUM_V 0xF +#define UART_RS485_TX_DLY_NUM_S 6 +/* UART_RS485_RX_DLY_NUM : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_RX_DLY_NUM (BIT(5)) +#define UART_RS485_RX_DLY_NUM_M (BIT(5)) +#define UART_RS485_RX_DLY_NUM_V 0x1 +#define UART_RS485_RX_DLY_NUM_S 5 +/* UART_RS485RXBY_TX_EN : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485RXBY_TX_EN (BIT(4)) +#define UART_RS485RXBY_TX_EN_M (BIT(4)) +#define UART_RS485RXBY_TX_EN_V 0x1 +#define UART_RS485RXBY_TX_EN_S 4 +/* UART_RS485TX_RX_EN : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485TX_RX_EN (BIT(3)) +#define UART_RS485TX_RX_EN_M (BIT(3)) +#define UART_RS485TX_RX_EN_V 0x1 +#define UART_RS485TX_RX_EN_S 3 +/* UART_DL1_EN : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UART_DL1_EN (BIT(2)) +#define UART_DL1_EN_M (BIT(2)) +#define UART_DL1_EN_V 0x1 +#define UART_DL1_EN_S 2 +/* UART_DL0_EN : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UART_DL0_EN (BIT(1)) +#define UART_DL0_EN_M (BIT(1)) +#define UART_DL0_EN_V 0x1 +#define UART_DL0_EN_S 1 +/* UART_RS485_EN : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UART_RS485_EN (BIT(0)) +#define UART_RS485_EN_M (BIT(0)) +#define UART_RS485_EN_V 0x1 +#define UART_RS485_EN_S 0 + +#define UART_AT_CMD_PRECNT_REG(i) (REG_UART_BASE(i) + 0x4c) +/* UART_PRE_IDLE_NUM : R/W ;bitpos:[15:0] ;default: 16'h901 ; */ +/*description: */ +#define UART_PRE_IDLE_NUM 0x0000FFFF +#define UART_PRE_IDLE_NUM_M ((UART_PRE_IDLE_NUM_V)<<(UART_PRE_IDLE_NUM_S)) +#define UART_PRE_IDLE_NUM_V 0xFFFF +#define UART_PRE_IDLE_NUM_S 0 + +#define UART_AT_CMD_POSTCNT_REG(i) (REG_UART_BASE(i) + 0x50) +/* UART_POST_IDLE_NUM : R/W ;bitpos:[15:0] ;default: 16'h901 ; */ +/*description: */ +#define UART_POST_IDLE_NUM 0x0000FFFF +#define UART_POST_IDLE_NUM_M ((UART_POST_IDLE_NUM_V)<<(UART_POST_IDLE_NUM_S)) +#define UART_POST_IDLE_NUM_V 0xFFFF +#define UART_POST_IDLE_NUM_S 0 + +#define UART_AT_CMD_GAPTOUT_REG(i) (REG_UART_BASE(i) + 0x54) +/* UART_RX_GAP_TOUT : R/W ;bitpos:[15:0] ;default: 16'd11 ; */ +/*description: */ +#define UART_RX_GAP_TOUT 0x0000FFFF +#define UART_RX_GAP_TOUT_M ((UART_RX_GAP_TOUT_V)<<(UART_RX_GAP_TOUT_S)) +#define UART_RX_GAP_TOUT_V 0xFFFF +#define UART_RX_GAP_TOUT_S 0 + +#define UART_AT_CMD_CHAR_REG(i) (REG_UART_BASE(i) + 0x58) +/* UART_CHAR_NUM : R/W ;bitpos:[15:8] ;default: 8'h3 ; */ +/*description: */ +#define UART_CHAR_NUM 0x000000FF +#define UART_CHAR_NUM_M ((UART_CHAR_NUM_V)<<(UART_CHAR_NUM_S)) +#define UART_CHAR_NUM_V 0xFF +#define UART_CHAR_NUM_S 8 +/* UART_AT_CMD_CHAR : R/W ;bitpos:[7:0] ;default: 8'h2b ; */ +/*description: */ +#define UART_AT_CMD_CHAR 0x000000FF +#define UART_AT_CMD_CHAR_M ((UART_AT_CMD_CHAR_V)<<(UART_AT_CMD_CHAR_S)) +#define UART_AT_CMD_CHAR_V 0xFF +#define UART_AT_CMD_CHAR_S 0 + +#define UART_MEM_CONF_REG(i) (REG_UART_BASE(i) + 0x5c) +/* UART_RX_TOUT_THRHD : R/W ;bitpos:[25:16] ;default: 10'ha ; */ +/*description: */ +#define UART_RX_TOUT_THRHD 0x000003FF +#define UART_RX_TOUT_THRHD_M ((UART_RX_TOUT_THRHD_V)<<(UART_RX_TOUT_THRHD_S)) +#define UART_RX_TOUT_THRHD_V 0x3FF +#define UART_RX_TOUT_THRHD_S 16 +/* UART_RX_FLOW_THRHD : R/W ;bitpos:[15:7] ;default: 9'h0 ; */ +/*description: */ +#define UART_RX_FLOW_THRHD 0x000001FF +#define UART_RX_FLOW_THRHD_M ((UART_RX_FLOW_THRHD_V)<<(UART_RX_FLOW_THRHD_S)) +#define UART_RX_FLOW_THRHD_V 0x1FF +#define UART_RX_FLOW_THRHD_S 7 +/* UART_TX_SIZE : R/W ;bitpos:[6:4] ;default: 3'h1 ; */ +/*description: */ +#define UART_TX_SIZE 0x00000007 +#define UART_TX_SIZE_M ((UART_TX_SIZE_V)<<(UART_TX_SIZE_S)) +#define UART_TX_SIZE_V 0x7 +#define UART_TX_SIZE_S 4 +/* UART_RX_SIZE : R/W ;bitpos:[3:1] ;default: 3'b1 ; */ +/*description: */ +#define UART_RX_SIZE 0x00000007 +#define UART_RX_SIZE_M ((UART_RX_SIZE_V)<<(UART_RX_SIZE_S)) +#define UART_RX_SIZE_V 0x7 +#define UART_RX_SIZE_S 1 +/* UART_MEM_PD : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UART_MEM_PD (BIT(0)) +#define UART_MEM_PD_M (BIT(0)) +#define UART_MEM_PD_V 0x1 +#define UART_MEM_PD_S 0 + +#define UART_MEM_TX_STATUS_REG(i) (REG_UART_BASE(i) + 0x60) +/* UART_TX_RADDR : RO ;bitpos:[20:11] ;default: 10'h0 ; */ +/*description: */ +#define UART_TX_RADDR 0x000003FF +#define UART_TX_RADDR_M ((UART_TX_RADDR_V)<<(UART_TX_RADDR_S)) +#define UART_TX_RADDR_V 0x3FF +#define UART_TX_RADDR_S 11 +/* UART_APB_TX_WADDR : RO ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define UART_APB_TX_WADDR 0x000003FF +#define UART_APB_TX_WADDR_M ((UART_APB_TX_WADDR_V)<<(UART_APB_TX_WADDR_S)) +#define UART_APB_TX_WADDR_V 0x3FF +#define UART_APB_TX_WADDR_S 0 + +#define UART_MEM_RX_STATUS_REG(i) (REG_UART_BASE(i) + 0x64) +/* UART_RX_WADDR : RO ;bitpos:[20:11] ;default: 10'h0 ; */ +/*description: */ +#define UART_RX_WADDR 0x000003FF +#define UART_RX_WADDR_M ((UART_RX_WADDR_V)<<(UART_RX_WADDR_S)) +#define UART_RX_WADDR_V 0x3FF +#define UART_RX_WADDR_S 11 +/* UART_APB_RX_RADDR : RO ;bitpos:[9:0] ;default: 10'h0 ; */ +/*description: */ +#define UART_APB_RX_RADDR 0x000003FF +#define UART_APB_RX_RADDR_M ((UART_APB_RX_RADDR_V)<<(UART_APB_RX_RADDR_S)) +#define UART_APB_RX_RADDR_V 0x3FF +#define UART_APB_RX_RADDR_S 0 + +#define UART_FSM_STATUS_REG(i) (REG_UART_BASE(i) + 0x68) +/* UART_ST_UTX_OUT : RO ;bitpos:[7:4] ;default: 4'b0 ; */ +/*description: */ +#define UART_ST_UTX_OUT 0x0000000F +#define UART_ST_UTX_OUT_M ((UART_ST_UTX_OUT_V)<<(UART_ST_UTX_OUT_S)) +#define UART_ST_UTX_OUT_V 0xF +#define UART_ST_UTX_OUT_S 4 +/* UART_ST_URX_OUT : RO ;bitpos:[3:0] ;default: 4'b0 ; */ +/*description: */ +#define UART_ST_URX_OUT 0x0000000F +#define UART_ST_URX_OUT_M ((UART_ST_URX_OUT_V)<<(UART_ST_URX_OUT_S)) +#define UART_ST_URX_OUT_V 0xF +#define UART_ST_URX_OUT_S 0 + +#define UART_POSPULSE_REG(i) (REG_UART_BASE(i) + 0x6c) +/* UART_POSEDGE_MIN_CNT : RO ;bitpos:[19:0] ;default: 20'hFFFFF ; */ +/*description: */ +#define UART_POSEDGE_MIN_CNT 0x000FFFFF +#define UART_POSEDGE_MIN_CNT_M ((UART_POSEDGE_MIN_CNT_V)<<(UART_POSEDGE_MIN_CNT_S)) +#define UART_POSEDGE_MIN_CNT_V 0xFFFFF +#define UART_POSEDGE_MIN_CNT_S 0 + +#define UART_NEGPULSE_REG(i) (REG_UART_BASE(i) + 0x70) +/* UART_NEGEDGE_MIN_CNT : RO ;bitpos:[19:0] ;default: 20'hFFFFF ; */ +/*description: */ +#define UART_NEGEDGE_MIN_CNT 0x000FFFFF +#define UART_NEGEDGE_MIN_CNT_M ((UART_NEGEDGE_MIN_CNT_V)<<(UART_NEGEDGE_MIN_CNT_S)) +#define UART_NEGEDGE_MIN_CNT_V 0xFFFFF +#define UART_NEGEDGE_MIN_CNT_S 0 + +#define UART_DATE_REG(i) (REG_UART_BASE(i) + 0x74) +/* UART_DATE : R/W ;bitpos:[31:0] ;default: 32'h18082800 ; */ +/*description: */ +#define UART_DATE 0xFFFFFFFF +#define UART_DATE_M ((UART_DATE_V)<<(UART_DATE_S)) +#define UART_DATE_V 0xFFFFFFFF +#define UART_DATE_S 0 + +#define UART_ID_REG(i) (REG_UART_BASE(i) + 0x78) +/* UART_ID : R/W ;bitpos:[31:0] ;default: 32'h0500 ; */ +/*description: */ +#define UART_ID 0xFFFFFFFF +#define UART_ID_M ((UART_ID_V)<<(UART_ID_S)) +#define UART_ID_V 0xFFFFFFFF +#define UART_ID_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_UART_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/uart_struct.h b/components/soc/esp32s2beta/include/soc/uart_struct.h new file mode 100644 index 0000000000..07f27e905b --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/uart_struct.h @@ -0,0 +1,374 @@ +// Copyright 2017-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_UART_STRUCT_H_ +#define _SOC_UART_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint8_t rw_byte; + uint8_t reserved[3]; + }; + uint32_t val; + } ahb_fifo; + union { + struct { + uint32_t rxfifo_full: 1; + uint32_t txfifo_empty: 1; + uint32_t parity_err: 1; + uint32_t frm_err: 1; + uint32_t rxfifo_ovf: 1; + uint32_t dsr_chg: 1; + uint32_t cts_chg: 1; + uint32_t brk_det: 1; + uint32_t rxfifo_tout: 1; + uint32_t sw_xon: 1; + uint32_t sw_xoff: 1; + uint32_t glitch_det: 1; + uint32_t tx_brk_done: 1; + uint32_t tx_brk_idle_done: 1; + uint32_t tx_done: 1; + uint32_t rs485_parity_err: 1; + uint32_t rs485_frm_err: 1; + uint32_t rs485_clash: 1; + uint32_t at_cmd_char_det: 1; + uint32_t wakeup: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t rxfifo_full: 1; + uint32_t txfifo_empty: 1; + uint32_t parity_err: 1; + uint32_t frm_err: 1; + uint32_t rxfifo_ovf: 1; + uint32_t dsr_chg: 1; + uint32_t cts_chg: 1; + uint32_t brk_det: 1; + uint32_t rxfifo_tout: 1; + uint32_t sw_xon: 1; + uint32_t sw_xoff: 1; + uint32_t glitch_det: 1; + uint32_t tx_brk_done: 1; + uint32_t tx_brk_idle_done: 1; + uint32_t tx_done: 1; + uint32_t rs485_parity_err: 1; + uint32_t rs485_frm_err: 1; + uint32_t rs485_clash: 1; + uint32_t at_cmd_char_det: 1; + uint32_t wakeup: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_st; + union { + struct { + uint32_t rxfifo_full: 1; + uint32_t txfifo_empty: 1; + uint32_t parity_err: 1; + uint32_t frm_err: 1; + uint32_t rxfifo_ovf: 1; + uint32_t dsr_chg: 1; + uint32_t cts_chg: 1; + uint32_t brk_det: 1; + uint32_t rxfifo_tout: 1; + uint32_t sw_xon: 1; + uint32_t sw_xoff: 1; + uint32_t glitch_det: 1; + uint32_t tx_brk_done: 1; + uint32_t tx_brk_idle_done: 1; + uint32_t tx_done: 1; + uint32_t rs485_parity_err: 1; + uint32_t rs485_frm_err: 1; + uint32_t rs485_clash: 1; + uint32_t at_cmd_char_det: 1; + uint32_t wakeup: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t rxfifo_full: 1; + uint32_t txfifo_empty: 1; + uint32_t parity_err: 1; + uint32_t frm_err: 1; + uint32_t rxfifo_ovf: 1; + uint32_t dsr_chg: 1; + uint32_t cts_chg: 1; + uint32_t brk_det: 1; + uint32_t rxfifo_tout: 1; + uint32_t sw_xon: 1; + uint32_t sw_xoff: 1; + uint32_t glitch_det: 1; + uint32_t tx_brk_done: 1; + uint32_t tx_brk_idle_done: 1; + uint32_t tx_done: 1; + uint32_t rs485_parity_err: 1; + uint32_t rs485_frm_err: 1; + uint32_t rs485_clash: 1; + uint32_t at_cmd_char_det: 1; + uint32_t wakeup: 1; + uint32_t reserved20: 12; + }; + uint32_t val; + } int_clr; + union { + struct { + uint32_t div_int: 20; + uint32_t div_frag: 4; + uint32_t reserved24: 8; + }; + uint32_t val; + } clk_div; + union { + struct { + uint32_t en: 1; + uint32_t reserved1: 7; + uint32_t glitch_filt: 8; + uint32_t reserved16: 16; + }; + uint32_t val; + } auto_baud; + union { + struct { + uint32_t rxfifo_cnt:10; + uint32_t reserved10: 3; + uint32_t dsrn: 1; + uint32_t ctsn: 1; + uint32_t rxd: 1; + uint32_t txfifo_cnt:10; + uint32_t reserved26: 3; + uint32_t dtrn: 1; + uint32_t rtsn: 1; + uint32_t txd: 1; + }; + uint32_t val; + } status; + union { + struct { + uint32_t parity: 1; + uint32_t parity_en: 1; + uint32_t bit_num: 2; + uint32_t stop_bit_num: 2; + uint32_t sw_rts: 1; + uint32_t sw_dtr: 1; + uint32_t txd_brk: 1; + uint32_t irda_dplx: 1; + uint32_t irda_tx_en: 1; + uint32_t irda_wctl: 1; + uint32_t irda_tx_inv: 1; + uint32_t irda_rx_inv: 1; + uint32_t loopback: 1; + uint32_t tx_flow_en: 1; + uint32_t irda_en: 1; + uint32_t rxfifo_rst: 1; + uint32_t txfifo_rst: 1; + uint32_t rxd_inv: 1; + uint32_t cts_inv: 1; + uint32_t dsr_inv: 1; + uint32_t txd_inv: 1; + uint32_t rts_inv: 1; + uint32_t dtr_inv: 1; + uint32_t clk_en: 1; + uint32_t err_wr_mask: 1; + uint32_t tick_ref_always_on: 1; + uint32_t reserved28: 4; + }; + uint32_t val; + } conf0; + union { + struct { + uint32_t rxfifo_full_thrhd: 9; + uint32_t txfifo_empty_thrhd: 9; + uint32_t reserved18: 11; + uint32_t rx_tout_flow_dis: 1; + uint32_t rx_flow_en: 1; + uint32_t rx_tout_en: 1; + }; + uint32_t val; + } conf1; + union { + struct { + uint32_t min_cnt: 20; + uint32_t reserved20: 12; + }; + uint32_t val; + } lowpulse; + union { + struct { + uint32_t min_cnt: 20; + uint32_t reserved20: 12; + }; + uint32_t val; + } highpulse; + union { + struct { + uint32_t edge_cnt: 10; + uint32_t reserved10: 22; + }; + uint32_t val; + } rxd_cnt; + union { + struct { + uint32_t sw_flow_con_en: 1; + uint32_t xonoff_del: 1; + uint32_t force_xon: 1; + uint32_t force_xoff: 1; + uint32_t send_xon: 1; + uint32_t send_xoff: 1; + uint32_t reserved6: 26; + }; + uint32_t val; + } flow_conf; + union { + struct { + uint32_t active_threshold:10; + uint32_t reserved10: 22; + }; + uint32_t val; + } sleep_conf; + union { + struct { + uint32_t xoff_threshold: 9; + uint32_t xoff_char: 8; + uint32_t reserved17: 15; + }; + uint32_t val; + } swfc_conf0; + union { + struct { + uint32_t xon_threshold: 9; + uint32_t xon_char: 8; + uint32_t reserved17: 15; + }; + uint32_t val; + } swfc_conf1; + union { + struct { + uint32_t rx_idle_thrhd:10; + uint32_t tx_idle_num: 10; + uint32_t tx_brk_num: 8; + uint32_t reserved28: 4; + }; + uint32_t val; + } idle_conf; + union { + struct { + uint32_t en: 1; + uint32_t dl0_en: 1; + uint32_t dl1_en: 1; + uint32_t tx_rx_en: 1; + uint32_t rx_busy_tx_en: 1; + uint32_t rx_dly_num: 1; + uint32_t tx_dly_num: 4; + uint32_t reserved10: 22; + }; + uint32_t val; + } rs485_conf; + union { + struct { + uint32_t pre_idle_num:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } at_cmd_precnt; + union { + struct { + uint32_t post_idle_num:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } at_cmd_postcnt; + union { + struct { + uint32_t rx_gap_tout:16; + uint32_t reserved16: 16; + }; + uint32_t val; + } at_cmd_gaptout; + union { + struct { + uint32_t data: 8; + uint32_t char_num: 8; + uint32_t reserved16: 16; + }; + uint32_t val; + } at_cmd_char; + union { + struct { + uint32_t mem_pd: 1; + uint32_t rx_size: 3; + uint32_t tx_size: 3; + uint32_t rx_flow_thrhd: 9; + uint32_t rx_tout_thrhd:10; + uint32_t reserved26: 6; + }; + uint32_t val; + } mem_conf; + union { + struct { + uint32_t apb_tx_waddr:10; + uint32_t reserved10: 1; + uint32_t tx_raddr: 10; + uint32_t reserved21: 11; + }; + uint32_t val; + } mem_tx_status; + union { + struct { + uint32_t apb_rx_raddr:10; + uint32_t reserved10: 1; + uint32_t rx_waddr: 10; + uint32_t reserved21: 11; + }; + uint32_t val; + } mem_rx_status; + union { + struct { + uint32_t st_urx_out: 4; + uint32_t st_utx_out: 4; + uint32_t reserved8: 24; + }; + uint32_t val; + } fsm_status; + union { + struct { + uint32_t min_cnt: 20; + uint32_t reserved20: 12; + }; + uint32_t val; + } pospulse; + union { + struct { + uint32_t min_cnt: 20; + uint32_t reserved20: 12; + }; + uint32_t val; + } negpulse; + uint32_t date; /**/ + uint32_t id; /**/ +} uart_dev_t; +extern uart_dev_t UART0; +extern uart_dev_t UART1; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_UART_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/uhci_reg.h b/components/soc/esp32s2beta/include/soc/uhci_reg.h new file mode 100644 index 0000000000..9a23fe737f --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/uhci_reg.h @@ -0,0 +1,1270 @@ +// Copyright 2017-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_UHCI_REG_H_ +#define _SOC_UHCI_REG_H_ + + +#ifdef __cplusplus +extern "C" { +#endif +#include "soc.h" +#define UHCI_CONF0_REG(i) (REG_UHCI_BASE(i) + 0x0) +/* UHCI_UART_RX_BRK_EOF_EN : R/W ;bitpos:[23] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_UART_RX_BRK_EOF_EN (BIT(23)) +#define UHCI_UART_RX_BRK_EOF_EN_M (BIT(23)) +#define UHCI_UART_RX_BRK_EOF_EN_V 0x1 +#define UHCI_UART_RX_BRK_EOF_EN_S 23 +/* UHCI_CLK_EN : R/W ;bitpos:[22] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_CLK_EN (BIT(22)) +#define UHCI_CLK_EN_M (BIT(22)) +#define UHCI_CLK_EN_V 0x1 +#define UHCI_CLK_EN_S 22 +/* UHCI_ENCODE_CRC_EN : R/W ;bitpos:[21] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_ENCODE_CRC_EN (BIT(21)) +#define UHCI_ENCODE_CRC_EN_M (BIT(21)) +#define UHCI_ENCODE_CRC_EN_V 0x1 +#define UHCI_ENCODE_CRC_EN_S 21 +/* UHCI_LEN_EOF_EN : R/W ;bitpos:[20] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_LEN_EOF_EN (BIT(20)) +#define UHCI_LEN_EOF_EN_M (BIT(20)) +#define UHCI_LEN_EOF_EN_V 0x1 +#define UHCI_LEN_EOF_EN_S 20 +/* UHCI_UART_IDLE_EOF_EN : R/W ;bitpos:[19] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_UART_IDLE_EOF_EN (BIT(19)) +#define UHCI_UART_IDLE_EOF_EN_M (BIT(19)) +#define UHCI_UART_IDLE_EOF_EN_V 0x1 +#define UHCI_UART_IDLE_EOF_EN_S 19 +/* UHCI_CRC_REC_EN : R/W ;bitpos:[18] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_CRC_REC_EN (BIT(18)) +#define UHCI_CRC_REC_EN_M (BIT(18)) +#define UHCI_CRC_REC_EN_V 0x1 +#define UHCI_CRC_REC_EN_S 18 +/* UHCI_HEAD_EN : R/W ;bitpos:[17] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_HEAD_EN (BIT(17)) +#define UHCI_HEAD_EN_M (BIT(17)) +#define UHCI_HEAD_EN_V 0x1 +#define UHCI_HEAD_EN_S 17 +/* UHCI_SEPER_EN : R/W ;bitpos:[16] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_SEPER_EN (BIT(16)) +#define UHCI_SEPER_EN_M (BIT(16)) +#define UHCI_SEPER_EN_V 0x1 +#define UHCI_SEPER_EN_S 16 +/* UHCI_MEM_TRANS_EN : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_MEM_TRANS_EN (BIT(15)) +#define UHCI_MEM_TRANS_EN_M (BIT(15)) +#define UHCI_MEM_TRANS_EN_V 0x1 +#define UHCI_MEM_TRANS_EN_S 15 +/* UHCI_OUT_DATA_BURST_EN : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_DATA_BURST_EN (BIT(14)) +#define UHCI_OUT_DATA_BURST_EN_M (BIT(14)) +#define UHCI_OUT_DATA_BURST_EN_V 0x1 +#define UHCI_OUT_DATA_BURST_EN_S 14 +/* UHCI_INDSCR_BURST_EN : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_INDSCR_BURST_EN (BIT(13)) +#define UHCI_INDSCR_BURST_EN_M (BIT(13)) +#define UHCI_INDSCR_BURST_EN_V 0x1 +#define UHCI_INDSCR_BURST_EN_S 13 +/* UHCI_OUTDSCR_BURST_EN : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUTDSCR_BURST_EN (BIT(12)) +#define UHCI_OUTDSCR_BURST_EN_M (BIT(12)) +#define UHCI_OUTDSCR_BURST_EN_V 0x1 +#define UHCI_OUTDSCR_BURST_EN_S 12 +/* UHCI_UART1_CE : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_UART1_CE (BIT(10)) +#define UHCI_UART1_CE_M (BIT(10)) +#define UHCI_UART1_CE_V 0x1 +#define UHCI_UART1_CE_S 10 +/* UHCI_UART0_CE : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_UART0_CE (BIT(9)) +#define UHCI_UART0_CE_M (BIT(9)) +#define UHCI_UART0_CE_V 0x1 +#define UHCI_UART0_CE_S 9 +/* UHCI_OUT_EOF_MODE : R/W ;bitpos:[8] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_OUT_EOF_MODE (BIT(8)) +#define UHCI_OUT_EOF_MODE_M (BIT(8)) +#define UHCI_OUT_EOF_MODE_V 0x1 +#define UHCI_OUT_EOF_MODE_S 8 +/* UHCI_OUT_NO_RESTART_CLR : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_NO_RESTART_CLR (BIT(7)) +#define UHCI_OUT_NO_RESTART_CLR_M (BIT(7)) +#define UHCI_OUT_NO_RESTART_CLR_V 0x1 +#define UHCI_OUT_NO_RESTART_CLR_S 7 +/* UHCI_OUT_AUTO_WRBACK : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_AUTO_WRBACK (BIT(6)) +#define UHCI_OUT_AUTO_WRBACK_M (BIT(6)) +#define UHCI_OUT_AUTO_WRBACK_V 0x1 +#define UHCI_OUT_AUTO_WRBACK_S 6 +/* UHCI_OUT_LOOP_TEST : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_LOOP_TEST (BIT(5)) +#define UHCI_OUT_LOOP_TEST_M (BIT(5)) +#define UHCI_OUT_LOOP_TEST_V 0x1 +#define UHCI_OUT_LOOP_TEST_S 5 +/* UHCI_IN_LOOP_TEST : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_LOOP_TEST (BIT(4)) +#define UHCI_IN_LOOP_TEST_M (BIT(4)) +#define UHCI_IN_LOOP_TEST_V 0x1 +#define UHCI_IN_LOOP_TEST_S 4 +/* UHCI_AHBM_RST : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_AHBM_RST (BIT(3)) +#define UHCI_AHBM_RST_M (BIT(3)) +#define UHCI_AHBM_RST_V 0x1 +#define UHCI_AHBM_RST_S 3 +/* UHCI_AHBM_FIFO_RST : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_AHBM_FIFO_RST (BIT(2)) +#define UHCI_AHBM_FIFO_RST_M (BIT(2)) +#define UHCI_AHBM_FIFO_RST_V 0x1 +#define UHCI_AHBM_FIFO_RST_S 2 +/* UHCI_OUT_RST : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_RST (BIT(1)) +#define UHCI_OUT_RST_M (BIT(1)) +#define UHCI_OUT_RST_V 0x1 +#define UHCI_OUT_RST_S 1 +/* UHCI_IN_RST : R/W ;bitpos:[0] ;default: 1'h0 ; */ +/*description: */ +#define UHCI_IN_RST (BIT(0)) +#define UHCI_IN_RST_M (BIT(0)) +#define UHCI_IN_RST_V 0x1 +#define UHCI_IN_RST_S 0 + +#define UHCI_INT_RAW_REG(i) (REG_UHCI_BASE(i) + 0x4) +/* UHCI_DMA_INFIFO_FULL_WM_INT_RAW : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_DMA_INFIFO_FULL_WM_INT_RAW (BIT(16)) +#define UHCI_DMA_INFIFO_FULL_WM_INT_RAW_M (BIT(16)) +#define UHCI_DMA_INFIFO_FULL_WM_INT_RAW_V 0x1 +#define UHCI_DMA_INFIFO_FULL_WM_INT_RAW_S 16 +/* UHCI_SEND_A_Q_INT_RAW : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SEND_A_Q_INT_RAW (BIT(15)) +#define UHCI_SEND_A_Q_INT_RAW_M (BIT(15)) +#define UHCI_SEND_A_Q_INT_RAW_V 0x1 +#define UHCI_SEND_A_Q_INT_RAW_S 15 +/* UHCI_SEND_S_Q_INT_RAW : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SEND_S_Q_INT_RAW (BIT(14)) +#define UHCI_SEND_S_Q_INT_RAW_M (BIT(14)) +#define UHCI_SEND_S_Q_INT_RAW_V 0x1 +#define UHCI_SEND_S_Q_INT_RAW_S 14 +/* UHCI_OUT_TOTAL_EOF_INT_RAW : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_TOTAL_EOF_INT_RAW (BIT(13)) +#define UHCI_OUT_TOTAL_EOF_INT_RAW_M (BIT(13)) +#define UHCI_OUT_TOTAL_EOF_INT_RAW_V 0x1 +#define UHCI_OUT_TOTAL_EOF_INT_RAW_S 13 +/* UHCI_OUTLINK_EOF_ERR_INT_RAW : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_EOF_ERR_INT_RAW (BIT(12)) +#define UHCI_OUTLINK_EOF_ERR_INT_RAW_M (BIT(12)) +#define UHCI_OUTLINK_EOF_ERR_INT_RAW_V 0x1 +#define UHCI_OUTLINK_EOF_ERR_INT_RAW_S 12 +/* UHCI_IN_DSCR_EMPTY_INT_RAW : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DSCR_EMPTY_INT_RAW (BIT(11)) +#define UHCI_IN_DSCR_EMPTY_INT_RAW_M (BIT(11)) +#define UHCI_IN_DSCR_EMPTY_INT_RAW_V 0x1 +#define UHCI_IN_DSCR_EMPTY_INT_RAW_S 11 +/* UHCI_OUT_DSCR_ERR_INT_RAW : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_DSCR_ERR_INT_RAW (BIT(10)) +#define UHCI_OUT_DSCR_ERR_INT_RAW_M (BIT(10)) +#define UHCI_OUT_DSCR_ERR_INT_RAW_V 0x1 +#define UHCI_OUT_DSCR_ERR_INT_RAW_S 10 +/* UHCI_IN_DSCR_ERR_INT_RAW : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DSCR_ERR_INT_RAW (BIT(9)) +#define UHCI_IN_DSCR_ERR_INT_RAW_M (BIT(9)) +#define UHCI_IN_DSCR_ERR_INT_RAW_V 0x1 +#define UHCI_IN_DSCR_ERR_INT_RAW_S 9 +/* UHCI_OUT_EOF_INT_RAW : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_EOF_INT_RAW (BIT(8)) +#define UHCI_OUT_EOF_INT_RAW_M (BIT(8)) +#define UHCI_OUT_EOF_INT_RAW_V 0x1 +#define UHCI_OUT_EOF_INT_RAW_S 8 +/* UHCI_OUT_DONE_INT_RAW : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_DONE_INT_RAW (BIT(7)) +#define UHCI_OUT_DONE_INT_RAW_M (BIT(7)) +#define UHCI_OUT_DONE_INT_RAW_V 0x1 +#define UHCI_OUT_DONE_INT_RAW_S 7 +/* UHCI_IN_ERR_EOF_INT_RAW : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_ERR_EOF_INT_RAW (BIT(6)) +#define UHCI_IN_ERR_EOF_INT_RAW_M (BIT(6)) +#define UHCI_IN_ERR_EOF_INT_RAW_V 0x1 +#define UHCI_IN_ERR_EOF_INT_RAW_S 6 +/* UHCI_IN_SUC_EOF_INT_RAW : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_SUC_EOF_INT_RAW (BIT(5)) +#define UHCI_IN_SUC_EOF_INT_RAW_M (BIT(5)) +#define UHCI_IN_SUC_EOF_INT_RAW_V 0x1 +#define UHCI_IN_SUC_EOF_INT_RAW_S 5 +/* UHCI_IN_DONE_INT_RAW : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DONE_INT_RAW (BIT(4)) +#define UHCI_IN_DONE_INT_RAW_M (BIT(4)) +#define UHCI_IN_DONE_INT_RAW_V 0x1 +#define UHCI_IN_DONE_INT_RAW_S 4 +/* UHCI_TX_HUNG_INT_RAW : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_TX_HUNG_INT_RAW (BIT(3)) +#define UHCI_TX_HUNG_INT_RAW_M (BIT(3)) +#define UHCI_TX_HUNG_INT_RAW_V 0x1 +#define UHCI_TX_HUNG_INT_RAW_S 3 +/* UHCI_RX_HUNG_INT_RAW : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_RX_HUNG_INT_RAW (BIT(2)) +#define UHCI_RX_HUNG_INT_RAW_M (BIT(2)) +#define UHCI_RX_HUNG_INT_RAW_V 0x1 +#define UHCI_RX_HUNG_INT_RAW_S 2 +/* UHCI_TX_START_INT_RAW : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_TX_START_INT_RAW (BIT(1)) +#define UHCI_TX_START_INT_RAW_M (BIT(1)) +#define UHCI_TX_START_INT_RAW_V 0x1 +#define UHCI_TX_START_INT_RAW_S 1 +/* UHCI_RX_START_INT_RAW : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_RX_START_INT_RAW (BIT(0)) +#define UHCI_RX_START_INT_RAW_M (BIT(0)) +#define UHCI_RX_START_INT_RAW_V 0x1 +#define UHCI_RX_START_INT_RAW_S 0 + +#define UHCI_INT_ST_REG(i) (REG_UHCI_BASE(i) + 0x8) +/* UHCI_DMA_INFIFO_FULL_WM_INT_ST : RO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_DMA_INFIFO_FULL_WM_INT_ST (BIT(16)) +#define UHCI_DMA_INFIFO_FULL_WM_INT_ST_M (BIT(16)) +#define UHCI_DMA_INFIFO_FULL_WM_INT_ST_V 0x1 +#define UHCI_DMA_INFIFO_FULL_WM_INT_ST_S 16 +/* UHCI_SEND_A_Q_INT_ST : RO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SEND_A_Q_INT_ST (BIT(15)) +#define UHCI_SEND_A_Q_INT_ST_M (BIT(15)) +#define UHCI_SEND_A_Q_INT_ST_V 0x1 +#define UHCI_SEND_A_Q_INT_ST_S 15 +/* UHCI_SEND_S_Q_INT_ST : RO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SEND_S_Q_INT_ST (BIT(14)) +#define UHCI_SEND_S_Q_INT_ST_M (BIT(14)) +#define UHCI_SEND_S_Q_INT_ST_V 0x1 +#define UHCI_SEND_S_Q_INT_ST_S 14 +/* UHCI_OUT_TOTAL_EOF_INT_ST : RO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_TOTAL_EOF_INT_ST (BIT(13)) +#define UHCI_OUT_TOTAL_EOF_INT_ST_M (BIT(13)) +#define UHCI_OUT_TOTAL_EOF_INT_ST_V 0x1 +#define UHCI_OUT_TOTAL_EOF_INT_ST_S 13 +/* UHCI_OUTLINK_EOF_ERR_INT_ST : RO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_EOF_ERR_INT_ST (BIT(12)) +#define UHCI_OUTLINK_EOF_ERR_INT_ST_M (BIT(12)) +#define UHCI_OUTLINK_EOF_ERR_INT_ST_V 0x1 +#define UHCI_OUTLINK_EOF_ERR_INT_ST_S 12 +/* UHCI_IN_DSCR_EMPTY_INT_ST : RO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DSCR_EMPTY_INT_ST (BIT(11)) +#define UHCI_IN_DSCR_EMPTY_INT_ST_M (BIT(11)) +#define UHCI_IN_DSCR_EMPTY_INT_ST_V 0x1 +#define UHCI_IN_DSCR_EMPTY_INT_ST_S 11 +/* UHCI_OUT_DSCR_ERR_INT_ST : RO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_DSCR_ERR_INT_ST (BIT(10)) +#define UHCI_OUT_DSCR_ERR_INT_ST_M (BIT(10)) +#define UHCI_OUT_DSCR_ERR_INT_ST_V 0x1 +#define UHCI_OUT_DSCR_ERR_INT_ST_S 10 +/* UHCI_IN_DSCR_ERR_INT_ST : RO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DSCR_ERR_INT_ST (BIT(9)) +#define UHCI_IN_DSCR_ERR_INT_ST_M (BIT(9)) +#define UHCI_IN_DSCR_ERR_INT_ST_V 0x1 +#define UHCI_IN_DSCR_ERR_INT_ST_S 9 +/* UHCI_OUT_EOF_INT_ST : RO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_EOF_INT_ST (BIT(8)) +#define UHCI_OUT_EOF_INT_ST_M (BIT(8)) +#define UHCI_OUT_EOF_INT_ST_V 0x1 +#define UHCI_OUT_EOF_INT_ST_S 8 +/* UHCI_OUT_DONE_INT_ST : RO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_DONE_INT_ST (BIT(7)) +#define UHCI_OUT_DONE_INT_ST_M (BIT(7)) +#define UHCI_OUT_DONE_INT_ST_V 0x1 +#define UHCI_OUT_DONE_INT_ST_S 7 +/* UHCI_IN_ERR_EOF_INT_ST : RO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_ERR_EOF_INT_ST (BIT(6)) +#define UHCI_IN_ERR_EOF_INT_ST_M (BIT(6)) +#define UHCI_IN_ERR_EOF_INT_ST_V 0x1 +#define UHCI_IN_ERR_EOF_INT_ST_S 6 +/* UHCI_IN_SUC_EOF_INT_ST : RO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_SUC_EOF_INT_ST (BIT(5)) +#define UHCI_IN_SUC_EOF_INT_ST_M (BIT(5)) +#define UHCI_IN_SUC_EOF_INT_ST_V 0x1 +#define UHCI_IN_SUC_EOF_INT_ST_S 5 +/* UHCI_IN_DONE_INT_ST : RO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DONE_INT_ST (BIT(4)) +#define UHCI_IN_DONE_INT_ST_M (BIT(4)) +#define UHCI_IN_DONE_INT_ST_V 0x1 +#define UHCI_IN_DONE_INT_ST_S 4 +/* UHCI_TX_HUNG_INT_ST : RO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_TX_HUNG_INT_ST (BIT(3)) +#define UHCI_TX_HUNG_INT_ST_M (BIT(3)) +#define UHCI_TX_HUNG_INT_ST_V 0x1 +#define UHCI_TX_HUNG_INT_ST_S 3 +/* UHCI_RX_HUNG_INT_ST : RO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_RX_HUNG_INT_ST (BIT(2)) +#define UHCI_RX_HUNG_INT_ST_M (BIT(2)) +#define UHCI_RX_HUNG_INT_ST_V 0x1 +#define UHCI_RX_HUNG_INT_ST_S 2 +/* UHCI_TX_START_INT_ST : RO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_TX_START_INT_ST (BIT(1)) +#define UHCI_TX_START_INT_ST_M (BIT(1)) +#define UHCI_TX_START_INT_ST_V 0x1 +#define UHCI_TX_START_INT_ST_S 1 +/* UHCI_RX_START_INT_ST : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_RX_START_INT_ST (BIT(0)) +#define UHCI_RX_START_INT_ST_M (BIT(0)) +#define UHCI_RX_START_INT_ST_V 0x1 +#define UHCI_RX_START_INT_ST_S 0 + +#define UHCI_INT_ENA_REG(i) (REG_UHCI_BASE(i) + 0xC) +/* UHCI_DMA_INFIFO_FULL_WM_INT_ENA : R/W ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_DMA_INFIFO_FULL_WM_INT_ENA (BIT(16)) +#define UHCI_DMA_INFIFO_FULL_WM_INT_ENA_M (BIT(16)) +#define UHCI_DMA_INFIFO_FULL_WM_INT_ENA_V 0x1 +#define UHCI_DMA_INFIFO_FULL_WM_INT_ENA_S 16 +/* UHCI_SEND_A_Q_INT_ENA : R/W ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SEND_A_Q_INT_ENA (BIT(15)) +#define UHCI_SEND_A_Q_INT_ENA_M (BIT(15)) +#define UHCI_SEND_A_Q_INT_ENA_V 0x1 +#define UHCI_SEND_A_Q_INT_ENA_S 15 +/* UHCI_SEND_S_Q_INT_ENA : R/W ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SEND_S_Q_INT_ENA (BIT(14)) +#define UHCI_SEND_S_Q_INT_ENA_M (BIT(14)) +#define UHCI_SEND_S_Q_INT_ENA_V 0x1 +#define UHCI_SEND_S_Q_INT_ENA_S 14 +/* UHCI_OUT_TOTAL_EOF_INT_ENA : R/W ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_TOTAL_EOF_INT_ENA (BIT(13)) +#define UHCI_OUT_TOTAL_EOF_INT_ENA_M (BIT(13)) +#define UHCI_OUT_TOTAL_EOF_INT_ENA_V 0x1 +#define UHCI_OUT_TOTAL_EOF_INT_ENA_S 13 +/* UHCI_OUTLINK_EOF_ERR_INT_ENA : R/W ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_EOF_ERR_INT_ENA (BIT(12)) +#define UHCI_OUTLINK_EOF_ERR_INT_ENA_M (BIT(12)) +#define UHCI_OUTLINK_EOF_ERR_INT_ENA_V 0x1 +#define UHCI_OUTLINK_EOF_ERR_INT_ENA_S 12 +/* UHCI_IN_DSCR_EMPTY_INT_ENA : R/W ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DSCR_EMPTY_INT_ENA (BIT(11)) +#define UHCI_IN_DSCR_EMPTY_INT_ENA_M (BIT(11)) +#define UHCI_IN_DSCR_EMPTY_INT_ENA_V 0x1 +#define UHCI_IN_DSCR_EMPTY_INT_ENA_S 11 +/* UHCI_OUT_DSCR_ERR_INT_ENA : R/W ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_DSCR_ERR_INT_ENA (BIT(10)) +#define UHCI_OUT_DSCR_ERR_INT_ENA_M (BIT(10)) +#define UHCI_OUT_DSCR_ERR_INT_ENA_V 0x1 +#define UHCI_OUT_DSCR_ERR_INT_ENA_S 10 +/* UHCI_IN_DSCR_ERR_INT_ENA : R/W ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DSCR_ERR_INT_ENA (BIT(9)) +#define UHCI_IN_DSCR_ERR_INT_ENA_M (BIT(9)) +#define UHCI_IN_DSCR_ERR_INT_ENA_V 0x1 +#define UHCI_IN_DSCR_ERR_INT_ENA_S 9 +/* UHCI_OUT_EOF_INT_ENA : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_EOF_INT_ENA (BIT(8)) +#define UHCI_OUT_EOF_INT_ENA_M (BIT(8)) +#define UHCI_OUT_EOF_INT_ENA_V 0x1 +#define UHCI_OUT_EOF_INT_ENA_S 8 +/* UHCI_OUT_DONE_INT_ENA : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_DONE_INT_ENA (BIT(7)) +#define UHCI_OUT_DONE_INT_ENA_M (BIT(7)) +#define UHCI_OUT_DONE_INT_ENA_V 0x1 +#define UHCI_OUT_DONE_INT_ENA_S 7 +/* UHCI_IN_ERR_EOF_INT_ENA : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_ERR_EOF_INT_ENA (BIT(6)) +#define UHCI_IN_ERR_EOF_INT_ENA_M (BIT(6)) +#define UHCI_IN_ERR_EOF_INT_ENA_V 0x1 +#define UHCI_IN_ERR_EOF_INT_ENA_S 6 +/* UHCI_IN_SUC_EOF_INT_ENA : R/W ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_SUC_EOF_INT_ENA (BIT(5)) +#define UHCI_IN_SUC_EOF_INT_ENA_M (BIT(5)) +#define UHCI_IN_SUC_EOF_INT_ENA_V 0x1 +#define UHCI_IN_SUC_EOF_INT_ENA_S 5 +/* UHCI_IN_DONE_INT_ENA : R/W ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DONE_INT_ENA (BIT(4)) +#define UHCI_IN_DONE_INT_ENA_M (BIT(4)) +#define UHCI_IN_DONE_INT_ENA_V 0x1 +#define UHCI_IN_DONE_INT_ENA_S 4 +/* UHCI_TX_HUNG_INT_ENA : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_TX_HUNG_INT_ENA (BIT(3)) +#define UHCI_TX_HUNG_INT_ENA_M (BIT(3)) +#define UHCI_TX_HUNG_INT_ENA_V 0x1 +#define UHCI_TX_HUNG_INT_ENA_S 3 +/* UHCI_RX_HUNG_INT_ENA : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_RX_HUNG_INT_ENA (BIT(2)) +#define UHCI_RX_HUNG_INT_ENA_M (BIT(2)) +#define UHCI_RX_HUNG_INT_ENA_V 0x1 +#define UHCI_RX_HUNG_INT_ENA_S 2 +/* UHCI_TX_START_INT_ENA : R/W ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_TX_START_INT_ENA (BIT(1)) +#define UHCI_TX_START_INT_ENA_M (BIT(1)) +#define UHCI_TX_START_INT_ENA_V 0x1 +#define UHCI_TX_START_INT_ENA_S 1 +/* UHCI_RX_START_INT_ENA : R/W ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_RX_START_INT_ENA (BIT(0)) +#define UHCI_RX_START_INT_ENA_M (BIT(0)) +#define UHCI_RX_START_INT_ENA_V 0x1 +#define UHCI_RX_START_INT_ENA_S 0 + +#define UHCI_INT_CLR_REG(i) (REG_UHCI_BASE(i) + 0x10) +/* UHCI_DMA_INFIFO_FULL_WM_INT_CLR : WO ;bitpos:[16] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_DMA_INFIFO_FULL_WM_INT_CLR (BIT(16)) +#define UHCI_DMA_INFIFO_FULL_WM_INT_CLR_M (BIT(16)) +#define UHCI_DMA_INFIFO_FULL_WM_INT_CLR_V 0x1 +#define UHCI_DMA_INFIFO_FULL_WM_INT_CLR_S 16 +/* UHCI_SEND_A_Q_INT_CLR : WO ;bitpos:[15] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SEND_A_Q_INT_CLR (BIT(15)) +#define UHCI_SEND_A_Q_INT_CLR_M (BIT(15)) +#define UHCI_SEND_A_Q_INT_CLR_V 0x1 +#define UHCI_SEND_A_Q_INT_CLR_S 15 +/* UHCI_SEND_S_Q_INT_CLR : WO ;bitpos:[14] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SEND_S_Q_INT_CLR (BIT(14)) +#define UHCI_SEND_S_Q_INT_CLR_M (BIT(14)) +#define UHCI_SEND_S_Q_INT_CLR_V 0x1 +#define UHCI_SEND_S_Q_INT_CLR_S 14 +/* UHCI_OUT_TOTAL_EOF_INT_CLR : WO ;bitpos:[13] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_TOTAL_EOF_INT_CLR (BIT(13)) +#define UHCI_OUT_TOTAL_EOF_INT_CLR_M (BIT(13)) +#define UHCI_OUT_TOTAL_EOF_INT_CLR_V 0x1 +#define UHCI_OUT_TOTAL_EOF_INT_CLR_S 13 +/* UHCI_OUTLINK_EOF_ERR_INT_CLR : WO ;bitpos:[12] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_EOF_ERR_INT_CLR (BIT(12)) +#define UHCI_OUTLINK_EOF_ERR_INT_CLR_M (BIT(12)) +#define UHCI_OUTLINK_EOF_ERR_INT_CLR_V 0x1 +#define UHCI_OUTLINK_EOF_ERR_INT_CLR_S 12 +/* UHCI_IN_DSCR_EMPTY_INT_CLR : WO ;bitpos:[11] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DSCR_EMPTY_INT_CLR (BIT(11)) +#define UHCI_IN_DSCR_EMPTY_INT_CLR_M (BIT(11)) +#define UHCI_IN_DSCR_EMPTY_INT_CLR_V 0x1 +#define UHCI_IN_DSCR_EMPTY_INT_CLR_S 11 +/* UHCI_OUT_DSCR_ERR_INT_CLR : WO ;bitpos:[10] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_DSCR_ERR_INT_CLR (BIT(10)) +#define UHCI_OUT_DSCR_ERR_INT_CLR_M (BIT(10)) +#define UHCI_OUT_DSCR_ERR_INT_CLR_V 0x1 +#define UHCI_OUT_DSCR_ERR_INT_CLR_S 10 +/* UHCI_IN_DSCR_ERR_INT_CLR : WO ;bitpos:[9] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DSCR_ERR_INT_CLR (BIT(9)) +#define UHCI_IN_DSCR_ERR_INT_CLR_M (BIT(9)) +#define UHCI_IN_DSCR_ERR_INT_CLR_V 0x1 +#define UHCI_IN_DSCR_ERR_INT_CLR_S 9 +/* UHCI_OUT_EOF_INT_CLR : WO ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_EOF_INT_CLR (BIT(8)) +#define UHCI_OUT_EOF_INT_CLR_M (BIT(8)) +#define UHCI_OUT_EOF_INT_CLR_V 0x1 +#define UHCI_OUT_EOF_INT_CLR_S 8 +/* UHCI_OUT_DONE_INT_CLR : WO ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_DONE_INT_CLR (BIT(7)) +#define UHCI_OUT_DONE_INT_CLR_M (BIT(7)) +#define UHCI_OUT_DONE_INT_CLR_V 0x1 +#define UHCI_OUT_DONE_INT_CLR_S 7 +/* UHCI_IN_ERR_EOF_INT_CLR : WO ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_ERR_EOF_INT_CLR (BIT(6)) +#define UHCI_IN_ERR_EOF_INT_CLR_M (BIT(6)) +#define UHCI_IN_ERR_EOF_INT_CLR_V 0x1 +#define UHCI_IN_ERR_EOF_INT_CLR_S 6 +/* UHCI_IN_SUC_EOF_INT_CLR : WO ;bitpos:[5] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_SUC_EOF_INT_CLR (BIT(5)) +#define UHCI_IN_SUC_EOF_INT_CLR_M (BIT(5)) +#define UHCI_IN_SUC_EOF_INT_CLR_V 0x1 +#define UHCI_IN_SUC_EOF_INT_CLR_S 5 +/* UHCI_IN_DONE_INT_CLR : WO ;bitpos:[4] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_DONE_INT_CLR (BIT(4)) +#define UHCI_IN_DONE_INT_CLR_M (BIT(4)) +#define UHCI_IN_DONE_INT_CLR_V 0x1 +#define UHCI_IN_DONE_INT_CLR_S 4 +/* UHCI_TX_HUNG_INT_CLR : WO ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_TX_HUNG_INT_CLR (BIT(3)) +#define UHCI_TX_HUNG_INT_CLR_M (BIT(3)) +#define UHCI_TX_HUNG_INT_CLR_V 0x1 +#define UHCI_TX_HUNG_INT_CLR_S 3 +/* UHCI_RX_HUNG_INT_CLR : WO ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_RX_HUNG_INT_CLR (BIT(2)) +#define UHCI_RX_HUNG_INT_CLR_M (BIT(2)) +#define UHCI_RX_HUNG_INT_CLR_V 0x1 +#define UHCI_RX_HUNG_INT_CLR_S 2 +/* UHCI_TX_START_INT_CLR : WO ;bitpos:[1] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_TX_START_INT_CLR (BIT(1)) +#define UHCI_TX_START_INT_CLR_M (BIT(1)) +#define UHCI_TX_START_INT_CLR_V 0x1 +#define UHCI_TX_START_INT_CLR_S 1 +/* UHCI_RX_START_INT_CLR : WO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_RX_START_INT_CLR (BIT(0)) +#define UHCI_RX_START_INT_CLR_M (BIT(0)) +#define UHCI_RX_START_INT_CLR_V 0x1 +#define UHCI_RX_START_INT_CLR_S 0 + +#define UHCI_DMA_OUT_STATUS_REG(i) (REG_UHCI_BASE(i) + 0x14) +/* UHCI_OUT_EMPTY : RO ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_OUT_EMPTY (BIT(1)) +#define UHCI_OUT_EMPTY_M (BIT(1)) +#define UHCI_OUT_EMPTY_V 0x1 +#define UHCI_OUT_EMPTY_S 1 +/* UHCI_OUT_FULL : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUT_FULL (BIT(0)) +#define UHCI_OUT_FULL_M (BIT(0)) +#define UHCI_OUT_FULL_V 0x1 +#define UHCI_OUT_FULL_S 0 + +#define UHCI_DMA_OUT_PUSH_REG(i) (REG_UHCI_BASE(i) + 0x18) +/* UHCI_OUTFIFO_PUSH : R/W ;bitpos:[16] ;default: 1'h0 ; */ +/*description: */ +#define UHCI_OUTFIFO_PUSH (BIT(16)) +#define UHCI_OUTFIFO_PUSH_M (BIT(16)) +#define UHCI_OUTFIFO_PUSH_V 0x1 +#define UHCI_OUTFIFO_PUSH_S 16 +/* UHCI_OUTFIFO_WDATA : R/W ;bitpos:[8:0] ;default: 9'h0 ; */ +/*description: */ +#define UHCI_OUTFIFO_WDATA 0x000001FF +#define UHCI_OUTFIFO_WDATA_M ((UHCI_OUTFIFO_WDATA_V)<<(UHCI_OUTFIFO_WDATA_S)) +#define UHCI_OUTFIFO_WDATA_V 0x1FF +#define UHCI_OUTFIFO_WDATA_S 0 + +#define UHCI_DMA_IN_STATUS_REG(i) (REG_UHCI_BASE(i) + 0x1C) +/* UHCI_RX_ERR_CAUSE : RO ;bitpos:[6:4] ;default: 3'h0 ; */ +/*description: */ +#define UHCI_RX_ERR_CAUSE 0x00000007 +#define UHCI_RX_ERR_CAUSE_M ((UHCI_RX_ERR_CAUSE_V)<<(UHCI_RX_ERR_CAUSE_S)) +#define UHCI_RX_ERR_CAUSE_V 0x7 +#define UHCI_RX_ERR_CAUSE_S 4 +/* UHCI_IN_EMPTY : RO ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_IN_EMPTY (BIT(1)) +#define UHCI_IN_EMPTY_M (BIT(1)) +#define UHCI_IN_EMPTY_V 0x1 +#define UHCI_IN_EMPTY_S 1 +/* UHCI_IN_FULL : RO ;bitpos:[0] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_IN_FULL (BIT(0)) +#define UHCI_IN_FULL_M (BIT(0)) +#define UHCI_IN_FULL_V 0x1 +#define UHCI_IN_FULL_S 0 + +#define UHCI_DMA_IN_POP_REG(i) (REG_UHCI_BASE(i) + 0x20) +/* UHCI_INFIFO_POP : R/W ;bitpos:[16] ;default: 1'h0 ; */ +/*description: */ +#define UHCI_INFIFO_POP (BIT(16)) +#define UHCI_INFIFO_POP_M (BIT(16)) +#define UHCI_INFIFO_POP_V 0x1 +#define UHCI_INFIFO_POP_S 16 +/* UHCI_INFIFO_RDATA : RO ;bitpos:[11:0] ;default: 12'h0 ; */ +/*description: */ +#define UHCI_INFIFO_RDATA 0x00000FFF +#define UHCI_INFIFO_RDATA_M ((UHCI_INFIFO_RDATA_V)<<(UHCI_INFIFO_RDATA_S)) +#define UHCI_INFIFO_RDATA_V 0xFFF +#define UHCI_INFIFO_RDATA_S 0 + +#define UHCI_DMA_OUT_LINK_REG(i) (REG_UHCI_BASE(i) + 0x24) +/* UHCI_OUTLINK_PARK : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define UHCI_OUTLINK_PARK (BIT(31)) +#define UHCI_OUTLINK_PARK_M (BIT(31)) +#define UHCI_OUTLINK_PARK_V 0x1 +#define UHCI_OUTLINK_PARK_S 31 +/* UHCI_OUTLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_RESTART (BIT(30)) +#define UHCI_OUTLINK_RESTART_M (BIT(30)) +#define UHCI_OUTLINK_RESTART_V 0x1 +#define UHCI_OUTLINK_RESTART_S 30 +/* UHCI_OUTLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_START (BIT(29)) +#define UHCI_OUTLINK_START_M (BIT(29)) +#define UHCI_OUTLINK_START_V 0x1 +#define UHCI_OUTLINK_START_S 29 +/* UHCI_OUTLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_STOP (BIT(28)) +#define UHCI_OUTLINK_STOP_M (BIT(28)) +#define UHCI_OUTLINK_STOP_V 0x1 +#define UHCI_OUTLINK_STOP_S 28 +/* UHCI_OUTLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define UHCI_OUTLINK_ADDR 0x000FFFFF +#define UHCI_OUTLINK_ADDR_M ((UHCI_OUTLINK_ADDR_V)<<(UHCI_OUTLINK_ADDR_S)) +#define UHCI_OUTLINK_ADDR_V 0xFFFFF +#define UHCI_OUTLINK_ADDR_S 0 + +#define UHCI_DMA_IN_LINK_REG(i) (REG_UHCI_BASE(i) + 0x28) +/* UHCI_INLINK_PARK : RO ;bitpos:[31] ;default: 1'h0 ; */ +/*description: */ +#define UHCI_INLINK_PARK (BIT(31)) +#define UHCI_INLINK_PARK_M (BIT(31)) +#define UHCI_INLINK_PARK_V 0x1 +#define UHCI_INLINK_PARK_S 31 +/* UHCI_INLINK_RESTART : R/W ;bitpos:[30] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_INLINK_RESTART (BIT(30)) +#define UHCI_INLINK_RESTART_M (BIT(30)) +#define UHCI_INLINK_RESTART_V 0x1 +#define UHCI_INLINK_RESTART_S 30 +/* UHCI_INLINK_START : R/W ;bitpos:[29] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_INLINK_START (BIT(29)) +#define UHCI_INLINK_START_M (BIT(29)) +#define UHCI_INLINK_START_V 0x1 +#define UHCI_INLINK_START_S 29 +/* UHCI_INLINK_STOP : R/W ;bitpos:[28] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_INLINK_STOP (BIT(28)) +#define UHCI_INLINK_STOP_M (BIT(28)) +#define UHCI_INLINK_STOP_V 0x1 +#define UHCI_INLINK_STOP_S 28 +/* UHCI_INLINK_AUTO_RET : R/W ;bitpos:[20] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_INLINK_AUTO_RET (BIT(20)) +#define UHCI_INLINK_AUTO_RET_M (BIT(20)) +#define UHCI_INLINK_AUTO_RET_V 0x1 +#define UHCI_INLINK_AUTO_RET_S 20 +/* UHCI_INLINK_ADDR : R/W ;bitpos:[19:0] ;default: 20'h0 ; */ +/*description: */ +#define UHCI_INLINK_ADDR 0x000FFFFF +#define UHCI_INLINK_ADDR_M ((UHCI_INLINK_ADDR_V)<<(UHCI_INLINK_ADDR_S)) +#define UHCI_INLINK_ADDR_V 0xFFFFF +#define UHCI_INLINK_ADDR_S 0 + +#define UHCI_CONF1_REG(i) (REG_UHCI_BASE(i) + 0x2C) +/* UHCI_DMA_INFIFO_FULL_THRS : R/W ;bitpos:[20:9] ;default: 12'b0 ; */ +/*description: */ +#define UHCI_DMA_INFIFO_FULL_THRS 0x00000FFF +#define UHCI_DMA_INFIFO_FULL_THRS_M ((UHCI_DMA_INFIFO_FULL_THRS_V)<<(UHCI_DMA_INFIFO_FULL_THRS_S)) +#define UHCI_DMA_INFIFO_FULL_THRS_V 0xFFF +#define UHCI_DMA_INFIFO_FULL_THRS_S 9 +/* UHCI_SW_START : R/W ;bitpos:[8] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SW_START (BIT(8)) +#define UHCI_SW_START_M (BIT(8)) +#define UHCI_SW_START_V 0x1 +#define UHCI_SW_START_S 8 +/* UHCI_WAIT_SW_START : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_WAIT_SW_START (BIT(7)) +#define UHCI_WAIT_SW_START_M (BIT(7)) +#define UHCI_WAIT_SW_START_V 0x1 +#define UHCI_WAIT_SW_START_S 7 +/* UHCI_CHECK_OWNER : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_CHECK_OWNER (BIT(6)) +#define UHCI_CHECK_OWNER_M (BIT(6)) +#define UHCI_CHECK_OWNER_V 0x1 +#define UHCI_CHECK_OWNER_S 6 +/* UHCI_TX_ACK_NUM_RE : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_TX_ACK_NUM_RE (BIT(5)) +#define UHCI_TX_ACK_NUM_RE_M (BIT(5)) +#define UHCI_TX_ACK_NUM_RE_V 0x1 +#define UHCI_TX_ACK_NUM_RE_S 5 +/* UHCI_TX_CHECK_SUM_RE : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_TX_CHECK_SUM_RE (BIT(4)) +#define UHCI_TX_CHECK_SUM_RE_M (BIT(4)) +#define UHCI_TX_CHECK_SUM_RE_V 0x1 +#define UHCI_TX_CHECK_SUM_RE_S 4 +/* UHCI_SAVE_HEAD : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SAVE_HEAD (BIT(3)) +#define UHCI_SAVE_HEAD_M (BIT(3)) +#define UHCI_SAVE_HEAD_V 0x1 +#define UHCI_SAVE_HEAD_S 3 +/* UHCI_CRC_DISABLE : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_CRC_DISABLE (BIT(2)) +#define UHCI_CRC_DISABLE_M (BIT(2)) +#define UHCI_CRC_DISABLE_V 0x1 +#define UHCI_CRC_DISABLE_S 2 +/* UHCI_CHECK_SEQ_EN : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_CHECK_SEQ_EN (BIT(1)) +#define UHCI_CHECK_SEQ_EN_M (BIT(1)) +#define UHCI_CHECK_SEQ_EN_V 0x1 +#define UHCI_CHECK_SEQ_EN_S 1 +/* UHCI_CHECK_SUM_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_CHECK_SUM_EN (BIT(0)) +#define UHCI_CHECK_SUM_EN_M (BIT(0)) +#define UHCI_CHECK_SUM_EN_V 0x1 +#define UHCI_CHECK_SUM_EN_S 0 + +#define UHCI_STATE0_REG(i) (REG_UHCI_BASE(i) + 0x30) +/* UHCI_DECODE_STATE : RO ;bitpos:[30:28] ;default: 3'b0 ; */ +/*description: */ +#define UHCI_DECODE_STATE 0x00000007 +#define UHCI_DECODE_STATE_M ((UHCI_DECODE_STATE_V)<<(UHCI_DECODE_STATE_S)) +#define UHCI_DECODE_STATE_V 0x7 +#define UHCI_DECODE_STATE_S 28 +/* UHCI_INFIFO_CNT_DEBUG : RO ;bitpos:[27:23] ;default: 5'b0 ; */ +/*description: */ +#define UHCI_INFIFO_CNT_DEBUG 0x0000001F +#define UHCI_INFIFO_CNT_DEBUG_M ((UHCI_INFIFO_CNT_DEBUG_V)<<(UHCI_INFIFO_CNT_DEBUG_S)) +#define UHCI_INFIFO_CNT_DEBUG_V 0x1F +#define UHCI_INFIFO_CNT_DEBUG_S 23 +/* UHCI_IN_STATE : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: */ +#define UHCI_IN_STATE 0x00000007 +#define UHCI_IN_STATE_M ((UHCI_IN_STATE_V)<<(UHCI_IN_STATE_S)) +#define UHCI_IN_STATE_V 0x7 +#define UHCI_IN_STATE_S 20 +/* UHCI_IN_DSCR_STATE : RO ;bitpos:[19:18] ;default: 2'b0 ; */ +/*description: */ +#define UHCI_IN_DSCR_STATE 0x00000003 +#define UHCI_IN_DSCR_STATE_M ((UHCI_IN_DSCR_STATE_V)<<(UHCI_IN_DSCR_STATE_S)) +#define UHCI_IN_DSCR_STATE_V 0x3 +#define UHCI_IN_DSCR_STATE_S 18 +/* UHCI_INLINK_DSCR_ADDR : RO ;bitpos:[17:0] ;default: 18'b0 ; */ +/*description: */ +#define UHCI_INLINK_DSCR_ADDR 0x0003FFFF +#define UHCI_INLINK_DSCR_ADDR_M ((UHCI_INLINK_DSCR_ADDR_V)<<(UHCI_INLINK_DSCR_ADDR_S)) +#define UHCI_INLINK_DSCR_ADDR_V 0x3FFFF +#define UHCI_INLINK_DSCR_ADDR_S 0 + +#define UHCI_STATE1_REG(i) (REG_UHCI_BASE(i) + 0x34) +/* UHCI_ENCODE_STATE : RO ;bitpos:[30:28] ;default: 3'b0 ; */ +/*description: */ +#define UHCI_ENCODE_STATE 0x00000007 +#define UHCI_ENCODE_STATE_M ((UHCI_ENCODE_STATE_V)<<(UHCI_ENCODE_STATE_S)) +#define UHCI_ENCODE_STATE_V 0x7 +#define UHCI_ENCODE_STATE_S 28 +/* UHCI_OUTFIFO_CNT : RO ;bitpos:[27:23] ;default: 5'b0 ; */ +/*description: */ +#define UHCI_OUTFIFO_CNT 0x0000001F +#define UHCI_OUTFIFO_CNT_M ((UHCI_OUTFIFO_CNT_V)<<(UHCI_OUTFIFO_CNT_S)) +#define UHCI_OUTFIFO_CNT_V 0x1F +#define UHCI_OUTFIFO_CNT_S 23 +/* UHCI_OUT_STATE : RO ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: */ +#define UHCI_OUT_STATE 0x00000007 +#define UHCI_OUT_STATE_M ((UHCI_OUT_STATE_V)<<(UHCI_OUT_STATE_S)) +#define UHCI_OUT_STATE_V 0x7 +#define UHCI_OUT_STATE_S 20 +/* UHCI_OUT_DSCR_STATE : RO ;bitpos:[19:18] ;default: 2'b0 ; */ +/*description: */ +#define UHCI_OUT_DSCR_STATE 0x00000003 +#define UHCI_OUT_DSCR_STATE_M ((UHCI_OUT_DSCR_STATE_V)<<(UHCI_OUT_DSCR_STATE_S)) +#define UHCI_OUT_DSCR_STATE_V 0x3 +#define UHCI_OUT_DSCR_STATE_S 18 +/* UHCI_OUTLINK_DSCR_ADDR : RO ;bitpos:[17:0] ;default: 18'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_DSCR_ADDR 0x0003FFFF +#define UHCI_OUTLINK_DSCR_ADDR_M ((UHCI_OUTLINK_DSCR_ADDR_V)<<(UHCI_OUTLINK_DSCR_ADDR_S)) +#define UHCI_OUTLINK_DSCR_ADDR_V 0x3FFFF +#define UHCI_OUTLINK_DSCR_ADDR_S 0 + +#define UHCI_DMA_OUT_EOF_DES_ADDR_REG(i) (REG_UHCI_BASE(i) + 0x38) +/* UHCI_OUT_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_OUT_EOF_DES_ADDR 0xFFFFFFFF +#define UHCI_OUT_EOF_DES_ADDR_M ((UHCI_OUT_EOF_DES_ADDR_V)<<(UHCI_OUT_EOF_DES_ADDR_S)) +#define UHCI_OUT_EOF_DES_ADDR_V 0xFFFFFFFF +#define UHCI_OUT_EOF_DES_ADDR_S 0 + +#define UHCI_DMA_IN_SUC_EOF_DES_ADDR_REG(i) (REG_UHCI_BASE(i) + 0x3C) +/* UHCI_IN_SUC_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_IN_SUC_EOF_DES_ADDR 0xFFFFFFFF +#define UHCI_IN_SUC_EOF_DES_ADDR_M ((UHCI_IN_SUC_EOF_DES_ADDR_V)<<(UHCI_IN_SUC_EOF_DES_ADDR_S)) +#define UHCI_IN_SUC_EOF_DES_ADDR_V 0xFFFFFFFF +#define UHCI_IN_SUC_EOF_DES_ADDR_S 0 + +#define UHCI_DMA_IN_ERR_EOF_DES_ADDR_REG(i) (REG_UHCI_BASE(i) + 0x40) +/* UHCI_IN_ERR_EOF_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_IN_ERR_EOF_DES_ADDR 0xFFFFFFFF +#define UHCI_IN_ERR_EOF_DES_ADDR_M ((UHCI_IN_ERR_EOF_DES_ADDR_V)<<(UHCI_IN_ERR_EOF_DES_ADDR_S)) +#define UHCI_IN_ERR_EOF_DES_ADDR_V 0xFFFFFFFF +#define UHCI_IN_ERR_EOF_DES_ADDR_S 0 + +#define UHCI_DMA_OUT_EOF_BFR_DES_ADDR_REG(i) (REG_UHCI_BASE(i) + 0x44) +/* UHCI_OUT_EOF_BFR_DES_ADDR : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_OUT_EOF_BFR_DES_ADDR 0xFFFFFFFF +#define UHCI_OUT_EOF_BFR_DES_ADDR_M ((UHCI_OUT_EOF_BFR_DES_ADDR_V)<<(UHCI_OUT_EOF_BFR_DES_ADDR_S)) +#define UHCI_OUT_EOF_BFR_DES_ADDR_V 0xFFFFFFFF +#define UHCI_OUT_EOF_BFR_DES_ADDR_S 0 + +#define UHCI_AHB_TEST_REG(i) (REG_UHCI_BASE(i) + 0x48) +/* UHCI_AHB_TESTADDR : R/W ;bitpos:[5:4] ;default: 2'b0 ; */ +/*description: */ +#define UHCI_AHB_TESTADDR 0x00000003 +#define UHCI_AHB_TESTADDR_M ((UHCI_AHB_TESTADDR_V)<<(UHCI_AHB_TESTADDR_S)) +#define UHCI_AHB_TESTADDR_V 0x3 +#define UHCI_AHB_TESTADDR_S 4 +/* UHCI_AHB_TESTMODE : R/W ;bitpos:[2:0] ;default: 3'b0 ; */ +/*description: */ +#define UHCI_AHB_TESTMODE 0x00000007 +#define UHCI_AHB_TESTMODE_M ((UHCI_AHB_TESTMODE_V)<<(UHCI_AHB_TESTMODE_S)) +#define UHCI_AHB_TESTMODE_V 0x7 +#define UHCI_AHB_TESTMODE_S 0 + +#define UHCI_DMA_IN_DSCR_REG(i) (REG_UHCI_BASE(i) + 0x4C) +/* UHCI_INLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define UHCI_INLINK_DSCR 0xFFFFFFFF +#define UHCI_INLINK_DSCR_M ((UHCI_INLINK_DSCR_V)<<(UHCI_INLINK_DSCR_S)) +#define UHCI_INLINK_DSCR_V 0xFFFFFFFF +#define UHCI_INLINK_DSCR_S 0 + +#define UHCI_DMA_IN_DSCR_BF0_REG(i) (REG_UHCI_BASE(i) + 0x50) +/* UHCI_INLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define UHCI_INLINK_DSCR_BF0 0xFFFFFFFF +#define UHCI_INLINK_DSCR_BF0_M ((UHCI_INLINK_DSCR_BF0_V)<<(UHCI_INLINK_DSCR_BF0_S)) +#define UHCI_INLINK_DSCR_BF0_V 0xFFFFFFFF +#define UHCI_INLINK_DSCR_BF0_S 0 + +#define UHCI_DMA_IN_DSCR_BF1_REG(i) (REG_UHCI_BASE(i) + 0x54) +/* UHCI_INLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define UHCI_INLINK_DSCR_BF1 0xFFFFFFFF +#define UHCI_INLINK_DSCR_BF1_M ((UHCI_INLINK_DSCR_BF1_V)<<(UHCI_INLINK_DSCR_BF1_S)) +#define UHCI_INLINK_DSCR_BF1_V 0xFFFFFFFF +#define UHCI_INLINK_DSCR_BF1_S 0 + +#define UHCI_DMA_OUT_DSCR_REG(i) (REG_UHCI_BASE(i) + 0x58) +/* UHCI_OUTLINK_DSCR : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_DSCR 0xFFFFFFFF +#define UHCI_OUTLINK_DSCR_M ((UHCI_OUTLINK_DSCR_V)<<(UHCI_OUTLINK_DSCR_S)) +#define UHCI_OUTLINK_DSCR_V 0xFFFFFFFF +#define UHCI_OUTLINK_DSCR_S 0 + +#define UHCI_DMA_OUT_DSCR_BF0_REG(i) (REG_UHCI_BASE(i) + 0x5C) +/* UHCI_OUTLINK_DSCR_BF0 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_DSCR_BF0 0xFFFFFFFF +#define UHCI_OUTLINK_DSCR_BF0_M ((UHCI_OUTLINK_DSCR_BF0_V)<<(UHCI_OUTLINK_DSCR_BF0_S)) +#define UHCI_OUTLINK_DSCR_BF0_V 0xFFFFFFFF +#define UHCI_OUTLINK_DSCR_BF0_S 0 + +#define UHCI_DMA_OUT_DSCR_BF1_REG(i) (REG_UHCI_BASE(i) + 0x60) +/* UHCI_OUTLINK_DSCR_BF1 : RO ;bitpos:[31:0] ;default: 32'b0 ; */ +/*description: */ +#define UHCI_OUTLINK_DSCR_BF1 0xFFFFFFFF +#define UHCI_OUTLINK_DSCR_BF1_M ((UHCI_OUTLINK_DSCR_BF1_V)<<(UHCI_OUTLINK_DSCR_BF1_S)) +#define UHCI_OUTLINK_DSCR_BF1_V 0xFFFFFFFF +#define UHCI_OUTLINK_DSCR_BF1_S 0 + +#define UHCI_ESCAPE_CONF_REG(i) (REG_UHCI_BASE(i) + 0x64) +/* UHCI_RX_13_ESC_EN : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_RX_13_ESC_EN (BIT(7)) +#define UHCI_RX_13_ESC_EN_M (BIT(7)) +#define UHCI_RX_13_ESC_EN_V 0x1 +#define UHCI_RX_13_ESC_EN_S 7 +/* UHCI_RX_11_ESC_EN : R/W ;bitpos:[6] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_RX_11_ESC_EN (BIT(6)) +#define UHCI_RX_11_ESC_EN_M (BIT(6)) +#define UHCI_RX_11_ESC_EN_V 0x1 +#define UHCI_RX_11_ESC_EN_S 6 +/* UHCI_RX_DB_ESC_EN : R/W ;bitpos:[5] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_RX_DB_ESC_EN (BIT(5)) +#define UHCI_RX_DB_ESC_EN_M (BIT(5)) +#define UHCI_RX_DB_ESC_EN_V 0x1 +#define UHCI_RX_DB_ESC_EN_S 5 +/* UHCI_RX_C0_ESC_EN : R/W ;bitpos:[4] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_RX_C0_ESC_EN (BIT(4)) +#define UHCI_RX_C0_ESC_EN_M (BIT(4)) +#define UHCI_RX_C0_ESC_EN_V 0x1 +#define UHCI_RX_C0_ESC_EN_S 4 +/* UHCI_TX_13_ESC_EN : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_TX_13_ESC_EN (BIT(3)) +#define UHCI_TX_13_ESC_EN_M (BIT(3)) +#define UHCI_TX_13_ESC_EN_V 0x1 +#define UHCI_TX_13_ESC_EN_S 3 +/* UHCI_TX_11_ESC_EN : R/W ;bitpos:[2] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_TX_11_ESC_EN (BIT(2)) +#define UHCI_TX_11_ESC_EN_M (BIT(2)) +#define UHCI_TX_11_ESC_EN_V 0x1 +#define UHCI_TX_11_ESC_EN_S 2 +/* UHCI_TX_DB_ESC_EN : R/W ;bitpos:[1] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_TX_DB_ESC_EN (BIT(1)) +#define UHCI_TX_DB_ESC_EN_M (BIT(1)) +#define UHCI_TX_DB_ESC_EN_V 0x1 +#define UHCI_TX_DB_ESC_EN_S 1 +/* UHCI_TX_C0_ESC_EN : R/W ;bitpos:[0] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_TX_C0_ESC_EN (BIT(0)) +#define UHCI_TX_C0_ESC_EN_M (BIT(0)) +#define UHCI_TX_C0_ESC_EN_V 0x1 +#define UHCI_TX_C0_ESC_EN_S 0 + +#define UHCI_HUNG_CONF_REG(i) (REG_UHCI_BASE(i) + 0x68) +/* UHCI_RXFIFO_TIMEOUT_ENA : R/W ;bitpos:[23] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_RXFIFO_TIMEOUT_ENA (BIT(23)) +#define UHCI_RXFIFO_TIMEOUT_ENA_M (BIT(23)) +#define UHCI_RXFIFO_TIMEOUT_ENA_V 0x1 +#define UHCI_RXFIFO_TIMEOUT_ENA_S 23 +/* UHCI_RXFIFO_TIMEOUT_SHIFT : R/W ;bitpos:[22:20] ;default: 3'b0 ; */ +/*description: */ +#define UHCI_RXFIFO_TIMEOUT_SHIFT 0x00000007 +#define UHCI_RXFIFO_TIMEOUT_SHIFT_M ((UHCI_RXFIFO_TIMEOUT_SHIFT_V)<<(UHCI_RXFIFO_TIMEOUT_SHIFT_S)) +#define UHCI_RXFIFO_TIMEOUT_SHIFT_V 0x7 +#define UHCI_RXFIFO_TIMEOUT_SHIFT_S 20 +/* UHCI_RXFIFO_TIMEOUT : R/W ;bitpos:[19:12] ;default: 8'h10 ; */ +/*description: */ +#define UHCI_RXFIFO_TIMEOUT 0x000000FF +#define UHCI_RXFIFO_TIMEOUT_M ((UHCI_RXFIFO_TIMEOUT_V)<<(UHCI_RXFIFO_TIMEOUT_S)) +#define UHCI_RXFIFO_TIMEOUT_V 0xFF +#define UHCI_RXFIFO_TIMEOUT_S 12 +/* UHCI_TXFIFO_TIMEOUT_ENA : R/W ;bitpos:[11] ;default: 1'b1 ; */ +/*description: */ +#define UHCI_TXFIFO_TIMEOUT_ENA (BIT(11)) +#define UHCI_TXFIFO_TIMEOUT_ENA_M (BIT(11)) +#define UHCI_TXFIFO_TIMEOUT_ENA_V 0x1 +#define UHCI_TXFIFO_TIMEOUT_ENA_S 11 +/* UHCI_TXFIFO_TIMEOUT_SHIFT : R/W ;bitpos:[10:8] ;default: 3'b0 ; */ +/*description: */ +#define UHCI_TXFIFO_TIMEOUT_SHIFT 0x00000007 +#define UHCI_TXFIFO_TIMEOUT_SHIFT_M ((UHCI_TXFIFO_TIMEOUT_SHIFT_V)<<(UHCI_TXFIFO_TIMEOUT_SHIFT_S)) +#define UHCI_TXFIFO_TIMEOUT_SHIFT_V 0x7 +#define UHCI_TXFIFO_TIMEOUT_SHIFT_S 8 +/* UHCI_TXFIFO_TIMEOUT : R/W ;bitpos:[7:0] ;default: 8'h10 ; */ +/*description: */ +#define UHCI_TXFIFO_TIMEOUT 0x000000FF +#define UHCI_TXFIFO_TIMEOUT_M ((UHCI_TXFIFO_TIMEOUT_V)<<(UHCI_TXFIFO_TIMEOUT_S)) +#define UHCI_TXFIFO_TIMEOUT_V 0xFF +#define UHCI_TXFIFO_TIMEOUT_S 0 + +#define UHCI_ACK_NUM_REG(i) (REG_UHCI_BASE(i) + 0x6C) + +#define UHCI_RX_HEAD_REG(i) (REG_UHCI_BASE(i) + 0x70) +/* UHCI_RX_HEAD : RO ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_RX_HEAD 0xFFFFFFFF +#define UHCI_RX_HEAD_M ((UHCI_RX_HEAD_V)<<(UHCI_RX_HEAD_S)) +#define UHCI_RX_HEAD_V 0xFFFFFFFF +#define UHCI_RX_HEAD_S 0 + +#define UHCI_QUICK_SENT_REG(i) (REG_UHCI_BASE(i) + 0x74) +/* UHCI_ALWAYS_SEND_EN : R/W ;bitpos:[7] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_ALWAYS_SEND_EN (BIT(7)) +#define UHCI_ALWAYS_SEND_EN_M (BIT(7)) +#define UHCI_ALWAYS_SEND_EN_V 0x1 +#define UHCI_ALWAYS_SEND_EN_S 7 +/* UHCI_ALWAYS_SEND_NUM : R/W ;bitpos:[6:4] ;default: 3'h0 ; */ +/*description: */ +#define UHCI_ALWAYS_SEND_NUM 0x00000007 +#define UHCI_ALWAYS_SEND_NUM_M ((UHCI_ALWAYS_SEND_NUM_V)<<(UHCI_ALWAYS_SEND_NUM_S)) +#define UHCI_ALWAYS_SEND_NUM_V 0x7 +#define UHCI_ALWAYS_SEND_NUM_S 4 +/* UHCI_SINGLE_SEND_EN : R/W ;bitpos:[3] ;default: 1'b0 ; */ +/*description: */ +#define UHCI_SINGLE_SEND_EN (BIT(3)) +#define UHCI_SINGLE_SEND_EN_M (BIT(3)) +#define UHCI_SINGLE_SEND_EN_V 0x1 +#define UHCI_SINGLE_SEND_EN_S 3 +/* UHCI_SINGLE_SEND_NUM : R/W ;bitpos:[2:0] ;default: 3'h0 ; */ +/*description: */ +#define UHCI_SINGLE_SEND_NUM 0x00000007 +#define UHCI_SINGLE_SEND_NUM_M ((UHCI_SINGLE_SEND_NUM_V)<<(UHCI_SINGLE_SEND_NUM_S)) +#define UHCI_SINGLE_SEND_NUM_V 0x7 +#define UHCI_SINGLE_SEND_NUM_S 0 + +#define UHCI_Q0_WORD0_REG(i) (REG_UHCI_BASE(i) + 0x78) +/* UHCI_SEND_Q0_WORD0 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q0_WORD0 0xFFFFFFFF +#define UHCI_SEND_Q0_WORD0_M ((UHCI_SEND_Q0_WORD0_V)<<(UHCI_SEND_Q0_WORD0_S)) +#define UHCI_SEND_Q0_WORD0_V 0xFFFFFFFF +#define UHCI_SEND_Q0_WORD0_S 0 + +#define UHCI_Q0_WORD1_REG(i) (REG_UHCI_BASE(i) + 0x7C) +/* UHCI_SEND_Q0_WORD1 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q0_WORD1 0xFFFFFFFF +#define UHCI_SEND_Q0_WORD1_M ((UHCI_SEND_Q0_WORD1_V)<<(UHCI_SEND_Q0_WORD1_S)) +#define UHCI_SEND_Q0_WORD1_V 0xFFFFFFFF +#define UHCI_SEND_Q0_WORD1_S 0 + +#define UHCI_Q1_WORD0_REG(i) (REG_UHCI_BASE(i) + 0x80) +/* UHCI_SEND_Q1_WORD0 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q1_WORD0 0xFFFFFFFF +#define UHCI_SEND_Q1_WORD0_M ((UHCI_SEND_Q1_WORD0_V)<<(UHCI_SEND_Q1_WORD0_S)) +#define UHCI_SEND_Q1_WORD0_V 0xFFFFFFFF +#define UHCI_SEND_Q1_WORD0_S 0 + +#define UHCI_Q1_WORD1_REG(i) (REG_UHCI_BASE(i) + 0x84) +/* UHCI_SEND_Q1_WORD1 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q1_WORD1 0xFFFFFFFF +#define UHCI_SEND_Q1_WORD1_M ((UHCI_SEND_Q1_WORD1_V)<<(UHCI_SEND_Q1_WORD1_S)) +#define UHCI_SEND_Q1_WORD1_V 0xFFFFFFFF +#define UHCI_SEND_Q1_WORD1_S 0 + +#define UHCI_Q2_WORD0_REG(i) (REG_UHCI_BASE(i) + 0x88) +/* UHCI_SEND_Q2_WORD0 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q2_WORD0 0xFFFFFFFF +#define UHCI_SEND_Q2_WORD0_M ((UHCI_SEND_Q2_WORD0_V)<<(UHCI_SEND_Q2_WORD0_S)) +#define UHCI_SEND_Q2_WORD0_V 0xFFFFFFFF +#define UHCI_SEND_Q2_WORD0_S 0 + +#define UHCI_Q2_WORD1_REG(i) (REG_UHCI_BASE(i) + 0x8C) +/* UHCI_SEND_Q2_WORD1 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q2_WORD1 0xFFFFFFFF +#define UHCI_SEND_Q2_WORD1_M ((UHCI_SEND_Q2_WORD1_V)<<(UHCI_SEND_Q2_WORD1_S)) +#define UHCI_SEND_Q2_WORD1_V 0xFFFFFFFF +#define UHCI_SEND_Q2_WORD1_S 0 + +#define UHCI_Q3_WORD0_REG(i) (REG_UHCI_BASE(i) + 0x90) +/* UHCI_SEND_Q3_WORD0 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q3_WORD0 0xFFFFFFFF +#define UHCI_SEND_Q3_WORD0_M ((UHCI_SEND_Q3_WORD0_V)<<(UHCI_SEND_Q3_WORD0_S)) +#define UHCI_SEND_Q3_WORD0_V 0xFFFFFFFF +#define UHCI_SEND_Q3_WORD0_S 0 + +#define UHCI_Q3_WORD1_REG(i) (REG_UHCI_BASE(i) + 0x94) +/* UHCI_SEND_Q3_WORD1 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q3_WORD1 0xFFFFFFFF +#define UHCI_SEND_Q3_WORD1_M ((UHCI_SEND_Q3_WORD1_V)<<(UHCI_SEND_Q3_WORD1_S)) +#define UHCI_SEND_Q3_WORD1_V 0xFFFFFFFF +#define UHCI_SEND_Q3_WORD1_S 0 + +#define UHCI_Q4_WORD0_REG(i) (REG_UHCI_BASE(i) + 0x98) +/* UHCI_SEND_Q4_WORD0 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q4_WORD0 0xFFFFFFFF +#define UHCI_SEND_Q4_WORD0_M ((UHCI_SEND_Q4_WORD0_V)<<(UHCI_SEND_Q4_WORD0_S)) +#define UHCI_SEND_Q4_WORD0_V 0xFFFFFFFF +#define UHCI_SEND_Q4_WORD0_S 0 + +#define UHCI_Q4_WORD1_REG(i) (REG_UHCI_BASE(i) + 0x9C) +/* UHCI_SEND_Q4_WORD1 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q4_WORD1 0xFFFFFFFF +#define UHCI_SEND_Q4_WORD1_M ((UHCI_SEND_Q4_WORD1_V)<<(UHCI_SEND_Q4_WORD1_S)) +#define UHCI_SEND_Q4_WORD1_V 0xFFFFFFFF +#define UHCI_SEND_Q4_WORD1_S 0 + +#define UHCI_Q5_WORD0_REG(i) (REG_UHCI_BASE(i) + 0xA0) +/* UHCI_SEND_Q5_WORD0 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q5_WORD0 0xFFFFFFFF +#define UHCI_SEND_Q5_WORD0_M ((UHCI_SEND_Q5_WORD0_V)<<(UHCI_SEND_Q5_WORD0_S)) +#define UHCI_SEND_Q5_WORD0_V 0xFFFFFFFF +#define UHCI_SEND_Q5_WORD0_S 0 + +#define UHCI_Q5_WORD1_REG(i) (REG_UHCI_BASE(i) + 0xA4) +/* UHCI_SEND_Q5_WORD1 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q5_WORD1 0xFFFFFFFF +#define UHCI_SEND_Q5_WORD1_M ((UHCI_SEND_Q5_WORD1_V)<<(UHCI_SEND_Q5_WORD1_S)) +#define UHCI_SEND_Q5_WORD1_V 0xFFFFFFFF +#define UHCI_SEND_Q5_WORD1_S 0 + +#define UHCI_Q6_WORD0_REG(i) (REG_UHCI_BASE(i) + 0xA8) +/* UHCI_SEND_Q6_WORD0 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q6_WORD0 0xFFFFFFFF +#define UHCI_SEND_Q6_WORD0_M ((UHCI_SEND_Q6_WORD0_V)<<(UHCI_SEND_Q6_WORD0_S)) +#define UHCI_SEND_Q6_WORD0_V 0xFFFFFFFF +#define UHCI_SEND_Q6_WORD0_S 0 + +#define UHCI_Q6_WORD1_REG(i) (REG_UHCI_BASE(i) + 0xAC) +/* UHCI_SEND_Q6_WORD1 : R/W ;bitpos:[31:0] ;default: 32'h0 ; */ +/*description: */ +#define UHCI_SEND_Q6_WORD1 0xFFFFFFFF +#define UHCI_SEND_Q6_WORD1_M ((UHCI_SEND_Q6_WORD1_V)<<(UHCI_SEND_Q6_WORD1_S)) +#define UHCI_SEND_Q6_WORD1_V 0xFFFFFFFF +#define UHCI_SEND_Q6_WORD1_S 0 + +#define UHCI_ESC_CONF0_REG(i) (REG_UHCI_BASE(i) + 0xB0) +/* UHCI_SEPER_ESC_CHAR1 : R/W ;bitpos:[23:16] ;default: 8'hdc ; */ +/*description: */ +#define UHCI_SEPER_ESC_CHAR1 0x000000FF +#define UHCI_SEPER_ESC_CHAR1_M ((UHCI_SEPER_ESC_CHAR1_V)<<(UHCI_SEPER_ESC_CHAR1_S)) +#define UHCI_SEPER_ESC_CHAR1_V 0xFF +#define UHCI_SEPER_ESC_CHAR1_S 16 +/* UHCI_SEPER_ESC_CHAR0 : R/W ;bitpos:[15:8] ;default: 8'hdb ; */ +/*description: */ +#define UHCI_SEPER_ESC_CHAR0 0x000000FF +#define UHCI_SEPER_ESC_CHAR0_M ((UHCI_SEPER_ESC_CHAR0_V)<<(UHCI_SEPER_ESC_CHAR0_S)) +#define UHCI_SEPER_ESC_CHAR0_V 0xFF +#define UHCI_SEPER_ESC_CHAR0_S 8 +/* UHCI_SEPER_CHAR : R/W ;bitpos:[7:0] ;default: 8'hc0 ; */ +/*description: */ +#define UHCI_SEPER_CHAR 0x000000FF +#define UHCI_SEPER_CHAR_M ((UHCI_SEPER_CHAR_V)<<(UHCI_SEPER_CHAR_S)) +#define UHCI_SEPER_CHAR_V 0xFF +#define UHCI_SEPER_CHAR_S 0 + +#define UHCI_ESC_CONF1_REG(i) (REG_UHCI_BASE(i) + 0xB4) +/* UHCI_ESC_SEQ0_CHAR1 : R/W ;bitpos:[23:16] ;default: 8'hdd ; */ +/*description: */ +#define UHCI_ESC_SEQ0_CHAR1 0x000000FF +#define UHCI_ESC_SEQ0_CHAR1_M ((UHCI_ESC_SEQ0_CHAR1_V)<<(UHCI_ESC_SEQ0_CHAR1_S)) +#define UHCI_ESC_SEQ0_CHAR1_V 0xFF +#define UHCI_ESC_SEQ0_CHAR1_S 16 +/* UHCI_ESC_SEQ0_CHAR0 : R/W ;bitpos:[15:8] ;default: 8'hdb ; */ +/*description: */ +#define UHCI_ESC_SEQ0_CHAR0 0x000000FF +#define UHCI_ESC_SEQ0_CHAR0_M ((UHCI_ESC_SEQ0_CHAR0_V)<<(UHCI_ESC_SEQ0_CHAR0_S)) +#define UHCI_ESC_SEQ0_CHAR0_V 0xFF +#define UHCI_ESC_SEQ0_CHAR0_S 8 +/* UHCI_ESC_SEQ0 : R/W ;bitpos:[7:0] ;default: 8'hdb ; */ +/*description: */ +#define UHCI_ESC_SEQ0 0x000000FF +#define UHCI_ESC_SEQ0_M ((UHCI_ESC_SEQ0_V)<<(UHCI_ESC_SEQ0_S)) +#define UHCI_ESC_SEQ0_V 0xFF +#define UHCI_ESC_SEQ0_S 0 + +#define UHCI_ESC_CONF2_REG(i) (REG_UHCI_BASE(i) + 0xB8) +/* UHCI_ESC_SEQ1_CHAR1 : R/W ;bitpos:[23:16] ;default: 8'hde ; */ +/*description: */ +#define UHCI_ESC_SEQ1_CHAR1 0x000000FF +#define UHCI_ESC_SEQ1_CHAR1_M ((UHCI_ESC_SEQ1_CHAR1_V)<<(UHCI_ESC_SEQ1_CHAR1_S)) +#define UHCI_ESC_SEQ1_CHAR1_V 0xFF +#define UHCI_ESC_SEQ1_CHAR1_S 16 +/* UHCI_ESC_SEQ1_CHAR0 : R/W ;bitpos:[15:8] ;default: 8'hdb ; */ +/*description: */ +#define UHCI_ESC_SEQ1_CHAR0 0x000000FF +#define UHCI_ESC_SEQ1_CHAR0_M ((UHCI_ESC_SEQ1_CHAR0_V)<<(UHCI_ESC_SEQ1_CHAR0_S)) +#define UHCI_ESC_SEQ1_CHAR0_V 0xFF +#define UHCI_ESC_SEQ1_CHAR0_S 8 +/* UHCI_ESC_SEQ1 : R/W ;bitpos:[7:0] ;default: 8'h11 ; */ +/*description: */ +#define UHCI_ESC_SEQ1 0x000000FF +#define UHCI_ESC_SEQ1_M ((UHCI_ESC_SEQ1_V)<<(UHCI_ESC_SEQ1_S)) +#define UHCI_ESC_SEQ1_V 0xFF +#define UHCI_ESC_SEQ1_S 0 + +#define UHCI_ESC_CONF3_REG(i) (REG_UHCI_BASE(i) + 0xBC) +/* UHCI_ESC_SEQ2_CHAR1 : R/W ;bitpos:[23:16] ;default: 8'hdf ; */ +/*description: */ +#define UHCI_ESC_SEQ2_CHAR1 0x000000FF +#define UHCI_ESC_SEQ2_CHAR1_M ((UHCI_ESC_SEQ2_CHAR1_V)<<(UHCI_ESC_SEQ2_CHAR1_S)) +#define UHCI_ESC_SEQ2_CHAR1_V 0xFF +#define UHCI_ESC_SEQ2_CHAR1_S 16 +/* UHCI_ESC_SEQ2_CHAR0 : R/W ;bitpos:[15:8] ;default: 8'hdb ; */ +/*description: */ +#define UHCI_ESC_SEQ2_CHAR0 0x000000FF +#define UHCI_ESC_SEQ2_CHAR0_M ((UHCI_ESC_SEQ2_CHAR0_V)<<(UHCI_ESC_SEQ2_CHAR0_S)) +#define UHCI_ESC_SEQ2_CHAR0_V 0xFF +#define UHCI_ESC_SEQ2_CHAR0_S 8 +/* UHCI_ESC_SEQ2 : R/W ;bitpos:[7:0] ;default: 8'h13 ; */ +/*description: */ +#define UHCI_ESC_SEQ2 0x000000FF +#define UHCI_ESC_SEQ2_M ((UHCI_ESC_SEQ2_V)<<(UHCI_ESC_SEQ2_S)) +#define UHCI_ESC_SEQ2_V 0xFF +#define UHCI_ESC_SEQ2_S 0 + +#define UHCI_PKT_THRES_REG(i) (REG_UHCI_BASE(i) + 0xC0) +/* UHCI_PKT_THRS : R/W ;bitpos:[12:0] ;default: 13'h80 ; */ +/*description: */ +#define UHCI_PKT_THRS 0x00001FFF +#define UHCI_PKT_THRS_M ((UHCI_PKT_THRS_V)<<(UHCI_PKT_THRS_S)) +#define UHCI_PKT_THRS_V 0x1FFF +#define UHCI_PKT_THRS_S 0 + +#define UHCI_DATE_REG(i) (REG_UHCI_BASE(i) + 0xFC) +/* UHCI_DATE : R/W ;bitpos:[31:0] ;default: 32'h18073001 ; */ +/*description: */ +#define UHCI_DATE 0xFFFFFFFF +#define UHCI_DATE_M ((UHCI_DATE_V)<<(UHCI_DATE_S)) +#define UHCI_DATE_V 0xFFFFFFFF +#define UHCI_DATE_S 0 + +#ifdef __cplusplus +} +#endif + + + +#endif /*_SOC_UHCI_REG_H_ */ + + diff --git a/components/soc/esp32s2beta/include/soc/uhci_struct.h b/components/soc/esp32s2beta/include/soc/uhci_struct.h new file mode 100644 index 0000000000..aadc2a6303 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/uhci_struct.h @@ -0,0 +1,365 @@ +// Copyright 2017-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_UHCI_STRUCT_H_ +#define _SOC_UHCI_STRUCT_H_ +#ifdef __cplusplus +extern "C" { +#endif + +typedef volatile struct { + union { + struct { + uint32_t in_rst: 1; + uint32_t out_rst: 1; + uint32_t ahbm_fifo_rst: 1; + uint32_t ahbm_rst: 1; + uint32_t in_loop_test: 1; + uint32_t out_loop_test: 1; + uint32_t out_auto_wrback: 1; + uint32_t out_no_restart_clr: 1; + uint32_t out_eof_mode: 1; + uint32_t uart0_ce: 1; + uint32_t uart1_ce: 1; + uint32_t reserved11: 1; + uint32_t outdscr_burst_en: 1; + uint32_t indscr_burst_en: 1; + uint32_t out_data_burst_en: 1; + uint32_t mem_trans_en: 1; + uint32_t seper_en: 1; + uint32_t head_en: 1; + uint32_t crc_rec_en: 1; + uint32_t uart_idle_eof_en: 1; + uint32_t len_eof_en: 1; + uint32_t encode_crc_en: 1; + uint32_t clk_en: 1; + uint32_t uart_rx_brk_eof_en: 1; + uint32_t reserved24: 8; + }; + uint32_t val; + } conf0; + union { + struct { + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t outlink_eof_err: 1; + uint32_t out_total_eof: 1; + uint32_t send_s_q: 1; + uint32_t send_a_q: 1; + uint32_t dma_in_fifo_full_wm: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } int_raw; + union { + struct { + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t outlink_eof_err: 1; + uint32_t out_total_eof: 1; + uint32_t send_s_q: 1; + uint32_t send_a_q: 1; + uint32_t dma_in_fifo_full_wm: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } int_st; + union { + struct { + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t outlink_eof_err: 1; + uint32_t out_total_eof: 1; + uint32_t send_s_q: 1; + uint32_t send_a_q: 1; + uint32_t dma_in_fifo_full_wm: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } int_ena; + union { + struct { + uint32_t rx_start: 1; + uint32_t tx_start: 1; + uint32_t rx_hung: 1; + uint32_t tx_hung: 1; + uint32_t in_done: 1; + uint32_t in_suc_eof: 1; + uint32_t in_err_eof: 1; + uint32_t out_done: 1; + uint32_t out_eof: 1; + uint32_t in_dscr_err: 1; + uint32_t out_dscr_err: 1; + uint32_t in_dscr_empty: 1; + uint32_t outlink_eof_err: 1; + uint32_t out_total_eof: 1; + uint32_t send_s_q: 1; + uint32_t send_a_q: 1; + uint32_t dma_in_fifo_full_wm: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } int_clr; + union { + struct { + uint32_t full: 1; + uint32_t empty: 1; + uint32_t reserved2: 30; + }; + uint32_t val; + } dma_out_status; + union { + struct { + uint32_t fifo_wdata: 9; + uint32_t reserved9: 7; + uint32_t fifo_push: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } dma_out_push; + union { + struct { + uint32_t full: 1; + uint32_t empty: 1; + uint32_t reserved2: 2; + uint32_t rx_err_cause: 3; + uint32_t reserved7: 25; + }; + uint32_t val; + } dma_in_status; + union { + struct { + uint32_t fifo_rdata: 12; + uint32_t reserved12: 4; + uint32_t fifo_pop: 1; + uint32_t reserved17: 15; + }; + uint32_t val; + } dma_in_pop; + union { + struct { + uint32_t addr: 20; + uint32_t reserved20: 8; + uint32_t stop: 1; + uint32_t start: 1; + uint32_t restart: 1; + uint32_t park: 1; + }; + uint32_t val; + } dma_out_link; + union { + struct { + uint32_t addr: 20; + uint32_t auto_ret: 1; + uint32_t reserved21: 7; + uint32_t stop: 1; + uint32_t start: 1; + uint32_t restart: 1; + uint32_t park: 1; + }; + uint32_t val; + } dma_in_link; + union { + struct { + uint32_t check_sum_en: 1; + uint32_t check_seq_en: 1; + uint32_t crc_disable: 1; + uint32_t save_head: 1; + uint32_t tx_check_sum_re: 1; + uint32_t tx_ack_num_re: 1; + uint32_t check_owner: 1; + uint32_t wait_sw_start: 1; + uint32_t sw_start: 1; + uint32_t dma_in_fifo_full_thrs:12; + uint32_t reserved21: 11; + }; + uint32_t val; + } conf1; + union { + struct { + uint32_t dscr_addr: 18; + uint32_t in_dscr_state: 2; + uint32_t in_state: 3; + uint32_t fifo_cnt_debug: 5; + uint32_t decode_state: 3; + uint32_t reserved31: 1; + }; + uint32_t val; + } state0; + union { + struct { + uint32_t outlink_dscr_addr:18; + uint32_t out_dscr_state: 2; + uint32_t out_state: 3; + uint32_t fifo_cnt: 5; + uint32_t encode_state: 3; + uint32_t reserved31: 1; + }; + uint32_t val; + } state1; + uint32_t dma_out_eof_des_addr; /**/ + uint32_t dma_in_suc_eof_des_addr; /**/ + uint32_t dma_in_err_eof_des_addr; /**/ + uint32_t dma_out_eof_bfr_des_addr; /**/ + union { + struct { + uint32_t test_mode: 3; + uint32_t reserved3: 1; + uint32_t test_addr: 2; + uint32_t reserved6: 26; + }; + uint32_t val; + } ahb_test; + uint32_t dma_in_dscr; /**/ + uint32_t dma_in_dscr_bf0; /**/ + uint32_t dma_in_dscr_bf1; /**/ + uint32_t dma_out_dscr; /**/ + uint32_t dma_out_dscr_bf0; /**/ + uint32_t dma_out_dscr_bf1; /**/ + union { + struct { + uint32_t tx_c0_esc_en: 1; + uint32_t tx_db_esc_en: 1; + uint32_t tx_11_esc_en: 1; + uint32_t tx_13_esc_en: 1; + uint32_t rx_c0_esc_en: 1; + uint32_t rx_db_esc_en: 1; + uint32_t rx_11_esc_en: 1; + uint32_t rx_13_esc_en: 1; + uint32_t reserved8: 24; + }; + uint32_t val; + } escape_conf; + union { + struct { + uint32_t txfifo_timeout: 8; + uint32_t txfifo_timeout_shift: 3; + uint32_t txfifo_timeout_ena: 1; + uint32_t rxfifo_timeout: 8; + uint32_t rxfifo_timeout_shift: 3; + uint32_t rxfifo_timeout_ena: 1; + uint32_t reserved24: 8; + }; + uint32_t val; + } hung_conf; + uint32_t ack_num; /**/ + uint32_t rx_head; /**/ + union { + struct { + uint32_t single_send_num: 3; + uint32_t single_send_en: 1; + uint32_t always_send_num: 3; + uint32_t always_send_en: 1; + uint32_t reserved8: 24; + }; + uint32_t val; + } quick_sent; + struct { + uint32_t w_data[2]; /**/ + } q_data[7]; + union { + struct { + uint32_t seper_char: 8; + uint32_t seper_esc_char0: 8; + uint32_t seper_esc_char1: 8; + uint32_t reserved24: 8; + }; + uint32_t val; + } esc_conf0; + union { + struct { + uint32_t seq0: 8; + uint32_t seq0_char0: 8; + uint32_t seq0_char1: 8; + uint32_t reserved24: 8; + }; + uint32_t val; + } esc_conf1; + union { + struct { + uint32_t seq1: 8; + uint32_t seq1_char0: 8; + uint32_t seq1_char1: 8; + uint32_t reserved24: 8; + }; + uint32_t val; + } esc_conf2; + union { + struct { + uint32_t seq2: 8; + uint32_t seq2_char0: 8; + uint32_t seq2_char1: 8; + uint32_t reserved24: 8; + }; + uint32_t val; + } esc_conf3; + union { + struct { + uint32_t thrs: 13; + uint32_t reserved13:19; + }; + uint32_t val; + } pkt_thres; + uint32_t reserved_c4; + uint32_t reserved_c8; + uint32_t reserved_cc; + uint32_t reserved_d0; + uint32_t reserved_d4; + uint32_t reserved_d8; + uint32_t reserved_dc; + uint32_t reserved_e0; + uint32_t reserved_e4; + uint32_t reserved_e8; + uint32_t reserved_ec; + uint32_t reserved_f0; + uint32_t reserved_f4; + uint32_t reserved_f8; + uint32_t date; /**/ +} uhci_dev_t; +extern uhci_dev_t UHCI0; +extern uhci_dev_t UHCI1; +#ifdef __cplusplus +} +#endif + +#endif /* _SOC_UHCI_STRUCT_H_ */ diff --git a/components/soc/esp32s2beta/include/soc/wdev_reg.h b/components/soc/esp32s2beta/include/soc/wdev_reg.h new file mode 100644 index 0000000000..093989f067 --- /dev/null +++ b/components/soc/esp32s2beta/include/soc/wdev_reg.h @@ -0,0 +1,21 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include "soc.h" + +/* Hardware random number generator register */ +#define WDEV_RND_REG 0x6003510C + diff --git a/components/soc/esp32s2beta/interrupts.c b/components/soc/esp32s2beta/interrupts.c new file mode 100644 index 0000000000..10856a3d4a --- /dev/null +++ b/components/soc/esp32s2beta/interrupts.c @@ -0,0 +1,105 @@ +// Copyright 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. + +#include "soc/interrupts.h" + +const char * const esp_isr_names[ETS_MAX_INTR_SOURCE] = { + [0] = "WIFI_MAC", + [1] = "WIFI_NMI", + [2] = "WIFI_PWR", + [3] = "WIFI_BB", + [4] = "BT_MAC", + [5] = "BT_BB", + [6] = "BT_BB_NMI", + [7] = "RWBT", + [8] = "RWBLE", + [9] = "RWBT_NMI", + [10] = "RWBLE_NMI", + [11] = "SLC0", + [12] = "SLC1", + [13] = "UHCI0", + [14] = "UHCI1", + [15] = "TG0_T0_LEVEL", + [16] = "TG0_T1_LEVEL", + [17] = "TG0_WDT_LEVEL", + [18] = "TG0_LACT_LEVEL", + [19] = "TG1_T0_LEVEL", + [20] = "TG1_T1_LEVEL", + [21] = "TG1_WDT_LEVEL", + [22] = "TG1_LACT_LEVEL", + [23] = "GPIO", + [24] = "GPIO_NMI", + [25] = "GPIO_INTR_2", + [26] = "GPIO_NMI_2", + [27] = "DEDICATED_GPIO", + [28] = "FROM_CPU_INTR0", + [29] = "FROM_CPU_INTR1", + [30] = "FROM_CPU_INTR2", + [31] = "FROM_CPU_INTR3", + [32] = "SPI1", + [33] = "SPI2", + [34] = "SPI3", + [35] = "I2S0", + [36] = "I2S1", + [37] = "UART0", + [38] = "UART1", + [39] = "UART2", + [40] = "SDIO_HOST", + [41] = "PWM0", + [42] = "PWM1", + [43] = "PWM2", + [44] = "PWM3", + [45] = "LEDC", + [46] = "EFUSE", + [47] = "CAN", + [48] = "USB", + [49] = "RTC_CORE", + [50] = "RMT", + [51] = "PCNT", + [52] = "I2C_EXT0", + [53] = "I2C_EXT1", + [54] = "RSA", + [55] = "SPI1_DMA", + [56] = "SPI2_DMA", + [57] = "SPI3_DMA", + [58] = "WDT", + [59] = "TIMER1", + [60] = "TIMER2", + [61] = "TG0_T0_EDGE", + [62] = "TG0_T1_EDGE", + [63] = "TG0_WDT_EDGE", + [64] = "TG0_LACT_EDGE", + [65] = "TG1_T0_EDGE", + [66] = "TG1_T1_EDGE", + [67] = "TG1_WDT_EDGE", + [68] = "TG1_LACT_EDGE", + [69] = "CACHE_IA", + [70] = "SYSTIMER_TARGET0", + [71] = "SYSTIMER_TARGET1", + [72] = "SYSTIMER_TARGET2", + [73] = "ASSIST_DEBUG", + [74] = "PMS_PRO_IRAM0_ILG", + [75] = "PMS_PRO_DRAM0_ILG", + [76] = "PMS_PRO_DPORT_ILG", + [77] = "PMS_PRO_AHB_ILG", + [78] = "PMS_PRO_CACHE_ILG", + [79] = "PMS_DMA_APB_I_ILG", + [80] = "PMS_DMA_RX_I_ILG", + [81] = "PMS_DMA_TX_I_ILG", + [82] = "SPI0_REJECT_CACHE", + [83] = "SPI1_REJECT_CPU", + [84] = "DMA_COPY", + [85] = "SPI4_DMA", + [86] = "SPI4", +}; diff --git a/components/soc/esp32s2beta/ledc_periph.c b/components/soc/esp32s2beta/ledc_periph.c new file mode 100644 index 0000000000..ce1ad7ce41 --- /dev/null +++ b/components/soc/esp32s2beta/ledc_periph.c @@ -0,0 +1,25 @@ +// 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. + +#include "soc/ledc_periph.h" +#include "soc/gpio_sig_map.h" + +/* + Bunch of constants for every LEDC peripheral: GPIO signals +*/ +const ledc_signal_conn_t ledc_periph_signal[1] = { + { + .sig_out0_idx = LEDC_LS_SIG_OUT0_IDX, + } +}; \ No newline at end of file diff --git a/components/soc/esp32s2beta/rtc_clk.c b/components/soc/esp32s2beta/rtc_clk.c new file mode 100644 index 0000000000..158ff890f9 --- /dev/null +++ b/components/soc/esp32s2beta/rtc_clk.c @@ -0,0 +1,883 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/rtc.h" +#include "esp32s2beta/rom/uart.h" +#include "esp32s2beta/rom/gpio.h" +#include "soc/rtc.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/rtc_io_reg.h" +#include "soc/sens_reg.h" +#include "soc/dport_reg.h" +#include "soc/efuse_reg.h" +#include "soc/syscon_reg.h" +#include "i2c_rtc_clk.h" +#include "soc_log.h" +#include "sdkconfig.h" +#include "xtensa/core-macros.h" + + +#define MHZ (1000000) + +/* Frequency of the 8M oscillator is 8.5MHz +/- 5%, at the default DCAP setting */ +#define RTC_FAST_CLK_FREQ_8M 8500000 +#define RTC_SLOW_CLK_FREQ_90K 90000 +#define RTC_SLOW_CLK_FREQ_8MD256 (RTC_FAST_CLK_FREQ_8M / 256) +#define RTC_SLOW_CLK_FREQ_32K 32768 + +static const char* TAG = "rtc_clk"; + +/* Various constants related to the analog internals of the chip. + * Defined here because they don't have any use outside of this file. + */ + +#define BBPLL_ENDIV5_VAL_320M 0x43 +#define BBPLL_BBADC_DSMP_VAL_320M 0x84 +#define BBPLL_ENDIV5_VAL_480M 0xc3 +#define BBPLL_BBADC_DSMP_VAL_480M 0x74 + +#define APLL_SDM_STOP_VAL_1 0x09 +#define APLL_SDM_STOP_VAL_2_REV0 0x69 +#define APLL_SDM_STOP_VAL_2_REV1 0x49 + +#define APLL_CAL_DELAY_1 0x0f +#define APLL_CAL_DELAY_2 0x3f +#define APLL_CAL_DELAY_3 0x1f + +#define XTAL_32K_DAC_VAL 1 +#define XTAL_32K_DRES_VAL 3 +#define XTAL_32K_DGM_VAL 0 + +#define XTAL_32K_BOOTSTRAP_DAC_VAL 3 +#define XTAL_32K_BOOTSTRAP_DRES_VAL 3 +#define XTAL_32K_BOOTSTRAP_DBIAS_VAL 0 +#define XTAL_32K_BOOTSTRAP_TIME_US 7 + +/* Delays for various clock sources to be enabled/switched. + * All values are in microseconds. + * TODO: some of these are excessive, and should be reduced. + */ +#define DELAY_PLL_DBIAS_RAISE 3 +#define DELAY_PLL_ENABLE_WITH_150K 80 +#define DELAY_PLL_ENABLE_WITH_32K 160 +#define DELAY_FAST_CLK_SWITCH 3 +#define DELAY_SLOW_CLK_SWITCH 300 +#define DELAY_8M_ENABLE 50 + +/* Number of 8M/256 clock cycles to use for XTAL frequency estimation. + * 10 cycles will take approximately 300 microseconds. + */ +#define XTAL_FREQ_EST_CYCLES 10 + +/* Core voltage needs to be increased in two cases: + * 1. running at 240 MHz + * 2. running with 80MHz Flash frequency + */ +#ifdef CONFIG_ESPTOOLPY_FLASHFREQ_80M +#define DIG_DBIAS_80M_160M RTC_CNTL_DBIAS_1V25 +#else +#define DIG_DBIAS_80M_160M RTC_CNTL_DBIAS_1V10 +#endif +#define DIG_DBIAS_240M RTC_CNTL_DBIAS_1V25 +#define DIG_DBIAS_XTAL RTC_CNTL_DBIAS_1V10 +#define DIG_DBIAS_2M RTC_CNTL_DBIAS_1V00 + +/* PLL currently enabled, if any */ +typedef enum { + RTC_PLL_NONE, + RTC_PLL_320M, + RTC_PLL_480M +} rtc_pll_t; +static rtc_pll_t s_cur_pll = RTC_PLL_NONE; + +/* Current CPU frequency; saved in a variable for faster freq. switching */ +static rtc_cpu_freq_t s_cur_freq = RTC_CPU_FREQ_XTAL; + +void rtc_clk_32k_enable_internal(int dac, int dres, int dgm) +{ + SET_PERI_REG_MASK(RTC_IO_XTAL_32P_PAD_REG, RTC_IO_X32P_MUX_SEL); + SET_PERI_REG_MASK(RTC_IO_XTAL_32N_PAD_REG, RTC_IO_X32N_MUX_SEL); + CLEAR_PERI_REG_MASK(RTC_IO_XTAL_32P_PAD_REG, RTC_IO_X32P_RUE | RTC_IO_X32P_FUN_IE | RTC_IO_X32P_RDE); + CLEAR_PERI_REG_MASK(RTC_IO_XTAL_32N_PAD_REG, RTC_IO_X32N_RUE | RTC_IO_X32N_FUN_IE | RTC_IO_X32N_RDE); + REG_SET_FIELD(RTC_CNTL_EXT_XTL_CONF_REG, RTC_CNTL_DAC_XTAL_32K, dac); + REG_SET_FIELD(RTC_CNTL_EXT_XTL_CONF_REG, RTC_CNTL_DRES_XTAL_32K, dres); + REG_SET_FIELD(RTC_CNTL_EXT_XTL_CONF_REG, RTC_CNTL_DGM_XTAL_32K, dgm); + + /* Differential buffer option. May need to change */ + // CLEAR_PERI_REG_MASK(RTC_CNTL_EXT_XTL_CONF_REG, RTC_CNTL_DBUF_XTAL_32K); + + /* Clear xpd force to use xtal32k watch dog to control xtal pxd. default on */ + CLEAR_PERI_REG_MASK(RTC_CNTL_EXT_XTL_CONF_REG, RTC_CNTL_XTAL32K_XPD_FORCE); +} + +void rtc_clk_32k_enable(bool enable) +{ + if (enable) { + rtc_clk_32k_enable_internal(XTAL_32K_DAC_VAL, XTAL_32K_DRES_VAL, XTAL_32K_DGM_VAL); + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_EXT_XTL_CONF_REG, RTC_CNTL_XPD_XTAL_32K); + SET_PERI_REG_MASK(RTC_CNTL_EXT_XTL_CONF_REG, RTC_CNTL_XTAL32K_XPD_FORCE); + } +} + +/* Helping external 32kHz crystal to start up. + * External crystal connected to outputs GPIO32 GPIO33. + * Forms N pulses with a frequency of about 32KHz on the outputs of the crystal. + */ +/* I doudt whether the old function can work correctly on ESP32...Need to review when having time */ +void rtc_clk_32k_bootstrap(uint32_t cycle) +{ + /* Config a clock to stimulate xtal, this clock is divided by a clock mux + * The default selection of the clock mux is to use 8M, but it may not have enough accuracy compared with 40M xtal + * This clock will be a pulse clk with a double frequency of 32.768k. + * and then it will become a 32.768k clock with 50% duty cycle in RTC. + * (40M / 32.768k) * 2 = 2441 + 13/32 + */ + REG_SET_FIELD(DPORT_BT_LPCK_DIV_INT_REG, DPORT_BT_LPCK_DIV_NUM, 2441); + REG_SET_FIELD(DPORT_BT_LPCK_DIV_FRAC_REG, DPORT_BT_LPCK_DIV_A, 32); + REG_SET_FIELD(DPORT_BT_LPCK_DIV_FRAC_REG, DPORT_BT_LPCK_DIV_B, 13); + + /* Enable clock mux with 40M */ + SET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_CLK8M_EN); + CLEAR_PERI_REG_MASK(DPORT_BT_LPCK_DIV_FRAC_REG, DPORT_LPCLK_SEL_8M); + SET_PERI_REG_MASK(DPORT_BT_LPCK_DIV_FRAC_REG, DPORT_LPCLK_SEL_XTAL); + + /* connect clock to RTC */ + SET_PERI_REG_MASK(DPORT_BT_LPCK_DIV_FRAC_REG, DPORT_LPCLK_RTC_EN); + /* connect clock to analog */ + SET_PERI_REG_MASK(RTC_CNTL_EXT_XTL_CONF_REG, RTC_CNTL_ENCKINIT_XTAL_32K); + + /* Enable 32k xtal */ + rtc_clk_32k_enable_internal(XTAL_32K_BOOTSTRAP_DAC_VAL, XTAL_32K_BOOTSTRAP_DRES_VAL, XTAL_32K_BOOTSTRAP_DBIAS_VAL); + + /* wait 32k xtal to be stable. Need to find a better way */ + ets_delay_us(cycle); + + /* Close clock source */ + CLEAR_PERI_REG_MASK(DPORT_BT_LPCK_DIV_FRAC_REG, DPORT_LPCLK_SEL_XTAL); + CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_CLK8M_EN); + CLEAR_PERI_REG_MASK(RTC_CNTL_EXT_XTL_CONF_REG, RTC_CNTL_ENCKINIT_XTAL_32K); + CLEAR_PERI_REG_MASK(DPORT_BT_LPCK_DIV_FRAC_REG, DPORT_LPCLK_RTC_EN); +} + +bool rtc_clk_32k_enabled(void) +{ + uint32_t xtal_conf = READ_PERI_REG(RTC_CNTL_EXT_XTL_CONF_REG); + /* If xtal xpd is controlled by software */ + bool xtal_xpd_sw = (xtal_conf & RTC_CNTL_XTAL32K_XPD_FORCE) >> RTC_CNTL_XTAL32K_XPD_FORCE_S; + /* If xtal xpd software control is on */ + bool xtal_xpd_st = (xtal_conf & RTC_CNTL_XPD_XTAL_32K) >> RTC_CNTL_XPD_XTAL_32K_S; + if (xtal_xpd_sw & !xtal_xpd_st) { + return false; + } else { + return true; + } +} + +void rtc_clk_8m_enable(bool clk_8m_en, bool d256_en) +{ + if (clk_8m_en) { + CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M); + /* no need to wait once enabled by software */ + REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, 1); + ets_delay_us(DELAY_8M_ENABLE); + } else { + SET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M); + REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CNTL_CK8M_WAIT_DEFAULT); + } + /* d256 should be independent configured with 8M + * Maybe we can split this function into 8m and dmd256 + */ + if (d256_en) { + CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M_DIV); + } else { + SET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M_DIV); + } +} + +bool rtc_clk_8m_enabled(void) +{ + return GET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M) == 0; +} + +bool rtc_clk_8md256_enabled(void) +{ + return GET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M_DIV) == 0; +} + +void rtc_clk_apll_enable(bool enable, uint32_t sdm0, uint32_t sdm1, uint32_t sdm2, uint32_t o_div) +{ + REG_SET_FIELD(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PLLA_FORCE_PD, enable ? 0 : 1); + REG_SET_FIELD(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PLLA_FORCE_PU, enable ? 1 : 0); + + /* BIAS I2C not exist any more, but not sure how to get the same effect yet... + * if (!enable && + * REG_GET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_SOC_CLK_SEL) != SYSCON_SOC_CLK_SEL_PLL) { + * REG_SET_BIT(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_I2C_FORCE_PD); + * } else { + * REG_CLR_BIT(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_I2C_FORCE_PD); + * } + */ + + if (enable) { + /* no need to differentiate ECO chip any more + uint8_t sdm_stop_val_2 = APLL_SDM_STOP_VAL_2_REV1; + uint32_t is_rev0 = (GET_PERI_REG_BITS2(EFUSE_BLK0_RDATA3_REG, 1, 15) == 0); + if (is_rev0) { + sdm0 = 0; + sdm1 = 0; + sdm_stop_val_2 = APLL_SDM_STOP_VAL_2_REV0; + } + */ + I2C_WRITEREG_MASK_RTC(I2C_APLL, I2C_APLL_DSDM2, sdm2); + I2C_WRITEREG_MASK_RTC(I2C_APLL, I2C_APLL_DSDM0, sdm0); + I2C_WRITEREG_MASK_RTC(I2C_APLL, I2C_APLL_DSDM1, sdm1); + I2C_WRITEREG_RTC(I2C_APLL, I2C_APLL_SDM_STOP, APLL_SDM_STOP_VAL_1); + I2C_WRITEREG_RTC(I2C_APLL, I2C_APLL_SDM_STOP, APLL_SDM_STOP_VAL_2_REV1); + I2C_WRITEREG_MASK_RTC(I2C_APLL, I2C_APLL_OR_OUTPUT_DIV, o_div); + + /* calibration */ + I2C_WRITEREG_RTC(I2C_APLL, I2C_APLL_IR_CAL_DELAY, APLL_CAL_DELAY_1); + I2C_WRITEREG_RTC(I2C_APLL, I2C_APLL_IR_CAL_DELAY, APLL_CAL_DELAY_2); + I2C_WRITEREG_RTC(I2C_APLL, I2C_APLL_IR_CAL_DELAY, APLL_CAL_DELAY_3); + + /* wait for calibration end */ + while (!(I2C_READREG_MASK_RTC(I2C_APLL, I2C_APLL_OR_CAL_END))) { + /* use ets_delay_us so the RTC bus doesn't get flooded */ + ets_delay_us(1); + } + } +} + +void rtc_clk_set_xtal_wait(void) +{ + /* + the `xtal_wait` time need 1ms, so we need calibrate slow clk period, + and `RTC_CNTL_XTL_BUF_WAIT` depend on it. + */ + rtc_slow_freq_t slow_clk_freq = rtc_clk_slow_freq_get(); + rtc_slow_freq_t rtc_slow_freq_x32k = RTC_SLOW_FREQ_32K_XTAL; + rtc_slow_freq_t rtc_slow_freq_8MD256 = RTC_SLOW_FREQ_8MD256; + rtc_cal_sel_t cal_clk = RTC_CAL_RTC_MUX; + if (slow_clk_freq == (rtc_slow_freq_x32k)) { + cal_clk = RTC_CAL_32K_XTAL; + } else if (slow_clk_freq == rtc_slow_freq_8MD256) { + cal_clk = RTC_CAL_8MD256; + } + uint32_t slow_clk_period = rtc_clk_cal(cal_clk, 2000); + uint32_t xtal_wait_1ms = 100; + if (slow_clk_period) { + xtal_wait_1ms = (1000 << RTC_CLK_CAL_FRACT) / slow_clk_period; + } + REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_XTL_BUF_WAIT, xtal_wait_1ms); +} + +void rtc_clk_slow_freq_set(rtc_slow_freq_t slow_freq) +{ + REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ANA_CLK_RTC_SEL, slow_freq); + + /* Why we need to connect this clock to digital? + * Or maybe this clock should be connected to digital when xtal 32k clock is enabled instead? + */ + REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_XTAL32K_EN, + (slow_freq == RTC_SLOW_FREQ_32K_XTAL) ? 1 : 0); + + /* The clk_8m_d256 will be closed when rtc_state in SLEEP, + so if the slow_clk is 8md256, clk_8m must be force power on + */ + REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG,RTC_CNTL_CK8M_FORCE_PU, (slow_freq == RTC_SLOW_FREQ_8MD256) ? 1 : 0); + rtc_clk_set_xtal_wait(); + ets_delay_us(DELAY_SLOW_CLK_SWITCH); +} + +rtc_slow_freq_t rtc_clk_slow_freq_get(void) +{ + return REG_GET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ANA_CLK_RTC_SEL); +} + +uint32_t rtc_clk_slow_freq_get_hz(void) +{ + switch(rtc_clk_slow_freq_get()) { + case RTC_SLOW_FREQ_RTC: return RTC_SLOW_CLK_FREQ_90K; + case RTC_SLOW_FREQ_32K_XTAL: return RTC_SLOW_CLK_FREQ_32K; + case RTC_SLOW_FREQ_8MD256: return RTC_SLOW_CLK_FREQ_8MD256; + } + return 0; +} + +void rtc_clk_fast_freq_set(rtc_fast_freq_t fast_freq) +{ + REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_FAST_CLK_RTC_SEL, fast_freq); + ets_delay_us(DELAY_FAST_CLK_SWITCH); +} + +rtc_fast_freq_t rtc_clk_fast_freq_get(void) +{ + return REG_GET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_FAST_CLK_RTC_SEL); +} + +/* In 7.2.2, cpu can run at 80M/160M/240M if PLL is 480M + * pll can run 80M/160M is PLL is 320M + */ +#define DR_REG_I2C_MST_BASE 0x3f40E000 +#define I2C_MST_ANA_STATE_REG (DR_REG_I2C_MST_BASE + 0x040) +#define I2C_MST_BBPLL_CAL_END (BIT(24)) +#define I2C_MST_BBPLL_CAL_END_M (BIT(24)) +#define I2C_MST_BBPLL_CAL_END_V 0x1 +#define I2C_MST_BBPLL_CAL_END_S 24 + +void rtc_clk_bbpll_set(rtc_xtal_freq_t xtal_freq, rtc_pll_t pll_freq) +{ + uint8_t div_ref; + uint8_t div7_0; + uint8_t dr1; + uint8_t dr3; + uint8_t dchgp; + uint8_t dcur; + + if (pll_freq == RTC_PLL_480M) { + /* Raise the voltage, if needed */ + /* move to 240M logic */ + //REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_80M_160M); + /* Set this register to let digital know pll is 480M */ + SET_PERI_REG_MASK(DPORT_CPU_PER_CONF_REG, DPORT_PLL_FREQ_SEL); + /* Configure 480M PLL */ + switch (xtal_freq) { + case RTC_XTAL_FREQ_40M: + div_ref = 0; + div7_0 = 8; + dr1 = 0; + dr3 = 0; + dchgp = 5; + dcur = 4; + break; + case RTC_XTAL_FREQ_26M: + div_ref = 12; + div7_0 = 156; + dr1 = 3; + dr3 = 3; + dchgp = 4; + dcur = 1; + break; + case RTC_XTAL_FREQ_24M: + div_ref = 11; + div7_0 = 156; + dr1 = 3; + dr3 = 3; + dchgp = 4; + dcur = 1; + break; + default: + div_ref = 0; + div7_0 = 8; + dr1 = 0; + dr3 = 0; + dchgp = 5; + dcur = 4; + break; + } + I2C_WRITEREG_RTC(I2C_BBPLL, I2C_BBPLL_MODE_HF, 0x6B); + } else { + /* Raise the voltage */ + //REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_240M); + //ets_delay_us(DELAY_PLL_DBIAS_RAISE); + CLEAR_PERI_REG_MASK(DPORT_CPU_PER_CONF_REG, DPORT_PLL_FREQ_SEL); + /* Configure 480M PLL */ + switch (xtal_freq) { + case RTC_XTAL_FREQ_40M: + div_ref = 0; + div7_0 = 4; + dr1 = 0; + dr3 = 0; + dchgp = 5; + dcur = 5; + break; + case RTC_XTAL_FREQ_26M: + div_ref = 12; + div7_0 = 236; + dr1 = 3; + dr3 = 3; + dchgp = 0; + dcur = 2; + break; + case RTC_XTAL_FREQ_24M: + div_ref = 11; + div7_0 = 236; + dr1 = 3; + dr3 = 3; + dchgp = 0; + dcur = 2; + break; + default: + div_ref = 0; + div7_0 = 4; + dr1 = 0; + dr3 = 0; + dchgp = 5; + dcur = 5; + break; + } + I2C_WRITEREG_RTC(I2C_BBPLL, I2C_BBPLL_MODE_HF, 0x69); + } + uint8_t i2c_bbpll_lref = (dchgp << I2C_BBPLL_OC_DCHGP_LSB) | (div_ref); + uint8_t i2c_bbpll_div_7_0 = div7_0; + uint8_t i2c_bbpll_dcur = (2 << I2C_BBPLL_OC_DLREF_SEL_LSB ) | (1 << I2C_BBPLL_OC_DHREF_SEL_LSB) | dcur; + I2C_WRITEREG_RTC(I2C_BBPLL, I2C_BBPLL_OC_REF_DIV, i2c_bbpll_lref); + I2C_WRITEREG_RTC(I2C_BBPLL, I2C_BBPLL_OC_DIV_7_0, i2c_bbpll_div_7_0); + I2C_WRITEREG_MASK_RTC(I2C_BBPLL, I2C_BBPLL_OC_DR1, dr1); + I2C_WRITEREG_MASK_RTC(I2C_BBPLL, I2C_BBPLL_OC_DR3, dr3); + I2C_WRITEREG_RTC(I2C_BBPLL, I2C_BBPLL_OC_DCUR, i2c_bbpll_dcur); + + // Enable calibration by software + I2C_WRITEREG_MASK_RTC(I2C_BBPLL, I2C_BBPLL_IR_CAL_ENX_CAP, 1); + for (int ext_cap = 0; ext_cap < 16; ext_cap++) { + uint8_t cal_result; + I2C_WRITEREG_MASK_RTC(I2C_BBPLL, I2C_BBPLL_IR_CAL_EXT_CAP, ext_cap); + cal_result = I2C_READREG_MASK_RTC(I2C_BBPLL, I2C_BBPLL_OR_CAL_CAP); + if (cal_result == 0) { + break; + } + if(ext_cap == 15) { + SOC_LOGE(TAG, "BBPLL SOFTWARE CAL FAIL"); + } + } + + /* this delay is replaced by polling Pll calibration end flag + * uint32_t delay_pll_en = (rtc_clk_slow_freq_get() == RTC_SLOW_FREQ_RTC) ? + * DELAY_PLL_ENABLE_WITH_150K : DELAY_PLL_ENABLE_WITH_32K; + * ets_delay_us(delay_pll_en); + */ + /* this calibration didn't work on 480M + need to test exact delay according to 320M + while (!GET_PERI_REG_MASK(I2C_MST_ANA_STATE_REG, I2C_MST_BBPLL_CAL_END)) { + ets_delay_us(1); + } + */ +} + +/** + * Switch to XTAL frequency. Does not disable the PLL. + */ +static void rtc_clk_cpu_freq_to_xtal(void) +{ + rtc_xtal_freq_t xtal_freq = rtc_clk_xtal_freq_get(); + ets_update_cpu_frequency(xtal_freq); + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_XTAL); + REG_SET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_PRE_DIV_CNT, 0); + REG_SET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_SOC_CLK_SEL, SYSCON_SOC_CLK_SEL_XTL); + /* Why we need to do this ? */ + //DPORT_REG_WRITE(DPORT_CPU_PER_CONF_REG, 0); // clear DPORT_CPUPERIOD_SEL + + rtc_clk_apb_freq_update(xtal_freq * MHZ); + s_cur_freq = RTC_CPU_FREQ_XTAL; + s_cur_pll = RTC_PLL_NONE; +} + +/** + * Switch to one of PLL-based frequencies. Current frequency can be XTAL or PLL. + * PLL must already be enabled. + * If switching between frequencies derived from different PLLs (320M and 480M), + * fall back to rtc_clk_cpu_freq_set. + * @param cpu_freq new CPU frequency + */ +static void rtc_clk_cpu_freq_to_pll(rtc_cpu_freq_t cpu_freq) +{ + int freq = 0; + if ((s_cur_pll == RTC_PLL_NONE) || ((s_cur_pll == RTC_PLL_320M) && (cpu_freq == RTC_CPU_FREQ_240M))) { + /* + * if switch from non-pll or switch from PLL 320M to 480M + * need to switch PLLs, fall back to full implementation + */ + rtc_clk_cpu_freq_set(cpu_freq); + return; + } + + if ((cpu_freq == RTC_CPU_FREQ_80M) || (cpu_freq == RTC_CPU_320M_80M)) { + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_80M_160M); + DPORT_REG_WRITE(DPORT_CPU_PER_CONF_REG, 0); + freq = 80; + } else if ((cpu_freq == RTC_CPU_FREQ_160M) || (cpu_freq == RTC_CPU_320M_160M)) { + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_80M_160M); + DPORT_REG_WRITE(DPORT_CPU_PER_CONF_REG, 1); + freq = 160; + } else if (cpu_freq == RTC_CPU_FREQ_240M) { + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_240M); + DPORT_REG_WRITE(DPORT_CPU_PER_CONF_REG, 2); + freq = 240; + } + // REG_SET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_SOC_CLK_SEL, SYSCON_SOC_CLK_SEL_PLL); + rtc_clk_apb_freq_update(80 * MHZ); + ets_update_cpu_frequency(freq); + s_cur_freq = cpu_freq; +} + +void rtc_clk_cpu_freq_set_fast(rtc_cpu_freq_t cpu_freq) +{ + if (cpu_freq == s_cur_freq) { + return; + } else if (cpu_freq == RTC_CPU_FREQ_2M || s_cur_freq == RTC_CPU_FREQ_2M) { + /* fall back to full implementation if switch to/from 2M is needed */ + rtc_clk_cpu_freq_set(cpu_freq); + } else if (cpu_freq == RTC_CPU_FREQ_XTAL) { + rtc_clk_cpu_freq_to_xtal(); + } else if (cpu_freq > RTC_CPU_FREQ_XTAL) { + rtc_clk_cpu_freq_to_pll(cpu_freq); + /* Not neccessary any more */ + //rtc_clk_wait_for_slow_cycle(); + } +} + +void rtc_clk_cpu_freq_set(rtc_cpu_freq_t cpu_freq) +{ + rtc_xtal_freq_t xtal_freq = rtc_clk_xtal_freq_get(); + /* Switch CPU to XTAL frequency first */ + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_XTAL); + REG_SET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_SOC_CLK_SEL, SYSCON_SOC_CLK_SEL_XTL); + REG_SET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_PRE_DIV_CNT, 0); + ets_update_cpu_frequency(xtal_freq); + /* Frequency switch is synchronized to SLOW_CLK cycle. Wait until the switch + * is complete before disabling the PLL. + */ + /* register SOC_CLK_SEL is moved to APB domain, so this delay is not neccessary any more */ + //rtc_clk_wait_for_slow_cycle(); + + DPORT_REG_SET_FIELD(DPORT_CPU_PER_CONF_REG, DPORT_CPUPERIOD_SEL, 0); + + /* BBPLL force power down won't affect force power up setting */ + SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, + RTC_CNTL_BB_I2C_FORCE_PD | RTC_CNTL_BBPLL_FORCE_PD | + RTC_CNTL_BBPLL_I2C_FORCE_PD); + s_cur_pll = RTC_PLL_NONE; + rtc_clk_apb_freq_update(xtal_freq * MHZ); + + /* is APLL under force power down? */ + /* may need equivalent function + uint32_t apll_fpd = REG_GET_FIELD(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PLLA_FORCE_PD); + + * if (apll_fpd) { + * SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_I2C_FORCE_PD); + * } + */ + + /* now switch to the desired frequency */ + if (cpu_freq == RTC_CPU_FREQ_XTAL) { + /* already at XTAL, nothing to do */ + } else if (cpu_freq == RTC_CPU_FREQ_2M) { + /* set up divider to produce 2MHz from XTAL */ + REG_SET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_PRE_DIV_CNT, (xtal_freq / 2) - 1); + ets_update_cpu_frequency(2); + rtc_clk_apb_freq_update(2 * MHZ); + /* lower the voltage */ + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_2M); + } else { + /* use PLL as clock source */ + CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, + RTC_CNTL_BB_I2C_FORCE_PD | + RTC_CNTL_BBPLL_FORCE_PD | RTC_CNTL_BBPLL_I2C_FORCE_PD); + if (cpu_freq > RTC_CPU_FREQ_2M) { + rtc_clk_bbpll_set(xtal_freq, RTC_PLL_320M); + s_cur_pll = RTC_PLL_320M; + } else { + rtc_clk_bbpll_set(xtal_freq, RTC_PLL_480M); + s_cur_pll = RTC_PLL_480M; + } + + if ((cpu_freq == RTC_CPU_FREQ_80M) || (cpu_freq == RTC_CPU_320M_80M)) { + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_80M_160M); + DPORT_REG_SET_FIELD(DPORT_CPU_PER_CONF_REG, DPORT_CPUPERIOD_SEL, 0); + ets_update_cpu_frequency(80); + } else if ((cpu_freq == RTC_CPU_FREQ_160M) || (cpu_freq == RTC_CPU_320M_160M)) { + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_80M_160M); + DPORT_REG_SET_FIELD(DPORT_CPU_PER_CONF_REG, DPORT_CPUPERIOD_SEL, 1); + ets_update_cpu_frequency(160); + } else if (cpu_freq == RTC_CPU_FREQ_240M) { + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, DIG_DBIAS_240M); + DPORT_REG_SET_FIELD(DPORT_CPU_PER_CONF_REG, DPORT_CPUPERIOD_SEL, 2); + ets_update_cpu_frequency(240); + } + REG_SET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_SOC_CLK_SEL, SYSCON_SOC_CLK_SEL_PLL); + //rtc_clk_wait_for_slow_cycle(); + rtc_clk_apb_freq_update(80 * MHZ); + } + s_cur_freq = cpu_freq; +} + +rtc_cpu_freq_t rtc_clk_cpu_freq_get(void) +{ + uint32_t soc_clk_sel = REG_GET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_SOC_CLK_SEL); + switch (soc_clk_sel) { + case SYSCON_SOC_CLK_SEL_XTL: { + uint32_t pre_div = REG_GET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_PRE_DIV_CNT); + if (pre_div == 0) { + return RTC_CPU_FREQ_XTAL; + } else if (pre_div == rtc_clk_xtal_freq_get() / 2 - 1) { + return RTC_CPU_FREQ_2M; + } else { + assert(false && "unsupported frequency"); + } + break; + } + case SYSCON_SOC_CLK_SEL_PLL: { + uint32_t cpuperiod_sel = DPORT_REG_GET_FIELD(DPORT_CPU_PER_CONF_REG, DPORT_CPUPERIOD_SEL); + if (cpuperiod_sel == 0) { + return RTC_CPU_FREQ_80M; + } else if (cpuperiod_sel == 1) { + return RTC_CPU_FREQ_160M; + } else if (cpuperiod_sel == 2) { + return RTC_CPU_FREQ_240M; + } else { + assert(false && "unsupported frequency"); + } + break; + } + case SYSCON_SOC_CLK_SEL_APLL: + case SYSCON_SOC_CLK_SEL_8M: + default: + assert(false && "unsupported frequency"); + } + return SYSCON_SOC_CLK_SEL_XTL; +} + +uint32_t rtc_clk_cpu_freq_value(rtc_cpu_freq_t cpu_freq) +{ + switch (cpu_freq) { + case RTC_CPU_FREQ_XTAL: + return ((uint32_t) rtc_clk_xtal_freq_get()) * MHZ; + case RTC_CPU_FREQ_2M: + return 2 * MHZ; + case RTC_CPU_FREQ_80M: + return 80 * MHZ; + case RTC_CPU_FREQ_160M: + return 160 * MHZ; + case RTC_CPU_FREQ_240M: + return 240 * MHZ; + case RTC_CPU_320M_80M: + return 80 * MHZ; + case RTC_CPU_320M_160M: + return 160 * MHZ; + default: + assert(false && "invalid rtc_cpu_freq_t value"); + return 0; + } +} + +bool rtc_clk_cpu_freq_from_mhz(int mhz, rtc_cpu_freq_t* out_val) +{ + if (mhz == 240) { + *out_val = RTC_CPU_FREQ_240M; + } else if (mhz == 160) { + *out_val = RTC_CPU_FREQ_160M; + } else if (mhz == 80) { + *out_val = RTC_CPU_FREQ_80M; + } else if (mhz == (int) rtc_clk_xtal_freq_get()) { + *out_val = RTC_CPU_FREQ_XTAL; + } else if (mhz == 2) { + *out_val = RTC_CPU_FREQ_2M; + } else { + return false; + } + return true; +} + +/* Values of RTC_XTAL_FREQ_REG and RTC_APB_FREQ_REG are stored as two copies in + * lower and upper 16-bit halves. These are the routines to work with such a + * representation. + */ +static bool clk_val_is_valid(uint32_t val) { + return (val & 0xffff) == ((val >> 16) & 0xffff) && + val != 0 && + val != UINT32_MAX; +} + +static uint32_t reg_val_to_clk_val(uint32_t val) { + return val & UINT16_MAX; +} + +static uint32_t clk_val_to_reg_val(uint32_t val) { + return (val & UINT16_MAX) | ((val & UINT16_MAX) << 16); +} + +rtc_xtal_freq_t rtc_clk_xtal_freq_get(void) +{ + /* We may have already written XTAL value into RTC_XTAL_FREQ_REG */ + uint32_t xtal_freq_reg = READ_PERI_REG(RTC_XTAL_FREQ_REG); + if (!clk_val_is_valid(xtal_freq_reg)) { + SOC_LOGW(TAG, "invalid RTC_XTAL_FREQ_REG value: 0x%08x", xtal_freq_reg); + return RTC_XTAL_FREQ_AUTO; + } + return reg_val_to_clk_val(xtal_freq_reg); +} + +void rtc_clk_xtal_freq_update(rtc_xtal_freq_t xtal_freq) +{ + WRITE_PERI_REG(RTC_XTAL_FREQ_REG, clk_val_to_reg_val(xtal_freq)); +} + +static rtc_xtal_freq_t rtc_clk_xtal_freq_estimate(void) +{ + /* Enable 8M/256 clock if needed */ + const bool clk_8m_enabled = rtc_clk_8m_enabled(); + const bool clk_8md256_enabled = rtc_clk_8md256_enabled(); + if (!clk_8md256_enabled) { + rtc_clk_8m_enable(true, true); + } + + uint64_t cal_val = rtc_clk_cal_ratio(RTC_CAL_8MD256, XTAL_FREQ_EST_CYCLES); + /* cal_val contains period of 8M/256 clock in XTAL clock cycles + * (shifted by RTC_CLK_CAL_FRACT bits). + * Xtal frequency will be (cal_val * 8M / 256) / 2^19 + */ + uint32_t freq_mhz = (cal_val * RTC_FAST_CLK_FREQ_APPROX / MHZ / 256 ) >> RTC_CLK_CAL_FRACT; + /* Guess the XTAL type. For now, only 40 and 26MHz are supported. + */ + switch (freq_mhz) { + case 21 ... 31: + return RTC_XTAL_FREQ_26M; + case 32 ... 33: + SOC_LOGW(TAG, "Potentially bogus XTAL frequency: %d MHz, guessing 26 MHz", freq_mhz); + return RTC_XTAL_FREQ_26M; + case 34 ... 35: + SOC_LOGW(TAG, "Potentially bogus XTAL frequency: %d MHz, guessing 40 MHz", freq_mhz); + return RTC_XTAL_FREQ_40M; + case 36 ... 45: + return RTC_XTAL_FREQ_40M; + default: + SOC_LOGW(TAG, "Bogus XTAL frequency: %d MHz", freq_mhz); + return RTC_XTAL_FREQ_AUTO; + } + /* Restore 8M and 8md256 clocks to original state */ + rtc_clk_8m_enable(clk_8m_enabled, clk_8md256_enabled); +} + +void rtc_clk_apb_freq_update(uint32_t apb_freq) +{ + WRITE_PERI_REG(RTC_APB_FREQ_REG, clk_val_to_reg_val(apb_freq >> 12)); +} + +uint32_t rtc_clk_apb_freq_get(void) +{ + uint32_t freq_hz = reg_val_to_clk_val(READ_PERI_REG(RTC_APB_FREQ_REG)) << 12; + // round to the nearest MHz + freq_hz += MHZ / 2; + uint32_t remainder = freq_hz % MHZ; + return freq_hz - remainder; +} + +void rtc_clk_divider_set(uint32_t div) +{ + CLEAR_PERI_REG_MASK(RTC_CNTL_SLOW_CLK_CONF_REG, RTC_CNTL_ANA_CLK_DIV_VLD); + REG_SET_FIELD(RTC_CNTL_SLOW_CLK_CONF_REG, RTC_CNTL_ANA_CLK_DIV, div); + SET_PERI_REG_MASK(RTC_CNTL_SLOW_CLK_CONF_REG, RTC_CNTL_ANA_CLK_DIV_VLD); +} + +void rtc_clk_8m_divider_set(uint32_t div) +{ + CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_CK8M_DIV_SEL_VLD); + REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_CK8M_DIV_SEL, div); + SET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_CK8M_DIV_SEL_VLD); +} + +void rtc_clk_init(rtc_clk_config_t cfg) +{ + rtc_cpu_freq_t cpu_source_before = rtc_clk_cpu_freq_get(); + /* If we get a TG WDT system reset while running at 240MHz, + * DPORT_CPUPERIOD_SEL register will be reset to 0 resulting in 120MHz + * APB and CPU frequencies after reset. This will cause issues with XTAL + * frequency estimation, so we switch to XTAL frequency first. + * + * Ideally we would only do this if SYSCON_SOC_CLK_SEL == PLL and + * PLL is configured for 480M, but it takes less time to switch to 40M and + * run the following code than querying the PLL does. + */ + if (REG_GET_FIELD(SYSCON_SYSCLK_CONF_REG, SYSCON_SOC_CLK_SEL) == SYSCON_SOC_CLK_SEL_PLL) { + rtc_clk_cpu_freq_set(RTC_CPU_FREQ_XTAL); + } + + /* Set tuning parameters for 8M and 150k clocks. + * Note: this doesn't attempt to set the clocks to precise frequencies. + * Instead, we calibrate these clocks against XTAL frequency later, when necessary. + * - SCK_DCAP value controls tuning of 150k clock. + * The higher the value of DCAP is, the lower is the frequency. + * - CK8M_DFREQ value controls tuning of 8M clock. + * CLK_8M_DFREQ constant gives the best temperature characteristics. + */ + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_SCK_DCAP, cfg.slow_clk_dcap); + REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_CK8M_DFREQ, cfg.clk_8m_dfreq); + + /* Configure 150k clock division */ + rtc_clk_divider_set(cfg.clk_rtc_clk_div); + /* Configure 8M clock division */ + rtc_clk_8m_divider_set(cfg.clk_8m_clk_div); + + /* Enable the internal bus used to configure PLLs */ + SET_PERI_REG_BITS(ANA_CONFIG_REG, ANA_CONFIG_M, ANA_CONFIG_M, ANA_CONFIG_S); + CLEAR_PERI_REG_MASK(ANA_CONFIG_REG, I2C_APLL_M | I2C_BBPLL_M); + + /* Estimate XTAL frequency */ + rtc_xtal_freq_t xtal_freq = cfg.xtal_freq; + if (xtal_freq == RTC_XTAL_FREQ_AUTO) { + if (clk_val_is_valid(READ_PERI_REG(RTC_XTAL_FREQ_REG))) { + /* XTAL frequency has already been set, use existing value */ + xtal_freq = rtc_clk_xtal_freq_get(); + } else { + /* Not set yet, estimate XTAL frequency based on RTC_FAST_CLK */ + xtal_freq = rtc_clk_xtal_freq_estimate(); + if (xtal_freq == RTC_XTAL_FREQ_AUTO) { + SOC_LOGW(TAG, "Can't estimate XTAL frequency, assuming 26MHz"); + xtal_freq = RTC_XTAL_FREQ_26M; + } + } + } else if (!clk_val_is_valid(READ_PERI_REG(RTC_XTAL_FREQ_REG))) { + /* Exact frequency was set in sdkconfig, but still warn if autodetected + * frequency is different. If autodetection failed, worst case we get a + * bit of garbage output. + */ + rtc_xtal_freq_t est_xtal_freq = rtc_clk_xtal_freq_estimate(); + if (est_xtal_freq != xtal_freq) { + SOC_LOGW(TAG, "Possibly invalid CONFIG_ESP32S2_XTAL_FREQ setting (%dMHz). Detected %d MHz.", + xtal_freq, est_xtal_freq); + } + } + uart_tx_wait_idle(0); + rtc_clk_xtal_freq_update(xtal_freq); + rtc_clk_apb_freq_update(xtal_freq * MHZ); + /* Set CPU frequency */ + rtc_clk_cpu_freq_set(cfg.cpu_freq); + + /* Re-calculate the ccount to make time calculation correct. */ + uint32_t freq_before = rtc_clk_cpu_freq_value(cpu_source_before) / MHZ; + uint32_t freq_after = rtc_clk_cpu_freq_value(cfg.cpu_freq) / MHZ; + XTHAL_SET_CCOUNT( XTHAL_GET_CCOUNT() * freq_after / freq_before ); + + /* Slow & fast clocks setup */ + if (cfg.slow_freq == RTC_SLOW_FREQ_32K_XTAL) { + rtc_clk_32k_enable(true); + } + if (cfg.fast_freq == RTC_FAST_FREQ_8M) { + bool need_8md256 = cfg.slow_freq == RTC_SLOW_FREQ_8MD256; + rtc_clk_8m_enable(true, need_8md256); + } + rtc_clk_fast_freq_set(cfg.fast_freq); + rtc_clk_slow_freq_set(cfg.slow_freq); +} + +/* Name used in libphy.a:phy_chip_v7.o + * TODO: update the library to use rtc_clk_xtal_freq_get + */ +rtc_xtal_freq_t rtc_get_xtal(void) __attribute__((alias("rtc_clk_xtal_freq_get"))); diff --git a/components/soc/esp32s2beta/rtc_init.c b/components/soc/esp32s2beta/rtc_init.c new file mode 100644 index 0000000000..29d53753af --- /dev/null +++ b/components/soc/esp32s2beta/rtc_init.c @@ -0,0 +1,235 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "soc/soc.h" +#include "soc/rtc.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/dport_reg.h" +#include "soc/efuse_periph.h" +#include "soc/gpio_reg.h" +#include "soc/spi_mem_reg.h" +#include "i2c_rtc_clk.h" + +/* Various delays to be programmed into power control state machines */ +#define RTC_CNTL_XTL_BUF_WAIT_SLP 2 +#define RTC_CNTL_PLL_BUF_WAIT_SLP 2 +#define RTC_CNTL_CK8M_WAIT_SLP 4 +#define OTHER_BLOCKS_POWERUP 1 +#define OTHER_BLOCKS_WAIT 1 + +#define ROM_RAM_POWERUP_CYCLES OTHER_BLOCKS_POWERUP +#define ROM_RAM_WAIT_CYCLES OTHER_BLOCKS_WAIT + +#define WIFI_POWERUP_CYCLES OTHER_BLOCKS_POWERUP +#define WIFI_WAIT_CYCLES OTHER_BLOCKS_WAIT + +#define RTC_POWERUP_CYCLES OTHER_BLOCKS_POWERUP +#define RTC_WAIT_CYCLES OTHER_BLOCKS_WAIT + +#define DG_WRAP_POWERUP_CYCLES OTHER_BLOCKS_POWERUP +#define DG_WRAP_WAIT_CYCLES OTHER_BLOCKS_WAIT + +#define RTC_MEM_POWERUP_CYCLES OTHER_BLOCKS_POWERUP +#define RTC_MEM_WAIT_CYCLES OTHER_BLOCKS_WAIT + +#ifndef CONFIG_HARDWARE_IS_FPGA +void rtc_init(rtc_config_t cfg) +{ + CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PVTMON_PU); + rtc_clk_set_xtal_wait(); + REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_PLL_BUF_WAIT, cfg.pll_wait); + REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, cfg.ck8m_wait); + + /* Moved from rtc sleep to rtc init to save sleep function running time */ + // set shortest possible sleep time limit + REG_SET_FIELD(RTC_CNTL_TIMER5_REG, RTC_CNTL_MIN_SLP_VAL, RTC_CNTL_MIN_SLP_VAL_MIN); + + /* This power domian removed + * set rom&ram timer + * REG_SET_FIELD(RTC_CNTL_TIMER3_REG, RTC_CNTL_ROM_RAM_POWERUP_TIMER, ROM_RAM_POWERUP_CYCLES); + * REG_SET_FIELD(RTC_CNTL_TIMER3_REG, RTC_CNTL_ROM_RAM_WAIT_TIMER, ROM_RAM_WAIT_CYCLES); + */ + // set wifi timer + REG_SET_FIELD(RTC_CNTL_TIMER3_REG, RTC_CNTL_WIFI_POWERUP_TIMER, WIFI_POWERUP_CYCLES); + REG_SET_FIELD(RTC_CNTL_TIMER3_REG, RTC_CNTL_WIFI_WAIT_TIMER, WIFI_WAIT_CYCLES); + // set rtc peri timer + REG_SET_FIELD(RTC_CNTL_TIMER4_REG, RTC_CNTL_POWERUP_TIMER, RTC_POWERUP_CYCLES); + REG_SET_FIELD(RTC_CNTL_TIMER4_REG, RTC_CNTL_WAIT_TIMER, RTC_WAIT_CYCLES); + // set digital wrap timer + REG_SET_FIELD(RTC_CNTL_TIMER4_REG, RTC_CNTL_DG_WRAP_POWERUP_TIMER, DG_WRAP_POWERUP_CYCLES); + REG_SET_FIELD(RTC_CNTL_TIMER4_REG, RTC_CNTL_DG_WRAP_WAIT_TIMER, DG_WRAP_WAIT_CYCLES); + // set rtc memory timer + REG_SET_FIELD(RTC_CNTL_TIMER5_REG, RTC_CNTL_RTCMEM_POWERUP_TIMER, RTC_MEM_POWERUP_CYCLES); + REG_SET_FIELD(RTC_CNTL_TIMER5_REG, RTC_CNTL_RTCMEM_WAIT_TIMER, RTC_MEM_WAIT_CYCLES); + + SET_PERI_REG_MASK(RTC_CNTL_BIAS_CONF_REG, + RTC_CNTL_DEC_HEARTBEAT_WIDTH | RTC_CNTL_INC_HEARTBEAT_PERIOD); + + /* Reset RTC bias to default value (needed if waking up from deep sleep) */ + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DBIAS_WAK, RTC_CNTL_DBIAS_1V10); + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DBIAS_SLP, RTC_CNTL_DBIAS_1V10); + + if (cfg.clkctl_init) { + //clear CMMU clock force on + CLEAR_PERI_REG_MASK(DPORT_PRO_CACHE_MMU_POWER_CTRL_REG, DPORT_PRO_CACHE_MMU_MEM_FORCE_ON); + //clear rom clock force on + REG_SET_FIELD(DPORT_ROM_CTRL_0_REG, DPORT_ROM_FO, 0); + //clear sram clock force on + REG_SET_FIELD(DPORT_SRAM_CTRL_0_REG, DPORT_SRAM_FO, 0); + //clear tag clock force on + CLEAR_PERI_REG_MASK(DPORT_PRO_DCACHE_TAG_POWER_CTRL_REG, DPORT_PRO_DCACHE_TAG_MEM_FORCE_ON); + CLEAR_PERI_REG_MASK(DPORT_PRO_ICACHE_TAG_POWER_CTRL_REG, DPORT_PRO_ICACHE_TAG_MEM_FORCE_ON); + //clear register clock force on + CLEAR_PERI_REG_MASK(SPI_MEM_CLOCK_GATE_REG(0), SPI_MEM_CLK_EN); + CLEAR_PERI_REG_MASK(SPI_MEM_CLOCK_GATE_REG(1), SPI_MEM_CLK_EN); + } + if (cfg.pwrctl_init) { + CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_CK8M_FORCE_PU); + //cancel xtal force pu if no need to force power up + //cannot cancel xtal force pu if pll is force power on + if (!(cfg.xtal_fpu | cfg.bbpll_fpu)) { + CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_XTL_FORCE_PU); + } else { + SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_XTL_FORCE_PU); + } + // cancel BIAS force pu + // CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_CORE_FORCE_PU); + // CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_I2C_FORCE_PU); + CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_FORCE_NOSLEEP); + // bias follow 8M + // SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_CORE_FOLW_8M); + // SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_I2C_FOLW_8M); + SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_SLEEP_FOLW_8M); + // CLEAR APLL close + CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PLLA_FORCE_PU); + SET_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG, RTC_CNTL_PLLA_FORCE_PD); + + //cancel bbpll force pu if setting no force power up + if (!cfg.bbpll_fpu) { + CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BBPLL_FORCE_PU); + CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BBPLL_I2C_FORCE_PU); + CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BB_I2C_FORCE_PU); + } else { + SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BBPLL_FORCE_PU); + SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BBPLL_I2C_FORCE_PU); + SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BB_I2C_FORCE_PU); + } + //cancel RTC REG force PU + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_PWC_FORCE_PU); + CLEAR_PERI_REG_MASK(RTC_CNTL_REG, RTC_CNTL_REGULATOR_FORCE_PU); + CLEAR_PERI_REG_MASK(RTC_CNTL_REG, RTC_CNTL_DBOOST_FORCE_PU); + + //combine two rtc memory options + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_MEM_FORCE_PU); + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_MEM_FORCE_NOISO); + + if (cfg.rtc_dboost_fpd) { + SET_PERI_REG_MASK(RTC_CNTL_REG, RTC_CNTL_DBOOST_FORCE_PD); + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_REG, RTC_CNTL_DBOOST_FORCE_PD); + } + //cancel digital pu force + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_MEM_FORCE_PU); + + /* If this mask is enabled, all soc memories cannot enter power down mode */ + /* We should control soc memory power down mode from RTC, so we will not touch this register any more */ + CLEAR_PERI_REG_MASK(DPORT_MEM_PD_MASK_REG, DPORT_LSLP_MEM_PD_MASK); + /* If this pd_cfg is set to 1, all memory won't enter low power mode during light sleep */ + /* If this pd_cfg is set to 0, all memory will enter low power mode during light sleep */ + rtc_sleep_pd_config_t pd_cfg = RTC_SLEEP_PD_CONFIG_ALL(0); + rtc_sleep_pd(pd_cfg); + + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_DG_WRAP_FORCE_PU); + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_FORCE_PU); + // ROM_RAM power domain is removed + // CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_CPU_ROM_RAM_FORCE_PU); + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_WRAP_FORCE_NOISO); + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_WIFI_FORCE_NOISO); + // CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_CPU_ROM_RAM_FORCE_NOISO); + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_FORCE_NOISO); + //cancel digital PADS force no iso + if (cfg.cpu_waiti_clk_gate){ + CLEAR_PERI_REG_MASK(DPORT_CPU_PER_CONF_REG, DPORT_CPU_WAIT_MODE_FORCE_ON); + } + else{ + SET_PERI_REG_MASK(DPORT_CPU_PER_CONF_REG, DPORT_CPU_WAIT_MODE_FORCE_ON); + } + /*if DPORT_CPU_WAIT_MODE_FORCE_ON == 0 , the cpu clk will be closed when cpu enter WAITI mode*/ + +#ifdef CONFIG_CHIP_IS_ESP32 + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_PAD_FORCE_UNHOLD); + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_PAD_FORCE_NOISO); +#endif + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_UNHOLD); + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_DG_PAD_FORCE_NOISO); +#ifdef CONFIG_CHIP_IS_ESP32 + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_PAD_AUTOHOLD_EN); + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_DG_PAD_AUTOHOLD_EN); +#endif + } +} +#endif + +rtc_vddsdio_config_t rtc_vddsdio_get_config(void) +{ + rtc_vddsdio_config_t result; + uint32_t sdio_conf_reg = REG_READ(RTC_CNTL_SDIO_CONF_REG); + result.drefh = (sdio_conf_reg & RTC_CNTL_DREFH_SDIO_M) >> RTC_CNTL_DREFH_SDIO_S; + result.drefm = (sdio_conf_reg & RTC_CNTL_DREFM_SDIO_M) >> RTC_CNTL_DREFM_SDIO_S; + result.drefl = (sdio_conf_reg & RTC_CNTL_DREFL_SDIO_M) >> RTC_CNTL_DREFL_SDIO_S; + if (sdio_conf_reg & RTC_CNTL_SDIO_FORCE) { + // Get configuration from RTC + result.force = 1; + result.enable = (sdio_conf_reg & RTC_CNTL_XPD_SDIO_REG_M) >> RTC_CNTL_XPD_SDIO_REG_S; + result.tieh = (sdio_conf_reg & RTC_CNTL_SDIO_TIEH_M) >> RTC_CNTL_SDIO_TIEH_S; + return result; + } else { + result.force = 0; + } + uint32_t efuse_reg = REG_READ(EFUSE_RD_REPEAT_DATA1_REG); + if (efuse_reg & EFUSE_SDIO_FORCE) { + // Get configuration from EFUSE + result.enable = (efuse_reg & EFUSE_SDIO_XPD_M) >> EFUSE_SDIO_XPD_S; + result.tieh = (efuse_reg & EFUSE_SDIO_TIEH_M) >> EFUSE_SDIO_TIEH_S; + + result.drefm = (efuse_reg & EFUSE_SDIO_DREFM_M) >> EFUSE_SDIO_DREFM_S; + result.drefl = (efuse_reg & EFUSE_SDIO_DREFL_M) >> EFUSE_SDIO_DREFL_S; + + efuse_reg = REG_READ(EFUSE_RD_REPEAT_DATA0_REG); + result.drefh = (efuse_reg & EFUSE_SDIO_DREFH_M) >> EFUSE_SDIO_DREFH_S; + + return result; + } + + // Otherwise, VDD_SDIO is controlled by bootstrapping pin + uint32_t strap_reg = REG_READ(GPIO_STRAP_REG); + result.tieh = (strap_reg & BIT(5)) ? RTC_VDDSDIO_TIEH_1_8V : RTC_VDDSDIO_TIEH_3_3V; + result.enable = 1; + return result; +} + +void rtc_vddsdio_set_config(rtc_vddsdio_config_t config) +{ + uint32_t val = 0; + val |= (config.force << RTC_CNTL_SDIO_FORCE_S); + val |= (config.enable << RTC_CNTL_XPD_SDIO_REG_S); + val |= (config.drefh << RTC_CNTL_DREFH_SDIO_S); + val |= (config.drefm << RTC_CNTL_DREFM_SDIO_S); + val |= (config.drefl << RTC_CNTL_DREFL_SDIO_S); + val |= (config.tieh << RTC_CNTL_SDIO_TIEH_S); + val |= RTC_CNTL_SDIO_PD_EN; + REG_WRITE(RTC_CNTL_SDIO_CONF_REG, val); +} diff --git a/components/soc/esp32s2beta/rtc_periph.c b/components/soc/esp32s2beta/rtc_periph.c new file mode 100644 index 0000000000..87d5ddc1b4 --- /dev/null +++ b/components/soc/esp32s2beta/rtc_periph.c @@ -0,0 +1,41 @@ +// Copyright 2018 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "soc/rtc_periph.h" + +/* Reg,Mux,Fun,IE,Up,Down,Rtc_number */ +rtc_gpio_info_t* rtc_gpio_reg[RTC_GPIO_NUMBER] = { + (rtc_gpio_info_t*)&RTCIO.touch_pad[0].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[1].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[2].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[3].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[4].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[5].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[6].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[7].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[8].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[9].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[10].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[11].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[12].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[13].val, + (rtc_gpio_info_t*)&RTCIO.touch_pad[14].val, + (rtc_gpio_info_t*)&RTCIO.xtal_32p_pad.val, + (rtc_gpio_info_t*)&RTCIO.xtal_32n_pad.val, + (rtc_gpio_info_t*)&RTCIO.pad_dac[0].val, + (rtc_gpio_info_t*)&RTCIO.pad_dac[1].val, + (rtc_gpio_info_t*)&RTCIO.rtc_pad19.val, + (rtc_gpio_info_t*)&RTCIO.rtc_pad20.val, + (rtc_gpio_info_t*)&RTCIO.rtc_pad21.val +}; \ No newline at end of file diff --git a/components/soc/esp32s2beta/rtc_pm.c b/components/soc/esp32s2beta/rtc_pm.c new file mode 100644 index 0000000000..2f63dc8beb --- /dev/null +++ b/components/soc/esp32s2beta/rtc_pm.c @@ -0,0 +1,67 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "soc/rtc.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/apb_ctrl_reg.h" + +typedef enum { + PM_LIGHT_SLEEP = BIT(2), /*!< WiFi PD, memory in light sleep */ +} pm_sleep_mode_t; + +typedef enum{ + PM_SW_NOREJECT = 0, + PM_SW_REJECT = 1 +} pm_sw_reject_t; + + +/* These MAC-related functions are defined in the closed source part of + * RTC library + */ +extern void pm_mac_init(void); +extern int pm_check_mac_idle(void); +extern void pm_mac_deinit(void); + +/* This sleep-related function is called from the closed source part of RTC + * library. + */ +pm_sw_reject_t pm_set_sleep_mode(pm_sleep_mode_t sleep_mode, void(*pmac_save_params)(void)) +{ + (void) pmac_save_params; /* unused */ + + pm_mac_deinit(); + if (pm_check_mac_idle()) { + pm_mac_init(); + return PM_SW_REJECT; + } + + rtc_sleep_config_t cfg = { 0 }; + + switch (sleep_mode) { + case PM_LIGHT_SLEEP: + cfg.wifi_pd_en = 1; + cfg.dig_dbias_wak = 4; + cfg.dig_dbias_slp = 0; + cfg.rtc_dbias_wak = 0; + cfg.rtc_dbias_slp = 0; + rtc_sleep_init(cfg); + break; + + default: + assert(0 && "unsupported sleep mode"); + } + return PM_SW_NOREJECT; +} diff --git a/components/soc/esp32s2beta/rtc_sleep.c b/components/soc/esp32s2beta/rtc_sleep.c new file mode 100644 index 0000000000..56865ce74c --- /dev/null +++ b/components/soc/esp32s2beta/rtc_sleep.c @@ -0,0 +1,197 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "soc/soc.h" +#include "soc/rtc.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/apb_ctrl_reg.h" +#include "soc/dport_reg.h" +#include "soc/rtc.h" +#include "soc/i2s_reg.h" +#include "soc/timer_group_reg.h" +#include "soc/bb_reg.h" +#include "soc/nrx_reg.h" +#include "soc/fe_reg.h" +#include "soc/rtc.h" +#include "esp32s2beta/rom/ets_sys.h" + +#define MHZ (1000000) + +/** + * Configure whether certain peripherals are powered down in deep sleep + * @param cfg power down flags as rtc_sleep_pd_config_t structure + */ +void rtc_sleep_pd(rtc_sleep_pd_config_t cfg) +{ + REG_SET_FIELD(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_LSLP_MEM_FORCE_PU, cfg.dig_fpu); + REG_SET_FIELD(RTC_CNTL_PWC_REG, RTC_CNTL_FASTMEM_FORCE_LPU, cfg.rtc_fpu); + REG_SET_FIELD(RTC_CNTL_PWC_REG, RTC_CNTL_SLOWMEM_FORCE_LPU, cfg.rtc_fpu); + //DPORT_REG_SET_FIELD(DPORT_MEM_PD_MASK_REG, DPORT_LSLP_MEM_PD_MASK, ~cfg.cpu_pd); + REG_SET_FIELD(I2S_PD_CONF_REG(0), I2S_PLC_MEM_FORCE_PU, cfg.i2s_fpu); + REG_SET_FIELD(I2S_PD_CONF_REG(0), I2S_FIFO_FORCE_PU, cfg.i2s_fpu); + REG_SET_FIELD(APB_CTRL_FRONT_END_MEM_PD_REG, APB_CTRL_DC_MEM_FORCE_PU, cfg.fe_fpu); + REG_SET_FIELD(APB_CTRL_FRONT_END_MEM_PD_REG, APB_CTRL_PBUS_MEM_FORCE_PU, cfg.fe_fpu); + REG_SET_FIELD(APB_CTRL_FRONT_END_MEM_PD_REG, APB_CTRL_AGC_MEM_FORCE_PU, cfg.fe_fpu); + REG_SET_FIELD(BBPD_CTRL, BB_FFT_FORCE_PU, cfg.bb_fpu); + REG_SET_FIELD(BBPD_CTRL, BB_DC_EST_FORCE_PU, cfg.bb_fpu); + REG_SET_FIELD(NRXPD_CTRL, NRX_RX_ROT_FORCE_PU, cfg.nrx_fpu); + REG_SET_FIELD(NRXPD_CTRL, NRX_VIT_FORCE_PU, cfg.nrx_fpu); + REG_SET_FIELD(NRXPD_CTRL, NRX_DEMAP_FORCE_PU, cfg.nrx_fpu); + REG_SET_FIELD(FE_GEN_CTRL, FE_IQ_EST_FORCE_PU, cfg.fe_fpu); + REG_SET_FIELD(FE2_TX_INTERP_CTRL, FE2_TX_INF_FORCE_PU, cfg.fe_fpu); +} + +void rtc_sleep_init(rtc_sleep_config_t cfg) +{ + /* Already defined in rtc init + // set 5 PWC state machine times to fit in main state machine time + REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_PLL_BUF_WAIT, RTC_CNTL_PLL_BUF_WAIT_SLP); + REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_XTL_BUF_WAIT, RTC_CNTL_XTL_BUF_WAIT_SLP); + REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, RTC_CNTL_CK8M_WAIT_SLP); + */ + /* I don't think it worthes to run this function everytime as it is just a test option */ + if (cfg.lslp_mem_inf_fpu) + { + rtc_sleep_pd_config_t pd_cfg = RTC_SLEEP_PD_CONFIG_ALL(1); + rtc_sleep_pd(pd_cfg); + } + + /* This option seems to be unneccessary + if (cfg.rtc_mem_inf_fpu) { + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_MEM_FORCE_PU); + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_MEM_FORCE_PU); + } + */ + + if (cfg.rtc_mem_inf_follow_cpu) { + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_MEM_FOLW_CPU); + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_MEM_FOLW_CPU); + } + + if (cfg.rtc_fastmem_pd_en) { + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_FASTMEM_PD_EN); + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG,RTC_CNTL_FASTMEM_FORCE_PU); + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG,RTC_CNTL_FASTMEM_FORCE_NOISO); + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_FASTMEM_PD_EN); + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG,RTC_CNTL_FASTMEM_FORCE_PU); + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG,RTC_CNTL_FASTMEM_FORCE_NOISO); + } + + if (cfg.rtc_slowmem_pd_en) { + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_SLOWMEM_PD_EN); + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG,RTC_CNTL_SLOWMEM_FORCE_PU); + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG,RTC_CNTL_SLOWMEM_FORCE_NOISO); + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_SLOWMEM_PD_EN); + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG,RTC_CNTL_SLOWMEM_FORCE_PU); + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG,RTC_CNTL_SLOWMEM_FORCE_NOISO); + } + + if (cfg.rtc_peri_pd_en) { + SET_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_PD_EN); + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_PWC_REG, RTC_CNTL_PD_EN); + } + + if (cfg.wifi_pd_en) { + SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_PD_EN); + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_WIFI_PD_EN); + } + + /* +#ifdef CONFIG_CHIP_IS_ESP32 + if (cfg.rom_mem_pd_en) { + SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_CPU_ROM_RAM_PD_EN); + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_CPU_ROM_RAM_PD_EN); + } +#endif + */ + + if (cfg.deep_slp) { + /* redundant ? People may not want to touch such registers after init + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, + RTC_CNTL_DG_PAD_FORCE_ISO | RTC_CNTL_DG_PAD_FORCE_NOISO); + + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, + RTC_CNTL_DG_WRAP_FORCE_PU | RTC_CNTL_DG_WRAP_FORCE_PD); + +#ifdef CONFIG_CHIP_IS_ESP32 + CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_FORCE_NOSLEEP); +#endif + */ + REG_SET_FIELD(RTC_CNTL_BIAS_CONF_REG, RTC_CNTL_DBG_ATTEN, RTC_CNTL_DBG_ATTEN_DEFAULT); + SET_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_DG_WRAP_PD_EN); + // Shut down parts of RTC which may have been left enabled by the wireless drivers + CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG, + RTC_CNTL_CKGEN_I2C_PU | RTC_CNTL_PLL_I2C_PU | + RTC_CNTL_RFRX_PBUS_PU | RTC_CNTL_TXRF_I2C_PU); + } else { + CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_DG_WRAP_PD_EN); + REG_SET_FIELD(RTC_CNTL_BIAS_CONF_REG, RTC_CNTL_DBG_ATTEN, 6); + } + + /* enable VDDSDIO control by state machine */ + REG_CLR_BIT(RTC_CNTL_SDIO_CONF_REG, RTC_CNTL_SDIO_FORCE); + REG_SET_FIELD(RTC_CNTL_SDIO_CONF_REG, RTC_CNTL_SDIO_PD_EN, cfg.vddsdio_pd_en); + + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DBIAS_SLP, cfg.rtc_dbias_slp); + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DBIAS_WAK, cfg.rtc_dbias_wak); + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, cfg.dig_dbias_wak); + REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_SLP, cfg.dig_dbias_slp); + + REG_SET_FIELD(RTC_CNTL_SLP_REJECT_CONF_REG, RTC_CNTL_DEEP_SLP_REJECT_EN, cfg.deep_slp_reject); + REG_SET_FIELD(RTC_CNTL_SLP_REJECT_CONF_REG, RTC_CNTL_LIGHT_SLP_REJECT_EN, cfg.light_slp_reject); +} + +void rtc_sleep_set_wakeup_time(uint64_t t) +{ + WRITE_PERI_REG(RTC_CNTL_SLP_TIMER0_REG, t & UINT32_MAX); + WRITE_PERI_REG(RTC_CNTL_SLP_TIMER1_REG, t >> 32); +} + +uint32_t rtc_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt, uint32_t lslp_mem_inf_fpu) +{ + REG_SET_FIELD(RTC_CNTL_WAKEUP_STATE_REG, RTC_CNTL_WAKEUP_ENA, wakeup_opt); + REG_SET_FIELD(RTC_CNTL_SLP_REJECT_CONF_REG, RTC_CNTL_SLEEP_REJECT_ENA, reject_opt); + + /* Start entry into sleep mode */ + SET_PERI_REG_MASK(RTC_CNTL_STATE0_REG, RTC_CNTL_SLEEP_EN); + + while (GET_PERI_REG_MASK(RTC_CNTL_INT_RAW_REG, + RTC_CNTL_SLP_REJECT_INT_RAW | RTC_CNTL_SLP_WAKEUP_INT_RAW) == 0) { + ; + } + /* In deep sleep mode, we never get here */ + uint32_t reject = REG_GET_FIELD(RTC_CNTL_INT_RAW_REG, RTC_CNTL_SLP_REJECT_INT_RAW); + SET_PERI_REG_MASK(RTC_CNTL_INT_CLR_REG, + RTC_CNTL_SLP_REJECT_INT_CLR | RTC_CNTL_SLP_WAKEUP_INT_CLR); + + /* restore config if it is a light sleep */ + if (lslp_mem_inf_fpu) + { + rtc_sleep_pd_config_t pd_cfg = RTC_SLEEP_PD_CONFIG_ALL(0); + rtc_sleep_pd(pd_cfg); + } + /* move setting from init to sleep, so we don't need to have this any more + * restore DBG_ATTEN to the default value + REG_SET_FIELD(RTC_CNTL_BIAS_CONF_REG, RTC_CNTL_DBG_ATTEN, RTC_CNTL_DBG_ATTEN_DEFAULT); + */ + return reject; +} diff --git a/components/soc/esp32s2beta/rtc_time.c b/components/soc/esp32s2beta/rtc_time.c new file mode 100644 index 0000000000..af7829a72f --- /dev/null +++ b/components/soc/esp32s2beta/rtc_time.c @@ -0,0 +1,174 @@ +// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "esp32s2beta/rom/ets_sys.h" +#include "soc/rtc.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/timer_group_reg.h" + +#define MHZ (1000000) + +/* Calibration of RTC_SLOW_CLK is performed using a special feature of TIMG0. + * This feature counts the number of XTAL clock cycles within a given number of + * RTC_SLOW_CLK cycles. + * + * Slow clock calibration feature has two modes of operation: one-off and cycling. + * In cycling mode (which is enabled by default on SoC reset), counting of XTAL + * cycles within RTC_SLOW_CLK cycle is done continuously. Cycling mode is enabled + * using TIMG_RTC_CALI_START_CYCLING bit. In one-off mode counting is performed + * once, and TIMG_RTC_CALI_RDY bit is set when counting is done. One-off mode is + * enabled using TIMG_RTC_CALI_START bit. + */ + +/** + * @brief Clock calibration function used by rtc_clk_cal and rtc_clk_cal_ratio + * @param cal_clk which clock to calibrate + * @param slowclk_cycles number of slow clock cycles to count + * @return number of XTAL clock cycles within the given number of slow clock cycles + */ +uint32_t rtc_clk_cal_internal(rtc_cal_sel_t cal_clk, uint32_t slowclk_cycles) +{ + /* Enable requested clock (150k clock is always on) */ + int dig_32k_xtal_state = REG_GET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_XTAL32K_EN); + if (cal_clk == RTC_CAL_32K_XTAL && !dig_32k_xtal_state) { + REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_XTAL32K_EN, 1); + } + + if (cal_clk == RTC_CAL_8MD256) { + SET_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_CLK8M_D256_EN); + } + /* Prepare calibration */ + REG_SET_FIELD(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_CLK_SEL, cal_clk); + /* There may be another calibration process already running during we call this function, + * so we should wait the last process is done. + */ + if (!GET_PERI_REG_MASK(TIMG_RTCCALICFG2_REG(0), TIMG_RTC_CALI_TIMEOUT)) { + if (GET_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_START_CYCLING)) { + while(!GET_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_RDY)); + } + } + CLEAR_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_START_CYCLING); + REG_SET_FIELD(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_MAX, slowclk_cycles); + /* Figure out how long to wait for calibration to finish */ + + /* Set timeout reg and expect time delay*/ + uint32_t expected_freq; + if (cal_clk == RTC_CAL_32K_XTAL) { + REG_SET_FIELD(TIMG_RTCCALICFG2_REG(0), TIMG_RTC_CALI_TIMEOUT_THRES, (slowclk_cycles << 13)); + expected_freq = 32768; + } else if (cal_clk == RTC_CAL_8MD256) { + REG_SET_FIELD(TIMG_RTCCALICFG2_REG(0), TIMG_RTC_CALI_TIMEOUT_THRES, (slowclk_cycles << 13)); + expected_freq = RTC_FAST_CLK_FREQ_APPROX / 256; + } else { + REG_SET_FIELD(TIMG_RTCCALICFG2_REG(0), TIMG_RTC_CALI_TIMEOUT_THRES, (slowclk_cycles << 11)); + expected_freq = 90000; + } + uint32_t us_time_estimate = (uint32_t) (((uint64_t) slowclk_cycles) * MHZ / expected_freq); + /* Start calibration */ + CLEAR_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_START); + SET_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_START); + + /* Wait for calibration to finish up to another us_time_estimate */ + ets_delay_us(us_time_estimate); + uint32_t cal_val; + while (true) { + if (GET_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_RDY)) { + cal_val = REG_GET_FIELD(TIMG_RTCCALICFG1_REG(0), TIMG_RTC_CALI_VALUE); + break; + } + if (GET_PERI_REG_MASK(TIMG_RTCCALICFG2_REG(0), TIMG_RTC_CALI_TIMEOUT)) { + cal_val = 0; + break; + } + } + CLEAR_PERI_REG_MASK(TIMG_RTCCALICFG_REG(0), TIMG_RTC_CALI_START); + + REG_SET_FIELD(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_XTAL32K_EN, dig_32k_xtal_state); + + if (cal_clk == RTC_CAL_8MD256) { + CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_DIG_CLK8M_D256_EN); + } + + return cal_val; +} + +uint32_t rtc_clk_cal_ratio(rtc_cal_sel_t cal_clk, uint32_t slowclk_cycles) +{ + uint64_t xtal_cycles = rtc_clk_cal_internal(cal_clk, slowclk_cycles); + uint64_t ratio_64 = ((xtal_cycles << RTC_CLK_CAL_FRACT)) / slowclk_cycles; + uint32_t ratio = (uint32_t)(ratio_64 & UINT32_MAX); + return ratio; +} + +uint32_t rtc_clk_cal(rtc_cal_sel_t cal_clk, uint32_t slowclk_cycles) +{ + rtc_xtal_freq_t xtal_freq = rtc_clk_xtal_freq_get(); + uint64_t xtal_cycles = rtc_clk_cal_internal(cal_clk, slowclk_cycles); + uint64_t divider = ((uint64_t)xtal_freq) * slowclk_cycles; + uint64_t period_64 = ((xtal_cycles << RTC_CLK_CAL_FRACT) + divider / 2 - 1) / divider; + uint32_t period = (uint32_t)(period_64 & UINT32_MAX); + return period; +} + +uint64_t rtc_time_us_to_slowclk(uint64_t time_in_us, uint32_t period) +{ + /* Overflow will happen in this function if time_in_us >= 2^45, which is about 400 days. + * TODO: fix overflow. + */ + return (time_in_us << RTC_CLK_CAL_FRACT) / period; +} + +uint64_t rtc_time_slowclk_to_us(uint64_t rtc_cycles, uint32_t period) +{ + return (rtc_cycles * period) >> RTC_CLK_CAL_FRACT; +} + +uint64_t rtc_time_get(void) +{ + SET_PERI_REG_MASK(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_UPDATE); + while (GET_PERI_REG_MASK(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_VALID) == 0) { + ets_delay_us(1); // might take 1 RTC slowclk period, don't flood RTC bus + } + SET_PERI_REG_MASK(RTC_CNTL_INT_CLR_REG, RTC_CNTL_TIME_VALID_INT_CLR); + uint64_t t = READ_PERI_REG(RTC_CNTL_TIME0_REG); + t |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME1_REG)) << 32; + return t; +} + +uint64_t rtc_light_slp_time_get(void) +{ + uint64_t t_wake = READ_PERI_REG(RTC_CNTL_TIME_LOW0_REG); + t_wake |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME_HIGH0_REG)) << 32; + uint64_t t_slp = READ_PERI_REG(RTC_CNTL_TIME_LOW1_REG); + t_slp |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME_HIGH1_REG)) << 32; + return (t_wake - t_slp); +} + +uint64_t rtc_deep_slp_time_get(void) +{ + uint64_t t_slp = READ_PERI_REG(RTC_CNTL_TIME_LOW1_REG); + t_slp |= ((uint64_t) READ_PERI_REG(RTC_CNTL_TIME_HIGH1_REG)) << 32; + uint64_t t_wake = rtc_time_get(); + return (t_wake - t_slp); +} + +void rtc_clk_wait_for_slow_cycle(void) //This function may not by useful any more +{ + SET_PERI_REG_MASK(RTC_CNTL_SLOW_CLK_CONF_REG, RTC_CNTL_SLOW_CLK_NEXT_EDGE); + while (GET_PERI_REG_MASK(RTC_CNTL_SLOW_CLK_CONF_REG, RTC_CNTL_SLOW_CLK_NEXT_EDGE)) { + ets_delay_us(1); + } +} + diff --git a/components/soc/esp32s2beta/rtc_wdt.c b/components/soc/esp32s2beta/rtc_wdt.c new file mode 100644 index 0000000000..53861772a4 --- /dev/null +++ b/components/soc/esp32s2beta/rtc_wdt.c @@ -0,0 +1,152 @@ +// Copyright 2018 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "soc/rtc_wdt.h" +#include "soc/rtc.h" +#include "soc/efuse_periph.h" + + +bool rtc_wdt_get_protect_status(void) +{ + return READ_PERI_REG(RTC_CNTL_WDTWPROTECT_REG) != RTC_CNTL_WDT_WKEY_VALUE; +} + +void rtc_wdt_protect_off(void) +{ + WRITE_PERI_REG(RTC_CNTL_WDTWPROTECT_REG, RTC_CNTL_WDT_WKEY_VALUE); +} + +void rtc_wdt_protect_on(void) +{ + WRITE_PERI_REG(RTC_CNTL_WDTWPROTECT_REG, 0); +} + + +void rtc_wdt_enable(void) +{ + REG_SET_BIT(RTC_CNTL_WDTFEED_REG, RTC_CNTL_WDT_FEED); + SET_PERI_REG_MASK(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_EN | RTC_CNTL_WDT_PAUSE_IN_SLP); +} + +void rtc_wdt_flashboot_mode_enable(void) +{ + REG_SET_BIT(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_FLASHBOOT_MOD_EN); +} + +void rtc_wdt_disable(void) +{ + bool protect = rtc_wdt_get_protect_status(); + if (protect) { + rtc_wdt_protect_off(); + } + REG_SET_BIT(RTC_CNTL_WDTFEED_REG, RTC_CNTL_WDT_FEED); + rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_OFF); + rtc_wdt_set_stage(RTC_WDT_STAGE1, RTC_WDT_STAGE_ACTION_OFF); + rtc_wdt_set_stage(RTC_WDT_STAGE2, RTC_WDT_STAGE_ACTION_OFF); + rtc_wdt_set_stage(RTC_WDT_STAGE3, RTC_WDT_STAGE_ACTION_OFF); + REG_CLR_BIT(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_FLASHBOOT_MOD_EN); + REG_CLR_BIT(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_EN); + if (protect) { + rtc_wdt_protect_on(); + } +} + +void rtc_wdt_feed(void) +{ + bool protect = rtc_wdt_get_protect_status(); + if (protect) { + rtc_wdt_protect_off(); + } + REG_SET_BIT(RTC_CNTL_WDTFEED_REG, RTC_CNTL_WDT_FEED); + if (protect) { + rtc_wdt_protect_on(); + } +} + +static uint32_t get_addr_reg(rtc_wdt_stage_t stage) +{ + uint32_t reg; + if (stage == RTC_WDT_STAGE0) { + reg = RTC_CNTL_WDTCONFIG1_REG; + } else if (stage == RTC_WDT_STAGE1) { + reg = RTC_CNTL_WDTCONFIG2_REG; + } else if (stage == RTC_WDT_STAGE2) { + reg = RTC_CNTL_WDTCONFIG3_REG; + } else { + reg = RTC_CNTL_WDTCONFIG4_REG; + } + return reg; +} + +esp_err_t rtc_wdt_set_time(rtc_wdt_stage_t stage, unsigned int timeout_ms) +{ + if (stage > 3) { + return ESP_ERR_INVALID_ARG; + } + uint32_t timeout = (uint32_t) ((uint64_t) rtc_clk_slow_freq_get_hz() * timeout_ms / 1000); + if (stage == RTC_WDT_STAGE0) { + timeout = timeout >> (1 + REG_GET_FIELD(EFUSE_RD_REPEAT_DATA1_REG, EFUSE_WDT_DELAY_SEL)); + } + WRITE_PERI_REG(get_addr_reg(stage), timeout); + return ESP_OK; +} + +esp_err_t rtc_wdt_get_timeout(rtc_wdt_stage_t stage, unsigned int* timeout_ms) +{ + if (stage > 3) { + return ESP_ERR_INVALID_ARG; + } + uint32_t time_tick; + time_tick = READ_PERI_REG(get_addr_reg(stage)); + *timeout_ms = time_tick * 1000 / rtc_clk_slow_freq_get_hz(); + + return ESP_OK; +} + +esp_err_t rtc_wdt_set_stage(rtc_wdt_stage_t stage, rtc_wdt_stage_action_t stage_sel) +{ + if (stage > 3 || stage_sel > 4) { + return ESP_ERR_INVALID_ARG; + } + if (stage == RTC_WDT_STAGE0) { + REG_SET_FIELD(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_STG0, stage_sel); + } else if (stage == RTC_WDT_STAGE1) { + REG_SET_FIELD(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_STG1, stage_sel); + } else if (stage == RTC_WDT_STAGE2) { + REG_SET_FIELD(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_STG2, stage_sel); + } else { + REG_SET_FIELD(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_STG3, stage_sel); + } + + return ESP_OK; +} + +esp_err_t rtc_wdt_set_length_of_reset_signal(rtc_wdt_reset_sig_t reset_src, rtc_wdt_length_sig_t reset_signal_length) +{ + if (reset_src > 1 || reset_signal_length > 7) { + return ESP_ERR_INVALID_ARG; + } + if (reset_src == 0) { + REG_SET_FIELD(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_SYS_RESET_LENGTH, reset_signal_length); + } else { + REG_SET_FIELD(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_CPU_RESET_LENGTH, reset_signal_length); + } + + return ESP_OK; +} + +bool rtc_wdt_is_on(void) +{ + return (REG_GET_BIT(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_EN) != 0) || (REG_GET_BIT(RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_FLASHBOOT_MOD_EN) != 0); +} diff --git a/components/soc/esp32s2beta/soc_log.h b/components/soc/esp32s2beta/soc_log.h new file mode 100644 index 0000000000..4cd669e117 --- /dev/null +++ b/components/soc/esp32s2beta/soc_log.h @@ -0,0 +1,29 @@ +// Copyright 2016-2017 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +/** + * @file soc_log.h + * @brief SOC library logging functions + * + * To make SOC library compatible with environments which don't use ESP-IDF, + * this header file provides wrappers for logging functions. + */ + +#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__) diff --git a/components/soc/esp32s2beta/soc_memory_layout.c b/components/soc/esp32s2beta/soc_memory_layout.c new file mode 100644 index 0000000000..5d6f680ce2 --- /dev/null +++ b/components/soc/esp32s2beta/soc_memory_layout.c @@ -0,0 +1,137 @@ +// Copyright 2010-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#ifndef BOOTLOADER_BUILD + +#include +#include + +#include "soc/soc.h" +#include "soc/soc_memory_layout.h" +#include "esp_heap_caps.h" +#include "sdkconfig.h" + +/* Memory layout for ESP32 SoC */ + +/* +Memory type descriptors. These describe the capabilities of a type of memory in the SoC. Each type of memory +map consist of one or more regions in the address space. + +Each type contains an array of prioritised capabilities; types with later entries are only taken if earlier +ones can't fulfill the memory request. + +The prioritised capabilities work roughly like this: +- For a normal malloc (MALLOC_CAP_DEFAULT), give away the DRAM-only memory first, then pass off any dual-use IRAM regions, + finally eat into the application memory. +- For a malloc where 32-bit-aligned-only access is okay, first allocate IRAM, then DRAM, finally application IRAM. +- Application mallocs (PIDx) will allocate IRAM first, if possible, then DRAM. +- Most other malloc caps only fit in one region anyway. + +*/ +const soc_memory_type_desc_t soc_memory_types[] = { + //Type 0: DRAM + { "DRAM", { MALLOC_CAP_8BIT|MALLOC_CAP_DEFAULT, MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA|MALLOC_CAP_32BIT, 0 }, false, false}, + // Type 1: DRAM used for startup stacks + { "DRAM", { MALLOC_CAP_8BIT|MALLOC_CAP_DEFAULT, MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA|MALLOC_CAP_32BIT, 0 }, false, true}, + //Type 2: DRAM which has an alias on the I-port + { "D/IRAM", { 0, MALLOC_CAP_DMA|MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL|MALLOC_CAP_DEFAULT, MALLOC_CAP_32BIT|MALLOC_CAP_EXEC }, true, false}, + //Type 3: IRAM + //In ESP32S2beta, All IRAM region are available by D-port (D/IRAM). + { "IRAM", { MALLOC_CAP_EXEC|MALLOC_CAP_32BIT|MALLOC_CAP_INTERNAL, 0, 0 }, false, false}, + //Type 4: SPI SRAM data + //TODO, in fact, part of them support EDMA, to be supported. + { "SPIRAM", { MALLOC_CAP_SPIRAM|MALLOC_CAP_DEFAULT, 0, MALLOC_CAP_8BIT|MALLOC_CAP_32BIT}, false, false}, + //Type 5: SPI SRAM data from AHB DBUS3, slower than normal + //TODO, add a bit to control the access of it +#if CONFIG_USE_AHB_DBUS3_ACCESS_SPIRAM + { "SPIRAM(Slow)", { MALLOC_CAP_SPIRAM|MALLOC_CAP_DEFAULT, 0, MALLOC_CAP_8BIT|MALLOC_CAP_32BIT}, false, false}, +#endif +}; + +const size_t soc_memory_type_count = sizeof(soc_memory_types)/sizeof(soc_memory_type_desc_t); + +/* +Region descriptors. These describe all regions of memory available, and map them to a type in the above type. + +Because of requirements in the coalescing code which merges adjacent regions, this list should always be sorted +from low to high start address. +*/ +const soc_memory_region_t soc_memory_regions[] = { +#ifdef CONFIG_SPIRAM + { SOC_EXTRAM_DATA_LOW, SOC_EXTRAM_DATA_HIGH - SOC_EXTRAM_DATA_LOW, 4, 0}, //SPI SRAM, if available +#if CONFIG_USE_AHB_DBUS3_ACCESS_SPIRAM + { SOC_SLOW_EXTRAM_DATA_LOW, SOC_SLOW_EXTRAM_DATA_HIGH - SOC_SLOW_EXTRAM_DATA_LOW, 5, 0}, //SPI SRAM, if available +#endif +#endif +#if CONFIG_ESP32S2_INSTRUCTION_CACHE_8KB +#if CONFIG_ESP32S2_DATA_CACHE_0KB + { 0x3FFB2000, 0x2000, 2, 0x40022000}, //Block 1, can be use as I/D cache memory + { 0x3FFB4000, 0x2000, 2, 0x40024000}, //Block 2, can be use as D cache memory + { 0x3FFB6000, 0x2000, 2, 0x40026000}, //Block 3, can be use as D cache memory +#elif CONFIG_ESP32S2_DATA_CACHE_8KB + { 0x3FFB4000, 0x2000, 2, 0x40024000}, //Block 2, can be use as D cache memory + { 0x3FFB6000, 0x2000, 2, 0x40026000}, //Block 3, can be use as D cache memory +#else + { 0x3FFB6000, 0x2000, 2, 0x40026000}, //Block 3, can be use as D cache memory +#endif +#else +#if CONFIG_ESP32S2_DATA_CACHE_0KB + { 0x3FFB4000, 0x2000, 2, 0x40024000}, //Block 2, can be use as D cache memory + { 0x3FFB6000, 0x2000, 2, 0x40026000}, //Block 3, can be use as D cache memory +#elif CONFIG_ESP32S2_DATA_CACHE_8KB + { 0x3FFB6000, 0x2000, 2, 0x40026000}, //Block 3, can be use as D cache memory +#endif +#endif + { 0x3FFB8000, 0x4000, 2, 0x40028000}, //Block 4, can be remapped to ROM, can be used as trace memory + { 0x3FFBC000, 0x4000, 2, 0x4002C000}, //Block 5, can be remapped to ROM, can be used as trace memory + { 0x3FFC0000, 0x4000, 2, 0x40030000}, //Block 6, can be used as trace memory + { 0x3FFC4000, 0x4000, 2, 0x40034000}, //Block 7, can be used as trace memory + { 0x3FFC8000, 0x4000, 2, 0x40038000}, //Block 8, can be used as trace memory + { 0x3FFCC000, 0x4000, 2, 0x4003C000}, //Block 9, can be used as trace memory + + { 0x3FFD0000, 0x4000, 2, 0x40040000}, //Block 10, can be used as trace memory + { 0x3FFD4000, 0x4000, 2, 0x40044000}, //Block 11, can be used as trace memory + { 0x3FFD8000, 0x4000, 2, 0x40048000}, //Block 12, can be used as trace memory + { 0x3FFDC000, 0x4000, 2, 0x4004C000}, //Block 13, can be used as trace memory + { 0x3FFE0000, 0x4000, 2, 0x40050000}, //Block 14, can be used as trace memory + { 0x3FFE4000, 0x4000, 2, 0x40054000}, //Block 15, can be used as trace memory + { 0x3FFE8000, 0x4000, 2, 0x40058000}, //Block 16, can be used as trace memory + { 0x3FFEC000, 0x4000, 2, 0x4005C000}, //Block 17, can be used as trace memory + { 0x3FFF0000, 0x4000, 2, 0x40060000}, //Block 18, can be used for MAC dump, can be used as trace memory + { 0x3FFF4000, 0x4000, 2, 0x40064000}, //Block 19, can be used for MAC dump, can be used as trace memory + { 0x3FFF8000, 0x4000, 2, 0x40068000}, //Block 20, can be used for MAC dump, can be used as trace memory + { 0x3FFFC000, 0x4000, 1, 0x4006C000}, //Block 21, can be used for MAC dump, can be used as trace memory, used for startup stack +}; + +const size_t soc_memory_region_count = sizeof(soc_memory_regions)/sizeof(soc_memory_region_t); + + +extern int _data_start_xtos; +/* Reserved memory regions + + These are removed from the soc_memory_regions array when heaps are created. + */ +//ROM data region +SOC_RESERVE_MEMORY_REGION(0x3fffc000, (intptr_t)&_data_start_xtos, rom_data_region); + +// TODO: soc_memory_layout: handle trace memory regions - IDF-750 + +#ifdef CONFIG_SPIRAM +SOC_RESERVE_MEMORY_REGION( SOC_EXTRAM_DATA_LOW, SOC_EXTRAM_DATA_HIGH, extram_data_region); //SPI RAM gets added later if needed, in spiram.c; reserve it for now +#if CONFIG_USE_AHB_DBUS3_ACCESS_SPIRAM +SOC_RESERVE_MEMORY_REGION( SOC_SLOW_EXTRAM_DATA_LOW, SOC_SLOW_EXTRAM_DATA_HIGH, extram_slow_data_region); //SPI RAM(Slow) gets added later if needed, in spiram.c; reserve it for now +#endif +#endif + + +#endif diff --git a/components/soc/esp32s2beta/sources.cmake b/components/soc/esp32s2beta/sources.cmake new file mode 100644 index 0000000000..8fcfefd6a2 --- /dev/null +++ b/components/soc/esp32s2beta/sources.cmake @@ -0,0 +1,19 @@ +set(SOC_SRCS "cpu_util.c" + "gpio_periph.c" + "rtc_clk.c" + "rtc_init.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") + +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + set_source_files_properties("esp32s2beta/rtc_clk.c" PROPERTIES + COMPILE_FLAGS "-fno-jump-tables -fno-tree-switch-conversion") +endif() diff --git a/components/soc/esp32s2beta/spi_periph.c b/components/soc/esp32s2beta/spi_periph.c new file mode 100644 index 0000000000..9c8fe230b1 --- /dev/null +++ b/components/soc/esp32s2beta/spi_periph.c @@ -0,0 +1,123 @@ +// 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. + +#include "soc/spi_periph.h" +#include "stddef.h" + +/* + Bunch of constants for every SPI peripheral: GPIO signals, irqs, hw addr of registers etc +*/ +const spi_signal_conn_t spi_periph_signal[4] = { + { + .spiclk_out = SPICLK_OUT_IDX, + .spiclk_in = 0,/* SPI clock is not an input signal*/ + .spid_out = SPID_OUT_IDX, + .spiq_out = SPIQ_OUT_IDX, + .spiwp_out = SPIWP_OUT_IDX, + .spihd_out = SPIHD_OUT_IDX, + .spid_in = SPID_IN_IDX, + .spiq_in = SPIQ_IN_IDX, + .spiwp_in = SPIWP_IN_IDX, + .spihd_in = SPIHD_IN_IDX, + .spics_out = {SPICS0_OUT_IDX, SPICS1_OUT_IDX},/* SPI0/1 do not have CS2 now */ + .spics_in = 0,/* SPI cs is not an input signal*/ + .spiclk_iomux_pin = SPI_IOMUX_PIN_NUM_CLK, + .spid_iomux_pin = SPI_IOMUX_PIN_NUM_MOSI, + .spiq_iomux_pin = SPI_IOMUX_PIN_NUM_MISO, + .spiwp_iomux_pin = SPI_IOMUX_PIN_NUM_WP, + .spihd_iomux_pin = SPI_IOMUX_PIN_NUM_HD, + .spics0_iomux_pin = SPI_IOMUX_PIN_NUM_CS, + .irq = ETS_SPI1_INTR_SOURCE, + .irq_dma = ETS_SPI1_DMA_INTR_SOURCE, + .module = PERIPH_SPI_MODULE, + .hw = (spi_dev_t *) &SPIMEM1, + .func = SPI_FUNC_NUM, + }, { + .spiclk_out = FSPICLK_OUT_MUX_IDX, + .spiclk_in = FSPICLK_IN_IDX, + .spid_out = FSPID_OUT_IDX, + .spiq_out = FSPIQ_OUT_IDX, + .spiwp_out = FSPIWP_OUT_IDX, + .spihd_out = FSPIHD_OUT_IDX, + .spid_in = FSPID_IN_IDX, + .spiq_in = FSPIQ_IN_IDX, + .spiwp_in = FSPIWP_IN_IDX, + .spihd_in = FSPIHD_IN_IDX, + .spics_out = {FSPICS0_OUT_IDX, FSPICS1_OUT_IDX, FSPICS2_OUT_IDX}, + .spics_in = FSPICS0_IN_IDX, + .spiclk_iomux_pin = FSPI_IOMUX_PIN_NUM_CLK, + .spid_iomux_pin = FSPI_IOMUX_PIN_NUM_MOSI, + .spiq_iomux_pin = FSPI_IOMUX_PIN_NUM_MISO, + .spiwp_iomux_pin = FSPI_IOMUX_PIN_NUM_WP, + .spihd_iomux_pin = FSPI_IOMUX_PIN_NUM_HD, + .spics0_iomux_pin = FSPI_IOMUX_PIN_NUM_CS, + .irq = ETS_SPI2_INTR_SOURCE, + .irq_dma = ETS_SPI2_DMA_INTR_SOURCE, + .module = PERIPH_FSPI_MODULE, + .hw = &GPSPI2, + .func = FSPI_FUNC_NUM, + }, { + .spiclk_out = SPI3_CLK_OUT_MUX_IDX, + .spiclk_in = SPI3_CLK_IN_IDX, + .spid_out = SPI3_D_OUT_IDX, + .spiq_out = SPI3_Q_OUT_IDX, + //SPI3 doesn't have wp and hd signals + .spiwp_out = -1, + .spihd_out = -1, + .spid_in = SPI3_D_IN_IDX, + .spiq_in = SPI3_Q_IN_IDX, + .spiwp_in = -1, + .spihd_in = -1, + .spics_out = {SPI3_CS0_OUT_IDX, SPI3_CS1_OUT_IDX, SPI3_CS2_OUT_IDX}, + .spics_in = SPI3_CS0_IN_IDX, + //SPI3 doesn't have iomux pins + .spiclk_iomux_pin = -1, + .spid_iomux_pin = -1, + .spiq_iomux_pin = -1, + .spiwp_iomux_pin = -1, + .spihd_iomux_pin = -1, + .spics0_iomux_pin = -1, + .irq = ETS_SPI3_INTR_SOURCE, + .irq_dma = ETS_SPI3_DMA_INTR_SOURCE, + .module = PERIPH_HSPI_MODULE, + .hw = &GPSPI3, + .func = -1, + }, { + .spiclk_out = SPI4_CLK_OUT_MUX_IDX, + .spiclk_in = SPI4_CLK_IN_IDX, + .spid_out = SPI4_D_OUT_IDX, + .spiq_out = SPI4_Q_OUT_IDX, + //SPI4 doesn't have wp and hd signals + .spiwp_out = -1, + .spihd_out = -1, + .spid_in = SPI4_D_IN_IDX, + .spiq_in = SPI4_Q_IN_IDX, + .spiwp_in = -1, + .spihd_in = -1, + .spics_out = {SPI4_CS0_OUT_IDX, SPI4_CS1_OUT_IDX, SPI4_CS2_OUT_IDX}, + .spics_in = SPI4_CS0_IN_IDX, + //SPI4 doesn't have iomux pins + .spiclk_iomux_pin = -1, + .spid_iomux_pin = -1, + .spiq_iomux_pin = -1, + .spiwp_iomux_pin = -1, + .spihd_iomux_pin = -1, + .spics0_iomux_pin = -1, + .irq = ETS_SPI4_INTR_SOURCE, + .irq_dma = ETS_SPI4_DMA_INTR_SOURCE, + .module = PERIPH_VSPI_MODULE, + .hw = &GPSPI4, + .func = -1, + } +}; diff --git a/components/soc/esp32s2beta/test/test_rtc_clk.c b/components/soc/esp32s2beta/test/test_rtc_clk.c new file mode 100644 index 0000000000..23a9bfe8f4 --- /dev/null +++ b/components/soc/esp32s2beta/test/test_rtc_clk.c @@ -0,0 +1,284 @@ +#include +#include "unity.h" +#include "rom/ets_sys.h" +#include "rom/uart.h" +#include "soc/rtc.h" +#include "soc/rtc_cntl_reg.h" +#include "soc/rtc_io_reg.h" +#include "soc/sens_reg.h" +#include "soc/io_mux_reg.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" +#include "esp_clk.h" + + +#ifdef CONFIG_CHIP_IS_ESP32 +#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)(rtc_cpu_freq_t)) +{ + 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_t cur_freq = rtc_clk_cpu_freq_get(); + int count = 0; + while (ref_clock_get() - t_start < test_duration_sec * 1000000) { + switch_func(RTC_CPU_FREQ_XTAL); + switch_func(cur_freq); + ++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); +} + +TEST_CASE("Test fast switching between PLL and XTAL", "[rtc_clk]") +{ + test_clock_switching(rtc_clk_cpu_freq_set_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_CLOCK_SOURCE_EXTERNAL_CRYSTAL + 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"); +} + +#ifdef CONFIG_SPIRAM +// PSRAM tests run on ESP-WROVER-KIT boards, which have the 32k XTAL installed. +// Other tests may run on DevKitC boards, which don't have a 32k XTAL. +TEST_CASE("Test starting external RTC quartz", "[rtc_clk]") +{ + int i = 0, fail = 0; + uint32_t start_time; + uint32_t end_time; + stop_rtc_external_quartz(); +#ifdef CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL + 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]") +{ + start_freq(RTC_SLOW_FREQ_32K_XTAL, 200); + start_freq(RTC_SLOW_FREQ_32K_XTAL, 0); +} + +#else + +TEST_CASE("Test starting 'External 32kHz XTAL' on the board without it.", "[rtc_clk][ignore]") +{ + 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 // CONFIG_SPIRAM +#endif diff --git a/components/soc/include/hal/spi_types.h b/components/soc/include/hal/spi_types.h index 12ee775e1e..715626a820 100644 --- a/components/soc/include/hal/spi_types.h +++ b/components/soc/include/hal/spi_types.h @@ -1,3 +1,17 @@ +// 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. + #pragma once #include "soc/spi_caps.h" @@ -10,9 +24,19 @@ typedef enum { SPI1_HOST=0, ///< SPI1 SPI2_HOST=1, ///< SPI2 SPI3_HOST=2, ///< SPI3 +#if SOC_SPI_PERIPH_NUM > 3 + SPI4_HOST=3, ///< SPI4 +#endif } spi_host_device_t; //alias for different chips +#ifdef CONFIG_IDF_TARGET_ESP32 #define SPI_HOST SPI1_HOST #define HSPI_HOST SPI2_HOST #define VSPI_HOST SPI3_HOST +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define SPI_HOST SPI1_HOST +#define FSPI_HOST SPI2_HOST +#define HSPI_HOST SPI3_HOST +#define VSPI_HOST SPI4_HOST +#endif diff --git a/components/soc/include/soc/can_periph.h b/components/soc/include/soc/can_periph.h index 91d9582766..c64519fc19 100644 --- a/components/soc/include/soc/can_periph.h +++ b/components/soc/include/soc/can_periph.h @@ -13,4 +13,6 @@ // limitations under the License. #pragma once +#if CONFIG_IDF_TARGET_ESP32 #include "soc/can_struct.h" +#endif diff --git a/components/soc/include/soc/i2s_periph.h b/components/soc/include/soc/i2s_periph.h index 7e4e2ed1a7..0c6e003add 100644 --- a/components/soc/include/soc/i2s_periph.h +++ b/components/soc/include/soc/i2s_periph.h @@ -13,5 +13,36 @@ // limitations under the License. #pragma once +#include "soc/soc.h" +#include "soc/periph_defs.h" #include "soc/i2s_struct.h" #include "soc/i2s_reg.h" +#include "soc/i2s_caps.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + Stores a bunch of per-I2S-peripheral data. +*/ +typedef struct { + const uint8_t o_bck_in_sig; + const uint8_t o_ws_in_sig; + const uint8_t o_bck_out_sig; + const uint8_t o_ws_out_sig; + const uint8_t o_data_out_sig; + const uint8_t i_bck_in_sig; + const uint8_t i_ws_in_sig; + const uint8_t i_bck_out_sig; + const uint8_t i_ws_out_sig; + const uint8_t i_data_in_sig; + const uint8_t irq; + const periph_module_t module; +} i2s_signal_conn_t; + +extern const i2s_signal_conn_t i2s_periph_signal[SOC_I2S_PERIPH_NUM]; + +#ifdef __cplusplus +} +#endif diff --git a/components/soc/include/soc/interrupts.h b/components/soc/include/soc/interrupts.h new file mode 100644 index 0000000000..50295d6262 --- /dev/null +++ b/components/soc/include/soc/interrupts.h @@ -0,0 +1,28 @@ +// Copyright 2018 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once +#include "stdint.h" +#include "soc/soc.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern const char * const esp_isr_names[ETS_MAX_INTR_SOURCE]; + +#ifdef __cplusplus +} +#endif diff --git a/components/soc/include/soc/ledc_periph.h b/components/soc/include/soc/ledc_periph.h index 342e542683..9ddd5f58a5 100644 --- a/components/soc/include/soc/ledc_periph.h +++ b/components/soc/include/soc/ledc_periph.h @@ -15,3 +15,16 @@ #pragma once #include "soc/ledc_reg.h" #include "soc/ledc_struct.h" + +/* + Stores a bunch of per-ledc-peripheral data. +*/ +typedef struct { + const uint8_t sig_out0_idx; +} ledc_signal_conn_t; + +#if CONFIG_IDF_TARGET_ESP32S2BETA +extern const ledc_signal_conn_t ledc_periph_signal[1]; +#elif defined CONFIG_IDF_TARGET_ESP32 +extern const ledc_signal_conn_t ledc_periph_signal[2]; +#endif \ No newline at end of file diff --git a/components/soc/include/soc/lldesc.h b/components/soc/include/soc/lldesc.h index 827e828bfb..8884e89e7d 100644 --- a/components/soc/include/soc/lldesc.h +++ b/components/soc/include/soc/lldesc.h @@ -14,7 +14,13 @@ #pragma once #include +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/lldesc.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/lldesc.h" +#endif //the size field has 12 bits, but 0 not for 4096. //to avoid possible problem when the size is not word-aligned, we only use 4096-4 per desc. diff --git a/components/soc/include/soc/rtc_periph.h b/components/soc/include/soc/rtc_periph.h index aa803e9b81..fedd5e54b2 100644 --- a/components/soc/include/soc/rtc_periph.h +++ b/components/soc/include/soc/rtc_periph.h @@ -57,6 +57,23 @@ typedef struct { */ extern const rtc_gpio_desc_t rtc_gpio_desc[GPIO_PIN_COUNT]; +typedef volatile struct { + uint32_t reserved0: 13; + uint32_t fun_ie: 1; /*input enable in work mode*/ + uint32_t slp_oe: 1; /*output enable in sleep mode*/ + uint32_t slp_ie: 1; /*input enable in sleep mode*/ + uint32_t slp_sel: 1; /*1: enable sleep mode during sleep 0: no sleep mode*/ + uint32_t fun_sel: 2; /*function sel*/ + uint32_t mux_sel: 1; /*1: use RTC GPIO 0: use digital GPIO*/ + uint32_t reserved20: 7; + uint32_t rue: 1; /*RUE*/ + uint32_t rde: 1; /*RDE*/ + uint32_t drv: 2; /*DRV*/ + uint32_t reserved31: 1; +} rtc_gpio_info_t; + +extern rtc_gpio_info_t* rtc_gpio_reg[RTC_GPIO_NUMBER]; + #ifdef __cplusplus } #endif diff --git a/components/soc/include/soc/soc_memory_layout.h b/components/soc/include/soc/soc_memory_layout.h index 15556fcde1..75c8c7daa6 100644 --- a/components/soc/include/soc/soc_memory_layout.h +++ b/components/soc/include/soc/soc_memory_layout.h @@ -160,10 +160,15 @@ inline static bool IRAM_ATTR esp_ptr_executable(const void *p) inline static bool IRAM_ATTR esp_ptr_byte_accessible(const void *p) { + intptr_t ip = (intptr_t) p; bool r; - r = ((intptr_t)p >= SOC_BYTE_ACCESSIBLE_LOW && (intptr_t)p < SOC_BYTE_ACCESSIBLE_HIGH); -#if CONFIG_ESP32_SPIRAM_SUPPORT - r |= ((intptr_t)p >= SOC_EXTRAM_DATA_LOW && (intptr_t)p < SOC_EXTRAM_DATA_HIGH); + r = (ip >= SOC_BYTE_ACCESSIBLE_LOW && ip < SOC_BYTE_ACCESSIBLE_HIGH); +#if CONFIG_SPIRAM +#if CONFIG_SPIRAM_SIZE != -1 // Fixed size, can be more accurate + r |= (ip >= SOC_EXTRAM_DATA_LOW && ip < (SOC_EXTRAM_DATA_LOW + CONFIG_SPIRAM_SIZE)); +#else + r |= (ip >= SOC_EXTRAM_DATA_LOW && ip < (SOC_EXTRAM_DATA_HIGH)); +#endif #endif return r; } @@ -181,7 +186,7 @@ inline static bool IRAM_ATTR esp_ptr_external_ram(const void *p) { } inline static bool IRAM_ATTR esp_ptr_in_iram(const void *p) { -#ifndef CONFIG_FREERTOS_UNICORE +#if !CONFIG_FREERTOS_UNICORE || CONFIG_IDF_TARGET_ESP32S2BETA return ((intptr_t)p >= SOC_IRAM_LOW && (intptr_t)p < SOC_IRAM_HIGH); #else return ((intptr_t)p >= SOC_CACHE_APP_LOW && (intptr_t)p < SOC_IRAM_HIGH); diff --git a/components/soc/include/soc/spi_periph.h b/components/soc/include/soc/spi_periph.h index bbe864eb6f..7748b6fbec 100644 --- a/components/soc/include/soc/spi_periph.h +++ b/components/soc/include/soc/spi_periph.h @@ -16,17 +16,31 @@ #include #include "soc/soc.h" #include "soc/periph_defs.h" + //include soc related (generated) definitions #include "soc/spi_caps.h" #include "soc/spi_reg.h" #include "soc/spi_struct.h" #include "soc/gpio_sig_map.h" +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32S2BETA +#include "soc/spi_mem_struct.h" +#endif #ifdef __cplusplus extern "C" { #endif +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +#define SPI_FREAD_DIO 0 +#define SPI_FREAD_QIO 0 +#define SPI_FWRITE_DIO 0 +#define SPI_FWRITE_QIO 0 +#endif + + + /* Stores a bunch of per-spi-peripheral data. */ @@ -43,6 +57,10 @@ typedef struct { const uint8_t spihd_in; const uint8_t spics_out[3]; // /CS GPIO output mux signals const uint8_t spics_in; + const uint8_t spidqs_out; + const uint8_t spidqs_in; + const uint8_t spicd_out; + const uint8_t spicd_in; const uint8_t spiclk_iomux_pin; //IO pins of IO_MUX muxed signals const uint8_t spid_iomux_pin; const uint8_t spiq_iomux_pin; diff --git a/components/soc/src/hal/spi_hal.c b/components/soc/src/hal/spi_hal.c index bddf983619..6b7b40c36a 100644 --- a/components/soc/src/hal/spi_hal.c +++ b/components/soc/src/hal/spi_hal.c @@ -59,6 +59,7 @@ esp_err_t spi_hal_get_clock_conf(const spi_hal_context_t *hal, int speed_hz, int //But these don't work for full-duplex connections. spi_hal_cal_timing(eff_clk_n, use_gpio, input_delay_ns, &temp_conf.timing_dummy, &temp_conf.timing_miso_delay); +#ifdef CONFIG_IDF_TARGET_ESP32 const int freq_limit = spi_hal_get_freq_limit(use_gpio, input_delay_ns); SPI_HAL_CHECK(hal->half_duplex || temp_conf.timing_dummy == 0 || hal->no_compensate, @@ -67,6 +68,7 @@ Try to use IOMUX pins to increase the frequency limit, or use the half duplex mo Please note the SPI master can only work at divisors of 80MHz, and the driver always tries to find the closest frequency to your configuration.\n\ Specify ``SPI_DEVICE_NO_DUMMY`` to ignore this checking. Then you can output data at higher speed, or read data at your own risk.", ESP_ERR_NOT_SUPPORTED, freq_limit / 1000. / 1000 ); +#endif if (timing_conf) { *timing_conf = temp_conf; diff --git a/components/soc/src/hal/spi_slave_hal.c b/components/soc/src/hal/spi_slave_hal.c index 82e656ca83..3ad0be86fc 100644 --- a/components/soc/src/hal/spi_slave_hal.c +++ b/components/soc/src/hal/spi_slave_hal.c @@ -12,8 +12,8 @@ void spi_slave_hal_init(spi_slave_hal_context_t *hal, int host_id) //Force a transaction done interrupt. This interrupt won't fire yet because we initialized the SPI interrupt as //disabled. This way, we can just enable the SPI interrupt and the interrupt handler will kick in, handling //any transactions that are queued. - spi_ll_enable_int(hal->hw); spi_ll_set_int_stat(hal->hw); + spi_ll_slave_set_int_type(hal->hw, SPI_LL_INT_TYPE_NORMAL); } void spi_slave_hal_setup_device(const spi_slave_hal_context_t *hal) diff --git a/components/soc/src/hal/spi_slave_hal_iram.c b/components/soc/src/hal/spi_slave_hal_iram.c index 1b97d38bab..ce4e46dcc3 100644 --- a/components/soc/src/hal/spi_slave_hal_iram.c +++ b/components/soc/src/hal/spi_slave_hal_iram.c @@ -14,6 +14,7 @@ void spi_slave_hal_user_start(const spi_slave_hal_context_t *hal) void spi_slave_hal_prepare_data(const spi_slave_hal_context_t *hal) { + spi_ll_slave_reset(hal->hw); if (hal->use_dma) { spi_ll_reset_dma(hal->hw); @@ -32,7 +33,6 @@ void spi_slave_hal_prepare_data(const spi_slave_hal_context_t *hal) spi_ll_write_buffer(hal->hw, hal->tx_buffer, hal->bitlen); } } - spi_ll_slave_reset(hal->hw); spi_ll_slave_set_rx_bitlen(hal->hw, hal->bitlen); spi_ll_slave_set_tx_bitlen(hal->hw, hal->bitlen); @@ -53,6 +53,7 @@ void spi_slave_hal_store_result(spi_slave_hal_context_t *hal) //Copy result out spi_ll_read_buffer(hal->hw, hal->rx_buffer, hal->bitlen); } + spi_ll_slave_set_int_type(hal->hw, SPI_LL_INT_TYPE_NORMAL); } uint32_t spi_slave_hal_get_rcv_bitlen(spi_slave_hal_context_t *hal) diff --git a/components/soc/src/memory_layout_utils.c b/components/soc/src/memory_layout_utils.c index 2f4acb5c2e..61414c71e7 100644 --- a/components/soc/src/memory_layout_utils.c +++ b/components/soc/src/memory_layout_utils.c @@ -15,6 +15,7 @@ #include #include "esp_log.h" #include "soc/soc_memory_layout.h" +#include "sdkconfig.h" static const char *TAG = "memory_layout"; @@ -69,8 +70,19 @@ static void s_prepare_reserved_regions(soc_reserved_region_t *reserved, size_t c /* Add the EXTRA_RESERVED_REGIONS at the beginning */ reserved[0].start = (intptr_t)&_data_start; /* DRAM used by data+bss and possibly rodata */ reserved[0].end = (intptr_t)&_heap_start; +#if CONFIG_IDF_TARGET_ESP32 + //ESP32 has a IRAM-only region 0x4008_0000 - 0x4009_FFFF, protect the used part reserved[1].start = (intptr_t)&_iram_start; /* IRAM used by code */ reserved[1].end = (intptr_t)&_iram_end; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + //ESP32S2 has a big D/IRAM region, the part used by code is reserved + //The address of the D/I bus are in the same order, directly shift IRAM address to get reserved DRAM address + const uint32_t i_d_offset = SOC_IRAM_LOW - SOC_DRAM_LOW; + reserved[1].start = (intptr_t)&_iram_start - i_d_offset; /* IRAM used by code */ + reserved[1].end = (intptr_t)&_iram_end - i_d_offset; +#else +# error chip not implemented! +#endif /* Sort by starting address */ qsort(reserved, count, sizeof(soc_reserved_region_t), s_compare_reserved_regions); diff --git a/components/spi_flash/CMakeLists.txt b/components/spi_flash/CMakeLists.txt index 61900d09ba..a3525021f0 100644 --- a/components/spi_flash/CMakeLists.txt +++ b/components/spi_flash/CMakeLists.txt @@ -1,8 +1,13 @@ set(priv_requires bootloader_support soc) if(BOOTLOADER_BUILD) - # Bootloader needs SPIUnlock from this file, but doesn't - # need other parts of this component - set(srcs "spi_flash_rom_patch.c") + if (CONFIG_IDF_TARGET_ESP32) + # ESP32 Bootloader needs SPIUnlock from this file, but doesn't + # need other parts of this component + set(srcs "spi_flash_rom_patch.c") + else() + # but on other platforms no source files are needed for bootloader + set(srcs) + endif() set(cache_srcs "") else() set(cache_srcs @@ -11,23 +16,30 @@ else() "flash_ops.c" ) set(srcs - "partition.c" - "spi_flash_rom_patch.c" - ) + "partition.c") + + if (CONFIG_IDF_TARGET_ESP32) + list(APPEND srcs + "spi_flash_rom_patch.c") + endif() + # New implementation after IDF v4.0 - list(APPEND cache_srcs - "esp_flash_api.c" - "esp_flash_spi_init.c" - "spi_flash_os_func_app.c" - "spi_flash_os_func_noos.c" - ) list(APPEND srcs "spi_flash_chip_drivers.c" "spi_flash_chip_generic.c" "spi_flash_chip_issi.c" - "spi_flash_chip_gd.c" - "memspi_host_driver.c" - ) + "spi_flash_chip_gd.c") + + if (NOT CONFIG_IDF_TARGET_ESP32S2BETA) + # TODO: workaround until ESP32-S2 supports new API, can be always included + list(APPEND srcs + "memspi_host_driver.c") + list(APPEND cache_srcs + "esp_flash_api.c" + "esp_flash_spi_init.c" + "spi_flash_os_func_app.c" + "spi_flash_os_func_noos.c") + endif() list(APPEND srcs ${cache_srcs}) set(priv_requires bootloader_support app_update soc) endif() diff --git a/components/spi_flash/Kconfig b/components/spi_flash/Kconfig index 046146e006..206a6d5694 100644 --- a/components/spi_flash/Kconfig +++ b/components/spi_flash/Kconfig @@ -77,6 +77,15 @@ menu "SPI Flash driver" bool "Allowed" endchoice + # Force the Legacy implementation to be used on ESP32S2Beta + # + # TODO esp32s2beta: Remove once SPI Flash HAL available on S2 Beta + config SPI_FLASH_FORCE_LEGACY_ESP32S2BETA + bool + default y + depends on IDF_TARGET_ESP32S2BETA + select SPI_FLASH_USE_LEGACY_IMPL + config SPI_FLASH_USE_LEGACY_IMPL bool "Use the legacy implementation before IDF v4.0" default n diff --git a/components/spi_flash/cache_utils.c b/components/spi_flash/cache_utils.c index 63603097ce..7e715abcc0 100644 --- a/components/spi_flash/cache_utils.c +++ b/components/spi_flash/cache_utils.c @@ -20,8 +20,13 @@ #include #include #include +#if CONFIG_IDF_TARGET_ESP32 #include #include +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/spi_flash.h" +#include "esp32s2beta/rom/cache.h" +#endif #include #include #include "sdkconfig.h" @@ -31,6 +36,8 @@ #include "esp_spi_flash.h" #include "esp_log.h" +static __attribute__((unused)) const char* TAG = "cache"; + #define DPORT_CACHE_BIT(cpuid, regid) DPORT_ ## cpuid ## regid #define DPORT_CACHE_MASK(cpuid) (DPORT_CACHE_BIT(cpuid, _CACHE_MASK_OPSDRAM) | DPORT_CACHE_BIT(cpuid, _CACHE_MASK_DROM0) | \ @@ -74,7 +81,7 @@ void spi_flash_op_unlock(void) } /* If you're going to modify this, keep in mind that while the flash caches of the pro and app - cpu are separate, the psram cache is *not*. If one of the CPUs returns from a flash routine + cpu are separate, the psram cache is *not*. If one of the CPUs returns from a flash routine with its cache enabled but the other CPUs cache is not enabled yet, you will have problems when accessing psram from the former CPU. */ @@ -145,7 +152,7 @@ void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu(void) } // Kill interrupts that aren't located in IRAM esp_intr_noniram_disable(); - // This CPU executes this routine, with non-IRAM interrupts and the scheduler + // This CPU executes this routine, with non-IRAM interrupts and the scheduler // disabled. The other CPU is spinning in the spi_flash_op_block_func task, also // with non-iram interrupts and the scheduler disabled. None of these CPUs will // touch external RAM or flash this way, so we can safely disable caches. @@ -267,9 +274,9 @@ void IRAM_ATTR spi_flash_enable_interrupts_caches_no_os(void) * function in ROM. They are used to work around a bug where Cache_Read_Disable requires a call to * Cache_Flush before Cache_Read_Enable, even if cached data was not modified. */ - static void IRAM_ATTR spi_flash_disable_cache(uint32_t cpuid, uint32_t* saved_state) { +#if CONFIG_IDF_TARGET_ESP32 uint32_t ret = 0; const uint32_t cache_mask = DPORT_CACHE_GET_MASK(cpuid); if (cpuid == 0) { @@ -278,42 +285,342 @@ static void IRAM_ATTR spi_flash_disable_cache(uint32_t cpuid, uint32_t* saved_st ; } DPORT_SET_PERI_REG_BITS(DPORT_PRO_CACHE_CTRL_REG, 1, 0, DPORT_PRO_CACHE_ENABLE_S); - } else { + } +#if !CONFIG_FREERTOS_UNICORE + else { ret |= DPORT_GET_PERI_REG_BITS2(DPORT_APP_CACHE_CTRL1_REG, cache_mask, 0); while (DPORT_GET_PERI_REG_BITS2(DPORT_APP_DCACHE_DBUG0_REG, DPORT_APP_CACHE_STATE, DPORT_APP_CACHE_STATE_S) != 1) { ; } DPORT_SET_PERI_REG_BITS(DPORT_APP_CACHE_CTRL_REG, 1, 0, DPORT_APP_CACHE_ENABLE_S); } +#endif *saved_state = ret; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + *saved_state = Cache_Suspend_ICache(); + if (!Cache_Drom0_Using_ICache()) { + *(saved_state + 1) = Cache_Suspend_DCache(); + } +#endif } static void IRAM_ATTR spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_state) { +#if CONFIG_IDF_TARGET_ESP32 const uint32_t cache_mask = DPORT_CACHE_GET_MASK(cpuid); if (cpuid == 0) { DPORT_SET_PERI_REG_BITS(DPORT_PRO_CACHE_CTRL_REG, 1, 1, DPORT_PRO_CACHE_ENABLE_S); DPORT_SET_PERI_REG_BITS(DPORT_PRO_CACHE_CTRL1_REG, cache_mask, saved_state, 0); - } else { + } +#if !CONFIG_FREERTOS_UNICORE + else { DPORT_SET_PERI_REG_BITS(DPORT_APP_CACHE_CTRL_REG, 1, 1, DPORT_APP_CACHE_ENABLE_S); DPORT_SET_PERI_REG_BITS(DPORT_APP_CACHE_CTRL1_REG, cache_mask, saved_state, 0); } +#endif +#elif CONFIG_IDF_TARGET_ESP32S2BETA + Cache_Resume_ICache(saved_state); + if (!Cache_Drom0_Using_ICache()) { + Cache_Resume_DCache(s_flash_op_cache_state[1]); + } +#endif } IRAM_ATTR bool spi_flash_cache_enabled(void) { +#if CONFIG_IDF_TARGET_ESP32 bool result = (DPORT_REG_GET_BIT(DPORT_PRO_CACHE_CTRL_REG, DPORT_PRO_CACHE_ENABLE) != 0); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + bool result = (DPORT_REG_GET_BIT(DPORT_PRO_ICACHE_CTRL_REG, DPORT_PRO_ICACHE_ENABLE) != 0); + if (!Cache_Drom0_Using_ICache()) { + result = result && (DPORT_REG_GET_BIT(DPORT_PRO_DCACHE_CTRL_REG, DPORT_PRO_DCACHE_ENABLE) != 0); + } +#endif #if portNUM_PROCESSORS == 2 result = result && (DPORT_REG_GET_BIT(DPORT_APP_CACHE_CTRL_REG, DPORT_APP_CACHE_ENABLE) != 0); #endif return result; } +#if CONFIG_IDF_TARGET_ESP32S2BETA +IRAM_ATTR void esp_config_instruction_cache_mode(void) +{ + cache_size_t cache_size; + cache_ways_t cache_ways; + cache_line_size_t cache_line_size; + +#if CONFIG_ESP32S2_INSTRUCTION_CACHE_8KB + Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_INVALID, CACHE_MEMORY_INVALID, CACHE_MEMORY_INVALID); + cache_size = CACHE_SIZE_8KB; +#else + Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_ICACHE_HIGH, CACHE_MEMORY_INVALID, CACHE_MEMORY_INVALID); + cache_size = CACHE_SIZE_16KB; +#endif +#if CONFIG_ESP32S2_INSTRUCTION_CACHE_4WAYS + cache_ways = CACHE_4WAYS_ASSOC; +#else + cache_ways = CACHE_8WAYS_ASSOC; +#endif +#if CONFIG_ESP32S2_INSTRUCTION_CACHE_LINE_16B + cache_line_size = CACHE_LINE_SIZE_16B; +#elif CONFIG_ESP32S2_INSTRUCTION_CACHE_LINE_32B + cache_line_size = CACHE_LINE_SIZE_32B; +#else + cache_line_size = CACHE_LINE_SIZE_64B; +#endif + ESP_EARLY_LOGI(TAG, "Instruction cache \t: size %dKB, %dWays, cache line size %dByte", cache_size == CACHE_SIZE_8KB ? 8 : 16,cache_ways == CACHE_4WAYS_ASSOC ? 4: 8, cache_line_size == CACHE_LINE_SIZE_16B ? 16 : (cache_line_size == CACHE_LINE_SIZE_32B ? 32 : 64)); + Cache_Suspend_ICache(); + Cache_Set_ICache_Mode(cache_size, cache_ways, cache_line_size); + Cache_Invalidate_ICache_All(); + Cache_Resume_ICache(0); +} + +IRAM_ATTR void esp_config_data_cache_mode(void) +{ + cache_size_t cache_size; + cache_ways_t cache_ways; + cache_line_size_t cache_line_size; + +#if CONFIG_ESP32S2_INSTRUCTION_CACHE_8KB +#if CONFIG_ESP32S2_DATA_CACHE_8KB + Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_DCACHE_LOW, CACHE_MEMORY_INVALID, CACHE_MEMORY_INVALID); + cache_size = CACHE_SIZE_8KB; +#else + Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_DCACHE_LOW, CACHE_MEMORY_DCACHE_HIGH, CACHE_MEMORY_INVALID); + cache_size = CACHE_SIZE_16KB; +#endif +#else +#if CONFIG_ESP32S2_DATA_CACHE_8KB + Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_ICACHE_HIGH, CACHE_MEMORY_DCACHE_LOW, CACHE_MEMORY_INVALID); + cache_size = CACHE_SIZE_8KB; +#else + Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_ICACHE_HIGH, CACHE_MEMORY_DCACHE_LOW, CACHE_MEMORY_DCACHE_HIGH); + cache_size = CACHE_SIZE_16KB; +#endif +#endif + +#if CONFIG_ESP32S2_DATA_CACHE_4WAYS + cache_ways = CACHE_4WAYS_ASSOC; +#else + cache_ways = CACHE_8WAYS_ASSOC; +#endif +#if CONFIG_ESP32S2_DATA_CACHE_LINE_16B + cache_line_size = CACHE_LINE_SIZE_16B; +#elif CONFIG_ESP32S2_DATA_CACHE_LINE_32B + cache_line_size = CACHE_LINE_SIZE_32B; +#else + cache_line_size = CACHE_LINE_SIZE_64B; +#endif + ESP_EARLY_LOGI(TAG, "Data cache \t\t: size %dKB, %dWays, cache line size %dByte", cache_size == CACHE_SIZE_8KB ? 8 : 16, cache_ways == CACHE_4WAYS_ASSOC ? 4: 8, cache_line_size == CACHE_LINE_SIZE_16B ? 16 : (cache_line_size == CACHE_LINE_SIZE_32B ? 32 : 64)); + Cache_Set_DCache_Mode(cache_size, cache_ways, cache_line_size); + Cache_Invalidate_DCache_All(); +} + +void esp_switch_rodata_to_dcache(void) +{ + REG_CLR_BIT(DPORT_PRO_DCACHE_CTRL1_REG, DPORT_PRO_DCACHE_MASK_DROM0); + Cache_Drom0_Source_DCache(); + MMU_Drom_ICache_Unmap(); + REG_SET_BIT(DPORT_PRO_ICACHE_CTRL1_REG, DPORT_PRO_ICACHE_MASK_DROM0); + ESP_EARLY_LOGI(TAG, "Switch rodata load path to data cache."); +} + +static IRAM_ATTR void esp_enable_cache_flash_wrap(bool icache, bool dcache) +{ + uint32_t i_autoload, d_autoload; + if (icache) { + i_autoload = Cache_Suspend_ICache(); + } + if (dcache) { + d_autoload = Cache_Suspend_DCache(); + } + REG_SET_BIT(DPORT_PRO_CACHE_WRAP_AROUND_CTRL_REG, DPORT_PRO_CACHE_FLASH_WRAP_AROUND); + if (icache) { + Cache_Resume_ICache(i_autoload); + } + if (dcache) { + Cache_Resume_DCache(d_autoload); + } +} + +#if CONFIG_ESP32S2_SPIRAM_SUPPORT +static IRAM_ATTR void esp_enable_cache_spiram_wrap(bool icache, bool dcache) +{ + uint32_t i_autoload, d_autoload; + if (icache) { + i_autoload = Cache_Suspend_ICache(); + } + if (dcache) { + d_autoload = Cache_Suspend_DCache(); + } + REG_SET_BIT(DPORT_PRO_CACHE_WRAP_AROUND_CTRL_REG, DPORT_PRO_CACHE_SRAM_RD_WRAP_AROUND); + if (icache) { + Cache_Resume_ICache(i_autoload); + } + if (dcache) { + Cache_Resume_DCache(d_autoload); + } +} +#endif + +esp_err_t esp_enable_cache_wrap(bool icache_wrap_enable, bool dcache_wrap_enable) +{ + int icache_wrap_size = 0, dcache_wrap_size = 0; + int flash_wrap_sizes[2]={-1, -1}, spiram_wrap_sizes[2]={-1, -1}; + int flash_wrap_size = 0, spiram_wrap_size = 0; + int flash_count = 0, spiram_count = 0; + int i; + bool flash_spiram_wrap_together, flash_support_wrap = true, spiram_support_wrap = true; + if (icache_wrap_enable) { +#if CONFIG_ESP32S2_INSTRUCTION_CACHE_LINE_16B + icache_wrap_size = 16; +#elif CONFIG_ESP32S2_INSTRUCTION_CACHE_LINE_32B + icache_wrap_size = 32; +#else + icache_wrap_size = 64; +#endif + } + if (dcache_wrap_enable) { +#if CONFIG_ESP32S2_DATA_CACHE_LINE_16B + dcache_wrap_size = 16; +#elif CONFIG_ESP32S2_DATA_CACHE_LINE_32B + dcache_wrap_size = 32; +#else + dcache_wrap_size = 64; +#endif + } + + uint32_t instruction_use_spiram = 0; + uint32_t rodata_use_spiram = 0; +#if CONFIG_SPIRAM_FETCH_INSTRUCTIONS +extern uint32_t esp_spiram_instruction_access_enabled(); + instruction_use_spiram = esp_spiram_instruction_access_enabled(); +#endif +#if CONFIG_SPIRAM_RODATA +extern uint32_t esp_spiram_rodata_access_enabled(); + rodata_use_spiram = esp_spiram_rodata_access_enabled(); +#endif + + if (instruction_use_spiram) { + spiram_wrap_sizes[0] = icache_wrap_size; + } else { + flash_wrap_sizes[0] = icache_wrap_size; + } + if (rodata_use_spiram) { + if (Cache_Drom0_Using_ICache()) { + spiram_wrap_sizes[0] = icache_wrap_size; + } else { + spiram_wrap_sizes[1] = dcache_wrap_size; + } +#ifdef CONFIG_EXT_RODATA_SUPPORT + spiram_wrap_sizes[1] = dcache_wrap_size; +#endif + } else { + if (Cache_Drom0_Using_ICache()) { + flash_wrap_sizes[0] = icache_wrap_size; + } else { + flash_wrap_sizes[1] = dcache_wrap_size; + } +#ifdef CONFIG_EXT_RODATA_SUPPORT + flash_wrap_sizes[1] = dcache_wrap_size; +#endif + } +#ifdef CONFIG_ESP32S2_SPIRAM_SUPPORT + spiram_wrap_sizes[1] = dcache_wrap_size; +#endif + for (i = 0; i < 2; i++) { + if (flash_wrap_sizes[i] != -1) { + flash_count++; + flash_wrap_size = flash_wrap_sizes[i]; + } + } + for (i = 0; i < 2; i++) { + if (spiram_wrap_sizes[i] != -1) { + spiram_count++; + spiram_wrap_size = spiram_wrap_sizes[i]; + } + } + if (flash_count + spiram_count <= 2) { + flash_spiram_wrap_together = false; + } else { + flash_spiram_wrap_together = true; + } + ESP_EARLY_LOGI(TAG, "flash_count=%d, size=%d, spiram_count=%d, size=%d,together=%d", flash_count, flash_wrap_size, spiram_count, spiram_wrap_size, flash_spiram_wrap_together); + if (flash_count > 1 && flash_wrap_sizes[0] != flash_wrap_sizes[1]) { + ESP_EARLY_LOGW(TAG, "Flash wrap with different length %d and %d, abort wrap.", flash_wrap_sizes[0], flash_wrap_sizes[1]); + if (spiram_wrap_size == 0) { + return ESP_FAIL; + } + if (flash_spiram_wrap_together) { + ESP_EARLY_LOGE(TAG, "Abort spiram wrap because flash wrap length not fixed."); + return ESP_FAIL; + } + } + if (spiram_count > 1 && spiram_wrap_sizes[0] != spiram_wrap_sizes[1]) { + ESP_EARLY_LOGW(TAG, "SPIRAM wrap with different length %d and %d, abort wrap.", spiram_wrap_sizes[0], spiram_wrap_sizes[1]); + if (flash_wrap_size == 0) { + return ESP_FAIL; + } + if (flash_spiram_wrap_together) { + ESP_EARLY_LOGW(TAG, "Abort flash wrap because spiram wrap length not fixed."); + return ESP_FAIL; + } + } + + if (flash_spiram_wrap_together && flash_wrap_size != spiram_wrap_size) { + ESP_EARLY_LOGW(TAG, "SPIRAM has different wrap length with flash, %d and %d, abort wrap.", spiram_wrap_size, flash_wrap_size); + return ESP_FAIL; + } + +extern bool spi_flash_support_wrap_size(uint32_t wrap_size); + if (!spi_flash_support_wrap_size(flash_wrap_size)) { + flash_support_wrap = false; + ESP_EARLY_LOGW(TAG, "Flash do not support wrap size %d.", flash_wrap_size); + } + +#ifdef CONFIG_ESP32S2_SPIRAM_SUPPORT +extern bool psram_support_wrap_size(uint32_t wrap_size); + if (!psram_support_wrap_size(spiram_wrap_size)) { + spiram_support_wrap = false; + ESP_EARLY_LOGW(TAG, "SPIRAM do not support wrap size %d.", spiram_wrap_size); + } +#endif + + if (flash_spiram_wrap_together && !(flash_support_wrap && spiram_support_wrap)) { + ESP_EARLY_LOGW(TAG, "Flash and SPIRAM should support wrap together."); + return ESP_FAIL; + } + +extern esp_err_t spi_flash_enable_wrap(uint32_t wrap_size); + if (flash_support_wrap && flash_wrap_size > 0) { + ESP_EARLY_LOGI(TAG, "Flash wrap enabled."); + spi_flash_enable_wrap(flash_wrap_size); + esp_enable_cache_flash_wrap((flash_wrap_sizes[0] > 0), (flash_wrap_sizes[1] > 0)); + } +#if CONFIG_ESP32S2_SPIRAM_SUPPORT +extern esp_err_t psram_enable_wrap(uint32_t wrap_size); + if (spiram_support_wrap && spiram_wrap_size > 0) { + ESP_EARLY_LOGI(TAG, "SPIRAM wrap enabled."); + psram_enable_wrap(spiram_wrap_size); + esp_enable_cache_spiram_wrap((spiram_wrap_sizes[0] > 0), (spiram_wrap_sizes[1] > 0)); + } +#endif + + return ESP_OK; + +} +#endif + void IRAM_ATTR spi_flash_enable_cache(uint32_t cpuid) { +#if CONFIG_IDF_TARGET_ESP32 uint32_t cache_value = DPORT_CACHE_GET_VAL(cpuid); cache_value &= DPORT_CACHE_GET_MASK(cpuid); // Re-enable cache on this CPU spi_flash_restore_cache(cpuid, cache_value); +#else + spi_flash_restore_cache(0, 0); // TODO cache_value should be non-zero +#endif } + diff --git a/components/spi_flash/cache_utils.h b/components/spi_flash/cache_utils.h index 9b272009ff..e57494c5af 100644 --- a/components/spi_flash/cache_utils.h +++ b/components/spi_flash/cache_utils.h @@ -15,6 +15,8 @@ #ifndef ESP_SPI_FLASH_CACHE_UTILS_H #define ESP_SPI_FLASH_CACHE_UTILS_H +#include + /** * This header file contains declarations of cache manipulation functions * used both in flash_ops.c and flash_mmap.c. @@ -54,4 +56,12 @@ void spi_flash_enable_interrupts_caches_no_os(void); // Returns true if cache was flushed, false otherwise bool spi_flash_check_and_flush_cache(uint32_t start_addr, uint32_t length); +//config cache mode +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +void esp_config_instruction_cache_mode(void); +void esp_config_data_cache_mode(void); +void esp_switch_rodata_to_dcache(void); +#endif + + #endif //ESP_SPI_FLASH_CACHE_UTILS_H diff --git a/components/spi_flash/component.mk b/components/spi_flash/component.mk index 64ab7548d7..74bcce42c8 100644 --- a/components/spi_flash/component.mk +++ b/components/spi_flash/component.mk @@ -1,4 +1,6 @@ COMPONENT_ADD_INCLUDEDIRS := include + +COMPONENT_SRCDIRS := . $(IDF_TARGET) COMPONENT_PRIV_INCLUDEDIRS := private_include COMPONENT_ADD_LDFRAGMENTS += linker.lf diff --git a/components/spi_flash/esp32/flash_ops_esp32.c b/components/spi_flash/esp32/flash_ops_esp32.c new file mode 100644 index 0000000000..77c90c95c0 --- /dev/null +++ b/components/spi_flash/esp32/flash_ops_esp32.c @@ -0,0 +1,86 @@ +// Copyright 2018 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#include +#include "esp_spi_flash.h" +#include "esp32/rom/spi_flash.h" +#include "esp32/rom/cache.h" + +static inline void IRAM_ATTR spi_flash_guard_start(void) +{ + const spi_flash_guard_funcs_t *ops = spi_flash_guard_get(); + if (ops && ops->start) { + ops->start(); + } +} + +static inline void IRAM_ATTR spi_flash_guard_end(void) +{ + const spi_flash_guard_funcs_t *ops = spi_flash_guard_get(); + if (ops && ops->end) { + ops->end(); + } +} + +esp_rom_spiflash_result_t IRAM_ATTR spi_flash_write_encrypted_chip(size_t dest_addr, const void *src, size_t size) +{ + const uint8_t *ssrc = (const uint8_t *)src; + esp_rom_spiflash_result_t rc; + rc = esp_rom_spiflash_unlock(); + if (rc != ESP_ROM_SPIFLASH_RESULT_OK) { + return rc; + } + /* esp_rom_spiflash_write_encrypted encrypts data in RAM as it writes, + so copy to a temporary buffer - 32 bytes at a time. + + Each call to esp_rom_spiflash_write_encrypted takes a 32 byte "row" of + data to encrypt, and each row is two 16 byte AES blocks + that share a key (as derived from flash address). + */ + uint8_t encrypt_buf[32] __attribute__((aligned(4))); + uint32_t row_size; + for (size_t i = 0; i < size; i += row_size) { + uint32_t row_addr = dest_addr + i; + if (i == 0 && (row_addr % 32) != 0) { + /* writing to second block of a 32 byte row */ + row_size = 16; + row_addr -= 16; + /* copy to second block in buffer */ + memcpy(encrypt_buf + 16, ssrc + i, 16); + /* decrypt the first block from flash, will reencrypt to same bytes */ + spi_flash_read_encrypted(row_addr, encrypt_buf, 16); + } else if (size - i == 16) { + /* 16 bytes left, is first block of a 32 byte row */ + row_size = 16; + /* copy to first block in buffer */ + memcpy(encrypt_buf, ssrc + i, 16); + /* decrypt the second block from flash, will reencrypt to same bytes */ + spi_flash_read_encrypted(row_addr + 16, encrypt_buf + 16, 16); + } else { + /* Writing a full 32 byte row (2 blocks) */ + row_size = 32; + memcpy(encrypt_buf, ssrc + i, 32); + } + + spi_flash_guard_start(); + rc = esp_rom_spiflash_write_encrypted(row_addr, (uint32_t *)encrypt_buf, 32); + spi_flash_guard_end(); + if (rc != ESP_ROM_SPIFLASH_RESULT_OK) { + break; + } + } + bzero(encrypt_buf, sizeof(encrypt_buf)); + + return rc; +} + diff --git a/components/spi_flash/esp32s2beta/flash_ops_esp32s2beta.c b/components/spi_flash/esp32s2beta/flash_ops_esp32s2beta.c new file mode 100644 index 0000000000..6241f399d2 --- /dev/null +++ b/components/spi_flash/esp32s2beta/flash_ops_esp32s2beta.c @@ -0,0 +1,136 @@ +// Copyright 2018 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include "esp_spi_flash.h" +#include "esp_spi_flash_chip.h" +#include "cache_utils.h" +#include "soc/system_reg.h" +#include "soc/soc_memory_layout.h" +#include "esp32s2beta/rom/spi_flash.h" +#include "esp32s2beta/rom/cache.h" + +esp_rom_spiflash_result_t IRAM_ATTR spi_flash_write_encrypted_chip(size_t dest_addr, const void *src, size_t size) +{ + const spi_flash_guard_funcs_t *ops = spi_flash_guard_get(); + esp_rom_spiflash_result_t rc; + + if (!esp_ptr_internal(src)) { + uint8_t block[128]; // Need to buffer in RAM as we write + while (size > 0) { + size_t next_block = MIN(size, sizeof(block)); + memcpy(block, src, next_block); + + esp_rom_spiflash_result_t r = spi_flash_write_encrypted_chip(dest_addr, block, next_block); + if (r != ESP_ROM_SPIFLASH_RESULT_OK) { + return r; + } + + size -= next_block; + dest_addr += next_block; + src = ((uint8_t *)src) + next_block; + } + bzero(block, sizeof(block)); + + return ESP_ROM_SPIFLASH_RESULT_OK; + } + else { // Already in internal memory + rc = spi_flash_unlock(); + if (rc != ESP_ROM_SPIFLASH_RESULT_OK) { + return rc; + } + + if (ops && ops->start) { + ops->start(); + } + rc = SPI_Encrypt_Write(dest_addr, src, size); + if (ops && ops->end) { + ops->end(); + } + return rc; + } +} + +#define SPICACHE SPIMEM0 +#define SPIFLASH SPIMEM1 +#define FLASH_WRAP_CMD 0x77 +esp_err_t spi_flash_wrap_set(spi_flash_wrap_mode_t mode) +{ + uint32_t reg_bkp_ctrl = SPIFLASH.ctrl.val; + uint32_t reg_bkp_usr = SPIFLASH.user.val; + SPIFLASH.user.fwrite_dio = 0; + SPIFLASH.user.fwrite_dual = 0; + SPIFLASH.user.fwrite_qio = 1; + SPIFLASH.user.fwrite_quad = 0; + SPIFLASH.ctrl.fcmd_dual = 0; + SPIFLASH.ctrl.fcmd_quad = 0; + SPIFLASH.user.usr_dummy = 0; + SPIFLASH.user.usr_addr = 1; + SPIFLASH.user.usr_command = 1; + SPIFLASH.user2.usr_command_bitlen = 7; + SPIFLASH.user2.usr_command_value = FLASH_WRAP_CMD; + SPIFLASH.user1.usr_addr_bitlen = 23; + SPIFLASH.addr = 0; + SPIFLASH.user.usr_miso = 0; + SPIFLASH.user.usr_mosi = 1; + SPIFLASH.mosi_dlen.usr_mosi_bit_len = 7; + SPIFLASH.data_buf[0] = (uint32_t) mode << 4;; + SPIFLASH.cmd.usr = 1; + while(SPIFLASH.cmd.usr != 0) + { } + + SPIFLASH.ctrl.val = reg_bkp_ctrl; + SPIFLASH.user.val = reg_bkp_usr; + return ESP_OK; +} + +esp_err_t spi_flash_enable_wrap(uint32_t wrap_size) +{ + switch(wrap_size) { + case 8: + return spi_flash_wrap_set(FLASH_WRAP_MODE_8B); + case 16: + return spi_flash_wrap_set(FLASH_WRAP_MODE_16B); + case 32: + return spi_flash_wrap_set(FLASH_WRAP_MODE_32B); + case 64: + return spi_flash_wrap_set(FLASH_WRAP_MODE_64B); + default: + return ESP_FAIL; + } +} + +void spi_flash_disable_wrap() +{ + spi_flash_wrap_set(FLASH_WRAP_MODE_DISABLE); +} + +bool spi_flash_support_wrap_size(uint32_t wrap_size) +{ + if (!REG_GET_BIT(SPI_MEM_CTRL_REG(0), SPI_MEM_FREAD_QIO) || !REG_GET_BIT(SPI_MEM_CTRL_REG(0), SPI_MEM_FASTRD_MODE)){ + return ESP_FAIL; + } + switch(wrap_size) { + case 0: + case 8: + case 16: + case 32: + case 64: + return true; + default: + return false; + } +} diff --git a/components/spi_flash/flash_mmap.c b/components/spi_flash/flash_mmap.c index 4af8012924..f2ede57daa 100644 --- a/components/spi_flash/flash_mmap.c +++ b/components/spi_flash/flash_mmap.c @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include #include #include @@ -32,7 +30,15 @@ #include "esp_flash_encrypt.h" #include "esp_log.h" #include "cache_utils.h" +#if CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/spi_flash.h" +#include "esp32/rom/cache.h" #include "esp32/spiram.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/spi_flash.h" +#include "esp32s2beta/rom/cache.h" +#include "esp32s2beta/spiram.h" +#endif #ifndef NDEBUG // Enable built-in checks in queue.h in debug builds @@ -40,13 +46,35 @@ #endif #include "sys/queue.h" -#define REGIONS_COUNT 4 #define PAGES_PER_REGION 64 -#define INVALID_ENTRY_VAL 0x100 -#define VADDR0_START_ADDR 0x3F400000 +#ifdef CONFIG_IDF_TARGET_ESP32 +#define REGIONS_COUNT 4 +#define IROM0_PAGES_START 64 +#define IROM0_PAGES_END 256 +#define DROM0_PAGES_START 0 +#define DROM0_PAGES_END 64 + +#define PAGE_IN_FLASH(page) (page) + +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define REGIONS_COUNT 8 +#define IROM0_PAGES_START (PRO_CACHE_IBUS0_MMU_START / sizeof(uint32_t)) +#define IROM0_PAGES_END (PRO_CACHE_IBUS2_MMU_END / sizeof(uint32_t)) +#define DROM0_PAGES_START (Cache_Drom0_Using_ICache()? PRO_CACHE_IBUS3_MMU_START / sizeof(uint32_t) : PRO_CACHE_DBUS3_MMU_START /sizeof(uint32_t)) +#define DROM0_PAGES_END (Cache_Drom0_Using_ICache()? PRO_CACHE_IBUS3_MMU_END / sizeof(uint32_t) : PRO_CACHE_DBUS3_MMU_END / sizeof(uint32_t)) + +#define PAGE_IN_FLASH(page) ((page) | DPORT_MMU_ACCESS_FLASH) + +#endif +#define MMU_ADDR_MASK DPORT_MMU_ADDRESS_MASK +#define IROM0_PAGES_NUM (IROM0_PAGES_END - IROM0_PAGES_START) +#define DROM0_PAGES_NUM (DROM0_PAGES_END - DROM0_PAGES_START) +#define PAGES_LIMIT (IROM0_PAGES_END > DROM0_PAGES_END ? IROM0_PAGES_END:DROM0_PAGES_END) +#define INVALID_ENTRY_VAL DPORT_FLASH_MMU_TABLE_INVALID_VAL +#define VADDR0_START_ADDR SOC_DROM_LOW #define VADDR1_START_ADDR 0x40000000 -#define VADDR1_FIRST_USABLE_ADDR 0x400D0000 -#define PRO_IRAM0_FIRST_USABLE_PAGE ((VADDR1_FIRST_USABLE_ADDR - VADDR1_START_ADDR) / SPI_FLASH_MMU_PAGE_SIZE + 64) +#define VADDR1_FIRST_USABLE_ADDR SOC_IROM_LOW +#define PRO_IRAM0_FIRST_USABLE_PAGE ((VADDR1_FIRST_USABLE_ADDR - VADDR1_START_ADDR) / SPI_FLASH_MMU_PAGE_SIZE + IROM0_PAGES_START) typedef struct mmap_entry_{ uint32_t handle; @@ -64,12 +92,13 @@ static uint32_t s_mmap_last_handle = 0; static void IRAM_ATTR spi_flash_mmap_init(void) { - if (s_mmap_page_refcnt[0] != 0) { + if (s_mmap_page_refcnt[DROM0_PAGES_START] != 0) { return; /* mmap data already initialised */ } DPORT_INTERRUPT_DISABLE(); for (int i = 0; i < REGIONS_COUNT * PAGES_PER_REGION; ++i) { uint32_t entry_pro = DPORT_SEQUENCE_REG_READ((uint32_t)&DPORT_PRO_FLASH_MMU_TABLE[i]); +#if !CONFIG_FREERTOS_UNICORE uint32_t entry_app = DPORT_SEQUENCE_REG_READ((uint32_t)&DPORT_APP_FLASH_MMU_TABLE[i]); if (entry_pro != entry_app) { @@ -77,11 +106,14 @@ static void IRAM_ATTR spi_flash_mmap_init(void) entry_pro = DPORT_FLASH_MMU_TABLE_INVALID_VAL; DPORT_PRO_FLASH_MMU_TABLE[i] = DPORT_FLASH_MMU_TABLE_INVALID_VAL; } - if ((entry_pro & INVALID_ENTRY_VAL) == 0 && (i == 0 || i == PRO_IRAM0_FIRST_USABLE_PAGE || entry_pro != 0)) { +#endif + if ((entry_pro & INVALID_ENTRY_VAL) == 0 && (i == DROM0_PAGES_START || i == PRO_IRAM0_FIRST_USABLE_PAGE || entry_pro != 0)) { s_mmap_page_refcnt[i] = 1; } else { DPORT_PRO_FLASH_MMU_TABLE[i] = DPORT_FLASH_MMU_TABLE_INVALID_VAL; +#if !CONFIG_FREERTOS_UNICORE DPORT_APP_FLASH_MMU_TABLE[i] = DPORT_FLASH_MMU_TABLE_INVALID_VAL; +#endif } } DPORT_INTERRUPT_RESTORE(); @@ -91,13 +123,13 @@ static void IRAM_ATTR get_mmu_region(spi_flash_mmap_memory_t memory, int* out_be { if (memory == SPI_FLASH_MMAP_DATA) { // Vaddr0 - *out_begin = 0; - *out_size = 64; + *out_begin = DROM0_PAGES_START; + *out_size = DROM0_PAGES_NUM; *region_addr = VADDR0_START_ADDR; } else { // only part of VAddr1 is usable, so adjust for that *out_begin = PRO_IRAM0_FIRST_USABLE_PAGE; - *out_size = 3 * 64 - *out_begin; + *out_size = IROM0_PAGES_END - *out_begin; *region_addr = VADDR1_FIRST_USABLE_ADDR; } } @@ -121,7 +153,7 @@ esp_err_t IRAM_ATTR spi_flash_mmap(size_t src_addr, size_t size, spi_flash_mmap_ return ESP_ERR_NO_MEM; } for (int i = 0; i < page_count; i++) { - pages[i] = phys_page+i; + pages[i] = (phys_page+i); } ret = spi_flash_mmap_pages(pages, page_count, memory, out_ptr, out_handle); free(pages); @@ -174,7 +206,7 @@ esp_err_t IRAM_ATTR spi_flash_mmap_pages(const int *pages, size_t page_count, sp for (pos = start; pos < start + page_count; ++pos, ++pageno) { int table_val = (int) DPORT_SEQUENCE_REG_READ((uint32_t)&DPORT_PRO_FLASH_MMU_TABLE[pos]); uint8_t refcnt = s_mmap_page_refcnt[pos]; - if (refcnt != 0 && table_val != pages[pageno]) { + if (refcnt != 0 && table_val != PAGE_IN_FLASH(pages[pageno])) { break; } } @@ -196,14 +228,29 @@ esp_err_t IRAM_ATTR spi_flash_mmap_pages(const int *pages, size_t page_count, sp for (int i = start; i != start + page_count; ++i, ++pageno) { // sanity check: we won't reconfigure entries with non-zero reference count uint32_t entry_pro = DPORT_SEQUENCE_REG_READ((uint32_t)&DPORT_PRO_FLASH_MMU_TABLE[i]); +#if !CONFIG_FREERTOS_UNICORE uint32_t entry_app = DPORT_SEQUENCE_REG_READ((uint32_t)&DPORT_APP_FLASH_MMU_TABLE[i]); +#endif assert(s_mmap_page_refcnt[i] == 0 || - (entry_pro == pages[pageno] && - entry_app == pages[pageno])); + (entry_pro == PAGE_IN_FLASH(pages[pageno]) +#if !CONFIG_FREERTOS_UNICORE + && entry_app == PAGE_IN_FLASH(pages[pageno]) +#endif + )); if (s_mmap_page_refcnt[i] == 0) { - if (entry_pro != pages[pageno] || entry_app != pages[pageno]) { - DPORT_PRO_FLASH_MMU_TABLE[i] = pages[pageno]; + if (entry_pro != PAGE_IN_FLASH(pages[pageno]) +#if !CONFIG_FREERTOS_UNICORE + || entry_app != PAGE_IN_FLASH(pages[pageno]) +#endif + ) { + DPORT_PRO_FLASH_MMU_TABLE[i] = PAGE_IN_FLASH(pages[pageno]); +#if !CONFIG_FREERTOS_UNICORE DPORT_APP_FLASH_MMU_TABLE[i] = pages[pageno]; +#endif + +#if CONFIG_IDF_TARGET_ESP32S2BETA + Cache_Invalidate_Addr(region_addr + (i - region_begin) * SPI_FLASH_MMU_PAGE_SIZE, SPI_FLASH_MMU_PAGE_SIZE); +#endif need_flush = true; } } @@ -226,11 +273,15 @@ esp_err_t IRAM_ATTR spi_flash_mmap_pages(const int *pages, size_t page_count, sp entire cache. */ if (need_flush) { -#if CONFIG_ESP32_SPIRAM_SUPPORT +#if CONFIG_IDF_TARGET_ESP32 +# if CONFIG_SPIRAM esp_spiram_writeback_cache(); -#endif +# endif Cache_Flush(0); +# if !CONFIG_FREERTOS_UNICORE Cache_Flush(1); +# endif +#endif } spi_flash_enable_interrupts_caches_and_other_cpu(); @@ -254,7 +305,9 @@ void IRAM_ATTR spi_flash_munmap(spi_flash_mmap_handle_t handle) assert(s_mmap_page_refcnt[i] > 0); if (--s_mmap_page_refcnt[i] == 0) { DPORT_PRO_FLASH_MMU_TABLE[i] = INVALID_ENTRY_VAL; +#if !CONFIG_FREERTOS_UNICORE DPORT_APP_FLASH_MMU_TABLE[i] = INVALID_ENTRY_VAL; +#endif } } LIST_REMOVE(it, entries); @@ -327,16 +380,15 @@ uint32_t spi_flash_cache2phys(const void *cached) if (c >= VADDR1_START_ADDR && c < VADDR1_FIRST_USABLE_ADDR) { /* IRAM address, doesn't map to flash */ return SPI_FLASH_CACHE2PHYS_FAIL; - } - else if (c < VADDR1_FIRST_USABLE_ADDR) { + } else if (c < VADDR1_FIRST_USABLE_ADDR) { /* expect cache is in DROM */ - cache_page = (c - VADDR0_START_ADDR) / SPI_FLASH_MMU_PAGE_SIZE; + cache_page = (c - VADDR0_START_ADDR) / SPI_FLASH_MMU_PAGE_SIZE + DROM0_PAGES_START; } else { /* expect cache is in IROM */ - cache_page = (c - VADDR1_START_ADDR) / SPI_FLASH_MMU_PAGE_SIZE + 64; + cache_page = (c - VADDR1_START_ADDR) / SPI_FLASH_MMU_PAGE_SIZE + IROM0_PAGES_START; } - if (cache_page >= 256) { + if (cache_page >= PAGES_LIMIT) { /* cached address was not in IROM or DROM */ return SPI_FLASH_CACHE2PHYS_FAIL; } @@ -345,7 +397,7 @@ uint32_t spi_flash_cache2phys(const void *cached) /* page is not mapped */ return SPI_FLASH_CACHE2PHYS_FAIL; } - uint32_t phys_offs = phys_page * SPI_FLASH_MMU_PAGE_SIZE; + uint32_t phys_offs = (phys_page & MMU_ADDR_MASK)* SPI_FLASH_MMU_PAGE_SIZE; return phys_offs | (c & (SPI_FLASH_MMU_PAGE_SIZE-1)); } @@ -356,20 +408,20 @@ const void *IRAM_ATTR spi_flash_phys2cache(uint32_t phys_offs, spi_flash_mmap_me intptr_t base; if (memory == SPI_FLASH_MMAP_DATA) { - start = 0; - end = 64; + start = DROM0_PAGES_START; + end = DROM0_PAGES_END; base = VADDR0_START_ADDR; - page_delta = 0; + page_delta = DROM0_PAGES_START > IROM0_PAGES_START ? DROM0_PAGES_START : 0; } else { start = PRO_IRAM0_FIRST_USABLE_PAGE; - end = 256; + end = IROM0_PAGES_END; base = VADDR1_START_ADDR; - page_delta = 64; + page_delta = DROM0_PAGES_START > IROM0_PAGES_START ? 0: IROM0_PAGES_START; } spi_flash_disable_interrupts_caches_and_other_cpu(); DPORT_INTERRUPT_DISABLE(); for (int i = start; i < end; i++) { - if (DPORT_SEQUENCE_REG_READ((uint32_t)&DPORT_PRO_FLASH_MMU_TABLE[i]) == phys_page) { + if (DPORT_SEQUENCE_REG_READ((uint32_t)&DPORT_PRO_FLASH_MMU_TABLE[i]) == PAGE_IN_FLASH(phys_page)) { i -= page_delta; intptr_t cache_page = base + (SPI_FLASH_MMU_PAGE_SIZE * i); DPORT_INTERRUPT_RESTORE(); @@ -382,22 +434,31 @@ const void *IRAM_ATTR spi_flash_phys2cache(uint32_t phys_offs, spi_flash_mmap_me return NULL; } -static bool IRAM_ATTR is_page_mapped_in_cache(uint32_t phys_page) +static bool IRAM_ATTR is_page_mapped_in_cache(uint32_t phys_page, const void **out_ptr) { int start[2], end[2]; + *out_ptr = NULL; + /* SPI_FLASH_MMAP_DATA */ - start[0] = 0; - end[0] = 64; + start[0] = DROM0_PAGES_START; + end[0] = DROM0_PAGES_END; /* SPI_FLASH_MMAP_INST */ start[1] = PRO_IRAM0_FIRST_USABLE_PAGE; - end[1] = 256; + end[1] = IROM0_PAGES_END; DPORT_INTERRUPT_DISABLE(); for (int j = 0; j < 2; j++) { for (int i = start[j]; i < end[j]; i++) { - if (DPORT_SEQUENCE_REG_READ((uint32_t)&DPORT_PRO_FLASH_MMU_TABLE[i]) == phys_page) { + if (DPORT_SEQUENCE_REG_READ((uint32_t)&DPORT_PRO_FLASH_MMU_TABLE[i]) == PAGE_IN_FLASH(phys_page)) { +#if CONFIG_IDF_TARGET_ESP32S2BETA + if (j == 0) { /* SPI_FLASH_MMAP_DATA */ + *out_ptr = (const void *)(VADDR0_START_ADDR + SPI_FLASH_MMU_PAGE_SIZE * (i - start[0])); + } else { /* SPI_FLASH_MMAP_INST */ + *out_ptr = (const void *)(VADDR1_FIRST_USABLE_ADDR + SPI_FLASH_MMU_PAGE_SIZE * (i - start[1])); + } +#endif DPORT_INTERRUPT_RESTORE(); return true; } @@ -410,6 +471,7 @@ static bool IRAM_ATTR is_page_mapped_in_cache(uint32_t phys_page) /* Validates if given flash address has corresponding cache mapping, if yes, flushes cache memories */ IRAM_ATTR bool spi_flash_check_and_flush_cache(size_t start_addr, size_t length) { + bool ret = false; /* align start_addr & length to full MMU pages */ uint32_t page_start_addr = start_addr & ~(SPI_FLASH_MMU_PAGE_SIZE-1); length += (start_addr - page_start_addr); @@ -420,8 +482,10 @@ IRAM_ATTR bool spi_flash_check_and_flush_cache(size_t start_addr, size_t length) return false; /* invalid address */ } - if (is_page_mapped_in_cache(page)) { -#if CONFIG_ESP32_SPIRAM_SUPPORT + const void *vaddr = NULL; + if (is_page_mapped_in_cache(page, &vaddr)) { +#if CONFIG_IDF_TARGET_ESP32 +#if CONFIG_SPIRAM esp_spiram_writeback_cache(); #endif Cache_Flush(0); @@ -429,7 +493,14 @@ IRAM_ATTR bool spi_flash_check_and_flush_cache(size_t start_addr, size_t length) Cache_Flush(1); #endif return true; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if (vaddr != NULL) { + Cache_Invalidate_Addr((uint32_t)vaddr, SPI_FLASH_MMU_PAGE_SIZE); + ret = true; + } +#endif + } } - return false; + return ret; } diff --git a/components/spi_flash/flash_ops.c b/components/spi_flash/flash_ops.c index 6e61da87de..fdf145c4f8 100644 --- a/components/spi_flash/flash_ops.c +++ b/components/spi_flash/flash_ops.c @@ -31,7 +31,13 @@ #include "esp_attr.h" #include "esp_spi_flash.h" #include "esp_log.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/clk.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/clk.h" +#include "soc/spi_mem_reg.h" +#include "soc/spi_mem_struct.h" +#endif #include "esp_flash_partitions.h" #include "cache_utils.h" #include "esp_flash.h" @@ -705,3 +711,80 @@ void spi_flash_dump_counters(void) } #endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS + +#if CONFIG_IDF_TARGET_ESP32S2BETA +#define SPICACHE SPIMEM0 +#define SPIFLASH SPIMEM1 +#define FLASH_WRAP_CMD 0x77 +esp_err_t spi_flash_wrap_set(spi_flash_wrap_mode_t mode) +{ + uint32_t reg_bkp_ctrl = SPIFLASH.ctrl.val; + uint32_t reg_bkp_usr = SPIFLASH.user.val; + SPIFLASH.user.fwrite_dio = 0; + SPIFLASH.user.fwrite_dual = 0; + SPIFLASH.user.fwrite_qio = 1; + SPIFLASH.user.fwrite_quad = 0; + SPIFLASH.ctrl.fcmd_dual = 0; + SPIFLASH.ctrl.fcmd_quad = 0; + SPIFLASH.user.usr_dummy = 0; + SPIFLASH.user.usr_addr = 1; + SPIFLASH.user.usr_command = 1; + SPIFLASH.user2.usr_command_bitlen = 7; + SPIFLASH.user2.usr_command_value = FLASH_WRAP_CMD; + SPIFLASH.user1.usr_addr_bitlen = 23; + SPIFLASH.addr = 0; + SPIFLASH.user.usr_miso = 0; + SPIFLASH.user.usr_mosi = 1; + SPIFLASH.mosi_dlen.usr_mosi_bit_len = 7; + SPIFLASH.data_buf[0] = (uint32_t) mode << 4;; + SPIFLASH.cmd.usr = 1; + while(SPIFLASH.cmd.usr != 0) + { } + + SPIFLASH.ctrl.val = reg_bkp_ctrl; + SPIFLASH.user.val = reg_bkp_usr; + return ESP_OK; +} + +esp_err_t spi_flash_enable_wrap(uint32_t wrap_size) +{ + switch(wrap_size) { + case 8: + return spi_flash_wrap_set(FLASH_WRAP_MODE_8B); + case 16: + return spi_flash_wrap_set(FLASH_WRAP_MODE_16B); + case 32: + return spi_flash_wrap_set(FLASH_WRAP_MODE_32B); + case 64: + return spi_flash_wrap_set(FLASH_WRAP_MODE_64B); + default: + return ESP_FAIL; + } +} + +void spi_flash_disable_wrap(void) +{ + spi_flash_wrap_set(FLASH_WRAP_MODE_DISABLE); +} + +bool spi_flash_support_wrap_size(uint32_t wrap_size) +{ + if (!REG_GET_BIT(SPI_MEM_CTRL_REG(0), SPI_MEM_FREAD_QIO) || !REG_GET_BIT(SPI_MEM_CTRL_REG(0), SPI_MEM_FASTRD_MODE)){ + return ESP_FAIL; + } + switch(wrap_size) { + case 0: + case 8: + case 16: + case 32: + case 64: + return true; + default: + return false; + } +} +#endif +#if defined(CONFIG_SPI_FLASH_USE_LEGACY_IMPL) && defined(CONFIG_IDF_TARGET_ESP32S2BETA) +// TODO esp32s2beta: Remove once ESP32S2Beta has new SPI Flash API support +esp_flash_t *esp_flash_default_chip = NULL; +#endif diff --git a/components/spi_flash/include/esp_spi_flash.h b/components/spi_flash/include/esp_spi_flash.h index 5966f0ecc1..9e8b19e869 100644 --- a/components/spi_flash/include/esp_spi_flash.h +++ b/components/spi_flash/include/esp_spi_flash.h @@ -32,6 +32,24 @@ extern "C" { #define SPI_FLASH_MMU_PAGE_SIZE 0x10000 /**< Flash cache MMU mapping page size */ +typedef enum { + FLASH_WRAP_MODE_8B = 0, + FLASH_WRAP_MODE_16B = 2, + FLASH_WRAP_MODE_32B = 4, + FLASH_WRAP_MODE_64B = 6, + FLASH_WRAP_MODE_DISABLE = 1 +} spi_flash_wrap_mode_t; + +/** + * @brief set wrap mode of flash + * + * @param mode: wrap mode support disable, 16 32, 64 byte + * + * @return esp_err_t : ESP_OK for successful. + * + */ +esp_err_t spi_flash_wrap_set(spi_flash_wrap_mode_t mode); + /** * @brief Initialize SPI flash access driver * @@ -55,7 +73,7 @@ size_t spi_flash_get_chip_size(void); /** * @brief Erase the Flash sector. * - * @param sector Sector number, the count starts at sector 0, 4KB per sector. + * @param sector: Sector number, the count starts at sector 0, 4KB per sector. * * @return esp_err_t */ diff --git a/components/spi_flash/sim/Makefile.files b/components/spi_flash/sim/Makefile.files index 88babdaa36..f66a58c678 100644 --- a/components/spi_flash/sim/Makefile.files +++ b/components/spi_flash/sim/Makefile.files @@ -5,10 +5,12 @@ SOURCE_FILES := \ $(addprefix ../, \ partition.c \ flash_ops.c \ + esp32/flash_ops_esp32.c \ ) \ INCLUDE_DIRS := \ . \ + ../ \ ../include \ ../private_include \ $(addprefix stubs/, \ diff --git a/components/spi_flash/spi_flash_os_func_app.c b/components/spi_flash/spi_flash_os_func_app.c index ad97c433c5..655d129404 100644 --- a/components/spi_flash/spi_flash_os_func_app.c +++ b/components/spi_flash/spi_flash_os_func_app.c @@ -13,13 +13,18 @@ // limitations under the License. #include -#include "esp32/rom/ets_sys.h" #include "esp_attr.h" #include "esp_spi_flash.h" //for ``g_flash_guard_default_ops`` #include "esp_flash.h" #include "esp_flash_partitions.h" +#ifdef CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/ets_sys.h" +#else +#include "esp32s2beta/rom/ets_sys.h" +#endif + /* * OS functions providing delay service and arbitration among chips, and with the cache. * diff --git a/components/spi_flash/spi_flash_os_func_noos.c b/components/spi_flash/spi_flash_os_func_noos.c index 910633f9b5..6595a4781e 100644 --- a/components/spi_flash/spi_flash_os_func_noos.c +++ b/components/spi_flash/spi_flash_os_func_noos.c @@ -13,12 +13,17 @@ // limitations under the License. #include +#include "sdkconfig.h" #include "esp_flash.h" - -#include "esp32/rom/ets_sys.h" -#include "esp32/rom/cache.h" #include "esp_attr.h" +#ifdef CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/ets_sys.h" +#include "esp32/rom/cache.h" +#else +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/cache.h" +#endif static IRAM_ATTR esp_err_t start(void *arg) diff --git a/components/spi_flash/spi_flash_rom_patch.c b/components/spi_flash/spi_flash_rom_patch.c index af3d5d47df..efbe883ea0 100644 --- a/components/spi_flash/spi_flash_rom_patch.c +++ b/components/spi_flash/spi_flash_rom_patch.c @@ -11,11 +11,16 @@ // 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. - +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/ets_sys.h" #include "esp32/rom/gpio.h" #include "esp32/rom/spi_flash.h" -#include "sdkconfig.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#include "esp32s2beta/rom/gpio.h" +#include "esp32s2beta/rom/spi_flash.h" +#endif #include "soc/spi_periph.h" @@ -27,12 +32,18 @@ extern esp_rom_spiflash_chip_t g_rom_spiflash_chip; esp_rom_spiflash_result_t esp_rom_spiflash_wait_idle(esp_rom_spiflash_chip_t *spi) { uint32_t status; - +#if CONFIG_IDF_TARGET_ESP32 //wait for spi control ready while ((REG_READ(SPI_EXT2_REG(1)) & SPI_ST)) { } while ((REG_READ(SPI_EXT2_REG(0)) & SPI_ST)) { } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + while ((REG_READ(SPI_MEM_FSM_REG(1)) & SPI_MEM_ST)) { + } + while ((REG_READ(SPI_MEM_FSM_REG(0)) & SPI_MEM_ST)) { + } +#endif //wait for flash status ready if ( ESP_ROM_SPIFLASH_RESULT_OK != esp_rom_spiflash_read_status(spi, &status)) { return ESP_ROM_SPIFLASH_RESULT_ERR; @@ -69,12 +80,21 @@ esp_rom_spiflash_result_t esp_rom_spiflash_unlock(void) status &= ESP_ROM_SPIFLASH_QE; esp_rom_spiflash_wait_idle(&g_rom_spiflash_chip); +#if CONFIG_IDF_TARGET_ESP32 REG_WRITE(SPI_CMD_REG(SPI_IDX), SPI_FLASH_WREN); while (REG_READ(SPI_CMD_REG(SPI_IDX)) != 0) { } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_WRITE(SPI_MEM_CMD_REG(SPI_IDX), SPI_MEM_FLASH_WREN); + while (REG_READ(SPI_MEM_CMD_REG(SPI_IDX)) != 0) { + } +#endif esp_rom_spiflash_wait_idle(&g_rom_spiflash_chip); - +#if CONFIG_IDF_TARGET_ESP32 SET_PERI_REG_MASK(SPI_CTRL_REG(SPI_IDX), SPI_WRSR_2B); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SET_PERI_REG_MASK(SPI_MEM_CTRL_REG(SPI_IDX), SPI_MEM_WRSR_2B); +#endif if (esp_rom_spiflash_write_status(&g_rom_spiflash_chip, status) != ESP_ROM_SPIFLASH_RESULT_OK) { return ESP_ROM_SPIFLASH_RESULT_ERR; } @@ -96,7 +116,11 @@ static esp_rom_spiflash_result_t esp_rom_spiflash_erase_chip_internal(esp_rom_sp esp_rom_spiflash_wait_idle(spi); // Chip erase. +#if CONFIG_IDF_TARGET_ESP32 WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_FLASH_CE); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_MEM_FLASH_CE); +#endif while (READ_PERI_REG(PERIPHS_SPI_FLASH_CMD) != 0); // check erase is finished. @@ -117,7 +141,11 @@ static esp_rom_spiflash_result_t esp_rom_spiflash_erase_sector_internal(esp_rom_ // sector erase 4Kbytes erase is sector erase. WRITE_PERI_REG(PERIPHS_SPI_FLASH_ADDR, addr & 0xffffff); +#if CONFIG_IDF_TARGET_ESP32 WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_FLASH_SE); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_MEM_FLASH_SE); +#endif while (READ_PERI_REG(PERIPHS_SPI_FLASH_CMD) != 0); esp_rom_spiflash_wait_idle(spi); @@ -132,7 +160,11 @@ static esp_rom_spiflash_result_t esp_rom_spiflash_erase_block_internal(esp_rom_s // sector erase 4Kbytes erase is sector erase. WRITE_PERI_REG(PERIPHS_SPI_FLASH_ADDR, addr & 0xffffff); +#if CONFIG_IDF_TARGET_ESP32 WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_FLASH_BE); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_MEM_FLASH_BE); +#endif while (READ_PERI_REG(PERIPHS_SPI_FLASH_CMD) != 0); esp_rom_spiflash_wait_idle(spi); @@ -186,8 +218,11 @@ static esp_rom_spiflash_result_t esp_rom_spiflash_program_page_internal(esp_rom_ } temp_bl = 0; } - +#if CONFIG_IDF_TARGET_ESP32 WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_FLASH_PP); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_MEM_FLASH_PP); +#endif while ( READ_PERI_REG(PERIPHS_SPI_FLASH_CMD ) != 0 ); esp_rom_spiflash_wait_idle(spi); @@ -218,9 +253,15 @@ static esp_rom_spiflash_result_t esp_rom_spiflash_read_data(esp_rom_spiflash_chi while (temp_length > 0) { if (temp_length >= ESP_ROM_SPIFLASH_BUFF_BYTE_READ_NUM) { //WRITE_PERI_REG(PERIPHS_SPI_FLASH_ADDR, temp_addr |(ESP_ROM_SPIFLASH_BUFF_BYTE_READ_NUM << ESP_ROM_SPIFLASH_BYTES_LEN)); +#if CONFIG_IDF_TARGET_ESP32 REG_WRITE(SPI_MISO_DLEN_REG(1), ((ESP_ROM_SPIFLASH_BUFF_BYTE_READ_NUM << 3) - 1) << SPI_USR_MISO_DBITLEN_S); WRITE_PERI_REG(PERIPHS_SPI_FLASH_ADDR, temp_addr << 8); REG_WRITE(PERIPHS_SPI_FLASH_CMD, SPI_USR); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_WRITE(SPI_MEM_MISO_DLEN_REG(1), ((ESP_ROM_SPIFLASH_BUFF_BYTE_READ_NUM << 3) - 1) << SPI_MEM_USR_MISO_DBITLEN_S); + WRITE_PERI_REG(PERIPHS_SPI_FLASH_ADDR, temp_addr << 8); + REG_WRITE(PERIPHS_SPI_FLASH_CMD, SPI_MEM_USR); +#endif while (REG_READ(PERIPHS_SPI_FLASH_CMD) != 0); for (i = 0; i < (ESP_ROM_SPIFLASH_BUFF_BYTE_READ_NUM >> 2); i++) { @@ -231,8 +272,13 @@ static esp_rom_spiflash_result_t esp_rom_spiflash_read_data(esp_rom_spiflash_chi } else { //WRITE_PERI_REG(PERIPHS_SPI_FLASH_ADDR, temp_addr |(temp_length << ESP_ROM_SPIFLASH_BYTES_LEN )); WRITE_PERI_REG(PERIPHS_SPI_FLASH_ADDR, temp_addr << 8); +#if CONFIG_IDF_TARGET_ESP32 REG_WRITE(SPI_MISO_DLEN_REG(1), ((ESP_ROM_SPIFLASH_BUFF_BYTE_READ_NUM << 3) - 1) << SPI_USR_MISO_DBITLEN_S); REG_WRITE(PERIPHS_SPI_FLASH_CMD, SPI_USR); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_WRITE(SPI_MEM_MISO_DLEN_REG(1), ((ESP_ROM_SPIFLASH_BUFF_BYTE_READ_NUM << 3) - 1) << SPI_MEM_USR_MISO_DBITLEN_S); + REG_WRITE(PERIPHS_SPI_FLASH_CMD, SPI_MEM_USR); +#endif while (REG_READ(PERIPHS_SPI_FLASH_CMD) != 0); remain_word_num = (0 == (temp_length & 0x3)) ? (temp_length >> 2) : (temp_length >> 2) + 1; @@ -253,7 +299,11 @@ esp_rom_spiflash_result_t esp_rom_spiflash_read_status(esp_rom_spiflash_chip_t * if (g_rom_spiflash_dummy_len_plus[1] == 0) { while (ESP_ROM_SPIFLASH_BUSY_FLAG == (status_value & ESP_ROM_SPIFLASH_BUSY_FLAG)) { WRITE_PERI_REG(PERIPHS_SPI_FLASH_STATUS, 0); // clear regisrter +#if CONFIG_IDF_TARGET_ESP32 WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_FLASH_RDSR); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_MEM_FLASH_RDSR); +#endif while (READ_PERI_REG(PERIPHS_SPI_FLASH_CMD) != 0); status_value = READ_PERI_REG(PERIPHS_SPI_FLASH_STATUS) & (spi->status_mask); @@ -283,7 +333,11 @@ esp_rom_spiflash_result_t esp_rom_spiflash_write_status(esp_rom_spiflash_chip_t // update status value by status_value WRITE_PERI_REG(PERIPHS_SPI_FLASH_STATUS, status_value); // write status regisrter +#if CONFIG_IDF_TARGET_ESP32 WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_FLASH_WRSR); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_MEM_FLASH_WRSR); +#endif while (READ_PERI_REG(PERIPHS_SPI_FLASH_CMD) != 0); esp_rom_spiflash_wait_idle(spi); @@ -297,7 +351,11 @@ static esp_rom_spiflash_result_t esp_rom_spiflash_enable_write(esp_rom_spiflash_ esp_rom_spiflash_wait_idle(spi); //enable write +#if CONFIG_IDF_TARGET_ESP32 WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_FLASH_WREN); // enable write operation +#elif CONFIG_IDF_TARGET_ESP32S2BETA + WRITE_PERI_REG(PERIPHS_SPI_FLASH_CMD, SPI_MEM_FLASH_WREN); // enable write operation +#endif while (READ_PERI_REG(PERIPHS_SPI_FLASH_CMD) != 0); // make sure the flash is ready for writing @@ -310,6 +368,7 @@ static esp_rom_spiflash_result_t esp_rom_spiflash_enable_write(esp_rom_spiflash_ static void spi_cache_mode_switch(uint32_t modebit) { +#if CONFIG_IDF_TARGET_ESP32 if ((modebit & SPI_FREAD_QIO) && (modebit & SPI_FASTRD_MODE)) { REG_CLR_BIT(SPI_USER_REG(0), SPI_USR_MOSI); REG_SET_BIT(SPI_USER_REG(0), SPI_USR_MISO | SPI_USR_DUMMY | SPI_USR_ADDR); @@ -346,7 +405,43 @@ static void spi_cache_mode_switch(uint32_t modebit) REG_SET_FIELD(SPI_USER1_REG(0), SPI_USR_ADDR_BITLEN, SPI0_R_SIO_ADDR_BITSLEN); REG_SET_FIELD(SPI_USER2_REG(0), SPI_USR_COMMAND_VALUE, 0x03); } - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if ((modebit & SPI_MEM_FREAD_QIO) && (modebit & SPI_MEM_FASTRD_MODE)) { + REG_CLR_BIT(SPI_MEM_USER_REG(0), SPI_MEM_USR_MOSI); + REG_SET_BIT(SPI_MEM_USER_REG(0), SPI_MEM_USR_MISO | SPI_MEM_USR_DUMMY | SPI_MEM_USR_ADDR); + REG_SET_FIELD(SPI_MEM_USER1_REG(0), SPI_MEM_USR_ADDR_BITLEN, SPI0_R_QIO_ADDR_BITSLEN); + REG_SET_FIELD(SPI_MEM_USER1_REG(0), SPI_MEM_USR_DUMMY_CYCLELEN, SPI0_R_QIO_DUMMY_CYCLELEN + g_rom_spiflash_dummy_len_plus[0]); + REG_SET_FIELD(SPI_MEM_USER2_REG(0), SPI_MEM_USR_COMMAND_VALUE, 0xEB); + } else if (modebit & SPI_MEM_FASTRD_MODE) { + REG_CLR_BIT(SPI_MEM_USER_REG(0), SPI_MEM_USR_MOSI); + REG_SET_BIT(SPI_MEM_USER_REG(0), SPI_MEM_USR_MISO | SPI_MEM_USR_DUMMY | SPI_MEM_USR_ADDR); + REG_SET_FIELD(SPI_MEM_USER1_REG(0), SPI_MEM_USR_ADDR_BITLEN, SPI0_R_FAST_ADDR_BITSLEN); + if ((modebit & SPI_MEM_FREAD_QUAD)) { + REG_SET_FIELD(SPI_MEM_USER2_REG(0), SPI_MEM_USR_COMMAND_VALUE, 0x6B); + REG_SET_FIELD(SPI_MEM_USER1_REG(0), SPI_MEM_USR_DUMMY_CYCLELEN, SPI0_R_FAST_DUMMY_CYCLELEN + g_rom_spiflash_dummy_len_plus[0]); + } else if ((modebit & SPI_MEM_FREAD_DIO)) { + REG_SET_FIELD(SPI_MEM_USER1_REG(0), SPI_MEM_USR_DUMMY_CYCLELEN, SPI0_R_DIO_DUMMY_CYCLELEN + g_rom_spiflash_dummy_len_plus[0]); + REG_SET_FIELD(SPI_MEM_USER2_REG(0), SPI_MEM_USR_COMMAND_VALUE, 0xBB); + } else if ((modebit & SPI_MEM_FREAD_DUAL)) { + REG_SET_FIELD(SPI_MEM_USER1_REG(0), SPI_MEM_USR_DUMMY_CYCLELEN, SPI0_R_FAST_DUMMY_CYCLELEN + g_rom_spiflash_dummy_len_plus[0]); + REG_SET_FIELD(SPI_MEM_USER2_REG(0), SPI_MEM_USR_COMMAND_VALUE, 0x3B); + } else{ + REG_SET_FIELD(SPI_MEM_USER1_REG(0), SPI_MEM_USR_DUMMY_CYCLELEN, SPI0_R_FAST_DUMMY_CYCLELEN + g_rom_spiflash_dummy_len_plus[0]); + REG_SET_FIELD(SPI_MEM_USER2_REG(0), SPI_MEM_USR_COMMAND_VALUE, 0x0B); + } + } else { + REG_CLR_BIT(SPI_MEM_USER_REG(0), SPI_MEM_USR_MOSI); + if (g_rom_spiflash_dummy_len_plus[0] == 0) { + REG_CLR_BIT(SPI_MEM_USER_REG(0), SPI_MEM_USR_DUMMY); + } else { + REG_SET_BIT(SPI_MEM_USER_REG(0), SPI_MEM_USR_DUMMY); + REG_SET_FIELD(SPI_MEM_USER1_REG(0), SPI_MEM_USR_DUMMY_CYCLELEN, g_rom_spiflash_dummy_len_plus[0] - 1); + } + REG_SET_BIT(SPI_MEM_USER_REG(0), SPI_MEM_USR_MISO | SPI_MEM_USR_ADDR); + REG_SET_FIELD(SPI_MEM_USER1_REG(0), SPI_MEM_USR_ADDR_BITLEN, SPI0_R_SIO_ADDR_BITSLEN); + REG_SET_FIELD(SPI_MEM_USER2_REG(0), SPI_MEM_USR_COMMAND_VALUE, 0x03); + } +#endif } esp_rom_spiflash_result_t esp_rom_spiflash_lock(void) @@ -375,27 +470,50 @@ esp_rom_spiflash_result_t esp_rom_spiflash_lock(void) esp_rom_spiflash_result_t esp_rom_spiflash_config_readmode(esp_rom_spiflash_read_mode_t mode) { uint32_t modebit; - +#if CONFIG_IDF_TARGET_ESP32 while ((REG_READ(SPI_EXT2_REG(1)) & SPI_ST)) { } while ((REG_READ(SPI_EXT2_REG(0)) & SPI_ST)) { } +#elif CONFIG_IDF_TARGET_ESP32S2BETA + while ((REG_READ(SPI_MEM_FSM_REG(1)) & SPI_MEM_ST)) { + } + while ((REG_READ(SPI_MEM_FSM_REG(0)) & SPI_MEM_ST)) { + } +#endif //clear old mode bit +#if CONFIG_IDF_TARGET_ESP32 CLEAR_PERI_REG_MASK(PERIPHS_SPI_FLASH_CTRL, SPI_FREAD_QIO | SPI_FREAD_QUAD | SPI_FREAD_DIO | SPI_FREAD_DUAL | SPI_FASTRD_MODE); CLEAR_PERI_REG_MASK(SPI_CTRL_REG(0), SPI_FREAD_QIO | SPI_FREAD_QUAD | SPI_FREAD_DIO | SPI_FREAD_DUAL | SPI_FASTRD_MODE); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + CLEAR_PERI_REG_MASK(PERIPHS_SPI_FLASH_CTRL, SPI_MEM_FREAD_QIO | SPI_MEM_FREAD_QUAD | SPI_MEM_FREAD_DIO | SPI_MEM_FREAD_DUAL | SPI_MEM_FASTRD_MODE); + CLEAR_PERI_REG_MASK(SPI_MEM_CTRL_REG(0), SPI_MEM_FREAD_QIO | SPI_MEM_FREAD_QUAD | SPI_MEM_FREAD_DIO | SPI_MEM_FREAD_DUAL | SPI_MEM_FASTRD_MODE); +#endif //configure read mode switch (mode) { +#if CONFIG_IDF_TARGET_ESP32 case ESP_ROM_SPIFLASH_QIO_MODE : modebit = SPI_FREAD_QIO | SPI_FASTRD_MODE; break; case ESP_ROM_SPIFLASH_QOUT_MODE : modebit = SPI_FREAD_QUAD | SPI_FASTRD_MODE; break; case ESP_ROM_SPIFLASH_DIO_MODE : modebit = SPI_FREAD_DIO | SPI_FASTRD_MODE; break; case ESP_ROM_SPIFLASH_DOUT_MODE : modebit = SPI_FREAD_DUAL | SPI_FASTRD_MODE; break; case ESP_ROM_SPIFLASH_FASTRD_MODE: modebit = SPI_FASTRD_MODE; break; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + case ESP_ROM_SPIFLASH_QIO_MODE : modebit = SPI_MEM_FREAD_QIO | SPI_MEM_FASTRD_MODE; break; + case ESP_ROM_SPIFLASH_QOUT_MODE : modebit = SPI_MEM_FREAD_QUAD | SPI_MEM_FASTRD_MODE; break; + case ESP_ROM_SPIFLASH_DIO_MODE : modebit = SPI_MEM_FREAD_DIO | SPI_MEM_FASTRD_MODE; break; + case ESP_ROM_SPIFLASH_DOUT_MODE : modebit = SPI_MEM_FREAD_DUAL | SPI_MEM_FASTRD_MODE; break; + case ESP_ROM_SPIFLASH_FASTRD_MODE: modebit = SPI_MEM_FASTRD_MODE; break; +#endif case ESP_ROM_SPIFLASH_SLOWRD_MODE: modebit = 0; break; default : modebit = 0; } SET_PERI_REG_MASK(PERIPHS_SPI_FLASH_CTRL, modebit); +#if CONFIG_IDF_TARGET_ESP32 SET_PERI_REG_MASK(SPI_CTRL_REG(0), modebit); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + SET_PERI_REG_MASK(SPI_MEM_CTRL_REG(0), modebit); +#endif spi_cache_mode_switch(modebit); return ESP_ROM_SPIFLASH_RESULT_OK; @@ -417,9 +535,13 @@ esp_rom_spiflash_result_t esp_rom_spiflash_erase_chip(void) esp_rom_spiflash_result_t esp_rom_spiflash_erase_block(uint32_t block_num) { // flash write is always 1 line currently +#if CONFIG_IDF_TARGET_ESP32 REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_DUMMY); REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_USR_ADDR_BITLEN, ESP_ROM_SPIFLASH_W_SIO_ADDR_BITSLEN); - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_DUMMY); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_ADDR_BITLEN, ESP_ROM_SPIFLASH_W_SIO_ADDR_BITSLEN); +#endif //check program size if (block_num >= ((g_rom_spiflash_chip.chip_size) / (g_rom_spiflash_chip.block_size))) { return ESP_ROM_SPIFLASH_RESULT_ERR; @@ -438,9 +560,13 @@ esp_rom_spiflash_result_t esp_rom_spiflash_erase_block(uint32_t block_num) esp_rom_spiflash_result_t esp_rom_spiflash_erase_sector(uint32_t sector_num) { // flash write is always 1 line currently +#if CONFIG_IDF_TARGET_ESP32 REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_DUMMY); REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_USR_ADDR_BITLEN, ESP_ROM_SPIFLASH_W_SIO_ADDR_BITSLEN); - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_DUMMY); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_ADDR_BITLEN, ESP_ROM_SPIFLASH_W_SIO_ADDR_BITSLEN); +#endif //check program size if (sector_num >= ((g_rom_spiflash_chip.chip_size) / (g_rom_spiflash_chip.sector_size))) { return ESP_ROM_SPIFLASH_RESULT_ERR; @@ -464,9 +590,13 @@ esp_rom_spiflash_result_t esp_rom_spiflash_write(uint32_t target, const uint32_t uint8_t i; // flash write is always 1 line currently +#if CONFIG_IDF_TARGET_ESP32 REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_DUMMY); REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_USR_ADDR_BITLEN, ESP_ROM_SPIFLASH_W_SIO_ADDR_BITSLEN); - +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_DUMMY); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_ADDR_BITLEN, ESP_ROM_SPIFLASH_W_SIO_ADDR_BITSLEN); +#endif //check program size if ( (target + len) > (g_rom_spiflash_chip.chip_size)) { return ESP_ROM_SPIFLASH_RESULT_ERR; @@ -504,6 +634,7 @@ esp_rom_spiflash_result_t esp_rom_spiflash_write(uint32_t target, const uint32_t return ESP_ROM_SPIFLASH_RESULT_OK; } +#if CONFIG_IDF_TARGET_ESP32 esp_rom_spiflash_result_t esp_rom_spiflash_write_encrypted(uint32_t flash_addr, uint32_t *data, uint32_t len) { esp_rom_spiflash_result_t ret = ESP_ROM_SPIFLASH_RESULT_OK; @@ -529,13 +660,14 @@ esp_rom_spiflash_result_t esp_rom_spiflash_write_encrypted(uint32_t flash_addr, return ret; } - +#endif esp_rom_spiflash_result_t esp_rom_spiflash_read(uint32_t target, uint32_t *dest_addr, int32_t len) { // QIO or SIO, non-QIO regard as SIO uint32_t modebit; modebit = READ_PERI_REG(PERIPHS_SPI_FLASH_CTRL); +#if CONFIG_IDF_TARGET_ESP32 if ((modebit & SPI_FREAD_QIO) && (modebit & SPI_FASTRD_MODE)) { REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_MOSI); REG_SET_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_MISO | SPI_USR_DUMMY | SPI_USR_ADDR); @@ -547,17 +679,44 @@ esp_rom_spiflash_result_t esp_rom_spiflash_read(uint32_t target, uint32_t *dest_ REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_MOSI); REG_SET_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_MISO | SPI_USR_ADDR); if (modebit & SPI_FREAD_DIO) { +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if ((modebit & SPI_MEM_FREAD_QIO) && (modebit & SPI_MEM_FASTRD_MODE)) { + REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_MOSI); + REG_SET_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_MISO | SPI_MEM_USR_DUMMY | SPI_MEM_USR_ADDR); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_ADDR_BITLEN, SPI1_R_QIO_ADDR_BITSLEN); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_DUMMY_CYCLELEN, SPI1_R_QIO_DUMMY_CYCLELEN + g_rom_spiflash_dummy_len_plus[1]); + //REG_SET_FIELD(PERIPHS_SPI_SPI_MEM_H_USRREG2, SPI_USR_COMMAND_VALUE, 0xEB); + REG_WRITE(PERIPHS_SPI_FLASH_USRREG2, (0x7 << SPI_MEM_USR_COMMAND_BITLEN_S) | 0xEB); + } else if (modebit & SPI_MEM_FASTRD_MODE) { + REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_MOSI); + REG_SET_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_MISO | SPI_MEM_USR_ADDR); + if (modebit & SPI_MEM_FREAD_DIO) { +#endif if (g_rom_spiflash_dummy_len_plus[1] == 0) { +#if CONFIG_IDF_TARGET_ESP32 REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_DUMMY); REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_USR_ADDR_BITLEN, SPI1_R_DIO_ADDR_BITSLEN); REG_WRITE(PERIPHS_SPI_FLASH_USRREG2, (0x7 << SPI_USR_COMMAND_BITLEN_S) | 0xBB); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_DUMMY); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_ADDR_BITLEN, SPI1_R_DIO_ADDR_BITSLEN); + REG_WRITE(PERIPHS_SPI_FLASH_USRREG2, (0x7 << SPI_MEM_USR_COMMAND_BITLEN_S) | 0xBB); +#endif } else { +#if CONFIG_IDF_TARGET_ESP32 REG_SET_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_DUMMY); REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_USR_ADDR_BITLEN, SPI1_R_DIO_ADDR_BITSLEN); REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_USR_DUMMY_CYCLELEN, g_rom_spiflash_dummy_len_plus[1] - 1); REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG2, SPI_USR_COMMAND_VALUE, 0xBB); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_SET_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_DUMMY); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_ADDR_BITLEN, SPI1_R_DIO_ADDR_BITSLEN); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_DUMMY_CYCLELEN, g_rom_spiflash_dummy_len_plus[1] - 1); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG2, SPI_MEM_USR_COMMAND_VALUE, 0xBB); +#endif } } else { +#if CONFIG_IDF_TARGET_ESP32 if ((modebit & SPI_FREAD_QUAD)) { //REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG2, SPI_USR_COMMAND_VALUE, 0x6B); REG_WRITE(PERIPHS_SPI_FLASH_USRREG2, (0x7 << SPI_USR_COMMAND_BITLEN_S) | 0x6B); @@ -571,8 +730,21 @@ esp_rom_spiflash_result_t esp_rom_spiflash_read(uint32_t target, uint32_t *dest_ REG_SET_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_DUMMY); REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_USR_ADDR_BITLEN, SPI1_R_FAST_ADDR_BITSLEN); REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_USR_DUMMY_CYCLELEN, SPI1_R_FAST_DUMMY_CYCLELEN + g_rom_spiflash_dummy_len_plus[1]); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + if ((modebit & SPI_MEM_FREAD_QUAD)) { + REG_WRITE(PERIPHS_SPI_FLASH_USRREG2, (0x7 << SPI_MEM_USR_COMMAND_BITLEN_S) | 0x6B); + } else if ((modebit & SPI_MEM_FREAD_DUAL)) { + REG_WRITE(PERIPHS_SPI_FLASH_USRREG2, (0x7 << SPI_MEM_USR_COMMAND_BITLEN_S) | 0x3B); + } else { + REG_WRITE(PERIPHS_SPI_FLASH_USRREG2, (0x7 << SPI_MEM_USR_COMMAND_BITLEN_S) | 0x0B); + } + REG_SET_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_DUMMY); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_ADDR_BITLEN, SPI1_R_FAST_ADDR_BITSLEN); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_DUMMY_CYCLELEN, SPI1_R_FAST_DUMMY_CYCLELEN + g_rom_spiflash_dummy_len_plus[1]); +#endif } } else { +#if CONFIG_IDF_TARGET_ESP32 REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_MOSI); if (g_rom_spiflash_dummy_len_plus[1] == 0) { REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_USR_DUMMY); @@ -584,6 +756,18 @@ esp_rom_spiflash_result_t esp_rom_spiflash_read(uint32_t target, uint32_t *dest_ REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_USR_ADDR_BITLEN, SPI1_R_SIO_ADDR_BITSLEN); //REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG2, SPI_USR_COMMAND_VALUE, 0x03); REG_WRITE(PERIPHS_SPI_FLASH_USRREG2, (0x7 << SPI_USR_COMMAND_BITLEN_S) | 0x03); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_MOSI); + if (g_rom_spiflash_dummy_len_plus[1] == 0) { + REG_CLR_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_DUMMY); + } else { + REG_SET_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_DUMMY); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_DUMMY_CYCLELEN, g_rom_spiflash_dummy_len_plus[1] - 1); + } + REG_SET_BIT(PERIPHS_SPI_FLASH_USRREG, SPI_MEM_USR_MISO | SPI_MEM_USR_ADDR); + REG_SET_FIELD(PERIPHS_SPI_FLASH_USRREG1, SPI_MEM_USR_ADDR_BITLEN, SPI1_R_SIO_ADDR_BITSLEN); + REG_WRITE(PERIPHS_SPI_FLASH_USRREG2, (0x7 << SPI_MEM_USR_COMMAND_BITLEN_S) | 0x03); +#endif } if ( ESP_ROM_SPIFLASH_RESULT_OK != esp_rom_spiflash_read_data(&g_rom_spiflash_chip, target, dest_addr, len)) { diff --git a/components/spi_flash/test/CMakeLists.txt b/components/spi_flash/test/CMakeLists.txt index 831e142120..3980437baf 100644 --- a/components/spi_flash/test/CMakeLists.txt +++ b/components/spi_flash/test/CMakeLists.txt @@ -1,7 +1,15 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." - REQUIRES unity test_utils spi_flash bootloader_support app_update) +set(src_dirs ".") +set(exclude_srcs) -if(CONFIG_SPI_FLASH_USE_LEGACY_IMPL) - set(COMPONENT_SRCEXCLUDE "test_esp_flash.c" "test_partition_ext.c") +if(IDF_TARGET STREQUAL "esp32") + list(APPEND src_dirs "esp32") + if(CONFIG_SPI_FLASH_USE_LEGACY_IMPL) + set(exclude_srcs "esp32/test_esp_flash.c" "esp32/test_partition_ext.c") + endif() endif() + +idf_component_register(SRC_DIRS ${src_dirs} + EXCLUDE_SRCS ${exclude_srcs} + INCLUDE_DIRS "." + REQUIRES unity test_utils spi_flash bootloader_support app_update) + diff --git a/components/spi_flash/test/component.mk b/components/spi_flash/test/component.mk index 2a236e9d03..c03bbed3f4 100644 --- a/components/spi_flash/test/component.mk +++ b/components/spi_flash/test/component.mk @@ -2,6 +2,7 @@ #Component Makefile # +COMPONENT_SRCDIRS += esp32 COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive ifdef CONFIG_SPI_FLASH_USE_LEGACY_IMPL diff --git a/components/spi_flash/test/test_esp_flash.c b/components/spi_flash/test/esp32/test_esp_flash.c similarity index 100% rename from components/spi_flash/test/test_esp_flash.c rename to components/spi_flash/test/esp32/test_esp_flash.c diff --git a/components/spi_flash/test/test_partition_ext.c b/components/spi_flash/test/esp32/test_partition_ext.c similarity index 100% rename from components/spi_flash/test/test_partition_ext.c rename to components/spi_flash/test/esp32/test_partition_ext.c diff --git a/components/spi_flash/test/test_cache_disabled.c b/components/spi_flash/test/test_cache_disabled.c index 747ccdf3ab..aae44bd431 100644 --- a/components/spi_flash/test/test_cache_disabled.c +++ b/components/spi_flash/test/test_cache_disabled.c @@ -73,8 +73,12 @@ TEST_CASE("invalid access to cache raises panic (PRO CPU)", "[spi_flash][ignore] vTaskDelay(1000/portTICK_PERIOD_MS); } +#ifndef CONFIG_FREERTOS_UNICORE + TEST_CASE("invalid access to cache raises panic (APP CPU)", "[spi_flash][ignore]") { xTaskCreatePinnedToCore(&cache_access_test_func, "ia", 2048, NULL, 5, NULL, 1); vTaskDelay(1000/portTICK_PERIOD_MS); } + +#endif diff --git a/components/spi_flash/test/test_mmap.c b/components/spi_flash/test/test_mmap.c index 80458e77e1..8396ee7e3b 100644 --- a/components/spi_flash/test/test_mmap.c +++ b/components/spi_flash/test/test_mmap.c @@ -93,7 +93,7 @@ static void setup_mmap_tests(void) } } -TEST_CASE("Can mmap into data address space", "[spi_flash][mmap]") +TEST_CASE_ESP32("Can mmap into data address space", "[spi_flash][mmap]") { setup_mmap_tests(); @@ -153,7 +153,7 @@ TEST_CASE("Can mmap into data address space", "[spi_flash][mmap]") TEST_ASSERT_EQUAL_PTR(NULL, spi_flash_phys2cache(start, SPI_FLASH_MMAP_DATA)); } -TEST_CASE("Can mmap into instruction address space", "[spi_flash][mmap]") +TEST_CASE_ESP32("Can mmap into instruction address space", "[spi_flash][mmap]") { setup_mmap_tests(); @@ -177,15 +177,23 @@ TEST_CASE("Can mmap into instruction address space", "[spi_flash][mmap]") printf("Mapping %x (+%x)\n", start - 0x10000, 0x20000); spi_flash_mmap_handle_t handle2; const void *ptr2; - ESP_ERROR_CHECK( spi_flash_mmap(start - 0x10000, 0x20000, SPI_FLASH_MMAP_DATA, &ptr2, &handle2) ); + ESP_ERROR_CHECK( spi_flash_mmap(start - 0x10000, 0x20000, SPI_FLASH_MMAP_INST, &ptr2, &handle2) ); printf("mmap_res: handle=%d ptr=%p\n", handle2, ptr2); + + TEST_ASSERT_EQUAL_HEX32(start - 0x10000, spi_flash_cache2phys(ptr2)); + TEST_ASSERT_EQUAL_PTR(ptr2, spi_flash_phys2cache(start - 0x10000, SPI_FLASH_MMAP_INST)); + spi_flash_mmap_dump(); printf("Mapping %x (+%x)\n", start, 0x10000); spi_flash_mmap_handle_t handle3; const void *ptr3; - ESP_ERROR_CHECK( spi_flash_mmap(start, 0x10000, SPI_FLASH_MMAP_DATA, &ptr3, &handle3) ); + ESP_ERROR_CHECK( spi_flash_mmap(start, 0x10000, SPI_FLASH_MMAP_INST, &ptr3, &handle3) ); printf("mmap_res: handle=%d ptr=%p\n", handle3, ptr3); + + TEST_ASSERT_EQUAL_HEX32(start, spi_flash_cache2phys(ptr3)); + TEST_ASSERT_EQUAL_PTR(ptr3, spi_flash_phys2cache(start, SPI_FLASH_MMAP_INST)); + spi_flash_mmap_dump(); printf("Unmapping handle1\n"); @@ -201,7 +209,7 @@ TEST_CASE("Can mmap into instruction address space", "[spi_flash][mmap]") } -TEST_CASE("Can mmap unordered pages into contiguous memory", "[spi_flash][mmap]") +TEST_CASE_ESP32("Can mmap unordered pages into contiguous memory", "[spi_flash][mmap]") { int nopages; int *pages; @@ -342,7 +350,7 @@ TEST_CASE("flash_mmap can mmap after get enough free MMU pages", "[spi_flash][mm TEST_ASSERT_EQUAL_PTR(NULL, spi_flash_phys2cache(start, SPI_FLASH_MMAP_DATA)); } -TEST_CASE("phys2cache/cache2phys basic checks", "[spi_flash][mmap]") +TEST_CASE_ESP32("phys2cache/cache2phys basic checks", "[spi_flash][mmap]") { uint8_t buf[64]; @@ -419,7 +427,7 @@ TEST_CASE("munmap followed by mmap flushes cache", "[spi_flash][mmap]") TEST_ASSERT_NOT_EQUAL(0, memcmp(buf, data, sizeof(buf))); } -TEST_CASE("no stale data read post mmap and write partition", "[spi_flash][mmap]") +TEST_CASE_ESP32("no stale data read post mmap and write partition", "[spi_flash][mmap]") { /* Buffer size is set to 32 to allow encrypted flash writes */ const char buf[32] = "Test buffer data for partition"; diff --git a/components/spi_flash/test/test_read_write.c b/components/spi_flash/test/test_read_write.c index f357695ebb..5bc602beed 100644 --- a/components/spi_flash/test/test_read_write.c +++ b/components/spi_flash/test/test_read_write.c @@ -168,7 +168,7 @@ static void IRAM_ATTR test_write(int dst_off, int src_off, int len) TEST_ASSERT_EQUAL_INT(cmp_or_dump(dst_buf, dst_gold, sizeof(dst_buf)), 0); } -TEST_CASE("Test spi_flash_write", "[spi_flash][esp_flash]") +TEST_CASE_ESP32("Test spi_flash_write", "[spi_flash][esp_flash]") { setup_tests(); #if CONFIG_SPI_FLASH_MINIMAL_TEST @@ -215,13 +215,32 @@ TEST_CASE("Test spi_flash_write", "[spi_flash][esp_flash]") * NB: At the moment these only support aligned addresses, because memcpy * is not aware of the 32-but load requirements for these regions. */ +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +#define TEST_SOC_IROM_ADDR (SOC_IROM_LOW) +#define TEST_SOC_CACHE_RAM_BANK0_ADDR (SOC_IRAM_LOW) +#define TEST_SOC_CACHE_RAM_BANK1_ADDR (SOC_IRAM_LOW + 0x2000) +#define TEST_SOC_CACHE_RAM_BANK2_ADDR (SOC_IRAM_LOW + 0x4000) +#define TEST_SOC_CACHE_RAM_BANK3_ADDR (SOC_IRAM_LOW + 0x6000) +#define TEST_SOC_IRAM_ADDR (SOC_IRAM_LOW + 0x8000) +#define TEST_SOC_RTC_IRAM_ADDR (SOC_RTC_IRAM_LOW) +#define TEST_SOC_RTC_DRAM_ADDR (SOC_RTC_DRAM_LOW) + ESP_ERROR_CHECK(spi_flash_write(start, (char *) TEST_SOC_IROM_ADDR, 16)); + ESP_ERROR_CHECK(spi_flash_write(start, (char *) TEST_SOC_IRAM_ADDR, 16)); + ESP_ERROR_CHECK(spi_flash_write(start, (char *) TEST_SOC_CACHE_RAM_BANK0_ADDR, 16)); + ESP_ERROR_CHECK(spi_flash_write(start, (char *) TEST_SOC_CACHE_RAM_BANK1_ADDR, 16)); + ESP_ERROR_CHECK(spi_flash_write(start, (char *) TEST_SOC_CACHE_RAM_BANK2_ADDR, 16)); + ESP_ERROR_CHECK(spi_flash_write(start, (char *) TEST_SOC_CACHE_RAM_BANK3_ADDR, 16)); + ESP_ERROR_CHECK(spi_flash_write(start, (char *) TEST_SOC_RTC_IRAM_ADDR, 16)); + ESP_ERROR_CHECK(spi_flash_write(start, (char *) TEST_SOC_RTC_DRAM_ADDR, 16)); +#else ESP_ERROR_CHECK(spi_flash_write(start, (char *) 0x40000000, 16)); ESP_ERROR_CHECK(spi_flash_write(start, (char *) 0x40070000, 16)); ESP_ERROR_CHECK(spi_flash_write(start, (char *) 0x40078000, 16)); ESP_ERROR_CHECK(spi_flash_write(start, (char *) 0x40080000, 16)); +#endif } -#ifdef CONFIG_ESP32_SPIRAM_SUPPORT +#ifdef CONFIG_SPIRAM TEST_CASE("spi_flash_read can read into buffer in external RAM", "[spi_flash]") { @@ -299,4 +318,5 @@ TEST_CASE("spi_flash_read less than 16 bytes into buffer in external RAM", "[spi } } -#endif // CONFIG_ESP32_SPIRAM_SUPPORT +#endif // CONFIG_SPIRAM + diff --git a/components/spi_flash/test/test_spi_flash.c b/components/spi_flash/test/test_spi_flash.c index f943723743..f14c5d0346 100644 --- a/components/spi_flash/test/test_spi_flash.c +++ b/components/spi_flash/test/test_spi_flash.c @@ -16,11 +16,23 @@ struct flash_test_ctx { SemaphoreHandle_t done; }; +/* Base offset in flash for tests. */ +static size_t start; + +static void setup_tests(void) +{ + if (start == 0) { + const esp_partition_t *part = get_test_data_partition(); + start = part->address; + printf("Test data partition @ 0x%x\n", start); + } +} + static void flash_test_task(void *arg) { struct flash_test_ctx *ctx = (struct flash_test_ctx *) arg; vTaskDelay(100 / portTICK_PERIOD_MS); - const uint32_t sector = ctx->offset; + const uint32_t sector = start / SPI_FLASH_SEC_SIZE + ctx->offset; printf("t%d\n", sector); printf("es%d\n", sector); if (spi_flash_erase_sector(sector) != ESP_OK) { @@ -65,13 +77,15 @@ static void flash_test_task(void *arg) TEST_CASE("flash write and erase work both on PRO CPU and on APP CPU", "[spi_flash][ignore]") { + setup_tests(); + SemaphoreHandle_t done = xSemaphoreCreateCounting(4, 0); struct flash_test_ctx ctx[] = { - { .offset = 0x100 + 6, .done = done }, - { .offset = 0x100 + 7, .done = done }, - { .offset = 0x100 + 8, .done = done }, + { .offset = 0x10 + 6, .done = done }, + { .offset = 0x10 + 7, .done = done }, + { .offset = 0x10 + 8, .done = done }, #ifndef CONFIG_FREERTOS_UNICORE - { .offset = 0x100 + 9, .done = done } + { .offset = 0x10 + 9, .done = done } #endif }; @@ -106,6 +120,10 @@ typedef struct { size_t repeat_count; } block_task_arg_t; +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +#define int_clr_timers int_clr +#endif + static void IRAM_ATTR timer_isr(void* varg) { block_task_arg_t* arg = (block_task_arg_t*) varg; timer_group_intr_clr_in_isr(TIMER_GROUP_0, TIMER_0); diff --git a/components/spiffs/CMakeLists.txt b/components/spiffs/CMakeLists.txt index 0c68155dc7..c9b164807b 100644 --- a/components/spiffs/CMakeLists.txt +++ b/components/spiffs/CMakeLists.txt @@ -10,4 +10,5 @@ idf_component_register(SRCS "esp_spiffs.c" REQUIRES spi_flash PRIV_REQUIRES bootloader_support) -set_source_files_properties(spiffs/src/spiffs_nucleus.c PROPERTIES COMPILE_FLAGS -Wno-stringop-truncation) \ No newline at end of file +set_source_files_properties(spiffs/src/spiffs_nucleus.c PROPERTIES COMPILE_FLAGS -Wno-stringop-truncation) + diff --git a/components/spiffs/test_spiffs_host/sdkconfig/sdkconfig.h b/components/spiffs/test_spiffs_host/sdkconfig/sdkconfig.h index f2fbfff6b5..1afb29924f 100644 --- a/components/spiffs/test_spiffs_host/sdkconfig/sdkconfig.h +++ b/components/spiffs/test_spiffs_host/sdkconfig/sdkconfig.h @@ -1,5 +1,5 @@ #pragma once - +#define CONFIG_IDF_TARGET_ESP32 1 #define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1 #define CONFIG_SPIFFS_MAX_PARTITIONS 3 #define CONFIG_SPIFFS_OBJ_NAME_LEN 32 diff --git a/components/tcpip_adapter/event_handlers.c b/components/tcpip_adapter/event_handlers.c index 6d2128e526..146f872036 100644 --- a/components/tcpip_adapter/event_handlers.c +++ b/components/tcpip_adapter/event_handlers.c @@ -17,7 +17,9 @@ #include "esp_event.h" #include "esp_wifi.h" #include "esp_private/wifi.h" +#if CONFIG_ETH_ENABLED #include "esp_eth.h" +#endif #include "esp_err.h" #include "esp_log.h" @@ -39,7 +41,7 @@ static void handle_sta_stop(void *arg, esp_event_base_t base, int32_t event_id, static void handle_sta_connected(void *arg, esp_event_base_t base, int32_t event_id, void *data); static void handle_sta_disconnected(void *arg, esp_event_base_t base, int32_t event_id, void *data); static void handle_sta_got_ip(void *arg, esp_event_base_t base, int32_t event_id, void *data); - +#if CONFIG_ETH_ENABLED static void handle_eth_start(void *arg, esp_event_base_t base, int32_t event_id, void *data); static void handle_eth_stop(void *arg, esp_event_base_t base, int32_t event_id, void *data); static void handle_eth_connected(void *arg, esp_event_base_t base, int32_t event_id, void *data); @@ -94,6 +96,16 @@ static void handle_eth_disconnected(void *arg, esp_event_base_t base, int32_t ev tcpip_adapter_down(TCPIP_ADAPTER_IF_ETH); } +static void handle_eth_got_ip(void *arg, esp_event_base_t base, int32_t event_id, void *data) +{ + const ip_event_got_ip_t *event = (const ip_event_got_ip_t *) data; + ESP_LOGI(TAG, "eth ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR, + IP2STR(&event->ip_info.ip), + IP2STR(&event->ip_info.netmask), + IP2STR(&event->ip_info.gw)); +} +#endif + static void handle_sta_got_ip(void *arg, esp_event_base_t base, int32_t event_id, void *data) { API_CALL_CHECK("esp_wifi_internal_set_sta_ip", esp_wifi_internal_set_sta_ip(), ESP_OK); @@ -105,14 +117,6 @@ static void handle_sta_got_ip(void *arg, esp_event_base_t base, int32_t event_id IP2STR(&event->ip_info.gw)); } -static void handle_eth_got_ip(void *arg, esp_event_base_t base, int32_t event_id, void *data) -{ - const ip_event_got_ip_t *event = (const ip_event_got_ip_t *) data; - ESP_LOGI(TAG, "eth ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR, - IP2STR(&event->ip_info.ip), - IP2STR(&event->ip_info.netmask), - IP2STR(&event->ip_info.gw)); -} static void handle_ap_start(void *arg, esp_event_base_t base, int32_t event_id, void *data) { @@ -260,6 +264,7 @@ esp_err_t tcpip_adapter_clear_default_wifi_handlers(void) return ESP_OK; } +#if CONFIG_ETH_ENABLED esp_err_t tcpip_adapter_set_default_eth_handlers(void) { esp_err_t err; @@ -304,3 +309,4 @@ esp_err_t tcpip_adapter_clear_default_eth_handlers(void) esp_event_handler_unregister(IP_EVENT, IP_EVENT_ETH_GOT_IP, handle_eth_got_ip); return ESP_OK; } +#endif diff --git a/components/tcpip_adapter/tcpip_adapter_lwip.c b/components/tcpip_adapter/tcpip_adapter_lwip.c index 307babe3a6..41000a9bc2 100644 --- a/components/tcpip_adapter/tcpip_adapter_lwip.c +++ b/components/tcpip_adapter/tcpip_adapter_lwip.c @@ -16,7 +16,6 @@ #include #include "tcpip_adapter_internal.h" - #if CONFIG_TCPIP_LWIP #include "lwip/inet.h" @@ -32,7 +31,9 @@ #include "lwip/netif.h" #endif #include "netif/wlanif.h" +#ifdef CONFIG_ETH_ENABLED #include "netif/ethernetif.h" +#endif #include "netif/nettestif.h" #include "dhcpserver/dhcpserver.h" @@ -232,8 +233,12 @@ static esp_err_t tcpip_adapter_start(tcpip_adapter_if_t tcpip_if, uint8_t *mac, esp_err_t tcpip_adapter_eth_start(uint8_t *mac, tcpip_adapter_ip_info_t *ip_info, void *args) { +#ifdef CONFIG_ETH_ENABLED esp_netif_init_fn[TCPIP_ADAPTER_IF_ETH] = ethernetif_init; return tcpip_adapter_start(TCPIP_ADAPTER_IF_ETH, mac, ip_info, args); +#else + return ESP_ERR_NOT_SUPPORTED; +#endif } esp_err_t tcpip_adapter_sta_start(uint8_t *mac, tcpip_adapter_ip_info_t *ip_info) @@ -1141,8 +1146,12 @@ static esp_err_t tcpip_adapter_dhcpc_stop_api(tcpip_adapter_api_msg_t *msg) esp_err_t tcpip_adapter_eth_input(void *buffer, uint16_t len, void *eb) { +#ifdef CONFIG_ETH_ENABLED ethernetif_input(esp_netif[TCPIP_ADAPTER_IF_ETH], buffer, len); return ESP_OK; +#else + return ESP_ERR_NOT_SUPPORTED; +#endif } esp_err_t tcpip_adapter_sta_input(void *buffer, uint16_t len, void *eb) diff --git a/components/ulp/include/esp32/ulp.h b/components/ulp/include/esp32/ulp.h index d55a8c6c7c..2f22937e28 100644 --- a/components/ulp/include/esp32/ulp.h +++ b/components/ulp/include/esp32/ulp.h @@ -18,6 +18,7 @@ #include #include "esp_err.h" #include "soc/soc.h" +#include "ulp_common.h" #ifdef __cplusplus extern "C" { @@ -111,15 +112,6 @@ extern "C" { #define SUB_OPCODE_MACRO_LABELPC 2 /*!< Label pointer macro */ /**@}*/ -/**@{*/ -#define ESP_ERR_ULP_BASE 0x1200 /*!< Offset for ULP-related error codes */ -#define ESP_ERR_ULP_SIZE_TOO_BIG (ESP_ERR_ULP_BASE + 1) /*!< Program doesn't fit into RTC memory reserved for the ULP */ -#define ESP_ERR_ULP_INVALID_LOAD_ADDR (ESP_ERR_ULP_BASE + 2) /*!< Load address is outside of RTC memory reserved for the ULP */ -#define ESP_ERR_ULP_DUPLICATE_LABEL (ESP_ERR_ULP_BASE + 3) /*!< More than one label with the same number was defined */ -#define ESP_ERR_ULP_UNDEFINED_LABEL (ESP_ERR_ULP_BASE + 4) /*!< Branch instructions references an undefined label */ -#define ESP_ERR_ULP_BRANCH_OUT_OF_RANGE (ESP_ERR_ULP_BASE + 5) /*!< Branch target is out of range of B instruction (try replacing with BX) */ -/**@}*/ - /** * @brief Instruction format structure @@ -135,7 +127,7 @@ extern "C" { * Preprocessor definitions provided below fill the fields of these structure with * the right arguments. */ -typedef union { +union ulp_insn { struct { uint32_t cycles : 16; /*!< Number of cycles to sleep */ @@ -295,7 +287,9 @@ typedef union { uint32_t instruction; /*!< Encoded instruction for ULP coprocessor */ -} ulp_insn_t; +}; + +typedef union ulp_insn ulp_insn_t; _Static_assert(sizeof(ulp_insn_t) == 4, "ULP coprocessor instruction size should be 4 bytes"); @@ -1046,80 +1040,7 @@ static inline uint32_t SOC_REG_TO_ULP_PERIPH_SEL(uint32_t reg) { #define RTC_SLOW_MEM ((uint32_t*) 0x50000000) /*!< RTC slow memory, 8k size */ -/** - * @brief Resolve all macro references in a program and load it into RTC memory - * @param load_addr address where the program should be loaded, expressed in 32-bit words - * @param program ulp_insn_t array with the program - * @param psize size of the program, expressed in 32-bit words - * @return - * - ESP_OK on success - * - ESP_ERR_NO_MEM if auxiliary temporary structure can not be allocated - * - one of ESP_ERR_ULP_xxx if program is not valid or can not be loaded - */ -esp_err_t ulp_process_macros_and_load(uint32_t load_addr, const ulp_insn_t* program, size_t* psize); - -/** - * @brief Load ULP program binary into RTC memory - * - * ULP program binary should have the following format (all values little-endian): - * - * 1. MAGIC, (value 0x00706c75, 4 bytes) - * 2. TEXT_OFFSET, offset of .text section from binary start (2 bytes) - * 3. TEXT_SIZE, size of .text section (2 bytes) - * 4. DATA_SIZE, size of .data section (2 bytes) - * 5. BSS_SIZE, size of .bss section (2 bytes) - * 6. (TEXT_OFFSET - 12) bytes of arbitrary data (will not be loaded into RTC memory) - * 7. .text section - * 8. .data section - * - * Linker script in components/ulp/ld/esp32.ulp.ld produces ELF files which - * correspond to this format. This linker script produces binaries with load_addr == 0. - * - * @param load_addr address where the program should be loaded, expressed in 32-bit words - * @param program_binary pointer to program binary - * @param program_size size of the program binary - * @return - * - ESP_OK on success - * - ESP_ERR_INVALID_ARG if load_addr is out of range - * - ESP_ERR_INVALID_SIZE if program_size doesn't match (TEXT_OFFSET + TEXT_SIZE + DATA_SIZE) - * - ESP_ERR_NOT_SUPPORTED if the magic number is incorrect - */ -esp_err_t ulp_load_binary(uint32_t load_addr, const uint8_t* program_binary, size_t program_size); - -/** - * @brief Run the program loaded into RTC memory - * @param entry_point entry point, expressed in 32-bit words - * @return ESP_OK on success - */ -esp_err_t ulp_run(uint32_t entry_point); - -/** - * @brief Set one of ULP wakeup period values - * - * ULP coprocessor starts running the program when the wakeup timer counts up - * to a given value (called period). There are 5 period values which can be - * programmed into SENS_ULP_CP_SLEEP_CYCx_REG registers, x = 0..4. - * By default, wakeup timer will use the period set into SENS_ULP_CP_SLEEP_CYC0_REG, - * i.e. period number 0. ULP program code can use SLEEP instruction to select - * which of the SENS_ULP_CP_SLEEP_CYCx_REG should be used for subsequent wakeups. - * - * However, please note that SLEEP instruction issued (from ULP program) while the system - * is in deep sleep mode does not have effect, and sleep cycle count 0 is used. - * - * @param period_index wakeup period setting number (0 - 4) - * @param period_us wakeup period, us - * @note The ULP FSM requires two clock cycles to wakeup before being able to run the program. - * Then additional 16 cycles are reserved after wakeup waiting until the 8M clock is stable. - * The FSM also requires two more clock cycles to go to sleep after the program execution is halted. - * The minimum wakeup period that may be set up for the ULP - * is equal to the total number of cycles spent on the above internal tasks. - * For a default configuration of the ULP running at 150kHz it makes about 133us. - * @return - * - ESP_OK on success - * - ESP_ERR_INVALID_ARG if period_index is out of range - */ -esp_err_t ulp_set_wakeup_period(size_t period_index, uint32_t period_us); #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/components/ulp/include/esp32s2beta/ulp.h b/components/ulp/include/esp32s2beta/ulp.h new file mode 100644 index 0000000000..58331cf52c --- /dev/null +++ b/components/ulp/include/esp32s2beta/ulp.h @@ -0,0 +1,839 @@ +// Copyright 2016-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. + +#pragma once +#include +#include +#include +#include "esp_err.h" +#include "soc/soc.h" +#include "ulp_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ULP_FSM_PREPARE_SLEEP_CYCLES 2 /*!< Cycles spent by FSM preparing ULP for sleep */ +#define ULP_FSM_WAKEUP_SLEEP_CYCLES 2 /*!< Cycles spent by FSM waking up ULP from sleep */ + +/** + * @defgroup ulp_registers ULP coprocessor registers + * @{ + */ + + +#define R0 0 /*!< general purpose register 0 */ +#define R1 1 /*!< general purpose register 1 */ +#define R2 2 /*!< general purpose register 2 */ +#define R3 3 /*!< general purpose register 3 */ +/**@}*/ + +/** @defgroup ulp_opcodes ULP coprocessor opcodes, sub opcodes, and various modifiers/flags + * + * These definitions are not intended to be used directly. + * They are used in definitions of instructions later on. + * + * @{ + */ + +#define OPCODE_WR_REG 1 /*!< Instruction: write peripheral register (RTC_CNTL/RTC_IO/SARADC) (not implemented yet) */ + +#define OPCODE_RD_REG 2 /*!< Instruction: read peripheral register (RTC_CNTL/RTC_IO/SARADC) (not implemented yet) */ + +#define RD_REG_PERIPH_RTC_CNTL 0 /*!< Identifier of RTC_CNTL peripheral for RD_REG and WR_REG instructions */ +#define RD_REG_PERIPH_RTC_IO 1 /*!< Identifier of RTC_IO peripheral for RD_REG and WR_REG instructions */ +#define RD_REG_PERIPH_SENS 2 /*!< Identifier of SARADC peripheral for RD_REG and WR_REG instructions */ +#define RD_REG_PERIPH_RTC_I2C 3 /*!< Identifier of RTC_I2C peripheral for RD_REG and WR_REG instructions */ + +#define OPCODE_I2C 3 /*!< Instruction: read/write I2C (not implemented yet) */ + +#define OPCODE_DELAY 4 /*!< Instruction: delay (nop) for a given number of cycles */ + +#define OPCODE_ADC 5 /*!< Instruction: SAR ADC measurement (not implemented yet) */ + +#define OPCODE_ST 6 /*!< Instruction: store indirect to RTC memory */ +#define SUB_OPCODE_ST 4 /*!< Store 32 bits, 16 MSBs contain PC, 16 LSBs contain value from source register */ + +#define OPCODE_ALU 7 /*!< Arithmetic instructions */ +#define SUB_OPCODE_ALU_REG 0 /*!< Arithmetic instruction, both source values are in register */ +#define SUB_OPCODE_ALU_IMM 1 /*!< Arithmetic instruction, one source value is an immediate */ +#define SUB_OPCODE_ALU_CNT 2 /*!< Arithmetic instruction between counter register and an immediate (not implemented yet)*/ +#define ALU_SEL_ADD 0 /*!< Addition */ +#define ALU_SEL_SUB 1 /*!< Subtraction */ +#define ALU_SEL_AND 2 /*!< Logical AND */ +#define ALU_SEL_OR 3 /*!< Logical OR */ +#define ALU_SEL_MOV 4 /*!< Copy value (immediate to destination register or source register to destination register */ +#define ALU_SEL_LSH 5 /*!< Shift left by given number of bits */ +#define ALU_SEL_RSH 6 /*!< Shift right by given number of bits */ + +#define OPCODE_BRANCH 8 /*!< Branch instructions */ +#define SUB_OPCODE_BX 0 /*!< Branch to absolute PC (immediate or in register) */ +#define BX_JUMP_TYPE_DIRECT 0 /*!< Unconditional jump */ +#define BX_JUMP_TYPE_ZERO 1 /*!< Branch if last ALU result is zero */ +#define BX_JUMP_TYPE_OVF 2 /*!< Branch if last ALU operation caused and overflow */ +#define SUB_OPCODE_B 1 /*!< Branch to a relative offset */ +#define B_CMP_L 0 /*!< Branch if R0 is less than an immediate */ +#define B_CMP_GE 1 /*!< Branch if R0 is greater than or equal to an immediate */ + +#define OPCODE_END 9 /*!< Stop executing the program */ +#define SUB_OPCODE_END 0 /*!< Stop executing the program and optionally wake up the chip */ +#define SUB_OPCODE_SLEEP 1 /*!< Stop executing the program and run it again after selected interval */ + +#define OPCODE_TSENS 10 /*!< Instruction: temperature sensor measurement (not implemented yet) */ + +#define OPCODE_HALT 11 /*!< Halt the coprocessor */ + +#define OPCODE_LD 13 /*!< Indirect load lower 16 bits from RTC memory */ + +#define OPCODE_MACRO 15 /*!< Not a real opcode. Used to identify labels and branches in the program */ +#define SUB_OPCODE_MACRO_LABEL 0 /*!< Label macro */ +#define SUB_OPCODE_MACRO_BRANCH 1 /*!< Branch macro */ +/**@}*/ + +/** + * @brief Instruction format structure + * + * All ULP instructions are 32 bit long. + * This union contains field layouts used by all of the supported instructions. + * This union also includes a special "macro" instruction layout. + * This is not a real instruction which can be executed by the CPU. It acts + * as a token which is removed from the program by the + * ulp_process_macros_and_load function. + * + * These structures are not intended to be used directly. + * Preprocessor definitions provided below fill the fields of these structure with + * the right arguments. + */ +union ulp_insn { + + struct { + uint32_t cycles : 16; /*!< Number of cycles to sleep */ + uint32_t unused : 12; /*!< Unused */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_DELAY) */ + } delay; /*!< Format of DELAY instruction */ + + struct { + uint32_t dreg : 2; /*!< Register which contains data to store */ + uint32_t sreg : 2; /*!< Register which contains address in RTC memory (expressed in words) */ + uint32_t unused1 : 6; /*!< Unused */ + uint32_t offset : 11; /*!< Offset to add to sreg */ + uint32_t unused2 : 4; /*!< Unused */ + uint32_t sub_opcode : 3; /*!< Sub opcode (SUB_OPCODE_ST) */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_ST) */ + } st; /*!< Format of ST instruction */ + + struct { + uint32_t dreg : 2; /*!< Register where the data should be loaded to */ + uint32_t sreg : 2; /*!< Register which contains address in RTC memory (expressed in words) */ + uint32_t unused1 : 6; /*!< Unused */ + uint32_t offset : 11; /*!< Offset to add to sreg */ + uint32_t unused2 : 7; /*!< Unused */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_LD) */ + } ld; /*!< Format of LD instruction */ + + struct { + uint32_t unused : 28; /*!< Unused */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_HALT) */ + } halt; /*!< Format of HALT instruction */ + + struct { + uint32_t dreg : 2; /*!< Register which contains target PC, expressed in words (used if .reg == 1) */ + uint32_t addr : 11; /*!< Target PC, expressed in words (used if .reg == 0) */ + uint32_t unused : 8; /*!< Unused */ + uint32_t reg : 1; /*!< Target PC in register (1) or immediate (0) */ + uint32_t type : 3; /*!< Jump condition (BX_JUMP_TYPE_xxx) */ + uint32_t sub_opcode : 3; /*!< Sub opcode (SUB_OPCODE_BX) */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_BRANCH) */ + } bx; /*!< Format of BRANCH instruction (absolute address) */ + + struct { + uint32_t imm : 16; /*!< Immediate value to compare against */ + uint32_t cmp : 1; /*!< Comparison to perform: B_CMP_L or B_CMP_GE */ + uint32_t offset : 7; /*!< Absolute value of target PC offset w.r.t. current PC, expressed in words */ + uint32_t sign : 1; /*!< Sign of target PC offset: 0: positive, 1: negative */ + uint32_t sub_opcode : 3; /*!< Sub opcode (SUB_OPCODE_B) */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_BRANCH) */ + } b; /*!< Format of BRANCH instruction (relative address) */ + + struct { + uint32_t dreg : 2; /*!< Destination register */ + uint32_t sreg : 2; /*!< Register with operand A */ + uint32_t treg : 2; /*!< Register with operand B */ + uint32_t unused : 15; /*!< Unused */ + uint32_t sel : 4; /*!< Operation to perform, one of ALU_SEL_xxx */ + uint32_t sub_opcode : 3; /*!< Sub opcode (SUB_OPCODE_ALU_REG) */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_ALU) */ + } alu_reg; /*!< Format of ALU instruction (both sources are registers) */ + + struct { + uint32_t dreg : 2; /*!< Destination register */ + uint32_t sreg : 2; /*!< Register with operand A */ + uint32_t imm : 16; /*!< Immediate value of operand B */ + uint32_t unused : 1; /*!< Unused */ + uint32_t sel : 4; /*!< Operation to perform, one of ALU_SEL_xxx */ + uint32_t sub_opcode : 3; /*!< Sub opcode (SUB_OPCODE_ALU_IMM) */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_ALU) */ + } alu_imm; /*!< Format of ALU instruction (one source is an immediate) */ + + struct { + uint32_t addr : 8; /*!< Address within either RTC_CNTL, RTC_IO, or SARADC */ + uint32_t periph_sel : 2; /*!< Select peripheral: RTC_CNTL (0), RTC_IO(1), SARADC(2) */ + uint32_t data : 8; /*!< 8 bits of data to write */ + uint32_t low : 5; /*!< Low bit */ + uint32_t high : 5; /*!< High bit */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_WR_REG) */ + } wr_reg; /*!< Format of WR_REG instruction */ + + struct { + uint32_t addr : 8; /*!< Address within either RTC_CNTL, RTC_IO, or SARADC */ + uint32_t periph_sel : 2; /*!< Select peripheral: RTC_CNTL (0), RTC_IO(1), SARADC(2) */ + uint32_t unused : 8; /*!< Unused */ + uint32_t low : 5; /*!< Low bit */ + uint32_t high : 5; /*!< High bit */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_WR_REG) */ + } rd_reg; /*!< Format of RD_REG instruction */ + + struct { + uint32_t dreg : 2; /*!< Register where to store ADC result */ + uint32_t mux : 4; /*!< Select SARADC pad (mux + 1) */ + uint32_t sar_sel : 1; /*!< Select SARADC0 (0) or SARADC1 (1) */ + uint32_t unused1 : 1; /*!< Unused */ + uint32_t cycles : 16; /*!< TBD, cycles used for measurement */ + uint32_t unused2 : 4; /*!< Unused */ + uint32_t opcode: 4; /*!< Opcode (OPCODE_ADC) */ + } adc; /*!< Format of ADC instruction */ + + struct { + uint32_t dreg : 2; /*!< Register where to store temperature measurement result */ + uint32_t wait_delay: 14; /*!< Cycles to wait after measurement is done */ + uint32_t reserved: 12; /*!< Reserved, set to 0 */ + uint32_t opcode: 4; /*!< Opcode (OPCODE_TSENS) */ + } tsens; /*!< Format of TSENS instruction */ + + struct { + uint32_t i2c_addr : 8; /*!< I2C slave address */ + uint32_t data : 8; /*!< Data to read or write */ + uint32_t low_bits : 3; /*!< TBD */ + uint32_t high_bits : 3; /*!< TBD */ + uint32_t i2c_sel : 4; /*!< TBD, select reg_i2c_slave_address[7:0] */ + uint32_t unused : 1; /*!< Unused */ + uint32_t rw : 1; /*!< Write (1) or read (0) */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_I2C) */ + } i2c; /*!< Format of I2C instruction */ + + struct { + uint32_t wakeup : 1; /*!< Set to 1 to wake up chip */ + uint32_t unused : 24; /*!< Unused */ + uint32_t sub_opcode : 3; /*!< Sub opcode (SUB_OPCODE_WAKEUP) */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_END) */ + } end; /*!< Format of END instruction with wakeup */ + + struct { + uint32_t cycle_sel : 4; /*!< Select which one of SARADC_ULP_CP_SLEEP_CYCx_REG to get the sleep duration from */ + uint32_t unused : 21; /*!< Unused */ + uint32_t sub_opcode : 3; /*!< Sub opcode (SUB_OPCODE_SLEEP) */ + uint32_t opcode : 4; /*!< Opcode (OPCODE_END) */ + } sleep; /*!< Format of END instruction with sleep */ + + struct { + uint32_t label : 16; /*!< Label number */ + uint32_t unused : 8; /*!< Unused */ + uint32_t sub_opcode : 4; /*!< SUB_OPCODE_MACRO_LABEL or SUB_OPCODE_MACRO_BRANCH */ + uint32_t opcode: 4; /*!< Opcode (OPCODE_MACRO) */ + } macro; /*!< Format of tokens used by LABEL and BRANCH macros */ + +}; + +typedef union ulp_insn ulp_insn_t; + +_Static_assert(sizeof(ulp_insn_t) == 4, "ULP coprocessor instruction size should be 4 bytes"); + +/** + * Delay (nop) for a given number of cycles + */ +#define I_DELAY(cycles_) { .delay = {\ + .cycles = cycles_, \ + .unused = 0, \ + .opcode = OPCODE_DELAY } } + +/** + * Halt the coprocessor. + * + * This instruction halts the coprocessor, but keeps ULP timer active. + * As such, ULP program will be restarted again by timer. + * To stop the program and prevent the timer from restarting the program, + * use I_END(0) instruction. + */ +#define I_HALT() { .halt = {\ + .unused = 0, \ + .opcode = OPCODE_HALT } } + +/** + * Map SoC peripheral register to periph_sel field of RD_REG and WR_REG + * instructions. + * + * @param reg peripheral register in RTC_CNTL_, RTC_IO_, SENS_, RTC_I2C peripherals. + * @return periph_sel value for the peripheral to which this register belongs. + */ +static inline uint32_t SOC_REG_TO_ULP_PERIPH_SEL(uint32_t reg) { + uint32_t ret = 3; + if (reg < DR_REG_RTCCNTL_BASE) { + assert(0 && "invalid register base"); + } else if (reg < DR_REG_RTCIO_BASE) { + ret = RD_REG_PERIPH_RTC_CNTL; + } else if (reg < DR_REG_SENS_BASE) { + ret = RD_REG_PERIPH_RTC_IO; + } else if (reg < DR_REG_RTC_I2C_BASE){ + ret = RD_REG_PERIPH_SENS; + } else if (reg < DR_REG_IO_MUX_BASE){ + ret = RD_REG_PERIPH_RTC_I2C; + } else { + assert(0 && "invalid register base"); + } + return ret; +} + +/** + * Write literal value to a peripheral register + * + * reg[high_bit : low_bit] = val + * This instruction can access RTC_CNTL_, RTC_IO_, SENS_, and RTC_I2C peripheral registers. + */ +#define I_WR_REG(reg, low_bit, high_bit, val) {.wr_reg = {\ + .addr = (reg & 0xff) / sizeof(uint32_t), \ + .periph_sel = SOC_REG_TO_ULP_PERIPH_SEL(reg), \ + .data = val, \ + .low = low_bit, \ + .high = high_bit, \ + .opcode = OPCODE_WR_REG } } + +/** + * Read from peripheral register into R0 + * + * R0 = reg[high_bit : low_bit] + * This instruction can access RTC_CNTL_, RTC_IO_, SENS_, and RTC_I2C peripheral registers. + */ +#define I_RD_REG(reg, low_bit, high_bit) {.rd_reg = {\ + .addr = (reg & 0xff) / sizeof(uint32_t), \ + .periph_sel = SOC_REG_TO_ULP_PERIPH_SEL(reg), \ + .unused = 0, \ + .low = low_bit, \ + .high = high_bit, \ + .opcode = OPCODE_RD_REG } } + +/** + * Set or clear a bit in the peripheral register. + * + * Sets bit (1 << shift) of register reg to value val. + * This instruction can access RTC_CNTL_, RTC_IO_, SENS_, and RTC_I2C peripheral registers. + */ +#define I_WR_REG_BIT(reg, shift, val) I_WR_REG(reg, shift, shift, val) + +/** + * Wake the SoC from deep sleep. + * + * This instruction initiates wake up from deep sleep. + * Use esp_deep_sleep_enable_ulp_wakeup to enable deep sleep wakeup + * triggered by the ULP before going into deep sleep. + * Note that ULP program will still keep running until the I_HALT + * instruction, and it will still be restarted by timer at regular + * intervals, even when the SoC is woken up. + * + * To stop the ULP program, use I_HALT instruction. + * + * To disable the timer which start ULP program, use I_END() + * instruction. I_END instruction clears the + * RTC_CNTL_ULP_CP_SLP_TIMER_EN_S bit of RTC_CNTL_STATE0_REG + * register, which controls the ULP timer. + */ +#define I_WAKE() { .end = { \ + .wakeup = 1, \ + .unused = 0, \ + .sub_opcode = SUB_OPCODE_END, \ + .opcode = OPCODE_END } } + +/** + * Stop ULP program timer. + * + * This is a convenience macro which disables the ULP program timer. + * Once this instruction is used, ULP program will not be restarted + * anymore until ulp_run function is called. + * + * ULP program will continue running after this instruction. To stop + * the currently running program, use I_HALT(). + */ +#define I_END() \ + I_WR_REG_BIT(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN_S, 0) +/** + * Select the time interval used to run ULP program. + * + * This instructions selects which of the SENS_SLEEP_CYCLES_Sx + * registers' value is used by the ULP program timer. + * When the ULP program stops at I_HALT instruction, ULP program + * timer start counting. When the counter reaches the value of + * the selected SENS_SLEEP_CYCLES_Sx register, ULP program + * start running again from the start address (passed to the ulp_run + * function). + * There are 5 SENS_SLEEP_CYCLES_Sx registers, so 0 <= timer_idx < 5. + * + * By default, SENS_SLEEP_CYCLES_S0 register is used by the ULP + * program timer. + */ +#define I_SLEEP_CYCLE_SEL(timer_idx) { .sleep = { \ + .cycle_sel = timer_idx, \ + .unused = 0, \ + .sub_opcode = SUB_OPCODE_SLEEP, \ + .opcode = OPCODE_END } } + +/** + * Perform temperature sensor measurement and store it into reg_dest. + * + * Delay can be set between 1 and ((1 << 14) - 1). Higher values give + * higher measurement resolution. + */ +#define I_TSENS(reg_dest, delay) { .tsens = { \ + .dreg = reg_dest, \ + .wait_delay = delay, \ + .reserved = 0, \ + .opcode = OPCODE_TSENS } } + +/** + * Perform ADC measurement and store result in reg_dest. + * + * adc_idx selects ADC (0 or 1). + * pad_idx selects ADC pad (0 - 7). + */ +#define I_ADC(reg_dest, adc_idx, pad_idx) { .adc = {\ + .dreg = reg_dest, \ + .mux = pad_idx + 1, \ + .sar_sel = adc_idx, \ + .unused1 = 0, \ + .cycles = 0, \ + .unused2 = 0, \ + .opcode = OPCODE_ADC } } + +/** + * Store value from register reg_val into RTC memory. + * + * The value is written to an offset calculated by adding value of + * reg_addr register and offset_ field (this offset is expressed in 32-bit words). + * 32 bits written to RTC memory are built as follows: + * - bits [31:21] hold the PC of current instruction, expressed in 32-bit words + * - bits [20:16] = 5'b1 + * - bits [15:0] are assigned the contents of reg_val + * + * RTC_SLOW_MEM[addr + offset_] = { 5'b0, insn_PC[10:0], val[15:0] } + */ +#define I_ST(reg_val, reg_addr, offset_) { .st = { \ + .dreg = reg_val, \ + .sreg = reg_addr, \ + .unused1 = 0, \ + .offset = offset_, \ + .unused2 = 0, \ + .sub_opcode = SUB_OPCODE_ST, \ + .opcode = OPCODE_ST } } + + +/** + * Load value from RTC memory into reg_dest register. + * + * Loads 16 LSBs from RTC memory word given by the sum of value in reg_addr and + * value of offset_. + */ +#define I_LD(reg_dest, reg_addr, offset_) { .ld = { \ + .dreg = reg_dest, \ + .sreg = reg_addr, \ + .unused1 = 0, \ + .offset = offset_, \ + .unused2 = 0, \ + .opcode = OPCODE_LD } } + + +/** + * Branch relative if R0 less than immediate value. + * + * pc_offset is expressed in words, and can be from -127 to 127 + * imm_value is a 16-bit value to compare R0 against + */ +#define I_BL(pc_offset, imm_value) { .b = { \ + .imm = imm_value, \ + .cmp = B_CMP_L, \ + .offset = abs(pc_offset), \ + .sign = (pc_offset >= 0) ? 0 : 1, \ + .sub_opcode = SUB_OPCODE_B, \ + .opcode = OPCODE_BRANCH } } + +/** + * Branch relative if R0 greater or equal than immediate value. + * + * pc_offset is expressed in words, and can be from -127 to 127 + * imm_value is a 16-bit value to compare R0 against + */ +#define I_BGE(pc_offset, imm_value) { .b = { \ + .imm = imm_value, \ + .cmp = B_CMP_GE, \ + .offset = abs(pc_offset), \ + .sign = (pc_offset >= 0) ? 0 : 1, \ + .sub_opcode = SUB_OPCODE_B, \ + .opcode = OPCODE_BRANCH } } + +/** + * Unconditional branch to absolute PC, address in register. + * + * reg_pc is the register which contains address to jump to. + * Address is expressed in 32-bit words. + */ +#define I_BXR(reg_pc) { .bx = { \ + .dreg = reg_pc, \ + .addr = 0, \ + .unused = 0, \ + .reg = 1, \ + .type = BX_JUMP_TYPE_DIRECT, \ + .sub_opcode = SUB_OPCODE_BX, \ + .opcode = OPCODE_BRANCH } } + +/** + * Unconditional branch to absolute PC, immediate address. + * + * Address imm_pc is expressed in 32-bit words. + */ +#define I_BXI(imm_pc) { .bx = { \ + .dreg = 0, \ + .addr = imm_pc, \ + .unused = 0, \ + .reg = 0, \ + .type = BX_JUMP_TYPE_DIRECT, \ + .sub_opcode = SUB_OPCODE_BX, \ + .opcode = OPCODE_BRANCH } } + +/** + * Branch to absolute PC if ALU result is zero, address in register. + * + * reg_pc is the register which contains address to jump to. + * Address is expressed in 32-bit words. + */ +#define I_BXZR(reg_pc) { .bx = { \ + .dreg = reg_pc, \ + .addr = 0, \ + .unused = 0, \ + .reg = 1, \ + .type = BX_JUMP_TYPE_ZERO, \ + .sub_opcode = SUB_OPCODE_BX, \ + .opcode = OPCODE_BRANCH } } + +/** + * Branch to absolute PC if ALU result is zero, immediate address. + * + * Address imm_pc is expressed in 32-bit words. + */ +#define I_BXZI(imm_pc) { .bx = { \ + .dreg = 0, \ + .addr = imm_pc, \ + .unused = 0, \ + .reg = 0, \ + .type = BX_JUMP_TYPE_ZERO, \ + .sub_opcode = SUB_OPCODE_BX, \ + .opcode = OPCODE_BRANCH } } + +/** + * Branch to absolute PC if ALU overflow, address in register + * + * reg_pc is the register which contains address to jump to. + * Address is expressed in 32-bit words. + */ +#define I_BXFR(reg_pc) { .bx = { \ + .dreg = reg_pc, \ + .addr = 0, \ + .unused = 0, \ + .reg = 1, \ + .type = BX_JUMP_TYPE_OVF, \ + .sub_opcode = SUB_OPCODE_BX, \ + .opcode = OPCODE_BRANCH } } + +/** + * Branch to absolute PC if ALU overflow, immediate address + * + * Address imm_pc is expressed in 32-bit words. + */ +#define I_BXFI(imm_pc) { .bx = { \ + .dreg = 0, \ + .addr = imm_pc, \ + .unused = 0, \ + .reg = 0, \ + .type = BX_JUMP_TYPE_OVF, \ + .sub_opcode = SUB_OPCODE_BX, \ + .opcode = OPCODE_BRANCH } } + + +/** + * Addition: dest = src1 + src2 + */ +#define I_ADDR(reg_dest, reg_src1, reg_src2) { .alu_reg = { \ + .dreg = reg_dest, \ + .sreg = reg_src1, \ + .treg = reg_src2, \ + .unused = 0, \ + .sel = ALU_SEL_ADD, \ + .sub_opcode = SUB_OPCODE_ALU_REG, \ + .opcode = OPCODE_ALU } } + +/** + * Subtraction: dest = src1 - src2 + */ +#define I_SUBR(reg_dest, reg_src1, reg_src2) { .alu_reg = { \ + .dreg = reg_dest, \ + .sreg = reg_src1, \ + .treg = reg_src2, \ + .unused = 0, \ + .sel = ALU_SEL_SUB, \ + .sub_opcode = SUB_OPCODE_ALU_REG, \ + .opcode = OPCODE_ALU } } + +/** + * Logical AND: dest = src1 & src2 + */ +#define I_ANDR(reg_dest, reg_src1, reg_src2) { .alu_reg = { \ + .dreg = reg_dest, \ + .sreg = reg_src1, \ + .treg = reg_src2, \ + .unused = 0, \ + .sel = ALU_SEL_AND, \ + .sub_opcode = SUB_OPCODE_ALU_REG, \ + .opcode = OPCODE_ALU } } + +/** + * Logical OR: dest = src1 | src2 + */ +#define I_ORR(reg_dest, reg_src1, reg_src2) { .alu_reg = { \ + .dreg = reg_dest, \ + .sreg = reg_src1, \ + .treg = reg_src2, \ + .unused = 0, \ + .sel = ALU_SEL_OR, \ + .sub_opcode = SUB_OPCODE_ALU_REG, \ + .opcode = OPCODE_ALU } } + +/** + * Copy: dest = src + */ +#define I_MOVR(reg_dest, reg_src) { .alu_reg = { \ + .dreg = reg_dest, \ + .sreg = reg_src, \ + .treg = 0, \ + .unused = 0, \ + .sel = ALU_SEL_MOV, \ + .sub_opcode = SUB_OPCODE_ALU_REG, \ + .opcode = OPCODE_ALU } } + +/** + * Logical shift left: dest = src << shift + */ +#define I_LSHR(reg_dest, reg_src, reg_shift) { .alu_reg = { \ + .dreg = reg_dest, \ + .sreg = reg_src, \ + .treg = reg_shift, \ + .unused = 0, \ + .sel = ALU_SEL_LSH, \ + .sub_opcode = SUB_OPCODE_ALU_REG, \ + .opcode = OPCODE_ALU } } + + +/** + * Logical shift right: dest = src >> shift + */ +#define I_RSHR(reg_dest, reg_src, reg_shift) { .alu_reg = { \ + .dreg = reg_dest, \ + .sreg = reg_src, \ + .treg = reg_shift, \ + .unused = 0, \ + .sel = ALU_SEL_RSH, \ + .sub_opcode = SUB_OPCODE_ALU_REG, \ + .opcode = OPCODE_ALU } } + +/** + * Add register and an immediate value: dest = src1 + imm + */ +#define I_ADDI(reg_dest, reg_src, imm_) { .alu_imm = { \ + .dreg = reg_dest, \ + .sreg = reg_src, \ + .imm = imm_, \ + .unused = 0, \ + .sel = ALU_SEL_ADD, \ + .sub_opcode = SUB_OPCODE_ALU_IMM, \ + .opcode = OPCODE_ALU } } + + +/** + * Subtract register and an immediate value: dest = src - imm + */ +#define I_SUBI(reg_dest, reg_src, imm_) { .alu_imm = { \ + .dreg = reg_dest, \ + .sreg = reg_src, \ + .imm = imm_, \ + .unused = 0, \ + .sel = ALU_SEL_SUB, \ + .sub_opcode = SUB_OPCODE_ALU_IMM, \ + .opcode = OPCODE_ALU } } + +/** + * Logical AND register and an immediate value: dest = src & imm + */ +#define I_ANDI(reg_dest, reg_src, imm_) { .alu_imm = { \ + .dreg = reg_dest, \ + .sreg = reg_src, \ + .imm = imm_, \ + .unused = 0, \ + .sel = ALU_SEL_AND, \ + .sub_opcode = SUB_OPCODE_ALU_IMM, \ + .opcode = OPCODE_ALU } } + +/** + * Logical OR register and an immediate value: dest = src | imm + */ +#define I_ORI(reg_dest, reg_src, imm_) { .alu_imm = { \ + .dreg = reg_dest, \ + .sreg = reg_src, \ + .imm = imm_, \ + .unused = 0, \ + .sel = ALU_SEL_OR, \ + .sub_opcode = SUB_OPCODE_ALU_IMM, \ + .opcode = OPCODE_ALU } } + +/** + * Copy an immediate value into register: dest = imm + */ +#define I_MOVI(reg_dest, imm_) { .alu_imm = { \ + .dreg = reg_dest, \ + .sreg = 0, \ + .imm = imm_, \ + .unused = 0, \ + .sel = ALU_SEL_MOV, \ + .sub_opcode = SUB_OPCODE_ALU_IMM, \ + .opcode = OPCODE_ALU } } + +/** + * Logical shift left register value by an immediate: dest = src << imm + */ +#define I_LSHI(reg_dest, reg_src, imm_) { .alu_imm = { \ + .dreg = reg_dest, \ + .sreg = reg_src, \ + .imm = imm_, \ + .unused = 0, \ + .sel = ALU_SEL_LSH, \ + .sub_opcode = SUB_OPCODE_ALU_IMM, \ + .opcode = OPCODE_ALU } } + + +/** + * Logical shift right register value by an immediate: dest = val >> imm + */ +#define I_RSHI(reg_dest, reg_src, imm_) { .alu_imm = { \ + .dreg = reg_dest, \ + .sreg = reg_src, \ + .imm = imm_, \ + .unused = 0, \ + .sel = ALU_SEL_RSH, \ + .sub_opcode = SUB_OPCODE_ALU_IMM, \ + .opcode = OPCODE_ALU } } + +/** + * Define a label with number label_num. + * + * This is a macro which doesn't generate a real instruction. + * The token generated by this macro is removed by ulp_process_macros_and_load + * function. Label defined using this macro can be used in branch macros defined + * below. + */ +#define M_LABEL(label_num) { .macro = { \ + .label = label_num, \ + .unused = 0, \ + .sub_opcode = SUB_OPCODE_MACRO_LABEL, \ + .opcode = OPCODE_MACRO } } + +/** + * Token macro used by M_B and M_BX macros. Not to be used directly. + */ +#define M_BRANCH(label_num) { .macro = { \ + .label = label_num, \ + .unused = 0, \ + .sub_opcode = SUB_OPCODE_MACRO_BRANCH, \ + .opcode = OPCODE_MACRO } } + +/** + * Macro: branch to label label_num if R0 is less than immediate value. + * + * This macro generates two ulp_insn_t values separated by a comma, and should + * be used when defining contents of ulp_insn_t arrays. First value is not a + * real instruction; it is a token which is removed by ulp_process_macros_and_load + * function. + */ +#define M_BL(label_num, imm_value) \ + M_BRANCH(label_num), \ + I_BL(0, imm_value) + +/** + * Macro: branch to label label_num if R0 is greater or equal than immediate value + * + * This macro generates two ulp_insn_t values separated by a comma, and should + * be used when defining contents of ulp_insn_t arrays. First value is not a + * real instruction; it is a token which is removed by ulp_process_macros_and_load + * function. + */ +#define M_BGE(label_num, imm_value) \ + M_BRANCH(label_num), \ + I_BGE(0, imm_value) + +/** + * Macro: unconditional branch to label + * + * This macro generates two ulp_insn_t values separated by a comma, and should + * be used when defining contents of ulp_insn_t arrays. First value is not a + * real instruction; it is a token which is removed by ulp_process_macros_and_load + * function. + */ +#define M_BX(label_num) \ + M_BRANCH(label_num), \ + I_BXI(0) + +/** + * Macro: branch to label if ALU result is zero + * + * This macro generates two ulp_insn_t values separated by a comma, and should + * be used when defining contents of ulp_insn_t arrays. First value is not a + * real instruction; it is a token which is removed by ulp_process_macros_and_load + * function. + */ +#define M_BXZ(label_num) \ + M_BRANCH(label_num), \ + I_BXZI(0) + +/** + * Macro: branch to label if ALU overflow + * + * This macro generates two ulp_insn_t values separated by a comma, and should + * be used when defining contents of ulp_insn_t arrays. First value is not a + * real instruction; it is a token which is removed by ulp_process_macros_and_load + * function. + */ +#define M_BXF(label_num) \ + M_BRANCH(label_num), \ + I_BXFI(0) + + + +#define RTC_SLOW_MEM ((uint32_t*) 0x50000000) /*!< RTC slow memory, 8k size */ + +#ifdef __cplusplus +} +#endif diff --git a/components/ulp/include/ulp_common.h b/components/ulp/include/ulp_common.h new file mode 100644 index 0000000000..b7c773d658 --- /dev/null +++ b/components/ulp/include/ulp_common.h @@ -0,0 +1,113 @@ +// Copyright 2016-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. +#pragma once + +/* This file contains definitions that are common between esp32/ulp.h + and esp32s2beta/ulp.h +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/**@{*/ +#define ESP_ERR_ULP_BASE 0x1200 /*!< Offset for ULP-related error codes */ +#define ESP_ERR_ULP_SIZE_TOO_BIG (ESP_ERR_ULP_BASE + 1) /*!< Program doesn't fit into RTC memory reserved for the ULP */ +#define ESP_ERR_ULP_INVALID_LOAD_ADDR (ESP_ERR_ULP_BASE + 2) /*!< Load address is outside of RTC memory reserved for the ULP */ +#define ESP_ERR_ULP_DUPLICATE_LABEL (ESP_ERR_ULP_BASE + 3) /*!< More than one label with the same number was defined */ +#define ESP_ERR_ULP_UNDEFINED_LABEL (ESP_ERR_ULP_BASE + 4) /*!< Branch instructions references an undefined label */ +#define ESP_ERR_ULP_BRANCH_OUT_OF_RANGE (ESP_ERR_ULP_BASE + 5) /*!< Branch target is out of range of B instruction (try replacing with BX) */ +/**@}*/ + +union ulp_insn; // Declared in the chip-specific ulp.h header + +typedef union ulp_insn ulp_insn_t; + +/** + * @brief Resolve all macro references in a program and load it into RTC memory + * @param load_addr address where the program should be loaded, expressed in 32-bit words + * @param program ulp_insn_t array with the program + * @param psize size of the program, expressed in 32-bit words + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM if auxiliary temporary structure can not be allocated + * - one of ESP_ERR_ULP_xxx if program is not valid or can not be loaded + */ +esp_err_t ulp_process_macros_and_load(uint32_t load_addr, const ulp_insn_t* program, size_t* psize); + +/** + * @brief Load ULP program binary into RTC memory + * + * ULP program binary should have the following format (all values little-endian): + * + * 1. MAGIC, (value 0x00706c75, 4 bytes) + * 2. TEXT_OFFSET, offset of .text section from binary start (2 bytes) + * 3. TEXT_SIZE, size of .text section (2 bytes) + * 4. DATA_SIZE, size of .data section (2 bytes) + * 5. BSS_SIZE, size of .bss section (2 bytes) + * 6. (TEXT_OFFSET - 12) bytes of arbitrary data (will not be loaded into RTC memory) + * 7. .text section + * 8. .data section + * + * Linker script in components/ulp/ld/esp32.ulp.ld produces ELF files which + * correspond to this format. This linker script produces binaries with load_addr == 0. + * + * @param load_addr address where the program should be loaded, expressed in 32-bit words + * @param program_binary pointer to program binary + * @param program_size size of the program binary + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if load_addr is out of range + * - ESP_ERR_INVALID_SIZE if program_size doesn't match (TEXT_OFFSET + TEXT_SIZE + DATA_SIZE) + * - ESP_ERR_NOT_SUPPORTED if the magic number is incorrect + */ +esp_err_t ulp_load_binary(uint32_t load_addr, const uint8_t* program_binary, size_t program_size); + +/** + * @brief Run the program loaded into RTC memory + * @param entry_point entry point, expressed in 32-bit words + * @return ESP_OK on success + */ +esp_err_t ulp_run(uint32_t entry_point); + +/** + * @brief Set one of ULP wakeup period values + * + * ULP coprocessor starts running the program when the wakeup timer counts up + * to a given value (called period). There are 5 period values which can be + * programmed into SENS_ULP_CP_SLEEP_CYCx_REG registers, x = 0..4. + * By default, wakeup timer will use the period set into SENS_ULP_CP_SLEEP_CYC0_REG, + * i.e. period number 0. ULP program code can use SLEEP instruction to select + * which of the SENS_ULP_CP_SLEEP_CYCx_REG should be used for subsequent wakeups. + * + * However, please note that SLEEP instruction issued (from ULP program) while the system + * is in deep sleep mode does not have effect, and sleep cycle count 0 is used. + * + * @param period_index wakeup period setting number (0 - 4) + * @param period_us wakeup period, us + * @note The ULP FSM requires two clock cycles to wakeup before being able to run the program. + * Then additional 16 cycles are reserved after wakeup waiting until the 8M clock is stable. + * The FSM also requires two more clock cycles to go to sleep after the program execution is halted. + * The minimum wakeup period that may be set up for the ULP + * is equal to the total number of cycles spent on the above internal tasks. + * For a default configuration of the ULP running at 150kHz it makes about 133us. + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if period_index is out of range + */ +esp_err_t ulp_set_wakeup_period(size_t period_index, uint32_t period_us); + +#ifdef __cplusplus +} +#endif diff --git a/components/ulp/test/CMakeLists.txt b/components/ulp/test/CMakeLists.txt index 27311f9530..bbcb38f156 100644 --- a/components/ulp/test/CMakeLists.txt +++ b/components/ulp/test/CMakeLists.txt @@ -1,8 +1,10 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." - REQUIRES unity ulp soc esp_common) +if(IDF_TARGET STREQUAL "esp32") + idf_component_register(SRC_DIRS esp32 + INCLUDE_DIRS . + REQUIRES unity ulp soc esp_common) -set(ulp_app_name ulp_test_app) -set(ulp_s_sources "ulp/test_jumps.S") -set(ulp_exp_dep_srcs "test_ulp_as.c") -ulp_embed_binary(${ulp_app_name} ${ulp_s_sources} ${ulp_exp_dep_srcs}) + set(ulp_app_name ulp_test_app) + set(ulp_s_sources "ulp/test_jumps_esp32.S") + set(ulp_exp_dep_srcs "esp32/test_ulp_as.c") + ulp_embed_binary(${ulp_app_name} ${ulp_s_sources} ${ulp_exp_dep_srcs}) +endif() diff --git a/components/ulp/test/component.mk b/components/ulp/test/component.mk index 84d7727d7e..7cd2406dec 100644 --- a/components/ulp/test/component.mk +++ b/components/ulp/test/component.mk @@ -1,11 +1,13 @@ ULP_APP_NAME = ulp_test_app +COMPONENT_SRCDIRS += esp32 + ULP_S_SOURCES = $(addprefix $(COMPONENT_PATH)/ulp/, \ - test_jumps.S \ + test_jumps_esp32.S \ ) -ULP_EXP_DEP_OBJECTS := test_ulp_as.o - +ULP_EXP_DEP_OBJECTS := esp32/test_ulp_as.o + include $(IDF_PATH)/components/ulp/component_ulp_common.mk COMPONENT_ADD_LDFLAGS += -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive diff --git a/components/ulp/test/test_ulp.c b/components/ulp/test/esp32/test_ulp.c similarity index 100% rename from components/ulp/test/test_ulp.c rename to components/ulp/test/esp32/test_ulp.c diff --git a/components/ulp/test/test_ulp_as.c b/components/ulp/test/esp32/test_ulp_as.c similarity index 100% rename from components/ulp/test/test_ulp_as.c rename to components/ulp/test/esp32/test_ulp_as.c diff --git a/components/ulp/test/ulp/test_jumps.S b/components/ulp/test/ulp/test_jumps_esp32.S similarity index 100% rename from components/ulp/test/ulp/test_jumps.S rename to components/ulp/test/ulp/test_jumps_esp32.S diff --git a/components/ulp/ulp.c b/components/ulp/ulp.c index 31a393b865..34d8531253 100644 --- a/components/ulp/ulp.c +++ b/components/ulp/ulp.c @@ -15,19 +15,24 @@ #include #include #include - +#include "sdkconfig.h" #include "esp_attr.h" #include "esp_err.h" #include "esp_log.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/clk.h" #include "esp32/ulp.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/clk.h" +#include "esp32s2beta/ulp.h" +#endif #include "soc/soc.h" #include "soc/rtc.h" #include "soc/rtc_cntl_reg.h" #include "soc/sens_reg.h" -#include "sdkconfig.h" +#include "ulp_private.h" typedef struct { uint32_t magic; @@ -43,6 +48,7 @@ static const char* TAG = "ulp"; esp_err_t ulp_run(uint32_t entry_point) { +#if CONFIG_IDF_TARGET_ESP32 // disable ULP timer CLEAR_PERI_REG_MASK(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN); // wait for at least 1 RTC_SLOW_CLK cycle @@ -59,6 +65,7 @@ esp_err_t ulp_run(uint32_t entry_point) SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BIAS_SLEEP_FOLW_8M); // enable ULP timer SET_PERI_REG_MASK(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN); +#endif return ESP_OK; } @@ -70,10 +77,10 @@ esp_err_t ulp_load_binary(uint32_t load_addr, const uint8_t* program_binary, siz if (program_size_bytes < sizeof(ulp_binary_header_t)) { return ESP_ERR_INVALID_SIZE; } - if (load_addr_bytes > CONFIG_ESP32_ULP_COPROC_RESERVE_MEM) { + if (load_addr_bytes > ULP_RESERVE_MEM) { return ESP_ERR_INVALID_ARG; } - if (load_addr_bytes + program_size_bytes > CONFIG_ESP32_ULP_COPROC_RESERVE_MEM) { + if (load_addr_bytes + program_size_bytes > ULP_RESERVE_MEM) { return ESP_ERR_INVALID_SIZE; } @@ -107,12 +114,13 @@ esp_err_t ulp_load_binary(uint32_t load_addr, const uint8_t* program_binary, siz esp_err_t ulp_set_wakeup_period(size_t period_index, uint32_t period_us) { +#if CONFIG_IDF_TARGET_ESP32 if (period_index > 4) { return ESP_ERR_INVALID_ARG; } uint64_t period_us_64 = period_us; uint64_t period_cycles = (period_us_64 << RTC_CLK_CAL_FRACT) / esp_clk_slowclk_cal_get(); - uint64_t min_sleep_period_cycles = ULP_FSM_PREPARE_SLEEP_CYCLES + uint64_t min_sleep_period_cycles = ULP_FSM_PREPARE_SLEEP_CYCLES + ULP_FSM_WAKEUP_SLEEP_CYCLES + REG_GET_FIELD(RTC_CNTL_TIMER2_REG, RTC_CNTL_ULPCP_TOUCH_START_WAIT); if (period_cycles < min_sleep_period_cycles) { @@ -123,5 +131,6 @@ esp_err_t ulp_set_wakeup_period(size_t period_index, uint32_t period_us) } REG_SET_FIELD(SENS_ULP_CP_SLEEP_CYC0_REG + period_index * sizeof(uint32_t), SENS_SLEEP_CYCLES_S0, (uint32_t) period_cycles); +#endif return ESP_OK; } diff --git a/components/ulp/ulp_macro.c b/components/ulp/ulp_macro.c index 619094ae53..919519ebbd 100644 --- a/components/ulp/ulp_macro.c +++ b/components/ulp/ulp_macro.c @@ -20,6 +20,7 @@ #include "esp_err.h" #include "esp_log.h" #include "esp32/ulp.h" +#include "ulp_private.h" #include "soc/soc.h" #include "soc/rtc_cntl_reg.h" @@ -194,7 +195,7 @@ esp_err_t ulp_process_macros_and_load(uint32_t load_addr, const ulp_insn_t* prog ++read_ptr; } size_t real_program_size = *psize - macro_count; - const size_t ulp_mem_end = CONFIG_ESP32_ULP_COPROC_RESERVE_MEM / sizeof(ulp_insn_t); + const size_t ulp_mem_end = ULP_RESERVE_MEM / sizeof(ulp_insn_t); if (load_addr > ulp_mem_end) { ESP_LOGW(TAG, "invalid load address %x, max is %x", load_addr, ulp_mem_end); diff --git a/components/ulp/ulp_private.h b/components/ulp/ulp_private.h new file mode 100644 index 0000000000..3d5b281493 --- /dev/null +++ b/components/ulp/ulp_private.h @@ -0,0 +1,21 @@ +// Copyright 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. + +#pragma once + +#ifdef CONFIG_ESP32_ULP_COPROC_RESERVE_MEM +#define ULP_RESERVE_MEM CONFIG_ESP32_ULP_COPROC_RESERVE_MEM +#else +#define ULP_RESERVE_MEM CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM +#endif diff --git a/components/unity/include/unity_test_runner.h b/components/unity/include/unity_test_runner.h index e9e46ebd43..8e8b5a3dae 100644 --- a/components/unity/include/unity_test_runner.h +++ b/components/unity/include/unity_test_runner.h @@ -130,6 +130,8 @@ void unity_testcase_register(test_desc_t* desc); unity_testcase_register( & UNITY_TEST_UID(test_desc_) ); \ } + + /* * First argument is a free-form description, * second argument is (by convention) a list of identifiers, each one in square brackets. @@ -172,3 +174,14 @@ void unity_run_all_tests(void); void unity_run_menu(void); +#include "sdkconfig.h" +#if CONFIG_IDF_TARGET_ESP32 +#define TEST_CASE_ESP32(...) TEST_CASE(__VA_ARGS__) +#define TEST_CASE_MULTIPLE_STAGES_ESP32(...) TEST_CASE_MULTIPLE_STAGES(__VA_ARGS__) +#define TEST_CASE_MULTIPLE_DEVICES_ESP32(...) TEST_CASE_MULTIPLE_DEVICES(__VA_ARGS__) +#else +#define TEST_CASE_ESP32(...) __attribute__((unused)) static void UNITY_TEST_UID(test_func_) (void) +#define TEST_CASE_MULTIPLE_STAGES_ESP32(_, __, ...) __attribute__((unused)) static test_func UNITY_TEST_UID(test_functions)[] = {__VA_ARGS__}; +#define TEST_CASE_MULTIPLE_DEVICES_ESP32(_, __, ...) __attribute__((unused)) static test_func UNITY_TEST_UID(test_functions)[] = {__VA_ARGS__}; + +#endif diff --git a/components/unity/unity_port_esp32.c b/components/unity/unity_port_esp32.c index 2517cd94c0..dcc01156bf 100644 --- a/components/unity/unity_port_esp32.c +++ b/components/unity/unity_port_esp32.c @@ -14,9 +14,14 @@ #include #include "unity.h" #include "sdkconfig.h" +#include "soc/cpu.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/clk.h" #include "esp32/rom/uart.h" -#include "soc/cpu.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/clk.h" +#include "esp32s2beta/rom/uart.h" +#endif static uint32_t s_test_start, s_test_stop; diff --git a/components/vfs/test/CMakeLists.txt b/components/vfs/test/CMakeLists.txt index f0a24edd9f..2e15ead8db 100644 --- a/components/vfs/test/CMakeLists.txt +++ b/components/vfs/test/CMakeLists.txt @@ -1,4 +1,10 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." - REQUIRES unity test_utils vfs fatfs spiffs - LDFRAGMENTS linker.lf) \ No newline at end of file +set(srcdirs ".") +if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcdirs "esp32") +endif() + +idf_component_register(SRC_DIRS ${srcdirs} + INCLUDE_DIRS . + REQUIRES unity test_utils vfs fatfs spiffs + LDFRAGMENTS linker.lf + ) diff --git a/components/vfs/test/component.mk b/components/vfs/test/component.mk index 5650ced1ee..5ad4f756e5 100644 --- a/components/vfs/test/component.mk +++ b/components/vfs/test/component.mk @@ -1,3 +1,4 @@ COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive +COMPONENT_SRCDIRS += esp32 COMPONENT_ADD_LDFRAGMENTS += linker.lf diff --git a/components/vfs/test/test_vfs_uart.c b/components/vfs/test/esp32/test_vfs_uart.c similarity index 100% rename from components/vfs/test/test_vfs_uart.c rename to components/vfs/test/esp32/test_vfs_uart.c diff --git a/components/vfs/test/test_vfs_access.c b/components/vfs/test/test_vfs_access.c index ed691f998b..e6549093d4 100644 --- a/components/vfs/test/test_vfs_access.c +++ b/components/vfs/test/test_vfs_access.c @@ -27,11 +27,19 @@ static wl_handle_t test_wl_handle; TEST_CASE("Can use access() for UART", "[vfs]") { - const char *uarts[] = {"/dev/uart/0", "/dev/uart/1", "/dev/uart/2"}; + const char *uarts[] = { + "/dev/uart/0", + "/dev/uart/1", +#if SOC_UART_NUM > 2 + "/dev/uart/2" +#endif + }; uart_driver_install(UART_NUM_0, 256, 0, 0, NULL, 0); uart_driver_install(UART_NUM_1, 256, 0, 0, NULL, 0); +#if SOC_UART_NUM > 2 uart_driver_install(UART_NUM_2, 256, 0, 0, NULL, 0); +#endif for (int i = 0; i < sizeof(uarts)/sizeof(uarts[0]); ++i) { TEST_ASSERT_EQUAL_MESSAGE(access(uarts[i], F_OK), 0, uarts[i]); @@ -55,7 +63,9 @@ TEST_CASE("Can use access() for UART", "[vfs]") uart_driver_delete(UART_NUM_0); uart_driver_delete(UART_NUM_1); +#if SOC_UART_NUM > 2 uart_driver_delete(UART_NUM_2); +#endif } static inline void test_spi_flash_setup(void) diff --git a/components/vfs/test/test_vfs_fd.c b/components/vfs/test/test_vfs_fd.c index 3f76f36ae2..d3b242a561 100644 --- a/components/vfs/test/test_vfs_fd.c +++ b/components/vfs/test/test_vfs_fd.c @@ -232,7 +232,7 @@ static int time_test_vfs_write(int fd, const void *data, size_t size) return size; } -TEST_CASE("Open & write & close through VFS passes performance test", "[vfs]") +TEST_CASE_ESP32("Open & write & close through VFS passes performance test", "[vfs]") { esp_vfs_t desc = { .flags = ESP_VFS_FLAG_DEFAULT, @@ -260,7 +260,7 @@ TEST_CASE("Open & write & close through VFS passes performance test", "[vfs]") const int64_t time_diff_us = esp_timer_get_time() - begin; const int ns_per_iter = (int) (time_diff_us * 1000 / iter_count); TEST_ESP_OK( esp_vfs_unregister(VFS_PREF1) ); -#ifdef CONFIG_ESP32_SPIRAM_SUPPORT +#ifdef CONFIG_SPIRAM TEST_PERFORMANCE_LESS_THAN(VFS_OPEN_WRITE_CLOSE_TIME_PSRAM, "%dns", ns_per_iter); #else TEST_PERFORMANCE_LESS_THAN(VFS_OPEN_WRITE_CLOSE_TIME, "%dns", ns_per_iter); diff --git a/components/vfs/vfs_uart.c b/components/vfs/vfs_uart.c index 7e02ef963d..262b4e5a54 100644 --- a/components/vfs/vfs_uart.c +++ b/components/vfs/vfs_uart.c @@ -25,7 +25,11 @@ #include "driver/uart.h" #include "sdkconfig.h" #include "driver/uart_select.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/uart.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/uart.h" +#endif // TODO: make the number of UARTs chip dependent #define UART_NUM SOC_UART_NUM @@ -155,7 +159,11 @@ static void uart_tx_char(int fd, int c) while (uart->status.txfifo_cnt >= 127) { ; } +#if CONFIG_IDF_TARGET_ESP32 uart->fifo.rw_byte = c; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + uart->ahb_fifo.rw_byte = c; +#endif } static void uart_tx_char_via_driver(int fd, int c) @@ -170,7 +178,11 @@ static int uart_rx_char(int fd) if (uart->status.rxfifo_cnt == 0) { return NONE; } +#if CONFIG_IDF_TARGET_ESP32 return uart->fifo.rw_byte; +#elif CONFIG_IDF_TARGET_ESP32S2BETA + return uart->ahb_fifo.rw_byte; +#endif } static int uart_rx_char_via_driver(int fd) diff --git a/components/wear_levelling/test/CMakeLists.txt b/components/wear_levelling/test/CMakeLists.txt index a81bf5a8e5..684960dac3 100644 --- a/components/wear_levelling/test/CMakeLists.txt +++ b/components/wear_levelling/test/CMakeLists.txt @@ -1,4 +1,11 @@ -idf_component_register(SRC_DIRS "." - INCLUDE_DIRS "." - REQUIRES unity test_utils wear_levelling - EMBED_FILES test_partition_v1.bin) \ No newline at end of file +set(srcdirs .) +if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcdirs esp32) +endif() + + +idf_component_register(SRC_DIRS ${srcdirs} + INCLUDE_DIRS . + REQUIRES unity test_utils wear_levelling + EMBED_FILES test_partition_v1.bin + ) diff --git a/components/wear_levelling/test/component.mk b/components/wear_levelling/test/component.mk index 47bab96485..002a9f6b7c 100644 --- a/components/wear_levelling/test/component.mk +++ b/components/wear_levelling/test/component.mk @@ -1,2 +1,3 @@ COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive COMPONENT_EMBED_FILES := test_partition_v1.bin +COMPONENT_SRCDIRS += esp32 diff --git a/components/wear_levelling/test/esp32/test_wl.c b/components/wear_levelling/test/esp32/test_wl.c new file mode 100644 index 0000000000..4ea0b3f2b3 --- /dev/null +++ b/components/wear_levelling/test/esp32/test_wl.c @@ -0,0 +1,88 @@ +#include +#include "unity.h" +#include "wear_levelling.h" +#include "test_utils.h" +#include "freertos/FreeRTOS.h" +#include "freertos/portable.h" +#include "freertos/task.h" +#include "freertos/semphr.h" +#include "soc/cpu.h" + +#include "esp32/clk.h" + + +#define TEST_SECTORS_COUNT 8 + +static void check_mem_data(wl_handle_t handle, uint32_t init_val, uint32_t* buff) +{ + size_t sector_size = wl_sector_size(handle); + + for (int m=0 ; m < TEST_SECTORS_COUNT ; m++) { + TEST_ESP_OK(wl_read(handle, sector_size * m, buff, sector_size)); + for (int i=0 ; i< sector_size/sizeof(uint32_t) ; i++) { + uint32_t compare_val = init_val + i + m*sector_size; + TEST_ASSERT_EQUAL( buff[i], compare_val); + } + } +} + + +// We write complete memory with defined data +// And then write one sector many times. +// A data in other secors should be the same. +// We do this also with unmount +TEST_CASE("multiple write is correct", "[wear_levelling]") +{ + const esp_partition_t *partition = get_test_data_partition(); + esp_partition_t fake_partition; + memcpy(&fake_partition, partition, sizeof(fake_partition)); + + fake_partition.size = SPI_FLASH_SEC_SIZE*(4 + TEST_SECTORS_COUNT); + + wl_handle_t handle; + TEST_ESP_OK(wl_mount(&fake_partition, &handle)); + + size_t sector_size = wl_sector_size(handle); + // Erase 8 sectors + TEST_ESP_OK(wl_erase_range(handle, 0, sector_size * TEST_SECTORS_COUNT)); + // Write data to all sectors + printf("Check 1 sector_size=0x%08x\n", sector_size); + // Set initial random value + uint32_t init_val = rand(); + + uint32_t* buff = (uint32_t*)malloc(sector_size); + for (int m=0 ; m < TEST_SECTORS_COUNT ; m++) { + for (int i=0 ; i< sector_size/sizeof(uint32_t) ; i++) { + buff[i] = init_val + i + m*sector_size; + } + TEST_ESP_OK(wl_erase_range(handle, sector_size*m, sector_size)); + TEST_ESP_OK(wl_write(handle, sector_size*m, buff, sector_size)); + } + + check_mem_data(handle, init_val, buff); + + uint32_t start; + RSR(CCOUNT, start); + + + for (int m=0 ; m< 100000 ; m++) { + uint32_t sector = m % TEST_SECTORS_COUNT; + for (int i=0 ; i< sector_size/sizeof(uint32_t) ; i++) { + buff[i] = init_val + i + sector*sector_size; + } + TEST_ESP_OK(wl_erase_range(handle, sector_size*sector, sector_size)); + TEST_ESP_OK(wl_write(handle, sector_size*sector, buff, sector_size)); + check_mem_data(handle, init_val, buff); + + uint32_t end; + RSR(CCOUNT, end); + uint32_t ms = (end - start) / (esp_clk_cpu_freq() / 1000); + printf("loop %4i pass, time= %ims\n", m, ms); + if (ms > 10000) { + break; + } + } + + free(buff); + wl_unmount(handle); +} \ No newline at end of file diff --git a/components/wear_levelling/test/test_wl.c b/components/wear_levelling/test/test_wl.c index 09ef23bfec..c0abe88acc 100644 --- a/components/wear_levelling/test/test_wl.c +++ b/components/wear_levelling/test/test_wl.c @@ -6,7 +6,6 @@ #include "freertos/portable.h" #include "freertos/task.h" #include "freertos/semphr.h" -#include "esp32/clk.h" #include "soc/cpu.h" TEST_CASE("wl_unmount doesn't leak memory", "[wear_levelling]") @@ -23,7 +22,7 @@ TEST_CASE("wl_unmount doesn't leak memory", "[wear_levelling]") // Original code: //TEST_ASSERT_EQUAL_HEX32(size_before, size_after); // Workaround for problem with heap size calculation: - ptrdiff_t stack_diff = size_before - size_after; + ptrdiff_t stack_diff = size_before - size_after; stack_diff = abs(stack_diff); if (stack_diff > 8) TEST_ASSERT_EQUAL(0, stack_diff); } @@ -49,7 +48,7 @@ TEST_CASE("wl_mount check partition parameters", "[wear_levelling][ignore]") // Original code: //TEST_ASSERT_EQUAL_HEX32(size_before, size_after); // Workaround for problem with heap size calculation: - ptrdiff_t stack_diff = size_before - size_after; + ptrdiff_t stack_diff = size_before - size_after; stack_diff = abs(stack_diff); if (stack_diff > 8) TEST_ASSERT_EQUAL(0, stack_diff); } @@ -65,7 +64,7 @@ TEST_CASE("wl_mount check partition parameters", "[wear_levelling][ignore]") // Original code: //TEST_ASSERT_EQUAL_HEX32(size_before, size_after); // Workaround for problem with heap size calculation: - ptrdiff_t stack_diff = size_before - size_after; + ptrdiff_t stack_diff = size_before - size_after; stack_diff = abs(stack_diff); if (stack_diff > 8) TEST_ASSERT_EQUAL(0, stack_diff); } @@ -177,81 +176,6 @@ TEST_CASE("multiple tasks can access wl handle simultaneously", "[wear_levelling wl_unmount(handle); } -#define TEST_SECTORS_COUNT 8 - -static void check_mem_data(wl_handle_t handle, uint32_t init_val, uint32_t* buff) -{ - size_t sector_size = wl_sector_size(handle); - - for (int m=0 ; m < TEST_SECTORS_COUNT ; m++) { - TEST_ESP_OK(wl_read(handle, sector_size * m, buff, sector_size)); - for (int i=0 ; i< sector_size/sizeof(uint32_t) ; i++) { - uint32_t compare_val = init_val + i + m*sector_size; - TEST_ASSERT_EQUAL( buff[i], compare_val); - } - } -} - - -// We write complete memory with defined data -// And then write one sector many times. -// A data in other secors should be the same. -// We do this also with unmount -TEST_CASE("multiple write is correct", "[wear_levelling]") -{ - const esp_partition_t *partition = get_test_data_partition(); - esp_partition_t fake_partition; - memcpy(&fake_partition, partition, sizeof(fake_partition)); - - fake_partition.size = SPI_FLASH_SEC_SIZE*(4 + TEST_SECTORS_COUNT); - - wl_handle_t handle; - TEST_ESP_OK(wl_mount(&fake_partition, &handle)); - - size_t sector_size = wl_sector_size(handle); - // Erase 8 sectors - TEST_ESP_OK(wl_erase_range(handle, 0, sector_size * TEST_SECTORS_COUNT)); - // Write data to all sectors - printf("Check 1 sector_size=0x%08x\n", sector_size); - // Set initial random value - uint32_t init_val = rand(); - - uint32_t* buff = (uint32_t*)malloc(sector_size); - for (int m=0 ; m < TEST_SECTORS_COUNT ; m++) { - for (int i=0 ; i< sector_size/sizeof(uint32_t) ; i++) { - buff[i] = init_val + i + m*sector_size; - } - TEST_ESP_OK(wl_erase_range(handle, sector_size*m, sector_size)); - TEST_ESP_OK(wl_write(handle, sector_size*m, buff, sector_size)); - } - - check_mem_data(handle, init_val, buff); - - uint32_t start; - RSR(CCOUNT, start); - - - for (int m=0 ; m< 100000 ; m++) { - uint32_t sector = m % TEST_SECTORS_COUNT; - for (int i=0 ; i< sector_size/sizeof(uint32_t) ; i++) { - buff[i] = init_val + i + sector*sector_size; - } - TEST_ESP_OK(wl_erase_range(handle, sector_size*sector, sector_size)); - TEST_ESP_OK(wl_write(handle, sector_size*sector, buff, sector_size)); - check_mem_data(handle, init_val, buff); - - uint32_t end; - RSR(CCOUNT, end); - uint32_t ms = (end - start) / (esp_clk_cpu_freq() / 1000); - printf("loop %4i pass, time= %ims\n", m, ms); - if (ms > 10000) { - break; - } - } - - free(buff); - wl_unmount(handle); -} extern const uint8_t test_partition_v1_bin_start[] asm("_binary_test_partition_v1_bin_start"); extern const uint8_t test_partition_v1_bin_end[] asm("_binary_test_partition_v1_bin_end"); @@ -259,7 +183,7 @@ extern const uint8_t test_partition_v1_bin_end[] asm("_binary_test_partition_v #define COMPARE_START_CONST 0x12340000 // We write to partition prepared image with V1 -// Then we convert image to new version and verifying the data +// Then we convert image to new version and verifying the data TEST_CASE("Version update test", "[wear_levelling]") { @@ -269,7 +193,7 @@ TEST_CASE("Version update test", "[wear_levelling]") if (partition->encrypted) { - printf("Update from V1 to V2 will not work.\n"); + printf("Update from V1 to V2 will not work.\n"); return; } fake_partition.size = (size_t)(test_partition_v1_bin_end - test_partition_v1_bin_start); diff --git a/components/wear_levelling/test_wl_host/sdkconfig/sdkconfig.h b/components/wear_levelling/test_wl_host/sdkconfig/sdkconfig.h index 0c44e1b77a..f9df47d6c2 100644 --- a/components/wear_levelling/test_wl_host/sdkconfig/sdkconfig.h +++ b/components/wear_levelling/test_wl_host/sdkconfig/sdkconfig.h @@ -1,5 +1,5 @@ #pragma once - +#define CONFIG_IDF_TARGET_ESP32 1 #define CONFIG_WL_SECTOR_SIZE 4096 #define CONFIG_LOG_DEFAULT_LEVEL 3 #define CONFIG_PARTITION_TABLE_OFFSET 0x8000 diff --git a/components/wpa_supplicant/port/include/os.h b/components/wpa_supplicant/port/include/os.h index ff1ba9bce1..95cceb2993 100644 --- a/components/wpa_supplicant/port/include/os.h +++ b/components/wpa_supplicant/port/include/os.h @@ -19,7 +19,7 @@ #include #include #include "esp_err.h" -#include "esp32/rom/ets_sys.h" +// #include "esp32/rom/ets_sys.h" typedef long os_time_t; @@ -188,7 +188,7 @@ char * os_readfile(const char *name, size_t *len); * OS_NO_C_LIB_DEFINES can be defined to skip all defines here in which case * these functions need to be implemented in os_*.c file for the target system. */ - + #ifndef os_malloc #define os_malloc(s) malloc((s)) #endif @@ -204,7 +204,7 @@ char * os_readfile(const char *name, size_t *len); #ifndef os_bzero #define os_bzero(s, n) bzero(s, n) -#endif +#endif #ifndef os_strdup diff --git a/components/wpa_supplicant/src/rsn_supp/wpa.h b/components/wpa_supplicant/src/rsn_supp/wpa.h index c3475eafee..b7c9a3588c 100644 --- a/components/wpa_supplicant/src/rsn_supp/wpa.h +++ b/components/wpa_supplicant/src/rsn_supp/wpa.h @@ -15,7 +15,13 @@ #ifndef WPA_H #define WPA_H +#include "sdkconfig.h" + +#ifdef CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/ets_sys.h" +#else +#include "esp32s2beta/rom/ets_sys.h" +#endif #include "utils/common.h" #include "common/defs.h" #include "common/wpa_common.h" diff --git a/components/wpa_supplicant/src/utils/includes.h b/components/wpa_supplicant/src/utils/includes.h index b7a3ce9597..3f49f513b9 100644 --- a/components/wpa_supplicant/src/utils/includes.h +++ b/components/wpa_supplicant/src/utils/includes.h @@ -54,8 +54,11 @@ #endif /* CONFIG_NATIVE_WINDOWS */ #else - +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#endif #endif /* !__ets__ */ diff --git a/components/wpa_supplicant/src/wps/wps.h b/components/wpa_supplicant/src/wps/wps.h index ab2eb00bda..5821634193 100644 --- a/components/wpa_supplicant/src/wps/wps.h +++ b/components/wpa_supplicant/src/wps/wps.h @@ -9,7 +9,11 @@ #ifndef WPS_H #define WPS_H +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/ets_sys.h" +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#include "esp32s2beta/rom/ets_sys.h" +#endif #include "wps_defs.h" #include "esp_wifi_types.h" @@ -1060,7 +1064,7 @@ struct wps_sm *wps_sm_get(void); int wps_ssid_save(u8 *ssid, u8 ssid_len); int wps_key_save(char *key, u8 key_len); int wps_station_wps_register_cb(wps_st_cb_t cb); -int wps_station_wps_unregister_cb(void); +int wps_station_wps_unregister_cb(void); int wps_start_pending(void); int wps_sm_rx_eapol(u8 *src_addr, u8 *buf, u32 len); diff --git a/components/wpa_supplicant/src/wps/wps_enrollee.c b/components/wpa_supplicant/src/wps/wps_enrollee.c index 7a30836577..3a47303abf 100644 --- a/components/wpa_supplicant/src/wps/wps_enrollee.c +++ b/components/wpa_supplicant/src/wps/wps_enrollee.c @@ -5,8 +5,9 @@ * This software may be distributed under the terms of the BSD license. * See README for more details. */ - +#if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/ets_sys.h" +#endif #include "utils/includes.h" #include "utils/common.h" diff --git a/components/wpa_supplicant/test/test_crypto.c b/components/wpa_supplicant/test/test_crypto.c index e8f8d05a5f..344c9daf6b 100644 --- a/components/wpa_supplicant/test/test_crypto.c +++ b/components/wpa_supplicant/test/test_crypto.c @@ -23,7 +23,7 @@ #include "mbedtls/ecp.h" typedef struct crypto_bignum crypto_bignum; -TEST_CASE("Test crypto lib bignum apis", "[wpa_crypto]") +TEST_CASE_ESP32("Test crypto lib bignum apis", "[wpa_crypto]") { { diff --git a/components/xtensa/CMakeLists.txt b/components/xtensa/CMakeLists.txt index 0ab1dd018d..5c335ffddc 100644 --- a/components/xtensa/CMakeLists.txt +++ b/components/xtensa/CMakeLists.txt @@ -1,10 +1,27 @@ +if(BOOTLOADER_BUILD) + # bootloader only needs headers from this component + set(priv_requires soc) +else() + set(priv_requires soc freertos) + set(srcs "debug_helpers.c" + "debug_helpers_asm.S" + "eri.c" + ) + + if(IDF_TARGET STREQUAL "esp32s2beta") + list(APPEND srcs "stdatomic.c") + endif() + if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcs "trax.c") + endif() +endif() + idf_build_get_property(target IDF_TARGET) -idf_component_register(SRCS "debug_helpers.c" - "debug_helpers_asm.S" - "eri.c" - "trax.c" +idf_component_register(SRCS ${srcs} INCLUDE_DIRS include ${target}/include LDFRAGMENTS linker.lf - PRIV_REQUIRES soc) + PRIV_REQUIRES ${priv_requires}) -target_link_libraries(${COMPONENT_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${target}/libhal.a") +if(NOT BOOTLOADER_BUILD) + target_link_libraries(${COMPONENT_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${target}/libhal.a") +endif() diff --git a/components/xtensa/debug_helpers.c b/components/xtensa/debug_helpers.c index 564e6eb159..74f66a6cc4 100644 --- a/components/xtensa/debug_helpers.c +++ b/components/xtensa/debug_helpers.c @@ -12,14 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "sdkconfig.h" #include "esp_types.h" #include "esp_attr.h" #include "esp_err.h" #include "esp_debug_helpers.h" -#include "esp32/rom/ets_sys.h" #include "soc/soc_memory_layout.h" #include "soc/cpu.h" +#ifdef CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/ets_sys.h" +#else +#include "esp32s2beta/rom/ets_sys.h" +#endif + bool IRAM_ATTR esp_backtrace_get_next_frame(esp_backtrace_frame_t *frame) { //Use frame(i-1)'s BS area located below frame(i)'s sp to get frame(i-1)'s sp and frame(i-2)'s pc diff --git a/components/xtensa/esp32s2beta/include/xtensa/config/core-isa.h b/components/xtensa/esp32s2beta/include/xtensa/config/core-isa.h new file mode 100644 index 0000000000..d07a1e7db4 --- /dev/null +++ b/components/xtensa/esp32s2beta/include/xtensa/config/core-isa.h @@ -0,0 +1,712 @@ +/* + * xtensa/config/core-isa.h -- HAL definitions that are dependent on Xtensa + * processor CORE configuration + * + * See , which includes this file, for more details. + */ + +/* Xtensa processor core configuration information. + + Copyright (c) 1999-2018 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _XTENSA_CORE_CONFIGURATION_H +#define _XTENSA_CORE_CONFIGURATION_H + + +/**************************************************************************** + Parameters Useful for Any Code, USER or PRIVILEGED + ****************************************************************************/ + +/* + * Note: Macros of the form XCHAL_HAVE_*** have a value of 1 if the option is + * configured, and a value of 0 otherwise. These macros are always defined. + */ + + +/*---------------------------------------------------------------------- + ISA + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_BE 0 /* big-endian byte ordering */ +#define XCHAL_HAVE_WINDOWED 1 /* windowed registers option */ +#define XCHAL_NUM_AREGS 64 /* num of physical addr regs */ +#define XCHAL_NUM_AREGS_LOG2 6 /* log2(XCHAL_NUM_AREGS) */ +#define XCHAL_MAX_INSTRUCTION_SIZE 3 /* max instr bytes (3..8) */ +#define XCHAL_HAVE_DEBUG 1 /* debug option */ +#define XCHAL_HAVE_DENSITY 1 /* 16-bit instructions */ +#define XCHAL_HAVE_LOOPS 0 /* zero-overhead loops */ +#define XCHAL_LOOP_BUFFER_SIZE 0 /* zero-ov. loop instr buffer size */ +#define XCHAL_HAVE_NSA 1 /* NSA/NSAU instructions */ +#define XCHAL_HAVE_MINMAX 1 /* MIN/MAX instructions */ +#define XCHAL_HAVE_SEXT 1 /* SEXT instruction */ +#define XCHAL_HAVE_DEPBITS 0 /* DEPBITS instruction */ +#define XCHAL_HAVE_CLAMPS 1 /* CLAMPS instruction */ +#define XCHAL_HAVE_MUL16 1 /* MUL16S/MUL16U instructions */ +#define XCHAL_HAVE_MUL32 1 /* MULL instruction */ +#define XCHAL_HAVE_MUL32_HIGH 1 /* MULUH/MULSH instructions */ +#define XCHAL_HAVE_DIV32 1 /* QUOS/QUOU/REMS/REMU instructions */ +#define XCHAL_HAVE_L32R 1 /* L32R instruction */ +#define XCHAL_HAVE_ABSOLUTE_LITERALS 0 /* non-PC-rel (extended) L32R */ +#define XCHAL_HAVE_CONST16 0 /* CONST16 instruction */ +#define XCHAL_HAVE_ADDX 1 /* ADDX#/SUBX# instructions */ +#define XCHAL_HAVE_EXCLUSIVE 0 /* L32EX/S32EX instructions */ +#define XCHAL_HAVE_WIDE_BRANCHES 0 /* B*.W18 or B*.W15 instr's */ +#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* B[EQ/EQZ/NE/NEZ]T instr's */ +#define XCHAL_HAVE_CALL4AND12 1 /* (obsolete option) */ +#define XCHAL_HAVE_ABS 1 /* ABS instruction */ +/*#define XCHAL_HAVE_POPC 0*/ /* POPC instruction */ +/*#define XCHAL_HAVE_CRC 0*/ /* CRC instruction */ +#define XCHAL_HAVE_RELEASE_SYNC 1 /* L32AI/S32RI instructions */ +#define XCHAL_HAVE_S32C1I 0 /* S32C1I instruction */ +#define XCHAL_HAVE_SPECULATION 0 /* speculation */ +#define XCHAL_HAVE_FULL_RESET 1 /* all regs/state reset */ +#define XCHAL_NUM_CONTEXTS 1 /* */ +#define XCHAL_NUM_MISC_REGS 4 /* num of scratch regs (0..4) */ +#define XCHAL_HAVE_TAP_MASTER 0 /* JTAG TAP control instr's */ +#define XCHAL_HAVE_PRID 1 /* processor ID register */ +#define XCHAL_HAVE_EXTERN_REGS 1 /* WER/RER instructions */ +#define XCHAL_HAVE_MX 0 /* MX core (Tensilica internal) */ +#define XCHAL_HAVE_MP_INTERRUPTS 0 /* interrupt distributor port */ +#define XCHAL_HAVE_MP_RUNSTALL 0 /* core RunStall control port */ +#define XCHAL_HAVE_PSO 0 /* Power Shut-Off */ +#define XCHAL_HAVE_PSO_CDM 0 /* core/debug/mem pwr domains */ +#define XCHAL_HAVE_PSO_FULL_RETENTION 0 /* all regs preserved on PSO */ +#define XCHAL_HAVE_THREADPTR 1 /* THREADPTR register */ +#define XCHAL_HAVE_BOOLEANS 0 /* boolean registers */ +#define XCHAL_HAVE_CP 1 /* CPENABLE reg (coprocessor) */ +#define XCHAL_CP_MAXCFG 8 /* max allowed cp id plus one */ +#define XCHAL_HAVE_MAC16 0 /* MAC16 package */ + +#define XCHAL_HAVE_FUSION 0 /* Fusion*/ +#define XCHAL_HAVE_FUSION_FP 0 /* Fusion FP option */ +#define XCHAL_HAVE_FUSION_LOW_POWER 0 /* Fusion Low Power option */ +#define XCHAL_HAVE_FUSION_AES 0 /* Fusion BLE/Wifi AES-128 CCM option */ +#define XCHAL_HAVE_FUSION_CONVENC 0 /* Fusion Conv Encode option */ +#define XCHAL_HAVE_FUSION_LFSR_CRC 0 /* Fusion LFSR-CRC option */ +#define XCHAL_HAVE_FUSION_BITOPS 0 /* Fusion Bit Operations Support option */ +#define XCHAL_HAVE_FUSION_AVS 0 /* Fusion AVS option */ +#define XCHAL_HAVE_FUSION_16BIT_BASEBAND 0 /* Fusion 16-bit Baseband option */ +#define XCHAL_HAVE_FUSION_VITERBI 0 /* Fusion Viterbi option */ +#define XCHAL_HAVE_FUSION_SOFTDEMAP 0 /* Fusion Soft Bit Demap option */ +#define XCHAL_HAVE_HIFIPRO 0 /* HiFiPro Audio Engine pkg */ +#define XCHAL_HAVE_HIFI4 0 /* HiFi4 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI4_VFPU 0 /* HiFi4 Audio Engine VFPU option */ +#define XCHAL_HAVE_HIFI3 0 /* HiFi3 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI3_VFPU 0 /* HiFi3 Audio Engine VFPU option */ +#define XCHAL_HAVE_HIFI3Z 0 /* HiFi3Z Audio Engine pkg */ +#define XCHAL_HAVE_HIFI3Z_VFPU 0 /* HiFi3Z Audio Engine VFPU option */ +#define XCHAL_HAVE_HIFI2 0 /* HiFi2 Audio Engine pkg */ +#define XCHAL_HAVE_HIFI2EP 0 /* HiFi2EP */ +#define XCHAL_HAVE_HIFI_MINI 0 + + + +#define XCHAL_HAVE_VECTORFPU2005 0 /* vector floating-point pkg */ +#define XCHAL_HAVE_USER_DPFPU 0 /* user DP floating-point pkg */ +#define XCHAL_HAVE_USER_SPFPU 0 /* user SP floating-point pkg */ +#define XCHAL_HAVE_FP 0 /* single prec floating point */ +#define XCHAL_HAVE_FP_DIV 0 /* FP with DIV instructions */ +#define XCHAL_HAVE_FP_RECIP 0 /* FP with RECIP instructions */ +#define XCHAL_HAVE_FP_SQRT 0 /* FP with SQRT instructions */ +#define XCHAL_HAVE_FP_RSQRT 0 /* FP with RSQRT instructions */ +#define XCHAL_HAVE_DFP 0 /* double precision FP pkg */ +#define XCHAL_HAVE_DFP_DIV 0 /* DFP with DIV instructions */ +#define XCHAL_HAVE_DFP_RECIP 0 /* DFP with RECIP instructions*/ +#define XCHAL_HAVE_DFP_SQRT 0 /* DFP with SQRT instructions */ +#define XCHAL_HAVE_DFP_RSQRT 0 /* DFP with RSQRT instructions*/ +#define XCHAL_HAVE_DFP_ACCEL 0 /* double precision FP acceleration pkg */ +#define XCHAL_HAVE_DFP_accel XCHAL_HAVE_DFP_ACCEL /* for backward compatibility */ + +#define XCHAL_HAVE_DFPU_SINGLE_ONLY 0 /* DFPU Coprocessor, single precision only */ +#define XCHAL_HAVE_DFPU_SINGLE_DOUBLE 0 /* DFPU Coprocessor, single and double precision */ +#define XCHAL_HAVE_VECTRA1 0 /* Vectra I pkg */ +#define XCHAL_HAVE_VECTRALX 0 /* Vectra LX pkg */ + +#define XCHAL_HAVE_FUSIONG 0 /* FusionG */ +#define XCHAL_HAVE_FUSIONG3 0 /* FusionG3 */ +#define XCHAL_HAVE_FUSIONG6 0 /* FusionG6 */ +#define XCHAL_HAVE_FUSIONG_SP_VFPU 0 /* sp_vfpu option on FusionG */ +#define XCHAL_HAVE_FUSIONG_DP_VFPU 0 /* dp_vfpu option on FusionG */ +#define XCHAL_FUSIONG_SIMD32 0 /* simd32 for FusionG */ + +#define XCHAL_HAVE_PDX 0 /* PDX */ +#define XCHAL_PDX_SIMD32 0 /* simd32 for PDX */ +#define XCHAL_HAVE_PDX4 0 /* PDX4 */ +#define XCHAL_HAVE_PDX8 0 /* PDX8 */ +#define XCHAL_HAVE_PDX16 0 /* PDX16 */ + +#define XCHAL_HAVE_CONNXD2 0 /* ConnX D2 pkg */ +#define XCHAL_HAVE_CONNXD2_DUALLSFLIX 0 /* ConnX D2 & Dual LoadStore Flix */ +#define XCHAL_HAVE_BBE16 0 /* ConnX BBE16 pkg */ +#define XCHAL_HAVE_BBE16_RSQRT 0 /* BBE16 & vector recip sqrt */ +#define XCHAL_HAVE_BBE16_VECDIV 0 /* BBE16 & vector divide */ +#define XCHAL_HAVE_BBE16_DESPREAD 0 /* BBE16 & despread */ +#define XCHAL_HAVE_BBENEP 0 /* ConnX BBENEP pkgs */ +#define XCHAL_HAVE_BBENEP_SP_VFPU 0 /* sp_vfpu option on BBE-EP */ +#define XCHAL_HAVE_BSP3 0 /* ConnX BSP3 pkg */ +#define XCHAL_HAVE_BSP3_TRANSPOSE 0 /* BSP3 & transpose32x32 */ +#define XCHAL_HAVE_SSP16 0 /* ConnX SSP16 pkg */ +#define XCHAL_HAVE_SSP16_VITERBI 0 /* SSP16 & viterbi */ +#define XCHAL_HAVE_TURBO16 0 /* ConnX Turbo16 pkg */ +#define XCHAL_HAVE_BBP16 0 /* ConnX BBP16 pkg */ +#define XCHAL_HAVE_FLIX3 0 /* basic 3-way FLIX option */ +#define XCHAL_HAVE_GRIVPEP 0 /* General Release of IVPEP */ +#define XCHAL_HAVE_GRIVPEP_HISTOGRAM 0 /* Histogram option on GRIVPEP */ + +#define XCHAL_HAVE_VISION 0 /* Vision P5/P6 */ +#define XCHAL_VISION_SIMD16 0 /* simd16 for Vision P5/P6 */ +#define XCHAL_VISION_TYPE 0 /* Vision P5, P6, or P3 */ +#define XCHAL_VISION_QUAD_MAC_TYPE 0 /* quad_mac option on Vision P6 */ +#define XCHAL_HAVE_VISION_HISTOGRAM 0 /* histogram option on Vision P5/P6 */ +#define XCHAL_HAVE_VISION_SP_VFPU 0 /* sp_vfpu option on Vision P5/P6 */ +#define XCHAL_HAVE_VISION_HP_VFPU 0 /* hp_vfpu option on Vision P6 */ + +#define XCHAL_HAVE_VISIONC 0 /* Vision C */ + +/*---------------------------------------------------------------------- + MISC + ----------------------------------------------------------------------*/ + +#define XCHAL_NUM_LOADSTORE_UNITS 1 /* load/store units */ +#define XCHAL_NUM_WRITEBUFFER_ENTRIES 4 /* size of write buffer */ +#define XCHAL_INST_FETCH_WIDTH 4 /* instr-fetch width in bytes */ +#define XCHAL_DATA_WIDTH 4 /* data width in bytes */ +#define XCHAL_DATA_PIPE_DELAY 2 /* d-side pipeline delay + (1 = 5-stage, 2 = 7-stage) */ +#define XCHAL_CLOCK_GATING_GLOBAL 0 /* global clock gating */ +#define XCHAL_CLOCK_GATING_FUNCUNIT 0 /* funct. unit clock gating */ +/* In T1050, applies to selected core load and store instructions (see ISA): */ +#define XCHAL_UNALIGNED_LOAD_EXCEPTION 0 /* unaligned loads cause exc. */ +#define XCHAL_UNALIGNED_STORE_EXCEPTION 0 /* unaligned stores cause exc.*/ +#define XCHAL_UNALIGNED_LOAD_HW 1 /* unaligned loads work in hw */ +#define XCHAL_UNALIGNED_STORE_HW 1 /* unaligned stores work in hw*/ + +#define XCHAL_SW_VERSION 1200008 /* sw version of this header */ + +#define XCHAL_CORE_ID "test_0731_1_TIE_GPIO_f" /* alphanum core name + (CoreID) set in the Xtensa + Processor Generator */ + +#define XCHAL_BUILD_UNIQUE_ID 0x00075F76 /* 22-bit sw build ID */ + +/* + * These definitions describe the hardware targeted by this software. + */ +#define XCHAL_HW_CONFIGID0 0xC2ECFAFE /* ConfigID hi 32 bits*/ +#define XCHAL_HW_CONFIGID1 0x22075F76 /* ConfigID lo 32 bits*/ +#define XCHAL_HW_VERSION_NAME "LX7.0.8" /* full version name */ +#define XCHAL_HW_VERSION_MAJOR 2700 /* major ver# of targeted hw */ +#define XCHAL_HW_VERSION_MINOR 8 /* minor ver# of targeted hw */ +#define XCHAL_HW_VERSION 270008 /* major*100+minor */ +#define XCHAL_HW_REL_LX7 1 +#define XCHAL_HW_REL_LX7_0 1 +#define XCHAL_HW_REL_LX7_0_8 1 +#define XCHAL_HW_CONFIGID_RELIABLE 1 +/* If software targets a *range* of hardware versions, these are the bounds: */ +#define XCHAL_HW_MIN_VERSION_MAJOR 2700 /* major v of earliest tgt hw */ +#define XCHAL_HW_MIN_VERSION_MINOR 8 /* minor v of earliest tgt hw */ +#define XCHAL_HW_MIN_VERSION 270008 /* earliest targeted hw */ +#define XCHAL_HW_MAX_VERSION_MAJOR 2700 /* major v of latest tgt hw */ +#define XCHAL_HW_MAX_VERSION_MINOR 8 /* minor v of latest tgt hw */ +#define XCHAL_HW_MAX_VERSION 270008 /* latest targeted hw */ + + +/*---------------------------------------------------------------------- + CACHE + ----------------------------------------------------------------------*/ + +#define XCHAL_ICACHE_LINESIZE 4 /* I-cache line size in bytes */ +#define XCHAL_DCACHE_LINESIZE 4 /* D-cache line size in bytes */ +#define XCHAL_ICACHE_LINEWIDTH 2 /* log2(I line size in bytes) */ +#define XCHAL_DCACHE_LINEWIDTH 2 /* log2(D line size in bytes) */ + +#define XCHAL_ICACHE_SIZE 0 /* I-cache size in bytes or 0 */ +#define XCHAL_DCACHE_SIZE 0 /* D-cache size in bytes or 0 */ + +#define XCHAL_DCACHE_IS_WRITEBACK 0 /* writeback feature */ +#define XCHAL_DCACHE_IS_COHERENT 0 /* MP coherence feature */ + +#define XCHAL_HAVE_PREFETCH 0 /* PREFCTL register */ +#define XCHAL_HAVE_PREFETCH_L1 0 /* prefetch to L1 dcache */ +#define XCHAL_PREFETCH_CASTOUT_LINES 0 /* dcache pref. castout bufsz */ +#define XCHAL_PREFETCH_ENTRIES 0 /* cache prefetch entries */ +#define XCHAL_PREFETCH_BLOCK_ENTRIES 0 /* prefetch block streams */ +#define XCHAL_HAVE_CACHE_BLOCKOPS 0 /* block prefetch for caches */ +#define XCHAL_HAVE_ICACHE_TEST 0 /* Icache test instructions */ +#define XCHAL_HAVE_DCACHE_TEST 0 /* Dcache test instructions */ +#define XCHAL_HAVE_ICACHE_DYN_WAYS 0 /* Icache dynamic way support */ +#define XCHAL_HAVE_DCACHE_DYN_WAYS 0 /* Dcache dynamic way support */ + + + + +/**************************************************************************** + Parameters Useful for PRIVILEGED (Supervisory or Non-Virtualized) Code + ****************************************************************************/ + + +#ifndef XTENSA_HAL_NON_PRIVILEGED_ONLY + +/*---------------------------------------------------------------------- + CACHE + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_PIF 1 /* any outbound bus present */ + +#define XCHAL_HAVE_AXI 0 /* AXI bus */ +#define XCHAL_HAVE_AXI_ECC 0 /* ECC on AXI bus */ +#define XCHAL_HAVE_ACELITE 0 /* ACELite bus */ + +#define XCHAL_HAVE_PIF_WR_RESP 0 /* pif write response */ +#define XCHAL_HAVE_PIF_REQ_ATTR 1 /* pif attribute */ + +/* If present, cache size in bytes == (ways * 2^(linewidth + setwidth)). */ + +/* Number of cache sets in log2(lines per way): */ +#define XCHAL_ICACHE_SETWIDTH 0 +#define XCHAL_DCACHE_SETWIDTH 0 + +/* Cache set associativity (number of ways): */ +#define XCHAL_ICACHE_WAYS 1 +#define XCHAL_DCACHE_WAYS 1 + +/* Cache features: */ +#define XCHAL_ICACHE_LINE_LOCKABLE 0 +#define XCHAL_DCACHE_LINE_LOCKABLE 0 +#define XCHAL_ICACHE_ECC_PARITY 0 +#define XCHAL_DCACHE_ECC_PARITY 0 + +/* Cache access size in bytes (affects operation of SICW instruction): */ +#define XCHAL_ICACHE_ACCESS_SIZE 1 +#define XCHAL_DCACHE_ACCESS_SIZE 1 + +#define XCHAL_DCACHE_BANKS 0 /* number of banks */ + +/* Number of encoded cache attr bits (see for decoded bits): */ +#define XCHAL_CA_BITS 4 + + +/*---------------------------------------------------------------------- + INTERNAL I/D RAM/ROMs and XLMI + ----------------------------------------------------------------------*/ +#define XCHAL_NUM_INSTROM 1 /* number of core instr. ROMs */ +#define XCHAL_NUM_INSTRAM 2 /* number of core instr. RAMs */ +#define XCHAL_NUM_DATAROM 1 /* number of core data ROMs */ +#define XCHAL_NUM_DATARAM 2 /* number of core data RAMs */ +#define XCHAL_NUM_URAM 0 /* number of core unified RAMs*/ +#define XCHAL_NUM_XLMI 1 /* number of core XLMI ports */ + +/* Instruction ROM 0: */ +#define XCHAL_INSTROM0_VADDR 0x40800000 /* virtual address */ +#define XCHAL_INSTROM0_PADDR 0x40800000 /* physical address */ +#define XCHAL_INSTROM0_SIZE 4194304 /* size in bytes */ +#define XCHAL_INSTROM0_ECC_PARITY 0 /* ECC/parity type, 0=none */ + +/* Instruction RAM 0: */ +#define XCHAL_INSTRAM0_VADDR 0x40000000 /* virtual address */ +#define XCHAL_INSTRAM0_PADDR 0x40000000 /* physical address */ +#define XCHAL_INSTRAM0_SIZE 4194304 /* size in bytes */ +#define XCHAL_INSTRAM0_ECC_PARITY 0 /* ECC/parity type, 0=none */ +#define XCHAL_HAVE_INSTRAM0 1 +#define XCHAL_INSTRAM0_HAVE_IDMA 0 /* idma supported by this local memory */ + +/* Instruction RAM 1: */ +#define XCHAL_INSTRAM1_VADDR 0x40400000 /* virtual address */ +#define XCHAL_INSTRAM1_PADDR 0x40400000 /* physical address */ +#define XCHAL_INSTRAM1_SIZE 4194304 /* size in bytes */ +#define XCHAL_INSTRAM1_ECC_PARITY 0 /* ECC/parity type, 0=none */ +#define XCHAL_HAVE_INSTRAM1 1 +#define XCHAL_INSTRAM1_HAVE_IDMA 0 /* idma supported by this local memory */ + +/* Data ROM 0: */ +#define XCHAL_DATAROM0_VADDR 0x3F400000 /* virtual address */ +#define XCHAL_DATAROM0_PADDR 0x3F400000 /* physical address */ +#define XCHAL_DATAROM0_SIZE 4194304 /* size in bytes */ +#define XCHAL_DATAROM0_ECC_PARITY 0 /* ECC/parity type, 0=none */ +#define XCHAL_DATAROM0_BANKS 1 /* number of banks */ + +/* Data RAM 0: */ +#define XCHAL_DATARAM0_VADDR 0x3FF80000 /* virtual address */ +#define XCHAL_DATARAM0_PADDR 0x3FF80000 /* physical address */ +#define XCHAL_DATARAM0_SIZE 524288 /* size in bytes */ +#define XCHAL_DATARAM0_ECC_PARITY 0 /* ECC/parity type, 0=none */ +#define XCHAL_DATARAM0_BANKS 1 /* number of banks */ +#define XCHAL_HAVE_DATARAM0 1 +#define XCHAL_DATARAM0_HAVE_IDMA 0 /* idma supported by this local memory */ + +/* Data RAM 1: */ +#define XCHAL_DATARAM1_VADDR 0x3F800000 /* virtual address */ +#define XCHAL_DATARAM1_PADDR 0x3F800000 /* physical address */ +#define XCHAL_DATARAM1_SIZE 4194304 /* size in bytes */ +#define XCHAL_DATARAM1_ECC_PARITY 0 /* ECC/parity type, 0=none */ +#define XCHAL_DATARAM1_BANKS 1 /* number of banks */ +#define XCHAL_HAVE_DATARAM1 1 +#define XCHAL_DATARAM1_HAVE_IDMA 0 /* idma supported by this local memory */ + +/* XLMI Port 0: */ +#define XCHAL_XLMI0_VADDR 0x3FE00000 /* virtual address */ +#define XCHAL_XLMI0_PADDR 0x3FE00000 /* physical address */ +#define XCHAL_XLMI0_SIZE 1048576 /* size in bytes */ +#define XCHAL_XLMI0_ECC_PARITY 0 /* ECC/parity type, 0=none */ + +#define XCHAL_HAVE_IDMA 0 +#define XCHAL_HAVE_IDMA_TRANSPOSE 0 + +#define XCHAL_HAVE_IMEM_LOADSTORE 1 /* can load/store to IROM/IRAM*/ + + +/*---------------------------------------------------------------------- + INTERRUPTS and TIMERS + ----------------------------------------------------------------------*/ + +#define XCHAL_HAVE_INTERRUPTS 1 /* interrupt option */ +#define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* med/high-pri. interrupts */ +#define XCHAL_HAVE_NMI 1 /* non-maskable interrupt */ +#define XCHAL_HAVE_CCOUNT 1 /* CCOUNT reg. (timer option) */ +#define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */ +#define XCHAL_NUM_INTERRUPTS 32 /* number of interrupts */ +#define XCHAL_NUM_INTERRUPTS_LOG2 5 /* ceil(log2(NUM_INTERRUPTS)) */ +#define XCHAL_NUM_EXTINTERRUPTS 26 /* num of external interrupts */ +#define XCHAL_NUM_INTLEVELS 6 /* number of interrupt levels + (not including level zero) */ +#define XCHAL_EXCM_LEVEL 3 /* level masked by PS.EXCM */ + /* (always 1 in XEA1; levels 2 .. EXCM_LEVEL are "medium priority") */ + +/* Masks of interrupts at each interrupt level: */ +#define XCHAL_INTLEVEL1_MASK 0x000637FF +#define XCHAL_INTLEVEL2_MASK 0x00380000 +#define XCHAL_INTLEVEL3_MASK 0x28C08800 +#define XCHAL_INTLEVEL4_MASK 0x53000000 +#define XCHAL_INTLEVEL5_MASK 0x84010000 +#define XCHAL_INTLEVEL6_MASK 0x00000000 +#define XCHAL_INTLEVEL7_MASK 0x00004000 + +/* Masks of interrupts at each range 1..n of interrupt levels: */ +#define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x000637FF +#define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x003E37FF +#define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x28FEBFFF +#define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x7BFEBFFF +#define XCHAL_INTLEVEL5_ANDBELOW_MASK 0xFFFFBFFF +#define XCHAL_INTLEVEL6_ANDBELOW_MASK 0xFFFFBFFF +#define XCHAL_INTLEVEL7_ANDBELOW_MASK 0xFFFFFFFF + +/* Level of each interrupt: */ +#define XCHAL_INT0_LEVEL 1 +#define XCHAL_INT1_LEVEL 1 +#define XCHAL_INT2_LEVEL 1 +#define XCHAL_INT3_LEVEL 1 +#define XCHAL_INT4_LEVEL 1 +#define XCHAL_INT5_LEVEL 1 +#define XCHAL_INT6_LEVEL 1 +#define XCHAL_INT7_LEVEL 1 +#define XCHAL_INT8_LEVEL 1 +#define XCHAL_INT9_LEVEL 1 +#define XCHAL_INT10_LEVEL 1 +#define XCHAL_INT11_LEVEL 3 +#define XCHAL_INT12_LEVEL 1 +#define XCHAL_INT13_LEVEL 1 +#define XCHAL_INT14_LEVEL 7 +#define XCHAL_INT15_LEVEL 3 +#define XCHAL_INT16_LEVEL 5 +#define XCHAL_INT17_LEVEL 1 +#define XCHAL_INT18_LEVEL 1 +#define XCHAL_INT19_LEVEL 2 +#define XCHAL_INT20_LEVEL 2 +#define XCHAL_INT21_LEVEL 2 +#define XCHAL_INT22_LEVEL 3 +#define XCHAL_INT23_LEVEL 3 +#define XCHAL_INT24_LEVEL 4 +#define XCHAL_INT25_LEVEL 4 +#define XCHAL_INT26_LEVEL 5 +#define XCHAL_INT27_LEVEL 3 +#define XCHAL_INT28_LEVEL 4 +#define XCHAL_INT29_LEVEL 3 +#define XCHAL_INT30_LEVEL 4 +#define XCHAL_INT31_LEVEL 5 +#define XCHAL_DEBUGLEVEL 6 /* debug interrupt level */ +#define XCHAL_HAVE_DEBUG_EXTERN_INT 1 /* OCD external db interrupt */ +#define XCHAL_NMILEVEL 7 /* NMI "level" (for use with + EXCSAVE/EPS/EPC_n, RFI n) */ + +/* Type of each interrupt: */ +#define XCHAL_INT0_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT1_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT3_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT4_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT5_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT6_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT7_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT8_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT9_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT10_TYPE XTHAL_INTTYPE_EXTERN_EDGE +#define XCHAL_INT11_TYPE XTHAL_INTTYPE_PROFILING +#define XCHAL_INT12_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT13_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT14_TYPE XTHAL_INTTYPE_NMI +#define XCHAL_INT15_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT16_TYPE XTHAL_INTTYPE_TIMER +#define XCHAL_INT17_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT18_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT19_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT20_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT21_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT22_TYPE XTHAL_INTTYPE_EXTERN_EDGE +#define XCHAL_INT23_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT24_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT25_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT26_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT27_TYPE XTHAL_INTTYPE_EXTERN_LEVEL +#define XCHAL_INT28_TYPE XTHAL_INTTYPE_EXTERN_EDGE +#define XCHAL_INT29_TYPE XTHAL_INTTYPE_SOFTWARE +#define XCHAL_INT30_TYPE XTHAL_INTTYPE_EXTERN_EDGE +#define XCHAL_INT31_TYPE XTHAL_INTTYPE_EXTERN_LEVEL + +/* Masks of interrupts for each type of interrupt: */ +#define XCHAL_INTTYPE_MASK_UNCONFIGURED 0x00000000 +#define XCHAL_INTTYPE_MASK_SOFTWARE 0x20000080 +#define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x50400400 +#define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x8FBE333F +#define XCHAL_INTTYPE_MASK_TIMER 0x00018040 +#define XCHAL_INTTYPE_MASK_NMI 0x00004000 +#define XCHAL_INTTYPE_MASK_WRITE_ERROR 0x00000000 +#define XCHAL_INTTYPE_MASK_PROFILING 0x00000800 +#define XCHAL_INTTYPE_MASK_IDMA_DONE 0x00000000 +#define XCHAL_INTTYPE_MASK_IDMA_ERR 0x00000000 +#define XCHAL_INTTYPE_MASK_GS_ERR 0x00000000 + +/* Interrupt numbers assigned to specific interrupt sources: */ +#define XCHAL_TIMER0_INTERRUPT 6 /* CCOMPARE0 */ +#define XCHAL_TIMER1_INTERRUPT 15 /* CCOMPARE1 */ +#define XCHAL_TIMER2_INTERRUPT 16 /* CCOMPARE2 */ +#define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED +#define XCHAL_NMI_INTERRUPT 14 /* non-maskable interrupt */ +#define XCHAL_PROFILING_INTERRUPT 11 + +/* Interrupt numbers for levels at which only one interrupt is configured: */ +#define XCHAL_INTLEVEL7_NUM 14 +/* (There are many interrupts each at level(s) 1, 2, 3, 4, 5.) */ + + +/* + * External interrupt mapping. + * These macros describe how Xtensa processor interrupt numbers + * (as numbered internally, eg. in INTERRUPT and INTENABLE registers) + * map to external BInterrupt pins, for those interrupts + * configured as external (level-triggered, edge-triggered, or NMI). + * See the Xtensa processor databook for more details. + */ + +/* Core interrupt numbers mapped to each EXTERNAL BInterrupt pin number: */ +#define XCHAL_EXTINT0_NUM 0 /* (intlevel 1) */ +#define XCHAL_EXTINT1_NUM 1 /* (intlevel 1) */ +#define XCHAL_EXTINT2_NUM 2 /* (intlevel 1) */ +#define XCHAL_EXTINT3_NUM 3 /* (intlevel 1) */ +#define XCHAL_EXTINT4_NUM 4 /* (intlevel 1) */ +#define XCHAL_EXTINT5_NUM 5 /* (intlevel 1) */ +#define XCHAL_EXTINT6_NUM 8 /* (intlevel 1) */ +#define XCHAL_EXTINT7_NUM 9 /* (intlevel 1) */ +#define XCHAL_EXTINT8_NUM 10 /* (intlevel 1) */ +#define XCHAL_EXTINT9_NUM 12 /* (intlevel 1) */ +#define XCHAL_EXTINT10_NUM 13 /* (intlevel 1) */ +#define XCHAL_EXTINT11_NUM 14 /* (intlevel 7) */ +#define XCHAL_EXTINT12_NUM 17 /* (intlevel 1) */ +#define XCHAL_EXTINT13_NUM 18 /* (intlevel 1) */ +#define XCHAL_EXTINT14_NUM 19 /* (intlevel 2) */ +#define XCHAL_EXTINT15_NUM 20 /* (intlevel 2) */ +#define XCHAL_EXTINT16_NUM 21 /* (intlevel 2) */ +#define XCHAL_EXTINT17_NUM 22 /* (intlevel 3) */ +#define XCHAL_EXTINT18_NUM 23 /* (intlevel 3) */ +#define XCHAL_EXTINT19_NUM 24 /* (intlevel 4) */ +#define XCHAL_EXTINT20_NUM 25 /* (intlevel 4) */ +#define XCHAL_EXTINT21_NUM 26 /* (intlevel 5) */ +#define XCHAL_EXTINT22_NUM 27 /* (intlevel 3) */ +#define XCHAL_EXTINT23_NUM 28 /* (intlevel 4) */ +#define XCHAL_EXTINT24_NUM 30 /* (intlevel 4) */ +#define XCHAL_EXTINT25_NUM 31 /* (intlevel 5) */ +/* EXTERNAL BInterrupt pin numbers mapped to each core interrupt number: */ +#define XCHAL_INT0_EXTNUM 0 /* (intlevel 1) */ +#define XCHAL_INT1_EXTNUM 1 /* (intlevel 1) */ +#define XCHAL_INT2_EXTNUM 2 /* (intlevel 1) */ +#define XCHAL_INT3_EXTNUM 3 /* (intlevel 1) */ +#define XCHAL_INT4_EXTNUM 4 /* (intlevel 1) */ +#define XCHAL_INT5_EXTNUM 5 /* (intlevel 1) */ +#define XCHAL_INT8_EXTNUM 6 /* (intlevel 1) */ +#define XCHAL_INT9_EXTNUM 7 /* (intlevel 1) */ +#define XCHAL_INT10_EXTNUM 8 /* (intlevel 1) */ +#define XCHAL_INT12_EXTNUM 9 /* (intlevel 1) */ +#define XCHAL_INT13_EXTNUM 10 /* (intlevel 1) */ +#define XCHAL_INT14_EXTNUM 11 /* (intlevel 7) */ +#define XCHAL_INT17_EXTNUM 12 /* (intlevel 1) */ +#define XCHAL_INT18_EXTNUM 13 /* (intlevel 1) */ +#define XCHAL_INT19_EXTNUM 14 /* (intlevel 2) */ +#define XCHAL_INT20_EXTNUM 15 /* (intlevel 2) */ +#define XCHAL_INT21_EXTNUM 16 /* (intlevel 2) */ +#define XCHAL_INT22_EXTNUM 17 /* (intlevel 3) */ +#define XCHAL_INT23_EXTNUM 18 /* (intlevel 3) */ +#define XCHAL_INT24_EXTNUM 19 /* (intlevel 4) */ +#define XCHAL_INT25_EXTNUM 20 /* (intlevel 4) */ +#define XCHAL_INT26_EXTNUM 21 /* (intlevel 5) */ +#define XCHAL_INT27_EXTNUM 22 /* (intlevel 3) */ +#define XCHAL_INT28_EXTNUM 23 /* (intlevel 4) */ +#define XCHAL_INT30_EXTNUM 24 /* (intlevel 4) */ +#define XCHAL_INT31_EXTNUM 25 /* (intlevel 5) */ + + +/*---------------------------------------------------------------------- + EXCEPTIONS and VECTORS + ----------------------------------------------------------------------*/ + +#define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture + number: 1 == XEA1 (old) + 2 == XEA2 (new) + 0 == XEAX (extern) or TX */ +#define XCHAL_HAVE_XEA1 0 /* Exception Architecture 1 */ +#define XCHAL_HAVE_XEA2 1 /* Exception Architecture 2 */ +#define XCHAL_HAVE_XEAX 0 /* External Exception Arch. */ +#define XCHAL_HAVE_EXCEPTIONS 1 /* exception option */ +#define XCHAL_HAVE_HALT 0 /* halt architecture option */ +#define XCHAL_HAVE_BOOTLOADER 0 /* boot loader (for TX) */ +#define XCHAL_HAVE_MEM_ECC_PARITY 0 /* local memory ECC/parity */ +#define XCHAL_HAVE_VECTOR_SELECT 1 /* relocatable vectors */ +#define XCHAL_HAVE_VECBASE 1 /* relocatable vectors */ +#define XCHAL_VECBASE_RESET_VADDR 0x40000000 /* VECBASE reset value */ +#define XCHAL_VECBASE_RESET_PADDR 0x40000000 +#define XCHAL_RESET_VECBASE_OVERLAP 0 + +#define XCHAL_RESET_VECTOR0_VADDR 0x50000000 +#define XCHAL_RESET_VECTOR0_PADDR 0x50000000 +#define XCHAL_RESET_VECTOR1_VADDR 0x40000400 +#define XCHAL_RESET_VECTOR1_PADDR 0x40000400 +#define XCHAL_RESET_VECTOR_VADDR 0x40000400 +#define XCHAL_RESET_VECTOR_PADDR 0x40000400 +#define XCHAL_USER_VECOFS 0x00000340 +#define XCHAL_USER_VECTOR_VADDR 0x40000340 +#define XCHAL_USER_VECTOR_PADDR 0x40000340 +#define XCHAL_KERNEL_VECOFS 0x00000300 +#define XCHAL_KERNEL_VECTOR_VADDR 0x40000300 +#define XCHAL_KERNEL_VECTOR_PADDR 0x40000300 +#define XCHAL_DOUBLEEXC_VECOFS 0x000003C0 +#define XCHAL_DOUBLEEXC_VECTOR_VADDR 0x400003C0 +#define XCHAL_DOUBLEEXC_VECTOR_PADDR 0x400003C0 +#define XCHAL_WINDOW_OF4_VECOFS 0x00000000 +#define XCHAL_WINDOW_UF4_VECOFS 0x00000040 +#define XCHAL_WINDOW_OF8_VECOFS 0x00000080 +#define XCHAL_WINDOW_UF8_VECOFS 0x000000C0 +#define XCHAL_WINDOW_OF12_VECOFS 0x00000100 +#define XCHAL_WINDOW_UF12_VECOFS 0x00000140 +#define XCHAL_WINDOW_VECTORS_VADDR 0x40000000 +#define XCHAL_WINDOW_VECTORS_PADDR 0x40000000 +#define XCHAL_INTLEVEL2_VECOFS 0x00000180 +#define XCHAL_INTLEVEL2_VECTOR_VADDR 0x40000180 +#define XCHAL_INTLEVEL2_VECTOR_PADDR 0x40000180 +#define XCHAL_INTLEVEL3_VECOFS 0x000001C0 +#define XCHAL_INTLEVEL3_VECTOR_VADDR 0x400001C0 +#define XCHAL_INTLEVEL3_VECTOR_PADDR 0x400001C0 +#define XCHAL_INTLEVEL4_VECOFS 0x00000200 +#define XCHAL_INTLEVEL4_VECTOR_VADDR 0x40000200 +#define XCHAL_INTLEVEL4_VECTOR_PADDR 0x40000200 +#define XCHAL_INTLEVEL5_VECOFS 0x00000240 +#define XCHAL_INTLEVEL5_VECTOR_VADDR 0x40000240 +#define XCHAL_INTLEVEL5_VECTOR_PADDR 0x40000240 +#define XCHAL_INTLEVEL6_VECOFS 0x00000280 +#define XCHAL_INTLEVEL6_VECTOR_VADDR 0x40000280 +#define XCHAL_INTLEVEL6_VECTOR_PADDR 0x40000280 +#define XCHAL_DEBUG_VECOFS XCHAL_INTLEVEL6_VECOFS +#define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL6_VECTOR_VADDR +#define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL6_VECTOR_PADDR +#define XCHAL_NMI_VECOFS 0x000002C0 +#define XCHAL_NMI_VECTOR_VADDR 0x400002C0 +#define XCHAL_NMI_VECTOR_PADDR 0x400002C0 +#define XCHAL_INTLEVEL7_VECOFS XCHAL_NMI_VECOFS +#define XCHAL_INTLEVEL7_VECTOR_VADDR XCHAL_NMI_VECTOR_VADDR +#define XCHAL_INTLEVEL7_VECTOR_PADDR XCHAL_NMI_VECTOR_PADDR + + +/*---------------------------------------------------------------------- + DEBUG MODULE + ----------------------------------------------------------------------*/ + +/* Misc */ +#define XCHAL_HAVE_DEBUG_ERI 1 /* ERI to debug module */ +#define XCHAL_HAVE_DEBUG_APB 0 /* APB to debug module */ +#define XCHAL_HAVE_DEBUG_JTAG 1 /* JTAG to debug module */ + +/* On-Chip Debug (OCD) */ +#define XCHAL_HAVE_OCD 1 /* OnChipDebug option */ +#define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */ +#define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */ +#define XCHAL_HAVE_OCD_DIR_ARRAY 0 /* faster OCD option (to LX4) */ +#define XCHAL_HAVE_OCD_LS32DDR 1 /* L32DDR/S32DDR (faster OCD) */ + +/* TRAX (in core) */ +#define XCHAL_HAVE_TRAX 1 /* TRAX in debug module */ +#define XCHAL_TRAX_MEM_SIZE 16384 /* TRAX memory size in bytes */ +#define XCHAL_TRAX_MEM_SHAREABLE 1 /* start/end regs; ready sig. */ +#define XCHAL_TRAX_ATB_WIDTH 0 /* ATB width (bits), 0=no ATB */ +#define XCHAL_TRAX_TIME_WIDTH 0 /* timestamp bitwidth, 0=none */ + +/* Perf counters */ +#define XCHAL_NUM_PERF_COUNTERS 2 /* performance counters */ + + +/*---------------------------------------------------------------------- + MMU + ----------------------------------------------------------------------*/ + +/* See core-matmap.h header file for more details. */ + +#define XCHAL_HAVE_TLBS 1 /* inverse of HAVE_CACHEATTR */ +#define XCHAL_HAVE_SPANNING_WAY 1 /* one way maps I+D 4GB vaddr */ +#define XCHAL_SPANNING_WAY 0 /* TLB spanning way number */ +#define XCHAL_HAVE_IDENTITY_MAP 1 /* vaddr == paddr always */ +#define XCHAL_HAVE_CACHEATTR 0 /* CACHEATTR register present */ +#define XCHAL_HAVE_MIMIC_CACHEATTR 1 /* region protection */ +#define XCHAL_HAVE_XLT_CACHEATTR 0 /* region prot. w/translation */ +#define XCHAL_HAVE_PTP_MMU 0 /* full MMU (with page table + [autorefill] and protection) + usable for an MMU-based OS */ + +/* If none of the above last 5 are set, it's a custom TLB configuration. */ + +#define XCHAL_MMU_ASID_BITS 0 /* number of bits in ASIDs */ +#define XCHAL_MMU_RINGS 1 /* number of rings (1..4) */ +#define XCHAL_MMU_RING_BITS 0 /* num of bits in RING field */ + +/*---------------------------------------------------------------------- + MPU + ----------------------------------------------------------------------*/ +#define XCHAL_HAVE_MPU 0 +#define XCHAL_MPU_ENTRIES 0 + +#define XCHAL_MPU_ALIGN_REQ 1 /* MPU requires alignment of entries to background map */ +#define XCHAL_MPU_BACKGROUND_ENTRIES 0 /* number of entries in bg map*/ +#define XCHAL_MPU_BG_CACHEADRDIS 0 /* default CACHEADRDIS for bg */ + +#define XCHAL_MPU_ALIGN_BITS 0 +#define XCHAL_MPU_ALIGN 0 + +#endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */ + + +#endif /* _XTENSA_CORE_CONFIGURATION_H */ + diff --git a/components/xtensa/esp32s2beta/include/xtensa/config/core-matmap.h b/components/xtensa/esp32s2beta/include/xtensa/config/core-matmap.h new file mode 100644 index 0000000000..724e84f1df --- /dev/null +++ b/components/xtensa/esp32s2beta/include/xtensa/config/core-matmap.h @@ -0,0 +1,322 @@ +/* + * xtensa/config/core-matmap.h -- Memory access and translation mapping + * parameters (CHAL) of the Xtensa processor core configuration. + * + * If you are using Xtensa Tools, see (which includes + * this file) for more details. + * + * In the Xtensa processor products released to date, all parameters + * defined in this file are derivable (at least in theory) from + * information contained in the core-isa.h header file. + * In particular, the following core configuration parameters are relevant: + * XCHAL_HAVE_CACHEATTR + * XCHAL_HAVE_MIMIC_CACHEATTR + * XCHAL_HAVE_XLT_CACHEATTR + * XCHAL_HAVE_PTP_MMU + * XCHAL_ITLB_ARF_ENTRIES_LOG2 + * XCHAL_DTLB_ARF_ENTRIES_LOG2 + * XCHAL_DCACHE_IS_WRITEBACK + * XCHAL_ICACHE_SIZE (presence of I-cache) + * XCHAL_DCACHE_SIZE (presence of D-cache) + * XCHAL_HW_VERSION_MAJOR + * XCHAL_HW_VERSION_MINOR + */ + +/* Copyright (c) 1999-2018 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + +#ifndef XTENSA_CONFIG_CORE_MATMAP_H +#define XTENSA_CONFIG_CORE_MATMAP_H + + +/*---------------------------------------------------------------------- + CACHE (MEMORY ACCESS) ATTRIBUTES + ----------------------------------------------------------------------*/ + + + +/* Cache Attribute encodings -- lists of access modes for each cache attribute: */ +#define XCHAL_FCA_LIST XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_BYPASS XCHAL_SEP \ + XTHAL_FAM_BYPASS XCHAL_SEP \ + XTHAL_FAM_BYPASS XCHAL_SEP \ + XTHAL_FAM_BYPASS XCHAL_SEP \ + XTHAL_FAM_BYPASS XCHAL_SEP \ + XTHAL_FAM_BYPASS XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION XCHAL_SEP \ + XTHAL_FAM_EXCEPTION +#define XCHAL_LCA_LIST XTHAL_LAM_BYPASSG XCHAL_SEP \ + XTHAL_LAM_BYPASSG XCHAL_SEP \ + XTHAL_LAM_BYPASSG XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_BYPASSG XCHAL_SEP \ + XTHAL_LAM_BYPASSG XCHAL_SEP \ + XTHAL_LAM_BYPASSG XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION XCHAL_SEP \ + XTHAL_LAM_EXCEPTION +#define XCHAL_SCA_LIST XTHAL_SAM_BYPASS XCHAL_SEP \ + XTHAL_SAM_BYPASS XCHAL_SEP \ + XTHAL_SAM_BYPASS XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_BYPASS XCHAL_SEP \ + XTHAL_SAM_BYPASS XCHAL_SEP \ + XTHAL_SAM_BYPASS XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION XCHAL_SEP \ + XTHAL_SAM_EXCEPTION + +#define XCHAL_CA_R (0xC0 | 0x40000000) +#define XCHAL_CA_RX (0xD0 | 0x40000000) +#define XCHAL_CA_RW (0xE0 | 0x40000000) +#define XCHAL_CA_RWX (0xF0 | 0x40000000) + +/* + * Specific encoded cache attribute values of general interest. + * If a specific cache mode is not available, the closest available + * one is returned instead (eg. writethru instead of writeback, + * bypass instead of writethru). + */ +#define XCHAL_CA_BYPASS 2 /* cache disabled (bypassed) mode */ +#define XCHAL_CA_BYPASSBUF 6 /* cache disabled (bypassed) bufferable mode */ +#define XCHAL_CA_WRITETHRU 1 /* cache enabled (write-through) mode */ +#define XCHAL_CA_WRITEBACK 2 /* cache enabled (write-back) mode */ +#define XCHAL_HAVE_CA_WRITEBACK_NOALLOC 0 /* write-back no-allocate availability */ +#define XCHAL_CA_WRITEBACK_NOALLOC 2 /* cache enabled (write-back no-allocate) mode */ +#define XCHAL_CA_BYPASS_RW 0 /* cache disabled (bypassed) mode (no exec) */ +#define XCHAL_CA_WRITETHRU_RW 0 /* cache enabled (write-through) mode (no exec) (FALLBACK) */ +#define XCHAL_CA_WRITEBACK_RW 0 /* cache enabled (write-back) mode (no exec) */ +#define XCHAL_CA_WRITEBACK_NOALLOC_RW 0 /* cache enabled (write-back no-allocate) mode (no exec) */ +#define XCHAL_CA_ILLEGAL 15 /* no access allowed (all cause exceptions) mode */ +#define XCHAL_CA_ISOLATE 0 /* cache isolate (accesses go to cache not memory) mode */ + +/*---------------------------------------------------------------------- + MMU + ----------------------------------------------------------------------*/ + +/* + * General notes on MMU parameters. + * + * Terminology: + * ASID = address-space ID (acts as an "extension" of virtual addresses) + * VPN = virtual page number + * PPN = physical page number + * CA = encoded cache attribute (access modes) + * TLB = translation look-aside buffer (term is stretched somewhat here) + * I = instruction (fetch accesses) + * D = data (load and store accesses) + * way = each TLB (ITLB and DTLB) consists of a number of "ways" + * that simultaneously match the virtual address of an access; + * a TLB successfully translates a virtual address if exactly + * one way matches the vaddr; if none match, it is a miss; + * if multiple match, one gets a "multihit" exception; + * each way can be independently configured in terms of number of + * entries, page sizes, which fields are writable or constant, etc. + * set = group of contiguous ways with exactly identical parameters + * ARF = auto-refill; hardware services a 1st-level miss by loading a PTE + * from the page table and storing it in one of the auto-refill ways; + * if this PTE load also misses, a miss exception is posted for s/w. + * min-wired = a "min-wired" way can be used to map a single (minimum-sized) + * page arbitrarily under program control; it has a single entry, + * is non-auto-refill (some other way(s) must be auto-refill), + * all its fields (VPN, PPN, ASID, CA) are all writable, and it + * supports the XCHAL_MMU_MIN_PTE_PAGE_SIZE page size (a current + * restriction is that this be the only page size it supports). + * + * TLB way entries are virtually indexed. + * TLB ways that support multiple page sizes: + * - must have all writable VPN and PPN fields; + * - can only use one page size at any given time (eg. setup at startup), + * selected by the respective ITLBCFG or DTLBCFG special register, + * whose bits n*4+3 .. n*4 index the list of page sizes for way n + * (XCHAL_xTLB_SETm_PAGESZ_LOG2_LIST for set m corresponding to way n); + * this list may be sparse for auto-refill ways because auto-refill + * ways have independent lists of supported page sizes sharing a + * common encoding with PTE entries; the encoding is the index into + * this list; unsupported sizes for a given way are zero in the list; + * selecting unsupported sizes results in undefine hardware behaviour; + * - is only possible for ways 0 thru 7 (due to ITLBCFG/DTLBCFG definition). + */ + +#define XCHAL_MMU_ASID_INVALID 0 /* ASID value indicating invalid address space */ +#define XCHAL_MMU_ASID_KERNEL 0 /* ASID value indicating kernel (ring 0) address space */ +#define XCHAL_MMU_SR_BITS 0 /* number of size-restriction bits supported */ +#define XCHAL_MMU_CA_BITS 4 /* number of bits needed to hold cache attribute encoding */ +#define XCHAL_MMU_MAX_PTE_PAGE_SIZE 29 /* max page size in a PTE structure (log2) */ +#define XCHAL_MMU_MIN_PTE_PAGE_SIZE 29 /* min page size in a PTE structure (log2) */ + + +/*** Instruction TLB: ***/ + +#define XCHAL_ITLB_WAY_BITS 0 /* number of bits holding the ways */ +#define XCHAL_ITLB_WAYS 1 /* number of ways (n-way set-associative TLB) */ +#define XCHAL_ITLB_ARF_WAYS 0 /* number of auto-refill ways */ +#define XCHAL_ITLB_SETS 1 /* number of sets (groups of ways with identical settings) */ + +/* Way set to which each way belongs: */ +#define XCHAL_ITLB_WAY0_SET 0 + +/* Ways sets that are used by hardware auto-refill (ARF): */ +#define XCHAL_ITLB_ARF_SETS 0 /* number of auto-refill sets */ + +/* Way sets that are "min-wired" (see terminology comment above): */ +#define XCHAL_ITLB_MINWIRED_SETS 0 /* number of "min-wired" sets */ + + +/* ITLB way set 0 (group of ways 0 thru 0): */ +#define XCHAL_ITLB_SET0_WAY 0 /* index of first way in this way set */ +#define XCHAL_ITLB_SET0_WAYS 1 /* number of (contiguous) ways in this way set */ +#define XCHAL_ITLB_SET0_ENTRIES_LOG2 3 /* log2(number of entries in this way) */ +#define XCHAL_ITLB_SET0_ENTRIES 8 /* number of entries in this way (always a power of 2) */ +#define XCHAL_ITLB_SET0_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ +#define XCHAL_ITLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */ +#define XCHAL_ITLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */ +#define XCHAL_ITLB_SET0_PAGESZ_LOG2_MIN 29 /* log2(minimum supported page size) */ +#define XCHAL_ITLB_SET0_PAGESZ_LOG2_MAX 29 /* log2(maximum supported page size) */ +#define XCHAL_ITLB_SET0_PAGESZ_LOG2_LIST 29 /* list of log2(page size)s, separated by XCHAL_SEP; + 2^PAGESZ_BITS entries in list, unsupported entries are zero */ +#define XCHAL_ITLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_VPN_CONSTMASK 0x00000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_PPN_CONSTMASK 0xE0000000 /* constant PPN bits, including entry index bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ +#define XCHAL_ITLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ +#define XCHAL_ITLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_ITLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_ITLB_SET0_CA_RESET 1 /* 1 if CA reset values defined (and all writable); 0 otherwise */ +/* Constant VPN values for each entry of ITLB way set 0 (because VPN_CONSTMASK is non-zero): */ +#define XCHAL_ITLB_SET0_E0_VPN_CONST 0x00000000 +#define XCHAL_ITLB_SET0_E1_VPN_CONST 0x20000000 +#define XCHAL_ITLB_SET0_E2_VPN_CONST 0x40000000 +#define XCHAL_ITLB_SET0_E3_VPN_CONST 0x60000000 +#define XCHAL_ITLB_SET0_E4_VPN_CONST 0x80000000 +#define XCHAL_ITLB_SET0_E5_VPN_CONST 0xA0000000 +#define XCHAL_ITLB_SET0_E6_VPN_CONST 0xC0000000 +#define XCHAL_ITLB_SET0_E7_VPN_CONST 0xE0000000 +/* Constant PPN values for each entry of ITLB way set 0 (because PPN_CONSTMASK is non-zero): */ +#define XCHAL_ITLB_SET0_E0_PPN_CONST 0x00000000 +#define XCHAL_ITLB_SET0_E1_PPN_CONST 0x20000000 +#define XCHAL_ITLB_SET0_E2_PPN_CONST 0x40000000 +#define XCHAL_ITLB_SET0_E3_PPN_CONST 0x60000000 +#define XCHAL_ITLB_SET0_E4_PPN_CONST 0x80000000 +#define XCHAL_ITLB_SET0_E5_PPN_CONST 0xA0000000 +#define XCHAL_ITLB_SET0_E6_PPN_CONST 0xC0000000 +#define XCHAL_ITLB_SET0_E7_PPN_CONST 0xE0000000 +/* Reset CA values for each entry of ITLB way set 0 (because SET0_CA_RESET is non-zero): */ +#define XCHAL_ITLB_SET0_E0_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E1_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E2_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E3_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E4_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E5_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E6_CA_RESET 0x02 +#define XCHAL_ITLB_SET0_E7_CA_RESET 0x02 + + +/*** Data TLB: ***/ + +#define XCHAL_DTLB_WAY_BITS 0 /* number of bits holding the ways */ +#define XCHAL_DTLB_WAYS 1 /* number of ways (n-way set-associative TLB) */ +#define XCHAL_DTLB_ARF_WAYS 0 /* number of auto-refill ways */ +#define XCHAL_DTLB_SETS 1 /* number of sets (groups of ways with identical settings) */ + +/* Way set to which each way belongs: */ +#define XCHAL_DTLB_WAY0_SET 0 + +/* Ways sets that are used by hardware auto-refill (ARF): */ +#define XCHAL_DTLB_ARF_SETS 0 /* number of auto-refill sets */ + +/* Way sets that are "min-wired" (see terminology comment above): */ +#define XCHAL_DTLB_MINWIRED_SETS 0 /* number of "min-wired" sets */ + + +/* DTLB way set 0 (group of ways 0 thru 0): */ +#define XCHAL_DTLB_SET0_WAY 0 /* index of first way in this way set */ +#define XCHAL_DTLB_SET0_WAYS 1 /* number of (contiguous) ways in this way set */ +#define XCHAL_DTLB_SET0_ENTRIES_LOG2 3 /* log2(number of entries in this way) */ +#define XCHAL_DTLB_SET0_ENTRIES 8 /* number of entries in this way (always a power of 2) */ +#define XCHAL_DTLB_SET0_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */ +#define XCHAL_DTLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */ +#define XCHAL_DTLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */ +#define XCHAL_DTLB_SET0_PAGESZ_LOG2_MIN 29 /* log2(minimum supported page size) */ +#define XCHAL_DTLB_SET0_PAGESZ_LOG2_MAX 29 /* log2(maximum supported page size) */ +#define XCHAL_DTLB_SET0_PAGESZ_LOG2_LIST 29 /* list of log2(page size)s, separated by XCHAL_SEP; + 2^PAGESZ_BITS entries in list, unsupported entries are zero */ +#define XCHAL_DTLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_VPN_CONSTMASK 0x00000000 /* constant VPN bits, not including entry index bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_PPN_CONSTMASK 0xE0000000 /* constant PPN bits, including entry index bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */ +#define XCHAL_DTLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */ +#define XCHAL_DTLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_DTLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */ +#define XCHAL_DTLB_SET0_CA_RESET 1 /* 1 if CA reset values defined (and all writable); 0 otherwise */ +/* Constant VPN values for each entry of DTLB way set 0 (because VPN_CONSTMASK is non-zero): */ +#define XCHAL_DTLB_SET0_E0_VPN_CONST 0x00000000 +#define XCHAL_DTLB_SET0_E1_VPN_CONST 0x20000000 +#define XCHAL_DTLB_SET0_E2_VPN_CONST 0x40000000 +#define XCHAL_DTLB_SET0_E3_VPN_CONST 0x60000000 +#define XCHAL_DTLB_SET0_E4_VPN_CONST 0x80000000 +#define XCHAL_DTLB_SET0_E5_VPN_CONST 0xA0000000 +#define XCHAL_DTLB_SET0_E6_VPN_CONST 0xC0000000 +#define XCHAL_DTLB_SET0_E7_VPN_CONST 0xE0000000 +/* Constant PPN values for each entry of DTLB way set 0 (because PPN_CONSTMASK is non-zero): */ +#define XCHAL_DTLB_SET0_E0_PPN_CONST 0x00000000 +#define XCHAL_DTLB_SET0_E1_PPN_CONST 0x20000000 +#define XCHAL_DTLB_SET0_E2_PPN_CONST 0x40000000 +#define XCHAL_DTLB_SET0_E3_PPN_CONST 0x60000000 +#define XCHAL_DTLB_SET0_E4_PPN_CONST 0x80000000 +#define XCHAL_DTLB_SET0_E5_PPN_CONST 0xA0000000 +#define XCHAL_DTLB_SET0_E6_PPN_CONST 0xC0000000 +#define XCHAL_DTLB_SET0_E7_PPN_CONST 0xE0000000 +/* Reset CA values for each entry of DTLB way set 0 (because SET0_CA_RESET is non-zero): */ +#define XCHAL_DTLB_SET0_E0_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E1_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E2_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E3_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E4_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E5_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E6_CA_RESET 0x02 +#define XCHAL_DTLB_SET0_E7_CA_RESET 0x02 + + + + +#endif /*XTENSA_CONFIG_CORE_MATMAP_H*/ + diff --git a/components/xtensa/esp32s2beta/include/xtensa/config/core.h b/components/xtensa/esp32s2beta/include/xtensa/config/core.h new file mode 100644 index 0000000000..f5bb44faf2 --- /dev/null +++ b/components/xtensa/esp32s2beta/include/xtensa/config/core.h @@ -0,0 +1,1408 @@ +/* + * xtensa/config/core.h -- HAL definitions dependent on CORE configuration + * + * This header file is sometimes referred to as the "compile-time HAL" or CHAL. + * It pulls definitions tailored for a specific Xtensa processor configuration. + * + * Sources for binaries meant to be configuration-independent generally avoid + * including this file (they may use the configuration-specific HAL library). + * It is normal for the HAL library source itself to include this file. + */ + +/* + * Copyright (c) 2005-2015 Cadence Design Systems, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef XTENSA_CONFIG_CORE_H +#define XTENSA_CONFIG_CORE_H + +/* CONFIGURATION INDEPENDENT DEFINITIONS: */ +#ifdef __XTENSA__ +#include +#include +#else +#include "../hal.h" +#include "../xtensa-versions.h" +#endif + +/* CONFIGURATION SPECIFIC DEFINITIONS: */ +#ifdef __XTENSA__ +#include +#include +#include +#else +#include "core-isa.h" +#include "core-matmap.h" +#include "tie.h" +#endif + +#if defined (_ASMLANGUAGE) || defined (__ASSEMBLER__) +#ifdef __XTENSA__ +#include +#else +#include "tie-asm.h" +#endif +#endif /*_ASMLANGUAGE or __ASSEMBLER__*/ + + +/*---------------------------------------------------------------------- + GENERAL + ----------------------------------------------------------------------*/ + +/* + * Separators for macros that expand into arrays. + * These can be predefined by files that #include this one, + * when different separators are required. + */ +/* Element separator for macros that expand into 1-dimensional arrays: */ +#ifndef XCHAL_SEP +#define XCHAL_SEP , +#endif +/* Array separator for macros that expand into 2-dimensional arrays: */ +#ifndef XCHAL_SEP2 +#define XCHAL_SEP2 },{ +#endif + + +/*---------------------------------------------------------------------- + ERRATA + ----------------------------------------------------------------------*/ + +/* + * Erratum T1020.H13, T1030.H7, T1040.H10, T1050.H4 (fixed in T1040.3 and T1050.1; + * relevant only in XEA1, kernel-vector mode, level-one interrupts and overflows enabled): + */ +#define XCHAL_MAYHAVE_ERRATUM_XEA1KWIN (XCHAL_HAVE_XEA1 && \ + (XCHAL_HW_RELEASE_AT_OR_BELOW(1040,2) != 0 \ + || XCHAL_HW_RELEASE_AT(1050,0))) +/* + * Erratum 453 present in RE-2013.2 up to RF-2014.0, fixed in RF-2014.1. + * Applies to specific set of configuration options. + * Part of the workaround is to add ISYNC at certain points in the code. + * The workaround gated by this macro can be disabled if not needed, e.g. if + * zero-overhead loop buffer will be disabled, by defining _NO_ERRATUM_453. + */ +#if ( XCHAL_HW_MAX_VERSION >= XTENSA_HWVERSION_RE_2013_2 && \ + XCHAL_HW_MIN_VERSION <= XTENSA_HWVERSION_RF_2014_0 && \ + XCHAL_ICACHE_SIZE != 0 && XCHAL_HAVE_PIF /*covers also AXI/AHB*/ && \ + XCHAL_HAVE_LOOPS && XCHAL_LOOP_BUFFER_SIZE != 0 && \ + XCHAL_CLOCK_GATING_GLOBAL && !defined(_NO_ERRATUM_453) ) +#define XCHAL_ERRATUM_453 1 +#else +#define XCHAL_ERRATUM_453 0 +#endif + +/* + * Erratum 497 present in RE-2012.2 up to RG/RF-2015.2 + * Applies to specific set of configuration options. + * Workaround is to add MEMWs after at most 8 cache WB instructions + */ +#if ( ((XCHAL_HW_MAX_VERSION >= XTENSA_HWVERSION_RE_2012_0 && \ + XCHAL_HW_MIN_VERSION <= XTENSA_HWVERSION_RF_2015_2) || \ + (XCHAL_HW_MAX_VERSION >= XTENSA_HWVERSION_RG_2015_0 && \ + XCHAL_HW_MIN_VERSION <= XTENSA_HWVERSION_RG_2015_2) \ + ) && \ + XCHAL_DCACHE_IS_WRITEBACK && \ + XCHAL_HAVE_AXI && \ + XCHAL_HAVE_PIF_WR_RESP && \ + XCHAL_HAVE_PIF_REQ_ATTR && !defined(_NO_ERRATUM_497) \ + ) +#define XCHAL_ERRATUM_497 1 +#else +#define XCHAL_ERRATUM_497 0 +#endif + + +/*---------------------------------------------------------------------- + ISA + ----------------------------------------------------------------------*/ + +#if XCHAL_HAVE_BE +# define XCHAL_HAVE_LE 0 +# define XCHAL_MEMORY_ORDER XTHAL_BIGENDIAN +#else +# define XCHAL_HAVE_LE 1 +# define XCHAL_MEMORY_ORDER XTHAL_LITTLEENDIAN +#endif + + + +/*---------------------------------------------------------------------- + INTERRUPTS + ----------------------------------------------------------------------*/ + +/* Indexing macros: */ +#define _XCHAL_INTLEVEL_MASK(n) XCHAL_INTLEVEL ## n ## _MASK +#define XCHAL_INTLEVEL_MASK(n) _XCHAL_INTLEVEL_MASK(n) /* n = 0 .. 15 */ +#define _XCHAL_INTLEVEL_ANDBELOWMASK(n) XCHAL_INTLEVEL ## n ## _ANDBELOW_MASK +#define XCHAL_INTLEVEL_ANDBELOW_MASK(n) _XCHAL_INTLEVEL_ANDBELOWMASK(n) /* n = 0 .. 15 */ +#define _XCHAL_INTLEVEL_NUM(n) XCHAL_INTLEVEL ## n ## _NUM +#define XCHAL_INTLEVEL_NUM(n) _XCHAL_INTLEVEL_NUM(n) /* n = 0 .. 15 */ +#define _XCHAL_INT_LEVEL(n) XCHAL_INT ## n ## _LEVEL +#define XCHAL_INT_LEVEL(n) _XCHAL_INT_LEVEL(n) /* n = 0 .. 31 */ +#define _XCHAL_INT_TYPE(n) XCHAL_INT ## n ## _TYPE +#define XCHAL_INT_TYPE(n) _XCHAL_INT_TYPE(n) /* n = 0 .. 31 */ +#define _XCHAL_TIMER_INTERRUPT(n) XCHAL_TIMER ## n ## _INTERRUPT +#define XCHAL_TIMER_INTERRUPT(n) _XCHAL_TIMER_INTERRUPT(n) /* n = 0 .. 3 */ + + +#define XCHAL_HAVE_HIGHLEVEL_INTERRUPTS XCHAL_HAVE_HIGHPRI_INTERRUPTS +#define XCHAL_NUM_LOWPRI_LEVELS 1 /* number of low-priority interrupt levels (always 1) */ +#define XCHAL_FIRST_HIGHPRI_LEVEL (XCHAL_NUM_LOWPRI_LEVELS+1) /* level of first high-priority interrupt (always 2) */ +/* Note: 1 <= LOWPRI_LEVELS <= EXCM_LEVEL < DEBUGLEVEL <= NUM_INTLEVELS < NMILEVEL <= 15 */ + +/* These values are constant for existing Xtensa processor implementations: */ +#define XCHAL_INTLEVEL0_MASK 0x00000000 +#define XCHAL_INTLEVEL8_MASK 0x00000000 +#define XCHAL_INTLEVEL9_MASK 0x00000000 +#define XCHAL_INTLEVEL10_MASK 0x00000000 +#define XCHAL_INTLEVEL11_MASK 0x00000000 +#define XCHAL_INTLEVEL12_MASK 0x00000000 +#define XCHAL_INTLEVEL13_MASK 0x00000000 +#define XCHAL_INTLEVEL14_MASK 0x00000000 +#define XCHAL_INTLEVEL15_MASK 0x00000000 + +/* Array of masks of interrupts at each interrupt level: */ +#define XCHAL_INTLEVEL_MASKS XCHAL_INTLEVEL0_MASK \ + XCHAL_SEP XCHAL_INTLEVEL1_MASK \ + XCHAL_SEP XCHAL_INTLEVEL2_MASK \ + XCHAL_SEP XCHAL_INTLEVEL3_MASK \ + XCHAL_SEP XCHAL_INTLEVEL4_MASK \ + XCHAL_SEP XCHAL_INTLEVEL5_MASK \ + XCHAL_SEP XCHAL_INTLEVEL6_MASK \ + XCHAL_SEP XCHAL_INTLEVEL7_MASK \ + XCHAL_SEP XCHAL_INTLEVEL8_MASK \ + XCHAL_SEP XCHAL_INTLEVEL9_MASK \ + XCHAL_SEP XCHAL_INTLEVEL10_MASK \ + XCHAL_SEP XCHAL_INTLEVEL11_MASK \ + XCHAL_SEP XCHAL_INTLEVEL12_MASK \ + XCHAL_SEP XCHAL_INTLEVEL13_MASK \ + XCHAL_SEP XCHAL_INTLEVEL14_MASK \ + XCHAL_SEP XCHAL_INTLEVEL15_MASK + +/* These values are constant for existing Xtensa processor implementations: */ +#define XCHAL_INTLEVEL0_ANDBELOW_MASK 0x00000000 +#define XCHAL_INTLEVEL8_ANDBELOW_MASK XCHAL_INTLEVEL7_ANDBELOW_MASK +#define XCHAL_INTLEVEL9_ANDBELOW_MASK XCHAL_INTLEVEL7_ANDBELOW_MASK +#define XCHAL_INTLEVEL10_ANDBELOW_MASK XCHAL_INTLEVEL7_ANDBELOW_MASK +#define XCHAL_INTLEVEL11_ANDBELOW_MASK XCHAL_INTLEVEL7_ANDBELOW_MASK +#define XCHAL_INTLEVEL12_ANDBELOW_MASK XCHAL_INTLEVEL7_ANDBELOW_MASK +#define XCHAL_INTLEVEL13_ANDBELOW_MASK XCHAL_INTLEVEL7_ANDBELOW_MASK +#define XCHAL_INTLEVEL14_ANDBELOW_MASK XCHAL_INTLEVEL7_ANDBELOW_MASK +#define XCHAL_INTLEVEL15_ANDBELOW_MASK XCHAL_INTLEVEL7_ANDBELOW_MASK + +/* Mask of all low-priority interrupts: */ +#define XCHAL_LOWPRI_MASK XCHAL_INTLEVEL1_ANDBELOW_MASK + +/* Mask of all interrupts masked by PS.EXCM (or CEXCM): */ +#define XCHAL_EXCM_MASK XCHAL_INTLEVEL_ANDBELOW_MASK(XCHAL_EXCM_LEVEL) + +/* Array of masks of interrupts at each range 1..n of interrupt levels: */ +#define XCHAL_INTLEVEL_ANDBELOW_MASKS XCHAL_INTLEVEL0_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL1_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL2_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL3_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL4_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL5_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL6_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL7_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL8_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL9_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL10_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL11_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL12_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL13_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL14_ANDBELOW_MASK \ + XCHAL_SEP XCHAL_INTLEVEL15_ANDBELOW_MASK + +#if 0 /*XCHAL_HAVE_NMI*/ +/* NMI "interrupt level" (for use with EXCSAVE_n, EPS_n, EPC_n, RFI n): */ +# define XCHAL_NMILEVEL (XCHAL_NUM_INTLEVELS+1) +#endif + +/* Array of levels of each possible interrupt: */ +#define XCHAL_INT_LEVELS XCHAL_INT0_LEVEL \ + XCHAL_SEP XCHAL_INT1_LEVEL \ + XCHAL_SEP XCHAL_INT2_LEVEL \ + XCHAL_SEP XCHAL_INT3_LEVEL \ + XCHAL_SEP XCHAL_INT4_LEVEL \ + XCHAL_SEP XCHAL_INT5_LEVEL \ + XCHAL_SEP XCHAL_INT6_LEVEL \ + XCHAL_SEP XCHAL_INT7_LEVEL \ + XCHAL_SEP XCHAL_INT8_LEVEL \ + XCHAL_SEP XCHAL_INT9_LEVEL \ + XCHAL_SEP XCHAL_INT10_LEVEL \ + XCHAL_SEP XCHAL_INT11_LEVEL \ + XCHAL_SEP XCHAL_INT12_LEVEL \ + XCHAL_SEP XCHAL_INT13_LEVEL \ + XCHAL_SEP XCHAL_INT14_LEVEL \ + XCHAL_SEP XCHAL_INT15_LEVEL \ + XCHAL_SEP XCHAL_INT16_LEVEL \ + XCHAL_SEP XCHAL_INT17_LEVEL \ + XCHAL_SEP XCHAL_INT18_LEVEL \ + XCHAL_SEP XCHAL_INT19_LEVEL \ + XCHAL_SEP XCHAL_INT20_LEVEL \ + XCHAL_SEP XCHAL_INT21_LEVEL \ + XCHAL_SEP XCHAL_INT22_LEVEL \ + XCHAL_SEP XCHAL_INT23_LEVEL \ + XCHAL_SEP XCHAL_INT24_LEVEL \ + XCHAL_SEP XCHAL_INT25_LEVEL \ + XCHAL_SEP XCHAL_INT26_LEVEL \ + XCHAL_SEP XCHAL_INT27_LEVEL \ + XCHAL_SEP XCHAL_INT28_LEVEL \ + XCHAL_SEP XCHAL_INT29_LEVEL \ + XCHAL_SEP XCHAL_INT30_LEVEL \ + XCHAL_SEP XCHAL_INT31_LEVEL + +/* Array of types of each possible interrupt: */ +#define XCHAL_INT_TYPES XCHAL_INT0_TYPE \ + XCHAL_SEP XCHAL_INT1_TYPE \ + XCHAL_SEP XCHAL_INT2_TYPE \ + XCHAL_SEP XCHAL_INT3_TYPE \ + XCHAL_SEP XCHAL_INT4_TYPE \ + XCHAL_SEP XCHAL_INT5_TYPE \ + XCHAL_SEP XCHAL_INT6_TYPE \ + XCHAL_SEP XCHAL_INT7_TYPE \ + XCHAL_SEP XCHAL_INT8_TYPE \ + XCHAL_SEP XCHAL_INT9_TYPE \ + XCHAL_SEP XCHAL_INT10_TYPE \ + XCHAL_SEP XCHAL_INT11_TYPE \ + XCHAL_SEP XCHAL_INT12_TYPE \ + XCHAL_SEP XCHAL_INT13_TYPE \ + XCHAL_SEP XCHAL_INT14_TYPE \ + XCHAL_SEP XCHAL_INT15_TYPE \ + XCHAL_SEP XCHAL_INT16_TYPE \ + XCHAL_SEP XCHAL_INT17_TYPE \ + XCHAL_SEP XCHAL_INT18_TYPE \ + XCHAL_SEP XCHAL_INT19_TYPE \ + XCHAL_SEP XCHAL_INT20_TYPE \ + XCHAL_SEP XCHAL_INT21_TYPE \ + XCHAL_SEP XCHAL_INT22_TYPE \ + XCHAL_SEP XCHAL_INT23_TYPE \ + XCHAL_SEP XCHAL_INT24_TYPE \ + XCHAL_SEP XCHAL_INT25_TYPE \ + XCHAL_SEP XCHAL_INT26_TYPE \ + XCHAL_SEP XCHAL_INT27_TYPE \ + XCHAL_SEP XCHAL_INT28_TYPE \ + XCHAL_SEP XCHAL_INT29_TYPE \ + XCHAL_SEP XCHAL_INT30_TYPE \ + XCHAL_SEP XCHAL_INT31_TYPE + +/* Array of masks of interrupts for each type of interrupt: */ +#define XCHAL_INTTYPE_MASKS XCHAL_INTTYPE_MASK_UNCONFIGURED \ + XCHAL_SEP XCHAL_INTTYPE_MASK_SOFTWARE \ + XCHAL_SEP XCHAL_INTTYPE_MASK_EXTERN_EDGE \ + XCHAL_SEP XCHAL_INTTYPE_MASK_EXTERN_LEVEL \ + XCHAL_SEP XCHAL_INTTYPE_MASK_TIMER \ + XCHAL_SEP XCHAL_INTTYPE_MASK_NMI \ + XCHAL_SEP XCHAL_INTTYPE_MASK_WRITE_ERROR \ + XCHAL_SEP XCHAL_INTTYPE_MASK_IDMA_DONE \ + XCHAL_SEP XCHAL_INTTYPE_MASK_IDMA_ERR \ + XCHAL_SEP XCHAL_INTTYPE_MASK_GS_ERR + +/* Interrupts that can be cleared using the INTCLEAR special register: */ +#define XCHAL_INTCLEARABLE_MASK (XCHAL_INTTYPE_MASK_SOFTWARE+XCHAL_INTTYPE_MASK_EXTERN_EDGE+XCHAL_INTTYPE_MASK_WRITE_ERROR) +/* Interrupts that can be triggered using the INTSET special register: */ +#define XCHAL_INTSETTABLE_MASK XCHAL_INTTYPE_MASK_SOFTWARE + +/* Array of interrupts assigned to each timer (CCOMPARE0 to CCOMPARE3): */ +#define XCHAL_TIMER_INTERRUPTS XCHAL_TIMER0_INTERRUPT \ + XCHAL_SEP XCHAL_TIMER1_INTERRUPT \ + XCHAL_SEP XCHAL_TIMER2_INTERRUPT \ + XCHAL_SEP XCHAL_TIMER3_INTERRUPT + + + +/* For backward compatibility and for the array macros, define macros for + * each unconfigured interrupt number (unfortunately, the value of + * XTHAL_INTTYPE_UNCONFIGURED is not zero): */ +#if XCHAL_NUM_INTERRUPTS == 0 +# define XCHAL_INT0_LEVEL 0 +# define XCHAL_INT0_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 1 +# define XCHAL_INT1_LEVEL 0 +# define XCHAL_INT1_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 2 +# define XCHAL_INT2_LEVEL 0 +# define XCHAL_INT2_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 3 +# define XCHAL_INT3_LEVEL 0 +# define XCHAL_INT3_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 4 +# define XCHAL_INT4_LEVEL 0 +# define XCHAL_INT4_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 5 +# define XCHAL_INT5_LEVEL 0 +# define XCHAL_INT5_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 6 +# define XCHAL_INT6_LEVEL 0 +# define XCHAL_INT6_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 7 +# define XCHAL_INT7_LEVEL 0 +# define XCHAL_INT7_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 8 +# define XCHAL_INT8_LEVEL 0 +# define XCHAL_INT8_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 9 +# define XCHAL_INT9_LEVEL 0 +# define XCHAL_INT9_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 10 +# define XCHAL_INT10_LEVEL 0 +# define XCHAL_INT10_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 11 +# define XCHAL_INT11_LEVEL 0 +# define XCHAL_INT11_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 12 +# define XCHAL_INT12_LEVEL 0 +# define XCHAL_INT12_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 13 +# define XCHAL_INT13_LEVEL 0 +# define XCHAL_INT13_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 14 +# define XCHAL_INT14_LEVEL 0 +# define XCHAL_INT14_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 15 +# define XCHAL_INT15_LEVEL 0 +# define XCHAL_INT15_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 16 +# define XCHAL_INT16_LEVEL 0 +# define XCHAL_INT16_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 17 +# define XCHAL_INT17_LEVEL 0 +# define XCHAL_INT17_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 18 +# define XCHAL_INT18_LEVEL 0 +# define XCHAL_INT18_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 19 +# define XCHAL_INT19_LEVEL 0 +# define XCHAL_INT19_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 20 +# define XCHAL_INT20_LEVEL 0 +# define XCHAL_INT20_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 21 +# define XCHAL_INT21_LEVEL 0 +# define XCHAL_INT21_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 22 +# define XCHAL_INT22_LEVEL 0 +# define XCHAL_INT22_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 23 +# define XCHAL_INT23_LEVEL 0 +# define XCHAL_INT23_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 24 +# define XCHAL_INT24_LEVEL 0 +# define XCHAL_INT24_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 25 +# define XCHAL_INT25_LEVEL 0 +# define XCHAL_INT25_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 26 +# define XCHAL_INT26_LEVEL 0 +# define XCHAL_INT26_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 27 +# define XCHAL_INT27_LEVEL 0 +# define XCHAL_INT27_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 28 +# define XCHAL_INT28_LEVEL 0 +# define XCHAL_INT28_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 29 +# define XCHAL_INT29_LEVEL 0 +# define XCHAL_INT29_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 30 +# define XCHAL_INT30_LEVEL 0 +# define XCHAL_INT30_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif +#if XCHAL_NUM_INTERRUPTS <= 31 +# define XCHAL_INT31_LEVEL 0 +# define XCHAL_INT31_TYPE XTHAL_INTTYPE_UNCONFIGURED +#endif + + +/* + * Masks and levels corresponding to each *external* interrupt. + */ + +#define XCHAL_EXTINT0_MASK (1 << XCHAL_EXTINT0_NUM) +#define XCHAL_EXTINT0_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT0_NUM) +#define XCHAL_EXTINT1_MASK (1 << XCHAL_EXTINT1_NUM) +#define XCHAL_EXTINT1_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT1_NUM) +#define XCHAL_EXTINT2_MASK (1 << XCHAL_EXTINT2_NUM) +#define XCHAL_EXTINT2_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT2_NUM) +#define XCHAL_EXTINT3_MASK (1 << XCHAL_EXTINT3_NUM) +#define XCHAL_EXTINT3_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT3_NUM) +#define XCHAL_EXTINT4_MASK (1 << XCHAL_EXTINT4_NUM) +#define XCHAL_EXTINT4_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT4_NUM) +#define XCHAL_EXTINT5_MASK (1 << XCHAL_EXTINT5_NUM) +#define XCHAL_EXTINT5_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT5_NUM) +#define XCHAL_EXTINT6_MASK (1 << XCHAL_EXTINT6_NUM) +#define XCHAL_EXTINT6_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT6_NUM) +#define XCHAL_EXTINT7_MASK (1 << XCHAL_EXTINT7_NUM) +#define XCHAL_EXTINT7_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT7_NUM) +#define XCHAL_EXTINT8_MASK (1 << XCHAL_EXTINT8_NUM) +#define XCHAL_EXTINT8_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT8_NUM) +#define XCHAL_EXTINT9_MASK (1 << XCHAL_EXTINT9_NUM) +#define XCHAL_EXTINT9_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT9_NUM) +#define XCHAL_EXTINT10_MASK (1 << XCHAL_EXTINT10_NUM) +#define XCHAL_EXTINT10_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT10_NUM) +#define XCHAL_EXTINT11_MASK (1 << XCHAL_EXTINT11_NUM) +#define XCHAL_EXTINT11_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT11_NUM) +#define XCHAL_EXTINT12_MASK (1 << XCHAL_EXTINT12_NUM) +#define XCHAL_EXTINT12_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT12_NUM) +#define XCHAL_EXTINT13_MASK (1 << XCHAL_EXTINT13_NUM) +#define XCHAL_EXTINT13_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT13_NUM) +#define XCHAL_EXTINT14_MASK (1 << XCHAL_EXTINT14_NUM) +#define XCHAL_EXTINT14_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT14_NUM) +#define XCHAL_EXTINT15_MASK (1 << XCHAL_EXTINT15_NUM) +#define XCHAL_EXTINT15_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT15_NUM) +#define XCHAL_EXTINT16_MASK (1 << XCHAL_EXTINT16_NUM) +#define XCHAL_EXTINT16_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT16_NUM) +#define XCHAL_EXTINT17_MASK (1 << XCHAL_EXTINT17_NUM) +#define XCHAL_EXTINT17_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT17_NUM) +#define XCHAL_EXTINT18_MASK (1 << XCHAL_EXTINT18_NUM) +#define XCHAL_EXTINT18_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT18_NUM) +#define XCHAL_EXTINT19_MASK (1 << XCHAL_EXTINT19_NUM) +#define XCHAL_EXTINT19_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT19_NUM) +#define XCHAL_EXTINT20_MASK (1 << XCHAL_EXTINT20_NUM) +#define XCHAL_EXTINT20_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT20_NUM) +#define XCHAL_EXTINT21_MASK (1 << XCHAL_EXTINT21_NUM) +#define XCHAL_EXTINT21_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT21_NUM) +#define XCHAL_EXTINT22_MASK (1 << XCHAL_EXTINT22_NUM) +#define XCHAL_EXTINT22_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT22_NUM) +#define XCHAL_EXTINT23_MASK (1 << XCHAL_EXTINT23_NUM) +#define XCHAL_EXTINT23_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT23_NUM) +#define XCHAL_EXTINT24_MASK (1 << XCHAL_EXTINT24_NUM) +#define XCHAL_EXTINT24_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT24_NUM) +#define XCHAL_EXTINT25_MASK (1 << XCHAL_EXTINT25_NUM) +#define XCHAL_EXTINT25_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT25_NUM) +#define XCHAL_EXTINT26_MASK (1 << XCHAL_EXTINT26_NUM) +#define XCHAL_EXTINT26_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT26_NUM) +#define XCHAL_EXTINT27_MASK (1 << XCHAL_EXTINT27_NUM) +#define XCHAL_EXTINT27_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT27_NUM) +#define XCHAL_EXTINT28_MASK (1 << XCHAL_EXTINT28_NUM) +#define XCHAL_EXTINT28_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT28_NUM) +#define XCHAL_EXTINT29_MASK (1 << XCHAL_EXTINT29_NUM) +#define XCHAL_EXTINT29_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT29_NUM) +#define XCHAL_EXTINT30_MASK (1 << XCHAL_EXTINT30_NUM) +#define XCHAL_EXTINT30_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT30_NUM) +#define XCHAL_EXTINT31_MASK (1 << XCHAL_EXTINT31_NUM) +#define XCHAL_EXTINT31_LEVEL XCHAL_INT_LEVEL(XCHAL_EXTINT31_NUM) + + +/*---------------------------------------------------------------------- + EXCEPTIONS and VECTORS + ----------------------------------------------------------------------*/ + +/* For backward compatibility ONLY -- DO NOT USE (will be removed in future release): */ +#define XCHAL_HAVE_OLD_EXC_ARCH XCHAL_HAVE_XEA1 /* (DEPRECATED) 1 if old exception architecture (XEA1), 0 otherwise (eg. XEA2) */ +#define XCHAL_HAVE_EXCM XCHAL_HAVE_XEA2 /* (DEPRECATED) 1 if PS.EXCM bit exists (currently equals XCHAL_HAVE_TLBS) */ +#ifdef XCHAL_USER_VECTOR_VADDR +#define XCHAL_PROGRAMEXC_VECTOR_VADDR XCHAL_USER_VECTOR_VADDR +#define XCHAL_USEREXC_VECTOR_VADDR XCHAL_USER_VECTOR_VADDR +#endif +#ifdef XCHAL_USER_VECTOR_PADDR +# define XCHAL_PROGRAMEXC_VECTOR_PADDR XCHAL_USER_VECTOR_PADDR +# define XCHAL_USEREXC_VECTOR_PADDR XCHAL_USER_VECTOR_PADDR +#endif +#ifdef XCHAL_KERNEL_VECTOR_VADDR +# define XCHAL_STACKEDEXC_VECTOR_VADDR XCHAL_KERNEL_VECTOR_VADDR +# define XCHAL_KERNELEXC_VECTOR_VADDR XCHAL_KERNEL_VECTOR_VADDR +#endif +#ifdef XCHAL_KERNEL_VECTOR_PADDR +# define XCHAL_STACKEDEXC_VECTOR_PADDR XCHAL_KERNEL_VECTOR_PADDR +# define XCHAL_KERNELEXC_VECTOR_PADDR XCHAL_KERNEL_VECTOR_PADDR +#endif + +#if 0 +#if XCHAL_HAVE_DEBUG +# define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL_VECTOR_VADDR(XCHAL_DEBUGLEVEL) +/* This one should only get defined if the corresponding intlevel paddr macro exists: */ +# define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL_VECTOR_PADDR(XCHAL_DEBUGLEVEL) +#endif +#endif + +/* Indexing macros: */ +#define _XCHAL_INTLEVEL_VECTOR_VADDR(n) XCHAL_INTLEVEL ## n ## _VECTOR_VADDR +#define XCHAL_INTLEVEL_VECTOR_VADDR(n) _XCHAL_INTLEVEL_VECTOR_VADDR(n) /* n = 0 .. 15 */ + +/* + * General Exception Causes + * (values of EXCCAUSE special register set by general exceptions, + * which vector to the user, kernel, or double-exception vectors). + * + * DEPRECATED. Please use the equivalent EXCCAUSE_xxx macros + * defined in . (Note that these have slightly + * different names, they don't just have the XCHAL_ prefix removed.) + */ +#define XCHAL_EXCCAUSE_ILLEGAL_INSTRUCTION 0 /* Illegal Instruction */ +#define XCHAL_EXCCAUSE_SYSTEM_CALL 1 /* System Call */ +#define XCHAL_EXCCAUSE_INSTRUCTION_FETCH_ERROR 2 /* Instruction Fetch Error */ +#define XCHAL_EXCCAUSE_LOAD_STORE_ERROR 3 /* Load Store Error */ +#define XCHAL_EXCCAUSE_LEVEL1_INTERRUPT 4 /* Level 1 Interrupt */ +#define XCHAL_EXCCAUSE_ALLOCA 5 /* Stack Extension Assist */ +#define XCHAL_EXCCAUSE_INTEGER_DIVIDE_BY_ZERO 6 /* Integer Divide by Zero */ +#define XCHAL_EXCCAUSE_SPECULATION 7 /* Speculation */ +#define XCHAL_EXCCAUSE_PRIVILEGED 8 /* Privileged Instruction */ +#define XCHAL_EXCCAUSE_UNALIGNED 9 /* Unaligned Load Store */ +/*10..15 reserved*/ +#define XCHAL_EXCCAUSE_ITLB_MISS 16 /* ITlb Miss Exception */ +#define XCHAL_EXCCAUSE_ITLB_MULTIHIT 17 /* ITlb Mutltihit Exception */ +#define XCHAL_EXCCAUSE_ITLB_PRIVILEGE 18 /* ITlb Privilege Exception */ +#define XCHAL_EXCCAUSE_ITLB_SIZE_RESTRICTION 19 /* ITlb Size Restriction Exception */ +#define XCHAL_EXCCAUSE_FETCH_CACHE_ATTRIBUTE 20 /* Fetch Cache Attribute Exception */ +/*21..23 reserved*/ +#define XCHAL_EXCCAUSE_DTLB_MISS 24 /* DTlb Miss Exception */ +#define XCHAL_EXCCAUSE_DTLB_MULTIHIT 25 /* DTlb Multihit Exception */ +#define XCHAL_EXCCAUSE_DTLB_PRIVILEGE 26 /* DTlb Privilege Exception */ +#define XCHAL_EXCCAUSE_DTLB_SIZE_RESTRICTION 27 /* DTlb Size Restriction Exception */ +#define XCHAL_EXCCAUSE_LOAD_CACHE_ATTRIBUTE 28 /* Load Cache Attribute Exception */ +#define XCHAL_EXCCAUSE_STORE_CACHE_ATTRIBUTE 29 /* Store Cache Attribute Exception */ +/*30..31 reserved*/ +#define XCHAL_EXCCAUSE_COPROCESSOR0_DISABLED 32 /* Coprocessor 0 disabled */ +#define XCHAL_EXCCAUSE_COPROCESSOR1_DISABLED 33 /* Coprocessor 1 disabled */ +#define XCHAL_EXCCAUSE_COPROCESSOR2_DISABLED 34 /* Coprocessor 2 disabled */ +#define XCHAL_EXCCAUSE_COPROCESSOR3_DISABLED 35 /* Coprocessor 3 disabled */ +#define XCHAL_EXCCAUSE_COPROCESSOR4_DISABLED 36 /* Coprocessor 4 disabled */ +#define XCHAL_EXCCAUSE_COPROCESSOR5_DISABLED 37 /* Coprocessor 5 disabled */ +#define XCHAL_EXCCAUSE_COPROCESSOR6_DISABLED 38 /* Coprocessor 6 disabled */ +#define XCHAL_EXCCAUSE_COPROCESSOR7_DISABLED 39 /* Coprocessor 7 disabled */ +/*40..63 reserved*/ + + +/* + * Miscellaneous special register fields. + * + * For each special register, and each field within each register: + * XCHAL__VALIDMASK is the set of bits defined in the register. + * XCHAL___BITS is the number of bits in the field. + * XCHAL___NUM is 2^bits, the number of possible values + * of the field. + * XCHAL___SHIFT is the position of the field within + * the register, starting from the least significant bit. + * + * DEPRECATED. Please use the equivalent macros defined in + * . (Note that these have different names.) + */ + +/* DBREAKC (special register number 160): */ +#define XCHAL_DBREAKC_VALIDMASK 0xC000003F +#define XCHAL_DBREAKC_MASK_BITS 6 +#define XCHAL_DBREAKC_MASK_NUM 64 +#define XCHAL_DBREAKC_MASK_SHIFT 0 +#define XCHAL_DBREAKC_MASK_MASK 0x0000003F +#define XCHAL_DBREAKC_LOADBREAK_BITS 1 +#define XCHAL_DBREAKC_LOADBREAK_NUM 2 +#define XCHAL_DBREAKC_LOADBREAK_SHIFT 30 +#define XCHAL_DBREAKC_LOADBREAK_MASK 0x40000000 +#define XCHAL_DBREAKC_STOREBREAK_BITS 1 +#define XCHAL_DBREAKC_STOREBREAK_NUM 2 +#define XCHAL_DBREAKC_STOREBREAK_SHIFT 31 +#define XCHAL_DBREAKC_STOREBREAK_MASK 0x80000000 +/* PS (special register number 230): */ +#define XCHAL_PS_VALIDMASK 0x00070F3F +#define XCHAL_PS_INTLEVEL_BITS 4 +#define XCHAL_PS_INTLEVEL_NUM 16 +#define XCHAL_PS_INTLEVEL_SHIFT 0 +#define XCHAL_PS_INTLEVEL_MASK 0x0000000F +#define XCHAL_PS_EXCM_BITS 1 +#define XCHAL_PS_EXCM_NUM 2 +#define XCHAL_PS_EXCM_SHIFT 4 +#define XCHAL_PS_EXCM_MASK 0x00000010 +#define XCHAL_PS_UM_BITS 1 +#define XCHAL_PS_UM_NUM 2 +#define XCHAL_PS_UM_SHIFT 5 +#define XCHAL_PS_UM_MASK 0x00000020 +#define XCHAL_PS_RING_BITS 2 +#define XCHAL_PS_RING_NUM 4 +#define XCHAL_PS_RING_SHIFT 6 +#define XCHAL_PS_RING_MASK 0x000000C0 +#define XCHAL_PS_OWB_BITS 4 +#define XCHAL_PS_OWB_NUM 16 +#define XCHAL_PS_OWB_SHIFT 8 +#define XCHAL_PS_OWB_MASK 0x00000F00 +#define XCHAL_PS_CALLINC_BITS 2 +#define XCHAL_PS_CALLINC_NUM 4 +#define XCHAL_PS_CALLINC_SHIFT 16 +#define XCHAL_PS_CALLINC_MASK 0x00030000 +#define XCHAL_PS_WOE_BITS 1 +#define XCHAL_PS_WOE_NUM 2 +#define XCHAL_PS_WOE_SHIFT 18 +#define XCHAL_PS_WOE_MASK 0x00040000 +/* EXCCAUSE (special register number 232): */ +#define XCHAL_EXCCAUSE_VALIDMASK 0x0000003F +#define XCHAL_EXCCAUSE_BITS 6 +#define XCHAL_EXCCAUSE_NUM 64 +#define XCHAL_EXCCAUSE_SHIFT 0 +#define XCHAL_EXCCAUSE_MASK 0x0000003F +/* DEBUGCAUSE (special register number 233): */ +#define XCHAL_DEBUGCAUSE_VALIDMASK 0x0000003F +#define XCHAL_DEBUGCAUSE_ICOUNT_BITS 1 +#define XCHAL_DEBUGCAUSE_ICOUNT_NUM 2 +#define XCHAL_DEBUGCAUSE_ICOUNT_SHIFT 0 +#define XCHAL_DEBUGCAUSE_ICOUNT_MASK 0x00000001 +#define XCHAL_DEBUGCAUSE_IBREAK_BITS 1 +#define XCHAL_DEBUGCAUSE_IBREAK_NUM 2 +#define XCHAL_DEBUGCAUSE_IBREAK_SHIFT 1 +#define XCHAL_DEBUGCAUSE_IBREAK_MASK 0x00000002 +#define XCHAL_DEBUGCAUSE_DBREAK_BITS 1 +#define XCHAL_DEBUGCAUSE_DBREAK_NUM 2 +#define XCHAL_DEBUGCAUSE_DBREAK_SHIFT 2 +#define XCHAL_DEBUGCAUSE_DBREAK_MASK 0x00000004 +#define XCHAL_DEBUGCAUSE_BREAK_BITS 1 +#define XCHAL_DEBUGCAUSE_BREAK_NUM 2 +#define XCHAL_DEBUGCAUSE_BREAK_SHIFT 3 +#define XCHAL_DEBUGCAUSE_BREAK_MASK 0x00000008 +#define XCHAL_DEBUGCAUSE_BREAKN_BITS 1 +#define XCHAL_DEBUGCAUSE_BREAKN_NUM 2 +#define XCHAL_DEBUGCAUSE_BREAKN_SHIFT 4 +#define XCHAL_DEBUGCAUSE_BREAKN_MASK 0x00000010 +#define XCHAL_DEBUGCAUSE_DEBUGINT_BITS 1 +#define XCHAL_DEBUGCAUSE_DEBUGINT_NUM 2 +#define XCHAL_DEBUGCAUSE_DEBUGINT_SHIFT 5 +#define XCHAL_DEBUGCAUSE_DEBUGINT_MASK 0x00000020 + + + + +/*---------------------------------------------------------------------- + TIMERS + ----------------------------------------------------------------------*/ + +/*#define XCHAL_HAVE_TIMERS XCHAL_HAVE_CCOUNT*/ + + + +/*---------------------------------------------------------------------- + INTERNAL I/D RAM/ROMs and XLMI + ----------------------------------------------------------------------*/ + +#define XCHAL_NUM_IROM XCHAL_NUM_INSTROM /* (DEPRECATED) */ +#define XCHAL_NUM_IRAM XCHAL_NUM_INSTRAM /* (DEPRECATED) */ +#define XCHAL_NUM_DROM XCHAL_NUM_DATAROM /* (DEPRECATED) */ +#define XCHAL_NUM_DRAM XCHAL_NUM_DATARAM /* (DEPRECATED) */ + +#define XCHAL_IROM0_VADDR XCHAL_INSTROM0_VADDR /* (DEPRECATED) */ +#define XCHAL_IROM0_PADDR XCHAL_INSTROM0_PADDR /* (DEPRECATED) */ +#define XCHAL_IROM0_SIZE XCHAL_INSTROM0_SIZE /* (DEPRECATED) */ +#define XCHAL_IROM1_VADDR XCHAL_INSTROM1_VADDR /* (DEPRECATED) */ +#define XCHAL_IROM1_PADDR XCHAL_INSTROM1_PADDR /* (DEPRECATED) */ +#define XCHAL_IROM1_SIZE XCHAL_INSTROM1_SIZE /* (DEPRECATED) */ +#define XCHAL_IRAM0_VADDR XCHAL_INSTRAM0_VADDR /* (DEPRECATED) */ +#define XCHAL_IRAM0_PADDR XCHAL_INSTRAM0_PADDR /* (DEPRECATED) */ +#define XCHAL_IRAM0_SIZE XCHAL_INSTRAM0_SIZE /* (DEPRECATED) */ +#define XCHAL_IRAM1_VADDR XCHAL_INSTRAM1_VADDR /* (DEPRECATED) */ +#define XCHAL_IRAM1_PADDR XCHAL_INSTRAM1_PADDR /* (DEPRECATED) */ +#define XCHAL_IRAM1_SIZE XCHAL_INSTRAM1_SIZE /* (DEPRECATED) */ +#define XCHAL_DROM0_VADDR XCHAL_DATAROM0_VADDR /* (DEPRECATED) */ +#define XCHAL_DROM0_PADDR XCHAL_DATAROM0_PADDR /* (DEPRECATED) */ +#define XCHAL_DROM0_SIZE XCHAL_DATAROM0_SIZE /* (DEPRECATED) */ +#define XCHAL_DROM1_VADDR XCHAL_DATAROM1_VADDR /* (DEPRECATED) */ +#define XCHAL_DROM1_PADDR XCHAL_DATAROM1_PADDR /* (DEPRECATED) */ +#define XCHAL_DROM1_SIZE XCHAL_DATAROM1_SIZE /* (DEPRECATED) */ +#define XCHAL_DRAM0_VADDR XCHAL_DATARAM0_VADDR /* (DEPRECATED) */ +#define XCHAL_DRAM0_PADDR XCHAL_DATARAM0_PADDR /* (DEPRECATED) */ +#define XCHAL_DRAM0_SIZE XCHAL_DATARAM0_SIZE /* (DEPRECATED) */ +#define XCHAL_DRAM1_VADDR XCHAL_DATARAM1_VADDR /* (DEPRECATED) */ +#define XCHAL_DRAM1_PADDR XCHAL_DATARAM1_PADDR /* (DEPRECATED) */ +#define XCHAL_DRAM1_SIZE XCHAL_DATARAM1_SIZE /* (DEPRECATED) */ + + + +/*---------------------------------------------------------------------- + CACHE + ----------------------------------------------------------------------*/ + + +/* Default PREFCTL value to enable prefetch. */ +#if XCHAL_HW_MIN_VERSION < XTENSA_HWVERSION_RE_2012_0 +#define XCHAL_CACHE_PREFCTL_DEFAULT 0x00044 /* enabled, not aggressive */ +#elif XCHAL_HW_MIN_VERSION < XTENSA_HWVERSION_RF_2014_0 +#define XCHAL_CACHE_PREFCTL_DEFAULT 0x01044 /* + enable prefetch to L1 */ +#elif ((XCHAL_PREFETCH_ENTRIES >= 16) && XCHAL_HAVE_CACHE_BLOCKOPS) +#define XCHAL_CACHE_PREFCTL_DEFAULT 0x81044 /* 12 entries for block ops */ +#elif ((XCHAL_PREFETCH_ENTRIES >= 8) && XCHAL_HAVE_CACHE_BLOCKOPS) +#define XCHAL_CACHE_PREFCTL_DEFAULT 0x51044 /* 5 entries for block ops */ +#else +#define XCHAL_CACHE_PREFCTL_DEFAULT 0x01044 /* 0 entries for block ops */ +#endif + + +/* Max for both I-cache and D-cache (used for general alignment): */ +#if XCHAL_ICACHE_LINESIZE > XCHAL_DCACHE_LINESIZE +# define XCHAL_CACHE_LINEWIDTH_MAX XCHAL_ICACHE_LINEWIDTH +# define XCHAL_CACHE_LINESIZE_MAX XCHAL_ICACHE_LINESIZE +#else +# define XCHAL_CACHE_LINEWIDTH_MAX XCHAL_DCACHE_LINEWIDTH +# define XCHAL_CACHE_LINESIZE_MAX XCHAL_DCACHE_LINESIZE +#endif + +#define XCHAL_ICACHE_SETSIZE (1< XCHAL_DCACHE_SETWIDTH +# define XCHAL_CACHE_SETWIDTH_MAX XCHAL_ICACHE_SETWIDTH +# define XCHAL_CACHE_SETSIZE_MAX XCHAL_ICACHE_SETSIZE +#else +# define XCHAL_CACHE_SETWIDTH_MAX XCHAL_DCACHE_SETWIDTH +# define XCHAL_CACHE_SETSIZE_MAX XCHAL_DCACHE_SETSIZE +#endif + +/* Instruction cache tag bits: */ +#define XCHAL_ICACHE_TAG_V_SHIFT 0 +#define XCHAL_ICACHE_TAG_V 0x1 /* valid bit */ +#if XCHAL_ICACHE_WAYS > 1 +# define XCHAL_ICACHE_TAG_F_SHIFT 1 +# define XCHAL_ICACHE_TAG_F 0x2 /* fill (LRU) bit */ +#else +# define XCHAL_ICACHE_TAG_F_SHIFT 0 +# define XCHAL_ICACHE_TAG_F 0 /* no fill (LRU) bit */ +#endif +#if XCHAL_ICACHE_LINE_LOCKABLE +# define XCHAL_ICACHE_TAG_L_SHIFT (XCHAL_ICACHE_TAG_F_SHIFT+1) +# define XCHAL_ICACHE_TAG_L (1 << XCHAL_ICACHE_TAG_L_SHIFT) /* lock bit */ +#else +# define XCHAL_ICACHE_TAG_L_SHIFT XCHAL_ICACHE_TAG_F_SHIFT +# define XCHAL_ICACHE_TAG_L 0 /* no lock bit */ +#endif +/* Data cache tag bits: */ +#define XCHAL_DCACHE_TAG_V_SHIFT 0 +#define XCHAL_DCACHE_TAG_V 0x1 /* valid bit */ +#if XCHAL_DCACHE_WAYS > 1 +# define XCHAL_DCACHE_TAG_F_SHIFT 1 +# define XCHAL_DCACHE_TAG_F 0x2 /* fill (LRU) bit */ +#else +# define XCHAL_DCACHE_TAG_F_SHIFT 0 +# define XCHAL_DCACHE_TAG_F 0 /* no fill (LRU) bit */ +#endif +#if XCHAL_DCACHE_IS_WRITEBACK +# define XCHAL_DCACHE_TAG_D_SHIFT (XCHAL_DCACHE_TAG_F_SHIFT+1) +# define XCHAL_DCACHE_TAG_D (1 << XCHAL_DCACHE_TAG_D_SHIFT) /* dirty bit */ +#else +# define XCHAL_DCACHE_TAG_D_SHIFT XCHAL_DCACHE_TAG_F_SHIFT +# define XCHAL_DCACHE_TAG_D 0 /* no dirty bit */ +#endif +#if XCHAL_DCACHE_LINE_LOCKABLE +# define XCHAL_DCACHE_TAG_L_SHIFT (XCHAL_DCACHE_TAG_D_SHIFT+1) +# define XCHAL_DCACHE_TAG_L (1 << XCHAL_DCACHE_TAG_L_SHIFT) /* lock bit */ +#else +# define XCHAL_DCACHE_TAG_L_SHIFT XCHAL_DCACHE_TAG_D_SHIFT +# define XCHAL_DCACHE_TAG_L 0 /* no lock bit */ +#endif + +/* Whether MEMCTL register has anything useful */ +#define XCHAL_USE_MEMCTL (((XCHAL_LOOP_BUFFER_SIZE > 0) || \ + XCHAL_DCACHE_IS_COHERENT || \ + XCHAL_HAVE_ICACHE_DYN_WAYS || \ + XCHAL_HAVE_DCACHE_DYN_WAYS) && \ + (XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RE_2012_0)) + +#if XCHAL_DCACHE_IS_COHERENT +#define _MEMCTL_SNOOP_EN 0x02 /* Enable snoop */ +#else +#define _MEMCTL_SNOOP_EN 0x00 /* Don't enable snoop */ +#endif + +#if (XCHAL_LOOP_BUFFER_SIZE == 0) || XCHAL_ERRATUM_453 +#define _MEMCTL_L0IBUF_EN 0x00 /* No loop buffer or don't enable */ +#else +#define _MEMCTL_L0IBUF_EN 0x01 /* Enable loop buffer */ +#endif + +/* Default MEMCTL values: */ +#if XCHAL_HAVE_ICACHE_DYN_WAYS || XCHAL_HAVE_DCACHE_DYN_WAYS +#define XCHAL_CACHE_MEMCTL_DEFAULT (0xFFFFFF00 | _MEMCTL_L0IBUF_EN) +#else +#define XCHAL_CACHE_MEMCTL_DEFAULT (0x00000000 | _MEMCTL_L0IBUF_EN) +#endif + +#define XCHAL_SNOOP_LB_MEMCTL_DEFAULT (_MEMCTL_SNOOP_EN | _MEMCTL_L0IBUF_EN) + + +/*---------------------------------------------------------------------- + MMU + ----------------------------------------------------------------------*/ + +/* See for more details. */ + +/* Has different semantic in open source headers (where it means HAVE_PTP_MMU), + so comment out starting with RB-2008.3 release; later, might get + get reintroduced as a synonym for XCHAL_HAVE_PTP_MMU instead: */ +/*#define XCHAL_HAVE_MMU XCHAL_HAVE_TLBS*/ /* (DEPRECATED; use XCHAL_HAVE_TLBS instead) */ + +/* Indexing macros: */ +#define _XCHAL_ITLB_SET(n,_what) XCHAL_ITLB_SET ## n ## _what +#define XCHAL_ITLB_SET(n,what) _XCHAL_ITLB_SET(n, _ ## what ) +#define _XCHAL_ITLB_SET_E(n,i,_what) XCHAL_ITLB_SET ## n ## _E ## i ## _what +#define XCHAL_ITLB_SET_E(n,i,what) _XCHAL_ITLB_SET_E(n,i, _ ## what ) +#define _XCHAL_DTLB_SET(n,_what) XCHAL_DTLB_SET ## n ## _what +#define XCHAL_DTLB_SET(n,what) _XCHAL_DTLB_SET(n, _ ## what ) +#define _XCHAL_DTLB_SET_E(n,i,_what) XCHAL_DTLB_SET ## n ## _E ## i ## _what +#define XCHAL_DTLB_SET_E(n,i,what) _XCHAL_DTLB_SET_E(n,i, _ ## what ) +/* + * Example use: XCHAL_ITLB_SET(XCHAL_ITLB_ARF_SET0,ENTRIES) + * to get the value of XCHAL_ITLB_SET_ENTRIES where is the first auto-refill set. + */ + +/* Number of entries per autorefill way: */ +#define XCHAL_ITLB_ARF_ENTRIES (1< 0 && XCHAL_DTLB_ARF_WAYS > 0 && XCHAL_MMU_RINGS >= 2 +# define XCHAL_HAVE_PTP_MMU 1 /* have full MMU (with page table [autorefill] and protection) */ +#else +# define XCHAL_HAVE_PTP_MMU 0 /* don't have full MMU */ +#endif +#endif + +/* + * For full MMUs, report kernel RAM segment and kernel I/O segment static page mappings: + */ +#if XCHAL_HAVE_PTP_MMU && !XCHAL_HAVE_SPANNING_WAY +#define XCHAL_KSEG_CACHED_VADDR 0xD0000000 /* virt.addr of kernel RAM cached static map */ +#define XCHAL_KSEG_CACHED_PADDR 0x00000000 /* phys.addr of kseg_cached */ +#define XCHAL_KSEG_CACHED_SIZE 0x08000000 /* size in bytes of kseg_cached (assumed power of 2!!!) */ +#define XCHAL_KSEG_BYPASS_VADDR 0xD8000000 /* virt.addr of kernel RAM bypass (uncached) static map */ +#define XCHAL_KSEG_BYPASS_PADDR 0x00000000 /* phys.addr of kseg_bypass */ +#define XCHAL_KSEG_BYPASS_SIZE 0x08000000 /* size in bytes of kseg_bypass (assumed power of 2!!!) */ + +#define XCHAL_KIO_CACHED_VADDR 0xE0000000 /* virt.addr of kernel I/O cached static map */ +#define XCHAL_KIO_CACHED_PADDR 0xF0000000 /* phys.addr of kio_cached */ +#define XCHAL_KIO_CACHED_SIZE 0x10000000 /* size in bytes of kio_cached (assumed power of 2!!!) */ +#define XCHAL_KIO_BYPASS_VADDR 0xF0000000 /* virt.addr of kernel I/O bypass (uncached) static map */ +#define XCHAL_KIO_BYPASS_PADDR 0xF0000000 /* phys.addr of kio_bypass */ +#define XCHAL_KIO_BYPASS_SIZE 0x10000000 /* size in bytes of kio_bypass (assumed power of 2!!!) */ + +#define XCHAL_SEG_MAPPABLE_VADDR 0x00000000 /* start of largest non-static-mapped virtual addr area */ +#define XCHAL_SEG_MAPPABLE_SIZE 0xD0000000 /* size in bytes of " */ +/* define XCHAL_SEG_MAPPABLE2_xxx if more areas present, sorted in order of descending size. */ +#endif + + +/*---------------------------------------------------------------------- + MISC + ----------------------------------------------------------------------*/ + +/* Data alignment required if used for instructions: */ +#if XCHAL_INST_FETCH_WIDTH > XCHAL_DATA_WIDTH +# define XCHAL_ALIGN_MAX XCHAL_INST_FETCH_WIDTH +#else +# define XCHAL_ALIGN_MAX XCHAL_DATA_WIDTH +#endif + +/* + * Names kept for backward compatibility. + * (Here "RELEASE" is now a misnomer; these are product *versions*, not the releases + * under which they are released. In the T10##.# era there was no distinction.) + */ +#define XCHAL_HW_RELEASE_MAJOR XCHAL_HW_VERSION_MAJOR +#define XCHAL_HW_RELEASE_MINOR XCHAL_HW_VERSION_MINOR +#define XCHAL_HW_RELEASE_NAME XCHAL_HW_VERSION_NAME + + + + +/*---------------------------------------------------------------------- + COPROCESSORS and EXTRA STATE + ----------------------------------------------------------------------*/ + +#define XCHAL_EXTRA_SA_SIZE XCHAL_NCP_SA_SIZE +#define XCHAL_EXTRA_SA_ALIGN XCHAL_NCP_SA_ALIGN +#define XCHAL_CPEXTRA_SA_SIZE XCHAL_TOTAL_SA_SIZE +#define XCHAL_CPEXTRA_SA_ALIGN XCHAL_TOTAL_SA_ALIGN + +#if defined (_ASMLANGUAGE) || defined (__ASSEMBLER__) + + /* Invoked at start of save area load/store sequence macro to setup macro + * internal offsets. Not usually invoked directly. + * continue 0 for 1st sequence, 1 for subsequent consecutive ones. + * totofs offset from original ptr to next load/store location. + */ + .macro xchal_sa_start continue totofs + .ifeq \continue + .set .Lxchal_pofs_, 0 /* offset from original ptr to current \ptr */ + .set .Lxchal_ofs_, 0 /* offset from current \ptr to next load/store location */ + .endif + .if \totofs + 1 /* if totofs specified (not -1) */ + .set .Lxchal_ofs_, \totofs - .Lxchal_pofs_ /* specific offset from original ptr */ + .endif + .endm + + /* Align portion of save area and bring ptr in range if necessary. + * Used by save area load/store sequences. Not usually invoked directly. + * Allows combining multiple (sub-)sequences arbitrarily. + * ptr pointer to save area (may be off, see .Lxchal_pofs_) + * minofs,maxofs range of offset from cur ptr to next load/store loc; + * minofs <= 0 <= maxofs (0 must always be valid offset) + * range must be within +/- 30kB or so. + * ofsalign alignment granularity of minofs .. maxofs (pow of 2) + * (restriction on offset from ptr to next load/store loc) + * totalign align from orig ptr to next load/store loc (pow of 2) + */ + .macro xchal_sa_align ptr minofs maxofs ofsalign totalign + /* First align where we start accessing the next register + * per \totalign relative to original ptr (i.e. start of the save area): + */ + .set .Lxchal_ofs_, ((.Lxchal_pofs_ + .Lxchal_ofs_ + \totalign - 1) & -\totalign) - .Lxchal_pofs_ + /* If necessary, adjust \ptr to bring .Lxchal_ofs_ in acceptable range: */ + .if (((\maxofs) - .Lxchal_ofs_) & 0xC0000000) | ((.Lxchal_ofs_ - (\minofs)) & 0xC0000000) | (.Lxchal_ofs_ & (\ofsalign-1)) + .set .Ligmask, 0xFFFFFFFF /* TODO: optimize to addmi, per aligns and .Lxchal_ofs_ */ + addi \ptr, \ptr, (.Lxchal_ofs_ & .Ligmask) + .set .Lxchal_pofs_, .Lxchal_pofs_ + (.Lxchal_ofs_ & .Ligmask) + .set .Lxchal_ofs_, (.Lxchal_ofs_ & ~.Ligmask) + .endif + .endm + /* + * We could optimize for addi to expand to only addmi instead of + * "addmi;addi", where possible. Here's a partial example how: + * .set .Lmaxmask, -(\ofsalign) & -(\totalign) + * .if (((\maxofs) + ~.Lmaxmask + 1) & 0xFFFFFF00) && ((.Lxchal_ofs_ & ~.Lmaxmask) == 0) + * .set .Ligmask, 0xFFFFFF00 + * .elif ... ditto for negative ofs range ... + * .set .Ligmask, 0xFFFFFF00 + * .set ... adjust per offset ... + * .else + * .set .Ligmask, 0xFFFFFFFF + * .endif + */ + + /* Invoke this after xchal_XXX_{load,store} macros to restore \ptr. */ + .macro xchal_sa_ptr_restore ptr + .if .Lxchal_pofs_ + addi \ptr, \ptr, - .Lxchal_pofs_ + .set .Lxchal_ofs_, .Lxchal_ofs_ + .Lxchal_pofs_ + .set .Lxchal_pofs_, 0 + .endif + .endm + + /* + * Use as eg: + * xchal_atmps_store a1, SOMEOFS, XCHAL_SA_NUM_ATMPS, a4, a5 + * xchal_ncp_load a2, a0,a3,a4,a5 + * xchal_atmps_load a1, SOMEOFS, XCHAL_SA_NUM_ATMPS, a4, a5 + * + * Specify only the ARs you *haven't* saved/restored already, up to 4. + * They *must* be the *last* ARs (in same order) specified to save area + * load/store sequences. In the example above, a0 and a3 were already + * saved/restored and unused (thus available) but a4 and a5 were not. + */ +#define xchal_atmps_store xchal_atmps_loadstore s32i, +#define xchal_atmps_load xchal_atmps_loadstore l32i, + .macro xchal_atmps_loadstore inst ptr offset nreq aa=0 ab=0 ac=0 ad=0 + .set .Lnsaved_, 0 + .irp reg,\aa,\ab,\ac,\ad + .ifeq 0x\reg ; .set .Lnsaved_,.Lnsaved_+1 ; .endif + .endr + .set .Laofs_, 0 + .irp reg,\aa,\ab,\ac,\ad + .ifgt (\nreq)-.Lnsaved_ + \inst \reg, \ptr, .Laofs_+\offset + .set .Laofs_,.Laofs_+4 + .set .Lnsaved_,.Lnsaved_+1 + .endif + .endr + .endm + +/*#define xchal_ncp_load_a2 xchal_ncp_load a2,a3,a4,a5,a6*/ +/*#define xchal_ncp_store_a2 xchal_ncp_store a2,a3,a4,a5,a6*/ +#define xchal_extratie_load xchal_ncptie_load +#define xchal_extratie_store xchal_ncptie_store +#define xchal_extratie_load_a2 xchal_ncptie_load a2,a3,a4,a5,a6 +#define xchal_extratie_store_a2 xchal_ncptie_store a2,a3,a4,a5,a6 +#define xchal_extra_load xchal_ncp_load +#define xchal_extra_store xchal_ncp_store +#define xchal_extra_load_a2 xchal_ncp_load a2,a3,a4,a5,a6 +#define xchal_extra_store_a2 xchal_ncp_store a2,a3,a4,a5,a6 +#define xchal_extra_load_funcbody xchal_ncp_load a2,a3,a4,a5,a6 +#define xchal_extra_store_funcbody xchal_ncp_store a2,a3,a4,a5,a6 +#define xchal_cp0_store_a2 xchal_cp0_store a2,a3,a4,a5,a6 +#define xchal_cp0_load_a2 xchal_cp0_load a2,a3,a4,a5,a6 +#define xchal_cp1_store_a2 xchal_cp1_store a2,a3,a4,a5,a6 +#define xchal_cp1_load_a2 xchal_cp1_load a2,a3,a4,a5,a6 +#define xchal_cp2_store_a2 xchal_cp2_store a2,a3,a4,a5,a6 +#define xchal_cp2_load_a2 xchal_cp2_load a2,a3,a4,a5,a6 +#define xchal_cp3_store_a2 xchal_cp3_store a2,a3,a4,a5,a6 +#define xchal_cp3_load_a2 xchal_cp3_load a2,a3,a4,a5,a6 +#define xchal_cp4_store_a2 xchal_cp4_store a2,a3,a4,a5,a6 +#define xchal_cp4_load_a2 xchal_cp4_load a2,a3,a4,a5,a6 +#define xchal_cp5_store_a2 xchal_cp5_store a2,a3,a4,a5,a6 +#define xchal_cp5_load_a2 xchal_cp5_load a2,a3,a4,a5,a6 +#define xchal_cp6_store_a2 xchal_cp6_store a2,a3,a4,a5,a6 +#define xchal_cp6_load_a2 xchal_cp6_load a2,a3,a4,a5,a6 +#define xchal_cp7_store_a2 xchal_cp7_store a2,a3,a4,a5,a6 +#define xchal_cp7_load_a2 xchal_cp7_load a2,a3,a4,a5,a6 + +/* Empty placeholder macros for undefined coprocessors: */ +#if (XCHAL_CP_MASK & ~XCHAL_CP_PORT_MASK) == 0 +# if XCHAL_CP0_SA_SIZE == 0 + .macro xchal_cp0_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp0_load p a b c d continue=0 ofs=-1 select=-1 ; .endm +# endif +# if XCHAL_CP1_SA_SIZE == 0 + .macro xchal_cp1_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp1_load p a b c d continue=0 ofs=-1 select=-1 ; .endm +# endif +# if XCHAL_CP2_SA_SIZE == 0 + .macro xchal_cp2_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp2_load p a b c d continue=0 ofs=-1 select=-1 ; .endm +# endif +# if XCHAL_CP3_SA_SIZE == 0 + .macro xchal_cp3_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp3_load p a b c d continue=0 ofs=-1 select=-1 ; .endm +# endif +# if XCHAL_CP4_SA_SIZE == 0 + .macro xchal_cp4_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp4_load p a b c d continue=0 ofs=-1 select=-1 ; .endm +# endif +# if XCHAL_CP5_SA_SIZE == 0 + .macro xchal_cp5_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp5_load p a b c d continue=0 ofs=-1 select=-1 ; .endm +# endif +# if XCHAL_CP6_SA_SIZE == 0 + .macro xchal_cp6_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp6_load p a b c d continue=0 ofs=-1 select=-1 ; .endm +# endif +# if XCHAL_CP7_SA_SIZE == 0 + .macro xchal_cp7_store p a b c d continue=0 ofs=-1 select=-1 ; .endm + .macro xchal_cp7_load p a b c d continue=0 ofs=-1 select=-1 ; .endm +# endif +#endif + + /******************** + * Macros to create functions that save and restore the state of *any* TIE + * coprocessor (by dynamic index). + */ + + /* + * Macro that expands to the body of a function + * that stores the selected coprocessor's state (registers etc). + * Entry: a2 = ptr to save area in which to save cp state + * a3 = coprocessor number + * Exit: any register a2-a15 (?) may have been clobbered. + */ + .macro xchal_cpi_store_funcbody +#if (XCHAL_CP_MASK & ~XCHAL_CP_PORT_MASK) +# if XCHAL_CP0_SA_SIZE + bnez a3, 99f + xchal_cp0_store_a2 + j 90f +99: +# endif +# if XCHAL_CP1_SA_SIZE + bnei a3, 1, 99f + xchal_cp1_store_a2 + j 90f +99: +# endif +# if XCHAL_CP2_SA_SIZE + bnei a3, 2, 99f + xchal_cp2_store_a2 + j 90f +99: +# endif +# if XCHAL_CP3_SA_SIZE + bnei a3, 3, 99f + xchal_cp3_store_a2 + j 90f +99: +# endif +# if XCHAL_CP4_SA_SIZE + bnei a3, 4, 99f + xchal_cp4_store_a2 + j 90f +99: +# endif +# if XCHAL_CP5_SA_SIZE + bnei a3, 5, 99f + xchal_cp5_store_a2 + j 90f +99: +# endif +# if XCHAL_CP6_SA_SIZE + bnei a3, 6, 99f + xchal_cp6_store_a2 + j 90f +99: +# endif +# if XCHAL_CP7_SA_SIZE + bnei a3, 7, 99f + xchal_cp7_store_a2 + j 90f +99: +# endif +90: +#endif + .endm + + /* + * Macro that expands to the body of a function + * that loads the selected coprocessor's state (registers etc). + * Entry: a2 = ptr to save area from which to restore cp state + * a3 = coprocessor number + * Exit: any register a2-a15 (?) may have been clobbered. + */ + .macro xchal_cpi_load_funcbody +#if (XCHAL_CP_MASK & ~XCHAL_CP_PORT_MASK) +# if XCHAL_CP0_SA_SIZE + bnez a3, 99f + xchal_cp0_load_a2 + j 90f +99: +# endif +# if XCHAL_CP1_SA_SIZE + bnei a3, 1, 99f + xchal_cp1_load_a2 + j 90f +99: +# endif +# if XCHAL_CP2_SA_SIZE + bnei a3, 2, 99f + xchal_cp2_load_a2 + j 90f +99: +# endif +# if XCHAL_CP3_SA_SIZE + bnei a3, 3, 99f + xchal_cp3_load_a2 + j 90f +99: +# endif +# if XCHAL_CP4_SA_SIZE + bnei a3, 4, 99f + xchal_cp4_load_a2 + j 90f +99: +# endif +# if XCHAL_CP5_SA_SIZE + bnei a3, 5, 99f + xchal_cp5_load_a2 + j 90f +99: +# endif +# if XCHAL_CP6_SA_SIZE + bnei a3, 6, 99f + xchal_cp6_load_a2 + j 90f +99: +# endif +# if XCHAL_CP7_SA_SIZE + bnei a3, 7, 99f + xchal_cp7_load_a2 + j 90f +99: +# endif +90: +#endif + .endm + +#endif /*_ASMLANGUAGE or __ASSEMBLER__*/ + + +/* Other default macros for undefined coprocessors: */ +#ifndef XCHAL_CP0_NAME +# define XCHAL_CP0_NAME 0 +# define XCHAL_CP0_SA_CONTENTS_LIBDB_NUM 0 +# define XCHAL_CP0_SA_CONTENTS_LIBDB /* empty */ +#endif +#ifndef XCHAL_CP1_NAME +# define XCHAL_CP1_NAME 0 +# define XCHAL_CP1_SA_CONTENTS_LIBDB_NUM 0 +# define XCHAL_CP1_SA_CONTENTS_LIBDB /* empty */ +#endif +#ifndef XCHAL_CP2_NAME +# define XCHAL_CP2_NAME 0 +# define XCHAL_CP2_SA_CONTENTS_LIBDB_NUM 0 +# define XCHAL_CP2_SA_CONTENTS_LIBDB /* empty */ +#endif +#ifndef XCHAL_CP3_NAME +# define XCHAL_CP3_NAME 0 +# define XCHAL_CP3_SA_CONTENTS_LIBDB_NUM 0 +# define XCHAL_CP3_SA_CONTENTS_LIBDB /* empty */ +#endif +#ifndef XCHAL_CP4_NAME +# define XCHAL_CP4_NAME 0 +# define XCHAL_CP4_SA_CONTENTS_LIBDB_NUM 0 +# define XCHAL_CP4_SA_CONTENTS_LIBDB /* empty */ +#endif +#ifndef XCHAL_CP5_NAME +# define XCHAL_CP5_NAME 0 +# define XCHAL_CP5_SA_CONTENTS_LIBDB_NUM 0 +# define XCHAL_CP5_SA_CONTENTS_LIBDB /* empty */ +#endif +#ifndef XCHAL_CP6_NAME +# define XCHAL_CP6_NAME 0 +# define XCHAL_CP6_SA_CONTENTS_LIBDB_NUM 0 +# define XCHAL_CP6_SA_CONTENTS_LIBDB /* empty */ +#endif +#ifndef XCHAL_CP7_NAME +# define XCHAL_CP7_NAME 0 +# define XCHAL_CP7_SA_CONTENTS_LIBDB_NUM 0 +# define XCHAL_CP7_SA_CONTENTS_LIBDB /* empty */ +#endif + +#if XCHAL_CP_MASK == 0 +/* Filler info for unassigned coprocessors, to simplify arrays etc: */ +#define XCHAL_CP0_SA_SIZE 0 +#define XCHAL_CP0_SA_ALIGN 1 +#define XCHAL_CP1_SA_SIZE 0 +#define XCHAL_CP1_SA_ALIGN 1 +#define XCHAL_CP2_SA_SIZE 0 +#define XCHAL_CP2_SA_ALIGN 1 +#define XCHAL_CP3_SA_SIZE 0 +#define XCHAL_CP3_SA_ALIGN 1 +#define XCHAL_CP4_SA_SIZE 0 +#define XCHAL_CP4_SA_ALIGN 1 +#define XCHAL_CP5_SA_SIZE 0 +#define XCHAL_CP5_SA_ALIGN 1 +#define XCHAL_CP6_SA_SIZE 0 +#define XCHAL_CP6_SA_ALIGN 1 +#define XCHAL_CP7_SA_SIZE 0 +#define XCHAL_CP7_SA_ALIGN 1 +#endif + + +/* Indexing macros: */ +#define _XCHAL_CP_SA_SIZE(n) XCHAL_CP ## n ## _SA_SIZE +#define XCHAL_CP_SA_SIZE(n) _XCHAL_CP_SA_SIZE(n) /* n = 0 .. 7 */ +#define _XCHAL_CP_SA_ALIGN(n) XCHAL_CP ## n ## _SA_ALIGN +#define XCHAL_CP_SA_ALIGN(n) _XCHAL_CP_SA_ALIGN(n) /* n = 0 .. 7 */ + +#define XCHAL_CPEXTRA_SA_SIZE_TOR2 XCHAL_CPEXTRA_SA_SIZE /* Tor2Beta only - do not use */ + +/* Link-time HAL global variables that report coprocessor numbers by name + (names are case-preserved from the original TIE): */ +#if !defined(_ASMLANGUAGE) && !defined(_NOCLANGUAGE) && !defined(__ASSEMBLER__) +# define _XCJOIN(a,b) a ## b +# define XCJOIN(a,b) _XCJOIN(a,b) +# ifdef XCHAL_CP0_NAME +extern const unsigned char XCJOIN(Xthal_cp_id_,XCHAL_CP0_IDENT); +extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP0_IDENT); +# endif +# ifdef XCHAL_CP1_NAME +extern const unsigned char XCJOIN(Xthal_cp_id_,XCHAL_CP1_IDENT); +extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP1_IDENT); +# endif +# ifdef XCHAL_CP2_NAME +extern const unsigned char XCJOIN(Xthal_cp_id_,XCHAL_CP2_IDENT); +extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP2_IDENT); +# endif +# ifdef XCHAL_CP3_NAME +extern const unsigned char XCJOIN(Xthal_cp_id_,XCHAL_CP3_IDENT); +extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP3_IDENT); +# endif +# ifdef XCHAL_CP4_NAME +extern const unsigned char XCJOIN(Xthal_cp_id_,XCHAL_CP4_IDENT); +extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP4_IDENT); +# endif +# ifdef XCHAL_CP5_NAME +extern const unsigned char XCJOIN(Xthal_cp_id_,XCHAL_CP5_IDENT); +extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP5_IDENT); +# endif +# ifdef XCHAL_CP6_NAME +extern const unsigned char XCJOIN(Xthal_cp_id_,XCHAL_CP6_IDENT); +extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP6_IDENT); +# endif +# ifdef XCHAL_CP7_NAME +extern const unsigned char XCJOIN(Xthal_cp_id_,XCHAL_CP7_IDENT); +extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP7_IDENT); +# endif +#endif + + + + +/*---------------------------------------------------------------------- + DERIVED + ----------------------------------------------------------------------*/ + +#if XCHAL_HAVE_BE +#define XCHAL_INST_ILLN 0xD60F /* 2-byte illegal instruction, msb-first */ +#define XCHAL_INST_ILLN_BYTE0 0xD6 /* 2-byte illegal instruction, 1st byte */ +#define XCHAL_INST_ILLN_BYTE1 0x0F /* 2-byte illegal instruction, 2nd byte */ +#else +#define XCHAL_INST_ILLN 0xF06D /* 2-byte illegal instruction, lsb-first */ +#define XCHAL_INST_ILLN_BYTE0 0x6D /* 2-byte illegal instruction, 1st byte */ +#define XCHAL_INST_ILLN_BYTE1 0xF0 /* 2-byte illegal instruction, 2nd byte */ +#endif +/* Belongs in xtensa/hal.h: */ +#define XTHAL_INST_ILL 0x000000 /* 3-byte illegal instruction */ + + +/* + * Because information as to exactly which hardware version is targeted + * by a given software build is not always available, compile-time HAL + * Hardware-Release "_AT" macros are fuzzy (return 0, 1, or XCHAL_MAYBE): + * (Here "RELEASE" is now a misnomer; these are product *versions*, not the releases + * under which they are released. In the T10##.# era there was no distinction.) + */ +#if XCHAL_HW_CONFIGID_RELIABLE +# define XCHAL_HW_RELEASE_AT_OR_BELOW(major,minor) (XTHAL_REL_LE( XCHAL_HW_VERSION_MAJOR,XCHAL_HW_VERSION_MINOR, major,minor ) ? 1 : 0) +# define XCHAL_HW_RELEASE_AT_OR_ABOVE(major,minor) (XTHAL_REL_GE( XCHAL_HW_VERSION_MAJOR,XCHAL_HW_VERSION_MINOR, major,minor ) ? 1 : 0) +# define XCHAL_HW_RELEASE_AT(major,minor) (XTHAL_REL_EQ( XCHAL_HW_VERSION_MAJOR,XCHAL_HW_VERSION_MINOR, major,minor ) ? 1 : 0) +# define XCHAL_HW_RELEASE_MAJOR_AT(major) ((XCHAL_HW_VERSION_MAJOR == (major)) ? 1 : 0) +#else +# define XCHAL_HW_RELEASE_AT_OR_BELOW(major,minor) ( ((major) < 1040 && XCHAL_HAVE_XEA2) ? 0 \ + : ((major) > 1050 && XCHAL_HAVE_XEA1) ? 1 \ + : XTHAL_MAYBE ) +# define XCHAL_HW_RELEASE_AT_OR_ABOVE(major,minor) ( ((major) >= 2000 && XCHAL_HAVE_XEA1) ? 0 \ + : (XTHAL_REL_LE(major,minor, 1040,0) && XCHAL_HAVE_XEA2) ? 1 \ + : XTHAL_MAYBE ) +# define XCHAL_HW_RELEASE_AT(major,minor) ( (((major) < 1040 && XCHAL_HAVE_XEA2) || \ + ((major) >= 2000 && XCHAL_HAVE_XEA1)) ? 0 : XTHAL_MAYBE) +# define XCHAL_HW_RELEASE_MAJOR_AT(major) XCHAL_HW_RELEASE_AT(major,0) +#endif + + +#endif /*XTENSA_CONFIG_CORE_H*/ + diff --git a/components/xtensa/esp32s2beta/include/xtensa/config/defs.h b/components/xtensa/esp32s2beta/include/xtensa/config/defs.h new file mode 100644 index 0000000000..9cf321a1d8 --- /dev/null +++ b/components/xtensa/esp32s2beta/include/xtensa/config/defs.h @@ -0,0 +1,37 @@ +/* Definitions for Xtensa instructions, types, and protos. */ + +/* Copyright (c) 2003-2004 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* NOTE: This file exists only for backward compatibility with T1050 + and earlier Xtensa releases. It includes only a subset of the + available header files. */ + +#ifndef _XTENSA_BASE_HEADER +#define _XTENSA_BASE_HEADER + +#ifdef __XTENSA__ + +#include +#include + +#endif /* __XTENSA__ */ +#endif /* !_XTENSA_BASE_HEADER */ diff --git a/components/xtensa/esp32s2beta/include/xtensa/config/specreg.h b/components/xtensa/esp32s2beta/include/xtensa/config/specreg.h new file mode 100644 index 0000000000..30e95592ab --- /dev/null +++ b/components/xtensa/esp32s2beta/include/xtensa/config/specreg.h @@ -0,0 +1,103 @@ +/* + * Xtensa Special Register symbolic names + */ + +/* $Id: //depot/rel/Foxhill/dot.8/Xtensa/SWConfig/hal/specreg.h.tpp#1 $ */ + +/* Copyright (c) 1998-2002 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef XTENSA_SPECREG_H +#define XTENSA_SPECREG_H + +/* Include these special register bitfield definitions, for historical reasons: */ +#include + + +/* Special registers: */ +#define SAR 3 +#define WINDOWBASE 72 +#define WINDOWSTART 73 +#define IBREAKENABLE 96 +#define DDR 104 +#define IBREAKA_0 128 +#define IBREAKA_1 129 +#define DBREAKA_0 144 +#define DBREAKA_1 145 +#define DBREAKC_0 160 +#define DBREAKC_1 161 +#define EPC_1 177 +#define EPC_2 178 +#define EPC_3 179 +#define EPC_4 180 +#define EPC_5 181 +#define EPC_6 182 +#define EPC_7 183 +#define DEPC 192 +#define EPS_2 194 +#define EPS_3 195 +#define EPS_4 196 +#define EPS_5 197 +#define EPS_6 198 +#define EPS_7 199 +#define EXCSAVE_1 209 +#define EXCSAVE_2 210 +#define EXCSAVE_3 211 +#define EXCSAVE_4 212 +#define EXCSAVE_5 213 +#define EXCSAVE_6 214 +#define EXCSAVE_7 215 +#define CPENABLE 224 +#define INTERRUPT 226 +#define INTENABLE 228 +#define PS 230 +#define VECBASE 231 +#define EXCCAUSE 232 +#define DEBUGCAUSE 233 +#define CCOUNT 234 +#define PRID 235 +#define ICOUNT 236 +#define ICOUNTLEVEL 237 +#define EXCVADDR 238 +#define CCOMPARE_0 240 +#define CCOMPARE_1 241 +#define CCOMPARE_2 242 +#define MISC_REG_0 244 +#define MISC_REG_1 245 +#define MISC_REG_2 246 +#define MISC_REG_3 247 + +/* Special cases (bases of special register series): */ +#define IBREAKA 128 +#define DBREAKA 144 +#define DBREAKC 160 +#define EPC 176 +#define EPS 192 +#define EXCSAVE 208 +#define CCOMPARE 240 + +/* Special names for read-only and write-only interrupt registers: */ +#define INTREAD 226 +#define INTSET 226 +#define INTCLEAR 227 + +#endif /* XTENSA_SPECREG_H */ + diff --git a/components/xtensa/esp32s2beta/include/xtensa/config/system.h b/components/xtensa/esp32s2beta/include/xtensa/config/system.h new file mode 100644 index 0000000000..b9bad9e385 --- /dev/null +++ b/components/xtensa/esp32s2beta/include/xtensa/config/system.h @@ -0,0 +1,277 @@ +/* + * xtensa/config/system.h -- HAL definitions that are dependent on SYSTEM configuration + * + * NOTE: The location and contents of this file are highly subject to change. + * + * Source for configuration-independent binaries (which link in a + * configuration-specific HAL library) must NEVER include this file. + * The HAL itself has historically included this file in some instances, + * but this is not appropriate either, because the HAL is meant to be + * core-specific but system independent. + */ + +/* Copyright (c) 2000-2010 Tensilica Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + +#ifndef XTENSA_CONFIG_SYSTEM_H +#define XTENSA_CONFIG_SYSTEM_H + +/*#include */ + + + +/*---------------------------------------------------------------------- + CONFIGURED SOFTWARE OPTIONS + ----------------------------------------------------------------------*/ + +#define XSHAL_USE_ABSOLUTE_LITERALS 0 /* (sw-only option, whether software uses absolute literals) */ +#define XSHAL_HAVE_TEXT_SECTION_LITERALS 1 /* Set if there is some memory that allows both code and literals. */ + +#define XSHAL_ABI XTHAL_ABI_WINDOWED /* (sw-only option, selected ABI) */ +/* The above maps to one of the following constants: */ +#define XTHAL_ABI_WINDOWED 0 +#define XTHAL_ABI_CALL0 1 +/* Alternatives: */ +/*#define XSHAL_WINDOWED_ABI 1*/ /* set if windowed ABI selected */ +/*#define XSHAL_CALL0_ABI 0*/ /* set if call0 ABI selected */ + +#define XSHAL_CLIB XTHAL_CLIB_NEWLIB /* (sw-only option, selected C library) */ +/* The above maps to one of the following constants: */ +#define XTHAL_CLIB_NEWLIB 0 +#define XTHAL_CLIB_UCLIBC 1 +#define XTHAL_CLIB_XCLIB 2 +/* Alternatives: */ +/*#define XSHAL_NEWLIB 1*/ /* set if newlib C library selected */ +/*#define XSHAL_UCLIBC 0*/ /* set if uCLibC C library selected */ +/*#define XSHAL_XCLIB 0*/ /* set if Xtensa C library selected */ + +#define XSHAL_USE_FLOATING_POINT 1 + +#define XSHAL_FLOATING_POINT_ABI 0 + +/* SW workarounds enabled for HW errata: */ + +/* SW options for functional safety: */ +#define XSHAL_FUNC_SAFETY_ENABLED 0 + +/*---------------------------------------------------------------------- + DEVICE ADDRESSES + ----------------------------------------------------------------------*/ + +/* + * Strange place to find these, but the configuration GUI + * allows moving these around to account for various core + * configurations. Specific boards (and their BSP software) + * will have specific meanings for these components. + */ + +/* I/O Block areas: */ +#define XSHAL_IOBLOCK_CACHED_VADDR 0x70000000 +#define XSHAL_IOBLOCK_CACHED_PADDR 0x70000000 +#define XSHAL_IOBLOCK_CACHED_SIZE 0x0E000000 + +#define XSHAL_IOBLOCK_BYPASS_VADDR 0x90000000 +#define XSHAL_IOBLOCK_BYPASS_PADDR 0x90000000 +#define XSHAL_IOBLOCK_BYPASS_SIZE 0x0E000000 + +/* System ROM: */ +#define XSHAL_ROM_VADDR 0x50000000 +#define XSHAL_ROM_PADDR 0x50000000 +#define XSHAL_ROM_SIZE 0x01000000 +/* Largest available area (free of vectors): */ +#define XSHAL_ROM_AVAIL_VADDR 0x50000000 +#define XSHAL_ROM_AVAIL_VSIZE 0x01000000 + +/* System RAM: */ +#define XSHAL_RAM_VADDR 0x60000000 +#define XSHAL_RAM_PADDR 0x60000000 +#define XSHAL_RAM_VSIZE 0x20000000 +#define XSHAL_RAM_PSIZE 0x20000000 +#define XSHAL_RAM_SIZE XSHAL_RAM_PSIZE +/* Largest available area (free of vectors): */ +#define XSHAL_RAM_AVAIL_VADDR 0x60000000 +#define XSHAL_RAM_AVAIL_VSIZE 0x20000000 + +/* + * Shadow system RAM (same device as system RAM, at different address). + * (Emulation boards need this for the SONIC Ethernet driver + * when data caches are configured for writeback mode.) + * NOTE: on full MMU configs, this points to the BYPASS virtual address + * of system RAM, ie. is the same as XSHAL_RAM_* except that virtual + * addresses are viewed through the BYPASS static map rather than + * the CACHED static map. + */ +#define XSHAL_RAM_BYPASS_VADDR 0xA0000000 +#define XSHAL_RAM_BYPASS_PADDR 0xA0000000 +#define XSHAL_RAM_BYPASS_PSIZE 0x20000000 + +/* Alternate system RAM (different device than system RAM): */ +/*#define XSHAL_ALTRAM_[VP]ADDR ...not configured...*/ +/*#define XSHAL_ALTRAM_SIZE ...not configured...*/ + +/* Some available location in which to place devices in a simulation (eg. XTMP): */ +#define XSHAL_SIMIO_CACHED_VADDR 0xC0000000 +#define XSHAL_SIMIO_BYPASS_VADDR 0xC0000000 +#define XSHAL_SIMIO_PADDR 0xC0000000 +#define XSHAL_SIMIO_SIZE 0x20000000 + + +/*---------------------------------------------------------------------- + * For use by reference testbench exit and diagnostic routines. + */ +#define XSHAL_MAGIC_EXIT 0x0 + +/*---------------------------------------------------------------------- + * DEVICE-ADDRESS DEPENDENT... + * + * Values written to CACHEATTR special register (or its equivalent) + * to enable and disable caches in various modes. + *----------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------- + BACKWARD COMPATIBILITY ... + ----------------------------------------------------------------------*/ + +/* + * NOTE: the following two macros are DEPRECATED. Use the latter + * board-specific macros instead, which are specially tuned for the + * particular target environments' memory maps. + */ +#define XSHAL_CACHEATTR_BYPASS XSHAL_XT2000_CACHEATTR_BYPASS /* disable caches in bypass mode */ +#define XSHAL_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_DEFAULT /* default setting to enable caches (no writeback!) */ + +/*---------------------------------------------------------------------- + GENERIC + ----------------------------------------------------------------------*/ + +/* For the following, a 512MB region is used if it contains a system (PIF) RAM, + * system (PIF) ROM, local memory, or XLMI. */ + +/* These set any unused 512MB region to cache-BYPASS attribute: */ +#define XSHAL_ALLVALID_CACHEATTR_WRITEBACK 0x22221112 /* enable caches in write-back mode */ +#define XSHAL_ALLVALID_CACHEATTR_WRITEALLOC 0x22221112 /* enable caches in write-allocate mode */ +#define XSHAL_ALLVALID_CACHEATTR_WRITETHRU 0x22221112 /* enable caches in write-through mode */ +#define XSHAL_ALLVALID_CACHEATTR_BYPASS 0x22222222 /* disable caches in bypass mode */ +#define XSHAL_ALLVALID_CACHEATTR_DEFAULT XSHAL_ALLVALID_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +/* These set any unused 512MB region to ILLEGAL attribute: */ +#define XSHAL_STRICT_CACHEATTR_WRITEBACK 0xFFFF111F /* enable caches in write-back mode */ +#define XSHAL_STRICT_CACHEATTR_WRITEALLOC 0xFFFF111F /* enable caches in write-allocate mode */ +#define XSHAL_STRICT_CACHEATTR_WRITETHRU 0xFFFF111F /* enable caches in write-through mode */ +#define XSHAL_STRICT_CACHEATTR_BYPASS 0xFFFF222F /* disable caches in bypass mode */ +#define XSHAL_STRICT_CACHEATTR_DEFAULT XSHAL_STRICT_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +/* These set the first 512MB, if unused, to ILLEGAL attribute to help catch + * NULL-pointer dereference bugs; all other unused 512MB regions are set + * to cache-BYPASS attribute: */ +#define XSHAL_TRAPNULL_CACHEATTR_WRITEBACK 0x2222111F /* enable caches in write-back mode */ +#define XSHAL_TRAPNULL_CACHEATTR_WRITEALLOC 0x2222111F /* enable caches in write-allocate mode */ +#define XSHAL_TRAPNULL_CACHEATTR_WRITETHRU 0x2222111F /* enable caches in write-through mode */ +#define XSHAL_TRAPNULL_CACHEATTR_BYPASS 0x2222222F /* disable caches in bypass mode */ +#define XSHAL_TRAPNULL_CACHEATTR_DEFAULT XSHAL_TRAPNULL_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +/*---------------------------------------------------------------------- + ISS (Instruction Set Simulator) SPECIFIC ... + ----------------------------------------------------------------------*/ + +/* For now, ISS defaults to the TRAPNULL settings: */ +#define XSHAL_ISS_CACHEATTR_WRITEBACK XSHAL_TRAPNULL_CACHEATTR_WRITEBACK +#define XSHAL_ISS_CACHEATTR_WRITEALLOC XSHAL_TRAPNULL_CACHEATTR_WRITEALLOC +#define XSHAL_ISS_CACHEATTR_WRITETHRU XSHAL_TRAPNULL_CACHEATTR_WRITETHRU +#define XSHAL_ISS_CACHEATTR_BYPASS XSHAL_TRAPNULL_CACHEATTR_BYPASS +#define XSHAL_ISS_CACHEATTR_DEFAULT XSHAL_TRAPNULL_CACHEATTR_WRITEBACK + +#define XSHAL_ISS_PIPE_REGIONS 0 +#define XSHAL_ISS_SDRAM_REGIONS 0 + + +/*---------------------------------------------------------------------- + XT2000 BOARD SPECIFIC ... + ----------------------------------------------------------------------*/ + +/* For the following, a 512MB region is used if it contains any system RAM, + * system ROM, local memory, XLMI, or other XT2000 board device or memory. + * Regions containing devices are forced to cache-BYPASS mode regardless + * of whether the macro is _WRITEBACK vs. _BYPASS etc. */ + +/* These set any 512MB region unused on the XT2000 to ILLEGAL attribute: */ +#define XSHAL_XT2000_CACHEATTR_WRITEBACK 0xFF22111F /* enable caches in write-back mode */ +#define XSHAL_XT2000_CACHEATTR_WRITEALLOC 0xFF22111F /* enable caches in write-allocate mode */ +#define XSHAL_XT2000_CACHEATTR_WRITETHRU 0xFF22111F /* enable caches in write-through mode */ +#define XSHAL_XT2000_CACHEATTR_BYPASS 0xFF22222F /* disable caches in bypass mode */ +#define XSHAL_XT2000_CACHEATTR_DEFAULT XSHAL_XT2000_CACHEATTR_WRITEBACK /* default setting to enable caches */ + +#define XSHAL_XT2000_PIPE_REGIONS 0x00000000 /* BusInt pipeline regions */ +#define XSHAL_XT2000_SDRAM_REGIONS 0x00000440 /* BusInt SDRAM regions */ + + +/*---------------------------------------------------------------------- + VECTOR INFO AND SIZES + ----------------------------------------------------------------------*/ + +#define XSHAL_VECTORS_PACKED 0 +#define XSHAL_STATIC_VECTOR_SELECT 1 +#define XSHAL_RESET_VECTOR_VADDR 0x40000400 +#define XSHAL_RESET_VECTOR_PADDR 0x40000400 + +/* + * Sizes allocated to vectors by the system (memory map) configuration. + * These sizes are constrained by core configuration (eg. one vector's + * code cannot overflow into another vector) but are dependent on the + * system or board (or LSP) memory map configuration. + * + * Whether or not each vector happens to be in a system ROM is also + * a system configuration matter, sometimes useful, included here also: + */ +#define XSHAL_RESET_VECTOR_SIZE 0x00000300 +#define XSHAL_RESET_VECTOR_ISROM 0 +#define XSHAL_USER_VECTOR_SIZE 0x00000038 +#define XSHAL_USER_VECTOR_ISROM 0 +#define XSHAL_PROGRAMEXC_VECTOR_SIZE XSHAL_USER_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_USEREXC_VECTOR_SIZE XSHAL_USER_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_KERNEL_VECTOR_SIZE 0x00000038 +#define XSHAL_KERNEL_VECTOR_ISROM 0 +#define XSHAL_STACKEDEXC_VECTOR_SIZE XSHAL_KERNEL_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_KERNELEXC_VECTOR_SIZE XSHAL_KERNEL_VECTOR_SIZE /* for backward compatibility */ +#define XSHAL_DOUBLEEXC_VECTOR_SIZE 0x00000040 +#define XSHAL_DOUBLEEXC_VECTOR_ISROM 0 +#define XSHAL_WINDOW_VECTORS_SIZE 0x00000178 +#define XSHAL_WINDOW_VECTORS_ISROM 0 +#define XSHAL_INTLEVEL2_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL2_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL3_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL3_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL4_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL4_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL5_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL5_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL6_VECTOR_SIZE 0x00000038 +#define XSHAL_INTLEVEL6_VECTOR_ISROM 0 +#define XSHAL_DEBUG_VECTOR_SIZE XSHAL_INTLEVEL6_VECTOR_SIZE +#define XSHAL_DEBUG_VECTOR_ISROM XSHAL_INTLEVEL6_VECTOR_ISROM +#define XSHAL_NMI_VECTOR_SIZE 0x00000038 +#define XSHAL_NMI_VECTOR_ISROM 0 +#define XSHAL_INTLEVEL7_VECTOR_SIZE XSHAL_NMI_VECTOR_SIZE + + +#endif /*XTENSA_CONFIG_SYSTEM_H*/ + diff --git a/components/xtensa/esp32s2beta/include/xtensa/config/tie-asm.h b/components/xtensa/esp32s2beta/include/xtensa/config/tie-asm.h new file mode 100644 index 0000000000..681b45602b --- /dev/null +++ b/components/xtensa/esp32s2beta/include/xtensa/config/tie-asm.h @@ -0,0 +1,130 @@ +/* + * tie-asm.h -- compile-time HAL assembler definitions dependent on CORE & TIE + * + * NOTE: This header file is not meant to be included directly. + */ + +/* This header file contains assembly-language definitions (assembly + macros, etc.) for this specific Xtensa processor's TIE extensions + and options. It is customized to this Xtensa processor configuration. + + Copyright (c) 1999-2018 Cadence Design Systems Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _XTENSA_CORE_TIE_ASM_H +#define _XTENSA_CORE_TIE_ASM_H + +/* Selection parameter values for save-area save/restore macros: */ +/* Option vs. TIE: */ +#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */ +#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */ +#define XTHAL_SAS_ANYOT 0x0003 /* both of the above */ +/* Whether used automatically by compiler: */ +#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */ +#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */ +#define XTHAL_SAS_ANYCC 0x000C /* both of the above */ +/* ABI handling across function calls: */ +#define XTHAL_SAS_CALR 0x0010 /* caller-saved */ +#define XTHAL_SAS_CALE 0x0020 /* callee-saved */ +#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */ +#define XTHAL_SAS_ANYABI 0x0070 /* all of the above three */ +/* Misc */ +#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */ +#define XTHAL_SAS3(optie,ccuse,abi) ( ((optie) & XTHAL_SAS_ANYOT) \ + | ((ccuse) & XTHAL_SAS_ANYCC) \ + | ((abi) & XTHAL_SAS_ANYABI) ) + + + /* + * Macro to store all non-coprocessor (extra) custom TIE and optional state + * (not including zero-overhead loop registers). + * Required parameters: + * ptr Save area pointer address register (clobbered) + * (register must contain a 4 byte aligned address). + * at1..at4 Four temporary address registers (first XCHAL_NCP_NUM_ATMPS + * registers are clobbered, the remaining are unused). + * Optional parameters: + * continue If macro invoked as part of a larger store sequence, set to 1 + * if this is not the first in the sequence. Defaults to 0. + * ofs Offset from start of larger sequence (from value of first ptr + * in sequence) at which to store. Defaults to next available space + * (or 0 if is 0). + * select Select what category(ies) of registers to store, as a bitmask + * (see XTHAL_SAS_xxx constants). Defaults to all registers. + * alloc Select what category(ies) of registers to allocate; if any + * category is selected here that is not in , space for + * the corresponding registers is skipped without doing any load. + */ + .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0 + xchal_sa_start \continue, \ofs + // Optional global registers used by default by the compiler: + .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~(\select) + xchal_sa_align \ptr, 0, 1016, 4, 4 + l32i \at1, \ptr, .Lxchal_ofs_+0 + wur.THREADPTR \at1 // threadptr option + .set .Lxchal_ofs_, .Lxchal_ofs_ + 4 + .elseif ((XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~(\alloc)) == 0 + xchal_sa_align \ptr, 0, 1016, 4, 4 + .set .Lxchal_ofs_, .Lxchal_ofs_ + 4 + .endif + .endm // xchal_ncp_load + + +#define XCHAL_NCP_NUM_ATMPS 1 + +#define XCHAL_SA_NUM_ATMPS 1 + +#endif /*_XTENSA_CORE_TIE_ASM_H*/ + diff --git a/components/xtensa/esp32s2beta/include/xtensa/config/tie.h b/components/xtensa/esp32s2beta/include/xtensa/config/tie.h new file mode 100644 index 0000000000..f6765ba2df --- /dev/null +++ b/components/xtensa/esp32s2beta/include/xtensa/config/tie.h @@ -0,0 +1,130 @@ +/* + * tie.h -- compile-time HAL definitions dependent on CORE & TIE configuration + * + * NOTE: This header file is not meant to be included directly. + */ + +/* This header file describes this specific Xtensa processor's TIE extensions + that extend basic Xtensa core functionality. It is customized to this + Xtensa processor configuration. + + Copyright (c) 1999-2018 Cadence Design Systems Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _XTENSA_CORE_TIE_H +#define _XTENSA_CORE_TIE_H + +#define XCHAL_CP_NUM 0 /* number of coprocessors */ +#define XCHAL_CP_MAX 0 /* max CP ID + 1 (0 if none) */ +#define XCHAL_CP_MASK 0x00 /* bitmask of all CPs by ID */ +#define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */ + +/* Save area for non-coprocessor optional and custom (TIE) state: */ +#define XCHAL_NCP_SA_SIZE 4 +#define XCHAL_NCP_SA_ALIGN 4 + +/* Total save area for optional and custom state (NCP + CPn): */ +#define XCHAL_TOTAL_SA_SIZE 16 /* with 16-byte align padding */ +#define XCHAL_TOTAL_SA_ALIGN 4 /* actual minimum alignment */ + +/* + * Detailed contents of save areas. + * NOTE: caller must define the XCHAL_SA_REG macro (not defined here) + * before expanding the XCHAL_xxx_SA_LIST() macros. + * + * XCHAL_SA_REG(s,ccused,abikind,kind,opt,name,galign,align,asize, + * dbnum,base,regnum,bitsz,gapsz,reset,x...) + * + * s = passed from XCHAL_*_LIST(s), eg. to select how to expand + * ccused = set if used by compiler without special options or code + * abikind = 0 (caller-saved), 1 (callee-saved), or 2 (thread-global) + * kind = 0 (special reg), 1 (TIE user reg), or 2 (TIE regfile reg) + * opt = 0 (custom TIE extension or coprocessor), or 1 (optional reg) + * name = lowercase reg name (no quotes) + * galign = group byte alignment (power of 2) (galign >= align) + * align = register byte alignment (power of 2) + * asize = allocated size in bytes (asize*8 == bitsz + gapsz + padsz) + * (not including any pad bytes required to galign this or next reg) + * dbnum = unique target number f/debug (see ) + * base = reg shortname w/o index (or sr=special, ur=TIE user reg) + * regnum = reg index in regfile, or special/TIE-user reg number + * bitsz = number of significant bits (regfile width, or ur/sr mask bits) + * gapsz = intervening bits, if bitsz bits not stored contiguously + * (padsz = pad bits at end [TIE regfile] or at msbits [ur,sr] of asize) + * reset = register reset value (or 0 if undefined at reset) + * x = reserved for future use (0 until then) + * + * To filter out certain registers, e.g. to expand only the non-global + * registers used by the compiler, you can do something like this: + * + * #define XCHAL_SA_REG(s,ccused,p...) SELCC##ccused(p) + * #define SELCC0(p...) + * #define SELCC1(abikind,p...) SELAK##abikind(p) + * #define SELAK0(p...) REG(p) + * #define SELAK1(p...) REG(p) + * #define SELAK2(p...) + * #define REG(kind,tie,name,galn,aln,asz,csz,dbnum,base,rnum,bsz,rst,x...) \ + * ...what you want to expand... + */ + +#define XCHAL_NCP_SA_NUM 1 +#define XCHAL_NCP_SA_LIST(s) \ + XCHAL_SA_REG(s,1,2,1,1, threadptr, 4, 4, 4,0x03E7, ur,231, 32,0,0,0) + +#define XCHAL_CP0_SA_NUM 0 +#define XCHAL_CP0_SA_LIST(s) /* empty */ + +#define XCHAL_CP1_SA_NUM 0 +#define XCHAL_CP1_SA_LIST(s) /* empty */ + +#define XCHAL_CP2_SA_NUM 0 +#define XCHAL_CP2_SA_LIST(s) /* empty */ + +#define XCHAL_CP3_SA_NUM 0 +#define XCHAL_CP3_SA_LIST(s) /* empty */ + +#define XCHAL_CP4_SA_NUM 0 +#define XCHAL_CP4_SA_LIST(s) /* empty */ + +#define XCHAL_CP5_SA_NUM 0 +#define XCHAL_CP5_SA_LIST(s) /* empty */ + +#define XCHAL_CP6_SA_NUM 0 +#define XCHAL_CP6_SA_LIST(s) /* empty */ + +#define XCHAL_CP7_SA_NUM 0 +#define XCHAL_CP7_SA_LIST(s) /* empty */ + +/* Byte length of instruction from its first nibble (op0 field), per FLIX. */ +#define XCHAL_OP0_FORMAT_LENGTHS 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3 +/* Byte length of instruction from its first byte, per FLIX. */ +#define XCHAL_BYTE0_FORMAT_LENGTHS \ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\ + 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3 + +#endif /*_XTENSA_CORE_TIE_H*/ + diff --git a/components/xtensa/esp32s2beta/libhal.a b/components/xtensa/esp32s2beta/libhal.a new file mode 100644 index 0000000000..42a19a23fa Binary files /dev/null and b/components/xtensa/esp32s2beta/libhal.a differ diff --git a/components/esp32/include/esp_attr.h b/components/xtensa/include/esp_attr.h similarity index 100% rename from components/esp32/include/esp_attr.h rename to components/xtensa/include/esp_attr.h diff --git a/components/xtensa/include/esp_debug_helpers.h b/components/xtensa/include/esp_debug_helpers.h index 40167780c5..d088ddeef1 100644 --- a/components/xtensa/include/esp_debug_helpers.h +++ b/components/xtensa/include/esp_debug_helpers.h @@ -20,7 +20,9 @@ extern "C" { #ifndef __ASSEMBLER__ +#include #include "esp_err.h" +#include "soc/soc.h" #define ESP_WATCHPOINT_LOAD 0x40000000 #define ESP_WATCHPOINT_STORE 0x80000000 @@ -125,7 +127,6 @@ bool esp_backtrace_get_next_frame(esp_backtrace_frame_t *frame); */ esp_err_t esp_backtrace_print(int depth); - #endif #ifdef __cplusplus } diff --git a/components/xtensa/stdatomic.c b/components/xtensa/stdatomic.c new file mode 100644 index 0000000000..a4a9c383bf --- /dev/null +++ b/components/xtensa/stdatomic.c @@ -0,0 +1,47 @@ +// 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. + +//replacement for gcc built-in functions + +#include "sdkconfig.h" +#include "freertos/FreeRTOS.h" +#include "freertos/portmacro.h" +#include "xtensa/config/core-isa.h" + + +#define CMP_EXCHANGE(n, type) bool __atomic_compare_exchange_ ## n (type* mem, type* expect, type desired, int success, int failure) \ +{ \ + bool ret = false; \ + unsigned state = portENTER_CRITICAL_NESTED(); \ + if (*mem == *expect) { \ + ret = true; \ + *mem = desired; \ + } else { \ + *expect = *mem; \ + } \ + portEXIT_CRITICAL_NESTED(state); \ + return ret; \ +} + +//this piece of code should only be compiled if the cpu doesn't support atomic compare and swap (s32c1i) +#if XCHAL_HAVE_S32C1I == 0 + +#pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch" + +CMP_EXCHANGE(1, uint8_t) +CMP_EXCHANGE(2, uint16_t) +CMP_EXCHANGE(4, uint32_t) +CMP_EXCHANGE(8, uint64_t) + +#endif \ No newline at end of file diff --git a/docs/Doxyfile b/docs/Doxyfile index 5074418536..f05cc2a6b3 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -98,6 +98,7 @@ INPUT = \ ../../components/driver/include/driver/spi_common.h \ ../../components/driver/include/driver/spi_master.h \ ../../components/driver/include/driver/spi_slave.h \ + ../../components/driver/esp32s2beta/include/temp_sensor.h \ ../../components/driver/include/driver/timer.h \ ../../components/driver/include/driver/touch_pad.h \ ../../components/driver/include/driver/uart.h \ @@ -218,6 +219,7 @@ INPUT = \ ## ## NOTE: for line below header_file.inc is not used ../../components/ulp/include/esp32/ulp.h \ + ../../components/ulp/include/ulp_common.h \ ## ## Application Level Tracing - API Reference ## diff --git a/docs/conf_common.py b/docs/conf_common.py index 12616080c3..b61ea2c39c 100644 --- a/docs/conf_common.py +++ b/docs/conf_common.py @@ -95,6 +95,11 @@ kconfigs = find_component_files("../../components", "Kconfig") kconfig_projbuilds = find_component_files("../../components", "Kconfig.projbuild") sdkconfig_renames = find_component_files("../../components", "sdkconfig.rename") +# trim the esp32s2beta component, until we have proper multi-target support +kconfigs = [k for k in kconfigs if "esp32s2beta" not in k] +kconfig_projbuilds = [k for k in kconfig_projbuilds if "esp32s2beta" not in k] +sdkconfig_renames = [r for r in sdkconfig_renames if "esp32s2beta" not in r] + confgen_args = [sys.executable, "../../tools/kconfig_new/confgen.py", "--kconfig", "../../Kconfig", diff --git a/docs/en/api-guides/fatal-errors.rst b/docs/en/api-guides/fatal-errors.rst index f1ca3f1842..fe07381a3e 100644 --- a/docs/en/api-guides/fatal-errors.rst +++ b/docs/en/api-guides/fatal-errors.rst @@ -62,7 +62,7 @@ Behavior of panic handler is affected by two other configuration options. - If :doc:`Core Dump ` feature is enabled (``CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH`` or ``CONFIG_ESP32_ENABLE_COREDUMP_TO_UART`` options), then system state (task stacks and registers) will be dumped either to Flash or UART, for later analysis. -- If :ref:`CONFIG_ESP32_PANIC_HANDLER_IRAM` is disabled (disabled by default), the panic handler code is placed in flash memory not IRAM. This means that if ESP-IDF crashes while flash cache is disabled, the panic handler will automatically re-enable flash cache before running GDB Stub or Core Dump. This adds some minor risk, if the flash cache status is also corrupted during the crash. +- If :ref:`CONFIG_ESP_PANIC_HANDLER_IRAM` is disabled (disabled by default), the panic handler code is placed in flash memory not IRAM. This means that if ESP-IDF crashes while flash cache is disabled, the panic handler will automatically re-enable flash cache before running GDB Stub or Core Dump. This adds some minor risk, if the flash cache status is also corrupted during the crash. If this option is enabled, the panic handler code is placed in IRAM. This allows the panic handler to run without needing to re-enable cache first. This may be necessary to debug some complex issues with crashes while flash cache is disabled (for example, when writing to SPI flash). diff --git a/docs/en/api-reference/peripherals/index.rst b/docs/en/api-reference/peripherals/index.rst index 73c5b42edf..6aff1448ae 100644 --- a/docs/en/api-reference/peripherals/index.rst +++ b/docs/en/api-reference/peripherals/index.rst @@ -22,6 +22,7 @@ Peripherals API Sigma-delta Modulation SPI Master SPI Slave + Temp sensor Timer Touch Sensor UART diff --git a/docs/en/api-reference/peripherals/temp_sensor.rst b/docs/en/api-reference/peripherals/temp_sensor.rst new file mode 100644 index 0000000000..b9dd6a2d9a --- /dev/null +++ b/docs/en/api-reference/peripherals/temp_sensor.rst @@ -0,0 +1,32 @@ +ESP32-S2 Temperature Sensor +=========================== + +Overview +-------- + +The ESP32-S2 has a built-in temperature sensor. The temperature sensor module contains an 8-bit Sigma-Delta ADC and a temperature offset DAC. +The conversion relationship is the first columns of the table below. Among them, offset = 0 is the main measurement option, and other values are extended measurement options. + ++--------+------------------------+------------------------+ +| offset | measure range(Celsius) | measure error(Celsius) | ++========+========================+========================+ +| -2 | 50 ~ 125 | < 3 | ++--------+------------------------+------------------------+ +| -1 | 20 ~ 100 | < 2 | ++--------+------------------------+------------------------+ +| 0 | -10 ~ 80 | < 1 | ++--------+------------------------+------------------------+ +| 1 | -30 ~ 50 | < 2 | ++--------+------------------------+------------------------+ +| 2 | -40 ~ 20 | < 3 | ++--------+------------------------+------------------------+ + +Application Example +------------------- + +Temperature sensor reading example: :example:`peripherals/temp_sensor`. + +API Reference - Normal Temp Sensor +---------------------------------- + +.. include:: /_build/inc/temp_sensor.inc diff --git a/docs/en/api-reference/peripherals/uart.rst b/docs/en/api-reference/peripherals/uart.rst index c131f66331..3202c56526 100644 --- a/docs/en/api-reference/peripherals/uart.rst +++ b/docs/en/api-reference/peripherals/uart.rst @@ -169,7 +169,7 @@ The API provides a convenient way to handle specific interrupts discussed above * **FIFO space threshold or transmission timeout reached** - the interrupts on TX or Rx FIFO buffer being filled with specific number of characters or on a timeout of sending or receiving data. To use these interrupts, first configure respective threshold values of the buffer length and the timeout by entering them in :cpp:type:`uart_intr_config_t` structure and calling :cpp:func:`uart_intr_config`. Then enable interrupts with functions :cpp:func:`uart_enable_rx_intr` and :cpp:func:`uart_enable_tx_intr`. To disable these interrupts there are corresponding functions :cpp:func:`uart_disable_rx_intr` or :cpp:func:`uart_disable_tx_intr`. -* **Pattern detection** - an interrupt triggered on detecting a 'pattern' of the same character being sent number of times. The functions that allow to configure, enable and disable this interrupt are :cpp:func:`uart_enable_pattern_det_intr` and cpp:func:`uart_disable_pattern_det_intr`. +* **Pattern detection** - an interrupt triggered on detecting a 'pattern' of the same character being sent number of times. The functions that allow to configure, enable and disable this interrupt are :cpp:func:`uart_enable_pattern_det_baud_intr` and cpp:func:`uart_disable_pattern_det_intr`. Macros ^^^^^^ diff --git a/docs/en/esp32s2beta.rst b/docs/en/esp32s2beta.rst new file mode 100644 index 0000000000..6e278312cb --- /dev/null +++ b/docs/en/esp32s2beta.rst @@ -0,0 +1,97 @@ +ESP32-S2 Beta Preview Support +============================= + +The current master branch of ESP-IDF (pre-V4.1) contains preview support for ESP32-S2 Beta. + +The ESP32-S2 Beta chip is not the same as the final ESP32-S2, the Beta chip is a limited engineering sample and as a result not all features are available. + +Software support is still being developed ahead of the final ESP32-S2 release (see :ref:`esp32s2-limitations` and :ref:`esp32s2-roadmap` sections below). + +Documentation +^^^^^^^^^^^^^ + +Except where it specifically mentions ESP32-S2, this version of the ESP-IDF Programming Guide is written for ESP32 only. Most software APIs and components are the same or very similar for ESP32-S2, but differences may not be documented yet. + +Setting up for ESP32-S2 Beta +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To start with, follow the :doc:`/get-started/index` guide to configure the CMake-based build system for ESP32. + +When running ``install.sh`` or ``install.bat`` as part of the Get Started guide, the ESP32-S2 toolchain will be automatically downloaded and added to the IDF Tools directory. If you had already run ``install.sh`` or ``install.bat`` before updating to a version with ESP32-S2 support, you may need to re-run it. + +The toolchain tuple is `xtensa-esp32s2-elf-`, for example the GCC compiler for this target is named `xtensa-esp32s2-elf-gcc`. + +Manual toolchain URLs +--------------------- + +If not using ``install.sh`` or ``install.bat``, you can download the manual toolchain manually from here: + +- `Windows `_ +- `macOS `_ +- `Linux 64-bit x86 `_ +- `Linux 32-bit x86 `_ + +If installing the toolchain manually, unpack it somewhere and add the ``bin`` subdirectory to your `PATH`. + +Building a project for ESP32-S2 Beta +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. important:: Not all ESP-IDF examples support ESP32-S2 Beta. + + For some examples this is because required hardware is not included in ESP32-S2 so it cannot be supported. For some examples this is because the example has not yet been updated for ESP32-S2. + + If building an example, please check the example CMakeLists.txt file for the clause ``SUPPORTED_TARGETS esp32``. If this is present, the example won't work on ESP32-S2. + +.. highlight:: bash + +Before building an ESP-IDF project, run the following command to switch the target to ESP32-S2 Beta:: + + idf.py set-target esp32s2beta + +.. important:: Running ``set-target`` will clear the project configuration and create a new empty ``sdkconfig`` file for the project. The old configuration will be saved in ``sdkconfig.old``. + +Then configure the project:: + + idf.py menuconfig + +.. important:: There are 3 versions of ESP32-S2 Beta engineering sample available with different Wi-Fi PHYs. They can be identified by the marking on the chip itself. The project must be configured to match the chip via the project setting "ESP32-S2 Beta chip version" (``CONFIG_ESP32S2_BETA_CHIP_VERSION``). This can be found under Component Config -> ESP32S2-specific. If the project setting doesn't match the chip then Wi-Fi performance may be very poor, or the chip may crash when initializing Wi-Fi. + +Build and flash the project as usual, for example:: + + idf.py -p PORT flash monitor + +Consult the :doc:`/get-started/index` guide for more details on building and flashing an ESP-IDF project. + +.. note:: It is possible to set the project target back to ESP32 by running ``idf.py set-target esp32``. This also clears the project configuration. + +.. _esp32s2-limitations: + +Limitations +^^^^^^^^^^^ + +ESP32-S2 Beta support is currently a preview and does not support all features. Espressif firmware developers are working hard on the remaining support, so please update the ``master`` branch regularly to receive the latest code. + +- The integrated USB OTG peripheral is not supported +- Documentation not updated for ESP32-S2 in most places +- Peripheral drivers are a work in progress +- No power saving modes +- No hardware security features or cryptographic accelerator support +- Time-of-Flight (TOF) measurements with normal Wi-Fi packets is not supported + +.. _esp32s2-roadmap: + +Roadmap +^^^^^^^ + +- ESP-IDF V4.1 will support ESP32-S2 Beta chip as a preview with some limitations. +- ESP-IDF V4.2 will support ESP32-S2. + +Support for ESP32-S2 Beta will be removed from ESP-IDF once ESP32-S2 is available. + + +Issues +^^^^^^ + +If you find issues which are not mentioned in :ref:`esp32s2-limitations`, please `open an issue on GitHub `_. + +Please make sure to mention that you are using the ESP32-S2 Beta preview support and give your exact version of ESP-IDF. diff --git a/docs/en/index.rst b/docs/en/index.rst index 2a2f3382a2..7976bab04f 100644 --- a/docs/en/index.rst +++ b/docs/en/index.rst @@ -41,6 +41,7 @@ This is the documentation for Espressif IoT Development Framework (`esp-idf API Reference H/W Reference + ESP32-S2 Preview Support API Guides Libraries and Frameworks Contribute diff --git a/docs/zh_CN/api-reference/peripherals/index.rst b/docs/zh_CN/api-reference/peripherals/index.rst index c985d687e6..22d2cd55da 100644 --- a/docs/zh_CN/api-reference/peripherals/index.rst +++ b/docs/zh_CN/api-reference/peripherals/index.rst @@ -22,6 +22,7 @@ Sigma-delta Modulation SPI Master SPI Slave + Temp sensor Timer Touch Sensor UART diff --git a/docs/zh_CN/api-reference/peripherals/temp_sensor.rst b/docs/zh_CN/api-reference/peripherals/temp_sensor.rst new file mode 100644 index 0000000000..e5a634c707 --- /dev/null +++ b/docs/zh_CN/api-reference/peripherals/temp_sensor.rst @@ -0,0 +1 @@ +.. include:: ../../../en/api-reference/peripherals/temp_sensor.rst \ No newline at end of file diff --git a/docs/zh_CN/esp32s2beta.rst b/docs/zh_CN/esp32s2beta.rst new file mode 100644 index 0000000000..ca4e0016f0 --- /dev/null +++ b/docs/zh_CN/esp32s2beta.rst @@ -0,0 +1 @@ +.. include:: ../en/esp32s2beta.rst diff --git a/docs/zh_CN/index.rst b/docs/zh_CN/index.rst index 5cd11e5f06..60a74df61f 100644 --- a/docs/zh_CN/index.rst +++ b/docs/zh_CN/index.rst @@ -42,6 +42,7 @@ ESP-IDF 编程指南 快速入门 API 参考 H/W 参考 + ESP32-S2 预览 API 指南 Libraries and Frameworks 贡献代码 diff --git a/examples/bluetooth/bluedroid/ble/ble_ancs/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/ble_ancs/CMakeLists.txt index 84faba94ed..ecfe4e5ad8 100644 --- a/examples/bluetooth/bluedroid/ble/ble_ancs/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/ble_ancs/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_ancs) diff --git a/examples/bluetooth/bluedroid/ble/ble_compatibility_test/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/ble_compatibility_test/CMakeLists.txt index a1bc6f47ba..e4a204ce56 100644 --- a/examples/bluetooth/bluedroid/ble/ble_compatibility_test/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/ble_compatibility_test/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_compatibility_test) diff --git a/examples/bluetooth/bluedroid/ble/ble_eddystone/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/ble_eddystone/CMakeLists.txt index 9c5943ef06..2961c2927f 100644 --- a/examples/bluetooth/bluedroid/ble/ble_eddystone/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/ble_eddystone/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_eddystone_demo) diff --git a/examples/bluetooth/bluedroid/ble/ble_hid_device_demo/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/ble_hid_device_demo/CMakeLists.txt index f8c948007c..0a407a5df4 100644 --- a/examples/bluetooth/bluedroid/ble/ble_hid_device_demo/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/ble_hid_device_demo/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(hidd_demos) diff --git a/examples/bluetooth/bluedroid/ble/ble_ibeacon/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/ble_ibeacon/CMakeLists.txt index dce22425d5..2f80f9c024 100644 --- a/examples/bluetooth/bluedroid/ble/ble_ibeacon/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/ble_ibeacon/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_ibeacon_demo) diff --git a/examples/bluetooth/bluedroid/ble/ble_spp_client/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/ble_spp_client/CMakeLists.txt index 301d8408e7..aa98c94672 100644 --- a/examples/bluetooth/bluedroid/ble/ble_spp_client/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/ble_spp_client/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(spp_client_demo) diff --git a/examples/bluetooth/bluedroid/ble/ble_spp_server/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/ble_spp_server/CMakeLists.txt index b4dcebe6af..7e461f590b 100644 --- a/examples/bluetooth/bluedroid/ble/ble_spp_server/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/ble_spp_server/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_spp_server_demo) diff --git a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/CMakeLists.txt index 3a592ef4f0..41add49707 100644 --- a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_client/CMakeLists.txt @@ -2,5 +2,6 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(throughput_client_demo) diff --git a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/CMakeLists.txt index adcc12d731..ddbd1b498a 100644 --- a/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/ble_throughput/throughput_server/CMakeLists.txt @@ -2,5 +2,6 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(throughput_server_demo) diff --git a/examples/bluetooth/bluedroid/ble/blufi/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/blufi/CMakeLists.txt index b85d34bbbf..850040d3aa 100644 --- a/examples/bluetooth/bluedroid/ble/blufi/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/blufi/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(blufi_demo) diff --git a/examples/bluetooth/bluedroid/ble/gatt_client/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/gatt_client/CMakeLists.txt index d32eb6bee1..ea402345d5 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_client/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/gatt_client/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gatt_client_demo) diff --git a/examples/bluetooth/bluedroid/ble/gatt_security_client/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/gatt_security_client/CMakeLists.txt index 8f468d7644..c61323685f 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_security_client/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/gatt_security_client/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sec_gattc_demo) diff --git a/examples/bluetooth/bluedroid/ble/gatt_security_server/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/gatt_security_server/CMakeLists.txt index 8e9d61ff9f..1406a6bb20 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_security_server/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/gatt_security_server/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sec_gatts_demo) diff --git a/examples/bluetooth/bluedroid/ble/gatt_server/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/gatt_server/CMakeLists.txt index fb1760c1ef..352a6e6af1 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_server/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/gatt_server/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gatt_server_demos) diff --git a/examples/bluetooth/bluedroid/ble/gatt_server_service_table/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/gatt_server_service_table/CMakeLists.txt index d6dc6a416b..4ac4420384 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_server_service_table/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/gatt_server_service_table/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gatt_server_service_table_demo) diff --git a/examples/bluetooth/bluedroid/ble/gattc_multi_connect/CMakeLists.txt b/examples/bluetooth/bluedroid/ble/gattc_multi_connect/CMakeLists.txt index 6a7a6b3b8d..c8f4695b4e 100644 --- a/examples/bluetooth/bluedroid/ble/gattc_multi_connect/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/ble/gattc_multi_connect/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gatt_multi_connect) diff --git a/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/CMakeLists.txt b/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/CMakeLists.txt index cc8e45027d..72fb9f87dd 100644 --- a/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/CMakeLists.txt @@ -2,5 +2,6 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(a2dp_sink) diff --git a/examples/bluetooth/bluedroid/classic_bt/a2dp_source/CMakeLists.txt b/examples/bluetooth/bluedroid/classic_bt/a2dp_source/CMakeLists.txt index 7c4e215288..55e21f6d43 100644 --- a/examples/bluetooth/bluedroid/classic_bt/a2dp_source/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/classic_bt/a2dp_source/CMakeLists.txt @@ -2,5 +2,6 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(a2dp_source) diff --git a/examples/bluetooth/bluedroid/classic_bt/bt_discovery/CMakeLists.txt b/examples/bluetooth/bluedroid/classic_bt/bt_discovery/CMakeLists.txt index 6b73adc360..41e349588c 100644 --- a/examples/bluetooth/bluedroid/classic_bt/bt_discovery/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/classic_bt/bt_discovery/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_discovery) diff --git a/examples/bluetooth/bluedroid/classic_bt/bt_spp_acceptor/CMakeLists.txt b/examples/bluetooth/bluedroid/classic_bt/bt_spp_acceptor/CMakeLists.txt index 8b26ee3f56..9fa9ebddd5 100644 --- a/examples/bluetooth/bluedroid/classic_bt/bt_spp_acceptor/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/classic_bt/bt_spp_acceptor/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_spp_acceptor_demo) diff --git a/examples/bluetooth/bluedroid/classic_bt/bt_spp_initiator/CMakeLists.txt b/examples/bluetooth/bluedroid/classic_bt/bt_spp_initiator/CMakeLists.txt index 4ee5f07788..c3f95222a9 100644 --- a/examples/bluetooth/bluedroid/classic_bt/bt_spp_initiator/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/classic_bt/bt_spp_initiator/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_spp_initiator_demo) diff --git a/examples/bluetooth/bluedroid/classic_bt/bt_spp_vfs_acceptor/CMakeLists.txt b/examples/bluetooth/bluedroid/classic_bt/bt_spp_vfs_acceptor/CMakeLists.txt index 46030210a0..a55bcd7e36 100644 --- a/examples/bluetooth/bluedroid/classic_bt/bt_spp_vfs_acceptor/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/classic_bt/bt_spp_vfs_acceptor/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_spp_vfs_acceptor_demo) diff --git a/examples/bluetooth/bluedroid/classic_bt/bt_spp_vfs_initiator/CMakeLists.txt b/examples/bluetooth/bluedroid/classic_bt/bt_spp_vfs_initiator/CMakeLists.txt index a133903920..94758343c3 100644 --- a/examples/bluetooth/bluedroid/classic_bt/bt_spp_vfs_initiator/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/classic_bt/bt_spp_vfs_initiator/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_spp_vfs_initiator_demo) diff --git a/examples/bluetooth/bluedroid/coex/a2dp_gatts_coex/CMakeLists.txt b/examples/bluetooth/bluedroid/coex/a2dp_gatts_coex/CMakeLists.txt index 3c9fa474c1..b54d4610c3 100644 --- a/examples/bluetooth/bluedroid/coex/a2dp_gatts_coex/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/coex/a2dp_gatts_coex/CMakeLists.txt @@ -2,5 +2,6 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(bt_ble_coex) diff --git a/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/CMakeLists.txt b/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/CMakeLists.txt index f520a3ae27..7f8c072493 100644 --- a/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/coex/gattc_gatts_coex/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(gattc_gatts_coex) diff --git a/examples/bluetooth/bluedroid/hci/controller_hci_uart/CMakeLists.txt b/examples/bluetooth/bluedroid/hci/controller_hci_uart/CMakeLists.txt index 49c95f4da4..088a6f5237 100644 --- a/examples/bluetooth/bluedroid/hci/controller_hci_uart/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/hci/controller_hci_uart/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(controller_hci_uart) diff --git a/examples/bluetooth/bluedroid/hci/controller_vhci_ble_adv/CMakeLists.txt b/examples/bluetooth/bluedroid/hci/controller_vhci_ble_adv/CMakeLists.txt index 22b94847f6..2a4b8872a1 100644 --- a/examples/bluetooth/bluedroid/hci/controller_vhci_ble_adv/CMakeLists.txt +++ b/examples/bluetooth/bluedroid/hci/controller_vhci_ble_adv/CMakeLists.txt @@ -2,5 +2,6 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_adv) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/CMakeLists.txt b/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/CMakeLists.txt index f384288f31..d604182bb5 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/CMakeLists.txt +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_client_model/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(ble_mesh_client_model) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/CMakeLists.txt b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/CMakeLists.txt index 74361e558c..5e425b2aea 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/CMakeLists.txt +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(ble_mesh_console_node) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/main/ble_mesh_console_main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/main/ble_mesh_console_main.c index 25857bc96d..5dba3a050b 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/main/ble_mesh_console_main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/main/ble_mesh_console_main.c @@ -63,11 +63,11 @@ static void initialize_console(void) esp_vfs_dev_uart_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF); /* Install UART driver for interrupt-driven reads and writes */ - ESP_ERROR_CHECK( uart_driver_install(CONFIG_CONSOLE_UART_NUM, + ESP_ERROR_CHECK( uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM, 256, 0, 0, NULL, 0) ); /* Tell VFS to use UART driver */ - esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM); + esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM); /* Initialize the console */ esp_console_config_t console_config = { diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/CMakeLists.txt b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/CMakeLists.txt index 6ce28d7d57..14941a14e5 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/CMakeLists.txt +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(ble_mesh_console_provisioner) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_console_main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_console_main.c index 4618e14b57..a60f70ee2b 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_console_main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_provisioner/main/ble_mesh_console_main.c @@ -66,11 +66,11 @@ static void initialize_console(void) esp_vfs_dev_uart_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF); /* Install UART driver for interrupt-driven reads and writes */ - ESP_ERROR_CHECK( uart_driver_install(CONFIG_CONSOLE_UART_NUM, + ESP_ERROR_CHECK( uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM, 256, 0, 0, NULL, 0) ); /* Tell VFS to use UART driver */ - esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM); + esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM); /* Initialize the console */ esp_console_config_t console_config = { diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_client/CMakeLists.txt b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_client/CMakeLists.txt index 5f9bd92c1c..fb8272bf31 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_client/CMakeLists.txt +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_client/CMakeLists.txt @@ -5,4 +5,5 @@ cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_models/fast_prov_vendor_model/components) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(ble_mesh_fast_prov_client) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_server/CMakeLists.txt b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_server/CMakeLists.txt index 56ef44654e..b16b01c888 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_server/CMakeLists.txt +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_server/CMakeLists.txt @@ -5,4 +5,5 @@ cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_models/fast_prov_vendor_model/components) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(ble_mesh_fast_prov_server) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/CMakeLists.txt b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/CMakeLists.txt index d8b91b1efc..6dd3671530 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_node/CMakeLists.txt +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_node/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(ble_mesh_node) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/CMakeLists.txt b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/CMakeLists.txt index dfffbf786f..503adacea5 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/CMakeLists.txt +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_provisioner/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(ble_mesh_provisioner) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_models/fast_prov_vendor_model/CMakeLists.txt b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_models/fast_prov_vendor_model/CMakeLists.txt index cb92f4b374..9ca35d2569 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_models/fast_prov_vendor_model/CMakeLists.txt +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_models/fast_prov_vendor_model/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(fast_prov_vendor_model) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/CMakeLists.txt b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/CMakeLists.txt index 8933ca7f25..3d18ee56b9 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/CMakeLists.txt +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/CMakeLists.txt @@ -5,4 +5,5 @@ cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/bluetooth/esp_ble_mesh/ble_mesh_vendor_models/fast_prov_vendor_model/components) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(ble_mesh_wifi_coexist) diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/main/ble_mesh_demo_main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/main/ble_mesh_demo_main.c index f2b56076f1..9c267582da 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/main/ble_mesh_demo_main.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_wifi_coexist/main/ble_mesh_demo_main.c @@ -792,11 +792,11 @@ static void initialize_console(void) esp_vfs_dev_uart_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF); /* Install UART driver for interrupt-driven reads and writes */ - ESP_ERROR_CHECK( uart_driver_install(CONFIG_CONSOLE_UART_NUM, + ESP_ERROR_CHECK( uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM, 256, 0, 0, NULL, 0) ); /* Tell VFS to use UART driver */ - esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM); + esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM); /* Initialize the console */ esp_console_config_t console_config = { diff --git a/examples/bluetooth/nimble/blecent/CMakeLists.txt b/examples/bluetooth/nimble/blecent/CMakeLists.txt index b3ac70b41a..4df574b9d5 100644 --- a/examples/bluetooth/nimble/blecent/CMakeLists.txt +++ b/examples/bluetooth/nimble/blecent/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(blecent) diff --git a/examples/bluetooth/nimble/blecent/blecent_test.py b/examples/bluetooth/nimble/blecent/blecent_test.py index 0933a71e2d..eabe8df261 100644 --- a/examples/bluetooth/nimble/blecent/blecent_test.py +++ b/examples/bluetooth/nimble/blecent/blecent_test.py @@ -27,6 +27,7 @@ try: if test_fw_path and test_fw_path not in sys.path: sys.path.insert(0, test_fw_path) import IDF + from IDF.IDFDUT import ESP32DUT except ImportError as e: print(e) print("\nCheck your IDF_PATH\nOR") @@ -67,7 +68,7 @@ def test_example_app_ble_central(env, extra_data): subprocess.check_output(['rm','-rf','/var/lib/bluetooth/*']) subprocess.check_output(['hciconfig','hci0','reset']) # Acquire DUT - dut = env.get_dut("blecent", "examples/bluetooth/nimble/blecent") + dut = env.get_dut("blecent", "examples/bluetooth/nimble/blecent", dut_class=ESP32DUT) # Get binary file binary_file = os.path.join(dut.app.binary_path, "blecent.bin") diff --git a/examples/bluetooth/nimble/blehr/CMakeLists.txt b/examples/bluetooth/nimble/blehr/CMakeLists.txt index 62f79f5231..6e02bcff33 100644 --- a/examples/bluetooth/nimble/blehr/CMakeLists.txt +++ b/examples/bluetooth/nimble/blehr/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(blehr) diff --git a/examples/bluetooth/nimble/blehr/blehr_test.py b/examples/bluetooth/nimble/blehr/blehr_test.py index 7cc10ed889..432a160135 100644 --- a/examples/bluetooth/nimble/blehr/blehr_test.py +++ b/examples/bluetooth/nimble/blehr/blehr_test.py @@ -29,6 +29,7 @@ try: if test_fw_path and test_fw_path not in sys.path: sys.path.insert(0, test_fw_path) import IDF + from IDF.IDFDUT import ESP32DUT except ImportError as e: print(e) print("\nCheck your IDF_PATH\nOR") @@ -128,7 +129,7 @@ def test_example_app_ble_hr(env, extra_data): subprocess.check_output(['hciconfig','hci0','reset']) # Acquire DUT - dut = env.get_dut("blehr", "examples/bluetooth/nimble/blehr") + dut = env.get_dut("blehr", "examples/bluetooth/nimble/blehr", dut_class=ESP32DUT) # Get binary file binary_file = os.path.join(dut.app.binary_path, "blehr.bin") diff --git a/examples/bluetooth/nimble/blemesh/CMakeLists.txt b/examples/bluetooth/nimble/blemesh/CMakeLists.txt index f022ba3d27..6250e13e12 100644 --- a/examples/bluetooth/nimble/blemesh/CMakeLists.txt +++ b/examples/bluetooth/nimble/blemesh/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(blemesh) diff --git a/examples/bluetooth/nimble/bleprph/CMakeLists.txt b/examples/bluetooth/nimble/bleprph/CMakeLists.txt index 6e3fbcae38..f400e730be 100644 --- a/examples/bluetooth/nimble/bleprph/CMakeLists.txt +++ b/examples/bluetooth/nimble/bleprph/CMakeLists.txt @@ -3,4 +3,5 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(bleprph) diff --git a/examples/bluetooth/nimble/bleprph/bleprph_test.py b/examples/bluetooth/nimble/bleprph/bleprph_test.py index 97bfeca97a..70615c12bf 100644 --- a/examples/bluetooth/nimble/bleprph/bleprph_test.py +++ b/examples/bluetooth/nimble/bleprph/bleprph_test.py @@ -29,6 +29,7 @@ try: if test_fw_path and test_fw_path not in sys.path: sys.path.insert(0, test_fw_path) import IDF + from IDF.IDFDUT import ESP32DUT except ImportError as e: print(e) print("Try `export TEST_FW_PATH=$IDF_PATH/tools/tiny-test-fw` for resolving the issue") @@ -149,7 +150,7 @@ def test_example_app_ble_peripheral(env, extra_data): subprocess.check_output(['hciconfig','hci0','reset']) # Acquire DUT - dut = env.get_dut("bleprph", "examples/bluetooth/nimble/bleprph") + dut = env.get_dut("bleprph", "examples/bluetooth/nimble/bleprph", dut_class=ESP32DUT) # Get binary file binary_file = os.path.join(dut.app.binary_path, "bleprph.bin") diff --git a/examples/build_system/cmake/idf_as_lib/CMakeLists.txt b/examples/build_system/cmake/idf_as_lib/CMakeLists.txt index b035e11b52..5da04579c9 100644 --- a/examples/build_system/cmake/idf_as_lib/CMakeLists.txt +++ b/examples/build_system/cmake/idf_as_lib/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.5) + project(idf_as_lib C) +set(SUPPORTED_TARGETS esp32) if("${TARGET}" STREQUAL "esp32") # Include for ESP-IDF build system functions include($ENV{IDF_PATH}/tools/cmake/idf.cmake) diff --git a/examples/common_components/protocol_examples_common/Kconfig.projbuild b/examples/common_components/protocol_examples_common/Kconfig.projbuild index e1fee9b611..0e69979836 100644 --- a/examples/common_components/protocol_examples_common/Kconfig.projbuild +++ b/examples/common_components/protocol_examples_common/Kconfig.projbuild @@ -142,6 +142,8 @@ menu "Example Connection Configuration" config EXAMPLE_CONNECT_IPV6 bool "Obtain IPv6 link-local address" + depends on IDF_TARGET_ESP32 + # ToDo: remove once IPV6 is supported on esp32s2 default y help By default, examples will wait until IPv4 and IPv6 addresses are obtained. diff --git a/examples/common_components/protocol_examples_common/connect.c b/examples/common_components/protocol_examples_common/connect.c index 1c6bd98d19..0e9b6a5eae 100644 --- a/examples/common_components/protocol_examples_common/connect.c +++ b/examples/common_components/protocol_examples_common/connect.c @@ -12,7 +12,9 @@ #include "sdkconfig.h" #include "esp_event.h" #include "esp_wifi.h" +#if CONFIG_EXAMPLE_CONNECT_ETHERNET #include "esp_eth.h" +#endif #include "esp_log.h" #include "tcpip_adapter.h" #include "freertos/FreeRTOS.h" diff --git a/examples/ethernet/iperf/CMakeLists.txt b/examples/ethernet/iperf/CMakeLists.txt index 9433ad87ae..a5952c9125 100644 --- a/examples/ethernet/iperf/CMakeLists.txt +++ b/examples/ethernet/iperf/CMakeLists.txt @@ -5,5 +5,6 @@ cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/system/console/components $ENV{IDF_PATH}/examples/wifi/iperf/components) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ethernet_iperf) diff --git a/examples/get-started/blink/example_test.py b/examples/get-started/blink/example_test.py index 91b0f9bc0e..fbe274beab 100644 --- a/examples/get-started/blink/example_test.py +++ b/examples/get-started/blink/example_test.py @@ -10,6 +10,7 @@ import hashlib try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # This environment variable is expected on the host machine test_fw_path = os.getenv("TEST_FW_PATH") @@ -40,7 +41,7 @@ def verify_elf_sha256_embedding(dut): @IDF.idf_example_test(env_tag="Example_WIFI") def test_examples_blink(env, extra_data): - dut = env.get_dut("blink", "examples/get-started/blink") + dut = env.get_dut("blink", "examples/get-started/blink", dut_class=ESP32DUT) binary_file = os.path.join(dut.app.binary_path, "blink.bin") bin_size = os.path.getsize(binary_file) IDF.log_performance("blink_bin_size", "{}KB".format(bin_size // 1024)) diff --git a/examples/get-started/hello_world/main/hello_world_main.c b/examples/get-started/hello_world/main/hello_world_main.c index 7bb54d2fde..2586eb1a84 100644 --- a/examples/get-started/hello_world/main/hello_world_main.c +++ b/examples/get-started/hello_world/main/hello_world_main.c @@ -7,11 +7,19 @@ CONDITIONS OF ANY KIND, either express or implied. */ #include +#include "sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_system.h" #include "esp_spi_flash.h" +#ifdef CONFIG_IDF_TARGET_ESP32 +#define CHIP_NAME "ESP32" +#endif + +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +#define CHIP_NAME "ESP32-S2 Beta" +#endif void app_main(void) { @@ -20,7 +28,8 @@ void app_main(void) /* Print chip information */ esp_chip_info_t chip_info; esp_chip_info(&chip_info); - printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ", + printf("This is %s chip with %d CPU cores, WiFi%s%s, ", + CHIP_NAME, chip_info.cores, (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "", (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : ""); diff --git a/examples/mesh/internal_communication/main/mesh_light.c b/examples/mesh/internal_communication/main/mesh_light.c index 360c14f43a..7c0e943862 100644 --- a/examples/mesh/internal_communication/main/mesh_light.c +++ b/examples/mesh/internal_communication/main/mesh_light.c @@ -41,10 +41,13 @@ esp_err_t mesh_light_init(void) ledc_timer_config_t ledc_timer = { .duty_resolution = LEDC_TIMER_13_BIT, .freq_hz = 5000, - .speed_mode = LEDC_HIGH_SPEED_MODE, + .speed_mode = LEDC_LOW_SPEED_MODE, .timer_num = LEDC_TIMER_0, .clk_cfg = LEDC_AUTO_CLK, }; +#ifdef CONFIG_IDF_TARGET_ESP32 + ledc_timer.speed_mode = LEDC_HIGH_SPEED_MODE; +#endif ledc_timer_config(&ledc_timer); ledc_channel_config_t ledc_channel = { @@ -52,8 +55,9 @@ esp_err_t mesh_light_init(void) .duty = 100, .gpio_num = LEDC_IO_0, .intr_type = LEDC_INTR_FADE_END, - .speed_mode = LEDC_HIGH_SPEED_MODE, - .timer_sel = LEDC_TIMER_0 + .speed_mode = LEDC_LOW_SPEED_MODE, + .timer_sel = LEDC_TIMER_0, + .hpoint = 0, }; ledc_channel_config(&ledc_channel); ledc_channel.channel = LEDC_CHANNEL_1; @@ -76,56 +80,56 @@ esp_err_t mesh_light_set(int color) switch (color) { case MESH_LIGHT_RED: /* Red */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 0); break; case MESH_LIGHT_GREEN: /* Green */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 0); break; case MESH_LIGHT_BLUE: /* Blue */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 3000); break; case MESH_LIGHT_YELLOW: /* Yellow */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 0); break; case MESH_LIGHT_PINK: /* Pink */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 3000); break; case MESH_LIGHT_INIT: /* can't say */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 3000); break; case MESH_LIGHT_WARNING: /* warning */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 3000); break; default: /* off */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 0); } - ledc_update_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0); - ledc_update_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1); - ledc_update_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2); + ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0); + ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1); + ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2); return ESP_OK; } diff --git a/examples/mesh/manual_networking/main/mesh_light.c b/examples/mesh/manual_networking/main/mesh_light.c index ebd620d63c..c9bbfc59bc 100644 --- a/examples/mesh/manual_networking/main/mesh_light.c +++ b/examples/mesh/manual_networking/main/mesh_light.c @@ -41,10 +41,13 @@ esp_err_t mesh_light_init(void) ledc_timer_config_t ledc_timer = { .duty_resolution = LEDC_TIMER_13_BIT, .freq_hz = 5000, - .speed_mode = LEDC_HIGH_SPEED_MODE, + .speed_mode = LEDC_LOW_SPEED_MODE, .timer_num = LEDC_TIMER_0, .clk_cfg = LEDC_AUTO_CLK, }; +#ifdef CONFIG_IDF_TARGET_ESP32 + ledc_timer.speed_mode = LEDC_HIGH_SPEED_MODE; +#endif ledc_timer_config(&ledc_timer); ledc_channel_config_t ledc_channel = { @@ -52,8 +55,9 @@ esp_err_t mesh_light_init(void) .duty = 100, .gpio_num = LEDC_IO_0, .intr_type = LEDC_INTR_FADE_END, - .speed_mode = LEDC_HIGH_SPEED_MODE, - .timer_sel = LEDC_TIMER_0 + .speed_mode = LEDC_LOW_SPEED_MODE, + .timer_sel = LEDC_TIMER_0, + .hpoint = 0, }; ledc_channel_config(&ledc_channel); ledc_channel.channel = LEDC_CHANNEL_1; @@ -76,56 +80,56 @@ esp_err_t mesh_light_set(int color) switch (color) { case MESH_LIGHT_RED: /* Red */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 0); break; case MESH_LIGHT_GREEN: /* Green */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 0); break; case MESH_LIGHT_BLUE: /* Blue */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 3000); break; case MESH_LIGHT_YELLOW: /* Yellow */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 0); break; case MESH_LIGHT_PINK: /* Pink */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 3000); break; case MESH_LIGHT_INIT: /* can't say */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 3000); break; case MESH_LIGHT_WARNING: /* warning */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 3000); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 3000); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 3000); break; default: /* off */ - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1, 0); - ledc_set_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1, 0); + ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2, 0); } - ledc_update_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_0); - ledc_update_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_1); - ledc_update_duty(LEDC_HIGH_SPEED_MODE, LEDC_CHANNEL_2); + ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0); + ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_1); + ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_2); return ESP_OK; } diff --git a/examples/peripherals/adc/CMakeLists.txt b/examples/peripherals/adc/CMakeLists.txt index b01d635218..c272a00142 100644 --- a/examples/peripherals/adc/CMakeLists.txt +++ b/examples/peripherals/adc/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(adc) diff --git a/examples/peripherals/adc/main/adc1_example_main.c b/examples/peripherals/adc/main/adc1_example_main.c index d0f20a6e60..594c05cc07 100644 --- a/examples/peripherals/adc/main/adc1_example_main.c +++ b/examples/peripherals/adc/main/adc1_example_main.c @@ -12,16 +12,23 @@ #include "freertos/task.h" #include "driver/gpio.h" #include "driver/adc.h" +#if CONFIG_IDF_TARGET_ESP32 #include "esp_adc_cal.h" +#endif #define DEFAULT_VREF 1100 //Use adc2_vref_to_gpio() to obtain a better estimate #define NO_OF_SAMPLES 64 //Multisampling +#if CONFIG_IDF_TARGET_ESP32 static esp_adc_cal_characteristics_t *adc_chars; static const adc_channel_t channel = ADC_CHANNEL_6; //GPIO34 if ADC1, GPIO14 if ADC2 +#elif CONFIG_IDF_TARGET_ESP32S2BETA +static const adc_channel_t channel = ADC_CHANNEL_6; // GPIO7 if ADC1, GPIO17 if ADC2 +#endif static const adc_atten_t atten = ADC_ATTEN_DB_0; static const adc_unit_t unit = ADC_UNIT_1; +#if CONFIG_IDF_TARGET_ESP32 static void check_efuse(void) { //Check TP is burned into eFuse @@ -49,11 +56,14 @@ static void print_char_val_type(esp_adc_cal_value_t val_type) printf("Characterized using Default Vref\n"); } } +#endif void app_main(void) { +#if CONFIG_IDF_TARGET_ESP32 //Check if Two Point or Vref are burned into eFuse check_efuse(); +#endif //Configure ADC if (unit == ADC_UNIT_1) { @@ -63,10 +73,12 @@ void app_main(void) adc2_config_channel_atten((adc2_channel_t)channel, atten); } +#if CONFIG_IDF_TARGET_ESP32 //Characterize ADC adc_chars = calloc(1, sizeof(esp_adc_cal_characteristics_t)); esp_adc_cal_value_t val_type = esp_adc_cal_characterize(unit, atten, ADC_WIDTH_BIT_12, DEFAULT_VREF, adc_chars); print_char_val_type(val_type); +#endif //Continuously sample ADC1 while (1) { @@ -82,11 +94,13 @@ void app_main(void) } } adc_reading /= NO_OF_SAMPLES; +#if CONFIG_IDF_TARGET_ESP32 //Convert adc_reading to voltage in mV uint32_t voltage = esp_adc_cal_raw_to_voltage(adc_reading, adc_chars); printf("Raw: %d\tVoltage: %dmV\n", adc_reading, voltage); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + printf("ADC%d CH%d Raw: %d\t\n", unit, channel, adc_reading); +#endif vTaskDelay(pdMS_TO_TICKS(1000)); } } - - diff --git a/examples/peripherals/adc2/CMakeLists.txt b/examples/peripherals/adc2/CMakeLists.txt index 7ea7329c1e..3b4af7e709 100644 --- a/examples/peripherals/adc2/CMakeLists.txt +++ b/examples/peripherals/adc2/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(adc2) diff --git a/examples/peripherals/adc2/main/adc2_example_main.c b/examples/peripherals/adc2/main/adc2_example_main.c index ccf32b3d5f..bfd305b647 100644 --- a/examples/peripherals/adc2/main/adc2_example_main.c +++ b/examples/peripherals/adc2/main/adc2_example_main.c @@ -15,7 +15,6 @@ #include "driver/adc.h" #include "driver/dac.h" #include "esp_system.h" -#include "esp_adc_cal.h" #define DAC_EXAMPLE_CHANNEL CONFIG_EXAMPLE_DAC_CHANNEL #define ADC2_EXAMPLE_CHANNEL CONFIG_EXAMPLE_ADC2_CHANNEL diff --git a/examples/peripherals/can/can_alert_and_recovery/CMakeLists.txt b/examples/peripherals/can/can_alert_and_recovery/CMakeLists.txt index 4d4838176f..cbe58fcb0f 100644 --- a/examples/peripherals/can/can_alert_and_recovery/CMakeLists.txt +++ b/examples/peripherals/can/can_alert_and_recovery/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(can_alert_and_recovery_example) diff --git a/examples/peripherals/can/can_alert_and_recovery/example_test.py b/examples/peripherals/can/can_alert_and_recovery/example_test.py index 403e056b28..911cebb32f 100644 --- a/examples/peripherals/can/can_alert_and_recovery/example_test.py +++ b/examples/peripherals/can/can_alert_and_recovery/example_test.py @@ -6,6 +6,7 @@ import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # The test cause is dependent on the Tiny Test Framework. Ensure the # `TEST_FW_PATH` environment variable is set to `$IDF_PATH/tools/tiny-test-fw` @@ -21,8 +22,7 @@ EXPECT_TIMEOUT = 20 @IDF.idf_example_test(env_tag='Example_CAN1', ignore=True) def test_can_alert_and_recovery_example(env, extra_data): - # Get device under test, flash and start example. "dut4" must be defined in EnvConfig - dut = env.get_dut('dut1', 'examples/peripherals/can/can_alert_and_recovery') + dut = env.get_dut('dut1', 'examples/peripherals/can/can_alert_and_recovery', dut_class=ESP32DUT) dut.start_app() for string in STR_EXPECT: diff --git a/examples/peripherals/can/can_network/can_network_listen_only/CMakeLists.txt b/examples/peripherals/can/can_network/can_network_listen_only/CMakeLists.txt index 42617e10ff..c5b0c8d4a5 100644 --- a/examples/peripherals/can/can_network/can_network_listen_only/CMakeLists.txt +++ b/examples/peripherals/can/can_network/can_network_listen_only/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(can_network_listen_only) diff --git a/examples/peripherals/can/can_network/can_network_master/CMakeLists.txt b/examples/peripherals/can/can_network/can_network_master/CMakeLists.txt index 33ac7b660b..e440673224 100644 --- a/examples/peripherals/can/can_network/can_network_master/CMakeLists.txt +++ b/examples/peripherals/can/can_network/can_network_master/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(can_network_master) diff --git a/examples/peripherals/can/can_network/can_network_slave/CMakeLists.txt b/examples/peripherals/can/can_network/can_network_slave/CMakeLists.txt index 1550db1564..6c5137f0f8 100644 --- a/examples/peripherals/can/can_network/can_network_slave/CMakeLists.txt +++ b/examples/peripherals/can/can_network/can_network_slave/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(can_network_slave) diff --git a/examples/peripherals/can/can_network/example_test.py b/examples/peripherals/can/can_network/example_test.py index b0ccf854a4..8c66f89f82 100644 --- a/examples/peripherals/can/can_network/example_test.py +++ b/examples/peripherals/can/can_network/example_test.py @@ -6,6 +6,7 @@ import sys from threading import Thread try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # The test cause is dependent on the Tiny Test Framework. Ensure the # `TEST_FW_PATH` environment variable is set to `$IDF_PATH/tools/tiny-test-fw` @@ -40,9 +41,9 @@ def dut_thread_callback(**kwargs): def test_can_network_example(env, extra_data): # Get device under test. "dut1", "dut2", and "dut3" must be properly defined in EnvConfig - dut_master = env.get_dut("dut1", "examples/peripherals/can/can_network/can_network_master") - dut_slave = env.get_dut("dut2", "examples/peripherals/can/can_network/can_network_slave") - dut_listen_only = env.get_dut("dut3", "examples/peripherals/can/can_network/can_network_listen_only") + dut_master = env.get_dut("dut1", "examples/peripherals/can/can_network/can_network_master", dut_class=ESP32DUT) + dut_slave = env.get_dut("dut2", "examples/peripherals/can/can_network/can_network_slave", dut_class=ESP32DUT) + dut_listen_only = env.get_dut("dut3", "examples/peripherals/can/can_network/can_network_listen_only", dut_class=ESP32DUT) # Flash app onto each DUT, each DUT is reset again at the start of each thread dut_master.start_app() diff --git a/examples/peripherals/can/can_self_test/CMakeLists.txt b/examples/peripherals/can/can_self_test/CMakeLists.txt index 027060e221..216e8edf50 100644 --- a/examples/peripherals/can/can_self_test/CMakeLists.txt +++ b/examples/peripherals/can/can_self_test/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(can_self_test_example) diff --git a/examples/peripherals/can/can_self_test/example_test.py b/examples/peripherals/can/can_self_test/example_test.py index 20f1727688..4cad759206 100644 --- a/examples/peripherals/can/can_self_test/example_test.py +++ b/examples/peripherals/can/can_self_test/example_test.py @@ -5,6 +5,7 @@ import os import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # The test cause is dependent on the Tiny Test Framework. Ensure the # `TEST_FW_PATH` environment variable is set to `$IDF_PATH/tools/tiny-test-fw` @@ -22,7 +23,7 @@ EXPECT_TIMEOUT = 20 @IDF.idf_example_test(env_tag='Example_CAN1', ignore=True) def test_can_self_test_example(env, extra_data): # Get device under test, flash and start example. "dut4" must be defined in EnvConfig - dut = env.get_dut('dut1', 'examples/peripherals/can/can_self_test') + dut = env.get_dut('dut1', 'examples/peripherals/can/can_self_test', dut_class=ESP32DUT) dut.start_app() for string in STR_EXPECT: diff --git a/examples/peripherals/i2c/i2c_self_test/README.md b/examples/peripherals/i2c/i2c_self_test/README.md index 66f64c2ffc..f8d7f6a1a4 100644 --- a/examples/peripherals/i2c/i2c_self_test/README.md +++ b/examples/peripherals/i2c/i2c_self_test/README.md @@ -24,19 +24,19 @@ To run this example, you should have one ESP32 dev board (e.g. ESP32-WROVER Kit) | | SDA | SCL | | ---------------- | ------ | ------ | | ESP32 I2C Master | GPIO18 | GPIO19 | -| ESP32 I2C Slave | GPIO25 | GPIO26 | +| ESP32 I2C Slave | GPIO4 | GPIO5 | | BH1750 Sensor | SDA | SCL | - slave: - - GPIO25 is assigned as the data signal of I2C slave port - - GPIO26 is assigned as the clock signal of I2C slave port + - GPIO4 is assigned as the data signal of I2C slave port + - GPIO5 is assigned as the clock signal of I2C slave port - master: - GPIO18 is assigned as the data signal of I2C master port - GPIO19 is assigned as the clock signal of I2C master port - Connection: - - connect GPIO18 with GPIO25 - - connect GPIO19 with GPIO26 + - connect GPIO18 with GPIO4 + - connect GPIO19 with GPIO5 - connect SDA/SCL of BH1750 sensor with GPIO18/GPIO19 **Note: ** There’s no need to add an external pull-up resistors for SDA/SCL pin, because the driver will enable the internal pull-up resistors. diff --git a/examples/peripherals/i2c/i2c_self_test/main/Kconfig.projbuild b/examples/peripherals/i2c/i2c_self_test/main/Kconfig.projbuild index 22cd216e93..bcd1c3fcfd 100644 --- a/examples/peripherals/i2c/i2c_self_test/main/Kconfig.projbuild +++ b/examples/peripherals/i2c/i2c_self_test/main/Kconfig.projbuild @@ -29,13 +29,13 @@ menu "Example Configuration" menu "I2C Slave" config I2C_SLAVE_SCL int "SCL GPIO Num" - default 26 + default 5 help GPIO number for I2C Slave clock line. config I2C_SLAVE_SDA int "SDA GPIO Num" - default 25 + default 4 help GPIO number for I2C Slave data line. diff --git a/examples/peripherals/i2c/i2c_tools/CMakeLists.txt b/examples/peripherals/i2c/i2c_tools/CMakeLists.txt index 53f2a254f2..7fd3cf67e0 100644 --- a/examples/peripherals/i2c/i2c_tools/CMakeLists.txt +++ b/examples/peripherals/i2c/i2c_tools/CMakeLists.txt @@ -4,5 +4,6 @@ cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/system/console/components) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(i2c-tools) diff --git a/examples/peripherals/i2c/i2c_tools/example_test.py b/examples/peripherals/i2c/i2c_tools/example_test.py index a42a0f0740..0f0c2271d5 100644 --- a/examples/peripherals/i2c/i2c_tools/example_test.py +++ b/examples/peripherals/i2c/i2c_tools/example_test.py @@ -6,6 +6,7 @@ EXPECT_TIMEOUT = 20 try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: test_fw_path = os.getenv("TEST_FW_PATH") if test_fw_path and test_fw_path not in sys.path: @@ -16,7 +17,7 @@ except ImportError: @IDF.idf_example_test(env_tag='Example_I2C_CCS811_SENSOR') def test_i2ctools_example(env, extra_data): # Get device under test, flash and start example. "i2ctool" must be defined in EnvConfig - dut = env.get_dut('i2ctools', 'examples/peripherals/i2c/i2c_tools') + dut = env.get_dut('i2ctools', 'examples/peripherals/i2c/i2c_tools', dut_class=ESP32DUT) dut.start_app() dut.expect("esp32>", timeout=EXPECT_TIMEOUT) # Get i2c address diff --git a/examples/peripherals/i2s/CMakeLists.txt b/examples/peripherals/i2s/CMakeLists.txt index 19c5f88308..8edbb54901 100644 --- a/examples/peripherals/i2s/CMakeLists.txt +++ b/examples/peripherals/i2s/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp32-i2s-driver-example) diff --git a/examples/peripherals/i2s/README.md b/examples/peripherals/i2s/README.md index 11c881dfa6..37d51437f1 100644 --- a/examples/peripherals/i2s/README.md +++ b/examples/peripherals/i2s/README.md @@ -53,9 +53,9 @@ If you have a logic analyzer, you can use a logic analyzer to grab online data. | pin name| function | gpio_num | |:---:|:---:|:---:| -| WS |word select| GPIO_NUM_25 | -| SCK |continuous serial clock| GPIO_NUM_26 | -| SD |serial data| GPIO_NUM_22 | +| WS |word select| GPIO_NUM_15 | +| SCK |continuous serial clock| GPIO_NUM_13 | +| SD |serial data| GPIO_NUM_21 | ## Troubleshooting diff --git a/examples/peripherals/i2s/main/i2s_example_main.c b/examples/peripherals/i2s/main/i2s_example_main.c index 04c90261df..18c66e34c5 100644 --- a/examples/peripherals/i2s/main/i2s_example_main.c +++ b/examples/peripherals/i2s/main/i2s_example_main.c @@ -21,9 +21,9 @@ #define I2S_NUM (0) #define WAVE_FREQ_HZ (100) #define PI (3.14159265) -#define I2S_BCK_IO (GPIO_NUM_26) -#define I2S_WS_IO (GPIO_NUM_25) -#define I2S_DO_IO (GPIO_NUM_22) +#define I2S_BCK_IO (GPIO_NUM_13) +#define I2S_WS_IO (GPIO_NUM_15) +#define I2S_DO_IO (GPIO_NUM_21) #define I2S_DI_IO (-1) #define SAMPLE_PER_CYCLE (SAMPLE_RATE/WAVE_FREQ_HZ) diff --git a/examples/peripherals/i2s_adc_dac/CMakeLists.txt b/examples/peripherals/i2s_adc_dac/CMakeLists.txt index 4b27d7cd68..4d8f5ef280 100644 --- a/examples/peripherals/i2s_adc_dac/CMakeLists.txt +++ b/examples/peripherals/i2s_adc_dac/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(i2s-adc-dac) diff --git a/examples/peripherals/ledc/main/ledc_example_main.c b/examples/peripherals/ledc/main/ledc_example_main.c index 88dbe6714e..97e3a07c6c 100644 --- a/examples/peripherals/ledc/main/ledc_example_main.c +++ b/examples/peripherals/ledc/main/ledc_example_main.c @@ -33,15 +33,22 @@ * GPIO4/5 are from low speed channel group. * */ +#ifdef CONFIG_IDF_TARGET_ESP32 #define LEDC_HS_TIMER LEDC_TIMER_0 #define LEDC_HS_MODE LEDC_HIGH_SPEED_MODE #define LEDC_HS_CH0_GPIO (18) #define LEDC_HS_CH0_CHANNEL LEDC_CHANNEL_0 #define LEDC_HS_CH1_GPIO (19) #define LEDC_HS_CH1_CHANNEL LEDC_CHANNEL_1 - +#endif #define LEDC_LS_TIMER LEDC_TIMER_1 #define LEDC_LS_MODE LEDC_LOW_SPEED_MODE +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA +#define LEDC_LS_CH0_GPIO (18) +#define LEDC_LS_CH0_CHANNEL LEDC_CHANNEL_0 +#define LEDC_LS_CH1_GPIO (19) +#define LEDC_LS_CH1_CHANNEL LEDC_CHANNEL_1 +#endif #define LEDC_LS_CH2_GPIO (4) #define LEDC_LS_CH2_CHANNEL LEDC_CHANNEL_2 #define LEDC_LS_CH3_GPIO (5) @@ -62,18 +69,18 @@ void app_main(void) ledc_timer_config_t ledc_timer = { .duty_resolution = LEDC_TIMER_13_BIT, // resolution of PWM duty .freq_hz = 5000, // frequency of PWM signal - .speed_mode = LEDC_HS_MODE, // timer mode - .timer_num = LEDC_HS_TIMER, // timer index + .speed_mode = LEDC_LS_MODE, // timer mode + .timer_num = LEDC_LS_TIMER, // timer index .clk_cfg = LEDC_AUTO_CLK, // Auto select the source clock }; // Set configuration of timer0 for high speed channels ledc_timer_config(&ledc_timer); - +#ifdef CONFIG_IDF_TARGET_ESP32 // Prepare and set configuration of timer1 for low speed channels - ledc_timer.speed_mode = LEDC_LS_MODE; - ledc_timer.timer_num = LEDC_LS_TIMER; + ledc_timer.speed_mode = LEDC_HS_MODE; + ledc_timer.timer_num = LEDC_HS_TIMER; ledc_timer_config(&ledc_timer); - +#endif /* * Prepare individual configuration * for each channel of LED Controller @@ -88,6 +95,7 @@ void app_main(void) * will be the same */ ledc_channel_config_t ledc_channel[LEDC_TEST_CH_NUM] = { +#ifdef CONFIG_IDF_TARGET_ESP32 { .channel = LEDC_HS_CH0_CHANNEL, .duty = 0, @@ -104,6 +112,24 @@ void app_main(void) .hpoint = 0, .timer_sel = LEDC_HS_TIMER }, +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + { + .channel = LEDC_LS_CH0_CHANNEL, + .duty = 0, + .gpio_num = LEDC_LS_CH0_GPIO, + .speed_mode = LEDC_LS_MODE, + .hpoint = 0, + .timer_sel = LEDC_LS_TIMER + }, + { + .channel = LEDC_LS_CH1_CHANNEL, + .duty = 0, + .gpio_num = LEDC_LS_CH1_GPIO, + .speed_mode = LEDC_LS_MODE, + .hpoint = 0, + .timer_sel = LEDC_LS_TIMER + }, +#endif { .channel = LEDC_LS_CH2_CHANNEL, .duty = 0, diff --git a/examples/peripherals/mcpwm/mcpwm_basic_config/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_basic_config/CMakeLists.txt index 53eb976ea4..520e404889 100644 --- a/examples/peripherals/mcpwm/mcpwm_basic_config/CMakeLists.txt +++ b/examples/peripherals/mcpwm/mcpwm_basic_config/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mcpwm_basic_config) diff --git a/examples/peripherals/mcpwm/mcpwm_bldc_control/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_bldc_control/CMakeLists.txt index 10ed869e1b..67bb8beeaa 100644 --- a/examples/peripherals/mcpwm/mcpwm_bldc_control/CMakeLists.txt +++ b/examples/peripherals/mcpwm/mcpwm_bldc_control/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mcpwm_bldc_control_hall_sensor) diff --git a/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/CMakeLists.txt index a4baf8b40c..ee6ca0a972 100644 --- a/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/CMakeLists.txt +++ b/examples/peripherals/mcpwm/mcpwm_brushed_dc_control/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mcpwm_brushed_dc_control) diff --git a/examples/peripherals/mcpwm/mcpwm_servo_control/CMakeLists.txt b/examples/peripherals/mcpwm/mcpwm_servo_control/CMakeLists.txt index 524c0ec97c..dc9beaffbd 100644 --- a/examples/peripherals/mcpwm/mcpwm_servo_control/CMakeLists.txt +++ b/examples/peripherals/mcpwm/mcpwm_servo_control/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mcpwm_servo_control) diff --git a/examples/peripherals/pcnt/CMakeLists.txt b/examples/peripherals/pcnt/CMakeLists.txt index 8f9d35a794..6858785c80 100644 --- a/examples/peripherals/pcnt/CMakeLists.txt +++ b/examples/peripherals/pcnt/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(pcnt) diff --git a/examples/peripherals/pcnt/main/pcnt_example_main.c b/examples/peripherals/pcnt/main/pcnt_example_main.c index a8d1fb32d7..7a298e6cea 100644 --- a/examples/peripherals/pcnt/main/pcnt_example_main.c +++ b/examples/peripherals/pcnt/main/pcnt_example_main.c @@ -96,7 +96,7 @@ static void ledc_init(void) { // Prepare and then apply the LEDC PWM timer configuration ledc_timer_config_t ledc_timer; - ledc_timer.speed_mode = LEDC_HIGH_SPEED_MODE; + ledc_timer.speed_mode = LEDC_LOW_SPEED_MODE; ledc_timer.timer_num = LEDC_TIMER_1; ledc_timer.duty_resolution = LEDC_TIMER_10_BIT; ledc_timer.freq_hz = 1; // set output frequency at 1 Hz @@ -105,7 +105,7 @@ static void ledc_init(void) // Prepare and then apply the LEDC PWM channel configuration ledc_channel_config_t ledc_channel; - ledc_channel.speed_mode = LEDC_HIGH_SPEED_MODE; + ledc_channel.speed_mode = LEDC_LOW_SPEED_MODE; ledc_channel.channel = LEDC_CHANNEL_1; ledc_channel.timer_sel = LEDC_TIMER_1; ledc_channel.intr_type = LEDC_INTR_DISABLE; @@ -188,19 +188,19 @@ void app_main(void) if (res == pdTRUE) { pcnt_get_counter_value(PCNT_TEST_UNIT, &count); printf("Event PCNT unit[%d]; cnt: %d\n", evt.unit, count); - if (evt.status & PCNT_STATUS_THRES1_M) { + if (evt.status & PCNT_EVT_THRES_1) { printf("THRES1 EVT\n"); } - if (evt.status & PCNT_STATUS_THRES0_M) { + if (evt.status & PCNT_EVT_THRES_0) { printf("THRES0 EVT\n"); } - if (evt.status & PCNT_STATUS_L_LIM_M) { + if (evt.status & PCNT_EVT_L_LIM) { printf("L_LIM EVT\n"); } - if (evt.status & PCNT_STATUS_H_LIM_M) { + if (evt.status & PCNT_EVT_H_LIM) { printf("H_LIM EVT\n"); } - if (evt.status & PCNT_STATUS_ZERO_M) { + if (evt.status & PCNT_EVT_ZERO) { printf("ZERO EVT\n"); } } else { diff --git a/examples/peripherals/sdio/host/CMakeLists.txt b/examples/peripherals/sdio/host/CMakeLists.txt index fb1d9a33ef..a3ab5fba96 100644 --- a/examples/peripherals/sdio/host/CMakeLists.txt +++ b/examples/peripherals/sdio/host/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sdio_host) diff --git a/examples/peripherals/sdio/sdio_test.py b/examples/peripherals/sdio/sdio_test.py index 8361dc3c86..0fa8b2979f 100644 --- a/examples/peripherals/sdio/sdio_test.py +++ b/examples/peripherals/sdio/sdio_test.py @@ -27,6 +27,7 @@ except ImportError: import TinyFW import IDF +from IDF.IDFDUT import ESP32DUT @IDF.idf_example_test(env_tag="Example_SDIO", ignore=True) @@ -49,8 +50,8 @@ def test_example_sdio_communication(env, extra_data): or use sdio test board, which has two wrover modules connect to a same FT3232 Assume that first dut is host and second is slave """ - dut1 = env.get_dut("sdio_host", "examples/peripherals/sdio/host") - dut2 = env.get_dut("sdio_slave", "examples/peripherals/sdio/slave") + dut1 = env.get_dut("sdio_host", "examples/peripherals/sdio/host", dut_class=ESP32DUT) + dut2 = env.get_dut("sdio_slave", "examples/peripherals/sdio/slave", dut_class=ESP32DUT) dut1.start_app() # wait until the master is ready to setup the slave dut1.expect("host ready, start initializing slave...") diff --git a/examples/peripherals/sdio/slave/CMakeLists.txt b/examples/peripherals/sdio/slave/CMakeLists.txt index c994453977..2f2080d041 100644 --- a/examples/peripherals/sdio/slave/CMakeLists.txt +++ b/examples/peripherals/sdio/slave/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sdio_slave) diff --git a/examples/peripherals/spi_master/main/CMakeLists.txt b/examples/peripherals/spi_master/main/CMakeLists.txt index 6d1a795b48..d0f93ab576 100644 --- a/examples/peripherals/spi_master/main/CMakeLists.txt +++ b/examples/peripherals/spi_master/main/CMakeLists.txt @@ -1,5 +1,13 @@ -idf_component_register(SRCS "decode_image.c" - "pretty_effect.c" - "spi_master_example_main.c" +set(srcs "pretty_effect.c" + "spi_master_example_main.c" + ) + +# Only ESP32 has enough memory to do jpeg decoding +if(IDF_TARGET STREQUAL "esp32") + list(APPEND srcs "decode_image.c") +endif() + +idf_component_register(SRCS ${srcs} INCLUDE_DIRS "." - EMBED_FILES image.jpg) \ No newline at end of file + EMBED_FILES image.jpg) + diff --git a/examples/peripherals/spi_master/main/pretty_effect.c b/examples/peripherals/spi_master/main/pretty_effect.c index 56903a38c7..96ef58e784 100644 --- a/examples/peripherals/spi_master/main/pretty_effect.c +++ b/examples/peripherals/spi_master/main/pretty_effect.c @@ -11,6 +11,9 @@ #include #include "pretty_effect.h" +#include "sdkconfig.h" + +#ifdef CONFIG_IDF_TARGET_ESP32 #include "decode_image.h" uint16_t **pixels; @@ -23,6 +26,13 @@ static inline uint16_t get_bgnd_pixel(int x, int y) y+=8; return pixels[y][x]; } +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA +//esp32s2beta doesn't have enough memory to hold the decoded image, calculate instead +static inline uint16_t get_bgnd_pixel(int x, int y) +{ + return ((x<<3)^(y<<3)^(x*y)); +} +#endif //This variable is used to detect the next frame. @@ -55,7 +65,12 @@ void pretty_effect_calc_lines(uint16_t *dest, int line, int frame, int linect) } -esp_err_t pretty_effect_init(void) +esp_err_t pretty_effect_init(void) { +#ifdef CONFIG_IDF_TARGET_ESP32 return decode_image(&pixels); +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA + //esp32s2beta doesn't have enough memory to hold the decoded image, calculate instead + return ESP_OK; +#endif } diff --git a/examples/peripherals/spi_master/main/spi_master_example_main.c b/examples/peripherals/spi_master/main/spi_master_example_main.c index 0e4cea3457..eda88fcf73 100644 --- a/examples/peripherals/spi_master/main/spi_master_example_main.c +++ b/examples/peripherals/spi_master/main/spi_master_example_main.c @@ -28,6 +28,10 @@ before the transaction is sent, the callback will set this line to the correct state. */ +#ifdef CONFIG_IDF_TARGET_ESP32 +#define LCD_HOST HSPI_HOST +#define DMA_CHAN 2 + #define PIN_NUM_MISO 25 #define PIN_NUM_MOSI 23 #define PIN_NUM_CLK 19 @@ -36,6 +40,19 @@ #define PIN_NUM_DC 21 #define PIN_NUM_RST 18 #define PIN_NUM_BCKL 5 +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA +#define LCD_HOST SPI2_HOST +#define DMA_CHAN LCD_HOST + +#define PIN_NUM_MISO 37 +#define PIN_NUM_MOSI 35 +#define PIN_NUM_CLK 36 +#define PIN_NUM_CS 34 + +#define PIN_NUM_DC 4 +#define PIN_NUM_RST 5 +#define PIN_NUM_BCKL 6 +#endif //To speed up transfers, every SPI transfer sends a bunch of lines. This define specifies how many. More means more memory use, //but less overhead for setting up / finishing transfers. Make sure 240 is dividable by this. @@ -410,10 +427,10 @@ void app_main(void) .pre_cb=lcd_spi_pre_transfer_callback, //Specify pre-transfer callback to handle D/C line }; //Initialize the SPI bus - ret=spi_bus_initialize(HSPI_HOST, &buscfg, 1); + ret=spi_bus_initialize(LCD_HOST, &buscfg, DMA_CHAN); ESP_ERROR_CHECK(ret); //Attach the LCD to the SPI bus - ret=spi_bus_add_device(HSPI_HOST, &devcfg, &spi); + ret=spi_bus_add_device(LCD_HOST, &devcfg, &spi); ESP_ERROR_CHECK(ret); //Initialize the LCD lcd_init(spi); diff --git a/examples/peripherals/spi_slave/receiver/main/app_main.c b/examples/peripherals/spi_slave/receiver/main/app_main.c index cd01465d86..d602b58932 100644 --- a/examples/peripherals/spi_slave/receiver/main/app_main.c +++ b/examples/peripherals/spi_slave/receiver/main/app_main.c @@ -55,6 +55,17 @@ Pins in use. The SPI Master can use the GPIO mux, so feel free to change these i #define GPIO_SCLK 15 #define GPIO_CS 14 +#ifdef CONFIG_IDF_TARGET_ESP32 +#define RCV_HOST HSPI_HOST +#define DMA_CHAN 2 + +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA +#define RCV_HOST SPI2_HOST +#define DMA_CHAN RCV_HOST + +#endif + + //Called after a transaction is queued and ready for pickup by master. We use this to set the handshake line high. void my_post_setup_cb(spi_slave_transaction_t *trans) { @@ -76,7 +87,9 @@ void app_main(void) spi_bus_config_t buscfg={ .mosi_io_num=GPIO_MOSI, .miso_io_num=GPIO_MISO, - .sclk_io_num=GPIO_SCLK + .sclk_io_num=GPIO_SCLK, + .quadwp_io_num = -1, + .quadhd_io_num = -1, }; //Configuration for the SPI slave interface @@ -104,7 +117,7 @@ void app_main(void) gpio_set_pull_mode(GPIO_CS, GPIO_PULLUP_ONLY); //Initialize SPI slave interface - ret=spi_slave_initialize(HSPI_HOST, &buscfg, &slvcfg, 1); + ret=spi_slave_initialize(RCV_HOST, &buscfg, &slvcfg, DMA_CHAN); assert(ret==ESP_OK); WORD_ALIGNED_ATTR char sendbuf[129]=""; @@ -128,7 +141,7 @@ void app_main(void) .post_setup_cb callback that is called as soon as a transaction is ready, to let the master know it is free to transfer data. */ - ret=spi_slave_transmit(HSPI_HOST, &t, portMAX_DELAY); + ret=spi_slave_transmit(RCV_HOST, &t, portMAX_DELAY); //spi_slave_transmit does not return until the master has done a transmission, so by here we have sent our data and //received data from the master. Print it. diff --git a/examples/peripherals/spi_slave/sender/main/app_main.c b/examples/peripherals/spi_slave/sender/main/app_main.c index c3a8007c7d..531421b7ec 100644 --- a/examples/peripherals/spi_slave/sender/main/app_main.c +++ b/examples/peripherals/spi_slave/sender/main/app_main.c @@ -56,6 +56,17 @@ Pins in use. The SPI Master can use the GPIO mux, so feel free to change these i #define GPIO_SCLK 15 #define GPIO_CS 14 +#ifdef CONFIG_IDF_TARGET_ESP32 +#define SENDER_HOST HSPI_HOST +#define DMA_CHAN 2 + +#elif defined CONFIG_IDF_TARGET_ESP32S2BETA +#define SENDER_HOST SPI2_HOST +#define DMA_CHAN SENDER_HOST + +#endif + + //The semaphore indicating the slave is ready to receive stuff. static xQueueHandle rdySem; @@ -130,9 +141,9 @@ void app_main(void) gpio_isr_handler_add(GPIO_HANDSHAKE, gpio_handshake_isr_handler, NULL); //Initialize the SPI bus and add the device we want to send stuff to. - ret=spi_bus_initialize(HSPI_HOST, &buscfg, 1); + ret=spi_bus_initialize(SENDER_HOST, &buscfg, DMA_CHAN); assert(ret==ESP_OK); - ret=spi_bus_add_device(HSPI_HOST, &devcfg, &handle); + ret=spi_bus_add_device(SENDER_HOST, &devcfg, &handle); assert(ret==ESP_OK); //Assume the slave is ready for the first transmission: if the slave started up before us, we will not detect diff --git a/examples/peripherals/temp_sensor_esp32s2/CMakeLists.txt b/examples/peripherals/temp_sensor_esp32s2/CMakeLists.txt new file mode 100644 index 0000000000..61bb8c9c57 --- /dev/null +++ b/examples/peripherals/temp_sensor_esp32s2/CMakeLists.txt @@ -0,0 +1,6 @@ +# The following lines of boilerplate have to be in your project's CMakeLists +# in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(temp_sensor_esp32s2) diff --git a/examples/peripherals/temp_sensor_esp32s2/Makefile b/examples/peripherals/temp_sensor_esp32s2/Makefile new file mode 100644 index 0000000000..fb95185800 --- /dev/null +++ b/examples/peripherals/temp_sensor_esp32s2/Makefile @@ -0,0 +1,9 @@ +# +# This is a project Makefile. It is assumed the directory this Makefile resides in is a +# project subdirectory. +# + +PROJECT_NAME := temp_sensor_esp32s2 + +include $(IDF_PATH)/make/project.mk + diff --git a/examples/peripherals/temp_sensor_esp32s2/README.md b/examples/peripherals/temp_sensor_esp32s2/README.md new file mode 100644 index 0000000000..3b6e22535a --- /dev/null +++ b/examples/peripherals/temp_sensor_esp32s2/README.md @@ -0,0 +1,27 @@ +# ESP32-S2 Temperature Sensor Example + +The ESP32-S2 has a built-in temperature sensor. The temperature sensor module contains an 8-bit Sigma-Delta ADC and a temperature offset DAC. + +The conversion relationship is the first two columns of the table below. Among them, `offset = 0`(default) is the main measurement option, and other values are extended measurement options. + +DAC level | offset | measure range(℃) | measure error(℃) + :-: | :-: | :-: | :-: + 0 | -2 | 50 ~ 125 | < 3 + 1 | -1 | 20 ~ 100 | < 2 + 2 | 0 | -10 ~ 80 | < 1 + 3 | 1 | -30 ~ 50 | < 2 + 4 | 2 | -40 ~ 20 | < 3 + +* Log output : + +``` +I (243) TempSensor: Initializing Temperature sensor +I (243) TempSensor: default dac 2, clk_div 6 +I (243) TempSensor: Config temperature range [-10°C ~ 80°C], error < 1°C +I (253) TempSensor: Temperature sensor started +I (1253) TempSensor: Temperature out celsius 27.287399°C +I (2253) TempSensor: Temperature out celsius 26.848801°C +I (3253) TempSensor: Temperature out celsius 26.848801°C +I (4253) TempSensor: Temperature out celsius 27.287399°C +I (5253) TempSensor: Temperature out celsius 27.287399°C +``` \ No newline at end of file diff --git a/examples/peripherals/temp_sensor_esp32s2/main/CMakeLists.txt b/examples/peripherals/temp_sensor_esp32s2/main/CMakeLists.txt new file mode 100644 index 0000000000..91425ac9f4 --- /dev/null +++ b/examples/peripherals/temp_sensor_esp32s2/main/CMakeLists.txt @@ -0,0 +1,4 @@ +set(COMPONENT_SRCS "temp_sensor_main.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() diff --git a/examples/peripherals/temp_sensor_esp32s2/main/component.mk b/examples/peripherals/temp_sensor_esp32s2/main/component.mk new file mode 100644 index 0000000000..0b9d7585e7 --- /dev/null +++ b/examples/peripherals/temp_sensor_esp32s2/main/component.mk @@ -0,0 +1,5 @@ +# +# "main" pseudo-component makefile. +# +# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) + diff --git a/examples/peripherals/temp_sensor_esp32s2/main/temp_sensor_main.c b/examples/peripherals/temp_sensor_esp32s2/main/temp_sensor_main.c new file mode 100644 index 0000000000..32e3bd40e7 --- /dev/null +++ b/examples/peripherals/temp_sensor_esp32s2/main/temp_sensor_main.c @@ -0,0 +1,54 @@ +/* Temperature Sensor Example + + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +#include +#include +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +/* Note: ESP32 don't support temperature sensor */ + +#if CONFIG_IDF_TARGET_ESP32S2BETA +#include "temp_sensor.h" + +static const char *TAG = "TempSensor"; + +void tempsensor_example(void *arg) +{ + // Initialize touch pad peripheral, it will start a timer to run a filter + ESP_LOGI(TAG, "Initializing Temperature sensor"); + float tsens_out; + temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT(); + temp_sensor_get_config(&temp_sensor); + ESP_LOGI(TAG, "default dac %d, clk_div %d", temp_sensor.dac_offset, temp_sensor.clk_div); + temp_sensor.dac_offset = TSENS_DAC_DEFAULT; // DEFAULT: range:-10℃ ~ 80℃, error < 1℃. + temp_sensor_set_config(temp_sensor); + temp_sensor_start(); + ESP_LOGI(TAG, "Temperature sensor started"); + while (1) { + vTaskDelay(1000 / portTICK_RATE_MS); + temp_sensor_read_celsius(&tsens_out); + ESP_LOGI(TAG, "Temperature out celsius %f°C", tsens_out); + } + vTaskDelete(NULL); +} + +void app_main(void) +{ + xTaskCreate(tempsensor_example, "temp", 2048, NULL, 5, NULL); +} + +#elif CONFIG_IDF_TARGET_ESP32 + +void app_main(void) +{ + printf("ESP32 don't support temperature sensor\n"); +} + +#endif diff --git a/examples/peripherals/timer_group/CMakeLists.txt b/examples/peripherals/timer_group/CMakeLists.txt index 247819ef30..989d76a457 100644 --- a/examples/peripherals/timer_group/CMakeLists.txt +++ b/examples/peripherals/timer_group/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(timer_group) diff --git a/examples/peripherals/timer_group/main/timer_group_example_main.c b/examples/peripherals/timer_group/main/timer_group_example_main.c index cd1e8cdee8..4f568ac679 100644 --- a/examples/peripherals/timer_group/main/timer_group_example_main.c +++ b/examples/peripherals/timer_group/main/timer_group_example_main.c @@ -6,7 +6,6 @@ software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ - #include #include "esp_types.h" #include "freertos/FreeRTOS.h" @@ -110,6 +109,9 @@ static void example_tg0_timer_init(int timer_idx, config.alarm_en = TIMER_ALARM_EN; config.intr_type = TIMER_INTR_LEVEL; config.auto_reload = auto_reload; +#ifdef CONFIG_IDF_TARGET_ESP32S2BETA + config.clk_sel = TIMER_SRC_CLK_APB; +#endif timer_init(TIMER_GROUP_0, timer_idx, &config); /* Timer's counter will initially start from value below. diff --git a/examples/peripherals/touch_pad_interrupt/main/CMakeLists.txt b/examples/peripherals/touch_pad_interrupt/main/CMakeLists.txt index df4240c344..61af5d42a0 100644 --- a/examples/peripherals/touch_pad_interrupt/main/CMakeLists.txt +++ b/examples/peripherals/touch_pad_interrupt/main/CMakeLists.txt @@ -1,2 +1,2 @@ -idf_component_register(SRCS "tp_interrupt_main.c" - INCLUDE_DIRS ".") \ No newline at end of file +idf_component_register(SRCS "${CONFIG_IDF_TARGET}/tp_interrupt_main.c" + INCLUDE_DIRS ".") diff --git a/examples/peripherals/touch_pad_interrupt/main/component.mk b/examples/peripherals/touch_pad_interrupt/main/component.mk index 0b9d7585e7..c6ea8a0a5a 100644 --- a/examples/peripherals/touch_pad_interrupt/main/component.mk +++ b/examples/peripherals/touch_pad_interrupt/main/component.mk @@ -3,3 +3,4 @@ # # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) +COMPONENT_SRCDIRS := $(IDF_TARGET) \ No newline at end of file diff --git a/examples/peripherals/touch_pad_interrupt/main/tp_interrupt_main.c b/examples/peripherals/touch_pad_interrupt/main/esp32/tp_interrupt_main.c similarity index 95% rename from examples/peripherals/touch_pad_interrupt/main/tp_interrupt_main.c rename to examples/peripherals/touch_pad_interrupt/main/esp32/tp_interrupt_main.c index 7b3f244ce5..76552239d9 100644 --- a/examples/peripherals/touch_pad_interrupt/main/tp_interrupt_main.c +++ b/examples/peripherals/touch_pad_interrupt/main/esp32/tp_interrupt_main.c @@ -9,13 +9,15 @@ #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "freertos/queue.h" #include "esp_log.h" #include "driver/touch_pad.h" #include "soc/rtc_periph.h" #include "soc/sens_periph.h" -static const char* TAG = "Touch pad"; +static const char *TAG = "Touch pad"; + #define TOUCH_THRESH_NO_USE (0) #define TOUCH_THRESH_PERCENT (80) #define TOUCHPAD_FILTER_TOUCH_PERIOD (10) @@ -35,7 +37,7 @@ static uint32_t s_pad_init_val[TOUCH_PAD_MAX]; static void tp_example_set_thresholds(void) { uint16_t touch_value; - for (int i = 0; i +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "freertos/queue.h" +#include "esp_log.h" + +#include "driver/touch_pad.h" +#include "soc/rtc_periph.h" +#include "soc/sens_periph.h" + +static const char *TAG = "Touch pad"; + +static QueueHandle_t que_touch = NULL; +typedef struct touch_msg { + touch_pad_intr_mask_t intr_mask; + uint32_t pad_num; + uint32_t pad_status; + uint32_t pad_val; +} touch_event_t; + +#define TOUCH_BUTTON_NUM 4 +#define TOUCH_BUTTON_WATERPROOF_ENABLE 1 +#define TOUCH_BUTTON_DENOISE_ENABLE 1 + +static const touch_pad_t button[TOUCH_BUTTON_NUM] = { + TOUCH_PAD_NUM7, // 'SELECT' button. + TOUCH_PAD_NUM9, // 'MENU' button. + TOUCH_PAD_NUM11, // 'BACK' button. + TOUCH_PAD_NUM13, // Guard ring for waterproof design. + // if this pad be touched, other pads no response. +}; + +/* + * Touch threshold. The threshold determines the sensitivity of the touch. + * This threshold is derived by testing changes in readings from different touch channels. + * If (raw_data - baseline) > baseline * threshold, the pad be actived. + * If (raw_data - baseline) < baseline * threshold, the pad be inactived. + */ +static const float button_threshold[TOUCH_BUTTON_NUM] = { + 0.2, // 20%. + 0.2, // 20%. + 0.2, // 20%. + 0.1, // 10%. +}; + +/* + Handle an interrupt triggered when a pad is touched. + Recognize what pad has been touched and save it in a table. + */ +static void touchsensor_interrupt_cb(void *arg) +{ + int task_awoken = pdFALSE; + touch_event_t evt; + + evt.intr_mask = touch_pad_intr_status_get_mask(); + evt.pad_status = touch_pad_get_status(); + evt.pad_num = touch_pad_get_scan_curr(); + + if (evt.intr_mask & TOUCH_PAD_INTR_MASK_DONE) { + touch_pad_filter_baseline_read(evt.pad_num, &evt.pad_val); + } + xQueueSendFromISR(que_touch, &evt, &task_awoken); + if (task_awoken == pdTRUE) { + portYIELD_FROM_ISR(); + } +} + +static void tp_example_set_thresholds(void) +{ + uint32_t touch_value; + for (int i = 0; i < TOUCH_BUTTON_NUM; i++) { + //read baseline value + touch_pad_read_raw_data(button[i], &touch_value); + //set interrupt threshold. + touch_pad_set_thresh(button[i], touch_value * button_threshold[i]); + ESP_LOGI(TAG, "test init: touch pad [%d] base %d, thresh %d", \ + button[i], touch_value, (uint32_t)(touch_value * button_threshold[i])); + } +} + +static void touchsensor_filter_set(touch_filter_mode_t mode) +{ + /* Filter function */ + touch_filter_config_t filter_info = { + .mode = mode, // Test jitter and filter 1/4. + .debounce_cnt = 1, // 1 time count. + .hysteresis_thr = 1, // 9.4% + .noise_thr = 1, // 37.5% + .noise_neg_thr = 1, // 37.5% + .neg_noise_limit = 10, // 10 time count. + .jitter_step = 4, // use for jitter mode. + }; + touch_pad_filter_set_config(&filter_info); + touch_pad_filter_enable(); + touch_pad_filter_baseline_reset(TOUCH_PAD_MAX); + ESP_LOGI(TAG, "touch pad filter init %d", mode); +} + +static void tp_example_read_task(void *pvParameter) +{ + touch_event_t evt = {0}; + static uint8_t guard_mode_flag = 0; + /* Wait touch sensor init done */ + vTaskDelay(100 / portTICK_RATE_MS); + tp_example_set_thresholds(); + + while (1) { + int ret = xQueueReceive(que_touch, &evt, (portTickType)portMAX_DELAY); + if (ret != pdTRUE) { + continue; + } + if (evt.intr_mask & TOUCH_PAD_INTR_MASK_ACTIVE) { + /* if guard pad be touched, other pads no response. */ + if (evt.pad_num == button[3]) { + guard_mode_flag = 1; + ESP_LOGW(TAG, "TouchSensor [%d] be actived, enter guard mode", evt.pad_num); + } else { + if (guard_mode_flag == 0) { + ESP_LOGI(TAG, "TouchSensor [%d] be actived, status mask 0x%x", evt.pad_num, evt.pad_status); + } else { + ESP_LOGW(TAG, "In guard mode. No response"); + } + } + } + if (evt.intr_mask & TOUCH_PAD_INTR_MASK_INACTIVE) { + /* if guard pad be touched, other pads no response. */ + if (evt.pad_num == button[3]) { + guard_mode_flag = 0; + ESP_LOGW(TAG, "TouchSensor [%d] be actived, exit guard mode", evt.pad_num); + } else { + if (guard_mode_flag == 0) { + ESP_LOGI(TAG, "TouchSensor [%d] be inactived, status mask 0x%x", evt.pad_num, evt.pad_status); + } + } + } + if (evt.intr_mask & TOUCH_PAD_INTR_MASK_DONE) { + ESP_LOGI(TAG, "TouchSensor [%d] measure done, raw data %d", evt.pad_num, evt.pad_val); + } + } +} + +void app_main(void) +{ + if (que_touch == NULL) { + que_touch = xQueueCreate(TOUCH_BUTTON_NUM, sizeof(touch_event_t)); + } + // Initialize touch pad peripheral, it will start a timer to run a filter + ESP_LOGI(TAG, "Initializing touch pad"); + /* Initialize touch pad peripheral. */ + touch_pad_init(); + for (int i = 0; i < TOUCH_BUTTON_NUM; i++) { + touch_pad_config(button[i]); + touch_pad_set_thresh(button[i], TOUCH_PAD_THRESHOLD_MAX); + } + +#if TOUCH_BUTTON_DENOISE_ENABLE + /* Denoise setting at TouchSensor 0. */ + touch_pad_denoise_t denoise = { + /* The bits to be cancelled are determined according to the noise level. */ + .grade = TOUCH_PAD_DENOISE_BIT4, + .cap_level = TOUCH_PAD_DENOISE_CAP_L7, + }; + touch_pad_denoise_set_config(denoise); + touch_pad_denoise_enable(); + ESP_LOGI(TAG, "Denoise function init"); +#endif + +#if TOUCH_BUTTON_WATERPROOF_ENABLE + /* Waterproof function */ + touch_pad_waterproof_t waterproof = { + .guard_ring_pad = button[3], // If no ring pad, set 0; + /* It depends on the number of the parasitic capacitance of the shield pad. */ + .shield_driver = TOUCH_PAD_SHIELD_DRV_L0, //40pf + }; + touch_pad_waterproof_set_config(waterproof); + touch_pad_waterproof_enable(); + ESP_LOGI(TAG, "touch pad waterproof init"); +#endif + + /* Filter setting */ + touchsensor_filter_set(TOUCH_PAD_FILTER_IIR_8); + /* Register touch interrupt ISR, enable intr type. */ + touch_pad_isr_register(touchsensor_interrupt_cb, NULL, TOUCH_PAD_INTR_MASK_ALL); + touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE); + // touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_DONE); // Use for debug + + /* Enable touch sensor clock. Work mode is "timer trigger". */ + touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); + touch_pad_fsm_start(); + + // Start a task to show what pads have been touched + xTaskCreate(&tp_example_read_task, "touch_pad_read_task", 2048, NULL, 5, NULL); +} diff --git a/examples/peripherals/touch_pad_read/main/CMakeLists.txt b/examples/peripherals/touch_pad_read/main/CMakeLists.txt index dad0c4905c..5514777109 100644 --- a/examples/peripherals/touch_pad_read/main/CMakeLists.txt +++ b/examples/peripherals/touch_pad_read/main/CMakeLists.txt @@ -1,2 +1,3 @@ -idf_component_register(SRCS "tp_read_main.c" - INCLUDE_DIRS ".") \ No newline at end of file +idf_component_register(SRCS "${CONFIG_IDF_TARGET}/tp_read_main.c" + INCLUDE_DIRS ".") + diff --git a/examples/peripherals/touch_pad_read/main/component.mk b/examples/peripherals/touch_pad_read/main/component.mk index 0b9d7585e7..c6ea8a0a5a 100644 --- a/examples/peripherals/touch_pad_read/main/component.mk +++ b/examples/peripherals/touch_pad_read/main/component.mk @@ -3,3 +3,4 @@ # # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) +COMPONENT_SRCDIRS := $(IDF_TARGET) \ No newline at end of file diff --git a/examples/peripherals/touch_pad_read/main/tp_read_main.c b/examples/peripherals/touch_pad_read/main/esp32/tp_read_main.c similarity index 99% rename from examples/peripherals/touch_pad_read/main/tp_read_main.c rename to examples/peripherals/touch_pad_read/main/esp32/tp_read_main.c index 3f442d7eb2..a3093b3982 100644 --- a/examples/peripherals/touch_pad_read/main/tp_read_main.c +++ b/examples/peripherals/touch_pad_read/main/esp32/tp_read_main.c @@ -10,6 +10,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/touch_pad.h" +#include "esp_log.h" #define TOUCH_PAD_NO_CHANGE (-1) #define TOUCH_THRESH_NO_USE (0) diff --git a/examples/peripherals/touch_pad_read/main/esp32s2beta/tp_read_main.c b/examples/peripherals/touch_pad_read/main/esp32s2beta/tp_read_main.c new file mode 100644 index 0000000000..d1b2bc97d3 --- /dev/null +++ b/examples/peripherals/touch_pad_read/main/esp32s2beta/tp_read_main.c @@ -0,0 +1,82 @@ +/* Touch Pad Read Example + + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "driver/touch_pad.h" +#include "esp_log.h" + +#define TOUCH_BUTTON_NUM 14 + +static const char * TAG = "touch read"; +static const touch_pad_t button[TOUCH_BUTTON_NUM] = { + TOUCH_PAD_NUM1, + TOUCH_PAD_NUM2, + TOUCH_PAD_NUM3, + TOUCH_PAD_NUM4, + TOUCH_PAD_NUM5, + TOUCH_PAD_NUM6, + TOUCH_PAD_NUM7, + TOUCH_PAD_NUM8, + TOUCH_PAD_NUM9, + TOUCH_PAD_NUM10, + TOUCH_PAD_NUM11, + TOUCH_PAD_NUM12, + TOUCH_PAD_NUM13, + TOUCH_PAD_NUM14 +}; + +/* + Read values sensed at all available touch pads. + Print out values in a loop on a serial monitor. + */ +static void tp_example_read_task(void *pvParameter) +{ + uint32_t touch_value; + + /* Wait touch sensor init done */ + vTaskDelay(100 / portTICK_RATE_MS); + printf("Touch Sensor read, the output format is: \nTouchpad num:[raw data]\n\n"); + + while (1) { + for (int i = 0; i < TOUCH_BUTTON_NUM; i++) { + touch_pad_read_raw_data(button[i], &touch_value); // read raw data. + printf("T%d: [%4d] ", button[i], touch_value); + } + printf("\n"); + vTaskDelay(200 / portTICK_PERIOD_MS); + } +} + +void app_main(void) +{ + /* Initialize touch pad peripheral. */ + touch_pad_init(); + for (int i = 0; i < TOUCH_BUTTON_NUM; i++) { + touch_pad_config(button[i]); + touch_pad_set_thresh(button[i], TOUCH_PAD_THRESHOLD_MAX); + } + + /* Denoise setting at TouchSensor 0. */ + touch_pad_denoise_t denoise = { + /* The bits to be cancelled are determined according to the noise level. */ + .grade = TOUCH_PAD_DENOISE_BIT4, + .cap_level = TOUCH_PAD_DENOISE_CAP_L7, + }; + touch_pad_denoise_set_config(denoise); + touch_pad_denoise_enable(); + ESP_LOGI(TAG, "Denoise function init"); + + /* Enable touch sensor clock. Work mode is "timer trigger". */ + touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); + touch_pad_fsm_start(); + + /* Start task to read values by pads. */ + xTaskCreate(&tp_example_read_task, "touch_pad_read_task", 2048, NULL, 5, NULL); +} diff --git a/examples/peripherals/uart/nmea0183_parser/main/nmea_parser.c b/examples/peripherals/uart/nmea0183_parser/main/nmea_parser.c index 0dc244afe2..89457e4921 100644 --- a/examples/peripherals/uart/nmea0183_parser/main/nmea_parser.c +++ b/examples/peripherals/uart/nmea0183_parser/main/nmea_parser.c @@ -699,7 +699,7 @@ nmea_parser_handle_t nmea_parser_init(const nmea_parser_config_t *config) goto err_uart_install; } /* Set pattern interrupt, used to detect the end of a line */ - uart_enable_pattern_det_intr(esp_gps->uart_port, '\n', 1, 10000, 10, 10); + uart_enable_pattern_det_baud_intr(esp_gps->uart_port, '\n', 1, 9, 0, 0); /* Set pattern queue size */ uart_pattern_queue_reset(esp_gps->uart_port, config->uart.event_queue_size); uart_flush(esp_gps->uart_port); diff --git a/examples/peripherals/uart/uart_echo_rs485/main/rs485_example.c b/examples/peripherals/uart/uart_echo_rs485/main/rs485_example.c index e2d53dac4d..f6577fba85 100644 --- a/examples/peripherals/uart/uart_echo_rs485/main/rs485_example.c +++ b/examples/peripherals/uart/uart_echo_rs485/main/rs485_example.c @@ -47,7 +47,7 @@ #define PACKET_READ_TICS (100 / portTICK_RATE_MS) #define ECHO_TASK_STACK_SIZE (2048) #define ECHO_TASK_PRIO (10) -#define ECHO_UART_PORT (UART_NUM_2) +#define ECHO_UART_PORT (UART_NUM_MAX - 1) static const char *TAG = "RS485_ECHO_APP"; diff --git a/examples/peripherals/uart/uart_events/main/uart_events_example_main.c b/examples/peripherals/uart/uart_events/main/uart_events_example_main.c index f749da0b14..e6d334712c 100644 --- a/examples/peripherals/uart/uart_events/main/uart_events_example_main.c +++ b/examples/peripherals/uart/uart_events/main/uart_events_example_main.c @@ -140,7 +140,7 @@ void app_main(void) uart_driver_install(EX_UART_NUM, BUF_SIZE * 2, BUF_SIZE * 2, 20, &uart0_queue, 0); //Set uart pattern detect function. - uart_enable_pattern_det_intr(EX_UART_NUM, '+', PATTERN_CHR_NUM, 10000, 10, 10); + uart_enable_pattern_det_baud_intr(EX_UART_NUM, '+', PATTERN_CHR_NUM, 9, 0, 0); //Reset the pattern queue length to record at most 20 pattern positions. uart_pattern_queue_reset(EX_UART_NUM, 20); diff --git a/examples/protocols/asio/chat_client/CMakeLists.txt b/examples/protocols/asio/chat_client/CMakeLists.txt index ddcc068ba8..38033d9431 100644 --- a/examples/protocols/asio/chat_client/CMakeLists.txt +++ b/examples/protocols/asio/chat_client/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(asio_chat_client) diff --git a/examples/protocols/asio/chat_client/asio_chat_client_test.py b/examples/protocols/asio/chat_client/asio_chat_client_test.py index 3b141c7d17..f5581796d1 100644 --- a/examples/protocols/asio/chat_client/asio_chat_client_test.py +++ b/examples/protocols/asio/chat_client/asio_chat_client_test.py @@ -7,6 +7,7 @@ import time try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -69,7 +70,7 @@ def test_examples_protocol_asio_chat_client(env, extra_data): global g_client_response global g_msg_to_client test_msg = "ABC" - dut1 = env.get_dut("chat_client", "examples/protocols/asio/chat_client") + dut1 = env.get_dut("chat_client", "examples/protocols/asio/chat_client", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "asio_chat_client.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/asio/chat_server/CMakeLists.txt b/examples/protocols/asio/chat_server/CMakeLists.txt index 182f8d4024..cd6a925f33 100644 --- a/examples/protocols/asio/chat_server/CMakeLists.txt +++ b/examples/protocols/asio/chat_server/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(asio_chat_server) diff --git a/examples/protocols/asio/chat_server/asio_chat_server_test.py b/examples/protocols/asio/chat_server/asio_chat_server_test.py index ea4702c4e8..5d53a89467 100644 --- a/examples/protocols/asio/chat_server/asio_chat_server_test.py +++ b/examples/protocols/asio/chat_server/asio_chat_server_test.py @@ -6,6 +6,7 @@ import socket try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -27,7 +28,7 @@ def test_examples_protocol_asio_chat_server(env, extra_data): 4. Test evaluates received test message from server """ test_msg = b" 4ABC\n" - dut1 = env.get_dut("chat_server", "examples/protocols/asio/chat_server") + dut1 = env.get_dut("chat_server", "examples/protocols/asio/chat_server", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "asio_chat_server.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/asio/tcp_echo_server/CMakeLists.txt b/examples/protocols/asio/tcp_echo_server/CMakeLists.txt index 6bf8f46825..cc906e36c7 100644 --- a/examples/protocols/asio/tcp_echo_server/CMakeLists.txt +++ b/examples/protocols/asio/tcp_echo_server/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(asio_tcp_echo_server) diff --git a/examples/protocols/asio/tcp_echo_server/asio_tcp_server_test.py b/examples/protocols/asio/tcp_echo_server/asio_tcp_server_test.py index 2cdfd45aee..aeb7faced5 100644 --- a/examples/protocols/asio/tcp_echo_server/asio_tcp_server_test.py +++ b/examples/protocols/asio/tcp_echo_server/asio_tcp_server_test.py @@ -6,6 +6,7 @@ import socket try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -29,7 +30,7 @@ def test_examples_protocol_asio_tcp_server(env, extra_data): 5. Test evaluates received test message on server stdout """ test_msg = b"echo message from client to server" - dut1 = env.get_dut("tcp_echo_server", "examples/protocols/asio/tcp_echo_server") + dut1 = env.get_dut("tcp_echo_server", "examples/protocols/asio/tcp_echo_server", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "asio_tcp_echo_server.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/asio/udp_echo_server/CMakeLists.txt b/examples/protocols/asio/udp_echo_server/CMakeLists.txt index 59493277c4..0ebe12f2ba 100644 --- a/examples/protocols/asio/udp_echo_server/CMakeLists.txt +++ b/examples/protocols/asio/udp_echo_server/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(asio_udp_echo_server) diff --git a/examples/protocols/asio/udp_echo_server/asio_udp_server_test.py b/examples/protocols/asio/udp_echo_server/asio_udp_server_test.py index dc2cc78a80..dac320068f 100644 --- a/examples/protocols/asio/udp_echo_server/asio_udp_server_test.py +++ b/examples/protocols/asio/udp_echo_server/asio_udp_server_test.py @@ -6,6 +6,7 @@ import socket try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -29,7 +30,7 @@ def test_examples_protocol_asio_udp_server(env, extra_data): 5. Test evaluates received test message on server stdout """ test_msg = b"echo message from client to server" - dut1 = env.get_dut("udp_echo_server", "examples/protocols/asio/udp_echo_server") + dut1 = env.get_dut("udp_echo_server", "examples/protocols/asio/udp_echo_server", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "asio_udp_echo_server.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/esp_http_client/CMakeLists.txt b/examples/protocols/esp_http_client/CMakeLists.txt index cce8eb1e25..5dd29aeacb 100644 --- a/examples/protocols/esp_http_client/CMakeLists.txt +++ b/examples/protocols/esp_http_client/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp-http-client-example) diff --git a/examples/protocols/esp_http_client/esp_http_client_test.py b/examples/protocols/esp_http_client/esp_http_client_test.py index 1c9c1d5701..cdd0888c47 100644 --- a/examples/protocols/esp_http_client/esp_http_client_test.py +++ b/examples/protocols/esp_http_client/esp_http_client_test.py @@ -4,6 +4,7 @@ import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -23,7 +24,7 @@ def test_examples_protocol_esp_http_client(env, extra_data): 1. join AP 2. Send HTTP request to httpbin.org """ - dut1 = env.get_dut("esp_http_client", "examples/protocols/esp_http_client") + dut1 = env.get_dut("esp_http_client", "examples/protocols/esp_http_client", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "esp-http-client-example.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/http2_request/CMakeLists.txt b/examples/protocols/http2_request/CMakeLists.txt index 0a720bf544..b3ca02d772 100644 --- a/examples/protocols/http2_request/CMakeLists.txt +++ b/examples/protocols/http2_request/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(http2-request) diff --git a/examples/protocols/http_server/advanced_tests/CMakeLists.txt b/examples/protocols/http_server/advanced_tests/CMakeLists.txt index c3972d7d3c..012f07e4d2 100644 --- a/examples/protocols/http_server/advanced_tests/CMakeLists.txt +++ b/examples/protocols/http_server/advanced_tests/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(tests) diff --git a/examples/protocols/http_server/advanced_tests/http_server_advanced_test.py b/examples/protocols/http_server/advanced_tests/http_server_advanced_test.py index f3e7033d77..e76f29ccac 100644 --- a/examples/protocols/http_server/advanced_tests/http_server_advanced_test.py +++ b/examples/protocols/http_server/advanced_tests/http_server_advanced_test.py @@ -23,6 +23,7 @@ import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # This environment variable is expected on the host machine test_fw_path = os.getenv("TEST_FW_PATH") @@ -52,7 +53,7 @@ client = Utility.load_source("client", expath + "/scripts/test.py") @IDF.idf_example_test(env_tag="Example_WIFI") def test_examples_protocol_http_server_advanced(env, extra_data): # Acquire DUT - dut1 = env.get_dut("http_server", "examples/protocols/http_server/advanced_tests") + dut1 = env.get_dut("http_server", "examples/protocols/http_server/advanced_tests", dut_class=ESP32DUT) # Get binary file binary_file = os.path.join(dut1.app.binary_path, "tests.bin") diff --git a/examples/protocols/http_server/persistent_sockets/CMakeLists.txt b/examples/protocols/http_server/persistent_sockets/CMakeLists.txt index b6d34fb24b..85281d89a3 100644 --- a/examples/protocols/http_server/persistent_sockets/CMakeLists.txt +++ b/examples/protocols/http_server/persistent_sockets/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(persistent_sockets) diff --git a/examples/protocols/http_server/persistent_sockets/http_server_persistence_test.py b/examples/protocols/http_server/persistent_sockets/http_server_persistence_test.py index 43174bc52c..f10a984857 100644 --- a/examples/protocols/http_server/persistent_sockets/http_server_persistence_test.py +++ b/examples/protocols/http_server/persistent_sockets/http_server_persistence_test.py @@ -26,6 +26,7 @@ import random try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # This environment variable is expected on the host machine test_fw_path = os.getenv("TEST_FW_PATH") @@ -48,7 +49,7 @@ client = Utility.load_source("client", expath + "/scripts/adder.py") @IDF.idf_example_test(env_tag="Example_WIFI") def test_examples_protocol_http_server_persistence(env, extra_data): # Acquire DUT - dut1 = env.get_dut("http_server", "examples/protocols/http_server/persistent_sockets") + dut1 = env.get_dut("http_server", "examples/protocols/http_server/persistent_sockets", dut_class=ESP32DUT) # Get binary file binary_file = os.path.join(dut1.app.binary_path, "persistent_sockets.bin") diff --git a/examples/protocols/http_server/restful_server/CMakeLists.txt b/examples/protocols/http_server/restful_server/CMakeLists.txt index cb143ac640..67e91b8877 100644 --- a/examples/protocols/http_server/restful_server/CMakeLists.txt +++ b/examples/protocols/http_server/restful_server/CMakeLists.txt @@ -4,4 +4,5 @@ cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(SUPPORTED_TARGETS esp32) project(restful_server) diff --git a/examples/protocols/http_server/simple/CMakeLists.txt b/examples/protocols/http_server/simple/CMakeLists.txt index db2ef2fa67..335f96cd8c 100644 --- a/examples/protocols/http_server/simple/CMakeLists.txt +++ b/examples/protocols/http_server/simple/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(simple) diff --git a/examples/protocols/http_server/simple/http_server_simple_test.py b/examples/protocols/http_server/simple/http_server_simple_test.py index 4cd344db83..75f5f4f262 100644 --- a/examples/protocols/http_server/simple/http_server_simple_test.py +++ b/examples/protocols/http_server/simple/http_server_simple_test.py @@ -26,6 +26,7 @@ import random try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # This environment variable is expected on the host machine test_fw_path = os.getenv("TEST_FW_PATH") @@ -49,7 +50,7 @@ client = Utility.load_source("client", expath + "/scripts/client.py") @IDF.idf_example_test(env_tag="Example_WIFI") def test_examples_protocol_http_server_simple(env, extra_data): # Acquire DUT - dut1 = env.get_dut("http_server", "examples/protocols/http_server/simple") + dut1 = env.get_dut("http_server", "examples/protocols/http_server/simple", dut_class=ESP32DUT) # Get binary file binary_file = os.path.join(dut1.app.binary_path, "simple.bin") diff --git a/examples/protocols/https_mbedtls/CMakeLists.txt b/examples/protocols/https_mbedtls/CMakeLists.txt index a053cbaf04..b42d539004 100644 --- a/examples/protocols/https_mbedtls/CMakeLists.txt +++ b/examples/protocols/https_mbedtls/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(https-mbedtls) diff --git a/examples/protocols/https_request/CMakeLists.txt b/examples/protocols/https_request/CMakeLists.txt index 6e3f1265b9..3ff9b29ad7 100644 --- a/examples/protocols/https_request/CMakeLists.txt +++ b/examples/protocols/https_request/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(https_request) diff --git a/examples/protocols/https_request/example_test.py b/examples/protocols/https_request/example_test.py index ce8453edb4..543edc3da2 100644 --- a/examples/protocols/https_request/example_test.py +++ b/examples/protocols/https_request/example_test.py @@ -4,6 +4,7 @@ import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -23,7 +24,7 @@ def test_examples_protocol_https_request(env, extra_data): 2. connect to www.howsmyssl.com:443 3. send http request """ - dut1 = env.get_dut("https_request", "examples/protocols/https_request") + dut1 = env.get_dut("https_request", "examples/protocols/https_request", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "https_request.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/https_server/CMakeLists.txt b/examples/protocols/https_server/CMakeLists.txt index 35fe8ca898..4c068c308b 100644 --- a/examples/protocols/https_server/CMakeLists.txt +++ b/examples/protocols/https_server/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(https_server) diff --git a/examples/protocols/mdns/mdns_example_test.py b/examples/protocols/mdns/mdns_example_test.py index a06623fcce..e86b84e42f 100644 --- a/examples/protocols/mdns/mdns_example_test.py +++ b/examples/protocols/mdns/mdns_example_test.py @@ -16,6 +16,7 @@ from threading import Thread, Event try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: test_fw_path = os.getenv("TEST_FW_PATH") if test_fw_path and test_fw_path not in sys.path: @@ -112,7 +113,7 @@ def test_examples_protocol_mdns(env, extra_data): 3. check the mdns name is accessible 4. check DUT output if mdns advertized host is resolved """ - dut1 = env.get_dut("mdns-test", "examples/protocols/mdns") + dut1 = env.get_dut("mdns-test", "examples/protocols/mdns", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "mdns-test.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/modbus_master/CMakeLists.txt b/examples/protocols/modbus_master/CMakeLists.txt index d39c8c85d9..66400e830b 100644 --- a/examples/protocols/modbus_master/CMakeLists.txt +++ b/examples/protocols/modbus_master/CMakeLists.txt @@ -2,5 +2,6 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(modbus_master) diff --git a/examples/protocols/mqtt/publish_test/CMakeLists.txt b/examples/protocols/mqtt/publish_test/CMakeLists.txt index 4a46af3e58..c7d6c8ac55 100644 --- a/examples/protocols/mqtt/publish_test/CMakeLists.txt +++ b/examples/protocols/mqtt/publish_test/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_publish) diff --git a/examples/protocols/mqtt/ssl/CMakeLists.txt b/examples/protocols/mqtt/ssl/CMakeLists.txt index 2b78a842b8..517c0221fd 100644 --- a/examples/protocols/mqtt/ssl/CMakeLists.txt +++ b/examples/protocols/mqtt/ssl/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_ssl) diff --git a/examples/protocols/mqtt/ssl/mqtt_ssl_example_test.py b/examples/protocols/mqtt/ssl/mqtt_ssl_example_test.py index 25e98ac765..43d4cec8bd 100644 --- a/examples/protocols/mqtt/ssl/mqtt_ssl_example_test.py +++ b/examples/protocols/mqtt/ssl/mqtt_ssl_example_test.py @@ -11,6 +11,7 @@ from threading import Thread, Event try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -84,7 +85,7 @@ def test_examples_protocol_mqtt_ssl(env, extra_data): 4. Test ESP32 client received correct qos0 message 5. Test python client receives binary data from running partition and compares it with the binary """ - dut1 = env.get_dut("mqtt_ssl", "examples/protocols/mqtt/ssl") + dut1 = env.get_dut("mqtt_ssl", "examples/protocols/mqtt/ssl", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "mqtt_ssl.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt b/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt index 472a3ca3ec..cd3de74aa4 100644 --- a/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt +++ b/examples/protocols/mqtt/ssl_mutual_auth/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_ssl_mutual_auth) diff --git a/examples/protocols/mqtt/tcp/CMakeLists.txt b/examples/protocols/mqtt/tcp/CMakeLists.txt index 5a70e7aa01..25e9bc38a4 100644 --- a/examples/protocols/mqtt/tcp/CMakeLists.txt +++ b/examples/protocols/mqtt/tcp/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_tcp) \ No newline at end of file diff --git a/examples/protocols/mqtt/tcp/mqtt_tcp_example_test.py b/examples/protocols/mqtt/tcp/mqtt_tcp_example_test.py index 05e51420ed..4e39705643 100644 --- a/examples/protocols/mqtt/tcp/mqtt_tcp_example_test.py +++ b/examples/protocols/mqtt/tcp/mqtt_tcp_example_test.py @@ -9,6 +9,7 @@ import time try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -75,7 +76,7 @@ def test_examples_protocol_mqtt_qos1(env, extra_data): 3. Test evaluates that qos1 message is queued and removed from queued after ACK received 4. Test the broker received the same message id evaluated in step 3 """ - dut1 = env.get_dut("mqtt_tcp", "examples/protocols/mqtt/tcp") + dut1 = env.get_dut("mqtt_tcp", "examples/protocols/mqtt/tcp", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "mqtt_tcp.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/mqtt/ws/CMakeLists.txt b/examples/protocols/mqtt/ws/CMakeLists.txt index f0490061c9..6b7b93d19b 100644 --- a/examples/protocols/mqtt/ws/CMakeLists.txt +++ b/examples/protocols/mqtt/ws/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_websocket) diff --git a/examples/protocols/mqtt/ws/mqtt_ws_example_test.py b/examples/protocols/mqtt/ws/mqtt_ws_example_test.py index 58b8d5e37a..19ed395d65 100644 --- a/examples/protocols/mqtt/ws/mqtt_ws_example_test.py +++ b/examples/protocols/mqtt/ws/mqtt_ws_example_test.py @@ -10,6 +10,7 @@ from threading import Thread, Event try: import IDF + from IDF.IDFDUT import ESP32DUT except Exception: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -62,7 +63,7 @@ def test_examples_protocol_mqtt_ws(env, extra_data): 3. Test evaluates it received correct qos0 message 4. Test ESP32 client received correct qos0 message """ - dut1 = env.get_dut("mqtt_websocket", "examples/protocols/mqtt/ws") + dut1 = env.get_dut("mqtt_websocket", "examples/protocols/mqtt/ws", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "mqtt_websocket.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/mqtt/wss/CMakeLists.txt b/examples/protocols/mqtt/wss/CMakeLists.txt index 2350bd8299..96fe21d5e5 100644 --- a/examples/protocols/mqtt/wss/CMakeLists.txt +++ b/examples/protocols/mqtt/wss/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(mqtt_websocket_secure) diff --git a/examples/protocols/mqtt/wss/mqtt_wss_example_test.py b/examples/protocols/mqtt/wss/mqtt_wss_example_test.py index 15ca2834a8..486d65d318 100644 --- a/examples/protocols/mqtt/wss/mqtt_wss_example_test.py +++ b/examples/protocols/mqtt/wss/mqtt_wss_example_test.py @@ -11,6 +11,7 @@ from threading import Thread, Event try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -63,7 +64,7 @@ def test_examples_protocol_mqtt_wss(env, extra_data): 3. Test evaluates it received correct qos0 message 4. Test ESP32 client received correct qos0 message """ - dut1 = env.get_dut("mqtt_websocket_secure", "examples/protocols/mqtt/wss") + dut1 = env.get_dut("mqtt_websocket_secure", "examples/protocols/mqtt/wss", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "mqtt_websocket_secure.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/protocols/openssl_client/CMakeLists.txt b/examples/protocols/openssl_client/CMakeLists.txt index 577d4ae082..f391773012 100644 --- a/examples/protocols/openssl_client/CMakeLists.txt +++ b/examples/protocols/openssl_client/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(openssl_client) diff --git a/examples/protocols/openssl_server/CMakeLists.txt b/examples/protocols/openssl_server/CMakeLists.txt index 9fb42034a5..c930277274 100644 --- a/examples/protocols/openssl_server/CMakeLists.txt +++ b/examples/protocols/openssl_server/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(openssl_server) diff --git a/examples/protocols/pppos_client/CMakeLists.txt b/examples/protocols/pppos_client/CMakeLists.txt index 9609525782..048c790928 100644 --- a/examples/protocols/pppos_client/CMakeLists.txt +++ b/examples/protocols/pppos_client/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(pppos_client) diff --git a/examples/protocols/pppos_client/components/modem/src/esp_modem.c b/examples/protocols/pppos_client/components/modem/src/esp_modem.c index 979b73870a..d59da0b5f2 100644 --- a/examples/protocols/pppos_client/components/modem/src/esp_modem.c +++ b/examples/protocols/pppos_client/components/modem/src/esp_modem.c @@ -28,9 +28,9 @@ #define ESP_MODEM_LINE_BUFFER_SIZE (CONFIG_EXAMPLE_UART_RX_BUFFER_SIZE / 2) #define ESP_MODEM_EVENT_QUEUE_SIZE (16) -#define MIN_PATTERN_INTERVAL (10000) -#define MIN_POST_IDLE (10) -#define MIN_PRE_IDLE (10) +#define MIN_PATTERN_INTERVAL (9) +#define MIN_POST_IDLE (0) +#define MIN_PRE_IDLE (0) /** * @brief Macro defined for error checking @@ -264,12 +264,12 @@ static esp_err_t esp_modem_dte_send_wait(modem_dte_t *dte, const char *data, uin MODEM_CHECK(res >= len, "wait prompt [%s] timeout", err, prompt); MODEM_CHECK(!strncmp(prompt, (const char *)buffer, len), "get wrong prompt: %s", err, buffer); free(buffer); - uart_enable_pattern_det_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE); + uart_enable_pattern_det_baud_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE); return ESP_OK; err: free(buffer); err_write: - uart_enable_pattern_det_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE); + uart_enable_pattern_det_baud_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE); err_param: return ESP_FAIL; } @@ -298,7 +298,7 @@ static esp_err_t esp_modem_dte_change_mode(modem_dte_t *dte, modem_mode_t new_mo case MODEM_COMMAND_MODE: uart_disable_rx_intr(esp_dte->uart_port); uart_flush(esp_dte->uart_port); - uart_enable_pattern_det_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE); + uart_enable_pattern_det_baud_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE); uart_pattern_queue_reset(esp_dte->uart_port, CONFIG_EXAMPLE_UART_PATTERN_QUEUE_SIZE); MODEM_CHECK(dce->set_working_mode(dce, new_mode) == ESP_OK, "set new working mode:%d failed", err, new_mode); break; @@ -392,7 +392,7 @@ modem_dte_t *esp_modem_dte_init(const esp_modem_dte_config_t *config) CONFIG_EXAMPLE_UART_EVENT_QUEUE_SIZE, &(esp_dte->event_queue), 0); MODEM_CHECK(res == ESP_OK, "install uart driver failed", err_uart_config); /* Set pattern interrupt, used to detect the end of a line. */ - res = uart_enable_pattern_det_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE); + res = uart_enable_pattern_det_baud_intr(esp_dte->uart_port, '\n', 1, MIN_PATTERN_INTERVAL, MIN_POST_IDLE, MIN_PRE_IDLE); /* Set pattern queue size */ res |= uart_pattern_queue_reset(esp_dte->uart_port, CONFIG_EXAMPLE_UART_PATTERN_QUEUE_SIZE); MODEM_CHECK(res == ESP_OK, "config uart pattern failed", err_uart_pattern); diff --git a/examples/protocols/sntp/CMakeLists.txt b/examples/protocols/sntp/CMakeLists.txt index 48ca89b291..5676bb7606 100644 --- a/examples/protocols/sntp/CMakeLists.txt +++ b/examples/protocols/sntp/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sntp) diff --git a/examples/protocols/websocket/example_test.py b/examples/protocols/websocket/example_test.py index ef0c3b2f2b..4ca10b2043 100644 --- a/examples/protocols/websocket/example_test.py +++ b/examples/protocols/websocket/example_test.py @@ -2,6 +2,7 @@ import re import os import sys import IDF +from IDF.IDFDUT import ESP32DUT # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -20,7 +21,7 @@ def test_examples_protocol_websocket(env, extra_data): 2. connect to ws://echo.websocket.org 3. send and receive data """ - dut1 = env.get_dut("websocket", "examples/protocols/websocket") + dut1 = env.get_dut("websocket", "examples/protocols/websocket", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "websocket-example.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/provisioning/ble_prov/CMakeLists.txt b/examples/provisioning/ble_prov/CMakeLists.txt index 30012d3e4d..63178e923f 100644 --- a/examples/provisioning/ble_prov/CMakeLists.txt +++ b/examples/provisioning/ble_prov/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ble_prov) diff --git a/examples/provisioning/ble_prov/ble_prov_test.py b/examples/provisioning/ble_prov/ble_prov_test.py index 01277117ed..760756a439 100644 --- a/examples/provisioning/ble_prov/ble_prov_test.py +++ b/examples/provisioning/ble_prov/ble_prov_test.py @@ -22,6 +22,7 @@ import time try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: test_fw_path = os.getenv("TEST_FW_PATH") if test_fw_path and test_fw_path not in sys.path: @@ -43,7 +44,7 @@ esp_prov.config_throw_except = True @IDF.idf_example_test(env_tag="Example_WIFI_BT") def test_examples_provisioning_ble(env, extra_data): # Acquire DUT - dut1 = env.get_dut("ble_prov", "examples/provisioning/ble_prov") + dut1 = env.get_dut("ble_prov", "examples/provisioning/ble_prov", dut_class=ESP32DUT) # Get binary file binary_file = os.path.join(dut1.app.binary_path, "ble_prov.bin") diff --git a/examples/provisioning/console_prov/CMakeLists.txt b/examples/provisioning/console_prov/CMakeLists.txt index 6542005886..5352f1e19a 100644 --- a/examples/provisioning/console_prov/CMakeLists.txt +++ b/examples/provisioning/console_prov/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(console_prov) diff --git a/examples/provisioning/custom_config/CMakeLists.txt b/examples/provisioning/custom_config/CMakeLists.txt index ec9b0ce662..ca8359f82a 100644 --- a/examples/provisioning/custom_config/CMakeLists.txt +++ b/examples/provisioning/custom_config/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(custom_config) diff --git a/examples/provisioning/manager/CMakeLists.txt b/examples/provisioning/manager/CMakeLists.txt index b036d9ce60..a628955d3a 100644 --- a/examples/provisioning/manager/CMakeLists.txt +++ b/examples/provisioning/manager/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(wifi_prov_mgr) diff --git a/examples/provisioning/manager/wifi_prov_mgr_test.py b/examples/provisioning/manager/wifi_prov_mgr_test.py index ea7172dc4d..600bb66d0c 100644 --- a/examples/provisioning/manager/wifi_prov_mgr_test.py +++ b/examples/provisioning/manager/wifi_prov_mgr_test.py @@ -22,6 +22,7 @@ import time try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: test_fw_path = os.getenv("TEST_FW_PATH") if test_fw_path and test_fw_path not in sys.path: @@ -43,7 +44,7 @@ esp_prov.config_throw_except = True @IDF.idf_example_test(env_tag="Example_WIFI_BT") def test_examples_wifi_prov_mgr(env, extra_data): # Acquire DUT - dut1 = env.get_dut("wifi_prov_mgr", "examples/provisioning/manager") + dut1 = env.get_dut("wifi_prov_mgr", "examples/provisioning/manager", dut_class=ESP32DUT) # Get binary file binary_file = os.path.join(dut1.app.binary_path, "wifi_prov_mgr.bin") diff --git a/examples/provisioning/softap_prov/CMakeLists.txt b/examples/provisioning/softap_prov/CMakeLists.txt index fa6ac14339..e63c8e4ed6 100644 --- a/examples/provisioning/softap_prov/CMakeLists.txt +++ b/examples/provisioning/softap_prov/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(softap_prov) diff --git a/examples/provisioning/softap_prov/softap_prov_test.py b/examples/provisioning/softap_prov/softap_prov_test.py index 6f67f47c8e..73d3a51815 100644 --- a/examples/provisioning/softap_prov/softap_prov_test.py +++ b/examples/provisioning/softap_prov/softap_prov_test.py @@ -22,6 +22,7 @@ import time try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: test_fw_path = os.getenv("TEST_FW_PATH") if test_fw_path and test_fw_path not in sys.path: @@ -51,7 +52,7 @@ esp_prov.config_throw_except = True @IDF.idf_example_test(env_tag="Example_WIFI_BT") def test_examples_provisioning_softap(env, extra_data): # Acquire DUT - dut1 = env.get_dut("softap_prov", "examples/provisioning/softap_prov") + dut1 = env.get_dut("softap_prov", "examples/provisioning/softap_prov", dut_class=ESP32DUT) # Get binary file binary_file = os.path.join(dut1.app.binary_path, "softap_prov.bin") diff --git a/examples/security/flash_encryption/CMakeLists.txt b/examples/security/flash_encryption/CMakeLists.txt index 27f6bc4e35..33248e978d 100644 --- a/examples/security/flash_encryption/CMakeLists.txt +++ b/examples/security/flash_encryption/CMakeLists.txt @@ -2,5 +2,6 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) # Flash encryption not currently supported for ESP32-S2beta include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(flash_encryption) diff --git a/examples/security/flash_encryption/example_test.py b/examples/security/flash_encryption/example_test.py index 401083b0cd..a48fac0875 100644 --- a/examples/security/flash_encryption/example_test.py +++ b/examples/security/flash_encryption/example_test.py @@ -4,6 +4,7 @@ import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: test_fw_path = os.getenv('TEST_FW_PATH') if test_fw_path and test_fw_path not in sys.path: @@ -20,7 +21,7 @@ except ImportError: # espefuse.py --do-not-confirm -p $ESPPORT burn_key flash_encryption key.bin @IDF.idf_example_test(env_tag='Example_Flash_Encryption') def test_examples_security_flash_encryption(env, extra_data): - dut = env.get_dut('flash_encryption', 'examples/security/flash_encryption') + dut = env.get_dut('flash_encryption', 'examples/security/flash_encryption', dut_class=ESP32DUT) # start test dut.start_app() lines = [ diff --git a/examples/storage/ext_flash_fatfs/CMakeLists.txt b/examples/storage/ext_flash_fatfs/CMakeLists.txt index 51f1129ba3..52b78776cd 100644 --- a/examples/storage/ext_flash_fatfs/CMakeLists.txt +++ b/examples/storage/ext_flash_fatfs/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) # external SPI flash driver not currently supported for ESP32-S2beta include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ext_flash_fatfs) diff --git a/examples/storage/ext_flash_fatfs/example_test.py b/examples/storage/ext_flash_fatfs/example_test.py index a66ad8c3a4..a0696d0573 100644 --- a/examples/storage/ext_flash_fatfs/example_test.py +++ b/examples/storage/ext_flash_fatfs/example_test.py @@ -10,10 +10,12 @@ except ImportError: sys.path.insert(0, test_fw_path) import IDF +from IDF.IDFDUT import ESP32DUT + @IDF.idf_example_test(env_tag='Example_ExtFlash') def test_examples_storage_ext_flash_fatfs(env, extra_data): - dut = env.get_dut('ext_flash_fatfs', 'examples/storage/ext_flash_fatfs') + dut = env.get_dut('ext_flash_fatfs', 'examples/storage/ext_flash_fatfs', dut_class=ESP32DUT) dut.start_app() dut.expect('Initialized external Flash') diff --git a/examples/storage/parttool/example_test.py b/examples/storage/parttool/example_test.py index 6ba90c1756..8b9d37775b 100644 --- a/examples/storage/parttool/example_test.py +++ b/examples/storage/parttool/example_test.py @@ -5,6 +5,7 @@ import subprocess try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: test_fw_path = os.getenv('TEST_FW_PATH') if test_fw_path and test_fw_path not in sys.path: @@ -14,7 +15,7 @@ except ImportError: @IDF.idf_example_test(env_tag='Example_WIFI') def test_examples_parttool(env, extra_data): - dut = env.get_dut('parttool', 'examples/storage/parttool') + dut = env.get_dut('parttool', 'examples/storage/parttool', dut_class=ESP32DUT) dut.start_app(False) # Verify factory firmware diff --git a/examples/storage/sd_card/CMakeLists.txt b/examples/storage/sd_card/CMakeLists.txt index 00153c74c9..9c49925fdd 100644 --- a/examples/storage/sd_card/CMakeLists.txt +++ b/examples/storage/sd_card/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sd_card) diff --git a/examples/storage/spiffsgen/example_test.py b/examples/storage/spiffsgen/example_test.py index 636d69c7db..a2ad4304a4 100644 --- a/examples/storage/spiffsgen/example_test.py +++ b/examples/storage/spiffsgen/example_test.py @@ -5,6 +5,7 @@ import hashlib try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: test_fw_path = os.getenv('TEST_FW_PATH') if test_fw_path and test_fw_path not in sys.path: @@ -15,7 +16,7 @@ except ImportError: @IDF.idf_example_test(env_tag='Example_WIFI') def test_examples_spiffsgen(env, extra_data): # Test with default build configurations - dut = env.get_dut('spiffsgen', 'examples/storage/spiffsgen') + dut = env.get_dut('spiffsgen', 'examples/storage/spiffsgen', dut_class=ESP32DUT) dut.start_app() base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'spiffs_image') diff --git a/examples/system/app_trace_to_host/CMakeLists.txt b/examples/system/app_trace_to_host/CMakeLists.txt index b490018a3b..abe6c89380 100644 --- a/examples/system/app_trace_to_host/CMakeLists.txt +++ b/examples/system/app_trace_to_host/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(app_trace_to_host) diff --git a/examples/system/console/CMakeLists.txt b/examples/system/console/CMakeLists.txt index d3f354f7fc..25197675a0 100644 --- a/examples/system/console/CMakeLists.txt +++ b/examples/system/console/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(console) diff --git a/examples/system/cpp_exceptions/example_test.py b/examples/system/cpp_exceptions/example_test.py index 7b4c004ec5..2101458361 100644 --- a/examples/system/cpp_exceptions/example_test.py +++ b/examples/system/cpp_exceptions/example_test.py @@ -4,6 +4,7 @@ import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: test_fw_path = os.getenv('TEST_FW_PATH') if test_fw_path and test_fw_path not in sys.path: @@ -13,7 +14,7 @@ except ImportError: @IDF.idf_example_test(env_tag='Example_WIFI') def test_examples_system_cpp_exceptions(env, extra_data): - dut = env.get_dut('cpp_exceptions_example', 'examples/system/cpp_exceptions') + dut = env.get_dut('cpp_exceptions_example', 'examples/system/cpp_exceptions', dut_class=ESP32DUT) # start test dut.start_app() lines = ['app_main starting', diff --git a/examples/system/deep_sleep/CMakeLists.txt b/examples/system/deep_sleep/CMakeLists.txt index 38e606ff25..cb7118f647 100644 --- a/examples/system/deep_sleep/CMakeLists.txt +++ b/examples/system/deep_sleep/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(deep_sleep) diff --git a/examples/system/deep_sleep/main/deep_sleep_example_main.c b/examples/system/deep_sleep/main/deep_sleep_example_main.c index 22bfad4b50..6bcfc003ac 100644 --- a/examples/system/deep_sleep/main/deep_sleep_example_main.c +++ b/examples/system/deep_sleep/main/deep_sleep_example_main.c @@ -145,6 +145,7 @@ void app_main(void) esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask | ext_wakeup_pin_2_mask, ESP_EXT1_WAKEUP_ANY_HIGH); #ifdef CONFIG_ENABLE_TOUCH_WAKEUP +#if CONFIG_IDF_TARGET_ESP32 // Initialize touch pad peripheral. // The default fsm mode is software trigger mode. touch_pad_init(); @@ -160,9 +161,50 @@ void app_main(void) touch_pad_config(TOUCH_PAD_NUM9, TOUCH_THRESH_NO_USE); calibrate_touch_pad(TOUCH_PAD_NUM8); calibrate_touch_pad(TOUCH_PAD_NUM9); +#elif CONFIG_IDF_TARGET_ESP32S2BETA + /* Initialize touch pad peripheral. */ + touch_pad_init(); + /* Only support one touch channel in sleep mode. */ + touch_pad_set_thresh(TOUCH_PAD_NUM8, TOUCH_PAD_THRESHOLD_MAX); + touch_pad_sleep_channel_t slp_config = { + .touch_num = TOUCH_PAD_NUM8, + .sleep_pad_threshold = TOUCH_PAD_THRESHOLD_MAX, + .en_proximity = false, + }; + touch_pad_sleep_channel_config(slp_config); + /* Filter setting */ + touch_filter_config_t filter_info = { + .mode = TOUCH_PAD_FILTER_IIR_8, + .debounce_cnt = 1, // 1 time count. + .hysteresis_thr = 1, // 9.4% + .noise_thr = 1, // 37.5% + .noise_neg_thr = 1, // 37.5% + .neg_noise_limit = 10, // 10 time count. + .jitter_step = 4, // use for jitter mode. + }; + touch_pad_filter_set_config(&filter_info); + touch_pad_filter_enable(); + touch_pad_filter_baseline_reset(TOUCH_PAD_MAX); + printf("touch pad filter init %d", TOUCH_PAD_FILTER_IIR_8); + + /* Enable touch sensor clock. Work mode is "timer trigger". */ + touch_pad_fsm_start(TOUCH_FSM_MODE_TIMER); + + uint32_t touch_value; + //read baseline value + touch_pad_read_raw(TOUCH_PAD_NUM8, &touch_value); + //set interrupt threshold. + touch_pad_sleep_channel_t slp_config = { + .touch_num = TOUCH_PAD_NUM8, + .sleep_pad_threshold = touch_value * 0.2, + .en_proximity = false, + }; + touch_pad_sleep_channel_config(slp_config); //20% + printf("test init: touch pad [%d] base %d, thresh %d", \ + TOUCH_PAD_NUM8, touch_value, (uint32_t)(touch_value * 0.2)); +#endif printf("Enabling touch pad wakeup\n"); esp_sleep_enable_touchpad_wakeup(); - #endif // CONFIG_ENABLE_TOUCH_WAKEUP #ifdef CONFIG_ENABLE_ULP_TEMPERATURE_WAKEUP @@ -186,6 +228,7 @@ void app_main(void) } #ifdef CONFIG_ENABLE_TOUCH_WAKEUP +#if CONFIG_IDF_TARGET_ESP32 static void calibrate_touch_pad(touch_pad_t pad) { int avg = 0; @@ -207,6 +250,7 @@ static void calibrate_touch_pad(touch_pad_t pad) touch_pad_config(pad, threshold); } } +#endif #endif // CONFIG_ENABLE_TOUCH_WAKEUP #ifdef CONFIG_ENABLE_ULP_TEMPERATURE_WAKEUP diff --git a/examples/system/esp_event/default_event_loop/example_test.py b/examples/system/esp_event/default_event_loop/example_test.py index 002c35eddf..0befaecc9e 100644 --- a/examples/system/esp_event/default_event_loop/example_test.py +++ b/examples/system/esp_event/default_event_loop/example_test.py @@ -4,6 +4,7 @@ import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -93,7 +94,7 @@ def _test_iteration_events(dut): @IDF.idf_example_test(env_tag='Example_WIFI') def test_default_event_loop_example(env, extra_data): - dut = env.get_dut('default_event_loop', 'examples/system/esp_event/default_event_loop') + dut = env.get_dut('default_event_loop', 'examples/system/esp_event/default_event_loop', dut_class=ESP32DUT) _test_iteration_events(dut) _test_timer_events(dut) diff --git a/examples/system/esp_event/user_event_loops/example_test.py b/examples/system/esp_event/user_event_loops/example_test.py index ccd8eeab95..212597d42c 100644 --- a/examples/system/esp_event/user_event_loops/example_test.py +++ b/examples/system/esp_event/user_event_loops/example_test.py @@ -4,6 +4,7 @@ import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -22,7 +23,7 @@ TASK_ITERATION_HANDLING = "handling TASK_EVENTS:TASK_ITERATION_EVENT from {}, it @IDF.idf_example_test(env_tag='Example_WIFI') def test_user_event_loops_example(env, extra_data): - dut = env.get_dut('user_event_loops', 'examples/system/esp_event/user_event_loops') + dut = env.get_dut('user_event_loops', 'examples/system/esp_event/user_event_loops', dut_class=ESP32DUT) dut.start_app() diff --git a/examples/system/esp_timer/CMakeLists.txt b/examples/system/esp_timer/CMakeLists.txt index 4222f063cb..18d67a0548 100644 --- a/examples/system/esp_timer/CMakeLists.txt +++ b/examples/system/esp_timer/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(esp_timer_example) diff --git a/examples/system/esp_timer/example_test.py b/examples/system/esp_timer/example_test.py index 474df5e0fa..325088abea 100644 --- a/examples/system/esp_timer/example_test.py +++ b/examples/system/esp_timer/example_test.py @@ -5,6 +5,7 @@ import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -39,7 +40,7 @@ ONE_SHOT_TIMER_PERIOD = 5000000 @IDF.idf_example_test(env_tag='Example_WIFI') def test_examples_system_esp_timer(env, extra_data): - dut = env.get_dut('esp_timer_example', 'examples/system/esp_timer') + dut = env.get_dut('esp_timer_example', 'examples/system/esp_timer', dut_class=ESP32DUT) # start test dut.start_app() groups = dut.expect(STARTING_TIMERS_REGEX, timeout=30) diff --git a/examples/system/freertos/real_time_stats/example_test.py b/examples/system/freertos/real_time_stats/example_test.py index f5ae64c3e4..2d2d2cc0bc 100644 --- a/examples/system/freertos/real_time_stats/example_test.py +++ b/examples/system/freertos/real_time_stats/example_test.py @@ -4,6 +4,7 @@ import sys try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -20,7 +21,7 @@ STATS_TASK_EXPECT = "Real time stats obtained" @IDF.idf_example_test(env_tag='Example_WIFI') def test_real_time_stats_example(env, extra_data): - dut = env.get_dut('real_time_stats', 'examples/system/freertos/real_time_stats') + dut = env.get_dut('real_time_stats', 'examples/system/freertos/real_time_stats', dut_class=ESP32DUT) dut.start_app() for iteration in range(0, STATS_TASK_ITERS): diff --git a/examples/system/gcov/CMakeLists.txt b/examples/system/gcov/CMakeLists.txt index e40ee66d50..b924db3493 100644 --- a/examples/system/gcov/CMakeLists.txt +++ b/examples/system/gcov/CMakeLists.txt @@ -2,6 +2,7 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gcov_example) diff --git a/examples/system/himem/CMakeLists.txt b/examples/system/himem/CMakeLists.txt index 4297397b63..b3740d8de5 100644 --- a/examples/system/himem/CMakeLists.txt +++ b/examples/system/himem/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(himem_test) diff --git a/examples/system/light_sleep/CMakeLists.txt b/examples/system/light_sleep/CMakeLists.txt index ed39e96714..253a31a005 100644 --- a/examples/system/light_sleep/CMakeLists.txt +++ b/examples/system/light_sleep/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(light_sleep_example) diff --git a/examples/system/light_sleep/example_test.py b/examples/system/light_sleep/example_test.py index a3ddd97a16..a29b5dcc8b 100644 --- a/examples/system/light_sleep/example_test.py +++ b/examples/system/light_sleep/example_test.py @@ -6,6 +6,7 @@ import time try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: test_fw_path = os.getenv('TEST_FW_PATH') if test_fw_path and test_fw_path not in sys.path: @@ -21,7 +22,7 @@ WAKEUP_INTERVAL_MS = 2000 @IDF.idf_example_test(env_tag='Example_WIFI') def test_examples_system_light_sleep(env, extra_data): - dut = env.get_dut('light_sleep_example', 'examples/system/light_sleep') + dut = env.get_dut('light_sleep_example', 'examples/system/light_sleep', dut_class=ESP32DUT) dut.start_app() # Ensure DTR and RTS are de-asserted for proper control of GPIO0 diff --git a/examples/system/network_tests/main/net_suite.c b/examples/system/network_tests/main/net_suite.c index dc88173573..d474dda5a1 100644 --- a/examples/system/network_tests/main/net_suite.c +++ b/examples/system/network_tests/main/net_suite.c @@ -29,8 +29,9 @@ void nettestif_input(void *buffer, u16_t len); /* these data configures ARP cache so the test IPs are knows */ static char arp1[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x06, 0x00, 0x01, 0x08, 0x00, 0x06, - 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x00, 0x01 + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x06, 0x00, 0x01, + 0x08, 0x00, 0x06, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x00, 0x01 }; /* Test data (ICMP packet) for verification of tcp ip test netif @@ -139,7 +140,7 @@ void app_main(void) uint8_t ap_mac[6] = { 0,0,0,0,0,1}; IP4_ADDR(&ip_info.ip, 10, 0 , 0, 1); IP4_ADDR(&ip_info.gw, 10, 0 , 0, 1); - IP4_ADDR(&ip_info.netmask, 255, 255 , 255, 0); + IP4_ADDR(&ip_info.netmask, 255, 255 , 255, 0); tcpip_adapter_init(); @@ -153,10 +154,10 @@ void app_main(void) setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); /* Install UART driver for interrupt-driven reads and writes */ - ESP_ERROR_CHECK( uart_driver_install( (uart_port_t)CONFIG_CONSOLE_UART_NUM, + ESP_ERROR_CHECK( uart_driver_install( (uart_port_t)CONFIG_ESP_CONSOLE_UART_NUM, 256, 0, 0, NULL, 0) ); /* Tell VFS to use UART driver */ - esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM); + esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM); esp_vfs_dev_uart_set_rx_line_endings(ESP_LINE_ENDINGS_CR); /* Move the caret to the beginning of the next line on '\n' */ esp_vfs_dev_uart_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF); diff --git a/examples/system/ota/advanced_https_ota/CMakeLists.txt b/examples/system/ota/advanced_https_ota/CMakeLists.txt index 7f8b1cb53f..489b5babf0 100644 --- a/examples/system/ota/advanced_https_ota/CMakeLists.txt +++ b/examples/system/ota/advanced_https_ota/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(advanced_https_ota) diff --git a/examples/system/ota/native_ota_example/CMakeLists.txt b/examples/system/ota/native_ota_example/CMakeLists.txt index 9cb3fe6e4e..e473e3af86 100644 --- a/examples/system/ota/native_ota_example/CMakeLists.txt +++ b/examples/system/ota/native_ota_example/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(native_ota) diff --git a/examples/system/ota/otatool/example_test.py b/examples/system/ota/otatool/example_test.py index a22ebf5a89..cfbf06450d 100644 --- a/examples/system/ota/otatool/example_test.py +++ b/examples/system/ota/otatool/example_test.py @@ -5,6 +5,7 @@ import subprocess try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -18,7 +19,7 @@ except ImportError: @IDF.idf_example_test(env_tag='Example_WIFI') def test_otatool_example(env, extra_data): - dut = env.get_dut('otatool', 'examples/system/ota/otatool') + dut = env.get_dut('otatool', 'examples/system/ota/otatool', dut_class=ESP32DUT) # Verify factory firmware dut.start_app() diff --git a/examples/system/ota/simple_ota_example/CMakeLists.txt b/examples/system/ota/simple_ota_example/CMakeLists.txt index 2d8bd77c48..83cdc97625 100644 --- a/examples/system/ota/simple_ota_example/CMakeLists.txt +++ b/examples/system/ota/simple_ota_example/CMakeLists.txt @@ -6,5 +6,6 @@ cmake_minimum_required(VERSION 3.5) # This example uses an extra component for common functions such as Wi-Fi and Ethernet connection. set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(simple_ota) diff --git a/examples/system/ota/simple_ota_example/example_test.py b/examples/system/ota/simple_ota_example/example_test.py index 7c732a5425..0b79b68b59 100644 --- a/examples/system/ota/simple_ota_example/example_test.py +++ b/examples/system/ota/simple_ota_example/example_test.py @@ -9,6 +9,7 @@ import ssl try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -115,7 +116,7 @@ def test_examples_protocol_simple_ota_example(env, extra_data): 2. Fetch OTA image over HTTPS 3. Reboot with the new OTA image """ - dut1 = env.get_dut("simple_ota_example", "examples/system/ota/simple_ota_example") + dut1 = env.get_dut("simple_ota_example", "examples/system/ota/simple_ota_example", dut_class=ESP32DUT) # check and log bin size binary_file = os.path.join(dut1.app.binary_path, "simple_ota.bin") bin_size = os.path.getsize(binary_file) diff --git a/examples/system/sysview_tracing/CMakeLists.txt b/examples/system/sysview_tracing/CMakeLists.txt index 8c11f89459..85173a8b6d 100644 --- a/examples/system/sysview_tracing/CMakeLists.txt +++ b/examples/system/sysview_tracing/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sysview_tracing) diff --git a/examples/system/sysview_tracing_heap_log/CMakeLists.txt b/examples/system/sysview_tracing_heap_log/CMakeLists.txt index 39a10b5524..c2ff26776e 100644 --- a/examples/system/sysview_tracing_heap_log/CMakeLists.txt +++ b/examples/system/sysview_tracing_heap_log/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(sysview_tracing_heap_log) diff --git a/examples/system/ulp/CMakeLists.txt b/examples/system/ulp/CMakeLists.txt index c24d801b3d..7d05840a72 100644 --- a/examples/system/ulp/CMakeLists.txt +++ b/examples/system/ulp/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ulp-example) \ No newline at end of file diff --git a/examples/system/ulp_adc/CMakeLists.txt b/examples/system/ulp_adc/CMakeLists.txt index 7037f86d8a..db2a3ea688 100644 --- a/examples/system/ulp_adc/CMakeLists.txt +++ b/examples/system/ulp_adc/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ulp-adc-example) \ No newline at end of file diff --git a/examples/wifi/espnow/CMakeLists.txt b/examples/wifi/espnow/CMakeLists.txt index 73c190ccbd..bd72a76709 100644 --- a/examples/wifi/espnow/CMakeLists.txt +++ b/examples/wifi/espnow/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(espnow_example) diff --git a/examples/wifi/iperf/CMakeLists.txt b/examples/wifi/iperf/CMakeLists.txt index c6c13f2929..e2869fde66 100644 --- a/examples/wifi/iperf/CMakeLists.txt +++ b/examples/wifi/iperf/CMakeLists.txt @@ -4,5 +4,6 @@ cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/system/console/components) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(iperf) diff --git a/examples/wifi/iperf/iperf_test.py b/examples/wifi/iperf/iperf_test.py index 35538cae7c..bc67e240fe 100644 --- a/examples/wifi/iperf/iperf_test.py +++ b/examples/wifi/iperf/iperf_test.py @@ -32,6 +32,7 @@ import subprocess try: import IDF + from IDF.IDFDUT import ESP32DUT except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, @@ -517,7 +518,7 @@ def test_wifi_throughput_with_different_configs(env, extra_data): "sdkconfig.{}".format(config_name)) # 2. get DUT and download - dut = env.get_dut("iperf", "examples/wifi/iperf") + dut = env.get_dut("iperf", "examples/wifi/iperf", dut_class=ESP32DUT) dut.start_app() dut.expect("esp32>") @@ -575,7 +576,7 @@ def test_wifi_throughput_vs_rssi(env, extra_data): build_iperf_with_config(BEST_PERFORMANCE_CONFIG) # 2. get DUT and download - dut = env.get_dut("iperf", "examples/wifi/iperf") + dut = env.get_dut("iperf", "examples/wifi/iperf", dut_class=ESP32DUT) dut.start_app() dut.expect("esp32>") @@ -624,7 +625,7 @@ def test_wifi_throughput_basic(env, extra_data): build_iperf_with_config(BEST_PERFORMANCE_CONFIG) # 2. get DUT - dut = env.get_dut("iperf", "examples/wifi/iperf") + dut = env.get_dut("iperf", "examples/wifi/iperf", dut_class=ESP32DUT) dut.start_app() dut.expect("esp32>") diff --git a/examples/wifi/power_save/CMakeLists.txt b/examples/wifi/power_save/CMakeLists.txt index a9a182fe6f..414c768947 100644 --- a/examples/wifi/power_save/CMakeLists.txt +++ b/examples/wifi/power_save/CMakeLists.txt @@ -2,5 +2,6 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(power_save) diff --git a/examples/wifi/simple_sniffer/CMakeLists.txt b/examples/wifi/simple_sniffer/CMakeLists.txt index 2ec8c4d9c6..bb06c01895 100644 --- a/examples/wifi/simple_sniffer/CMakeLists.txt +++ b/examples/wifi/simple_sniffer/CMakeLists.txt @@ -4,5 +4,6 @@ cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/system/console/components) +set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(simple_sniffer) diff --git a/tools/check_kconfigs.py b/tools/check_kconfigs.py index bdc3953e46..93754b7055 100755 --- a/tools/check_kconfigs.py +++ b/tools/check_kconfigs.py @@ -94,11 +94,12 @@ class SourceChecker(BaseChecker): raise InputError(self.path_in_idf, line_number, '"source" has to been followed by space', line.replace('source', 'source ')) path = m.group(2) + filename = os.path.basename(path) if path in ['$COMPONENT_KCONFIGS_PROJBUILD', '$COMPONENT_KCONFIGS']: pass - elif not path.endswith('/Kconfig.in') and path != 'Kconfig.in': - raise InputError(self.path_in_idf, line_number, "only Kconfig.in can be sourced", - line.replace(path, os.path.join(os.path.dirname(path), 'Kconfig.in'))) + elif not filename.startswith('Kconfig.'): + raise InputError(self.path_in_idf, line_number, "only filenames starting with Kconfig.* can be sourced", + line.replace(path, os.path.join(os.path.dirname(path), 'Kconfig.' + filename))) class LineRuleChecker(BaseChecker): diff --git a/tools/ci/build_examples_cmake.sh b/tools/ci/build_examples_cmake.sh index 9a8751ae26..37a1f922c5 100755 --- a/tools/ci/build_examples_cmake.sh +++ b/tools/ci/build_examples_cmake.sh @@ -69,7 +69,7 @@ SDKCONFIG_DEFAULTS_CI=sdkconfig.ci EXAMPLE_PATHS=$( get_supported_examples.sh $IDF_TARGET | sed "s#^#${IDF_PATH}\/examples\/#g" | awk '{print $0"/CmakeLists.txt"}' ) NUM_OF_EXAMPLES=$( echo "${EXAMPLE_PATHS}" | wc -l ) # just a plausibility check -[ ${NUM_OF_EXAMPLES} -lt 100 ] && die "NUM_OF_EXAMPLES is bad" +[ ${NUM_OF_EXAMPLES} -lt 50 ] && die "NUM_OF_EXAMPLES is bad" echo "All examples found for target $IDF_TARGET:" echo $EXAMPLE_PATHS diff --git a/tools/ci/config/assign-test.yml b/tools/ci/config/assign-test.yml index 92dc8cad2c..40826ef7f2 100644 --- a/tools/ci/config/assign-test.yml +++ b/tools/ci/config/assign-test.yml @@ -13,6 +13,7 @@ assign_test: variables: TEST_FW_PATH: "$CI_PROJECT_DIR/tools/tiny-test-fw" EXAMPLE_CONFIG_OUTPUT_PATH: "$CI_PROJECT_DIR/examples/test_configs" + UNIT_TEST_CASE_FILE: "${CI_PROJECT_DIR}/components/idf_test/unit_test/TestCaseAll.yml" artifacts: paths: - components/idf_test/*/CIConfigs @@ -29,7 +30,7 @@ assign_test: # assign example tests - python $TEST_FW_PATH/CIAssignExampleTest.py $IDF_PATH/examples $CI_TARGET_TEST_CONFIG_FILE $EXAMPLE_CONFIG_OUTPUT_PATH # assign unit test cases - - python $TEST_FW_PATH/CIAssignUnitTest.py $IDF_PATH/components/idf_test/unit_test/TestCaseAll.yml $CI_TARGET_TEST_CONFIG_FILE $IDF_PATH/components/idf_test/unit_test/CIConfigs + - python $TEST_FW_PATH/CIAssignUnitTest.py $UNIT_TEST_CASE_FILE $CI_TARGET_TEST_CONFIG_FILE $IDF_PATH/components/idf_test/unit_test/CIConfigs # clone test script to assign tests - git clone $TEST_SCRIPT_REPOSITORY - python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script diff --git a/tools/ci/config/build.yml b/tools/ci/config/build.yml index 46ee9fdefb..6fb4c5e4ac 100644 --- a/tools/ci/config/build.yml +++ b/tools/ci/config/build.yml @@ -114,6 +114,7 @@ build_esp_idf_tests_make: script: - export EXTRA_CFLAGS=${PEDANTIC_CFLAGS} - export EXTRA_CXXFLAGS=${PEDANTIC_CXXFLAGS} + - export IDF_TARGET=esp32 - cd $CI_PROJECT_DIR/tools/unit-test-app - MAKEFLAGS= make help # make sure kconfig tools are built in single process - make ut-clean-all-configs @@ -154,6 +155,7 @@ build_examples_make: - build_examples/*/*/*/build/*.map - build_examples/*/*/*/build/download.config - build_examples/*/*/*/build/bootloader/*.bin + - build_examples/*/*/*/*/build/partition_table/*.bin - $LOG_PATH expire_in: 3 days variables: @@ -183,6 +185,10 @@ build_examples_make: # build some of examples - mkdir -p ${LOG_PATH} - ${IDF_PATH}/tools/ci/build_examples.sh + # Check if the tests demand Make built binaries. If not, delete them + - if [ "$EXAMPLE_TEST_BUILD_SYSTEM" == "make" ]; then exit 0; fi + - cd .. + - rm -rf build_examples # same as above, but for CMake .build_examples_cmake: &build_examples_cmake @@ -191,12 +197,13 @@ build_examples_make: artifacts: when: always paths: - - build_examples_cmake/*/*/*/*/build/*.bin - - build_examples_cmake/*/*/*/*/sdkconfig - - build_examples_cmake/*/*/*/*/build/*.elf - - build_examples_cmake/*/*/*/*/build/*.map - - build_examples_cmake/*/*/*/*/build/flasher_args.json - - build_examples_cmake/*/*/*/*/build/bootloader/*.bin + - build_examples/*/*/*/*/build/*.bin + - build_examples/*/*/*/*/sdkconfig + - build_examples/*/*/*/*/build/*.elf + - build_examples/*/*/*/*/build/*.map + - build_examples/*/*/*/*/build/flasher_args.json + - build_examples/*/*/*/*/build/bootloader/*.bin + - build_examples/*/*/*/*/build/partition_table/*.bin - $LOG_PATH expire_in: 3 days variables: @@ -211,18 +218,27 @@ build_examples_make: script: # it's not possible to build 100% out-of-tree and have the "artifacts" # mechanism work, but this is the next best thing - - rm -rf build_examples_cmake - - mkdir build_examples_cmake - - cd build_examples_cmake + - rm -rf build_examples + - mkdir build_examples + - cd build_examples # build some of examples - mkdir -p ${LOG_PATH} - ${IDF_PATH}/tools/ci/build_examples_cmake.sh + # Check if the tests demand CMake built binaries. If not, delete them + - if [ "$EXAMPLE_TEST_BUILD_SYSTEM" == "cmake" ]; then exit 0; fi + - cd .. + - rm -rf build_examples build_examples_cmake_esp32: extends: .build_examples_cmake variables: IDF_TARGET: esp32 +build_examples_cmake_esp32s2: + extends: .build_examples_cmake + variables: + IDF_TARGET: esp32s2beta + # If you want to add new build example jobs, please add it into dependencies of `.example_test_template` build_docs: diff --git a/tools/ci/config/deploy.yml b/tools/ci/config/deploy.yml index 5a057a9e68..57a33b5661 100644 --- a/tools/ci/config/deploy.yml +++ b/tools/ci/config/deploy.yml @@ -55,6 +55,7 @@ push_to_github: - master - /^release\/v/ - /^v\d+\.\d+(\.\d+)?($|-)/ + - feature/esp32s2beta when: on_success dependencies: [] extends: .before_script_lesser diff --git a/tools/ci/config/host-test.yml b/tools/ci/config/host-test.yml index aeeac45419..e730d13605 100644 --- a/tools/ci/config/host-test.yml +++ b/tools/ci/config/host-test.yml @@ -217,7 +217,7 @@ test_esp_err_to_name_on_host: - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.4.8 ./gen_esp_err_to_name.py - git diff --exit-code -- ../components/esp_common/src/esp_err_to_name.c || { echo 'Differences found between running under Python 2 and 3.'; exit 1; } -test_esp_efuse_table_on_host: +test_esp32_efuse_table_on_host: extends: .host_test_template artifacts: when: on_failure @@ -227,12 +227,28 @@ test_esp_efuse_table_on_host: script: - cd ${IDF_PATH}/components/efuse/ - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 2.7.15 ./efuse_table_gen.py ${IDF_PATH}/components/efuse/esp32/esp_efuse_table.csv - - git diff --exit-code -- esp32/esp_efuse_table.c || { echo 'Differences found. Please run make efuse_common_table or idf.py efuse_common_table and commit the changes.'; exit 1; } + - git diff --exit-code -- esp32/esp_efuse_table.c || { echo 'Differences found for esp32 target. Please run make efuse_common_table or idf.py efuse_common_table and commit the changes.'; exit 1; } - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.4.8 ./efuse_table_gen.py ${IDF_PATH}/components/efuse/esp32/esp_efuse_table.csv - git diff --exit-code -- esp32/esp_efuse_table.c || { echo 'Differences found between running under Python 2 and 3.'; exit 1; } - cd ${IDF_PATH}/components/efuse/test_efuse_host - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh ./efuse_tests.py +test_esp32s2beta_efuse_table_on_host: + extends: .host_test_template + artifacts: + when: on_failure + paths: + - components/efuse/esp32s2beta/esp_efuse_table.c + expire_in: 1 week + script: + - cd ${IDF_PATH}/components/efuse/ + - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 2.7.15 ./efuse_table_gen.py -t "esp32s2beta" ${IDF_PATH}/components/efuse/esp32s2beta/esp_efuse_table.csv + - git diff --exit-code -- esp32s2beta/esp_efuse_table.c || { echo 'Differences found for esp32s2beta target. Please run make efuse_common_table or idf.py efuse_common_table and commit the changes.'; exit 1; } + - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh -p 3.4.8 ./efuse_table_gen.py -t "esp32s2beta" ${IDF_PATH}/components/efuse/esp32s2beta/esp_efuse_table.csv + - git diff --exit-code -- esp32s2beta/esp_efuse_table.c || { echo 'Differences found between running under Python 2 and 3.'; exit 1; } + - cd ${IDF_PATH}/components/efuse/test_efuse_host + - ${IDF_PATH}/tools/ci/multirun_with_pyenv.sh ./efuse_tests.py + test_espcoredump: extends: .host_test_template artifacts: diff --git a/tools/ci/config/target-test.yml b/tools/ci/config/target-test.yml index 9c8862bf1d..d7c4355c59 100644 --- a/tools/ci/config/target-test.yml +++ b/tools/ci/config/target-test.yml @@ -3,8 +3,8 @@ # we need to convert to pattern "job_name_index.yml" .define_config_file_name: &define_config_file_name | JOB_NAME_PREFIX=$(echo ${CI_JOB_NAME} | awk '{print $1}') - JOG_FULL_NAME="${JOB_NAME_PREFIX}_${CI_NODE_INDEX}" - CONFIG_FILE="${CONFIG_FILE_PATH}/${JOG_FULL_NAME}.yml" + JOB_FULL_NAME="${JOB_NAME_PREFIX}_${CI_NODE_INDEX}" + CONFIG_FILE="${CONFIG_FILE_PATH}/${JOB_FULL_NAME}.yml" .example_test_template: stage: target_test @@ -23,6 +23,7 @@ - assign_test - build_examples_make - build_examples_cmake_esp32 + - build_examples_cmake_esp32s2 artifacts: when: always paths: @@ -113,7 +114,7 @@ - python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script - cd auto_test_script # run test - - python CIRunner.py -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH + - python CIRunner.py -l "$LOG_PATH/$JOB_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH test_weekend_mqtt: extends: .example_test_template @@ -464,6 +465,12 @@ UT_034: - ESP32_IDF - UT_T1_ESP_FLASH +UT_035: + extends: .unit_test_template + parallel: 28 + tags: + - ESP32S2BETA_IDF + - UT_T1_1 nvs_compatible_test: extends: .test_template @@ -490,7 +497,7 @@ nvs_compatible_test: # prepare nvs bins - ./Tools/prepare_nvs_bin.sh # run test - - python CIRunner.py -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH + - python CIRunner.py -l "$LOG_PATH/$JOB_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH IT_001: extends: .test_template diff --git a/tools/ci/executable-list.txt b/tools/ci/executable-list.txt index 4912c9d7db..718336a1d7 100644 --- a/tools/ci/executable-list.txt +++ b/tools/ci/executable-list.txt @@ -81,6 +81,7 @@ tools/test_idf_monitor/run_test_idf_monitor.py tools/test_idf_py/test_idf_py.py tools/test_idf_size/test.sh tools/test_idf_tools/test_idf_tools.py +tools/unit-test-app/tools/get_available_configs.sh tools/unit-test-app/unit_test.py tools/windows/eclipse_make.sh tools/windows/tool_setup/build_installer.sh diff --git a/tools/ci/mirror-list.txt b/tools/ci/mirror-list.txt new file mode 100644 index 0000000000..d257d0def3 --- /dev/null +++ b/tools/ci/mirror-list.txt @@ -0,0 +1,21 @@ +components/esp_wifi/lib_esp32 @GENERAL_MIRROR_SERVER@/idf/esp32-wifi-lib.git +components/esp_wifi/lib_esp32s2beta @GENERAL_MIRROR_SERVER@/idf/esp32-wifi-lib.git +components/bt/lib @GENERAL_MIRROR_SERVER@/idf/esp32-bt-lib.git +components/esptool_py/esptool @GENERAL_MIRROR_SERVER@/idf/esptool.git +components/coap/libcoap @GENERAL_MIRROR_SERVER@/idf/libcoap.git ALLOW_TO_SYNC_FROM_PUBLIC +ext/tinydtls @GENERAL_MIRROR_SERVER@/idf/org.eclipse.tinydtls.git ALLOW_TO_SYNC_FROM_PUBLIC +components/json/cJSON @GENERAL_MIRROR_SERVER@/idf/cJSON.git ALLOW_TO_SYNC_FROM_PUBLIC +components/libsodium/libsodium @GENERAL_MIRROR_SERVER@/idf/libsodium.git ALLOW_TO_SYNC_FROM_PUBLIC +components/mbedtls/mbedtls @GENERAL_MIRROR_SERVER@/idf/mbedtls.git ALLOW_TO_SYNC_FROM_PUBLIC +components/expat/expat @GENERAL_MIRROR_SERVER@/idf/libexpat.git ALLOW_TO_SYNC_FROM_PUBLIC +components/bootloader/subproject/components/micro-ecc/micro-ecc @GENERAL_MIRROR_SERVER@/idf/micro-ecc.git ALLOW_TO_SYNC_FROM_PUBLIC +components/nghttp/nghttp2 @GENERAL_MIRROR_SERVER@/idf/nghttp2.git ALLOW_TO_SYNC_FROM_PUBLIC +components/spiffs/spiffs @GENERAL_MIRROR_SERVER@/idf/spiffs.git ALLOW_TO_SYNC_FROM_PUBLIC +components/asio/asio @GENERAL_MIRROR_SERVER@/idf/asio.git +components/lwip/lwip @GENERAL_MIRROR_SERVER@/idf/esp-lwip.git +third-party/mruby @GENERAL_MIRROR_SERVER@/idf/mruby.git ALLOW_TO_SYNC_FROM_PUBLIC +third-party/neverbleed @GENERAL_MIRROR_SERVER@/idf/neverbleed.git ALLOW_TO_SYNC_FROM_PUBLIC +components/mqtt/esp-mqtt @GENERAL_MIRROR_SERVER@/idf/esp-mqtt.git ALLOW_TO_SYNC_FROM_PUBLIC +components/protobuf-c/protobuf-c @GENERAL_MIRROR_SERVER@/idf/protobuf-c.git ALLOW_TO_SYNC_FROM_PUBLIC +components/unity/unity @GENERAL_MIRROR_SERVER@/idf/Unity.git ALLOW_TO_SYNC_FROM_PUBLIC +examples/build_system/cmake/import_lib/main/lib/tinyxml2 @GENERAL_MIRROR_SERVER@/idf/tinyxml2.git ALLOW_TO_SYNC_FROM_PUBLIC diff --git a/tools/cmake/kconfig.cmake b/tools/cmake/kconfig.cmake index 6b808deb59..04b40000d3 100644 --- a/tools/cmake/kconfig.cmake +++ b/tools/cmake/kconfig.cmake @@ -250,6 +250,7 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults) "COMPONENT_KCONFIGS=${kconfigs}" "COMPONENT_KCONFIGS_PROJBUILD=${kconfig_projbuilds}" "IDF_CMAKE=y" + "IDF_TARGET=${IDF_TARGET}" "KCONFIG_CONFIG=${sdkconfig}" "IDF_TARGET=${idf_target}" ${mconf} ${root_kconfig} diff --git a/tools/cmake/project_description.json.in b/tools/cmake/project_description.json.in index e0a62ee552..568a236c45 100644 --- a/tools/cmake/project_description.json.in +++ b/tools/cmake/project_description.json.in @@ -7,8 +7,10 @@ "app_elf": "${PROJECT_EXECUTABLE}", "app_bin": "${PROJECT_BIN}", "git_revision": "${IDF_VER}", + "target": "${CONFIG_IDF_TARGET}", "phy_data_partition": "${CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION}", - "monitor_baud" : "${CONFIG_ESPTOOLPY_MONITOR_BAUD}", + "monitor_baud" : "${CONFIG_ESPTOOLPY_MONITOR_BAUD}", + "monitor_toolprefix": "${CONFIG_SDK_TOOLPREFIX}", "config_environment" : { "COMPONENT_KCONFIGS" : "${COMPONENT_KCONFIGS}", "COMPONENT_KCONFIGS_PROJBUILD" : "${COMPONENT_KCONFIGS_PROJBUILD}" diff --git a/tools/cmake/toolchain-esp32s2beta.cmake b/tools/cmake/toolchain-esp32s2beta.cmake new file mode 100644 index 0000000000..3ec83543af --- /dev/null +++ b/tools/cmake/toolchain-esp32s2beta.cmake @@ -0,0 +1,9 @@ +set(CMAKE_SYSTEM_NAME Generic) + +set(CMAKE_C_COMPILER xtensa-esp32s2-elf-gcc) +set(CMAKE_CXX_COMPILER xtensa-esp32s2-elf-g++) +set(CMAKE_ASM_COMPILER xtensa-esp32s2-elf-gcc) + +set(CMAKE_EXE_LINKER_FLAGS "-nostdlib" CACHE STRING "Linker Base Flags") +set(CMAKE_C_FLAGS "-mlongcalls" CACHE STRING "C Compiler Base Flags") +set(CMAKE_CXX_FLAGS "-mlongcalls" CACHE STRING "C++ Compiler Base Flags") diff --git a/tools/idf.py b/tools/idf.py index 6a8ec7ec50..559996a8c8 100755 --- a/tools/idf.py +++ b/tools/idf.py @@ -86,7 +86,7 @@ GENERATORS = [ GENERATOR_CMDS = dict((a[0], a[1]) for a in GENERATORS) GENERATOR_VERBOSE = dict((a[0], a[3]) for a in GENERATORS) -SUPPORTED_TARGETS = ["esp32"] +SUPPORTED_TARGETS = ["esp32", "esp32s2beta"] def _run_tool(tool_name, args, cwd): @@ -395,6 +395,8 @@ def monitor(action, ctx, args, print_filter): if args.port is not None: monitor_args += ["-p", args.port] monitor_args += ["-b", project_desc["monitor_baud"]] + monitor_args += ["--toolchain-prefix", project_desc["monitor_toolprefix"]] + if print_filter is not None: monitor_args += ["--print_filter", print_filter] monitor_args += [elf_file] diff --git a/tools/kconfig_new/confgen.py b/tools/kconfig_new/confgen.py index 1c1a5dbc0e..5e43498e96 100755 --- a/tools/kconfig_new/confgen.py +++ b/tools/kconfig_new/confgen.py @@ -159,13 +159,18 @@ class DeprecatedOptions(object): f_o.write('{}\n'.format(self._DEP_OP_END)) def append_header(self, config, path_output): + def _opt_defined(opt): + if not opt.visibility: + return False + return not (opt.orig_type in (kconfiglib.BOOL, kconfiglib.TRISTATE) and opt.str_value == "n") + if len(self.r_dic) > 0: with open(path_output, 'a') as f_o: f_o.write('\n/* List of deprecated options */\n') for dep_opt in sorted(self.r_dic): new_opt = self.r_dic[dep_opt] - f_o.write('#ifdef {}{}\n#define {}{} {}{}\n#endif\n\n'.format(self.config_prefix, new_opt, - self.config_prefix, dep_opt, self.config_prefix, new_opt)) + if new_opt in config.syms and _opt_defined(config.syms[new_opt]): + f_o.write('#define {}{} {}{}\n'.format(self.config_prefix, dep_opt, self.config_prefix, new_opt)) def main(): diff --git a/tools/test_check_kconfigs.py b/tools/test_check_kconfigs.py index a38f16ab91..b8541e4a6d 100755 --- a/tools/test_check_kconfigs.py +++ b/tools/test_check_kconfigs.py @@ -80,10 +80,10 @@ class TestSourceChecker(unittest.TestCase, ApplyLine): pass def test_source_file_name(self): - self.expect_error('source "Kconfig.test"', expect='source "Kconfig.in"') - self.expect_error('source "/tmp/Kconfig.test"', expect='source "/tmp/Kconfig.in"') - self.expect_error('source "Kconfig"', expect='source "Kconfig.in"') + self.expect_error('source "notKconfig.test"', expect='source "Kconfig.notKconfig.test"') + self.expect_error('source "Kconfig"', expect='source "Kconfig.Kconfig"') self.expt_success('source "Kconfig.in"') + self.expt_success('source "/tmp/Kconfig.test"') self.expt_success('source "/tmp/Kconfig.in"') self.expect_error('source"Kconfig.in"', expect='source "Kconfig.in"') self.expt_success('source "/tmp/Kconfig.in" # comment') diff --git a/tools/test_idf_tools/test_idf_tools.py b/tools/test_idf_tools/test_idf_tools.py index 49927d39f2..d6c7ef393a 100755 --- a/tools/test_idf_tools/test_idf_tools.py +++ b/tools/test_idf_tools/test_idf_tools.py @@ -54,7 +54,8 @@ class TestUsage(unittest.TestCase): mirror_prefix_map = None if os.path.exists(old_tools_dir): - mirror_prefix_map = 'https://dl.espressif.com/dl,file://' + os.path.join(old_tools_dir, 'dist') + mirror_prefix_map = 'https://dl.espressif.com/dl/toolchains/preview,file://' + os.path.join(old_tools_dir, 'dist') + mirror_prefix_map += ';https://dl.espressif.com/dl,file://' + os.path.join(old_tools_dir, 'dist') mirror_prefix_map += ';https://github.com/espressif/.*/releases/download/.*/,file://' + os.path.join(old_tools_dir, 'dist', '') if mirror_prefix_map: print('Using IDF_MIRROR_PREFIX_MAP={}'.format(mirror_prefix_map)) diff --git a/tools/tiny-test-fw/CIAssignUnitTest.py b/tools/tiny-test-fw/CIAssignUnitTest.py index 6e619400d1..b95cd89034 100644 --- a/tools/tiny-test-fw/CIAssignUnitTest.py +++ b/tools/tiny-test-fw/CIAssignUnitTest.py @@ -24,13 +24,12 @@ except ImportError: class Group(CIAssignTest.Group): - SORT_KEYS = ["config", "SDK", "test environment", "multi_device", "multi_stage", "tags"] + SORT_KEYS = ["config", "test environment", "multi_device", "multi_stage", "tags", "chip_target"] MAX_CASE = 30 ATTR_CONVERT_TABLE = { "execution_time": "execution time" } - # when IDF support multiple chips, SDK will be moved into tags, we can remove it - CI_JOB_MATCH_KEYS = ["test environment", "SDK"] + CI_JOB_MATCH_KEYS = ["test environment"] def __init__(self, case): super(Group, self).__init__(case) @@ -89,6 +88,7 @@ class Group(CIAssignTest.Group): :return: {"Filter": case filter, "CaseConfig": list of case configs for cases in this group} """ test_function = self._map_test_function() + output_data = { # we don't need filter for test function, as UT uses a few test functions for all cases "CaseConfig": [ @@ -96,8 +96,26 @@ class Group(CIAssignTest.Group): "name": test_function, "extra_data": self._create_extra_data(test_function), } - ] + ], } + + target = self._get_case_attr(self.case_list[0], "chip_target") + if target is not None: + target_dut = { + "esp32": "ESP32DUT", + "esp32s2beta": "ESP32S2DUT", + "esp8266": "ESP8266DUT", + }[target] + output_data.update({ + "Filter": { + "overwrite": { + "dut": { + "path": "IDF/IDFDUT.py", + "class": target_dut, + } + } + } + }) return output_data diff --git a/tools/tiny-test-fw/Env.py b/tools/tiny-test-fw/Env.py index 3622ba3824..389e87b335 100644 --- a/tools/tiny-test-fw/Env.py +++ b/tools/tiny-test-fw/Env.py @@ -99,10 +99,10 @@ class Env(object): except ValueError: dut_config = dict() dut_config.update(dut_init_args) - dut = self.default_dut_cls(dut_name, port, - os.path.join(self.log_path, dut_name + ".log"), - app_inst, - **dut_config) + dut = dut_class(dut_name, port, + os.path.join(self.log_path, dut_name + ".log"), + app_inst, + **dut_config) self.allocated_duts[dut_name] = {"port": port, "dut": dut} else: raise ValueError("Failed to get DUT") diff --git a/tools/tiny-test-fw/IDF/IDFDUT.py b/tools/tiny-test-fw/IDF/IDFDUT.py index bb217ca2c8..a360e45042 100644 --- a/tools/tiny-test-fw/IDF/IDFDUT.py +++ b/tools/tiny-test-fw/IDF/IDFDUT.py @@ -122,7 +122,7 @@ def _uses_esptool(func): settings = self.port_inst.get_settings() try: - rom = esptool.ESP32ROM(self.port_inst) + rom = self._get_rom()(self.port_inst) rom.connect('hard_reset') esp = rom.run_stub() @@ -159,6 +159,10 @@ class IDFDUT(DUT.SerialDUT): self.exceptions = _queue.Queue() self.performance_items = _queue.Queue() + @classmethod + def _get_rom(cls): + raise NotImplementedError("This is an abstraction class, method not defined.") + @classmethod def get_mac(cls, app, port): """ @@ -169,7 +173,7 @@ class IDFDUT(DUT.SerialDUT): :return: MAC address or None """ try: - esp = esptool.ESP32ROM(port) + esp = cls._get_rom()(port) esp.connect() return esp.read_mac() except RuntimeError: @@ -181,7 +185,19 @@ class IDFDUT(DUT.SerialDUT): @classmethod def confirm_dut(cls, port, app, **kwargs): - return cls.get_mac(app, port) is not None + inst = None + try: + # TODO: check whether 8266 works with this logic + # Otherwise overwrite it in ESP8266DUT + inst = esptool.ESPLoader.detect_chip(port) + if type(inst) != cls._get_rom(): + raise RuntimeError("Target not expected") + return inst.read_mac() is not None + except(esptool.FatalError, RuntimeError): + return False + finally: + if inst is not None: + inst._port.close() @_uses_esptool def _try_flash(self, esp, erase_nvs, baud_rate): @@ -389,3 +405,21 @@ class IDFDUT(DUT.SerialDUT): if not self.allow_dut_exception and self.get_exceptions(): Utility.console_log("DUT exception detected on {}".format(self), color="red") raise IDFDUTException() + + +class ESP32DUT(IDFDUT): + @classmethod + def _get_rom(cls): + return esptool.ESP32ROM + + +class ESP32S2DUT(IDFDUT): + @classmethod + def _get_rom(cls): + return esptool.ESP32S2ROM + + +class ESP8266DUT(IDFDUT): + @classmethod + def _get_rom(cls): + return esptool.ESP8266ROM diff --git a/tools/tiny-test-fw/Utility/CIAssignTest.py b/tools/tiny-test-fw/Utility/CIAssignTest.py index a4c1446bdd..0931b6997d 100644 --- a/tools/tiny-test-fw/Utility/CIAssignTest.py +++ b/tools/tiny-test-fw/Utility/CIAssignTest.py @@ -238,7 +238,7 @@ class AssignTest(object): else: failed_to_assign.append(group) if failed_to_assign: - console_log("Too many test cases vs jobs to run. Please add the following jobs to .gitlab-ci.yml with specific tags:", "R") + console_log("Too many test cases vs jobs to run. Please add the following jobs to tools/ci/config/target-test.yml with specific tags:", "R") for group in failed_to_assign: console_log("* Add job with: " + ",".join(group.ci_job_match_keys), "R") raise RuntimeError("Failed to assign test case to CI jobs") diff --git a/tools/tiny-test-fw/example.py b/tools/tiny-test-fw/example.py index 2cdd04b403..c4348bf346 100644 --- a/tools/tiny-test-fw/example.py +++ b/tools/tiny-test-fw/example.py @@ -28,6 +28,7 @@ except ImportError: import TinyFW import IDF +from IDF.IDFDUT import ESP32DUT @IDF.idf_example_test(env_tag="Example_WIFI") @@ -38,7 +39,7 @@ def test_examples_protocol_https_request(env, extra_data): 2. connect to www.howsmyssl.com:443 3. send http request """ - dut1 = env.get_dut("https_request", "examples/protocols/https_request") + dut1 = env.get_dut("https_request", "examples/protocols/https_request", dut_class=ESP32DUT) dut1.start_app() dut1.expect(re.compile(r"Connecting to www.howsmyssl.com:443"), timeout=30) dut1.expect("Performing the SSL/TLS handshake") diff --git a/tools/tools.json b/tools/tools.json index 8c2fdfa94b..18aca948c6 100644 --- a/tools/tools.json +++ b/tools/tools.json @@ -56,6 +56,62 @@ } ] }, + { + "description": "Toolchain for Xtensa (ESP32-S2) based on GCC", + "export_paths": [ + [ + "xtensa-esp32s2-elf", + "bin" + ] + ], + "export_vars": {}, + "info_url": "https://github.com/espressif/crosstool-NG", + "install": "always", + "license": "GPL-3.0-with-GCC-exception", + "name": "xtensa-esp32s2-elf", + "version_cmd": [ + "xtensa-esp32s2-elf-gcc", + "--version" + ], + "version_regex": "\\(crosstool-NG\\s+(?:crosstool-ng-)?([0-9a-z\\.\\-]+)\\)\\s*([0-9\\.]+)", + "version_regex_replace": "\\1-\\2", + "versions": [ + { + "linux-amd64": { + "sha256": "014f13cbaef62b1b2edb42d6c49fc9e277005c30a4b48d8216568b76762101d2", + "size": 63081098, + "url": "https://dl.espressif.com/dl/toolchains/preview/xtensa-esp32s2-elf-gcc8_2_0-esp32s2-dev-4-g3a626e-linux-amd64.tar.gz" + }, + "linux-armel": { + "sha256": "5a7eb91937f3d4f93d1830ca62d93db995cd7ce06b07e76d6b58d34f7b8acf50", + "size": 61288049, + "url": "https://dl.espressif.com/dl/toolchains/preview/xtensa-esp32s2-elf-gcc8_2_0-esp32s2-dev-4-g3a626e-linux-armel.tar.gz" + }, + "linux-i686": { + "sha256": "ce85ccde5b42f5dc31d41eca3111bf61a056a38ab6e43b70b76b53fed042709f", + "size": 65070186, + "url": "https://dl.espressif.com/dl/toolchains/preview/xtensa-esp32s2-elf-gcc8_2_0-esp32s2-dev-4-g3a626e-linux-i686.tar.gz" + }, + "macos": { + "sha256": "e566b9f1288ef3bd89b08e9807e88c37f760d48e74b84eee9e9642bb5c0a0bbd", + "size": 69793197, + "url": " https://dl.espressif.com/dl/toolchains/preview/xtensa-esp32s2-elf-gcc8_2_0-esp32s2-dev-4-g3a626e-macos.tar.gz " + }, + "name": "esp32s2-dev-4-g3a626e9-8.2.0", + "status": "recommended", + "win32": { + "sha256": "6ebdcd01de2c8c50ac38446dd4421bb44d320b30b85727c49db26a703ac2c381", + "size": 73352955, + "url": " https://dl.espressif.com/dl/toolchains/preview/xtensa-esp32s2-elf-gcc8_2_0-esp32s2-dev-4-g3a626e-win32.zip" + }, + "win64": { + "sha256": "6ebdcd01de2c8c50ac38446dd4421bb44d320b30b85727c49db26a703ac2c381", + "size": 73352955, + "url": "https://dl.espressif.com/dl/toolchains/preview/xtensa-esp32s2-elf-gcc8_2_0-esp32s2-dev-4-g3a626e-win32.zip" + } + } + ] + }, { "description": "Toolchain for ESP32 ULP coprocessor", "export_paths": [ diff --git a/tools/unit-test-app/Makefile b/tools/unit-test-app/Makefile index 006bf9753e..5aef4f9538 100644 --- a/tools/unit-test-app/Makefile +++ b/tools/unit-test-app/Makefile @@ -15,7 +15,7 @@ all: # Each file in configs/ directory defines a configuration. The format is the # same as sdkconfig file. Configuration is applied on top of sdkconfig.defaults # file from the project directory -CONFIG_NAMES := $(notdir $(wildcard configs/*)) +CONFIG_NAMES := $(shell ${IDF_PATH}/tools/unit-test-app/tools/get_available_configs.sh esp32) # Per-config targets CONFIG_BUILD_TARGETS := $(addprefix ut-build-,$(CONFIG_NAMES)) diff --git a/tools/unit-test-app/components/test_utils/CMakeLists.txt b/tools/unit-test-app/components/test_utils/CMakeLists.txt index 7932a10a68..c099725c1d 100644 --- a/tools/unit-test-app/components/test_utils/CMakeLists.txt +++ b/tools/unit-test-app/components/test_utils/CMakeLists.txt @@ -4,3 +4,4 @@ idf_component_register(SRCS "ref_clock.c" INCLUDE_DIRS include REQUIRES spi_flash idf_test unity) + diff --git a/tools/unit-test-app/components/test_utils/ref_clock.c b/tools/unit-test-app/components/test_utils/ref_clock.c index afafd42b53..a0ecd887b6 100644 --- a/tools/unit-test-app/components/test_utils/ref_clock.c +++ b/tools/unit-test-app/components/test_utils/ref_clock.c @@ -35,14 +35,13 @@ #include "soc/pcnt_periph.h" #include "soc/gpio_periph.h" #include "soc/dport_reg.h" -#include "esp32/rom/gpio.h" -#include "esp32/rom/ets_sys.h" #include "esp_intr_alloc.h" #include "freertos/FreeRTOS.h" #include "driver/periph_ctrl.h" +#include "esp32/rom/gpio.h" +#include "sdkconfig.h" /* Select which RMT and PCNT channels, and GPIO to use */ -#define REF_CLOCK_RMT_CHANNEL 7 #define REF_CLOCK_PCNT_UNIT 0 #define REF_CLOCK_GPIO 21 @@ -54,7 +53,25 @@ static intr_handle_t s_intr_handle; static portMUX_TYPE s_lock = portMUX_INITIALIZER_UNLOCKED; static volatile uint32_t s_milliseconds; -void ref_clock_init(void) +#if CONFIG_IDF_TARGET_ESP32 +#define REF_CLOCK_RMT_CHANNEL 7 + +static int get_pcnt_sig(void) +{ + return (REF_CLOCK_PCNT_UNIT < 5) ? + PCNT_SIG_CH0_IN0_IDX + 4 * REF_CLOCK_PCNT_UNIT : + PCNT_SIG_CH0_IN5_IDX + 4 * (REF_CLOCK_PCNT_UNIT - 5); +} +#elif CONFIG_IDF_TARGET_ESP32S2BETA +#define REF_CLOCK_RMT_CHANNEL 3 + +static int get_pcnt_sig(void) +{ + return PCNT_SIG_CH0_IN0_IDX + 4 * REF_CLOCK_PCNT_UNIT; +} +#endif + +void ref_clock_init() { assert(s_intr_handle == NULL && "already initialized"); @@ -88,9 +105,7 @@ void ref_clock_init(void) RMT.conf_ch[REF_CLOCK_RMT_CHANNEL].conf1.tx_start = 1; // Route signal to PCNT - int pcnt_sig_idx = (REF_CLOCK_PCNT_UNIT < 5) ? - PCNT_SIG_CH0_IN0_IDX + 4 * REF_CLOCK_PCNT_UNIT : - PCNT_SIG_CH0_IN5_IDX + 4 * (REF_CLOCK_PCNT_UNIT - 5); + int pcnt_sig_idx = get_pcnt_sig(); gpio_matrix_in(REF_CLOCK_GPIO, pcnt_sig_idx, false); if (REF_CLOCK_GPIO != 20) { PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[REF_CLOCK_GPIO]); @@ -134,7 +149,7 @@ static void IRAM_ATTR pcnt_isr(void* arg) portEXIT_CRITICAL_ISR(&s_lock); } -void ref_clock_deinit(void) +void ref_clock_deinit() { assert(s_intr_handle && "deinit called without init"); @@ -153,7 +168,7 @@ void ref_clock_deinit(void) periph_module_disable(PERIPH_PCNT_MODULE); } -uint64_t ref_clock_get(void) +uint64_t ref_clock_get() { portENTER_CRITICAL(&s_lock); uint32_t microseconds = PCNT.cnt_unit[REF_CLOCK_PCNT_UNIT].cnt_val; diff --git a/tools/unit-test-app/components/test_utils/test_utils.c b/tools/unit-test-app/components/test_utils/test_utils.c index 9216a70fd8..ec45b85727 100644 --- a/tools/unit-test-app/components/test_utils/test_utils.c +++ b/tools/unit-test-app/components/test_utils/test_utils.c @@ -15,8 +15,6 @@ #include #include "unity.h" #include "test_utils.h" -#include "esp32/rom/ets_sys.h" -#include "esp32/rom/uart.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "tcpip_adapter.h" diff --git a/tools/unit-test-app/configs/aes_no_hw_s2 b/tools/unit-test-app/configs/aes_no_hw_s2 new file mode 100644 index 0000000000..69071c5451 --- /dev/null +++ b/tools/unit-test-app/configs/aes_no_hw_s2 @@ -0,0 +1,4 @@ +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update +TEST_COMPONENTS=mbedtls +CONFIG_MBEDTLS_HARDWARE_AES=n +CONFIG_IDF_TARGET="esp32s2beta" diff --git a/tools/unit-test-app/configs/default_2_s2 b/tools/unit-test-app/configs/default_2_s2 new file mode 100644 index 0000000000..c07c0833cf --- /dev/null +++ b/tools/unit-test-app/configs/default_2_s2 @@ -0,0 +1,2 @@ +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32s2beta driver heap pthread soc spi_flash vfs +CONFIG_IDF_TARGET="esp32s2beta" \ No newline at end of file diff --git a/tools/unit-test-app/configs/default_s2 b/tools/unit-test-app/configs/default_s2 new file mode 100644 index 0000000000..e55c68be0a --- /dev/null +++ b/tools/unit-test-app/configs/default_s2 @@ -0,0 +1,2 @@ +TEST_COMPONENTS=freertos esp32s2beta driver heap pthread soc spi_flash vfs +CONFIG_IDF_TARGET="esp32s2beta" \ No newline at end of file diff --git a/tools/unit-test-app/configs/freertos_compliance_s2 b/tools/unit-test-app/configs/freertos_compliance_s2 new file mode 100644 index 0000000000..e94fa8863b --- /dev/null +++ b/tools/unit-test-app/configs/freertos_compliance_s2 @@ -0,0 +1,3 @@ +TEST_COMPONENTS=driver esp32s2beta spi_flash +CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE=y +CONFIG_IDF_TARGET="esp32s2beta" diff --git a/tools/unit-test-app/configs/libsodium_s2 b/tools/unit-test-app/configs/libsodium_s2 new file mode 100644 index 0000000000..9485da494f --- /dev/null +++ b/tools/unit-test-app/configs/libsodium_s2 @@ -0,0 +1,4 @@ +TEST_COMPONENTS=libsodium +TEST_EXCLUDE_COMPONENTS=bt app_update +CONFIG_UNITY_FREERTOS_STACK_SIZE=12288 +CONFIG_IDF_TARGET="esp32s2beta" \ No newline at end of file diff --git a/tools/unit-test-app/configs/psram b/tools/unit-test-app/configs/psram index 4ca428d582..363bae0599 100644 --- a/tools/unit-test-app/configs/psram +++ b/tools/unit-test-app/configs/psram @@ -1,2 +1,3 @@ TEST_EXCLUDE_COMPONENTS=libsodium bt app_update driver esp32 spi_flash CONFIG_ESP32_SPIRAM_SUPPORT=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=800 diff --git a/tools/unit-test-app/configs/psram_2 b/tools/unit-test-app/configs/psram_2 index c0d4dc9ebb..a9570091a4 100644 --- a/tools/unit-test-app/configs/psram_2 +++ b/tools/unit-test-app/configs/psram_2 @@ -1,2 +1,3 @@ TEST_COMPONENTS=driver esp32 spi_flash CONFIG_ESP32_SPIRAM_SUPPORT=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=800 diff --git a/tools/unit-test-app/configs/psram_8m b/tools/unit-test-app/configs/psram_8m index f933166985..3ab2bf21df 100644 --- a/tools/unit-test-app/configs/psram_8m +++ b/tools/unit-test-app/configs/psram_8m @@ -2,3 +2,4 @@ TEST_COMPONENTS=esp32 CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_SPIRAM_BANKSWITCH_ENABLE=y CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 +CONFIG_ESP_INT_WDT_TIMEOUT_MS=800 \ No newline at end of file diff --git a/tools/unit-test-app/configs/psram_hspi b/tools/unit-test-app/configs/psram_hspi index ffd031b238..a7c288cc1e 100644 --- a/tools/unit-test-app/configs/psram_hspi +++ b/tools/unit-test-app/configs/psram_hspi @@ -4,3 +4,4 @@ CONFIG_ESPTOOLPY_FLASHFREQ_80M=y CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_SPIRAM_SPEED_80M=y CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=800 diff --git a/tools/unit-test-app/configs/psram_vspi b/tools/unit-test-app/configs/psram_vspi index 8b159487d1..acd4979523 100644 --- a/tools/unit-test-app/configs/psram_vspi +++ b/tools/unit-test-app/configs/psram_vspi @@ -4,3 +4,4 @@ CONFIG_ESPTOOLPY_FLASHFREQ_80M=y CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_SPIRAM_SPEED_80M=y CONFIG_SPIRAM_OCCUPY_VSPI_HOST=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=800 diff --git a/tools/unit-test-app/configs/release_2_s2 b/tools/unit-test-app/configs/release_2_s2 new file mode 100644 index 0000000000..b392e48fd2 --- /dev/null +++ b/tools/unit-test-app/configs/release_2_s2 @@ -0,0 +1,4 @@ +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32s2beta driver heap pthread soc spi_flash vfs +CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y +CONFIG_IDF_TARGET="esp32s2beta" diff --git a/tools/unit-test-app/configs/release_s2 b/tools/unit-test-app/configs/release_s2 new file mode 100644 index 0000000000..aaa50b0ce4 --- /dev/null +++ b/tools/unit-test-app/configs/release_s2 @@ -0,0 +1,4 @@ +TEST_COMPONENTS=freertos esp32s2beta driver heap pthread soc spi_flash vfs +CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y +CONFIG_IDF_TARGET="esp32s2beta" diff --git a/tools/unit-test-app/configs/single_core_2_s2 b/tools/unit-test-app/configs/single_core_2_s2 new file mode 100644 index 0000000000..b9bbf882da --- /dev/null +++ b/tools/unit-test-app/configs/single_core_2_s2 @@ -0,0 +1,5 @@ +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update freertos esp32s2beta driver heap pthread soc spi_flash vfs +CONFIG_MEMMAP_SMP=n +CONFIG_FREERTOS_UNICORE=y +CONFIG_ESP32_RTCDATA_IN_FAST_MEM=y +CONFIG_IDF_TARGET="esp32s2beta" diff --git a/tools/unit-test-app/configs/single_core_s2 b/tools/unit-test-app/configs/single_core_s2 new file mode 100644 index 0000000000..e7353a4994 --- /dev/null +++ b/tools/unit-test-app/configs/single_core_s2 @@ -0,0 +1,5 @@ +TEST_COMPONENTS=freertos esp32s2beta driver heap pthread soc spi_flash vfs +CONFIG_MEMMAP_SMP=n +CONFIG_FREERTOS_UNICORE=y +CONFIG_ESP32_RTCDATA_IN_FAST_MEM=y +CONFIG_IDF_TARGET="esp32s2beta" diff --git a/tools/unit-test-app/disabled_configs/app_update_s2 b/tools/unit-test-app/disabled_configs/app_update_s2 new file mode 100644 index 0000000000..9a714628db --- /dev/null +++ b/tools/unit-test-app/disabled_configs/app_update_s2 @@ -0,0 +1,14 @@ +TEST_COMPONENTS=app_update +TEST_EXCLUDE_COMPONENTS=libsodium bt +CONFIG_UNITY_FREERTOS_STACK_SIZE=12288 +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partition_table_unit_test_two_ota.csv" +CONFIG_PARTITION_TABLE_FILENAME="partition_table_unit_test_two_ota.csv" +CONFIG_PARTITION_TABLE_OFFSET=0x18000 +CONFIG_BOOTLOADER_FACTORY_RESET=y +CONFIG_BOOTLOADER_APP_TEST=y +CONFIG_BOOTLOADER_HOLD_TIME_GPIO=2 +CONFIG_BOOTLOADER_OTA_DATA_ERASE=y +CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET=4 +CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=32 +CONFIG_IDF_TARGET="esp32s2beta" \ No newline at end of file diff --git a/tools/unit-test-app/disabled_configs/psram_2_s2 b/tools/unit-test-app/disabled_configs/psram_2_s2 new file mode 100644 index 0000000000..69bb6ff1bb --- /dev/null +++ b/tools/unit-test-app/disabled_configs/psram_2_s2 @@ -0,0 +1,3 @@ +TEST_COMPONENTS=driver esp32s2beta spi_flash +CONFIG_ESP32S2_SPIRAM_SUPPORT=y +CONFIG_IDF_TARGET="esp32s2beta" diff --git a/tools/unit-test-app/disabled_configs/psram_8m_s2 b/tools/unit-test-app/disabled_configs/psram_8m_s2 new file mode 100644 index 0000000000..68661d877f --- /dev/null +++ b/tools/unit-test-app/disabled_configs/psram_8m_s2 @@ -0,0 +1,5 @@ +TEST_COMPONENTS=esp32s2beta +CONFIG_ESP32S2_SPIRAM_SUPPORT=y +CONFIG_SPIRAM_BANKSWITCH_ENABLE=y +CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 +CONFIG_IDF_TARGET="esp32s2beta" diff --git a/tools/unit-test-app/disabled_configs/psram_s2 b/tools/unit-test-app/disabled_configs/psram_s2 new file mode 100644 index 0000000000..be364cff75 --- /dev/null +++ b/tools/unit-test-app/disabled_configs/psram_s2 @@ -0,0 +1,3 @@ +TEST_EXCLUDE_COMPONENTS=libsodium bt app_update driver esp32s2beta spi_flash +CONFIG_ESP32S2_SPIRAM_SUPPORT=y +CONFIG_IDF_TARGET="esp32s2beta" diff --git a/tools/unit-test-app/idf_ext.py b/tools/unit-test-app/idf_ext.py index 9fea430466..efab4703cd 100644 --- a/tools/unit-test-app/idf_ext.py +++ b/tools/unit-test-app/idf_ext.py @@ -4,7 +4,6 @@ import os import os.path import re import shutil -import tempfile def action_extensions(base_actions, project_path=os.getcwd()): @@ -66,31 +65,35 @@ def action_extensions(base_actions, project_path=os.getcwd()): config_path = os.path.join(project_path, "configs", config_name) config = parse_config(config_path) + target = config.get("CONFIG_IDF_TARGET", "esp32").strip("'").strip('"') + + print("Reconfigure: config %s, target %s" % (config_name, target)) + + # Clean up and set idf-target + base_actions["actions"]["fullclean"]["callback"]("fullclean", ctx, args) + base_actions["actions"]["set-target"]["callback"]("set-target", ctx, args, target) + new_cache_values["EXCLUDE_COMPONENTS"] = config.get("EXCLUDE_COMPONENTS", "''") new_cache_values["TEST_EXCLUDE_COMPONENTS"] = config.get("TEST_EXCLUDE_COMPONENTS", "''") new_cache_values["TEST_COMPONENTS"] = config.get("TEST_COMPONENTS", "''") new_cache_values["TESTS_ALL"] = int(new_cache_values["TEST_COMPONENTS"] == "''") - with tempfile.NamedTemporaryFile() as sdkconfig_temp: - # Use values from the combined defaults and the values from - # config folder to build config + # write a new sdkconfig file from the combined defaults and the config + # value folder + with open(os.path.join(project_path, "sdkconfig"), "w") as sdkconfig: sdkconfig_default = os.path.join(project_path, "sdkconfig.defaults") with open(sdkconfig_default, "rb") as sdkconfig_default_file: - sdkconfig_temp.write(sdkconfig_default_file.read()) + sdkconfig.write(sdkconfig_default_file.read()) sdkconfig_config = os.path.join(project_path, "configs", config_name) with open(sdkconfig_config, "rb") as sdkconfig_config_file: - sdkconfig_temp.write(b"\n") - sdkconfig_temp.write(sdkconfig_config_file.read()) + sdkconfig.write(b"\n") + sdkconfig.write(sdkconfig_config_file.read()) - sdkconfig_temp.flush() - new_cache_values["SDKCONFIG_DEFAULTS"] = sdkconfig_temp.name + args.define_cache_entry.extend(["%s=%s" % (k, v) for k, v in new_cache_values.items()]) - args.define_cache_entry.extend(["%s=%s" % (k, v) for k, v in new_cache_values.items()]) - - reconfigure = base_actions["actions"]["reconfigure"]["callback"] - reconfigure(None, ctx, args) + base_actions["actions"]["reconfigure"]["callback"](None, ctx, args) # This target builds the configuration. It does not currently track dependencies, # but is good enough for CI builds if used together with clean-all-configs. diff --git a/tools/unit-test-app/sdkconfig.defaults.esp32s2beta b/tools/unit-test-app/sdkconfig.defaults.esp32s2beta new file mode 100644 index 0000000000..e8620adfc2 --- /dev/null +++ b/tools/unit-test-app/sdkconfig.defaults.esp32s2beta @@ -0,0 +1 @@ +CONFIG_MBEDTLS_HARDWARE_MPI=n diff --git a/tools/unit-test-app/tools/ConfigDependency.yml b/tools/unit-test-app/tools/ConfigDependency.yml index 2e720089a8..e998cd28a9 100644 --- a/tools/unit-test-app/tools/ConfigDependency.yml +++ b/tools/unit-test-app/tools/ConfigDependency.yml @@ -1,2 +1,4 @@ "psram": '{CONFIG_ESP32_SPIRAM_SUPPORT=y} and not {CONFIG_SPIRAM_BANKSWITCH_ENABLE=y}' "8Mpsram": "CONFIG_SPIRAM_BANKSWITCH_ENABLE=y" +"ESP32_IDF": "CONFIG_IDF_TARGET_ESP32=y" +"ESP32S2BETA_IDF": "CONFIG_IDF_TARGET_ESP32S2BETA=y" \ No newline at end of file diff --git a/tools/unit-test-app/tools/UnitTestParser.py b/tools/unit-test-app/tools/UnitTestParser.py index 9bee158168..eff151f11d 100644 --- a/tools/unit-test-app/tools/UnitTestParser.py +++ b/tools/unit-test-app/tools/UnitTestParser.py @@ -15,7 +15,7 @@ except ImportError: TEST_CASE_PATTERN = { "initial condition": "UTINIT1", - "SDK": "ESP32_IDF", + "chip_target": "esp32", "level": "Unit", "execution time": 0, "auto test": "Yes", @@ -79,6 +79,7 @@ class Parser(object): table = CreateSectionTable.SectionTable("section_table.tmp") tags = self.parse_tags(os.path.join(config_output_folder, self.SDKCONFIG_FILE)) + print("Tags of config %s: %s" % (config_name, tags)) test_cases = [] # we could split cases of same config into multiple binaries as we have limited rom space @@ -100,7 +101,17 @@ class Parser(object): name = table.get_string("any", name_addr) desc = table.get_string("any", desc_addr) file_name = table.get_string("any", file_name_addr) - tc = self.parse_one_test_case(name, desc, file_name, config_name, stripped_config_name, tags) + + # Search in tags to set the target + target_tag_dict = {"ESP32_IDF": "esp32", "ESP32S2BETA_IDF": "esp32s2beta"} + for tag in target_tag_dict: + if tag in tags: + target = target_tag_dict[tag] + break + else: + target = "esp32" + + tc = self.parse_one_test_case(name, desc, file_name, config_name, stripped_config_name, tags, target) # check if duplicated case names # we need to use it to select case, @@ -239,7 +250,7 @@ class Parser(object): return match.group(1).split(' ') return None - def parse_one_test_case(self, name, description, file_name, config_name, stripped_config_name, tags): + def parse_one_test_case(self, name, description, file_name, config_name, stripped_config_name, tags, target): """ parse one test case :param name: test case name (summary) @@ -267,7 +278,8 @@ class Parser(object): "multi_device": prop["multi_device"], "multi_stage": prop["multi_stage"], "timeout": int(prop["timeout"]), - "tags": tags}) + "tags": tags, + "chip_target": target}) return test_case def dump_test_cases(self, test_cases): diff --git a/tools/unit-test-app/tools/get_available_configs.sh b/tools/unit-test-app/tools/get_available_configs.sh new file mode 100755 index 0000000000..c5161bd295 --- /dev/null +++ b/tools/unit-test-app/tools/get_available_configs.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +cd ${IDF_PATH}/tools/unit-test-app + +AVAL_CONFIGS="" +CONFIGS=$(ls configs) +if [ $1 == "esp32" ]; then + #echo 'Searching for configs for target "'$1'"' + for FILE in $CONFIGS + do + grep 'CONFIG_IDF_TARGET' /dev/null + if [ $? -ne 0 ]; then + # If CONFIG_IDF_TARGET not found, implies ESP32 + AVAL_CONFIGS="$AVAL_CONFIGS $FILE" + fi + grep -E '^CONFIG_IDF_TARGET="?'$1'"?$' /dev/null + if [ $? -eq 0 ]; then + AVAL_CONFIGS="$AVAL_CONFIGS $FILE" + fi + done +else + #echo 'Searching for configs for target "'$1'"' + for FILE in $CONFIGS + do + grep -E '^CONFIG_IDF_TARGET="?'$1'"?$' /dev/null + if [ $? -eq 0 ]; then + AVAL_CONFIGS="$AVAL_CONFIGS $FILE" + fi + done +fi + +echo $AVAL_CONFIGS