ipw2200.h

来自「底层驱动开发」· C头文件 代码 · 共 1,681 行 · 第 1/4 页

H
1,681
字号
/******************************************************************************  Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved.  This program is free software; you can redistribute it and/or modify it  under the terms of version 2 of the GNU General Public License as  published by the Free Software Foundation.  This program 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  this program; if not, write to the Free Software Foundation, Inc., 59  Temple Place - Suite 330, Boston, MA  02111-1307, USA.  The full GNU General Public License is included in this distribution in the  file called LICENSE.  Contact Information:  James P. Ketrenos <ipw2100-admin@linux.intel.com>  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497******************************************************************************/#ifndef __ipw2200_h__#define __ipw2200_h__#define WEXT_USECHANNELS 1#include <linux/module.h>#include <linux/moduleparam.h>#include <linux/config.h>#include <linux/init.h>#include <linux/version.h>#include <linux/pci.h>#include <linux/netdevice.h>#include <linux/ethtool.h>#include <linux/skbuff.h>#include <linux/etherdevice.h>#include <linux/delay.h>#include <linux/random.h>#include <linux/dma-mapping.h>#include <linux/firmware.h>#include <linux/wireless.h>#include <linux/dma-mapping.h>#include <asm/io.h>#include <net/ieee80211.h>#define DRV_NAME	"ipw2200"#include <linux/workqueue.h>/* Authentication  and Association States */enum connection_manager_assoc_states {	CMAS_INIT = 0,	CMAS_TX_AUTH_SEQ_1,	CMAS_RX_AUTH_SEQ_2,	CMAS_AUTH_SEQ_1_PASS,	CMAS_AUTH_SEQ_1_FAIL,	CMAS_TX_AUTH_SEQ_3,	CMAS_RX_AUTH_SEQ_4,	CMAS_AUTH_SEQ_2_PASS,	CMAS_AUTH_SEQ_2_FAIL,	CMAS_AUTHENTICATED,	CMAS_TX_ASSOC,	CMAS_RX_ASSOC_RESP,	CMAS_ASSOCIATED,	CMAS_LAST};#define IPW_WAIT                     (1<<0)#define IPW_QUIET                    (1<<1)#define IPW_ROAMING                  (1<<2)#define IPW_POWER_MODE_CAM           0x00	//(always on)#define IPW_POWER_INDEX_1            0x01#define IPW_POWER_INDEX_2            0x02#define IPW_POWER_INDEX_3            0x03#define IPW_POWER_INDEX_4            0x04#define IPW_POWER_INDEX_5            0x05#define IPW_POWER_AC                 0x06#define IPW_POWER_BATTERY            0x07#define IPW_POWER_LIMIT              0x07#define IPW_POWER_MASK               0x0F#define IPW_POWER_ENABLED            0x10#define IPW_POWER_LEVEL(x)           ((x) & IPW_POWER_MASK)#define IPW_CMD_HOST_COMPLETE                 2#define IPW_CMD_POWER_DOWN                    4#define IPW_CMD_SYSTEM_CONFIG                 6#define IPW_CMD_MULTICAST_ADDRESS             7#define IPW_CMD_SSID                          8#define IPW_CMD_ADAPTER_ADDRESS              11#define IPW_CMD_PORT_TYPE                    12#define IPW_CMD_RTS_THRESHOLD                15#define IPW_CMD_FRAG_THRESHOLD               16#define IPW_CMD_POWER_MODE                   17#define IPW_CMD_WEP_KEY                      18#define IPW_CMD_TGI_TX_KEY                   19#define IPW_CMD_SCAN_REQUEST                 20#define IPW_CMD_ASSOCIATE                    21#define IPW_CMD_SUPPORTED_RATES              22#define IPW_CMD_SCAN_ABORT                   23#define IPW_CMD_TX_FLUSH                     24#define IPW_CMD_QOS_PARAMETERS               25#define IPW_CMD_SCAN_REQUEST_EXT             26#define IPW_CMD_DINO_CONFIG                  30#define IPW_CMD_RSN_CAPABILITIES             31#define IPW_CMD_RX_KEY                       32#define IPW_CMD_CARD_DISABLE                 33#define IPW_CMD_SEED_NUMBER                  34#define IPW_CMD_TX_POWER                     35#define IPW_CMD_COUNTRY_INFO                 36#define IPW_CMD_AIRONET_INFO                 37#define IPW_CMD_AP_TX_POWER                  38#define IPW_CMD_CCKM_INFO                    39#define IPW_CMD_CCX_VER_INFO                 40#define IPW_CMD_SET_CALIBRATION              41#define IPW_CMD_SENSITIVITY_CALIB            42#define IPW_CMD_RETRY_LIMIT                  51#define IPW_CMD_IPW_PRE_POWER_DOWN           58#define IPW_CMD_VAP_BEACON_TEMPLATE          60#define IPW_CMD_VAP_DTIM_PERIOD              61#define IPW_CMD_EXT_SUPPORTED_RATES          62#define IPW_CMD_VAP_LOCAL_TX_PWR_CONSTRAINT  63#define IPW_CMD_VAP_QUIET_INTERVALS          64#define IPW_CMD_VAP_CHANNEL_SWITCH           65#define IPW_CMD_VAP_MANDATORY_CHANNELS       66#define IPW_CMD_VAP_CELL_PWR_LIMIT           67#define IPW_CMD_VAP_CF_PARAM_SET             68#define IPW_CMD_VAP_SET_BEACONING_STATE      69#define IPW_CMD_MEASUREMENT                  80#define IPW_CMD_POWER_CAPABILITY             81#define IPW_CMD_SUPPORTED_CHANNELS           82#define IPW_CMD_TPC_REPORT                   83#define IPW_CMD_WME_INFO                     84#define IPW_CMD_PRODUCTION_COMMAND	     85#define IPW_CMD_LINKSYS_EOU_INFO             90#define RFD_SIZE                              4#define NUM_TFD_CHUNKS                        6#define TX_QUEUE_SIZE                        32#define RX_QUEUE_SIZE                        32#define DINO_CMD_WEP_KEY                   0x08#define DINO_CMD_TX                        0x0B#define DCT_ANTENNA_A                      0x01#define DCT_ANTENNA_B                      0x02#define IPW_A_MODE                         0#define IPW_B_MODE                         1#define IPW_G_MODE                         2/* * TX Queue Flag Definitions *//* abort attempt if mgmt frame is rx'd */#define DCT_FLAG_ABORT_MGMT                0x01/* require CTS */#define DCT_FLAG_CTS_REQUIRED              0x02/* use short preamble */#define DCT_FLAG_SHORT_PREMBL              0x04/* RTS/CTS first */#define DCT_FLAG_RTS_REQD                  0x08/* dont calculate duration field */#define DCT_FLAG_DUR_SET                   0x10/* even if MAC WEP set (allows pre-encrypt) */#define DCT_FLAG_NO_WEP              0x20/* overwrite TSF field */#define DCT_FLAG_TSF_REQD                  0x40/* ACK rx is expected to follow */#define DCT_FLAG_ACK_REQD                  0x80#define DCT_FLAG_EXT_MODE_CCK  0x01#define DCT_FLAG_EXT_MODE_OFDM 0x00#define TX_RX_TYPE_MASK                    0xFF#define TX_FRAME_TYPE                      0x00#define TX_HOST_COMMAND_TYPE               0x01#define RX_FRAME_TYPE                      0x09#define RX_HOST_NOTIFICATION_TYPE          0x03#define RX_HOST_CMD_RESPONSE_TYPE          0x04#define RX_TX_FRAME_RESPONSE_TYPE          0x05#define TFD_NEED_IRQ_MASK                  0x04#define HOST_CMD_DINO_CONFIG               30#define HOST_NOTIFICATION_STATUS_ASSOCIATED             10#define HOST_NOTIFICATION_STATUS_AUTHENTICATE           11#define HOST_NOTIFICATION_STATUS_SCAN_CHANNEL_RESULT    12#define HOST_NOTIFICATION_STATUS_SCAN_COMPLETED         13#define HOST_NOTIFICATION_STATUS_FRAG_LENGTH            14#define HOST_NOTIFICATION_STATUS_LINK_DETERIORATION     15#define HOST_NOTIFICATION_DINO_CONFIG_RESPONSE          16#define HOST_NOTIFICATION_STATUS_BEACON_STATE           17#define HOST_NOTIFICATION_STATUS_TGI_TX_KEY             18#define HOST_NOTIFICATION_TX_STATUS                     19#define HOST_NOTIFICATION_CALIB_KEEP_RESULTS            20#define HOST_NOTIFICATION_MEASUREMENT_STARTED           21#define HOST_NOTIFICATION_MEASUREMENT_ENDED             22#define HOST_NOTIFICATION_CHANNEL_SWITCHED              23#define HOST_NOTIFICATION_RX_DURING_QUIET_PERIOD        24#define HOST_NOTIFICATION_NOISE_STATS			25#define HOST_NOTIFICATION_S36_MEASUREMENT_ACCEPTED      30#define HOST_NOTIFICATION_S36_MEASUREMENT_REFUSED       31#define HOST_NOTIFICATION_STATUS_BEACON_MISSING         1#define IPW_MB_DISASSOCIATE_THRESHOLD_DEFAULT           24#define IPW_MB_ROAMING_THRESHOLD_DEFAULT                8#define IPW_REAL_RATE_RX_PACKET_THRESHOLD               300#define MACADRR_BYTE_LEN                     6#define DCR_TYPE_AP                       0x01#define DCR_TYPE_WLAP                     0x02#define DCR_TYPE_MU_ESS                   0x03#define DCR_TYPE_MU_IBSS                  0x04#define DCR_TYPE_MU_PIBSS                 0x05#define DCR_TYPE_SNIFFER                  0x06#define DCR_TYPE_MU_BSS        DCR_TYPE_MU_ESS/** * Generic queue structure * * Contains common data for Rx and Tx queues */struct clx2_queue {	int n_bd;		       /**< number of BDs in this queue */	int first_empty;	       /**< 1-st empty entry (index) */	int last_used;		       /**< last used entry (index) */	u32 reg_w;		     /**< 'write' reg (queue head), addr in domain 1 */	u32 reg_r;		     /**< 'read' reg (queue tail), addr in domain 1 */	dma_addr_t dma_addr;		/**< physical addr for BD's */	int low_mark;		       /**< low watermark, resume queue if free space more than this */	int high_mark;		       /**< high watermark, stop queue if free space less than this */} __attribute__ ((packed));struct machdr32 {	u16 frame_ctl;	u16 duration;		// watch out for endians!	u8 addr1[MACADRR_BYTE_LEN];	u8 addr2[MACADRR_BYTE_LEN];	u8 addr3[MACADRR_BYTE_LEN];	u16 seq_ctrl;		// more endians!	u8 addr4[MACADRR_BYTE_LEN];	u16 qos_ctrl;} __attribute__ ((packed));struct machdr30 {	u16 frame_ctl;	u16 duration;		// watch out for endians!	u8 addr1[MACADRR_BYTE_LEN];	u8 addr2[MACADRR_BYTE_LEN];	u8 addr3[MACADRR_BYTE_LEN];	u16 seq_ctrl;		// more endians!	u8 addr4[MACADRR_BYTE_LEN];} __attribute__ ((packed));struct machdr26 {	u16 frame_ctl;	u16 duration;		// watch out for endians!	u8 addr1[MACADRR_BYTE_LEN];	u8 addr2[MACADRR_BYTE_LEN];	u8 addr3[MACADRR_BYTE_LEN];	u16 seq_ctrl;		// more endians!	u16 qos_ctrl;} __attribute__ ((packed));struct machdr24 {	u16 frame_ctl;	u16 duration;		// watch out for endians!	u8 addr1[MACADRR_BYTE_LEN];	u8 addr2[MACADRR_BYTE_LEN];	u8 addr3[MACADRR_BYTE_LEN];	u16 seq_ctrl;		// more endians!} __attribute__ ((packed));// TX TFD with 32 byte MAC Headerstruct tx_tfd_32 {	struct machdr32 mchdr;	// 32	u32 uivplaceholder[2];	// 8} __attribute__ ((packed));// TX TFD with 30 byte MAC Headerstruct tx_tfd_30 {	struct machdr30 mchdr;	// 30	u8 reserved[2];		// 2	u32 uivplaceholder[2];	// 8} __attribute__ ((packed));// tx tfd with 26 byte mac headerstruct tx_tfd_26 {	struct machdr26 mchdr;	// 26	u8 reserved1[2];	// 2	u32 uivplaceholder[2];	// 8	u8 reserved2[4];	// 4} __attribute__ ((packed));// tx tfd with 24 byte mac headerstruct tx_tfd_24 {	struct machdr24 mchdr;	// 24	u32 uivplaceholder[2];	// 8	u8 reserved[8];		// 8} __attribute__ ((packed));#define DCT_WEP_KEY_FIELD_LENGTH 16struct tfd_command {	u8 index;	u8 length;	u16 reserved;	u8 payload[0];} __attribute__ ((packed));struct tfd_data {	/* Header */	u32 work_area_ptr;	u8 station_number;	/* 0 for BSS */	u8 reserved1;	u16 reserved2;	/* Tx Parameters */	u8 cmd_id;	u8 seq_num;	u16 len;	u8 priority;	u8 tx_flags;	u8 tx_flags_ext;	u8 key_index;	u8 wepkey[DCT_WEP_KEY_FIELD_LENGTH];	u8 rate;	u8 antenna;	u16 next_packet_duration;	u16 next_frag_len;	u16 back_off_counter;	//////txop;	u8 retrylimit;	u16 cwcurrent;	u8 reserved3;	/* 802.11 MAC Header */	union {		struct tx_tfd_24 tfd_24;		struct tx_tfd_26 tfd_26;		struct tx_tfd_30 tfd_30;		struct tx_tfd_32 tfd_32;	} tfd;	/* Payload DMA info */	u32 num_chunks;	u32 chunk_ptr[NUM_TFD_CHUNKS];	u16 chunk_len[NUM_TFD_CHUNKS];} __attribute__ ((packed));struct txrx_control_flags {	u8 message_type;	u8 rx_seq_num;	u8 control_bits;	u8 reserved;} __attribute__ ((packed));#define  TFD_SIZE                           128#define  TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH   (TFD_SIZE - sizeof(struct txrx_control_flags))struct tfd_frame {	struct txrx_control_flags control_flags;	union {		struct tfd_data data;		struct tfd_command cmd;		u8 raw[TFD_CMD_IMMEDIATE_PAYLOAD_LENGTH];	} u;} __attribute__ ((packed));typedef void destructor_func(const void *);/** * Tx Queue for DMA. Queue consists of circular buffer of * BD's and required locking structures. */struct clx2_tx_queue {	struct clx2_queue q;	struct tfd_frame *bd;	struct ieee80211_txb **txb;};/* * RX related structures and functions */#define RX_FREE_BUFFERS 32#define RX_LOW_WATERMARK 8#define SUP_RATE_11A_MAX_NUM_CHANNELS  (8)#define SUP_RATE_11B_MAX_NUM_CHANNELS  (4)#define SUP_RATE_11G_MAX_NUM_CHANNELS  (12)// Used for passing to driver number of successes and failures per ratestruct rate_histogram {	union {		u32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];		u32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];		u32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];	} success;	union {		u32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];		u32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];		u32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];	} failed;} __attribute__ ((packed));

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?