diff --git a/tests/drivers/spi/spi_slave/CMakeLists.txt b/tests/drivers/spi/spi_controller_peripheral/CMakeLists.txt similarity index 85% rename from tests/drivers/spi/spi_slave/CMakeLists.txt rename to tests/drivers/spi/spi_controller_peripheral/CMakeLists.txt index f9f7a6bdae4..122faf00c88 100644 --- a/tests/drivers/spi/spi_slave/CMakeLists.txt +++ b/tests/drivers/spi/spi_controller_peripheral/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(spi_slave) +project(spi_controller_peripheral) FILE(GLOB app_sources src/*.c) diff --git a/tests/drivers/spi/spi_slave/Kconfig b/tests/drivers/spi/spi_controller_peripheral/Kconfig similarity index 100% rename from tests/drivers/spi/spi_slave/Kconfig rename to tests/drivers/spi/spi_controller_peripheral/Kconfig diff --git a/tests/drivers/spi/spi_slave/README.txt b/tests/drivers/spi/spi_controller_peripheral/README.txt similarity index 84% rename from tests/drivers/spi/spi_slave/README.txt rename to tests/drivers/spi/spi_controller_peripheral/README.txt index 9e3ad6af857..3098b50d0f4 100644 --- a/tests/drivers/spi/spi_slave/README.txt +++ b/tests/drivers/spi/spi_controller_peripheral/README.txt @@ -1,5 +1,5 @@ In this test suite two instances of the SPI peripheral are connected together. -One SPI instance works as a master, second one is configured as a slave. +One SPI instance works as a controller, second one is configured as a peripheral. In each test, both instances get identical configuration (CPOL, CPHA, bitrate, etc.). Four GPIO loopbacks are required (see overlay for nrf54l15pdk for reference): diff --git a/tests/drivers/spi/spi_slave/boards/1mhz.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/1mhz.overlay similarity index 100% rename from tests/drivers/spi/spi_slave/boards/1mhz.overlay rename to tests/drivers/spi/spi_controller_peripheral/boards/1mhz.overlay diff --git a/tests/drivers/spi/spi_slave/boards/250khz.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/250khz.overlay similarity index 100% rename from tests/drivers/spi/spi_slave/boards/250khz.overlay rename to tests/drivers/spi/spi_controller_peripheral/boards/250khz.overlay diff --git a/tests/drivers/spi/spi_slave/boards/2mhz.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/2mhz.overlay similarity index 100% rename from tests/drivers/spi/spi_slave/boards/2mhz.overlay rename to tests/drivers/spi/spi_controller_peripheral/boards/2mhz.overlay diff --git a/tests/drivers/spi/spi_slave/boards/4mhz.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/4mhz.overlay similarity index 100% rename from tests/drivers/spi/spi_slave/boards/4mhz.overlay rename to tests/drivers/spi/spi_controller_peripheral/boards/4mhz.overlay diff --git a/tests/drivers/spi/spi_slave/boards/500khz.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/500khz.overlay similarity index 100% rename from tests/drivers/spi/spi_slave/boards/500khz.overlay rename to tests/drivers/spi/spi_controller_peripheral/boards/500khz.overlay diff --git a/tests/drivers/spi/spi_slave/boards/8mhz.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/8mhz.overlay similarity index 100% rename from tests/drivers/spi/spi_slave/boards/8mhz.overlay rename to tests/drivers/spi/spi_controller_peripheral/boards/8mhz.overlay diff --git a/tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf52840dk_nrf52840.overlay similarity index 100% rename from tests/drivers/spi/spi_slave/boards/nrf52840dk_nrf52840.overlay rename to tests/drivers/spi/spi_controller_peripheral/boards/nrf52840dk_nrf52840.overlay diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_common.dtsi similarity index 100% rename from tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_common.dtsi rename to tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_common.dtsi diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuapp.overlay similarity index 100% rename from tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpuapp.overlay rename to tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpuapp.overlay diff --git a/tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpurad.overlay similarity index 100% rename from tests/drivers/spi/spi_slave/boards/nrf54h20dk_nrf54h20_cpurad.overlay rename to tests/drivers/spi/spi_controller_peripheral/boards/nrf54h20dk_nrf54h20_cpurad.overlay diff --git a/tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay b/tests/drivers/spi/spi_controller_peripheral/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay similarity index 100% rename from tests/drivers/spi/spi_slave/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay rename to tests/drivers/spi/spi_controller_peripheral/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay diff --git a/tests/drivers/spi/spi_slave/prj.conf b/tests/drivers/spi/spi_controller_peripheral/prj.conf similarity index 100% rename from tests/drivers/spi/spi_slave/prj.conf rename to tests/drivers/spi/spi_controller_peripheral/prj.conf diff --git a/tests/drivers/spi/spi_slave/src/main.c b/tests/drivers/spi/spi_controller_peripheral/src/main.c similarity index 85% rename from tests/drivers/spi/spi_slave/src/main.c rename to tests/drivers/spi/spi_controller_peripheral/src/main.c index 2ad7d509c72..dfcd83e6558 100644 --- a/tests/drivers/spi/spi_slave/src/main.c +++ b/tests/drivers/spi/spi_controller_peripheral/src/main.c @@ -146,15 +146,15 @@ static int check_buffers(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set, return memcmp(tx_data, rx_data, rx_len); } -/** Calculate expected number of received bytes by the slave. +/** Calculate expected number of received bytes by the SPI peripheral. * - * It is used to check if SPI API call for slave returns correct value. + * It is used to check if SPI API call for peripheral SPI device returns correct value. * @param tx_set TX set. * @param rx_set RX set. * * @return Expected amount of received bytes. */ -static int slave_rx_len(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set) +static int peripheral_rx_len(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set) { size_t tx_len = 0; size_t rx_len = 0; @@ -178,15 +178,15 @@ static int slave_rx_len(struct spi_buf_set *tx_set, struct spi_buf_set *rx_set) static void run_test(bool m_same_size, bool s_same_size, bool async) { int rv; - int slave_rv; + int periph_rv; int srx_len; rv = k_work_schedule(&tdata.test_work, K_MSEC(10)); zassert_equal(rv, 1); if (!async) { - slave_rv = spi_transceive(spis_dev, &spis_config, tdata.stx_set, tdata.srx_set); - if (slave_rv == -ENOTSUP) { + periph_rv = spi_transceive(spis_dev, &spis_config, tdata.stx_set, tdata.srx_set); + if (periph_rv == -ENOTSUP) { ztest_test_skip(); } } else { @@ -204,7 +204,7 @@ static void run_test(bool m_same_size, bool s_same_size, bool async) rv = k_poll(&async_evt, 1, K_MSEC(200)); zassert_false(rv, "one or more events are not ready"); - slave_rv = async_evt.signal->result; + periph_rv = async_evt.signal->result; /* Reinitializing for next call */ async_evt.signal->signaled = 0U; @@ -214,9 +214,9 @@ static void run_test(bool m_same_size, bool s_same_size, bool async) rv = k_sem_take(&tdata.sem, K_MSEC(100)); zassert_equal(rv, 0); - srx_len = slave_rx_len(tdata.mtx_set, tdata.srx_set); + srx_len = peripheral_rx_len(tdata.mtx_set, tdata.srx_set); - zassert_equal(slave_rv, srx_len, "Got: %d but expected:%d", slave_rv, srx_len); + zassert_equal(periph_rv, srx_len, "Got: %d but expected:%d", periph_rv, srx_len); rv = check_buffers(tdata.mtx_set, tdata.srx_set, m_same_size); zassert_equal(rv, 0); @@ -225,7 +225,7 @@ static void run_test(bool m_same_size, bool s_same_size, bool async) zassert_equal(rv, 0); } -/** Basic test where slave and master have RX and TX sets which contains only one +/** Basic test where SPI controller and SPI peripheral have RX and TX sets which contains only one * same size buffer. */ static void test_basic(bool async) @@ -247,12 +247,12 @@ static void test_basic(bool async) run_test(true, true, async); } -ZTEST(spi_slave, test_basic) +ZTEST(spi_controller_peripheral, test_basic) { test_basic(false); } -ZTEST(spi_slave, test_basic_async) +ZTEST(spi_controller_peripheral, test_basic_async) { test_basic(true); } @@ -298,19 +298,19 @@ void test_basic_zero_len(bool async) run_test(true, true, async); } -ZTEST(spi_slave, test_basic_zero_len) +ZTEST(spi_controller_peripheral, test_basic_zero_len) { test_basic_zero_len(false); } -ZTEST(spi_slave, test_basic_zero_len_async) +ZTEST(spi_controller_peripheral, test_basic_zero_len_async) { test_basic_zero_len(true); } -/** Setup a transfer where RX buffer on master and slave are shorter than - * TX buffers. RX buffers shall contain beginning of TX data and last TX - * bytes that did not fit in the RX buffers shall be lost. +/** Setup a transfer where RX buffer on SPI controller and SPI peripheral are + * shorter than TX buffers. RX buffers shall contain beginning of TX data + * and last TX bytes that did not fit in the RX buffers shall be lost. */ static void test_short_rx(bool async) { @@ -338,12 +338,12 @@ static void test_short_rx(bool async) run_test(false, false, async); } -ZTEST(spi_slave, test_short_rx) +ZTEST(spi_controller_peripheral, test_short_rx) { test_short_rx(false); } -ZTEST(spi_slave, test_short_rx_async) +ZTEST(spi_controller_peripheral, test_short_rx_async) { test_short_rx(true); } @@ -372,17 +372,17 @@ static void test_only_tx(bool async) run_test(true, true, async); } -ZTEST(spi_slave, test_only_tx) +ZTEST(spi_controller_peripheral, test_only_tx) { test_only_tx(false); } -ZTEST(spi_slave, test_only_tx_async) +ZTEST(spi_controller_peripheral, test_only_tx_async) { test_only_tx(true); } -/** Test where only master transmits and slave receives in chunks. */ +/** Test where only SPI controller transmits and SPI peripheral receives in chunks. */ static void test_only_tx_in_chunks(bool async) { size_t len1 = 7; @@ -409,17 +409,17 @@ static void test_only_tx_in_chunks(bool async) run_test(true, true, async); } -ZTEST(spi_slave, test_only_tx_in_chunks) +ZTEST(spi_controller_peripheral, test_only_tx_in_chunks) { test_only_tx_in_chunks(false); } -ZTEST(spi_slave, test_only_tx_in_chunks_async) +ZTEST(spi_controller_peripheral, test_only_tx_in_chunks_async) { test_only_tx_in_chunks(true); } -/** Test where only slave transmits. */ +/** Test where only SPI peripheral transmits. */ static void test_only_rx(bool async) { size_t len = 16; @@ -443,17 +443,17 @@ static void test_only_rx(bool async) run_test(true, true, async); } -ZTEST(spi_slave, test_only_rx) +ZTEST(spi_controller_peripheral, test_only_rx) { test_only_rx(false); } -ZTEST(spi_slave, test_only_rx_async) +ZTEST(spi_controller_peripheral, test_only_rx_async) { test_only_rx(true); } -/** Test where only slave transmits in chunks. */ +/** Test where only SPI peripheral transmits in chunks. */ static void test_only_rx_in_chunks(bool async) { size_t len1 = 7; @@ -480,12 +480,12 @@ static void test_only_rx_in_chunks(bool async) run_test(true, true, async); } -ZTEST(spi_slave, test_only_rx_in_chunks) +ZTEST(spi_controller_peripheral, test_only_rx_in_chunks) { test_only_rx_in_chunks(false); } -ZTEST(spi_slave, test_only_rx_in_chunks_async) +ZTEST(spi_controller_peripheral, test_only_rx_in_chunks_async) { test_only_rx_in_chunks(true); } @@ -511,4 +511,4 @@ static void *suite_setup(void) return NULL; } -ZTEST_SUITE(spi_slave, NULL, suite_setup, before, NULL, NULL); +ZTEST_SUITE(spi_controller_peripheral, NULL, suite_setup, before, NULL, NULL); diff --git a/tests/drivers/spi/spi_slave/testcase.yaml b/tests/drivers/spi/spi_controller_peripheral/testcase.yaml similarity index 100% rename from tests/drivers/spi/spi_slave/testcase.yaml rename to tests/drivers/spi/spi_controller_peripheral/testcase.yaml