162 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			162 lines
		
	
	
		
			5.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_H
							 | 
						||
| 
								 | 
							
								#define IOT_VERSION_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "iot_config.h"
							 | 
						||
| 
								 | 
							
								/* export includes */
							 | 
						||
| 
								 | 
							
								#include "iot_version_api.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef enum {
							 | 
						||
| 
								 | 
							
								    IOT_FIRMWARE_TYPE_KL = 0,
							 | 
						||
| 
								 | 
							
								    /* KL2 type III collector Series equipment */
							 | 
						||
| 
								 | 
							
								    IOT_FIRMWARE_TYPE_KL2_BRM,
							 | 
						||
| 
								 | 
							
								    IOT_FIRMWARE_TYPE_KL3,
							 | 
						||
| 
								 | 
							
								    /* KL2 topology recognition module */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_KL2_BSRM,
							 | 
						||
| 
								 | 
							
								    /* KL2 measurement circuit breaker module */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_KL2_BRK,
							 | 
						||
| 
								 | 
							
								    /* KL1 ckb image type */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_KL1_CKB,
							 | 
						||
| 
								 | 
							
								    /* KL3 ckb image type */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_KL3_CKB,
							 | 
						||
| 
								 | 
							
								    /* KL3 type III collector Series equipment */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_KL3_BRM,
							 | 
						||
| 
								 | 
							
								    /* kl3 measurement circuit breaker module */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_KL3_BRK,
							 | 
						||
| 
								 | 
							
								    /* KL1 new type cco */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_KL1_NEW_TYPE_CCO,
							 | 
						||
| 
								 | 
							
								    /* KL3 new type cco */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_KL3_NEW_TYPE_CCO,
							 | 
						||
| 
								 | 
							
								    /* KL3 for no rf device */
							 | 
						||
| 
								 | 
							
								    IOT_FIRMWARE_TYPE_KL3_NO_RF,
							 | 
						||
| 
								 | 
							
								    /* KL3 type III collector Series equipment without RF hardware */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_KL3_BRM_NO_RF,
							 | 
						||
| 
								 | 
							
								    /* KL3 measurement circuit breaker module without RF hardware */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_KL3_BRK_NO_RF,
							 | 
						||
| 
								 | 
							
								    /* max image type value */
							 | 
						||
| 
								 | 
							
								    IOT_FIREWARE_TYPE_MAX = 255,
							 | 
						||
| 
								 | 
							
								} FIRMWARE_IMAGE_TYPE;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* Image type: see IOT_FIRMWARE_TYPE_XXX */
							 | 
						||
| 
								 | 
							
								#ifndef AP_FIRMWARE_IMAGE_TYPE
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if (TARGET_VERSION == TARGET_KUNLUN)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if (IOT_STA_CONTROL_MODE > 0)
							 | 
						||
| 
								 | 
							
								/* KL1 CKB FW. */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE    (IOT_FIREWARE_TYPE_KL1_CKB)
							 | 
						||
| 
								 | 
							
								#elif (INCLUDE_VIRTUAL_CHANNEL && PLC_SUPPORT_CCO_ROLE)
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE    (IOT_FIREWARE_TYPE_KL1_NEW_TYPE_CCO)
							 | 
						||
| 
								 | 
							
								#else /* (IOT_STA_CONTROL_MODE > 0) */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE    (IOT_FIRMWARE_TYPE_KL)
							 | 
						||
| 
								 | 
							
								#endif /* (IOT_STA_CONTROL_MODE > 0) */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#elif (TARGET_VERSION == TARGET_KUNLUN2)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if (IOT_APP_DEF_14_BSRM == IOT_APP_SELECTION)
							 | 
						||
| 
								 | 
							
								/* KL2 BSRM FW. */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE    (IOT_FIREWARE_TYPE_KL2_BSRM)
							 | 
						||
| 
								 | 
							
								#elif (IOT_APP_DEF_16_BSRM_CUS_APP == IOT_APP_SELECTION)
							 | 
						||
| 
								 | 
							
								/* KL2 BSRM CUS FW. */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE    (IOT_FIREWARE_TYPE_KL2_BRK)
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE    (IOT_FIRMWARE_TYPE_KL2_BRM)
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#elif (TARGET_VERSION == TARGET_KUNLUN3)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if (IOT_STA_CONTROL_MODE > 0)
							 | 
						||
| 
								 | 
							
								/* KL3 CKB FW. */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE    (IOT_FIREWARE_TYPE_KL3_CKB)
							 | 
						||
| 
								 | 
							
								#elif (IOT_APP_DEF_11_BRM == IOT_APP_SELECTION)
							 | 
						||
| 
								 | 
							
								#if HPLC_RF_DEV_SUPPORT
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE   (IOT_FIREWARE_TYPE_KL3_BRM)
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE   (IOT_FIREWARE_TYPE_KL3_BRM_NO_RF)
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								#elif (IOT_APP_DEF_16_BSRM_CUS_APP == IOT_APP_SELECTION)
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE   (IOT_FIREWARE_TYPE_KL3_BRK)
							 | 
						||
| 
								 | 
							
								#elif (INCLUDE_VIRTUAL_CHANNEL && PLC_SUPPORT_CCO_ROLE)
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE    (IOT_FIREWARE_TYPE_KL3_NEW_TYPE_CCO)
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								#if HPLC_RF_DEV_SUPPORT
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE    (IOT_FIRMWARE_TYPE_KL3)
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_IMAGE_TYPE    (IOT_FIRMWARE_TYPE_KL3_NO_RF)
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								#endif /* (IOT_STA_CONTROL_MODE > 0) */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								#error "!!Unknown target version!!"
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* AP_FIRMWARE_IMAGE_TYPE */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* Build type: Release/Debug-(0/1) */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_VERSION_TYPE (1)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The major version 5 bits: 0~31 */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_VERSION_MAJOR (11)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The minor version 7 bits: 0~127 */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_VERSION_MINOR (0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The micro version 4 bits: 0~15 */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_VERSION_MICRO (0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The build version 16 bits: 0~65535. note that only lower 6 bits can be used
							 | 
						||
| 
								 | 
							
								 * if app version is not 0. app version will use higher 10 bits for
							 | 
						||
| 
								 | 
							
								 * iot_version_hex function.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_VERSION_BUILD (1)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* Numerically encoded version, like 0x01020304 */
							 | 
						||
| 
								 | 
							
								#define AP_FIRMWARE_VERSION_HEX ((AP_FIRMWARE_VERSION_MAJOR << 27) |  \
							 | 
						||
| 
								 | 
							
								                                 (AP_FIRMWARE_VERSION_MINOR << 20) |  \
							 | 
						||
| 
								 | 
							
								                                 (AP_FIRMWARE_VERSION_MICRO << 16) |  \
							 | 
						||
| 
								 | 
							
								                                 (AP_FIRMWARE_VERSION_BUILD ))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* hw version cmd parameters */
							 | 
						||
| 
								 | 
							
								#define IOT_HW_VER_LOW_OFFSET     (0)
							 | 
						||
| 
								 | 
							
								#define IOT_HW_VER_HIGH_OFFSET    (8)
							 | 
						||
| 
								 | 
							
								#define IOT_HW_VER_LOW_MASK       (0xFF)
							 | 
						||
| 
								 | 
							
								#define IOT_HW_VER_HIGH_MASK      (0xFF << 8)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief           set user build info
							 | 
						||
| 
								 | 
							
								 * @param info:     user build info to be set. if not set, user build info will
							 | 
						||
| 
								 | 
							
								 *                  same as buld info.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_version_set_user_build_info(iot_build_info_t *info);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_image_type() - image's build type
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @return            image type see - IOT_FIRMWARE_TYPE_XXX
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint8_t iot_image_type(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* IOT_VERSION_H */
							 |