Next: , Previous: , Up: Instruction Class Set Definition   [Contents][Index]


4.4.3 Registering the Function

Use the following macro to register the event handler function of an instruction class set.

Macro: QSMM_REG_INSTR_CLASS_SET (model, instr_class_set_name, paramp)

This macro registers instruction class set instr_class_set_name for a multinode model specified by handle model. That instruction class set represented by its event handler function should be previously defined by the macro QSMM_INSTR_CLASS_SET. Parameter paramp will be passed as the value of argument qsmm_param_p of this event handler function on events QSMM_EVT_ENT_INIT, QSMM_EVT_ENT_DONE, QSMM_EVT_ENGINE_INIT, and QSMM_EVT_ENGINE_DONE.

This macro is expanded to:

qsmm_reg_instr_class_set((model), #instr_class_set_name,
                         &instr_class_set_name, (paramp))

Below is the description of a function called by the macro QSMM_REG_INSTR_CLASS_SET.

Function: int qsmm_reg_instr_class_set (qsmm_t model, const char *instr_class_set_name, qsmm_instr_class_set_func_t instr_class_set_func, void *paramp)

This function registers instruction class set instr_class_set_name for a multinode model specified by handle model. Function instr_class_set_func will be used as the event handler function of this instruction class set. Parameter paramp will be passed as the value of argument qsmm_param_p of that event handler function on events QSMM_EVT_ENT_INIT, QSMM_EVT_ENT_DONE, QSMM_EVT_ENGINE_INIT, and QSMM_EVT_ENGINE_DONE.

After registering the instruction class set, the function qsmm_reg_instr_class_set sends event QSMM_EVT_ENT_INIT to the event handler function of that instruction class set. At this point, the latter function can perform initialization of that instruction class set.

The function returns a non-negative value on success or a negative error code on failure. Currently, the following error codes can be returned.

QSMM_ERR_UNTIMELY

The model instance already exists, so changing model structure is not allowed.

QSMM_ERR_EXIST

An instruction class set or instruction meta-class named instr_class_set_name is already registered.

QSMM_ERR_NOMEM

There was not enough memory to perform the operation.

Use the following function to get a pointer to the event handler function of an instruction class set and a user parameter passed to that function in certain cases.

Function: int qsmm_get_instr_class_set_handler (qsmm_t model, const char *instr_class_set_name, qsmm_instr_class_set_func_t *instr_class_set_func_p, void **param_pp)

This function retrieves parameters associated with the event handler function of instruction class set instr_class_set_name registered for a multinode model specified by handle model. If instr_class_set_func_p is not NULL, then *instr_class_set_func_p will be set to a pointer to this event handler function. If param_pp is not NULL, then *param_pp will be set to the value of argument qsmm_param_p of this event handler function passed on events QSMM_EVT_ENT_INIT, QSMM_EVT_ENT_DONE, QSMM_EVT_ENGINE_INIT, and QSMM_EVT_ENGINE_DONE.

The function returns a non-negative value on success or a negative error code on failure. Currently, the following error codes can be returned.

QSMM_ERR_NOTFOUND

Instruction class set instr_class_set_name is not found.

QSMM_ERR_TYPE

An entity named instr_class_set_name is not an instruction class set. The entity is an instruction meta-class.

QSMM_ERR_NOMEM

There was not enough memory to perform the operation.


Next: , Previous: , Up: Instruction Class Set Definition   [Contents][Index]