usbd_dfu_core.h
Go to the documentation of this file.
1 
28 /* Includes ------------------------------------------------------------------*/
29 
30 #ifndef __USB_DFU_CORE_H_
31 #define __USB_DFU_CORE_H_
32 
33 #include "usbd_ioreq.h"
34 #include "usbd_dfu_mal.h"
35 
49 #define USB_DFU_CONFIG_DESC_SIZ (18 + (9 * USBD_ITF_MAX_NUM))
50 #define USB_DFU_DESC_SIZ 9
51 
52 #define DFU_DESCRIPTOR_TYPE 0x21
53 
54 
55 /*---------------------------------------------------------------------*/
56 /* DFU definitions */
57 /*---------------------------------------------------------------------*/
58 
59 
60 
61 /**************************************************/
62 /* DFU Requests DFU states */
63 /**************************************************/
64 
65 
66 #define STATE_appIDLE 0
67 #define STATE_appDETACH 1
68 #define STATE_dfuIDLE 2
69 #define STATE_dfuDNLOAD_SYNC 3
70 #define STATE_dfuDNBUSY 4
71 #define STATE_dfuDNLOAD_IDLE 5
72 #define STATE_dfuMANIFEST_SYNC 6
73 #define STATE_dfuMANIFEST 7
74 #define STATE_dfuMANIFEST_WAIT_RESET 8
75 #define STATE_dfuUPLOAD_IDLE 9
76 #define STATE_dfuERROR 10
77 
78 /**************************************************/
79 /* DFU Requests DFU status */
80 /**************************************************/
81 
82 #define STATUS_OK 0x00
83 #define STATUS_ERRTARGET 0x01
84 #define STATUS_ERRFILE 0x02
85 #define STATUS_ERRWRITE 0x03
86 #define STATUS_ERRERASE 0x04
87 #define STATUS_ERRCHECK_ERASED 0x05
88 #define STATUS_ERRPROG 0x06
89 #define STATUS_ERRVERIFY 0x07
90 #define STATUS_ERRADDRESS 0x08
91 #define STATUS_ERRNOTDONE 0x09
92 #define STATUS_ERRFIRMWARE 0x0A
93 #define STATUS_ERRVENDOR 0x0B
94 #define STATUS_ERRUSBR 0x0C
95 #define STATUS_ERRPOR 0x0D
96 #define STATUS_ERRUNKNOWN 0x0E
97 #define STATUS_ERRSTALLEDPKT 0x0F
98 
99 /**************************************************/
100 /* DFU Requests DFU states Manifestation State */
101 /**************************************************/
102 
103 #define Manifest_complete 0x00
104 #define Manifest_In_Progress 0x01
105 
106 
107 /**************************************************/
108 /* Special Commands with Download Request */
109 /**************************************************/
110 
111 #define CMD_GETCOMMANDS 0x00
112 #define CMD_SETADDRESSPOINTER 0x21
113 #define CMD_ERASE 0x41
114 
115 /**************************************************/
116 /* Other defines */
117 /**************************************************/
118 /* Bit Detach capable = bit 3 in bmAttributes field */
119 #define DFU_DETACH_MASK (uint8_t)(1 << 4)
120 
128 /**************************************************/
129 /* DFU Requests */
130 /**************************************************/
131 
132 typedef enum _DFU_REQUESTS {
140 } DFU_REQUESTS;
141 
142 typedef void (*pFunction)(void);
152 /********** Descriptor of DFU interface 0 Alternate setting n ****************/
153 #define USBD_DFU_IF_DESC(n) 0x09, /* bLength: Interface Descriptor size */ \
154  USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \
155  0x00, /* bInterfaceNumber: Number of Interface */ \
156  (n), /* bAlternateSetting: Alternate setting */ \
157  0x00, /* bNumEndpoints*/ \
158  0xFE, /* bInterfaceClass: Application Specific Class Code */ \
159  0x01, /* bInterfaceSubClass : Device Firmware Upgrade Code */ \
160  0x02, /* nInterfaceProtocol: DFU mode protocol */ \
161  USBD_IDX_INTERFACE_STR + (n) + 1 /* iInterface: Index of string descriptor */ \
162  /* 18 */
163 
184 #endif // __USB_DFU_CORE_H_
185 
193 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
enum _DFU_REQUESTS DFU_REQUESTS
_DFU_REQUESTS
Header for usbd_dfu_mal.c file.
header file for the usbd_ioreq.c file
void(* pFunction)(void)
USBD_Class_cb_TypeDef DFU_cb


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:50