run-and-decode-test.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #! /bin/bash
  2. location=/mnt/fast/
  3. #location="./"
  4. duration=10000000
  5. wait_frame=1000000
  6. TESTS_PATH="`dirname \"$0\"`"
  7. TESTS_PATH="`( cd \"$TESTS_PATH\" && pwd )`"
  8. function pci {
  9. PCILIB_PATH=$TESTS_PATH/..
  10. LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $*
  11. }
  12. function stop {
  13. usleep $duration
  14. pci -w control 0x201 &> /dev/null
  15. }
  16. function reset {
  17. pci -r 0x9000 -s 256 > $1.status
  18. $TESTS_PATH/ipecamera/Reset_Init_all_reg_10bit.sh &> $1.reset
  19. }
  20. $TESTS_PATH/ipecamera/cfg/Reset_Init_all_reg_10bit.sh &> /dev/null
  21. $TESTS_PATH/ipecamera/frame.sh &> /dev/null
  22. rm -f bench.out
  23. pci --stop-dma
  24. pci --start-dma dma1
  25. pci -r dma1 -s 16777216 --multipacket -o /dev/null &> /dev/null
  26. pci -r dma1 -s 1 | grep -i "Error (62)" &> /dev/null
  27. if [ $? -ne 0 ]; then
  28. echo "There is data on dma..."
  29. exit
  30. fi
  31. echo "Starting ... "
  32. decode_failures=0
  33. failures=0
  34. failed=0
  35. frames=0
  36. fpga_failures=0
  37. cmosis_failures=0
  38. frame_rate_failures=0
  39. iter=0
  40. while [ 1 ]; do
  41. pci -w control 0xa01 &> /dev/null
  42. stop &
  43. output="$location/test$iter.out"
  44. rm -f $output
  45. pci -r dma1 -o $output --wait --multipacket -t $wait_frame &> /dev/null
  46. killall -9 usleep &> /dev/null
  47. usleep 100000
  48. pci -w control 0x201 &> /dev/null
  49. if [ -f $output ]; then
  50. result=`ipedec -d -v --continue $output 2>&1 | grep -iE "failed|decoded"`
  51. cur_failed=`echo $result | wc -l`
  52. cur_decoded=`echo $result | tail -n 1 | grep -i decoded`
  53. if [ $? -ne 0 -o $cur_failed -eq 0 ]; then
  54. ipedec -d -v --continue $output > $output.decode
  55. decode_failures=$(($decode_failures + 1))
  56. reset $output
  57. else
  58. cur_failed=$(($cur_failed - 1))
  59. cur_frames=`echo $cur_decoded | cut -f 2 -d ' '`
  60. failed=$(($failed + $cur_failed))
  61. frames=$(($frames + $cur_frames))
  62. fpga_status=`pci -r 0x9054 | awk '{print $2;}' | cut -c 2`
  63. cmosis_status=`pci -r 0x9050 | awk '{print $2;}' | cut -c 3-4`
  64. if [ "$fpga_status" != "f" ]; then
  65. fpga_failures=$(($fpga_failures + 1))
  66. reset $output
  67. elif [ "$cmosis_status" == "7d" ]; then
  68. cmosis_failures=$(($cmosis_failures + 1))
  69. reset $output
  70. elif [ $cur_frames -lt 10 ]; then
  71. frame_rate_failures=$(($frame_rate_failures + 1))
  72. reset $output
  73. elif [ $cur_failed -eq 0 ]; then
  74. rm -f $output
  75. else
  76. reset $output
  77. fi
  78. fi
  79. else
  80. failures=$(($failures + 1))
  81. reset $output
  82. fi
  83. echo "Frames: $frames, Failed Frames: $failed, Failed Exchanges: $failures, Failed Decodings: $decode_failures, FPGA Failures: $fpga_failures, CMOSIS Failures: $cmosis_failures, Low Frame Rate: $frame_rate_failures"
  84. iter=`expr $iter + 1`
  85. done