Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Common hardware header file. |
ecd75fc8 | 2 | Copyright (C) 1998-2014 Free Software Foundation, Inc. |
c906108c SS |
3 | Contributed by Andrew Cagney and Cygnus Support. |
4 | ||
5 | This file is part of GDB, the GNU debugger. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
4744ac1b JB |
9 | the Free Software Foundation; either version 3 of the License, or |
10 | (at your option) any later version. | |
c906108c SS |
11 | |
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
4744ac1b JB |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
c906108c SS |
19 | |
20 | ||
21 | #ifndef HW_MAIN | |
22 | #define HW_MAIN | |
23 | ||
24 | /* establish a type system */ | |
25 | #include "sim-basics.h" | |
26 | ||
27 | /* construct a hw device */ | |
28 | #include "hw-device.h" | |
29 | #include "hw-properties.h" | |
30 | #include "hw-events.h" | |
31 | #include "hw-alloc.h" | |
32 | #include "hw-instances.h" | |
33 | #include "hw-handles.h" | |
34 | #include "hw-ports.h" | |
35 | ||
36 | /* Description of a hardware device */ | |
37 | ||
38 | typedef void (hw_finish_method) | |
39 | (struct hw *me); | |
40 | ||
12c4cbd5 MF |
41 | struct hw_descriptor |
42 | { | |
c906108c SS |
43 | const char *family; |
44 | hw_finish_method *to_finish; | |
45 | }; | |
46 | ||
47 | /* Helper functions to make the implementation of a device easier */ | |
48 | ||
49 | /* Go through the devices reg properties and look for those specifying | |
50 | an address to attach various registers to */ | |
51 | ||
52 | void do_hw_attach_regs (struct hw *me); | |
53 | ||
54 | /* Perform a polling read on FD returning either the number of bytes | |
55 | or a hw_io status code that indicates the reason for the read | |
56 | failure */ | |
57 | ||
12c4cbd5 MF |
58 | enum |
59 | { | |
c906108c SS |
60 | HW_IO_EOF = -1, HW_IO_NOT_READY = -2, /* See: IEEE 1275 */ |
61 | }; | |
62 | ||
63 | typedef int (do_hw_poll_read_method) | |
64 | (SIM_DESC sd, int, char *, int); | |
65 | ||
66 | int do_hw_poll_read | |
67 | (struct hw *me, | |
68 | do_hw_poll_read_method *read, | |
69 | int sim_io_fd, | |
70 | void *buf, | |
71 | unsigned size_of_buf); | |
72 | ||
73 | ||
74 | #endif |