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.
17 /* Module Name : usbdrv.h */
20 /* This module contains network interface up/down related definition*/
23 /* Platform dependent. */
25 /************************************************************************/
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/version.h>
39 #include <asm/uaccess.h>
40 #include <linux/wireless.h>
41 #include <linux/if_arp.h>
44 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
45 #include <asm/div64.h>
52 #include "80211core/pub_zfi.h"
53 //#include "pub_zfw.h"
54 #include "80211core/pub_usb.h"
56 #include <linux/usb.h>
57 /* Please include header files for device type in the beginning of this file */
58 #define urb_t struct urb
60 #define usb_complete_t usb_complete_t
63 /* USB Endpoint definition */
64 #define USB_WLAN_TX_PIPE 1
65 #define USB_WLAN_RX_PIPE 2
66 #define USB_REG_IN_PIPE 3
67 #define USB_REG_OUT_PIPE 4
69 #if (WLAN_HOSTIF == WLAN_USB)
70 #include <linux/usb.h>
73 #ifdef ZM_HOSTAPD_SUPPORT
74 #include "athr_common.h"
77 /**************************************************************************
78 ** Descriptor Data Structure
79 ***************************************************************************/
81 struct net_device_stats net_stats;
84 #define ZM_MAX_RX_BUFFER_SIZE 8192
86 #if ZM_USB_TX_STREAM_MODE == 1
87 #define ZM_MAX_TX_AGGREGATE_NUM 4
88 #define ZM_USB_TX_BUF_SIZE 8096
89 #define ZM_MAX_TX_URB_NUM 4
91 #define ZM_USB_TX_BUF_SIZE 2048
92 #define ZM_MAX_TX_URB_NUM 8
94 #define ZM_USB_REG_MAX_BUF_SIZE 64
95 #define ZM_MAX_RX_URB_NUM 16
96 #define ZM_MAX_TX_BUF_NUM 128
112 u16_t cmd; /* Command to run */
113 u32_t addr; /* Length of the data buffer */
114 u32_t value; /* Pointer to the data buffer */
118 #define ZM_OAL_MAX_STA_SUPPORT 16
120 struct usbdrv_private
123 struct net_device *device;
124 #if (WLAN_HOSTIF == WLAN_PCI)
125 struct pci_dev *pdev;
127 #if (WLAN_HOSTIF == WLAN_USB)
128 struct usb_device *udev;
129 struct usb_interface *interface;
131 struct driver_stats drv_stats;
132 char ifname[IFNAMSIZ];
134 u8_t rev_id; /* adapter PCI revision ID */
135 rwlock_t isolate_lock;
138 #if (WLAN_HOSTIF == WLAN_PCI)
142 /* timer for heart beat */
143 struct timer_list hbTimer10ms;
145 /* For driver core */
148 #if (WLAN_HOSTIF == WLAN_USB)
149 u8_t txUsbBuf[ZM_MAX_TX_URB_NUM][ZM_USB_TX_BUF_SIZE];
150 u8_t regUsbReadBuf[ZM_USB_REG_MAX_BUF_SIZE];
151 u8_t regUsbWriteBuf[ZM_USB_REG_MAX_BUF_SIZE];
152 urb_t *WlanTxDataUrb[ZM_MAX_TX_URB_NUM];
153 urb_t *WlanRxDataUrb[ZM_MAX_RX_URB_NUM];
156 UsbTxQ_t UsbTxBufQ[ZM_MAX_TX_BUF_NUM];
157 zbuf_t *UsbRxBufQ[ZM_MAX_RX_URB_NUM];
169 #if ZM_USB_STREAM_MODE == 1
173 #ifdef ZM_HOSTAPD_SUPPORT
174 struct athr_wlan_param athr_wpa_req;
176 struct sock *netlink_sk;
177 u8_t DeviceOpened; //CWYang(+)
180 struct ieee80211req_wpaie stawpaie[ZM_OAL_MAX_STA_SUPPORT];
183 struct zfCbUsbFuncTbl usbCbFunctions;
187 unsigned long kevent_flags;
190 struct semaphore ioctl_sem;
191 struct work_struct kevent;
192 wait_queue_head_t wait_queue_event;
193 #ifdef ZM_HALPLUS_LOCK
194 unsigned long hal_irqFlag;
200 #define ZM_WDS_PORT_NUMBER 6
204 struct net_device* dev;
209 #define ZM_VAP_PORT_NUMBER 7
213 struct net_device* dev;
217 /***************************************/
219 #define ZM_IOCTL_REG_READ 0x01
220 #define ZM_IOCTL_REG_WRITE 0x02
221 #define ZM_IOCTL_MEM_DUMP 0x03
222 #define ZM_IOCTL_REG_DUMP 0x05
223 #define ZM_IOCTL_TXD_DUMP 0x06
224 #define ZM_IOCTL_RXD_DUMP 0x07
225 #define ZM_IOCTL_MEM_READ 0x0B
226 #define ZM_IOCTL_MEM_WRITE 0x0C
227 #define ZM_IOCTL_DMA_TEST 0x10
228 #define ZM_IOCTL_REG_TEST 0x11
229 #define ZM_IOCTL_TEST 0x80
230 #define ZM_IOCTL_TALLY 0x81 //CWYang(+)
231 #define ZM_IOCTL_RTS 0xA0
232 #define ZM_IOCTL_MIX_MODE 0xA1
233 #define ZM_IOCTL_FRAG 0xA2
234 #define ZM_IOCTL_SCAN 0xA3
235 #define ZM_IOCTL_KEY 0xA4
236 #define ZM_IOCTL_RATE 0xA5
237 #define ZM_IOCTL_ENCRYPTION_MODE 0xA6
238 #define ZM_IOCTL_GET_TXCNT 0xA7
239 #define ZM_IOCTL_GET_DEAGG_CNT 0xA8
240 #define ZM_IOCTL_DURATION_MODE 0xA9
241 #define ZM_IOCTL_SET_AES_KEY 0xAA
242 #define ZM_IOCTL_SET_AES_MODE 0xAB
243 #define ZM_IOCTL_SIGNAL_STRENGTH 0xAC //CWYang(+)
244 #define ZM_IOCTL_SIGNAL_QUALITY 0xAD //CWYang(+)
245 #define ZM_IOCTL_SET_PIBSS_MODE 0xAE
247 #define ZDAPIOCTL SIOCDEVPRIVATE
256 #endif /* _USBDRV_H */