laforge submitted this change.
dfu: download: make variables between IRQ and main loop volatile
Both are access by IRQ and mainloop and are written by the IRQ handler.
Change-Id: Ic3dccd77eff7feb164f9f07047680eef3f7c2516
---
M usb/class/dfu/device/dfudf.c
M usb/class/dfu/device/dfudf.h
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c
index 389f07f..7388060 100644
--- a/usb/class/dfu/device/dfudf.c
+++ b/usb/class/dfu/device/dfudf.c
@@ -43,8 +43,8 @@
volatile 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_offset = 0;
+volatile uint16_t dfu_download_length = 0;
+volatile size_t dfu_download_offset = 0;
/* buffer the first block, to write it last */
uint8_t dfu_download_data_first[512];
diff --git a/usb/class/dfu/device/dfudf.h b/usb/class/dfu/device/dfudf.h
index 390aace..15d6ad3 100644
--- a/usb/class/dfu/device/dfudf.h
+++ b/usb/class/dfu/device/dfudf.h
@@ -48,9 +48,9 @@
*/
extern uint8_t dfu_download_data[512];
/** Length of downloaded data in bytes */
-extern uint16_t dfu_download_length;
+extern volatile uint16_t dfu_download_length;
/** Offset of where the downloaded data should be flashed in bytes */
-extern size_t dfu_download_offset;
+extern volatile size_t dfu_download_offset;
extern uint8_t dfu_download_data_first[512];
extern volatile uint16_t dfu_download_length_first;
To view, visit change 42322. To unsubscribe, or for help writing mail filters, visit settings.