OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [sim/] [ppc/] [hw_iobus.c] - Blame information for rev 866

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
/*  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 - simple bus for attaching devices
35
 
36
   DESCRIPTION
37
 
38
   IOBUS provides a simple `local' bus for attaching (hanging)
39
   programmed IO devices from.  All child devices are directly mapped
40
   into this devices parent address space (after checking that the
41
   attach address lies within the <<iobus>> address range.  address).
42
 
43
   PROPERTIES
44
 
45
   None.
46
 
47
   */
48
 
49
static void
50
hw_iobus_attach_address_callback(device *me,
51
                                 attach_type type,
52
                                 int space,
53
                                 unsigned_word addr,
54
                                 unsigned nr_bytes,
55
                                 access_type access,
56
                                 device *client) /*callback/default*/
57
{
58
  int attach_space;
59
  unsigned_word attach_address;
60
  /* sanity check */
61
  if (space != 0)
62
    device_error(me, "invalid space (%d) specified by %s",
63
                 space, device_path(client));
64
  /* get the bus address */
65
  device_address_to_attach_address(device_parent(me),
66
                                   device_unit_address(me),
67
                                   &attach_space,
68
                                   &attach_address,
69
                                   me);
70
  if (addr < attach_address)
71
    device_error(me, "Invalid attach address 0x%lx", (unsigned long)addr);
72
  device_attach_address(device_parent(me),
73
                        type,
74
                        attach_space,
75
                        addr,
76
                        nr_bytes,
77
                        access,
78
                        client);
79
}
80
 
81
 
82
static 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
    generic_device_address_to_attach_address,
91
    generic_device_size_to_attach_size }
92
};
93
 
94
 
95
const device_descriptor hw_iobus_device_descriptor[] = {
96
  { "iobus", NULL, &hw_iobus_callbacks },
97
  { NULL, },
98
};
99
 
100
#endif /* _HW_IOBUS_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.