tclk_events_h

#include "ul_cnscom_noX11.h"
/*
**	Copyright 1991-2017, Fermi Research Alliance, LLC.  All rights reserved.
*/
/******************************************************************************/
/* tclk_events.h
**
**	This header file contains named constants for TCLK events.
**
**	Whenever this file is updated, the same changes should be made
**	to tclk_events.txt which provides the short text for the clock
**	event database.
**
*/
/******************************************************************************/

#ifndef TCLK_EVENTS_DEFINED			/* do this only once */
#define	TCLK_EVENTS_DEFINED

#define	TCLK_MIN_EVENT		0		/* minimum valid TCLK event */
#define	TCLK_MAX_EVENT		0xFF		/* maximum valid TCLK event */
#define	TCLK_NUM_EVENTS		256		/* number of valid TCLK events */

// Clock event offsets for various Accelerator Clocks
// Used by lckclk_c and friends
#define	DEFAULT_CLOCK_BASE	0
#define	TCLK_BASE		1024
#define	MIBS_BASE		1280
#define	RRBS_BASE		1536
#define	TVBS_BASE		1792
#define	TESTCLK_BASE		2048
#define	HINSCLK_BASE		3072		/* (repurposed for PROJ) */
#define	PROJCLK_BASE		3072
#define	NMLCLK_BASE		4096

// Clock multicast types
#define	MCAST_TYPE_NONE		(-1)		/* no multicast */
#define	MAX_MCAST_TYPES		(4)		/* # of clock multicast types */
#define	MCAST_TYPE_TCLK		(0)		/* TEV clock */
#define	MCAST_TYPE_TEST		(1)		/* test TimeLine Generator clock */
#define	MCAST_TYPE_HINS		(2)		/* (repurposed for PROJ)*/
#define	MCAST_TYPE_PROJ		(2)		/* special PROJects clock (including PXIE) */
#define	MCAST_TYPE_NML		(3)		/* New Muon Lab clock (FAST) */

#define	MCAST_BEAM_SYNC_EVENTS_AVAILABLE	(FALSE)	/* flag indicating whether or not beam sync events are available via multicast */

/*
  General clock system events
*/
#define	EVENT_SC_RESET		0		/* super cycle and master clock reset */
/* #define	EVENT_SC_SAMPLE		1 */		/* super cycle sample time */
#define	EVENT_TIMESTAMP_RESET	2		/* plot timestamp reset */
#define	EVENT_MTA_PERMITTED	3		/* MTA beam permitted cycle */
#define	EVENT_MTA_RESET		4		/* MTA (Muon Test Area) reset */
#define	EVENT_USER_FRIENDLY	5		/* user friendly event */
#define	EVENT_60_HZ		6		/* 60 Hz event */
#define	EVENT_720_HZ		7		/* 720 Hz event */
#define	EVENT_LINAC_PREPULSE	8		/* anticipate beam prepulse cycle */
#define	EVENT_NTF_PERMITTED	9		/* NTF beam permitted cycle */
#define	EVENT_LINAC_STUDIES	0x0A		/* Linac 400 MeV studies */
#define	EVENT_BOOSTER_SD_READY	0x0B		/* Booster sampled data ready */
/* #define	EVENT_MR_SD_READY	0x0C */		/* Main Ring sampled data ready */
/* #define	EVENT_MI_SD_READY	0x0C */		/* Main Injector sampled data ready */
#define	EVENT_BOOSTER_15HZ_RESET	0x0C	/* Booster reset 15 Hz event */
#define	EVENT_BOOSTER_CYCLE_TIME	0x0D	/* Booster beam cycle time */
#define	EVENT_BOOSTER_1ST_BEAM	0x0E		/* Booster first beam cycle */
#define	EVENT_15_HZ		0x0F		/* 15 Hz event */

/*
  Linac and Booster events
*/
#define	EVENT_BOOSTER_BEAM_RESET	0x10	/* Booster beam cycle */
#define	EVENT_BOOSTER_NULL_RESET	0x11	/* Booster reset for null cycle */
#define	EVENT_BOOSTER_PREPULSE	0x12		/* Booster beam prepulse cycle */
/* #define	EVENT_BOOSTER_RESET_FOR_MR	0x13 */	/* Booster beam cycle to Main Ring */
#define	EVENT_BOOSTER_RESET_FOR_MI	0x13	/* Booster beam cycle to Main Injector */
#define	EVENT_BOOSTER_RESET_FIXTAR	0x13	/* Booster fixed target beam cycle */
#define	EVENT_BOOSTER_RESET_FOR_PBAR	0x14	/* Booster beam cycle to P-bar */
#define	EVENT_BOOSTER_RESET_FOR_MI_MUON_STUDIES	0x14	/* Booster beam cycle for MI/Muon studies */
#define	EVENT_BOOSTER_RESET_FOR_MI_MUON_STUDY	0x14	/* Booster beam cycle for MI/Muon studies */
#define	EVENT_BOOSTER_RESET_FOR_COLLIDER	0x15	/* Booster beam cycle to Collider */
#define	EVENT_BOOSTER_RESET_FOR_MI_RR_STUDIES	0x15	/* Booster beam cycle for MI/RR studies */
#define	EVENT_BOOSTER_RESET_FOR_DEB_ACC	0x16	/* Booster Debuncher/Accumulator beam cycle */
#define	EVENT_BOOSTER_RESET_FOR_MI_STUDIES	0x16	/* Booster beam cycle for MI studies */
#define	EVENT_BOOSTER_RESET_FOR_STUDIES	0x17	/* Booster studies beam cycle */
#define	EVENT_BOOSTER_SAMPLE_TIME	0x18	/* Booster sample time */
#define	EVENT_BOOSTER_RESET_FOR_NUMI	0x19	/* Booster beam cycle for NUMI */
#define	EVENT_NTF_ENABLE	0x1A		/* NTF enable event */
#define	EVENT_NTF_DISABLE	0x1B		/* NTF disable event */
#define	EVENT_BOOSTER_RESET_FOR_STUDIES_2	0x1C	/* Booster/MI/Tev studies beam cycle */
#define	EVENT_BOOSTER_RESET_FOR_8_GEV_BEAM_TO_MUON	0x1C	/* Booster 8 GeV beam to Muon cycle */
#define	EVENT_BOOSTER_8_GEV_BEAM_TO_MUON	0x1C	/* Booster 8 GeV beam to Muon cycle */
#define	EVENT_BOOSTER_RESET_FOR_MINIBOONE	0x1D	/* Booster cycle to MiniBoone */
#define	EVENT_BOOSTER_8_GEV_PREPULSE	0x1E	/* Booster 8 GeV line reset prepulse */
#define	EVENT_BOOSTER_8_GEV_RESET	0x1F	/* Booster 8 GeV line reest for beam */

/*
  Main Ring events
*/
#if 0
#define	EVENT_MR_RESET_REV_INJ	0x20		/* Main Ring reset for reverse injection */
#define	EVENT_MR_RESET_FIXED_TARG	0x21	/* Main Ring reset for fixed target injection */
#define	EVENT_MR_START_RAMP	0x22		/* start Main Ring ramp */
#define	EVENT_MR_RAMP_TRIP	0x23		/* Main Ring ramp fast trip */
#define	EVENT_MR_RESET_ABORT	0x24		/* reset Main Ring abort */
#define	EVENT_MR_START_FT	0x25		/* start Main Ring flattop */
#define	EVENT_MR_END_FT		0x26		/* end Main Ring flattop */
#define	EVENT_MR_ABORT		0x27		/* Main Ring abort */
#define	EVENT_MR_INJ_BEAM_SYNC	0x28		/* Main Ring injection beam synch */
#define	EVENT_MR_RESET_PBAR_PROD	0x29	/* Main Ring reset for p-bar production */
#define	EVENT_MR_RESET_PBAR_COLL	0x2A	/* Main Ring reset for injecting p-bars into the Collider */
#define	EVENT_MR_RESET_PRTN_COLL	0x2B	/* Main Ring reset for injecting protons into the Collider */
#define	EVENT_MR_SAMPLE		0x2C		/* Main Ring sample event */
#define	EVENT_MR_RESET_COAST	0x2D		/* Main Ring reset for coasting beam */
#define	EVENT_MR_RESET_STUDIES	0x2E		/* Main Ring reset for studies */
#define	EVENT_MR_CLEANUP	0x2F		/* Main Ring clean-up event */
#endif

/*
  Main Injector events
*/
#define	EVENT_MI_RESET_PBAR_DECEL	0x20	/* Main Injector reset for p-bar deceleration */
#define	EVENT_MI_RESET_FIXED_TARGET_SHORT_FT	0x20	/* Main Injector reset for fixed target (short flattop) */
#define	EVENT_MI_RESET_FIXED_TARG	0x21	/* Main Injector reset for fixed target injection */
#define	EVENT_MI_RESET_FIXED_TARGET_LONG_FT	0x21	/* Main Injector reset for fixed target (long flattop) */
#define	EVENT_MI_START_RAMP	0x22		/* start Main Injector ramp */
#define	EVENT_MI_RESET_NUMI	0x23		/* Main Injector reset for NUMI beam */
#define	EVENT_MI_RESET_ABORT	0x24		/* reset Main Injector abort */
#define	EVENT_MI_START_FT	0x25		/* start Main Injector flattop */
#define	EVENT_MI_END_FT		0x26		/* end Main Injector flattop */
#define	EVENT_MI_ABORT		0x27		/* Main Injector abort */
#define	EVENT_MI_INJ_BEAM_SYNC	0x28		/* Main Injector injection beam synch */
#define	EVENT_MI_RESET_PBAR_PROD	0x29	/* Main Injector reset for p-bar production */
#define	EVENT_MI_RESET_MUON_120_GEV	0x29	/* Main Injector reset for Muon 120 GeV beam */
#define	EVENT_MI_RESET_PBAR_COLL	0x2A	/* Main Injector reset for injecting p-bars into the Collider */
#define	EVENT_MI_RESET_NUMI_WITH_RR	0x2A	/* Main Injector reset for NuMI beam with Recycler */
#define	EVENT_MI_RESET_PRTN_COLL	0x2B	/* Main Injector reset for injecting protons into the Collider */
#define	EVENT_MI_RESET_STUDIES_2	0x2B	/* Main Injector reset for studies */
#define	EVENT_MI_SAMPLE		0x2C		/* Main Injector sample event */
#define	EVENT_MI_RESET_COAST	0x2D		/* Main Injector reset for coasting beam */
#define	EVENT_MI_RESET_MUON_8_GEV	0x2D	/* Main Injector reset for Muon 8 GeV beam */
#define	EVENT_MI_RESET_STUDIES	0x2E		/* Main Injector reset for studies */
#define	EVENT_MI_CLEANUP	0x2F		/* Main Injector clean-up event */

/*
  Switchyard and 8 GeV line events
*/
/* #define	EVENT_SY_NULL_RESET	0x30 */		/* Switchyard null cycle reset */
#define	EVENT_SY_RESET_120_GEV	0x30		/* Switchyard reset for 120 GeV extraction */
#define	EVENT_SY_RESET		0x31		/* Switchyard reset for extraction */
/* #define	EVENT_SY_PING		0x32 */		/* Switchyard ping arm/trigger */
#define	EVENT_SY_120_GEV_EXT_1_SEC	0x32	/* Switchyard 120 GeV extraction (1 sec) */
/* #define	EVENT_SY_PULSE		0x33 */		/* Switchyard pulse arm/trigger */
#define	EVENT_SY_FAST_SPILL_PING	0x33	/* Switchyard fast spill/ping */
#define	EVENT_SY_SWIC_SAMPLE	0x34		/* Switchyard SWIC sample */
#define	EVENT_SY_BEAM_SAMPLE	0x35		/* Switchyard beam sample */
#define	EVENT_SY_POST_BEAM_SAMPLE	0x36	/* Switchyard post beam sample */
/* #define	EVENT_SY_FAST_SPILL_SAMPLE	0x37 */	/* Switchyard fast spill beam sample */
#define	EVENT_SY_READ_INT_MONITORS	0x37	/* Switchyard read intensity monitors */
/* #define	EVENT_8_GEV_RESET	0x38 */		/* 8 GeV line reset */
#define	EVENT_SY_RESET_PERMIT	0x38		/* Switchyard permit system reset */
/* #define	EVENT_8_GEV_XFER_DONE	0x39 */		/* 8 GeV line transfer complete */
#define	EVENT_SY_PROTON_EXTRACT	0x39		/* Switchyard proton extraction */
#define	EVENT_SY_BPM_PROFILE	0x3A		/* Switchyard BPM profile trigger */
#define	EVENT_SY_BPM_DISPLAY	0x3B		/* Switchyard BPM display trigger */
#define	EVENT_SY_SAMPLE		0x3C		/* Switchyard sample event */
#define	EVENT_SY_ALARM		0x3D		/* Switchyard analog alarm event */
#define	EVENT_SY_PERMIT_HAS_FALLEN	0x3E	/* Switchyard permit has fallen */
#define	EVENT_SY_FLY_WIRES	0x3F		/* Switchyard flying wire event */

/*
  Tevatron events
*/
#define	EVENT_RESET_PBAR_INJ	0x40		/* Tev reset for p-bar injection */
#define	EVENT_TEV_GENERIC_RESET	0x41		/* Tev generic reset */
#define	EVENT_TEV_RAMP_RESET	0x41		/* Tev ramp reset */
#define	EVENT_TEV_START_RAMP	0x42		/* start Tev ramp */
#define	EVENT_TEV_START_FP	0x43		/* start Tev front porch */
/* #define	EVENT_TEV_END_FP	0x44 */		/* end Tev front porch */
#define	EVENT_TEV_START_BP	0x44		/* start Tev back porch */
#define	EVENT_TEV_START_FT	0x45		/* start Tev flattop */
#define	EVENT_TEV_END_FT	0x46		/* end Tev flattop */
#define	EVENT_TEV_END_BEAM_OP	0x46		/* Tevatron end of beam operations */
#define	EVENT_TEV_ABORT		0x47		/* Tev abort */
#define	EVENT_TEV_RESET_ABORT	0x48		/* reset Tev abort */
#define	EVENT_TEV_RESET_FIXED_TARG	0x49	/* Tev reset for fixed target injection */
#define	EVENT_TEV_INJ_BEAM_SYNC	0x4A		/* Tev injection beam synch */
#define	EVENT_TEV_CLEANUP	0x4B		/* Tev clean-up event */
#define	EVENT_TEV_SAMPLE	0x4C		/* Tev sample event */
#define	EVENT_BOOSTER_VARIABLE_EVENT	0x4C	/* Booster variable event */
#define	EVENT_RESET_PROTON_INJ	0x4D		/* Tev reset for proton injection */
#define	EVENT_TEV_QUENCH	0x4E		/* Tev quench */
#define	EVENT_TEV_ADC_COMPARE	0x4F		/* Tev ADC compare trigger */

/*
  Miscellaneous events
*/
/* #define	EVENT_MR_BEGIN_STUDIES	0x50 */		/* Main Ring begin studies */
#define	EVENT_MI_BEGIN_STUDIES	0x50		/* Main Injector begin studies */
/* #define	EVENT_MR_END_STUDIES	0x51 */		/* Main Ring end studies */
#define	EVENT_MI_END_STUDIES	0x51		/* Main Injector end studies */
#define	EVENT_HEP_BEAM_PERMIT	0x52		/* HEP beam is permitted */
#define	EVENT_HEP_BEAM_INHIBIT	0x53		/* HEP beam is inhibitted */
/* #define	EVENT_TEV_BLINE_XFER	0x54 */		/* Tevatron to beamline transfer */
#define	EVENT_TEV_PBAR_TO_MI_RESET	0x54	/* Tevatron Pbar to Main Injector reset */
/* #define	EVENT_TEV_MR_XFER	0x55 */		/* Tevatron to Main Ring transfer */
#define	EVENT_TEV_MI_XFER	0x55		/* Tevatron to Main Injector transfer */
/* #define	EVENT_MR_RAMP_SAMPLE	0x56 */		/* Main Ring ramped device sample event */
/* #define	EVENT_MI_RAMP_SAMPLE	0x56 */		/* Main Injector ramped device sample event */
/* #define	EVENT_BOOSTR_EXTR_TIMNG_RESET	0x57 */	/* Booster extraction timing reset event */
#define	EVENT_MI_BOOSTER_EXT_SYNC	0x57	/* MI and Booster extraction sync */
/* #define	EVENT_FT_INJECT_PROTONS	0x58 */		/* inject protons into the Tevatron for fixed target operation */
#define	EVENT_MI_MI10_KICKER_DISABLE	0x58	/* MI10 kicker disable */
/* #define	EVENT_MR_TRANSITION_SLIDE	0x59 */	/* slide under Main Ring transition */
/* #define	EVENT_MI_TRANSITION_SLIDE	0x59 */	/* slide under Main Injector transition */
#define	EVENT_P2_PREP_FOR_PBARS	0x59		/* prepare P2 line power supplies (F17 Lambertson) for a pbar transfer */

#define	EVENT_COLL_INJ_PBARS	0x5B		/* inject p-bars into the Tevatron for Collider operation */
#define	EVENT_CLDR_INJ_PBARS	0x5B		/* inject p-bars into the Tevatron for Collider operation */
#define	EVENT_COLL_INJ_PROTONS	0x5C		/* inject protons into the Tevatron for Collider operation */
#define	EVENT_CLDR_INJ_PROTONS	0x5C		/* inject protons into the Tevatron for Collider operation */

#define	EVENT_TEV_LOWB_QUENCH	0x5E		/* Tev low beta quench */
/* #define	EVENT_TEV_HI_FIELD	0x5F */		/* Tev start high field operations */
#define	EVENT_TEV_PBAR_TO_MI_XFER	0x5F	/* Tevatron Pbar to Main Injector transfer */

/*
  DFG events
*/
/* #define	EVENT_DFG_NEW		0x60 */		/* DFG new table */
#define	EVENT_TEV_DFG_COPY	0x60		/* Tevatron DFG copy */
/* #define	EVENT_DFG_START		0x61 */		/* DFG start time table */
#define	EVENT_TEV_ORBIT_CORRECT	0x61		/* Tevatron orbit correction */
#define	EVENT_DFG_STOP		0x62		/* DFG stop */
#define	EVENT_TEV_DFG_STOP	0x62		/* Tevatron DFG stop */
#define	EVENT_DFG_CONTINUE	0x63		/* DFG continue */
#define	EVENT_TEV_DFG_CONTINUE	0x63		/* Tevatron DFG continue */
/* #define	EVENT_DFG_READ		0x64 */		/* DFG read */
#define	EVENT_TEV_WAVEFORM_ARCHIVE	0x64	/* Tevatron waveform archive */
#define	EVENT_CLDR_STATE_UPDATE	0x65		/* Collider state update */
#define	EVENT_TEV_BPM_USER_FRAME	0x66	/* Tev BPM user frame trigger */
/* #define	EVENT_RF_WATER_NEW	0x67 */		/* RF water program new */
#define	EVENT_CLDR_SMOOTH_DEC_ORBIT	0x67	/* Collider smooth deceleration/unsqueeze orbit */
#define	EVENT_RF_WATER_START	0x68		/* RF water program start */
#define	EVENT_TEV_RF_WATER_START	0x68	/* Tevatron RF water program start */
#define	EVENT_CLDR_PROTON_REMOVAL	0x69	/* Collider proton removal */
/* #define	EVENT_B0_NEW		0x6A */		/* B0 DFG new */
#define	EVENT_CLDR_COPY_F_TO_G	0x6A		/* Collider copy f(t) to g(i) */
/* #define	EVENT_B0_START		0x6B */		/* B0 DFG start */
#define	EVENT_CLDR_COPY_F_TO_H	0x6B		/* Collider copy f(t) to h(i) */
/* #define	EVENT_D0_NEW		0x6C */		/* D0 DFG new */
#define	EVENT_CLDR_AFTER_PROT_REMOVE	0x6C	/* Collider after proton removal */
/* #define	EVENT_D0_START		0x6D */		/* D0 DFG start */
#define	EVENT_CLDR_DECEL_AFTER_LOWB	0x6D	/* Collider decelerate after low beta */
/* #define	EVENT_RF_NEW		0x6E */		/* RF new */
/* #define	EVENT_CLDR_DECEL_AFTER_NOSQZ	0x6E */	/* Collider decelerate after no squeeze */
#define	EVENT_TEV_PING_BEAM	0x6E		/* ping Tevatron beam */
#define	EVENT_RF_START		0x6F		/* RF start */
#define	EVENT_TEV_RF_START	0x6F		/* Tevatron RF start */

/*
  BPM/BLM events
*/
/* #define	EVENT_BSTR_BPM_PREPARE	0x70 */		/* Booster BPM prepare for beam */
#define	EVENT_TEV_BPM_RESET_USER_FRAME	0x70	/* Tev BPM reset user frame pointer */
#define	EVENT_TEV_BPM_PREPARE	0x71		/* Tev BPM prepare for beam */
#define	EVENT_BSTR_BPM_END_BEAM	0x72		/* Booster BPM end of beam */
#define	EVENT_TEV_BPM_HI_FIELD	0x73		/* Tev BPM high field */
#define	EVENT_TEV_BPM_LO_FIELD	0x74		/* Tev BPM low field */
#define	EVENT_TEV_BPM_PROFILE	0x75		/* Tev BPM profile trigger */
#define	EVENT_TEV_BLM_DISPLAY	0x76		/* Tev BLM display trigger */
#define	EVENT_TEV_BPM_FLASH	0x77		/* Tev BPM flash trigger */
#define	EVENT_TEV_BPM_DISPLAY	0x78		/* Tev BPM display trigger */
/* #define	EVENT_MR_BPM_PREPARE	0x79 */		/* MR BPM prepare for beam */
#define	EVENT_MI_BPM_PREPARE	0x79		/* MI BPM prepare for beam */
/* #define	EVENT_MR_BPM_PROFILE	0x7A */		/* MR BPM profile trigger */
#define	EVENT_MI_BPM_PROFILE	0x7A		/* MI BPM profile trigger */
#define	EVENT_MR_BPM_DISPLAY	0x7B		/* MR BPM display trigger */
#define	EVENT_MI_BPM_DISPLAY	0x7B		/* MI BPM display trigger */
/* #define	EVENT_MR_BPM_FLASH	0x7C */		/* MR BPM flash trigger */
#define	EVENT_MI_BPM_FLASH	0x7C		/* MI BPM flash trigger */
/* #define	EVENT_MR_BPM_BUNCH_MODE	0x7D */		/* MR BPM set bunch mode */
#define	EVENT_MI_BPM_BUNCH_MODE	0x7D		/* MI BPM set bunch mode */
#define	EVENT_BSTR_BPM_BEG_CLOS	0x7E		/* Booster BPM begin closed orbit */
#define	EVENT_BSTR_BPM_FLASH	0x7F		/* Booster BPM flash trigger */

/*
  Debuncher events
*/
#define	EVENT_DEB_RESET_PBAR_PRODUCE	0x80	/* Debuncher production cycle reset */
#define	EVENT_DEB_MI_TO_TARGET_XFER	0x81	/* Debuncher Main Injector to target transfer */
#define	EVENT_DEB_SAMPLE	0x82		/* Debuncher sample event */
#define	EVENT_DEB_PREP_INJ_TBT	0x83		/* Debuncher setup injection turn by turn BPM measurement */
#define	EVENT_DEB_PREP_BEAMLINE	0x84		/* Debuncher prepare beamline for beam */
#define	EVENT_DEB_RESET_8_GEV_TEST	0x85	/* Debuncher 8 GeV test beam reset */
#define	EVENT_DEB_INIT_MI_XFER	0x86		/* Debuncher initialize transfer from Main Injector */
#define	EVENT_DEB_TO_AP2_XFER	0x87		/* Debuncher transfer 8 GeV protons to the AP2 line */
#define	EVENT_DEB_RESET_PERMIT	0x88		/* Debuncher permit system reset */

#define	EVENT_PBAR_FLY_WIRES	0x8B		/* Pbar flying wire event */
#define	EVENT_P2_LINE_BPM_FLASH	0x8C		/* P2 line BPM flash trigger */
#define	EVENT_NUMI_MIXED_MODE	0x8D		/* NuMI mixed mode pbar production */
#define	EVENT_P1_P2_BEAMLINE_RESET	0x8E	/* P1 and P2 beamline reset */
#define	EVENT_DEB_1HZ		0x8F		/* Debuncher 1 Hz event */

/*
  Muon events
*/
#define	EVENT_MUON_NON_8_GEV_FROM_MI	0x80	/* Non 8 GeV protons from Main Injector */
#define	EVENT_MUON_REFLECTED_MIBS_79	0x81	/* Reflection of MIBS event 79 */
#define	EVENT_MUON_VARIABLE_EVENT_1	0x82	/* Muon variable event 1 */
#define	EVENT_MUON_BPM_TBT_TRIGGER	0x83	/* Muon turn by turn BPM trigger */
#define	EVENT_MUON_DRING_PREP_FOR_BEAM	0x84	/* Delivery Ring prepare for beam */
#define	EVENT_MUON_8_GEV_FROM_MI	0x85	/* 8 GeV protons from Main Injector */
#define	EVENT_MUON_END_OF_BEAM		0x86	/* Muon end of beam */
#define	EVENT_MUON_BEAM_ABORTED		0x87	/* Muon beam aborted */
#define	EVENT_MUON_RESET_PERMIT		0x88	/* Muon permit system reset */
#define	EVENT_MUON_ABORT_CLEANUP	0x89	/* Muon abort cleanup */

#define	EVENT_MUON_BPM_FLASH		0x8C	/* Muon BPM flash trigger */

#define	EVENT_MUON_1HZ			0x8F	/* Muon 1 Hz event */

/*
  Accumulator events
*/
#define	EVENT_ACC_RESET_DEB_XFER	0x90	/* Accumulator <-> Debuncher transfer reset */
/* #define	EVENT_ACC_RESET_PBAR_TO_RR	0x91 */	/* Accumulator pbars to Recycler reset */
#define	EVENT_ACC_RESET_UNSTACK	0x91		/* Accumulator unstack cycle reset */
#define	EVENT_ACC_DEB_XFER	0x92		/* Accumulator <-> Debuncher transfer */
#define	EVENT_ACC_RESET_8_GEV_TEST	0x93	/* Accumulator 8 GeV test beam reset */
#define	EVENT_ACC_INJ_PBAR_SYNC	0x94		/* Accumulator injected pbar synch */
#define	EVENT_ACC_SAMPLE	0x95		/* Accumulator sample event */
#define	EVENT_ACC_RESET_PRTNS_FROM_RR	0x96	/* Accumulator protons from Recycler reset */
#define	EVENT_MUON_XFER_FROM_RR_6	0x96	/* Recycler to Muon transfer #6 */
#define	EVENT_ACC_PRTNS_FROM_RR_XFER	0x97	/* Accumulator protons from Recycler transfer */
#define	EVENT_MUON_XFER_FROM_RR_7	0x97	/* Recycler to Muon transfer #7 */
#define	EVENT_ACC_PRTNS_TO_RR_XFER	0x98	/* Accumulator protons to Recycler transfer */
#define	EVENT_MUON_XFER_FROM_RR_8	0x98	/* Recycler to Muon transfer #8 */
#define	EVENT_ACC_INIT_MI_XFER	0x99		/* Accumulator initialize transfer from Main Injector */
/* #define	EVENT_ACC_RESET_UNSTACK	0x9A */		/* Accumulator unstack cycle reset */
#define	EVENT_ACC_PBARS_TO_MI_PREP	0x9A	/* Prepare to transfer pbars from the Accumulator to MI */
#define	EVENT_MUON_XFER_FROM_RR_1	0x9A	/* Recycler to Muon transfer #1 */
#define	EVENT_RR_8_GEV_PBAR_XFER	0x9B	/* Recycler 8 GeV pbar transfer */
#define	EVENT_MUON_XFER_FROM_RR_2	0x9B	/* Recycler to Muon transfer #2 */
#define	EVENT_ACC_SUDDEN_LOSS	0x9C		/* Accumulator sudden beam loss */
#define	EVENT_MUON_XFER_FROM_RR_3	0x9C	/* Recycler to Muon transfer #3 */
#define	EVENT_ACC_START_RAMP	0x9D		/* Accumulator start ramp program */
#define	EVENT_MUON_XFER_FROM_RR_4	0x9D	/* Recycler to Muon transfer #4 */
#define	EVENT_ACC_STOP_RAMP	0x9E		/* Accumulator stop ramp program */
#define	EVENT_MUON_XFER_FROM_RR_5	0x9E	/* Recycler to Muon transfer #5 */

/*
  Muon events (contd)
*/
#define	EVENT_MUON_8_GEV_RR_TO_TARGET	0x93	/* Muon 8 GeV protons from Recycler to the target */
#define	EVENT_MUON_8_GEV_RR_TO_M3_LINE	0x94	/* Muon 8 GeV protons from Recycler to the M3 Line */
#define	EVENT_MUON_VARIABLE_EVENT_2	0x95	/* Muon variable event 2 */
#define	EVENT_MUON_RR_TRANSFER_6	0x96	/* Muon Recycler transfer #6 */
#define	EVENT_MUON_RR_TRANSFER_7	0x97	/* Muon Recycler transfer #7 */
#define	EVENT_MUON_RR_TRANSFER_8	0x98	/* Muon Recycler transfer #8 */
#define	EVENT_MUON_REFLECTED_MIBS_7E	0x99	/* Reflection of MIBS event 7E */
#define	EVENT_MUON_RR_TRANSFER_1	0x9A	/* Muon Recycler transfer #1 */
#define	EVENT_MUON_RR_TRANSFER_2	0x9B	/* Muon Recycler transfer #2 */
#define	EVENT_MUON_RR_TRANSFER_3	0x9C	/* Muon Recycler transfer #3 */
#define	EVENT_MUON_RR_TRANSFER_4	0x9D	/* Muon Recycler transfer #4 */
#define	EVENT_MUON_RR_TRANSFER_5	0x9E	/* Muon Recycler transfer #5 */
#define	EVENT_MUON_RR_KICKER_TRIG_CLEAR	0x9F	/* Recycler to Muon kicker trigger clear */

/*
  Experimental areas events
*/
/* #define	EVENT_SY_PRE_FAST_SPILL	0xA0 */		/* Switchyard pre fast spill beam trigger */

#define	EVENT_SY_PRE_FT_1	0xA2		/* Switchyard pre flattop trigger #1 */
#define	EVENT_SY_PRE_FT_2	0xA3		/* Switchyard pre flattop trigger #2 */
#define	EVENT_SAMPLE_TRIGGER_2	0xA3		/* Switchyard sample trigger #2 */
#define	EVENT_SY_PRE_FT_3	0xA4		/* Switchyard pre flattop trigger #3 */
#define	EVENT_NUMI_EXT_RESET	0xA5		/* NuMI extracted beam reset */
#define	EVENT_NUMI_ABORT	0xA6		/* NuMI abort */
#define	EVENT_SY_NO_BEAM	0xA7		/* Switchyard no beam to experimental areas */
#define	EVENT_NUMI_RESET_PERMIT	0xA8		/* NuMI permit system reset */
#define	EVENT_NUMI_PRTNS_FROM_MI	0xA9	/* proton extraction from MI to NuMI */
#define	EVENT_MI_CHARGE_ABORT	0xAC		/* Main Injector charge abort */
#define	EVENT_NUMI_EXTRACTION	0xAD		/* NuMI extraction reset */
#define	EVENT_NUMI_MIXED_MODE_RAMP	0xAE	/* NuMI mixed mode ramp */
#define	EVENT_NUMI_BEAMLINE_RAMP	0xAE	/* NuMI beamline ramp */
#define	EVENT_NUMI_END_OF_INJECTION	0xAF	/* NuMI end of beam injection */

/*
  reserved events
*/
#define	EVENT_MB_START_PULSE_TRAIN	0xB0	/* MiniBooNE start of pulse train */
#define	EVENT_MB_END_PULSE_TRAIN	0xB1	/* MiniBooNE end of pulse train */
#define	EVENT_RR_BPM_PREPARE	0xB2		/* Recycler BPM prepare for beam */
#define	EVENT_RR_BPM_PROFILE	0xB3		/* Recycler BPM write profile frame */
#define	EVENT_RR_BPM_DISPLAY	0xB4		/* Recycler BPM write display frame */
#define	EVENT_RR_BPM_FLASH	0xB5		/* Recycler BPM flash trigger */
#define	EVENT_RR_BPM_BUNCH_MODE	0xB6		/* Recycler BPM set bunch mode */
#define	EVENT_BOONE_RESET_PERMIT	0xB8	/* MiniBooNE permit system reset */
#define	EVENT_MB_RESET_PERMIT	0xB8		/* MiniBooNE permit system reset */

#define	EVENT_START_TCLK_DIAG	0xBB		/* start TCLK diagnostics */
#define	EVENT_STOP_TCLK_DIAG	0xBC		/* stop TCLK diagnostics */
#define	EVENT_MI8_BLM_SAMPLE_TIME	0xBD	/* MI-8 Line BLM sample time */
#define	EVENT_BOOSTER_BEAM_TO_RR	0xBE	/* Booster beam to Recycler */
#define	EVENT_BOOSTER_BEAM_TO_MI	0xBF	/* Booster beam to Main Injector */

/*
  Collider events
*/
#define	EVENT_CLOSE_INJ_HELIX	0xC0		/* close injection helix */
#define	EVENT_COLLIDER_RESET	0xC1		/* Tev reset for collider operations */
#define	EVENT_COLLIDER_PREP	0xC2		/* prepare for colliding batches */
#define	EVENT_OPEN_INJ_HELIX	0xC3		/* Collider open injection helix */
#define	EVENT_REM_INJ_BUMPS	0xC4		/* remove E0 injection bumps */
#define	EVENT_START_B0_SQUEEZE	0xC5		/* start B0 low beta squeeze */
#define	EVENT_INIT_COLLISIONS	0xC6		/* Collider initiate collisions */
/* #define	EVENT_START_D0_SQUEEZE	0xC7 */		/* start D0 low beta squeeze */
#define	EVENT_ADD_INJ_LAM_BUMP	0xC7		/* Collider add injection Lam bump */
/* #define	EVENT_ADJUST_AT_FT	0xC8 */		/* adjust Tev at flattop or low beta */
#define	EVENT_RECOVER_FROM_LB	0xC9		/* Collider recover from low beta */
#define	EVENT_COLLIDER_STUDIES	0xCA		/* Collider studies event */
#define	EVENT_BEGIN_STORE	0xCB		/* store begins event */
/* #define	EVENT_CBA_ON		0xCC */		/* turn on CBA */
#define	EVENT_CLDR_SQUEEZE_STOP	0xCC		/* Collider squeeze stop */
#define	EVENT_TEV_BPM_ARM_TBT	0xCC		/* Tevatron BPM arm turn by turn data collection */
/* #define	EVENT_CBA_OFF		0xCD */		/* turn off CBA */
#define	EVENT_CLDR_SQUEEZE_CONT	0xCD		/* Collider squeeze continue */
#define	EVENT_END_STORE		0xCE		/* store ends event */
#define	EVENT_FLY_WIRES		0xCF		/* flying wire event */

/*
  miscellaneous events
*/
#define	EVENT_MI_PREP_TO_DECEL	0xD0		/* Main Injector prepare to decelerate */
#define	EVENT_MI_START_TO_DECEL	0xD1		/* Main Injector start to decelerate */
#define	EVENT_MI_END_DECEL	0xD2		/* Main Injector end deceleration */

/* #define	EVENT_C465_LEVEL_13	0xD4 */		/* Collider C465 interrupt level 13 trigger */
#define	EVENT_CLDR_C465_COPY_F_TO_G	0xD4	/* Collider C465 copy f(t) to g(i) */
/* #define	EVENT_C465_LEVEL_15	0xD5 */		/* Collider C465 interrupt level 15 trigger */
#define	EVENT_CLDR_C465_STOP	0xD5		/* Collider C465 stop */
/* #define	EVENT_C465_LEVEL_16	0xD6 */		/* Collider C465 interrupt level 16 trigger */
#define	EVENT_CLDR_C465_CONT	0xD6		/* Collider C465 continue */
#define	EVENT_CDF_TRIP		0xD7		/* CDF system trip */

#define	EVENT_TEV_SUDDEN_LOSS	0xD9		/* Tevatron sudden beam loss */
/* #define	EVENT_SDA_SAMPLE	0xDA */		/* SDA sample time */
#define	EVENT_RR_RBEX_TRIGGER	0xDA		/* Recycler RBEX trigger */
#define	EVENT_COLLIDER_SAMPLE	0xDB		/* Collider sample time */
#define	EVENT_COLLIDER_IR_SCAN	0xDC		/* Collider initiate IR scan */
#define	EVENT_BOOSTER_8_GEV_BPM_SMPL	0xDD	/* Booster 8 GeV BPM sample */
#define	EVENT_RR_RESET_FOR_MI	0xDE		/* Recycler reset for beam to Main Injector */

/*
  Recycler events
*/
#define	EVENT_RR_RESET_PBARS_FROM_MI	0xE0	/* Recycler pbars from Main Injector reset */
#define	EVENT_RR_RESET_FOR_RR_STUDIES	0xE0	/* Recycler reset for Recycler studies */
#define	EVENT_RR_RESET_PBARS_FROM_ACC	0xE1	/* Recycler pbars from Accumulator reset */
#define	EVENT_RR_RESET_FOR_MI_STUDIES	0xE1	/* Recycler reset for Main Injector studies */
#define	EVENT_RR_RESET_PRTNS_FROM_MI	0xE2	/* Recycler protons from Main Injector reset */
#define	EVENT_RR_RESET_FIXED_TARGET	0xE2	/* Recycler reset for fixed target */
#define	EVENT_RR_RESET_PRTNS_TO_MI	0xE3	/* Recycler protons to Main Injector reset */
#define	EVENT_RR_RESET_FOR_NUMI		0xE3	/* Recycler reset for NuMI */
#define	EVENT_RR_RESET_PBARS_TO_MI	0xE4	/* Recycler pbars to Main Injector reset */
#define	EVENT_RR_BEAM_FROM_BOOSTER	0xE4	/* Recycler injected beam from Booster */
#define	EVENT_RR_TRIGGER_PINGERS	0xE5	/* Recycler trigger pingers */
#define	EVENT_RR_BEAM_SAMPLE	0xE6		/* Recycler beam sample */
#define	EVENT_RR_END_OF_BEAM	0xE6		/* Recycler end of beam */
#define	EVENT_RR_DUMP_PROTONS	0xE7		/* Recycler dump protons */
#define	EVENT_RR_BEAM_ABORTED	0xE7		/* Recycler beam aborted */
#define	EVENT_RR_DUMP_SYS_RESET	0xE8		/* Recycler proton dump system reset */
#define	EVENT_RR_ABORT_RESET	0xE8		/* Recycler BP/abort system reset */
#define	EVENT_EC_ELECTRON_BEAM_TRIP	0xE9	/* electron cooling electron beam trip */
#define	EVENT_RR_RESET_FOR_MUON	0xE9		/* Recycler reset for Muon */
#define	EVENT_MTA_PREPULSE	0xEA		/* MTA (Muon Test Area) prepulse */
#define	EVENT_EC_PULSE		0xEB		/* Electron Cooling pulse */
#define	EVENT_RR_STATE_UPDATE	0xEC		/* Recycler state update */
#define	EVENT_RR_PREP_FOR_INJECT	0xED	/* Recycler prepare for injection */
#define	EVENT_RR_VARIABLE_EVENT	0xED		/* Recycler variable event */
#define	EVENT_RR_PREP_FOR_EXTRACT	0xEE	/* Recycler prepare for extraction */
#define	EVENT_RR_SAMPLE		0xEF		/* Recycler sample event */
#define	EVENT_RR_ABORT_CLEANUP	0xEF		/* Recycler abort cleanup */

#define	EVENT_RR_INJ_DECEL_BEAM	0xF0		/* Recycler inject decelerated beam */

#define	EVENT_RR_INJECT_PROTONS	0xF2		/* Recycler inject protons */
#define	EVENT_RR_EXT_PROTONS_TO_MI	0xF3	/* Recycler extract protons to Main Injector */

#define	EVENT_RR_ABORT_PROTONS	0xF5		/* Recycler abort protons */
#define	EVENT_RR_8_GEV_PRTNS_TO_ACC	0xF6	/* Recycler 8 GeV protons to Accumulator */
#define	EVENT_RR_8_GEV_PRTNS_TO_MUON	0xF6	/* Recycler 8 GeV protons to Muon */
#define	EVENT_RR_EXT_PBARS_TO_MI	0xF7	/* Recycler extract pbars to Main Injector */
#define	EVENT_RR_PROTONS_FROM_BOOSTER	0xF7	/* Recycler protons from Booster */

#define	EVENT_RR_SUDDEN_LOSS	0xF9		/* Recycler sudden beam loss */
#define	EVENT_RR_MIBS_EVENT_DENIED	0xFA	/* Recycler/Main Injector MIBS event denied */

/*
  Clock system NOOP events
*/
#define	EVENT_NULL		0xFE		/* null event - never generated */
#define	EVENT_NOOP		0xFF		/* null event - sometimes generated */

/* special event values */

#define	EVENT_MI_RESET		0x7FFF		/* any Main Injector reset event */
#define	EVENT_RR_RESET		0x7FFE		/* any Tevatron reset event */

#endif