Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/12506


Change subject: make USB descriptor available for the two state machines
......................................................................

make USB descriptor available for the two state machines

this is required to know the DFU bmAttributes since they affect
the state machine

Change-Id: Ib3907423bb9e197f53ed4522e8a5789a3d29489e
---
M usb/class/dfu/device/dfudf.c
M usb/class/dfu/device/dfudf_desc.h
M usb_start.c
3 files changed, 15 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/06/12506/1

diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c
index 15a89fc..42b708b 100644
--- a/usb/class/dfu/device/dfudf.c
+++ b/usb/class/dfu/device/dfudf.c
@@ -22,8 +22,9 @@

 #include "dfudf.h"
 #include "usb_protocol_dfu.h"
+#include "dfudf_desc.h"

-/** USB Device DFU Fucntion Specific Data */
+/** USB Device DFU Function Specific Data */
 struct dfudf_func_data {
        /** DFU Interface information */
        uint8_t func_iface;
@@ -34,6 +35,10 @@
 static struct usbdf_driver _dfudf;
 static struct dfudf_func_data _dfudf_funcd;

+/** USB DFU functional descriptor (with DFU attributes) */
+static const uint8_t usb_dfu_func_desc_bytes[] = {DFUD_IFACE_DESCB};
+static const usb_dfu_func_desc_t* usb_dfu_func_desc = 
(usb_dfu_func_desc_t*)&usb_dfu_func_desc_bytes;
+
 enum usb_dfu_state dfu_state = USB_DFU_STATE_DFU_IDLE;
 enum usb_dfu_status dfu_status = USB_DFU_STATUS_OK;

diff --git a/usb/class/dfu/device/dfudf_desc.h 
b/usb/class/dfu/device/dfudf_desc.h
index 5590e16..cd6ba41 100644
--- a/usb/class/dfu/device/dfudf_desc.h
+++ b/usb/class/dfu/device/dfudf_desc.h
@@ -75,6 +75,11 @@
                                   CONF_USB_DFUD_BMATTRI, \
                                   CONF_USB_DFUD_BMAXPOWER)

+#define DFUD_IFACE_DESCB 
USB_DFU_FUNC_DESC_BYTES(USB_DFU_ATTRIBUTES_CAN_DOWNLOAD | 
USB_DFU_ATTRIBUTES_WILL_DETACH, \
+                                                    0, /**< detaching makes 
only sense in run-time mode */ \
+                                                    512, /**< transfer size 
corresponds to page size for optimal flash writing */ \
+                                                    0x0110 /**< DFU 
specification version 1.1 used */ )
+
 #define DFUD_IFACE_DESCES \
        USB_IFACE_DESC_BYTES(CONF_USB_DFUD_BIFCNUM, \
                             CONF_USB_DFUD_BALTSET, \
@@ -83,10 +88,7 @@
                             USB_DFU_SUBCLASS, \
                             USB_DFU_PROTOCOL_DFU, \
                             CONF_USB_DFUD_IINTERFACE), \
-                            
USB_DFU_FUNC_DESC_BYTES(USB_DFU_ATTRIBUTES_CAN_DOWNLOAD | 
USB_DFU_ATTRIBUTES_WILL_DETACH, \
-                                                    0, /**< detaching makes 
only sense in run-time mode */ \
-                                                    1024, /**< transfer size 
corresponds to page size for optimal flash writing */ \
-                                                    0x0110 /**< DFU 
specification version 1.1 used */ )
+                            DFUD_IFACE_DESCB

 #define DFUD_STR_DESCES \
        CONF_USB_DFUD_LANGID_DESC \
diff --git a/usb_start.c b/usb_start.c
index 4f9f875..d911db4 100644
--- a/usb_start.c
+++ b/usb_start.c
@@ -39,6 +39,9 @@
 #endif
 };

+/** USB DFU functional descriptor (with DFU attributes) */
+static const uint8_t usb_dfu_func_desc_bytes[] = {DFUD_IFACE_DESCB};
+static const usb_dfu_func_desc_t* usb_dfu_func_desc = 
(usb_dfu_func_desc_t*)&usb_dfu_func_desc_bytes;
 /** Ctrl endpoint buffer */
 static uint8_t ctrl_buffer[64];


--
To view, visit https://gerrit.osmocom.org/12506
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-asf4-dfu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3907423bb9e197f53ed4522e8a5789a3d29489e
Gerrit-Change-Number: 12506
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <[email protected]>

Reply via email to