Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIMXRT1062/LLD/USBHSv1: Fix USB_USE_WAIT support #343

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions os/hal/ports/MIMXRT1062/LLD/USBHSv1/hal_usb_lld.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ static usb_status_t device_ep0_control_callback(usb_device_handle handle,

if (direction == USB_OUT) {
printf_debug(" complete, OUT ep=%d (OUT), rxbuf=%x", ep, epc->out_state->rxbuf);
(usbp)->receiving &= ~(1 << ep);

USBOutEndpointState *osp = epc->out_state;
osp->rxcnt = message->length;
Expand All @@ -317,19 +316,14 @@ static usb_status_t device_ep0_control_callback(usb_device_handle handle,

/* Endpoint Receive Complete Event */
/* Transfer Direction OUT */
if (epc->out_cb != NULL) {
printf_debug(" invoking out_cb for ep %d", ep);
_usb_isr_invoke_out_cb(usbp, ep);
}
printf_debug(" invoking out_cb for ep %d", ep);
_usb_isr_invoke_out_cb(usbp, ep);
} else if (direction == USB_IN) {
printf_debug(" complete, IN ep=%d (IN), txbuf=%x", ep, epc->in_state->txbuf);
(usbp)->transmitting &= ~(1 << ep);
/* Endpoint Transmit Complete Event */
/* Transfer Direction IN */
if (epc->in_cb != NULL) {
printf_debug(" invoking in_cb for ep %d", ep);
_usb_isr_invoke_in_cb(usbp, ep);
}
printf_debug(" invoking in_cb for ep %d", ep);
_usb_isr_invoke_in_cb(usbp, ep);
}

return kStatus_USB_Success;
Expand Down Expand Up @@ -468,27 +462,21 @@ static usb_status_t device_epN_control_callback(usb_device_handle handle,

if (direction == USB_OUT) {
printf_debug(" complete, OUT ep=%d (OUT), rxbuf=%x", ep, epc->out_state->rxbuf);
(usbp)->receiving &= ~(1 << ep);

USBOutEndpointState *osp = epc->out_state;
osp->rxcnt = message->length;
printf_debug(" received %d bytes", osp->rxcnt);

/* Endpoint Receive Complete Event */
/* Transfer Direction OUT */
if (epc->out_cb != NULL) {
printf_debug(" invoking out_cb for ep %d", ep);
_usb_isr_invoke_out_cb(usbp, ep);
}
printf_debug(" invoking out_cb for ep %d", ep);
_usb_isr_invoke_out_cb(usbp, ep);
} else if (direction == USB_IN) {
printf_debug(" complete, IN ep=%d (IN), txbuf=%x", ep, epc->in_state->txbuf);
(usbp)->transmitting &= ~(1 << ep);
/* Endpoint Transmit Complete Event */
/* Transfer Direction IN */
if (epc->in_cb != NULL) {
printf_debug(" invoking in_cb for ep %d", ep);
_usb_isr_invoke_in_cb(usbp, ep);
}
printf_debug(" invoking in_cb for ep %d", ep);
_usb_isr_invoke_in_cb(usbp, ep);
}
return kStatus_USB_Success;
}
Expand Down