#!/bin/sh

# helper script for fpga register decode
#
# this script will figure out which fpga the board has, and use the correct regmap

source /ciena/scripts/board_lib.sh

board=$(get_board_name)

if [ $board == '5150' ]; then
    fpga_string=VINMAR
    regmap=/ciena/fpga/vinmar_regmap.conf
elif [ $board == '3916' ]; then
    fpga_string=FARIN
    regmap=/ciena/fpga/farin_regmap.conf
elif [ $board == '3930' ]; then
    fpga_string=OCTOPUS
    regmap=/ciena/fpga/octopus_regmap.conf
elif [ $board == '3931' ]; then
    fpga_string=OCTOPUS
    regmap=/ciena/fpga/octopus_regmap.conf
elif [ $board == '3932' ]; then
    fpga_string=BALIN
    regmap=/ciena/fpga/balin_regmap.conf
elif [ $board == '3938' ]; then
    fpga_string=VANYAR
    regmap=/ciena/fpga/vanyar_regmap.conf
elif [ $board == '3942' ]; then
    fpga_string=LINDIR
    regmap=/ciena/fpga/lindir_regmap.conf
elif [ $board == '5142' ]; then
    fpga_string=GAMIL
    regmap=/ciena/fpga/gamil_regmap.conf
elif [ $board == '5160' ]; then
    fpga_string=NORIN
    regmap=/ciena/fpga/norin_regmap.conf
else
    echo 'Error: Board Not Supported'
    exit 1
fi

/ciena/bin/regdecode "UIO Driver for Ciena $fpga_string FPGA" $regmap "$@"
