OSDN Git Service

2002-11-22 Andrew Cagney <ac131313@redhat.com>
[pf3gnuchains/pf3gnuchains3x.git] / sim / common / hw-tree.h
1 /* 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_TREE
26 #define HW_TREE
27
28
29 struct hw *hw_tree_create
30 (SIM_DESC sd,
31  const char *device);
32
33 void hw_tree_delete
34 (struct hw *root);
35
36 struct hw *hw_tree_parse
37 (struct hw *root,
38  const char *fmt,
39  ...) __attribute__ ((format (printf, 2, 3)));
40
41 struct hw *hw_tree_vparse
42 (struct hw *root,
43  const char *fmt,
44  va_list ap);
45
46
47 void hw_tree_finish
48 (struct hw *root);
49
50 typedef void (hw_tree_print_callback)
51      (void *,
52       const char *fmt,
53       ...);
54
55 void hw_tree_print
56 (struct hw *root,
57  hw_tree_print_callback *print,
58  void *file);
59
60
61 /* Tree traversal::
62
63    The entire device tree can be traversed using the
64    <<device_tree_traverse()>> function.  The traversal can be in
65    either prefix or postfix order.
66
67    */
68
69 typedef void (hw_tree_traverse_function)
70      (struct hw *device,
71       void *data);
72
73 void hw_tree_traverse
74 (struct hw *root,
75  hw_tree_traverse_function *prefix,
76  hw_tree_traverse_function *postfix,
77  void *data);
78
79
80 /* Tree lookup::
81
82    The function <<hw_tree_find_device()>> will attempt to locate the
83    specified device within the tree.  If the device is not found a
84    NULL device is returned.
85
86    */
87
88 struct hw * hw_tree_find_device
89 (struct hw *root,
90  const char *path);
91
92
93 const struct hw_property *hw_tree_find_property
94 (struct hw *root,
95  const char *path_to_property);
96
97 int hw_tree_find_boolean_property
98 (struct hw *root,
99  const char *path_to_property);
100
101 signed_cell hw_tree_find_integer_property
102 (struct hw *root,
103  const char *path_to_property);
104
105 #if NOT_YET
106 device_instance *hw_tree_find_ihandle_property
107 (struct hw *root,
108  const char *path_to_property);
109 #endif
110
111 const char *hw_tree_find_string_property
112 (struct hw *root,
113  const char *path_to_property);
114
115
116 /* Perform a soft reset on the created tree. */
117
118 void hw_tree_reset
119 (struct hw *root);
120
121
122 #endif