stress_ext.c 2.17 KB
/* The purpose of this program is to stress the external buses(BusData[8-0])     */
/* of the RDRAMs. When we access the address 0x003fc038, the following request   */
/* packet is sent to the RDRAMs:                                                 */
/*                                                                               */
/*     Clock   Bus-  BusData                                                     */
/*             Ctrl   [8]  [7]  [6]  [5]  [4]  [3]  [2]  [1]  [0]                */
/* --------------------------------------------------------------                */
/*     [0]e    xxx    xxx   0    0    0    0    1    1    1    0                 */
/*        o    xxx    xxx   1    1    1    1    0    0    0    0                 */
/*     [1]e    xxx     0    0    0    0    0    1    1    1    1                 */
/*        o    xxx     0    0    0    0    0    0    0    0    0                 */
/*     [2]e    xxx    xxx  xxx  xxx  xxx  xxx  xxx  xxx  xxx  xxx                */
/*        o    xxx    xxx  xxx  xxx  xxx  xxx  xxx  xxx   0    0                 */
/*                                                                               */
/* This is because BusData[7:0] stand for Adr[9:2] at clock [0]even, Adr[17:10]  */
/* at clock [0]odd, and BusData[8:0] stand for Adr[26:18] at [1]even,            */
/* Adr[35:27] at [1]odd. Adr[1:0] is sent through BusData[1:0] at clock [2] odd. */
/* (for more detail, refer "RDRAM reference manual" page 70.)  Should you have   */
/* any more efficient idea, please feel free to change address, value, or even   */
/* whole program.                                                                */

#include <ultra64.h>
#include <assert.h>
#include "main.h"

extern	errorReport1(u32, u32, u32);
extern 	errorReport2(u32, u32, u32, u32, u32);

u32 stressExternalBus(u32 cnt)
{
  u32 i, j, error_cnt=0;
  u32 value=0xff00ff00;
  u32 *addr=(u32 *)OS_PHYSICAL_TO_K1(0x003fc038);
  
  for (j=0; j<10000; j++)
    for (i=0; i<cnt; i++)
      *addr = value;
  for (j=0; j<10000; j++)
    for (i=0; i<cnt; i++)
      if (*addr != value)
      {
	error_cnt++;
#ifdef DEBUG
	errorReport1((u32)addr, value, *addr);
#endif
      }	
  return 0;
}