Software APIs
mock_spi_device.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_MOCK_SPI_DEVICE_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_MOCK_SPI_DEVICE_H_
7 
8 #include "sw/device/lib/base/global_mock.h"
9 #include "sw/device/silicon_creator/lib/drivers/spi_device.h"
10 
11 namespace rom_test {
12 namespace internal {
13 
14 /**
15  * Mock class for spi_device.c.
16  */
17 class MockSpiDevice : public global_mock::GlobalMock<MockSpiDevice> {
18  public:
19  MOCK_METHOD(void, Init, ());
20  MOCK_METHOD(rom_error_t, CmdGet, (spi_device_cmd_t *));
21  MOCK_METHOD(void, FlashStatusClear, ());
22  MOCK_METHOD(uint32_t, FlashStatusGet, ());
23 };
24 
25 } // namespace internal
26 
27 using MockSpiDevice = testing::StrictMock<internal::MockSpiDevice>;
28 using NiceMockSpiDevice = testing::NiceMock<internal::MockSpiDevice>;
29 
30 } // namespace rom_test
31 
32 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_MOCK_SPI_DEVICE_H_