#!/bin/bash
#==============================================================
#  Name: rfInitResAD10Wrapper.sh
#  Abs:  Initialize AD10 resonance chassis
#        For now, this means simply program Kintex firmware
#
#  Facility: LCLS-II
#
#  Auth: Sonya Hoobler, 12 Nov 2018
#  Rev:  dd-mmm-yyyy, First Lastname (USERNAME)
#
#
#--------------------------------------------------------------
#  Mod:
#   
#--------------------------------------------------------------
#
#  Usage:
#         rfInitResAD10Wrapper.sh
#
#============================================================

function usage {
echo "
   Purpose: Initialize the AD10 LLRF Resonance Chassis.
            This loads the Kintex FPGA firmware.
            Previous settings/values will be lost.
            
   Usage:
          rfInitResAD10Wrapper.sh 
"
}

# Halt communication between EPICS and chassis
caput -t ACCL:AD10:0100:RESA:CTRL_HALT 1 

ssh laci@cpu-ad10-cm01 sh /afs/slac/g/lcls/tools/script/rfInitResAD10.sh

# Resume communication
caput -t ACCL:AD10:0100:RESA:CTRL_RESET 1 

sleep 2

# Set expected motor settings
caput -t ACCL:AD10:0110:STEP:INIT_SETTINGS.PROC 1

echo 'Done'

exit 0
