aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKévin Redon <kredon@sysmocom.de>2019-01-03 18:10:53 +0100
committerKévin Redon <kredon@sysmocom.de>2019-01-16 18:41:23 +0100
commit2f8fcbbef6117af05812ff0676587ab45cef3234 (patch)
tree4ae690ce8eb967d7f398865bcca9e7b4ec7b816b
parentd25509abca2baed8dad4f39a6aea27edd914b77f (diff)
declare variables so the main loop can read the data to be flashed provided by the USB stack
-rw-r--r--usb/class/dfu/device/dfudf.c9
-rw-r--r--usb/class/dfu/device/dfudf.h18
2 files changed, 25 insertions, 2 deletions
diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c
index f3286a1..15a89fc 100644
--- a/usb/class/dfu/device/dfudf.c
+++ b/usb/class/dfu/device/dfudf.c
@@ -34,8 +34,13 @@ struct dfudf_func_data {
static struct usbdf_driver _dfudf;
static struct dfudf_func_data _dfudf_funcd;
-static enum usb_dfu_state dfu_state = USB_DFU_STATE_DFU_IDLE; /**< current DFU state */
-static enum usb_dfu_status dfu_status = USB_DFU_STATUS_OK; /**< current DFU status */
+enum usb_dfu_state dfu_state = USB_DFU_STATE_DFU_IDLE;
+enum usb_dfu_status dfu_status = USB_DFU_STATUS_OK;
+
+uint8_t dfu_download_data[512];
+uint16_t dfu_download_length = 0;
+size_t dfu_download_progress = 0;
+bool dfu_manifestation_complete = false;
/**
* \brief Enable DFU Function
diff --git a/usb/class/dfu/device/dfudf.h b/usb/class/dfu/device/dfudf.h
index ba5cdd5..a19b569 100644
--- a/usb/class/dfu/device/dfudf.h
+++ b/usb/class/dfu/device/dfudf.h
@@ -35,6 +35,24 @@
#define USBDF_DFU_H_
#include "usbdc.h"
+#include "usb_protocol_dfu.h"
+
+/** Current DFU state */
+extern enum usb_dfu_state dfu_state;
+/**< Current DFU status */
+extern enum usb_dfu_status dfu_status;
+
+/** Downloaded data to be programmed in flash
+ *
+ * 512 is the flash page size of the SAM D5x/E5x
+ */
+extern uint8_t dfu_download_data[512];
+/** Length of downloaded data in bytes */
+extern uint16_t dfu_download_length;
+/** Progress of the already downloaded data in bytes */
+extern size_t dfu_download_progress;
+/** If manifestation (firmware flash and check) is complete */
+extern bool dfu_manifestation_complete;
/**
* \brief Initialize the USB DFU Function Driver