AN050
GD32 USBFS&USBHS Firmware Library User Guide
38
Table 5-13. DFU device class interface functions
usb_class_core dfu_class
=
{
.
init
=
dfu_init
,
.
deinit
=
dfu_deinit
,
.
req_proc
=
dfu_req_handler
,
.
ctlx_in
=
dfu_ctlx_in
};
Table 5-13
. DFU device class interface functions
Function name
Functional description
dfu_init
initialize DFU device
dfu_deinit
deinitialize DFU device
dfu_req_handler
DFU device class request function
dfu_ctlx_in
IN control transfer callback
DFU device class request
DFU include device class request is shown in
Table 5-14. DFU device class request
Table 5-14
. DFU device class request
Request name
value
Functional description
DFU_DETACH
0
DFU detach
DFU_DNLOAD
1
Download
DFU_UPLOAD
2
Upload
DFU_GETSTATUS
3
Get status
DFU_CLRSTATUS
4
Clear status
DFU_GETSTATE
5
Get state
DFU_ABORT
6
abort
DFU user interface
DFU user interface is flash operation corresponding function, which is shown in below
structure.
dfu_mal_prop DFU_Flash_cb
=
{
(
const
uint8_t
*)
FLASH_IF_STRING
,
flash_if_init
,
flash_if_deinit
,
flash_if_erase
,
flash_if_write
,
flash_if_read
,
flash_if_checkaddr
,
60
,
/* flash erase timeout in ms */
80
/* flash programming timeout in ms (80us * RAM Buffer size (1024 Bytes) */