orinoco: Fix transmit for Agere/Lucent with fw 9.x
[safe/jmp/linux-2.6] / drivers / net / wireless / orinoco.h
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
10 #define DRIVER_VERSION "0.15"
11
12 #include <linux/netdevice.h>
13 #include <linux/wireless.h>
14 #include <net/iw_handler.h>
15
16 #include "hermes.h"
17
18 /* To enable debug messages */
19 //#define ORINOCO_DEBUG         3
20
21 #define WIRELESS_SPY            // enable iwspy support
22
23 #define MAX_SCAN_LEN            4096
24
25 #define ORINOCO_MAX_KEY_SIZE    14
26 #define ORINOCO_MAX_KEYS        4
27
28 struct orinoco_key {
29         __le16 len;     /* always stored as little-endian */
30         char data[ORINOCO_MAX_KEY_SIZE];
31 } __attribute__ ((packed));
32
33 typedef enum {
34         FIRMWARE_TYPE_AGERE,
35         FIRMWARE_TYPE_INTERSIL,
36         FIRMWARE_TYPE_SYMBOL
37 } fwtype_t;
38
39 typedef struct {
40         union hermes_scan_info bss;
41         unsigned long last_scanned;
42         struct list_head list;
43 } bss_element;
44
45 struct orinoco_private {
46         void *card;     /* Pointer to card dependent structure */
47         struct device *dev;
48         int (*hard_reset)(struct orinoco_private *);
49         int (*stop_fw)(struct orinoco_private *, int);
50
51         /* Synchronisation stuff */
52         spinlock_t lock;
53         int hw_unavailable;
54         struct work_struct reset_work;
55
56         /* driver state */
57         int open;
58         u16 last_linkstatus;
59         struct work_struct join_work;
60         struct work_struct wevent_work;
61
62         /* Net device stuff */
63         struct net_device *ndev;
64         struct net_device_stats stats;
65         struct iw_statistics wstats;
66
67         /* Hardware control variables */
68         hermes_t hw;
69         u16 txfid;
70
71         /* Capabilities of the hardware/firmware */
72         fwtype_t firmware_type;
73         char fw_name[32];
74         int ibss_port;
75         int nicbuf_size;
76         u16 channel_mask;
77
78         /* Boolean capabilities */
79         unsigned int has_ibss:1;
80         unsigned int has_port3:1;
81         unsigned int has_wep:1;
82         unsigned int has_big_wep:1;
83         unsigned int has_mwo:1;
84         unsigned int has_pm:1;
85         unsigned int has_preamble:1;
86         unsigned int has_sensitivity:1;
87         unsigned int has_hostscan:1;
88         unsigned int has_alt_txcntl:1;
89         unsigned int do_fw_download:1;
90         unsigned int broken_disableport:1;
91         unsigned int broken_monitor:1;
92
93         /* Configuration paramaters */
94         u32 iw_mode;
95         int prefer_port3;
96         u16 wep_on, wep_restrict, tx_key;
97         struct orinoco_key keys[ORINOCO_MAX_KEYS];
98         int bitratemode;
99         char nick[IW_ESSID_MAX_SIZE+1];
100         char desired_essid[IW_ESSID_MAX_SIZE+1];
101         char desired_bssid[ETH_ALEN];
102         int bssid_fixed;
103         u16 frag_thresh, mwo_robust;
104         u16 channel;
105         u16 ap_density, rts_thresh;
106         u16 pm_on, pm_mcast, pm_period, pm_timeout;
107         u16 preamble;
108 #ifdef WIRELESS_SPY
109         struct iw_spy_data spy_data; /* iwspy support */
110         struct iw_public_data   wireless_data;
111 #endif
112
113         /* Configuration dependent variables */
114         int port_type, createibss;
115         int promiscuous, mc_count;
116
117         /* Scanning support */
118         struct list_head bss_list;
119         struct list_head bss_free_list;
120         bss_element *bss_data;
121
122         int     scan_inprogress;        /* Scan pending... */
123         u32     scan_mode;              /* Type of scan done */
124 };
125
126 #ifdef ORINOCO_DEBUG
127 extern int orinoco_debug;
128 #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
129 #else
130 #define DEBUG(n, args...) do { } while (0)
131 #endif  /* ORINOCO_DEBUG */
132
133 /********************************************************************/
134 /* Exported prototypes                                              */
135 /********************************************************************/
136
137 extern struct net_device *alloc_orinocodev(
138         int sizeof_card, struct device *device,
139         int (*hard_reset)(struct orinoco_private *),
140         int (*stop_fw)(struct orinoco_private *, int));
141 extern void free_orinocodev(struct net_device *dev);
142 extern int __orinoco_up(struct net_device *dev);
143 extern int __orinoco_down(struct net_device *dev);
144 extern int orinoco_reinit_firmware(struct net_device *dev);
145 extern irqreturn_t orinoco_interrupt(int irq, void * dev_id);
146
147 /********************************************************************/
148 /* Locking and synchronization functions                            */
149 /********************************************************************/
150
151 static inline int orinoco_lock(struct orinoco_private *priv,
152                                unsigned long *flags)
153 {
154         spin_lock_irqsave(&priv->lock, *flags);
155         if (priv->hw_unavailable) {
156                 DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
157                        priv->ndev);
158                 spin_unlock_irqrestore(&priv->lock, *flags);
159                 return -EBUSY;
160         }
161         return 0;
162 }
163
164 static inline void orinoco_unlock(struct orinoco_private *priv,
165                                   unsigned long *flags)
166 {
167         spin_unlock_irqrestore(&priv->lock, *flags);
168 }
169
170 #endif /* _ORINOCO_H */