Contiki-NG
cdc.h
1 #ifndef CDC_H_K1Q26ESJOC__
2 #define CDC_H_K1Q26ESJOC__
3 #include "usb.h"
4 /* Communication Class */
5 /* Class code */
6 #define CDC 0x02
7 
8 /* Interface subclass codes */
9 #define CDC_RESERVED 0x00
10 #define DIRECT_LINE_CONTROL_MODEL 0x01
11 #define ABSTRACT_CONTROL_MODEL 0x02
12 #define TELEPHONE_CONTROL_MODEL 0x03
13 #define MULTI_CHANNEL_CONTROL_MODEL 0x04
14 #define CAPI_CONTROL_MODEL 0x05
15 #define ETHERNET_NETWORKING_CONTROL_MODEL 0x06
16 #define ATM_NETWORKING_CONTROL_MODEL 0x07
17 
18 /* Protocols */
19 #define V_25TER_PROTOCOL 0x01
20 
21 /* Requests */
22 #define SEND_ENCAPSULATED_COMMAND 0x00
23 #define GET_ENCAPSULATED_RESPONSE 0x01
24 #define SET_COMM_FEATURE 0x02
25 #define GET_COMM_FEATURE 0x03
26 #define CLEAR_COMM_FEATURE 0x04
27 
28 #define SET_AUX_LINE_STATE 0x10
29 #define SET_HOOK_STATE 0x11
30 #define PULSE_SETUP 0x12
31 #define SEND_PULSE 0x13
32 #define SET_PULSE_TIME 0x14
33 #define RING_AUX_JACK 0x15
34 
35 #define SET_LINE_CODING 0x20
36 #define GET_LINE_CODING 0x21
37 #define SET_CONTROL_LINE_STATE 0x22
38 #define SEND_BREAK 0x23
39 
40 #define SET_RINGER_PARMS 0x30
41 #define GET_RINGER_PARMS 0x31
42 #define SET_OPERATION_PARMS 0x32
43 #define GET_OPERATION_PARMS 0x33
44 #define SET_LINE_PARMS 0x34
45 #define GET_LINE_PARMS 0x35
46 #define DIAL_DIGITS 0x36
47 
48 #define SET_UNIT_PARAMETER 0x37
49 #define GET_UNIT_PARAMETER 0x38
50 #define CLEAR_UNIT_PARAMETER 0x39
51 
52 #define GET_PROFILE 0x3a
53 
54 #define SET_ETHERNET_MULTICAST_FILTERS 0x40
55 #define GET_ETHERNET_MULTICAST_FILTERS 0x41
56 #define GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER 0x42
57 #define SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER 0x43
58 #define GET_ETHERNET_STATISTIC 0x44
59 
60 #define SET_ATM_D ATA_FORMAT 0x50
61 #define GET_ATM_DEVICE_STATISTICS 0x51
62 #define SET_ATM_DEFAULT_VC 0x52
63 #define GET_ATM_VC_STATISTICS 0x53
64 
65 
66 /* Notifications */
67 #define NETWORK_CONNECTION 0x00
68 #define RESPONSE_AVAILABLE 0x01
69 
70 #define AUX_JACK_HOOK_STATE 0x08
71 #define RING_DETECT 0x09
72 
73 #define SERIAL_STATE 0x20
74 
75 #define CALL_STATE_CHANGE 0x28
76 #define LINE_STATE_CHANGE 0x29
77 #define CONNECTION_SPEED_CHANGE 0x2a
78 
79 /* Data interface */
80 
81 /* Class code */
82 #define CDC_DATA 0x0a
83 
84 /* Protocols */
85 #define I_430_PROTOCOL 0x30
86 #define ISO_IEC_3_1993_PROTOCOL 0x31
87 #define TRANSPARENT_PROTOCOL 0x32
88 #define Q_921M_PROTOCOL 0x50
89 #define Q_921_PROTOCOL 0x51
90 #define Q_921TM_PROTOCOL 0x52
91 #define V_42BIS_PROTOCOL 0x90
92 #define Q_931_PROTOCOL 0x91
93 #define V_120_PROTOCOL 0x93
94 #define CDC_PROTOCOL 0xfe
95 
96 /* Descriptor subtypes */
97 
98 #define CDC_FUNC_DESCR_HEADER 0x00
99 #define CDC_FUNC_DESCR_CALL_MGMNT 0x01
100 #define CDC_FUNC_DESCR_ABSTRACT_CTRL_MGMNT 0x02
101 #define CDC_FUNC_DESCR_DIRECT_LINE_MGMNT 0x03
102 #define CDC_FUNC_DESCR_RINGER_MGMNT 0x04
103 #define CDC_FUNC_DESCR_TEL_STATE 0x05
104 #define CDC_FUNC_DESCR_UNION 0x06
105 #define CDC_FUNC_DESCR_COUNTRY 0x07
106 #define CDC_FUNC_DESCR_TEL_MODE 0x08
107 #define CDC_FUNC_DESCR_USB_TERM 0x09
108 #define CDC_FUNC_DESCR_NET_TERM 0x0a
109 #define CDC_FUNC_DESCR_PROTOCOL_UNIT 0x0b
110 #define CDC_FUNC_DESCR_EXTENSION_UNIT 0x0c
111 #define CDC_FUNC_DESCR_MULTICH_MGMNT 0x0d
112 #define CDC_FUNC_DESCR_CAPI_MGMNT 0x0e
113 #define CDC_FUNC_DESCR_ETHERNET 0x0f
114 #define CDC_FUNC_DESCR_ATM 0x10
115 
116 
117 
118 struct usb_cdc_header_func_descriptor {
119  Uchar bLength; /* Size of this descriptor in bytes */
120  Uchar bDescriptorType; /* CS_INTERFACE descriptor type */
121  Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_HEADER subtype */
122  Uint16 bcdCDC; /* Revision of class specification */
123 } BYTE_ALIGNED;
124 
125 struct usb_cdc_call_mgmnt_func_descriptor {
126  Uchar bLength; /* Size of this descriptor in bytes */
127  Uchar bDescriptorType; /* CS_INTERFACE descriptor type */
128  Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_CALL_MGMNT subtype */
129  Uchar bmCapabilities; /* Capabilities */
130  Uchar bDataInterface; /* Management data interface */
131 } BYTE_ALIGNED;
132 
133 struct usb_cdc_abstract_ctrl_mgmnt_func_descriptor {
134  Uchar bLength; /* Size of this descriptor in bytes */
135  Uchar bDescriptorType; /* CS_INTERFACE descriptor type */
136  Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_ABSTRACT_CTRL_MGMNT subtype */
137  Uchar bmCapabilities; /* Capabilities */
138 } BYTE_ALIGNED;
139 
140 struct usb_cdc_direct_line_mgmnt_func_descriptor {
141  Uchar bLength; /* Size of this descriptor in bytes */
142  Uchar bDescriptorType; /* CS_INTERFACE descriptor type */
143  Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_DIRECT_LINE_MGMNT subtype */
144  Uchar bmCapabilities; /* Capabilities */
145 } BYTE_ALIGNED;
146 
147 struct usb_cdc_ringer_mgmnt_func_descriptor {
148  Uchar bLength; /* Size of this descriptor in bytes */
149  Uchar bDescriptorType; /* CS_INTERFACE descriptor type */
150  Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_RINGER_MGMNT subtype */
151  Uchar bRingerVolSteps; /* Ringer volume steps */
152  Uchar bNumRingerPatterns; /* Number of ringer patterns supported */
153 } BYTE_ALIGNED;
154 
155 struct usb_cdc_tel_mode_func_descriptor {
156  Uchar bLength; /* Size of this descriptor in bytes */
157  Uchar bDescriptorType; /* CS_INTERFACE descriptor type */
158  Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_TEL_MODE subtype */
159  Uchar bmCapabilities; /* Capabilities */
160 } BYTE_ALIGNED;
161 
162 struct usb_cdc_tel_state_func_descriptor {
163  Uchar bLength; /* Size of this descriptor in bytes */
164  Uchar bDescriptorType; /* CS_INTERFACE descriptor type */
165  Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_TEL_STATE subtype */
166  Uchar bmCapabilities; /* Capabilities */
167 } BYTE_ALIGNED;
168 
169 struct usb_cdc_union_func_descriptor {
170  Uchar bLength; /* Size of this descriptor in bytes */
171  Uchar bDescriptorType; /* CS_INTERFACE descriptor type */
172  Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_UNION subtype */
173  Uchar bMasterInterface; /* Master interface for union */
174  Uchar bSlaveInterface[1]; /* Slave interfaces in union */
175 } BYTE_ALIGNED;
176 
177 struct usb_cdc_country_func_descriptor {
178  Uchar bLength; /* Size of this descriptor in bytes */
179  Uchar bDescriptorType; /* CS_INTERFACE descriptor type */
180  Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_COUNTRY subtype */
181  Uchar iCountryCodeRelDate; /* Release date for country codes */
182  Uint16 wCountryCode[1]; /* Country codes */
183 } BYTE_ALIGNED;
184 
185 struct usb_cdc_ethernet_func_descriptor {
186  Uchar bLength; /* Size of this descriptor in bytes */
187  Uchar bDescriptorType; /* CS_INTERFACE descriptor type */
188  Uchar bDescriptorSubtype; /* CDC_FUNC_DESCR_ETHERNET subtype */
189  Uchar iMACAddress; /* MAC address string descriptor */
190  Uint32 bmEthernetStatistics; /* Supported statistics */
191  Uint16 wMaxSegmentSize;
192  Uint16 wNumberMCFilters; /* Number of multicast filters */
193  Uchar bNumberPowerFilters; /* Number of wake-up pattern filters */
194 } BYTE_ALIGNED;
195 
196 struct usb_cdc_line_coding {
197  Uint32 dwDTERate;
198  Uchar bCharFormat;
199  Uchar bParityType;
200  Uchar bDataBits;
201 } BYTE_ALIGNED;
202 
203 #endif /* CDC_H_K1Q26ESJOC__ */