User`s guide

11 Real-Time Workshop Libraries
11-20
Asynchronous Buffer Block
TheVxWorksDoubleBufferblocksaremeanttobeusedtointerfacesignalsto
asynchronous function-call subsystems in a model. This is needed whenever a
function-call subsystem has input or output signals and its control input
ultimately connects (sources) to the VxWorks Asynchronous Interrupt block or
Task Synchronization block.
Because an asynchronous function-call subsystem can preempt or be
preempted by other model code, an inconsistency arises when more than one
signal element is connected to it. The issue is that signals passed to and/or from
the function-call subsystem can be in the process of being written or read when
the preemption occurs. Thus, partial old and partial new data will be used. The
Double Buffer blocks can be used to guarantee the data passed to and/or from
the function-call subsystem is all from the same iteration.
The Double Buffer blocks are used in pairs, with a write side driving the read
side. To ensure the data integrity, no other connections are allowed between
the two Double Buffer blocks. The pair works by using two buffers (“double
buffering”) to pass the signal and, by using mutually exclusive control, allow
only exclusive access to each buffer. For example, if the write side is currently
writing into one buffer, the read side can only read from the other buffer.
The initial buffer is filled with zeros so that if the read side executes before the
write side has had time to fill the other buffer, the read side will collect zeros
from the initial buffer.