1 //***************************************************************************** 2 // 3 //! @file am_util_id.h 4 //! 5 //! @brief Identification of the Ambiq Micro device. 6 //! 7 //! This module contains functions for run time identification of Ambiq Micro 8 //! devices. 9 //! 10 //! @addtogroup id ID - Identification 11 //! @ingroup utils 12 //! @{ 13 // 14 //***************************************************************************** 15 16 //***************************************************************************** 17 // 18 // Copyright (c) 2023, Ambiq Micro, Inc. 19 // All rights reserved. 20 // 21 // Redistribution and use in source and binary forms, with or without 22 // modification, are permitted provided that the following conditions are met: 23 // 24 // 1. Redistributions of source code must retain the above copyright notice, 25 // this list of conditions and the following disclaimer. 26 // 27 // 2. Redistributions in binary form must reproduce the above copyright 28 // notice, this list of conditions and the following disclaimer in the 29 // documentation and/or other materials provided with the distribution. 30 // 31 // 3. Neither the name of the copyright holder nor the names of its 32 // contributors may be used to endorse or promote products derived from this 33 // software without specific prior written permission. 34 // 35 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 36 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 38 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 39 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 40 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 42 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 43 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 44 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 45 // POSSIBILITY OF SUCH DAMAGE. 46 // 47 // This is part of revision release_sdk_4_4_0-3c5977e664 of the AmbiqSuite Development Package. 48 // 49 //***************************************************************************** 50 #ifndef AM_UTIL_ID_H 51 #define AM_UTIL_ID_H 52 53 #include "am_mcu_apollo.h" 54 55 #ifdef __cplusplus 56 extern "C" 57 { 58 #endif 59 60 61 //***************************************************************************** 62 // 63 // Define the devices to be included in identification. 64 // This is useful for limiting coding to the desired device. 65 // 66 //***************************************************************************** 67 // 68 // Define AM_ID_APOLLO_ALL to define all Apollo family 69 // 70 //#define AM_ID_APOLLO_ALL 71 72 // 73 //! New defines to be used in am_util_id 74 // 75 #if defined(AM_PART_APOLLO) 76 #define AM_ID_APOLLO 77 #endif 78 #if defined(AM_PART_APOLLO2) 79 #define AM_ID_APOLLO2 80 #endif 81 #if defined(AM_PART_APOLLO3) 82 #define AM_ID_APOLLO3 83 #endif 84 #if defined(AM_PART_APOLLO3P) 85 #define AM_ID_APOLLO3P 86 #endif 87 #if defined(AM_PART_APOLLO4) 88 #define AM_ID_APOLLO4A 89 #endif 90 #if defined(AM_PART_APOLLO4B) 91 #define AM_ID_APOLLO4B 92 #endif 93 #if defined(AM_PART_APOLLO4P) 94 #define AM_ID_APOLLO4P 95 #endif 96 #if defined(AM_PART_APOLLO4L) 97 #define AM_ID_APOLLO4L 98 #endif 99 100 // 101 //! Handle AM_ID_APOLLO_ALL 102 // 103 #if defined(AM_ID_APOLLO_ALL) 104 #ifndef AM_ID_APOLLO 105 #define AM_ID_APOLLO 106 #endif 107 #ifndef AM_ID_APOLLO2 108 #define AM_ID_APOLLO2 109 #endif 110 #ifndef AM_ID_APOLLO3 111 #define AM_ID_APOLLO3 112 #endif 113 #ifndef AM_ID_APOLLO3P 114 #define AM_ID_APOLLO3P 115 #endif 116 #ifndef AM_ID_APOLLO4A 117 #define AM_ID_APOLLO4A 118 #endif 119 #ifndef AM_ID_APOLLO4B 120 #define AM_ID_APOLLO4B 121 #endif 122 #ifndef AM_ID_APOLLO4P 123 #define AM_ID_APOLLO4P 124 #endif 125 #ifndef AM_ID_APOLLO4L 126 #define AM_ID_APOLLO4L 127 #endif 128 #endif // AM_ID_APOLLO_ALL 129 130 131 //***************************************************************************** 132 // 133 //! ID structure 134 // 135 //***************************************************************************** 136 typedef struct 137 { 138 // 139 //! Contains the HAL hardware information about the device. 140 // 141 am_hal_mcuctrl_device_t sMcuCtrlDevice; 142 143 // 144 //! Contains the HAL hardware information about the device. 145 // 146 am_hal_mcuctrl_feature_t sMcuCtrlFeature; 147 148 // 149 //! Device type (derived value, not a hardware value) 150 // 151 uint32_t ui32Device; 152 153 // 154 //! Vendor name from the MCUCTRL VENDORID register and stringized here. 155 // 156 const uint8_t *pui8VendorName; 157 158 // 159 //! Device name (derived value, not a hardware value) 160 // 161 const uint8_t *pui8DeviceName; 162 163 // 164 //! Major chip revision (e.g. char 'A' or 'B') 165 // 166 uint8_t ui8ChipRevMaj; 167 168 // 169 //! Minor chip revision (e.g. char '0', '1', ' ') 170 // 171 uint8_t ui8ChipRevMin; 172 173 // 174 //! Package Type (defined at factory) 175 // 176 const uint8_t *pui8PackageType; 177 178 // 179 //! Temperature Range 180 // 181 const uint8_t *pui8TempRange; 182 183 } 184 am_util_id_t; 185 186 //***************************************************************************** 187 // 188 //! @name Macros for MCUCTRL CHIP INFO field. 189 //! @note these macros are derived from CHIPPN definitions. 190 //! @{ 191 // 192 //***************************************************************************** 193 #define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO4L 0x09000000 194 #define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO4 0x08000000 195 #define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO3P 0x07000000 196 #define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO3 0x06000000 197 #define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLOBL 0x05000000 198 #define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_VOYAGER 0x04000000 199 #define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO2 0x03000000 200 #define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLOHC 0x02000000 201 #define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO 0x01000000 202 #define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_PN_M 0xFF000000 203 //! @} 204 205 //***************************************************************************** 206 // 207 //! @name Macros for silicon identification 208 //! @{ 209 // 210 //***************************************************************************** 211 #define AM_UTIL_ID_UNKNOWN 0 212 #define AM_UTIL_ID_APOLLO 0x0001 213 #define AM_UTIL_ID_APOLLO2 0x0002 214 #define AM_UTIL_ID_APOLLO3 0x0003 // Apollo3 Blue 215 #define AM_UTIL_ID_APOLLO3P 0x0103 // Apollo3 Blue Plus 216 #define AM_UTIL_ID_APOLLO4 0x0004 // Apollo4 217 #define AM_UTIL_ID_APOLLO4P 0x0104 // Apollo4 Plus 218 #define AM_UTIL_ID_APOLLO4L 0x0204 // Apollo4 Lite 219 //! @} 220 221 //***************************************************************************** 222 // 223 // External function definitions 224 // 225 //***************************************************************************** 226 //***************************************************************************** 227 // 228 //! @brief Device identification. 229 //! 230 //! @param psIDDevice - ptr to a device ID structure (am_util_id_t*) to be 231 //! filled in by the function. 232 //! 233 //! This function provides additional information about the currently running 234 //! Ambiq Micro MCU device. 235 //! 236 //! @returns The ui32Device value, which is a value corresponding to the 237 //! device type. 238 // 239 //***************************************************************************** 240 extern uint32_t am_util_id_device(am_util_id_t *psIDDevice); 241 242 #ifdef __cplusplus 243 } 244 #endif 245 246 #endif // AM_UTIL_ID_H 247 248 //***************************************************************************** 249 // 250 // End Doxygen group. 251 //! @} 252 // 253 //***************************************************************************** 254 255