[Feature][ZXW-88]merge P50 version

Only Configure: No
Affected branch: master
Affected module: unknown
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I34667719d9e0e7e29e8e4368848601cde0a48408
diff --git a/pub/include/infra/pub_debug_info.h b/pub/include/infra/pub_debug_info.h
index 53b1fad..93b5a80 100755
--- a/pub/include/infra/pub_debug_info.h
+++ b/pub/include/infra/pub_debug_info.h
@@ -6,52 +6,53 @@
 #define DEBUG_INFO_DEV_PATH "/dev/debug_info"
 
 /* AP²àºÍCAP²àµÄPS\KERNEL\DRIVER\FS\APP  ÒÔSTART~ENDÎªÇø¼ä£¬¸÷²¿·ÖÔ¤ÁôÁË100¸öID */
-#define MODULE_ID_PS_START           (1)
-#define MODULE_ID_PS_NAS             (1)
-#define MODULE_ID_PS_RRC             (2)
-#define MODULE_ID_PS_L2              (3)
-#define MODULE_ID_PS_UICC            (99)
-#define MODULE_ID_PS_END             (100)
+#define MODULE_ID_PS_START			(1)
+#define MODULE_ID_PS_NAS			(1)
+#define MODULE_ID_PS_RRC			(2)
+#define MODULE_ID_PS_L2				(3)
+#define MODULE_ID_PS_UICC			(99)
+#define MODULE_ID_PS_END			(100)
 
-#define MODULE_ID_AP_KERNEL_START    (101)
-#define MODULE_ID_AP_KERNEL_END      (200)
+#define MODULE_ID_AP_KERNEL_START	(101)
+#define MODULE_ID_AP_KERNEL_END		(200)
 
-#define MODULE_ID_CAP_KERNEL_START   (201)
-#define MODULE_ID_CAP_KERNEL_END     (300)
+#define MODULE_ID_CAP_KERNEL_START	(201)
+#define MODULE_ID_CAP_KERNEL_END	(300)
 
-#define MODULE_ID_AP_DRIVES_START    (301)
-#define MODULE_ID_AP_USB		(301)
-#define MODULE_ID_AP_REBOOT	(302)
-#define MODULE_ID_AP_TSC		(303)
-#define MODULE_ID_AP_PSM		(304)
-#define MODULE_ID_AP_NAND		(305)
+#define MODULE_ID_AP_DRIVES_START	(301)
+#define MODULE_ID_AP_USB			(301)
+#define MODULE_ID_AP_REBOOT			(302)
+#define MODULE_ID_AP_TSC			(303)
+#define MODULE_ID_AP_PSM			(304)
+#define MODULE_ID_AP_NAND			(305)
+#define MODULE_ID_AP_MMC			(306)
+#define MODULE_ID_AP_DRIVES_END		(400)
 
-#define MODULE_ID_AP_DRIVES_END      (400)
+#define MODULE_ID_CAP_DRIVES_START	(401)
+#define MODULE_ID_CAP_USB			(401)
+#define MODULE_ID_CAP_TSC			(402)
+#define MODULE_ID_CAP_PSM			(403)
+#define MODULE_ID_CAP_NAND			(404)
+#define MODULE_ID_CAP_SPI			(405)
+#define MODULE_ID_CAP_MMC			(406)
+#define MODULE_ID_CAP_DRIVES_END	(500)
 
-#define MODULE_ID_CAP_DRIVES_START   (401)
-#define MODULE_ID_CAP_USB            (401)
-#define MODULE_ID_CAP_TSC		(402)
-#define MODULE_ID_CAP_PSM		(403)
-#define MODULE_ID_CAP_NAND		(404)
-#define MODULE_ID_CAP_SPI			 (405)
-#define MODULE_ID_CAP_DRIVES_END     (500)
+#define MODULE_ID_AP_FS_START		(501)
+#define MODULE_ID_AP_JFFS2			(501)
+#define MODULE_ID_AP_FS_END			(600)
 
-#define MODULE_ID_AP_FS_START        (501)
-#define MODULE_ID_AP_JFFS2           (501)
-#define MODULE_ID_AP_FS_END          (600)
+#define MODULE_ID_CAP_FS_START		(601)
+#define MODULE_ID_CAP_FS_END		(700)
 
-#define MODULE_ID_CAP_FS_START       (601)
-#define MODULE_ID_CAP_FS_END         (700)
+#define MODULE_ID_AP_APP_START		(701)
+#define MODULE_ID_AP_FOTA			(701)
+#define MODULE_ID_AP_FS_CHECK		(702)
+#define MODULE_ID_AP_APP_END		(800)
 
-#define MODULE_ID_AP_APP_START       (701)
-#define MODULE_ID_AP_FOTA            (701)
-#define MODULE_ID_AP_FS_CHECK        (702)
-#define MODULE_ID_AP_APP_END         (800)
-
-#define MODULE_ID_CAP_APP_START      (801)
-#define MODULE_ID_CAP_FOTA           (801)
-#define MODULE_ID_CAP_FS_CHECK       (802)
-#define MODULE_ID_CAP_APP_END        (900)
+#define MODULE_ID_CAP_APP_START		(801)
+#define MODULE_ID_CAP_FOTA			(801)
+#define MODULE_ID_CAP_FS_CHECK		(802)
+#define MODULE_ID_CAP_APP_END		(900)
 
 #if defined(_USE_ZXIC_DEBUG_INFO) && !defined(CONFIG_SYSTEM_RECOVERY)
 int sc_debug_info_vrecord(unsigned int id, const char *format, va_list args);
diff --git a/pub/include/infra/pub_flags.h b/pub/include/infra/pub_flags.h
new file mode 100755
index 0000000..07fd7d0
--- /dev/null
+++ b/pub/include/infra/pub_flags.h
@@ -0,0 +1,98 @@
+/**
+ * @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
+