Line 37... |
Line 37... |
int flags;
|
int flags;
|
} sections[];
|
} sections[];
|
|
|
void init_defconfig()
|
void init_defconfig()
|
{
|
{
|
unsigned long val;
|
int i;
|
|
|
memset(&config, 0, sizeof(config));
|
memset(&config, 0, sizeof(config));
|
memset(&runtime, 0, sizeof(runtime));
|
memset(&runtime, 0, sizeof(runtime));
|
/* Sim */
|
/* Sim */
|
config.sim.exe_log = 0;
|
config.sim.exe_log = 0;
|
Line 60... |
Line 60... |
|
|
/* Memory */
|
/* Memory */
|
config.memory.type = MT_PATTERN;
|
config.memory.type = MT_PATTERN;
|
config.memory.pattern = 0;
|
config.memory.pattern = 0;
|
config.memory.random_seed = -1; /* Generate new seed */
|
config.memory.random_seed = -1; /* Generate new seed */
|
strcpy(config.memory.memory_table_file, "simmem.cfg");
|
for (i = 0; i < MAX_MEMORIES; i++) {
|
|
config.memory.table[i].ce = -1; /* memory is disabled by default */
|
|
runtime.memory.table[i].log = NULL;
|
|
}
|
|
|
/* Memory Controller */
|
/* Memory Controller */
|
config.mc.enabled = 0;
|
config.mc.enabled = 0;
|
|
|
/* Uarts */
|
/* Uarts */
|
Line 248... |
Line 251... |
else
|
else
|
printf("BTIC simulation off.\n");
|
printf("BTIC simulation off.\n");
|
}
|
}
|
}
|
}
|
|
|
|
/* Forward declarations of functions */
|
void change_device ();
|
void change_device ();
|
void end_device ();
|
void end_device ();
|
|
void uart_nuarts ();
|
void uart_baseaddr ();
|
void uart_baseaddr ();
|
void uart_rxfile ();
|
void uart_rxfile ();
|
void uart_txfile ();
|
void uart_txfile ();
|
void uart_jitter ();
|
void uart_jitter ();
|
void uart_irq ();
|
void uart_irq ();
|
void uart_16550 ();
|
void uart_16550 ();
|
void uart_vapi_id ();
|
void uart_vapi_id ();
|
|
void dma_ndmas ();
|
void dma_baseaddr ();
|
void dma_baseaddr ();
|
void dma_irq ();
|
void dma_irq ();
|
void dma_vapi_id ();
|
void dma_vapi_id ();
|
void memory_type ();
|
void memory_type ();
|
|
void memory_nmemories ();
|
|
void memory_ce ();
|
|
void memory_baseaddr ();
|
|
void memory_size ();
|
|
void memory_name ();
|
|
void memory_log ();
|
|
void memory_delayr ();
|
|
void memory_delayw ();
|
|
void eth_nethernets ();
|
void eth_baseaddr ();
|
void eth_baseaddr ();
|
void eth_dma ();
|
void eth_dma ();
|
void eth_rx_channel ();
|
void eth_rx_channel ();
|
void eth_tx_channel ();
|
void eth_tx_channel ();
|
void eth_rxfile ();
|
void eth_rxfile ();
|
Line 306... |
Line 321... |
{1, 0, "enabled", "=%i", NULL, (void *)(&config.mc.enabled)},
|
{1, 0, "enabled", "=%i", NULL, (void *)(&config.mc.enabled)},
|
{1, 0, "baseaddr", "=0x%x", NULL, (void *)(&config.mc.baseaddr)},
|
{1, 0, "baseaddr", "=0x%x", NULL, (void *)(&config.mc.baseaddr)},
|
{1, 0, "POC", "=0x%x", NULL, (void *)(&config.mc.POC)},
|
{1, 0, "POC", "=0x%x", NULL, (void *)(&config.mc.POC)},
|
|
|
{2, 0, "enabled", "=%i", NULL, (void *)(&config.uarts_enabled)},
|
{2, 0, "enabled", "=%i", NULL, (void *)(&config.uarts_enabled)},
|
{2, 0, "nuarts", "=%i", NULL, (void *)(&config.nuarts)},
|
{2, 0, "nuarts", "=%i", uart_nuarts, (void *)(&tempL)},
|
{2, 0, "device", "%i", change_device, (void *)(&tempL)},
|
{2, 0, "device", "%i", change_device, (void *)(&tempL)},
|
{2, 0, "enddevice", "", end_device, NULL},
|
{2, 0, "enddevice", "", end_device, NULL},
|
{2, 0, "baseaddr", "=0x%x", uart_baseaddr, (void *)(&tempUL)},
|
{2, 0, "baseaddr", "=0x%x", uart_baseaddr, (void *)(&tempUL)},
|
{2, 0, "irq", "=%i", uart_irq, (void *)(&tempL)},
|
{2, 0, "irq", "=%i", uart_irq, (void *)(&tempL)},
|
{2, 0, "16550", "=%i", uart_16550, (void *)(&tempL)},
|
{2, 0, "16550", "=%i", uart_16550, (void *)(&tempL)},
|
Line 318... |
Line 333... |
{2, 0, "rxfile", "=\"%s\"", uart_rxfile, (void *)(&tempS[0])},
|
{2, 0, "rxfile", "=\"%s\"", uart_rxfile, (void *)(&tempS[0])},
|
{2, 0, "txfile", "=\"%s\"", uart_txfile, (void *)(&tempS[0])},
|
{2, 0, "txfile", "=\"%s\"", uart_txfile, (void *)(&tempS[0])},
|
{2, 0, "vapi_id", "=0x%x", uart_vapi_id, (void *)(&tempUL)},
|
{2, 0, "vapi_id", "=0x%x", uart_vapi_id, (void *)(&tempUL)},
|
|
|
{3, 0, "enabled", "=%i", NULL, (void *)(&config.dmas_enabled)},
|
{3, 0, "enabled", "=%i", NULL, (void *)(&config.dmas_enabled)},
|
{3, 0, "ndmas", "=%i", NULL, (void *)(&config.ndmas)},
|
{3, 0, "ndmas", "=%i", dma_ndmas, (void *)(&tempL)},
|
{3, 0, "device", "%i", change_device, (void *)(&tempL)},
|
{3, 0, "device", "%i", change_device, (void *)(&tempL)},
|
{3, 0, "enddevice", "", end_device, NULL},
|
{3, 0, "enddevice", "", end_device, NULL},
|
{3, 0, "baseaddr", "=0x%x", dma_baseaddr, (void *)(&tempUL)},
|
{3, 0, "baseaddr", "=0x%x", dma_baseaddr, (void *)(&tempUL)},
|
{3, 0, "irq", "=%i", dma_baseaddr, (void *)(&tempL)},
|
{3, 0, "irq", "=%i", dma_baseaddr, (void *)(&tempL)},
|
{3, 0, "vapi_id", "=0x%x", dma_vapi_id, (void *)(&tempUL)},
|
{3, 0, "vapi_id", "=0x%x", dma_vapi_id, (void *)(&tempUL)},
|
|
|
{4, 0, "memory_table_file", "=\"%s\"", NULL, (void *)(&config.memory.memory_table_file[0])},
|
|
{4, 0, "random_seed", "=%i", NULL, (void *)(&config.memory.random_seed)},
|
{4, 0, "random_seed", "=%i", NULL, (void *)(&config.memory.random_seed)},
|
{4, 0, "pattern", "=%i", NULL, (void *)(&config.memory.pattern)},
|
{4, 0, "pattern", "=%i", NULL, (void *)(&config.memory.pattern)},
|
{4, 0, "type", "=%s ", memory_type, (void *)(&tempS[0])},
|
{4, 0, "type", "=%s ", memory_type, (void *)(&tempS[0])},
|
|
{4, 0, "nmemories", "=%i", memory_nmemories,(void *)(&tempL)},
|
|
{4, 0, "device", "%i", change_device, (void *)(&tempL)},
|
|
{4, 0, "enddevice", "", end_device, NULL},
|
|
{4, 0, "ce", "=%i", memory_ce, (void *)(&tempL)},
|
|
{4, 0, "baseaddr", "=0x%x", memory_baseaddr,(void *)(&tempUL)},
|
|
{4, 0, "size", "=0x%x", memory_size, (void *)(&tempUL)},
|
|
{4, 0, "name", "=%s ", memory_name, (void *)(&tempS[0])},
|
|
{4, 0, "log", "=%s ", memory_log, (void *)(&tempS[0])},
|
|
{4, 0, "delayr", "=%i", memory_delayr, (void *)(&tempL)},
|
|
{4, 0, "delayw", "=%i", memory_delayw, (void *)(&tempL)},
|
|
|
{5, 0, "ver", "=0x%x", NULL, (void *)(&config.cpu.ver)},
|
{5, 0, "ver", "=0x%x", NULL, (void *)(&config.cpu.ver)},
|
{5, 0, "rev", "=0x%x", NULL, (void *)(&config.cpu.rev)},
|
{5, 0, "rev", "=0x%x", NULL, (void *)(&config.cpu.rev)},
|
{5, 0, "upr", "=0x%x", NULL, (void *)(&config.cpu.upr)},
|
{5, 0, "upr", "=0x%x", NULL, (void *)(&config.cpu.upr)},
|
{5, 0, "hazards", "=%i", NULL, (void *)(&config.cpu.hazards)},
|
{5, 0, "hazards", "=%i", NULL, (void *)(&config.cpu.hazards)},
|
Line 360... |
Line 384... |
{8, 0, "log_enabled", "=%i", NULL, (void *)(&config.vapi.log_enabled)},
|
{8, 0, "log_enabled", "=%i", NULL, (void *)(&config.vapi.log_enabled)},
|
{8, 0, "log_device_id", "=%i", NULL, (void *)(&config.vapi.log_device_id)},
|
{8, 0, "log_device_id", "=%i", NULL, (void *)(&config.vapi.log_device_id)},
|
{8, 0, "vapi_log_fn", "=\"%s\"", NULL, (void *)(&config.vapi.vapi_fn[0])},
|
{8, 0, "vapi_log_fn", "=\"%s\"", NULL, (void *)(&config.vapi.vapi_fn[0])},
|
|
|
{9, 0, "enabled", "=%i", NULL, (void *)(&config.ethernets_enabled)},
|
{9, 0, "enabled", "=%i", NULL, (void *)(&config.ethernets_enabled)},
|
{9, 0, "nethernets", "=%i", NULL, (void *)(&config.nethernets)},
|
{9, 0, "nethernets", "=%i", eth_nethernets,(void *)(&tempL)},
|
{9, 0, "device", "%i", change_device, (void *)(&tempL)},
|
{9, 0, "device", "%i", change_device, (void *)(&tempL)},
|
{9, 0, "enddevice", "", end_device, NULL},
|
{9, 0, "enddevice", "", end_device, NULL},
|
{9, 0, "baseaddr", "=0x%x", eth_baseaddr, (void *)(&tempUL)},
|
{9, 0, "baseaddr", "=0x%x", eth_baseaddr, (void *)(&tempUL)},
|
{9, 0, "dma", "=%i", eth_dma, (void *)(&tempL)},
|
{9, 0, "dma", "=%i", eth_dma, (void *)(&tempL)},
|
{9, 0, "rx_channel", "=%i", eth_rx_channel,(void *)(&tempL)},
|
{9, 0, "rx_channel", "=%i", eth_rx_channel,(void *)(&tempL)},
|
Line 386... |
Line 410... |
|
|
void end_device () {
|
void end_device () {
|
current_device = -1;
|
current_device = -1;
|
}
|
}
|
|
|
|
void uart_nuarts () {
|
|
if (tempL >= 0 && tempL < MAX_UARTS)
|
|
config.nuarts = tempL;
|
|
else
|
|
ERROR("invalid number of devices.");
|
|
}
|
|
|
void uart_baseaddr () {
|
void uart_baseaddr () {
|
if (current_device >= 0 && current_device < config.nuarts)
|
if (current_device >= 0 && current_device < config.nuarts)
|
config.uarts[current_device].baseaddr = tempUL;
|
config.uarts[current_device].baseaddr = tempUL;
|
else
|
else
|
ERROR("invalid device number.");
|
ERROR("invalid device number.");
|
Line 435... |
Line 466... |
config.uarts[current_device].vapi_id = tempUL;
|
config.uarts[current_device].vapi_id = tempUL;
|
else
|
else
|
ERROR("invalid device number.");
|
ERROR("invalid device number.");
|
}
|
}
|
|
|
|
void dma_ndmas () {
|
|
if (tempL >= 0 && tempL < MAX_DMAS)
|
|
config.ndmas = tempL;
|
|
else
|
|
ERROR("invalid number of devices.");
|
|
}
|
|
|
void dma_baseaddr () {
|
void dma_baseaddr () {
|
if (current_device >= 0 && current_device < config.ndmas)
|
if (current_device >= 0 && current_device < config.ndmas)
|
config.dmas[current_device].baseaddr = tempUL;
|
config.dmas[current_device].baseaddr = tempUL;
|
else
|
else
|
ERROR("invalid device number.");
|
ERROR("invalid device number.");
|
Line 456... |
Line 494... |
config.dmas[current_device].vapi_id = tempUL;
|
config.dmas[current_device].vapi_id = tempUL;
|
else
|
else
|
ERROR("invalid device number.");
|
ERROR("invalid device number.");
|
}
|
}
|
|
|
|
void memory_nmemories () {
|
|
if (tempL >= 0 && tempL < MAX_MEMORIES)
|
|
config.memory.nmemories = tempL;
|
|
else
|
|
ERROR("invalid number of devices.");
|
|
}
|
|
|
void memory_type () {
|
void memory_type () {
|
if (strcmp (tempS, "unknown") == 0)
|
if (strcmp (tempS, "unknown") == 0)
|
config.memory.type = MT_UNKNOWN;
|
config.memory.type = MT_UNKNOWN;
|
else if (strcmp (tempS, "random") == 0)
|
else if (strcmp (tempS, "random") == 0)
|
config.memory.type = MT_RANDOM;
|
config.memory.type = MT_RANDOM;
|
Line 473... |
Line 518... |
sprintf (tmp, "invalid memory type '%s'.\n", tempS);
|
sprintf (tmp, "invalid memory type '%s'.\n", tempS);
|
ERROR(tmp);
|
ERROR(tmp);
|
}
|
}
|
}
|
}
|
|
|
|
void memory_ce () {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
config.memory.table[current_device].ce = tempL;
|
|
else
|
|
ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_baseaddr () {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
config.memory.table[current_device].baseaddr = tempUL;
|
|
else
|
|
ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_size () {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
config.memory.table[current_device].size = tempUL;
|
|
else
|
|
ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_name () {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
strcpy (config.memory.table[current_device].name, tempS);
|
|
else
|
|
ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_log () {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
strcpy (config.memory.table[current_device].log, tempS);
|
|
else
|
|
ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_delayr () {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
config.memory.table[current_device].delayr = tempL;
|
|
else
|
|
ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_delayw () {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
config.memory.table[current_device].delayw = tempL;
|
|
else
|
|
ERROR("invalid device number.");
|
|
}
|
|
|
|
void eth_nethernets () {
|
|
if (tempL >= 0 && tempL < MAX_ETHERNETS)
|
|
config.nethernets = tempL;
|
|
else
|
|
ERROR("invalid number of devices.");
|
|
}
|
|
|
void eth_baseaddr () {
|
void eth_baseaddr () {
|
if (current_device >= 0 && current_device < config.nethernets)
|
if (current_device >= 0 && current_device < config.nethernets)
|
config.ethernets[current_device].baseaddr = tempUL;
|
config.ethernets[current_device].baseaddr = tempUL;
|
else
|
else
|
ERROR("invalid device number.");
|
ERROR("invalid device number.");
|
Line 620... |
Line 721... |
if (config_params[found].func)
|
if (config_params[found].func)
|
config_params[found].func();
|
config_params[found].func();
|
}
|
}
|
}
|
}
|
fclose (f);
|
fclose (f);
|
|
runtime.sim.script_file_specified = 1;
|
} else
|
} else
|
if (config.sim.verbose)
|
if (config.sim.verbose)
|
fprintf (stderr, "WARNING: Cannot read script file from '%s',\nneither '%s'; assuming standard configuration.\n", filename, ctmp);
|
fprintf (stderr, "WARNING: Cannot read script file from '%s',\nneither '%s'.\n", filename, ctmp);
|
|
|
/* Initialize memory table. */
|
|
sim_read_memory_table (config.memory.memory_table_file);
|
|
runtime.sim.script_file_specified = 1;
|
|
}
|
}
|
|
|
/* Utility for execution of set sim command. */
|
/* Utility for execution of set sim command. */
|
static int set_config (char *s)
|
static int set_config (char *s)
|
{
|
{
|