• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __FT_NV_H__
17 #define __FT_NV_H__
18 #include <hi_types.h>
19 
20 /******************************************************************************
21  NV ID[0xF00, 0xFFF]
22  *****************************************************************************/
23 #define HI_NV_FTM_FLASH_PARTIRION_TABLE_ID   0x02
24 #define HI_FTM_PRODUCT_ID_RANGE_MRS          500
25 
26 #define HI_NV_FTM_STARTUP_CFG_ID   0x3 /* hi_nv_ftm_startup_cfg */
27 #define HI_NV_FTM_FACTORY_MODE     0x9 /* hi_nv_ftm_factory_mode */
28 #define HI_NV_FTM_UPG_WAIT_MODE    0xA /* hi_nv_ftm_upg_wait_mode */
29 
30 typedef struct {
31     uintptr_t addr_start; /* boot start address */
32     hi_u16 mode;          /* upgrade mode */
33     hi_u8 file_type;      /* file type:boot or code+nv */
34     hi_u8 refresh_nv;     /* refresh nv when the flag bit 0x55 is read */
35     hi_u8 reset_cnt;      /* number of restarts in upgrade mode */
36     hi_u8 cnt_max;        /* the maximum number of restarts (default value : 3) */
37     hi_u16 reserved1;
38     uintptr_t addr_write; /* write kernel upgrade file address */
39     hi_u32 reserved2;     /* reserved */
40 } hi_nv_ftm_startup_cfg;
41 
42 typedef struct {
43     hi_u32 factory_mode;          /* 0:normal_mode;1:factory_mode */
44     uintptr_t factory_addr_start; /* factory bin start address */
45     hi_u32 factory_size;          /* factory bin size */
46     hi_u32 factory_valid;         /* 0:invalid;1:valid */
47 } hi_nv_ftm_factory_mode;
48 
49 typedef struct {
50     hi_u32 file_addr;
51     hi_u8 file_type;
52     hi_u8 boot_version;
53     hi_u8 is_upg_process;
54     hi_u8 trans_finish_flag;
55 } hi_nv_ftm_upg_wait_mode;
56 
57 #endif  /* __FT_NV_H__ */
58 
59