blob: 07fd7d0f4c091da6ae08284a3e62a074c18e5a23 [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
37
38/*******************************************************************************
39 * Type definitions *
40 ******************************************************************************/
41typedef struct
42{
43 int status; /* bootable/successful/unbootable */
44 int try_cnt;
45} T_DualSystem_Status;
46
47typedef enum
48{
49 DUAL_SYSTEM = 0x875A, /* µÚÒ»¸öϵͳ */
50 DUAL_SYSTEM2 = 0x986B, /* µÚ¶þ¸öϵͳ */
51} T_BOOT_TARGET;
52
53/* ˫ϵͳÀàÐÍ */
54typedef enum
55{
56 DUALSYSTEM_RECOVERY = 0x7575, /* normal-recovery˫ϵͳ */
57 DUALSYSTEM_AA = 0xAAAA, /* AA˫ϵͳ */
58 DUALSYSTEM_AB = 0xABAB /* AB˫ϵͳ */
59} T_BOOT_DUALSYSTEM_TYPE;
60
61typedef struct
62{
63 T_BOOT_TARGET boot_to; /* µ±Ç°Æô¶¯ÏµÍ³±êÖ¾*/
64 unsigned int fota_status; /* fota״̬ */
65 T_DualSystem_Status system; /* µÚÒ»¸öϵͳ״̬ */
66 T_DualSystem_Status system2; /* µÚ¶þ¸öϵͳ״̬ */
67} T_BOOT_FOTA_FLAG;
68
69typedef struct
70{
71 T_BOOT_DUALSYSTEM_TYPE dualsys_type; /* ˫ϵͳÀàÐÍ */
72 char system_boot_env[128];
73 char system2_boot_env[128];
74} T_BOOT_ENV;
75
76typedef struct
77{
78 int fs_status; /* ÎļþϵͳÒì³£±êʶ */
79 char fs_mtd_name[16];
80 char fs_ubi_vol_name[16];
81} T_UBIFS_STATUS;
82
83typedef struct
84{
85 unsigned int magic_start; /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
86
87 T_BOOT_FOTA_FLAG boot_fota_flag;
88 T_BOOT_ENV boot_env;
89 T_UBIFS_STATUS ubifs_status;
90
91 char reserve[184];
92
93 unsigned int magic_end; /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
94} T_FLAGS_INFO;
95
96
97#endif // _PUB_FLAGS_H
98