op_intrpt_disable()
Abstract
Prohibits the specified class of interrupts from being delivered to the invoking process, either for an indefinite period or just for the next occurrence of such an interrupt.
Syntax
op_intrpt_disable (type, code, next)
| Argument | Type | Description |
|---|---|---|
type |
int |
type of interrupts to be disabled [This is an integer code that specifies the interrupt type, and thus partially defines the class of interrupts to be disabled (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 disabled [This is a specific integer numeric code which partially defines the class of interrupts to be disabled. This value is compared to different kinds of codes associated with incoming interrupts.] |
next |
Boolean |
Boolean flag (i.e., OPC_TRUE or OPC_FALSE) indicating the disabling mode. [This flag should be set to OPC_TRUE to disable only the next interrupt of the specified class; it should be set to OPC_FALSE to disable interrupts of the specified class indefinitely.] |
Return Type
void
no return value
Example
Excerpt from: example model (models/std/eth_net); process model (eth_defer); state (SPACING); enter execs.
/* schedule an interrupt to mark the end of the */
/* inter-frame gap */
op_intrpt_schedule_self (op_sim_time () + INTERFRAME_SPACING, 0);
/* during the inter-frame gap, ignore all statistic wire interrupts */
op_intrpt_disable (OPC_INTRPT_STAT, FRAME_WAITING_INSTAT, OPC_FALSE);
op_intrpt_disable (OPC_INTRPT_STAT, CARRIER_SENSE_INSTAT, OPC_FALSE);
Details
The class of interrupts to be disabled 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
The next flag indicates whether to disable the class of interrupts for an indefinite period, or just for the next occurrence. By default, interrupts of all classes are enabled. Interrupts that are disabled are discarded as they occur, not queued, and are never delivered to the target process.
Purpose
Provides a mechanism to ignore interrupts at the current module. For instance, disabling is useful when modeling that a processor is busy executing a task for an interval of time: when the interval begins, the process will schedule a self interrupt for the end of the interval, and disable all the interrupts that it normally expects to receive. When the interval ends, the process will enable all of the disabled interrupts with a single invocation of the KP op_intrpt_enable_all() or a sequence of invocations of the KP op_intrpt_enable().
Errors
- Program Abort: Allocation of memory failed. (due to insufficient memory to hold disabling information)
- Program Abort: KP requires process context.
- Recoverable Error: Interrupt type (
<type>) is unrecognized.
Reference
- Use the KP op_intrpt_enable() to perform the inverse operation and enable 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 interrupt
- Use the KP op_intrpt_clear_self() to cancel all pending self interrupts