ERP CANoe Interface : Module Interface Code

Module Interface Code

When you use the CANoe environment, Rational Statemate generates module interface code in the module file. The C macros used are defined in the stmm.h header file. The macro calls create an array that defines the mapping between a Rational Statemate model element and the CANoe environment, which is accessible by CANoe at run time. Note that the init_module() and exec_module() functions are called by CANoe.

The module interface code is as follows:

/******* CANoe interface code *******/
#include "private\stmm.h"
sw_module_ptr MODULE_HANDLE = 0;
condition stm_BREAK_PADDLE;
real stm_SPEED;
 
CN_ENVIRONMENT_MAP_BEGIN()
CN_ENVIRONMENT_ENTRY(&stm_BREAK_PADDLE,
el_condition, STM_OUT_MAP, "EnvBreakActive")
CN_ENVIRONMENT_ENTRY(&stm_SPEED, el_real,
STM_IN_MAP, "EnvDashboardEngSpeedDsp_")
CN_ENVIRONMENT_MAP_END()
 
void init_module()
{
speed_init_module(&MODULE_HANDLE,
&stm_BREAK_PADDLE, &stm_SPEED);
}
 
sw_module_status exec_module()
{
return speed_exec(MODULE_HANDLE, 1);
}