op_intrpt_stat()
Abstract
Obtains the input statistic index associated with the current interrupt of the invoking process.
Syntax
op_intrpt_stat ()
| Argument | Type | Description |
|---|---|---|
| no arguments |
Return Type
int
Index of the input statistic associated with the current interrupt.
[This value is determined by the statistic-related event due to an invocation of the KPs op_stat_write() or op_stat_write_t() by a process, or due to the automatic updating of a statistic by a module.]
Example
Excerpt from: example model (models/std/eth_net); process model (eth_defer); header block.
/* macros for state-transitions */
#define FRAME_WAITING (op_stat_local_read (FRAME_WAITING_INSTAT) == 1.0
#define FRAME_WAITING_LOW (op_intrpt_stat () == FRAME_WAITING_INSTAT && \
!FRAME_WAITING)
#define CHANNEL_BUSY (op_stat_local_read (CARRIER_SENSE_INSTAT) == 1.0)
#define BUSY_HIGH (op_intrpt_stat () == CARRIER_SENSE_INSTAT && \
CHANNEL_BUSY)
#define BUSY_LOW (op_intrpt_stat () == CARRIER_SENSE_INSTAT && \
!CHANNEL_BUSY)
Details
This KP will only produce a valid result when invoked after an interrupt that is associated with an input statistic. The only type of interrupt which meets this restriction is the statistic interrupt.
Purpose
Provides a mechanism for determining which input statistic caused the interrupt at the invoking process. This is necessary when more than one statistic wire is feeding into a processor or queue, and the triggering statistic wire must be determined before a call to the KP op_stat_local_read() can be made.
Errors
- Program Abort: KP requires process context.
- Recoverable Error: Current event is not a statistic interrupt.
Reference
- Use the KP op_intrpt_type() to determine the type of the current interrupt
- Use the KP op_intrpt_code() to determine the numeric code associated with the current interrupt
- Use the KP op_intrpt_strm() to determine the stream index associated with a stream interrupt
- Use the KP op_intrpt_ici() to obtain the ICI associated with the current interrupt
- Use the KP op_stat_write() or op_stat_write_t() to update the value of an output statistic
- Use the KP op_stat_local_read() to read the value of an input statistic