14e98e3e1Schristos /* The common simulator framework for GDB, the GNU Debugger. 24e98e3e1Schristos 3*88241920Schristos Copyright 2002-2024 Free Software Foundation, Inc. 44e98e3e1Schristos 54e98e3e1Schristos Contributed by Andrew Cagney and Red Hat. 64e98e3e1Schristos 74e98e3e1Schristos This file is part of GDB. 84e98e3e1Schristos 94e98e3e1Schristos This program is free software; you can redistribute it and/or modify 104e98e3e1Schristos it under the terms of the GNU General Public License as published by 114e98e3e1Schristos the Free Software Foundation; either version 3 of the License, or 124e98e3e1Schristos (at your option) any later version. 134e98e3e1Schristos 144e98e3e1Schristos This program is distributed in the hope that it will be useful, 154e98e3e1Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 164e98e3e1Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 174e98e3e1Schristos GNU General Public License for more details. 184e98e3e1Schristos 194e98e3e1Schristos You should have received a copy of the GNU General Public License 204e98e3e1Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 214e98e3e1Schristos 224e98e3e1Schristos 234e98e3e1Schristos #ifndef HW_TREE 244e98e3e1Schristos #define HW_TREE 254e98e3e1Schristos 264b169a6bSchristos #include <stdarg.h> 274b169a6bSchristos 284b169a6bSchristos #include "ansidecl.h" 294e98e3e1Schristos 304e98e3e1Schristos struct hw *hw_tree_create 314e98e3e1Schristos (SIM_DESC sd, 324e98e3e1Schristos const char *device); 334e98e3e1Schristos 344e98e3e1Schristos void hw_tree_delete 354e98e3e1Schristos (struct hw *root); 364e98e3e1Schristos 374e98e3e1Schristos struct hw *hw_tree_parse 384e98e3e1Schristos (struct hw *root, 394e98e3e1Schristos const char *fmt, 404b169a6bSchristos ...) ATTRIBUTE_PRINTF (2, 3); 414e98e3e1Schristos 424e98e3e1Schristos struct hw *hw_tree_vparse 434e98e3e1Schristos (struct hw *root, 444e98e3e1Schristos const char *fmt, 454b169a6bSchristos va_list ap) ATTRIBUTE_PRINTF (2, 0); 464e98e3e1Schristos 474e98e3e1Schristos 484e98e3e1Schristos void hw_tree_finish 494e98e3e1Schristos (struct hw *root); 504e98e3e1Schristos 514e98e3e1Schristos typedef void (hw_tree_print_callback) 524e98e3e1Schristos (void *, 534e98e3e1Schristos const char *fmt, 544e98e3e1Schristos ...); 554e98e3e1Schristos 564e98e3e1Schristos void hw_tree_print 574e98e3e1Schristos (struct hw *root, 584e98e3e1Schristos hw_tree_print_callback *print, 594e98e3e1Schristos void *file); 604e98e3e1Schristos 614e98e3e1Schristos 624e98e3e1Schristos /* Tree traversal:: 634e98e3e1Schristos 644e98e3e1Schristos The entire device tree can be traversed using the 654e98e3e1Schristos <<device_tree_traverse()>> function. The traversal can be in 664e98e3e1Schristos either prefix or postfix order. 674e98e3e1Schristos 684e98e3e1Schristos */ 694e98e3e1Schristos 704e98e3e1Schristos typedef void (hw_tree_traverse_function) 714e98e3e1Schristos (struct hw *device, 724e98e3e1Schristos void *data); 734e98e3e1Schristos 744e98e3e1Schristos void hw_tree_traverse 754e98e3e1Schristos (struct hw *root, 764e98e3e1Schristos hw_tree_traverse_function *prefix, 774e98e3e1Schristos hw_tree_traverse_function *postfix, 784e98e3e1Schristos void *data); 794e98e3e1Schristos 804e98e3e1Schristos 814e98e3e1Schristos /* Tree lookup:: 824e98e3e1Schristos 834e98e3e1Schristos The function <<hw_tree_find_device()>> will attempt to locate the 844e98e3e1Schristos specified device within the tree. If the device is not found a 854e98e3e1Schristos NULL device is returned. 864e98e3e1Schristos 874e98e3e1Schristos */ 884e98e3e1Schristos 894e98e3e1Schristos struct hw * hw_tree_find_device 904e98e3e1Schristos (struct hw *root, 914e98e3e1Schristos const char *path); 924e98e3e1Schristos 934e98e3e1Schristos 944e98e3e1Schristos const struct hw_property *hw_tree_find_property 954e98e3e1Schristos (struct hw *root, 964e98e3e1Schristos const char *path_to_property); 974e98e3e1Schristos 984e98e3e1Schristos int hw_tree_find_boolean_property 994e98e3e1Schristos (struct hw *root, 1004e98e3e1Schristos const char *path_to_property); 1014e98e3e1Schristos 1024e98e3e1Schristos signed_cell hw_tree_find_integer_property 1034e98e3e1Schristos (struct hw *root, 1044e98e3e1Schristos const char *path_to_property); 1054e98e3e1Schristos 1064e98e3e1Schristos #if NOT_YET 1074e98e3e1Schristos device_instance *hw_tree_find_ihandle_property 1084e98e3e1Schristos (struct hw *root, 1094e98e3e1Schristos const char *path_to_property); 1104e98e3e1Schristos #endif 1114e98e3e1Schristos 1124e98e3e1Schristos const char *hw_tree_find_string_property 1134e98e3e1Schristos (struct hw *root, 1144e98e3e1Schristos const char *path_to_property); 1154e98e3e1Schristos 1164e98e3e1Schristos 1174e98e3e1Schristos /* Perform a soft reset on the created tree. */ 1184e98e3e1Schristos 1194e98e3e1Schristos void hw_tree_reset 1204e98e3e1Schristos (struct hw *root); 1214e98e3e1Schristos 1224e98e3e1Schristos 1234e98e3e1Schristos #endif 124