@@ -83,122 +83,219 @@ extern "C" {
83
83
#endif
84
84
85
85
#ifndef USBD_MAX_NUM_INTERFACES
86
- #define USBD_MAX_NUM_INTERFACES 2U
86
+ #define USBD_MAX_NUM_INTERFACES 2U
87
87
#endif /* USBD_MAX_NUM_INTERFACES */
88
88
89
89
#ifndef USBD_MAX_NUM_CONFIGURATION
90
- #define USBD_MAX_NUM_CONFIGURATION 1U
90
+ #define USBD_MAX_NUM_CONFIGURATION 1U
91
91
#endif /* USBD_MAX_NUM_CONFIGURATION */
92
92
93
93
#ifndef USBD_MAX_STR_DESC_SIZ
94
- #define USBD_MAX_STR_DESC_SIZ 0x100U
94
+ #define USBD_MAX_STR_DESC_SIZ 0x100U
95
95
#endif /* USBD_MAX_STR_DESC_SIZ */
96
96
97
97
#ifndef USBD_SELF_POWERED
98
- #define USBD_SELF_POWERED 1U
98
+ #define USBD_SELF_POWERED 1U
99
99
#endif /* USBD_SELF_POWERED */
100
100
101
101
#ifndef USBD_DEBUG_LEVEL
102
- #define USBD_DEBUG_LEVEL 0U
102
+ #define USBD_DEBUG_LEVEL 0U
103
103
#endif /* USBD_DEBUG_LEVEL */
104
104
105
105
/* ECM, RNDIS, DFU Class Config */
106
106
#ifndef USBD_SUPPORT_USER_STRING_DESC
107
- #define USBD_SUPPORT_USER_STRING_DESC 0U
107
+ #define USBD_SUPPORT_USER_STRING_DESC 0U
108
108
#endif /* USBD_SUPPORT_USER_STRING_DESC */
109
109
110
110
/* BillBoard Class Config */
111
111
#ifndef USBD_CLASS_USER_STRING_DESC
112
- #define USBD_CLASS_USER_STRING_DESC 1U
112
+ #define USBD_CLASS_USER_STRING_DESC 1U
113
113
#endif /* USBD_CLASS_USER_STRING_DESC */
114
114
115
115
#ifndef USBD_CLASS_BOS_ENABLED
116
- #define USBD_CLASS_BOS_ENABLED 0U
116
+ #define USBD_CLASS_BOS_ENABLED 0U
117
117
#endif /* USBD_CLASS_BOS_ENABLED */
118
118
119
119
#ifndef USB_BB_MAX_NUM_ALT_MODE
120
- #define USB_BB_MAX_NUM_ALT_MODE 0x2U
120
+ #define USB_BB_MAX_NUM_ALT_MODE 0x2U
121
121
#endif /* USB_BB_MAX_NUM_ALT_MODE */
122
122
123
123
/* MSC Class Config */
124
124
#ifndef MSC_MEDIA_PACKET
125
- #define MSC_MEDIA_PACKET 8192U
125
+ #define MSC_MEDIA_PACKET 8192U
126
126
#endif /* MSC_MEDIA_PACKET */
127
127
128
128
/* CDC Class Config */
129
129
#ifndef USBD_CDC_INTERVAL
130
- #define USBD_CDC_INTERVAL 2000U
130
+ #define USBD_CDC_INTERVAL 2000U
131
131
#endif /* USBD_CDC_INTERVAL */
132
132
133
133
/* DFU Class Config */
134
134
#ifndef USBD_DFU_MAX_ITF_NUM
135
- #define USBD_DFU_MAX_ITF_NUM 1U
135
+ #define USBD_DFU_MAX_ITF_NUM 1U
136
136
#endif /* USBD_DFU_MAX_ITF_NUM */
137
137
#ifndef USBD_DFU_XFERS_IZE
138
- #define USBD_DFU_XFERS_IZE 1024U
138
+ #define USBD_DFU_XFERS_IZE 1024U
139
139
#endif /* USBD_DFU_XFERS_IZE */
140
140
141
141
/* AUDIO Class Config */
142
142
#ifndef USBD_AUDIO_FREQ
143
- #define USBD_AUDIO_FREQ 22100U
143
+ #define USBD_AUDIO_FREQ 22100U
144
144
#endif /* USBD_AUDIO_FREQ */
145
145
146
+ /* CustomHID Class Config */
147
+ #ifndef CUSTOM_HID_HS_BINTERVAL
148
+ #define CUSTOM_HID_HS_BINTERVAL 0x05U
149
+ #endif /* CUSTOM_HID_HS_BINTERVAL */
150
+ #ifndef CUSTOM_HID_FS_BINTERVAL
151
+ #define CUSTOM_HID_FS_BINTERVAL 0x05U
152
+ #endif /* CUSTOM_HID_FS_BINTERVAL */
153
+ #ifndef USBD_CUSTOMHID_OUTREPORT_BUF_SIZE
154
+ #define USBD_CUSTOMHID_OUTREPORT_BUF_SIZE 0x02U
155
+ #endif /* USBD_CUSTOMHID_OUTREPORT_BUF_SIZE */
156
+ #ifndef USBD_CUSTOM_HID_REPORT_DESC_SIZE
157
+ #define USBD_CUSTOM_HID_REPORT_DESC_SIZE 163U
158
+ #endif /* USBD_CUSTOM_HID_REPORT_DESC_SIZE */
159
+
160
+ /* VIDEO Class Config */
161
+ #ifndef UVC_1_1
162
+ #define UVC_1_1 /* #define UVC_1_0 */
163
+ #endif /* UVC_1_1 */
164
+
165
+ /* To be used only with YUY2 and NV12 Video format, shouldn't be defined for MJPEG format */
166
+ #ifndef USBD_UVC_FORMAT_UNCOMPRESSED
167
+ #define USBD_UVC_FORMAT_UNCOMPRESSED
168
+ #endif /* USBD_UVC_FORMAT_UNCOMPRESSED */
169
+
170
+ #ifdef USBD_UVC_FORMAT_UNCOMPRESSED
171
+ #ifndef UVC_BITS_PER_PIXEL
172
+ #define UVC_BITS_PER_PIXEL 12U
173
+ #endif /* UVC_BITS_PER_PIXEL */
174
+ #ifndef UVC_UNCOMPRESSED_GUID
175
+ #define UVC_UNCOMPRESSED_GUID UVC_GUID_NV12 /* UVC_GUID_YUY2 */
176
+ #endif /* UVC_UNCOMPRESSED_GUID */
177
+
178
+ /* refer to Table 3-18 Color Matching Descriptor video class v1.1 */
179
+ #ifndef UVC_COLOR_PRIMARIE
180
+ #define UVC_COLOR_PRIMARIE 0x01U
181
+ #endif /* UVC_COLOR_PRIMARIE */
182
+ #ifndef UVC_TFR_CHARACTERISTICS
183
+ #define UVC_TFR_CHARACTERISTICS 0x01U
184
+ #endif /* UVC_TFR_CHARACTERISTICS */
185
+ #ifndef UVC_MATRIX_COEFFICIENTS
186
+ #define UVC_MATRIX_COEFFICIENTS 0x04U
187
+ #endif /* UVC_MATRIX_COEFFICIENTS */
188
+ #endif
189
+
190
+ /* Video Stream frame width and height */
191
+ #ifndef UVC_WIDTH
192
+ #define UVC_WIDTH 176U
193
+ #endif /* UVC_WIDTH */
194
+ #ifndef UVC_HEIGHT
195
+ #define UVC_HEIGHT 144U
196
+ #endif /* UVC_HEIGHT */
197
+
198
+ /* bEndpointAddress in Endpoint Descriptor */
199
+ #ifndef UVC_IN_EP
200
+ #define UVC_IN_EP 0x81U
201
+ #endif /* UVC_IN_EP */
202
+
203
+ #ifndef UVC_CAM_FPS_FS
204
+ #define UVC_CAM_FPS_FS 10U
205
+ #endif /* UVC_CAM_FPS_FS */
206
+ #ifndef UVC_CAM_FPS_HS
207
+ #define UVC_CAM_FPS_HS 5U
208
+ #endif /* UVC_CAM_FPS_HS */
209
+
210
+ #ifndef UVC_ISO_HS_MPS
211
+ #define UVC_ISO_FS_MPS 512U
212
+ #endif /* UVC_ISO_HS_MPS */
213
+ #ifndef UVC_ISO_HS_MPS
214
+ #define UVC_ISO_HS_MPS 512U
215
+ #endif /* UVC_ISO_HS_MPS */
216
+
217
+ #ifndef UVC_PACKET_SIZE
218
+ #define UVC_PACKET_SIZE UVC_ISO_FS_MPS
219
+ #endif /* UVC_PACKET_SIZE */
220
+ /* To be used with Device Only IP supporting double buffer mode */
221
+ /* #define UVC_HEADER_PACKET_CNT 0x02U */
222
+ /* #define UVC_PACKET_SIZE (UVC_ISO_FS_MPS * UVC_HEADER_PACKET_CNT) */
223
+
224
+ #ifndef UVC_MAX_FRAME_SIZE
225
+ #define UVC_MAX_FRAME_SIZE (UVC_WIDTH * UVC_HEIGHT * 16U / 8U)
226
+ #endif /* UVC_MAX_FRAME_SIZE */
227
+
146
228
/* Interrupt priority */
147
229
#ifndef USBD_IRQ_PRIO
148
- #define USBD_IRQ_PRIO 1
230
+ #define USBD_IRQ_PRIO 1
149
231
#endif /* USBD_IRQ_PRIO */
232
+
150
233
#ifndef USBD_IRQ_SUBPRIO
151
- #define USBD_IRQ_SUBPRIO 0
234
+ #define USBD_IRQ_SUBPRIO 0
152
235
#endif /* USBD_IRQ_SUBPRIO */
153
236
154
- /* Memory management macros */
237
+ /* Memory management macros make sure to use static memory allocation */
238
+ /* Currently dynamic memory allocation usage */
239
+ /** Alias for memory allocation. */
155
240
#ifndef USBD_malloc
156
- #define USBD_malloc malloc
241
+ #define USBD_malloc malloc
157
242
#endif /* USBD_malloc */
243
+
244
+ /** Alias for memory release. */
158
245
#ifndef USBD_free
159
- #define USBD_free free
246
+ #define USBD_free free
160
247
#endif /* USBD_free */
248
+
249
+ /** Alias for memory set. */
161
250
#ifndef USBD_memset
162
- #define USBD_memset memset
251
+ #define USBD_memset memset
163
252
#endif /* USBD_memset */
253
+
254
+ /** Alias for memory copy. */
164
255
#ifndef USBD_memcpy
165
- #define USBD_memcpy memcpy
256
+ #define USBD_memcpy memcpy
166
257
#endif /* USBD_memcpy */
258
+
259
+ /** Alias for delay. */
167
260
#ifndef USBD_Delay
168
- #define USBD_Delay HAL_Delay
261
+ #define USBD_Delay HAL_Delay
169
262
#endif /* USBD_Delay */
170
263
171
264
/* DEBUG macros */
172
265
#if (USBD_DEBUG_LEVEL > 0U )
173
266
#define USBD_UsrLog (...) do { \
174
- printf(__VA_ARGS__); \
175
- printf("\n"); \
176
- } while (0)
267
+ printf(__VA_ARGS__); \
268
+ printf("\n"); \
269
+ } while (0)
177
270
#else
178
271
#define USBD_UsrLog (...) do {} while (0)
179
272
#endif
180
273
181
274
#if (USBD_DEBUG_LEVEL > 1U )
182
275
183
276
#define USBD_ErrLog (...) do { \
184
- printf("ERROR: ") ; \
185
- printf(__VA_ARGS__); \
186
- printf("\n"); \
187
- } while (0)
277
+ printf("ERROR: ") ; \
278
+ printf(__VA_ARGS__); \
279
+ printf("\n"); \
280
+ } while (0)
188
281
#else
189
282
#define USBD_ErrLog (...) do {} while (0)
190
283
#endif
191
284
192
285
#if (USBD_DEBUG_LEVEL > 2U )
193
286
#define USBD_DbgLog (...) do { \
194
- printf("DEBUG : ") ; \
195
- printf(__VA_ARGS__); \
196
- printf("\n"); \
197
- } while (0)
287
+ printf("DEBUG : ") ; \
288
+ printf(__VA_ARGS__); \
289
+ printf("\n"); \
290
+ } while (0)
198
291
#else
199
292
#define USBD_DbgLog (...) do {} while (0)
200
293
#endif
201
294
295
+ /* Exported functions -------------------------------------------------------*/
296
+ void * USBD_static_malloc (uint32_t size );
297
+ void USBD_static_free (void * p );
298
+
202
299
#endif /* USBCON */
203
300
204
301
#ifdef __cplusplus
0 commit comments