op_intrpt_ici()
Abstract
Obtains the ICI associated with the current interrupt.
Syntax
op_intrpt_ici ()
| Argument | Type | Description |
|---|---|---|
| no arguments |
Return Type
Ici*
Pointer to the ICI that is associated with the current interrupt.
The symbolic constant OPC_NIL is returned when there is no ICI associated with the current interrupt of the invoking process.
Example
Excerpt from: example model (models/std/eth_net); process model (eth_mac); function block; function eth_mac_llc_pk_accept().
/* get a handle on the ICI associated with this mac invocation */
iciptr = op_intrpt_ici ();
/* from the ICI, obtain the intended destination address */
op_ici_attr_get (iciptr, “dst_addr”, &dest_addr);
/* create an ethernet frame in which to encapsulate the llc data */
eth_pkptr = op_pk_create_fmt (“ethernet”);
op_pk_nfd_set (eth_pkptr, “data”, llc_pkptr);
/* assign the destination address of the new frame */
op_pk_nfd_set (eth_pkptr, “dst_addr”, dest_addr);
/* assign this station’s address to the source address field */
op_pk_nfd_set (eth_pkptr, “src_addr”, my_address);
Details
Process interrupts carry several types of information with them: the type of interrupt, a flag or code associated with the interrupt, and optionally, an ICI. Obtaining a pointer to an ICI allows the receiving process to extract its contents. If the contents of an ICI have been completely “processed” (i.e., the ICI is no longer of use to the receiving process), then it may be possible to recycle the ICI via the primitive op_ici_destroy(). However, destroying an ICI should only be done if the originating process creates fresh ICI’s for each outgoing interrupt, as opposed to the approach that is sometimes used where a single ICI is installed once and continually reused.
Purpose
Provides a mechanism for a process to obtain a pointer to a received ICI, which is associated with the current interrupt. Once the pointer is obtained, the contents of the ICI can be extracted via a KP such as op_ici_attr_get_dbl().
Errors
No errors are trapped.
Reference
- Use the KP op_ici_create() to create an ICI
- Use the KP op_ici_install() to install an ICI for outgoing interrupts
- Use the KP op_ici_destroy() to deallocate an ICI that has been processed
- Use the KP op_intrpt_type() to determine the type of the current interrupt
- Use the KPs op_ici_attr_get_dbl(), op_ici_attr_get_int32(), op_ici_attr_get_int64(), and op_ici_attr_get_ptr()to obtain the value of an ICI attribute
- Use the KP op_ici_attr_exists() to determine if an ICI contains a particular attribute