p54common.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. #ifndef P54COMMON_H
  2. #define P54COMMON_H
  3. /*
  4. * Common code specific definitions for mac80211 Prism54 drivers
  5. *
  6. * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
  7. * Copyright (c) 2007, Christian Lamparter <chunkeey@web.de>
  8. *
  9. * Based on the islsm (softmac prism54) driver, which is:
  10. * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. */
  16. struct bootrec {
  17. __le32 code;
  18. __le32 len;
  19. u32 data[0];
  20. } __attribute__((packed));
  21. struct bootrec_exp_if {
  22. __le16 role;
  23. __le16 if_id;
  24. __le16 variant;
  25. __le16 btm_compat;
  26. __le16 top_compat;
  27. } __attribute__((packed));
  28. struct bootrec_desc {
  29. __le16 modes;
  30. __le16 flags;
  31. __le32 rx_start;
  32. __le32 rx_end;
  33. u8 headroom;
  34. u8 tailroom;
  35. u8 unimportant[6];
  36. u8 rates[16];
  37. } __attribute__((packed));
  38. #define BR_CODE_MIN 0x80000000
  39. #define BR_CODE_COMPONENT_ID 0x80000001
  40. #define BR_CODE_COMPONENT_VERSION 0x80000002
  41. #define BR_CODE_DEPENDENT_IF 0x80000003
  42. #define BR_CODE_EXPOSED_IF 0x80000004
  43. #define BR_CODE_DESCR 0x80000101
  44. #define BR_CODE_MAX 0x8FFFFFFF
  45. #define BR_CODE_END_OF_BRA 0xFF0000FF
  46. #define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF
  47. /* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */
  48. struct pda_entry {
  49. __le16 len; /* includes both code and data */
  50. __le16 code;
  51. u8 data[0];
  52. } __attribute__ ((packed));
  53. struct eeprom_pda_wrap {
  54. __le32 magic;
  55. __le16 pad;
  56. __le16 len;
  57. __le32 arm_opcode;
  58. u8 data[0];
  59. } __attribute__ ((packed));
  60. struct pda_iq_autocal_entry {
  61. __le16 freq;
  62. __le16 iq_param[4];
  63. } __attribute__ ((packed));
  64. struct pda_channel_output_limit {
  65. __le16 freq;
  66. u8 val_bpsk;
  67. u8 val_qpsk;
  68. u8 val_16qam;
  69. u8 val_64qam;
  70. u8 rate_set_mask;
  71. u8 rate_set_size;
  72. } __attribute__ ((packed));
  73. struct pda_pa_curve_data_sample_rev0 {
  74. u8 rf_power;
  75. u8 pa_detector;
  76. u8 pcv;
  77. } __attribute__ ((packed));
  78. struct pda_pa_curve_data_sample_rev1 {
  79. u8 rf_power;
  80. u8 pa_detector;
  81. u8 data_barker;
  82. u8 data_bpsk;
  83. u8 data_qpsk;
  84. u8 data_16qam;
  85. u8 data_64qam;
  86. } __attribute__ ((packed));
  87. struct p54_pa_curve_data_sample {
  88. u8 rf_power;
  89. u8 pa_detector;
  90. u8 data_barker;
  91. u8 data_bpsk;
  92. u8 data_qpsk;
  93. u8 data_16qam;
  94. u8 data_64qam;
  95. u8 padding;
  96. } __attribute__ ((packed));
  97. struct pda_pa_curve_data {
  98. u8 cal_method_rev;
  99. u8 channels;
  100. u8 points_per_channel;
  101. u8 padding;
  102. u8 data[0];
  103. } __attribute__ ((packed));
  104. /*
  105. * this defines the PDR codes used to build PDAs as defined in document
  106. * number 553155. The current implementation mirrors version 1.1 of the
  107. * document and lists only PDRs supported by the ARM platform.
  108. */
  109. /* common and choice range (0x0000 - 0x0fff) */
  110. #define PDR_END 0x0000
  111. #define PDR_MANUFACTURING_PART_NUMBER 0x0001
  112. #define PDR_PDA_VERSION 0x0002
  113. #define PDR_NIC_SERIAL_NUMBER 0x0003
  114. #define PDR_MAC_ADDRESS 0x0101
  115. #define PDR_REGULATORY_DOMAIN_LIST 0x0103
  116. #define PDR_TEMPERATURE_TYPE 0x0107
  117. #define PDR_PRISM_PCI_IDENTIFIER 0x0402
  118. /* ARM range (0x1000 - 0x1fff) */
  119. #define PDR_COUNTRY_INFORMATION 0x1000
  120. #define PDR_INTERFACE_LIST 0x1001
  121. #define PDR_HARDWARE_PLATFORM_COMPONENT_ID 0x1002
  122. #define PDR_OEM_NAME 0x1003
  123. #define PDR_PRODUCT_NAME 0x1004
  124. #define PDR_UTF8_OEM_NAME 0x1005
  125. #define PDR_UTF8_PRODUCT_NAME 0x1006
  126. #define PDR_COUNTRY_LIST 0x1007
  127. #define PDR_DEFAULT_COUNTRY 0x1008
  128. #define PDR_ANTENNA_GAIN 0x1100
  129. #define PDR_PRISM_INDIGO_PA_CALIBRATION_DATA 0x1901
  130. #define PDR_RSSI_LINEAR_APPROXIMATION 0x1902
  131. #define PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS 0x1903
  132. #define PDR_PRISM_PA_CAL_CURVE_DATA 0x1904
  133. #define PDR_RSSI_LINEAR_APPROXIMATION_DUAL_BAND 0x1905
  134. #define PDR_PRISM_ZIF_TX_IQ_CALIBRATION 0x1906
  135. #define PDR_REGULATORY_POWER_LIMITS 0x1907
  136. #define PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED 0x1908
  137. #define PDR_RADIATED_TRANSMISSION_CORRECTION 0x1909
  138. #define PDR_PRISM_TX_IQ_CALIBRATION 0x190a
  139. /* reserved range (0x2000 - 0x7fff) */
  140. /* customer range (0x8000 - 0xffff) */
  141. #define PDR_BASEBAND_REGISTERS 0x8000
  142. #define PDR_PER_CHANNEL_BASEBAND_REGISTERS 0x8001
  143. /* stored in skb->cb */
  144. struct memrecord {
  145. u32 start_addr;
  146. u32 end_addr;
  147. };
  148. struct p54_eeprom_lm86 {
  149. __le16 offset;
  150. __le16 len;
  151. u8 data[0];
  152. } __attribute__ ((packed));
  153. struct p54_rx_hdr {
  154. __le16 magic;
  155. __le16 len;
  156. __le16 freq;
  157. u8 antenna;
  158. u8 rate;
  159. u8 rssi;
  160. u8 quality;
  161. u16 unknown2;
  162. __le64 timestamp;
  163. u8 align[0];
  164. } __attribute__ ((packed));
  165. struct p54_frame_sent_hdr {
  166. u8 status;
  167. u8 retries;
  168. __le16 ack_rssi;
  169. __le16 seq;
  170. u16 rate;
  171. } __attribute__ ((packed));
  172. struct p54_tx_control_allocdata {
  173. u8 rateset[8];
  174. u8 unalloc0[2];
  175. u8 key_type;
  176. u8 key_len;
  177. u8 key[16];
  178. u8 hw_queue;
  179. u8 unalloc1[9];
  180. u8 tx_antenna;
  181. u8 output_power;
  182. u8 cts_rate;
  183. u8 unalloc2[3];
  184. u8 align[0];
  185. } __attribute__ ((packed));
  186. struct p54_tx_control_filter {
  187. __le16 filter_type;
  188. u8 mac_addr[ETH_ALEN];
  189. u8 bssid[ETH_ALEN];
  190. u8 rx_antenna;
  191. u8 rx_align;
  192. union {
  193. struct {
  194. __le32 basic_rate_mask;
  195. u8 rts_rates[8];
  196. __le32 rx_addr;
  197. __le16 max_rx;
  198. __le16 rxhw;
  199. __le16 wakeup_timer;
  200. __le16 unalloc0;
  201. } v1 __attribute__ ((packed));
  202. struct {
  203. __le32 rx_addr;
  204. __le16 max_rx;
  205. __le16 rxhw;
  206. __le16 timer;
  207. __le16 unalloc0;
  208. __le32 unalloc1;
  209. } v2 __attribute__ ((packed));
  210. } __attribute__ ((packed));
  211. } __attribute__ ((packed));
  212. #define P54_TX_CONTROL_FILTER_V1_LEN (sizeof(struct p54_tx_control_filter))
  213. #define P54_TX_CONTROL_FILTER_V2_LEN (sizeof(struct p54_tx_control_filter)-8)
  214. struct p54_tx_control_channel {
  215. __le16 flags;
  216. __le16 dwell;
  217. u8 padding1[20];
  218. struct pda_iq_autocal_entry iq_autocal;
  219. u8 pa_points_per_curve;
  220. u8 val_barker;
  221. u8 val_bpsk;
  222. u8 val_qpsk;
  223. u8 val_16qam;
  224. u8 val_64qam;
  225. struct p54_pa_curve_data_sample curve_data[8];
  226. u8 dup_bpsk;
  227. u8 dup_qpsk;
  228. u8 dup_16qam;
  229. u8 dup_64qam;
  230. union {
  231. struct {
  232. __le16 rssical_mul;
  233. __le16 rssical_add;
  234. } v1 __attribute__ ((packed));
  235. struct {
  236. __le32 basic_rate_mask;
  237. u8 rts_rates[8];
  238. __le16 rssical_mul;
  239. __le16 rssical_add;
  240. } v2 __attribute__ ((packed));
  241. } __attribute__ ((packed));
  242. } __attribute__ ((packed));
  243. #define P54_TX_CONTROL_CHANNEL_V1_LEN (sizeof(struct p54_tx_control_channel)-12)
  244. #define P54_TX_CONTROL_CHANNEL_V2_LEN (sizeof(struct p54_tx_control_channel))
  245. struct p54_tx_control_led {
  246. __le16 mode;
  247. __le16 led_temporary;
  248. __le16 led_permanent;
  249. __le16 duration;
  250. } __attribute__ ((packed));
  251. struct p54_tx_vdcf_queues {
  252. __le16 aifs;
  253. __le16 cwmin;
  254. __le16 cwmax;
  255. __le16 txop;
  256. } __attribute__ ((packed));
  257. struct p54_tx_control_vdcf {
  258. u8 padding;
  259. u8 slottime;
  260. u8 magic1;
  261. u8 magic2;
  262. struct p54_tx_vdcf_queues queue[8];
  263. u8 pad2[4];
  264. __le16 frameburst;
  265. } __attribute__ ((packed));
  266. #endif /* P54COMMON_H */