Software APIs
mock_otp.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_OTP_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_MOCK_OTP_H_
7 
8 #include "sw/device/lib/base/global_mock.h"
9 #include "sw/device/silicon_creator/lib/drivers/otp.h"
10 #include "sw/device/silicon_creator/testing/rom_test.h"
11 
12 namespace rom_test {
13 namespace internal {
14 
15 /**
16  * Mock class for otp.c.
17  */
18 class MockOtp : public global_mock::GlobalMock<MockOtp> {
19  public:
20  MOCK_METHOD(uint32_t, read32, (uint32_t address));
21  MOCK_METHOD(uint32_t, read64, (uint32_t address));
22  MOCK_METHOD(void, read, (uint32_t address, uint32_t *data, size_t num_words));
23  MOCK_METHOD(void, CreatorSwCfgLockdown, ());
24 };
25 
26 } // namespace internal
27 
28 // Nice mock for shutdown unit tests.
29 using NiceMockOtp = testing::NiceMock<internal::MockOtp>;
30 // Strict mock for other unit tests.
31 using MockOtp = testing::StrictMock<internal::MockOtp>;
32 
33 } // namespace rom_test
34 
35 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_MOCK_OTP_H_