diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-09-01 11:27:59 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-09-01 11:27:59 -0600 |
commit | 7a57dd91fe66f1c4b42f12dc531db62b4c1bf383 (patch) | |
tree | 24b8f9841671d097bed746ae4d49eaed9fe98c62 /nuttx/drivers/usbdev | |
parent | 3282abcdf16d7de9d0b755ad8021a6236ad71a38 (diff) | |
download | px4-nuttx-7a57dd91fe66f1c4b42f12dc531db62b4c1bf383.tar.gz px4-nuttx-7a57dd91fe66f1c4b42f12dc531db62b4c1bf383.tar.bz2 px4-nuttx-7a57dd91fe66f1c4b42f12dc531db62b4c1bf383.zip |
CDC/ACM Device: Fixe compilation errors when dual speed support is enabled
Diffstat (limited to 'nuttx/drivers/usbdev')
-rw-r--r-- | nuttx/drivers/usbdev/cdcacm_desc.c | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/nuttx/drivers/usbdev/cdcacm_desc.c b/nuttx/drivers/usbdev/cdcacm_desc.c index 5d60df612..58dcc123f 100644 --- a/nuttx/drivers/usbdev/cdcacm_desc.c +++ b/nuttx/drivers/usbdev/cdcacm_desc.c @@ -374,6 +374,29 @@ static const struct usb_qualdesc_s g_qualdesc = ****************************************************************************/ /**************************************************************************** + * 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; - - /* Copy the "canned" descriptor */ - - indesc = cdcacm_getepdesc(epid) - memcpy(outdesc, indesc, USB_SIZEOF_EPDESC); - - /* Then add the correct max packet size */ + /* Map the ID to the correct endpoint and let cdcacm_cpepdesc to the real + * work. + */ - 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 |