aboutsummaryrefslogtreecommitdiff
path: root/at76c503.h
diff options
context:
space:
mode:
Diffstat (limited to 'at76c503.h')
-rw-r--r--at76c503.h180
1 files changed, 148 insertions, 32 deletions
diff --git a/at76c503.h b/at76c503.h
index b2b03a0..8af15aa 100644
--- a/at76c503.h
+++ b/at76c503.h
@@ -1,26 +1,22 @@
-/* -*- linux-c -*- */
/*
- * Copyright (c) 2002 - 2003 Oliver Kurth
- * (c) 2003 - 2004 Jörg Albert <joerg.albert@gmx.de>
+ * Copyright (c) 2002,2003 Oliver Kurth
+ * (c) 2003,2004 Jörg Albert <joerg.albert@gmx.de>
+ * (c) 2007 Guido Guenther <agx@sigxcpu.org>
*
- * 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 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:
+ * This driver was based on information from the Sourceforge driver
+ * released and maintained by Atmel:
*
* http://sourceforge.net/projects/atmelwlandriver/
*
- * Although 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/
+ * Although 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!
*/
#ifndef _AT76C503_H
@@ -29,8 +25,7 @@
#include <net/ieee80211.h>
/* current driver version */
-#define DRIVER_VERSION "0.14dev"
-
+#define DRIVER_VERSION "0.15dev"
/* our private ioctl's */
/* set preamble length*/
@@ -137,15 +132,6 @@
#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 7
-#define BOARDTYPE_505AMX_RFMD 8
-
struct hwcfg_r505 {
u8 cr39_values[14];
u8 reserved1[14];
@@ -379,6 +365,11 @@ struct mib_mdomain {
u8 channel_list[14]; /* 0 for invalid channels */
} __attribute__ ((packed));
+static u8 snapsig[] = {0xaa, 0xaa, 0x03};
+/* RFC 1042 encapsulates Ethernet frames in 802.2 SNAP (0xaa, 0xaa, 0x03) with
+ * a SNAP OID of 0 (0x00, 0x00, 0x00) */
+static u8 rfc1042sig[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
+
/* states in infrastructure mode */
enum infra_state {
INIT,
@@ -396,6 +387,21 @@ enum infra_state {
MONITORING,
};
+#define KEVENT_CTRL_HALT 1
+#define KEVENT_NEW_BSS 2
+#define KEVENT_SET_PROMISC 3
+#define KEVENT_MGMT_TIMEOUT 4
+#define KEVENT_SCAN 5
+#define KEVENT_JOIN 6
+#define KEVENT_STARTIBSS 7
+#define KEVENT_SUBMIT_RX 8
+#define KEVENT_RESTART 9 /* restart the device */
+#define KEVENT_ASSOC_DONE 10 /* execute the power save settings:
+ listen interval, pm mode, assoc id */
+#define KEVENT_EXTERNAL_FW 11
+#define KEVENT_INTERNAL_FW 12
+#define KEVENT_RESET_DEVICE 13
+
/* a description of a regulatory domain and the allowed channels */
struct reg_domain {
u16 code;
@@ -408,7 +414,6 @@ struct reg_domain {
(by iwlist ?) after the device started, because all entries from
other channels than the one the device locks on get removed, too */
#define BSS_LIST_TIMEOUT (120*HZ)
-
/* struct to store BSS info found during scan */
#define BSS_LIST_MAX_RATE_LEN 32 /* 32 rates should be enough ... */
@@ -451,7 +456,6 @@ struct rx_data_buf {
};
#define NR_RX_DATA_BUF 8
-
/* how often do we try to submit a rx urb until giving up */
#define NR_SUBMIT_RX_TRIES 8
@@ -636,8 +640,8 @@ typedef struct p80211msg
uint8_t devname[IFNAMSIZ];
} __attribute__ ((packed)) p80211msg_t;
-#define P80211ENUM_msgitem_status_data_ok 0
-#define P80211ENUM_msgitem_status_no_value 1
+#define P80211ENUM_msgitem_status_data_ok 0
+#define P80211ENUM_msgitem_status_no_value 1
#define P80211ENUM_truth_false 0
#define P80211ENUM_truth_true 1
@@ -670,6 +674,118 @@ typedef struct p80211msg_lnxind_wlansniffrm
p80211item_uint32_t frmlen;
} __attribute__ ((packed)) p80211msg_lnxind_wlansniffrm_t;
+#define BEACON_MAX_DATA_LENGTH 1500
+/* beacon in ieee80211_hdr_3addr.payload */
+struct ieee802_11_beacon_data {
+ u8 timestamp[8]; /* TSFTIMER */
+ __le16 beacon_interval; /* Kms between TBTTs (Target Beacon Transmission Times) */
+ __le16 capability_information;
+ u8 data[BEACON_MAX_DATA_LENGTH]; /* contains: SSID (tag,length,value),
+ Supported Rates (tlv), channel */
+} __attribute__ ((packed));
+
+/* disassoc frame in ieee80211_hdr_3addr.payload */
+struct ieee802_11_disassoc_frame {
+ __le16 reason;
+} __attribute__ ((packed));
+#define DISASSOC_FRAME_SIZE \
+ (AT76C503_TX_HDRLEN + IEEE802_11_MGMT_HEADER_SIZE +\
+ sizeof(struct ieee802_11_disassoc_frame))
+
+/* assoc request in ieee80211_hdr_3addr.payload */
+struct ieee802_11_assoc_req {
+ __le16 capability;
+ __le16 listen_interval;
+ u8 data[1]; /* variable number of bytes for SSID
+ and supported rates (tlv coded) */
+};
+/* the maximum size of an AssocReq packet */
+#define ASSOCREQ_MAX_SIZE \
+ (AT76C503_TX_HDRLEN + IEEE802_11_MGMT_HEADER_SIZE +\
+ offsetof(struct ieee802_11_assoc_req,data) +\
+ 1+1+IW_ESSID_MAX_SIZE + 1+1+4)
+
+/* reassoc request in ieee80211_hdr_3addr.payload */
+struct ieee802_11_reassoc_req {
+ __le16 capability;
+ __le16 listen_interval;
+ u8 curr_ap[ETH_ALEN]; /* the bssid of the AP we are
+ currently associated to */
+ u8 data[1]; /* variable number of bytes for SSID
+ and supported rates (tlv coded) */
+} __attribute__ ((packed));
+
+/* the maximum size of an AssocReq packet */
+#define REASSOCREQ_MAX_SIZE \
+ (AT76C503_TX_HDRLEN + IEEE802_11_MGMT_HEADER_SIZE +\
+ offsetof(struct ieee802_11_reassoc_req,data) +\
+ 1+1+IW_ESSID_MAX_SIZE + 1+1+4)
+
+/* assoc/reassoc response */
+struct ieee802_11_assoc_resp {
+ __le16 capability;
+ __le16 status;
+ __le16 assoc_id;
+ u8 data[1]; /* variable number of bytes for
+ supported rates (tlv coded) */
+} __attribute__ ((packed));
+
+/* auth. request/response in ieee80211_hdr_3addr.payload */
+struct ieee802_11_auth_frame {
+ __le16 algorithm;
+ __le16 seq_nr;
+ __le16 status;
+ u8 challenge[0];
+} __attribute__ ((packed));
+/* for shared secret auth, add the challenge text size */
+#define AUTH_FRAME_SIZE \
+ (AT76C503_TX_HDRLEN + IEEE802_11_MGMT_HEADER_SIZE +\
+ sizeof(struct ieee802_11_auth_frame))
+
+/* deauth frame in ieee80211_hdr_3addr.payload */
+struct ieee802_11_deauth_frame {
+ __le16 reason;
+} __attribute__ ((packed));
+#define DEAUTH_FRAME_SIZE \
+ (AT76C503_TX_HDRLEN + IEEE802_11_MGMT_HEADER_SIZE +\
+ sizeof(struct ieee802_11_disauth_frame))
+
+/* how often do we re-try these packets ? */
+#define AUTH_RETRIES 3
+#define ASSOC_RETRIES 3
+#define DISASSOC_RETRIES 3
+
+/* the beacon timeout in infra mode when we are connected (in seconds) */
+#define BEACON_TIMEOUT 10
+/* the interval in ticks we poll if scan is completed */
+#define SCAN_POLL_INTERVAL (HZ/4)
+
+#define DEF_RTS_THRESHOLD 1536
+#define DEF_FRAG_THRESHOLD 1536
+#define DEF_SHORT_RETRY_LIMIT 8
+#define DEF_CHANNEL 10
+
+#define MAX_RTS_THRESHOLD (MAX_FRAG_THRESHOLD + 1)
+
+/* The frequency of each channel in MHz */
+static const long channel_frequency[] = {
+ 2412, 2417, 2422, 2427, 2432, 2437, 2442,
+ 2447, 2452, 2457, 2462, 2467, 2472, 2484
+};
+#define NUM_CHANNELS ( sizeof(channel_frequency) / sizeof(channel_frequency[0]) )
+
+/* the broadcast address */
+static const u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};
+static const u8 off_addr[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+/* the supported rates of this hardware, bit7 marks a basic rate */
+static const u8 hw_rates[4] = {0x82,0x84,0x0b,0x16};
+
+/* the max padding size for tx in bytes (see calc_padding) */
+#define MAX_PADDING_SIZE 53
+
+/* the size of the ieee802.11 header (excl. the at76c503 tx header) */
+#define IEEE802_11_MGMT_HEADER_SIZE offsetof(struct ieee80211_hdr_3addr, payload)
+
/* 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 */