hw-tree.h revision 1.1.1.4
1232950Stheraven/* The common simulator framework for GDB, the GNU Debugger.
2232950Stheraven
3232950Stheraven   Copyright 2002-2015 Free Software Foundation, Inc.
4232950Stheraven
5232950Stheraven   Contributed by Andrew Cagney and Red Hat.
6232950Stheraven
7232950Stheraven   This file is part of GDB.
8232950Stheraven
9232950Stheraven   This program is free software; you can redistribute it and/or modify
10232950Stheraven   it under the terms of the GNU General Public License as published by
11232950Stheraven   the Free Software Foundation; either version 3 of the License, or
12232950Stheraven   (at your option) any later version.
13232950Stheraven
14232950Stheraven   This program is distributed in the hope that it will be useful,
15232950Stheraven   but WITHOUT ANY WARRANTY; without even the implied warranty of
16232950Stheraven   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17232950Stheraven   GNU General Public License for more details.
18232950Stheraven
19232950Stheraven   You should have received a copy of the GNU General Public License
20232950Stheraven   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21232950Stheraven
22232950Stheraven
23232950Stheraven#ifndef HW_TREE
24232950Stheraven#define HW_TREE
25232950Stheraven
26227825Stheraven
27227825Stheravenstruct hw *hw_tree_create
28227825Stheraven(SIM_DESC sd,
29227825Stheraven const char *device);
30227825Stheraven
31227825Stheravenvoid hw_tree_delete
32227825Stheraven(struct hw *root);
33227825Stheraven
34227825Stheravenstruct hw *hw_tree_parse
35227825Stheraven(struct hw *root,
36227825Stheraven const char *fmt,
37227825Stheraven ...) __attribute__ ((format (printf, 2, 3)));
38227825Stheraven
39227825Stheravenstruct hw *hw_tree_vparse
40227825Stheraven(struct hw *root,
41227825Stheraven const char *fmt,
42227825Stheraven va_list ap);
43227825Stheraven
44227972Stheraven
45227825Stheravenvoid hw_tree_finish
46227825Stheraven(struct hw *root);
47227972Stheraven
48227825Stheraventypedef void (hw_tree_print_callback)
49227825Stheraven     (void *,
50227825Stheraven      const char *fmt,
51227825Stheraven      ...);
52227825Stheraven
53227825Stheravenvoid hw_tree_print
54227825Stheraven(struct hw *root,
55227825Stheraven hw_tree_print_callback *print,
56227825Stheraven void *file);
57227825Stheraven
58227825Stheraven
59227825Stheraven/* Tree traversal::
60253159Stheraven
61253159Stheraven   The entire device tree can be traversed using the
62227825Stheraven   <<device_tree_traverse()>> function.  The traversal can be in
63227825Stheraven   either prefix or postfix order.
64227825Stheraven
65227825Stheraven   */
66227825Stheraven
67227825Stheraventypedef void (hw_tree_traverse_function)
68227825Stheraven     (struct hw *device,
69227825Stheraven      void *data);
70227825Stheraven
71227825Stheravenvoid hw_tree_traverse
72227825Stheraven(struct hw *root,
73227825Stheraven hw_tree_traverse_function *prefix,
74227825Stheraven hw_tree_traverse_function *postfix,
75227825Stheraven void *data);
76227825Stheraven
77227825Stheraven
78227825Stheraven/* Tree lookup::
79227825Stheraven
80227825Stheraven   The function <<hw_tree_find_device()>> will attempt to locate the
81227825Stheraven   specified device within the tree.  If the device is not found a
82227825Stheraven   NULL device is returned.
83227825Stheraven
84227825Stheraven   */
85227825Stheraven
86278724Sdimstruct hw * hw_tree_find_device
87227825Stheraven(struct hw *root,
88227825Stheraven const char *path);
89227825Stheraven
90227825Stheraven
91227825Stheravenconst struct hw_property *hw_tree_find_property
92227825Stheraven(struct hw *root,
93227825Stheraven const char *path_to_property);
94227825Stheraven
95227825Stheravenint hw_tree_find_boolean_property
96227825Stheraven(struct hw *root,
97227825Stheraven const char *path_to_property);
98227825Stheraven
99227825Stheravensigned_cell hw_tree_find_integer_property
100227825Stheraven(struct hw *root,
101227825Stheraven const char *path_to_property);
102227825Stheraven
103227825Stheraven#if NOT_YET
104227825Stheravendevice_instance *hw_tree_find_ihandle_property
105227825Stheraven(struct hw *root,
106227825Stheraven const char *path_to_property);
107227825Stheraven#endif
108227825Stheraven
109227825Stheravenconst char *hw_tree_find_string_property
110227825Stheraven(struct hw *root,
111227825Stheraven const char *path_to_property);
112227825Stheraven
113227825Stheraven
114227825Stheraven/* Perform a soft reset on the created tree. */
115227825Stheraven
116227825Stheravenvoid hw_tree_reset
117227825Stheraven(struct hw *root);
118278724Sdim
119227825Stheraven
120227825Stheraven#endif
121227825Stheraven