diff --git a/startup/alias.template b/startup/alias.template new file mode 100644 index 0000000000000000000000000000000000000000..c3a40f10ad00a82de30eac678a0f565eb09949f5 --- /dev/null +++ b/startup/alias.template @@ -0,0 +1 @@ +alias($(O), $(A)) diff --git a/startup/configChannels.sh b/startup/configChannels.sh new file mode 100644 index 0000000000000000000000000000000000000000..31921180bc7dce9e625bba6e19ae9b707e83b3d9 --- /dev/null +++ b/startup/configChannels.sh @@ -0,0 +1,40 @@ +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 +fi + +installPath=/iocs/sis8300llrf +fPath=$installPath/config-aliasing$iNum.iocsh +# Populate IOC snippet for alias values +if [ -f $fPath ]; then + rm $fPath +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 diff --git a/startup/deployServiceIOC.sh b/startup/deployServiceIOC.sh index a0651f6d14a2eef358d02529afeaa747964e8618..c94524eabfb95b0792e4ec4e8331413919afca15 100755 --- a/startup/deployServiceIOC.sh +++ b/startup/deployServiceIOC.sh @@ -6,9 +6,12 @@ fi if [[ $# -gt 0 ]] ; then EPICS_SRC=$1 + EPICS_BASE=$2 + E3_REQUIRE_VERSION=$3 + LLRF_IOC_NAME=$4 else echo "Usage: sudo deployServiceIOC.sh <e3 source directory> <epics base directory> <epics require version> <LLRF_IOC_NAME>" - echo "sudo deployServiceIOC.sh $EPICS_SRC $EPICS_BASE $E3_REQUIRE_VERSION" + echo "sudo deployServiceIOC.sh $EPICS_SRC $EPICS_BASE $E3_REQUIRE_VERSION $LLRF_IOC_NAME" exit fi @@ -18,10 +21,10 @@ serviceNameGit=$EPICS_SRC/e3-sis8300llrf/startup/ioc@llrf.service #Prepare service and enable #Get EPICS base version and require version -ver_base=$(echo $2 | cut -c13-18) +ver_base=$(echo $EPICS_BASE | cut -c13-18) eval "sed -e 's/icslab-llrf/$hostName/'\ -e 's/<epics_base>/$ver_base/'\ - -e 's/<req_version>/$3/'\ + -e 's/<req_version>/$E3_REQUIRE_VERSION/'\ < $serviceNameGit" > $serviceName systemctl enable ioc@llrf.service @@ -29,54 +32,17 @@ systemctl enable ioc@llrf.service #Prepare siteApp configuration for IOC instance specific configuration siteApp=/iocs/sis8300llrf -mkdir -p $siteApp/log/ -mkdir -p $siteApp/run/ - -cp $EPICS_SRC/e3-sis8300llrf/startup/llrf_template.iocsh $siteApp/llrf.iocsh - -slots_fpga=$(ls /dev/sis8300-* | cut -f2 -d "-") -if [ ${#slots_fpga} -lt 1 ] ; then - echo "Could not find SIS8300 digitiser board." - echo "Board slot must be manually configured in $siteApp/llrf.cmd" - snippet="epicsEnvSet(\"LLRF_PREFIX\" \"$4\" ) \\\n \ -epicsEnvSet(\"LLRF_SLOT\" \"<slot>\" ) \\\n \ -iocshLoad $\(E3_CMD_TOP\)\/llrf.iocsh \\\n " - eval "sed -e $'s/<snippet>/$snippet/g' < $EPICS_SRC/e3-sis8300llrf/startup/llrf_template.cmd > $siteApp/llrf.cmd" -else - if [ ${#slots_fpga} -eq 1 ]; then - i='' # just one board, use original IOC name - else - i=1 # more than 1 board, enumerate IOC name - fi - - snippet="" - for slot_fpga in $(ls /dev/sis8300-* | cut -f2 -d "-" | sort -n) - do - snippet="$snippet \\\n\ -epicsEnvSet(\"LLRF_PREFIX\" \"$4$i\" ) \\\n \ -epicsEnvSet(\"LLRF_SLOT\" \"$slot_fpga\" ) \\\n \ -iocshLoad $\(E3_CMD_TOP\)\/llrf.iocsh \\\n " - i=$(($i+1)) - done - #Populate digitiser slot and IOC Name in startup script. - eval "sed -e $'s/<snippet>/$snippet/g' < $EPICS_SRC/e3-sis8300llrf/startup/llrf_template.cmd > $siteApp/llrf.cmd" - +if [ ! -d $siteApp/log ]; then + mkdir -p "$siteApp/log/" fi - - -#Timing configuration -# We check the EVR is available on PCIe to use in timing.iocsh snippet used to configure the EVR. -pcie_enumeration=$(lspci | grep Xilinx | cut -c1-7) -if [ ${#pcie_enumeration} != 7 ] ; then - echo "Could not find Timing Event Receiver on PCIexpress bus." - echo "Therefore no timing configuration created." - echo "# no timing configuration as no EVR detected on PCIe bus." > $siteApp/timing.iocsh -else - eval "sed -e 's/<B:D.F>/$pcie_enumeration/' -e 's/<LLRF_IOC_NAME>/$4/' < $EPICS_SRC/e3-sis8300llrf/startup/timing_template.iocsh" > "/iocs/sis8300llrf/timing.iocsh" - cp $EPICS_SRC/e3-sis8300llrf/startup/tr-sequencer.sh $siteApp/tr-sequencer.sh +if [ ! -d $siteApp/run ]; then + mkdir -p "$siteApp/run/" fi +chown -R iocuser $siteApp + if [ ! -L /etc/systemd/system/multi-user.target.wants/ioc@llrf.service ] ; then echo "ioc@llrf.service is not enabled." fi systemctl daemon-reload + diff --git a/startup/deployStartup.sh b/startup/deployStartup.sh new file mode 100755 index 0000000000000000000000000000000000000000..e122e050ab6aff5fa03f4fa45a7bc630cd6b9ab7 --- /dev/null +++ b/startup/deployStartup.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +#Prepare siteApp configuration for IOC instance specific configuration +siteApp=/iocs/sis8300llrf + +if [ ! -d $siteApp ]; then + sudo mkdir -p "$siteApp" +fi + +sudo chown -R iocuser "$siteApp" + + +cp $EPICS_SRC/e3-sis8300llrf/startup/llrf_template.iocsh $siteApp/llrf.iocsh +slots_fpga=$(ls /dev/sis8300-* | cut -f2 -d "-") +if [ ${#slots_fpga} -lt 1 ] ; then + echo "Could not find SIS8300 digitiser board." + echo "Board slot must be manually configured in $siteApp/llrf.cmd" + 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" + echo "snippet = $snippet" + eval "sed -e $'s/<snippet>/$snippet/g' < $EPICS_SRC/e3-sis8300llrf/startup/llrf_template.cmd > $siteApp/llrf.cmd" +else + # Start board enumeration from 1. + i=1 + + snippet="" + for slot_fpga in $(ls /dev/sis8300-* | cut -f2 -d "-" | sort -n) + do + snippet="$snippet \\\n\ +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" + i=$(($i+1)) + done + #Populate digitiser slot and IOC Name in startup script. + eval "sed -e $'s/<snippet>/$snippet/g'\ + < $EPICS_SRC/e3-sis8300llrf/startup/llrf_template.cmd > $siteApp/llrf.cmd" + +fi + + +#Timing configuration +# We check the EVR is available on PCIe to use in timing.iocsh snippet used to configure the EVR. +pcie_enumeration=$(lspci | grep Xilinx | cut -c1-7) +if [ ${#pcie_enumeration} != 7 ] ; then + echo "Could not find Timing Event Receiver on PCIexpress bus." + echo "Therefore no timing configuration created." + echo "# no timing configuration as no EVR detected on PCIe bus." > $siteApp/timing.iocsh +else + eval "sed -e 's/<B:D.F>/$pcie_enumeration/' -e 's/<LLRF_IOC_NAME>/$LLRF_IOC_NAME/' < $EPICS_SRC/e3-sis8300llrf/startup/timing_template.iocsh" > "/iocs/sis8300llrf/timing.iocsh" + cp $EPICS_SRC/e3-sis8300llrf/startup/tr-sequencer.sh $siteApp/tr-sequencer.sh +fi + +# Alias template +cp $EPICS_SRC/e3-sis8300llrf/startup/alias.template $siteApp/alias.template diff --git a/startup/llrf_template.cmd b/startup/llrf_template.cmd index 097fdfeafe342f4ad1615fca7f6864edc5bedf1c..b4f21011bf81986199344d0522ae39fca6795204 100644 --- a/startup/llrf_template.cmd +++ b/startup/llrf_template.cmd @@ -3,7 +3,7 @@ iocshLoad $(E3_CMD_TOP)/timing.iocsh epicsEnvSet("EPICS_CA_MAX_ARRAY_BYTES" "8388624") require sis8300llrf, 3.10.3 -ndsSetTraceLevel 5 +ndsSetTraceLevel 3 <snippet> diff --git a/startup/llrf_template.iocsh b/startup/llrf_template.iocsh index 77c580a74fa5a2e7c002ae22bc8506d61565e013..0870e3508e9a8f6e06e5cf958f99b938c2bce4a0 100644 --- a/startup/llrf_template.iocsh +++ b/startup/llrf_template.iocsh @@ -23,7 +23,6 @@ dbLoadRecords("sis8300Register.db", "PREFIX=$(LLRF_PREFIX), ASYN_PORT=$(LLRF_POR dbLoadRecords("sis8300noAO.db", "PREFIX=$(LLRF_PREFIX), ASYN_PORT=$(LLRF_PORT), AI_NELM=$(AI_SMNM_MAX)") dbLoadRecords("sis8300llrf-Register.db", "PREFIX=$(LLRF_PREFIX), ASYN_PORT=$(LLRF_PORT), REG_SCAN=2") - epicsThreadSleep(1) # Configure the RTM for LLRF afterInit("dbpf $(LLRF_PREFIX):RTM 2 > /dev/null") diff --git a/startup/setPVs.sh b/startup/setPVs.sh new file mode 100644 index 0000000000000000000000000000000000000000..b27dd27d4669b3248efe0da28284e9682a8821d0 --- /dev/null +++ b/startup/setPVs.sh @@ -0,0 +1,10 @@ +#!/bin/bash +caput -s ${LLRF_IOC_NAME}:AI0-MAG.DESC "PreAmp Fwd" +caput -s ${LLRF_IOC_NAME}:AI1-MAG.DESC "PwrAmp Fwd" +caput -s ${LLRF_IOC_NAME}:AI2-SMON-MAGCURR.DESC "PwrAmp Rflct" +caput -s ${LLRF_IOC_NAME}:AI3-SMON-MAGCURR.DESC "Circ Fwd" +caput -s ${LLRF_IOC_NAME}:AI4-SMON-MAGCURR.DESC "Cav1 Fwd" +caput -s ${LLRF_IOC_NAME}:AI5-SMON-MAGCURR.DESC "Cav1 Reflct" +caput -s ${LLRF_IOC_NAME}:AI6-SMON-MAGCURR.DESC "Cav2 Fwd" +caput -s ${LLRF_IOC_NAME}:AI7-SMON-MAGCURR.DESC "Cav2 Reflct" + diff --git a/testing/test1.sh b/testing/test1.sh index f5ede7606e5a973de7e7e81cb7920b159315dfee..d4c87380dd200b8324e439e6d154a9c50fb9163a 100755 --- a/testing/test1.sh +++ b/testing/test1.sh @@ -82,7 +82,7 @@ echo 'Simulating backplane triggers to FPGA for pulse_coming, pulse_start and pu for i in `seq 1 50` do - echo "RF Pulse $i" + echo "Beam Pulse $i" sis8300drv_reg /dev/sis8300-$slot 0x404 -w 0x20 sis8300drv_reg /dev/sis8300-$slot 0x404 -w 0x40 sis8300drv_reg /dev/sis8300-$slot 0x404 -w 0x80