pif2Boot.s
2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#This is a sample of reply program for PIf chip test.
#This program is in cartrideg ROM after IPL3 space(0xb0001000-).
#If there are some accidents for boot program, please insert testing code in
#this program.
#include "regdef.h"
#include "asm.h"
#include "R4300.h"
#include "rcp.h"
rom_offset = 0x10
LEAF (reply)
#****************************** reply for IPL ***************************
#org b0001000
.set reorder
#This code run after block1.
#If there is a need of test for block1, please insert testing code.
li t0, SP_SET_HALT|SP_CLR_INTR
sw t0, PHYS_TO_K1(SP_STATUS_REG)
#b. Reset PI to stop current DMA
li t0, PI_STATUS_RESET|PI_STATUS_CLR_INTR
sw t0, PHYS_TO_K1(PI_STATUS_REG)
#c. Write to VI regs to set NTSC default sync, stop new video and blank video
lw t0, PHYS_TO_K1(VI_CONTROL_REG)
and t0, 0xfffffffc
sw t0, PHYS_TO_K1(VI_CONTROL_REG) # clear video
ori t0,zero,100 #t0 = roop count = 100
wait_vi:
addi t0,t0,0xffff #t0 = t0 - 1
bne t0,zero,wait_vi #end check
jalr s0,ra
#This code run after block2.
#If there is a need of test for block2, please insert testing code.
jalr s0,ra
#This code run after block3.
#If there is a need of test for block3, please insert testing code.
jalr s0,ra
#This code run after block4.
#If there is a need of test for block4, please insert testing code.
jalr s0,ra
#This code run after block5.
#If there is a need of test for block5, please insert testing code.
jalr s0,ra
#This code run after block6.
#If there is a need of test for block6, please insert testing code.
jalr s0,ra
#This code run after block7.
#If there is a need of test for block7, please insert testing code.
jalr s0,ra
#This code run after block8.
#If there is a need of test for block8, please insert testing code.
jalr s0,ra
#If there is a need of test for block9, please insert testing code.
li t0,0xbfc007fc
loop1:
lw t1,0(t0)
li t2,0x80000000
and t1,t2
bne t1,zero,loop1
#wait for 20 usec.
.set noreorder
nop
nop
.set reorder
lw t1,0(t0)
li t2,0x1000000
or t1,t2
sw t1,0(t0)
.set noreorder
nop
nop
.set reorder
wait1:
lw t1,PHYS_TO_K1(SI_STATUS_REG)
andi t1,SI_STATUS_RD_BUSY
bnez t1,wait1
lw t1,0(t0)
li t2,0x6000000
sw t2,0(t0)
ori t1,zero,50000 #t1 = roop count = 50
wait_pif2:
addi t1,t1,0xffff #t1 = t1 - 1
bne t1,zero,wait_pif2 #end check
la t3,PHYS_TO_K1(SP_DMEM_START)
addi t3,rom_offset # dest. address for IPL3
j t3 #jump to IPL3
#This code run after block10.
#If there is a need of test for block10, please insert testing code.
jalr s0,ra
#This code run after block10.
#This code run after block11.
#If there is a need of test for block11, please insert testing code.
jalr s0,ra
END (reply)