p54common.h 7.1 KB

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