diff --git a/user_space/check_calib_inf.sh b/user_space/check_calib_inf.sh new file mode 100644 index 0000000..46b61ac --- /dev/null +++ b/user_space/check_calib_inf.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +(bash -c 'echo $PPID' > /tmp/check_calib_inf.pid +while true; do + echo 0x0A7 > /sys/kernel/debug/iio/iio:device2/direct_reg_access + status=$( cat /sys/kernel/debug/iio/iio:device2/direct_reg_access ) + if [ $status == "0xFF" ]; then + echo "WARNING: Tx Quadrature Calibration failed." + fi + sleep 5 +done) & + diff --git a/user_space/set_tx_lo.sh b/user_space/set_tx_lo.sh new file mode 100644 index 0000000..a7b967b --- /dev/null +++ b/user_space/set_tx_lo.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -x +if test -f "/sys/kernel/debug/iio/iio:device0/direct_reg_access"; then + cd /sys/kernel/debug/iio/device0/ +else if test -f "/sys/kernel/debug/iio/iio:device1/direct_reg_access"; then + cd /sys/kernel/debug/iio/iio:device1/ + else if test -f "/sys/kernel/debug/iio/iio:device2/direct_reg_access"; then + cd /sys/kernel/debug/iio/iio:device2/ + else if test -f "/sys/kernel/debug/iio/iio:device3/direct_reg_access"; then + cd /sys/kernel/debug/iio/iio:device3/ + else if test -f "/sys/kernel/debug/iio/iio:device4/direct_reg_access"; then + cd /sys/kernel/debug/iio/iio:device4/ + else + echo "Can not find direct_reg_access!" + echo "Check log to make sure ad9361 driver is loaded!" + exit 1 + fi + fi + fi + fi +fi +set +x + +if [ "$#" -eq 1 ]; then + if [ $1 == "0" ]; then + echo 0x051 0x10 > direct_reg_access + status=$( cat direct_reg_access ) + if [ $status == "0x10" ]; then + echo "Tx LO turned off" + else + echo "WARNING: turning Tx LO off unsuccessful" + fi + elif [ $1 == "1" ]; then + echo 0x051 0x0 > direct_reg_access + status=$( cat direct_reg_access ) + if [ $status == "0x0" ]; then + echo "Tx LO turned on" + else + echo "WARNING: turning Tx LO on unsuccessful" + fi + fi +elif [ "$#" -eq 0 ]; then + echo "Reading status only. Enter 1 or 0 as argument to set Tx LO on or off." + echo 0x051 > direct_reg_access + status=$( cat direct_reg_access ) + if [ $status == "0x10" ]; then + echo "Tx LO is off" + elif [ $status == "0x0" ]; then + echo "Tx LO is on" + else + echo "WARNING Unrecognized value $status." + fi +else + echo "Too many arguments, specify only one for turning on (1) or off (0) the Tx LO." +fi diff --git a/user_space/set_tx_port.sh b/user_space/set_tx_port.sh new file mode 100755 index 0000000..6a47e7c --- /dev/null +++ b/user_space/set_tx_port.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -x +if test -f "/sys/kernel/debug/iio/iio:device0/direct_reg_access"; then + cd /sys/kernel/debug/iio/device0/ +else if test -f "/sys/kernel/debug/iio/iio:device1/direct_reg_access"; then + cd /sys/kernel/debug/iio/iio:device1/ + else if test -f "/sys/kernel/debug/iio/iio:device2/direct_reg_access"; then + cd /sys/kernel/debug/iio/iio:device2/ + else if test -f "/sys/kernel/debug/iio/iio:device3/direct_reg_access"; then + cd /sys/kernel/debug/iio/iio:device3/ + else if test -f "/sys/kernel/debug/iio/iio:device4/direct_reg_access"; then + cd /sys/kernel/debug/iio/iio:device4/ + else + echo "Can not find direct_reg_access!" + echo "Check log to make sure ad9361 driver is loaded!" + exit 1 + fi + fi + fi + fi +fi +set +x + +if [ "$#" -eq 1 ]; then + if [ $1 == "0" ]; then + echo 0x004 0x43 > direct_reg_access + status=$( cat direct_reg_access ) + if [ $status == "0x43" ]; then + echo "Tx port B selected." + else + echo "WARNING: switching Tx port B unsuccessful" + fi + elif [ $1 == "1" ]; then + echo 0x004 0x3 > direct_reg_access + status=$( cat direct_reg_access ) + if [ $status == "0x3" ]; then + echo "Tx port A selected." + else + echo "WARNING: switching Tx port A unsuccessful" + fi + fi +elif [ "$#" -eq 0 ]; then + echo "Reading status only. Enter 1 or 0 as argument to select port A or B." + echo 0x004 > direct_reg_access + status=$( cat direct_reg_access ) + if [ $status == "0x43" ]; then + echo "Tx port B is used" + elif [ $status == "0x3" ]; then + echo "Tx port A is used" + else + echo "WARNING Unrecognized value $status." + fi +else + echo "Too many arguments, specify only one for selecting port A (1) or B (0)." +fi diff --git a/user_space/wgd.sh b/user_space/wgd.sh index d16a120..408ee42 100755 --- a/user_space/wgd.sh +++ b/user_space/wgd.sh @@ -247,6 +247,12 @@ then return fi +if ps -p $( /dev/null +then + kill $(