📄 vnetusba.h
字号:
/* $Id: vnetusba.h,v 1.24 2004/11/10 10:52:45 smarkou Exp $ *//*************************************************************************************** Copyright 2000-2001 ATMEL Corporation. This file is part of atmel wireless lan drivers. Atmel wireless lan drivers is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Atmel wireless lan drivers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Atmel wireless lan drivers; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA**************************************************************************************/#ifndef __vnetusba_h_OK__#define __vnetusba_h_OK__#include <linux/config.h>#include <linux/sched.h>#include <linux/slab.h>#include <linux/init.h>#include <linux/delay.h>#include <linux/netdevice.h>#include <linux/wireless.h>#include <linux/etherdevice.h>#include <linux/version.h>#include <linux/usb.h>#include <asm/uaccess.h>#include "general.h"#include "appint.h"#ifdef MODULE#ifdef MODVERSIONS#include <linux/modversions.h>#endif#include <linux/module.h>#endif// Kernel 2.6 Related definitions#define AT76C503A_USB_CONFDESCR_LEN 0x20#define ATMEL_DEVDESCR_SIZE 0x12#define HUB_ROOT_RESET_TIME 50 /* times are in msec */#define PORT_RESET_TRIES 5#define SET_ADDRESS_TRIES 2#define GET_DESCRIPTOR_TRIES 2#define SET_CONFIG_TRIES 2#define HUB_RESET_TRIES 5#define HUB_LONG_RESET_TIME 200#define USB_PORT_FEAT_ENABLE 1#define USB_MAXCONFIG 8#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)#define HUB_RESET_TIMEOUT 500#define USB_PORT_FEAT_CONNECTION 0#define USB_PORT_FEAT_ENABLE 1#define USB_PORT_FEAT_SUSPEND 2#define USB_PORT_FEAT_OVER_CURRENT 3#define USB_PORT_FEAT_RESET 4#define USB_PORT_FEAT_POWER 8#define USB_PORT_FEAT_LOWSPEED 9#define USB_PORT_FEAT_HIGHSPEED 10#define USB_PORT_FEAT_C_CONNECTION 16#define USB_PORT_FEAT_C_ENABLE 17#define USB_PORT_FEAT_C_SUSPEND 18#define USB_PORT_FEAT_C_OVER_CURRENT 19#define USB_PORT_FEAT_C_RESET 20#define USB_PORT_FEAT_TEST 21#define USB_PORT_FEAT_INDICATOR 22#define USB_PORT_STAT_CONNECTION 0x0001#define USB_PORT_STAT_ENABLE 0x0002#define USB_PORT_STAT_SUSPEND 0x0004#define USB_PORT_STAT_OVERCURRENT 0x0008#define USB_PORT_STAT_RESET 0x0010/* bits 5 to 7 are reserved */#define USB_PORT_STAT_POWER 0x0100#define USB_PORT_STAT_LOW_SPEED 0x0200#define USB_PORT_STAT_HIGH_SPEED 0x0400#define USB_PORT_STAT_TEST 0x0800#define USB_PORT_STAT_INDICATOR 0x1000#define USB_PORT_STAT_C_CONNECTION 0x0001#define USB_PORT_STAT_C_ENABLE 0x0002#define USB_PORT_STAT_C_SUSPEND 0x0004#define USB_PORT_STAT_C_OVERCURRENT 0x0008#define USB_PORT_STAT_C_RESET 0x0010#define USB_MAXALTSETTING 128#if (LINUX_VERSION_CODE > 0x020500)#define USB_MAXENDPOINTS 30#endif#define USB_MAXINTERFACES 32#define HUB_SHORT_RESET_TIME 10//End of Kernel Specific definitions/* Kernel 2.4.20 Changes */#if LINUX_VERSION_CODE > 132115typedef struct devrequest { u8 requesttype; u8 request; u16 value; u16 index; u16 length;}__attribute__((packed)) devrequest;typedef struct urb *purb_t;#endif // Linux-2.4+/* kernel 2.5.xx changes */#ifndef USB_ST_NOERROR // if noerror is defined, all are defined #define USB_ST_NOERROR 0#define USB_ST_CRC (-EILSEQ)#define USB_ST_BITSTUFF (-EPROTO)#define USB_ST_NORESPONSE (-ETIMEDOUT) /* device not responding/handshaking */#define USB_ST_DATAOVERRUN (-EOVERFLOW)#define USB_ST_DATAUNDERRUN (-EREMOTEIO)#define USB_ST_BUFFEROVERRUN (-ECOMM)#define USB_ST_BUFFERUNDERRUN (-ENOSR)#define USB_ST_INTERNALERROR (-EPROTO) /* unknown error */#define USB_ST_SHORT_PACKET (-EREMOTEIO)#define USB_ST_PARTIAL_ERROR (-EXDEV) /* ISO transfer only partially completed */#define USB_ST_URB_KILLED (-ENOENT) /* URB canceled by user */#define USB_ST_URB_PENDING (-EINPROGRESS)#define USB_ST_REMOVED (-ENODEV) /* device not existing or removed */#define USB_ST_TIMEOUT (-ETIMEDOUT) /* communication timed out, also in urb->status**/#define USB_ST_NOTSUPPORTED (-ENOSYS) #define USB_ST_BANDWIDTH_ERROR (-ENOSPC) /* too much bandwidth used */#define USB_ST_URB_INVALID_ERROR (-EINVAL) /* invalid value/transfer type */#define USB_ST_URB_REQUEST_ERROR (-ENXIO) /* invalid endpoint */#define USB_ST_STALL (-EPIPE) /* pipe stalled, also in urb->status*/#endif //USB_ST_* #ifndef FILL_BULK_URB#define FILL_BULK_URB usb_fill_bulk_urb#endif #ifndef FILL_CONTROL_URB#define FILL_CONTROL_URB usb_fill_control_urb#endif #if (LINUX_VERSION_CODE >= 0x020500)#define usb_inc_dev_use usb_get_dev #define usb_dec_dev_use usb_put_dev #endif/* the version of this driver */#define VERSION_STRING "2.0.1.0"// reawaken network queue this soon after stopping; else watchdog barks#define TX_TIMEOUT_JIFFIES (5*HZ)/* when we got so many pending tx packets in TxList we stop the netdev queue */#define THRE_STOP_NET_TX 20/* and restart it below this value */#define THRE_START_NET_TX 5#define VNetVID 0x03EB#define VNetPID_RFMD 0x7605#define VNetPID_R505 0x7606#define VNetPID_R505A 0x7614#define VNetPID_R505AMX 0x7615#define VNetPID_R505AS 0x7617#define VNetPID_R505_2958 0x7613#define VNET_TX_TIMEOUT (HZ*10)#define PERIODIC_TIMER_OUT 2000// version.....#define USB_VNET_MAJOR_VERSION 2#define USB_VNET_MINOR_VERSION 1#define USB_VNET_SUB_VERSION 2#define USB_VNET_BUILD 0#define RFMD_Board 1#define R505_Board 4#define R505_2958_Board 5#define R505A_Board 6#define R505AMX_Board 7#define VNET_MAX_WIRELESS_PACKET 1554#define ACTIVE_MODE 0#define PS_MODE 1#define SPS_MODE 2#define USB_ALIGN(x) x __attribute__((aligned(L1_CACHE_BYTES)))// various flags#define RX_BUSY 0x00000002 // receiver working#define TX_SLEEP 0x00000004 // bulk out endpoint in use#define STOPPED_RX 0x00000008 // used to stop Rx path....//functionallity controls#define CTRL_URB_SLEEP 0x00000010 // ctrl endpoint in use#define VNET_RUNNING 0x00000020 // driver up and running#define NEED_CLEAR_HALT 0x00000040 // in case of usb_st_stall#define INIT_PENDING 0x00000080 // flag for initialization#define TX_STOPPED 0x00000100 // flag for tx queue status(system's queue)#define INTERNAL_FW_DNLD 0x00000200 // internal f/w downloading (DFU)#define USB_RESET_DEVICE 0x00000400 // RESET NEEDED..#define IOCTL_SLEEPING 0x00000800 // Ioctl Pending....#define ChangePending 0x00001000#define GetCommandPedding 0x00002000// mgmt status#define HeardBeacons 0x00004000 // check for out of range....#define StationIsAuthenticated 0x00008000 // check if the station is authenticated // (needed in Association Responce)#define StationWasAssociated 0x00010000 // check if the station was associated#define BSSIDfound 0x00020000 // in selectBSS flag for BSSID state#define StationIsAssociated 0x00040000#define SITE_SURVEY_REQUEST 0x00080000// wep status#define WepIsSet 0x00100000//SetPreamble Status, Fragmentation, Rts/Cts#define PreambleChanged 0x00200000#define FragChanged 0x00400000#define RtsCtsChanged 0x00800000#define AutoRFChanged 0x01000000#define TimerReScheduled 0x02000000#define WAKE_UP_WITH_ERROR 0x04000000#define FIRST_SCAN_DONE 0x08000000#define RadioOnOffChanged 0x10000000// WEP key values#define WEP_DISABLED 0#define WEP_64BIT 1#define WEP_128BIT 2#define WEP_MODE_OPTIONAL 0#define WEP_MODE_MANDATORY 1// Privacy#define C80211_MGMT_AAN_OPENSYSTEM 0x0000#define C80211_MGMT_AAN_SHAREDKEY 0x0001#define AD_HOC_MODE 1#define INFRASTRUCTURE_MODE 2#define PREAMBLE_TYPE_LONG 0#define PREAMBLE_TYPE_SHORT 1//Regulatory Domains#define REG_DOMAIN_FCC 0x10 //Channels 1-11 USA#define REG_DOMAIN_DOC 0x20 //Channel 1-11 Canada#define REG_DOMAIN_ETSI 0x30 //Channel 1-13 Europe (ex Spain/France)#define REG_DOMAIN_SPAIN 0x31 //Channel 10-11 Spain#define REG_DOMAIN_FRANCE 0x32 //Channel 10-13 France#define REG_DOMAIN_MKK 0x40 //Channel 14 Japan#define REG_DOMAIN_MKK1 0x41 //Channel 1-14 Japan(MKK1)#define REG_DOMAIN_ISRAEL 0x50 //Channel 3-9 ISRAEL///////////////////////// StationState defines///////////////////////#define STATION_STATE_INITIALIZING 0x00#define STATION_STATE_SCANNING 0x01#define STATION_STATE_JOINING 0x02#define STATION_STATE_AUTHENTICATING 0x03#define STATION_STATE_ASSOCIATING 0x04#define STATION_STATE_READY 0x05#define STATION_STATE_OUT_OF_RANGE 0x06#define STATION_STATE_DISASSOCIATING 0x07#define STATION_STATE_DEAUTHENTICATING 0x08#define STATION_STATE_REASSOCIATING 0x09#define STATION_STATE_RECONFIGURING 0x0A#define STATION_STATE_FW_DOWNLOAD 0x0B#define STATION_STATE_IDLE 0x0C#define STATION_STATE_RESET 0x0F#define STATION_STATE_EXITING 0x10#define STATION_STATE_RADIO_OFF 0x13#define STATION_STATE_MGMT_ERROR 0xf1#define STATION_STATE_INIT_FAILED 0xf2 // if initialization failed // and a function sleeps(vnet_probe) when it wakes up it has to know what happened/////////////////////////// Device Operating Modes/////////////////////////#define DeviceNetCardMode 1#define DeviceConfigurationMode 2#define DeviceDFUMode 3#define DeviceNOFlashNetCardMode 4//#define UNDER_CONSTRUCTION 0x01//#define TX_DATA 0x02//#define TX_MGMT 0x04#define UNDER_SUBMIT 0x08//Setup Packet used in Ctrl urb's filler....#define FILL_REQUEST(a,aa,ab,ac,ad,ae)\ do {\ (a)->devreq->request = aa;\ (a)->devreq->requesttype = ab;\ (a)->devreq->value = cpu_to_le16(ac);\ (a)->devreq->index = cpu_to_le16(ad);\ (a)->devreq->length = cpu_to_le16(ae);\ }while(0)typedef struct __DFU { PUCHAR ExternalRom; PUCHAR InternalRom; USHORT BlockCnt; UCHAR State; UCHAR StatusBuf[6]; ULONG TimeOut; UCHAR ReSendState; USHORT ExternalFWSizeLeft; USHORT InternalFWSizeLeft;} DFU, *PDFU;#ifdef ATMEL_WLAN#define HEADER_SIZE 14#define MAXIMUM_PACKET_SIZE 1500#define WIRELESS_HEADER_OVERHEAD 18#define MAX_TX_PADDING_BYTES 50#define MAX_RX_PADDING_BYTES 66#define CRC32_BYTES 4#define MIC_OVERHEAD 8#define CCX_OVERHEAD 10#define MAX_WIRELESS_SIZE WIRELESS_HEADER_OVERHEAD + HEADER_SIZE + MAXIMUM_PACKET_SIZE + MIC_OVERHEAD + CRC32_BYTES + CCX_OVERHEAD#define MAX_ASSOC_BUFF_LEN 255#define MAX_ELEMENT_SIZE 255#define MAX_AP_ENTRIES 64#define ESS_ID_SIZE 32#define WPA_MODE_OFF 0#define WPA_MODE_1 1#define WPA_MODE_2 2#define SSID_ELEMENT_OFFSET 14 //12+2#define SSID_ELEMENT_LENGTH_OFFSET 13 //12+1#define SSID_ELEMENT_ID_OFFSET 12 //12+1#define SUP_RATES_ELEMENT_LENGTH_REL_OFFSET 15 //12+2+1#define DS_PARAM_SET_ELEMENT_REL_OFFSET 18 //12+2+2+2#define BSSID_HEADER_OFFSET 16#define MGMT_FRAME_BODY_OFFSET 24#define SUPPORTED_RATES_ELEMENT_ID 1#define MIN_BEACON_PROBE_BYTES 60#define MAX_WPA_ELEMENT_SIZE 200 //52+...#define WPA_ELEMENT_GROUP_SUITE_OFFSET 6#define WPA_ELEMENT_PW_SUITE_OFFSET 10#define WPA_ELEMENT_PW_LIST_OFFSET 12#define MIN_WPA_ELEMENT_DATA_SIZE 6#define MAX_RSSI_SAMPLES 32#define MAX_RECONNECT_RETRIES 9#define MAX_EAPOL_PACKETS 5#define EAPOL_KEY_INFO_TYPE 0x0008#define EAPOL_KEY_INFO_ACK 0x0080#define EAPOL_KEY_INFO_INDEX 0x0030#define EAPOL_KEY_INFO_REQUEST 0x0800#define EAPOL_KEY_INFO_ERROR 0x0400#define EAPOL_KEY_INFO_SECURE 0x0200#define EAPOL_KEY_INFO_MIC 0x0100typedef struct __MIC_BLACK_LIST{ UCHAR Bssid[6]; UCHAR InUse; ULONG64 TimeStamp;}MIC_BLACK_LIST, *PMIC_BLACK_LIST;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -