Merge branch 'feature/gpio_dump_io_info' into 'master'

feat(gpio): add a dump API to dump IO configurations

Closes IDFGH-10987

See merge request espressif/esp-idf!26158
This commit is contained in:
Song Ruo Jing
2023-10-13 22:35:59 +08:00
17 changed files with 557 additions and 13 deletions

View File

@@ -83,6 +83,7 @@ INPUT = \
$(PROJECT_PATH)/components/driver/gpio/include/driver/gpio.h \
$(PROJECT_PATH)/components/driver/gpio/include/driver/gpio_etm.h \
$(PROJECT_PATH)/components/driver/gpio/include/driver/gpio_filter.h \
$(PROJECT_PATH)/components/driver/gpio/include/driver/lp_io.h \
$(PROJECT_PATH)/components/driver/gpio/include/driver/rtc_io.h \
$(PROJECT_PATH)/components/driver/gptimer/include/driver/gptimer.h \
$(PROJECT_PATH)/components/driver/gptimer/include/driver/gptimer_etm.h \

View File

@@ -10,6 +10,34 @@ GPIO Summary
:start-after: gpio-summary
:end-before: ---
GPIO driver offers a dump function :cpp:func:`gpio_dump_io_configuration` to show the configurations of the IOs at the moment, such as pull-up / pull-down, input / output enable, pin mapping etc. Below is an example dump:
::
================IO DUMP Start================
IO[4] -
Pullup: 1, Pulldown: 0, DriveCap: 2
InputEn: 1, OutputEn: 0, OpenDrain: 0
FuncSel: 1 (GPIO)
GPIO Matrix SigIn ID: (simple GPIO input)
SleepSelEn: 1
IO[18] -
Pullup: 0, Pulldown: 0, DriveCap: 2
InputEn: 0, OutputEn: 1, OpenDrain: 0
FuncSel: 1 (GPIO)
GPIO Matrix SigOut ID: 256 (simple GPIO output)
SleepSelEn: 1
IO[26] **RESERVED** -
Pullup: 1, Pulldown: 0, DriveCap: 2
InputEn: 1, OutputEn: 0, OpenDrain: 0
FuncSel: 0 (IOMUX)
SleepSelEn: 1
=================IO DUMP End==================
If an IO pin is routed to a peripheral signal through the GPIO matrix, the signal ID printed in the dump information is defined in the ``soc/gpio_sig_map.h`` file. The word ``**RESERVED**`` indicates the IO is occupied by either FLASH or PSRAM. It is strongly not recommended to reconfigure them for other application purposes.
.. only:: SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
@@ -96,6 +124,7 @@ API Reference - Normal GPIO
------------------------
.. include-build-file:: inc/rtc_io.inc
.. include-build-file:: inc/lp_io.inc
.. include-build-file:: inc/rtc_io_types.inc
.. only:: SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER or SOC_GPIO_FLEX_GLITCH_FILTER_NUM

View File

@@ -10,6 +10,34 @@ GPIO 汇总
:start-after: gpio-summary
:end-before: ---
GPIO 驱动提供了一个函数 :cpp:func:`gpio_dump_io_configuration` 用来输出指定管脚的实时配置状态,包括上下拉、输入输出使能、管脚映射等。输出示例如下:
::
================IO DUMP Start================
IO[4] -
Pullup: 1, Pulldown: 0, DriveCap: 2
InputEn: 1, OutputEn: 0, OpenDrain: 0
FuncSel: 1 (GPIO)
GPIO Matrix SigIn ID: (simple GPIO input)
SleepSelEn: 1
IO[18] -
Pullup: 0, Pulldown: 0, DriveCap: 2
InputEn: 0, OutputEn: 1, OpenDrain: 0
FuncSel: 1 (GPIO)
GPIO Matrix SigOut ID: 256 (simple GPIO output)
SleepSelEn: 1
IO[26] **RESERVED** -
Pullup: 1, Pulldown: 0, DriveCap: 2
InputEn: 1, OutputEn: 0, OpenDrain: 0
FuncSel: 0 (IOMUX)
SleepSelEn: 1
=================IO DUMP End==================
当 IO 管脚是通过 GPIO 交换矩阵连接到内部外设信号,输出信息打印中的外设信号 ID 定义可以在 ``soc/gpio_sig_map.h`` 文件中查看。``**RESERVED**`` 字样则表示此 IO 被用于连接 FLASH 或 PSRAM因此该引脚不应该被其他任何应用场景所征用并进行重新配置。
.. only:: SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
@@ -96,6 +124,7 @@ API 参考 - 普通 GPIO
------------------------
.. include-build-file:: inc/rtc_io.inc
.. include-build-file:: inc/lp_io.inc
.. include-build-file:: inc/rtc_io_types.inc
.. only:: SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER or SOC_GPIO_FLEX_GLITCH_FILTER_NUM