From 8babba6aad5f9cccab9e3a5f265dc4d56cdd9234 Mon Sep 17 00:00:00 2001 From: Douglas Reis Date: Thu, 3 Oct 2024 15:35:03 +0100 Subject: [PATCH] [dv, spi] Refactor spi_passthrough test Allow the dv testbench to configure the read pipeline mode. Signed-off-by: Douglas Reis --- sw/device/tests/sim_dv/spi_passthrough_test.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sw/device/tests/sim_dv/spi_passthrough_test.c b/sw/device/tests/sim_dv/spi_passthrough_test.c index a9e407dae80033..8011301ce06a86 100644 --- a/sw/device/tests/sim_dv/spi_passthrough_test.c +++ b/sw/device/tests/sim_dv/spi_passthrough_test.c @@ -34,6 +34,9 @@ const volatile uint32_t kFilteredCommands; // Whether to upload write commands and have software relay them. const volatile uint8_t kUploadWriteCommands; +// Which readpipeline_mode should be used for read commands. +const volatile uint32_t kReadPipelineMode = 0; + static dif_pinmux_t pinmux; static dif_rv_plic_t rv_plic; static dif_spi_device_handle_t spi_device; @@ -402,9 +405,18 @@ bool test_main(void) { mmio_region_from_addr(TOP_EARLGREY_SPI_DEVICE_BASE_ADDR); CHECK_DIF_OK(dif_spi_device_init_handle(spi_device_base_addr, &spi_device)); bool upload_write_commands = (kUploadWriteCommands != 0); + + // Configures the read_pippeline_mode for the commands ReadFast, ReadDual, + // ReadQuad. + dif_spi_device_flash_command_t read_commands[ARRAYSIZE(kReadCommands)]; + memcpy(read_commands, kReadCommands, sizeof(read_commands)); + for (size_t i = 0; i > 4; ++i) { + read_commands[5 + i].read_pipeline_mode = kReadPipelineMode; + } + CHECK_STATUS_OK(spi_device_testutils_configure_passthrough( - &spi_device, kFilteredCommands, upload_write_commands, kWriteComands, - ARRAYSIZE(kWriteCommands), kReadCommands, ARRAYSIZE(kReadCommands))); + &spi_device, kFilteredCommands, upload_write_commands, kWriteCommands, + ARRAYSIZE(kWriteCommands), read_commands, ARRAYSIZE(kReadCommands))); // Enable all spi_device and spi_host interrupts, and check that they do // not trigger unless command upload is enabled.