raulcxw opened a new pull request, #19484:
URL: https://github.com/apache/nuttx/pull/19484
## Summary
Add a board-agnostic GPIO driver for Realtek Ameba chips, exposing pins
through
the NuttX GPIO (ioexpander) upper half at `/dev/gpioN`.
- **`arch/arm/src/common/ameba/ameba_gpio.{c,h}`** — the shared driver,
sitting
directly on the SDK fwlib register layer. The fwlib GPIO API it calls
resolves at link time from the on-chip ROM symbol table, except
`GPIO_INTStatusGet`/`ClearEdge` which are not in ROM and are compiled in
from
the fwlib `ram_common/ameba_gpio.c`. Pin interrupts are dispatched
NuttX-natively: the port's NVIC vector is owned by NuttX via `irq_attach`,
and
the ISR reads/clears status through the fwlib helpers.
- The driver keeps nothing IC-specific: the port count, per-port NVIC vectors
and RCC gate bits come from a per-chip `<ameba_gpio_chip.h>` resolved on
the
include path, so bringing up a new Ameba chip only adds that header, not a
change to the shared driver.
- **`common/ameba/Kconfig`** — a shared "Ameba Peripheral Support" menu with
the
`AMEBA_GPIO` option, sourced by each Ameba chip's Kconfig so it is reused
across ICs (RTL8721Dx, RTL8720F, ...).
- **`arch/arm/src/rtl8721dx`** — provide `ameba_gpio_chip.h`, wire the driver
into **both the make and CMake builds**, and compile the fwlib register
layer
(`ameba_gpio.c`) into `libameba_fwlib` for the RTL8721Dx.
- **`boards/arm/rtl8721dx/pke8721daf`** — board pin table
(`rtl8721dx_gpio.c`),
bring-up registration, and a standalone `gpio` defconfig.
- **`tools/nxstyle`** — whitelist the Ameba `GPIO_` SDK ROM symbol prefix
(alongside the existing `FLASH_`/`IPC_`/... Ameba prefixes) so the vendor
GPIO
API's mixed-case identifiers do not trip nxstyle.
- Documentation: the `gpio` configuration and pin encoding.
## Impact
- New: `AMEBA_GPIO` driver + `pke8721daf:gpio` configuration. Off by
default;
no effect on existing configurations.
- Builds under both make and CMake (the CMake support landed in #19463).
## Testing
Fork CI on top of current apache/master, all green — the `pke8721daf:gpio`
config builds under both build systems, and the existing `nsh` configs for
both
boards still build:
<details>
<summary>pke8721daf:gpio — make and CMake</summary>
```
# make
$ ./tools/configure.sh pke8721daf:gpio && make
-- Found assembler:
~/rtk-toolchain/asdk-10.3.1-4602/linux/newlib/bin/arm-none-eabi-gcc
PACK: wrote nuttx.bin
-rw-r--r-- 1 root root 517728 nuttx.bin
# CMake
$ . tools/ameba/env.sh pke8721daf
$ cmake -B build -DBOARD_CONFIG=pke8721daf:gpio -GNinja && cmake --build
build
[1172/1174] Linking C executable nuttx
PACK: wrote build/nuttx.bin
-rw-r--r-- 1 root root 527456 build/nuttx.bin
```
</details>
Hardware-verified on the pke8721daf (RTL8721Dx) with the make build: the
driver
was exercised on target through `/dev/gpio*` (input read, output write and
pin
interrupts). The CMake build of the same config is CI-verified (above).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]