45#define AD738X_REG_NOP 0x00
46#define AD738X_REG_CONFIG1 0x01
47#define AD738X_REG_CONFIG2 0x02
48#define AD738X_REG_ALERT 0x03
49#define AD738X_REG_ALERT_LOW_TH 0x04
50#define AD738X_REG_ALERT_HIGH_TH 0x05
55#define AD738X_CONFIG1_OS_MODE_MSK NO_OS_BIT(9)
56#define AD738X_CONFIG1_OS_MODE(x) (((x) & 0x1) << 9)
57#define AD738X_CONFIG1_OSR_MSK NO_OS_GENMASK(8, 6)
58#define AD738X_CONFIG1_OSR(x) (((x) & 0x7) << 6)
59#define AD738X_CONFIG1_CRC_W_MSK NO_OS_BIT(5)
60#define AD738X_CONFIG1_CRC_W(x) (((x) & 0x1) << 5)
61#define AD738X_CONFIG1_CRC_R_MSK NO_OS_BIT(4)
62#define AD738X_CONFIG1_CRC_R(x) (((x) & 0x1) << 4)
63#define AD738X_CONFIG1_ALERTEN_MSK NO_OS_BIT(3)
64#define AD738X_CONFIG1_ALERTEN(x) (((x) & 0x1) << 3)
65#define AD738X_CONFIG1_RES_MSK NO_OS_BIT(2)
66#define AD738X_CONFIG1_RES(x) (((x) & 0x1) << 2)
67#define AD738X_CONFIG1_REFSEL_MSK NO_OS_BIT(1)
68#define AD738X_CONFIG1_REFSEL(x) (((x) & 0x1) << 1)
69#define AD738X_CONFIG1_PMODE_MSK NO_OS_BIT(0)
70#define AD738X_CONFIG1_PMODE(x) (((x) & 0x1) << 0)
75#define AD738X_CONFIG2_SDO2_MSK NO_OS_BIT(8)
76#define AD738X_CONFIG2_SDO2(x) (((x) & 0x1) << 8)
77#define AD738X_CONFIG2_SDO4_MSK NO_OS_GENMASK(9, 8)
78#define AD738X_CONFIG2_SDO4(x) (((x) & 0x3) << 8)
79#define AD738X_CONFIG2_RESET_MSK NO_OS_GENMASK(7, 0)
80#define AD738X_CONFIG2_RESET(x) (((x) & 0xFF) << 0)
85#define AD738X_ALERT_LOW_MSK NO_OS_GENMASK(11, 0)
86#define AD738X_ALERT_LOW(x) (((x) & 0xFFF) << 0)
91#define AD738X_ALERT_HIGH_MSK NO_OS_GENMASK(11, 0)
92#define AD738X_ALERT_HIGH(x) (((x) & 0xFFF) << 0)
95#define AD738X_REG_WRITE(x) ((1 << 7) | ((x & 0x7) << 4))
97#define AD738X_REG_READ(x) ((x & 0x7) << 4)
99#define AD738X_FLAG_STANDARD_SPI_DMA NO_OS_BIT(0)
100#define AD738X_FLAG_OFFLOAD NO_OS_BIT(1)
int32_t ad738x_spi_write_mask(struct ad738x_dev *dev, uint8_t reg_addr, uint32_t mask, uint16_t data)
Definition ad738x.c:104
ad738x_pwd_mode
Definition ad738x.h:130
@ NORMAL_PWDM
Definition ad738x.h:131
@ FULL_PWDM
Definition ad738x.h:132
int32_t ad738x_remove(struct ad738x_dev *dev)
Free the resources allocated by ad738x_init().
Definition ad738x.c:451
int32_t ad738x_power_down_mode(struct ad738x_dev *dev, enum ad738x_pwd_mode pmode)
Definition ad738x.c:212
int32_t ad738x_init(struct ad738x_dev **device, struct ad738x_init_param *init_param)
Definition ad738x.c:388
int32_t ad738x_read_data(struct ad738x_dev *dev, uint32_t *buf, uint16_t samples)
Read from device. Enter register mode to read/write registers.
Definition ad738x.c:358
ad738x_conv_mode
Definition ad738x.h:101
@ TWO_WIRE_MODE
Definition ad738x.h:102
@ ONE_WIRE_MODE
Definition ad738x.h:103
int32_t ad738x_set_conversion_mode(struct ad738x_dev *dev, enum ad738x_conv_mode mode)
Definition ad738x.c:130
ad738x_ref_sel
Definition ad738x.h:135
@ INT_REF
Definition ad738x.h:136
@ EXT_REF
Definition ad738x.h:137
int32_t ad738x_reference_sel(struct ad738x_dev *dev, enum ad738x_ref_sel ref_sel)
Definition ad738x.c:229
ad738x_reset_type
Definition ad738x.h:125
@ HARD_RESET
Definition ad738x.h:127
int32_t ad738x_spi_reg_write(struct ad738x_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Definition ad738x.c:84
ad738x_resolution
Definition ad738x.h:120
@ RES_16_BIT
Definition ad738x.h:121
@ RES_18_BIT
Definition ad738x.h:122
int32_t ad738x_oversampling_config(struct ad738x_dev *dev, enum ad738x_os_mode os_mode, enum ad738x_os_ratio os_ratio, enum ad738x_resolution res)
Definition ad738x.c:175
int32_t ad738x_reset(struct ad738x_dev *dev, enum ad738x_reset_type reset)
Definition ad738x.c:147
int32_t ad738x_spi_single_conversion(struct ad738x_dev *dev, uint32_t *adc_data)
Definition ad738x.c:244
ad738x_os_mode
Definition ad738x.h:106
@ ROLLING_OS_MODE
Definition ad738x.h:108
@ NORMAL_OS_MODE
Definition ad738x.h:107
int32_t ad738x_spi_reg_read(struct ad738x_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Definition ad738x.c:51
ad738x_os_ratio
Definition ad738x.h:111
@ OSR_X32
Definition ad738x.h:117
@ OSR_X16
Definition ad738x.h:116
@ OSR_DISABLED
Definition ad738x.h:112
@ OSR_X4
Definition ad738x.h:114
@ OSR_X8
Definition ad738x.h:115
@ OSR_X2
Definition ad738x.h:113
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
#define SOFT_RESET
Definition ad9361.h:568
Driver for the Analog Devices AXI CLKGEN.
Header file of SPI Interface.
Header file of utility functions.
struct no_os_spi_desc * spi_desc
Definition ad738x.h:142
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition ad738x.h:154
struct spi_engine_offload_init_param * offload_init_param
Definition ad738x.h:144
uint32_t ref_voltage_mv
Definition ad738x.h:151
enum ad738x_resolution resolution
Definition ad738x.h:152
enum ad738x_conv_mode conv_mode
Definition ad738x.h:149
uint32_t flags
Definition ad738x.h:155
struct axi_clkgen * clkgen
Definition ad738x.h:145
struct no_os_pwm_desc * pwm_desc
Definition ad738x.h:146
enum ad738x_ref_sel ref_sel
Definition ad738x.h:150
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition ad738x.h:172
uint32_t flags
Definition ad738x.h:173
struct spi_engine_offload_init_param * offload_init_param
Definition ad738x.h:164
uint32_t ref_voltage_mv
Definition ad738x.h:170
enum ad738x_conv_mode conv_mode
Definition ad738x.h:168
struct axi_clkgen_init * clkgen_init
Definition ad738x.h:161
uint32_t axi_clkgen_rate
Definition ad738x.h:162
struct no_os_pwm_init_param * pwm_init
Definition ad738x.h:165
struct no_os_spi_init_param * spi_param
Definition ad738x.h:160
enum ad738x_ref_sel ref_sel
Definition ad738x.h:169
Definition clk_axi_clkgen.h:44
Definition clk_axi_clkgen.h:38
Definition ad9361_util.h:63
Structure representing an PWM generator device.
Definition no_os_pwm.h:83
Structure containing the init parameters needed by the PWM generator.
Definition no_os_pwm.h:56
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128
Structure containing the init parameters needed by the offload module.
Definition spi_engine.h:131