Real-Time Workshop User's Guide    

Asynchronous Buffer Block

The VxWorks Asynchronous Buffer blocks are meant to be used to interface signals to 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.

This situation can also occur with scalar signals in some cases. For example, if a signal is a double (8 bytes), the read or write operation may require two assembly instructions.

The Asynchronous 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 Asynchronous 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 Asynchronous 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.

Asynchronous Buffer Block Parameters

There are two kinds of Asynchronous Buffer blocks, a reader and a writer. The picture below shows the Asynchronous Buffer block's dialog boxes.

Both blocks require the Sample Time parameter. The sample time should be set to -1 inside a function call and to the desired time otherwise.

Asynchronous Buffer Block Example

This example shows how you might use the Asynchronous Buffer block to control the data flow in an interrupt service routine.

The ISR0 subsystem block, which is configured as a function-call subsystem, contains another set of Asynchronous Buffer blocks.


 Task Synchronization Block Rate Transition Block