/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to tests/ipecamera/tests/run-and-decode-test.sh

  • Committer: Suren A. Chilingaryan
  • Date: 2015-04-20 20:01:04 UTC
  • Revision ID: csa@suren.me-20150420200104-b5xny65io8lvoz3w
Big redign of model structures

Show diffs side-by-side

added added

removed removed

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