root/Examples_CP-JR_ARM7_LPC2368/ETT_LPC2368_Examples/USB_DEMO/USBCDC/cdc.h

Revision 8, 11.4 kB (checked in by phil, 16 years ago)

Added Examples etc. from CD

Line 
1 /*----------------------------------------------------------------------------
2  *      U S B  -  K e r n e l
3  *----------------------------------------------------------------------------
4  *      Name:    CDC.h
5  *      Purpose: USB Communication Device Class Definitions
6  *      Version: V1.00
7  *----------------------------------------------------------------------------
8  *      This file is part of the uVision/ARM development tools.
9  *      This software may only be used under the terms of a valid, current,
10  *      end user licence from KEIL for a compatible version of KEIL software
11  *      development tools. Nothing else gives you the right to use it.
12  *
13  *      Copyright (c) 2005-2007 Keil Software.
14  *---------------------------------------------------------------------------*/
15
16 #ifndef __CDC_H
17 #define __CDC_H
18
19 /*----------------------------------------------------------------------------
20  *      Definitions  based on usbcdc11.pdf (www.usb.org)
21  *---------------------------------------------------------------------------*/
22 // Communication device class specification version 1.10
23 #define CDC_V1_10                               0x0110
24
25 // Communication interface class code
26 // (usbcdc11.pdf, 4.2, Table 15)
27 #define CDC_COMMUNICATION_INTERFACE_CLASS       0x02
28
29 // Communication interface class subclass codes
30 // (usbcdc11.pdf, 4.3, Table 16)
31 #define CDC_DIRECT_LINE_CONTROL_MODEL           0x01
32 #define CDC_ABSTRACT_CONTROL_MODEL              0x02
33 #define CDC_TELEPHONE_CONTROL_MODEL             0x03
34 #define CDC_MULTI_CHANNEL_CONTROL_MODEL         0x04
35 #define CDC_CAPI_CONTROL_MODEL                  0x05
36 #define CDC_ETHERNET_NETWORKING_CONTROL_MODEL   0x06
37 #define CDC_ATM_NETWORKING_CONTROL_MODEL        0x07
38
39 // Communication interface class control protocol codes
40 // (usbcdc11.pdf, 4.4, Table 17)
41 #define CDC_PROTOCOL_COMMON_AT_COMMANDS         0x01
42
43 // Data interface class code
44 // (usbcdc11.pdf, 4.5, Table 18)
45 #define CDC_DATA_INTERFACE_CLASS                0x0A
46
47 // Data interface class protocol codes
48 // (usbcdc11.pdf, 4.7, Table 19)
49 #define CDC_PROTOCOL_ISDN_BRI                   0x30
50 #define CDC_PROTOCOL_HDLC                       0x31
51 #define CDC_PROTOCOL_TRANSPARENT                0x32
52 #define CDC_PROTOCOL_Q921_MANAGEMENT            0x50
53 #define CDC_PROTOCOL_Q921_DATA_LINK             0x51
54 #define CDC_PROTOCOL_Q921_MULTIPLEXOR           0x52
55 #define CDC_PROTOCOL_V42                        0x90
56 #define CDC_PROTOCOL_EURO_ISDN                  0x91
57 #define CDC_PROTOCOL_V24_RATE_ADAPTATION        0x92
58 #define CDC_PROTOCOL_CAPI                       0x93
59 #define CDC_PROTOCOL_HOST_BASED_DRIVER          0xFD
60 #define CDC_PROTOCOL_DESCRIBED_IN_PUFD          0xFE
61
62 // Type values for bDescriptorType field of functional descriptors
63 // (usbcdc11.pdf, 5.2.3, Table 24)
64 #define CDC_CS_INTERFACE                        0x24
65 #define CDC_CS_ENDPOINT                         0x25
66
67 // Type values for bDescriptorSubtype field of functional descriptors
68 // (usbcdc11.pdf, 5.2.3, Table 25)
69 #define CDC_HEADER                              0x00
70 #define CDC_CALL_MANAGEMENT                     0x01
71 #define CDC_ABSTRACT_CONTROL_MANAGEMENT         0x02
72 #define CDC_DIRECT_LINE_MANAGEMENT              0x03
73 #define CDC_TELEPHONE_RINGER                    0x04
74 #define CDC_REPORTING_CAPABILITIES              0x05
75 #define CDC_UNION                               0x06
76 #define CDC_COUNTRY_SELECTION                   0x07
77 #define CDC_TELEPHONE_OPERATIONAL_MODES         0x08
78 #define CDC_USB_TERMINAL                        0x09
79 #define CDC_NETWORK_CHANNEL                     0x0A
80 #define CDC_PROTOCOL_UNIT                       0x0B
81 #define CDC_EXTENSION_UNIT                      0x0C
82 #define CDC_MULTI_CHANNEL_MANAGEMENT            0x0D
83 #define CDC_CAPI_CONTROL_MANAGEMENT             0x0E
84 #define CDC_ETHERNET_NETWORKING                 0x0F
85 #define CDC_ATM_NETWORKING                      0x10
86
87 // CDC class-specific request codes
88 // (usbcdc11.pdf, 6.2, Table 46)
89 // see Table 45 for info about the specific requests.
90 #define CDC_SEND_ENCAPSULATED_COMMAND           0x00
91 #define CDC_GET_ENCAPSULATED_RESPONSE           0x01
92 #define CDC_SET_COMM_FEATURE                    0x02
93 #define CDC_GET_COMM_FEATURE                    0x03
94 #define CDC_CLEAR_COMM_FEATURE                  0x04
95 #define CDC_SET_AUX_LINE_STATE                  0x10
96 #define CDC_SET_HOOK_STATE                      0x11
97 #define CDC_PULSE_SETUP                         0x12
98 #define CDC_SEND_PULSE                          0x13
99 #define CDC_SET_PULSE_TIME                      0x14
100 #define CDC_RING_AUX_JACK                       0x15
101 #define CDC_SET_LINE_CODING                     0x20
102 #define CDC_GET_LINE_CODING                     0x21
103 #define CDC_SET_CONTROL_LINE_STATE              0x22
104 #define CDC_SEND_BREAK                          0x23
105 #define CDC_SET_RINGER_PARMS                    0x30
106 #define CDC_GET_RINGER_PARMS                    0x31
107 #define CDC_SET_OPERATION_PARMS                 0x32
108 #define CDC_GET_OPERATION_PARMS                 0x33
109 #define CDC_SET_LINE_PARMS                      0x34
110 #define CDC_GET_LINE_PARMS                      0x35
111 #define CDC_DIAL_DIGITS                         0x36
112 #define CDC_SET_UNIT_PARAMETER                  0x37
113 #define CDC_GET_UNIT_PARAMETER                  0x38
114 #define CDC_CLEAR_UNIT_PARAMETER                0x39
115 #define CDC_GET_PROFILE                         0x3A
116 #define CDC_SET_ETHERNET_MULTICAST_FILTERS      0x40
117 #define CDC_SET_ETHERNET_PMP_FILTER             0x41
118 #define CDC_GET_ETHERNET_PMP_FILTER             0x42
119 #define CDC_SET_ETHERNET_PACKET_FILTER          0x43
120 #define CDC_GET_ETHERNET_STATISTIC              0x44
121 #define CDC_SET_ATM_DATA_FORMAT                 0x50
122 #define CDC_GET_ATM_DEVICE_STATISTICS           0x51
123 #define CDC_SET_ATM_DEFAULT_VC                  0x52
124 #define CDC_GET_ATM_VC_STATISTICS               0x53
125
126 // Communication feature selector codes
127 // (usbcdc11.pdf, 6.2.2..6.2.4, Table 47)
128 #define CDC_ABSTRACT_STATE                      0x01
129 #define CDC_COUNTRY_SETTING                     0x02
130
131 // Feature Status returned for ABSTRACT_STATE Selector
132 // (usbcdc11.pdf, 6.2.3, Table 48)
133 #define CDC_IDLE_SETTING                        (1 << 0)
134 #define CDC_DATA_MULTPLEXED_STATE               (1 << 1)
135
136
137 // Control signal bitmap values for the SetControlLineState request
138 // (usbcdc11.pdf, 6.2.14, Table 51)
139 #define CDC_DTE_PRESENT                         (1 << 0)
140 #define CDC_ACTIVATE_CARRIER                    (1 << 1)
141
142 // CDC class-specific notification codes
143 // (usbcdc11.pdf, 6.3, Table 68)
144 // see Table 67 for Info about class-specific notifications
145 #define CDC_NOTIFICATION_NETWORK_CONNECTION     0x00
146 #define CDC_RESPONSE_AVAILABLE                  0x01
147 #define CDC_AUX_JACK_HOOK_STATE                 0x08
148 #define CDC_RING_DETECT                         0x09
149 #define CDC_NOTIFICATION_SERIAL_STATE           0x20
150 #define CDC_CALL_STATE_CHANGE                   0x28
151 #define CDC_LINE_STATE_CHANGE                   0x29
152 #define CDC_CONNECTION_SPEED_CHANGE             0x2A
153
154 // UART state bitmap values (Serial state notification).
155 // (usbcdc11.pdf, 6.3.5, Table 69)
156 #define CDC_SERIAL_STATE_OVERRUN                (1 << 6)  // receive data overrun error has occurred
157 #define CDC_SERIAL_STATE_PARITY                 (1 << 5)  // parity error has occurred
158 #define CDC_SERIAL_STATE_FRAMING                (1 << 4)  // framing error has occurred
159 #define CDC_SERIAL_STATE_RING                   (1 << 3)  // state of ring signal detection
160 #define CDC_SERIAL_STATE_BREAK                  (1 << 2)  // state of break detection
161 #define CDC_SERIAL_STATE_TX_CARRIER             (1 << 1)  // state of transmission carrier
162 #define CDC_SERIAL_STATE_RX_CARRIER             (1 << 0)  // state of receiver carrier
163
164
165 /*----------------------------------------------------------------------------
166  *      Structures  based on usbcdc11.pdf (www.usb.org)
167  *---------------------------------------------------------------------------*/
168
169 // Header functional descriptor
170 // (usbcdc11.pdf, 5.2.3.1)
171 // This header must precede any list of class-specific descriptors.
172 typedef __packed struct _CDC_HEADER_DESCRIPTOR{
173   BYTE bFunctionLength;                     // size of this descriptor in bytes
174   BYTE bDescriptorType;                     // CS_INTERFACE descriptor type
175   BYTE bDescriptorSubtype;                  // Header functional descriptor subtype
176   WORD bcdCDC;                              // USB CDC specification release version
177 } CDC_HEADER_DESCRIPTOR;
178
179 //Call management functional descriptor
180 // (usbcdc11.pdf, 5.2.3.2)
181 // Describes the processing of calls for the communication class interface.
182 typedef __packed struct _CDC_CALL_MANAGEMENT_DESCRIPTOR {
183   BYTE bFunctionLength;                     // size of this descriptor in bytes
184   BYTE bDescriptorType;                     // CS_INTERFACE descriptor type
185   BYTE bDescriptorSubtype;                  // call management functional descriptor subtype
186   BYTE bmCapabilities;                      // capabilities that this configuration supports
187   BYTE bDataInterface;                      // interface number of the data class interface used for call management (optional)
188 } CDC_CALL_MANAGEMENT_DESCRIPTOR;
189
190 // Abstract control management functional descriptor
191 // (usbcdc11.pdf, 5.2.3.3)
192 // Describes the command supported by the communication interface class with the Abstract Control Model subclass code.
193 typedef __packed struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR {
194   BYTE bFunctionLength;                     // size of this descriptor in bytes
195   BYTE bDescriptorType;                     // CS_INTERFACE descriptor type
196   BYTE bDescriptorSubtype;                  // abstract control management functional descriptor subtype
197   BYTE bmCapabilities;                      // capabilities supported by this configuration
198 } CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR;
199
200 // Union functional descriptors
201 // (usbcdc11.pdf, 5.2.3.8)
202 // Describes the relationship between a group of interfaces that can be considered to form a functional unit.
203 typedef __packed struct _CDC_UNION_DESCRIPTOR {
204   BYTE bFunctionLength;                     // size of this descriptor in bytes
205   BYTE bDescriptorType;                     // CS_INTERFACE descriptor type
206   BYTE bDescriptorSubtype;                  // union functional descriptor subtype
207   BYTE bMasterInterface;                    // interface number designated as master
208 } CDC_UNION_DESCRIPTOR;
209
210 // Union functional descriptors with one slave interface
211 // (usbcdc11.pdf, 5.2.3.8)
212 typedef __packed struct _CDC_UNION_1SLAVE_DESCRIPTOR {
213   CDC_UNION_DESCRIPTOR sUnion;              // Union functional descriptor
214   BYTE                 bSlaveInterfaces[1]; // Slave interface 0
215 } CDC_UNION_1SLAVE_DESCRIPTOR;
216
217 //  Line coding structure
218 //  Format of the data returned when a GetLineCoding request is received
219 // (usbcdc11.pdf, 6.2.13)
220 typedef __packed struct _CDC_LINE_CODING {
221   DWORD dwDTERate;                          // Data terminal rate in bits per second
222   BYTE  bCharFormat;                        // Number of stop bits
223   BYTE  bParityType;                        // Parity bit type
224   BYTE  bDataBits;                          // Number of data bits
225 } CDC_LINE_CODING;
226
227 // Notification header
228 // Data sent on the notification endpoint must follow this header.
229 // see  USB_SETUP_PACKET in file usb.h
230 typedef USB_SETUP_PACKET CDC_NOTIFICATION_HEADER;
231
232 #endif /* __CDC_H */
233
Note: See TracBrowser for help on using the browser.