Skip to content

Commit bd191d8

Browse files
nika-nordicrlubos
authored andcommitted
[nrf fromlist] 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. Upstream PR #: 93487 Signed-off-by: Nikodem Kastelik <[email protected]>
1 parent 88454f2 commit bd191d8

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
@@ -117,3 +117,14 @@ tests:
117117
- nrf54h20dk/nrf54h20/cpuppr
118118
- nrf54l20pdk/nrf54l20/cpuapp
119119
- ophelia4ev/nrf54l15/cpuapp
120+
121+
drivers.spi.direct_xfer:
122+
extra_configs:
123+
- CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=0
124+
filter: CONFIG_SOC_FAMILY_NORDIC_NRF
125+
126+
drivers.spi.direct_xfer.no_prealloc:
127+
extra_configs:
128+
- CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=0
129+
- CONFIG_PREALLOC_BUFFERS=n
130+
filter: CONFIG_SOC_FAMILY_NORDIC_NRF

0 commit comments

Comments
 (0)