## Example RTEMS startup script # Adding to the useful abbreviations. NB: no () here (that executes the cmd!) #rr=rtemsReboot rr=bsp_reset IOC=pwd() cd("../..") # Load obj file ld("bin/RTEMS-beatnik/daq.obj") ## Set common environment variables. eg. EPICS_TS_NTP_INET and PORTs . iocBoot/ioc-as01-ls01/envPaths ## iocAdmin Setup epicsEnvSet("ENGINEER","Garth Brown (gwbrown)") epicsEnvSet("LOCATION","ASTA") # ======================================================== # Support Large Arrays/Waveforms; Number in Bytes # Please calculate the size of the largest waveform # that you support in your IOC. Do not just copy numbers # from other apps. This will only lead to an exhaustion # of resources and problems with your IOC. # The default maximum size for a channel access array is # 16K bytes. # ======================================================== epicsEnvSet("EPICS_CA_MAX_ARRAY_BYTES", "65536") ################################################ # Start IOC log client # and increase the bufffer size. ################################################ iocLogDisable=0 errlogInit(5000) iocLogInit() ################################################ # Register all EPICS support components # ################################################ dbLoadDatabase("dbd/daq.dbd") daq_registerRecordDeviceDriver(pdbbase) ########################################################### # Load EPICS databases # ########################################################### # ====================================================== # Timing System Event Receiver # ====================================================== # Init PMC EVR ErConfigure( ErConfigure(0, 0, 0, 0, 1) #dbLoadRecords("db/IOC-AS01-LS01-pattern.db") #dbLoadRecords("db/IOC-AS01-LS01-evr.db") #dbLoadRecords("db/IOC-AS01-LS01-trig.db") dbLoadRecords("db/Pattern.db","IOC=IOC:AS01:LS01, SYS=SYS7") dbLoadRecords("db/EvrPmc.db","EVR=EVR:AS01:LS01,CRD=0, SYS=SYS7") dbLoadRecords("db/PMC-trig.db", "LOCA=AS01,UNIT=LS01,SYS=SYS7,IOC=IOC:AS01:LS01") dbLoadRecords("db/VME-TTB-trig.db", "LOCA=AS01,UNIT=LS01,SYS=SYS7,IOC=IOC:AS01:LS01") # ====================================================== # BSA # ====================================================== dbLoadRecords("db/bsaPWREdef.db") # ====================================================== # DAQ # ====================================================== # Initialize IPAC ipacAddXy9660("0x0000,6") # initialize IPAC cards IP330_DRV_DEBUG=0 IP231_DRV_DEBUG=0 bspExtVerbosity=0 # ip330Create (analogue in) #------------------------------- # (1) Unique Identifier "ip330-1" # (2) Ipac Driver carrier card number # (3) Slot number on IP carrier # (4) This must be "-5to5D","-10to10D","0to5D","0to10D","-5to5S","-10to10S","0to5S","0to10S" (D-Differential, S-Single End) # (5) This must be "ch1-ch12" or "ch2-ch30", available range is 0 to 15/31 depends on Differential or Single End # (6) The lower two bits is gain for channel0, then channel 1 ... 15 # (7) The lower two bits is gain for channel16, then channel 17 ... 31 # (8) Scan mode must be "mode-trgdir-AvgxR" # mode could be "uniformCont", "uniformSingle", "burstCont", "burstSingle", "cvtOnExt" # trgdir could be "Input", "Output" except for "cvtOnExt" which must come with "Input" # AvgxN could be Avg10 means average 10 times, R means reset after average and only applicable to Continuous mode # (9) timer: "x*y@8MHz", x must be [64,255], y must be [1,65535] # (10) vector # Each sample takes 40us * 5 channels * 5 times = 1.0ms #ip330Create("ai0", 0, 0, "-5to5D", "ch0-ch15", 0x0, 0x0, "burstSingle-Input-Avg1", "64*65535@8MHz", 0x66) ip330Create("ai0", 0, 0, "-5to5D", "ch0-ch15", 0x0, 0x0, "burstCont-Input-Avg40", "64*1@8MHz", 0x66) # ==================================================== # Analog Output module [Acromag Industry Pack: IP231] # ==================================================== ip231Create("ao0", 0, 1, "transparent") epicsThreadSleep(1) dbLoadRecords("db/IOC-AS01-LS01-daq.db") # ======================================================== # IOC admin # ======================================================== dbLoadRecords("db/iocAdminRTEMS.db", "IOC=IOC:AS01:LS01") dbLoadRecords("db/iocRelease.db" ,"IOC=IOC:AS01:LS01") ############################################################## # autosave/restore # ############################################################## # Config # ------------------------------------------------------------ set_requestfile_path("/data/autosave-req") set_savefile_path("/data/autosave") save_restoreSet_status_prefix("IOC:AS01:LS01:") save_restoreSet_IncompleteSetsOk(1) save_restoreSet_DatedBackupFiles(1) # Restore # ------------------------------------------------------------ # specify what save files should be restored. Note these files must be # in the directory specified in set_savefile_path(), or, if that function # has not been called, from the directory current when iocInit is invoked # Save files associated with the request files 'auto_positions.req' and # 'auto_settings.req'. These files are the standard way to use autosave in # synApps. #set_pass0_restoreFile("auto_positions.sav") #set_pass0_restoreFile("auto_settings.sav") #set_pass1_restoreFile("auto_settings.sav") set_pass0_restoreFile("ioc-as01-ls01.sav") set_pass1_restoreFile("ioc-as01-ls01.sav") # Save files associated with the request files 'info_positions.req' and # 'info_settings.req'. These .req files are written by the autosave function # makeAutosaveFiles() below. set_pass0_restoreFile("info_positions.sav") set_pass0_restoreFile("info_settings.sav") set_pass1_restoreFile("info_settings.sav") # Database # ------------------------------------------------------------ dbLoadRecords("db/save_restoreStatus.db", "P=IOC:AS01:LS01:") iocInit() ############################################################## # post IOC init # ############################################################## # Autosave, create monitors # ----------------------- cd("/data/autosave-req") makeAutosaveFiles() create_monitor_set("info_positions.req",10) create_monitor_set("info_settings.req",30) # save positions every five seconds #create_monitor_set("auto_positions.req",10) # save other things every thirty seconds #create_monitor_set("auto_settings.req",30,"") create_monitor_set("ioc-as01-ls01.req",30,"") cd(IOC)