[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/lib/libupi_ab/inc/upi_fotaflag_partition.h b/ap/lib/libupi_ab/inc/upi_fotaflag_partition.h
new file mode 100755
index 0000000..f172b50
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/upi_fotaflag_partition.h
@@ -0,0 +1,143 @@
+/**
+* @file upi_fotaflag_partition.h
+* @brief °æ±¾·ÖÇøÅäÖÃÐÅÏ¢
+*
+* Copyright (C) 2017 Sanechips Technology Co., Ltd.
+* @author
+*
+*/
+
+#ifndef _UPI_FOTAFLAG_PARTITION_H
+#define _UPI_FOTAFLAG_PARTITION_H
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+
+// fotaflagÔÚzftl5ÖÐÕ¼ÓõÄ×Ö½ÚÊý
+#define FOTA_FLAG_SIZE (32)
+
+
+
+// fotaflag ±éÀúÓú궨Òå
+#define ZTE_DUA_FOTAFLAG_PART ("/device/name")
+#define ZTE_DUA_FOTAFLAG ("fotaflag")
+#define ZTE_DUA_PART_UPDATED_DEV ("/dev")
+#define ZTE_DUA_FOTAFLAG_BLOCK_PART ("/sys/class/block")
+
+
+/* Êý¾ÝÀàÐÍ */
+typedef enum
+{
+ SYSTEM_FLAG_FOTA_MAIN = 0,
+ SYSTEM_FLAG_FOTA_BACKUP,
+} E_SYSTEM_FLAG_DATA_TYPE;
+
+
+
+/*******************************************************************************
+ * Type definitions *
+ ******************************************************************************/
+
+/* ÔÚflags·ÖÇøÀïÆ«ÒÆµØÖ· */
+
+#define FLAGS_MAGIC (0x464C4147UL)
+
+
+
+#define DUALSYSTEM_STATUS_BOOTABLE (0xB0AB) /* ¿ÉÆô¶¯ */
+#define DUALSYSTEM_STATUS_SUCCESSFUL (0x5CCF) /* Äܳɹ¦Æô¶¯ */
+#define DUALSYSTEM_STATUS_UNBOOTABLE (0xBABE) /* ²»¿ÉÆô¶¯ */
+
+typedef struct
+{
+ int status; /* bootable/successful/unbootable */
+ int try_cnt;
+} T_DualSystem_Status;
+
+typedef enum
+{
+ DUAL_SYSTEM = 0x875A, /* µÚÒ»¸öϵͳ */
+ DUAL_SYSTEM2 = 0x986B, /* µÚ¶þ¸öϵͳ */
+} T_BOOT_TARGET;
+
+/* ˫ϵͳÀàÐÍ */
+typedef enum
+{
+ DUALSYSTEM_RECOVERY = 0x7575, /* normal-recovery˫ϵͳ */
+ DUALSYSTEM_AA = 0xAAAA, /* AA˫ϵͳ */
+ DUALSYSTEM_AB = 0xABAB /* AB˫ϵͳ */
+} T_BOOT_DUALSYSTEM_TYPE;
+
+typedef struct
+{
+ unsigned int magic; /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
+ T_BOOT_TARGET boot_to; /* µ±Ç°Æô¶¯ÏµÍ³±êÖ¾*/
+ unsigned int fota_status; /* fota״̬ */
+ T_DualSystem_Status system; /* µÚÒ»¸öϵͳ״̬ */
+ T_DualSystem_Status system2; /* µÚ¶þ¸öϵͳ״̬ */
+} T_BOOT_FOTA_FLAG;
+
+typedef struct
+{
+ unsigned int magic; /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
+ T_BOOT_DUALSYSTEM_TYPE dualsys_type; /* ˫ϵͳÀàÐÍ */
+ char system_boot_env[128];
+ char system2_boot_env[128];
+} T_BOOT_ENV;
+
+
+typedef struct
+{
+ T_BOOT_FOTA_FLAG boot_flag;
+ T_BOOT_ENV boot_env;
+} T_FOTA_FLAG_INFO;
+
+
+
+/*******************************************************************************
+ * Global variable declarations *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+
+void upi_reboot();
+int check_fota_flag_partition(void);
+
+
+
+int upi_get_boot_env(T_BOOT_ENV* boot_env);
+int upi_set_boot_fota_flag(T_BOOT_FOTA_FLAG* fota_flag);
+int upi_get_system_boot_to();
+int upi_set_system_boot_to(int boot_to, int boot_to_status);
+int upi_set_system_status(int system, int status);
+
+int upi_get_boot_flag(T_BOOT_FOTA_FLAG *boot_flag);
+int init_fotaflag_partition();
+
+int upi_get_system_info(T_FOTA_FLAG_INFO *p_system_info);
+
+// Éý¼¶ºófota±êÖ¾£¬Ö÷ÒªÓÃÀ´±êÖ¾ÊÇ·ñÐèҪͬ²½NV
+int upi_get_system_fota_status();
+int upi_set_system_fota_stauts(int status);
+
+
+
+
+/*******************************************************************************
+ * Inline function implementations *
+ ******************************************************************************/
+
+
+
+
+#endif // _UPI_FOTAFLAG_PARTITION_H
+
diff --git a/ap/lib/libupi_ab/inc/upi_hash.h b/ap/lib/libupi_ab/inc/upi_hash.h
new file mode 100755
index 0000000..9d8bc29
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/upi_hash.h
@@ -0,0 +1,67 @@
+/**
+* @file upi_hash.h
+* @brief ¹«¹²½Ó¿Ú¼°ÐÅÏ¢
+*
+* Copyright (C) 2017 Sanechips Technology Co., Ltd.
+* @author
+*
+*/
+
+#ifndef _UPI_HASH_H
+#define _UPI_HASH_H
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+
+#include "upi_mtd.h"
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+
+
+
+
+
+
+/*******************************************************************************
+ * Type definitions *
+ ******************************************************************************/
+
+typedef enum E_HASH_TYPE{
+ HASH_SHA512 = 0,
+ HASH_SHA526 = 1
+} hash_type_e;
+
+/*******************************************************************************
+ * Global variable declarations *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+int check_image_hash(partition_mtd_info_t *mtd_info, int len, char * digest);
+
+int get_hash_from_fd(int hash_type, int fd, unsigned int offset, unsigned int len, unsigned int read_size_per_time, unsigned char* digest);
+
+int get_hash_from_file_path_segment(int hash_type, const char* file_path, unsigned int offset, unsigned int len, unsigned char* digest);
+
+
+/*******************************************************************************
+ * Inline function implementations *
+ ******************************************************************************/
+
+
+
+
+#endif // _UPI_HASH_H
+
diff --git a/ap/lib/libupi_ab/inc/upi_img_interface.h b/ap/lib/libupi_ab/inc/upi_img_interface.h
new file mode 100755
index 0000000..2a0ea67
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/upi_img_interface.h
@@ -0,0 +1,50 @@
+#ifndef UPI_IMG_INTERFACE_H
+#define UPI_IMG_INTERFACE_H
+
+
+
+typedef struct {
+ unsigned int mtd_totalsize; // mtd device total size
+ unsigned int mtd_pageperblock; // mtd device page per block
+ unsigned int mtd_blocksize; // mtd device block size
+ unsigned int mtd_pagesize; // mtd device page size
+ unsigned int mtd_oobsize; // mtd device oob size
+// char mtd_path[256]; // mtd path
+ int parti_file_desc; // partition update file description
+}partition_mtd_info_t;
+
+#if 0
+int ZXIC_GetBlockSize(partition_mtd_info_t *mtd_info, int *block_size);
+int ZXIC_GetFiledesc(partition_mtd_info_t *mtd_info, int *fd_dst);
+#endif
+
+int ZXIC_ReadImage(partition_mtd_info_t *mtd_info, unsigned char *buffer, int start_address, int size);
+int ZXIC_WriteBlock(partition_mtd_info_t *mtd_info, int start_address, unsigned char *buffer);
+unsigned long translateToGoodAddress(partition_mtd_info_t *mtd_info, unsigned long dwBlockAddress, int *badnum);
+
+
+
+int ZXIC_ReadImageSeg(
+ partition_mtd_info_t *mtd_info,
+ unsigned char *buffer,
+ int start_address,
+ int stop_address,
+ int index,
+ int size) ;
+
+
+int ZXIC_WriteBlockSeg(
+ partition_mtd_info_t *mtd_info,
+ int start_address,
+ int stop_address,
+ int index,
+ unsigned char *buffer,
+ int size);
+
+
+
+
+
+
+#endif /*UPI_IMG_INTERFACE_H*/
+
diff --git a/ap/lib/libupi_ab/inc/upi_log.h b/ap/lib/libupi_ab/inc/upi_log.h
new file mode 100755
index 0000000..d089723
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/upi_log.h
@@ -0,0 +1,53 @@
+#ifndef UPI_LOG_H
+#define UPI_LOG_H
+
+
+#define FOTA_UPI_AB_LOG_ROOT "/cache/zte_fota_ab/"
+
+#define FOTA_UPI_AB_LOG_PATH "/cache/zte_fota_ab/upi_ab.log"
+
+
+#ifdef _IS_MIN
+
+
+#define upi_print(ModID,...) do { \
+ printf(__VA_ARGS__); \
+ } while(0)
+
+
+#else
+
+#define upi_print(ModID,...) do { \
+ printf(__VA_ARGS__); \
+ char buffer_log[512] = {0}; \
+ snprintf(buffer_log, 510, __VA_ARGS__); \
+ upi_fwrite(ModID,buffer_log); \
+ } while(0)
+
+
+#endif
+
+
+
+#define upi_log(fmt, args...) \
+ do {upi_print(FOTA_UPI_AB_LOG_PATH, "[%s][fota_upi] [%s-%d]: " fmt"\n", upi_get_time_us(),__FUNCTION__, __LINE__, ## args);} while (0)
+#define upi_err(fmt, args...) \
+ do {upi_print(FOTA_UPI_AB_LOG_PATH, "[%s][fota_upi] [%s-%d]: " fmt"\n", upi_get_time_us(),__FUNCTION__, __LINE__, ## args);} while (0)
+#if 0
+#define lib_log(fmt, args...) \
+ do {upi_print(FOTA_UPI_AB_LOG_PATH, "" fmt"\n", ## args);} while (0)
+#endif
+
+
+#define LOG_FUNC_BEGIN upi_log("%s func begin!", __func__);
+#define LOG_FUNC_END upi_log("%s func end!", __func__);
+
+
+
+void upi_fwrite(char *filename, char* info);
+void upi_close_logfile(void);
+char * upi_get_time_us(void);
+
+unsigned int timestamp_now(void);
+
+#endif /*UPI_LOG_H*/
diff --git a/ap/lib/libupi_ab/inc/upi_mtd.h b/ap/lib/libupi_ab/inc/upi_mtd.h
new file mode 100755
index 0000000..a856ffb
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/upi_mtd.h
@@ -0,0 +1,74 @@
+/**
+* @file upi_mtd.h
+* @brief °æ±¾·ÖÇøÅäÖÃÐÅÏ¢
+*
+* Copyright (C) 2017 Sanechips Technology Co., Ltd.
+* @author
+*
+*/
+
+#ifndef _UPI_MTD_H
+#define _UPI_MTD_H
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+
+#include "upi_img_interface.h"
+#include "upi_update.h"
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Type definitions *
+ ******************************************************************************/
+
+typedef enum {
+ DEVICE_MTD = 0,
+ DEVICE_ZFTL = 1,
+ DEVICE_MTD_BLOCK,
+ DEVICE_UNKNOWN,
+} device_type_t;
+
+/*******************************************************************************
+ * Global variable declarations *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+
+/**
+ * @brief
+ * @note
+ */
+
+int mtd_find(const char *i_parti_name, char *o_mtd_path, device_type_t device_type, unsigned int o_mtd_path_len);
+int get_partition_update_info(int target, const char *partition_name, device_data_t *device_data);
+int mtd_erase_partition(int target, const char*partition_name);
+int is_partition_exist(int target, char * partition_name);
+
+/**
+ * @brief
+ * @note
+ */
+
+int write_mtd_partition_data(partition_mtd_info_t *mtd_info, int offset, int len, unsigned char *write_data);
+int read_mtd_partition_data(partition_mtd_info_t *mtd_info, int offset, int len, char * read_data);
+
+
+int get_partition_mtd_info(const char *partition_name, int partition_type, partition_mtd_info_t *mtd_info);
+
+
+/*******************************************************************************
+ * Inline function implementations *
+ ******************************************************************************/
+
+
+
+
+#endif // _UPI_MTD_H
+
diff --git a/ap/lib/libupi_ab/inc/upi_public.h b/ap/lib/libupi_ab/inc/upi_public.h
new file mode 100755
index 0000000..0ade3d3
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/upi_public.h
@@ -0,0 +1,202 @@
+/**
+* @file upi_public.h
+* @brief ¹«¹²½Ó¿Ú¼°ÐÅÏ¢
+*
+* Copyright (C) 2017 Sanechips Technology Co., Ltd.
+* @author
+*
+*/
+
+#ifndef _UPI_PUBLIC_H
+#define _UPI_PUBLIC_H
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+
+
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+//ÄÚ´æ¼ì²â¿ª¹Ø
+//#define FOTA_MEM_DEBUG
+
+
+#ifndef FOTA_MEM_DEBUG
+#define upi_free(ptr) if(NULL != ptr) {free(ptr); ptr = NULL;}
+#define upi_malloc(size) malloc(size)
+#define upi_strdup(str) strdup(str)
+#define upi_realloc(ptr, size) realloc(ptr, size)
+#else
+void* realloc_debug(void *ptr, size_t size, const char*func, long line);
+
+void* malloc_debug(size_t bytes, const char* func, long line);
+void* free_debug(void*p, const char* func, long line);
+char* strdup_debug(const char* str, const char* func, long line);
+
+#define upi_free(ptr) if(NULL != ptr){free_debug(ptr, __FUNCTION__, __LINE__); ptr=NULL;}
+#define upi_malloc(size) malloc_debug(size, __FUNCTION__, __LINE__)
+#define upi_strdup(str) strdup_debug(str, __FUNCTION__, __LINE__)
+#define upi_realloc(ptr, size) realloc_debug(ptr, size, __FUNCTION__, __LINE__)
+
+
+#endif
+
+#define MAX_PATH_LEN (256)
+#define SHA512_LEN (64)
+#define HASH_MAX_LEN (64)
+
+#define PARTITION_NAME_LEN (32)
+#define EXTRA_NAME_LEN (32)
+
+
+
+#define FOTA_AB_UPGRADE_STATUS "fota_ab_upgrade_status"
+
+#define FOTA_AB_UPGRADE_TOTAL_SIZE "fota_ab_upgrade_total_size"
+
+#define FOTA_AB_UPGRADE_UPDATED_SZIE "fota_ab_upgrade_updated_size"
+
+#define FOTA_AB_AA_SYNC_STATUS "fota_ab_aa_sync_status"
+
+
+#define PARTITION_NAME_FOTA_FLAG "flags"
+#define PARTITION_NAME_ROOTFS_1 "rootfs"
+#define PARTITION_NAME_ROOTFS_2 "rootfs2"
+#define SYSTEM_INDEX_1 (1)
+#define SYSTEM_INDEX_2 (2)
+#define SYSTEM_INDEX_UNKNOWN (-1)
+
+
+
+#define FILE_PATH_PROC_MTD "/proc/mtd"
+#define FILE_PATH_PROC_CMDLINE "/proc/cmdline"
+
+
+#define SYSTEM_UPGRADE_PARTITION_INFO_HEAD_MAGIC ("SUPI")
+#define SYSTEM_UPGRADE_PARTITION_INFO_HEAD_MAGIC_LEN (4)
+
+#define SYSTEM_PARTITION_FILE ("/etc_ro/systemPartitionInfo.conf")
+
+#define PLATFORM_PARTITION_NUM_MAX (7)
+#define OEM_PARTITION_NUM_MAX (7)
+
+/*******************************************************************************
+ * Type definitions *
+ ******************************************************************************/
+
+typedef enum {
+ HASH_TYPE_SHA_512 = 0,
+ HASH_TYPE_SHA_256
+} Hash_type_s;
+
+
+/**
+* @brief ϵͳ·ÖÇøÐÅϢͷ
+* @param magic ħÊõ×Ö
+* @param plat ƽ̨: 0 - V3T, 1 - 8501
+* @param plat_partition_num ƽ̨·ÖÇøÊý
+* @param oem_partition_num oem·ÖÇøÊý
+*/
+typedef struct {
+ char magic[SYSTEM_UPGRADE_PARTITION_INFO_HEAD_MAGIC_LEN];
+ int plat;
+ int plat_partition_num;
+ int oem_partition_num;
+} system_partition_info_head_t;
+
+
+/**
+* @brief ƽ̨ϵͳ·ÖÇøÐÅÏ¢
+* @param name ·ÖÇøÃû
+* @param system_type ËùÊôϵͳÀàÐÍ - 0 ƽ̨ÀàÐÍ, 1 oem
+* @param partition_type ·ÖÇøÀàÐÍ
+*/
+typedef struct {
+ char name[PARTITION_NAME_LEN];
+ int system_type;
+ int partition_type;
+} platform_partition_info_t;
+
+
+/**
+* @brief oem·ÖÇøÐÅÏ¢
+* @param name ·ÖÇøÃû
+* @param system_type ËùÊôϵͳÀàÐÍ - 0 ƽ̨ÀàÐÍ, 1 oem
+* @param partition_type ·ÖÇøÀàÐÍ
+*/
+typedef struct {
+ char name[PARTITION_NAME_LEN];
+ int system_type;
+ int partition_type;
+} oem_partition_info_t;
+
+
+/**
+* @brief ϵͳ¿ÉÉý¼¶·ÖÇøÐÅÏ¢
+* @param platform_partition_info ƽ̨¿ÉÉý¼¶·ÖÇøÐÅÏ¢
+* @param oem_partition_info oem¿ÉÉý¼¶·ÖÇøÐÅÏ¢
+*/
+typedef struct {
+ system_partition_info_head_t system_partition_info_head;
+ platform_partition_info_t *platform_partition_info;
+ oem_partition_info_t *oem_partition_info;
+} system_upgrade_partition_info_t;
+
+
+/*******************************************************************************
+ * Global variable declarations *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+int upi_delete_folder(const char* folderpath);
+int upi_create_folder(const char* folderpath);
+int upi_check_file_existence(const char* filepath);
+char * get_log_root_path();
+char * get_temp_path();
+
+int hash_copy(char *dst, char *src, int type);
+int hash_compare(char *str1, char *str2, int type);
+void show_hash_hex(int type, const char* title, char *hash);
+
+
+void upi_set_upgrade_status(int status);
+void upi_set_upgrade_total_size(int total_size);
+void upi_set_upgrade_updated_size(int updated_size);
+void upi_set_sync_status(int sync_status);
+
+int upi_get_upgrade_status();
+int upi_get_upgrade_total_size();
+int upi_get_upgrade_updated_size();
+int upi_get_sync_status();
+
+int upi_get_current_system();
+int upi_get_target_upgrade_system();
+int upi_get_target_sync_system(int *target_system_index, int *target_system);
+
+ssize_t upi_readn(int fd, void *vptr, size_t n);
+
+int upi_init_system_partition_info(system_upgrade_partition_info_t *system_partition_info);
+void upi_deinit_system_partition_info(system_upgrade_partition_info_t *system_partition_info);
+
+
+/*******************************************************************************
+ * Inline function implementations *
+ ******************************************************************************/
+
+
+
+
+#endif // _UPI_PUBLIC_H
+
diff --git a/ap/lib/libupi_ab/inc/upi_sync_system.h b/ap/lib/libupi_ab/inc/upi_sync_system.h
new file mode 100755
index 0000000..9ca0409
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/upi_sync_system.h
@@ -0,0 +1,48 @@
+/**
+* @file upi_sync_system.h
+* @brief AB-AAϵͳͬ²½
+*
+* Copyright (C) 2017 Sanechips Technology Co., Ltd.
+* @author
+*
+*/
+
+
+#ifndef _UPI_SYNC_SYSTEM_H
+#define _UPI_SYNC_SYSTEM_H
+
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Type definitions *
+ ******************************************************************************/
+typedef enum {
+ SYNC_STATUS_FAIL = -1,
+ SYNC_STATUS_SUCCESS = 0,
+ SYNC_STATUS_SYNCING
+} sync_status_t;
+
+
+/*******************************************************************************
+ * Global variable declarations *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+int upi_sync_system();
+
+int upi_get_upgrade_type();
+
+
+#endif // _UPI_SYNC_SYSTEM_H
diff --git a/ap/lib/libupi_ab/inc/upi_update.h b/ap/lib/libupi_ab/inc/upi_update.h
new file mode 100755
index 0000000..486707e
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/upi_update.h
@@ -0,0 +1,56 @@
+#ifndef UPI_UPDATE_H
+#define UPI_UPDATE_H
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/reboot.h>
+
+
+#include "upi_public.h"
+#include "upi_img_interface.h"
+//#include "upi_mtd.h"
+#include "zxic_fota_ab_upgrade.h"
+
+
+#define FOTA_PACKAGE_FILE "/cache/zte_fota_ab/upgrade.package"
+
+typedef enum {
+ UPGRADE_STATUS_UNKNOWN = -1,
+ UPGRADE_STATUS_VERIFING = 0,
+ UPGRADE_STATUS_VERIFY_SUCCESS,
+ UPGRADE_STATUS_VERIFY_FAIL,
+ UPGRADE_STATUS_UPDATING,
+ UPGRADE_STATUS_UPDATE_SUCCESS,
+ UPGRADE_STATUS_UPDATE_FAIL,
+ UPGRADE_STATUS_NO_NEED_UPDATE,
+ UPGRADE_STATUS_NEED_UPDATE
+} upgrade_status_s_type;
+
+typedef struct {
+ int upgrage_package_file_desc; // upgrade package file description
+ unsigned int upgrade_data_offset; // upgrade package offset in file
+ unsigned int upgrade_file_size; // upgrade package file size
+}partition_upgrade_package_info_t;
+
+
+typedef struct {
+ char partition_name[PARTITION_NAME_LEN];
+ int partition_type;
+ long long len;
+ int offset;
+ int zipped;
+ char hash[HASH_MAX_LEN];
+ int index;
+ int partition_total_count;
+ partition_upgrade_package_info_t pkg_info;
+ partition_mtd_info_t mtd_info;
+} device_data_t;
+
+int upi_update(z_upgrade_flush_status_t* flush_status);
+
+
+#endif /*UPI_UPDATE_H*/
diff --git a/ap/lib/libupi_ab/inc/upi_upgrade_package.h b/ap/lib/libupi_ab/inc/upi_upgrade_package.h
new file mode 100755
index 0000000..b4604dc
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/upi_upgrade_package.h
@@ -0,0 +1,167 @@
+/**
+* @file upi_delta.h
+* @brief ²î·ÖÎļþÏà¹ØÍ·Îļþ
+*
+* Copyright (C) 2017 Sanechips Technology Co., Ltd.
+* @author
+*
+*/
+
+#ifndef _UPI_UPGRADE_PACKAGE_H
+#define _UPI_UPGRADE_PACKAGE_H
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+
+#include "upi_public.h"
+
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+
+#define UPGRADE_PACKAGE_HEAD_MAGIC ("FOTA")
+#define UPGRADE_PACKAGE_HEAD_MAGIC_LEN (4)
+
+#define VERSION_LEN (64)
+
+
+/*******************************************************************************
+ * Type definitions *
+ ******************************************************************************/
+
+/**
+* @brief ²î·ÖÎļþÎļþÍ·ÐÅÏ¢£¬¿ÉÒÔÓÃÓÚУÑé²î·ÖÎļþµÈ£»¼°»ñÈ¡µ±Ç°ÎļþÖзÖÇø¼°extraÊýµÈ£»
+* @param magic_word: ÎļþͷħÊõ×Ö
+* @param plat: ƽ̨
+* @param upgrade_package_type: Éý¼¶°üÎļþÀàÐÍ AL£ºÈ«°æ±¾£¬ DE£º²î·Ö
+* @param upgrade_type Éý¼¶ÀàÐÍ
+* @param upgrade_package_version: Éý¼¶°üÎļþ°æ±¾
+* @param partition_num: ·ÖÇøÊý
+* @param extra_num: hashËã·¨ÀàÐÍ£¬0£ºÄ¬ÈÏ SHA512
+* @param block_size: ¿é´óС£¬128ÕûÊý±¶
+* @param extra_num: extraÎļþÊý
+* @param version_src: ²î·ÖÎļþÉý¼¶Ô´°æ±¾£¬¶ÔÓ¦ÄÚ²¿°æ±¾ºÅ
+* @param version_dst: ²î·ÖÎļþÉý¼¶Ä¿±ê°æ±¾ºÅ£¬¶ÔÓ¦ÄÚ²¿°æ±¾ºÅ
+* @param hash: hashËã·¨Öµ
+**/
+
+
+
+typedef struct {
+ char magic_word[UPGRADE_PACKAGE_HEAD_MAGIC_LEN];
+ int upgrade_package_version;
+ int plat;
+ int upgrade_package_type;
+ int upgrade_type;
+ int partition_num;
+ int extra_num;
+ int hash_type;
+ int block_size;
+ char version_src[VERSION_LEN];
+ char version_dst[VERSION_LEN];
+ unsigned char hash[HASH_MAX_LEN];
+ char reserve[28];
+} upgrade_package_head_info_t;
+
+/**
+* @brief ·ÖÇøÎļþÍ·ÐÅÏ¢£¬°üº¬´ýÉý¼¶µÄ²î·Ö·ÖÇøÎļþÐÅÏ¢
+* @param name: ²î·Ö·ÖÇøÃû
+* @param len: ²î·Ö·ÖÇøÎļþ³¤¶È
+* @param offset: ²î·Ö·ÖÇøÎļþÏà¶ÔÓÚdeltaÎļþ0µØÖ·µÄÆ«ÒÆ
+* @param partition_type: ·ÖÇøÀàÐÍ
+* @param zipped: ÊÇ·ñ¾¹ýѹËõ
+* @param reserve: ±£Áô
+* @param hash: ÖÆ×÷²î·Ö·ÖÇøµÄÔ´·ÖÇøÎļþmd5
+*/
+typedef struct {
+ char name[PARTITION_NAME_LEN];
+ int len;
+ int offset;
+ int partition_type;
+ int zipped;
+ char reserve[16];
+ unsigned char hash[HASH_MAX_LEN];
+} partition_head_info_t;
+
+
+/**
+* @brief extraÐÅÏ¢
+* @param name: extraÎļþÃû
+* @param len: Îļþ³¤¶È
+* @param offset: »ùÓÚÕû¸ö²î·ÖÎļþµÄÆ«ÒÆ
+* @param hash: ÎļþhashÖµ
+* @param reserve: Ô¤ÁôÐÅÏ¢
+*/
+typedef struct {
+ char name[EXTRA_NAME_LEN];
+ int len;
+ int offset;
+ char reserve_1[8];
+ unsigned char hash[HASH_MAX_LEN];
+ char reserve_2[8];
+} extra_head_info_t;
+
+
+/**
+* @brief ²î·ÖÎļþÐÅÏ¢
+* @param head: ÎļþÍ·ÐÅÏ¢
+* @param partition_num: ÎļþÖзÖÇøÊý
+* @param partition_info: ·ÖÇøÐÅÏ¢Ö¸ÕëÍ·
+* @param extra_num: extraÎļþÊý
+* @param extra_info: extraÎļþÐÅÏ¢Ö¸Õë
+* @param upgrade_package_file_desc: Îļþ¾ä±ú
+* @param upgrade_package_file_size: Îļþ³¤¶È
+*/
+typedef struct {
+ upgrade_package_head_info_t *head;
+// int partition_num;
+ partition_head_info_t *partition_info;
+// int extra_num;
+ extra_head_info_t *extra_info;
+ int upgrade_package_file_desc;
+ unsigned int upgrade_package_file_size;
+}upgrade_package_info_t;
+
+
+
+
+
+
+/*******************************************************************************
+ * Global variable declarations *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+
+
+int init_upgrade_package_info(const char * upagrade_package_file_path);
+void deinit_upgrade_package_info();
+
+upgrade_package_info_t *get_upgrade_package_info();
+
+partition_head_info_t *get_partition_head_info();
+int get_partition_num();
+
+extra_head_info_t *get_extra_head_info();
+int get_extra_num();
+
+int get_upgrade_package_file_fd();
+
+partition_head_info_t *get_partition_head_info_by_name(const char *partition_name);
+int get_total_partition_length();
+
+int get_upgrade_type();
+
+/*******************************************************************************
+ * Inline function implementations *
+ ******************************************************************************/
+
+
+
+
+#endif // _UPI_UPGRADE_PACKAGE_H
+
diff --git a/ap/lib/libupi_ab/inc/upi_verify.h b/ap/lib/libupi_ab/inc/upi_verify.h
new file mode 100755
index 0000000..c6de83c
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/upi_verify.h
@@ -0,0 +1,18 @@
+#ifndef UPI_VERIFY_H
+#define UPI_VERIFY_H
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/reboot.h>
+
+
+#include "upi_public.h"
+#include "upi_img_interface.h"
+
+int upi_verify();
+
+#endif /*UPI_VERIFY_H*/
diff --git a/ap/lib/libupi_ab/inc/zxic_fota_ab_upgrade.h b/ap/lib/libupi_ab/inc/zxic_fota_ab_upgrade.h
new file mode 100755
index 0000000..bea70b8
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/zxic_fota_ab_upgrade.h
@@ -0,0 +1,366 @@
+/**
+* @file zxic_fota_ab_upgrade.h
+* @brief ABϵͳFOTAÉý¼¶¶ÔÍâ½Ó¿Ú
+*
+* Copyright (C) 2017 Sanechips Technology Co., Ltd.
+* @author
+*
+*/
+
+#ifndef ZXIC_FOTA_AB_UPGRADE_H
+#define ZXIC_FOTA_AB_UPGRADE_H
+
+/*******************************************************************************
+ * Include header files *
+ ******************************************************************************/
+
+
+
+/*******************************************************************************
+ * Macro definitions *
+ ******************************************************************************/
+
+#define Z_FOTA_SUCCESS (0)
+#define Z_FOTA_FAIL (-1)
+
+/*
+ ºê¶¨Ò壺Éý¼¶×´Ì¬ºê
+ */
+#define Z_UPGRAGE_STATUS_FREE (-1)
+#define Z_UPGRADE_STATUS_VERIFING (0)
+#define Z_UPGRADE_STATUS_VERIFY_SUCCESS (1)
+#define Z_UPGRADE_STATUS_VERIFY_FAIL (2)
+#define Z_UPGRADE_STATUS_UPDATING (3)
+#define Z_UPGRADE_STATUS_UPDATE_SUCCESS (4)
+#define Z_UPGRADE_STATUS_UPDATE_FAIL (5)
+
+
+/*
+ * ºê¶¨Ò壺˫ϵͳÆô¶¯£¬ÏµÍ³×´Ì¬
+ */
+#define Z_DUALSYSTEM_STATUS_BOOTABLE (0xB0AB) /* ¿ÉÆô¶¯ */
+#define Z_DUALSYSTEM_STATUS_SUCCESSFUL (0x5CCF) /* Äܳɹ¦Æô¶¯ */
+#define Z_DUALSYSTEM_STATUS_UNBOOTABLE (0xBABE) /* ²»¿ÉÆô¶¯ */
+
+
+#define Z_DUAL_SYSTEM (0x875A)
+#define Z_DUAL_SYSTEM2 (0x986B)
+
+
+/*
+ *ºê¶¨Ò壺Éý¼¶ÀàÐÍ
+ */
+#define Z_UPGRADE_TYPE_ALL (0) /* È«°æ±¾ÀàÐÍ */
+#define Z_UPGRADE_TYPE_PLATFORM (1) /* ƽ̨ÀàÐÍ */
+#define Z_UPGRADE_TYPE_OEM (2) /* OEMÀàÐÍ */
+#define Z_UPGRADE_TYPE_INVALID (-1) /* ÎÞЧÀàÐÍ */
+
+
+/*******************************************************************************
+ * Type definitions *
+ ******************************************************************************/
+
+
+
+/*
+ * ˵Ã÷£ºÉý¼¶×´Ì¬ÐÅÏ¢½á¹¹Ìå
+ * upgrade_status:Éý¼¶×´Ì¬£¬È¡Öµ²Î¿¼¡¾Éý¼¶×´Ì¬ºê¡¿
+ * total_size:´ýдÈëÉý¼¶·ÖÇø×ܳ¤¶È
+ * upgraded_size:ÒÑÉý¼¶·ÖÇø³¤¶È
+ * ×¢Ò⣺
+ * ³¤¶ÈÐÅÏ¢½öÔÚÉý¼¶×´Ì¬ÎªUPGRADE_STATUS_UPDATINGʱÓÐЧ£¬ÆäËü״̬²ÎÊýÖµÎÞʵ¼ÊÒâÒå
+ */
+
+typedef struct {
+ int upgrade_status;
+ int total_size;
+ int upgraded_size;
+}z_upgrade_status_info_t;
+
+
+/*
+ * ˵Ã÷£ºµ¥ÏµÍ³×´Ì¬
+ * system:µ±Ç°ÏµÍ³ Z_DUAL_SYSTEM¡¢Z_DUAL_SYSTEM2
+ * status:ϵͳ״̬ Z_DUALSYSTEM_STATUS_BOOTABLE¡¢Z_DUALSYSTEM_STATUS_SUCCESSFUL¡¢Z_DUALSYSTEM_STATUS_UNBOOTABLE
+ * try_cnt:ÖØÆô´ÎÊý
+ * ×¢Ò⣺
+ * ³¤¶ÈÐÅÏ¢½öÔÚÉý¼¶×´Ì¬ÎªUPGRADE_STATUS_UPDATINGʱÓÐЧ£¬ÆäËü״̬²ÎÊýÖµÎÞʵ¼ÊÒâÒå
+ */
+typedef struct {
+ int system;
+ int status; /* bootable/successful/unbootable */
+ int try_cnt;
+}z_system_info_t;
+
+
+/*
+ * ˵Ã÷£ºÏµÍ³×´Ì¬
+ * boot_to:ÏÂ´ÎÆô¶¯ÏµÍ³
+ * system_1:ϵͳ1״̬
+ * system_2:ϵͳ2״̬
+ * ×¢Ò⣺
+ *
+ */
+typedef struct
+{
+ int boot_to; /* µ±Ç°Æô¶¯ÏµÍ³±êÖ¾*/
+ int fota_status;
+ z_system_info_t system_1;
+ z_system_info_t system_2;
+}z_upgrade_system_info_t;
+
+
+typedef struct {
+ z_upgrade_status_info_t *status;
+ void(* status_cb)(z_upgrade_status_info_t *status);
+} z_upgrade_flush_status_t;
+
+
+//typedef void(* flush_upgrade_status)(z_upgrade_status_info_t *status);
+
+
+/*******************************************************************************
+ * Global variable declarations *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ * Global function declarations *
+ ******************************************************************************/
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_verify
+ * ¹¦ÄÜÃèÊö:Éý¼¶°üºÏ·¨ÐÔУÑé
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
+ * Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * Z_FOTA_SUCCESS УÑé³É¹¦
+ * Z_FOTA_FAILУÑéʧ°Ü
+ * ×¢Òâ:
+ * ͬ²½½Ó¿Ú£¬½¨ÒéÒì²½µ÷ÓÃ
+ ********************************************************************************/
+int zxic_dual_verify();
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_upgrade
+ * ¹¦ÄÜÃèÊö:¿ªÊ¼Éý¼¶
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£º
+ * flush_upgrade_status ״̬»Øµ÷½Ó¿Ú
+ * Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * Z_FOTA_SUCCESS Éý¼¶³É¹¦
+ * Z_FOTA_FAILÉý¼¶Ê§°Ü
+ * ×¢Òâ:
+ * ͬ²½½Ó¿Ú£¬½¨ÒéÒì²½µ÷Ó㬱ÜÃâ×èÈû
+ * ״̬»Øµ÷½Ó¿ÚÖнûÖ¹×ö¸´ÔÓ²Ù×÷£¬½¨Òé½ö½øÐÐ״̬Êä³ö
+********************************************************************************/
+
+int zxic_dual_upgrade(z_upgrade_flush_status_t* flush_status);
+
+
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_get_upgrade_status
+ * ¹¦ÄÜÃèÊö:Éý¼¶×´Ì¬»ñÈ¡
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
+ * Êä³ö²ÎÊý:
+ * upgrade_info_t *upgrade_info Éý¼¶×´Ì¬
+ * ·µ»ØÖµ£º
+ * Z_FOTA_SUCCESS Éý¼¶³É¹¦
+ * Z_FOTA_FAILÉý¼¶Ê§°Ü
+ * ×¢Òâ:
+********************************************************************************/
+int zxic_dual_get_upgrade_status(z_upgrade_status_info_t *upgrade_info);
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_get_current_system
+ * ¹¦ÄÜÃèÊö:»ñÈ¡µ±Ç°ÔËÐÐϵͳ
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
+ * Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * µ±Ç°ÔËÐÐϵͳ
+ * ×¢Òâ:
+********************************************************************************/
+int zxic_dual_get_current_system();
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_get_boot_to_system
+ * ¹¦ÄÜÃèÊö:»ñÈ¡ÖØÆôºóÄ¿±êÆô¶¯ÏµÍ³
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
+ * Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * µ±Ç°ÔËÐÐϵͳ
+ * ×¢Òâ:
+********************************************************************************/
+int zxic_dual_get_boot_to_system();
+
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_set_boot_to_system
+ * ¹¦ÄÜÃèÊö:ÉèÖÃÄ¿±êÔËÐÐϵͳ
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£º
+ * system:Ä¿±êϵͳ
+ * reboot_flag:ÉèÖÃÍê±ÏºóÊÇ·ñÁ¢¼´ÖØÆô 0:²»ÖØÆô,1:ÖØÆô
+ * Êä³ö²ÎÊý:
+ * ϵͳ״̬ÐÅÏ¢
+ * ·µ»ØÖµ£º
+ * Z_FOTA_SUCCESS »ñÈ¡ÐÅÏ¢³É¹¦
+ * Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü
+ * ×¢Òâ:
+ * ·µ»ØÖµ£ºÖ»ÔÚ²»ÐèÒªÖØÆôʱÓÐЧ
+********************************************************************************/
+int zxic_dual_set_boot_to_system(int system, int reboot_flag);
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_get_system_status
+ * ¹¦ÄÜÃèÊö:²éѯABϵͳ״̬
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
+ * Êä³ö²ÎÊý:
+ * system_info ϵͳ״̬ÐÅÏ¢
+ * ·µ»ØÖµ£º
+ * Z_FOTA_SUCCESS »ñÈ¡ÐÅÏ¢³É¹¦
+ * Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü
+ * ×¢Òâ:
+********************************************************************************/
+int zxic_dual_get_system_status(z_upgrade_system_info_t *system_info);
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_set_system_status
+ * ¹¦ÄÜÃèÊö:ÉèÖÃϵͳ״̬
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£º
+ * system:´ýÉèÖÃϵͳ
+ * status:ÉèÖÃϵͳ״̬
+ * Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * Z_FOTA_SUCCESS »ñÈ¡ÐÅÏ¢³É¹¦
+ * Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü
+ * ×¢Òâ:
+********************************************************************************/
+int zxic_dual_set_system_status(int system, int status);
+
+/*******************************************************************************
+ * Inline function implementations *
+ ******************************************************************************/
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_init_flag_partition
+ * ¹¦ÄÜÃèÊö:³õʼ»¯flag·ÖÇøÐÅÏ¢,²âÊÔ½Ó¿Ú£¬Õý³£Á÷³Ì²»¿ÉʹÓÃ
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý:ÎÞ
+ * Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * Z_FOTA_SUCCESS »ñÈ¡ÐÅÏ¢³É¹¦
+ * Z_FOTA_FAIL»ñÈ¡ÐÅϢʧ°Ü
+ * ×¢Òâ:
+********************************************************************************/
+
+int zxic_init_flag_partition();
+
+
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_get_fota_status_for_nv
+ * ¹¦ÄÜÃèÊö:»ñȡϵͳNVÊÇ·ñͬ²½±êÖ¾
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
+ * Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * ״̬±êÖ¾ 0£º²»ÐèҪͬ²½£¬1£ºÐèҪͬ²½
+ * ×¢Òâ:
+********************************************************************************/
+int zxic_dual_get_fota_status_for_nv();
+int dual_AB_get_fota_status_for_nv();
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_set_fota_status_for_nv
+ * ¹¦ÄÜÃèÊö:ÉèÖÃϵͳNVÊÇ·ñͬ²½±êÖ¾
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£º
+ * status:״̬±êÖ¾£¬0£º²»ÐèҪͬ²½£¬1£ºÐèҪͬ²½
+ * Êä³ö²ÎÊý:ÎÞ
+ * ·µ»ØÖµ£º
+ * Z_FOTA_SUCCESS ÉèÖóɹ¦
+ * Z_FOTA_FAIL ÉèÖÃʧ°Ü
+ * ×¢Òâ:
+********************************************************************************/
+int zxic_dual_set_fota_status_for_nv(int status);
+int dual_AB_set_fota_status_for_nv(int status);
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_sync_system
+ * ¹¦ÄÜÃèÊö: AB-AAϵͳͬ²½
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
+ * Êä³ö²ÎÊý: ÎÞ
+ * ·µ»ØÖµ£º
+ * Z_FOTA_SUCCESS ͬ²½³É¹¦
+ * Z_FOTA_FAIL ͬ²½Ê§°Ü
+ * ×¢Òâ:
+ ********************************************************************************/
+int zxic_dual_sync_system(void);
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_get_upgrade_type
+ * ¹¦ÄÜÃèÊö: »ñÈ¡Éý¼¶ÀàÐÍ
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
+ * Êä³ö²ÎÊý: ÎÞ
+ * ·µ»ØÖµ£º
+ * Z_UPGRADE_TYPE_ALL È«°æ±¾ÀàÐÍ
+ * Z_UPGRADE_TYPE_PLATFORM ƽ̨ÀàÐÍ
+ * Z_UPGRADE_TYPE_OEM OEMÀàÐÍ
+ * Z_UPGRADE_TYPE_INVALID ÎÞЧÀàÐÍ
+ * ×¢Òâ:
+ ********************************************************************************/
+int zxic_dual_get_upgrade_type(void);
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_get_sync_status
+ * ¹¦ÄÜÃèÊö: »ñȡͬ²½×´Ì¬
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£ºÎÞ
+ * Êä³ö²ÎÊý:
+ * sync_status ͬ²½×´Ì¬
+ * ·µ»ØÖµ£ºÎÞ
+ * ×¢Òâ:
+ ********************************************************************************/
+void zxic_dual_get_sync_status(int *sync_status);
+
+
+/********************************************************************************
+ * º¯ÊýÃû: zxic_dual_set_sync_status
+ * ¹¦ÄÜÃèÊö: ÉèÖÃͬ²½×´Ì¬
+ * ²ÎÊý˵Ã÷£º
+ * ÊäÈë²ÎÊý£º
+ * sync_status ͬ²½×´Ì¬
+ * Êä³ö²ÎÊý: ÎÞ
+ * ·µ»ØÖµ£º
+ * Z_FOTA_SUCCESS ÉèÖóɹ¦
+ * Z_FOTA_FAIL ÉèÖÃʧ°Ü
+ * ×¢Òâ:
+ ********************************************************************************/
+int zxic_dual_set_sync_status(int sync_status);
+
+
+
+#endif // ZXIC_FOTA_AB_UPGRADE_H
+
diff --git a/ap/lib/libupi_ab/inc/zxic_update.h b/ap/lib/libupi_ab/inc/zxic_update.h
new file mode 100755
index 0000000..7eddb29
--- /dev/null
+++ b/ap/lib/libupi_ab/inc/zxic_update.h
@@ -0,0 +1,17 @@
+#ifndef ZXIC_UPDATE_H
+#define ZXIC_UPDATE_H
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/reboot.h>
+
+
+
+
+
+
+#endif /*ZXIC_UPDATE_H*/