add usbd_get_ep_mult api
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
struct usbd_tx_rx_msg {
|
||||
uint8_t ep;
|
||||
uint8_t ep_mult;
|
||||
uint16_t ep_mps;
|
||||
uint32_t nbytes;
|
||||
usbd_endpoint_callback cb;
|
||||
@@ -103,9 +104,11 @@ static bool usbd_set_endpoint(uint8_t busid, const struct usb_endpoint_descripto
|
||||
USB_GET_MAXPACKETSIZE(ep->wMaxPacketSize));
|
||||
|
||||
if (ep->bEndpointAddress & 0x80) {
|
||||
g_usbd_core[busid].tx_msg[ep->bEndpointAddress & 0x7f].ep_mps = USB_GET_MAXPACKETSIZE(ep->wMaxPacketSize) * (USB_GET_MULT(ep->wMaxPacketSize));
|
||||
g_usbd_core[busid].tx_msg[ep->bEndpointAddress & 0x7f].ep_mps = USB_GET_MAXPACKETSIZE(ep->wMaxPacketSize);
|
||||
g_usbd_core[busid].tx_msg[ep->bEndpointAddress & 0x7f].ep_mult = USB_GET_MULT(ep->wMaxPacketSize);
|
||||
} else {
|
||||
g_usbd_core[busid].rx_msg[ep->bEndpointAddress & 0x7f].ep_mps = USB_GET_MAXPACKETSIZE(ep->wMaxPacketSize) * (USB_GET_MULT(ep->wMaxPacketSize));
|
||||
g_usbd_core[busid].rx_msg[ep->bEndpointAddress & 0x7f].ep_mps = USB_GET_MAXPACKETSIZE(ep->wMaxPacketSize);
|
||||
g_usbd_core[busid].rx_msg[ep->bEndpointAddress & 0x7f].ep_mult = USB_GET_MULT(ep->wMaxPacketSize);
|
||||
}
|
||||
|
||||
return usbd_ep_open(busid, ep) == 0 ? true : false;
|
||||
@@ -1213,6 +1216,15 @@ uint16_t usbd_get_ep_mps(uint8_t busid, uint8_t ep)
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t usbd_get_ep_mult(uint8_t busid, uint8_t ep)
|
||||
{
|
||||
if (ep & 0x80) {
|
||||
return g_usbd_core[busid].tx_msg[ep & 0x7f].ep_mult;
|
||||
} else {
|
||||
return g_usbd_core[busid].rx_msg[ep & 0x7f].ep_mult;
|
||||
}
|
||||
}
|
||||
|
||||
bool usb_device_is_configured(uint8_t busid)
|
||||
{
|
||||
return g_usbd_core[busid].configuration;
|
||||
|
||||
@@ -98,7 +98,9 @@ void usbd_add_interface(uint8_t busid, struct usbd_interface *intf);
|
||||
void usbd_add_endpoint(uint8_t busid, struct usbd_endpoint *ep);
|
||||
|
||||
uint16_t usbd_get_ep_mps(uint8_t busid, uint8_t ep);
|
||||
uint8_t usbd_get_ep_mult(uint8_t busid, uint8_t ep);
|
||||
bool usb_device_is_configured(uint8_t busid);
|
||||
|
||||
int usbd_initialize(uint8_t busid, uint32_t reg_base, void (*event_handler)(uint8_t busid, uint8_t event));
|
||||
int usbd_deinitialize(uint8_t busid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user