#!/bin/sh
key_word="SSV|RSV"

if [ $# -lt 1 ]; then
	echo "Usage: hci_mib PHY_IF $#";
	exit;
fi

phy_dir="/sys/class/ieee80211/$1/device/driver"
drv_name=`ls ${phy_dir} | grep -E $key_word`
if [ -z ${drv_name} ]; then
	echo "Cannot find SSV driver"
    exit;
fi

phy_if=/sys/kernel/debug/ieee80211/$1/${drv_name}/hci
if [ ! -d $phy_if ]; then 
    echo "$phy_if does not exist.";
    exit;
fi

cd $phy_if

echo 0 > hci_isr_mib_enable
echo 1 > hci_isr_mib_reset
echo 1 > hci_isr_mib_enable

sleep 10

echo 0 > hci_isr_mib_enable

echo "ISR total time: `cat isr_total_time`"
echo "RX IO time: `cat rx_io_time`"
echo "RX IO count: `cat rx_io_count`"
echo "RX process time: `cat rx_proc_time`"
echo "TX IO time: `cat tx_io_time`"
echo "TX IO count: `cat tx_io_count`"
