mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 20:44:39 +08:00
xtensa: Add initial support for ESP32-S3
Co-authored-by: Alan Carvalho de Assis <alan.carvalho@espressif.com> Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
f8ba016d72
commit
b0d24f53c4
+37
-2
@@ -70,6 +70,34 @@ config ARCH_CHIP_ESP32S2
|
||||
Based on an Xtensa single-core 32-bit LX7 processor, it can be clocked
|
||||
at up to 240 MHz.
|
||||
|
||||
config ARCH_CHIP_ESP32S3
|
||||
bool "Espressif ESP32-S3"
|
||||
select ARCH_FAMILY_LX7
|
||||
select XTENSA_HAVE_INTERRUPTS
|
||||
select ARCH_HAVE_MULTICPU
|
||||
select ARCH_HAVE_TEXT_HEAP
|
||||
select ARCH_HAVE_SDRAM
|
||||
select ARCH_HAVE_RESET
|
||||
select ARCH_HAVE_BOOTLOADER
|
||||
select ARCH_VECNOTIRQ
|
||||
select LIBC_ARCH_MEMCPY
|
||||
select LIBC_ARCH_MEMCHR
|
||||
select LIBC_ARCH_MEMCMP
|
||||
select LIBC_ARCH_MEMMOVE
|
||||
select LIBC_ARCH_MEMSET
|
||||
select LIBC_ARCH_STRCHR
|
||||
select LIBC_ARCH_STRCMP
|
||||
select LIBC_ARCH_STRCPY
|
||||
select LIBC_ARCH_STRLCPY
|
||||
select LIBC_ARCH_STRNCPY
|
||||
select LIBC_ARCH_STRLEN
|
||||
select LIBC_ARCH_STRNLEN
|
||||
---help---
|
||||
ESP32-S3 is a dual-core Xtensa LX7 MCU, capable of running at 240 MHz.
|
||||
Apart from its 512 KB of internal SRAM, it also comes with integrated 2.4 GHz,
|
||||
802.11 b/g/n Wi-Fi and Bluetooth 5 (LE) connectivity that provides long-range
|
||||
support.
|
||||
|
||||
config ARCH_CHIP_XTENSA_CUSTOM
|
||||
bool "Custom XTENSA chip"
|
||||
select ARCH_CHIP_CUSTOM
|
||||
@@ -145,8 +173,9 @@ config ARCH_FAMILY_LX7
|
||||
|
||||
config ARCH_CHIP
|
||||
string
|
||||
default "esp32" if ARCH_CHIP_ESP32
|
||||
default "esp32s2" if ARCH_CHIP_ESP32S2
|
||||
default "esp32" if ARCH_CHIP_ESP32
|
||||
default "esp32s2" if ARCH_CHIP_ESP32S2
|
||||
default "esp32s3" if ARCH_CHIP_ESP32S3
|
||||
|
||||
config XTENSA_CP_LAZY
|
||||
bool "Lazy co-processor state restoration"
|
||||
@@ -267,13 +296,19 @@ config XTENSA_TOOLCHAIN_ESP
|
||||
endchoice
|
||||
|
||||
source "arch/xtensa/src/lx6/Kconfig"
|
||||
|
||||
if ARCH_CHIP_ESP32
|
||||
source "arch/xtensa/src/esp32/Kconfig"
|
||||
endif
|
||||
|
||||
source "arch/xtensa/src/lx7/Kconfig"
|
||||
|
||||
if ARCH_CHIP_ESP32S2
|
||||
source "arch/xtensa/src/esp32s2/Kconfig"
|
||||
endif
|
||||
|
||||
if ARCH_CHIP_ESP32S3
|
||||
source "arch/xtensa/src/esp32s3/Kconfig"
|
||||
endif
|
||||
|
||||
endif # ARCH_XTENSA
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/include/esp32s3/chip.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_INCLUDE_ESP32S3_CHIP_H
|
||||
#define __ARCH_XTENSA_INCLUDE_ESP32S3_CHIP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ESP32S3_NGPIOS 45 /* GPIO0-44 */
|
||||
|
||||
/* Characterize each supported ESP32-S3 part */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_XTENSA_INCLUDE_ESP32S3_CHIP_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,463 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/include/esp32s3/irq.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directly but, rather, only indirectly
|
||||
* through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_XTENSA_INCLUDE_ESP32S3_IRQ_H
|
||||
#define __ARCH_XTENSA_INCLUDE_ESP32S3_IRQ_H
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ESP32S3_INT_PRIO_DEF 1
|
||||
|
||||
/* Interrupt Matrix
|
||||
*
|
||||
* The Interrupt Matrix embedded in the ESP32-S3 independently allocates
|
||||
* peripheral interrupt sources to the two CPUs’ peripheral interrupts, to
|
||||
* timely inform CPU0 or CPU1 to process the interrupts once the interrupt
|
||||
* signals are generated.
|
||||
* Peripheral interrupt sources must be routed to CPU0/CPU1 peripheral
|
||||
* interrupts via this interrupt matrix due to the following considerations:
|
||||
* - ESP32-S3 has 99 peripheral interrupt sources. To map them to 32 CPU0
|
||||
* interrupts or 32 CPU1 interrupts, this matrix is needed.
|
||||
* - Through this matrix, one peripheral interrupt source can be mapped to
|
||||
* multiple CPU0 interrupts or CPU1 interrupts according to application
|
||||
* requirements.
|
||||
*
|
||||
* Features:
|
||||
* - Accept 99 peripheral interrupt sources as input.
|
||||
* - Generate 26 peripheral interrupts to CPU0 and 26 peripheral interrupts
|
||||
* to CPU1 as output. Note that the remaining 6 CPU0 interrupts and 6 CPU1
|
||||
* interrupts are internal interrupts.
|
||||
* - Support disabling CPU non-maskable interrupt (NMI) sources.
|
||||
* - Support querying current interrupt status of peripheral interrupt
|
||||
* sources.
|
||||
*/
|
||||
|
||||
#define ESP32S3_PERIPH_MAC 0
|
||||
#define ESP32S3_PERIPH_MAC_NMI 1
|
||||
#define ESP32S3_PERIPH_PWR 2
|
||||
#define ESP32S3_PERIPH_BB 3
|
||||
#define ESP32S3_PERIPH_BT_MAC 4
|
||||
#define ESP32S3_PERIPH_BT_BB 5
|
||||
#define ESP32S3_PERIPH_BT_BB_NMI 6
|
||||
#define ESP32S3_PERIPH_RWBT 7
|
||||
#define ESP32S3_PERIPH_RWBLE 8
|
||||
#define ESP32S3_PERIPH_RWBT_NMI 9
|
||||
|
||||
/* RESERVED interrupts: 12, 13, 15, 18, 19 */
|
||||
|
||||
#define ESP32S3_PERIPH_RWBLE_NMI 10
|
||||
#define ESP32S3_PERIPH_I2C_MST 11
|
||||
#define ESP32S3_PERIPH_UHCI0 14
|
||||
#define ESP32S3_PERIPH_GPIO_INT_CPU 16
|
||||
#define ESP32S3_PERIPH_GPIO_INT_CPU_NMI 17
|
||||
|
||||
/* RESERVED interrupts: 23 */
|
||||
|
||||
#define ESP32S3_PERIPH_SPI1 20
|
||||
#define ESP32S3_PERIPH_SPI2 21
|
||||
#define ESP32S3_PERIPH_SPI3 22
|
||||
#define ESP32S3_PERIPH_LCD_CAM 24
|
||||
#define ESP32S3_PERIPH_I2S0 25
|
||||
#define ESP32S3_PERIPH_I2S1 26
|
||||
#define ESP32S3_PERIPH_UART0 27
|
||||
#define ESP32S3_PERIPH_UART1 28
|
||||
#define ESP32S3_PERIPH_UART2 29
|
||||
|
||||
/* RESERVED interrupts: 33, 34 */
|
||||
|
||||
#define ESP32S3_PERIPH_SDIO_HOST 30
|
||||
#define ESP32S3_PERIPH_PWM0 31
|
||||
#define ESP32S3_PERIPH_PWM1 32
|
||||
#define ESP32S3_PERIPH_LEDC 35
|
||||
#define ESP32S3_PERIPH_EFUSE 36
|
||||
#define ESP32S3_PERIPH_CAN 37
|
||||
#define ESP32S3_PERIPH_USB 38
|
||||
#define ESP32S3_PERIPH_RTC_CORE 39
|
||||
|
||||
/* RESERVED interrupts: 44, 45, 46, 47, 48, 49 */
|
||||
|
||||
#define ESP32S3_PERIPH_RMT 40
|
||||
#define ESP32S3_PERIPH_PCNT 41
|
||||
#define ESP32S3_PERIPH_I2C_EXT0 42
|
||||
#define ESP32S3_PERIPH_I2C_EXT1 43
|
||||
|
||||
#define ESP32S3_PERIPH_TG_T0_LEVEL 50
|
||||
#define ESP32S3_PERIPH_TG_T1_LEVEL 51
|
||||
#define ESP32S3_PERIPH_TG_WDT_LEVEL 52
|
||||
#define ESP32S3_PERIPH_TG1_T0_LEVEL 53
|
||||
#define ESP32S3_PERIPH_TG1_T1_LEVEL 54
|
||||
#define ESP32S3_PERIPH_TG1_WDT_LEVEL 55
|
||||
#define ESP32S3_PERIPH_CACHE_IA 56
|
||||
#define ESP32S3_PERIPH_SYSTIMER_TARGET0 57
|
||||
#define ESP32S3_PERIPH_SYSTIMER_TARGET1 58
|
||||
#define ESP32S3_PERIPH_SYSTIMER_TARGET2 59
|
||||
|
||||
#define ESP32S3_PERIPH_SPI_MEM_REJECT 60
|
||||
#define ESP32S3_PERIPH_DCACHE_PRELOAD 61
|
||||
#define ESP32S3_PERIPH_ICACHE_PRELOAD 62
|
||||
#define ESP32S3_PERIPH_DCACHE_SYNC 63
|
||||
#define ESP32S3_PERIPH_ICACHE_SYNC 64
|
||||
#define ESP32S3_PERIPH_APB_ADC 65
|
||||
#define ESP32S3_PERIPH_DMA_IN_CH0 66
|
||||
#define ESP32S3_PERIPH_DMA_IN_CH1 67
|
||||
#define ESP32S3_PERIPH_DMA_IN_CH2 68
|
||||
#define ESP32S3_PERIPH_DMA_IN_CH3 69
|
||||
|
||||
#define ESP32S3_PERIPH_DMA_IN_CH4 70
|
||||
#define ESP32S3_PERIPH_DMA_OUT_CH0 71
|
||||
#define ESP32S3_PERIPH_DMA_OUT_CH1 72
|
||||
#define ESP32S3_PERIPH_DMA_OUT_CH2 73
|
||||
#define ESP32S3_PERIPH_DMA_OUT_CH3 74
|
||||
#define ESP32S3_PERIPH_DMA_OUT_CH4 75
|
||||
#define ESP32S3_PERIPH_RSA 76
|
||||
#define ESP32S3_PERIPH_AES 77
|
||||
#define ESP32S3_PERIPH_SHA 78
|
||||
#define ESP32S3_PERIPH_INT_FROM_CPU0 79
|
||||
|
||||
#define ESP32S3_PERIPH_INT_FROM_CPU1 80
|
||||
#define ESP32S3_PERIPH_INT_FROM_CPU2 81
|
||||
#define ESP32S3_PERIPH_INT_FROM_CPU3 82
|
||||
#define ESP32S3_PERIPH_ASSIST_DEBUG 83
|
||||
#define ESP32S3_PERIPH_DMA_APB_PMS_MONITOR_VIOLATE 84
|
||||
#define ESP32S3_PERIPH_CORE_0_IRAM0_PMS_MONITOR_VIOLATE 85
|
||||
#define ESP32S3_PERIPH_CORE_0_DRAM0_PMS_MONITOR_VIOLATE 86
|
||||
#define ESP32S3_PERIPH_CORE_0_PIF_PMS_MONITOR_VIOLATE 87
|
||||
#define ESP32S3_PERIPH_CORE_0_PIF_PMS_MONITOR_VIOLATE_SIZE 88
|
||||
#define ESP32S3_PERIPH_CORE_1_IRAM0_PMS_MONITOR_VIOLATE 89
|
||||
|
||||
#define ESP32S3_PERIPH_CORE_1_DRAM0_PMS_MONITOR_VIOLATE 90
|
||||
#define ESP32S3_PERIPH_CORE_1_PIF_PMS_MONITOR_VIOLATE 91
|
||||
#define ESP32S3_PERIPH_CORE_1_PIF_PMS_MONITOR_VIOLATE_SIZE 92
|
||||
#define ESP32S3_PERIPH_BACKUP_PMS_VIOLATE 93
|
||||
#define ESP32S3_PERIPH_CACHE_CORE0_ACS 94
|
||||
#define ESP32S3_PERIPH_CACHE_CORE1_ACS 95
|
||||
#define ESP32S3_PERIPH_USB_DEVICE 96
|
||||
#define ESP32S3_PERIPH_PERIPH_BACKUP 97
|
||||
#define ESP32S3_PERIPH_DMA_EXTMEM_REJECT 98
|
||||
|
||||
/* Total number of peripherals */
|
||||
|
||||
#define ESP32S3_NPERIPHERALS 99
|
||||
|
||||
/* Exceptions
|
||||
*
|
||||
* IRAM Offset Description
|
||||
* 0x0000 Windows
|
||||
* 0x0180 Level 2 interrupt
|
||||
* 0x01c0 Level 3 interrupt
|
||||
* 0x0200 Level 4 interrupt
|
||||
* 0x0240 Level 5 interrupt
|
||||
* 0x0280 Debug exception
|
||||
* 0x02c0 NMI exception
|
||||
* 0x0300 Kernel exception
|
||||
* 0x0340 User exception
|
||||
* 0x03c0 Double exception
|
||||
*/
|
||||
|
||||
/* IRQ numbers for internal interrupts that are dispatched like peripheral
|
||||
* interrupts.
|
||||
*/
|
||||
|
||||
#define XTENSA_IRQ_TIMER0 0 /* INTERRUPT, bit 6 */
|
||||
#define XTENSA_IRQ_TIMER1 1 /* INTERRUPT, bit 15 */
|
||||
#define XTENSA_IRQ_TIMER2 2 /* INTERRUPT, bit 16 */
|
||||
#define XTENSA_IRQ_SYSCALL 3 /* User interrupt w/EXCCAUSE=syscall */
|
||||
|
||||
#define XTENSA_NIRQ_INTERNAL 4 /* Number of dispatch internal interrupts */
|
||||
#define XTENSA_IRQ_FIRSTPERIPH 4 /* First peripheral IRQ number */
|
||||
|
||||
/* IRQ numbers for peripheral interrupts coming through the Interrupt
|
||||
* Matrix.
|
||||
*/
|
||||
|
||||
#define ESP32S3_IRQ2PERIPH(irq) ((irq) - XTENSA_IRQ_FIRSTPERIPH)
|
||||
#define ESP32S3_PERIPH2IRQ(id) ((id) + XTENSA_IRQ_FIRSTPERIPH)
|
||||
|
||||
#define ESP32S3_IRQ_MAC (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_MAC)
|
||||
#define ESP32S3_IRQ_MAC_NMI (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_MAC_NMI)
|
||||
#define ESP32S3_IRQ_PWR (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_PWR)
|
||||
#define ESP32S3_IRQ_BB (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_BB)
|
||||
#define ESP32S3_IRQ_BT_MAC (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_BT_MAC)
|
||||
#define ESP32S3_IRQ_BT_BB (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_BB)
|
||||
#define ESP32S3_IRQ_BT_BB_NMI (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_BB_NMI)
|
||||
#define ESP32S3_IRQ_RWBT (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_RWBT)
|
||||
#define ESP32S3_IRQ_RWBLE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_RWBLE)
|
||||
#define ESP32S3_IRQ_RWBT_NMI (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_RWBT_NMI)
|
||||
|
||||
#define ESP32S3_IRQ_RWBLE_NMI (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_RWBLE_NMI)
|
||||
#define ESP32S3_IRQ_I2C_MST (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_I2C_MST)
|
||||
#define ESP32S3_IRQ_UHCI0 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_UHCI0)
|
||||
#define ESP32S3_IRQ_GPIO_INT_CPU (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_GPIO_INT_CPU)
|
||||
#define ESP32S3_IRQ_GPIO_INT_CPU_NMI (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_GPIO_INT_CPU_NMI)
|
||||
|
||||
#define ESP32S3_IRQ_SPI1 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_SPI1)
|
||||
#define ESP32S3_IRQ_SPI2 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_SPI2)
|
||||
#define ESP32S3_IRQ_SPI3 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_SPI3)
|
||||
#define ESP32S3_IRQ_LCD_CAM (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_LCD_CAM)
|
||||
#define ESP32S3_IRQ_I2S0 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_I2S0)
|
||||
#define ESP32S3_IRQ_I2S1 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_I2S1)
|
||||
#define ESP32S3_IRQ_UART0 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_UART0)
|
||||
#define ESP32S3_IRQ_UART1 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_UART1)
|
||||
#define ESP32S3_IRQ_UART2 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_UART2)
|
||||
|
||||
#define ESP32S3_IRQ_SDIO_HOST (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_SDIO_HOST)
|
||||
#define ESP32S3_IRQ_PWM0 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_PWM0)
|
||||
|
||||
#define ESP32S3_IRQ_SREG0 ESP32S3_IRQ_MAC
|
||||
#define ESP32S3_NIRQS_SREG0 32
|
||||
|
||||
#define ESP32S3_IRQ_PWM1 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_PWM1)
|
||||
#define ESP32S3_IRQ_LEDC (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_LEDC)
|
||||
#define ESP32S3_IRQ_EFUSE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_EFUSE)
|
||||
#define ESP32S3_IRQ_CAN (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CAN)
|
||||
#define ESP32S3_IRQ_USB (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_USB)
|
||||
#define ESP32S3_IRQ_RTC_CORE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_RTC_CORE)
|
||||
|
||||
#define ESP32S3_IRQ_RMT (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_RMT)
|
||||
#define ESP32S3_IRQ_PCNT (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_PCNT)
|
||||
#define ESP32S3_IRQ_I2C_EXT0 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_I2C_EXT0)
|
||||
#define ESP32S3_IRQ_I2C_EXT1 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_I2C_EXT1)
|
||||
|
||||
#define ESP32S3_IRQ_TG_T0_LEVEL (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_TG_T0_LEVEL)
|
||||
#define ESP32S3_IRQ_TG_T1_LEVEL (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_TG_T1_LEVEL)
|
||||
#define ESP32S3_IRQ_TG_WDT_LEVEL (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_TG_WDT_LEVEL)
|
||||
#define ESP32S3_IRQ_TG1_T0_LEVEL (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_TG1_T0_LEVEL)
|
||||
#define ESP32S3_IRQ_TG1_T1_LEVEL (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_TG1_T1_LEVEL)
|
||||
#define ESP32S3_IRQ_TG1_WDT_LEVEL (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_TG1_WDT_LEVEL)
|
||||
#define ESP32S3_IRQ_CACHE_IA (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CACHE_IA)
|
||||
#define ESP32S3_IRQ_SYSTIMER_TARGET0 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_SYSTIMER_TARGET0)
|
||||
#define ESP32S3_IRQ_SYSTIMER_TARGET1 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_SYSTIMER_TARGET1)
|
||||
#define ESP32S3_IRQ_SYSTIMER_TARGET2 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_SYSTIMER_TARGET2)
|
||||
|
||||
#define ESP32S3_IRQ_SPI_MEM_REJECT (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_SPI_MEM_REJECT)
|
||||
#define ESP32S3_IRQ_DCACHE_PRELOAD (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DCACHE_PRELOAD)
|
||||
#define ESP32S3_IRQ_ICACHE_PRELOAD (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_ICACHE_PRELOAD)
|
||||
#define ESP32S3_IRQ_DCACHE_SYNC (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DCACHE_SYNC)
|
||||
|
||||
#define ESP32S3_IRQ_SREG1 ESP32S3_IRQ_PWM1
|
||||
#define ESP32S3_NIRQS_SREG1 32
|
||||
|
||||
#define ESP32S3_IRQ_ICACHE_SYNC (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_ICACHE_SYNC)
|
||||
#define ESP32S3_IRQ_APB_ADC (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_APB_ADC)
|
||||
#define ESP32S3_IRQ_DMA_IN_CH0 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_IN_CH0)
|
||||
#define ESP32S3_IRQ_DMA_IN_CH1 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_IN_CH1)
|
||||
#define ESP32S3_IRQ_DMA_IN_CH2 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_IN_CH2)
|
||||
#define ESP32S3_IRQ_DMA_IN_CH3 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_IN_CH3)
|
||||
|
||||
#define ESP32S3_IRQ_DMA_IN_CH4 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_IN_CH4)
|
||||
#define ESP32S3_IRQ_DMA_OUT_CH0 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_OUT_CH0)
|
||||
#define ESP32S3_IRQ_DMA_OUT_CH1 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_OUT_CH1)
|
||||
#define ESP32S3_IRQ_DMA_OUT_CH2 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_OUT_CH2)
|
||||
#define ESP32S3_IRQ_DMA_OUT_CH3 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_OUT_CH3)
|
||||
#define ESP32S3_IRQ_DMA_OUT_CH4 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_OUT_CH4)
|
||||
#define ESP32S3_IRQ_RSA (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_RSA)
|
||||
#define ESP32S3_IRQ_AES (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_AES)
|
||||
#define ESP32S3_IRQ_SHA (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_SHA)
|
||||
#define ESP32S3_IRQ_INT_FROM_CPU0 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_INT_FROM_CPU0)
|
||||
|
||||
#define ESP32S3_IRQ_INT_FROM_CPU1 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_INT_FROM_CPU1)
|
||||
#define ESP32S3_IRQ_INT_FROM_CPU2 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_INT_FROM_CPU2)
|
||||
#define ESP32S3_IRQ_INT_FROM_CPU3 (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_INT_FROM_CPU3)
|
||||
#define ESP32S3_IRQ_ASSIST_DEBUG (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_ASSIST_DEBUG)
|
||||
#define ESP32S3_IRQ_DMA_APB_PMS_MONITOR_VIOLATE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_APB_PMS_MONITOR_VIOLATE)
|
||||
#define ESP32S3_IRQ_CORE_0_IRAM0_PMS_MONITOR_VIOLATE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CORE_0_IRAM0_PMS_MONITOR_VIOLATE)
|
||||
#define ESP32S3_IRQ_CORE_0_DRAM0_PMS_MONITOR_VIOLATE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CORE_0_DRAM0_PMS_MONITOR_VIOLATE)
|
||||
#define ESP32S3_IRQ_CORE_0_PIF_PMS_MONITOR_VIOLATE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CORE_0_PIF_PMS_MONITOR_VIOLATE)
|
||||
#define ESP32S3_IRQ_CORE_0_PIF_PMS_MONITOR_VIOLATE_SIZE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CORE_0_PIF_PMS_MONITOR_VIOLATE_SIZE)
|
||||
#define ESP32S3_IRQ_CORE_1_IRAM0_PMS_MONITOR_VIOLATE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CORE_1_IRAM0_PMS_MONITOR_VIOLATE)
|
||||
|
||||
#define ESP32S3_IRQ_CORE_1_DRAM0_PMS_MONITOR_VIOLATE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CORE_1_DRAM0_PMS_MONITOR_VIOLATE)
|
||||
#define ESP32S3_IRQ_CORE_1_PIF_PMS_MONITOR_VIOLATE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CORE_1_PIF_PMS_MONITOR_VIOLATE)
|
||||
#define ESP32S3_IRQ_CORE_1_PIF_PMS_MONITOR_VIOLATE_SIZE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CORE_1_PIF_PMS_MONITOR_VIOLATE_SIZE)
|
||||
#define ESP32S3_IRQ_BACKUP_PMS_VIOLATE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_BACKUP_PMS_VIOLATE)
|
||||
#define ESP32S3_IRQ_CACHE_CORE0_ACS (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CACHE_CORE0_ACS)
|
||||
#define ESP32S3_IRQ_CACHE_CORE1_ACS (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_CACHE_CORE1_ACS)
|
||||
|
||||
#define ESP32S3_IRQ_SREG2 ESP32S3_IRQ_ICACHE_SYNC
|
||||
#define ESP32S3_NIRQS_SREG2 32
|
||||
|
||||
#define ESP32S3_IRQ_USB_DEVICE (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_USB_DEVICE)
|
||||
#define ESP32S3_IRQ_PERIPH_BACKUP (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_PERIPH_BACKUP)
|
||||
#define ESP32S3_IRQ_DMA_EXTMEM_REJECT (XTENSA_IRQ_FIRSTPERIPH + ESP32S3_PERIPH_DMA_EXTMEM_REJECT)
|
||||
|
||||
#define ESP32S3_IRQ_SREG3 ESP32S3_IRQ_USB_DEVICE
|
||||
#define ESP32S3_NIRQS_SREG3 3
|
||||
|
||||
#define ESP32S3_NIRQ_PERIPH ESP32S3_NPERIPHERALS
|
||||
|
||||
/* Second level GPIO interrupts. GPIO interrupts are decoded and dispatched
|
||||
* as a second level of decoding: The first level dispatches to the GPIO
|
||||
* interrupt handler. The second to the decoded GPIO interrupt handler.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ESP32S3_GPIO_IRQ
|
||||
# define ESP32S3_NIRQ_GPIO 40
|
||||
# define ESP32S3_FIRST_GPIOIRQ (XTENSA_NIRQ_INTERNAL + ESP32S3_NIRQ_PERIPH)
|
||||
# define ESP32S3_LAST_GPIOIRQ (ESP32S3_FIRST_GPIOIRQ + ESP32S3_NIRQ_GPIO - 1)
|
||||
# define ESP32S3_PIN2IRQ(p) ((p) + ESP32S3_FIRST_GPIOIRQ)
|
||||
# define ESP32S3_IRQ2PIN(i) ((i) - ESP32S3_FIRST_GPIOIRQ)
|
||||
#else
|
||||
# define ESP32S3_NIRQ_GPIO 0
|
||||
#endif
|
||||
|
||||
/* Total number of interrupts */
|
||||
|
||||
#define NR_IRQS (XTENSA_NIRQ_INTERNAL + ESP32S3_NIRQ_PERIPH + ESP32S3_NIRQ_GPIO)
|
||||
|
||||
/* Xtensa CPU Interrupts.
|
||||
*
|
||||
* Each of the two CPUs (PRO and APP) have 32 interrupts each, of which
|
||||
* 26 can be mapped to peripheral interrupts:
|
||||
*
|
||||
* Level triggered peripherals (21 total):
|
||||
* 0-5, 8-9, 12-13, 17-18 - Priority 1
|
||||
* 19-21 - Priority 2
|
||||
* 23, 27 - Priority 3
|
||||
* 24-25 - Priority 4
|
||||
* 26, 31 - Priority 5
|
||||
* Edge triggered peripherals (4 total):
|
||||
* 10 - Priority 1
|
||||
* 22 - Priority 3
|
||||
* 28, 30 - Priority 4
|
||||
* NMI (1 total):
|
||||
* 14 - NMI
|
||||
*
|
||||
* CPU peripheral interrupts can be a assigned to a CPU interrupt using the
|
||||
* PRO_*_MAP_REG or APP_*_MAP_REG. There are a pair of these registers for
|
||||
* each peripheral source. Multiple peripheral interrupt sources can be
|
||||
* mapped to the same CPU interrupt.
|
||||
*
|
||||
* The remaining, six, internal CPU interrupts are:
|
||||
*
|
||||
* 6 Timer0 - Priority 1
|
||||
* 7 Software - Priority 1
|
||||
* 11 Profiling - Priority 3
|
||||
* 15 Timer1 - Priority 3
|
||||
* 16 Timer2 - Priority 5
|
||||
* 29 Software - Priority 3
|
||||
*
|
||||
* A peripheral interrupt can be disabled
|
||||
*/
|
||||
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_0 0
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_1 1
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_2 2
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_3 3
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_4 4
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_5 5
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_6 8
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_7 9
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_8 12
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_9 13
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_10 17
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_11 18
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_12 19
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_13 20
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_14 21
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_15 23
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_16 24
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_17 25
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_18 26
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_19 27
|
||||
#define ESP32S3_CPUINT_LEVELPERIPH_20 31
|
||||
|
||||
#define ESP32S3_CPUINT_NLEVELPERIPHS 21
|
||||
#define ESP32S3_CPUINT_LEVELSET 0x8fbe333f
|
||||
|
||||
#define ESP32S3_CPUINT_EDGEPERIPH_0 10
|
||||
#define ESP32S3_CPUINT_EDGEPERIPH_1 22
|
||||
#define ESP32S3_CPUINT_EDGEPERIPH_2 28
|
||||
#define ESP32S3_CPUINT_EDGEPERIPH_3 30
|
||||
|
||||
#define ESP32S3_CPUINT_NEDGEPERIPHS 4
|
||||
#define ESP32S3_CPUINT_EDGESET 0x50400400
|
||||
|
||||
#define ESP32S3_CPUINT_NNMIPERIPHS 1
|
||||
#define ESP32S3_CPUINT_NMISET 0x00004000
|
||||
|
||||
#define ESP32S3_CPUINT_MAC 0
|
||||
#define ESP32S3_CPUINT_TIMER0 6
|
||||
#define ESP32S3_CPUINT_SOFTWARE0 7
|
||||
#define ESP32S3_CPUINT_PROFILING 11
|
||||
#define ESP32S3_CPUINT_TIMER1 15
|
||||
#define ESP32S3_CPUINT_TIMER2 16
|
||||
#define ESP32S3_CPUINT_SOFTWARE1 29
|
||||
|
||||
#define ESP32S3_CPUINT_NINTERNAL 6
|
||||
|
||||
#define ESP32S3_NCPUINTS 32
|
||||
#define ESP32S3_CPUINT_MAX (ESP32S3_NCPUINTS - 1)
|
||||
#define ESP32S3_CPUINT_PERIPHSET 0xdffe773f
|
||||
#define ESP32S3_CPUINT_INTERNALSET 0x200188c0
|
||||
|
||||
/* Priority 1: 0-10, 12-13, 17-18 (15)
|
||||
* Priority 2: 19-21 (3)
|
||||
* Priority 3: 11, 15, 22-23, 27, 29 (6)
|
||||
* Priority 4: 24-25, 28, 30 (4)
|
||||
* Priority 5: 16, 26, 31 (3)
|
||||
* Priority NMI: 14 (1)
|
||||
*/
|
||||
|
||||
#define ESP32S3_INTPRI1_MASK 0x000637ff
|
||||
#define ESP32S3_INTPRI2_MASK 0x00380000
|
||||
#define ESP32S3_INTPRI3_MASK 0x28c08800
|
||||
#define ESP32S3_INTPRI4_MASK 0x53000000
|
||||
#define ESP32S3_INTPRI5_MASK 0x84010000
|
||||
#define ESP32S3_INTNMI_MASK 0x00004000
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Inline functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_XTENSA_INCLUDE_ESP32S3_IRQ_H */
|
||||
@@ -0,0 +1,433 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/include/esp32s3/tie-asm.h
|
||||
* Compile-time HAL assembler definitions dependent on CORE & TIE
|
||||
* configuration
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Customer ID=15128; Build=0x90f1f;
|
||||
* Copyright (c) 1999-2021 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 __ARCH_XTENSA_INCLUDE_ESP32S3_TIE_ASM_H
|
||||
#define __ARCH_XTENSA_INCLUDE_ESP32S3_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 <continue> 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 <select>, space for
|
||||
* the corresponding registers is skipped without doing any store.
|
||||
*/
|
||||
.macro xchal_ncp_store 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
|
||||
rur.THREADPTR \at1 // threadptr option
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+0
|
||||
.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
|
||||
// Optional caller-saved registers used by default by the compiler:
|
||||
.ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~(\select)
|
||||
xchal_sa_align \ptr, 0, 1012, 4, 4
|
||||
rsr.ACCLO \at1 // MAC16 option
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+0
|
||||
rsr.ACCHI \at1 // MAC16 option
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+4
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 8
|
||||
.elseif ((XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~(\alloc)) == 0
|
||||
xchal_sa_align \ptr, 0, 1012, 4, 4
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 8
|
||||
.endif
|
||||
// Optional caller-saved registers not used by default by the compiler:
|
||||
.ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select)
|
||||
xchal_sa_align \ptr, 0, 996, 4, 4
|
||||
rsr.BR \at1 // boolean option
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+0
|
||||
rsr.SCOMPARE1 \at1 // conditional store option
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+4
|
||||
rsr.M0 \at1 // MAC16 option
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+8
|
||||
rsr.M1 \at1 // MAC16 option
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+12
|
||||
rsr.M2 \at1 // MAC16 option
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+16
|
||||
rsr.M3 \at1 // MAC16 option
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+20
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 24
|
||||
.elseif ((XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0
|
||||
xchal_sa_align \ptr, 0, 996, 4, 4
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 24
|
||||
.endif
|
||||
.endm // xchal_ncp_store
|
||||
|
||||
/*
|
||||
* Macro to load 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 load 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 load. Defaults to next available space
|
||||
* (or 0 if <continue> is 0).
|
||||
* select Select what category(ies) of registers to load, 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 <select>, 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
|
||||
// Optional caller-saved registers used by default by the compiler:
|
||||
.ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~(\select)
|
||||
xchal_sa_align \ptr, 0, 1012, 4, 4
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+0
|
||||
wsr.ACCLO \at1 // MAC16 option
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+4
|
||||
wsr.ACCHI \at1 // MAC16 option
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 8
|
||||
.elseif ((XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~(\alloc)) == 0
|
||||
xchal_sa_align \ptr, 0, 1012, 4, 4
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 8
|
||||
.endif
|
||||
// Optional caller-saved registers not used by default by the compiler:
|
||||
.ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select)
|
||||
xchal_sa_align \ptr, 0, 996, 4, 4
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+0
|
||||
wsr.BR \at1 // boolean option
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+4
|
||||
wsr.SCOMPARE1 \at1 // conditional store option
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+8
|
||||
wsr.M0 \at1 // MAC16 option
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+12
|
||||
wsr.M1 \at1 // MAC16 option
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+16
|
||||
wsr.M2 \at1 // MAC16 option
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+20
|
||||
wsr.M3 \at1 // MAC16 option
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 24
|
||||
.elseif ((XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0
|
||||
xchal_sa_align \ptr, 0, 996, 4, 4
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 24
|
||||
.endif
|
||||
.endm // xchal_ncp_load
|
||||
|
||||
|
||||
#define XCHAL_NCP_NUM_ATMPS 1
|
||||
|
||||
/*
|
||||
* Macro to store the state of TIE coprocessor FPU.
|
||||
* 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_CP0_NUM_ATMPS
|
||||
* registers are clobbered, the remaining are unused).
|
||||
* Optional parameters are the same as for xchal_ncp_store.
|
||||
*/
|
||||
#define xchal_cp_FPU_store xchal_cp0_store
|
||||
.macro xchal_cp0_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0
|
||||
xchal_sa_start \continue, \ofs
|
||||
// Custom caller-saved registers not used by default by the compiler:
|
||||
.ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select)
|
||||
xchal_sa_align \ptr, 0, 948, 4, 4
|
||||
rur.FCR \at1 // ureg 232
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+0
|
||||
rur.FSR \at1 // ureg 233
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+4
|
||||
ssi f0, \ptr, .Lxchal_ofs_+8
|
||||
ssi f1, \ptr, .Lxchal_ofs_+12
|
||||
ssi f2, \ptr, .Lxchal_ofs_+16
|
||||
ssi f3, \ptr, .Lxchal_ofs_+20
|
||||
ssi f4, \ptr, .Lxchal_ofs_+24
|
||||
ssi f5, \ptr, .Lxchal_ofs_+28
|
||||
ssi f6, \ptr, .Lxchal_ofs_+32
|
||||
ssi f7, \ptr, .Lxchal_ofs_+36
|
||||
ssi f8, \ptr, .Lxchal_ofs_+40
|
||||
ssi f9, \ptr, .Lxchal_ofs_+44
|
||||
ssi f10, \ptr, .Lxchal_ofs_+48
|
||||
ssi f11, \ptr, .Lxchal_ofs_+52
|
||||
ssi f12, \ptr, .Lxchal_ofs_+56
|
||||
ssi f13, \ptr, .Lxchal_ofs_+60
|
||||
ssi f14, \ptr, .Lxchal_ofs_+64
|
||||
ssi f15, \ptr, .Lxchal_ofs_+68
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 72
|
||||
.elseif ((XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0
|
||||
xchal_sa_align \ptr, 0, 948, 4, 4
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 72
|
||||
.endif
|
||||
.endm // xchal_cp0_store
|
||||
|
||||
/*
|
||||
* Macro to load the state of TIE coprocessor FPU.
|
||||
* 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_CP0_NUM_ATMPS
|
||||
* registers are clobbered, the remaining are unused).
|
||||
* Optional parameters are the same as for xchal_ncp_load.
|
||||
*/
|
||||
#define xchal_cp_FPU_load xchal_cp0_load
|
||||
.macro xchal_cp0_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0
|
||||
xchal_sa_start \continue, \ofs
|
||||
// Custom caller-saved registers not used by default by the compiler:
|
||||
.ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select)
|
||||
xchal_sa_align \ptr, 0, 948, 4, 4
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+0
|
||||
wur.FCR \at1 // ureg 232
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+4
|
||||
wur.FSR \at1 // ureg 233
|
||||
lsi f0, \ptr, .Lxchal_ofs_+8
|
||||
lsi f1, \ptr, .Lxchal_ofs_+12
|
||||
lsi f2, \ptr, .Lxchal_ofs_+16
|
||||
lsi f3, \ptr, .Lxchal_ofs_+20
|
||||
lsi f4, \ptr, .Lxchal_ofs_+24
|
||||
lsi f5, \ptr, .Lxchal_ofs_+28
|
||||
lsi f6, \ptr, .Lxchal_ofs_+32
|
||||
lsi f7, \ptr, .Lxchal_ofs_+36
|
||||
lsi f8, \ptr, .Lxchal_ofs_+40
|
||||
lsi f9, \ptr, .Lxchal_ofs_+44
|
||||
lsi f10, \ptr, .Lxchal_ofs_+48
|
||||
lsi f11, \ptr, .Lxchal_ofs_+52
|
||||
lsi f12, \ptr, .Lxchal_ofs_+56
|
||||
lsi f13, \ptr, .Lxchal_ofs_+60
|
||||
lsi f14, \ptr, .Lxchal_ofs_+64
|
||||
lsi f15, \ptr, .Lxchal_ofs_+68
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 72
|
||||
.elseif ((XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0
|
||||
xchal_sa_align \ptr, 0, 948, 4, 4
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 72
|
||||
.endif
|
||||
.endm // xchal_cp0_load
|
||||
|
||||
#define XCHAL_CP0_NUM_ATMPS 1
|
||||
/*
|
||||
* Macro to store the state of TIE coprocessor cop_ai.
|
||||
* Required parameters:
|
||||
* ptr Save area pointer address register (clobbered)
|
||||
* (register must contain a 16 byte aligned address).
|
||||
* at1..at4 Four temporary address registers (first XCHAL_CP3_NUM_ATMPS
|
||||
* registers are clobbered, the remaining are unused).
|
||||
* Optional parameters are the same as for xchal_ncp_store.
|
||||
*/
|
||||
#define xchal_cp_cop_ai_store xchal_cp3_store
|
||||
.macro xchal_cp3_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0
|
||||
xchal_sa_start \continue, \ofs
|
||||
// Custom caller-saved registers not used by default by the compiler:
|
||||
.ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select)
|
||||
xchal_sa_align \ptr, 0, 0, 16, 16
|
||||
rur.ACCX_0 \at1 // ureg 0
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+0
|
||||
rur.ACCX_1 \at1 // ureg 1
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+4
|
||||
rur.QACC_H_0 \at1 // ureg 2
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+8
|
||||
rur.QACC_H_1 \at1 // ureg 3
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+12
|
||||
rur.QACC_H_2 \at1 // ureg 4
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+16
|
||||
rur.QACC_H_3 \at1 // ureg 5
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+20
|
||||
rur.QACC_H_4 \at1 // ureg 6
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+24
|
||||
rur.QACC_L_0 \at1 // ureg 7
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+28
|
||||
rur.QACC_L_1 \at1 // ureg 8
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+32
|
||||
rur.QACC_L_2 \at1 // ureg 9
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+36
|
||||
rur.QACC_L_3 \at1 // ureg 10
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+40
|
||||
rur.QACC_L_4 \at1 // ureg 11
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+44
|
||||
rur.SAR_BYTE \at1 // ureg 13
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+48
|
||||
rur.FFT_BIT_WIDTH \at1 // ureg 14
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+52
|
||||
rur.UA_STATE_0 \at1 // ureg 15
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+56
|
||||
rur.UA_STATE_1 \at1 // ureg 16
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+60
|
||||
rur.UA_STATE_2 \at1 // ureg 17
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+64
|
||||
rur.UA_STATE_3 \at1 // ureg 18
|
||||
s32i \at1, \ptr, .Lxchal_ofs_+68
|
||||
st.qr q0, \ptr, .Lxchal_ofs_+80
|
||||
st.qr q1, \ptr, .Lxchal_ofs_+96
|
||||
st.qr q2, \ptr, .Lxchal_ofs_+112
|
||||
addi \ptr, \ptr, 128
|
||||
st.qr q3, \ptr, .Lxchal_ofs_+0
|
||||
st.qr q4, \ptr, .Lxchal_ofs_+16
|
||||
st.qr q5, \ptr, .Lxchal_ofs_+32
|
||||
st.qr q6, \ptr, .Lxchal_ofs_+48
|
||||
st.qr q7, \ptr, .Lxchal_ofs_+64
|
||||
.set .Lxchal_pofs_, .Lxchal_pofs_ + 128
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 80
|
||||
.elseif ((XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0
|
||||
xchal_sa_align \ptr, 0, 0, 16, 16
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 208
|
||||
.endif
|
||||
.endm // xchal_cp3_store
|
||||
|
||||
/*
|
||||
* Macro to load the state of TIE coprocessor cop_ai.
|
||||
* Required parameters:
|
||||
* ptr Save area pointer address register (clobbered)
|
||||
* (register must contain a 16 byte aligned address).
|
||||
* at1..at4 Four temporary address registers (first XCHAL_CP3_NUM_ATMPS
|
||||
* registers are clobbered, the remaining are unused).
|
||||
* Optional parameters are the same as for xchal_ncp_load.
|
||||
*/
|
||||
#define xchal_cp_cop_ai_load xchal_cp3_load
|
||||
.macro xchal_cp3_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0
|
||||
xchal_sa_start \continue, \ofs
|
||||
// Custom caller-saved registers not used by default by the compiler:
|
||||
.ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select)
|
||||
xchal_sa_align \ptr, 0, 0, 16, 16
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+0
|
||||
wur.ACCX_0 \at1 // ureg 0
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+4
|
||||
wur.ACCX_1 \at1 // ureg 1
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+8
|
||||
wur.QACC_H_0 \at1 // ureg 2
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+12
|
||||
wur.QACC_H_1 \at1 // ureg 3
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+16
|
||||
wur.QACC_H_2 \at1 // ureg 4
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+20
|
||||
wur.QACC_H_3 \at1 // ureg 5
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+24
|
||||
wur.QACC_H_4 \at1 // ureg 6
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+28
|
||||
wur.QACC_L_0 \at1 // ureg 7
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+32
|
||||
wur.QACC_L_1 \at1 // ureg 8
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+36
|
||||
wur.QACC_L_2 \at1 // ureg 9
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+40
|
||||
wur.QACC_L_3 \at1 // ureg 10
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+44
|
||||
wur.QACC_L_4 \at1 // ureg 11
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+48
|
||||
wur.SAR_BYTE \at1 // ureg 13
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+52
|
||||
wur.FFT_BIT_WIDTH \at1 // ureg 14
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+56
|
||||
wur.UA_STATE_0 \at1 // ureg 15
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+60
|
||||
wur.UA_STATE_1 \at1 // ureg 16
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+64
|
||||
wur.UA_STATE_2 \at1 // ureg 17
|
||||
l32i \at1, \ptr, .Lxchal_ofs_+68
|
||||
wur.UA_STATE_3 \at1 // ureg 18
|
||||
ld.qr q0, \ptr, .Lxchal_ofs_+80
|
||||
ld.qr q1, \ptr, .Lxchal_ofs_+96
|
||||
ld.qr q2, \ptr, .Lxchal_ofs_+112
|
||||
addi \ptr, \ptr, 128
|
||||
ld.qr q3, \ptr, .Lxchal_ofs_+0
|
||||
ld.qr q4, \ptr, .Lxchal_ofs_+16
|
||||
ld.qr q5, \ptr, .Lxchal_ofs_+32
|
||||
ld.qr q6, \ptr, .Lxchal_ofs_+48
|
||||
ld.qr q7, \ptr, .Lxchal_ofs_+64
|
||||
.set .Lxchal_pofs_, .Lxchal_pofs_ + 128
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 80
|
||||
.elseif ((XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0
|
||||
xchal_sa_align \ptr, 0, 0, 16, 16
|
||||
.set .Lxchal_ofs_, .Lxchal_ofs_ + 208
|
||||
.endif
|
||||
.endm // xchal_cp3_load
|
||||
|
||||
#define XCHAL_CP3_NUM_ATMPS 1
|
||||
#define XCHAL_SA_NUM_ATMPS 1
|
||||
|
||||
/* Empty macros for unconfigured coprocessors: */
|
||||
.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
|
||||
.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
|
||||
.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
|
||||
.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
|
||||
.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
|
||||
.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 /* __ARCH_XTENSA_INCLUDE_ESP32S3_TIE_ASM_H */
|
||||
@@ -0,0 +1,209 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/include/esp32s3/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.
|
||||
*
|
||||
* Customer ID=15128; Build=0x90f1f;
|
||||
* Copyright (c) 1999-2021 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 __ARCH_XTENSA_INCLUDE_ESP32S3_TIE_H
|
||||
#define __ARCH_XTENSA_INCLUDE_ESP32S3_TIE_H
|
||||
|
||||
#define XCHAL_CP_NUM 2 /* number of coprocessors */
|
||||
#define XCHAL_CP_MAX 4 /* max CP ID + 1 (0 if none) */
|
||||
#define XCHAL_CP_MASK 0x09 /* bitmask of all CPs by ID */
|
||||
#define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */
|
||||
|
||||
/* Basic parameters of each coprocessor: */
|
||||
#define XCHAL_CP0_NAME "FPU"
|
||||
#define XCHAL_CP0_IDENT FPU
|
||||
#define XCHAL_CP0_SA_SIZE 72 /* size of state save area */
|
||||
#define XCHAL_CP0_SA_ALIGN 4 /* min alignment of save area */
|
||||
#define XCHAL_CP_ID_FPU 0 /* coprocessor ID (0..7) */
|
||||
#define XCHAL_CP3_NAME "cop_ai"
|
||||
#define XCHAL_CP3_IDENT cop_ai
|
||||
#define XCHAL_CP3_SA_SIZE 208 /* size of state save area */
|
||||
#define XCHAL_CP3_SA_ALIGN 16 /* min alignment of save area */
|
||||
#define XCHAL_CP_ID_COP_AI 3 /* coprocessor ID (0..7) */
|
||||
|
||||
/* Filler info for unassigned coprocessors, to simplify arrays etc: */
|
||||
#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_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
|
||||
|
||||
/* Save area for non-coprocessor optional and custom (TIE) state: */
|
||||
#define XCHAL_NCP_SA_SIZE 36
|
||||
#define XCHAL_NCP_SA_ALIGN 4
|
||||
|
||||
/* Total save area for optional and custom state (NCP + CPn): */
|
||||
#define XCHAL_TOTAL_SA_SIZE 336 /* with 16-byte align padding */
|
||||
#define XCHAL_TOTAL_SA_ALIGN 16 /* 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 <xtensa-libdb-macros.h>)
|
||||
* 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 9
|
||||
#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) \
|
||||
XCHAL_SA_REG(s,1,0,0,1, acclo, 4, 4, 4,0x0210, sr,16 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,1,0,0,1, acchi, 4, 4, 4,0x0211, sr,17 , 8,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,0,1, br, 4, 4, 4,0x0204, sr,4 , 16,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,0,1, scompare1, 4, 4, 4,0x020C, sr,12 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,0,1, m0, 4, 4, 4,0x0220, sr,32 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,0,1, m1, 4, 4, 4,0x0221, sr,33 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,0,1, m2, 4, 4, 4,0x0222, sr,34 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,0,1, m3, 4, 4, 4,0x0223, sr,35 , 32,0,0,0)
|
||||
|
||||
#define XCHAL_CP0_SA_NUM 18
|
||||
#define XCHAL_CP0_SA_LIST(s) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, fcr, 4, 4, 4,0x03E8, ur,232, 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, fsr, 4, 4, 4,0x03E9, ur,233, 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f0, 4, 4, 4,0x0030, f,0 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f1, 4, 4, 4,0x0031, f,1 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f2, 4, 4, 4,0x0032, f,2 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f3, 4, 4, 4,0x0033, f,3 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f4, 4, 4, 4,0x0034, f,4 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f5, 4, 4, 4,0x0035, f,5 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f6, 4, 4, 4,0x0036, f,6 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f7, 4, 4, 4,0x0037, f,7 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f8, 4, 4, 4,0x0038, f,8 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f9, 4, 4, 4,0x0039, f,9 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f10, 4, 4, 4,0x003A, f,10 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f11, 4, 4, 4,0x003B, f,11 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f12, 4, 4, 4,0x003C, f,12 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f13, 4, 4, 4,0x003D, f,13 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f14, 4, 4, 4,0x003E, f,14 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, f15, 4, 4, 4,0x003F, f,15 , 32,0,0,0)
|
||||
|
||||
#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 26
|
||||
#define XCHAL_CP3_SA_LIST(s) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, accx_0,16, 4, 4,0x0300, ur,0 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, accx_1, 4, 4, 4,0x0301, ur,1 , 8,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, qacc_h_0, 4, 4, 4,0x0302, ur,2 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, qacc_h_1, 4, 4, 4,0x0303, ur,3 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, qacc_h_2, 4, 4, 4,0x0304, ur,4 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, qacc_h_3, 4, 4, 4,0x0305, ur,5 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, qacc_h_4, 4, 4, 4,0x0306, ur,6 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, qacc_l_0, 4, 4, 4,0x0307, ur,7 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, qacc_l_1, 4, 4, 4,0x0308, ur,8 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, qacc_l_2, 4, 4, 4,0x0309, ur,9 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, qacc_l_3, 4, 4, 4,0x030A, ur,10 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, qacc_l_4, 4, 4, 4,0x030B, ur,11 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, sar_byte, 4, 4, 4,0x030D, ur,13 , 4,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, fft_bit_width, 4, 4, 4,0x030E, ur,14 , 4,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, ua_state_0, 4, 4, 4,0x030F, ur,15 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, ua_state_1, 4, 4, 4,0x0310, ur,16 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, ua_state_2, 4, 4, 4,0x0311, ur,17 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,1,0, ua_state_3, 4, 4, 4,0x0312, ur,18 , 32,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, q0,16,16,16,0x1008, q,0 ,128,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, q1,16,16,16,0x1009, q,1 ,128,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, q2,16,16,16,0x100A, q,2 ,128,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, q3,16,16,16,0x100B, q,3 ,128,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, q4,16,16,16,0x100C, q,4 ,128,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, q5,16,16,16,0x100D, q,5 ,128,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, q6,16,16,16,0x100E, q,6 ,128,0,0,0) \
|
||||
XCHAL_SA_REG(s,0,0,2,0, q7,16,16,16,0x100F, q,7 ,128,0,0,0)
|
||||
|
||||
#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,4,4
|
||||
/* 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,4,4, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4,\
|
||||
3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4,\
|
||||
3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4,\
|
||||
3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4,\
|
||||
3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4,\
|
||||
3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4,\
|
||||
3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4,\
|
||||
3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,4,4
|
||||
|
||||
#endif /* __ARCH_XTENSA_INCLUDE_ESP32S3_TIE_H */
|
||||
@@ -0,0 +1,62 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/include/lx7/chip.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_INCLUDE_LX7_CHIP_H
|
||||
#define __ARCH_XTENSA_INCLUDE_LX7_CHIP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_XTENSA_INCLUDE_LX7_CHIP_H */
|
||||
@@ -0,0 +1 @@
|
||||
/esp-nuttx-bootloader
|
||||
@@ -0,0 +1,88 @@
|
||||
############################################################################
|
||||
# arch/xtensa/src/esp32s3/Bootloader.mk
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_ESP32S3_BOOTLOADER_BUILD_FROM_SOURCE),y)
|
||||
|
||||
CHIPDIR = $(TOPDIR)/arch/xtensa/src/chip
|
||||
|
||||
BOOTLOADER_SRCDIR = $(CHIPDIR)/esp-nuttx-bootloader
|
||||
BOOTLOADER_VERSION = main
|
||||
BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader
|
||||
BOOTLOADER_OUTDIR = out
|
||||
BOOTLOADER_CONFIG = $(CHIPDIR)/bootloader.conf
|
||||
|
||||
$(BOOTLOADER_SRCDIR):
|
||||
$(Q) git clone $(BOOTLOADER_URL) $(BOOTLOADER_SRCDIR) -b $(BOOTLOADER_VERSION)
|
||||
|
||||
# Helpers for creating the configuration file
|
||||
|
||||
cfg_en = echo "$(1)=y";
|
||||
cfg_val = echo "$(1)=$(2)";
|
||||
|
||||
$(BOOTLOADER_CONFIG): $(TOPDIR)/.config
|
||||
$(Q) echo "Creating Bootloader configuration"
|
||||
$(Q) { \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_4M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHSIZE_4MB)) \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_8M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHSIZE_8MB)) \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_16M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHSIZE_16MB)) \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_MODE_DIO),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHMODE_DIO)) \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_MODE_DOUT),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHMODE_DOUT)) \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_MODE_QIO),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHMODE_QIO)) \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_MODE_QOUT),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHMODE_QOUT)) \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_FREQ_120M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_120M)) \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_FREQ_80M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_80M)) \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_FREQ_40M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_40M)) \
|
||||
$(if $(CONFIG_ESP32S3_FLASH_FREQ_20M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_20M)) \
|
||||
} > $(BOOTLOADER_CONFIG)
|
||||
ifeq ($(CONFIG_ESP32S3_APP_FORMAT_LEGACY),y)
|
||||
$(Q) { \
|
||||
$(call cfg_en,CONFIG_PARTITION_TABLE_CUSTOM) \
|
||||
$(call cfg_val,CONFIG_PARTITION_TABLE_CUSTOM_FILENAME,\"partitions.csv\") \
|
||||
$(call cfg_val,CONFIG_PARTITION_TABLE_OFFSET,$(CONFIG_ESP32S3_PARTITION_TABLE_OFFSET)) \
|
||||
} >> $(BOOTLOADER_CONFIG)
|
||||
endif
|
||||
|
||||
bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
|
||||
$(Q) echo "Building Bootloader binaries"
|
||||
$(Q) $(BOOTLOADER_SRCDIR)/build_idfboot.sh -c esp32s3 -s -f $(BOOTLOADER_CONFIG)
|
||||
$(call COPYFILE,$(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/bootloader-esp32s3.bin,$(TOPDIR))
|
||||
$(call COPYFILE,$(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/partition-table-esp32s3.bin,$(TOPDIR))
|
||||
|
||||
clean_bootloader:
|
||||
$(call DELDIR,$(BOOTLOADER_SRCDIR))
|
||||
$(call DELFILE,$(BOOTLOADER_CONFIG))
|
||||
$(call DELFILE,$(TOPDIR)/bootloader-esp32s3.bin)
|
||||
$(call DELFILE,$(TOPDIR)/partition-table-esp32s3.bin)
|
||||
|
||||
else ifeq ($(CONFIG_ESP32S3_BOOTLOADER_DOWNLOAD_PREBUILT),y)
|
||||
|
||||
BOOTLOADER_VERSION = latest
|
||||
BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader/releases/download/$(BOOTLOADER_VERSION)
|
||||
|
||||
bootloader:
|
||||
$(Q) echo "Downloading Bootloader binaries"
|
||||
$(Q) curl -L $(BOOTLOADER_URL)/bootloader-esp32s3.bin -o $(TOPDIR)/bootloader-esp32s3.bin
|
||||
$(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32s3.bin -o $(TOPDIR)/partition-table-esp32s3.bin
|
||||
|
||||
clean_bootloader:
|
||||
$(call DELFILE,$(TOPDIR)/bootloader-esp32s3.bin)
|
||||
$(call DELFILE,$(TOPDIR)/partition-table-esp32s3.bin)
|
||||
|
||||
endif
|
||||
@@ -0,0 +1,461 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_CHIP_ESP32S3
|
||||
|
||||
comment "ESP32-S3 Configuration Options"
|
||||
|
||||
choice
|
||||
prompt "ESP32-S3 Chip Selection"
|
||||
default ARCH_CHIP_ESP32S3WROOM1
|
||||
|
||||
config ARCH_CHIP_ESP32S3WROOM1
|
||||
bool "ESP32-S3-WROOM-1"
|
||||
select ESP32S3_FLASH_4M
|
||||
---help---
|
||||
Generic module with an embedded ESP32-S3.
|
||||
|
||||
config ARCH_CHIP_ESP32S3WROOM2
|
||||
bool "ESP32-S3-WROOM-2"
|
||||
select ESP32S3_FLASH_16M
|
||||
select ESP32S3_PSRAM_8M
|
||||
---help---
|
||||
Generic module with an embedded ESP32-S3.
|
||||
|
||||
config ARCH_CHIP_ESP32S3MINI1
|
||||
bool "ESP32-S3-MINI-1"
|
||||
select ESP32S3_FLASH_8M
|
||||
---help---
|
||||
Generic module with an embedded ESP32-S3.
|
||||
|
||||
endchoice # ESP32-S3 Chip Selection
|
||||
|
||||
choice ESP32S3_DEFAULT_CPU_FREQ
|
||||
prompt "CPU frequency"
|
||||
default ESP32S3_DEFAULT_CPU_FREQ_240
|
||||
---help---
|
||||
CPU frequency to be set on application startup.
|
||||
|
||||
config ESP32S3_DEFAULT_CPU_FREQ_80
|
||||
bool "80 MHz"
|
||||
|
||||
config ESP32S3_DEFAULT_CPU_FREQ_160
|
||||
bool "160 MHz"
|
||||
|
||||
config ESP32S3_DEFAULT_CPU_FREQ_240
|
||||
bool "240 MHz"
|
||||
|
||||
endchoice # CPU frequency
|
||||
|
||||
config ESP32S3_DEFAULT_CPU_FREQ_MHZ
|
||||
int
|
||||
default 80 if ESP32S3_DEFAULT_CPU_FREQ_80
|
||||
default 160 if ESP32S3_DEFAULT_CPU_FREQ_160
|
||||
default 240 if ESP32S3_DEFAULT_CPU_FREQ_240
|
||||
|
||||
menu "Cache config"
|
||||
|
||||
choice
|
||||
prompt "Instruction cache size"
|
||||
default ESP32S3_INSTRUCTION_CACHE_16KB
|
||||
---help---
|
||||
Instruction cache size to be set on application startup.
|
||||
If you use 16KB instruction cache rather than 32KB instruction cache,
|
||||
then the other 16KB will be managed by heap allocator.
|
||||
|
||||
config ESP32S3_INSTRUCTION_CACHE_16KB
|
||||
bool "16KB"
|
||||
---help---
|
||||
Use 16KB of SRAM as Instruction Cache
|
||||
|
||||
config ESP32S3_INSTRUCTION_CACHE_32KB
|
||||
bool "32KB"
|
||||
---help---
|
||||
Use 32KB of SRAM as Instruction Cache
|
||||
|
||||
endchoice # Instruction cache size
|
||||
|
||||
config ESP32S3_INSTRUCTION_CACHE_SIZE
|
||||
hex
|
||||
default 0x4000 if ESP32S3_INSTRUCTION_CACHE_16KB
|
||||
default 0x8000 if ESP32S3_INSTRUCTION_CACHE_32KB
|
||||
|
||||
choice ESP32S3_ICACHE_ASSOCIATED_WAYS
|
||||
prompt "Instruction cache associated ways"
|
||||
default ESP32S3_INSTRUCTION_CACHE_8WAYS
|
||||
---help---
|
||||
Instruction cache associated ways to be set on application startup.
|
||||
|
||||
config ESP32S3_INSTRUCTION_CACHE_4WAYS
|
||||
bool "4 ways"
|
||||
|
||||
config ESP32S3_INSTRUCTION_CACHE_8WAYS
|
||||
bool "8 ways"
|
||||
|
||||
endchoice
|
||||
|
||||
config ESP32S3_ICACHE_ASSOCIATED_WAYS
|
||||
int
|
||||
default 4 if ESP32S3_INSTRUCTION_CACHE_4WAYS
|
||||
default 8 if ESP32S3_INSTRUCTION_CACHE_8WAYS
|
||||
|
||||
choice ESP32S3_INSTRUCTION_CACHE_LINE_SIZE
|
||||
prompt "Instruction cache line size"
|
||||
default ESP32S3_INSTRUCTION_CACHE_LINE_32B
|
||||
---help---
|
||||
Instruction cache line size to be set on application startup.
|
||||
|
||||
config ESP32S3_INSTRUCTION_CACHE_LINE_16B
|
||||
bool "16 Bytes"
|
||||
depends on ESP32S3_INSTRUCTION_CACHE_16KB
|
||||
|
||||
config ESP32S3_INSTRUCTION_CACHE_LINE_32B
|
||||
bool "32 Bytes"
|
||||
|
||||
endchoice
|
||||
|
||||
config ESP32S3_INSTRUCTION_CACHE_LINE_SIZE
|
||||
int
|
||||
default 16 if ESP32S3_INSTRUCTION_CACHE_LINE_16B
|
||||
default 32 if ESP32S3_INSTRUCTION_CACHE_LINE_32B
|
||||
|
||||
choice
|
||||
prompt "Data cache size"
|
||||
default ESP32S3_DATA_CACHE_32KB
|
||||
---help---
|
||||
Data cache size to be set on application startup.
|
||||
If you use 32KB data cache rather than 64KB data cache,
|
||||
the other 32KB will be added to the heap.
|
||||
|
||||
config ESP32S3_DATA_CACHE_16KB
|
||||
bool "16KB"
|
||||
---help---
|
||||
Use 16KB of SRAM as Data Cache
|
||||
|
||||
config ESP32S3_DATA_CACHE_32KB
|
||||
bool "32KB"
|
||||
---help---
|
||||
Use 32KB of SRAM as Data Cache
|
||||
|
||||
config ESP32S3_DATA_CACHE_64KB
|
||||
bool "64KB"
|
||||
---help---
|
||||
Use 64KB of SRAM as Data Cache
|
||||
|
||||
endchoice # Data cache size
|
||||
|
||||
config ESP32S3_DATA_CACHE_SIZE
|
||||
hex
|
||||
# For 16KB the actual configuration is 32kb cache, but 16kb will be reserved for heap at startup
|
||||
default 0x8000 if ESP32S3_DATA_CACHE_16KB
|
||||
default 0x8000 if ESP32S3_DATA_CACHE_32KB
|
||||
default 0x10000 if ESP32S3_DATA_CACHE_64KB
|
||||
|
||||
choice ESP32S3_DCACHE_ASSOCIATED_WAYS
|
||||
prompt "Data cache associated ways"
|
||||
default ESP32S3_DATA_CACHE_8WAYS
|
||||
---help---
|
||||
Data cache associated ways to be set on application startup.
|
||||
|
||||
config ESP32S3_DATA_CACHE_4WAYS
|
||||
bool "4 ways"
|
||||
|
||||
config ESP32S3_DATA_CACHE_8WAYS
|
||||
bool "8 ways"
|
||||
|
||||
endchoice
|
||||
|
||||
config ESP32S3_DCACHE_ASSOCIATED_WAYS
|
||||
int
|
||||
default 4 if ESP32S3_DATA_CACHE_4WAYS
|
||||
default 8 if ESP32S3_DATA_CACHE_8WAYS
|
||||
|
||||
choice ESP32S3_DATA_CACHE_LINE_SIZE
|
||||
prompt "Data cache line size"
|
||||
default ESP32S3_DATA_CACHE_LINE_32B
|
||||
---help---
|
||||
Data cache line size to be set on application startup.
|
||||
|
||||
config ESP32S3_DATA_CACHE_LINE_16B
|
||||
bool "16 Bytes"
|
||||
depends on ESP32S3_DATA_CACHE_16KB || ESP32S3_DATA_CACHE_32KB
|
||||
|
||||
config ESP32S3_DATA_CACHE_LINE_32B
|
||||
bool "32 Bytes"
|
||||
|
||||
config ESP32S3_DATA_CACHE_LINE_64B
|
||||
bool "64 Bytes"
|
||||
|
||||
endchoice
|
||||
|
||||
config ESP32S3_DATA_CACHE_LINE_SIZE
|
||||
int
|
||||
default 16 if ESP32S3_DATA_CACHE_LINE_16B
|
||||
default 32 if ESP32S3_DATA_CACHE_LINE_32B
|
||||
default 64 if ESP32S3_DATA_CACHE_LINE_64B
|
||||
|
||||
endmenu # Cache config
|
||||
|
||||
config ESP32S3_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.
|
||||
|
||||
config ESP32S3_ULP_COPROC_RESERVE_MEM
|
||||
int
|
||||
prompt "RTC slow memory reserved for coprocessor" if ESP32S3_ULP_COPROC_ENABLED
|
||||
default 512 if ESP32S3_ULP_COPROC_ENABLED
|
||||
range 32 8176 if ESP32S3_ULP_COPROC_ENABLED
|
||||
default 0 if !ESP32S3_ULP_COPROC_ENABLED
|
||||
range 0 0 if !ESP32S3_ULP_COPROC_ENABLED
|
||||
help
|
||||
Bytes of memory to reserve for ULP coprocessor firmware & data.
|
||||
Data is reserved at the beginning of RTC slow memory.
|
||||
|
||||
config ESP32S3_FLASH_4M
|
||||
bool
|
||||
default n
|
||||
|
||||
config ESP32S3_FLASH_8M
|
||||
bool
|
||||
default n
|
||||
|
||||
config ESP32S3_FLASH_16M
|
||||
bool
|
||||
default n
|
||||
|
||||
config ESP32S3_ESPTOOLPY_NO_STUB
|
||||
bool "Disable download stub"
|
||||
default n
|
||||
---help---
|
||||
The flasher tool sends a precompiled download stub first by default.
|
||||
That stub allows things like compressed downloads and more.
|
||||
Usually you should not need to disable that feature.
|
||||
It is only required to be disabled in certain scenarios when either
|
||||
Secure Boot V2 or Flash Encryption is enabled.
|
||||
|
||||
config ESP32S3_FLASH_DETECT
|
||||
bool "Auto-detect FLASH size"
|
||||
default y
|
||||
---help---
|
||||
Auto detect flash size when flashing.
|
||||
|
||||
config ESP32S3_PSRAM_8M
|
||||
bool
|
||||
default n
|
||||
|
||||
choice ESP32S3_FLASH_MODE
|
||||
prompt "SPI FLASH mode"
|
||||
default ESP32S3_FLASH_MODE_DIO
|
||||
---help---
|
||||
These options control how many I/O pins are used for communication
|
||||
with the attached SPI flash chip.
|
||||
The option selected here is then used by esptool when flashing.
|
||||
|
||||
config ESP32S3_FLASH_MODE_DIO
|
||||
bool "Dual IO (DIO)"
|
||||
|
||||
config ESP32S3_FLASH_MODE_DOUT
|
||||
bool "Dual Output (DOUT)"
|
||||
|
||||
config ESP32S3_FLASH_MODE_QIO
|
||||
bool "Quad IO (QIO)"
|
||||
|
||||
config ESP32S3_FLASH_MODE_QOUT
|
||||
bool "Quad Output (QOUT)"
|
||||
|
||||
endchoice # ESP32S3_FLASH_MODE
|
||||
|
||||
choice ESP32S3_FLASH_FREQ
|
||||
prompt "SPI FLASH frequency"
|
||||
default ESP32S3_FLASH_FREQ_40M
|
||||
---help---
|
||||
SPI FLASH frequency
|
||||
|
||||
config ESP32S3_FLASH_FREQ_120M
|
||||
bool "120 MHz"
|
||||
|
||||
config ESP32S3_FLASH_FREQ_80M
|
||||
bool "80 MHz"
|
||||
|
||||
config ESP32S3_FLASH_FREQ_40M
|
||||
bool "40 MHz"
|
||||
|
||||
config ESP32S3_FLASH_FREQ_20M
|
||||
bool "20 MHz"
|
||||
|
||||
endchoice # ESP32S3_FLASH_FREQ
|
||||
|
||||
config ESP32S3_RUN_IRAM
|
||||
bool "Run from IRAM"
|
||||
default n
|
||||
---help---
|
||||
This loads all of NuttX inside IRAM. Used to test somewhat small
|
||||
images that can fit entirely in IRAM.
|
||||
|
||||
menu "ESP32-S3 Peripheral Selection"
|
||||
|
||||
config ESP32S3_UART
|
||||
bool
|
||||
default n
|
||||
|
||||
config ESP32S3_UART0
|
||||
bool "UART 0"
|
||||
default n
|
||||
select ESP32S3_UART
|
||||
select UART0_SERIALDRIVER
|
||||
select ARCH_HAVE_SERIAL_TERMIOS
|
||||
|
||||
config ESP32S3_UART1
|
||||
bool "UART 1"
|
||||
default n
|
||||
select ESP32S3_UART
|
||||
select UART1_SERIALDRIVER
|
||||
select ARCH_HAVE_SERIAL_TERMIOS
|
||||
|
||||
config ESP32S3_UART2
|
||||
bool "UART 2"
|
||||
default n
|
||||
select ESP32S3_UART
|
||||
select UART2_SERIALDRIVER
|
||||
select ARCH_HAVE_SERIAL_TERMIOS
|
||||
|
||||
endmenu # ESP32S3 Peripheral Selection
|
||||
|
||||
menu "UART configuration"
|
||||
depends on ESP32S3_UART
|
||||
|
||||
if ESP32S3_UART0
|
||||
|
||||
config ESP32S3_UART0_TXPIN
|
||||
int "UART0 Tx Pin"
|
||||
default 43
|
||||
range 0 48
|
||||
|
||||
config ESP32S3_UART0_RXPIN
|
||||
int "UART0 Rx Pin"
|
||||
default 44
|
||||
range 0 48
|
||||
|
||||
config ESP32S3_UART0_RTSPIN
|
||||
int "UART0 RTS Pin"
|
||||
depends on SERIAL_IFLOWCONTROL
|
||||
default 15
|
||||
range 0 48
|
||||
|
||||
config ESP32S3_UART0_CTSPIN
|
||||
int "UART0 CTS Pin"
|
||||
depends on SERIAL_OFLOWCONTROL
|
||||
default 16
|
||||
range 0 48
|
||||
|
||||
endif # ESP32S3_UART0
|
||||
|
||||
if ESP32S3_UART1
|
||||
|
||||
config ESP32S3_UART1_TXPIN
|
||||
int "UART1 Tx Pin"
|
||||
default 17
|
||||
range 0 48
|
||||
|
||||
config ESP32S3_UART1_RXPIN
|
||||
int "UART1 Rx Pin"
|
||||
default 18
|
||||
range 0 48
|
||||
|
||||
config ESP32S3_UART1_RTSPIN
|
||||
int "UART1 RTS Pin"
|
||||
depends on SERIAL_IFLOWCONTROL
|
||||
default 19
|
||||
range 0 48
|
||||
|
||||
config ESP32S3_UART1_CTSPIN
|
||||
int "UART1 CTS Pin"
|
||||
depends on SERIAL_OFLOWCONTROL
|
||||
default 20
|
||||
range 0 48
|
||||
|
||||
endif # ESP32S3_UART1
|
||||
|
||||
if ESP32S3_UART2
|
||||
|
||||
config ESP32S3_UART2_TXPIN
|
||||
int "UART2 Tx Pin"
|
||||
default 17
|
||||
range 0 48
|
||||
|
||||
config ESP32S3_UART2_RXPIN
|
||||
int "UART2 Rx Pin"
|
||||
default 16
|
||||
range 0 48
|
||||
|
||||
config ESP32S3_UART2_RTSPIN
|
||||
int "UART2 RTS Pin"
|
||||
depends on SERIAL_IFLOWCONTROL
|
||||
default 35
|
||||
range 0 48
|
||||
|
||||
config ESP32S3_UART2_CTSPIN
|
||||
int "UART2 CTS Pin"
|
||||
depends on SERIAL_OFLOWCONTROL
|
||||
default 36
|
||||
range 0 48
|
||||
|
||||
endif # ESP32S3_UART2
|
||||
|
||||
endmenu # UART configuration
|
||||
|
||||
menu "Application Image Configuration"
|
||||
|
||||
choice
|
||||
prompt "Application Image Format"
|
||||
default ESP32S3_APP_FORMAT_LEGACY
|
||||
---help---
|
||||
Depending on the chosen 2nd stage bootloader, the application may
|
||||
be required to be perform a specific startup routine. Furthermore,
|
||||
the image binary must be formatted according to the definition from
|
||||
the 2nd stage bootloader.
|
||||
|
||||
config ESP32S3_APP_FORMAT_LEGACY
|
||||
bool "Legacy format"
|
||||
---help---
|
||||
This is the legacy application image format, as supported by the ESP-IDF
|
||||
2nd stage bootloader.
|
||||
|
||||
endchoice # Application Image Format
|
||||
|
||||
choice
|
||||
prompt "Source for bootloader binaries"
|
||||
default ESP32S3_BOOTLOADER_DOWNLOAD_PREBUILT
|
||||
---help---
|
||||
Select the action to be taken by the build system for the
|
||||
"make bootloader" target.
|
||||
|
||||
config ESP32S3_BOOTLOADER_DOWNLOAD_PREBUILT
|
||||
bool "Download prebuilt binaries"
|
||||
---help---
|
||||
The build system will download the prebuilt binaries from
|
||||
https://github.com/espressif/esp-nuttx-bootloader according to the chosen
|
||||
Application Image Format (ESP32S3_APP_FORMAT_LEGACY or ESP32S3_APP_FORMAT_MCUBOOT)
|
||||
|
||||
config ESP32S3_BOOTLOADER_BUILD_FROM_SOURCE
|
||||
bool "Build binaries from source"
|
||||
---help---
|
||||
The build system will build all the required binaries from source. It will clone
|
||||
the https://github.com/espressif/esp-nuttx-bootloader repository and build a
|
||||
custom bootloader according to the chosen Application Image Format
|
||||
(ESP32S3_APP_FORMAT_LEGACY or ESP32S3_APP_FORMAT_MCUBOOT) and partition information.
|
||||
|
||||
endchoice
|
||||
|
||||
config ESP32S3_PARTITION_TABLE_OFFSET
|
||||
hex "Partition Table offset"
|
||||
default 0x8000
|
||||
depends on ESP32S3_APP_FORMAT_LEGACY
|
||||
|
||||
endmenu # Application Image Configuration
|
||||
|
||||
endif # ARCH_CHIP_ESP32S3
|
||||
@@ -0,0 +1,74 @@
|
||||
############################################################################
|
||||
# arch/xtensa/src/esp32s3/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you 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 chip/Bootloader.mk
|
||||
|
||||
# The start-up, "head", file. May be either a .S or a .c file.
|
||||
|
||||
HEAD_ASRC = xtensa_vectors.S xtensa_window_vector.S xtensa_windowspill.S
|
||||
HEAD_ASRC += xtensa_int_handlers.S xtensa_user_handler.S
|
||||
HEAD_CSRC = esp32s3_start.c
|
||||
|
||||
# Common XTENSA files (arch/xtensa/src/common)
|
||||
|
||||
CMN_ASRCS = xtensa_context.S xtensa_coproc.S xtensa_cpuint.S xtensa_panic.S
|
||||
CMN_ASRCS += xtensa_sigtramp.S
|
||||
|
||||
CMN_CSRCS = xtensa_assert.c xtensa_blocktask.c xtensa_copystate.c
|
||||
CMN_CSRCS += xtensa_cpenable.c xtensa_createstack.c xtensa_exit.c
|
||||
CMN_CSRCS += xtensa_initialize.c xtensa_initialstate.c xtensa_interruptcontext.c
|
||||
CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c xtensa_mdelay.c
|
||||
CMN_CSRCS += xtensa_modifyreg8.c xtensa_modifyreg16.c xtensa_modifyreg32.c
|
||||
CMN_CSRCS += xtensa_puts.c xtensa_releasepending.c xtensa_releasestack.c
|
||||
CMN_CSRCS += xtensa_reprioritizertr.c xtensa_schedsigaction.c
|
||||
CMN_CSRCS += xtensa_sigdeliver.c xtensa_stackframe.c xtensa_udelay.c
|
||||
CMN_CSRCS += xtensa_unblocktask.c xtensa_usestack.c
|
||||
|
||||
# Configuration-dependent common XTENSA files
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_ALERT),y)
|
||||
CMN_CSRCS += xtensa_dumpstate.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SPINLOCK),y)
|
||||
CMN_CSRCS += xtensa_testset.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||
CMN_CSRCS += xtensa_checkstack.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_XTENSA_SEMIHOSTING_HOSTFS),y)
|
||||
CMN_ASRCS += xtensa_simcall.S
|
||||
CMN_CSRCS += xtensa_hostfs.c
|
||||
endif
|
||||
|
||||
# Required ESP32-S3 files (arch/xtensa/src/esp32s3)
|
||||
|
||||
CHIP_CSRCS = esp32s3_irq.c esp32s3_clockconfig.c esp32s3_region.c
|
||||
CHIP_CSRCS += esp32s3_timerisr.c esp32s3_user.c esp32s3_allocateheap.c
|
||||
CHIP_CSRCS += esp32s3_wdt.c esp32s3_gpio.c esp32s3_lowputc.c esp32s3_serial.c
|
||||
CHIP_CSRCS += esp32s3_systemreset.c
|
||||
|
||||
# Configuration-dependent ESP32-S3 files
|
||||
|
||||
ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y)
|
||||
CHIP_CSRCS += esp32s3_idle.c
|
||||
endif
|
||||
@@ -0,0 +1,61 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/chip.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_CHIP_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_CHIP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "chip_macros.h"
|
||||
#include "chip_memory.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_CHIP_H */
|
||||
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/chip_macros.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_CHIP_MACROS_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_CHIP_MACROS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* This is the name of the section containing the Xtensa low level handlers
|
||||
* that is used by the board linker scripts.
|
||||
*/
|
||||
|
||||
#define HANDLER_SECTION .iram1
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Assembly Language Macros
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
|
||||
/* Macro to get the current core ID. Only uses the reg given as an argument.
|
||||
* Reading PRID on the ESP108 architecture gives us 0xcdcd on the PRO
|
||||
* processor and 0xabab on the APP CPU. We distinguish between the two by
|
||||
* simply checking bit 1: it's 1 on the APP and 0 on the PRO processor.
|
||||
*/
|
||||
|
||||
.macro getcoreid reg
|
||||
rsr.prid \reg
|
||||
bbci \reg, 1, 1f
|
||||
movi \reg, 1
|
||||
j 2f
|
||||
1:
|
||||
movi \reg, 0
|
||||
2:
|
||||
.endm
|
||||
|
||||
#endif /* __ASSEMBLY */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_CHIP_MACROS_H */
|
||||
@@ -0,0 +1,73 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/chip_memory.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_CHIP_MEMORY_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_CHIP_MEMORY_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "hardware/esp32s3_soc.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_sp_sane
|
||||
****************************************************************************/
|
||||
|
||||
static inline bool xtensa_sp_sane(uint32_t sp)
|
||||
{
|
||||
return (esp32s3_sp_dram(sp) && ((sp & 0x0f) == 0));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_ptr_extram
|
||||
****************************************************************************/
|
||||
|
||||
static inline bool xtensa_ptr_exec(const void *p)
|
||||
{
|
||||
return esp32s3_ptr_exec(p);
|
||||
}
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_CHIP_MEMORY_H */
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_allocateheap.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/mm/mm.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "xtensa.h"
|
||||
|
||||
#include "hardware/esp32s3_rom_layout.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_allocate_heap
|
||||
*
|
||||
* Description:
|
||||
* This function will be called to dynamically set aside the heap region.
|
||||
*
|
||||
* For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and
|
||||
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
|
||||
* size of the unprotected, user-space heap.
|
||||
*
|
||||
* If a protected kernel-space heap is provided, the kernel heap must be
|
||||
* allocated (and protected) by an analogous up_allocate_kheap().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||
{
|
||||
board_autoled_on(LED_HEAPALLOCATE);
|
||||
|
||||
*heap_start = (void *)&_sheap;
|
||||
*heap_size = (size_t)(ets_rom_layout_p->dram0_rtos_reserved_start -
|
||||
(uintptr_t)&_sheap);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_add_region
|
||||
*
|
||||
* Description:
|
||||
* RAM may be added in non-contiguous chunks. This routine adds all chunks
|
||||
* that may be used for heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_MM_REGIONS > 1
|
||||
void xtensa_add_region(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,312 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_clockconfig.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "xtensa.h"
|
||||
#include "xtensa_attr.h"
|
||||
#include "hardware/esp32s3_soc.h"
|
||||
#include "hardware/esp32s3_uart.h"
|
||||
#include "hardware/esp32s3_system.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define DEFAULT_CPU_FREQ 80
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
enum cpu_freq_e
|
||||
{
|
||||
CPU_80M = 0,
|
||||
CPU_160M = 1,
|
||||
CPU_240M = 2,
|
||||
};
|
||||
|
||||
enum cpu_clksrc_e
|
||||
{
|
||||
XTAL_CLK,
|
||||
PLL_CLK,
|
||||
FOSC_CLK
|
||||
};
|
||||
|
||||
enum pll_freq_e
|
||||
{
|
||||
PLL_320,
|
||||
PLL_480
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* ROM Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ets_update_cpu_frequency
|
||||
*
|
||||
* Description:
|
||||
* 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.
|
||||
*
|
||||
* Input Parameters:
|
||||
* ticks_per_us - CPU ticks per us.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
extern void ets_update_cpu_frequency(uint32_t ticks_per_us);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ets_get_cpu_frequency
|
||||
*
|
||||
* Description:
|
||||
* 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.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* CPU ticks per us record in ets.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
extern uint32_t ets_get_cpu_frequency(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_cpuclksrc
|
||||
*
|
||||
* Description:
|
||||
* Select a clock source for CPU clock.
|
||||
*
|
||||
* Input Parameters:
|
||||
* src - Any source from cpu_clksrc_e.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void esp32s3_cpuclksrc(enum cpu_clksrc_e src)
|
||||
{
|
||||
uint32_t value;
|
||||
value = VALUE_TO_FIELD(src, SYSTEM_SOC_CLK_SEL);
|
||||
modifyreg32(SYSTEM_SYSCLK_CONF_REG, SYSTEM_SOC_CLK_SEL_M, value);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_cpudiv
|
||||
*
|
||||
* Description:
|
||||
* Select a divider for the CPU clk.
|
||||
* NOTE: The divider is not necessarily the real divisor. See TRM for the
|
||||
* equivalences.
|
||||
*
|
||||
* Input Parameters:
|
||||
* divider - A value between 0 to 2.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void esp32s3_cpudiv(uint8_t divider)
|
||||
{
|
||||
uint32_t value;
|
||||
value = VALUE_TO_FIELD(divider, SYSTEM_CPUPERIOD_SEL);
|
||||
modifyreg32(SYSTEM_CPU_PER_CONF_REG, SYSTEM_CPUPERIOD_SEL_M, value);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_pllfreqsel
|
||||
*
|
||||
* Description:
|
||||
* Select the PLL frequency.
|
||||
*
|
||||
* Input Parameters:
|
||||
* freq - Any clock from enum pll_freq_e
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
****************************************************************************/
|
||||
|
||||
static inline void esp32s3_pllfreqsel(enum pll_freq_e freq)
|
||||
{
|
||||
uint32_t value;
|
||||
value = VALUE_TO_FIELD(freq, SYSTEM_PLL_FREQ_SEL);
|
||||
modifyreg32(SYSTEM_CPU_PER_CONF_REG, SYSTEM_PLL_FREQ_SEL_M, value);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_update_cpu_freq
|
||||
*
|
||||
* Description:
|
||||
* 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.
|
||||
*
|
||||
* Input Parameters:
|
||||
* ticks_per_us - CPU ticks per us
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void IRAM_ATTR esp32s3_update_cpu_freq(uint32_t ticks_per_us)
|
||||
{
|
||||
/* Update scale factors used by esp_rom_delay_us */
|
||||
|
||||
ets_update_cpu_frequency(ticks_per_us);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_set_cpu_freq
|
||||
*
|
||||
* Description:
|
||||
* Switch to one of PLL-based frequencies.
|
||||
*
|
||||
* Input Parameters:
|
||||
* cpu_freq_mhz - Target CPU frequency
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void IRAM_ATTR esp32s3_set_cpu_freq(int cpu_freq_mhz)
|
||||
{
|
||||
switch (cpu_freq_mhz)
|
||||
{
|
||||
case 80:
|
||||
/* 80 MHz is obtained from the 480 MHz PLL.
|
||||
* In this case CPU_CLK = PLL_CLK / 6. Config the PLL as 480 MHz
|
||||
* with a 6 divider and set the source clock as PLL_CLK.
|
||||
*/
|
||||
|
||||
esp32s3_cpudiv(0);
|
||||
break;
|
||||
|
||||
case 160:
|
||||
/* 160 MHz is obtained from the 480 MHz PLL.
|
||||
* In this case CPU_CLK = PLL_CLK / 3. Config the PLL as 480 MHz
|
||||
* with a 3 divider and set the source clock as PLL_CLK.
|
||||
*/
|
||||
|
||||
esp32s3_cpudiv(1);
|
||||
break;
|
||||
|
||||
case 240:
|
||||
/* 240 MHz is obtained from the 480 MHz PLL.
|
||||
* In this case CPU_CLK = PLL_CLK / 2. Config the PLL as 480 MHz
|
||||
* with a 2 divider and set the source clock as PLL_CLK.
|
||||
*/
|
||||
|
||||
esp32s3_cpudiv(2);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* Unsupported clock config. */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
esp32s3_pllfreqsel(PLL_480);
|
||||
esp32s3_cpuclksrc(PLL_CLK);
|
||||
esp32s3_update_cpu_freq(cpu_freq_mhz);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_clockconfig
|
||||
*
|
||||
* Description:
|
||||
* Called to initialize the ESP32-S3. This does whatever setup is needed to
|
||||
* put the SoC in a usable state. This includes the initialization of
|
||||
* clocking using the settings in board.h.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_clockconfig(void)
|
||||
{
|
||||
/* Configure the CPU frequency */
|
||||
|
||||
esp32s3_set_cpu_freq(CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_clk_cpu_freq
|
||||
*
|
||||
* Description:
|
||||
* Get CPU frequency
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* CPU frequency
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int IRAM_ATTR esp_clk_cpu_freq(void)
|
||||
{
|
||||
return (int)ets_get_cpu_frequency() * MHZ;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_clk_apb_freq
|
||||
*
|
||||
* Description:
|
||||
* Return current APB clock frequency.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* APB clock frequency, in Hz
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int IRAM_ATTR esp_clk_apb_freq(void)
|
||||
{
|
||||
return MIN(ets_get_cpu_frequency(), 80) * MHZ;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_clockconfig.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_CLOCKCONFIG_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_CLOCKCONFIG_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_update_cpu_freq
|
||||
*
|
||||
* Description:
|
||||
* 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.
|
||||
*
|
||||
* Input Parameters:
|
||||
* ticks_per_us - CPU ticks per us
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_update_cpu_freq(uint32_t ticks_per_us);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_set_cpu_freq
|
||||
*
|
||||
* Description:
|
||||
* Switch to one of PLL-based frequencies.
|
||||
* Current frequency can be XTAL or PLL.
|
||||
*
|
||||
* Input Parameters:
|
||||
* cpu_freq_mhz - new CPU frequency
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_set_cpu_freq(int cpu_freq_mhz);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_clockconfig
|
||||
*
|
||||
* Description:
|
||||
* Called to initialize the ESP32-S3. This does whatever setup is needed to
|
||||
* put the SoC in a usable state. This includes the initialization of
|
||||
* clocking using the settings in board.h.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_clockconfig(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_clk_cpu_freq
|
||||
*
|
||||
* Description:
|
||||
* Get the current CPU frequency.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* CPU frequency in Hz.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp_clk_cpu_freq(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_clk_apb_freq
|
||||
*
|
||||
* Description:
|
||||
* Return current APB clock frequency.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* APB clock frequency in Hz.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp_clk_apb_freq(void);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_CLOCKCONFIG_H */
|
||||
@@ -0,0 +1,64 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_config.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_CONFIG_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_CONFIG_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <arch/chip/chip.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* UARTs ********************************************************************/
|
||||
|
||||
/* Are any UARTs enabled? */
|
||||
|
||||
#undef HAVE_UART_DEVICE
|
||||
#ifdef CONFIG_ESP32S3_UART
|
||||
# define HAVE_UART_DEVICE 1
|
||||
#endif
|
||||
|
||||
/* Serial Console ***********************************************************/
|
||||
|
||||
/* Is there a serial console? There should be no more than one defined. It
|
||||
* could be on any UARTn. n E {0,1}
|
||||
*/
|
||||
|
||||
#undef CONSOLE_UART
|
||||
#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_ESP32S3_UART0)
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# define CONSOLE_UART 1
|
||||
#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_ESP32S3_UART1)
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# define CONSOLE_UART 1
|
||||
#else
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_CONFIG_H */
|
||||
@@ -0,0 +1,205 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_gpio.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/irq.h>
|
||||
#include <arch/esp32s3/chip.h>
|
||||
|
||||
#include "xtensa.h"
|
||||
#include "esp32s3_irq.h"
|
||||
#include "hardware/esp32s3_iomux.h"
|
||||
#include "hardware/esp32s3_gpio.h"
|
||||
|
||||
#include "esp32s3_gpio.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_configgpio
|
||||
*
|
||||
* Description:
|
||||
* Configure a GPIO pin based on encoded pin attributes.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32s3_configgpio(int pin, gpio_pinattr_t attr)
|
||||
{
|
||||
uintptr_t regaddr;
|
||||
uint32_t func;
|
||||
uint32_t cntrl;
|
||||
uint32_t pin2func;
|
||||
|
||||
DEBUGASSERT(pin >= 0 && pin <= ESP32S3_NGPIOS);
|
||||
|
||||
func = 0;
|
||||
cntrl = 0;
|
||||
|
||||
/* Handle input pins */
|
||||
|
||||
if ((attr & INPUT) != 0)
|
||||
{
|
||||
putreg32((1ul << pin), GPIO_ENABLE_W1TC_REG);
|
||||
|
||||
/* Input enable */
|
||||
|
||||
func |= FUN_IE;
|
||||
|
||||
if ((attr & PULLUP) != 0)
|
||||
{
|
||||
func |= FUN_PU;
|
||||
}
|
||||
else if ((attr & PULLDOWN) != 0)
|
||||
{
|
||||
func |= FUN_PD;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle output pins */
|
||||
|
||||
if ((attr & OUTPUT) != 0)
|
||||
{
|
||||
putreg32((1ul << pin), GPIO_ENABLE_W1TS_REG);
|
||||
}
|
||||
|
||||
/* Add drivers */
|
||||
|
||||
func |= (uint32_t)(2ul << FUN_DRV_S);
|
||||
|
||||
/* Select the pad's function. If no function was given, consider it a
|
||||
* normal input or output (i.e. function1).
|
||||
*/
|
||||
|
||||
if ((attr & FUNCTION_MASK) != 0)
|
||||
{
|
||||
func |= (uint32_t)(((attr >> FUNCTION_SHIFT) - 1) << MCU_SEL_S);
|
||||
}
|
||||
else
|
||||
{
|
||||
func |= (uint32_t)(PIN_FUNC_GPIO << MCU_SEL_S);
|
||||
}
|
||||
|
||||
if ((attr & OPEN_DRAIN) != 0)
|
||||
{
|
||||
cntrl |= (1 << GPIO_PIN_PAD_DRIVER_S);
|
||||
}
|
||||
|
||||
/* Set the pin function to its register */
|
||||
|
||||
pin2func = (pin + 1) * 4;
|
||||
regaddr = REG_IO_MUX_BASE + pin2func;
|
||||
putreg32(func, regaddr);
|
||||
|
||||
regaddr = GPIO_REG(pin);
|
||||
putreg32(cntrl, regaddr);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_gpio_matrix_in
|
||||
*
|
||||
* Description:
|
||||
* Set gpio input to a signal
|
||||
* NOTE: one gpio can input to several signals
|
||||
* If gpio == 0x3c, cancel input to the signal, input 0 to signal.
|
||||
* If gpio == 0x3a, input nothing to signal.
|
||||
* If gpio == 0x38, cancel input to the signal, input 1 to signal.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_gpio_matrix_in(uint32_t gpio, uint32_t signal_idx, bool inv)
|
||||
{
|
||||
uint32_t regaddr = GPIO_FUNC0_IN_SEL_CFG_REG + (signal_idx * 4);
|
||||
uint32_t regval = (gpio << GPIO_FUNC0_IN_SEL_S);
|
||||
|
||||
if (inv)
|
||||
{
|
||||
regval |= GPIO_FUNC0_IN_INV_SEL;
|
||||
}
|
||||
|
||||
if (gpio != 0x3a)
|
||||
{
|
||||
regval |= GPIO_SIG0_IN_SEL;
|
||||
}
|
||||
|
||||
putreg32(regval, regaddr);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_gpio_matrix_out
|
||||
*
|
||||
* Description:
|
||||
* Set signal output to gpio
|
||||
* NOTE: one signal can output to several gpios
|
||||
* If signal_idx == 0x100, cancel output put to the gpio
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_gpio_matrix_out(uint32_t gpio, uint32_t signal_idx,
|
||||
bool out_inv, bool oen_inv)
|
||||
{
|
||||
uint32_t regaddr = GPIO_FUNC0_OUT_SEL_CFG_REG + (gpio * 4);
|
||||
uint32_t regval = signal_idx << GPIO_FUNC0_OUT_SEL_S;
|
||||
|
||||
if (gpio >= ESP32S3_NGPIOS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
putreg32(1ul << gpio, GPIO_ENABLE_W1TS_REG);
|
||||
|
||||
if (out_inv)
|
||||
{
|
||||
regval |= GPIO_FUNC0_OUT_INV_SEL;
|
||||
}
|
||||
|
||||
if (oen_inv)
|
||||
{
|
||||
regval |= GPIO_FUNC0_OEN_INV_SEL;
|
||||
}
|
||||
|
||||
putreg32(regval, regaddr);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_gpio.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_GPIO_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_GPIO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define MATRIX_DETACH_OUT_SIG 0x100 /* Detach an OUTPUT signal */
|
||||
#define MATRIX_DETACH_IN_LOW_PIN 0x3c /* Detach non-inverted INPUT signal */
|
||||
#define MATRIX_DETACH_IN_LOW_HIGH 0x38 /* Detach inverted INPUT signal */
|
||||
|
||||
/* Bit-encoded input to esp32s3_configgpio() ********************************/
|
||||
|
||||
/* Encoded pin attributes used with esp32s3_configgpio()
|
||||
*
|
||||
* 8 7 6 5 4 3 2 1 0
|
||||
* -- -- -- -- -- -- -- -- --
|
||||
* FN FN FN OD PD PU F O I
|
||||
*/
|
||||
|
||||
#define PINMODE_SHIFT 0
|
||||
#define PINMODE_MASK (7 << PINMODE_SHIFT)
|
||||
# define INPUT (1 << 0)
|
||||
# define OUTPUT (1 << 1)
|
||||
# define FUNCTION (1 << 2)
|
||||
|
||||
#define PULLUP (1 << 3)
|
||||
#define PULLDOWN (1 << 4)
|
||||
#define OPEN_DRAIN (1 << 5)
|
||||
#define FUNCTION_SHIFT 6
|
||||
#define FUNCTION_MASK (7 << FUNCTION_SHIFT)
|
||||
# define FUNCTION_0 (1 << FUNCTION_SHIFT)
|
||||
# define FUNCTION_1 (2 << FUNCTION_SHIFT)
|
||||
# define FUNCTION_2 (3 << FUNCTION_SHIFT)
|
||||
# define FUNCTION_3 (4 << FUNCTION_SHIFT)
|
||||
# define FUNCTION_4 (5 << FUNCTION_SHIFT)
|
||||
|
||||
#define INPUT_PULLUP (INPUT | PULLUP)
|
||||
#define INPUT_PULLDOWN (INPUT | PULLDOWN)
|
||||
#define OUTPUT_OPEN_DRAIN (OUTPUT | OPEN_DRAIN)
|
||||
#define INPUT_FUNCTION (INPUT | FUNCTION)
|
||||
# define INPUT_FUNCTION_0 (INPUT_FUNCTION | FUNCTION_0)
|
||||
# define INPUT_FUNCTION_1 (INPUT_FUNCTION | FUNCTION_1)
|
||||
# define INPUT_FUNCTION_2 (INPUT_FUNCTION | FUNCTION_2)
|
||||
# define INPUT_FUNCTION_3 (INPUT_FUNCTION | FUNCTION_3)
|
||||
# define INPUT_FUNCTION_4 (INPUT_FUNCTION | FUNCTION_4)
|
||||
#define OUTPUT_FUNCTION (OUTPUT | FUNCTION)
|
||||
# define OUTPUT_FUNCTION_0 (OUTPUT_FUNCTION | FUNCTION_0)
|
||||
# define OUTPUT_FUNCTION_1 (OUTPUT_FUNCTION | FUNCTION_1)
|
||||
# define OUTPUT_FUNCTION_2 (OUTPUT_FUNCTION | FUNCTION_2)
|
||||
# define OUTPUT_FUNCTION_3 (OUTPUT_FUNCTION | FUNCTION_3)
|
||||
# define OUTPUT_FUNCTION_4 (OUTPUT_FUNCTION | FUNCTION_4)
|
||||
|
||||
/* Interrupt type used with esp32s3_gpioirqenable() */
|
||||
|
||||
#define DISABLED 0x00
|
||||
#define RISING 0x01
|
||||
#define FALLING 0x02
|
||||
#define CHANGE 0x03
|
||||
#define ONLOW 0x04
|
||||
#define ONHIGH 0x05
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* Must be big enough to hold the above encodings */
|
||||
|
||||
typedef uint16_t gpio_pinattr_t;
|
||||
typedef uint8_t gpio_intrtype_t;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_configgpio
|
||||
*
|
||||
* Description:
|
||||
* Configure a GPIO pin based on encoded pin attributes.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32s3_configgpio(int pin, gpio_pinattr_t attr);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_gpio_matrix_in
|
||||
*
|
||||
* Description:
|
||||
* Set gpio input to a signal
|
||||
* NOTE: one gpio can input to several signals
|
||||
* If gpio == 0x3c, cancel input to the signal, input 0 to signal.
|
||||
* If gpio == 0x3a, input nothing to signal.
|
||||
* If gpio == 0x38, cancel input to the signal, input 1 to signal.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_gpio_matrix_in(uint32_t gpio, uint32_t signal_idx, bool inv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_gpio_matrix_out
|
||||
*
|
||||
* Description:
|
||||
* Set signal output to gpio
|
||||
* NOTE: one signal can output to several gpios
|
||||
* If signal_idx == 0x100, cancel output put to the gpio
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_gpio_matrix_out(uint32_t gpio, uint32_t signal_idx,
|
||||
bool out_inv, bool oen_inv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#undef EXTERN
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_GPIO_H */
|
||||
@@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_idle.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "xtensa.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_idle
|
||||
*
|
||||
* Description:
|
||||
* up_idle() is the logic that will be executed when their is no other
|
||||
* ready-to-run task. This is processor idle time and will continue until
|
||||
* some interrupt occurs to cause a context switch from the idle task.
|
||||
*
|
||||
* Processing in this state may be processor-specific. e.g., this is where
|
||||
* power management operations might be performed.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_idle(void)
|
||||
{
|
||||
#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
|
||||
/* If the system is idle and there are no timer interrupts, then process
|
||||
* "fake" timer interrupts. Hopefully, something will wake up.
|
||||
*/
|
||||
|
||||
nxsched_process_timer();
|
||||
#else
|
||||
|
||||
/* This would be an appropriate place to put some MCU-specific logic to
|
||||
* sleep in a reduced power mode until an interrupt occurs to save power
|
||||
*/
|
||||
|
||||
#if XCHAL_HAVE_INTERRUPTS
|
||||
__asm__ __volatile__ ("waiti 0");
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,123 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_irq.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_IRQ_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_IRQ_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/* CPU interrupt types. */
|
||||
|
||||
#define ESP32S3_CPUINT_LEVEL 0
|
||||
#define ESP32S3_CPUINT_EDGE 1
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_cpuint_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize CPU interrupts
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned on
|
||||
* any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32s3_cpuint_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_setup_irq
|
||||
*
|
||||
* Description:
|
||||
* This function sets up the IRQ. It allocates a CPU interrupt of the given
|
||||
* priority and type and attaches it to the given peripheral.
|
||||
*
|
||||
* Input Parameters:
|
||||
* cpu - The CPU to receive the interrupt 0=PRO CPU 1=APP CPU
|
||||
* periphid - The peripheral number from irq.h to be assigned to
|
||||
* a CPU interrupt.
|
||||
* priority - Interrupt's priority (1 - 5).
|
||||
* type - Interrupt's type (level or edge).
|
||||
*
|
||||
* Returned Value:
|
||||
* The allocated CPU interrupt on success, a negated errno value on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32s3_setup_irq(int cpu, int periphid, int priority, int type);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_teardown_irq
|
||||
*
|
||||
* Description:
|
||||
* This function undoes the operations done by esp32s3_setup_irq.
|
||||
* It detaches a peripheral interrupt from a CPU interrupt and frees the
|
||||
* CPU interrupt.
|
||||
*
|
||||
* Input Parameters:
|
||||
* cpu - The CPU to receive the interrupt 0=PRO CPU 1=APP CPU
|
||||
* periphid - The peripheral number from irq.h to be detached from the
|
||||
* CPU interrupt.
|
||||
* cpuint - The CPU interrupt from which the peripheral interrupt will
|
||||
* be detached.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_teardown_irq(int cpu, int periphid, int cpuint);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_IRQ_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,485 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_lowputc.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_LOWPUTC_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_LOWPUTC_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "chip.h"
|
||||
|
||||
#include "hardware/esp32s3_uart.h"
|
||||
#include "hardware/esp32s3_gpio_sigmap.h"
|
||||
|
||||
#include "esp32s3_irq.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
enum uart_sclk
|
||||
{
|
||||
APB_CLK = 1, /* 80 MHz */
|
||||
CLK_8, /* 8 MHz */
|
||||
XTAL_CLK
|
||||
};
|
||||
|
||||
enum uart_parity
|
||||
{
|
||||
UART_PARITY_DISABLE,
|
||||
UART_PARITY_ODD,
|
||||
UART_PARITY_EVEN
|
||||
};
|
||||
|
||||
enum uart_data_length
|
||||
{
|
||||
UART_DATA_5_BITS,
|
||||
UART_DATA_6_BITS,
|
||||
UART_DATA_7_BITS,
|
||||
UART_DATA_8_BITS
|
||||
};
|
||||
|
||||
enum uart_stop_length
|
||||
{
|
||||
UART_STOP_BITS_1 = 0x1, /* Stop bit: 1 bit */
|
||||
UART_STOP_BITS_2 = 0x3, /* Stop bit: 2 bits */
|
||||
};
|
||||
|
||||
/* Default FIFOs size */
|
||||
|
||||
#define UART_TX_FIFO_SIZE 128
|
||||
#define UART_RX_FIFO_SIZE 128
|
||||
|
||||
/* Maximum serial clock divisor for integer part */
|
||||
|
||||
#define MAX_UART_CLKDIV (BIT(12) - 1)
|
||||
#define DIV_UP(a, b) (((a) + (b) - 1) / (b))
|
||||
|
||||
/* Struct used to store uart driver information and to
|
||||
* manipulate uart driver
|
||||
*/
|
||||
|
||||
struct esp32s3_uart_s
|
||||
{
|
||||
uint8_t periph; /* UART peripheral ID */
|
||||
int cpuint; /* CPU interrupt assigned to this UART */
|
||||
uint8_t id; /* UART ID */
|
||||
uint8_t irq; /* IRQ associated with this UART */
|
||||
uint8_t cpu; /* CPU ID */
|
||||
uint32_t baud; /* Configured baud rate */
|
||||
uint8_t bits; /* Data length (5 to 8 bits). */
|
||||
uint8_t parity; /* 0=no parity, 1=odd parity, 2=even parity */
|
||||
uint8_t stop_b2; /* Use 2 stop bits? 0 = no (use 1) 1 = yes (use 2) */
|
||||
uint8_t int_pri; /* UART Interrupt Priority */
|
||||
uint8_t txpin; /* TX pin */
|
||||
uint8_t txsig; /* TX signal */
|
||||
uint8_t rxpin; /* RX pin */
|
||||
uint8_t rxsig; /* RX signal */
|
||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
uint8_t rtspin; /* RTS pin number */
|
||||
uint8_t rtssig; /* RTS signal */
|
||||
bool iflow; /* Input flow control (RTS) enabled */
|
||||
#endif
|
||||
#ifdef CONFIG_SERIAL_OFLOWCONTROL
|
||||
uint8_t ctspin; /* CTS pin number */
|
||||
uint8_t ctssig; /* CTS signal */
|
||||
bool oflow; /* Output flow control (CTS) enabled */
|
||||
#endif
|
||||
};
|
||||
|
||||
extern struct esp32s3_uart_s g_uart0_config;
|
||||
extern struct esp32s3_uart_s g_uart1_config;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_set_iflow
|
||||
*
|
||||
* Description:
|
||||
* Configure the input hardware flow control.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
* threshold - RX FIFO value from which RST will automatically be
|
||||
* asserted.
|
||||
* enable - true = enable, false = disable
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_set_iflow(const struct esp32s3_uart_s *priv,
|
||||
uint8_t threshold, bool enable);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_set_oflow
|
||||
*
|
||||
* Description:
|
||||
* Configure the output hardware flow control.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
* enable - true = enable, false = disable
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_set_oflow(const struct esp32s3_uart_s *priv,
|
||||
bool enable);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_reset_core
|
||||
*
|
||||
* Description:
|
||||
* Reset both TX and RX cores.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_reset_cores(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_rst_tx
|
||||
*
|
||||
* Description:
|
||||
* Reset TX core.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_rst_tx(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_rst_rx
|
||||
*
|
||||
* Description:
|
||||
* Reset RX core.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_rst_rx(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_enable_sclk
|
||||
*
|
||||
* Description:
|
||||
* Enable clock for whole core.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_enable_sclk(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_disable_sclk
|
||||
*
|
||||
* Description:
|
||||
* Disable clock for whole core.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_disable_sclk(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_set_sclk
|
||||
*
|
||||
* Description:
|
||||
* Set a source clock for UART.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
* source - APB_CLK = 1 80 MHz
|
||||
* CLK_8 = 2 8 MHz
|
||||
* XTAL_CLK = 3
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_set_sclk(const struct esp32s3_uart_s *priv,
|
||||
enum uart_sclk source);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_get_sclk
|
||||
*
|
||||
* Description:
|
||||
* Get the source clock for UART.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
* Returned Value:
|
||||
* The frequency of the clock in Hz.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t esp32s3_lowputc_get_sclk(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_baud
|
||||
*
|
||||
* Description:
|
||||
* Set the baud rate according to the value in the private driver
|
||||
* struct.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_baud(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_normal_mode
|
||||
*
|
||||
* Description:
|
||||
* Set the UART to operate in normal mode, i.e., disable the RS485 mode and
|
||||
* IRDA mode.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_normal_mode(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_parity
|
||||
*
|
||||
* Description:
|
||||
* Set the parity, according to the value in the private driver
|
||||
* struct.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_parity(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_data_length
|
||||
*
|
||||
* Description:
|
||||
* Set the data bits length, according to the value in the private driver
|
||||
* struct.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32s3_lowputc_data_length(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_stop_length
|
||||
*
|
||||
* Description:
|
||||
* Set the stop bits length, according to the value in the private driver
|
||||
* struct.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_stop_length(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_set_tx_idle_time
|
||||
*
|
||||
* Description:
|
||||
* Set the idle time between transfers.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
* time - Desired time interval between the transfers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_set_tx_idle_time(const struct esp32s3_uart_s *priv,
|
||||
uint32_t time);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_send_byte
|
||||
*
|
||||
* Description:
|
||||
* Send one byte.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
* byte - Byte to be sent.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_send_byte(const struct esp32s3_uart_s *priv,
|
||||
char byte);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_is_tx_fifo_full
|
||||
*
|
||||
* Description:
|
||||
* Verify if TX FIFO is full.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
* Returned Value:
|
||||
* True if it is full, otherwise false.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool esp32s3_lowputc_is_tx_fifo_full(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_rst_peripheral
|
||||
*
|
||||
* Description:
|
||||
* Reset the UART peripheral by using System reg.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_rst_peripheral(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_rst_txfifo
|
||||
*
|
||||
* Description:
|
||||
* Reset TX FIFO.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_rst_txfifo(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_rst_rxfifo
|
||||
*
|
||||
* Description:
|
||||
* Reset RX FIFO.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_rst_rxfifo(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_disable_all_uart_int
|
||||
*
|
||||
* Description:
|
||||
* Disable all UART interrupts.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
* current_status - Pointer to a variable to store the current status of
|
||||
* the interrupt enable register before disabling
|
||||
* UART interrupts.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_disable_all_uart_int(const struct esp32s3_uart_s *priv,
|
||||
uint32_t *current_status);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_restore_all_uart_int
|
||||
*
|
||||
* Description:
|
||||
* Restore all UART interrupts.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
* last_status - Pointer to a variable that stored the last state of the
|
||||
* interrupt enable register.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_restore_all_uart_int(const struct esp32s3_uart_s *priv,
|
||||
uint32_t * last_status);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_config_pins
|
||||
*
|
||||
* Description:
|
||||
* Configure TX and RX UART pins.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_config_pins(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowputc_restore_pins
|
||||
*
|
||||
* Description:
|
||||
* Configure both pins back to INPUT mode and detach the TX pin from the
|
||||
* output signal and the RX pin from the input signal.
|
||||
*
|
||||
* Parameters:
|
||||
* priv - Pointer to the private driver struct.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowputc_restore_pins(const struct esp32s3_uart_s *priv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_lowsetup
|
||||
*
|
||||
* Description:
|
||||
* This performs basic initialization of the UART used for the serial
|
||||
* console. Its purpose is to get the console output available as soon
|
||||
* as possible.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_lowsetup(void);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_LOWPUTC_H */
|
||||
@@ -0,0 +1,102 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_region.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const uint32_t g_protected_pages[] =
|
||||
{
|
||||
0x00000000, 0x80000000, 0xa0000000, 0xc0000000, 0xe0000000
|
||||
};
|
||||
|
||||
#define NPROTECTED_PAGES (sizeof(g_protected_pages)/sizeof(uint32_t))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_write_dtlb and xtensa_write_itlb
|
||||
*
|
||||
* Description:
|
||||
* 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 xtensa_write_dtlb(uint32_t vpn, uint32_t attr)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"wdtlb %1, %0\n"
|
||||
"dsync\n"
|
||||
: : "r" (vpn), "r" (attr)
|
||||
);
|
||||
}
|
||||
|
||||
static inline void xtensa_write_itlb(uint32_t vpn, uint32_t attr)
|
||||
{
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"witlb %1, %0\n"
|
||||
"isync\n"
|
||||
: : "r" (vpn), "r" (attr)
|
||||
);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_region_protection
|
||||
*
|
||||
* Description:
|
||||
* 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
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_region_protection(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NPROTECTED_PAGES; ++i)
|
||||
{
|
||||
xtensa_write_dtlb(g_protected_pages[i], 0xf);
|
||||
xtensa_write_itlb(g_protected_pages[i], 0xf);
|
||||
}
|
||||
|
||||
xtensa_write_dtlb(0x20000000, 0);
|
||||
xtensa_write_itlb(0x20000000, 0);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_region.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_REGION_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_REGION_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_region_protection
|
||||
*
|
||||
* Description:
|
||||
* 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
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_region_protection(void);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_REGION_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,324 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_start.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <nuttx/init.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "xtensa.h"
|
||||
#include "xtensa_attr.h"
|
||||
|
||||
#include "esp32s3_start.h"
|
||||
#include "esp32s3_lowputc.h"
|
||||
#include "esp32s3_clockconfig.h"
|
||||
#include "esp32s3_region.h"
|
||||
#include "esp32s3_wdt.h"
|
||||
#include "hardware/esp32s3_cache_memory.h"
|
||||
#include "hardware/esp32s3_system.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_FEATURES
|
||||
# define showprogress(c) up_lowputc(c)
|
||||
#else
|
||||
# define showprogress(c)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* ROM Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
extern void rom_config_instruction_cache_mode(uint32_t cfg_cache_size,
|
||||
uint8_t cfg_cache_ways,
|
||||
uint8_t cfg_cache_line_size);
|
||||
extern void rom_config_data_cache_mode(uint32_t cfg_cache_size,
|
||||
uint8_t cfg_cache_ways,
|
||||
uint8_t cfg_cache_line_size);
|
||||
extern uint32_t cache_suspend_dcache(void);
|
||||
extern void cache_resume_dcache(uint32_t val);
|
||||
extern uint32_t cache_set_idrom_mmu_size(uint32_t irom_size,
|
||||
uint32_t drom_size);
|
||||
extern void cache_set_idrom_mmu_info(uint32_t instr_page_num,
|
||||
uint32_t rodata_page_num,
|
||||
uint32_t rodata_start,
|
||||
uint32_t rodata_end,
|
||||
int i_off,
|
||||
int ro_off);
|
||||
#ifdef CONFIG_ESP32S3_DATA_CACHE_16KB
|
||||
extern void cache_invalidate_dcache_all(void);
|
||||
extern int cache_occupy_addr(uint32_t addr, uint32_t size);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
extern int _rodata_reserved_start;
|
||||
extern int _rodata_reserved_end;
|
||||
|
||||
/* Address of the CPU0 IDLE thread */
|
||||
|
||||
uint32_t g_idlestack[IDLETHREAD_STACKWORDS]
|
||||
aligned_data(16) locate_data(".noinit");
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: configure_cpu_caches
|
||||
*
|
||||
* Description:
|
||||
* Configure the Instruction and Data CPU caches.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void IRAM_ATTR configure_cpu_caches(void)
|
||||
{
|
||||
int s_instr_flash2spiram_off = 0;
|
||||
int s_rodata_flash2spiram_off = 0;
|
||||
|
||||
/* Configure the mode of instruction cache: cache size, cache line size. */
|
||||
|
||||
rom_config_instruction_cache_mode(CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE,
|
||||
CONFIG_ESP32S3_ICACHE_ASSOCIATED_WAYS,
|
||||
CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_SIZE);
|
||||
|
||||
/* If we need to use SPIRAM, we should use data cache.
|
||||
* Configure the mode of data cache: cache size, cache line size.
|
||||
*/
|
||||
|
||||
cache_suspend_dcache();
|
||||
rom_config_data_cache_mode(CONFIG_ESP32S3_DATA_CACHE_SIZE,
|
||||
CONFIG_ESP32S3_DCACHE_ASSOCIATED_WAYS,
|
||||
CONFIG_ESP32S3_DATA_CACHE_LINE_SIZE);
|
||||
cache_resume_dcache(0);
|
||||
|
||||
/* Configure the Cache MMU size for instruction and rodata in flash. */
|
||||
|
||||
uint32_t rodata_reserved_start_align =
|
||||
(uint32_t)&_rodata_reserved_start & ~(MMU_PAGE_SIZE - 1);
|
||||
uint32_t cache_mmu_irom_size =
|
||||
((rodata_reserved_start_align - SOC_DROM_LOW) / MMU_PAGE_SIZE) *
|
||||
sizeof(uint32_t);
|
||||
|
||||
uint32_t cache_mmu_drom_size =
|
||||
(((uint32_t)&_rodata_reserved_end - rodata_reserved_start_align +
|
||||
MMU_PAGE_SIZE - 1) /
|
||||
MMU_PAGE_SIZE) * sizeof(uint32_t);
|
||||
|
||||
cache_set_idrom_mmu_size(cache_mmu_irom_size,
|
||||
CACHE_DROM_MMU_MAX_END - cache_mmu_irom_size);
|
||||
|
||||
cache_set_idrom_mmu_info(cache_mmu_irom_size / sizeof(uint32_t),
|
||||
cache_mmu_drom_size / sizeof(uint32_t),
|
||||
(uint32_t)&_rodata_reserved_start,
|
||||
(uint32_t)&_rodata_reserved_end,
|
||||
s_instr_flash2spiram_off,
|
||||
s_rodata_flash2spiram_off);
|
||||
|
||||
#ifdef CONFIG_ESP32S3_DATA_CACHE_16KB
|
||||
cache_invalidate_dcache_all();
|
||||
cache_occupy_addr(SOC_DROM_LOW, 0x4000);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: disable_app_cpu
|
||||
*
|
||||
* Description:
|
||||
* Disable the APP CPU (Core 1).
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void IRAM_ATTR disable_app_cpu(void)
|
||||
{
|
||||
uint32_t regval;
|
||||
|
||||
regval = getreg32(SYSTEM_CORE_1_CONTROL_0_REG);
|
||||
regval &= ~SYSTEM_CONTROL_CORE_1_CLKGATE_EN;
|
||||
putreg32(regval, SYSTEM_CORE_1_CONTROL_0_REG);
|
||||
|
||||
/* The clock gating signal of the App core is invalid.
|
||||
* We use RUNSTALL and RESETING signals to ensure that the App core stops
|
||||
* running in single-core mode.
|
||||
*/
|
||||
|
||||
regval = getreg32(SYSTEM_CORE_1_CONTROL_0_REG);
|
||||
regval |= SYSTEM_CONTROL_CORE_1_RUNSTALL;
|
||||
putreg32(regval, SYSTEM_CORE_1_CONTROL_0_REG);
|
||||
|
||||
regval = getreg32(SYSTEM_CORE_1_CONTROL_0_REG);
|
||||
regval &= ~SYSTEM_CONTROL_CORE_1_RESETING;
|
||||
putreg32(regval, SYSTEM_CORE_1_CONTROL_0_REG);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: __esp32s3_start
|
||||
*
|
||||
* Description:
|
||||
* Perform base configuration of the chip for code execution.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void noreturn_function IRAM_ATTR __esp32s3_start(void)
|
||||
{
|
||||
uint32_t sp;
|
||||
|
||||
/* Make sure that normal interrupts are disabled. This is really only an
|
||||
* issue when we are started in un-usual ways (such as from IRAM). In this
|
||||
* case, we can at least defer some unexpected interrupts left over from
|
||||
* the last program execution.
|
||||
*/
|
||||
|
||||
up_irq_disable();
|
||||
|
||||
/* Move the stack to a known location. Although we were given a stack
|
||||
* pointer at start-up, we don't know where that stack pointer is
|
||||
* positioned with respect to our memory map. The only safe option is to
|
||||
* switch to a well-known IDLE thread stack.
|
||||
*/
|
||||
|
||||
sp = (uint32_t)g_idlestack + IDLETHREAD_STACKSIZE;
|
||||
__asm__ __volatile__("mov sp, %0\n" : : "r"(sp));
|
||||
|
||||
/* Raise an exception in case page 0 is accessed */
|
||||
|
||||
esp32s3_region_protection();
|
||||
|
||||
/* Move CPU0 exception vectors to IRAM */
|
||||
|
||||
__asm__ __volatile__ ("wsr %0, vecbase\n"::"r" (&_init_start));
|
||||
|
||||
/* Clear .bss. We'll do this inline (vs. calling memset) just to be
|
||||
* certain that there are no issues with the state of global variables.
|
||||
*/
|
||||
|
||||
for (uint32_t *dest = &_sbss; dest < &_ebss; dest++)
|
||||
{
|
||||
*dest = 0;
|
||||
}
|
||||
|
||||
/* Make sure that the APP_CPU is disabled for now */
|
||||
|
||||
disable_app_cpu();
|
||||
|
||||
/* The 2nd stage bootloader enables RTC WDT to check on startup sequence
|
||||
* related issues in application. Hence disable that as we are about to
|
||||
* start the NuttX environment.
|
||||
*/
|
||||
|
||||
esp32s3_wdt_early_deinit();
|
||||
|
||||
/* Set CPU frequency configured in board.h */
|
||||
|
||||
esp32s3_clockconfig();
|
||||
|
||||
#ifndef CONFIG_SUPPRESS_UART_CONFIG
|
||||
/* Configure the UART so we can get debug output */
|
||||
|
||||
esp32s3_lowsetup();
|
||||
#endif
|
||||
|
||||
#ifdef USE_EARLYSERIALINIT
|
||||
/* Perform early serial initialization */
|
||||
|
||||
xtensa_earlyserialinit();
|
||||
#endif
|
||||
|
||||
showprogress('A');
|
||||
|
||||
/* Initialize onboard resources */
|
||||
|
||||
esp32s3_board_initialize();
|
||||
|
||||
showprogress('B');
|
||||
|
||||
/* Bring up NuttX */
|
||||
|
||||
nx_start();
|
||||
for (; ; ); /* Should not return */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: __start
|
||||
*
|
||||
* Description:
|
||||
* 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.
|
||||
*
|
||||
* The app CPU will remain in reset unless CONFIG_SMP is selected and
|
||||
* up_cpu_start() is called later in the bring-up sequence.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void IRAM_ATTR __start(void)
|
||||
{
|
||||
configure_cpu_caches();
|
||||
|
||||
__esp32s3_start();
|
||||
|
||||
while (true); /* Should not return */
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_start.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_START_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_START_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* Board-specific logic is initialized by calling this function. This
|
||||
* entry point is called early in the initialization -- after all memory
|
||||
* has been configured but before any devices have been initialized.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_board_initialize(void);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_START_H */
|
||||
@@ -0,0 +1,54 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_systemreset.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "xtensa.h"
|
||||
#include "hardware/esp32s3_rtccntl.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_systemreset
|
||||
*
|
||||
* Description:
|
||||
* Internal reset logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_systemreset(void)
|
||||
{
|
||||
putreg32(RTC_CNTL_SW_SYS_RST, RTC_CNTL_RTC_OPTIONS0_REG);
|
||||
|
||||
/* Wait for the reset */
|
||||
|
||||
for (; ; );
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_timerisr.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "esp32s3_irq.h"
|
||||
#include "hardware/esp32s3_system.h"
|
||||
#include "hardware/esp32s3_systimer.h"
|
||||
#include "xtensa.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ESP32S3_SYSTIMER_TICKS_PER_SEC (16 * 1000 * 1000)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: systimer_isr
|
||||
*
|
||||
* Description:
|
||||
* The timer ISR will perform a variety of services for various portions
|
||||
* of the systems.
|
||||
*
|
||||
* Input Parameters:
|
||||
* irq - CPU interrupt index.
|
||||
* context - Context data from the ISR.
|
||||
* arg - Opaque pointer to the internal driver state structure.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success. A negated errno value is returned on
|
||||
* failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int systimer_isr(int irq, void *context, void *arg)
|
||||
{
|
||||
modifyreg32(SYSTIMER_INT_CLR_REG, 0, SYSTIMER_TARGET0_INT_CLR);
|
||||
|
||||
/* Process timer interrupt */
|
||||
|
||||
nxsched_process_timer();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_timer_initialize
|
||||
*
|
||||
* Description:
|
||||
* This function is called during start-up to initialize the timer
|
||||
* interrupt.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_timer_initialize(void)
|
||||
{
|
||||
uint32_t regval;
|
||||
int cpuint;
|
||||
|
||||
cpuint = esp32s3_setup_irq(0, ESP32S3_PERIPH_SYSTIMER_TARGET0, 1,
|
||||
ESP32S3_CPUINT_LEVEL);
|
||||
DEBUGASSERT(cpuint >= 0);
|
||||
|
||||
/* Attach the timer interrupt. */
|
||||
|
||||
irq_attach(ESP32S3_IRQ_SYSTIMER_TARGET0, systimer_isr, NULL);
|
||||
|
||||
/* Enable the allocated CPU interrupt. */
|
||||
|
||||
up_enable_irq(ESP32S3_IRQ_SYSTIMER_TARGET0);
|
||||
|
||||
/* Enable timer clock */
|
||||
|
||||
modifyreg32(SYSTEM_PERIP_CLK_EN0_REG, 0, SYSTEM_SYSTIMER_CLK_EN);
|
||||
modifyreg32(SYSTEM_PERIP_RST_EN0_REG, SYSTEM_SYSTIMER_RST, 0);
|
||||
modifyreg32(SYSTIMER_CONF_REG, 0, SYSTIMER_CLK_EN);
|
||||
|
||||
/* Configure alarm0 (Comparator 0) */
|
||||
|
||||
regval = SYSTIMER_TARGET0_PERIOD_MODE |
|
||||
((ESP32S3_SYSTIMER_TICKS_PER_SEC / CLOCKS_PER_SEC) <<
|
||||
SYSTIMER_TARGET0_PERIOD_S);
|
||||
putreg32(regval, SYSTIMER_TARGET0_CONF_REG);
|
||||
putreg32(SYSTIMER_TIMER_COMP0_LOAD, SYSTIMER_COMP0_LOAD_REG);
|
||||
|
||||
/* Stall systimer 0 when CPU stalls, e.g., when using JTAG to debug */
|
||||
|
||||
modifyreg32(SYSTIMER_CONF_REG, 0, SYSTIMER_TIMER_UNIT0_CORE0_STALL_EN);
|
||||
|
||||
/* Enable interrupt */
|
||||
|
||||
modifyreg32(SYSTIMER_INT_CLR_REG, 0, SYSTIMER_TARGET0_INT_CLR);
|
||||
modifyreg32(SYSTIMER_INT_ENA_REG, 0, SYSTIMER_TARGET0_INT_ENA);
|
||||
modifyreg32(SYSTIMER_CONF_REG, 0, SYSTIMER_TARGET0_WORK_EN);
|
||||
|
||||
/* Start alarm0 counter0 */
|
||||
|
||||
modifyreg32(SYSTIMER_CONF_REG, 0, SYSTIMER_TIMER_UNIT0_WORK_EN);
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_user.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "xtensa.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: xtensa_user
|
||||
*
|
||||
* Description:
|
||||
* ESP32-S3-specific user exception handler.
|
||||
*
|
||||
* Input Parameters:
|
||||
* exccause - Identifies the EXCCAUSE of the user exception.
|
||||
* regs - The register save are at the time of the interrupt.
|
||||
*
|
||||
* Returned Value:
|
||||
* Does not return.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t *xtensa_user(int exccause, uint32_t *regs)
|
||||
{
|
||||
/* xtensa_user_panic never returns. */
|
||||
|
||||
xtensa_user_panic(exccause, regs);
|
||||
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_wdt.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "xtensa.h"
|
||||
|
||||
#include "esp32s3_wdt.h"
|
||||
#include "hardware/esp32s3_rtccntl.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_wdt_early_deinit
|
||||
*
|
||||
* Description:
|
||||
* Disable the WDT(s) that was/were enabled by the bootloader.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_wdt_early_deinit(void)
|
||||
{
|
||||
uint32_t regval;
|
||||
putreg32(RTC_CNTL_WDT_WKEY_VALUE, RTC_CNTL_RTC_WDTWPROTECT_REG);
|
||||
regval = getreg32(RTC_CNTL_RTC_WDTCONFIG0_REG);
|
||||
regval &= ~RTC_CNTL_WDT_EN;
|
||||
putreg32(regval, RTC_CNTL_RTC_WDTCONFIG0_REG);
|
||||
putreg32(0, RTC_CNTL_RTC_WDTWPROTECT_REG);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/esp32s3_wdt.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WDT_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WDT_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
void esp32s3_wdt_early_deinit(void);
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_ESP32S3_WDT_H */
|
||||
@@ -0,0 +1,118 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/hardware/esp32s3_cache_memory.h
|
||||
*
|
||||
* 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 __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_CACHE_MEMORY_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_CACHE_MEMORY_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "esp32s3_soc.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* IRAM0 is connected with Cache IBUS0 */
|
||||
|
||||
#define IRAM0_ADDRESS_LOW 0x40000000
|
||||
#define IRAM0_ADDRESS_HIGH 0x44000000
|
||||
#define IRAM0_CACHE_ADDRESS_LOW 0x42000000
|
||||
#define IRAM0_CACHE_ADDRESS_HIGH 0x44000000
|
||||
|
||||
/* DRAM0 is connected with Cache DBUS0 */
|
||||
|
||||
#define DRAM0_ADDRESS_LOW 0x3c000000
|
||||
#define DRAM0_ADDRESS_HIGH 0x40000000
|
||||
#define DRAM0_CACHE_ADDRESS_LOW 0x3c000000
|
||||
#define DRAM0_CACHE_ADDRESS_HIGH 0x3e000000
|
||||
#define DRAM0_CACHE_OPERATION_HIGH DRAM0_CACHE_ADDRESS_HIGH
|
||||
#define ESP_CACHE_TEMP_ADDR 0x3c800000
|
||||
|
||||
#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_DRAM0(vaddr) ADDRESS_IN_BUS(DRAM0, vaddr)
|
||||
#define ADDRESS_IN_DRAM0_CACHE(vaddr) ADDRESS_IN_BUS(DRAM0_CACHE, vaddr)
|
||||
|
||||
#define BUS_IRAM0_CACHE_SIZE BUS_SIZE(IRAM0_CACHE)
|
||||
#define BUS_DRAM0_CACHE_SIZE BUS_SIZE(DRAM0_CACHE)
|
||||
|
||||
#define CACHE_IBUS 0
|
||||
#define CACHE_IBUS_MMU_START 0
|
||||
#define CACHE_IBUS_MMU_END 0x800
|
||||
|
||||
#define CACHE_DBUS 1
|
||||
#define CACHE_DBUS_MMU_START 0
|
||||
#define CACHE_DBUS_MMU_END 0x800
|
||||
|
||||
#define CACHE_IROM_MMU_START 0
|
||||
#define CACHE_IROM_MMU_END Cache_Get_IROM_MMU_End()
|
||||
#define CACHE_IROM_MMU_SIZE (CACHE_IROM_MMU_END - CACHE_IROM_MMU_START)
|
||||
|
||||
#define CACHE_DROM_MMU_START CACHE_IROM_MMU_END
|
||||
#define CACHE_DROM_MMU_END Cache_Get_DROM_MMU_End()
|
||||
#define CACHE_DROM_MMU_SIZE (CACHE_DROM_MMU_END - CACHE_DROM_MMU_START)
|
||||
|
||||
#define CACHE_DROM_MMU_MAX_END 0x400
|
||||
|
||||
#define ICACHE_MMU_SIZE 0x800
|
||||
#define DCACHE_MMU_SIZE 0x800
|
||||
|
||||
#define MMU_BUS_START(i) 0
|
||||
#define MMU_BUS_SIZE(i) 0x800
|
||||
|
||||
#define MMU_INVALID BIT(14)
|
||||
#define MMU_TYPE BIT(15)
|
||||
#define MMU_ACCESS_FLASH 0
|
||||
#define MMU_ACCESS_SPIRAM BIT(15)
|
||||
|
||||
#define CACHE_MAX_SYNC_NUM 0x400000
|
||||
#define CACHE_MAX_LOCK_NUM 0x8000
|
||||
|
||||
#define FLASH_MMU_TABLE ((volatile uint32_t *)DR_REG_MMU_TABLE)
|
||||
#define FLASH_MMU_TABLE_SIZE (ICACHE_MMU_SIZE / sizeof(uint32_t))
|
||||
|
||||
#define MMU_TABLE_INVALID_VAL 0x4000
|
||||
#define FLASH_MMU_TABLE_INVALID_VAL DPORT_MMU_TABLE_INVALID_VAL
|
||||
#define MMU_ADDRESS_MASK 0x3fff
|
||||
#define MMU_PAGE_SIZE 0x10000
|
||||
#define INVALID_PHY_PAGE 0xffff
|
||||
|
||||
#define BUS_ADDR_SIZE 0x200000
|
||||
#define BUS_ADDR_MASK (BUS_ADDR_SIZE - 1)
|
||||
|
||||
#define CACHE_ICACHE_LOW_SHIFT 0
|
||||
#define CACHE_ICACHE_HIGH_SHIFT 2
|
||||
#define CACHE_DCACHE_LOW_SHIFT 4
|
||||
#define CACHE_DCACHE_HIGH_SHIFT 6
|
||||
|
||||
#define CACHE_MEMORY_IBANK0_ADDR 0x40370000
|
||||
#define CACHE_MEMORY_IBANK1_ADDR 0x40374000
|
||||
|
||||
#define CACHE_MEMORY_DBANK0_ADDR 0x3fcf0000
|
||||
#define CACHE_MEMORY_DBANK1_ADDR 0x3fcf8000
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_CACHE_MEMORY_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,447 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/hardware/esp32s3_gpio_sigmap.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_GPIO_SIGMAP_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_GPIO_SIGMAP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
#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_IDX 4
|
||||
#define SPICS0_OUT_IDX 5
|
||||
#define SPICS1_OUT_IDX 6
|
||||
#define SPID4_IN_IDX 7
|
||||
#define SPID4_OUT_IDX 7
|
||||
#define SPID5_IN_IDX 8
|
||||
#define SPID5_OUT_IDX 8
|
||||
#define SPID6_IN_IDX 9
|
||||
#define SPID6_OUT_IDX 9
|
||||
#define SPID7_IN_IDX 10
|
||||
#define SPID7_OUT_IDX 10
|
||||
#define SPIDQS_IN_IDX 11
|
||||
#define SPIDQS_OUT_IDX 11
|
||||
#define U0RXD_IN_IDX 12
|
||||
#define U0TXD_OUT_IDX 12
|
||||
#define U0CTS_IN_IDX 13
|
||||
#define U0RTS_OUT_IDX 13
|
||||
#define U0DSR_IN_IDX 14
|
||||
#define U0DTR_OUT_IDX 14
|
||||
#define U1RXD_IN_IDX 15
|
||||
#define U1TXD_OUT_IDX 15
|
||||
#define U1CTS_IN_IDX 16
|
||||
#define U1RTS_OUT_IDX 16
|
||||
#define U1DSR_IN_IDX 17
|
||||
#define U1DTR_OUT_IDX 17
|
||||
#define U2RXD_IN_IDX 18
|
||||
#define U2TXD_OUT_IDX 18
|
||||
#define U2CTS_IN_IDX 19
|
||||
#define U2RTS_OUT_IDX 19
|
||||
#define U2DSR_IN_IDX 20
|
||||
#define U2DTR_OUT_IDX 20
|
||||
#define I2S1_MCLK_IN_IDX 21
|
||||
#define I2S1_MCLK_OUT_IDX 21
|
||||
#define I2S0O_BCK_IN_IDX 22
|
||||
#define I2S0O_BCK_OUT_IDX 22
|
||||
#define I2S0_MCLK_IN_IDX 23
|
||||
#define I2S0_MCLK_OUT_IDX 23
|
||||
#define I2S0O_WS_IN_IDX 24
|
||||
#define I2S0O_WS_OUT_IDX 24
|
||||
#define I2S0I_SD_IN_IDX 25
|
||||
#define I2S0O_SD_OUT_IDX 25
|
||||
#define I2S0I_BCK_IN_IDX 26
|
||||
#define I2S0I_BCK_OUT_IDX 26
|
||||
#define I2S0I_WS_IN_IDX 27
|
||||
#define I2S0I_WS_OUT_IDX 27
|
||||
#define I2S1O_BCK_IN_IDX 28
|
||||
#define I2S1O_BCK_OUT_IDX 28
|
||||
#define I2S1O_WS_IN_IDX 29
|
||||
#define I2S1O_WS_OUT_IDX 29
|
||||
#define I2S1I_SD_IN_IDX 30
|
||||
#define I2S1O_SD_OUT_IDX 30
|
||||
#define I2S1I_BCK_IN_IDX 31
|
||||
#define I2S1I_BCK_OUT_IDX 31
|
||||
#define I2S1I_WS_IN_IDX 32
|
||||
#define I2S1I_WS_OUT_IDX 32
|
||||
#define PCNT_SIG_CH0_IN0_IDX 33
|
||||
#define GPIO_WLAN_PRIO_IDX 33
|
||||
#define PCNT_SIG_CH1_IN0_IDX 34
|
||||
#define GPIO_WLAN_ACTIVE_IDX 34
|
||||
#define PCNT_CTRL_CH0_IN0_IDX 35
|
||||
#define BB_DIAG0_IDX 35
|
||||
#define PCNT_CTRL_CH1_IN0_IDX 36
|
||||
#define BB_DIAG1_IDX 36
|
||||
#define PCNT_SIG_CH0_IN1_IDX 37
|
||||
#define BB_DIAG2_IDX 37
|
||||
#define PCNT_SIG_CH1_IN1_IDX 38
|
||||
#define BB_DIAG3_IDX 38
|
||||
#define PCNT_CTRL_CH0_IN1_IDX 39
|
||||
#define BB_DIAG4_IDX 39
|
||||
#define PCNT_CTRL_CH1_IN1_IDX 40
|
||||
#define BB_DIAG5_IDX 40
|
||||
#define PCNT_SIG_CH0_IN2_IDX 41
|
||||
#define BB_DIAG6_IDX 41
|
||||
#define PCNT_SIG_CH1_IN2_IDX 42
|
||||
#define BB_DIAG7_IDX 42
|
||||
#define PCNT_CTRL_CH0_IN2_IDX 43
|
||||
#define BB_DIAG8_IDX 43
|
||||
#define PCNT_CTRL_CH1_IN2_IDX 44
|
||||
#define BB_DIAG9_IDX 44
|
||||
#define PCNT_SIG_CH0_IN3_IDX 45
|
||||
#define BB_DIAG10_IDX 45
|
||||
#define PCNT_SIG_CH1_IN3_IDX 46
|
||||
#define BB_DIAG11_IDX 46
|
||||
#define PCNT_CTRL_CH0_IN3_IDX 47
|
||||
#define BB_DIAG12_IDX 47
|
||||
#define PCNT_CTRL_CH1_IN3_IDX 48
|
||||
#define BB_DIAG13_IDX 48
|
||||
#define GPIO_BT_ACTIVE_IDX 49
|
||||
#define BB_DIAG14_IDX 49
|
||||
#define GPIO_BT_PRIORITY_IDX 50
|
||||
#define BB_DIAG15_IDX 50
|
||||
#define I2S0I_SD1_IN_IDX 51
|
||||
#define BB_DIAG16_IDX 51
|
||||
#define I2S0I_SD2_IN_IDX 52
|
||||
#define BB_DIAG17_IDX 52
|
||||
#define I2S0I_SD3_IN_IDX 53
|
||||
#define BB_DIAG18_IDX 53
|
||||
#define BB_DIAG19_IDX 54
|
||||
#define USB_EXTPHY_VP_IDX 55
|
||||
#define USB_EXTPHY_OEN_IDX 55
|
||||
#define USB_EXTPHY_VM_IDX 56
|
||||
#define USB_EXTPHY_SPEED_IDX 56
|
||||
#define USB_EXTPHY_RCV_IDX 57
|
||||
#define USB_EXTPHY_VPO_IDX 57
|
||||
#define USB_OTG_IDDIG_IN_IDX 58
|
||||
#define USB_EXTPHY_VMO_IDX 58
|
||||
#define USB_OTG_AVALID_IN_IDX 59
|
||||
#define USB_EXTPHY_SUSPND_IDX 59
|
||||
#define USB_SRP_BVALID_IN_IDX 60
|
||||
#define USB_OTG_IDPULLUP_IDX 60
|
||||
#define USB_OTG_VBUSVALID_IN_IDX 61
|
||||
#define USB_OTG_DPPULLDOWN_IDX 61
|
||||
#define USB_SRP_SESSEND_IN_IDX 62
|
||||
#define USB_OTG_DMPULLDOWN_IDX 62
|
||||
#define USB_OTG_DRVVBUS_IDX 63
|
||||
#define USB_SRP_CHRGVBUS_IDX 64
|
||||
#define USB_SRP_DISCHRGVBUS_IDX 65
|
||||
#define SPI3_CLK_IN_IDX 66
|
||||
#define SPI3_CLK_OUT_IDX 66
|
||||
#define SPI3_Q_IN_IDX 67
|
||||
#define SPI3_Q_OUT_IDX 67
|
||||
#define SPI3_D_IN_IDX 68
|
||||
#define SPI3_D_OUT_IDX 68
|
||||
#define SPI3_HD_IN_IDX 69
|
||||
#define SPI3_HD_OUT_IDX 69
|
||||
#define SPI3_WP_IN_IDX 70
|
||||
#define SPI3_WP_OUT_IDX 70
|
||||
#define SPI3_CS0_IN_IDX 71
|
||||
#define SPI3_CS0_OUT_IDX 71
|
||||
#define SPI3_CS1_OUT_IDX 72
|
||||
#define EXT_ADC_START_IDX 73
|
||||
#define LEDC_LS_SIG_OUT0_IDX 73
|
||||
#define LEDC_LS_SIG_OUT1_IDX 74
|
||||
#define LEDC_LS_SIG_OUT2_IDX 75
|
||||
#define LEDC_LS_SIG_OUT3_IDX 76
|
||||
#define LEDC_LS_SIG_OUT4_IDX 77
|
||||
#define LEDC_LS_SIG_OUT5_IDX 78
|
||||
#define LEDC_LS_SIG_OUT6_IDX 79
|
||||
#define LEDC_LS_SIG_OUT7_IDX 80
|
||||
#define RMT_SIG_IN0_IDX 81
|
||||
#define RMT_SIG_OUT0_IDX 81
|
||||
#define RMT_SIG_IN1_IDX 82
|
||||
#define RMT_SIG_OUT1_IDX 82
|
||||
#define RMT_SIG_IN2_IDX 83
|
||||
#define RMT_SIG_OUT2_IDX 83
|
||||
#define RMT_SIG_IN3_IDX 84
|
||||
#define RMT_SIG_OUT3_IDX 84
|
||||
#define I2CEXT0_SCL_IN_IDX 89
|
||||
#define I2CEXT0_SCL_OUT_IDX 89
|
||||
#define I2CEXT0_SDA_IN_IDX 90
|
||||
#define I2CEXT0_SDA_OUT_IDX 90
|
||||
#define I2CEXT1_SCL_IN_IDX 91
|
||||
#define I2CEXT1_SCL_OUT_IDX 91
|
||||
#define I2CEXT1_SDA_IN_IDX 92
|
||||
#define I2CEXT1_SDA_OUT_IDX 92
|
||||
#define GPIO_SD0_OUT_IDX 93
|
||||
#define GPIO_SD1_OUT_IDX 94
|
||||
#define GPIO_SD2_OUT_IDX 95
|
||||
#define GPIO_SD3_OUT_IDX 96
|
||||
#define GPIO_SD4_OUT_IDX 97
|
||||
#define GPIO_SD5_OUT_IDX 98
|
||||
#define GPIO_SD6_OUT_IDX 99
|
||||
#define GPIO_SD7_OUT_IDX 100
|
||||
#define FSPICLK_IN_IDX 101
|
||||
#define FSPICLK_OUT_IDX 101
|
||||
#define FSPIQ_IN_IDX 102
|
||||
#define FSPIQ_OUT_IDX 102
|
||||
#define FSPID_IN_IDX 103
|
||||
#define FSPID_OUT_IDX 103
|
||||
#define FSPIHD_IN_IDX 104
|
||||
#define FSPIHD_OUT_IDX 104
|
||||
#define FSPIWP_IN_IDX 105
|
||||
#define FSPIWP_OUT_IDX 105
|
||||
#define FSPIIO4_IN_IDX 106
|
||||
#define FSPIIO4_OUT_IDX 106
|
||||
#define FSPIIO5_IN_IDX 107
|
||||
#define FSPIIO5_OUT_IDX 107
|
||||
#define FSPIIO6_IN_IDX 108
|
||||
#define FSPIIO6_OUT_IDX 108
|
||||
#define FSPIIO7_IN_IDX 109
|
||||
#define FSPIIO7_OUT_IDX 109
|
||||
#define FSPICS0_IN_IDX 110
|
||||
#define FSPICS0_OUT_IDX 110
|
||||
#define FSPICS1_OUT_IDX 111
|
||||
#define FSPICS2_OUT_IDX 112
|
||||
#define FSPICS3_OUT_IDX 113
|
||||
#define FSPICS4_OUT_IDX 114
|
||||
#define FSPICS5_OUT_IDX 115
|
||||
#define TWAI_RX_IDX 116
|
||||
#define TWAI_TX_IDX 116
|
||||
#define TWAI_BUS_OFF_ON_IDX 117
|
||||
#define TWAI_CLKOUT_IDX 118
|
||||
#define SUBSPICLK_OUT_IDX 119
|
||||
#define SUBSPIQ_IN_IDX 120
|
||||
#define SUBSPIQ_OUT_IDX 120
|
||||
#define SUBSPID_IN_IDX 121
|
||||
#define SUBSPID_OUT_IDX 121
|
||||
#define SUBSPIHD_IN_IDX 122
|
||||
#define SUBSPIHD_OUT_IDX 122
|
||||
#define SUBSPIWP_IN_IDX 123
|
||||
#define SUBSPIWP_OUT_IDX 123
|
||||
#define SUBSPICS0_OUT_IDX 124
|
||||
#define SUBSPICS1_OUT_IDX 125
|
||||
#define FSPIDQS_OUT_IDX 126
|
||||
#define SPI3_CS2_OUT_IDX 127
|
||||
#define LCD_CS_IDX 132
|
||||
#define CAM_DATA_IN0_IDX 133
|
||||
#define LCD_DATA_OUT0_IDX 133
|
||||
#define CAM_DATA_IN1_IDX 134
|
||||
#define LCD_DATA_OUT1_IDX 134
|
||||
#define CAM_DATA_IN2_IDX 135
|
||||
#define LCD_DATA_OUT2_IDX 135
|
||||
#define CAM_DATA_IN3_IDX 136
|
||||
#define LCD_DATA_OUT3_IDX 136
|
||||
#define CAM_DATA_IN4_IDX 137
|
||||
#define LCD_DATA_OUT4_IDX 137
|
||||
#define CAM_DATA_IN5_IDX 138
|
||||
#define LCD_DATA_OUT5_IDX 138
|
||||
#define CAM_DATA_IN6_IDX 139
|
||||
#define LCD_DATA_OUT6_IDX 139
|
||||
#define CAM_DATA_IN7_IDX 140
|
||||
#define LCD_DATA_OUT7_IDX 140
|
||||
#define CAM_DATA_IN8_IDX 141
|
||||
#define LCD_DATA_OUT8_IDX 141
|
||||
#define CAM_DATA_IN9_IDX 142
|
||||
#define LCD_DATA_OUT9_IDX 142
|
||||
#define CAM_DATA_IN10_IDX 143
|
||||
#define LCD_DATA_OUT10_IDX 143
|
||||
#define CAM_DATA_IN11_IDX 144
|
||||
#define LCD_DATA_OUT11_IDX 144
|
||||
#define CAM_DATA_IN12_IDX 145
|
||||
#define LCD_DATA_OUT12_IDX 145
|
||||
#define CAM_DATA_IN13_IDX 146
|
||||
#define LCD_DATA_OUT13_IDX 146
|
||||
#define CAM_DATA_IN14_IDX 147
|
||||
#define LCD_DATA_OUT14_IDX 147
|
||||
#define CAM_DATA_IN15_IDX 148
|
||||
#define LCD_DATA_OUT15_IDX 148
|
||||
#define CAM_PCLK_IDX 149
|
||||
#define CAM_CLK_IDX 149
|
||||
#define CAM_H_ENABLE_IDX 150
|
||||
#define LCD_H_ENABLE_IDX 150
|
||||
#define CAM_H_SYNC_IDX 151
|
||||
#define LCD_H_SYNC_IDX 151
|
||||
#define CAM_V_SYNC_IDX 152
|
||||
#define LCD_V_SYNC_IDX 152
|
||||
#define LCD_DC_IDX 153
|
||||
#define LCD_PCLK_IDX 154
|
||||
#define SUBSPID4_IN_IDX 155
|
||||
#define SUBSPID4_OUT_IDX 155
|
||||
#define SUBSPID5_IN_IDX 156
|
||||
#define SUBSPID5_OUT_IDX 156
|
||||
#define SUBSPID6_IN_IDX 157
|
||||
#define SUBSPID6_OUT_IDX 157
|
||||
#define SUBSPID7_IN_IDX 158
|
||||
#define SUBSPID7_OUT_IDX 158
|
||||
#define SUBSPIDQS_IN_IDX 159
|
||||
#define SUBSPIDQS_OUT_IDX 159
|
||||
#define PWM0_SYNC0_IN_IDX 160
|
||||
#define PWM0_OUT0A_IDX 160
|
||||
#define PWM0_SYNC1_IN_IDX 161
|
||||
#define PWM0_OUT0B_IDX 161
|
||||
#define PWM0_SYNC2_IN_IDX 162
|
||||
#define PWM0_OUT1A_IDX 162
|
||||
#define PWM0_F0_IN_IDX 163
|
||||
#define PWM0_OUT1B_IDX 163
|
||||
#define PWM0_F1_IN_IDX 164
|
||||
#define PWM0_OUT2A_IDX 164
|
||||
#define PWM0_F2_IN_IDX 165
|
||||
#define PWM0_OUT2B_IDX 165
|
||||
#define PWM0_CAP0_IN_IDX 166
|
||||
#define PWM1_OUT0A_IDX 166
|
||||
#define PWM0_CAP1_IN_IDX 167
|
||||
#define PWM1_OUT0B_IDX 167
|
||||
#define PWM0_CAP2_IN_IDX 168
|
||||
#define PWM1_OUT1A_IDX 168
|
||||
#define PWM1_SYNC0_IN_IDX 169
|
||||
#define PWM1_OUT1B_IDX 169
|
||||
#define PWM1_SYNC1_IN_IDX 170
|
||||
#define PWM1_OUT2A_IDX 170
|
||||
#define PWM1_SYNC2_IN_IDX 171
|
||||
#define PWM1_OUT2B_IDX 171
|
||||
#define PWM1_F0_IN_IDX 172
|
||||
#define SDHOST_CCLK_OUT_1_IDX 172
|
||||
#define PWM1_F1_IN_IDX 173
|
||||
#define SDHOST_CCLK_OUT_2_IDX 173
|
||||
#define PWM1_F2_IN_IDX 174
|
||||
#define SDHOST_RST_N_1_IDX 174
|
||||
#define PWM1_CAP0_IN_IDX 175
|
||||
#define SDHOST_RST_N_2_IDX 175
|
||||
#define PWM1_CAP1_IN_IDX 176
|
||||
#define SDHOST_CCMD_OD_PULLUP_EN_N_IDX176
|
||||
#define PWM1_CAP2_IN_IDX 177
|
||||
#define SDIO_TOHOST_INT_OUT_IDX 177
|
||||
#define SDHOST_CCMD_IN_1_IDX 178
|
||||
#define SDHOST_CCMD_OUT_1_IDX 178
|
||||
#define SDHOST_CCMD_IN_2_IDX 179
|
||||
#define SDHOST_CCMD_OUT_2_IDX 179
|
||||
#define SDHOST_CDATA_IN_10_IDX 180
|
||||
#define SDHOST_CDATA_OUT_10_IDX 180
|
||||
#define SDHOST_CDATA_IN_11_IDX 181
|
||||
#define SDHOST_CDATA_OUT_11_IDX 181
|
||||
#define SDHOST_CDATA_IN_12_IDX 182
|
||||
#define SDHOST_CDATA_OUT_12_IDX 182
|
||||
#define SDHOST_CDATA_IN_13_IDX 183
|
||||
#define SDHOST_CDATA_OUT_13_IDX 183
|
||||
#define SDHOST_CDATA_IN_14_IDX 184
|
||||
#define SDHOST_CDATA_OUT_14_IDX 184
|
||||
#define SDHOST_CDATA_IN_15_IDX 185
|
||||
#define SDHOST_CDATA_OUT_15_IDX 185
|
||||
#define SDHOST_CDATA_IN_16_IDX 186
|
||||
#define SDHOST_CDATA_OUT_16_IDX 186
|
||||
#define SDHOST_CDATA_IN_17_IDX 187
|
||||
#define SDHOST_CDATA_OUT_17_IDX 187
|
||||
#define PCMFSYNC_IN_IDX 188
|
||||
#define BT_AUDIO0_IRQ_IDX 188
|
||||
#define PCMCLK_IN_IDX 189
|
||||
#define BT_AUDIO1_IRQ_IDX 189
|
||||
#define PCMDIN_IDX 190
|
||||
#define BT_AUDIO2_IRQ_IDX 190
|
||||
#define RW_WAKEUP_REQ_IDX 191
|
||||
#define BLE_AUDIO0_IRQ_IDX 191
|
||||
#define SDHOST_DATA_STROBE_1_IDX 192
|
||||
#define BLE_AUDIO1_IRQ_IDX 192
|
||||
#define SDHOST_DATA_STROBE_2_IDX 193
|
||||
#define BLE_AUDIO2_IRQ_IDX 193
|
||||
#define SDHOST_CARD_DETECT_N_1_IDX 194
|
||||
#define PCMFSYNC_OUT_IDX 194
|
||||
#define SDHOST_CARD_DETECT_N_2_IDX 195
|
||||
#define PCMCLK_OUT_IDX 195
|
||||
#define SDHOST_CARD_WRITE_PRT_1_IDX 196
|
||||
#define PCMDOUT_IDX 196
|
||||
#define SDHOST_CARD_WRITE_PRT_2_IDX 197
|
||||
#define BLE_AUDIO_SYNC0_P_IDX 197
|
||||
#define SDHOST_CARD_INT_N_1_IDX 198
|
||||
#define BLE_AUDIO_SYNC1_P_IDX 198
|
||||
#define SDHOST_CARD_INT_N_2_IDX 199
|
||||
#define BLE_AUDIO_SYNC2_P_IDX 199
|
||||
#define ANT_SEL0_IDX 200
|
||||
#define ANT_SEL1_IDX 201
|
||||
#define ANT_SEL2_IDX 202
|
||||
#define ANT_SEL3_IDX 203
|
||||
#define ANT_SEL4_IDX 204
|
||||
#define ANT_SEL5_IDX 205
|
||||
#define ANT_SEL6_IDX 206
|
||||
#define ANT_SEL7_IDX 207
|
||||
#define SIG_IN_FUNC_223_IDX 208
|
||||
#define SIG_IN_FUNC223_IDX 208
|
||||
#define SIG_IN_FUNC_224_IDX 209
|
||||
#define SIG_IN_FUNC224_IDX 209
|
||||
#define SIG_IN_FUNC_225_IDX 210
|
||||
#define SIG_IN_FUNC225_IDX 210
|
||||
#define SIG_IN_FUNC_226_IDX 211
|
||||
#define SIG_IN_FUNC226_IDX 211
|
||||
#define SIG_IN_FUNC_227_IDX 212
|
||||
#define SIG_IN_FUNC227_IDX 212
|
||||
#define SDHOST_CDATA_IN_20_IDX 213
|
||||
#define SDHOST_CDATA_OUT_20_IDX 213
|
||||
#define SDHOST_CDATA_IN_21_IDX 214
|
||||
#define SDHOST_CDATA_OUT_21_IDX 214
|
||||
#define SDHOST_CDATA_IN_22_IDX 215
|
||||
#define SDHOST_CDATA_OUT_22_IDX 215
|
||||
#define SDHOST_CDATA_IN_23_IDX 216
|
||||
#define SDHOST_CDATA_OUT_23_IDX 216
|
||||
#define SDHOST_CDATA_IN_24_IDX 217
|
||||
#define SDHOST_CDATA_OUT_24_IDX 217
|
||||
#define SDHOST_CDATA_IN_25_IDX 218
|
||||
#define SDHOST_CDATA_OUT_25_IDX 218
|
||||
#define SDHOST_CDATA_IN_26_IDX 219
|
||||
#define SDHOST_CDATA_OUT_26_IDX 219
|
||||
#define SDHOST_CDATA_IN_27_IDX 220
|
||||
#define SDHOST_CDATA_OUT_27_IDX 220
|
||||
#define PRO_ALONEGPIO_IN0_IDX 221
|
||||
#define PRO_ALONEGPIO_OUT0_IDX 221
|
||||
#define PRO_ALONEGPIO_IN1_IDX 222
|
||||
#define PRO_ALONEGPIO_OUT1_IDX 222
|
||||
#define PRO_ALONEGPIO_IN2_IDX 223
|
||||
#define PRO_ALONEGPIO_OUT2_IDX 223
|
||||
#define PRO_ALONEGPIO_IN3_IDX 224
|
||||
#define PRO_ALONEGPIO_OUT3_IDX 224
|
||||
#define PRO_ALONEGPIO_IN4_IDX 225
|
||||
#define PRO_ALONEGPIO_OUT4_IDX 225
|
||||
#define PRO_ALONEGPIO_IN5_IDX 226
|
||||
#define PRO_ALONEGPIO_OUT5_IDX 226
|
||||
#define PRO_ALONEGPIO_IN6_IDX 227
|
||||
#define PRO_ALONEGPIO_OUT6_IDX 227
|
||||
#define PRO_ALONEGPIO_IN7_IDX 228
|
||||
#define PRO_ALONEGPIO_OUT7_IDX 228
|
||||
#define SYNCERR_IDX 229
|
||||
#define SYNCFOUND_FLAG_IDX 230
|
||||
#define EVT_CNTL_IMMEDIATE_ABORT_IDX 231
|
||||
#define LINKLBL_IDX 232
|
||||
#define DATA_EN_IDX 233
|
||||
#define DATA_IDX 234
|
||||
#define PKT_TX_ON_IDX 235
|
||||
#define PKT_RX_ON_IDX 236
|
||||
#define RW_TX_ON_IDX 237
|
||||
#define RW_RX_ON_IDX 238
|
||||
#define EVT_REQ_P_IDX 239
|
||||
#define EVT_STOP_P_IDX 240
|
||||
#define BT_MODE_ON_IDX 241
|
||||
#define GPIO_LC_DIAG0_IDX 242
|
||||
#define GPIO_LC_DIAG1_IDX 243
|
||||
#define GPIO_LC_DIAG2_IDX 244
|
||||
#define CH_IDX_IDX 245
|
||||
#define RX_WINDOW_IDX 246
|
||||
#define UPDATE_RX_IDX 247
|
||||
#define RX_STATUS_IDX 248
|
||||
#define CLK_GPIO_IDX 249
|
||||
#define NBT_BLE_IDX 250
|
||||
#define SIG_GPIO_OUT_IDX 256
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_GPIO_SIGMAP_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,467 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/hardware/esp32s3_iomux.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_IOMUX_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_IOMUX_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "esp32s3_soc.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-preprocessor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* 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 IO_MUX_GPIO47_REG PERIPHS_IO_MUX_SPICLK_P_U
|
||||
#define IO_MUX_GPIO48_REG PERIPHS_IO_MUX_SPICLK_N_U
|
||||
|
||||
#define FUNC_GPIO_GPIO 1
|
||||
#define PIN_FUNC_GPIO 1
|
||||
|
||||
#define GPIO_PAD_PULLUP(num) do{PIN_PULLDWN_DIS(IOMUX_REG_GPIO##num);PIN_PULLUP_EN(IOMUX_REG_GPIO##num);}while(0)
|
||||
#define GPIO_PAD_PULLDOWN(num) do{PIN_PULLUP_DIS(IOMUX_REG_GPIO##num);PIN_PULLDWN_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_CS1_GPIO_NUM 26
|
||||
#define SPI_HD_GPIO_NUM 27
|
||||
#define SPI_WP_GPIO_NUM 28
|
||||
#define SPI_CS0_GPIO_NUM 29
|
||||
#define SPI_CLK_GPIO_NUM 30
|
||||
#define SPI_Q_GPIO_NUM 31
|
||||
#define SPI_D_GPIO_NUM 32
|
||||
#define SPI_D4_GPIO_NUM 33
|
||||
#define SPI_D5_GPIO_NUM 34
|
||||
#define SPI_D6_GPIO_NUM 35
|
||||
#define SPI_D7_GPIO_NUM 36
|
||||
#define SPI_DQS_GPIO_NUM 37
|
||||
#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 48
|
||||
#define MAX_GPIO_NUM 53
|
||||
|
||||
#define REG_IO_MUX_BASE DR_REG_IO_MUX_BASE
|
||||
#define PIN_CTRL (REG_IO_MUX_BASE + 0x00)
|
||||
#define PAD_POWER_SEL BIT(15)
|
||||
#define PAD_POWER_SEL_V 0x1
|
||||
#define PAD_POWER_SEL_M BIT(15)
|
||||
#define PAD_POWER_SEL_S 15
|
||||
|
||||
#define PAD_POWER_SWITCH_DELAY 0x7
|
||||
#define PAD_POWER_SWITCH_DELAY_V 0x7
|
||||
#define PAD_POWER_SWITCH_DELAY_M (PAD_POWER_SWITCH_DELAY_V << PAD_POWER_SWITCH_DELAY_S)
|
||||
#define PAD_POWER_SWITCH_DELAY_S 12
|
||||
|
||||
#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_FSPIHD 4
|
||||
#define FUNC_GPIO9_SUBSPIHD 3
|
||||
#define FUNC_GPIO9_GPIO9 1
|
||||
#define FUNC_GPIO9_GPIO9_0 0
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO10_U (REG_IO_MUX_BASE + 0x2c)
|
||||
#define FUNC_GPIO10_FSPICS0 4
|
||||
#define FUNC_GPIO10_SUBSPICS0 3
|
||||
#define FUNC_GPIO10_FSPIIO4 2
|
||||
#define FUNC_GPIO10_GPIO10 1
|
||||
#define FUNC_GPIO10_GPIO10_0 0
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO11_U (REG_IO_MUX_BASE + 0x30)
|
||||
#define FUNC_GPIO11_FSPID 4
|
||||
#define FUNC_GPIO11_SUBSPID 3
|
||||
#define FUNC_GPIO11_FSPIIO5 2
|
||||
#define FUNC_GPIO11_GPIO11 1
|
||||
#define FUNC_GPIO11_GPIO11_0 0
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO12_U (REG_IO_MUX_BASE + 0x34)
|
||||
#define FUNC_GPIO12_FSPICLK 4
|
||||
#define FUNC_GPIO12_SUBSPICLK 3
|
||||
#define FUNC_GPIO12_FSPIIO6 2
|
||||
#define FUNC_GPIO12_GPIO12 1
|
||||
#define FUNC_GPIO12_GPIO12_0 0
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO13_U (REG_IO_MUX_BASE + 0x38)
|
||||
#define FUNC_GPIO13_FSPIQ 4
|
||||
#define FUNC_GPIO13_SUBSPIQ 3
|
||||
#define FUNC_GPIO13_FSPIIO7 2
|
||||
#define FUNC_GPIO13_GPIO13 1
|
||||
#define FUNC_GPIO13_GPIO13_0 0
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO14_U (REG_IO_MUX_BASE + 0x3c)
|
||||
#define FUNC_GPIO14_FSPIWP 4
|
||||
#define FUNC_GPIO14_SUBSPIWP 3
|
||||
#define FUNC_GPIO14_FSPIDQS 2
|
||||
#define FUNC_GPIO14_GPIO14 1
|
||||
#define FUNC_GPIO14_GPIO14_0 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_SPIIO4 4
|
||||
#define FUNC_GPIO33_SUBSPIHD 3
|
||||
#define FUNC_GPIO33_FSPIHD 2
|
||||
#define FUNC_GPIO33_GPIO33 1
|
||||
#define FUNC_GPIO33_GPIO33_0 0
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO34_U (REG_IO_MUX_BASE + 0x8c)
|
||||
#define FUNC_GPIO34_SPIIO5 4
|
||||
#define FUNC_GPIO34_SUBSPICS0 3
|
||||
#define FUNC_GPIO34_FSPICS0 2
|
||||
#define FUNC_GPIO34_GPIO34 1
|
||||
#define FUNC_GPIO34_GPIO34_0 0
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO35_U (REG_IO_MUX_BASE + 0x90)
|
||||
#define FUNC_GPIO35_SPIIO6 4
|
||||
#define FUNC_GPIO35_SUBSPID 3
|
||||
#define FUNC_GPIO35_FSPID 2
|
||||
#define FUNC_GPIO35_GPIO35 1
|
||||
#define FUNC_GPIO35_GPIO35_0 0
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO36_U (REG_IO_MUX_BASE + 0x94)
|
||||
#define FUNC_GPIO36_SPIIO7 4
|
||||
#define FUNC_GPIO36_SUBSPICLK 3
|
||||
#define FUNC_GPIO36_FSPICLK 2
|
||||
#define FUNC_GPIO36_GPIO36 1
|
||||
#define FUNC_GPIO36_GPIO36_0 0
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO37_U (REG_IO_MUX_BASE + 0x98)
|
||||
#define FUNC_GPIO37_SPIDQS 4
|
||||
#define FUNC_GPIO37_SUBSPIQ 3
|
||||
#define FUNC_GPIO37_FSPIQ 2
|
||||
#define FUNC_GPIO37_GPIO37 1
|
||||
#define FUNC_GPIO37_GPIO37_0 0
|
||||
|
||||
#define PERIPHS_IO_MUX_GPIO38_U (REG_IO_MUX_BASE + 0x9c)
|
||||
#define FUNC_GPIO38_SUBSPIWP 3
|
||||
#define FUNC_GPIO38_FSPIWP 2
|
||||
#define FUNC_GPIO38_GPIO38 1
|
||||
#define FUNC_GPIO38_GPIO38_0 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 PERIPHS_IO_MUX_SPICLK_P_U (REG_IO_MUX_BASE + 0xc0)
|
||||
#define FUNC_SPICLK_P_SUBSPICLK_DIFF 2
|
||||
#define FUNC_SPICLK_P_GPIO47 1
|
||||
#define FUNC_SPICLK_P_SPICLK_DIFF 0
|
||||
|
||||
#define PERIPHS_IO_MUX_SPICLK_N_U (REG_IO_MUX_BASE + 0xc4)
|
||||
#define FUNC_SPICLK_N_SUBSPICLK_DIFF 2
|
||||
#define FUNC_SPICLK_N_GPIO48 1
|
||||
#define FUNC_SPICLK_N_SPICLK_DIFF 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 0x1907160
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_IOMUX_H */
|
||||
@@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/hardware/esp32s3_rom_layout.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_ROM_LAYOUT_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_ROM_LAYOUT_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Structure and functions for returning ROM global layout
|
||||
*
|
||||
* This is for address symbols defined in the linker script,
|
||||
* which may change during ECOs.
|
||||
*/
|
||||
|
||||
struct esp32s3_rom_layout_s
|
||||
{
|
||||
uintptr_t dram0_stack_shared_mem_start;
|
||||
uintptr_t dram0_rtos_reserved_start;
|
||||
uintptr_t stack_sentry;
|
||||
uintptr_t stack;
|
||||
uintptr_t stack_sentry_app;
|
||||
uintptr_t stack_app;
|
||||
|
||||
/* BTDM data */
|
||||
|
||||
uintptr_t data_start_btdm;
|
||||
uintptr_t data_end_btdm;
|
||||
uintptr_t bss_start_btdm;
|
||||
uintptr_t bss_end_btdm;
|
||||
uintptr_t data_start_btdm_rom;
|
||||
uintptr_t data_end_btdm_rom;
|
||||
uintptr_t data_start_interface_btdm;
|
||||
uintptr_t data_end_interface_btdm;
|
||||
uintptr_t bss_start_interface_btdm;
|
||||
uintptr_t bss_end_interface_btdm;
|
||||
|
||||
/* PHY data */
|
||||
|
||||
uintptr_t dram_start_phyrom;
|
||||
uintptr_t dram_end_phyrom;
|
||||
|
||||
/* Wi-Fi data */
|
||||
|
||||
uintptr_t dram_start_coexist;
|
||||
uintptr_t dram_end_coexist;
|
||||
uintptr_t dram_start_net80211;
|
||||
uintptr_t dram_end_net80211;
|
||||
uintptr_t dram_start_pp;
|
||||
uintptr_t dram_end_pp;
|
||||
uintptr_t data_start_interface_coexist;
|
||||
uintptr_t data_end_interface_coexist;
|
||||
uintptr_t bss_start_interface_coexist;
|
||||
uintptr_t bss_end_interface_coexist;
|
||||
uintptr_t data_start_interface_net80211;
|
||||
uintptr_t data_end_interface_net80211;
|
||||
uintptr_t bss_start_interface_net80211;
|
||||
uintptr_t bss_end_interface_net80211;
|
||||
uintptr_t data_start_interface_pp;
|
||||
uintptr_t data_end_interface_pp;
|
||||
uintptr_t bss_start_interface_pp;
|
||||
uintptr_t bss_end_interface_pp;
|
||||
uintptr_t dram_start_usbdev_rom;
|
||||
uintptr_t dram_end_usbdev_rom;
|
||||
uintptr_t dram_start_uart_rom;
|
||||
uintptr_t dram_end_uart_rom;
|
||||
};
|
||||
|
||||
extern const struct esp32s3_rom_layout_s *ets_rom_layout_p;
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_ROM_LAYOUT_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,487 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/esp32s3/hardware/esp32s3_soc.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you 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 __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_SOC_H
|
||||
#define __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_SOC_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "xtensa_attr.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define PRO_CPU_NUM (0)
|
||||
#define APP_CPU_NUM (1)
|
||||
|
||||
#define PRO_CPUID (0xcdcd)
|
||||
#define APP_CPUID (0xabab)
|
||||
|
||||
/* Largest span of contiguous memory (DRAM or IRAM) in the address space */
|
||||
|
||||
#define SOC_MAX_CONTIGUOUS_RAM_SIZE (SOC_EXTRAM_DATA_HIGH - SOC_EXTRAM_DATA_LOW)
|
||||
|
||||
#define DR_REG_UART_BASE 0x60000000
|
||||
#define DR_REG_SPI1_BASE 0x60002000
|
||||
#define DR_REG_SPI0_BASE 0x60003000
|
||||
#define DR_REG_GPIO_BASE 0x60004000
|
||||
#define DR_REG_GPIO_SD_BASE 0x60004f00
|
||||
|
||||
#define DR_REG_FE2_BASE 0x60005000
|
||||
#define DR_REG_FE_BASE 0x60006000
|
||||
|
||||
#define DR_REG_EFUSE_BASE 0x60007000
|
||||
#define DR_REG_RTCCNTL_BASE 0x60008000
|
||||
#define DR_REG_RTCIO_BASE 0x60008400
|
||||
#define DR_REG_SENS_BASE 0x60008800
|
||||
#define DR_REG_RTC_I2C_BASE 0x60008C00
|
||||
#define DR_REG_IO_MUX_BASE 0x60009000
|
||||
|
||||
#define DR_REG_HINF_BASE 0x6000B000
|
||||
#define DR_REG_UHCI1_BASE 0x6000C000
|
||||
|
||||
#define DR_REG_I2S_BASE 0x6000F000
|
||||
#define DR_REG_UART1_BASE 0x60010000
|
||||
|
||||
#define DR_REG_BT_BASE 0x60011000
|
||||
|
||||
#define DR_REG_I2C_EXT_BASE 0x60013000
|
||||
#define DR_REG_UHCI0_BASE 0x60014000
|
||||
|
||||
#define DR_REG_SLCHOST_BASE 0x60015000
|
||||
|
||||
#define DR_REG_RMT_BASE 0x60016000
|
||||
#define DR_REG_PCNT_BASE 0x60017000
|
||||
|
||||
#define DR_REG_SLC_BASE 0x60018000
|
||||
|
||||
#define DR_REG_LEDC_BASE 0x60019000
|
||||
|
||||
#define DR_REG_NRX_BASE 0x6001CC00
|
||||
#define DR_REG_BB_BASE 0x6001D000
|
||||
|
||||
#define DR_REG_PWM0_BASE 0x6001E000
|
||||
#define DR_REG_TIMERGROUP0_BASE 0x6001F000
|
||||
#define DR_REG_TIMERGROUP1_BASE 0x60020000
|
||||
#define DR_REG_RTC_SLOWMEM_BASE 0x60021000
|
||||
#define DR_REG_SYSTIMER_BASE 0x60023000
|
||||
#define DR_REG_SPI2_BASE 0x60024000
|
||||
#define DR_REG_SPI3_BASE 0x60025000
|
||||
#define DR_REG_SYSCON_BASE 0x60026000
|
||||
#define DR_REG_APB_CTRL_BASE 0x60026000 /* Old name for SYSCON, to be removed */
|
||||
#define DR_REG_I2C1_EXT_BASE 0x60027000
|
||||
#define DR_REG_SDMMC_BASE 0x60028000
|
||||
|
||||
#define DR_REG_PERI_BACKUP_BASE 0x6002A000
|
||||
|
||||
#define DR_REG_TWAI_BASE 0x6002B000
|
||||
#define DR_REG_PWM1_BASE 0x6002C000
|
||||
#define DR_REG_I2S1_BASE 0x6002D000
|
||||
#define DR_REG_UART2_BASE 0x6002E000
|
||||
|
||||
#define DR_REG_USB_DEVICE_BASE 0x60038000
|
||||
#define DR_REG_USB_WRAP_BASE 0x60039000
|
||||
#define DR_REG_AES_BASE 0x6003A000
|
||||
#define DR_REG_SHA_BASE 0x6003B000
|
||||
#define DR_REG_RSA_BASE 0x6003C000
|
||||
#define DR_REG_HMAC_BASE 0x6003E000
|
||||
#define DR_REG_DIGITAL_SIGNATURE_BASE 0x6003D000
|
||||
#define DR_REG_GDMA_BASE 0x6003F000
|
||||
#define DR_REG_APB_SARADC_BASE 0x60040000
|
||||
#define DR_REG_LCD_CAM_BASE 0x60041000
|
||||
|
||||
#define DR_REG_SYSTEM_BASE 0x600C0000
|
||||
#define DR_REG_SENSITIVE_BASE 0x600C1000
|
||||
#define DR_REG_INTERRUPT_BASE 0x600C2000
|
||||
|
||||
/* Cache configuration */
|
||||
|
||||
#define DR_REG_EXTMEM_BASE 0x600C4000
|
||||
#define DR_REG_MMU_TABLE 0x600C5000
|
||||
#define DR_REG_ITAG_TABLE 0x600C6000
|
||||
#define DR_REG_DTAG_TABLE 0x600C8000
|
||||
|
||||
#define DR_REG_EXT_MEM_ENC 0x600CC000
|
||||
|
||||
#define DR_REG_ASSIST_DEBUG_BASE 0x600CE000
|
||||
#define DR_REG_WORLD_CNTL_BASE 0x600D0000
|
||||
#define DR_REG_DPORT_END 0x600D3FFC
|
||||
|
||||
#define REG_UHCI_BASE(i) (DR_REG_UHCI0_BASE - (i) * 0x8000)
|
||||
#define REG_UART_BASE( i ) (DR_REG_UART_BASE + (i) * 0x10000 + ((i) > 1 ? 0xe000 : 0))
|
||||
#define REG_UART_AHB_BASE(i) (0x60000000 + (i) * 0x10000 + ((i) > 1 ? 0xe000 : 0 ))
|
||||
#define UART_FIFO_AHB_REG(i) (REG_UART_AHB_BASE(i) + 0x0)
|
||||
#define REG_I2S_BASE( i ) (DR_REG_I2S_BASE + (i) * 0x1E000)
|
||||
#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)
|
||||
|
||||
#define BIT(nr) (1UL << (nr))
|
||||
|
||||
/* 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,
|
||||
* used when _f is not left shifted by _f##_S
|
||||
*/
|
||||
|
||||
#define REG_GET_FIELD(_r, _f) ((REG_READ(_r) >> (_f##_S)) & (_f##_V))
|
||||
|
||||
/* Set field to register,
|
||||
* used when _f is not left shifted by _f##_S
|
||||
*/
|
||||
|
||||
#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))
|
||||
|
||||
/* Extract the field from the register and shift it to avoid wrong reading */
|
||||
|
||||
#define REG_MASK(_reg, _field) ((_reg & (_field##_M)) >> (_field##_S))
|
||||
|
||||
/* Helper to place a value in a field */
|
||||
|
||||
#define VALUE_TO_FIELD(_value, _field) ((_value << (_field##_S)) & (_field##_M))
|
||||
|
||||
/* Peripheral Clock */
|
||||
|
||||
#define APB_CLK_FREQ_ROM (40*1000000)
|
||||
#define CPU_CLK_FREQ_ROM (40*1000000)
|
||||
#define UART_CLK_FREQ_ROM (40*1000000)
|
||||
#define EFUSE_CLK_FREQ_ROM (20*1000000)
|
||||
#define CPU_CLK_FREQ APB_CLK_FREQ
|
||||
#define APB_CLK_FREQ (80*1000000)
|
||||
#define REF_CLK_FREQ (1000000)
|
||||
#define RTC_CLK_FREQ (20*1000000)
|
||||
#define XTAL_CLK_FREQ (40*1000000)
|
||||
#define UART_CLK_FREQ APB_CLK_FREQ
|
||||
#define WDT_CLK_FREQ APB_CLK_FREQ
|
||||
#define TIMER_CLK_FREQ (80000000>>4)
|
||||
#define SPI_CLK_DIV 4
|
||||
#define TICKS_PER_US_ROM 40
|
||||
#define GPIO_MATRIX_DELAY_NS 0
|
||||
|
||||
/* Overall memory map */
|
||||
|
||||
#define SOC_DROM_LOW 0x3C000000
|
||||
#define SOC_DROM_HIGH 0x3D000000
|
||||
#define SOC_IROM_LOW 0x42000000
|
||||
#define SOC_IROM_HIGH 0x44000000
|
||||
#define SOC_IRAM_LOW 0x40370000
|
||||
#define SOC_IRAM_HIGH 0x403E0000
|
||||
#define SOC_DRAM_LOW 0x3FC88000
|
||||
#define SOC_DRAM_HIGH 0x3FD00000
|
||||
|
||||
#define SOC_RTC_IRAM_LOW 0x600FE000
|
||||
#define SOC_RTC_IRAM_HIGH 0x60100000
|
||||
#define SOC_RTC_DRAM_LOW 0x600FE000
|
||||
#define SOC_RTC_DRAM_HIGH 0x60100000
|
||||
|
||||
#define SOC_RTC_DATA_LOW 0x50000000
|
||||
#define SOC_RTC_DATA_HIGH 0x50002000
|
||||
|
||||
#define SOC_EXTRAM_DATA_LOW 0x3D000000
|
||||
#define SOC_EXTRAM_DATA_HIGH 0x3E000000
|
||||
#define SOC_IROM_MASK_LOW 0x40000000
|
||||
#define SOC_IROM_MASK_HIGH 0x4001A100
|
||||
|
||||
#define SOC_EXTRAM_DATA_SIZE (SOC_EXTRAM_DATA_HIGH - SOC_EXTRAM_DATA_LOW)
|
||||
|
||||
/* 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 0x40378000
|
||||
#define SOC_DIRAM_IRAM_HIGH 0x403E0000
|
||||
#define SOC_DIRAM_DRAM_LOW 0x3FC88000
|
||||
#define SOC_DIRAM_DRAM_HIGH 0x3FCF0000
|
||||
|
||||
/* Region of memory accessible via DMA in internal memory.
|
||||
* See esp_ptr_dma_capable().
|
||||
*/
|
||||
|
||||
#define SOC_DMA_LOW 0x3FC88000
|
||||
#define SOC_DMA_HIGH 0x3FD00000
|
||||
|
||||
/* Region of memory accessible via DMA in external memory.
|
||||
* See esp_ptr_dma_ext_capable().
|
||||
*/
|
||||
|
||||
#define SOC_DMA_EXT_LOW SOC_EXTRAM_DATA_LOW
|
||||
#define SOC_DMA_EXT_HIGH SOC_EXTRAM_DATA_HIGH
|
||||
|
||||
/* Region of memory that is byte-accessible.
|
||||
* See esp_ptr_byte_accessible().
|
||||
*/
|
||||
|
||||
#define SOC_BYTE_ACCESSIBLE_LOW 0x3FC88000
|
||||
#define SOC_BYTE_ACCESSIBLE_HIGH 0x3FD00000
|
||||
|
||||
/* 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 0x3FC88000
|
||||
#define SOC_MEM_INTERNAL_HIGH 0x403E2000
|
||||
|
||||
/* Start (highest address) of ROM boot stack, only relevant during
|
||||
* early boot
|
||||
*/
|
||||
|
||||
#define SOC_ROM_STACK_START 0x3fcebf10
|
||||
|
||||
/* Interrupt cpu using table, Please see the core-isa.h */
|
||||
|
||||
/****************************************************************************
|
||||
* Intr num Level Type PRO CPU usage APP CPU usage
|
||||
* 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 DPORT ACCESS DPORT ACCESS
|
||||
* 29 3 software Reserved Reserved
|
||||
* 30 4 extern edge Reserved Reserved
|
||||
* 31 5 extern level
|
||||
****************************************************************************/
|
||||
|
||||
/* Core voltage needs to be increased in two cases:
|
||||
* 1. running at 240 MHz
|
||||
* 2. running with 80MHz Flash frequency
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ESP32S3_FLASH_FREQ_80M) || defined(CONFIG_ESP32S3_FLASH_FREQ_120M)
|
||||
#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
|
||||
|
||||
/* 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
|
||||
#define ETS_DPORT_INUM 28
|
||||
|
||||
/* 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
|
||||
#define ETS_SPI2_INUM 1
|
||||
|
||||
/* 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
|
||||
|
||||
#define MHZ (1000000)
|
||||
#define RTC_PLL_FREQ_320M 320
|
||||
#define RTC_PLL_FREQ_480M 480
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_sp_dram
|
||||
*
|
||||
* Description:
|
||||
* Check if the stack pointer is in DRAM.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline bool IRAM_ATTR esp32s3_sp_dram(uint32_t sp)
|
||||
{
|
||||
return (sp >= SOC_DRAM_LOW + 0x10 && sp < SOC_DRAM_HIGH - 0x10);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_ptr_extram
|
||||
*
|
||||
* Description:
|
||||
* Check if the buffer comes from the external RAM
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline bool IRAM_ATTR esp32s3_ptr_extram(const void *p)
|
||||
{
|
||||
return ((intptr_t)p >= SOC_EXTRAM_DATA_LOW &&
|
||||
(intptr_t)p < SOC_EXTRAM_DATA_HIGH);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32s3_ptr_exec
|
||||
*
|
||||
* Description:
|
||||
* Check if the pointer is within an executable range.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline bool IRAM_ATTR esp32s3_ptr_exec(const void *p)
|
||||
{
|
||||
intptr_t ip = (intptr_t)p;
|
||||
return (ip >= SOC_IROM_LOW && ip < SOC_IROM_HIGH)
|
||||
|| (ip >= SOC_IRAM_LOW && ip < SOC_IRAM_HIGH)
|
||||
|| (ip >= SOC_IROM_MASK_LOW && ip < SOC_IROM_MASK_HIGH)
|
||||
#if defined(SOC_CACHE_APP_LOW) && !defined(CONFIG_SMP)
|
||||
|| (ip >= SOC_CACHE_APP_LOW && ip < SOC_CACHE_APP_HIGH)
|
||||
#endif
|
||||
|| (ip >= SOC_RTC_IRAM_LOW && ip < SOC_RTC_IRAM_HIGH);
|
||||
}
|
||||
|
||||
#endif /* __ARCH_XTENSA_SRC_ESP32S3_HARDWARE_ESP32S3_SOC_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,7 @@ ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCLANG), y)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_XTENSA_TOOLCHAIN_ESP), y)
|
||||
CROSSDEV = xtensa-esp32s2-elf-
|
||||
CROSSDEV = xtensa-$(CONFIG_ARCH_CHIP)-elf-
|
||||
endif
|
||||
|
||||
ARCHCPUFLAGS =
|
||||
|
||||
@@ -279,6 +279,17 @@ config ARCH_BOARD_ESP32S2_SAOLA_1
|
||||
---help---
|
||||
This is the ESP32-S2-Saola-1 board
|
||||
|
||||
config ARCH_BOARD_ESP32S3_DEVKIT
|
||||
bool "Espressif ESP32-S3 DevKit"
|
||||
depends on ARCH_CHIP_ESP32S3WROOM1 || ARCH_CHIP_ESP32S3MINI1
|
||||
select ARCH_HAVE_LEDS
|
||||
---help---
|
||||
The ESP32-S3 DevKit features the ESP32-S3 CPU with dual Xtensa LX7 cores.
|
||||
It comes in two flavors, the ESP32-S3-DevKitM-1 and the ESP32-S3-DevKitC-1.
|
||||
The ESP32-C3-DevKitM-1 version contains the ESP32-S3-MINI-1/1U module and the
|
||||
ESP32-S3-DevKitC-1 version may be based either on ESP32-S3-WROOM-1/1U or
|
||||
ESP32-S3-WROOM-2/2U.
|
||||
|
||||
config ARCH_BOARD_ET_STM32_STAMP
|
||||
bool "Futurlec: ET-STM32 Stamp"
|
||||
depends on ARCH_CHIP_STM32F103RE
|
||||
@@ -2401,6 +2412,7 @@ config ARCH_BOARD
|
||||
default "esp32-wrover-kit" if ARCH_BOARD_ESP32_WROVERKIT
|
||||
default "esp32c3-devkit" if ARCH_BOARD_ESP32C3_DEVKIT
|
||||
default "esp32s2-saola-1" if ARCH_BOARD_ESP32S2_SAOLA_1
|
||||
default "esp32s3-devkit" if ARCH_BOARD_ESP32S3_DEVKIT
|
||||
default "et-stm32-stamp" if ARCH_BOARD_ET_STM32_STAMP
|
||||
default "ez80f910200kitg" if ARCH_BOARD_EZ80F910200KITG
|
||||
default "ez80f910200zco" if ARCH_BOARD_EZ80F910200ZCO
|
||||
@@ -3282,6 +3294,12 @@ endif
|
||||
if ARCH_BOARD_ESP32S2_SAOLA_1
|
||||
source "boards/xtensa/esp32s2/esp32s2-saola-1/Kconfig"
|
||||
endif
|
||||
if ARCH_CHIP_ESP32S3 && !ARCH_BOARD_CUSTOM
|
||||
source "boards/xtensa/esp32s3/common/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_ESP32S3_DEVKIT
|
||||
source "boards/xtensa/esp32s3/esp32s3-devkit/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_SIM
|
||||
source "boards/sim/sim/sim/Kconfig"
|
||||
endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user