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

   ## Summary
   
     Add a shared NuttX PWM lower-half for the Realtek Ameba PWM timer and wire
     it up on three Ameba SoCs. A single PWM-capable timer provides one time 
base
     feeding several compare channels: every channel runs at the same frequency
     while each carries its own duty cycle, exposed as a single `/dev/pwm0`
     character device through the stock upper-half PWM driver (the
     `CONFIG_PWM_NCHANNELS` multi-channel form).
   
     - New shared driver `arch/arm/src/common/ameba/ameba_pwm.c/.h`, driven
       through the SDK fwlib. The time-base entry points resolve from on-chip
       ROM; the compare/capture helpers are pulled in from
       `fwlib ram_common/ameba_tim.c` only when `CONFIG_AMEBA_PWM` is set.
     - Per-chip constants (timer index, channel count, register base, input
       clock, IRQ, clock-enable masks and the per-channel pad-mux code table)
       live in each chip's `ameba_pwm_chip.h`, so a port to another Ameba chip
       only supplies a same-named header.
     - Board wiring and a `pwm` defconfig (running `examples/pwm`) for
       `pke8721daf` (RTL8721DX, TIM8), `rtl8720f_evb` (RTL8720F, TIM4) and
       `rtl8721f_evb` (RTL8721F, TIM4).
     - `RTIM_` added to the `tools/nxstyle.c` mixed-case allow-list.
   
     The series is 3 commits: the shared driver (on RTL8721DX), then RTL8720F,
     then RTL8721F.
   
     ## Impact
   
     New feature, opt-in via `CONFIG_AMEBA_PWM`. No change to existing
     configurations or to other architectures; the code is only built when the
     `pwm` config is selected on one of the three affected boards. Board
     `index.rst` documentation is updated for all three boards in the same
     commits.
   
     ## Testing
   
     Host: Ubuntu on WSL2 (x86_64), arm-none-eabi-gcc.
   
     Hardware-verified on all three boards; PWM output pads were probed with a
     logic analyzer (channel 1 / channel 2): RTL8721DX PB18/PB19, RTL8720F
     PA23/PA24, RTL8721F PA24/PA25.
   
     For each board, run from NSH via `examples/pwm`:
   
     | Command | Expected (channel 1) | Result |
     | --- | --- | --- |
     | `pwm -f 1000 -d 25 -t 10` | 1 kHz, 25 % duty | pass |
     | `pwm -f 1000 -d 50 -t 10` | 1 kHz, 50 % duty | pass |
     | `pwm -f 100 -d 50 -t 10` | 100 Hz, 50 % duty | pass |
     | `pwm -f 20000 -d 50 -t 10` | 20 kHz, 50 % duty | pass |
     | `pwm -f 1000 -d 25 -d 75 -t 10` | ch1 25 %, ch2 75 %, both 1 kHz | pass |
   
     The last case exercises the multi-channel path: two independent compare
     channels off one shared time base output different duty cycles at the same
     frequency. Measured frequency error was < 1 %, and the output stopped
     cleanly when the run duration elapsed.
   
     `tools/checkpatch.sh -g master..HEAD` is clean on the whole series, and the
     three `pwm` defconfigs match `make savedefconfig` output.
   


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