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