Go to the documentation of this file.
58 #define ADE9113_SPI_READ NO_OS_BIT(7)
61 #define ADE9113_OP_MODE_LONG NO_OS_BIT(6)
64 #define ADE9113_CRC8_POLY 0x07
65 #define ADE9113_CRC16_POLY 0x1021
66 #define ADE9113_CRC16_INIT_VAL 0xFFFF
73 #define ADE9113_REG_SWRST 0x001
74 #define ADE9113_REG_CONFIG0 0x002
75 #define ADE9113_REG_CONFIG_FILT 0x003
76 #define ADE9113_REG_CONFIG_ISO_ACC 0x005
77 #define ADE9113_REG_CRC_RESULT_HI 0x006
78 #define ADE9113_REG_CRC_RESULT_LO 0x007
79 #define ADE9113_REG_EFUSE_REFRESH 0x008
80 #define ADE9113_REG_EMI_CONFIG 0x009
81 #define ADE9113_REG_EMI_HI_MASK 0x00A
82 #define ADE9113_REG_EMI_LO_MASK 0x00B
83 #define ADE9113_REG_EMI_HI_LIMIT 0x00C
84 #define ADE9113_REG_EMI_MID_LIMIT 0x00D
85 #define ADE9113_REG_EMI_LO_LIMIT 0x00E
86 #define ADE9113_REG_MASK0 0x00F
87 #define ADE9113_REG_MASK1 0x010
88 #define ADE9113_REG_MASK2 0x011
89 #define ADE9113_REG_CONFIG_ZX 0x012
90 #define ADE9113_REG_SCRATCH 0x013
91 #define ADE9113_REG_SYNC_SNAP 0x014
92 #define ADE9113_REG_COUNTER_HI 0x015
93 #define ADE9113_REG_COUNTER_LO 0x016
94 #define ADE9113_REG_SNAPSHOT_COUNT_HI 0x017
95 #define ADE9113_REG_SNAPSHOT_COUNT_LO 0x018
96 #define ADE9113_REG_WR_LOCK 0x01F
97 #define ADE9113_REG_STATUS0 0x020
98 #define ADE9113_REG_STATUS1 0x021
99 #define ADE9113_REG_STATUS2 0x022
100 #define ADE9113_REG_COM_FLT_TYPE 0x023
101 #define ADE9113_REG_COM_FLT_COUNT 0x024
102 #define ADE9113_REG_CONFIG_CRC 0x025
103 #define ADE9113_REG_I_WAV_HI 0x026
104 #define ADE9113_REG_I_WAV_MD 0x027
105 #define ADE9113_REG_I_WAV_LO 0x028
106 #define ADE9113_REG_V1_WAV_HI 0x029
107 #define ADE9113_REG_V1_WAV_MD 0x02A
108 #define ADE9113_REG_V1_WAV_LO 0x02B
109 #define ADE9113_REG_V2_WAV_HI 0x02C
110 #define ADE9113_REG_V2_WAV_MD 0x02D
111 #define ADE9113_REG_V2_WAV_LO 0x02E
112 #define ADE9113_REG_UNIQUE_PART_ID_5 0x075
113 #define ADE9113_REG_UNIQUE_PART_ID_4 0x076
114 #define ADE9113_REG_UNIQUE_PART_ID_3 0x077
115 #define ADE9113_REG_UNIQUE_PART_ID_2 0x078
116 #define ADE9113_REG_UNIQUE_PART_ID_1 0x079
117 #define ADE9113_REG_UNIQUE_PART_ID_0 0x07A
118 #define ADE9113_REG_SILICON_REVISION 0x07D
119 #define ADE9113_REG_VERSION_PRODUCT 0x07E
122 #define ADE9113_SWRST_CMD 0xD6
125 #define ADE9113_STREAM_DBG_MSK NO_OS_GENMASK(3, 2)
126 #define ADE9113_CRC_EN_SPI_WRITE_MSK NO_OS_BIT(1)
127 #define ADE9113_CLOUT_EN_MSK NO_OS_BIT(0)
130 #define ADE9113_V2_ADC_INVERT_MSK NO_OS_BIT(6)
131 #define ADE9113_V1_ADC_INVERT_MSK NO_OS_BIT(5)
132 #define ADE9113_I_ADC_INVERT_MSK NO_OS_BIT(4)
133 #define ADE9113_LPF_BW_MSK NO_OS_BIT(3)
134 #define ADE9113_DATAPATH_CONFIG_MSK NO_OS_GENMASK(2, 0)
137 #define ADE9113_ISO_WR_ACC_EN_MSK NO_OS_BIT(0)
140 #define ADE9113_EFUSE_REFRESH_MSK NO_OS_BIT(0)
143 #define ADE9113_EMI_CONFIG_MSK NO_OS_GENMASK(2, 0)
146 #define ADE9113_STATUS1X_MSK NO_OS_BIT(7)
147 #define ADE9113_STATUS2X_MSK NO_OS_BIT(6)
148 #define ADE9113_COM_UP_MSK NO_OS_BIT(4)
149 #define ADE9113_CRC_CHG_MSK NO_OS_BIT(3)
150 #define ADE9113_SPI_CRC_ERR_MSK NO_OS_BIT(1)
151 #define ADE9113_COMFLT_ERR_MSK NO_OS_BIT(0)
154 #define ADE9113_V2_WAV_OVRNG_MSK NO_OS_BIT(3)
155 #define ADE9113_V1_WAV_OVRNG_MSK NO_OS_BIT(2)
156 #define ADE9113_I_WAV_OVRNG_MSK NO_OS_BIT(1)
157 #define ADE9113_ADC_SYNC_DONE_MSK NO_OS_BIT(0)
160 #define ADE9113_ISO_CLK_STBL_ERR_MSK NO_OS_BIT(6)
161 #define ADE9113_ISO_PHY_CRC_ERR_MSK NO_OS_BIT(5)
162 #define ADE9113_ISO_EFUSE_MEM_ERR_MSK NO_OS_BIT(4)
163 #define ADE9113_ISO_DIG_MOD_V2_OVF_MSK NO_OS_BIT(3)
164 #define ADE9113_ISO_DIG_MOD_V1_OVF_MSK NO_OS_BIT(2)
165 #define ADE9113_ISO_DIG_MOD_I_OVF_MSK NO_OS_BIT(1)
166 #define ADE9113_ISO_TEST_MMR_ERR_MSK NO_OS_BIT(0)
169 #define ADE9113_ZX_EDGE_SEL_MSK NO_OS_GENMASK(3, 2)
170 #define ADE9113_ZX_CHANNEL_CONFIG_MSK NO_OS_GENMASK(1, 0)
173 #define ADE9113_PREP_BROADCAST_MSK NO_OS_BIT(2)
174 #define ADE9113_ALIGN_MSK NO_OS_BIT(1)
175 #define ADE9113_SNAPSHOT_MSK NO_OS_BIT(0)
178 #define ADE9113_COUNTER_HI_MSK NO_OS_GENMASK(5, 0)
181 #define ADE9113_COUNTER_LO_MSK NO_OS_GENMASK(8, 0)
184 #define ADE9113_SNAPSHOT_COUNT_HI_MSK NO_OS_GENMASK(5, 0)
187 #define ADE9113_SNAPSHOT_COUNT_LO_MSK NO_OS_GENMASK(7, 0)
190 #define ADE9113_RESET_DONE_MSK NO_OS_BIT(5)
191 #define ADE9113_EFUSE_MEM_ERR_MSK NO_OS_BIT(2)
194 #define ADE9113_ISO_STATUS_RD_ECC_ERR_MSK NO_OS_BIT(2)
195 #define ADE9113_ISO_PHY_ERR_MSK NO_OS_BIT(1)
196 #define ADE9113_ISO_ECC_ERR_MSK NO_OS_BIT(1)
199 #define ADE9113_CRC_DONE_MSK NO_OS_BIT(1)
200 #define ADE9113_CRC_FORCE_MSK NO_OS_BIT(0)
203 #define ADE9113_NONISO_CHIP_REV_MSK NO_OS_GENMASK(7, 4)
204 #define ADE9113_ISO_CHIP_REV_MSK NO_OS_GENMASK(3, 0)
207 #define ADE9113_LOCK_KEY 0XD4
208 #define ADE9113_UNLOCK_KEY 0X5E
211 #define ADE9113_3_CHANNEL_ADE9113 0U
212 #define ADE9113_2_CHANNEL_ADE9112 1U
213 #define ADE9113_NONISOLATED_ADE9103 3U
216 #define ADE9113_VREF (1249810)
426 uint8_t *crc_en_state);
430 uint8_t crc_en_state);
526 uint8_t int_msk, uint8_t en);
794 #endif // __ADE9113_H__
ade9113_stream_debug_e
ADE9113 Stream Debug.
Definition: ade9113.h:226
int ade9113_get_comflt_err(struct ade9113_dev *dev, uint8_t *status)
Get COMFLT_ERR indicator.
Definition: ade9113.c:2019
int ade9113_enable_wa_dc_offset_mode(struct ade9113_dev *dev)
Enable write access to DC_OFFSET_MODE register.
Definition: ade9113.c:1121
int ade9113_wr_lock(struct ade9113_dev *dev)
Lock device.
Definition: ade9113.c:867
#define ADE9113_STATUS1X_MSK
Definition: ade9113.h:146
int ade9113_get_emi_mid_limit(struct ade9113_dev *dev, uint8_t *limit)
Get EMI MID limit.
Definition: ade9113.c:1277
#define ADE9113_SWRST_CMD
Definition: ade9113.h:122
#define ADE9113_REG_EFUSE_REFRESH
Definition: ade9113.h:79
#define ADE9113_REG_COM_FLT_TYPE
Definition: ade9113.h:100
int ade9113_disable_iso_test_mmr_err_int(struct ade9113_dev *dev)
Disable ISO_TEST_MMR_ERR interrupt.
Definition: ade9113.c:1784
int ade9113_convert_to_millivolts(struct ade9113_dev *dev, uint8_t dev_no, enum ade9113_wav_e ch, int32_t *mv_val)
Convert a 24-bit raw sample to millivolts.
Definition: ade9113.c:725
int ade9113_disable_status2x_int(struct ade9113_dev *dev)
Disable STATUS2X interrupt.
Definition: ade9113.c:1364
#define ADE9113_CRC_DONE_MSK
Definition: ade9113.h:199
int ade9113_enable_status2x_int(struct ade9113_dev *dev)
Enable STATUS2X interrupt.
Definition: ade9113.c:1350
#define ADE9113_REG_EMI_CONFIG
Definition: ade9113.h:80
int ade9113_get_statusx_val(struct ade9113_dev *dev, uint8_t addr, uint8_t *status)
Get STATUSx register value.
Definition: ade9113.c:1910
int ade9113_get_iso_efuse_mem_err_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_EFUSE_MEM_ERR indicator.
Definition: ade9113.c:2229
uint32_t timeout
Definition: ad413x.c:55
int ade9113_clear_crc_done_int(struct ade9113_dev *dev)
Clear the CRC_DONE int mask.
Definition: ade9113.c:2400
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
int ade9113_invert_v1_inputs(struct ade9113_dev *dev)
Invert V1 channel inputs.
Definition: ade9113.c:1001
int ade9113_disable_iso_efuse_mem_err_int(struct ade9113_dev *dev)
Disable ISO_EFUSE_MEM_ERR interrupt.
Definition: ade9113.c:1672
@ ADE9113_SINC3_LPF_EN_4_KHZ_SAMPLING
Definition: ade9113.h:253
@ ADE9113_SAWTOOTH_FREQUENCY_RISING
Definition: ade9113.h:266
int ade9113_get_adc_sync_done(struct ade9113_dev *dev, uint8_t *status)
Get ADC_SYNC_DONE indicator.
Definition: ade9113.c:2157
int ade9113_get_v2_wav_ovrng(struct ade9113_dev *dev, uint8_t *status)
Get V2_WAV_OVRNG indicator.
Definition: ade9113.c:2086
int ade9113_get_efuse_mem_err(struct ade9113_dev *dev, uint8_t *status)
Get EFUSE_MEM_ERR indicator.
Definition: ade9113.c:1994
int ade9113_enable_comflt_err_int(struct ade9113_dev *dev)
Enable COMFLT_ERR interrupt.
Definition: ade9113.c:1462
#define ADE9113_CRC16_INIT_VAL
Definition: ade9113.h:66
int ade9113_enable_iso_dig_mod_v1_ovf_int(struct ade9113_dev *dev)
Enable ISO_DIG_MOD_V1_OVF interrupt.
Definition: ade9113.c:1714
uint8_t no_devs
Definition: ade9113.h:347
#define ADE9113_REG_SYNC_SNAP
Definition: ade9113.h:91
int ade9113_enable_crc_chg_int(struct ade9113_dev *dev)
Enable CRC_CHG interrupt.
Definition: ade9113.c:1406
@ ADE9113_ZX_V2_SEL
Definition: ade9113.h:302
int ade9113_disable_status2x_int(struct ade9113_dev *dev)
Disable STATUS2X interrupt.
Definition: ade9113.c:1364
#define ADE9113_STREAM_DBG_MSK
Definition: ade9113.h:125
struct no_os_gpio_desc * gpio_reset
Definition: ade9113.h:370
int ade9113_get_iso_efuse_mem_err_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_EFUSE_MEM_ERR indicator.
Definition: ade9113.c:2229
@ ADE9113_ZX_I_SEL
Definition: ade9113.h:298
int ade9113_clear_spi_crc_err_int(struct ade9113_dev *dev)
Clear the SPI_CRC_ERR int mask.
Definition: ade9113.c:2063
int ade9113_get_iso_phy_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_PHY_ERR indicator.
Definition: ade9113.c:2362
@ ADE9113_SINC3_LPF_EN_32_KHZ_SAMPLING
Definition: ade9113.h:245
int ade9113_set_emi_lo_mask(struct ade9113_dev *dev, uint8_t msk)
Set EMI LO mask.
Definition: ade9113.c:1249
int ade9113_invert_v2_inputs(struct ade9113_dev *dev)
Invert V2 channel inputs.
Definition: ade9113.c:987
#define ADE9113_ISO_DIG_MOD_I_OVF_MSK
Definition: ade9113.h:165
#define ADE9113_I_WAV_OVRNG_MSK
Definition: ade9113.h:156
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:165
int ade9113_enable_adc_sync_done_int(struct ade9113_dev *dev)
Enable ADC_SYNC_DONE interrupt.
Definition: ade9113.c:1574
int ade9113_force_crc_recalculation(struct ade9113_dev *dev)
Force background register map CRC recalculation.
Definition: ade9113.c:2414
Structure describing a callback to be registered.
Definition: no_os_irq.h:148
#define ADE9113_SNAPSHOT_MSK
Definition: ade9113.h:175
void(* drdy_callback)(void *context)
Definition: ade9113.h:345
#define ADE9113_ISO_ECC_ERR_MSK
Definition: ade9113.h:196
ade9113_datapath_config_e
ADE9113 digital signal processing configuration.
Definition: ade9113.h:241
int ade9113_get_emi_hi_mask(struct ade9113_dev *dev, uint8_t *msk)
Get EMI HI mask.
Definition: ade9113.c:1207
#define ADE9113_REG_COM_FLT_COUNT
Definition: ade9113.h:101
int ade9113_get_emi_lo_mask(struct ade9113_dev *dev, uint8_t *msk)
Get EMI LO mask.
Definition: ade9113.c:1221
int ade9113_set_normal_mode(struct ade9113_dev *dev)
Set normal mode of operation.
Definition: ade9113.c:933
int ade9113_set_dsp_config(struct ade9113_dev *dev, enum ade9113_datapath_config_e config)
Set digital signal processing configuration.
Definition: ade9113.c:1102
int ade9113_clear_v1_wav_ovrng_int(struct ade9113_dev *dev)
Clear the V1_WAV_OVRNG int mask.
Definition: ade9113.c:2122
Header file of SPI Interface.
int ade9113_set_emi_config(struct ade9113_dev *dev, enum ade9113_emi_config_e config)
Select EMI frequency hopping.
Definition: ade9113.c:1191
#define ADE9113_REG_I_WAV_MD
Definition: ade9113.h:104
Header file of IRQ interface.
int32_t no_os_irq_register_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
Register a callback to handle the irq events.
Definition: no_os_irq.c:98
struct no_os_gpio_init_param * gpio_reset
Definition: ade9113.h:340
int ade9113_disable_iso_clk_stbl_err_int(struct ade9113_dev *dev)
Disable ISO_CLK_STBL_ERR interrupt.
Definition: ade9113.c:1616
int ade9113_get_err_count(struct ade9113_dev *dev, uint8_t *err_count)
Get ECC or PHY Error Count on ISO to NONISO Communications.
Definition: ade9113.c:973
int ade9113_adc_prepare_broadcast(struct ade9113_dev *dev)
ADC prepare broadcast.
Definition: ade9113.c:1837
uint8_t ver_product
Definition: ade9113.h:358
int ade9113_set_data_increments_mode(struct ade9113_dev *dev)
Set data increments mode of operation.
Definition: ade9113.c:959
int ade9113_enable_adc_sync_done_int(struct ade9113_dev *dev)
Enable ADC_SYNC_DONE interrupt.
Definition: ade9113.c:1574
int ade9113_get_crc_chg(struct ade9113_dev *dev, uint8_t *status)
Get CRC_CHG indicator.
Definition: ade9113.c:1982
int ade9113_disable_v1_wav_ovrng_int(struct ade9113_dev *dev)
Disable V1_WAV_OVRNG interrupt.
Definition: ade9113.c:1532
#define ADE9113_REG_CRC_RESULT_LO
Definition: ade9113.h:78
int ade9113_enable_iso_phy_crc_err_int(struct ade9113_dev *dev)
Enable ISO_PHY_CRC_ERR interrupt.
Definition: ade9113.c:1630
uint8_t no_devs
Definition: ade9113.h:376
int ade9113_clear_iso_dig_mod_i_ovf_int(struct ade9113_dev *dev)
Clear the ISO_DIG_MOD_I_OVF int mask.
Definition: ade9113.c:2313
int ade9113_read(struct ade9113_dev *dev, uint8_t reg_addr, uint8_t *reg_data, enum ade9113_operation_e op_mode)
Read device register.
Definition: ade9113.c:69
int ade9113_disable_i_wav_ovrng_int(struct ade9113_dev *dev)
Disable I_WAV_OVRNG interrupt.
Definition: ade9113.c:1560
@ ADE9113_SINC3_32_KHZ_SAMPLING
Definition: ade9113.h:243
int ade9113_set_normal_mode(struct ade9113_dev *dev)
Set normal mode of operation.
Definition: ade9113.c:933
int ade9113_clear_iso_dig_mod_v2_ovf_int(struct ade9113_dev *dev)
Clear the ISO_DIG_MOD_V2_OVF int mask.
Definition: ade9113.c:2265
@ ADE9113_ZX_DETECT_NEGATIVE_SLOPE
Definition: ade9113.h:285
int ade9113_get_status2x(struct ade9113_dev *dev, uint8_t *status)
Get STATUS2 indicator.
Definition: ade9113.c:1946
int ade9113_invert_i_inputs(struct ade9113_dev *dev)
Invert I channel inputs.
Definition: ade9113.c:1015
int ade9113_enable_iso_efuse_mem_err_int(struct ade9113_dev *dev)
Enable ISO_EFUSE_MEM_ERR interrupt.
Definition: ade9113.c:1658
@ ADE9113_ZX_INPUT_SIGNAL_SIGN
Definition: ade9113.h:281
#define ADE9113_CRC_CHG_MSK
Definition: ade9113.h:149
int ade9113_set_stream_dbg_mode(struct ade9113_dev *dev, enum ade9113_stream_debug_e stream_dbg)
Set STREAM_DBG mode.
Definition: ade9113.c:797
int ade9113_get_com_up(struct ade9113_dev *dev, uint8_t *status)
Get COM_UP indicator.
Definition: ade9113.c:1970
int ade9113_get_v2_wav_ovrng(struct ade9113_dev *dev, uint8_t *status)
Get V2_WAV_OVRNG indicator.
Definition: ade9113.c:2086
int ade9113_get_iso_dig_mod_v1_ovf(struct ade9113_dev *dev, uint8_t *status)
Get ISO_DIG_MOD_V1_OVF indicator.
Definition: ade9113.c:2277
@ ADE9113_STREAM_FUNCTIONAL_MODE
Definition: ade9113.h:234
Header file of Delay functions.
int ade9113_select_zero_crossing_edge(struct ade9113_dev *dev, enum ade9113_zx_edge_sel_e sel)
Select zero crossing edge.
Definition: ade9113.c:1799
int ade9113_clear_iso_dig_mod_i_ovf_int(struct ade9113_dev *dev)
Clear the ISO_DIG_MOD_I_OVF int mask.
Definition: ade9113.c:2313
int ade9113_get_iso_phy_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_PHY_ERR indicator.
Definition: ade9113.c:2362
int ade9113_clear_iso_dig_mod_v2_ovf_int(struct ade9113_dev *dev)
Clear the ISO_DIG_MOD_V2_OVF int mask.
Definition: ade9113.c:2265
int ade9113_set_emi_lo_mask(struct ade9113_dev *dev, uint8_t msk)
Set EMI LO mask.
Definition: ade9113.c:1249
int32_t * i_wav
Definition: ade9113.h:362
int ade9113_get_status2x(struct ade9113_dev *dev, uint8_t *status)
Get STATUS2 indicator.
Definition: ade9113.c:1946
@ ADE9113_RANDOM_HOPPING_FREQUENCY
Definition: ade9113.h:272
int ade9113_invert_v2_inputs(struct ade9113_dev *dev)
Invert V2 channel inputs.
Definition: ade9113.c:987
int ade9113_enable_v2_wav_ovrng_int(struct ade9113_dev *dev)
Enable V2_WAV_OVRNG interrupt.
Definition: ade9113.c:1490
int ade9113_disable_iso_dig_mod_v2_ovf_int(struct ade9113_dev *dev)
Disable ISO_DIG_MOD_V2_OVF interrupt.
Definition: ade9113.c:1700
ADE9113 Device initialization parameters.
Definition: ade9113.h:334
int ade9113_set_lpf_bw_3_3(struct ade9113_dev *dev)
Set filter bandwidth to 3.3 kHz at 8ksps output data rate.
Definition: ade9113.c:1087
int ade9113_clear_adc_sync_done_int(struct ade9113_dev *dev)
Clear the ADC_SYNC_DONE int mask.
Definition: ade9113.c:2169
#define ENABLE
Definition: ad77681.h:345
int ade9113_enable_spi_crc_err_int(struct ade9113_dev *dev)
Enable SPI_CRC_ERR interrupt.
Definition: ade9113.c:1434
NO_OS_DECLARE_CRC16_TABLE(ade9113_crc16)
int ade9113_get_emi_mid_limit(struct ade9113_dev *dev, uint8_t *limit)
Get EMI MID limit.
Definition: ade9113.c:1277
Definition: ad9361_util.h:75
int ade9113_init(struct ade9113_dev **device, struct ade9113_init_param init_param)
Initialize the device.
Definition: ade9113.c:401
int ade9113_disable_com_up_int(struct ade9113_dev *dev)
Disable COM_UP interrupt.
Definition: ade9113.c:1392
int ade9113_clear_iso_phy_crc_err_int(struct ade9113_dev *dev)
Clear the ISO_PHY_CRC_ERR int mask.
Definition: ade9113.c:2217
#define ADE9113_ISO_WR_ACC_EN_MSK
Definition: ade9113.h:137
int ade9113_select_zero_crossing_channel(struct ade9113_dev *dev, enum ade9113_zx_channel_cfg_e cfg)
Select zero crossing channel.
Definition: ade9113.c:1818
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:123
@ ADE9113_V1_WAV
Definition: ade9113.h:324
int ade9113_disable_crc_chg_int(struct ade9113_dev *dev)
Disable CRC_CHG interrupt.
Definition: ade9113.c:1420
int ade9113_disable_v2_wav_ovrng_int(struct ade9113_dev *dev)
Disable V2_WAV_OVRNG interrupt.
Definition: ade9113.c:1504
#define ADE9113_REG_CONFIG0
Definition: ade9113.h:74
#define ADE9113_CRC16_POLY
Definition: ade9113.h:65
#define ADE9113_V1_ADC_INVERT_MSK
Definition: ade9113.h:131
struct no_os_gpio_desc * gpio_rdy
Definition: ade9113.h:368
uint8_t crc_en
Definition: ade9113.h:360
int ade9113_get_silicon_revision(struct ade9113_dev *dev, uint8_t *silicon_rev)
Get SILICON_REVISION value.
Definition: ade9113.c:2429
int ade9113_enable_iso_dig_mod_v2_ovf_int(struct ade9113_dev *dev)
Enable ISO_DIG_MOD_V2_OVF interrupt.
Definition: ade9113.c:1686
int ade9113_get_crc_en_state(struct ade9113_dev *dev, uint8_t *crc_en_state)
Get CRC enable on SPI write setting.
Definition: ade9113.c:813
NO_OS_DECLARE_CRC8_TABLE(ade9113_crc8)
int ade9113_disable_iso_clk_stbl_err_int(struct ade9113_dev *dev)
Disable ISO_CLK_STBL_ERR interrupt.
Definition: ade9113.c:1616
int ade9113_clear_iso_test_mmr_err_int(struct ade9113_dev *dev)
Clear the ISO_TEST_MMR_ERR int mask.
Definition: ade9113.c:2337
int ade9113_enable_i_wav_ovrng_int(struct ade9113_dev *dev)
Enable I_WAV_OVRNG interrupt.
Definition: ade9113.c:1546
int ade9113_set_lpf_bw_3_3(struct ade9113_dev *dev)
Set filter bandwidth to 3.3 kHz at 8ksps output data rate.
Definition: ade9113.c:1087
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:60
@ ADE9113_STREAM_STATIC_MODE
Definition: ade9113.h:230
int ade9113_get_crc_done_flag(struct ade9113_dev *dev, uint8_t *status)
Get CRC_DONE indicator.
Definition: ade9113.c:2388
int ade9113_read_scratchpad(struct ade9113_dev *dev, uint8_t *val)
Get the value stired in the scratchpad register.
Definition: ade9113.c:910
int32_t no_os_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: no_os_gpio.c:130
int ade9113_disable_com_up_int(struct ade9113_dev *dev)
Disable COM_UP interrupt.
Definition: ade9113.c:1392
int ade9113_disable_v1_wav_ovrng_int(struct ade9113_dev *dev)
Disable V1_WAV_OVRNG interrupt.
Definition: ade9113.c:1532
@ ADE9113_ZX_V1_SEL
Definition: ade9113.h:300
int ade9113_enable_iso_clk_stbl_err_int(struct ade9113_dev *dev)
Enable ISO_CLK_STBL_ERR interrupt.
Definition: ade9113.c:1602
@ NO_OS_IRQ_EDGE_FALLING
Definition: no_os_irq.h:85
#define ADE9113_REG_SILICON_REVISION
Definition: ade9113.h:118
int ade9113_write(struct ade9113_dev *dev, uint8_t reg_addr, uint8_t reg_data, enum ade9113_operation_e op_mode)
Write device register.
Definition: ade9113.c:287
int ade9113_set_static_mode(struct ade9113_dev *dev)
Set static mode of operation.
Definition: ade9113.c:946
int ade9113_invert_v2_inputs_disable(struct ade9113_dev *dev)
Disable invert V2 channel inputs.
Definition: ade9113.c:1029
int ade9113_efuse_refresh(struct ade9113_dev *dev)
Refresh EFuse Memory.
Definition: ade9113.c:1176
int ade9113_get_silicon_revision(struct ade9113_dev *dev, uint8_t *silicon_rev)
Get SILICON_REVISION value.
Definition: ade9113.c:2429
int ade9113_invert_i_inputs(struct ade9113_dev *dev)
Invert I channel inputs.
Definition: ade9113.c:1015
int ade9113_enable_iso_efuse_mem_err_int(struct ade9113_dev *dev)
Enable ISO_EFUSE_MEM_ERR interrupt.
Definition: ade9113.c:1658
struct no_os_irq_ctrl_desc * irq_ctrl
Definition: ade9113.h:342
@ ADE9113_S_OP
Definition: ade9113.h:313
int ade9113_set_stream_dbg_mode(struct ade9113_dev *dev, enum ade9113_stream_debug_e stream_dbg)
Set STREAM_DBG mode.
Definition: ade9113.c:797
int ade9113_clear_reset_done_int(struct ade9113_dev *dev)
Clear the RESET_DONE int mask.
Definition: ade9113.c:2030
int ade9113_disable_adc_sync_done_int(struct ade9113_dev *dev)
Disable ADC_SYNC_DONE interrupt.
Definition: ade9113.c:1588
int ade9113_get_iso_dig_mod_v1_ovf(struct ade9113_dev *dev, uint8_t *status)
Get ISO_DIG_MOD_V1_OVF indicator.
Definition: ade9113.c:2277
int ade9113_hw_reset(struct ade9113_dev *dev)
Reset the device using SW reset.
Definition: ade9113.c:687
int ade9113_get_reset_done(struct ade9113_dev *dev, uint8_t *status)
Get RESET_DONE indicator.
Definition: ade9113.c:1958
int ade9113_invert_i_inputs_disable(struct ade9113_dev *dev)
Disable invert I channel inputs.
Definition: ade9113.c:1059
int ade9113_get_crc_done_flag(struct ade9113_dev *dev, uint8_t *status)
Get CRC_DONE indicator.
Definition: ade9113.c:2388
int ade9113_enable_v1_wav_ovrng_int(struct ade9113_dev *dev)
Enable V1_WAV_OVRNG interrupt.
Definition: ade9113.c:1518
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:121
int ade9113_enable_iso_clk_stbl_err_int(struct ade9113_dev *dev)
Enable ISO_CLK_STBL_ERR interrupt.
Definition: ade9113.c:1602
@ ADE9113_SINC3_COMP_EN_LPF_EN_8_KHZ_SAMPLING
Definition: ade9113.h:251
int ade9113_disable_comflt_err_int(struct ade9113_dev *dev)
Disable COMFLT_ERR interrupt.
Definition: ade9113.c:1476
struct no_os_spi_desc * spi_desc
Definition: ade9113.h:356
int ade9113_set_lpf_bw_2_7(struct ade9113_dev *dev)
Set filter bandwidth to 2.7 kHz at 8ksps output data rate.
Definition: ade9113.c:1073
int ade9113_clear_iso_dig_mod_v1_ovf_int(struct ade9113_dev *dev)
Clear the ISO_DIG_MOD_V1_OVF int mask.
Definition: ade9113.c:2289
#define ADE9113_ISO_CLK_STBL_ERR_MSK
Definition: ade9113.h:160
int ade9113_set_dsp_config(struct ade9113_dev *dev, enum ade9113_datapath_config_e config)
Set digital signal processing configuration.
Definition: ade9113.c:1102
int ade9113_clear_v1_wav_ovrng_int(struct ade9113_dev *dev)
Clear the V1_WAV_OVRNG int mask.
Definition: ade9113.c:2122
int ade9113_efuse_refresh(struct ade9113_dev *dev)
Refresh EFuse Memory.
Definition: ade9113.c:1176
ade9113_zx_edge_sel_e
ADE9113 Zero Crossing Edge Select.
Definition: ade9113.h:279
#define ADE9113_REG_SCRATCH
Definition: ade9113.h:90
int ade9113_get_iso_ecc_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_ECC_ERR indicator.
Definition: ade9113.c:2375
int ade9113_enable_v2_wav_ovrng_int(struct ade9113_dev *dev)
Enable V2_WAV_OVRNG interrupt.
Definition: ade9113.c:1490
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
int ade9113_get_wav(struct ade9113_dev *dev, enum ade9113_wav_e selection, uint32_t *val)
Get wave value.
Definition: ade9113.c:2483
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
int ade9113_get_i_wav_ovrng(struct ade9113_dev *dev, uint8_t *status)
Get I_WAV_OVRNG indicator.
Definition: ade9113.c:2134
int ade9113_disable_adc_sync_done_int(struct ade9113_dev *dev)
Disable ADC_SYNC_DONE interrupt.
Definition: ade9113.c:1588
int ade9113_adc_prepare_broadcast(struct ade9113_dev *dev)
ADC prepare broadcast.
Definition: ade9113.c:1837
#define ADE9113_UNLOCK_KEY
Definition: ade9113.h:208
int ade9113_enable_spi_crc_err_int(struct ade9113_dev *dev)
Enable SPI_CRC_ERR interrupt.
Definition: ade9113.c:1434
int32_t no_os_irq_set_priority(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, uint32_t priority_level)
Set the priority for an interrupt.
Definition: no_os_irq.c:222
int ade9113_invert_i_inputs_disable(struct ade9113_dev *dev)
Disable invert I channel inputs.
Definition: ade9113.c:1059
int ade9113_enable_v1_wav_ovrng_int(struct ade9113_dev *dev)
Enable V1_WAV_OVRNG interrupt.
Definition: ade9113.c:1518
int ade9113_clear_iso_phy_crc_err_int(struct ade9113_dev *dev)
Clear the ISO_PHY_CRC_ERR int mask.
Definition: ade9113.c:2217
int ade9113_select_zero_crossing_channel(struct ade9113_dev *dev, enum ade9113_zx_channel_cfg_e cfg)
Select zero crossing channel.
Definition: ade9113.c:1818
int ade9113_disable_iso_phy_crc_err_int(struct ade9113_dev *dev)
Disable ISO_PHY_CRC_ERR interrupt.
Definition: ade9113.c:1644
@ ADE9113_L_OP
Definition: ade9113.h:311
int ade9113_read(struct ade9113_dev *dev, uint8_t reg_addr, uint8_t *reg_data, enum ade9113_operation_e op_mode)
Read device register.
Definition: ade9113.c:69
#define ADE9113_REG_STATUS1
Definition: ade9113.h:98
int ade9113_disable_i_wav_ovrng_int(struct ade9113_dev *dev)
Disable I_WAV_OVRNG interrupt.
Definition: ade9113.c:1560
int ade9113_enable_iso_dig_mod_v2_ovf_int(struct ade9113_dev *dev)
Enable ISO_DIG_MOD_V2_OVF interrupt.
Definition: ade9113.c:1686
int ade9113_get_crc_en_state(struct ade9113_dev *dev, uint8_t *crc_en_state)
Get CRC enable on SPI write setting.
Definition: ade9113.c:813
int ade9113_wr_unlock(struct ade9113_dev *dev)
Unlock device.
Definition: ade9113.c:880
#define ADE9113_REG_SWRST
Definition: ade9113.h:73
#define ADE9113_REG_EMI_HI_LIMIT
Definition: ade9113.h:83
int ade9113_get_int_status(struct ade9113_dev *dev, uint8_t addr, uint8_t msk, uint8_t *status)
Get interrupt indicator from STATUS register.
Definition: ade9113.c:1885
ade9113_wav_e
ADE9113 waveorm data.
Definition: ade9113.h:320
#define ADE9113_LOCK_KEY
Definition: ade9113.h:207
@ ADE9113_I_WAV
Definition: ade9113.h:322
int ade9113_enable_wa_dc_offset_mode(struct ade9113_dev *dev)
Enable write access to DC_OFFSET_MODE register.
Definition: ade9113.c:1121
#define ADE9113_V2_WAV_OVRNG_MSK
Definition: ade9113.h:154
#define ADE9113_ZX_CHANNEL_CONFIG_MSK
Definition: ade9113.h:170
int ade9113_sw_reset(struct ade9113_dev *dev)
Reset the device using SW reset.
Definition: ade9113.c:658
uint32_t no_os_get_unaligned_le24(uint8_t *buf)
int ade9113_get_emi_hi_limit(struct ade9113_dev *dev, uint8_t *limit)
Get EMI HI limit.
Definition: ade9113.c:1263
void no_os_crc8_populate_msb(uint8_t *table, const uint8_t polynomial)
int ade9113_disable_iso_test_mmr_err_int(struct ade9113_dev *dev)
Disable ISO_TEST_MMR_ERR interrupt.
Definition: ade9113.c:1784
int ade9113_get_version_product(struct ade9113_dev *dev, uint8_t *ver_product)
Get VERSION_PRODUCT value.
Definition: ade9113.c:2444
int ade9113_select_zero_crossing_edge(struct ade9113_dev *dev, enum ade9113_zx_edge_sel_e sel)
Select zero crossing edge.
Definition: ade9113.c:1799
int ade9113_get_stream_dbg_mode(struct ade9113_dev *dev, enum ade9113_stream_debug_e *stream_dbg)
Get STREAM_DBG mode.
Definition: ade9113.c:760
@ ADE9113_STREAM_NORMAL_MODE
Definition: ade9113.h:228
@ ADE9113_ZX_DETECT_POSITIVE_SLOPE
Definition: ade9113.h:283
int ade9113_clear_v2_wav_ovrng_int(struct ade9113_dev *dev)
Clear the V2_WAV_OVRNG int mask.
Definition: ade9113.c:2098
Header file of CRC-16 computation.
int ade9113_clear_reset_done_int(struct ade9113_dev *dev)
Clear the RESET_DONE int mask.
Definition: ade9113.c:2030
#define ADE9113_ADC_SYNC_DONE_MSK
Definition: ade9113.h:157
@ ADE9113_V2_WAV
Definition: ade9113.h:326
ade9113_emi_config_e
ADE9113 EMI Frequency Hopping Selection.
Definition: ade9113.h:264
#define ADE9113_V1_WAV_OVRNG_MSK
Definition: ade9113.h:155
#define ADE9113_REG_MASK1
Definition: ade9113.h:87
int ade9113_clear_adc_sync_done_int(struct ade9113_dev *dev)
Clear the ADC_SYNC_DONE int mask.
Definition: ade9113.c:2169
int ade9113_get_int_status(struct ade9113_dev *dev, uint8_t addr, uint8_t msk, uint8_t *status)
Get interrupt indicator from STATUS register.
Definition: ade9113.c:1885
int ade9113_get_adc_sync_done(struct ade9113_dev *dev, uint8_t *status)
Get ADC_SYNC_DONE indicator.
Definition: ade9113.c:2157
int ade9113_clear_iso_efuse_mem_err_int(struct ade9113_dev *dev)
Clear the ISO_EFUSE_MEM_ERR int mask.
Definition: ade9113.c:2241
int ade9113_get_emi_hi_limit(struct ade9113_dev *dev, uint8_t *limit)
Get EMI HI limit.
Definition: ade9113.c:1263
int ade9113_disable_iso_dig_mod_v1_ovf_int(struct ade9113_dev *dev)
Disable ISO_DIG_MOD_V1_OVF interrupt.
Definition: ade9113.c:1728
#define ADE9113_REG_STATUS2
Definition: ade9113.h:99
#define ADE9113_V2_ADC_INVERT_MSK
Definition: ade9113.h:130
int ade9113_get_iso_dig_mod_v2_ovf(struct ade9113_dev *dev, uint8_t *status)
Get ISO_DIG_MOD_V2_OVF indicator.
Definition: ade9113.c:2253
int ade9113_set_lpf_bw_2_7(struct ade9113_dev *dev)
Set filter bandwidth to 2.7 kHz at 8ksps output data rate.
Definition: ade9113.c:1073
#define DISABLE
Definition: ad77681.h:346
int32_t no_os_irq_unregister_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
Unregisters a generic IRQ handling function.
Definition: no_os_irq.c:118
int ade9113_disable_v2_wav_ovrng_int(struct ade9113_dev *dev)
Disable V2_WAV_OVRNG interrupt.
Definition: ade9113.c:1504
int ade9113_clear_iso_dig_mod_v1_ovf_int(struct ade9113_dev *dev)
Clear the ISO_DIG_MOD_V1_OVF int mask.
Definition: ade9113.c:2289
#define ADE9113_PREP_BROADCAST_MSK
Definition: ade9113.h:173
#define ADE9113_ISO_PHY_ERR_MSK
Definition: ade9113.h:195
#define ADE9113_ISO_DIG_MOD_V1_OVF_MSK
Definition: ade9113.h:164
int ade9113_clear_v2_wav_ovrng_int(struct ade9113_dev *dev)
Clear the V2_WAV_OVRNG int mask.
Definition: ade9113.c:2098
int ade9113_get_wav(struct ade9113_dev *dev, enum ade9113_wav_e selection, uint32_t *val)
Get wave value.
Definition: ade9113.c:2483
Header file of ADE9113 Driver.
int ade9113_enable_i_wav_ovrng_int(struct ade9113_dev *dev)
Enable I_WAV_OVRNG interrupt.
Definition: ade9113.c:1546
int ade9113_get_crc(struct ade9113_dev *dev, uint16_t *crc)
Get register map CRC.
Definition: ade9113.c:1151
#define ADE9113_STATUS2X_MSK
Definition: ade9113.h:147
int ade9113_write(struct ade9113_dev *dev, uint8_t reg_addr, uint8_t reg_data, enum ade9113_operation_e op_mode)
Write device register.
Definition: ade9113.c:287
int ade9113_control_interrupt(struct ade9113_dev *dev, uint8_t reg_addr, uint8_t int_msk, uint8_t en)
Enable/disable interrupt.
Definition: ade9113.c:1307
int ade9113_get_emi_hi_mask(struct ade9113_dev *dev, uint8_t *msk)
Get EMI HI mask.
Definition: ade9113.c:1207
int ade9113_get_iso_dig_mod_v2_ovf(struct ade9113_dev *dev, uint8_t *status)
Get ISO_DIG_MOD_V2_OVF indicator.
Definition: ade9113.c:2253
#define ADE9113_DATAPATH_CONFIG_MSK
Definition: ade9113.h:134
#define ADE9113_ZX_EDGE_SEL_MSK
Definition: ade9113.h:169
int ade9113_write_dc(struct ade9113_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Write device register in a daisy-chain setup.
Definition: ade9113.c:312
int ade9113_drdy_int_enable(struct ade9113_dev *dev)
DRDY inerrupt enable.
Definition: ade9113.c:2529
int ade9113_wr_unlock(struct ade9113_dev *dev)
Unlock device.
Definition: ade9113.c:880
int ade9113_get_v1_wav_ovrng(struct ade9113_dev *dev, uint8_t *status)
Get V1_WAV_OVRNG indicator.
Definition: ade9113.c:2110
int ade9113_remove(struct ade9113_dev *dev)
Remove the device and release resources.
Definition: ade9113.c:627
#define ADE9113_ISO_EFUSE_MEM_ERR_MSK
Definition: ade9113.h:162
#define ADE9113_REG_CRC_RESULT_HI
Definition: ade9113.h:77
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:110
int ade9113_get_reset_done(struct ade9113_dev *dev, uint8_t *status)
Get RESET_DONE indicator.
Definition: ade9113.c:1958
#define ADE9113_EMI_CONFIG_MSK
Definition: ade9113.h:143
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
int ade9113_set_data_increments_mode(struct ade9113_dev *dev)
Set data increments mode of operation.
Definition: ade9113.c:959
#define ADE9113_I_ADC_INVERT_MSK
Definition: ade9113.h:132
int ade9113_get_crc(struct ade9113_dev *dev, uint16_t *crc)
Get register map CRC.
Definition: ade9113.c:1151
#define ADE9113_REG_WR_LOCK
Definition: ade9113.h:96
@ ADE9113_STREAM_INCREMENTS_MODE
Definition: ade9113.h:232
int ade9113_adc_align(struct ade9113_dev *dev)
ADC align.
Definition: ade9113.c:1852
int ade9113_enable_iso_test_mmr_err_int(struct ade9113_dev *dev)
Enable ISO_TEST_MMR_ERR interrupt.
Definition: ade9113.c:1770
int ade9113_enable_iso_phy_crc_err_int(struct ade9113_dev *dev)
Enable ISO_PHY_CRC_ERR interrupt.
Definition: ade9113.c:1630
int ade9113_set_crc_en_state(struct ade9113_dev *dev, uint8_t crc_en_state)
Set CRC enable on SPI write setting.
Definition: ade9113.c:842
struct no_os_irq_ctrl_desc * irq_ctrl
Definition: ade9113.h:372
int ade9113_clear_com_up_int(struct ade9113_dev *dev)
Clear the COM_UP int mask.
Definition: ade9113.c:2041
#define ADE9113_REG_MASK2
Definition: ade9113.h:88
int ade9113_remove(struct ade9113_dev *dev)
Remove the device and release resources.
Definition: ade9113.c:627
void(* callback)(void *context)
Definition: no_os_irq.h:150
#define ADE9113_LPF_BW_MSK
Definition: ade9113.h:133
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
int ade9113_get_com_up(struct ade9113_dev *dev, uint8_t *status)
Get COM_UP indicator.
Definition: ade9113.c:1970
int ade9113_enable_com_up_int(struct ade9113_dev *dev)
Enable COM_UP interrupt.
Definition: ade9113.c:1378
@ ADE9113_SINC3_LPF_EN_8_KHZ_SAMPLING
Definition: ade9113.h:249
int ade9113_get_iso_status_rd_ecc_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_STATUS_RD_ECC_ERR indicator.
Definition: ade9113.c:2349
int ade9113_adc_align(struct ade9113_dev *dev)
ADC align.
Definition: ade9113.c:1852
#define ADE9113_REG_EMI_LO_MASK
Definition: ade9113.h:82
int ade9113_invert_v1_inputs_disable(struct ade9113_dev *dev)
Disable invert V1 channel inputs.
Definition: ade9113.c:1044
int32_t * v1_wav
Definition: ade9113.h:364
int ade9113_get_iso_clk_stbl_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_CLK_STBL_ERR indicator.
Definition: ade9113.c:2181
int ade9113_get_emi_lo_limit(struct ade9113_dev *dev, uint8_t *limit)
Get EMI LO limit.
Definition: ade9113.c:1291
int ade9113_enable_comflt_err_int(struct ade9113_dev *dev)
Enable COMFLT_ERR interrupt.
Definition: ade9113.c:1462
int ade9113_sw_reset(struct ade9113_dev *dev)
Reset the device using SW reset.
Definition: ade9113.c:658
int ade9113_enable_com_up_int(struct ade9113_dev *dev)
Enable COM_UP interrupt.
Definition: ade9113.c:1378
int ade9113_init(struct ade9113_dev **device, struct ade9113_init_param init_param)
Initialize the device.
Definition: ade9113.c:401
#define ADE9113_COMFLT_ERR_MSK
Definition: ade9113.h:151
int ade9113_clear_comflt_err_int(struct ade9113_dev *dev)
Clear the COMFLT_ERR int mask.
Definition: ade9113.c:2074
#define ADE9113_3_CHANNEL_ADE9113
Definition: ade9113.h:211
int ade9113_set_emi_hi_mask(struct ade9113_dev *dev, uint8_t msk)
Set EMI HI mask.
Definition: ade9113.c:1235
@ ADE9113_RAMP
Definition: ade9113.h:270
int ade9113_enable_crc_chg_int(struct ade9113_dev *dev)
Enable CRC_CHG interrupt.
Definition: ade9113.c:1406
int ade9113_write_dc(struct ade9113_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Write device register in a daisy-chain setup.
Definition: ade9113.c:312
int ade9113_disable_crc_chg_int(struct ade9113_dev *dev)
Disable CRC_CHG interrupt.
Definition: ade9113.c:1420
int ade9113_drdy_int_enable(struct ade9113_dev *dev)
DRDY inerrupt enable.
Definition: ade9113.c:2529
int ade9113_disable_iso_dig_mod_i_ovf_int(struct ade9113_dev *dev)
Disable ISO_DIG_MOD_I_OVF interrupt.
Definition: ade9113.c:1756
#define ADE9113_CRC_EN_SPI_WRITE_MSK
Definition: ade9113.h:126
int ade9113_clear_spi_crc_err_int(struct ade9113_dev *dev)
Clear the SPI_CRC_ERR int mask.
Definition: ade9113.c:2063
int ade9113_get_v1_wav_ovrng(struct ade9113_dev *dev, uint8_t *status)
Get V1_WAV_OVRNG indicator.
Definition: ade9113.c:2110
int ade9113_get_iso_test_mmr_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_TEST_MMR_ERR indicator.
Definition: ade9113.c:2325
#define ADE9113_ALIGN_MSK
Definition: ade9113.h:174
int ade9113_get_iso_clk_stbl_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_CLK_STBL_ERR indicator.
Definition: ade9113.c:2181
int ade9113_clear_iso_test_mmr_err_int(struct ade9113_dev *dev)
Clear the ISO_TEST_MMR_ERR int mask.
Definition: ade9113.c:2337
#define ADE9113_SPI_CRC_ERR_MSK
Definition: ade9113.h:150
int ade9113_get_emi_lo_limit(struct ade9113_dev *dev, uint8_t *limit)
Get EMI LO limit.
Definition: ade9113.c:1291
int ade9113_write_scratchpad(struct ade9113_dev *dev, uint8_t val)
Write value in the scratchpad register.
Definition: ade9113.c:895
int ade9113_disable_wa_dc_offset_mode(struct ade9113_dev *dev)
Disable write access to DC_OFFSET_MODE register.
Definition: ade9113.c:1135
int ade9113_clear_iso_efuse_mem_err_int(struct ade9113_dev *dev)
Clear the ISO_EFUSE_MEM_ERR int mask.
Definition: ade9113.c:2241
uint8_t no_os_crc8(const uint8_t *table, const uint8_t *pdata, size_t nbytes, uint8_t crc)
#define ADE9113_REG_CONFIG_CRC
Definition: ade9113.h:102
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:75
uint16_t no_os_crc16(const uint16_t *table, const uint8_t *pdata, size_t nbytes, uint16_t crc)
ade9113_operation_e
ADE9113 long/short operation mode.
Definition: ade9113.h:309
int ade9113_clear_comflt_err_int(struct ade9113_dev *dev)
Clear the COMFLT_ERR int mask.
Definition: ade9113.c:2074
int ade9113_disable_iso_dig_mod_v1_ovf_int(struct ade9113_dev *dev)
Disable ISO_DIG_MOD_V1_OVF interrupt.
Definition: ade9113.c:1728
@ ADE9113_SINC3_COMP_EN_LPF_EN_32_KHZ_SAMPLING
Definition: ade9113.h:247
int ade9113_set_crc_en_state(struct ade9113_dev *dev, uint8_t crc_en_state)
Set CRC enable on SPI write setting.
Definition: ade9113.c:842
uint16_t no_os_get_unaligned_le16(uint8_t *buf)
int ade9113_clear_com_up_int(struct ade9113_dev *dev)
Clear the COM_UP int mask.
Definition: ade9113.c:2041
int ade9113_read_dc(struct ade9113_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Read device register in a daisy-chain setup.
Definition: ade9113.c:172
int ade9113_set_static_mode(struct ade9113_dev *dev)
Set static mode of operation.
Definition: ade9113.c:946
#define ADE9113_COM_UP_MSK
Definition: ade9113.h:148
int ade9113_get_emi_lo_mask(struct ade9113_dev *dev, uint8_t *msk)
Get EMI LO mask.
Definition: ade9113.c:1221
int ade9113_get_iso_test_mmr_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_TEST_MMR_ERR indicator.
Definition: ade9113.c:2325
int ade9113_clear_iso_clk_stbl_err_int(struct ade9113_dev *dev)
Clear the ISO_CLK_STBL_ERR int mask.
Definition: ade9113.c:2193
int ade9113_adc_snapshot(struct ade9113_dev *dev)
ADC snapshot.
Definition: ade9113.c:1867
int ade9113_get_iso_dig_mod_i_ovf(struct ade9113_dev *dev, uint8_t *status)
Get ISO_DIG_MOD_I_OVF indicator.
Definition: ade9113.c:2301
#define ADE9113_2_CHANNEL_ADE9112
Definition: ade9113.h:212
int ade9113_hw_reset(struct ade9113_dev *dev)
Reset the device using SW reset.
Definition: ade9113.c:687
int ade9113_get_status1x(struct ade9113_dev *dev, uint8_t *status)
Get STATUS1 indicator.
Definition: ade9113.c:1934
#define ADE9113_OP_MODE_LONG
Definition: ade9113.h:61
int ade9113_get_iso_status_rd_ecc_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_STATUS_RD_ECC_ERR indicator.
Definition: ade9113.c:2349
int ade9113_enable_iso_dig_mod_i_ovf_int(struct ade9113_dev *dev)
Enable ISO_DIG_MOD_I_OVF interrupt.
Definition: ade9113.c:1742
int ade9113_control_interrupt(struct ade9113_dev *dev, uint8_t reg_addr, uint8_t int_msk, uint8_t en)
Enable/disable interrupt.
Definition: ade9113.c:1307
int ade9113_clear_i_wav_ovrng_int(struct ade9113_dev *dev)
Clear the I_WAV_OVRNG int mask.
Definition: ade9113.c:2145
int ade9113_disable_status1x_int(struct ade9113_dev *dev)
Disable STATUS1X interrupt.
Definition: ade9113.c:1336
#define ADE9113_REG_I_WAV_LO
Definition: ade9113.h:105
int ade9113_disable_comflt_err_int(struct ade9113_dev *dev)
Disable COMFLT_ERR interrupt.
Definition: ade9113.c:1476
int ade9113_invert_v1_inputs_disable(struct ade9113_dev *dev)
Disable invert V1 channel inputs.
Definition: ade9113.c:1044
#define ADE9113_CRC8_POLY
Definition: ade9113.h:64
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:203
#define ADE9113_REG_CONFIG_ZX
Definition: ade9113.h:89
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
@ NO_OS_EVT_GPIO
Definition: no_os_irq.h:68
#define ADE9113_REG_MASK0
Definition: ade9113.h:86
int ade9113_disable_spi_crc_err_int(struct ade9113_dev *dev)
Disable SPI_CRC_ERR interrupt.
Definition: ade9113.c:1448
int ade9113_enable_iso_test_mmr_err_int(struct ade9113_dev *dev)
Enable ISO_TEST_MMR_ERR interrupt.
Definition: ade9113.c:1770
int ade9113_clear_i_wav_ovrng_int(struct ade9113_dev *dev)
Clear the I_WAV_OVRNG int mask.
Definition: ade9113.c:2145
#define ADE9113_ISO_DIG_MOD_V2_OVF_MSK
Definition: ade9113.h:163
int ade9113_disable_status1x_int(struct ade9113_dev *dev)
Disable STATUS1X interrupt.
Definition: ade9113.c:1336
#define ADE9113_REG_VERSION_PRODUCT
Definition: ade9113.h:119
#define ADE9113_REG_CONFIG_ISO_ACC
Definition: ade9113.h:76
int ade9113_invert_v1_inputs(struct ade9113_dev *dev)
Invert V1 channel inputs.
Definition: ade9113.c:1001
int ade9113_clear_crc_chg_int(struct ade9113_dev *dev)
Clear the CRC_CHG int mask.
Definition: ade9113.c:2052
@ ADE9113_ZX_DETECT_BOTH_SLOPES
Definition: ade9113.h:287
int ade9113_disable_iso_dig_mod_v2_ovf_int(struct ade9113_dev *dev)
Disable ISO_DIG_MOD_V2_OVF interrupt.
Definition: ade9113.c:1700
#define ADE9113_ISO_STATUS_RD_ECC_ERR_MSK
Definition: ade9113.h:194
int ade9113_disable_iso_efuse_mem_err_int(struct ade9113_dev *dev)
Disable ISO_EFUSE_MEM_ERR interrupt.
Definition: ade9113.c:1672
#define ADE9113_EFUSE_REFRESH_MSK
Definition: ade9113.h:140
int ade9113_get_iso_phy_crc_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_PHY_CRC_ERR indicator.
Definition: ade9113.c:2205
int ade9113_disable_spi_crc_err_int(struct ade9113_dev *dev)
Disable SPI_CRC_ERR interrupt.
Definition: ade9113.c:1448
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:122
#define ADE9113_REG_CONFIG_FILT
Definition: ade9113.h:75
#define ADE9113_ISO_TEST_MMR_ERR_MSK
Definition: ade9113.h:166
int32_t no_os_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable specific interrupt.
Definition: no_os_irq.c:187
int ade9113_disable_wa_dc_offset_mode(struct ade9113_dev *dev)
Disable write access to DC_OFFSET_MODE register.
Definition: ade9113.c:1135
Header file of GPIO Interface.
#define ADE9113_REG_EMI_LO_LIMIT
Definition: ade9113.h:85
int ade9113_read_dc(struct ade9113_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Read device register in a daisy-chain setup.
Definition: ade9113.c:172
int ade9113_get_version_product(struct ade9113_dev *dev, uint8_t *ver_product)
Get VERSION_PRODUCT value.
Definition: ade9113.c:2444
@ NO_OS_GPIO_IRQ
Definition: no_os_irq.h:91
int ade9113_get_stream_dbg_mode(struct ade9113_dev *dev, enum ade9113_stream_debug_e *stream_dbg)
Get STREAM_DBG mode.
Definition: ade9113.c:760
@ ADE9113_SINC3_LPF_EN_1_KHZ_SAMPLING
Definition: ade9113.h:257
ade9113_zx_channel_cfg_e
ADE9113 Zero Crossing Channel Select.
Definition: ade9113.h:294
int ade9113_enable_status1x_int(struct ade9113_dev *dev)
Enable STATUS1X interrupt.
Definition: ade9113.c:1322
int ade9113_clear_crc_chg_int(struct ade9113_dev *dev)
Clear the CRC_CHG int mask.
Definition: ade9113.c:2052
#define ADE9113_CRC_FORCE_MSK
Definition: ade9113.h:200
int ade9113_clear_iso_clk_stbl_err_int(struct ade9113_dev *dev)
Clear the ISO_CLK_STBL_ERR int mask.
Definition: ade9113.c:2193
int32_t * v2_wav
Definition: ade9113.h:366
#define ADE9113_SPI_READ
Definition: ade9113.h:58
int ade9113_adc_snapshot(struct ade9113_dev *dev)
ADC snapshot.
Definition: ade9113.c:1867
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:58
int ade9113_get_status1x(struct ade9113_dev *dev, uint8_t *status)
Get STATUS1 indicator.
Definition: ade9113.c:1934
int ade9113_get_comflt_err(struct ade9113_dev *dev, uint8_t *status)
Get COMFLT_ERR indicator.
Definition: ade9113.c:2019
void no_os_crc16_populate_msb(uint16_t *table, const uint16_t polynomial)
int ade9113_wr_lock(struct ade9113_dev *dev)
Lock device.
Definition: ade9113.c:867
int ade9113_read_scratchpad(struct ade9113_dev *dev, uint8_t *val)
Get the value stired in the scratchpad register.
Definition: ade9113.c:910
int ade9113_force_crc_recalculation(struct ade9113_dev *dev)
Force background register map CRC recalculation.
Definition: ade9113.c:2414
int ade9113_get_spi_crc_err(struct ade9113_dev *dev, uint8_t *status)
Get SPI_CRC_ERR indicator.
Definition: ade9113.c:2007
int ade9113_drdy_int_disable(struct ade9113_dev *dev)
DRDY inerrupt disable.
Definition: ade9113.c:2539
int ade9113_set_emi_hi_mask(struct ade9113_dev *dev, uint8_t msk)
Set EMI HI mask.
Definition: ade9113.c:1235
Header file of utility functions.
uint32_t no_os_find_first_set_bit(uint32_t word)
int ade9113_invert_v2_inputs_disable(struct ade9113_dev *dev)
Disable invert V2 channel inputs.
Definition: ade9113.c:1029
#define ADE9113_REG_EMI_MID_LIMIT
Definition: ade9113.h:84
int ade9113_enable_status2x_int(struct ade9113_dev *dev)
Enable STATUS2X interrupt.
Definition: ade9113.c:1350
int ade9113_disable_iso_dig_mod_i_ovf_int(struct ade9113_dev *dev)
Disable ISO_DIG_MOD_I_OVF interrupt.
Definition: ade9113.c:1756
int ade9113_set_emi_config(struct ade9113_dev *dev, enum ade9113_emi_config_e config)
Select EMI frequency hopping.
Definition: ade9113.c:1191
int32_t no_os_sign_extend32(uint32_t value, int index)
@ ADE9113_SINC3_LPF_EN_2_KHZ_SAMPLING
Definition: ade9113.h:255
int32_t no_os_irq_trigger_level_set(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, enum no_os_irq_trig_level trig)
Set interrupt trigger level.
Definition: no_os_irq.c:168
ADE9113 Device structure.
Definition: ade9113.h:354
int32_t no_os_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable specific interrupt.
Definition: no_os_irq.c:204
struct no_os_callback_desc irq_cb
Definition: ade9113.h:374
int ade9113_get_err_count(struct ade9113_dev *dev, uint8_t *err_count)
Get ECC or PHY Error Count on ISO to NONISO Communications.
Definition: ade9113.c:973
int ade9113_write_scratchpad(struct ade9113_dev *dev, uint8_t val)
Write value in the scratchpad register.
Definition: ade9113.c:895
int ade9113_get_efuse_mem_err(struct ade9113_dev *dev, uint8_t *status)
Get EFUSE_MEM_ERR indicator.
Definition: ade9113.c:1994
int ade9113_get_crc_chg(struct ade9113_dev *dev, uint8_t *status)
Get CRC_CHG indicator.
Definition: ade9113.c:1982
#define ADE9113_NONISOLATED_ADE9103
Definition: ade9113.h:213
int ade9113_get_spi_crc_err(struct ade9113_dev *dev, uint8_t *status)
Get SPI_CRC_ERR indicator.
Definition: ade9113.c:2007
Definition: no_os_irq.h:129
int ade9113_enable_iso_dig_mod_v1_ovf_int(struct ade9113_dev *dev)
Enable ISO_DIG_MOD_V1_OVF interrupt.
Definition: ade9113.c:1714
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:153
int ade9113_drdy_int_disable(struct ade9113_dev *dev)
DRDY inerrupt disable.
Definition: ade9113.c:2539
struct no_os_gpio_init_param * gpio_rdy
Definition: ade9113.h:338
int32_t number
Definition: no_os_gpio.h:106
@ ADE9113_SAWTOOTH_FREQUENCY_FALLING
Definition: ade9113.h:268
#define ADE9113_REG_EMI_HI_MASK
Definition: ade9113.h:81
int no_os_test_bit(int pos, const volatile void *addr)
Definition: no_os_util.h:138
int ade9113_get_iso_ecc_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_ECC_ERR indicator.
Definition: ade9113.c:2375
int ade9113_get_iso_phy_crc_err(struct ade9113_dev *dev, uint8_t *status)
Get ISO_PHY_CRC_ERR indicator.
Definition: ade9113.c:2205
#define ADE9113_RESET_DONE_MSK
Definition: ade9113.h:190
Header file of CRC-8 computation.
int ade9113_get_i_wav_ovrng(struct ade9113_dev *dev, uint8_t *status)
Get I_WAV_OVRNG indicator.
Definition: ade9113.c:2134
int ade9113_get_iso_dig_mod_i_ovf(struct ade9113_dev *dev, uint8_t *status)
Get ISO_DIG_MOD_I_OVF indicator.
Definition: ade9113.c:2301
#define ADE9113_ISO_PHY_CRC_ERR_MSK
Definition: ade9113.h:161
Error macro definition for ARM Compiler.
#define ADE9113_EFUSE_MEM_ERR_MSK
Definition: ade9113.h:191
int ade9113_enable_iso_dig_mod_i_ovf_int(struct ade9113_dev *dev)
Enable ISO_DIG_MOD_I_OVF interrupt.
Definition: ade9113.c:1742
int ade9113_convert_to_millivolts(struct ade9113_dev *dev, uint8_t dev_no, enum ade9113_wav_e ch, int32_t *mv_val)
Convert a 24-bit raw sample to millivolts.
Definition: ade9113.c:725
int ade9113_disable_iso_phy_crc_err_int(struct ade9113_dev *dev)
Disable ISO_PHY_CRC_ERR interrupt.
Definition: ade9113.c:1644
@ ADE9113_ZX_DISABLE
Definition: ade9113.h:296
int ade9113_get_statusx_val(struct ade9113_dev *dev, uint8_t addr, uint8_t *status)
Get STATUSx register value.
Definition: ade9113.c:1910
int ade9113_clear_crc_done_int(struct ade9113_dev *dev)
Clear the CRC_DONE int mask.
Definition: ade9113.c:2400
struct no_os_spi_init_param * spi_init
Definition: ade9113.h:336
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131
#define ADE9113_REG_STATUS0
Definition: ade9113.h:97
int ade9113_enable_status1x_int(struct ade9113_dev *dev)
Enable STATUS1X interrupt.
Definition: ade9113.c:1322
#define ADE9113_REG_I_WAV_HI
Definition: ade9113.h:103
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:81