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