1 1.1 christos /* The common simulator framework for GDB, the GNU Debugger. 2 1.1 christos 3 1.11 christos Copyright 2002-2024 Free Software Foundation, Inc. 4 1.1 christos 5 1.1 christos Contributed by Andrew Cagney and Red Hat. 6 1.1 christos 7 1.1 christos This file is part of GDB. 8 1.1 christos 9 1.1 christos This program is free software; you can redistribute it and/or modify 10 1.1 christos it under the terms of the GNU General Public License as published by 11 1.1 christos the Free Software Foundation; either version 3 of the License, or 12 1.1 christos (at your option) any later version. 13 1.1 christos 14 1.1 christos This program is distributed in the hope that it will be useful, 15 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 16 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 1.1 christos GNU General Public License for more details. 18 1.1 christos 19 1.1 christos You should have received a copy of the GNU General Public License 20 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 21 1.1 christos 22 1.1 christos 23 1.1 christos #ifndef HW_TREE 24 1.1 christos #define HW_TREE 25 1.1 christos 26 1.10 christos #include <stdarg.h> 27 1.10 christos 28 1.10 christos #include "ansidecl.h" 29 1.1 christos 30 1.1 christos struct hw *hw_tree_create 31 1.1 christos (SIM_DESC sd, 32 1.1 christos const char *device); 33 1.1 christos 34 1.1 christos void hw_tree_delete 35 1.1 christos (struct hw *root); 36 1.1 christos 37 1.1 christos struct hw *hw_tree_parse 38 1.1 christos (struct hw *root, 39 1.1 christos const char *fmt, 40 1.10 christos ...) ATTRIBUTE_PRINTF (2, 3); 41 1.1 christos 42 1.1 christos struct hw *hw_tree_vparse 43 1.1 christos (struct hw *root, 44 1.1 christos const char *fmt, 45 1.10 christos va_list ap) ATTRIBUTE_PRINTF (2, 0); 46 1.1 christos 47 1.1 christos 48 1.1 christos void hw_tree_finish 49 1.1 christos (struct hw *root); 50 1.1 christos 51 1.1 christos typedef void (hw_tree_print_callback) 52 1.1 christos (void *, 53 1.1 christos const char *fmt, 54 1.1 christos ...); 55 1.1 christos 56 1.1 christos void hw_tree_print 57 1.1 christos (struct hw *root, 58 1.1 christos hw_tree_print_callback *print, 59 1.1 christos void *file); 60 1.1 christos 61 1.1 christos 62 1.1 christos /* Tree traversal:: 63 1.1 christos 64 1.1 christos The entire device tree can be traversed using the 65 1.1 christos <<device_tree_traverse()>> function. The traversal can be in 66 1.1 christos either prefix or postfix order. 67 1.1 christos 68 1.1 christos */ 69 1.1 christos 70 1.1 christos typedef void (hw_tree_traverse_function) 71 1.1 christos (struct hw *device, 72 1.1 christos void *data); 73 1.1 christos 74 1.1 christos void hw_tree_traverse 75 1.1 christos (struct hw *root, 76 1.1 christos hw_tree_traverse_function *prefix, 77 1.1 christos hw_tree_traverse_function *postfix, 78 1.1 christos void *data); 79 1.1 christos 80 1.1 christos 81 1.1 christos /* Tree lookup:: 82 1.1 christos 83 1.1 christos The function <<hw_tree_find_device()>> will attempt to locate the 84 1.1 christos specified device within the tree. If the device is not found a 85 1.1 christos NULL device is returned. 86 1.1 christos 87 1.1 christos */ 88 1.1 christos 89 1.1 christos struct hw * hw_tree_find_device 90 1.1 christos (struct hw *root, 91 1.1 christos const char *path); 92 1.1 christos 93 1.1 christos 94 1.1 christos const struct hw_property *hw_tree_find_property 95 1.1 christos (struct hw *root, 96 1.1 christos const char *path_to_property); 97 1.1 christos 98 1.1 christos int hw_tree_find_boolean_property 99 1.1 christos (struct hw *root, 100 1.1 christos const char *path_to_property); 101 1.1 christos 102 1.1 christos signed_cell hw_tree_find_integer_property 103 1.1 christos (struct hw *root, 104 1.1 christos const char *path_to_property); 105 1.1 christos 106 1.1 christos #if NOT_YET 107 1.1 christos device_instance *hw_tree_find_ihandle_property 108 1.1 christos (struct hw *root, 109 1.1 christos const char *path_to_property); 110 1.1 christos #endif 111 1.1 christos 112 1.1 christos const char *hw_tree_find_string_property 113 1.1 christos (struct hw *root, 114 1.1 christos const char *path_to_property); 115 1.1 christos 116 1.1 christos 117 1.1 christos /* Perform a soft reset on the created tree. */ 118 1.1 christos 119 1.1 christos void hw_tree_reset 120 1.1 christos (struct hw *root); 121 1.1 christos 122 1.1 christos 123 1.1 christos #endif 124