Christian Lamparter | 32ddf07 | 2008-08-08 21:17:37 +0200 | [diff] [blame] | 1 | #ifndef P54COMMON_H |
| 2 | #define P54COMMON_H |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 3 | |
| 4 | /* |
| 5 | * Common code specific definitions for mac80211 Prism54 drivers |
| 6 | * |
| 7 | * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> |
| 8 | * Copyright (c) 2007, Christian Lamparter <chunkeey@web.de> |
| 9 | * |
Christian Lamparter | 0fdd7c5 | 2008-10-15 03:55:37 +0200 | [diff] [blame] | 10 | * Based on: |
| 11 | * - the islsm (softmac prism54) driver, which is: |
| 12 | * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al. |
| 13 | * |
| 14 | * - LMAC API interface header file for STLC4560 (lmac_longbow.h) |
| 15 | * Copyright (C) 2007 Conexant Systems, Inc. |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 16 | * |
| 17 | * This program is free software; you can redistribute it and/or modify |
| 18 | * it under the terms of the GNU General Public License version 2 as |
| 19 | * published by the Free Software Foundation. |
| 20 | */ |
| 21 | |
| 22 | struct bootrec { |
| 23 | __le32 code; |
| 24 | __le32 len; |
Larry Finger | 1f1c0e3 | 2008-09-25 14:54:28 -0500 | [diff] [blame] | 25 | u32 data[10]; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 26 | } __attribute__((packed)); |
| 27 | |
| 28 | struct bootrec_exp_if { |
| 29 | __le16 role; |
| 30 | __le16 if_id; |
| 31 | __le16 variant; |
| 32 | __le16 btm_compat; |
| 33 | __le16 top_compat; |
| 34 | } __attribute__((packed)); |
| 35 | |
Christian Lamparter | 4e416a6 | 2008-09-01 22:48:41 +0200 | [diff] [blame] | 36 | struct bootrec_desc { |
| 37 | __le16 modes; |
| 38 | __le16 flags; |
| 39 | __le32 rx_start; |
| 40 | __le32 rx_end; |
| 41 | u8 headroom; |
| 42 | u8 tailroom; |
| 43 | u8 unimportant[6]; |
| 44 | u8 rates[16]; |
Larry Finger | 2e20cc3 | 2008-10-09 17:38:52 -0700 | [diff] [blame] | 45 | u8 padding2[4]; |
| 46 | __le16 rx_mtu; |
Christian Lamparter | 4e416a6 | 2008-09-01 22:48:41 +0200 | [diff] [blame] | 47 | } __attribute__((packed)); |
| 48 | |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 49 | #define BR_CODE_MIN 0x80000000 |
| 50 | #define BR_CODE_COMPONENT_ID 0x80000001 |
| 51 | #define BR_CODE_COMPONENT_VERSION 0x80000002 |
| 52 | #define BR_CODE_DEPENDENT_IF 0x80000003 |
| 53 | #define BR_CODE_EXPOSED_IF 0x80000004 |
| 54 | #define BR_CODE_DESCR 0x80000101 |
| 55 | #define BR_CODE_MAX 0x8FFFFFFF |
| 56 | #define BR_CODE_END_OF_BRA 0xFF0000FF |
| 57 | #define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF |
| 58 | |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 59 | /* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */ |
| 60 | |
| 61 | struct pda_entry { |
| 62 | __le16 len; /* includes both code and data */ |
| 63 | __le16 code; |
| 64 | u8 data[0]; |
| 65 | } __attribute__ ((packed)); |
| 66 | |
| 67 | struct eeprom_pda_wrap { |
Johannes Berg | 8c28293 | 2008-02-29 13:56:33 +0100 | [diff] [blame] | 68 | __le32 magic; |
| 69 | __le16 pad; |
| 70 | __le16 len; |
| 71 | __le32 arm_opcode; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 72 | u8 data[0]; |
| 73 | } __attribute__ ((packed)); |
| 74 | |
| 75 | struct pda_iq_autocal_entry { |
| 76 | __le16 freq; |
| 77 | __le16 iq_param[4]; |
| 78 | } __attribute__ ((packed)); |
| 79 | |
| 80 | struct pda_channel_output_limit { |
| 81 | __le16 freq; |
| 82 | u8 val_bpsk; |
| 83 | u8 val_qpsk; |
| 84 | u8 val_16qam; |
| 85 | u8 val_64qam; |
| 86 | u8 rate_set_mask; |
| 87 | u8 rate_set_size; |
| 88 | } __attribute__ ((packed)); |
| 89 | |
| 90 | struct pda_pa_curve_data_sample_rev0 { |
| 91 | u8 rf_power; |
| 92 | u8 pa_detector; |
| 93 | u8 pcv; |
| 94 | } __attribute__ ((packed)); |
| 95 | |
| 96 | struct pda_pa_curve_data_sample_rev1 { |
| 97 | u8 rf_power; |
| 98 | u8 pa_detector; |
| 99 | u8 data_barker; |
| 100 | u8 data_bpsk; |
| 101 | u8 data_qpsk; |
| 102 | u8 data_16qam; |
| 103 | u8 data_64qam; |
Christian Lamparter | 154e3af | 2008-08-23 22:15:25 +0200 | [diff] [blame] | 104 | } __attribute__ ((packed)); |
| 105 | |
| 106 | struct p54_pa_curve_data_sample { |
| 107 | u8 rf_power; |
| 108 | u8 pa_detector; |
| 109 | u8 data_barker; |
| 110 | u8 data_bpsk; |
| 111 | u8 data_qpsk; |
| 112 | u8 data_16qam; |
| 113 | u8 data_64qam; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 114 | u8 padding; |
| 115 | } __attribute__ ((packed)); |
| 116 | |
| 117 | struct pda_pa_curve_data { |
| 118 | u8 cal_method_rev; |
| 119 | u8 channels; |
| 120 | u8 points_per_channel; |
| 121 | u8 padding; |
| 122 | u8 data[0]; |
| 123 | } __attribute__ ((packed)); |
| 124 | |
| 125 | /* |
| 126 | * this defines the PDR codes used to build PDAs as defined in document |
| 127 | * number 553155. The current implementation mirrors version 1.1 of the |
| 128 | * document and lists only PDRs supported by the ARM platform. |
| 129 | */ |
| 130 | |
| 131 | /* common and choice range (0x0000 - 0x0fff) */ |
| 132 | #define PDR_END 0x0000 |
| 133 | #define PDR_MANUFACTURING_PART_NUMBER 0x0001 |
| 134 | #define PDR_PDA_VERSION 0x0002 |
| 135 | #define PDR_NIC_SERIAL_NUMBER 0x0003 |
| 136 | |
| 137 | #define PDR_MAC_ADDRESS 0x0101 |
| 138 | #define PDR_REGULATORY_DOMAIN_LIST 0x0103 |
| 139 | #define PDR_TEMPERATURE_TYPE 0x0107 |
| 140 | |
| 141 | #define PDR_PRISM_PCI_IDENTIFIER 0x0402 |
| 142 | |
| 143 | /* ARM range (0x1000 - 0x1fff) */ |
| 144 | #define PDR_COUNTRY_INFORMATION 0x1000 |
| 145 | #define PDR_INTERFACE_LIST 0x1001 |
| 146 | #define PDR_HARDWARE_PLATFORM_COMPONENT_ID 0x1002 |
| 147 | #define PDR_OEM_NAME 0x1003 |
| 148 | #define PDR_PRODUCT_NAME 0x1004 |
| 149 | #define PDR_UTF8_OEM_NAME 0x1005 |
| 150 | #define PDR_UTF8_PRODUCT_NAME 0x1006 |
| 151 | #define PDR_COUNTRY_LIST 0x1007 |
| 152 | #define PDR_DEFAULT_COUNTRY 0x1008 |
| 153 | |
| 154 | #define PDR_ANTENNA_GAIN 0x1100 |
| 155 | |
| 156 | #define PDR_PRISM_INDIGO_PA_CALIBRATION_DATA 0x1901 |
| 157 | #define PDR_RSSI_LINEAR_APPROXIMATION 0x1902 |
| 158 | #define PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS 0x1903 |
| 159 | #define PDR_PRISM_PA_CAL_CURVE_DATA 0x1904 |
| 160 | #define PDR_RSSI_LINEAR_APPROXIMATION_DUAL_BAND 0x1905 |
| 161 | #define PDR_PRISM_ZIF_TX_IQ_CALIBRATION 0x1906 |
| 162 | #define PDR_REGULATORY_POWER_LIMITS 0x1907 |
| 163 | #define PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED 0x1908 |
| 164 | #define PDR_RADIATED_TRANSMISSION_CORRECTION 0x1909 |
| 165 | #define PDR_PRISM_TX_IQ_CALIBRATION 0x190a |
| 166 | |
| 167 | /* reserved range (0x2000 - 0x7fff) */ |
| 168 | |
| 169 | /* customer range (0x8000 - 0xffff) */ |
| 170 | #define PDR_BASEBAND_REGISTERS 0x8000 |
| 171 | #define PDR_PER_CHANNEL_BASEBAND_REGISTERS 0x8001 |
| 172 | |
| 173 | /* stored in skb->cb */ |
| 174 | struct memrecord { |
| 175 | u32 start_addr; |
| 176 | u32 end_addr; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 177 | }; |
| 178 | |
| 179 | struct p54_eeprom_lm86 { |
| 180 | __le16 offset; |
| 181 | __le16 len; |
| 182 | u8 data[0]; |
| 183 | } __attribute__ ((packed)); |
| 184 | |
| 185 | struct p54_rx_hdr { |
| 186 | __le16 magic; |
| 187 | __le16 len; |
| 188 | __le16 freq; |
| 189 | u8 antenna; |
| 190 | u8 rate; |
| 191 | u8 rssi; |
| 192 | u8 quality; |
| 193 | u16 unknown2; |
Christian Lamparter | a0db663 | 2008-09-06 02:56:04 +0200 | [diff] [blame] | 194 | __le32 tsf32; |
| 195 | __le32 unalloc0; |
Christian Lamparter | 19c19d5 | 2008-09-03 22:25:25 +0200 | [diff] [blame] | 196 | u8 align[0]; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 197 | } __attribute__ ((packed)); |
| 198 | |
| 199 | struct p54_frame_sent_hdr { |
| 200 | u8 status; |
| 201 | u8 retries; |
| 202 | __le16 ack_rssi; |
| 203 | __le16 seq; |
| 204 | u16 rate; |
| 205 | } __attribute__ ((packed)); |
| 206 | |
| 207 | struct p54_tx_control_allocdata { |
| 208 | u8 rateset[8]; |
Christian Lamparter | aaa1553 | 2008-08-09 19:20:47 -0500 | [diff] [blame] | 209 | u8 unalloc0[2]; |
| 210 | u8 key_type; |
| 211 | u8 key_len; |
| 212 | u8 key[16]; |
| 213 | u8 hw_queue; |
| 214 | u8 unalloc1[9]; |
| 215 | u8 tx_antenna; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 216 | u8 output_power; |
Christian Lamparter | aaa1553 | 2008-08-09 19:20:47 -0500 | [diff] [blame] | 217 | u8 cts_rate; |
| 218 | u8 unalloc2[3]; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 219 | u8 align[0]; |
| 220 | } __attribute__ ((packed)); |
| 221 | |
Christian Lamparter | 5e73444 | 2008-10-15 04:07:56 +0200 | [diff] [blame^] | 222 | struct p54_setup_mac { |
| 223 | __le16 mac_mode; |
Christian Lamparter | e0a58ea | 2008-09-03 22:25:20 +0200 | [diff] [blame] | 224 | u8 mac_addr[ETH_ALEN]; |
| 225 | u8 bssid[ETH_ALEN]; |
| 226 | u8 rx_antenna; |
| 227 | u8 rx_align; |
Christian Lamparter | 19c19d5 | 2008-09-03 22:25:25 +0200 | [diff] [blame] | 228 | union { |
| 229 | struct { |
| 230 | __le32 basic_rate_mask; |
| 231 | u8 rts_rates[8]; |
| 232 | __le32 rx_addr; |
| 233 | __le16 max_rx; |
| 234 | __le16 rxhw; |
| 235 | __le16 wakeup_timer; |
| 236 | __le16 unalloc0; |
| 237 | } v1 __attribute__ ((packed)); |
| 238 | struct { |
| 239 | __le32 rx_addr; |
| 240 | __le16 max_rx; |
| 241 | __le16 rxhw; |
| 242 | __le16 timer; |
Christian Lamparter | 5e73444 | 2008-10-15 04:07:56 +0200 | [diff] [blame^] | 243 | __le16 truncate; |
| 244 | __le32 basic_rate_mask; |
| 245 | u8 sbss_offset; |
| 246 | u8 mcast_window; |
| 247 | u8 rx_rssi_threshold; |
| 248 | u8 rx_ed_threshold; |
| 249 | __le32 ref_clock; |
| 250 | __le16 lpf_bandwidth; |
| 251 | __le16 osc_start_delay; |
Christian Lamparter | 19c19d5 | 2008-09-03 22:25:25 +0200 | [diff] [blame] | 252 | } v2 __attribute__ ((packed)); |
| 253 | } __attribute__ ((packed)); |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 254 | } __attribute__ ((packed)); |
| 255 | |
| 256 | struct p54_tx_control_channel { |
Christian Lamparter | 154e3af | 2008-08-23 22:15:25 +0200 | [diff] [blame] | 257 | __le16 flags; |
| 258 | __le16 dwell; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 259 | u8 padding1[20]; |
| 260 | struct pda_iq_autocal_entry iq_autocal; |
| 261 | u8 pa_points_per_curve; |
| 262 | u8 val_barker; |
| 263 | u8 val_bpsk; |
| 264 | u8 val_qpsk; |
| 265 | u8 val_16qam; |
| 266 | u8 val_64qam; |
Christian Lamparter | 19c19d5 | 2008-09-03 22:25:25 +0200 | [diff] [blame] | 267 | struct p54_pa_curve_data_sample curve_data[8]; |
Christian Lamparter | 154e3af | 2008-08-23 22:15:25 +0200 | [diff] [blame] | 268 | u8 dup_bpsk; |
| 269 | u8 dup_qpsk; |
| 270 | u8 dup_16qam; |
| 271 | u8 dup_64qam; |
Christian Lamparter | 19c19d5 | 2008-09-03 22:25:25 +0200 | [diff] [blame] | 272 | union { |
| 273 | struct { |
| 274 | __le16 rssical_mul; |
| 275 | __le16 rssical_add; |
| 276 | } v1 __attribute__ ((packed)); |
| 277 | |
| 278 | struct { |
| 279 | __le32 basic_rate_mask; |
| 280 | u8 rts_rates[8]; |
| 281 | __le16 rssical_mul; |
| 282 | __le16 rssical_add; |
| 283 | } v2 __attribute__ ((packed)); |
| 284 | } __attribute__ ((packed)); |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 285 | } __attribute__ ((packed)); |
| 286 | |
Christian Lamparter | 19c19d5 | 2008-09-03 22:25:25 +0200 | [diff] [blame] | 287 | #define P54_TX_CONTROL_CHANNEL_V1_LEN (sizeof(struct p54_tx_control_channel)-12) |
| 288 | #define P54_TX_CONTROL_CHANNEL_V2_LEN (sizeof(struct p54_tx_control_channel)) |
| 289 | |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 290 | struct p54_tx_control_led { |
| 291 | __le16 mode; |
| 292 | __le16 led_temporary; |
| 293 | __le16 led_permanent; |
| 294 | __le16 duration; |
| 295 | } __attribute__ ((packed)); |
| 296 | |
Christian Lamparter | 0fdd7c5 | 2008-10-15 03:55:37 +0200 | [diff] [blame] | 297 | struct p54_edcf { |
| 298 | u8 flags; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 299 | u8 slottime; |
Christian Lamparter | 0fdd7c5 | 2008-10-15 03:55:37 +0200 | [diff] [blame] | 300 | u8 sifs; |
| 301 | u8 eofpad; |
| 302 | struct p54_edcf_queue_param queue[8]; |
| 303 | u8 mapping[4]; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 304 | __le16 frameburst; |
Christian Lamparter | 0fdd7c5 | 2008-10-15 03:55:37 +0200 | [diff] [blame] | 305 | __le16 round_trip_delay; |
Michael Wu | eff1a59 | 2007-09-25 18:11:01 -0700 | [diff] [blame] | 306 | } __attribute__ ((packed)); |
| 307 | |
Christian Lamparter | cc6de66 | 2008-09-06 02:56:23 +0200 | [diff] [blame] | 308 | struct p54_statistics { |
| 309 | __le32 rx_success; |
| 310 | __le32 rx_bad_fcs; |
| 311 | __le32 rx_abort; |
| 312 | __le32 rx_abort_phy; |
| 313 | __le32 rts_success; |
| 314 | __le32 rts_fail; |
| 315 | __le32 tsf32; |
| 316 | __le32 airtime; |
| 317 | __le32 noise; |
| 318 | __le32 unkn[10]; /* CCE / CCA / RADAR */ |
| 319 | } __attribute__ ((packed)); |
| 320 | |
Christian Lamparter | 1b99753 | 2008-09-06 14:25:58 +0200 | [diff] [blame] | 321 | struct p54_tx_control_xbow_synth { |
| 322 | __le16 magic1; |
| 323 | __le16 magic2; |
| 324 | __le16 freq; |
| 325 | u32 padding[5]; |
| 326 | } __attribute__ ((packed)); |
| 327 | |
Christian Lamparter | 32ddf07 | 2008-08-08 21:17:37 +0200 | [diff] [blame] | 328 | #endif /* P54COMMON_H */ |