📄 at76c503.h
字号:
/* -*- linux-c -*- *//* $Id: at76c503.h,v 1.37 2006/06/22 21:09:23 agx Exp $ * * Copyright (c) 2002 - 2003 Oliver Kurth * (c) 2003 - 2004 J鰎g Albert <joerg.albert@gmx.de> * * This program 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. * * This driver was based on information from the Sourceforge driver * released and maintained by Atmel: * * http://sourceforge.net/projects/atmelwlandriver/ * * althrough the code was completely re-written. * It would have been impossible without Atmel's decision to * release an Open Source driver (unfortunately the firmware was * kept binary only). Thanks for that decision to Atmel! * * For the latest version of this driver, mailinglists * and other info, please check * http://at76c503a.berlios.de/ */#ifndef _AT76C503_H#define _AT76C503_H#include <linux/netdevice.h>#include <linux/etherdevice.h>#include <linux/wireless.h>#include <net/iw_handler.h>#include <linux/version.h>#include "at76_ieee802_11.h" /* we need some constants here */#ifndef COMPILE_FIRMWARE_INTO_DRIVER# define CONFIG_AT76C503_FIRMWARE_DOWNLOAD# define VERSION_APPEND "-fw_dwl"#else# ifdef CONFIG_AT76C503_FIRMWARE_DOWNLOAD# undef CONFIG_AT76C503_FIRMWARE_DOWNLOAD# endif# define VERSION_APPEND "-static"#endif /* current driver version */#define DRIVER_VERSION "v0.13" VERSION_APPEND#include <linux/workqueue.h>/* this wasn't even defined in early 2.4.x kernels ... */#ifndef SIOCIWFIRSTPRIV# define SIOCIWFIRSTPRIV SIOCDEVPRIVATE#endif/* our private ioctl's *//* set preamble length*/#define PRIV_IOCTL_SET_SHORT_PREAMBLE (SIOCIWFIRSTPRIV + 0x0)/* set debug parameter */#define PRIV_IOCTL_SET_DEBUG (SIOCIWFIRSTPRIV + 0x2)/* set power save mode (incl. the Atmel proprietary smart save mode */#define PRIV_IOCTL_SET_POWERSAVE_MODE (SIOCIWFIRSTPRIV + 0x4)/* set min and max channel times for scan */#define PRIV_IOCTL_SET_SCAN_TIMES (SIOCIWFIRSTPRIV + 0x6)/* set scan mode */#define PRIV_IOCTL_SET_SCAN_MODE (SIOCIWFIRSTPRIV + 0x8)/* set international roaming */#define PRIV_IOCTL_SET_INTL_ROAMING (SIOCIWFIRSTPRIV + 0x10)/* set monitor mode */#define PRIV_IOCTL_SET_MONITOR_MODE (SIOCIWFIRSTPRIV + 0x12)#ifndef ETH_P_ECONET#define ETH_P_ECONET 0x0018 /* needed for 2.2.x kernels */#endif#define ETH_P_80211_RAW (ETH_P_ECONET + 1)#ifndef ARPHRD_IEEE80211#define ARPHRD_IEEE80211 801 /* kernel 2.4.6 */#endif#ifndef ARPHRD_IEEE80211_PRISM /* kernel 2.4.18 */#define ARPHRD_IEEE80211_PRISM 802#endif#define DEVICE_VENDOR_REQUEST_OUT 0x40#define DEVICE_VENDOR_REQUEST_IN 0xc0#define INTERFACE_VENDOR_REQUEST_OUT 0x41#define INTERFACE_VENDOR_REQUEST_IN 0xc1#define CLASS_REQUEST_OUT 0x21#define CLASS_REQUEST_IN 0xa1#define CMD_STATUS_IDLE 0x00#define CMD_STATUS_COMPLETE 0x01#define CMD_STATUS_UNKNOWN 0x02#define CMD_STATUS_INVALID_PARAMETER 0x03#define CMD_STATUS_FUNCTION_NOT_SUPPORTED 0x04#define CMD_STATUS_TIME_OUT 0x07#define CMD_STATUS_IN_PROGRESS 0x08#define CMD_STATUS_HOST_FAILURE 0xff#define CMD_STATUS_SCAN_FAILED 0xf0/* answers to get op mode */#define OPMODE_NONE 0x00#define OPMODE_NORMAL_NIC_WITH_FLASH 0x01#define OPMODE_HW_CONFIG_MODE 0x02#define OPMODE_DFU_MODE_WITH_FLASH 0x03#define OPMODE_NORMAL_NIC_WITHOUT_FLASH 0x04#define CMD_SET_MIB 0x01#define CMD_GET_MIB 0x02#define CMD_SCAN 0x03#define CMD_JOIN 0x04#define CMD_START_IBSS 0x05#define CMD_RADIO 0x06#define CMD_STARTUP 0x0B#define CMD_GETOPMODE 0x33#define MIB_LOCAL 0x01#define MIB_MAC_ADD 0x02#define MIB_MAC 0x03#define MIB_MAC_MGMT 0x05#define MIB_MAC_WEP 0x06#define MIB_PHY 0x07#define MIB_FW_VERSION 0x08#define MIB_MDOMAIN 0x09#define ADHOC_MODE 1#define INFRASTRUCTURE_MODE 2/* values for struct mib_local, field preamble_type */#define PREAMBLE_TYPE_SHORT 1#define PREAMBLE_TYPE_LONG 0/* values for tx_rate */#define TX_RATE_1MBIT 0#define TX_RATE_2MBIT 1#define TX_RATE_5_5MBIT 2#define TX_RATE_11MBIT 3#define TX_RATE_AUTO 4/* power management modi */#define PM_ACTIVE 1#define PM_SAVE 2#define PM_SMART_SAVE 3/* international roaming state */#define IR_OFF 0#define IR_ON 1/* monitor mode - param of private ioctl */#define MM_OFF 0#define MM_ON 1#define MM_ON_NO_PRISM 2/* offsets into the MIBs we use to configure the device */#define TX_AUTORATE_FALLBACK_OFFSET offsetof(struct mib_local,txautorate_fallback)#define FRAGMENTATION_OFFSET offsetof(struct mib_mac,frag_threshold)#define PREAMBLE_TYPE_OFFSET offsetof(struct mib_local,preamble_type)#define RTS_OFFSET offsetof(struct mib_mac, rts_threshold) /* valid only for rfmd and 505 !*/#define IBSS_CHANGE_OK_OFFSET offsetof(struct mib_mac_mgmt, ibss_change)#define IROAMING_IMPL_OFFSET offsetof(struct mib_mac_mgmt, multi_domain_capability_implemented)#define IROAMING_OFFSET \ offsetof(struct mib_mac_mgmt, multi_domain_capability_enabled)/* the AssocID */#define STATION_ID_OFFSET offsetof(struct mib_mac_mgmt, station_id)#define POWER_MGMT_MODE_OFFSET offsetof(struct mib_mac_mgmt, power_mgmt_mode)#define LISTEN_INTERVAL_OFFSET offsetof(struct mib_mac, listen_interval)#define PRIVACY_OPT_IMPL offsetof(struct mib_mac_mgmt, privacy_option_implemented)#define BOARDTYPE_503_INTERSIL_3861 1#define BOARDTYPE_503_INTERSIL_3863 2#define BOARDTYPE_503_RFMD 3#define BOARDTYPE_503_RFMD_ACC 4#define BOARDTYPE_505_RFMD 5#define BOARDTYPE_505_RFMD_2958 6#define BOARDTYPE_505A_RFMD_2958 7struct hwcfg_r505 { u8 cr39_values[14]; u8 reserved1[14]; u8 bb_cr[14]; u8 pidvid[4]; u8 mac_addr[ETH_ALEN]; u8 regulatory_domain; u8 reserved2[14]; u8 cr15_values[14]; u8 reserved3[3];} __attribute__ ((packed));struct hwcfg_rfmd { u8 cr20_values[14]; u8 cr21_values[14]; u8 bb_cr[14]; u8 pidvid[4]; u8 mac_addr[ETH_ALEN]; u8 regulatory_domain; u8 low_power_values[14]; u8 normal_power_values[14]; u8 reserved1[3]; } __attribute__ ((packed));struct hwcfg_intersil { u8 mac_addr[ETH_ALEN]; u8 cr31_values[14]; u8 cr58_values[14]; u8 pidvid[4]; u8 regulatory_domain; u8 reserved[1];} __attribute__ ((packed));#define WEP_KEY_SIZE 13#define NR_WEP_KEYS 4#define WEP_SMALL_KEY_LEN (40/8)#define WEP_LARGE_KEY_LEN (104/8)struct at76c503_card_config{ u8 exclude_unencrypted; u8 promiscuous_mode; u8 short_retry_limit; u8 encryption_type; u16 rts_threshold; u16 fragmentation_threshold; // 256..2346 u8 basic_rate_set[4]; u8 auto_rate_fallback; //0,1 u8 channel; u8 privacy_invoked; u8 wep_default_key_id; // 0..3 u8 current_ssid[32]; u8 wep_default_key_value[4][WEP_KEY_SIZE]; u8 ssid_len; u8 short_preamble; u16 beacon_period;} __attribute__ ((packed));struct at76c503_command{ u8 cmd; u8 reserved; u16 size;} __attribute__ ((packed));/* the length of the Atmel firmware specific rx header before IEEE 802.11 starts */#define AT76C503_RX_HDRLEN offsetof(struct at76c503_rx_buffer, packet)struct at76c503_rx_buffer { u16 wlength; u8 rx_rate; u8 newbss; u8 fragmentation; u8 rssi; u8 link_quality; u8 noise_level; u8 rx_time[4]; u8 packet[IEEE802_11_MAX_FRAME_LEN];} __attribute__ ((packed));/* the length of the Atmel firmware specific tx header before IEEE 802.11 starts */#define AT76C503_TX_HDRLEN offsetof(struct at76c503_tx_buffer, packet)struct at76c503_tx_buffer { u16 wlength; u8 tx_rate; u8 padding; u8 reserved[4]; u8 packet[IEEE802_11_MAX_FRAME_LEN];} __attribute__ ((packed));/* defines for scan_type below */#define SCAN_TYPE_ACTIVE 0#define SCAN_TYPE_PASSIVE 1struct at76c503_start_scan { u8 bssid[ETH_ALEN]; u8 essid[32]; u8 scan_type; u8 channel; u16 probe_delay; u16 min_channel_time; u16 max_channel_time; u8 essid_size; u8 international_scan;} __attribute__ ((packed));struct at76c503_start_bss { u8 bssid[ETH_ALEN]; u8 essid[32]; u8 bss_type; u8 channel; u8 essid_size; u8 reserved[3];} __attribute__ ((packed));struct at76c503_join { u8 bssid[ETH_ALEN]; u8 essid[32]; u8 bss_type; u8 channel; u16 timeout; u8 essid_size; u8 reserved;} __attribute__ ((packed));struct set_mib_buffer { u8 type; u8 size; u8 index; u8 reserved; u8 data[72];} __attribute__ ((packed));struct mib_local { u16 reserved0; u8 beacon_enable; u8 txautorate_fallback; u8 reserved1; u8 ssid_size; u8 promiscuous_mode; u16 reserved2; u8 preamble_type; u16 reserved3;} __attribute__ ((packed));struct mib_mac_addr { u8 mac_addr[ETH_ALEN]; u8 res[2]; /* ??? */ u8 group_addr[4][ETH_ALEN]; u8 group_addr_status[4];} __attribute__ ((packed));struct mib_mac { u32 max_tx_msdu_lifetime; u32 max_rx_lifetime; u16 frag_threshold; u16 rts_threshold; u16 cwmin; u16 cwmax; u8 short_retry_time; u8 long_retry_time; u8 scan_type; /* active or passive */ u8 scan_channel; u16 probe_delay; /* delay before sending a ProbeReq in active scan, RO */ u16 min_channel_time; u16 max_channel_time; u16 listen_interval; u8 desired_ssid[32]; u8 desired_bssid[ETH_ALEN]; u8 desired_bsstype; /* ad-hoc or infrastructure */ u8 reserved2;} __attribute__ ((packed));struct mib_mac_mgmt { u16 beacon_period; u16 CFP_max_duration; u16 medium_occupancy_limit; u16 station_id; /* assoc id */ u16 ATIM_window;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -