stress_int.c 988 Bytes
 /* The purpose of this program is stressing internal address buses. */
 /* The addresses are accessed in a butterfly fashion. */


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

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

u32 stressInternalAddressBus(u32 *begadr, u32 *endadr)
{
  u32 *ptr1, *ptr2;
  u32 loop, i;
  u32 error_cnt=0;
  u32 pattern1=0x55555555;
  u32 pattern2=0xaaaaaaaa;
  
  ptr1 = begadr;
  ptr2 = endadr;
  
  loop = (endadr - begadr) >> 1;
  
#ifdef DEBUG
  SOAKPRINTF("loop = %x\n", loop);
#endif
  
  for (i=0; i<loop; i++)
  {
    *ptr1++ = pattern1;
    *(--ptr2) = pattern2;
  }

  for (; i>0; i--)
  {
    if (*ptr2++ != pattern2)
    {
      error_cnt ++;

#ifdef DEBUG
      errorReport1((u32)(ptr2 - 1), pattern2, *(ptr2 - 1));
#endif
    }      
    if (*(--ptr1) != pattern1)
    {
      error_cnt ++;

#ifdef DEBUG
      errorReport1((u32)ptr1, pattern1, *ptr1);
#endif
    }
  }
  return error_cnt;
}