wusba.h revision ff0e937b36dcde1a47ff7b00aa76a491c0dc07a8
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_USB_WUSBA_H
#define _SYS_USB_WUSBA_H
#ifdef __cplusplus
extern "C" {
#endif
/* Wireless USB feature selectors */
#define WUSB_FEAT_TX_DRP_IE 0
#define WUSB_FEAT_DEV_XMIT_PKT 1
#define WUSB_FEAT_COUNT_PKTS 2
#define WUSB_FEAT_CAPT_PKTS 3
/* Wireless USB status selector for GET_STATUS request */
#define WUSB_STS_TYPE_STANDARD 0
#define WUSB_STS_TYPE_WIRELESS_FEAT 1
#define WUSB_STS_TYPE_CHANNEL_INFO 2
#define WUSB_STS_TYPE_RECVD_DATA 3
#define WUSB_STS_TYPE_MAS_AVAIL 4
#define WUSB_STS_TYPE_TRANS_PWR 5
/*
* Device buffer length for count packets and capture packet functions,
* refer to WUSB 1.0 4.3.7.2
*/
#define WUSB_COUNT_CAPT_PKT_LEN 512
/* Length for Wireless USB GET_STATUS request */
#define WUSB_STANDARD_STS_LEN 2
#define WUSB_FEAT_STAT_LEN 1
#define WUSB_CHANNEL_INFO_STS_LEN 1
#define WUSB_MAS_AVAIL_STS_LEN 1
#define WUSB_TRANS_PWR_STS_LEN 2
/* Wiless USB feature status bits */
#define WUSB_TX_DRP_IE_STATUS 1
#define WUSB_TRANS_PWR_STATUS 2
#define WUSB_COUNT_PKTS_STATUS 4
#define WUSB_CAPT_PKTS_STATUS 8
/* Status data */
typedef struct wusb_counted_pkt {
typedef struct wusb_count_pkts {
typedef struct wusb_trans_pwr {
/* Wireless USB data selectors for SetWUSBDate request */
#define WUSB_DATA_DRPIE_INFO 1
#define WUSB_DATA_TRANS_DATA 2
#define WUSB_DATA_TRANS_PARAMS 3
#define WUSB_DATA_RECV_PARAMS 4
#define WUSB_DATA_TRANS_PWR 5
typedef struct wusb_trans_params {
typedef struct wusb_recv_params {
/* Wireless USB key index bits */
#define WUSB_KEY_INDEX_MASK 0x0f
#define WUSB_KEY_TYPE_MASK 0x30
#define WUSB_KEY_TYPE_ASSOCIATION 0x10
#define WUSB_KEY_TYPE_GTK 0x20
#define WUSB_KEY_ORIGIN_MASK 0x40
#define WUSB_KEY_ORIGIN_HOST 0x00
#define WUSB_KEY_ORIGIN_DEV 0x40
typedef struct wusb_key {
#if defined(_BIT_FIELDS_LTOH)
key_type :2,
key_origin :1,
key_resv :1;
#elif defined(_BIT_FIELDS_HTOL)
key_origin :1,
key_type :2,
key_index :4;
#endif
} wusb_key_t;
/* Wireless USB handshake data */
typedef struct wusb_hndshk_data {
/* Handshake stage */
#define WUSB_HNDSHK_MSG_NUM1 1
#define WUSB_HNDSHK_MSG_NUM2 2
#define WUSB_HNDSHK_MSG_NUM3 3
/* Handshake status */
#define WUSB_HNDSHK_NORMAL 0
#define WUSB_HNDSHK_ABORT_PER_POLICY 1
#define WUSB_HNDSHK_IN_PROGRESS 2
#define WUSB_HNDSHK_TKID_CONFLICT 3
#define WUSB_HNDSHK_DATA_LEN 46
/* Wireless USB connection context */
#define WUSB_CHID_LEN 16
#define WUSB_CDID_LEN 16
#define WUSB_CK_LEN 16
#define WUSB_CC_LEN 48
/*
* ****************************************
* IE definitions
* ****************************************
*/
/* Wireless USB channel IE identifiers */
#define WUSB_IE_WCTA 0x80
#define WUSB_IE_CONNECTACK 0x81
#define WUSB_IE_HOSTINFO 0x82
#define WUSB_IE_CHCHANGEANNOUNCE 0x83
#define WUSB_IE_DEV_DISCONNECT 0x84
#define WUSB_IE_HOST_DISCONNECT 0x85
#define WUSB_IE_RELEASE_CHANNEL 0x86
#define WUSB_IE_WORK 0x87
#define WUSB_IE_CHANNEL_STOP 0x88
#define WUSB_IE_DEV_KEEPALIVE 0x89
#define WUSB_IE_ISOC_DISCARD 0x8a
#define WUSB_IE_RESETDEVICE 0x8b
#define WUSB_IE_XMIT_PACKET_ADJUST 0x8c
/* Array-based IE must not include more than 4 elements */
#define WUSB_IE_MAX_ELEMENT 4
#define WUSB_ACK_BLOCK_SIZE 18
#define WUSB_ACK_IE_MAX_DATA_LEN \
typedef struct wusb_ie_header {
typedef struct wusb_connectack_block {
typedef struct wusb_ie_connect_ack {
typedef struct wusb_ie_host_info {
#define WUSB_HI_RECONN_ONLY 0x00
#define WUSB_HI_CONN_LMTED 0x01
#define WUSB_HI_CONN_ALL 0x03
#define WUSB_HI_P2P_DRD_CAP 0x04
#define WUSB_HI_STRIDX_SHIFT 3
#define WUSB_HI_STRIDX_MASK 0x38
typedef struct wusb_ie_chchange_announce {
/* the size must be even multiple of 2 bytes */
typedef struct wusb_ie_dev_disconnect {
typedef struct wusb_ie_host_disconnect {
typedef struct wusb_udrb {
} wusb_udrb_t;
typedef struct wusb_ie_release_channel {
typedef struct wusb_ie_channel_stop {
typedef struct wusb_ie_isoc_discard {
typedef struct wusb_ie_reset_device {
typedef struct wusb_ie_xmit_packet_adjust {
/*
* **************************************
* Device notification definitions
* **************************************
*/
/* Device notification message types */
#define WUSB_DN_CONNECT 1
#define WUSB_DN_DISCONNECT 2
#define WUSB_DN_EPRDY 3
#define WUSB_DN_MASAVAILCHANGED 4
#define WUSB_DN_REMOTEWAKEUP 5
#define WUSB_DN_SLEEP 6
#define WUSB_DN_ALIVE 7
/* WUSB Errata 06.12 specifies WUSB header must not be included */
typedef struct wusb_dn_header {
#define WUSB_DN_CONN_PKT_LEN 19
#define WUSB_DN_DISCONN_PKT_LEN 1
#define WUSB_DN_EPRDY_HDR_LEN 2
#define WUSB_DN_MASAVAILCHANGED_PKT_LEN 1
#define WUSB_DN_SLEEP_PKT_LEN 2
#define WUSB_DN_REMOTEWAKEUP_PKT_LEN 1
#define WUSB_DN_ALIVE_PKT_LEN 1
typedef struct wusb_dn_connect {
typedef struct wusb_dn_disconnect {
typedef struct wusb_dn_eprdy {
typedef struct wusb_dn_masavail_changed {
typedef struct wusb_dn_sleep {
typedef struct wusb_dn_remote_wakeup {
typedef struct wusb_dn_alive {
#define WUSB_DN_CONN_NEW 0x01
#define WUSB_DN_CONN_BEACON_MASK 0x06
#define WUSB_DN_CONN_SELF_BEACON 0x02
#define WUSB_DN_CONN_DIRECTED_BEACON 0x04
#define WUSB_DN_CONN_NO_BEACON 0x06
#define WUSB_DN_SLP_ATTR_GTS 0
#define WUSB_DN_SLP_ATTR_WTS 1
/*
* WUSB data rate definitions. See WUSB 7.4.1.1
*/
/*
* WUSB PHY Transfer Rate. See WUSB 5.6
*/
#define WUSB_PHY_TX_RATE_53 0 /* 53.3 Mbps */
/*
* *****************************************
* crypto definition
* *****************************************
*/
typedef struct wusb_ccm_nonce {
/* WUSB encryption types. see table 7-35 */
#define WUSB_ENCRYP_TYPE_UNSECURE 0
#define WUSB_ENCRYP_TYPE_WIRED 1
#define WUSB_ENCRYP_TYPE_CCM_1 2
#define WUSB_ENCRYP_TYPE_RSA_1 3
/* association, refer to WUSB AM Spec 3.8 */
enum wusb_association_attr {
attrAssociationTypeId = 0x0000,
attrAssociationSubTypeId = 0x0001,
attrLength = 0x0002,
attrAssociationStatus = 0x0004,
attrLangID = 0x0008,
attrDeviceFriendlyName = 0x000B,
attrHostFriendlyName = 0x000C,
attrCHID = 0x1000,
attrCDID = 0x1001,
attrConnectionContext = 0x1002,
attrBandGroups = 0x1004
};
typedef uint16_t wusb_asso_attr_t;
typedef struct wusb_cbaf_info_item {
#define fieldAssociationTypeId "\x00\x00\x02\x00"
#define fieldAssociationSubTypeId "\x01\x00\x02\x00"
#define fieldLength "\x02\x00\x04\x00"
#define fieldAssociationStatus "\x04\x00\x04\x00"
#define fieldLangID "\x08\x00\x02\x00"
#define fieldDeviceFriendlyName "\x0B\x00\x40\x00"
#define fieldHostFriendlyName "\x0C\x00\x40\x00"
#define fieldCHID "\x00\x10\x10\x00"
#define fieldCDID "\x01\x10\x10\x00"
#define fieldConnectionContext "\x02\x10\x30\x00"
#define fieldBandGroups "\x04\x10\x02\x00"
#ifdef __cplusplus
}
#endif
#endif /* _SYS_USB_WUSBA_H */