]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/ppc/tree.h
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / sim / ppc / tree.h
1 /* This file is part of the program psim.
2
3 Copyright (C) 1994-1996, 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 _TREE_H_
23 #define _TREE_H_
24
25 #ifndef INLINE_TREE
26 #define INLINE_TREE
27 #endif
28
29 /* Constructing the device tree:
30
31 The initial device tree populated with devices and basic properties
32 is created using the function <<device_tree_add_parsed()>>. This
33 function parses a PSIM device specification and uses it to populate
34 the tree accordingly.
35
36 This function accepts a printf style formatted string as the
37 argument that describes the entry. Any properties or interrupt
38 connections added to a device tree using this function are marked
39 as having a permenant disposition. When the tree is (re)
40 initialized they will be restored to their initial value.
41
42 */
43
44 EXTERN_TREE\
45 (device *) tree_parse
46 (device *root,
47 const char *fmt,
48 ...) __attribute__ ((format (printf, 2, 3)));
49
50
51 INLINE_TREE\
52 (void) tree_usage
53 (int verbose);
54
55 INLINE_TREE\
56 (void) tree_print
57 (device *root);
58
59 INLINE_TREE\
60 (device_instance*) tree_instance
61 (device *root,
62 const char *device_specifier);
63
64
65 /* Tree traversal::
66
67 The entire device tree can be traversed using the
68 <<device_tree_traverse()>> function. The traversal can be in
69 either pre- or postfix order.
70
71 */
72
73 typedef void (tree_traverse_function)
74 (device *device,
75 void *data);
76
77 INLINE_DEVICE\
78 (void) tree_traverse
79 (device *root,
80 tree_traverse_function *prefix,
81 tree_traverse_function *postfix,
82 void *data);
83
84
85 /* Tree lookup::
86
87 The function <<tree_find_device()>> will attempt to locate
88 the specified device within the tree. If the device is not found a
89 NULL device is returned.
90
91 */
92
93 INLINE_TREE\
94 (device *) tree_find_device
95 (device *root,
96 const char *path);
97
98
99 INLINE_TREE\
100 (const device_property *) tree_find_property
101 (device *root,
102 const char *path_to_property);
103
104 INLINE_TREE\
105 (int) tree_find_boolean_property
106 (device *root,
107 const char *path_to_property);
108
109 INLINE_TREE\
110 (signed_cell) tree_find_integer_property
111 (device *root,
112 const char *path_to_property);
113
114 INLINE_TREE\
115 (device_instance *) tree_find_ihandle_property
116 (device *root,
117 const char *path_to_property);
118
119 INLINE_TREE\
120 (const char *) tree_find_string_property
121 (device *root,
122 const char *path_to_property);
123
124
125 /* Initializing the created tree:
126
127 Once a device tree has been created the <<device_tree_init()>>
128 function is used to initialize it. The exact sequence of events
129 that occure during initialization are described separatly.
130
131 */
132
133 INLINE_TREE\
134 (void) tree_init
135 (device *root,
136 psim *system);
137
138
139 #endif /* _TREE_H_ */