no-OS
ad7616.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef AD7616_H_
35 #define AD7616_H_
36 
37 #include "no_os_gpio.h"
38 
39 #include <stdint.h>
40 
41 #ifdef XILINX_PLATFORM
42 #include "no_os_pwm.h"
43 #include "clk_axi_clkgen.h"
44 #endif
45 
46 /******************************************************************************/
47 /********************** Macros and Constants Definitions **********************/
48 /******************************************************************************/
49 /* AD7616 CORE */
50 #define AD7616_REG_PCORE_VERSION 0x400
51 #define AD7616_REG_ID 0x404
52 #define AD7616_REG_UP_SCRATCH 0x408
53 #define AD7616_REG_UP_IF_TYPE 0x40C
54 #define AD7616_REG_UP_CTRL 0x440
55 #define AD7616_REG_UP_CONV_RATE 0x444
56 #define AD7616_REG_UP_BURST_LENGTH 0x448
57 #define AD7616_REG_UP_READ_DATA 0x44C
58 #define AD7616_REG_UP_WRITE_DATA 0x450
59 
60 /* AD7616_REG_UP_CTRL */
61 #define AD7616_CTRL_RESETN (1 << 0)
62 #define AD7616_CTRL_CNVST_EN (1 << 1)
63 
64 #define AD7616_REG_CONFIG 0x02
65 #define AD7616_REG_CHANNEL 0x03
66 #define AD7616_REG_INPUT_RANGE_A1 0x04
67 #define AD7616_REG_INPUT_RANGE_A2 0x05
68 #define AD7616_REG_INPUT_RANGE_B1 0x06
69 #define AD7616_REG_INPUT_RANGE_B2 0x07
70 #define AD7616_REG_SEQUENCER_STACK(x) (0x20 + (x))
71 
72 /* AD7616_REG_CONFIG */
73 #define AD7616_SDEF (1 << 7)
74 #define AD7616_BURSTEN(x) ((x & 1) << 6)
75 #define AD7616_BURSTEN_MASK (1 << 6)
76 #define AD7616_SEQEN(x) ((x & 1) << 5)
77 #define AD7616_SEQEN_MASK (1 << 5)
78 #define AD7616_OS(x) (((x) & 0x7) << 2)
79 #define AD7616_STATUSEN (1 << 1)
80 #define AD7616_STATUSEN_MASK (1 << 1)
81 #define AD7616_CRCEN (1 << 0)
82 #define AD7616_CRCEN_MASK (1 << 0)
83 
84 /* AD7616_REG_CHANNEL */
85 #define AD7616_CHA_MASK 0xF
86 #define AD7616_CHB_MASK 0xF0
87 #define AD7616_CHB_OFFSET 4
88 #define AD7616_CHANNELS_MASK 0xFF
89 
90 /* AD7616_REG_INPUT_RANGE */
91 #define AD7616_INPUT_RANGE(ch, x) (((x) & 0x3) << (((ch) & 0x3) * 2))
92 
93 /* AD7616_REG_SEQUENCER_STACK(x) */
94 #define AD7616_ADDR(x) (((x) & 0x7F) << 9)
95 #define AD7616_SSREN (1 << 8)
96 #define AD7616_BSEL(x) (((x) & 0xF) << 4)
97 #define AD7616_ASEL(x) (((x) & 0xF) << 0)
98 
99 /* AD7616_REG_STATUS */
100 #define AD7616_STATUS_A(x) (((x) & 0xF) << 12)
101 #define AD7616_STATUS_B(x) (((x) & 0xF) << 8)
102 #define AD7616_STATUS_CRC(x) (((x) & 0xFF) << 0)
103 
104 /* AD7616 conversion results */
105 #define AD7616_CHANNEL_A_SELF_TEST_VALUE 0xAAAA
106 #define AD7616_CHANNEL_B_SELF_TEST_VALUE 0x5555
107 
108 /* AD7616_REG_PWM */
109 #define AD7616_TRIGGER_PULSE_WIDTH_NS 50
110 
111 /******************************************************************************/
112 /*************************** Types Declarations *******************************/
113 /******************************************************************************/
117 };
118 
122 };
123 
124 enum ad7616_ch {
151 };
152 
157 };
158 
168 };
169 
170 struct ad7616_dev {
171  /* SPI */
174  /* Clock gen for hdl design structure */
176  /* Trigger conversion PWM generator descriptor */
179  uint8_t crc;
180  /* GPIO */
189  /* AXI Core */
190  uint32_t core_baseaddr;
191  /* Device Settings */
194  enum ad7616_range va[8];
195  enum ad7616_range vb[8];
197  void (*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
198  /* Sequencer and burst mode */
199  uint8_t layers_nb;
200 };
201 
203  /* SPI */
206  /* PWM generator init structure */
208  /* Clock gen for hdl design init structure */
210  /* Clock generator rate */
211  uint32_t axi_clkgen_rate;
213  uint8_t crc;
214  /* GPIO */
223  /* Core */
224  uint32_t core_baseaddr;
225  /* Device Settings */
227  enum ad7616_range va[8];
228  enum ad7616_range vb[8];
230  void (*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
231 };
232 
234  uint16_t channel_a;
235  uint16_t channel_b;
236 };
237 
241 };
242 
243 /******************************************************************************/
244 /************************ Functions Declarations ******************************/
245 /******************************************************************************/
246 /* SPI read from device. */
247 int32_t ad7616_read(struct ad7616_dev *dev,
248  uint8_t reg_addr,
249  uint16_t *reg_data);
250 /* SPI write to device. */
251 int32_t ad7616_write(struct ad7616_dev *dev,
252  uint8_t reg_addr,
253  uint16_t reg_data);
254 /* SPI read from device using a mask. */
255 int32_t ad7616_read_mask(struct ad7616_dev *dev,
256  uint8_t reg_addr,
257  uint16_t mask,
258  uint16_t *data);
259 /* SPI write to device using a mask. */
260 int32_t ad7616_write_mask(struct ad7616_dev *dev,
261  uint8_t reg_addr,
262  uint16_t mask,
263  uint16_t data);
264 /* SPI read from device. */
265 int32_t ad7616_spi_read(struct ad7616_dev *dev,
266  uint8_t reg_addr,
267  uint16_t *reg_data);
268 /* SPI write to device. */
269 int32_t ad7616_spi_write(struct ad7616_dev *dev,
270  uint8_t reg_addr,
271  uint16_t reg_data);
272 /* PAR read from device. */
273 int32_t ad7616_par_read(struct ad7616_dev *dev,
274  uint8_t reg_addr,
275  uint16_t *reg_data);
276 /* PAR write to device. */
277 int32_t ad7616_par_write(struct ad7616_dev *dev,
278  uint8_t reg_addr,
279  uint16_t reg_data);
280 /* Perform a full reset of the device. */
281 int32_t ad7616_reset(struct ad7616_dev *dev);
282 /* Set the analog input range for the selected analog input channel. */
283 int32_t ad7616_set_range(struct ad7616_dev *dev,
284  enum ad7616_ch ch,
285  enum ad7616_range range);
286 /* Set the operation mode (software or hardware). */
287 int32_t ad7616_set_mode(struct ad7616_dev *dev,
288  enum ad7616_mode mode);
289 /* Set the oversampling ratio. */
290 int32_t ad7616_set_oversampling_ratio(struct ad7616_dev *dev,
291  enum ad7616_osr osr);
292 /* Read data in serial mode. */
293 int32_t ad7616_read_data_serial(struct ad7616_dev *dev,
294  struct ad7616_conversion_result *results,
295  uint32_t samples);
296 /* Read data in parallel mode. */
297 int32_t ad7616_read_data_parallel(struct ad7616_dev *dev,
298  uint32_t *buf,
299  uint32_t samples);
300 /* Initialize the core. */
301 int32_t ad7616_core_setup(struct ad7616_dev *dev);
302 /* Initialize the device. */
303 int32_t ad7616_setup(struct ad7616_dev **device,
304  struct ad7616_init_param *init_param);
305 /* Remove the device. */
306 void ad7616_remove(struct ad7616_dev *device);
307 /* Read conversion results. */
308 int32_t ad7616_read_channel_source(struct ad7616_dev *dev, enum ad7616_ch *ch_a,
309  enum ad7616_ch *ch_b);
310 /* Select the input source for a channel. */
311 int32_t ad7616_select_channel_source(struct ad7616_dev *dev, enum ad7616_ch ch);
312 /* Setup sequencer with given layers. */
313 int32_t ad7616_setup_sequencer(struct ad7616_dev *dev,
314  struct ad7616_sequencer_layer *layers, uint32_t layers_nb, uint8_t burst);
315 /* Disable the sequencer. */
316 int32_t ad7616_disable_sequencer(struct ad7616_dev *dev);
317 #endif
ad7616_write_mask
int32_t ad7616_write_mask(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t mask, uint16_t data)
Definition: ad7616.c:383
AD7616_VA7
@ AD7616_VA7
Definition: ad7616.h:132
AD7616_OSR_32
@ AD7616_OSR_32
Definition: ad7616.h:165
ad7616_dev::gpio_os2
struct no_os_gpio_desc * gpio_os2
Definition: ad7616.h:186
ad7616_set_oversampling_ratio
int32_t ad7616_set_oversampling_ratio(struct ad7616_dev *dev, enum ad7616_osr osr)
Definition: ad7616.c:581
timeout
uint32_t timeout
Definition: ad413x.c:49
no_os_alloc.h
axi_dmac_init::base
uint32_t base
Definition: axi_dmac.h:129
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
AD7616_REG_INPUT_RANGE_B2
#define AD7616_REG_INPUT_RANGE_B2
Definition: ad7616.h:69
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:66
AD7616_STATUSEN
#define AD7616_STATUSEN
Definition: ad7616.h:79
ad7616_osr
ad7616_osr
Definition: ad7616.h:159
AD7616_REG_INPUT_RANGE_A2
#define AD7616_REG_INPUT_RANGE_A2
Definition: ad7616.h:67
ad7616_init_param::gpio_hw_rngsel0_param
struct no_os_gpio_init_param * gpio_hw_rngsel0_param
Definition: ad7616.h:215
AD7616_VB6
@ AD7616_VB6
Definition: ad7616.h:144
ad7616_setup_sequencer
int32_t ad7616_setup_sequencer(struct ad7616_dev *dev, struct ad7616_sequencer_layer *layers, uint32_t layers_nb, uint8_t burst)
Setup the sequencer layers.
Definition: ad7616.c:842
ad7616_write
int32_t ad7616_write(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Definition: ad7616.c:340
ad7616_spi_read
int32_t ad7616_spi_read(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Definition: ad7616.c:412
AD7616_REG_CHANNEL
#define AD7616_REG_CHANNEL
Definition: ad7616.h:65
ad7616_mode
ad7616_mode
Definition: ad7616.h:114
ad7616_dev::va
enum ad7616_range va[8]
Definition: ad7616.h:194
AD7616_VA3
@ AD7616_VA3
Definition: ad7616.h:128
ad7616_interface
ad7616_interface
Definition: ad7616.h:119
ad7616_dev::gpio_os1
struct no_os_gpio_desc * gpio_os1
Definition: ad7616.h:185
ad7616_spi_write
int32_t ad7616_spi_write(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Definition: ad7616.c:438
AD7616_VA5
@ AD7616_VA5
Definition: ad7616.h:130
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
ad7616_conversion_result::channel_a
uint16_t channel_a
Definition: ad7616.h:234
ad7616_remove
void ad7616_remove(struct ad7616_dev *device)
Definition: ad7616.c:1063
axi_dmac_init
Definition: axi_dmac.h:127
axi_dmac_init::name
const char * name
Definition: axi_dmac.h:128
ad7616_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad7616.h:172
ad7616_read_data_parallel
int32_t ad7616_read_data_parallel(struct ad7616_dev *dev, uint32_t *buf, uint32_t samples)
Read from device in parallel mode. Enter register mode to read/write registers.
Definition: ad7616.c:753
AD7616_CHA_MASK
#define AD7616_CHA_MASK
Definition: ad7616.h:85
CS_LOW
#define CS_LOW
Definition: spi_engine.h:73
ad7616_self_test
int32_t ad7616_self_test(struct ad7616_dev *dev)
Perform a self test. Channels selection will be left untouched.
Definition: ad7616.c:893
ad7616_par_read
int32_t ad7616_par_read(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Definition: ad7616.c:704
no_os_spi.h
Header file of SPI Interface.
ad7616_init_param::crc
uint8_t crc
Definition: ad7616.h:213
ad7616_setup
int32_t ad7616_setup(struct ad7616_dev **device, struct ad7616_init_param *init_param)
Definition: ad7616.c:941
ad7616_init_param::gpio_busy_param
struct no_os_gpio_init_param * gpio_busy_param
Definition: ad7616.h:222
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
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
clk_axi_clkgen.h
Driver for the Analog Devices AXI CLKGEN.
ad7616_init_param::gpio_reset_param
struct no_os_gpio_init_param * gpio_reset_param
Definition: ad7616.h:217
axi_dmac_transfer_wait_completion
int32_t axi_dmac_transfer_wait_completion(struct axi_dmac *dmac, uint32_t timeout_ms)
Definition: axi_dmac.c:525
no_os_gpio_get_value
int32_t no_os_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: no_os_gpio.c:221
SPI_ENGINE_WORDS_PER_READ
#define SPI_ENGINE_WORDS_PER_READ
Definition: ad7616.c:65
ad7616_setup
int32_t ad7616_setup(struct ad7616_dev **device, struct ad7616_init_param *init_param)
Definition: ad7616.c:941
spi_engine_offload_message::commands_data
uint32_t * commands_data
Definition: spi_engine.h:167
no_os_delay.h
Header file of Delay functions.
ad7616_dev::vb
enum ad7616_range vb[8]
Definition: ad7616.h:195
ad7616_sequencer_layer
Definition: ad7616.h:238
axi_clkgen_init
Definition: clk_axi_clkgen.h:50
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
ad7616_dev
Definition: ad7616.h:170
ad7616_par_write
int32_t ad7616_par_write(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Definition: ad7616.c:730
ad7616_dev::gpio_hw_rngsel0
struct no_os_gpio_desc * gpio_hw_rngsel0
Definition: ad7616.h:181
spi_engine_offload_message
Structure representing an offload message.
Definition: spi_engine.h:158
AD7616_REG_UP_READ_DATA
#define AD7616_REG_UP_READ_DATA
Definition: ad7616.h:57
device
Definition: ad9361_util.h:69
AD7616_SERIAL
@ AD7616_SERIAL
Definition: ad7616.h:120
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
AD7616_VB_SELF_TEST
@ AD7616_VB_SELF_TEST
Definition: ad7616.h:149
AD7616_VA1
@ AD7616_VA1
Definition: ad7616.h:126
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
AD7616_REG_SEQUENCER_STACK
#define AD7616_REG_SEQUENCER_STACK(x)
Definition: ad7616.h:70
AD7616_VA_RESERVED1
@ AD7616_VA_RESERVED1
Definition: ad7616.h:135
axi_clkgen
Definition: clk_axi_clkgen.h:44
AD7616_HW
@ AD7616_HW
Definition: ad7616.h:116
no_os_axi_io.h
Header file of AXI IO.
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
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:124
ad7616_init_param::mode
enum ad7616_mode mode
Definition: ad7616.h:226
AD7616_VA0
@ AD7616_VA0
Definition: ad7616.h:125
ad7616_read
int32_t ad7616_read(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Definition: ad7616.c:323
AD7616_PARALLEL
@ AD7616_PARALLEL
Definition: ad7616.h:121
ad7616_set_mode
int32_t ad7616_set_mode(struct ad7616_dev *dev, enum ad7616_mode mode)
Definition: ad7616.c:552
ad7616_dev::offload_init_param
struct spi_engine_offload_init_param * offload_init_param
Definition: ad7616.h:173
ad7616_set_range
int32_t ad7616_set_range(struct ad7616_dev *dev, enum ad7616_ch ch, enum ad7616_range range)
Definition: ad7616.c:497
NO_OS_SPI_MODE_3
@ NO_OS_SPI_MODE_3
Definition: no_os_spi.h:67
ad7616.h
Header file of AD7616 Driver.
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
ad7616_read_data_serial
int32_t ad7616_read_data_serial(struct ad7616_dev *dev, struct ad7616_conversion_result *results, uint32_t samples)
Read conversion result from device, checking with CRC if enabled.
Definition: ad7616.c:664
AD7616_CRCEN_MASK
#define AD7616_CRCEN_MASK
Definition: ad7616.h:82
ad7616_init_param::reg_access_speed
uint32_t reg_access_speed
Definition: ad7616.h:212
AD7616_OSR_128
@ AD7616_OSR_128
Definition: ad7616.h:167
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
axi_dma_transfer
Definition: axi_dmac.h:102
ad7616_dev::trigger_pwm_desc
struct no_os_pwm_desc * trigger_pwm_desc
Definition: ad7616.h:177
ad7616_init_param::core_baseaddr
uint32_t core_baseaddr
Definition: ad7616.h:224
ad7616_dev::core_baseaddr
uint32_t core_baseaddr
Definition: ad7616.h:190
ad7616_spi_read
int32_t ad7616_spi_read(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Definition: ad7616.c:412
AD7616_VB7
@ AD7616_VB7
Definition: ad7616.h:145
CS_HIGH
#define CS_HIGH
Definition: spi_engine.h:72
ad7616_init_param::gpio_os0_param
struct no_os_gpio_init_param * gpio_os0_param
Definition: ad7616.h:218
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
AD7616_OSR_2
@ AD7616_OSR_2
Definition: ad7616.h:161
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
AD7616_5V
@ AD7616_5V
Definition: ad7616.h:155
AD7616_STATUSEN_MASK
#define AD7616_STATUSEN_MASK
Definition: ad7616.h:80
AD7616_OSR_0
@ AD7616_OSR_0
Definition: ad7616.h:160
ad7616_init_param::gpio_os1_param
struct no_os_gpio_init_param * gpio_os1_param
Definition: ad7616.h:219
AD7616_CRCEN
#define AD7616_CRCEN
Definition: ad7616.h:81
AD7616_VB5
@ AD7616_VB5
Definition: ad7616.h:143
IRQ_DISABLED
@ IRQ_DISABLED
Definition: axi_dmac.h:79
ad7616_init_param::gpio_convst_param
struct no_os_gpio_init_param * gpio_convst_param
Definition: ad7616.h:221
ad7616_init_param::offload_init_param
struct spi_engine_offload_init_param * offload_init_param
Definition: ad7616.h:205
AD7616_INPUT_RANGE
#define AD7616_INPUT_RANGE(ch, x)
Definition: ad7616.h:91
AD7616_VB_VCC
@ AD7616_VB_VCC
Definition: ad7616.h:146
AD7616_VA_ALDO
@ AD7616_VA_ALDO
Definition: ad7616.h:134
AD7616_SEQEN_MASK
#define AD7616_SEQEN_MASK
Definition: ad7616.h:77
ad7616_conversion_result::channel_b
uint16_t channel_b
Definition: ad7616.h:235
ad7616_range
ad7616_range
Definition: ad7616.h:153
ad7616_init_param::trigger_pwm_init
struct no_os_pwm_init_param * trigger_pwm_init
Definition: ad7616.h:207
AD7616_BURSTEN
#define AD7616_BURSTEN(x)
Definition: ad7616.h:74
ad7616_dev::gpio_convst
struct no_os_gpio_desc * gpio_convst
Definition: ad7616.h:187
spi_engine.h
ad7616_init_param
Definition: ad7616.h:202
AD7616_CHANNELS_MASK
#define AD7616_CHANNELS_MASK
Definition: ad7616.h:88
ad7616_dev::clkgen
struct axi_clkgen * clkgen
Definition: ad7616.h:175
AD7616_VB_ALDO
@ AD7616_VB_ALDO
Definition: ad7616.h:147
AD7616_OSR_8
@ AD7616_OSR_8
Definition: ad7616.h:163
AD7616_VA_VCC
@ AD7616_VA_VCC
Definition: ad7616.h:133
ad7616_core_setup
int32_t ad7616_core_setup(struct ad7616_dev *dev)
axi_dmac.h
Driver for the Analog Devices AXI-DMAC core.
AD7616_2V5
@ AD7616_2V5
Definition: ad7616.h:154
ad7616_sequencer_layer::ch_a
enum ad7616_ch ch_a
Definition: ad7616.h:239
ad7616_write_mask
int32_t ad7616_write_mask(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t mask, uint16_t data)
Definition: ad7616.c:383
AD7616_SEQEN
#define AD7616_SEQEN(x)
Definition: ad7616.h:76
ad7616_dev::reg_access_speed
uint32_t reg_access_speed
Definition: ad7616.h:178
AD7616_OSR_4
@ AD7616_OSR_4
Definition: ad7616.h:162
ad7616_read_channel_source
int32_t ad7616_read_channel_source(struct ad7616_dev *dev, enum ad7616_ch *ch_a, enum ad7616_ch *ch_b)
Read the current selected channels.
Definition: ad7616.c:300
ad7616_set_oversampling_ratio
int32_t ad7616_set_oversampling_ratio(struct ad7616_dev *dev, enum ad7616_osr osr)
Definition: ad7616.c:581
AD7616_VB_RESERVED2
@ AD7616_VB_RESERVED2
Definition: ad7616.h:150
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
AD7616_VB_RESERVED1
@ AD7616_VB_RESERVED1
Definition: ad7616.h:148
ad7616_init_param::vb
enum ad7616_range vb[8]
Definition: ad7616.h:228
ad7616_setup_sequencer
int32_t ad7616_setup_sequencer(struct ad7616_dev *dev, struct ad7616_sequencer_layer *layers, uint32_t layers_nb, uint8_t burst)
Setup the sequencer layers.
Definition: ad7616.c:842
no_os_axi_io_read
int32_t no_os_axi_io_read(uint32_t base, uint32_t offset, uint32_t *data)
AXI IO Altera specific read function.
Definition: altera_axi_io.c:53
ad7616_conversion_result
Definition: ad7616.h:233
ad7616_read_channel_source
int32_t ad7616_read_channel_source(struct ad7616_dev *dev, enum ad7616_ch *ch_a, enum ad7616_ch *ch_b)
Read the current selected channels.
Definition: ad7616.c:300
ad7616_dev::interface
enum ad7616_interface interface
Definition: ad7616.h:192
AD7616_SSREN
#define AD7616_SSREN
Definition: ad7616.h:95
ad7616_init_param::osr
enum ad7616_osr osr
Definition: ad7616.h:229
ad7616_read_mask
int32_t ad7616_read_mask(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t mask, uint16_t *data)
Definition: ad7616.c:358
axi_dmac_init::irq_option
enum use_irq irq_option
Definition: axi_dmac.h:130
AD7616_REG_UP_CTRL
#define AD7616_REG_UP_CTRL
Definition: ad7616.h:54
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
AD7616_REG_UP_IF_TYPE
#define AD7616_REG_UP_IF_TYPE
Definition: ad7616.h:53
ad7616_spi_write
int32_t ad7616_spi_write(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Definition: ad7616.c:438
AD7616_VA4
@ AD7616_VA4
Definition: ad7616.h:129
AD7616_CTRL_CNVST_EN
#define AD7616_CTRL_CNVST_EN
Definition: ad7616.h:62
AD7616_VB1
@ AD7616_VB1
Definition: ad7616.h:139
ad7616_read_data_parallel
int32_t ad7616_read_data_parallel(struct ad7616_dev *dev, uint32_t *buf, uint32_t samples)
Read from device in parallel mode. Enter register mode to read/write registers.
Definition: ad7616.c:753
spi_engine_offload_init_param::rx_dma_baseaddr
uint32_t rx_dma_baseaddr
Definition: spi_engine.h:145
AD7616_VA_SELF_TEST
@ AD7616_VA_SELF_TEST
Definition: ad7616.h:136
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:93
ad7616_set_mode
int32_t ad7616_set_mode(struct ad7616_dev *dev, enum ad7616_mode mode)
Definition: ad7616.c:552
ad7616_select_channel_source
int32_t ad7616_select_channel_source(struct ad7616_dev *dev, enum ad7616_ch ch)
Select a new source for a channel.
Definition: ad7616.c:278
ad7616_read_mask
int32_t ad7616_read_mask(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t mask, uint16_t *data)
Definition: ad7616.c:358
ad7616_set_range
int32_t ad7616_set_range(struct ad7616_dev *dev, enum ad7616_ch ch, enum ad7616_range range)
Definition: ad7616.c:497
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
ad7616_reset
int32_t ad7616_reset(struct ad7616_dev *dev)
Definition: ad7616.c:457
ad7616_init_param::dcache_invalidate_range
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad7616.h:230
ad7616_init_param::axi_clkgen_rate
uint32_t axi_clkgen_rate
Definition: ad7616.h:211
ad7616_sequencer_layer::ch_b
enum ad7616_ch ch_b
Definition: ad7616.h:240
ad7616_disable_sequencer
int32_t ad7616_disable_sequencer(struct ad7616_dev *dev)
Definition: ad7616.c:880
ad7616_init_param::va
enum ad7616_range va[8]
Definition: ad7616.h:227
no_os_pwm.h
Header file of PWM Interface.
AD7616_CHB_OFFSET
#define AD7616_CHB_OFFSET
Definition: ad7616.h:87
AD7616_OS
#define AD7616_OS(x)
Definition: ad7616.h:78
AD7616_SW
@ AD7616_SW
Definition: ad7616.h:115
AD7616_TOGGLE_TIMEOUT_DELAY
#define AD7616_TOGGLE_TIMEOUT_DELAY
Definition: ad7616.c:64
ad7616_reset
int32_t ad7616_reset(struct ad7616_dev *dev)
Definition: ad7616.c:457
AD7616_CHANNEL_A_SELF_TEST_VALUE
#define AD7616_CHANNEL_A_SELF_TEST_VALUE
Definition: ad7616.h:105
AD7616_OSR_64
@ AD7616_OSR_64
Definition: ad7616.h:166
NO
@ NO
Definition: axi_dmac.h:98
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
AD7616_VB2
@ AD7616_VB2
Definition: ad7616.h:140
ad7616_par_write
int32_t ad7616_par_write(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Definition: ad7616.c:730
ad7616_dev::gpio_busy
struct no_os_gpio_desc * gpio_busy
Definition: ad7616.h:188
AD7616_VB0
@ AD7616_VB0
Definition: ad7616.h:138
AD7616_REG_INPUT_RANGE_B1
#define AD7616_REG_INPUT_RANGE_B1
Definition: ad7616.h:68
axi_dmac_init
int32_t axi_dmac_init(struct axi_dmac **dmac_core, const struct axi_dmac_init *init)
Definition: axi_dmac.c:334
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
ad7616_write
int32_t ad7616_write(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Definition: ad7616.c:340
AD7616_10V
@ AD7616_10V
Definition: ad7616.h:156
ad7616_dev::crc
uint8_t crc
Definition: ad7616.h:179
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
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
ad7616_select_channel_source
int32_t ad7616_select_channel_source(struct ad7616_dev *dev, enum ad7616_ch ch)
Select a new source for a channel.
Definition: ad7616.c:278
ad7616_init_param::clkgen_init
struct axi_clkgen_init * clkgen_init
Definition: ad7616.h:209
ad7616_init_param::gpio_hw_rngsel1_param
struct no_os_gpio_init_param * gpio_hw_rngsel1_param
Definition: ad7616.h:216
ad7616_dev::osr
enum ad7616_osr osr
Definition: ad7616.h:196
AD7616_VB4
@ AD7616_VB4
Definition: ad7616.h:142
AD7616_CHB_MASK
#define AD7616_CHB_MASK
Definition: ad7616.h:86
AD7616_CTRL_RESETN
#define AD7616_CTRL_RESETN
Definition: ad7616.h:61
AD7616_CHANNEL_B_SELF_TEST_VALUE
#define AD7616_CHANNEL_B_SELF_TEST_VALUE
Definition: ad7616.h:106
ad7616_dev::dcache_invalidate_range
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad7616.h:197
ad7616_read
int32_t ad7616_read(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Definition: ad7616.c:323
AD7616_VA2
@ AD7616_VA2
Definition: ad7616.h:127
AD7616_GET_BIT
#define AD7616_GET_BIT(v, b)
Definition: ad7616.c:63
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
AD7616_OSR_16
@ AD7616_OSR_16
Definition: ad7616.h:164
no_os_axi_io_write
int32_t no_os_axi_io_write(uint32_t base, uint32_t offset, uint32_t data)
AXI IO Altera specific write function.
Definition: altera_axi_io.c:67
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
AD7616_VB3
@ AD7616_VB3
Definition: ad7616.h:141
ad7616_read_data_serial
int32_t ad7616_read_data_serial(struct ad7616_dev *dev, struct ad7616_conversion_result *results, uint32_t samples)
Read conversion result from device, checking with CRC if enabled.
Definition: ad7616.c:664
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.
AD7616_REG_UP_CONV_RATE
#define AD7616_REG_UP_CONV_RATE
Definition: ad7616.h:55
ad7616_dev::layers_nb
uint8_t layers_nb
Definition: ad7616.h:199
no_os_spi_desc::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:198
ad7616_remove
void ad7616_remove(struct ad7616_dev *dev)
Definition: ad7616.c:1063
AD7616_REG_UP_WRITE_DATA
#define AD7616_REG_UP_WRITE_DATA
Definition: ad7616.h:58
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
ad7616_dev::gpio_os0
struct no_os_gpio_desc * gpio_os0
Definition: ad7616.h:184
no_os_get_unaligned_be16
uint16_t no_os_get_unaligned_be16(uint8_t *buf)
AD7616_REG_INPUT_RANGE_A1
#define AD7616_REG_INPUT_RANGE_A1
Definition: ad7616.h:66
axi_dmac_transfer_start
int32_t axi_dmac_transfer_start(struct axi_dmac *dmac, struct axi_dma_transfer *dma_transfer)
Definition: axi_dmac.c:385
ad7616_dev::mode
enum ad7616_mode mode
Definition: ad7616.h:193
AD7616_BURSTEN_MASK
#define AD7616_BURSTEN_MASK
Definition: ad7616.h:75
ad7616_dev::gpio_reset
struct no_os_gpio_desc * gpio_reset
Definition: ad7616.h:183
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.
ad7616_dev::gpio_hw_rngsel1
struct no_os_gpio_desc * gpio_hw_rngsel1
Definition: ad7616.h:182
AD7616_REG_CONFIG
#define AD7616_REG_CONFIG
Definition: ad7616.h:64
no_os_spi_desc::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:202
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
ad7616_ch
ad7616_ch
Definition: ad7616.h:124
AD7616_VA_RESERVED2
@ AD7616_VA_RESERVED2
Definition: ad7616.h:137
axi_dma_transfer::size
uint32_t size
Definition: axi_dmac.h:103
ad7616_init_param::gpio_os2_param
struct no_os_gpio_init_param * gpio_os2_param
Definition: ad7616.h:220
AD7616_VA6
@ AD7616_VA6
Definition: ad7616.h:131
READ
#define READ(no_bytes)
Definition: spi_engine.h:62
ad7616_init_param::spi_param
struct no_os_spi_init_param * spi_param
Definition: ad7616.h:204
ad7616_disable_sequencer
int32_t ad7616_disable_sequencer(struct ad7616_dev *dev)
Definition: ad7616.c:880
axi_dmac
Definition: axi_dmac.h:110
ad7616_par_read
int32_t ad7616_par_read(struct ad7616_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Definition: ad7616.c:704
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
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