/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/loopback-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
 
TESTS_PATH="`dirname \"$0\"`" 
4
 
TESTS_PATH="`( cd \"$TESTS_PATH\" && pwd )`"
5
 
 
6
 
function pci {
7
 
    PCILIB_PATH=$TESTS_PATH/..
8
 
    LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci $*
9
 
}
10
 
 
11
 
function compare {
12
 
    PCILIB_PATH=$TESTS_PATH/..
13
 
    LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/apps/compare_to_value $*
14
 
}
15
 
 
16
 
#size=`expr 1024 "*" 1024`
17
 
size=`expr 1024 "*" 1`
18
 
multiplier=2
19
 
wait=0
20
 
 
21
 
/root/pcitool/tests/ipecamera/frame.sh &> /dev/null
22
 
rm -f bench.out
23
 
 
24
 
pci --stop-dma dma1
25
 
pci --start-dma dma1
26
 
 
27
 
pci -r dma1 -s 16777216 --multipacket -o /dev/null &> /dev/null
28
 
 
29
 
pci -r dma1 -s 1024 -o /dev/null | grep -i "Error (62)" &> /dev/null
30
 
if [ $? -ne 0 ]; then
31
 
    echo "There is data on dma..."
32
 
    exit
33
 
fi
34
 
 
35
 
failed=0
36
 
send=0
37
 
errors=0
38
 
err_num=0
39
 
 
40
 
print_iters=`expr 2 + 1024 '*' 100 / $size`
41
 
 
42
 
read_size=`expr $multiplier '*' $size`
43
 
echo "Starting..."
44
 
i=1
45
 
 
46
 
pci -w 0x9040 0x201
47
 
 
48
 
while [ 1 ]; do
49
 
    if [ $wait -gt 0 ]; then
50
 
        pci -w 0x9040 0x1
51
 
    fi
52
 
    
53
 
    pci -w dma1 -s $size "*0x$i"
54
 
    rm -f /tmp/camera-test.out
55
 
    pci -r dma1 --wait --multipacket -s $read_size -o /tmp/camera-test.out -t 1000000 &> /dev/null
56
 
    if [ $wait -gt 0 ]; then
57
 
        wrdone=0
58
 
        while [ $wrdone -eq 0 ]; do
59
 
#           pci --list-dma-engines
60
 
            pci --list-dma-engines | grep "DMA1 S2C" | grep "SD" #&> /dev/null
61
 
            wrdone=$?
62
 
        done
63
 
        pci -w 0x9040 0x201
64
 
    fi
65
 
 
66
 
    res=`compare /tmp/camera-test.out  $read_size "$i" 6 2 6`
67
 
    if [ $? -eq 0 ]; then
68
 
        err_cnt=`echo $res | cut -f 1 -d ' '`
69
 
        if [ "$err_cnt" -ne 0 ]; then
70
 
            pci -r dma1 --wait --multipacket -o /tmp/camera-test.out -t 1000000 &> /dev/null
71
 
            cp /tmp/camera-test.out /tmp/camera-test.out.$err_num
72
 
            err_num=$(($err_num + 1))
73
 
        fi
74
 
        byte_cnt=`echo $res | cut -f 3 -d ' '`
75
 
        send=$(($send + $byte_cnt * 4))
76
 
        errors=$(($errors + $err_cnt * 4))
77
 
    else 
78
 
        failed=$(($failed + 1))
79
 
    fi
80
 
    
81
 
    i=$((i + 1))
82
 
    if [ $i -eq $print_iters ]; then
83
 
        echo "Data send: $send bytes, Errors: $errors bytes, Failed exchanges: $failed"
84
 
#       pci -r 0x9070 -s 4      
85
 
        i=1
86
 
    fi
87
 
done