diff --git a/ChangeLog b/ChangeLog index 0d5ec32b5e..c15340ec83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5483,4 +5483,6 @@ * Remove all empty and most useless README.txt files (2013-8-31) * configs/freedom-kl25z/src/kl_spi.c: Correct typo in name of a function. From Alan Carvalho de Assis (2013-8-31). + * drivers/usbdev/cdcacm_desc.c: Fixed some compilation errors that + only occur when dual speed support is enabled (2013-9-1). diff --git a/drivers/usbdev/cdcacm_desc.c b/drivers/usbdev/cdcacm_desc.c index 5d60df612b..58dcc123f0 100644 --- a/drivers/usbdev/cdcacm_desc.c +++ b/drivers/usbdev/cdcacm_desc.c @@ -373,6 +373,29 @@ static const struct usb_qualdesc_s g_qualdesc = * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: cdcacm_cpepdesc + * + * Description: + * Copy an endpoint descriptor using the correct max packet size. + * + ****************************************************************************/ + +#ifdef CONFIG_USBDEV_DUALSPEED +void cdcacm_cpepdesc(FAR const struct usb_epdesc_s *indesc, uint16_t mxpacket, + FAR struct usb_epdesc_s *outdesc) +{ + /* Copy the "canned" descriptor */ + + memcpy(outdesc, indesc, USB_SIZEOF_EPDESC); + + /* Then add the correct max packet size */ + + outdesc->mxpacketsize[0] = LSBYTE(mxpacket); + outdesc->mxpacketsize[1] = MSBYTE(mxpacket); +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -462,7 +485,7 @@ int cdcacm_mkstrdesc(uint8_t id, struct usb_strdesc_s *strdesc) } /**************************************************************************** - * Name: cdcacm_getepdesc + * Name: cdcacm_getdevdesc * * Description: * Return a pointer to the raw device descriptor @@ -512,20 +535,14 @@ FAR const struct usb_epdesc_s *cdcacm_getepdesc(enum cdcacm_epdesc_e epid) ****************************************************************************/ #ifdef CONFIG_USBDEV_DUALSPEED -void cdcacm_mkepdesc(num cdcacm_epdesc_e epid, uint16_t mxpacket, +void cdcacm_mkepdesc(enum cdcacm_epdesc_e epid, uint16_t mxpacket, FAR struct usb_epdesc_s *outdesc) { - FAR const struct usb_epdesc_s *indesc; + /* Map the ID to the correct endpoint and let cdcacm_cpepdesc to the real + * work. + */ - /* Copy the "canned" descriptor */ - - indesc = cdcacm_getepdesc(epid) - memcpy(outdesc, indesc, USB_SIZEOF_EPDESC); - - /* Then add the correct max packet size */ - - outdesc->mxpacketsize[0] = LSBYTE(mxpacket); - outdesc->mxpacketsize[1] = MSBYTE(mxpacket); + cdcacm_cpepdesc(cdcacm_getepdesc(epid), mxpacket, outdesc); } #endif @@ -574,10 +591,11 @@ int16_t cdcacm_mkcfgdesc(FAR uint8_t *buf) */ #ifdef CONFIG_USBDEV_DUALSPEED - if (highspeed && group->hsepsize != 0) + if (hispeed && group->hsepsize != 0) { - cdcacm_mkepdesc(group->desc, group->hsepsize, - (FAR struct usb_epdesc_s*)dest); + cdcacm_cpepdesc((FAR const struct usb_epdesc_s *)group->desc, + group->hsepsize, + (FAR struct usb_epdesc_s*)dest); } else #endif