<p>Hoernchen has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/17034">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">support DFU detach to switch from fw to bootloader<br><br>This makes flashing a bit more convenient, because pushing the button is<br>not required. It can be disabled using make DISABLE_DFU_DETACH=1.<br><br>Change-Id: I04d05054d1c0e3988b8eafd93c6524f4a0489cb7<br>---<br>M sysmoOCTSIM/dfu_descriptors.h<br>M sysmoOCTSIM/gcc/Makefile<br>A sysmoOCTSIM/usb/class/dfu/device/dfudf.c<br>A sysmoOCTSIM/usb/class/dfu/device/dfudf.h<br>A sysmoOCTSIM/usb/class/dfu/device/dfudf_desc.h<br>A sysmoOCTSIM/usb/class/dfu/usb_protocol_dfu.h<br>M sysmoOCTSIM/usb_start.c<br>M sysmoOCTSIM/usb_start.h<br>8 files changed, 653 insertions(+), 3 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/34/17034/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/sysmoOCTSIM/dfu_descriptors.h b/sysmoOCTSIM/dfu_descriptors.h</span><br><span>index 8cbaf23..853a98b 100644</span><br><span>--- a/sysmoOCTSIM/dfu_descriptors.h</span><br><span>+++ b/sysmoOCTSIM/dfu_descriptors.h</span><br><span>@@ -10,8 +10,8 @@</span><br><span> #define DFU_FUNC_DESC  {                                                \</span><br><span>    .bLength                = USB_DT_DFU_SIZE,                      \</span><br><span>    .bDescriptorType        = USB_DT_DFU,                           \</span><br><span style="color: hsl(0, 100%, 40%);">-       .bmAttributes           = USB_DFU_CAN_UPLOAD | USB_DFU_CAN_DOWNLOAD, \</span><br><span style="color: hsl(0, 100%, 40%);">-  .wDetachTimeOut         = 5000,                                 \</span><br><span style="color: hsl(120, 100%, 40%);">+     .bmAttributes           = USB_DFU_WILL_DETACH, \</span><br><span style="color: hsl(120, 100%, 40%);">+      .wDetachTimeOut         = 0,                                    \</span><br><span>    .wTransferSize          = FLASH_PAGE_SIZE,                      \</span><br><span>    .bcdDFUVersion          = 0x0100,                               \</span><br><span> }</span><br><span>diff --git a/sysmoOCTSIM/gcc/Makefile b/sysmoOCTSIM/gcc/Makefile</span><br><span>index 6c0974f..9df0c01 100644</span><br><span>--- a/sysmoOCTSIM/gcc/Makefile</span><br><span>+++ b/sysmoOCTSIM/gcc/Makefile</span><br><span>@@ -7,9 +7,11 @@</span><br><span> EXTRA_CFLAGS=-I$(SYSTEM_PREFIX)/include -I../../ccid_common</span><br><span> CROSS_COMPILE= arm-none-eabi-</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+DISABLE_DFU_DETACH ?= 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> CFLAGS_CPU=-D__SAME54N19A__ -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16</span><br><span> CFLAGS=-x c -mthumb -DDEBUG -Os -ffunction-sections -fdata-sections -mlong-calls \</span><br><span style="color: hsl(0, 100%, 40%);">-       -g3 -Wall -c -std=gnu99 $(CFLAGS_CPU) -DOCTSIMFWBUILD</span><br><span style="color: hsl(120, 100%, 40%);">+       -g3 -Wall -c -std=gnu99 $(CFLAGS_CPU) -DOCTSIMFWBUILD -DDISABLE_DFU_DETACH=$(DISABLE_DFU_DETACH)</span><br><span> </span><br><span> CC = $(CROSS_COMPILE)gcc</span><br><span> LD = $(CROSS_COMPILE)ld</span><br><span>@@ -75,6 +77,8 @@</span><br><span>  -I"../usb/class/ccid/device" \</span><br><span>     -I"../usb/class/cdc" \</span><br><span>     -I"../usb/class/cdc/device" \</span><br><span style="color: hsl(120, 100%, 40%);">+       -I"../usb/class/dfu" \</span><br><span style="color: hsl(120, 100%, 40%);">+      -I"../usb/class/dfu/device" \</span><br><span>      -I"../usb/device" \</span><br><span>        $(NULL)</span><br><span> </span><br><span>@@ -135,6 +139,7 @@</span><br><span>    talloc.o \</span><br><span>   usb/class/ccid/device/ccid_df.o \</span><br><span>    usb/class/cdc/device/cdcdf_acm.o \</span><br><span style="color: hsl(120, 100%, 40%);">+    usb/class/dfu/device/dfudf.o \</span><br><span>       usb/device/usbdc.o \</span><br><span>         usb/usb_protocol.o \</span><br><span>         usb_descriptors.o \</span><br><span>diff --git a/sysmoOCTSIM/usb/class/dfu/device/dfudf.c b/sysmoOCTSIM/usb/class/dfu/device/dfudf.c</span><br><span>new file mode 100644</span><br><span>index 0000000..2b11fb4</span><br><span>--- /dev/null</span><br><span>+++ b/sysmoOCTSIM/usb/class/dfu/device/dfudf.c</span><br><span>@@ -0,0 +1,300 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/**</span><br><span style="color: hsl(120, 100%, 40%);">+ * \file</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief USB Device Stack DFU Function Implementation.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (c) 2018 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de></span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This library is free software; you can redistribute it and/or</span><br><span style="color: hsl(120, 100%, 40%);">+ * modify it under the terms of the GNU Lesser General Public</span><br><span style="color: hsl(120, 100%, 40%);">+ * License as published by the Free Software Foundation; either</span><br><span style="color: hsl(120, 100%, 40%);">+ * version 2.1 of the License, or (at your option) any later version.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This library is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span><br><span style="color: hsl(120, 100%, 40%);">+ * Lesser General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * You should have received a copy of the GNU Lesser General Public</span><br><span style="color: hsl(120, 100%, 40%);">+ * License along with this library; if not, write to the Free Software</span><br><span style="color: hsl(120, 100%, 40%);">+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA</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%);">+#include "dfudf.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usb_protocol_dfu.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "dfudf_desc.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/** USB Device DFU Function Specific Data */</span><br><span style="color: hsl(120, 100%, 40%);">+struct dfudf_func_data {</span><br><span style="color: hsl(120, 100%, 40%);">+   /** DFU Interface information */</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t func_iface;</span><br><span style="color: hsl(120, 100%, 40%);">+   /** DFU Enable Flag */</span><br><span style="color: hsl(120, 100%, 40%);">+        bool enabled;</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%);">+static struct usbdf_driver _dfudf;</span><br><span style="color: hsl(120, 100%, 40%);">+static struct dfudf_func_data _dfudf_funcd;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/** USB DFU functional descriptor (with DFU attributes) */</span><br><span style="color: hsl(120, 100%, 40%);">+static const uint8_t usb_dfu_func_desc_bytes[] = {DFUD_IFACE_DESCB};</span><br><span style="color: hsl(120, 100%, 40%);">+static const usb_dfu_func_desc_t* usb_dfu_func_desc = (usb_dfu_func_desc_t*)&usb_dfu_func_desc_bytes;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+enum usb_dfu_state dfu_state = USB_DFU_STATE_APP_IDLE;</span><br><span style="color: hsl(120, 100%, 40%);">+enum usb_dfu_status dfu_status = USB_DFU_STATUS_OK;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+uint8_t dfu_download_data[512];</span><br><span style="color: hsl(120, 100%, 40%);">+uint16_t dfu_download_length = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+size_t dfu_download_offset = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+bool dfu_manifestation_complete = false;</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%);">+ * \brief Enable DFU Function</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] drv Pointer to USB device function driver</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] desc Pointer to USB interface descriptor</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Operation status.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static int32_t dfudf_enable(struct usbdf_driver *drv, struct usbd_descriptors *desc)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        struct dfudf_func_data *func_data = (struct dfudf_func_data *)(drv->func_data);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  usb_iface_desc_t ifc_desc;</span><br><span style="color: hsl(120, 100%, 40%);">+    uint8_t *        ifc;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       ifc = desc->sod;</span><br><span style="color: hsl(120, 100%, 40%);">+   if (NULL == ifc) {</span><br><span style="color: hsl(120, 100%, 40%);">+            return ERR_NOT_FOUND;</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%);">+   ifc_desc.bInterfaceNumber = ifc[2];</span><br><span style="color: hsl(120, 100%, 40%);">+   ifc_desc.bInterfaceClass  = ifc[5];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (USB_DFU_CLASS == ifc_desc.bInterfaceClass) {</span><br><span style="color: hsl(120, 100%, 40%);">+              if (func_data->func_iface == ifc_desc.bInterfaceNumber) { // Initialized</span><br><span style="color: hsl(120, 100%, 40%);">+                   return ERR_ALREADY_INITIALIZED;</span><br><span style="color: hsl(120, 100%, 40%);">+               } else if (func_data->func_iface != 0xFF) { // Occupied</span><br><span style="color: hsl(120, 100%, 40%);">+                    return ERR_NO_RESOURCE;</span><br><span style="color: hsl(120, 100%, 40%);">+               } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      func_data->func_iface = ifc_desc.bInterfaceNumber;</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+     } else { // Not supported by this function driver</span><br><span style="color: hsl(120, 100%, 40%);">+             return ERR_NOT_FOUND;</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%);">+   // there are no endpoint to install since DFU uses only the control endpoint</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        ifc = usb_find_desc(usb_desc_next(desc->sod), desc->eod, USB_DT_INTERFACE);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   // Installed</span><br><span style="color: hsl(120, 100%, 40%);">+  _dfudf_funcd.enabled = true;</span><br><span style="color: hsl(120, 100%, 40%);">+  return ERR_NONE;</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%);">+ * \brief Disable DFU Function</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] drv Pointer to USB device function driver</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] desc Pointer to USB device descriptor</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Operation status.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static int32_t dfudf_disable(struct usbdf_driver *drv, struct usbd_descriptors *desc)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ struct dfudf_func_data *func_data = (struct dfudf_func_data *)(drv->func_data);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  usb_iface_desc_t ifc_desc;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  if (desc) {</span><br><span style="color: hsl(120, 100%, 40%);">+           ifc_desc.bInterfaceClass = desc->sod[5];</span><br><span style="color: hsl(120, 100%, 40%);">+           // Check interface</span><br><span style="color: hsl(120, 100%, 40%);">+            if (ifc_desc.bInterfaceClass != USB_DFU_CLASS) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      return ERR_NOT_FOUND;</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%);">+   func_data->func_iface = 0xFF;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    _dfudf_funcd.enabled = false;</span><br><span style="color: hsl(120, 100%, 40%);">+ return ERR_NONE;</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%);">+ * \brief DFU Control Function</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] drv Pointer to USB device function driver</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] ctrl USB device general function control type</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] param Parameter pointer</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Operation status.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static int32_t dfudf_ctrl(struct usbdf_driver *drv, enum usbdf_control ctrl, void *param)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      switch (ctrl) {</span><br><span style="color: hsl(120, 100%, 40%);">+       case USBDF_ENABLE:</span><br><span style="color: hsl(120, 100%, 40%);">+            return dfudf_enable(drv, (struct usbd_descriptors *)param);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ case USBDF_DISABLE:</span><br><span style="color: hsl(120, 100%, 40%);">+           return dfudf_disable(drv, (struct usbd_descriptors *)param);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        case USBDF_GET_IFACE:</span><br><span style="color: hsl(120, 100%, 40%);">+         return ERR_UNSUPPORTED_OP;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  default:</span><br><span style="color: hsl(120, 100%, 40%);">+              return ERR_INVALID_ARG;</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%);">+ * \brief Process the DFU IN request</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] ep Endpoint address.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] req Pointer to the request.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] stage Stage of the request.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Operation status.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static int32_t dfudf_in_req(uint8_t ep, struct usb_req *req, enum usb_ctrl_stage stage)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    if (USB_DATA_STAGE == stage) { // the data stage is only for IN data, which we sent</span><br><span style="color: hsl(120, 100%, 40%);">+           return ERR_NONE; // send the IN data</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%);">+   int32_t to_return = ERR_NONE;</span><br><span style="color: hsl(120, 100%, 40%);">+ uint8_t response[6]; // buffer for the response to this request</span><br><span style="color: hsl(120, 100%, 40%);">+       switch (req->bRequest) {</span><br><span style="color: hsl(120, 100%, 40%);">+   case USB_DFU_UPLOAD: // upload firmware from flash not supported</span><br><span style="color: hsl(120, 100%, 40%);">+              dfu_state = USB_DFU_STATE_DFU_ERROR; // unsupported class request</span><br><span style="color: hsl(120, 100%, 40%);">+             to_return = ERR_UNSUPPORTED_OP; // stall control pipe (don't reply to the request)</span><br><span style="color: hsl(120, 100%, 40%);">+                break;</span><br><span style="color: hsl(120, 100%, 40%);">+        case USB_DFU_GETSTATUS: // get status</span><br><span style="color: hsl(120, 100%, 40%);">+         response[0] = dfu_status; // set status</span><br><span style="color: hsl(120, 100%, 40%);">+               response[1] = 10; // set poll timeout (24 bits, in milliseconds) to small value for periodical poll</span><br><span style="color: hsl(120, 100%, 40%);">+           response[2] = 0; // set poll timeout (24 bits, in milliseconds) to small value for periodical poll</span><br><span style="color: hsl(120, 100%, 40%);">+            response[3] = 0; // set poll timeout (24 bits, in milliseconds) to small value for periodical poll</span><br><span style="color: hsl(120, 100%, 40%);">+            response[4] = dfu_state; // set state</span><br><span style="color: hsl(120, 100%, 40%);">+         response[5] = 0; // string not used</span><br><span style="color: hsl(120, 100%, 40%);">+           to_return = usbdc_xfer(ep, response, 6, false); // send back status</span><br><span style="color: hsl(120, 100%, 40%);">+           if (USB_DFU_STATE_DFU_DNLOAD_SYNC == dfu_state) { // download has not completed</span><br><span style="color: hsl(120, 100%, 40%);">+                       dfu_state = USB_DFU_STATE_DFU_DNBUSY; // switch to busy state</span><br><span style="color: hsl(120, 100%, 40%);">+         } else if (USB_DFU_STATE_DFU_MANIFEST_SYNC == dfu_state) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    if (!dfu_manifestation_complete) {</span><br><span style="color: hsl(120, 100%, 40%);">+                            dfu_state = USB_DFU_STATE_DFU_MANIFEST; // go to manifest mode</span><br><span style="color: hsl(120, 100%, 40%);">+                        } else if (usb_dfu_func_desc->bmAttributes & USB_DFU_ATTRIBUTES_MANIFEST_TOLERANT) {</span><br><span style="color: hsl(120, 100%, 40%);">+                           dfu_state = USB_DFU_STATE_DFU_IDLE; // go back to idle mode</span><br><span style="color: hsl(120, 100%, 40%);">+                   } else { // this should not happen (after manifestation the state should be dfuMANIFEST-WAIT-RESET if we are not manifest tolerant)</span><br><span style="color: hsl(120, 100%, 40%);">+                           dfu_state = USB_DFU_STATE_DFU_MANIFEST_WAIT_RESET; // wait for reset</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%);">+             break;</span><br><span style="color: hsl(120, 100%, 40%);">+        case USB_DFU_GETSTATE: // get state</span><br><span style="color: hsl(120, 100%, 40%);">+           response[0] = dfu_state; // return state</span><br><span style="color: hsl(120, 100%, 40%);">+              to_return = usbdc_xfer(ep, response, 1, false); // send back state</span><br><span style="color: hsl(120, 100%, 40%);">+            break;</span><br><span style="color: hsl(120, 100%, 40%);">+        default: // all other DFU class IN request</span><br><span style="color: hsl(120, 100%, 40%);">+            dfu_state = USB_DFU_STATE_DFU_ERROR; // unknown or unsupported class request</span><br><span style="color: hsl(120, 100%, 40%);">+          to_return = ERR_INVALID_ARG; // stall control pipe (don't reply to the request)</span><br><span style="color: hsl(120, 100%, 40%);">+           break;</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%);">+   return to_return;</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%);">+ * \brief Process the DFU OUT request</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] ep Endpoint address.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] req Pointer to the request.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] stage Stage of the request.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Operation status.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static int32_t dfudf_out_req(uint8_t ep, struct usb_req *req, enum usb_ctrl_stage stage)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  int32_t to_return = ERR_NONE;</span><br><span style="color: hsl(120, 100%, 40%);">+ switch (req->bRequest) {</span><br><span style="color: hsl(120, 100%, 40%);">+   case USB_DFU_DETACH: // detach makes only sense in DFU run-time/application mode</span><br><span style="color: hsl(120, 100%, 40%);">+#if (DISABLE_DFU_DETACH != 0)</span><br><span style="color: hsl(120, 100%, 40%);">+               dfu_state = USB_DFU_STATE_DFU_ERROR; // unsupported class request</span><br><span style="color: hsl(120, 100%, 40%);">+             to_return = ERR_UNSUPPORTED_OP; // stall control pipe (don't reply to the request)</span><br><span style="color: hsl(120, 100%, 40%);">+#else</span><br><span style="color: hsl(120, 100%, 40%);">+         to_return = usbdc_xfer(ep, NULL, 0, false);</span><br><span style="color: hsl(120, 100%, 40%);">+           *(uint32_t*)HSRAM_ADDR = 0x44465521;</span><br><span style="color: hsl(120, 100%, 40%);">+          __disable_irq();</span><br><span style="color: hsl(120, 100%, 40%);">+              delay_us(10000);</span><br><span style="color: hsl(120, 100%, 40%);">+              usbdc_detach();</span><br><span style="color: hsl(120, 100%, 40%);">+               delay_us(100000);</span><br><span style="color: hsl(120, 100%, 40%);">+             NVIC_SystemReset();</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+           break;</span><br><span style="color: hsl(120, 100%, 40%);">+        case USB_DFU_CLRSTATUS: // clear status</span><br><span style="color: hsl(120, 100%, 40%);">+               if (USB_DFU_STATE_DFU_ERROR == dfu_state || USB_DFU_STATUS_OK != dfu_status) { // only clear in case there is an error</span><br><span style="color: hsl(120, 100%, 40%);">+                        dfu_status = USB_DFU_STATUS_OK; // clear error status</span><br><span style="color: hsl(120, 100%, 40%);">+                 dfu_state = USB_DFU_STATE_DFU_IDLE; // put back in idle state</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+             to_return = usbdc_xfer(ep, NULL, 0, false); // send ACK</span><br><span style="color: hsl(120, 100%, 40%);">+               break;</span><br><span style="color: hsl(120, 100%, 40%);">+        case USB_DFU_ABORT: // abort current operation</span><br><span style="color: hsl(120, 100%, 40%);">+                dfu_download_offset = 0; // reset download progress</span><br><span style="color: hsl(120, 100%, 40%);">+           dfu_state = USB_DFU_STATE_DFU_IDLE; // put back in idle state (nothing else to do)</span><br><span style="color: hsl(120, 100%, 40%);">+            to_return = usbdc_xfer(ep, NULL, 0, false); // send ACK</span><br><span style="color: hsl(120, 100%, 40%);">+               break;</span><br><span style="color: hsl(120, 100%, 40%);">+        default: // all other DFU class OUT request</span><br><span style="color: hsl(120, 100%, 40%);">+           dfu_state = USB_DFU_STATE_DFU_ERROR; // unknown class request</span><br><span style="color: hsl(120, 100%, 40%);">+         to_return = ERR_INVALID_ARG; // stall control pipe (don't reply to the request)</span><br><span style="color: hsl(120, 100%, 40%);">+           break;</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%);">+   return to_return;</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%);">+ * \brief Process the CDC class request</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] ep Endpoint address.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] req Pointer to the request.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] stage Stage of the request.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Operation status.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+static int32_t dfudf_req(uint8_t ep, struct usb_req *req, enum usb_ctrl_stage stage)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    if (0x01 != ((req->bmRequestType >> 5) & 0x03)) { // class request</span><br><span style="color: hsl(120, 100%, 40%);">+               return ERR_NOT_FOUND;</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%);">+   if ((req->wIndex == _dfudf_funcd.func_iface)) {</span><br><span style="color: hsl(120, 100%, 40%);">+            if (req->bmRequestType & USB_EP_DIR_IN) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      return dfudf_in_req(ep, req, stage);</span><br><span style="color: hsl(120, 100%, 40%);">+          } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      return dfudf_out_req(ep, req, stage);</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+     } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              return ERR_NOT_FOUND;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+     return ERR_NOT_FOUND;</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%);">+/** USB Device DFU Handler Struct */</span><br><span style="color: hsl(120, 100%, 40%);">+static struct usbdc_handler dfudf_req_h = {NULL, (FUNC_PTR)dfudf_req};</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%);">+ * \brief Initialize the USB DFU Function Driver</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+int32_t dfudf_init(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   if (usbdc_get_state() > USBD_S_POWER) {</span><br><span style="color: hsl(120, 100%, 40%);">+            return ERR_DENIED;</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%);">+   _dfudf.ctrl      = dfudf_ctrl;</span><br><span style="color: hsl(120, 100%, 40%);">+        _dfudf.func_data = &_dfudf_funcd;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       usbdc_register_function(&_dfudf);</span><br><span style="color: hsl(120, 100%, 40%);">+ usbdc_register_handler(USBDC_HDL_REQ, &dfudf_req_h);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    return ERR_NONE;</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%);">+ * \brief De-initialize the USB DFU Function Driver</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+void dfudf_deinit(void)</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%);">+ * \brief Check whether DFU Function is enabled</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+bool dfudf_is_enabled(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      return _dfudf_funcd.enabled;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span>diff --git a/sysmoOCTSIM/usb/class/dfu/device/dfudf.h b/sysmoOCTSIM/usb/class/dfu/device/dfudf.h</span><br><span>new file mode 100644</span><br><span>index 0000000..cee5845</span><br><span>--- /dev/null</span><br><span>+++ b/sysmoOCTSIM/usb/class/dfu/device/dfudf.h</span><br><span>@@ -0,0 +1,77 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/**</span><br><span style="color: hsl(120, 100%, 40%);">+ * \file</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief USB Device Stack DFU Function Definition.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (c) 2018 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de></span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \asf_license_start</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \page License</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Subject to your compliance with these terms, you may use Microchip</span><br><span style="color: hsl(120, 100%, 40%);">+ * software and any derivatives exclusively with Microchip products.</span><br><span style="color: hsl(120, 100%, 40%);">+ * It is your responsibility to comply with third party license terms applicable</span><br><span style="color: hsl(120, 100%, 40%);">+ * to your use of third party software (including open source software) that</span><br><span style="color: hsl(120, 100%, 40%);">+ * may accompany Microchip software.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,</span><br><span style="color: hsl(120, 100%, 40%);">+ * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,</span><br><span style="color: hsl(120, 100%, 40%);">+ * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,</span><br><span style="color: hsl(120, 100%, 40%);">+ * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE</span><br><span style="color: hsl(120, 100%, 40%);">+ * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL</span><br><span style="color: hsl(120, 100%, 40%);">+ * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE</span><br><span style="color: hsl(120, 100%, 40%);">+ * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE</span><br><span style="color: hsl(120, 100%, 40%);">+ * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.  TO THE FULLEST EXTENT</span><br><span style="color: hsl(120, 100%, 40%);">+ * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY</span><br><span style="color: hsl(120, 100%, 40%);">+ * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,</span><br><span style="color: hsl(120, 100%, 40%);">+ * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \asf_license_stop</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%);">+#ifndef USBDF_DFU_H_</span><br><span style="color: hsl(120, 100%, 40%);">+#define USBDF_DFU_H_</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usbdc.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usb_protocol_dfu.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/** Current DFU state */</span><br><span style="color: hsl(120, 100%, 40%);">+extern enum usb_dfu_state dfu_state;</span><br><span style="color: hsl(120, 100%, 40%);">+/**< Current DFU status */</span><br><span style="color: hsl(120, 100%, 40%);">+extern enum usb_dfu_status dfu_status;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/** Downloaded data to be programmed in flash</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ *  512 is the flash page size of the SAM D5x/E5x</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+extern uint8_t dfu_download_data[512];</span><br><span style="color: hsl(120, 100%, 40%);">+/** Length of downloaded data in bytes */</span><br><span style="color: hsl(120, 100%, 40%);">+extern uint16_t dfu_download_length;</span><br><span style="color: hsl(120, 100%, 40%);">+/** Offset of where the downloaded data should be flashed in bytes */</span><br><span style="color: hsl(120, 100%, 40%);">+extern size_t dfu_download_offset;</span><br><span style="color: hsl(120, 100%, 40%);">+/** If manifestation (firmware flash and check) is complete */</span><br><span style="color: hsl(120, 100%, 40%);">+extern bool dfu_manifestation_complete;</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%);">+ * \brief Initialize the USB DFU Function Driver</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Operation status.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+int32_t dfudf_init(void);</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%);">+ * \brief Deinitialize the USB DFU Function Driver</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Operation status.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+void dfudf_deinit(void);</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%);">+ * \brief Check whether DFU Function is enabled</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Operation status.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return true DFU Function is enabled</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return false DFU Function is disabled</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+bool dfudf_is_enabled(void);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* USBDF_DFU_H_ */</span><br><span>diff --git a/sysmoOCTSIM/usb/class/dfu/device/dfudf_desc.h b/sysmoOCTSIM/usb/class/dfu/device/dfudf_desc.h</span><br><span>new file mode 100644</span><br><span>index 0000000..50a79e4</span><br><span>--- /dev/null</span><br><span>+++ b/sysmoOCTSIM/usb/class/dfu/device/dfudf_desc.h</span><br><span>@@ -0,0 +1,114 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/**</span><br><span style="color: hsl(120, 100%, 40%);">+ * \file</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief USB Device Stack DFU Function Descriptor Setting.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (c) 2018 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de></span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \asf_license_start</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \page License</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Subject to your compliance with these terms, you may use Microchip</span><br><span style="color: hsl(120, 100%, 40%);">+ * software and any derivatives exclusively with Microchip products.</span><br><span style="color: hsl(120, 100%, 40%);">+ * It is your responsibility to comply with third party license terms applicable</span><br><span style="color: hsl(120, 100%, 40%);">+ * to your use of third party software (including open source software) that</span><br><span style="color: hsl(120, 100%, 40%);">+ * may accompany Microchip software.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,</span><br><span style="color: hsl(120, 100%, 40%);">+ * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,</span><br><span style="color: hsl(120, 100%, 40%);">+ * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,</span><br><span style="color: hsl(120, 100%, 40%);">+ * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE</span><br><span style="color: hsl(120, 100%, 40%);">+ * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL</span><br><span style="color: hsl(120, 100%, 40%);">+ * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE</span><br><span style="color: hsl(120, 100%, 40%);">+ * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE</span><br><span style="color: hsl(120, 100%, 40%);">+ * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.  TO THE FULLEST EXTENT</span><br><span style="color: hsl(120, 100%, 40%);">+ * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY</span><br><span style="color: hsl(120, 100%, 40%);">+ * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,</span><br><span style="color: hsl(120, 100%, 40%);">+ * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \asf_license_stop</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%);">+#ifndef USBDF_DFU_DESC_H_</span><br><span style="color: hsl(120, 100%, 40%);">+#define USBDF_DFU_DESC_H_</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usb_protocol.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usbd_config.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usb_protocol_dfu.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define DFUD_DEV_DESC \</span><br><span style="color: hsl(120, 100%, 40%);">+   USB_DEV_DESC_BYTES(CONF_USB_DFUD_BCDUSB, \</span><br><span style="color: hsl(120, 100%, 40%);">+                       CONF_USB_DFUD_BDEVICECLASS, \</span><br><span style="color: hsl(120, 100%, 40%);">+                         CONF_USB_DFUD_BDEVICESUBCLASS, \</span><br><span style="color: hsl(120, 100%, 40%);">+                      CONF_USB_DFUD_BDEVICEPROTOCOL, \</span><br><span style="color: hsl(120, 100%, 40%);">+                      CONF_USB_DFUD_BMAXPKSZ0, \</span><br><span style="color: hsl(120, 100%, 40%);">+                    CONF_USB_OPENMOKO_IDVENDOR, \</span><br><span style="color: hsl(120, 100%, 40%);">+                         CONF_USB_OSMOASF4DFU_IDPRODUCT, \</span><br><span style="color: hsl(120, 100%, 40%);">+                     CONF_USB_DFUD_BCDDEVICE, \</span><br><span style="color: hsl(120, 100%, 40%);">+                    CONF_USB_DFUD_IMANUFACT, \</span><br><span style="color: hsl(120, 100%, 40%);">+                    CONF_USB_DFUD_IPRODUCT, \</span><br><span style="color: hsl(120, 100%, 40%);">+                     CONF_USB_DFUD_ISERIALNUM, \</span><br><span style="color: hsl(120, 100%, 40%);">+                           CONF_USB_DFUD_BNUMCONFIG)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define DFUD_DEV_QUAL_DESC \</span><br><span style="color: hsl(120, 100%, 40%);">+  USB_DEV_QUAL_DESC_BYTES(CONF_USB_DFUD_BCDUSB, \</span><br><span style="color: hsl(120, 100%, 40%);">+                               CONF_USB_DFUD_BDEVICECLASS, \</span><br><span style="color: hsl(120, 100%, 40%);">+                         CONF_USB_DFUD_BDEVICESUBCLASS, \</span><br><span style="color: hsl(120, 100%, 40%);">+                              CONF_USB_DFUD_BMAXPKSZ0, \</span><br><span style="color: hsl(120, 100%, 40%);">+                            CONF_USB_DFUD_BNUMCONFIG)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define DFUD_CFG_DESC \</span><br><span style="color: hsl(120, 100%, 40%);">+  USB_CONFIG_DESC_BYTES(CONF_USB_DFUD_WTOTALLENGTH, \</span><br><span style="color: hsl(120, 100%, 40%);">+                         CONF_USB_DFUD_BNUMINTERFACES, \</span><br><span style="color: hsl(120, 100%, 40%);">+                       CONF_USB_DFUD_BCONFIGVAL, \</span><br><span style="color: hsl(120, 100%, 40%);">+                           CONF_USB_DFUD_ICONFIG, \</span><br><span style="color: hsl(120, 100%, 40%);">+                              CONF_USB_DFUD_BMATTRI, \</span><br><span style="color: hsl(120, 100%, 40%);">+                              CONF_USB_DFUD_BMAXPOWER)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define DFUD_OTH_SPD_CFG_DESC \</span><br><span style="color: hsl(120, 100%, 40%);">+     USB_OTH_SPD_CFG_DESC_BYTES(CONF_USB_DFUD_WTOTALLENGTH, \</span><br><span style="color: hsl(120, 100%, 40%);">+                                 CONF_USB_DFUD_BNUMINTERFACES, \</span><br><span style="color: hsl(120, 100%, 40%);">+                               CONF_USB_DFUD_BCONFIGVAL, \</span><br><span style="color: hsl(120, 100%, 40%);">+                                   CONF_USB_DFUD_ICONFIG, \</span><br><span style="color: hsl(120, 100%, 40%);">+                              CONF_USB_DFUD_BMATTRI, \</span><br><span style="color: hsl(120, 100%, 40%);">+                              CONF_USB_DFUD_BMAXPOWER)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define DFUD_IFACE_DESCB USB_DFU_FUNC_DESC_BYTES(USB_DFU_ATTRIBUTES_CAN_DOWNLOAD | USB_DFU_ATTRIBUTES_WILL_DETACH, \</span><br><span style="color: hsl(120, 100%, 40%);">+                                                0, /**< detaching makes only sense in run-time mode */ \</span><br><span style="color: hsl(120, 100%, 40%);">+                                                   512, /**< transfer size corresponds to page size for optimal flash writing */ \</span><br><span style="color: hsl(120, 100%, 40%);">+                                                    0x0110 /**< DFU specification version 1.1 used */ )</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define DFUD_IFACE_DESCES \</span><br><span style="color: hsl(120, 100%, 40%);">+    USB_IFACE_DESC_BYTES(CONF_USB_DFUD_BIFCNUM, \</span><br><span style="color: hsl(120, 100%, 40%);">+                      CONF_USB_DFUD_BALTSET, \</span><br><span style="color: hsl(120, 100%, 40%);">+                      CONF_USB_DFUD_BNUMEP, \</span><br><span style="color: hsl(120, 100%, 40%);">+                       USB_DFU_CLASS, \</span><br><span style="color: hsl(120, 100%, 40%);">+                      USB_DFU_SUBCLASS, \</span><br><span style="color: hsl(120, 100%, 40%);">+                           USB_DFU_PROTOCOL_DFU, \</span><br><span style="color: hsl(120, 100%, 40%);">+                       CONF_USB_DFUD_IINTERFACE), \</span><br><span style="color: hsl(120, 100%, 40%);">+                          DFUD_IFACE_DESCB</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define DFUD_STR_DESCES \</span><br><span style="color: hsl(120, 100%, 40%);">+    CONF_USB_DFUD_LANGID_DESC \</span><br><span style="color: hsl(120, 100%, 40%);">+   CONF_USB_DFUD_IMANUFACT_STR_DESC \</span><br><span style="color: hsl(120, 100%, 40%);">+    CONF_USB_DFUD_IPRODUCT_STR_DESC \</span><br><span style="color: hsl(120, 100%, 40%);">+     CONF_USB_DFUD_ISERIALNUM_STR_DESC \</span><br><span style="color: hsl(120, 100%, 40%);">+   CONF_USB_DFUD_ICONFIG_STR_DESC \</span><br><span style="color: hsl(120, 100%, 40%);">+      CONF_USB_DFUD_IINTERFACE_STR_DESC</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/** USB Device descriptors and configuration descriptors */</span><br><span style="color: hsl(120, 100%, 40%);">+#define DFUD_DESCES_LS_FS \</span><br><span style="color: hsl(120, 100%, 40%);">+ DFUD_DEV_DESC, DFUD_CFG_DESC, DFUD_IFACE_DESCES, DFUD_STR_DESCES</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define DFUD_HS_DESCES_LS_FS \</span><br><span style="color: hsl(120, 100%, 40%);">+    DFUD_DEV_DESC, DFUD_DEV_QUAL_DESC, DFUD_CFG_DESC, DFUD_M_IFACE_DESCES, \</span><br><span style="color: hsl(120, 100%, 40%);">+          DFUD_IFACE_DESCES, DFUD_OTH_SPD_CFG_DESC, \</span><br><span style="color: hsl(120, 100%, 40%);">+           DFUD_IFACE_DESCES_HS, DFUD_STR_DESCES</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define DFUD_HS_DESCES_HS \</span><br><span style="color: hsl(120, 100%, 40%);">+      DFUD_CFG_DESC, DFUD_IFACE_DESCES, DFUD_IFACE_DESCES_HS, DFUD_OTH_SPD_CFG_DESC, \</span><br><span style="color: hsl(120, 100%, 40%);">+          DFUD_IFACE_DESCES</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* USBDF_DFU_DESC_H_ */</span><br><span>diff --git a/sysmoOCTSIM/usb/class/dfu/usb_protocol_dfu.h b/sysmoOCTSIM/usb/class/dfu/usb_protocol_dfu.h</span><br><span>new file mode 100644</span><br><span>index 0000000..7f82743</span><br><span>--- /dev/null</span><br><span>+++ b/sysmoOCTSIM/usb/class/dfu/usb_protocol_dfu.h</span><br><span>@@ -0,0 +1,150 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/**</span><br><span style="color: hsl(120, 100%, 40%);">+ * \file</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief USB Device Firmware Upgrade (DFU) protocol definitions</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (c) 2018 sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de></span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This library is free software; you can redistribute it and/or</span><br><span style="color: hsl(120, 100%, 40%);">+ * modify it under the terms of the GNU Lesser General Public</span><br><span style="color: hsl(120, 100%, 40%);">+ * License as published by the Free Software Foundation; either</span><br><span style="color: hsl(120, 100%, 40%);">+ * version 2.1 of the License, or (at your option) any later version.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This library is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span><br><span style="color: hsl(120, 100%, 40%);">+ * Lesser General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * You should have received a copy of the GNU Lesser General Public</span><br><span style="color: hsl(120, 100%, 40%);">+ * License along with this library; if not, write to the Free Software</span><br><span style="color: hsl(120, 100%, 40%);">+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef _USB_PROTOCOL_DFU_H_</span><br><span style="color: hsl(120, 100%, 40%);">+#define _USB_PROTOCOL_DFU_H_</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include "usb_includes.h"</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%);">+ * \ingroup usb_protocol_group</span><br><span style="color: hsl(120, 100%, 40%);">+ * \defgroup dfu_protocol_group Device Firmware Upgrade Definitions</span><br><span style="color: hsl(120, 100%, 40%);">+ * \implements USB Device Firmware Upgrade Specification, Revision 1.1</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%);">+ * \name USB DFU Subclass IDs</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%);">+#define USB_DFU_CLASS 0xFE //!< Application Specific Class Code</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%);">+//! \name USB DFU Subclass IDs</span><br><span style="color: hsl(120, 100%, 40%);">+//@{</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_DFU_SUBCLASS 0x01 //!< Device Firmware Upgrade Code</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%);">+//! \name USB DFU Protocol IDs</span><br><span style="color: hsl(120, 100%, 40%);">+//@{</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_DFU_PROTOCOL_RUNTIME 0x01 //!< Runtime protocol</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_DFU_PROTOCOL_DFU 0x02 //!< DFU mode protocol</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%);">+//! \name USB DFU Attributes bits mask</span><br><span style="color: hsl(120, 100%, 40%);">+//@{</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_DFU_ATTRIBUTES_CAN_DOWNLOAD 0x01</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_DFU_ATTRIBUTES_CAN_UPLOAD 0x02</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_DFU_ATTRIBUTES_MANIFEST_TOLERANT 0x04</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_DFU_ATTRIBUTES_WILL_DETACH 0x08</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%);">+//! \name USB DFU Request IDs</span><br><span style="color: hsl(120, 100%, 40%);">+//@{</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_REQ_DFU_DETACH 0x00</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_REQ_DFU_DNLOAD 0x01</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_REQ_DFU_UPLOAD 0x02</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_REQ_DFU_GETSTATUS 0x03</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_REQ_DFU_CLRSTATUS 0x04</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_REQ_DFU_GETSTATE 0x05</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_REQ_DFU_ABORT 0x06</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%);">+ * Need to pack structures tightly, or the compiler might insert padding</span><br><span style="color: hsl(120, 100%, 40%);">+ * and violate the spec-mandated layout.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+COMPILER_PACK_SET(1)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+//! \name USB DFU Descriptors</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%);">+//! DFU Functional Descriptor</span><br><span style="color: hsl(120, 100%, 40%);">+typedef struct usb_dfu_func_desc {</span><br><span style="color: hsl(120, 100%, 40%);">+  uint8_t bFunctionLength; /**< Size of this descriptor, in bytes (always 9) */</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t bDescriptorType; /**< DFU FUNCTIONAL descriptor type (always 0x21) */</span><br><span style="color: hsl(120, 100%, 40%);">+      uint8_t bmAttributes; /**< DFU attributes bit mask */</span><br><span style="color: hsl(120, 100%, 40%);">+      le16_t  wDetachTimeOut; /**< Time, in milliseconds, that the device will wait after receipt of the DFU_DETACH request */</span><br><span style="color: hsl(120, 100%, 40%);">+   le16_t  wTransferSize; /**< Maximum number of bytes that the device can accept per control-write transaction */</span><br><span style="color: hsl(120, 100%, 40%);">+    le16_t  bcdDFUVersion; /**< Numeric expression identifying the version of the DFU Specification release */</span><br><span style="color: hsl(120, 100%, 40%);">+} usb_dfu_func_desc_t;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_DFU_FUNC_DESC_LEN 9</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_DFU_FUNC_DESC_TYPE 0x21</span><br><span style="color: hsl(120, 100%, 40%);">+#define USB_DFU_FUNC_DESC_BYTES(bmAttributes, wDetachTimeOut, wTransferSize, bcdDFUVersion) \</span><br><span style="color: hsl(120, 100%, 40%);">+  USB_DFU_FUNC_DESC_LEN, /* bFunctionLength */ \</span><br><span style="color: hsl(120, 100%, 40%);">+        USB_DFU_FUNC_DESC_TYPE, /* bDescriptorType */ \</span><br><span style="color: hsl(120, 100%, 40%);">+       bmAttributes, \</span><br><span style="color: hsl(120, 100%, 40%);">+       LE_BYTE0(wDetachTimeOut), LE_BYTE1(wDetachTimeOut), \</span><br><span style="color: hsl(120, 100%, 40%);">+ LE_BYTE0(wTransferSize), LE_BYTE1(wTransferSize), \</span><br><span style="color: hsl(120, 100%, 40%);">+   LE_BYTE0(bcdDFUVersion), LE_BYTE1(bcdDFUVersion)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+COMPILER_PACK_RESET()</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%);">+//! USB DFU Request IDs</span><br><span style="color: hsl(120, 100%, 40%);">+enum usb_dfu_req {</span><br><span style="color: hsl(120, 100%, 40%);">+    USB_DFU_DETACH,</span><br><span style="color: hsl(120, 100%, 40%);">+       USB_DFU_DNLOAD,</span><br><span style="color: hsl(120, 100%, 40%);">+       USB_DFU_UPLOAD,</span><br><span style="color: hsl(120, 100%, 40%);">+       USB_DFU_GETSTATUS,</span><br><span style="color: hsl(120, 100%, 40%);">+    USB_DFU_CLRSTATUS,</span><br><span style="color: hsl(120, 100%, 40%);">+    USB_DFU_GETSTATE,</span><br><span style="color: hsl(120, 100%, 40%);">+     USB_DFU_ABORT,</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%);">+//! USB DFU Device Status IDs</span><br><span style="color: hsl(120, 100%, 40%);">+enum usb_dfu_status {</span><br><span style="color: hsl(120, 100%, 40%);">+    USB_DFU_STATUS_OK,</span><br><span style="color: hsl(120, 100%, 40%);">+    USB_DFU_STATUS_ERR_TARGET,</span><br><span style="color: hsl(120, 100%, 40%);">+    USB_DFU_STATUS_ERR_FILE,</span><br><span style="color: hsl(120, 100%, 40%);">+      USB_DFU_STATUS_ERR_WRITE,</span><br><span style="color: hsl(120, 100%, 40%);">+     USB_DFU_STATUS_ERR_ERASE,</span><br><span style="color: hsl(120, 100%, 40%);">+     USB_DFU_STATUS_ERR_CHECK_ERASED,</span><br><span style="color: hsl(120, 100%, 40%);">+      USB_DFU_STATUS_ERR_PROG,</span><br><span style="color: hsl(120, 100%, 40%);">+      USB_DFU_STATUS_ERR_VERIFY,</span><br><span style="color: hsl(120, 100%, 40%);">+    USB_DFU_STATUS_ERR_ADDRESS,</span><br><span style="color: hsl(120, 100%, 40%);">+   USB_DFU_STATUS_ERR_NOTDONE,</span><br><span style="color: hsl(120, 100%, 40%);">+   USB_DFU_STATUS_ERR_FIRMWARE,</span><br><span style="color: hsl(120, 100%, 40%);">+  USB_DFU_STATUS_ERR_VENDOR,</span><br><span style="color: hsl(120, 100%, 40%);">+    USB_DFU_STATUS_ERR_USBR,</span><br><span style="color: hsl(120, 100%, 40%);">+      USB_DFU_STATUS_ERR_POR,</span><br><span style="color: hsl(120, 100%, 40%);">+       USB_DFU_STATUS_ERR_UNKNOWN,</span><br><span style="color: hsl(120, 100%, 40%);">+   USB_DFU_STATUS_ERR_STALLEDPKT,</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%);">+//! USB DFU Device State IDs</span><br><span style="color: hsl(120, 100%, 40%);">+enum usb_dfu_state {</span><br><span style="color: hsl(120, 100%, 40%);">+      USB_DFU_STATE_APP_IDLE,</span><br><span style="color: hsl(120, 100%, 40%);">+       USB_DFU_STATE_APP_DETACH,</span><br><span style="color: hsl(120, 100%, 40%);">+     USB_DFU_STATE_DFU_IDLE,</span><br><span style="color: hsl(120, 100%, 40%);">+       USB_DFU_STATE_DFU_DNLOAD_SYNC,</span><br><span style="color: hsl(120, 100%, 40%);">+        USB_DFU_STATE_DFU_DNBUSY,</span><br><span style="color: hsl(120, 100%, 40%);">+     USB_DFU_STATE_DFU_DNLOAD_IDLE,</span><br><span style="color: hsl(120, 100%, 40%);">+        USB_DFU_STATE_DFU_MANIFEST_SYNC,</span><br><span style="color: hsl(120, 100%, 40%);">+      USB_DFU_STATE_DFU_MANIFEST,</span><br><span style="color: hsl(120, 100%, 40%);">+   USB_DFU_STATE_DFU_MANIFEST_WAIT_RESET,</span><br><span style="color: hsl(120, 100%, 40%);">+        USB_DFU_STATE_DFU_UPLOAD_IDLE,</span><br><span style="color: hsl(120, 100%, 40%);">+        USB_DFU_STATE_DFU_ERROR,</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%);">+#endif // _USB_PROTOCOL_DFU_H_</span><br><span>diff --git a/sysmoOCTSIM/usb_start.c b/sysmoOCTSIM/usb_start.c</span><br><span>index 1c1672c..f737dc4 100644</span><br><span>--- a/sysmoOCTSIM/usb_start.c</span><br><span>+++ b/sysmoOCTSIM/usb_start.c</span><br><span>@@ -138,6 +138,8 @@</span><br><span>        /* usbdc_register_funcion inside */</span><br><span>  cdcdf_acm_init();</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ dfudf_init();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>      printf("usb_descs_size=%u\r\n", usb_descs[0].eod - usb_descs[0].sod);</span><br><span>      usbdc_start((struct usbd_descriptors *) usb_descs);</span><br><span>  usbdc_attach();</span><br><span>diff --git a/sysmoOCTSIM/usb_start.h b/sysmoOCTSIM/usb_start.h</span><br><span>index a99d1ad..089c58d 100644</span><br><span>--- a/sysmoOCTSIM/usb_start.h</span><br><span>+++ b/sysmoOCTSIM/usb_start.h</span><br><span>@@ -15,6 +15,8 @@</span><br><span> #include "cdcdf_acm.h"</span><br><span> #include "cdcdf_acm_desc.h"</span><br><span> #include "ccid_df.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "dfudf.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "dfudf_desc.h"</span><br><span> </span><br><span> void usb_start(void);</span><br><span> void cdc_device_acm_init(void);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/17034">change 17034</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/c/osmo-ccid-firmware/+/17034"/><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-Change-Id: I04d05054d1c0e3988b8eafd93c6524f4a0489cb7 </div>
<div style="display:none"> Gerrit-Change-Number: 17034 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Hoernchen <ewild@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>