5 #include "sw/device/lib/testing/rstmgr_testutils.h"
12 #include "sw/device/lib/testing/test_framework/check.h"
13 #include "sw/device/silicon_creator/lib/drivers/retention_sram.h"
15 #define MODULE_ID MAKE_MODULE_ID('r', 'm', 'g')
17 status_t rstmgr_testutils_is_reset_info(
const dif_rstmgr_t *rstmgr,
20 actual_info = rstmgr_testutils_reason_get();
21 return OK_STATUS(actual_info == info);
24 status_t rstmgr_testutils_reset_info_any(
27 actual_info = rstmgr_testutils_reason_get();
28 return OK_STATUS((actual_info & info) != 0);
31 status_t rstmgr_testutils_compare_alert_info(
32 const dif_rstmgr_t *rstmgr,
41 TRY_CHECK(dump_size == size_read,
42 "The expected alert info dump size (%d) is not equal to "
43 "the observed dump size (%d).",
44 dump_size, size_read);
45 TRY_CHECK_ARRAYS_EQ(actual_alert_dump, expected_alert_dump, dump_size);
49 status_t rstmgr_testutils_compare_cpu_info(
50 const dif_rstmgr_t *rstmgr,
58 TRY_CHECK(dump_size == size_read,
59 "The expected cpu info dump size (%d) is not equal to "
60 "the observed dump size (%d).",
61 dump_size, size_read);
62 TRY_CHECK_ARRAYS_EQ(actual_cpu_dump, expected_cpu_dump, dump_size);
66 status_t rstmgr_testutils_pre_reset(
const dif_rstmgr_t *rstmgr) {
68 rstmgr_testutils_reason_clear();
76 status_t rstmgr_testutils_post_reset(
77 const dif_rstmgr_t *rstmgr,
80 size_t alert_dump_size,
82 size_t cpu_dump_size) {
85 actual_reset_info = rstmgr_testutils_reason_get();
86 TRY_CHECK(expected_reset_info == actual_reset_info,
87 "Unexpected reset_info CSR mismatch, expected 0x%x, got 0x%x",
88 expected_reset_info, actual_reset_info);
90 if (expected_alert_dump != NULL && alert_dump_size != 0) {
91 TRY(rstmgr_testutils_compare_alert_info(rstmgr, expected_alert_dump,
94 if (expected_cpu_dump != NULL && cpu_dump_size != 0) {
95 TRY(rstmgr_testutils_compare_cpu_info(rstmgr, expected_cpu_dump,
105 void rstmgr_testutils_reason_clear(
void) {