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