#!/bin/bash

# Script to provide nco_resets internally to a wr2rf card at a given FTW
# while true; do sh tcal.sh; done
# Need to have initialised the card before calling with sh wr2rf_init.sh <slot>
# Common ftw listed towards the end.

slot=$1
ftw=$2

./wr2rf -s $slot nco-wrcfg  1
./wr2rf -s $slot nco-wrcfg  2
./wr2rf -s $slot nco-source local

./wr2rf -s $slot tmgio-oe   0xF
./wr2rf -s $slot tmgio-term 0x0

./wr2rf -s $slot lemo-dbg-sel tmgio3 nco_reset
./wr2rf -s $slot lemo-dbg-sel tmgio4 rf1_frev

./wr2rf -s $slot set-rfout 1 mix
./wr2rf -s $slot set-rfout 2 mix

sh vtu_setup.sh $slot

ftw_SFTPRO2_hex=0016b0bbb3c4
ftw_LHCPILOT_hex=0016b9f306de
ftw_SFTION1_hex=00168b5cbff4

./wr2rf -s $slot nco-lcfg-update 0x7 $ftw

