1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SYS_USB_USB_CDC_H 27 #define _SYS_USB_USB_CDC_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #include <sys/types.h> 32 #include <sys/dditypes.h> 33 #include <sys/usb/clients/usbser/usbser_dsdi.h> 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /* 40 * USB Communications Device Class 41 */ 42 43 /* 44 * Class-specific descriptors 45 */ 46 #define USB_CDC_CS_INTERFACE 0x24 47 #define USB_CDC_CS_ENDPOINT 0x25 48 49 #define USB_CDC_DESCR_TYPE_HEADER 0x00 50 #define USB_CDC_DESCR_TYPE_CALL_MANAGEMENT 0x01 51 #define USB_CDC_DESCR_TYPE_ACM 0x02 52 #define USB_CDC_DESCR_TYPE_UNION 0x06 53 #define USB_CDC_DESCR_TYPE_COUNTRY 0x07 54 #define USB_CDC_DESCR_TYPE_NETWORK_TERMINAL 0x0a 55 #define USB_CDC_DESCR_TYPE_ETHERNET 0x0f 56 57 /* Header Functional Descriptor */ 58 typedef struct usb_cdc_header_descr { 59 uint8_t bFunctionalLength; 60 uint8_t bDescriptorType; 61 uint8_t bDescriptorSubtype; 62 uint16_t bcdCDC; 63 } usb_cdc_header_descr_t; 64 65 /* Call Management Descriptor */ 66 typedef struct usb_cdc_call_mgmt_descr { 67 uint8_t bFunctionalLength; 68 uint8_t bDescriptorType; 69 uint8_t bDescriptorSubtype; 70 uint8_t bmCapabilities; 71 uint8_t bDataInterface; 72 } usb_cdc_call_mgmt_descr_t; 73 74 #define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01 75 #define USB_CDC_CALL_MGMT_CAP_DATA_INTERFACE 0x02 76 77 /* Abstract Control Management Descriptor */ 78 typedef struct usb_cdc_acm_descr { 79 uint8_t bFunctionalLength; 80 uint8_t bDescriptorType; 81 uint8_t bDescriptorSubtype; 82 uint8_t bmCapabilities; 83 } usb_cdc_acm_descr_t; 84 85 #define USB_CDC_ACM_CAP_COMM_FEATURE 0x01 86 #define USB_CDC_ACM_CAP_SERIAL_LINE 0x02 87 #define USB_CDC_ACM_CAP_SEND_BREAK 0x04 88 #define USB_CDC_ACM_CAP_NETWORK_CONNECTION 0x08 89 90 /* Union Functional Descriptor */ 91 typedef struct usb_cdc_union_descr { 92 uint8_t bFunctionalLength; 93 uint8_t bDescriptorType; 94 uint8_t bDescriptorSubtype; 95 uint8_t bMasterInterface0; 96 uint8_t bSlaveInterface0; 97 /* more slave interafce may follow */ 98 } usb_cdc_union_descr_t; 99 100 /* 101 * Class-specific requests 102 */ 103 #define USB_CDC_REQ_SEND_ENCAPSULATED_COMMAND 0x00 104 #define USB_CDC_REQ_GET_ENCAPSULATED_RESPONSE 0x01 105 #define USB_CDC_REQ_SET_LINE_CODING 0x20 106 #define USB_CDC_REQ_GET_LINE_CODING 0x21 107 #define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22 108 #define USB_CDC_REQ_SEND_BREAK 0x23 109 110 /* Line Coding */ 111 typedef struct usb_cdc_line_coding { 112 uint32_t dwDTERate; 113 uint8_t bCharFormat; 114 uint8_t bParityType; 115 uint8_t bDataBits; 116 } usb_cdc_line_coding_t; 117 118 #define USB_CDC_LINE_CODING_LEN 7 119 120 #define USB_CDC_STOP_BITS_1 0 121 #define USB_CDC_STOP_BITS_1_5 1 122 #define USB_CDC_STOP_BITS_2 2 123 124 #define USB_CDC_PARITY_NO 0 125 #define USB_CDC_PARITY_ODD 1 126 #define USB_CDC_PARITY_EVEN 2 127 #define USB_CDC_PARITY_MARK 3 128 #define USB_CDC_PARITY_SPACE 4 129 130 #define USB_CDC_ACM_CONTROL_DTR 0x01 131 #define USB_CDC_ACM_CONTROL_RTS 0x02 132 133 #define USB_CDC_NOTIFICATION_REQUEST_TYPE 0xa1 134 /* 135 * Class-specific notifications 136 */ 137 #define USB_CDC_NOTIFICATION_NETWORK_CONNECTION 0x00 138 #define USB_CDC_NOTIFICATION_RESPONSE_AVAILABLE 0x01 139 #define USB_CDC_NOTIFICATION_SERIAL_STATE 0x20 140 #define USB_CDC_NOTIFICATION_SPEED_CHANGE 0x2a 141 142 typedef struct usb_cdc_notification { 143 uint8_t bmRequestType; 144 uint8_t bNotificationType; 145 uint16_t wValue; 146 uint16_t wIndex; 147 uint16_t wLength; 148 } usb_cdc_notification_t; 149 150 /* Serial State */ 151 #define USB_CDC_ACM_CONTROL_DCD 0x01 152 #define USB_CDC_ACM_CONTROL_DSR 0x02 153 #define USB_CDC_ACM_CONTROL_BREAK 0x04 154 #define USB_CDC_ACM_CONTROL_RNG 0x08 155 #define USB_CDC_ACM_CONTROL_FRAMING 0x10 156 #define USB_CDC_ACM_CONTROL_PARITY 0x20 157 #define USB_CDC_ACM_CONTROL_OVERRUN 0x40 158 159 160 #ifdef __cplusplus 161 } 162 #endif 163 164 #endif /* _SYS_USB_USB_CDC_H */ 165