From 2f8fcbbef6117af05812ff0676587ab45cef3234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Redon?= Date: Thu, 3 Jan 2019 18:10:53 +0100 Subject: declare variables so the main loop can read the data to be flashed provided by the USB stack Change-Id: I092357aad95abef1a781be1ea77944f2ea523dab --- usb/class/dfu/device/dfudf.c | 9 +++++++-- usb/class/dfu/device/dfudf.h | 18 ++++++++++++++++++ 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 -- cgit v1.2.3