Commit 59832854 authored by 's avatar
Browse files

Corrected bug in mapi.sh.in and better loading of multiple cards in

dag.sh.in


git-svn-id: file:///home/svn/mapi/trunk@1313 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 55cd34af
......@@ -4,9 +4,23 @@ DAGDIR=@DAG_DIR@
DAGFWDIR=${DAGDIR}/share/dag/xilinx
function usage() {
echo "dag.sh { 4.3 | 6.2 | 8.2 [ 1 | 2 ] }"
echo "dag.sh { 4.3 | 6.2 | 8.2 ] [ <card_number> ] [ -f ] [ -p ] }"
echo ""
echo "Number of DAG8.2 cards in a PC can be specified. Default is 1."
echo "<card_number> is x in /dev/dagx. Default is 0."
echo "-f only reload firmware (do not reload driver)"
echo "-p enable PPS output from the card"
echo ""
echo "If there are more DAG cards in a PC then:"
echo "initialize one card without -f (reload both driver and firmware)"
echo "and initialize other cards with -f (reload only firmware)"
echo ""
echo "Example DAG4.3 (/dev/dag0) + DAG8.2 (/dev/dag1 + /dev/dag2):"
echo "dag.sh 4.3"
echo "dag.sh 8.2 1 -f"
echo ""
echo "Example DAG8.2 (/dev/dag0 + /dev/dag1) + DAG8.2 (/dev/dag2 + /dev/dag3):"
echo "dag.sh 8.2 -p"
echo "dag.sh 8.2 2 -f"
}
if [ $# -lt 1 ]; then
......@@ -17,65 +31,89 @@ fi
# Determine card type
if [ $1 = "4.3" -o $1 = "6.2" -o $1 = "8.2" ]; then
VERSION=$1
CARD_TYPE=$1
shift
else
echo "Unsupported card type"
usage
exit
exit -1
fi
# Determine the number of cards in a PC
# Determine the card number
CARD_NO=0
if [ $# -gt 0 ]; then
if [ $1 = "1" ]; then
CARD_NO=1
elif [ $1 = "2" ]; then
CARD_NO=2
else
usage
exit
fi
else
CARD_NO=1
if [ ${1:0:1} != "-" ]; then
if [ $1 -ge 0 -a $1 -le 255 ]; then
CARD_NO=$1
shift
fi
fi
fi
rmmod dag
rmmod dagmem
RELOAD_DRIVER=1
if [ $# -gt 0 ]; then
if [ $1 == "-f" ]; then
RELOAD_DRIVER=0
shift
fi
fi
PPS_OUT=1
if [ $# -gt 0 ]; then
if [ $1 == "-p" ]; then
PPS_OUT=1
else
echo "Unknown argument"
usage
exit -1
fi
fi
KERNEL_VERSION=`uname -r`
KERNEL_V4V6=`echo $KERNEL_VERSION | awk -F. '{print $2}'`
echo "CARD_TYPE: $CARD_TYPE"
echo "CARD_NO: $CARD_NO"
echo "RELOAD_DRIVER: $RELOAD_DRIVER"
echo "PPS_OUT: $PPS_OUT"
#if [ $KERNEL_V4V6 = "6" ]; then
# insmod /lib/modules/${KERNEL_VERSION}/extra/dagmem.ko dsize=128M
#else
modprobe dagmem dsize=128M
#fi
if [ $RELOAD_DRIVER -gt 0 ]; then
rmmod dag
rmmod dagmem
dagload
KERNEL_VERSION=`uname -r`
KERNEL_V4V6=`echo $KERNEL_VERSION | awk -F. '{print $2}'`
if [ $VERSION = "4.3" ]; then
#if [ $KERNEL_V4V6 = "6" ]; then
# insmod /lib/modules/${KERNEL_VERSION}/extra/dagmem.ko dsize=128M
#else
modprobe dagmem dsize=128M
#fi
dagload
fi
if [ $CARD_TYPE = "4.3" ]; then
# The following firmware supports transmitting, but not filtering
# dagrom -rvp -d /dev/dag0 -f ${DAGFWDIR}/dag43gepcix-terf.bit
dagrom -rvp -d /dev/dag0 -f ${DAGFWDIR}/dag43gepcix-ipf.bit
dagld -x -d /dev/dag0 ${DAGFWDIR}/copro-ipf43ge.bit
# dagrom -rvp -d /dev/dag${CARD_NO} -f ${DAGFWDIR}/dag43gepcix-terf.bit
dagrom -rvp -d /dev/dag${CARD_NO} -f ${DAGFWDIR}/dag43gepcix-ipf.bit
dagld -x -d /dev/dag${CARD_NO} ${DAGFWDIR}/copro-ipf43ge.bit
dagfour default nic slen=1520
elif [ $VERSION = "6.2" ]; then
dagrom -rvp -d /dev/dag0 -f ${DAGFWDIR}/dag62pcix-erf.bit
dagld -x -d /dev/dag0 ${DAGFWDIR}/dag62rx-erf.bit
elif [ $CARD_TYPE = "6.2" ]; then
dagrom -rvp -d /dev/dag${CARD_NO} -f ${DAGFWDIR}/dag62pcix-erf.bit
dagld -x -d /dev/dag${CARD_NO} ${DAGFWDIR}/dag62rx-erf.bit
dagsix default eth lan slen=1520 long=1520
elif [ $CARD_TYPE = "8.2" ]; then
SECOND_INTERNAL_DEVICE=`expr $CARD_NO + 1`
dagrom -rvp -d${CARD_NO} -f ${DAGFWDIR}/dag82xpci-terf-dsm.bit
dagconfig -d${CARD_NO} default
dagconfig -d${SECOND_INTERNAL_DEVICE} default
dagconfig -d${CARD_NO} slen=1520 mem=128:0
else
dagrom -rvp -d0 -f ${DAGFWDIR}/dag82xpci-terf-dsm.bit
dagconfig -d0 default
dagconfig -d1 default
dagconfig -d0 slen=1520 mem=128:0
if [ ${CARD_NO} -eq 2 ]; then
dagrom -rvp -d2 -f ${DAGFWDIR}/dag82xpci-terf-dsm.bit
dagconfig -d2 default
dagconfig -d3 default
dagconfig -d2 slen=1520 mem=128:0
fi
# Enable PPS output from the first card (can be used by the second card)
if [ ${CARD_NO} -eq 2 ]; then
dagclock -d0 overout
fi
echo "Unsupported card type"
usage
exit -1
fi
# Enable PPS output from the first card (can be used by the second card)
if [ ${PPS_OUT} -gt 0 ]; then
dagclock -d${CARD_NO} overout
fi
......@@ -117,7 +117,7 @@ case "$1" in
killall mapicommd
sleep 2
PROCESSES_=`ps -ef|grep mapicommd|grep -v grep|wc -l`
PROCESSES_MAPICOMMD=`ps -ef|grep mapicommd|grep -v grep|wc -l`
echo "PROCESSES_MAPICOMMD: $PROCESSES_MAPICOMMD"
if [ $PROCESSES_MAPICOMMD -gt 0 ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment