Linux 2.6.33-rc6
[cris-mirror.git] / drivers / staging / otus / usbdrv.h
blob330d1b95cb889435670aa31d361a5204dbb242be
1 /*
2 * Copyright (c) 2007-2008 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 /* */
17 /* Module Name : usbdrv.h */
18 /* */
19 /* Abstract */
20 /* This module contains network interface up/down related definition*/
21 /* */
22 /* NOTES */
23 /* Platform dependent. */
24 /* */
25 /************************************************************************/
27 #ifndef _USBDRV_H
28 #define _USBDRV_H
30 #define WLAN_USB 0
31 #define WLAN_PCI 1
33 #include <linux/module.h>
34 #include <linux/pci.h>
35 #include <linux/netdevice.h>
36 #include <linux/etherdevice.h>
37 #include <linux/skbuff.h>
38 #include <linux/uaccess.h>
39 #include <linux/wireless.h>
40 #include <linux/if_arp.h>
41 #include <linux/io.h>
43 #include "zdcompat.h"
45 #include "oal_dt.h"
46 #include "oal_marc.h"
47 #include "80211core/pub_zfi.h"
48 /* #include "pub_zfw.h" */
49 #include "80211core/pub_usb.h"
51 #include <linux/usb.h>
52 /* Please include header files for device type in the beginning of this file */
53 #define urb_t struct urb
55 #define usb_complete_t usb_complete_t
56 #define pipe_t u32_t
58 /* USB Endpoint definition */
59 #define USB_WLAN_TX_PIPE 1
60 #define USB_WLAN_RX_PIPE 2
61 #define USB_REG_IN_PIPE 3
62 #define USB_REG_OUT_PIPE 4
64 #ifdef ZM_HOSTAPD_SUPPORT
65 #include "athr_common.h"
66 #endif
68 /**************************************************************************
69 ** Descriptor Data Structure
70 ***************************************************************************/
71 struct driver_stats {
72 struct net_device_stats net_stats;
75 #define ZM_MAX_RX_BUFFER_SIZE 8192
77 #if ZM_USB_TX_STREAM_MODE == 1
78 #define ZM_MAX_TX_AGGREGATE_NUM 4
79 #define ZM_USB_TX_BUF_SIZE 8096
80 #define ZM_MAX_TX_URB_NUM 4
81 #else
82 #define ZM_USB_TX_BUF_SIZE 2048
83 #define ZM_MAX_TX_URB_NUM 8
84 #endif
85 #define ZM_USB_REG_MAX_BUF_SIZE 64
86 #define ZM_MAX_RX_URB_NUM 16
87 #define ZM_MAX_TX_BUF_NUM 128
89 typedef struct UsbTxQ {
90 zbuf_t *buf;
91 u8_t hdr[80];
92 u16_t hdrlen;
93 u8_t snap[8];
94 u16_t snapLen;
95 u8_t tail[16];
96 u16_t tailLen;
97 u16_t offset;
98 } UsbTxQ_t;
101 struct zdap_ioctl {
102 u16_t cmd; /* Command to run */
103 u32_t addr; /* Length of the data buffer */
104 u32_t value; /* Pointer to the data buffer */
105 u8_t data[0x100];
108 #define ZM_OAL_MAX_STA_SUPPORT 16
110 struct usbdrv_private {
111 /* linux used */
112 struct net_device *device;
113 #if (WLAN_HOSTIF == WLAN_PCI)
114 struct pci_dev *pdev;
115 #endif
116 #if (WLAN_HOSTIF == WLAN_USB)
117 struct usb_device *udev;
118 struct usb_interface *interface;
119 #endif
120 struct driver_stats drv_stats;
121 char ifname[IFNAMSIZ];
122 int using_dac;
123 u8_t rev_id; /* adapter PCI revision ID */
124 rwlock_t isolate_lock;
125 spinlock_t cs_lock;
126 int driver_isolated;
127 #if (WLAN_HOSTIF == WLAN_PCI)
128 void *regp;
129 #endif
131 /* timer for heart beat */
132 struct timer_list hbTimer10ms;
134 /* For driver core */
135 void *wd;
137 #if (WLAN_HOSTIF == WLAN_USB)
138 u8_t txUsbBuf[ZM_MAX_TX_URB_NUM][ZM_USB_TX_BUF_SIZE];
139 u8_t regUsbReadBuf[ZM_USB_REG_MAX_BUF_SIZE];
140 u8_t regUsbWriteBuf[ZM_USB_REG_MAX_BUF_SIZE];
141 urb_t *WlanTxDataUrb[ZM_MAX_TX_URB_NUM];
142 urb_t *WlanRxDataUrb[ZM_MAX_RX_URB_NUM];
143 urb_t *RegOutUrb;
144 urb_t *RegInUrb;
145 UsbTxQ_t UsbTxBufQ[ZM_MAX_TX_BUF_NUM];
146 zbuf_t *UsbRxBufQ[ZM_MAX_RX_URB_NUM];
147 u16_t TxBufHead;
148 u16_t TxBufTail;
149 u16_t TxBufCnt;
150 u16_t TxUrbHead;
151 u16_t TxUrbTail;
152 u16_t TxUrbCnt;
153 u16_t RxBufHead;
154 u16_t RxBufTail;
155 u16_t RxBufCnt;
156 #endif
158 #if ZM_USB_STREAM_MODE == 1
159 zbuf_t *reamin_buf;
160 #endif
162 #ifdef ZM_HOSTAPD_SUPPORT
163 struct athr_wlan_param athr_wpa_req;
164 #endif
165 struct sock *netlink_sk;
166 u8_t DeviceOpened; /* CWYang(+) */
167 u8_t supIe[50];
168 u8_t supLen;
169 struct ieee80211req_wpaie stawpaie[ZM_OAL_MAX_STA_SUPPORT];
170 u8_t forwardMgmt;
172 struct zfCbUsbFuncTbl usbCbFunctions;
174 /* For keventd */
175 u32_t flags;
176 unsigned long kevent_flags;
177 u16_t kevent_ready;
179 struct semaphore ioctl_sem;
180 struct work_struct kevent;
181 wait_queue_head_t wait_queue_event;
182 #ifdef ZM_HALPLUS_LOCK
183 unsigned long hal_irqFlag;
184 #endif
185 u16_t adapterState;
188 /* WDS */
189 #define ZM_WDS_PORT_NUMBER 6
191 struct zsWdsStruct {
192 struct net_device *dev;
193 u16_t openFlag;
196 /* VAP */
197 #define ZM_VAP_PORT_NUMBER 7
199 struct zsVapStruct {
200 struct net_device *dev;
201 u16_t openFlag;
204 /***************************************/
206 #define ZM_IOCTL_REG_READ 0x01
207 #define ZM_IOCTL_REG_WRITE 0x02
208 #define ZM_IOCTL_MEM_DUMP 0x03
209 #define ZM_IOCTL_REG_DUMP 0x05
210 #define ZM_IOCTL_TXD_DUMP 0x06
211 #define ZM_IOCTL_RXD_DUMP 0x07
212 #define ZM_IOCTL_MEM_READ 0x0B
213 #define ZM_IOCTL_MEM_WRITE 0x0C
214 #define ZM_IOCTL_DMA_TEST 0x10
215 #define ZM_IOCTL_REG_TEST 0x11
216 #define ZM_IOCTL_TEST 0x80
217 #define ZM_IOCTL_TALLY 0x81 /* CWYang(+) */
218 #define ZM_IOCTL_RTS 0xA0
219 #define ZM_IOCTL_MIX_MODE 0xA1
220 #define ZM_IOCTL_FRAG 0xA2
221 #define ZM_IOCTL_SCAN 0xA3
222 #define ZM_IOCTL_KEY 0xA4
223 #define ZM_IOCTL_RATE 0xA5
224 #define ZM_IOCTL_ENCRYPTION_MODE 0xA6
225 #define ZM_IOCTL_GET_TXCNT 0xA7
226 #define ZM_IOCTL_GET_DEAGG_CNT 0xA8
227 #define ZM_IOCTL_DURATION_MODE 0xA9
228 #define ZM_IOCTL_SET_AES_KEY 0xAA
229 #define ZM_IOCTL_SET_AES_MODE 0xAB
230 #define ZM_IOCTL_SIGNAL_STRENGTH 0xAC /* CWYang(+) */
231 #define ZM_IOCTL_SIGNAL_QUALITY 0xAD /* CWYang(+) */
232 #define ZM_IOCTL_SET_PIBSS_MODE 0xAE
234 #define ZDAPIOCTL SIOCDEVPRIVATE
236 enum devState {
237 Opened,
238 Enabled,
239 Disabled,
240 Closed
243 #endif /* _USBDRV_H */