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/* To enable debug messages */
11//#define ORINOCO_DEBUG		3
12
13#if (!defined(WIRELESS_EXT)) || (WIRELESS_EXT < 10)
14#error "orinoco driver requires Wireless extensions v10 or later."
15#endif /* (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10) */
16#define WIRELESS_SPY		// enable iwspy support
17
18#define ORINOCO_MAX_KEY_SIZE	14
19#define ORINOCO_MAX_KEYS	4
20
21typedef struct orinoco_key {
22	u16 len;	/* always store little-endian */
23	char data[ORINOCO_MAX_KEY_SIZE];
24} __attribute__ ((packed)) orinoco_key_t;
25
26typedef orinoco_key_t orinoco_keys_t[ORINOCO_MAX_KEYS];
27
28/*====================================================================*/
29
30struct orinoco_private {
31	void *card;	/* Pointer to card dependant structure */
32	/* card dependant extra reset code (i.e. bus/interface specific */
33	int (*hard_reset)(struct orinoco_private *);
34
35	spinlock_t lock;
36	long state;
37#define ORINOCO_STATE_INIRQ 0
38#define ORINOCO_STATE_DOIRQ 1
39
40	/* Net device stuff */
41	struct net_device *ndev;
42	struct net_device_stats stats;
43	struct iw_statistics wstats;
44
45	/* Hardware control variables */
46	hermes_t hw;
47	u16 txfid;
48
49	/* Capabilities of the hardware/firmware */
50	int firmware_type;
51#define FIRMWARE_TYPE_AGERE 1
52#define FIRMWARE_TYPE_INTERSIL 2
53#define FIRMWARE_TYPE_SYMBOL 3
54	int has_ibss, has_port3, has_ibss_any, ibss_port;
55	int has_wep, has_big_wep;
56	int has_mwo;
57	int has_pm;
58	int has_preamble;
59	int has_sensitivity;
60	int nicbuf_size;
61	int broken_cor_reset;
62	u16 channel_mask;
63
64	/* Configuration paramaters */
65	u32 iw_mode;
66	int prefer_port3;
67	u16 wep_on, wep_restrict, tx_key;
68	orinoco_keys_t keys;
69	int bitratemode;
70 	char nick[IW_ESSID_MAX_SIZE+1];
71	char desired_essid[IW_ESSID_MAX_SIZE+1];
72	u16 frag_thresh, mwo_robust;
73	u16 channel;
74	u16 ap_density, rts_thresh;
75	u16 pm_on, pm_mcast, pm_period, pm_timeout;
76	u16 preamble;
77#ifdef WIRELESS_SPY
78	int			spy_number;
79	u_char			spy_address[IW_MAX_SPY][ETH_ALEN];
80	struct iw_quality	spy_stat[IW_MAX_SPY];
81#endif
82
83	/* Configuration dependent variables */
84	int port_type, allow_ibss;
85	int promiscuous, mc_count;
86
87
88	/* /proc based debugging stuff */
89	struct proc_dir_entry *dir_dev;
90};
91
92/*====================================================================*/
93
94extern struct list_head orinoco_instances;
95
96#ifdef ORINOCO_DEBUG
97extern int orinoco_debug;
98#define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
99#define DEBUGMORE(n, args...) do { if (orinoco_debug>(n)) printk(args); } while (0)
100#else
101#define DEBUG(n, args...) do { } while (0)
102#define DEBUGMORE(n, args...) do { } while (0)
103#endif	/* ORINOCO_DEBUG */
104
105#define TRACE_ENTER(devname) DEBUG(2, "%s: -> " __FUNCTION__ "()\n", devname);
106#define TRACE_EXIT(devname)  DEBUG(2, "%s: <- " __FUNCTION__ "()\n", devname);
107
108#define RUP_EVEN(a) ( (a) % 2 ? (a) + 1 : (a) )
109
110/* utility routines */
111struct net_device *alloc_orinocodev(int sizeof_card);
112extern void orinoco_shutdown(struct orinoco_private *dev);
113extern int orinoco_reset(struct orinoco_private *dev);
114extern int orinoco_proc_dev_init(struct orinoco_private *dev);
115extern void orinoco_proc_dev_cleanup(struct orinoco_private *priv);
116extern void orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs);
117
118#endif /* _ORINOCO_H */
119