Skip to content

Commit

Permalink
tests: esp32c3: Add USB variant
Browse files Browse the repository at this point in the history
Add USB variant config files for esp32c3 boards.

Signed-off-by: Raffael Rostagno <[email protected]>
  • Loading branch information
Raffael Rostagno authored and kartben committed Jan 10, 2025
1 parent 8048a6a commit d20140d
Show file tree
Hide file tree
Showing 17 changed files with 282 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/boards/espressif/wifi/socs/esp32c3_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/

&wifi {
status = "okay";
};
1 change: 1 addition & 0 deletions tests/drivers/adc/adc_api/socs/esp32c3_usb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ADC_ASYNC=n
35 changes: 35 additions & 0 deletions tests/drivers/adc/adc_api/socs/esp32c3_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2022 Wolter HV <[email protected]>
* Copyright (c) 2023 Benjamin Björnsson <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
zephyr,user {
/* adjust channel number according to pinmux in board.dts */
io-channels = <&adc0 0>, <&adc0 1>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};

channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
&timer0 {
status = "okay";
};

&rtc {
slow-clk-src = <ESP32_RTC_SLOW_CLK_SRC_RC_FAST_D256>;
};
3 changes: 3 additions & 0 deletions tests/drivers/dma/chan_blen_transfer/socs/esp32c3_usb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_DMA_TRANSFER_CHANNEL_NR_0=5
CONFIG_DMA_TRANSFER_CHANNEL_NR_1=0
CONFIG_HEAP_MEM_POOL_SIZE=32768
11 changes: 11 additions & 0 deletions tests/drivers/dma/chan_blen_transfer/socs/esp32c3_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/

&dma {
status = "okay";
};

tst_dma0: &dma { };
2 changes: 2 additions & 0 deletions tests/drivers/dma/loop_transfer/socs/esp32c3_usb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_DMA_LOOP_TRANSFER_CHANNEL_NR=0
CONFIG_DMA_LOOP_TRANSFER_SIZE=4094
11 changes: 11 additions & 0 deletions tests/drivers/dma/loop_transfer/socs/esp32c3_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/

&dma {
status = "okay";
};

tst_dma0: &dma { };
1 change: 1 addition & 0 deletions tests/drivers/flash/common/socs/esp32c3_usb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_HEAP_MEM_POOL_SIZE=16384
13 changes: 13 additions & 0 deletions tests/drivers/gpio/gpio_basic_api/socs/esp32c3_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
resources {
compatible = "test-gpio-basic-api";
out-gpios = <&gpio0 4 0>;
in-gpios = <&gpio0 5 0>;
};
};
34 changes: 34 additions & 0 deletions tests/drivers/pwm/pwm_api/socs/esp32c3_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*/

#include <zephyr/dt-bindings/pwm/pwm.h>

/ {
aliases {
pwm-0 = &ledc0;
};
};

&pinctrl {
ledc0_default: ledc0_default {
group1 {
pinmux = <LEDC_CH0_GPIO2>;
output-enable;
};
};
};

&ledc0 {
pinctrl-0 = <&ledc0_default>;
pinctrl-names = "default";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
channel0@0 {
reg = <0x0>;
timer = <0>;
};
};
48 changes: 48 additions & 0 deletions tests/drivers/pwm/pwm_gpio_loopback/socs/esp32c3_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*/

#include <zephyr/dt-bindings/pwm/pwm.h>
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/gpio/espressif-esp32-gpio.h>

/ {
zephyr,user {
/* GPIO input pins order must match PWM pinctrl config */
gpios = <&gpio0 2 ESP32_GPIO_PIN_OUT_EN>,
<&gpio0 3 ESP32_GPIO_PIN_OUT_EN>;

pwms = <&ledc0 0 160000 PWM_POLARITY_NORMAL>,
<&ledc0 5 80000 PWM_POLARITY_INVERTED>;
};
};

&pinctrl {
ledc0_default: ledc0_default {
group1 {
pinmux = <LEDC_CH0_GPIO2>,
<LEDC_CH5_GPIO3>;
input-enable;
};
};
};

&ledc0 {
pinctrl-0 = <&ledc0_default>;
pinctrl-names = "default";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;

channel0@0 {
reg = <0x0>;
timer = <0>;
};

channel5@5 {
reg = <0x5>;
timer = <1>;
};
};
2 changes: 2 additions & 0 deletions tests/drivers/spi/spi_loopback/socs/esp32c3_usb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_SPI_ESP32_INTERRUPT=y
CONFIG_HEAP_MEM_POOL_SIZE=32768
44 changes: 44 additions & 0 deletions tests/drivers/spi/spi_loopback/socs/esp32c3_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2022 Kumar Gala <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
spim2_loopback: spim2_loopback {
group1 {
pinmux = <SPIM2_MISO_GPIO2>;
output-enable; /* Enable internal loopback */
};
group2 {
pinmux = <SPIM2_MOSI_GPIO2>;
input-enable; /* Enable internal loopback */
};
group3 {
pinmux = <SPIM2_SCLK_GPIO6>,
<SPIM2_CSEL_GPIO10>;
};
};
};

&spi2 {
slow@0 {
compatible = "test-spi-loopback-slow";
reg = <0>;
spi-max-frequency = <500000>;
};
fast@0 {
compatible = "test-spi-loopback-fast";
reg = <0>;
spi-max-frequency = <16000000>;
};
};

&spi2 {
#address-cells = <1>;
#size-cells = <0>;
dma-enabled;
pinctrl-0 = <&spim2_loopback>;
pinctrl-names = "default";
status = "okay";
};
2 changes: 2 additions & 0 deletions tests/drivers/uart/uart_async_api/socs/esp32c3_usb.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_HEAP_MEM_POOL_SIZE=32768
CONFIG_DMA=y
31 changes: 31 additions & 0 deletions tests/drivers/uart/uart_async_api/socs/esp32c3_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
uart1_test: uart1_test {
group1 {
pinmux = <UART1_TX_GPIO5>;
input-enable;
};
group2 {
pinmux = <UART1_RX_GPIO5>;
output-enable;
};
};
};

dut: &uart1 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart1_test>;
pinctrl-names = "default";
dmas = <&dma 0>, <&dma 1>;
dma-names = "rx", "tx";
};

&dma {
status = "okay";
};
28 changes: 28 additions & 0 deletions tests/drivers/uart/uart_elementary/socs/esp32c3_usb.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
uart1_test: uart1_test {
group1 {
pinmux = <UART1_TX_GPIO2>,
<UART1_RTS_GPIO3>;
input-enable;
output-high;
};
group2 {
pinmux = <UART1_RX_GPIO2>,
<UART1_CTS_GPIO3>;
output-enable;
bias-pull-up;
};
};
};

dut: &uart1 {
status = "okay";
pinctrl-0 = <&uart1_test>;
pinctrl-names = "default";
current-speed = <115200>;
};

0 comments on commit d20140d

Please sign in to comment.