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

Subversion Repositories or1k

[/] [or1k/] [tags/] [final_interface/] [gdb-5.0/] [sim/] [common/] [hw-properties.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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