1 //***************************************************************************** 2 // 3 //! @file am_hal_burst.h 4 //! 5 //! @brief Functions for Controlling Burst Mode Operation. 6 //! 7 //! @addtogroup burstmode3p Burst - Burst Mode Functionality 8 //! @ingroup apollo3p_hal 9 //! @{ 10 // 11 //***************************************************************************** 12 13 //***************************************************************************** 14 // 15 // Copyright (c) 2023, Ambiq Micro, Inc. 16 // All rights reserved. 17 // 18 // Redistribution and use in source and binary forms, with or without 19 // modification, are permitted provided that the following conditions are met: 20 // 21 // 1. Redistributions of source code must retain the above copyright notice, 22 // this list of conditions and the following disclaimer. 23 // 24 // 2. Redistributions in binary form must reproduce the above copyright 25 // notice, this list of conditions and the following disclaimer in the 26 // documentation and/or other materials provided with the distribution. 27 // 28 // 3. Neither the name of the copyright holder nor the names of its 29 // contributors may be used to endorse or promote products derived from this 30 // software without specific prior written permission. 31 // 32 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 33 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 34 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 35 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 36 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 37 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 40 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 41 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42 // POSSIBILITY OF SUCH DAMAGE. 43 // 44 // This is part of revision release_sdk_3_1_1-10cda4b5e0 of the AmbiqSuite Development Package. 45 // 46 //***************************************************************************** 47 #ifndef AM_HAL_BURST_H 48 #define AM_HAL_BURST_H 49 50 #ifdef __cplusplus 51 extern "C" 52 { 53 #endif 54 55 //***************************************************************************** 56 // 57 //! @brief Option to Enable LDO Burst mode workaound 58 //! 59 //! When entering burst mode, the 96MHz clock is active prior to Burst Active 60 //! is enabled. This is not an issue on all chips. 61 //! 62 //! AM_HAL_BURST_LDO_WORKAROUND: 63 //! 0 = Use existing sequence when entering burst mode 64 //! 1 = Burst LDO into Active mode and delay before enabling 96MHz CLK 65 //! Default: 1 66 // 67 //***************************************************************************** 68 #define AM_HAL_BURST_LDO_WORKAROUND 1 69 70 //***************************************************************************** 71 // 72 // Burst Mode Status enums 73 // 74 //***************************************************************************** 75 // 76 //! Avail - the result of a feature availability interrogation. 77 // 78 typedef enum 79 { 80 AM_HAL_BURST_AVAIL, 81 AM_HAL_BURST_NOTAVAIL 82 } am_hal_burst_avail_e; 83 84 // 85 //! Mode - the result of a change request. 86 // 87 typedef enum 88 { 89 AM_HAL_BURST_MODE, 90 AM_HAL_NORMAL_MODE, 91 } am_hal_burst_mode_e; 92 93 //***************************************************************************** 94 // 95 //! @brief Burst mode initialization function 96 //! 97 //! @param peBurstAvail - Availibility of feature 98 //! 99 //! This function initializes the Apollo3 MCU for Burst Mode operation. It does 100 //! not set the MCU into Burst Mode. This should be called once at system 101 //! initialization if Burst Mode is going to be used in the system. 102 //! 103 //! @return status of API call. 104 // 105 //***************************************************************************** 106 extern uint32_t am_hal_burst_mode_initialize(am_hal_burst_avail_e *peBurstAvail); 107 108 //***************************************************************************** 109 // 110 //! @brief Burst mode enable function 111 //! 112 //! @param peBurstStatus - resulting mode after call. 113 //! 114 //! This function enables the Apollo3 MCU into Burst Mode operation. 115 //! 116 //! @return status of API call. 117 // 118 //***************************************************************************** 119 extern uint32_t am_hal_burst_mode_enable(am_hal_burst_mode_e *peBurstStatus); 120 121 //***************************************************************************** 122 // 123 //! @brief Burst mode disable function 124 //! 125 //! @param peBurstStatus - resulting mode after call. 126 //! 127 //! This function disables the Apollo3 MCU from Burst Mode operation. It returns 128 //! the MCU to Normal Mode. 129 //! 130 //! @return status of API call. 131 // 132 //***************************************************************************** 133 extern uint32_t am_hal_burst_mode_disable(am_hal_burst_mode_e *peBurstStatus); 134 135 //***************************************************************************** 136 // 137 //! @brief Return current burst mode state 138 //! 139 //! Implemented as a macro, this function returns the current burst mode state. 140 //! AM_HAL_BURST_MODE 141 //! AM_HAL_NORMAL_MODE 142 // 143 //***************************************************************************** 144 #define am_hal_burst_mode_status() \ 145 (CLKGEN->FREQCTRL_b.BURSTSTATUS ? AM_HAL_BURST_MODE : AM_HAL_NORMAL_MODE) 146 147 148 #if AM_HAL_BURST_LDO_WORKAROUND 149 #define AM_HAL_BURST_BUCK_VDDF_ADJ_CODE_30MV 5 150 #define AM_HAL_BURST_LDO_VDDF_ADJ_CODE_30MV 3 151 152 //***************************************************************************** 153 // 154 //! @brief Burst LDO to charge VDDS cap 155 //! 156 //! This function changes burst LDO power init to charge VDDS cap and put Burst 157 //! LDO into LP mode after chip power up 158 // 159 //***************************************************************************** 160 extern void am_hal_burst_ldo_charge(void); 161 162 //***************************************************************************** 163 // 164 //! @brief Enable Burst LDO workaround if Burst LDO Patch applied 165 //! 166 //! @param peBurstStatus - The memory power down enum. 167 //! 168 //! @return status - generic or interface specific status. 169 // 170 //***************************************************************************** 171 extern uint32_t am_hal_burst_mode_enable_w_manual_sequence( 172 am_hal_burst_mode_e *peBurstStatus); 173 174 //***************************************************************************** 175 // 176 //! @brief Disable Burst LDO workaround if Burst LDO Patchapplied 177 //! 178 //! @param peBurstStatus - The memory power down enum. 179 //! 180 //! @return status - generic or interface specific status. 181 // 182 //***************************************************************************** 183 extern uint32_t am_hal_burst_mode_disable_w_manual_sequence( 184 am_hal_burst_mode_e *peBurstStatus); 185 186 //***************************************************************************** 187 // 188 //! @brief Check if Burst LDO Patch is applied 189 // 190 //***************************************************************************** 191 extern bool am_hal_burst_ldo_patch_check(void); 192 193 #endif //AM_HAL_BURST_LDO_WORKAROUND 194 195 #ifdef __cplusplus 196 } 197 #endif 198 199 #endif // AM_HAL_BURST_H 200 //***************************************************************************** 201 // 202 // End Doxygen group. 203 //! @} 204 // 205 //***************************************************************************** 206