43#define NO_OS_BIT(x) (1UL << (x))
50#define NO_OS_GENMASK(h, l) \
51 (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (31 - (h))))
55#define AD5770R_INTERFACE_CONFIG_A 0x00
56#define AD5770R_INTERFACE_CONFIG_B 0x01
57#define AD5770R_CHIP_TYPE 0x03
58#define AD5770R_PRODUCT_ID_L 0x04
59#define AD5770R_PRODUCT_ID_H 0x05
60#define AD5770R_CHIP_GRADE 0x06
61#define AD5770R_SCRATCH_PAD 0x0A
62#define AD5770R_SPI_REVISION 0x0B
63#define AD5770R_VENDOR_L 0x0C
64#define AD5770R_VENDOR_H 0x0D
65#define AD5770R_STREAM_MODE 0x0E
66#define AD5770R_INTERFACE_CONFIG_C 0x10
67#define AD5770R_INTERFACE_STATUS_A 0x11
70#define AD5770R_CHANNEL_CONFIG 0x14
71#define AD5770R_OUTPUT_RANGE_CH0 0x15
72#define AD5770R_OUTPUT_RANGE_CH1 0x16
73#define AD5770R_OUTPUT_RANGE_CH2 0x17
74#define AD5770R_OUTPUT_RANGE_CH3 0x18
75#define AD5770R_OUTPUT_RANGE_CH4 0x19
76#define AD5770R_OUTPUT_RANGE_CH5 0x1A
77#define AD5770R_REFERENCE 0x1B
78#define AD5770R_ALARM_CONFIG 0x1C
79#define AD5770R_OUTPUT_FILTER_CH0 0x1D
80#define AD5770R_OUTPUT_FILTER_CH1 0x1E
81#define AD5770R_OUTPUT_FILTER_CH2 0x1F
82#define AD5770R_OUTPUT_FILTER_CH3 0x20
83#define AD5770R_OUTPUT_FILTER_CH4 0x21
84#define AD5770R_OUTPUT_FILTER_CH5 0x22
85#define AD5770R_MONITOR_SETUP 0x23
86#define AD5770R_STATUS 0x24
87#define AD5770R_HW_LDAC 0x25
88#define AD5770R_CH0_DAC_LSB 0x26
89#define AD5770R_CH0_DAC_MSB 0x27
90#define AD5770R_CH1_DAC_LSB 0x28
91#define AD5770R_CH1_DAC_MSB 0x29
92#define AD5770R_CH2_DAC_LSB 0x2A
93#define AD5770R_CH2_DAC_MSB 0x2B
94#define AD5770R_CH3_DAC_LSB 0x2C
95#define AD5770R_CH3_DAC_MSB 0x2D
96#define AD5770R_CH4_DAC_LSB 0x2E
97#define AD5770R_CH4_DAC_MSB 0x2F
98#define AD5770R_CH5_DAC_LSB 0x30
99#define AD5770R_CH5_DAC_MSB 0x31
100#define AD5770R_DAC_PAGE_MASK_LSB 0x32
101#define AD5770R_DAC_PAGE_MASK_MSB 0x33
102#define AD5770R_CH_SELECT 0x34
103#define AD5770R_INPUT_PAGE_MASK_LSB 0x35
104#define AD5770R_INPUT_PAGE_MASK_MSB 0x36
105#define AD5770R_SW_LDAC 0x37
106#define AD5770R_CH0_INPUT_LSB 0x38
107#define AD5770R_CH0_INPUT_MSB 0x39
108#define AD5770R_CH1_INPUT_LSB 0x3A
109#define AD5770R_CH1_INPUT_MSB 0x3B
110#define AD5770R_CH2_INPUT_LSB 0x3C
111#define AD5770R_CH2_INPUT_MSB 0x3D
112#define AD5770R_CH3_INPUT_LSB 0x3E
113#define AD5770R_CH3_INPUT_MSB 0x3F
114#define AD5770R_CH4_INPUT_LSB 0x40
115#define AD5770R_CH4_INPUT_MSB 0x41
116#define AD5770R_CH5_INPUT_LSB 0x42
117#define AD5770R_CH5_INPUT_MSB 0x43
120#define AD5770R_INTERFACE_CONFIG_A_SW_RESET_MSK NO_OS_BIT(7) | NO_OS_BIT(0)
121#define AD5770R_INTERFACE_CONFIG_A_SW_RESET(x) (((x) & 0x1) | 0x80)
122#define AD5770R_INTERFACE_CONFIG_A_ADDR_ASCENSION_MSB_MSK NO_OS_BIT(5)
123#define AD5770R_INTERFACE_CONFIG_A_ADDR_ASCENSION_MSB(x) (((x) & 0x1) << 5)
124#define AD5770R_INTERFACE_CONFIG_A_SDO_ACTIVE_MSK NO_OS_BIT(4) | NO_OS_BIT(3)
127#define AD5770R_INTERFACE_CONFIG_B_SINGLE_INST_MSK NO_OS_BIT(7)
128#define AD5770R_INTERFACE_CONFIG_B_SINGLE_INST(x) (((x) & 0x1) << 7)
129#define AD5770R_INTERFACE_CONFIG_B_SHORT_INST_MSK NO_OS_BIT(3)
130#define AD5770R_INTERFACE_CONFIG_B_SHORT_INST(x) (((x) & 0x1) << 3)
133#define AD5770R_INTERFACE_CONFIG_C_STRUCT_REGISTER_ACCESS_MSK NO_OS_BIT(5)
134#define AD5770R_INTERFACE_CONFIG_C_STRUCT_REGISTER_ACCESS(x) (((x) & 0x1) << 5)
137#define AD5770R_CHANNEL_CONFIG_CH0_SINK_EN_MSK NO_OS_BIT(7)
138#define AD5770R_CHANNEL_CONFIG_CH0_SINK_EN(x) (((x) & 0x1) << 7)
139#define AD5770R_CHANNEL_CONFIG_CH5_SHUTDOWN_B_MSK NO_OS_BIT(5)
140#define AD5770R_CHANNEL_CONFIG_CH5_SHUTDOWN_B(x) (((x) & 0x1) << 5)
141#define AD5770R_CHANNEL_CONFIG_CH4_SHUTDOWN_B_MSK NO_OS_BIT(4)
142#define AD5770R_CHANNEL_CONFIG_CH4_SHUTDOWN_B(x) (((x) & 0x1) << 4)
143#define AD5770R_CHANNEL_CONFIG_CH3_SHUTDOWN_B_MSK NO_OS_BIT(3)
144#define AD5770R_CHANNEL_CONFIG_CH3_SHUTDOWN_B(x) (((x) & 0x1) << 3)
145#define AD5770R_CHANNEL_CONFIG_CH2_SHUTDOWN_B_MSK NO_OS_BIT(2)
146#define AD5770R_CHANNEL_CONFIG_CH2_SHUTDOWN_B(x) (((x) & 0x1) << 2)
147#define AD5770R_CHANNEL_CONFIG_CH1_SHUTDOWN_B_MSK NO_OS_BIT(1)
148#define AD5770R_CHANNEL_CONFIG_CH1_SHUTDOWN_B(x) (((x) & 0x1) << 1)
149#define AD5770R_CHANNEL_CONFIG_CH0_SHUTDOWN_B_MSK NO_OS_BIT(0)
150#define AD5770R_CHANNEL_CONFIG_CH0_SHUTDOWN_B(x) (((x) & 0x1) << 0)
153#define AD5770R_OUTPUT_RANGE_OUTPUT_SCALING_MSK NO_OS_GENMASK(7, 2)
154#define AD5770R_OUTPUT_RANGE_OUTPUT_SCALING(x) (((x) & 0x3F) << 2)
155#define AD5770R_OUTPUT_RANGE_MODE_MSK NO_OS_GENMASK(1, 0)
156#define AD5770R_OUTPUT_RANGE_MODE(x) ((x) & 0x03)
159#define AD5770R_REFERENCE_RESISTOR_SEL_MSK NO_OS_BIT(2)
160#define AD5770R_REFERENCE_RESISTOR_SEL(x) (((x) & 0x1) << 2)
161#define AD5770R_REFERENCE_VOLTATE_SEL_MSK NO_OS_GENMASK(1, 0)
162#define AD5770R_REFERENCE_VOLTATE_SEL(x) (((x) & 0x3) << 0)
165#define AD5770R_ALARM_CONFIG_BACKGROUND_CRC_ALARM_MASK(x) (((x) & 0x1) << 7)
166#define AD5770R_ALARM_CONFIG_IREF_FAULT_ALARM_MASK(x) (((x) & 0x1) << 6)
167#define AD5770R_ALARM_CONFIG_NEGATIVE_CHANNEL0_ALARM_MASK(x) (((x) & 0x1) << 5)
168#define AD5770R_ALARM_CONFIG_OVER_TEMP_ALARM_MASK(x) (((x) & 0x1) << 4)
169#define AD5770R_ALARM_CONFIG_TEMP_WARNING_ALARM_MASK(x) (((x) & 0x1) << 3)
170#define AD5770R_ALARM_CONFIG_BACKGROUND_CRC_EN(x) (((x) & 0x1) << 2)
171#define AD5770R_ALARM_CONFIG_THERMAL_SHUTDOWN_EN(x) (((x) & 0x1) << 1)
172#define AD5770R_ALARM_CONFIG_OPEN_DRAIN_EN(x) (((x) & 0x1) << 0)
175#define AD5770R_OUTPUT_FILTER_CH_MSK NO_OS_GENMASK(3, 0)
176#define AD5770R_OUTPUT_FILTER_CH(x) (((x) & 0xF) << 0)
179#define AD5770R_MONITOR_SETUP_MON_FUNCTION_MSK NO_OS_GENMASK(7, 6)
180#define AD5770R_MONITOR_SETUP_MON_FUNCTION(x) (((x) & 0x3) << 6)
181#define AD5770R_MONITOR_SETUP_MUX_BUFFER_MSK NO_OS_BIT(5)
182#define AD5770R_MONITOR_SETUP_MUX_BUFFER(x) (((x) & 0x1) << 5)
183#define AD5770R_MONITOR_SETUP_IB_EXT_EN_MSK NO_OS_BIT(4)
184#define AD5770R_MONITOR_SETUP_IB_EXT_EN(x) (((x) & 0x1) << 4)
185#define AD5770R_MONITOR_SETUP_MON_CH_MSK NO_OS_GENMASK(3, 0)
186#define AD5770R_MONITOR_SETUP_MON_CH(x) (((x) & 0x7) << 0)
189#define AD5770R_STATUS_BACKGROUND_CRC_STATUS_MSK NO_OS_BIT(7)
190#define AD5770R_STATUS_IREF_FAULT_MSK NO_OS_BIT(3)
191#define AD5770R_STATUS_NEGATIVE_CHANNEL0_MSK NO_OS_BIT(2)
192#define AD5770R_STATUS_OVER_TEMP_MSK NO_OS_BIT(1)
193#define AD5770R_STATUS_TEMP_WARNING_MSK NO_OS_BIT(0)
196#define AD5770R_HW_LDAC_MASK_CH(x, channel) (((x) & 0x1) << (channel))
199#define AD5770R_CH_DAC_DATA_LSB(x) (((x) & 0x3F) << 2)
200#define AD5770R_CH_DAC_DATA_MSB(x) (((x) & 0xFF) << 0)
203#define AD5770R_CH_SELECT_SEL_CH(x, channel) (((x) & 0x1) << (channel))
206#define AD5770R_CH_DAC_INPUT_DATA_LSB(x) (((x) & 0x3F) << 2)
207#define AD5770R_CH_DAC_INPUT_DATA_MSB(x) (((x) & 0xFF) << 0)
210#define AD5770R_SW_LDAC_CH(x, channel) (((x) & 0x1) << (channel))
213#define AD5770R_REG_READ(x) (((x) & 0x7F) | 0x80)
214#define AD5770R_REG_WRITE(x) ((x) & 0x7F)
363 bool external_reference,
int32_t ad5770r_set_device_spi(struct ad5770r_dev *dev, const struct ad5770r_device_spi_settings *spi_settings)
Definition ad5770r.c:194
int32_t ad5770r_set_alarm(struct ad5770r_dev *dev, const struct ad5770r_alarm_cfg *const alarm_config)
Definition ad5770r.c:321
int32_t ad5770r_set_sw_ldac(struct ad5770r_dev *dev, const struct ad5770r_channel_switches *sw_ldac)
Definition ad5770r.c:532
int32_t ad5770r_get_interface_status(struct ad5770r_dev *dev, uint8_t *status)
Definition ad5770r.c:585
int32_t ad5770r_set_page_mask(struct ad5770r_dev *dev, const struct ad5770r_dac_page_mask *page_mask)
Definition ad5770r.c:468
int32_t ad5770r_set_reference(struct ad5770r_dev *dev, bool external_reference, enum ad5770r_reference_voltage reference_selector)
Definition ad5770r.c:291
int32_t ad5770r_spi_reg_write(struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t reg_data)
Definition ad5770r.c:114
int32_t ad5770r_set_mask_channel(struct ad5770r_dev *dev, const struct ad5770r_channel_switches *mask_channel_sel)
Definition ad5770r.c:501
int32_t ad5770r_spi_reg_write_multiple(struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t *reg_data, uint16_t count)
Definition ad5770r.c:138
int32_t ad5770r_spi_write_mask(struct ad5770r_dev *dev, uint8_t reg_addr, uint32_t mask, uint8_t data)
Definition ad5770r.c:168
int32_t ad5770r_init(struct ad5770r_dev **device, const struct ad5770r_init_param *init_param)
Definition ad5770r.c:658
int32_t ad5770r_channel_config(struct ad5770r_dev *dev, const struct ad5770r_channel_switches *channel_config)
Definition ad5770r.c:236
int32_t ad5770r_set_output_filter(struct ad5770r_dev *dev, enum ad5770r_output_filter_resistor output_filter, enum ad5770r_channels channel)
Definition ad5770r.c:357
ad5770r_monitor_function
Definition ad5770r.h:225
@ AD5770R_DISABLE
Definition ad5770r.h:226
@ AD5770R_VOLTAGE_MONITORING
Definition ad5770r.h:227
@ AD5770R_TEMPERATURE_MONITORING
Definition ad5770r.h:229
@ AD5770R_CURRENT_MONITORING
Definition ad5770r.h:228
int32_t ad5770r_set_monitor_setup(struct ad5770r_dev *dev, const struct ad5770r_monitor_setup *mon_setup)
Definition ad5770r.c:600
ad5770r_output_filter_resistor
Definition ad5770r.h:216
@ AD5770R_OUTPUT_FILTER_RESISTOR_104_KOHM
Definition ad5770r.h:222
@ AD5770R_OUTPUT_FILTER_RESISTOR_11_2_KOHM
Definition ad5770r.h:219
@ AD5770R_OUTPUT_FILTER_RESISTOR_44_4_KOHM
Definition ad5770r.h:221
@ AD5770R_OUTPUT_FILTER_RESISTOR_22_2_KOHM
Definition ad5770r.h:220
@ AD5770R_OUTPUT_FILTER_RESISTOR_5_6_KOHM
Definition ad5770r.h:218
@ AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM
Definition ad5770r.h:217
int32_t ad5770r_set_dac_value(struct ad5770r_dev *dev, uint16_t dac_value, enum ad5770r_channels channel)
Definition ad5770r.c:407
int32_t ad5770r_remove(struct ad5770r_dev *dev)
Definition ad5770r.c:778
ad5770r_channels
Definition ad5770r.h:232
@ AD5770R_CH1
Definition ad5770r.h:234
@ AD5770R_CH4
Definition ad5770r.h:237
@ AD5770R_CH0
Definition ad5770r.h:233
@ AD5770R_CH2
Definition ad5770r.h:235
@ AD5770R_CH5
Definition ad5770r.h:238
@ AD5770R_CH3
Definition ad5770r.h:236
int32_t ad5770r_set_hw_ldac(struct ad5770r_dev *dev, const struct ad5770r_channel_switches *mask_hw_ldac)
Definition ad5770r.c:375
int32_t ad5770r_get_status(struct ad5770r_dev *dev, uint8_t *status)
Definition ad5770r.c:571
int32_t ad5770r_spi_reg_read_multiple(struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t *reg_data, uint16_t count)
Definition ad5770r.c:80
ad5770r_reference_voltage
Definition ad5770r.h:241
@ AD5770R_EXT_REF_1_25_V
Definition ad5770r.h:244
@ AD5770R_INT_REF_1_25_V_OUT_OFF
Definition ad5770r.h:245
@ AD5770R_INT_REF_1_25_V_OUT_ON
Definition ad5770r.h:243
@ AD5770R_EXT_REF_2_5_V
Definition ad5770r.h:242
int32_t ad5770r_set_dac_input(struct ad5770r_dev *dev, uint16_t dac_input, enum ad5770r_channels channel)
Definition ad5770r.c:439
int32_t ad5770r_set_output_mode(struct ad5770r_dev *dev, const struct ad5770r_output_range *output_mode, enum ad5770r_channels channel)
Definition ad5770r.c:270
int32_t ad5770r_spi_reg_read(struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Definition ad5770r.c:48
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
Header file of GPIO Interface.
Header file of SPI Interface.
bool iref_fault_msk
Definition ad5770r.h:282
bool background_crc_msk
Definition ad5770r.h:283
bool neg_ch0_msk
Definition ad5770r.h:281
bool background_crc_en
Definition ad5770r.h:278
bool temp_warning_msk
Definition ad5770r.h:279
bool over_temp_msk
Definition ad5770r.h:280
bool open_drain_en
Definition ad5770r.h:276
bool thermal_shutdown_en
Definition ad5770r.h:277
bool en1
Definition ad5770r.h:272
bool en3
Definition ad5770r.h:272
bool en0
Definition ad5770r.h:272
bool en2
Definition ad5770r.h:272
bool en5
Definition ad5770r.h:272
bool sink0
Definition ad5770r.h:272
bool en4
Definition ad5770r.h:272
uint16_t input_page_mask
Definition ad5770r.h:257
uint16_t dac_data_page_mask
Definition ad5770r.h:256
struct no_os_gpio_desc * gpio_reset_n
Definition ad5770r.h:292
struct no_os_gpio_desc * gpio_alarm_n
Definition ad5770r.h:291
enum ad5770r_output_filter_resistor output_filter[6]
Definition ad5770r.h:302
struct ad5770r_alarm_cfg alarm_config
Definition ad5770r.h:301
uint16_t dac_value[6]
Definition ad5770r.h:305
struct no_os_gpio_desc * gpio_ldac_n
Definition ad5770r.h:293
struct ad5770r_channel_switches mask_hw_ldac
Definition ad5770r.h:304
struct ad5770r_channel_switches channel_config
Definition ad5770r.h:297
struct ad5770r_device_spi_settings dev_spi_settings
Definition ad5770r.h:295
struct no_os_spi_desc * spi_desc
Definition ad5770r.h:288
enum ad5770r_reference_voltage reference_selector
Definition ad5770r.h:300
struct ad5770r_dac_page_mask page_mask
Definition ad5770r.h:306
uint16_t input_value[6]
Definition ad5770r.h:309
struct ad5770r_output_range output_mode[6]
Definition ad5770r.h:298
struct ad5770r_monitor_setup mon_setup
Definition ad5770r.h:303
struct ad5770r_channel_switches sw_ldac
Definition ad5770r.h:308
struct ad5770r_channel_switches mask_channel_sel
Definition ad5770r.h:307
bool external_reference
Definition ad5770r.h:299
bool single_instruction
Definition ad5770r.h:267
bool addr_ascension
Definition ad5770r.h:266
uint8_t stream_mode_length
Definition ad5770r.h:268
struct ad5770r_device_spi_settings dev_spi_settings
Definition ad5770r.h:320
struct no_os_gpio_init_param * gpio_ldac_n
Definition ad5770r.h:318
struct no_os_gpio_init_param * gpio_reset_n
Definition ad5770r.h:317
bool external_reference
Definition ad5770r.h:324
enum ad5770r_reference_voltage reference_selector
Definition ad5770r.h:325
struct ad5770r_channel_switches mask_channel_sel
Definition ad5770r.h:332
struct ad5770r_channel_switches channel_config
Definition ad5770r.h:322
uint16_t dac_value[6]
Definition ad5770r.h:330
struct ad5770r_dac_page_mask page_mask
Definition ad5770r.h:331
struct ad5770r_channel_switches mask_hw_ldac
Definition ad5770r.h:329
struct ad5770r_monitor_setup mon_setup
Definition ad5770r.h:328
struct ad5770r_output_range output_mode[6]
Definition ad5770r.h:323
struct ad5770r_alarm_cfg alarm_config
Definition ad5770r.h:326
enum ad5770r_output_filter_resistor output_filter[6]
Definition ad5770r.h:327
struct no_os_gpio_init_param * gpio_alarm_n
Definition ad5770r.h:316
struct no_os_spi_init_param spi_init
Definition ad5770r.h:314
uint16_t input_value[6]
Definition ad5770r.h:334
struct ad5770r_channel_switches sw_ldac
Definition ad5770r.h:333
enum ad5770r_channels monitor_channel
Definition ad5770r.h:252
bool ib_ext_en
Definition ad5770r.h:251
bool mux_buffer
Definition ad5770r.h:250
enum ad5770r_monitor_function monitor_function
Definition ad5770r.h:249
uint8_t output_scale
Definition ad5770r.h:261
uint8_t output_range_mode
Definition ad5770r.h:262
Definition ad9361_util.h:63
Structure holding the GPIO descriptor.
Definition no_os_gpio.h:84
Structure holding the parameters for GPIO initialization.
Definition no_os_gpio.h:67
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128