Commit | Line | Data |
---|---|---|
ae7c3446 AC |
1 | /* This file is part of the program psim. |
2 | ||
3 | Copyright (C) 1994-1997, 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 HW_TREE | |
23 | #define HW_TREE | |
24 | ||
25 | ||
26 | struct hw *hw_tree_create | |
27 | (SIM_DESC sd, | |
28 | const char *device); | |
29 | ||
30 | struct hw *hw_tree_parse | |
31 | (struct hw *root, | |
32 | const char *fmt, | |
33 | ...) __attribute__ ((format (printf, 2, 3))); | |
34 | ||
35 | void hw_tree_finish | |
36 | (struct hw *root); | |
37 | ||
38 | void hw_tree_print | |
39 | (struct hw *root); | |
40 | ||
41 | ||
42 | /* Tree traversal:: | |
43 | ||
44 | The entire device tree can be traversed using the | |
45 | <<device_tree_traverse()>> function. The traversal can be in | |
46 | either prefix or postfix order. | |
47 | ||
48 | */ | |
49 | ||
50 | typedef void (hw_tree_traverse_function) | |
51 | (struct hw *device, | |
52 | void *data); | |
53 | ||
54 | void hw_tree_traverse | |
55 | (struct hw *root, | |
56 | hw_tree_traverse_function *prefix, | |
57 | hw_tree_traverse_function *postfix, | |
58 | void *data); | |
59 | ||
60 | ||
61 | /* Tree lookup:: | |
62 | ||
63 | The function <<hw_tree_find_device()>> will attempt to locate the | |
64 | specified device within the tree. If the device is not found a | |
65 | NULL device is returned. | |
66 | ||
67 | */ | |
68 | ||
69 | struct hw * hw_tree_find_device | |
70 | (struct hw *root, | |
71 | const char *path); | |
72 | ||
73 | ||
74 | const struct hw_property *hw_tree_find_property | |
75 | (struct hw *root, | |
76 | const char *path_to_property); | |
77 | ||
78 | int hw_tree_find_boolean_property | |
79 | (struct hw *root, | |
80 | const char *path_to_property); | |
81 | ||
82 | signed_cell hw_tree_find_integer_property | |
83 | (struct hw *root, | |
84 | const char *path_to_property); | |
85 | ||
86 | #if NOT_YET | |
87 | device_instance *hw_tree_find_ihandle_property | |
88 | (struct hw *root, | |
89 | const char *path_to_property); | |
90 | #endif | |
91 | ||
92 | const char *hw_tree_find_string_property | |
93 | (struct hw *root, | |
94 | const char *path_to_property); | |
95 | ||
96 | ||
97 | /* Perform a soft reset on the created tree. */ | |
98 | ||
99 | void hw_tree_reset | |
100 | (struct hw *root); | |
101 | ||
102 | ||
103 | #endif |