Add alt settings support in DFU class.

This commit is contained in:
Mengsk
2021-07-05 17:56:21 +02:00
parent 2ae19ce40d
commit c2d8ed3fd1
5 changed files with 56 additions and 41 deletions

View File

@@ -39,13 +39,14 @@
//--------------------------------------------------------------------+
// Invoked during DFU_MANIFEST_SYNC get status request to check if firmware
// is valid
bool tud_dfu_firmware_valid_check_cb(void);
bool tud_dfu_firmware_valid_check_cb(uint8_t alt);
// Invoked when a DFU_DNLOAD request is received
// 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.
void tud_dfu_req_dnload_data_cb(uint16_t wBlockNum, uint8_t* data, uint16_t length);
// alt is used as the partition number, in order to 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
// provided by tud_dfu_req_dnload_data_cb
@@ -56,7 +57,7 @@ void tud_dfu_dnload_complete(void);
// Return true if the application agrees there is no more data
// Return false if the device disagrees, which will stall the pipe, and the Host
// should initiate a recovery procedure
bool tud_dfu_device_data_done_check_cb(void);
bool tud_dfu_device_data_done_check_cb(uint8_t alt);
// Invoked when the Host has terminated a download or upload transfer
TU_ATTR_WEAK void tud_dfu_abort_cb(void);
@@ -64,7 +65,8 @@ 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
uint16_t tud_dfu_req_upload_data_cb(uint16_t block_num, uint8_t* data, uint16_t length);
// alt is used as the partition number, in order to 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);
//--------------------------------------------------------------------+
// Internal Class Driver API