• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 the NCP.
32  */
33 
34 #ifndef CONFIG_NCP_H_
35 #define CONFIG_NCP_H_
36 
37 #ifndef OPENTHREAD_RADIO
38 #define OPENTHREAD_RADIO 0
39 #endif
40 
41 /**
42  * @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE
43  *
44  * Define to 1 to enable NCP SPI support.
45  */
46 #ifndef OPENTHREAD_CONFIG_NCP_SPI_ENABLE
47 #define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0
48 #endif
49 
50 /**
51  * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
52  *
53  * Define to 1 to enable NCP HDLC support.
54  */
55 #ifndef OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
56 #define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 0
57 #endif
58 
59 /**
60  * @def OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE
61  *
62  * The size of NCP message buffer in bytes.
63  */
64 #ifndef OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE
65 #define OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE 2048
66 #endif
67 
68 /**
69  * @def OPENTHREAD_CONFIG_NCP_HDLC_TX_CHUNK_SIZE
70  *
71  * The size of NCP HDLC TX chunk in bytes.
72  */
73 #ifndef OPENTHREAD_CONFIG_NCP_HDLC_TX_CHUNK_SIZE
74 #define OPENTHREAD_CONFIG_NCP_HDLC_TX_CHUNK_SIZE 2048
75 #endif
76 
77 /**
78  * @def OPENTHREAD_CONFIG_NCP_HDLC_RX_BUFFER_SIZE
79  *
80  * The size of NCP HDLC RX buffer in bytes.
81  */
82 #ifndef OPENTHREAD_CONFIG_NCP_HDLC_RX_BUFFER_SIZE
83 #if OPENTHREAD_RADIO
84 #define OPENTHREAD_CONFIG_NCP_HDLC_RX_BUFFER_SIZE 512
85 #else
86 #define OPENTHREAD_CONFIG_NCP_HDLC_RX_BUFFER_SIZE 1300
87 #endif
88 #endif // OPENTHREAD_CONFIG_NCP_HDLC_RX_BUFFER_SIZE
89 
90 /**
91  * @def OPENTHREAD_CONFIG_NCP_SPI_BUFFER_SIZE
92  *
93  * The size of NCP SPI (RX/TX) buffer in bytes.
94  */
95 #ifndef OPENTHREAD_CONFIG_NCP_SPI_BUFFER_SIZE
96 #if OPENTHREAD_RADIO
97 #define OPENTHREAD_CONFIG_NCP_SPI_BUFFER_SIZE 512
98 #else
99 #define OPENTHREAD_CONFIG_NCP_SPI_BUFFER_SIZE 1300
100 #endif
101 #endif // OPENTHREAD_CONFIG_NCP_SPI_BUFFER_SIZE
102 
103 /**
104  * @def OPENTHREAD_CONFIG_NCP_SPINEL_ENCRYPTER_EXTRA_DATA_SIZE
105  *
106  * The size of extra data to be allocated in UART buffer,
107  * needed by NCP Spinel Encrypter.
108  */
109 #ifndef OPENTHREAD_CONFIG_NCP_SPINEL_ENCRYPTER_EXTRA_DATA_SIZE
110 #define OPENTHREAD_CONFIG_NCP_SPINEL_ENCRYPTER_EXTRA_DATA_SIZE 0
111 #endif
112 
113 /**
114  * @def OPENTHREAD_CONFIG_NCP_SPINEL_LOG_MAX_SIZE
115  *
116  * The maximum OpenThread log string size (number of chars) supported by NCP using Spinel `StreamWrite`.
117  */
118 #ifndef OPENTHREAD_CONFIG_NCP_SPINEL_LOG_MAX_SIZE
119 #define OPENTHREAD_CONFIG_NCP_SPINEL_LOG_MAX_SIZE 150
120 #endif
121 
122 /**
123  * @def OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
124  *
125  * Define as 1 to enable peek/poke functionality on NCP.
126  *
127  * Peek/Poke allows the host to read/write to memory addresses on NCP. This is intended for debugging.
128  */
129 #ifndef OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
130 #define OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE 0
131 #endif
132 
133 /**
134  * @def OPENTHREAD_CONFIG_NCP_SPINEL_RESPONSE_QUEUE_SIZE
135  *
136  * Size of NCP Spinel command response queue.
137  *
138  * NCP guarantees that it can respond up to `OPENTHREAD_CONFIG_NCP_SPINEL_RESPONSE_QUEUE_SIZE` spinel commands at the
139  * same time. The spinel protocol defines a Transaction ID (TID) as part of spinel command frame (the TID can be
140  * a value 0-15 where TID 0 is used for frames which require no response). Spinel protocol can support at most support
141  * 15 simultaneous commands.
142  *
143  * The host driver implementation may further limit the number of simultaneous Spinel command frames (e.g., wpantund
144  * limits this to two). This configuration option can be used to reduce the response queue size.
145  */
146 #ifndef OPENTHREAD_CONFIG_NCP_SPINEL_RESPONSE_QUEUE_SIZE
147 #define OPENTHREAD_CONFIG_NCP_SPINEL_RESPONSE_QUEUE_SIZE 15
148 #endif
149 
150 /**
151  * @def OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL
152  *
153  * Define to 1 to enable support controlling of desired power state of NCP's micro-controller.
154  *
155  * The power state specifies the desired power state of NCP's micro-controller (MCU) when the underlying platform's
156  * operating system enters idle mode (i.e., all active tasks/events are processed and the MCU can potentially enter a
157  * energy-saving power state).
158  *
159  * The power state primarily determines how the host should interact with the NCP and whether the host needs an
160  * external trigger (a "poke") before it can communicate with the NCP or not.
161  *
162  * When enabled, the platform is expected to provide `otPlatSetMcuPowerState()` and `otPlatGetMcuPowerState()`
163  * functions (please see `openthread/platform/misc.h`). Host can then control the power state using
164  * `SPINEL_PROP_MCU_POWER_STATE`.
165  */
166 #ifndef OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL
167 #define OPENTHREAD_CONFIG_NCP_ENABLE_MCU_POWER_STATE_CONTROL 0
168 #endif
169 
170 /**
171  * @def OPENTHREAD_CONFIG_NCP_INFRA_IF_ENABLE
172  *
173  * Define to 1 to enable the NCP based implementation of platform InfraIf APIs.
174  */
175 #ifndef OPENTHREAD_CONFIG_NCP_INFRA_IF_ENABLE
176 #define OPENTHREAD_CONFIG_NCP_INFRA_IF_ENABLE 0
177 #endif
178 
179 /**
180  * @def OPENTHREAD_CONFIG_NCP_DNSSD_ENABLE
181  *
182  * Define to 1 to enable NCP based implementation of platform DNS-SD APIs.
183  */
184 #ifndef OPENTHREAD_CONFIG_NCP_DNSSD_ENABLE
185 #define OPENTHREAD_CONFIG_NCP_DNSSD_ENABLE 0
186 #endif
187 
188 /**
189  * @def OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
190  *
191  * TODO: complete.
192  */
193 #ifndef OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
194 #define OPENTHREAD_ENABLE_NCP_VENDOR_HOOK 0
195 #endif
196 
197 #endif // CONFIG_NCP_H_
198