51#define AD7606_REG_STATUS 0x01
52#define AD7606_REG_CONFIG 0x02
53#define AD7606_REG_RANGE_CH_ADDR(ch) (0x03 + ((ch) >> 1))
54#define AD7606_REG_BANDWIDTH 0x07
55#define AD7606_REG_OVERSAMPLING 0x08
56#define AD7606_REG_GAIN_CH(ch) (0x09 + (ch))
57#define AD7606_REG_OFFSET_CH(ch) (0x11 + (ch))
58#define AD7606_REG_PHASE_CH(ch) (0x19 + (ch))
59#define AD7606_REG_DIGITAL_DIAG_ENABLE 0x21
60#define AD7606_REG_DIGITAL_DIAG_ERR 0x22
61#define AD7606_REG_OPEN_DETECT_ENABLE 0x23
62#define AD7606_REG_OPEN_DETECTED 0x24
63#define AD7606_REG_AIN_OV_UV_DIAG_ENABLE 0x25
64#define AD7606_REG_AIN_OV_DIAG_ERROR 0x26
65#define AD7606_REG_AIN_UV_DIAG_ERROR 0x27
66#define AD7606_REG_DIAGNOSTIC_MUX_CH(ch) (0x28 + ((ch) >> 1))
67#define AD7606_REG_OPEN_DETECT_QUEUE 0x2C
68#define AD7606_REG_CLK_FS_COUNTER 0x2D
69#define AD7606_REG_CLK_OS_COUNTER 0x2E
70#define AD7606_REG_ID 0x2F
73#define AD7606_STATUS_CHANNEL_MSK NO_OS_GENMASK(2,0)
74#define AD7606_AIN_UV_ERR_MSK NO_OS_BIT(3)
75#define AD7606_AIN_OV_ERR_MSK NO_OS_BIT(4)
76#define AD7606_OPEN_DETECTED_MSK NO_OS_BIT(5)
77#define AD7606_DIGITAL_ERROR_MSK NO_OS_BIT(6)
78#define AD7606_RESET_DETECT_MSK NO_OS_BIT(7)
81#define AD7606_CONFIG_OPERATION_MODE_MSK NO_OS_GENMASK(1,0)
82#define AD7606_CONFIG_DOUT_FORMAT_MSK NO_OS_GENMASK(4,3)
83#define AD7606_CONFIG_EXT_OS_CLOCK_MSK NO_OS_BIT(5)
84#define AD7606_CONFIG_STATUS_HEADER_MSK NO_OS_BIT(6)
87#define AD7606_RANGE_CH_MSK(ch) (NO_OS_GENMASK(3, 0) << (4 * ((ch) % 2)))
88#define AD7606_RANGE_CH_MODE(ch, mode) \
89 ((NO_OS_GENMASK(3, 0) & mode) << (4 * ((ch) % 2)))
88#define AD7606_RANGE_CH_MODE(ch, mode) \ …
92#define AD7606_OS_PAD_MSK NO_OS_GENMASK(7,4)
93#define AD7606_OS_RATIO_MSK NO_OS_GENMASK(3,0)
96#define AD7606_ID_DEVICE_ID_MSK NO_OS_GENMASK(7,4)
97#define AD7606_ID_SILICON_REVISION_MSK NO_OS_GENMASK(3,0)
100#define AD7606_GAIN_MSK NO_OS_GENMASK(5,0)
103#define AD7606_ROM_CRC_ERR_EN_MSK NO_OS_BIT(0)
104#define AD7606_MM_CRC_ERR_EN_MSK NO_OS_BIT(1)
105#define AD7606_INT_CRC_ERR_EN_MSK NO_OS_BIT(2)
106#define AD7606_SPI_WRITE_ERR_EN_MSK NO_OS_BIT(3)
107#define AD7606_SPI_READ_ERR_EN_MSK NO_OS_BIT(4)
108#define AD7606_BUSY_STUCK_HIGH_ERR_EN_MSK NO_OS_BIT(5)
109#define AD7606_CLK_FS_OS_COUNTER_EN_MSK NO_OS_BIT(6)
110#define AD7606_INTERFACE_CHECK_EN_MSK NO_OS_BIT(7)
113#define AD7606_DIAGN_MUX_CH_MSK(ch) (NO_OS_GENMASK(2, 0) << (3 * (ch & 0x1)))
115#define AD7606_SERIAL_RD_FLAG_MSK(x) (NO_OS_BIT(6) | ((x) & 0x3F))
116#define AD7606_SERIAL_WR_FLAG_MSK(x) ((x) & 0x3F)
118#define AD7606_PARALLEL_RD_FLAG_MSK(x) (NO_OS_BIT(7) | ((x) & 0x7F))
119#define AD7606_PARALLEL_WR_FLAG_MSK(x) ((x) & 0x7F)
121#define AD7606_MAX_CHANNELS 8
276#ifdef XILINX_PLATFORM
281struct ad7606_axi_dev {
293 uint32_t core_baseaddr;
295 uint32_t rx_dma_baseaddr;
296 uint32_t reg_access_speed;
297 void (*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
306#ifdef XILINX_PLATFORM
308 struct ad7606_axi_dev axi_dev;
362#ifdef XILINX_PLATFORM
367struct ad7606_axi_init_param {
371 uint32_t axi_clkgen_rate;
377 uint32_t core_baseaddr;
379 uint32_t rx_dma_baseaddr;
380 uint32_t reg_access_speed;
381 void (*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
392#ifdef XILINX_PLATFORM
394 struct ad7606_axi_init_param *axi_init;
438 uint32_t *num_ranges);
486 uint32_t *buf, int32_t *data, uint8_t *status);
struct axi_clkgen_init clkgen_init
Definition common_data.c:74
struct no_os_pwm_init_param trigger_pwm_init
Definition common_data.c:82
int32_t ad7606_set_digital_diag(struct ad7606_dev *dev, struct ad7606_digital_diag diag)
Set the device digital diagnostics configuration.
Definition ad7606.c:1664
ad7606_device_id
Device ID definitions.
Definition ad7606.h:127
@ ID_AD7605_4
Definition ad7606.h:129
@ ID_AD7606_8
Definition ad7606.h:135
@ ID_AD7609
Definition ad7606.h:145
@ ID_AD7608
Definition ad7606.h:143
@ ID_AD7606B
Definition ad7606.h:137
@ ID_AD7606_4
Definition ad7606.h:131
@ ID_AD7606_6
Definition ad7606.h:133
@ ID_AD7606C_16
Definition ad7606.h:139
@ ID_AD7606C_18
Definition ad7606.h:141
int32_t ad7606_spi_data_read(struct ad7606_dev *dev, uint32_t *data)
Read conversion data.
Definition ad7606.c:638
#define AD7606_MAX_CHANNELS
Definition ad7606.h:121
int32_t ad7606_init(struct ad7606_dev **device, struct ad7606_init_param *init_param)
Initialize the ad7606 device structure.
Definition ad7606.c:1775
bool ad7606_sw_mode_enabled(struct ad7606_dev *dev)
Returns true if SW mode is enabled.
Definition ad7606.c:1375
int32_t ad7606_get_oversampling(struct ad7606_dev *dev, struct ad7606_oversampling *oversampling)
Get the oversampling ratio.
Definition ad7606.c:1285
ad7606_osr
Oversampling ratio.
Definition ad7606.h:152
@ AD7606_OSR_16
Definition ad7606.h:162
@ AD7606_OSR_2
Definition ad7606.h:156
@ AD7606_OSR_4
Definition ad7606.h:158
@ AD7606_OSR_128
Definition ad7606.h:168
@ AD7606_OSR_64
Definition ad7606.h:166
@ AD7606_OSR_8
Definition ad7606.h:160
@ AD7606_OSR_1
Definition ad7606.h:154
@ AD7606_OSR_32
Definition ad7606.h:164
@ AD7606_OSR_256
Definition ad7606.h:170
int32_t ad7606_get_channels_number(struct ad7606_dev *dev)
Returns the number of channels this ADC has.
Definition ad7606.c:246
int32_t ad7606_spi_reg_write(struct ad7606_dev *dev, uint8_t reg_addr, uint8_t reg_data)
Write a device register via SPI.
Definition ad7606.c:411
int32_t ad7606_remove(struct ad7606_dev *dev)
Free any resource used by the driver.
Definition ad7606.c:2015
const struct ad7606_range * ad7606_get_ch_ranges(struct ad7606_dev *dev, uint8_t ch, uint32_t *num_ranges)
Get the available channel ranges for the given channel.
Definition ad7606.c:1306
int32_t ad7606_set_ch_range(struct ad7606_dev *dev, uint8_t ch, struct ad7606_range range)
Set the channel operation range.
Definition ad7606.c:1396
int32_t ad7606_capture_pre_enable(struct ad7606_dev *dev)
Prepares buffer capture for an AXI SPI Engine or AXI Parallel interface.
Definition ad7606.c:948
ad7606_op_mode
Operation mode.
Definition ad7606.h:177
@ AD7606_SHUTDOWN
Definition ad7606.h:185
@ AD7606_NORMAL
Definition ad7606.h:179
@ AD7606_AUTOSTANDBY
Definition ad7606.h:183
@ AD7606_STANDBY
Definition ad7606.h:181
ad7606_dout_format
Number of DOUT lines.
Definition ad7606.h:192
@ AD7606_8_DOUT
Definition ad7606.h:200
@ AD7606_1_DOUT
Definition ad7606.h:194
@ AD7606_4_DOUT
Definition ad7606.h:198
@ AD7606_2_DOUT
Definition ad7606.h:196
int32_t ad7606_set_ch_phase(struct ad7606_dev *dev, uint8_t ch, uint8_t phase)
Set the channel phase.
Definition ad7606.c:1529
int32_t ad7606_reg_write(struct ad7606_dev *dev, uint8_t reg_addr, uint8_t reg_data)
Write a device register via SPI or AXI Parallel core.
Definition ad7606.c:486
int32_t ad7606_set_config(struct ad7606_dev *dev, struct ad7606_config config)
Set the device config register.
Definition ad7606.c:1599
int32_t ad7606_set_ch_gain(struct ad7606_dev *dev, uint8_t ch, uint8_t gain)
Set the channel gain.
Definition ad7606.c:1563
int32_t ad7606_reset(struct ad7606_dev *dev)
Reset the device by toggling the reset GPIO.
Definition ad7606.c:1081
int32_t ad7606_read_samples(struct ad7606_dev *dev, uint32_t *data, uint32_t samples)
Read muliple raw samples from device.
Definition ad7606.c:999
int32_t ad7606_get_resolution_bits(struct ad7606_dev *dev)
Get the resolution bits of this device.
Definition ad7606.c:1464
int32_t ad7606_write_mask(struct ad7606_dev *dev, uint32_t addr, uint32_t mask, uint32_t val)
int32_t ad7606_spi_reg_read(struct ad7606_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Read a device register via SPI.
Definition ad7606.c:350
int32_t ad7606_set_oversampling(struct ad7606_dev *dev, struct ad7606_oversampling oversampling)
Set the oversampling ratio.
Definition ad7606.c:1235
int32_t ad7606_set_ch_offset(struct ad7606_dev *dev, uint8_t ch, int8_t offset)
Set the channel offset.
Definition ad7606.c:1494
int32_t ad7606_get_ch_scale(struct ad7606_dev *dev, uint8_t ch, double *scale)
Get the value of scale for the channel.
Definition ad7606.c:1442
ad7606_range_type
Type of range for this channel.
Definition ad7606.h:207
@ AD7606_HW_RANGE
Definition ad7606.h:208
@ AD7606_SW_RANGE_SINGLE_ENDED_BIPOLAR
Definition ad7606.h:210
@ AD7606_SW_RANGE_SINGLE_ENDED_UNIPOLAR
Definition ad7606.h:209
@ AD7606_SW_RANGE_DIFFERENTIAL_BIPOLAR
Definition ad7606.h:211
int32_t ad7606_reg_read(struct ad7606_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Write a device register via SPI or AXI Parallel core.
Definition ad7606.c:460
void ad7606_capture_post_disable(struct ad7606_dev *dev)
Disables buffer capture for an AXI SPI Engine or AXI Parallel interface.
Definition ad7606.c:968
int32_t ad7606_read_one_sample(struct ad7606_dev *dev, uint32_t *data)
Blocking conversion start and read data (for a single sample from all channels).
Definition ad7606.c:907
int32_t ad7606_data_correction_serial(struct ad7606_dev *dev, uint32_t *buf, int32_t *data, uint8_t *status)
Definition ad7606.c:1944
int32_t ad7606_convst(struct ad7606_dev *dev)
Toggle the CONVST pin to start a conversion.
Definition ad7606.c:595
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
Driver for the Analog Devices AXI CLKGEN.
Header file of Delay functions.
Header file of GPIO Interface.
Header file of PWM Interface.
Header file of SPI Interface.
Header file of utility functions.
AD7606_REG_CONFIG configuration parameters.
Definition ad7606.h:218
bool status_header
Definition ad7606.h:226
enum ad7606_dout_format dout_format
Definition ad7606.h:222
enum ad7606_op_mode op_mode
Definition ad7606.h:220
bool ext_os_clock
Definition ad7606.h:224
Device driver structure.
Definition ad7606.h:305
struct no_os_gpio_desc * gpio_os0
Definition ad7606.h:323
struct no_os_gpio_desc * gpio_par_ser
Definition ad7606.h:329
bool sw_mode
Definition ad7606.h:335
struct no_os_spi_desc * spi_desc
Definition ad7606.h:311
struct no_os_gpio_desc * gpio_busy
Definition ad7606.h:317
uint8_t num_channels
Definition ad7606.h:347
enum ad7606_device_id device_id
Definition ad7606.h:331
struct ad7606_oversampling oversampling
Definition ad7606.h:333
struct no_os_gpio_desc * gpio_convst
Definition ad7606.h:315
struct no_os_gpio_desc * gpio_range
Definition ad7606.h:321
int8_t offset_ch[AD7606_MAX_CHANNELS]
Definition ad7606.h:353
enum ad7606_range_type range_ch_type[AD7606_MAX_CHANNELS]
Definition ad7606.h:351
struct no_os_gpio_desc * gpio_os2
Definition ad7606.h:327
uint8_t data[28]
Definition ad7606.h:359
struct no_os_gpio_desc * gpio_reset
Definition ad7606.h:313
enum ad7606_dout_format max_dout_lines
Definition ad7606.h:341
bool reg_mode
Definition ad7606.h:339
struct ad7606_config config
Definition ad7606.h:343
uint8_t gain_ch[AD7606_MAX_CHANNELS]
Definition ad7606.h:357
struct no_os_gpio_desc * gpio_stby_n
Definition ad7606.h:319
double scale_ch[AD7606_MAX_CHANNELS]
Definition ad7606.h:349
bool parallel_interface
Definition ad7606.h:337
uint8_t phase_ch[AD7606_MAX_CHANNELS]
Definition ad7606.h:355
struct ad7606_digital_diag digital_diag_enable
Definition ad7606.h:345
struct no_os_gpio_desc * gpio_os1
Definition ad7606.h:325
Oversampling settings.
Definition ad7606.h:257
bool mm_crc_err_en
Definition ad7606.h:261
bool spi_write_err_en
Definition ad7606.h:265
bool spi_read_err_en
Definition ad7606.h:267
bool int_crc_err_en
Definition ad7606.h:263
bool rom_crc_err_en
Definition ad7606.h:259
bool clk_fs_os_counter_en
Definition ad7606.h:271
bool busy_stuck_high_err_en
Definition ad7606.h:269
bool interface_check_en
Definition ad7606.h:273
Device driver initialization parameters.
Definition ad7606.h:389
struct no_os_gpio_init_param * gpio_reset
Definition ad7606.h:397
uint8_t phase_ch[AD7606_MAX_CHANNELS]
Definition ad7606.h:429
struct no_os_gpio_init_param * gpio_os1
Definition ad7606.h:409
enum ad7606_device_id device_id
Definition ad7606.h:415
struct no_os_gpio_init_param * gpio_os2
Definition ad7606.h:411
int8_t offset_ch[AD7606_MAX_CHANNELS]
Definition ad7606.h:427
struct no_os_gpio_init_param * gpio_os0
Definition ad7606.h:407
struct no_os_gpio_init_param * gpio_busy
Definition ad7606.h:401
uint8_t gain_ch[AD7606_MAX_CHANNELS]
Definition ad7606.h:431
struct no_os_gpio_init_param * gpio_convst
Definition ad7606.h:399
struct no_os_gpio_init_param * gpio_par_ser
Definition ad7606.h:413
struct ad7606_range range_ch[AD7606_MAX_CHANNELS]
Definition ad7606.h:433
struct no_os_gpio_init_param * gpio_stby_n
Definition ad7606.h:403
struct ad7606_config config
Definition ad7606.h:423
struct no_os_gpio_init_param * gpio_range
Definition ad7606.h:405
struct ad7606_digital_diag digital_diag_enable
Definition ad7606.h:425
bool sw_mode
Definition ad7606.h:419
bool parallel_interface
Definition ad7606.h:421
struct ad7606_oversampling oversampling
Definition ad7606.h:417
struct no_os_spi_init_param spi_init
Definition ad7606.h:391
enum ad7606_osr os_ratio
Definition ad7606.h:250
uint8_t os_pad
Definition ad7606.h:248
Operation range as specified in datasheet (in uV)
Definition ad7606.h:233
enum ad7606_range_type type
Definition ad7606.h:239
int32_t max
Definition ad7606.h:237
int32_t min
Definition ad7606.h:235
Definition clk_axi_clkgen.h:44
Definition clk_axi_clkgen.h:38
Definition axi_dmac.h:101
Definition ad9361_util.h:63
Structure holding the GPIO descriptor.
Definition no_os_gpio.h:84
Structure holding the parameters for GPIO initialization.
Definition no_os_gpio.h:67
Structure representing an PWM generator device.
Definition no_os_pwm.h:83
Structure containing the init parameters needed by the PWM generator.
Definition no_os_pwm.h:56
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128
Structure containing the init parameters needed by the offload module.
Definition spi_engine.h:131