RRM 3-14 Multi-Bit Binary Output Direct

From EPICSWIKI
Revision as of 19:37, 18 April 2008 by KazimierzGofron (talk | contribs)

EPICS Record Reference Manual


mbboDirect - Multi-Bit Binary Output Direct

Johnny Tang, Matthew Bickley, and Chip Watson
Continuous Electron Beam Accelerator Facility
Southeastern Universities Research Association


The mbboDirect record performs the opposite function to that of the mbbiDirect record. It accumulates bits (in the fields B0 - BF) as unsigned characters, and converts them to a word which is then written out to hardware. If a bit field is non-zero, it is interpreted as a binary 1. On the other hand, if it is zero, it is interpreted as a binary 0.

Parameter Fields

The mbboDirect record's fields fall into the following categories:

  • scan parameters
  • desired output parameters
  • write and convert parameters
  • operator display parameters
  • alarm parameters
  • run-time parameters

Scan Parameters

The mbboDirect record has the standard fields for specifying under what circumstances it 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.


Desired Output Parameters

The mbboDirect record, like all output records, must specify where its output originates. The output mode select field (OMSL) determines whether the output originates from another record or from database access. When set to closed_loop, the desired output is retrieved from the link specified in the desired output (DOL) field--which can specify either a database or channel access link--and placed into the VAL field. When set to supervisory, the DOL field is ignored and the current value of VAL is used. The desired output can be written into the VAL field via dpPuts at run-time when the record is in supervisory mode. DOL can also be a constant, in which case VAL is initialized to the constant value. Note that OMSL cannot be closed_loop when DOL is a constant. See Address Specification for information on how to specify database links.

VAL is then converted to RVAL in the routine described in the next section. However, the Soft Channel device support module for the mbboDirect record writes the VAL field's value without any conversion.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
OMSLOutput Mode SelectGBLCHOICEYes0YesYesNoNo
DOLDesired Output Location (an Input Link)INLINKYes0NoNoN/ANo
VALValue FieldENUMNo0YesYesYesYes


Convert and Write Parameters

For records that are to write values to hardware devices, the OUT output link 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.

If the mbboDirect record does not use the Soft Channel device support module, then VAL is converted to RVAL, and RVAL is the actual 16-bit word sent out. RVAL is set equal to VAL and then shifted left by the number of bits specified in the SHFT field (the SHFT value is set by device support and is not configurable by the user). RVAL is then sent out to the location specified in the OUT field.

For mbboDirect records that specify a database link, a channel access link, or a constant, the DTYP field must specify either one of two soft device support routines--Soft Channel or Raw Soft Channel. The difference between the two is that Soft Channel writes the desired output value from VAL directly to the output link while Raw Soft Channel writes the value from RVAL to the output link after it has undergone the conversion described above. See Address Specification for information on how to specify database links.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
OUTOutput LinkOUTLINKYes0NoNoN/ANo
RVALRaw Data ValueULONGNo0YesYesYesYes
SHFTShiftUSHORTNo0YesNoNoNo
B0Bit 0 ValueUCHARYes0YesYesYesYes
B1Bit 1 ValueUCHARYes0YesYesYesYes
B2Bit 2 ValueUCHARYes0YesYesYesYes
B3Bit 3 ValueUCHARYes0YesYesYesYes
B4Bit 4 ValueUCHARYes0YesYesYesYes
B5Bit 5 ValueUCHARYes0YesYesYesYes
B6Bit 6 ValueUCHARYes0YesYesYesYes
B7Bit 7 ValueUCHARYes0YesYesYesYes
B8Bit 8 ValueUCHARYes0YesYesYesYes
B9Bit 9 ValueUCHARYes0YesYesYesYes
BABit 10 ValueUCHARYes0YesYesYesYes
BBBit 12 ValueUCHARYes0YesYesYesYes
BCBit 13 ValueUCHARYes0YesYesYesYes
BDBit 14 ValueUCHARYes0YesYesYesYes
BEBit 15 ValueUCHARYes0YesYesYesYes
BFBit 16 ValueUCHARYes0YesYesYesYes


Operator Display Parameters

See Fields Common to All Record Types for more on the record name (NAME) and description (DESC) fields.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
NAMERecord NameSTRING [29]Yes0YesNoNoNo
DESCDescriptionSTRING [29]YesNullYesYesNoNo


Alarm Parameters

The possible alarm conditions for mbboDirect records are the SCAN, READ, and INVALID alarms. The SCAN and READ 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.

The IVOA field specifies an action to take when the INVALID alarm is triggered. There are three possible actions: Continue normally, Don't drive outputs, or Set output to IVOV. When Set output to IVOV is specified and a INVALID alarm is triggered, the record will write the value in the IVOV field to output. See Invalid Alarm Output Action for more information. Alarm Fields lists other fields related to a alarms that are common to all record types.

No fields exist for this record to have state alarms.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
IVOAInvalid Alarm Output ActionGBLCHOICEYes0YesYesNoNo
IVOVInvalid Alarm Output Value, in eng. unitsDOUBLEYes0YesYesNoNo


Run-time and Simulation Mode Parameters

These parameters are used by the run-time code for processing the mbbo Direct record.

MASK is used by device support routine to read the hardware register. Record support sets low order NOBT bits. 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.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
NOBTNumber of BitsSHORTYes0YesNoNoNo
ORAWOld Raw DataULONGNo0YesNoNoNo
MASKMaskULONGNo0YesNoNoNo
LALMLast AlarmedUSHORTNo0YesNoNoNo
MLSTMonitor LastUSHORTNo0YesNoNoNo
SDEFStates Defined?SHORTNo0YesNoNoNo

The following fields are used to operate the mbboDirect record in the simulation mode. See Simulation Mode for more information on the simulation mode fields.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
SIOLSimulation Value LocationINLINKYes0NoNoN/ANo
SVALSimulation ValueDOUBLENo0YesYesNoNo
SIMLSimulation Mode LocationINLINKYes0NoNoN/ANo
SIMMSimulation ModeGBLCHOICENo0YesYesNoNo
SIMSSimulation Mode Alarm SeverityGBLCHOICEYes0YesYesNoNo


Record Support

Record Support Routines

init_record

This routine initializes SIMM if SIML is a constant or creates a channel access link if SIML is PV_LINK. If SIOL is PV_LINK a channel access link is created.

This routine next checks to see that device support is available.The routine next checks to see if the device support write routine is defined. If either device support or the device support write routine does not exist, an error message is issued and processing is terminated.

If DOL is a constant, then VAL is initialized to its value and UDF is set to FALSE.

MASK is cleared and then the NOBT low order bits are set.

If device support includes init_record, it is called.

init_common is then called to determine if any states are defined. If states are defined, SDEF is set to TRUE.

If device support returns success, VAL is then set from RVAL and UDF is set to FALSE.

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:

  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.
  2. If PACT is FALSE
    • If DOL is DB_LINK and OMSL is CLOSED_LOOP
      • Get value from DOL
      • Set PACT to FALSE
  3. Convert
    • If PACT is FALSE, compute RVAL
      • Set RVAL = VAL
      • Shift RVAL left SHFT bits
    • Status=write_mbboDirect
  4. If PACT has been changed to TRUE, the device support write output routine has started but has not completed writing the new value. In this case, the processing routine merely returns, leaving PACT TRUE.
  5. 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 and RBV are checked whenever other monitors are invoked.
    • NSEV and NSTA are reset to 0.
  6. Scan forward link if necessary, set PACT FALSE, and return.


Device Support

Fields Of Interest To Device Support

Each mbboDirect record must have an associated set of device support routines. The primary responsibility of the device support routines is to obtain a new raw mbbo value whenever write_mbboDirect is called. The device support routines are primarily interested in the following fields:


NameSummaryDescription
PACTProcessing ActiveSee Fields Common to All Record Types for an explanation of these fields.
DPVTDevice Private
UDFVAL Undefined
NSEVNew Alarm Severity
NSTANew Alarm Status
NOBTNumber of BitsNumber of hardware bits accessed. They must be consecutive.
OUTOutput LinkThis field is used by the device support routines to locate its output.
RVALRaw data valueThis is the value to be written to OUT.
RBVRead Back ValueIt is the responsibility of the device support modules to set this field.
MASKMaskThis 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.
SHFTShiftThis 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 MASK is used, it should be shifted if necessary and SHFT given 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.

write_mbboDirect

write_mbboDirect(precord)

This routine must output a new value. It returns the following values:

  • 0: Success.
  • Other: Error.

Device Support For Soft Records

This SOft Channel module writes the current value of VAL.

If the OUT link type is PV_LINK, then dbCaAddInlink is called by init_record.

write_mbboDirect calls recGblPutLinkValue to write the current value of VAL.

See Soft Output.




EPICS Record Reference Manual - 19 MAY 1998