p54common.h 7.1 KB

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