Skip to content

Commit 6a5a253

Browse files
heinwesselscarlescufi
authored andcommitted
tests: drivers: dma: chen_blen_transfer: add bdma test to nucleo_h743zi
Add unit tests for BDMA driver. Also requires adding additional kconfig options to allocate the memory buffers in a specific SRAM section, because the BDMA only has access to SRAM4. Signed-off-by: Hein Wessels <[email protected]>
1 parent aa3783f commit 6a5a253

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

tests/drivers/dma/chan_blen_transfer/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ config DMA_TRANSFER_CHANNEL_NR_1
1313
int "second DMA channel to use"
1414
default 1
1515

16+
config DMA_LOOP_TRANSFER_SRAM_SECTION
17+
string "the section to place the memory buffers."
18+
depends on NOCACHE_MEMORY
19+
default ".nocache"
20+
1621
config DMA_LOOP_TRANSFER_NUMBER_OF_DMAS
1722
int "Number of DMAs to test"
1823
default 1
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1-
CONFIG_DMA_TRANSFER_CHANNEL_NR_0=6
2-
CONFIG_DMA_TRANSFER_CHANNEL_NR_1=10
1+
CONFIG_DMA_TRANSFER_CHANNEL_NR_0=4
2+
CONFIG_DMA_TRANSFER_CHANNEL_NR_1=6
3+
CONFIG_DMA_LOOP_TRANSFER_NUMBER_OF_DMAS=2
4+
5+
# Required by BDMA which only has access to
6+
# a NOCACHE SRAM4 section. All other DMAs also
7+
# has access to this section.
8+
CONFIG_DMA_LOOP_TRANSFER_SRAM_SECTION=".sram4"
9+
10+
# Required for SRAM4 to be non-cachable
311
CONFIG_NOCACHE_MEMORY=y

tests/drivers/dma/chan_blen_transfer/boards/nucleo_h743zi.overlay

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,18 @@
1313
test_dma0: &dmamux1 {
1414
status = "okay";
1515
};
16+
17+
/* The BDMA driver expects the SRAM4 region
18+
* to be non-cachable.
19+
*/
20+
&sram4 {
21+
zephyr,memory-region-mpu = "RAM_NOCACHE";
22+
};
23+
24+
&bdma1 {
25+
status = "okay";
26+
};
27+
28+
test_dma1: &dmamux2 {
29+
status = "okay";
30+
};

tests/drivers/dma/chan_blen_transfer/src/test_dma.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
#ifdef CONFIG_NOCACHE_MEMORY
2626
static __aligned(32) char tx_data[RX_BUFF_SIZE] __used
27-
__attribute__((__section__(".nocache")));
27+
__attribute__((__section__(CONFIG_DMA_LOOP_TRANSFER_SRAM_SECTION)));
2828
static const char TX_DATA[] = "It is harder to be kind than to be wise........";
2929
static __aligned(32) char rx_data[RX_BUFF_SIZE] __used
30-
__attribute__((__section__(".nocache.dma")));
30+
__attribute__((__section__(CONFIG_DMA_LOOP_TRANSFER_SRAM_SECTION".dma")));
3131
#else
3232
static const char tx_data[] = "It is harder to be kind than to be wise........";
3333
static char rx_data[RX_BUFF_SIZE] = { 0 };
@@ -90,6 +90,7 @@ static int test_task(const struct device *dma, uint32_t chan_id, uint32_t blen)
9090
return TC_FAIL;
9191
}
9292
k_sleep(K_MSEC(2000));
93+
9394
TC_PRINT("%s\n", rx_data);
9495
if (strcmp(tx_data, rx_data) != 0) {
9596
return TC_FAIL;

0 commit comments

Comments
 (0)