#!/bin/sh

# since the script might be called from the rcS the PATH
# of the rcu-sh has to be added
export PATH=/usr/local/sbin:$PATH

# set the DCS to RCU clock to 40 MHz
echo "FFFFF7">/dev/vreg
# program the RCU via select map

#added line since the v23 of ACTEL fw
rcu-sh w 0xb112 0xa


rcu-sh sm e

rcunetwork="/dcs-share/bit_files/rcu_111108.bit"
rcudefault="/rcu/rcu.bit"
if [ -e $rcunetwork ]; then
   echo programming rcu configuration from $rcunetwork
   cat $rcunetwork > /dev/virtex
else
   if [ -e $rcudefault ]; then
     echo programming default rcu configuration from $rcudefault
     cat $rcudefault >/dev/virtex
   else
     echo no rcu configuration file found
   fi
fi

rcu-sh sm d
# Enable TTCrx chip for SERB
ttcrx_regs w 0x7f 3
