Software APIs
otp_ctrl_vendor_test_csr_access_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 
10 #include "sw/device/lib/testing/test_framework/check.h"
11 #include "sw/device/lib/testing/test_framework/ottf_test_config.h"
13 
15 
16 static dif_lc_ctrl_t lc;
17 static dif_otp_ctrl_t otp;
18 
19 OTTF_DEFINE_TEST_CONFIG();
20 
21 static void init_peripherals(void) {
22  dif_otp_ctrl_config_t config = {
23  .check_timeout = 100000,
24  .integrity_period_mask = 0x3ffff,
25  .consistency_period_mask = 0x3ffffff,
26  };
27  // Life cycle
28  CHECK_DIF_OK(dif_lc_ctrl_init(
30  // OTP
31  CHECK_DIF_OK(dif_otp_ctrl_init(
33  CHECK_DIF_OK(dif_otp_ctrl_configure(&otp, config));
34 }
35 
36 /**
37  * A simple SW test to enable OTP_CTRL and LC_CTRL.
38  * The main sequence is driven by JTAG agent in SV sequence
39  * `chip_sw_otp_ctrl_vendor_test_csr_access_vseq.sv`.
40  */
41 bool test_main(void) {
42  init_peripherals();
43  // This is an anker for sv wait
44  LOG_INFO("init peripheral is done");
45  return true;
46 }