40#define MAX22007_REV_ID_REG 0x00
41#define MAX22007_STAT_AND_INTR_REG 0x01
42#define MAX22007_INR_ENABLE_REG 0x02
43#define MAX22007_CONFIG_REG 0x03
44#define MAX22007_CTRL_REG 0x04
45#define MAX22007_CHANNEL_MODE_REG 0x05
46#define MAX22007_SOFT_RESET_REG 0x06
47#define MAX22007_CHANNEL_DATA_REG(channel) (0x07 + (channel))
48#define MAX22007_GPIO_CTRL_REG 0x0B
49#define MAX22007_GPIO_DATA_REG 0x0C
50#define MAX22007_GPIO_EDGE_CTRL_REG 0x0D
51#define MAX22007_GPIO_EDGE_DETECTION_STAT_REG 0x0E
54#define MAX22007_REV_ID_MASK NO_OS_GENMASK(7, 0)
55#define MAX22007_PART_ID_MASK NO_OS_GENMASK(15, 8)
58#define MAX22007_CONFIG_LD_CNFG_MASK NO_OS_GENMASK(15, 12)
59#define MAX22007_CONFIG_COMP_EDGE_MASK NO_OS_GENMASK(11, 10)
60#define MAX22007_CONFIG_REF_SEL_MASK NO_OS_BIT(8)
61#define MAX22007_TIMEOUT_SEL_MASK NO_OS_GENMASK(7, 4)
62#define MAX22007_TIMEOUT_CNFG_MASK NO_OS_BIT(3)
63#define MAX22007_TIMEOUT_EN_MASK NO_OS_BIT(2)
64#define MAX22007_OVERCURRENT_CTRL_MASK NO_OS_BIT(1)
65#define MAX22007_CRC_EN_MASK NO_OS_BIT(0)
68#define MAX22007_LD_CTRL_MASK NO_OS_GENMASK(15, 12)
69#define LD_CTRL_CH_MASK(channel) NO_OS_BIT(12 + channel)
72#define MAX22007_CH_MODE_MASK NO_OS_GENMASK(15, 12)
73#define MAX22007_CH_MODE_CH_MASK(channel) NO_OS_BIT(12 + channel)
74#define MAX22007_CH_PWR_MASK NO_OS_GENMASK(11, 8)
75#define MAX22007_CH_PWR_CH_MASK(channel) NO_OS_BIT(8 + channel)
78#define MAX22007_SW_CLR_MASK NO_OS_BIT(12)
79#define MAX22007_SW_RST_MASK NO_OS_BIT(8)
82#define MAX22007_GPIO_CTRL_MASK NO_OS_GENMASK(15, 8)
83#define MAX22007_GPIO_DIR_MASK NO_OS_GENMASK(7, 0)
86#define DAC_CH_DATA_MASK NO_OS_GENMASK(15, 4)
89#define MAX22007_GPO_DATA_MASK NO_OS_GENMASK(15, 8)
90#define MAX22007_GPI_DATA_MASK NO_OS_GENMASK(7, 0)
92#define MAX22007_SPI_READ 0x80
93#define MAX22007_NUM_CHANNELS 4
94#define MAX22007_REV_ID_REV0 0xBB45
95#define MAX22007_REV_ID_REV1 0xBB47
96#define MAX22007_ADRR_MASK NO_OS_GENMASK(7, 1)
97#define MAX22007_RW_MASK NO_OS_BIT(0)
98#define MAX22007_FRAME_SIZE 3
99#define MAX22007_PAYLOAD_LSB_MASK NO_OS_GENMASK(7, 0)
100#define MAX22007_PAYLOAD_MSB_MASK NO_OS_GENMASK(15, 8)
177 uint16_t data, uint16_t mask);
@ INTERNAL_REF
Definition ad7124.h:387
@ EXTERNAL_REF
Definition ad717x.h:69
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
max22007_timeout_sel
Definition max22007.h:112
@ MAX22007_TIMEOUT_1600MS
Definition max22007.h:128
@ MAX22007_TIMEOUT_200MS
Definition max22007.h:114
@ MAX22007_TIMEOUT_600MS
Definition max22007.h:118
@ MAX22007_TIMEOUT_500MS
Definition max22007.h:117
@ MAX22007_TIMEOUT_100MS
Definition max22007.h:113
@ MAX22007_TIMEOUT_1200MS
Definition max22007.h:124
@ MAX22007_TIMEOUT_1400MS
Definition max22007.h:126
@ MAX22007_TIMEOUT_1500MS
Definition max22007.h:127
@ MAX22007_TIMEOUT_400MS
Definition max22007.h:116
@ MAX22007_TIMEOUT_1300MS
Definition max22007.h:125
@ MAX22007_TIMEOUT_800MS
Definition max22007.h:120
@ MAX22007_TIMEOUT_300MS
Definition max22007.h:115
@ MAX22007_TIMEOUT_900MS
Definition max22007.h:121
@ MAX22007_TIMEOUT_1100MS
Definition max22007.h:123
@ MAX22007_TIMEOUT_700MS
Definition max22007.h:119
@ MAX22007_TIMEOUT_1000MS
Definition max22007.h:122
int max22007_set_reference(struct max22007_dev *dev, enum max22007_ref_mode mode)
Set reference source.
Definition max22007.c:215
max22007_channel_mode
Definition max22007.h:136
@ MAX22007_VOLTAGE_MODE
Definition max22007.h:137
@ MAX22007_CURRENT_MODE
Definition max22007.h:138
int max22007_reg_read(struct max22007_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Read from a register.
Definition max22007.c:52
max22007_ref_mode
Definition max22007.h:107
int max22007_write_ldac(struct max22007_dev *dev, uint8_t ch_mask)
Write to LDAC register to update DAC output.
Definition max22007.c:469
#define MAX22007_FRAME_SIZE
Definition max22007.h:98
int max22007_set_latch_mode(struct max22007_dev *dev, uint8_t ch, enum max22007_dac_latch_mode mode)
Set DAC latch mode.
Definition max22007.c:170
int max22007_set_channel_power(struct max22007_dev *dev, uint8_t ch, enum max22007_channel_power mode)
Set channel power.
Definition max22007.c:361
int max22007_init(struct max22007_dev **device, struct max22007_init_param init_param)
MAX22007 descriptor initialization function.
Definition max22007.c:510
int max22007_set_timeout(struct max22007_dev *dev, bool timeout_en, enum max22007_timeout_sel timeout_sel, enum max22007_timeout_cnfg timeout_cnfg)
Set timeout configuration.
Definition max22007.c:261
max22007_dac_latch_mode
Definition max22007.h:102
@ TRANSPARENT_LATCH
Definition max22007.h:104
@ LDAC_CONTROL
Definition max22007.h:103
max22007_channel_power
Definition max22007.h:141
@ MAX22007_CH_POWER_OFF
Definition max22007.h:142
@ MAX22007_CH_POWER_ON
Definition max22007.h:143
int max22007_get_channel_power(struct max22007_dev *dev, uint8_t ch, enum max22007_channel_power *mode)
Get channel power.
Definition max22007.c:382
int max22007_set_channel_mode(struct max22007_dev *dev, uint8_t ch, enum max22007_channel_mode mode)
Set channel mode.
Definition max22007.c:315
int max22007_get_channel_mode(struct max22007_dev *dev, uint8_t ch, enum max22007_channel_mode *mode)
Get channel mode.
Definition max22007.c:336
int max22007_read_channel_data(struct max22007_dev *dev, uint8_t ch, uint16_t *data)
Read data from a DAC channel data register.
Definition max22007.c:454
int max22007_write_channel_data(struct max22007_dev *dev, uint8_t ch, uint16_t data)
Write data to a DAC channel data register.
Definition max22007.c:433
int max22007_remove(struct max22007_dev *dev)
Deallocates all the resources used at initialization.
Definition max22007.c:587
max22007_timeout_cnfg
Definition max22007.h:131
@ TIMEOUT_RESET
Definition max22007.h:133
@ TIMEOUT_EVENT_ONLY
Definition max22007.h:132
#define MAX22007_NUM_CHANNELS
Definition max22007.h:93
int max22007_reg_write(struct max22007_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Write to a register.
Definition max22007.c:107
int max22007_get_reference(struct max22007_dev *dev, enum max22007_ref_mode *mode)
Get reference source.
Definition max22007.c:235
int max22007_get_latch_mode(struct max22007_dev *dev, uint8_t ch, enum max22007_dac_latch_mode *mode)
Get DAC latch mode.
Definition max22007.c:191
int max22007_configure_crc(struct max22007_dev *dev, bool crc_en)
Configure CRC.
Definition max22007.c:406
int max22007_reg_write_msk(struct max22007_dev *dev, uint8_t reg_addr, uint16_t data, uint16_t mask)
Register write with mask.
Definition max22007.c:142
Header file of SPI Interface.
Header file of utility functions.
Definition ad9361_util.h:63
Definition max22007.h:152
enum max22007_channel_power channel_power
Definition max22007.h:155
enum max22007_channel_mode channel_mode
Definition max22007.h:154
enum max22007_dac_latch_mode latch_mode
Definition max22007.h:153
Definition max22007.h:166
bool crc_en
Definition max22007.h:169
struct no_os_spi_desc * comm_desc
Definition max22007.h:167
uint8_t buff[MAX22007_FRAME_SIZE+1]
Definition max22007.h:168
Definition max22007.h:158
bool crc_en
Definition max22007.h:163
struct max22007_channel_config channel_config[MAX22007_NUM_CHANNELS]
Definition max22007.h:160
struct max22007_spi_timeout_config timeout_config
Definition max22007.h:161
struct no_os_spi_init_param * comm_param
Definition max22007.h:159
enum max22007_ref_mode ref_mode
Definition max22007.h:162
Definition max22007.h:146
bool timeout_en
Definition max22007.h:149
enum max22007_timeout_cnfg timeout_cnfg
Definition max22007.h:148
enum max22007_timeout_sel timeout_sel
Definition max22007.h:147
Structure holding SPI descriptor.
Definition no_os_spi.h:180
enum no_os_spi_mode mode
Definition no_os_spi.h:190
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128