| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
| Pavel Roskin | f298a2e | 2006-04-07 04:11:02 -0400 | [diff] [blame] | 10 | #define DRIVER_VERSION "0.15" | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/netdevice.h> | 
 | 13 | #include <linux/wireless.h> | 
| Pavel Roskin | 343c686 | 2005-09-09 18:43:02 -0400 | [diff] [blame] | 14 | #include <net/iw_handler.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
| Christoph Hellwig | 16739b0 | 2005-06-19 01:27:51 +0200 | [diff] [blame] | 23 | #define MAX_SCAN_LEN		4096 | 
 | 24 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #define ORINOCO_MAX_KEY_SIZE	14 | 
 | 26 | #define ORINOCO_MAX_KEYS	4 | 
 | 27 |  | 
 | 28 | struct orinoco_key { | 
| Pavel Roskin | d133ae4 | 2005-09-23 04:18:06 -0400 | [diff] [blame] | 29 | 	__le16 len;	/* always stored as little-endian */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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; | 
| Christoph Hellwig | 16739b0 | 2005-06-19 01:27:51 +0200 | [diff] [blame] | 51 | 	struct work_struct join_work; | 
| Christoph Hellwig | 95dd91f | 2005-06-19 01:27:56 +0200 | [diff] [blame] | 52 | 	struct work_struct wevent_work; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 |  | 
 | 54 | 	/* Net device stuff */ | 
 | 55 | 	struct net_device *ndev; | 
 | 56 | 	struct net_device_stats stats; | 
 | 57 | 	struct iw_statistics wstats; | 
 | 58 |  | 
 | 59 | 	/* Hardware control variables */ | 
 | 60 | 	hermes_t hw; | 
 | 61 | 	u16 txfid; | 
 | 62 |  | 
 | 63 | 	/* Capabilities of the hardware/firmware */ | 
 | 64 | 	fwtype_t firmware_type; | 
 | 65 | 	char fw_name[32]; | 
 | 66 | 	int ibss_port; | 
 | 67 | 	int nicbuf_size; | 
 | 68 | 	u16 channel_mask; | 
 | 69 |  | 
 | 70 | 	/* Boolean capabilities */ | 
 | 71 | 	unsigned int has_ibss:1; | 
 | 72 | 	unsigned int has_port3:1; | 
 | 73 | 	unsigned int has_wep:1; | 
 | 74 | 	unsigned int has_big_wep:1; | 
 | 75 | 	unsigned int has_mwo:1; | 
 | 76 | 	unsigned int has_pm:1; | 
 | 77 | 	unsigned int has_preamble:1; | 
 | 78 | 	unsigned int has_sensitivity:1; | 
| Christoph Hellwig | 95dd91f | 2005-06-19 01:27:56 +0200 | [diff] [blame] | 79 | 	unsigned int has_hostscan:1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | 	unsigned int broken_disableport:1; | 
| Christoph Hellwig | 98c4cae | 2005-06-19 01:28:06 +0200 | [diff] [blame] | 81 | 	unsigned int broken_monitor:1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 |  | 
 | 83 | 	/* Configuration paramaters */ | 
 | 84 | 	u32 iw_mode; | 
 | 85 | 	int prefer_port3; | 
 | 86 | 	u16 wep_on, wep_restrict, tx_key; | 
 | 87 | 	struct orinoco_key keys[ORINOCO_MAX_KEYS]; | 
 | 88 | 	int bitratemode; | 
 | 89 |  	char nick[IW_ESSID_MAX_SIZE+1]; | 
 | 90 | 	char desired_essid[IW_ESSID_MAX_SIZE+1]; | 
| Christoph Hellwig | 16739b0 | 2005-06-19 01:27:51 +0200 | [diff] [blame] | 91 | 	char desired_bssid[ETH_ALEN]; | 
 | 92 | 	int bssid_fixed; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | 	u16 frag_thresh, mwo_robust; | 
 | 94 | 	u16 channel; | 
 | 95 | 	u16 ap_density, rts_thresh; | 
 | 96 | 	u16 pm_on, pm_mcast, pm_period, pm_timeout; | 
 | 97 | 	u16 preamble; | 
 | 98 | #ifdef WIRELESS_SPY | 
| Pavel Roskin | 343c686 | 2005-09-09 18:43:02 -0400 | [diff] [blame] | 99 |  	struct iw_spy_data spy_data; /* iwspy support */ | 
 | 100 | 	struct iw_public_data	wireless_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | #endif | 
 | 102 |  | 
 | 103 | 	/* Configuration dependent variables */ | 
 | 104 | 	int port_type, createibss; | 
 | 105 | 	int promiscuous, mc_count; | 
| Christoph Hellwig | 95dd91f | 2005-06-19 01:27:56 +0200 | [diff] [blame] | 106 |  | 
 | 107 | 	/* Scanning support */ | 
 | 108 | 	int	scan_inprogress;	/* Scan pending... */ | 
 | 109 | 	u32	scan_mode;		/* Type of scan done */ | 
 | 110 | 	char *	scan_result;		/* Result of previous scan */ | 
 | 111 | 	int	scan_len;		/* Lenght of result */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | }; | 
 | 113 |  | 
 | 114 | #ifdef ORINOCO_DEBUG | 
 | 115 | extern int orinoco_debug; | 
 | 116 | #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0) | 
 | 117 | #else | 
 | 118 | #define DEBUG(n, args...) do { } while (0) | 
 | 119 | #endif	/* ORINOCO_DEBUG */ | 
 | 120 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | /********************************************************************/ | 
 | 122 | /* Exported prototypes                                              */ | 
 | 123 | /********************************************************************/ | 
 | 124 |  | 
 | 125 | extern struct net_device *alloc_orinocodev(int sizeof_card, | 
 | 126 | 					   int (*hard_reset)(struct orinoco_private *)); | 
 | 127 | extern void free_orinocodev(struct net_device *dev); | 
 | 128 | extern int __orinoco_up(struct net_device *dev); | 
 | 129 | extern int __orinoco_down(struct net_device *dev); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | extern int orinoco_reinit_firmware(struct net_device *dev); | 
 | 131 | extern irqreturn_t orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs); | 
 | 132 |  | 
 | 133 | /********************************************************************/ | 
 | 134 | /* Locking and synchronization functions                            */ | 
 | 135 | /********************************************************************/ | 
 | 136 |  | 
 | 137 | /* These functions *must* be inline or they will break horribly on | 
 | 138 |  * SPARC, due to its weird semantics for save/restore flags. extern | 
 | 139 |  * inline should prevent the kernel from linking or module from | 
 | 140 |  * loading if they are not inlined. */ | 
 | 141 | extern inline int orinoco_lock(struct orinoco_private *priv, | 
 | 142 | 			       unsigned long *flags) | 
 | 143 | { | 
 | 144 | 	spin_lock_irqsave(&priv->lock, *flags); | 
 | 145 | 	if (priv->hw_unavailable) { | 
 | 146 | 		DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n", | 
 | 147 | 		       priv->ndev); | 
 | 148 | 		spin_unlock_irqrestore(&priv->lock, *flags); | 
 | 149 | 		return -EBUSY; | 
 | 150 | 	} | 
 | 151 | 	return 0; | 
 | 152 | } | 
 | 153 |  | 
 | 154 | extern inline void orinoco_unlock(struct orinoco_private *priv, | 
 | 155 | 				  unsigned long *flags) | 
 | 156 | { | 
 | 157 | 	spin_unlock_irqrestore(&priv->lock, *flags); | 
 | 158 | } | 
 | 159 |  | 
 | 160 | #endif /* _ORINOCO_H */ |