Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / include / ui.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: ui.h
5* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7*
8* The above named program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public
10* License version 2 as published by the Free Software Foundation.
11*
12* The above named program is distributed in the hope that it will be
13* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this work; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20*
21* ========== Copyright Header End ============================================
22*/
23/*
24 * Copyright (C) 2001 Sun Microsystems, Inc.
25 * All rights reserved.
26 */
27#pragma ident "@(#)1.2 01/10/08 ui.h"
28
29#ifndef _UI_H
30#define _UI_H
31
32#include "types.h"
33#include <stdio.h>
34
35
36//----------------------------------------------------------------------
37// UI is the User Interface class that eventually will hold
38// all things related to the UI.
39//----------------------------------------------------------------------
40
41class UserInterface
42{
43 public:
44 UserInterface( const char* module_name_=0 );
45
46
47 // output() is for conventional ui command output like printing
48 // registers, tlb entries, etc.
49 void output( const char* format, ... );
50
51 // verbose() is output that is only send to the logfile.
52 void verbose( const char* format, ... );
53
54 // warning() are for cases were say the command is depricated
55 // but still supported. Warnings should be rare, and they can
56 // NOT be turned off. The message should tell what, why and how
57 // the user can avoid the warning.
58 void warning( const char* format, ... );
59
60 // error() is for output that reports errors in the command
61 // arguments, state of the simulator and requested operation, etc.
62 void error( const char* format, ... );
63
64 // fatal() is for output of fatal situation, running out of
65 // memory for example., The fatal() call ends with a abort()
66 // system call. Fatals should be even more rare then warnings.
67 void fatal( const char* format, ... );
68
69 // perror() is SAM's wrapper for perror(3C).
70 void perror( const char* s );
71
72 // flush() flushes buffered output and flushed buffered log file
73 // output.
74 void flush();
75
76 // For user commands that need FILE* to output. Code that uses this
77 // methods also need to use get_log_file() and output to the log file.
78 FILE* get_output_file();
79
80
81 // set_log_file() sets the file to log all ui input, output,
82 // warning, error, fatal, and debugging output.
83 void set_log_file( FILE* log_file_ );
84
85 // get_log_file() returns the FILE pointer associated with
86 // logging the UI. 0 (NULL) is returned is logging is disabled.
87 FILE* get_log_file() { return log_file; }
88
89
90 // input() is called for dumping user (standard) input into a log file
91 // if file logging has been enabled, see set_log_file().
92 void input( const char* );
93
94 private:
95 const char* module_name; // If set put module name after ERROR, etc
96 static FILE* log_file; // When set duplicates the file_* output
97};
98
99
100extern UserInterface* ui;
101
102
103
104#define RC_DUMP "rc.dmp"
105
106extern char *get_script_file();
107
108extern volatile bool_t cpu_enabled[/*MAX_MP*/];
109extern volatile bool_t cpu_enable_changed;
110
111extern int ui_exper; /* ui-settable int-valued developer-experiment flag */
112
113typedef int (*ui_cmd_exe_handler) (void *cd, int argc, char **argv);
114typedef int (*ui_cmd_help_handler) ();
115
116void UI_register_cmd_1 (char * name, char *help, ui_cmd_exe_handler efn, ui_cmd_help_handler hfn);
117void UI_register_cmd_2 (char * name, char *help, ui_cmd_exe_handler efn, ui_cmd_help_handler hfn);
118void UI_invalidate_cmd (char * name);
119void UI_exec_cmd (char * name);
120void UI_exec_cmd_fd (int fd, char * name, int l);
121void UI_exec_onstop_cmd ();
122bool_t UI_redirect (char *fname);
123void * UI_is_ready ();
124uint8_t send_diskinfo_to_fakeprom();
125
126#endif /* _UI_H */