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