6 #include "sw/device/lib/runtime/irq.h"
8 #include "sw/device/lib/testing/pwrmgr_testutils.h"
9 #include "sw/device/lib/testing/ret_sram_testutils.h"
10 #include "sw/device/lib/testing/test_framework/check.h"
12 #include "sw/device/tests/pwrmgr_sleep_all_wake_ups_impl.h"
21 OTTF_DEFINE_TEST_CONFIG();
26 static void delay_n_clear(uint32_t delay_in_us) {
33 irq_global_ctrl(
true);
34 irq_external_ctrl(
true);
36 ret_sram_testutils_init();
40 uint32_t wakeup_unit = 0;
42 if (UNWRAP(pwrmgr_testutils_is_wakeup_reason(&pwrmgr, 0))) {
44 CHECK_STATUS_OK(ret_sram_testutils_counter_clear(kCounterCases));
47 ret_sram_testutils_counter_get(kCounterCases, &wakeup_unit));
48 check_wakeup_reason(wakeup_unit);
49 LOG_INFO(
"Woke up by source %d", wakeup_unit);
50 clear_wakeup(wakeup_unit);
52 CHECK_STATUS_OK(ret_sram_testutils_counter_increment(kCounterCases));
57 ret_sram_testutils_counter_get(kCounterCases, &wakeup_unit));
58 if (wakeup_unit >= get_wakeup_count()) {
61 if (execute_test(wakeup_unit,
true)) {
62 CHECK(
false,
"This is not reachable since we entered deep sleep");
65 CHECK_STATUS_OK(ret_sram_testutils_counter_increment(kCounterCases));