MT2523 API Reference  LinkIt SDK v4
hal_sleep_manager.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __HAL_SLEEP_MANAGER_H__
36 #define __HAL_SLEEP_MANAGER_H__
37 #include "hal_platform.h"
38 
39 #ifdef HAL_SLEEP_MANAGER_ENABLED
40 #ifdef HAL_SLEEP_MANAGER_SUPPORT_WAKEUP_SOURCE_CONFIG
41 
74 #else
75 
103 #endif
104 
152 #ifdef HAL_SLEEP_MANAGER_SUPPORT_POWER_OFF
153 
176 #endif
177 
178 #ifdef __cplusplus
179 extern "C" {
180 #endif
181 
182 /*****************************************************************************
183 * Enum
184 *****************************************************************************/
196 typedef enum {
204 /*****************************************************************************
205  * Functions
206  *****************************************************************************/
207 
212 
213 #ifdef HAL_SLEEP_MANAGER_SUPPORT_WAKEUP_SOURCE_CONFIG
214 
220 
227 #endif
228 
235 uint8_t hal_sleep_manager_set_sleep_handle(const char *handle_name);
236 
244 
252 
260 
266 uint32_t hal_sleep_manager_get_lock_status(void);
267 
273 
279 bool hal_sleep_manager_is_sleep_handle_alive(uint8_t handle_index);
280 
281 #ifdef HAL_SLEEP_MANAGER_SUPPORT_POWER_OFF
282 
289 #endif
290 
298 
304 
305 #ifdef __cplusplus
306 }
307 #endif
308 
314 #endif /*HAL_SLEEP_MANAGER_ENABLED*/
315 #endif /* __HAL_SLEEP_MANAGER_H__ */
316 
bool hal_sleep_manager_is_sleep_locked(void)
This function checks if there are any Sleep Locks in the system.
hal_sleep_manager_status_t hal_sleep_manager_enable_wakeup_pin(hal_sleep_manager_wakeup_source_t pin)
This function enables a specific Wakeup Source.
hal_sleep_mode_t
Sleep modes.
Definition: hal_platform.h:130
An undefined error occurred.
Definition: hal_sleep_manager.h:197
void hal_sleep_manager_enter_sleep_mode(hal_sleep_mode_t mode)
This function sets the system to any of the modes defined in hal_sleep_mode_t.
The operation completed successfully.
Definition: hal_sleep_manager.h:198
hal_sleep_manager_status_t
This enum defines the Sleep Manager API return status.
Definition: hal_sleep_manager.h:196
uint8_t hal_sleep_manager_set_sleep_handle(const char *handle_name)
This function sets up a sleep handle to control the sleep state of the system.
uint32_t hal_sleep_manager_get_lock_status(void)
The sleep lock status is represented by an unsigned integer (uint32_t).
hal_sleep_manager_status_t hal_sleep_manager_unlock_sleep(uint8_t handle_index)
This function unlocks the specific Sleep Lock and permits the MCU going into sleep mode when needed i...
hal_sleep_manager_status_t hal_sleep_manager_init(void)
This function initializes the Sleep Manager.
hal_sleep_manager_wakeup_source_t
sleep_manager wake up source
Definition: hal_platform.h:138
hal_sleep_manager_status_t hal_sleep_manager_disable_wakeup_pin(hal_sleep_manager_wakeup_source_t pin)
This function disables the specific Wakeup Source.
void hal_sleep_manager_enter_power_off_mode(void)
This function sets the system to power off mode.
hal_sleep_manager_status_t hal_sleep_manager_set_sleep_time(uint32_t sleep_time_ms)
Set sleep(suspend) time length.
hal_sleep_manager_status_t hal_sleep_manager_release_sleep_handle(uint8_t handle_index)
This function releases the sleep handle if it is no longer in use.
hal_sleep_manager_status_t hal_sleep_manager_lock_sleep(uint8_t handle_index)
This function prevents the MCU from getting into sleep mode.
bool hal_sleep_manager_is_sleep_handle_alive(uint8_t handle_index)
This function checks whether the sleep handle is still alive.