arch/arm/rtl8721f: add GPIO character driver support
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions

Wire the shared Ameba GPIO driver into the RTL8721F (amebagreen2) build and
add the EVB board glue:

  - arch/arm/src/rtl8721f: build ameba_gpio.c (CMake/Make.defs), source the
    common Ameba Kconfig, and add ameba_gpio_chip.h describing the chip's
    three GPIO ports (A/B/C), their IRQs and the APBPeriph clock bit.
  - arch/arm/src/common/ameba: teach the driver that amebagreen2's ROM
    GPIO_Init does not call PAD_PullCtrl or GPIO_INTMode, so call both
    explicitly after GPIO_Init; on RTL8721Dx (ram_common) these are harmless
    redundant writes.  Add the AMEBA_PORT_C / AMEBA_PC() helpers.
  - boards/arm/rtl8721f/rtl8721f_evb: register output/input/interrupt demo
    pins, add the bringup hook, and provide a minimal 'gpio' NSH defconfig.
  - Documentation: add a GPIO section for the RTL8721F EVB and fix a
    rising/falling typo in the PKE8721DAF page.

Hardware-verified on the RTL8721F EVB: output, input, and all interrupt
trigger/polarity combinations (rising/falling edge, level high/low).

Signed-off-by: dechao_gong <dechao_gong@realsil.com.cn>
Assisted-by: Claude <noreply@anthropic.com>
This commit is contained in:
dechao_gong 2026-07-30 18:09:57 +08:00 committed by Alin Jerpelea
parent a6a5c8aff2
commit d960bc39ee
15 changed files with 344 additions and 15 deletions

View file

@ -74,7 +74,7 @@ the example::
nsh> gpio -o 1 /dev/gpio0 # drive the output high
nsh> gpio /dev/gpio1 # read the input
nsh> gpio -w 1 /dev/gpio2 # wait for a rising-edge interrupt
nsh> gpio -w 1 /dev/gpio2 # wait for a falling-edge interrupt
Pins are encoded with the ``AMEBA_PA()`` / ``AMEBA_PB()`` helpers from
``arch/arm/src/common/ameba/ameba_gpio.h`` (port A/B, pin 0-31), matching the

View file

@ -47,6 +47,24 @@ rtl8721f_evb`` first (the make build needs no sourcing).
$ ./tools/configure.sh rtl8721f_evb:<config-name>
gpio
----
Minimal NSH with the GPIO driver and the ``gpio`` example enabled (no Wi-Fi).
The board registers three pins from its pin table (see
``boards/arm/rtl8721f/rtl8721f_evb/src/rtl8721f_gpio.c``): an output at
``/dev/gpio0``, an input at ``/dev/gpio1`` and an interrupt pin at
``/dev/gpio2``. Edit that table to match a board's wiring. Exercise them with
the example::
nsh> gpio -o 1 /dev/gpio0 # drive the output high
nsh> gpio /dev/gpio1 # read the input
nsh> gpio -w 1 /dev/gpio2 # wait for a falling-edge interrupt
Pins are encoded with the ``AMEBA_PA()`` / ``AMEBA_PB()`` helpers from
``arch/arm/src/common/ameba/ameba_gpio.h`` (port A/B, pin 0-31), matching the
Ameba SDK ``PinName`` layout.
nsh
---