mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-18 02:42:37 +00:00
Update
This commit is contained in:
parent
c2b9ac9dd4
commit
cf4220a9fb
@ -76,6 +76,7 @@
|
|||||||
#define CFG_TUD_ENDPOINT0_SIZE 64
|
#define CFG_TUD_ENDPOINT0_SIZE 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// DFU buffer size, must to be set to the largest buffer size used by an any given storage type
|
||||||
#define CFG_TUD_DFU_TRANSFER_BUFFER_SIZE 4096
|
#define CFG_TUD_DFU_TRANSFER_BUFFER_SIZE 4096
|
||||||
|
|
||||||
//------------- CLASS -------------//
|
//------------- CLASS -------------//
|
||||||
|
@ -147,6 +147,7 @@ void dfu_moded_init(void)
|
|||||||
_dfu_state_ctx.status = DFU_STATUS_OK;
|
_dfu_state_ctx.status = DFU_STATUS_OK;
|
||||||
_dfu_state_ctx.attrs = 0;
|
_dfu_state_ctx.attrs = 0;
|
||||||
_dfu_state_ctx.blk_transfer_in_proc = false;
|
_dfu_state_ctx.blk_transfer_in_proc = false;
|
||||||
|
_dfu_state_ctx.alt = 0;
|
||||||
|
|
||||||
dfu_debug_print_context();
|
dfu_debug_print_context();
|
||||||
}
|
}
|
||||||
@ -158,6 +159,8 @@ void dfu_moded_reset(uint8_t rhport)
|
|||||||
_dfu_state_ctx.state = DFU_IDLE;
|
_dfu_state_ctx.state = DFU_IDLE;
|
||||||
_dfu_state_ctx.status = DFU_STATUS_OK;
|
_dfu_state_ctx.status = DFU_STATUS_OK;
|
||||||
_dfu_state_ctx.blk_transfer_in_proc = false;
|
_dfu_state_ctx.blk_transfer_in_proc = false;
|
||||||
|
_dfu_state_ctx.alt = 0;
|
||||||
|
|
||||||
dfu_debug_print_context();
|
dfu_debug_print_context();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,13 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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)
|
// 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
|
// 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
|
// 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.
|
// 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);
|
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
|
// 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
|
// Invoked when a DFU_UPLOAD request is received
|
||||||
// This callback must populate data with up to length bytes
|
// This callback must populate data with up to length bytes
|
||||||
// Return the number of bytes to write
|
// 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);
|
TU_ATTR_WEAK uint16_t tud_dfu_req_upload_data_cb(uint8_t alt, uint16_t block_num, uint8_t* data, uint16_t length);
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
Loading…
x
Reference in New Issue
Block a user