#!/bin/sh

FIP=./fip_urv

$FIP i2c 0

echo -n "********** System board (revision "
$FIP mon -s revision
echo ") **********"

echo -n "P12V:  "
$FIP wmon page 0
$FIP mon -s vout
echo -n "   "
$FIP mon -s iout
echo

echo -n "P1.2V: "
$FIP wmon page 1
$FIP mon -s vout
echo

echo -n "P3.3V: "
$FIP wmon page 2
$FIP mon -s vout
echo

echo -n "Vperi: "
$FIP wmon page 3
$FIP mon -s vout
echo

echo -n "Temp amb:  "
$FIP mon -s temp-1
echo

echo -n "Temp LDO:  "
$FIP mon -s temp-2
echo

echo -n "Temp FPGA: "
$FIP mon -s temp-3
echo

psu=$(./fip_urv psu)

$FIP i2c 2
echo "************ PSU 0 *****************"
if echo $psu | grep -q "PSU 0: presence: 1"; then
 :
else
  echo "Not present"
fi

echo "************ PSU 1 *****************"
if echo $psu | grep -q "PSU 1: presence: 1"; then
 echo -n "Vout: "
 $FIP mon -s -t 0x18 vout
 echo
 echo -n "Iout: "
 $FIP mon -s -t 0x18 iout
 echo
 echo -n "Temp 1:  "
 $FIP mon -s -t 0x18 temp-1
 echo
 echo -n "Temp 2:  "
 $FIP mon -s -t 0x18 temp-2
 echo
else
  echo "Not present"
fi

echo "*********** Configuration ***********"
$FIP i2c 1
echo    "SLOTS: 01 02 03 04 05 06 07 08"
echo -n "      "
for i in 0 1 2 3 4 5 6 7; do
 echo -n " "
 $FIP i2c-id -s $i
done
echo
$FIP i2c 0
