1 //***************************************************************************** 2 // 3 // am_hal_mcuctrl.h 4 //! @file 5 //! 6 //! @brief Functions for accessing and configuring the MCUCTRL. 7 //! 8 //! @addtogroup mcuctrl2 MCU Control (MCUCTRL) 9 //! @ingroup apollo2hal 10 //! @{ 11 // 12 //***************************************************************************** 13 14 //***************************************************************************** 15 // 16 // Copyright (c) 2017, Ambiq Micro 17 // All rights reserved. 18 // 19 // Redistribution and use in source and binary forms, with or without 20 // modification, are permitted provided that the following conditions are met: 21 // 22 // 1. Redistributions of source code must retain the above copyright notice, 23 // this list of conditions and the following disclaimer. 24 // 25 // 2. Redistributions in binary form must reproduce the above copyright 26 // notice, this list of conditions and the following disclaimer in the 27 // documentation and/or other materials provided with the distribution. 28 // 29 // 3. Neither the name of the copyright holder nor the names of its 30 // contributors may be used to endorse or promote products derived from this 31 // software without specific prior written permission. 32 // 33 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 34 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 35 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 36 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 37 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 38 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 41 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 42 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 43 // POSSIBILITY OF SUCH DAMAGE. 44 // 45 // This is part of revision 1.2.11 of the AmbiqSuite Development Package. 46 // 47 //***************************************************************************** 48 #ifndef AM_HAL_MCUCTRL_H 49 #define AM_HAL_MCUCTRL_H 50 51 // 52 // Deprecate the am_hal_mcuctrl_bucks_enable() and disable() functions. 53 // This functionality is now handled in pwrctrl. 54 // 55 #define am_hal_mcuctrl_bucks_enable am_hal_pwrctrl_bucks_enable 56 #define am_hal_mcuctrl_bucks_disable am_hal_pwrctrl_bucks_disable 57 58 59 //***************************************************************************** 60 // 61 // Define CHIP_INFO fields, which for Apollo2 are not defined in the register 62 // definitions. 63 // 64 //***************************************************************************** 65 #define AM_HAL_MCUCTRL_CHIP_INFO_CLASS_M 0xFF000000 66 #define AM_HAL_MCUCTRL_CHIP_INFO_CLASS_S 24 67 #define AM_HAL_MCUCTRL_CHIP_INFO_FLASH_SIZE_M 0x00F00000 68 #define AM_HAL_MCUCTRL_CHIP_INFO_FLASH_SIZE_S 20 69 #define AM_HAL_MCUCTRL_CHIP_INFO_SRAM_SIZE_M 0x000F0000 70 #define AM_HAL_MCUCTRL_CHIP_INFO_SRAM_SIZE_S 16 71 #define AM_HAL_MCUCTRL_CHIP_INFO_REV_M 0x0000FF00 72 #define AM_HAL_MCUCTRL_CHIP_INFO_REV_S 8 73 #define AM_HAL_MCUCTRL_CHIP_INFO_PKG_M 0x000000C0 74 #define AM_HAL_MCUCTRL_CHIP_INFO_PKG_S 6 75 #define AM_HAL_MCUCTRL_CHIP_INFO_PINS_M 0x00000038 76 #define AM_HAL_MCUCTRL_CHIP_INFO_PINS_S 3 77 #define AM_HAL_MCUCTRL_CHIP_INFO_TEMP_M 0x00000006 78 #define AM_HAL_MCUCTRL_CHIP_INFO_TEMP_S 1 79 #define AM_HAL_MCUCTRL_CHIP_INFO_QUAL_M 0x00000001 80 #define AM_HAL_MCUCTRL_CHIP_INFO_QUAL_S 0 81 82 //***************************************************************************** 83 // 84 // Apollo Number Decode. 85 // 86 //***************************************************************************** 87 extern const uint32_t g_am_hal_mcuctrl_flash_size[]; 88 extern const uint32_t g_am_hal_mcuctrl_sram_size[]; 89 90 //***************************************************************************** 91 // 92 //! MCUCTRL device structure 93 // 94 //***************************************************************************** 95 typedef struct 96 { 97 // 98 //! Device part number. (BCD format) 99 // 100 uint32_t ui32ChipPN; 101 102 // 103 //! Unique Chip ID 0. 104 // 105 uint32_t ui32ChipID0; 106 107 // 108 //! Unique Chip ID 1. 109 // 110 uint32_t ui32ChipID1; 111 112 // 113 //! Chip Revision. 114 // 115 uint32_t ui32ChipRev; 116 117 // 118 //! Vendor ID. 119 // 120 uint32_t ui32VendorID; 121 122 // 123 //! Qualified chip. 124 // 125 uint32_t ui32Qualified; 126 127 // 128 //! Flash Size. 129 // 130 uint32_t ui32FlashSize; 131 132 // 133 //! SRAM Size. 134 // 135 uint32_t ui32SRAMSize; 136 137 // 138 // JEDEC chip info 139 // 140 uint32_t ui32JedecPN; 141 uint32_t ui32JedecJEPID; 142 uint32_t ui32JedecCHIPREV; 143 uint32_t ui32JedecCID; 144 } 145 am_hal_mcuctrl_device_t; 146 147 //***************************************************************************** 148 // 149 //! MCUCTRL fault structure 150 // 151 //***************************************************************************** 152 typedef struct 153 { 154 // 155 //! ICODE bus fault occurred. 156 // 157 bool bICODE; 158 159 // 160 //! ICODE bus fault address. 161 // 162 uint32_t ui32ICODE; 163 164 // 165 //! DCODE bus fault occurred. 166 // 167 bool bDCODE; 168 169 // 170 //! DCODE bus fault address. 171 // 172 uint32_t ui32DCODE; 173 174 // 175 //! SYS bus fault occurred. 176 // 177 bool bSYS; 178 179 // 180 //! SYS bus fault address. 181 // 182 uint32_t ui32SYS; 183 } 184 am_hal_mcuctrl_fault_t; 185 186 #ifdef __cplusplus 187 extern "C" 188 { 189 #endif 190 191 //***************************************************************************** 192 // 193 // External function definitions 194 // 195 //***************************************************************************** 196 extern void am_hal_mcuctrl_device_info_get(am_hal_mcuctrl_device_t *psDevice); 197 extern void am_hal_mcuctrl_fault_capture_enable(void); 198 extern void am_hal_mcuctrl_fault_capture_disable(void); 199 extern void am_hal_mcuctrl_fault_status(am_hal_mcuctrl_fault_t *psFault); 200 201 #ifdef __cplusplus 202 } 203 #endif 204 205 #endif // AM_HAL_MCUCTRL_H 206 207 //***************************************************************************** 208 // 209 // End Doxygen group. 210 //! @} 211 // 212 //***************************************************************************** 213