@@ -64,4 +64,69 @@ Zephyr's OpenThread L2 platform adaptation layer glues the external OpenThread
6464stack together with Zephyr's IEEE 802.15.4 protocol agnostic driver API. This
6565API is of interest to OpenThread L2 **subsystem contributors ** only.
6666
67+ OpenThread Platform API
68+ =======================
69+
70+ The OpenThread platform API is defined by the OpenThread stack and implemented in Zephyr as an
71+ OpenThread module. Applications can use this implementation directly, or access it through the
72+ OpenThread L2 adaptation layer.
73+
74+ Using the OpenThread L2 Adaptation Layer API
75+ --------------------------------------------
76+
77+ To use the OpenThread platform API via the OpenThread L2 adaptation layer, enable both the
78+ :kconfig:option: `CONFIG_NET_L2_OPENTHREAD ` and :kconfig:option: `CONFIG_NETWORKING ` Kconfig options
79+ by setting them to ``y ``. The adaptation layer will use the OpenThread radio API implementation
80+ found in :file: `modules/openthread/platform/radio.c `. In this setup, the OpenThread stack is
81+ initialized and managed by the adaptation layer.
82+
83+ Using the OpenThread Platform API Directly
84+ ------------------------------------------
85+
86+ You can also use the OpenThread platform API directly, bypassing the OpenThread L2 adaptation
87+ layer. However, this approach requires you to provide your own implementation of the OpenThread
88+ radio API that is compatible with your specific radio driver.
89+
90+ To use the OpenThread platform API directly, set the :kconfig:option: `CONFIG_OPENTHREAD ` Kconfig
91+ option to ``y ``, and do **not ** set :kconfig:option: `CONFIG_NET_L2_OPENTHREAD `. In this case, you
92+ must implement the following functions from the `OpenThread radio API
93+ <https://openthread.io/reference/group/radio-config> `_ using your own radio driver:
94+
95+ * ``otPlatRadioGetPromiscuous ``
96+ * ``otPlatRadioGetCcaEnergyDetectThreshold ``
97+ * ``otPlatRadioGetTransmitPower ``
98+ * ``otPlatRadioGetIeeeEui64 ``
99+ * ``otPlatRadioSetPromiscuous ``
100+ * ``otPlatRadioGetCaps ``
101+ * ``otPlatRadioGetTransmitBuffer ``
102+ * ``otPlatRadioSetPanId ``
103+ * ``otPlatRadioEnable ``
104+ * ``otPlatRadioDisable ``
105+ * ``otPlatRadioReceive ``
106+ * ``otPlatRadioGetRssi ``
107+ * ``otPlatRadioGetReceiveSensitivity ``
108+ * ``otPlatRadioEnergyScan ``
109+ * ``otPlatRadioSetExtendedAddress ``
110+ * ``otPlatRadioSetShortAddress ``
111+ * ``otPlatRadioAddSrcMatchExtEntry ``
112+ * ``otPlatRadioTransmit ``
113+ * ``otPlatRadioClearSrcMatchShortEntries ``
114+ * ``otPlatRadioClearSrcMatchExtEntries ``
115+ * ``otPlatRadioEnableSrcMatch ``
116+ * ``otPlatRadioAddSrcMatchShortEntry ``
117+ * ``otPlatRadioClearSrcMatchShortEntry ``
118+ * ``otPlatRadioClearSrcMatchExtEntry ``
119+
120+ Additionally, you must implement the following functions from the OpenThread radio API (see
121+ :zephyr_file: `include/zephyr/net/openthread.h `) to handle radio initialization and event processing:
122+
123+ * :c:func: `platformRadioInit `
124+ * :c:func: `platformRadioProcess `
125+
126+ To initialize the OpenThread stack in this approach, either call the :c:func: `ot_platform_init `
127+ function in your application, or enable the :kconfig:option: `CONFIG_OPENTHREAD_SYS_INIT ` Kconfig
128+ option to automatically initialize OpenThread during system startup. You can set the
129+ initialization priority using the :kconfig:option: `CONFIG_OPENTHREAD_SYS_INIT_PRIORITY ` Kconfig
130+ option.
131+
67132.. doxygengroup :: openthread
0 commit comments