RRM 3-14 Multi-Bit Binary Input Direct
mbbiDirect - Multi-Bit Binary Input Direct
- Johnny Tang, Matthew Bickley, and Chip Watson
- Continuous Electron Beam Accelerator Facility
- Southeastern Universities Research Association
The mbbiDirect record retrieves a sixteen-bit hardware value and converts it to an array of sixteen unsigned characters, each representing a bit of the word. These fields (B0-B9, BA-BF) are set to 1 if a bit is set, and 0 if not.
This record's operation is similar to that of the multi-bit binary input record, and it has many fields in common with it. This record also has two available soft device support modules--Soft Channel
and Raw Soft Channel
.
Parameter Fields
The fields fall into the following categories:
- scan parameters
- read and convert parameters
- operator display parameters
- alarm parameters
- run-time and simulation mode parameters
Scan fields
The mbbiDirect record has the standard fields for specifying under what circumstances the record will be processed. These fields are listed in Scan Fields. In addition, Scanning Specification explains how these fields are used. Note that I/O event scanning is only supported for those card types that interrupt.
Read and Convert fields
The device support routines obtain the record's input from the device or link specified in the INP field. For records that obtain their input from devices, the INP field must contain the address of the I/O card, and the DTYP field must specify the proper device support module. Be aware that the address format differs according to the I/O bus used. See Address Specification for information on the format of hardware addresses. You can see a list of the device support modules currently supported at the user's local site by using the dbst
utility in R3.13.
Two soft device support modules can be specified in DTYP--Soft Channel
and Raw Soft Channel
. Raw Soft Channel
reads the value into RVAL, upon which the normal conversion process is undergone. Soft Channel
reads any unsigned integer directly into VAL. For a soft mbbiDirect record, the INP field can be a constant, a database, or a channel access link. If INP is a constant, then the VAL is initialized to the INP value but can be changed at run-time via dbPutField or dbPutLink. See Address Specification for information on how to database links.
For records that don't use Soft Channel
device support, RVAL is used to determine VAL as follows:
- RVAL is assigned to a temporary variable--rval = RVAL
- rval is shifted right SHFT number of bits.
- VAL is set equal to rval.
Each of the fields, B0-BF, represents one bit of the word.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
VAL | Value Field | ENUM | No | 0 | Yes | Yes | Yes | Yes |
INP | Input Link | INLINK | Yes | 0 | No | No | N/A | No |
RVAL | Raw Data Value | ULONG | No | 0 | Yes | Yes | Yes | Yes |
SHFT | Shift | USHORT | No | 0 | Yes | No | No | No |
B0 | Bit 0 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
B1 | Bit 1 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
B2 | Bit 2 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
B3 | Bit 3 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
B4 | Bit 4 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
B5 | Bit 5 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
B6 | Bit 6 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
B7 | Bit 7 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
B8 | Bit 8 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
B9 | Bit 9 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
BA | Bit 10 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
BB | Bit 12 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
BC | Bit 13 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
BD | Bit 14 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
BE | Bit 15 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
BF | Bit 16 Value | UCHAR | Yes | 0 | Yes | Yes | Yes | Yes |
Operator Display Parameters
These parameters are used to present meaningful data to the operator.
See Fields Common to All Record Types for more on the record name (NAME) and description (DESC) fields.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
NAME | Record Name | STRING [29] | Yes | 0 | Yes | No | No | No |
DESC | Description | STRING [29] | Yes | Null | Yes | Yes | No | No |
Alarm Parameters
The possible alarm conditions for multi-bit binary input direct records are the SCAN and READ alarms. These alarms are not configurable by the user since they are always of MAJOR severity. See Alarm Specification for a complete explanation of Scan and Read alarms. No fields exist for the mbbi direct record to have state alarms.
Alarm Fields lists other fields related to a alarms that are common to all record types.
Run-time and Simulation Mode Fields
These parameters are used by the run-time code for processing the mbbi direct record. They are not configurable prior to run-time.
MASK is used by device support routine to read hardware register. Record support sets low order NOBT bits in MASK. Device support can shift this value.
The LALM field implements the change of state alarm severity by holding the value of VAL when the previous change of state alarm was issued.
MLST holds the value when the last monitor for value change was triggered.
SDEF is used by record support to save time if no states are defined.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
NOBT | Number of Bits | SHORT | Yes | 0 | Yes | No | No | No |
ORAW | Old Raw Data | ULONG | No | 0 | Yes | No | No | No |
MASK | Mask | ULONG | No | 0 | Yes | No | No | No |
LALM | Last Alarmed | USHORT | No | 0 | Yes | No | No | No |
MLST | Monitor Last | USHORT | No | 0 | Yes | No | No | No |
SDEF | States Defined? | SHORT | No | 0 | Yes | No | No | No |
The following fields are used to operate the mbbiDirect record in the simulation mode. See Fields Common to Many Record Types for more information on these fields.
Field | Summary | Type | DCT | Initial | Access | Modify | Rec Proc Monitor | PP |
---|---|---|---|---|---|---|---|---|
SIOL | Simulation Value Location | INLINK | Yes | 0 | No | No | N/A | No |
SVAL | Simulation Value | DOUBLE | No | 0 | Yes | Yes | No | No |
SIML | Simulation Mode Location | INLINK | Yes | 0 | No | No | N/A | No |
SIMM | Simulation Mode | GBLCHOICE | No | 0 | Yes | Yes | No | No |
SIMS | Simulation Mode Alarm Severity | GBLCHOICE | Yes | 0 | Yes | Yes | No | No |
Record Support
Record Support Routines
init_record
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 device support read routine is defined. If either does not exist, an error message is issued and processing is terminated.
Clears MASK and then sets the NOBT low order bits.
If device support includes init_record, it is called.
refresh_bits is then called to refresh all the bit fields based on a hardware value.
process
See next section.
get_value
Fills in the values of struct valueDes so that they refer to VAL.
Record Processing
Routine process implements the following algorithm:
- 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.
- readValue is called. See Output Records for information.
- 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.
- Convert.
- status=read_mbbiDirect
- PACT = TRUE
- TIME = tsLocalTime
- If status is 0, then determine VAL
- Set rval = RVAL
- Shift rval right SHFT bits
- Set VAL = RVAL
- If status is 1, return(0)
- If status is 2, set status = 0
- Check to see if monitors should be invoked.
- Alarm monitors are invoked if the alarm status or severity has changed.
- Archive and value change monitors are invoked if MLST is not equal to VAL.
- Monitors for RVAL are checked whenever other monitors are invoked.
- NSEV and NSTA are reset to 0.
- Scan forward link if necessary, set PACT FALSE, and return.
Device Support
Fields Of Interest To Device Support
Each input record must have an associated set of device support routines.
The primary responsibility of the device support routines is to obtain a new raw input value whenever read_mbbiDirect is called. The device support routines are primarily interested in the following fields:
Name | Summary | Description |
---|---|---|
PACT | Processing Active | See Fields Common to All Record Types for an explanation of these fields. |
DPVT | Device Private | |
UDF | VAL Undefined | |
NSEV | New Alarm Severity | |
NSTA | New Alarm Status | |
NOBT | Number of Bits | Number of hardware bits accessed. They must be consecutive. |
VAL | Value Field | This field is set by the device support routines if they don't want record support to set it. |
INP | Input Link | This field is used by the device support routines to locate its input. |
RVAL | Raw Data Value | It is the responsibility of the device support routine to give this field a value. |
MASK | Mask | This is a mask used to read the hardware. Record support sets the low order NOBT bits. The device support routine can shift the bits. The device support routine should perform the shift in init_record. |
SHFT | Shift | This can be set by the device support module at init_record time. |
Device Support Routines
Device support consists of the following routines:
report
report(FILE fp, paddr)
Not currently used.
init
init()
This routine is called once during IOC initialization.
init_record
init_record(precord)
This routine is optional. If provided, it is called by the record support init_record routine. If it uses MASK, it should shift it as necessary and also give SHFT a value.
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. 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.
read_mbbiDirect
read_mbbiDirect(precord)
This routine must provide a new input value. It returns the following values:
- 0: Success. A new raw value is placed in RVAL. The record support module determines VAL from RVAL and SHFT.
- 2: Success, but don't modify VAL.
- Other: Error.
Device Support For Soft Records
Two soft device support modules, Soft Channel
and Raw Soft Channel
, are provided for multi-bit binary input direct records not related to actual hardware devices. The INP link type must be either CONSTANT, DB_LINK, or CA_LINK.
Soft Channel
For this module, read_mbbiDirect always returns a value of 2, which means that no conversion is performed.
If the INP link type is constant, then the constant value is stored into VAL by init_record, and UDF is set to FALSE. VAL can be changed via dbPut requests. If the INP link type is PV_LINK, then dbCaAddInlink is called by init_record.
read_mbbiDirect calls recGblGetLinkValue to read the current value of VAL.
See Input Records for a further explanation.
If the return status of recGblGetLinkValue is zero, then read_mbbi sets UDF to FALSE. The status of recGblGetLinkValue is returned.
Raw Soft Channel
This module is like the previous except that values are read into RVAL, VAL is computed from RVAL, and read_mbbiDirect returns a value of 0. Thus the record processing routine will determine VAL in the normal way.
EPICS Record Reference Manual - 19 MAY 1998