42#define LTC2983_STATUS_REG 0x0000
43#define LTC2983_TEMP_RES_START_REG 0x0010
44#define LTC2983_EEPROM_KEY_REG 0x00B0
45#define LTC2983_EEPROM_READ_STATUS_REG 0x00D0
46#define LTC2983_GLOBAL_CONFIG_REG 0x00F0
47#define LTC2986_EEPROM_STATUS_REG 0x00F9
48#define LTC2983_MUX_CONFIG_REG 0x00FF
49#define LTC2983_CHAN_ASSIGN_START_REG 0x0200
50#define LTC2983_CUST_SENS_TBL_START_REG 0x0250
51#define LTC2983_CUST_SENS_TBL_END_REG 0x03CF
53#define ADT7604_RES_RES_START_REG 0x0060
54#define ADT7604_RES_RES_ADDR(chan) \
55 (((chan) - 1) * 4 + ADT7604_RES_RES_START_REG)
57#define LTC2983_CUST_SENS_TBL_SIZE LTC2983_CUST_SENS_TBL_END_REG - \
58 LTC2983_CUST_SENS_TBL_START_REG + 1
59#define LTC2983_SPI_READ_BYTE 0x3
60#define LTC2983_SPI_WRITE_BYTE 0x2
62#define LTC2983_EEPROM_KEY 0xA53C0F5A
63#define LTC2983_EEPROM_WRITE_CMD 0x15
64#define LTC2983_EEPROM_READ_CMD 0x16
65#define LTC2983_EEPROM_STATUS_FAILURE_MASK NO_OS_GENMASK(3, 1)
66#define LTC2983_EEPROM_READ_FAILURE_MASK NO_OS_GENMASK(7, 0)
68#define LTC2983_EEPROM_WRITE_TIME_MS 2600
69#define LTC2983_EEPROM_READ_TIME_MS 20
71#define LTC2983_CHAN_START_ADDR(chan) \
72 (((chan - 1) * 4) + LTC2983_CHAN_ASSIGN_START_REG)
73#define LTC2983_CHAN_RES_ADDR(chan) \
74 (((chan - 1) * 4) + LTC2983_TEMP_RES_START_REG)
76#define LTC2983_COMMON_HARD_FAULT_MASK NO_OS_GENMASK(31, 30)
77#define LTC2983_COMMON_SOFT_FAULT_MASK NO_OS_GENMASK(27, 25)
79#define LTC2983_STATUS_START_MASK NO_OS_BIT(7)
80#define LTC2983_STATUS_START(x) no_os_field_prep(LTC2983_STATUS_START_MASK, x)
81#define LTC2983_STATUS_UP_MASK NO_OS_GENMASK(7, 6)
82#define LTC2983_STATUS_UP(reg) no_os_field_get(LTC2983_STATUS_UP_MASK, reg)
84#define LTC2983_STATUS_CHAN_SEL_MASK NO_OS_GENMASK(4, 0)
85#define LTC2983_STATUS_CHAN_SEL(x) \
86 no_os_field_prep(LTC2983_STATUS_CHAN_SEL_MASK, x)
88#define LTC2983_NOTCH_FREQ_MASK NO_OS_GENMASK(1, 0)
90#define LTC2983_RES_VALID_MASK NO_OS_BIT(24)
91#define LTC2983_DATA_SIGN_BIT 23
92#define LTC2983_DATA_MASK NO_OS_GENMASK(LTC2983_DATA_SIGN_BIT, 0)
94#define LTC2983_CHAN_TYPE_MASK NO_OS_GENMASK(31, 27)
95#define LTC2983_CHAN_TYPE(x) no_os_field_prep(LTC2983_CHAN_TYPE_MASK, x)
97#define LTC2983_CHAN_ASSIGN_MASK NO_OS_GENMASK(26, 22)
98#define LTC2983_CHAN_ASSIGN(x) no_os_field_prep(LTC2983_CHAN_ASSIGN_MASK, x)
100#define LTC2983_CUSTOM_LEN_MASK NO_OS_GENMASK(5, 0)
101#define LTC2983_CUSTOM_LEN(x) no_os_field_prep(LTC2983_CUSTOM_LEN_MASK, x)
103#define LTC2983_CUSTOM_ADDR_MASK NO_OS_GENMASK(11, 6)
104#define LTC2983_CUSTOM_ADDR(x) no_os_field_prep(LTC2983_CUSTOM_ADDR_MASK, x)
106#define LTC2983_THERMOCOUPLE_CFG_MASK NO_OS_GENMASK(21, 18)
107#define LTC2983_THERMOCOUPLE_CFG(x) \
108 no_os_field_prep(LTC2983_THERMOCOUPLE_CFG_MASK, x)
109#define LTC2983_THERMOCOUPLE_HARD_FAULT_MASK NO_OS_GENMASK(31, 29)
110#define LTC2983_THERMOCOUPLE_SOFT_FAULT_MASK NO_OS_GENMASK(28, 25)
112#define LTC2983_RTD_CFG_MASK NO_OS_GENMASK(21, 18)
113#define LTC2983_RTD_CFG(x) no_os_field_prep(LTC2983_RTD_CFG_MASK, x)
114#define LTC2983_RTD_EXC_CURRENT_MASK NO_OS_GENMASK(17, 14)
115#define LTC2983_RTD_EXC_CURRENT(x) \
116 no_os_field_prep(LTC2983_RTD_EXC_CURRENT_MASK, x)
117#define LTC2983_RTD_CURVE_MASK NO_OS_GENMASK(13, 12)
118#define LTC2983_RTD_CURVE(x) no_os_field_prep(LTC2983_RTD_CURVE_MASK, x)
120#define LTC2983_THERMISTOR_CFG_MASK NO_OS_GENMASK(21, 19)
121#define LTC2983_THERMISTOR_CFG(x) \
122 no_os_field_prep(LTC2983_THERMISTOR_CFG_MASK, x)
123#define LTC2983_THERMISTOR_EXC_CURRENT_MASK NO_OS_GENMASK(18, 15)
124#define LTC2983_THERMISTOR_EXC_CURRENT(x) \
125 no_os_field_prep(LTC2983_THERMISTOR_EXC_CURRENT_MASK, x)
127#define LTC2983_DIODE_CFG_MASK NO_OS_GENMASK(26, 24)
128#define LTC2983_DIODE_CFG(x) no_os_field_prep(LTC2983_DIODE_CFG_MASK, x)
129#define LTC2983_DIODE_EXC_CURRENT_MASK NO_OS_GENMASK(23, 22)
130#define LTC2983_DIODE_EXC_CURRENT(x) \
131 no_os_field_prep(LTC2983_DIODE_EXC_CURRENT_MASK, x)
132#define LTC2983_DIODE_IDEAL_FACTOR_MASK NO_OS_GENMASK(21, 0)
133#define LTC2983_DIODE_IDEAL_FACTOR(x) \
134 no_os_field_prep(LTC2983_DIODE_IDEAL_FACTOR_MASK, x)
136#define LTC2983_R_SENSE_VAL_MASK NO_OS_GENMASK(26, 0)
137#define LTC2983_R_SENSE_VAL(x) no_os_field_prep(LTC2983_R_SENSE_VAL_MASK, x)
139#define LTC2983_ADC_SINGLE_ENDED_MASK NO_OS_BIT(26)
140#define LTC2983_ADC_SINGLE_ENDED(x) \
141 no_os_field_prep(LTC2983_ADC_SINGLE_ENDED_MASK, x)
201#define to_thermocouple(_sensor) \
202 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_thermocouple, sensor)
204#define to_rtd(_sensor) \
205 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_rtd, sensor)
207#define to_thermistor(_sensor) \
208 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_thermistor, sensor)
210#define to_diode(_sensor) \
211 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_diode, sensor)
213#define to_rsense(_sensor) \
214 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_rsense, sensor)
216#define to_adc(_sensor) \
217 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_adc, sensor)
219#define to_temp(_sensor) \
220 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_temp, sensor)
432 uint32_t *, uint32_t *);
int ltc2983_reg_update_bits(struct ltc2983_desc *, uint16_t, uint8_t, uint8_t)
Update register value.
Definition ltc2983.c:205
int ltc2983_common_fault_handler(const uint32_t)
Fault handling of sensors other than thermocouple.
Definition ltc2983.c:794
int ltc2983_setup(struct ltc2983_desc *)
Device setup.
Definition ltc2983.c:225
int ltc2983_chan_read(struct ltc2983_desc *, const int, int *)
Read channel data / temperature.
Definition ltc2983.c:375
int ltc2983_init(struct ltc2983_desc **, struct ltc2983_init_param *)
Device and comm init function.
Definition ltc2983.c:48
int ltc2983_diode_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for diode sensors.
Definition ltc2983.c:686
int ltc2983_chan_read_resistance(struct ltc2983_desc *, const int, uint32_t *)
Read raw resistance from the ADT7604 resistance result bank (0x0060)
Definition ltc2983.c:332
int ltc2983_chan_read_raw(struct ltc2983_desc *, const int, uint32_t *)
Read raw channel data / temperature.
Definition ltc2983.c:405
int ltc2983_reg_write(struct ltc2983_desc *, uint16_t, uint8_t)
Write raw register value.
Definition ltc2983.c:179
int ltc2983_rtd_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for RTD sensors.
Definition ltc2983.c:606
int ltc2983_reg_read(struct ltc2983_desc *, uint16_t, uint8_t *)
Read raw register value.
Definition ltc2983.c:153
int ltc2983_chan_read_scale_resistance(struct ltc2983_desc *, const int, uint32_t *, uint32_t *)
Get resistance scale for copper trace or leak detector channels.
Definition ltc2983.c:482
int ltc2983_r_sense_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for rsense.
Definition ltc2983.c:708
int ltc2983_temp_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Definition ltc2983.c:738
int ltc2983_thermocouple_fault_handler(const uint32_t)
Fault handling of thermocouple sensors.
Definition ltc2983.c:782
int ltc2983_thermocouple_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for thermocouple sensors.
Definition ltc2983.c:579
int ltc2983_chan_read_scale(struct ltc2983_desc *, const int, uint32_t *, uint32_t *)
Set scale of raw channel data / temperature.
Definition ltc2983.c:457
ltc2983_filter_notch_freq
Notch frequency of the digital filter.
Definition ltc2983.h:157
@ LTC2983_50HZ_REJECTION
Definition ltc2983.h:160
@ LTC2983_60HZ_REJECTION
Definition ltc2983.h:159
@ LTC2983_50_60HZ_REJECTION
Definition ltc2983.h:158
int ltc2983_remove(struct ltc2983_desc *)
Remove resources allocated by the init function.
Definition ltc2983.c:127
ltc2983_sensor_type
LTC2983 Sensor Type.
Definition ltc2983.h:166
@ LTC2983_DIRECT_ADC
Definition ltc2983.h:197
@ LTC2983_THERMOCOUPLE_R
Definition ltc2983.h:172
@ LTC2983_ACTIVE_TEMP
Definition ltc2983.h:198
@ LTC2983_THERMOCOUPLE_E
Definition ltc2983.h:170
@ LTC2983_RTD_PT_200
Definition ltc2983.h:180
@ LTC2983_THERMISTOR_44004_44033
Definition ltc2983.h:186
@ LTC2983_RTD_PT_100
Definition ltc2983.h:179
@ LTC2983_THERMOCOUPLE_N
Definition ltc2983.h:171
@ LTC2983_THERMISTOR_CUSTOM
Definition ltc2983.h:194
@ LTC2983_THERMOCOUPLE_CUSTOM
Definition ltc2983.h:176
@ LTC2983_UNASSIGNED
Definition ltc2983.h:167
@ LTC2983_THERMISTOR_44007_44034
Definition ltc2983.h:188
@ LTC2983_RTD_PT_50
Definition ltc2983.h:178
@ LTC2983_THERMISTOR_44006_44031
Definition ltc2983.h:189
@ LTC2983_THERMISTOR_44008_44032
Definition ltc2983.h:190
@ LTC2983_THERMOCOUPLE_T
Definition ltc2983.h:174
@ LTC2983_RTD_PT_10
Definition ltc2983.h:177
@ LTC2983_RTD_NI_120
Definition ltc2983.h:184
@ LTC2983_RTD_PT_500
Definition ltc2983.h:181
@ LTC2983_THERMOCOUPLE_B
Definition ltc2983.h:175
@ LTC2983_THERMISTOR_44005_44030
Definition ltc2983.h:187
@ LTC2983_THERMOCOUPLE_K
Definition ltc2983.h:169
@ LTC2983_THERMISTOR_SPECTRUM_1003K
Definition ltc2983.h:192
@ LTC2983_RTD_CUSTOM
Definition ltc2983.h:185
@ LTC2983_RTD_PT_1000
Definition ltc2983.h:182
@ LTC2983_RTD_1000
Definition ltc2983.h:183
@ LTC2983_THERMISTOR_YSI_400
Definition ltc2983.h:191
@ LTC2983_THERMOCOUPLE_S
Definition ltc2983.h:173
@ LTC2983_THERMISTOR_CUSTOM_STEINHART_HART
Definition ltc2983.h:193
@ LTC2983_THERMOCOUPLE_J
Definition ltc2983.h:168
@ LTC2983_RSENSE
Definition ltc2983.h:196
@ LTC2983_DIODE
Definition ltc2983.h:195
int ltc2983_thermistor_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for thermistor sensors.
Definition ltc2983.c:651
ltc298x_id
Definition ltc2983.h:147
@ ID_ADT7604
Definition ltc2983.h:151
@ ID_LTC2984
Definition ltc2983.h:149
@ ID_LTC2983
Definition ltc2983.h:148
@ ID_LTC2986
Definition ltc2983.h:150
int ltc2983_adc_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for direct ADC.
Definition ltc2983.c:727
Header file of GPIO Interface.
Header file of SPI Interface.
Header file of utility functions.
LTC2983 diode ideal factor value.
Definition ltc2983.h:339
uint32_t ideal_factor_val_dec_1048576
Definition ltc2983.h:343
uint32_t ideal_factor_val_int
Definition ltc2983.h:341
direct ADC descriptor for LTC2983
Definition ltc2983.h:383
bool single_ended
Definition ltc2983.h:387
struct ltc2983_sensor sensor
Definition ltc2983.h:385
custom LTC2983 sensor struct
Definition ltc2983.h:277
size_t len
Definition ltc2983.h:281
bool is_steinhart
Definition ltc2983.h:283
uint32_t * table
Definition ltc2983.h:279
LTC2983 descriptor.
Definition ltc2983.h:243
bool has_copper_trace
Definition ltc2983.h:261
uint8_t max_channels_nr
Definition ltc2983.h:259
struct ltc2983_sensor * sensors[20]
Definition ltc2983.h:255
uint16_t custom_addr_ptr
Definition ltc2983.h:257
struct no_os_spi_desc * comm_desc
Definition ltc2983.h:245
enum ltc2983_filter_notch_freq filter_notch_freq
Definition ltc2983.h:251
struct no_os_gpio_desc * gpio_rstn
Definition ltc2983.h:247
uint32_t mux_delay_config_us
Definition ltc2983.h:249
uint8_t num_channels
Definition ltc2983.h:253
diode sensor descriptor for LTC2983
Definition ltc2983.h:349
uint32_t excitation_current
Definition ltc2983.h:355
uint32_t sensor_config
Definition ltc2983.h:353
struct ltc2983_sensor sensor
Definition ltc2983.h:351
struct ideal_factor_value ideal_factor_val
Definition ltc2983.h:357
LTC2983 init param.
Definition ltc2983.h:225
enum ltc2983_filter_notch_freq filter_notch_freq
Definition ltc2983.h:233
enum ltc298x_id dev_type
Definition ltc2983.h:237
struct no_os_spi_init_param spi_init
Definition ltc2983.h:227
uint32_t mux_delay_config_us
Definition ltc2983.h:231
struct ltc2983_sensor * sensors[20]
Definition ltc2983.h:235
struct no_os_gpio_init_param gpio_rstn
Definition ltc2983.h:229
sense resistor descriptor for LTC2983
Definition ltc2983.h:373
struct r_sense_value r_sense_val
Definition ltc2983.h:377
struct ltc2983_sensor sensor
Definition ltc2983.h:375
RTD sensor descriptor for LTC2983.
Definition ltc2983.h:303
uint32_t r_sense_chan
Definition ltc2983.h:311
struct ltc2983_sensor sensor
Definition ltc2983.h:305
uint32_t sensor_config
Definition ltc2983.h:309
struct ltc2983_custom_sensor * custom
Definition ltc2983.h:307
bool sub_ohm
Definition ltc2983.h:317
uint32_t excitation_current
Definition ltc2983.h:313
uint32_t rtd_curve
Definition ltc2983.h:315
common LTC2983 sensor struct
Definition ltc2983.h:267
uint8_t chan
Definition ltc2983.h:269
uint8_t type
Definition ltc2983.h:271
analog temperature sensor descriptor for LTC2983
Definition ltc2983.h:393
struct ltc2983_custom_sensor * custom
Definition ltc2983.h:397
struct ltc2983_sensor sensor
Definition ltc2983.h:395
bool single_ended
Definition ltc2983.h:399
thermistor sensor descriptor for LTC2983
Definition ltc2983.h:323
struct ltc2983_sensor sensor
Definition ltc2983.h:325
uint32_t sensor_config
Definition ltc2983.h:329
uint32_t excitation_current
Definition ltc2983.h:333
uint32_t r_sense_chan
Definition ltc2983.h:331
struct ltc2983_custom_sensor * custom
Definition ltc2983.h:327
thermocouple sensor descriptor for LTC2983
Definition ltc2983.h:289
struct ltc2983_sensor sensor
Definition ltc2983.h:291
struct ltc2983_custom_sensor * custom
Definition ltc2983.h:293
uint32_t cold_junction_chan
Definition ltc2983.h:297
uint32_t sensor_config
Definition ltc2983.h:295
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
LTC2983 sense resistance value.
Definition ltc2983.h:363
uint32_t r_sense_val_int
Definition ltc2983.h:365
uint32_t r_sense_val_dec_1024
Definition ltc2983.h:367