1 /* This file is part of the program psim.
3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
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.
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.
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.
22 #ifndef _DEVICE_TREE_H_
23 #define _DEVICE_TREE_H_
25 #ifndef INLINE_DEVICE_TREE
26 #define INLINE_DEVICE_TREE
32 typedef struct _device_tree device_tree
;
35 /* extend the device tree, each function returns the address of the
38 INLINE_DEVICE_TREE device_tree
*device_tree_add_passthrough
42 INLINE_DEVICE_TREE device_tree
*device_tree_add_device
47 INLINE_DEVICE_TREE device_tree
*device_tree_add_integer
52 INLINE_DEVICE_TREE device_tree
*device_tree_add_string
57 INLINE_DEVICE_TREE device_tree
*device_tree_add_boolean
62 INLINE_DEVICE_TREE device_tree
*device_tree_add_found_device
66 /* query the device tree */
68 INLINE_DEVICE_TREE
const device
*device_tree_find_device
72 INLINE_DEVICE_TREE signed_word device_tree_find_integer
76 INLINE_DEVICE_TREE
const char *device_tree_find_string
80 INLINE_DEVICE_TREE
int device_tree_find_boolean
85 /* initialize the entire tree */
87 INLINE_DEVICE_TREE
void device_tree_init
92 /* traverse the tree eiter pre or post fix */
94 typedef void (device_tree_traverse_function
)
98 INLINE_DEVICE_TREE
void device_tree_traverse
100 device_tree_traverse_function
*prefix
,
101 device_tree_traverse_function
*postfix
,
105 /* dump a node, this can be passed to the device_tree_traverse()
106 function to dump out the entire device tree */
108 INLINE_DEVICE_TREE
void device_tree_dump
109 (device_tree
*device
,
110 void *ignore_data_argument
);
113 /* Parse a device name, various formats:
119 INLINE_DEVICE_TREE
int scand_uw
123 INLINE_DEVICE_TREE
int scand_uw_u
128 INLINE_DEVICE_TREE
int scand_uw_u_u
134 INLINE_DEVICE_TREE
int scand_uw_uw_u
140 INLINE_DEVICE_TREE
int scand_c
142 char *c1
, int c1size
);
144 INLINE_DEVICE_TREE
int scand_c_uw_u
146 char *c1
, int c1size
,
150 INLINE_DEVICE_TREE
char *printd_uw_u
155 INLINE_DEVICE_TREE
char *printd_uw_u_u
161 INLINE_DEVICE_TREE
char *printd_uw_u_u_c
168 INLINE_DEVICE_TREE
char *printd_c
172 INLINE_DEVICE_TREE
char *printd_c_uw
177 #endif /* _DEVICE_TREE_H_ */