orinoco.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. struct orinoco_private {
  29. void *card; /* Pointer to card dependent structure */
  30. int (*hard_reset)(struct orinoco_private *);
  31. /* Synchronisation stuff */
  32. spinlock_t lock;
  33. int hw_unavailable;
  34. struct work_struct reset_work;
  35. /* driver state */
  36. int open;
  37. u16 last_linkstatus;
  38. struct work_struct join_work;
  39. struct work_struct wevent_work;
  40. /* Net device stuff */
  41. struct net_device *ndev;
  42. struct net_device_stats stats;
  43. struct iw_statistics wstats;
  44. /* Hardware control variables */
  45. hermes_t hw;
  46. u16 txfid;
  47. /* Capabilities of the hardware/firmware */
  48. fwtype_t firmware_type;
  49. char fw_name[32];
  50. int ibss_port;
  51. int nicbuf_size;
  52. u16 channel_mask;
  53. /* Boolean capabilities */
  54. unsigned int has_ibss:1;
  55. unsigned int has_port3:1;
  56. unsigned int has_wep:1;
  57. unsigned int has_big_wep:1;
  58. unsigned int has_mwo:1;
  59. unsigned int has_pm:1;
  60. unsigned int has_preamble:1;
  61. unsigned int has_sensitivity:1;
  62. unsigned int has_hostscan:1;
  63. unsigned int broken_disableport:1;
  64. unsigned int broken_monitor:1;
  65. /* Configuration paramaters */
  66. u32 iw_mode;
  67. int prefer_port3;
  68. u16 wep_on, wep_restrict, tx_key;
  69. struct orinoco_key keys[ORINOCO_MAX_KEYS];
  70. int bitratemode;
  71. char nick[IW_ESSID_MAX_SIZE+1];
  72. char desired_essid[IW_ESSID_MAX_SIZE+1];
  73. char desired_bssid[ETH_ALEN];
  74. int bssid_fixed;
  75. u16 frag_thresh, mwo_robust;
  76. u16 channel;
  77. u16 ap_density, rts_thresh;
  78. u16 pm_on, pm_mcast, pm_period, pm_timeout;
  79. u16 preamble;
  80. #ifdef WIRELESS_SPY
  81. struct iw_spy_data spy_data; /* iwspy support */
  82. struct iw_public_data wireless_data;
  83. #endif
  84. /* Configuration dependent variables */
  85. int port_type, createibss;
  86. int promiscuous, mc_count;
  87. /* Scanning support */
  88. int scan_inprogress; /* Scan pending... */
  89. u32 scan_mode; /* Type of scan done */
  90. char * scan_result; /* Result of previous scan */
  91. int scan_len; /* Lenght of result */
  92. };
  93. #ifdef ORINOCO_DEBUG
  94. extern int orinoco_debug;
  95. #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
  96. #else
  97. #define DEBUG(n, args...) do { } while (0)
  98. #endif /* ORINOCO_DEBUG */
  99. /********************************************************************/
  100. /* Exported prototypes */
  101. /********************************************************************/
  102. extern struct net_device *alloc_orinocodev(int sizeof_card,
  103. int (*hard_reset)(struct orinoco_private *));
  104. extern void free_orinocodev(struct net_device *dev);
  105. extern int __orinoco_up(struct net_device *dev);
  106. extern int __orinoco_down(struct net_device *dev);
  107. extern int orinoco_reinit_firmware(struct net_device *dev);
  108. extern irqreturn_t orinoco_interrupt(int irq, void * dev_id);
  109. /********************************************************************/
  110. /* Locking and synchronization functions */
  111. /********************************************************************/
  112. static inline int orinoco_lock(struct orinoco_private *priv,
  113. unsigned long *flags)
  114. {
  115. spin_lock_irqsave(&priv->lock, *flags);
  116. if (priv->hw_unavailable) {
  117. DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
  118. priv->ndev);
  119. spin_unlock_irqrestore(&priv->lock, *flags);
  120. return -EBUSY;
  121. }
  122. return 0;
  123. }
  124. static inline void orinoco_unlock(struct orinoco_private *priv,
  125. unsigned long *flags)
  126. {
  127. spin_unlock_irqrestore(&priv->lock, *flags);
  128. }
  129. #endif /* _ORINOCO_H */