Esa_Interface_Callback_Register()
Abstract
Registers a callback to be invoked when model code assigns a value to the specified interface.
Syntax
Esa_Interface_Callback_Register (esa_state_ptr, status_ptr, interface, proc, array_proc, state_ptr)
| Argument | Type | Description |
|---|---|---|
esa_state_ptr |
EsaT_State_Handle |
ESA state information generated by Esa_Init(). |
status_ptr |
int * |
status value indicating cause of error (when return value is EsaC_Comp_Failure); one of the values in Table 2 External Simulation Access Package Symbolic Constants. |
interface |
EsaT_Interface |
interface of interest |
proc |
EsaT_Interface_Callback_Proc |
function invoked when the specified interface is assigned to using the non-array form. |
array_proc |
EsaT_Interface_Array_Callback_Proc |
function invoked when the specified interface is assigned to as part of an array. |
state_ptr |
void * |
client data passed to the proc and array_proc functions when they are invoked. |
Return Type
EsaT_Compcode
EsaC_Comp_Success if registration successful; EsaC_Comp_Failure otherwise.
Header
esa.h
Details
Model code sets interface values using op_esys_interface_value_set(), op_esys_interface_array_set(), or op_esys_interface_vector_set(). If callbacks have been registered with the interface in question, one will be invoked as soon as the value is set using one of these KPs, enabling external code to immediately process the information. If no callbacks are registered, the interface value must be polled by the cosimulation code after Esa_Execute_Until() returns.
There are two possible callbacks:
- The
proccallback is invoked if the interface is assigned individually, usingop_esys_interface_value_set(). Theprocfunction prototype is described inEsaT_Interface_Callback_Proc. - The
array_proccallback is invoked if the interface is assigned as part of an array, usingop_esys_interface_array_set()orop_esys_interface_vector_set(). Thearray_procfunction prototype is described inEsaT_Interface_Array_Callback_Proc.