no-OS
ad469x.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef SRC_AD469X_H_
41 #define SRC_AD469X_H_
42 
43 // **** Note for User: SPI Standard/Engine selection **** //
44 /* By default the SPI Engine Framework is used for communicating with eval board.
45  * Uncomment the "USE_STANDARD_SPI" macro to enable the standard SPI.
46  * framework.
47  * */
48 //#define USE_STANDARD_SPI
49 
50 /******************************************************************************/
51 /***************************** Include Files **********************************/
52 /******************************************************************************/
53 #include <stdbool.h>
54 
55 #if !defined(USE_STANDARD_SPI)
56 #include "spi_engine.h"
57 #include "clk_axi_clkgen.h"
58 #include "no_os_pwm.h"
59 #else
60 #include "no_os_spi.h"
61 #endif
62 
63 #include "no_os_gpio.h"
64 
65 /******************************************************************************/
66 /********************** Macros and Constants Definitions **********************/
67 /******************************************************************************/
68 /* AD469x registers */
69 #define AD469x_REG_IF_CONFIG_A 0x000
70 #define AD469x_REG_IF_CONFIG_B 0x001
71 #define AD469x_REG_DEVICE_TYPE 0x003
72 #define AD469x_REG_DEVICE_ID_L 0x004
73 #define AD469x_REG_DEVICE_ID_H 0x005
74 #define AD469x_REG_SCRATCH_PAD 0x00A
75 #define AD469x_REG_VENDOR_L 0x00C
76 #define AD469x_REG_VENDOR_H 0x00D
77 #define AD469x_REG_LOOP_MODE 0x00E
78 #define AD469x_REG_IF_CONFIG_C 0x010
79 #define AD469x_REG_IF_STATUS 0x011
80 #define AD469x_REG_STATUS 0x014
81 #define AD469x_REG_ALERT_STATUS1 0x015
82 #define AD469x_REG_ALERT_STATUS2 0x016
83 #define AD469x_REG_ALERT_STATUS3 0x017
84 #define AD469x_REG_ALERT_STATUS4 0x018
85 #define AD469x_REG_CLAMP_STATUS1 0x01A
86 #define AD469x_REG_CLAMP_STATUS2 0x01B
87 #define AD469x_REG_SETUP 0x020
88 #define AD469x_REG_REF_CTRL 0x021
89 #define AD469x_REG_SEQ_CTRL 0x022
90 #define AD469x_REG_AC_CTRL 0x023
91 #define AD469x_REG_STD_SEQ_CONFIG 0x024
92 #define AD469x_REG_GPIO_CTRL 0x026
93 #define AD469x_REG_GP_MODE 0x027
94 #define AD469x_REG_GPIO_STATE 0x028
95 #define AD469x_REG_TEMP_CTRL 0x029
96 #define AD469x_REG_CONFIG_IN(x) ((x & 0x0F) | 0x30)
97 #define AD469x_REG_THRESHOLD_UB(x) ((x << 1) | 0x40)
98 #define AD469x_REG_THRESHOLD_LB(x) ((x << 1) | 0x60)
99 #define AD469x_REG_HYST_IN(x) ((x << 1) | 0x80)
100 #define AD469x_REG_GAIN_IN(x) ((x << 1) | 0x0C0)
101 #define AD469x_REG_AS_SLOT(x) ((x & 0x7F) | 0x100)
102 
103 /* 5-bit SDI Conversion Mode Commands */
104 #define AD469x_CMD_REG_CONFIG_MODE (0x0A << 3)
105 #define AD469x_CMD_SEL_TEMP_SNSOR_CH (0x0F << 3)
106 #define AD469x_CMD_CONFIG_CH_SEL(x) ((0x10 | (0x0F & x)) << 3)
107 
108 /* Status Register Mask */
109 #define AD469x_REG_STATUS_RESET_MASK (0x01 << 5)
110 
111 /* AD469x_REG_SETUP */
112 #define AD469x_SETUP_IF_MODE_MASK (0x01 << 2)
113 #define AD469x_SETUP_IF_MODE_CONV (0x01 << 2)
114 #define AD469x_SETUP_CYC_CTRL_MASK (0x01 << 1)
115 #define AD469x_SETUP_CYC_CTRL_SINGLE(x) ((x & 0x01) << 1)
116 
117 /* AD469x_REG_GP_MODE */
118 #define AD469x_GP_MODE_BUSY_GP_EN_MASK (0x01 << 1)
119 #define AD469x_GP_MODE_BUSY_GP_EN(x) ((x & 0x01) << 1)
120 #define AD469x_GP_MODE_BUSY_GP_SEL_MASK (0x01 << 4)
121 #define AD469x_GP_MODE_BUSY_GP_SEL(x) ((x & 0x01) << 4)
122 
123 /* AD469x_REG_SEQ_CTRL */
124 #define AD469x_SEQ_CTRL_STD_SEQ_EN_MASK (0x01 << 7)
125 #define AD469x_SEQ_CTRL_STD_SEQ_EN(x) ((x & 0x01) << 7)
126 #define AD469x_SEQ_CTRL_NUM_SLOTS_AS_MASK (0x7f << 0)
127 #define AD469x_SEQ_CTRL_NUM_SLOTS_AS(x) ((x & 0x7f) << 0)
128 
129 /* AD469x_REG_TEMP_CTRL */
130 #define AD469x_REG_TEMP_CTRL_TEMP_EN_MASK (0x01 << 0)
131 #define AD469x_REG_TEMP_CTRL_TEMP_EN(x) ((x & 0x01) << 0)
132 
133 /* AD469x_REG_AS_SLOT */
134 #define AD469x_REG_AS_SLOT_INX(x) ((x & 0x0f) << 0)
135 
136 /* AD469x_REG_IF_CONFIG_C */
137 #define AD469x_REG_IF_CONFIG_C_MB_STRICT_MASK (0x01 << 5)
138 #define AD469x_REG_IF_CONFIG_C_MB_STRICT(x) ((x & 0x01) << 5)
139 
140 /* AD469x_REG_CONFIG_INn */
141 #define AD469x_REG_CONFIG_IN_OSR_MASK (0x03 << 0)
142 #define AD469x_REG_CONFIG_IN_OSR(x) ((x & 0x03) << 0)
143 #define AD469x_REG_CONFIG_IN_HIZ_EN_MASK (0x01 << 3)
144 #define AD469x_REG_CONFIG_IN_HIZ_EN(x) ((x & 0x01) << 3)
145 #define AD469x_REG_CONFIG_IN_PAIR_MASK (0x03 << 4)
146 #define AD469x_REG_CONFIG_IN_PAIR(x) ((x & 0x03) << 4)
147 #define AD469x_REG_CONFIG_IN_MODE_MASK (0x01 << 6)
148 #define AD469x_REG_CONFIG_IN_MODE(x) ((x & 0x01) << 6)
149 #define AD469x_REG_CONFIG_IN_TD_EN_MASK (0x01 << 7)
150 #define AD469x_REG_CONFIG_IN_TD_EN(x) ((x & 0x01) << 7)
151 
152 #define AD469x_CHANNEL(x) (NO_OS_BIT(x) & 0xFFFF)
153 #define AD469x_CHANNEL_NO 16
154 #define AD469x_SLOTS_NO 0x80
155 #define AD469x_CHANNEL_TEMP 16
156 
157 /******************************************************************************/
158 /*************************** Types Declarations *******************************/
159 /******************************************************************************/
173 };
174 
184 };
185 
193 };
194 
203 };
204 
214 };
215 
224 };
225 
231  /* SPI */
233 #if !defined(USE_STANDARD_SPI)
234  /* SPI module offload init */
236  /* PWM generator init structure */
238  /* Clock gen for hdl design init structure */
240  /* Clock generator rate */
241  uint32_t axi_clkgen_rate;
242 #endif
243 
249  /* Register access speed */
251  /* Register data width */
252  uint8_t reg_data_width;
253  /* Capture data width */
255  /* Device Settings */
257  /* Pin Pairing option in standard sequencer mode */
259  /* Channel sequencing mode */
268  void (*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
269 };
270 
275 struct ad469x_dev {
276  /* SPI descriptor */
278 #if !defined(USE_STANDARD_SPI)
279  /* Clock gen for hdl design structure */
281  /* Trigger conversion PWM generator descriptor */
283  /* SPI module offload init */
285 #endif
286  /* Register access speed */
288  /* Register data width */
289  uint8_t reg_data_width;
290  /* Capture data width */
292  /* Device Settings */
301  void (*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
304  /* Pin Pairing option in standard sequencer mode */
317  uint8_t num_slots;
318 };
319 
320 /******************************************************************************/
321 /************************ Functions Declarations ******************************/
322 /******************************************************************************/
323 /* Read device register. */
324 int32_t ad469x_spi_reg_read(struct ad469x_dev *dev,
325  uint16_t reg_addr,
326  uint8_t *reg_data);
327 
328 /* Write device register */
329 int32_t ad469x_spi_reg_write(struct ad469x_dev *dev,
330  uint16_t reg_addr,
331  uint8_t reg_data);
332 
333 /* Read from device using a mask */
334 int32_t ad469x_spi_read_mask(struct ad469x_dev *dev,
335  uint16_t reg_addr,
336  uint8_t mask,
337  uint8_t *data);
338 
339 /* Write to device using a mask */
340 int32_t ad469x_spi_write_mask(struct ad469x_dev *dev,
341  uint16_t reg_addr,
342  uint8_t mask,
343  uint8_t data);
344 
345 /* Read data from device */
346 int32_t ad469x_read_data(struct ad469x_dev *dev,
347  uint8_t channel,
348  uint32_t *buf,
349  uint16_t samples);
350 
351 /* Read from device when converter has the channel sequencer activated */
352 int32_t ad469x_seq_read_data(struct ad469x_dev *dev,
353  uint32_t *buf,
354  uint16_t samples);
355 
356 /* Set channel sequence */
357 int32_t ad469x_set_channel_sequence(struct ad469x_dev *dev,
358  enum ad469x_channel_sequencing seq);
359 
360 /* Configure standard sequencer enabled channels */
361 int32_t ad469x_std_sequence_ch(struct ad469x_dev *dev,
362  uint16_t ch_mask);
363 
364 /* Configure advanced sequencer number of slots */
366  uint8_t num_slots);
367 
368 /* Advanced sequencer, assign channel to a slot */
369 int32_t ad469x_adv_sequence_set_slot(struct ad469x_dev *dev,
370  uint8_t slot,
371  uint8_t channel);
372 
373 /* Enable temperature read at the end of the sequence, for standard and */
374 int32_t ad469x_sequence_enable_temp(struct ad469x_dev *dev);
375 
376 /* Disable temperature read at the end of the sequence, for standard and */
377 int32_t ad469x_sequence_disable_temp(struct ad469x_dev *dev);
378 
379 /* Configure over sampling ratio in advanced sequencer mode */
380 int32_t ad469x_adv_seq_osr(struct ad469x_dev *dev, uint16_t ch,
381  enum ad469x_osr_ratios ratio);
382 
383 /* Configure over sampling ratio in standard sequencer mode */
384 int32_t ad469x_std_seq_osr(struct ad469x_dev *dev,
385  enum ad469x_osr_ratios ratio);
386 
387 /* Configure the pairing option in standard sequencer mode */
388 int32_t ad469x_std_pin_pairing(struct ad469x_dev *dev,
389  enum ad469x_pin_pairing pin_pair);
390 
391 /* Enter conversion mode */
392 int32_t ad469x_enter_conversion_mode(struct ad469x_dev *dev);
393 
394 /* Exit conversion mode */
395 int32_t ad469x_exit_conversion_mode(struct ad469x_dev *dev);
396 
397 /* Reset with AD469x device */
398 int32_t ad469x_reset_dev(struct ad469x_dev *dev);
399 
400 /* Configures the AD469x device */
401 int32_t ad469x_config(struct ad469x_dev *dev,
402  struct ad469x_init_param *config_desc);
403 
404 /* Initialize the device. */
405 int32_t ad469x_init(struct ad469x_dev **device,
406  struct ad469x_init_param *init_param);
407 
408 /* Remove the device and release resources. */
409 int32_t ad469x_remove(struct ad469x_dev *dev);
410 
411 #endif /* SRC_AD469X_H_ */
ID_AD4696
@ ID_AD4696
Definition: ad469x.h:201
ad469x_init_param::axi_clkgen_rate
uint32_t axi_clkgen_rate
Definition: ad469x.h:241
ad469x_init
int32_t ad469x_init(struct ad469x_dev **device, struct ad469x_init_param *init_param)
Definition: ad469x.c:874
AD469x_REG_TEMP_CTRL_TEMP_EN_MASK
#define AD469x_REG_TEMP_CTRL_TEMP_EN_MASK
Definition: ad469x.h:130
ad469x_dev::dcache_invalidate_range
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad469x.h:301
AD469x_two_cycle
@ AD469x_two_cycle
Definition: ad469x.h:168
ad469x_channel_sequencing
ad469x_channel_sequencing
Channel sequencing modes.
Definition: ad469x.h:164
ID_AD4697
@ ID_AD4697
Definition: ad469x.h:202
ad469x_init_param::dcache_invalidate_range
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad469x.h:268
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
spi_engine_offload_message::no_commands
uint32_t no_commands
Definition: spi_engine.h:167
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:66
ad469x_std_sequence_ch
int32_t ad469x_std_sequence_ch(struct ad469x_dev *dev, uint16_t ch_mask)
Configure standard sequencer channels.
Definition: ad469x.c:522
ad469x_init_param::ch_sequence
enum ad469x_channel_sequencing ch_sequence
Definition: ad469x.h:260
ad469x_dev::reg_access_speed
uint32_t reg_access_speed
Definition: ad469x.h:287
ad469x_sequence_enable_temp
int32_t ad469x_sequence_enable_temp(struct ad469x_dev *dev)
Enable temperature read at the end of the sequence, for standard and advanced sequencer.
Definition: ad469x.c:549
ad469x_enter_conversion_mode
int32_t ad469x_enter_conversion_mode(struct ad469x_dev *dev)
Enter conversion mode. To exit conversion mode send a 5 bit conversion mode command AD469x_CMD_REG_CO...
Definition: ad469x.c:624
AD469x_INx_COM
@ AD469x_INx_COM
Definition: ad469x.h:222
ad469x_init_param::trigger_pwm_init
struct no_os_pwm_init_param * trigger_pwm_init
Definition: ad469x.h:237
ad469x_supported_dev_ids
ad469x_supported_dev_ids
Supported devices.
Definition: ad469x.h:199
ad469x_dev::adv_seq_osr_resol
enum ad469x_osr_ratios adv_seq_osr_resol[AD469x_CHANNEL_NO]
Definition: ad469x.h:311
ad469x_exit_conversion_mode
int32_t ad469x_exit_conversion_mode(struct ad469x_dev *dev)
Exit conversion mode. Enter register mode to read/write registers.
Definition: ad469x.c:638
ad469x_adv_sequence_set_num_slots
int32_t ad469x_adv_sequence_set_num_slots(struct ad469x_dev *dev, uint8_t num_slots)
Configure advanced sequencer number of slots, temp channel not included.
Definition: ad469x.c:472
ad469x_set_busy
int32_t ad469x_set_busy(struct ad469x_dev *dev, enum ad469x_busy_gp_sel gp_sel)
Configure converter busy indicator to the output of the specified port.
Definition: ad469x.c:593
AD469x_SEQ_CTRL_STD_SEQ_EN
#define AD469x_SEQ_CTRL_STD_SEQ_EN(x)
Definition: ad469x.h:125
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:82
ad469x_sequence_disable_temp
int32_t ad469x_sequence_disable_temp(struct ad469x_dev *dev)
Disable temperature read at the end of the sequence, for standard and advanced sequencer.
Definition: ad469x.c:571
ad469x_dev::clkgen
struct axi_clkgen * clkgen
Definition: ad469x.h:280
CS_LOW
#define CS_LOW
Definition: spi_engine.h:79
ad469x_remove
int32_t ad469x_remove(struct ad469x_dev *dev)
Free the memory allocated by ad469x_init().
Definition: ad469x.c:974
no_os_spi.h
Header file of SPI Interface.
ad469x_init_param::reg_access_speed
uint32_t reg_access_speed
Definition: ad469x.h:250
ad469x_sequence_disable_temp
int32_t ad469x_sequence_disable_temp(struct ad469x_dev *dev)
Disable temperature read at the end of the sequence, for standard and advanced sequencer.
Definition: ad469x.c:571
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:757
ad469x_read_data
int32_t ad469x_read_data(struct ad469x_dev *dev, uint8_t channel, uint32_t *buf, uint16_t samples)
Read from device. Enter register mode to read/write registers.
Definition: ad469x.c:752
no_os_pwm_remove
int32_t no_os_pwm_remove(struct no_os_pwm_desc *desc)
Free the memory allocated by axi_pwmgen_init().
Definition: axi_pwm.c:372
ad469x_set_channel_sequence
int32_t ad469x_set_channel_sequence(struct ad469x_dev *dev, enum ad469x_channel_sequencing seq)
Set channel sequence.
Definition: ad469x.c:367
AD469x_REG_CONFIG_IN_MODE
#define AD469x_REG_CONFIG_IN_MODE(x)
Definition: ad469x.h:148
ad469x_set_reg_access_mode
int32_t ad469x_set_reg_access_mode(struct ad469x_dev *dev, enum ad469x_reg_access access)
Configure register access mode.
Definition: ad469x.c:211
AD469x_TEST_DATA
#define AD469x_TEST_DATA
Definition: ad469x.c:57
ad469x_dev::trigger_pwm_desc
struct no_os_pwm_desc * trigger_pwm_desc
Definition: ad469x.h:282
clk_axi_clkgen.h
Driver for the Analog Devices AXI CLKGEN.
ad469x_pin_pairing
ad469x_pin_pairing
Channel pin pairing options.
Definition: ad469x.h:220
spi_engine_offload_message::commands_data
uint32_t * commands_data
Definition: spi_engine.h:169
ad469x_reset_dev
int32_t ad469x_reset_dev(struct ad469x_dev *dev)
Resets the ad469x device.
Definition: ad469x.c:805
ad469x_adv_seq_osr
int32_t ad469x_adv_seq_osr(struct ad469x_dev *dev, uint16_t ch, enum ad469x_osr_ratios ratio)
Configure over sampling ratio in advanced sequencer mode.
Definition: ad469x.c:266
no_os_delay.h
Header file of Delay functions.
AD469x_CHANNEL_TEMP
#define AD469x_CHANNEL_TEMP
Definition: ad469x.h:155
AD469x_GP_MODE_BUSY_GP_EN_MASK
#define AD469x_GP_MODE_BUSY_GP_EN_MASK
Definition: ad469x.h:118
axi_clkgen_init
Definition: clk_axi_clkgen.h:56
ad469x_dev::ch_sequence
enum ad469x_channel_sequencing ch_sequence
Definition: ad469x.h:303
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:418
AD469x_REG_CONFIG_IN_OSR_MASK
#define AD469x_REG_CONFIG_IN_OSR_MASK
Definition: ad469x.h:141
ad469x_enter_conversion_mode
int32_t ad469x_enter_conversion_mode(struct ad469x_dev *dev)
Enter conversion mode. To exit conversion mode send a 5 bit conversion mode command AD469x_CMD_REG_CO...
Definition: ad469x.c:624
ad469x_reset_dev
int32_t ad469x_reset_dev(struct ad469x_dev *dev)
Resets the ad469x device.
Definition: ad469x.c:805
spi_engine_offload_message
Structure representing an offload message.
Definition: spi_engine.h:160
AD469x_GP_MODE_BUSY_GP_SEL_MASK
#define AD469x_GP_MODE_BUSY_GP_SEL_MASK
Definition: ad469x.h:120
device
Definition: ad9361_util.h:75
ad469x_spi_write_mask
int32_t ad469x_spi_write_mask(struct ad469x_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t data)
Definition: ad469x.c:187
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:123
ad469x_dev::gpio_resetn
struct no_os_gpio_desc * gpio_resetn
Definition: ad469x.h:295
ad469x_dev::std_seq_pin_pairing
enum ad469x_pin_pairing std_seq_pin_pairing
Definition: ad469x.h:305
AD469x_advanced_seq
@ AD469x_advanced_seq
Definition: ad469x.h:172
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:524
AD469x_REG_IF_CONFIG_C_MB_STRICT
#define AD469x_REG_IF_CONFIG_C_MB_STRICT(x)
Definition: ad469x.h:138
axi_clkgen
Definition: clk_axi_clkgen.h:50
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:53
ad469x_std_sequence_ch
int32_t ad469x_std_sequence_ch(struct ad469x_dev *dev, uint16_t ch_mask)
Configure standard sequencer channels.
Definition: ad469x.c:522
no_os_gpio_direction_input
int32_t no_os_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: no_os_gpio.c:108
ad469x_init_param::dev_id
enum ad469x_supported_dev_ids dev_id
Definition: ad469x.h:256
ad469x_std_pin_pairing
int32_t ad469x_std_pin_pairing(struct ad469x_dev *dev, enum ad469x_pin_pairing pin_pair)
Configure the pin pairing option in standard sequencer mode.
Definition: ad469x.c:351
AD469x_CMD_CONFIG_CH_SEL
#define AD469x_CMD_CONFIG_CH_SEL(x)
Definition: ad469x.h:106
ad469x_spi_reg_read
int32_t ad469x_spi_reg_read(struct ad469x_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
Definition: ad469x.c:80
ad469x_init_param::gpio_convst
struct no_os_gpio_init_param * gpio_convst
Definition: ad469x.h:246
ad469x_dev::spi_desc
no_os_spi_desc * spi_desc
Definition: ad469x.h:277
ad469x_spi_read_mask
int32_t ad469x_spi_read_mask(struct ad469x_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t *data)
Definition: ad469x.c:162
WRITE_READ
#define WRITE_READ(no_bytes)
Definition: spi_engine.h:71
ad469x_device_resol
const uint8_t ad469x_device_resol[]
Device resolution.
Definition: ad469x.c:62
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:121
ad7616_init_param::reg_access_speed
uint32_t reg_access_speed
Definition: ad7616.h:169
ad469x_init_param::gpio_resetn
struct no_os_gpio_init_param * gpio_resetn
Definition: ad469x.h:244
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: delay.c:130
AD469x_SEQ_CTRL_NUM_SLOTS_AS
#define AD469x_SEQ_CTRL_NUM_SLOTS_AS(x)
Definition: ad469x.h:127
ad469x_std_seq_osr
int32_t ad469x_std_seq_osr(struct ad469x_dev *dev, enum ad469x_osr_ratios ratio)
Configure over sampling ratio in standard sequencer mode.
Definition: ad469x.c:323
CS_HIGH
#define CS_HIGH
Definition: spi_engine.h:78
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:150
AD469x_SETUP_CYC_CTRL_MASK
#define AD469x_SETUP_CYC_CTRL_MASK
Definition: ad469x.h:114
AD469x_busy_gp3
@ AD469x_busy_gp3
Definition: ad469x.h:183
ad469x_dev::dev_id
enum ad469x_supported_dev_ids dev_id
Definition: ad469x.h:293
ad469x_read_data
int32_t ad469x_read_data(struct ad469x_dev *dev, uint8_t channel, uint32_t *buf, uint16_t samples)
Read from device. Enter register mode to read/write registers.
Definition: ad469x.c:752
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 generator device.
Definition: axi_pwm.c:107
ad469x_adv_sequence_set_num_slots
int32_t ad469x_adv_sequence_set_num_slots(struct ad469x_dev *dev, uint8_t num_slots)
Configure advanced sequencer number of slots, temp channel not included.
Definition: ad469x.c:472
AD469x_REG_GP_MODE
#define AD469x_REG_GP_MODE
Definition: ad469x.h:93
AD469x_REG_TEMP_CTRL_TEMP_EN
#define AD469x_REG_TEMP_CTRL_TEMP_EN(x)
Definition: ad469x.h:131
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:129
ad7616_init_param::offload_init_param
struct spi_engine_offload_init_param * offload_init_param
Definition: ad7616.h:168
ad469x_init_param::reg_data_width
uint8_t reg_data_width
Definition: ad469x.h:252
AD469x_CMD_SEL_TEMP_SNSOR_CH
#define AD469x_CMD_SEL_TEMP_SNSOR_CH
Definition: ad469x.h:105
no_os_pwm_disable
int32_t no_os_pwm_disable(struct no_os_pwm_desc *desc)
Disable PWM generator device.
Definition: axi_pwm.c:128
ad469x_set_channel_sequence
int32_t ad469x_set_channel_sequence(struct ad469x_dev *dev, enum ad469x_channel_sequencing seq)
Set channel sequence.
Definition: ad469x.c:367
spi_engine.h
ad469x_reg_access
ad469x_reg_access
Register access modes.
Definition: ad469x.h:190
AD469x_REG_CONFIG_IN
#define AD469x_REG_CONFIG_IN(x)
Definition: ad469x.h:96
ad469x_dev::capture_data_width
uint8_t capture_data_width
Definition: ad469x.h:291
ID_AD4695
@ ID_AD4695
Definition: ad469x.h:200
ad469x_busy_gp_sel
ad469x_busy_gp_sel
Busy state, possible general purpose pin selections.
Definition: ad469x.h:179
AD469x_single_cycle
@ AD469x_single_cycle
Definition: ad469x.h:166
ad469x_dev::std_seq_osr
enum ad469x_osr_ratios std_seq_osr
Definition: ad469x.h:308
ad469x_spi_write_mask
int32_t ad469x_spi_write_mask(struct ad469x_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t data)
Definition: ad469x.c:187
ad469x_dev::offload_init_param
struct spi_engine_offload_init_param * offload_init_param
Definition: ad469x.h:284
ad469x_dev::num_slots
uint8_t num_slots
Definition: ad469x.h:317
AD469x_SETUP_IF_MODE_CONV
#define AD469x_SETUP_IF_MODE_CONV
Definition: ad469x.h:113
ad469x_adv_seq_osr
int32_t ad469x_adv_seq_osr(struct ad469x_dev *dev, uint16_t ch, enum ad469x_osr_ratios ratio)
Configure over sampling ratio in advanced sequencer mode.
Definition: ad469x.c:266
AD469x_GP_MODE_BUSY_GP_SEL
#define AD469x_GP_MODE_BUSY_GP_SEL(x)
Definition: ad469x.h:121
no_os_hweight16
unsigned int no_os_hweight16(uint16_t word)
ad469x.h
Header file for ad469x Driver.
AD469x_REG_SEQ_CTRL
#define AD469x_REG_SEQ_CTRL
Definition: ad469x.h:89
ad469x_seq_read_data
int32_t ad469x_seq_read_data(struct ad469x_dev *dev, uint32_t *buf, uint16_t samples)
Read from device when converter has the channel sequencer activated. Enter register mode to read/writ...
Definition: ad469x.c:718
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:95
AD469x_REG_STD_SEQ_CONFIG
#define AD469x_REG_STD_SEQ_CONFIG
Definition: ad469x.h:91
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:132
AD469x_REG_IF_CONFIG_C_MB_STRICT_MASK
#define AD469x_REG_IF_CONFIG_C_MB_STRICT_MASK
Definition: ad469x.h:137
ad469x_adv_sequence_set_slot
int32_t ad469x_adv_sequence_set_slot(struct ad469x_dev *dev, uint8_t slot, uint8_t channel)
Advanced sequencer, assign channel to a slot.
Definition: ad469x.c:500
AD469x_REG_TEMP_CTRL
#define AD469x_REG_TEMP_CTRL
Definition: ad469x.h:95
AD469x_REG_AS_SLOT_INX
#define AD469x_REG_AS_SLOT_INX(x)
Definition: ad469x.h:134
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
ad469x_init_param::std_seq_pin_pairing
enum ad469x_pin_pairing std_seq_pin_pairing
Definition: ad469x.h:258
ad469x_config
int32_t ad469x_config(struct ad469x_dev *dev, struct ad469x_init_param *config_desc)
Definition: ad469x.c:839
AD469x_SEQ_CTRL_STD_SEQ_EN_MASK
#define AD469x_SEQ_CTRL_STD_SEQ_EN_MASK
Definition: ad469x.h:124
ad469x_remove
int32_t ad469x_remove(struct ad469x_dev *dev)
Free the memory allocated by ad469x_init().
Definition: ad469x.c:974
spi_engine_offload_message::commands
uint32_t * commands
Definition: spi_engine.h:165
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:85
ad469x_dev
Structure representing an ad469x device.
Definition: ad469x.h:275
ad469x_init
int32_t ad469x_init(struct ad469x_dev **device, struct ad469x_init_param *init_param)
Definition: ad469x.c:874
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 axi generator and the handler associated with it.
Definition: axi_pwm.c:280
AD469x_REG_CONFIG_IN_OSR
#define AD469x_REG_CONFIG_IN_OSR(x)
Definition: ad469x.h:142
ad7616_init_param::dcache_invalidate_range
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad7616.h:184
AD469x_INx_REF_GND
@ AD469x_INx_REF_GND
Definition: ad469x.h:221
AD469x_SLOTS_NO
#define AD469x_SLOTS_NO
Definition: ad469x.h:154
AD469x_OSR_64
@ AD469x_OSR_64
Definition: ad469x.h:213
AD469x_REG_SCRATCH_PAD
#define AD469x_REG_SCRATCH_PAD
Definition: ad469x.h:74
ad469x_dev::gpio_busy
struct no_os_gpio_desc * gpio_busy
Definition: ad469x.h:299
no_os_pwm.h
Header file of PWM Interface.
AD469x_BYTE_ACCESS
@ AD469x_BYTE_ACCESS
Definition: ad469x.h:191
ad469x_std_seq_osr
int32_t ad469x_std_seq_osr(struct ad469x_dev *dev, enum ad469x_osr_ratios ratio)
Configure over sampling ratio in standard sequencer mode.
Definition: ad469x.c:323
ad469x_sequence_enable_temp
int32_t ad469x_sequence_enable_temp(struct ad469x_dev *dev)
Enable temperature read at the end of the sequence, for standard and advanced sequencer.
Definition: ad469x.c:549
AD469x_OSR_16
@ AD469x_OSR_16
Definition: ad469x.h:212
ad469x_osr_ratios
ad469x_osr_ratios
Supported oversampling ratios.
Definition: ad469x.h:209
AD469x_REG_IF_CONFIG_C
#define AD469x_REG_IF_CONFIG_C
Definition: ad469x.h:78
AD469x_busy_gp0
@ AD469x_busy_gp0
Definition: ad469x.h:181
ad469x_spi_reg_read
int32_t ad469x_spi_reg_read(struct ad469x_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
Definition: ad469x.c:80
ad469x_std_pin_pairing
int32_t ad469x_std_pin_pairing(struct ad469x_dev *dev, enum ad469x_pin_pairing pin_pair)
Configure the pin pairing option in standard sequencer mode.
Definition: ad469x.c:351
AD469x_OSR_4
@ AD469x_OSR_4
Definition: ad469x.h:211
AD469x_OSR_1
@ AD469x_OSR_1
Definition: ad469x.h:210
ad469x_spi_reg_write
int32_t ad469x_spi_reg_write(struct ad469x_dev *dev, uint16_t reg_addr, uint8_t reg_data)
Definition: ad469x.c:121
AD469x_GP_MODE_BUSY_GP_EN
#define AD469x_GP_MODE_BUSY_GP_EN(x)
Definition: ad469x.h:119
ad469x_dev::gpio_convst
struct no_os_gpio_desc * gpio_convst
Definition: ad469x.h:297
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:160
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
ad469x_adv_sequence_set_slot
int32_t ad469x_adv_sequence_set_slot(struct ad469x_dev *dev, uint8_t slot, uint8_t channel)
Advanced sequencer, assign channel to a slot.
Definition: ad469x.c:500
AD469x_SETUP_CYC_CTRL_SINGLE
#define AD469x_SETUP_CYC_CTRL_SINGLE(x)
Definition: ad469x.h:115
AD469x_WORD_ACCESS
@ AD469x_WORD_ACCESS
Definition: ad469x.h:192
AD469x_CMD_REG_CONFIG_MODE
#define AD469x_CMD_REG_CONFIG_MODE
Definition: ad469x.h:104
AD469x_SETUP_IF_MODE_MASK
#define AD469x_SETUP_IF_MODE_MASK
Definition: ad469x.h:112
ad469x_init_param::clkgen_init
struct axi_clkgen_init * clkgen_init
Definition: ad469x.h:239
ad469x_init_param::capture_data_width
uint8_t capture_data_width
Definition: ad469x.h:254
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:803
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:70
AD469x_REG_AS_SLOT
#define AD469x_REG_AS_SLOT(x)
Definition: ad469x.h:101
spi_engine_offload_init_param
Structure containing the init parameters needed by the offload module.
Definition: spi_engine.h:145
no_os_gpio.h
Header file of GPIO Interface.
ad469x_config
int32_t ad469x_config(struct ad469x_dev *dev, struct ad469x_init_param *config_desc)
Definition: ad469x.c:839
AD469x_CHANNEL_NO
#define AD469x_CHANNEL_NO
Definition: ad469x.h:153
no_os_spi_desc::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:136
ad469x_init_param::gpio_busy
struct no_os_gpio_init_param * gpio_busy
Definition: ad469x.h:248
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:51
ad469x_init_param::std_seq_osr
enum ad469x_osr_ratios std_seq_osr
Definition: ad469x.h:263
AD469x_REG_STATUS_RESET_MASK
#define AD469x_REG_STATUS_RESET_MASK
Definition: ad469x.h:109
axi_clkgen_remove
int32_t axi_clkgen_remove(struct axi_clkgen *clkgen)
axi_clkgen_remove
Definition: clk_axi_clkgen.c:545
no_os_util.h
Implementation of utility functions.
ad469x_init_param::spi_init
no_os_spi_init_param * spi_init
Definition: ad469x.h:232
ad469x_spi_reg_write
int32_t ad469x_spi_reg_write(struct ad469x_dev *dev, uint16_t reg_addr, uint8_t reg_data)
Definition: ad469x.c:121
ad469x_init_param::adv_seq_osr_resol
enum ad469x_osr_ratios adv_seq_osr_resol[AD469x_CHANNEL_NO]
Definition: ad469x.h:266
spi_engine_offload_message::rx_addr
uint32_t rx_addr
Definition: spi_engine.h:173
AD469x_INx_EVEN_ODD
@ AD469x_INx_EVEN_ODD
Definition: ad469x.h:223
AD469x_SEQ_CTRL_NUM_SLOTS_AS_MASK
#define AD469x_SEQ_CTRL_NUM_SLOTS_AS_MASK
Definition: ad469x.h:126
ad469x_spi_read_mask
int32_t ad469x_spi_read_mask(struct ad469x_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t *data)
Definition: ad469x.c:162
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:124
ad469x_exit_conversion_mode
int32_t ad469x_exit_conversion_mode(struct ad469x_dev *dev)
Exit conversion mode. Enter register mode to read/write registers.
Definition: ad469x.c:638
ad469x_init_param::offload_init_param
struct spi_engine_offload_init_param * offload_init_param
Definition: ad469x.h:235
ad469x_dev::ch_slots
uint8_t ch_slots[AD469x_SLOTS_NO]
Definition: ad469x.h:313
ad469x_init_param
Structure containing the init parameters needed by the ad469x device.
Definition: ad469x.h:230
AD469x_standard_seq
@ AD469x_standard_seq
Definition: ad469x.h:170
ad469x_dev::temp_enabled
bool temp_enabled
Definition: ad469x.h:315
ad469x_seq_read_data
int32_t ad469x_seq_read_data(struct ad469x_dev *dev, uint32_t *buf, uint16_t samples)
Read from device when converter has the channel sequencer activated. Enter register mode to read/writ...
Definition: ad469x.c:718
AD469x_REG_STATUS
#define AD469x_REG_STATUS
Definition: ad469x.h:80
AD469x_REG_SETUP
#define AD469x_REG_SETUP
Definition: ad469x.h:87
ad469x_dev::reg_data_width
uint8_t reg_data_width
Definition: ad469x.h:289
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:112
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