drivers: usb_dc_nrfx: Abort write on ep_ctx_reset

Change adds abort of ongoing write operation in ep_ctx_reset. This is
required to keep the state of Zephyr driver consistent with state of
nrfx driver. This fixes a bug where nrfx_usbd was stuck in busy state.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
This commit is contained in:
Marek Pieta 2020-05-13 07:11:06 -07:00 committed by Carles Cufí
commit 6da15634bf

View file

@ -637,6 +637,11 @@ static void ep_ctx_reset(struct nrf_usbd_ep_ctx *ep_ctx)
ep_ctx->buf.curr = ep_ctx->buf.data;
ep_ctx->buf.len = 0U;
/* Abort ongoing write operation. */
if (ep_ctx->write_in_progress) {
nrfx_usbd_ep_abort(ep_addr_to_nrfx(ep_ctx->cfg.addr));
}
ep_ctx->read_complete = true;
ep_ctx->read_pending = false;
ep_ctx->write_in_progress = false;
@ -1056,6 +1061,12 @@ static void usbd_event_transfer_data(nrfx_usbd_evt_t const *const p_event)
}
break;
case NRFX_USBD_EP_ABORTED: {
LOG_DBG("Endpoint 0x%02x write aborted",
p_event->data.eptransfer.ep);
}
break;
default: {
LOG_ERR("Unexpected event (nrfx_usbd): %d, ep 0x%02x",
p_event->data.eptransfer.status,