1 /* The common simulator framework for GDB, the GNU Debugger.
3 Copyright 2002 Free Software Foundation, Inc.
5 Contributed by Andrew Cagney and Red Hat.
7 This file is part of GDB.
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.
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.
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. */
25 #ifndef HW_PROPERTIES_H
26 #define HW_PROPERTIES_H
28 /* The following are valid property types. The property `array' is
29 for generic untyped data. */
35 ihandle_property
, /*runtime*/
41 string_array_property
,
47 hw_property_type type
;
48 unsigned sizeof_array
;
50 const struct hw_property
*original
;
51 object_disposition disposition
;
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)
63 /* Find/iterate over properites attached to a device.
65 To iterate over all properties attached to a device, call
66 hw_find_property (.., NULL) and then hw_property_next. */
68 const struct hw_property
*hw_find_property
70 const char *property
);
72 const struct hw_property
*hw_next_property
73 (const struct hw_property
*previous
);
76 /* Manipulate the properties belonging to a given device.
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_*).
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
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.
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>*)
104 void hw_add_array_property
106 const char *property
,
110 void hw_set_array_property
112 const char *property
,
116 const struct hw_property
*hw_find_array_property
118 const char *property
);
122 void hw_add_boolean_property
124 const char *property
,
127 int hw_find_boolean_property
129 const char *property
);
134 typedef struct _ihandle_runtime_property_spec
{
135 const char *full_path
;
136 } ihandle_runtime_property_spec
;
138 void hw_add_ihandle_runtime_property
140 const char *property
,
141 const ihandle_runtime_property_spec
*ihandle
);
143 void hw_find_ihandle_runtime_property
145 const char *property
,
146 ihandle_runtime_property_spec
*ihandle
);
148 void hw_set_ihandle_property
150 const char *property
,
151 hw_instance
*ihandle
);
153 hw_instance
* hw_find_ihandle_property
155 const char *property
);
159 void hw_add_integer_property
161 const char *property
,
162 signed_cell integer
);
164 signed_cell hw_find_integer_property
166 const char *property
);
168 int hw_find_integer_array_property
170 const char *property
,
172 signed_cell
*integer
);
176 typedef struct _range_property_spec
{
177 hw_unit child_address
;
178 hw_unit parent_address
;
180 } range_property_spec
;
182 void hw_add_range_array_property
184 const char *property
,
185 const range_property_spec
*ranges
,
188 int hw_find_range_array_property
190 const char *property
,
192 range_property_spec
*range
);
196 typedef struct _reg_property_spec
{
201 void hw_add_reg_array_property
203 const char *property
,
204 const reg_property_spec
*reg
,
207 int hw_find_reg_array_property
209 const char *property
,
211 reg_property_spec
*reg
);
215 void hw_add_string_property
217 const char *property
,
220 const char *hw_find_string_property
222 const char *property
);
226 typedef const char *string_property_spec
;
228 void hw_add_string_array_property
230 const char *property
,
231 const string_property_spec
*strings
,
232 unsigned nr_strings
);
234 int hw_find_string_array_property
236 const char *property
,
238 string_property_spec
*string
);
242 void hw_add_duplicate_property
244 const char *property
,
245 const struct hw_property
*original
);