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