dcgong2917 opened a new pull request, #19899:
URL: https://github.com/apache/nuttx/pull/19899

   ## Summary
   
     Adds a shared Ameba SAR-ADC driver plus per-chip integration for three
     Realtek parts. Structured as three self-contained commits (each builds and
     can be reviewed independently):
   
     - `arch/arm/rtl8721dx`: the shared driver (`arch/arm/src/common/ameba/
       ameba_adc.{c,h}`) + pke8721daf integration and board table
     - `arch/arm/rtl8720f`: RTL8720F chip header + board table
     - `arch/arm/rtl8721f`: RTL8721F chip header + board table
   
     The converter is exposed as a NuttX ADC character device at `/dev/adc0`.
     It has a single channel-switch list; the board bring-up selects which
     channels are sampled and which analog pad each external channel maps to.
     Every listed channel is sampled, in order, on each `ANIOC_TRIGGER`.
   
     The driver sits on the SDK fwlib register layer and reads the auto
     channel-switch FIFO by polling in task context (the hardware does not
     enable a software-trigger path, so this is the supported on-demand read).
     It reports the raw right-aligned conversion code, matching the NuttX
     convention used by other in-tree ADC drivers.
   
     Per-chip differences (pinmux code, aux clock gate, the real fwlib
     `ADC_InitTypeDef` size) live in each `ameba_adc_chip.h`; the shared driver
     mirrors only the leading opmode/cvlistlen/cvlist prefix it actually writes
     and sizes a `reserved[]` tail from `AMEBA_ADC_INIT_SIZE` with a
     `static_assert` so a new port cannot under-size the stack object. The
     per-chip ClkDiv write is guarded by `AMEBA_ADC_HAS_CLKDIV` (only amebadplus
     has that field at that offset).
   
     ## Impact
   
     New opt-in feature (`CONFIG_AMEBA_ADC`, default n). No change to existing
     configurations. Documentation updated for each board's `index.rst`.
   
     ## Testing
   
     Built and hardware-tested on all three targets (`<board>:adc` config,
     `adc` NSH example):
   
     - pke8721daf (RTL8721Dx): PB19 grounded -> 132, PB19 @3.3V -> 3886,
       other channel steady (channel isolation OK)
     - rtl8720f_evb (RTL8720F): grounded -> 5, @3.3V -> 3863, isolation OK
     - rtl8721f_evb (RTL8721F): grounded -> 123, @3.3V -> 3918, isolation OK
   
     nxstyle clean (only the standing vendor-symbol Mixed-case exemptions).
     CMake and make builds both verified for each board.


-- 
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]

Reply via email to