yangsong8-a1 opened a new pull request, #22514:
URL: https://github.com/apache/nuttx/pull/22514
Summary
- New CONFIG_RPMSG_BOOTTIME driver (drivers/timers/rpmsg_boottime.c):
an rpmsg client that synchronizes CLOCK_MONOTONIC with a boottime
server on a remote core. It measures the offset with a delay
request every CONFIG_RPMSG_BOOTTIME_DELAY_REQ_INTERVAL seconds:
offsets beyond CONFIG_RPMSG_BOOTTIME_SETTIME_THRESHOLD_MS step the
monotonic clock in one jump; smaller offsets are absorbed by
slewing with adjtime().
- sched/clock prerequisite: CLOCK_MONOTONIC now reads the tick time
plus g_monotonic_basetime, which the new clock_synchronize_monotonic()
steps from the driver side. The realtime clock base is unchanged.
- clock_adjtime() internals: the wdog-based adjustment timer becomes
an hrtimer, and CONFIG_CLOCK_ADJTIME_PERIOD_MS is renamed to
CONFIG_CLOCK_ADJTIME_PERIOD_NS (default 970000000, i.e. the same
970 ms) so the adjustment period has nanosecond granularity.
- The client endpoint is set to RPMSG_PRIO_RT so the RX dispatch runs
the callback inline from the interrupt, reducing the jitter between
sync packet arrival and the local timestamp sample.
Impact
- New code, all opt-in: nothing changes unless CONFIG_RPMSG_BOOTTIME
is enabled. Depends on RPMSG; no defconfig in tree enables it.
- The CLOCK_MONOTONIC base offset defaults to zero, so existing
behavior is unchanged without the new driver.
- CLOCK_ADJTIME users: the watchdog is replaced by an equivalent
hrtimer, same behavior; out-of-tree configs using the renamed
CONFIG_CLOCK_ADJTIME_PERIOD_MS must switch to
CONFIG_CLOCK_ADJTIME_PERIOD_NS (no in-tree defconfig sets it).
- Size on sim:nsh (flat, with debug info): master 5011672, branch
5012304 (+632 bytes).
Testing
- sim:nsh (flat): build, boot, NSH "hello" on the console.
- qemu-armv8a:rpproxy with CONFIG_RPMSG_BOOTTIME=y (flat): builds and
links against openamp; drivers/timers/rpmsg_boottime.c compiles
clean.
- qemu-armv8a:knsh (kernel): build.
- stm32f4discovery:gnsspps (CLOCK_ADJTIME=y, PTP): build, covers the
hrtimer conversion of clock_adjtime.c and the drivers/timers build
list.
- ./tools/checkpatch.sh -c -u -m -g HEAD~5..HEAD: all checks pass.
- Not tested: protected build mode; runtime clock sync on real
multicore hardware.
--
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]