3 * Common definitions to all pieces of the various orinoco
10 #include <linux/types.h>
11 #include <linux/spinlock.h>
12 #include <linux/netdevice.h>
13 #include <linux/wireless.h>
14 #include <linux/version.h>
17 /* Workqueue / task queue backwards compatibility stuff */
19 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
20 #include <linux/workqueue.h>
22 #include <linux/tqueue.h>
23 #define work_struct tq_struct
24 #define INIT_WORK INIT_TQUEUE
25 #define schedule_work schedule_task
28 /* Interrupt handler backwards compatibility stuff */
33 typedef void irqreturn_t;
37 /* To enable debug messages */
38 //#define ORINOCO_DEBUG 3
40 #if (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10)
41 #error "orinoco driver requires Wireless extensions v10 or later."
42 #endif /* (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10) */
43 #define WIRELESS_SPY // enable iwspy support
45 #define ORINOCO_MAX_KEY_SIZE 14
46 #define ORINOCO_MAX_KEYS 4
49 u16 len; /* always stored as little-endian */
50 char data[ORINOCO_MAX_KEY_SIZE];
51 } __attribute__ ((packed));
53 #define ORINOCO_INTEN ( HERMES_EV_RX | HERMES_EV_ALLOC | HERMES_EV_TX | \
54 HERMES_EV_TXEXC | HERMES_EV_WTERR | HERMES_EV_INFO | \
58 struct orinoco_private {
59 void *card; /* Pointer to card dependent structure */
60 int (*hard_reset)(struct orinoco_private *);
62 /* Synchronisation stuff */
65 struct work_struct reset_work;
72 /* Net device stuff */
73 struct net_device *ndev;
74 struct net_device_stats stats;
75 struct iw_statistics wstats;
77 /* Hardware control variables */
82 /* Capabilities of the hardware/firmware */
84 #define FIRMWARE_TYPE_AGERE 1
85 #define FIRMWARE_TYPE_INTERSIL 2
86 #define FIRMWARE_TYPE_SYMBOL 3
87 int has_ibss, has_port3, has_ibss_any, ibss_port;
88 int has_wep, has_big_wep;
95 int broken_disableport;
97 /* Configuration paramaters */
100 u16 wep_on, wep_restrict, tx_key;
101 struct orinoco_key keys[ORINOCO_MAX_KEYS];
103 char nick[IW_ESSID_MAX_SIZE+1];
104 char desired_essid[IW_ESSID_MAX_SIZE+1];
105 u16 frag_thresh, mwo_robust;
107 u16 ap_density, rts_thresh;
108 u16 pm_on, pm_mcast, pm_period, pm_timeout;
112 u_char spy_address[IW_MAX_SPY][ETH_ALEN];
113 struct iw_quality spy_stat[IW_MAX_SPY];
116 /* Configuration dependent variables */
117 int port_type, createibss;
118 int promiscuous, mc_count;
122 extern int orinoco_debug;
123 #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
125 #define DEBUG(n, args...) do { } while (0)
126 #endif /* ORINOCO_DEBUG */
128 #define TRACE_ENTER(devname) DEBUG(2, "%s: -> %s()\n", devname, __FUNCTION__);
129 #define TRACE_EXIT(devname) DEBUG(2, "%s: <- %s()\n", devname, __FUNCTION__);
131 extern struct net_device *alloc_orinocodev(int sizeof_card,
132 int (*hard_reset)(struct orinoco_private *));
133 extern int __orinoco_up(struct net_device *dev);
134 extern int __orinoco_down(struct net_device *dev);
135 extern int orinoco_stop(struct net_device *dev);
136 extern int orinoco_reinit_firmware(struct net_device *dev);
137 extern irqreturn_t orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs);
139 /********************************************************************/
140 /* Locking and synchronization functions */
141 /********************************************************************/
143 /* These functions *must* be inline or they will break horribly on
144 * SPARC, due to its weird semantics for save/restore flags. extern
145 * inline should prevent the kernel from linking or module from
146 * loading if they are not inlined. */
147 extern inline int orinoco_lock(struct orinoco_private *priv,
148 unsigned long *flags)
150 spin_lock_irqsave(&priv->lock, *flags);
151 if (priv->hw_unavailable) {
152 printk(KERN_DEBUG "orinoco_lock() called with hw_unavailable (dev=%p)\n",
154 spin_unlock_irqrestore(&priv->lock, *flags);
160 extern inline void orinoco_unlock(struct orinoco_private *priv,
161 unsigned long *flags)
163 spin_unlock_irqrestore(&priv->lock, *flags);
166 #endif /* _ORINOCO_H */