1 /*
2  *  Copyright (c) 2019, The OpenThread Authors.
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *  1. Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  *  2. Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *  3. Neither the name of the copyright holder nor the
13  *     names of its contributors may be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  *  POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 /**
30  * @file
31  *   This file includes compile-time configurations for platform-specific services.
32  *
33  */
34 
35 #ifndef CONFIG_PLATFORM_H_
36 #define CONFIG_PLATFORM_H_
37 
38 #include "config/srp_server.h"
39 
40 /**
41  * @addtogroup config-platform
42  *
43  * @brief
44  *   This module includes configuration variables for platform-specific services.
45  *
46  * @{
47  *
48  */
49 
50 /**
51  * @def OPENTHREAD_CONFIG_PLATFORM_INFO
52  *
53  * The platform-specific string to insert into the OpenThread version string.
54  *
55  */
56 #ifndef OPENTHREAD_CONFIG_PLATFORM_INFO
57 #define OPENTHREAD_CONFIG_PLATFORM_INFO "NONE"
58 #endif
59 
60 /**
61  * @def OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT
62  *
63  * The message pool is managed by platform defined logic when this flag is set.
64  * This feature would typically be used when operating in a multi-threaded system
65  * and multiple threads need to access the message pool.
66  *
67  */
68 #ifndef OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT
69 #define OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT 0
70 #endif
71 
72 /**
73  * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
74  *
75  * The assert is managed by platform defined logic when this flag is set.
76  *
77  */
78 #ifndef OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
79 #define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 0
80 #endif
81 
82 /**
83  * @def OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
84  *
85  * Define to 1 to enable platform NETIF support.
86  *
87  */
88 #ifndef OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
89 #define OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE 0
90 #endif
91 
92 /**
93  * @def OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
94  *
95  * Define to 1 to enable platform UDP support.
96  *
97  */
98 #ifndef OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
99 #define OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 0
100 #endif
101 
102 /**
103  * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
104  *
105  * Define to 1 if you want to enable microsecond backoff timer implemented in platform.
106  *
107  */
108 #ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
109 #define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 0
110 #endif
111 
112 /**
113  * @def OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
114  *
115  * Define as 1 to enable DNSSD (mDNS) platform module.
116  *
117  */
118 #ifndef OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
119 #define OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE 0
120 #endif
121 
122 /**
123  * @def OPENTHREAD_CONFIG_PLATFORM_DNSSD_ALLOW_RUN_TIME_SELECTION
124  *
125  * Define as 1 to enable run-time selection of DNSSD module, i.e., whether the native OpenThread mDNS module is used or
126  * the platform `otPlatDnssd` APIs are used (DNSSD support is delegated to the platform layer).
127  *
128  * This config is mainly intended for testing, allowing test-specific `otPlatDnssd` APIs to be used instead of the
129  * native mDNS module in unit tests.
130  *
131  */
132 #ifndef OPENTHREAD_CONFIG_PLATFORM_DNSSD_ALLOW_RUN_TIME_SELECTION
133 #define OPENTHREAD_CONFIG_PLATFORM_DNSSD_ALLOW_RUN_TIME_SELECTION 0
134 #endif
135 
136 /**
137  * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
138  *
139  * Define to 1 if you want to enable radio coexistence implemented in platform.
140  *
141  */
142 #ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
143 #define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 0
144 #endif
145 
146 /**
147  * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT
148  *
149  * Define to 1 if you want to enable proprietary radio support as defined by platform.
150  *
151  */
152 #ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT
153 #define OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT 0
154 #endif
155 
156 /**
157  * @def OPENTHREAD_CONFIG_PSA_ITS_NVM_OFFSET
158  *
159  * Default NVM offset while using key refs. Platforms can override this definition based on implementation
160  *
161  */
162 #ifndef OPENTHREAD_CONFIG_PSA_ITS_NVM_OFFSET
163 #define OPENTHREAD_CONFIG_PSA_ITS_NVM_OFFSET 0x20000
164 #endif
165 
166 /**
167  * @def OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
168  *
169  * Define to 1 if you want to enable key ref usage support as defined by platform.
170  *
171  */
172 #ifndef OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
173 #define OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE 0
174 #endif
175 
176 /**
177  * @def OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE
178  *
179  * Define to 1 if you want to make MAC keys exportable.
180  *
181  */
182 #ifndef OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE
183 #define OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE 0
184 #endif
185 
186 /**
187  * @def OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
188  *
189  * Define as 1 to enable platform power calibration support.
190  *
191  */
192 #ifndef OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
193 #define OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE 0
194 #endif
195 
196 #if OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT
197 #if (!defined(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE) || \
198      !defined(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MIN) ||  \
199      !defined(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MAX) ||  \
200      !defined(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MASK))
201 #error "Proprietary radio support requires\
202  OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE,\
203  OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MIN,\
204  OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MAX and\
205  OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MASK\
206  to be defined by Platform."
207 #endif
208 
209 #if OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE > 31
210 #error "Maximum Proprietary Channel Page value currently supported is 31."
211 #endif
212 #endif
213 
214 /**
215  * @}
216  *
217  */
218 
219 #endif // CONFIG_PLATFORM_H_
220