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

Subversion Repositories test_project

[/] [test_project/] [trunk/] [sw/] [support/] [reset.S] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 julius
/* Support file for c based tests */
2
#include "spr_defs.h"
3
#include "board.h"
4
#include "mc.h"
5
 
6
        .section .stack
7
        .space 0x10000
8
_stack:
9
 
10
        .section .reset, "ax"
11
 
12
        .org    0x100
13
_reset_vector:
14
        l.nop
15
        l.nop
16
        l.addi  r2,r0,0x0
17
        l.addi  r3,r0,0x0
18
        l.addi  r4,r0,0x0
19
        l.addi  r5,r0,0x0
20
        l.addi  r6,r0,0x0
21
        l.addi  r7,r0,0x0
22
        l.addi  r8,r0,0x0
23
        l.addi  r9,r0,0x0
24
        l.addi  r10,r0,0x0
25
        l.addi  r11,r0,0x0
26
        l.addi  r12,r0,0x0
27
        l.addi  r13,r0,0x0
28
        l.addi  r14,r0,0x0
29
        l.addi  r15,r0,0x0
30
        l.addi  r16,r0,0x0
31
        l.addi  r17,r0,0x0
32
        l.addi  r18,r0,0x0
33
        l.addi  r19,r0,0x0
34
        l.addi  r20,r0,0x0
35
        l.addi  r21,r0,0x0
36
        l.addi  r22,r0,0x0
37
        l.addi  r23,r0,0x0
38
        l.addi  r24,r0,0x0
39
        l.addi  r25,r0,0x0
40
        l.addi  r26,r0,0x0
41
        l.addi  r27,r0,0x0
42
        l.addi  r28,r0,0x0
43
        l.addi  r29,r0,0x0
44
        l.addi  r30,r0,0x0
45
        l.addi  r31,r0,0x0
46
 
47
        l.movhi r3,hi(MC_BASE_ADDR)
48
        l.ori   r3,r3,MC_BA_MASK
49
        l.addi  r5,r0,0x00
50
        l.sw    0(r3),r5
51
        l.movhi r3,hi(_start)
52
        l.ori   r3,r3,lo(_start)
53
        l.jr    r3
54
        l.nop
55
 
56
        .section .text
57
 
58
_start:
59
        l.jal   _init_mc
60
        l.nop
61
 
62
.if IC | DC
63
        /* Flush IC and/or DC */
64
        l.addi  r10,r0,0
65
        l.addi  r11,r0,0
66
        l.addi  r12,r0,0
67
.if IC
68
        l.addi  r11,r0,IC_SIZE
69
.endif
70
.if DC
71
        l.addi  r12,r0,DC_SIZE
72
.endif
73
        l.sfleu r12,r11
74
        l.bf    loop
75
        l.nop
76
        l.add   r11,r0,r12
77
loop:
78
.if IC
79
        l.mtspr r0,r10,SPR_ICBIR
80
.endif
81
.if DC
82
        l.mtspr r0,r10,SPR_DCBIR
83
.endif
84
        l.sfne  r10,r11
85
        l.bf    loop
86
        l.addi  r10,r10,16
87
 
88
        /* Enable IC and/or DC */
89
        l.addi  r10,r0,(SPR_SR_SM)
90
.if IC
91
        l.ori   r10,r10,(SPR_SR_ICE)
92
.endif
93
.if DC
94
        l.ori   r10,r10,(SPR_SR_DCE)
95
.endif
96
        l.mtspr r0,r10,SPR_SR
97
        l.nop
98
        l.nop
99
        l.nop
100
        l.nop
101
        l.nop
102
.endif
103
 
104
        /* Wait for SDRAM */
105
        l.addi  r3,r0,0x1       /* 0x1000 */
106
1:      l.sfeqi r3,0
107
        l.bnf   1b
108
        l.addi  r3,r3,-1
109
 
110
        /* Copy from flash to sram */
111
        l.movhi r3,hi(_src_beg)
112
        l.ori   r3,r3,lo(_src_beg)
113
        l.movhi r4,hi(_icm_start)
114
        l.ori   r4,r4,lo(_icm_start)
115
        l.movhi r5,hi(_icm_end)
116
        l.ori   r5,r5,lo(_icm_end)
117
        l.sub   r5,r5,r4
118
        l.sfeqi r5,0
119
        l.bf    20f
120
        l.nop
121
10:     l.lwz   r6,0(r3)
122
        l.sw    0(r4),r6
123
        l.addi  r3,r3,4
124
        l.addi  r4,r4,4
125
        l.addi  r5,r5,-4
126
        l.sfgtsi r5,0
127
        l.bf    10b
128
        l.nop
129
20:
130
 
131
        /* Copy from flash to sram */
132
        l.movhi r3,hi(_src_beg)
133
        l.ori   r3,r3,lo(_src_beg)
134
        l.movhi r4,hi(_vec_start)
135
        l.ori   r4,r4,lo(_vec_start)
136
        l.movhi r5,hi(_vec_end)
137
        l.ori   r5,r5,lo(_vec_end)
138
        l.sub   r5,r5,r4
139
        l.sfeqi r5,0
140
        l.bf    2f
141
        l.nop
142
1:      l.lwz   r6,0(r3)
143
        l.sw    0(r4),r6
144
        l.addi  r3,r3,4
145
        l.addi  r4,r4,4
146
        l.addi  r5,r5,-4
147
        l.sfgtsi r5,0
148
        l.bf    1b
149
        l.nop
150
2:
151
        l.movhi r4,hi(_dst_beg)
152
        l.ori   r4,r4,lo(_dst_beg)
153
        l.movhi r5,hi(_dst_end)
154
        l.ori   r5,r5,lo(_dst_end)
155
1:      l.sfgeu r4,r5
156
        l.bf    1f
157
        l.nop
158
        l.lwz   r8,0(r3)
159
        l.sw    0(r4),r8
160
        l.addi  r3,r3,4
161
        l.bnf   1b
162
        l.addi  r4,r4,4
163
1:
164
        l.addi  r3,r0,0
165
        l.addi  r4,r0,0
166
3:
167
        /* Set stack pointer */
168
        l.movhi r1,hi(_stack)
169
        l.ori   r1,r1,lo(_stack)
170
 
171
        /* Jump to main */
172
        l.movhi r2,hi(_reset)
173
        l.ori   r2,r2,lo(_reset)
174
        l.jr    r2
175
        l.nop
176
 
177
_init_mc:
178
 
179
        l.movhi r3,hi(MC_BASE_ADDR)
180
        l.ori   r3,r3,lo(MC_BASE_ADDR)
181
 
182
        l.addi  r4,r3,MC_CSC(0)
183
        l.movhi r5,hi(FLASH_BASE_ADDR)
184
        l.srai  r5,r5,6
185
        l.ori   r5,r5,0x0025
186
        l.sw    0(r4),r5
187
 
188
        l.addi  r4,r3,MC_TMS(0)
189
        l.movhi r5,hi(FLASH_TMS_VAL)
190
        l.ori   r5,r5,lo(FLASH_TMS_VAL)
191
        l.sw    0(r4),r5
192
 
193
        l.addi  r4,r3,MC_BA_MASK
194
        l.addi  r5,r0,MC_MASK_VAL
195
        l.sw    0(r4),r5
196
 
197
        l.addi  r4,r3,MC_CSR
198
        l.movhi r5,hi(MC_CSR_VAL)
199
        l.ori   r5,r5,lo(MC_CSR_VAL)
200
        l.sw    0(r4),r5
201
 
202
        l.addi  r4,r3,MC_TMS(1)
203
        l.movhi r5,hi(SDRAM_TMS_VAL)
204
        l.ori   r5,r5,lo(SDRAM_TMS_VAL)
205
        l.sw    0(r4),r5
206
 
207
        l.addi  r4,r3,MC_CSC(1)
208
        l.movhi r5,hi(SDRAM_BASE_ADDR)
209
        l.srai  r5,r5,6
210
        l.ori   r5,r5,0x0411
211
        l.sw    0(r4),r5
212
 
213
        l.addi  r4,r3,MC_TMS(2)
214
        l.movhi r5,hi(SDRAM_TMS_VAL)
215
        l.ori   r5,r5,lo(SDRAM_TMS_VAL)
216
        l.sw    0(r4),r5
217
 
218
        l.addi  r4,r3,MC_CSC(2)
219
        l.movhi r5,hi(0x00800000)
220
        l.srai  r5,r5,6
221
        l.ori   r5,r5,0x0411
222
        l.sw    0(r4),r5
223
 
224
        l.jr    r9
225
        l.nop
226
 

powered by: WebSVN 2.1.0

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