#==============================================================================
#
# Abs:  LCLS EVR records for Laser Steering LS01
#
# Name: LaserSteeringEVRLS01.substitutions
#
# Macros: evrWithExtDelays.db - instantiates an EVR record.
#	  Associated display is evrDiags.edl.
#	DEV	Name of EVR - EVR:<loca>:<unit>
#	CARD	EVR card number starting at 0 (matches card number in ErConfigure).
#	DELAY	Initial delay in ticks for normal delay triggers (one tick = 8.4 nsec)
#	WIDTH	Initial pulse width in ticks
#	STATE	Initial trigger state ("Enabled" or "Disabled")
#	DG0C, DG1C, DG2C - Clock prescaler      for 3 extended delay triggers on the front panel
#	DG0W, DG1W, DG2W - Pulse width in ticks for 3 extended delay triggers on the front panel 
#	DG0D, DG1D, DG2D - Delay in ticks       for 3 extended delay triggers on the front panel 
#	DG0P, DG1P, DG2P - Polarity ("Normal", "Inverted")
#
#	evrEventCtrl.db - instantiates a record for an EVR event.
#	Associated display is evrTriggerDiags.edl.
#	DEV	Name of EVR - EVR:<loca>:<unit>
#	CARD	EVR card number starting at 0 (matches card number in ErConfigure).
#	NAME	EVENT1 to EVENT14 - instantiate all 14 records even if you only use a few events.
#	ID	Event code number.  To find all available event codes:
#		lclshome -> Event -> Events... (in the EVG IOC box).
#		This display brings up all the event that are beam-dependent.
#	        For events that are beam-independent (constant or standby), select 
#		"Time Slot 1 to 6 Event Codes".  Find the event that you want to trigger one or 
#		more devices connected to the EVR.  Use number in the Event Code column.
#		Also check sharepoint spreadsheet:
#		Controls -> Timing -> timingEventCodes
#		NOTE: There is a dependency on event code assignments and triggers.
#     		When changing event code assignments below, also change the appropriate
#    		<ioc>trig.substitutions file!
#		NOTE: If you don't need to use all 14 event codes, populate the spare records 
#		with other event codes from the "Time Slot 1 to 6 Event Codes" display.
#	P0 to P13 - trigger state for channels 0 to 13
#		(0 = disabled for the event code, 1 = enabled for the event code)
#		Channels 0 to 3  are used for the front panel triggers.
#		Channels 0 to 13 are used for the transition module triggers.
#		The assignments here must match the field selections in <ioc>trig.substitution.
#	VME	Controls whether an IRQ happens when this event code occurs.
#		(0 = no IRQ, 1 = IRQ)
#		Must be set to 1 if you want event record processing using the event code.
#		Must be set to 1 if you have records with TSE fields set to the event code.
#
#==============================================================================
#
file evrWithExtDelays.db
{
#                      Default Pulse <--------------------------- Extended Delays -------------------------------------->
#	 Device     Card Delay Width State    Clock PreScaler   Pulse Widths       Delays             Polarities     
pattern { DEV      ,CARD,DELAY,WIDTH,STATE   , DG0C,DG1C,DG2C, DG0W,DG1W,DG2W, DG0D,DG1D,DG2D,   DG0P  ,  DG1P  ,  DG2P  }
	{ $(LOC)   ,0   ,  0  , 12  ,Enabled , 119 ,119 ,119 , 1000,1000, 5  , 900 ,910 ,2200,   Normal, Normal ,Inverted}
}
file evrEventCtrl.db
{
#	  Device      Card  <----------------------------  Event -------------------------->       
pattern { DEV       , CARD , NAME    , ID ,P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,VME,SYS}
	{ $(LOC)    ,  0   , EVENT1  , 40 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 ,SYS0}
	{ $(LOC)    ,  0   , EVENT2  , 41 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 ,SYS0}
	{ $(LOC)    ,  0   , EVENT3  , 42 , 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 ,SYS0}
	{ $(LOC)    ,  0   , EVENT4  , 43 , 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 , 1 , 1 , 1 , 0 ,SYS0}
	{ $(LOC)    ,  0   , EVENT5  , 44 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 ,SYS0}
	{ $(LOC)    ,  0   , EVENT6  , 45 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 ,SYS0}
	{ $(LOC)    ,  0   , EVENT7  , 46 , 0, 0, 0, 0, 0, 0, 0,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