Software APIs
mock_otp.cc
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 #include "sw/device/silicon_creator/lib/drivers/mock_otp.h"
6 
7 namespace rom_test {
8 extern "C" {
9 // Note: In the functions below, we use `MockOtp` only for conciseness. The
10 // static `Instance()` method returns a reference to the same
11 // `internal::MockOtp` instance regardless if we use `MockOtp`, `NiceMockOtp`,
12 // or `internal::MockOtp`.
13 uint32_t otp_read32(uint32_t address) {
14  return MockOtp::Instance().read32(address);
15 }
16 
17 uint64_t otp_read64(uint32_t address) {
18  return MockOtp::Instance().read64(address);
19 }
20 
21 void otp_read(uint32_t address, uint32_t *data, size_t num_words) {
22  return MockOtp::Instance().read(address, data, num_words);
23 }
24 
25 void otp_creator_sw_cfg_lockdown(void) {
26  MockOtp::Instance().CreatorSwCfgLockdown();
27 }
28 } // extern "C"
29 } // namespace rom_test