4 * \brief USB Communication Device Class (CDC) protocol definitions
6 * Copyright (c) 2009-2015 Atmel Corporation. All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
22 * 3. The name of Atmel may not be used to endorse or promote products derived
23 * from this software without specific prior written permission.
25 * 4. This software may only be redistributed and used in connection with an
26 * Atmel microcontroller product.
28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
44 * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
46 #ifndef _USB_PROTOCOL_CDC_H_
47 #define _USB_PROTOCOL_CDC_H_
53 #define CDC_CLASS_DEVICE 0x02 //!< USB Communication Device Class
54 #define CDC_CLASS_COMM 0x02 //!< CDC Communication Class Interface
55 #define CDC_CLASS_DATA 0x0A //!< CDC Data Class Interface
57 #define CDC_SUBCLASS_DLCM 0x01 //!< Direct Line Control Model
58 #define CDC_SUBCLASS_ACM 0x02 //!< Abstract Control Model
59 #define CDC_SUBCLASS_TCM 0x03 //!< Telephone Control Model
60 #define CDC_SUBCLASS_MCCM 0x04 //!< Multi-Channel Control Model
61 #define CDC_SUBCLASS_CCM 0x05 //!< CAPI Control Model
62 #define CDC_SUBCLASS_ETH 0x06 //!< Ethernet Networking Control Model
63 #define CDC_SUBCLASS_ATM 0x07 //!< ATM Networking Control Model
65 #define CDC_PROTOCOL_V25TER 0x01 //!< Common AT commands
67 #define CDC_PROTOCOL_I430 0x30 //!< ISDN BRI
68 #define CDC_PROTOCOL_HDLC 0x31 //!< HDLC
69 #define CDC_PROTOCOL_TRANS 0x32 //!< Transparent
70 #define CDC_PROTOCOL_Q921M 0x50 //!< Q.921 management protocol
71 #define CDC_PROTOCOL_Q921 0x51 //!< Q.931 [sic] Data link protocol
72 #define CDC_PROTOCOL_Q921TM 0x52 //!< Q.921 TEI-multiplexor
73 #define CDC_PROTOCOL_V42BIS 0x90 //!< Data compression procedures
74 #define CDC_PROTOCOL_Q931 0x91 //!< Euro-ISDN protocol control
75 #define CDC_PROTOCOL_V120 0x92 //!< V.24 rate adaption to ISDN
76 #define CDC_PROTOCOL_CAPI20 0x93 //!< CAPI Commands
77 #define CDC_PROTOCOL_HOST 0xFD //!< Host based driver
79 #define CDC_PROTOCOL_PUFD 0xFE
81 #define CDC_CS_INTERFACE 0x24 //!< Interface Functional Descriptor
82 #define CDC_CS_ENDPOINT 0x25 //!< Endpoint Functional Descriptor
84 #define CDC_SCS_HEADER 0x00 //!< Header Functional Descriptor
85 #define CDC_SCS_CALL_MGMT 0x01 //!< Call Management
86 #define CDC_SCS_ACM 0x02 //!< Abstract Control Management
87 #define CDC_SCS_UNION 0x06 //!< Union Functional Descriptor
89 #define USB_REQ_CDC_SEND_ENCAPSULATED_COMMAND 0x00
90 #define USB_REQ_CDC_GET_ENCAPSULATED_RESPONSE 0x01
91 #define USB_REQ_CDC_SET_COMM_FEATURE 0x02
92 #define USB_REQ_CDC_GET_COMM_FEATURE 0x03
93 #define USB_REQ_CDC_CLEAR_COMM_FEATURE 0x04
94 #define USB_REQ_CDC_SET_AUX_LINE_STATE 0x10
95 #define USB_REQ_CDC_SET_HOOK_STATE 0x11
96 #define USB_REQ_CDC_PULSE_SETUP 0x12
97 #define USB_REQ_CDC_SEND_PULSE 0x13
98 #define USB_REQ_CDC_SET_PULSE_TIME 0x14
99 #define USB_REQ_CDC_RING_AUX_JACK 0x15
100 #define USB_REQ_CDC_SET_LINE_CODING 0x20
101 #define USB_REQ_CDC_GET_LINE_CODING 0x21
102 #define USB_REQ_CDC_SET_CONTROL_LINE_STATE 0x22
103 #define USB_REQ_CDC_SEND_BREAK 0x23
104 #define USB_REQ_CDC_SET_RINGER_PARMS 0x30
105 #define USB_REQ_CDC_GET_RINGER_PARMS 0x31
106 #define USB_REQ_CDC_SET_OPERATION_PARMS 0x32
107 #define USB_REQ_CDC_GET_OPERATION_PARMS 0x33
108 #define USB_REQ_CDC_SET_LINE_PARMS 0x34
109 #define USB_REQ_CDC_GET_LINE_PARMS 0x35
110 #define USB_REQ_CDC_DIAL_DIGITS 0x36
111 #define USB_REQ_CDC_SET_UNIT_PARAMETER 0x37
112 #define USB_REQ_CDC_GET_UNIT_PARAMETER 0x38
113 #define USB_REQ_CDC_CLEAR_UNIT_PARAMETER 0x39
114 #define USB_REQ_CDC_GET_PROFILE 0x3A
115 #define USB_REQ_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
116 #define USB_REQ_CDC_SET_ETHERNET_POWER_MANAGEMENT_PATTERNFILTER 0x41
117 #define USB_REQ_CDC_GET_ETHERNET_POWER_MANAGEMENT_PATTERNFILTER 0x42
118 #define USB_REQ_CDC_SET_ETHERNET_PACKET_FILTER 0x43
119 #define USB_REQ_CDC_GET_ETHERNET_STATISTIC 0x44
120 #define USB_REQ_CDC_SET_ATM_DATA_FORMAT 0x50
121 #define USB_REQ_CDC_GET_ATM_DEVICE_STATISTICS 0x51
122 #define USB_REQ_CDC_SET_ATM_DEFAULT_VC 0x52
123 #define USB_REQ_CDC_GET_ATM_VC_STATISTICS 0x53
124 // Added bNotification codes according cdc spec 1.1 chapter 6.3
125 #define USB_REQ_CDC_NOTIFY_RING_DETECT 0x09
126 #define USB_REQ_CDC_NOTIFY_SERIAL_STATE 0x20
127 #define USB_REQ_CDC_NOTIFY_CALL_STATE_CHANGE 0x28
128 #define USB_REQ_CDC_NOTIFY_LINE_STATE_CHANGE 0x29
131 #define CDC_CALL_MGMT_SUPPORTED (1 << 0)
132 #define CDC_CALL_MGMT_OVER_DCI (1 << 1)
133 #define CDC_ACM_SUPPORT_FEATURE_REQUESTS (1 << 0)
134 #define CDC_ACM_SUPPORT_LINE_REQUESTS (1 << 1)
135 #define CDC_ACM_SUPPORT_SENDBREAK_REQUESTS (1 << 2)
136 #define CDC_ACM_SUPPORT_NOTIFY_REQUESTS (1 << 3)
144 } usb_cdc_line_coding_t;
147 enum cdc_char_format {
148 CDC_STOP_BITS_1 = 0, //!< 1 stop bit
149 CDC_STOP_BITS_1_5 = 1, //!< 1.5 stop bits
150 CDC_STOP_BITS_2 = 2, //!< 2 stop bits
154 CDC_PAR_NONE = 0, //!< No parity
155 CDC_PAR_ODD = 1, //!< Odd parity
156 CDC_PAR_EVEN = 2, //!< Even parity
157 CDC_PAR_MARK = 3, //!< Parity forced to 0 (space)
158 CDC_PAR_SPACE = 4, //!< Parity forced to 1 (mark)
164 } usb_cdc_control_signal_t;
166 #define CDC_CTRL_SIGNAL_ACTIVATE_CARRIER (1 << 1)
167 #define CDC_CTRL_SIGNAL_DTE_PRESENT (1 << 0)
171 uint8_t bmRequestType;
172 uint8_t bNotification;
176 } usb_cdc_notify_msg_t;
179 usb_cdc_notify_msg_t header;
181 } usb_cdc_notify_serial_state_t;
183 #define CDC_SERIAL_STATE_DCD CPU_TO_LE16((1<<0))
184 #define CDC_SERIAL_STATE_DSR CPU_TO_LE16((1<<1))
185 #define CDC_SERIAL_STATE_BREAK CPU_TO_LE16((1<<2))
186 #define CDC_SERIAL_STATE_RING CPU_TO_LE16((1<<3))
187 #define CDC_SERIAL_STATE_FRAMING CPU_TO_LE16((1<<4))
188 #define CDC_SERIAL_STATE_PARITY CPU_TO_LE16((1<<5))
189 #define CDC_SERIAL_STATE_OVERRUN CPU_TO_LE16((1<<6))
193 #endif // _USB_PROTOCOL_CDC_H_