|
|
1.1 ! root 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: #include <linux/types.h> ! 11: #include <linux/spinlock.h> ! 12: #include <linux/netdevice.h> ! 13: #include <linux/wireless.h> ! 14: #include <linux/version.h> ! 15: #include "hermes.h" ! 16: ! 17: /* Workqueue / task queue backwards compatibility stuff */ ! 18: ! 19: #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41) ! 20: #include <linux/workqueue.h> ! 21: #else ! 22: #include <linux/tqueue.h> ! 23: #define work_struct tq_struct ! 24: #define INIT_WORK INIT_TQUEUE ! 25: #define schedule_work schedule_task ! 26: #endif ! 27: ! 28: /* Interrupt handler backwards compatibility stuff */ ! 29: #ifndef IRQ_NONE ! 30: ! 31: #define IRQ_NONE ! 32: #define IRQ_HANDLED ! 33: typedef void irqreturn_t; ! 34: ! 35: #endif ! 36: ! 37: /* To enable debug messages */ ! 38: //#define ORINOCO_DEBUG 3 ! 39: ! 40: #if (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10) ! 41: #error "orinoco driver requires Wireless extensions v10 or later." ! 42: #endif /* (! defined (WIRELESS_EXT)) || (WIRELESS_EXT < 10) */ ! 43: #define WIRELESS_SPY // enable iwspy support ! 44: ! 45: #define ORINOCO_MAX_KEY_SIZE 14 ! 46: #define ORINOCO_MAX_KEYS 4 ! 47: ! 48: struct orinoco_key { ! 49: u16 len; /* always stored as little-endian */ ! 50: char data[ORINOCO_MAX_KEY_SIZE]; ! 51: } __attribute__ ((packed)); ! 52: ! 53: #define ORINOCO_INTEN ( HERMES_EV_RX | HERMES_EV_ALLOC | HERMES_EV_TX | \ ! 54: HERMES_EV_TXEXC | HERMES_EV_WTERR | HERMES_EV_INFO | \ ! 55: HERMES_EV_INFDROP ) ! 56: ! 57: ! 58: struct orinoco_private { ! 59: void *card; /* Pointer to card dependent structure */ ! 60: int (*hard_reset)(struct orinoco_private *); ! 61: ! 62: /* Synchronisation stuff */ ! 63: spinlock_t lock; ! 64: int hw_unavailable; ! 65: struct work_struct reset_work; ! 66: ! 67: /* driver state */ ! 68: int open; ! 69: u16 last_linkstatus; ! 70: int connected; ! 71: ! 72: /* Net device stuff */ ! 73: struct net_device *ndev; ! 74: struct net_device_stats stats; ! 75: struct iw_statistics wstats; ! 76: ! 77: /* Hardware control variables */ ! 78: hermes_t hw; ! 79: u16 txfid; ! 80: ! 81: ! 82: /* Capabilities of the hardware/firmware */ ! 83: int firmware_type; ! 84: #define FIRMWARE_TYPE_AGERE 1 ! 85: #define FIRMWARE_TYPE_INTERSIL 2 ! 86: #define FIRMWARE_TYPE_SYMBOL 3 ! 87: int has_ibss, has_port3, has_ibss_any, ibss_port; ! 88: int has_wep, has_big_wep; ! 89: int has_mwo; ! 90: int has_pm; ! 91: int has_preamble; ! 92: int has_sensitivity; ! 93: int nicbuf_size; ! 94: u16 channel_mask; ! 95: int broken_disableport; ! 96: ! 97: /* Configuration paramaters */ ! 98: u32 iw_mode; ! 99: int prefer_port3; ! 100: u16 wep_on, wep_restrict, tx_key; ! 101: struct orinoco_key keys[ORINOCO_MAX_KEYS]; ! 102: int bitratemode; ! 103: char nick[IW_ESSID_MAX_SIZE+1]; ! 104: char desired_essid[IW_ESSID_MAX_SIZE+1]; ! 105: u16 frag_thresh, mwo_robust; ! 106: u16 channel; ! 107: u16 ap_density, rts_thresh; ! 108: u16 pm_on, pm_mcast, pm_period, pm_timeout; ! 109: u16 preamble; ! 110: #ifdef WIRELESS_SPY ! 111: int spy_number; ! 112: u_char spy_address[IW_MAX_SPY][ETH_ALEN]; ! 113: struct iw_quality spy_stat[IW_MAX_SPY]; ! 114: #endif ! 115: ! 116: /* Configuration dependent variables */ ! 117: int port_type, createibss; ! 118: int promiscuous, mc_count; ! 119: }; ! 120: ! 121: #ifdef ORINOCO_DEBUG ! 122: extern int orinoco_debug; ! 123: #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0) ! 124: #else ! 125: #define DEBUG(n, args...) do { } while (0) ! 126: #endif /* ORINOCO_DEBUG */ ! 127: ! 128: #define TRACE_ENTER(devname) DEBUG(2, "%s: -> " __FUNCTION__ "()\n", devname); ! 129: #define TRACE_EXIT(devname) DEBUG(2, "%s: <- " __FUNCTION__ "()\n", devname); ! 130: ! 131: extern struct net_device *alloc_orinocodev(int sizeof_card, ! 132: int (*hard_reset)(struct orinoco_private *)); ! 133: extern int __orinoco_up(struct net_device *dev); ! 134: extern int __orinoco_down(struct net_device *dev); ! 135: extern int orinoco_stop(struct net_device *dev); ! 136: extern int orinoco_reinit_firmware(struct net_device *dev); ! 137: extern irqreturn_t orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs); ! 138: ! 139: /********************************************************************/ ! 140: /* Locking and synchronization functions */ ! 141: /********************************************************************/ ! 142: ! 143: /* These functions *must* be inline or they will break horribly on ! 144: * SPARC, due to its weird semantics for save/restore flags. extern ! 145: * inline should prevent the kernel from linking or module from ! 146: * loading if they are not inlined. */ ! 147: extern inline int orinoco_lock(struct orinoco_private *priv, ! 148: unsigned long *flags) ! 149: { ! 150: spin_lock_irqsave(&priv->lock, *flags); ! 151: if (priv->hw_unavailable) { ! 152: printk(KERN_DEBUG "orinoco_lock() called with hw_unavailable (dev=%p)\n", ! 153: priv->ndev); ! 154: spin_unlock_irqrestore(&priv->lock, *flags); ! 155: return -EBUSY; ! 156: } ! 157: return 0; ! 158: } ! 159: ! 160: extern inline void orinoco_unlock(struct orinoco_private *priv, ! 161: unsigned long *flags) ! 162: { ! 163: spin_unlock_irqrestore(&priv->lock, *flags); ! 164: } ! 165: ! 166: #endif /* _ORINOCO_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.