📄 info.c
字号:
/* pci_busfreq_string( msg, wdata ); */
strcat( msg, "\n" );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
return TRUE;
}
/************************************************************************
* info_mem
************************************************************************/
static bool
info_mem( void )
{
char msg[80];
UINT32 wdata;
/* System Flash base */
if(SYSCON_read( SYSCON_BOARD_SYSTEMFLASH_BASE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("System flash phys base =" )) return FALSE;
sprintf( msg, "0x%08x\n", PHYS(wdata) );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* System Flash size */
if(SYSCON_read( SYSCON_BOARD_SYSTEMFLASH_SIZE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("System flash size =" )) return FALSE;
sprintf( msg, "0x%08x\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* Monitor Flash base */
if(SYSCON_read( SYSCON_BOARD_MONITORFLASH_BASE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("Monitor flash phys base =" )) return FALSE;
sprintf( msg, "0x%08x\n", PHYS(wdata) );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* Monitor Flash size */
if(SYSCON_read( SYSCON_BOARD_MONITORFLASH_SIZE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("Monitor flash size =" )) return FALSE;
sprintf( msg, "0x%08x\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* Environment Flash base */
if(SYSCON_read( SYSCON_BOARD_FILEFLASH_BASE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("Env. flash phys base =" )) return FALSE;
sprintf( msg, "0x%08x\n", PHYS(wdata) );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* Environment Flash size */
if(SYSCON_read( SYSCON_BOARD_FILEFLASH_SIZE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("Env. flash size =" )) return FALSE;
sprintf( msg, "0x%08x\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* System RAM base */
if(SYSCON_read( SYSCON_BOARD_SYSTEMRAM_BASE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("\nSDRAM phys base =" )) return FALSE;
sprintf( msg, "0x%08x\n", PHYS(wdata) );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* System RAM size */
if(SYSCON_read( SYSCON_BOARD_SYSTEMRAM_ACTUAL_SIZE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("SDRAM size =" )) return FALSE;
sprintf( msg, "0x%08x\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* System RAM refresh interval */
if(SYSCON_read( SYSCON_BOARD_SYSTEMRAM_REFRESH_CYCLES_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("SDRAM refresh interval =" )) return FALSE;
sprintf( msg, "%d cycles\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* CAS latency */
if(SYSCON_read( SYSCON_BOARD_SYSTEMRAM_CASLAT_CYCLES_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("SDRAM CAS latency =" )) return FALSE;
sprintf( msg, "%d cycles\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* SRAS precharge */
if(SYSCON_read( SYSCON_BOARD_SYSTEMRAM_SRASPRCHG_CYCLES_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("SDRAM SRAS precharge =" )) return FALSE;
sprintf( msg, "%d cycles\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* SRAS to SCAS delay */
if(SYSCON_read( SYSCON_BOARD_SYSTEMRAM_SRAS2SCAS_CYCLES_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("SDRAM SRAS to SCAS delay =" )) return FALSE;
sprintf( msg, "%d cycles\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* System RAM Write burst length */
if(SYSCON_read( SYSCON_BOARD_SYSTEMRAM_WRITE_BURSTLEN_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("SDRAM write burst length =" )) return FALSE;
sprintf( msg, "%d\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* System RAM Write burst length */
if(SYSCON_read( SYSCON_BOARD_SYSTEMRAM_READ_BURSTLEN_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("SDRAM read burst length =" )) return FALSE;
sprintf( msg, "%d\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* Free memory */
if(SYSCON_read( SYSCON_BOARD_FREE_MEM_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS( "\nFirst free SDRAM address =" )) return FALSE;
sprintf( msg, "0x%08x\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* Stack size */
if(SYSCON_read( SYSCON_BOARD_STACK_SIZE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS( "Stack size =" )) return FALSE;
sprintf( msg, "0x%x bytes\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* Application stack size */
if(SYSCON_read( SYSCON_BOARD_APPL_STACK_SIZE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS( "Application stack size =" )) return FALSE;
sprintf( msg, "0x%x bytes\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
return TRUE;
}
/************************************************************************
* info_mem_boot
************************************************************************/
static bool
info_mem_boot( void )
{
char msg[80];
UINT32 flash_size;
UINT32 wdata;
/* Flash size */
flash_size = determine_total_flash();
if(SHELL_PUTS("Flash memory size =" )) return FALSE;
sprintf( msg, "%d MByte\n", flash_size / (1024*1024) );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
/* Ram size */
if(SYSCON_read( SYSCON_BOARD_SYSTEMRAM_ACTUAL_SIZE_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS("SDRAM size =" )) return FALSE;
sprintf( msg, "%d MByte\n", wdata / (1024*1024) );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
/* Free memory */
if(SYSCON_read( SYSCON_BOARD_FREE_MEM_ID,
&wdata, sizeof(wdata)) == OK)
{
if(SHELL_PUTS( "First free SDRAM address =" )) return FALSE;
sprintf( msg, "0x%08x\n", wdata );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
}
return TRUE;
}
/************************************************************************
* info_boot
************************************************************************/
static bool
info_boot( void )
{
char msg[80];
bool errflag;
/* Welcome message */
if(SHELL_PUTS( SHELL_WELCOME_MSG )) return FALSE;
#ifdef BOARD_STARTUP_MENU
if(SHELL_PUTS( BOARD_STARTUP_MENU )) return FALSE;
#endif
/* Compile data and time */
if(SHELL_PUTS( "\nCompilation time =" )) return FALSE;
sprintf( msg, "%s %s\n", _shell_date, _shell_time );
if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;
if( !info_board() )
return FALSE;
if( !info_cpu_boot() )
return FALSE;
if( !info_mem_boot() )
return FALSE;
/* Print out warnings for various things */
errflag = FALSE;
if ( SYSENV_check_state() ) errflag = TRUE;
if ( !errflag )
{
if( check_ip() ) errflag = TRUE;
if( check_eeprom() ) errflag = TRUE;
if( env_check() ) errflag = TRUE;
if( check_config1() ) errflag = TRUE;
}
if (errflag)
printf("\n");
return TRUE;
}
/************************************************************************
* get_options
************************************************************************/
static UINT32
get_options(
UINT32 argc,
char **argv,
char **name )
{
if( argc > 2 )
{
return SHELL_ERROR_SYNTAX;
}
*name =
( argc != 1 ) ?
argv[1] : NULL;
if( !(*name) )
*name = boot_name;
return OK;
}
/* Command definition for help */
static t_cmd cmd_def =
{
"info",
info,
NULL,
NULL,
NULL,
0,
FALSE
};
/* Command definitions for SDB 'i' command (secret command) */
static t_cmd cmd_def_sdb_lower =
{
"i",
info_sdb,
"i (Microsoft SDB command)",
"Identity command. Displays SDB information list.",
NULL,
0,
TRUE
};
/************************************************************************
* init_command
************************************************************************/
static void
init_command( void )
{
sprintf( syntax, "info [" );
/* Info sw should always be first since it contains the
* welcome message.
*/
register_item( info_board_name, info_board_descr, info_board );
register_item( info_cpu_name, info_cpu_descr, info_cpu );
register_item( info_mem_name, info_mem_descr, info_mem );
register_item( info_uart_name, info_uart_descr, info_uart );
register_item( info_boot_name, info_boot_descr, info_boot );
register_item( info_all_name, info_all_descr, NULL );
if( board_pci )
register_item( info_pci_name, info_pci_descr, info_pci );
if( board_isa )
register_item( info_isa_name, info_isa_descr, info_isa );
if( board_lan )
register_item( info_lan_name, info_lan_descr, info_lan );
strcat( syntax, " ]" );
cmd_def.descr = syntax_descr;
cmd_def.syntax = syntax;
init_done = TRUE;
}
/************************************************************************
* Implementation : Public functions
************************************************************************/
/************************************************************************
*
* shell_disp_info
* Description :
* -------------
*
* Display info on the specified item
*
* Return values :
* ---------------
*
* void
*
************************************************************************/
UINT32
shell_disp_info(
char *name )
{
t_item *item_data;
bool all;
bool valid;
UINT32 i;
all =
(strcmp(name, info_all_name) == 0) ?
TRUE :
FALSE;
if( all )
{
SHELL_DISABLE_MORE;
}
/* Go through all registered items */
for( i=0; i<item_count; i++ )
{
item_data = &item[i];
valid = FALSE;
if( all )
{
if( strcmp( item_data->name, info_boot_name ) != 0 )
valid = TRUE;
}
else
{
if( strcmp(item_data->name, name) == 0 )
valid = TRUE;
}
if( valid )
{
if( item_data->func )
{
if( strcmp( name, info_boot_name ) != 0 )
{
if(SHELL_PUTS( "\n**** Info " ))
return OK;
if(SHELL_PUTS( item_data->name ))
return OK;
if(SHELL_PUTS( " ****\n\n" ))
return OK;
}
else
{
if(SHELL_PUTS( "\n" ))
return OK;
}
if( !item_data->func() || !all )
{
SHELL_PUTC( '\n' );
return OK;
}
if( SHELL_PUTC( '\n' ) )
return OK;
}
}
}
if( !all )
{
/* Not found */
if( *name == '-' )
{
shell_error_data = name;
return SHELL_ERROR_OPTION;
}
else
return SHELL_ERROR_SYNTAX;
}
return OK;
}
/************************************************************************
*
* shell_info_init
* Description :
* -------------
*
* Initialise command
*
* Return values :
* ---------------
*
* void
*
************************************************************************/
t_cmd *
shell_info_init(
bool pci, /* TRUE -> Board supports PCI */
bool isa, /* TRUE -> Board supports ISA bus */
bool lan, /* TRUE -> Board supports Ethernet */
bool eeprom ) /* TRUE -> Boards supports EEPROM */
{
board_pci = pci;
board_isa = isa;
board_lan = lan;
board_eeprom = eeprom;
if( !init_done )
init_command();
return &cmd_def;
}
/************************************************************************
*
* shell_info_sdb_init
* Description :
* -------------
*
* Register command for shell
*
* Return values :
* ---------------
*
* void
*
************************************************************************/
t_cmd *
shell_info_sdb_init( void )
{
if( !init_done )
init_command();
return &cmd_def_sdb_lower;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -