98
RSP Coprocessor 0
Figure 4-2
DMA Read/Write Example
###############################################
# Procedure to do DMA reads/writes.
# Registers:
# $20 mem_addr
# $19 dram_addr
# $18 dma_len
# $17 iswrite?
# $11 used as tmp
.name mem_addr, $20
.name dram_addr, $19
.name dma_len, $18
.name iswrite, $17
.name tmp, $11
DMAproc: # request DMA access: (get semaphore)
mfc0 tmp, SP_RESERVED
bne tmp, zero, DMAproc
# note delay slot
DMAFull: # wait for not FULL:
mfc0 tmp, DMA_FULL
bne tmp, zero, DMAFull
nop
# set DMA registers:
mtc0 mem_addr, DMA_CACHE
# handle writes:
bgtz iswrite, DMAWrite
mtc0 dram_addr, DMA_DRAM
j DMADone
mtc0 dma_len, DMA_READ_LENGTH
DMAWrite:
mtc0 dma_len, DMA_WRITE_LENGTH
DMADone:
jr return
# clear semaphore, delay slot
mtc0 zero, SP_RESERVED
.unname mem_addr
.unname dram_addr
.unname dma_len
.unname iswrite
.unname tmp
#
################################################
Summary of Contents for Ultra64
Page 2: ...2 ...
Page 10: ...10 ...
Page 12: ...12 Figure 6 2 buildtask Operation 137 ...
Page 14: ...14 ...
Page 80: ...80 Vector Unit Instructions vmadm dres_int dres_int vconst 3 vmadn dres_frac vconst vconst 0 ...
Page 104: ...104 RSP Coprocessor 0 ...
Page 150: ...150 Advanced Information ...
Page 155: ...Revision 1 0 155 ...
Page 248: ...248 Exceptions None ...
Page 251: ...Revision 1 0 251 Exceptions None ...
Page 254: ...254 Exceptions None ...
Page 257: ...Revision 1 0 257 Exceptions None ...
Page 293: ...Revision 1 0 293 Exceptions None ...
Page 316: ...316 Exceptions None ...