136 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			136 lines
		
	
	
		
			3.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_VERSION_API_H
 | ||
|  | #define IOT_VERSION_API_H
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #define BUILD_TIME_YEAR 17
 | ||
|  | #define BUILD_TIME_MONTH 5
 | ||
|  | #define BUILD_TIME_DATE 19
 | ||
|  | #define BUILD_TIME_HOUR 16
 | ||
|  | #define BUILD_TIME_MIN 9
 | ||
|  | #define BUILD_TIME_SEC 0
 | ||
|  | 
 | ||
|  | #define BUILD_EXTERN_SW_VER     0
 | ||
|  | 
 | ||
|  | /** \defgroup MISC_APIs MISC APIs
 | ||
|  |  *  @brief MISC APIs | ||
|  |  * | ||
|  |  * | ||
|  |  */ | ||
|  | 
 | ||
|  | /** @addtogroup MISC_APIs
 | ||
|  |  * @{ | ||
|  |  * | ||
|  |  */ | ||
|  | 
 | ||
|  | /** build info descriptor descriptor */ | ||
|  | typedef struct _iot_build_info { | ||
|  |     /** external software version. BCD format. range from 0 - 9999 */ | ||
|  |     uint16_t    sw_ver; | ||
|  |     /** app software version. bin format. range from 0 - 1023 */ | ||
|  |     uint16_t    app_ver; | ||
|  |     /** build year */ | ||
|  |     uint8_t     year; | ||
|  |     /** build month */ | ||
|  |     uint8_t     month; | ||
|  |     /** build day */ | ||
|  |     uint8_t     day; | ||
|  |     /** build hour */ | ||
|  |     uint8_t     hour; | ||
|  |     /** build min */ | ||
|  |     uint8_t     min; | ||
|  |     /** build sec */ | ||
|  |     uint8_t     sec; | ||
|  | } iot_build_info_t; | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_version_major() - firmware's major version | ||
|  |  * | ||
|  |  * @return             major version | ||
|  |  */ | ||
|  | uint8_t iot_version_major(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_version_minor() - firmware's minor version | ||
|  |  * | ||
|  |  * @return             minor version | ||
|  |  */ | ||
|  | uint8_t iot_version_minor(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_version_micro() - firmware's micro version | ||
|  |  * | ||
|  |  * @return             micro version | ||
|  |  */ | ||
|  | uint8_t iot_version_micro(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_version_bootloader() - bootloader version | ||
|  |  * | ||
|  |  * @return             bootloader version | ||
|  |  */ | ||
|  | uint8_t iot_version_bootloader(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_version_build() - firmware's build id | ||
|  |  * | ||
|  |  * @return             build id | ||
|  |  */ | ||
|  | uint16_t iot_version_build(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_version_hex() - convert firmware's version to hex | ||
|  |  * | ||
|  |  * @return             hex version | ||
|  |  */ | ||
|  | uint32_t iot_version_hex(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_version_packed() - convert firmware's version to packed version | ||
|  |  * | ||
|  |  * @return             packed version | ||
|  |  */ | ||
|  | uint16_t iot_version_packed(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief iot_version_type() - firmware's build type | ||
|  |  * | ||
|  |  * @return            build type | ||
|  |  *                    0 - release | ||
|  |  *                    1 - debug | ||
|  |  */ | ||
|  | uint8_t iot_version_type(void); | ||
|  | 
 | ||
|  | /**
 | ||
|  |  * @brief   get user build info. if user build info is not available, | ||
|  |  *          the return value is same as BUILD_TIME_XXX and iot_version_packed(). | ||
|  |  * @param info: buffer to return user build info | ||
|  |  */ | ||
|  | void iot_version_get_user_build_info(iot_build_info_t *info); | ||
|  | 
 | ||
|  | /**
 | ||
|  |   * @} | ||
|  |   */ | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif /* IOT_VERSION_API_H */
 |