18#ifndef __VSF_USBD_DFU_H__
19#define __VSF_USBD_DFU_H__
25#if VSF_USE_USB_DEVICE == ENABLED && VSF_USBD_USE_DFU == ENABLED
27#include "../../../common/class/DFU/vsf_usb_DFU.h"
30#if defined(__VSF_USBD_DFU_CLASS_IMPLEMENT)
31# undef __VSF_USBD_DFU_CLASS_IMPLEMENT
32# define __VSF_CLASS_IMPLEMENT__
33#elif defined(__VSF_USBD_DFU_CLASS_INHERIT__)
34# undef __VSF_USBD_DFU_CLASS_INHERIT__
35# define __VSF_CLASS_INHERIT__
45#define USB_DFU_IFS_NUM 1
47#define __usbd_dfu_desc_iad(__name, __ifs_start, __i_func, __protocol, __dfu_attr, __detach_timeout, __transfer_size)\
48 USB_DESC_DFU_IAD((__ifs_start), (__i_func), (__protocol), (__dfu_attr), (__detach_timeout), (__transfer_size))
49#define __usbd_dfu_desc(__name, __ifs_start, __i_func, __protocol, __dfu_attr, __detach_timeout, __transfer_size)\
50 USB_DESC_DFU((__ifs_start), (__i_func), (__protocol), (__dfu_attr), (__detach_timeout), (__transfer_size))
52#define USB_DFU_PARAM(__PROTOCOL, __DFU_ATTR, __TRANSFER_SIZE, __TRANSFER_BUFFER)\
53 .protocol = (__PROTOCOL), \
54 .attribute = (__DFU_ATTR), \
55 .transfer_size = (__TRANSFER_SIZE), \
56 .transfer_buffer = (__TRANSFER_BUFFER),
58#define __usbd_dfu_func1(__name, __func_id, __protocol, __dfu_attr, __transfer_size, __transfer_buffer)\
59 vk_usbd_dfu_t __##__name##_DFU##__func_id = { \
60 USB_DFU_PARAM((__protocol), (__dfu_attr), (__transfer_size), (__transfer_buffer))\
62#define __usbd_dfu_func0(__name, __func_id, __protocol, __dfu_attr, __transfer_size)\
63 static uint8_t __##__name##_DFU##__transfer_buffer[__transfer_size];\
64 __usbd_dfu_func1(__name, __func_id, (__protocol), (__dfu_attr), (__transfer_size), __##__name##_DFU##__transfer_buffer)
66#define __usbd_dfu_func(__name, __func_id, __protocol, __dfu_attr, __transfer_size, ...)\
67 __PLOOC_EVAL(__usbd_dfu_func, __VA_ARGS__)(__name, __func_id, (__protocol), (__dfu_attr), (__transfer_size), ##__VA_ARGS__)
69#define __usbd_dfu_ifs(__name, __func_id) \
70 USB_IFS(&vk_usbd_dfu, &__##__name##_DFU##__func_id)
72#define usbd_dfu_desc(__name, __ifs_start, __i_func, __protocol, __dfu_attr, __detach_timeout, __transfer_size)\
73 __usbd_dfu_desc(__name, (__ifs_start), __i_func, (__protocol), (__dfu_attr), (__detach_timeout), (__transfer_size))
74#define usbd_dfu_desc_iad(__name, __ifs_start, __i_func, __protocol, __dfu_attr, __detach_timeout, __transfer_size)\
75 __usbd_dfu_desc_iad(__name, (__ifs_start), __i_func, (__protocol), (__dfu_attr), (__transfer_size))
76#define usbd_dfu_func(__name, __func_id, __protocol, __dfu_attr, __transfer_size, ...)\
77 __usbd_dfu_func(__name, __func_id, (__protocol), (__dfu_attr), (__transfer_size), ##__VA_ARGS__)
78#define usbd_dfu_ifs(__name, __func_id) \
79 __usbd_dfu_ifs(__name, __func_id)
vsf_err_t
Definition __type.h:42
Definition vsf_usbd_DFU.h:84
unsigned short uint16_t
Definition lvgl.h:41
unsigned int uint32_t
Definition lvgl.h:43
unsigned char uint8_t
Definition lvgl.h:40
#define vsf_class(__name)
Definition ooc_class.h:48
Definition vsf_usb_DFU.h:106
uint8_t status
Definition vsf_tgui.h:139
const vk_usbd_class_op_t vk_usbd_dfu
void vk_usbd_dfu_downloaded(vk_usbd_dfu_t *dfu, vsf_err_t result)