orinoco.h 4.6 KB

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