📄 ipw2100.h
字号:
/****************************************************************************** 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 _IPW2100_H#define _IPW2100_H#include <linux/sched.h>#include <linux/interrupt.h>#include <linux/netdevice.h>#include <linux/etherdevice.h>#include <linux/list.h>#include <linux/delay.h>#include <linux/skbuff.h>#include <asm/io.h>#include <linux/socket.h>#include <linux/if_arp.h>#include <linux/wireless.h>#include <net/iw_handler.h> // new driver API#include <net/ieee80211.h>#include <linux/workqueue.h>struct ipw2100_priv;struct ipw2100_tx_packet;struct ipw2100_rx_packet;#define IPW_DL_UNINIT 0x80000000#define IPW_DL_NONE 0x00000000#define IPW_DL_ALL 0x7FFFFFFF/* * To use the debug system; * * If you are defining a new debug classification, simply add it to the #define * list here in the form of: * * #define IPW_DL_xxxx VALUE * * shifting value to the left one bit from the previous entry. xxxx should be * the name of the classification (for example, WEP) * * You then need to either add a IPW2100_xxxx_DEBUG() macro definition for your * classification, or use IPW_DEBUG(IPW_DL_xxxx, ...) whenever you want * to send output to that classification. * * To add your debug level to the list of levels seen when you perform * * % cat /proc/net/ipw2100/debug_level * * you simply need to add your entry to the ipw2100_debug_levels array. * * If you do not see debug_level in /proc/net/ipw2100 then you do not have * CONFIG_IPW_DEBUG defined in your kernel configuration * */#define IPW_DL_ERROR (1<<0)#define IPW_DL_WARNING (1<<1)#define IPW_DL_INFO (1<<2)#define IPW_DL_WX (1<<3)#define IPW_DL_HC (1<<5)#define IPW_DL_STATE (1<<6)#define IPW_DL_NOTIF (1<<10)#define IPW_DL_SCAN (1<<11)#define IPW_DL_ASSOC (1<<12)#define IPW_DL_DROP (1<<13)#define IPW_DL_IOCTL (1<<14)#define IPW_DL_RF_KILL (1<<17)#define IPW_DL_MANAGE (1<<15)#define IPW_DL_FW (1<<16)#define IPW_DL_FRAG (1<<21)#define IPW_DL_WEP (1<<22)#define IPW_DL_TX (1<<23)#define IPW_DL_RX (1<<24)#define IPW_DL_ISR (1<<25)#define IPW_DL_IO (1<<26)#define IPW_DL_TRACE (1<<28)#define IPW_DEBUG_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a)#define IPW_DEBUG_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a)#define IPW_DEBUG_INFO(f...) IPW_DEBUG(IPW_DL_INFO, ## f)#define IPW_DEBUG_WX(f...) IPW_DEBUG(IPW_DL_WX, ## f)#define IPW_DEBUG_SCAN(f...) IPW_DEBUG(IPW_DL_SCAN, ## f)#define IPW_DEBUG_NOTIF(f...) IPW_DEBUG(IPW_DL_NOTIF, ## f)#define IPW_DEBUG_TRACE(f...) IPW_DEBUG(IPW_DL_TRACE, ## f)#define IPW_DEBUG_RX(f...) IPW_DEBUG(IPW_DL_RX, ## f)#define IPW_DEBUG_TX(f...) IPW_DEBUG(IPW_DL_TX, ## f)#define IPW_DEBUG_ISR(f...) IPW_DEBUG(IPW_DL_ISR, ## f)#define IPW_DEBUG_MANAGEMENT(f...) IPW_DEBUG(IPW_DL_MANAGE, ## f)#define IPW_DEBUG_WEP(f...) IPW_DEBUG(IPW_DL_WEP, ## f)#define IPW_DEBUG_HC(f...) IPW_DEBUG(IPW_DL_HC, ## f)#define IPW_DEBUG_FRAG(f...) IPW_DEBUG(IPW_DL_FRAG, ## f)#define IPW_DEBUG_FW(f...) IPW_DEBUG(IPW_DL_FW, ## f)#define IPW_DEBUG_RF_KILL(f...) IPW_DEBUG(IPW_DL_RF_KILL, ## f)#define IPW_DEBUG_DROP(f...) IPW_DEBUG(IPW_DL_DROP, ## f)#define IPW_DEBUG_IO(f...) IPW_DEBUG(IPW_DL_IO, ## f)#define IPW_DEBUG_IOCTL(f...) IPW_DEBUG(IPW_DL_IOCTL, ## f)#define IPW_DEBUG_STATE(f, a...) IPW_DEBUG(IPW_DL_STATE | IPW_DL_ASSOC | IPW_DL_INFO, f, ## a)#define IPW_DEBUG_ASSOC(f, a...) IPW_DEBUG(IPW_DL_ASSOC | IPW_DL_INFO, f, ## a)enum { IPW_HW_STATE_DISABLED = 1, IPW_HW_STATE_ENABLED = 0};struct ssid_context { char ssid[IW_ESSID_MAX_SIZE + 1]; int ssid_len; unsigned char bssid[ETH_ALEN]; int port_type; int channel;};extern const char *port_type_str[];extern const char *band_str[];#define NUMBER_OF_BD_PER_COMMAND_PACKET 1#define NUMBER_OF_BD_PER_DATA_PACKET 2#define IPW_MAX_BDS 6#define NUMBER_OF_OVERHEAD_BDS_PER_PACKETR 2#define NUMBER_OF_BDS_TO_LEAVE_FOR_COMMANDS 1#define REQUIRED_SPACE_IN_RING_FOR_COMMAND_PACKET \ (IPW_BD_QUEUE_W_R_MIN_SPARE + NUMBER_OF_BD_PER_COMMAND_PACKET)struct bd_status { union { struct { u8 nlf:1, txType:2, intEnabled:1, reserved:4; } fields; u8 field; } info;} __attribute__ ((packed));struct ipw2100_bd { u32 host_addr; u32 buf_length; struct bd_status status; /* number of fragments for frame (should be set only for * 1st TBD) */ u8 num_fragments; u8 reserved[6];} __attribute__ ((packed));#define IPW_BD_QUEUE_LENGTH(n) (1<<n)#define IPW_BD_ALIGNMENT(L) (L*sizeof(struct ipw2100_bd))#define IPW_BD_STATUS_TX_FRAME_802_3 0x00#define IPW_BD_STATUS_TX_FRAME_NOT_LAST_FRAGMENT 0x01#define IPW_BD_STATUS_TX_FRAME_COMMAND 0x02#define IPW_BD_STATUS_TX_FRAME_802_11 0x04#define IPW_BD_STATUS_TX_INTERRUPT_ENABLE 0x08struct ipw2100_bd_queue { /* driver (virtual) pointer to queue */ struct ipw2100_bd *drv; /* firmware (physical) pointer to queue */ dma_addr_t nic; /* Length of phy memory allocated for BDs */ u32 size; /* Number of BDs in queue (and in array) */ u32 entries; /* Number of available BDs (invalid for NIC BDs) */ u32 available; /* Offset of oldest used BD in array (next one to * check for completion) */ u32 oldest; /* Offset of next available (unused) BD */ u32 next;};#define RX_QUEUE_LENGTH 256#define TX_QUEUE_LENGTH 256#define HW_QUEUE_LENGTH 256#define TX_PENDED_QUEUE_LENGTH (TX_QUEUE_LENGTH / NUMBER_OF_BD_PER_DATA_PACKET)#define STATUS_TYPE_MASK 0x0000000f#define COMMAND_STATUS_VAL 0#define STATUS_CHANGE_VAL 1#define P80211_DATA_VAL 2#define P8023_DATA_VAL 3#define HOST_NOTIFICATION_VAL 4#define IPW2100_RSSI_TO_DBM (-98)struct ipw2100_status { u32 frame_size; u16 status_fields; u8 flags;#define IPW_STATUS_FLAG_DECRYPTED (1<<0)#define IPW_STATUS_FLAG_WEP_ENCRYPTED (1<<1)#define IPW_STATUS_FLAG_CRC_ERROR (1<<2) u8 rssi;} __attribute__ ((packed));struct ipw2100_status_queue { /* driver (virtual) pointer to queue */ struct ipw2100_status *drv; /* firmware (physical) pointer to queue */ dma_addr_t nic; /* Length of phy memory allocated for BDs */ u32 size;};#define HOST_COMMAND_PARAMS_REG_LEN 100#define CMD_STATUS_PARAMS_REG_LEN 3#define IPW_WPA_CAPABILITIES 0x1#define IPW_WPA_LISTENINTERVAL 0x2#define IPW_WPA_AP_ADDRESS 0x4#define IPW_MAX_VAR_IE_LEN ((HOST_COMMAND_PARAMS_REG_LEN - 4) * sizeof(u32))struct ipw2100_wpa_assoc_frame { u16 fixed_ie_mask; struct { u16 capab_info; u16 listen_interval; u8 current_ap[ETH_ALEN]; } fixed_ies; u32 var_ie_len; u8 var_ie[IPW_MAX_VAR_IE_LEN];};#define IPW_BSS 1#define IPW_MONITOR 2#define IPW_IBSS 3/** * @struct _tx_cmd - HWCommand * @brief H/W command structure. */struct ipw2100_cmd_header { u32 host_command_reg; u32 host_command_reg1; u32 sequence; u32 host_command_len_reg; u32 host_command_params_reg[HOST_COMMAND_PARAMS_REG_LEN]; u32 cmd_status_reg; u32 cmd_status_params_reg[CMD_STATUS_PARAMS_REG_LEN]; u32 rxq_base_ptr; u32 rxq_next_ptr; u32 rxq_host_ptr; u32 txq_base_ptr; u32 txq_next_ptr; u32 txq_host_ptr; u32 tx_status_reg; u32 reserved; u32 status_change_reg; u32 reserved1[3]; u32 *ordinal1_ptr; u32 *ordinal2_ptr;} __attribute__ ((packed));struct ipw2100_data_header { u32 host_command_reg; u32 host_command_reg1; u8 encrypted; // BOOLEAN in win! TRUE if frame is enc by driver u8 needs_encryption; // BOOLEAN in win! TRUE if frma need to be enc in NIC u8 wep_index; // 0 no key, 1-4 key index, 0xff immediate key u8 key_size; // 0 no imm key, 0x5 64bit encr, 0xd 128bit encr, 0x10 128bit encr and 128bit IV u8 key[16]; u8 reserved[10]; // f/w reserved u8 src_addr[ETH_ALEN]; u8 dst_addr[ETH_ALEN]; u16 fragment_size;} __attribute__ ((packed));/* Host command data structure */struct host_command { u32 host_command; // COMMAND ID u32 host_command1; // COMMAND ID u32 host_command_sequence; // UNIQUE COMMAND NUMBER (ID) u32 host_command_length; // LENGTH u32 host_command_parameters[HOST_COMMAND_PARAMS_REG_LEN]; // COMMAND PARAMETERS} __attribute__ ((packed));typedef enum { POWER_ON_RESET, EXIT_POWER_DOWN_RESET, SW_RESET, EEPROM_RW, SW_RE_INIT} ipw2100_reset_event;enum { COMMAND = 0xCAFE, DATA, RX};struct ipw2100_tx_packet { int type; int index; union { struct { /* COMMAND */ struct ipw2100_cmd_header *cmd; dma_addr_t cmd_phys; } c_struct; struct { /* DATA */ struct ipw2100_data_header *data; dma_addr_t data_phys; struct ieee80211_txb *txb; } d_struct; } info; int jiffy_start; struct list_head list;};struct ipw2100_rx_packet { struct ipw2100_rx *rxp; dma_addr_t dma_addr; int jiffy_start; struct sk_buff *skb; struct list_head list;};#define FRAG_DISABLED (1<<31)#define RTS_DISABLED (1<<31)#define MAX_RTS_THRESHOLD 2304U#define MIN_RTS_THRESHOLD 1U#define DEFAULT_RTS_THRESHOLD 1000U#define DEFAULT_BEACON_INTERVAL 100U#define DEFAULT_SHORT_RETRY_LIMIT 7U#define DEFAULT_LONG_RETRY_LIMIT 4Ustruct ipw2100_ordinals { u32 table1_addr; u32 table2_addr; u32 table1_size; u32 table2_size;};/* Host Notification header */struct ipw2100_notification { u32 hnhdr_subtype; /* type of host notification */ u32 hnhdr_size; /* size in bytes of data or number of entries, if table. Does NOT include header */} __attribute__ ((packed));#define MAX_KEY_SIZE 16#define MAX_KEYS 8#define IPW2100_WEP_ENABLE (1<<1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -