orinoco.h 4.1 KB

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