v01d commented on pull request #1705:
URL: https://github.com/apache/incubator-nuttx/pull/1705#issuecomment-687630050
The difference between oneshot/timer was not apparent to me. At least it is
not documented anywhere. It would appear to be two different possible
interfaces with no apparent change in semantics. Actually, the biggest
difference is the fact that oneshot receives a timespec value instead of a
microsecond value.
Moreover, I realized this timespec is *relative* (I thought it was
absolute), so indeed it is a matter of representation. The difference you
mention about auto-clear is documented anywhere?
Anyway, it is confusing to me that arch_timer/arch_alarm both use a timer
based on a relative timeout, where arch_alarm gives the illusion to NuttX that
it is working in absolute values (by using the alarm time to get a relative
timeout). The point of arch_alarm is that it is supposed to be used with a
timer which allows to set an absolute time in the future, see:
<pre>
config SCHED_TICKLESS_ALARM
bool "Tickless alarm"
default n
---help---
The tickless option can be supported either via a simple
interval
timer (plus elapsed time) or via an alarm. The interval
timer allows
programming events to occur after an interval. With the
alarm,
you can set a time in the future and get an event when that
alarm
goes off. This option selects the use of an alarm.
The advantage of an alarm is that it avoids some small timing
errors; the advantage of the use of the interval timer is
that
the hardware requirement may be less
</pre>
I always understood from this that it should be based on an RTC peripheral
which allows you to set an absolute RTC alarm.
So, it seems to me that arch_timer should actually be implemented as
arch_alarm is implemented (no drift in up_timer_gettime()) instead of having
one combination which does not make sense for tickless (arch_timer).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]