STM32_USB_Device_Library
Select one of the symbols to view example projects that use it.
Symbol previews are coming soon...
Outline
#define __USB_DFU_H
#include "usbd_ioreq.h"
#define USBD_DFU_MAX_ITF_NUM
#define USBD_DFU_XFER_SIZE
#define USBD_DFU_APP_DEFAULT_ADD
#define USBD_DFU_BM_ATTRIBUTES
#define USBD_DFU_DETACH_TIMEOUT
#define USB_DFU_CONFIG_DESC_SIZ
#define USB_DFU_DESC_SIZ
#define DFU_DESCRIPTOR_TYPE
#define DFU_VENDOR_CMD_MAX
...
#define APP_STATE_IDLE
#define APP_STATE_DETACH
#define DFU_STATE_IDLE
#define DFU_STATE_DNLOAD_SYNC
#define DFU_STATE_DNLOAD_BUSY
#define DFU_STATE_DNLOAD_IDLE
#define DFU_STATE_MANIFEST_SYNC
#define DFU_STATE_MANIFEST
#define DFU_STATE_MANIFEST_WAIT_RESET
#define DFU_STATE_UPLOAD_IDLE
#define DFU_STATE_ERROR
...
#define DFU_ERROR_NONE
#define DFU_ERROR_TARGET
#define DFU_ERROR_FILE
#define DFU_ERROR_WRITE
#define DFU_ERROR_ERASE
#define DFU_ERROR_CHECK_ERASED
#define DFU_ERROR_PROG
#define DFU_ERROR_VERIFY
#define DFU_ERROR_ADDRESS
#define DFU_ERROR_NOTDONE
#define DFU_ERROR_FIRMWARE
#define DFU_ERROR_VENDOR
#define DFU_ERROR_USB
#define DFU_ERROR_POR
#define DFU_ERROR_UNKNOWN
#define DFU_ERROR_STALLEDPKT
...
#define DFU_MANIFEST_COMPLETE
#define DFU_MANIFEST_IN_PROGRESS
...
#define DFU_CMD_GETCOMMANDS
#define DFU_CMD_SETADDRESSPOINTER
#define DFU_CMD_ERASE
#define DFU_MEDIA_ERASE
#define DFU_MEDIA_PROGRAM
#define DFU_DETACH_MASK
#define DFU_MANIFEST_MASK
#define DFU_STATUS_DEPTH
#define IS_DFU_DOWNLOAD
#define IS_DFU_UPLOAD
#define IS_DFU_SETADDRESSPOINTER
#define IS_DFU_PHY_ADDRESS
DFU_RequestTypeDef
DFU_DETACH
DFU_DNLOAD
DFU_UPLOAD
DFU_GETSTATUS
DFU_CLRSTATUS
DFU_GETSTATE
DFU_ABORT
pFunction
#define TRANSFER_SIZE_BYTES
#define IS_PROTECTED_AREA
USBD_DFU_HandleTypeDef
<anonymous union>
d32
d8
buffer
wblock_num
wlength
data_ptr
app_addr_ptr
alt_setting
dev_status
ReservedForAlign
dev_state
manif_state
USBD_DFU_MediaTypeDef
pStrDesc
Init
DeInit
Erase
Write
Read
GetStatus
USBD_DFUFuncDescTypeDef
bLength
bDescriptorType
bmAttributes
wDetachTimeout
wTransferSze
bcdDFUVersion
USBD_DFU;
#define USBD_DFU_CLASS
USBD_DFU_RegisterMedia(USBD_HandleTypeDef *, USBD_DFU_MediaTypeDef *);
Files
loading...
SourceVu
STM32 Libraries and Samples
STM32_USB_Device_Library
Class/DFU/Inc/usbd_dfu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
/**
******************************************************************************
* @file usbd_dfu.h
* @author MCD Application Team
* @brief Header file for the usbd_dfu.c file.
******************************************************************************
* @attention
*
* Copyright (c) 2015 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* ... */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef
__USB_DFU_H
#define
__USB_DFU_H
#ifdef
__cplusplus
extern
"C"
{
#endif
/* Includes ------------------------------------------------------------------*/
#include
"
usbd_ioreq.h"
/** @addtogroup STM32_USB_DEVICE_LIBRARY
* @{
*/
/* ... */
/** @defgroup USBD_DFU
* @brief This file is the Header file for usbd_dfu.c
* @{
*/
/* ... */
/** @defgroup USBD_DFU_Exported_Defines
* @{
*/
/* ... */
#ifndef
USBD_DFU_MAX_ITF_NUM
#define
USBD_DFU_MAX_ITF_NUM
1U
#endif
/* USBD_DFU_MAX_ITF_NUM */
#ifndef
USBD_DFU_XFER_SIZE
#define
USBD_DFU_XFER_SIZE
1024U
#endif
/* USBD_DFU_XFER_SIZE */
#ifndef
USBD_DFU_APP_DEFAULT_ADD
#define
USBD_DFU_APP_DEFAULT_ADD
0x08008000U
/* The first sector (32 KB) is reserved for DFU code */
#endif
/* USBD_DFU_APP_DEFAULT_ADD */
#ifndef
USBD_DFU_BM_ATTRIBUTES
#define
USBD_DFU_BM_ATTRIBUTES
0x0BU
#endif
/* USBD_DFU_BM_ATTRIBUTES */
#ifndef
USBD_DFU_DETACH_TIMEOUT
#define
USBD_DFU_DETACH_TIMEOUT
0xFFU
#endif
/* USBD_DFU_DETACH_TIMEOUT */
#define
USB_DFU_CONFIG_DESC_SIZ
(
18U
+
(
9U
*
USBD_DFU_MAX_ITF_NUM
)
)
#define
USB_DFU_DESC_SIZ
9U
#define
DFU_DESCRIPTOR_TYPE
0x21U
#define
DFU_VENDOR_CMD_MAX
32U
/**************************************************/
/* DFU Requests DFU states */
/**************************************************/
#define
APP_STATE_IDLE
0U
#define
APP_STATE_DETACH
1U
#define
DFU_STATE_IDLE
2U
#define
DFU_STATE_DNLOAD_SYNC
3U
#define
DFU_STATE_DNLOAD_BUSY
4U
#define
DFU_STATE_DNLOAD_IDLE
5U
#define
DFU_STATE_MANIFEST_SYNC
6U
#define
DFU_STATE_MANIFEST
7U
#define
DFU_STATE_MANIFEST_WAIT_RESET
8U
#define
DFU_STATE_UPLOAD_IDLE
9U
#define
DFU_STATE_ERROR
10U
...
/**************************************************/
/* DFU errors */
/**************************************************/
#define
DFU_ERROR_NONE
0x00U
#define
DFU_ERROR_TARGET
0x01U
#define
DFU_ERROR_FILE
0x02U
#define
DFU_ERROR_WRITE
0x03U
#define
DFU_ERROR_ERASE
0x04U
#define
DFU_ERROR_CHECK_ERASED
0x05U
#define
DFU_ERROR_PROG
0x06U
#define
DFU_ERROR_VERIFY
0x07U
#define
DFU_ERROR_ADDRESS
0x08U
#define
DFU_ERROR_NOTDONE
0x09U
#define
DFU_ERROR_FIRMWARE
0x0AU
#define
DFU_ERROR_VENDOR
0x0BU
#define
DFU_ERROR_USB
0x0CU
#define
DFU_ERROR_POR
0x0DU
#define
DFU_ERROR_UNKNOWN
0x0EU
#define
DFU_ERROR_STALLEDPKT
0x0FU
...
/**************************************************/
/* DFU Manifestation State */
/**************************************************/
#define
DFU_MANIFEST_COMPLETE
0x00U
#define
DFU_MANIFEST_IN_PROGRESS
0x01U
...
/**************************************************/
/* Special Commands with Download Request */
/**************************************************/
#define
DFU_CMD_GETCOMMANDS
0x00U
#define
DFU_CMD_SETADDRESSPOINTER
0x21U
#define
DFU_CMD_ERASE
0x41U
#define
DFU_MEDIA_ERASE
0x00U
#define
DFU_MEDIA_PROGRAM
0x01U
...
/**************************************************/
/* Other defines */
/**************************************************/
/* Bit Detach capable = bit 3 in bmAttributes field */
#define
DFU_DETACH_MASK
(
1U
<
<
3
)
#define
DFU_MANIFEST_MASK
(
1U
<
<
2
)
#define
DFU_STATUS_DEPTH
6U
#define
IS_DFU_DOWNLOAD
0x0DFDFU
#define
IS_DFU_UPLOAD
0x1DFDFU
#define
IS_DFU_SETADDRESSPOINTER
0x2DFDFU
#define
IS_DFU_PHY_ADDRESS
0x3DFDFU
45 defines
typedef
enum
{
DFU_DETACH
=
0U
,
DFU_DNLOAD
,
DFU_UPLOAD
,
DFU_GETSTATUS
,
DFU_CLRSTATUS
,
DFU_GETSTATE
,
DFU_ABORT
...
}
DFU_RequestTypeDef
;
typedef
void
(
*
pFunction
)
(
void
)
;
/********** Descriptor of DFU interface 0 Alternate setting n ****************/
#define
USBD_DFU_IF_DESC
(
n
)
\
0x09
,
/* bLength: Interface Descriptor size */
\
USB_DESC_TYPE_INTERFACE
,
/* bDescriptorType */
\
0x00
,
/* bInterfaceNumber: Number of Interface */
\
(
n
)
,
/* bAlternateSetting: Alternate setting */
\
0x00
,
/* bNumEndpoints*/
\
0xFE
,
/* bInterfaceClass: Application Specific Class Code */
\
0x01
,
/* bInterfaceSubClass : Device Firmware Upgrade Code */
\
0x02
,
/* nInterfaceProtocol: DFU mode protocol */
\
USBD_IDX_INTERFACE_STR
+
(
n
)
+
1U
/* iInterface: Index of string descriptor */
...
#define
TRANSFER_SIZE_BYTES
(
size
)
(
(
uint8_t
)
(
size
)
)
,
(
(
uint8_t
)
(
(
size
)
>
>
8
)
)
#define
IS_PROTECTED_AREA
(
add
)
(
uint8_t
)
(
(
(
(
add
)
>=
0x08000000
)
&&
(
(
add
)
<
(
APP_DEFAULT_ADD
)
)
)
?
1
:
0
)
/**
* @}
*/
/* ... */
/** @defgroup USBD_CORE_Exported_TypesDefinitions
* @{
*/
/* ... */
typedef
struct
{
union
{
uint32_t
d32
[
USBD_DFU_XFER_SIZE
/
4U
]
;
uint8_t
d8
[
USBD_DFU_XFER_SIZE
]
;
...
}
buffer
;
uint32_t
wblock_num
;
uint32_t
wlength
;
uint32_t
data_ptr
;
uint32_t
app_addr_ptr
;
uint32_t
alt_setting
;
uint8_t
dev_status
[
DFU_STATUS_DEPTH
]
;
uint8_t
ReservedForAlign
[
2
]
;
uint8_t
dev_state
;
uint8_t
manif_state
;
...
}
USBD_DFU_HandleTypeDef
;
typedef
struct
{
const
uint8_t
*
pStrDesc
;
uint16_t
(
*
Init
)
(
void
)
;
uint16_t
(
*
DeInit
)
(
void
)
;
uint16_t
(
*
Erase
)
(
uint32_t
Add
)
;
uint16_t
(
*
Write
)
(
uint8_t
*
src
,
uint8_t
*
dest
,
uint32_t
Len
)
;
uint8_t
*
(
*
Read
)
(
uint8_t
*
src
,
uint8_t
*
dest
,
uint32_t
Len
)
;
uint16_t
(
*
GetStatus
)
(
uint32_t
Add
,
uint8_t
cmd
,
uint8_t
*
buff
)
;
#if
(
USBD_DFU_VENDOR_CMD_ENABLED
==
1U
)
uint16_t
(
*
GetVendorCMD
)
(
uint8_t
*
cmd
,
uint8_t
*
cmdlength
)
;
uint16_t
(
*
VendorDownloadCMD
)
(
uint8_t
*
pbuf
,
uint32_t
BlockNumber
,
uint32_t
wlength
,
uint32_t
*
status
)
;
uint16_t
(
*
VendorUploadCMD
)
(
uint32_t
Add
,
uint32_t
BlockNumber
,
uint32_t
*
status
)
;
/* ... */
#endif
/* USBD_DFU_VENDOR_CMD_ENABLED */
#if
(
USBD_DFU_VENDOR_CHECK_ENABLED
==
1U
)
uint16_t
(
*
VendorCheck
)
(
uint8_t
*
pbuf
,
uint32_t
ReqType
,
uint32_t
*
status
)
;
#endif
/* USBD_DFU_VENDOR_CHECK_ENABLED */
#if
(
USBD_DFU_VENDOR_EXIT_ENABLED
==
1U
)
uint16_t
(
*
LeaveDFU
)
(
uint32_t
Add
)
;
#endif
/* USBD_DFU_VENDOR_EXIT_ENABLED */
...
}
USBD_DFU_MediaTypeDef
;
typedef
struct
{
uint8_t
bLength
;
uint8_t
bDescriptorType
;
uint8_t
bmAttributes
;
uint16_t
wDetachTimeout
;
uint16_t
wTransferSze
;
uint16_t
bcdDFUVersion
;
...
}
__PACKED
USBD_DFUFuncDescTypeDef
;
/**
* @}
*/
/* ... */
/** @defgroup USBD_CORE_Exported_Macros
* @{
*/
/* ... */
/**
* @}
*/
/* ... */
/** @defgroup USBD_CORE_Exported_Variables
* @{
*/
/* ... */
extern
USBD_ClassTypeDef
USBD_DFU
;
#define
USBD_DFU_CLASS
&
USBD_DFU
/**
* @}
*/
/* ... */
/** @defgroup USB_CORE_Exported_Functions
* @{
*/
/* ... */
uint8_t
USBD_DFU_RegisterMedia
(
USBD_HandleTypeDef
*
pdev
,
USBD_DFU_MediaTypeDef
*
fops
)
;
/**
* @}
*/
/* ... */
#ifdef
__cplusplus
}
extern "C" { ... }
#endif
/* ... */
#endif
/* __USB_DFU_H */
/**
* @}
*/
/* ... */
/**
* @}
*/
/* ... */
Details
Show:
from
Types:
Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.
USBD_DFU_RegisterMedia()
USBD_DFU_HandleTypeDef::dev_status
pFunction
__PACKED
USBD_DFU_HandleTypeDef::dev_state
USBD_DFU_MediaTypeDef
USBD_DFU_HandleTypeDef
USB_DESC_TYPE_INTERFACE
USBD_DFU_HandleTypeDef::
::d8
USBD_DFU_HandleTypeDef::buffer
USBD_DFU_HandleTypeDef::wlength
USBD_DFU_HandleTypeDef::wblock_num
DFU_STATE_IDLE
USBD_DFU_MediaTypeDef::GetStatus
USBD_DFU_MediaTypeDef::Init
USBD_DFU_MediaTypeDef::DeInit
USBD_DFU_MediaTypeDef::Erase
USBD_DFU_MediaTypeDef::Write
USBD_DFU_MediaTypeDef::Read
USBD_DFUFuncDescTypeDef
DFU_MEDIA_ERASE
DFU_MEDIA_PROGRAM
USBD_DFU
USBD_DFU_HandleTypeDef::data_ptr
USBD_DFU_CLASS
DFU_CMD_ERASE
DFU_DESCRIPTOR_TYPE
DFU_STATE_DNLOAD_SYNC
DFU_STATE_DNLOAD_IDLE
DFU_STATE_MANIFEST_SYNC
DFU_STATE_UPLOAD_IDLE
DFU_ERROR_NONE
DFU_CMD_SETADDRESSPOINTER
USBD_DFU_HandleTypeDef::manif_state
DFU_STATE_ERROR
DFU_CMD_GETCOMMANDS
DFU_MANIFEST_COMPLETE
USBD_IDX_INTERFACE_STR
USBD_DFU_HandleTypeDef::alt_setting
USBD_DFUFuncDescTypeDef::bmAttributes
USBD_DFU_RegisterMedia()::pdev
USBD_DFU_RegisterMedia()::fops
USBD_DFU_BM_ATTRIBUTES
USB_DFU_CONFIG_DESC_SIZ
DFU_STATE_DNLOAD_BUSY
DFU_STATE_MANIFEST
DFU_ERROR_VENDOR
DFU_ERROR_STALLEDPKT
DFU_MANIFEST_IN_PROGRESS
DFU_MANIFEST_MASK
DFU_RequestTypeDef
USB_DFU_DESC_SIZ
DFU_STATE_MANIFEST_WAIT_RESET
DFU_ERROR_UNKNOWN
DFU_DETACH_MASK
DFU_STATUS_DEPTH
DFU_RequestTypeDef::DFU_DETACH
DFU_RequestTypeDef::DFU_DNLOAD
DFU_RequestTypeDef::DFU_UPLOAD
DFU_RequestTypeDef::DFU_GETSTATUS
DFU_RequestTypeDef::DFU_CLRSTATUS
DFU_RequestTypeDef::DFU_GETSTATE
DFU_RequestTypeDef::DFU_ABORT
USBD_DFU_IF_DESC
TRANSFER_SIZE_BYTES
USBD_DFU_MediaTypeDef::pStrDesc
__USB_DFU_H
USBD_DFU_DETACH_TIMEOUT
DFU_VENDOR_CMD_MAX
APP_STATE_IDLE
APP_STATE_DETACH
DFU_ERROR_TARGET
DFU_ERROR_FILE
DFU_ERROR_WRITE
DFU_ERROR_ERASE
DFU_ERROR_CHECK_ERASED
DFU_ERROR_PROG
DFU_ERROR_VERIFY
DFU_ERROR_ADDRESS
DFU_ERROR_NOTDONE
DFU_ERROR_FIRMWARE
DFU_ERROR_USB
DFU_ERROR_POR
IS_DFU_DOWNLOAD
IS_DFU_UPLOAD
IS_DFU_SETADDRESSPOINTER
IS_DFU_PHY_ADDRESS
IS_PROTECTED_AREA
USBD_DFU_HandleTypeDef::
::d32
USBD_DFU_HandleTypeDef::app_addr_ptr
USBD_DFU_HandleTypeDef::ReservedForAlign
USBD_DFUFuncDescTypeDef::bLength
USBD_DFUFuncDescTypeDef::bDescriptorType
USBD_DFUFuncDescTypeDef::wDetachTimeout
USBD_DFUFuncDescTypeDef::wTransferSze
USBD_DFUFuncDescTypeDef::bcdDFUVersion
DFU_RequestTypeDef
USBD_DFU_HandleTypeDef
USBD_DFU_MediaTypeDef
USBD_DFUFuncDescTypeDef
USBD_ClassTypeDef
USBD_HandleTypeDef