1 /***************************************************************************//**
2  * @file
3  * @brief Power Manager execution modes API definition.
4  *******************************************************************************
5  * # License
6  * <b>Copyright 2023 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 SL_POWER_MANAGER_EXECUTION_MODES_H
32 #define SL_POWER_MANAGER_EXECUTION_MODES_H
33 
34 #include "cmsis_compiler.h"
35 #include "sl_code_classification.h"
36 
37 #include <stdbool.h>
38 #include <stdint.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /*******************************************************************************
45  *****************************   PROTOTYPES   **********************************
46  ******************************************************************************/
47 
48 /***************************************************************************//**
49  * Updates execution mode requirements.
50  *
51  * @param add boolean value indicating whether to add or remove requirement.
52  *
53  * @note FOR INTERNAL USE ONLY.
54  ******************************************************************************/
55 SL_CODE_CLASSIFY(SL_CODE_COMPONENT_POWER_MANAGER, SL_CODE_CLASS_TIME_CRITICAL)
56 void sli_power_manager_update_execution_mode_requirement(bool  add);
57 
58 /***************************************************************************//**
59  * Adds requirement on performance execution mode.
60  ******************************************************************************/
SL_CODE_CLASSIFY(SL_CODE_COMPONENT_POWER_MANAGER,SL_CODE_CLASS_TIME_CRITICAL)61 SL_CODE_CLASSIFY(SL_CODE_COMPONENT_POWER_MANAGER, SL_CODE_CLASS_TIME_CRITICAL)
62 __INLINE void sl_power_manager_add_performance_mode_requirement(void)
63 {
64   sli_power_manager_update_execution_mode_requirement(true);
65 }
66 
67 /***************************************************************************//**
68  * Removes requirement on performance execution mode.
69  ******************************************************************************/
SL_CODE_CLASSIFY(SL_CODE_COMPONENT_POWER_MANAGER,SL_CODE_CLASS_TIME_CRITICAL)70 SL_CODE_CLASSIFY(SL_CODE_COMPONENT_POWER_MANAGER, SL_CODE_CLASS_TIME_CRITICAL)
71 __INLINE void sl_power_manager_remove_performance_mode_requirement(void)
72 {
73   sli_power_manager_update_execution_mode_requirement(false);
74 }
75 
76 /***************************************************************************//**
77  * Initializes execution mode feature.
78  *
79  * @note FOR INTERNAL USE ONLY.
80  ******************************************************************************/
81 void sli_power_manager_executions_modes_init(void);
82 
83 /***************************************************************************//**
84  * Implement execution mode if not already implemented during a wakeup event.
85  *
86  * @note FOR INTERNAL USE ONLY.
87  ******************************************************************************/
88 SL_CODE_CLASSIFY(SL_CODE_COMPONENT_POWER_MANAGER, SL_CODE_CLASS_TIME_CRITICAL)
89 void sli_power_manager_implement_execution_mode_on_wakeup(void);
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 #endif // SL_POWER_MANAGER_EXECUTION_MODES_H
95