/**	teds_tests.c
 **
 **	This file was created to help check out the diagnotic monitor
 ** for the diagnostic code.
 **/
#include "errhand.h"
#include "../ll_post.h"
#include "../ll_bist.h"
#include "../ll_post_utils.h"

#if !defined(__U_BOOT__)
#include <stdio.h>    /* standard library headers */
#else
#include "common.h"  /* common library headers for Uboot environment */
#endif

void disp_not_implenemted_msg(void)
{
  printf("Not yet implemented...\n");

}

void test1(void)
{
  disp_not_implenemted_msg();
}

void test2(void)
{
  disp_not_implenemted_msg();

}

void test3(void)
{
  disp_not_implenemted_msg();

}

void test4(void)
{
  disp_not_implenemted_msg();

}

void test5(void)
{
  disp_not_implenemted_msg();

}

void test6(void)
{
  disp_not_implenemted_msg();

}

void test7(void)
{
  disp_not_implenemted_msg();

}

void test8(void)
{
  disp_not_implenemted_msg();

}

void test9(void)
{
  disp_not_implenemted_msg();

}

void test10(void)
{
  disp_not_implenemted_msg();

}

void test11(void)
{
  disp_not_implenemted_msg();

}

void test12(void)
{
  disp_not_implenemted_msg();

}

void test13(void)
{
  disp_not_implenemted_msg();

}

void test14(void)
{
  disp_not_implenemted_msg();

}

void test15(void)
{
  disp_not_implenemted_msg();

}

void test16(void)
{
  disp_not_implenemted_msg();

}

void test17(void)
{
  disp_not_implenemted_msg();

}

void test18(void)
{
  disp_not_implenemted_msg();

}

void test19(void)
{
  disp_not_implenemted_msg();

}

void test20(void)
{
  disp_not_implenemted_msg();

}

void test21(void)
{
  disp_not_implenemted_msg();

}

void test22(void)
{
  disp_not_implenemted_msg();

}

void test23(void)
{
  disp_not_implenemted_msg();

}

void test24(void)
{
  disp_not_implenemted_msg();

}

void test25(void)
{
  disp_not_implenemted_msg();

}

void test26(void)
{
  disp_not_implenemted_msg();

}

void test27(void)
{
  disp_not_implenemted_msg();

}

void test28(void)
{
  disp_not_implenemted_msg();

}

void test29(void)
{
  disp_not_implenemted_msg();

}

void test30(void)
{

}

void test31(void)
{

}

void test32(void)
{

}

void test33(void)
{
  struct errhand_info eh;
  char err_msg[] = "New Rev B DMA device is detected... ";

  eh.call_type = EH_INFO_ONLY;
  eh.severity = SLEVEL_INFO;
  eh.void_ptr = (void *) err_msg;

  error_handler(&eh);		/* display an error */

}

void test34(void)
{
  struct errhand_info eh;
  char err_msg[] = "OLD Rev A DMA device is detected... ";

  eh.call_type = EH_WARNING;
  eh.severity = SLEVEL_WARN;
  eh.data_exp[0] = 0x02;
  eh.data_rec[0] = 0x01;
  eh.fail_adrs = 0x8070001D;
  eh.void_ptr = (void *) err_msg;
  eh.disp_size = DISP_SIZE_1B;

  error_handler(&eh);		/* display an error */

}

void test35(void)
{
  struct errhand_info eh;

  eh.call_type = EH_FAIL;
  eh.error_stop = 0x0100;
  eh.sup_error_stop = 0x0050;
  eh.severity = SLEVEL_FATAL;
  eh.data_exp[0] = 0x55555555;
  eh.data_rec[0] = 0x55A55555;
  eh.data_exp[1] = 0xAAAAAAAA;
  eh.data_rec[1] = 0xAAAAAAAA;
  eh.data_exp[2] = 0x33333333;
  eh.data_rec[2] = 0x33331333;
  eh.fail_adrs = 0xD0100000;
  eh.disp_size = DISP_SIZE_12B;


  eh.fru_list[0] = slot4;
  eh.fru_list[1] = slot7;
  eh.fru_list[2] = slot3;
  eh.fru_list[3] = ps1;
  eh.fru_list[4] = ps3;
  eh.fru_list[5] = f1;
  eh.fru_list[6] = f2;
  eh.fru_list[7] = dimm1;
  eh.fru_list[8] = 0xff;

  error_handler(&eh);		/* display an error */
  
}

void test36(void)
{
  struct errhand_info eh;
  char err_msg[] = "Local RAM worked previously but FAILED after it warmed "
                   "up!!!";

  eh.call_type = EH_FAIL_USR_MSG;
  eh.error_stop = 0x0090;
  eh.sup_error_stop = 0x0005;
  eh.severity = SLEVEL_FATAL;
  eh.data_exp[0] = 0x33333333;
  eh.data_rec[0] = 0x33333333;
  eh.data_exp[1] = 0xAAAAAAAA;
  eh.data_rec[1] = 0xAAAAAA3A;
  eh.fail_adrs = 0x8010000C;
  eh.void_ptr = (void *) err_msg;
  eh.disp_size = DISP_SIZE_8B;


  eh.fru_list[0] = slot4;
  eh.fru_list[1] = 0xff;

  error_handler(&eh);		/* display an error */

}

void test37(void)
{
  struct errhand_info eh;

  eh.call_type = EH_FAIL_EXP_REC;
  eh.error_stop = 0x0100;
  eh.sup_error_stop = 0x0015;
  eh.severity = SLEVEL_FATAL;
  eh.data_exp[0] = 0x33333333;
  eh.data_exp[1] = 0xAAAAAAAA;
  eh.data_exp[2] = 0x55555555;
  eh.data_exp[3] = 0xDDDDDDDD;
  eh.data_rec[0] = 0x33333333;
  eh.data_rec[1] = 0xAAAAAAAA;
  eh.data_rec[2] = 0x55555515;
  eh.data_rec[3] = 0xDDDDDDDD;
  eh.disp_size = DISP_SIZE_16B;

  eh.fru_list[0] = slot1;
  eh.fru_list[1] = slot2;
  eh.fru_list[2] = ps1;
  eh.fru_list[3] = f1;
  eh.fru_list[4] = dimm2;
  eh.fru_list[5] = 0xff;

  error_handler(&eh);		/* display an error */


}

void test38(void)
{

}

void test_passed(void)
{

}

/* this is a long test that demonstrates the wheel spinning at the cursor 
   "loop_count' = how many times to spin the wheel.
*/
void long_test_passed(int loop_count)
{
  int i;

  for (i = 0; i < loop_count; i++)
    {
    tbl_delay(MS_200);
    hl_spin_wheel();
    }

}

void test12_spin_wheel(void)
{
  long_test_passed (5);
}

void test18_spin_wheel(void)
{
  long_test_passed (10);
}

void test19_spin_wheel(void)
{
  long_test_passed (7);
}

void test21_spin_wheel(void)
{
  long_test_passed (20);
}

void test22_spin_wheel(void)
{
  long_test_passed (30);
}

void test25_spin_wheel(void)
{
  long_test_passed (30);
}
