OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [oc/] [orp/] [orp_soc/] [sw/] [orp_mon/] [reset-flash.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 748 lampret
#include "spr_defs.h"
2
#include "board.h"
3
#include "mc.h"
4
 
5
        .extern _reset_support
6
        .extern _eth_int
7
        .extern _src_beg
8
        .extern _dst_beg
9
        .extern _dst_end
10
        .extern _c_reset
11
        .extern _int_main
12
 
13
        .global _lolev_ie
14
        .global _lolev_idis
15
 
16
        .section .reset
17
 
18
        .org 0x100
19
_reset:
20
.if MC_ENABLED
21
        l.nop
22
        l.movhi r3,hi(MC_BASE_ADD)
23
        l.ori   r3,r3,MC_BA_MASK
24
        l.addi  r5,r0,0x00
25
        l.sw    0(r3),r5
26
.endif
27
        l.movhi r3,hi(_start)
28
        l.ori   r3,r3,lo(_start)
29
        l.jr    r3
30
        l.nop
31
 
32
        .section .vectors
33
 
34
        l.nop
35
        l.nop
36
        l.j     _int_wrapper
37
        l.nop
38
 
39
        .section .text
40
 
41
_start:
42
.if MC_ENABLED
43
        l.jal   init_mc
44
        l.nop
45
 
46
        /* Wait for SDRAM */
47
        l.addi  r3,r0,0x7fff  /* igor zmanjsal iz 0x7fff na 0x0000 */
48
1:      l.sfeqi r3,0
49
        l.bnf   1b
50
        l.addi  r3,r3,-1
51
.endif
52
        /* Copy form flash to sram */
53
.if 1
54
        l.movhi r3,hi(_src_beg)
55
        l.ori   r3,r3,lo(_src_beg)
56
        l.movhi r4,hi(_vec_start)
57
        l.ori   r4,r4,lo(_vec_start)
58
        l.movhi r5,hi(_vec_end)
59
        l.ori   r5,r5,lo(_vec_end)
60
        l.sub   r5,r5,r4
61
        l.sfeqi r5,0
62
        l.bf    2f
63
        l.nop
64
1:      l.lwz   r6,0(r3)
65
        l.sw    0(r4),r6
66
        l.addi  r3,r3,4
67
        l.addi  r4,r4,4
68
        l.addi  r5,r5,-4
69
        l.sfgtsi r5,0
70
        l.bf    1b
71
        l.nop
72
2:
73
 
74
.if 1
75
        l.movhi r4,hi(_dst_beg)
76
        l.ori   r4,r4,lo(_dst_beg)
77
        l.movhi r5,hi(_dst_end)
78
        l.ori   r5,r5,lo(_dst_end)
79
1:      l.sfgeu r4,r5
80
        l.bf    1f
81
        l.nop
82
        l.lwz   r8,0(r3)
83
        l.sw    0(r4),r8
84
        l.addi  r3,r3,4
85
        l.bnf   1b
86
        l.addi  r4,r4,4
87
1:
88
.endif
89
        l.addi  r3,r0,0
90
        l.addi  r4,r0,0
91
3:
92
.endif
93
 
94
.if IC_ENABLE
95
        /* Flush IC */
96
        l.addi  r10,r0,0
97
        l.addi  r11,r0,8192
98
loop:
99
        l.mtspr r0,r10,SPR_ICBIR
100
        l.sfne  r10,r11
101
        l.bf    loop
102
        l.addi  r10,r10,16
103
 
104
        /* Enable IC */
105
        l.addi  r10,r0,(SPR_SR_ICE|SPR_SR_SM)
106
        l.mtspr r0,r10,SPR_SR
107
        l.nop
108
        l.nop
109
        l.nop
110
        l.nop
111
        l.nop
112
.endif
113
 
114
        l.movhi r1,hi(0x00010000)
115
        l.addi  r1,r1,lo(0x00010000)
116
        l.addi  r1,r1,-4
117
 
118
        l.movhi r2,hi(_main)
119
        l.ori   r2,r2,lo(_main)
120
        l.jr    r2
121
        l.addi  r2,r0,0
122
 
123
init_mc:
124
 
125
        l.movhi r3,hi(MC_BASE_ADD)
126
        l.ori   r3,r3,lo(MC_BASE_ADD)
127
 
128
        l.addi  r4,r3,MC_CSC(0)
129
        l.movhi r5,hi(FLASH_BASE_ADD)
130
        l.srai  r5,r5,5
131
        l.ori   r5,r5,0x0025
132
        l.sw    0(r4),r5
133
 
134
        l.addi  r4,r3,MC_TMS(0)
135
        l.movhi r5,hi(FLASH_TMS_VAL)
136
        l.ori   r5,r5,lo(FLASH_TMS_VAL)
137
        l.sw    0(r4),r5
138
 
139
        l.addi  r4,r3,MC_BA_MASK
140
        l.addi  r5,r0,MC_MASK_VAL
141
        l.sw    0(r4),r5
142
 
143
        l.addi  r4,r3,MC_CSR
144
        l.movhi r5,hi(MC_CSR_VAL)
145
        l.ori   r5,r5,lo(MC_CSR_VAL)
146
        l.sw    0(r4),r5
147
 
148
        l.addi  r4,r3,MC_TMS(1)
149
        l.movhi r5,hi(SDRAM_TMS_VAL)
150
        l.ori   r5,r5,lo(SDRAM_TMS_VAL)
151
        l.sw    0(r4),r5
152
 
153
        l.addi  r4,r3,MC_CSC(1)
154
        l.movhi r5,hi(SDRAM_BASE_ADD)
155
        l.srai  r5,r5,5
156
        l.ori   r5,r5,0x0411
157
        l.sw    0(r4),r5
158
 
159
        l.jr    r9
160
        l.nop
161
 
162
_int_wrapper:
163
        l.addi  r1,r1,-128
164
 
165
        l.sw    0x4(r1),r2
166
        l.sw    0x8(r1),r4
167
        l.sw    0xc(r1),r5
168
        l.sw    0x10(r1),r6
169
        l.sw    0x14(r1),r7
170
        l.sw    0x18(r1),r8
171
        l.sw    0x1c(r1),r9
172
        l.sw    0x20(r1),r10
173
        l.sw    0x24(r1),r11
174
        l.sw    0x28(r1),r12
175
        l.sw    0x2c(r1),r13
176
        l.sw    0x30(r1),r14
177
        l.sw    0x34(r1),r15
178
        l.sw    0x38(r1),r16
179
        l.sw    0x3c(r1),r17
180
        l.sw    0x40(r1),r18
181
        l.sw    0x44(r1),r19
182
        l.sw    0x48(r1),r20
183
        l.sw    0x4c(r1),r21
184
        l.sw    0x50(r1),r22
185
        l.sw    0x54(r1),r23
186
        l.sw    0x58(r1),r24
187
        l.sw    0x5c(r1),r25
188
        l.sw    0x60(r1),r26
189
        l.sw    0x64(r1),r27
190
        l.sw    0x68(r1),r28
191
        l.sw    0x6c(r1),r29
192
        l.sw    0x70(r1),r30
193
        l.sw    0x74(r1),r31
194
        l.sw    0x78(r1),r3
195
 
196
        l.movhi r3,hi(_eth_int)
197
        l.ori   r3,r3,lo(_eth_int)
198
        l.jalr  r3
199
        l.nop
200
 
201
        l.lwz   r2,0x4(r1)
202
        l.lwz   r4,0x8(r1)
203
        l.lwz   r5,0xc(r1)
204
        l.lwz   r6,0x10(r1)
205
        l.lwz   r7,0x14(r1)
206
        l.lwz   r8,0x18(r1)
207
        l.lwz   r9,0x1c(r1)
208
        l.lwz   r10,0x20(r1)
209
        l.lwz   r11,0x24(r1)
210
        l.lwz   r12,0x28(r1)
211
        l.lwz   r13,0x2c(r1)
212
        l.lwz   r14,0x30(r1)
213
        l.lwz   r15,0x34(r1)
214
        l.lwz   r16,0x38(r1)
215
        l.lwz   r17,0x3c(r1)
216
        l.lwz   r18,0x40(r1)
217
        l.lwz   r19,0x44(r1)
218
        l.lwz   r20,0x48(r1)
219
        l.lwz   r21,0x4c(r1)
220
        l.lwz   r22,0x50(r1)
221
        l.lwz   r23,0x54(r1)
222
        l.lwz   r24,0x58(r1)
223
        l.lwz   r25,0x5c(r1)
224
        l.lwz   r26,0x60(r1)
225
        l.lwz   r27,0x64(r1)
226
        l.lwz   r28,0x68(r1)
227
        l.lwz   r29,0x6c(r1)
228
        l.lwz   r30,0x70(r1)
229
        l.lwz   r31,0x74(r1)
230
#        l.lwz   r3,0x78(r1)
231
 
232
        l.mtspr r0,r0,SPR_PICSR
233
 
234
        l.mfspr r3,r0,SPR_ESR_BASE
235
        l.ori   r3,r3,SPR_SR_IEE
236
        l.mtspr r0,r3,SPR_ESR_BASE
237
 
238
        l.lwz   r3,0x78(r1)
239
 
240
        l.addi  r1,r1,128
241
        l.rfe
242
        l.nop
243
 
244
        .section .text
245
_lolev_ie:
246
        l.mfspr r3,r0,SPR_SR
247
        l.ori   r3,r3,SPR_SR_IEE
248
        l.mtspr r0,r3,SPR_SR
249
        l.movhi r3,hi(ETH0_INT)
250
        l.ori   r3,r3,lo(ETH0_INT)
251
        l.mtspr r0,r3,SPR_PICMR
252
 
253
        l.jr    r9
254
        l.nop
255
 
256
_lolev_idis:
257
        l.mtspr r0,r0,SPR_PICMR
258
 
259
        l.jr    r9
260
        l.nop

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.