1
1
#ifndef __GENERATED_CSR_H
2
2
#define __GENERATED_CSR_H
3
- #include " hw/common.h"
3
+ #include < hw/common.h>
4
4
5
- /* dna */
6
- #define CSR_DNA_BASE 0xe0006000
7
- #define CSR_DNA_ID_ADDR 0xe0006000
8
- #define CSR_DNA_ID_SIZE 8
9
- static inline unsigned long long int dna_id_read (void ) {
5
+ /* info */
6
+ #define CSR_INFO_BASE 0xe0006000
7
+ #define CSR_INFO_DNA_ID_ADDR 0xe0006000
8
+ #define CSR_INFO_DNA_ID_SIZE 8
9
+ static inline unsigned long long int info_dna_id_read (void ) {
10
10
unsigned long long int r = MMPTR (0xe0006000 );
11
11
r <<= 8 ;
12
12
r |= MMPTR (0xe0006004 );
@@ -24,6 +24,48 @@ static inline unsigned long long int dna_id_read(void) {
24
24
r |= MMPTR (0xe000601c );
25
25
return r ;
26
26
}
27
+ #define CSR_INFO_GIT_COMMIT_ADDR 0xe0006020
28
+ #define CSR_INFO_GIT_COMMIT_SIZE 20
29
+ #define CSR_INFO_PLATFORM_PLATFORM_ADDR 0xe0006070
30
+ #define CSR_INFO_PLATFORM_PLATFORM_SIZE 8
31
+ static inline unsigned long long int info_platform_platform_read (void ) {
32
+ unsigned long long int r = MMPTR (0xe0006070 );
33
+ r <<= 8 ;
34
+ r |= MMPTR (0xe0006074 );
35
+ r <<= 8 ;
36
+ r |= MMPTR (0xe0006078 );
37
+ r <<= 8 ;
38
+ r |= MMPTR (0xe000607c );
39
+ r <<= 8 ;
40
+ r |= MMPTR (0xe0006080 );
41
+ r <<= 8 ;
42
+ r |= MMPTR (0xe0006084 );
43
+ r <<= 8 ;
44
+ r |= MMPTR (0xe0006088 );
45
+ r <<= 8 ;
46
+ r |= MMPTR (0xe000608c );
47
+ return r ;
48
+ }
49
+ #define CSR_INFO_PLATFORM_TARGET_ADDR 0xe0006090
50
+ #define CSR_INFO_PLATFORM_TARGET_SIZE 8
51
+ static inline unsigned long long int info_platform_target_read (void ) {
52
+ unsigned long long int r = MMPTR (0xe0006090 );
53
+ r <<= 8 ;
54
+ r |= MMPTR (0xe0006094 );
55
+ r <<= 8 ;
56
+ r |= MMPTR (0xe0006098 );
57
+ r <<= 8 ;
58
+ r |= MMPTR (0xe000609c );
59
+ r <<= 8 ;
60
+ r |= MMPTR (0xe00060a0 );
61
+ r <<= 8 ;
62
+ r |= MMPTR (0xe00060a4 );
63
+ r <<= 8 ;
64
+ r |= MMPTR (0xe00060a8 );
65
+ r <<= 8 ;
66
+ r |= MMPTR (0xe00060ac );
67
+ return r ;
68
+ }
27
69
28
70
/* sdram */
29
71
#define CSR_SDRAM_BASE 0xe0004000
@@ -76,51 +118,138 @@ static inline void sdram_dfii_pi0_baddress_write(unsigned char value) {
76
118
MMPTR (0xe0004014 ) = value ;
77
119
}
78
120
#define CSR_SDRAM_DFII_PI0_WRDATA_ADDR 0xe0004018
79
- #define CSR_SDRAM_DFII_PI0_WRDATA_SIZE 2
80
- static inline unsigned short int sdram_dfii_pi0_wrdata_read (void ) {
81
- unsigned short int r = MMPTR (0xe0004018 );
121
+ #define CSR_SDRAM_DFII_PI0_WRDATA_SIZE 4
122
+ static inline unsigned int sdram_dfii_pi0_wrdata_read (void ) {
123
+ unsigned int r = MMPTR (0xe0004018 );
82
124
r <<= 8 ;
83
125
r |= MMPTR (0xe000401c );
126
+ r <<= 8 ;
127
+ r |= MMPTR (0xe0004020 );
128
+ r <<= 8 ;
129
+ r |= MMPTR (0xe0004024 );
84
130
return r ;
85
131
}
86
- static inline void sdram_dfii_pi0_wrdata_write (unsigned short int value ) {
87
- MMPTR (0xe0004018 ) = value >> 8 ;
88
- MMPTR (0xe000401c ) = value ;
132
+ static inline void sdram_dfii_pi0_wrdata_write (unsigned int value ) {
133
+ MMPTR (0xe0004018 ) = value >> 24 ;
134
+ MMPTR (0xe000401c ) = value >> 16 ;
135
+ MMPTR (0xe0004020 ) = value >> 8 ;
136
+ MMPTR (0xe0004024 ) = value ;
89
137
}
90
- #define CSR_SDRAM_DFII_PI0_RDDATA_ADDR 0xe0004020
91
- #define CSR_SDRAM_DFII_PI0_RDDATA_SIZE 2
92
- static inline unsigned short int sdram_dfii_pi0_rddata_read (void ) {
93
- unsigned short int r = MMPTR (0xe0004020 );
138
+ #define CSR_SDRAM_DFII_PI0_RDDATA_ADDR 0xe0004028
139
+ #define CSR_SDRAM_DFII_PI0_RDDATA_SIZE 4
140
+ static inline unsigned int sdram_dfii_pi0_rddata_read (void ) {
141
+ unsigned int r = MMPTR (0xe0004028 );
94
142
r <<= 8 ;
95
- r |= MMPTR (0xe0004024 );
143
+ r |= MMPTR (0xe000402c );
144
+ r <<= 8 ;
145
+ r |= MMPTR (0xe0004030 );
146
+ r <<= 8 ;
147
+ r |= MMPTR (0xe0004034 );
96
148
return r ;
97
149
}
98
-
99
- /* spiflash */
100
- #define CSR_SPIFLASH_BASE 0xe0005000
101
- #define CSR_SPIFLASH_BITBANG_ADDR 0xe0005000
102
- #define CSR_SPIFLASH_BITBANG_SIZE 1
103
- static inline unsigned char spiflash_bitbang_read (void ) {
104
- unsigned char r = MMPTR (0xe0005000 );
150
+ #define CSR_SDRAM_DFII_PI1_COMMAND_ADDR 0xe0004038
151
+ #define CSR_SDRAM_DFII_PI1_COMMAND_SIZE 1
152
+ static inline unsigned char sdram_dfii_pi1_command_read (void ) {
153
+ unsigned char r = MMPTR (0xe0004038 );
154
+ return r ;
155
+ }
156
+ static inline void sdram_dfii_pi1_command_write (unsigned char value ) {
157
+ MMPTR (0xe0004038 ) = value ;
158
+ }
159
+ #define CSR_SDRAM_DFII_PI1_COMMAND_ISSUE_ADDR 0xe000403c
160
+ #define CSR_SDRAM_DFII_PI1_COMMAND_ISSUE_SIZE 1
161
+ static inline unsigned char sdram_dfii_pi1_command_issue_read (void ) {
162
+ unsigned char r = MMPTR (0xe000403c );
163
+ return r ;
164
+ }
165
+ static inline void sdram_dfii_pi1_command_issue_write (unsigned char value ) {
166
+ MMPTR (0xe000403c ) = value ;
167
+ }
168
+ #define CSR_SDRAM_DFII_PI1_ADDRESS_ADDR 0xe0004040
169
+ #define CSR_SDRAM_DFII_PI1_ADDRESS_SIZE 2
170
+ static inline unsigned short int sdram_dfii_pi1_address_read (void ) {
171
+ unsigned short int r = MMPTR (0xe0004040 );
172
+ r <<= 8 ;
173
+ r |= MMPTR (0xe0004044 );
105
174
return r ;
106
175
}
107
- static inline void spiflash_bitbang_write (unsigned char value ) {
108
- MMPTR (0xe0005000 ) = value ;
176
+ static inline void sdram_dfii_pi1_address_write (unsigned short int value ) {
177
+ MMPTR (0xe0004040 ) = value >> 8 ;
178
+ MMPTR (0xe0004044 ) = value ;
109
179
}
110
- #define CSR_SPIFLASH_MISO_ADDR 0xe0005004
111
- #define CSR_SPIFLASH_MISO_SIZE 1
112
- static inline unsigned char spiflash_miso_read (void ) {
113
- unsigned char r = MMPTR (0xe0005004 );
180
+ #define CSR_SDRAM_DFII_PI1_BADDRESS_ADDR 0xe0004048
181
+ #define CSR_SDRAM_DFII_PI1_BADDRESS_SIZE 1
182
+ static inline unsigned char sdram_dfii_pi1_baddress_read (void ) {
183
+ unsigned char r = MMPTR (0xe0004048 );
114
184
return r ;
115
185
}
116
- #define CSR_SPIFLASH_BITBANG_EN_ADDR 0xe0005008
117
- #define CSR_SPIFLASH_BITBANG_EN_SIZE 1
118
- static inline unsigned char spiflash_bitbang_en_read (void ) {
119
- unsigned char r = MMPTR (0xe0005008 );
186
+ static inline void sdram_dfii_pi1_baddress_write (unsigned char value ) {
187
+ MMPTR (0xe0004048 ) = value ;
188
+ }
189
+ #define CSR_SDRAM_DFII_PI1_WRDATA_ADDR 0xe000404c
190
+ #define CSR_SDRAM_DFII_PI1_WRDATA_SIZE 4
191
+ static inline unsigned int sdram_dfii_pi1_wrdata_read (void ) {
192
+ unsigned int r = MMPTR (0xe000404c );
193
+ r <<= 8 ;
194
+ r |= MMPTR (0xe0004050 );
195
+ r <<= 8 ;
196
+ r |= MMPTR (0xe0004054 );
197
+ r <<= 8 ;
198
+ r |= MMPTR (0xe0004058 );
199
+ return r ;
200
+ }
201
+ static inline void sdram_dfii_pi1_wrdata_write (unsigned int value ) {
202
+ MMPTR (0xe000404c ) = value >> 24 ;
203
+ MMPTR (0xe0004050 ) = value >> 16 ;
204
+ MMPTR (0xe0004054 ) = value >> 8 ;
205
+ MMPTR (0xe0004058 ) = value ;
206
+ }
207
+ #define CSR_SDRAM_DFII_PI1_RDDATA_ADDR 0xe000405c
208
+ #define CSR_SDRAM_DFII_PI1_RDDATA_SIZE 4
209
+ static inline unsigned int sdram_dfii_pi1_rddata_read (void ) {
210
+ unsigned int r = MMPTR (0xe000405c );
211
+ r <<= 8 ;
212
+ r |= MMPTR (0xe0004060 );
213
+ r <<= 8 ;
214
+ r |= MMPTR (0xe0004064 );
215
+ r <<= 8 ;
216
+ r |= MMPTR (0xe0004068 );
217
+ return r ;
218
+ }
219
+ #define CSR_SDRAM_CONTROLLER_BANDWIDTH_UPDATE_ADDR 0xe000406c
220
+ #define CSR_SDRAM_CONTROLLER_BANDWIDTH_UPDATE_SIZE 1
221
+ static inline unsigned char sdram_controller_bandwidth_update_read (void ) {
222
+ unsigned char r = MMPTR (0xe000406c );
223
+ return r ;
224
+ }
225
+ static inline void sdram_controller_bandwidth_update_write (unsigned char value ) {
226
+ MMPTR (0xe000406c ) = value ;
227
+ }
228
+ #define CSR_SDRAM_CONTROLLER_BANDWIDTH_NREADS_ADDR 0xe0004070
229
+ #define CSR_SDRAM_CONTROLLER_BANDWIDTH_NREADS_SIZE 3
230
+ static inline unsigned int sdram_controller_bandwidth_nreads_read (void ) {
231
+ unsigned int r = MMPTR (0xe0004070 );
232
+ r <<= 8 ;
233
+ r |= MMPTR (0xe0004074 );
234
+ r <<= 8 ;
235
+ r |= MMPTR (0xe0004078 );
236
+ return r ;
237
+ }
238
+ #define CSR_SDRAM_CONTROLLER_BANDWIDTH_NWRITES_ADDR 0xe000407c
239
+ #define CSR_SDRAM_CONTROLLER_BANDWIDTH_NWRITES_SIZE 3
240
+ static inline unsigned int sdram_controller_bandwidth_nwrites_read (void ) {
241
+ unsigned int r = MMPTR (0xe000407c );
242
+ r <<= 8 ;
243
+ r |= MMPTR (0xe0004080 );
244
+ r <<= 8 ;
245
+ r |= MMPTR (0xe0004084 );
120
246
return r ;
121
247
}
122
- static inline void spiflash_bitbang_en_write (unsigned char value ) {
123
- MMPTR (0xe0005008 ) = value ;
248
+ #define CSR_SDRAM_CONTROLLER_BANDWIDTH_DATA_WIDTH_ADDR 0xe0004088
249
+ #define CSR_SDRAM_CONTROLLER_BANDWIDTH_DATA_WIDTH_SIZE 1
250
+ static inline unsigned char sdram_controller_bandwidth_data_width_read (void ) {
251
+ unsigned char r = MMPTR (0xe0004088 );
252
+ return r ;
124
253
}
125
254
126
255
/* timer0 */
@@ -293,10 +422,44 @@ static inline void uart_phy_tuning_word_write(unsigned int value) {
293
422
294
423
/* constants */
295
424
#define UART_INTERRUPT 0
425
+ static inline int uart_interrupt_read (void ) {
426
+ return 0 ;
427
+ }
296
428
#define TIMER0_INTERRUPT 1
297
- #define SYSTEM_CLOCK_FREQUENCY 80000000
429
+ static inline int timer0_interrupt_read (void ) {
430
+ return 1 ;
431
+ }
432
+ #define CSR_DATA_WIDTH 8
433
+ static inline int csr_data_width_read (void ) {
434
+ return 8 ;
435
+ }
436
+ #define SYSTEM_CLOCK_FREQUENCY 83333333
437
+ static inline int system_clock_frequency_read (void ) {
438
+ return 83333333 ;
439
+ }
298
440
#define SPIFLASH_PAGE_SIZE 256
441
+ static inline int spiflash_page_size_read (void ) {
442
+ return 256 ;
443
+ }
299
444
#define SPIFLASH_SECTOR_SIZE 65536
445
+ static inline int spiflash_sector_size_read (void ) {
446
+ return 65536 ;
447
+ }
300
448
#define L2_SIZE 8192
449
+ static inline int l2_size_read (void ) {
450
+ return 8192 ;
451
+ }
452
+ #define CONFIG_CLOCK_FREQUENCY 83333333
453
+ static inline int config_clock_frequency_read (void ) {
454
+ return 83333333 ;
455
+ }
456
+ #define CONFIG_CPU_TYPE "LM32"
457
+ static inline const char * config_cpu_type_read (void ) {
458
+ return "LM32" ;
459
+ }
460
+ #define CONFIG_CSR_DATA_WIDTH 8
461
+ static inline int config_csr_data_width_read (void ) {
462
+ return 8 ;
463
+ }
301
464
302
465
#endif
0 commit comments