2011-09-27 22:11:14 +02:00
|
|
|
/****************************************************************************
|
2012-04-23 18:49:15 +02:00
|
|
|
* drivers/usbdev/cdcacm_desc.c
|
2011-09-27 22:11:14 +02:00
|
|
|
*
|
2021-03-04 07:10:42 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2011-09-27 22:11:14 +02:00
|
|
|
*
|
2021-03-04 07:10:42 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-09-27 22:11:14 +02:00
|
|
|
*
|
2021-03-04 07:10:42 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2011-09-27 22:11:14 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
#include <nuttx/usb/usb.h>
|
2017-07-16 16:43:17 +02:00
|
|
|
#include <nuttx/usb/usbdev.h>
|
2011-09-27 22:11:14 +02:00
|
|
|
#include <nuttx/usb/cdc.h>
|
2012-01-26 00:04:17 +01:00
|
|
|
#include <nuttx/usb/cdcacm.h>
|
2011-09-27 22:11:14 +02:00
|
|
|
#include <nuttx/usb/usbdev_trace.h>
|
|
|
|
|
2023-08-25 08:49:45 +02:00
|
|
|
#ifdef CONFIG_BOARD_USBDEV_SERIALSTR
|
2022-01-18 02:36:37 +01:00
|
|
|
#include <nuttx/board.h>
|
|
|
|
#endif
|
|
|
|
|
2012-01-24 22:51:26 +01:00
|
|
|
#include "cdcacm.h"
|
2011-09-27 22:11:14 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-03-04 08:02:21 +01:00
|
|
|
/* USB descriptor templates these will be copied and modified ***************/
|
2020-01-10 16:06:36 +01:00
|
|
|
|
2012-01-24 22:51:26 +01:00
|
|
|
/* Device Descriptor. If the USB serial device is configured as part of
|
|
|
|
* composite device, then the device descriptor will be provided by the
|
|
|
|
* composite device logic.
|
|
|
|
*/
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
#ifndef CONFIG_CDCACM_COMPOSITE
|
2011-09-27 22:11:14 +02:00
|
|
|
static const struct usb_devdesc_s g_devdesc =
|
|
|
|
{
|
|
|
|
USB_SIZEOF_DEVDESC, /* len */
|
|
|
|
USB_DESC_TYPE_DEVICE, /* type */
|
|
|
|
{ /* usb */
|
|
|
|
LSBYTE(0x0200),
|
|
|
|
MSBYTE(0x0200)
|
|
|
|
},
|
|
|
|
USB_CLASS_CDC, /* class */
|
|
|
|
CDC_SUBCLASS_NONE, /* subclass */
|
|
|
|
CDC_PROTO_NONE, /* protocol */
|
2012-01-26 00:04:17 +01:00
|
|
|
CONFIG_CDCACM_EP0MAXPACKET, /* maxpacketsize */
|
2011-09-27 22:11:14 +02:00
|
|
|
{
|
2012-01-26 00:04:17 +01:00
|
|
|
LSBYTE(CONFIG_CDCACM_VENDORID), /* vendor */
|
|
|
|
MSBYTE(CONFIG_CDCACM_VENDORID)
|
2011-09-27 22:11:14 +02:00
|
|
|
},
|
|
|
|
{
|
2012-01-26 00:04:17 +01:00
|
|
|
LSBYTE(CONFIG_CDCACM_PRODUCTID), /* product */
|
|
|
|
MSBYTE(CONFIG_CDCACM_PRODUCTID)
|
2011-09-27 22:11:14 +02:00
|
|
|
},
|
|
|
|
{
|
2012-01-26 00:04:17 +01:00
|
|
|
LSBYTE(CDCACM_VERSIONNO), /* device */
|
|
|
|
MSBYTE(CDCACM_VERSIONNO)
|
2011-09-27 22:11:14 +02:00
|
|
|
},
|
2012-01-26 00:04:17 +01:00
|
|
|
CDCACM_MANUFACTURERSTRID, /* imfgr */
|
|
|
|
CDCACM_PRODUCTSTRID, /* iproduct */
|
|
|
|
CDCACM_SERIALSTRID, /* serno */
|
|
|
|
CDCACM_NCONFIGS /* nconfigs */
|
2011-09-27 22:11:14 +02:00
|
|
|
};
|
2012-01-24 22:51:26 +01:00
|
|
|
#endif
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
#if !defined(CONFIG_CDCACM_COMPOSITE) && defined(CONFIG_USBDEV_DUALSPEED)
|
2011-09-27 22:11:14 +02:00
|
|
|
static const struct usb_qualdesc_s g_qualdesc =
|
|
|
|
{
|
|
|
|
USB_SIZEOF_QUALDESC, /* len */
|
|
|
|
USB_DESC_TYPE_DEVICEQUALIFIER, /* type */
|
|
|
|
{ /* usb */
|
|
|
|
LSBYTE(0x0200),
|
|
|
|
MSBYTE(0x0200)
|
|
|
|
},
|
|
|
|
USB_CLASS_VENDOR_SPEC, /* class */
|
|
|
|
0, /* subclass */
|
|
|
|
0, /* protocol */
|
2012-01-26 00:04:17 +01:00
|
|
|
CONFIG_CDCACM_EP0MAXPACKET, /* mxpacketsize */
|
|
|
|
CDCACM_NCONFIGS, /* nconfigs */
|
2011-09-27 22:11:14 +02:00
|
|
|
0, /* reserved */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2012-01-26 00:04:17 +01:00
|
|
|
* Name: cdcacm_mkstrdesc
|
2011-09-27 22:11:14 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Construct a string descriptor
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-03-05 18:59:15 +01:00
|
|
|
int cdcacm_mkstrdesc(uint8_t id, FAR struct usb_strdesc_s *strdesc)
|
2011-09-27 22:11:14 +02:00
|
|
|
{
|
2012-01-26 00:04:17 +01:00
|
|
|
#if !defined(CONFIG_CDCACM_COMPOSITE) || defined(CONFIG_CDCACM_NOTIFSTR) || \
|
|
|
|
defined(CONFIG_CDCACM_DATAIFSTR)
|
2022-03-05 18:59:15 +01:00
|
|
|
FAR uint8_t *data = (FAR uint8_t *)(strdesc + 1);
|
|
|
|
FAR const char *str;
|
2011-09-27 22:11:14 +02:00
|
|
|
int len;
|
|
|
|
int ndata;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
switch (id)
|
|
|
|
{
|
2012-01-26 00:04:17 +01:00
|
|
|
#ifndef CONFIG_CDCACM_COMPOSITE
|
2011-09-27 22:11:14 +02:00
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
/* Descriptor 0 is the language id */
|
|
|
|
|
2022-03-05 18:59:15 +01:00
|
|
|
strdesc->len = 4;
|
|
|
|
strdesc->type = USB_DESC_TYPE_STRING;
|
|
|
|
data[0] = LSBYTE(CDCACM_STR_LANGUAGE);
|
|
|
|
data[1] = MSBYTE(CDCACM_STR_LANGUAGE);
|
2011-09-27 22:11:14 +02:00
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
case CDCACM_MANUFACTURERSTRID:
|
|
|
|
str = CONFIG_CDCACM_VENDORSTR;
|
2011-09-27 22:11:14 +02:00
|
|
|
break;
|
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
case CDCACM_PRODUCTSTRID:
|
|
|
|
str = CONFIG_CDCACM_PRODUCTSTR;
|
2011-09-27 22:11:14 +02:00
|
|
|
break;
|
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
case CDCACM_SERIALSTRID:
|
2023-08-25 08:49:45 +02:00
|
|
|
#ifdef CONFIG_BOARD_USBDEV_SERIALSTR
|
2022-01-18 02:36:37 +01:00
|
|
|
str = board_usbdev_serialstr();
|
|
|
|
#else
|
2012-01-26 00:04:17 +01:00
|
|
|
str = CONFIG_CDCACM_SERIALSTR;
|
2022-01-18 02:36:37 +01:00
|
|
|
#endif
|
2011-09-27 22:11:14 +02:00
|
|
|
break;
|
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
case CDCACM_CONFIGSTRID:
|
|
|
|
str = CONFIG_CDCACM_CONFIGSTR;
|
2011-09-27 22:11:14 +02:00
|
|
|
break;
|
2012-01-24 22:51:26 +01:00
|
|
|
#endif
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
#ifdef CONFIG_CDCACM_NOTIFSTR
|
|
|
|
case CDCACM_NOTIFSTRID:
|
|
|
|
str = CONFIG_CDCACM_NOTIFSTR;
|
2011-09-27 22:11:14 +02:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
#ifdef CONFIG_CDCACM_DATAIFSTR
|
|
|
|
case CDCACM_DATAIFSTRID:
|
|
|
|
str = CONFIG_CDCACM_DATAIFSTR;
|
2011-09-27 22:11:14 +02:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2020-01-10 16:06:36 +01:00
|
|
|
/* The string is utf16-le. The poor man's utf-8 to utf16-le
|
|
|
|
* conversion below will only handle 7-bit en-us ascii
|
|
|
|
*/
|
|
|
|
|
|
|
|
len = strlen(str);
|
|
|
|
if (len > (CDCACM_MAXSTRLEN / 2))
|
|
|
|
{
|
|
|
|
len = (CDCACM_MAXSTRLEN / 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0, ndata = 0; i < len; i++, ndata += 2)
|
|
|
|
{
|
2022-03-05 18:59:15 +01:00
|
|
|
data[ndata] = str[i];
|
|
|
|
data[ndata + 1] = 0;
|
2020-01-10 16:06:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
strdesc->len = ndata + 2;
|
|
|
|
strdesc->type = USB_DESC_TYPE_STRING;
|
|
|
|
return strdesc->len;
|
2012-01-24 22:51:26 +01:00
|
|
|
#else
|
2020-01-10 16:06:36 +01:00
|
|
|
return -EINVAL;
|
2012-01-24 22:51:26 +01:00
|
|
|
#endif
|
2011-09-27 22:11:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2013-09-01 19:27:59 +02:00
|
|
|
* Name: cdcacm_getdevdesc
|
2011-09-27 22:11:14 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return a pointer to the raw device descriptor
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
#ifndef CONFIG_CDCACM_COMPOSITE
|
|
|
|
FAR const struct usb_devdesc_s *cdcacm_getdevdesc(void)
|
2011-09-27 22:11:14 +02:00
|
|
|
{
|
|
|
|
return &g_devdesc;
|
|
|
|
}
|
2012-01-24 22:51:26 +01:00
|
|
|
#endif
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: cdcacm_copy_epcompdesc
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Copies the Endpoint Companion Description into the buffer given.
|
|
|
|
* Returns the number of Bytes filled in.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_USBDEV_SUPERSPEED
|
|
|
|
static void
|
|
|
|
cdcacm_copy_epcompdesc(enum cdcacm_epdesc_e epid,
|
|
|
|
FAR struct usb_ss_epcompdesc_s *epcompdesc)
|
|
|
|
{
|
|
|
|
switch (epid)
|
|
|
|
{
|
|
|
|
case CDCACM_EPINTIN: /* Interrupt IN endpoint */
|
|
|
|
{
|
|
|
|
epcompdesc->len = USB_SIZEOF_SS_EPCOMPDESC; /* Descriptor length */
|
|
|
|
epcompdesc->type = USB_DESC_TYPE_ENDPOINT_COMPANION; /* Descriptor type */
|
|
|
|
|
|
|
|
if (CONFIG_CDCACM_EPINTIN_MAXBURST >= USB_SS_INT_EP_MAXBURST)
|
|
|
|
{
|
|
|
|
epcompdesc->mxburst = USB_SS_INT_EP_MAXBURST - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
epcompdesc->mxburst = CONFIG_CDCACM_EPINTIN_MAXBURST;
|
|
|
|
}
|
|
|
|
|
|
|
|
epcompdesc->attr = 0;
|
|
|
|
epcompdesc->wbytes[0] = LSBYTE((epcompdesc->mxburst + 1) *
|
|
|
|
CONFIG_CDCACM_EPINTIN_SSSIZE);
|
|
|
|
epcompdesc->wbytes[1] = MSBYTE((epcompdesc->mxburst + 1) *
|
|
|
|
CONFIG_CDCACM_EPINTIN_SSSIZE);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CDCACM_EPBULKOUT: /* Bulk OUT endpoint */
|
|
|
|
{
|
|
|
|
epcompdesc->len = USB_SIZEOF_SS_EPCOMPDESC; /* Descriptor length */
|
|
|
|
epcompdesc->type = USB_DESC_TYPE_ENDPOINT_COMPANION; /* Descriptor type */
|
|
|
|
|
|
|
|
if (CONFIG_CDCACM_EPBULKOUT_MAXBURST >= USB_SS_BULK_EP_MAXBURST)
|
|
|
|
{
|
|
|
|
epcompdesc->mxburst = USB_SS_BULK_EP_MAXBURST - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
epcompdesc->mxburst = CONFIG_CDCACM_EPBULKOUT_MAXBURST;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CONFIG_CDCACM_EPBULKOUT_MAXSTREAM > USB_SS_BULK_EP_MAXSTREAM)
|
|
|
|
{
|
|
|
|
epcompdesc->attr = USB_SS_BULK_EP_MAXSTREAM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
epcompdesc->attr = CONFIG_CDCACM_EPBULKOUT_MAXSTREAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
epcompdesc->wbytes[0] = 0;
|
|
|
|
epcompdesc->wbytes[1] = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CDCACM_EPBULKIN: /* Bulk IN endpoint */
|
|
|
|
{
|
|
|
|
epcompdesc->len = USB_SIZEOF_SS_EPCOMPDESC; /* Descriptor length */
|
|
|
|
epcompdesc->type = USB_DESC_TYPE_ENDPOINT_COMPANION; /* Descriptor type */
|
|
|
|
|
|
|
|
if (CONFIG_CDCACM_EPBULKIN_MAXBURST >= USB_SS_BULK_EP_MAXBURST)
|
|
|
|
{
|
|
|
|
epcompdesc->mxburst = USB_SS_BULK_EP_MAXBURST - 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
epcompdesc->mxburst = CONFIG_CDCACM_EPBULKIN_MAXBURST;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CONFIG_CDCACM_EPBULKIN_MAXSTREAM > USB_SS_BULK_EP_MAXSTREAM)
|
|
|
|
{
|
|
|
|
epcompdesc->attr = USB_SS_BULK_EP_MAXSTREAM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
epcompdesc->attr = CONFIG_CDCACM_EPBULKIN_MAXSTREAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
epcompdesc->wbytes[0] = 0;
|
|
|
|
epcompdesc->wbytes[1] = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-09-27 22:11:14 +02:00
|
|
|
/****************************************************************************
|
2017-07-16 16:43:17 +02:00
|
|
|
* Name: cdcacm_copy_epdesc
|
2011-09-27 22:11:14 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2017-07-16 16:43:17 +02:00
|
|
|
* Copies the requested Endpoint Description into the buffer given.
|
|
|
|
* Returns the number of Bytes filled in (sizeof(struct usb_epdesc_s)).
|
2011-09-27 22:11:14 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
int cdcacm_copy_epdesc(enum cdcacm_epdesc_e epid,
|
|
|
|
FAR struct usb_epdesc_s *epdesc,
|
2017-07-20 17:34:48 +02:00
|
|
|
FAR struct usbdev_devinfo_s *devinfo,
|
2024-07-02 08:36:49 +02:00
|
|
|
uint8_t speed)
|
2011-09-27 22:11:14 +02:00
|
|
|
{
|
2024-07-03 09:21:39 +02:00
|
|
|
int len = sizeof(struct usb_epdesc_s);
|
|
|
|
|
2024-07-02 08:36:49 +02:00
|
|
|
#if !defined(CONFIG_USBDEV_DUALSPEED) && !defined(CONFIG_USBDEV_SUPERSPEED)
|
|
|
|
UNUSED(speed);
|
2017-07-16 16:43:17 +02:00
|
|
|
#endif
|
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
#ifdef CONFIG_USBDEV_SUPERSPEED
|
|
|
|
if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
|
|
|
|
{
|
|
|
|
len += sizeof(struct usb_ss_epcompdesc_s);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (epdesc == NULL)
|
|
|
|
{
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (epid)
|
2011-09-27 22:11:14 +02:00
|
|
|
{
|
2017-07-16 16:43:17 +02:00
|
|
|
case CDCACM_EPINTIN: /* Interrupt IN endpoint */
|
2024-07-03 09:21:39 +02:00
|
|
|
{
|
|
|
|
epdesc->len = USB_SIZEOF_EPDESC; /* Descriptor length */
|
|
|
|
epdesc->type = USB_DESC_TYPE_ENDPOINT; /* Descriptor type */
|
|
|
|
epdesc->addr = CDCACM_MKEPINTIN(devinfo); /* Endpoint address */
|
|
|
|
epdesc->attr = CDCACM_EPINTIN_ATTR; /* Endpoint attributes */
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2024-07-02 08:36:49 +02:00
|
|
|
#ifdef CONFIG_USBDEV_SUPERSPEED
|
2024-07-03 09:21:39 +02:00
|
|
|
if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
|
|
|
|
{
|
|
|
|
/* Maximum packet size (super speed) */
|
|
|
|
|
|
|
|
epdesc->mxpacketsize[0] = LSBYTE(CONFIG_CDCACM_EPINTIN_SSSIZE);
|
|
|
|
epdesc->mxpacketsize[1] = MSBYTE(CONFIG_CDCACM_EPINTIN_SSSIZE);
|
|
|
|
|
|
|
|
/* Copy endpoint companion description */
|
|
|
|
|
|
|
|
epdesc++;
|
|
|
|
cdcacm_copy_epcompdesc(epid,
|
|
|
|
(FAR struct usb_ss_epcompdesc_s *)epdesc);
|
|
|
|
}
|
|
|
|
else
|
2024-07-02 08:36:49 +02:00
|
|
|
#endif
|
2017-07-16 16:43:17 +02:00
|
|
|
#ifdef CONFIG_USBDEV_DUALSPEED
|
2024-07-03 09:21:39 +02:00
|
|
|
if (speed == USB_SPEED_HIGH)
|
|
|
|
{
|
|
|
|
/* Maximum packet size (high speed) */
|
|
|
|
|
|
|
|
epdesc->mxpacketsize[0] = LSBYTE(CONFIG_CDCACM_EPINTIN_HSSIZE);
|
|
|
|
epdesc->mxpacketsize[1] = MSBYTE(CONFIG_CDCACM_EPINTIN_HSSIZE);
|
|
|
|
}
|
|
|
|
else
|
2017-07-16 16:43:17 +02:00
|
|
|
#endif
|
2024-07-03 09:21:39 +02:00
|
|
|
{
|
|
|
|
/* Maximum packet size (full speed) */
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
epdesc->mxpacketsize[0] = LSBYTE(CONFIG_CDCACM_EPINTIN_FSSIZE);
|
|
|
|
epdesc->mxpacketsize[1] = MSBYTE(CONFIG_CDCACM_EPINTIN_FSSIZE);
|
|
|
|
}
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
epdesc->interval = 10; /* Interval */
|
2017-07-19 17:00:01 +02:00
|
|
|
}
|
|
|
|
break;
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
case CDCACM_EPBULKOUT: /* Bulk OUT endpoint */
|
2017-07-19 17:00:01 +02:00
|
|
|
{
|
2024-07-03 09:21:39 +02:00
|
|
|
epdesc->len = USB_SIZEOF_EPDESC; /* Descriptor length */
|
2017-07-19 17:00:01 +02:00
|
|
|
epdesc->type = USB_DESC_TYPE_ENDPOINT; /* Descriptor type */
|
2017-07-20 17:34:48 +02:00
|
|
|
epdesc->addr = CDCACM_MKEPBULKOUT(devinfo); /* Endpoint address */
|
2017-07-19 17:00:01 +02:00
|
|
|
epdesc->attr = CDCACM_EPOUTBULK_ATTR; /* Endpoint attributes */
|
2024-07-02 08:36:49 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_USBDEV_SUPERSPEED
|
|
|
|
if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
|
|
|
|
{
|
|
|
|
/* Maximum packet size (super speed) */
|
|
|
|
|
|
|
|
epdesc->mxpacketsize[0] = LSBYTE(CONFIG_CDCACM_EPBULKOUT_SSSIZE);
|
|
|
|
epdesc->mxpacketsize[1] = MSBYTE(CONFIG_CDCACM_EPBULKOUT_SSSIZE);
|
2024-07-03 09:21:39 +02:00
|
|
|
|
|
|
|
/* Copy endpoint companion description */
|
|
|
|
|
|
|
|
epdesc++;
|
|
|
|
cdcacm_copy_epcompdesc(epid,
|
|
|
|
(FAR struct usb_ss_epcompdesc_s *)epdesc);
|
2024-07-02 08:36:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
2017-07-16 16:43:17 +02:00
|
|
|
#ifdef CONFIG_USBDEV_DUALSPEED
|
2024-07-02 08:36:49 +02:00
|
|
|
if (speed == USB_SPEED_HIGH)
|
2017-07-19 17:00:01 +02:00
|
|
|
{
|
|
|
|
/* Maximum packet size (high speed) */
|
|
|
|
|
|
|
|
epdesc->mxpacketsize[0] = LSBYTE(CONFIG_CDCACM_EPBULKOUT_HSSIZE);
|
|
|
|
epdesc->mxpacketsize[1] = MSBYTE(CONFIG_CDCACM_EPBULKOUT_HSSIZE);
|
|
|
|
}
|
|
|
|
else
|
2017-07-16 16:43:17 +02:00
|
|
|
#endif
|
2017-07-19 17:00:01 +02:00
|
|
|
{
|
|
|
|
/* Maximum packet size (full speed) */
|
2017-07-16 16:43:17 +02:00
|
|
|
|
2017-07-19 17:00:01 +02:00
|
|
|
epdesc->mxpacketsize[0] = LSBYTE(CONFIG_CDCACM_EPBULKOUT_FSSIZE);
|
|
|
|
epdesc->mxpacketsize[1] = MSBYTE(CONFIG_CDCACM_EPBULKOUT_FSSIZE);
|
|
|
|
}
|
2017-07-16 16:43:17 +02:00
|
|
|
|
2017-07-19 17:00:01 +02:00
|
|
|
epdesc->interval = 1; /* Interval */
|
|
|
|
}
|
|
|
|
break;
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
case CDCACM_EPBULKIN: /* Bulk IN endpoint */
|
2017-07-19 17:00:01 +02:00
|
|
|
{
|
|
|
|
epdesc->len = USB_SIZEOF_EPDESC; /* Descriptor length */
|
|
|
|
epdesc->type = USB_DESC_TYPE_ENDPOINT; /* Descriptor type */
|
2017-07-20 17:34:48 +02:00
|
|
|
epdesc->addr = CDCACM_MKEPBULKIN(devinfo); /* Endpoint address */
|
2017-07-19 17:00:01 +02:00
|
|
|
epdesc->attr = CDCACM_EPINBULK_ATTR; /* Endpoint attributes */
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2024-07-02 08:36:49 +02:00
|
|
|
#ifdef CONFIG_USBDEV_SUPERSPEED
|
|
|
|
if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
|
|
|
|
{
|
|
|
|
/* Maximum packet size (super speed) */
|
|
|
|
|
|
|
|
epdesc->mxpacketsize[0] = LSBYTE(CONFIG_CDCACM_EPBULKIN_SSSIZE);
|
|
|
|
epdesc->mxpacketsize[1] = MSBYTE(CONFIG_CDCACM_EPBULKIN_SSSIZE);
|
2024-07-03 09:21:39 +02:00
|
|
|
|
|
|
|
/* Copy endpoint companion description */
|
|
|
|
|
|
|
|
epdesc++;
|
|
|
|
cdcacm_copy_epcompdesc(epid,
|
|
|
|
(FAR struct usb_ss_epcompdesc_s *)epdesc);
|
2024-07-02 08:36:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
2011-09-27 22:11:14 +02:00
|
|
|
#ifdef CONFIG_USBDEV_DUALSPEED
|
2024-07-02 08:36:49 +02:00
|
|
|
if (speed == USB_SPEED_HIGH)
|
2017-07-19 17:00:01 +02:00
|
|
|
{
|
|
|
|
/* Maximum packet size (high speed) */
|
|
|
|
|
|
|
|
epdesc->mxpacketsize[0] = LSBYTE(CONFIG_CDCACM_EPBULKIN_HSSIZE);
|
|
|
|
epdesc->mxpacketsize[1] = MSBYTE(CONFIG_CDCACM_EPBULKIN_HSSIZE);
|
|
|
|
}
|
|
|
|
else
|
2017-07-16 16:43:17 +02:00
|
|
|
#endif
|
2017-07-19 17:00:01 +02:00
|
|
|
{
|
|
|
|
/* Maximum packet size (full speed) */
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2017-07-19 17:00:01 +02:00
|
|
|
epdesc->mxpacketsize[0] = LSBYTE(CONFIG_CDCACM_EPBULKIN_FSSIZE);
|
|
|
|
epdesc->mxpacketsize[1] = MSBYTE(CONFIG_CDCACM_EPBULKIN_FSSIZE);
|
|
|
|
}
|
2017-07-16 16:43:17 +02:00
|
|
|
|
2017-07-19 17:00:01 +02:00
|
|
|
epdesc->interval = 1; /* Interval */
|
|
|
|
}
|
|
|
|
break;
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
default:
|
2017-07-19 17:00:01 +02:00
|
|
|
return 0;
|
2017-07-16 16:43:17 +02:00
|
|
|
}
|
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
return len;
|
2011-09-27 22:11:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2012-01-26 00:04:17 +01:00
|
|
|
* Name: cdcacm_mkcfgdesc
|
2011-09-27 22:11:14 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Construct the configuration descriptor
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
int16_t cdcacm_mkcfgdesc(FAR uint8_t *buf,
|
2017-07-20 17:34:48 +02:00
|
|
|
FAR struct usbdev_devinfo_s *devinfo,
|
2017-07-16 16:43:17 +02:00
|
|
|
uint8_t speed, uint8_t type)
|
2011-09-27 22:11:14 +02:00
|
|
|
{
|
2017-07-16 16:43:17 +02:00
|
|
|
int length = 0;
|
2024-07-03 09:21:39 +02:00
|
|
|
int ret;
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2024-07-02 08:36:49 +02:00
|
|
|
if (type == USB_DESC_TYPE_OTHERSPEEDCONFIG && speed < USB_SPEED_SUPER)
|
2011-09-27 22:11:14 +02:00
|
|
|
{
|
2024-07-02 08:36:49 +02:00
|
|
|
speed = speed == USB_SPEED_HIGH ? USB_SPEED_FULL : USB_SPEED_HIGH;
|
2011-09-27 22:11:14 +02:00
|
|
|
}
|
|
|
|
|
2017-07-19 17:00:01 +02:00
|
|
|
/* Fill in all descriptors directly to the buf */
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
/* Configuration Descriptor. If the serial device is used in as part
|
|
|
|
* or a composite device, then the configuration descriptor is
|
|
|
|
* provided by the composite device logic.
|
|
|
|
*/
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
#if !defined(CONFIG_CDCACM_COMPOSITE)
|
|
|
|
if (buf != NULL)
|
2011-09-27 22:11:14 +02:00
|
|
|
{
|
2021-03-04 08:02:21 +01:00
|
|
|
/* Configuration descriptor.
|
|
|
|
* If the USB serial device is configured as part of composite device,
|
|
|
|
* then the configuration descriptor will be provided by the
|
2017-07-16 16:43:17 +02:00
|
|
|
* composite device logic.
|
2011-09-27 22:11:14 +02:00
|
|
|
*/
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
FAR struct usb_cfgdesc_s *dest = (FAR struct usb_cfgdesc_s *)buf;
|
|
|
|
|
|
|
|
/* Let's calculate the size... */
|
|
|
|
|
|
|
|
int16_t size = cdcacm_mkcfgdesc(NULL, NULL, speed, type);
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
dest->len = USB_SIZEOF_CFGDESC; /* Descriptor length */
|
2020-01-10 16:06:36 +01:00
|
|
|
dest->type = type; /* Descriptor type */
|
2017-07-16 16:43:17 +02:00
|
|
|
dest->totallen[0] = LSBYTE(size); /* LS Total length */
|
|
|
|
dest->totallen[1] = MSBYTE(size); /* MS Total length */
|
|
|
|
dest->ninterfaces = CDCACM_NINTERFACES; /* Number of interfaces */
|
|
|
|
dest->cfgvalue = CDCACM_CONFIGID; /* Configuration value */
|
|
|
|
dest->icfg = CDCACM_CONFIGSTRID; /* Configuration */
|
|
|
|
dest->attr = USB_CONFIG_ATTR_ONE | /* Attributes */
|
|
|
|
CDCACM_SELFPOWERED |
|
|
|
|
CDCACM_REMOTEWAKEUP;
|
|
|
|
dest->mxpower = (CONFIG_USBDEV_MAXPOWER + 1) / 2; /* Max power (mA/2) */
|
|
|
|
|
|
|
|
buf += sizeof(struct usb_cfgdesc_s);
|
|
|
|
}
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
length += sizeof(struct usb_cfgdesc_s);
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
/* If the serial device is part of a composite device, then it should
|
|
|
|
* begin with an interface association descriptor (IAD) because the
|
|
|
|
* CDC/ACM device consists of more than one interface. The IAD associates
|
|
|
|
* the two CDC/ACM interfaces with the same CDC/ACM device.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#elif defined(CONFIG_COMPOSITE_IAD)
|
|
|
|
/* Interface association descriptor */
|
|
|
|
|
|
|
|
if (buf != NULL)
|
|
|
|
{
|
|
|
|
FAR struct usb_iaddesc_s *dest = (FAR struct usb_iaddesc_s *)buf;
|
|
|
|
|
|
|
|
dest->len = USB_SIZEOF_IADDESC; /* Descriptor length */
|
|
|
|
dest->type = USB_DESC_TYPE_INTERFACEASSOCIATION; /* Descriptor type */
|
2017-07-20 17:34:48 +02:00
|
|
|
dest->firstif = devinfo->ifnobase; /* Number of first interface of the function */
|
|
|
|
dest->nifs = devinfo->ninterfaces; /* Number of interfaces associated with the function */
|
2017-07-16 16:43:17 +02:00
|
|
|
dest->classid = USB_CLASS_CDC; /* Class code */
|
|
|
|
dest->subclass = CDC_SUBCLASS_ACM; /* Sub-class code */
|
|
|
|
dest->protocol = CDC_PROTO_NONE; /* Protocol code */
|
|
|
|
dest->ifunction = 0; /* Index to string identifying the function */
|
|
|
|
|
|
|
|
buf += sizeof(struct usb_iaddesc_s);
|
2011-09-27 22:11:14 +02:00
|
|
|
}
|
2017-07-20 18:27:34 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
length += sizeof(struct usb_iaddesc_s);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Notification interface */
|
2011-09-27 22:11:14 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
if (buf != NULL)
|
|
|
|
{
|
|
|
|
FAR struct usb_ifdesc_s *dest = (FAR struct usb_ifdesc_s *)buf;
|
|
|
|
|
|
|
|
dest->len = USB_SIZEOF_IFDESC; /* Descriptor length */
|
|
|
|
dest->type = USB_DESC_TYPE_INTERFACE; /* Descriptor type */
|
2017-07-20 17:34:48 +02:00
|
|
|
dest->ifno = devinfo->ifnobase; /* Interface number */
|
2017-07-16 16:43:17 +02:00
|
|
|
dest->alt = CDCACM_NOTALTIFID; /* Alternate setting */
|
|
|
|
dest->neps = 1; /* Number of endpoints */
|
|
|
|
dest->classid = USB_CLASS_CDC; /* Interface class */
|
|
|
|
dest->subclass = CDC_SUBCLASS_ACM; /* Interface sub-class */
|
|
|
|
dest->protocol = CDC_PROTO_ATM; /* Interface protocol */
|
|
|
|
#ifdef CONFIG_CDCACM_NOTIFSTR
|
2017-07-20 17:34:48 +02:00
|
|
|
dest->iif = devinfo->strbase + CDCACM_NOTIFSTRID; /* iInterface */
|
2017-07-16 16:43:17 +02:00
|
|
|
#else
|
|
|
|
dest->iif = 0; /* iInterface */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
buf += sizeof(struct usb_ifdesc_s);
|
|
|
|
}
|
|
|
|
|
|
|
|
length += sizeof(struct usb_ifdesc_s);
|
|
|
|
|
|
|
|
/* Header functional descriptor */
|
|
|
|
|
|
|
|
if (buf != NULL)
|
|
|
|
{
|
2021-03-04 08:02:21 +01:00
|
|
|
FAR struct cdc_hdr_funcdesc_s *dest =
|
|
|
|
(FAR struct cdc_hdr_funcdesc_s *)buf;
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
dest->size = SIZEOF_HDR_FUNCDESC; /* Descriptor length */
|
|
|
|
dest->type = USB_DESC_TYPE_CSINTERFACE; /* Descriptor type */
|
|
|
|
dest->subtype = CDC_DSUBTYPE_HDR; /* Descriptor sub-type */
|
|
|
|
dest->cdc[0] = LSBYTE(CDC_VERSIONNO); /* CDC release number in BCD */
|
|
|
|
dest->cdc[1] = MSBYTE(CDC_VERSIONNO);
|
|
|
|
|
|
|
|
buf += sizeof(struct cdc_hdr_funcdesc_s);
|
|
|
|
}
|
|
|
|
|
|
|
|
length += sizeof(struct cdc_hdr_funcdesc_s);
|
|
|
|
|
|
|
|
/* ACM functional descriptor */
|
|
|
|
|
|
|
|
if (buf != NULL)
|
|
|
|
{
|
2021-03-04 08:02:21 +01:00
|
|
|
FAR struct cdc_acm_funcdesc_s *dest =
|
|
|
|
(FAR struct cdc_acm_funcdesc_s *)buf;
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
dest->size = SIZEOF_ACM_FUNCDESC; /* Descriptor length */
|
|
|
|
dest->type = USB_DESC_TYPE_CSINTERFACE; /* Descriptor type */
|
|
|
|
dest->subtype = CDC_DSUBTYPE_ACM; /* Descriptor sub-type */
|
|
|
|
dest->caps = 0x06; /* Bit encoded capabilities */
|
|
|
|
|
|
|
|
buf += sizeof(struct cdc_acm_funcdesc_s);
|
|
|
|
}
|
|
|
|
|
|
|
|
length += sizeof(struct cdc_acm_funcdesc_s);
|
|
|
|
|
|
|
|
/* This codeblock is just for future use - currently we didn't need it */
|
|
|
|
|
|
|
|
#ifdef OPTIONAL_UNION_FUNCTIONAL_DESCRIPTOR
|
|
|
|
/* Union functional descriptor */
|
2017-07-20 18:27:34 +02:00
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
if (buf != NULL)
|
|
|
|
{
|
2021-03-04 08:02:21 +01:00
|
|
|
FAR struct cdc_union_funcdesc_s *dest =
|
|
|
|
(FAR struct cdc_union_funcdesc_s *)buf;
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
dest->size = SIZEOF_UNION_FUNCDESC(1); /* Descriptor length */
|
|
|
|
dest->type = USB_DESC_TYPE_CSINTERFACE; /* Descriptor type */
|
|
|
|
dest->subtype = CDC_DSUBTYPE_UNION; /* Descriptor sub-type */
|
2017-07-20 17:34:48 +02:00
|
|
|
dest->master = devinfo->ifnobase; /* Master interface number */
|
|
|
|
dest->slave[0] = devinfo->ifnobase + 1; /* Slave[0] interface number */
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
buf += sizeof(struct cdc_union_funcdesc_s);
|
|
|
|
}
|
|
|
|
|
|
|
|
length += sizeof(struct cdc_union_funcdesc_s);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Call Management functional descriptor */
|
|
|
|
|
|
|
|
if (buf != NULL)
|
|
|
|
{
|
2020-01-10 16:06:36 +01:00
|
|
|
FAR struct cdc_callmgmt_funcdesc_s *dest =
|
|
|
|
(FAR struct cdc_callmgmt_funcdesc_s *)buf;
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
dest->size = SIZEOF_CALLMGMT_FUNCDESC; /* Descriptor length */
|
|
|
|
dest->type = USB_DESC_TYPE_CSINTERFACE; /* Descriptor type */
|
|
|
|
dest->subtype = CDC_DSUBTYPE_CALLMGMT; /* Descriptor sub-type */
|
|
|
|
dest->caps = 3; /* Bit encoded capabilities */
|
2017-07-20 17:34:48 +02:00
|
|
|
dest->ifno = devinfo->ifnobase + 1; /* Interface number of Data Class interface */
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
buf += sizeof(struct cdc_callmgmt_funcdesc_s);
|
|
|
|
}
|
|
|
|
|
|
|
|
length += sizeof(struct cdc_callmgmt_funcdesc_s);
|
|
|
|
|
|
|
|
/* Interrupt IN endpoint descriptor */
|
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
ret = cdcacm_copy_epdesc(CDCACM_EPINTIN,
|
|
|
|
(FAR struct usb_epdesc_s *)buf,
|
|
|
|
devinfo,
|
|
|
|
speed);
|
2017-07-16 16:43:17 +02:00
|
|
|
if (buf != NULL)
|
|
|
|
{
|
2024-07-03 09:21:39 +02:00
|
|
|
buf += ret;
|
2017-07-16 16:43:17 +02:00
|
|
|
}
|
2017-07-20 18:27:34 +02:00
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
length += ret;
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
/* Data interface descriptor */
|
|
|
|
|
|
|
|
if (buf != NULL)
|
|
|
|
{
|
|
|
|
FAR struct usb_ifdesc_s *dest = (FAR struct usb_ifdesc_s *)buf;
|
|
|
|
|
|
|
|
dest->len = USB_SIZEOF_IFDESC; /* Descriptor length */
|
|
|
|
dest->type = USB_DESC_TYPE_INTERFACE; /* Descriptor type */
|
2017-07-20 17:34:48 +02:00
|
|
|
dest->ifno = devinfo->ifnobase + 1; /* Interface number */
|
2017-07-16 16:43:17 +02:00
|
|
|
dest->alt = CDCACM_DATAALTIFID; /* Alternate setting */
|
|
|
|
dest->neps = 2; /* Number of endpoints */
|
|
|
|
dest->classid = USB_CLASS_CDC_DATA; /* Interface class */
|
|
|
|
dest->subclass = CDC_DATA_SUBCLASS_NONE; /* Interface sub-class */
|
|
|
|
dest->protocol = CDC_DATA_PROTO_NONE; /* Interface protocol */
|
|
|
|
#ifdef CONFIG_CDCACM_DATAIFSTR
|
2017-07-20 17:34:48 +02:00
|
|
|
dest->iif = devinfo->strbase + CDCACM_DATAIFSTRID; /* iInterface */
|
2017-07-16 16:43:17 +02:00
|
|
|
#else
|
|
|
|
dest->iif = 0; /* iInterface */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
buf += sizeof(struct usb_ifdesc_s);
|
|
|
|
}
|
|
|
|
|
|
|
|
length += sizeof(struct usb_ifdesc_s);
|
|
|
|
|
|
|
|
/* Bulk OUT endpoint descriptor */
|
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
ret = cdcacm_copy_epdesc(CDCACM_EPBULKOUT,
|
|
|
|
(FAR struct usb_epdesc_s *)buf,
|
|
|
|
devinfo,
|
|
|
|
speed);
|
2017-07-16 16:43:17 +02:00
|
|
|
if (buf != NULL)
|
|
|
|
{
|
2024-07-03 09:21:39 +02:00
|
|
|
buf += ret;
|
2017-07-16 16:43:17 +02:00
|
|
|
}
|
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
length += ret;
|
2017-07-16 16:43:17 +02:00
|
|
|
|
|
|
|
/* Bulk IN endpoint descriptor */
|
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
ret = cdcacm_copy_epdesc(CDCACM_EPBULKIN,
|
|
|
|
(FAR struct usb_epdesc_s *)buf,
|
|
|
|
devinfo,
|
|
|
|
speed);
|
2017-07-16 16:43:17 +02:00
|
|
|
if (buf != NULL)
|
|
|
|
{
|
2024-07-03 09:21:39 +02:00
|
|
|
buf += ret;
|
2017-07-16 16:43:17 +02:00
|
|
|
}
|
|
|
|
|
2024-07-03 09:21:39 +02:00
|
|
|
length += ret;
|
|
|
|
|
2017-07-16 16:43:17 +02:00
|
|
|
return length;
|
2011-09-27 22:11:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2012-01-26 00:04:17 +01:00
|
|
|
* Name: cdcacm_getqualdesc
|
2011-09-27 22:11:14 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return a pointer to the raw qual descriptor
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-01-26 00:04:17 +01:00
|
|
|
#if !defined(CONFIG_CDCACM_COMPOSITE) && defined(CONFIG_USBDEV_DUALSPEED)
|
|
|
|
FAR const struct usb_qualdesc_s *cdcacm_getqualdesc(void)
|
2011-09-27 22:11:14 +02:00
|
|
|
{
|
|
|
|
return &g_qualdesc;
|
|
|
|
}
|
|
|
|
#endif
|