diff --git a/drivers/usbdev/adb.c b/drivers/usbdev/adb.c index e094d8d779..080854302f 100644 --- a/drivers/usbdev/adb.c +++ b/drivers/usbdev/adb.c @@ -285,28 +285,19 @@ static const FAR struct usbdev_epinfo_s *g_adb_epinfos[USBADB_NUM_EPS] = * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type) -#else -static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, - FAR struct usbdev_devinfo_s *devinfo) -#endif { FAR struct usb_epdesc_s *epdesc; FAR struct usb_ifdesc_s *dest; /* Check for switches between high and full speed */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) if (type == USB_DESC_TYPE_OTHERSPEEDCONFIG && speed < USB_SPEED_SUPER) { speed = speed == USB_SPEED_HIGH ? USB_SPEED_FULL : USB_SPEED_HIGH; } -#else - uint8_t speed = USB_SPEED_FULL; -#endif dest = (FAR struct usb_ifdesc_s *)buf; epdesc = (FAR struct usb_epdesc_s *)(buf + sizeof(g_adb_ifdesc)); diff --git a/drivers/usbdev/cdcacm.c b/drivers/usbdev/cdcacm.c index 4ec53e471d..43509a4172 100644 --- a/drivers/usbdev/cdcacm.c +++ b/drivers/usbdev/cdcacm.c @@ -1631,12 +1631,8 @@ static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver, #ifndef CONFIG_CDCACM_COMPOSITE case USB_DESC_TYPE_CONFIG: { -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) ret = cdcacm_mkcfgdesc(ctrlreq->buf, &priv->devinfo, dev->speed, ctrl->value[1]); -#else - ret = cdcacm_mkcfgdesc(ctrlreq->buf, &priv->devinfo); -#endif } break; #endif @@ -3107,11 +3103,7 @@ void cdcacm_get_composite_devdesc(struct composite_devdesc_s *dev) /* Let the construction function calculate the size of config descriptor */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) dev->cfgdescsize = cdcacm_mkcfgdesc(NULL, NULL, USB_SPEED_UNKNOWN, 0); -#else - dev->cfgdescsize = cdcacm_mkcfgdesc(NULL, NULL); -#endif /* Board-specific logic must provide the device minor */ diff --git a/drivers/usbdev/cdcacm.h b/drivers/usbdev/cdcacm.h index 8671c313e9..d9f6ee0930 100644 --- a/drivers/usbdev/cdcacm.h +++ b/drivers/usbdev/cdcacm.h @@ -246,14 +246,9 @@ int cdcacm_copy_epdesc(enum cdcacm_epdesc_e epid, * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) int16_t cdcacm_mkcfgdesc(FAR uint8_t *buf, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type); -#else -int16_t cdcacm_mkcfgdesc(FAR uint8_t *buf, - FAR struct usbdev_devinfo_s *devinfo); -#endif /**************************************************************************** * Name: cdcacm_getqualdesc diff --git a/drivers/usbdev/cdcacm_desc.c b/drivers/usbdev/cdcacm_desc.c index 516ab859ee..8dc9890d63 100644 --- a/drivers/usbdev/cdcacm_desc.c +++ b/drivers/usbdev/cdcacm_desc.c @@ -364,25 +364,16 @@ int cdcacm_copy_epdesc(enum cdcacm_epdesc_e epid, * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) int16_t cdcacm_mkcfgdesc(FAR uint8_t *buf, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type) -#else -int16_t cdcacm_mkcfgdesc(FAR uint8_t *buf, - FAR struct usbdev_devinfo_s *devinfo) -#endif { int length = 0; -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) if (type == USB_DESC_TYPE_OTHERSPEEDCONFIG && speed < USB_SPEED_SUPER) { speed = speed == USB_SPEED_HIGH ? USB_SPEED_FULL : USB_SPEED_HIGH; } -#else - uint8_t speed = USB_SPEED_FULL; -#endif /* Fill in all descriptors directly to the buf */ @@ -404,18 +395,10 @@ int16_t cdcacm_mkcfgdesc(FAR uint8_t *buf, /* Let's calculate the size... */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) int16_t size = cdcacm_mkcfgdesc(NULL, NULL, speed, type); -#else - int16_t size = cdcacm_mkcfgdesc(NULL, NULL); -#endif dest->len = USB_SIZEOF_CFGDESC; /* Descriptor length */ -#ifdef CONFIG_USBDEV_DUALSPEED dest->type = type; /* Descriptor type */ -#else - dest->type = USB_DESC_TYPE_CONFIG; /* Descriptor type */ -#endif dest->totallen[0] = LSBYTE(size); /* LS Total length */ dest->totallen[1] = MSBYTE(size); /* MS Total length */ dest->ninterfaces = CDCACM_NINTERFACES; /* Number of interfaces */ diff --git a/drivers/usbdev/cdcecm.c b/drivers/usbdev/cdcecm.c index 05b904aaf4..70b4754cc5 100644 --- a/drivers/usbdev/cdcecm.c +++ b/drivers/usbdev/cdcecm.c @@ -1221,35 +1221,26 @@ static void cdcecm_mkepdesc(int epidx, * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) static int16_t cdcecm_mkcfgdesc(FAR uint8_t *desc, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type) -#else -static int16_t cdcecm_mkcfgdesc(FAR uint8_t *desc, - FAR struct usbdev_devinfo_s *devinfo) -#endif { FAR struct usb_cfgdesc_s *cfgdesc = NULL; int16_t len = 0; /* Check for switches between high and full speed */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) if (type == USB_DESC_TYPE_OTHERSPEEDCONFIG && speed < USB_SPEED_SUPER) { speed = speed == USB_SPEED_HIGH ? USB_SPEED_FULL : USB_SPEED_HIGH; } -#else - uint8_t speed = USB_SPEED_FULL; -#endif #ifndef CONFIG_CDCECM_COMPOSITE if (desc) { cfgdesc = (FAR struct usb_cfgdesc_s *)desc; cfgdesc->len = USB_SIZEOF_CFGDESC; - cfgdesc->type = USB_DESC_TYPE_CONFIG; + cfgdesc->type = type; cfgdesc->ninterfaces = CDCECM_NINTERFACES; cfgdesc->cfgvalue = CDCECM_CONFIGID; cfgdesc->icfg = devinfo->strbase + CDCECM_CONFIGSTRID; @@ -1484,12 +1475,8 @@ static int cdcecm_getdescriptor(FAR struct cdcecm_driver_s *self, #endif /* CONFIG_USBDEV_DUALSPEED */ case USB_DESC_TYPE_CONFIG: { -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) return cdcecm_mkcfgdesc((FAR uint8_t *)desc, &self->devinfo, self->usbdev.speed, type); -#else - return cdcecm_mkcfgdesc((FAR uint8_t *)desc, &self->devinfo); -#endif } break; @@ -2018,11 +2005,7 @@ void cdcecm_get_composite_devdesc(struct composite_devdesc_s *dev) /* Let the construction function calculate the size of config descriptor */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) dev->cfgdescsize = cdcecm_mkcfgdesc(NULL, NULL, USB_SPEED_UNKNOWN, 0); -#else - dev->cfgdescsize = cdcecm_mkcfgdesc(NULL, NULL); -#endif /* Board-specific logic must provide the device minor */ diff --git a/drivers/usbdev/cdcncm.c b/drivers/usbdev/cdcncm.c index b64b3942a0..4c9479e11c 100644 --- a/drivers/usbdev/cdcncm.c +++ b/drivers/usbdev/cdcncm.c @@ -1992,36 +1992,26 @@ static void cdcncm_mkepdesc(int epidx, FAR struct usb_epdesc_s *epdesc, * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) static int16_t cdcnm_mkcfgdesc(FAR uint8_t *desc, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type, bool isncm) -#else -static int16_t cdcnm_mkcfgdesc(FAR uint8_t *desc, - FAR struct usbdev_devinfo_s *devinfo, - bool isncm) -#endif { FAR struct usb_cfgdesc_s *cfgdesc = NULL; int16_t len = 0; /* Check for switches between high and full speed */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) if (type == USB_DESC_TYPE_OTHERSPEEDCONFIG && speed < USB_SPEED_SUPER) { speed = speed == USB_SPEED_HIGH ? USB_SPEED_FULL : USB_SPEED_HIGH; } -#else - uint8_t speed = USB_SPEED_FULL; -#endif #ifndef CONFIG_CDCNCM_COMPOSITE if (desc) { cfgdesc = (FAR struct usb_cfgdesc_s *)desc; cfgdesc->len = USB_SIZEOF_CFGDESC; - cfgdesc->type = USB_DESC_TYPE_CONFIG; + cfgdesc->type = type; cfgdesc->ninterfaces = CDCECM_NINTERFACES; cfgdesc->cfgvalue = CDCECM_CONFIGID; cfgdesc->icfg = devinfo->strbase + CDCECM_CONFIGSTRID; @@ -2272,7 +2262,6 @@ static int16_t cdcnm_mkcfgdesc(FAR uint8_t *desc, * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) static int16_t cdcncm_mkcfgdesc(FAR uint8_t *desc, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type) @@ -2288,21 +2277,6 @@ static int16_t cdcmbim_mkcfgdesc(FAR uint8_t *desc, return cdcnm_mkcfgdesc(desc, devinfo, speed, type, false); } # endif -#else -static int16_t cdcncm_mkcfgdesc(FAR uint8_t *desc, - FAR struct usbdev_devinfo_s *devinfo) -{ - return cdcnm_mkcfgdesc(desc, devinfo, true); -} - -# ifdef CONFIG_NET_CDCMBIM -static int16_t cdcmbim_mkcfgdesc(FAR uint8_t *desc, - FAR struct usbdev_devinfo_s *devinfo) -{ - return cdcnm_mkcfgdesc(desc, devinfo, false); -} -# endif -#endif /**************************************************************************** * Name: cdcncm_getdescriptor @@ -2351,12 +2325,8 @@ static int cdcncm_getdescriptor(FAR struct cdcncm_driver_s *self, case USB_DESC_TYPE_OTHERSPEEDCONFIG: #endif /* CONFIG_USBDEV_DUALSPEED */ case USB_DESC_TYPE_CONFIG: -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) return cdcncm_mkcfgdesc((FAR uint8_t *)desc, &self->devinfo, self->usbdev.speed, type); -#else - return cdcncm_mkcfgdesc((FAR uint8_t *)desc, &self->devinfo); -#endif case USB_DESC_TYPE_STRING: return cdcncm_mkstrdesc(index, (FAR struct usb_strdesc_s *)desc); @@ -3082,14 +3052,9 @@ static void cdcnm_get_composite_devdesc(FAR struct composite_devdesc_s *dev, /* Let the construction function calculate the size of config descriptor */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) dev->cfgdescsize = isncm ? cdcncm_mkcfgdesc(NULL, NULL, USB_SPEED_UNKNOWN, 0) : cdcmbim_mkcfgdesc(NULL, NULL, USB_SPEED_UNKNOWN, 0); -#else - dev->cfgdescsize = isncm ? cdcncm_mkcfgdesc(NULL, NULL) : - cdcmbim_mkcfgdesc(NULL, NULL); -#endif /* Board-specific logic must provide the device minor */ diff --git a/drivers/usbdev/composite.c b/drivers/usbdev/composite.c index e793a8f51a..e7fc39818e 100644 --- a/drivers/usbdev/composite.c +++ b/drivers/usbdev/composite.c @@ -277,14 +277,9 @@ static int composite_msftdescriptor(FAR struct composite_dev_s *priv, * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) static int16_t composite_mkcfgdesc(FAR struct usbdevclass_driver_s *driver, FAR uint8_t *buf, uint8_t speed, uint8_t type) -#else -static int16_t composite_mkcfgdesc(FAR struct usbdevclass_driver_s *driver, - FAR uint8_t *buf) -#endif { FAR struct composite_dev_s *priv = ((FAR struct composite_driver_s *)driver)->dev; @@ -299,6 +294,7 @@ static int16_t composite_mkcfgdesc(FAR struct usbdevclass_driver_s *driver, cfgdesc = (FAR struct usb_cfgdesc_s *)buf; cfgdesc->ninterfaces = priv->ninterfaces; + cfgdesc->type = type; /* Increment the size and buf to point right behind the information * filled in @@ -313,18 +309,11 @@ static int16_t composite_mkcfgdesc(FAR struct usbdevclass_driver_s *driver, { FAR struct composite_devobj_s *devobj = &priv->device[i]; -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) len = devobj->compdesc.mkconfdesc(buf, &devobj->compdesc.devinfo, speed, type); total += len; buf += len; -#else - len = devobj->compdesc.mkconfdesc(buf, - &devobj->compdesc.devinfo); - total += len; - buf += len; -#endif } cfgdesc->totallen[0] = LSBYTE(total); @@ -677,12 +666,8 @@ static int composite_setup(FAR struct usbdevclass_driver_s *driver, case USB_DESC_TYPE_CONFIG: { -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) ret = composite_mkcfgdesc(driver, ctrlreq->buf, dev->speed, ctrl->value[1]); -#else - ret = composite_mkcfgdesc(driver, ctrlreq->buf); -#endif } break; diff --git a/drivers/usbdev/dfu.c b/drivers/usbdev/dfu.c index 1cc4fc3c76..80c6aa8be2 100644 --- a/drivers/usbdev/dfu.c +++ b/drivers/usbdev/dfu.c @@ -181,21 +181,14 @@ static void usbclass_ep0incomplete(FAR struct usbdev_ep_s *ep, { } -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type) -#else -static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, - FAR struct usbdev_devinfo_s *devinfo) -#endif { FAR struct dfu_cfgdesc_s *dest = (FAR struct dfu_cfgdesc_s *)buf; -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) UNUSED(speed); UNUSED(type); -#endif *dest = g_dfu_cfgdesc; dest->ifdesc.ifno += devinfo->ifnobase; @@ -319,12 +312,8 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver, { if (ctrl->value[1] == USB_DESC_TYPE_CONFIG) { -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) ret = usbclass_mkcfgdesc(ctrlreq->buf, &priv->devinfo, dev->speed, ctrl->value[1]); -#else - ret = usbclass_mkcfgdesc(ctrlreq->buf, &priv->devinfo); -#endif } else if (ctrl->value[1] == USB_DESC_TYPE_STRING) { diff --git a/drivers/usbdev/mtp.c b/drivers/usbdev/mtp.c index 22888d1cb5..86967d119d 100644 --- a/drivers/usbdev/mtp.c +++ b/drivers/usbdev/mtp.c @@ -296,28 +296,19 @@ static const FAR struct usbdev_epinfo_s *g_mtp_epinfos[USBMTP_NUM_EPS] = * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type) -#else -static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, - FAR struct usbdev_devinfo_s *devinfo) -#endif { FAR struct usb_epdesc_s *epdesc; FAR struct usb_ifdesc_s *dest; /* Check for switches between high and full speed */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) if (type == USB_DESC_TYPE_OTHERSPEEDCONFIG && speed < USB_SPEED_SUPER) { speed = speed == USB_SPEED_HIGH ? USB_SPEED_FULL : USB_SPEED_HIGH; } -#else - uint8_t speed = USB_SPEED_FULL; -#endif dest = (FAR struct usb_ifdesc_s *)buf; epdesc = (FAR struct usb_epdesc_s *)(buf + sizeof(g_mtp_ifdesc)); diff --git a/drivers/usbdev/pl2303.c b/drivers/usbdev/pl2303.c index 8927f6c8ac..09f88fd3f1 100644 --- a/drivers/usbdev/pl2303.c +++ b/drivers/usbdev/pl2303.c @@ -295,11 +295,7 @@ static inline int usbclass_recvpacket(FAR struct pl2303_dev_s *priv, static int usbclass_mkstrdesc(uint8_t id, struct usb_strdesc_s *strdesc); static void usbclass_mkepbulkdesc(const struct usb_epdesc_s *indesc, uint16_t mxpacket, struct usb_epdesc_s *outdesc); -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) static int16_t usbclass_mkcfgdesc(uint8_t *buf, uint8_t speed, uint8_t type); -#else -static int16_t usbclass_mkcfgdesc(uint8_t *buf); -#endif static void usbclass_resetconfig(FAR struct pl2303_dev_s *priv); static int usbclass_setconfig(FAR struct pl2303_dev_s *priv, uint8_t config); @@ -858,11 +854,7 @@ static inline void usbclass_mkepbulkdesc( * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) static int16_t usbclass_mkcfgdesc(uint8_t *buf, uint8_t speed, uint8_t type) -#else -static int16_t usbclass_mkcfgdesc(uint8_t *buf) -#endif { FAR struct usb_cfgdesc_s *cfgdesc = (FAR struct usb_cfgdesc_s *)buf; uint16_t bulkmxpacket = CONFIG_PL2303_EPBULK_FSSIZE; @@ -870,12 +862,10 @@ static int16_t usbclass_mkcfgdesc(uint8_t *buf) /* Check for switches between high and full speed */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) if (type == USB_DESC_TYPE_OTHERSPEEDCONFIG && speed < USB_SPEED_SUPER) { speed = speed == USB_SPEED_HIGH ? USB_SPEED_FULL : USB_SPEED_HIGH; } -#endif /* This is the total length of the configuration (not necessarily the * size that we will be sending now. @@ -889,6 +879,7 @@ static int16_t usbclass_mkcfgdesc(uint8_t *buf) */ memcpy(cfgdesc, &g_cfgdesc, USB_SIZEOF_CFGDESC); + cfgdesc->type = type; buf += USB_SIZEOF_CFGDESC; /* Copy the canned interface descriptor */ @@ -1634,12 +1625,8 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver, case USB_DESC_TYPE_CONFIG: { -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) ret = usbclass_mkcfgdesc(ctrlreq->buf, dev->speed, ctrl->req); -#else - ret = usbclass_mkcfgdesc(ctrlreq->buf); -#endif } break; diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c index e7eaf482ea..3ad72229c5 100644 --- a/drivers/usbdev/rndis.c +++ b/drivers/usbdev/rndis.c @@ -1910,27 +1910,18 @@ static int usbclass_mkstrdesc(uint8_t id, FAR struct usb_strdesc_s *strdesc) * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type) -#else -static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, - FAR struct usbdev_devinfo_s *devinfo) -#endif { uint16_t totallen = 0; /* Check for switches between high and full speed */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) if (type == USB_DESC_TYPE_OTHERSPEEDCONFIG && speed < USB_SPEED_SUPER) { speed = speed == USB_SPEED_HIGH ? USB_SPEED_FULL : USB_SPEED_HIGH; } -#else - uint8_t speed = USB_SPEED_FULL; -#endif /* This is the total length of the configuration (not necessarily the * size that we will be sending now). @@ -1945,16 +1936,10 @@ static int16_t usbclass_mkcfgdesc(FAR uint8_t *buf, */ FAR struct usb_cfgdesc_s *dest = (FAR struct usb_cfgdesc_s *)buf; -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) int16_t size = usbclass_mkcfgdesc(NULL, NULL, speed, type); -#else - int16_t size = usbclass_mkcfgdesc(NULL, NULL); -#endif memcpy(buf, &g_rndis_cfgdesc, sizeof(struct usb_cfgdesc_s)); -#ifdef CONFIG_USBDEV_DUALSPEED dest->type = type; /* Descriptor type */ -#endif dest->totallen[0] = LSBYTE(size); /* LS Total length */ dest->totallen[1] = MSBYTE(size); /* MS Total length */ @@ -2441,12 +2426,8 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver, # endif /* CONFIG_USBDEV_DUALSPEED */ case USB_DESC_TYPE_CONFIG: { -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) ret = usbclass_mkcfgdesc(ctrlreq->buf, &priv->devinfo, dev->speed, ctrl->req); -# else - ret = usbclass_mkcfgdesc(ctrlreq->buf, &priv->devinfo); -# endif } break; #endif @@ -3016,11 +2997,8 @@ void usbdev_rndis_get_composite_devdesc(struct composite_devdesc_s *dev) /* Let the construction function calculate the size of config descriptor */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) - dev->cfgdescsize = usbclass_mkcfgdesc(NULL, NULL, USB_SPEED_UNKNOWN, 0); -#else - dev->cfgdescsize = usbclass_mkcfgdesc(NULL, NULL); -#endif + dev->cfgdescsize = usbclass_mkcfgdesc(NULL, NULL, + USB_SPEED_UNKNOWN, 0); /* Board-specific logic must provide the device minor */ diff --git a/drivers/usbdev/usbmsc.c b/drivers/usbdev/usbmsc.c index b679335bad..a9ff5888e9 100644 --- a/drivers/usbdev/usbmsc.c +++ b/drivers/usbdev/usbmsc.c @@ -546,12 +546,8 @@ static int usbmsc_setup(FAR struct usbdevclass_driver_s *driver, #ifndef CONFIG_USBMSC_COMPOSITE case USB_DESC_TYPE_CONFIG: { -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) ret = usbmsc_mkcfgdesc(ctrlreq->buf, &priv->devinfo, dev->speed, ctrl->value[1]); -#else - ret = usbmsc_mkcfgdesc(ctrlreq->buf, &priv->devinfo); -#endif } break; #endif diff --git a/drivers/usbdev/usbmsc.h b/drivers/usbdev/usbmsc.h index 7fa463d6fb..2ebf741ed2 100644 --- a/drivers/usbdev/usbmsc.h +++ b/drivers/usbdev/usbmsc.h @@ -558,14 +558,9 @@ int usbmsc_copy_epdesc(enum usbmsc_epdesc_e epid, * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) int16_t usbmsc_mkcfgdesc(FAR uint8_t *buf, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type); -#else -int16_t usbmsc_mkcfgdesc(FAR uint8_t *buf, - FAR struct usbdev_devinfo_s *devinfo); -#endif /**************************************************************************** * Name: usbmsc_getqualdesc diff --git a/drivers/usbdev/usbmsc_desc.c b/drivers/usbdev/usbmsc_desc.c index 8d0efb95e7..b6e211d21e 100644 --- a/drivers/usbdev/usbmsc_desc.c +++ b/drivers/usbdev/usbmsc_desc.c @@ -324,25 +324,16 @@ int usbmsc_copy_epdesc(enum usbmsc_epdesc_e epid, * ****************************************************************************/ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) int16_t usbmsc_mkcfgdesc(uint8_t *buf, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type) -#else -int16_t usbmsc_mkcfgdesc(uint8_t *buf, - FAR struct usbdev_devinfo_s *devinfo) -#endif { /* Check for switches between high and full speed */ -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) if (type == USB_DESC_TYPE_OTHERSPEEDCONFIG && speed != USB_SPEED_HIGH) { speed = speed == USB_SPEED_HIGH ? USB_SPEED_FULL : USB_SPEED_HIGH; } -#else - uint8_t speed = USB_SPEED_FULL; -#endif /* Fill in all descriptors directly to the buf */ @@ -361,11 +352,7 @@ int16_t usbmsc_mkcfgdesc(uint8_t *buf, FAR struct usb_cfgdesc_s *dest = (FAR struct usb_cfgdesc_s *)buf; dest->len = USB_SIZEOF_CFGDESC; /* Descriptor length */ -#ifdef CONFIG_USBDEV_DUALSPEED dest->type = type; /* Descriptor type */ -#else - dest->type = USB_DESC_TYPE_CONFIG; /* Descriptor type */ -#endif dest->totallen[0] = LSBYTE(SIZEOF_USBMSC_CFGDESC); /* LS Total length */ dest->totallen[1] = MSBYTE(SIZEOF_USBMSC_CFGDESC); /* MS Total length */ dest->ninterfaces = USBMSC_NINTERFACES; /* Number of interfaces */ diff --git a/include/nuttx/usb/usbdev.h b/include/nuttx/usb/usbdev.h index b0ecc81291..d75e0e3f76 100644 --- a/include/nuttx/usb/usbdev.h +++ b/include/nuttx/usb/usbdev.h @@ -222,15 +222,9 @@ struct usbdev_devinfo_s struct usbdevclass_driver_s; struct composite_devdesc_s { -#if defined(CONFIG_USBDEV_DUALSPEED) || defined(CONFIG_USBDEV_SUPERSPEED) CODE int16_t (*mkconfdesc)(FAR uint8_t *buf, FAR struct usbdev_devinfo_s *devinfo, uint8_t speed, uint8_t type); -#else - CODE int16_t (*mkconfdesc)(FAR uint8_t *buf, - FAR struct usbdev_devinfo_s *devinfo); -#endif - CODE int (*mkstrdesc)(uint8_t id, FAR struct usb_strdesc_s *strdesc); CODE int (*classobject)(int minor, FAR struct usbdev_devinfo_s *devinfo,