xbus_dma.s 927 Bytes
#include <PR/rcp.h>
#include <PR/rsp.h>
		
	/****************************************************************
	                           DMA TEST #0.0
	 ****************************************************************/
	/* XBUS Ring-Buffer test	*/
	or	$1,	$0,	$0		/* R1  = TEST ID	*/
CheckSig:	
	mfc0	$2,	$4			/* read SP Status Reg	*/
	andi	$2,	$2,	SP_STATUS_SIG0	/* extract signal 0	*/
	beq	$2,	$0,	CheckSig	/* CPU not requesting	*/
CmdWait:	mfc0	$2,	CMD_STATUS	/* read DPC Status Reg	*/
	andi	$2,	$2,	0x0200		/* extract end valid	*/
	bne	$2,	$0,	CmdWait		/* wait for XBUS idle	*/
	ori	$2,	$0,	0x0002		/* set xbus_dmem_dma b	*/
	mtc0	$2,	CMD_STATUS		/* write DP status reg	*/
	lw	$2,	0($0)			/* load start address	*/
	mtc0	$2,	CMD_START		/* write start address	*/
	lw	$2,	4($0)			/* end address	*/
	mtc0	$2,	CMD_END			/* write end address	*/
	ori	$2,	$0,	SP_CLR_SIG0	/* Clear sig0 */
	mtc0	$2,	$4			
	nop
	j	CheckSig	
	nop