no-OS
ad4858.h
Go to the documentation of this file.
1 /***************************************************************************/
37 #ifndef AD4858_H_
38 #define AD4858_H_
39 
40 #include <stdint.h>
41 #include <stdbool.h>
42 #include "no_os_util.h"
43 #include "no_os_spi.h"
44 #include "no_os_gpio.h"
45 #include "no_os_error.h"
46 
47 #define AD4858_R1B (1ul << 16)
48 #define AD4858_R2B (2ul << 16)
49 #define AD4858_R3B (3ul << 16)
50 #define AD4858_R4B (4ul << 16)
51 #define AD4858_LEN(x) ((x) >> 16)
52 #define AD4858_ADDR(x) ((x) & 0xFFFF)
53 
55 #define AD4858_REG_INTERFACE_CONFIG_A (AD4858_R1B | 0x00)
56 #define AD4858_REG_INTERFACE_CONFIG_B (AD4858_R1B | 0x01)
57 #define AD4858_REG_DEVICE_CONFIG (AD4858_R1B | 0x02)
58 #define AD4858_REG_CHIP_TYPE (AD4858_R1B | 0x03)
59 #define AD4858_REG_PRODUCT_ID_L (AD4858_R1B | 0x04)
60 #define AD4858_REG_PRODUCT_ID_H (AD4858_R1B | 0x05)
61 #define AD4858_REG_CHIP_GRADE (AD4858_R1B | 0x06)
62 #define AD4858_REG_SCRATCH_PAD (AD4858_R1B | 0x0A)
63 #define AD4858_REG_SPI_REV (AD4858_R1B | 0x0B)
64 #define AD4858_REG_VENDOR_L (AD4858_R1B | 0x0C)
65 #define AD4858_REG_VENDOR_H (AD4858_R1B | 0x0D)
66 #define AD4858_REG_STREAM_MODE (AD4858_R1B | 0x0E)
67 #define AD4858_REG_TRANSFER_CONFIG (AD4858_R1B | 0x0F)
68 #define AD4858_REG_INTERFACE_CONFIG_C (AD4858_R1B | 0x10)
69 #define AD4858_REG_INTERFACE_STATUS_A (AD4858_R1B | 0x11)
70 #define AD4858_REG_SPI_CONFIG_D (AD4858_R1B | 0x14)
71 #define AD4858_REG_DEVICE_STATUS (AD4858_R1B | 0x20)
72 #define AD4858_REG_CH_OR_STATUS (AD4858_R1B | 0x21)
73 #define AD4858_REG_CH_UR_STATUS (AD4858_R1B | 0x22)
74 #define AD4858_REG_REGMAP_CRC (AD4858_R2B | 0x23)
75 #define AD4858_REG_DEVICE_CTRL (AD4858_R1B | 0x25)
76 #define AD4858_REG_PACKET (AD4858_R1B | 0x26)
77 #define AD4858_REG_OVERSAMPLE (AD4858_R1B | 0x27)
78 #define AD4858_REG_SEAMLESS_HDR (AD4858_R1B | 0x28)
79 #define AD4858_REG_CH_SLEEP (AD4858_R1B | 0x29)
80 #define AD4858_REG_CH_SOFTSPAN(chn) (AD4858_R1B | (0x2A + (0x12 * chn)))
81 #define AD4858_REG_CH_OFFSET(chn) (AD4858_R3B | (0x2B + (0x12 * chn)))
82 #define AD4858_REG_CH_GAIN(chn) (AD4858_R2B | (0x2E + (0x12 * chn)))
83 #define AD4858_REG_CH_PHASE(chn) (AD4858_R2B | (0x30 + (0x12 * chn)))
84 #define AD4858_REG_CH_OR(chn) (AD4858_R3B | (0x32 + (0x12 * chn)))
85 #define AD4858_REG_CH_UR(chn) (AD4858_R3B | (0x35 + (0x12 * chn)))
86 #define AD4858_REG_CH_TESTPAT(chn) (AD4858_R4B | (0x38 + (0x12 * chn)))
87 
89 #define AD4858_SW_RESET_MSK NO_OS_BIT(7) | NO_OS_BIT(0)
90 #define AD4858_SDO_ENABLE_MSK NO_OS_BIT(4)
91 #define AD4858_ADDR_ASCENSION_MSK NO_OS_BIT(5)
92 
94 #define AD4858_SINGLE_INST_MSK NO_OS_BIT(7)
95 
97 #define AD4858_OPERATING_MODES_MSK NO_OS_GENMASK(1,0)
98 #define AD4858_STATUS_BIT0_MSK NO_OS_BIT(4)
99 #define AD4858_STATUS_BIT1_MSK NO_OS_BIT(5)
100 #define AD4858_STATUS_BIT2_MSK NO_OS_BIT(6)
101 #define AD4858_STATUS_BIT3_MSK NO_OS_BIT(7)
102 
104 #define AD4858_KEEP_STRM_LEN_MSK NO_OS_BIT(2)
105 
107 #define AD4858_ACTIVE_INF_MODE_MSK NO_OS_GENMASK(3,2)
108 #define AD4858_CRC_ENABLE_MSK NO_OS_GENMASK(7,6)
109 
111 #define AD4858_ADDR_INVALID_ERR_MSK NO_OS_BIT(0)
112 #define AD4858_WR_TO_RD_ONLY_ERR_MSK NO_OS_BIT(2)
113 #define AD4858_CRC_ERR_MSK NO_OS_BIT(3)
114 #define AD4858_CLK_COUNT_ERR_MSK NO_OS_BIT(4)
115 #define AD4858_NOT_READY_ERR_MSK NO_OS_BIT(7)
116 
118 #define AD4858_CSDO_ON_SDO_MSK NO_OS_BIT(0)
119 
121 #define AD4858_TEST_PATTERN_MSK NO_OS_BIT(2)
122 #define AD4858_PACKET_FORMAT_MSK NO_OS_GENMASK(1,0)
123 
125 #define AD4858_OS_ENABLE_MSK NO_OS_BIT(7)
126 #define AD4858_OS_RATIO_MSK NO_OS_GENMASK(3,0)
127 
129 #define AD4858_SOFTSPAN_MSK NO_OS_GENMASK(3,0)
130 
132 #define AD4858_REG_RD_BIT_MSK NO_OS_BIT(7)
133 #define AD4858_PRODUCT_ID_L 0x60
134 #define AD4858_PRODUCT_ID_H 0x00
135 #define AD4858_NUM_CHANNELS 8
136 #define AD4858_DEF_CHN_SOFTSPAN 0xf
137 #define AD4858_DEF_CHN_OFFSET 0x0
138 #define AD4858_DEF_CHN_GAIN 0x8000
139 #define AD4858_DEF_CHN_PHASE 0x0
140 #define AD4858_DEF_CHN_OR 0x7ffff0
141 #define AD4858_DEF_CHN_UR 0x800000
142 
151 };
152 
160 };
161 
169 };
170 
179 };
180 
189 };
190 
213 };
214 
224 };
225 
248 };
249 
255  /* 20-bit ADC conversion raw data */
257  /* 1-bit OR/UR status */
259  /* 3-bit channel ID */
261  /* 4-bit softspan ID */
263 };
264 
310 };
311 
316 struct ad4858_dev {
359 };
360 
361 /* Initialize the device */
362 int ad4858_init(struct ad4858_dev **device,
363  struct ad4858_init_param *init_param);
364 
365 /* Remove the device */
366 int ad4858_remove(struct ad4858_dev *dev);
367 
368 /* Write device register */
369 int ad4858_reg_write(struct ad4858_dev *dev, uint32_t reg_addr,
370  uint32_t reg_val);
371 
372 /* Read device register */
373 int ad4858_reg_read(struct ad4858_dev *dev, uint32_t reg_addr,
374  uint32_t *reg_val);
375 
376 /* Update specific register bits of an input register */
377 int ad4858_reg_mask(struct ad4858_dev *dev,
378  uint32_t reg_addr,
379  uint32_t mask,
380  uint32_t reg_val);
381 
382 /* Software reset of the device */
383 int ad4858_soft_reset(struct ad4858_dev *dev);
384 
385 /* Set operating mode */
386 int ad4858_set_operating_mode(struct ad4858_dev *dev,
387  enum ad4858_operating_mode mode);
388 
389 /* Set SPI data mode */
390 int ad4858_set_spi_data_mode(struct ad4858_dev *dev,
391  enum ad4858_spi_data_mode mode);
392 
393 /* Set device config interface mode. */
395 
396 /* Set device data interface mode. */
398 
399 /* Enable/Disable OSR */
400 int ad4858_enable_osr(struct ad4858_dev *dev, bool osr_status);
401 
402 /* Set OSR ratio */
403 int ad4858_set_osr_ratio(struct ad4858_dev *dev,
404  enum ad4858_osr_ratio osr_ratio);
405 
406 /* Set packet format */
407 int ad4858_set_packet_format(struct ad4858_dev *dev,
408  enum ad4858_packet_format packet_format);
409 
410 /* Enable/Disable test pattern on ADC data output. */
411 int ad4858_enable_test_pattern(struct ad4858_dev *dev, bool test_pattern);
412 
413 /* Set channel softspan */
414 int ad4858_set_chn_softspan(struct ad4858_dev *dev, uint8_t chn,
415  enum ad4858_chn_softspan chn_softspan);
416 
417 /* Set channel offset */
418 int ad4858_set_chn_offset(struct ad4858_dev *dev, uint8_t chn,
419  uint32_t offset);
420 
421 /* Set channel gain */
422 int ad4858_set_chn_gain(struct ad4858_dev *dev, uint8_t chn, uint16_t gain);
423 
424 /* Set channel phase */
425 int ad4858_set_chn_phase(struct ad4858_dev *dev, uint8_t chn,
426  uint16_t phase);
427 
428 /* Set channel overrange (OR) limit */
429 int ad4858_set_chn_or_limit(struct ad4858_dev *dev, uint8_t chn,
430  uint32_t or_limit);
431 
432 /* Set channel underrange (UR) limit */
433 int ad4858_set_chn_ur_limit(struct ad4858_dev *dev, uint8_t chn,
434  uint32_t ur_limit);
435 
436 /* Toggle the CNV pin to start a conversion. */
437 int ad4858_convst(struct ad4858_dev *dev);
438 
439 /* Perform ADC conversion. */
440 int ad4858_perform_conv(struct ad4858_dev *dev);
441 
442 /* Read ADC conversion data over SPI. */
443 int ad4858_spi_data_read(struct ad4858_dev *dev, struct ad4858_conv_data *data);
444 
445 /* Perform conversion and read ADC data (for all channels). */
446 int ad4858_read_data(struct ad4858_dev *dev, struct ad4858_conv_data *data);
447 
448 /* Enable/Disable channel sleep */
449 int ad4858_enable_ch_sleep(struct ad4858_dev* dev, uint8_t chn,
450  enum ad4858_ch_sleep_value sleep_status);
451 
452 /* Enable/Disable seamless HDR */
453 int ad4858_enable_ch_seamless_hdr(struct ad4858_dev* dev, uint8_t chn,
454  enum ad4858_ch_seamless_hdr seamless_hdr_status);
455 
456 #endif // AD4858_H_
ad4858_init_param::addr_ascension_enable
bool addr_ascension_enable
Definition: ad4858.h:281
AD4858_NUM_OF_SPI_DATA_MODES
@ AD4858_NUM_OF_SPI_DATA_MODES
Definition: ad4858.h:188
no_os_memswap64
void no_os_memswap64(void *buf, uint32_t bytes, uint32_t step)
ad4858_dev::chn_gain
uint16_t chn_gain[AD4858_NUM_CHANNELS]
Definition: ad4858.h:346
timeout
uint32_t timeout
Definition: ad413x.c:55
ad4858_packet_format
ad4858_packet_format
Packet formats.
Definition: ad4858.h:219
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
ad4858_set_chn_ur_limit
int ad4858_set_chn_ur_limit(struct ad4858_dev *dev, uint8_t chn, uint32_t ur_limit)
Set channel underrange (UR) limit.
Definition: ad4858.c:578
ad4858_init_param::chn_softspan
enum ad4858_chn_softspan chn_softspan[AD4858_NUM_CHANNELS]
Definition: ad4858.h:295
ad4858_set_packet_format
int ad4858_set_packet_format(struct ad4858_dev *dev, enum ad4858_packet_format packet_format)
Set packet format.
Definition: ad4858.c:342
AD4858_RANGE_NEG_25_0V_TO_POS_25_0V
@ AD4858_RANGE_NEG_25_0V_TO_POS_25_0V
Definition: ad4858.h:244
ad4858_set_operating_mode
int ad4858_set_operating_mode(struct ad4858_dev *dev, enum ad4858_operating_mode mode)
Set the device operating mode.
Definition: ad4858.c:184
AD4858_SDO_ENABLE_MSK
#define AD4858_SDO_ENABLE_MSK
Definition: ad4858.h:90
ad4858_init_param::chn_phase
uint16_t chn_phase[AD4858_NUM_CHANNELS]
Definition: ad4858.h:301
ad4858_set_config_interface_mode
int ad4858_set_config_interface_mode(struct ad4858_dev *dev)
Set device config interface mode.
Definition: ad4858.c:236
ad4858_ch_seamless_hdr
ad4858_ch_seamless_hdr
Enable/diable seamless high dynamic range.
Definition: ad4858.h:166
ad4858_dev::osr_enable
bool osr_enable
Definition: ad4858.h:334
ad4858_conv_data
ADC conversion data structure.
Definition: ad4858.h:254
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:165
AD4858_OSR_64
@ AD4858_OSR_64
Definition: ad4858.h:201
ad4858_set_data_interface_mode
int ad4858_set_data_interface_mode(struct ad4858_dev *dev)
Set device data interface mode.
Definition: ad4858.c:268
AD4858_DATA_INTERFACE_MODE
@ AD4858_DATA_INTERFACE_MODE
Definition: ad4858.h:177
ad4858_read_data
int ad4858_read_data(struct ad4858_dev *dev, struct ad4858_conv_data *data)
Read ADC data (for all channels).
Definition: ad4858.c:749
ad4858_dev::chn_ur
uint16_t chn_ur[AD4858_NUM_CHANNELS]
Definition: ad4858.h:352
AD4858_OSR_512
@ AD4858_OSR_512
Definition: ad4858.h:204
no_os_spi.h
Header file of SPI Interface.
AD4858_REG_RD_BIT_MSK
#define AD4858_REG_RD_BIT_MSK
Definition: ad4858.h:132
AD4858_SEAMLESS_HDR_ENABLE
@ AD4858_SEAMLESS_HDR_ENABLE
Definition: ad4858.h:168
AD4858_PACKET_24_BIT
@ AD4858_PACKET_24_BIT
Definition: ad4858.h:221
AD4858_REG_INTERFACE_CONFIG_A
#define AD4858_REG_INTERFACE_CONFIG_A
Definition: ad4858.h:55
AD4858_RANGE_0V_TO_20_0V
@ AD4858_RANGE_0V_TO_20_0V
Definition: ad4858.h:241
ad4858_conv_data::raw
uint32_t raw[AD4858_NUM_CHANNELS]
Definition: ad4858.h:256
ad4858_convst
int ad4858_convst(struct ad4858_dev *dev)
Toggle the CNV pin to start a conversion.
Definition: ad4858.c:601
ad4858_enable_ch_sleep
int ad4858_enable_ch_sleep(struct ad4858_dev *dev, uint8_t chn, enum ad4858_ch_sleep_value sleep_status)
Enable/Disable channel sleep.
Definition: ad4858.c:393
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:227
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:94
AD4858_RANGE_NEG_5_0V_TO_POS_5_0V
@ AD4858_RANGE_NEG_5_0V_TO_POS_5_0V
Definition: ad4858.h:234
ad4858_set_chn_ur_limit
int ad4858_set_chn_ur_limit(struct ad4858_dev *dev, uint8_t chn, uint32_t ur_limit)
Set channel underrange (UR) limit.
Definition: ad4858.c:578
AD4858_RANGE_0V_TO_2_5V
@ AD4858_RANGE_0V_TO_2_5V
Definition: ad4858.h:231
no_os_delay.h
Header file of Delay functions.
AD4858_OSR_256
@ AD4858_OSR_256
Definition: ad4858.h:203
AD4858_SLEEP_ENABLE
@ AD4858_SLEEP_ENABLE
Definition: ad4858.h:159
ad4858_conv_data::chn_id
uint8_t chn_id[AD4858_NUM_CHANNELS]
Definition: ad4858.h:260
ad4858_set_chn_or_limit
int ad4858_set_chn_or_limit(struct ad4858_dev *dev, uint8_t chn, uint32_t or_limit)
Set channel overrange (OR) limit.
Definition: ad4858.c:553
AD4858_SINGLE_INST_MSK
#define AD4858_SINGLE_INST_MSK
Definition: ad4858.h:94
AD4858_OSR_1024
@ AD4858_OSR_1024
Definition: ad4858.h:205
AD4858_REG_OVERSAMPLE
#define AD4858_REG_OVERSAMPLE
Definition: ad4858.h:77
AD4858_REG_SEAMLESS_HDR
#define AD4858_REG_SEAMLESS_HDR
Definition: ad4858.h:78
ad4858_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: ad4858.h:271
device
Definition: ad9361_util.h:75
ad4858_set_chn_offset
int ad4858_set_chn_offset(struct ad4858_dev *dev, uint8_t chn, uint32_t offset)
Set channel offset.
Definition: ad4858.c:483
ad4858_dev
AD4858 device descriptor.
Definition: ad4858.h:316
no_os_print_log.h
Print messages helpers.
ad4858_dev::operating_mode
enum ad4858_operating_mode operating_mode
Definition: ad4858.h:330
AD4858_OSR_8192
@ AD4858_OSR_8192
Definition: ad4858.h:208
ad4858_init_param::gpio_cmos_lvds
struct no_os_gpio_init_param * gpio_cmos_lvds
Definition: ad4858.h:275
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:130
ad4858_set_packet_format
int ad4858_set_packet_format(struct ad4858_dev *dev, enum ad4858_packet_format packet_format)
Set packet format.
Definition: ad4858.c:342
ad4858_dev::gpio_busy
struct no_os_gpio_desc * gpio_busy
Definition: ad4858.h:326
AD4858_OSR_16384
@ AD4858_OSR_16384
Definition: ad4858.h:209
ad4858_init_param::chn_seamless_hdr
enum ad4858_ch_seamless_hdr chn_seamless_hdr[AD4858_NUM_CHANNELS]
Definition: ad4858.h:309
ad4858_spi_data_read
int ad4858_spi_data_read(struct ad4858_dev *dev, struct ad4858_conv_data *data)
Read ADC conversion data over SPI.
Definition: ad4858.c:659
AD4858_REG_CH_SOFTSPAN
#define AD4858_REG_CH_SOFTSPAN(chn)
Definition: ad4858.h:80
AD4858_SEAMLESS_HDR_DISABLE
@ AD4858_SEAMLESS_HDR_DISABLE
Definition: ad4858.h:167
ad4858_init_param::gpio_busy
struct no_os_gpio_init_param * gpio_busy
Definition: ad4858.h:279
ad4858_interface_mode
ad4858_interface_mode
Interface modes.
Definition: ad4858.h:175
AD4858_NUM_OF_OP_MODES
@ AD4858_NUM_OF_OP_MODES
Definition: ad4858.h:150
AD4858_OSR_16
@ AD4858_OSR_16
Definition: ad4858.h:199
AD4858_OSR_2048
@ AD4858_OSR_2048
Definition: ad4858.h:206
AD4858_REG_CH_GAIN
#define AD4858_REG_CH_GAIN(chn)
Definition: ad4858.h:82
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:121
AD4858_OSR_2
@ AD4858_OSR_2
Definition: ad4858.h:196
ad4858_remove
int ad4858_remove(struct ad4858_dev *dev)
Remove an AD4858 device (free memory allocated by ad4858_init function).
Definition: ad4858.c:1081
AD4858_DEF_CHN_OR
#define AD4858_DEF_CHN_OR
Definition: ad4858.h:140
AD4858_OS_ENABLE_MSK
#define AD4858_OS_ENABLE_MSK
Definition: ad4858.h:125
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
AD4858_REG_CH_UR
#define AD4858_REG_CH_UR(chn)
Definition: ad4858.h:85
AD4858_ADDR
#define AD4858_ADDR(x)
Definition: ad4858.h:52
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
ad4858_dev::addr_ascension_enable
bool addr_ascension_enable
Definition: ad4858.h:328
AD4858_SOFTSPAN_MSK
#define AD4858_SOFTSPAN_MSK
Definition: ad4858.h:129
ad4858_reg_read
int ad4858_reg_read(struct ad4858_dev *dev, uint32_t reg_addr, uint32_t *reg_val)
Read device register.
Definition: ad4858.c:101
ad4858_dev::chn_offset
uint32_t chn_offset[AD4858_NUM_CHANNELS]
Definition: ad4858.h:344
ad4858_dev::chn_phase
uint16_t chn_phase[AD4858_NUM_CHANNELS]
Definition: ad4858.h:348
AD4858_OSR_32768
@ AD4858_OSR_32768
Definition: ad4858.h:210
AD4858_NUM_OF_INTF_MODES
@ AD4858_NUM_OF_INTF_MODES
Definition: ad4858.h:178
no_os_error.h
Error codes definition.
ad4858_dev::packet_format
enum ad4858_packet_format packet_format
Definition: ad4858.h:338
ad4858_set_config_interface_mode
int ad4858_set_config_interface_mode(struct ad4858_dev *dev)
Set device config interface mode.
Definition: ad4858.c:236
AD4858_REG_SPI_CONFIG_D
#define AD4858_REG_SPI_CONFIG_D
Definition: ad4858.h:70
ad4858_reg_write
int ad4858_reg_write(struct ad4858_dev *dev, uint32_t reg_addr, uint32_t reg_val)
Write device register.
Definition: ad4858.c:53
AD4858_LOW_POWER_OP_MODE
@ AD4858_LOW_POWER_OP_MODE
Definition: ad4858.h:149
ad4858_dev::chn_softspan
enum ad4858_chn_softspan chn_softspan[AD4858_NUM_CHANNELS]
Definition: ad4858.h:342
ad4858_init_param::gpio_cnv
struct no_os_gpio_init_param * gpio_cnv
Definition: ad4858.h:277
ad4858_set_osr_ratio
int ad4858_set_osr_ratio(struct ad4858_dev *dev, enum ad4858_osr_ratio osr_ratio)
Set OSR ratio.
Definition: ad4858.c:316
AD4858_RANGE_0V_TO_25_0V
@ AD4858_RANGE_0V_TO_25_0V
Definition: ad4858.h:243
AD4858_REG_DEVICE_CONFIG
#define AD4858_REG_DEVICE_CONFIG
Definition: ad4858.h:57
AD4858_OSR_65536
@ AD4858_OSR_65536
Definition: ad4858.h:211
AD4858_CONFIG_INTERFACE_MODE
@ AD4858_CONFIG_INTERFACE_MODE
Definition: ad4858.h:176
AD4858_REG_INTERFACE_CONFIG_B
#define AD4858_REG_INTERFACE_CONFIG_B
Definition: ad4858.h:56
ad4858_dev::chn_sleep_value
enum ad4858_ch_sleep_value chn_sleep_value[AD4858_NUM_CHANNELS]
Definition: ad4858.h:356
ad4858_set_spi_data_mode
int ad4858_set_spi_data_mode(struct ad4858_dev *dev, enum ad4858_spi_data_mode mode)
Set the SPI data mode.
Definition: ad4858.c:210
AD4858_RANGE_0V_TO_5_0V
@ AD4858_RANGE_0V_TO_5_0V
Definition: ad4858.h:233
AD4858_RANGE_NEG_2_5V_TO_POS_2_5V
@ AD4858_RANGE_NEG_2_5V_TO_POS_2_5V
Definition: ad4858.h:232
ad4858_dev::osr_ratio
enum ad4858_osr_ratio osr_ratio
Definition: ad4858.h:336
ad4858_conv_data::or_ur_status
bool or_ur_status[AD4858_NUM_CHANNELS]
Definition: ad4858.h:258
ad4858_init_param::chn_or
uint16_t chn_or[AD4858_NUM_CHANNELS]
Definition: ad4858.h:303
ad4858_reg_read
int ad4858_reg_read(struct ad4858_dev *dev, uint32_t reg_addr, uint32_t *reg_val)
Read device register.
Definition: ad4858.c:101
ad4858_reg_mask
int ad4858_reg_mask(struct ad4858_dev *dev, uint32_t reg_addr, uint32_t mask, uint32_t reg_val)
Update specific register bits of an input register.
Definition: ad4858.c:157
AD4858_NUM_OF_SOFTSPAN
@ AD4858_NUM_OF_SOFTSPAN
Definition: ad4858.h:247
AD4858_DEF_CHN_OFFSET
#define AD4858_DEF_CHN_OFFSET
Definition: ad4858.h:137
AD4858_RANGE_0V_TO_12_5V
@ AD4858_RANGE_0V_TO_12_5V
Definition: ad4858.h:239
AD4858_PACKET_32_BIT
@ AD4858_PACKET_32_BIT
Definition: ad4858.h:222
ad4858_set_chn_gain
int ad4858_set_chn_gain(struct ad4858_dev *dev, uint8_t chn, uint16_t gain)
Set channel gain.
Definition: ad4858.c:507
ad4858_set_chn_softspan
int ad4858_set_chn_softspan(struct ad4858_dev *dev, uint8_t chn, enum ad4858_chn_softspan chn_softspan)
Set channel softspan.
Definition: ad4858.c:455
AD4858_RANGE_0V_TO_10_0V
@ AD4858_RANGE_0V_TO_10_0V
Definition: ad4858.h:237
AD4858_DEF_CHN_SOFTSPAN
#define AD4858_DEF_CHN_SOFTSPAN
Definition: ad4858.h:136
ad4858_init_param::osr_enable
bool osr_enable
Definition: ad4858.h:285
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:110
AD4858_NORMAL_OP_MODE
@ AD4858_NORMAL_OP_MODE
Definition: ad4858.h:148
ad4858_set_chn_phase
int ad4858_set_chn_phase(struct ad4858_dev *dev, uint8_t chn, uint16_t phase)
Set channel phase.
Definition: ad4858.c:530
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
no_os_is_big_endian
bool no_os_is_big_endian(void)
AD4858_SW_RESET_MSK
#define AD4858_SW_RESET_MSK
Definition: ad4858.h:89
AD4858_RANGE_NEG_12_5V_TO_POS_12_5V
@ AD4858_RANGE_NEG_12_5V_TO_POS_12_5V
Definition: ad4858.h:240
AD4858_OSR_4
@ AD4858_OSR_4
Definition: ad4858.h:197
AD4858_DEF_CHN_PHASE
#define AD4858_DEF_CHN_PHASE
Definition: ad4858.h:139
ad4858_init_param::osr_ratio
enum ad4858_osr_ratio osr_ratio
Definition: ad4858.h:287
AD4858_RANGE_0V_TO_6_25V
@ AD4858_RANGE_0V_TO_6_25V
Definition: ad4858.h:235
AD4858_SINGLE_INSTRUCTION_MODE
@ AD4858_SINGLE_INSTRUCTION_MODE
Definition: ad4858.h:187
ad4858_set_chn_gain
int ad4858_set_chn_gain(struct ad4858_dev *dev, uint8_t chn, uint16_t gain)
Set channel gain.
Definition: ad4858.c:507
AD4858_OSR_8
@ AD4858_OSR_8
Definition: ad4858.h:198
AD4858_OS_RATIO_MSK
#define AD4858_OS_RATIO_MSK
Definition: ad4858.h:126
AD4858_TEST_PATTERN_MSK
#define AD4858_TEST_PATTERN_MSK
Definition: ad4858.h:121
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
ad4858_init_param::packet_format
enum ad4858_packet_format packet_format
Definition: ad4858.h:289
AD4858_OPERATING_MODES_MSK
#define AD4858_OPERATING_MODES_MSK
Definition: ad4858.h:97
AD4858_RANGE_NEG_6_25V_TO_POS_6_25V
@ AD4858_RANGE_NEG_6_25V_TO_POS_6_25V
Definition: ad4858.h:236
ad4858_init_param::chn_ur
uint16_t chn_ur[AD4858_NUM_CHANNELS]
Definition: ad4858.h:305
ad4858_reg_write
int ad4858_reg_write(struct ad4858_dev *dev, uint32_t reg_addr, uint32_t reg_val)
Write device register.
Definition: ad4858.c:53
ad4858_reg_mask
int ad4858_reg_mask(struct ad4858_dev *dev, uint32_t reg_addr, uint32_t mask, uint32_t reg_val)
Update specific register bits of an input register.
Definition: ad4858.c:157
AD4858_ADDR_ASCENSION_MSK
#define AD4858_ADDR_ASCENSION_MSK
Definition: ad4858.h:91
ad4858_dev::gpio_pd
struct no_os_gpio_desc * gpio_pd
Definition: ad4858.h:320
AD4858_RANGE_NEG_40_0V_TO_POS_40_0V
@ AD4858_RANGE_NEG_40_0V_TO_POS_40_0V
Definition: ad4858.h:246
ad4858_set_chn_offset
int ad4858_set_chn_offset(struct ad4858_dev *dev, uint8_t chn, uint32_t offset)
Set channel offset.
Definition: ad4858.c:483
ad4858_spi_data_read
int ad4858_spi_data_read(struct ad4858_dev *dev, struct ad4858_conv_data *data)
Read ADC conversion data over SPI.
Definition: ad4858.c:659
ad4858_convst
int ad4858_convst(struct ad4858_dev *dev)
Toggle the CNV pin to start a conversion.
Definition: ad4858.c:601
ad4858_init
int ad4858_init(struct ad4858_dev **device, struct ad4858_init_param *init_param)
Initialize an AD4858 device structure.
Definition: ad4858.c:991
AD4858_OSR_32
@ AD4858_OSR_32
Definition: ad4858.h:200
ad4858_init_param::use_default_chn_configs
bool use_default_chn_configs
Definition: ad4858.h:293
ad4858_dev::big_endian
bool big_endian
Definition: ad4858.h:354
ad4858_set_spi_data_mode
int ad4858_set_spi_data_mode(struct ad4858_dev *dev, enum ad4858_spi_data_mode mode)
Set the SPI data mode.
Definition: ad4858.c:210
ad4858_remove
int ad4858_remove(struct ad4858_dev *dev)
Remove an AD4858 device (free memory allocated by ad4858_init function).
Definition: ad4858.c:1081
AD4858_REG_CH_OR
#define AD4858_REG_CH_OR(chn)
Definition: ad4858.h:84
AD4858_DEF_CHN_UR
#define AD4858_DEF_CHN_UR
Definition: ad4858.h:141
ad4858_init_param::test_pattern
bool test_pattern
Definition: ad4858.h:291
AD4858_STREAMING_MODE
@ AD4858_STREAMING_MODE
Definition: ad4858.h:186
ad4858_operating_mode
ad4858_operating_mode
Operating modes.
Definition: ad4858.h:147
ad4858_init_param::operating_mode
enum ad4858_operating_mode operating_mode
Definition: ad4858.h:283
ad4858.h
AD4858_REG_PACKET
#define AD4858_REG_PACKET
Definition: ad4858.h:76
ad4858_init_param::chn_gain
uint16_t chn_gain[AD4858_NUM_CHANNELS]
Definition: ad4858.h:299
ad4858_set_chn_or_limit
int ad4858_set_chn_or_limit(struct ad4858_dev *dev, uint8_t chn, uint32_t or_limit)
Set channel overrange (OR) limit.
Definition: ad4858.c:553
AD4858_PACKET_FORMAT_MSK
#define AD4858_PACKET_FORMAT_MSK
Definition: ad4858.h:122
ad4858_set_osr_ratio
int ad4858_set_osr_ratio(struct ad4858_dev *dev, enum ad4858_osr_ratio osr_ratio)
Set OSR ratio.
Definition: ad4858.c:316
ad4858_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad4858.h:318
ad4858_chn_softspan
ad4858_chn_softspan
Channel softspan.
Definition: ad4858.h:230
AD4858_SLEEP_DISABLE
@ AD4858_SLEEP_DISABLE
Definition: ad4858.h:158
AD4858_REG_CH_SLEEP
#define AD4858_REG_CH_SLEEP
Definition: ad4858.h:79
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:203
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
ad4858_osr_ratio
ad4858_osr_ratio
OSR ratio values.
Definition: ad4858.h:195
ad4858_enable_ch_seamless_hdr
int ad4858_enable_ch_seamless_hdr(struct ad4858_dev *dev, uint8_t chn, enum ad4858_ch_seamless_hdr seamless_hdr_status)
Enable/Disable seamless hdr.
Definition: ad4858.c:424
ad4858_set_chn_phase
int ad4858_set_chn_phase(struct ad4858_dev *dev, uint8_t chn, uint16_t phase)
Set channel phase.
Definition: ad4858.c:530
ad4858_dev::gpio_cmos_lvds
struct no_os_gpio_desc * gpio_cmos_lvds
Definition: ad4858.h:322
AD4858_NUM_OF_OSR_RATIO
@ AD4858_NUM_OF_OSR_RATIO
Definition: ad4858.h:212
ad4858_read_data
int ad4858_read_data(struct ad4858_dev *dev, struct ad4858_conv_data *data)
Read ADC data (for all channels).
Definition: ad4858.c:749
ad4858_ch_sleep_value
ad4858_ch_sleep_value
Enable/diable sleep.
Definition: ad4858.h:157
AD4858_REG_PRODUCT_ID_H
#define AD4858_REG_PRODUCT_ID_H
Definition: ad4858.h:60
AD4858_RANGE_0V_TO_40_0V
@ AD4858_RANGE_0V_TO_40_0V
Definition: ad4858.h:245
AD4858_REG_CH_PHASE
#define AD4858_REG_CH_PHASE(chn)
Definition: ad4858.h:83
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:122
ad4858_perform_conv
int ad4858_perform_conv(struct ad4858_dev *dev)
Perform ADC conversion.
Definition: ad4858.c:624
AD4858_DEF_CHN_GAIN
#define AD4858_DEF_CHN_GAIN
Definition: ad4858.h:138
no_os_gpio.h
Header file of GPIO Interface.
ad4858_dev::gpio_cnv
struct no_os_gpio_desc * gpio_cnv
Definition: ad4858.h:324
ad4858_soft_reset
int ad4858_soft_reset(struct ad4858_dev *dev)
Perform an AD4858 software reset.
Definition: ad4858.c:768
ad4858_dev::spi_data_mode
enum ad4858_spi_data_mode spi_data_mode
Definition: ad4858.h:332
AD4858_LEN
#define AD4858_LEN(x)
Definition: ad4858.h:51
AD4858_OSR_4096
@ AD4858_OSR_4096
Definition: ad4858.h:207
ad4858_init
int ad4858_init(struct ad4858_dev **device, struct ad4858_init_param *init_param)
Initialize an AD4858 device structure.
Definition: ad4858.c:991
ad4858_enable_test_pattern
int ad4858_enable_test_pattern(struct ad4858_dev *dev, bool test_pattern)
Enable/Disable test pattern on ADC data output.
Definition: ad4858.c:368
ad4858_set_data_interface_mode
int ad4858_set_data_interface_mode(struct ad4858_dev *dev)
Set device data interface mode.
Definition: ad4858.c:268
AD4858_OSR_128
@ AD4858_OSR_128
Definition: ad4858.h:202
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:58
ad4858_set_chn_softspan
int ad4858_set_chn_softspan(struct ad4858_dev *dev, uint8_t chn, enum ad4858_chn_softspan chn_softspan)
Set channel softspan.
Definition: ad4858.c:455
ad4858_init_param
AD4858 init parameters structure used for initializing the ad4858_dev.
Definition: ad4858.h:269
ad4858_soft_reset
int ad4858_soft_reset(struct ad4858_dev *dev)
Perform an AD4858 software reset.
Definition: ad4858.c:768
ad4858_spi_data_mode
ad4858_spi_data_mode
SPI data modes.
Definition: ad4858.h:185
AD4858_REG_CH_OFFSET
#define AD4858_REG_CH_OFFSET(chn)
Definition: ad4858.h:81
no_os_util.h
Header file of utility functions.
AD4858_REG_PRODUCT_ID_L
#define AD4858_REG_PRODUCT_ID_L
Definition: ad4858.h:59
AD4858_CSDO_ON_SDO_MSK
#define AD4858_CSDO_ON_SDO_MSK
Definition: ad4858.h:118
ad4858_enable_test_pattern
int ad4858_enable_test_pattern(struct ad4858_dev *dev, bool test_pattern)
Enable/Disable test pattern on ADC data output.
Definition: ad4858.c:368
ad4858_enable_osr
int ad4858_enable_osr(struct ad4858_dev *dev, bool osr_status)
Enable OSR.
Definition: ad4858.c:291
AD4858_PRODUCT_ID_L
#define AD4858_PRODUCT_ID_L
Definition: ad4858.h:133
AD4858_RANGE_NEG_10_0V_TO_POS_10_0V
@ AD4858_RANGE_NEG_10_0V_TO_POS_10_0V
Definition: ad4858.h:238
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:153
ad4858_enable_ch_seamless_hdr
int ad4858_enable_ch_seamless_hdr(struct ad4858_dev *dev, uint8_t chn, enum ad4858_ch_seamless_hdr seamless_hdr_status)
Enable/Disable seamless hdr.
Definition: ad4858.c:424
ad4858_init_param::gpio_pd
struct no_os_gpio_init_param * gpio_pd
Definition: ad4858.h:273
ad4858_conv_data::softspan_id
uint32_t softspan_id[AD4858_NUM_CHANNELS]
Definition: ad4858.h:262
ad4858_perform_conv
int ad4858_perform_conv(struct ad4858_dev *dev)
Perform ADC conversion.
Definition: ad4858.c:624
ad4858_enable_ch_sleep
int ad4858_enable_ch_sleep(struct ad4858_dev *dev, uint8_t chn, enum ad4858_ch_sleep_value sleep_status)
Enable/Disable channel sleep.
Definition: ad4858.c:393
ad4858_enable_osr
int ad4858_enable_osr(struct ad4858_dev *dev, bool osr_status)
Enable OSR.
Definition: ad4858.c:291
AD4858_RANGE_NEG_20_0V_TO_POS_20_0V
@ AD4858_RANGE_NEG_20_0V_TO_POS_20_0V
Definition: ad4858.h:242
ad4858_dev::test_pattern
bool test_pattern
Definition: ad4858.h:340
AD4858_NUM_OF_PACKETS
@ AD4858_NUM_OF_PACKETS
Definition: ad4858.h:223
ad4858_dev::chn_seamless_hdr
enum ad4858_ch_seamless_hdr chn_seamless_hdr[AD4858_NUM_CHANNELS]
Definition: ad4858.h:358
ad4858_dev::chn_or
uint16_t chn_or[AD4858_NUM_CHANNELS]
Definition: ad4858.h:350
ad4858_init_param::chn_offset
uint32_t chn_offset[AD4858_NUM_CHANNELS]
Definition: ad4858.h:297
AD4858_PRODUCT_ID_H
#define AD4858_PRODUCT_ID_H
Definition: ad4858.h:134
AD4858_NUM_CHANNELS
#define AD4858_NUM_CHANNELS
Definition: ad4858.h:135
ad4858_set_operating_mode
int ad4858_set_operating_mode(struct ad4858_dev *dev, enum ad4858_operating_mode mode)
Set the device operating mode.
Definition: ad4858.c:184
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131
ad4858_init_param::chn_sleep_value
enum ad4858_ch_sleep_value chn_sleep_value[AD4858_NUM_CHANNELS]
Definition: ad4858.h:307
AD4858_PACKET_20_BIT
@ AD4858_PACKET_20_BIT
Definition: ad4858.h:220
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:81