![Intel IXP2400 User Manual Download Page 225](http://html1.mh-extra.com/html/intel/ixp2400/ixp2400_user-manual_2071795225.webp)
Development Tools User’s Guide
225
Intel® IXP2400/IXP2800 Network Processors
Foreign Model Simulation Extensions
// by each function so the instance generating the console messages is uniquely
identifiable
// allow room for up to 255 foreign models!
static char *INIT_STRING[255] = {0};
static char *MODEL_NAME[255] = {0};
/*-----------------------------------------------------------------
foreign_model_initialize
This function will be called to initialize the foreign model after
the transactor "init" command has successfully executed. Returning 0
will result in a transactor error.
returns:
uses:
modifies:
*/
int foreign_model_initialize(int model_instance_num, const char *model_name, const
char *init_str)
{
// though we are alocating memory here, it is not deleted later
int len = 1;
if ( init_str != NULL )
len = strlen(in1;
MODEL_NAME[model_instance_num] = new char[len];
if ( init_str != NULL )
strcpy(MODEL_NAME[model_instance_num], model_name);
else
MODEL_NAME[model_instance_num] = 0;
INIT_STRING[model_instance_num] = new char[len];
if ( init_str != NULL )
strcpy(INIT_STRING[model_instance_num], init_str);
else
INIT_STRING[model_instance_num] = 0;
XACT_printf( "(instance_num = %d)(instance_name = %s)(init_str = %s)
foreign_model_initialize called\n",
model_instance_num,
MODEL_NAME[model_instance_num],
INIT_STRING[model_instance_num]
);
return(1);
}
/*-----------------------------------------------------------------
foreign_model_pre_sim
This function will be called prior to each transactor simulation event.
It can be used to deposit state values into the transactor model prior
to simulating the next event. Returning 0 results in an error.
returns: