| USBD ROM Stack 2.0 ROM based USB device stack

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