blob: 07fd7d0f4c091da6ae08284a3e62a074c18e5a23 [file] [log] [blame]
/**
* @file pub_flags.h
* @brief flags·ÖÇø×Ö¶Î
*
* Copyright (C) 2023 Sanechips Technology Co., Ltd.
* @author
* @ingroup
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. £¨±ØÑ¡£ºGPLv2 Licence£©
*
*/
#ifndef _PUB_FLAGS_H
#define _PUB_FLAGS_H
/*******************************************************************************
* Include header files *
******************************************************************************/
/*******************************************************************************
* Macro definitions *
******************************************************************************/
/**
* @brief ÔÚflags·ÖÇøÀïÆ«ÒÆµØÖ·
*/
#define FLAGS_MAGIC (0x464C4147UL)
#define DUALSYSTEM_STATUS_BOOTABLE (0xB0AB) /* ¿ÉÆô¶¯ */
#define DUALSYSTEM_STATUS_SUCCESSFUL (0x5CCF) /* Äܳɹ¦Æô¶¯ */
#define DUALSYSTEM_STATUS_UNBOOTABLE (0xBABE) /* ²»¿ÉÆô¶¯ */
/*******************************************************************************
* Type definitions *
******************************************************************************/
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
{
T_BOOT_TARGET boot_to; /* µ±Ç°Æô¶¯ÏµÍ³±êÖ¾*/
unsigned int fota_status; /* fota״̬ */
T_DualSystem_Status system; /* µÚÒ»¸öϵͳ״̬ */
T_DualSystem_Status system2; /* µÚ¶þ¸öϵͳ״̬ */
} T_BOOT_FOTA_FLAG;
typedef struct
{
T_BOOT_DUALSYSTEM_TYPE dualsys_type; /* ˫ϵͳÀàÐÍ */
char system_boot_env[128];
char system2_boot_env[128];
} T_BOOT_ENV;
typedef struct
{
int fs_status; /* ÎļþϵͳÒì³£±êʶ */
char fs_mtd_name[16];
char fs_ubi_vol_name[16];
} T_UBIFS_STATUS;
typedef struct
{
unsigned int magic_start; /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
T_BOOT_FOTA_FLAG boot_fota_flag;
T_BOOT_ENV boot_env;
T_UBIFS_STATUS ubifs_status;
char reserve[184];
unsigned int magic_end; /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
} T_FLAGS_INFO;
#endif // _PUB_FLAGS_H