no-OS
Loading...
Searching...
No Matches
iio_example.c File Reference

IIO example for the AD9082 (VPK180) project. More...

#include "iio_example.h"
#include "common_data.h"
#include "parameters.h"
#include "app_config.h"
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include "no_os_error.h"
#include "no_os_gpio.h"
#include "no_os_spi.h"
#include "no_os_util.h"
#include "no_os_delay.h"
#include "no_os_print_log.h"
#include "xilinx_gpio.h"
#include "xilinx_spi.h"
#include "xilinx_uart.h"
#include "xil_cache.h"
#include "ad9081.h"
#include "axi_jesd204_rx.h"
#include "axi_jesd204_tx.h"
#include "axi_adc_core.h"
#include "axi_dac_core.h"
#include "axi_dmac.h"
#include "no_os_axi_io.h"
#include "iio_axi_adc.h"
#include "iio_axi_dac.h"
#include "iio_app.h"
Include dependency graph for iio_example.c:

Macros

#define TX_OFFLOAD_MAX_BYTES   (512 * 1024)
 
#define AXI_DO_REG_MEMORY_SIZE_LSB   0x0014
 
#define AXI_DO_REG_RESETN_OFFLOAD   0x0084
 
#define DMA_BUFFER_ALIGN   4096
 
#define DMA_BUFFER_SLACK   (DMA_BUFFER_ALIGN / sizeof(uint16_t))
 

Functions

int example_main (void)
 IIO example main execution.
 

Variables

uint16_t adc_buffer [MAX_ADC_BUF_SAMPLES *AD9081_RX_JESD_M]
 
uint16_t dac_buffer [TX_OFFLOAD_MAX_BYTES/sizeof(uint16_t)]
 

Detailed Description

IIO example for the AD9082 (VPK180) project.

    Brings the HMC7044 clocks, the AXI-JESD204 RX/TX cores and the
    AD9082 (ad9081 driver) up exactly like the basic example, then
    exposes the AXI ADC and DAC over the IIO framework
    (iio_axi_adc / iio_axi_dac) and runs iio_app_run() so an IIO host
    can capture ADC samples and inject DAC samples over the console
    UART.

    NOTE: the PL DMACs master DDR over the Versal NoC (routed to the
    DDR controller by the ADI vpk180 HDL) and are not cache-coherent
    with the CPU; the IIO AXI ADC/DAC drivers keep the capture/playback
    buffers coherent through the dcache invalidate/flush callbacks
    passed below.  The buffers are 1 KB aligned and sized to whole cache
    lines so those cache ops never touch neighbouring data.
Author
Analog Devices, Inc.

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ AXI_DO_REG_MEMORY_SIZE_LSB

#define AXI_DO_REG_MEMORY_SIZE_LSB   0x0014

◆ AXI_DO_REG_RESETN_OFFLOAD

#define AXI_DO_REG_RESETN_OFFLOAD   0x0084

◆ DMA_BUFFER_ALIGN

#define DMA_BUFFER_ALIGN   4096

◆ DMA_BUFFER_SLACK

#define DMA_BUFFER_SLACK   (DMA_BUFFER_ALIGN / sizeof(uint16_t))

◆ TX_OFFLOAD_MAX_BYTES

#define TX_OFFLOAD_MAX_BYTES   (512 * 1024)

Function Documentation

◆ example_main()

int example_main ( void )

IIO example main execution.

Basic example main execution.

Basic example main executiont.

Returns
0 on success, negative error code otherwise.

IIO descriptor and initialization parameter.

IIO app.

Declaring iio_devices structure

Initializing IIO app init param.

Initializing IIO app.

Running the IIO app (use iio_info or osc in terminal).

Set the threshold voltage to 5V

The comparator output will be available on the GPO_A pin

Set the DAC output on channel C to 5V

Measure input current on channel D

Variable Documentation

◆ adc_buffer

uint16_t adc_buffer[MAX_ADC_BUF_SAMPLES *AD9081_RX_JESD_M]

◆ dac_buffer

uint16_t dac_buffer[TX_OFFLOAD_MAX_BYTES/sizeof(uint16_t)]