#! /bin/sh

unit=$1

if [ "$1" = "-u" ] ; then
unit=$2
fi

if [ "$unit" = ""  ] ; then 
	unit=0
fi

# loading bitfiles
mezzload -u $unit
# set up LIU to do diagnostic loopback
oc192_set -u $unit -l
# set up the FIFO and turn on prbs7 generator
echo "Testing CH1 at STM64/OC192 rate"
pdb -u $unit  -f oc192_loop.pdb
# collect and check
chkprbs7 -u $unit -c 1 -n 1 -i -s 1 -l 4500 
#
echo "Testing CH0 at STM16/OC48 rate"
mezzload -u $unit -b oc48m
pdb -u $unit  -f ocm48_test.pdb
chkprbs7 -u $unit -b 1048576 -c 0 -n 1 -i -l 2400
echo "Testing CH0 at STM4/OC12 rate"
mezzload -u $unit  -b oc12m
pdb -u $unit  -f ocm12_test.pdb
chkprbs7 -u $unit -c 0 -n 1 -i -l 600
echo "Testing CH0 at STM1/OC3 rate"
# mezzload -u $unit  -b oc12m
pdb -u $unit  -f ocm3_test.pdb
chkprbs7 -u $unit -c 0 -n 1 -i -l 150
