156 lines
5.3 KiB
Plaintext
156 lines
5.3 KiB
Plaintext
# This is the common part of all vxWorks startup scripts
|
|
# It is included by all generated scripts
|
|
|
|
# The following variables should be set before:
|
|
# * EPICS the epics release (e.g "R3.14.12")
|
|
|
|
EPICS_MODULES = "/ioc/modules"
|
|
|
|
# Find a better way later to know current require version
|
|
REQUIRE_VERSION="3.1.0"
|
|
|
|
# Set EPICS_HOST_ARCH according to vxWorks version and cpu type
|
|
VX6=(*runtimeVersion>>24)-'5'
|
|
VMI=(*runtimeVersion>>8)&255
|
|
EPICS_HOST_ARCH=malloc(16)
|
|
sprintf EPICS_HOST_ARCH, "%s%c-ppc60%d", VX6 ? "V6" : "T", VX6 ? VMI : VMI>'3' ? '2' : '1', sysCpu-90
|
|
printf "EPICS_HOST_ARCH = %s\n",EPICS_HOST_ARCH
|
|
|
|
# Set target name as IOC name
|
|
IOC=&sysBootParams+60
|
|
printf "IOC = %s\n",IOC
|
|
|
|
BOOTPC=&sysBootHost
|
|
printf "BOOTPC = %s\n",BOOTPC
|
|
|
|
STRINGBUFFER=malloc(256)
|
|
|
|
# Set the prompt
|
|
sprintf STRINGBUFFER, "%s (startup.script aborted) > ", IOC
|
|
shellPromptSet STRINGBUFFER
|
|
|
|
# Set DNS if necessary
|
|
resolvInit "129.129.190.11", "psi.ch"
|
|
|
|
# autoSR location
|
|
putenv "SRBASE=/ioc/data"
|
|
|
|
# Do the NFS mounts and other network dependend stuff
|
|
nfsAuthUnixSet &sysBootHost,500,9102
|
|
< /ioc/startup/network
|
|
|
|
# Set environment variables
|
|
sprintf STRINGBUFFER, "IOC=%s", IOC
|
|
putenv STRINGBUFFER
|
|
|
|
sprintf STRINGBUFFER, "BOOTPC=%s", BOOTPC
|
|
putenv STRINGBUFFER
|
|
|
|
sprintf STRINGBUFFER, "EPICS_HOST_ARCH=%s", EPICS_HOST_ARCH
|
|
putenv STRINGBUFFER
|
|
|
|
# Create some path variables
|
|
HOME=malloc(80)
|
|
sprintf HOME, "/ioc/%s", IOC
|
|
sprintf STRINGBUFFER, "HOME=%s", HOME
|
|
putenv STRINGBUFFER
|
|
cd HOME
|
|
|
|
CFG=malloc(80)
|
|
sprintf CFG, "%s/cfg", HOME
|
|
sprintf STRINGBUFFER, "CFG=%s", CFG
|
|
putenv STRINGBUFFER
|
|
|
|
STREAM_PROTOCOL_DIR=malloc(80)
|
|
sprintf STREAM_PROTOCOL_DIR, "%s/cfg", HOME
|
|
|
|
sprintf STRINGBUFFER, "EPICS_DRIVER_PATH=.:bin/%s_%s:bin:snl:../bin:%s", EPICS, EPICS_HOST_ARCH, EPICS_MODULES
|
|
putenv STRINGBUFFER
|
|
|
|
# Release memory above 32 MB
|
|
# Code loaded after this must be compiled with -mlongcall
|
|
# at the moment snp24 does not work with this
|
|
memAddToPool sysMemTop(),sysPhysMemTop()-sysMemTop()
|
|
EXTENDED_MEMORY=0
|
|
|
|
# Need to branch a few times on EPICS base release
|
|
R3_13 = strncmp(EPICS,"R3.13.",6)==0
|
|
R3_14 = strncmp(EPICS,"R3.14.",6)==0
|
|
R3_14_8 = strcmp(EPICS,"R3.14.8")==0
|
|
R3_15 = strncmp(EPICS,"R3.15.",6)==0
|
|
R3_16 = strncmp(EPICS,"R3.16.",6)==0
|
|
R3 = strncmp(EPICS,"R3.",3)==0
|
|
R7 = strncmp(EPICS,"R7.",3)==0
|
|
PVA = R7&&VX6
|
|
|
|
# Time server (must be set before loading iocCoreLibrary.munch for 3.14.12)
|
|
# Need EPICS_TS_FORCE_NTPTIME for 7.0
|
|
putenv "EPICS_TS_NTP_INET=129.129.190.1"
|
|
putenv "EPICS_TS_FORCE_NTPTIME=YES"
|
|
|
|
# Load EPICS system core (different names for different EPICS versions)
|
|
# 3.13: "iocCore"
|
|
# 3.14: "iocCoreLibrary.munch"
|
|
# 3.15+: "softIoc.munch" (could do this from 3.14.12 on)
|
|
EPICS_APP = R3_13 ? "iocCore" : R3_14 ? "iocCoreLibrary.munch" : PVA ? "softIocPVA.munch" : "softIoc.munch"
|
|
sprintf STRINGBUFFER, "/epics/base-%s/bin/%s/%s", EPICS+1, EPICS_HOST_ARCH, EPICS_APP
|
|
printf "loading %s\n",STRINGBUFFER
|
|
ld 0, 0, STRINGBUFFER
|
|
|
|
# Setup Time (must be set after loading iocCoreLibrary.munch)
|
|
# 2021:
|
|
putenv "EPICS_TIMEZONE=MET::-60:032802:103103"
|
|
putenv "TIMEZONE=MET::-60:032802:103103"
|
|
putenv "EPICS_TS_MIN_WEST=-60"
|
|
|
|
# Allow backward compatible non-monotonic breaktables
|
|
dbBptNotMonotonic=1
|
|
|
|
# Start Logging
|
|
putenv getenv("EPICS_IOC_LOG_INET") ? "" : "EPICS_IOC_LOG_INET=gfa-syslog"
|
|
putenv getenv("EPICS_IOC_LOG_PORT") ? "" : "EPICS_IOC_LOG_PORT=1514"
|
|
sprintf STRINGBUFFER, R3_13||R3_14_8 ? "putenv \"EPICS_CA_PUT_LOG_PREFIX=%s\"" : "iocLogPrefix \"%s \"", IOC
|
|
execute STRINGBUFFER
|
|
iocLogInit
|
|
errlogPrintf "Starting EPICS %s\n", EPICS
|
|
|
|
sprintf STRINGBUFFER, R3_13||R3_14 ? ";" : "dbLoadDatabase \"/epics/base-%s/dbd/softIoc%s.dbd\"", EPICS+1, PVA ? "PVA" : ""
|
|
execute STRINGBUFFER
|
|
|
|
sprintf STRINGBUFFER, R3_13||R3_14 ? ";" : "softIoc%s_registerRecordDeviceDriver pdbbase", PVA ? "PVA" : ""
|
|
execute STRINGBUFFER
|
|
|
|
# load "require"
|
|
sprintf STRINGBUFFER, "require_VERSION=%s", getenv("require_VERSION") ? getenv("require_VERSION") : REQUIRE_VERSION
|
|
putenv STRINGBUFFER
|
|
sprintf STRINGBUFFER, "require_DIR=%s/require/%s/%s/", EPICS_MODULES, getenv("require_VERSION"), EPICS
|
|
putenv STRINGBUFFER
|
|
sprintf STRINGBUFFER, "%s/lib/%s/requireLib.munch", getenv("require_DIR"), EPICS_HOST_ARCH
|
|
ld 0, 0, STRINGBUFFER
|
|
|
|
#load standard drivers (allow user to specify version in environment variable)
|
|
require "base", getenv("base_VERSION") ? getenv("base_VERSION") : "ifexists"
|
|
registerModule "require", getenv("require_VERSION"), getenv("require_DIR")
|
|
sprintf STRINGBUFFER, R3_13 ? ";" : "require_registerRecordDeviceDriver pdbbase"
|
|
execute STRINGBUFFER
|
|
require "utilities", getenv("utilities_VERSION")
|
|
require "misc", getenv("misc_VERSION")
|
|
|
|
# caPutLog
|
|
putenv "EPICS_CA_PUT_LOG_ADDR=gfa-syslog:1515 gfa-logstash.psi.ch:1515"
|
|
require "caPutLog", getenv("caPutLog_VERSION")?getenv("caPutLog_VERSION"):"ifexists"
|
|
|
|
# Run Channel Access only on 1st network port
|
|
putenv "EPICS_CA_AUTO_ADDR_LIST=NO"
|
|
putenv getenv("EPICS_CA_ADDR_LIST") ? "" : bootInfo("EPICS_CA_ADDR_LIST=%B")
|
|
putenv bootInfo("EPICS_CAS_INTF_ADDR_LIST=%e")
|
|
putenv "EPICS_CAS_AUTO_BEACON_ADDR_LIST=NO"
|
|
sprintf STRINGBUFFER, getenv("EPICS_CAS_BEACON_ADDR_LIST") ? "" : "EPICS_CAS_BEACON_ADDR_LIST=%s", getenv("EPICS_CA_ADDR_LIST")
|
|
putenv STRINGBUFFER
|
|
|
|
# EPICS 3.13 needs this to not use synchronized timestamps
|
|
sprintf STRINGBUFFER, R3_13 ? "TSconfigure(0,10,10,18323,18322,250,1)" : ";"
|
|
execute STRINGBUFFER
|
|
|
|
# End of startup.script_common
|