add tuh_edpt_close() API, it will abort any pending transfer

implement hcd_edpt_close() for pio-usb and max3421e, also move max3421e api into its own header.
This commit is contained in:
hathach
2025-03-25 16:15:58 +07:00
parent b99b811308
commit 65e01fff2e
8 changed files with 213 additions and 159 deletions

View File

@@ -994,6 +994,12 @@ bool tuh_edpt_open(uint8_t dev_addr, tusb_desc_endpoint_t const* desc_ep) {
return hcd_edpt_open(usbh_get_rhport(dev_addr), dev_addr, desc_ep);
}
bool tuh_edpt_close(uint8_t daddr, uint8_t ep_addr) {
TU_VERIFY(0 != tu_edpt_number(ep_addr)); // cannot close EP0
tuh_edpt_abort_xfer(daddr, ep_addr); // abort any pending transfer
return hcd_edpt_close(usbh_get_rhport(daddr), daddr, ep_addr);
}
bool usbh_edpt_busy(uint8_t dev_addr, uint8_t ep_addr) {
usbh_device_t* dev = get_device(dev_addr);
TU_VERIFY(dev);