297 lines
7.6 KiB
Plaintext
297 lines
7.6 KiB
Plaintext
#*************************************************************************
|
|
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
|
# National Laboratory.
|
|
# Copyright (c) 2002 The Regents of the University of California, as
|
|
# Operator of Los Alamos National Laboratory.
|
|
# EPICS BASE is distributed subject to a Software License Agreement found
|
|
# in file LICENSE that is included with this distribution.
|
|
#*************************************************************************
|
|
|
|
=title Event Record (event)
|
|
|
|
The normal use for this record type is to post an event and/or process a
|
|
forward link. Device support for this record can provide a hardware interrupt
|
|
handler routine for I/O Event-scanned records.
|
|
|
|
=head2 Parameter Fields
|
|
|
|
The record-specific fields are described below, grouped by functionality.
|
|
|
|
=recordtype event
|
|
|
|
=cut
|
|
|
|
recordtype(event) {
|
|
include "dbCommon.dbd"
|
|
|
|
%
|
|
%/* Declare Device Support Entry Table */
|
|
%struct eventRecord;
|
|
%typedef struct eventdset {
|
|
% dset common; /*init_record returns: (-1,0)=>(failure,success)*/
|
|
% long (*read_event)(struct eventRecord *prec); /*(0)=> success */
|
|
%} eventdset;
|
|
%#define HAS_eventdset
|
|
%
|
|
|
|
=head3 Scan Parameters
|
|
|
|
The event record has the standard fields for specifying under what circumstances
|
|
it will be processed.
|
|
These fields are described in L<Scan Fields|dbCommonRecord/Scan Fields>.
|
|
|
|
=fields SCAN, PHAS, EVNT, PRIO, PINI
|
|
|
|
=head3 Event Number Parameters
|
|
|
|
The VAL field contains the event number read by the device support routines. It
|
|
is this number which is posted. For records that use C<Soft Channel> device
|
|
support, it can be configured before run-time or set via dbPuts.
|
|
|
|
=fields VAL
|
|
|
|
=cut
|
|
|
|
field(VAL,DBF_STRING) {
|
|
prompt("Event Name To Post")
|
|
promptgroup("40 - Input")
|
|
special(SPC_MOD)
|
|
asl(ASL0)
|
|
size(40)
|
|
}
|
|
%#include "dbScan.h"
|
|
field(EPVT, DBF_NOACCESS) {
|
|
prompt("Event private")
|
|
special(SPC_NOMOD)
|
|
interest(4)
|
|
extra("EVENTPVT epvt")
|
|
}
|
|
|
|
=head3 Input Specification
|
|
|
|
The device support routines use the address in this record to obtain input. For
|
|
records that provide an interrupt handler, the INP field should specify the
|
|
address of the I/O card, and the DTYP field should specify a valid device
|
|
support module. Be aware that the address format differs according to the card
|
|
type used. See L<Address
|
|
Specification|https://docs.epics-controls.org/en/latest/guides/EPICS_Process_Database_Concepts.html#address-specification>
|
|
for information on the format of hardware addresses and specifying links.
|
|
|
|
For soft records, the INP field can be a constant, a database link, or a channel
|
|
access link. For soft records, the DTYP field should specify C<Soft Channel>.
|
|
|
|
=fields INP, DTYP
|
|
|
|
=cut
|
|
|
|
field(INP,DBF_INLINK) {
|
|
prompt("Input Specification")
|
|
promptgroup("40 - Input")
|
|
interest(1)
|
|
}
|
|
|
|
=head3 Operator Display Parameters
|
|
|
|
See L<Fields Common to All Record Types|dbCommonRecord/Operator Display
|
|
Parameters> for more on the record name (NAME) and description (DESC) fields.
|
|
|
|
|
|
=fields NAME, DESC
|
|
|
|
=head3 Alarm Parameters
|
|
|
|
The Event record has the alarm parameters common to all record types. L<Alarm
|
|
Fields> lists other fields related to alarms that are common to all record
|
|
types.
|
|
|
|
=head3 Simulation Mode Parameters
|
|
|
|
The following fields are used to operate the event record in the simulation
|
|
mode. See L<Fields Common to Many Record Types> for more information on these
|
|
fields.
|
|
|
|
=fields SIOL, SVAL, SIML, SIMM, SIMS
|
|
|
|
=cut
|
|
|
|
field(SIOL,DBF_INLINK) {
|
|
prompt("Sim Input Specifctn")
|
|
promptgroup("90 - Simulate")
|
|
interest(1)
|
|
}
|
|
field(SVAL,DBF_STRING) {
|
|
prompt("Simulation Value")
|
|
size(40)
|
|
}
|
|
field(SIML,DBF_INLINK) {
|
|
prompt("Sim Mode Location")
|
|
promptgroup("90 - Simulate")
|
|
interest(1)
|
|
}
|
|
field(SIMM,DBF_MENU) {
|
|
prompt("Simulation Mode")
|
|
special(SPC_MOD)
|
|
interest(1)
|
|
menu(menuYesNo)
|
|
}
|
|
field(SIMS,DBF_MENU) {
|
|
prompt("Sim mode Alarm Svrty")
|
|
promptgroup("90 - Simulate")
|
|
interest(2)
|
|
menu(menuAlarmSevr)
|
|
}
|
|
field(OLDSIMM,DBF_MENU) {
|
|
prompt("Prev. Simulation Mode")
|
|
special(SPC_NOMOD)
|
|
interest(4)
|
|
menu(menuSimm)
|
|
}
|
|
field(SSCN,DBF_MENU) {
|
|
prompt("Sim. Mode Scan")
|
|
promptgroup("90 - Simulate")
|
|
interest(1)
|
|
menu(menuScan)
|
|
initial("65535")
|
|
}
|
|
field(SDLY,DBF_DOUBLE) {
|
|
prompt("Sim. Mode Async Delay")
|
|
promptgroup("90 - Simulate")
|
|
interest(2)
|
|
initial("-1.0")
|
|
}
|
|
%#include "callback.h"
|
|
field(SIMPVT,DBF_NOACCESS) {
|
|
prompt("Sim. Mode Private")
|
|
special(SPC_NOMOD)
|
|
interest(4)
|
|
extra("epicsCallback *simpvt")
|
|
}
|
|
|
|
=head2 Record Support
|
|
|
|
=head3 Record Support Routines
|
|
|
|
=head4 init_record
|
|
|
|
This routine initializes SIMM with the value of SIML if SIML type is a CONSTANT
|
|
link or creates a channel access link if SIML type is PV_LINK. SVAL is likewise
|
|
initialized if SIOL is CONSTANT or PV_LINK.
|
|
|
|
If device support includes C<init_record()>, it is called.
|
|
|
|
=head4 process
|
|
|
|
See next section.
|
|
|
|
=head3 Record Processing
|
|
|
|
Routine process implements the following algorithm:
|
|
|
|
=over
|
|
|
|
=item 1.
|
|
|
|
readValue is called. See L<Input Records> for more information.
|
|
|
|
=item 2.
|
|
|
|
If PACT has been changed to TRUE, the device support read routine has started
|
|
but has not completed reading a new input value. In this case, the processing
|
|
routine merely returns, leaving PACT TRUE.
|
|
|
|
=item 3.
|
|
|
|
If VAL E<gt> 0, post event number VAL.
|
|
|
|
=item 4.
|
|
|
|
Check to see if monitors should be invoked. Alarm monitors are invoked if the
|
|
alarm status or severity has chanet to 0.
|
|
|
|
=item 5.
|
|
|
|
Scan forward link if necessary, set PACT FALSE, and return.
|
|
|
|
=back
|
|
|
|
=head2 Device Support
|
|
|
|
=head3 Fields of Interest To Device Support
|
|
|
|
Each record must have an associated set of device support routines. The device
|
|
support routines are primarily interested in the following fields:
|
|
|
|
=fields PACT, DPVT, UDF, NSEV, NSTA, INP, PRIO
|
|
|
|
=head3 Device Support Routines
|
|
|
|
Device support consists of the following routines:
|
|
|
|
=head4 long report(int level)
|
|
|
|
This optional routine is called by the IOC command C<dbior> and is passed the
|
|
report level that was requested by the user.
|
|
It should print a report on the state of the device support to stdout.
|
|
The C<level> parameter may be used to output increasingly more detailed
|
|
information at higher levels, or to select different types of information with
|
|
different levels.
|
|
Level zero should print no more than a small summary.
|
|
|
|
=head4 long init(int after)
|
|
|
|
This optional routine is called twice at IOC initialization time.
|
|
The first call happens before any of the C<init_record()> calls are made, with
|
|
the integer parameter C<after> set to 0.
|
|
The second call happens after all of the C<init_record()> calls have been made,
|
|
with C<after> set to 1.
|
|
|
|
=head4 init_record
|
|
|
|
init_record(precord)
|
|
|
|
This routine is optional. If provided, it is called by the record support
|
|
C<init_record()> routine.
|
|
|
|
=head4 get_ioint_info
|
|
|
|
get_ioint_info(int cmd, struct dbCommon *precord, IOSCANPVT *ppvt)
|
|
|
|
This routine is called by the ioEventScan system each time the record is added
|
|
or deleted from an I/O event scan list. C<cmd> has the value (0,1) if the record is
|
|
being (added to, deleted from) an I/O event list. It must be provided for any
|
|
device type that can use the ioEvent scanner.
|
|
|
|
=head4 read_event
|
|
|
|
read_event(precord)
|
|
|
|
This routine returns the following values:
|
|
|
|
=over
|
|
|
|
=item *
|
|
|
|
0: Success.
|
|
|
|
=item *
|
|
|
|
Other: Error.
|
|
|
|
=back
|
|
|
|
=head3 Device Support For Soft Records
|
|
|
|
The C<Soft Channel> device support module is available. The INP link type must
|
|
be either CONSTANT, DB_LINK, or CA_LINK.
|
|
|
|
If the INP link type is CONSTANT, then the constant value is stored into VAL by
|
|
C<init_record()>, and UDF is set to FALSE. If the INP link type is PV_LINK, then
|
|
dbCaAddInlink is called by C<init_record()>.
|
|
|
|
C<read_event> calls recGblGetLinkValue to read the current value of VAL. See
|
|
L<Input Records> for details on soft input.
|
|
|
|
=cut
|
|
|
|
}
|