xref: /aosp_15_r20/external/pigweed/pw_chrono_threadx/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_chrono_threadx:
2*61c4878aSAndroid Build Coastguard Worker
3*61c4878aSAndroid Build Coastguard Worker-----------------
4*61c4878aSAndroid Build Coastguard Workerpw_chrono_threadx
5*61c4878aSAndroid Build Coastguard Worker-----------------
6*61c4878aSAndroid Build Coastguard Worker``pw_chrono_threadx`` is a collection of ``pw_chrono`` backends that are
7*61c4878aSAndroid Build Coastguard Workerimplemented using ThreadX.
8*61c4878aSAndroid Build Coastguard Worker
9*61c4878aSAndroid Build Coastguard Worker.. warning::
10*61c4878aSAndroid Build Coastguard Worker  This module is under construction, not ready for use, and the documentation
11*61c4878aSAndroid Build Coastguard Worker  is incomplete.
12*61c4878aSAndroid Build Coastguard Worker
13*61c4878aSAndroid Build Coastguard WorkerSystemClock backend
14*61c4878aSAndroid Build Coastguard Worker-------------------
15*61c4878aSAndroid Build Coastguard WorkerThe ThreadX based ``system_clock`` backend implements the
16*61c4878aSAndroid Build Coastguard Worker``pw_chrono:system_clock`` facade by using ``tx_time_get()``. An
17*61c4878aSAndroid Build Coastguard WorkerInterruptSpinLock is used to manage overflows in a thread and interrupt safe
18*61c4878aSAndroid Build Coastguard Workermanner to produce a signed 64 bit timestamp.
19*61c4878aSAndroid Build Coastguard Worker
20*61c4878aSAndroid Build Coastguard WorkerThe ``SystemClock::now()`` must be used more than once per overflow of the
21*61c4878aSAndroid Build Coastguard Workernative ThreadX ``tx_time_get()`` overflow. Note that this duration may vary if
22*61c4878aSAndroid Build Coastguard Worker``tx_time_set()`` is used.
23*61c4878aSAndroid Build Coastguard Worker
24*61c4878aSAndroid Build Coastguard Worker.. warning::
25*61c4878aSAndroid Build Coastguard Worker  Note that this is not compatible with TX_NO_TIMER as this disables
26*61c4878aSAndroid Build Coastguard Worker  ``tx_time_get()``.
27*61c4878aSAndroid Build Coastguard Worker
28*61c4878aSAndroid Build Coastguard WorkerBuild targets
29*61c4878aSAndroid Build Coastguard Worker-------------
30*61c4878aSAndroid Build Coastguard WorkerThe GN build for ``pw_chrono_threadx`` has one target: ``system_clock``.
31*61c4878aSAndroid Build Coastguard WorkerThe ``system_clock`` target provides the
32*61c4878aSAndroid Build Coastguard Worker``pw_chrono_backend/system_clock_config.h`` and ``pw_chrono_threadx/config.h``
33*61c4878aSAndroid Build Coastguard Workerheaders and the backend for the ``pw_chrono:system_clock``.
34