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_IO_H 27*ff0e937bSRaymond Chen #define _SYS_USB_WUSBA_IO_H 28*ff0e937bSRaymond Chen 29*ff0e937bSRaymond Chen #ifdef __cplusplus 30*ff0e937bSRaymond Chen extern "C" { 31*ff0e937bSRaymond Chen #endif 32*ff0e937bSRaymond Chen 33*ff0e937bSRaymond Chen /* ioctl commands between wusb host and the wusbadm tool */ 34*ff0e937bSRaymond Chen #define WUSB_HC_IOC ('W' << 8) 35*ff0e937bSRaymond Chen 36*ff0e937bSRaymond Chen /* get the state of a device corresponding to cdid */ 37*ff0e937bSRaymond Chen #define WUSB_HC_GET_DSTATE (WUSB_HC_IOC | 0x01) 38*ff0e937bSRaymond Chen 39*ff0e937bSRaymond Chen #define MAX_USB_NODENAME 256 40*ff0e937bSRaymond Chen /* for WUSB_HC_GET_DSTATE ioctl */ 41*ff0e937bSRaymond Chen typedef struct wusb_hc_get_dstate { 42*ff0e937bSRaymond Chen uint8_t cdid[16]; /* IN arg */ 43*ff0e937bSRaymond Chen uint16_t state; /* OUT arg - device state */ 44*ff0e937bSRaymond Chen char path[MAXPATHLEN]; /* OUT arg - device apid */ 45*ff0e937bSRaymond Chen 46*ff0e937bSRaymond Chen /* OUT arg - driver name XXX: need to find MAX nodename len */ 47*ff0e937bSRaymond Chen char nodename[MAX_USB_NODENAME]; 48*ff0e937bSRaymond Chen } wusb_hc_get_dstate_t; 49*ff0e937bSRaymond Chen 50*ff0e937bSRaymond Chen /* device state, refer to WUSB 1.0 spec - Figure 7.1 */ 51*ff0e937bSRaymond Chen enum wusb_device_state { 52*ff0e937bSRaymond Chen WUSB_STATE_UNCONNTED = 0, 53*ff0e937bSRaymond Chen WUSB_STATE_CONNTING, /* sent connection notification */ 54*ff0e937bSRaymond Chen WUSB_STATE_UNAUTHENTICATED, /* got connect ACK from host */ 55*ff0e937bSRaymond Chen WUSB_STATE_DEFAULT, /* authenticated and usb addr = 0 */ 56*ff0e937bSRaymond Chen WUSB_STATE_ADDRESSED, /* non-zero usb addr is assigned */ 57*ff0e937bSRaymond Chen WUSB_STATE_CONFIGURED, /* configuration is set */ 58*ff0e937bSRaymond Chen WUSB_STATE_SLEEPING, 59*ff0e937bSRaymond Chen WUSB_STATE_RECONNTING 60*ff0e937bSRaymond Chen }; 61*ff0e937bSRaymond Chen 62*ff0e937bSRaymond Chen /* get host 48-bit MAC addr */ 63*ff0e937bSRaymond Chen #define WUSB_HC_GET_MAC_ADDR (WUSB_HC_IOC | 0x02) 64*ff0e937bSRaymond Chen 65*ff0e937bSRaymond Chen /* load CC to host and update chid when cc list is null */ 66*ff0e937bSRaymond Chen #define WUSB_HC_ADD_CC (WUSB_HC_IOC | 0x03) 67*ff0e937bSRaymond Chen 68*ff0e937bSRaymond Chen /* remove CC from host */ 69*ff0e937bSRaymond Chen #define WUSB_HC_REM_CC (WUSB_HC_IOC | 0x04) 70*ff0e937bSRaymond Chen 71*ff0e937bSRaymond Chen /* CC structure for WUSB_HC_ADD_CC and WUSB_HC_REM_CC ioctl */ 72*ff0e937bSRaymond Chen typedef struct wusb_cc { 73*ff0e937bSRaymond Chen uint8_t CHID[16]; 74*ff0e937bSRaymond Chen uint8_t CDID[16]; 75*ff0e937bSRaymond Chen uint8_t CK[16]; 76*ff0e937bSRaymond Chen } wusb_cc_t; 77*ff0e937bSRaymond Chen 78*ff0e937bSRaymond Chen /* set host beaconing channel number */ 79*ff0e937bSRaymond Chen #define WUSB_HC_SET_CHANNEL (WUSB_HC_IOC | 0x05) 80*ff0e937bSRaymond Chen 81*ff0e937bSRaymond Chen /* start host to accept device connections and transfers */ 82*ff0e937bSRaymond Chen #define WUSB_HC_START (WUSB_HC_IOC | 0x06) 83*ff0e937bSRaymond Chen 84*ff0e937bSRaymond Chen /* 85*ff0e937bSRaymond Chen * start flag bitmap for WUSB_HC_START ioctl: 86*ff0e937bSRaymond Chen * INITIAL_START and CHANNEL_START are exclusive 87*ff0e937bSRaymond Chen */ 88*ff0e937bSRaymond Chen #define WUSB_HC_INITIAL_START 0x00000001 /* fully start host */ 89*ff0e937bSRaymond Chen #define WUSB_HC_CHANNEL_START 0x00000002 /* partially start host */ 90*ff0e937bSRaymond Chen 91*ff0e937bSRaymond Chen /* stop host functioning */ 92*ff0e937bSRaymond Chen #define WUSB_HC_STOP (WUSB_HC_IOC | 0x07) 93*ff0e937bSRaymond Chen 94*ff0e937bSRaymond Chen /* 95*ff0e937bSRaymond Chen * stop flag bitmap for WUSB_HC_STOP ioctl: 96*ff0e937bSRaymond Chen * FINAL_STOP and CHANNEL_STOP are exclusive, and there must be one 97*ff0e937bSRaymond Chen * REM_ALL_CC is optional 98*ff0e937bSRaymond Chen */ 99*ff0e937bSRaymond Chen #define WUSB_HC_FINAL_STOP 0x00000001 /* fully stop host */ 100*ff0e937bSRaymond Chen #define WUSB_HC_CHANNEL_STOP 0x00000002 /* partially stop host */ 101*ff0e937bSRaymond Chen #define WUSB_HC_REM_ALL_CC 0x00000004 /* remove all cc'es */ 102*ff0e937bSRaymond Chen 103*ff0e937bSRaymond Chen /* start host to accept new device connections */ 104*ff0e937bSRaymond Chen #define WUSB_HC_START_NA (WUSB_HC_IOC | 0x08) 105*ff0e937bSRaymond Chen 106*ff0e937bSRaymond Chen /* stop host from accepting new device connections */ 107*ff0e937bSRaymond Chen #define WUSB_HC_STOP_NA (WUSB_HC_IOC | 0x09) 108*ff0e937bSRaymond Chen 109*ff0e937bSRaymond Chen /* get host state */ 110*ff0e937bSRaymond Chen #define WUSB_HC_GET_HSTATE (WUSB_HC_IOC | 0x0a) 111*ff0e937bSRaymond Chen 112*ff0e937bSRaymond Chen /* host state for WUSB_HC_GET_HSTATE ioctl */ 113*ff0e937bSRaymond Chen enum wusb_host_state { 114*ff0e937bSRaymond Chen WUSB_HC_DISCONNTED = 0, 115*ff0e937bSRaymond Chen WUSB_HC_STOPPED, /* default or WUSB_HC_FINAL_STOP is called */ 116*ff0e937bSRaymond Chen WUSB_HC_STARTED, /* WUSB_HC_INITIAL_START is called */ 117*ff0e937bSRaymond Chen WUSB_HC_CH_STOPPED /* WUSB_HC_CHANNEL_STOP is called */ 118*ff0e937bSRaymond Chen }; 119*ff0e937bSRaymond Chen 120*ff0e937bSRaymond Chen #ifdef __cplusplus 121*ff0e937bSRaymond Chen } 122*ff0e937bSRaymond Chen #endif 123*ff0e937bSRaymond Chen 124*ff0e937bSRaymond Chen #endif /* _SYS_USB_WUSBA_IO_H */ 125