Async Interrupt

Generate Versa Module Eurocard (VME) interrupt service routines (ISRs) that are to execute downstream subsystems or Task Sync blocks

Library

Interrupt Templates, VxWorks

Description

For each specified VxWorks VME interrupt level, the Async Interrupt block generates an interrupt service routine (ISR) that calls one of the following:

You can use the block for simulation and code generation.

Parameters

VME interrupt number(s)

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.

VME interrupt vector offset(s)

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),...).

Simulink task priority(s)

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.

Preemption flag(s); preemptable-1; non-preemptable-0

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.

Manage own timer

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.

Timer resolution (seconds)

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.

Timer size

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.

Enable simulation input

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.

Inputs and Outputs

Input

A simulated interrupt source.

Output

Control signal for a

Assumptions and Limitations

Performance Considerations

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.

See Also

Task Sync
Asynchronous Support in the Real-Time Workshop documentation

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS