| #ifndef __ASR_FLAG_H__ | 
 | #define __ASR_FLAG_H__ | 
 |  | 
 | typedef struct{ | 
 | 	unsigned int CurImageID; | 
 | 	unsigned int ImageType; | 
 | 	unsigned int ImageState; /* 1: new image is backed up, 0: not backed up */ | 
 | 	unsigned int ImageBkAddr; | 
 | 	unsigned int ImageBkLen; | 
 | 	unsigned int SegState; | 
 | 	unsigned int SegIndex; | 
 | 	unsigned int SegDestBkAddr; | 
 | 	unsigned int SegDestBkLen; | 
 | 	unsigned int PreTailAddr; | 
 | 	unsigned int PreTailLen; | 
 | 	unsigned int NextHeadAddr; | 
 | 	unsigned int NextHeadLen; | 
 | 	unsigned int NextSegWriteOffset; | 
 | 	unsigned int NextSegReadOffset; | 
 | 	unsigned int NextSegEraseOffset; | 
 | }SDfotaState, *pSDfotaState; | 
 |  | 
 | struct DDRT_STATE{ | 
 | 	unsigned int test_proc		:1;	//1: start, 0: done | 
 | 	unsigned int last_res		:1; //1: fail, 0: pass | 
 | 	unsigned int total_times	:15; | 
 | 	unsigned int fail_times		:15; | 
 | }; | 
 |  | 
 | typedef union{ | 
 | 	unsigned int value; | 
 | 	struct DDRT_STATE bits; | 
 | }DDRTestState, *pDDRTestState; | 
 |  | 
 | #define INVALID_DDRT_STATE		(0xFFFFFFFF) | 
 |  | 
 | struct asr_firmware_flag { | 
 | 	unsigned int header; | 
 | 	unsigned int upgrade_flag;		//1,upgrade;  2, backup boot | 
 | 	unsigned int fbf_flash_address; | 
 | 	unsigned int fbf_file_size; | 
 | 	unsigned int erase_psm; | 
 | 	unsigned int erase_psm_address; | 
 | 	unsigned int erase_psm_size; | 
 | 	unsigned int erase_fs; | 
 | 	unsigned int fs_erase_address; | 
 | 	unsigned int fs_erase_size; | 
 | 	unsigned int upgrade_method;		//1,TR069;	2, SD;	3,WebUI | 
 | 	unsigned int UnlockKeyFlag; | 
 | 	unsigned int production_mode_flag;		//for production mode | 
 | 	unsigned int eehP[2]; | 
 | 	unsigned int cpsr[2]; | 
 | 	unsigned int hawk[2]; | 
 | 	unsigned int imsd[2]; | 
 | 	unsigned int pipe[2]; | 
 | 	unsigned int fast[2]; | 
 | 	unsigned int apmf[2]; | 
 | 	unsigned int pid[2]; | 
 | 	unsigned int vid[2]; | 
 | 	unsigned int obmdl[2]; | 
 | 	unsigned int dlflag[2]; | 
 | 	unsigned int ramdump[2]; | 
 | 	unsigned int dfota_n_of_images; | 
 | 	unsigned int dfota_need_copy_only; | 
 | 	unsigned int dfota_conpy_len; | 
 | #ifdef CONFIG_AB_SYSTEM | 
 | 	unsigned int active_slot; /* prev active slot */ | 
 | 	unsigned int temp_active_slot; /* current active slot */ | 
 | 	unsigned int reboot_cnt; | 
 | 	unsigned int synced; | 
 | 	unsigned int rsvd[16]; | 
 | #endif | 
 | 	unsigned int nocp[2]; | 
 | 	unsigned int trust_boot_status; | 
 | 	char mversion[128]; | 
 | 	SDfotaState SDfotaInfo; | 
 | 	unsigned int ref_count; | 
 | 	unsigned int flag_len; | 
 | 	unsigned int version; | 
 | 	unsigned int DDR_ID; | 
 | 	unsigned int Flash_ID; | 
 |     unsigned int cplog[2]; | 
 | 	DDRTestState ddrt_state; | 
 | 	unsigned int svc_state; | 
 | 	char MVersion_B[128]; /* only use for AB system */ | 
 | 	unsigned int Reserved[68]; /* reserved for asr */ | 
 | 	unsigned int ReservedForCustomer[35]; /* reserved for customer */ | 
 | 	/* reserve to make the ASR_Flag length as 1KB */ | 
 |  | 
 | 	unsigned int crc; | 
 | 	/* NOTICE !!! | 
 | 	*  If you change this structure, you must also sync the change to OBM/Uboot/OTA/Telephony | 
 | 	*  OBM: obm/Common/Misc/asr_flag.h | 
 | 	*  Uboot: uboot/board/Marvell/common/asr_flag.h | 
 | 	*  OTA: services/ota/otad.c | 
 | 	*  Telephony: lte_telephony/apps/cp_load/cploader.h | 
 | 	*  If add a new member to this structure, must decrease the size of Reserved[] | 
 | 	*/ | 
 | }; | 
 |  | 
 | #define ASRFLAG_HEADER 0x464F5441 | 
 | #define MAX_ASR_FLAG_SIZE  1024 | 
 |  | 
 | /* ASR Flag version history | 
 | *  1.0.0.1: support dual asr flag | 
 | *  1.0.0.2: support asr flag crc | 
 | */ | 
 | #define ASRFLAG_VERSION_LEGACY 0xFFFFFFFF | 
 | #define ASRFLAG_VERSION_DAF  0x31303031 | 
 | #define ASRFLAG_VERSION_CRC  0x31303032 | 
 | #define ASRFLAG_VERSION     ASRFLAG_VERSION_CRC | 
 |  | 
 | enum TRUST_BOOT_CODES{ | 
 | 	TB_NO_ERROR = 0, | 
 | 	TB_TIMH_ERROR = 1, | 
 | 	TB_OBMI_ERROR = 2, | 
 | 	TB_UBOOT_ERROR = 3, | 
 | 	TB_DTIM_ERROR = 4, | 
 | 	TB_ZIMG_ERROR = 5, | 
 | 	TB_SYSJ_ERROR = 6, | 
 | 	TB_RFBI_ERROR = 7, | 
 | 	TB_GRBI_ERROR = 8, | 
 | 	TB_ARBI_ERROR = 9, | 
 | 	TB_ABRL_ERROR = 10, | 
 | 	TB_CBRL_ERROR = 11, | 
 | 	TB_APRL_ERROR = 12, | 
 | 	TB_OEMD_ERROR = 13, | 
 | 	TB_DTIM_PRIMARY_ERROR = 14, | 
 | 	TB_DTIM_RECOVERY_ERROR = 15, | 
 | 	TB_DTIM_PPSETTING_ERROR = 16, | 
 | 	TB_TOS_ERROR = 17, | 
 | 	TB_OSLO_GENERAL_ERROR = 18, | 
 | 	TB_AB_SYSTEM_BOOT_ERROR = 19, | 
 | 	TB_CPHD_ERROR = 20, | 
 | 	TB_BXBI_ERROR, | 
 | 	TB_AB_SYSTEM_ROLLBACK_ERROR, | 
 | 	TB_SDTIM_ERROR, | 
 | }; | 
 |  | 
 |  | 
 | unsigned int get_asr_flag_offset(void); | 
 | struct asr_firmware_flag *get_asr_flag(void); | 
 | int asr_flag_init(void *ptim); | 
 | int asr_flag_update(void); | 
 | int asr_flag_trust_boot_update(unsigned int tb_status); | 
 | void *asr_read_tim(void); | 
 |  | 
 | #endif |