From dc0b3db1b4f1895a07e5fe280ee3790e87f97b9f Mon Sep 17 00:00:00 2001 From: Ataberk Date: Sun, 25 Sep 2022 17:22:03 +0200 Subject: Initial commit --- sources/xdma_driver/load_driver.sh | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 sources/xdma_driver/load_driver.sh (limited to 'sources/xdma_driver/load_driver.sh') diff --git a/sources/xdma_driver/load_driver.sh b/sources/xdma_driver/load_driver.sh new file mode 100755 index 0000000..9910136 --- /dev/null +++ b/sources/xdma_driver/load_driver.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# Make sure only root can run our script +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +cd xdma +make clean +make -j +if [ ! $? == 0 ]; then + echo "Error: Kernel module did not compile properly." + echo " FAILED" + exit 1 +fi +cd .. + + +# Remove the existing xdma kernel module +lsmod | grep xdma +if [ $? -eq 0 ]; then + rmmod xdma +fi +echo -n "Loading xdma driver..." +# Use the following command to Load the driver in the default +# or interrupt drive mode. This will allow the driver to use +# interrupts to signal when DMA transfers are completed. +insmod xdma/xdma.ko enable_credit_mp=1 +# Use the following command to Load the driver in Polling +# mode rather than than interrupt mode. This will allow the +# driver to use polling to determ when DMA transfers are +# completed. +#insmod ../xdma/xdma.ko poll_mode=1 + +if [ ! $? == 0 ]; then + echo "Error: Kernel module did not load properly." + echo " FAILED" + exit 1 +fi + +# Check to see if the xdma devices were recognized +echo "" +cat /proc/devices | grep xdma > /dev/null +returnVal=$? +if [ $returnVal == 0 ]; then + # Installed devices were recognized. + echo "The Kernel module installed correctly and the xmda devices were recognized." +else + # No devices were installed. + echo "Error: The Kernel module installed correctly, but no devices were recognized." + echo " FAILED" + exit 1 +fi + +echo " DONE" -- cgit v1.2.3