mainssav.sav

来自「The Lite Evaluation/Demonstration Kit is」· SAV 代码 · 共 1,534 行 · 第 1/3 页

SAV
1,534
字号
#495: 	// Check the non-complement.
#496: 	for (i = 0; i < SMtstBlkSz/4; i++)		// Write address pattern
	addi	r31, r31, 1
.L242:
	srwi	r11, r29, 2
	cmplw	r31, r11
	blt	.L241
	li	r31, 0
#497: 	{
	b	.L248
.L247:
#498: 		((long *) SMoffset)[i] = ( i | (i << 12) | (i << 24) );
	mr	r10, r31
	slwi	r10, r10, 2
	add	r9, r28, r10
	slwi	r8, r31, 12
	or	r7, r31, r8
	slwi	r11, r31, 24
	or	r10, r7, r11
	stw	r10, 0(r9)
#499: 	}
#501: 	for (i = 0; i < SMtstBlkSz/4; i++)		// Read and check address pattern
	addi	r31, r31, 1
.L248:
	srwi	r9, r29, 2
	cmplw	r31, r9
	blt	.L247
	li	r31, 0
#502: 	{
	b	.L252
.L251:
#503: 		dWrote = i | (i << 12) | (i << 24);
	slwi	r8, r31, 12
	or	r7, r31, r8
	slwi	r11, r31, 24
	or	r6, r7, r11
#504: 		if ( (dRead = ((long *) SMoffset)[i]) != dWrote)
#505: 		{
	mr	r10, r31
	slwi	r10, r10, 2
	add	r9, r28, r10
	lwz	r11, 0(r9)
	cmplw	r11, r6
	beq	.L250
#506: 			errorCnt++;
	addi	r30, r30, 1
#507: 			errorHandler (errorCnt, FALSE);
	mr	r3, r30
	li	r4, 0
	bl	errorHandler
#508: 			// printf ("R%08xW%08x ", dRead, dWrote);
#509: 			// if (errorCnt % 4 == 0)
#510: 			//	printf ("\n");
#511: 		}
#512: 	}
.L250:
#514: /*
#515: 	if (errorCnt > 0)
#516: 		printf ("\nShared Memory test failed.\n");
#517: 	else
#518: 		printf ("\nShared Memory test passed.\n");
#520: 	_flushall();
#522: 	return (errorCnt);
#523: */
#525: 	writeLED(errorCnt, TRUE);
	addi	r31, r31, 1
.L252:
	srwi	r8, r29, 2
	cmplw	r31, r8
	blt	.L251
	mr	r3, r30
	li	r4, 1
	bl	writeLED
#527: }    // end testSharedMem
#	    .es
#	    .ef
	addi	r11, sp, 24
	b	_restgpr_28_l
__ghs_eofn_testSharedMem::
	.type	testSharedMem,@function
	.size	testSharedMem,$-testSharedMem
	.align	2

#function:			testSharedMem
#stack frame size:		24
#link area offset:		0
#local storage area offset:	8
#gpr save area offset:		8
#
#SMtstBlkSz	r29	local
#SMoffset	r28	local
#errorCnt	r30	local
#i	r31	local
#dRead	r11	local
#dWrote	r6	local

	.data
	.text
#531: DWORD timeoutcnt = 0;
#532: void timeout ()
#533: {
	.align	2
	.align	2
	.align	2
	.long	0	# alloca=0;fmax=0;gmax=0;sp=lr=0;cr=fpscr=0
	.globl	timeout
timeout:
#	    .bf
#534: 	timeoutcnt++;
#	    .bs
	lis	r12, %hiadj(timeoutcnt)
	lwz	r11, %lo(timeoutcnt)(r12)
	addi	r11, r11, 1
	lis	r12, %hiadj(timeoutcnt)
	stw	r11, %lo(timeoutcnt)(r12)
#535: }
#	    .es
#	    .ef
	blr
__ghs_eofn_timeout::
	.type	timeout,@function
	.size	timeout,$-timeout
	.align	2

#function:			timeout
#stack frame size:		0
#

	.data
	.text
#537: //
#538: // testI2O
#539: //
#540: //
#541: //  Here we test the I2O FIFOs as generic FIFOs, using the FE (FIFO Empty) bit,
#542: //   not using the I2O protocol convention that a 
#543: //   read of all ones (0xFFFFffff) means 'an empty FIFO'.  With the generic protocol, data that is
#544: //   all ones can actually be sent, whereas with the I2O protocol, all ones is reserved as a signal and
#545: //   cannot be a value in the data stream.
#546: //
#547: //  Note well: we use the Post (not Free) FIFOs for this first test because the Post FIFOs have 
#548: //   the FE (FIFO Empty) bit exposed in a register to both host and local.  The Free FIFOs do not
#549: //   expose this bit.
#550: //
#551: DWORD testI2O ()
#552: {
	.align	2
	.align	2
	.long	0	# alloca=0;fmax=0;gmax=0;sp=lr=0;cr=fpscr=0
	.globl	testI2O
testI2O:
#	    .bf
#553: 	int errorCnt = 0;
#554: 	DWORD hostwrote;
#556: 	// printf ("Testing I2O...\n");
#558: 	// Host: Notes about Host Operations start like this line and are not indented.
#559: 		// 860: Notes about 860 Operations start like this line and are indented.
#560: 	
#561: // I2O Interrupt Enable Masks (set the bit to enable)
#562: #define I2OIMSK_LOFL	( 0x00010000 )	// Local overflow
#563: #define I2OIMSK_POFL	( 0x00020000 )	// PCI   overflow	
#564: #define I2OIMSK_IBPNE	( 0x00400000 )	// ibp not empty	
#565: #define I2OIMSK_OBPNE	( 0x00800000 )	// obp not empty
#567: #define I2OCOMMONMSK	0x8		// Mask used for all I2O interrupt mask and status registers
#569: 	
#570: 	// Host: Notes about Host Operations start like this line and are not indented.
#571: 		// 860: Notes about 860 Operations start like this line and are indented.
#572: 	
#574: 	// Host: Write DWORD x to the Inbound Post FIFO (ibp).
#576: 		// 860: Because of 'Interrupt Generation' issue with the 3042, we do the following:
#577: 		i2oregp->limr = 0;		// Unmask interrupts in limr.
#	    .bs
	lis	r12, %hiadj(i2oregp)
	lwz	r11, %lo(i2oregp)(r12)
	li	r0, 0
	stw	r0, 60(r11)
#578: 		regp->lint = 0;		    // Mask all (including I2O) interrupts in lint.
	lis	r12, %hiadj(regp)
	lwz	r10, %lo(regp)(r12)
	li	r0, 0
	stw	r0, 148(r10)
#580: 		while (1)		// Go forever reading from the ibp and writing back to the obp.
.L315:
#582: 		// 860: Reads x from the IBP.
#583: 		// 860: Spin waiting for OBP (Outbound Post) not empty. Wait forever.
#584: 			while ( (i2oregp->lisr & I2OCOMMONMSK) != I2OCOMMONMSK )
#587: 			hostwrote = i2oregp->ibp_ibf;   // read from ibp !!!
#585: 				;
	lis	r12, %hiadj(i2oregp)
	lwz	r9, %lo(i2oregp)(r12)
	lwz	r7, 56(r9)
	andi.	r8, r7, 8
	cmplwi	r8, 8
	bne	.L315
	lis	r12, %hiadj(i2oregp)
	lwz	r11, %lo(i2oregp)(r12)
	lwz	r11, 72(r11)
#589: 		// 860: Writes x back to the OBP.
#590: 			i2oregp->obp_obf = hostwrote;	// write to obp  !!!
	lis	r12, %hiadj(i2oregp)
	lwz	r10, %lo(i2oregp)(r12)
	stw	r11, 76(r10)
#591: 			
#592: 		// 860: And that's all there is to it on the 860 side !!!
#593: 		}
#596: 	// Host: Spin waiting for OBP (Outbound Post) not empty. Timeout if it takes too long.
#597: 	// Host: Read the Outbound Post FIFO and compare to x above.
#599: /*
#600: 	if (errorCnt > 0)
#601: 		printf ("\nI2O test failed.\n");
#602: 	else
#603: 		printf ("\nI2O test passed.\n");
#604: */
#606: 	return (errorCnt);
#581: 		{
#608: }  // end testI2O()
#	    .es
	b	.L315
#	    .ef
__ghs_eofn_testI2O::
	.type	testI2O,@function
	.size	testI2O,$-testI2O
	.align	2

#function:			testI2O
#stack frame size:		0
#
#errorCnt	r11	local
#hostwrote	r11	local

	.data
	.text
#611: testDirectAccess(void)
#612: {
	.align	2
	.align	2
	.long	0	# alloca=0;fmax=0;gmax=0;sp=lr=0;cr=fpscr=0
	.globl	testDirectAccess
testDirectAccess:
#	    .bf
#613: 	long temp;
#614: 	
#615: 	// Can only do Writes for now until the RDYOUT# fix is in
#617: 	*DAHBASEptr = 0xFFBDC004;			// Set up for Memory cycles
#	    .bs
	lis	r12, %hiadj(DAHBASEptr)
	lwz	r11, %lo(DAHBASEptr)(r12)
	lis	r0, -67
	ori	r0, r0, 49156
	stw	r0, 0(r11)
#618: 	temp = *DAHBASEptr;					// Read back the DAHBASE register to make sure we wrote it OK.
	lis	r12, %hiadj(DAHBASEptr)
	lwz	r10, %lo(DAHBASEptr)(r12)
	lwz	r11, 0(r10)
#620: 	*DAregion = 0x12345678;				// Generate a Write cycle through the DA region to where the DAHBASE[PCI addr field] points.
	lis	r12, %hiadj(DAregion)
	lwz	r9, %lo(DAregion)(r12)
	lis	r0, 4660
	ori	r0, r0, 22136
	stw	r0, 0(r9)
#621: 	 
#622: 	*((long *) (CS1_BASE + DAregionoffset + 4)) = 0x87654321;		// ???  This code (and other lines nearby) could be made for readable.
	lis	r12, 16
	ori	r12, r12, 8196
	lis	r0, -30875
	ori	r0, r0, 17185
	stw	r0, 0(r12)
#623: 		 
#626: 	// This worked, but further I/O testing must wait until the very last !!!
#627: 	//  *DAHBASEptr = 0x0000E002;			// Set up for I/O cycles
#628: 	//  *((long *) (CS1_BASE + DAregionoffset + 0x1FE0)) = 0xAA55AA55;
#629: 		 
#630: 	// writeLED(temp, FALSE);  				// Write the result to the LED so we can see it on the logic analyzer.
#631: }
#	    .es
#	    .ef
	blr
__ghs_eofn_testDirectAccess::
	.type	testDirectAccess,@function
	.size	testDirectAccess,$-testDirectAccess
	.align	2

#function:			testDirectAccess
#stack frame size:		0
#
#temp	r11	local

	.data
	.text
#634: long testLED (void)
#635: {
	.align	2
	.align	2
	.long	16396	# alloca=1;fmax=0;gmax=0;sp=lr=1;cr=fpscr=0
	.globl	testLED
testLED:
	mflr	r0
	stw	r0, 4(sp)
	stwu	sp, -8(sp)
#	    .bf
#636: 	long count, temp, i;
#638: 	// while (1)  			//  for (i = 0 ; i < 10000 ; i++)
#639: 	{
#	    .bs
#640: 		// Write and increment the LED
#641: 		writeLED (LEDvalue++, FALSE);
	lis	r12, %hiadj(LEDvalue)
	lwz	r11, %lo(LEDvalue)(r12)
	mr	r3, r11
	addi	r11, r11, 1
	lis	r12, %hiadj(LEDvalue)
	stw	r11, %lo(LEDvalue)(r12)
	li	r4, 0
	bl	writeLED
#643: 		// Wait loop
#644: 		// for (count = 0; count < 10000; count ++) 
#645: 			// temp = 0x11223344;
#646: 	}
#647: }
#	    .es
#	    .ef
	lwz	r0, 12(sp)
	mtlr	r0
	addi	sp, sp, 8
	blr
__ghs_eofn_testLED::
	.type	testLED,@function
	.size	testLED,$-testLED
	.align	2

#function:			testLED
#stack frame size:		8
#link area offset:		0
#local storage area offset:	8
#
#count	r11	local
#temp	r11	local
#i	r11	local

	.data
	.text
#650: main()
#651: {
	.align	2
	.align	2
	.long	16396	# alloca=1;fmax=0;gmax=0;sp=lr=1;cr=fpscr=0
	.globl	main
main:
	mflr	r0
	stw	r0, 4(sp)
	stwu	sp, -8(sp)
#	    .bf
#652: 	LEDvalue = 0;
#	    .bs
	lis	r12, %hiadj(LEDvalue)
	li	r0, 0
	stw	r0, %lo(LEDvalue)(r12)
#654: 	while(1)
.L358:
#656: 		// testDirectAccess();
#657: 		// testOpRegs();
#658: 		testSharedMem();
	bl	testSharedMem
#659: 		testI2O();
	bl	testI2O
#660: 		// testDMA();
#661: 		testLED();
	bl	testLED
#662: 		// indicateAlive();
#663: 	}
#665: 	// testSharedMem();
#666: 	
#655: 	{
#	    .es
#667: }
	b	.L358
#	    .ef
__ghs_eofn_main::
	.type	main,@function
	.size	main,$-main
	.align	2

#function:			main
#stack frame size:		8
#link area offset:		0
#local storage area offset:	8
#

	.data
	.text
	.align	2
	.data

	.section ".rodata","a"
	.space	3
.L379:
	.globl	OP_REGS_BASE_42
OP_REGS_BASE_42:	.byte	0,0,4,96
	.type	OP_REGS_BASE_42,@object
	.size	OP_REGS_BASE_42,4
.L380:
	.globl	dahbaseBASEaddrMSK
dahbaseBASEaddrMSK:	.byte	255,255,224,0
	.type	dahbaseBASEaddrMSK,@object
	.size	dahbaseBASEaddrMSK,4
.L381:
	.globl	dahbasePCIMSK
dahbasePCIMSK:	.byte	0,0,0,6
	.type	dahbasePCIMSK,@object
	.size	dahbasePCIMSK,4
.L382:
	.globl	dahbaseMSK
dahbaseMSK:	.byte	255,255,224,6
	.type	dahbaseMSK,@object
	.size	dahbaseMSK,4
.L383:
	.globl	NUMopr3042
NUMopr3042:	.byte	0,0,0,8
	.type	NUMopr3042,@object
	.size	NUMopr3042,4
	.data
.L384:
	.globl	opRegs3042
opRegs3042:	.byte	0,0,4,96
	.byte	255,255,224,246
	.space	4
	.long	.L34
	.byte	0,0,4,176
	.byte	0,0,63,252
	.space	4
	.long	.L35
	.byte	0,0,4,180
	.byte	255,255,255,252
	.space	4
	.long	.L36
	.byte	0,0,4,184
	.byte	0,0,63,252
	.space	4
	.long	.L37
	.byte	0,0,4,228
	.byte	3,59,0,24
	.byte	0,0,0,24
	.long	.L38
	.byte	0,0,4,232
	.byte	0,0,255,255
	.space	4
	.long	.L39
	.byte	0,0,4,244
	.byte	3,43,0,0
	.space	4
	.long	.L40
	.byte	0,0,4,248
	.byte	0,0,255,255
	.space	4
	.long	.L41
	.type	opRegs3042,@object
	.size	opRegs3042,128
.L385:
	.globl	AN3042ptr
AN3042ptr:	.byte	0,16,0,0
	.type	AN3042ptr,@object
	.size	AN3042ptr,4
.L386:
	.globl	DAHBASEptr
DAHBASEptr:	.byte	0,16,4,96
	.type	DAHBASEptr,@object
	.size	DAHBASEptr,4
.L387:
	.globl	DAregion
DAregion:	.byte	0,16,32,0
	.type	DAregion,@object
	.size	DAregion,4
.L388:
	.globl	SRAMptr
SRAMptr:	.byte	0,32,0,0
	.type	SRAMptr,@object
	.size	SRAMptr,4
.L389:
	.globl	LEDptr
LEDptr:	.byte	0,48,0,0
	.type	LEDptr,@object
	.size	LEDptr,4
.L390:
	.globl	LEDvalue
LEDvalue:	.byte	0,0,0,0
	.type	LEDvalue,@object
	.size	LEDvalue,4
.L391:
	.globl	i2oregp
i2oregp:	.byte	0,16,0,0
	.type	i2oregp,@object
	.size	i2oregp,4
.L392:
	.globl	regp
regp:	.byte	0,16,4,96
	.type	regp,@object
	.size	regp,4
.L393:
	.globl	timeoutcnt
timeoutcnt:	.byte	0,0,0,0
	.type	timeoutcnt,@object
	.size	timeoutcnt,4
	.align	2
	.section ".rodata","a"
	.align	2
	.text
	.text
	.globl	..eof.main..2E
..eof.main..2E:

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?