From e1265fa32837f457ee2c2fa259d12c9545af4bbf Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Mon, 27 Apr 2015 02:28:57 +0200 Subject: First stand-alone ipecamera implementation --- tests/dma/debug/test-iommu.sh | 19 ----- tests/dma/ipe/bench.sh | 40 ---------- tests/dma/nwl/bench.sh | 30 -------- tests/dma/nwl/cleanup.sh | 13 ---- tests/dma/xilinx/xilinx_dma.sh | 121 ------------------------------ tests/dma/xilinx/xilinx_dma_static_mem.sh | 117 ----------------------------- 6 files changed, 340 deletions(-) delete mode 100755 tests/dma/debug/test-iommu.sh delete mode 100755 tests/dma/ipe/bench.sh delete mode 100755 tests/dma/nwl/bench.sh delete mode 100755 tests/dma/nwl/cleanup.sh delete mode 100755 tests/dma/xilinx/xilinx_dma.sh delete mode 100755 tests/dma/xilinx/xilinx_dma_static_mem.sh (limited to 'tests/dma') diff --git a/tests/dma/debug/test-iommu.sh b/tests/dma/debug/test-iommu.sh deleted file mode 100755 index 74e3ece..0000000 --- a/tests/dma/debug/test-iommu.sh +++ /dev/null @@ -1,19 +0,0 @@ -#! /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/ipe/bench.sh b/tests/dma/ipe/bench.sh deleted file mode 100755 index aa7ec25..0000000 --- a/tests/dma/ipe/bench.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -size=65536 - -function pci { - PCILIB_PATH=`pwd`/../../.. - LD_LIBRARY_PATH="$PCILIB_PATH" $PCILIB_PATH/pci -m kapture $* -} - - -rm -f bench.out - -echo "Stopping DMA and skipping exiting data..." -pci --stop-dma dma0r -echo "Starting DMA..." -pci --start-dma dma0r -echo "Enabling data generation..." -pci -w 0x4 0x1 - -# Clean DMA buffers -#while [ $? -eq 0 ]; do -# pci -r dma0 -s 65536 &> /dev/null -#done - -echo "Reading the data from DMA..." -for i in `seq 1 100`; do - pci -r dma0 --multipacket -s $size -o bench.out - if [ $? -ne 0 ]; then - echo "Stopping DMA due to the error..." - pci --stop-dma dma0r - exit - fi -done - -echo "Stopping DMA..." -pci --stop-dma dma0r - -../../../apps/check_counter bench.out - -#pci -r 0 -s 32 diff --git a/tests/dma/nwl/bench.sh b/tests/dma/nwl/bench.sh deleted file mode 100755 index b36c251..0000000 --- a/tests/dma/nwl/bench.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/dma/nwl/cleanup.sh b/tests/dma/nwl/cleanup.sh deleted file mode 100755 index 5ef568e..0000000 --- a/tests/dma/nwl/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/xilinx/xilinx_dma.sh b/tests/dma/xilinx/xilinx_dma.sh deleted file mode 100755 index 6aada8b..0000000 --- a/tests/dma/xilinx/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 diff --git a/tests/dma/xilinx/xilinx_dma_static_mem.sh b/tests/dma/xilinx/xilinx_dma_static_mem.sh deleted file mode 100755 index e3ba0f5..0000000 --- a/tests/dma/xilinx/xilinx_dma_static_mem.sh +++ /dev/null @@ -1,117 +0,0 @@ -#! /bin/bash - -BAR=0 -USE=1 -ITERATIONS=1 -TLP_SIZE=32 -BUFFER_SIZE=8 - -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 $TLP_SIZE ]; 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 - -# TLP size -pci -b $BAR -w 0x0C 0x`echo "obase=16; $TLP_SIZE" | bc` -# TLP count -pci -b $BAR -w 0x10 0x`echo "obase=16; $BUFFER_SIZE * 1024 * 1024 / $TLP_SIZE / 4" | bc` -# Data -pci -b $BAR -w 0x14 0x13131313 - -bus="80000000" -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 - - 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: $(($BUFFER_SIZE * 1024 * 1024 * ITERATIONS * $speed / $dmaperf / 8)) MB/s" - -#pci -b $BAR -r 0 -s 32 -- cgit v1.2.3