## 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/Laser.obj") #< envPaths ## Set common environment variables. eg. EPICS_TS_NTP_INET and PORTs putenv ("EPICS_CA_MAX_ARRAY_BYTES=4000000") ## iocAdmin Setup epicsEnvSet("ENGINEER","Garth Brown") epicsEnvSet("LOCATION","Laser Room:LKA03") # Start IOC log client # and increase the bufffer size. iocLogDisable=0 errlogInit(5000) iocLogInit() ## Register all support components dbLoadDatabase("dbd/Laser.dbd") Laser_registerRecordDeviceDriver(pdbbase) ########################### # initialize all hardware # ########################### # initialize IP cards IP330_DRV_DEBUG=0 IP231_DRV_DEBUG=0 bspExtVerbosity=0 # ================================================================== # Acromag Industry Pack Carrier Board AVME9670 # ================================================================== ipacAddXy9660("0xfc00,6") # =================================================================================================== # Analog Input module [Acromag Industry Pack: IP330] # =================================================================================================== # Each sample takes 40us * 5 channels * 5 times = 1.0ms ip330Create("ai2", 0, 0, "-10to10S", "ch0-ch31", 0x0, 0x0, "uniformCont-Output-Avg5", "64*300@8MHz", 0x70) ip330Create("ai0", 0, 2, "0to5D", "ch0-ch15", 0x0, 0x0, "uniformCont-Input-Avg5R", "64*5@8MHz", 0x66) ip330Create("ai1", 0, 3, "-5to5D", "ch0-ch15", 0x0, 0x0, "uniformCont-Input-Avg5R", "64*5@8MHz", 0x68) # ==================================================== # Analog Output module [Acromag Industry Pack: IP231] # ==================================================== ip231Create("ao0", 0, 1, "transparent") # ====================================================================================================== # Newport 8-Axis Ethernet-based Motion Controller: Model = XPS-C8 # ====================================================================================================== #### initialize XPS-C8 with the new asyn driver # Create Object for the controller itself ####################################################################################################### # XPSCreateController( asyn port, IP address, IP port, number of axes, # active poll period (ms), idle poll period (ms), # enable set position, set position settling time (ms) ) # # moc-lr20-ls01 is using 8 axes XPSCreateController("XPS1", "moc-lr20-ls01", 5001, 6, 1000, 500, 0, 500) # moc-lr20-ls03 is using 8 axes XPSCreateController("XPS2", "moc-lr20-ls03", 5001, 8, 1000, 500, 0, 500) # moc-lr20-ls04 is using 8 axes XPSCreateController("XPS3", "moc-lr20-ls04", 5001, 8, 1000, 500, 0, 500) # moc-lr20-ls05 is using 5 axes XPSCreateController("XPS4", "moc-lr20-ls05", 5001, 8, 1000, 500, 0, 500) # Uncomment below for debugging #asynSetTraceMask("XPS1", 0, 255) #asynSetTraceMask("XPS2", 0, 2) #asynSetTraceMask("XPS3", 0, 2) # Create port to access and control other features such as General purpose I/O ==> GPIO ####################################################################################################### # asynPort, IP address, IP port, poll period (ms) XPSAuxConfig("XPS_AUX1", "moc-lr20-ls01", 5001, 500) XPSAuxConfig("XPS_AUX2", "moc-lr20-ls03", 5001, 500) #XPSAuxConfig("XPS_AUX3", "moc-lr20-ls04", 5001, 500) XPSAuxConfig("XPS_AUX4", "moc-lr20-ls05", 5001, 500) # Create an instance for each axis ####################################################################################################### # XPSCreateAxis(XPS asyn port, axis, groupName.positionerName, stepSize) # stepSize = 1/encoderResolution # MOC-LR20-LS01 --- 172.27.13.5 ### XPSCreateAxis("XPS1",0,"Group1.Pos", "1000") XPSCreateAxis("XPS1",1,"Group2.Pos", "1000") XPSCreateAxis("XPS1",2,"Group3.Pos", "1000") XPSCreateAxis("XPS1",3,"Group4.Pos", "1000") XPSCreateAxis("XPS1",4,"Group5.Pos", "32786") XPSCreateAxis("XPS1",5,"Group6.Pos", "32786") #XPSCreateAxis("XPS1",6,"Group7.Pos", "1000") #XPSCreateAxis("XPS1",7,"Group8.Pos", "1000") # MOC-LR20-LS03 --- 172.27.13.12 ### XPSCreateAxis("XPS2",0,"GROUP1.POSITIONER", "1000") XPSCreateAxis("XPS2",1,"GROUP2.POSITIONER", "32786") XPSCreateAxis("XPS2",2,"GROUP3.POSITIONER", "32786") XPSCreateAxis("XPS2",3,"GROUP4.POSITIONER", "5000") XPSCreateAxis("XPS2",4,"GROUP5.POSITIONER", "1000") XPSCreateAxis("XPS2",5,"GROUP6.POSITIONER", "32786") XPSCreateAxis("XPS2",6,"GROUP7.POSITIONER", "32786") XPSCreateAxis("XPS2",7,"GROUP8.POSITIONER", "1000") # MOC-LR20-LS04 --- 172.27.14.13 ### XPSCreateAxis("XPS3",0,"Group1.Pos", "32786") XPSCreateAxis("XPS3",1,"Group2.Pos", "32786") XPSCreateAxis("XPS3",2,"Group3.Pos", "32786") XPSCreateAxis("XPS3",3,"Group4.Pos", "32786") XPSCreateAxis("XPS3",4,"Group5.Pos", "1000") XPSCreateAxis("XPS3",5,"Group6.Pos", "32786") XPSCreateAxis("XPS3",6,"Group7.Pos", "32786") XPSCreateAxis("XPS3",7,"Group8.Pos", "1000") # MOC-LR20-LS05 --- 172.27.14.16 ### XPSCreateAxis("XPS4",0,"Group1.Pos", "5000") XPSCreateAxis("XPS4",1,"Group2.Pos", "1000") XPSCreateAxis("XPS4",2,"Group3.Pos", "1000") XPSCreateAxis("XPS4",3,"Group4.Pos", "1000") XPSCreateAxis("XPS4",4,"Group5.Pos", "32786") XPSCreateAxis("XPS4",5,"Group6.Pos", "32786") XPSCreateAxis("XPS4",6,"Group7.Pos", "32786") XPSCreateAxis("XPS4",7,"Group8.Pos", "32786") ####################################################################################################### # Why are needing a delay here? epicsThreadSleep(1) # ========================================================= # Initialize EVR # ========================================================= # Init PMC EVR ErConfigure(0, 0, 0, 0, 1) ########################### ## Load record instances ## ########################### dbLoadRecords("db/IOC-LR20-LS01.db", "SYS=SYS0") dbLoadRecords("db/IOC-LR20-LS01iris.db") dbLoadRecords("db/IOC-LR20-LS01trig.db", "SYS=SYS0") dbLoadRecords("db/IOC-LR20-LS01misc.db", "SYS=SYS0") # ====================================================== # iocAmin # ====================================================== dbLoadTemplate("db/IOC-LR20-LS01-iocAdmin.substitutions") ############################################################## # autosave/restore # ############################################################## # Config # ------------------------------------------------------------ set_requestfile_path("/data/autosave-req") set_savefile_path("/data/autosave") save_restoreSet_status_prefix("IOC:LR20: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") # 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:LR20:LS01:") #Increase (x30) the callback queue size for peak loads#------- callbackSetQueueSize(30000) iocInit() ############################################################## # post IOC init # ############################################################## # Initialize IP330 - Not needed if triggered ip330StartConvertByName("ai2") # 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,"") ## Start any sequence programs #################################################### # IP231 doesn't restore properly. The PV gets set, but the hardware doesn't. # Making the PVs process seems to get the job done. dbpf("DAC:LR20:10:AO0_CH00.PROC", "1") dbpf("OSC:LR20:10:CH1_FEEDBACK_GAIN.PROC", "1") dbpf("OSC:LR20:20:CH1_FEEDBACK_GAIN.PROC", "1") dbpf("OSC:LR20:20:PID_MODE.PROC", "1") #dbpf("MRC:LR20:119:QD1_CTRL.PROC", "1") #dbpf("MRC:LR20:119:QD2_CTRL.PROC", "1") ## Start any sequence program cd("iocBoot/ioc-lr20-ls01") seq(&laserPowerControl,"FBCK=FBCK:LR20:LS01,ENABLE=LASR:LR20:80:FBCK_ENABLE,LASR_WPLT=WPLT:LR20:80:WP1_ANGLE,LASR_ANG_MAX=WPLT:LR20:80:WP1_ANG_MAX") seq(&laserPowerControl,"FBCK=FBCK:LR20:LS01,ENABLE=LASR:LR20:70:FBCK_ENABLE,LASR_WPLT=WPLT:LR20:70:WP2_ANGLE,LASR_ANG_MAX=WPLT:LR20:70:WP2_ANG_MAX") seq(&sncIrisConfig)