Select one of the symbols to view example projects that use it.
 
Outline
#define __USBH_CDC_H
#include "usbh_core.h"
#define USB_CDC_CLASS
#define COMMUNICATION_INTERFACE_CLASS_CODE
#define DATA_INTERFACE_CLASS_CODE
#define RESERVED
#define DIRECT_LINE_CONTROL_MODEL
#define ABSTRACT_CONTROL_MODEL
#define TELEPHONE_CONTROL_MODEL
#define MULTICHANNEL_CONTROL_MODEL
#define CAPI_CONTROL_MODEL
#define ETHERNET_NETWORKING_CONTROL_MODEL
#define ATM_NETWORKING_CONTROL_MODEL
#define NO_CLASS_SPECIFIC_PROTOCOL_CODE
#define COMMON_AT_COMMAND
#define VENDOR_SPECIFIC
#define CS_INTERFACE
#define CDC_PAGE_SIZE_64
#define CDC_SEND_ENCAPSULATED_COMMAND
#define CDC_GET_ENCAPSULATED_RESPONSE
#define CDC_SET_COMM_FEATURE
#define CDC_GET_COMM_FEATURE
#define CDC_CLEAR_COMM_FEATURE
#define CDC_SET_AUX_LINE_STATE
#define CDC_SET_HOOK_STATE
#define CDC_PULSE_SETUP
#define CDC_SEND_PULSE
#define CDC_SET_PULSE_TIME
#define CDC_RING_AUX_JACK
#define CDC_SET_LINE_CODING
#define CDC_GET_LINE_CODING
#define CDC_SET_CONTROL_LINE_STATE
#define CDC_SEND_BREAK
#define CDC_SET_RINGER_PARMS
#define CDC_GET_RINGER_PARMS
#define CDC_SET_OPERATION_PARMS
#define CDC_GET_OPERATION_PARMS
#define CDC_SET_LINE_PARMS
#define CDC_GET_LINE_PARMS
#define CDC_DIAL_DIGITS
#define CDC_SET_UNIT_PARAMETER
#define CDC_GET_UNIT_PARAMETER
#define CDC_CLEAR_UNIT_PARAMETER
#define CDC_GET_PROFILE
#define CDC_SET_ETHERNET_MULTICAST_FILTERS
#define CDC_SET_ETHERNET_POWER_MANAGEMENT_PATTERN
#define CDC_GET_ETHERNET_POWER_MANAGEMENT_PATTERN
#define CDC_SET_ETHERNET_PACKET_FILTER
#define CDC_GET_ETHERNET_STATISTIC
#define CDC_SET_ATM_DATA_FORMAT
#define CDC_GET_ATM_DEVICE_STATISTICS
#define CDC_SET_ATM_DEFAULT_VC
#define CDC_GET_ATM_VC_STATISTICS
#define CDC_ACTIVATE_CARRIER_SIGNAL_RTS
#define CDC_DEACTIVATE_CARRIER_SIGNAL_RTS
#define CDC_ACTIVATE_SIGNAL_DTR
#define CDC_DEACTIVATE_SIGNAL_DTR
#define LINE_CODING_STRUCTURE_SIZE
CDC_DataStateTypeDef
CDC_StateTypeDef
_CDC_LineCodingStructure
_FunctionalDescriptorHeader
_CallMgmtFunctionalDescriptor
_AbstractCntrlMgmtFunctionalDescriptor
_UnionFunctionalDescriptor
_USBH_CDCInterfaceDesc
CDC_CommItfTypedef
CDC_DataItfTypedef
_CDC_Process
CDC_Class;
#define USBH_CDC_CLASS
USBH_CDC_SetLineCoding(USBH_HandleTypeDef *, CDC_LineCodingTypeDef *);
USBH_CDC_GetLineCoding(USBH_HandleTypeDef *, CDC_LineCodingTypeDef *);
USBH_CDC_Transmit(USBH_HandleTypeDef *, uint8_t *, uint32_t);
USBH_CDC_Receive(USBH_HandleTypeDef *, uint8_t *, uint32_t);
USBH_CDC_GetLastReceivedDataSize(USBH_HandleTypeDef *);
USBH_CDC_Stop(USBH_HandleTypeDef *);
USBH_CDC_LineCodingChanged(USBH_HandleTypeDef *);
USBH_CDC_TransmitCallback(USBH_HandleTypeDef *);
USBH_CDC_ReceiveCallback(USBH_HandleTypeDef *);
Files
loading...
SourceVuSTM32 Libraries and SamplesSTM32_USB_Host_LibraryClass/CDC/Inc/usbh_cdc.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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file usbh_cdc.h * @author MCD Application Team * @brief This file contains all the prototypes for the usbh_cdc.c ****************************************************************************** * @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 ----------------------------------------------*/ #ifndef __USBH_CDC_H #define __USBH_CDC_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "usbh_core.h" /** @addtogroup USBH_LIB * @{ *//* ... */ /** @addtogroup USBH_CLASS * @{ *//* ... */ /** @addtogroup USBH_CDC_CLASS * @{ *//* ... */ /** @defgroup USBH_CDC_CORE * @brief This file is the Header file for usbh_core.c * @{ *//* ... */ /*Communication Class codes*/ #define USB_CDC_CLASS 0x02U #define COMMUNICATION_INTERFACE_CLASS_CODE 0x02U /*Data Interface Class Codes*/ #define DATA_INTERFACE_CLASS_CODE 0x0AU /*Communication sub class codes*/ #define RESERVED 0x00U #define DIRECT_LINE_CONTROL_MODEL 0x01U #define ABSTRACT_CONTROL_MODEL 0x02U #define TELEPHONE_CONTROL_MODEL 0x03U #define MULTICHANNEL_CONTROL_MODEL 0x04U #define CAPI_CONTROL_MODEL 0x05U #define ETHERNET_NETWORKING_CONTROL_MODEL 0x06U #define ATM_NETWORKING_CONTROL_MODEL 0x07U /*Communication Interface Class Control Protocol Codes*/ #define NO_CLASS_SPECIFIC_PROTOCOL_CODE 0x00U #define COMMON_AT_COMMAND 0x01U #define VENDOR_SPECIFIC 0xFFU #define CS_INTERFACE 0x24U #define CDC_PAGE_SIZE_64 0x40U /*Class-Specific Request Codes*/ #define CDC_SEND_ENCAPSULATED_COMMAND 0x00U #define CDC_GET_ENCAPSULATED_RESPONSE 0x01U #define CDC_SET_COMM_FEATURE 0x02U #define CDC_GET_COMM_FEATURE 0x03U #define CDC_CLEAR_COMM_FEATURE 0x04U #define CDC_SET_AUX_LINE_STATE 0x10U #define CDC_SET_HOOK_STATE 0x11U #define CDC_PULSE_SETUP 0x12U #define CDC_SEND_PULSE 0x13U #define CDC_SET_PULSE_TIME 0x14U #define CDC_RING_AUX_JACK 0x15U #define CDC_SET_LINE_CODING 0x20U #define CDC_GET_LINE_CODING 0x21U #define CDC_SET_CONTROL_LINE_STATE 0x22U #define CDC_SEND_BREAK 0x23U #define CDC_SET_RINGER_PARMS 0x30U #define CDC_GET_RINGER_PARMS 0x31U #define CDC_SET_OPERATION_PARMS 0x32U #define CDC_GET_OPERATION_PARMS 0x33U #define CDC_SET_LINE_PARMS 0x34U #define CDC_GET_LINE_PARMS 0x35U #define CDC_DIAL_DIGITS 0x36U #define CDC_SET_UNIT_PARAMETER 0x37U #define CDC_GET_UNIT_PARAMETER 0x38U #define CDC_CLEAR_UNIT_PARAMETER 0x39U #define CDC_GET_PROFILE 0x3AU #define CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40U #define CDC_SET_ETHERNET_POWER_MANAGEMENT_PATTERN FILTER 0x41U #define CDC_GET_ETHERNET_POWER_MANAGEMENT_PATTERN FILTER 0x42U #define CDC_SET_ETHERNET_PACKET_FILTER 0x43U #define CDC_GET_ETHERNET_STATISTIC 0x44U #define CDC_SET_ATM_DATA_FORMAT 0x50U #define CDC_GET_ATM_DEVICE_STATISTICS 0x51U #define CDC_SET_ATM_DEFAULT_VC 0x52U #define CDC_GET_ATM_VC_STATISTICS 0x53U /* wValue for SetControlLineState*/ #define CDC_ACTIVATE_CARRIER_SIGNAL_RTS 0x0002U #define CDC_DEACTIVATE_CARRIER_SIGNAL_RTS 0x0000U #define CDC_ACTIVATE_SIGNAL_DTR 0x0001U #define CDC_DEACTIVATE_SIGNAL_DTR 0x0000U #define LINE_CODING_STRUCTURE_SIZE 0x07U 56 defines/** * @} *//* ... */ /** @defgroup USBH_CDC_CORE_Exported_Types * @{ *//* ... */ /* States for CDC State Machine */ typedef enum { CDC_IDLE = 0U, CDC_SEND_DATA, CDC_SEND_DATA_WAIT, CDC_RECEIVE_DATA, CDC_RECEIVE_DATA_WAIT, ...} CDC_DataStateTypeDef; typedef enum { CDC_IDLE_STATE = 0U, CDC_SET_LINE_CODING_STATE, CDC_GET_LAST_LINE_CODING_STATE, CDC_TRANSFER_DATA, CDC_ERROR_STATE, ...} CDC_StateTypeDef; /*Line coding structure*/ typedef union _CDC_LineCodingStructure { uint8_t Array[LINE_CODING_STRUCTURE_SIZE]; struct { uint32_t dwDTERate; /*Data terminal rate, in bits per second*/ uint8_t bCharFormat; /*Stop bits 0 - 1 Stop bit 1 - 1.5 Stop bits 2 - 2 Stop bits*//* ... */ uint8_t bParityType; /* Parity 0 - None 1 - Odd 2 - Even 3 - Mark 4 - Space*//* ... */ uint8_t bDataBits; /* Data bits (5, 6, 7, 8 or 16). */ ...} b; ...} CDC_LineCodingTypeDef; /* Header Functional Descriptor -------------------------------------------------------------------------------- Offset| field | Size | Value | Description ------|---------------------|-------|------------|------------------------------ 0 | bFunctionLength | 1 | number | Size of this descriptor. 1 | bDescriptorType | 1 | Constant | CS_INTERFACE (0x24) 2 | bDescriptorSubtype | 1 | Constant | Identifier (ID) of functional | | | | descriptor. 3 | bcdCDC | 2 | | | | | Number | USB Class Definitions for | | | | Communication Devices Specification | | | | release number in binary-coded | | | | decimal ------|---------------------|-------|------------|------------------------------ *//* ... */ typedef struct _FunctionalDescriptorHeader { uint8_t bLength; /*Size of this descriptor.*/ uint8_t bDescriptorType; /*CS_INTERFACE (0x24)*/ uint8_t bDescriptorSubType; /* Header functional descriptor subtype as*/ uint16_t bcdCDC; /* USB Class Definitions for Communication Devices Specification release number in binary-coded decimal. *//* ... */ ...} CDC_HeaderFuncDesc_TypeDef; /* Call Management Functional Descriptor -------------------------------------------------------------------------------- Offset| field | Size | Value | Description ------|---------------------|-------|------------|------------------------------ 0 | bFunctionLength | 1 | number | Size of this descriptor. 1 | bDescriptorType | 1 | Constant | CS_INTERFACE (0x24) 2 | bDescriptorSubtype | 1 | Constant | Call Management functional | | | | descriptor subtype. 3 | bmCapabilities | 1 | Bitmap | The capabilities that this configuration | | | | supports: | | | | D7..D2: RESERVED (Reset to zero) | | | | D1: 0 - Device sends/receives call | | | | management information only over | | | | the Communication Class | | | | interface. | | | | 1 - Device can send/receive call | \ | | management information over a | | | | Data Class interface. | | | | D0: 0 - Device does not handle call | | | | management itself. | | | | 1 - Device handles call | | | | management itself. | | | | The previous bits, in combination, identify | | | | which call management scenario is used. If bit | | | | D0 is reset to 0, then the value of bit D1 is | | | | ignored. In this case, bit D1 is reset to zero for | | | | future compatibility. 4 | bDataInterface | 1 | Number | Interface number of Data Class interface | | | | optionally used for call management. ------|---------------------|-------|------------|------------------------------ *//* ... */ typedef struct _CallMgmtFunctionalDescriptor { uint8_t bLength; /*Size of this functional descriptor, in bytes.*/ uint8_t bDescriptorType; /*CS_INTERFACE (0x24)*/ uint8_t bDescriptorSubType; /* Call Management functional descriptor subtype*/ uint8_t bmCapabilities; /* bmCapabilities: D0+D1 */ uint8_t bDataInterface; /*bDataInterface: 1*/ ...} CDC_CallMgmtFuncDesc_TypeDef; /* Abstract Control Management Functional Descriptor -------------------------------------------------------------------------------- Offset| field | Size | Value | Description ------|---------------------|-------|------------|------------------------------ 0 | bFunctionLength | 1 | number | Size of functional descriptor, in bytes. 1 | bDescriptorType | 1 | Constant | CS_INTERFACE (0x24) 2 | bDescriptorSubtype | 1 | Constant | Abstract Control Management | | | | functional descriptor subtype. 3 | bmCapabilities | 1 | Bitmap | The capabilities that this configuration | | | | supports ((A bit value of zero means that the | | | | request is not supported.) ) D7..D4: RESERVED (Reset to zero) | | | | D3: 1 - Device supports the notification | | | | Network_Connection. | | | | D2: 1 - Device supports the request | | | | Send_Break | | | | D1: 1 - Device supports the request | \ | | combination of Set_Line_Coding, | | | | Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State. | | | | D0: 1 - Device supports the request | | | | combination of Set_Comm_Feature, | | | | Clear_Comm_Feature, and Get_Comm_Feature. | | | | The previous bits, in combination, identify | | | | which requests/notifications are supported by | | | | a Communication Class interface with the | | | | SubClass code of Abstract Control Model. ------|---------------------|-------|------------|------------------------------ *//* ... */ typedef struct _AbstractCntrlMgmtFunctionalDescriptor { uint8_t bLength; /*Size of this functional descriptor, in bytes.*/ uint8_t bDescriptorType; /*CS_INTERFACE (0x24)*/ uint8_t bDescriptorSubType; /* Abstract Control Management functional descriptor subtype*//* ... */ uint8_t bmCapabilities; /* The capabilities that this configuration supports */ ...} CDC_AbstCntrlMgmtFuncDesc_TypeDef; /* Union Functional Descriptor -------------------------------------------------------------------------------- Offset| field | Size | Value | Description ------|---------------------|-------|------------|------------------------------ 0 | bFunctionLength | 1 | number | Size of this descriptor. 1 | bDescriptorType | 1 | Constant | CS_INTERFACE (0x24) 2 | bDescriptorSubtype | 1 | Constant | Union functional | | | | descriptor subtype. 3 | bMasterInterface | 1 | Constant | The interface number of the | | | | Communication or Data Class interface 4 | bSlaveInterface0 | 1 | Number | nterface number of first slave or associated | | | | interface in the union. ------|---------------------|-------|------------|------------------------------ *//* ... */ typedef struct _UnionFunctionalDescriptor { uint8_t bLength; /*Size of this functional descriptor, in bytes*/ uint8_t bDescriptorType; /*CS_INTERFACE (0x24)*/ uint8_t bDescriptorSubType; /* Union functional descriptor SubType*/ uint8_t bMasterInterface; /* The interface number of the Communication or Data Class interface,*//* ... */ uint8_t bSlaveInterface0; /*Interface number of first slave*/ ...} CDC_UnionFuncDesc_TypeDef; typedef struct _USBH_CDCInterfaceDesc { CDC_HeaderFuncDesc_TypeDef CDC_HeaderFuncDesc; CDC_CallMgmtFuncDesc_TypeDef CDC_CallMgmtFuncDesc; CDC_AbstCntrlMgmtFuncDesc_TypeDef CDC_AbstCntrlMgmtFuncDesc; CDC_UnionFuncDesc_TypeDef CDC_UnionFuncDesc; ...} CDC_InterfaceDesc_Typedef; /* Structure for CDC process */ typedef struct { uint8_t NotifPipe; uint8_t NotifEp; uint8_t buff[8]; uint16_t NotifEpSize; ...} CDC_CommItfTypedef; typedef struct { uint8_t InPipe; uint8_t OutPipe; uint8_t OutEp; uint8_t InEp; uint8_t buff[8]; uint16_t OutEpSize; uint16_t InEpSize; ...} CDC_DataItfTypedef; /* Structure for CDC process */ typedef struct _CDC_Process { CDC_CommItfTypedef CommItf; CDC_DataItfTypedef DataItf; uint8_t *pTxData; uint8_t *pRxData; uint32_t TxDataLength; uint32_t RxDataLength; CDC_InterfaceDesc_Typedef CDC_Desc; CDC_LineCodingTypeDef LineCoding; CDC_LineCodingTypeDef *pUserLineCoding; CDC_StateTypeDef state; CDC_DataStateTypeDef data_tx_state; CDC_DataStateTypeDef data_rx_state; uint8_t Rx_Poll; ...} CDC_HandleTypeDef; /** * @} *//* ... */ /** @defgroup USBH_CDC_CORE_Exported_Defines * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup USBH_CDC_CORE_Exported_Macros * @{ *//* ... */ /** * @} *//* ... */ /** @defgroup USBH_CDC_CORE_Exported_Variables * @{ *//* ... */ extern USBH_ClassTypeDef CDC_Class; #define USBH_CDC_CLASS &CDC_Class /** * @} *//* ... */ /** @defgroup USBH_CDC_CORE_Exported_FunctionsPrototype * @{ *//* ... */ USBH_StatusTypeDef USBH_CDC_SetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecoding); USBH_StatusTypeDef USBH_CDC_GetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecoding); USBH_StatusTypeDef USBH_CDC_Transmit(USBH_HandleTypeDef *phost, uint8_t *pbuff, uint32_t length); USBH_StatusTypeDef USBH_CDC_Receive(USBH_HandleTypeDef *phost, uint8_t *pbuff, uint32_t length); uint16_t USBH_CDC_GetLastReceivedDataSize(USBH_HandleTypeDef *phost); USBH_StatusTypeDef USBH_CDC_Stop(USBH_HandleTypeDef *phost); void USBH_CDC_LineCodingChanged(USBH_HandleTypeDef *phost); void USBH_CDC_TransmitCallback(USBH_HandleTypeDef *phost); void USBH_CDC_ReceiveCallback(USBH_HandleTypeDef *phost); /** * @} *//* ... */ #ifdef __cplusplus }extern "C" { ... } #endif /* ... */ #endif /* __USBH_CDC_H */ /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */ /** * @} *//* ... */
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.