no-OS
ad463x.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef AD463X_H_
34 #define AD463x_H_
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include <stdint.h>
40 #include "no_os_util.h"
41 #include "spi_engine.h"
42 #include "clk_axi_clkgen.h"
43 #include "no_os_pwm.h"
44 #include "no_os_gpio.h"
45 
46 /******************************************************************************/
47 /********************** Macros and Types Declarations *************************/
48 /******************************************************************************/
49 
50 /* Register addresses */
51 #define AD463X_REG_INTERFACE_CONFIG_A 0x00
52 #define AD463X_REG_INTERFACE_CONFIG_B 0x01
53 #define AD463X_REG_DEVICE_CONFIG 0x02
54 #define AD463X_REG_CHIP_TYPE 0x03
55 #define AD463X_REG_PRODUCT_ID_L 0x04
56 #define AD463X_REG_PRODUCT_ID_H 0x05
57 #define AD463X_REG_CHIP_GRADE 0x06
58 #define AD463X_REG_SCRATCH_PAD 0x0A
59 #define AD463X_REG_SPI_REVISION 0x0B
60 #define AD463X_REG_VENDOR_L 0x0C
61 #define AD463X_REG_VENDOR_H 0x0D
62 #define AD463X_REG_STREAM_MODE 0x0E
63 #define AD463X_REG_EXIT_CFG_MODE 0x14
64 #define AD463X_REG_AVG 0x15
65 #define AD463X_REG_OFFSET_BASE 0x16
66 #define AD463X_REG_OFFSET_X0_0 0x16
67 #define AD463X_REG_OFFSET_X0_1 0x17
68 #define AD463X_REG_OFFSET_X0_2 0x18
69 #define AD463X_REG_OFFSET_X1_0 0x19
70 #define AD463X_REG_OFFSET_X1_1 0x1A
71 #define AD463X_REG_OFFSET_X1_2 0x1B
72 #define AD463X_REG_GAIN_BASE 0x1C
73 #define AD463X_REG_GAIN_X0_LSB 0x1C
74 #define AD463X_REG_GAIN_X0_MSB 0x1D
75 #define AD463X_REG_GAIN_X1_LSB 0x1E
76 #define AD463X_REG_GAIN_X1_MSB 0x1F
77 #define AD463X_REG_MODES 0x20
78 #define AD463X_REG_OSCILATOR 0x21
79 #define AD463X_REG_IO 0x22
80 #define AD463X_REG_PAT0 0x23
81 #define AD463X_REG_PAT1 0x24
82 #define AD463X_REG_PAT2 0x25
83 #define AD463X_REG_PAT3 0x26
84 #define AD463X_REG_DIG_DIAG 0x34
85 #define AD463X_REG_DIG_ERR 0x35
86 /* INTERFACE_CONFIG_A */
87 #define AD463X_CFG_SW_RESET (NO_OS_BIT(7) | NO_OS_BIT(0))
88 #define AD463X_CFG_SDO_ENABLE NO_OS_BIT(4)
89 /* MODES */
90 #define AD463X_SW_RESET_MSK (NO_OS_BIT(7) | NO_OS_BIT(0))
91 #define AD463X_LANE_MODE_MSK (NO_OS_BIT(7) | NO_OS_BIT(6))
92 #define AD463X_CLK_MODE_MSK (NO_OS_BIT(5) | NO_OS_BIT(4))
93 #define AD463X_DDR_MODE_MSK NO_OS_BIT(3)
94 #define AD463X_SDR_MODE 0x00
95 #define AD463X_DDR_MODE NO_OS_BIT(3)
96 #define AD463X_OUT_DATA_MODE_MSK (NO_OS_BIT(2) | NO_OS_BIT(1) | NO_OS_BIT(0))
97 #define AD463X_24_DIFF 0x00
98 #define AD463X_16_DIFF_8_COM 0x01
99 #define AD463X_24_DIFF_8_COM 0x02
100 #define AD463X_30_AVERAGED_DIFF 0x03
101 #define AD463X_32_PATTERN 0x04
102 /* EXIT_CFG_MD */
103 #define AD463X_EXIT_CFG_MODE NO_OS_BIT(0)
104 /* CHANNEL */
105 #define AD463X_CHANNEL_0 0x00
106 #define AD463X_CHANNEL_1 0x01
107 /* OFFSET */
108 #define AD463X_OFFSET_0 0x00
109 #define AD463X_OFFSET_1 0x01
110 #define AD463X_OFFSET_2 0x02
111 /* GAIN */
112 #define AD463X_GAIN_LSB 0x00
113 #define AD463X_GAIN_MSB 0x01
114 /* LANE MODE */
115 #define AD463X_ONE_LANE_PER_CH 0x00
116 #define AD463X_TWO_LANES_PER_CH NO_OS_BIT(6)
117 #define AD463X_FOUR_LANES_PER_CH NO_OS_BIT(7)
118 #define AD463X_SHARED_TWO_CH (NO_OS_BIT(6) | NO_OS_BIT(7))
119 /* CLK MODE */
120 #define AD463X_SPI_COMPATIBLE_MODE 0x00
121 #define AD463X_ECHO_CLOCK_MODE NO_OS_BIT(4)
122 #define AD463X_CLOCK_MASTER_MODE NO_OS_BIT(5)
123 /* POWER MODE */
124 #define AD463X_NORMAL_MODE 0x00
125 #define AD463X_LOW_POWER_MODE (NO_OS_BIT(1) | NO_OS_BIT(0))
126 /* AVG */
127 #define AD463X_AVG_FILTER_RESET NO_OS_BIT(7)
128 #define AD463X_CONFIG_TIMING 0x2000
129 #define AD463X_REG_READ_DUMMY 0x00
130 #define AD463X_REG_WRITE 0x00
131 #define AD463X_REG_READ NO_OS_BIT(7)
132 #define AD463X_REG_CHAN_OFFSET(ch, pos) (AD463X_REG_OFFSET_BASE + (3 * ch) + pos)
133 #define AD463X_REG_CHAN_GAIN(ch, pos) (AD463X_REG_GAIN_BASE + (2 * ch) + pos)
134 /* IO */
135 #define AD463X_DRIVER_STRENGTH_MASK NO_OS_BIT(0)
136 #define AD463X_NORMAL_OUTPUT_STRENGTH 0x00
137 #define AD463X_DOUBLE_OUTPUT_STRENGTH NO_OS_BIT(1)
138 /* OUT_DATA_PAT */
139 #define AD463X_OUT_DATA_PAT 0x5A5A0F0F
140 
141 #define AD463X_TRIGGER_PULSE_WIDTH_NS 0x0A
142 
143 #define AD463X_GAIN_MAX_VAL_SCALED 19997
144 
149 enum ad463x_id {
172 };
173 
187 };
188 
208  uint32_t axi_clkgen_rate;
214  uint8_t reg_data_width;
216  uint8_t lane_mode;
218  uint8_t clock_mode;
220  uint8_t data_rate;
222  int32_t vref;
224  uint8_t output_mode;
230  void (*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
231 };
232 
237 struct ad463x_dev {
256  uint8_t reg_data_width;
258  uint8_t read_bytes_no;
262  uint8_t lane_mode;
264  uint8_t clock_mode;
266  uint8_t data_rate;
268  int32_t vref;
270  uint8_t pgia_idx;
272  int32_t scale_table[4][2];
274  uint8_t output_mode;
278  bool has_pgia;
284  void (*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
285 };
286 
287 /******************************************************************************/
288 /************************ Functions Declarations ******************************/
289 /******************************************************************************/
291 int32_t ad463x_spi_reg_read(struct ad463x_dev *dev,
292  uint16_t reg_addr,
293  uint8_t *reg_data);
294 
296 int32_t ad463x_spi_reg_write(struct ad463x_dev *dev,
297  uint16_t reg_addr,
298  uint8_t reg_data);
299 
301 int32_t ad463x_spi_reg_read_masked(struct ad463x_dev *dev,
302  uint16_t reg_addr,
303  uint8_t mask,
304  uint8_t *data);
305 
307 int32_t ad463x_spi_reg_write_masked(struct ad463x_dev *dev,
308  uint16_t reg_addr,
309  uint8_t mask,
310  uint8_t data);
311 
313 int32_t ad463x_set_pwr_mode(struct ad463x_dev *dev, uint8_t mode);
314 
316 int32_t ad463x_set_avg_frame_len(struct ad463x_dev *dev, uint8_t mode);
317 
319 int32_t ad463x_set_drive_strength(struct ad463x_dev *dev, uint8_t mode);
320 
322 int32_t ad463x_exit_reg_cfg_mode(struct ad463x_dev *dev);
323 
325 int32_t ad463x_set_ch_gain(struct ad463x_dev *dev, uint8_t ch_idx,
326  uint64_t gain);
327 
329 int32_t ad463x_set_ch_offset(struct ad463x_dev *dev, uint8_t ch_idx,
330  uint32_t offset);
331 
333 int32_t ad463x_read_data(struct ad463x_dev *dev,
334  uint32_t *buf,
335  uint16_t samples);
336 
338 int32_t ad463x_init(struct ad463x_dev **device,
339  struct ad463x_init_param *init_param);
340 
342 int32_t ad463x_calc_pgia_gain(int32_t gain_int, int32_t gain_fract,
343  int32_t vref,
344  int32_t precision,
345  enum ad463x_pgia_gain *gain_idx);
346 
348 int32_t ad463x_set_pgia_gain(struct ad463x_dev *dev,
349  enum ad463x_pgia_gain gain_idx);
350 
352 int32_t ad463x_remove(struct ad463x_dev *dev);
353 
354 
356 int32_t ad463x_enter_config_mode(struct ad463x_dev *dev);
357 
358 #endif // AD463X_H_
axi_clkgen_init::name
const char * name
Definition: clk_axi_clkgen.h:51
MILLI
#define MILLI
Definition: no_os_units.h:48
ad463x_set_drive_strength
int32_t ad463x_set_drive_strength(struct ad463x_dev *dev, uint8_t mode)
Set drive strength.
Definition: ad463x.c:247
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
ad463x_id
ad463x_id
Device type.
Definition: ad463x.h:149
spi_engine_offload_message::no_commands
uint32_t no_commands
Definition: spi_engine.h:165
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:66
ad463x_dev::scale_table
int32_t scale_table[4][2]
Definition: ad463x.h:272
ad463x_set_ch_gain
int32_t ad463x_set_ch_gain(struct ad463x_dev *dev, uint8_t ch_idx, uint64_t gain)
Set channel gain.
Definition: ad463x.c:291
no_os_div_s64_rem
int64_t no_os_div_s64_rem(int64_t dividend, int32_t divisor, int32_t *remainder)
ad463x_set_avg_frame_len
int32_t ad463x_set_avg_frame_len(struct ad463x_dev *dev, uint8_t mode)
Set average frame length.
Definition: ad463x.c:210
ad463x_init_param::reg_data_width
uint8_t reg_data_width
Definition: ad463x.h:214
AD463x_TEST_DATA
#define AD463x_TEST_DATA
Definition: ad463x.c:51
ad463x_dev::pgia_idx
uint8_t pgia_idx
Definition: ad463x.h:270
ad463x_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: ad463x.h:195
ad463x_init_param::clock_mode
uint8_t clock_mode
Definition: ad463x.h:218
ad463x_set_avg_frame_len
int32_t ad463x_set_avg_frame_len(struct ad463x_dev *dev, uint8_t mode)
Set average frame length.
Definition: ad463x.c:210
ad463x_init_param::offload_enable
bool offload_enable
Definition: ad463x.h:228
ad463x_init_param::data_rate
uint8_t data_rate
Definition: ad463x.h:220
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
AD463X_GAIN_0_56
@ AD463X_GAIN_0_56
Definition: ad463x.h:182
AD463X_REG_READ_DUMMY
#define AD463X_REG_READ_DUMMY
Definition: ad463x.h:129
ad463x_calc_pgia_gain
int32_t ad463x_calc_pgia_gain(int32_t gain_int, int32_t gain_fract, int32_t vref, int32_t precision, enum ad463x_pgia_gain *gain_idx)
Calculate the PGIA gain.
Definition: ad463x.c:888
CS_LOW
#define CS_LOW
Definition: spi_engine.h:73
AD463X_REG_DEVICE_CONFIG
#define AD463X_REG_DEVICE_CONFIG
Definition: ad463x.h:53
AD463X_EXIT_CFG_MODE
#define AD463X_EXIT_CFG_MODE
Definition: ad463x.h:103
no_os_spi.h
Header file of SPI Interface.
ad463x_dev::lane_mode
uint8_t lane_mode
Definition: ad463x.h:262
AD463X_DDR_MODE
#define AD463X_DDR_MODE
Definition: ad463x.h:95
ADAQ4224_GAIN_MAX_NANO
#define ADAQ4224_GAIN_MAX_NANO
Definition: ad463x.c:53
ID_AD4631_16
@ ID_AD4631_16
Definition: ad463x.h:161
ad463x_init_param::axi_clkgen_rate
uint32_t axi_clkgen_rate
Definition: ad463x.h:208
spi_engine_offload_init
int32_t spi_engine_offload_init(struct no_os_spi_desc *desc, const struct spi_engine_offload_init_param *param)
Initialize the SPI engine's offload module.
Definition: spi_engine.c:763
ad463x_spi_reg_read
int32_t ad463x_spi_reg_read(struct ad463x_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
Read device register.
Definition: ad463x.c:83
no_os_pwm_remove
int32_t no_os_pwm_remove(struct no_os_pwm_desc *desc)
Free the resources allocated by no_os_pwm_init().
Definition: no_os_pwm.c:79
no_os_units.h
Header file of Units.
clk_axi_clkgen.h
Driver for the Analog Devices AXI CLKGEN.
ad463x_spi_reg_write
int32_t ad463x_spi_reg_write(struct ad463x_dev *dev, uint16_t reg_addr, uint8_t reg_data)
Write device register.
Definition: ad463x.c:107
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:88
spi_engine_offload_message::commands_data
uint32_t * commands_data
Definition: spi_engine.h:167
no_os_spi_msg
Definition: no_os_spi.h:100
ad463x_exit_reg_cfg_mode
int32_t ad463x_exit_reg_cfg_mode(struct ad463x_dev *dev)
Exit register configuration mode.
Definition: ad463x.c:262
ad463x_init_param::vref
int32_t vref
Definition: ad463x.h:222
AD463X_CLK_MODE_MSK
#define AD463X_CLK_MODE_MSK
Definition: ad463x.h:92
ad463x_init_param::output_mode
uint8_t output_mode
Definition: ad463x.h:224
no_os_delay.h
Header file of Delay functions.
axi_clkgen_init
Definition: clk_axi_clkgen.h:50
ad463x_dev::gpio_pgia_a0
struct no_os_gpio_desc * gpio_pgia_a0
Definition: ad463x.h:243
axi_clkgen_set_rate
int32_t axi_clkgen_set_rate(struct axi_clkgen *clkgen, uint32_t rate)
axi_clkgen_set_rate
Definition: clk_axi_clkgen.c:414
NO_OS_DIV_ROUND_CLOSEST_ULL
#define NO_OS_DIV_ROUND_CLOSEST_ULL(x, y)
Definition: no_os_util.h:56
ad463x_dev::gpio_resetn
struct no_os_gpio_desc * gpio_resetn
Definition: ad463x.h:241
ad463x_init_param::offload_init_param
struct spi_engine_offload_init_param * offload_init_param
Definition: ad463x.h:204
ad463x_read_data_offload
int32_t ad463x_read_data_offload(struct ad463x_dev *dev, uint32_t *buf, uint16_t samples)
Read from device. Enter register mode to read/write registers.
Definition: ad463x.c:418
ID_ADAQ4224
@ ID_ADAQ4224
Definition: ad463x.h:171
spi_engine_offload_message
Structure representing an offload message.
Definition: spi_engine.h:158
ad463x_spi_reg_read_masked
int32_t ad463x_spi_reg_read_masked(struct ad463x_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t *data)
SPI read device register using a mask.
Definition: ad463x.c:147
device
Definition: ad9361_util.h:69
no_os_spi_transfer_dma_sync
int32_t no_os_spi_transfer_dma_sync(struct no_os_spi_desc *desc, struct no_os_spi_msg *msgs, uint32_t len)
Transfer a list of messages using DMA and busy wait for the completion.
Definition: no_os_spi.c:224
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
AD463X_OFFSET_1
#define AD463X_OFFSET_1
Definition: ad463x.h:109
no_os_print_log.h
Print messages helpers.
ad463x_init_param::device_id
enum ad463x_id device_id
Definition: ad463x.h:212
AD463X_CONFIG_TIMING
#define AD463X_CONFIG_TIMING
Definition: ad463x.h:128
ad463x_dev::trigger_pwm_desc
struct no_os_pwm_desc * trigger_pwm_desc
Definition: ad463x.h:246
AD463X_DOUBLE_OUTPUT_STRENGTH
#define AD463X_DOUBLE_OUTPUT_STRENGTH
Definition: ad463x.h:137
no_os_find_closest
uint32_t no_os_find_closest(int32_t val, const int32_t *array, uint32_t size)
ad463x_dev::data_rate
uint8_t data_rate
Definition: ad463x.h:266
AD463X_TWO_LANES_PER_CH
#define AD463X_TWO_LANES_PER_CH
Definition: ad463x.h:116
axi_clkgen_init
int32_t axi_clkgen_init(struct axi_clkgen **clk, const struct axi_clkgen_init *init)
axi_clkgen_init
Definition: clk_axi_clkgen.c:520
ID_AD4630_16
@ ID_AD4630_16
Definition: ad463x.h:155
axi_clkgen
Definition: clk_axi_clkgen.h:44
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
AD463X_FOUR_LANES_PER_CH
#define AD463X_FOUR_LANES_PER_CH
Definition: ad463x.h:117
ID_AD4631_20
@ ID_AD4631_20
Definition: ad463x.h:159
AD463X_GAIN_LSB
#define AD463X_GAIN_LSB
Definition: ad463x.h:112
ad463x_set_ch_gain
int32_t ad463x_set_ch_gain(struct ad463x_dev *dev, uint8_t ch_idx, uint64_t gain)
Set channel gain.
Definition: ad463x.c:291
MICRO
#define MICRO
Definition: no_os_units.h:49
ad463x_init_param::gpio_pgia_a1
struct no_os_gpio_init_param * gpio_pgia_a1
Definition: ad463x.h:200
ad463x_spi_reg_write_masked
int32_t ad463x_spi_reg_write_masked(struct ad463x_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t data)
SPI write device register using a mask.
Definition: ad463x.c:172
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
AD463X_32_PATTERN
#define AD463X_32_PATTERN
Definition: ad463x.h:101
ad463x_init_param::trigger_pwm_init
struct no_os_pwm_init_param * trigger_pwm_init
Definition: ad463x.h:202
AD463X_SHARED_TWO_CH
#define AD463X_SHARED_TWO_CH
Definition: ad463x.h:118
ad7616_init_param::reg_access_speed
uint32_t reg_access_speed
Definition: ad7616.h:212
ad463x_dev::reg_data_width
uint8_t reg_data_width
Definition: ad463x.h:256
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
ad463x_dev::real_bits_precision
uint8_t real_bits_precision
Definition: ad463x.h:276
ad463x_set_pwr_mode
int32_t ad463x_set_pwr_mode(struct ad463x_dev *dev, uint8_t mode)
Set power mode.
Definition: ad463x.c:196
ID_AD4631_24
@ ID_AD4631_24
Definition: ad463x.h:157
CS_HIGH
#define CS_HIGH
Definition: spi_engine.h:72
spi_engine_set_speed
void spi_engine_set_speed(struct no_os_spi_desc *desc, uint32_t speed_hz)
Set SPI engine clock frequency.
Definition: spi_engine.c:148
AD463X_ONE_LANE_PER_CH
#define AD463X_ONE_LANE_PER_CH
Definition: ad463x.h:115
no_os_error.h
Error codes definition.
no_os_pwm_enable
int32_t no_os_pwm_enable(struct no_os_pwm_desc *desc)
Enable PWM signal generation.
Definition: no_os_pwm.c:98
AD463X_REG_MODES
#define AD463X_REG_MODES
Definition: ad463x.h:77
spi_engine_set_transfer_width
int32_t spi_engine_set_transfer_width(struct no_os_spi_desc *desc, uint8_t data_wdith)
Set width of the transfered word over SPI.
Definition: spi_engine.c:127
ID_AD4632_24
@ ID_AD4632_24
Definition: ad463x.h:163
ID_AD4632_16
@ ID_AD4632_16
Definition: ad463x.h:167
AD463X_OFFSET_0
#define AD463X_OFFSET_0
Definition: ad463x.h:108
ad7616_init_param::offload_init_param
struct spi_engine_offload_init_param * offload_init_param
Definition: ad7616.h:205
ad463x_init_param::spi_dma_enable
bool spi_dma_enable
Definition: ad463x.h:226
ad463x.h
Header file of AD463x Driver.
ad7616_init_param::trigger_pwm_init
struct no_os_pwm_init_param * trigger_pwm_init
Definition: ad7616.h:207
no_os_pwm_disable
int32_t no_os_pwm_disable(struct no_os_pwm_desc *desc)
Disable PWM signal generation.
Definition: no_os_pwm.c:115
spi_engine.h
AD463X_GAIN_6_67
@ AD463X_GAIN_6_67
Definition: ad463x.h:186
ad463x_set_ch_offset
int32_t ad463x_set_ch_offset(struct ad463x_dev *dev, uint8_t ch_idx, uint32_t offset)
Set channel offset.
Definition: ad463x.c:320
ad463x_dev::spi_dma_enable
bool spi_dma_enable
Definition: ad463x.h:280
ad463x_spi_reg_write_masked
int32_t ad463x_spi_reg_write_masked(struct ad463x_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t data)
SPI write device register using a mask.
Definition: ad463x.c:172
ad463x_read_data
int32_t ad463x_read_data(struct ad463x_dev *dev, uint32_t *buf, uint16_t samples)
Read from device. Enter register mode to read/write registers.
Definition: ad463x.c:628
AD463X_24_DIFF
#define AD463X_24_DIFF
Definition: ad463x.h:97
AD463X_REG_EXIT_CFG_MODE
#define AD463X_REG_EXIT_CFG_MODE
Definition: ad463x.h:63
AD463X_REG_AVG
#define AD463X_REG_AVG
Definition: ad463x.h:64
ad463x_dev::reg_access_speed
uint32_t reg_access_speed
Definition: ad463x.h:252
ad463x_init_param::reg_access_speed
uint32_t reg_access_speed
Definition: ad463x.h:210
ad463x_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad463x.h:239
ad463x_dev::dcache_invalidate_range
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad463x.h:284
ad463x_calc_pgia_gain
int32_t ad463x_calc_pgia_gain(int32_t gain_int, int32_t gain_fract, int32_t vref, int32_t precision, enum ad463x_pgia_gain *gain_idx)
Calculate the PGIA gain.
Definition: ad463x.c:888
AD463X_NORMAL_MODE
#define AD463X_NORMAL_MODE
Definition: ad463x.h:124
ad463x_enter_config_mode
int32_t ad463x_enter_config_mode(struct ad463x_dev *dev)
Enter register configuration mode.
Definition: ad463x.c:125
ad463x_spi_reg_read_masked
int32_t ad463x_spi_reg_read_masked(struct ad463x_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t *data)
SPI read device register using a mask.
Definition: ad463x.c:147
ad463x_init_param::lane_mode
uint8_t lane_mode
Definition: ad463x.h:216
ad463x_set_pgia_gain
int32_t ad463x_set_pgia_gain(struct ad463x_dev *dev, enum ad463x_pgia_gain gain_idx)
Set the PGIA gain.
Definition: ad463x.c:916
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
AD463X_REG_SCRATCH_PAD
#define AD463X_REG_SCRATCH_PAD
Definition: ad463x.h:58
ad463x_enter_config_mode
int32_t ad463x_enter_config_mode(struct ad463x_dev *dev)
Enter register configuration mode.
Definition: ad463x.c:125
ad463x_pgia_gain
ad463x_pgia_gain
Available pgia gains.
Definition: ad463x.h:178
ad463x_dev::capture_data_width
uint8_t capture_data_width
Definition: ad463x.h:260
ad463x_remove
int32_t ad463x_remove(struct ad463x_dev *dev)
Free the memory allocated by ad463x_init().
Definition: ad463x.c:946
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
AD463X_16_DIFF_8_COM
#define AD463X_16_DIFF_8_COM
Definition: ad463x.h:98
ad463x_init
int32_t ad463x_init(struct ad463x_dev **device, struct ad463x_init_param *init_param)
Initialize the device.
Definition: ad463x.c:687
AD463X_REG_READ
#define AD463X_REG_READ
Definition: ad463x.h:131
ad463x_dev::vref
int32_t vref
Definition: ad463x.h:268
ad463x_set_drive_strength
int32_t ad463x_set_drive_strength(struct ad463x_dev *dev, uint8_t mode)
Set drive strength.
Definition: ad463x.c:247
ad463x_dev::clock_mode
uint8_t clock_mode
Definition: ad463x.h:264
spi_engine_offload_message::commands
uint32_t * commands
Definition: spi_engine.h:163
AD463X_AVG_FILTER_RESET
#define AD463X_AVG_FILTER_RESET
Definition: ad463x.h:127
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:93
AD463X_REG_CHAN_GAIN
#define AD463X_REG_CHAN_GAIN(ch, pos)
Definition: ad463x.h:133
ad463x_read_data
int32_t ad463x_read_data(struct ad463x_dev *dev, uint32_t *buf, uint16_t samples)
Read from device. Enter register mode to read/write registers.
Definition: ad463x.c:628
no_os_pwm_init
int32_t no_os_pwm_init(struct no_os_pwm_desc **desc, const struct no_os_pwm_init_param *param)
Initialize the PWM peripheral.
Definition: no_os_pwm.c:51
ID_AD4630_24
@ ID_AD4630_24
Definition: ad463x.h:151
ad7616_init_param::dcache_invalidate_range
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad7616.h:230
AD463X_GAIN_0_33
@ AD463X_GAIN_0_33
Definition: ad463x.h:180
ad7616_init_param::axi_clkgen_rate
uint32_t axi_clkgen_rate
Definition: ad7616.h:211
ad463x_remove
int32_t ad463x_remove(struct ad463x_dev *dev)
Free the memory allocated by ad463x_init().
Definition: ad463x.c:946
ad463x_spi_reg_write
int32_t ad463x_spi_reg_write(struct ad463x_dev *dev, uint16_t reg_addr, uint8_t reg_data)
Write device register.
Definition: ad463x.c:107
no_os_pwm.h
Header file of PWM Interface.
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
AD463X_GAIN_2_22
@ AD463X_GAIN_2_22
Definition: ad463x.h:184
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:45
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
ad463x_dev::clkgen
struct axi_clkgen * clkgen
Definition: ad463x.h:250
ad463x_dev::output_mode
uint8_t output_mode
Definition: ad463x.h:274
AD463X_REG_CHAN_OFFSET
#define AD463X_REG_CHAN_OFFSET(ch, pos)
Definition: ad463x.h:132
AD463X_DDR_MODE_MSK
#define AD463X_DDR_MODE_MSK
Definition: ad463x.h:93
AD463X_OUT_DATA_MODE_MSK
#define AD463X_OUT_DATA_MODE_MSK
Definition: ad463x.h:96
AD463X_LOW_POWER_MODE
#define AD463X_LOW_POWER_MODE
Definition: ad463x.h:125
no_os_get_unaligned_be32
uint32_t no_os_get_unaligned_be32(uint8_t *buf)
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
no_os_shift_right
#define no_os_shift_right(x, s)
Definition: no_os_util.h:119
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
ad7616_init_param::clkgen_init
struct axi_clkgen_init * clkgen_init
Definition: ad7616.h:209
ad463x_set_pgia_gain
int32_t ad463x_set_pgia_gain(struct ad463x_dev *dev, enum ad463x_pgia_gain gain_idx)
Set the PGIA gain.
Definition: ad463x.c:916
ad463x_init_param::gpio_pgia_a0
struct no_os_gpio_init_param * gpio_pgia_a0
Definition: ad463x.h:199
ad463x_dev
Device initialization parameters.
Definition: ad463x.h:237
AD463X_24_DIFF_8_COM
#define AD463X_24_DIFF_8_COM
Definition: ad463x.h:99
AD463X_30_AVERAGED_DIFF
#define AD463X_30_AVERAGED_DIFF
Definition: ad463x.h:100
ad463x_init_param::dcache_invalidate_range
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad463x.h:230
ad463x_dev::read_bytes_no
uint8_t read_bytes_no
Definition: ad463x.h:258
spi_engine_offload_transfer
int32_t spi_engine_offload_transfer(struct no_os_spi_desc *desc, struct spi_engine_offload_message msg, uint32_t no_samples)
Initiate a SPI transfer in offload mode.
Definition: spi_engine.c:809
ad463x_init_param::clkgen_init
struct axi_clkgen_init * clkgen_init
Definition: ad463x.h:206
ad463x_init
int32_t ad463x_init(struct ad463x_dev **device, struct ad463x_init_param *init_param)
Initialize the device.
Definition: ad463x.c:687
AD463X_GAIN_MAX_VAL_SCALED
#define AD463X_GAIN_MAX_VAL_SCALED
Definition: ad463x.h:143
ad463x_init_param
Definition: ad463x.h:193
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
spi_engine_offload_init_param
Structure containing the init parameters needed by the offload module.
Definition: spi_engine.h:143
no_os_gpio.h
Header file of GPIO Interface.
ID_AD4030
@ ID_AD4030
Definition: ad463x.h:169
ad463x_dev::offload_enable
bool offload_enable
Definition: ad463x.h:282
AD463X_REG_IO
#define AD463X_REG_IO
Definition: ad463x.h:79
ad463x_dev::device_id
enum ad463x_id device_id
Definition: ad463x.h:254
AD463X_GAIN_MSB
#define AD463X_GAIN_MSB
Definition: ad463x.h:113
no_os_spi_desc::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:198
NANO
#define NANO
Definition: no_os_units.h:50
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
AD463X_NORMAL_OUTPUT_STRENGTH
#define AD463X_NORMAL_OUTPUT_STRENGTH
Definition: ad463x.h:136
axi_clkgen_remove
int32_t axi_clkgen_remove(struct axi_clkgen *clkgen)
axi_clkgen_remove
Definition: clk_axi_clkgen.c:541
no_os_util.h
Header file of utility functions.
ad463x_dev::offload_init_param
struct spi_engine_offload_init_param * offload_init_param
Definition: ad463x.h:248
ad463x_set_ch_offset
int32_t ad463x_set_ch_offset(struct ad463x_dev *dev, uint8_t ch_idx, uint32_t offset)
Set channel offset.
Definition: ad463x.c:320
AD463X_DRIVER_STRENGTH_MASK
#define AD463X_DRIVER_STRENGTH_MASK
Definition: ad463x.h:135
ID_AD4630_20
@ ID_AD4630_20
Definition: ad463x.h:153
spi_engine_offload_message::rx_addr
uint32_t rx_addr
Definition: spi_engine.h:171
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147
AD463X_LANE_MODE_MSK
#define AD463X_LANE_MODE_MSK
Definition: ad463x.h:91
ad463x_dev::gpio_pgia_a1
struct no_os_gpio_desc * gpio_pgia_a1
Definition: ad463x.h:244
READ
#define READ(no_bytes)
Definition: spi_engine.h:62
ad463x_init_param::gpio_resetn
struct no_os_gpio_init_param * gpio_resetn
Definition: ad463x.h:197
ad463x_dev::has_pgia
bool has_pgia
Definition: ad463x.h:278
AD463X_SPI_COMPATIBLE_MODE
#define AD463X_SPI_COMPATIBLE_MODE
Definition: ad463x.h:120
ad463x_set_pwr_mode
int32_t ad463x_set_pwr_mode(struct ad463x_dev *dev, uint8_t mode)
Set power mode.
Definition: ad463x.c:196
ad463x_exit_reg_cfg_mode
int32_t ad463x_exit_reg_cfg_mode(struct ad463x_dev *dev)
Exit register configuration mode.
Definition: ad463x.c:262
AD463X_OFFSET_2
#define AD463X_OFFSET_2
Definition: ad463x.h:110
ID_AD4632_20
@ ID_AD4632_20
Definition: ad463x.h:165
ad463x_init_param::gpio_cnv
struct no_os_gpio_init_param * gpio_cnv
Definition: ad463x.h:198
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
ad463x_dev::gpio_cnv
struct no_os_gpio_desc * gpio_cnv
Definition: ad463x.h:242
ad463x_spi_reg_read
int32_t ad463x_spi_reg_read(struct ad463x_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
Read device register.
Definition: ad463x.c:83
no_os_gpio_get_optional
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:75