casaroli opened a new pull request, #19525:
URL: https://github.com/apache/nuttx/pull/19525
## Summary
Adds a driver for the RP2350 hardware true random number generator (TRNG).
- New `arch/arm/src/rp23xx/rp23xx_rng.c` registering `/dev/random` (and
`/dev/urandom` when `CONFIG_DEV_URANDOM` selects the architecture source,
`DEV_URANDOM_ARCH`).
- New `CONFIG_RP23XX_RNG` Kconfig option (default n) which `select`s
`ARCH_HAVE_RNG`, plus the Make.defs / CMakeLists build wiring.
- Each read enables the entropy source, waits for a valid 192-bit entropy
holding register (EHR) sample, reads the six 32-bit EHR words, and repeats
until the request is satisfied (poll-based; no interrupt required).
- Documents the TRNG on the rp23xx platform page.
## Impact
Opt-in and off by default (`RP23XX_RNG=n`), so no impact on existing
configurations. When enabled it provides `/dev/random` / `/dev/urandom` on
the
rp2350, and makes the hardware TRNG the entropy source for `getrandom()` and
the C library RNG.
## Testing
Verified on an emulated RP2350 (Renode, with a functional model of the TRNG
EHR registers) using the `pimoroni-pico-2-plus` ARM build:
- `ls /dev` shows `random` and `urandom` after boot (both register).
- `dd if=/dev/random of=/dev/console bs=16 count=1` returns entropy and
completes without blocking.
- The bytes read match the exact EHR words produced by the modelled TRNG,
confirming the enable / wait-for-valid / read-EHR sequence.
- `tools/checkpatch.sh` is clean on the commit.
The read sequence follows the RP2350 datasheet TRNG description
(`RND_SOURCE_ENABLE` -> poll `TRNG_VALID` -> read `EHR_DATA0..5`). Testing on
physical silicon is welcome.
--
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]