xref: /aosp_15_r20/external/pigweed/pw_chrono_embos/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1.. _module-pw_chrono_embos:
2
3---------------
4pw_chrono_embos
5---------------
6``pw_chrono_embos`` is a collection of ``pw_chrono`` backends that are
7implemented using embOS v4 for 32bit targets.
8
9.. warning::
10  This module is still under construction, the API is not yet stable.
11
12SystemClock backend
13-------------------
14The embOS based ``system_clock`` backend implements the
15``pw_chrono:system_clock`` facade by using ``OS_GetTime32()``. An
16InterruptSpinLock is used to manage overflows in a thread and interrupt safe
17manner to produce a signed 64 bit timestamp. Note that this does NOT use
18``OS_GetTime_us64()`` which is not always available, this could be considered
19for a future alternative backend for the SystemClock.
20
21The ``SystemClock::now()`` must be used more than once per overflow of the
22native embOS ``OS_GetTime32()`` overflow. Note that this duration may
23vary if ``OS_SUPPORT_TICKLESS`` is used.
24
25SystemTimer backend
26-------------------
27The embOS based ``system_timer`` backend implements the
28``pw_chrono:system_timer`` facade by using embOS's software timer API.
29``pw::chrono::SystemTimer`` instances use ``OS_TIMER_EX`` &
30``OS_CreateTimerEx``, dynamic memory allocation is never used.
31
32Build targets
33-------------
34The GN build for ``pw_chrono_embos`` has one target: ``system_clock``.
35The ``system_clock`` target provides the
36``pw_chrono_backend/system_clock_config.h`` and ``pw_chrono_embos/config.h``
37headers and the backend for the ``pw_chrono:system_clock``.
38