## PAD RTEMS startup script for Klystron 24-8 and Phase Cavity 3 PAD at Sector 25 PADLAN9118_BPH3 app ## Set common environment variables #< /boot/lcls/epics/iocCommon/All/Prod/pre_st.cmd should be done by calling script epicsEnvSet("EPICS_CA_MAX_ARRAY_BYTES","1000000") # Setup for generic piece setenv("IPADDR1","172.27.206.21",1) setenv("NETMASK1","255.255.255.0",1) setenv("PADSLOT","11",1) setenv("LOCAs","LI25",1) setenv("UNITs","300",1) #addpath("/boot/g/lcls/users/strauman/epics/dev/app/bin/RTEMS-uC5282/:",1) # Generic piece of Stripline BPM PAD initialization wdStart(20) # Dedicated ethernet + network stack driver ld("lanIpBasic.obj") #check that it finds this # turning on lanIpDebug shows you all the ARP requests on the console lanIpDebug = 0 lanIpSetup(getenv("IPADDR1"),getenv("NETMASK1"),0,0) chdir("/boot/lcls/epics/iocTop/LLRF/Pad4-Prod") ld("bin/RTEMS-uC5282/padLan9118Bph3App.obj") lsmod() dbLoadDatabase("dbd/pad4App.dbd") pad4App_registerRecordDeviceDriver(pdbbase) drvPadScalFlag=2 drvPadLan9118DacqFlag=2 ## Load record instances dbLoadTemplate("db/padKLY248.bph3_template") dbLoadRecords("db/iocAdmin.db","IOC=EIOC:LI24:RD02") # autosave/restore settings substr=malloc(500) sprintf(substr,"") # no pattern here. PVs are KLYS:LI24:K8:TC3 and PCAV:LI25:300:PH3 printf("%s\n",substr) save_restoreSet_status_prefix( substr) save_restoreSet_IncompleteSetsOk(1) save_restoreSet_DatedBackupFiles(1) sprintf(substr,"/data/autosave-req") set_requestfile_path(substr) set_requestfile_path("./") # maybe you do need this set_savefile_path("/data","autosave") ## ============================================== ## New method for autosave and restore ## Decide what is saved by specifying it in the ## EPICS databases ## ============================================= #set_pass0_restoreFile("info_positions.sav") set_pass0_restoreFile("info_settings.sav") set_pass1_restoreFile("info_settings.sav") ## ============================================= ## Load Access Security File ## caPutLog now depends on this running. #asSetFilename("db/mpsLinkNode.acf") # New: pre maps /data to /u1/lcls/epics/ioc/data/ #dbRestore("/data/EIOC-LI24-RD02.sav") autosave replaces this iocInit() # force scalar waveforms to read (once) dbpf("KLYS:LI24:K8:TC3_0_SCL_WF.PROC","1") dbpf("KLYS:LI24:K8:TC3_1_SCL_WF.PROC","1") dbpf("KLYS:LI24:K8:TC3_2_SCL_WF.PROC","1") # channel 3 used by PCAV dbpf("KLYS:LI24:K8:TC3_0_OFST.PROC","1") dbpf("KLYS:LI24:K8:TC3_1_OFST.PROC","1") dbpf("KLYS:LI24:K8:TC3_2_OFST.PROC","1") dbpf("PCAV:LI25:300:PH3_3_OF_0.PROC","1") dbpf("PCAV:LI25:300:PH3_3_OF_1.PROC","1") # regardless of CW dbpf("KLYS:LI24:K8:TC3_4_OFST","0") dbpf("KLYS:LI24:K8:TC3_5_OFST","0") dbpf("KLYS:LI24:K8:TC3_6_OFST","0") dbpf("KLYS:LI24:K8:TC3_7_OFST","0") # size must be a multiple of 4 since # data in quadruples of (Q1,I2,Q3,I4) read # (see comments in drvPad.c for more info) dbpf("KLYS:LI24:K8:TC3_0_SIZE.PROC","1") dbpf("KLYS:LI24:K8:TC3_1_SIZE.PROC","1") dbpf("KLYS:LI24:K8:TC3_2_SIZE.PROC","1") dbpf("PCAV:LI25:300:PH3_3_SZ_0.PROC","1") dbpf("PCAV:LI25:300:PH3_3_SZ_1.PROC","1") # regardless of CW dbpf("KLYS:LI24:K8:TC3_4_SIZE","65536") dbpf("KLYS:LI24:K8:TC3_5_SIZE","65536") dbpf("KLYS:LI24:K8:TC3_6_SIZE","65536") dbpf("KLYS:LI24:K8:TC3_7_SIZE","65536") ## ===================================================== ## Turn on caPutLogging: ## Log values only on change to the iocLogServer: #caPutLogInit("172.27.8.31:7004") #caPutLogShow(2) ## =========================================================== ## Start autosave routines to save our data ## =========================================================== # optional, needed if the IOC takes a very long time to boot. epicsThreadSleep( 1.0) ## Handle autosave 'commands' contained in loaded databases. # change directory to ioc startup area to run makeAutosaveFiles() chdir("/data/autosave-req") iocshCmd("makeAutosaveFiles()") ## Explaining the difference: even though there is only field line added ## to the record, it is used in two ways. First, on pass0, the positions ## are saved at the rate of 5 sec. Why you would want to do this more ## than once escapes me. Second, you save the the settings every 30 sec ## to a file (if they change more freq, the values are kept in RAM !? ## ??? create_monitor_set("info_positions.req", 5, "U=USEG:UND1:150:") # 2/2/2009 deliberately leaving off last argument... create_monitor_set("info_settings.req", 30, "U=") free(substr)