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
|
.set noreorder
.include "hwregs_a.h"
.section .text
.global CdGetSector
.type CdGetSector, @function
CdGetSector:
lui $a2, IOBASE
.Lwait_fifo:
lbu $v0, CD_REG0($a2)
nop
andi $v0, 0x40
beqz $v0, .Lwait_fifo
nop
lui $v0, 0x1
srl $a1, 2
or $v0, $a1
sw $a0, D3_MADR($a2) # Set DMA base address and transfer length
sw $v0, D3_BCR($a2)
lui $v0, 0x1100 # Start DMA transfer
sw $v0, D3_CHCR($a2)
nop
nop
.Ldma_wait:
lw $v0, D3_CHCR($a2)
nop
srl $v0, 24
andi $v0, 0x1
bnez $v0, .Ldma_wait
nop
# Not stable
# sb $0 , CD_REG0($a2)
#.Lflush_fifo: # Read out any remaining bytes in the buffer
# lbu $v1, CD_REG0($a2)
# li $v0, 0x40
# and $v1, $v0
# beqz $v1, .Lend_flush
# nop
# lbu $v0, CD_REG2($a2)
# b .Lflush_fifo
# nop
#.Lend_flush:
jr $ra
li $v0, 1
|