lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /*******************************************************************************
|
| 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.li | 7ccf837 | 2024-03-07 00:08:02 -0800 | [diff] [blame^] | 23 | #include "pub_flags.h"
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 24 |
|
| 25 | #define NOR_BOOT 0x0
|
| 26 | #define NAND_BOOT 0x1
|
| 27 | #define SPI_NAND_BOOT 0x2
|
| 28 | #define OTHER_BOOT 0xff
|
| 29 |
|
| 30 | struct 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.li | 7ccf837 | 2024-03-07 00:08:02 -0800 | [diff] [blame^] | 45 | typedef 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;
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 59 |
|
| 60 | extern struct flash_type flash;
|
| 61 |
|
| 62 | char get_boot_mode(void);
|
| 63 | int board_flash_init(void);
|
| 64 |
|
| 65 |
|
| 66 | #endif/*_FLASH_H_*/
|
| 67 |
|
| 68 |
|