xref: /titanic_52/usr/src/uts/common/sys/usb/usba/wusba.h (revision ff0e937b36dcde1a47ff7b00aa76a491c0dc07a8)
1*ff0e937bSRaymond Chen /*
2*ff0e937bSRaymond Chen  * CDDL HEADER START
3*ff0e937bSRaymond Chen  *
4*ff0e937bSRaymond Chen  * The contents of this file are subject to the terms of the
5*ff0e937bSRaymond Chen  * Common Development and Distribution License (the "License").
6*ff0e937bSRaymond Chen  * You may not use this file except in compliance with the License.
7*ff0e937bSRaymond Chen  *
8*ff0e937bSRaymond Chen  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*ff0e937bSRaymond Chen  * or http://www.opensolaris.org/os/licensing.
10*ff0e937bSRaymond Chen  * See the License for the specific language governing permissions
11*ff0e937bSRaymond Chen  * and limitations under the License.
12*ff0e937bSRaymond Chen  *
13*ff0e937bSRaymond Chen  * When distributing Covered Code, include this CDDL HEADER in each
14*ff0e937bSRaymond Chen  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*ff0e937bSRaymond Chen  * If applicable, add the following below this CDDL HEADER, with the
16*ff0e937bSRaymond Chen  * fields enclosed by brackets "[]" replaced with your own identifying
17*ff0e937bSRaymond Chen  * information: Portions Copyright [yyyy] [name of copyright owner]
18*ff0e937bSRaymond Chen  *
19*ff0e937bSRaymond Chen  * CDDL HEADER END
20*ff0e937bSRaymond Chen  */
21*ff0e937bSRaymond Chen /*
22*ff0e937bSRaymond Chen  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*ff0e937bSRaymond Chen  * Use is subject to license terms.
24*ff0e937bSRaymond Chen  */
25*ff0e937bSRaymond Chen 
26*ff0e937bSRaymond Chen #ifndef	_SYS_USB_WUSBA_H
27*ff0e937bSRaymond Chen #define	_SYS_USB_WUSBA_H
28*ff0e937bSRaymond Chen 
29*ff0e937bSRaymond Chen #ifdef	__cplusplus
30*ff0e937bSRaymond Chen extern "C" {
31*ff0e937bSRaymond Chen #endif
32*ff0e937bSRaymond Chen 
33*ff0e937bSRaymond Chen /* Wireless USB feature selectors */
34*ff0e937bSRaymond Chen #define	WUSB_FEAT_TX_DRP_IE		0
35*ff0e937bSRaymond Chen #define	WUSB_FEAT_DEV_XMIT_PKT		1
36*ff0e937bSRaymond Chen #define	WUSB_FEAT_COUNT_PKTS		2
37*ff0e937bSRaymond Chen #define	WUSB_FEAT_CAPT_PKTS		3
38*ff0e937bSRaymond Chen 
39*ff0e937bSRaymond Chen /* Wireless USB status selector for GET_STATUS request */
40*ff0e937bSRaymond Chen #define	WUSB_STS_TYPE_STANDARD		0
41*ff0e937bSRaymond Chen #define	WUSB_STS_TYPE_WIRELESS_FEAT	1
42*ff0e937bSRaymond Chen #define	WUSB_STS_TYPE_CHANNEL_INFO	2
43*ff0e937bSRaymond Chen #define	WUSB_STS_TYPE_RECVD_DATA	3
44*ff0e937bSRaymond Chen #define	WUSB_STS_TYPE_MAS_AVAIL		4
45*ff0e937bSRaymond Chen #define	WUSB_STS_TYPE_TRANS_PWR		5
46*ff0e937bSRaymond Chen 
47*ff0e937bSRaymond Chen /*
48*ff0e937bSRaymond Chen  * Device buffer length for count packets and capture packet functions,
49*ff0e937bSRaymond Chen  * refer to WUSB 1.0 4.3.7.2
50*ff0e937bSRaymond Chen  */
51*ff0e937bSRaymond Chen #define	WUSB_COUNT_CAPT_PKT_LEN		512
52*ff0e937bSRaymond Chen 
53*ff0e937bSRaymond Chen /* Length for Wireless USB GET_STATUS request */
54*ff0e937bSRaymond Chen #define	WUSB_STANDARD_STS_LEN		2
55*ff0e937bSRaymond Chen #define	WUSB_FEAT_STAT_LEN		1
56*ff0e937bSRaymond Chen #define	WUSB_CHANNEL_INFO_STS_LEN	1
57*ff0e937bSRaymond Chen #define	WUSB_RECVD_DATA_STS_LEN		WUSB_COUNT_CAPT_PKT_LEN
58*ff0e937bSRaymond Chen #define	WUSB_MAS_AVAIL_STS_LEN		1
59*ff0e937bSRaymond Chen #define	WUSB_TRANS_PWR_STS_LEN		2
60*ff0e937bSRaymond Chen 
61*ff0e937bSRaymond Chen /* Wiless USB feature status bits */
62*ff0e937bSRaymond Chen #define	WUSB_TX_DRP_IE_STATUS		1
63*ff0e937bSRaymond Chen #define	WUSB_TRANS_PWR_STATUS		2
64*ff0e937bSRaymond Chen #define	WUSB_COUNT_PKTS_STATUS		4
65*ff0e937bSRaymond Chen #define	WUSB_CAPT_PKTS_STATUS		8
66*ff0e937bSRaymond Chen 
67*ff0e937bSRaymond Chen /* Status data */
68*ff0e937bSRaymond Chen typedef struct wusb_counted_pkt {
69*ff0e937bSRaymond Chen 	uint8_t		recp_time[3];
70*ff0e937bSRaymond Chen 	uint8_t		mac_header[6];
71*ff0e937bSRaymond Chen 	uint8_t		lqi;
72*ff0e937bSRaymond Chen } wusb_counted_pkt_t;
73*ff0e937bSRaymond Chen 
74*ff0e937bSRaymond Chen typedef struct wusb_count_pkts {
75*ff0e937bSRaymond Chen 	uint8_t			pkt_count;
76*ff0e937bSRaymond Chen 	wusb_counted_pkt_t	pkt_block[51];
77*ff0e937bSRaymond Chen } wusb_count_pkts_t;
78*ff0e937bSRaymond Chen 
79*ff0e937bSRaymond Chen typedef struct wusb_trans_pwr {
80*ff0e937bSRaymond Chen 	uint8_t		bTxNotifTransPwr;
81*ff0e937bSRaymond Chen 	uint8_t		bTxBeaconTransPwr;
82*ff0e937bSRaymond Chen } wusb_trans_pwr_t;
83*ff0e937bSRaymond Chen 
84*ff0e937bSRaymond Chen /* Wireless USB data selectors for SetWUSBDate request */
85*ff0e937bSRaymond Chen #define	WUSB_DATA_DRPIE_INFO		1
86*ff0e937bSRaymond Chen #define	WUSB_DATA_TRANS_DATA		2
87*ff0e937bSRaymond Chen #define	WUSB_DATA_TRANS_PARAMS		3
88*ff0e937bSRaymond Chen #define	WUSB_DATA_RECV_PARAMS		4
89*ff0e937bSRaymond Chen #define	WUSB_DATA_TRANS_PWR		5
90*ff0e937bSRaymond Chen 
91*ff0e937bSRaymond Chen typedef struct wusb_trans_params {
92*ff0e937bSRaymond Chen 	uint8_t		trans_time[3];
93*ff0e937bSRaymond Chen 	uint8_t		trans_adjust;
94*ff0e937bSRaymond Chen } wusb_trans_params_t;
95*ff0e937bSRaymond Chen 
96*ff0e937bSRaymond Chen typedef struct wusb_recv_params {
97*ff0e937bSRaymond Chen 	uint8_t		recv_filter;
98*ff0e937bSRaymond Chen 	uint8_t		recv_channel;
99*ff0e937bSRaymond Chen 	uint8_t		recv_start_time[3];
100*ff0e937bSRaymond Chen 	uint8_t		recv_end_time[3];
101*ff0e937bSRaymond Chen } wusb_recv_params_t;
102*ff0e937bSRaymond Chen 
103*ff0e937bSRaymond Chen /* Wireless USB key index bits */
104*ff0e937bSRaymond Chen #define	WUSB_KEY_INDEX_MASK		0x0f
105*ff0e937bSRaymond Chen #define	WUSB_KEY_TYPE_MASK		0x30
106*ff0e937bSRaymond Chen #define	WUSB_KEY_TYPE_ASSOCIATION	0x10
107*ff0e937bSRaymond Chen #define	WUSB_KEY_TYPE_GTK		0x20
108*ff0e937bSRaymond Chen #define	WUSB_KEY_ORIGIN_MASK		0x40
109*ff0e937bSRaymond Chen #define	WUSB_KEY_ORIGIN_HOST		0x00
110*ff0e937bSRaymond Chen #define	WUSB_KEY_ORIGIN_DEV		0x40
111*ff0e937bSRaymond Chen 
112*ff0e937bSRaymond Chen typedef struct wusb_key {
113*ff0e937bSRaymond Chen #if defined(_BIT_FIELDS_LTOH)
114*ff0e937bSRaymond Chen 	uint8_t		key_index	:4,
115*ff0e937bSRaymond Chen 			key_type	:2,
116*ff0e937bSRaymond Chen 			key_origin	:1,
117*ff0e937bSRaymond Chen 			key_resv	:1;
118*ff0e937bSRaymond Chen #elif defined(_BIT_FIELDS_HTOL)
119*ff0e937bSRaymond Chen 	uint8_t		key_resv	:1,
120*ff0e937bSRaymond Chen 			key_origin	:1,
121*ff0e937bSRaymond Chen 			key_type	:2,
122*ff0e937bSRaymond Chen 			key_index	:4;
123*ff0e937bSRaymond Chen #endif
124*ff0e937bSRaymond Chen } wusb_key_t;
125*ff0e937bSRaymond Chen 
126*ff0e937bSRaymond Chen /* Wireless USB handshake data */
127*ff0e937bSRaymond Chen typedef struct wusb_hndshk_data {
128*ff0e937bSRaymond Chen 	uint8_t		bMessageNumber;
129*ff0e937bSRaymond Chen 	uint8_t		bStatus;
130*ff0e937bSRaymond Chen 	uint8_t		tTKID[3];
131*ff0e937bSRaymond Chen 	uint8_t		bReserved;
132*ff0e937bSRaymond Chen 	uint8_t		CDID[16];
133*ff0e937bSRaymond Chen 	uint8_t		Nonce[16];
134*ff0e937bSRaymond Chen 	uint8_t		MIC[8];
135*ff0e937bSRaymond Chen } wusb_hndshk_data_t;
136*ff0e937bSRaymond Chen 
137*ff0e937bSRaymond Chen /* Handshake stage */
138*ff0e937bSRaymond Chen #define	WUSB_HNDSHK_MSG_NUM1		1
139*ff0e937bSRaymond Chen #define	WUSB_HNDSHK_MSG_NUM2		2
140*ff0e937bSRaymond Chen #define	WUSB_HNDSHK_MSG_NUM3		3
141*ff0e937bSRaymond Chen 
142*ff0e937bSRaymond Chen /* Handshake status */
143*ff0e937bSRaymond Chen #define	WUSB_HNDSHK_NORMAL		0
144*ff0e937bSRaymond Chen #define	WUSB_HNDSHK_ABORT_PER_POLICY	1
145*ff0e937bSRaymond Chen #define	WUSB_HNDSHK_IN_PROGRESS		2
146*ff0e937bSRaymond Chen #define	WUSB_HNDSHK_TKID_CONFLICT	3
147*ff0e937bSRaymond Chen 
148*ff0e937bSRaymond Chen #define	WUSB_HNDSHK_DATA_LEN		46
149*ff0e937bSRaymond Chen 
150*ff0e937bSRaymond Chen /* Wireless USB connection context */
151*ff0e937bSRaymond Chen #define	WUSB_CHID_LEN			16
152*ff0e937bSRaymond Chen #define	WUSB_CDID_LEN			16
153*ff0e937bSRaymond Chen #define	WUSB_CK_LEN			16
154*ff0e937bSRaymond Chen #define	WUSB_CC_LEN			48
155*ff0e937bSRaymond Chen 
156*ff0e937bSRaymond Chen 
157*ff0e937bSRaymond Chen /*
158*ff0e937bSRaymond Chen  * ****************************************
159*ff0e937bSRaymond Chen  * IE definitions
160*ff0e937bSRaymond Chen  * ****************************************
161*ff0e937bSRaymond Chen  */
162*ff0e937bSRaymond Chen 
163*ff0e937bSRaymond Chen /* Wireless USB channel IE identifiers */
164*ff0e937bSRaymond Chen #define	WUSB_IE_WCTA			0x80
165*ff0e937bSRaymond Chen #define	WUSB_IE_CONNECTACK		0x81
166*ff0e937bSRaymond Chen #define	WUSB_IE_HOSTINFO		0x82
167*ff0e937bSRaymond Chen #define	WUSB_IE_CHCHANGEANNOUNCE	0x83
168*ff0e937bSRaymond Chen #define	WUSB_IE_DEV_DISCONNECT		0x84
169*ff0e937bSRaymond Chen #define	WUSB_IE_HOST_DISCONNECT		0x85
170*ff0e937bSRaymond Chen #define	WUSB_IE_RELEASE_CHANNEL		0x86
171*ff0e937bSRaymond Chen #define	WUSB_IE_WORK			0x87
172*ff0e937bSRaymond Chen #define	WUSB_IE_CHANNEL_STOP		0x88
173*ff0e937bSRaymond Chen #define	WUSB_IE_DEV_KEEPALIVE		0x89
174*ff0e937bSRaymond Chen #define	WUSB_IE_ISOC_DISCARD		0x8a
175*ff0e937bSRaymond Chen #define	WUSB_IE_RESETDEVICE		0x8b
176*ff0e937bSRaymond Chen #define	WUSB_IE_XMIT_PACKET_ADJUST	0x8c
177*ff0e937bSRaymond Chen 
178*ff0e937bSRaymond Chen /* Array-based IE must not include more than 4 elements */
179*ff0e937bSRaymond Chen #define	WUSB_IE_MAX_ELEMENT		4
180*ff0e937bSRaymond Chen #define	WUSB_ACK_BLOCK_SIZE		18
181*ff0e937bSRaymond Chen #define	WUSB_ACK_IE_MAX_DATA_LEN	\
182*ff0e937bSRaymond Chen 	(WUSB_ACK_BLOCK_SIZE * WUSB_IE_MAX_ELEMENT)
183*ff0e937bSRaymond Chen #define	WUSB_DISCONN_IE_MAX_DATA_LEN	(WUSB_IE_MAX_ELEMENT + 2)
184*ff0e937bSRaymond Chen 
185*ff0e937bSRaymond Chen typedef struct wusb_ie_header {
186*ff0e937bSRaymond Chen 	uint8_t			bLength;
187*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
188*ff0e937bSRaymond Chen } wusb_ie_header_t;
189*ff0e937bSRaymond Chen 
190*ff0e937bSRaymond Chen typedef struct wusb_connectack_block {
191*ff0e937bSRaymond Chen 	uint8_t			CDID[16];
192*ff0e937bSRaymond Chen 	uint8_t			bDeviceAddress;
193*ff0e937bSRaymond Chen 	uint8_t			bReserved;
194*ff0e937bSRaymond Chen } wusb_connectack_block_t;
195*ff0e937bSRaymond Chen 
196*ff0e937bSRaymond Chen typedef struct wusb_ie_connect_ack {
197*ff0e937bSRaymond Chen 	uint8_t			bLength;
198*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
199*ff0e937bSRaymond Chen 	uint8_t			bAckBlock[WUSB_ACK_IE_MAX_DATA_LEN];
200*ff0e937bSRaymond Chen } wusb_ie_connect_ack_t;
201*ff0e937bSRaymond Chen 
202*ff0e937bSRaymond Chen typedef struct wusb_ie_host_info {
203*ff0e937bSRaymond Chen 	uint8_t			bLength;
204*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
205*ff0e937bSRaymond Chen 	uint8_t			bmAttributes[2];
206*ff0e937bSRaymond Chen 	uint8_t			CHID[16];
207*ff0e937bSRaymond Chen } wusb_ie_host_info_t;
208*ff0e937bSRaymond Chen 
209*ff0e937bSRaymond Chen #define	WUSB_HI_RECONN_ONLY	0x00
210*ff0e937bSRaymond Chen #define	WUSB_HI_CONN_LMTED	0x01
211*ff0e937bSRaymond Chen #define	WUSB_HI_CONN_ALL	0x03
212*ff0e937bSRaymond Chen #define	WUSB_HI_P2P_DRD_CAP	0x04
213*ff0e937bSRaymond Chen #define	WUSB_HI_STRIDX_SHIFT	3
214*ff0e937bSRaymond Chen #define	WUSB_HI_STRIDX_MASK	0x38
215*ff0e937bSRaymond Chen 
216*ff0e937bSRaymond Chen typedef struct wusb_ie_chchange_announce {
217*ff0e937bSRaymond Chen 	uint8_t			bLength;
218*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
219*ff0e937bSRaymond Chen 	uint8_t			bNewPHYChannelNumber;
220*ff0e937bSRaymond Chen 	uint8_t			SwitchTime[3];
221*ff0e937bSRaymond Chen } wusb_ie_chchange_announce_t;
222*ff0e937bSRaymond Chen 
223*ff0e937bSRaymond Chen /* the size must be even multiple of 2 bytes */
224*ff0e937bSRaymond Chen typedef struct wusb_ie_dev_disconnect {
225*ff0e937bSRaymond Chen 	uint8_t			bLength;
226*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
227*ff0e937bSRaymond Chen 	uint8_t			bDeviceAddress[WUSB_DISCONN_IE_MAX_DATA_LEN];
228*ff0e937bSRaymond Chen } wusb_ie_dev_disconnect_t;
229*ff0e937bSRaymond Chen 
230*ff0e937bSRaymond Chen typedef wusb_ie_dev_disconnect_t wusb_ie_keepalive_t;
231*ff0e937bSRaymond Chen 
232*ff0e937bSRaymond Chen typedef struct wusb_ie_host_disconnect {
233*ff0e937bSRaymond Chen 	uint8_t			bLength;
234*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
235*ff0e937bSRaymond Chen } wusb_ie_host_disconnect_t;
236*ff0e937bSRaymond Chen 
237*ff0e937bSRaymond Chen typedef struct wusb_udrb {
238*ff0e937bSRaymond Chen 	uint16_t		wStart;
239*ff0e937bSRaymond Chen 	uint16_t		wDurationValue;
240*ff0e937bSRaymond Chen 	uint8_t			bDeviceAddress;
241*ff0e937bSRaymond Chen 	uint8_t			bReserved;
242*ff0e937bSRaymond Chen } wusb_udrb_t;
243*ff0e937bSRaymond Chen 
244*ff0e937bSRaymond Chen typedef struct wusb_ie_release_channel {
245*ff0e937bSRaymond Chen 	uint8_t			bLength;
246*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
247*ff0e937bSRaymond Chen 	wusb_udrb_t		udrb[WUSB_IE_MAX_ELEMENT];
248*ff0e937bSRaymond Chen } wusb_ie_release_channel_t;
249*ff0e937bSRaymond Chen 
250*ff0e937bSRaymond Chen typedef struct wusb_ie_channel_stop {
251*ff0e937bSRaymond Chen 	uint8_t			bLength;
252*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
253*ff0e937bSRaymond Chen 	uint8_t			bmAttributes;
254*ff0e937bSRaymond Chen 	uint8_t			StopTime[3];
255*ff0e937bSRaymond Chen } wusb_ie_channel_stop_t;
256*ff0e937bSRaymond Chen 
257*ff0e937bSRaymond Chen typedef struct wusb_ie_isoc_discard {
258*ff0e937bSRaymond Chen 	uint8_t			bLength;
259*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
260*ff0e937bSRaymond Chen 	uint8_t			bDiscardID;
261*ff0e937bSRaymond Chen 	uint8_t			bDeviceAddress;
262*ff0e937bSRaymond Chen 	uint8_t			bmAttributes;
263*ff0e937bSRaymond Chen 	uint8_t			bFirstReceiveWindowPosition;
264*ff0e937bSRaymond Chen 	uint16_t		wNumberDiscardedPackets;
265*ff0e937bSRaymond Chen 	uint16_t		wNumberDiscardedSegments;
266*ff0e937bSRaymond Chen 	uint8_t			bmDeviceReceiveWindow[4];
267*ff0e937bSRaymond Chen } wusb_ie_isoc_discard_t;
268*ff0e937bSRaymond Chen 
269*ff0e937bSRaymond Chen typedef struct wusb_ie_reset_device {
270*ff0e937bSRaymond Chen 	uint8_t			bLength;
271*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
272*ff0e937bSRaymond Chen 	uint8_t			CDID[4 * WUSB_IE_MAX_ELEMENT];
273*ff0e937bSRaymond Chen } wusb_ie_reset_device_t;
274*ff0e937bSRaymond Chen 
275*ff0e937bSRaymond Chen typedef struct wusb_ie_xmit_packet_adjust {
276*ff0e937bSRaymond Chen 	uint8_t			bLength;
277*ff0e937bSRaymond Chen 	uint8_t			bIEIdentifier;
278*ff0e937bSRaymond Chen 	uint8_t			bTransmitAdjustment;
279*ff0e937bSRaymond Chen 	uint8_t			bReserved;
280*ff0e937bSRaymond Chen } wusb_ie_xmit_packet_adjust_t;
281*ff0e937bSRaymond Chen 
282*ff0e937bSRaymond Chen /*
283*ff0e937bSRaymond Chen  * **************************************
284*ff0e937bSRaymond Chen  * Device notification definitions
285*ff0e937bSRaymond Chen  * **************************************
286*ff0e937bSRaymond Chen  */
287*ff0e937bSRaymond Chen 
288*ff0e937bSRaymond Chen /* Device notification message types */
289*ff0e937bSRaymond Chen #define	WUSB_DN_CONNECT			1
290*ff0e937bSRaymond Chen #define	WUSB_DN_DISCONNECT		2
291*ff0e937bSRaymond Chen #define	WUSB_DN_EPRDY			3
292*ff0e937bSRaymond Chen #define	WUSB_DN_MASAVAILCHANGED		4
293*ff0e937bSRaymond Chen #define	WUSB_DN_REMOTEWAKEUP		5
294*ff0e937bSRaymond Chen #define	WUSB_DN_SLEEP			6
295*ff0e937bSRaymond Chen #define	WUSB_DN_ALIVE			7
296*ff0e937bSRaymond Chen 
297*ff0e937bSRaymond Chen /* WUSB Errata 06.12 specifies WUSB header must not be included */
298*ff0e937bSRaymond Chen typedef struct wusb_dn_header {
299*ff0e937bSRaymond Chen 	uint8_t			bType;
300*ff0e937bSRaymond Chen } wusb_dn_header_t;
301*ff0e937bSRaymond Chen 
302*ff0e937bSRaymond Chen #define	WUSB_DN_CONN_PKT_LEN		19
303*ff0e937bSRaymond Chen #define	WUSB_DN_DISCONN_PKT_LEN		1
304*ff0e937bSRaymond Chen #define	WUSB_DN_EPRDY_HDR_LEN		2
305*ff0e937bSRaymond Chen #define	WUSB_DN_MASAVAILCHANGED_PKT_LEN	1
306*ff0e937bSRaymond Chen #define	WUSB_DN_SLEEP_PKT_LEN		2
307*ff0e937bSRaymond Chen #define	WUSB_DN_REMOTEWAKEUP_PKT_LEN	1
308*ff0e937bSRaymond Chen #define	WUSB_DN_ALIVE_PKT_LEN		1
309*ff0e937bSRaymond Chen 
310*ff0e937bSRaymond Chen typedef struct wusb_dn_connect {
311*ff0e937bSRaymond Chen 	uint8_t			bType;
312*ff0e937bSRaymond Chen 	uint8_t			bmConnAttributes[2];
313*ff0e937bSRaymond Chen 	uint8_t			CDID[16];
314*ff0e937bSRaymond Chen } wusb_dn_connect_t;
315*ff0e937bSRaymond Chen 
316*ff0e937bSRaymond Chen typedef struct wusb_dn_disconnect {
317*ff0e937bSRaymond Chen 	uint8_t			bType;
318*ff0e937bSRaymond Chen } wusb_dn_disconnect_t;
319*ff0e937bSRaymond Chen 
320*ff0e937bSRaymond Chen typedef struct wusb_dn_eprdy {
321*ff0e937bSRaymond Chen 	uint8_t			bType;
322*ff0e937bSRaymond Chen 	uint8_t			bLength;
323*ff0e937bSRaymond Chen 	uint8_t			bEPsReadyArray[1];
324*ff0e937bSRaymond Chen } wusb_dn_eprdy_t;
325*ff0e937bSRaymond Chen 
326*ff0e937bSRaymond Chen typedef struct wusb_dn_masavail_changed {
327*ff0e937bSRaymond Chen 	uint8_t			bType;
328*ff0e937bSRaymond Chen } wusb_dn_masavail_changed_t;
329*ff0e937bSRaymond Chen 
330*ff0e937bSRaymond Chen typedef struct wusb_dn_sleep {
331*ff0e937bSRaymond Chen 	uint8_t			bType;
332*ff0e937bSRaymond Chen 	uint8_t			bmSlpAttributes;
333*ff0e937bSRaymond Chen } wusb_dn_sleep_t;
334*ff0e937bSRaymond Chen 
335*ff0e937bSRaymond Chen typedef struct wusb_dn_remote_wakeup {
336*ff0e937bSRaymond Chen 	uint8_t			bType;
337*ff0e937bSRaymond Chen } wusb_dn_remote_wakeup_t;
338*ff0e937bSRaymond Chen 
339*ff0e937bSRaymond Chen typedef struct wusb_dn_alive {
340*ff0e937bSRaymond Chen 	uint8_t			bType;
341*ff0e937bSRaymond Chen } wusb_dn_alive_t;
342*ff0e937bSRaymond Chen 
343*ff0e937bSRaymond Chen #define	WUSB_DN_CONN_NEW		0x01
344*ff0e937bSRaymond Chen #define	WUSB_DN_CONN_BEACON_MASK	0x06
345*ff0e937bSRaymond Chen #define	WUSB_DN_CONN_SELF_BEACON	0x02
346*ff0e937bSRaymond Chen #define	WUSB_DN_CONN_DIRECTED_BEACON	0x04
347*ff0e937bSRaymond Chen #define	WUSB_DN_CONN_NO_BEACON		0x06
348*ff0e937bSRaymond Chen 
349*ff0e937bSRaymond Chen #define	WUSB_DN_SLP_ATTR_GTS		0
350*ff0e937bSRaymond Chen #define	WUSB_DN_SLP_ATTR_WTS		1
351*ff0e937bSRaymond Chen 
352*ff0e937bSRaymond Chen /*
353*ff0e937bSRaymond Chen  * WUSB data rate definitions. See WUSB 7.4.1.1
354*ff0e937bSRaymond Chen  */
355*ff0e937bSRaymond Chen #define	WUSB_DATA_RATE_BIT_53	1 << 0	/* 53.3 Mbps */
356*ff0e937bSRaymond Chen #define	WUSB_DATA_RATE_BIT_80	1 << 1	/* 80 Mbps */
357*ff0e937bSRaymond Chen #define	WUSB_DATA_RATE_BIT_106	1 << 2	/* 106.7 Mbps */
358*ff0e937bSRaymond Chen #define	WUSB_DATA_RATE_BIT_160	1 << 3	/* 160 Mbps */
359*ff0e937bSRaymond Chen #define	WUSB_DATA_RATE_BIT_200	1 << 4	/* 200 Mbps */
360*ff0e937bSRaymond Chen #define	WUSB_DATA_RATE_BIT_320	1 << 5	/* 320 Mbps */
361*ff0e937bSRaymond Chen #define	WUSB_DATA_RATE_BIT_400	1 << 6	/* 400 Mbps */
362*ff0e937bSRaymond Chen #define	WUSB_DATA_RATE_BIT_480	1 << 7	/* 480 Mbps */
363*ff0e937bSRaymond Chen 
364*ff0e937bSRaymond Chen /*
365*ff0e937bSRaymond Chen  * WUSB PHY Transfer Rate. See WUSB 5.6
366*ff0e937bSRaymond Chen  */
367*ff0e937bSRaymond Chen #define	WUSB_PHY_TX_RATE_53	0	/* 53.3 Mbps */
368*ff0e937bSRaymond Chen #define	WUSB_PHY_TX_RATE_80	1	/* 80 Mbps */
369*ff0e937bSRaymond Chen #define	WUSB_PHY_TX_RATE_106	2	/* 106.7 Mbps */
370*ff0e937bSRaymond Chen #define	WUSB_PHY_TX_RATE_160	3	/* 160 Mbps */
371*ff0e937bSRaymond Chen #define	WUSB_PHY_TX_RATE_200	4	/* 200 Mbps */
372*ff0e937bSRaymond Chen #define	WUSB_PHY_TX_RATE_320	5	/* 320 Mbps */
373*ff0e937bSRaymond Chen #define	WUSB_PHY_TX_RATE_400	6	/* 400 Mbps */
374*ff0e937bSRaymond Chen #define	WUSB_PHY_TX_RATE_480	7	/* 480 Mbps */
375*ff0e937bSRaymond Chen #define	WUSB_PHY_TX_RATE_RES	8	/* 8~1F, reserved */
376*ff0e937bSRaymond Chen 
377*ff0e937bSRaymond Chen /*
378*ff0e937bSRaymond Chen  * *****************************************
379*ff0e937bSRaymond Chen  * crypto definition
380*ff0e937bSRaymond Chen  * *****************************************
381*ff0e937bSRaymond Chen  */
382*ff0e937bSRaymond Chen 
383*ff0e937bSRaymond Chen typedef struct wusb_ccm_nonce {
384*ff0e937bSRaymond Chen 	uint64_t		sfn;
385*ff0e937bSRaymond Chen 	uint32_t		tkid;
386*ff0e937bSRaymond Chen 	uint16_t		daddr;
387*ff0e937bSRaymond Chen 	uint16_t		saddr;
388*ff0e937bSRaymond Chen } wusb_ccm_nonce_t;
389*ff0e937bSRaymond Chen 
390*ff0e937bSRaymond Chen #define	CCM_MAC_LEN		8	/* from WUSB 6.4 */
391*ff0e937bSRaymond Chen #define	CCM_NONCE_LEN		13	/* from WUSB 6.4 */
392*ff0e937bSRaymond Chen 
393*ff0e937bSRaymond Chen /* WUSB encryption types. see table 7-35 */
394*ff0e937bSRaymond Chen #define	WUSB_ENCRYP_TYPE_UNSECURE	0
395*ff0e937bSRaymond Chen #define	WUSB_ENCRYP_TYPE_WIRED		1
396*ff0e937bSRaymond Chen #define	WUSB_ENCRYP_TYPE_CCM_1		2
397*ff0e937bSRaymond Chen #define	WUSB_ENCRYP_TYPE_RSA_1		3
398*ff0e937bSRaymond Chen 
399*ff0e937bSRaymond Chen /* association, refer to WUSB AM Spec 3.8 */
400*ff0e937bSRaymond Chen enum wusb_association_attr {
401*ff0e937bSRaymond Chen 	attrAssociationTypeId			= 0x0000,
402*ff0e937bSRaymond Chen 	attrAssociationSubTypeId		= 0x0001,
403*ff0e937bSRaymond Chen 	attrLength				= 0x0002,
404*ff0e937bSRaymond Chen 	attrAssociationStatus			= 0x0004,
405*ff0e937bSRaymond Chen 	attrLangID				= 0x0008,
406*ff0e937bSRaymond Chen 	attrDeviceFriendlyName			= 0x000B,
407*ff0e937bSRaymond Chen 	attrHostFriendlyName			= 0x000C,
408*ff0e937bSRaymond Chen 	attrCHID				= 0x1000,
409*ff0e937bSRaymond Chen 	attrCDID				= 0x1001,
410*ff0e937bSRaymond Chen 	attrConnectionContext			= 0x1002,
411*ff0e937bSRaymond Chen 	attrBandGroups				= 0x1004
412*ff0e937bSRaymond Chen };
413*ff0e937bSRaymond Chen 
414*ff0e937bSRaymond Chen typedef	uint16_t	wusb_asso_attr_t;
415*ff0e937bSRaymond Chen 
416*ff0e937bSRaymond Chen typedef struct wusb_cbaf_info_item {
417*ff0e937bSRaymond Chen 	wusb_asso_attr_t	typeID;
418*ff0e937bSRaymond Chen 	uint16_t		length;
419*ff0e937bSRaymond Chen } wusb_cbaf_info_item_t;
420*ff0e937bSRaymond Chen 
421*ff0e937bSRaymond Chen #define	fieldAssociationTypeId			"\x00\x00\x02\x00"
422*ff0e937bSRaymond Chen #define	fieldAssociationSubTypeId		"\x01\x00\x02\x00"
423*ff0e937bSRaymond Chen #define	fieldLength				"\x02\x00\x04\x00"
424*ff0e937bSRaymond Chen #define	fieldAssociationStatus			"\x04\x00\x04\x00"
425*ff0e937bSRaymond Chen #define	fieldLangID				"\x08\x00\x02\x00"
426*ff0e937bSRaymond Chen #define	fieldDeviceFriendlyName			"\x0B\x00\x40\x00"
427*ff0e937bSRaymond Chen #define	fieldHostFriendlyName			"\x0C\x00\x40\x00"
428*ff0e937bSRaymond Chen #define	fieldCHID				"\x00\x10\x10\x00"
429*ff0e937bSRaymond Chen #define	fieldCDID				"\x01\x10\x10\x00"
430*ff0e937bSRaymond Chen #define	fieldConnectionContext			"\x02\x10\x30\x00"
431*ff0e937bSRaymond Chen #define	fieldBandGroups				"\x04\x10\x02\x00"
432*ff0e937bSRaymond Chen 
433*ff0e937bSRaymond Chen 
434*ff0e937bSRaymond Chen #ifdef __cplusplus
435*ff0e937bSRaymond Chen }
436*ff0e937bSRaymond Chen #endif
437*ff0e937bSRaymond Chen 
438*ff0e937bSRaymond Chen #endif /* _SYS_USB_WUSBA_H */
439