orinoco.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /* orinoco.h
  2. *
  3. * Common definitions to all pieces of the various orinoco
  4. * drivers
  5. */
  6. #ifndef _ORINOCO_H
  7. #define _ORINOCO_H
  8. #define DRIVER_VERSION "0.15"
  9. #include <linux/netdevice.h>
  10. #include <linux/wireless.h>
  11. #include <net/iw_handler.h>
  12. #include "hermes.h"
  13. /* To enable debug messages */
  14. //#define ORINOCO_DEBUG 3
  15. #define WIRELESS_SPY // enable iwspy support
  16. #define MAX_SCAN_LEN 4096
  17. #define ORINOCO_MAX_KEY_SIZE 14
  18. #define ORINOCO_MAX_KEYS 4
  19. struct orinoco_key {
  20. __le16 len; /* always stored as little-endian */
  21. char data[ORINOCO_MAX_KEY_SIZE];
  22. } __attribute__ ((packed));
  23. typedef enum {
  24. FIRMWARE_TYPE_AGERE,
  25. FIRMWARE_TYPE_INTERSIL,
  26. FIRMWARE_TYPE_SYMBOL
  27. } fwtype_t;
  28. typedef struct {
  29. union hermes_scan_info bss;
  30. unsigned long last_scanned;
  31. struct list_head list;
  32. } bss_element;
  33. struct orinoco_private {
  34. void *card; /* Pointer to card dependent structure */
  35. struct device *dev;
  36. int (*hard_reset)(struct orinoco_private *);
  37. int (*stop_fw)(struct orinoco_private *, int);
  38. /* Synchronisation stuff */
  39. spinlock_t lock;
  40. int hw_unavailable;
  41. struct work_struct reset_work;
  42. /* driver state */
  43. int open;
  44. u16 last_linkstatus;
  45. struct work_struct join_work;
  46. struct work_struct wevent_work;
  47. /* Net device stuff */
  48. struct net_device *ndev;
  49. struct net_device_stats stats;
  50. struct iw_statistics wstats;
  51. /* Hardware control variables */
  52. hermes_t hw;
  53. u16 txfid;
  54. /* Capabilities of the hardware/firmware */
  55. fwtype_t firmware_type;
  56. char fw_name[32];
  57. int ibss_port;
  58. int nicbuf_size;
  59. u16 channel_mask;
  60. /* Boolean capabilities */
  61. unsigned int has_ibss:1;
  62. unsigned int has_port3:1;
  63. unsigned int has_wep:1;
  64. unsigned int has_big_wep:1;
  65. unsigned int has_mwo:1;
  66. unsigned int has_pm:1;
  67. unsigned int has_preamble:1;
  68. unsigned int has_sensitivity:1;
  69. unsigned int has_hostscan:1;
  70. unsigned int has_alt_txcntl:1;
  71. unsigned int do_fw_download:1;
  72. unsigned int broken_disableport:1;
  73. unsigned int broken_monitor:1;
  74. /* Configuration paramaters */
  75. u32 iw_mode;
  76. int prefer_port3;
  77. u16 wep_on, wep_restrict, tx_key;
  78. struct orinoco_key keys[ORINOCO_MAX_KEYS];
  79. int bitratemode;
  80. char nick[IW_ESSID_MAX_SIZE+1];
  81. char desired_essid[IW_ESSID_MAX_SIZE+1];
  82. char desired_bssid[ETH_ALEN];
  83. int bssid_fixed;
  84. u16 frag_thresh, mwo_robust;
  85. u16 channel;
  86. u16 ap_density, rts_thresh;
  87. u16 pm_on, pm_mcast, pm_period, pm_timeout;
  88. u16 preamble;
  89. #ifdef WIRELESS_SPY
  90. struct iw_spy_data spy_data; /* iwspy support */
  91. struct iw_public_data wireless_data;
  92. #endif
  93. /* Configuration dependent variables */
  94. int port_type, createibss;
  95. int promiscuous, mc_count;
  96. /* Scanning support */
  97. struct list_head bss_list;
  98. struct list_head bss_free_list;
  99. bss_element *bss_data;
  100. int scan_inprogress; /* Scan pending... */
  101. u32 scan_mode; /* Type of scan done */
  102. };
  103. #ifdef ORINOCO_DEBUG
  104. extern int orinoco_debug;
  105. #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
  106. #else
  107. #define DEBUG(n, args...) do { } while (0)
  108. #endif /* ORINOCO_DEBUG */
  109. /********************************************************************/
  110. /* Exported prototypes */
  111. /********************************************************************/
  112. extern struct net_device *alloc_orinocodev(
  113. int sizeof_card, struct device *device,
  114. int (*hard_reset)(struct orinoco_private *),
  115. int (*stop_fw)(struct orinoco_private *, int));
  116. extern void free_orinocodev(struct net_device *dev);
  117. extern int __orinoco_up(struct net_device *dev);
  118. extern int __orinoco_down(struct net_device *dev);
  119. extern int orinoco_reinit_firmware(struct net_device *dev);
  120. extern irqreturn_t orinoco_interrupt(int irq, void * dev_id);
  121. /********************************************************************/
  122. /* Locking and synchronization functions */
  123. /********************************************************************/
  124. static inline int orinoco_lock(struct orinoco_private *priv,
  125. unsigned long *flags)
  126. {
  127. spin_lock_irqsave(&priv->lock, *flags);
  128. if (priv->hw_unavailable) {
  129. DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
  130. priv->ndev);
  131. spin_unlock_irqrestore(&priv->lock, *flags);
  132. return -EBUSY;
  133. }
  134. return 0;
  135. }
  136. static inline void orinoco_unlock(struct orinoco_private *priv,
  137. unsigned long *flags)
  138. {
  139. spin_unlock_irqrestore(&priv->lock, *flags);
  140. }
  141. #endif /* _ORINOCO_H */