diff --git a/components/esp_hw_support/debug_probe/debug_probe.c b/components/esp_hw_support/debug_probe/debug_probe.c index 586a1c69d33..6dd56b6061a 100644 --- a/components/esp_hw_support/debug_probe/debug_probe.c +++ b/components/esp_hw_support/debug_probe/debug_probe.c @@ -224,8 +224,7 @@ esp_err_t debug_probe_chan_add_signal_by_byte(debug_probe_channel_handle_t chan, { ESP_RETURN_ON_FALSE(chan, ESP_ERR_INVALID_ARG, TAG, "invalid args"); debug_probe_unit_t *unit = chan->unit; - ESP_RETURN_ON_FALSE(byte_idx < ((unit->unit_id == DEBUG_PROBE_UNIT_LP) ? 2 : 4), - ESP_ERR_INVALID_ARG, TAG, "byte_idx out of range"); + ESP_RETURN_ON_FALSE(byte_idx < 4, ESP_ERR_INVALID_ARG, TAG, "byte_idx out of range"); ESP_RETURN_ON_FALSE(sig_group < 16, ESP_ERR_INVALID_ARG, TAG, "sig_group out of range"); debug_probe_ll_channel_add_signal_group(unit->unit_id, chan->chan_id, byte_idx, sig_group); return ESP_OK; diff --git a/components/esp_hw_support/debug_probe/include/esp_private/debug_probe.h b/components/esp_hw_support/debug_probe/include/esp_private/debug_probe.h index 50396c32189..6ed4a47f7de 100644 --- a/components/esp_hw_support/debug_probe/include/esp_private/debug_probe.h +++ b/components/esp_hw_support/debug_probe/include/esp_private/debug_probe.h @@ -66,7 +66,7 @@ esp_err_t debug_probe_del_unit(debug_probe_unit_handle_t unit); */ typedef struct { union { - debug_probe_target_t hp_target; ///< Target when unit is HP + debug_probe_target_hp_t hp_target; ///< Target when unit is HP debug_probe_target_lp_t lp_target; ///< Target when unit is LP } target_module; } debug_probe_channel_config_t; @@ -106,10 +106,10 @@ esp_err_t debug_probe_del_channel(debug_probe_channel_handle_t chan); * byte_idx = 1: signal 8-15 in the group * ... * @note If you add the signals from different groups but with the same byte_idx, only the last added signal will be effective. - * @note You can save up to 32 signals in a channel, but in the end, only the part of them (e.g. upper or lower 16 signals) can be output to the GPIO pads. + * @note You can save up to 32 signals in a channel, but only 16 of them can be routed to GPIO pads at a time. * * @param[in] chan Handle of the debug probe channel - * @param[in] byte_idx Byte index (HP: 0-3, LP: 0-1) + * @param[in] byte_idx Byte index (0-3) * @param[in] sig_group Signal group of the signal, ranges from 0 to 15 * @return * - ESP_OK on success diff --git a/components/esp_hw_support/debug_probe/include/esp_private/debug_probe_types.h b/components/esp_hw_support/debug_probe/include/esp_private/debug_probe_types.h index 49d700a3fe5..a12967bd32b 100644 --- a/components/esp_hw_support/debug_probe/include/esp_private/debug_probe_types.h +++ b/components/esp_hw_support/debug_probe/include/esp_private/debug_probe_types.h @@ -22,12 +22,12 @@ extern "C" { #if SOC_DEBUG_PROBE_SUPPORTED #define DEBUG_PROBE_MAX_OUTPUT_WIDTH SOC_DEBUG_PROBE_MAX_OUTPUT_WIDTH #define DEBUG_PROBE_GPIO_NUMS_NONE { [0 ... (SOC_DEBUG_PROBE_MAX_OUTPUT_WIDTH - 1)] = -1 } -typedef soc_debug_probe_target_t debug_probe_target_t; +typedef soc_debug_probe_target_hp_t debug_probe_target_hp_t; typedef soc_debug_probe_target_lp_t debug_probe_target_lp_t; #else #define DEBUG_PROBE_MAX_OUTPUT_WIDTH 16 #define DEBUG_PROBE_GPIO_NUMS_NONE { [0 ... 15] = -1 } -typedef int debug_probe_target_t; +typedef int debug_probe_target_hp_t; typedef int debug_probe_target_lp_t; #endif diff --git a/components/esp_hw_support/power_supply/vbat.c b/components/esp_hw_support/power_supply/vbat.c index 079715af97d..200857acdab 100644 --- a/components/esp_hw_support/power_supply/vbat.c +++ b/components/esp_hw_support/power_supply/vbat.c @@ -193,7 +193,7 @@ esp_err_t esp_vbat_init(void) #endif ESP_ERROR_CHECK(debug_probe_new_unit(&unit_config, &lp_probe_hdl)); ESP_ERROR_CHECK(debug_probe_new_channel(lp_probe_hdl, &chan_config, &lp_probe_channel_hdl)); - ESP_ERROR_CHECK(debug_probe_chan_add_signal_by_byte(lp_probe_channel_hdl, 1, DEBUG_PROBE_TARGET_LP_PMU)); + ESP_ERROR_CHECK(debug_probe_chan_add_signal_by_byte(lp_probe_channel_hdl, 1, 0)); ESP_ERROR_CHECK(debug_probe_unit_merge16(lp_probe_hdl, lp_probe_channel_hdl, DEBUG_PROBE_SPLIT_UPPER16, NULL, 0)); } // The LP Probe & LP IOMUX pathways depend on the LP_PERIPH power domain. diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_debug_probe.c b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_debug_probe.c index 0aa09aeb085..02bf4c3e231 100644 --- a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_debug_probe.c +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_debug_probe.c @@ -34,9 +34,9 @@ TEST_CASE("debug probe install & uninstall", "[debug_probe]") for (int i = 0; i < SOC_DEBUG_PROBE_NUM_UNIT; i++) { debug_probe_channel_config_t chan_config = {0}; if (i == 0) { - chan_config.target_module.hp_target = DEBUG_PROBE_TARGET_AXI_GDMA; + chan_config.target_module.hp_target = DEBUG_PROBE_TARGET_HP_CORE; } else { - chan_config.target_module.lp_target = DEBUG_PROBE_TARGET_LP_PMU; + chan_config.target_module.lp_target = DEBUG_PROBE_TARGET_LP_CORE; } for (int j = 0; j < DEBUG_PROBE_LL_CHANNELS_PER_UNIT; j++) { TEST_ESP_OK(debug_probe_new_channel(probe_units[i], &chan_config, &probe_chans[i][j])); @@ -52,7 +52,7 @@ TEST_CASE("debug probe install & uninstall", "[debug_probe]") } } -TEST_CASE("debug probe read", "[debug_probe]") +TEST_CASE("debug probe HP read", "[debug_probe]") { debug_probe_unit_config_t unit_config = { .unit_id = DEBUG_PROBE_UNIT_HP, @@ -63,9 +63,13 @@ TEST_CASE("debug probe read", "[debug_probe]") // allocate two channels from the unit, each channel monitor different target module debug_probe_channel_handle_t probe_chans[2] = {0}; + const debug_probe_target_hp_t targets[2] = { + DEBUG_PROBE_TARGET_HP_MSPI_FLASH, + DEBUG_PROBE_TARGET_HP_CORE, + }; for (int i = 0; i < 2; i++) { debug_probe_channel_config_t chan_config = {0}; - chan_config.target_module.hp_target = (debug_probe_target_t)(i + 1); + chan_config.target_module.hp_target = targets[i]; TEST_ESP_OK(debug_probe_new_channel(probe_unit, &chan_config, &probe_chans[i])); // group15[7:0] contains the debug target module ID @@ -81,7 +85,7 @@ TEST_CASE("debug probe read", "[debug_probe]") uint32_t probe_result = 0; TEST_ESP_OK(debug_probe_unit_read(probe_unit, &probe_result)); printf("probe result: 0x%"PRIx32"\r\n", probe_result); - TEST_ASSERT_EQUAL_HEX32(0x20001, probe_result); + TEST_ASSERT_EQUAL_HEX32(0xE0006, probe_result); // free resources for (int i = 0; i < 2; i++) { @@ -89,3 +93,42 @@ TEST_CASE("debug probe read", "[debug_probe]") } TEST_ESP_OK(debug_probe_del_unit(probe_unit)); } + +TEST_CASE("debug probe LP read", "[debug_probe]") +{ + debug_probe_unit_config_t unit_config = { + .unit_id = DEBUG_PROBE_UNIT_LP, + .probe_out_gpio_nums = DEBUG_PROBE_GPIO_NUMS_NONE, + }; + debug_probe_unit_handle_t probe_unit = NULL; + TEST_ESP_OK(debug_probe_new_unit(&unit_config, &probe_unit)); + + debug_probe_channel_handle_t probe_chans[2] = {0}; + const debug_probe_target_lp_t targets[2] = { + DEBUG_PROBE_TARGET_LP_PMU, + DEBUG_PROBE_TARGET_LP_CORE, + }; + for (int i = 0; i < 2; i++) { + debug_probe_channel_config_t chan_config = {0}; + chan_config.target_module.lp_target = targets[i]; + TEST_ESP_OK(debug_probe_new_channel(probe_unit, &chan_config, &probe_chans[i])); + + TEST_ESP_OK(debug_probe_chan_add_signal_by_byte(probe_chans[i], 0, 15)); + TEST_ESP_OK(debug_probe_chan_add_signal_by_byte(probe_chans[i], 1, 15)); + TEST_ESP_OK(debug_probe_chan_add_signal_by_byte(probe_chans[i], 2, 15)); + TEST_ESP_OK(debug_probe_chan_add_signal_by_byte(probe_chans[i], 3, 15)); + } + + TEST_ESP_OK(debug_probe_unit_merge16(probe_unit, + probe_chans[0], DEBUG_PROBE_SPLIT_LOWER16, + probe_chans[1], DEBUG_PROBE_SPLIT_LOWER16)); + uint32_t probe_result = 0; + TEST_ESP_OK(debug_probe_unit_read(probe_unit, &probe_result)); + printf("LP probe result: 0x%"PRIx32"\r\n", probe_result); + TEST_ASSERT_EQUAL_HEX32(0x1F0025, probe_result); + + for (int i = 0; i < 2; i++) { + TEST_ESP_OK(debug_probe_del_channel(probe_chans[i])); + } + TEST_ESP_OK(debug_probe_del_unit(probe_unit)); +} diff --git a/components/hal/esp32p4/include/hal/debug_probe_ll.h b/components/hal/esp32p4/include/hal/debug_probe_ll.h index 2f0bab979ba..37b1ed09a51 100644 --- a/components/hal/esp32p4/include/hal/debug_probe_ll.h +++ b/components/hal/esp32p4/include/hal/debug_probe_ll.h @@ -133,20 +133,22 @@ static inline void debug_probe_ll_set_lower16_output(debug_probe_unit_id_t unit_ * @brief Set the upper 16 bits of the probe output * * @param part where does the probe_top_out[31:16] come from - * @note No-op for LP unit: only 16 bits are routed to LP GPIO, so upper 16 selection has no effect. + * @note Only probe_top_out[15:0] can be routed to GPIO pads, but both HP and LP units still keep a 32-bit probe_top_out register. */ static inline void debug_probe_ll_set_upper16_output(debug_probe_unit_id_t unit_id, int channel, debug_probe_split_u16_t part) { - if (unit_id != DEBUG_PROBE_UNIT_HP) { - return; /* LP has only 16 bits to GPIO; probe_top_out[31:16] is not routed */ + uint8_t val = (uint8_t)(channel * 2 + DEBUG_PROBE_LL_PART_TO_REG_VAL(part)); + if (unit_id == DEBUG_PROBE_UNIT_HP) { + HP_SYSTEM.probea_ctrl.reg_probe_h_sel = val; + } else { + LP_SYS.lp_probea_ctrl.probe_h_sel = val; } - HP_SYSTEM.probea_ctrl.reg_probe_h_sel = channel * 2 + DEBUG_PROBE_LL_PART_TO_REG_VAL(part); } /** * @brief Read the value that currently being probed * - * @note ESP32P4 can only route the LSB probe_top_out[15:0] to the GPIO pad. But the register still saves 32 signal bits. + * @note Can only route the LSB probe_top_out[15:0] to the GPIO pad. But the register still saves 32 signal bits. * * @return the value that currently being probed */ diff --git a/components/hal/esp32s31/include/hal/debug_probe_ll.h b/components/hal/esp32s31/include/hal/debug_probe_ll.h new file mode 100644 index 00000000000..37b1ed09a51 --- /dev/null +++ b/components/hal/esp32s31/include/hal/debug_probe_ll.h @@ -0,0 +1,166 @@ +/* + * SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include +#include +#include +#include "hal/misc.h" +#include "hal/assert.h" +#include "soc/hp_system_struct.h" +#include "soc/lp_system_struct.h" +#include "hal/debug_probe_types.h" + +/** + * @brief Define how many channels are there in one debug probe unit + */ +#define DEBUG_PROBE_LL_CHANNELS_PER_UNIT 2 + +#ifdef __cplusplus +extern "C" { +#endif + +// translate the HAL types into register values +#define DEBUG_PROBE_LL_PART_TO_REG_VAL(part) ((uint8_t[]) {0, 1}[(part)]) + +/** + * @brief Enable the debug probe module + * + * @param unit_id unit identifier, see debug_probe_unit_id_t + * @param en true: enable, false: disable + */ +static inline void debug_probe_ll_enable_unit(debug_probe_unit_id_t unit_id, bool en) +{ + if (unit_id == DEBUG_PROBE_UNIT_HP) { + HP_SYSTEM.probea_ctrl.reg_probe_global_en = en; + } else { + LP_SYS.lp_probea_ctrl.probe_global_en = en; + } +} + +/** + * @brief Enable a specific channel in the debug probe unit + * + * @param unit_id unit identifier, see debug_probe_unit_id_t + * @param channel channel number (only support 0 and 1) + * @param en true: enable, false: disable + */ +static inline void debug_probe_ll_enable_channel(debug_probe_unit_id_t unit_id, int channel, bool en) +{ + // channel 0 is always enabled + if (channel == 1) { + if (unit_id == DEBUG_PROBE_UNIT_HP) { + HP_SYSTEM.probeb_ctrl.reg_probe_b_en = en; + } else { + LP_SYS.lp_probeb_ctrl.probe_b_en = en; + } + } +} + +/** + * @brief Set the target module for a probe channel + * + * @param unit_id unit identifier, see debug_probe_unit_id_t + * @param channel channel number (only support 0 and 1) + * @param target_module HP: soc_debug_probe_target_t, LP: soc_debug_probe_target_lp_t + */ +static inline void debug_probe_ll_channel_set_target_module(debug_probe_unit_id_t unit_id, uint8_t channel, uint8_t target_module) +{ + if (channel == 0) { + if (unit_id == DEBUG_PROBE_UNIT_HP) { + HP_SYSTEM.probea_ctrl.reg_probe_a_top_sel = target_module; + } else { + LP_SYS.lp_probea_ctrl.probe_a_top_sel = target_module; + } + } else { + if (unit_id == DEBUG_PROBE_UNIT_HP) { + HP_SYSTEM.probeb_ctrl.reg_probe_b_top_sel = target_module; + } else { + LP_SYS.lp_probeb_ctrl.probe_b_top_sel = target_module; + } + } +} + +/** + * @brief Add signals from a specific group to the probe channel + * + * @note One sig_group contains 4 bytes of signals. The sig_byte_idx is used to select the byte in the sig_group. + * + * @param channel channel number (only support 0 and 1) + * @param sig_byte_idx signal byte index (0-3) + * @param sig_group signal group (0-15) + */ +static inline void debug_probe_ll_channel_add_signal_group(debug_probe_unit_id_t unit_id, uint8_t channel, uint8_t sig_byte_idx, uint8_t sig_group) +{ + if (unit_id == DEBUG_PROBE_UNIT_HP) { + if (channel == 0) { + HP_SYSTEM.probea_ctrl.reg_probe_a_mod_sel &= ~(0xf << (sig_byte_idx * 4)); + HP_SYSTEM.probea_ctrl.reg_probe_a_mod_sel |= (sig_group << (sig_byte_idx * 4)); + } else { + HP_SYSTEM.probeb_ctrl.reg_probe_b_mod_sel &= ~(0xf << (sig_byte_idx * 4)); + HP_SYSTEM.probeb_ctrl.reg_probe_b_mod_sel |= (sig_group << (sig_byte_idx * 4)); + } + } else { + if (channel == 0) { + LP_SYS.lp_probea_ctrl.probe_a_mod_sel &= ~(0xf << (sig_byte_idx * 4)); + LP_SYS.lp_probea_ctrl.probe_a_mod_sel |= (sig_group << (sig_byte_idx * 4)); + } else { + LP_SYS.lp_probeb_ctrl.probe_b_mod_sel &= ~(0xf << (sig_byte_idx * 4)); + LP_SYS.lp_probeb_ctrl.probe_b_mod_sel |= (sig_group << (sig_byte_idx * 4)); + } + } +} + +/** + * @brief Set the lower 16 bits of the probe output + * + * @param part where does the probe_top_out[15:0] come from + */ +static inline void debug_probe_ll_set_lower16_output(debug_probe_unit_id_t unit_id, int channel, debug_probe_split_u16_t part) +{ + uint8_t val = (uint8_t)(channel * 2 + DEBUG_PROBE_LL_PART_TO_REG_VAL(part)); + if (unit_id == DEBUG_PROBE_UNIT_HP) { + HP_SYSTEM.probea_ctrl.reg_probe_l_sel = val; + } else { + LP_SYS.lp_probea_ctrl.probe_l_sel = val; + } +} + +/** + * @brief Set the upper 16 bits of the probe output + * + * @param part where does the probe_top_out[31:16] come from + * @note Only probe_top_out[15:0] can be routed to GPIO pads, but both HP and LP units still keep a 32-bit probe_top_out register. + */ +static inline void debug_probe_ll_set_upper16_output(debug_probe_unit_id_t unit_id, int channel, debug_probe_split_u16_t part) +{ + uint8_t val = (uint8_t)(channel * 2 + DEBUG_PROBE_LL_PART_TO_REG_VAL(part)); + if (unit_id == DEBUG_PROBE_UNIT_HP) { + HP_SYSTEM.probea_ctrl.reg_probe_h_sel = val; + } else { + LP_SYS.lp_probea_ctrl.probe_h_sel = val; + } +} + +/** + * @brief Read the value that currently being probed + * + * @note Can only route the LSB probe_top_out[15:0] to the GPIO pad. But the register still saves 32 signal bits. + * + * @return the value that currently being probed + */ +static inline uint32_t debug_probe_ll_read_output(debug_probe_unit_id_t unit_id) +{ + if (unit_id == DEBUG_PROBE_UNIT_HP) { + return HP_SYSTEM.probe_out.reg_probe_top_out; + } else { + return LP_SYS.lp_probe_out.probe_top_out; + } +} + +#ifdef __cplusplus +} +#endif diff --git a/components/soc/esp32p4/include/soc/debug_probe_targets.h b/components/soc/esp32p4/include/soc/debug_probe_targets.h index 25736f33b1a..349f47044e8 100644 --- a/components/soc/esp32p4/include/soc/debug_probe_targets.h +++ b/components/soc/esp32p4/include/soc/debug_probe_targets.h @@ -11,46 +11,44 @@ extern "C" { #endif /** - * @brief Target module that we want to attach the probe to - * - * @note The target module ID can be obtained from the prob_grp15[7:0] + * @brief Target module that we want to attach the HP probe to */ typedef enum { - DEBUG_PROBE_TARGET_MIPI_CSI_HOST = 0, // MIPI CSI Host - DEBUG_PROBE_TARGET_AXI_GDMA = 1, // AXI GDMA - DEBUG_PROBE_TARGET_I3C = 2, // I3C - DEBUG_PROBE_TARGET_HP_TCM = 3, // HP TCM Memory - DEBUG_PROBE_TARGET_USB_OTG_FS = 4, // USB OTG FS (1.1) - DEBUG_PROBE_TARGET_MIPI_CSI_BRG = 5, // MIPI CSI Bridge - DEBUG_PROBE_TARGET_MSPI_PSRAM = 6, // MSPI PSRAM - DEBUG_PROBE_TARGET_MIPI_DSI_BRG = 7, // MIPI DSI Bridge - DEBUG_PROBE_TARGET_DW_GDMA = 8, // DW GDMA - DEBUG_PROBE_TARGET_AXI_ICM = 9, // AXI ICM matrix - DEBUG_PROBE_TARGET_L2_MEM = 10, // L2 Memory - DEBUG_PROBE_TARGET_BIT_SCRAMBLER = 11, // Bit Scrambler - DEBUG_PROBE_TARGET_MSPI_FLASH = 12, // MSPI Flash - DEBUG_PROBE_TARGET_L1_CACHE = 13, // L1 Cache - DEBUG_PROBE_TARGET_HP_CORE = 14, // HP Core - DEBUG_PROBE_TARGET_L2_CACHE = 15, // L2 Cache - DEBUG_PROBE_TARGET_LP_PROBE_IN = 16, // LP System Probe In - DEBUG_PROBE_TARGET_USJ = 17, // USB Serial JTAG - DEBUG_PROBE_TARGET_EMAC = 18, // EMAC - DEBUG_PROBE_TARGET_JPEG = 19, // JPEG - DEBUG_PROBE_TARGET_PPA = 20, // PPA - DEBUG_PROBE_TARGET_DMA2D = 21, // DMA2D - DEBUG_PROBE_TARGET_LEDC = 22, // LEDC - DEBUG_PROBE_TARGET_SDMMC = 23, // SDMMC - DEBUG_PROBE_TARGET_ISP = 24, // ISP - DEBUG_PROBE_TARGET_USB_OTG_HS = 25, // USB OTG HS (2.0) - DEBUG_PROBE_TARGET_H264 = 26, // H264 - DEBUG_PROBE_TARGET_MCPWM0 = 27, // MCPWM0 - DEBUG_PROBE_TARGET_MCPWM1 = 28, // MCPWM1 - DEBUG_PROBE_TARGET_REGDMA = 29, // REGDMA - DEBUG_PROBE_TARGET_PVT = 30, // PVT -} soc_debug_probe_target_t; + DEBUG_PROBE_TARGET_HP_MIPI_CSI_HOST = 0, // MIPI CSI Host + DEBUG_PROBE_TARGET_HP_AXI_GDMA = 1, // AXI GDMA + DEBUG_PROBE_TARGET_HP_I3C = 2, // I3C + DEBUG_PROBE_TARGET_HP_TCM = 3, // HP TCM Memory + DEBUG_PROBE_TARGET_HP_USB_OTG_FS = 4, // USB OTG FS (1.1) + DEBUG_PROBE_TARGET_HP_MIPI_CSI_BRG = 5, // MIPI CSI Bridge + DEBUG_PROBE_TARGET_HP_MSPI_PSRAM = 6, // MSPI PSRAM + DEBUG_PROBE_TARGET_HP_MIPI_DSI_BRG = 7, // MIPI DSI Bridge + DEBUG_PROBE_TARGET_HP_DW_GDMA = 8, // DW GDMA + DEBUG_PROBE_TARGET_HP_AXI_ICM = 9, // AXI ICM matrix + DEBUG_PROBE_TARGET_HP_L2_MEM = 10, // L2 Memory + DEBUG_PROBE_TARGET_HP_BIT_SCRAMBLER = 11, // Bit Scrambler + DEBUG_PROBE_TARGET_HP_MSPI_FLASH = 12, // MSPI Flash + DEBUG_PROBE_TARGET_HP_L1_CACHE = 13, // L1 Cache + DEBUG_PROBE_TARGET_HP_CORE = 14, // HP Core + DEBUG_PROBE_TARGET_HP_L2_CACHE = 15, // L2 Cache + DEBUG_PROBE_TARGET_HP_LP_PROBE_IN = 16, // LP System Probe In + DEBUG_PROBE_TARGET_HP_USJ = 17, // USB Serial JTAG + DEBUG_PROBE_TARGET_HP_EMAC = 18, // EMAC + DEBUG_PROBE_TARGET_HP_JPEG = 19, // JPEG + DEBUG_PROBE_TARGET_HP_PPA = 20, // PPA + DEBUG_PROBE_TARGET_HP_DMA2D = 21, // DMA2D + DEBUG_PROBE_TARGET_HP_LEDC0 = 22, // LEDC0 + DEBUG_PROBE_TARGET_HP_SDMMC = 23, // SDMMC + DEBUG_PROBE_TARGET_HP_ISP = 24, // ISP + DEBUG_PROBE_TARGET_HP_USB_OTG_HS = 25, // USB OTG HS (2.0) + DEBUG_PROBE_TARGET_HP_H264 = 26, // H264 + DEBUG_PROBE_TARGET_HP_MCPWM0 = 27, // MCPWM0 + DEBUG_PROBE_TARGET_HP_MCPWM1 = 28, // MCPWM1 + DEBUG_PROBE_TARGET_HP_REGDMA = 29, // REGDMA + DEBUG_PROBE_TARGET_HP_PVT = 30, // PVT +} soc_debug_probe_target_hp_t; /** - * @brief LP probe target module (probe_a_top_sel 0..10) + * @brief Target module that we want to attach the LP probe to */ typedef enum { DEBUG_PROBE_TARGET_LP_PMU = 0, // LP PMU @@ -62,8 +60,8 @@ typedef enum { DEBUG_PROBE_TARGET_LP_TOUCH = 6, // LP Touch DEBUG_PROBE_TARGET_LP_ANA_PERI = 7, // LP Analog Peripherals DEBUG_PROBE_TARGET_LP_AON_CLKRST = 8, // LP AON Clock/Reset - DEBUG_PROBE_TARGET_LP_SYS_MISC = 9, // LP System Misc - DEBUG_PROBE_TARGET_LP_SYS_PROBE_IN = 10, // LP System Probe In + DEBUG_PROBE_TARGET_LP_MISC = 9, // LP System Misc + DEBUG_PROBE_TARGET_LP_HP_PROBE_IN = 10, // HP System Probe In } soc_debug_probe_target_lp_t; #ifdef __cplusplus diff --git a/components/soc/esp32s31/debug_probe_periph.c b/components/soc/esp32s31/debug_probe_periph.c new file mode 100644 index 00000000000..bec4a2d1be9 --- /dev/null +++ b/components/soc/esp32s31/debug_probe_periph.c @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + */ + +#include "soc/gpio_sig_map.h" +#include "soc/lp_gpio_sig_map.h" +#include "soc/debug_probe_periph.h" + +const debug_probe_signal_conn_t debug_probe_periph_signals = { + .units = { + [0] = { + .out_sig = { + [0] = HP_PROBE_TOP_OUT0_IDX, + [1] = HP_PROBE_TOP_OUT1_IDX, + [2] = HP_PROBE_TOP_OUT2_IDX, + [3] = HP_PROBE_TOP_OUT3_IDX, + [4] = HP_PROBE_TOP_OUT4_IDX, + [5] = HP_PROBE_TOP_OUT5_IDX, + [6] = HP_PROBE_TOP_OUT6_IDX, + [7] = HP_PROBE_TOP_OUT7_IDX, + [8] = HP_PROBE_TOP_OUT8_IDX, + [9] = HP_PROBE_TOP_OUT9_IDX, + [10] = HP_PROBE_TOP_OUT10_IDX, + [11] = HP_PROBE_TOP_OUT11_IDX, + [12] = HP_PROBE_TOP_OUT12_IDX, + [13] = HP_PROBE_TOP_OUT13_IDX, + [14] = HP_PROBE_TOP_OUT14_IDX, + [15] = HP_PROBE_TOP_OUT15_IDX, + } + }, + [1] = { + .out_sig = { + [0] = LP_PROBE_TOP_OUT0_IDX, + [1] = LP_PROBE_TOP_OUT1_IDX, + [2] = LP_PROBE_TOP_OUT2_IDX, + [3] = LP_PROBE_TOP_OUT3_IDX, + [4] = LP_PROBE_TOP_OUT4_IDX, + [5] = LP_PROBE_TOP_OUT5_IDX, + [6] = LP_PROBE_TOP_OUT6_IDX, + [7] = LP_PROBE_TOP_OUT7_IDX, + [8] = LP_PROBE_TOP_OUT8_IDX, + [9] = LP_PROBE_TOP_OUT9_IDX, + [10] = LP_PROBE_TOP_OUT10_IDX, + [11] = LP_PROBE_TOP_OUT11_IDX, + [12] = LP_PROBE_TOP_OUT12_IDX, + [13] = LP_PROBE_TOP_OUT13_IDX, + [14] = LP_PROBE_TOP_OUT14_IDX, + [15] = LP_PROBE_TOP_OUT15_IDX, + } + } + } +}; diff --git a/components/soc/esp32s31/include/soc/Kconfig.soc_caps.in b/components/soc/esp32s31/include/soc/Kconfig.soc_caps.in index a8bf900c0ff..69d26c8427b 100644 --- a/components/soc/esp32s31/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32s31/include/soc/Kconfig.soc_caps.in @@ -259,6 +259,10 @@ config SOC_CPU_LOCKUP_DEBUG_SUPPORTED bool default y +config SOC_DEBUG_PROBE_SUPPORTED + bool + default y + config SOC_WDT_SUPPORTED bool default y @@ -651,6 +655,14 @@ config SOC_CLOCKOUT_SUPPORT_CHANNEL_DIVIDER bool default y +config SOC_DEBUG_PROBE_NUM_UNIT + int + default 2 + +config SOC_DEBUG_PROBE_MAX_OUTPUT_WIDTH + int + default 16 + config SOC_RTCIO_PIN_COUNT int default 8 diff --git a/components/soc/esp32s31/include/soc/debug_probe_targets.h b/components/soc/esp32s31/include/soc/debug_probe_targets.h new file mode 100644 index 00000000000..a7bfe756eb2 --- /dev/null +++ b/components/soc/esp32s31/include/soc/debug_probe_targets.h @@ -0,0 +1,62 @@ +/* + * SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Target module that we want to attach the HP probe to + */ +typedef enum { + DEBUG_PROBE_TARGET_HP_USB_OTG_HS = 0, // USB OTG HS + DEBUG_PROBE_TARGET_HP_AXI_GDMA = 1, // AXI GDMA + DEBUG_PROBE_TARGET_HP_TCM = 3, // HP TCM RAM + DEBUG_PROBE_TARGET_HP_MSPI_PSRAM = 6, // MSPI PSRAM + DEBUG_PROBE_TARGET_HP_AXI_ICM = 9, // HP ICM matrix + DEBUG_PROBE_TARGET_HP_BIT_SCRAMBLER = 11, // Bit Scrambler + DEBUG_PROBE_TARGET_HP_MSPI_FLASH = 12, // MSPI Flash + DEBUG_PROBE_TARGET_HP_CACHE = 13, // Cache + DEBUG_PROBE_TARGET_HP_CORE = 14, // HP Core + DEBUG_PROBE_TARGET_HP_LP_PROBE_IN = 16, // LP System Probe In + DEBUG_PROBE_TARGET_HP_EMAC = 18, // GMAC + DEBUG_PROBE_TARGET_HP_JPEG = 19, // JPEG + DEBUG_PROBE_TARGET_HP_PPA = 20, // PPA + DEBUG_PROBE_TARGET_HP_DMA2D = 21, // DMA2D + DEBUG_PROBE_TARGET_HP_LEDC0 = 22, // LEDC0 + DEBUG_PROBE_TARGET_HP_SDMMC = 23, // SDMMC + DEBUG_PROBE_TARGET_HP_LEDC1 = 24, // LEDC1 + DEBUG_PROBE_TARGET_HP_MCPWM2 = 25, // MCPWM2 + DEBUG_PROBE_TARGET_HP_MCPWM3 = 26, // MCPWM3 + DEBUG_PROBE_TARGET_HP_MCPWM0 = 27, // MCPWM0 + DEBUG_PROBE_TARGET_HP_MCPWM1 = 28, // MCPWM1 + DEBUG_PROBE_TARGET_HP_REGDMA = 29, // REGDMA + DEBUG_PROBE_TARGET_HP_ZERO_DET = 30, // Zero detection +} soc_debug_probe_target_hp_t; + +/** + * @brief Target module that we want to attach the LP probe to + */ +typedef enum { + DEBUG_PROBE_TARGET_LP_PMU = 0, // LP PMU + DEBUG_PROBE_TARGET_LP_TCM = 1, // LP TCM + DEBUG_PROBE_TARGET_LP_TSENS = 2, // LP TSENS + DEBUG_PROBE_TARGET_LP_CORE = 3, // LP Core + DEBUG_PROBE_TARGET_LP_ADC = 4, // LP ADC + DEBUG_PROBE_TARGET_LP_SPI = 5, // LP SPI + DEBUG_PROBE_TARGET_LP_TOUCH = 6, // LP Touch + DEBUG_PROBE_TARGET_LP_ANA_PERI = 7, // LP Analog Peripherals + DEBUG_PROBE_TARGET_LP_AON_CLKRST = 8, // LP AON Clock/Reset + DEBUG_PROBE_TARGET_LP_TRNG = 9, // LP TRNG + DEBUG_PROBE_TARGET_LP_MISC = 10, // LP System Misc + DEBUG_PROBE_TARGET_LP_HP_PROBE_IN = 11, // HP System Probe In +} soc_debug_probe_target_lp_t; + +#ifdef __cplusplus +} +#endif diff --git a/components/soc/esp32s31/include/soc/soc_caps.h b/components/soc/esp32s31/include/soc/soc_caps.h index 8907cf8458b..6be1c469338 100644 --- a/components/soc/esp32s31/include/soc/soc_caps.h +++ b/components/soc/esp32s31/include/soc/soc_caps.h @@ -93,7 +93,7 @@ #define SOC_CLK_TREE_SUPPORTED 1 #define SOC_ASSIST_DEBUG_SUPPORTED 1 #define SOC_CPU_LOCKUP_DEBUG_SUPPORTED 1 -// #define SOC_DEBUG_PROBE_SUPPORTED 1 // TODO: [ESP32S31] IDF-14798 +#define SOC_DEBUG_PROBE_SUPPORTED 1 #define SOC_WDT_SUPPORTED 1 #define SOC_RTC_WDT_SUPPORTED 1 #define SOC_SPI_FLASH_SUPPORTED 1 // TODO: [ESP32S31] IDF-14777 @@ -249,6 +249,10 @@ #define SOC_GPIO_CLOCKOUT_CHANNEL_NUM (3) #define SOC_CLOCKOUT_SUPPORT_CHANNEL_DIVIDER (1) +/*-------------------------- DEBUG PROBE CAPS ---------------------------------*/ +#define SOC_DEBUG_PROBE_NUM_UNIT (2U) // Unit 0: HP probe, Unit 1: LP probe +#define SOC_DEBUG_PROBE_MAX_OUTPUT_WIDTH (16) // Maximum width of the debug probe output in each unit + /*-------------------------- RTCIO CAPS --------------------------------------*/ #define SOC_RTCIO_PIN_COUNT 8 #define SOC_RTCIO_INPUT_OUTPUT_SUPPORTED 1 /* This macro indicates that the target has separate RTC IOMUX hardware feature,