#!/bin/sh SBIN=/sbin COMMON_PATH=$PWD WLAN_DEMO_PATH=$COMMON_PATH/../wlan stty erase ^H TIME_INTERVAL=1 TIME_PERIOD=60 PING_COUNT=10 TIWLAN0_IP=192.168.103.40 IPERF_BIN=iperf wl1271_wlan_init() { ls $WLAN_DEMO_PATH &> /dev/null if [ "$?" -ne 0 ]; then echo "Wireless module does not present ..." return 0 fi cd $WLAN_DEMO_PATH ls sdio.ko &> /dev/null if [ "$?" -ne 0 ]; then echo "Module: \"sdio.ko\" is not available" exit fi $SBIN/insmod sdio.ko &> /dev/null if [ "$?" -ne 0 ]; then echo "Insert: \"sdio.ko\" module failed" $SBIN/lsmod | grep sdio if [ "$?" -ne 0 ]; then $SBIN/rmmod sdio fi exit fi sleep 1 ls tiwlan_drv.ko &> /dev/null if [ "$?" -ne 0 ]; then echo "Module: \"tiwlan_drv.ko\" is not available" exit fi $SBIN/insmod tiwlan_drv.ko &> /dev/null if [ "$?" -ne 0 ]; then echo "Insert: \"tiwlan_drv.ko\" module failed" $SBIN/lsmod | grep tiwlan_drv if [ "$?" -ne 0 ]; then $SBIN/rmmod tiwlan_drv fi $SBIN/lsmod | grep bmtrace $SBIN/rmmod sdio exit fi sleep 1 ls tiwlan_loader &> /dev/null if [ "$?" -ne 0 ]; then echo "There is no \"tiwlan_loader\" script" $SBIN/rmmod tiwlan_drv $SBIN/lsmod | grep bmtrace $SBIN/rmmod sdio exit fi sleep 1 ./tiwlan_loader $SBIN/ifconfig tiwlan0 $TIWLAN0_IP netmask 255.255.255.0 up &> /dev/null 2>&1 if [ "$?" -ne 0 ]; then echo "There is no \"tiwlan0\" interface" lsmod | grep sdio if [ "$?" -ne 0 ]; then $SBIN/rmmod tiwlan_drv $SBIN/rmmod bmtrace $SBIN/rmmod sdio fi fi sleep 1 ./wpa_supplicant -Dwext -itiwlan0 -c wpa_supplicant.txt & sleep 5 ./wlan_cu } wl1271_wlan_demo() { echo "********************************************************" echo "* WIRELESS MAIN MENU *" echo "********************************************************" echo "" echo " 0: Exit" echo " 1: Ping Demo" echo " 2: Iperf Demo" echo " 3: Web Browse Demo" echo " 4: Return to Main Menu" echo -n "WLAN MENU OPTION: " read WLAN_MENU_OPTION case $WLAN_MENU_OPTION in 0) exit ;; 1) echo "*****************************************************************" echo "* Provide the remote device IP address *" echo "*****************************************************************" echo "" echo -n "REMOTE IP: " read PING_IP echo "Pinging "$PING_COUNT" times" ping $PING_IP -c $PING_COUNT if [ "$?" -ne 0 ]; then echo "Can not ping remote device, please verify the IP address." echo "" echo "Ping Test Failed ..." wl1271_wlan_demo else echo "Ping Test Passed ..." fi echo "" wl1271_wlan_demo ;; 2) echo "*****************************************************************" echo "* IPERF TEST *" echo "*****************************************************************" ls $COMMON_PATH/../tools &> /dev/null if [ "$?" -ne 0 ]; then echo "" echo "There is no iperf utility ..." echo "" wl1271_wlan_demo fi echo "" echo "Select Iperf Test Type:" echo "1: TCP UpStream Iperf" echo "2: UDP UpStream Iperf" echo "3: TCP DownStream Iperf" echo "4: UDP DownStream Iperf" echo -n "IPERF_TYPE: " read TCP_UDP if [ $TCP_UDP -lt 3 ]; then echo "*****************************************************************" echo "* Provide the Iperf server IP address *" echo "*****************************************************************" echo "" echo -n "IPERF SERVER IP: " read SERVER_IP echo "" ping $SERVER_IP -c 1 &> /dev/null if [ "$?" -ne 0 ]; then echo "Please check the server IP address ..." wl1271_wlan_demo fi fi case $TCP_UDP in 1) echo "Start TCP server on Host with command 'iperf -s'. If server is ready," echo "press Enter and wait for "$TIME_PERIOD" seconds to complete the test" read CONTINUE_KEY cd $COMMON_PATH/../tools $IPERF_BIN -c $SERVER_IP -i $TIME_INTERVAL -t $TIME_PERIOD if [ "$?" -ne 0 ]; then echo "Iperf test failed, Please check the parameters ..." else echo "TCP: Iperf test passed ..." fi ;; 2) echo "Start UDP server on Host with command 'iperf -s -i 1 -u'. If server is ready," echo "press Enter and wait for "$TIME_PERIOD" seconds to complete the test" read CONTINUE_KEY cd $COMMON_PATH/../tools $IPERF_BIN -c $SERVER_IP -u -b 30M -i $TIME_INTERVAL -t $TIME_PERIOD if [ "$?" -ne 0 ]; then echo "Iperf test failed, Please check the parameters ..." else echo "UDP: Iperf test passed ..." fi ;; 3) cd $COMMON_PATH/../tools $IPERF_BIN -s & sleep 1 echo "" echo "Server started on EVM, run client command on remote PC" echo "" echo "Client command : iperf -c -i 1 -t 60 " echo "" echo "Enter any key to stop the server...." read USER_INPUT killall -15 $IPERF_BIN ;; 4) cd $COMMON_PATH/../tools $IPERF_BIN -s -u -i $TIME_INTERVAL & sleep 1 echo "" echo "Server started on EVM, run client command on remote PC" echo "" echo "Client command : iperf -c -i 1 -t 60 -u -b 40M " echo "" echo "Enter any key to stop the server...." read USER_INPUT killall -15 $IPERF_BIN ;; esac wl1271_wlan_demo ;; 3) ls $COMMON_PATH/../iptables-1.4.3.2 &> /dev/null if [ "$?" -ne 0 ]; then echo "" echo "There is no Iptable utility ..." echo "" wl1271_wlan_demo fi ls $COMMON_PATH/../iptables-1.4.3.2/WebBrowse.sh &> /dev/null if [ "$?" -ne 0 ]; then ls $COMMON_PATH/../wlan_scripts/WebBrowse.sh &> /dev/null if [ "$?" -ne 0 ]; then echo "There is no Web Browing script available" echo "" wl1271_wlan_demo else cp $COMMON_PATH/../wlan_scripts/WebBrowse.sh $COMMON_PATH/../iptables-1.4.3.2/ fi fi chmod 777 $COMMON_PATH/../iptables-1.4.3.2/WebBrowse.sh cd $COMMON_PATH/../iptables-1.4.3.2 ./WebBrowse.sh start cd $COMMON_PATH wl1271_wlan_demo ;; 4) wl1271_main_menu ;; *) wl1271_wlan_demo ;; esac } wl1271_wlan_main_menu () { $SBIN/ifconfig tiwlan0 &> /dev/null if [ "$?" -ne 0 ]; then wl1271_wlan_init fi sleep 1 #wlan menu configuration wl1271_wlan_demo } wl1271_bt_demo() { ls $COMMON_PATH/../bluetooth_scripts/BT_Init.sh &> /dev/null if [ "$?" -ne 0 ]; then echo "BT scripts are not available ..." return fi cd $COMMON_PATH/../bluetooth_scripts/ ./BT_Demo.sh wl1271_main_menu } wl1271_main_menu() { echo "********************************************************" echo "* WL1271 DEMO MAIN MENU *" echo "********************************************************" echo "" echo " 0: Exit from Demo" echo " 1: Wireless Demo" # echo " 2: Bluetooth Demo" echo "" echo -n "DEMO OPTION: " read DEMO_OPTION case $DEMO_OPTION in 0) exit ;; 1) wl1271_wlan_main_menu ;; # 2) # wl1271_bt_demo # ;; *) wl1271_main_menu ;; esac } case $1 in --help) echo "" echo "This script helps to start wireless and blutooth on the OMAP3 EVM" echo "" echo "Use below command to enable web browsing" echo "Usage:./wl1271_Demo.sh" echo "" ;; *) wl1271_main_menu ;; esac