Software APIs
sram_readback_test.c
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 <stdbool.h>
6 
9 #include "sw/device/silicon_creator/lib/drivers/otp.h"
10 #include "sw/device/silicon_creator/lib/manifest_def.h"
11 
13 #include "otp_ctrl_regs.h"
14 #include "sram_ctrl_regs.h"
15 
16 OTTF_DEFINE_TEST_CONFIG();
17 
18 enum {
21 };
22 
23 bool test_main(void) {
24  uint32_t otp =
25  otp_read32(OTP_CTRL_PARAM_OWNER_SW_CFG_ROM_SRAM_READBACK_EN_OFFSET);
26  uint32_t sram =
27  abs_mmio_read32(kSramCtrlBase + SRAM_CTRL_READBACK_REG_OFFSET);
28  uint32_t retram =
29  abs_mmio_read32(kRetRamCtrlBase + SRAM_CTRL_READBACK_REG_OFFSET);
30  LOG_INFO("sram_readback: otp=%x retram=%x sram=%x", otp, retram, sram);
31  return otp == (retram << 4 | sram);
32 }