...
First, define the usual environment variables in the startup script.
Code Block |
---|
|
# ===========================================
# ENVIRONMENT VARIABLES
# ===========================================
epicsEnvSet("AREA", "SYS0" )
epicsEnvSet("UNIT", "MS09" )
epicsEnvSet("LOCATION", "" )
epicsEnvSet("IOC_PV", "SIOC:$(AREA):$(UNIT)" )
epicsEnvSet("TPR_PV", "TPR:$(AREA):$(UNIT)" )
epicsEnvSet("IOC", "sioc-sys0-ms09" )
epicsEnvSet("HASH", "58070ee" )
epicsEnvSet("YAML_DIR", "${TOP}/yaml/EvrCardG2-$(HASH).yaml")
epicsEnvSet("YAML_TOP_FILE", "${YAML_DIR}/000TopLevel.yaml" )
# Support Large Arrays/Waveforms; Number in Bytes
epicsEnvSet("EPICS_CA_MAX_ARRAY_BYTES", "2000000")
|
Common setup
Load dbd and IOC health/monitoring records. Also, set up autosave and load the LCLS access configuration file. Finally, copy the archive file in $IOC_DATA to enable record archiving.
Code Block |
---|
|
## Load dbd
dbLoadDatabase("dbd/masterSource.dbd", 0, 0)
masterSource_registerRecordDeviceDriver(pdbbase)
## Environment variables
epicsEnvSet("ENGINEER", "")
epicsEnvSet("STREAM_PROTOCOL_PATH", "${TOP}/db")
## Tag log messages with IOC name
epicsEnvSet("EPICS_IOC_LOG_CLIENT_INET", "${IOC}")
## Load records
# **** Load iocAdmin databases to support IOC Health and monitoring ****
dbLoadRecords("db/iocAdminSoft.db", "IOC=${IOC_NAME}")
dbLoadRecords("db/iocAdminScanMon.db", "IOC=${IOC_NAME}")
dbLoadRecords("db/iocRelease.db", "IOC=${IOC_NAME}")
## Autosave initialization
< $(TOP)/iocBoot/common/autosave_init.cmd
## Channel Access Security:
# This is required if you use caPutLog.
# Set access security file
# Load common LCLS Access Configuration File
< ${ACF_INIT}
## Update archive pv list in ${IOC_DATA}
system("cp $(TOP)/archive/${IOC}.archive ${IOC_DATA}/${IOC}/archive/")
|
Autosave initialization
Tell the IOC where to find the list of record names and where they will be autosaved. Also, restore previously autosaved values.
Code Block |
---|
|
# =====================================================================
# Load database for autosave status
# =====================================================================
dbLoadRecords("db/save_restoreStatus.db", "P=${IOC_NAME}:")
# ============================================================
# If all PVs don't connect continue anyway
# ============================================================
save_restoreSet_IncompleteSetsOk(1)
# ============================================================
# created save/restore backup files with date string
# useful for recovery.
# ============================================================
save_restoreSet_DatedBackupFiles(1)
# ============================================================
# Where to find the list of PVs to save
# ============================================================
set_requestfile_path("${IOC_DATA}/${IOC}/autosave-req")
# ============================================================
# Where to write the save files that will be used to restore
# ============================================================
set_savefile_path("${IOC_DATA}/${IOC}/autosave")
# ============================================================
# Prefix that is use to update save/restore status database
# records
# ============================================================
save_restoreSet_status_prefix("${IOC_NAME}:")
## Restore datasets
set_pass0_restoreFile("info_positions.sav")
set_pass1_restoreFile("info_positions.sav")
set_pass0_restoreFile("info_settings.sav")
set_pass1_restoreFile("info_settings.sav")
|
Besides the auto-generated record names for autosave, copy the manually generated list of records to be autosaved and restore their previously autosaved values.
Code Block |
---|
|
# Copy over the manual settings request file
system("cp $(TOP)/autosave/${IOC}.req ${IOC_DATA}/${IOC}/autosave-req/")
# Load manual settings from autosave
set_pass0_restoreFile("${IOC}.sav")
set_pass1_restoreFile("${IOC}.sav")
|
Yaml initialization
Load the YAML hierarchy and register configuration.
Code Block |
---|
|
# Use slot A pcie tpr for root_0, override to use slot_a
cpswLoadYamlFile("${YAML_TOP_FILE}", "MemDev", "", "/dev/tpra", "root_0")
|
Database loading
Load the phase locker records.
Code Block |
---|
|
# ===========================================
# DB LOADING
# ===========================================
# TPR driver DB
dbLoadRecords("db/pcie_tprTrig.db", "DEV=${IOC_PV}:0,LOCA=$(AREA),IOC_UNIT=$(UNIT),INST=0,PORT=trig0")
# Load database for autosave status
dbLoadRecords("db/save_restoreStatus.db", "P=${IOC_PV}:")
|
Asyn driver configuration
Create the ycpswAsynDriver with a dictionary option, i.e. use a limited number of interfaces to the FPGA registers.
Code Block |
---|
|
# ===========================================
# DRIVER SETUP
# ===========================================
# Configure crossbarControlAsynDriver
crossbarControlAsynDriverConfigure("crossbar0", "PCIe:/mmio/SfpXbar", "root_0")
# Setup tprTrigger Driver
tprTriggerAsynDriverConfigure("trig0", "PCIe:/mmio", "root_0")
|
Archiver list
A complete list of the records to archive is provided below.
...
Code Block |
---|
|
# ===========================================
# IOC INIT
# ===========================================
iocInit()
# ===========================================
# CAPUTLOG
# ===========================================
# Turn on caPutLogging:
# Log values only on change to the iocLogServer:
caPutLogInit("${EPICS_CA_PUT_LOG_ADDR}")
caPutLogShow(2)
|
...