| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
usbd_cdc.h
Go to the documentation of this file.
1 /***********************************************************************
2 * $Id: mw_usbd_cdc.h.rca 1.2 Tue Nov 1 11:45:07 2011 nlv09221 Experimental $
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 "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
147 /* Control signal bitmap values for the SetControlLineState request */
148 /* (usbcdc11.pdf, 6.2.14, Table 51) */
149 #define CDC_DTE_PRESENT (1 << 0)
150 #define CDC_ACTIVATE_CARRIER (1 << 1)
151
152 /* CDC class-specific notification codes */
153 /* (usbcdc11.pdf, 6.3, Table 68) */
154 /* see Table 67 for Info about class-specific notifications */
155 #define CDC_NOTIFICATION_NETWORK_CONNECTION 0x00
156 #define CDC_RESPONSE_AVAILABLE 0x01
157 #define CDC_AUX_JACK_HOOK_STATE 0x08
158 #define CDC_RING_DETECT 0x09
159 #define CDC_NOTIFICATION_SERIAL_STATE 0x20
160 #define CDC_CALL_STATE_CHANGE 0x28
161 #define CDC_LINE_STATE_CHANGE 0x29
162 #define CDC_CONNECTION_SPEED_CHANGE 0x2A
163
164 /* UART state bitmap values (Serial state notification). */
165 /* (usbcdc11.pdf, 6.3.5, Table 69) */
166 #define CDC_SERIAL_STATE_OVERRUN (1 << 6) /* receive data overrun error has occurred */
167 #define CDC_SERIAL_STATE_PARITY (1 << 5) /* parity error has occurred */
168 #define CDC_SERIAL_STATE_FRAMING (1 << 4) /* framing error has occurred */
169 #define CDC_SERIAL_STATE_RING (1 << 3) /* state of ring signal detection */
170 #define CDC_SERIAL_STATE_BREAK (1 << 2) /* state of break detection */
171 #define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) /* state of transmission carrier */
172 #define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) /* state of receiver carrier */
173
174
175 /*----------------------------------------------------------------------------
176 * Structures based on usbcdc11.pdf (www.usb.org)
177 *---------------------------------------------------------------------------*/
178
179 /* Header functional descriptor */
180 /* (usbcdc11.pdf, 5.2.3.1) */
181 /* This header must precede any list of class-specific descriptors. */
182 PRE_PACK struct POST_PACK _CDC_HEADER_DESCRIPTOR{
183 uint8_t bFunctionLength; /* size of this descriptor in bytes */
184 uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
185 uint8_t bDescriptorSubtype; /* Header functional descriptor subtype */
186 uint16_t bcdCDC; /* USB CDC specification release version */
187 };
188 typedef struct _CDC_HEADER_DESCRIPTOR CDC_HEADER_DESCRIPTOR;
189
190 /* Call management functional descriptor */
191 /* (usbcdc11.pdf, 5.2.3.2) */
192 /* Describes the processing of calls for the communication class interface. */
193 PRE_PACK struct POST_PACK _CDC_CALL_MANAGEMENT_DESCRIPTOR {
194 uint8_t bFunctionLength; /* size of this descriptor in bytes */
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 uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
208 uint8_t bDescriptorSubtype; /* abstract control management functional descriptor subtype */
209 uint8_t bmCapabilities; /* capabilities supported by this configuration */
210 };
211 typedef struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR;
212
213 /* Union functional descriptors */
214 /* (usbcdc11.pdf, 5.2.3.8) */
215 /* Describes the relationship between a group of interfaces that can be considered to form a functional unit. */
216 PRE_PACK struct POST_PACK _CDC_UNION_DESCRIPTOR {
217 uint8_t bFunctionLength; /* size of this descriptor in bytes */
218 uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */
219 uint8_t bDescriptorSubtype; /* union functional descriptor subtype */
220 uint8_t bMasterInterface; /* interface number designated as master */
221 };
222 typedef struct _CDC_UNION_DESCRIPTOR CDC_UNION_DESCRIPTOR;
223
224 /* Union functional descriptors with one slave interface */
225 /* (usbcdc11.pdf, 5.2.3.8) */
226 PRE_PACK struct POST_PACK _CDC_UNION_1SLAVE_DESCRIPTOR {
227 CDC_UNION_DESCRIPTOR sUnion; /* Union functional descriptor */
228 uint8_t bSlaveInterfaces[1]; /* Slave interface 0 */
229 };
230 typedef struct _CDC_UNION_1SLAVE_DESCRIPTOR CDC_UNION_1SLAVE_DESCRIPTOR;
231
232 /* Line coding structure */
233 /* Format of the data returned when a GetLineCoding request is received */
234 /* (usbcdc11.pdf, 6.2.13) */
235 PRE_PACK struct POST_PACK _CDC_LINE_CODING {
236 uint32_t dwDTERate; /* Data terminal rate in bits per second */
237 uint8_t bCharFormat; /* Number of stop bits */
238 uint8_t bParityType; /* Parity bit type */
239 uint8_t bDataBits; /* Number of data bits */
240 };
241 typedef struct _CDC_LINE_CODING CDC_LINE_CODING;
242
243 /* Notification header */
244 /* Data sent on the notification endpoint must follow this header. */
245 /* see USB_SETUP_PACKET in file usb.h */
246 typedef USB_SETUP_PACKET CDC_NOTIFICATION_HEADER;
247
248 #endif /* __CDC_H */
249