Skip to content

Commit

Permalink
usb: Ensure endpoint queue is flushed on disable/init
Browse files Browse the repository at this point in the history
  • Loading branch information
bgamari committed Jul 7, 2013
1 parent 8fdc22f commit f12defe
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions firmware/hackrf_usb/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "usb.h"
#include "usb_type.h"
#include "usb_queue.h"
#include "usb_standard_request.h"

#include <libopencm3/lpc43xx/creg.h>
Expand Down Expand Up @@ -163,6 +164,7 @@ void usb_endpoint_disable(
} else {
USB0_ENDPTCTRL(endpoint_number) &= ~(USB0_ENDPTCTRL_RXE);
}
usb_queue_flush_endpoint(endpoint);
usb_endpoint_clear_pending_interrupts(endpoint);
usb_endpoint_flush(endpoint);
}
Expand Down Expand Up @@ -248,6 +250,7 @@ void usb_endpoint_flush(
const usb_endpoint_t* const endpoint
) {
const uint_fast8_t endpoint_number = usb_endpoint_number(endpoint->address);
usb_queue_flush_endpoint(endpoint);
if( usb_endpoint_is_in(endpoint->address) ) {
usb_flush_primed_endpoints(USB0_ENDPTFLUSH_FETB(1 << endpoint_number));
} else {
Expand Down

0 comments on commit f12defe

Please sign in to comment.