diff --git a/firmware/hackrf_usb/usb.c b/firmware/hackrf_usb/usb.c index 14a94397..09e3d127 100644 --- a/firmware/hackrf_usb/usb.c +++ b/firmware/hackrf_usb/usb.c @@ -188,6 +188,17 @@ void usb_endpoint_prime( } } +static bool usb_endpoint_is_priming( + const usb_endpoint_t* const endpoint +) { + const uint_fast8_t endpoint_number = usb_endpoint_number(endpoint->address); + if( usb_endpoint_is_in(endpoint->address) ) { + return USB0_ENDPTPRIME & USB0_ENDPTPRIME_PETB(1 << endpoint_number); + } else { + return USB0_ENDPTPRIME & USB0_ENDPTPRIME_PERB(1 << endpoint_number); + } +} + // Schedule an already filled-in transfer descriptor for execution on // the given endpoint, waiting until the endpoint has finished. void usb_endpoint_schedule_wait( @@ -213,18 +224,13 @@ void usb_endpoint_schedule_append( usb_transfer_descriptor_t* const tail_td, usb_transfer_descriptor_t* const new_td ) { - const uint_fast8_t endpoint_number = usb_endpoint_number(endpoint->address); bool done; tail_td->next_dtd_pointer = new_td; do { - if( usb_endpoint_is_in(endpoint->address) ) { - if (USB0_ENDPTPRIME & USB0_ENDPTPRIME_PETB(1 << endpoint_number) ) - return; - } else { - if (USB0_ENDPTPRIME & USB0_ENDPTPRIME_PERB(1 << endpoint_number) ) - return; + if (usb_endpoint_is_priming(endpoint)) { + return; } USB0_USBCMD_D |= USB0_USBCMD_D_ATDTW; @@ -237,18 +243,6 @@ void usb_endpoint_schedule_append( } } -/* -static bool usb_endpoint_is_priming( - const usb_endpoint_t* const endpoint -) { - const uint_fast8_t endpoint_number = usb_endpoint_number(endpoint->address); - if( usb_endpoint_is_in(endpoint->address) ) { - return USB0_ENDPTPRIME & USB0_ENDPTPRIME_PETB(1 << endpoint_number); - } else { - return USB0_ENDPTPRIME & USB0_ENDPTPRIME_PERB(1 << endpoint_number); - } -} -*/ void usb_endpoint_flush( const usb_endpoint_t* const endpoint ) {