mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
refactor(esp_hal_regi2c): move regi2c implementation from esp_rom to esp_hal_regi2c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*/
|
||||
@@ -13,8 +13,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef volatile struct sens_dev_s {
|
||||
union {
|
||||
typedef struct sens_dev_t {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t sar1_clk_div : 8; /*clock divider*/
|
||||
uint32_t reserved8 : 10;
|
||||
@@ -27,8 +27,8 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_reader1_ctrl;
|
||||
uint32_t sar_reader1_status;
|
||||
union {
|
||||
volatile uint32_t sar_reader1_status;
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t reserved0 : 24;
|
||||
uint32_t force_xpd_amp : 2;
|
||||
@@ -38,7 +38,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_meas1_ctrl1;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t meas1_data_sar : 16; /*SAR ADC1 data*/
|
||||
uint32_t meas1_done_sar : 1; /*SAR ADC1 conversion done indication*/
|
||||
@@ -49,22 +49,22 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_meas1_ctrl2;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t reserved0 : 31;
|
||||
uint32_t sar1_dig_force : 1; /*1: SAR ADC1 controlled by DIG ADC1 CTRL*/
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_meas1_mux;
|
||||
uint32_t sar_atten1;
|
||||
union {
|
||||
volatile uint32_t sar_atten1;
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t sar_amp_wait1 : 16;
|
||||
uint32_t sar_amp_wait2 : 16;
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_amp_ctrl1;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t sar1_dac_xpd_fsm_idle : 1;
|
||||
uint32_t xpd_sar_amp_fsm_idle : 1;
|
||||
@@ -78,7 +78,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_amp_ctrl2;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t sar1_dac_xpd_fsm : 4;
|
||||
uint32_t xpd_sar_amp_fsm : 4;
|
||||
@@ -91,7 +91,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_amp_ctrl3;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t sar2_clk_div : 8; /*clock divider*/
|
||||
uint32_t reserved8 : 8;
|
||||
@@ -105,8 +105,8 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_reader2_ctrl;
|
||||
uint32_t sar_reader2_status;
|
||||
union {
|
||||
volatile uint32_t sar_reader2_status;
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t sar2_cntl_state : 3; /*saradc2_cntl_fsm*/
|
||||
uint32_t sar2_pwdet_cal_en : 1; /*rtc control pwdet enable*/
|
||||
@@ -119,7 +119,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_meas2_ctrl1;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t meas2_data_sar : 16; /*SAR ADC2 data*/
|
||||
uint32_t meas2_done_sar : 1; /*SAR ADC2 conversion done indication*/
|
||||
@@ -130,7 +130,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_meas2_ctrl2;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t reserved0 : 28;
|
||||
uint32_t sar2_pwdet_cct : 3; /*SAR2_PWDET_CCT*/
|
||||
@@ -138,8 +138,8 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_meas2_mux;
|
||||
uint32_t sar_atten2;
|
||||
union {
|
||||
volatile uint32_t sar_atten2;
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t reserved0 : 29;
|
||||
uint32_t force_xpd_sar : 2;
|
||||
@@ -147,7 +147,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_power_xpd_sar;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t i2c_slave_addr1 : 11;
|
||||
uint32_t i2c_slave_addr0 : 11;
|
||||
@@ -156,7 +156,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_slave_addr1;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t i2c_slave_addr3 : 11;
|
||||
uint32_t i2c_slave_addr2 : 11;
|
||||
@@ -164,7 +164,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_slave_addr2;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t i2c_slave_addr5 : 11;
|
||||
uint32_t i2c_slave_addr4 : 11;
|
||||
@@ -172,7 +172,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_slave_addr3;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t i2c_slave_addr7 : 11;
|
||||
uint32_t i2c_slave_addr6 : 11;
|
||||
@@ -180,7 +180,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_slave_addr4;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t tsens_out : 8; /*temperature sensor data out*/
|
||||
uint32_t tsens_ready : 1; /*indicate temperature sensor out ready*/
|
||||
@@ -195,7 +195,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_tctrl;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t tsens_xpd_wait : 12;
|
||||
uint32_t tsens_xpd_force : 2;
|
||||
@@ -204,7 +204,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_tctrl2;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t sar_i2c_ctrl : 28; /*I2C control data*/
|
||||
uint32_t sar_i2c_start : 1; /*start I2C*/
|
||||
@@ -213,7 +213,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_i2c_ctrl;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_outen : 15; /*touch controller output enable*/
|
||||
uint32_t touch_status_clr : 1; /*clear all touch active status*/
|
||||
@@ -226,21 +226,21 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_touch_conf;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_denoise_data : 22;
|
||||
uint32_t reserved22 : 10;
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_touch_denoise;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t thresh : 22; /*Finger threshold for touch pad 1*/
|
||||
uint32_t reserved22 : 10;
|
||||
};
|
||||
uint32_t val;
|
||||
} touch_thresh[14];
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_pad_active : 15; /*touch active status*/
|
||||
uint32_t touch_channel_clr : 15; /*Clear touch channel*/
|
||||
@@ -249,7 +249,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_touch_chn_st;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_denoise_data : 22; /*the counter for touch pad 0*/
|
||||
uint32_t touch_scan_curr : 4;
|
||||
@@ -257,7 +257,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_touch_status0;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_pad_data : 22;
|
||||
uint32_t reserved22 : 7;
|
||||
@@ -265,7 +265,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_touch_status[14];
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_slp_data : 22;
|
||||
uint32_t reserved22 : 7;
|
||||
@@ -273,7 +273,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_touch_slp_status;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_approach_pad2_cnt : 8;
|
||||
uint32_t touch_approach_pad1_cnt : 8;
|
||||
@@ -282,7 +282,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_touch_appr_status;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t reserved0 : 25;
|
||||
uint32_t dbg_trigger : 1; /*trigger cocpu debug registers*/
|
||||
@@ -295,7 +295,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_cocpu_state;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_done : 1; /*int from touch done*/
|
||||
uint32_t touch_inactive : 1; /*int from touch inactive*/
|
||||
@@ -313,7 +313,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_cocpu_int_raw;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_done : 1;
|
||||
uint32_t touch_inactive : 1;
|
||||
@@ -331,7 +331,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_cocpu_int_ena;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_done : 1;
|
||||
uint32_t touch_inactive : 1;
|
||||
@@ -349,7 +349,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_cocpu_int_st;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_done : 1;
|
||||
uint32_t touch_inactive : 1;
|
||||
@@ -367,7 +367,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_cocpu_int_clr;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t pc : 13; /*cocpu Program counter*/
|
||||
uint32_t mem_vld : 1; /*cocpu mem valid output*/
|
||||
@@ -377,7 +377,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_cocpu_debug;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t reserved0 : 28;
|
||||
uint32_t xpd_hall : 1; /*Power on hall sensor and connect to VP and VN*/
|
||||
@@ -387,8 +387,8 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_hall_ctrl;
|
||||
uint32_t sar_nouse;
|
||||
union {
|
||||
volatile uint32_t sar_nouse;
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t reserved0 : 27;
|
||||
uint32_t rtc_i2c_clk_en : 1;
|
||||
@@ -399,7 +399,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_peri_clk_gate_conf;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t reserved0 : 25;
|
||||
uint32_t reset : 1;
|
||||
@@ -412,7 +412,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_peri_reset_conf;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_done_w1ts : 1;
|
||||
uint32_t touch_inactive_w1ts : 1;
|
||||
@@ -430,7 +430,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_cocpu_int_ena_w1ts;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t touch_done_w1tc : 1;
|
||||
uint32_t touch_inactive_w1tc : 1;
|
||||
@@ -448,7 +448,7 @@ typedef volatile struct sens_dev_s {
|
||||
};
|
||||
uint32_t val;
|
||||
} sar_cocpu_int_ena_w1tc;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t debug_bit_sel : 5;
|
||||
uint32_t reserved5 : 27;
|
||||
@@ -512,7 +512,7 @@ typedef volatile struct sens_dev_s {
|
||||
uint32_t reserved_1f0;
|
||||
uint32_t reserved_1f4;
|
||||
uint32_t reserved_1f8;
|
||||
union {
|
||||
volatile union {
|
||||
struct {
|
||||
uint32_t sar_date : 28;
|
||||
uint32_t reserved28 : 4;
|
||||
|
||||
Reference in New Issue
Block a user