usb: drivers: Save setup packet in the driver structure.
This patch adds setup packet copy in the Nordic device
controller driver (ubs_dc_nrfx.c). This patch is required
for subsequent patch that fixes isssues with ZLP handling.
Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
diff --git a/drivers/usb/device/usb_dc_nrfx.c b/drivers/usb/device/usb_dc_nrfx.c
index a5d46fe..424fdcd 100644
--- a/drivers/usb/device/usb_dc_nrfx.c
+++ b/drivers/usb/device/usb_dc_nrfx.c
@@ -237,6 +237,7 @@
* @brief USBD control structure
*
* @param status_cb Status callback for USB DC notifications
+ * @param setup Setup packet for Control requests
* @param hfxo_cli Onoff client used to control HFXO
* @param hfxo_mgr Pointer to onoff manager associated with HFXO.
* @param clk_requested Flag used to protect against double stop.
@@ -249,6 +250,7 @@
*/
struct nrf_usbd_ctx {
usb_dc_status_callback status_cb;
+ struct usb_setup_packet setup;
struct onoff_client hfxo_cli;
struct onoff_manager *hfxo_mgr;
atomic_t clk_requested;
@@ -796,6 +798,9 @@
usbd_setup->wLength = nrf_usbd_setup_wlength_get(NRF_USBD);
ep_ctx->buf.len = sizeof(struct usb_setup_packet);
+ /* Copy setup packet to driver internal structure */
+ memcpy(&usbd_ctx.setup, usbd_setup, sizeof(struct usb_setup_packet));
+
LOG_DBG("SETUP: bR:0x%02x bmRT:0x%02x wV:0x%04x wI:0x%04x wL:%d",
(uint32_t)usbd_setup->bRequest,
(uint32_t)usbd_setup->bmRequestType,