SAMV71-Xult Composite: Now can switch between two different composite configurations dynamically.
This commit is contained in:
parent
815257743d
commit
e4d262436c
@ -86,12 +86,10 @@ FAR void *board_composite_connect(int port, int configid)
|
|||||||
/* Here we are composing the configuration of the usb composite device.
|
/* 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.
|
* 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];
|
struct composite_devdesc_s dev[2];
|
||||||
int ifnobase = 0;
|
int ifnobase = 0;
|
||||||
int strbase = COMPOSITE_NSTRIDS;
|
int strbase = COMPOSITE_NSTRIDS;
|
||||||
@ -163,18 +161,18 @@ FAR void *board_composite_connect(int port, int configid)
|
|||||||
strbase += dev[1].devdesc.nstrings;
|
strbase += dev[1].devdesc.nstrings;
|
||||||
|
|
||||||
return composite_initialize(2, dev);
|
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
|
* 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
|
* 10 Endpoints (EPs). The EPs 0 up to 7 are DMA aware. The EPs 8 and 9
|
||||||
* and 9 are not.
|
* are not.
|
||||||
*
|
*
|
||||||
* In a composite device we need the EP0 as an control Endpoint.
|
* In a composite device we need the EP0 as an control Endpoint. Each
|
||||||
* Each CDC/ACM needs one Interrupt driven and two bulk Endpoints.
|
* CDC/ACM needs one Interrupt driven and two bulk Endpoints. This is
|
||||||
* This is why we configure the EPs 7, 8 and 9 to be the IRQ-EPs
|
* why we configure the EPs 7, 8 and 9 to be the IRQ-EPs and the
|
||||||
* and the EP-Pairs 1/2, 3/4, 5/6 to be the bulk EPs for each
|
* EP-Pairs 1/2, 3/4, 5/6 to be the bulk EPs for each device.
|
||||||
* device.
|
|
||||||
*
|
*
|
||||||
* This means, that
|
* This means, that
|
||||||
*
|
*
|
||||||
@ -186,7 +184,9 @@ FAR void *board_composite_connect(int port, int configid)
|
|||||||
* as its EP-Configuration.
|
* 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 strbase = COMPOSITE_NSTRIDS;
|
||||||
int ifnobase = 0;
|
int ifnobase = 0;
|
||||||
int ia;
|
int ia;
|
||||||
@ -224,7 +224,11 @@ FAR void *board_composite_connect(int port, int configid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return composite_initialize(3, dev);
|
return composite_initialize(3, dev);
|
||||||
#endif
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_BOARDCTL_USBDEVCTRL && CONFIG_USBDEV_COMPOSITE */
|
#endif /* CONFIG_BOARDCTL_USBDEVCTRL && CONFIG_USBDEV_COMPOSITE */
|
||||||
|
Loading…
Reference in New Issue
Block a user