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>
This commit is contained in:
Emil Obalski 2020-10-20 13:28:02 +02:00 committed by Carles Cufí
commit 2eb2bc325e

View file

@ -237,6 +237,7 @@ K_MEM_POOL_DEFINE(ep_buf_pool, EP_BUF_POOL_BLOCK_MIN_SZ,
* @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 @@ K_MEM_POOL_DEFINE(ep_buf_pool, EP_BUF_POOL_BLOCK_MIN_SZ,
*/
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 @@ static inline void usbd_work_process_setup(struct nrf_usbd_ep_ctx *ep_ctx)
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,