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