SAMV71-Xult Composite: Now can switch between two different composite configurations dynamically.

This commit is contained in:
Gregory Nutt 2017-06-02 07:19:27 -06:00
parent 815257743d
commit e4d262436c

View File

@ -86,12 +86,10 @@ FAR void *board_composite_connect(int port, int configid)
/* Here we are composing the configuration of the usb composite device.
*
* The standard is to use one CDC/ACM and one USB mass storage device.
*
* You will also find an example below which generates three CDC/ACM
* devices. This example can be used on samv71-xult.
*/
#if 1
if (configid == 0)
{
struct composite_devdesc_s dev[2];
int ifnobase = 0;
int strbase = COMPOSITE_NSTRIDS;
@ -163,18 +161,18 @@ FAR void *board_composite_connect(int port, int configid)
strbase += dev[1].devdesc.nstrings;
return composite_initialize(2, dev);
#else
/* Example with three CDC/ACMs
}
/* Configuration with three CDC/ACMs
*
* This Example can be used e.g. on a samv71-xult. The samv71 has
* 10 Endpoints (EPs). The EPs 0 up to 7 are DMA aware. The EPs 8
* and 9 are not.
* This configuration can be used e.g. on a samv71-xult. The samv71 has
* 10 Endpoints (EPs). The EPs 0 up to 7 are DMA aware. The EPs 8 and 9
* are not.
*
* In a composite device we need the EP0 as an control Endpoint.
* Each CDC/ACM needs one Interrupt driven and two bulk Endpoints.
* This is why we configure the EPs 7, 8 and 9 to be the IRQ-EPs
* and the EP-Pairs 1/2, 3/4, 5/6 to be the bulk EPs for each
* device.
* In a composite device we need the EP0 as an control Endpoint. Each
* CDC/ACM needs one Interrupt driven and two bulk Endpoints. This is
* why we configure the EPs 7, 8 and 9 to be the IRQ-EPs and the
* EP-Pairs 1/2, 3/4, 5/6 to be the bulk EPs for each device.
*
* This means, that
*
@ -186,7 +184,9 @@ FAR void *board_composite_connect(int port, int configid)
* as its EP-Configuration.
*/
struct composite_devdesc_struct dev[3];
else if (configid == 1)
{
struct composite_devdesc_s dev[3];
int strbase = COMPOSITE_NSTRIDS;
int ifnobase = 0;
int ia;
@ -224,7 +224,11 @@ FAR void *board_composite_connect(int port, int configid)
}
return composite_initialize(3, dev);
#endif
}
else
{
return NULL;
}
}
#endif /* CONFIG_BOARDCTL_USBDEVCTRL && CONFIG_USBDEV_COMPOSITE */