void usb_endpoint_prime( const usb_endpoint_t* const endpoint, usb_transfer_descriptor_t* const first_td ) { usb_queue_head_t* const qh = usb_queue_head(endpoint->address, endpoint->device); qh->next_dtd_pointer = first_td; qh->total_bytes &= ~( USB_TD_DTD_TOKEN_STATUS_ACTIVE | USB_TD_DTD_TOKEN_STATUS_HALTED ) ; const uint_fast8_t endpoint_number = usb_endpoint_number(endpoint->address); if(endpoint->device->controller == 0) { if( usb_endpoint_is_in(endpoint->address) ) { USB0_ENDPTPRIME = USB0_ENDPTPRIME_PETB(1 << endpoint_number); } else { USB0_ENDPTPRIME = USB0_ENDPTPRIME_PERB(1 << endpoint_number); } } if(endpoint->device->controller == 1) { if( usb_endpoint_is_in(endpoint->address) ) { USB1_ENDPTPRIME = USB1_ENDPTPRIME_PETB(1 << endpoint_number); } else { USB1_ENDPTPRIME = USB1_ENDPTPRIME_PERB(1 << endpoint_number); } } }
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); } }