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 | |
Dan Williams | 1e3428e | 2007-10-10 23:56:25 -0400 | [diff] [blame] | 39 | typedef struct { |
| 40 | union hermes_scan_info bss; |
| 41 | unsigned long last_scanned; |
| 42 | struct list_head list; |
| 43 | } bss_element; |
| 44 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | struct orinoco_private { |
| 46 | void *card; /* Pointer to card dependent structure */ |
| 47 | int (*hard_reset)(struct orinoco_private *); |
| 48 | |
| 49 | /* Synchronisation stuff */ |
| 50 | spinlock_t lock; |
| 51 | int hw_unavailable; |
| 52 | struct work_struct reset_work; |
| 53 | |
| 54 | /* driver state */ |
| 55 | int open; |
| 56 | u16 last_linkstatus; |
Christoph Hellwig | 16739b0 | 2005-06-19 01:27:51 +0200 | [diff] [blame] | 57 | struct work_struct join_work; |
Christoph Hellwig | 95dd91f | 2005-06-19 01:27:56 +0200 | [diff] [blame] | 58 | struct work_struct wevent_work; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
| 60 | /* Net device stuff */ |
| 61 | struct net_device *ndev; |
| 62 | struct net_device_stats stats; |
| 63 | struct iw_statistics wstats; |
| 64 | |
| 65 | /* Hardware control variables */ |
| 66 | hermes_t hw; |
| 67 | u16 txfid; |
| 68 | |
| 69 | /* Capabilities of the hardware/firmware */ |
| 70 | fwtype_t firmware_type; |
| 71 | char fw_name[32]; |
| 72 | int ibss_port; |
| 73 | int nicbuf_size; |
| 74 | u16 channel_mask; |
| 75 | |
| 76 | /* Boolean capabilities */ |
| 77 | unsigned int has_ibss:1; |
| 78 | unsigned int has_port3:1; |
| 79 | unsigned int has_wep:1; |
| 80 | unsigned int has_big_wep:1; |
| 81 | unsigned int has_mwo:1; |
| 82 | unsigned int has_pm:1; |
| 83 | unsigned int has_preamble:1; |
| 84 | unsigned int has_sensitivity:1; |
Christoph Hellwig | 95dd91f | 2005-06-19 01:27:56 +0200 | [diff] [blame] | 85 | unsigned int has_hostscan:1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | unsigned int broken_disableport:1; |
Christoph Hellwig | 98c4cae | 2005-06-19 01:28:06 +0200 | [diff] [blame] | 87 | unsigned int broken_monitor:1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | |
| 89 | /* Configuration paramaters */ |
| 90 | u32 iw_mode; |
| 91 | int prefer_port3; |
| 92 | u16 wep_on, wep_restrict, tx_key; |
| 93 | struct orinoco_key keys[ORINOCO_MAX_KEYS]; |
| 94 | int bitratemode; |
| 95 | char nick[IW_ESSID_MAX_SIZE+1]; |
| 96 | char desired_essid[IW_ESSID_MAX_SIZE+1]; |
Christoph Hellwig | 16739b0 | 2005-06-19 01:27:51 +0200 | [diff] [blame] | 97 | char desired_bssid[ETH_ALEN]; |
| 98 | int bssid_fixed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | u16 frag_thresh, mwo_robust; |
| 100 | u16 channel; |
| 101 | u16 ap_density, rts_thresh; |
| 102 | u16 pm_on, pm_mcast, pm_period, pm_timeout; |
| 103 | u16 preamble; |
| 104 | #ifdef WIRELESS_SPY |
Pavel Roskin | 343c686 | 2005-09-09 18:43:02 -0400 | [diff] [blame] | 105 | struct iw_spy_data spy_data; /* iwspy support */ |
| 106 | struct iw_public_data wireless_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | #endif |
| 108 | |
| 109 | /* Configuration dependent variables */ |
| 110 | int port_type, createibss; |
| 111 | int promiscuous, mc_count; |
Christoph Hellwig | 95dd91f | 2005-06-19 01:27:56 +0200 | [diff] [blame] | 112 | |
| 113 | /* Scanning support */ |
Dan Williams | 1e3428e | 2007-10-10 23:56:25 -0400 | [diff] [blame] | 114 | struct list_head bss_list; |
| 115 | struct list_head bss_free_list; |
| 116 | bss_element *bss_data; |
| 117 | |
Christoph Hellwig | 95dd91f | 2005-06-19 01:27:56 +0200 | [diff] [blame] | 118 | int scan_inprogress; /* Scan pending... */ |
| 119 | u32 scan_mode; /* Type of scan done */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | }; |
| 121 | |
| 122 | #ifdef ORINOCO_DEBUG |
| 123 | extern int orinoco_debug; |
| 124 | #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0) |
| 125 | #else |
| 126 | #define DEBUG(n, args...) do { } while (0) |
| 127 | #endif /* ORINOCO_DEBUG */ |
| 128 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | /********************************************************************/ |
| 130 | /* Exported prototypes */ |
| 131 | /********************************************************************/ |
| 132 | |
| 133 | extern struct net_device *alloc_orinocodev(int sizeof_card, |
| 134 | int (*hard_reset)(struct orinoco_private *)); |
| 135 | extern void free_orinocodev(struct net_device *dev); |
| 136 | extern int __orinoco_up(struct net_device *dev); |
| 137 | extern int __orinoco_down(struct net_device *dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | extern int orinoco_reinit_firmware(struct net_device *dev); |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 139 | extern irqreturn_t orinoco_interrupt(int irq, void * dev_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | |
| 141 | /********************************************************************/ |
| 142 | /* Locking and synchronization functions */ |
| 143 | /********************************************************************/ |
| 144 | |
Pavel Roskin | 821fe68 | 2006-08-15 20:45:00 -0400 | [diff] [blame] | 145 | static inline int orinoco_lock(struct orinoco_private *priv, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | unsigned long *flags) |
| 147 | { |
| 148 | spin_lock_irqsave(&priv->lock, *flags); |
| 149 | if (priv->hw_unavailable) { |
| 150 | DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n", |
| 151 | priv->ndev); |
| 152 | spin_unlock_irqrestore(&priv->lock, *flags); |
| 153 | return -EBUSY; |
| 154 | } |
| 155 | return 0; |
| 156 | } |
| 157 | |
Pavel Roskin | 821fe68 | 2006-08-15 20:45:00 -0400 | [diff] [blame] | 158 | static inline void orinoco_unlock(struct orinoco_private *priv, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 159 | unsigned long *flags) |
| 160 | { |
| 161 | spin_unlock_irqrestore(&priv->lock, *flags); |
| 162 | } |
| 163 | |
| 164 | #endif /* _ORINOCO_H */ |