blob: 4a8088e9001eb6a48a0e5c0c1462a2e62fe207f5 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*******************************************************************************
2 * Copyright (C) 2016, ZXIC Corporation.
3 *
4 * File Name:
5 * File Mark:
6 * Description:
7 * Others:
8 * Version: v1.0
9 * Author: zhouqi
10 * Date: 2013-8-21
11 * History 1:
12 * Date:
13 * Version:
14 * Author:
15 * Modification:
16 * History 2:
17 ********************************************************************************/
18
19#ifndef _FLASH_H_
20#define _FLASH_H_
21
22#include <linux/types.h>
xf.li7ccf8372024-03-07 00:08:02 -080023#include "pub_flags.h"
lh9ed821d2023-04-07 01:36:19 -070024
25#define NOR_BOOT 0x0
26#define NAND_BOOT 0x1
27#define SPI_NAND_BOOT 0x2
28#define OTHER_BOOT 0xff
29
30struct flash_type{
31 uint8_t flash_type;
32 uint8_t manuf_id;
33 uint8_t device_id;
34 uint16_t page_size;
35 uint16_t page_size_shift;
36 uint16_t oob_size;
37 uint16_t block_size_shift;
38 uint16_t block_num;
39 uint32_t block_size;
40 int32_t (*read_page_raw)(uint32_t buf, uint32_t offset);
41 int32_t (*read)(uint32_t from, uint32_t len, uint32_t to);
42 void (*read_oob)(uint8_t *buf, uint32_t offset, uint32_t len);
43};
44
xf.li7ccf8372024-03-07 00:08:02 -080045typedef struct
46{
47 unsigned int magic_start; /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
48
49 T_BOOT_FOTA_FLAG boot_fota_flag;
50 T_BOOT_ENV boot_env;
51 T_UBIFS_STATUS ubifs_status;
52 unsigned int nvro_flag;
53 unsigned int crc32;
54 T_BOOT_TARGET ota_system; /* Éý¼¶Ê±ÊÇϵͳA»¹ÊÇϵͳB */
55 T_AA_PARTITION_INFO ota_partiton_info[OTA_PARTITION_NUM_MAX]; /* ÈÝÄÉ×î¶à15¸öÉý¼¶·ÖÇøµÄimage¾µÏñ´óС */
56 char reserve[52];
57 unsigned int magic_end; /* Êý¾ÝÓÐЧÐÔħÊõ×Ö */
58} T_FLAGS;
lh9ed821d2023-04-07 01:36:19 -070059
60extern struct flash_type flash;
61
62char get_boot_mode(void);
63int board_flash_init(void);
64
65
66#endif/*_FLASH_H_*/
67
68