From ef4f563559f195672d07114670a461a7c55ea22b Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 19 Mar 2014 23:12:31 +0100 Subject: Add HEB scripts and re-organize the structure --- tests/bench_ipecamera.sh | 34 --- tests/bench_nwl.sh | 30 -- tests/cleanup.sh | 13 - tests/dma/debug/test-iommu.sh | 19 ++ tests/dma/nwl/bench.sh | 30 ++ tests/dma/nwl/cleanup.sh | 13 + tests/dma/xilinx/xilinx_dma.sh | 121 ++++++++ tests/frame.sh | 36 --- tests/frame2.sh | 37 --- tests/frame_req.sh | 27 -- tests/grabhw.sh | 20 -- tests/heb/DataTaking.sh | 96 ++++++ tests/heb/cfg/BoardOFF.sh | 11 + tests/heb/cfg/BoardOn.sh | 57 ++++ tests/heb/cfg/README | 11 + tests/heb/cfg/Set_ADC_1_Delay.sh | 10 + tests/heb/cfg/Set_ADC_2_Delay.sh | 10 + tests/heb/cfg/Set_ADC_3_Delay.sh | 10 + tests/heb/cfg/Set_ADC_4_Delay.sh | 11 + tests/heb/cfg/Set_Default.sh | 30 ++ tests/heb/cfg/Set_Delay_chip.sh | 11 + tests/heb/cfg/Set_FPGA_clock_delay.sh | 10 + tests/heb/cfg/Set_TH_Delay.sh | 10 + tests/heb/debug/debug.sh | 45 +++ tests/heb/debug/request_data.sh | 27 ++ tests/incomplete.sh | 37 --- tests/ipecamera/Reset_Init_all_reg_10bit.sh | 326 --------------------- tests/ipecamera/Reset_Init_all_reg_10bit_4Mp.sh | 325 -------------------- tests/ipecamera/Reset_Init_all_reg_11bit.sh | 318 -------------------- tests/ipecamera/Reset_Init_all_reg_12bit.sh | 323 -------------------- tests/ipecamera/bench.sh | 34 +++ tests/ipecamera/cfg/Reset_Init_all_reg_10bit.sh | 326 +++++++++++++++++++++ .../ipecamera/cfg/Reset_Init_all_reg_10bit_4Mp.sh | 325 ++++++++++++++++++++ tests/ipecamera/cfg/Reset_Init_all_reg_11bit.sh | 318 ++++++++++++++++++++ tests/ipecamera/cfg/Reset_Init_all_reg_12bit.sh | 323 ++++++++++++++++++++ tests/ipecamera/debug/incomplete.sh | 37 +++ tests/ipecamera/frame.sh | 36 +++ tests/ipecamera/frame_req.sh | 27 ++ tests/ipecamera/grab-hwtrigger.sh | 20 ++ tests/ipecamera/stimuli.sh | 30 ++ tests/ipecamera/tests/loopback-test.sh | 87 ++++++ tests/ipecamera/tests/run-and-decode-test.sh | 103 +++++++ tests/loopback-test.sh | 87 ------ tests/run-and-decode-test.sh | 103 ------- tests/stimuli.sh | 30 -- tests/xilinx_dma.sh | 121 -------- 46 files changed, 2198 insertions(+), 1867 deletions(-) delete mode 100755 tests/bench_ipecamera.sh delete mode 100755 tests/bench_nwl.sh delete mode 100755 tests/cleanup.sh create mode 100755 tests/dma/debug/test-iommu.sh create mode 100755 tests/dma/nwl/bench.sh create mode 100755 tests/dma/nwl/cleanup.sh create mode 100755 tests/dma/xilinx/xilinx_dma.sh delete mode 100755 tests/frame.sh delete mode 100755 tests/frame2.sh delete mode 100755 tests/frame_req.sh delete mode 100755 tests/grabhw.sh create mode 100755 tests/heb/DataTaking.sh create mode 100755 tests/heb/cfg/BoardOFF.sh create mode 100755 tests/heb/cfg/BoardOn.sh create mode 100644 tests/heb/cfg/README create mode 100755 tests/heb/cfg/Set_ADC_1_Delay.sh create mode 100755 tests/heb/cfg/Set_ADC_2_Delay.sh create mode 100755 tests/heb/cfg/Set_ADC_3_Delay.sh create mode 100755 tests/heb/cfg/Set_ADC_4_Delay.sh create mode 100755 tests/heb/cfg/Set_Default.sh create mode 100755 tests/heb/cfg/Set_Delay_chip.sh create mode 100755 tests/heb/cfg/Set_FPGA_clock_delay.sh create mode 100755 tests/heb/cfg/Set_TH_Delay.sh create mode 100755 tests/heb/debug/debug.sh create mode 100755 tests/heb/debug/request_data.sh delete mode 100755 tests/incomplete.sh delete mode 100755 tests/ipecamera/Reset_Init_all_reg_10bit.sh delete mode 100755 tests/ipecamera/Reset_Init_all_reg_10bit_4Mp.sh delete mode 100755 tests/ipecamera/Reset_Init_all_reg_11bit.sh delete mode 100755 tests/ipecamera/Reset_Init_all_reg_12bit.sh create mode 100755 tests/ipecamera/bench.sh create mode 100755 tests/ipecamera/cfg/Reset_Init_all_reg_10bit.sh create mode 100755 tests/ipecamera/cfg/Reset_Init_all_reg_10bit_4Mp.sh create mode 100755 tests/ipecamera/cfg/Reset_Init_all_reg_11bit.sh create mode 100755 tests/ipecamera/cfg/Reset_Init_all_reg_12bit.sh create mode 100755 tests/ipecamera/debug/incomplete.sh create mode 100755 tests/ipecamera/frame.sh create mode 100755 tests/ipecamera/frame_req.sh create mode 100755 tests/ipecamera/grab-hwtrigger.sh create mode 100755 tests/ipecamera/stimuli.sh create mode 100755 tests/ipecamera/tests/loopback-test.sh create mode 100755 tests/ipecamera/tests/run-and-decode-test.sh delete mode 100755 tests/loopback-test.sh delete mode 100755 tests/run-and-decode-test.sh delete mode 100755 tests/stimuli.sh delete mode 100755 tests/xilinx_dma.sh (limited to 'tests') diff --git a/tests/bench_ipecamera.sh b/tests/bench_ipecamera.sh deleted file mode 100755 index 09edae9..0000000 --- a/tests/bench_ipecamera.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/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/bench_nwl.sh b/tests/bench_nwl.sh deleted file mode 100755 index b36c251..0000000 --- a/tests/bench_nwl.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -function pci { - PCILIB_PATH="/root/pcitool" - LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* -} - -size=16 -bytes=`expr $size "*" 4` - -pci -w xrawdata_packet_length $bytes -pci -w xrawdata_enable_loopback 0 -pci -w xrawdata_enable_generator 0 - -pci --start-dma dma1 - -while [ $? -eq 0 ]; do - pci -r dma1 -s 65536 &> /dev/null -done - -pci -w xrawdata_enable_loopback 1 - -for i in `seq 1 10`; do - pci -w dma1 -s $size "*$i" - pci -r dma1 -s $size -o bench.out -done - -pci --stop-dma dma1 - -pci -w xrawdata_enable_loopback 0 diff --git a/tests/cleanup.sh b/tests/cleanup.sh deleted file mode 100755 index 5ef568e..0000000 --- a/tests/cleanup.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -function pci { - PCILIB_PATH="/root/pcitool" - LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* -} - -pci --start-dma dma1r -pci -w dma1r_reset_request 1 -pci -w dma1r_reset 1 -pci -r dma1r_running - -pci --free-kernel-memory dma diff --git a/tests/dma/debug/test-iommu.sh b/tests/dma/debug/test-iommu.sh new file mode 100755 index 0000000..74e3ece --- /dev/null +++ b/tests/dma/debug/test-iommu.sh @@ -0,0 +1,19 @@ +#! /bin/bash + +i=1 +while [ 1 ]; do + pci --start-dma dma1r + for name in /sys/class/fpga/fpga0/kbuf*; do + bus_addr=0x`cat $name | grep "bus addr" | cut -d ':' -f 2 | sed -e 's/\s\+//g'` + if [ $((bus_addr % 4096)) -ne 0 ]; then + + echo "Failed at iteration $i, $name" + echo "----------------------" + cat $name + exit + fi + + done + pci --stop-dma dma1r + i=$((i + 1)) +done diff --git a/tests/dma/nwl/bench.sh b/tests/dma/nwl/bench.sh new file mode 100755 index 0000000..b36c251 --- /dev/null +++ b/tests/dma/nwl/bench.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +function pci { + PCILIB_PATH="/root/pcitool" + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +size=16 +bytes=`expr $size "*" 4` + +pci -w xrawdata_packet_length $bytes +pci -w xrawdata_enable_loopback 0 +pci -w xrawdata_enable_generator 0 + +pci --start-dma dma1 + +while [ $? -eq 0 ]; do + pci -r dma1 -s 65536 &> /dev/null +done + +pci -w xrawdata_enable_loopback 1 + +for i in `seq 1 10`; do + pci -w dma1 -s $size "*$i" + pci -r dma1 -s $size -o bench.out +done + +pci --stop-dma dma1 + +pci -w xrawdata_enable_loopback 0 diff --git a/tests/dma/nwl/cleanup.sh b/tests/dma/nwl/cleanup.sh new file mode 100755 index 0000000..5ef568e --- /dev/null +++ b/tests/dma/nwl/cleanup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +function pci { + PCILIB_PATH="/root/pcitool" + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +pci --start-dma dma1r +pci -w dma1r_reset_request 1 +pci -w dma1r_reset 1 +pci -r dma1r_running + +pci --free-kernel-memory dma diff --git a/tests/dma/xilinx/xilinx_dma.sh b/tests/dma/xilinx/xilinx_dma.sh new file mode 100755 index 0000000..6aada8b --- /dev/null +++ b/tests/dma/xilinx/xilinx_dma.sh @@ -0,0 +1,121 @@ +#! /bin/bash + +BAR=0 +USE=1 +ITERATIONS=2 +BUFFERS=16 + +function pci { + PCILIB_PATH=`pwd`/.. + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + + +function reset { + pci -b $BAR -w 0 1 + usleep 1000 + pci -b $BAR -w 0 0 + pci -b $BAR -w 4 0 +} + +function read_cfg { +# echo $1 1>&2 + pci -a config -r 0x$1 | awk '{ print $2; }' +} + +function parse_config { + info=0x`pci -b $BAR -r 0 | awk '{ print $2; }'` + model=`printf "%X" $((info>>24))` + if [ $model -eq 14 ]; then + model="Xilinx Virtex-6" + else + model="Xilinx $model" + fi + version=$(((info >> 8) & 0xFF)) + data_width=$((16 * (2 ** ((info >> 16) & 0xF)))) + + echo "$model, build $version, $data_width bits" + + + next=`read_cfg 34 | cut -c 7-8` + + while [ $next -ne 0 ]; do + cap=`read_cfg $next` + capid=`echo $cap | cut -c 7-8` + if [ $capid -eq 10 ]; then + addr=`printf "%X" $((0x$next + 12))` + pcie_link1=`read_cfg $addr` + addr=`printf "%X" $((0x$next + 16))` + pcie_link2=`read_cfg $addr` + + link_speed=$((((0x$pcie_link2 & 0xF0000) >> 16))) + link_width=$((((0x$pcie_link2 & 0x3F00000) >> 20))) + + dev_link_speed=$((((0x$pcie_link1 & 0xF)))) + dev_link_width=$((((0x$pcie_link1 & 0x3F0) >> 4))) + fi + next=`echo $cap | cut -c 5-6` + done + + echo "Link: PCIe gen$link_speed x$link_width" + if [ $link_speed -ne $dev_link_speed -o $link_width -ne $dev_link_width ]; then + echo " * But device capable of gen$dev_link_speed x$dev_link_width" + fi + + info=0x`read_cfg 40` + max_tlp=$((2 ** (5 + ((info & 0xE0) >> 5)))) + echo "TLP: 32 dwords (transfering 32 TLP per request)" + if [ $max_tlp -ne 32 ]; then + echo " * But device is able to transfer TLP up to $max_tlp bytes" + fi + + # 2500 MT/s, but PCIe gen1 and gen2 uses 10 bit encoding + speed=$((link_width * link_speed * 2500 / 10)) +} + +reset +parse_config + +pci --enable-irq +pci --acknowledge-irq + +pci --free-kernel-memory $USE +pci --alloc-kernel-memory $USE --type c2s -s $BUFFERS +bus=`pci --list-kernel-memory 00100001 | awk '{ print $4; }' | grep 00` +#ptr=`pci --list-kernel-memory 00100001 | awk '{ print $2; }' | grep 00` + +# TLP size +pci -b $BAR -w 0x0C 0x20 +# TLP count +pci -b $BAR -w 0x10 0x20 +# Data +pci -b $BAR -w 0x14 0x13131313 + +dmaperf=0 +for i in `seq 1 $ITERATIONS`; do + for addr in $bus; do + pci -b $BAR -w 0x08 0x$addr + +#Trigger + pci -b $BAR -w 0x04 0x01 + pci --wait-irq +# pci -b $BAR -w 0x04 0x00 + + status=`pci -b $BAR -r 0x04 | awk '{print $2; }' | cut -c 5-8` + if [ $status != "0101" ]; then + echo "Read failed, invalid status: $status" + fi + + dmaperf=$((dmaperf + 0x`pci -b $BAR -r 0x28 | awk '{print $2}'`)) + reset + done +done + +pci --free-kernel-memory $USE +pci --disable-irq + +echo +# Don't ask me about this formula +echo "Performance reported by FPGA: $((4096 * BUFFERS * ITERATIONS * $speed / $dmaperf / 8)) MB/s" + +#pci -b $BAR -r 0 -s 32 diff --git a/tests/frame.sh b/tests/frame.sh deleted file mode 100755 index 679817b..0000000 --- a/tests/frame.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/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/frame2.sh b/tests/frame2.sh deleted file mode 100755 index 2795caf..0000000 --- a/tests/frame2.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/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 1000 -pci -w control 1e1 -usleep 300000 -pci -w control 1e9 -usleep 1000 -pci -w control 1e1 -usleep 3000 - -echo "Enable Readout ... " -pci -w control 3e1 - -usleep 100000 - -pci -r dma1 -o bench.out --multipacket --timeout 1000000 - -pci -w control 1e1 - -pci --stop-dma dma1 - diff --git a/tests/frame_req.sh b/tests/frame_req.sh deleted file mode 100755 index bce89c3..0000000 --- a/tests/frame_req.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/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/grabhw.sh b/tests/grabhw.sh deleted file mode 100755 index 0279ab4..0000000 --- a/tests/grabhw.sh +++ /dev/null @@ -1,20 +0,0 @@ -#! /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/heb/DataTaking.sh b/tests/heb/DataTaking.sh new file mode 100755 index 0000000..b6046d7 --- /dev/null +++ b/tests/heb/DataTaking.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +#Channel 1 --> 05 +#Channel 2 --> 0B +#Channel 1&2 --> 0F +#Channel 3 --> 13 +#Channel 4 --> 23 +#Channel 3&4 --> 33 +#ALL --> 3F + +#rm *.out +pci -r dma1 --multipacket -o /dev/null + +echo "Start DMA ..... " +#pci --start-dma dma1 +sleep 0.2 + +echo "Data Reset ... " +pci -w 0x9040 000003f1 +sleep 0.1 +pci -w 0x9040 000003f0 + +sleep 0.1 +#echo "Pilot bunch emulator ..... " +#pci -w 0x9040 400003f0 +sleep 0.2 +pci -w 0x9040 03f0 +#pci -r 0x9000 -s 40 +#sleep 0.2 +echo "Start data pci. ..... " +pci -w 0x9040 00bf0 + +sleep 2 + +echo "Stop data acquis...... " +pci -w 0x9040 003f0 +pci -r 0x9000 -s 40 +sleep 0.1 +echo "Enable data transfer.... " +pci -w 0x9040 007f0 +exit +sleep 2 +pci -r dma1 -o run_num_$1.out --multipacket +sleep 2 + +pci -w 0x9040 003f0 +#echo "Status ... " + + + +pci -r 0x9000 -s 40 + + status=`pci -r 0x9050 -s 1 | awk '{print $2$3$4}'` + if [ "$status" != "85000021" ]; then + echo "--------------------------------->>>> ERROR! ... " + error=1 + exit + else + echo " Status 1 -> OK " + fi + + status=`pci -r 0x9000 -s 1 | awk '{print $2$3$4}'` + if [ "$status" != "01000021" ]; then + echo "--------------------------------->>>> ERROR! ... " + error=1 + exit + else + echo " Status 1 Readout -> OK " + fi + +status=`pci -r 0x9008 -s 1 | awk '{print $2$3$4}'` + if [ "$status" != "01000021" ]; then + echo "--------------------------------->>>> ERROR! ... " + error=1 + exit + else + echo " Status 2 Readout -> OK " + fi + +status=`pci -r 0x9010 -s 1 | awk '{print $2$3$4}'` + if [ "$status" != "01000021" ]; then + echo "--------------------------------->>>> ERROR! ... " + error=1 + exit + else + echo " Status 3 Readout -> OK " + fi + +status=`pci -r 0x9018 -s 1 | awk '{print $2$3$4}'` + if [ "$status" != "01000021" ]; then + echo "--------------------------------->>>> ERROR! ... " + error=1 + exit + else + echo " Status 4 Readout -> OK " + fi diff --git a/tests/heb/cfg/BoardOFF.sh b/tests/heb/cfg/BoardOFF.sh new file mode 100755 index 0000000..351bcb8 --- /dev/null +++ b/tests/heb/cfg/BoardOFF.sh @@ -0,0 +1,11 @@ +#!/bin/bash + + +echo " ************************************************************** " +echo " Board OFF" +echo " ************************************************************** " + +pci -w 0x9040 0x01 +sleep 0.5 + +pci --stop-dma dma1 diff --git a/tests/heb/cfg/BoardOn.sh b/tests/heb/cfg/BoardOn.sh new file mode 100755 index 0000000..b14c73b --- /dev/null +++ b/tests/heb/cfg/BoardOn.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +echo " ************************************************************** " +echo " Start DMA" +echo " ************************************************************** " + +pci --start-dma dma1 +sleep 0.5 +pci --list-dma-engines + + +echo " ************************************************************** " +echo " Board ON procedure" +echo " ************************************************************** " + +pci -w 0x9040 0x01 +sleep 1 + +echo "switch ON the power supply --> FIRST <--" +echo "Press a key to continue ...." +read -n 1 -s + +echo "Switch ON T/Hs" +pci -w 0x9040 0x3C1 +pci -r 0x9040 -s1 + +echo "switch ON the power supply --> SECOND <--" +echo "Press a key to continue ...." +read -n 1 -s + +echo "Switch ON ADCs" +pci -w 0x9040 0x3F1 +pci -r 0x9040 -s1 +sleep 0.1 + + +pci -w 0x9040 0x3F0 +pci -r 0x9040 -s1 +sleep 1 + +echo " Status ................... " +pci -r 0x9000 -s 40 + + + +./PLL_conf_calib_3001.sh + +echo " Status ................... " +pci -r 0x9000 -s 40 + + +echo " ************************************************************** " +echo " Board Ready" +echo " ************************************************************** " + + +echo " --> remember to run: ./Set_Default.sh" diff --git a/tests/heb/cfg/README b/tests/heb/cfg/README new file mode 100644 index 0000000..125bc0d --- /dev/null +++ b/tests/heb/cfg/README @@ -0,0 +1,11 @@ + - Initializing + ./BoardOn.sh + ./Set_Default.sh + + - Configuring the size + pci -w 9020 0x20 (linear scale) + + * Number of samples are determined by 0x9020 / 0x9028 (0x0e by default) + * For each sample is descibed by (184 / 2) * 128 bits + * Where most-significant bytes of 4 dwords (128 bit) are iterating + from 0x00 to 0xb8 with step 0x02 diff --git a/tests/heb/cfg/Set_ADC_1_Delay.sh b/tests/heb/cfg/Set_ADC_1_Delay.sh new file mode 100755 index 0000000..bd8f980 --- /dev/null +++ b/tests/heb/cfg/Set_ADC_1_Delay.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "Set CH_4 clock ADC 1 delay... " + +upfix=000501 +fixed=4 + + hex_val=$(printf "%01x\n" $1) + echo "Set $hex_val --> Time value picosecond = `expr $1 "*" 150`." + pci -w 0x9060 $upfix$hex_val$fixed diff --git a/tests/heb/cfg/Set_ADC_2_Delay.sh b/tests/heb/cfg/Set_ADC_2_Delay.sh new file mode 100755 index 0000000..d6cdf75 --- /dev/null +++ b/tests/heb/cfg/Set_ADC_2_Delay.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "Set CH_5 clock ADC 2 delay... " + +upfix=000501 +fixed=5 + + hex_val=$(printf "%01x\n" $1) + echo "Set $hex_val --> Time value picosecond = `expr $1 "*" 150`." + pci -w 0x9060 $upfix$hex_val$fixed diff --git a/tests/heb/cfg/Set_ADC_3_Delay.sh b/tests/heb/cfg/Set_ADC_3_Delay.sh new file mode 100755 index 0000000..567b977 --- /dev/null +++ b/tests/heb/cfg/Set_ADC_3_Delay.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "Set CH_6 clock ADC 3 delay... " + +upfix=000501 +fixed=6 + + hex_val=$(printf "%01x\n" $1) + echo "Set $hex_val --> Time value picosecond = `expr $1 "*" 150`." + pci -w 0x9060 $upfix$hex_val$fixed diff --git a/tests/heb/cfg/Set_ADC_4_Delay.sh b/tests/heb/cfg/Set_ADC_4_Delay.sh new file mode 100755 index 0000000..d666595 --- /dev/null +++ b/tests/heb/cfg/Set_ADC_4_Delay.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +echo "Set CH_7 clock ADC 4 delay... " + +upfix=000501 +fixed=7 + + hex_val=$(printf "%01x\n" $1) + echo "Set $hex_val --> Time value picosecond = `expr $1 "*" 150`." + pci -w 0x9060 $upfix$hex_val$fixed + diff --git a/tests/heb/cfg/Set_Default.sh b/tests/heb/cfg/Set_Default.sh new file mode 100755 index 0000000..0149bf0 --- /dev/null +++ b/tests/heb/cfg/Set_Default.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +echo "Set Defaults delay value in the board... " + +./Set_FPGA_clock_delay.sh 0 +sleep 0.1 + + ./Set_Delay_chip.sh 16 16 16 16 +sleep 0.1 + +./Set_TH_Delay.sh 12 +sleep 0.1 + +./Set_ADC_1_Delay.sh 5 +sleep 0.1 + +./Set_ADC_2_Delay.sh 5 +sleep 0.1 + +./Set_ADC_3_Delay.sh 5 +sleep 0.1 + +./Set_ADC_4_Delay.sh 5 + +#pci -w 0x9020 200b20 +pci -w 0x9020 20 +pci -w 0x9028 e + +echo " DONE ................ " + diff --git a/tests/heb/cfg/Set_Delay_chip.sh b/tests/heb/cfg/Set_Delay_chip.sh new file mode 100755 index 0000000..3d15cad --- /dev/null +++ b/tests/heb/cfg/Set_Delay_chip.sh @@ -0,0 +1,11 @@ +#!/bin/bash + + zero=0 + hex_val1=$(printf "%02x\n" $1) + hex_val2=$(printf "%02x\n" $2) + hex_val3=$(printf "%02x\n" $3) + hex_val4=$(printf "%02x\n" $4) + + pci -w 0x9080 $zero$hex_val4$hex_val3$hex_val2$hex_val1 + pci -r 0x9080 -s 1 + sleep 0.5 diff --git a/tests/heb/cfg/Set_FPGA_clock_delay.sh b/tests/heb/cfg/Set_FPGA_clock_delay.sh new file mode 100755 index 0000000..f4d0f46 --- /dev/null +++ b/tests/heb/cfg/Set_FPGA_clock_delay.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "Set delay on T/Hs signals... " + +upfix=000501 +fixed=0 + + hex_val=$(printf "%01x\n" $1) + echo "Set $hex_val --> Time picosecond = `expr $1 "*" 150`." + pci -w 0x9060 $upfix$hex_val$fixed diff --git a/tests/heb/cfg/Set_TH_Delay.sh b/tests/heb/cfg/Set_TH_Delay.sh new file mode 100755 index 0000000..9a6e58f --- /dev/null +++ b/tests/heb/cfg/Set_TH_Delay.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "Set delay on T/Hs signals... " + +upfix=000501 +fixed=3 + + hex_val=$(printf "%01x\n" $1) + echo "Set $hex_val --> Time picosecond = `expr $1 "*" 150`." + pci -w 0x9060 $upfix$hex_val$fixed diff --git a/tests/heb/debug/debug.sh b/tests/heb/debug/debug.sh new file mode 100755 index 0000000..2db21d4 --- /dev/null +++ b/tests/heb/debug/debug.sh @@ -0,0 +1,45 @@ +#! /bin/bash + +SCRIPT_PATH="`dirname \"$0\"`" +SCRIPT_PATH="`( cd \"$TESTS_PATH\" && pwd )`" +PCILIB_PATH=${SCRIPT_PATH%/tests/*} + +function pci { + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* +} + +function strip_bad_values { + LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/apps/heb_strip_bad_values $* +} + +function request_data { + $PCILIB_PATH/tests/heb/debug/request_data.sh $* +} + +while [ 1 ]; do + from=`pci --list-dma-engines | grep C2S | sed -s 's/\s\+/ /g' | cut -d ' ' -f 6` + to=`pci --list-dma-engines | grep C2S | sed -s 's/\s\+/ /g' | cut -d ' ' -f 8` + + if [ $from -gt $to ]; then + buffers="`seq $from 255` `seq 0 $to`" + else + buffers=`seq $from $to` + fi + + echo $buffers + + rm data.out + for i in $buffers; do + pci --read-dma-buffer dma1r:$i -o data.out + done + + + error=`strip_bad_values data.out | head -n 1 | cut -f 1 -d ':'` + if [ $error != "0x1140" ]; then + echo "Problems found" + exit + else + echo "Fine" + request_data + fi +done diff --git a/tests/heb/debug/request_data.sh b/tests/heb/debug/request_data.sh new file mode 100755 index 0000000..b751f5d --- /dev/null +++ b/tests/heb/debug/request_data.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +pci -r dma1 --multipacket -o /dev/null + +#echo "Data Reset ... " +pci -w 0x9040 000003f1 +sleep 0.1 +pci -w 0x9040 000003f0 + +sleep 0.1 +#echo "Pilot bunch emulator ..... " +#pci -w 0x9040 400003f0 +sleep 0.2 +pci -w 0x9040 03f0 +#pci -r 0x9000 -s 40 +#sleep 0.2 +#echo "Start data pci. ..... " +pci -w 0x9040 00bf0 + +sleep 2 + +#echo "Stop data acquis...... " +pci -w 0x9040 003f0 +pci -r 0x9000 -s 40 +sleep 0.1 +#echo "Enable data transfer.... " +pci -w 0x9040 007f0 diff --git a/tests/incomplete.sh b/tests/incomplete.sh deleted file mode 100755 index 5c80198..0000000 --- a/tests/incomplete.sh +++ /dev/null @@ -1,37 +0,0 @@ -#! /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/Reset_Init_all_reg_10bit.sh b/tests/ipecamera/Reset_Init_all_reg_10bit.sh deleted file mode 100755 index f4afa06..0000000 --- a/tests/ipecamera/Reset_Init_all_reg_10bit.sh +++ /dev/null @@ -1,326 +0,0 @@ -#!/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 1088 -#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 ... " - echo " $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_10bit_4Mp.sh b/tests/ipecamera/Reset_Init_all_reg_10bit_4Mp.sh deleted file mode 100755 index 5a4e582..0000000 --- a/tests/ipecamera/Reset_Init_all_reg_10bit_4Mp.sh +++ /dev/null @@ -1,325 +0,0 @@ -#!/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/Reset_Init_all_reg_11bit.sh deleted file mode 100755 index 3c4af0e..0000000 --- a/tests/ipecamera/Reset_Init_all_reg_11bit.sh +++ /dev/null @@ -1,318 +0,0 @@ -#!/bin/bash - -###################### by Michele Caselle and Uros Stafanovic ################################################## -############ Resent procedure and camera initialization for 12 -bit mode ###################################### - -error=0 -echo " Reset Readout and CMOSIS " -pci -w 0x9040 1e4 -sleep .1 -echo " Release Reset for Readout" -pci -w 0x9040 1e0 -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 " 11 - 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 " 11 bit mode, set ADC resolution 11 bits " -val=f001 # 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=ab02 -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 201 -sleep 0.01 -########################## WRITE THE READOUT NUMBER OF LINE ####################################################### -pci -w cmosis_number_lines 1088 -#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 -######################################################################################################## -#pci -w 0x9000 0xc802 -##pci -w 0x9000 0xc803 -sleep 0.01 -val=c802 -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 - -################################################## -#SET the max number of frame in DDR -pci -w 0x91a0 0x1C - -sleep 0.01 -#pci -w 0x9000 0xd011 -sleep 0.01 -#pci -r 0x9000 -s 10 - -sleep 0.01 -#pci -w 0x9000 0xd111 -#pci -r 0x9000 -s 10 -######################################################################################################### -sleep 0.01 - -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 resetand 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_12bit.sh b/tests/ipecamera/Reset_Init_all_reg_12bit.sh deleted file mode 100755 index b04f2cd..0000000 --- a/tests/ipecamera/Reset_Init_all_reg_12bit.sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/bash - -###################### by Michele Caselle and Uros Stafanovic ################################################## -############ Resent procedure and camera initialization for 12 -bit mode ###################################### - -error=0 -echo " Reset Readout and CMOSIS " -pci -w 0x9040 1e4 -sleep .1 -echo " Release Reset for Readout" -pci -w 0x9040 1e0 -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 " 12 - 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 " 12 bit mode, set ADC resolution 12 bits " -val=f002 # 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=aa0f -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 201 -sleep 0.01 -########################## WRITE THE READOUT NUMBER OF LINE ####################################################### -pci -w cmosis_number_lines 1088 -#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 -######################################################################################################## -#pci -w 0x9000 0xc802 -##pci -w 0x9000 0xc803 -sleep 0.01 -val=c802 -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 - -################################################## -#SET the max number of frame in DDR -pci -w 0x91a0 0x1C - - -#pci -w 0x9000 0xd011 -sleep 0.01 -pci -r 0x9000 -s 10 - -sleep 0.01 -#pci -w 0x9000 0xd111 -sleep 0.01 -pci -r 0x9000 -s 10 -######################################################################################################### -sleep 0.1 - -status=`pci -r 0x9050 -s 4 | awk '{print $2$3$4}'` -if [ "$status" != "844950280f0010013ffff111" ]; then - - echo "--------------------------------->>>> ERROR! in the camera status ... " - echo $status - error=1 - # exit -fi - -#echo "--> $status" - -if [ "$error" = "1" ]; then - echo " Error in the resetand 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/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/cfg/Reset_Init_all_reg_10bit.sh b/tests/ipecamera/cfg/Reset_Init_all_reg_10bit.sh new file mode 100755 index 0000000..f4afa06 --- /dev/null +++ b/tests/ipecamera/cfg/Reset_Init_all_reg_10bit.sh @@ -0,0 +1,326 @@ +#!/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 1088 +#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 ... " + echo " $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/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/cfg/Reset_Init_all_reg_11bit.sh b/tests/ipecamera/cfg/Reset_Init_all_reg_11bit.sh new file mode 100755 index 0000000..3c4af0e --- /dev/null +++ b/tests/ipecamera/cfg/Reset_Init_all_reg_11bit.sh @@ -0,0 +1,318 @@ +#!/bin/bash + +###################### by Michele Caselle and Uros Stafanovic ################################################## +############ Resent procedure and camera initialization for 12 -bit mode ###################################### + +error=0 +echo " Reset Readout and CMOSIS " +pci -w 0x9040 1e4 +sleep .1 +echo " Release Reset for Readout" +pci -w 0x9040 1e0 +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 " 11 - 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 " 11 bit mode, set ADC resolution 11 bits " +val=f001 # 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=ab02 +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 201 +sleep 0.01 +########################## WRITE THE READOUT NUMBER OF LINE ####################################################### +pci -w cmosis_number_lines 1088 +#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 +######################################################################################################## +#pci -w 0x9000 0xc802 +##pci -w 0x9000 0xc803 +sleep 0.01 +val=c802 +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 + +################################################## +#SET the max number of frame in DDR +pci -w 0x91a0 0x1C + +sleep 0.01 +#pci -w 0x9000 0xd011 +sleep 0.01 +#pci -r 0x9000 -s 10 + +sleep 0.01 +#pci -w 0x9000 0xd111 +#pci -r 0x9000 -s 10 +######################################################################################################### +sleep 0.01 + +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 resetand 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/cfg/Reset_Init_all_reg_12bit.sh b/tests/ipecamera/cfg/Reset_Init_all_reg_12bit.sh new file mode 100755 index 0000000..b04f2cd --- /dev/null +++ b/tests/ipecamera/cfg/Reset_Init_all_reg_12bit.sh @@ -0,0 +1,323 @@ +#!/bin/bash + +###################### by Michele Caselle and Uros Stafanovic ################################################## +############ Resent procedure and camera initialization for 12 -bit mode ###################################### + +error=0 +echo " Reset Readout and CMOSIS " +pci -w 0x9040 1e4 +sleep .1 +echo " Release Reset for Readout" +pci -w 0x9040 1e0 +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 " 12 - 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 " 12 bit mode, set ADC resolution 12 bits " +val=f002 # 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=aa0f +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 201 +sleep 0.01 +########################## WRITE THE READOUT NUMBER OF LINE ####################################################### +pci -w cmosis_number_lines 1088 +#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 +######################################################################################################## +#pci -w 0x9000 0xc802 +##pci -w 0x9000 0xc803 +sleep 0.01 +val=c802 +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 + +################################################## +#SET the max number of frame in DDR +pci -w 0x91a0 0x1C + + +#pci -w 0x9000 0xd011 +sleep 0.01 +pci -r 0x9000 -s 10 + +sleep 0.01 +#pci -w 0x9000 0xd111 +sleep 0.01 +pci -r 0x9000 -s 10 +######################################################################################################### +sleep 0.1 + +status=`pci -r 0x9050 -s 4 | awk '{print $2$3$4}'` +if [ "$status" != "844950280f0010013ffff111" ]; then + + echo "--------------------------------->>>> ERROR! in the camera status ... " + echo $status + error=1 + # exit +fi + +#echo "--> $status" + +if [ "$error" = "1" ]; then + echo " Error in the resetand 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/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 diff --git a/tests/loopback-test.sh b/tests/loopback-test.sh deleted file mode 100755 index 09bfc82..0000000 --- a/tests/loopback-test.sh +++ /dev/null @@ -1,87 +0,0 @@ -#! /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/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/run-and-decode-test.sh b/tests/run-and-decode-test.sh deleted file mode 100755 index 5bf6513..0000000 --- a/tests/run-and-decode-test.sh +++ /dev/null @@ -1,103 +0,0 @@ -#! /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/Reset_Init_all_reg_10bit.sh &> /dev/null -/root/pcitool/tests/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 diff --git a/tests/stimuli.sh b/tests/stimuli.sh deleted file mode 100755 index 33e99e1..0000000 --- a/tests/stimuli.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/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/xilinx_dma.sh b/tests/xilinx_dma.sh deleted file mode 100755 index 6aada8b..0000000 --- a/tests/xilinx_dma.sh +++ /dev/null @@ -1,121 +0,0 @@ -#! /bin/bash - -BAR=0 -USE=1 -ITERATIONS=2 -BUFFERS=16 - -function pci { - PCILIB_PATH=`pwd`/.. - LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $* -} - - -function reset { - pci -b $BAR -w 0 1 - usleep 1000 - pci -b $BAR -w 0 0 - pci -b $BAR -w 4 0 -} - -function read_cfg { -# echo $1 1>&2 - pci -a config -r 0x$1 | awk '{ print $2; }' -} - -function parse_config { - info=0x`pci -b $BAR -r 0 | awk '{ print $2; }'` - model=`printf "%X" $((info>>24))` - if [ $model -eq 14 ]; then - model="Xilinx Virtex-6" - else - model="Xilinx $model" - fi - version=$(((info >> 8) & 0xFF)) - data_width=$((16 * (2 ** ((info >> 16) & 0xF)))) - - echo "$model, build $version, $data_width bits" - - - next=`read_cfg 34 | cut -c 7-8` - - while [ $next -ne 0 ]; do - cap=`read_cfg $next` - capid=`echo $cap | cut -c 7-8` - if [ $capid -eq 10 ]; then - addr=`printf "%X" $((0x$next + 12))` - pcie_link1=`read_cfg $addr` - addr=`printf "%X" $((0x$next + 16))` - pcie_link2=`read_cfg $addr` - - link_speed=$((((0x$pcie_link2 & 0xF0000) >> 16))) - link_width=$((((0x$pcie_link2 & 0x3F00000) >> 20))) - - dev_link_speed=$((((0x$pcie_link1 & 0xF)))) - dev_link_width=$((((0x$pcie_link1 & 0x3F0) >> 4))) - fi - next=`echo $cap | cut -c 5-6` - done - - echo "Link: PCIe gen$link_speed x$link_width" - if [ $link_speed -ne $dev_link_speed -o $link_width -ne $dev_link_width ]; then - echo " * But device capable of gen$dev_link_speed x$dev_link_width" - fi - - info=0x`read_cfg 40` - max_tlp=$((2 ** (5 + ((info & 0xE0) >> 5)))) - echo "TLP: 32 dwords (transfering 32 TLP per request)" - if [ $max_tlp -ne 32 ]; then - echo " * But device is able to transfer TLP up to $max_tlp bytes" - fi - - # 2500 MT/s, but PCIe gen1 and gen2 uses 10 bit encoding - speed=$((link_width * link_speed * 2500 / 10)) -} - -reset -parse_config - -pci --enable-irq -pci --acknowledge-irq - -pci --free-kernel-memory $USE -pci --alloc-kernel-memory $USE --type c2s -s $BUFFERS -bus=`pci --list-kernel-memory 00100001 | awk '{ print $4; }' | grep 00` -#ptr=`pci --list-kernel-memory 00100001 | awk '{ print $2; }' | grep 00` - -# TLP size -pci -b $BAR -w 0x0C 0x20 -# TLP count -pci -b $BAR -w 0x10 0x20 -# Data -pci -b $BAR -w 0x14 0x13131313 - -dmaperf=0 -for i in `seq 1 $ITERATIONS`; do - for addr in $bus; do - pci -b $BAR -w 0x08 0x$addr - -#Trigger - pci -b $BAR -w 0x04 0x01 - pci --wait-irq -# pci -b $BAR -w 0x04 0x00 - - status=`pci -b $BAR -r 0x04 | awk '{print $2; }' | cut -c 5-8` - if [ $status != "0101" ]; then - echo "Read failed, invalid status: $status" - fi - - dmaperf=$((dmaperf + 0x`pci -b $BAR -r 0x28 | awk '{print $2}'`)) - reset - done -done - -pci --free-kernel-memory $USE -pci --disable-irq - -echo -# Don't ask me about this formula -echo "Performance reported by FPGA: $((4096 * BUFFERS * ITERATIONS * $speed / $dmaperf / 8)) MB/s" - -#pci -b $BAR -r 0 -s 32 -- cgit v1.2.3