92 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			92 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
|  | /****************************************************************************
 | ||
|  | 
 | ||
|  | Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED. | ||
|  | 
 | ||
|  | This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT | ||
|  | be copied by any method or incorporated into another program without | ||
|  | the express written consent of Aerospace C.Power. This Information or any portion | ||
|  | thereof remains the property of Aerospace C.Power. The Information contained herein | ||
|  | is believed to be accurate and Aerospace C.Power assumes no responsibility or | ||
|  | liability for its use in any way and conveys no license or title under | ||
|  | any patent or copyright and makes no representation or warranty that this | ||
|  | Information is free from patent or copyright infringement. | ||
|  | 
 | ||
|  | ****************************************************************************/ | ||
|  | 
 | ||
|  | #ifndef IOT_POWER_MGMT_H
 | ||
|  | #define IOT_POWER_MGMT_H
 | ||
|  | 
 | ||
|  | #include "iot_config.h"
 | ||
|  | #include "iot_errno.h"
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #if PLC_SUPPORT_POWER_COLLAPSE
 | ||
|  | 
 | ||
|  | /** \defgroup MISC_APIs MISC APIs
 | ||
|  |  *  @brief MISC APIs | ||
|  |  * | ||
|  |  * | ||
|  |  */ | ||
|  | 
 | ||
|  | /** @addtogroup MISC_APIs
 | ||
|  |  * @{ | ||
|  |  * | ||
|  |  */ | ||
|  | 
 | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_powr_mgmt_init() - enable power management sub system | ||
|  |  * @return see ERR_XXX. | ||
|  |  */ | ||
|  | uint32_t iot_power_mgmt_init(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_powr_mgmt_check_power_collapsed() - check externl power's collapsed. | ||
|  |  * @param pullout_flag: module pull out flag, 1 -> pull out, 0 -> not pull out. | ||
|  |  * @return collapsed flag, 1 -> collapsed, 0 -> not collapsed. | ||
|  |  */ | ||
|  | uint32_t iot_power_mgmt_check_power_collapsed(uint8_t *pullout_flag); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_power_mgmt_stop_charge() - stop charge when exception. | ||
|  |  * | ||
|  | */ | ||
|  | void iot_power_mgmt_stop_charge(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_power_mgmt_check_low_power_mode() - check externl power's mode. | ||
|  |  * | ||
|  |  */ | ||
|  | uint32_t iot_power_mgmt_check_low_power_mode(); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief check power management sub system. | ||
|  |  * @retval: ERR_OK -- power management sub system support. | ||
|  |  * @retval: otherwise -- not supported, see ERR_XXX. | ||
|  |  */ | ||
|  | uint32_t iot_power_mgmt_supp_check(); | ||
|  | 
 | ||
|  | #else
 | ||
|  | 
 | ||
|  | #define iot_power_mgmt_init() (ERR_NOSUPP)
 | ||
|  | 
 | ||
|  | #define iot_power_mgmt_check_power_collapsed(pullout_flag) 0
 | ||
|  | 
 | ||
|  | #define iot_power_mgmt_stop_charge()
 | ||
|  | 
 | ||
|  | #define iot_power_mgmt_check_low_power_mode()  0
 | ||
|  | 
 | ||
|  | #define iot_power_mgmt_supp_check()  ERR_NOSUPP
 | ||
|  | 
 | ||
|  | #endif /*PLC_SUPPORT_POWER_COLLAPSE*/
 | ||
|  | 
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif /*IOT_POWER_MGMT_H*/
 |