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