diff options
Diffstat (limited to 'tests/ipecamera')
-rwxr-xr-x | tests/ipecamera/bench.sh | 34 | ||||
-rwxr-xr-x | tests/ipecamera/cfg/Reset_Init_all_reg_10bit.sh (renamed from tests/ipecamera/Reset_Init_all_reg_10bit.sh) | 22 | ||||
-rwxr-xr-x | tests/ipecamera/cfg/Reset_Init_all_reg_10bit_4Mp.sh | 325 | ||||
-rwxr-xr-x | tests/ipecamera/cfg/Reset_Init_all_reg_11bit.sh (renamed from tests/ipecamera/Reset_Init_all_reg_11bit.sh) | 9 | ||||
-rwxr-xr-x | tests/ipecamera/cfg/Reset_Init_all_reg_12bit.sh (renamed from tests/ipecamera/Reset_Init_all_reg_12bit.sh) | 26 | ||||
-rwxr-xr-x | tests/ipecamera/debug/incomplete.sh | 37 | ||||
-rwxr-xr-x | tests/ipecamera/frame.sh | 36 | ||||
-rwxr-xr-x | tests/ipecamera/frame_req.sh | 27 | ||||
-rwxr-xr-x | tests/ipecamera/grab-hwtrigger.sh | 20 | ||||
-rwxr-xr-x | tests/ipecamera/stimuli.sh | 30 | ||||
-rwxr-xr-x | tests/ipecamera/tests/loopback-test.sh | 87 | ||||
-rwxr-xr-x | tests/ipecamera/tests/run-and-decode-test.sh | 103 |
12 files changed, 745 insertions, 11 deletions
diff --git a/tests/ipecamera/bench.sh b/tests/ipecamera/bench.sh new file mode 100755 index 0000000..09edae9 --- /dev/null +++ b/tests/ipecamera/bench.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +function pci { + PCILIB_PATH="/root/pcitool" + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +size=16 +bytes=`expr $size "*" 4` + +rm -f bench.out +pci --stop-dma dma1 +pci --reset + +#pci -w xrawdata_packet_length $bytes + +pci --start-dma dma1 +pci -w control 0x1e5 +sleep 1 +pci -w control 0x1e1 + +sleep 1 +pci -w control 0x3e1 +for i in `seq 1 10`; do +# pci -w control 0x1e1 + pci -w dma1 -s $size "*$i" +# pci -w control 0x3e1 + usleep 100000 + pci -r dma1 -s $size -o bench.out +done + +pci -w control 0x1e1 +pci --stop-dma dma1 + diff --git a/tests/ipecamera/Reset_Init_all_reg_10bit.sh b/tests/ipecamera/cfg/Reset_Init_all_reg_10bit.sh index f6a3521..f4afa06 100755 --- a/tests/ipecamera/Reset_Init_all_reg_10bit.sh +++ b/tests/ipecamera/cfg/Reset_Init_all_reg_10bit.sh @@ -5,10 +5,10 @@ error=0 echo " Reset Readout and CMOSIS " -pci -w 0x9040 204 +pci -w 0x9040 80000204 sleep .1 #echo " Release Reset for Readout" -#pci -w 0x9040 1e0 +#pci -w 0x9040 800001e0 sleep .1 ##################### PLL SET ##################################### val=f501 @@ -228,7 +228,7 @@ fi #################################################################################################################### sleep 0.01 -#pci -w 0x9040 201 +#pci -w 0x9040 80000201 sleep 0.01 ########################## WRITE THE READOUT NUMBER OF LINE ####################################################### pci -w cmosis_number_lines 1088 @@ -288,16 +288,23 @@ sleep 0.01 ######################################################################################################### sleep 0.01 + + +################################################## +#SET the max number of frame in DDR +pci -w 0x91a0 0x71 + #echo " Reset Readout and CMOSIS " -pci -w 0x9040 0x204 +pci -w 0x9040 0x80000204 sleep .1 echo " Release Reset for Readout" -pci -w 0x9040 0x201 +pci -w 0x9040 0x80000201 sleep .1 status=`pci -r 0x9050 -s 4 | awk '{print $2$3$4}'` if [ "$status" != "8449ffff0f0010013ffff111" ]; then echo "--------------------------------->>>> ERROR! in the camera status ... " + echo " $status " error=1 # exit fi @@ -311,4 +318,9 @@ else fi echo +echo "DMA reset ... " +pci --stop-dma dma1 +sleep 0.5 +pci --start-dma dma1 + diff --git a/tests/ipecamera/cfg/Reset_Init_all_reg_10bit_4Mp.sh b/tests/ipecamera/cfg/Reset_Init_all_reg_10bit_4Mp.sh new file mode 100755 index 0000000..5a4e582 --- /dev/null +++ b/tests/ipecamera/cfg/Reset_Init_all_reg_10bit_4Mp.sh @@ -0,0 +1,325 @@ +#!/bin/bash + +###################### by Michele Caselle and Uros Stafanovic ################################################## +############ Resent procedure and camera initialization for 10 -bit mode ###################################### + +error=0 +echo " Reset Readout and CMOSIS " +pci -w 0x9040 80000204 +sleep .1 +#echo " Release Reset for Readout" +#pci -w 0x9040 800001e0 +sleep .1 +##################### PLL SET ##################################### +val=f501 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +echo " Start CMOSIS Configuration .." +pci -w 0x9000 f301 +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "bf301" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +val=d207 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 + +# Michele 10 - 12 bit mode # +# ################################################################################################### +echo " 10 - bit mode, set Bit_mode " +val=ef00 ###################################################### +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +# Michele set ADC_resolution @ 12 bits +echo " 10 bit mode, set ADC resolution 10 bits " +val=f000 # qui for 10 - 11 - 12 bits ######################################################## +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 + +# adc recommended 28=44 +val=e72c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val " + error=1 + # exit +fi +sleep 0.01 +# #################################################################################################### + +################# CAMERA CONFIGURATION ############################################ +val=e603 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 + +val=d404 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +val=d501 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +# recommended is d840 +val=d840 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +# sleep 0.01 +# recommended is db40 +val=db40 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +val=de65 +# val=de0 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +sleep 0.01 +val=df6a +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +echo " End CMOSIS Configuration .." +######################################################################################################## +echo " Write exp time......" + +######################################### EXP TIME ####################################################### +val=aa25 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +# val=ab2c +val=ab00 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +# val=acaa +val=ac00 +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +#################################################################################################################### + +sleep 0.01 +#pci -w 0x9040 80000201 +sleep 0.01 +########################## WRITE THE READOUT NUMBER OF LINE ####################################################### +pci -w cmosis_number_lines 2047 +#pci -w number_lines 8 +sleep 0.01 +################################################################################################################# +pci --start-dma dma1 +sleep 0.01 +#VRAMP 6c is 108 +val=e26c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +#VRAMP 6c is 108 +val=e36c +pci -w 0x9000 $val +sleep 0.01 +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +sleep 0.01 +###################################### NUMBER OF OUTPUT ############################################################ +##pci -w 0x9000 0xc803 +sleep 0.01 +val=c800 +pci -w 0x9000 $val +#pci -r 0x9000 -s 10 +sleep 0.01 +value=`pci -r 0x9000 -s 8 | grep 9010 | awk '{print $2}' | cut -c 4-8` +if [ "$value" != "b$val" ]; then + echo "--------------------------------->>>> ERROR! read value: ${value:1:4}, written value: $val" + error=1 + # exit +fi +#pci -r 0x9000 -s 10 + +sleep 0.01 +#pci -w 0x9000 0xd011 +sleep 0.01 +#pci -r 0x9000 -s 10 + +sleep 0.01 +#pci -w 0x9000 0xd111 +######################################################################################################### +sleep 0.01 + + + +################################################## +#SET the max number of frame in DDR +pci -w 0x91a0 0x71 + +#echo " Reset Readout and CMOSIS " +pci -w 0x9040 0x80000204 +sleep .1 +echo " Release Reset for Readout" +pci -w 0x9040 0x80000201 +sleep .1 + +status=`pci -r 0x9050 -s 4 | awk '{print $2$3$4}'` +if [ "$status" != "8449ffff0f0010013ffff111" ]; then + echo "--------------------------------->>>> ERROR! in the camera status ... " + error=1 + # exit +fi + +#echo "--> $status" + +if [ "$error" = "1" ]; then + echo " Error in the reset and initialization" +else + echo " Camera READY ........................... OK" +fi +echo + +echo "DMA reset ... " +pci --stop-dma dma1 +sleep 0.5 +pci --start-dma dma1 + + diff --git a/tests/ipecamera/Reset_Init_all_reg_11bit.sh b/tests/ipecamera/cfg/Reset_Init_all_reg_11bit.sh index 048f6b0..3c4af0e 100755 --- a/tests/ipecamera/Reset_Init_all_reg_11bit.sh +++ b/tests/ipecamera/cfg/Reset_Init_all_reg_11bit.sh @@ -279,6 +279,10 @@ if [ "$value" != "b$val" ]; then fi #pci -r 0x9000 -s 10 +################################################## +#SET the max number of frame in DDR +pci -w 0x91a0 0x1C + sleep 0.01 #pci -w 0x9000 0xd011 sleep 0.01 @@ -307,3 +311,8 @@ fi echo +echo "DMA reset ... " +pci --stop-dma dma1 +sleep 0.5 +pci --start-dma dma1 + diff --git a/tests/ipecamera/Reset_Init_all_reg_12bit.sh b/tests/ipecamera/cfg/Reset_Init_all_reg_12bit.sh index 00c2481..b04f2cd 100755 --- a/tests/ipecamera/Reset_Init_all_reg_12bit.sh +++ b/tests/ipecamera/cfg/Reset_Init_all_reg_12bit.sh @@ -188,7 +188,7 @@ echo " End CMOSIS Configuration .." echo " Write exp time......" ######################################### EXP TIME ####################################################### -val=aa01 +val=aa0f pci -w 0x9000 $val sleep 0.01 #pci -r 0x9000 -s 10 @@ -280,20 +280,29 @@ fi #pci -r 0x9000 -s 10 sleep 0.01 + +################################################## +#SET the max number of frame in DDR +pci -w 0x91a0 0x1C + + #pci -w 0x9000 0xd011 sleep 0.01 -#pci -r 0x9000 -s 10 +pci -r 0x9000 -s 10 sleep 0.01 #pci -w 0x9000 0xd111 -#pci -r 0x9000 -s 10 -######################################################################################################### sleep 0.01 +pci -r 0x9000 -s 10 +######################################################################################################### +sleep 0.1 status=`pci -r 0x9050 -s 4 | awk '{print $2$3$4}'` -if [ "$status" != "8449ffff0f0010013ffff111" ]; then +if [ "$status" != "844950280f0010013ffff111" ]; then + echo "--------------------------------->>>> ERROR! in the camera status ... " - error =1 + echo $status + error=1 # exit fi @@ -307,3 +316,8 @@ fi echo + +echo "DMA reset ... " +pci --stop-dma dma1 +sleep 0.5 +pci --start-dma dma1 diff --git a/tests/ipecamera/debug/incomplete.sh b/tests/ipecamera/debug/incomplete.sh new file mode 100755 index 0000000..5c80198 --- /dev/null +++ b/tests/ipecamera/debug/incomplete.sh @@ -0,0 +1,37 @@ +#! /bin/bash + +function pci { + PCILIB_PATH="/root/pcitool" + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +rm -f images.raw +touch images.raw + +echo "Starting the grabber" +pci --stop-dma +pci --start-dma dma1 +pci -g -o images.raw --run-time 1000000000 & +pid=$! + +usleep 1000000 + +for i in `seq 1 100000`; do + old_size=`ls -la images.raw | cut -d " " -f 5` + echo "Trigger $i" + pci --trigger + usleep 100000 + new_size=`ls -la images.raw | cut -d " " -f 5` + if [ $old_size -eq $new_size ]; then + sleep 2 + new_size=`ls -la images.raw | cut -d " " -f 5` + if [ $old_size -eq $new_size ]; then + echo "Incomplete frame..." + killall -SIGINT pci + break + fi + fi +done + +echo "Waiting grabber to finish" +wait $pid diff --git a/tests/ipecamera/frame.sh b/tests/ipecamera/frame.sh new file mode 100755 index 0000000..679817b --- /dev/null +++ b/tests/ipecamera/frame.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +TESTS_PATH="`dirname \"$0\"`" +TESTS_PATH="`( cd \"$TESTS_PATH\" && pwd )`" + +function pci { + PCILIB_PATH=$TESTS_PATH/.. + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +pci --stop-dma dma1 +#pci --reset + +echo "Set packet size 1024 .. " +pci -w cmosis_number_lines 1088 +#pci -w xrawdata_packet_length 4096 +pci --start-dma dma1 +usleep 1000 + +echo "Send frame request ... " +pci -w control 1e9 +usleep 100000 +pci -w control 1e1 +usleep 100000 + +echo "Enable Readout ... " +pci -w control 3e1 + +usleep 100000 + +pci -r dma1 -o bench.out --multipacket + +pci -w control 1e1 + +pci --stop-dma dma1 + diff --git a/tests/ipecamera/frame_req.sh b/tests/ipecamera/frame_req.sh new file mode 100755 index 0000000..bce89c3 --- /dev/null +++ b/tests/ipecamera/frame_req.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +function pci { + PCILIB_PATH="/root/pcitool" + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +#pci --stop-dma dma1 +#pci --reset + +echo "Set packet size 1024 .. " +pci -w cmosis_number_lines 1088 +#pci -w xrawdata_packet_length 4096 +pci --start-dma dma1 +usleep 1000 + +echo "Send frame request ... " +pci -w control 1e9 +usleep 100000 +pci -w control 1e1 +usleep 100000 + +echo "Enable Readout 3... " +pci -w control 3e1 +usleep 1000000 +pci -w control 1e1 + diff --git a/tests/ipecamera/grab-hwtrigger.sh b/tests/ipecamera/grab-hwtrigger.sh new file mode 100755 index 0000000..0279ab4 --- /dev/null +++ b/tests/ipecamera/grab-hwtrigger.sh @@ -0,0 +1,20 @@ +#! /bin/bash + +function pci { + PCILIB_PATH="/root/pcitool" + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +function enable_hw_trigger { + usleep 100000 + pci -w control 0xa01 +} + +rm -f images.raw + +enable_hw_trigger & +pid=$! + +echo "Starting the grabber" +pci -g -o images.raw --run-time 60000000 --verbose 10 -o /dev/null +wait $pid diff --git a/tests/ipecamera/stimuli.sh b/tests/ipecamera/stimuli.sh new file mode 100755 index 0000000..33e99e1 --- /dev/null +++ b/tests/ipecamera/stimuli.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +function pci { + PCILIB_PATH="/root/pcitool" + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +rm -f bench.out + +echo "Set FFFF the frame space .." +pci -w 0x9180 fff + +echo "Set the number of frames .." +pci -w reg9170 55 + +pci --start-dma dma1 + +echo "Send frame request ... " +pci -w control 1f1 +usleep 100000 +pci -w control 1e1 + + +echo "Enable Readout ... " +pci -w control 3e1 +pci -r dma1 -o bench.out --multipacket +pci -w control 1e1 + +pci --stop-dma dma1 + diff --git a/tests/ipecamera/tests/loopback-test.sh b/tests/ipecamera/tests/loopback-test.sh new file mode 100755 index 0000000..1c033cc --- /dev/null +++ b/tests/ipecamera/tests/loopback-test.sh @@ -0,0 +1,87 @@ +#! /bin/bash + +TESTS_PATH="`dirname \"$0\"`" +TESTS_PATH="`( cd \"$TESTS_PATH\" && pwd )`" + +function pci { + PCILIB_PATH=$TESTS_PATH/.. + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +function compare { + PCILIB_PATH=$TESTS_PATH/.. + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/apps/compare_to_value $* +} + +#size=`expr 1024 "*" 1024` +size=`expr 1024 "*" 1` +multiplier=2 +wait=0 + +/root/pcitool/tests/ipecamera/frame.sh &> /dev/null +rm -f bench.out + +pci --stop-dma dma1 +pci --start-dma dma1 + +pci -r dma1 -s 16777216 --multipacket -o /dev/null &> /dev/null + +pci -r dma1 -s 1024 -o /dev/null | grep -i "Error (62)" &> /dev/null +if [ $? -ne 0 ]; then + echo "There is data on dma..." + exit +fi + +failed=0 +send=0 +errors=0 +err_num=0 + +print_iters=`expr 2 + 1024 '*' 100 / $size` + +read_size=`expr $multiplier '*' $size` +echo "Starting..." +i=1 + +pci -w 0x9040 0x201 + +while [ 1 ]; do + if [ $wait -gt 0 ]; then + pci -w 0x9040 0x1 + fi + + pci -w dma1 -s $size "*0x$i" + rm -f /tmp/camera-test.out + pci -r dma1 --wait --multipacket -s $read_size -o /tmp/camera-test.out -t 1000000 &> /dev/null + if [ $wait -gt 0 ]; then + wrdone=0 + while [ $wrdone -eq 0 ]; do +# pci --list-dma-engines + pci --list-dma-engines | grep "DMA1 S2C" | grep "SD" #&> /dev/null + wrdone=$? + done + pci -w 0x9040 0x201 + fi + + res=`compare /tmp/camera-test.out $read_size "$i" 6 2 6` + if [ $? -eq 0 ]; then + err_cnt=`echo $res | cut -f 1 -d ' '` + if [ "$err_cnt" -ne 0 ]; then + pci -r dma1 --wait --multipacket -o /tmp/camera-test.out -t 1000000 &> /dev/null + cp /tmp/camera-test.out /tmp/camera-test.out.$err_num + err_num=$(($err_num + 1)) + fi + byte_cnt=`echo $res | cut -f 3 -d ' '` + send=$(($send + $byte_cnt * 4)) + errors=$(($errors + $err_cnt * 4)) + else + failed=$(($failed + 1)) + fi + + i=$((i + 1)) + if [ $i -eq $print_iters ]; then + echo "Data send: $send bytes, Errors: $errors bytes, Failed exchanges: $failed" +# pci -r 0x9070 -s 4 + i=1 + fi +done diff --git a/tests/ipecamera/tests/run-and-decode-test.sh b/tests/ipecamera/tests/run-and-decode-test.sh new file mode 100755 index 0000000..d355475 --- /dev/null +++ b/tests/ipecamera/tests/run-and-decode-test.sh @@ -0,0 +1,103 @@ +#! /bin/bash + +location=/mnt/fast/ +#location="./" +duration=10000000 +wait_frame=1000000 + +TESTS_PATH="`dirname \"$0\"`" +TESTS_PATH="`( cd \"$TESTS_PATH\" && pwd )`" + +function pci { + PCILIB_PATH=$TESTS_PATH/.. + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +function stop { + usleep $duration + pci -w control 0x201 &> /dev/null +} + +function reset { + pci -r 0x9000 -s 256 > $1.status + $TESTS_PATH/ipecamera/Reset_Init_all_reg_10bit.sh &> $1.reset +} + + +$TESTS_PATH/ipecamera/cfg/Reset_Init_all_reg_10bit.sh &> /dev/null +$TESTS_PATH/ipecamera/frame.sh &> /dev/null +rm -f bench.out + +pci --stop-dma +pci --start-dma dma1 + + +pci -r dma1 -s 16777216 --multipacket -o /dev/null &> /dev/null + +pci -r dma1 -s 1 | grep -i "Error (62)" &> /dev/null +if [ $? -ne 0 ]; then + echo "There is data on dma..." + exit +fi + +echo "Starting ... " + +decode_failures=0 +failures=0 +failed=0 +frames=0 +fpga_failures=0 +cmosis_failures=0 +frame_rate_failures=0 + +iter=0 +while [ 1 ]; do + pci -w control 0xa01 &> /dev/null + stop & + + output="$location/test$iter.out" + rm -f $output + pci -r dma1 -o $output --wait --multipacket -t $wait_frame &> /dev/null + + killall -9 usleep &> /dev/null + usleep 100000 + pci -w control 0x201 &> /dev/null + + if [ -f $output ]; then + result=`ipedec -d -v --continue $output 2>&1 | grep -iE "failed|decoded"` + cur_failed=`echo $result | wc -l` + cur_decoded=`echo $result | tail -n 1 | grep -i decoded` + if [ $? -ne 0 -o $cur_failed -eq 0 ]; then + ipedec -d -v --continue $output > $output.decode + decode_failures=$(($decode_failures + 1)) + reset $output + else + cur_failed=$(($cur_failed - 1)) + cur_frames=`echo $cur_decoded | cut -f 2 -d ' '` + failed=$(($failed + $cur_failed)) + frames=$(($frames + $cur_frames)) + fpga_status=`pci -r 0x9054 | awk '{print $2;}' | cut -c 2` + cmosis_status=`pci -r 0x9050 | awk '{print $2;}' | cut -c 3-4` + if [ "$fpga_status" != "f" ]; then + fpga_failures=$(($fpga_failures + 1)) + reset $output + elif [ "$cmosis_status" == "7d" ]; then + cmosis_failures=$(($cmosis_failures + 1)) + reset $output + elif [ $cur_frames -lt 10 ]; then + frame_rate_failures=$(($frame_rate_failures + 1)) + reset $output + elif [ $cur_failed -eq 0 ]; then + rm -f $output + else + reset $output + fi + fi + else + failures=$(($failures + 1)) + reset $output + fi + + 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" + iter=`expr $iter + 1` +done |