Select one of the symbols to view example projects that use it.
 
Outline
...
...
...
...
#define UX_DEVICE_CLASS_DFU_H
#define UX_SLAVE_CLASS_DFU_CAPABILITY_WILL_DETACH
#define UX_SLAVE_CLASS_DFU_CAPABILITY_MANIFESTATION_TOLERANT
#define UX_SLAVE_CLASS_DFU_CAPABILITY_CAN_UPLOAD
#define UX_SLAVE_CLASS_DFU_CAPABILITY_CAN_DOWNLOAD
#define UX_SLAVE_CLASS_DFU_CLASS
#define UX_SLAVE_CLASS_DFU_SUBCLASS
#define UX_SLAVE_CLASS_DFU_PROTOCOL_RUNTIME
#define UX_SLAVE_CLASS_DFU_PROTOCOL_DFU_MODE
#define UX_DEVICE_CLASS_DFU_MODE_RUNTIME
#define UX_DEVICE_CLASS_DFU_MODE_DFU
#define UX_SLAVE_CLASS_DFU_COMMAND_DETACH
#define UX_SLAVE_CLASS_DFU_COMMAND_DOWNLOAD
#define UX_SLAVE_CLASS_DFU_COMMAND_UPLOAD
#define UX_SLAVE_CLASS_DFU_COMMAND_GET_STATUS
#define UX_SLAVE_CLASS_DFU_COMMAND_CLEAR_STATUS
#define UX_SLAVE_CLASS_DFU_COMMAND_GET_STATE
#define UX_SLAVE_CLASS_DFU_COMMAND_ABORT
#define UX_SLAVE_CLASS_DFU_STATUS_OK
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_TARGET
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_FILE
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_WRITE
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_ERASE
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_CHECK_ERASED
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_PROG
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_VERIFY
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_ADDRESS
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_NOTDONE
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_FIRMWARE
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_VENDOR
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_USBR
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_POR
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_UNKNOWN
#define UX_SLAVE_CLASS_DFU_STATUS_ERROR_STALLEDPKT
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_APP_IDLE
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_APP_DETACH
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_IDLE
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_DNLOAD_SYNC
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_DNBUSY
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_DNLOAD_IDLE
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_MANIFEST_SYNC
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_MANIFEST
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_MANIFEST_WAIT_RESET
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_UPLOAD_IDLE
#define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_ERROR
#define UX_SLAVE_CLASS_DFU_GET_STATUS_STATUS
#define UX_SLAVE_CLASS_DFU_GET_STATUS_POLL_TIMEOUT
#define UX_SLAVE_CLASS_DFU_GET_STATUS_STATE
#define UX_SLAVE_CLASS_DFU_GET_STATUS_STRING
#define UX_SLAVE_CLASS_DFU_GET_STATUS_LENGTH
#define UX_DEVICE_CLASS_DFU_STATUS_MODE
#define UX_DEVICE_CLASS_DFU_STATUS_POLLTIMEOUT
#define UX_SLAVE_CLASS_DFU_GET_STATE_STATE
#define UX_SLAVE_CLASS_DFU_GET_STATE_LENGTH
#define UX_SLAVE_CLASS_DFU_NOTIFICATION_BEGIN_DOWNLOAD
#define UX_SLAVE_CLASS_DFU_NOTIFICATION_END_DOWNLOAD
#define UX_SLAVE_CLASS_DFU_NOTIFICATION_ABORT_DOWNLOAD
#define UX_SLAVE_CLASS_DFU_NOTIFICATION_BEGIN_UPLOAD
#define UX_SLAVE_CLASS_DFU_NOTIFICATION_END_UPLOAD
#define UX_SLAVE_CLASS_DFU_NOTIFICATION_ABORT_UPLOAD
#define UX_SLAVE_CLASS_DFU_MEDIA_STATUS_OK
#define UX_SLAVE_CLASS_DFU_MEDIA_STATUS_BUSY
#define UX_SLAVE_CLASS_DFU_MEDIA_STATUS_ERROR
#define UX_DEVICE_CLASS_DFU_THREAD_EVENT_DISCONNECT
#define UX_DEVICE_CLASS_DFU_THREAD_EVENT_WAIT_RESET
UX_SLAVE_CLASS_DFU_PARAMETER_STRUCT
UX_SLAVE_CLASS_DFU_STRUCT
_ux_device_class_dfu_activate(UX_SLAVE_CLASS_COMMAND *);
_ux_device_class_dfu_control_request(UX_SLAVE_CLASS_COMMAND *);
_ux_device_class_dfu_deactivate(UX_SLAVE_CLASS_COMMAND *);
_ux_device_class_dfu_entry(UX_SLAVE_CLASS_COMMAND *);
_ux_device_class_dfu_initialize(UX_SLAVE_CLASS_COMMAND *);
_ux_device_class_dfu_thread(ULONG);
_ux_device_class_dfu_state_get(UX_SLAVE_CLASS_DFU *);
_ux_device_class_dfu_state_sync(UX_SLAVE_CLASS_DFU *);
_ux_device_class_dfu_tasks_run(void *);
#define ux_device_class_dfu_entry
#define ux_device_class_dfu_state_get
#define ux_device_class_dfu_state_sync
Files
loading...
CodeScopeSTM32 Libraries and Samplesusbxcommon/usbx_device_classes/inc/ux_device_class_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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */... /**************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** USBX Component */ /** */ /** DFU Class */ /** */... /**************************************************************************/ /**************************************************************************/ /**************************************************************************/ /* */ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_device_class_dfu.h PORTABLE C */ /* 6.1.10 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This file defines the equivalences for the USBX Device Class DFU */ /* ACM component. */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* used UX prefix to refer to */ /* TX symbols instead of using */ /* them directly, */ /* resulting in version 6.1 */ /* 04-02-2021 Chaoqiong Xiao Modified comment(s), */ /* added DFU_UPLOAD support, */ /* refined dfu_read prototype, */ /* removed block count (it's */ /* from host request wValue), */ /* resulting in version 6.1.6 */ /* 08-02-2021 Chaoqiong Xiao Modified comment(s), */ /* added extern "C" keyword */ /* for compatibility with C++, */ /* resulting in version 6.1.8 */ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ /* */... /**************************************************************************/ #ifndef UX_DEVICE_CLASS_DFU_H #define UX_DEVICE_CLASS_DFU_H /* Determine if a C++ compiler is being used. If so, ensure that standard C is used to process the API information. *//* ... */ #ifdef __cplusplus /* Yes, C++ compiler is present. Use standard C. */ extern "C" { #endif /* Define DFU class descriptor capabilities. */ #define UX_SLAVE_CLASS_DFU_CAPABILITY_WILL_DETACH 0x08 #define UX_SLAVE_CLASS_DFU_CAPABILITY_MANIFESTATION_TOLERANT 0x04 #define UX_SLAVE_CLASS_DFU_CAPABILITY_CAN_UPLOAD 0x02 #define UX_SLAVE_CLASS_DFU_CAPABILITY_CAN_DOWNLOAD 0x01 /* Define DFU Class USB Class constants. */ #define UX_SLAVE_CLASS_DFU_CLASS 0xFE #define UX_SLAVE_CLASS_DFU_SUBCLASS 0x01 #define UX_SLAVE_CLASS_DFU_PROTOCOL_RUNTIME 0x01 #define UX_SLAVE_CLASS_DFU_PROTOCOL_DFU_MODE 0x02 /* Define DFU MODES signals. */ #define UX_DEVICE_CLASS_DFU_MODE_RUNTIME 1 #define UX_DEVICE_CLASS_DFU_MODE_DFU 2 /* Device DFU Requests */ #define UX_SLAVE_CLASS_DFU_COMMAND_DETACH 0 #define UX_SLAVE_CLASS_DFU_COMMAND_DOWNLOAD 1 #define UX_SLAVE_CLASS_DFU_COMMAND_UPLOAD 2 #define UX_SLAVE_CLASS_DFU_COMMAND_GET_STATUS 3 #define UX_SLAVE_CLASS_DFU_COMMAND_CLEAR_STATUS 4 #define UX_SLAVE_CLASS_DFU_COMMAND_GET_STATE 5 #define UX_SLAVE_CLASS_DFU_COMMAND_ABORT 6 /* Device DFU Status values */ #define UX_SLAVE_CLASS_DFU_STATUS_OK 0x00 #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_TARGET 0x01 #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_FILE 0x02 #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_WRITE 0x03 #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_ERASE 0x04 #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_CHECK_ERASED 0x05 #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_PROG 0x06 #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_VERIFY 0x07 #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_ADDRESS 0x08 #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_NOTDONE 0x09 #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_FIRMWARE 0x0A #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_VENDOR 0x0B #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_USBR 0x0C #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_POR 0x0D #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_UNKNOWN 0x0E #define UX_SLAVE_CLASS_DFU_STATUS_ERROR_STALLEDPKT 0x0F #define UX_SLAVE_CLASS_DFU_STATUS_STATE_APP_IDLE 0 #define UX_SLAVE_CLASS_DFU_STATUS_STATE_APP_DETACH 1 #define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_IDLE 2 #define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_DNLOAD_SYNC 3 #define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_DNBUSY 4 #define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_DNLOAD_IDLE 5 #define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_MANIFEST_SYNC 6 #define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_MANIFEST 7 #define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_MANIFEST_WAIT_RESET 8 #define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_UPLOAD_IDLE 9 #define UX_SLAVE_CLASS_DFU_STATUS_STATE_DFU_ERROR 10 /* Define DFU class GET_STATUS command response. */ #define UX_SLAVE_CLASS_DFU_GET_STATUS_STATUS 0 #define UX_SLAVE_CLASS_DFU_GET_STATUS_POLL_TIMEOUT 1 #define UX_SLAVE_CLASS_DFU_GET_STATUS_STATE 4 #define UX_SLAVE_CLASS_DFU_GET_STATUS_STRING 5 #define UX_SLAVE_CLASS_DFU_GET_STATUS_LENGTH 6 49 defines /* Status mode for DFU_GETSTATUS 0 - simple mode, status is queried from application in dfuDNLOAD-SYNC and dfuMANIFEST-SYNC state, no bwPollTimeout. 1 - status is queried from application once requested, b0-3 : media status b4-7 : bStatus b8-31: bwPollTimeout bwPollTimeout supported. *//* ... */ #ifndef UX_DEVICE_CLASS_DFU_STATUS_MODE #define UX_DEVICE_CLASS_DFU_STATUS_MODE (0) #endif /* Status mode 0 bwPollTimeout (width: 3 bytes, ~0xFFFFFF). */ #ifndef UX_DEVICE_CLASS_DFU_STATUS_POLLTIMEOUT #define UX_DEVICE_CLASS_DFU_STATUS_POLLTIMEOUT (1) #endif /* Define DFU class GET_STATE command response. */ #define UX_SLAVE_CLASS_DFU_GET_STATE_STATE 0 #define UX_SLAVE_CLASS_DFU_GET_STATE_LENGTH 1 /* Define DFU application notification signals. */ #define UX_SLAVE_CLASS_DFU_NOTIFICATION_BEGIN_DOWNLOAD 0x1u #define UX_SLAVE_CLASS_DFU_NOTIFICATION_END_DOWNLOAD 0x2u #define UX_SLAVE_CLASS_DFU_NOTIFICATION_ABORT_DOWNLOAD 0x3u #define UX_SLAVE_CLASS_DFU_NOTIFICATION_BEGIN_UPLOAD 0x5u #define UX_SLAVE_CLASS_DFU_NOTIFICATION_END_UPLOAD 0x6u #define UX_SLAVE_CLASS_DFU_NOTIFICATION_ABORT_UPLOAD 0x7u /* Define DFU application notification signals. */ #define UX_SLAVE_CLASS_DFU_MEDIA_STATUS_OK 0 #define UX_SLAVE_CLASS_DFU_MEDIA_STATUS_BUSY 1 #define UX_SLAVE_CLASS_DFU_MEDIA_STATUS_ERROR 2 /* Define DFU thread event signals. */ #define UX_DEVICE_CLASS_DFU_THREAD_EVENT_DISCONNECT 0x1u #define UX_DEVICE_CLASS_DFU_THREAD_EVENT_WAIT_RESET 0x2u 13 defines /* Define Slave DFU Class Calling Parameter structure */ typedef struct UX_SLAVE_CLASS_DFU_PARAMETER_STRUCT { ULONG ux_slave_class_dfu_parameter_will_detach; ULONG ux_slave_class_dfu_parameter_capabilities; VOID (*ux_slave_class_dfu_parameter_instance_activate)(VOID *); VOID (*ux_slave_class_dfu_parameter_instance_deactivate)(VOID *); UINT (*ux_slave_class_dfu_parameter_read)(VOID *dfu, ULONG block_number, UCHAR * data_pointer, ULONG length, ULONG *actual_length); UINT (*ux_slave_class_dfu_parameter_write)(VOID *dfu, ULONG block_number, UCHAR * data_pointer, ULONG length, ULONG *media_status); UINT (*ux_slave_class_dfu_parameter_get_status)(VOID *dfu, ULONG *media_status); UINT (*ux_slave_class_dfu_parameter_notify)(VOID *dfu, ULONG notification); #ifdef UX_DEVICE_CLASS_DFU_CUSTOM_REQUEST_ENABLE UINT (*ux_device_class_dfu_parameter_custom_request)(VOID *dfu, UX_SLAVE_TRANSFER *transfer); #endif UCHAR *ux_slave_class_dfu_parameter_framework; ULONG ux_slave_class_dfu_parameter_framework_length; ...} UX_SLAVE_CLASS_DFU_PARAMETER; /* Define DFU Class structure. */ typedef struct UX_SLAVE_CLASS_DFU_STRUCT { UX_SLAVE_INTERFACE *ux_slave_class_dfu_interface; ULONG ux_slave_class_dfu_status; VOID (*ux_slave_class_dfu_instance_activate)(VOID *); VOID (*ux_slave_class_dfu_instance_deactivate)(VOID *); UINT (*ux_slave_class_dfu_read)(VOID *dfu, ULONG block_number, UCHAR * data_pointer, ULONG length, ULONG *actual_length); UINT (*ux_slave_class_dfu_write)(VOID *dfu, ULONG block_number, UCHAR * data_pointer, ULONG length, ULONG *media_status); UINT (*ux_slave_class_dfu_get_status)(VOID *dfu, ULONG *media_status); UINT (*ux_slave_class_dfu_notify)(VOID *dfu, ULONG notification); #ifdef UX_DEVICE_CLASS_DFU_CUSTOM_REQUEST_ENABLE UINT (*ux_device_class_dfu_custom_request)(VOID *dfu, UX_SLAVE_TRANSFER *transfer); #endif #if !defined(UX_DEVICE_STANDALONE) UX_THREAD ux_slave_class_dfu_thread; UCHAR *ux_slave_class_dfu_thread_stack; UX_EVENT_FLAGS_GROUP ux_slave_class_dfu_event_flags_group;/* ... */ #else ULONG ux_device_class_dfu_flags; #endif ...} UX_SLAVE_CLASS_DFU; #if !defined(UX_DEVICE_STANDALONE) #define _ux_device_class_dfu_event_flags_set(dfu, flags) do { \ _ux_utility_event_flags_set(&(dfu) -> ux_slave_class_dfu_event_flags_group, flags, UX_OR); \ ...} while(0)... /* ... */#else #define _ux_device_class_dfu_event_flags_set(dfu, flags) do { \ (dfu) -> ux_device_class_dfu_flags |= flags; \ ...} while(0)... /* ... */#endif /* Define Device DFU Class prototypes. */ UINT _ux_device_class_dfu_activate(UX_SLAVE_CLASS_COMMAND *command); UINT _ux_device_class_dfu_control_request(UX_SLAVE_CLASS_COMMAND *command); UINT _ux_device_class_dfu_deactivate(UX_SLAVE_CLASS_COMMAND *command); UINT _ux_device_class_dfu_entry(UX_SLAVE_CLASS_COMMAND *command); UINT _ux_device_class_dfu_initialize(UX_SLAVE_CLASS_COMMAND *command); VOID _ux_device_class_dfu_thread(ULONG dfu_class); UCHAR _ux_device_class_dfu_state_get(UX_SLAVE_CLASS_DFU *dfu); VOID _ux_device_class_dfu_state_sync(UX_SLAVE_CLASS_DFU *dfu); UINT _ux_device_class_dfu_tasks_run(VOID *class_instance); /* Define Device DFU Class API prototypes. */ #define ux_device_class_dfu_entry _ux_device_class_dfu_entry #define ux_device_class_dfu_state_get _ux_device_class_dfu_state_get #define ux_device_class_dfu_state_sync _ux_device_class_dfu_state_sync /* Determine if a C++ compiler is being used. If so, complete the standard C conditional started above. *//* ... */ #ifdef __cplusplus }extern "C" { ... } #endif /* ... */ ...#endif /* UX_DEVICE_CLASS_DFU_H */