14e98e3e1Schristos /* Common hardware header file. 2*88241920Schristos Copyright (C) 1998-2024 Free Software Foundation, Inc. 34e98e3e1Schristos Contributed by Andrew Cagney and Cygnus Support. 44e98e3e1Schristos 54e98e3e1Schristos This file is part of GDB, the GNU debugger. 64e98e3e1Schristos 74e98e3e1Schristos This program is free software; you can redistribute it and/or modify 84e98e3e1Schristos it under the terms of the GNU General Public License as published by 94e98e3e1Schristos the Free Software Foundation; either version 3 of the License, or 104e98e3e1Schristos (at your option) any later version. 114e98e3e1Schristos 124e98e3e1Schristos This program is distributed in the hope that it will be useful, 134e98e3e1Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 144e98e3e1Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 154e98e3e1Schristos GNU General Public License for more details. 164e98e3e1Schristos 174e98e3e1Schristos You should have received a copy of the GNU General Public License 184e98e3e1Schristos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 194e98e3e1Schristos 204e98e3e1Schristos 214e98e3e1Schristos #ifndef HW_MAIN 224e98e3e1Schristos #define HW_MAIN 234e98e3e1Schristos 244e98e3e1Schristos /* establish a type system */ 254e98e3e1Schristos #include "sim-basics.h" 264e98e3e1Schristos 274e98e3e1Schristos /* construct a hw device */ 284e98e3e1Schristos #include "hw-device.h" 294e98e3e1Schristos #include "hw-properties.h" 304e98e3e1Schristos #include "hw-events.h" 314e98e3e1Schristos #include "hw-alloc.h" 324e98e3e1Schristos #include "hw-instances.h" 334e98e3e1Schristos #include "hw-handles.h" 344e98e3e1Schristos #include "hw-ports.h" 354e98e3e1Schristos 364e98e3e1Schristos /* Description of a hardware device */ 374e98e3e1Schristos 384e98e3e1Schristos typedef void (hw_finish_method) 394e98e3e1Schristos (struct hw *me); 404e98e3e1Schristos 414e98e3e1Schristos struct hw_descriptor 424e98e3e1Schristos { 434e98e3e1Schristos const char *family; 444e98e3e1Schristos hw_finish_method *to_finish; 454e98e3e1Schristos }; 464e98e3e1Schristos 474e98e3e1Schristos /* Helper functions to make the implementation of a device easier */ 484e98e3e1Schristos 494e98e3e1Schristos /* Go through the devices reg properties and look for those specifying 504e98e3e1Schristos an address to attach various registers to */ 514e98e3e1Schristos 524e98e3e1Schristos void do_hw_attach_regs (struct hw *me); 534e98e3e1Schristos 544e98e3e1Schristos /* Perform a polling read on FD returning either the number of bytes 554e98e3e1Schristos or a hw_io status code that indicates the reason for the read 564e98e3e1Schristos failure */ 574e98e3e1Schristos 584e98e3e1Schristos enum 594e98e3e1Schristos { 604e98e3e1Schristos HW_IO_EOF = -1, HW_IO_NOT_READY = -2, /* See: IEEE 1275 */ 614e98e3e1Schristos }; 624e98e3e1Schristos 634e98e3e1Schristos typedef int (do_hw_poll_read_method) 644e98e3e1Schristos (SIM_DESC sd, int, char *, int); 654e98e3e1Schristos 664e98e3e1Schristos int do_hw_poll_read 674e98e3e1Schristos (struct hw *me, 684e98e3e1Schristos do_hw_poll_read_method *read, 694e98e3e1Schristos int sim_io_fd, 704e98e3e1Schristos void *buf, 714e98e3e1Schristos unsigned size_of_buf); 724e98e3e1Schristos 734e98e3e1Schristos 744e98e3e1Schristos #endif 75