p54common.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. #ifndef PRISM54COMMON_H
  2. #define PRISM54COMMON_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. #define BR_CODE_MIN 0x80000000
  29. #define BR_CODE_COMPONENT_ID 0x80000001
  30. #define BR_CODE_COMPONENT_VERSION 0x80000002
  31. #define BR_CODE_DEPENDENT_IF 0x80000003
  32. #define BR_CODE_EXPOSED_IF 0x80000004
  33. #define BR_CODE_DESCR 0x80000101
  34. #define BR_CODE_MAX 0x8FFFFFFF
  35. #define BR_CODE_END_OF_BRA 0xFF0000FF
  36. #define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF
  37. #define FW_FMAC 0x464d4143
  38. #define FW_LM86 0x4c4d3836
  39. #define FW_LM87 0x4c4d3837
  40. #define FW_LM20 0x4c4d3230
  41. /* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */
  42. struct pda_entry {
  43. __le16 len; /* includes both code and data */
  44. __le16 code;
  45. u8 data[0];
  46. } __attribute__ ((packed));
  47. struct eeprom_pda_wrap {
  48. u32 magic;
  49. u16 pad;
  50. u16 len;
  51. u32 arm_opcode;
  52. u8 data[0];
  53. } __attribute__ ((packed));
  54. struct pda_iq_autocal_entry {
  55. __le16 freq;
  56. __le16 iq_param[4];
  57. } __attribute__ ((packed));
  58. struct pda_channel_output_limit {
  59. __le16 freq;
  60. u8 val_bpsk;
  61. u8 val_qpsk;
  62. u8 val_16qam;
  63. u8 val_64qam;
  64. u8 rate_set_mask;
  65. u8 rate_set_size;
  66. } __attribute__ ((packed));
  67. struct pda_pa_curve_data_sample_rev0 {
  68. u8 rf_power;
  69. u8 pa_detector;
  70. u8 pcv;
  71. } __attribute__ ((packed));
  72. struct pda_pa_curve_data_sample_rev1 {
  73. u8 rf_power;
  74. u8 pa_detector;
  75. u8 data_barker;
  76. u8 data_bpsk;
  77. u8 data_qpsk;
  78. u8 data_16qam;
  79. u8 data_64qam;
  80. u8 padding;
  81. } __attribute__ ((packed));
  82. struct pda_pa_curve_data {
  83. u8 cal_method_rev;
  84. u8 channels;
  85. u8 points_per_channel;
  86. u8 padding;
  87. u8 data[0];
  88. } __attribute__ ((packed));
  89. /*
  90. * this defines the PDR codes used to build PDAs as defined in document
  91. * number 553155. The current implementation mirrors version 1.1 of the
  92. * document and lists only PDRs supported by the ARM platform.
  93. */
  94. /* common and choice range (0x0000 - 0x0fff) */
  95. #define PDR_END 0x0000
  96. #define PDR_MANUFACTURING_PART_NUMBER 0x0001
  97. #define PDR_PDA_VERSION 0x0002
  98. #define PDR_NIC_SERIAL_NUMBER 0x0003
  99. #define PDR_MAC_ADDRESS 0x0101
  100. #define PDR_REGULATORY_DOMAIN_LIST 0x0103
  101. #define PDR_TEMPERATURE_TYPE 0x0107
  102. #define PDR_PRISM_PCI_IDENTIFIER 0x0402
  103. /* ARM range (0x1000 - 0x1fff) */
  104. #define PDR_COUNTRY_INFORMATION 0x1000
  105. #define PDR_INTERFACE_LIST 0x1001
  106. #define PDR_HARDWARE_PLATFORM_COMPONENT_ID 0x1002
  107. #define PDR_OEM_NAME 0x1003
  108. #define PDR_PRODUCT_NAME 0x1004
  109. #define PDR_UTF8_OEM_NAME 0x1005
  110. #define PDR_UTF8_PRODUCT_NAME 0x1006
  111. #define PDR_COUNTRY_LIST 0x1007
  112. #define PDR_DEFAULT_COUNTRY 0x1008
  113. #define PDR_ANTENNA_GAIN 0x1100
  114. #define PDR_PRISM_INDIGO_PA_CALIBRATION_DATA 0x1901
  115. #define PDR_RSSI_LINEAR_APPROXIMATION 0x1902
  116. #define PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS 0x1903
  117. #define PDR_PRISM_PA_CAL_CURVE_DATA 0x1904
  118. #define PDR_RSSI_LINEAR_APPROXIMATION_DUAL_BAND 0x1905
  119. #define PDR_PRISM_ZIF_TX_IQ_CALIBRATION 0x1906
  120. #define PDR_REGULATORY_POWER_LIMITS 0x1907
  121. #define PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED 0x1908
  122. #define PDR_RADIATED_TRANSMISSION_CORRECTION 0x1909
  123. #define PDR_PRISM_TX_IQ_CALIBRATION 0x190a
  124. /* reserved range (0x2000 - 0x7fff) */
  125. /* customer range (0x8000 - 0xffff) */
  126. #define PDR_BASEBAND_REGISTERS 0x8000
  127. #define PDR_PER_CHANNEL_BASEBAND_REGISTERS 0x8001
  128. /* stored in skb->cb */
  129. struct memrecord {
  130. u32 start_addr;
  131. u32 end_addr;
  132. struct ieee80211_tx_control *control;
  133. };
  134. struct p54_eeprom_lm86 {
  135. __le16 offset;
  136. __le16 len;
  137. u8 data[0];
  138. } __attribute__ ((packed));
  139. struct p54_rx_hdr {
  140. __le16 magic;
  141. __le16 len;
  142. __le16 freq;
  143. u8 antenna;
  144. u8 rate;
  145. u8 rssi;
  146. u8 quality;
  147. u16 unknown2;
  148. __le64 timestamp;
  149. u8 data[0];
  150. } __attribute__ ((packed));
  151. struct p54_frame_sent_hdr {
  152. u8 status;
  153. u8 retries;
  154. __le16 ack_rssi;
  155. __le16 seq;
  156. u16 rate;
  157. } __attribute__ ((packed));
  158. struct p54_tx_control_allocdata {
  159. u8 rateset[8];
  160. u16 padding;
  161. u8 wep_key_present;
  162. u8 wep_key_len;
  163. u8 wep_key[16];
  164. __le32 frame_type;
  165. u32 padding2;
  166. __le16 magic4;
  167. u8 antenna;
  168. u8 output_power;
  169. __le32 magic5;
  170. u8 align[0];
  171. } __attribute__ ((packed));
  172. struct p54_tx_control_filter {
  173. __le16 filter_type;
  174. u8 dst[ETH_ALEN];
  175. u8 src[ETH_ALEN];
  176. u8 antenna;
  177. u8 debug;
  178. __le32 magic3;
  179. u8 rates[8]; // FIXME: what's this for?
  180. __le32 rx_addr;
  181. __le16 max_rx;
  182. __le16 rxhw;
  183. __le16 magic8;
  184. __le16 magic9;
  185. } __attribute__ ((packed));
  186. struct p54_tx_control_channel {
  187. __le16 magic1;
  188. __le16 magic2;
  189. u8 padding1[20];
  190. struct pda_iq_autocal_entry iq_autocal;
  191. u8 pa_points_per_curve;
  192. u8 val_barker;
  193. u8 val_bpsk;
  194. u8 val_qpsk;
  195. u8 val_16qam;
  196. u8 val_64qam;
  197. struct pda_pa_curve_data_sample_rev1 curve_data[0];
  198. /* additional padding/data after curve_data */
  199. } __attribute__ ((packed));
  200. struct p54_tx_control_led {
  201. __le16 mode;
  202. __le16 led_temporary;
  203. __le16 led_permanent;
  204. __le16 duration;
  205. } __attribute__ ((packed));
  206. struct p54_tx_vdcf_queues {
  207. __le16 aifs;
  208. __le16 cwmin;
  209. __le16 cwmax;
  210. __le16 txop;
  211. } __attribute__ ((packed));
  212. struct p54_tx_control_vdcf {
  213. u8 padding;
  214. u8 slottime;
  215. u8 magic1;
  216. u8 magic2;
  217. struct p54_tx_vdcf_queues queue[8];
  218. u8 pad2[4];
  219. __le16 frameburst;
  220. } __attribute__ ((packed));
  221. static const struct ieee80211_rate p54_rates[] = {
  222. { .rate = 10,
  223. .val = 0,
  224. .val2 = 0x10,
  225. .flags = IEEE80211_RATE_CCK_2 },
  226. { .rate = 20,
  227. .val = 1,
  228. .val2 = 0x11,
  229. .flags = IEEE80211_RATE_CCK_2 },
  230. { .rate = 55,
  231. .val = 2,
  232. .val2 = 0x12,
  233. .flags = IEEE80211_RATE_CCK_2 },
  234. { .rate = 110,
  235. .val = 3,
  236. .val2 = 0x13,
  237. .flags = IEEE80211_RATE_CCK_2 },
  238. { .rate = 60,
  239. .val = 4,
  240. .flags = IEEE80211_RATE_OFDM },
  241. { .rate = 90,
  242. .val = 5,
  243. .flags = IEEE80211_RATE_OFDM },
  244. { .rate = 120,
  245. .val = 6,
  246. .flags = IEEE80211_RATE_OFDM },
  247. { .rate = 180,
  248. .val = 7,
  249. .flags = IEEE80211_RATE_OFDM },
  250. { .rate = 240,
  251. .val = 8,
  252. .flags = IEEE80211_RATE_OFDM },
  253. { .rate = 360,
  254. .val = 9,
  255. .flags = IEEE80211_RATE_OFDM },
  256. { .rate = 480,
  257. .val = 10,
  258. .flags = IEEE80211_RATE_OFDM },
  259. { .rate = 540,
  260. .val = 11,
  261. .flags = IEEE80211_RATE_OFDM },
  262. };
  263. // TODO: just generate this..
  264. static const struct ieee80211_channel p54_channels[] = {
  265. { .chan = 1,
  266. .freq = 2412},
  267. { .chan = 2,
  268. .freq = 2417},
  269. { .chan = 3,
  270. .freq = 2422},
  271. { .chan = 4,
  272. .freq = 2427},
  273. { .chan = 5,
  274. .freq = 2432},
  275. { .chan = 6,
  276. .freq = 2437},
  277. { .chan = 7,
  278. .freq = 2442},
  279. { .chan = 8,
  280. .freq = 2447},
  281. { .chan = 9,
  282. .freq = 2452},
  283. { .chan = 10,
  284. .freq = 2457},
  285. { .chan = 11,
  286. .freq = 2462},
  287. { .chan = 12,
  288. .freq = 2467},
  289. { .chan = 13,
  290. .freq = 2472},
  291. { .chan = 14,
  292. .freq = 2484}
  293. };
  294. #endif /* PRISM54COMMON_H */