356 lines
9.2 KiB
Plaintext
356 lines
9.2 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 String Input Record (stringin)
|
|
|
|
The string input record retrieves an arbitrary ASCII string of up to 40
|
|
characters. Several device support routines are available, all of which are soft
|
|
device support for retrieving values from other records or other software
|
|
components.
|
|
|
|
=recordtype stringin
|
|
|
|
=cut
|
|
|
|
menu(stringinPOST) {
|
|
choice(stringinPOST_OnChange,"On Change")
|
|
choice(stringinPOST_Always,"Always")
|
|
}
|
|
recordtype(stringin) {
|
|
include "dbCommon.dbd"
|
|
field(VAL,DBF_STRING) {
|
|
prompt("Current Value")
|
|
promptgroup("40 - Input")
|
|
asl(ASL0)
|
|
pp(TRUE)
|
|
size(40)
|
|
}
|
|
field(OVAL,DBF_STRING) {
|
|
prompt("Previous Value")
|
|
special(SPC_NOMOD)
|
|
interest(3)
|
|
size(40)
|
|
}
|
|
|
|
=head2 Parameter Fields
|
|
|
|
The record-specific fields are described below, grouped by functionality.
|
|
|
|
=head3 Scan Parameters
|
|
|
|
The string input record has the standard fields for specifying under what
|
|
circumstances it will be processed. These fields are listed in L<Scan Fields>.
|
|
In addition, L<Scanning Specification> explains how these fields are used.
|
|
|
|
=head3 Input Specification
|
|
|
|
The INP field determines where the string input record gets its string. It can
|
|
be a database or channel access link, or a constant. If constant, the VAL field
|
|
is initialized with the constant and can be changed via dbPuts. Otherwise, the
|
|
string is read from the specified location each time the record is processed and
|
|
placed in the VAL field. The maximum number of characters that the string in VAL
|
|
can be is 40. In addition, the appropriate device support module must be entered
|
|
into the DTYP field.
|
|
|
|
See L<Address Specification> for information on specifying links.
|
|
|
|
=fields VAL, INP, DTYP
|
|
|
|
=cut
|
|
|
|
field(INP,DBF_INLINK) {
|
|
prompt("Input Specification")
|
|
promptgroup("40 - Input")
|
|
interest(1)
|
|
}
|
|
|
|
=head3 Monitor Parameters
|
|
|
|
These parameters are used to specify when the monitor post should be sent by
|
|
C<monitor()> routine. There are two possible choices:
|
|
|
|
=head4 Menu stringinPOST
|
|
|
|
=menu stringinPOST
|
|
|
|
APST is used for archiver monitors and MPST is for all other type of monitors.
|
|
|
|
=fields MPST, APST
|
|
|
|
=cut
|
|
|
|
field(MPST,DBF_MENU) {
|
|
prompt("Post Value Monitors")
|
|
promptgroup("80 - Display")
|
|
interest(1)
|
|
menu(stringinPOST)
|
|
}
|
|
field(APST,DBF_MENU) {
|
|
prompt("Post Archive Monitors")
|
|
promptgroup("80 - Display")
|
|
interest(1)
|
|
menu(stringinPOST)
|
|
}
|
|
|
|
=head3 Operator Display Parameters
|
|
|
|
See L<Fields Common to All Record Types> for more on the record name (NAME) and
|
|
description (DESC) fields.
|
|
|
|
=fields NAME, DESC
|
|
|
|
=head3 Alarm Parameters
|
|
|
|
The string input record has the alarm parameters common to all record types.
|
|
L<Alarm Fields> lists other fields related to a alarms that are common to all
|
|
record types.
|
|
|
|
=head3 Run-time Parameters
|
|
|
|
The old value field (OVAL) of the string input is used to implement value change
|
|
monitors for VAL. If VAL is not equal to OVAL, then monitors are triggered.
|
|
|
|
=fields OVAL
|
|
|
|
=head3 Simulation Mode Parameters
|
|
|
|
The following fields are used to operate the record in simulation mode.
|
|
|
|
If SIMM (fetched through SIML) is YES, the record is put in SIMS
|
|
severity and the value is fetched through SIOL (buffered in SVAL).
|
|
SSCN sets a different SCAN mechanism to use in simulation mode.
|
|
SDLY sets a delay (in sec) that is used for asynchronous simulation
|
|
processing.
|
|
|
|
See L<Input Simulation Fields|dbCommonInput/Input Simulation Fields>
|
|
for more information on simulation mode and its fields.
|
|
|
|
=fields SIML, SIMM, SIOL, SVAL, SIMS, SDLY, SSCN
|
|
|
|
=cut
|
|
|
|
field(SIOL,DBF_INLINK) {
|
|
prompt("Simulation Input Link")
|
|
promptgroup("90 - Simulate")
|
|
interest(1)
|
|
}
|
|
field(SVAL,DBF_STRING) {
|
|
prompt("Simulation Value")
|
|
pp(TRUE)
|
|
size(40)
|
|
}
|
|
field(SIML,DBF_INLINK) {
|
|
prompt("Simulation Mode Link")
|
|
promptgroup("90 - Simulate")
|
|
interest(1)
|
|
}
|
|
field(SIMM,DBF_MENU) {
|
|
prompt("Simulation Mode")
|
|
special(SPC_MOD)
|
|
interest(1)
|
|
menu(menuYesNo)
|
|
}
|
|
field(SIMS,DBF_MENU) {
|
|
prompt("Simulation Mode Severity")
|
|
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
|
|
|
|
long (*init_record)(struct dbCommon *precord, int pass)
|
|
|
|
This routine initializes SIMM with the value of SIML if SIML type is 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.
|
|
|
|
This routine next checks to see that device support is available and a record
|
|
support read routine is defined. If either does not exist, an error message is
|
|
issued and processing is terminated.
|
|
|
|
If device support includes an C<init_record()> routine it is called.
|
|
|
|
=head4 process
|
|
|
|
long (*process)(struct dbCommon *precord)
|
|
|
|
See L<Record Processing>.
|
|
|
|
=head3 Record Processing
|
|
|
|
Routine process implements the following algorithm:
|
|
|
|
=over
|
|
|
|
=item 1.
|
|
|
|
Check to see that the appropriate device support module exists. If it doesn't,
|
|
an error message is issued and processing is terminated with the PACT field
|
|
still set to TRUE. This ensures that processes will no longer be called for this
|
|
record. Thus error storms will not occur.
|
|
|
|
=item 2.
|
|
|
|
readValue is called. See L<Simulation Mode> for more information on simulation
|
|
mode fields and how they affect input.
|
|
|
|
=item 3.
|
|
|
|
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 4.
|
|
|
|
C<recGblGetTimeStamp()> is called.
|
|
|
|
=item 5.
|
|
|
|
Check to see if monitors should be invoked.
|
|
|
|
=over
|
|
|
|
=item *
|
|
|
|
Alarm monitors are invoked if the alarm status or severity has changed.
|
|
|
|
=item *
|
|
|
|
Archive and value change monitors are invoked if OVAL is not equal to VAL.
|
|
|
|
=item *
|
|
|
|
NSEV and NSTA are reset to 0.
|
|
|
|
=back
|
|
|
|
=item 6.
|
|
|
|
Scan forward link if necessary, set PACT FALSE, and return.
|
|
|
|
=back
|
|
|
|
=begin html
|
|
|
|
<br>
|
|
<hr>
|
|
<br>
|
|
|
|
=end html
|
|
|
|
=head2 Device Support
|
|
|
|
=head3 Fields Of Interest To Device Support
|
|
|
|
Each stringin input record must have an associated set of device support
|
|
routines. The primary responsibility of the device support routines is to obtain
|
|
a new ASCII string value whenever read_stringin is called. The device support
|
|
routines are primarily interested in the following fields:
|
|
|
|
=fields PACT, DPVT, UDF, VAL, INP
|
|
|
|
=head3 Device Support Routines
|
|
|
|
Device support consists of the following routines:
|
|
|
|
=head4 report
|
|
|
|
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 init
|
|
|
|
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
|
|
|
|
long init_record(dbCommon *prec)
|
|
|
|
This routine is optional. If provided, it is called by the record support
|
|
C<init_record()> routine.
|
|
|
|
=head4 get_ioint_info
|
|
|
|
long get_ioint_info(int cmd, 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_stringin
|
|
|
|
long read_stringin(stringinRecord *prec)
|
|
|
|
This routine must provide a new input value. It returns the following values:
|
|
|
|
=over
|
|
|
|
=item * 0: Success. A new ASCII string is stored into VAL.
|
|
|
|
=item * Other: Error.
|
|
|
|
=back
|
|
|
|
=head3 Device Support for Soft Records
|
|
|
|
The C<<< Soft Channel >>> module reads a value directly into VAL.
|
|
|
|
Device support for DTYP C<getenv> is provided for retrieving strings from environment variables.
|
|
C<INST_IO> addressing C!!@<environment variable> !!is used on the C<INP> link field to select the
|
|
desired environment variable.
|
|
|
|
=cut
|
|
|
|
}
|