• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 #ifndef __STACK_H__
20 #define __STACK_H__
21 
22 #ifdef __cplusplus
23 #if __cplusplus
24 extern "C" {
25 #endif
26 #endif
27 
28 /* ****************************************************************************
29   1 Other Header File Including
30 **************************************************************************** */
31 /* ****************************************************************************
32   2 Macro Definition
33 **************************************************************************** */
34 #define VECTOR_NUMBER           48
35 /* ROM for code 16k */
36 #define ROM_BASEADDR            0x00000000
37 #define ROM_LEN                 0x00059000      /* 1131C-debug */
38 #define ROM_MPU_LEN             0x00080000      /* ROM_LEN向上取2的整数次方倍) */
39 
40 #define PATCH_TAB_BASEADDR      0x00100000      /* RAMx2 0/1 belong to CPU_RAM */
41 
42 #define PATCH_FP_MAX_NUM        256
43 #define PATCH_FP_REG_SIZE       4
44 #define PATCH_HEAD_SIZE         (PATCH_FP_MAX_NUM * PATCH_FP_REG_SIZE * 2)
45 
46 #define PATCH_BASEADDR          RAM_BASEADDR
47 
48 #define RAM_VECTOR_LEN          (VECTOR_NUMBER * 4)
49 
50 /* the following region will not be downloaded from host */
51 #define RAM_NODL_DATA_LEN       0x3000
52 
53 /* stack for normal */
54 #define USER_STACK_BASEADDR     (RAM_BASEADDR + RAM_LEN - RAM_NODL_DATA_LEN)
55 #define USER_STACK_LEN          0x1800
56 
57 #define RAM_NODL_DATA_BASEADDR  USER_STACK_BASEADDR
58 #define RAM_VECTOR_BASEADDR     RAM_NODL_DATA_BASEADDR
59 
60 #define PKT_H_RAM_BASEADDR      0x30400000
61 #define PKT_H_RAM_LEN           0x00006000
62 
63 #define PKT_B_RAM_BASEADDR      0x40100000
64 
65 #define PSM_SAVE_BASEADDR       0x4011C000
66 #define PSM_SAVE_PHY_OFFSET     0x400
67 
68 /* PKT A 规格和地址空间需要再规划 */
69 #ifdef SW_DEBUG
70 #define OML_DATA_BUFF_LEN       0x00000C00         /* 3k */
71 #else
72 #define OML_DATA_BUFF_LEN       4
73 #endif
74 #define OML_DATA_BUFF_ADDR      (PKT_B_RAM_BASEADDR + PKT_B_RAM_LEN - OML_DATA_BUFF_LEN)
75 
76 /* 总线生成时,一个slave口的基地址应该是0x3000_0000,
77    但实际错误的配置为了0x0300_0000,需由MPU保护0x2000_0000~0x2FFF_FFFF 地址被改写 */
78 #define ROM_PROTECT_BASEADDR    0x20000000
79 #define ROM_PROTECT_LEN         0x10000000
80 
81 /* 以下为需要MPU保护的RAM空间,如果不保护这部分空间,发生写操作后会修改正常空间的内容 */
82 #define ROM_PROTECT_BASEADDR_1  0x200000
83 #define ROM_PROTECT_LEN_1       0x200000
84 
85 #define ROM_PROTECT_BASEADDR_2  0x30200000
86 #define ROM_PROTECT_LEN_2       0x100000
87 
88 #define ROM_PROTECT_BASEADDR_3  0x30500000
89 #define ROM_PROTECT_LEN_3       0x100000
90 
91 #define ROM_PROTECT_BASEADDR_4  0x30600000
92 #define ROM_PROTECT_LEN_4       0x100000
93 
94 /* ****************************************************************************
95   3 Enum Type Definition
96 **************************************************************************** */
97 /* ****************************************************************************
98   4 Global Variable Declaring
99 **************************************************************************** */
100 /* ****************************************************************************
101   5 Message Header Definition
102 **************************************************************************** */
103 /* ****************************************************************************
104   6 Message Definition
105 **************************************************************************** */
106 /* ****************************************************************************
107   7 STRUCT Type Definition
108 **************************************************************************** */
109 /* ****************************************************************************
110   8 UNION Type Definition
111 **************************************************************************** */
112 /* ****************************************************************************
113   9 OTHERS Definition
114 **************************************************************************** */
115 /* ****************************************************************************
116   10 Function Declare
117 **************************************************************************** */
118 #ifdef __cplusplus
119 #if __cplusplus
120 }
121 #endif
122 #endif
123 
124 #endif /* end of stack_r4.h */
125