op_intrpt_enable()
Abstract
Re-permits the specified class of interrupt for delivery to the invoking process, for an indefinite period.
Syntax
op_intrpt_enable (type, code)
| Argument | Type | Description |
|---|---|---|
type |
int |
type of interrupts to be enabled. [This is an integer code that specifies the interrupt type, and thus partially defines the class of interrupts to be enabled (see Table 59 “Interrupt Type Symbolic Constants“ on page 15); the possible values of this code are also listed in the Details section.] |
code |
int |
numeric code of interrupts to be enabled [This is a specific integer numeric code which partially defines the class of interrupts to be enabled. This value is compared to the codes associated with disable masks which have been previously defined via the KP op_intrpt_disable().] |
Return Type
void
no return value
Example
Excerpt from: example model (models/std/eth_net); process model (eth_mac); function block.
eth_mac_phys_layer_ignore ()
{
/* enable reception of physical layer events */
op_intrpt_disable (OPC_INTRPT_STAT, DEFERENCE_INSTAT, 0);
op_intrpt_disable (OPC_INTRPT_STAT, COLLISION_DETECT_INSTAT, 0);
op_intrpt_disable (OPC_INTRPT_STAT, TRANSMITTING_INSTAT, 0);
}
eth_mac_phys_layer_listen ()
{
/* enable reception of physical layer events */
op_intrpt_enable (OPC_INTRPT_STAT, DEFERENCE_INSTAT);
op_intrpt_enable (OPC_INTRPT_STAT, COLLISION_DETECT_INSTAT);
op_intrpt_enable (OPC_INTRPT_STAT, TRANSMITTING_INSTAT);
}
Details
The class of interrupts to be enabled is specified by the type of interrupt (e.g., stream interrupts, self interrupts, etc.) and the numeric code associated with the interrupt. The value of the type argument can be taken from one of the following symbolic constants:
- OPC_INTRPT_ACCESS—access interrupt
- OPC_INTRPT_BEGSIM—begin simulation interrupt
- OPC_INTRPT_ENDSIM—end simulation interrupt
- OPC_INTRPT_ESYS_INTERFACE—external system interrupt
- OPC_INTRPT_ESYS_INTERFACE_EXT—external system interrupt (from cosimulator)
- OPC_INTRPT_FAIL—node/link failure interrupt
- OPC_INTRPT_MCAST—multicast interrupt
- OPC_INTRPT_PROCEDURE—procedure interrupt
- OPC_INTRPT_PROCESS—process interrupt
- OPC_INTRPT_RECOVER—node/link recovery interrupt
- OPC_INTRPT_REGULAR—regular interrupt
- OPC_INTRPT_REMOTE—remote interrupt)
- OPC_INTRPT_REMOTE_END_RCV—end of packet arrival at receiver
- OPC_INTRPT_REMOTE_START_RCV—beginning of packet arrival at receiver
- OPC_INTRPT_REMOTE_START_XMT—beginning of packet transmission at transmitter the “split_start_radio_transmission“ preference is TRUE
- OPC_INTRPT_SELF—self interrupt
- OPC_INTRPT_SELF_END_XMT—end of packet transmission at transmitter
- OPC_INTRPT_STAT—statistic interrupt
- OPC_INTRPT_STRM—stream interrupt
The code argument is relevant for the following interrupt types:
- self
- remote
- procedure
- stream (the code represents the affected input stream index)
- statistic wire (the code represents the affected input statistic index)
- access (the code represents the affected output stream index)
- multicast
- process
By default, interrupts of all classes are enabled; they can only be disabled by calls to the related KP, op_intrpt_disable().
Purpose
Provides a mechanism to re-enable a class of interrupts that have been previously disabled via the KP op_intrpt_disable(). Interrupt classes can be consecutively disabled and enabled any number of times. Typically interrupts are re-enabled at the end of an interval of simulation time in which the invoking process was busy performing a task; the interrupts being enabled had been disabled at the beginning of the interval to avoid preemption of the task. Note that disabling a class of interrupts does not cause interrupts of that class to be removed from the event list; it only masks their delivery to the invoking process. Thus if interrupts that have been disabled are then enabled again before their scheduled time of delivery, they will in fact be delivered to the module.
Errors
- Program Abort: KP requires process context.
- Recoverable Error: Interrupt type (
<type>) is unrecognized.
Reference
- Use the KP op_intrpt_disable() to perform the inverse operation and disable a class of interrupts
- Use the KP op_intrpt_enable_all() to enable all classes of interrupts
- Use the KP op_ev_cancel() to cancel a single self interrupt
- Use the KP op_intrpt_clear_self() to cancel all pending self interrupts