1 /***********************************************************************
\r
2 * $Id:: mw_usbd_cdc.h 165 2011-04-14 17:41:11Z usb10131 $
\r
4 * Project: USB device ROM Stack
\r
7 * USB Communication Device Class User module Definitions.
\r
9 ***********************************************************************
\r
10 * Copyright(C) 2011, NXP Semiconductor
\r
11 * All rights reserved.
\r
13 * Software that is described herein is for illustrative purposes only
\r
14 * which provides customers with programming information regarding the
\r
15 * products. This software is supplied "AS IS" without any warranties.
\r
16 * NXP Semiconductors assumes no responsibility or liability for the
\r
17 * use of the software, conveys no license or title under any patent,
\r
18 * copyright, or mask work right to the product. NXP Semiconductors
\r
19 * reserves the right to make changes in the software without
\r
20 * notification. NXP Semiconductors also make no representation or
\r
21 * warranty that such application will be suitable for the specified
\r
22 * use without further testing or modification.
\r
23 **********************************************************************/
\r
29 /*----------------------------------------------------------------------------
\r
30 * Definitions based on usbcdc11.pdf (www.usb.org)
\r
31 *---------------------------------------------------------------------------*/
\r
32 /* Communication device class specification version 1.10 */
\r
33 #define CDC_V1_10 0x0110
\r
35 /* Communication interface class code */
\r
36 /* (usbcdc11.pdf, 4.2, Table 15) */
\r
37 #define CDC_COMMUNICATION_INTERFACE_CLASS 0x02
\r
39 /* Communication interface class subclass codes */
\r
40 /* (usbcdc11.pdf, 4.3, Table 16) */
\r
41 #define CDC_DIRECT_LINE_CONTROL_MODEL 0x01
\r
42 #define CDC_ABSTRACT_CONTROL_MODEL 0x02
\r
43 #define CDC_TELEPHONE_CONTROL_MODEL 0x03
\r
44 #define CDC_MULTI_CHANNEL_CONTROL_MODEL 0x04
\r
45 #define CDC_CAPI_CONTROL_MODEL 0x05
\r
46 #define CDC_ETHERNET_NETWORKING_CONTROL_MODEL 0x06
\r
47 #define CDC_ATM_NETWORKING_CONTROL_MODEL 0x07
\r
49 /* Communication interface class control protocol codes */
\r
50 /* (usbcdc11.pdf, 4.4, Table 17) */
\r
51 #define CDC_PROTOCOL_COMMON_AT_COMMANDS 0x01
\r
53 /* Data interface class code */
\r
54 /* (usbcdc11.pdf, 4.5, Table 18) */
\r
55 #define CDC_DATA_INTERFACE_CLASS 0x0A
\r
57 /* Data interface class protocol codes */
\r
58 /* (usbcdc11.pdf, 4.7, Table 19) */
\r
59 #define CDC_PROTOCOL_ISDN_BRI 0x30
\r
60 #define CDC_PROTOCOL_HDLC 0x31
\r
61 #define CDC_PROTOCOL_TRANSPARENT 0x32
\r
62 #define CDC_PROTOCOL_Q921_MANAGEMENT 0x50
\r
63 #define CDC_PROTOCOL_Q921_DATA_LINK 0x51
\r
64 #define CDC_PROTOCOL_Q921_MULTIPLEXOR 0x52
\r
65 #define CDC_PROTOCOL_V42 0x90
\r
66 #define CDC_PROTOCOL_EURO_ISDN 0x91
\r
67 #define CDC_PROTOCOL_V24_RATE_ADAPTATION 0x92
\r
68 #define CDC_PROTOCOL_CAPI 0x93
\r
69 #define CDC_PROTOCOL_HOST_BASED_DRIVER 0xFD
\r
70 #define CDC_PROTOCOL_DESCRIBED_IN_PUFD 0xFE
\r
72 /* Type values for bDescriptorType field of functional descriptors */
\r
73 /* (usbcdc11.pdf, 5.2.3, Table 24) */
\r
74 #define CDC_CS_INTERFACE 0x24
\r
75 #define CDC_CS_ENDPOINT 0x25
\r
77 /* Type values for bDescriptorSubtype field of functional descriptors */
\r
78 /* (usbcdc11.pdf, 5.2.3, Table 25) */
\r
79 #define CDC_HEADER 0x00
\r
80 #define CDC_CALL_MANAGEMENT 0x01
\r
81 #define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02
\r
82 #define CDC_DIRECT_LINE_MANAGEMENT 0x03
\r
83 #define CDC_TELEPHONE_RINGER 0x04
\r
84 #define CDC_REPORTING_CAPABILITIES 0x05
\r
85 #define CDC_UNION 0x06
\r
86 #define CDC_COUNTRY_SELECTION 0x07
\r
87 #define CDC_TELEPHONE_OPERATIONAL_MODES 0x08
\r
88 #define CDC_USB_TERMINAL 0x09
\r
89 #define CDC_NETWORK_CHANNEL 0x0A
\r
90 #define CDC_PROTOCOL_UNIT 0x0B
\r
91 #define CDC_EXTENSION_UNIT 0x0C
\r
92 #define CDC_MULTI_CHANNEL_MANAGEMENT 0x0D
\r
93 #define CDC_CAPI_CONTROL_MANAGEMENT 0x0E
\r
94 #define CDC_ETHERNET_NETWORKING 0x0F
\r
95 #define CDC_ATM_NETWORKING 0x10
\r
97 /* CDC class-specific request codes */
\r
98 /* (usbcdc11.pdf, 6.2, Table 46) */
\r
99 /* see Table 45 for info about the specific requests. */
\r
100 #define CDC_SEND_ENCAPSULATED_COMMAND 0x00
\r
101 #define CDC_GET_ENCAPSULATED_RESPONSE 0x01
\r
102 #define CDC_SET_COMM_FEATURE 0x02
\r
103 #define CDC_GET_COMM_FEATURE 0x03
\r
104 #define CDC_CLEAR_COMM_FEATURE 0x04
\r
105 #define CDC_SET_AUX_LINE_STATE 0x10
\r
106 #define CDC_SET_HOOK_STATE 0x11
\r
107 #define CDC_PULSE_SETUP 0x12
\r
108 #define CDC_SEND_PULSE 0x13
\r
109 #define CDC_SET_PULSE_TIME 0x14
\r
110 #define CDC_RING_AUX_JACK 0x15
\r
111 #define CDC_SET_LINE_CODING 0x20
\r
112 #define CDC_GET_LINE_CODING 0x21
\r
113 #define CDC_SET_CONTROL_LINE_STATE 0x22
\r
114 #define CDC_SEND_BREAK 0x23
\r
115 #define CDC_SET_RINGER_PARMS 0x30
\r
116 #define CDC_GET_RINGER_PARMS 0x31
\r
117 #define CDC_SET_OPERATION_PARMS 0x32
\r
118 #define CDC_GET_OPERATION_PARMS 0x33
\r
119 #define CDC_SET_LINE_PARMS 0x34
\r
120 #define CDC_GET_LINE_PARMS 0x35
\r
121 #define CDC_DIAL_DIGITS 0x36
\r
122 #define CDC_SET_UNIT_PARAMETER 0x37
\r
123 #define CDC_GET_UNIT_PARAMETER 0x38
\r
124 #define CDC_CLEAR_UNIT_PARAMETER 0x39
\r
125 #define CDC_GET_PROFILE 0x3A
\r
126 #define CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
\r
127 #define CDC_SET_ETHERNET_PMP_FILTER 0x41
\r
128 #define CDC_GET_ETHERNET_PMP_FILTER 0x42
\r
129 #define CDC_SET_ETHERNET_PACKET_FILTER 0x43
\r
130 #define CDC_GET_ETHERNET_STATISTIC 0x44
\r
131 #define CDC_SET_ATM_DATA_FORMAT 0x50
\r
132 #define CDC_GET_ATM_DEVICE_STATISTICS 0x51
\r
133 #define CDC_SET_ATM_DEFAULT_VC 0x52
\r
134 #define CDC_GET_ATM_VC_STATISTICS 0x53
\r
136 /* Communication feature selector codes */
\r
137 /* (usbcdc11.pdf, 6.2.2..6.2.4, Table 47) */
\r
138 #define CDC_ABSTRACT_STATE 0x01
\r
139 #define CDC_COUNTRY_SETTING 0x02
\r
141 /* Feature Status returned for ABSTRACT_STATE Selector */
\r
142 /* (usbcdc11.pdf, 6.2.3, Table 48) */
\r
143 #define CDC_IDLE_SETTING (1 << 0)
\r
144 #define CDC_DATA_MULTPLEXED_STATE (1 << 1)
\r
147 /* Control signal bitmap values for the SetControlLineState request */
\r
148 /* (usbcdc11.pdf, 6.2.14, Table 51) */
\r
149 #define CDC_DTE_PRESENT (1 << 0)
\r
150 #define CDC_ACTIVATE_CARRIER (1 << 1)
\r
152 /* CDC class-specific notification codes */
\r
153 /* (usbcdc11.pdf, 6.3, Table 68) */
\r
154 /* see Table 67 for Info about class-specific notifications */
\r
155 #define CDC_NOTIFICATION_NETWORK_CONNECTION 0x00
\r
156 #define CDC_RESPONSE_AVAILABLE 0x01
\r
157 #define CDC_AUX_JACK_HOOK_STATE 0x08
\r
158 #define CDC_RING_DETECT 0x09
\r
159 #define CDC_NOTIFICATION_SERIAL_STATE 0x20
\r
160 #define CDC_CALL_STATE_CHANGE 0x28
\r
161 #define CDC_LINE_STATE_CHANGE 0x29
\r
162 #define CDC_CONNECTION_SPEED_CHANGE 0x2A
\r
164 /* UART state bitmap values (Serial state notification). */
\r
165 /* (usbcdc11.pdf, 6.3.5, Table 69) */
\r
166 #define CDC_SERIAL_STATE_OVERRUN (1 << 6) /* receive data overrun error has occurred */
\r
167 #define CDC_SERIAL_STATE_PARITY (1 << 5) /* parity error has occurred */
\r
168 #define CDC_SERIAL_STATE_FRAMING (1 << 4) /* framing error has occurred */
\r
169 #define CDC_SERIAL_STATE_RING (1 << 3) /* state of ring signal detection */
\r
170 #define CDC_SERIAL_STATE_BREAK (1 << 2) /* state of break detection */
\r
171 #define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) /* state of transmission carrier */
\r
172 #define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) /* state of receiver carrier */
\r
175 /*----------------------------------------------------------------------------
\r
176 * Structures based on usbcdc11.pdf (www.usb.org)
\r
177 *---------------------------------------------------------------------------*/
\r
179 /* Header functional descriptor */
\r
180 /* (usbcdc11.pdf, 5.2.3.1) */
\r
181 /* This header must precede any list of class-specific descriptors. */
\r
182 PRE_PACK struct POST_PACK _CDC_HEADER_DESCRIPTOR{
\r
183 uint8_t bFunctionLength; /* size of this descriptor in bytes */
\r
184 uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
\r
185 uint8_t bDescriptorSubtype; /* Header functional descriptor subtype */
\r
186 uint16_t bcdCDC; /* USB CDC specification release version */
\r
188 typedef struct _CDC_HEADER_DESCRIPTOR CDC_HEADER_DESCRIPTOR;
\r
190 /* Call management functional descriptor */
\r
191 /* (usbcdc11.pdf, 5.2.3.2) */
\r
192 /* Describes the processing of calls for the communication class interface. */
\r
193 PRE_PACK struct POST_PACK _CDC_CALL_MANAGEMENT_DESCRIPTOR {
\r
194 uint8_t bFunctionLength; /* size of this descriptor in bytes */
\r
195 uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
\r
196 uint8_t bDescriptorSubtype; /* call management functional descriptor subtype */
\r
197 uint8_t bmCapabilities; /* capabilities that this configuration supports */
\r
198 uint8_t bDataInterface; /* interface number of the data class interface used for call management (optional) */
\r
200 typedef struct _CDC_CALL_MANAGEMENT_DESCRIPTOR CDC_CALL_MANAGEMENT_DESCRIPTOR;
\r
202 /* Abstract control management functional descriptor */
\r
203 /* (usbcdc11.pdf, 5.2.3.3) */
\r
204 /* Describes the command supported by the communication interface class with the Abstract Control Model subclass code. */
\r
205 PRE_PACK struct POST_PACK _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR {
\r
206 uint8_t bFunctionLength; /* size of this descriptor in bytes */
\r
207 uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
\r
208 uint8_t bDescriptorSubtype; /* abstract control management functional descriptor subtype */
\r
209 uint8_t bmCapabilities; /* capabilities supported by this configuration */
\r
211 typedef struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR;
\r
213 /* Union functional descriptors */
\r
214 /* (usbcdc11.pdf, 5.2.3.8) */
\r
215 /* Describes the relationship between a group of interfaces that can be considered to form a functional unit. */
\r
216 PRE_PACK struct POST_PACK _CDC_UNION_DESCRIPTOR {
\r
217 uint8_t bFunctionLength; /* size of this descriptor in bytes */
\r
218 uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
\r
219 uint8_t bDescriptorSubtype; /* union functional descriptor subtype */
\r
220 uint8_t bMasterInterface; /* interface number designated as master */
\r
222 typedef struct _CDC_UNION_DESCRIPTOR CDC_UNION_DESCRIPTOR;
\r
224 /* Union functional descriptors with one slave interface */
\r
225 /* (usbcdc11.pdf, 5.2.3.8) */
\r
226 PRE_PACK struct POST_PACK _CDC_UNION_1SLAVE_DESCRIPTOR {
\r
227 CDC_UNION_DESCRIPTOR sUnion; /* Union functional descriptor */
\r
228 uint8_t bSlaveInterfaces[1]; /* Slave interface 0 */
\r
230 typedef struct _CDC_UNION_1SLAVE_DESCRIPTOR CDC_UNION_1SLAVE_DESCRIPTOR;
\r
232 /* Line coding structure */
\r
233 /* Format of the data returned when a GetLineCoding request is received */
\r
234 /* (usbcdc11.pdf, 6.2.13) */
\r
235 PRE_PACK struct POST_PACK _CDC_LINE_CODING {
\r
236 uint32_t dwDTERate; /* Data terminal rate in bits per second */
\r
237 uint8_t bCharFormat; /* Number of stop bits */
\r
238 uint8_t bParityType; /* Parity bit type */
\r
239 uint8_t bDataBits; /* Number of data bits */
\r
241 typedef struct _CDC_LINE_CODING CDC_LINE_CODING;
\r
243 /* Notification header */
\r
244 /* Data sent on the notification endpoint must follow this header. */
\r
245 /* see USB_SETUP_PACKET in file usb.h */
\r
246 typedef USB_SETUP_PACKET CDC_NOTIFICATION_HEADER;
\r
248 #endif /* __CDC_H */
\r