User`s guide
11 Real-Time Workshop Libraries
11-16
Locking and Unlocking ISRs. It is possible to lock ISRs so that they are not
preempted by a higher priority interrupt. Configuring the interrupt as
nonpreemptive has this effect. This code shows where the Real-Time Workshop
places the
int_lock and int_unlock functions to configure the interrupt as
nonpreemptive:
Finally, the model’s terminate function disables the interrupt:
/* model terminate function */
MdlTerminate()
{
...
int_disable(1);
...
}
Task Synchronization Block
The VxWorks Task Synchronization block is a function-call subsystem that
spawns, as an independent VxWorks task, the function-call subsystem
connected to its output. It is meant to be placed between two other function-call
subsytems. Typically it would be placed between the VxWorks Asynchronous
Interrupt block and a function-call subsystem block or a Stateflow chart.
Another example would be to place the Task Synchronization block at the
output of a Stateflow diagram that has an Event “Output to Simulink”
configured as a function-call. The VxWorks Task Synchronization block
performs the following functions:
• The downstream function-call subsystem is spawned as an independent task
using the VxWorks system call
taskSpawn(). The task is deleted using
taskDelete() during model termination.
Real-Time Workshop code
f()
{
lock = int_lock();
. . .
. . .
. . .
int_unlock(lock);
}