yangsong8-a1 opened a new pull request, #21851:
URL: https://github.com/apache/nuttx/pull/21851

   ## Summary
   
   Add an upper half for Output Compare Units (`CONFIG_OCU`, `/dev/ocuN`).
   An OCU channel compares a free-running counter with a threshold and, on a
   match, can change an output pin and notify the application.
   
   - ioctls: `OCUIOC_START`/`STOP`, `GETSTATUS`, `GETCOUNTER`,
     `SETABSTHRESHOLD`, `SETRELTHRESHOLD`, `SETADVANCETHRESHOLD`,
     `SETPINSTATE`, `SETPINACTION` and `OCUIOC_NOTIFICATION` (signal on
     compare match). Unknown commands go to the lower half `ioctl`.
   - Kernel code can register a match callback directly with
     `OCU_SETCALLBACK()`, as with `TIMER_SETCALLBACK()`.
   - New ioctl base `_OCUIOCBASE` (0x4b00), documentation in
     `Documentation/os/drivers/character/timers/ocu.rst`.
   
   The second commit adds `ocu.c` to the Make build, the third fixes nxstyle
   errors.
   
   ## Impact
   
   New framework, off by default. No lower half in this PR; the i.MX GPT
   lower half follows in a separate PR.
   
   ## Testing
   
   Ubuntu 22.04, gcc 13.1, aarch64-none-elf-gcc 13.2.
   
   | Config | Result |
   |---|---|
   | sim:nsh + OCU (Make, and CMake for the first commit) | builds, 0 warnings |
   | qemu-armv8a:nsh + OCU (Make and CMake) | builds, 0 warnings |
   | sim:nsh + OCU, test program with a fake lower half; the compare match is 
simulated with interrupts disabled | see the log below |
   
   ```
   GETSTATUS ret=0 flags=0x4 counter=100
   lower start
   START ret=0
   START again ret=-16
   SETPINSTATE while running ret=-16
   lower setpinaction(3)
   SETPINACTION ret=0
   GETCOUNTER ret=0 counter=100
   SETABSTHRESHOLD ret=0 result=0
   SETRELTHRESHOLD ret=0 threshold=150
   SETADVANCETHRESHOLD ret=0 threshold=1150 result=1
   lower setcallback(set)
   lower notification(1)
   NOTIFICATION(enable) ret=0
   GETSTATUS ret=0 flags=0x7 threshold=1150
   sigtimedwait ret=10 signo=10 value=1234
   lower notification(0)
   lower setcallback(NULL)
   NOTIFICATION(disable) ret=0
   sigtimedwait after disable ret=-1 errno=11
   unknown ioctl ret=-25
   lower stop
   STOP ret=0
   lower notification(0)
   lower setcallback(NULL)
   ```
   


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