USBLibAPIGuide
1.00.00.01
bazel-out
k8-dbg
bin
docs
usblib
msp432e4
api-guide-html-srcs
usbcdc.h
Go to the documentation of this file.
1
//*****************************************************************************
2
//
3
// usbhid.h - Definitions used by Communication Device Class devices.
4
//
5
// Copyright (c) 2007-2017 Texas Instruments Incorporated. All rights reserved.
6
// Software License Agreement
7
//
8
// Texas Instruments (TI) is supplying this software for use solely and
9
// exclusively on TI's microcontroller products. The software is owned by
10
// TI and/or its suppliers, and is protected under applicable copyright
11
// laws. You may not combine this software with "viral" open-source
12
// software in order to form a larger program.
13
//
14
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
15
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
16
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
18
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
19
// DAMAGES, FOR ANY REASON WHATSOEVER.
20
//
21
//*****************************************************************************
22
23
//*****************************************************************************
24
//
25
// Note: This header contains definitions related to the USB Communication
26
// Device Class specification. The header is complete for ACM model
27
// devices but request and notification definitions specific to other
28
// modem types, ISDN, ATM and Ethernet are currently incomplete or
29
// omitted.
30
//
31
//*****************************************************************************
32
33
#ifndef __USBCDC_H__
34
#define __USBCDC_H__
35
36
//*****************************************************************************
37
//
38
// If building with a C++ compiler, make all of the definitions in this header
39
// have a C binding.
40
//
41
//*****************************************************************************
42
#ifdef __cplusplus
43
extern
"C"
44
{
45
#endif
46
47
//*****************************************************************************
48
//
51
//
52
//*****************************************************************************
53
54
//*****************************************************************************
55
//
56
// Generic macros to read an 8-bit, 16-bit or 32-bit value from a character
57
// pointer.
58
//
59
//*****************************************************************************
60
#define BYTE(pui8Data) (*(uint8_t *)(pui8Data))
61
#define SHORT(pui8Data) (*(uint16_t *)(pui8Data))
62
#define LONG(pui8Data) (*(uint32_t *)(pui8Data))
63
64
//*****************************************************************************
65
//
66
// USB CDC subclass codes. Used in interface descriptor, bInterfaceClass
67
//
68
//*****************************************************************************
69
#define USB_CDC_SUBCLASS_DIRECT_LINE_MODEL \
70
0x01
71
#define USB_CDC_SUBCLASS_ABSTRACT_MODEL \
72
0x02
73
#define USB_CDC_SUBCLASS_TELEPHONE_MODEL \
74
0x03
75
#define USB_CDC_SUBCLASS_MULTI_CHANNEL_MODEL \
76
0x04
77
#define USB_CDC_SUBCLASS_CAPI_MODEL \
78
0x05
79
#define USB_CDC_SUBCLASS_ETHERNET_MODEL \
80
0x06
81
#define USB_CDC_SUBCLASS_ATM_MODEL \
82
0x07
83
84
//*****************************************************************************
85
//
86
// USB CDC control interface protocols. Used in control interface descriptor,
87
// bInterfaceProtocol. Control interface is the interface where the control
88
// information is sent or received. Usually interface 0.
89
//
90
//*****************************************************************************
91
#define USB_CDC_PROTOCOL_NONE 0x00
92
#define USB_CDC_PROTOCOL_V25TER 0x01
93
#define USB_CDC_PROTOCOL_VENDOR 0xFF
94
95
//*****************************************************************************
96
//
97
// USB CDC data interface protocols. Used in data interface descriptor,
98
// bInterfaceProtocol. Data interface is the interface where the data from
99
// CDC device is sent or received. Usually interface 1
100
//
101
//*****************************************************************************
102
#define USB_CDC_PROTOCOL_NONE 0x00
103
#define USB_CDC_PROTOCOL_I420 0x30
104
#define USB_CDC_PROTOCOL_TRANSPARENT \
105
0x32
106
#define USB_CDC_PROTOCOL_Q921M 0x50
107
#define USB_CDC_PROTOCOL_Q921 0x51
108
#define USB_CDC_PROTOCOL_Q921TM 0x52
109
#define USB_CDC_PROTOCOL_V42BIS 0x90
110
#define USB_CDC_PROTOCOL_Q921EURO \
111
0x91
112
#define USB_CDC_PROTOCOL_V120 0x92
113
#define USB_CDC_PROTOCOL_CAPI20 0x93
114
#define USB_CDC_PROTOCOL_HOST_DRIVER \
115
0xFD
116
#define USB_CDC_PROTOCOL_CDC_SPEC \
117
0xFE
118
#define USB_CDC_PROTOCOL_VENDOR 0xFF
119
120
//*****************************************************************************
121
//
122
// Functional descriptor definitions
123
//
124
//*****************************************************************************
125
126
//*****************************************************************************
127
//
128
// Functional descriptor types
129
//
130
//*****************************************************************************
131
#define USB_CDC_CS_INTERFACE 0x24
132
#define USB_CDC_CS_ENDPOINT 0x25
133
134
//*****************************************************************************
135
//
136
// Functional descriptor subtypes
137
//
138
//*****************************************************************************
139
#define USB_CDC_FD_SUBTYPE_HEADER \
140
0x00
141
#define USB_CDC_FD_SUBTYPE_CALL_MGMT \
142
0x01
143
#define USB_CDC_FD_SUBTYPE_ABSTRACT_CTL_MGMT \
144
0x02
145
#define USB_CDC_FD_SUBTYPE_DIRECT_LINE_MGMT \
146
0x03
147
#define USB_CDC_FD_SUBTYPE_TELEPHONE_RINGER \
148
0x04
149
#define USB_CDC_FD_SUBTYPE_LINE_STATE_CAPS \
150
0x05
151
#define USB_CDC_FD_SUBTYPE_UNION \
152
0x06
153
#define USB_CDC_FD_SUBTYPE_COUNTRY \
154
0x07
155
#define USB_CDC_FD_SUBTYPE_TELEPHONE_MODES \
156
0x08
157
#define USB_CDC_FD_SUBTYPE_USB_TERMINAL \
158
0x09
159
#define USB_CDC_FD_SUBTYPE_NETWORK_TERMINAL \
160
0x0A
161
#define USB_CDC_FD_SUBTYPE_PROTOCOL_UNIT \
162
0x0B
163
#define USB_CDC_FD_SUBTYPE_EXTENSION_UNIT \
164
0x0C
165
#define USB_CDC_FD_SUBTYPE_MULTI_CHANNEL_MGMT \
166
0x0D
167
#define USB_CDC_FD_SUBTYPE_CAPI_MGMT \
168
0x0E
169
#define USB_CDC_FD_SUBTYPE_ETHERNET \
170
0x0F
171
#define USB_CDC_FD_SUBTYPE_ATM 0x10
172
173
//*****************************************************************************
174
//
175
// USB_CDC_FD_SUBTYPE_CALL_MGMT, Header functional descriptor, bmCapabilities
176
//
177
//*****************************************************************************
178
#define USB_CDC_CALL_MGMT_VIA_DATA \
179
0x02
180
#define USB_CDC_CALL_MGMT_HANDLED \
181
0x01
182
183
//*****************************************************************************
184
//
185
// USB_CDC_FD_SUBTYPE_ABSTRACT_CTL_MGMT, Abstract Control Management functional
186
// descriptor, bmCapabilities
187
//
188
//*****************************************************************************
189
#define USB_CDC_ACM_SUPPORTS_NETWORK_CONNECTION \
190
0x08
191
#define USB_CDC_ACM_SUPPORTS_SEND_BREAK \
192
0x04
193
#define USB_CDC_ACM_SUPPORTS_LINE_PARAMS \
194
0x02
195
#define USB_CDC_ACM_SUPPORTS_COMM_FEATURE \
196
0x01
197
198
//*****************************************************************************
199
//
200
// USB_CDC_FD_SUBTYPE_DIRECT_LINE_MGMT, Direct Line Management functional
201
// descriptor, bmCapabilities
202
//
203
//*****************************************************************************
204
#define USB_CDC_DLM_NEEDS_EXTRA_PULSE_SETUP \
205
0x04
206
#define USB_CDC_DLM_SUPPORTS_AUX \
207
0x02
208
#define USB_CDC_DLM_SUPPORTS_PULSE \
209
0x01
210
211
//*****************************************************************************
212
//
213
// USB_CDC_FD_SUBTYPE_TELEPHONE_MODES, Telephone Operational Modes functional
214
// descriptor, bmCapabilities
215
//
216
//*****************************************************************************
217
#define USB_CDC_TELEPHONE_SUPPORTS_COMPUTER \
218
0x04
219
#define USB_CDC_TELEPHONE_SUPPORTS_STANDALONE \
220
0x02
221
#define USB_CDC_TELEPHONE_SUPPORTS_SIMPLE \
222
0x01
223
224
//*****************************************************************************
225
//
226
// USB_CDC_FD_SUBTYPE_LINE_STATE_CAPS, Telephone Call and Line State Reporting
227
// Capabilities descriptor
228
//
229
//*****************************************************************************
230
#define USB_CDC_LINE_STATE_CHANGES_NOTIFIED \
231
0x20
232
#define USB_CDC_LINE_STATE_REPORTS_DTMF \
233
0x10
234
#define USB_CDC_LINE_STATE_REPORTS_DIST_RING \
235
0x08
236
#define USB_CDC_LINE_STATE_REPORTS_CALLERID \
237
0x04
238
#define USB_CDC_LINE_STATE_REPORTS_BUSY \
239
0x02
240
#define USB_CDC_LINE_STATE_REPORTS_INT_DIALTONE \
241
0x01
242
243
//*****************************************************************************
244
//
245
// USB_CDC_FD_SUBTYPE_USB_TERMINAL, USB Terminal functional descriptor,
246
// bmOptions
247
//
248
//*****************************************************************************
249
#define USB_CDC_TERMINAL_NO_WRAPPER_USED \
250
0x00
251
#define USB_CDC_TERMINAL_WRAPPER_USED \
252
0x01
253
254
//*****************************************************************************
255
//
256
// USB_CDC_FD_SUBTYPE_MULTI_CHANNEL_MGMT, Multi-Channel Management functional
257
// descriptor, bmCapabilities
258
//
259
//*****************************************************************************
260
#define USB_CDC_MCM_SUPPORTS_SET_UNIT_PARAM \
261
0x04
262
#define USB_CDC_MCM_SUPPORTS_CLEAR_UNIT_PARAM \
263
0x02
264
#define USB_CDC_MCM_UNIT_PARAMS_NON_VOLATILE \
265
0x01
266
267
//*****************************************************************************
268
//
269
// USB_CDC_FD_SUBTYPE_CAPI_MGMT, CAPI Control Management functional descriptor,
270
// bmCapabilities
271
//
272
//*****************************************************************************
273
#define USB_CDC_CAPI_INTELLIGENT \
274
0x01
275
#define USB_CDC_CAPI_SIMPLE 0x00
276
277
//*****************************************************************************
278
//
279
// USB_CDC_FD_SUBTYPE_ETHERNET, Ethernet Networking functional descriptor,
280
// bmEthernetStatistics
281
//
282
//*****************************************************************************
283
#define USB_CDC_ETHERNET_XMIT_OK \
284
0x01000000
285
#define USB_CDC_ETHERNET_RCV_OK 0x02000000
286
#define USB_CDC_ETHERNET_XMIT_ERROR \
287
0x04000000
288
#define USB_CDC_ETHERNET_RCV_ERROR \
289
0x08000000
290
#define USB_CDC_ETHERNET_RCV_NO_BUFFER \
291
0x10000000
292
#define USB_CDC_ETHERNET_DIRECTED_BYTES_XMIT \
293
0x20000000
294
#define USB_CDC_ETHERNET_DIRECTED_FRAMES_XMIT \
295
0x40000000
296
#define USB_CDC_ETHERNET_MULTICAST_BYTES_XMIT \
297
0x80000000
298
#define USB_CDC_ETHERNET_MULTICAST_FRAMES_XMIT \
299
0x00010000
300
#define USB_CDC_ETHERNET_BROADCAST_BYTES_XMIT \
301
0x00020000
302
#define USB_CDC_ETHERNET_BROADCAST_FRAMES_XMIT \
303
0x00040000
304
#define USB_CDC_ETHERNET_DIRECTED_BYTES_RCV \
305
0x00080000
306
#define USB_CDC_ETHERNET_DIRECTED_FRAMES_RCV \
307
0x00100000
308
#define USB_CDC_ETHERNET_MULTICAST_BYTES_RCV \
309
0x00200000
310
#define USB_CDC_ETHERNET_MULTICAST_FRAMES_RCV \
311
0x00400000
312
#define USB_CDC_ETHERNET_BROADCAST_BYTES_RCV \
313
0x00800000
314
#define USB_CDC_ETHERNET_BROADCAST_FRAMES_RCV \
315
0x00000100
316
#define USB_CDC_ETHERNET_RCV_CRC_ERROR \
317
0x00000200
318
#define USB_CDC_ETHERNET_TRANSMIT_QUEUE_LENGTH \
319
0x00000400
320
#define USB_CDC_ETHERNET_RCV_ERROR_ALIGNMENT \
321
0x00000800
322
#define USB_CDC_ETHERNET_XMIT_ONE_COLLISION \
323
0x00001000
324
#define USB_CDC_ETHERNET_XMIT_MORE_COLLISIONS \
325
0x00002000
326
#define USB_CDC_ETHERNET_XMIT_DEFERRED \
327
0x00004000
328
#define USB_CDC_ETHERNET_XMIT_MAX_COLLISIONS \
329
0x00008000
330
#define USB_CDC_ETHERNET_RCV_OVERRUN \
331
0x00000001
332
#define USB_CDC_ETHERNET_XMIT_UNDERRUN \
333
0x00000002
334
#define USB_CDC_ETHERNET_XMIT_HEARTBEAT_FAILURE \
335
0x00000004
336
#define USB_CDC_ETHERNET_XMIT_TIMES_CRS_LOST \
337
0x00000010
338
339
//*****************************************************************************
340
//
341
// USB_CDC_FD_SUBTYPE_ATM, ATM Networking functional descriptor,
342
// bmDataCapabilities
343
//
344
//*****************************************************************************
345
#define USB_CDC_ATM_TYPE_3 0x08
346
#define USB_CDC_ATM_TYPE_2 0x04
347
#define USB_CDC_ATM_TYPE_1 0x02
348
349
//*****************************************************************************
350
//
351
// bmATMDeviceStatistics
352
//
353
//*****************************************************************************
354
#define USB_CDC_ATM_VC_US_CELLS_SENT \
355
0x10
356
#define USB_CDC_ATM_VC_US_CELLS_RECEIVED \
357
0x08
358
#define USB_CDC_ATM_DS_CELLS_HEC_ERR_CORRECTED \
359
0x04
360
#define USB_CDC_ATM_US_CELLS_SENT \
361
0x02
362
#define USB_CDC_ATM_US_CELLS_RECEIVED \
363
0x01
364
365
//*****************************************************************************
366
//
367
// Management Element Requests (provided in tUSBRequest.bRequest)
368
//
369
//*****************************************************************************
370
#define USB_CDC_SEND_ENCAPSULATED_COMMAND \
371
0x00
372
#define USB_CDC_GET_ENCAPSULATED_RESPONSE \
373
0x01
374
#define USB_CDC_SET_COMM_FEATURE \
375
0x02
376
#define USB_CDC_GET_COMM_FEATURE \
377
0x03
378
#define USB_CDC_CLEAR_COMM_FEATURE \
379
0x04
380
#define USB_CDC_SET_AUX_LINE_STATE \
381
0x10
382
#define USB_CDC_SET_HOOK_STATE 0x11
383
#define USB_CDC_PULSE_SETUP 0x12
384
#define USB_CDC_SEND_PULSE 0x13
385
#define USB_CDC_SET_PULSE_TIME 0x14
386
#define USB_CDC_RING_AUX_JACK 0x15
387
#define USB_CDC_SET_LINE_CODING 0x20
388
#define USB_CDC_GET_LINE_CODING 0x21
389
#define USB_CDC_SET_CONTROL_LINE_STATE \
390
0x22
391
#define USB_CDC_SEND_BREAK 0x23
392
#define USB_CDC_SET_RINGER_PARMS \
393
0x30
394
#define USB_CDC_GET_RINGER_PARMS \
395
0x31
396
#define USB_CDC_SET_OPERATION_PARMS \
397
0x32
398
#define USB_CDC_GET_OPERATION_PARMS \
399
0x33
400
#define USB_CDC_SET_LINE_PARMS 0x34
401
#define USB_CDC_GET_LINE_PARMS 0x35
402
#define USB_CDC_DIAL_DIGITS 0x36
403
#define USB_CDC_SET_UNIT_PARAMETER \
404
0x37
405
#define USB_CDC_GET_UNIT_PARAMETER \
406
0x38
407
#define USB_CDC_CLEAR_UNIT_PARAMETER \
408
0x39
409
#define USB_CDC_GET_PROFILE 0x3A
410
#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS \
411
0x40
412
#define USB_CDC_SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER \
413
0x41
414
#define USB_CDC_GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER \
415
0x42
416
#define USB_CDC_SET_ETHERNET_PACKET_FILTER \
417
0x43
418
#define USB_CDC_GET_ETHERNET_STATISTIC \
419
0x44
420
#define USB_CDC_SET_ATM_DATA_FORMAT \
421
0x50
422
#define USB_CDC_GET_ATM_DEVICE_STATISTICS \
423
0x51
424
#define USB_CDC_SET_ATM_DEFAULT_VC \
425
0x52
426
#define USB_CDC_GET_ATM_VC_STATISTICS \
427
0x53
428
429
//*****************************************************************************
430
//
431
// In cases where a request defined above results in the return of a fixed size
432
// data block, the following group of labels define the size of that block. In
433
// each of these cases, an access macro is also provided to write the response
434
// data into an appropriately-sized array of 8-bit characters.
435
//
436
//*****************************************************************************
437
#define USB_CDC_SIZE_COMM_FEATURE \
438
2
439
#define USB_CDC_SIZE_LINE_CODING \
440
7
441
#define USB_CDC_SIZE_RINGER_PARMS \
442
4
443
#define USB_CDC_SIZE_OPERATION_PARMS \
444
2
445
#define USB_CDC_SIZE_UNIT_PARAMETER \
446
2
447
#define USB_CDC_SIZE_PROFILE 64
448
#define USB_CDC_SIZE_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER \
449
2
450
#define USB_CDC_SIZE_ETHERNET_STATISTIC \
451
4
452
#define USB_CDC_SIZE_ATM_DEVICE_STATISTICS \
453
4
454
#define USB_CDC_SIZE_ATM_VC_STATISTICS \
455
4
456
#define USB_CDC_SIZE_LINE_PARMS \
457
10
458
459
//*****************************************************************************
460
//
461
// NB: USB_CDC_SIZE_LINE_PARAMS assumes only a single call. For multiple
462
// calls, add 4 bytes per additional call.
463
//
464
//*****************************************************************************
465
466
//*****************************************************************************
467
//
468
// USB_CDC_GET_COMM_FEATURE & USB_CDC_SET_COMM_FEATURE
469
//
470
//*****************************************************************************
471
472
//*****************************************************************************
473
//
474
// wValue (Feature Selector)
475
//
476
//*****************************************************************************
477
#define USB_CDC_ABSTRACT_STATE 0x0001
478
#define USB_CDC_COUNTRY_SETTING 0x0002
479
480
//*****************************************************************************
481
//
482
// Data when feature selector is USB_DCD_ABSTRACT_STATE
483
//
484
//*****************************************************************************
485
#define USB_CDC_ABSTRACT_CALL_DATA_MULTIPLEXED \
486
0x0002
487
#define USB_CDC_ABSTRACT_ENDPOINTS_IDLE \
488
0x0001
489
490
//*****************************************************************************
491
//
492
// Macros to populate the response data buffer (whose size in bytes is defined
493
// by USB_CDC_SIZE_COMM_FEATURE).
494
//
495
//*****************************************************************************
496
#define SetResponseCommFeature(pi8Buf, ui16Data) \
497
do \
498
{ \
499
(*(uint16_t *)(pi8Buf)) = ui16Data; \
500
} \
501
while(0)
502
503
//*****************************************************************************
504
//
505
// USB_CDC_SET_AUX_LINE_STATE, wValue
506
//
507
//*****************************************************************************
508
#define USB_CDC_AUX_DISCONNECT 0x0000
509
#define USB_CDC_AUX_CONNECT 0x0001
510
511
//*****************************************************************************
512
//
513
// USB_CDC_SET_HOOK_STATE, wValue
514
//
515
//*****************************************************************************
516
#define USB_CDC_ON_HOOK 0x0000
517
#define USB_CDC_OFF_HOOK 0x0001
518
#define USB_CDC_SNOOPING 0x0002
519
520
//*****************************************************************************
521
//
522
// USB_CDC_GET_LINE_CODING
523
//
524
//*****************************************************************************
525
#define USB_CDC_STOP_BITS_1 0x00
526
#define USB_CDC_STOP_BITS_1_5 0x01
527
#define USB_CDC_STOP_BITS_2 0x02
528
529
#define USB_CDC_PARITY_NONE 0x00
530
#define USB_CDC_PARITY_ODD 0x01
531
#define USB_CDC_PARITY_EVEN 0x02
532
#define USB_CDC_PARITY_MARK 0x03
533
#define USB_CDC_PARITY_SPACE 0x04
534
535
//*****************************************************************************
536
//
537
// Macro to populate the response data buffer (whose size in bytes is defined
538
// by USB_CDC_SIZE_LINE_CODING).
539
//
540
//*****************************************************************************
541
#define SetResponseLineCoding(pi8Buf, ui8Rate, ui8Stop, ui8Parity, \
542
ui8Databits) \
543
do \
544
{ \
545
(*(uint32_t *)(pi8Buf)) = ui8Rate; \
546
(*((uint8_t *)(pi8Buf) + 4)) = ui8Stop; \
547
(*((uint8_t *)(pi8Buf) + 5)) = ui8Parity; \
548
(*((uint8_t *)(pi8Buf) + 6)) = ui8Databits; \
549
} \
550
while(0)
551
552
//*****************************************************************************
553
//
554
// USB_CDC_SET_CONTROL_LINE_STATE, wValue
555
//
556
//*****************************************************************************
557
#define USB_CDC_DEACTIVATE_CARRIER \
558
0x00
559
#define USB_CDC_ACTIVATE_CARRIER \
560
0x02
561
#define USB_CDC_DTE_NOT_PRESENT 0x00
562
#define USB_CDC_DTE_PRESENT 0x01
563
564
//*****************************************************************************
565
//
566
// USB_CDC_SET_RINGER_PARMS, USB_CDC_GET_RINGER_PARMS and
567
// USB_CDC_GET_LINE_PARMS (ui32RingerBmp)
568
//
569
//*****************************************************************************
570
#define USB_CDC_RINGER_EXISTS 0x80000000
571
#define USB_CDC_RINGER_DOES_NOT_EXIST \
572
0x00000000
573
574
//*****************************************************************************
575
//
576
// Macro to populate the response data buffer to USB_CDC_GET_RINGER_PARMS.
577
// Parameter buf points to a buffer of size USB_CDC_SIZE_RINGER_PARMS bytes.
578
//
579
//*****************************************************************************
580
#define SetResponseRingerParms(pi8Buf, ui8Pattern, ui8Volume, ui32Exists) \
581
do \
582
{ \
583
*(uint32_t *)(pi8Buf) = ((ui8Pattern) + \
584
((ui8Volume & 0xFF) << 8) + \
585
(ui32Exists & USB_CDC_RINGER_EXISTS)); \
586
} \
587
while(0)
588
589
//*****************************************************************************
590
//
591
// Macros to extract fields from the USB_CDC_SET_RINGER_PARMS data
592
//
593
//*****************************************************************************
594
#define GetRingerVolume(pi8Data) \
595
(BYTE((pi8Data) + 1))
596
#define GetRingerPattern(pi8Data) \
597
(BYTE(pi8Data))
598
#define GetRingerExists(pi8Data) \
599
((LONG(pi8Data)) & USB_CDC_RINGER_EXISTS)
600
601
//*****************************************************************************
602
//
603
// USB_CDC_SET_OPERATION_PARMS, wValue
604
//
605
//*****************************************************************************
606
#define USB_CDC_SIMPLE_MODE 0x0000
607
#define USB_CDC_STANDALONE_MODE 0x0001
608
#define USB_CDC_HOST_CENTRIC_MODE \
609
0x0002
610
611
//*****************************************************************************
612
//
613
// Macro to populate the response data buffer to USB_CDC_GET_OPERATION_PARMS.
614
// Parameter buf points to a buffer of size USB_CDC_SIZE_OPERATION_PARMS
615
// bytes.
616
//
617
//*****************************************************************************
618
#define SetResponseOperationParms(pi8Bbuf, ui16Data) \
619
do \
620
{ \
621
WORD(pi8Buf) = ui16Data; \
622
} \
623
while(0)
624
625
//*****************************************************************************
626
//
627
// USB_CDC_SET_LINE_PARMS, wParam - Line State Change
628
//
629
//*****************************************************************************
630
#define USB_CDC_DROP_ACTIVE_CALL \
631
0x0000
632
#define USB_CDC_START_NEW_CALL 0x0001
633
#define USB_CDC_APPLY_RINGING 0x0002
634
#define USB_CDC_REMOVE_RINGING 0x0003
635
#define USB_CDC_SWITCH_CALL 0x0004
636
637
//*****************************************************************************
638
//
639
// Line state bitmap in USB_CDC_GET_LINE_PARMS response
640
//
641
//*****************************************************************************
642
#define USB_CDC_LINE_IS_ACTIVE 0x80000000
643
#define USB_CDC_LINE_IS_IDLE 0x00000000
644
#define USB_CDC_LINE_NO_ACTIVE_CALL \
645
0x000000FF
646
647
#define USB_CDC_CALL_ACTIVE 0x80000000
648
649
//*****************************************************************************
650
//
651
// Call state value definitions
652
//
653
//*****************************************************************************
654
#define USB_CDC_CALL_IDLE 0x00000000
655
#define USB_CDC_CALL_TYPICAL_DIALTONE \
656
0x00000001
657
#define USB_CDC_CALL_INTERRUPTED_DIALTONE \
658
0x00000002
659
#define USB_CDC_CALL_DIALING 0x00000003
660
#define USB_CDC_CALL_RINGBACK 0x00000004
661
#define USB_CDC_CALL_CONNECTED 0x00000005
662
#define USB_CDC_CALL_INCOMING 0x00000006
663
664
//*****************************************************************************
665
//
666
// Call state change value definitions
667
//
668
//*****************************************************************************
669
#define USB_CDC_CALL_STATE_IDLE 0x01
670
#define USB_CDC_CALL_STATE_DIALING \
671
0x02
672
#define USB_CDC_CALL_STATE_RINGBACK \
673
0x03
674
#define USB_CDC_CALL_STATE_CONNECTED \
675
0x04
676
#define USB_CDC_CALL_STATE_INCOMING \
677
0x05
678
679
//*****************************************************************************
680
//
681
// Extra byte of data describing the connection type for
682
// USB_CDC_CALL_STATE_CONNECTED.
683
//
684
//*****************************************************************************
685
#define USB_CDC_VOICE 0x00
686
#define USB_CDC_ANSWERING_MACHINE \
687
0x01
688
#define USB_CDC_FAX 0x02
689
#define USB_CDC_MODEM 0x03
690
#define USB_CDC_UNKNOWN 0xFF
691
692
//*****************************************************************************
693
//
694
// Macro to extract call index from request in cases where wParam is
695
// USB_CDC_SWITCH_CALL.
696
//
697
//*****************************************************************************
698
#define GetCallIndex(pi8Data) (BYTE(pi8Data))
699
700
//*****************************************************************************
701
//
702
// Macro to populate the CallState entries in response to request
703
// USB_CDC_GET_LINE_PARMS. The ui8Index parameter is a zero based index
704
// indicating which call entry in the pi8Buf response buffer to fill in. Note
705
// that pi8Buf points to the first byte of the buffer (the wLength field).
706
//
707
//*****************************************************************************
708
#define SetResponseCallState(pi8Buf, ui8Index, ui32Active, ui8StateChange, \
709
ui8State) \
710
do \
711
{ \
712
(LONG((uint8_t *)(pi8Buf) + (10 + (4 * (ui8Index))))) = \
713
(((ui32Active) & USB_CDC_CALL_IS_ACTIVE) + \
714
(((ui8StateChange) & 0xFF) << 8) + \
715
((ui8State) & 0xFF)); \
716
} \
717
while(0)
718
719
//*****************************************************************************
720
//
721
// Macro to populate the response data buffer (whose size in bytes is defined
722
// by USB_CDC_SIZE_LINE_PARMS). Note that this macro only populates fields for
723
// a single call. If multiple calls are being managed, additional 4 byte
724
// fields must be appended to provide call state for each call after the first.
725
// This may be done using the SetResponseCallState macro with the appropriate
726
// call index supplied.
727
//
728
//*****************************************************************************
729
#define SetResponseLineParms(pi8Buf, ui16Length, \
730
ui8RingPattern, ui8RingVolume, ui32RingExists, \
731
ui32LineActive, ui8LineCallIndex, \
732
ui32CallActive, ui8CallStateChange, \
733
ui8CallState) \
734
do \
735
{ \
736
(WORD(pi8Buf)) = ui16Length; \
737
SetResponseRingerParams(((uint8_t *)(pi8Buf) + 2), \
738
ui8RingPattern, ui8RingVolume, \
739
ui32RingExists); \
740
(LONG((uint8_t *)(pi8Buf) + 6)) = \
741
(((ui32LineActive) & USB_CDC_LINE_IS_ACTIVE) + \
742
((ui8LineCallIndex) & 0xFF)) ; \
743
SetResponseCallState(pi8Buf, 0, ui32CallActive, \
744
ui8CallStateChange, ui8CallState); \
745
} \
746
while(0)
747
748
//*****************************************************************************
749
//
750
// Notification Element definitions
751
//
752
//*****************************************************************************
753
#define USB_CDC_NOTIFY_NETWORK_CONNECTION \
754
0x00
755
#define USB_CDC_NOTIFY_RESPONSE_AVAILABLE \
756
0x01
757
#define USB_CDC_NOTIFY_AUX_JACK_HOOK_STATE \
758
0x08
759
#define USB_CDC_NOTIFY_RING_DETECT \
760
0x09
761
#define USB_CDC_NOTIFY_SERIAL_STATE \
762
0x20
763
#define USB_CDC_NOTIFY_CALL_STATE_CHANGE \
764
0x28
765
#define USB_CDC_NOTIFY_LINE_STATE_CHANGE \
766
0x29
767
#define USB_CDC_NOTIFY_CONNECTION_SPEED_CHANGE \
768
0x2A
769
770
//*****************************************************************************
771
//
772
// USB_CDC_NOTIFY_NETWORK_CONNECTION, wValue
773
//
774
//*****************************************************************************
775
#define USB_CDC_NETWORK_DISCONNECTED \
776
0x0000
777
#define USB_CDC_NETWORK_CONNECTED \
778
0x0001
779
780
//*****************************************************************************
781
//
782
// USB_CDC_NOTIFY_AUX_JACK_HOOK_STATE, wValue
783
//
784
//*****************************************************************************
785
#define USB_CDC_AUX_JACK_ON_HOOK \
786
0x0000
787
#define USB_CDC_AUX_JACK_OFF_HOOK \
788
0x0001
789
790
//*****************************************************************************
791
//
792
// USB_CDC_NOTIFY_SERIAL_STATE, Data
793
//
794
//*****************************************************************************
795
796
//*****************************************************************************
797
//
798
// Number of bytes of data returned alongside this notification.
799
//
800
//*****************************************************************************
801
#define USB_CDC_NOTIFY_SERIAL_STATE_SIZE \
802
2
803
804
#define USB_CDC_SERIAL_STATE_OVERRUN \
805
0x0040
806
#define USB_CDC_SERIAL_STATE_PARITY \
807
0x0020
808
#define USB_CDC_SERIAL_STATE_FRAMING \
809
0x0010
810
#define USB_CDC_SERIAL_STATE_RING_SIGNAL \
811
0x0008
812
#define USB_CDC_SERIAL_STATE_BREAK \
813
0x0004
814
#define USB_CDC_SERIAL_STATE_TXCARRIER \
815
0x0002
816
#define USB_CDC_SERIAL_STATE_RXCARRIER \
817
0x0001
818
819
//*****************************************************************************
820
//
821
// USB_CDC_NOTIFY_CALL_STATE_CHANGE, wValue
822
//
823
// Call state values are defined above in the group beginning
824
// USB_CDC_CALL_STATE_IDLE. Note that the data returned alongside this
825
// notification are heavily dependent upon the call state being reported so no
826
// specific lengths or access macros are provided here.
827
//
828
// Macro to construct the correct wValue for this notification given a state
829
// and call index.
830
//
831
//*****************************************************************************
832
#define SetNotifyCallStatewValue(pi16Result, ui8CallState, ui8Index) \
833
do \
834
{ \
835
(WORD(pi16Result)) = (((ui8CallState) & 0xFF) + \
836
(((ui8Index) & 0xFF) << 8)); \
837
} \
838
while(0)
839
840
//*****************************************************************************
841
//
842
// USB_CDC_NOTIFY_LINE_STATE_CHANGE, wValue
843
//
844
// Note that the data returned alongside this notification are heavily
845
// dependent upon the call state being reported so no specific lengths or
846
// access macros are provided here.
847
//
848
//*****************************************************************************
849
#define USB_CDC_LINE_STATE_IDLE 0x0000
850
#define USB_CDC_LINE_STATE_HOLD 0x0001
851
#define USB_CDC_LINE_STATE_OFF_HOOK \
852
0x0002
853
#define USB_CDC_LINE_STATE_ON_HOOK \
854
0x0003
855
856
//*****************************************************************************
857
//
858
// USB_CDC_NOTIFY_CONNECTION_SPEED_CHANGE, Data
859
//
860
// Macro to populate the 8 byte data structure returned alongside this
861
// notification.
862
//
863
//*****************************************************************************
864
#define SetNotifyConnectionSpeedChange(pi8Buf, ui32USBitRate, ui32DSBitRate) \
865
do \
866
{ \
867
LONG(pi8Buf) = ui32USBitRate; \
868
LONG((uint8_t *)(pi8Buf) + 4) = ui32DSBitRate; \
869
} \
870
while(0)
871
872
//*****************************************************************************
873
//
874
// Packed structure definitions for request/response data blocks
875
//
876
//*****************************************************************************
877
878
//*****************************************************************************
879
//
880
// All structures defined in this section of the header require byte packing of
881
// fields. This is usually accomplished using the PACKED macro but, for IAR
882
// Embedded Workbench, this requires a pragma.
883
//
884
//*****************************************************************************
885
#ifdef __ICCARM__
886
#pragma pack(1)
887
#endif
888
889
//*****************************************************************************
890
//
892
//
893
//*****************************************************************************
894
typedef
struct
895
{
896
//
898
//
899
uint32_t
ui32Rate
;
900
901
//
904
//
905
uint8_t
ui8Stop
;
906
907
//
911
//
912
uint8_t
ui8Parity
;
913
914
//
917
//
918
uint8_t
ui8Databits
;
919
}
920
PACKED
tLineCoding;
921
922
//*****************************************************************************
923
//
924
// Return to default packing when using the IAR Embedded Workbench compiler.
925
//
926
//*****************************************************************************
927
#ifdef __ICCARM__
928
#pragma pack()
929
#endif
930
931
//*****************************************************************************
932
//
933
// Close the Doxygen group.
935
//
936
//*****************************************************************************
937
938
//*****************************************************************************
939
//
940
// Mark the end of the C bindings section for C++ compilers.
941
//
942
//*****************************************************************************
943
#ifdef __cplusplus
944
}
945
#endif
946
947
#endif // __USBCDC_H__
PACKED::ui8Stop
uint8_t ui8Stop
Definition:
usbcdc.h:905
PACKED::ui8Databits
uint8_t ui8Databits
Definition:
usbcdc.h:918
PACKED::ui32Rate
uint32_t ui32Rate
The data terminal rate in bits per second.
Definition:
usbcdc.h:899
PACKED::ui8Parity
uint8_t ui8Parity
Definition:
usbcdc.h:912
PACKED
USB_CDC_GET/SET_LINE_CODING request-specific data.
Definition:
usbaudio.h:288
© Copyright 1995-2020
, Texas Instruments Incorporated. All rights reserved.
Trademarks
|
Privacy policy
|
Terms of use
|
Terms of sale