sim: common: trim trailing whitespace
[external/binutils.git] / sim / common / sim-basics.h
1 /* The common simulator framework for GDB, the GNU Debugger.
2
3    Copyright 2002, 2004, 2007, 2008, 2009, 2010, 2011
4    Free Software Foundation, Inc.
5
6    Contributed by Andrew Cagney and Red Hat.
7
8    This file is part of GDB.
9
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 3 of the License, or
13    (at your option) any later version.
14
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
22
23
24 #ifndef _SIM_BASICS_H_
25 #define _SIM_BASICS_H_
26
27
28 /* Basic configuration */
29
30 #ifdef HAVE_CONFIG_H
31 #include "cconfig.h"
32 #endif
33
34 /* Basic host dependant mess - hopefully <stdio.h> + <stdarg.h> will
35    bring potential conflicts out in the open */
36
37 #include <stdarg.h>
38 #include <stdio.h>
39 #include <setjmp.h>
40
41 #ifdef __CYGWIN32__
42 extern int vasprintf (char **result, const char *format, va_list args);
43 extern int asprintf (char **result, const char *format, ...);
44 #endif
45
46
47 #ifndef NULL
48 #define NULL 0
49 #endif
50
51
52
53 /* Some versions of GCC include an attribute operator, define it */
54
55 #if !defined (__attribute__)
56 #if (!defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
57 #define __attribute__(arg)
58 #endif
59 #endif
60
61
62 /* Global types that code manipulates */
63
64 typedef struct _device device;
65 struct hw;
66 struct _sim_fpu;
67
68
69 /* Generic address space (maps) and access attributes */
70
71 enum {
72   read_map = 0,
73   write_map = 1,
74   exec_map = 2,
75   io_map = 3,
76   nr_maps = 32, /* something small */
77 };
78
79 enum {
80   access_invalid = 0,
81   access_read = 1 << read_map,
82   access_write = 1 << write_map,
83   access_exec = 1 << exec_map,
84   access_io = 1 << io_map,
85 };
86
87 enum {
88   access_read_write = (access_read | access_write),
89   access_read_exec = (access_read | access_exec),
90   access_write_exec = (access_write | access_exec),
91   access_read_write_exec = (access_read | access_write | access_exec),
92   access_read_io = (access_read | access_io),
93   access_write_io = (access_write | access_io),
94   access_read_write_io = (access_read | access_write | access_io),
95   access_exec_io = (access_exec | access_io),
96   access_read_exec_io = (access_read | access_exec | access_io),
97   access_write_exec_io = (access_write | access_exec | access_io),
98   access_read_write_exec_io = (access_read | access_write | access_exec | access_io),
99 };
100
101
102 /* disposition of an object when things are reset */
103
104 typedef enum {
105   permenant_object,
106   temporary_object,
107 } object_disposition;
108
109
110 /* Memory transfer types */
111
112 typedef enum _transfer_type {
113   read_transfer,
114   write_transfer,
115 } transfer_type;
116
117
118 /* directions */
119
120 typedef enum {
121   bidirect_port,
122   input_port,
123   output_port,
124 } port_direction;
125
126
127 \f
128 /* Basic definitions - ordered so that nothing calls what comes after it.  */
129
130 /* FIXME: conditionalizing tconfig.h on HAVE_CONFIG_H seems wrong.  */
131 #ifdef HAVE_CONFIG_H
132 #include "tconfig.h"
133 #endif
134
135 #include "ansidecl.h"
136 #include "gdb/callback.h"
137 #include "gdb/remote-sim.h"
138
139 #include "sim-config.h"
140
141 #include "sim-inline.h"
142
143 #include "sim-types.h"
144 #include "sim-bits.h"
145 #include "sim-endian.h"
146 #include "sim-signal.h"
147 #include "sim-arange.h"
148
149 #include "sim-utils.h"
150
151 /* Note: Only the simpler interfaces are defined here.  More heavy
152    weight objects, such as core and events, are defined in the more
153    serious sim-base.h header. */
154
155 #endif /* _SIM_BASICS_H_ */