1 //***************************************************************************** 2 // 3 // am_hal_reset.h 4 //! @file 5 //! 6 //! @brief Hardware abstraction layer for the Reset Generator module. 7 //! 8 //! @addtogroup wdt2 Watchdog Timer (RSTGEN) 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_RSTGEN_H 49 #define AM_HAL_RSTGEN_H 50 51 //***************************************************************************** 52 // 53 //! @name Reset Generator Configuration 54 //! @brief These macros may be used to set the reset generator's configuration. 55 //! @{ 56 // 57 //***************************************************************************** 58 #define AM_HAL_RESET_CFG_WDT_RESET_ENABLE (AM_REG_RSTGEN_CFG_WDREN(1)) 59 // Brown out high (2.1v) reset enable. 60 #define AM_HAL_RESET_CFG_BOD_HIGH_RESET_ENABLE (AM_REG_RSTGEN_CFG_BODHREN(1)) 61 //! @} 62 63 //***************************************************************************** 64 // 65 //! @name Reset Generator Status Bit Masks 66 //! @brief These macros may be used to determine which type(s) of resets have 67 //! been seen. 68 //! @{ 69 // 70 //***************************************************************************** 71 // Reset was initiated by a Watchdog Timer Reset. 72 #define AM_HAL_RESET_STAT_WDT (AM_REG_RSTGEN_STAT_WDRSTAT_M) 73 74 // Reset was a initiated by Debugger Reset. 75 #define AM_HAL_RESET_STAT_DEBUG (AM_REG_RSTGEN_STAT_DBGRSTAT_M) 76 77 // Reset was a initiated by Software POI Reset. 78 #define AM_HAL_RESET_STAT_POI (AM_REG_RSTGEN_STAT_POIRSTAT_M) 79 80 // Reset was a initiated by Software POR or AIRCR Reset. 81 #define AM_HAL_RESET_STAT_SOFTWARE (AM_REG_RSTGEN_STAT_SWRSTAT_M) 82 83 // Reset was initiated by a Brown-Out Reset. 84 #define AM_HAL_RESET_STAT_BOD (AM_REG_RSTGEN_STAT_BORSTAT_M) 85 86 // Reset was initiated by a Power Cycle 87 #define AM_HAL_RESET_STAT_POWER_CYCLE (AM_REG_RSTGEN_STAT_PORSTAT_M) 88 89 // Reset was initiated by an External Reset. 90 #define AM_HAL_RESET_STAT_EXTERNAL (AM_REG_RSTGEN_STAT_EXRSTAT_M) 91 //! @} 92 93 #ifdef __cplusplus 94 extern "C" 95 { 96 #endif 97 //***************************************************************************** 98 // 99 // External function definitions 100 // 101 //***************************************************************************** 102 extern void am_hal_reset_init(uint32_t ui32Config); 103 extern void am_hal_reset_por(void); 104 extern void am_hal_reset_poi(void); 105 extern uint32_t am_hal_reset_status_get(void); 106 extern void am_hal_reset_status_clear(void); 107 108 #ifdef __cplusplus 109 } 110 #endif 111 112 #endif // AM_HAL_RSTGEN_H 113 114 //***************************************************************************** 115 // 116 // End Doxygen group. 117 //! @} 118 // 119 //***************************************************************************** 120