Skip to content

Commit 8423b90

Browse files
nika-nordiccfriedt
authored andcommitted
tests: drivers: spi: controller_peripheral: add direct variant
Direct variant of this test disables intermediate buffer in the nRF SPI driver and verifies whether devices like nRF54H20, which can peform DMA transcations only from specific memory regions, are handled properly. Signed-off-by: Nikodem Kastelik <[email protected]>
1 parent 304e19f commit 8423b90

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

tests/drivers/spi/spi_controller_peripheral/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,11 @@ config TESTED_SPI_MODE
1111
2: CPOL 1 (Active low), CPHA 0 (leading)
1212
3: CPOL 1 (Active low), CPHA 1 (trailing)
1313

14+
config PREALLOC_BUFFERS
15+
bool "Preallocate buffers"
16+
default y
17+
help
18+
Preallocate buffers used for transaction
19+
using `memory-region` property.
20+
1421
source "Kconfig.zephyr"

tests/drivers/spi/spi_controller_peripheral/src/main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ static struct k_poll_event async_evt_spim =
4141
K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL, K_POLL_MODE_NOTIFY_ONLY, &async_sig_spim);
4242

4343
#define MEMORY_SECTION(node) \
44-
COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \
45-
(__attribute__((__section__( \
46-
LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, memory_regions)))))), \
44+
COND_CODE_1(IS_ENABLED(CONFIG_PREALLOC_BUFFERS), \
45+
(COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \
46+
(__attribute__((__section__( \
47+
LINKER_DT_NODE_REGION_NAME(DT_PHANDLE(node, \
48+
memory_regions)))))), \
49+
())), \
4750
())
4851

4952
static uint8_t spim_buffer[32] MEMORY_SECTION(DT_BUS(DT_NODELABEL(dut_spi_dt)));

tests/drivers/spi/spi_controller_peripheral/testcase.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,14 @@ tests:
116116
- nrf54h20dk/nrf54h20/cpurad
117117
- nrf54h20dk/nrf54h20/cpuppr
118118
- ophelia4ev/nrf54l15/cpuapp
119+
120+
drivers.spi.direct_xfer:
121+
extra_configs:
122+
- CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=0
123+
filter: CONFIG_SOC_FAMILY_NORDIC_NRF
124+
125+
drivers.spi.direct_xfer.no_prealloc:
126+
extra_configs:
127+
- CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=0
128+
- CONFIG_PREALLOC_BUFFERS=n
129+
filter: CONFIG_SOC_FAMILY_NORDIC_NRF

0 commit comments

Comments
 (0)