summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorMasterPhi <[email protected]>2021-07-06 18:03:05 +0200
committerMasterPhi <[email protected]>2021-07-06 18:04:24 +0200
commitcf4220a9fb24279b423656257cea39b3ab68aa67 (patch)
treedd6f9b740e05beac42881128f357aa705e26992b /src/class
parentc2b9ac9dd415505350c40f6830c1d211de67c342 (diff)
Update
Diffstat (limited to 'src/class')
-rw-r--r--src/class/dfu/dfu_device.c3
-rw-r--r--src/class/dfu/dfu_device.h11
2 files changed, 12 insertions, 2 deletions
diff --git a/src/class/dfu/dfu_device.c b/src/class/dfu/dfu_device.c
index 9eafca359..a186e9140 100644
--- a/src/class/dfu/dfu_device.c
+++ b/src/class/dfu/dfu_device.c
@@ -147,6 +147,7 @@ void dfu_moded_init(void)
_dfu_state_ctx.status = DFU_STATUS_OK;
_dfu_state_ctx.attrs = 0;
_dfu_state_ctx.blk_transfer_in_proc = false;
+ _dfu_state_ctx.alt = 0;
dfu_debug_print_context();
}
@@ -158,6 +159,8 @@ void dfu_moded_reset(uint8_t rhport)
_dfu_state_ctx.state = DFU_IDLE;
_dfu_state_ctx.status = DFU_STATUS_OK;
_dfu_state_ctx.blk_transfer_in_proc = false;
+ _dfu_state_ctx.alt = 0;
+
dfu_debug_print_context();
}
diff --git a/src/class/dfu/dfu_device.h b/src/class/dfu/dfu_device.h
index d5bc88ab2..c5c1ede28 100644
--- a/src/class/dfu/dfu_device.h
+++ b/src/class/dfu/dfu_device.h
@@ -33,6 +33,13 @@
extern "C" {
#endif
+//--------------------------------------------------------------------+
+// Class Driver Default Configure & Validation
+//--------------------------------------------------------------------+
+
+#if !defined(CFG_TUD_DFU_TRANSFER_BUFFER_SIZE)
+ #error " CFG_TUD_DFU_TRANSFER_BUFFER_SIZE must be defined, it have to be set to the largest buffer size used by an any given storage type"
+#endif
//--------------------------------------------------------------------+
// Application Callback API (weak is optional)
@@ -45,7 +52,7 @@ bool tud_dfu_firmware_valid_check_cb(uint8_t alt);
// This callback takes the wBlockNum chunk of length length and provides it
// to the application at the data pointer. This data is only valid for this
// call, so the app must use it not or copy it.
-// alt is used as the partition number, in order to multiple partitions like FLASH, EEPROM, etc.
+// alt is used as the partition number, in order to support multiple partitions like FLASH, EEPROM, etc.
void tud_dfu_req_dnload_data_cb(uint8_t alt, uint16_t wBlockNum, uint8_t* data, uint16_t length);
// Must be called when the application is done using the last block of data
@@ -65,7 +72,7 @@ TU_ATTR_WEAK void tud_dfu_abort_cb(void);
// Invoked when a DFU_UPLOAD request is received
// This callback must populate data with up to length bytes
// Return the number of bytes to write
-// alt is used as the partition number, in order to multiple partitions like FLASH, EEPROM, etc.
+// alt is used as the partition number, in order to support multiple partitions like FLASH, EEPROM, etc.
TU_ATTR_WEAK uint16_t tud_dfu_req_upload_data_cb(uint8_t alt, uint16_t block_num, uint8_t* data, uint16_t length);
//--------------------------------------------------------------------+