1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/usbus: handle exceeding of number of endpoints

If the number of endpoints is not sufficient for an application, it should not be silently ignored and cause a non-working application. Rather, should cause an assertion as it is a configuration issue.
This commit is contained in:
Gunar Schorcht 2023-03-10 07:54:49 +01:00
parent 513676f6e0
commit 1fa988d135
4 changed files with 10 additions and 0 deletions

View File

@ -231,18 +231,21 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
usbus_endpoint_t *ep = usbus_add_endpoint(usbus, &cdcacm->iface_ctrl,
USB_EP_TYPE_INTERRUPT,
USB_EP_DIR_IN, 8);
assert(ep);
ep->interval = 255; /* Max interval */
usbus_enable_endpoint(ep);
ep = usbus_add_endpoint(usbus, &cdcacm->iface_data,
USB_EP_TYPE_BULK, USB_EP_DIR_IN,
CONFIG_USBUS_CDC_ACM_BULK_EP_SIZE);
ep->interval = 0; /* Interval is not used with bulk endpoints */
assert(ep);
usbus_enable_endpoint(ep);
/* Store the endpoint reference to activate it
* when DTE present is signalled by the host */
ep = usbus_add_endpoint(usbus, &cdcacm->iface_data,
USB_EP_TYPE_BULK, USB_EP_DIR_OUT,
CONFIG_USBUS_CDC_ACM_BULK_EP_SIZE);
assert(ep);
ep->interval = 0; /* Interval is not used with bulk endpoints */
usbus_enable_endpoint(ep);

View File

@ -218,6 +218,7 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
USB_EP_TYPE_INTERRUPT,
USB_EP_DIR_IN,
USBUS_CDCECM_EP_CTRL_SIZE);
assert(cdcecm->ep_ctrl);
cdcecm->ep_ctrl->interval = 0x10;
cdcecm->ep_out = usbus_add_endpoint(usbus,
@ -225,12 +226,14 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
USB_EP_TYPE_BULK,
USB_EP_DIR_OUT,
USBUS_CDCECM_EP_DATA_SIZE);
assert(cdcecm->ep_out);
cdcecm->ep_out->interval = 0; /* Must be 0 for bulk endpoints */
cdcecm->ep_in = usbus_add_endpoint(usbus,
(usbus_interface_t *)&cdcecm->iface_data_alt,
USB_EP_TYPE_BULK,
USB_EP_DIR_IN,
USBUS_CDCECM_EP_DATA_SIZE);
assert(cdcecm->ep_in);
cdcecm->ep_in->interval = 0; /* Must be 0 for bulk endpoints */
/* Add interfaces to the stack */

View File

@ -121,6 +121,7 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
USB_EP_TYPE_INTERRUPT,
USB_EP_DIR_IN,
CONFIG_USBUS_HID_INTERRUPT_EP_SIZE);
assert(hid->ep_in);
/* interrupt endpoint polling rate in ms */
hid->ep_in->interval = 0x05;
@ -131,6 +132,7 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
hid->ep_out = usbus_add_endpoint(usbus, &hid->iface,
USB_EP_TYPE_INTERRUPT, USB_EP_DIR_OUT,
CONFIG_USBUS_HID_INTERRUPT_EP_SIZE);
assert(hid->ep_out);
/* interrupt endpoint polling rate in ms */
hid->ep_out->interval = 0x05;

View File

@ -339,9 +339,11 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
/* Create required endpoints */
msc->ep_in = usbus_add_endpoint(usbus, &msc->iface, USB_EP_TYPE_BULK,
USB_EP_DIR_IN, CONFIG_USBUS_EP0_SIZE);
assert(msc->ep_in);
msc->ep_in->interval = 0;
msc->ep_out = usbus_add_endpoint(usbus, &msc->iface, USB_EP_TYPE_BULK,
USB_EP_DIR_OUT, CONFIG_USBUS_EP0_SIZE);
assert(msc->ep_out);
msc->ep_out->interval = 0;
/* Add interfaces to the stack */