2019-12-10 13:03:47 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-02-03 15:01:04 +00:00
|
|
|
# Author: Xianjun Jiao
|
|
|
|
# SPDX-FileCopyrightText: 2019 UGent
|
2021-01-20 12:30:12 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2019-12-10 13:03:47 +00:00
|
|
|
checkModule () {
|
|
|
|
MODULE="$1"
|
|
|
|
if lsmod | grep "$MODULE" &> /dev/null ; then
|
|
|
|
echo "$MODULE is loaded!"
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
echo "$MODULE is not loaded!"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
num_arg=$#
|
|
|
|
echo "num_arg " $num_arg
|
|
|
|
|
|
|
|
for input_var in "$@"
|
|
|
|
do
|
|
|
|
last_input=$input_var
|
|
|
|
# echo $last_input
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z $last_input ]
|
|
|
|
then
|
2022-03-28 09:20:22 +00:00
|
|
|
last_input="unset"
|
2019-12-10 13:03:47 +00:00
|
|
|
test_mode=0
|
|
|
|
else
|
|
|
|
if [ $1 -eq 1 ]
|
|
|
|
then
|
|
|
|
test_mode=1
|
2022-03-28 09:20:22 +00:00
|
|
|
elif [ $1 -eq 2 ]
|
|
|
|
then
|
|
|
|
test_mode=2
|
|
|
|
elif [ $1 -eq 3 ]
|
|
|
|
then
|
|
|
|
test_mode=3
|
|
|
|
elif [ $1 -eq 4 ]
|
|
|
|
then
|
|
|
|
test_mode=4
|
|
|
|
elif [ $1 -eq 5 ]
|
|
|
|
then
|
|
|
|
test_mode=5
|
|
|
|
elif [ $1 -eq 6 ]
|
|
|
|
then
|
|
|
|
test_mode=6
|
|
|
|
elif [ $1 -eq 7 ]
|
|
|
|
then
|
|
|
|
test_mode=7
|
2019-12-10 13:03:47 +00:00
|
|
|
else
|
|
|
|
test_mode=0
|
|
|
|
fi
|
|
|
|
fi
|
2022-03-28 09:20:22 +00:00
|
|
|
|
|
|
|
#if ((($test_mode & 0x2) != 0)); then
|
|
|
|
tx_offset_tuning_enable=0
|
|
|
|
#else
|
|
|
|
# tx_offset_tuning_enable=1
|
|
|
|
#fi
|
|
|
|
|
2019-12-10 13:03:47 +00:00
|
|
|
echo last_input $last_input
|
|
|
|
echo test_mode $test_mode
|
2022-03-28 09:20:22 +00:00
|
|
|
echo tx_offset_tuning_enable $tx_offset_tuning_enable
|
|
|
|
|
|
|
|
service network-manager stop
|
|
|
|
|
2022-03-26 20:03:08 +00:00
|
|
|
depmod
|
2019-12-10 13:03:47 +00:00
|
|
|
modprobe mac80211
|
2022-03-26 20:03:08 +00:00
|
|
|
lsmod
|
2019-12-10 13:03:47 +00:00
|
|
|
# dmesg -c
|
|
|
|
|
|
|
|
PROG=sdr
|
|
|
|
rmmod $PROG
|
|
|
|
|
2022-03-26 20:03:08 +00:00
|
|
|
|
|
|
|
# mv ad9361 driver to local folder, to prevent booting issue
|
|
|
|
if [ -f /lib/modules/$(uname -r)/ad9361_drv.ko ]; then
|
|
|
|
mv /lib/modules/$(uname -r)/ad9361_drv.ko .
|
|
|
|
fi
|
|
|
|
SUBMODULE=ad9361_drv
|
|
|
|
rmmod $SUBMODULE
|
|
|
|
insmod $SUBMODULE.ko
|
|
|
|
|
|
|
|
echo check $SUBMODULE module is loaded or not
|
|
|
|
checkModule $SUBMODULE
|
|
|
|
if [ $? -eq 1 ]
|
|
|
|
then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
lsmod
|
|
|
|
|
|
|
|
# mv xilinx dma driver to local folder, to prevent booting issue
|
|
|
|
if [ -f /lib/modules/$(uname -r)/xilinx_dma.ko ]; then
|
|
|
|
mv /lib/modules/$(uname -r)/xilinx_dma.ko .
|
|
|
|
fi
|
|
|
|
SUBMODULE=xilinx_dma
|
|
|
|
rmmod $SUBMODULE
|
|
|
|
insmod $SUBMODULE.ko
|
|
|
|
|
|
|
|
#sleep 1
|
|
|
|
|
|
|
|
echo check $SUBMODULE module is loaded or not
|
|
|
|
checkModule $SUBMODULE
|
|
|
|
if [ $? -eq 1 ]
|
|
|
|
then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
lsmod
|
|
|
|
|
2019-12-10 13:03:47 +00:00
|
|
|
# before drive ad9361, let's bring up duc and make sure dac is connected to ad9361 dma
|
|
|
|
SUBMODULE=tx_intf
|
|
|
|
if [ $last_input == "remote" ]
|
|
|
|
then
|
|
|
|
rm $SUBMODULE.ko
|
|
|
|
sync
|
|
|
|
wget ftp://192.168.10.1/driver/$SUBMODULE/$SUBMODULE.ko
|
|
|
|
sync
|
|
|
|
fi
|
|
|
|
rmmod $SUBMODULE
|
|
|
|
insmod $SUBMODULE.ko
|
|
|
|
|
|
|
|
echo check $SUBMODULE module is loaded or not
|
|
|
|
checkModule $SUBMODULE
|
|
|
|
if [ $? -eq 1 ]
|
|
|
|
then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
sleep 0.5
|
|
|
|
|
2021-05-05 14:44:39 +00:00
|
|
|
|
2019-12-10 13:03:47 +00:00
|
|
|
|
2020-03-04 18:39:12 +00:00
|
|
|
echo "set RF frontend"
|
2020-01-25 18:18:16 +00:00
|
|
|
# if [ $last_input == "remote" ]
|
|
|
|
# then
|
|
|
|
# rm rf_init.sh
|
|
|
|
# sync
|
|
|
|
# wget ftp://192.168.10.1/user_space/rf_init.sh
|
|
|
|
# sync
|
|
|
|
# chmod +x rf_init.sh
|
|
|
|
# sync
|
|
|
|
# fi
|
2022-03-28 09:20:22 +00:00
|
|
|
|
|
|
|
# if [ $tx_offset_tuning_enable = "1" ]
|
|
|
|
# then
|
|
|
|
./rf_init_11n.sh
|
|
|
|
# else
|
|
|
|
# ./rf_init.sh tx_offset_tuning_disable
|
|
|
|
# fi
|
2019-12-10 13:03:47 +00:00
|
|
|
|
|
|
|
#sleep 1
|
|
|
|
|
|
|
|
SUBMODULE=rx_intf
|
|
|
|
if [ $last_input == "remote" ]
|
|
|
|
then
|
|
|
|
rm $SUBMODULE.ko
|
|
|
|
sync
|
|
|
|
wget ftp://192.168.10.1/driver/$SUBMODULE/$SUBMODULE.ko
|
|
|
|
sync
|
|
|
|
fi
|
|
|
|
rmmod $SUBMODULE
|
|
|
|
insmod $SUBMODULE.ko
|
|
|
|
|
|
|
|
echo check $SUBMODULE module is loaded or not
|
|
|
|
checkModule $SUBMODULE
|
|
|
|
if [ $? -eq 1 ]
|
|
|
|
then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
SUBMODULE=openofdm_tx
|
|
|
|
if [ $last_input == "remote" ]
|
|
|
|
then
|
|
|
|
rm $SUBMODULE.ko
|
|
|
|
sync
|
|
|
|
wget ftp://192.168.10.1/driver/$SUBMODULE/$SUBMODULE.ko
|
|
|
|
sync
|
|
|
|
fi
|
|
|
|
rmmod $SUBMODULE
|
|
|
|
insmod $SUBMODULE.ko
|
|
|
|
|
|
|
|
echo check $SUBMODULE module is loaded or not
|
|
|
|
checkModule $SUBMODULE
|
|
|
|
if [ $? -eq 1 ]
|
|
|
|
then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
SUBMODULE=openofdm_rx
|
|
|
|
if [ $last_input == "remote" ]
|
|
|
|
then
|
|
|
|
rm $SUBMODULE.ko
|
|
|
|
sync
|
|
|
|
wget ftp://192.168.10.1/driver/$SUBMODULE/$SUBMODULE.ko
|
|
|
|
sync
|
|
|
|
fi
|
|
|
|
rmmod $SUBMODULE
|
|
|
|
insmod $SUBMODULE.ko
|
|
|
|
|
|
|
|
echo check $SUBMODULE module is loaded or not
|
|
|
|
checkModule $SUBMODULE
|
|
|
|
if [ $? -eq 1 ]
|
|
|
|
then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
SUBMODULE=xpu
|
|
|
|
if [ $last_input == "remote" ]
|
|
|
|
then
|
|
|
|
rm $SUBMODULE.ko
|
|
|
|
sync
|
|
|
|
wget ftp://192.168.10.1/driver/$SUBMODULE/$SUBMODULE.ko
|
|
|
|
sync
|
|
|
|
fi
|
|
|
|
rmmod $SUBMODULE
|
|
|
|
insmod $SUBMODULE.ko
|
|
|
|
|
|
|
|
echo check $SUBMODULE module is loaded or not
|
|
|
|
checkModule $SUBMODULE
|
|
|
|
if [ $? -eq 1 ]
|
|
|
|
then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
sleep 0.5
|
|
|
|
|
|
|
|
PROG=sdr
|
|
|
|
if [ $last_input == "remote" ]
|
|
|
|
then
|
|
|
|
rm $PROG.ko
|
|
|
|
sync
|
|
|
|
wget ftp://192.168.10.1/driver/$PROG.ko
|
|
|
|
sync
|
|
|
|
fi
|
|
|
|
|
|
|
|
rmmod $PROG
|
|
|
|
echo insert $PROG.ko test_mode=$test_mode
|
|
|
|
insmod $PROG.ko test_mode=$test_mode
|
|
|
|
|
|
|
|
echo check $PROG module is loaded or not
|
|
|
|
checkModule $PROG
|
|
|
|
if [ $? -eq 1 ]
|
|
|
|
then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo the end
|
|
|
|
dmesg
|
|
|
|
|
|
|
|
# dmesg -c
|
|
|
|
# sleep 0.1
|
|
|
|
# ifconfig sdr0 up
|