Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/drivers/i2s/i2s_additional/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(i2s_additional)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
168 changes: 168 additions & 0 deletions tests/drivers/i2s/i2s_additional/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#

mainmenu "I2S Additional Test"

source "Kconfig.zephyr"

config I2S_TEST_USE_GPIO_LOOPBACK
bool "Use GPIO loopback"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED
help
Use wiring between the data-out and data-in pins for looping back
data. This option is intended to be used for devices that do not
provide the internal loopback functionality.

config I2S_TEST_ALLOWED_DATA_OFFSET
int "Allowed offset in received data"
default 2 if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED
default 0
help
Maximum allowed offset between sent and received samples. Non-zero
value of this option may be needed when GPIO loopback is used.

config I2S_TEST_WORD_SIZE_8_BIT_UNSUPPORTED
bool "8 bit word size is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_WORD_SIZE_16_BIT_UNSUPPORTED
bool "16 bit word size is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_WORD_SIZE_24_BIT_UNSUPPORTED
bool "24 bit word size is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_WORD_SIZE_32_BIT_UNSUPPORTED
bool "32 bit word size is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_WORD_SIZE_48_BIT_UNSUPPORTED
bool "48 bit word size is not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_ONE_CHANNEL_UNSUPPORTED
bool "Single audio channel is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_FOUR_CHANNELS_UNSUPPORTED
bool "Four audio channels are not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_EIGHT_CHANNELS_UNSUPPORTED
bool "Eight audio channels are not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_DATA_FORMAT_I2S_UNSUPPORTED
bool "I2S_FMT_DATA_FORMAT_I2S is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_DATA_FORMAT_LEFT_JUSTIFIED_UNSUPPORTED
bool "I2S_FMT_DATA_FORMAT_LEFT_JUSTIFIED is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_DATA_FORMAT_RIGHT_JUSTIFIED_UNSUPPORTED
bool "I2S_FMT_DATA_FORMAT_RIGHT_JUSTIFIED is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_DATA_FORMAT_PCM_LONG_UNSUPPORTED
bool "I2S_FMT_DATA_FORMAT_PCM_LONG is not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_DATA_FORMAT_PCM_SHORT_UNSUPPORTED
bool "I2S_FMT_DATA_FORMAT_PCM_SHORT is not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_DATA_ORDER_MSB_UNSUPPORTED
bool "I2S_FMT_DATA_ORDER_MSB is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_DATA_ORDER_LSB_UNSUPPORTED
bool "I2S_FMT_DATA_ORDER_LSB is not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_BIT_CLK_INV_UNSUPPORTED
bool "I2S_FMT_BIT_CLK_INV is not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_FRAME_CLK_INV_UNSUPPORTED
bool "I2S_FMT_FRAME_CLK_INV is not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_BLOCK_SIZE_6_UNSUPPORTED
bool "Block_size of 6 is not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_OPTIONS_BIT_CLK_CONT_UNSUPPORTED
bool "I2S_OPT_BIT_CLK_CONT is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_OPTIONS_BIT_CLK_GATED_UNSUPPORTED
bool "I2S_OPT_BIT_CLK_GATED is not supported by the driver"
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_OPTIONS_LOOPBACK_UNSUPPORTED
bool "I2S_OPT_LOOPBACK is not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.

config I2S_TEST_OPTIONS_PINGPONG_UNSUPPORTED
bool "I2S_OPT_PINGPONG is not supported by the driver"
default y if DT_HAS_NORDIC_NRF_I2S_ENABLED || DT_HAS_NORDIC_NRF_TDM_ENABLED
help
When set to 'y', test will check that i2s_configure() returns -EINVAL.
When set to 'n', test will do the transmission.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_I2S_TEST_WORD_SIZE_32_BIT_UNSUPPORTED=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
aliases {
i2s-node0 = &i2s0;
};
};

&pinctrl {
i2s0_default_alt: i2s0_default_alt {
group1 {
psels = <NRF_PSEL(I2S_SCK_M, 1, 5)>,
<NRF_PSEL(I2S_LRCK_M, 1, 6)>,
<NRF_PSEL(I2S_SDOUT, 1, 1)>,
<NRF_PSEL(I2S_SDIN, 1, 2)>;
};
};
};

&i2s0 {
status = "okay";
pinctrl-0 = <&i2s0_default_alt>;
pinctrl-names = "default";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
aliases {
i2s-node0 = &i2s0;
};
};

&pinctrl {
i2s0_default_alt: i2s0_default_alt {
group1 {
psels = <NRF_PSEL(I2S_SCK_M, 1, 6)>,
<NRF_PSEL(I2S_LRCK_M, 1, 7)>,
<NRF_PSEL(I2S_SDOUT, 0, 4)>,
<NRF_PSEL(I2S_SDIN, 0, 5)>;
};
};
};

&uart1 {
status = "disabled";
};

&i2s0 {
status = "okay";
pinctrl-0 = <&i2s0_default_alt>;
pinctrl-names = "default";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Drive i2s peripheral from ACLK. */

&clock {
hfclkaudio-frequency = <11289600>;
};

&i2s0 {
clock-source = "ACLK";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

/* i2s-node0 is the transmitter/receiver */

/ {
aliases {
i2s-node0 = &tdm130;
};
};

&pinctrl {
tdm130_default_alt: tdm130_default_alt {
group1 {
psels = <NRF_PSEL(TDM_SCK_M, 1, 3)>,
<NRF_PSEL(TDM_FSYNC_M, 1, 6)>,
<NRF_PSEL(TDM_SDOUT, 1, 4)>,
<NRF_PSEL(TDM_SDIN, 1, 5)>;
};
};
};

&tdm130 {
status = "okay";
pinctrl-0 = <&tdm130_default_alt>;
pinctrl-names = "default";
memory-regions = <&cpuapp_dma_region>;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

/* i2s-node0 is the transmitter/receiver */

/ {
aliases {
i2s-node0 = &i2s20;
};
};

&pinctrl {
i2s20_default_alt: i2s20_default_alt {
group1 {
psels = <NRF_PSEL(I2S_SCK_M, 1, 11)>,
<NRF_PSEL(I2S_LRCK_M, 1, 12)>,
<NRF_PSEL(I2S_SDOUT, 1, 8)>,
<NRF_PSEL(I2S_SDIN, 1, 9)>;
};
};
};

&i2s20 {
status = "okay";
pinctrl-0 = <&i2s20_default_alt>;
pinctrl-names = "default";
};
2 changes: 2 additions & 0 deletions tests/drivers/i2s/i2s_additional/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_I2S=y
CONFIG_ZTEST=y
Loading
Loading