14 #include "sw/device/lib/testing/aon_timer_testutils.h"
15 #include "sw/device/lib/testing/pwrmgr_testutils.h"
16 #include "sw/device/lib/testing/rstmgr_testutils.h"
17 #include "sw/device/lib/testing/test_framework/check.h"
22 #define IDLE_TIME_US 10
23 #define WKUP_TIME_US 2000
24 OTTF_DEFINE_TEST_CONFIG();
29 CHECK_DIF_OK(dif_pwrmgr_init(
34 CHECK_DIF_OK(dif_rstmgr_init(
38 dif_aon_timer_t aon_timer;
39 CHECK_DIF_OK(dif_aon_timer_init(
45 kDifPwrmgrResetRequestSourceTwo,
50 rstmgr_testutils_reason_clear();
55 LOG_INFO(
"Booting for the first time, setting wdog");
58 uint64_t wkup_cycles = 0;
59 CHECK_STATUS_OK(aon_timer_testutils_get_aon_cycles_64_from_us(
60 WKUP_TIME_US, &wkup_cycles));
64 CHECK_STATUS_OK(aon_timer_testutils_watchdog_config(&aon_timer, UINT32_MAX,
66 CHECK_STATUS_OK(aon_timer_testutils_wakeup_config(&aon_timer, wkup_cycles));
73 CHECK(wdog_cnt >= wkup_cnt);
76 CHECK_STATUS_OK(pwrmgr_testutils_enable_low_power(
77 &pwrmgr, kDifPwrmgrWakeupRequestSourceFive,
81 LOG_INFO(
"Issue WFI to enter sleep");
84 LOG_INFO(
"Booting for the second time due to wakeup");
89 CHECK(wdog_cnt < wkup_cnt);
92 LOG_ERROR(
"Got unexpected reset_info=0x%x", rst_info);