#==============================================================================
#
# Abs:  LCLS EVR IOC records for CAMAC-to-VME IOCs
#
# Name: camac_evr.substitutions
#
# Macros: evr.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
#
#	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.
#
# Facility: LCLS CAMAC Controls
#
# Auth: 30-Jun-2009, K. Luchini       (LUCHINI)
# Rev : dd-mmm-yyyy, Reviewer's Name  (USERNAME)
#-----------------------------------------------------------------------------
# Mod:
#       dd-mmm-yyyy, First Lastname    (USERNAME):
#          comment
#
#==============================================================================
#
file evr.db 
{
#                           Default Pulse
#	 Device      Card   Delay   Width (clock ticks)    
pattern { DEV      , CARD , DELAY , WIDTH }
	{ $(DEVICE),  0   ,   0   ,  12   }
}

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}
	{ $(DEVICE) ,   0  , EVENT1  ,140 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT2  , 40 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT3  , 41 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT4  , 42 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT5  , 43 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT6  , 44 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT7  , 45 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT8  , 46 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT9  , 11 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT10 , 12 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT11 , 13 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT12 , 14 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT13 , 15 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
	{ $(DEVICE) ,   0  , EVENT14 , 16 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0 , 0 , 0 , 0 }
}

# End of file
