blob: 5ec8b26dc6329ef02134947000527f13feb07122 [file] [log] [blame]
xf.li6c8fc1e2023-08-12 00:11:09 -07001/**
2 * @file pub_flags.h
3 * @brief flags·ÖÇø×Ö¶Î
4 *
5 * Copyright (C) 2023 Sanechips Technology Co., Ltd.
6 * @author
7 * @ingroup
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. £¨±ØÑ¡£ºGPLv2 Licence£©
12 *
13 */
14
15
16#ifndef _PUB_FLAGS_H
17#define _PUB_FLAGS_H
18
19
20/*******************************************************************************
21 * Include header files *
22 ******************************************************************************/
23
24
25/*******************************************************************************
26 * Macro definitions *
27 ******************************************************************************/
28/**
29 * @brief ÔÚflags·ÖÇøÀïÆ«ÒÆµØÖ·
30 */
31#define FLAGS_MAGIC (0x464C4147UL)
32
33#define DUALSYSTEM_STATUS_BOOTABLE (0xB0AB) /* ¿ÉÆô¶¯ */
34#define DUALSYSTEM_STATUS_SUCCESSFUL (0x5CCF) /* Äܳɹ¦Æô¶¯ */
35#define DUALSYSTEM_STATUS_UNBOOTABLE (0xBABE) /* ²»¿ÉÆô¶¯ */
36
xf.lice873192023-11-08 17:10:35 -080037#define OTA_PARTITION_NUM_MAX 15
38
xf.li6c8fc1e2023-08-12 00:11:09 -070039
40/*******************************************************************************
41 * Type definitions *
42 ******************************************************************************/
43typedef struct
44{
45 int status; /* bootable/successful/unbootable */
46 int try_cnt;
47} T_DualSystem_Status;
48
49typedef enum
50{
51 DUAL_SYSTEM = 0x875A, /* µÚÒ»¸öϵͳ */
52 DUAL_SYSTEM2 = 0x986B, /* µÚ¶þ¸öϵͳ */
53} T_BOOT_TARGET;
54
xf.liaa4d92f2023-09-13 00:18:58 -070055#define NVRO_INIT (0) /* initial state */
56#define NVRO_BACKED_UP (0xBACE) /* nvro backed up already */
xf.lie31de8b2023-12-26 23:38:58 -080057#define NVRO_BACKING_UP (0xBAC1) /* nvro back up next boot */
xf.liaa4d92f2023-09-13 00:18:58 -070058#define NVRO_RESTORING (0x2E20) /* nvro restoring */
59#define NVRO_INVALID (0xDEAD) /* nvro invalid */
60
xf.li6c8fc1e2023-08-12 00:11:09 -070061/* ˫ϵͳÀàÐÍ */
62typedef enum
63{
64 DUALSYSTEM_RECOVERY = 0x7575, /* normal-recovery˫ϵͳ */
65 DUALSYSTEM_AA = 0xAAAA, /* AA˫ϵͳ */
66 DUALSYSTEM_AB = 0xABAB /* AB˫ϵͳ */
67} T_BOOT_DUALSYSTEM_TYPE;
68
69typedef struct
70{
71 T_BOOT_TARGET boot_to; /* µ±Ç°Æô¶¯ÏµÍ³±êÖ¾*/
72 unsigned int fota_status; /* fota״̬ */
73 T_DualSystem_Status system; /* µÚÒ»¸öϵͳ״̬ */
74 T_DualSystem_Status system2; /* µÚ¶þ¸öϵͳ״̬ */
75} T_BOOT_FOTA_FLAG;
76
77typedef struct
78{
79 T_BOOT_DUALSYSTEM_TYPE dualsys_type; /* ˫ϵͳÀàÐÍ */
80 char system_boot_env[128];
81 char system2_boot_env[128];
82} T_BOOT_ENV;
83
84typedef struct
85{
86 int fs_status; /* ÎļþϵͳÒì³£±êʶ */
87 char fs_mtd_name[16];
88 char fs_ubi_vol_name[16];
89} T_UBIFS_STATUS;
90
xf.lice873192023-11-08 17:10:35 -080091typedef struct {
92 int mtdnum;
93 unsigned int len;
94} T_AA_PARTITION_INFO;
95
xf.li6c8fc1e2023-08-12 00:11:09 -070096typedef struct
97{
98 unsigned int magic_start; /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
99
100 T_BOOT_FOTA_FLAG boot_fota_flag;
101 T_BOOT_ENV boot_env;
102 T_UBIFS_STATUS ubifs_status;
xf.liaa4d92f2023-09-13 00:18:58 -0700103 unsigned int nvro_flag;
xf.lice873192023-11-08 17:10:35 -0800104 unsigned int crc32;
105 T_BOOT_TARGET ota_system; /* Éý¼¶Ê±ÊÇϵͳA»¹ÊÇϵͳB */
106 T_AA_PARTITION_INFO ota_partiton_info[OTA_PARTITION_NUM_MAX]; /* ÈÝÄÉ×î¶à15¸öÉý¼¶·ÖÇøµÄimage¾µÏñ´óС */
107 char reserve[52];
xf.li6c8fc1e2023-08-12 00:11:09 -0700108
109 unsigned int magic_end; /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
110} T_FLAGS_INFO;
111
112
113#endif // _PUB_FLAGS_H
114