1 /* 2 * Copyright (c) 2016, 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 cc2538 compile-time configuration constants for OpenThread. 32 */ 33 34 #ifndef OPENTHREAD_CORE_CC2538_CONFIG_H_ 35 #define OPENTHREAD_CORE_CC2538_CONFIG_H_ 36 37 /** 38 * @def OPENTHREAD_CONFIG_PLATFORM_INFO 39 * 40 * The platform-specific string to insert into the OpenThread version string. 41 * 42 */ 43 #define OPENTHREAD_CONFIG_PLATFORM_INFO "CC2538" 44 45 /** 46 * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 47 * 48 * Define to 1 if you want to enable software ACK timeout logic. 49 * 50 */ 51 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 1 52 53 /** 54 * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 55 * 56 * Define to 1 if you want to enable software retransmission logic. 57 * 58 */ 59 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1 60 61 /** 62 * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 63 * 64 * Define to 1 if you want to enable software CSMA-CA backoff logic. 65 * 66 */ 67 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1 68 69 /** 70 * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 71 * 72 * Define to 1 if you want to enable software transmission security logic. 73 * 74 */ 75 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE 0 76 77 /** 78 * @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 79 * 80 * Define to 1 if you want to enable software energy scanning logic. 81 * 82 */ 83 #define OPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE 1 84 85 /** 86 * @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 87 * 88 * Define to 1 to enable NCP HDLC support. 89 * 90 */ 91 #define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1 92 93 /** 94 * @def OPENTHREAD_CONFIG_CC2538_USE_RADIO_RX_INTERRUPT 95 * 96 * Enable support for using interrupt-driven radio reception. This allows 97 * for a single frame to be received whilst the CPU is busy processing some 98 * other code. 99 * 100 * To disable interrupts and just rely on polling, set this to 0. 101 * 102 */ 103 #ifndef OPENTHREAD_CONFIG_CC2538_USE_RADIO_RX_INTERRUPT 104 #define OPENTHREAD_CONFIG_CC2538_USE_RADIO_RX_INTERRUPT 1 105 #endif 106 107 /** 108 * @def OPENTHREAD_CONFIG_CC2538_WITH_CC2592 109 * 110 * Enable support for the CC2592 range-extender front-end. 111 * 112 * This is a feature of the CC2538-CC2592 EM and other peripherals which 113 * extends the range of the bare CC2538 to over a kilometre line-of-sight. 114 * The CC2592 needs to be wired up to the RF port on the CC2538 in accordance 115 * with application note 130 ("Using CC2592 Front End With CC2538", TI doc 116 * SWRA447). 117 * 118 * If you have such a board, change this to 1. 119 * 120 */ 121 #ifndef OPENTHREAD_CONFIG_CC2538_WITH_CC2592 122 #define OPENTHREAD_CONFIG_CC2538_WITH_CC2592 0 123 #endif 124 125 /** 126 * @def OPENTHREAD_CONFIG_CC2592_PA_EN_PIN 127 * 128 * Define the pin (on port C) that connects to the CC2592 PA_EN pin. 129 * 130 * One of the 3 observable channels on the CC2538 radio module will be 131 * configured to take the "PA power down" signal from the radio module itself, 132 * invert it, and emit it on this GPIO pin. Due to hardware constraints, it 133 * may only be connected to a pin on GPIO port C. 134 * 135 * The default (PC3) is as per TI recommendations in AN130. 136 * 137 */ 138 #ifndef OPENTHREAD_CONFIG_CC2592_PA_EN_PIN 139 #define OPENTHREAD_CONFIG_CC2592_PA_EN_PIN 3 140 #endif 141 142 /** 143 * @def OPENTHREAD_CONFIG_CC2592_LNA_EN_PIN 144 * 145 * Define the pin (on port C) that connects to the CC2592 LNA_EN pin. 146 * 147 * One of the 3 observable channels on the CC2538 radio module will be 148 * configured to take the "LNA power down" signal from the radio module itself, 149 * invert it, and emit it on this GPIO pin. Due to hardware constraints, it 150 * may only be connected to a pin on GPIO port C. 151 * 152 * The default (PC2) is as per TI recommendations in AN130. 153 * 154 */ 155 #ifndef OPENTHREAD_CONFIG_CC2592_LNA_EN_PIN 156 #define OPENTHREAD_CONFIG_CC2592_LNA_EN_PIN 2 157 #endif 158 159 /** 160 * @def OPENTHREAD_CONFIG_CC2592_USE_HGM 161 * 162 * Enable control of the high-gain mode signal. 163 * 164 * High-gain mode is enabled through the `HGM` pin on the CC2592, which may be 165 * connected to any free GPIO pin for software control, or may be linked to 166 * VDD or 0V to hard-wire it to a given state. 167 * 168 * Set this to 0 if you have wired this pin to a power rail, or have a 169 * non-standard way of controlling it. 170 * 171 */ 172 #ifndef OPENTHREAD_CONFIG_CC2592_USE_HGM 173 #define OPENTHREAD_CONFIG_CC2592_USE_HGM 1 174 #endif 175 176 /** 177 * @def OPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY 178 * 179 * Set the CC2538 receive sensitivity. 180 * 181 * A bare CC2538 has a receive sensitivity of -88dBm. The CC2592 changes this 182 * to -85 or -81 depending on whether the HGM pin is high or low. If 183 * `OPENTHREAD_CONFIG_CC2592_USE_HGM` is 0, then this sets the receive 184 * sensitivity. 185 * 186 */ 187 #ifndef OPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY 188 #define OPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY -88 189 #endif 190 191 /** 192 * @def OPENTHREAD_CONFIG_CC2538_RSSI_OFFSET 193 * 194 * Set the CC2538 RSSI offset. This calibrates the RSSI readings received from 195 * the CC2538 radio module to give a reading in dBm. 196 * 197 * For a standard CC2538 (no front-end), the RSSI offset is 73. 198 * 199 * For a CC2592 hard-wired in high-gain mode, an offset of 85 should be used; 200 * or for low-gain mode, 81. If `OPENTHREAD_CONFIG_CC2592_USE_HGM` is 0, then 201 * this calibrates the RSSI value accordingly. 202 */ 203 #ifndef OPENTHREAD_CONFIG_CC2538_RSSI_OFFSET 204 #define OPENTHREAD_CONFIG_CC2538_RSSI_OFFSET 73 205 #endif 206 207 /** 208 * @def OPENTHREAD_CONFIG_CC2592_HGM_PORT 209 * 210 * Define the GPIO port that the HGM pin is connected to. It may be 211 * connected to any available GPIO pin. 212 * 213 * The default (GPIO port D) is as per TI recommendations. 214 * 215 */ 216 #ifndef OPENTHREAD_CONFIG_CC2592_HGM_PORT 217 #define OPENTHREAD_CONFIG_CC2592_HGM_PORT GPIO_D_BASE 218 #endif 219 220 /** 221 * @def OPENTHREAD_CONFIG_CC2592_HGM_PIN 222 * 223 * Define the pin on the GPIO port that the HGM pin is connected to. It 224 * may be connected to any available GPIO pin. 225 * 226 * The default (PD2) is as per TI recommendations. 227 * 228 */ 229 #ifndef OPENTHREAD_CONFIG_CC2592_HGM_PIN 230 #define OPENTHREAD_CONFIG_CC2592_HGM_PIN 2 231 #endif 232 233 /** 234 * @def OPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE 235 * 236 * Define the default state of the CC2592's HGM pin. 237 * 238 * The default is to turn high-gain mode on. 239 * 240 */ 241 #ifndef OPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE 242 #define OPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE true 243 #endif 244 245 /** 246 * @def OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 247 * 248 * Define to 1 to enable otPlatFlash* APIs to support non-volatile storage. 249 * 250 * When defined to 1, the platform MUST implement the otPlatFlash* APIs instead of the otPlatSettings* APIs. 251 * 252 */ 253 #define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1 254 255 #endif // OPENTHREAD_CORE_CC2538_CONFIG_H_ 256