#!/bin/sh

echo
echo

rm temp.lst

loop_counter=0
while :
do

#register tests
   echo SIS330x Register Tests            runs   .........................
        #test SIS330x RAM Bank1 (2MByte ; 8 x 256KBytes ; 8 x 128Ksample with SGL, BLT, MBLT and 2EVME
        ./register_test/sis330x_register_test1 0x33000000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

# ram tests
   echo SIS330x RamTestAllCycles  Bank1   runs   .........................
        #test SIS330x RAM Bank1 (2MByte ; 8 x 256KBytes ; 8 x 128Ksample with SGL, BLT, MBLT and 2EVME
        ./ram_test/sis330x_ram_test_all 0x33400000 0x80000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   echo SIS330x RamTestAllCycles  Bank2   runs   .........................
        #test SIS330x RAM Bank2 (2MByte ; 8 x 256KBytes ; 8 x 128Ksample with SGL, BLT, MBLT and 2EVME
        ./ram_test/sis330x_ram_test_all 0x33600000 0x80000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi


   echo SIS330x RamTest1  Bank1 and Bank2   runs   .........................
        #test SIS330x RAM Bank 1 and Bank2 (4MByte ; 8 x 256KBytes ; 16 x 128Ksample with BLT, MBLT and 2EVME
        ./ram_test/sis330x_ram_test1 0x33400000 0x100000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   echo SIS330x RamTest1  Bank1    runs   .........................
        #test SIS330x RAM Bank 1
        ./ram_test/sis330x_ram_test1 0x33400000 0x80000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   echo SIS330x RamTest1  Bank2    runs   .........................
        #test SIS330x RAM Bank 2
        ./ram_test/sis330x_ram_test1 0x33600000 0x80000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi





   echo SIS330x RamTest2  Bank1 ADC1,2    runs   .........................
        #test SIS330x RAM Bank 1
        ./ram_test/sis330x_ram_test2 0x33400000 0x20000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   echo SIS330x RamTest2  Bank1 ADC3,4    runs   .........................
        #test SIS330x RAM Bank 1
        ./ram_test/sis330x_ram_test2 0x33480000 0x20000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   echo SIS330x RamTest2  Bank1 ADC5,6    runs   .........................
        #test SIS330x RAM Bank 1
        ./ram_test/sis330x_ram_test2 0x33500000 0x20000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   echo SIS330x RamTest2  Bank1 ADC7,8    runs   .........................
        #test SIS330x RAM Bank 1
        ./ram_test/sis330x_ram_test2 0x33580000 0x20000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi


   echo SIS330x RamTest2  Bank2 ADC1,2    runs   .........................
        #test SIS330x RAM Bank 2
        ./ram_test/sis330x_ram_test2 0x33600000 0x20000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   echo SIS330x RamTest2  Bank2 ADC3,4    runs   .........................
        #test SIS330x RAM Bank 2
        ./ram_test/sis330x_ram_test2 0x33680000 0x20000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   echo SIS330x RamTest2  Bank2 ADC5,6    runs   .........................
        #test SIS330x RAM Bank 2
        ./ram_test/sis330x_ram_test2 0x33700000 0x20000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   echo SIS330x RamTest2  Bank2 ADC7,8    runs   .........................
        #test SIS330x RAM Bank 2
        ./ram_test/sis330x_ram_test2 0x33780000 0x20000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi






  loop_counter=`expr $loop_counter + 1`
  echo test_loop  $loop_counter

  if [ $loop_counter -eq 10 ]
    then rm temp.lst
  fi


  if [ $loop_counter -eq 20 ]
     then exit
   fi
done



















