| 1 | /***************************************************************************//** |
| 2 | * @file ad9434_fmc_500ebz.c |
| 3 | * @brief Implementation of Main Function. |
| 4 | * @author DBogdan ([email protected]) |
| 5 | ******************************************************************************** |
| 6 | * Copyright 2015(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 | #include <xil_cache.h> |
| 44 | #include <xil_printf.h> |
| 45 | #include "xparameters.h" |
| 46 | #include "adc_core.h" |
| 47 | #include "platform_drivers.h" |
| 48 | #include "ad9265.h" |
| 49 | |
| 50 | /******************************************************************************/ |
| 51 | /********************** Macros and Constants Definitions **********************/ |
| 52 | /******************************************************************************/ |
| 53 | #define SPI_DEVICE_ID XPAR_PS7_SPI_0_DEVICE_ID |
| 54 | #define AD9265_CORE_BASEADDR XPAR_AXI_AD9265_BASEADDR |
| 55 | #define AD9265_DMA_BASEADDR XPAR_AXI_AD9265_DMA_BASEADDR |
| 56 | #define ADC_DDR_BASEADDR XPAR_DDR_MEM_BASEADDR + 0x800000 |
| 57 | |
| 58 | ad9265_init_param default_ad9265_init_param = { |
| 59 | 0, // spi_chip_select |
| 60 | SPI_MODE_0, // spi_mode |
| 61 | PS7_SPI, // spi_type |
| 62 | SPI_DEVICE_ID, // spi_device_id; |
| 63 | }; |
| 64 | |
| 65 | /***************************************************************************//** |
| 66 | * @brief main |
| 67 | *******************************************************************************/ |
| 68 | int main(void) |
| 69 | { |
| 70 | ad9265_dev *ad9265_device; |
| 71 | adc_core ad9625_core; |
| 72 | |
| 73 | Xil_ICacheEnable(); |
| 74 | Xil_DCacheEnable(); |
| 75 | |
| 76 | ad9625_core.adc_baseaddr = AD9265_CORE_BASEADDR; |
| 77 | ad9625_core.dmac_baseaddr = AD9265_DMA_BASEADDR; |
| 78 | ad9625_core.no_of_channels = 1; |
| 79 | adc_setup(ad9625_core); |
| 80 | |
| 81 | ad9265_setup(&ad9265_device, default_ad9265_init_param, ad9625_core); |
| 82 | |
| 83 | ad9265_testmode_set(ad9265_device, 0, TESTMODE_ONE_ZERO_TOGGLE); |
| 84 | |
| 85 | adc_capture(ad9625_core, 32768, ADC_DDR_BASEADDR); |
| 86 | |
| 87 | xil_printf("Done\n"); |
| 88 | |
| 89 | Xil_DCacheDisable(); |
| 90 | Xil_ICacheDisable(); |
| 91 | |
| 92 | return 0; |
| 93 | } |