OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [sim/] [common/] [hw-properties.h] - Blame information for rev 1775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/* The common simulator framework for GDB, the GNU Debugger.
2
 
3
   Copyright 2002 Free Software Foundation, Inc.
4
 
5
   Contributed by Andrew Cagney and Red Hat.
6
 
7
   This file is part of GDB.
8
 
9
   This program is free software; you can redistribute it and/or modify
10
   it under the terms of the GNU General Public License as published by
11
   the Free Software Foundation; either version 2 of the License, or
12
   (at your option) any later version.
13
 
14
   This program is distributed in the hope that it will be useful,
15
   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
   GNU General Public License for more details.
18
 
19
   You should have received a copy of the GNU General Public License
20
   along with this program; if not, write to the Free Software
21
   Foundation, Inc., 59 Temple Place - Suite 330,
22
   Boston, MA 02111-1307, USA.  */
23
 
24
 
25
#ifndef HW_PROPERTIES_H
26
#define HW_PROPERTIES_H
27
 
28
/* The following are valid property types.  The property `array' is
29
   for generic untyped data. */
30
 
31
typedef enum {
32
  array_property,
33
  boolean_property,
34
#if 0
35
  ihandle_property, /*runtime*/
36
#endif
37
  integer_property,
38
  range_array_property,
39
  reg_array_property,
40
  string_property,
41
  string_array_property,
42
} hw_property_type;
43
 
44
struct hw_property {
45
  struct hw *owner;
46
  const char *name;
47
  hw_property_type type;
48
  unsigned sizeof_array;
49
  const void *array;
50
  const struct hw_property *original;
51
  object_disposition disposition;
52
};
53
 
54
#define hw_property_owner(p) ((p)->owner + 0)
55
#define hw_property_name(p) ((p)->name + 0)
56
#define hw_property_type(p) ((p)->type + 0)
57
#define hw_property_array(p) ((p)->array + 0)
58
#define hw_property_sizeof_array(p) ((p)->sizeof_array + 0)
59
#define hw_property_original(p) ((p)->original + 0)
60
#define hw_property_disposition(p) ((p)->disposition + 0)
61
 
62
 
63
/* Find/iterate over properites attached to a device.
64
 
65
   To iterate over all properties attached to a device, call
66
   hw_find_property (.., NULL) and then hw_property_next. */
67
 
68
const struct hw_property *hw_find_property
69
(struct hw *me,
70
 const char *property);
71
 
72
const struct hw_property *hw_next_property
73
(const struct hw_property *previous);
74
 
75
 
76
/* Manipulate the properties belonging to a given device.
77
 
78
   HW_ADD_* will, if the property is not already present, add a
79
   property to the device.  Adding a property to a device after it has
80
   been created is a checked run-time error (use HW_SET_*).
81
 
82
   HW_SET_* will always update (or create) the property so that it has
83
   the specified value.  Changing the type of a property is a checked
84
   run-time error.
85
 
86
   FIND returns the specified properties value.  It is a checked
87
   runtime error to either request a nonexistant property or to
88
   request a property using the wrong type. Code locating a property
89
   should first check its type (using hw_find_property above) and then
90
   obtain its value using the below.
91
 
92
   Naming convention:
93
 
94
   void hw_add_<type>_property(struct hw *, const char *, <type>)
95
   void hw_add_*_array_property(struct hw *, const char *, const <type>*, int)
96
   void hw_set_*_property(struct hw *, const char *, <type>)
97
   void hw_set_*_array_property(struct hw *, const char *, const <type>*, int)
98
   <type> hw_find_*_property(struct hw *, const char *)
99
   int hw_find_*_array_property(struct hw *, const char *, int, <type>*)
100
 
101
   */
102
 
103
 
104
void hw_add_array_property
105
(struct hw *me,
106
 const char *property,
107
 const void *array,
108
 int sizeof_array);
109
 
110
void hw_set_array_property
111
(struct hw *me,
112
 const char *property,
113
 const void *array,
114
 int sizeof_array);
115
 
116
const struct hw_property *hw_find_array_property
117
(struct hw *me,
118
 const char *property);
119
 
120
 
121
 
122
void hw_add_boolean_property
123
(struct hw *me,
124
 const char *property,
125
 int bool);
126
 
127
int hw_find_boolean_property
128
(struct hw *me,
129
 const char *property);
130
 
131
 
132
 
133
#if 0
134
typedef struct _ihandle_runtime_property_spec {
135
  const char *full_path;
136
} ihandle_runtime_property_spec;
137
 
138
void hw_add_ihandle_runtime_property
139
(struct hw *me,
140
 const char *property,
141
 const ihandle_runtime_property_spec *ihandle);
142
 
143
void hw_find_ihandle_runtime_property
144
(struct hw *me,
145
 const char *property,
146
 ihandle_runtime_property_spec *ihandle);
147
 
148
void hw_set_ihandle_property
149
(struct hw *me,
150
 const char *property,
151
 hw_instance *ihandle);
152
 
153
hw_instance * hw_find_ihandle_property
154
(struct hw *me,
155
 const char *property);
156
#endif
157
 
158
 
159
void hw_add_integer_property
160
(struct hw *me,
161
 const char *property,
162
 signed_cell integer);
163
 
164
signed_cell hw_find_integer_property
165
(struct hw *me,
166
 const char *property);
167
 
168
int hw_find_integer_array_property
169
(struct hw *me,
170
 const char *property,
171
 unsigned index,
172
 signed_cell *integer);
173
 
174
 
175
 
176
typedef struct _range_property_spec {
177
  hw_unit child_address;
178
  hw_unit parent_address;
179
  hw_unit size;
180
} range_property_spec;
181
 
182
void hw_add_range_array_property
183
(struct hw *me,
184
 const char *property,
185
 const range_property_spec *ranges,
186
 unsigned nr_ranges);
187
 
188
int hw_find_range_array_property
189
(struct hw *me,
190
 const char *property,
191
 unsigned index,
192
 range_property_spec *range);
193
 
194
 
195
 
196
typedef struct _reg_property_spec {
197
  hw_unit address;
198
  hw_unit size;
199
} reg_property_spec;
200
 
201
void hw_add_reg_array_property
202
(struct hw *me,
203
 const char *property,
204
 const reg_property_spec *reg,
205
 unsigned nr_regs);
206
 
207
int hw_find_reg_array_property
208
(struct hw *me,
209
 const char *property,
210
 unsigned index,
211
 reg_property_spec *reg);
212
 
213
 
214
 
215
void hw_add_string_property
216
(struct hw *me,
217
 const char *property,
218
 const char *string);
219
 
220
const char *hw_find_string_property
221
(struct hw *me,
222
 const char *property);
223
 
224
 
225
 
226
typedef const char *string_property_spec;
227
 
228
void hw_add_string_array_property
229
(struct hw *me,
230
 const char *property,
231
 const string_property_spec *strings,
232
 unsigned nr_strings);
233
 
234
int hw_find_string_array_property
235
(struct hw *me,
236
 const char *property,
237
 unsigned index,
238
 string_property_spec *string);
239
 
240
 
241
 
242
void hw_add_duplicate_property
243
(struct hw *me,
244
 const char *property,
245
 const struct hw_property *original);
246
 
247
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.