Skip to content

Commit 7201c1f

Browse files
jacob-wienecke-nxpkartben
authored andcommitted
tests: drivers: spi: loopback: Fix cache coherency on size9/size24
Make tx_data9 and tx_data24 non-cachable within the 9-bit word size and 24-bit word size functions. This repairs a suspected cache coherency issue where these buffers are written to cache and therefore not seen correctly by spi/dma. Signed-off-by: Jacob Wienecke <[email protected]>
1 parent 0e1dfd9 commit 7201c1f

File tree

1 file changed

+3
-3
lines changed
  • tests/drivers/spi/spi_loopback/src

1 file changed

+3
-3
lines changed

tests/drivers/spi/spi_loopback/src/spi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ ZTEST(spi_loopback, test_spi_same_buf_cmd)
642642
spi_loopback_compare_bufs(tx_data, buffer_rx, 1,
643643
buffer_print_tx, buffer_print_rx);
644644

645-
char zeros[BUF_SIZE - 1] = {0};
645+
static const char zeros[BUF_SIZE - 1] = {0};
646646

647647
zassert_ok(memcmp(buffer_rx+1, zeros, BUF_SIZE - 1));
648648
}
@@ -688,7 +688,7 @@ ZTEST(spi_loopback, test_spi_word_size_9)
688688
{
689689
struct spi_dt_spec *spec = loopback_specs[spec_idx];
690690

691-
static __BUF_ALIGN uint16_t tx_data_9[BUFWIDE_SIZE];
691+
static __BUF_ALIGN __NOCACHE uint16_t tx_data_9[BUFWIDE_SIZE];
692692

693693
for (int i = 0; i < BUFWIDE_SIZE; i++) {
694694
tx_data_9[i] = tx_data_16[i] & 0x1FF;
@@ -712,7 +712,7 @@ ZTEST(spi_loopback, test_spi_word_size_24)
712712
{
713713
struct spi_dt_spec *spec = loopback_specs[spec_idx];
714714

715-
static __BUF_ALIGN uint32_t tx_data_24[BUFWIDE_SIZE];
715+
static __BUF_ALIGN __NOCACHE uint32_t tx_data_24[BUFWIDE_SIZE];
716716

717717
for (int i = 0; i < BUFWIDE_SIZE; i++) {
718718
tx_data_24[i] = tx_data_32[i] & 0xFFFFFF;

0 commit comments

Comments
 (0)