1 /*
2  * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #include "sdkconfig.h"
10 
11 /**
12  * @def OPENTHREAD_CONFIG_PLATFORM_INFO
13  *
14  * The platform-specific string to insert into the OpenThread version string.
15  *
16  */
17 #define OPENTHREAD_CONFIG_PLATFORM_INFO CONFIG_IDF_TARGET
18 
19 /**
20  * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
21  *
22  * The assert is managed by platform defined logic when this flag is set.
23  *
24  */
25 #define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1
26 
27 /**
28  * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
29  *
30  * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
31  *
32  * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs.
33  *
34  */
35 #define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1
36 
37 /**
38  * @def OPENTHREAD_CONFIG_LOG_OUTPUT
39  *
40  * The ESP-IDF platform provides an otPlatLog() function.
41  */
42 #define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
43 
44 /**
45  * @def OPENTHREAD_CONFIG_LOG_LEVEL
46  *
47  * The log level (used at compile time). If `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE` is set, this defines the most
48  * verbose log level possible. See `OPENTHREAD_CONFIG_LOG_LEVEL_INIT` to set the initial log level.
49  *
50  */
51 #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG
52 
53 /**
54  * @def OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE
55  *
56  * Define as 1 to enable dynamic log level control.
57  *
58  */
59 #define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE 1
60 
61 #define OPENTHREAD_CONFIG_LOG_API 1
62 #define OPENTHREAD_CONFIG_LOG_ARP 1
63 #define OPENTHREAD_CONFIG_LOG_BBR 1
64 #define OPENTHREAD_CONFIG_LOG_CLI 1
65 #define OPENTHREAD_CONFIG_LOG_COAP 1
66 #define OPENTHREAD_CONFIG_LOG_DUA 1
67 #define OPENTHREAD_CONFIG_LOG_ICMP 1
68 #define OPENTHREAD_CONFIG_LOG_IP6 1
69 #define OPENTHREAD_CONFIG_LOG_MAC 1
70 #define OPENTHREAD_CONFIG_LOG_MEM 1
71 #define OPENTHREAD_CONFIG_LOG_MESHCOP 1
72 #define OPENTHREAD_CONFIG_LOG_MLE 1
73 #define OPENTHREAD_CONFIG_LOG_MLR 1
74 #define OPENTHREAD_CONFIG_LOG_NETDATA 1
75 #define OPENTHREAD_CONFIG_LOG_NETDIAG 1
76 #define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
77 #define OPENTHREAD_CONFIG_LOG_PLATFORM 1
78 
79 /**
80  * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS
81  *
82  * The number of message buffers in buffer pool
83  */
84 #define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS CONFIG_OPENTHREAD_NUM_MESSAGE_BUFFERS
85 
86 /**
87  * @def OPENTHREAD_CONFIG_COAP_API_ENABLE
88  *
89  * Define to 1 to enable the CoAP API.
90  *
91  */
92 #define OPENTHREAD_CONFIG_COAP_API_ENABLE 1
93 
94 
95 /**
96  * @def OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
97  *
98  * Define to 1 to enable platform NETIF support.
99  *
100  */
101 #ifndef OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
102 #define OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE 1
103 #endif
104 
105 /**
106  * @def OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
107  *
108  * Enable the external heap.
109  *
110  */
111 #ifndef OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
112 #define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1
113 #endif
114 
115 /**
116  * @def OPENTHREAD_CONFIG_TCP_ENABLE
117  *
118  * Define to 0 to disable TCP
119  *
120  */
121 #ifndef OPENTHREAD_CONFIG_TCP_ENABLE
122 #define OPENTHREAD_CONFIG_TCP_ENABLE 0
123 #endif
124 
125 #if CONFIG_OPENTHREAD_BORDER_ROUTER
126 
127 /**
128  * @def OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
129  *
130  * Define to 1 to enable Border Agent support.
131  *
132  */
133 #ifndef OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
134 #define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 1
135 #endif
136 
137 /**
138  * @def OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
139  *
140  * Define to 1 to enable Border Router support.
141  *
142  */
143 #ifndef OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
144 #define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1
145 #endif
146 
147 /**
148  * @def OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
149  *
150  * Define to 1 to enable Border Routing support.
151  *
152  */
153 #ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
154 #define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 1
155 #endif
156 
157 /**
158  * @def OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
159  *
160  * Define to 1 to enable platform UDP support.
161  *
162  */
163 #ifndef OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
164 #define OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 1
165 #endif
166 
167 /**
168  * @def OPENTHREAD_CONFIG_ECDSA_ENABLE
169  *
170  * Define to 1 to enable ECDSA support.
171  *
172  */
173 #ifndef OPENTHREAD_CONFIG_ECDSA_ENABLE
174 #define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
175 #endif
176 
177 /**
178  * @def OPENTHREAD_CONFIG_SRP_SERVER_ENABLE
179  *
180  * Define to 1 to enable SRP Server support.
181  *
182  */
183 #ifndef OPENTHREAD_CONFIG_SRP_SERVER_ENABLE
184 #define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 1
185 #endif
186 
187 /**
188  * @def OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE
189  *
190  * Define to 1 to enable DNS-SD Server support.
191  *
192  */
193 #ifndef OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE
194 #define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1
195 #endif
196 
197 #endif // CONFIG_OPENTHREAD_BORDER_ROUTER
198 
199 /**
200  * @def OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
201  *
202  * Define to 1 to enable Thread Test Harness reference device support.
203  *
204  */
205 #define OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE 1
206 
207 /**
208  * @def OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE
209  *
210  * Define to 1 to enable Child Supervision support.
211  *
212  */
213 #ifndef OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE
214 #define OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE 1
215 #endif
216 
217 /**
218  * @def OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
219  *
220  * Define to 1 to enable DHCPv6 Client support.
221  *
222  */
223 #ifndef OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
224 #define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 1
225 #endif
226 
227 /**
228  * @def OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE
229  *
230  * Define to 1 to enable DHCPv6 Server support.
231  *
232  */
233 #ifndef OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE
234 #define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 1
235 #endif
236 
237 /**
238  * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE
239  *
240  * Define to 1 to enable DNS Client support.
241  *
242  */
243 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE
244 #define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
245 #endif
246 
247 /**
248  * @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE
249  *
250  * Define to 1 to enable NCP SPI support.
251  *
252  */
253 #define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0
254 
255 /**
256  * @def OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER
257  *
258  * Define to 1 to enable NCP Spinel Encrypter.
259  *
260  */
261 #define OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER 0
262 
263 /**
264  * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
265  *
266  * Define to 1 to enable NCP HDLC support.
267  *
268  */
269 #define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
270 
271 /**
272  * @def OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
273  *
274  * Define to 1 to support injecting Service entries into the Thread Network Data.
275  *
276  */
277 #define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1
278 
279 /**
280  * @def PACKAGE_NAME
281  *
282  * Define to the full name of this package.
283  *
284  */
285 #define PACKAGE_NAME "openthread-esp32"
286 
287 /**
288  * @def PACKAGE_STRING
289  *
290  * Define to the full name and version of this package.
291  *
292  */
293 #define PACKAGE_STRING (PACKAGE_NAME " - " PACKAGE_VERSION)
294 
295 /**
296  * @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS
297  *
298  * Define as 1 to enable bultin-mbedtls.
299  *
300  * Note that the OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS determines whether to use bultin-mbedtls as well as
301  * whether to manage mbedTLS internally, such as memory allocation and debug.
302  *
303  */
304 #define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 0
305 
306 /**
307  * @def OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE
308  *
309  * Define as 1 to enable support for adding of auto-configured SLAAC addresses by OpenThread.
310  *
311  */
312 #define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1
313 
314 /**
315  * @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS
316  *
317  * The maximum number of state-changed callback handlers (set using `otSetStateChangedCallback()`).
318  *
319  */
320 #define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 3
321 
322 /**
323  * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE
324  *
325  * Specifies the rx frame buffer size used by `SpinelInterface` in RCP host code. This is applicable/used when
326  * `RadioSpinel` platform is used.
327  *
328  */
329 #define OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE 1024
330 
331 /**
332  * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
333  *
334  * Define as 1 to enable microsecond timer.
335  *
336  */
337 #define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1
338 
339 /**
340  * @def OPENTHREAD_CONFIG_PING_SENDER_ENABLE
341  *
342  * Define to 1 to enable ping sender module.
343  *
344  * Ping sender module implements sending ICMPv6 Echo Request messages and processing ICMPv6 Echo Reply messages.
345  *
346  */
347 #define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1
348 
349 /**
350  * @def OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN
351  *
352  * The max length of the OpenThread dtls content buffer.
353  *
354  */
355 #ifndef OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN
356 #define OPENTHREAD_CONFIG_DTLS_MAX_CONTENT_LEN 768
357 #endif
358 
359 /**
360  * The configurable definitions via Kconfig
361  */
362 #if CONFIG_OPENTHREAD_COMMISSIONER
363 #define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 1
364 #endif
365 
366 #if CONFIG_OPENTHREAD_JOINER
367 #define OPENTHREAD_CONFIG_JOINER_ENABLE 1
368 #endif
369 
370 #if CONFIG_OPENTHREAD_DIAG
371 #define OPENTHREAD_CONFIG_DIAG_ENABLE 1
372 #endif
373 
374 #if CONFIG_OPENTHREAD_SRP_CLIENT
375 #ifndef OPENTHREAD_CONFIG_ECDSA_ENABLE
376 #define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
377 #endif
378 
379 #ifndef OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE
380 #define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
381 #endif
382 #endif
383 
384 #if CONFIG_OPENTHREAD_FTD
385 #define OPENTHREAD_FTD 1
386 #elif CONFIG_OPENTHREAD_MTD
387 #define OPENTHREAD_MTD 1
388 #elif CONFIG_OPENTHREAD_RADIO
389 #define OPENTHREAD_RADIO 1
390 #endif
391