I have a set of mbboDirect records using asynchronous device support to
access a hardware register in which the individual bits control power
switches. I need to automatically initialize the VAL field of the mbboDirect
record at IOC reboot time to the contents of the hardware register.
This is an example of the not uncommon read-modify-write (RWM) problem in
which sub-groups of bits in a hardware register must be modified without
affecting the values of the remaining bits. This particular instance is
complicated by the asynchronous nature of the hardware access protocol which
does not allow an instantaneous read of the current value of the register.
I could finesse the problem by modifying (1) our driver support package
(for the MIL/STD1553B bus) to implement a RMW at the interrupt service
routine level (the interrupt action for the read operation would modify the
just-read value and initiate a write of the modified value, leading to a
second interrupt that completes the driver operation) or (2) our device
support package so that the RMW is achieved through a state machine that
steps from the "read" state to the "write" state with successive callbacks
from the driver. The former would be "atomic" while the latter would not.
Can anyone suggest how the existing features of EPICS records might be
used to initialize the mmboRecord - i.e. an automatic, one-time operation at
reboot?
Fritz