pif2Boot.s 2.93 KB

 #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)