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
|
// Schedule an already filled-in transfer descriptor for execution on
|
||||||
// the given endpoint, waiting until the endpoint has finished.
|
// the given endpoint, waiting until the endpoint has finished.
|
||||||
void usb_endpoint_schedule_wait(
|
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 tail_td,
|
||||||
usb_transfer_descriptor_t* const new_td
|
usb_transfer_descriptor_t* const new_td
|
||||||
) {
|
) {
|
||||||
const uint_fast8_t endpoint_number = usb_endpoint_number(endpoint->address);
|
|
||||||
bool done;
|
bool done;
|
||||||
|
|
||||||
tail_td->next_dtd_pointer = new_td;
|
tail_td->next_dtd_pointer = new_td;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if( usb_endpoint_is_in(endpoint->address) ) {
|
if (usb_endpoint_is_priming(endpoint)) {
|
||||||
if (USB0_ENDPTPRIME & USB0_ENDPTPRIME_PETB(1 << endpoint_number) )
|
return;
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if (USB0_ENDPTPRIME & USB0_ENDPTPRIME_PERB(1 << endpoint_number) )
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
USB0_USBCMD_D |= USB0_USBCMD_D_ATDTW;
|
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(
|
void usb_endpoint_flush(
|
||||||
const usb_endpoint_t* const endpoint
|
const usb_endpoint_t* const endpoint
|
||||||
) {
|
) {
|
||||||
|
Reference in New Issue
Block a user