from ``up_timer_gettime()`` and the interval timer is ready for use
(but not actively timing).
***Input Parameters:** None.
***Returned Value:** None.
***Assumptions:** Called early in the initialization sequence before
any special concurrency protections are required.
``up_timer_gettime()``
^^^^^^^^^^^^^^^^^^^^^^
..code:: c
int up_timer_gettime(FAR struct timespec *ts);
***Description:** Return the elapsed time since power-up (or, more correctly,
since ``up_timer_initialize()`` was called). This function is functionally
equivalent to ``clock_gettime()`` for the clock ID ``CLOCK_MONOTONIC``.
This function provides the basis for reporting the current time and also
is used to eliminate error build-up from small errors
in interval time calculations.
***Input Parameters:**``*ts`` - Provides the location in which
to return the up-time.
***Returned Value:** Zero (``OK``) is returned on success;
a negated ``errno`` value is returned on any failure.
***Assumptions:** Called from the the normal tasking context. The implementation must provide whatever mutual exclusion is necessary for correct operation. This can include disabling interrupts in order to assure atomic register operations.
``up_alarm_cancel()``
^^^^^^^^^^^^^^^^^^^^^
..code:: c
int up_alarm_cancel(FAR struct timespec *ts);
***Description:** Cancel the alarm and return the time of cancellation
of the alarm. These two steps need to be as nearly atomic as possible.
``sched_timer_expiration()`` will not be called unless the alarm
is restarted with ``up_alarm_start()``. If, as a race condition,
the alarm has already expired when this function is called,
then time returned is the current time.
***Input Parameters:**``*ts`` - Location to return the expiration time.
The current time should be returned if the timer is not active.
``ts`` may be ``NULL`` in which case the time is not returned.
***Returned Value:** Zero (``OK``) is returned on success;
a negated ``errno`` value is returned on any failure.
***Assumptions:** May be called from interrupt level handling or from the
normal tasking level. Interrupts may need to be disabled internally
to assure non-reentrancy.
..note:: This function is only required when ``CONFIG_SCHED_TICKLESS_ALARM``
is defined.
``up_alarm_start()``
^^^^^^^^^^^^^^^^^^^^
..code:: c
int up_alarm_start(FAR const struct timespec *ts);
***Description:** Start the alarm. ``sched_timer_expiration()`` will be
called at alarm expires (unless ``up_alarm_cancel()`` is called to stop
the alarm.
***Input Parameters:**``*ts`` - The time in the future at the alarm
is expected to occur. When the alarm occurs the timer logic will call
``ched_timer_expiration()`` is called.
***Returned Value:** Zero (``OK``) is returned on success;
a negated ``errno`` value is returned on any failure.
***Assumptions:** May be called from interrupt level handling
or from the normal tasking level. Interrupts may need to be disabled
internally to assure non-reentrancy.
..note:: This function is only required when ``CONFIG_SCHED_TICKLESS_ALARM``
is defined.
``up_timer_cancel()``
^^^^^^^^^^^^^^^^^^^^^
..code:: c
int up_timer_cancel(FAR struct timespec *ts);
***Description:** Cancel the interval timer and return the time remaining
on the timer. These two steps need to be as nearly atomic as possible.
``sched_timer_expiration()`` will not be called unless the timer
is restarted with ``up_timer_start()``. If, as a race condition,
the timer has already expired when this function is called,
then that pending interrupt must be cleared so that
``up_timer_start()`` and the remaining time of zero should be returned.
***Input Parameters:**``*ts`` - Location to return the remaining time.
Zero should be returned if the timer is not active. ``ts`` may be ``NULL``
in which case the time remainging is not returned
***Returned Value:** Zero (``OK``) is returned on success;
a negated ``errno`` value is returned on any failure.
***Assumptions:** May be called from interrupt level handling
or from the normal tasking level. Interrupts may need to be disabled
internally to assure non-reentrancy.
..note:: This function is only required when ``CONFIG_SCHED_TICKLESS_ALARM``
is not defined.
``up_timer_start()``
^^^^^^^^^^^^^^^^^^^^
..code:: c
int up_timer_start(FAR const struct timespec *ts);
***Description:** Start the interval timer. ``sched_timer_expiration()``
will be called at the completion of the timeout (unless
``up_timer_cancel()`` is called to stop the timing.
***Input Parameters:**``*ts`` - Provides the time interval until
``sched_timer_expiration()`` is called.
***Returned Value:** Zero (``OK``) is returned on success;
a negated ``errno`` value is returned on any failure.
***Assumptions:** May be called from interrupt level handling or from the
normal tasking level. Interrupts may need to be disabled internally
to assure non-reentrancy.
..note:: This function is only required when ``CONFIG_SCHED_TICKLESS_ALARM``
is not defined.
Exported Interfaces
-------------------
In addition, the following interface is provided by the RTOS for use