Example #1
0
static void
cleanup( void )
{
    cfi_array_free( cfi_array );
    cfi_array = NULL;

    if (bus) {
        bus_free( bus );
        bus = NULL;
    }
    chain_free( chain );
    chain = NULL;
}
Example #2
0
bool cache_controller_none_t::can_schedule_downstream(struct cache_t * const prev_cache)
{
  return (!prev_cache || bus_free(prev_cache->next_bus));
}
Example #3
0
bool cache_controller_none_t::can_schedule_upstream()
{
  if (cache->next_level)
    return (!cache->next_bus || bus_free(cache->next_bus));
  return bus_free(uncore->fsb);
}
Example #4
0
/*
 * In this function, you should perform any actions that are necessary
 * at the termination of a simulation.  For example, if memory was
 * allocated in mdlStart, this is the place to free it.
 */
static void mdlTerminate (SimStruct *S)
{
	bus_t *c = (bus_t*) ssGetPWorkValue(S,0);

	bus_free (c);
}
Example #5
0
static int
cmd_cable_run( chain_t *chain, char *params[] )
{
	cable_t *cable;
	int i;
	int paramc = cmd_params( params );

	/* we need at least one parameter for 'cable' command */
	if (paramc < 2) return -1;

	/* maybe old syntax was used?  search connection type driver */
	for (i = 0; parport_drivers[i]; i++)
		if (strcasecmp( params[1], parport_drivers[i]->type ) == 0)
			break;

	if (parport_drivers[i] != 0)
	{
		/* Old syntax was used. Swap params. */
		printf( _("Note: the 'cable' command syntax changed, please read the help text\n") );
		if (paramc >= 4)
		{
			char *tmparam;
			tmparam = params[3];
			params[3] = params[2];
			params[2] = params[1];
			params[1] = tmparam;
		}
		else
			return -1;
	}

	/* search cable driver list */
	for (i = 0; cable_drivers[i]; i++)
		if (strcasecmp( params[1], cable_drivers[i]->name ) == 0)
			break;
	if (!cable_drivers[i]) {
		printf( _("Unknown cable type: %s\n"), params[1] );
		return 1;
	}

	if (paramc >= 3)
	{
		if (strcasecmp( params[2], "help" ) == 0)
		{
			cable_drivers[i]->help(cable_drivers[i]->name);
			return 1;
		}
	}

	if (bus) {
		bus_free( bus );
		bus = NULL;
	}

	chain_disconnect( chain );

	cable = calloc(1, sizeof(cable_t) );
	if (!cable) {
	  printf( _("%s(%d) malloc failed!\n"), __FILE__, __LINE__);
	  return 1;
	}

	cable->driver = cable_drivers[i];

	if ( cable->driver->connect( ++params, cable ) ) {
		printf( _("Error: Cable connection failed!\n") );
		free( cable );
		return 1;
	}

	chain->cable = cable;

	if (cable_init( chain->cable )) {
		printf( _("Error: Cable initialization failed!\n") );
		chain_disconnect( chain );
		return 1;
	}
	chain_set_trst( chain, 0 );
	chain_set_trst( chain, 1 );
	tap_reset( chain );

	return 1;
}