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