orinoco.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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.15rc2"
  9. #include <linux/types.h>
  10. #include <linux/spinlock.h>
  11. #include <linux/netdevice.h>
  12. #include <linux/wireless.h>
  13. #include <linux/version.h>
  14. #include "hermes.h"
  15. /* To enable debug messages */
  16. //#define ORINOCO_DEBUG 3
  17. #define WIRELESS_SPY // enable iwspy support
  18. #define MAX_SCAN_LEN 4096
  19. #define ORINOCO_MAX_KEY_SIZE 14
  20. #define ORINOCO_MAX_KEYS 4
  21. struct orinoco_key {
  22. u16 len; /* always stored as little-endian */
  23. char data[ORINOCO_MAX_KEY_SIZE];
  24. } __attribute__ ((packed));
  25. struct header_struct {
  26. /* 802.3 */
  27. u8 dest[ETH_ALEN];
  28. u8 src[ETH_ALEN];
  29. u16 len;
  30. /* 802.2 */
  31. u8 dsap;
  32. u8 ssap;
  33. u8 ctrl;
  34. /* SNAP */
  35. u8 oui[3];
  36. u16 ethertype;
  37. } __attribute__ ((packed));
  38. typedef enum {
  39. FIRMWARE_TYPE_AGERE,
  40. FIRMWARE_TYPE_INTERSIL,
  41. FIRMWARE_TYPE_SYMBOL
  42. } fwtype_t;
  43. struct orinoco_private {
  44. void *card; /* Pointer to card dependent structure */
  45. int (*hard_reset)(struct orinoco_private *);
  46. /* Synchronisation stuff */
  47. spinlock_t lock;
  48. int hw_unavailable;
  49. struct work_struct reset_work;
  50. /* driver state */
  51. int open;
  52. u16 last_linkstatus;
  53. struct work_struct join_work;
  54. struct work_struct wevent_work;
  55. /* Net device stuff */
  56. struct net_device *ndev;
  57. struct net_device_stats stats;
  58. struct iw_statistics wstats;
  59. /* Hardware control variables */
  60. hermes_t hw;
  61. u16 txfid;
  62. /* Capabilities of the hardware/firmware */
  63. fwtype_t firmware_type;
  64. char fw_name[32];
  65. int ibss_port;
  66. int nicbuf_size;
  67. u16 channel_mask;
  68. /* Boolean capabilities */
  69. unsigned int has_ibss:1;
  70. unsigned int has_port3:1;
  71. unsigned int has_wep:1;
  72. unsigned int has_big_wep:1;
  73. unsigned int has_mwo:1;
  74. unsigned int has_pm:1;
  75. unsigned int has_preamble:1;
  76. unsigned int has_sensitivity:1;
  77. unsigned int has_hostscan:1;
  78. unsigned int broken_disableport:1;
  79. unsigned int broken_monitor:1;
  80. /* Configuration paramaters */
  81. u32 iw_mode;
  82. int prefer_port3;
  83. u16 wep_on, wep_restrict, tx_key;
  84. struct orinoco_key keys[ORINOCO_MAX_KEYS];
  85. int bitratemode;
  86. char nick[IW_ESSID_MAX_SIZE+1];
  87. char desired_essid[IW_ESSID_MAX_SIZE+1];
  88. char desired_bssid[ETH_ALEN];
  89. int bssid_fixed;
  90. u16 frag_thresh, mwo_robust;
  91. u16 channel;
  92. u16 ap_density, rts_thresh;
  93. u16 pm_on, pm_mcast, pm_period, pm_timeout;
  94. u16 preamble;
  95. #ifdef WIRELESS_SPY
  96. int spy_number;
  97. u_char spy_address[IW_MAX_SPY][ETH_ALEN];
  98. struct iw_quality spy_stat[IW_MAX_SPY];
  99. #endif
  100. /* Configuration dependent variables */
  101. int port_type, createibss;
  102. int promiscuous, mc_count;
  103. /* Scanning support */
  104. int scan_inprogress; /* Scan pending... */
  105. u32 scan_mode; /* Type of scan done */
  106. char * scan_result; /* Result of previous scan */
  107. int scan_len; /* Lenght of result */
  108. };
  109. #ifdef ORINOCO_DEBUG
  110. extern int orinoco_debug;
  111. #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
  112. #else
  113. #define DEBUG(n, args...) do { } while (0)
  114. #endif /* ORINOCO_DEBUG */
  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. /* Exported prototypes */
  119. /********************************************************************/
  120. extern struct net_device *alloc_orinocodev(int sizeof_card,
  121. int (*hard_reset)(struct orinoco_private *));
  122. extern void free_orinocodev(struct net_device *dev);
  123. extern int __orinoco_up(struct net_device *dev);
  124. extern int __orinoco_down(struct net_device *dev);
  125. extern int orinoco_reinit_firmware(struct net_device *dev);
  126. extern irqreturn_t orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs);
  127. /********************************************************************/
  128. /* Locking and synchronization functions */
  129. /********************************************************************/
  130. /* These functions *must* be inline or they will break horribly on
  131. * SPARC, due to its weird semantics for save/restore flags. extern
  132. * inline should prevent the kernel from linking or module from
  133. * loading if they are not inlined. */
  134. extern inline int orinoco_lock(struct orinoco_private *priv,
  135. unsigned long *flags)
  136. {
  137. spin_lock_irqsave(&priv->lock, *flags);
  138. if (priv->hw_unavailable) {
  139. DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
  140. priv->ndev);
  141. spin_unlock_irqrestore(&priv->lock, *flags);
  142. return -EBUSY;
  143. }
  144. return 0;
  145. }
  146. extern inline void orinoco_unlock(struct orinoco_private *priv,
  147. unsigned long *flags)
  148. {
  149. spin_unlock_irqrestore(&priv->lock, *flags);
  150. }
  151. #endif /* _ORINOCO_H */