⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 info.c

📁 MIPS YAMON, a famous monitor inc. source, make file and PDF manuals.
💻 C
📖 第 1 页 / 共 4 页
字号:
    char   msg[80];    UINT32 wdata;    char  *sdata;    /* 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;    }#if 0    /* System RAM type */    if(SYSCON_read( SYSCON_BOARD_SYSTEMRAM_DDR_CFG_ID,		    &wdata, sizeof(wdata)) == OK)    {        if(SHELL_PUTS("SDRAM type =" )) return FALSE;        strcpy( msg, wdata == 1 ? "DDR\n" : "SDR\n" );        if(SHELL_PUTS_INDENT( msg, INDENT )) return FALSE;    }#endif    /* 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 boolinfo_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 boolinfo_boot( void ){    char msg[80];    bool errflag;    /* Welcome message */    if(SHELL_PUTS( SHELL_WELCOME_MSG )) return FALSE;    /* 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( !disp_all )    {        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( check_fpu() )	errflag = TRUE;	if( check_pci_alloc() )	errflag = TRUE;    }    if (errflag)	printf("\n");    return TRUE;}/************************************************************************ *                          get_options ************************************************************************/static UINT32get_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 voidinit_command( void ){    item_count = 0;    sprintf( syntax, "info [" );    register_item( info_boot_name,  info_boot_descr,  info_boot );    register_item( info_board_name, info_board_descr, info_board );    register_item( info_cpu_name,   info_cpu_descr,   info_cpu );    register_item( info_sysctrl_name, info_sysctrl_descr, info_sysctrl );    register_item( info_mem_name,   info_mem_descr,   info_mem );    register_item( info_uart_name,  info_uart_descr,  info_uart );    register_item( info_all_name,   info_all_descr,   NULL );    if( board_pci )        register_item( info_pci_name, info_pci_descr, info_pci );    if( board_ide )        register_item( info_ide_name, info_ide_descr, info_ide );    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 * ************************************************************************/UINT32shell_disp_info(    char *name ){    t_item *item_data;    bool   valid;    UINT32 i;    disp_all =        (strcmp(name, info_all_name) == 0) ?	    TRUE :	    FALSE;    if( disp_all )    {        SHELL_DISABLE_MORE;    }    /* Go through all registered items */    for( i=0; i<item_count; i++ )    {	item_data = &item[i];	valid     = FALSE;	if( disp_all )	    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() || !disp_all )		{ 		    SHELL_PUTC( '\n' );	            return OK;		} 		if( SHELL_PUTC( '\n' ) )		    return OK;            }        }    }        if( !disp_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 ide,			/* TRUE -> Board supports IDE		*/    bool isa,			/* TRUE -> Board supports ISA bus	*/    bool lan,			/* TRUE -> Board supports Ethernet	*/    bool eeprom )		/* TRUE -> Boards supports EEPROM	*/{    board_pci    = pci;    board_ide    = ide;    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 + -