blob: 5cfb41510252ed9fbbce3e5e6442a3ecd192af85 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08005 */
Jeff Johnson295189b2012-06-20 16:38:30 -07006#ifndef WLAN_PHY_H
7#define WLAN_PHY_H
8/*============================================================================
9@file wlan_phy.h
10
11Contains definitions of all PHY related structures that aree needed by FTM/PTT
12
Anand Kumar012623a2013-01-11 17:00:00 -080013Copyright (c) 2007 Qualcomm Technologies, Inc. All Rights Reserved.
14Qualcomm Technologies Proprietary and Confidential
15
Jeff Johnson295189b2012-06-20 16:38:30 -070016============================================================================*/
17#include <wlan_nv.h>
18
19/* Currently this structure holds the information about the current calibration mode.
20In future, if anymore info is needed, that can be added here */
21typedef PACKED_PRE struct PACKED_POST
22{
23 tANI_U8 currentCalibration;
24} sCalibrationInfo;
25
26typedef PACKED_PRE struct PACKED_POST {
27 tANI_S16 I; //ADC sample of PHY_I_RAIL
28 tANI_S16 Q; //ADC sample of PHY_Q_RAIL
29}tIQSamples;
30
31typedef tIQSamples tIQAdc;
32typedef tIQSamples tIQDac;
33
34typedef PACKED_PRE struct PACKED_POST
35{
36 tANI_U8 maxGainIndex;
37 tANI_U8 topGainDb;
38 tANI_U8 bottomGainDb;
39 tANI_U8 unused[1];
40}tAsicAgc;
41
42#define TXFIR_MEM QWLAN_TXFIR_TXCAL_MEM0_MREG
43#define TXFIR_MEM_GAIN_MULT (16) //bytes per gain
44#define TXFIR_MEM_PER_CHAIN (16 * TXFIR_MEM_GAIN_MULT) //# of gains per chain * bytes per gain
45
46typedef tIQAdc tTxCarrierError;
47
48#define ONE_MICROSECOND (160)
49#define DEFAULT_INTERFRAME_SPACE (ONE_MICROSECOND * 10) //10 microseconds
50
51typedef enum {
52 PHYDBG_TX_IDLE = 0,
53 PHYDBG_TX_START = 1,
54 PHYDBG_TX_WARMUP = 2,
55 PHYDBG_TX_INFD = 3,
56 PHYDBG_TX_CMD = 4,
57 PHYDBG_TX_SVC = 5,
58 PHYDBG_TX_PYLDF = 6,
59 PHYDBG_TX_PYLDR = 7,
60 PHYDBG_TX_CRC = 8,
61 PHYDBG_TX_FLUSH = 9,
62 PHYDBG_TX_TXDONEWAIT = 10,
63 PHYDBG_TX_TIFWAIT = 11
64} ePhyDbgTxStatus;
65
66typedef enum {
67 PHYDBG_PREAMBLE_OFDM,
68 PHYDBG_PREAMBLE_GREENFIELD,
69 PHYDBG_PREAMBLE_MIXED,
70 PHYDBG_PREAMBLE_SHORTB,
Gopichand Nakkala90bcf7a2013-01-04 11:45:31 -080071 PHYDBG_PREAMBLE_LONGB,
72
73 PHYDBG_LDPC_PREAMBLE_OFDM = 0x10,
74 PHYDBG_LDPC_PREAMBLE_GREENFIELD = 0x11,
75 PHYDBG_LDPC_PREAMBLE_MIXED = 0x12
Jeff Johnson295189b2012-06-20 16:38:30 -070076} ePhyDbgPreamble;
77
78
79//grab ram
80#ifdef VERIFY_HALPHY_SIMV_MODEL
81#define GRAB_RAM_DBLOCK_SIZE (256) //number of samples in full capture
82#else
83#define GRAB_RAM_DBLOCK_SIZE (1024) //number of samples in full capture
84#endif
85
86#define MAX_REQUESTED_GRAB_RAM_SAMPLES 256 //only allow 256 samples at a time
87#define GRAB_RAM_BUFFER_DEPTH (4*1024) //maximum grab ram size in full capture
88#define LAST_GRAB_RAM_SAMPLE_INDEX (GRAB_RAM_BUFFER_DEPTH - 1)
89
90
91typedef PACKED_PRE struct PACKED_POST {
92 tIQAdc rx0;
93} tGrabRamSample;
94
95
96enum {
97 GRABRAM_RAWADC = 0,
98 GRABRAM_POSTIQ
99};
100typedef tANI_U32 eGrabRamSampleType;
101
102typedef tANI_S8 tANI_S6;
103typedef tANI_S16 tANI_S9;
104typedef tANI_S16 tANI_S10;
105typedef tANI_S16 tANI_S12;
106typedef tANI_U16 tANI_U10;
107
108
109
110//convert float to a format that preserves enough accuracy to be used by driver
111typedef tANI_S16 t2Decimal;
112#define CONVERT_TO_2DECIMAL_PLACES(x) (x * 100)
113#define CONVERT_FROM_2DECIMAL_PLACES(x) (x / 100)
114
115#ifndef PTT_FLOAT
116#define PTT_FLOAT tANI_U32 // driver code can't include float,
117//so this reserves space in our structures to allow floating point measurements
118#endif
119
120typedef enum
121{
122 PHY_RX_CHAIN_0 = 0,
123
124 PHY_MAX_RX_CHAINS = 1,
125 PHY_ALL_RX_CHAINS,
126 PHY_NO_RX_CHAINS
127}ePhyRxChains;
128
129typedef enum
130{
131 PHY_I_RAIL = 0,
132 PHY_Q_RAIL = 1,
133 PHY_NUM_IQ_RAILS
134}ePhyIQ;
135
136//[RY] extend total gain steps to 24
137
138enum
139{
140 TX_GAIN_STEP_0,
141 TX_GAIN_STEP_1,
142 TX_GAIN_STEP_2,
143 TX_GAIN_STEP_3,
144 TX_GAIN_STEP_4,
145 TX_GAIN_STEP_5,
146 TX_GAIN_STEP_6,
147 TX_GAIN_STEP_7,
148 TX_GAIN_STEP_8,
149 TX_GAIN_STEP_9,
150 TX_GAIN_STEP_10,
151 TX_GAIN_STEP_11,
152 TX_GAIN_STEP_12,
153 TX_GAIN_STEP_13,
154 TX_GAIN_STEP_14,
155 TX_GAIN_STEP_15,
156 TX_GAIN_STEP_16,
157 TX_GAIN_STEP_17,
158 TX_GAIN_STEP_18,
159 TX_GAIN_STEP_19,
160 TX_GAIN_STEP_20,
161 TX_GAIN_STEP_21,
162 TX_GAIN_STEP_22,
163 TX_GAIN_STEP_23,
164 TX_GAIN_STEP_24,
165 TX_GAIN_STEP_25,
166 TX_GAIN_STEP_26,
167 TX_GAIN_STEP_27,
168 TX_GAIN_STEP_28,
169 TX_GAIN_STEP_29,
170 TX_GAIN_STEP_30,
171 TX_GAIN_STEP_31,
172
173 RX_GAIN_STEP_0 = 0,
174 RX_GAIN_STEP_1,
175 RX_GAIN_STEP_2,
176 RX_GAIN_STEP_3,
177 RX_GAIN_STEP_4,
178 RX_GAIN_STEP_5,
179 RX_GAIN_STEP_6,
180 RX_GAIN_STEP_7,
181 RX_GAIN_STEP_8,
182 RX_GAIN_STEP_9,
183 RX_GAIN_STEP_10,
184 RX_GAIN_STEP_11,
185 RX_GAIN_STEP_12,
186 RX_GAIN_STEP_13,
187 RX_GAIN_STEP_14,
188 RX_GAIN_STEP_15,
189
190 NUM_TX_GAIN_STEPS = 32,
191 MAX_TX_GAIN_STEP = TX_GAIN_STEP_31,
192
193 NUM_RX_GAIN_STEPS = 16,
194 MAX_RX_GAIN_STEP = RX_GAIN_STEP_15,
195};
196typedef tANI_U32 eGainSteps;
197
198
199//[RY] new for PRIMA
200#define DPD_RESPONSE_SIZE 128
201typedef PACKED_PRE struct PACKED_POST {
Sanoop K05588fc2012-12-12 13:51:22 -0800202 tANI_U8 dpdCalFailCnt; //Count for number of times DPD cal failed.
203 tANI_U8 dpdCalSuccessCnt; //Count for number of times DPD cal passed.
Shailender Karmuchi07f514b2013-06-25 01:14:09 -0700204 tANI_U8 dpdColdBootRepeatCalStatus;
205 tANI_U8 dpdLastIteration;
Jeff Johnson295189b2012-06-20 16:38:30 -0700206 tANI_S16 dpd_threshold[DPD_RESPONSE_SIZE];
207 tANI_S16 dpd_aoffset[DPD_RESPONSE_SIZE];
208 tANI_S16 dpd_again[DPD_RESPONSE_SIZE];
209 tANI_S16 dpd_poffset[DPD_RESPONSE_SIZE];
210 tANI_S16 dpd_pgain[DPD_RESPONSE_SIZE];
Shailender Karmuchi07f514b2013-06-25 01:14:09 -0700211 tANI_S32 dpd_sample[20];
212 tANI_U8 dpd_try;
213 tANI_U8 band;
Jeff Johnson295189b2012-06-20 16:38:30 -0700214}sDPDcorrectionCalValues;
215
216typedef PACKED_PRE struct PACKED_POST {
217 sDPDcorrectionCalValues dpd[PHY_MAX_TX_CHAINS];
218}sTxChainsDPDCalValues;
219
220
221//[RY] RX IQ correction coefficients Memory
222typedef PACKED_PRE struct PACKED_POST {
223 tANI_S9 coeff_i[5];
224 tANI_S9 coeff_q[5];
225}sIQCalValues;
226
227//[RY], added for RIVA
228typedef PACKED_PRE struct PACKED_POST {
229 tANI_S9 iq_ampimb_coeff;
230 tANI_S16 txloleakage_i; // raw data is 6-bit 2's compliment
231 tANI_S16 txloleakage_q; // raw data is 6-bit 2's compliment
232}sTXIQCalValues;
233
234//[RY], added for RIVA
235typedef PACKED_PRE struct PACKED_POST {
236 tANI_S9 iqphaseimb_coeff_i[5];
237 tANI_S9 iqphaseimb_coeff_q[5];
238}sTXIQPhaseImbCalValues;
239
240typedef PACKED_PRE struct PACKED_POST {
241 sIQCalValues iq[PHY_MAX_RX_CHAINS];
242}sRxChainsIQCalValues;
243
244//[RY] change for PRIMA
245typedef PACKED_PRE struct PACKED_POST {
246 sTXIQCalValues iq[PHY_MAX_TX_CHAINS];
247 sTXIQPhaseImbCalValues iqImb[PHY_MAX_TX_CHAINS];
248}sTxChainsIQCalValues;
249
250typedef PACKED_PRE struct PACKED_POST {
251 tANI_S9 co_i[3];
252 tANI_S9 co_q[3];
253}sHKIQCalValues;
254
255typedef PACKED_PRE struct PACKED_POST {
256 sHKIQCalValues co[PHY_MAX_TX_CHAINS];
257}sTxChainsHKIQCalValues;
258
259typedef PACKED_PRE struct PACKED_POST {
260 tANI_U8 lna_code; //wlan_lna_5g_control1,wl_5g_lna_load_ctune
261 tANI_U8 gm_code; //wlan_rxgm_5g_control4,wlgm_ctune
262}sLnaBandCalValues;
263
264typedef PACKED_PRE struct PACKED_POST {
265 sLnaBandCalValues lnaCode[PHY_MAX_RX_CHAINS];
266}sTxChainsLnaBandCalValues;
267
268typedef tANI_U16 t_mW; //milliWatts
269typedef tANI_U8 tPwrTemplateIndex; //5-bit number used as the index into the tx gain tables
270
271typedef PACKED_PRE struct PACKED_POST {
272 tANI_U8 txPowerAdc[PHY_MAX_TX_CHAINS];
273}sTxChainsPowerAdcReadings;
274
275typedef PACKED_PRE struct PACKED_POST
276{
277 tANI_U8 agcGain;
278}tRxGain;
279
280typedef PACKED_PRE struct PACKED_POST {
281 tANI_U8 rx[PHY_MAX_RX_CHAINS];
282}sRxChainsData;
283
284typedef sRxChainsData sRxChainsRssi;
285typedef sRxChainsData sRxChainsAgcDisable;
286
287typedef PACKED_PRE struct PACKED_POST {
288 tANI_BOOLEAN rx[PHY_MAX_RX_CHAINS];
289}sRxChainsBoolean;
290
291typedef sRxChainsBoolean sRxChainsAgcEnable;
292
293#define NUM_AGC_GAINS 64
294typedef tRxGain sAgcGainLut[NUM_AGC_GAINS];
295
296
297typedef PACKED_PRE struct PACKED_POST
298{
299 tANI_S6 iLo;
300 tANI_S6 qLo;
301}sTxFirLoCorrect;
302
303typedef tIQAdc sTxLoCorrectBB[PHY_MAX_TX_CHAINS][NUM_TX_GAIN_STEPS];
304
305typedef PACKED_PRE struct PACKED_POST
306{
307 tANI_U32 txIqLoCache[PHY_MAX_TX_CHAINS][NUM_TX_GAIN_STEPS][4];
308 tANI_U32 spatialRotation;
309}tAsicTxFir;
310
311//Tx Power Config
312//A collection of selected calibrated power points at selected frequencies.
313//The algorithm does not need to know any particulars about which frequencies or cal points,
314// just the linearized adjustments at the selected calibration points
315#define MAX_TPC_CHANNELS (NUM_RF_CHANNELS)
316#define START_TPC_CHANNEL (2412)
317#define END_TPC_CHANNEL (2484)
318
319#define MAX_PWR_LUT_DBM (24)
320#define MIN_PWR_LUT_DBM (8)
321
322
323/* The reason that MAX_PWR_LUT_DBM_2DEC_PLACES is not simply (MAX_PWR_LUT_DBM * 100) is due to the fact
324 that we are interpolating the 5-bit power template index from this range compared to a LUT range of 0 to 127.
325 There is an expectation that this power range is evenly divided in 0.5dBm steps.
326 We expect that a commanded 13dBm would yield a power template index of 10, where a power template index of 0 would represent 8dBm.
327 If we used an even 2400 to represent the max power, then the calculation for 13dBm actually returns 9:
328 (127 - 0)*((1300 - 800)/(2400 - 800))+0 = 39.6875 = 39. When shifted to 5 bits, =9. Not what we wanted.
329 What we need to do is find the 2-decimal place power that corresponds as closely as possible to the 127 in the 0 to 127 range.
330 For the 800 to 2400 range, that comes out to 2386.5, so 2386. So again for a commanded power of 13dBm:
331 (127 - 0)*((1300 - 800)/(2386 - 800))+0 = 40.0378 = 40. When shifted to 5-bits, = 10, which is what we wanted.
332
333*/
334
335#define MIN_PWR_LUT_DBM_2DEC_PLACES (MIN_PWR_LUT_DBM * 100)
336#define MAX_PWR_LUT_DBM_2DEC_PLACES ((MAX_PWR_LUT_DBM * 100) - (1 + (100 * (MAX_PWR_LUT_DBM - MIN_PWR_LUT_DBM))/TPC_MEM_POWER_LUT_DEPTH))
337
338//macro provides a quick conversion of dbm value between MIN_PWR_LUT_DBM and MAX_PWR_LUT_DBM to a power template index(0 to 31)
339//based on convention, which may not hold true in the future.
340#define CONVERT_DBM_GINDEX(dbm) (((dbm - MIN_PWR_LUT_DBM) * 32) / (MAX_PWR_LUT_DBM - MIN_PWR_LUT_DBM))
341
342typedef tANI_U8 tTxGainCombo; //7-bit gain value used to get the power measurement
343
344typedef PACKED_PRE struct PACKED_POST
345{
346 tPowerDetect min;
347 tPowerDetect max;
348}tPwrTemplateRange;
349
350
351
352/*
353 The following union affords backward compatibility with txGain usage with band-specific tTpcConfig tables.
354 Due to my finding that 7-bits is not enough precision, we need to reuse the txGain space as extra precision bits
355 for the adjustedPwrDet. My spreadsheet shows that we need at least 4 bits more precision.
356 To know which usage, the MSB of adjustedPwrDet can be set to signify the extra precision in place of the txGain, which isn't used anyway.
357 We just need to be careful not to interpret a pre-existing table's txGain as extra precision.
358*/
359
360 typedef union
361 {
362 tTxGainCombo txGain; //7-bit gain used to measure the pwrDetAdc value
363 tANI_U8 hi8_adjustedPwrDet; //if the MSB is set in adjustedPwrDet, then these are extra bits of precision
364 }uExtraLutBits;
365
366
367typedef PACKED_PRE struct PACKED_POST
368{
369 t2Decimal min; //sometimes used for comparing chain powers
370 t2Decimal max; //sometimes used for comparing chain powers
371}tPowerdBmRange; //absolute power measurement precision maintained to two decimal places
372
373
374typedef tANI_U16 tRfADCVal;
375typedef tRfADCVal tTempADCVal;
376
377typedef PACKED_PRE struct PACKED_POST
378{
379 tRfADCVal pdadc_offset;
380 tANI_U8 reserved[2];
381}tTpcParams;
382
383
384//these definitions used as indexing to power per channel per rate table stored in NV
385#define CB_RATE_POWER_OFFSET 0
386#define CB_RATE_POWER_OFFSET_LAST_INDEX 60 //last index where we would apply the CB_RATE_POWER_OFFSET
387
388/* TX Power Calibration & Report Types */
389
390
391 typedef PACKED_PRE struct PACKED_POST
392 {
393 tANI_U8 temperatureAdc; //= 5 bit temperature measured at time sample was taken
394 tANI_U8 txGain; //= 7 bit gain value used to get the power measurement
395 tANI_U8 pwrDetAdc; //= 8 bit ADC power detect value
396 tANI_U8 reserved;
397 uAbsPwrPrecision absPowerMeasured; //= dBm measurement, will be truncated to two decimal places
398 }tTpcCalPoint;
399
400
401 typedef PACKED_PRE struct PACKED_POST
402 {
403 tANI_U16 numTpcCalPoints;
404 tANI_U16 reserved;
405 tTpcCalPoint chain[MAX_TPC_CAL_POINTS];
406 }tTpcChainData;
407
408
409 typedef PACKED_PRE struct PACKED_POST
410 {
411 tANI_U16 freq; //frequency in MHz
412 tANI_U16 reserved;
413 tTpcChainData empirical[PHY_MAX_TX_CHAINS]; //TPC samples passed in
414 }tTpcFreqData;
415
416 typedef PACKED_PRE struct PACKED_POST
417 {
418 tANI_U8 numChannels;
419 tANI_U8 reserved[3];
420 tTpcFreqData calValues[MAX_TPC_CHANNELS];
421 }sTpcFreqCalTable;
422
423
424typedef PACKED_PRE struct PACKED_POST {
425 tPowerDetect lut; //7-bit value in the power Lookup Table
426 tANI_U8 reserved[3];
427
428 uAbsPwrPrecision abs; //LUT value conversion to absolute dBm
429}tTxPowerLutOutput;
430
431typedef PACKED_PRE struct PACKED_POST {
432 tANI_U8 gain; //8-bit coarse(bits 4-7) & fine(bits 0-3) gain commanded for the current index
433 tPowerDetect adc; //8-bit power ADC sampled during the packet preamble
434 tANI_U16 rawAdc; //11-bit power raw ADC sampled
435
436 tTxPowerLutOutput indexMinMatch; //minimum LUT matching power that satisfies the power template index setting
437 tTxPowerLutOutput indexMaxMatch; //maximum LUT matching power that satisfies the power template index setting
438 tTxPowerLutOutput output; //output power values corresponding to power ADC index
439}tTxChainPower;
440
441extern const tRfChannelProps rfChannels[NUM_RF_CHANNELS];
442
443typedef enum
444{
445 RF_CAL_TONE_28NEG,
446 RF_CAL_TONE_24NEG,
447 RF_CAL_TONE_20NEG,
448 RF_CAL_TONE_16NEG,
449 RF_CAL_TONE_12NEG,
450 RF_CAL_TONE_8NEG,
451 RF_CAL_TONE_4NEG,
452 RF_CAL_TONE_4POS,
453 RF_CAL_TONE_8POS,
454 RF_CAL_TONE_12POS,
455 RF_CAL_TONE_16POS,
456 RF_CAL_TONE_20POS,
457 RF_CAL_TONE_24POS,
458 RF_CAL_TONE_28POS,
459
460 NUM_RF_TONES,
461
462 MIN_RF_TONE = RF_CAL_TONE_28NEG,
463 MAX_RF_TONE = RF_CAL_TONE_28POS
464}eRfTones;
465
466typedef tANI_U8 tDcoCorrect;
467typedef tANI_S8 tIm2Correct;
468
469typedef PACKED_PRE struct PACKED_POST {
470 tDcoCorrect IDcoCorrect;
471 tDcoCorrect QDcoCorrect;
472 tANI_U8 dcRange;
473}tRxDcoCorrect;
474
475typedef PACKED_PRE struct PACKED_POST {
476 tRxDcoCorrect dco[PHY_MAX_RX_CHAINS];
477}tRxChainsDcoCorrections;
478
479typedef PACKED_PRE struct PACKED_POST {
480 tIm2Correct ICorrect;
481 tIm2Correct QCorrect;
482}tRxIm2Correct;
483
484typedef PACKED_PRE struct PACKED_POST {
485 tRxIm2Correct dco[PHY_MAX_RX_CHAINS];
486}tRxChainsIm2Corrections;
487
488typedef PACKED_PRE struct PACKED_POST {
489 tDcoCorrect IDcoCorrect;
490 tDcoCorrect QDcoCorrect;
491}tTxLoCorrect;
492
493typedef PACKED_PRE struct PACKED_POST {
494 tTxLoCorrect txLo[PHY_MAX_TX_CHAINS];
495}sTxChainsLoCorrections;
496
497
498//tDcoCorrect is needed to define rf specific structures
499
500#define NUM_RF_RX_GAIN_STEPS (128)
501#define MAX_RF_RX_GAIN_STEP (NUM_RF_RX_GAIN_STEPS - 1)
502
503#define NUM_RF_TX_GAIN_STEPS (16)
504#define MAX_RF_TX_GAIN_STEP (NUM_RF_TX_GAIN_STEPS - 1)
505
506#define RF_AGC_GAIN_LUT_DEPTH (128)
507#define NUM_RF_DCO_VALUES (128) //There are only 32 DCO values, but our algorithm it makes more sense for us to access these by AGC gain index
508#define MAX_RF_DCO_VALUE (NUM_RF_DCO_VALUES - 1)
509
510
511typedef PACKED_PRE struct PACKED_POST
512{
513 tANI_U16 gainReg1; //GEMINI_REG_RX_GC_0 (lna + mix + tia + bq1 + bq2 + pga)
514}tRfRxGain;
515
516
517typedef PACKED_PRE struct PACKED_POST
518{
519 tANI_U16 bbf_gain_cnt;
520 tANI_U16 bbf_lin_adj;
521 tANI_U16 lo_mix_da_gain_cntl;
522 tANI_U16 pa_gain_cntl;
523 tANI_U16 da_pa_bias_1_cnt;
524 tANI_U16 da_pa_bias_2_cntl;
525}tRfTxGain;
526
527typedef PACKED_PRE struct PACKED_POST
528{
529 //TODO:define this struct for Gemini
530 tANI_U8 rxIf;
531 tANI_U8 txIf;
532 tANI_U8 txRf;
533 tANI_U8 reserved;
534}sRfSpecificFilterSettings;
535
536typedef sRfSpecificFilterSettings sRfChannelFilterSettings[NUM_RF_CHANNELS];
537
538
539typedef PACKED_PRE struct PACKED_POST
540{
541 tANI_U8 hdet_ctl_ext_atten;
542 tANI_U8 hdet_dcoc_code;
543 tANI_U8 hdet_dcoc_ib_rcal_en;
544 tANI_U8 hdet_dcoc_ib_scal_en;
545}sRfNvCalValues; //stored in QFUSE
546
547
548
549typedef enum
550{
551 SYNTH_UNLOCKED,
552 SYNTH_LOCK
553}eRfSynthLock;
554
555typedef enum
556{
557 TEMP_SENSOR_PA,
558 TEMP_SENSOR_RX
559}eRfTempSensor;
560
561typedef enum
562{
563 TEMPERATURE_BIN_0, //-30 to 5 C
564 TEMPERATURE_BIN_1, //5 to 45 C
565 TEMPERATURE_BIN_2, //45 to 85 C
566 TEMPERATURE_BIN_3, //85 to 125 C
567 NUM_TEMPERATURE_BINS
568}eTemperatureBins;
569
570typedef PACKED_PRE struct PACKED_POST {
571 tANI_U16 hdetDcocCode;
572 tANI_U16 hdetDcoOffset;
573}sRfHdetCalValues;
574
575#define TPC_TXPWR_ENABLE_MASK QWLAN_TPC_TXPWR_ENABLE_EN_MASK
576
577
578#define TPC_MEM_TX0_PWR_LUT_OFFSET QWLAN_TPC_POWERDET0_RAM_MREG
579#define TPC_MEM_TX1_PWR_LUT_OFFSET QWLAN_TPC_POWERDET1_RAM_MREG
580#define TPC_MEM_TX2_PWR_LUT_OFFSET QWLAN_TPC_POWERDET2_RAM_MREG
581#define TPC_MEM_TX3_PWR_LUT_OFFSET QWLAN_TPC_POWERDET3_RAM_MREG
582#define TPC_MEM_TX0_GAIN_LUT_OFFSET QWLAN_TPC_GAIN_LUT0_MREG
583#define TPC_MEM_TX1_GAIN_LUT_OFFSET QWLAN_TPC_GAIN_LUT1_MREG
584#define TPC_MEM_TX2_GAIN_LUT_OFFSET QWLAN_TPC_GAIN_LUT2_MREG
585#define TPC_MEM_TX3_GAIN_LUT_OFFSET QWLAN_TPC_GAIN_LUT3_MREG
586
587//these masks are the same for both chains
588#define TPC_POWERDET_MASK QWLAN_TPC_POWERDET0_RAM_POWER_MASK
589#define TPC_GAIN_RF_MASK QWLAN_TPC_GAIN_LUT0_RF_GAIN_MASK
590#define TPC_GAIN_RF_OFFSET QWLAN_TPC_GAIN_LUT0_RF_GAIN_OFFSET
591#define TPC_GAIN_DIG_MASK QWLAN_TPC_GAIN_LUT0_DIG_GAIN_MASK
592
593
594#define TPC_MEM_GAIN_LUT_DEPTH 32
595
596
597#define TPC_ADC_CTRL_REG QWLAN_TPC_ADC_CTRL_GET_ADC_REG
598#define TPC_ADC_GET_MASK QWLAN_TPC_ADC_CTRL_GET_ADC_GET_ADC_MASK
599
600#define TPC_ADC_FAILED_MASK QWLAN_TPC_ADC_STATUS_FAILED_MASK
601#define TPC_ADC_BUSY_P_MASK QWLAN_TPC_ADC_STATUS_BUSY_P_MASK
602#define TPC_ADC_BUSY_T_MASK QWLAN_TPC_ADC_STATUS_BUSY_T_MASK
603
604
605#define MSK_1 0x1
606#define MSK_2 0x3
607#define MSK_3 0x7
608#define MSK_4 0xF
609#define MSK_5 0x1F
610#define MSK_6 0x3F
611#define MSK_7 0x7F
612#define MSK_8 0xFF
613#define MSK_9 0x1FF
614#define MSK_10 0x3FF
615#define MSK_11 0x7FF
616#define MSK_12 0xFFF
617#define MSK_13 0x1FFF
618#define MSK_14 0x3FFF
619#define MSK_15 0x7FFF
620#define MSK_16 0xFFFF
621#define MSK_17 0x1FFFF
622#define MSK_18 0x3FFFF
623#define MSK_19 0x7FFFF
624#define MSK_20 0xFFFFF
625#define MSK_21 0x1FFFFF
626#define MSK_22 0x3FFFFF
627#define MSK_23 0x7FFFFF
628#define MSK_24 0xFFFFFF
629#define MSK_25 0x1FFFFFF
630#define MSK_26 0x3FFFFFF
631#define MSK_27 0x7FFFFFF
632#define MSK_28 0xFFFFFFF
633#define MSK_29 0x1FFFFFFF
634#define MSK_30 0x3FFFFFFF
635#define MSK_31 0x7FFFFFFF
636#define MSK_32 0xFFFFFFFF
637
638
639#define COARSE_GAIN_MASK MSK_4
640#define COARSE_GAIN_OFFSET 4
641#define FINE_GAIN_MASK MSK_4 //the upper most bit overlaps the coarse gain and should not be used for TPC LUT data
642#define FINE_GAIN_OFFSET 0
643
644typedef enum
645{
646 TPC_COARSE_TXPWR_0,
647 TPC_COARSE_TXPWR_1,
648 TPC_COARSE_TXPWR_2,
649 TPC_COARSE_TXPWR_3,
650 TPC_COARSE_TXPWR_4,
651 TPC_COARSE_TXPWR_5,
652 TPC_COARSE_TXPWR_6,
653 TPC_COARSE_TXPWR_7,
654 TPC_COARSE_TXPWR_8,
655 TPC_COARSE_TXPWR_9,
656 TPC_COARSE_TXPWR_10,
657 TPC_COARSE_TXPWR_11,
658 TPC_COARSE_TXPWR_12,
659 TPC_COARSE_TXPWR_13,
660 TPC_COARSE_TXPWR_14,
661 TPC_COARSE_TXPWR_15,
662 TPC_COARSE_TXPWR_16,
663 TPC_COARSE_TXPWR_17,
664 TPC_COARSE_TXPWR_18,
665 TPC_COARSE_TXPWR_19,
666 TPC_COARSE_TXPWR_20,
667 TPC_COARSE_TXPWR_21,
668 TPC_COARSE_TXPWR_22,
669 TPC_COARSE_TXPWR_23,
670 TPC_COARSE_TXPWR_24,
671 TPC_COARSE_TXPWR_25,
672 TPC_COARSE_TXPWR_26,
673 TPC_COARSE_TXPWR_27,
674 TPC_COARSE_TXPWR_28,
675 TPC_COARSE_TXPWR_29,
676 TPC_COARSE_TXPWR_30,
677 TPC_COARSE_TXPWR_31,
678 NUM_TPC_COARSE_STEPS = TPC_COARSE_TXPWR_31 - TPC_COARSE_TXPWR_0 + 1,
679 MIN_TPC_COARSE_TXPWR = TPC_COARSE_TXPWR_0,
680 MAX_TPC_COARSE_TXPWR = TPC_COARSE_TXPWR_31
681}eTxCoarseGain; //refers to the external RF power adjustment
682
683typedef enum
684{
685 TPC_FINE_TXPWR_0,
686 TPC_FINE_TXPWR_1,
687 TPC_FINE_TXPWR_2,
688 TPC_FINE_TXPWR_3,
689 TPC_FINE_TXPWR_4,
690 TPC_FINE_TXPWR_5,
691 TPC_FINE_TXPWR_6,
692 TPC_FINE_TXPWR_7,
693 TPC_FINE_TXPWR_8,
694 TPC_FINE_TXPWR_9,
695 TPC_FINE_TXPWR_10,
696 TPC_FINE_TXPWR_11,
697 TPC_FINE_TXPWR_12,
698 TPC_FINE_TXPWR_13,
699 TPC_FINE_TXPWR_14,
700 TPC_FINE_TXPWR_15,
701 MIN_TPC_FINE_TXPWR = TPC_FINE_TXPWR_0,
702 MAX_TPC_FINE_TXPWR = TPC_FINE_TXPWR_15
703}eTxFineGain; //refers to the internal TxFIR power adjustment
704
705typedef PACKED_PRE struct PACKED_POST {
706 eTxCoarseGain coarsePwr;
707 eTxFineGain finePwr;
708}tTxGain;
709
710//for 30second periodic interrupt, do this every 5 minutes
711#define HAL_PHY_PERIODIC_CAL_ITER_LIMIT 10
712
713typedef enum
714{
715 //these show which rx and tx chains are enabled, other chains are disable accordingly
716 //Production modes
717 PHY_CHAIN_SEL_R0_T0_ON,
718
719 PHY_CHAIN_SEL_BT_R0_T0_ON, //simultaneous bluetooth receive enabled
720
721
722 //test modes
723 PHY_CHAIN_SEL_R0_ON,
724 PHY_CHAIN_SEL_T0_ON,
725 PHY_CHAIN_SEL_NO_RX_TX,
726
727 MAX_PHY_CHAIN_SEL,
728 INVALID_PHY_CHAIN_SEL,
729 PHY_MAX_CHAIN_SELECT = 0x7FFFFFFF /* define as 4 bytes data */
730}ePhyChainSelect;
731
732typedef enum
733{
734#ifdef CHANNEL_BONDED_CAPABLE
735
736 PHY_CCA_40MHZ_SOURCE = 0,
737#endif
738
739 PHY_CCA_20MHZ_SOURCE = 1
740}ePhyCCASource;
741
742typedef enum
743{
744 PHY_CCA_FORCED_ON = 0,
745 PHY_CCA_ED = 1,
746 PHY_CCA_CD = 2,
747 PHY_CCA_CD_AND_CS = 3,
748 PHY_CCA_ED_AND_CD = 4,
749 PHY_CCA_ED_OR_CD = 5,
750 PHY_CCA_ED_AND_CD_AND_CS = 6,
751 PHY_CCA_ED_OR_CD_AND_CS = 7,
752 PHY_CCA_SEC_ED40_AND_NOR_PKTDET40_PKTDET20 = 8,
753 PHY_CCA_SEC_BUSY = 9
754}ePhyCCAMode;
755
756typedef enum
757{
758 PHY_RX_DISABLE_NONE = 0,
759 PHY_RX_DISABLE_11AG = 0x00000001,
760 PHY_RX_DISABLE_11B = 0x00000002,
761 PHY_RX_DISABLE_11N40 = 0x00000004,
762 PHY_RX_DISABLE_11AC80 = 0x00000008,
763
764 PHY_RX_DISABLE_11ABG = (PHY_RX_DISABLE_11AG | PHY_RX_DISABLE_11B),
765 PHY_RX_DISABLE_ALL_TYPES = (PHY_RX_DISABLE_11B | PHY_RX_DISABLE_11AG |
766 PHY_RX_DISABLE_11N40 | PHY_RX_DISABLE_11AC80),
767}ePhyRxDisabledPktTypes;
768
769
770// Enum for network density setting.
771typedef enum
772{
773 PHY_NW_DENSITY_LOW = 0,
774 PHY_NW_DENSITY_MED,
775 PHY_NW_DENSITY_HIGH,
776 PHY_NW_DENSITY_ADAPTIVE
777} ePhyNwDensity;
778
779
780typedef enum
781{
782 ALL_CALS, //RxDco 1st, TxLO 2nd
783 RX_DCO_CAL_ONLY,
784 RX_IM2_CAL_ONLY,
785 RX_DCO_IM2_CAL,
786 TX_LO_CAL_ONLY,
787 RX_IQ_CAL_ONLY,
788 TX_IQ_CAL_ONLY,
789 HKDAC_TX_IQ_CAL_ONLY,
790 NO_CALS = 0xFF
791}eCalSelection;
792
793
794//supports testing of closed-loop power control
795typedef enum
796{
797 FORCE_CLOSED_LOOP_GAIN = 0, //phyDbg pkt gen only uses gain index 0 when we are taking measurements with the closed-loop gain
798 FORCE_POWER_TEMPLATE_INDEX = 1, //only use forced power template index
799 FIXED_POWER_DBM = 2, //only use to specify fixed power, ignoring rate/channel/reg limits
800 REGULATORY_POWER_LIMITS = 3, //use production power Lut settings limited by power limit table per channel
801 RATE_POWER_NON_LIMITED = 4, //use power specified per rate and channel group, but don't limit power by channel
802 POWER_INDX_SRC_MAX_VAL = 0x7FFFFFFF, //dummy val to set enum to 4 bytes
803}ePowerTempIndexSource;
804
805#define BIT_0 0x00000001
806#define BIT_1 0x00000002
807#define BIT_2 0x00000004
808#define BIT_3 0x00000008
809#define BIT_4 0x00000010
810#define BIT_5 0x00000020
811#define BIT_6 0x00000040
812#define BIT_7 0x00000080
813#define BIT_8 0x00000100
814#define BIT_9 0x00000200
815#define BIT_10 0x00000400
816#define BIT_11 0x00000800
817#define BIT_12 0x00001000
818#define BIT_13 0x00002000
819#define BIT_14 0x00004000
820#define BIT_15 0x00008000
821#define BIT_16 0x00010000
822#define BIT_17 0x00020000
823#define BIT_18 0x00040000
824#define BIT_19 0x00080000
825#define BIT_20 0x00100000
826#define BIT_21 0x00200000
827#define BIT_22 0x00400000
828#define BIT_23 0x00800000
829#define BIT_24 0x01000000
830#define BIT_25 0x02000000
831#define BIT_26 0x04000000
832#define BIT_27 0x08000000
833#define BIT_28 0x10000000
834#define BIT_29 0x20000000
835#define BIT_30 0x40000000
836#define BIT_31 0x80000000
837
838#define WFM_CLK_80 BIT_3
839#define WFM_START BIT_0
840#define WFM_STOP BIT_1
841
842#define WFM_MEM_I_DATA_MASK (0x7FF)
843#define WFM_MEM_Q_DATA_OFFSET (0xB)
844#define WFM_MEM_Q_DATA_MASK (0x3FF800)
845
846typedef enum
847{
848 WAVE_SINGLE_SHOT = 0,
849 WAVE_CONTINUOUS = BIT_2
850}eWaveMode;
851
852typedef enum
853{
854 RATE_240 = 0,
855 RATE_160 = 1,
856 RATE_120 = 2,
857 RATE_80 = 3,
858 RATE_40 = 4,
859 RATE_20 = 5,
860}eWaveRate;
861
862#define MAX_TONE_AMPLITUDE (2^11) // peak to peak
863
864#define MAX_TEST_WAVEFORM_SAMPLES 500
865
866#define NUM_RX_IMB_CAL_TONES 4
867
868#define CAL_WFM_TX_TONE_8_START_IDX 0
869#define CAL_WFM_TX_TONE_8_STOP_IDX 255
870#define CAL_WFM_TX_TONE_MINUS_8_START_IDX 256
871#define CAL_WFM_TX_TONE_MINUS_8_STOP_IDX 511
872#define CAL_WFM_RX_TONE_START_IDX 512
873#define CAL_WFM_RX_TONE_STOP_IDX 767
874
875#define B_RATE_CAL_ADJUSTMENT -150
876#define GN_RATE_BANDEDGE_ADJUSTMENT -100
877
878#define TPC_INDEX_WIFI_DIRECT 0
879#define TPC_INDEX_LOW_POWER 1
880#define MIN_TPC_GAIN_INDEX 0 //Index 0 used for Wifi Direct
881#define TPC_GAIN_LUT_PWR_SLOPE 2
882#define MAX_TPC_GAIN_LUT_DBM (22)
883#define MIN_TPC_GAIN_LUT_DBM (6)
884
885#define MAX_TPC_GAIN_LUT_DBM_2DEC_PLACES (MAX_TPC_GAIN_LUT_DBM * 100)
886#define MIN_TPC_GAIN_LUT_DBM_2DEC_PLACES (MIN_TPC_GAIN_LUT_DBM * 100)
887
Anand Kumar012623a2013-01-11 17:00:00 -0800888typedef enum
889{
890 RF_BANDWIDTH_20MHZ = 20,
891 RF_BANDWIDTH_40MHZ = 40,
892 RF_BANDWIDTH_80MHZ = 80,
893 RF_MIN_BANDWIDTH = RF_BANDWIDTH_20MHZ,
894 RF_MAX_BANDWIDTH = RF_BANDWIDTH_80MHZ,
895 RF_BANDWIDTH_INVALID = 0x7FFFFFFF
896}eRfBandwidth;
897
Jeff Johnson295189b2012-06-20 16:38:30 -0700898#endif /* WLAN_PHY_H */