Commit | Line | Data |
---|---|---|
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 | ||
10 | #define DRIVER_VERSION "0.14alpha2" | |
11 | ||
12 | #include <linux/types.h> | |
13 | #include <linux/spinlock.h> | |
14 | #include <linux/netdevice.h> | |
15 | #include <linux/wireless.h> | |
16 | #include <linux/version.h> | |
17 | ||
18 | #include "hermes.h" | |
19 | ||
20 | /* To enable debug messages */ | |
21 | //#define ORINOCO_DEBUG 3 | |
22 | ||
23 | #define WIRELESS_SPY // enable iwspy support | |
24 | ||
25 | #define ORINOCO_MAX_KEY_SIZE 14 | |
26 | #define ORINOCO_MAX_KEYS 4 | |
27 | ||
28 | struct orinoco_key { | |
29 | u16 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 | struct orinoco_private { | |
40 | void *card; /* Pointer to card dependent structure */ | |
41 | int (*hard_reset)(struct orinoco_private *); | |
42 | ||
43 | /* Synchronisation stuff */ | |
44 | spinlock_t lock; | |
45 | int hw_unavailable; | |
46 | struct work_struct reset_work; | |
47 | ||
48 | /* driver state */ | |
49 | int open; | |
50 | u16 last_linkstatus; | |
51 | ||
52 | /* Net device stuff */ | |
53 | struct net_device *ndev; | |
54 | struct net_device_stats stats; | |
55 | struct iw_statistics wstats; | |
56 | ||
57 | /* Hardware control variables */ | |
58 | hermes_t hw; | |
59 | u16 txfid; | |
60 | ||
61 | /* Capabilities of the hardware/firmware */ | |
62 | fwtype_t firmware_type; | |
63 | char fw_name[32]; | |
64 | int ibss_port; | |
65 | int nicbuf_size; | |
66 | u16 channel_mask; | |
67 | ||
68 | /* Boolean capabilities */ | |
69 | unsigned int has_ibss:1; | |
70 | unsigned int has_port3:1; | |
71 | unsigned int has_wep:1; | |
72 | unsigned int has_big_wep:1; | |
73 | unsigned int has_mwo:1; | |
74 | unsigned int has_pm:1; | |
75 | unsigned int has_preamble:1; | |
76 | unsigned int has_sensitivity:1; | |
77 | unsigned int broken_disableport:1; | |
78 | ||
79 | /* Configuration paramaters */ | |
80 | u32 iw_mode; | |
81 | int prefer_port3; | |
82 | u16 wep_on, wep_restrict, tx_key; | |
83 | struct orinoco_key keys[ORINOCO_MAX_KEYS]; | |
84 | int bitratemode; | |
85 | char nick[IW_ESSID_MAX_SIZE+1]; | |
86 | char desired_essid[IW_ESSID_MAX_SIZE+1]; | |
87 | u16 frag_thresh, mwo_robust; | |
88 | u16 channel; | |
89 | u16 ap_density, rts_thresh; | |
90 | u16 pm_on, pm_mcast, pm_period, pm_timeout; | |
91 | u16 preamble; | |
92 | #ifdef WIRELESS_SPY | |
93 | int spy_number; | |
94 | u_char spy_address[IW_MAX_SPY][ETH_ALEN]; | |
95 | struct iw_quality spy_stat[IW_MAX_SPY]; | |
96 | #endif | |
97 | ||
98 | /* Configuration dependent variables */ | |
99 | int port_type, createibss; | |
100 | int promiscuous, mc_count; | |
101 | }; | |
102 | ||
103 | #ifdef ORINOCO_DEBUG | |
104 | extern int orinoco_debug; | |
105 | #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0) | |
106 | #else | |
107 | #define DEBUG(n, args...) do { } while (0) | |
108 | #endif /* ORINOCO_DEBUG */ | |
109 | ||
110 | #define TRACE_ENTER(devname) DEBUG(2, "%s: -> %s()\n", devname, __FUNCTION__); | |
111 | #define TRACE_EXIT(devname) DEBUG(2, "%s: <- %s()\n", devname, __FUNCTION__); | |
112 | ||
113 | /********************************************************************/ | |
114 | /* Exported prototypes */ | |
115 | /********************************************************************/ | |
116 | ||
117 | extern struct net_device *alloc_orinocodev(int sizeof_card, | |
118 | int (*hard_reset)(struct orinoco_private *)); | |
119 | extern void free_orinocodev(struct net_device *dev); | |
120 | extern int __orinoco_up(struct net_device *dev); | |
121 | extern int __orinoco_down(struct net_device *dev); | |
1da177e4 LT |
122 | extern int orinoco_reinit_firmware(struct net_device *dev); |
123 | extern irqreturn_t orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs); | |
124 | ||
125 | /********************************************************************/ | |
126 | /* Locking and synchronization functions */ | |
127 | /********************************************************************/ | |
128 | ||
129 | /* These functions *must* be inline or they will break horribly on | |
130 | * SPARC, due to its weird semantics for save/restore flags. extern | |
131 | * inline should prevent the kernel from linking or module from | |
132 | * loading if they are not inlined. */ | |
133 | extern inline int orinoco_lock(struct orinoco_private *priv, | |
134 | unsigned long *flags) | |
135 | { | |
136 | spin_lock_irqsave(&priv->lock, *flags); | |
137 | if (priv->hw_unavailable) { | |
138 | DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n", | |
139 | priv->ndev); | |
140 | spin_unlock_irqrestore(&priv->lock, *flags); | |
141 | return -EBUSY; | |
142 | } | |
143 | return 0; | |
144 | } | |
145 | ||
146 | extern inline void orinoco_unlock(struct orinoco_private *priv, | |
147 | unsigned long *flags) | |
148 | { | |
149 | spin_unlock_irqrestore(&priv->lock, *flags); | |
150 | } | |
151 | ||
152 | #endif /* _ORINOCO_H */ |