21 #include "hal/ledc_types.h" 
   22 #include "hal/spi_types.h" 
   23 #include "soc/ledc_struct.h" 
   24 #include "soc/periph_defs.h" 
   25 #include "soc/soc_caps.h" 
   36 #define STDIO_UART_DEV  CONFIG_ESP_CONSOLE_UART_NUM 
   42 #define PROVIDES_PM_SET_LOWEST 
   43 #define PROVIDES_PM_RESTART 
   44 #define PROVIDES_PM_OFF 
   45 #define PROVIDES_PM_LAYERED_OFF 
   50 #define PM_NUM_MODES            (3U) 
   56 #define ESP_PM_MODEM_SLEEP      (2U) 
   57 #define ESP_PM_LIGHT_SLEEP      (1U) 
   58 #define ESP_PM_DEEP_SLEEP       (0U) 
   66 #if defined(CPU_FAM_ESP32H2) && defined(CONFIG_IEEE802154_ENABLED) 
   70 #  define CPUID_LEN             (8U) 
   72 #  define CPUID_LEN             (6U) 
   87 typedef unsigned int gpio_t;
 
   94 #define GPIO_UNDEF          (0xffffffff) 
  101 #define GPIO_PIN(x, y)      ((x << 5) | y) 
  108 #define PORT_GPIO           (0) 
  115 #define GPIO_PIN_NUMOF      (SOC_GPIO_PIN_COUNT) 
  124 #define HAVE_GPIO_FLANK_T 
  140 #define HAVE_GPIO_MODE_T 
  156 #if SOC_GPIO_PIN_COUNT > 32 
  157 #  define GPIO_PORT_NUMOF           2 
  158 #  define GPIO_PORT_0               0 
  159 #  define GPIO_PORT_1               1 
  160 #  define GPIO_PORT_0_PIN_NUMOF     (32) 
  161 #  define GPIO_PORT_1_PIN_NUMOF     (SOC_GPIO_PIN_COUNT - 32) 
  162 #  define GPIO_PORT_PIN_NUMOF(p)    ((p == GPIO_PORT_0) ? GPIO_PORT_0_PIN_NUMOF \ 
  163                                                         : GPIO_PORT_1_PIN_NUMOF) 
  165 #  define GPIO_PORT_NUMOF            1 
  166 #  define GPIO_PORT_0               0 
  167 #  define GPIO_PORT_0_PIN_NUMOF     (SOC_GPIO_PIN_COUNT) 
  168 #  define GPIO_PORT_PIN_NUMOF(p)    ((p == GPIO_PORT_0) ? GPIO_PORT_0_PIN_NUMOF : 0) 
  171 #define HAVE_GPIO_PORT_T 
  174 #define HAVE_GPIO_SLEW_T 
  182 #define HAVE_GPIO_PULL_STRENGTH_T 
  197 #include "hal/gpio_types.h" 
  199 #define HAVE_GPIO_PULL_T 
  201 #define GPIO_PULL_UP    GPIO_PULLUP_ONLY 
  202 #define GPIO_PULL_DOWN  GPIO_PULLDOWN_ONLY 
  203 #define GPIO_PULL_KEEP  GPIO_PULLUP_PULLDOWN 
  208 #define HAVE_GPIO_DRIVE_STRENGTH_T 
  219 #define GPIO_DRIVE_5    GPIO_DRIVE_WEAKEST       
  220 #define GPIO_DRIVE_10   GPIO_DRIVE_WEAK          
  221 #define GPIO_DRIVE_20   GPIO_DRIVE_STRONG        
  222 #define GPIO_DRIVE_30   GPIO_DRIVE_STRONGEST     
  224 #define HAVE_GPIO_STATE_T 
  234 #define HAVE_GPIO_CONF_T 
  348 #define ADC_NUMOF_MAX   (SOC_ADC_CHANNEL_NUM(0) + SOC_ADC_CHANNEL_NUM(1)) 
  391 #if defined(SOC_DAC_SUPPORTED) || DOXYGEN 
  392 #  define DAC_NUMOF_MAX (SOC_DAC_PERIPH_NUM) 
  450 #define HAVE_I2C_SPEED_T 
  476 #define I2C_NUMOF_MAX   (SOC_I2C_NUM) 
  478 #define PERIPH_I2C_NEED_READ_REG     
  479 #define PERIPH_I2C_NEED_READ_REGS    
  480 #define PERIPH_I2C_NEED_WRITE_REG    
  481 #define PERIPH_I2C_NEED_WRITE_REGS   
  584 #define PWM_NUMOF_MAX       (4) 
  589 #define PWM_CH_NUMOF_MAX    (SOC_LEDC_CHANNEL_NUM) 
  623 #define RMT_CH_NUMOF_MAX    (SOC_RMT_CHANNELS_PER_GROUP) 
  635 #define RNG_DATA_REG_ADDR   (WDEV_RND_REG) 
  650 #define RTT_FREQUENCY       (32768UL) 
  655 #define RTT_MAX_VALUE       (0xFFFFFFFFUL) 
  684 #if IS_USED(SOC_SDMMC_USE_GPIO_MATRIX) || DOXYGEN 
  705 #if IS_USED(SOC_SDMMC_USE_GPIO_MATRIX) || DOXYGEN 
  712 #if IS_USED(MODULE_PERIPH_SMMC_8BIT) || DOXYGEN 
  726 #define SDMMC_CPU_DMA_REQUIREMENTS  __attribute__((aligned(SDMMC_CPU_DMA_ALIGNMENT))) 
  731 #define SDMMC_CPU_DMA_ALIGNMENT     4 
  815 #define HAVE_SPI_CLK_T 
  829 #define spi_pin_mosi(dev) spi_config[dev].mosi 
  830 #define spi_pin_miso(dev) spi_config[dev].miso 
  831 #define spi_pin_clk(dev)  spi_config[dev].sck 
  847 #if defined(CPU_FAM_ESP32) 
  848 #  define HSPI  SPI2_HOST    
  849 #  define VSPI  SPI3_HOST    
  850 #elif defined(CPU_FAM_ESP32S2) 
  851 #  define FSPI  SPI2_HOST    
  852 #  define HSPI  SPI3_HOST    
  854 #  define FSPI  SPI2_HOST    
  871 #define SPI_NUMOF_MAX   (SOC_SPI_PERIPH_NUM - 1) 
  873 #define PERIPH_SPI_NEEDS_TRANSFER_BYTE   
  874 #define PERIPH_SPI_NEEDS_TRANSFER_REG    
  875 #define PERIPH_SPI_NEEDS_TRANSFER_REGS   
  903 #ifndef MODULE_ESP_HW_COUNTER 
  910 #  define TIMER_NUMOF           (SOC_TIMER_GROUP_TOTAL_TIMERS - 1) 
  911 #  define TIMER_CHANNEL_NUMOF   (1) 
  915 #define TIMER_SYSTEM_GROUP      0    
  917 #define TIMER_SYSTEM_INDEX      0    
  919 #define TIMER_SYSTEM_INT_SRC    ETS_TG0_T0_LEVEL_INTR_SOURCE 
  926 #define PERIPH_TIMER_PROVIDES_SET 
  984     UART_STOP_BITS_1_5 = 0x2,  
 
  988 #define HAVE_UART_STOP_BITS_T 
  993 #define UART_MODE_UNSUPPORTED 0xf0 
 1006 #define UART_PARITY_DISABLE     UART_PARITY_NONE 
 1008 #define HAVE_UART_PARITY_T 
 1015 #define UART_NUMOF_MAX      (SOC_UART_NUM) 
 1030 #define USBDEV_NUMOF_MAX    (SOC_USB_PERIPH_NUM) 
 1040 #if defined(CPU_FAM_ESP32) 
 1042 #elif defined(CPU_FAM_ESP32C3) 
 1044 #elif defined(CPU_FAM_ESP32C6) 
 1046 #elif defined(CPU_FAM_ESP32H2) 
 1048 #elif defined(CPU_FAM_ESP32S2) 
 1050 #elif defined(CPU_FAM_ESP32S3) 
 1053 #  error "ESP32x family implementation missing" 
 1056 #ifdef MODULE_PERIPH_CAN 
@ GPIO_OUT
select GPIO MASK as output
 
@ GPIO_IN
select GPIO MASK as input
 
sdmmc_slot_t
SDIO/SDMMC slots.
 
@ SDMMC_SLOT_1
SD/MMC host controller slot 1.
 
@ SDMMC_SLOT_0
SD/MMC host controller slot 0 (not usable on ESP32 variant)
 
spi_ctrl_t
SPI controllers that can be used for peripheral interfaces.
 
gpio_mode_t
Available pin modes.
 
gpio_pull_t
Enumeration of pull resistor configurations.
 
gpio_pull_strength_t
Enumeration of pull resistor values.
 
gpio_state_t
Enumeration of GPIO states (direction)
 
gpio_slew_t
Enumeration of slew rate settings.
 
gpio_drive_strength_t
Enumeration of drive strength options.
 
typedef gpio_conf_t
GPIO pin configuration.
 
uintptr_t gpio_port_t
GPIO port type.
 
@ GPIO_PULL_WEAKEST
Use the weakest (highest Ohm value) resistor.
 
@ GPIO_PULL_WEAK
Use a weak pull resistor.
 
@ GPIO_PULL_STRONG
Use a strong pull resistor.
 
@ GPIO_PULL_STRONGEST
Use the strongest pull resistor.
 
@ GPIO_OUTPUT_OPEN_SOURCE
Use pin as output in open emitter configuration.
 
@ GPIO_USED_BY_PERIPHERAL
The GPIO pin is used by a peripheral.
 
@ GPIO_OUTPUT_OPEN_DRAIN
Use pin as output in open collector configuration.
 
@ GPIO_OUTPUT_PUSH_PULL
Use pin as output in push-pull configuration.
 
@ GPIO_DISCONNECT
Disconnect pin from all peripherals.
 
@ GPIO_INPUT
Use pin as input.
 
@ GPIO_SLEW_SLOWEST
let the output voltage level rise/fall as slow as possible
 
@ GPIO_SLEW_FAST
let the output voltage level rise/fall fast
 
@ GPIO_SLEW_SLOW
let the output voltage level rise/fall slowly
 
@ GPIO_SLEW_FASTEST
let the output voltage level rise/fall as fast as possible
 
@ GPIO_DRIVE_STRONG
Use a strong drive strength.
 
@ GPIO_DRIVE_WEAK
Use a weak drive strength.
 
@ GPIO_DRIVE_STRONGEST
Use the strongest drive strength.
 
@ GPIO_DRIVE_WEAKEST
Use the weakest drive strength.
 
unsigned int gpio_t
GPIO type identifier.
 
@ GPIO_FALLING
emit interrupt on falling flank
 
@ GPIO_RISING
emit interrupt on rising flank
 
@ GPIO_BOTH
emit interrupt on both flanks
 
@ GPIO_OD
configure as output in open-drain mode without pull resistor
 
@ GPIO_IN_PU
configure as input with pull-up resistor
 
@ GPIO_OD_PU
configure as output in open-drain mode with pull resistor enabled
 
@ GPIO_IN_PD
configure as input with pull-down resistor
 
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
 
@ I2C_SPEED_FAST_PLUS
fast plus mode: ~1000 kbit/s
 
@ I2C_SPEED_LOW
low speed mode: ~10 kbit/s
 
@ I2C_SPEED_HIGH
high speed mode: ~3400 kbit/s
 
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
 
@ SPI_CLK_10MHZ
drive the SPI bus with 10MHz
 
@ SPI_CLK_5MHZ
drive the SPI bus with 5MHz
 
@ SPI_CLK_400KHZ
drive the SPI bus with 400KHz
 
@ SPI_CLK_1MHZ
drive the SPI bus with 1MHz
 
@ SPI_CLK_100KHZ
drive the SPI bus with 100KHz
 
@ UART_PARITY_SPACE
space parity
 
@ UART_PARITY_NONE
no parity
 
@ UART_PARITY_EVEN
even parity
 
@ UART_PARITY_ODD
odd parity
 
@ UART_PARITY_MARK
mark parity
 
@ UART_STOP_BITS_2
2 stop bits
 
@ UART_STOP_BITS_1
1 stop bit
 
Common macros and compiler attributes/pragmas configuration.
 
ESP32 specific peripheral configuration.
 
ESP32-C3 specific peripheral configuration.
 
ESP32-C6 specific peripheral configuration.
 
ESP32-H2 specific peripheral configuration.
 
ESP32-S2 specific peripheral configuration.
 
ESP32-S3 specific peripheral configuration.
 
RIOT-OS modification of the bootloader SDK configuration.
 
uart_parity_t
Definition of possible parity modes.
 
uart_stop_bits_t
Definition of possible stop bits lengths.
 
I2C configuration structure.
 
bool scl_pullup
Pullup enabled for SCL pin.
 
bool sda_pullup
Pullup enabled for SDA pin.
 
gpio_t sda
GPIO used as SDA pin.
 
gpio_t scl
GPIO used as SCL pin.
 
uint8_t module
I2C module identifier.
 
PWM configuration structure type.
 
ledc_mode_t group
LEDC channel group used (low/high speed)
 
ledc_timer_t timer
LEDC timer used by this device.
 
uint8_t module
LEDC module identifier.
 
uint8_t ch_numof
Number of channels used by this device.
 
const gpio_t * gpios
GPIOs used as channels of this device.
 
RMT channel configuration.
 
uint8_t channel
channel index
 
gpio_t gpio
GPIO used as RMT channel.
 
SDMMC slot configuration.
 
gpio_t wp
Write Protect pin (must be GPIO_UNDEF if not connected)
 
gpio_t dat1
DAT[1] pin (GPIO_UNDEF if not connected)
 
gpio_t dat3
DAT[3] pin (GPIO_UNDEF if not connected)
 
gpio_t clk
CLK pin (must be defined)
 
gpio_t dat0
DAT[0] pin (must be defined)
 
gpio_t dat4
DAT[4] pin (GPIO_UNDEF if not connected)
 
gpio_t cmd
CMD pin (must be defined)
 
gpio_t dat6
DAT[6] pin (GPIO_UNDEF if not connected)
 
gpio_t dat7
DAT[7] pin (GPIO_UNDEF if not connected)
 
gpio_t dat2
DAT[2] pin (GPIO_UNDEF if not connected)
 
gpio_t dat5
DAT[5] pin (GPIO_UNDEF if not connected)
 
sdmmc_slot_t slot
SDMMC slot used [ SDMMC_SLOT_0 | SDMMC_SLOT_1].
 
gpio_t cd
Card Detect pin (must be GPIO_UNDEF if not connected)
 
SPI device configuration.
 
gpio_t mosi
GPIO used as MOSI pin.
 
spi_ctrl_t ctrl
SPI controller used for the interface.
 
gpio_t cs
GPIO used as CS0 pin.
 
gpio_t miso
GPIO used as MISO pin.
 
gpio_t sck
GPIO used as SCK pin.
 
UART device configuration.
 
gpio_t txd
GPIO used as TxD pin.
 
gpio_t rxd
GPIO used as RxD pin.
 
GPIO pin configuration for ESP32/ESP32Cx/ESP32Sx MCUs.
 
bool initial_value
Initial value of the output.
 
gpio_state_t state
State of the pin.
 
gpio_drive_strength_t drive_strength
Drive strength of the GPIO.
 
gpio_pull_t pull
Pull resistor configuration.
 
Low level USB FS/HS driver definitions for MCUs with Synopsys DWC2 IP core.