Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/adrv9371x/ad9371_init.c

raw symbols SCIP
1 /**
2 * \brief Contains init setting structure declarations for the _instance API
3 *
4 * The top level structure mykonosDevice_t mykDevice uses keyword
5 * extern to allow the application layer main() to have visibility
6 * to these settings.
7 *
8 * All data structures required for operation have been initialized with values which reflect these settings:
9 *
10 * Device Clock:
11 * 122.88MHz
12 *
13 * Profiles:
14 * Rx 100MHz, IQrate 122.88MSPS, Dec5
15 * Tx 75/200MHz, IQrate 245.76MSPS, Dec5
16 * ORX 200MHz, IQrate 245.76MSPS, Dec5
17 * SRx 20MHz, IQrate 30.72MSPS, Dec5
18 *
19 */
20
21 #include <stddef.h>
22 #include "t_mykonos.h"
23 #include "t_mykonos_gpio.h"
24 #include "ad9371_init.h"
25
26 static int16_t txFirCoefs[] = {-15,33,-92,207,-457,1094,-3342,21908,-4607,2226,-862,376,-169,72,-29,19};
27
28 static mykonosFir_t txFir =
29 {
30 6, /* Filter gain in dB*/
31 16, /* Number of coefficients in the FIR filter*/
32 &txFirCoefs[0] /* A pointer to an array of filter coefficients*/
33 };
34
35 static int16_t rxFirCoefs[] = {-20,6,66,22,-128,-54,240,126,-402,-248,634,444,-956,-756,1400,1244,-2028,-2050,2978,3538,-4646,-7046,9536,30880,30880,9536,-7046,-4646,3538,2978,-2050,-2028,1244,1400,-756,-956,444,634,-248,-402,126,240,-54,-128,22,66,6,-20};
36
37 static mykonosFir_t rxFir =
38 {
39 -6, /* Filter gain in dB*/
40 48, /* Number of coefficients in the FIR filter*/
41 &rxFirCoefs[0] /* A pointer to an array of filter coefficients*/
42 };
43
44 static int16_t obsrxFirCoefs[] = {150,-55,-64,354,-896,1788,-3101,4953,-7622,9914,-14047,25417,25417,-14047,9914,-7622,4953,-3101,1788,-896,354,-64,-55,150};
45 static mykonosFir_t obsrxFir =
46 {
47 0, /* Filter gain in dB*/
48 24, /* Number of coefficients in the FIR filter*/
49 &obsrxFirCoefs[0]/* A pointer to an array of filter coefficients*/
50 };
51
52 static int16_t snifferFirCoefs[] = {-1,-5,-14,-23,-16,24,92,137,80,-120,-378,-471,-174,507,1174,1183,98,-1771,-3216,-2641,942,7027,13533,17738,17738,13533,7027,942,-2641,-3216,-1771,98,1183,1174,507,-174,-471,-378,-120,80,137,92,24,-16,-23,-14,-5,-1};
53 static mykonosFir_t snifferRxFir=
54 {
55 -6, /* Filter gain in dB*/
56 48, /* Number of coefficients in the FIR filter*/
57 &snifferFirCoefs[0]/* A pointer to an array of filter coefficients*/
58 };
59
60 static mykonosJesd204bFramerConfig_t rxFramer =
61 {
62 0, /* JESD204B Configuration Bank ID -extension to Device ID (Valid 0..15)*/
63 0, /* JESD204B Configuration Device ID - link identification number. (Valid 0..255)*/
64 0, /* JESD204B Configuration starting Lane ID. If more than one lane used, each lane will increment from the Lane0 ID. (Valid 0..31)*/
65 4, /* number of ADCs (0, 2, or 4) - 2 ADCs per receive chain*/
66 32, /* number of frames in a multiframe (default=32), F*K must be a multiple of 4. (F=2*M/numberOfLanes)*/
67 1, /* scrambling off if framerScramble= 0, if framerScramble>0 scramble is enabled.*/
68 1, /* 0=use internal SYSREF, 1= use external SYSREF*/
69 0x03, /* serializerLanesEnabled - bit per lane, [0] = Lane0 enabled, [1] = Lane1 enabled*/
70 0xE4, /* serializerLaneCrossbar*/
71 22, /* serializerAmplitude - default 22 (valid (0-31)*/
72 4, /* preEmphasis - < default 4 (valid 0 - 7)*/
73 0, /* invertLanePolarity - default 0 ([0] will invert lane [0], bit1 will invert lane1)*/
74 0, /* lmfcOffset - LMFC_Offset offset value for deterministic latency setting*/
75 0, /* Flag for determining if SYSREF on relink should be set. Where, if > 0 = set, 0 = not set*/
76 0, /* Flag for determining if auto channel select for the xbar should be set. Where, if > 0 = set, '0' = not set*/
77 0, /* Selects SYNCb input source. Where, 0 = use RXSYNCB for this framer, 1 = use OBSRX_SYNCB for this framer*/
78 0, /* Flag for determining if CMOS mode for RX Sync signal is used. Where, if > 0 = CMOS, '0' = LVDS*/
79 0 /* Selects framer bit repeat or oversampling mode for lane rate matching. Where, 0 = bitRepeat mode (changes effective lanerate), 1 = overSample (maintains same lane rate between ObsRx framer and Rx framer and oversamples the ADC samples)*/
80 };
81
82 static mykonosJesd204bFramerConfig_t obsRxFramer =
83 {
84 0, /* JESD204B Configuration Bank ID -extension to Device ID (Valid 0..15)*/
85 0, /* JESD204B Configuration Device ID - link identification number. (Valid 0..255)*/
86 0, /* JESD204B Configuration starting Lane ID. If more than one lane used, each lane will increment from the Lane0 ID. (Valid 0..31)*/
87 2, /* number of ADCs (0, 2, or 4) - 2 ADCs per receive chain*/
88 32, /* number of frames in a multiframe (default=32), F*K must be a multiple of 4. (F=2*M/numberOfLanes)*/
89 1, /* scrambling off if framerScramble= 0, if framerScramble>0 scramble is enabled.*/
90 1, /* 0=use internal SYSREF, 1= use external SYSREF*/
91 0x0C, /* serializerLanesEnabled - bit per lane, [0] = Lane0 enabled, [1] = Lane1 enabled*/
92 0xE4, /* Lane crossbar to map framer lane outputs to physical lanes*/
93 22, /* serializerAmplitude - default 22 (valid (0-31)*/
94 4, /* preEmphasis - < default 4 (valid 0 - 7)*/
95 0, /* invertLanePolarity - default 0 ([0] will invert lane [0], bit1 will invert lane1)*/
96 0, /* lmfcOffset - LMFC_Offset offset value for deterministic latency setting*/
97 0, /* Flag for determining if SYSREF on relink should be set. Where, if > 0 = set, 0 = not set*/
98 0, /* Flag for determining if auto channel select for the xbar should be set. Where, if > 0 = set, '0' = not set*/
99 1, /* Selects SYNCb input source. Where, 0 = use RXSYNCB for this framer, 1 = use OBSRX_SYNCB for this framer*/
100 0, /* Flag for determining if CMOS mode for RX Sync signal is used. Where, if > 0 = CMOS, '0' = LVDS*/
101 1 /* Selects framer bit repeat or oversampling mode for lane rate matching. Where, 0 = bitRepeat mode (changes effective lanerate), 1 = overSample (maintains same lane rate between ObsRx framer and Rx framer and oversamples the ADC samples)*/
102 };
103
104 static mykonosJesd204bDeframerConfig_t deframer =
105 {
106 0, /* bankId extension to Device ID (Valid 0..15)*/
107 0, /* deviceId link identification number. (Valid 0..255)*/
108 0, /* lane0Id Lane0 ID. (Valid 0..31)*/
109 4, /* M number of DACss (0, 2, or 4) - 2 DACs per transmit chain */
110 32, /* K #frames in a multiframe (default=32), F*K=multiple of 4. (F=2*M/numberOfLanes)*/
111 1, /* scramble scrambling off if scramble= 0.*/
112 1, /* External SYSREF select. 0 = use internal SYSREF, 1 = external SYSREF*/
113 0x0F, /* Deserializer lane select bit field. Where, [0] = Lane0 enabled, [1] = Lane1 enabled, etc */
114 0xE4, /* Lane crossbar to map physical lanes to deframer lane inputs [1:0] = Deframer Input 0 Lane section, [3:2] = Deframer Input 1 lane select, etc */
115 1, /* Equalizer setting. Applied to all deserializer lanes. Range is 0..4*/
116 0, /* PN inversion per each lane. bit[0] = 1 Invert PN of Lane 0, bit[1] = Invert PN of Lane 1, etc).*/
117 0, /* LMFC_Offset offset value to adjust deterministic latency. Range is 0..31*/
118 0, /* Flag for determining if SYSREF on relink should be set. Where, if > 0 = set, '0' = not set*/
119 0, /* Flag for determining if auto channel select for the xbar should be set. Where, if > 0 = set, '0' = not set*/
120 0 /* Flag for determining if CMOS mode for TX Sync signal is used. Where, if > 0 = CMOS, '0' = LVDS*/
121 };
122
123 static mykonosRxGainControl_t rxGainControl =
124 {
125 MGC, /* Current Rx gain control mode setting*/
126 255, /* Rx1 Gain Index, can be used in different ways for manual and AGC gain control*/
127 255, /* Rx2 Gain Index, can be used in different ways for manual and AGC gain control*/
128 255, /* Max gain index for the currently loaded Rx1 Gain table*/
129 195, /* Min gain index for the currently loaded Rx1 Gain table*/
130 255, /* Max gain index for the currently loaded Rx2 Gain table*/
131 195, /* Min gain index for the currently loaded Rx2 Gain table*/
132 0, /* Stores Rx1 RSSI value read back from the Mykonos*/
133 0 /* Stores Rx2 RSSI value read back from the Mykonos*/
134 };
135
136 static mykonosORxGainControl_t orxGainControl =
137 {
138 MGC, /* Current ORx gain control mode setting*/
139 255, /* ORx1 Gain Index, can be used in different ways for manual and AGC gain control*/
140 255, /* ORx2 Gain Index, can be used in different ways for manual and AGC gain control*/
141 255, /* Max gain index for the currently loaded ORx Gain table*/
142 237 /* Min gain index for the currently loaded ORx Gain table*/
143 };
144
145 static mykonosSnifferGainControl_t snifferGainControl =
146 {
147 MGC, /* Current Sniffer gain control mode setting*/
148 255, /* Current Sniffer gain index. Can be used differently for MANUAL Gain control/AGC*/
149 255, /* Max gain index for the currently loaded Sniffer Gain table*/
150 203 /* Min gain index for the currently loaded Sniffer Gain table*/
151 };
152
153 static mykonosPeakDetAgcCfg_t rxPeakAgc =
154 {
155 0x1F, /* apdHighThresh: */
156 0x16, /* apdLowThresh */
157 0xB5, /* hb2HighThresh */
158 0x80, /* hb2LowThresh */
159 0x40, /* hb2VeryLowThresh */
160 0x06, /* apdHighThreshExceededCnt */
161 0x04, /* apdLowThreshExceededCnt */
162 0x06, /* hb2HighThreshExceededCnt */
163 0x04, /* hb2LowThreshExceededCnt */
164 0x04, /* hb2VeryLowThreshExceededCnt */
165 0x4, /* apdHighGainStepAttack */
166 0x2, /* apdLowGainStepRecovery */
167 0x4, /* hb2HighGainStepAttack */
168 0x2, /* hb2LowGainStepRecovery */
169 0x4, /* hb2VeryLowGainStepRecovery */
170 0x1, /* apdFastAttack */
171 0x1, /* hb2FastAttack */
172 0x1, /* hb2OverloadDetectEnable */
173 0x1, /* hb2OverloadDurationCnt */
174 0x1 /* hb2OverloadThreshCnt */
175 };
176
177 static mykonosPowerMeasAgcCfg_t rxPwrAgc =
178 {
179 0x01, /* pmdUpperHighThresh */
180 0x03, /* pmdUpperLowThresh */
181 0x0C, /* pmdLowerHighThresh */
182 0x04, /* pmdLowerLowThresh */
183 0x4, /* pmdUpperHighGainStepAttack */
184 0x2, /* pmdUpperLowGainStepAttack */
185 0x2, /* pmdLowerHighGainStepRecovery */
186 0x4, /* pmdLowerLowGainStepRecovery */
187 0x08, /* pmdMeasDuration */
188 0x02 /* pmdMeasConfig */
189 };
190
191 static mykonosAgcCfg_t rxAgcConfig =
192 {
193 255, /* agcRx1MaxGainIndex */
194 195, /* agcRx1MinGainIndex */
195 255, /* agcRx2MaxGainIndex */
196 195, /* agcRx2MinGainIndex: */
197 255, /* agcObsRxMaxGainIndex */
198 203, /* agcObsRxMinGainIndex */
199 1, /* agcObsRxSelect */
200 1, /* agcPeakThresholdMode */
201 1, /* agcLowThsPreventGainIncrease */
202 30720, /* agcGainUpdateCounter */
203 3, /* agcSlowLoopSettlingDelay */
204 2, /* agcPeakWaitTime */
205 1, /* agcResetOnRxEnable */
206 0, /* agcEnableSyncPulseForGainCounter */
207 &rxPeakAgc,
208 &rxPwrAgc
209 };
210
211 static mykonosPeakDetAgcCfg_t obsRxPeakAgc =
212 {
213 0x1F, /* apdHighThresh: */
214 0x16, /* apdLowThresh */
215 0xB5, /* hb2HighThresh */
216 0x80, /* hb2LowThresh */
217 0x40, /* hb2VeryLowThresh */
218 0x06, /* apdHighThreshExceededCnt */
219 0x04, /* apdLowThreshExceededCnt */
220 0x06, /* hb2HighThreshExceededCnt */
221 0x04, /* hb2LowThreshExceededCnt */
222 0x04, /* hb2VeryLowThreshExceededCnt */
223 0x4, /* apdHighGainStepAttack */
224 0x2, /* apdLowGainStepRecovery */
225 0x4, /* hb2HighGainStepAttack */
226 0x2, /* hb2LowGainStepRecovery */
227 0x4, /* hb2VeryLowGainStepRecovery */
228 0x1, /* apdFastAttack */
229 0x1, /* hb2FastAttack */
230 0x1, /* hb2OverloadDetectEnable */
231 0x1, /* hb2OverloadDurationCnt */
232 0x1 /* hb2OverloadThreshCnt */
233 };
234
235 static mykonosPowerMeasAgcCfg_t obsRxPwrAgc =
236 {
237 0x01, /* pmdUpperHighThresh */
238 0x03, /* pmdUpperLowThresh */
239 0x0C, /* pmdLowerHighThresh */
240 0x04, /* pmdLowerLowThresh */
241 0x4, /* pmdUpperHighGainStepAttack */
242 0x2, /* pmdUpperLowGainStepAttack */
243 0x2, /* pmdLowerHighGainStepRecovery */
244 0x4, /* pmdLowerLowGainStepRecovery */
245 0x08, /* pmdMeasDuration */
246 0x02 /* pmdMeasConfig */
247 };
248
249 static mykonosAgcCfg_t obsRxAgcConfig =
250 {
251 255, /* agcRx1MaxGainIndex */
252 195, /* agcRx1MinGainIndex */
253 255, /* agcRx2MaxGainIndex */
254 195, /* agcRx2MinGainIndex: */
255 255, /* agcObsRxMaxGainIndex */
256 203, /* agcObsRxMinGainIndex */
257 1, /* agcObsRxSelect */
258 1, /* agcPeakThresholdMode */
259 1, /* agcLowThsPreventGainIncrease */
260 30720, /* agcGainUpdateCounter */
261 3, /* agcSlowLoopSettlingDelay */
262 2, /* agcPeakWaitTime */
263 1, /* agcResetOnRxEnable */
264 0, /* agcEnableSyncPulseForGainCounter */
265 &obsRxPeakAgc,
266 &obsRxPwrAgc
267 };
268
269
270 static mykonosRxProfile_t rxProfile =
271 {/* Rx 100MHz, IQrate 122.88MSPS, Dec5 */
272 1, /* The divider used to generate the ADC clock*/
273 &rxFir, /* Pointer to Rx FIR filter structure*/
274 2, /* Rx FIR decimation (1,2,4)*/
275 5, /* Decimation of Dec5 or Dec4 filter (5,4)*/
276 1, /* If set, and DEC5 filter used, will use a higher rejection DEC5 FIR filter (1=Enabled, 0=Disabled)*/
277 1, /* RX Half band 1 decimation (1 or 2)*/
278 122880, /* Rx IQ data rate in kHz*/
279 100000000, /* The Rx RF passband bandwidth for the profile*/
280 100000, /* Rx BBF 3dB corner in kHz*/
281 NULL /* pointer to custom ADC profile*/
282 };
283
284 static mykonosRxProfile_t orxProfile =
285 {/* ORX 200MHz, IQrate 245.76MSPS, Dec5 */
286 1, /* The divider used to generate the ADC clock*/
287 &obsrxFir, /* Pointer to Rx FIR filter structure or NULL*/
288 1, /* Rx FIR decimation (1,2,4)*/
289 5, /* Decimation of Dec5 or Dec4 filter (5,4)*/
290 0, /* If set, and DEC5 filter used, will use a higher rejection DEC5 FIR filter (1=Enabled, 0=Disabled)*/
291 1, /* RX Half band 1 decimation (1 or 2)*/
292 245760, /* Rx IQ data rate in kHz*/
293 200000000, /* The Rx RF passband bandwidth for the profile*/
294 100000, /* Rx BBF 3dB corner in kHz*/
295 NULL /* pointer to custom ADC profile*/
296 };
297
298
299 static mykonosRxProfile_t snifferProfile =
300 { /* SRx 20MHz, IQrate 30.72MSPS, Dec5 */
301 1, /* The divider used to generate the ADC clock*/
302 &snifferRxFir, /* Pointer to Rx FIR filter structure or NULL*/
303 4, /* Rx FIR decimation (1,2,4)*/
304 5, /* Decimation of Dec5 or Dec4 filter (5,4)*/
305 0, /* If set, and DEC5 filter used, will use a higher rejection DEC5 FIR filter (1=Enabled, 0=Disabled)*/
306 2, /* RX Half band 1 decimation (1 or 2)*/
307 30720, /* Rx IQ data rate in kHz*/
308 20000000, /* The Rx RF passband bandwidth for the profile*/
309 100000, /* Rx BBF 3dB corner in kHz*/
310 NULL /* pointer to custom ADC profile*/
311 };
312
313
314
315 static mykonosTxProfile_t txProfile =
316 { /* Tx 75/200MHz, IQrate 245.76MSPS, Dec5 */
317 DACDIV_2p5, /* The divider used to generate the DAC clock*/
318 &txFir, /* Pointer to Tx FIR filter structure*/
319 1, /* The Tx digital FIR filter interpolation (1,2,4)*/
320 2, /* Tx Halfband1 filter interpolation (1,2)*/
321 1, /* Tx Halfband2 filter interpolation (1,2)*/
322 1, /* TxInputHbInterpolation (1,2)*/
323 245760, /* Tx IQ data rate in kHz*/
324 75000000, /* Primary Signal BW*/
325 200000000, /* The Tx RF passband bandwidth for the profile*/
326 189477, /* The DAC filter 3dB corner in kHz*/
327 100000, /* Tx BBF 3dB corner in kHz*/
328 0 /* Enable DPD, only valid for AD9373*/
329 };
330
331 static mykonosDigClocks_t mykonosClocks =
332 {
333 122880, /* CLKPLL and device reference clock frequency in kHz*/
334 9830400, /* CLKPLL VCO frequency in kHz*/
335 VCODIV_2, /* CLKPLL VCO divider*/
336 4 /* CLKPLL high speed clock divider*/
337 };
338
339 static mykonosRxSettings_t rxSettings =
340 {
341 &rxProfile, /* Rx datapath profile, 3dB corner frequencies, and digital filter enables*/
342 &rxFramer, /* Rx JESD204b framer configuration structure*/
343 &rxGainControl, /* Rx Gain control settings structure*/
344 &rxAgcConfig, /* Rx AGC control settings structure*/
345 3, /* The desired Rx Channels to enable during initialization*/
346 0, /* Internal LO = 0, external LO*2 = 1*/
347 2400000000U, /* Rx PLL LO Frequency (internal or external LO)*/
348 0 /* Flag to choose if complex baseband or real IF data are selected for Rx and ObsRx paths. Where, if > 0 = real IF data, '0' = zero IF (IQ) data*/
349 };
350
351 #ifdef CONFIG_DPD
352 static mykonosDpdConfig_t dpdConfig =
353 {
354 5, /* 1/2^(damping + 8) fraction of power `forgotten' per sample (default: `1/8192' = 5, valid 0 to 15), 0 = infinite damping*/
355 1, /* number of weights to use for int8_cpx weights weights member of this structure (default = 1)*/
356 2, /* DPD model version: one of four different generalized polynomial models: 0 = same as R0 silicon, 1-3 are new and the best one depends on the PA (default: 2)*/
357 1, /* 1 = Update saved model whenever peak Tx digital RMS is within 1dB of historical peak Tx RMS*/
358 20, /* Determines how much weight the loaded prior model has on DPD modeling (Valid 0 - 32, default 20)*/
359 0, /* Default off = 0, 1=enables automatic outlier removal during DPD modeling */
360 512, /* Number of samples to capture (default: 512, valid 64-32768)*/
361 4096, /* threshold for sample in AM-AM plot outside of 1:1 line to be thrown out. (default: 50% = 8192/2, valid 8192 to 1)*/
362 0, /* 16th of an ORx sample (16=1sample), (default 0, valid -64 to 64)*/
363 255, /* Default 255 (-30dBFs=(20Log10(value/8192)), (valid range 1 to 8191)*/
364 {{64,0},{0,0},{0,0}}/* DPD model error weighting (real/imag valid from -128 to 127)*/
365 };
366 #endif
367
368 #ifdef CONFIG_CLGC
369 static mykonosClgcConfig_t clgcConfig =
370 {
371 -2000, /* (value = 100 * dB (valid range -32768 to 32767) - total gain and attenuation from Mykonos Tx1 output to ORx1 input in (dB * 100)*/
372 -2000, /* (value = 100 * dB (valid range -32768 to 32767) - total gain and attenuation from Mykonos Tx2 output to ORx2 input in (dB * 100)*/
373 0, /* (valid range 0 - 40dB), no default, depends on PA, Protects PA by making sure Tx1Atten is not reduced below the limit*/
374 0, /* (valid range 0 - 40dB), no default, depends on PA, Protects PA by making sure Tx2Atten is not reduced below the limit*/
375 75, /* valid range 1-100, default 75*/
376 75, /* valid range 1-100, default 45*/
377 0, /* 0= allow CLGC to run, but Tx1Atten will not be updated. User can still read back power measurements. 1=CLGC runs, and Tx1Atten automatically updated*/
378 0, /* 0= allow CLGC to run, but Tx2Atten will not be updated. User can still read back power measurements. 1=CLGC runs, and Tx2Atten automatically updated*/
379 0, /* 16th of an ORx sample (16=1sample), (default 0, valid -64 to 64)*/
380 255 /* Default 255 (-30dBFs=(20Log10(value/8192)), (valid range 1 to 8191)*/
381 };
382 #endif
383
384 #ifdef CONFIG_VSWR
385 static mykonosVswrConfig_t vswrConfig =
386 {
387 0, /* 16th of an ORx sample (16=1sample), (default 0, valid -64 to 64)*/
388 255, /* Default 255 (-30dBFs=(20Log10(value/8192)), (valid range 1 to 8191)*/
389 0, /* 3p3V GPIO pin to use to control VSWR switch for Tx1 (valid 0-11) (output from Mykonos)*/
390 1, /* 3p3V GPIO pin to use to control VSWR switch for Tx2 (valid 0-11) (output from Mykonos)*/
391 0, /* 3p3v GPIO pin polarity for forward path of Tx1, opposite used for reflection path (1 = high level, 0 = low level)*/
392 0, /* 3p3v GPIO pin polarity for forward path of Tx2, opposite used for reflection path (1 = high level, 0 = low level)*/
393 1, /* Delay for Tx1 after flipping the VSWR switch until measurement is made. In ms resolution*/
394 1 /* Delay for Tx2 after flipping the VSWR switch until measurement is made. In ms resolution*/
395 };
396 #endif
397
398 static mykonosTxSettings_t txSettings =
399 {
400 &txProfile, /* Tx datapath profile, 3dB corner frequencies, and digital filter enables*/
401 &deframer, /* Mykonos JESD204b deframer config for the Tx data path*/
402 TX1_TX2, /* The desired Tx channels to enable during initialization*/
403 0, /* Internal LO=0, external LO*2 if =1*/
404 2400000000U, /* Tx PLL LO frequency (internal or external LO)*/
405 TXATTEN_0P05_DB,/* Initial and current Tx1 Attenuation*/
406 10000, /* Initial and current Tx1 Attenuation mdB*/
407 10000, /* Initial and current Tx2 Attenuation mdB*/
408 NULL, /* DPD,CLGC,VSWR settings. Only valid for AD9373 device, set pointer to NULL otherwise*/
409 NULL, /* CLGC Config Structure. Only valid for AD9373 device, set pointer to NULL otherwise*/
410 NULL /* VSWR Config Structure. Only valid for AD9373 device, set pointer to NULL otherwise*/
411 };
412
413
414 static mykonosObsRxSettings_t obsRxSettings =
415 {
416 &orxProfile, /* ORx datapath profile, 3dB corner frequencies, and digital filter enables*/
417 &orxGainControl,/* ObsRx gain control settings structure*/
418 &obsRxAgcConfig,/* ORx AGC control settings structure*/
419 &snifferProfile,/* Sniffer datapath profile, 3dB corner frequencies, and digital filter enables*/
420 &snifferGainControl,/* SnRx gain control settings structure*/
421 &obsRxFramer, /* ObsRx JESD204b framer configuration structure */
422 (MYK_ORX1_ORX2 | MYK_SNRXA_B_C),/* obsRxChannel */
423 OBSLO_TX_PLL, /* (obsRxLoSource) The Obs Rx mixer can use the Tx Synth(TX_PLL) or Sniffer Synth (SNIFFER_PLL) */
424 2400000000U, /* SnRx PLL LO frequency in Hz */
425 0, /* Flag to choose if complex baseband or real IF data are selected for Rx and ObsRx paths. Where if > 0 = real IF data, '0' = complex data*/
426 NULL, /* Custom Loopback ADC profile to set the bandwidth of the ADC response */
427 OBS_RXOFF /* Default ObsRx channel to enter when radioOn called */
428 };
429
430 static mykonosArmGpioConfig_t armGpio =
431 {
432 0, // useRx2EnablePin; /*!< 0= RX1_ENABLE controls RX1 and RX2, 1 = separate RX1_ENABLE/RX2_ENABLE pins */
433 0, // useTx2EnablePin; /*!< 0= TX1_ENABLE controls TX1 and TX2, 1 = separate TX1_ENABLE/TX2_ENABLE pins */
434 0, // txRxPinMode; /*!< 0= ARM command mode, 1 = Pin mode to power up Tx/Rx chains */
435 0, // orxPinMode; /*!< 0= ARM command mode, 1 = Pin mode to power up ObsRx receiver*/
436
437 /*Mykonos ARM input GPIO pins -- Only valid if orxPinMode = 1 */
438 0, // orxTriggerPin; /*!< Select desired GPIO pin (valid 4-15) */
439 0, // orxMode2Pin; /*!< Select desired GPIO pin (valid 0-18) */
440 0, // orxMode1Pin; /*!< Select desired GPIO pin (valid 0-18) */
441 0, // orxMode0Pin; /*!< Select desired GPIO pin (valid 0-18) */
442
443 /* Mykonos ARM output GPIO pins -- always available, even when pin mode not enabled*/
444 0, // rx1EnableAck; /*!< Select desired GPIO pin (0-15), [4] = Output Enable */
445 0, // rx2EnableAck; /*!< Select desired GPIO pin (0-15), [4] = Output Enable */
446 0, // tx1EnableAck; /*!< Select desired GPIO pin (0-15), [4] = Output Enable */
447 0, // tx2EnableAck; /*!< Select desired GPIO pin (0-15), [4] = Output Enable */
448 0, // orx1EnableAck; /*!< Select desired GPIO pin (0-15), [4] = Output Enable */
449 0, // orx2EnableAck; /*!< Select desired GPIO pin (0-15), [4] = Output Enable */
450 0, // srxEnableAck; /*!< Select desired GPIO pin (0-15), [4] = Output Enable */
451 0 // txObsSelect; /*!< Select desired GPIO pin (0-15), [4] = Output Enable */
452 /* When 2Tx are used with only 1 ORx input, this GPIO tells the BBIC which Tx channel is */
453 /* active for calibrations, so BBIC can route correct RF Tx path into the single ORx input*/
454 };
455
456 static mykonosGpio3v3_t gpio3v3 =
457 {
458 0, /*!< Oe per pin, 1=output, 0 = input */
459 GPIO3V3_BITBANG_MODE, /*!< Mode for GPIO3V3[3:0] */
460 GPIO3V3_BITBANG_MODE, /*!< Mode for GPIO3V3[7:4] */
461 GPIO3V3_BITBANG_MODE, /*!< Mode for GPIO3V3[11:8] */
462 };
463
464 static mykonosGpioLowVoltage_t gpio =
465 {
466 0,/* Oe per pin, 1=output, 0 = input */
467 GPIO_MONITOR_MODE,/* Mode for GPIO[3:0] */
468 GPIO_MONITOR_MODE,/* Mode for GPIO[7:4] */
469 GPIO_MONITOR_MODE,/* Mode for GPIO[11:8] */
470 GPIO_MONITOR_MODE,/* Mode for GPIO[15:12] */
471 GPIO_MONITOR_MODE,/* Mode for GPIO[18:16] */
472 };
473
474 static mykonosAuxIo_t mykonosAuxIo =
475 {
476 0, //auxDacEnableMask uint16_t
477 {0,0,0,0,0,0,0,0,0,0}, //AuxDacValue uint16[10]
478 {0,0,0,0,0,0,0,0,0,0}, //AuxDacSlope uint8[10]
479 {0,0,0,0,0,0,0,0,0,0}, //AuxDacVref uint8[10]
480 &gpio3v3, //pointer to gpio3v3 struct
481 &gpio, //pointer to gpio1v8 struct
482 &armGpio
483 };
484
485 static spiSettings_t mykSpiSettings =
486 {
487 5, /* chip select index - valid 1~8 */
488 0, /* the level of the write bit of a SPI write instruction word, value is inverted for SPI read operation */
489 1, /* 1 = 16-bit instruction word, 0 = 8-bit instruction word */
490 1, /* 1 = MSBFirst, 0 = LSBFirst */
491 0, /* clock phase, sets which clock edge the data updates (valid 0 or 1) */
492 0, /* clock polarity 0 = clock starts low, 1 = clock starts high */
493 0, /* Not implemented in ADIs platform layer. SW feature to improve SPI throughput */
494 1, /* Not implemented in ADIs platform layer. For SPI Streaming, set address increment direction. 1= next addr = addr+1, 0:addr=addr-1 */
495 1 /* 1: Use 4-wire SPI, 0: 3-wire SPI (SDIO pin is bidirectional). NOTE: ADI's FPGA platform always uses 4-wire mode */
496 };
497
498 #ifdef TMP_SENSOR
499 static mykonosTempSensorConfig_t tempSensor =
500 {
501 7, /* 3-bit value that controls the AuxADC decimation factor when used for temp sensor calculations; AuxADC_decimation = 256 * 2^tempDecimation*/
502 67, /* 8-bit offset that gets added to temp sensor code internally*/
503 1, /* this bit overrides the factory-calibrated fuse offset and uses the value stored in the offset member*/
504 15, /* 4-bit code with a resolution of 1°C/LSB, each time a temperature measurement is performed, the device compares the current temperature against the previous value.*/
505 };
506 #endif
507
508 #ifdef TMP_STATUS
509 static mykonosTempSensorStatus_t tempStatus =
510 {
511 0, /* 16-bit signed temperature value (in deg C) that is read back*/
512 0, /* If the absolute value of the difference is greater than the value in temperature configuration tempWindow, the windowExceeded flag is set.*/
513 0, /* when windowExceeded member gets set, this bit is set to 1 if current value is greater than previous value, else reset*/
514 0, /* when the reading is complete and a valid temperature value stored in tempCode.*/
515 };
516 #endif
517
518 mykonosDevice_t mykDevice =
519 {
520 &mykSpiSettings, /* SPI settings data structure pointer */
521 &rxSettings, /* Rx settings data structure pointer */
522 &txSettings, /* Tx settings data structure pointer */
523 &obsRxSettings, /* ObsRx settings data structure pointer */
524 &mykonosAuxIo, /* Auxiliary IO settings data structure pointer */
525 &mykonosClocks, /* Holds settings for CLKPLL and reference clock */
526 0 /* Mykonos initialize function uses this as an output to remember which profile data structure pointers are valid */
527 };