15 #include "dt/dt_pinmux.h"
21 #include "sw/device/lib/testing/pwrmgr_testutils.h"
22 #include "sw/device/lib/testing/test_framework/check.h"
25 static dif_pwrmgr_t pwrmgr;
26 static dif_usbdev_t usbdev;
28 static const dt_pwrmgr_t kPwrmgrDt = 0;
29 static_assert(kDtPwrmgrCount == 1,
"this test expects a pwrmgr");
30 static const dt_pinmux_t kPinmuxDt = 0;
31 static_assert(kDtPinmuxCount == 1,
"this test expects a pinmux");
32 static const dt_usbdev_t kUsbdevDt = 0;
33 static_assert(kDtUsbdevCount >= 1,
"this test expects at least one usbdev");
35 OTTF_DEFINE_TEST_CONFIG();
43 CHECK_DIF_OK(dif_pwrmgr_init_from_dt(kPwrmgrDt, &pwrmgr));
44 CHECK_DIF_OK(dif_usbdev_init_from_dt(kUsbdevDt, &usbdev));
49 kDtPinmuxWakeupUsbWkupReq, &wakeup_sources));
62 .request_sources = wakeup_sources,
65 bool low_power_exit =
false;
66 if (compare_wakeup_reasons(wakeup_reason, exp_por_wakeup_reason)) {
67 LOG_INFO(
"Powered up for the first time, begin test");
68 }
else if (compare_wakeup_reasons(wakeup_reason, exp_test_wakeup_reason)) {
69 low_power_exit =
true;
72 LOG_ERROR(
"Unexpected wakeup reason (types: %02x, sources: %08x)",
79 if (!low_power_exit) {
83 .dn_pullup_en =
false,
93 CHECK_STATUS_OK(pwrmgr_testutils_enable_low_power(
94 &pwrmgr, wakeup_sources, kDifPwrmgrDomainOptionUsbClockInActivePower));