Table of Contents
Previous Chapter The use of the global event system and its associated records should not be confused with the vanilla EPICS events and the associated event records. They are very different.
--------------------------------------------------------------
Field Type DCT Initial Access Modify Rec Proc PP
Monitor
--------------------------------------------------------------
OUT OUTLINK Yes No No No No
MOD1 RECCHOICE Yes 0 Yes Yes No Yes
R1SP DOUBLE Yes 0 Yes No No Yes
MOD2 RECCHOICE Yes 0 Yes Yes No Yes
R2SP DOUBLE Yes 0 Yes No No Yes
LMD1 RECCHOICE No 0 Yes No No Yes
LMD2 RECCHOICE No 0 Yes No No Yes
FIFO GBLCHOICE Yes 0 Yes Yes No Yes
LFFO GBLCHOICE No 0 Yes No No Yes
CLR1 CHAR No 0 Yes Yes No Yes
CLR2 CHAR No 0 Yes Yes No Yes
TRG1 CHAR No 0 Yes Yes No Yes
TRG2 CHAR No 0 Yes Yes No Yes
ENAB GBLCHOICE Yes 0 Yes Yes No Yes
LENA LONG No 0 Yes No No Yes
TAXI LONG No 0 Yes Yes Yes No
LTAX LONG No 0 Yes No No No
VME LONG No 0 Yes Yes No Yes
ETE0 GBLCHOICE Yes 0 Yes Yes No Yes
ET0 LONG Yes 0 Yes Yes No Yes
LET0 LONG No 0 Yes No No Yes
ETE1 GBLCHOICE Yes 0 Yes Yes No Yes
ET1 LONG Yes 0 Yes Yes No Yes
LET1 LONG No 0 Yes No No Yes
ETE2 GBLCHOICE Yes 0 Yes Yes No Yes
ET2 LONG Yes 0 Yes Yes No Yes
LET2 LONG No 0 Yes No No Yes
ETE3 GBLCHOICE Yes 0 Yes Yes No Yes
ET3 LONG Yes 0 Yes Yes No Yes
LET3 LONG No 0 Yes No No Yes
ETE4 GBLCHOICE Yes 0 Yes Yes No Yes
ET4 LONG Yes 0 Yes Yes No Yes
LET4 LONG No 0 Yes No No Yes
ETE5 GBLCHOICE Yes 0 Yes Yes No Yes
ET5 LONG Yes 0 Yes Yes No Yes
LET5 LONG No 0 Yes No No Yes
ETE6 GBLCHOICE Yes 0 Yes Yes No Yes
ET6 LONG Yes 0 Yes Yes No Yes
LET6 LONG No 0 Yes No No Yes
ETE7 GBLCHOICE Yes 0 Yes Yes No Yes
ET7 LONG Yes 0 Yes Yes No Yes
LET7 LONG No 0 Yes No No Yes
VAL CHAR No 0 Yes No Yes No
--------------------------------------------------------------
-------------------------------------------------------------------------------------------
Name Summary Description
-------------------------------------------------------------------------------------------
OUT Output Link Specifies the link number of the event generator board.
Only the `Card' value of the link specification is used.
MOD1 Mode Select for Used to select the operating mode of event sequence
RAM 1 RAM1 or RAM2. It is important to know that the
configuration of the events in the RAM may not be altered
unless it is either `Off' or in `Alternate Mode'.
Should a configuration attempt be made when the RAM is
not in one of these modes, it will be deferred until the
RAM mode is changed to either `Off' or `Alternate'.
When MOD1 is set to alternate from any other mode, MOD2
will also be set to alternate. If MOD1 is changed from
alternate to any other mode, MOD2 will be set to off.
MOD2 Mode Select for
RAM 2
R1SP RAM 1 Speed Event clock 1 rate in Hz. This must be set to the clock rate
of the signal source on the Event CLK 1 input. It is only
used to calculate the `desired position' value of events
that are placed into the sequence RAM. These events are
specified by the use of `egevent' records.
If all `egevent' record types that use the generator being
configured will be using `Clock Ticks' as their `Delay
Units' the value placed into R1SP is not used and may be
left as zero.
R2SP RAM 2 Speed
LMD1 Last Operating
Mode 1
LMD2 Last Operating
Mode 2
FIFO FIFO Enable Used to enable or disable the input-fifo on the generator
board. The fifo is used to allow more than one event
generator to exist on the same fiber-optic line.
LFFO Last FIFO Enable
CLR1 Clear RAM 1 Performing a `put' operation on this field causes sequence
RAM1 or RAM2 to be cleared. The use of this field is
undefined (and will cause great problems) if there are any
`egevent' records configured in the database. This is
provided for testing purposes.
CLR2 Clear RAM 2
TRG1 Manual Trigger If a `put' operation is performed on this field, a one-time
RAM 1 trigger on sequence RAM1 or RAM2 will be initiated. The
result would be that same as if there were a hardware
trigger applied to the `Event TRG1' input on the card.
TRG2 Manual Trigger
RAM 2
ENAB Master Enable Master card enable. No events are generated unless the
card is enabled. In general, there should never be any
reason to disable an event generator. This is provided for
testing purposes.
LENA Last Master Enable
TAXI Taxi Violation Flag This is set to a non-zero value when there has been a taxi
violation. It simply reflects that state of the violation
signal on the taxi receiver module. Taxi violations can not
occur when FIFO is set to `Off.'
LTAX Last Taxi Violation
VME Manual Event Used to send out a one-shot event code. A put to this field
Generation via will cause the event to be sent. It appears to be zero if it is
VME Access ever read. This can be `OUT-LINKed' to by an other
record in order to generate an arbitrary event when it is
processed.
ETEn Event Trigger (n=0-7) These are the enables for the trigger event inputs
Enable on the card. They must be set to `On' in order to send the
trigger event codes.
ETn Event Trigger (n=0-7) These are used to program the event codes that
correspond to the trigger event inputs on the card.
LETn Last Trigger Event (n=0-7)
VAL Value Not Used.
-------------------------------------------------------------------------------------------
As an observation, it is not advisable to alter the R1SP or R2SP fields. You may, but then all related egevent records must be processed again, in order to recalculate their desired position values. The MOD1 and MOD2 fields can also cause some nasty side effects if they are altered between any two non-off modes. In general, the operating mode should be set to OFF and then to some other mode if it is desired to switch between two modes.
In order to configure the event generator device support, a call must be made to set the address for each of the event generator cards present in the IOC. This configuration call is as follows:
EgConfigure(<card number>, <Base address in A16>)The <card number> field may be 0-4 and is used to specify which card is to be configured. This is the card number that is referenced in the eg and egevent records when building the database. The <Base address in A16> field is a 16-bit number that represents the address of the card in the A16 memory space.
Database records that specify card numbers that are not configured will generate `bad field' errors when they are initialized by iocInit. And will then be ignored by the event generator device support if ever processed.
This is the only relationship between the vanilla EPICS event codes (and their associated records) and the global APS event system.
First of all, remember that the sequence RAMs can not be updated unless they are either in ALT mode or OFF. This is due to the hardware constraints. In order to alter a sequence RAM that is not set to ALT or OFF, the RAM must be changed to one of those modes, altered, and then reset back to the desired mode. (No it is not reasonable to do this automatically.) Should the mode be carelessly altered, the EG card will have the mode updated, but the sequence RAM(s) will not be updated again until the mode is set to ALT or OFF. (In an actual application program, it is not reasonable to think that the operating modes of the sequence RAMs will be changed.)
Unless you have a strong need to use more than one sequence RAM at the same time, it is strongly recommended that the ALT mode be used. This is so that you may alter the event positions on the fly when debugging.
The use of `clock ticks' as the delay units specification will eliminate the rounding caused by the conversion from alternate units into clock ticks.
Additionally, the timing system has to take care of high order counter truncation and slave resynchronization. This is handled by the use of the Reset Time Stamp Counters (0x7D) event (the processing of the time stamp information is described in more detail in the document on the global timing system.)
record(eg, "$(prefix)_eg")
{
field(DESC, "")
field(ASG, "")
field(SCAN, "Passive")
field(PINI, "YES")
field(PHAS, "0")
field(EVNT, "0")
field(TSE, "0")
field(TSEL, "0")
field(DTYP, "APS event generator G")
field(DISV, "1")
field(SDIS, "0")
field(DISS, "NO_ALARM")
field(PRIO, "LOW")
field(FLNK, "0")
field(OUT, "#C0 S0 @")
field(MOD1, "Off")
field(R1SP, "0")
field(MOD2, "Off")
field(R2SP, "0")
field(FIFO, "NO")
field(ENAB, "YES")
field(ETE0, "YES")
field(ET0, "0x7c")
field(ETE1, "NO")
field(ET1, "0x0")
field(ETE2, "NO")
field(ET2, "0x0")
field(ETE3, "NO")
field(ET3, "0x0")
field(ETE4, "NO")
field(ET4, "0x0")
field(ETE5, "NO")
field(ET5, "0x0")
field(ETE6, "NO")
field(ET6, "0x0")
field(ETE7, "NO")
field(ET7, "0x0")
}
The important items of note are that ENAB is YES, ETE0 is YES, ET0 is set to 0x7C, and that the record be set to process at init time. The scan should always be set to passive since it only makes sense to process the record when the field values change.In order to take care of the heart beat (0x7A) and time stamp reset/resync (0x7D) events, longout records are used that have their output links pointed to the VME field on the above eg record. When they are processed, the VAL field of the longout record is sent out on the event system.
record(longout, "$(prefix)_hbeat")
{
field(DESC, "")
field(ASG, "")
field(SCAN, "1 second")
field(PINI, "NO")
field(PHAS, "0")
field(EVNT, "0")
field(TSE, "0")
field(TSEL, "0")
field(DTYP, "Soft Channel")
field(DISV, "1")
field(SDIS, "0")
field(DISS, "NO_ALARM")
field(PRIO, "LOW")
field(FLNK, "0")
field(OUT, "$(prefix)_eg.VME PP NMS")
field(DOL, "122")
field(OMSL, "supervisory")
field(EGU, "rocks")
field(HOPR, "0")
field(LOPR, "0")
field(HIHI, "0")
field(LOLO, "0")
field(HIGH, "0")
field(LOW, "0")
field(HHSV, "NO_ALARM")
field(LLSV, "NO_ALARM")
field(HSV, "NO_ALARM")
field(LSV, "NO_ALARM")
field(HYST, "0")
field(ADEL, "0")
field(MDEL, "0")
field(SIOL, "0")
field(SIML, "0")
field(SIMS, "NO_ALARM")
field(IVOA, "Continue normally")
field(IVOV, "0")
}
record(longout, "$(prefix)_resync")
{
field(DESC, "")
field(ASG, "")
field(SCAN, "10 second")
field(PINI, "NO")
field(PHAS, "0")
field(EVNT, "0")
field(TSE, "0")
field(TSEL, "0")
field(DTYP, "Soft Channel")
field(DISV, "1")
field(SDIS, "0")
field(DISS, "NO_ALARM")
field(PRIO, "LOW")
field(FLNK, "0")
field(OUT, "$(prefix)_eg.VME PP MS")
field(DOL, "125")
field(OMSL, "supervisory")
field(EGU, "rocks")
field(HOPR, "0")
field(LOPR, "0")
field(HIHI, "0")
field(LOLO, "0")
field(HIGH, "0")
field(LOW, "0")
field(HHSV, "NO_ALARM")
field(LLSV, "NO_ALARM")
field(HSV, "NO_ALARM")
field(LSV, "NO_ALARM")
field(HYST, "0")
field(ADEL, "0")
field(MDEL, "0")
field(SIOL, "0")
field(SIML, "0")
field(SIMS, "NO_ALARM")
field(IVOA, "Continue normally")
field(IVOV, "0")
}
There should be nothing interesting about the longout records described above. The only important thing is that they properly point to the VME field of the eg record.
record(er, "$(prefix)_ER")
{
field(DESC, "")
field(ASG, "")
field(SCAN, "Passive")
field(PINI, "YES")
field(PHAS, "0")
field(EVNT, "0")
field(TSE, "0")
field(TSEL, "0")
field(DTYP, "APS event receiver")
field(DISV, "1")
field(SDIS, "0")
field(DISS, "NO_ALARM")
field(PRIO, "LOW")
field(FLNK, "0")
field(OUT, "#C0 S0 @")
field(ENAB, "YES")
field(TRG0, "Disabled")
field(TRG1, "Disabled")
field(TRG2, "Disabled")
field(TRG3, "Disabled")
field(TRG4, "Disabled")
field(TRG5, "Disabled")
field(TRG6, "Disabled")
field(OTP0, "Disabled")
field(OTP1, "Disabled")
field(OTP2, "Disabled")
field(OTP3, "Disabled")
field(OTP4, "Disabled")
field(OTP5, "Disabled")
field(OTP6, "Disabled")
field(OTP7, "Disabled")
field(OTP8, "Disabled")
field(OTP9, "Disabled")
field(OTPA, "Disabled")
field(OTPB, "Disabled")
field(OTPC, "Disabled")
field(OTPD, "Disabled")
field(OTL0, "Disabled")
field(OTL1, "Disabled")
field(OTL2, "Disabled")
field(OTL3, "Disabled")
field(OTL4, "Disabled")
field(OTL5, "Disabled")
field(OTL6, "Disabled")
field(DG0E, "Disabled")
field(DG0D, "0")
field(DG0W, "0")
field(DG1E, "Disabled")
field(DG1D, "0")
field(DG1W, "0")
field(DG2E, "Disabled")
field(DG2D, "0")
field(DG2W, "0")
field(DG3E, "Disabled")
field(DG3D, "0")
field(DG3W, "0")
}
Much like the eg record, the only interesting to note is that this record is passive and processed at init time.Now, in order to cause an IRQ to occur when the reset/resync time stamp event is received, we use the following erevent record:
record(erevent, "$(prefix)_erevent7d")
{
field(DESC, "")
field(ASG, "")
field(SCAN, "Passive")
field(PINI, "YES")
field(PHAS, "0")
field(EVNT, "0")
field(TSE, "0")
field(TSEL, "0")
field(DTYP, "APS event receiver")
field(DISV, "1")
field(SDIS, "0")
field(DISS, "NO_ALARM")
field(PRIO, "LOW")
field(FLNK, "0")
field(OUT, "#C0 S0 @")
field(ENAB, "Enabled")
field(ENM, "0x7d")
field(OUT0, "Disabled")
field(OUT1, "Disabled")
field(OUT2, "Disabled")
field(OUT3, "Disabled")
field(OUT4, "Disabled")
field(OUT5, "Disabled")
field(OUT6, "Disabled")
field(OUT7, "Disabled")
field(OUT8, "Disabled")
field(OUT9, "Disabled")
field(OUTA, "Disabled")
field(OUTB, "Disabled")
field(OUTC, "Disabled")
field(OUTD, "Disabled")
field(VME, "Enabled")
}
Interesting points here are that the output link field points to the same ER card as the above er record. The event number specified in the ENM field is the reset/resync time stamp event, and we can see that the VME field is set to ENABLED. This does nothing more than to tell the ER card that we want an IRQ on event number 0x7D. Note that we could also have turned on any of the output pulse/level outputs as well.We need not include a record to enable anything on the increment time stamp or heart beat events as they are handled by the ER card automatically.
Exactly what happens when the IRQ arrives for event 0x7D is described in detail in the global timing documentation. Suffice it to say that the timing system registers a callback with the event receiver driver that gets called upon receipt of the event.
Should you desire to process a database record upon the receipt of an event (in this case event number 0x7D) you may use a regular EPICS event record and set it up like this:
record(event, "$(prefix)_event")
{
field(DESC, "")
field(ASG, "")
field(SCAN, "Passive")
field(PINI, "NO")
field(PHAS, "0")
field(EVNT, "0")
field(TSE, "0")
field(TSEL, "0")
field(DTYP, "APS event receiver")
field(DISV, "1")
field(SDIS, "0")
field(DISS, "NO_ALARM")
field(PRIO, "LOW")
field(FLNK, "$(prefix)_calc1.PROC PP MS")
field(INP, "#C0 S125 @")
field(SIOL, "0")
field(SIML, "0")
field(SIMS, "NO_ALARM")
}
Interesting tidbits here are that the record's INP link is set to the ER card, the signal number is set to the event number of interest, and that the forward link field be set to the record you wish to process upon receipt of the event code. Remember also that the VME interrupt must be enabled for the desired event code (in this case, 125 (0x7D)) by the use of an erevent record type for the same event number, that has the VME field set to ENABLED.