Annotation of sys/dev/usb/if_wi_usb.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: if_wi_usb.h,v 1.2 2005/10/31 05:37:13 jsg Exp $ */
! 2:
! 3: /*
! 4: * Copyright (c) 2003 Dale Rahn. All rights reserved.
! 5: *
! 6: * Redistribution and use in source and binary forms, with or without
! 7: * modification, are permitted provided that the following conditions
! 8: * are met:
! 9: * 1. Redistributions of source code must retain the above copyright
! 10: * notice, this list of conditions and the following disclaimer.
! 11: * 2. Redistributions in binary form must reproduce the above copyright
! 12: * notice, this list of conditions and the following disclaimer in the
! 13: * documentation and/or other materials provided with the distribution.
! 14: *
! 15: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 16: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! 17: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 18: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
! 19: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
! 20: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! 21: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! 22: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 23: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
! 24: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! 25: *
! 26: * Effort sponsored in part by the Defense Advanced Research Projects
! 27: * Agency (DARPA) and Air Force Research Laboratory, Air Force
! 28: * Materiel Command, USAF, under agreement number F30602-01-2-0537.
! 29: */
! 30:
! 31: #define WI_USB_CONFIG_NO 1
! 32:
! 33: #define WI_USB_ENDPT_TX 1
! 34: #define WI_USB_ENDPT_RX 2
! 35: #define WI_USB_ENDPT_INTR 3
! 36: #define WI_USB_ENDPT_MAX 4
! 37:
! 38: #define WI_USB_IFACE_IDX 0
! 39:
! 40:
! 41: /* XXX */
! 42: #define WI_USB_DATA_MAXLEN WI_DEFAULT_DATALEN
! 43: #define WI_USB_BUFSZ 2368 /* MAX PACKET LEN ??? n%64 == 0 */
! 44: #define WI_USB_INTR_INTERVAL 100 /* ms */
! 45:
! 46: struct wi_usb_softc;
! 47:
! 48: struct wi_usb_chain {
! 49: struct wi_usb_softc *wi_usb_sc;
! 50: struct usbd_xfer *wi_usb_xfer;
! 51: void *wi_usb_buf;
! 52: struct mbuf *wi_usb_mbuf;
! 53: int wi_usb_idx;
! 54: };
! 55: #define WI_USB_TX_LIST_CNT 1
! 56: #define WI_USB_RX_LIST_CNT 1
! 57:
! 58: struct wi_rridreq {
! 59: u_int16_t type; /* 0x00 */
! 60: u_int16_t frmlen; /* 0x02 */
! 61: u_int16_t rid; /* 0x04 */
! 62: u_int8_t pad[58]; /* 0x06 + sizeof(.) == 64 */
! 63: };
! 64: struct wi_rridresp {
! 65: u_int16_t type; /* 0x00 */
! 66: u_int16_t frmlen; /* 0x02 */
! 67: u_int16_t rid; /* 0x04 */
! 68: u_int8_t data[1658]; /* 0x06 */
! 69: /* sizeof(struct wi_rridresp) == WI_USB_BUFSZ */
! 70: };
! 71: struct wi_wridreq {
! 72: u_int16_t type; /* 0x00 */
! 73: u_int16_t frmlen; /* 0x02 */
! 74: u_int16_t rid; /* 0x04 */
! 75: u_int8_t data[2048]; /* 0x06 */
! 76: };
! 77: struct wi_wridresp {
! 78: u_int16_t type;
! 79: u_int16_t status;
! 80: u_int16_t resp0;
! 81: u_int16_t resp1;
! 82: u_int16_t resp2;
! 83: };
! 84: struct wi_info {
! 85: u_int16_t type;
! 86: u_int16_t info;
! 87: };
! 88:
! 89:
! 90: #define WI_USB_CMD_INIT 0x0
! 91: #define WI_USB_CMD_ENABLE 0x1
! 92: #define WI_USB_CMD_DISABLE 0x2
! 93: #define WI_USB_CMD_DIAG 0x3
! 94:
! 95: struct wi_cmdreq {
! 96: u_int16_t type;
! 97: u_int16_t cmd;
! 98: u_int16_t param0;
! 99: u_int16_t param1;
! 100: u_int16_t param2;
! 101: u_int8_t pad[54];
! 102: };
! 103: struct wi_cmdresp {
! 104: u_int16_t type;
! 105: u_int16_t status;
! 106: u_int16_t resp0;
! 107: u_int16_t resp1;
! 108: u_int16_t resp2;
! 109: };
! 110:
! 111: typedef union {
! 112: u_int16_t type;
! 113: struct wi_rridreq rridreq;
! 114: struct wi_rridresp rridresp;
! 115: struct wi_cmdreq cmdreq;
! 116: struct wi_cmdresp cmdresp;
! 117: } wi_usb_usbin;
! 118: #define WI_USB_INTR_PKTLEN 8
! 119:
! 120: #define WI_USB_TX_TIMEOUT 10000 /* ms */
! 121:
! 122:
! 123: /* Should be sent to the bulkout endpoint */
! 124: #define WI_USB_TXFRM 0
! 125: #define WI_USB_CMDREQ 1
! 126: #define WI_USB_WRIDREQ 2
! 127: #define WI_USB_RRIDREQ 3
! 128: #define WI_USB_WMEMREQ 4
! 129: #define WI_USB_RMEMREQ 5
! 130:
! 131: /* Received from the bulkin endpoint */
! 132: #define WI_USB_ISTXFRM(a) (((a) & 0xf000) == 0x0000)
! 133: #define WI_USB_ISRXFRM(a) (((a) & 0xf000) == 0x2000)
! 134:
! 135: #define WI_USB_INFOFRM 0x8000
! 136: #define WI_USB_CMDRESP 0x8001
! 137: #define WI_USB_WRIDRESP 0x8002
! 138: #define WI_USB_RRIDRESP 0x8003
! 139: #define WI_USB_WMEMRESP 0x8004
! 140: #define WI_USB_RMEMRESP 0x8005
! 141: #define WI_USB_BUFAVAIL 0x8006
! 142: #define WI_USB_ERROR 0x8007
! 143:
! 144: #define WI_GET_IFP(sc) &(sc)->sc_wi.sc_ic.ic_if
! 145:
! 146: /* USB */
! 147: int wi_cmd_usb(struct wi_softc *sc, int cmd, int val0, int val1, int val2);
! 148: int wi_read_record_usb(struct wi_softc *sc, struct wi_ltv_gen *ltv);
! 149: int wi_write_record_usb(struct wi_softc *sc, struct wi_ltv_gen *ltv);
! 150: int wi_read_data_usb(struct wi_softc *sc, int id, int off, caddr_t buf,
! 151: int len);
! 152: int wi_write_data_usb(struct wi_softc *sc, int id, int off, caddr_t buf,
! 153: int len);
! 154: int wi_alloc_nicmem_usb(struct wi_softc *sc, int len, int *id);
! 155: int wi_get_fid_usb(struct wi_softc *sc, int fid);
! 156: void wi_init_usb(struct wi_softc *sc);
! 157:
! 158: void wi_start_usb(struct ifnet *ifp);
! 159: int wi_ioctl_usb(struct ifnet *, u_long, caddr_t);
! 160: void wi_inquire_usb(void *xsc);
! 161: void wi_watchdog_usb(struct ifnet *ifp);
CVSweb