1 /* The common simulator framework for GDB, the GNU Debugger.
3 Copyright 2002-2018 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 3 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, see <http://www.gnu.org/licenses/>. */
23 #ifndef HW_PROPERTIES_H
24 #define HW_PROPERTIES_H
26 /* The following are valid property types. The property `array' is
27 for generic untyped data. */
34 ihandle_property, /*runtime*/
40 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
136 const char *full_path;
137 } ihandle_runtime_property_spec;
139 void hw_add_ihandle_runtime_property
141 const char *property,
142 const ihandle_runtime_property_spec *ihandle);
144 void hw_find_ihandle_runtime_property
146 const char *property,
147 ihandle_runtime_property_spec *ihandle);
149 void hw_set_ihandle_property
151 const char *property,
152 hw_instance *ihandle);
154 hw_instance * hw_find_ihandle_property
156 const char *property);
160 void hw_add_integer_property
162 const char *property,
163 signed_cell integer);
165 signed_cell hw_find_integer_property
167 const char *property);
169 int hw_find_integer_array_property
171 const char *property,
173 signed_cell *integer);
177 typedef struct _range_property_spec
179 hw_unit child_address;
180 hw_unit parent_address;
182 } range_property_spec;
184 void hw_add_range_array_property
186 const char *property,
187 const range_property_spec *ranges,
190 int hw_find_range_array_property
192 const char *property,
194 range_property_spec *range);
198 typedef struct _reg_property_spec
204 void hw_add_reg_array_property
206 const char *property,
207 const reg_property_spec *reg,
210 int hw_find_reg_array_property
212 const char *property,
214 reg_property_spec *reg);
218 void hw_add_string_property
220 const char *property,
223 const char *hw_find_string_property
225 const char *property);
229 typedef const char *string_property_spec;
231 void hw_add_string_array_property
233 const char *property,
234 const string_property_spec *strings,
235 unsigned nr_strings);
237 int hw_find_string_array_property
239 const char *property,
241 string_property_spec *string);
245 void hw_add_duplicate_property
247 const char *property,
248 const struct hw_property *original);