| Real-Time Workshop® | ![]() |
Generate Versa Module Eurocard (VME) interrupt service routines (ISRs) that are to execute downstream subsystems or Task Sync blocks
Interrupt Templates, VxWorks
For each specified VxWorks VME interrupt level, the Async Interrupt block generates an interrupt service routine (ISR) that calls one of the following:
A function call subsystem
A Task Sync block
A Stateflow® chart configured for a function call input event
You can use the block for simulation and code generation.
An array of VME interrupt numbers for the interrupts to be installed. The valid range is 1..7.
The width of the Async Interrupt block output signal corresponds to the number of VME interrupt numbers specified.
Note A model can contain more than one Async Interrupt block. However, if you use more than one Async Interrupt block, do not duplicate the VME interrupt numbers specified in each block. |
An array of unique interrupt vector offset numbers corresponding to the VME interrupt numbers entered in the VME interrupt number(s) field. The Stateflow software passes the offsets to the VxWorks call intConnect(INUM_TO_IVEC(offset),...).
The Simulink® priority of downstream blocks. Each output of the Async Interrupt block drives a downstream block (for example, a function-call subsystem). Specify an array of priorities corresponding to the VME interrupt numbers you specify for VME interrupt number(s).
The Simulink task priority values are required to generate the proper rate transition code (see Rate Transitions and Asynchronous Blocks in the Real-Time Workshop® documentation). Simulink task priority values are also required to ensure absolute time integrity when the asynchronous task needs to obtain real time from its base rate or its caller. The assigned priorities typically are higher than the priorities assigned to periodic tasks.
Note The Simulink software does not simulate asynchronous task behavior. The task priority of an asynchronous task is for code generation purposes only and is not honored during simulation. |
The value 1 or 0. Set this option to 1 if an output signal of the Async Interrupt block drives a Task Sync block.
Higher priority interrupts can preempt lower priority interrupts in VxWorks. To lock out interrupts during the execution of an ISR, set the preemption flag to 0. This causes generation of intLock() and intUnlock() calls at the beginning and end of the ISR code. Use interrupt locking carefully, as it increases the system's interrupt response time for all interrupts at the intLockLevelSet() level and below. Specify an array of flags corresponding to the VME interrupt numbers entered in the VME interrupt number(s) field.
Note The number of elements in the arrays specifying VME interrupt vector offset(s) and Simulink task priority must match the number of elements in the VME interrupt number(s) array. |
If checked, the ISR generated by the Async Interrupt block manages its own timer by reading absolute time from the hardware timer. Specify the size of the hardware timer with the Timer size option.
The resolution of the ISRs timer. ISRs generated by the Async Interrupt block maintain their own absolute time counters. By default, these timers obtain their values from the VxWorks kernel by using the tickGet call. The Timer resolution field determines the resolution of these counters. The default resolution is 1/60 second. The tickGet resolution for your board support package (BSP) might be different. You should determine the tickGet resolution for your BSP and enter it in the Timer resolution field.
If you are targeting VxWorks, you can obtain better timer resolution by replacing the tickGet call and accessing a hardware timer by using your BSP instead. If you are targeting an RTOS other than VxWorks, you should replace the tickGet call with an equivalent call to the target RTOS, or generate code to read the appropriate timer register on the target hardware. See Using Timers in Asynchronous Tasks and Async Interrupt Block Implementation in the Real-Time Workshop documentation for more information.
The number of bits to be used to store the clock tick for a hardware timer. The ISR generated by the Async Interrupt block uses the timer size when you select Manage own timer. The size can be 32bits (the default), 16bits, 8bits, or auto. If you select auto, the Real-Time Workshop software determines the timer size based on the settings of Application lifespan (days) and Timer resolution.
By default, timer values are stored as 32-bit integers. However, when Timer size is auto, you can indirectly control the word size of the counters by setting the Application lifespan (days) option. If you set Application lifespan (days) to a value that is too large for the code generator to handle as a 32-bit integer of the specified resolution, the code generator uses a second 32-bit integer to address overflows.
For more information, see Controlling Memory Allocation for Time Counters. See also Using Timers in Asynchronous Tasks.
If checked, the Simulink software adds an input port to the Async Interrupt block. This port is for use in simulation only. Connect one or more simulated interrupt sources to the simulation input.
Note Before generating code, consider removing blocks that drive the simulation input to ensure that those blocks do not contribute to the generated code. Alternatively, you can use the Environment Controller block, as explained in Dual-Model Approach: Code Generation. However, if you use the Environment Controller block, be aware that the sample times of driving blocks contribute to the sample times supported in the generated code. |
A simulated interrupt source.
Control signal for a
Function-call subsystem
Task Sync block
Stateflow chart configured for a function call input event
The block supports VME interrupts 1 through 7.
The block requires a VxWorks Board Support Package (BSP) that supports the following VxWorks system calls:
| sysIntEnable |
| sysIntDisable |
| intConnect |
| intLock |
| intUnlock |
| tickGet |
Execution of large subsystems at interrupt level can have a significant impact on interrupt response time for interrupts of equal and lower priority in the system. As a general rule, it is best to keep ISRs as short as possible. Connect only function-call subsystems that contain a small number of blocks to an Async Interrupt block.
A better solution for large subsystems is to use the Task Sync block to synchronize the execution of the function-call subsystem to a VxWorks task. Place the Task Sync block between the Async Interrupt block and the function-call subsystem. The Async Interrupt block then uses the Task Sync block as the ISR. The ISR releases a synchronization semaphore (performs a semGive) to the task, and returns immediately from interrupt level. VxWorks then schedules and runs the task. See the description of the Task Sync block for more information.
Task Sync
Asynchronous Support in
the Real-Time Workshop documentation
![]() | Blocks — Alphabetical List | Model Header | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |