Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / include / ui.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: ui.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
*
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ========== Copyright Header End ============================================
*/
/*
* Copyright (C) 2001 Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "@(#)1.2 01/10/08 ui.h"
#ifndef _UI_H
#define _UI_H
#include "types.h"
#include <stdio.h>
//----------------------------------------------------------------------
// UI is the User Interface class that eventually will hold
// all things related to the UI.
//----------------------------------------------------------------------
class UserInterface
{
public:
UserInterface( const char* module_name_=0 );
// output() is for conventional ui command output like printing
// registers, tlb entries, etc.
void output( const char* format, ... );
// verbose() is output that is only send to the logfile.
void verbose( const char* format, ... );
// warning() are for cases were say the command is depricated
// but still supported. Warnings should be rare, and they can
// NOT be turned off. The message should tell what, why and how
// the user can avoid the warning.
void warning( const char* format, ... );
// error() is for output that reports errors in the command
// arguments, state of the simulator and requested operation, etc.
void error( const char* format, ... );
// fatal() is for output of fatal situation, running out of
// memory for example., The fatal() call ends with a abort()
// system call. Fatals should be even more rare then warnings.
void fatal( const char* format, ... );
// perror() is SAM's wrapper for perror(3C).
void perror( const char* s );
// flush() flushes buffered output and flushed buffered log file
// output.
void flush();
// For user commands that need FILE* to output. Code that uses this
// methods also need to use get_log_file() and output to the log file.
FILE* get_output_file();
// set_log_file() sets the file to log all ui input, output,
// warning, error, fatal, and debugging output.
void set_log_file( FILE* log_file_ );
// get_log_file() returns the FILE pointer associated with
// logging the UI. 0 (NULL) is returned is logging is disabled.
FILE* get_log_file() { return log_file; }
// input() is called for dumping user (standard) input into a log file
// if file logging has been enabled, see set_log_file().
void input( const char* );
private:
const char* module_name; // If set put module name after ERROR, etc
static FILE* log_file; // When set duplicates the file_* output
};
extern UserInterface* ui;
#define RC_DUMP "rc.dmp"
extern char *get_script_file();
extern volatile bool_t cpu_enabled[/*MAX_MP*/];
extern volatile bool_t cpu_enable_changed;
extern int ui_exper; /* ui-settable int-valued developer-experiment flag */
typedef int (*ui_cmd_exe_handler) (void *cd, int argc, char **argv);
typedef int (*ui_cmd_help_handler) ();
void UI_register_cmd_1 (char * name, char *help, ui_cmd_exe_handler efn, ui_cmd_help_handler hfn);
void UI_register_cmd_2 (char * name, char *help, ui_cmd_exe_handler efn, ui_cmd_help_handler hfn);
void UI_invalidate_cmd (char * name);
void UI_exec_cmd (char * name);
void UI_exec_cmd_fd (int fd, char * name, int l);
void UI_exec_onstop_cmd ();
bool_t UI_redirect (char *fname);
void * UI_is_ready ();
uint8_t send_diskinfo_to_fakeprom();
#endif /* _UI_H */