1 /* 2 * Copyright (c) 2017-2024, Texas Instruments Incorporated 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 7 * are met: 8 * 9 * * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * * Neither the name of Texas Instruments Incorporated nor the names of 17 * its contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 /** ============================================================================ 33 * @file DeviceFamily.h 34 * 35 * @brief Infrastructure to select correct driverlib path and identify devices 36 * 37 * This module enables the selection of the correct driverlib path for the current 38 * device. It also facilitates the use of per-device conditional compilation 39 * to enable minor variations in drivers between devices. 40 * 41 * In order to use this functionality, DeviceFamily_XYZ must be defined as one of 42 * the supported values. The DeviceFamily_ID and DeviceFamily_DIRECTORY defines 43 * are set based on DeviceFamily_XYZ. 44 */ 45 46 #ifndef ti_devices_DeviceFamily__include 47 #define ti_devices_DeviceFamily__include 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif 52 53 /* 54 * DeviceFamily_ID_XYZ values. 55 * 56 * DeviceFamily_ID may be used in the preprocessor for conditional compilation. 57 * DeviceFamily_ID is set to one of these values based on the top level 58 * DeviceFamily_XYZ define. 59 */ 60 #define DeviceFamily_ID_CC13X0 1 61 #define DeviceFamily_ID_CC26X0 2 62 #define DeviceFamily_ID_CC26X0R2 3 63 #define DeviceFamily_ID_CC13X2 4 64 #define DeviceFamily_ID_CC26X2 5 65 #define DeviceFamily_ID_CC3200 6 66 #define DeviceFamily_ID_CC3220 7 67 #define DeviceFamily_ID_CC13X1 8 68 #define DeviceFamily_ID_CC26X1 9 69 #define DeviceFamily_ID_CC13X2X7 10 70 #define DeviceFamily_ID_CC26X2X7 11 71 #define DeviceFamily_ID_CC13X1_CC26X1 12 72 #define DeviceFamily_ID_CC13X2_CC26X2 13 73 #define DeviceFamily_ID_CC13X2X7_CC26X2X7 14 74 #define DeviceFamily_ID_CC13X4_CC26X4 15 75 #define DeviceFamily_ID_CC13X4 16 76 #define DeviceFamily_ID_CC26X4 17 77 #define DeviceFamily_ID_CC26X3 18 78 #define DeviceFamily_ID_CC23X0R5 19 79 #define DeviceFamily_ID_CC23X0R2 20 80 #define DeviceFamily_ID_CC27XX 21 81 #define DeviceFamily_ID_CC35XX 22 82 #define DeviceFamily_ID_CC33XX 23 83 84 /* 85 * DeviceFamily_PARENT_XYZ values. 86 * 87 * DeviceFamily_PARENT may be used in the preprocessor for conditional 88 * compilation. DeviceFamily_PARENT is set to one of these values based 89 * on the top-level DeviceFamily_XYZ define. 90 */ 91 #define DeviceFamily_PARENT_CC13X0_CC26X0 1 92 #define DeviceFamily_PARENT_CC13X2_CC26X2 2 93 #define DeviceFamily_PARENT_CC13X1_CC26X1 3 94 #define DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4 4 95 #define DeviceFamily_PARENT_CC32XX 5 96 #define DeviceFamily_PARENT_CC23X0 6 97 #define DeviceFamily_PARENT_CC27XX 7 98 #define DeviceFamily_PARENT_CC35XX 8 99 100 /* 101 * Lookup table that sets DeviceFamily_ID, DeviceFamily_DIRECTORY, and 102 * DeviceFamily_PARENT based on the DeviceFamily_XYZ define. 103 * If DeviceFamily_XYZ is undefined, a compiler error is thrown. If 104 * multiple DeviceFamily_XYZ are defined, the first one encountered is used. 105 */ 106 #if defined(DeviceFamily_CC13X0) 107 #define DeviceFamily_ID DeviceFamily_ID_CC13X0 108 #define DeviceFamily_DIRECTORY cc13x0 109 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X0_CC26X0 110 111 #elif defined(DeviceFamily_CC13X1) 112 #define DeviceFamily_ID DeviceFamily_ID_CC13X1 113 #define DeviceFamily_DIRECTORY cc13x1_cc26x1 114 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X1_CC26X1 115 116 #elif defined(DeviceFamily_CC13X2) 117 #define DeviceFamily_ID DeviceFamily_ID_CC13X2 118 #define DeviceFamily_DIRECTORY cc13x2_cc26x2 119 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X2_CC26X2 120 121 #elif defined(DeviceFamily_CC13X2X7) 122 #define DeviceFamily_ID DeviceFamily_ID_CC13X2X7 123 #define DeviceFamily_DIRECTORY cc13x2x7_cc26x2x7 124 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X2_CC26X2 125 126 #elif defined(DeviceFamily_CC13X4) 127 #define DeviceFamily_ID DeviceFamily_ID_CC13X4 128 #define DeviceFamily_DIRECTORY cc13x4_cc26x4 129 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4 130 131 #elif defined(DeviceFamily_CC26X0) 132 #define DeviceFamily_ID DeviceFamily_ID_CC26X0 133 #define DeviceFamily_DIRECTORY cc26x0 134 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X0_CC26X0 135 136 #elif defined(DeviceFamily_CC26X0R2) 137 #define DeviceFamily_ID DeviceFamily_ID_CC26X0R2 138 #define DeviceFamily_DIRECTORY cc26x0r2 139 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X0_CC26X0 140 141 #elif defined(DeviceFamily_CC26X1) 142 #define DeviceFamily_ID DeviceFamily_ID_CC26X1 143 #define DeviceFamily_DIRECTORY cc13x1_cc26x1 144 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X1_CC26X1 145 146 #elif defined(DeviceFamily_CC26X2) 147 #define DeviceFamily_ID DeviceFamily_ID_CC26X2 148 #define DeviceFamily_DIRECTORY cc13x2_cc26x2 149 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X2_CC26X2 150 151 #elif defined(DeviceFamily_CC26X2X7) 152 #define DeviceFamily_ID DeviceFamily_ID_CC26X2X7 153 #define DeviceFamily_DIRECTORY cc13x2x7_cc26x2x7 154 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X2_CC26X2 155 156 #elif defined(DeviceFamily_CC26X3) 157 /* The CC2653 is very similar to CC26X4 from a software point of view, 158 * so we use the same directory and parent defines. 159 */ 160 #define DeviceFamily_ID DeviceFamily_ID_CC26X3 161 #define DeviceFamily_DIRECTORY cc13x4_cc26x4 162 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4 163 164 #elif defined(DeviceFamily_CC26X4) 165 #define DeviceFamily_ID DeviceFamily_ID_CC26X4 166 #define DeviceFamily_DIRECTORY cc13x4_cc26x4 167 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4 168 169 #elif defined(DeviceFamily_CC23X0R5) 170 #define DeviceFamily_ID DeviceFamily_ID_CC23X0R5 171 #define DeviceFamily_DIRECTORY cc23x0r5 172 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC23X0 173 174 #elif defined(DeviceFamily_CC23X0R2) 175 #define DeviceFamily_ID DeviceFamily_ID_CC23X0R2 176 #define DeviceFamily_DIRECTORY cc23x0r2 177 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC23X0 178 179 #elif defined(DeviceFamily_CC27XX) 180 #define DeviceFamily_ID DeviceFamily_ID_CC27XX 181 #define DeviceFamily_DIRECTORY cc27xx 182 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC27XX 183 184 #elif defined(DeviceFamily_CC13X1_CC26X1) 185 #define DeviceFamily_ID DeviceFamily_ID_CC13X1_CC26X1 186 #define DeviceFamily_DIRECTORY cc13x1_cc26x1 187 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X1_CC26X1 188 189 #elif defined(DeviceFamily_CC13X2_CC26X2) 190 #define DeviceFamily_ID DeviceFamily_ID_CC13X2_CC26X2 191 #define DeviceFamily_DIRECTORY cc13x2_cc26x2 192 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X2_CC26X2 193 194 #elif defined(DeviceFamily_CC13X2X7_CC26X2X7) 195 #define DeviceFamily_ID DeviceFamily_ID_CC13X2X7_CC26X2X7 196 #define DeviceFamily_DIRECTORY cc13x2x7_cc26x2x7 197 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X2_CC26X2 198 199 #elif defined(DeviceFamily_CC13X4_CC26X4) 200 #define DeviceFamily_ID DeviceFamily_ID_CC13X4_CC26X4 201 #define DeviceFamily_DIRECTORY cc13x4_cc26x4 202 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC13X4_CC26X3_CC26X4 203 204 #elif defined(DeviceFamily_CC3200) 205 #define DeviceFamily_ID DeviceFamily_ID_CC3200 206 #define DeviceFamily_DIRECTORY cc32xx 207 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC32XX 208 209 #elif defined(DeviceFamily_CC3220) 210 #define DeviceFamily_ID DeviceFamily_ID_CC3220 211 #define DeviceFamily_DIRECTORY cc32xx 212 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC32XX 213 214 #elif defined(DeviceFamily_CC35XX) 215 #define DeviceFamily_ID DeviceFamily_ID_CC35XX 216 #define DeviceFamily_DIRECTORY cc35xx 217 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC35XX 218 219 #elif defined(DeviceFamily_CC33XX) 220 #define DeviceFamily_ID DeviceFamily_ID_CC33XX 221 #define DeviceFamily_DIRECTORY cc33xx 222 #define DeviceFamily_PARENT DeviceFamily_PARENT_CC35XX 223 224 #else 225 #error "DeviceFamily_XYZ undefined. You must define a DeviceFamily_XYZ!" 226 #endif 227 228 /* Ensure that only one DeviceFamily was specified */ 229 #if (defined(DeviceFamily_CC13X0) + defined(DeviceFamily_CC13X1) + defined(DeviceFamily_CC13X2) + \ 230 defined(DeviceFamily_CC13X2X7) + defined(DeviceFamily_CC26X0) + defined(DeviceFamily_CC26X0R2) + \ 231 defined(DeviceFamily_CC26X1) + defined(DeviceFamily_CC26X2) + defined(DeviceFamily_CC26X2X7) + \ 232 defined(DeviceFamily_CC26X3) + defined(DeviceFamily_CC26X4) + defined(DeviceFamily_CC13X4) + \ 233 defined(DeviceFamily_CC23X0R5) + defined(DeviceFamily_CC23X0R2) + defined(DeviceFamily_CC27XX) + \ 234 defined(DeviceFamily_CC3200) + defined(DeviceFamily_CC3220) + defined(DeviceFamily_CC35XX) + \ 235 defined(DeviceFamily_CC33XX)) > 1 236 #error More then one DeviceFamily has been defined! 237 #endif 238 239 /*! 240 * @brief Macro to include correct driverlib path. 241 * 242 * @pre DeviceFamily_XYZ which sets DeviceFamily_DIRECTORY must be defined 243 * first. 244 * 245 * @param x A token containing the path of the file to include based on 246 * the root device folder. The preceding forward slash must be 247 * omitted. For example: 248 * - #include DeviceFamily_constructPath(inc/hw_memmap.h) 249 * - #include DeviceFamily_constructPath(driverlib/uart.h) 250 * 251 * @return Returns an include path. 252 * 253 */ 254 #define DeviceFamily_constructPath(x) <ti/devices/DeviceFamily_DIRECTORY/x> 255 256 #ifdef __cplusplus 257 } 258 #endif 259 260 #endif /* ti_devices_DeviceFamily__include */ 261