1 /*
2  * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 // The long term plan is to have a single soc_caps.h for all peripherals.
8 // During the refactoring and multichip support development process, we
9 // separate these information into periph_caps.h for each peripheral and
10 // include them here to avoid developing conflicts.
11 
12 #pragma once
13 
14 /*-------------------------- COMMON CAPS ---------------------------------------*/
15 #define SOC_ADC_SUPPORTED               1
16 #define SOC_PCNT_SUPPORTED              1
17 #define SOC_TWAI_SUPPORTED              1
18 #define SOC_GDMA_SUPPORTED              1
19 #define SOC_LCDCAM_SUPPORTED            1
20 #define SOC_MCPWM_SUPPORTED             1
21 #define SOC_DEDICATED_GPIO_SUPPORTED    1
22 #define SOC_CPU_CORES_NUM               2
23 #define SOC_CACHE_SUPPORT_WRAP          1
24 #define SOC_ULP_SUPPORTED               1
25 #define SOC_BT_SUPPORTED                1
26 #define SOC_USB_OTG_SUPPORTED           1
27 #define SOC_USB_SERIAL_JTAG_SUPPORTED   1
28 #define SOC_RTC_SLOW_MEM_SUPPORTED      1
29 #define SOC_CCOMP_TIMER_SUPPORTED       1
30 #define SOC_DIG_SIGN_SUPPORTED          1
31 #define SOC_HMAC_SUPPORTED              1
32 #define SOC_ASYNC_MEMCPY_SUPPORTED      1
33 #define SOC_SUPPORTS_SECURE_DL_MODE     1
34 #define SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS 3
35 #define SOC_EFUSE_REVOKE_BOOT_KEY_DIGESTS 1
36 #define SOC_SDMMC_HOST_SUPPORTED        1
37 #define SOC_FLASH_ENCRYPTION_XTS_AES      1
38 #define SOC_FLASH_ENCRYPTION_XTS_AES_256 1
39 #define SOC_PSRAM_DMA_CAPABLE           1
40 #define SOC_XT_WDT_SUPPORTED            1
41 
42 /*-------------------------- SOC CAPS ----------------------------------------*/
43 #define SOC_APPCPU_HAS_CLOCK_GATING_BUG (1)
44 
45 /*-------------------------- ADC CAPS ----------------------------------------*/
46 /*!< SAR ADC Module*/
47 #define SOC_ADC_RTC_CTRL_SUPPORTED              1
48 #define SOC_ADC_DIG_CTRL_SUPPORTED              1
49 #define SOC_ADC_ARBITER_SUPPORTED               1
50 #define SOC_ADC_FILTER_SUPPORTED                1
51 #define SOC_ADC_MONITOR_SUPPORTED               1
52 #define SOC_ADC_PERIPH_NUM                      (2)
53 #define SOC_ADC_CHANNEL_NUM(PERIPH_NUM)         (10)
54 #define SOC_ADC_MAX_CHANNEL_NUM                 (10)
55 
56 /*!< Digital */
57 #define SOC_ADC_DIGI_CONTROLLER_NUM             (2)
58 #define SOC_ADC_PATT_LEN_MAX                    (24)    //Two pattern table, each contains 12 items. Each item takes 1 byte
59 #define SOC_ADC_DIGI_MIN_BITWIDTH               (12)
60 #define SOC_ADC_DIGI_MAX_BITWIDTH               (12)
61 /*!< F_sample = F_digi_con / 2 / interval. F_digi_con = 5M for now. 30 <= interva <= 4095 */
62 #define SOC_ADC_SAMPLE_FREQ_THRES_HIGH          83333
63 #define SOC_ADC_SAMPLE_FREQ_THRES_LOW           611
64 
65 /*!< RTC */
66 #define SOC_ADC_MAX_BITWIDTH                    (12)
67 
68 /*!< Calibration */
69 #define SOC_ADC_CALIBRATION_V1_SUPPORTED        (1) /*!< support HW offset calibration version 1*/
70 
71 
72 /*-------------------------- APB BACKUP DMA CAPS -------------------------------*/
73 #define SOC_APB_BACKUP_DMA              (1)
74 
75 /*-------------------------- BROWNOUT CAPS -----------------------------------*/
76 #include "brownout_caps.h"
77 
78 /*-------------------------- CPU CAPS ----------------------------------------*/
79 #include "cpu_caps.h"
80 
81 /*-------------------------- DIGITAL SIGNATURE CAPS ----------------------------------------*/
82 /** The maximum length of a Digital Signature in bits. */
83 #define SOC_DS_SIGNATURE_MAX_BIT_LEN (4096)
84 
85 /** Initialization vector (IV) length for the RSA key parameter message digest (MD) in bytes. */
86 #define SOC_DS_KEY_PARAM_MD_IV_LENGTH (16)
87 
88 /** Maximum wait time for DS parameter decryption key. If overdue, then key error.
89     See TRM DS chapter for more details */
90 #define SOC_DS_KEY_CHECK_MAX_WAIT_US (1100)
91 
92 /*-------------------------- GDMA CAPS ---------------------------------------*/
93 #define SOC_GDMA_GROUPS            (1)  // Number of GDMA groups
94 #define SOC_GDMA_PAIRS_PER_GROUP   (5)  // Number of GDMA pairs in each group
95 #define SOC_GDMA_SUPPORT_PSRAM     (1)  // GDMA can access external PSRAM
96 #define SOC_GDMA_PSRAM_MIN_ALIGN   (16) // Minimal alignment for PSRAM transaction
97 
98 /*-------------------------- GPIO CAPS ---------------------------------------*/
99 #include "gpio_caps.h"
100 
101 /*-------------------------- Dedicated GPIO CAPS -----------------------------*/
102 #define SOC_DEDIC_GPIO_OUT_CHANNELS_NUM (8) /*!< 8 outward channels on each CPU core */
103 #define SOC_DEDIC_GPIO_IN_CHANNELS_NUM  (8) /*!< 8 inward channels on each CPU core */
104 #define SOC_DEDIC_GPIO_OUT_AUTO_ENABLE  (1) /*!< Dedicated GPIO output attribution is enabled automatically */
105 
106 /*-------------------------- I2C CAPS ----------------------------------------*/
107 #include "i2c_caps.h"
108 
109 /*-------------------------- I2S CAPS ----------------------------------------*/
110 #define SOC_I2S_NUM                 (2)
111 #define SOC_I2S_SUPPORTS_PCM        (1)
112 #define SOC_I2S_SUPPORTS_PDM_TX     (1)
113 #define SOC_I2S_SUPPORTS_PDM_RX     (1)
114 #define SOC_I2S_SUPPORTS_PDM_CODEC  (1)
115 #define SOC_I2S_SUPPORTS_TDM        (1)
116 
117 /*-------------------------- LEDC CAPS ---------------------------------------*/
118 #include "ledc_caps.h"
119 
120 /*-------------------------- MCPWM CAPS --------------------------------------*/
121 #define SOC_MCPWM_GROUPS                     (2)    ///< 2 MCPWM groups on the chip (i.e., the number of independent MCPWM peripherals)
122 #define SOC_MCPWM_TIMERS_PER_GROUP           (3)    ///< The number of timers that each group has
123 #define SOC_MCPWM_OPERATORS_PER_GROUP        (3)    ///< The number of operators that each group has
124 #define SOC_MCPWM_COMPARATORS_PER_OPERATOR   (2)    ///< The number of comparators that each operator has
125 #define SOC_MCPWM_GENERATORS_PER_OPERATOR    (2)    ///< The number of generators that each operator has
126 #define SOC_MCPWM_TRIGGERS_PER_OPERATOR      (2)    ///< The number of triggers that each operator has
127 #define SOC_MCPWM_GPIO_FAULTS_PER_GROUP      (3)    ///< The number of fault signal detectors that each group has
128 #define SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP   (1)    ///< The number of capture timers that each group has
129 #define SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER (3)    ///< The number of capture channels that each capture timer has
130 #define SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP    (3)    ///< The number of GPIO synchros that each group has
131 #define SOC_MCPWM_SWSYNC_CAN_PROPAGATE       (1)    ///< Software sync event can be routed to its output
132 #define SOC_MCPWM_BASE_CLK_HZ       (160000000ULL)  ///< Base Clock frequency of 160MHz
133 
134 /*-------------------------- MPU CAPS ----------------------------------------*/
135 #include "mpu_caps.h"
136 
137 /*-------------------------- PCNT CAPS ---------------------------------------*/
138 #define SOC_PCNT_GROUPS               (1)
139 #define SOC_PCNT_UNITS_PER_GROUP      (4)
140 #define SOC_PCNT_CHANNELS_PER_UNIT    (2)
141 #define SOC_PCNT_THRES_POINT_PER_UNIT (2)
142 
143 /*-------------------------- RMT CAPS ----------------------------------------*/
144 #define SOC_RMT_GROUPS                    (1)  /*!< One RMT group */
145 #define SOC_RMT_TX_CANDIDATES_PER_GROUP   (4)  /*!< Number of channels that capable of Transmit in each group */
146 #define SOC_RMT_RX_CANDIDATES_PER_GROUP   (4)  /*!< Number of channels that capable of Receive in each group */
147 #define SOC_RMT_CHANNELS_PER_GROUP        (8)  /*!< Total 8 channels */
148 #define SOC_RMT_MEM_WORDS_PER_CHANNEL     (48) /*!< Each channel owns 48 words memory (1 word = 4 Bytes) */
149 #define SOC_RMT_SUPPORT_RX_PINGPONG       (1)  /*!< Support Ping-Pong mode on RX path */
150 #define SOC_RMT_SUPPORT_RX_DEMODULATION   (1)  /*!< Support signal demodulation on RX path (i.e. remove carrier) */
151 #define SOC_RMT_SUPPORT_TX_LOOP_COUNT     (1)  /*!< Support transmit specified number of cycles in loop mode */
152 #define SOC_RMT_SUPPORT_TX_LOOP_AUTOSTOP  (1)  /*!< Hardware support of auto-stop in loop mode */
153 #define SOC_RMT_SUPPORT_TX_SYNCHRO        (1)  /*!< Support coordinate a group of TX channels to start simultaneously */
154 #define SOC_RMT_SUPPORT_XTAL              (1)  /*!< Support set XTAL clock as the RMT clock source */
155 
156 
157 /*-------------------------- LCD CAPS ----------------------------------------*/
158 /* Notes: On esp32-s3, I80 bus and RGB timing generator can't work at the same time */
159 #define SOC_LCD_I80_SUPPORTED           (1)  /*!< Intel 8080 LCD is supported */
160 #define SOC_LCD_RGB_SUPPORTED           (1)  /*!< RGB LCD is supported */
161 #define SOC_LCD_I80_BUSES               (1)  /*!< Has one LCD Intel 8080 bus */
162 #define SOC_LCD_RGB_PANELS              (1)  /*!< Support one RGB LCD panel */
163 #define SOC_LCD_I80_BUS_WIDTH           (16) /*!< Intel 8080 bus width */
164 #define SOC_LCD_RGB_DATA_WIDTH          (16) /*!< Number of LCD data lines */
165 
166 /*-------------------------- RTC CAPS --------------------------------------*/
167 #define SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH       (128)
168 #define SOC_RTC_CNTL_CPU_PD_REG_FILE_NUM        (549)
169 #define SOC_RTC_CNTL_CPU_PD_DMA_ADDR_ALIGN      (SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH >> 3)
170 #define SOC_RTC_CNTL_CPU_PD_DMA_BLOCK_SIZE      (SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH >> 3)
171 
172 #define SOC_RTC_CNTL_CPU_PD_RETENTION_MEM_SIZE  (SOC_RTC_CNTL_CPU_PD_REG_FILE_NUM * (SOC_RTC_CNTL_CPU_PD_DMA_BUS_WIDTH >> 3))
173 
174 /* I/D Cache tag memory retention hardware parameters */
175 #define SOC_RTC_CNTL_TAGMEM_PD_DMA_BUS_WIDTH    (128)
176 #define SOC_RTC_CNTL_TAGMEM_PD_DMA_ADDR_ALIGN   (SOC_RTC_CNTL_TAGMEM_PD_DMA_BUS_WIDTH >> 3)
177 
178 /*-------------------------- RTCIO CAPS --------------------------------------*/
179 #include "rtc_io_caps.h"
180 
181 /*-------------------------- SIGMA DELTA CAPS --------------------------------*/
182 #define SOC_SIGMADELTA_NUM         (1) // 1 sigma-delta peripheral
183 #define SOC_SIGMADELTA_CHANNEL_NUM (8) // 8 channels
184 
185 /*-------------------------- SPI CAPS ----------------------------------------*/
186 #define SOC_SPI_PERIPH_NUM                  3
187 #define SOC_SPI_DMA_CHAN_NUM                3
188 #define SOC_SPI_PERIPH_CS_NUM(i)            3
189 #define SOC_SPI_MAXIMUM_BUFFER_SIZE         64
190 #define SOC_SPI_SUPPORT_DDRCLK              1
191 #define SOC_SPI_SLAVE_SUPPORT_SEG_TRANS     1
192 #define SOC_SPI_SUPPORT_CD_SIG              1
193 #define SOC_SPI_SUPPORT_CONTINUOUS_TRANS    1
194 #define SOC_SPI_SUPPORT_SLAVE_HD_VER2       1
195 
196 // Peripheral supports DIO, DOUT, QIO, or QOUT
197 #define SOC_SPI_PERIPH_SUPPORT_MULTILINE_MODE(host_id)  ({(void)host_id; 1;})
198 
199 // Peripheral supports output given level during its "dummy phase"
200 #define SOC_SPI_PERIPH_SUPPORT_CONTROL_DUMMY_OUTPUT 1
201 #define SOC_MEMSPI_IS_INDEPENDENT                   1
202 #define SOC_SPI_MAX_PRE_DIVIDER                     16
203 #define SOC_SPI_SUPPORT_OCT                         1
204 
205 /*-------------------------- SPIRAM CAPS ----------------------------------------*/
206 #define SOC_SPIRAM_SUPPORTED            1
207 
208 /*-------------------------- SYS TIMER CAPS ----------------------------------*/
209 #define SOC_TOUCH_VERSION_2                (1)  // Hardware version of touch sensor
210 #define SOC_SYSTIMER_COUNTER_NUM           (2)  // Number of counter units
211 #define SOC_SYSTIMER_ALARM_NUM             (3)  // Number of alarm units
212 #define SOC_SYSTIMER_BIT_WIDTH_LO          (32) // Bit width of systimer low part
213 #define SOC_SYSTIMER_BIT_WIDTH_HI          (20) // Bit width of systimer high part
214 #define SOC_SYSTIMER_FIXED_TICKS_US        (16) // Number of ticks per microsecond is fixed
215 #define SOC_SYSTIMER_INT_LEVEL             (1)  // Systimer peripheral uses level
216 #define SOC_SYSTIMER_ALARM_MISS_COMPENSATE (1)  // Systimer peripheral can generate interrupt immediately if t(target) > t(current)
217 
218 /*-------------------------- TIMER GROUP CAPS --------------------------------*/
219 #define SOC_TIMER_GROUPS                  (2)
220 #define SOC_TIMER_GROUP_TIMERS_PER_GROUP  (2)
221 #define SOC_TIMER_GROUP_COUNTER_BIT_WIDTH (54)
222 #define SOC_TIMER_GROUP_SUPPORT_XTAL      (1)
223 #define SOC_TIMER_GROUP_TOTAL_TIMERS (SOC_TIMER_GROUPS * SOC_TIMER_GROUP_TIMERS_PER_GROUP)
224 
225 /*-------------------------- TOUCH SENSOR CAPS -------------------------------*/
226 #define SOC_TOUCH_SENSOR_NUM                (15) /*! 15 Touch channels */
227 #define SOC_TOUCH_PROXIMITY_CHANNEL_NUM     (3)  /* Sopport touch proximity channel number. */
228 #define SOC_TOUCH_PROXIMITY_MEAS_DONE_SUPPORTED (1) /*Sopport touch proximity channel measure done interrupt type. */
229 
230 #define SOC_TOUCH_PAD_THRESHOLD_MAX         (0x1FFFFF)  /*!<If set touch threshold max value, The touch sensor can't be in touched status */
231 #define SOC_TOUCH_PAD_MEASURE_WAIT_MAX      (0xFF)  /*!<The timer frequency is 8Mhz, the max value is 0xff */
232 
233 /*-------------------------- TWAI CAPS ---------------------------------------*/
234 #include "twai_caps.h"
235 
236 /*-------------------------- UART CAPS ---------------------------------------*/
237 #include "uart_caps.h"
238 
239 #define SOC_UART_SUPPORT_RTC_CLK    (1)     /*!< Support RTC clock as the clock source */
240 #define SOC_UART_SUPPORT_XTAL_CLK   (1)     /*!< Support XTAL clock as the clock source */
241 #define SOC_UART_REQUIRE_CORE_RESET (1)
242 
243 /*-------------------------- USB CAPS ----------------------------------------*/
244 #define SOC_USB_PERIPH_NUM 1
245 
246 
247 /*--------------------------- SHA CAPS ---------------------------------------*/
248 /* Max amount of bytes in a single DMA operation is 4095,
249    for SHA this means that the biggest safe amount of bytes is
250    31 blocks of 128 bytes = 3968
251 */
252 #define SOC_SHA_DMA_MAX_BUFFER_SIZE     (3968)
253 #define SOC_SHA_SUPPORT_DMA             (1)
254 
255 /* The SHA engine is able to resume hashing from a user supplied context */
256 #define SOC_SHA_SUPPORT_RESUME          (1)
257 
258 /* Has a centralized DMA, which is shared with all peripherals */
259 #define SOC_SHA_GDMA             (1)
260 
261 /* Supported HW algorithms */
262 #define SOC_SHA_SUPPORT_SHA1            (1)
263 #define SOC_SHA_SUPPORT_SHA224          (1)
264 #define SOC_SHA_SUPPORT_SHA256          (1)
265 #define SOC_SHA_SUPPORT_SHA384          (1)
266 #define SOC_SHA_SUPPORT_SHA256          (1)
267 #define SOC_SHA_SUPPORT_SHA512          (1)
268 #define SOC_SHA_SUPPORT_SHA512_224      (1)
269 #define SOC_SHA_SUPPORT_SHA512_256      (1)
270 #define SOC_SHA_SUPPORT_SHA512_T        (1)
271 
272 
273 /*--------------------------- RSA CAPS ---------------------------------------*/
274 #define SOC_RSA_MAX_BIT_LEN    (4096)
275 
276 
277 /*-------------------------- AES CAPS -----------------------------------------*/
278 #define SOC_AES_SUPPORT_DMA     (1)
279 
280 /* Has a centralized DMA, which is shared with all peripherals */
281 #define SOC_AES_GDMA            (1)
282 
283 #define SOC_AES_SUPPORT_AES_128 (1)
284 #define SOC_AES_SUPPORT_AES_256 (1)
285 
286 
287 /*-------------------------- Power Management CAPS ---------------------------*/
288 #define SOC_PM_SUPPORT_EXT_WAKEUP       (1)
289 
290 #define SOC_PM_SUPPORT_WIFI_WAKEUP      (1)
291 
292 #define SOC_PM_SUPPORT_BT_WAKEUP        (1)
293 
294 #define SOC_PM_SUPPORT_CPU_PD           (1)
295 
296 #define SOC_PM_SUPPORT_TAGMEM_PD        (1)
297 
298 #define SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP    (1)     /*!<Supports waking up from touch pad trigger */
299 
300 #define SOC_PM_SUPPORT_DEEPSLEEP_VERIFY_STUB_ONLY   (1)
301 
302 
303 /*-------------------------- Flash Encryption CAPS----------------------------*/
304 #define SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX   (64)
305 
306 
307 /*-------------------------- WI-FI HARDWARE TSF CAPS -------------------------------*/
308 #define SOC_WIFI_HW_TSF                 (1)
309 
310 /*--------------- PHY REGISTER AND MEMORY SIZE CAPS --------------------------*/
311 #define SOC_PHY_DIG_REGS_MEM_SIZE       (21*4)
312 #define SOC_MAC_BB_PD_MEM_SIZE          (192*4)
313 
314 /*--------------- WIFI LIGHT SLEEP CLOCK WIDTH CAPS --------------------------*/
315 #define SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH  (12)
316 
317 /*-------------------------- SPI MEM CAPS ---------------------------------------*/
318 #define SOC_SPI_MEM_SUPPORT_AUTO_WAIT_IDLE                (1)
319 #define SOC_SPI_MEM_SUPPORT_AUTO_SUSPEND                  (1)
320 #define SOC_SPI_MEM_SUPPORT_AUTO_RESUME                   (1)
321 #define SOC_SPI_MEM_SUPPORT_SW_SUSPEND                    (1)
322 #define SOC_SPI_MEM_SUPPORT_OPI_MODE                      (1)
323 #define SOC_SPI_MEM_SUPPORT_TIME_TUNING                   (1)
324 
325 /*-------------------------- COEXISTENCE HARDWARE PTI CAPS -------------------------------*/
326 #define SOC_COEX_HW_PTI                 (1)
327 
328 /*-------------------------- SDMMC CAPS -----------------------------------------*/
329 
330 /* Card detect, write protect, interrupt use GPIO Matrix on all chips.
331  * On ESP32-S3, clock/cmd/data pins use GPIO Matrix as well.
332  */
333 #define SOC_SDMMC_USE_GPIO_MATRIX  1
334 #define SOC_SDMMC_NUM_SLOTS        2
335 /* Indicates that there is an option to use XTAL clock instead of PLL for SDMMC */
336 #define SOC_SDMMC_SUPPORT_XTAL_CLOCK    1
337