#!/bin/sh

#chrislin on VME address 0x0 ; space min. 16MByte; D32/BLT32/MBLT32
test_vme_ram_chrislin=1 

#SIS3100 Slave on VME address 0x84000000 ; space min. 16MByte; D32/BLT32/MBLT32
test_vme_ram_sis3100=0 


test_sdram=1
must_no_of_mbyte=512         # valid values are :  0, 64, 128, 256, 512

test_sharc_intern=1
test_sharc_vme_chrislin=1
test_sharc_vme_sis3100=0


echo 
echo 

rm temp.lst

loop_counter=0
while :
do

# VME test with chrislin
   if [ $test_vme_ram_chrislin -eq 1 ] 
      then 
   echo Test VME Chrislin Slave  Byte/Word/Longword    runs   ......
         #test on chrislin Memory 256KByte with SGL (Byte/Word/Longword)   
         ./pci_vme/pci_vme_ram_test_sgl_8_16_32 0x0 0x10000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

# VME test with chrislin
   if [ $test_vme_ram_chrislin -eq 1 ] 
      then 
   echo Test VME Chrislin Slave runs   .........................
         #test on chrislin Memory 256KByte with SGL, BLT and MBLT   
         ./pci_vme/pci_vme_ram_test_all 0x0 0x10000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

         #test on chrislin Memory 256KByte with SGL, BLT and MBLT   
         ./pci_vme/pci_vme_ram_test_all 0x4ff000 0x10000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi


         #test on chrislin Memory 4MByte with write BLT32 and read BLT32   
         ./pci_vme/pci_vme_ram_test 0x0 0x100000 2 2 >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

         #test on chrislin Memory second 8MByte with write BLT32 and read MBLT64   
         ./pci_vme/pci_vme_ram_test 0x800000 0x200000 2 3  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

         #test on chrislin Memory  8MByte with write MBLT64 and read MBLT64   
         ./pci_vme/pci_vme_ram_test 0x400000 0x200000 3 3  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   fi 



# VME test with other sis3100 slave 
   if [ $test_vme_ram_sis3100 -eq 1 ] 
      then 
   echo Test VME SIS3100 Slave runs   ..........................

         #test on SIS3100 Slave Memory 256KByte with SGL, BLT and MBLT   
         ./pci_vme/pci_vme_ram_test_all 0x84000000 0x10000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

         #test on SIS3100 Slave Memory 256KByte with SGL, BLT and MBLT   
         ./pci_vme/pci_vme_ram_test_all 0x844ff000 0x10000  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi


         #test on SIS3100 Slave  Memory 4MByte with write BLT32 and read BLT32   
         ./pci_vme/pci_vme_ram_test 0x84100000 0x100000 2 2 >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

         #test on SIS3100 Slave  Memory second 8MByte with write BLT32 and read MBLT64   
         ./pci_vme/pci_vme_ram_test 0x84800000 0x200000 2 3  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

         #test on SIS3100 Slave  Memory  8MByte with write MBLT64 and read MBLT64   
         ./pci_vme/pci_vme_ram_test 0x84400000 0x200000 3 3  >> temp.lst
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
   fi 



#SDRAM Test
#check first the size and compare it with "MUST value" must_no_of_mbyte
   if [ $test_sdram -eq 1 ] 
      then ./pci_sdram/check_size  >> temp.lst
#       NO_OF_MBYTE=$?
#       if [ $must_no_of_mbyte -ne $NO_OF_MBYTE ]
#       then 
#           echo  
#           echo wrong size of SDRAM or wrong "MUST value"  ,  size of SDRAM = $NO_OF_MBYTE
#           echo
#       exit
#     fi
NO_OF_MBYTE=512
   echo Test SDRAM runs   ......................................
     if [ $NO_OF_MBYTE -eq 64 ]
       then 
        ./pci_sdram/pci_sdram_test_inc 64 3 >> temp.lst    # check full SDRAM with increment pattern (3 time)
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x0 0x20000 0 0  >> temp.lst   # test with 4 different pattern ,512 KByte SGL write , SGL read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x7ff00 0x40000 1 0  >> temp.lst   # test with 4 different pattern ,1MByte KByte BLT write , SGL read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x489f0 0x40000 0 1  >> temp.lst   # test with 4 different pattern ,1MByte KByte SGL write , DMA read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x0 0x400000 1 1  >> temp.lst   # test with 4 different pattern ,16MByte KByte DMA write , DMA read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x1000000 0x400000 1 1  >> temp.lst   # test with 4 different pattern ,16MByte KByte DMA write , DMA read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x2000000 0x400000 1 1  >> temp.lst   # test with 4 different pattern ,16MByte KByte DMA write , DMA read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x3000000 0x400000 1 1  >> temp.lst   # test with 4 different pattern ,16MByte KByte DMA write , DMA read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
     fi



   echo Test SDRAM runs   ......................................
     if [ $NO_OF_MBYTE -eq 512 ]
       then 
        ./pci_sdram/pci_sdram_test_inc 512 3 >> temp.lst    # check full SDRAM with increment pattern (3 time)
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x0 0x20000 0 0  >> temp.lst   # test with 4 different pattern ,512 KByte SGL write , SGL read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x7ff00 0x40000 1 0  >> temp.lst   # test with 4 different pattern ,1MByte KByte BLT write , SGL read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x489f0 0x40000 0 1  >> temp.lst   # test with 4 different pattern ,1MByte KByte SGL write , DMA read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x0 0x400000 1 1  >> temp.lst   # test with 4 different pattern ,16MByte KByte DMA write , DMA read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x1000000 0x400000 1 1  >> temp.lst   # test with 4 different pattern ,16MByte KByte DMA write , DMA read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x2000000 0x400000 1 1  >> temp.lst   # test with 4 different pattern ,16MByte KByte DMA write , DMA read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
        ./pci_sdram/pci_sdram_test_all 0x3000000 0x400000 1 1  >> temp.lst   # test with 4 different pattern ,16MByte KByte DMA write , DMA read
         RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
     fi



   fi 






   if [ $test_sharc_intern -eq 1 ] 
   then echo Test SHARC runs   ......................................
     ./sharc/fpga_ram_test  >> temp.lst
     RETVAL=$?
     if [ $RETVAL -ne 0 ]
       then echo SHARC Tests Not OK  RETVAL= $RETVAL
       exit
     fi
   fi 



# SHARC VME test with chrislin
   if [ $test_sharc_vme_chrislin -eq 1 ] 
      then 
   echo Test SHARC VME Chrislin Slave runs   ...................
         #test on chrislin Memory 256KByte with SGL, BLT    
         ./sharc/vme_ram_test 0x0 0x10000 0x4 >> temp.lst
          RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
         #test on chrislin Memory 1MByte with SGL, BLT    
         ./sharc/vme_ram_test 0x14670 0x40000 0x4 >> temp.lst
          RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   fi 

# SHARC VME test with other SIS3100 Slave
   if [ $test_sharc_vme_sis3100 -eq 1 ] 
      then 
   echo Test SHARC VME other SIS3100 Slave runs   ..............
         #test on chrislin Memory 256KByte with SGL, BLT    
         ./sharc/vme_ram_test 0x84000000 0x10000 0x4 >> temp.lst
          RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi
         #test on chrislin Memory 1MByte with SGL, BLT    
         ./sharc/vme_ram_test 0x84014670 0x40000 0x4 >> temp.lst
          RETVAL=$?
         if [ $RETVAL -ne 0 ]
           then echo NOT OK RETVAL= $RETVAL
           exit
         fi

   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





















