feat(hal): graudate the PCNT hal driver into a new component

This commit is contained in:
Chen Jichang
2025-11-21 11:22:41 +08:00
committed by Chen Ji Chang
parent 8811f2ec07
commit c84773f307
44 changed files with 339 additions and 122 deletions
-4
View File
@@ -92,10 +92,6 @@ if(CONFIG_SOC_LEDC_SUPPORTED)
list(APPEND srcs "${target_folder}/ledc_periph.c")
endif()
if(CONFIG_SOC_PCNT_SUPPORTED)
list(APPEND srcs "${target_folder}/pcnt_periph.c")
endif()
if(CONFIG_SOC_RMT_SUPPORTED)
list(APPEND srcs "${target_folder}/rmt_periph.c")
endif()
@@ -13,12 +13,6 @@
#define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances
#define _SOC_CAPS_SDM_CHANS_PER_INST 8 // Number of channels in each SDM instance
/*--------------------------- PCNT (Pulse Counter) ------------------------*/
#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances
#define _SOC_CAPS_PCNT_UNITS_PER_INST 8 // Number of units in each PCNT instance
#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit
#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit
/*------------------------------- I2S ---------------------------------------*/
// helper macros to access module attributes
#define _SOC_CAPS_I2S_INST_NUM 2 // Number of I2S instances
+1 -1
View File
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/pcnt_periph.h"
#include "hal/pcnt_periph.h"
#include "soc/gpio_sig_map.h"
#include "soc/soc.h"
@@ -17,12 +17,6 @@
#define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances
#define _SOC_CAPS_SDM_CHANS_PER_INST 4 // Number of channels in each SDM instance
/*--------------------------- PCNT (Pulse Counter) ------------------------*/
#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances
#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance
#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit
#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit
/*------------------------------- I2S ---------------------------------------*/
// helper macros to access module attributes
#define _SOC_CAPS_I2S_INST_NUM 1 // Number of I2S instances
-70
View File
@@ -1,70 +0,0 @@
/*
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/pcnt_periph.h"
#include "soc/gpio_sig_map.h"
#include "soc/pcnt_reg.h"
const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = {
[0] = {
.irq_id = ETS_PCNT_INTR_SOURCE,
.module_name = "pcnt0",
.units = {
[0] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN0_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN0_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN0_IDX
},
[1] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN1_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN1_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN1_IDX
},
[2] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN2_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN2_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN2_IDX
},
[3] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN3_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN3_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN3_IDX
}
}
}
};
@@ -17,12 +17,6 @@
#define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances
#define _SOC_CAPS_SDM_CHANS_PER_INST 4 // Number of channels in each SDM instance
/*--------------------------- PCNT (Pulse Counter) ------------------------*/
#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances
#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance
#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit
#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit
/*------------------------------- I2S ---------------------------------------*/
// helper macros to access module attributes
#define _SOC_CAPS_I2S_INST_NUM 1 // Number of I2S instances
-66
View File
@@ -1,66 +0,0 @@
/*
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/pcnt_periph.h"
#include "soc/gpio_sig_map.h"
#include "soc/pcnt_reg.h"
const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = {
[0] = {
.irq_id = ETS_PCNT_INTR_SOURCE,
.module_name = "pcnt0",
.units = {
[0] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN0_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN0_IDX
}
}
},
[1] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN1_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN1_IDX
}
}
},
[2] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN2_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN2_IDX
}
}
},
[3] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN3_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN3_IDX
}
}
}
}
}
};
@@ -17,12 +17,6 @@
#define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances
#define _SOC_CAPS_SDM_CHANS_PER_INST 4 // Number of channels in each SDM instance
/*--------------------------- PCNT (Pulse Counter) ------------------------*/
#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances
#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance
#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit
#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit
/*------------------------------- I2S ---------------------------------------*/
// helper macros to access module attributes
#define _SOC_CAPS_I2S_INST_NUM 1 // Number of I2S instances
-66
View File
@@ -1,66 +0,0 @@
/*
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/pcnt_periph.h"
#include "soc/gpio_sig_map.h"
#include "soc/pcnt_reg.h"
const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = {
[0] = {
.irq_id = ETS_PCNT_INTR_SOURCE,
.module_name = "pcnt0",
.units = {
[0] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN0_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN0_IDX
}
}
},
[1] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN1_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN1_IDX
}
}
},
[2] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN2_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN2_IDX
}
}
},
[3] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN3_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN3_IDX
}
}
}
}
}
};
@@ -13,12 +13,6 @@
#define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances
#define _SOC_CAPS_SDM_CHANS_PER_INST 4 // Number of channels in each SDM instance
/*--------------------------- PCNT (Pulse Counter) ------------------------*/
#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances
#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance
#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit
#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit
/*------------------------------- I2S ---------------------------------------*/
// helper macros to access module attributes
// #define _SOC_CAPS_I2S_INST_NUM 1 // Number of I2S instances
-70
View File
@@ -1,70 +0,0 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/pcnt_periph.h"
#include "soc/gpio_sig_map.h"
#include "soc/pcnt_reg.h"
const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = {
[0] = {
.irq_id = ETS_PCNT_INTR_SOURCE,
.module_name = "pcnt0",
.units = {
[0] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN0_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN0_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN0_IDX
},
[1] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN1_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN1_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN1_IDX
},
[2] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN2_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN2_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN2_IDX
},
[3] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN3_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN3_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN3_IDX
}
}
}
};
@@ -13,12 +13,6 @@
#define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances
#define _SOC_CAPS_SDM_CHANS_PER_INST 4 // Number of channels in each SDM instance
/*--------------------------- PCNT (Pulse Counter) ------------------------*/
#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances
#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance
#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit
#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit
/*------------------------------- I2S ---------------------------------------*/
// helper macros to access module attributes
#define _SOC_CAPS_I2S_INST_NUM 1 // Number of I2S instances
-70
View File
@@ -1,70 +0,0 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/pcnt_periph.h"
#include "soc/gpio_sig_map.h"
#include "soc/pcnt_reg.h"
const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = {
[0] = {
.irq_id = ETS_PCNT_INTR_SOURCE,
.module_name = "pcnt0",
.units = {
[0] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN0_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN0_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN0_IDX
},
[1] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN1_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN1_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN1_IDX
},
[2] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN2_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN2_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN2_IDX
},
[3] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN3_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN3_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_IN3_IDX
}
}
}
};
@@ -17,12 +17,6 @@
#define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances
#define _SOC_CAPS_SDM_CHANS_PER_INST 8 // Number of channels in each SDM instance
/*--------------------------- PCNT (Pulse Counter) ------------------------*/
#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances
#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance
#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit
#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit
/*------------------------------- I2S ---------------------------------------*/
// helper macros to access module attributes
#define _SOC_CAPS_I2S_INST_NUM 3 // Number of I2S instances
-70
View File
@@ -1,70 +0,0 @@
/*
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/pcnt_periph.h"
#include "soc/gpio_sig_map.h"
#include "soc/pcnt_reg.h"
const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = {
[0] = {
.irq_id = ETS_PCNT_INTR_SOURCE,
.module_name = "pcnt0",
.units = {
[0] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_PAD_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_PAD_IN0_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_PAD_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_PAD_IN0_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_PAD_IN0_IDX
},
[1] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_PAD_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_PAD_IN1_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_PAD_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_PAD_IN1_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_PAD_IN1_IDX
},
[2] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_PAD_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_PAD_IN2_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_PAD_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_PAD_IN2_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_PAD_IN2_IDX
},
[3] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_PAD_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_PAD_IN3_IDX,
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_PAD_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_PAD_IN3_IDX
}
},
.clear_sig_id_matrix = PCNT_RST_PAD_IN3_IDX
}
}
}
};
@@ -13,12 +13,6 @@
#define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances
#define _SOC_CAPS_SDM_CHANS_PER_INST 8 // Number of channels in each SDM instance
/*--------------------------- PCNT (Pulse Counter) ------------------------*/
#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances
#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance
#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit
#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit
/*------------------------------- Dedicated GPIO ------------------------------*/
#define _SOC_CAPS_DEDIC_GPIO_OUT_CHANS_PER_CPU 8 /*!< 8 outward channels on each CPU core */
#define _SOC_CAPS_DEDIC_GPIO_IN_CHANS_PER_CPU 8 /*!< 8 inward channels on each CPU core */
-65
View File
@@ -1,65 +0,0 @@
/*
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/pcnt_periph.h"
#include "soc/gpio_sig_map.h"
const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = {
[0] = {
.irq_id = ETS_PCNT_INTR_SOURCE,
.module_name = "pcnt0",
.units = {
[0] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN0_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN0_IDX
}
}
},
[1] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN1_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN1_IDX
}
}
},
[2] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN2_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN2_IDX
}
}
},
[3] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN3_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN3_IDX
}
}
}
}
}
};
@@ -13,12 +13,6 @@
#define _SOC_CAPS_SDM_INST_NUM 1 // Number of SDM instances
#define _SOC_CAPS_SDM_CHANS_PER_INST 8 // Number of channels in each SDM instance
/*--------------------------- PCNT (Pulse Counter) ------------------------*/
#define _SOC_CAPS_PCNT_INST_NUM 1 // Number of PCNT instances
#define _SOC_CAPS_PCNT_UNITS_PER_INST 4 // Number of units in each PCNT instance
#define _SOC_CAPS_PCNT_CHANS_PER_UNIT 2 // Number of channels in each PCNT unit
#define _SOC_CAPS_PCNT_THRES_POINT_PER_UNIT 2 // Number of threshold points in each PCNT unit
/*------------------------------- Dedicated GPIO ------------------------------*/
#define _SOC_CAPS_DEDIC_GPIO_OUT_CHANS_PER_CPU 8 /*!< 8 outward channels on each CPU core */
#define _SOC_CAPS_DEDIC_GPIO_IN_CHANS_PER_CPU 8 /*!< 8 inward channels on each CPU core */
-65
View File
@@ -1,65 +0,0 @@
/*
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/pcnt_periph.h"
#include "soc/gpio_sig_map.h"
const soc_pcnt_signal_desc_t soc_pcnt_signals[1] = {
[0] = {
.irq_id = ETS_PCNT_INTR_SOURCE,
.module_name = "pcnt0",
.units = {
[0] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN0_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN0_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN0_IDX
}
}
},
[1] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN1_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN1_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN1_IDX
}
}
},
[2] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN2_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN2_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN2_IDX
}
}
},
[3] = {
.channels = {
[0] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH0_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH0_IN3_IDX
},
[1] = {
.ctl_sig_id_matrix = PCNT_CTRL_CH1_IN3_IDX,
.pulse_sig_id_matrix = PCNT_SIG_CH1_IN3_IDX
}
}
}
}
}
};
-41
View File
@@ -1,41 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include <stddef.h>
#include "soc/soc_caps_full.h"
#include "soc/interrupts.h"
// helper macros to access module attributes
#define SOC_PCNT_ATTR(_attr) SOC_MODULE_ATTR(PCNT, _attr)
#ifdef __cplusplus
extern "C" {
#endif
#if SOC_HAS(PCNT)
typedef struct {
const char *module_name; // module name
struct {
struct {
const int pulse_sig_id_matrix; // pulse signal ID in the GPIO matrix
const int ctl_sig_id_matrix; // control signal ID in the GPIO matrix
} channels[SOC_PCNT_ATTR(CHANS_PER_UNIT)];
const int clear_sig_id_matrix; // clear signal ID in the GPIO matrix
} units[SOC_PCNT_ATTR(UNITS_PER_INST)];
const int irq_id; // interrupt source ID
} soc_pcnt_signal_desc_t;
extern const soc_pcnt_signal_desc_t soc_pcnt_signals[SOC_PCNT_ATTR(INST_NUM)];
#endif // SOC_HAS(PCNT)
#ifdef __cplusplus
}
#endif