blob: 6ebbb1d22d28e4622415f36630c8f3d4c9a7e75b [file] [log] [blame]
/******************************************************************************
*
* (C)Copyright 2014 Marvell Hefei Branch. All Rights Reserved.
*
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MARVELL.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
* This Module contains Proprietary Information of Marvell and should be
* treated as Confidential.
* The information in this file is provided for the exclusive use of the
* licensees of Marvell.
* Such users have the right to use, modify, and incorporate this code into
* products for purposes authorized by the license agreement provided they
* include this notice and the associated copyright notice with any such
* product.
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifndef __FOTA_H__
#define __FOTA_H__
#include "Typedef.h"
#include "Errors.h"
#include "Flash.h"
#include "loadoffsets.h"
#include "downloader.h"
#include "TIMDownload.h"
#include "asr_flag.h"
#if LED_DISPLAY
#include "led.h"
#endif
#if OLED_SUPPORT
#include "oled.h"
#endif
#if LZMA_SUPPORT
#include "LzmaDecode.h"
#endif
#define MINOR_VERSION_MAX_SIZE 128
typedef struct
{
UINT_T InitFlag;
UINT_T FOTA_Addr;
UINT_T FOTA_FBF_Flag;
UINT_T FOTA_Direction; /* 0: downgrade, 1: upgrade */
UINT_T FOTA_MajorVersion; /* 0 ~ 31 */
INT_T FOTA_MinorVersionValid; /* 0: initialized, 1: valid, -1: invalid */
CHAR FOTA_MinorVersion[MINOR_VERSION_MAX_SIZE];
UINT_T ATRB_CFG;
} FOTA_Info, *P_FOTA_Info;
typedef struct
{
UINT_T OS_Version;
UINT_T AP_Version;
UINT_T CP_Version;
UINT_T BuildDate;
UINT_T BuildTime;
UINT_T BuildNum;
CHAR Profile[16];
}ASR_MVersion, *P_ASR_MVersion;
#define MAX_IMAGES_NUMBER 0x100
typedef struct
{
UINT_T Image_ID;
UINT_T Image_Size;
UINT_T Image_Address;
UINT_T Image_LoadAddress;
UINT_T Image_In_TIM;
}LZMA_Image_t, *P_LZMA_Image_t;
typedef struct
{
LZMA_Image_t LZMA_List[MAX_IMAGES_NUMBER];
}LZMA_Image_List, *P_LZMA_Image_List;
extern pTIM pTIM_h_Main;
extern UINT_T MainTimSize;
extern pTIM pDTIM_Primary;
#if DUAL_TIM
extern pTIM pTIM_h_Backup;
extern INT_T BackupTimSize;
#endif
UINT_T fota_upgrade(pTIM pTIM_h, pFUSE_SET pFuses);
INT_T ASR_ParseStringToMVersion(CHAR *MVersionString, P_ASR_MVersion pMVersion);
INT_T ASR_MVersionANewerThanB(P_ASR_MVersion pMVersionA, P_ASR_MVersion pMVersionB );
INT OTA_CheckMVersion(P_FOTA_Firmware pFOTA_T, P_FOTA_Info pFOTAInfo, MasterBlockHeader *pMasterHeader);
INT FOTA_Check_OSversionProfile(P_ASR_MVersion pMVersionA, P_ASR_MVersion pMVersionB );
#endif