5 #ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_SPI_DEVICE_TESTUTILS_H_
6 #define OPENTITAN_SW_DEVICE_LIB_TESTING_SPI_DEVICE_TESTUTILS_H_
11 #include "sw/device/lib/base/status.h"
14 #include "sw/device/lib/testing/json/spi_passthru.h"
19 typedef enum spi_device_flash_opcode {
20 kSpiDeviceFlashOpReadJedec = 0x9f,
21 kSpiDeviceFlashOpReadSfdp = 0x5a,
22 kSpiDeviceFlashOpReadNormal = 0x03,
23 kSpiDeviceFlashOpRead4b = 0x13,
24 kSpiDeviceFlashOpReadFast = 0x0b,
25 kSpiDeviceFlashOpReadFast4b = 0x0c,
26 kSpiDeviceFlashOpReadDual = 0x3b,
27 kSpiDeviceFlashOpReadQuad = 0x6b,
28 kSpiDeviceFlashOpWriteEnable = 0x06,
29 kSpiDeviceFlashOpWriteDisable = 0x04,
30 kSpiDeviceFlashOpReadStatus1 = 0x05,
31 kSpiDeviceFlashOpReadStatus2 = 0x35,
32 kSpiDeviceFlashOpReadStatus3 = 0x15,
33 kSpiDeviceFlashOpWriteStatus1 = 0x01,
34 kSpiDeviceFlashOpWriteStatus2 = 0x31,
35 kSpiDeviceFlashOpWriteStatus3 = 0x11,
36 kSpiDeviceFlashOpChipErase = 0xc7,
37 kSpiDeviceFlashOpSectorErase = 0x20,
38 kSpiDeviceFlashOpBlockErase32k = 0x52,
39 kSpiDeviceFlashOpBlockErase64k = 0xd8,
40 kSpiDeviceFlashOpPageProgram = 0x02,
41 kSpiDeviceFlashOpEnter4bAddr = 0xb7,
42 kSpiDeviceFlashOpExit4bAddr = 0xe9,
43 kSpiDeviceFlashOpResetEnable = 0x66,
44 kSpiDeviceFlashOpReset = 0x99,
45 kSpiDeviceFlashOpSectorErase4b = 0x21,
46 kSpiDeviceFlashOpBlockErase32k4b = 0x5c,
47 kSpiDeviceFlashOpBlockErase64k4b = 0xdc,
48 kSpiDeviceFlashOpPageProgram4b = 0x12,
49 } spi_device_flash_opcode_t;
54 enum spi_device_command_slot {
55 kSpiDeviceReadCommandSlotBase = 0,
56 kSpiDeviceWriteCommandSlotBase = 11,
96 status_t spi_device_testutils_configure_passthrough(
98 bool upload_write_commands);
111 status_t spi_device_testutils_configure_read_pipeline(
113 dif_spi_device_read_pipeline_mode_t dual_mode,
114 dif_spi_device_read_pipeline_mode_t quad_mode);
123 status_t spi_device_testutils_configure_pad_attrs(dif_pinmux_t *pinmux);
138 upload_info_t *info);