From d9f76f65b59f030e5fd75910bbe0c3105252af56 Mon Sep 17 00:00:00 2001 From: thomasfay <thomas.fay@esss.se> Date: Fri, 2 Aug 2019 11:22:04 +0200 Subject: [PATCH] WIP2 --- startup/deployStartup.sh | 53 ++++++++++++++++++++++++++++++++++++++++ startup/setPVs.sh | 10 ++++++++ testing/test1.sh | 2 +- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100755 startup/deployStartup.sh create mode 100644 startup/setPVs.sh diff --git a/startup/deployStartup.sh b/startup/deployStartup.sh new file mode 100755 index 0000000..efbb99c --- /dev/null +++ b/startup/deployStartup.sh @@ -0,0 +1,53 @@ +#!/bin/sh + +#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\" \"$LLRF_IOC_NAME\" ) \\\n \ +epicsEnvSet(\"LLRF_SLOT\" \"<slot>\" ) \\\n \ +iocshLoad $\(E3_CMD_TOP\)\/llrf.iocsh \\\n \ +iocshLoad $\(E3_CMD_TOP\)\/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\)\/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/setPVs.sh b/startup/setPVs.sh new file mode 100644 index 0000000..b27dd27 --- /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 f5ede76..d4c8738 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 -- GitLab