aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorehovland <ehovland>2006-07-17 21:46:16 +0000
committerehovland <ehovland>2006-07-17 21:46:16 +0000
commit965e8e124304173820436e821585c8291e694883 (patch)
treeece271ea8c1d18265e9d735d473b058614dc2314
parent6b6df62e20f276c3d71a64cf3c6e089a0b0bc810 (diff)
Bump the version from 0.12beta23 to 0.12.0. This is done since theversion_0_12_0
driver in its current state is as close to a final 0.12 version as it is ever goinng to get.
-rw-r--r--at76c503.h265
1 files changed, 148 insertions, 117 deletions
diff --git a/at76c503.h b/at76c503.h
index 0d36bbb..4584f10 100644
--- a/at76c503.h
+++ b/at76c503.h
@@ -1,5 +1,6 @@
/* -*- linux-c -*- */
-/*
+/* $Id: at76c503.h,v 1.33.2.1 2006/07/17 21:46:16 ehovland Exp $
+ *
* Copyright (c) 2002 - 2003 Oliver Kurth
* (c) 2003 - 2004 Jörg Albert <joerg.albert@gmx.de>
*
@@ -13,8 +14,8 @@
*
* http://sourceforge.net/projects/atmelwlandriver/
*
- * Although the code was completely re-written,
- * it would have been impossible without Atmel's decision to
+ * 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!
*
@@ -26,11 +27,58 @@
#ifndef _AT76C503_H
#define _AT76C503_H
-#include <net/ieee80211.h>
-
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/wireless.h>
+#if WIRELESS_EXT > 12
+#include <net/iw_handler.h>
+#endif
+#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 "0.14dev"
-
+#define DRIVER_VERSION "v0.12.0" VERSION_APPEND
+
+/* Workqueue / task queue backwards compatibility stuff */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
+#include <linux/workqueue.h>
+#else
+#include <linux/tqueue.h>
+#define work_struct tq_struct
+#define INIT_WORK(a,b,c) INIT_TQUEUE(a,b,c)
+#define schedule_work(w) schedule_task(w)
+#define flush_scheduled_work() flush_scheduled_tasks()
+#endif
+
+/* Backward compatibility for free_netdev() */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+#ifndef HAVE_FREE_NETDEV
+#define free_netdev(dev) kfree(dev)
+#endif
+#endif
+
+/* this wasn't even defined in early 2.4.x kernels ... */
+#ifndef SIOCIWFIRSTPRIV
+# define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
+#endif
+
+/* WIRELESS_EXT 8 does not provide iw_point ! */
+#if WIRELESS_EXT <= 8
+/* this comes from <linux/wireless.h> */
+#undef IW_MAX_SPY
+#define IW_MAX_SPY 0
+#endif
/* our private ioctl's */
/* set preamble length*/
@@ -48,6 +96,20 @@
/* 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
@@ -104,7 +166,7 @@
#define TX_RATE_11MBIT 3
#define TX_RATE_AUTO 4
-/* power management modes */
+/* power management modi */
#define PM_ACTIVE 1
#define PM_SAVE 2
#define PM_SMART_SAVE 3
@@ -144,7 +206,6 @@
#define BOARDTYPE_505_RFMD 5
#define BOARDTYPE_505_RFMD_2958 6
#define BOARDTYPE_505A_RFMD_2958 7
-#define BOARDTYPE_505AMX_RFMD 8
struct hwcfg_r505 {
u8 cr39_values[14];
@@ -179,6 +240,8 @@ struct hwcfg_intersil {
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)
@@ -187,31 +250,31 @@ struct at76c503_card_config{
u8 promiscuous_mode;
u8 short_retry_limit;
u8 encryption_type;
- __le16 rts_threshold;
- __le16 fragmentation_threshold; // 256..2346
+ 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_LEN];
+ u8 wep_default_key_value[4][WEP_KEY_SIZE];
u8 ssid_len;
u8 short_preamble;
- __le16 beacon_period;
+ u16 beacon_period;
} __attribute__ ((packed));
struct at76c503_command{
u8 cmd;
u8 reserved;
- __le16 size;
+ 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 {
- __le16 wlength;
+ u16 wlength;
u8 rx_rate;
u8 newbss;
u8 fragmentation;
@@ -219,18 +282,18 @@ struct at76c503_rx_buffer {
u8 link_quality;
u8 noise_level;
u8 rx_time[4];
- u8 packet[IEEE80211_FRAME_LEN + IEEE80211_FCS_LEN];
+ 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 {
- __le16 wlength;
+ u16 wlength;
u8 tx_rate;
u8 padding;
u8 reserved[4];
- u8 packet[IEEE80211_FRAME_LEN + IEEE80211_FCS_LEN];
+ u8 packet[IEEE802_11_MAX_FRAME_LEN];
} __attribute__ ((packed));
/* defines for scan_type below */
@@ -242,9 +305,9 @@ struct at76c503_start_scan {
u8 essid[32];
u8 scan_type;
u8 channel;
- __le16 probe_delay;
- __le16 min_channel_time;
- __le16 max_channel_time;
+ u16 probe_delay;
+ u16 min_channel_time;
+ u16 max_channel_time;
u8 essid_size;
u8 international_scan;
} __attribute__ ((packed));
@@ -263,7 +326,7 @@ struct at76c503_join {
u8 essid[32];
u8 bss_type;
u8 channel;
- __le16 timeout;
+ u16 timeout;
u8 essid_size;
u8 reserved;
} __attribute__ ((packed));
@@ -296,20 +359,20 @@ struct mib_mac_addr {
} __attribute__ ((packed));
struct mib_mac {
- __le32 max_tx_msdu_lifetime;
- __le32 max_rx_lifetime;
- __le16 frag_threshold;
- __le16 rts_threshold;
- __le16 cwmin;
- __le16 cwmax;
+ 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;
- __le16 probe_delay; /* delay before sending a ProbeReq in active scan, RO */
- __le16 min_channel_time;
- __le16 max_channel_time;
- __le16 listen_interval;
+ 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 */
@@ -317,11 +380,11 @@ struct mib_mac {
} __attribute__ ((packed));
struct mib_mac_mgmt {
- __le16 beacon_period;
- __le16 CFP_max_duration;
- __le16 medium_occupancy_limit;
- __le16 station_id; /* assoc id */
- __le16 ATIM_window;
+ u16 beacon_period;
+ u16 CFP_max_duration;
+ u16 medium_occupancy_limit;
+ u16 station_id; /* assoc id */
+ u16 ATIM_window;
u8 CFP_mode;
u8 privacy_option_implemented;
u8 DTIM_period;
@@ -344,21 +407,21 @@ struct mib_mac_wep {
u8 wep_default_key_id;
u8 wep_key_mapping_len;
u8 exclude_unencrypted;
- __le32 wep_icv_error_count;
- __le32 wep_excluded_count;
- u8 wep_default_keyvalue[WEP_KEYS][WEP_KEY_LEN];
+ u32 wep_icv_error_count;
+ u32 wep_excluded_count;
+ u8 wep_default_keyvalue[NR_WEP_KEYS][WEP_KEY_SIZE];
u8 encryption_level; /* 1 for 40bit, 2 for 104bit encryption */
} __attribute__ ((packed));
struct mib_phy {
- __le32 ed_threshold;
+ u32 ed_threshold;
- __le16 slot_time;
- __le16 sifs_time;
- __le16 preamble_length;
- __le16 plcp_header_length;
- __le16 mpdu_max_length;
- __le16 cca_mode_supported;
+ u16 slot_time;
+ u16 sifs_time;
+ u16 preamble_length;
+ u16 plcp_header_length;
+ u16 mpdu_max_length;
+ u16 cca_mode_supported;
u8 operation_rate_set[4];
u8 channel_id;
@@ -425,7 +488,7 @@ struct bss_info{
u16 capa; /* the capabilities of the BSS (in original endianess -
we only check IEEE802_11 bits in it) */
u16 beacon_interval; /* the beacon interval in units of TU (1.024 ms)
- (in CPU endianess - we must calc. values from it) */
+ (in cpu endianess - we must calc. values from it) */
u8 rates[BSS_LIST_MAX_RATE_LEN]; /* supported rates (list of bytes:
(basic_rate ? 0x80 : 0) + rate/(500 Kbit/s); e.g.
x82,x84,x8b,x96 for basic rates 1,2,5.5,11 MBit/s) */
@@ -456,8 +519,8 @@ struct rx_data_buf {
#define NR_SUBMIT_RX_TRIES 8
struct at76c503 {
- struct usb_device *udev; /* USB device pointer */
- struct net_device *netdev; /* net device pointer */
+ struct usb_device *udev; /* save off the usb device pointer */
+ struct net_device *netdev; /* save off the net device pointer */
struct net_device_stats stats;
struct iw_statistics wstats;
struct usb_interface *interface; /* the interface for this device */
@@ -495,9 +558,9 @@ struct at76c503 {
/* the WEP stuff */
int wep_enabled; /* 1 if WEP is enabled */
int wep_key_id; /* key id to be used */
- u8 wep_keys[WEP_KEYS][WEP_KEY_LEN]; /* the four WEP keys,
- 5 or 13 bytes are used */
- u8 wep_keys_len[WEP_KEYS]; /* the length of the above keys */
+ u8 wep_keys[NR_WEP_KEYS][WEP_KEY_SIZE]; /* the four WEP keys,
+ 5 or 13 bytes are used */
+ u8 wep_keys_len[NR_WEP_KEYS]; /* the length of the above keys */
int channel;
int iw_mode;
@@ -527,7 +590,7 @@ struct at76c503 {
curr_bss and new_bss */
struct list_head bss_list; /* the list of bss we received beacons from */
struct timer_list bss_list_timer; /* a timer removing old entries from
- the bss_list. It must acquire bss_list_spinlock
+ the bss_list. It must aquire bss_list_spinlock
before and must not remove curr_bss nor
new_bss ! */
struct bss_info *curr_bss; /* if istate == AUTH, ASSOC, REASSOC, JOIN or CONN
@@ -541,20 +604,10 @@ struct at76c503 {
/* some data for infrastructure mode only */
spinlock_t mgmt_spinlock; /* this spinlock protects access to
- next_mgmt_bulk */
- spinlock_t istate_spinlock; /* this spinlock protects access to
- istate */
-
-
+ next_mgmt_bulk and istate */
struct at76c503_tx_buffer *next_mgmt_bulk; /* pending management msg to
send via bulk out */
enum infra_state istate;
- enum {
- SITE_SURVEY_IDLE,
- SITE_SURVEY_IN_PROGRESS,
- SITE_SURVEY_COMPLETED
- } site_survey_state;
- time_t last_survey;
struct timer_list restart_timer; /* the timer we use to delay the restart a bit */
@@ -570,8 +623,16 @@ struct at76c503 {
struct reg_domain const *domain; /* the description of the regulatory domain */
/* iwspy support */
+#if (WIRELESS_EXT > 15) || (IW_MAX_SPY > 0)
spinlock_t spy_spinlock;
+#if WIRELESS_EXT > 15
struct iw_spy_data spy_data;
+#else
+ int iwspy_nr; /* nr of valid entries below */
+ struct sockaddr iwspy_addr[IW_MAX_SPY];
+ struct iw_quality iwspy_stats[IW_MAX_SPY];
+#endif
+#endif
#if WIRELESS_EXT > 16
struct iw_public_data wireless_data;
@@ -609,8 +670,11 @@ struct at76c503 {
/* these point into a buffer managed by at76c503-xxx.o, no need to dealloc */
u8 *extfw; /* points to external firmware part, extfw_size bytes long */
u8 *intfw; /* points to internal firmware part, intfw_size bytes long */
- unsigned int device_unplugged:1;
- unsigned int netdev_registered:1;
+ struct usb_driver *calling_driver; /* the calling driver: at76c503-{rfmd,i3861,i3863,...} */
+ int flags; /* AT76C503A_UNPLUG signals at76c503a_stop()
+ that the device was unplugged
+ AT76C503A_NETDEV_REGISTERED signals that register_netdevice
+ xwas successfully called */
char obuf[2*256+1]; /* global debug output buffer to reduce stack usage */
char obuf_s[3*32]; /* small global debug output buffer to reduce stack usage */
struct set_mib_buffer mib_buf; /* global buffer for set_mib calls */
@@ -621,20 +685,21 @@ struct at76c503 {
use Prism header */
int monitor_scan_min_time;
int monitor_scan_max_time;
-
- int beacon_period; /* period of mgmt beacons */
- int beacons_received;
- unsigned long beacons_last_qual; /* last time we reset beacons_received = 0 */
};
+#define AT76C503A_UNPLUG 1
+#define AT76C503A_NETDEV_REGISTERED 2
+
/* Quasi-monitor mode defs (copied from <kernel>/drivers/net/wireless/orinoco.h) */
+#define WLAN_DEVNAMELEN_MAX 16
+
/* message data item for INT, BOUNDEDINT, ENUMINT */
typedef struct p80211item_uint32
{
- uint32_t did __attribute__ ((packed));
+ uint32_t did __attribute__ ((packed));
uint16_t status __attribute__ ((packed));
- uint16_t len __attribute__ ((packed));
+ uint16_t len __attribute__ ((packed));
uint32_t data __attribute__ ((packed));
} __attribute__ ((packed)) p80211item_uint32_t;
@@ -642,7 +707,7 @@ typedef struct p80211msg
{
uint32_t msgcode __attribute__ ((packed));
uint32_t msglen __attribute__ ((packed));
- uint8_t devname[IFNAMSIZ];
+ uint8_t devname[WLAN_DEVNAMELEN_MAX] __attribute__ ((packed));
} __attribute__ ((packed)) p80211msg_t;
#define P80211ENUM_msgitem_status_data_ok 0
@@ -666,7 +731,7 @@ typedef struct p80211msg_lnxind_wlansniffrm
{
uint32_t msgcode;
uint32_t msglen;
- uint8_t devname[IFNAMSIZ];
+ uint8_t devname[WLAN_DEVNAMELEN_MAX];
p80211item_uint32_t hosttime;
p80211item_uint32_t mactime;
p80211item_uint32_t channel;
@@ -679,47 +744,13 @@ typedef struct p80211msg_lnxind_wlansniffrm
p80211item_uint32_t frmlen;
} __attribute__ ((packed)) p80211msg_lnxind_wlansniffrm_t;
-/* at76_debug bits */
-#define DBG_PROGRESS 0x00000001 /* progress of scan-join-(auth-assoc)-connected */
-#define DBG_BSS_TABLE 0x00000002 /* show the bss table after scans */
-#define DBG_IOCTL 0x00000004 /* ioctl calls / settings */
-#define DBG_KEVENT 0x00000008 /* kevents */
-#define DBG_TX_DATA 0x00000010 /* tx header */
-#define DBG_TX_DATA_CONTENT 0x00000020 /* tx content */
-#define DBG_TX_MGMT 0x00000040
-#define DBG_RX_DATA 0x00000080 /* rx data header */
-#define DBG_RX_DATA_CONTENT 0x00000100 /* rx data content */
-#define DBG_RX_MGMT 0x00000200 /* rx mgmt header except beacon and probe responses */
-#define DBG_RX_BEACON 0x00000400 /* rx beacon */
-#define DBG_RX_CTRL 0x00000800 /* rx control */
-#define DBG_RX_MGMT_CONTENT 0x00001000 /* rx mgmt content */
-#define DBG_RX_FRAGS 0x00002000 /* rx data fragment handling */
-#define DBG_DEVSTART 0x00004000 /* fw download, device start */
-#define DBG_URB 0x00008000 /* rx urb status, ... */
-#define DBG_RX_ATMEL_HDR 0x00010000 /* the Atmel specific header of each rx packet */
-#define DBG_PROC_ENTRY 0x00020000 /* procedure entries and exits */
-#define DBG_PM 0x00040000 /* power management settings */
-#define DBG_BSS_MATCH 0x00080000 /* show why a certain bss did not match */
-#define DBG_PARAMS 0x00100000 /* show the configured parameters */
-#define DBG_WAIT_COMPLETE 0x00200000 /* show the wait_completion progress */
-#define DBG_RX_FRAGS_SKB 0x00400000 /* show skb header for incoming rx fragments */
-#define DBG_BSS_TABLE_RM 0x00800000 /* inform on removal of old bss table entries */
-#define DBG_MONITOR_MODE 0x01000000 /* debugs from monitor mode */
-#define DBG_MIB 0x02000000 /* dump all MIBs in startup_device */
-#define DBG_MGMT_TIMER 0x04000000 /* dump mgmt_timer ops */
-#define DBG_WE_EVENTS 0x08000000 /* dump wireless events */
-#define DBG_FW 0x10000000 /* firmware download */
-#define DBG_DFU 0x20000000 /* device firmware upgrade */
-
-#define DBG_DEFAULTS 0
-extern int at76_debug;
-
-/* Use our own dbg macro */
-#undef dbg
-#define dbg(bits, format, arg...) \
- do { \
- if (at76_debug & (bits)) \
- printk(KERN_DEBUG __FILE__ ": " format "\n" , ## arg);\
- } while (0)
+/* Function prototypes */
+
+int at76c503_do_probe(struct module *mod, struct usb_device *udev,
+ struct usb_driver *calling_driver,
+ u8 *fw_data, int fw_size, u32 board_type,
+ const char *netdev_name, void **devptr);
+
+void at76c503_delete_device(struct at76c503 *dev);
#endif /* _AT76C503_H */