no-OS
Loading...
Searching...
No Matches
axi_dac_core.h File Reference

Driver for the Analog Devices AXI-DAC-CORE module. More...

#include <stdint.h>
Include dependency graph for axi_dac_core.h:

Classes

struct  axi_dac
 AXI DAC Device Descriptor. More...
 
struct  axi_dac_init
 
struct  axi_dac_channel
 

Enumerations

enum  axi_iface {
  AXI_DAC_BUS_TYPE_NONE ,
  AXI_DAC_BUS_TYPE_QSPI
}
 
enum  axi_io_mode {
  AXI_DAC_IO_MODE_SPI ,
  AXI_DAC_IO_MODE_DSPI ,
  AXI_DAC_IO_MODE_QSPI
}
 
enum  axi_dac_data_sel {
  AXI_DAC_DATA_SEL_DDS ,
  AXI_DAC_DATA_SEL_SED ,
  AXI_DAC_DATA_SEL_DMA ,
  AXI_DAC_DATA_SEL_ZERO ,
  AXI_DAC_DATA_SEL_PN7 ,
  AXI_DAC_DATA_SEL_PN15 ,
  AXI_DAC_DATA_SEL_PN23 ,
  AXI_DAC_DATA_SEL_PN31 ,
  AXI_DAC_DATA_SEL_LB ,
  AXI_DAC_DATA_SEL_PNXX
}
 

Functions

int32_t axi_dac_init_begin (struct axi_dac **dac_core, const struct axi_dac_init *init)
 Begin AXI DAC Initialization.
 
int32_t axi_dac_init_finish (struct axi_dac *dac)
 Begin AXI DAC Initialization.
 
int32_t axi_dac_init (struct axi_dac **dac_core, const struct axi_dac_init *init)
 AXI DAC Main Initialization.
 
int32_t axi_dac_remove (struct axi_dac *dac)
 AXI DAC Resources deallocation.
 
int32_t axi_dac_set_datasel (struct axi_dac *dac, int32_t chan, enum axi_dac_data_sel sel)
 AXI DAC Set Data type for specific channel.
 
int32_t axi_dac_dds_set_frequency (struct axi_dac *dac, uint32_t chan, uint32_t freq_hz)
 AXI DAC Set DDS frequency for specific channel.
 
int32_t axi_dac_dds_get_frequency (struct axi_dac *dac, uint32_t chan, uint32_t *freq)
 AXI DAC Get DDS frequency for specific channel.
 
int32_t axi_dac_dds_set_phase (struct axi_dac *dac, uint32_t chan, uint32_t phase)
 AXI DAC Set DDS phase for specific channel.
 
int32_t axi_dac_dds_get_phase (struct axi_dac *dac, uint32_t chan, uint32_t *phase)
 AXI DAC Get DDS phase for specific channel.
 
int32_t axi_dac_dds_set_scale (struct axi_dac *dac, uint32_t chan, int32_t scale_micro_units)
 AXI DAC Set DDS scale for specific channel.
 
int32_t axi_dac_dds_get_scale (struct axi_dac *dac, uint32_t chan, int32_t *scale_micro_units)
 AXI DAC Get DDS scale for specific channel.
 
int32_t axi_dac_set_buff (struct axi_dac *dac, uint32_t address, uint16_t *buff, uint32_t buff_size)
 AXI DAC Set data buffer.
 
uint32_t axi_dac_set_sine_lut (struct axi_dac *dac, uint32_t address)
 AXI DAC Set data based on a Sine Lookup Table.
 
int32_t axi_dac_dds_get_calib_scale (struct axi_dac *dac, uint32_t chan, int32_t *val, int32_t *val2)
 Get the scale calibration values for AXI DAC channel.
 
int32_t axi_dac_dds_get_calib_phase (struct axi_dac *dac, uint32_t chan, int32_t *val, int32_t *val2)
 Get the phase calibration values for AXI DAC channel.
 
int32_t axi_dac_dds_set_calib_scale (struct axi_dac *dac, uint32_t chan, int32_t val, int32_t val2)
 Calibrate scale for specific AXI DAC channel.
 
int32_t axi_dac_dds_set_calib_phase (struct axi_dac *dac, uint32_t chan, int32_t val, int32_t val2)
 Calibrate phase for specific AXI DAC channel.
 
int32_t axi_dac_load_custom_data (struct axi_dac *dac, const uint32_t *custom_data_iq, uint32_t custom_tx_count, uint32_t address)
 AXI DAC Load custom data.
 
int32_t axi_dac_data_setup (struct axi_dac *dac)
 AXI DAC Data Setup.
 
int32_t axi_dac_bus_read (struct axi_dac *dac, uint32_t reg_addr, uint32_t *reg_data, uint8_t data_size)
 AXI DAC Bus Data Read.
 
int32_t axi_dac_bus_write (struct axi_dac *dac, uint32_t reg_addr, uint32_t reg_data, uint8_t data_size)
 AXI DAC Bus Data Write.
 
int32_t axi_dac_set_ddr (struct axi_dac *dac, bool enable)
 AXI DAC Set DDR (bus double-data-rate) mode.
 
int32_t axi_dac_set_io_mode (struct axi_dac *dac, enum axi_io_mode mode)
 AXI DAC Set IO mode.
 
int32_t axi_dac_set_data_stream (struct axi_dac *dac, bool enable)
 AXI DAC Set data stream mode.
 
int32_t axi_dac_data_transfer_addr (struct axi_dac *dac, uint32_t address)
 AXI DAC Set starting dma data trasfer address.
 
int32_t axi_dac_data_format_set (struct axi_dac *dac, int format)
 AXI DAC data format.
 

Variables

const uint16_t sine_lut [128]
 
const uint32_t sine_lut_iq [1024]
 

Detailed Description

Driver for the Analog Devices AXI-DAC-CORE module.

Author
DBogdan (drago.nosp@m.s.bo.nosp@m.gdan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2018(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Enumeration Type Documentation

◆ axi_dac_data_sel

Enumerator
AXI_DAC_DATA_SEL_DDS 
AXI_DAC_DATA_SEL_SED 
AXI_DAC_DATA_SEL_DMA 
AXI_DAC_DATA_SEL_ZERO 
AXI_DAC_DATA_SEL_PN7 
AXI_DAC_DATA_SEL_PN15 
AXI_DAC_DATA_SEL_PN23 
AXI_DAC_DATA_SEL_PN31 
AXI_DAC_DATA_SEL_LB 
AXI_DAC_DATA_SEL_PNXX 

◆ axi_iface

enum axi_iface
Enumerator
AXI_DAC_BUS_TYPE_NONE 
AXI_DAC_BUS_TYPE_QSPI 

◆ axi_io_mode

Enumerator
AXI_DAC_IO_MODE_SPI 
AXI_DAC_IO_MODE_DSPI 
AXI_DAC_IO_MODE_QSPI 

Function Documentation

◆ axi_dac_bus_read()

int32_t axi_dac_bus_read ( struct axi_dac * dac,
uint32_t reg_addr,
uint32_t * reg_data,
uint8_t data_size )

AXI DAC Bus Data Read.

AXI DAC Bus Data read

Parameters
dac- The device structure.
reg_addr- The register address.
reg_data- Pointer to data value to be read.
data_size- Data size in bytes.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_bus_write()

int32_t axi_dac_bus_write ( struct axi_dac * dac,
uint32_t reg_addr,
uint32_t reg_data,
uint8_t data_size )

AXI DAC Bus Data Write.

AXI DAC Bus Data write

Parameters
dac- The device structure.
reg_addr- The register address.
reg_data- Data value to be written.
data_size- Data size in bytes.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_data_format_set()

int32_t axi_dac_data_format_set ( struct axi_dac * dac,
int format )

AXI DAC data format.

AXI DAC data format

Parameters
dac- The device structure.
format- bit width of the samples sent over dma, can be 8 or 16.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_data_setup()

int32_t axi_dac_data_setup ( struct axi_dac * dac)

AXI DAC Data Setup.

Setup the AXI DAC Data

Parameters
dac- The device structure.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_data_transfer_addr()

int32_t axi_dac_data_transfer_addr ( struct axi_dac * dac,
uint32_t address )

AXI DAC Set starting dma data trasfer address.

AXI DAC Set dma buffering mode

Parameters
dac- The device structure.
address- the 8-bit target register address for dma data streaming operations.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_dds_get_calib_phase()

int32_t axi_dac_dds_get_calib_phase ( struct axi_dac * dac,
uint32_t chan,
int32_t * val,
int32_t * val2 )

Get the phase calibration values for AXI DAC channel.

Get the phase calibration values for AXI DAC channel

Parameters
dac- The device structure.
chan- The DAC channel.
val- the integer part.
val2- the fractional part.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_dds_get_calib_scale()

int32_t axi_dac_dds_get_calib_scale ( struct axi_dac * dac,
uint32_t chan,
int32_t * val,
int32_t * val2 )

Get the scale calibration values for AXI DAC channel.

Get the scale calibration values for AXI DAC channel

Parameters
dac- The device structure.
chan- The DAC channel.
val- the integer part.
val2- the fractional part.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_dds_get_frequency()

int32_t axi_dac_dds_get_frequency ( struct axi_dac * dac,
uint32_t chan,
uint32_t * freq )

AXI DAC Get DDS frequency for specific channel.

AXI DAC Get DDS Frequency

Parameters
dac- The device structure.
chan- The DAC channel.
freq- The frequency read in Hz.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_dds_get_phase()

int32_t axi_dac_dds_get_phase ( struct axi_dac * dac,
uint32_t chan,
uint32_t * phase )

AXI DAC Get DDS phase for specific channel.

AXI DAC Get DDS Phase

Parameters
dac- The device structure.
chan- The DAC channel.
phase- The phase read. Phase is in milli angles scaled to 1000 (i.e. 90*1000 is 90 degrees (pi/2))
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_dds_get_scale()

int32_t axi_dac_dds_get_scale ( struct axi_dac * dac,
uint32_t chan,
int32_t * scale_micro_units )

AXI DAC Get DDS scale for specific channel.

AXI DAC Get DDS Phase

Parameters
dac- The device structure.
chan- The DAC channel.
scale_micro_units- The scale read. Scale is in micro units (i.e. 1*1000*1000 is 1.0)
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_dds_set_calib_phase()

int32_t axi_dac_dds_set_calib_phase ( struct axi_dac * dac,
uint32_t chan,
int32_t val,
int32_t val2 )

Calibrate phase for specific AXI DAC channel.

Calibrate phase for specific AXI DAC channel

Parameters
dac- The device structure.
chan- The DAC channel.
val- the integer part.
val2- the fractional part.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_dds_set_calib_scale()

int32_t axi_dac_dds_set_calib_scale ( struct axi_dac * dac,
uint32_t chan,
int32_t val,
int32_t val2 )

Calibrate scale for specific AXI DAC channel.

Calibrate scale for specific AXI DAC channel

Parameters
dac- The device structure.
chan- The DAC channel.
val- the integer part.
val2- the fractional part.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_dds_set_frequency()

int32_t axi_dac_dds_set_frequency ( struct axi_dac * dac,
uint32_t chan,
uint32_t freq_hz )

AXI DAC Set DDS frequency for specific channel.

AXI DAC Set DDS Frequency

Parameters
dac- The device structure.
chan- The DAC channel.
freq_hz- The frequency to be set in Hz.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_dds_set_phase()

int32_t axi_dac_dds_set_phase ( struct axi_dac * dac,
uint32_t chan,
uint32_t phase )

AXI DAC Set DDS phase for specific channel.

AXI DAC Set DDS Phase

Parameters
dac- The device structure.
chan- The DAC channel.
phase- The phase to be set. Phase is in milli angles scaled to 1000 (i.e. 90*1000 is 90 degrees (pi/2))
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_dds_set_scale()

int32_t axi_dac_dds_set_scale ( struct axi_dac * dac,
uint32_t chan,
int32_t scale_micro_units )

AXI DAC Set DDS scale for specific channel.

AXI DAC Set DDS Scale

Parameters
dac- The device structure.
chan- The DAC channel.
scale_micro_units- The scale to be set. Scale is in micro units (i.e. 1*1000*1000 is 1.0)
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_init()

int32_t axi_dac_init ( struct axi_dac ** dac_core,
const struct axi_dac_init * init )

AXI DAC Main Initialization.

AXI DAC Main Initialization

Parameters
dac_core- The device structure.
init- Initialization parameters.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_init_begin()

int32_t axi_dac_init_begin ( struct axi_dac ** dac_core,
const struct axi_dac_init * init )

Begin AXI DAC Initialization.

Begin AXI DAC Initialization

Parameters
dac_core- The device structure.
init- Initialization parameters.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_init_finish()

int32_t axi_dac_init_finish ( struct axi_dac * dac)

Begin AXI DAC Initialization.

Finish AXI DAC Initialization

Parameters
dac- The device structure.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_load_custom_data()

int32_t axi_dac_load_custom_data ( struct axi_dac * dac,
const uint32_t * custom_data_iq,
uint32_t custom_tx_count,
uint32_t address )

AXI DAC Load custom data.

AXI DAC Load Custom Data

Parameters
dac- The device structure.
custom_data_iq- The custom data array in I/Q format.
custom_tx_count- The custom data array size.
address- The address where the data is loaded.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_remove()

int32_t axi_dac_remove ( struct axi_dac * dac)

AXI DAC Resources deallocation.

Resources Deallocation

Parameters
dac- The device structure.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_set_buff()

int32_t axi_dac_set_buff ( struct axi_dac * dac,
uint32_t address,
uint16_t * buff,
uint32_t buff_size )

AXI DAC Set data buffer.

AXI DAC Set Buffer

Parameters
dac- The device structure.
address- Base Address.
buff- The buffer to be set.
buff_size- The buffer size.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_set_data_stream()

int32_t axi_dac_set_data_stream ( struct axi_dac * dac,
bool enable )

AXI DAC Set data stream mode.

AXI DAC Set data stream mode

Parameters
dac- The device structure.
enable- enable or disable data stream over the bus interface, where any is available.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_set_datasel()

int32_t axi_dac_set_datasel ( struct axi_dac * dac,
int32_t chan,
enum axi_dac_data_sel sel )

AXI DAC Set Data type for specific channel.

AXI DAC Data Select

Parameters
dac- The device structure.
chan- The DAC channel.
sel- Data type.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_set_ddr()

int32_t axi_dac_set_ddr ( struct axi_dac * dac,
bool enable )

AXI DAC Set DDR (bus double-data-rate) mode.

AXI DAC Set DDR (bus double-data-rate) mode

Parameters
dac- The device structure.
enable- enable or disable DDR mode.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_set_io_mode()

int32_t axi_dac_set_io_mode ( struct axi_dac * dac,
enum axi_io_mode mode )

AXI DAC Set IO mode.

AXI DAC set IO mode

Parameters
dac- The device structure.
mode- enum axi_io_mode.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ axi_dac_set_sine_lut()

uint32_t axi_dac_set_sine_lut ( struct axi_dac * dac,
uint32_t address )

AXI DAC Set data based on a Sine Lookup Table.

AXI DAC Set Sine Lookup Table

Parameters
dac- The device structure.
address- Address of the sine lut.
Returns
Returns 0 in case of success or negative error code otherwise.

Variable Documentation

◆ sine_lut

const uint16_t sine_lut[128]
extern

◆ sine_lut_iq

const uint32_t sine_lut_iq[1024]
extern