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  * @def OPENTHREAD_CONFIG_PLATFORM_INFO
12  *
13  * The platform-specific string to insert into the OpenThread version string.
14  *
15  */
16 #define OPENTHREAD_CONFIG_PLATFORM_INFO CONFIG_IDF_TARGET
17 
18 /**
19  * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
20  *
21  * The assert is managed by platform defined logic when this flag is set.
22  *
23  */
24 #define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1
25 
26 /**
27  * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE
28  *
29  * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
30  *
31  * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs.
32  *
33  */
34 #define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1
35 
36 /**
37  * @def OPENTHREAD_CONFIG_LOG_OUTPUT
38  *
39  * The ESP-IDF platform provides an otPlatLog() function.
40  */
41 #define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
42 
43 /**
44  * @def OPENTHREAD_CONFIG_LOG_LEVEL
45  *
46  * The log level (used at compile time). If `OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE` is set, this defines the most
47  * verbose log level possible. See `OPENTHREAD_CONFIG_LOG_LEVEL_INIT` to set the initial log level.
48  *
49  */
50 #ifndef OPENTHREAD_CONFIG_LOG_LEVEL
51 #if CONFIG_LOG_DEFAULT_LEVEL_NONE
52 #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_NONE
53 #elif CONFIG_LOG_DEFAULT_LEVEL_ERROR
54 #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_CRIT
55 #elif CONFIG_LOG_DEFAULT_LEVEL_WARN
56 #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_WARN
57 #elif CONFIG_LOG_DEFAULT_LEVEL_INFO
58 #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_WARN
59 #elif CONFIG_LOG_DEFAULT_LEVEL_DEBUG
60 #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_INFO
61 #elif CONFIG_LOG_DEFAULT_LEVEL_VERBOSE
62 #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG
63 #endif
64 #endif
65 
66 #define    OPENTHREAD_CONFIG_LOG_API 1
67 #define    OPENTHREAD_CONFIG_LOG_ARP 1
68 #define    OPENTHREAD_CONFIG_LOG_BBR 1
69 #define    OPENTHREAD_CONFIG_LOG_CLI 1
70 #define    OPENTHREAD_CONFIG_LOG_COAP 1
71 #define    OPENTHREAD_CONFIG_LOG_DUA 1
72 #define    OPENTHREAD_CONFIG_LOG_ICMP 1
73 #define    OPENTHREAD_CONFIG_LOG_IP6 1
74 #define    OPENTHREAD_CONFIG_LOG_MAC 1
75 #define    OPENTHREAD_CONFIG_LOG_MEM 1
76 #define    OPENTHREAD_CONFIG_LOG_MESHCOP 1
77 #define    OPENTHREAD_CONFIG_LOG_MLE 1
78 #define    OPENTHREAD_CONFIG_LOG_MLR 1
79 #define    OPENTHREAD_CONFIG_LOG_NETDATA 1
80 #define    OPENTHREAD_CONFIG_LOG_NETDIAG 1
81 #define    OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
82 #define    OPENTHREAD_CONFIG_LOG_PLATFORM 1
83 
84 /**
85  * @def OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS
86  *
87  * The number of message buffers in buffer pool
88  */
89 #define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 50
90 
91 /**
92  * @def OPENTHREAD_CONFIG_COAP_API_ENABLE
93  *
94  * Define to 1 to enable the CoAP API.
95  *
96  */
97 #define OPENTHREAD_CONFIG_COAP_API_ENABLE 0
98 
99 /**
100  * @def OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
101  *
102  * Define to 1 to enable Border Router support.
103  *
104  */
105 #ifndef OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE
106 #define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 0
107 #endif
108 
109 /**
110  * @def OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
111  *
112  * Define to 1 to enable Thread Test Harness reference device support.
113  *
114  */
115 #define OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE 0
116 
117 /**
118  * @def OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE
119  *
120  * Define to 1 to enable Child Supervision support.
121  *
122  */
123 #ifndef OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE
124 #define OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE 0
125 #endif
126 
127 /**
128  * @def OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
129  *
130  * Define to 1 to enable DHCPv6 Client support.
131  *
132  */
133 #ifndef OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE
134 #define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 0
135 #endif
136 
137 /**
138  * @def OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE
139  *
140  * Define to 1 to enable DHCPv6 Server support.
141  *
142  */
143 #ifndef OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE
144 #define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 0
145 #endif
146 
147 /**
148  * @def OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE
149  *
150  * Define to 1 to enable DNS Client support.
151  *
152  */
153 #ifndef OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE
154 #define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 0
155 #endif
156 
157 /**
158  * @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE
159  *
160  * Define to 1 to enable NCP SPI support.
161  *
162  */
163 #define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0
164 
165 /**
166  * @def OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER
167  *
168  * Define to 1 to enable NCP Spinel Encrypter.
169  *
170  */
171 #define OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER 0
172 
173 /**
174  * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
175  *
176  * Define to 1 to enable NCP HDLC support.
177  *
178  */
179 #define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
180 
181 /**
182  * @def OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE
183  *
184  * Define 1 to enable feeding an OpenThread message to encoder/decoder.
185  *
186  */
187 #define OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE 0
188 
189 /**
190  * @def OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
191  *
192  * Define to 1 to support injecting Service entries into the Thread Network Data.
193  *
194  */
195 #define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 0
196 
197 /**
198  * @def PACKAGE_NAME
199  *
200  * Define to the full name of this package.
201  *
202  */
203 #define PACKAGE_NAME "openthread-esp32"
204 
205 /**
206  * @def PACKAGE_STRING
207  *
208  * Define to the full name and version of this package.
209  *
210  */
211 #define PACKAGE_STRING (PACKAGE_NAME " - " PACKAGE_VERSION)
212 
213 /**
214  * @def OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS
215  *
216  * Define as 1 to enable bultin-mbedtls.
217  *
218  * Note that the OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS determines whether to use bultin-mbedtls as well as
219  * whether to manage mbedTLS internally, such as memory allocation and debug.
220  *
221  */
222 #define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS 0
223 
224 /**
225  * @def OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE
226  *
227  * Define as 1 to enable support for adding of auto-configured SLAAC addresses by OpenThread.
228  *
229  */
230 #define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 0
231 
232 /**
233  * @def OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS
234  *
235  * The maximum number of state-changed callback handlers (set using `otSetStateChangedCallback()`).
236  *
237  */
238 #define OPENTHREAD_CONFIG_MAX_STATECHANGE_HANDLERS 3
239 
240 /**
241  * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE
242  *
243  * Specifies the rx frame buffer size used by `SpinelInterface` in RCP host code. This is applicable/used when
244  * `RadioSpinel` platform is used.
245  *
246  */
247 #define OPENTHREAD_CONFIG_PLATFORM_RADIO_SPINEL_RX_FRAME_BUFFER_SIZE 1024
248 
249 /**
250  * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
251  *
252  * Define as 1 to enable microsecond timer.
253  *
254  */
255 #define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1
256 
257 /**
258  * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
259  *
260  * Define to 1 to enable software CSMA-CA backoff logic.
261  *
262  */
263 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1
264 
265 /**
266  * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
267  *
268  * Define to 1 to enable software retransmission logic.
269  *
270  */
271 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
272 
273 /**
274  * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
275  *
276  * Define to 1 to enable software transmission security logic.
277  *
278  */
279 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 1
280 
281 /**
282  * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE
283  *
284  * Define to 1 to enable software transmission target time logic.
285  *
286  */
287 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE 1
288 
289 /**
290  * The configurable definitions via Kconfig
291  */
292 #if CONFIG_OPENTHREAD_COMMISSIONER
293 #error "Commissioner shouldn't be enabled for RCP"
294 #endif
295 
296 #if CONFIG_OPENTHREAD_JOINER
297 #error "Joiner shouldn't be enabled for RCP"
298 #endif
299 
300 #if CONFIG_OPENTHREAD_DIAG
301 #define OPENTHREAD_CONFIG_DIAG_ENABLE 1
302 #endif
303 
304 #if CONFIG_OPENTHREAD_FTD
305 #error "Only OPENTHREAD_RADIO is used for RCP"
306 #elif CONFIG_OPENTHREAD_MTD
307 #error "Only OPENTHREAD_RADIO is used for RCP"
308 #elif CONFIG_OPENTHREAD_RADIO
309 #define OPENTHREAD_RADIO 1
310 #endif
311