diff --git a/startup/configChannels.input b/startup/configChannels.input new file mode 100644 index 0000000000000000000000000000000000000000..be8cdf970551eb72f7d7b98808017c881a52d0e5 --- /dev/null +++ b/startup/configChannels.input @@ -0,0 +1,7 @@ +CvtFldCtrl,Cavity Field Ctrl +Refer,Reference +Cvt1Fwd,Cavity 1 Fwd +Cvt1Rfl,Cavity 1 Rflct +Cvt2Fwd,Cavity 2 Fwd +Cvt2Rfl,Cavity 2 Rflct +PwrAmpFwd,PowerAmp Fwd diff --git a/startup/configChannels.sh b/startup/configChannels.sh index 31921180bc7dce9e625bba6e19ae9b707e83b3d9..8058c35e3f551b7c8d26d29705e5d09f14986d4c 100644 --- a/startup/configChannels.sh +++ b/startup/configChannels.sh @@ -1,40 +1,51 @@ -function usage() { - echo "usage: configChannels.sh" - echo "-a channel number - amplifier power" - echo "-c channel number - cavity power" - echo "-n digitiser instance - as integer starting from 1" - echo "-p channel number - preamplifier power" - echo "-h help" -} - -options=":a:c:n:p:h" -while getopts "${options}" opts; do - case "${opts}" in - h) usage ;; - a) chAmp=${OPTARG} ;; - c) chCav=${OPTARG} ;; - n) iNum=${OPTARG} ;; - p) chPreAmp=${OPTARG} ;; - esac -done - -if [ $# -lt 3 ]; then - echo "Script requires at least input of digitiser instance and a channel number" - usage +#!/bin/bash +if [ $# -ne 2 ]; then + echo "usage: configChannels.sh <digitiser instance> <config input file>" + echo "There is an example for config input file: configChannels.input" + exit fi +iNum=$1 +confFile=$2 + installPath=/iocs/sis8300llrf + fPath=$installPath/config-aliasing$iNum.iocsh +fPathDesc=$installPath/config-desc$iNum.iocsh # Populate IOC snippet for alias values if [ -f $fPath ]; then rm $fPath fi +if [ -f $fPathDesc ]; then + rm $fPathDesc +fi + # Populate iocsh snippet containing alias definitions. echo "# Alias definitions for digitiser card number $iNum" > $fPath template0="dbLoadRecords(\$(E3_CMD_TOP)/alias.template, \"O=$LLRF_IOC_NAME$iNum:AI" -if [ ${#chAmp} -gt 0 ]; then - echo "$template0$chAmp, A=$LLRF_IOC_NAME:AmpPow\")" >> $fPath - echo "$template0$chAmp-ATT, A=$LLRF_IOC_NAME:AmpPow-ATT\")" >> $fPath - echo "$template0$chAmp-ATT-RBV, A=$LLRF_IOC_NAME:AmpPow-ATT-RBV\")" >> $fPath -fi +template1="dbLoadRecords(\$(E3_CMD_TOP)/desc.template, " + + +i=0 +cat $confFile | while read line +do + pv_name=$(echo $line | cut -f 1 -d ,) + desc=$(echo $line | cut -f 2 -d ,) + + # set aliases + echo "$template0$i, A=$LLRF_IOC_NAME$iNum:$pv_name\")" >> $fPath + echo "$template0$i-ATT, A=$LLRF_IOC_NAME$iNum:$pv_name-ATT\")" >> $fPath + echo "$template0$i-ATT-RBV, A=$LLRF_IOC_NAME$iNum:$pv_name-ATT-RBV\")" >> $fPath + echo "$template0$i-DECF, A=$LLRF_IOC_NAME$iNum:$pv_name-DECF\")" >> $fPath + echo "$template0$i-DECF-RBV, A=$LLRF_IOC_NAME$iNum:$pv_name-DECF-RBV\")" >> $fPath + echo "$template0$i-DECO, A=$LLRF_IOC_NAME$iNum:$pv_name-DECO\")" >> $fPath + echo "$template0$i-DECO-RBV, A=$LLRF_IOC_NAME$iNum:$pv_name-DECO-RBV\")" >> $fPath + + # set descriptions + echo "$template1\"A=$LLRF_IOC_NAME$iNum:$pv_name, D=$desc\")" >> $fPathDesc + + i=$(($i+1)) +done + + diff --git a/startup/deployStartup.sh b/startup/deployStartup.sh index e122e050ab6aff5fa03f4fa45a7bc630cd6b9ab7..f9482ae86ecec87b49cb5d0ec967c6235bb9332f 100755 --- a/startup/deployStartup.sh +++ b/startup/deployStartup.sh @@ -18,7 +18,8 @@ if [ ${#slots_fpga} -lt 1 ] ; then snippet="epicsEnvSet(\"LLRF_PREFIX\" \"$LLRF_IOC_NAME\" ) \\\n \ epicsEnvSet(\"LLRF_SLOT\" \"<slot>\" ) \\\n \ iocshLoad $\(E3_CMD_TOP\)\/llrf.iocsh \\\n \ -iocshLoad $\(E3_CMD_TOP\)\/config-aliasing1.iocsh \\\n" +iocshLoad $\(E3_CMD_TOP\)\/config-aliasing1.iocsh \\\n \ +iocshLoad $\(E3_CMD_TOP\)\/config-desc1.iocsh \\\n" echo "snippet = $snippet" eval "sed -e $'s/<snippet>/$snippet/g' < $EPICS_SRC/e3-sis8300llrf/startup/llrf_template.cmd > $siteApp/llrf.cmd" else @@ -32,7 +33,8 @@ else epicsEnvSet(\"LLRF_PREFIX\" \"$LLRF_IOC_NAME$i\" ) \\\n \ epicsEnvSet(\"LLRF_SLOT\" \"$slot_fpga\" ) \\\n \ iocshLoad $\(E3_CMD_TOP\)\/llrf.iocsh \\\n \ -iocshLoad $\(E3_CMD_TOP\)\/config-aliasing$i.iocsh \\\n" +iocshLoad $\(E3_CMD_TOP\)\/config-aliasing$i.iocsh \\\n \ +iocshLoad $\(E3_CMD_TOP\)\/config-desc$i.iocsh \\\n" i=$(($i+1)) done #Populate digitiser slot and IOC Name in startup script. @@ -56,3 +58,6 @@ fi # Alias template cp $EPICS_SRC/e3-sis8300llrf/startup/alias.template $siteApp/alias.template + +# Description template +cp $EPICS_SRC/e3-sis8300llrf/startup/desc.template $siteApp/desc.template diff --git a/startup/desc.template b/startup/desc.template new file mode 100644 index 0000000000000000000000000000000000000000..0adfc5f93f60b92fc1049ed8eb6801e5a6fd4156 --- /dev/null +++ b/startup/desc.template @@ -0,0 +1,3 @@ +record("*", "$(A)"){ + field(DESC, "$(D)") +}