usb: Use usb_endpoint_is_priming helper
This commit is contained in:
@ -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,17 +224,12 @@ 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) )
|
||||
if (usb_endpoint_is_priming(endpoint)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -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
|
||||
) {
|
||||
|
Reference in New Issue
Block a user