9 #include "sw/device/lib/testing/otp_ctrl_testutils.h"
10 #include "sw/device/lib/testing/test_framework/check.h"
11 #include "sw/device/lib/testing/test_framework/ottf_test_config.h"
17 static volatile const uint32_t kTestAddress = 0;
19 static dif_otp_ctrl_t otp;
21 OTTF_DEFINE_TEST_CONFIG();
23 static void init_peripherals(
void) {
26 .integrity_period_mask = 0x3ffff,
27 .consistency_period_mask = 0x3ffffff,
30 CHECK_DIF_OK(dif_otp_ctrl_init(
35 static void check_status(uint32_t expected_code,
42 if (expected_code == 0) {
44 "Unexpected OTP status codes, got 0x%x, expected 0",
status.codes);
46 CHECK(
status.codes == (1 << expected_code),
47 "Unexpected OTP status, got 0x%x, expected 0x%x",
status.codes,
48 (1 << expected_cause));
49 CHECK(
status.causes[expected_code] == expected_cause,
50 "Unexpected error cause, got 0x%x, expected 0x%x",
51 status.causes[expected_code], expected_cause);
61 static const uint32_t kTestPartition = 0;
66 LOG_INFO(
"Testing at OTP address 0x%x", kTestAddress);
67 LOG_INFO(
"Ready for single fault injection");
69 CHECK_STATUS_OK(otp_ctrl_testutils_dai_read32(&otp, kTestPartition,
70 kTestAddress, &value));
72 LOG_INFO(
"Ready for double fault injection");
74 CHECK_STATUS_OK(otp_ctrl_testutils_dai_read32(&otp, kTestPartition,
75 kTestAddress, &value));