Initial commit
Signed-off-by: Alphan Ulusoy <alphan@google.com>
[sw] Add dif_pwrmgr_smoktest
- The test puts the device to sleep and immediately wakes up via usb
- The usb wakeup is FAKE, the usb device is not actually enumerated. Instead the usbdev presents to be in suspend to activate the wake logic, which is then used to trigger a wakeup.
Signed-off-by: Timothy Chen <timothytim@google.com>
[dv] Convert existing dif_pwrmgr_smoketest into a dv only test
- The test relies on specific dv behvaior that cannot always be replicated in other systems without intervention.
Signed-off-by: Timothy Chen <timothytim@google.com>
[sw] update dif_pwrmgr_smoketest
- use aon_timer for wakeup instead of usb
- this should now be portable across all targets
Signed-off-by: Timothy Chen <timothytim@google.com>
[sw] Fix typo
Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/sw/device/lib/usbdev.h b/sw/device/lib/usbdev.h
index bb9d59d..afe7794 100644
--- a/sw/device/lib/usbdev.h
+++ b/sw/device/lib/usbdev.h
@@ -36,6 +36,11 @@
};
/**
+ * Select USB lines P or N
+ */
+typedef enum line_sel { kDpSel = 0, kDnSel = 1 } line_sel_t;
+
+/**
* Allocate a buffer for the caller to use
*
* @param ctx usbdev context pointer
@@ -229,6 +234,21 @@
*/
void usbdev_init(usbdev_ctx_t *ctx, bool pinflip, bool diff_rx, bool diff_tx);
+/**
+ * Force usbdev to output suspend state for testing purposes
+ */
+void usbdev_force_suspend(void);
+
+/**
+ * Force usbdev pull-up to specific value
+ */
+void usbdev_force_dx_pullup(line_sel_t line, bool set);
+
+/**
+ * Enable usb wake
+ */
+void usbdev_wake(bool set);
+
// Used for tracing what is going on. This may impact timing which is critical
// when simulating with the USB DPI module.
//#define ENABLE_TRC