Go to the documentation of this file.
52 #define AD738X_REG_NOP 0x00
53 #define AD738X_REG_CONFIG1 0x01
54 #define AD738X_REG_CONFIG2 0x02
55 #define AD738X_REG_ALERT 0x03
56 #define AD738X_REG_ALERT_LOW_TH 0x04
57 #define AD738X_REG_ALERT_HIGH_TH 0x05
62 #define AD738X_CONFIG1_OS_MODE_MSK NO_OS_BIT(9)
63 #define AD738X_CONFIG1_OS_MODE(x) (((x) & 0x1) << 9)
64 #define AD738X_CONFIG1_OSR_MSK NO_OS_GENMASK(8, 6)
65 #define AD738X_CONFIG1_OSR(x) (((x) & 0x7) << 6)
66 #define AD738X_CONFIG1_CRC_W_MSK NO_OS_BIT(5)
67 #define AD738X_CONFIG1_CRC_W(x) (((x) & 0x1) << 5)
68 #define AD738X_CONFIG1_CRC_R_MSK NO_OS_BIT(4)
69 #define AD738X_CONFIG1_CRC_R(x) (((x) & 0x1) << 4)
70 #define AD738X_CONFIG1_ALERTEN_MSK NO_OS_BIT(3)
71 #define AD738X_CONFIG1_ALERTEN(x) (((x) & 0x1) << 3)
72 #define AD738X_CONFIG1_RES_MSK NO_OS_BIT(2)
73 #define AD738X_CONFIG1_RES(x) (((x) & 0x1) << 2)
74 #define AD738X_CONFIG1_REFSEL_MSK NO_OS_BIT(1)
75 #define AD738X_CONFIG1_REFSEL(x) (((x) & 0x1) << 1)
76 #define AD738X_CONFIG1_PMODE_MSK NO_OS_BIT(0)
77 #define AD738X_CONFIG1_PMODE(x) (((x) & 0x1) << 0)
82 #define AD738X_CONFIG2_SDO2_MSK NO_OS_BIT(8)
83 #define AD738X_CONFIG2_SDO2(x) (((x) & 0x1) << 8)
84 #define AD738X_CONFIG2_SDO4_MSK NO_OS_GENMASK(9, 8)
85 #define AD738X_CONFIG2_SDO4(x) (((x) & 0x3) << 8)
86 #define AD738X_CONFIG2_RESET_MSK NO_OS_GENMASK(7, 0)
87 #define AD738X_CONFIG2_RESET(x) (((x) & 0xFF) << 0)
92 #define AD738X_ALERT_LOW_MSK NO_OS_GENMASK(11, 0)
93 #define AD738X_ALERT_LOW(x) (((x) & 0xFFF) << 0)
98 #define AD738X_ALERT_HIGH_MSK NO_OS_GENMASK(11, 0)
99 #define AD738X_ALERT_HIGH(x) (((x) & 0xFFF) << 0)
102 #define AD738X_REG_WRITE(x) ((1 << 7) | ((x & 0x7) << 4))
104 #define AD738X_REG_READ(x) ((x & 0x7) << 4)
106 #define AD738X_FLAG_STANDARD_SPI_DMA NO_OS_BIT(0)
107 #define AD738X_FLAG_OFFLOAD NO_OS_BIT(1)
int32_t ad738x_init(struct ad738x_dev **device, struct ad738x_init_param *init_param)
Definition: ad738x.c:394
Definition: ad77681.h:490
@ OSR_X32
Definition: ad738x.h:127
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:66
enum ad738x_ref_sel ref_sel
Definition: ad738x.h:179
#define AD738X_CONFIG1_OSR(x)
Definition: ad738x.h:65
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:181
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad738x.h:164
#define AD738X_REG_CONFIG2
Definition: ad738x.h:54
struct axi_clkgen * clkgen
Definition: ad738x.h:155
#define AD738X_CONFIG1_PMODE_MSK
Definition: ad738x.h:76
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
#define CS_LOW
Definition: spi_engine.h:73
int32_t ad738x_reset(struct ad738x_dev *dev, enum ad738x_reset_type reset)
Definition: ad738x.c:153
Header file of SPI Interface.
@ FULL_PWDM
Definition: ad738x.h:142
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
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
#define AD738X_CONFIG1_OS_MODE_MSK
Definition: ad738x.h:62
@ NORMAL_OS_MODE
Definition: ad738x.h:117
ad738x_os_mode
Definition: ad738x.h:116
#define AD738X_CONFIG2_RESET(x)
Definition: ad738x.h:87
Driver for the Analog Devices AXI CLKGEN.
int32_t ad738x_reference_sel(struct ad738x_dev *dev, enum ad738x_ref_sel ref_sel)
Definition: ad738x.c:235
#define AD738X_FLAG_OFFLOAD
Definition: ad738x.h:107
uint32_t * commands_data
Definition: spi_engine.h:167
Definition: no_os_spi.h:100
Header file of Delay functions.
ad738x_conv_mode
Definition: ad738x.h:111
Definition: clk_axi_clkgen.h:50
ad738x_reset_type
Definition: ad738x.h:135
int32_t axi_clkgen_set_rate(struct axi_clkgen *clkgen, uint32_t rate)
axi_clkgen_set_rate
Definition: clk_axi_clkgen.c:414
enum ad738x_conv_mode conv_mode
Definition: ad738x.h:159
#define AD738X_CONFIG1_OS_MODE(x)
Definition: ad738x.h:63
#define AD738X_REG_CONFIG1
Definition: ad738x.h:53
int32_t ad738x_reference_sel(struct ad738x_dev *dev, enum ad738x_ref_sel ref_sel)
Definition: ad738x.c:235
Structure representing an offload message.
Definition: spi_engine.h:158
Definition: ad9361_util.h:69
int32_t no_os_spi_transfer_dma_sync(struct no_os_spi_desc *desc, struct no_os_spi_msg *msgs, uint32_t len)
Transfer a list of messages using DMA and busy wait for the completion.
Definition: no_os_spi.c:224
int32_t ad738x_spi_write_mask(struct ad738x_dev *dev, uint8_t reg_addr, uint32_t mask, uint16_t data)
Definition: ad738x.c:110
#define AD738X_CONFIG1_REFSEL_MSK
Definition: ad738x.h:74
int32_t axi_clkgen_init(struct axi_clkgen **clk, const struct axi_clkgen_init *init)
axi_clkgen_init
Definition: clk_axi_clkgen.c:520
int32_t ad738x_spi_reg_read(struct ad738x_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Definition: ad738x.c:57
Definition: clk_axi_clkgen.h:44
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
@ OSR_X16
Definition: ad738x.h:126
uint32_t ref_voltage_mv
Definition: ad738x.h:161
#define AD738X_CONFIG1_PMODE(x)
Definition: ad738x.h:77
@ EXT_REF
Definition: ad738x.h:147
#define WRITE_READ(no_bytes)
Definition: spi_engine.h:65
int32_t ad738x_init(struct ad738x_dev **device, struct ad738x_init_param *init_param)
Definition: ad738x.c:394
uint8_t * tx_buff
Definition: no_os_spi.h:102
@ NORMAL_PWDM
Definition: ad738x.h:141
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
Header file for AD738x Driver.
#define CS_HIGH
Definition: spi_engine.h:72
#define AD738X_CONFIG1_RES_MSK
Definition: ad738x.h:72
int32_t no_os_pwm_enable(struct no_os_pwm_desc *desc)
Enable PWM signal generation.
Definition: no_os_pwm.c:98
@ OSR_X4
Definition: ad738x.h:124
@ SOFT_RESET
Definition: ad738x.h:136
#define AD738X_CONFIG1_OSR_MSK
Definition: ad738x.h:64
@ RES_18_BIT
Definition: ad738x.h:132
#define AD738X_CONFIG2_SDO2(x)
Definition: ad738x.h:83
uint32_t axi_clkgen_rate
Definition: ad738x.h:172
@ HARD_RESET
Definition: ad738x.h:137
struct spi_engine_offload_init_param * offload_init_param
Definition: ad7616.h:205
int32_t ad738x_spi_single_conversion(struct ad738x_dev *dev, uint32_t *adc_data)
Definition: ad738x.c:250
#define AD738X_CONFIG1_REFSEL(x)
Definition: ad738x.h:75
int32_t no_os_pwm_disable(struct no_os_pwm_desc *desc)
Disable PWM signal generation.
Definition: no_os_pwm.c:115
struct spi_engine_offload_init_param * offload_init_param
Definition: ad738x.h:154
int32_t ad738x_spi_reg_write(struct ad738x_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Definition: ad738x.c:90
@ INT_REF
Definition: ad738x.h:146
uint32_t ref_voltage_mv
Definition: ad738x.h:180
@ OSR_X2
Definition: ad738x.h:123
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad738x.h:182
struct no_os_pwm_init_param * pwm_init
Definition: ad738x.h:175
int32_t ad738x_spi_write_mask(struct ad738x_dev *dev, uint8_t reg_addr, uint32_t mask, uint16_t data)
Definition: ad738x.c:110
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:364
int32_t ad738x_spi_single_conversion(struct ad738x_dev *dev, uint32_t *adc_data)
Definition: ad738x.c:250
ad738x_ref_sel
Definition: ad738x.h:145
ad738x_pwd_mode
Definition: ad738x.h:140
int32_t ad738x_remove(struct ad738x_dev *dev)
Free the resources allocated by ad738x_init().
Definition: ad738x.c:457
ad738x_os_ratio
Definition: ad738x.h:121
Structure representing an PWM generator device.
Definition: no_os_pwm.h:93
#define AD738X_CONFIG2_RESET_MSK
Definition: ad738x.h:86
#define AD738X_CONFIG1_RES(x)
Definition: ad738x.h:73
struct no_os_spi_desc * spi_desc
Definition: ad738x.h:152
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
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: ad7616.h:230
uint32_t axi_clkgen_rate
Definition: ad7616.h:211
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
int32_t ad738x_spi_reg_write(struct ad738x_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Definition: ad738x.c:90
Header file of PWM Interface.
struct no_os_pwm_desc * pwm_desc
Definition: ad738x.h:156
@ ONE_WIRE_MODE
Definition: ad738x.h:113
enum ad738x_ref_sel ref_sel
Definition: ad738x.h:160
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
#define AD738X_FLAG_STANDARD_SPI_DMA
Definition: ad738x.h:106
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:364
#define AD738X_REG_WRITE(x)
Definition: ad738x.h:102
#define AD738X_REG_READ(x)
Definition: ad738x.h:104
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:181
int32_t ad738x_remove(struct ad738x_dev *dev)
Free the resources allocated by ad738x_init().
Definition: ad738x.c:457
struct spi_engine_offload_init_param * offload_init_param
Definition: ad738x.h:174
#define AD738X_CONFIG2_SDO2_MSK
Definition: ad738x.h:82
@ RES_16_BIT
Definition: ad738x.h:131
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
struct no_os_spi_init_param * spi_param
Definition: ad738x.h:170
struct axi_clkgen_init * clkgen_init
Definition: ad7616.h:209
int32_t ad738x_set_conversion_mode(struct ad738x_dev *dev, enum ad738x_conv_mode mode)
Definition: ad738x.c:136
int32_t ad738x_spi_reg_read(struct ad738x_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Definition: ad738x.c:57
enum ad738x_conv_mode conv_mode
Definition: ad738x.h:178
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
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
int32_t ad738x_power_down_mode(struct ad738x_dev *dev, enum ad738x_pwd_mode pmode)
Definition: ad738x.c:218
@ OSR_DISABLED
Definition: ad738x.h:122
Structure containing the init parameters needed by the offload module.
Definition: spi_engine.h:143
uint32_t flags
Definition: ad738x.h:165
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
@ OSR_X8
Definition: ad738x.h:125
struct axi_clkgen_init * clkgen_init
Definition: ad738x.h:171
uint32_t flags
Definition: ad738x.h:183
int32_t axi_clkgen_remove(struct axi_clkgen *clkgen)
axi_clkgen_remove
Definition: clk_axi_clkgen.c:541
Header file of utility functions.
@ ROLLING_OS_MODE
Definition: ad738x.h:118
enum ad738x_resolution resolution
Definition: ad738x.h:162
int32_t ad738x_set_conversion_mode(struct ad738x_dev *dev, enum ad738x_conv_mode mode)
Definition: ad738x.c:136
@ TWO_WIRE_MODE
Definition: ad738x.h:112
ad738x_resolution
Definition: ad738x.h:130
struct no_os_spi_init_param * spi_param
Definition: ad7616.h:204
int32_t ad738x_power_down_mode(struct ad738x_dev *dev, enum ad738x_pwd_mode pmode)
Definition: ad738x.c:218
int32_t ad738x_reset(struct ad738x_dev *dev, enum ad738x_reset_type reset)
Definition: ad738x.c:153
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140