Merge branch 'master'
[deliverable/linux.git] / drivers / net / wireless / orinoco.h
CommitLineData
1da177e4
LT
1/* orinoco.h
2 *
3 * Common definitions to all pieces of the various orinoco
4 * drivers
5 */
6
7#ifndef _ORINOCO_H
8#define _ORINOCO_H
9
acc4b985 10#define DRIVER_VERSION "0.15rc3"
1da177e4 11
1da177e4
LT
12#include <linux/netdevice.h>
13#include <linux/wireless.h>
343c686c 14#include <net/iw_handler.h>
1da177e4
LT
15#include <linux/version.h>
16
17#include "hermes.h"
18
19/* To enable debug messages */
20//#define ORINOCO_DEBUG 3
21
22#define WIRELESS_SPY // enable iwspy support
23
16739b06
CH
24#define MAX_SCAN_LEN 4096
25
1da177e4
LT
26#define ORINOCO_MAX_KEY_SIZE 14
27#define ORINOCO_MAX_KEYS 4
28
29struct orinoco_key {
d133ae4c 30 __le16 len; /* always stored as little-endian */
1da177e4
LT
31 char data[ORINOCO_MAX_KEY_SIZE];
32} __attribute__ ((packed));
33
95dd91fb
CH
34struct header_struct {
35 /* 802.3 */
36 u8 dest[ETH_ALEN];
37 u8 src[ETH_ALEN];
d133ae4c 38 __be16 len;
95dd91fb
CH
39 /* 802.2 */
40 u8 dsap;
41 u8 ssap;
42 u8 ctrl;
43 /* SNAP */
44 u8 oui[3];
d133ae4c 45 unsigned short ethertype;
95dd91fb
CH
46} __attribute__ ((packed));
47
1da177e4
LT
48typedef enum {
49 FIRMWARE_TYPE_AGERE,
50 FIRMWARE_TYPE_INTERSIL,
51 FIRMWARE_TYPE_SYMBOL
52} fwtype_t;
53
54struct orinoco_private {
55 void *card; /* Pointer to card dependent structure */
56 int (*hard_reset)(struct orinoco_private *);
57
58 /* Synchronisation stuff */
59 spinlock_t lock;
60 int hw_unavailable;
61 struct work_struct reset_work;
62
63 /* driver state */
64 int open;
65 u16 last_linkstatus;
16739b06 66 struct work_struct join_work;
95dd91fb 67 struct work_struct wevent_work;
1da177e4
LT
68
69 /* Net device stuff */
70 struct net_device *ndev;
71 struct net_device_stats stats;
72 struct iw_statistics wstats;
73
74 /* Hardware control variables */
75 hermes_t hw;
76 u16 txfid;
77
78 /* Capabilities of the hardware/firmware */
79 fwtype_t firmware_type;
80 char fw_name[32];
81 int ibss_port;
82 int nicbuf_size;
83 u16 channel_mask;
84
85 /* Boolean capabilities */
86 unsigned int has_ibss:1;
87 unsigned int has_port3:1;
88 unsigned int has_wep:1;
89 unsigned int has_big_wep:1;
90 unsigned int has_mwo:1;
91 unsigned int has_pm:1;
92 unsigned int has_preamble:1;
93 unsigned int has_sensitivity:1;
95dd91fb 94 unsigned int has_hostscan:1;
1da177e4 95 unsigned int broken_disableport:1;
98c4cae1 96 unsigned int broken_monitor:1;
1da177e4
LT
97
98 /* Configuration paramaters */
99 u32 iw_mode;
100 int prefer_port3;
101 u16 wep_on, wep_restrict, tx_key;
102 struct orinoco_key keys[ORINOCO_MAX_KEYS];
103 int bitratemode;
104 char nick[IW_ESSID_MAX_SIZE+1];
105 char desired_essid[IW_ESSID_MAX_SIZE+1];
16739b06
CH
106 char desired_bssid[ETH_ALEN];
107 int bssid_fixed;
1da177e4
LT
108 u16 frag_thresh, mwo_robust;
109 u16 channel;
110 u16 ap_density, rts_thresh;
111 u16 pm_on, pm_mcast, pm_period, pm_timeout;
112 u16 preamble;
113#ifdef WIRELESS_SPY
343c686c
PR
114 struct iw_spy_data spy_data; /* iwspy support */
115 struct iw_public_data wireless_data;
1da177e4
LT
116#endif
117
118 /* Configuration dependent variables */
119 int port_type, createibss;
120 int promiscuous, mc_count;
95dd91fb
CH
121
122 /* Scanning support */
123 int scan_inprogress; /* Scan pending... */
124 u32 scan_mode; /* Type of scan done */
125 char * scan_result; /* Result of previous scan */
126 int scan_len; /* Lenght of result */
1da177e4
LT
127};
128
129#ifdef ORINOCO_DEBUG
130extern int orinoco_debug;
131#define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
132#else
133#define DEBUG(n, args...) do { } while (0)
134#endif /* ORINOCO_DEBUG */
135
136#define TRACE_ENTER(devname) DEBUG(2, "%s: -> %s()\n", devname, __FUNCTION__);
137#define TRACE_EXIT(devname) DEBUG(2, "%s: <- %s()\n", devname, __FUNCTION__);
138
139/********************************************************************/
140/* Exported prototypes */
141/********************************************************************/
142
143extern struct net_device *alloc_orinocodev(int sizeof_card,
144 int (*hard_reset)(struct orinoco_private *));
145extern void free_orinocodev(struct net_device *dev);
146extern int __orinoco_up(struct net_device *dev);
147extern int __orinoco_down(struct net_device *dev);
1da177e4
LT
148extern int orinoco_reinit_firmware(struct net_device *dev);
149extern irqreturn_t orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs);
150
151/********************************************************************/
152/* Locking and synchronization functions */
153/********************************************************************/
154
155/* These functions *must* be inline or they will break horribly on
156 * SPARC, due to its weird semantics for save/restore flags. extern
157 * inline should prevent the kernel from linking or module from
158 * loading if they are not inlined. */
159extern inline int orinoco_lock(struct orinoco_private *priv,
160 unsigned long *flags)
161{
162 spin_lock_irqsave(&priv->lock, *flags);
163 if (priv->hw_unavailable) {
164 DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
165 priv->ndev);
166 spin_unlock_irqrestore(&priv->lock, *flags);
167 return -EBUSY;
168 }
169 return 0;
170}
171
172extern inline void orinoco_unlock(struct orinoco_private *priv,
173 unsigned long *flags)
174{
175 spin_unlock_irqrestore(&priv->lock, *flags);
176}
177
178#endif /* _ORINOCO_H */
This page took 0.117637 seconds and 5 git commands to generate.