FreeBSD/Linux Kernel Cross Reference
sys/dev/usb/usbcdc.h
1 /* $NetBSD: usbcdc.h,v 1.8 2001/02/16 20:15:57 kenh Exp $ */
2 /* $FreeBSD: src/sys/dev/usb/usbcdc.h,v 1.7 1999/11/17 22:33:48 n_hibma Exp $ */
3
4 /*
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (lennart@augustsson.net) at
10 * Carlstedt Research & Technology.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. All advertising materials mentioning features or use of this software
21 * must display the following acknowledgement:
22 * This product includes software developed by the NetBSD
23 * Foundation, Inc. and its contributors.
24 * 4. Neither the name of The NetBSD Foundation nor the names of its
25 * contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
39 */
40
41 #ifndef _USBCDC_H_
42 #define _USBCDC_H_
43
44 #define UDESCSUB_CDC_HEADER 0
45 #define UDESCSUB_CDC_CM 1 /* Call Management */
46 #define UDESCSUB_CDC_ACM 2 /* Abstract Control Model */
47 #define UDESCSUB_CDC_DLM 3 /* Direct Line Management */
48 #define UDESCSUB_CDC_TRF 4 /* Telephone Ringer */
49 #define UDESCSUB_CDC_TCLSR 5 /* Telephone Call ... */
50 #define UDESCSUB_CDC_UNION 6
51 #define UDESCSUB_CDC_CS 7 /* Country Selection */
52 #define UDESCSUB_CDC_TOM 8 /* Telephone Operational Modes */
53 #define UDESCSUB_CDC_USBT 9 /* USB Terminal */
54
55 typedef struct {
56 uByte bLength;
57 uByte bDescriptorType;
58 uByte bDescriptorSubtype;
59 uWord bcdCDC;
60 } UPACKED usb_cdc_header_descriptor_t;
61
62 typedef struct {
63 uByte bLength;
64 uByte bDescriptorType;
65 uByte bDescriptorSubtype;
66 uByte bmCapabilities;
67 #define USB_CDC_CM_DOES_CM 0x01
68 #define USB_CDC_CM_OVER_DATA 0x02
69 uByte bDataInterface;
70 } UPACKED usb_cdc_cm_descriptor_t;
71
72 typedef struct {
73 uByte bLength;
74 uByte bDescriptorType;
75 uByte bDescriptorSubtype;
76 uByte bmCapabilities;
77 #define USB_CDC_ACM_HAS_FEATURE 0x01
78 #define USB_CDC_ACM_HAS_LINE 0x02
79 #define USB_CDC_ACM_HAS_BREAK 0x04
80 #define USB_CDC_ACM_HAS_NETWORK_CONN 0x08
81 } UPACKED usb_cdc_acm_descriptor_t;
82
83 typedef struct {
84 uByte bLength;
85 uByte bDescriptorType;
86 uByte bDescriptorSubtype;
87 uByte bMasterInterface;
88 uByte bSlaveInterface[1];
89 } UPACKED usb_cdc_union_descriptor_t;
90
91 #define UCDC_SEND_ENCAPSULATED_COMMAND 0x00
92 #define UCDC_GET_ENCAPSULATED_RESPONSE 0x01
93 #define UCDC_SET_COMM_FEATURE 0x02
94 #define UCDC_GET_COMM_FEATURE 0x03
95 #define UCDC_ABSTRACT_STATE 0x01
96 #define UCDC_COUNTRY_SETTING 0x02
97 #define UCDC_CLEAR_COMM_FEATURE 0x04
98 #define UCDC_SET_LINE_CODING 0x20
99 #define UCDC_GET_LINE_CODING 0x21
100 #define UCDC_SET_CONTROL_LINE_STATE 0x22
101 #define UCDC_LINE_DTR 0x0001
102 #define UCDC_LINE_RTS 0x0002
103 #define UCDC_SEND_BREAK 0x23
104 #define UCDC_BREAK_ON 0xffff
105 #define UCDC_BREAK_OFF 0x0000
106
107 typedef struct {
108 uWord wState;
109 #define UCDC_IDLE_SETTING 0x0001
110 #define UCDC_DATA_MULTIPLEXED 0x0002
111 } UPACKED usb_cdc_abstract_state_t;
112 #define UCDC_ABSTRACT_STATE_LENGTH 2
113
114 typedef struct {
115 uDWord dwDTERate;
116 uByte bCharFormat;
117 #define UCDC_STOP_BIT_1 0
118 #define UCDC_STOP_BIT_1_5 1
119 #define UCDC_STOP_BIT_2 2
120 uByte bParityType;
121 #define UCDC_PARITY_NONE 0
122 #define UCDC_PARITY_ODD 1
123 #define UCDC_PARITY_EVEN 2
124 #define UCDC_PARITY_MARK 3
125 #define UCDC_PARITY_SPACE 4
126 uByte bDataBits;
127 } UPACKED usb_cdc_line_state_t;
128 #define UCDC_LINE_STATE_LENGTH 7
129
130 typedef struct {
131 uByte bmRequestType;
132 #define UCDC_NOTIFICATION 0xa1
133 uByte bNotification;
134 #define UCDC_N_NETWORK_CONNECTION 0x00
135 #define UCDC_N_RESPONSE_AVAILABLE 0x01
136 #define UCDC_N_AUX_JACK_HOOK_STATE 0x08
137 #define UCDC_N_RING_DETECT 0x09
138 #define UCDC_N_SERIAL_STATE 0x20
139 #define UCDC_N_CALL_STATE_CHANGED 0x28
140 #define UCDC_N_LINE_STATE_CHANGED 0x29
141 #define UCDC_N_CONNECTION_SPEED_CHANGE 0x2a
142 uWord wValue;
143 uWord wIndex;
144 uWord wLength;
145 uByte data[16];
146 } UPACKED usb_cdc_notification_t;
147 #define UCDC_NOTIFICATION_LENGTH 8
148
149 /*
150 * Bits set in the SERIAL STATE notifcation (first byte of data)
151 */
152
153 #define UCDC_N_SERIAL_OVERRUN 0x40
154 #define UCDC_N_SERIAL_PARITY 0x20
155 #define UCDC_N_SERIAL_FRAMING 0x10
156 #define UCDC_N_SERIAL_RI 0x08
157 #define UCDC_N_SERIAL_BREAK 0x04
158 #define UCDC_N_SERIAL_DSR 0x02
159 #define UCDC_N_SERIAL_DCD 0x01
160
161 #endif /* _USBCDC_H_ */
Cache object: 46a11357b6b0e4f3bebd791e1f273c64
|