Debian Codegraph @

thirdparty/analogdevicesinc/no-OS/fmcdaq2/fmcdaq2.c

raw symbols SCIP
1 /***************************************************************************//**
2 * @file ad_fmcdaq2_ebz.c
3 * @brief Implementation of Main Function.
4 * @author DBogdan ([email protected])
5 ********************************************************************************
6 * Copyright 2014-2016(c) Analog Devices, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 * - Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * - Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * - Neither the name of Analog Devices, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 * - The use of this software may or may not infringe the patent rights
22 * of one or more patent holders. This license does not release you
23 * from the requirement that you obtain separate licenses from these
24 * patent holders to use this software.
25 * - Use of the software either in source or binary form, must be run
26 * on or directly connected to an Analog Devices Inc. component.
27 *
28 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
34 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *******************************************************************************/
39
40 /******************************************************************************/
41 /***************************** Include Files **********************************/
42 /******************************************************************************/
43
44 #include "platform_drivers.h"
45 #include "ad9144.h"
46 #include "ad9523.h"
47 #include "ad9680.h"
48 #include "adc_core.h"
49 #include "dac_core.h"
50 #include "dmac_core.h"
51 #include "dac_buffer.h"
52 #include "xcvr_core.h"
53 #include "jesd_core.h"
54
55 /******************************************************************************/
56 /********************** Macros and Constants Definitions **********************/
57 /******************************************************************************/
58
59 #define GPIO_TRIG 43
60 #define GPIO_ADC_PD 42
61 #define GPIO_DAC_TXEN 41
62 #define GPIO_DAC_RESET 40
63 #define GPIO_CLKD_SYNC 38
64 #define GPIO_ADC_FDB 36
65 #define GPIO_ADC_FDA 35
66 #define GPIO_DAC_IRQ 34
67 #define GPIO_CLKD_STATUS_1 33
68 #define GPIO_CLKD_STATUS_0 32
69
70 enum ad9523_channels {
71 DAC_DEVICE_CLK,
72 DAC_DEVICE_SYSREF,
73 DAC_FPGA_CLK,
74 DAC_FPGA_SYSREF,
75 ADC_DEVICE_CLK,
76 ADC_DEVICE_SYSREF,
77 ADC_FPGA_CLK,
78 ADC_FPGA_SYSREF,
79 };
80
81 /***************************************************************************//**
82 * @brief main
83 *******************************************************************************/
84 int fmcdaq2_reconfig(ad9144_init_param *p_ad9144_param, xcvr_core *p_ad9144_xcvr,
85 ad9680_init_param *p_ad9680_param, xcvr_core *p_ad9680_xcvr,
86 ad9523_platform_data *p_ad9523_param)
87 {
88
89 #ifdef ALTERA
90 return(0);
91 #endif
92
93 #ifdef XILINX
94
95 uint8_t mode = 0;
96
97 ad_printf ("Available sampling rates:\n");
98 ad_printf ("\t1 - ADC 1000 MSPS; DAC 1000 MSPS\n");
99 ad_printf ("\t2 - ADC 500 MSPS; DAC 1000 MSPS\n");
100 ad_printf ("\t3 - ADC 500 MSPS; DAC 500 MSPS\n");
101 ad_printf ("\t4 - ADC 750 MSPS; DAC 750 MSPS\n");
102
103 mode = ad_uart_read();
104
105 switch (mode) {
106 case '1':
107 p_ad9523_param->pll2_vco_diff_m1 = 3;
108 (&p_ad9523_param->channels[DAC_FPGA_CLK])->channel_divider = 2;
109 (&p_ad9523_param->channels[DAC_DEVICE_CLK])->channel_divider = 1;
110 (&p_ad9523_param->channels[DAC_DEVICE_SYSREF])->channel_divider = 128;
111 (&p_ad9523_param->channels[DAC_FPGA_SYSREF])->channel_divider = 128;
112 (&p_ad9523_param->channels[ADC_FPGA_CLK])->channel_divider = 2;
113 (&p_ad9523_param->channels[ADC_DEVICE_CLK])->channel_divider = 1;
114 (&p_ad9523_param->channels[ADC_DEVICE_SYSREF])->channel_divider = 128;
115 (&p_ad9523_param->channels[ADC_FPGA_SYSREF])->channel_divider = 128;
116 p_ad9144_xcvr->reconfig_bypass = 0;
117 p_ad9144_xcvr->lpm_enable = 1;
118 p_ad9144_xcvr->out_clk_sel = 4;
119 p_ad9144_xcvr->sys_clk_sel = 3;
120 p_ad9144_param->lane_rate_kbps = 10000000;
121 p_ad9144_xcvr->lane_rate_kbps = 10000000;
122 p_ad9144_xcvr->ref_clock_khz = 500000;
123 p_ad9680_xcvr->reconfig_bypass = 0;
124 p_ad9680_xcvr->lpm_enable = 1;
125 p_ad9680_xcvr->out_clk_sel = 4;
126 p_ad9680_xcvr->sys_clk_sel = 3;
127 p_ad9680_param->lane_rate_kbps = 10000000;
128 p_ad9680_xcvr->lane_rate_kbps = 10000000;
129 p_ad9680_xcvr->ref_clock_khz = 500000;
130 break;
131 case '2':
132 p_ad9523_param->pll2_vco_diff_m1 = 3;
133 (&p_ad9523_param->channels[DAC_FPGA_CLK])->channel_divider = 2;
134 (&p_ad9523_param->channels[DAC_DEVICE_CLK])->channel_divider = 1;
135 (&p_ad9523_param->channels[DAC_DEVICE_SYSREF])->channel_divider = 128;
136 (&p_ad9523_param->channels[DAC_FPGA_SYSREF])->channel_divider = 128;
137 (&p_ad9523_param->channels[ADC_FPGA_CLK])->channel_divider = 4;
138 (&p_ad9523_param->channels[ADC_DEVICE_CLK])->channel_divider = 2;
139 (&p_ad9523_param->channels[ADC_DEVICE_SYSREF])->channel_divider = 256;
140 (&p_ad9523_param->channels[ADC_FPGA_SYSREF])->channel_divider = 256;
141 p_ad9144_xcvr->reconfig_bypass = 0;
142 p_ad9144_xcvr->lpm_enable = 0;
143 p_ad9144_xcvr->out_clk_sel = 4;
144 p_ad9144_xcvr->sys_clk_sel = 3;
145 p_ad9144_param->lane_rate_kbps = 10000000;
146 p_ad9144_xcvr->lane_rate_kbps = 10000000;
147 p_ad9144_xcvr->ref_clock_khz = 500000;
148 p_ad9680_xcvr->reconfig_bypass = 0;
149 p_ad9680_xcvr->lpm_enable = 1;
150 p_ad9680_xcvr->out_clk_sel = 4;
151 p_ad9680_xcvr->sys_clk_sel = 0;
152 p_ad9680_param->lane_rate_kbps = 5000000;
153 p_ad9680_xcvr->lane_rate_kbps = 5000000;
154 p_ad9680_xcvr->ref_clock_khz = 250000;
155 break;
156 case '3':
157 p_ad9523_param->pll2_vco_diff_m1 = 3;
158 (&p_ad9523_param->channels[DAC_FPGA_CLK])->channel_divider = 4;
159 (&p_ad9523_param->channels[DAC_DEVICE_CLK])->channel_divider = 2;
160 (&p_ad9523_param->channels[DAC_DEVICE_SYSREF])->channel_divider = 256;
161 (&p_ad9523_param->channels[DAC_FPGA_SYSREF])->channel_divider = 256;
162 (&p_ad9523_param->channels[ADC_FPGA_CLK])->channel_divider = 4;
163 (&p_ad9523_param->channels[ADC_DEVICE_CLK])->channel_divider = 2;
164 (&p_ad9523_param->channels[ADC_DEVICE_SYSREF])->channel_divider = 256;
165 (&p_ad9523_param->channels[ADC_FPGA_SYSREF])->channel_divider = 256;
166 p_ad9144_xcvr->reconfig_bypass = 0;
167 p_ad9144_xcvr->lpm_enable = 1;
168 p_ad9144_xcvr->out_clk_sel = 4;
169 p_ad9144_xcvr->sys_clk_sel = 0;
170 p_ad9144_param->lane_rate_kbps = 5000000;
171 p_ad9144_xcvr->lane_rate_kbps = 5000000;
172 p_ad9144_xcvr->ref_clock_khz = 250000;
173 p_ad9680_xcvr->reconfig_bypass = 0;
174 p_ad9680_xcvr->lpm_enable = 1;
175 p_ad9680_xcvr->out_clk_sel = 4;
176 p_ad9680_xcvr->sys_clk_sel = 0;
177 p_ad9680_param->lane_rate_kbps = 5000000;
178 p_ad9680_xcvr->lane_rate_kbps = 5000000;
179 p_ad9680_xcvr->ref_clock_khz = 250000;
180 break;
181 case '4':
182 p_ad9523_param->pll2_vco_diff_m1 = 4;
183 (&p_ad9523_param->channels[DAC_FPGA_CLK])->channel_divider = 2;
184 (&p_ad9523_param->channels[DAC_DEVICE_CLK])->channel_divider = 1;
185 (&p_ad9523_param->channels[DAC_DEVICE_SYSREF])->channel_divider = 128;
186 (&p_ad9523_param->channels[DAC_FPGA_SYSREF])->channel_divider = 128;
187 (&p_ad9523_param->channels[ADC_FPGA_CLK])->channel_divider = 2;
188 (&p_ad9523_param->channels[ADC_DEVICE_CLK])->channel_divider = 1;
189 (&p_ad9523_param->channels[ADC_DEVICE_SYSREF])->channel_divider = 128;
190 (&p_ad9523_param->channels[ADC_FPGA_SYSREF])->channel_divider = 128;
191 p_ad9144_xcvr->reconfig_bypass = 0;
192 p_ad9144_xcvr->lpm_enable = 0;
193 p_ad9144_xcvr->out_clk_sel = 4;
194 p_ad9144_xcvr->sys_clk_sel = 0;
195 p_ad9144_param->lane_rate_kbps = 7500000;
196 p_ad9144_xcvr->lane_rate_kbps = 7500000;
197 p_ad9144_xcvr->ref_clock_khz = 375000;
198 p_ad9680_xcvr->reconfig_bypass = 0;
199 p_ad9680_xcvr->lpm_enable = 1;
200 p_ad9680_xcvr->out_clk_sel = 4;
201 p_ad9680_xcvr->sys_clk_sel = 0;
202 p_ad9680_param->lane_rate_kbps = 7500000;
203 p_ad9680_xcvr->lane_rate_kbps = 7500000;
204 p_ad9680_xcvr->ref_clock_khz = 375000;
205 break;
206 default:
207 ad_printf("Unknown selection.\n");
208 return -1;
209 }
210 return(0);
211 #endif
212 }
213
214 /***************************************************************************//**
215 * @brief main
216 *******************************************************************************/
217 int main(void)
218 {
219 spi_device ad9523_spi_device;
220 spi_device ad9144_spi_device;
221 spi_device ad9680_spi_device;
222
223 ad9523_channel_spec ad9523_channels[8];
224 ad9523_platform_data ad9523_param;
225 ad9144_init_param ad9144_param;
226 ad9680_init_param ad9680_param;
227
228 dac_core ad9144_core;
229 dac_channel ad9144_channels[2];
230 jesd_core ad9144_jesd;
231 xcvr_core ad9144_xcvr;
232 adc_core ad9680_core;
233 jesd_core ad9680_jesd;
234 xcvr_core ad9680_xcvr;
235 dmac_core ad9680_dma;
236 dmac_xfer rx_xfer;
237
238 //********************************************************************************
239 // setup the base addresses
240 //********************************************************************************
241
242 #ifdef XILINX
243 ad9144_xcvr.base_address = XPAR_AXI_AD9144_XCVR_BASEADDR;
244 ad9144_core.base_address = XPAR_AXI_AD9144_CORE_BASEADDR;
245 ad9144_jesd.base_address = XPAR_AXI_AD9144_JESD_BASEADDR;
246 ad9680_xcvr.base_address = XPAR_AXI_AD9680_XCVR_BASEADDR;
247 ad9680_core.base_address = XPAR_AXI_AD9680_CORE_BASEADDR;
248 ad9680_jesd.base_address = XPAR_AXI_AD9680_JESD_BASEADDR;
249 ad9680_dma.base_address = XPAR_AXI_AD9680_DMA_BASEADDR;
250 #endif
251
252 #ifdef ZYNQ
253 rx_xfer.start_address = XPAR_DDR_MEM_BASEADDR + 0x800000;
254 #endif
255
256 #ifdef MICROBLAZE
257 rx_xfer.start_address = XPAR_AXI_DDR_CNTRL_BASEADDR + 0x800000;
258 #endif
259
260 #ifdef ALTERA
261 ad9144_xcvr.base_address = AXI_AD9144_XCVR_BASE;
262 ad9144_core.base_address = AXI_AD9144_CORE_BASE;
263 ad9680_xcvr.base_address = AXI_AD9680_XCVR_BASE;
264 ad9680_core.base_address = AXI_AD9680_CORE_BASE;
265 ad9144_jesd.base_address = AVL_AD9144_XCVR_IP_RECONFIG_BASE;
266 ad9680_jesd.base_address = AVL_AD9680_XCVR_IP_RECONFIG_BASE;
267 ad9144_xcvr.mmcm_lpll_base_address = AVL_AD9144_XCVR_CORE_PLL_RECONFIG_BASE;
268 ad9680_xcvr.mmcm_lpll_base_address = AVL_AD9680_XCVR_CORE_PLL_RECONFIG_BASE;
269 ad9144_xcvr.tx_lane_pll_base_address = AVL_AD9144_XCVR_LANE_PLL_RECONFIG_BASE;
270 ad9680_dma.base_address = AXI_AD9680_DMA_BASE;
271 rx_xfer.start_address = 0x800000;
272 #endif
273
274 //********************************************************************************
275 // SPI interface configuration
276 //********************************************************************************
277
278 ad_spi_init(&ad9523_spi_device);
279 ad_spi_init(&ad9144_spi_device);
280 ad_spi_init(&ad9680_spi_device);
281
282 ad9523_spi_device.chip_select = 0x6;
283 ad9144_spi_device.chip_select = 0x5;
284 ad9680_spi_device.chip_select = 0x3;
285
286 //********************************************************************************
287 // clock distribution device (AD9523) configuration
288 //********************************************************************************
289
290 ad9523_param.num_channels = 8;
291 ad9523_param.channels = &ad9523_channels[0];
292 ad9523_init(&ad9523_param);
293
294 // dac device-clk-sysref, fpga-clk-sysref
295
296 ad9523_channels[DAC_DEVICE_CLK].channel_num = 1;
297 ad9523_channels[DAC_DEVICE_CLK].channel_divider = 1;
298 ad9523_channels[DAC_DEVICE_SYSREF].channel_num = 7;
299 ad9523_channels[DAC_DEVICE_SYSREF].channel_divider = 128;
300 ad9523_channels[DAC_FPGA_CLK].channel_num = 9;
301 ad9523_channels[DAC_FPGA_CLK].channel_divider = 2;
302 ad9523_channels[DAC_FPGA_SYSREF].channel_num = 8;
303 ad9523_channels[DAC_FPGA_SYSREF].channel_divider = 128;
304
305 // adc device-clk-sysref, fpga-clk-sysref
306
307 ad9523_channels[ADC_DEVICE_CLK].channel_num = 13;
308 ad9523_channels[ADC_DEVICE_CLK].channel_divider = 1;
309 ad9523_channels[ADC_DEVICE_SYSREF].channel_num = 6;
310 ad9523_channels[ADC_DEVICE_SYSREF].channel_divider = 128;
311 ad9523_channels[ADC_FPGA_CLK].channel_num = 4;
312 ad9523_channels[ADC_FPGA_CLK].channel_divider = 2;
313 ad9523_channels[ADC_FPGA_SYSREF].channel_num = 5;
314 ad9523_channels[ADC_FPGA_SYSREF].channel_divider = 128;
315
316 // VCXO 125MHz
317
318 ad9523_param.vcxo_freq = 125000000;
319 ad9523_param.spi3wire = 1;
320 ad9523_param.osc_in_diff_en = 1;
321 ad9523_param.pll2_charge_pump_current_nA = 413000;
322 ad9523_param.pll2_freq_doubler_en = 0;
323 ad9523_param.pll2_r2_div = 1;
324 ad9523_param.pll2_ndiv_a_cnt = 0;
325 ad9523_param.pll2_ndiv_b_cnt = 6;
326 ad9523_param.pll2_vco_diff_m1 = 3;
327 ad9523_param.pll2_vco_diff_m2 = 0;
328 ad9523_param.rpole2 = 0;
329 ad9523_param.rzero = 7;
330 ad9523_param.cpole1 = 2;
331
332 //********************************************************************************
333 // DAC (AD9144) and the transmit path (AXI_ADXCVR,
334 // JESD204, AXI_AD9144, TX DMAC) configuration
335 //********************************************************************************
336
337 xcvr_getconfig(&ad9144_xcvr);
338 ad9144_xcvr.mmcm_present = 0;
339 ad9144_xcvr.reconfig_bypass = 1;
340 ad9144_xcvr.lane_rate_kbps = 10000000;
341
342 ad9144_jesd.rx_tx_n = 0;
343 ad9144_jesd.scramble_enable = 1;
344 ad9144_jesd.octets_per_frame = 1;
345 ad9144_jesd.frames_per_multiframe = 32;
346 ad9144_jesd.subclass_mode = 1;
347
348 ad9144_channels[0].dds_dual_tone = 0;
349 ad9144_channels[0].dds_frequency_0 = 33*1000*1000;
350 ad9144_channels[0].dds_phase_0 = 0;
351 ad9144_channels[0].dds_scale_0 = 500000;
352 ad9144_channels[0].pat_data = 0xb1b0a1a0;
353 ad9144_channels[1].dds_dual_tone = 0;
354 ad9144_channels[1].dds_frequency_0 = 11*1000*1000;
355 ad9144_channels[1].dds_phase_0 = 0;
356 ad9144_channels[1].dds_scale_0 = 500000;
357 ad9144_channels[1].pat_data = 0xd1d0c1c0;
358 ad9144_channels[0].sel = DAC_SRC_DDS;
359 ad9144_channels[1].sel = DAC_SRC_DDS;
360
361 ad9144_param.lane_rate_kbps = 10000000;
362 ad9144_param.active_converters = 2;
363
364 ad9144_core.no_of_channels = ad9144_param.active_converters;
365 ad9144_core.resolution = 16;
366 ad9144_core.channels = &ad9144_channels[0];
367
368 ad9144_param.stpl_samples[0][0] = (ad9144_channels[0].pat_data>> 0) & 0xffff;
369 ad9144_param.stpl_samples[0][1] = (ad9144_channels[0].pat_data>>16) & 0xffff;
370 ad9144_param.stpl_samples[0][2] = (ad9144_channels[0].pat_data>> 0) & 0xffff;
371 ad9144_param.stpl_samples[0][3] = (ad9144_channels[0].pat_data>>16) & 0xffff;
372 ad9144_param.stpl_samples[1][0] = (ad9144_channels[1].pat_data>> 0) & 0xffff;
373 ad9144_param.stpl_samples[1][1] = (ad9144_channels[1].pat_data>>16) & 0xffff;
374 ad9144_param.stpl_samples[1][2] = (ad9144_channels[1].pat_data>> 0) & 0xffff;
375 ad9144_param.stpl_samples[1][3] = (ad9144_channels[1].pat_data>>16) & 0xffff;
376
377 //********************************************************************************
378 // ADC (AD9680) and the transmit path ( AXI_ADXCVR,
379 // JESD204, AXI_AD9680, TX DMAC) configuration
380 //********************************************************************************
381
382 ad9680_param.lane_rate_kbps = 10000000;
383
384 xcvr_getconfig(&ad9680_xcvr);
385 ad9680_xcvr.mmcm_present = 0;
386 ad9680_xcvr.reconfig_bypass = 1;
387 ad9680_xcvr.lane_rate_kbps = ad9680_param.lane_rate_kbps;
388
389 ad9680_jesd.scramble_enable = 1;
390 ad9680_jesd.octets_per_frame = 1;
391 ad9680_jesd.frames_per_multiframe = 32;
392 ad9680_jesd.subclass_mode = 1;
393
394 ad9680_core.no_of_channels = 2;
395 ad9680_core.resolution = 14;
396
397 //********************************************************************************
398 // configure the receiver DMA
399 //********************************************************************************
400
401 ad9680_dma.type = DMAC_RX;
402 ad9680_dma.transfer = &rx_xfer;
403 rx_xfer.id = 0;
404 rx_xfer.size = 32768;
405
406 // change the default JESD configurations, if required
407
408 fmcdaq2_reconfig(&ad9144_param, &ad9144_xcvr, &ad9680_param, &ad9680_xcvr, &ad9523_param);
409
410 //********************************************************************************
411 // bring up the system
412 //********************************************************************************
413
414 // setup GPIOs
415
416 ad_platform_init();
417 ad_gpio_set(GPIO_DAC_RESET, 0);
418 mdelay(1);
419
420 ad_gpio_set(GPIO_CLKD_SYNC, 1);
421 ad_gpio_set(GPIO_DAC_RESET, 1);
422 ad_gpio_set(GPIO_DAC_TXEN, 1);
423 ad_gpio_set(GPIO_ADC_PD, 0);
424
425 // setup clocks
426
427 ad9523_setup(&ad9523_spi_device, &ad9523_param);
428
429 // set up the devices
430 ad9680_setup(&ad9680_spi_device, ad9680_param);
431 ad9144_setup(&ad9144_spi_device, ad9144_param);
432
433 // set up the JESD core
434 jesd_setup(ad9680_jesd);
435 jesd_setup(ad9144_jesd);
436
437 // set up the XCVRs
438 if (ad9144_xcvr.sys_clk_sel == 3) { // DAC_XCVR controls the QPLL reset
439 xcvr_setup(ad9144_xcvr);
440 xcvr_setup(ad9680_xcvr);
441 } else { // ADC_XCVR controls the CPLL reset
442 xcvr_setup(ad9680_xcvr);
443 xcvr_setup(ad9144_xcvr);
444 }
445
446 // JESD core status
447 jesd_status(ad9144_jesd);
448 jesd_status(ad9680_jesd);
449
450 // interface core set up
451 adc_setup(ad9680_core);
452 dac_setup(ad9144_core);
453
454 ad9144_status(&ad9144_spi_device);
455
456 //********************************************************************************
457 // transport path testing
458 //********************************************************************************
459
460 ad9144_channels[0].sel = DAC_SRC_SED;
461 ad9144_channels[1].sel = DAC_SRC_SED;
462 dac_data_setup(ad9144_core);
463 ad9144_short_pattern_test(&ad9144_spi_device, ad9144_param);
464
465 // PN7 data path test
466
467 ad9144_channels[0].sel = DAC_SRC_PN23;
468 ad9144_channels[1].sel = DAC_SRC_PN23;
469 dac_data_setup(ad9144_core);
470 ad9144_param.prbs_type = AD9144_PRBS7;
471 ad9144_datapath_prbs_test(&ad9144_spi_device, ad9144_param);
472
473 // PN15 data path test
474
475 ad9144_channels[0].sel = DAC_SRC_PN31;
476 ad9144_channels[1].sel = DAC_SRC_PN31;
477 dac_data_setup(ad9144_core);
478 ad9144_param.prbs_type = AD9144_PRBS15;
479 ad9144_datapath_prbs_test(&ad9144_spi_device, ad9144_param);
480
481 //********************************************************************************
482 // receive path testing
483 //********************************************************************************
484
485 ad9680_test(&ad9680_spi_device, AD9680_TEST_PN9);
486 adc_pn_mon(ad9680_core, ADC_PN9);
487 ad9680_test(&ad9680_spi_device, AD9680_TEST_PN23);
488 adc_pn_mon(ad9680_core, ADC_PN23A);
489
490 // default data
491
492 ad9144_channels[0].sel = DAC_SRC_DDS;
493 ad9144_channels[1].sel = DAC_SRC_DDS;
494 dac_data_setup(ad9144_core);
495 ad9680_test(&ad9680_spi_device, AD9680_TEST_OFF);
496
497 ad_printf("daq2: setup and configuration is done\n");
498
499 //********************************************************************************
500 // external loopback - capture data with DMA
501 //********************************************************************************
502
503 if(!dmac_start_transaction(ad9680_dma)){
504 ad_printf("daq2: RX capture done.\n");
505 };
506
507 ad_platform_close();
508 return(0);
509 }