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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Definitions and data structures for application to exchange request
28 * with driver
29 */
30 #ifndef _SYS_USB_WUSB_CA_H
31 #define _SYS_USB_WUSB_CA_H
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #include <sys/usb/usba/wusba_io.h>
38 #include <sys/usb/usba/wusba.h>
39
40 /* Refer to WUSB AM Spec 4.3 */
41 #define WUSB_CBAF_GET_ASSOCIATION_INFORMATION 0x01
42 #define WUSB_CBAF_GET_ASSOCIATION_REQUEST 0x02
43 #define WUSB_CBAF_SET_ASSOCIATION_RESPONSE 0x03
44
45 #define WUSB_CBAF_DEFAULT_STATE 0x01
46 #define WUSB_CBAF_ADDRESS_STATE 0x02
47 #define WUSB_CBAF_CONFIG_STATE 0x03
48
49 #define WUSB_CBAF_RETRIEVE_HOST_INFO 0x0000
50 #define WUSB_CBAF_ASSOCIATE_WUSB 0x0001
51
52 #define WUSB_ASSO_INFO_SIZE 5
53 #define WUSB_ASSO_REQUEST_SIZE 10
54 #define WUSB_HOST_INFO_SIZE 106
55 #define WUSB_DEVICE_INFO_SIZE 108
56 #define WUSB_CC_DATA_SIZE 78
57 #define WUSB_CC_FAILURE_SIZE 28
58
59 typedef struct __association_information {
60 uint16_t Length;
61 uint8_t NumAssociationRequests;
62 uint16_t Flag;
63 } wusb_cbaf_asso_info_t;
64
65 typedef struct __association_request {
66 uint8_t AssociationDataIndex;
67 uint8_t Reserved;
68 uint16_t AssociationTypeId;
69 uint16_t AssociationSubTypeId;
70 uint32_t AssociationTypeInfoSize;
71 } wusb_cbaf_asso_req_t;
72
73 typedef struct __host_info {
74 uint16_t AssociationTypeId;
75 uint16_t AssociationSubTypeId;
76 uint8_t CHID[16];
77 uint16_t LangID;
78 char HostFriendlyName[64];
79 } wusb_cbaf_host_info_t;
80
81 typedef struct __device_info {
82 uint32_t Length;
83 uint8_t CDID[16];
84 uint16_t BandGroups;
85 uint16_t LangID;
86 char DeviceFriendlyName[64];
87 } wusb_cbaf_device_info_t;
88
89 typedef struct __cc_data {
90 uint16_t AssociationTypeId;
91 uint16_t AssociationSubTypeId;
92 uint32_t Length;
93 wusb_cc_t CC;
94 uint16_t BandGroups;
95 } wusb_cbaf_cc_data_t;
96
97 typedef struct __cc_fail {
98 uint16_t AssociationTypeId;
99 uint16_t AssociationSubTypeId;
100 uint32_t Length;
101 uint32_t AssociationStatus;
102 } wusb_cbaf_cc_fail_t;
103
104
105 /* WUSB CBAF ioctl command */
106 #define CBAF_IOCTL_GET_ASSO_INFO 0x0001
107 #define CBAF_IOCTL_GET_ASSO_REQS 0x0002
108 #define CBAF_IOCTL_SET_HOST_INFO 0x0003
109 #define CBAF_IOCTL_GET_DEVICE_INFO 0x0004
110 #define CBAF_IOCTL_SET_CONNECTION 0x0005
111 #define CBAF_IOCTL_SET_FAILURE 0x0006
112
113 #define CBAF_ASSO_FAILURE_DEFAULT 0x0001
114 #define CBAF_ASSO_FAILURE_MALFORMED_REQUEST 0x0002
115 #define CBAF_ASSO_FAILURE_TYPE_NOT_SUPPORTED 0x0003
116
117 #ifdef __cplusplus
118 }
119 #endif
120
121 #endif /* _SYS_USB_WUSB_CA_H */