Re-structure USB descriptors
Use structures to define the USB descriptors of the sysmoOCTSIM device.
While at it, turn it from a pure CDC-ACM to a CDC-ACM + CCID interface,
so we can expose a virtual UART at the same time as the chip card reader
device.
Change-Id: I0423d733476f37c16bdb6abc651b7ad5ca7ac63e
diff --git a/sysmoOCTSIM/usb_start.c b/sysmoOCTSIM/usb_start.c
index d02edc0..83fac81 100644
--- a/sysmoOCTSIM/usb_start.c
+++ b/sysmoOCTSIM/usb_start.c
@@ -8,28 +8,7 @@
#include "atmel_start.h"
#include "usb_start.h"
-#if CONF_USBD_HS_SP
-static uint8_t single_desc_bytes[] = {
- /* Device descriptors and Configuration descriptors list. */
- CDCD_ACM_HS_DESCES_LS_FS};
-static uint8_t single_desc_bytes_hs[] = {
- /* Device descriptors and Configuration descriptors list. */
- CDCD_ACM_HS_DESCES_HS};
-#define CDCD_ECHO_BUF_SIZ CONF_USB_CDCD_ACM_DATA_BULKIN_MAXPKSZ_HS
-#else
-static uint8_t single_desc_bytes[] = {
- /* Device descriptors and Configuration descriptors list. */
- CDCD_ACM_DESCES_LS_FS};
#define CDCD_ECHO_BUF_SIZ CONF_USB_CDCD_ACM_DATA_BULKIN_MAXPKSZ
-#endif
-
-static struct usbd_descriptors single_desc[]
- = {{single_desc_bytes, single_desc_bytes + sizeof(single_desc_bytes)}
-#if CONF_USBD_HS_SP
- ,
- {single_desc_bytes_hs, single_desc_bytes_hs + sizeof(single_desc_bytes_hs)}
-#endif
-};
/** Buffers to receive and echo the communication bytes. */
static uint32_t usbd_cdc_buffer[CDCD_ECHO_BUF_SIZ / 4];
@@ -77,6 +56,8 @@
return false;
}
+extern const struct usbd_descriptors usb_descs[];
+
/**
* \brief CDC ACM Init
*/
@@ -88,7 +69,7 @@
/* usbdc_register_funcion inside */
cdcdf_acm_init();
- usbdc_start(single_desc);
+ usbdc_start((struct usbd_descriptors *) usb_descs);
usbdc_attach();
}