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

    ## Summary
   
     This PR adds a shared NuttX timer lower-half for the Realtek Ameba
     general-purpose timers and wires it into three boards (RTL8721Dx, RTL8720F,
     RTL8721F).
   
     The shared driver (`arch/arm/src/common/ameba/ameba_timer.c`) sits on the 
SDK
     per-chip instance table (`ameba_timer_chip.h`) for each timer's base 
address,
     input clock, RCC gate mask and IRQ; the requested period is programmed
     directly in microseconds and converted to the 32-bit auto-reload with a 
single
     clkfreq formula. The RTIM time-base entry points resolve to ROM, while the
     interrupt-clear and period-change helpers come from the fwlib RAM source
     `ameba_tim.c` (shared with the existing PWM driver, now also pulled in by
     `CONFIG_AMEBA_TIMER`, matching the PWM build rule).
   
     On each board two of the 32.768 kHz "basic" (LTIM) timers are exposed:
     `/dev/timer0` is TIM1 and `/dev/timer1` is TIM2. TIM0 is deliberately left
     untouched because the boot ROM claims it as the always-on system timer
     (SYSTIMER); reprogramming it would break every SDK delay. Only the per-chip
     base addresses, RCC masks and IRQs differ between the three SoCs, so each 
chip
     adds only a small `ameba_timer_chip.h` (verified against the SoC
     `hal_platform.h` / `sysreg_lsys.h` / vector table) plus its build hooks, 
board
     bring-up registration, board `timer` defconfig and `index.rst` docs. The
     shared driver itself is identical across all three.
   
     The `timer` defconfigs also enable `CONFIG_TIMER_ARCH=y`; without it
     `up_timer_set_lowerhalf()` expands to a no-op macro, 
`systick_initialize()` is
     never called and `clock_systime_ticks()` never advances.
   
     `tools/nxstyle.c` gains the vendor `RTIM_` symbol prefix in the whitelist,
     alongside the existing `RCC_` / `SYSTIMER_` Ameba SDK entries.
   
     ## Impact
   
     New optional peripheral driver, off by default (`CONFIG_AMEBA_TIMER`). No
     change to any existing board configuration. Only affects the three Ameba
     boards listed above.
   
     ## Testing
   
     - `nxstyle` / `checkpatch` clean on all three commits.
     - `make` and `cmake` out-of-tree builds pass for all three boards with the
       `:timer` config.
     - Hardware-verified on RTL8721F, RTL8720F and RTL8721Dx with 
`examples/timer`
       against both `/dev/timer0` and `/dev/timer1`: the update interrupt fires 
at
       the requested 1 s interval (cross-checked against the independent ROM
       SYSTIMER = 32768 ticks = 1.000 s), and `cat /proc/uptime` advances in 
real
       time (the example completes in ~2 s with nsignals=2, confirming the 
system
       tick is running).


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