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 #ifndef CONFIG_PLATFORM_H_
35 #define CONFIG_PLATFORM_H_
36 
37 #include "config/srp_server.h"
38 
39 /**
40  * @addtogroup config-platform
41  *
42  * @brief
43  *   This module includes configuration variables for platform-specific services.
44  *
45  * @{
46  */
47 
48 /**
49  * @def OPENTHREAD_CONFIG_PLATFORM_INFO
50  *
51  * The platform-specific string to insert into the OpenThread version string.
52  */
53 #ifndef OPENTHREAD_CONFIG_PLATFORM_INFO
54 #define OPENTHREAD_CONFIG_PLATFORM_INFO "NONE"
55 #endif
56 
57 /**
58  * @def OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT
59  *
60  * The message pool is managed by platform defined logic when this flag is set.
61  * This feature would typically be used when operating in a multi-threaded system
62  * and multiple threads need to access the message pool.
63  */
64 #ifndef OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT
65 #define OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT 0
66 #endif
67 
68 /**
69  * @def OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
70  *
71  * The assert is managed by platform defined logic when this flag is set.
72  */
73 #ifndef OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
74 #define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 0
75 #endif
76 
77 /**
78  * @def OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
79  *
80  * Define to 1 to enable platform NETIF support.
81  */
82 #ifndef OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE
83 #define OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE 0
84 #endif
85 
86 /**
87  * @def OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
88  *
89  * Define to 1 to enable platform UDP support.
90  */
91 #ifndef OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE
92 #define OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE 0
93 #endif
94 
95 /**
96  * @def OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
97  *
98  * Define to 1 if you want to enable microsecond backoff timer implemented in platform.
99  */
100 #ifndef OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
101 #define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 0
102 #endif
103 
104 /**
105  * @def OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
106  *
107  * Define as 1 to enable DNSSD (mDNS) platform module.
108  */
109 #ifndef OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE
110 #define OPENTHREAD_CONFIG_PLATFORM_DNSSD_ENABLE 0
111 #endif
112 
113 /**
114  * @def OPENTHREAD_CONFIG_PLATFORM_DNSSD_ALLOW_RUN_TIME_SELECTION
115  *
116  * Define as 1 to enable run-time selection of DNSSD module, i.e., whether the native OpenThread mDNS module is used or
117  * the platform `otPlatDnssd` APIs are used (DNSSD support is delegated to the platform layer).
118  *
119  * This config is mainly intended for testing, allowing test-specific `otPlatDnssd` APIs to be used instead of the
120  * native mDNS module in unit tests.
121  */
122 #ifndef OPENTHREAD_CONFIG_PLATFORM_DNSSD_ALLOW_RUN_TIME_SELECTION
123 #define OPENTHREAD_CONFIG_PLATFORM_DNSSD_ALLOW_RUN_TIME_SELECTION 0
124 #endif
125 
126 /**
127  * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
128  *
129  * Define to 1 if you want to enable radio coexistence implemented in platform.
130  */
131 #ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
132 #define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 0
133 #endif
134 
135 /**
136  * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT
137  *
138  * Define to 1 if you want to enable proprietary radio support as defined by platform.
139  */
140 #ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT
141 #define OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT 0
142 #endif
143 
144 /**
145  * @def OPENTHREAD_CONFIG_PSA_ITS_NVM_OFFSET
146  *
147  * Default NVM offset while using key refs. Platforms can override this definition based on implementation
148  */
149 #ifndef OPENTHREAD_CONFIG_PSA_ITS_NVM_OFFSET
150 #define OPENTHREAD_CONFIG_PSA_ITS_NVM_OFFSET 0x20000
151 #endif
152 
153 /**
154  * @def OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
155  *
156  * Define to 1 if you want to enable key ref usage support as defined by platform.
157  */
158 #ifndef OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
159 #define OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE 0
160 #endif
161 
162 /**
163  * @def OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE
164  *
165  * Define to 1 if you want to make MAC keys exportable.
166  */
167 #ifndef OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE
168 #define OPENTHREAD_CONFIG_PLATFORM_MAC_KEYS_EXPORTABLE_ENABLE 0
169 #endif
170 
171 /**
172  * @def OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
173  *
174  * Define as 1 to enable platform power calibration support.
175  */
176 #ifndef OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE
177 #define OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE 0
178 #endif
179 
180 #if OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_SUPPORT
181 #if (!defined(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE) || \
182      !defined(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MIN) ||  \
183      !defined(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MAX) ||  \
184      !defined(OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MASK))
185 #error "Proprietary radio support requires\
186  OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE,\
187  OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MIN,\
188  OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MAX and\
189  OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MASK\
190  to be defined by Platform."
191 #endif
192 
193 #if OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_PAGE > 31
194 #error "Maximum Proprietary Channel Page value currently supported is 31."
195 #endif
196 #endif
197 
198 /**
199  * @}
200  */
201 
202 #endif // CONFIG_PLATFORM_H_
203