<p>Harald Welte has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13998">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Re-structure USB descriptors<br><br>Use structures to define the USB descriptors of the sysmoOCTSIM device.<br><br>While at it, turn it from a pure CDC-ACM to a CDC-ACM + CCID interface,<br>so we can expose a virtual UART at the same time as the chip card reader<br>device.<br><br>Change-Id: I0423d733476f37c16bdb6abc651b7ad5ca7ac63e<br>---<br>M sysmoOCTSIM/atmel_start.c<br>M sysmoOCTSIM/config/hpl_usb_config.h<br>M sysmoOCTSIM/gcc/Makefile<br>A sysmoOCTSIM/usb_descriptors.c<br>M sysmoOCTSIM/usb_start.c<br>5 files changed, 250 insertions(+), 25 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware refs/changes/98/13998/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/sysmoOCTSIM/atmel_start.c b/sysmoOCTSIM/atmel_start.c</span><br><span>index fd566dd..bee1ed2 100644</span><br><span>--- a/sysmoOCTSIM/atmel_start.c</span><br><span>+++ b/sysmoOCTSIM/atmel_start.c</span><br><span>@@ -12,8 +12,8 @@</span><br><span> void atmel_start_init(void)</span><br><span> {</span><br><span> system_init();</span><br><span style="color: hsl(0, 100%, 40%);">- usb_init();</span><br><span> dma_memory_init();</span><br><span> dma_memory_register_callback(DMA_MEMORY_COMPLETE_CB, M2M_DMA_complete_cb);</span><br><span> stdio_redirect_init();</span><br><span style="color: hsl(120, 100%, 40%);">+ usb_init();</span><br><span> }</span><br><span>diff --git a/sysmoOCTSIM/config/hpl_usb_config.h b/sysmoOCTSIM/config/hpl_usb_config.h</span><br><span>index 73a9fea..bbfd99d 100644</span><br><span>--- a/sysmoOCTSIM/config/hpl_usb_config.h</span><br><span>+++ b/sysmoOCTSIM/config/hpl_usb_config.h</span><br><span>@@ -39,7 +39,7 @@</span><br><span> // <CONF_USB_D_N_EP_MAX"> Max possible (by "Max Endpoint Number" config)</span><br><span> // <id> usbd_num_ep_sp</span><br><span> #ifndef CONF_USB_D_NUM_EP_SP</span><br><span style="color: hsl(0, 100%, 40%);">-#define CONF_USB_D_NUM_EP_SP CONF_USB_N_4</span><br><span style="color: hsl(120, 100%, 40%);">+#define CONF_USB_D_NUM_EP_SP CONF_USB_N_6</span><br><span> #endif</span><br><span> </span><br><span> // </h></span><br><span>@@ -60,7 +60,7 @@</span><br><span> // <i> The number of physical endpoints - 1</span><br><span> // <id> usbd_arch_max_ep_n</span><br><span> #ifndef CONF_USB_D_MAX_EP_N</span><br><span style="color: hsl(0, 100%, 40%);">-#define CONF_USB_D_MAX_EP_N CONF_USB_N_2</span><br><span style="color: hsl(120, 100%, 40%);">+#define CONF_USB_D_MAX_EP_N CONF_USB_N_4</span><br><span> #endif</span><br><span> </span><br><span> // <y> USB Speed Limit</span><br><span>diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile</span><br><span>index 080aa41..7684204 100644</span><br><span>--- a/sysmoOCTSIM/gcc/Makefile</span><br><span>+++ b/sysmoOCTSIM/gcc/Makefile</span><br><span>@@ -84,6 +84,7 @@</span><br><span> main.o \</span><br><span> manual_test.o \</span><br><span> talloc.o \</span><br><span style="color: hsl(120, 100%, 40%);">+usb_descriptors.o \</span><br><span> i2c_bitbang.o \</span><br><span> octsim_i2c.o \</span><br><span> ncn8025.o \</span><br><span>@@ -136,6 +137,7 @@</span><br><span> "main.o" \</span><br><span> "manual_test.o" \</span><br><span> "talloc.o" \</span><br><span style="color: hsl(120, 100%, 40%);">+"usb_descriptors.o" \</span><br><span> "i2c_bitbang.o" \</span><br><span> "octsim_i2c.o" \</span><br><span> "ncn8025.o" \</span><br><span>@@ -194,6 +196,7 @@</span><br><span> "main.d" \</span><br><span> "manual_test.d" \</span><br><span> "talloc.d" \</span><br><span style="color: hsl(120, 100%, 40%);">+"usb_descriptors.d" \</span><br><span> "i2c_bitbang.d" \</span><br><span> "octsim_i2c.d" \</span><br><span> "ncn8025.d" \</span><br><span>diff --git a/sysmoOCTSIM/usb_descriptors.c b/sysmoOCTSIM/usb_descriptors.c</span><br><span>new file mode 100644</span><br><span>index 0000000..429e8c2</span><br><span>--- /dev/null</span><br><span>+++ b/sysmoOCTSIM/usb_descriptors.c</span><br><span>@@ -0,0 +1,241 @@</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usbd_config.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usbdc.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usb_protocol.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usb_protocol_cdc.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "ccid_proto.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "cdcdf_acm_desc.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* aggregate descriptors for the combined CDC-ACM + CCID device that we expose</span><br><span style="color: hsl(120, 100%, 40%);">+ * from sysmoQMOD */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+enum str_desc_num {</span><br><span style="color: hsl(120, 100%, 40%);">+ STR_DESC_MANUF = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+ STR_DESC_PRODUCT,</span><br><span style="color: hsl(120, 100%, 40%);">+ STR_DESC_CONFIG,</span><br><span style="color: hsl(120, 100%, 40%);">+ STR_DESC_INTF_ACM_COMM,</span><br><span style="color: hsl(120, 100%, 40%);">+ STR_DESC_INTF_ACM_DATA,</span><br><span style="color: hsl(120, 100%, 40%);">+ STR_DESC_INTF_CCID,</span><br><span style="color: hsl(120, 100%, 40%);">+ STR_DESC_SERIAL,</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* a struct of structs representing the concatenated collection of USB descriptors */</span><br><span style="color: hsl(120, 100%, 40%);">+struct usb_desc_collection {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_dev_desc dev;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_config_desc cfg;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* CDC-ACM: Two interfaces, one with IRQ EP and one with BULK IN + OUT */</span><br><span style="color: hsl(120, 100%, 40%);">+ struct {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_iface_desc iface;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_cdc_hdr_desc cdc_hdr;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_cdc_call_mgmt_desc cdc_call_mgmt;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_cdc_acm_desc cdc_acm;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_cdc_union_desc cdc_union;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_ep_desc ep[1];</span><br><span style="color: hsl(120, 100%, 40%);">+ } comm;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_iface_desc iface;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_ep_desc ep[2];</span><br><span style="color: hsl(120, 100%, 40%);">+ } data;</span><br><span style="color: hsl(120, 100%, 40%);">+ } cdc;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* CCID: One interface with CCID class descriptor and three endpoints */</span><br><span style="color: hsl(120, 100%, 40%);">+ struct {</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_iface_desc iface;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_ccid_class_descriptor class;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct usb_ep_desc ep[3];</span><br><span style="color: hsl(120, 100%, 40%);">+ } ccid;</span><br><span style="color: hsl(120, 100%, 40%);">+ uint8_t str[116];</span><br><span style="color: hsl(120, 100%, 40%);">+} __attribute__((packed));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static const struct usb_desc_collection usb_fs_descs = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .dev = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_dev_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_DEVICE,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bcdUSB = USB_V2_0,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDeviceClass = 0x02,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDeviceSubClass = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDeviceProtocol = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bMaxPacketSize0 = CONF_USB_CDCD_ACM_BMAXPKSZ0,</span><br><span style="color: hsl(120, 100%, 40%);">+ .idVendor = CONF_USB_CDCD_ACM_IDVENDER,</span><br><span style="color: hsl(120, 100%, 40%);">+ .idProduct = CONF_USB_CDCD_ACM_IDPRODUCT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .iManufacturer = STR_DESC_MANUF,</span><br><span style="color: hsl(120, 100%, 40%);">+ .iProduct = STR_DESC_PRODUCT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .iSerialNumber = STR_DESC_SERIAL,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bNumConfigurations = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .cfg = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_config_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_CONFIG,</span><br><span style="color: hsl(120, 100%, 40%);">+ .wTotalLength = sizeof(usb_fs_descs.cfg) +</span><br><span style="color: hsl(120, 100%, 40%);">+ sizeof(usb_fs_descs.cdc) +</span><br><span style="color: hsl(120, 100%, 40%);">+ sizeof(usb_fs_descs.ccid),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bNumInterfaces = 3,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bConfigurationValue = CONF_USB_CDCD_ACM_BCONFIGVAL,</span><br><span style="color: hsl(120, 100%, 40%);">+ .iConfiguration = STR_DESC_CONFIG,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bmAttributes = CONF_USB_CDCD_ACM_BMATTRI,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bMaxPower = CONF_USB_CDCD_ACM_BMAXPOWER,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .cdc = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .comm = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .iface = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_iface_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_INTERFACE,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceNumber = CONF_USB_CDCD_ACM_COMM_BIFCNUM,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bAlternateSetting = CONF_USB_CDCD_ACM_COMM_BALTSET,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bNumEndpoints = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceClass = CDC_CLASS_COMM,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceSubClass = CDC_SUBCLASS_ACM,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceProtocol = 0x00,</span><br><span style="color: hsl(120, 100%, 40%);">+ .iInterface = STR_DESC_INTF_ACM_COMM,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .cdc_hdr = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bFunctionLength = sizeof(struct usb_cdc_hdr_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = CDC_CS_INTERFACE,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorSubtype = CDC_SCS_HEADER,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bcdCDC = LE16(0x1001),</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .cdc_call_mgmt = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bFunctionLength = sizeof(struct usb_cdc_call_mgmt_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = CDC_CS_INTERFACE,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorSubtype = CDC_SCS_CALL_MGMT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bmCapabilities = 0x01,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDataInterface = 0x00,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .cdc_acm = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bFunctionLength = sizeof(struct usb_cdc_acm_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = CDC_CS_INTERFACE,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorSubtype = CDC_SCS_ACM,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bmCapabilities = 0x02,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .cdc_union = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bFunctionLength = sizeof(struct usb_cdc_union_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = CDC_CS_INTERFACE,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorSubtype = CDC_SCS_UNION,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bMasterInterface = CONF_USB_CDCD_ACM_COMM_BIFCNUM,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bSlaveInterface0 = 0x01,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .ep = {</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_ep_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_ENDPOINT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bEndpointAddress = CONF_USB_CDCD_ACM_COMM_INT_EPADDR,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bmAttributes = USB_EP_TYPE_INTERRUPT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .wMaxPacketSize = CONF_USB_CDCD_ACM_COMM_INT_MAXPKSZ,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterval = CONF_USB_CDCD_ACM_COMM_INT_INTERVAL,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .data = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .iface = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_iface_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_INTERFACE,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceNumber = CONF_USB_CDCD_ACM_DATA_BIFCNUM,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bAlternateSetting = CONF_USB_CDCD_ACM_DATA_BALTSET,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bNumEndpoints = 2,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceClass = CDC_CLASS_DATA,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceSubClass = 0x00,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceProtocol = 0x00,</span><br><span style="color: hsl(120, 100%, 40%);">+ .iInterface = STR_DESC_INTF_ACM_DATA,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .ep = {</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_ep_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_ENDPOINT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bEndpointAddress = CONF_USB_CDCD_ACM_DATA_BULKOUT_EPADDR,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bmAttributes = USB_EP_TYPE_BULK,</span><br><span style="color: hsl(120, 100%, 40%);">+ .wMaxPacketSize = CONF_USB_CDCD_ACM_DATA_BULKOUT_MAXPKSZ,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterval = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_ep_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_ENDPOINT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bEndpointAddress = CONF_USB_CDCD_ACM_DATA_BULKIN_EPADDR,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bmAttributes = USB_EP_TYPE_BULK,</span><br><span style="color: hsl(120, 100%, 40%);">+ .wMaxPacketSize = CONF_USB_CDCD_ACM_DATA_BULKIN_MAXPKSZ,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterval = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .ccid = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .iface = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_iface_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_INTERFACE,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceNumber = 2,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bAlternateSetting = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bNumEndpoints = 3,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceClass = 11,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceSubClass = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterfaceProtocol = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ .iInterface = STR_DESC_INTF_CCID,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .class = {</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_ccid_class_descriptor),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = 33,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bcdCCID = LE16(0x0110),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bMaxSlotIndex = 7,</span><br><span style="color: hsl(120, 100%, 40%);">+ .dwProtocols = 0x07, /* 5/3/1.8V */</span><br><span style="color: hsl(120, 100%, 40%);">+ .dwDefaultClock = LE32(2500),</span><br><span style="color: hsl(120, 100%, 40%);">+ .dwMaximumClock = LE32(20000),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bNumClockSupported = 4,</span><br><span style="color: hsl(120, 100%, 40%);">+ .dwDataRate = LE32(9600),</span><br><span style="color: hsl(120, 100%, 40%);">+ .dwMaxDataRate = LE32(921600),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bNumDataRatesSupported = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ .dwMaxIFSD = LE32(0),</span><br><span style="color: hsl(120, 100%, 40%);">+ .dwSynchProtocols = LE32(0),</span><br><span style="color: hsl(120, 100%, 40%);">+ .dwMechanical = LE32(0),</span><br><span style="color: hsl(120, 100%, 40%);">+ .dwFeatures = LE32(0x10),</span><br><span style="color: hsl(120, 100%, 40%);">+ .dwMaxCCIDMessageLength = 272,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bClassGetResponse = 0xff,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bClassEnvelope = 0xff,</span><br><span style="color: hsl(120, 100%, 40%);">+ .wLcdLayout = LE16(0),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bPINSupport = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bMaxCCIDBusySlots = 8,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ .ep = {</span><br><span style="color: hsl(120, 100%, 40%);">+ { /* Bulk-OUT descriptor */</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_ep_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_ENDPOINT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bEndpointAddress = 0x02,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bmAttributes = USB_EP_TYPE_BULK,</span><br><span style="color: hsl(120, 100%, 40%);">+ .wMaxPacketSize = 64,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterval = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ { /* Bulk-IN descriptor */</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_ep_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_ENDPOINT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bEndpointAddress = 0x83,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bmAttributes = USB_EP_TYPE_BULK,</span><br><span style="color: hsl(120, 100%, 40%);">+ .wMaxPacketSize = 64,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterval = 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ { /* Interrupt dscriptor */</span><br><span style="color: hsl(120, 100%, 40%);">+ .bLength = sizeof(struct usb_ep_desc),</span><br><span style="color: hsl(120, 100%, 40%);">+ .bDescriptorType = USB_DT_ENDPOINT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bEndpointAddress = 0x84,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bmAttributes = USB_EP_TYPE_INTERRUPT,</span><br><span style="color: hsl(120, 100%, 40%);">+ .wMaxPacketSize = 64,</span><br><span style="color: hsl(120, 100%, 40%);">+ .bInterval = 0x10,</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ },</span><br><span style="color: hsl(120, 100%, 40%);">+ //DFURT_IF_DESCRIPTOR,</span><br><span style="color: hsl(120, 100%, 40%);">+ .str = {</span><br><span style="color: hsl(120, 100%, 40%);">+#if 0</span><br><span style="color: hsl(120, 100%, 40%);">+ CDCD_ACM_STR_DESCES</span><br><span style="color: hsl(120, 100%, 40%);">+#else</span><br><span style="color: hsl(120, 100%, 40%);">+ 4, 3, 0x09, 0x04,</span><br><span style="color: hsl(120, 100%, 40%);">+ 18, 3, 's',0, 'y',0, 's',0, 'm',0, 'o',0, 'c',0, 'o',0, 'm',0,</span><br><span style="color: hsl(120, 100%, 40%);">+ 24, 3, 's',0, 'y',0, 's',0, 'm',0, 'o',0, 'O',0, 'C',0, 'T',0, 'S',0, 'I',0, 'M',0,</span><br><span style="color: hsl(120, 100%, 40%);">+ 4, 3, 'A', 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ 22, 3, 'd',0, 'e',0, 'b',0, 'u',0, 'g',0, ' ',0, 'U',0, 'A',0, 'R',0, 'T',0,</span><br><span style="color: hsl(120, 100%, 40%);">+ 22, 3, 'd',0, 'e',0, 'b',0, 'u',0, 'g',0, ' ',0, 'U',0, 'A',0, 'R',0, 'T',0,</span><br><span style="color: hsl(120, 100%, 40%);">+ 10, 3, 'C',0, 'C',0, 'I',0, 'D',0,</span><br><span style="color: hsl(120, 100%, 40%);">+ 12, 3, 'F',0, 'I',0, 'X',0, 'M',0, 'E',0,</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+const struct usbd_descriptors usb_descs[]</span><br><span style="color: hsl(120, 100%, 40%);">+ = {{ (uint8_t *)&usb_fs_descs, (uint8_t *)&usb_fs_descs + sizeof(usb_fs_descs) }};</span><br><span>diff --git a/sysmoOCTSIM/usb_start.c b/sysmoOCTSIM/usb_start.c</span><br><span>index d02edc0..83fac81 100644</span><br><span>--- a/sysmoOCTSIM/usb_start.c</span><br><span>+++ b/sysmoOCTSIM/usb_start.c</span><br><span>@@ -8,28 +8,7 @@</span><br><span> #include "atmel_start.h"</span><br><span> #include "usb_start.h"</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-#if CONF_USBD_HS_SP</span><br><span style="color: hsl(0, 100%, 40%);">-static uint8_t single_desc_bytes[] = {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Device descriptors and Configuration descriptors list. */</span><br><span style="color: hsl(0, 100%, 40%);">- CDCD_ACM_HS_DESCES_LS_FS};</span><br><span style="color: hsl(0, 100%, 40%);">-static uint8_t single_desc_bytes_hs[] = {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Device descriptors and Configuration descriptors list. */</span><br><span style="color: hsl(0, 100%, 40%);">- CDCD_ACM_HS_DESCES_HS};</span><br><span style="color: hsl(0, 100%, 40%);">-#define CDCD_ECHO_BUF_SIZ CONF_USB_CDCD_ACM_DATA_BULKIN_MAXPKSZ_HS</span><br><span style="color: hsl(0, 100%, 40%);">-#else</span><br><span style="color: hsl(0, 100%, 40%);">-static uint8_t single_desc_bytes[] = {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Device descriptors and Configuration descriptors list. */</span><br><span style="color: hsl(0, 100%, 40%);">- CDCD_ACM_DESCES_LS_FS};</span><br><span> #define CDCD_ECHO_BUF_SIZ CONF_USB_CDCD_ACM_DATA_BULKIN_MAXPKSZ</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-static struct usbd_descriptors single_desc[]</span><br><span style="color: hsl(0, 100%, 40%);">- = {{single_desc_bytes, single_desc_bytes + sizeof(single_desc_bytes)}</span><br><span style="color: hsl(0, 100%, 40%);">-#if CONF_USBD_HS_SP</span><br><span style="color: hsl(0, 100%, 40%);">- ,</span><br><span style="color: hsl(0, 100%, 40%);">- {single_desc_bytes_hs, single_desc_bytes_hs + sizeof(single_desc_bytes_hs)}</span><br><span style="color: hsl(0, 100%, 40%);">-#endif</span><br><span style="color: hsl(0, 100%, 40%);">-};</span><br><span> </span><br><span> /** Buffers to receive and echo the communication bytes. */</span><br><span> static uint32_t usbd_cdc_buffer[CDCD_ECHO_BUF_SIZ / 4];</span><br><span>@@ -77,6 +56,8 @@</span><br><span> return false;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+extern const struct usbd_descriptors usb_descs[];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /**</span><br><span> * \brief CDC ACM Init</span><br><span> */</span><br><span>@@ -88,7 +69,7 @@</span><br><span> /* usbdc_register_funcion inside */</span><br><span> cdcdf_acm_init();</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- usbdc_start(single_desc);</span><br><span style="color: hsl(120, 100%, 40%);">+ usbdc_start((struct usbd_descriptors *) usb_descs);</span><br><span> usbdc_attach();</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13998">change 13998</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/13998"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: osmo-ccid-firmware </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I0423d733476f37c16bdb6abc651b7ad5ca7ac63e </div>
<div style="display:none"> Gerrit-Change-Number: 13998 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Harald Welte <laforge@gnumonks.org> </div>