1 //***************************************************************************** 2 // 3 //! @file am_hal_sysctrl.h 4 //! 5 //! @brief Functions for interfacing with the M4F system control registers 6 //! 7 //! @addtogroup sysctrl4_4p SYSCTRL - System Control 8 //! @ingroup apollo4p_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_4_4_0-3c5977e664 of the AmbiqSuite Development Package. 45 // 46 //***************************************************************************** 47 #ifndef AM_HAL_SYSCTRL_H 48 #define AM_HAL_SYSCTRL_H 49 50 #ifdef __cplusplus 51 extern "C" 52 { 53 #endif 54 55 //***************************************************************************** 56 // 57 //! @name Definitions for sleep mode parameter 58 //! @{ 59 // 60 //***************************************************************************** 61 #define AM_HAL_SYSCTRL_SLEEP_DEEP true 62 #define AM_HAL_SYSCTRL_SLEEP_NORMAL false 63 //! @} 64 65 //***************************************************************************** 66 // 67 //! Definition of Global Power State enumeration 68 // 69 //***************************************************************************** 70 typedef enum 71 { 72 AM_HAL_SYSCTRL_WAKE, 73 AM_HAL_SYSCTRL_NORMALSLEEP, 74 AM_HAL_SYSCTRL_DEEPSLEEP 75 } am_hal_sysctrl_power_state_e; 76 77 #define SYNC_READ 0x47FF0000 78 79 //***************************************************************************** 80 // 81 //! Write flush - This function will hold the bus until all queued write 82 //! operations on System Bus have completed, thereby guaranteeing that all 83 //! writes to APB have been flushed. 84 // 85 //***************************************************************************** 86 #define am_hal_sysctrl_sysbus_write_flush() AM_REGVAL(SYNC_READ) 87 88 //***************************************************************************** 89 // 90 //! Write flush - This function will return once all queued write 91 //! operations have completed, thereby guaranteeing that all 92 //! writes have been flushed. 93 //! This works across all the buses - AXI and APB 94 // 95 //***************************************************************************** 96 #define am_hal_sysctrl_bus_write_flush() \ 97 am_hal_daxi_control(AM_HAL_DAXI_CONTROL_FLUSH, 0) 98 99 //***************************************************************************** 100 // 101 // External function definitions 102 // 103 //***************************************************************************** 104 //***************************************************************************** 105 // 106 //! @brief Place the core into sleep or deepsleep. 107 //! 108 //! @param bSleepDeep - False for Normal or True Deep sleep. 109 //! 110 //! This function puts the MCU to sleep or deepsleep depending on bSleepDeep. 111 //! 112 //! Valid values for bSleepDeep are: 113 //! 114 //! AM_HAL_SYSCTRL_SLEEP_NORMAL 115 //! AM_HAL_SYSCTRL_SLEEP_DEEP 116 // 117 //***************************************************************************** 118 extern void am_hal_sysctrl_sleep(bool bSleepDeep); 119 #ifdef __cplusplus 120 } 121 #endif 122 123 #endif // AM_HAL_SYSCTRL_H 124 125 //***************************************************************************** 126 // 127 // End Doxygen group. 128 //! @} 129 // 130 //***************************************************************************** 131 132