orinoco.h 4.6 KB

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