mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
cdcacm: config to enable or disable interrupt endpoint
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
This commit is contained in:
@@ -446,9 +446,17 @@ config CDCACM_CONSOLE
|
|||||||
Register the USB device as /dev/console so that is will be used
|
Register the USB device as /dev/console so that is will be used
|
||||||
as the console device.
|
as the console device.
|
||||||
|
|
||||||
|
config CDCACM_HAVE_EPINTIN
|
||||||
|
bool "CDC/ACM have interrupt IN endpoint"
|
||||||
|
default y
|
||||||
|
---help---
|
||||||
|
Using the interrupt endpoint as notification element to transmit
|
||||||
|
asynchronous event information from device to host.
|
||||||
|
|
||||||
config CDCACM_IFLOWCONTROL
|
config CDCACM_IFLOWCONTROL
|
||||||
bool "CDC/ACM RTS flow control"
|
bool "CDC/ACM RTS flow control"
|
||||||
default n
|
default n
|
||||||
|
depends on CDCACM_HAVE_EPINTIN
|
||||||
select SERIAL_IFLOWCONTROL
|
select SERIAL_IFLOWCONTROL
|
||||||
---help---
|
---help---
|
||||||
Enable CDC/ACM RTS flow control
|
Enable CDC/ACM RTS flow control
|
||||||
|
|||||||
@@ -753,7 +753,9 @@ static void cdcacm_resetconfig(FAR struct cdcacm_dev_s *priv)
|
|||||||
* transfers.
|
* transfers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_CDCACM_HAVE_EPINTIN
|
||||||
EP_DISABLE(priv->epintin);
|
EP_DISABLE(priv->epintin);
|
||||||
|
#endif
|
||||||
EP_DISABLE(priv->epbulkin);
|
EP_DISABLE(priv->epbulkin);
|
||||||
EP_DISABLE(priv->epbulkout);
|
EP_DISABLE(priv->epbulkout);
|
||||||
}
|
}
|
||||||
@@ -828,6 +830,7 @@ static int cdcacm_setconfig(FAR struct cdcacm_dev_s *priv, uint8_t config)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_CDCACM_HAVE_EPINTIN
|
||||||
/* Configure the IN interrupt endpoint */
|
/* Configure the IN interrupt endpoint */
|
||||||
|
|
||||||
ret = cdcacm_epconfigure(priv->epintin, CDCACM_EPINTIN, false,
|
ret = cdcacm_epconfigure(priv->epintin, CDCACM_EPINTIN, false,
|
||||||
@@ -840,6 +843,7 @@ static int cdcacm_setconfig(FAR struct cdcacm_dev_s *priv, uint8_t config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
priv->epintin->priv = priv;
|
priv->epintin->priv = priv;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Configure the IN bulk endpoint */
|
/* Configure the IN bulk endpoint */
|
||||||
|
|
||||||
@@ -1121,6 +1125,7 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver,
|
|||||||
* logic where kmm_malloc calls will fail.
|
* logic where kmm_malloc calls will fail.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_CDCACM_HAVE_EPINTIN
|
||||||
/* Pre-allocate the IN interrupt endpoint */
|
/* Pre-allocate the IN interrupt endpoint */
|
||||||
|
|
||||||
priv->epintin = DEV_ALLOCEP(dev, CDCACM_MKEPINTIN(&priv->devinfo),
|
priv->epintin = DEV_ALLOCEP(dev, CDCACM_MKEPINTIN(&priv->devinfo),
|
||||||
@@ -1133,6 +1138,7 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
priv->epintin->priv = priv;
|
priv->epintin->priv = priv;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Pre-allocate the IN bulk endpoint */
|
/* Pre-allocate the IN bulk endpoint */
|
||||||
|
|
||||||
@@ -1390,6 +1396,7 @@ static void cdcacm_unbind(FAR struct usbdevclass_driver_s *driver,
|
|||||||
DEBUGASSERT(priv->nwrq == 0);
|
DEBUGASSERT(priv->nwrq == 0);
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
|
#ifdef CONFIG_CDCACM_HAVE_EPINTIN
|
||||||
/* Free the interrupt IN endpoint */
|
/* Free the interrupt IN endpoint */
|
||||||
|
|
||||||
if (priv->epintin)
|
if (priv->epintin)
|
||||||
@@ -1397,6 +1404,7 @@ static void cdcacm_unbind(FAR struct usbdevclass_driver_s *driver,
|
|||||||
DEV_FREEEP(dev, priv->epintin);
|
DEV_FREEEP(dev, priv->epintin);
|
||||||
priv->epintin = NULL;
|
priv->epintin = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Free the bulk OUT endpoint */
|
/* Free the bulk OUT endpoint */
|
||||||
|
|
||||||
|
|||||||
@@ -231,6 +231,7 @@ cdcacm_copy_epcompdesc(enum cdcacm_epdesc_e epid,
|
|||||||
{
|
{
|
||||||
switch (epid)
|
switch (epid)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_CDCACM_HAVE_EPINTIN
|
||||||
case CDCACM_EPINTIN: /* Interrupt IN endpoint */
|
case CDCACM_EPINTIN: /* Interrupt IN endpoint */
|
||||||
{
|
{
|
||||||
epcompdesc->len = USB_SIZEOF_SS_EPCOMPDESC; /* Descriptor length */
|
epcompdesc->len = USB_SIZEOF_SS_EPCOMPDESC; /* Descriptor length */
|
||||||
@@ -252,6 +253,7 @@ cdcacm_copy_epcompdesc(enum cdcacm_epdesc_e epid,
|
|||||||
CONFIG_CDCACM_EPINTIN_SSSIZE);
|
CONFIG_CDCACM_EPINTIN_SSSIZE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case CDCACM_EPBULKOUT: /* Bulk OUT endpoint */
|
case CDCACM_EPBULKOUT: /* Bulk OUT endpoint */
|
||||||
{
|
{
|
||||||
@@ -349,6 +351,7 @@ int cdcacm_copy_epdesc(enum cdcacm_epdesc_e epid,
|
|||||||
|
|
||||||
switch (epid)
|
switch (epid)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_CDCACM_HAVE_EPINTIN
|
||||||
case CDCACM_EPINTIN: /* Interrupt IN endpoint */
|
case CDCACM_EPINTIN: /* Interrupt IN endpoint */
|
||||||
{
|
{
|
||||||
epdesc->len = USB_SIZEOF_EPDESC; /* Descriptor length */
|
epdesc->len = USB_SIZEOF_EPDESC; /* Descriptor length */
|
||||||
@@ -392,6 +395,7 @@ int cdcacm_copy_epdesc(enum cdcacm_epdesc_e epid,
|
|||||||
epdesc->interval = 10; /* Interval */
|
epdesc->interval = 10; /* Interval */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case CDCACM_EPBULKOUT: /* Bulk OUT endpoint */
|
case CDCACM_EPBULKOUT: /* Bulk OUT endpoint */
|
||||||
{
|
{
|
||||||
@@ -585,7 +589,11 @@ int16_t cdcacm_mkcfgdesc(FAR uint8_t *buf,
|
|||||||
dest->type = USB_DESC_TYPE_INTERFACE; /* Descriptor type */
|
dest->type = USB_DESC_TYPE_INTERFACE; /* Descriptor type */
|
||||||
dest->ifno = devinfo->ifnobase; /* Interface number */
|
dest->ifno = devinfo->ifnobase; /* Interface number */
|
||||||
dest->alt = CDCACM_NOTALTIFID; /* Alternate setting */
|
dest->alt = CDCACM_NOTALTIFID; /* Alternate setting */
|
||||||
|
#ifdef CONFIG_CDCACM_HAVE_EPINTIN
|
||||||
dest->neps = 1; /* Number of endpoints */
|
dest->neps = 1; /* Number of endpoints */
|
||||||
|
#else
|
||||||
|
dest->neps = 0; /* Number of endpoints */
|
||||||
|
#endif
|
||||||
dest->classid = USB_CLASS_CDC; /* Interface class */
|
dest->classid = USB_CLASS_CDC; /* Interface class */
|
||||||
dest->subclass = CDC_SUBCLASS_ACM; /* Interface sub-class */
|
dest->subclass = CDC_SUBCLASS_ACM; /* Interface sub-class */
|
||||||
dest->protocol = CDC_PROTO_ATM; /* Interface protocol */
|
dest->protocol = CDC_PROTO_ATM; /* Interface protocol */
|
||||||
@@ -675,6 +683,7 @@ int16_t cdcacm_mkcfgdesc(FAR uint8_t *buf,
|
|||||||
|
|
||||||
length += sizeof(struct cdc_callmgmt_funcdesc_s);
|
length += sizeof(struct cdc_callmgmt_funcdesc_s);
|
||||||
|
|
||||||
|
#ifdef CONFIG_CDCACM_HAVE_EPINTIN
|
||||||
/* Interrupt IN endpoint descriptor */
|
/* Interrupt IN endpoint descriptor */
|
||||||
|
|
||||||
ret = cdcacm_copy_epdesc(CDCACM_EPINTIN,
|
ret = cdcacm_copy_epdesc(CDCACM_EPINTIN,
|
||||||
@@ -687,6 +696,7 @@ int16_t cdcacm_mkcfgdesc(FAR uint8_t *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
length += ret;
|
length += ret;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Data interface descriptor */
|
/* Data interface descriptor */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user