1 //***************************************************************************** 2 // 3 //! am_hal_sysctrl.h 4 //! @file 5 //! 6 //! @brief Functions for interfacing with the M4F system control registers 7 //! 8 //! @addtogroup sysctrl2 System Control (SYSCTRL) 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_SYSCTRL_H 49 #define AM_HAL_SYSCTRL_H 50 51 52 //***************************************************************************** 53 // 54 // Definitions for sleep mode parameter 55 // 56 //***************************************************************************** 57 #define AM_HAL_SYSCTRL_SLEEP_DEEP true 58 #define AM_HAL_SYSCTRL_SLEEP_NORMAL false 59 60 //***************************************************************************** 61 // 62 // Parameters for am_hal_sysctrl_buck_ctimer_isr_init() 63 // 64 //***************************************************************************** 65 // 66 // Define the maximum valid timer number 67 // 68 #define BUCK_TIMER_MAX (AM_HAL_CTIMER_TIMERS_NUM - 1) 69 70 // 71 // Define the valid timer numbers 72 // 73 #define AM_HAL_SYSCTRL_BUCK_CTIMER_TIMER0 0 74 #define AM_HAL_SYSCTRL_BUCK_CTIMER_TIMER1 1 75 #define AM_HAL_SYSCTRL_BUCK_CTIMER_TIMER2 2 76 #define AM_HAL_SYSCTRL_BUCK_CTIMER_TIMER3 3 77 78 // 79 // The following is an invalid timer number. If used, it is the caller telling 80 // the HAL to use the "Hard Option", which applies a constant value to the zero 81 // cross. The applied value is more noise immune, if less energy efficent. 82 // 83 #define AM_HAL_SYSCTRL_BUCK_CTIMER_ZX_CONSTANT 0x01000000 // No timer, apply a constant value 84 85 #ifdef __cplusplus 86 extern "C" 87 { 88 #endif 89 //***************************************************************************** 90 // 91 // External function definitions 92 // 93 //***************************************************************************** 94 extern void am_hal_sysctrl_sleep(bool bSleepDeep); 95 extern void am_hal_sysctrl_fpu_enable(void); 96 extern void am_hal_sysctrl_fpu_disable(void); 97 extern void am_hal_sysctrl_fpu_stacking_enable(bool bLazy); 98 extern void am_hal_sysctrl_fpu_stacking_disable(void); 99 extern void am_hal_sysctrl_aircr_reset(void); 100 101 // 102 // Apollo2 zero-cross buck/ctimer related functions 103 // 104 extern uint32_t am_hal_sysctrl_buck_ctimer_isr_init(uint32_t ui32BuckTimerNumber); 105 extern bool am_hal_sysctrl_buck_update_complete(void); 106 107 #ifdef __cplusplus 108 } 109 #endif 110 111 #endif // AM_HAL_SYSCTRL_H 112 113 //***************************************************************************** 114 // 115 // End Doxygen group. 116 //! @} 117 // 118 //***************************************************************************** 119 120