New changes from Andrew
[deliverable/binutils-gdb.git] / sim / ppc / device_tree.h
1 /* This file is part of the program psim.
2
3 Copyright (C) 1994-1995, 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 _DEVICE_TREE_H_
23 #define _DEVICE_TREE_H_
24
25 #ifndef INLINE_DEVICE_TREE
26 #define INLINE_DEVICE_TREE
27 #endif
28
29
30 #include "devices.h"
31
32 typedef struct _device_tree device_tree;
33
34
35 /* extend the device tree, each function returns the address of the
36 new node */
37
38 INLINE_DEVICE_TREE device_tree *device_tree_add_passthrough
39 (device_tree *root,
40 const char *path);
41
42 INLINE_DEVICE_TREE device_tree *device_tree_add_device
43 (device_tree *root,
44 const char *path,
45 const device *dev);
46
47 INLINE_DEVICE_TREE device_tree *device_tree_add_integer
48 (device_tree *root,
49 const char *path,
50 signed_word integer);
51
52 INLINE_DEVICE_TREE device_tree *device_tree_add_string
53 (device_tree *root,
54 const char *path,
55 const char *string);
56
57 INLINE_DEVICE_TREE device_tree *device_tree_add_boolean
58 (device_tree *root,
59 const char *path,
60 int bool);
61
62 INLINE_DEVICE_TREE device_tree *device_tree_add_found_device
63 (device_tree *root,
64 const char *path);
65
66 /* query the device tree */
67
68 INLINE_DEVICE_TREE const device *device_tree_find_device
69 (device_tree *root,
70 const char *path);
71
72 INLINE_DEVICE_TREE signed_word device_tree_find_integer
73 (device_tree *root,
74 const char *path);
75
76 INLINE_DEVICE_TREE const char *device_tree_find_string
77 (device_tree *root,
78 const char *path);
79
80 INLINE_DEVICE_TREE int device_tree_find_boolean
81 (device_tree *root,
82 const char *path);
83
84
85 /* initialize the entire tree */
86
87 INLINE_DEVICE_TREE void device_tree_init
88 (device_tree *root,
89 psim *system);
90
91
92 /* traverse the tree eiter pre or post fix */
93
94 typedef void (device_tree_traverse_function)
95 (device_tree *device,
96 void *data);
97
98 INLINE_DEVICE_TREE void device_tree_traverse
99 (device_tree *root,
100 device_tree_traverse_function *prefix,
101 device_tree_traverse_function *postfix,
102 void *data);
103
104
105 /* dump a node, this can be passed to the device_tree_traverse()
106 function to dump out the entire device tree */
107
108 INLINE_DEVICE_TREE void device_tree_dump
109 (device_tree *device,
110 void *ignore_data_argument);
111
112
113 /* Parse a device name, various formats:
114
115 uw: unsigned_word
116 u: unsigned
117 c: string */
118
119 INLINE_DEVICE_TREE int scand_uw
120 (const char *name,
121 unsigned_word *uw1);
122
123 INLINE_DEVICE_TREE int scand_uw_u
124 (const char *name,
125 unsigned_word *uw1,
126 unsigned *u2);
127
128 INLINE_DEVICE_TREE int scand_uw_u_u
129 (const char *name,
130 unsigned_word *uw1,
131 unsigned *u2,
132 unsigned *u3);
133
134 INLINE_DEVICE_TREE int scand_uw_uw_u
135 (const char *name,
136 unsigned_word *uw1,
137 unsigned_word *uw2,
138 unsigned *u3);
139
140 INLINE_DEVICE_TREE int scand_c
141 (const char *name,
142 char *c1, int c1size);
143
144 INLINE_DEVICE_TREE int scand_c_uw_u
145 (const char *name,
146 char *c1, int c1size,
147 unsigned_word *uw2,
148 unsigned *u3);
149
150 INLINE_DEVICE_TREE char *printd_uw_u
151 (const char *name,
152 unsigned_word uw1,
153 unsigned u2);
154
155 INLINE_DEVICE_TREE char *printd_uw_u_u
156 (const char *name,
157 unsigned_word uw1,
158 unsigned u2,
159 unsigned u3);
160
161 INLINE_DEVICE_TREE char *printd_uw_u_u_c
162 (const char *name,
163 unsigned_word uw1,
164 unsigned u2,
165 unsigned u3,
166 const char *c4);
167
168 INLINE_DEVICE_TREE char *printd_c
169 (const char *name,
170 const char *c1);
171
172 INLINE_DEVICE_TREE char *printd_c_uw
173 (const char *name,
174 const char *c1,
175 unsigned_word uw2);
176
177 #endif /* _DEVICE_TREE_H_ */
This page took 0.033421 seconds and 5 git commands to generate.