[test] update test for latest design
- Fixes #8729
- Lengthen the test time as sram key rotation / init takes
significant time
- Correct the wakeup source number. This should be addressed
eventually in autogenerated difs instead of using numbers like three / four.
- Some minor cosmetic fixes to the test to make the intent more clear.
Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/hw/top_earlgrey/dv/chip_sim_cfg.hjson b/hw/top_earlgrey/dv/chip_sim_cfg.hjson
index e97c999..7554066 100644
--- a/hw/top_earlgrey/dv/chip_sim_cfg.hjson
+++ b/hw/top_earlgrey/dv/chip_sim_cfg.hjson
@@ -253,7 +253,7 @@
uvm_test_seq: chip_sw_base_vseq
sw_images: ["sw/device/tests/pwrmgr_usbdev_smoketest:1"]
en_run_modes: ["sw_test_mode"]
- run_opts: ["+sw_test_timeout_ns=2000000"]
+ run_opts: ["+sw_test_timeout_ns=4000000"]
}
{
name: chip_sw_rv_timer_irq
diff --git a/sw/device/tests/sim_dv/pwrmgr_usbdev_smoketest.c b/sw/device/tests/sim_dv/pwrmgr_usbdev_smoketest.c
index e9c8a60..0244da5 100644
--- a/sw/device/tests/sim_dv/pwrmgr_usbdev_smoketest.c
+++ b/sw/device/tests/sim_dv/pwrmgr_usbdev_smoketest.c
@@ -14,6 +14,7 @@
#include "sw/device/lib/base/mmio.h"
#include "sw/device/lib/dif/dif_pwrmgr.h"
+#include "sw/device/lib/runtime/hart.h"
#include "sw/device/lib/runtime/log.h"
#include "sw/device/lib/testing/check.h"
#include "sw/device/lib/testing/test_framework/test_main.h"
@@ -45,7 +46,7 @@
const dif_pwrmgr_wakeup_reason_t exp_test_wakeup_reason = {
.types = kDifPwrmgrWakeupTypeRequest,
- .request_sources = kDifPwrmgrWakeupRequestSourceThree,
+ .request_sources = kDifPwrmgrWakeupRequestSourceFour,
};
bool low_power_exit = false;
@@ -66,11 +67,14 @@
usbdev_wake(true);
usbdev_force_suspend();
usbdev_force_dx_pullup(kDpSel, true);
- usbdev_force_dx_pullup(kDnSel, true);
+ usbdev_force_dx_pullup(kDnSel, false);
+
+ // give the hardware a chance to recognize the wakeup values are the same
+ usleep(20); // 20us
// Enable low power on the next WFI with default settings.
CHECK_DIF_OK(dif_pwrmgr_set_request_sources(
- &pwrmgr, kDifPwrmgrReqTypeWakeup, kDifPwrmgrWakeupRequestSourceThree));
+ &pwrmgr, kDifPwrmgrReqTypeWakeup, kDifPwrmgrWakeupRequestSourceFour));
CHECK_DIF_OK(dif_pwrmgr_set_domain_config(
&pwrmgr, kDifPwrmgrDomainOptionUsbClockInActivePower));
CHECK_DIF_OK(dif_pwrmgr_low_power_set_enabled(&pwrmgr, kDifToggleEnabled));