orinoco.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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.14alpha2"
  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 ORINOCO_MAX_KEY_SIZE 14
  19. #define ORINOCO_MAX_KEYS 4
  20. struct orinoco_key {
  21. u16 len; /* always stored as little-endian */
  22. char data[ORINOCO_MAX_KEY_SIZE];
  23. } __attribute__ ((packed));
  24. typedef enum {
  25. FIRMWARE_TYPE_AGERE,
  26. FIRMWARE_TYPE_INTERSIL,
  27. FIRMWARE_TYPE_SYMBOL
  28. } fwtype_t;
  29. struct orinoco_private {
  30. void *card; /* Pointer to card dependent structure */
  31. int (*hard_reset)(struct orinoco_private *);
  32. /* Synchronisation stuff */
  33. spinlock_t lock;
  34. int hw_unavailable;
  35. struct work_struct reset_work;
  36. /* driver state */
  37. int open;
  38. u16 last_linkstatus;
  39. /* Net device stuff */
  40. struct net_device *ndev;
  41. struct net_device_stats stats;
  42. struct iw_statistics wstats;
  43. /* Hardware control variables */
  44. hermes_t hw;
  45. u16 txfid;
  46. /* Capabilities of the hardware/firmware */
  47. fwtype_t firmware_type;
  48. char fw_name[32];
  49. int ibss_port;
  50. int nicbuf_size;
  51. u16 channel_mask;
  52. /* Boolean capabilities */
  53. unsigned int has_ibss:1;
  54. unsigned int has_port3:1;
  55. unsigned int has_wep:1;
  56. unsigned int has_big_wep:1;
  57. unsigned int has_mwo:1;
  58. unsigned int has_pm:1;
  59. unsigned int has_preamble:1;
  60. unsigned int has_sensitivity:1;
  61. unsigned int broken_disableport:1;
  62. /* Configuration paramaters */
  63. u32 iw_mode;
  64. int prefer_port3;
  65. u16 wep_on, wep_restrict, tx_key;
  66. struct orinoco_key keys[ORINOCO_MAX_KEYS];
  67. int bitratemode;
  68. char nick[IW_ESSID_MAX_SIZE+1];
  69. char desired_essid[IW_ESSID_MAX_SIZE+1];
  70. u16 frag_thresh, mwo_robust;
  71. u16 channel;
  72. u16 ap_density, rts_thresh;
  73. u16 pm_on, pm_mcast, pm_period, pm_timeout;
  74. u16 preamble;
  75. #ifdef WIRELESS_SPY
  76. int spy_number;
  77. u_char spy_address[IW_MAX_SPY][ETH_ALEN];
  78. struct iw_quality spy_stat[IW_MAX_SPY];
  79. #endif
  80. /* Configuration dependent variables */
  81. int port_type, createibss;
  82. int promiscuous, mc_count;
  83. };
  84. #ifdef ORINOCO_DEBUG
  85. extern int orinoco_debug;
  86. #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
  87. #else
  88. #define DEBUG(n, args...) do { } while (0)
  89. #endif /* ORINOCO_DEBUG */
  90. #define TRACE_ENTER(devname) DEBUG(2, "%s: -> %s()\n", devname, __FUNCTION__);
  91. #define TRACE_EXIT(devname) DEBUG(2, "%s: <- %s()\n", devname, __FUNCTION__);
  92. /********************************************************************/
  93. /* Exported prototypes */
  94. /********************************************************************/
  95. extern struct net_device *alloc_orinocodev(int sizeof_card,
  96. int (*hard_reset)(struct orinoco_private *));
  97. extern void free_orinocodev(struct net_device *dev);
  98. extern int __orinoco_up(struct net_device *dev);
  99. extern int __orinoco_down(struct net_device *dev);
  100. extern int orinoco_stop(struct net_device *dev);
  101. extern int orinoco_reinit_firmware(struct net_device *dev);
  102. extern irqreturn_t orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs);
  103. /********************************************************************/
  104. /* Locking and synchronization functions */
  105. /********************************************************************/
  106. /* These functions *must* be inline or they will break horribly on
  107. * SPARC, due to its weird semantics for save/restore flags. extern
  108. * inline should prevent the kernel from linking or module from
  109. * loading if they are not inlined. */
  110. extern inline int orinoco_lock(struct orinoco_private *priv,
  111. unsigned long *flags)
  112. {
  113. spin_lock_irqsave(&priv->lock, *flags);
  114. if (priv->hw_unavailable) {
  115. DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
  116. priv->ndev);
  117. spin_unlock_irqrestore(&priv->lock, *flags);
  118. return -EBUSY;
  119. }
  120. return 0;
  121. }
  122. extern inline void orinoco_unlock(struct orinoco_private *priv,
  123. unsigned long *flags)
  124. {
  125. spin_unlock_irqrestore(&priv->lock, *flags);
  126. }
  127. #endif /* _ORINOCO_H */