[dif/usbdev] Decouple HW config from DIF handle init.
DIF libraries across most IPs have two DIFs for initializing and
configuring an IP (respectively):
1. `dif_<ip>_init(...)` initializes an IP DIF handle, and
2. `dif_<ip>_configure(...)` configures an IP with runtime parameters.
The usbdev DIF library did not conform to this pattern, rather it
combined the intended functionality of both DIFs above into the first
DIF listed above, the `dif_<ip>_init(...)` DIF.
This commit fixes this and enables the usbdev DIF library to conform to
the pattern used by most other DIF libraries, therefore making
auto-generation of IRQ integration-tests feasible.
Signed-off-by: Timothy Trippel <ttrippel@google.com>
diff --git a/sw/device/lib/dif/dif_usbdev.h b/sw/device/lib/dif/dif_usbdev.h
index f7b2929..648c60a 100644
--- a/sw/device/lib/dif/dif_usbdev.h
+++ b/sw/device/lib/dif/dif_usbdev.h
@@ -131,10 +131,6 @@
*/
typedef struct dif_usbdev_config {
/**
- * Base address of the USB device.
- */
- mmio_region_t base_addr;
- /**
* Use the differential rx signal instead of the single-ended signals.
*/
dif_usbdev_toggle_t differential_rx;
@@ -188,15 +184,28 @@
* A USB device must first be initialized by this function before calling other
* functions in this library.
*
- * @param config Configuration for initializing a USB device.
+ * @param base_addr Hardware instantiation base address.
* @param[out] usbdev Internal state of the initialized USB device.
* @return The result of the operation.
*/
OT_WARN_UNUSED_RESULT
-dif_usbdev_result_t dif_usbdev_init(dif_usbdev_config_t *config,
+dif_usbdev_result_t dif_usbdev_init(mmio_region_t base_addr,
dif_usbdev_t *usbdev);
/**
+ * Configures a USB device with runtime information.
+ *
+ * This function should need to be called once for the lifetime of `handle`.
+ *
+ * @param usbdev A USB device.
+ * @param config Runtime configuration parameters for a USB device.
+ * @return The result of the operation.
+ */
+OT_WARN_UNUSED_RESULT
+dif_usbdev_result_t dif_usbdev_configure(const dif_usbdev_t *usbdev,
+ dif_usbdev_config_t config);
+
+/**
* Fill the available buffer FIFO of a USB device.
*
* The USB device has a small FIFO (AV FIFO) that stores free buffers for