14 #include "sw/device/lib/testing/aon_timer_testutils.h"
15 #include "sw/device/lib/testing/flash_ctrl_testutils.h"
16 #include "sw/device/lib/testing/nv_counter_testutils.h"
17 #include "sw/device/lib/testing/pwrmgr_testutils.h"
18 #include "sw/device/lib/testing/rstmgr_testutils.h"
19 #include "sw/device/lib/testing/test_framework/check.h"
22 #include "aon_timer_regs.h"
37 OTTF_DEFINE_TEST_CONFIG();
39 static volatile const uint8_t kNumRound;
42 static dif_sysrst_ctrl_t sysrst_ctrl;
43 static dif_pinmux_t pinmux;
50 static void prgm_push_button_wakeup(
void) {
53 .debounce_time_threshold = 1,
72 CHECK_DIF_OK(dif_pwrmgr_init(
77 CHECK_DIF_OK(dif_rstmgr_init(
86 CHECK_DIF_OK(dif_sysrst_ctrl_init(
91 CHECK_DIF_OK(dif_pinmux_init(
95 uint32_t event_idx = 0;
96 CHECK_STATUS_OK(flash_ctrl_testutils_counter_get(0, &event_idx));
99 flash_ctrl_testutils_default_region_access(&flash_ctrl,
108 CHECK_STATUS_OK(flash_ctrl_testutils_counter_increment(&flash_ctrl, 0));
113 LOG_INFO(
"wakeup type:%d wakeup reason: 0x%02X", wakeup_reason.
types,
116 if (wakeup_reason.
types == 0) {
121 CHECK(wakeup_reason.
request_sources == (kDifPwrmgrWakeupRequestSourceOne |
122 kDifPwrmgrWakeupRequestSourceFive));
129 rst_info = rstmgr_testutils_reason_get();
130 rstmgr_testutils_reason_clear();
131 LOG_INFO(
"reset info = 0x%02X", rst_info);
135 LOG_ERROR(
"unexpected reset info: 0x%x", rst_info);
138 dif_aon_timer_t aon_timer;
139 CHECK_DIF_OK(dif_aon_timer_init(
154 if (event_idx < kNumRound) {
155 LOG_INFO(
"Test round %d", event_idx);
162 prgm_push_button_wakeup();
165 CHECK_STATUS_OK(rstmgr_testutils_pre_reset(&rstmgr));
172 aon_timer_testutils_wakeup_config(&aon_timer, wakeup_threshold));
175 CHECK_STATUS_OK(pwrmgr_testutils_enable_low_power(
177 (kDifPwrmgrWakeupRequestSourceOne | kDifPwrmgrWakeupRequestSourceTwo |
178 kDifPwrmgrWakeupRequestSourceThree | kDifPwrmgrWakeupRequestSourceFour |
179 kDifPwrmgrWakeupRequestSourceFive | kDifPwrmgrWakeupRequestSourceSix),