41#define AD5460_NOP 0x00
42#define AD5460_CH_FUNC_SETUP(x) (0x01 + (x * 6))
43#define AD5460_OUTPUT_CONFIG(x) (0x02 + (x * 6))
44#define AD5460_DAC_SLEW_CONFIG(x) (0x03 + (x * 6))
45#define AD5460_DAC_CODE(x) (0x04 + (x * 6))
46#define AD5460_DAC_CLR_CODE(x) (0x05 + (x * 6))
47#define AD5460_DAC_ACTIVE(x) (0x06 + (x * 6))
48#define AD5460_GPIO_CONFIG(x) (0x19 + x)
49#define AD5460_WTD_CONFIG 0x1D
50#define AD5460_DIAG_CONFIG 0x1E
51#define AD5460_PWR_CONFIG 0x1F
52#define AD5460_LIVE_STATUS 0x20
53#define AD5460_DIGITAL_ALERT_STATUS 0x21
54#define AD5460_ANALOG_ALERT_STATUS 0x22
55#define AD5460_DIGITAL_ALERT_MSK 0x23
56#define AD5460_ANALOG_ALERT_MSK 0x24
57#define AD5460_READ_SELECT 0x73
58#define AD5460_THERM_RST 0x74
59#define AD5460_CMD_KEY 0x75
60#define AD5460_BROADCAST_CMD_KEY 0x76
61#define AD5460_SCRATCH(x) (0x77 + x)
62#define AD5460_GENERIC_ID 0x7B
63#define AD5460_SILICON_REV 0x7C
64#define AD5460_SILICON_ID0 0x7D
65#define AD5460_SILICON_ID1 0x7E
66#define AD5460_SILICON_ID2 0x7F
69#define AD5460_CMD_KEY_RESET_1 0x9A17
70#define AD5460_CMD_KEY_RESET_2 0xE9C1
73#define AD5460_CH_FUNC_SETUP_MSK NO_OS_GENMASK(3, 0)
76#define AD5460_AVDD_SELECT_MSK NO_OS_GENMASK(13, 12)
77#define AD5460_CLR_EN_MSK NO_OS_BIT(11)
78#define AD5460_WAIT_LDAC_CMD_MSK NO_OS_BIT(10)
79#define AD5460_IOUT_RANGE_MSK NO_OS_GENMASK(9, 8)
80#define AD5460_I_LIMIT_MSK NO_OS_BIT(7)
81#define AD5460_ALARM_DEG_PERIOD_MSK NO_OS_BIT(6)
82#define AD5460_VOUT_RANGE_MSK NO_OS_BIT(5)
83#define AD5460_VIOUT_DRV_EN_DLY_MSK NO_OS_GENMASK(4, 3)
84#define AD5460_VOUT_4W_EN_MSK NO_OS_BIT(2)
85#define AD5460_VIOUT_GLITCH_MSK NO_OS_GENMASK(1, 0)
88#define AD5460_SLEW_EN_MSK NO_OS_GENMASK(5, 4)
89#define AD5460_SLEW_LIN_STEP_MSK NO_OS_GENMASK(3, 2)
90#define AD5460_SLEW_LIN_RATE_MSK NO_OS_GENMASK(1, 0)
93#define AD5460_DAC_CODE_MSK NO_OS_GENMASK(15, 0)
96#define AD5460_DAC_CLR_CODE_MSK NO_OS_GENMASK(15, 0)
99#define AD5460_DAC_ACTIVE_MSK NO_OS_GENMASK(15, 0)
102#define AD5460_GPI_DATA_MSK NO_OS_BIT(5)
103#define AD5460_GPO_DATA_MSK NO_OS_BIT(4)
104#define AD5460_GP_WK_PD_EN_MSK NO_OS_BIT(3)
105#define AD5460_GPIO_SELECT_MSK NO_OS_GENMASK(2, 0)
108#define AD5460_DIAG_SELECT_MSK NO_OS_GENMASK(4, 0)
111#define AD5460_REF_EN_MSK NO_OS_BIT(0)
114#define AD5460_TEMP_ALERT_STATUS_MSK NO_OS_BIT(9)
115#define AD5460_SUPPLY_STATUS_MSK NO_OS_BIT(8)
116#define AD5460_ANALOG_IO_SC_STATUS_D_MSK NO_OS_BIT(7)
117#define AD5460_ANALOG_IO_SC_STATUS_C_MSK NO_OS_BIT(6)
118#define AD5460_ANALOG_IO_SC_STATUS_B_MSK NO_OS_BIT(5)
119#define AD5460_ANALOG_IO_SC_STATUS_A_MSK NO_OS_BIT(4)
120#define AD5460_ANALOG_IO_OC_STATUS_D_MSK NO_OS_BIT(3)
121#define AD5460_ANALOG_IO_OC_STATUS_C_MSK NO_OS_BIT(2)
122#define AD5460_ANALOG_IO_OC_STATUS_B_MSK NO_OS_BIT(1)
123#define AD5460_ANALOG_IO_OC_STATUS_A_MSK NO_OS_BIT(0)
126#define AD5460_TEMP_ALERT_MSK NO_OS_BIT(4)
127#define AD5460_CAL_MEM_ERR_MSK NO_OS_BIT(3)
128#define AD5460_SPI_ERR_MSK NO_OS_BIT(2)
129#define AD5460_WDT_RESET_OCCURRED_MSK NO_OS_BIT(1)
130#define AD5460_RESET_OCCURRED_MSK NO_OS_BIT(0)
133#define AD5460_AVDD_HI_ERR_MSK NO_OS_BIT(12)
134#define AD5460_AVDD_LO_ERR_MSK NO_OS_BIT(11)
135#define AD5460_AVCC_ERR_MSK NO_OS_BIT(10)
136#define AD5460_IODVCC_ERR_MSK NO_OS_BIT(9)
137#define AD5460_AVSS_ERR_MSK NO_OS_BIT(8)
138#define AD5460_ANALOG_IO_SC_D_MSK NO_OS_BIT(7)
139#define AD5460_ANALOG_IO_SC_C_MSK NO_OS_BIT(6)
140#define AD5460_ANALOG_IO_SC_B_MSK NO_OS_BIT(5)
141#define AD5460_ANALOG_IO_SC_A_MSK NO_OS_BIT(4)
142#define AD5460_ANALOG_IO_OC_D_MSK NO_OS_BIT(3)
143#define AD5460_ANALOG_IO_OC_C_MSK NO_OS_BIT(2)
144#define AD5460_ANALOG_IO_OC_B_MSK NO_OS_BIT(1)
145#define AD5460_ANALOG_IO_OC_A_MSK NO_OS_BIT(0)
148#define AD5460_READBACK_SELECT_MODE_MSK NO_OS_GENMASK(8, 0)
149#define AD5460_READBACK_ADDR_MSK NO_OS_GENMASK(8, 0)
152#define AD5460_THERM_RST_MSK NO_OS_GENMASK(8, 0)
155#define AD5460_CMD_KEY_MSK NO_OS_GENMASK(15, 0)
158#define AD5460_BROADCAST_CMD_KEY_MSK NO_OS_GENMASK(15, 0)
161#define AD5460_SCRATCH_BITS_MSK NO_OS_GENMASK(15, 0)
164#define AD5460_GENERIC_ID_MSK NO_OS_GENMASK(2, 0)
167#define AD5460_SILICON_REV_ID_MSK NO_OS_GENMASK(7, 0)
170#define AD5460_LOT_MSK NO_OS_GENMASK(6, 0)
173#define AD5460_Y_COORDS_MSK NO_OS_GENMASK(13, 7)
174#define AD5460_X_COORDS_MSK NO_OS_GENMASK(6, 0)
177#define AD5460_WAFER_NUM_MSK NO_OS_GENMASK(4, 0)
179#define AD5460_FRAME_SIZE 5
180#define AD5460_N_CHANNELS 4
185#define AD5460_DAC_RANGE 12000
186#define AD5460_DAC_CURRENT_RANGE_25MA 25000
187#define AD5460_DAC_CURRENT_RANGE_20MA 20000
188#define AD5460_DAC_CURRENT_RANGE_4MA 4000
189#define AD5460_DAC_RESOLUTION 16
344 uint16_t *, uint32_t);
int ad5460_set_diag(struct ad5460_desc *, uint32_t, enum ad5460_diag_mode)
Set which diagnostic value to be loaded in the DIAG_RESULT register.
Definition ad5460.c:350
ad5460_diag_mode
Possible values to be loaded in the DIAG_RESULT register.
Definition ad5460.h:259
@ AD5460_DIAG_REFOUT
Definition ad5460.h:263
@ AD5460_DIAG_SENSE_AVDD_LO
Definition ad5460.h:281
@ AD5460_DIAG_REFIN
Definition ad5460.h:262
@ AD5460_DIAG_SENSE_N_CH_A
Definition ad5460.h:269
@ AD5460_DIAG_SENSE_P_CH_D
Definition ad5460.h:268
@ AD5460_DIAG_SENSE_AVDD_CH_C
Definition ad5460.h:285
@ AD5460_DIAG_SENSE_P_CH_A
Definition ad5460.h:265
@ AD5460_DIAG_NO_DIAG
Definition ad5460.h:260
@ AD5460_DIAG_INT_BG_V
Definition ad5460.h:264
@ AD5460_DIAG_SENSE_N_CH_B
Definition ad5460.h:270
@ AD5460_DIAG_SENSE_AVSS
Definition ad5460.h:282
@ AD5460_DIAG_SENSE_AVDD_HI
Definition ad5460.h:280
@ AD5460_DIAG_SENSE_LDO
Definition ad5460.h:274
@ AD5460_DIAG_SENSE_N_CH_C
Definition ad5460.h:271
@ AD5460_DIAG_SENSE_AVCC
Definition ad5460.h:273
@ AD5460_DIAG_SENSE_P_CH_C
Definition ad5460.h:267
@ AD5460_DIAG_SENSE_AGND1
Definition ad5460.h:276
@ AD5460_DIAG_SENSE_DVCC
Definition ad5460.h:275
@ AD5460_DIAG_SENSE_AGND2
Definition ad5460.h:277
@ AD5460_DIAG_SENSE_AVDD_CH_D
Definition ad5460.h:286
@ AD5460_DIAG_SENSE_AVDD_CH_A
Definition ad5460.h:283
@ AD5460_DIAG_PTAT
Definition ad5460.h:261
@ AD5460_DIAG_SENSE_DGND
Definition ad5460.h:279
@ AD5460_DIAG_SENSE_AGND3
Definition ad5460.h:278
@ AD5460_DIAG_SENSE_AVDD_CH_B
Definition ad5460.h:284
@ AD5460_DIAG_SENSE_CH_B
Definition ad5460.h:266
@ AD5460_DIAG_SENSE_N_CH_D
Definition ad5460.h:272
int ad5460_set_therm_rst(struct ad5460_desc *, bool)
Enable or disable the higher thermal reset.
Definition ad5460.c:470
int ad5460_reg_update(struct ad5460_desc *, uint32_t, uint16_t, uint16_t)
Update a register's field.
Definition ad5460.c:218
int ad5460_set_gpio_config(struct ad5460_desc *, uint32_t, enum ad5460_gpio_select)
Set the GPIO operation mode.
Definition ad5460.c:363
int ad5460_init(struct ad5460_desc **, struct ad5460_init_param *)
Initialize the device structure.
Definition ad5460.c:541
ad5460_lin_rate
Possible update rates for a DAC when slew control is enabled.
Definition ad5460.h:240
@ AD5460_LIN_RATE_76KHZ8
Definition ad5460.h:242
@ AD5460_LIN_RATE_153KHZ6
Definition ad5460.h:243
@ AD5460_LIN_RATE_230KHZ4
Definition ad5460.h:244
@ AD5460_LIN_RATE_4KHZ8
Definition ad5460.h:241
int ad5460_reset(struct ad5460_desc *)
Perform software or hardware reset and wait for device reset time.
Definition ad5460.c:480
int ad5460_set_channel_iout_range(struct ad5460_desc *, uint32_t, enum ad5460_iout_range)
Set the current range for a specific channel.
Definition ad5460.c:294
ad5460_vout_range
Possible voltage output ranges for the DAC.
Definition ad5460.h:205
@ AD5460_VOUT_RANGE_NEG12_12V
Definition ad5460.h:207
@ AD5460_VOUT_RANGE_0_12V
Definition ad5460.h:206
int ad5460_set_channel_function(struct ad5460_desc *, uint32_t, enum ad5460_op_mode)
Set the operation mode for a specific channel.
Definition ad5460.c:242
#define AD5460_FRAME_SIZE
Definition ad5460.h:179
ad5460_gpio_select
GPO operation modes.
Definition ad5460.h:250
@ AD5460_GPIO_SEL_HIGH_Z
Definition ad5460.h:251
@ AD5460_GPIO_SEL_GPI
Definition ad5460.h:253
@ AD5460_GPIO_SEL_GPIO
Definition ad5460.h:252
int ad5460_reg_read(struct ad5460_desc *, uint32_t, uint16_t *)
Read a register's value.
Definition ad5460.c:192
ad5460_op_mode
Operation modes of the device.
Definition ad5460.h:194
@ AD5460_VOLTAGE_OUT
Definition ad5460.h:196
@ AD5460_CURRENT_OUT_HART
Definition ad5460.h:198
@ AD5460_HIGH_Z
Definition ad5460.h:195
@ AD5460_CURRENT_OUT
Definition ad5460.h:197
ad5460_iout_range
Possible current output ranges for the DAC.
Definition ad5460.h:213
@ AD5460_IOUT_RANGE_4_20MA
Definition ad5460.h:216
@ AD5460_IOUT_RANGE_0_25MA
Definition ad5460.h:214
@ AD5460_IOUT_RANGE_0_20MA
Definition ad5460.h:215
int ad5460_set_channel_vout_range(struct ad5460_desc *, uint32_t, enum ad5460_vout_range)
Set the voltage range for a specific channel.
Definition ad5460.c:272
int ad5460_set_channel_i_limit(struct ad5460_desc *, uint32_t, enum ad5460_i_limit)
Set the current limit for a specific DAC channel in vout mode.
Definition ad5460.c:316
int ad5460_remove(struct ad5460_desc *desc)
Free the device descriptor.
Definition ad5460.c:594
ad5460_i_limit
DAC Current limits in Vout mode.
Definition ad5460.h:222
@ AD5460_I_LIMIT0
Definition ad5460.h:223
@ AD5460_I_LIMIT1
Definition ad5460.h:224
int ad5460_reg_read_raw(struct ad5460_desc *, uint32_t, uint8_t *)
Read a raw communication frame.
Definition ad5460.c:146
int ad5460_reg_write(struct ad5460_desc *, uint32_t, uint16_t)
Write a register's value.
Definition ad5460.c:177
int ad5460_dac_slew_enable(struct ad5460_desc *, uint32_t, enum ad5460_slew_lin_step, enum ad5460_lin_rate)
Configure and enable slew rate control for a DAC on a specific channel.
Definition ad5460.c:430
int ad5460_gpio_set(struct ad5460_desc *, uint32_t, uint8_t)
Set the logic value of a GPO pin.
Definition ad5460.c:377
int ad5460_gpio_get(struct ad5460_desc *, uint32_t, uint8_t *)
Get the GPO value for a specific channel.
Definition ad5460.c:396
int ad5460_dac_current_to_code(struct ad5460_desc *, uint32_t, uint16_t *, uint32_t)
Convers a microamp value in the corresponding DAC 16 bit code.
Definition ad5460.c:90
int ad5460_get_live(struct ad5460_desc *, union ad5460_live_status *)
Read the live status bits.
Definition ad5460.c:416
int ad5460_dac_voltage_to_code(struct ad5460_desc *, int32_t, uint16_t *, uint32_t)
Converts a millivolt value in the corresponding DAC 16 bit code.
Definition ad5460.c:55
#define AD5460_N_CHANNELS
Definition ad5460.h:180
int ad5460_dac_slew_disable(struct ad5460_desc *, uint32_t)
Disable the slew rate control.
Definition ad5460.c:456
ad5460_slew_lin_step
The voltage step size of Full Scale DAC Voltage.
Definition ad5460.h:230
@ AD5460_STEP_6_1_PERCENT
Definition ad5460.h:233
@ AD5460_STEP_0_8_PERCENT
Definition ad5460.h:231
@ AD5460_STEP_1_5_PERCENT
Definition ad5460.h:232
@ AD5460_STEP_22_2_PERCENT
Definition ad5460.h:234
int ad5460_set_channel_dac_code(struct ad5460_desc *, uint32_t, uint16_t)
Set and load a code for the DAC on a specific channel.
Definition ad5460.c:337
Header file of GPIO Interface.
Header file of SPI Interface.
Bitfield struct which maps on the LIVE_STATUS register.
Definition ad5460.h:292
uint8_t ANALOG_IO_OC_STATUS_C
Definition ad5460.h:295
uint8_t ANALOG_IO_SC_STATUS_C
Definition ad5460.h:299
uint8_t ANALOG_IO_OC_STATUS_D
Definition ad5460.h:296
uint8_t SUPPLY_STATUS
Definition ad5460.h:301
uint8_t TEMP_ALERT_STATUS
Definition ad5460.h:302
uint8_t ANALOG_IO_OC_STATUS_B
Definition ad5460.h:294
uint8_t ANALOG_IO_SC_STATUS_B
Definition ad5460.h:298
uint8_t ANALOG_IO_OC_STATUS_A
Definition ad5460.h:293
uint8_t ANALOG_IO_SC_STATUS_A
Definition ad5460.h:297
uint8_t ANALOG_IO_SC_STATUS_D
Definition ad5460.h:300
Device channel state.
Definition ad5460.h:323
enum ad5460_vout_range vout_range
Definition ad5460.h:326
bool enabled
Definition ad5460.h:324
enum ad5460_op_mode function
Definition ad5460.h:325
enum ad5460_i_limit i_limit
Definition ad5460.h:328
enum ad5460_iout_range iout_range
Definition ad5460.h:327
AD5460 device descriptor.
Definition ad5460.h:334
uint8_t comm_buff[AD5460_FRAME_SIZE]
Definition ad5460.h:337
struct no_os_spi_desc * spi_desc
Definition ad5460.h:336
struct ad5460_channel_config channel_configs[AD5460_N_CHANNELS]
Definition ad5460.h:338
uint8_t dev_addr
Definition ad5460.h:335
struct no_os_gpio_desc * reset_gpio
Definition ad5460.h:339
uint8_t dev_addr
Definition ad5460.h:314
struct no_os_spi_init_param spi_ip
Definition ad5460.h:315
struct no_os_gpio_init_param * reset_gpio_param
Definition ad5460.h:316
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
Used to store the live status bit fields.
Definition ad5460.h:308
uint16_t value
Definition ad5460.h:310
struct _ad5460_live_status status_bits
Definition ad5460.h:309