]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/ppc/hw_iobus.c
* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[thirdparty/binutils-gdb.git] / sim / ppc / hw_iobus.c
CommitLineData
d4d3c7ad
MM
1/* This file is part of the program psim.
2
3 Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 */
20
21
22#ifndef _HW_IOBUS_C_
23#define _HW_IOBUS_C_
24
25#ifndef STATIC_INLINE_HW_IOBUS
26#define STATIC_INLINE_HW_IOBUS STATIC_INLINE
27#endif
28
29#include "device_table.h"
30
31
32/* Device:
33
34 iobus@<address> - bus for attaching devices
35
36
37 Description:
38
39 IOBUS provides a simple `local' bus for attaching (hanging)
40 programmed IO devices from. All child devices are mapped into this
41 devices parent address space (after adjusting for the iobus's base
42 address).
43
44
45 Properties:
46
47 None.
48
49 */
50
51static void
52hw_iobus_attach_address_callback(device *me,
53 const char *name,
54 attach_type type,
55 int space,
56 unsigned_word addr,
57 unsigned nr_bytes,
58 access_type access,
59 device *who) /*callback/default*/
60{
61 unsigned_word hw_iobus_addr;
62 /* sanity check */
63 if (space != 0)
64 error("hw_iobus_attach_address_callback() no space for %s/%s\n",
65 device_name(me), name);
66 /* get the bus address */
67 if (device_unit_address(me)->nr_cells != 1)
68 error("hw_iobus_attach_address_callback() invalid address for %s\n",
69 device_name(me));
70 hw_iobus_addr = device_unit_address(me)->cells[0];
71 device_attach_address(device_parent(me),
72 device_name(me),
73 type,
74 0 /*space*/,
75 hw_iobus_addr + addr,
76 nr_bytes,
77 access,
78 who);
79}
80
81
82static device_callbacks const hw_iobus_callbacks = {
83 { NULL, },
84 { hw_iobus_attach_address_callback, },
85 { NULL, }, /* IO */
86 { NULL, }, /* DMA */
87 { NULL, }, /* interrupt */
88 { generic_device_unit_decode,
89 generic_device_unit_encode, }
90};
91
92
93const device_descriptor hw_iobus_device_descriptor[] = {
94 { "iobus", NULL, &hw_iobus_callbacks },
95 { NULL, },
96};
97
98#endif /* _HW_IOBUS_ */