1 /***************************************************************************//** 2 * @file 3 * @brief Power Manager Private API definition. 4 ******************************************************************************* 5 * # License 6 * <b>Copyright 2019 Silicon Laboratories Inc. www.silabs.com</b> 7 ******************************************************************************* 8 * 9 * SPDX-License-Identifier: Zlib 10 * 11 * The licensor of this software is Silicon Laboratories Inc. 12 * 13 * This software is provided 'as-is', without any express or implied 14 * warranty. In no event will the authors be held liable for any damages 15 * arising from the use of this software. 16 * 17 * Permission is granted to anyone to use this software for any purpose, 18 * including commercial applications, and to alter it and redistribute it 19 * freely, subject to the following restrictions: 20 * 21 * 1. The origin of this software must not be misrepresented; you must not 22 * claim that you wrote the original software. If you use this software 23 * in a product, an acknowledgment in the product documentation would be 24 * appreciated but is not required. 25 * 2. Altered source versions must be plainly marked as such, and must not be 26 * misrepresented as being the original software. 27 * 3. This notice may not be removed or altered from any source distribution. 28 * 29 ******************************************************************************/ 30 31 #ifndef SLI_POWER_MANAGER_H 32 #define SLI_POWER_MANAGER_H 33 34 #include "sl_power_manager.h" 35 #include "em_device.h" 36 37 #include <stdbool.h> 38 #include <stdint.h> 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 /******************************************************************************* 45 ******************************* DEFINES *********************************** 46 ******************************************************************************/ 47 48 #if !defined(SLI_DEVICE_SUPPORTS_EM1P) && defined(_SILICON_LABS_32B_SERIES_2_CONFIG) && _SILICON_LABS_32B_SERIES_2_CONFIG >= 2 49 #define SLI_DEVICE_SUPPORTS_EM1P 50 #endif 51 52 /******************************************************************************* 53 ***************************** PROTOTYPES ********************************** 54 ******************************************************************************/ 55 56 #if defined(SLI_DEVICE_SUPPORTS_EM1P) 57 void sli_power_manager_update_hf_clock_settings_preservation_requirement(bool add); 58 #endif 59 60 /***************************************************************************//** 61 * Adds requirement on the preservation of the High Frequency Clocks settings. 62 * 63 * @note FOR INTERNAL USE ONLY. 64 * 65 * @note Must be used together with adding an EM2 requirement. 66 ******************************************************************************/ sli_power_manager_add_hf_clock_settings_preservation_requirement(void)67__STATIC_INLINE void sli_power_manager_add_hf_clock_settings_preservation_requirement(void) 68 { 69 #if defined(SLI_DEVICE_SUPPORTS_EM1P) 70 sli_power_manager_update_hf_clock_settings_preservation_requirement(true); 71 #else 72 sl_power_manager_add_em_requirement(SL_POWER_MANAGER_EM1); 73 #endif 74 } 75 76 /***************************************************************************//** 77 * Removes requirement on the preservation of the High Frequency Clocks settings. 78 * 79 * @note FOR INTERNAL USE ONLY. 80 * 81 * @note Must be used together with removing an EM2 requirement. 82 ******************************************************************************/ sli_power_manager_remove_hf_clock_settings_preservation_requirement(void)83__STATIC_INLINE void sli_power_manager_remove_hf_clock_settings_preservation_requirement(void) 84 { 85 #if defined(SLI_DEVICE_SUPPORTS_EM1P) 86 sli_power_manager_update_hf_clock_settings_preservation_requirement(false); 87 #else 88 sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1); 89 #endif 90 } 91 92 /***************************************************************************//** 93 * Informs the power manager module that the high accuracy/high frequency clock 94 * is used. 95 * 96 * @note FOR INTERNAL USE ONLY. 97 * 98 * @note Must be called by RAIL initialization in case radio clock settings 99 * are not set before the Power Manager initialization. 100 ******************************************************************************/ 101 __WEAK void sli_power_manager_set_high_accuracy_hf_clock_as_used(void); 102 103 /***************************************************************************//** 104 * Gets the wake-up restore process time. 105 * If we are not in the context of a deepsleep and therefore don't need to 106 * do a restore, the return value is 0. 107 * 108 * 109 * @return Wake-up restore process time. 110 ******************************************************************************/ 111 uint32_t sli_power_manager_get_restore_delay(void); 112 113 /***************************************************************************//** 114 * Initiates the wake-up restore process. 115 ******************************************************************************/ 116 void sli_power_manager_initiate_restore(void); 117 118 #ifdef __cplusplus 119 } 120 #endif 121 122 #endif /* SLI_POWER_MANAGER_H */ 123