p54.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. #ifndef P54_H
  2. #define P54_H
  3. /*
  4. * Shared defines for all mac80211 Prism54 code
  5. *
  6. * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
  7. *
  8. * Based on the islsm (softmac prism54) driver, which is:
  9. * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #ifdef CONFIG_P54_LEDS
  16. #include <linux/leds.h>
  17. #endif /* CONFIG_P54_LEDS */
  18. enum p54_control_frame_types {
  19. P54_CONTROL_TYPE_SETUP = 0,
  20. P54_CONTROL_TYPE_SCAN,
  21. P54_CONTROL_TYPE_TRAP,
  22. P54_CONTROL_TYPE_DCFINIT,
  23. P54_CONTROL_TYPE_RX_KEYCACHE,
  24. P54_CONTROL_TYPE_TIM,
  25. P54_CONTROL_TYPE_PSM,
  26. P54_CONTROL_TYPE_TXCANCEL,
  27. P54_CONTROL_TYPE_TXDONE,
  28. P54_CONTROL_TYPE_BURST,
  29. P54_CONTROL_TYPE_STAT_READBACK,
  30. P54_CONTROL_TYPE_BBP,
  31. P54_CONTROL_TYPE_EEPROM_READBACK,
  32. P54_CONTROL_TYPE_LED,
  33. P54_CONTROL_TYPE_GPIO,
  34. P54_CONTROL_TYPE_TIMER,
  35. P54_CONTROL_TYPE_MODULATION,
  36. P54_CONTROL_TYPE_SYNTH_CONFIG,
  37. P54_CONTROL_TYPE_DETECTOR_VALUE,
  38. P54_CONTROL_TYPE_XBOW_SYNTH_CFG,
  39. P54_CONTROL_TYPE_CCE_QUIET,
  40. P54_CONTROL_TYPE_PSM_STA_UNLOCK,
  41. P54_CONTROL_TYPE_PCS,
  42. P54_CONTROL_TYPE_BT_BALANCER = 28,
  43. P54_CONTROL_TYPE_GROUP_ADDRESS_TABLE = 30,
  44. P54_CONTROL_TYPE_ARPTABLE = 31,
  45. P54_CONTROL_TYPE_BT_OPTIONS = 35
  46. };
  47. /* provide 16 bytes for the transport back-end */
  48. #define P54_TX_INFO_DATA_SIZE 16
  49. /* stored in ieee80211_tx_info's rate_driver_data */
  50. struct p54_tx_info {
  51. u32 start_addr;
  52. u32 end_addr;
  53. void *data[P54_TX_INFO_DATA_SIZE / sizeof(void *)];
  54. };
  55. #define P54_MAX_CTRL_FRAME_LEN 0x1000
  56. #define P54_HDR_FLAG_CONTROL BIT(15)
  57. #define P54_HDR_FLAG_CONTROL_OPSET (BIT(15) + BIT(0))
  58. struct p54_hdr {
  59. __le16 flags;
  60. __le16 len;
  61. __le32 req_id;
  62. __le16 type; /* enum p54_control_frame_types */
  63. u8 rts_tries;
  64. u8 tries;
  65. u8 data[0];
  66. } __attribute__ ((packed));
  67. #define FREE_AFTER_TX(skb) \
  68. ((((struct p54_hdr *) ((struct sk_buff *) skb)->data)-> \
  69. flags) == cpu_to_le16(P54_HDR_FLAG_CONTROL_OPSET))
  70. struct p54_edcf_queue_param {
  71. __le16 aifs;
  72. __le16 cwmin;
  73. __le16 cwmax;
  74. __le16 txop;
  75. } __attribute__ ((packed));
  76. struct p54_rssi_linear_approximation {
  77. s16 mul;
  78. s16 add;
  79. s16 longbow_unkn;
  80. s16 longbow_unk2;
  81. };
  82. struct p54_cal_database {
  83. size_t entries;
  84. size_t entry_size;
  85. size_t offset;
  86. size_t len;
  87. u8 data[0];
  88. };
  89. #define EEPROM_READBACK_LEN 0x3fc
  90. #define ISL38XX_DEV_FIRMWARE_ADDR 0x20000
  91. #define FW_FMAC 0x464d4143
  92. #define FW_LM86 0x4c4d3836
  93. #define FW_LM87 0x4c4d3837
  94. #define FW_LM20 0x4c4d3230
  95. enum fw_state {
  96. FW_STATE_OFF,
  97. FW_STATE_BOOTING,
  98. FW_STATE_READY,
  99. FW_STATE_RESET,
  100. FW_STATE_RESETTING,
  101. };
  102. #ifdef CONFIG_P54_LEDS
  103. #define P54_LED_MAX_NAME_LEN 31
  104. struct p54_led_dev {
  105. struct ieee80211_hw *hw_dev;
  106. struct led_classdev led_dev;
  107. char name[P54_LED_MAX_NAME_LEN + 1];
  108. unsigned int index;
  109. unsigned int registered;
  110. };
  111. #endif /* CONFIG_P54_LEDS */
  112. struct p54_common {
  113. struct ieee80211_hw *hw;
  114. u32 rx_start;
  115. u32 rx_end;
  116. struct sk_buff_head tx_queue;
  117. void (*tx)(struct ieee80211_hw *dev, struct sk_buff *skb);
  118. int (*open)(struct ieee80211_hw *dev);
  119. void (*stop)(struct ieee80211_hw *dev);
  120. int mode;
  121. u16 rx_mtu;
  122. u8 headroom;
  123. u8 tailroom;
  124. struct mutex conf_mutex;
  125. u8 mac_addr[ETH_ALEN];
  126. u8 bssid[ETH_ALEN];
  127. u8 rx_diversity_mask;
  128. u8 tx_diversity_mask;
  129. struct pda_iq_autocal_entry *iq_autocal;
  130. unsigned int iq_autocal_len;
  131. struct p54_cal_database *output_limit;
  132. struct p54_cal_database *curve_data;
  133. struct p54_rssi_linear_approximation rssical_db[IEEE80211_NUM_BANDS];
  134. unsigned int filter_flags;
  135. bool use_short_slot;
  136. u16 rxhw;
  137. u8 version;
  138. unsigned int tx_hdr_len;
  139. unsigned int fw_var;
  140. unsigned int fw_interface;
  141. unsigned int output_power;
  142. u32 tsf_low32;
  143. u32 tsf_high32;
  144. u32 basic_rate_mask;
  145. u16 wakeup_timer;
  146. u16 aid;
  147. struct ieee80211_tx_queue_stats tx_stats[8];
  148. struct p54_edcf_queue_param qos_params[8];
  149. struct ieee80211_low_level_stats stats;
  150. struct delayed_work work;
  151. struct sk_buff *cached_beacon;
  152. int noise;
  153. void *eeprom;
  154. struct completion eeprom_comp;
  155. u8 privacy_caps;
  156. u8 rx_keycache_size;
  157. /* LED management */
  158. #ifdef CONFIG_P54_LEDS
  159. struct p54_led_dev assoc_led;
  160. struct p54_led_dev tx_led;
  161. #endif /* CONFIG_P54_LEDS */
  162. u16 softled_state; /* bit field of glowing LEDs */
  163. };
  164. int p54_rx(struct ieee80211_hw *dev, struct sk_buff *skb);
  165. void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb);
  166. int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw);
  167. int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len);
  168. int p54_read_eeprom(struct ieee80211_hw *dev);
  169. struct ieee80211_hw *p54_init_common(size_t priv_data_len);
  170. int p54_register_common(struct ieee80211_hw *dev, struct device *pdev);
  171. void p54_free_common(struct ieee80211_hw *dev);
  172. #endif /* P54_H */