OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [sim/] [ppc/] [hw_iobus.c] - Diff between revs 24 and 33

Only display areas with differences | Details | Blame | View Log

Rev 24 Rev 33
/*  This file is part of the program psim.
/*  This file is part of the program psim.
 
 
    Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
    Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
 
 
    This program is free software; you can redistribute it and/or modify
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    (at your option) any later version.
 
 
    This program is distributed in the hope that it will be useful,
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    GNU General Public License for more details.
 
 
    You should have received a copy of the GNU General Public License
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 
    */
    */
 
 
 
 
#ifndef _HW_IOBUS_C_
#ifndef _HW_IOBUS_C_
#define _HW_IOBUS_C_
#define _HW_IOBUS_C_
 
 
#ifndef STATIC_INLINE_HW_IOBUS
#ifndef STATIC_INLINE_HW_IOBUS
#define STATIC_INLINE_HW_IOBUS STATIC_INLINE
#define STATIC_INLINE_HW_IOBUS STATIC_INLINE
#endif
#endif
 
 
#include "device_table.h"
#include "device_table.h"
 
 
 
 
/* DEVICE
/* DEVICE
 
 
   iobus - simple bus for attaching devices
   iobus - simple bus for attaching devices
 
 
   DESCRIPTION
   DESCRIPTION
 
 
   IOBUS provides a simple `local' bus for attaching (hanging)
   IOBUS provides a simple `local' bus for attaching (hanging)
   programmed IO devices from.  All child devices are directly mapped
   programmed IO devices from.  All child devices are directly mapped
   into this devices parent address space (after checking that the
   into this devices parent address space (after checking that the
   attach address lies within the <<iobus>> address range.  address).
   attach address lies within the <<iobus>> address range.  address).
 
 
   PROPERTIES
   PROPERTIES
 
 
   None.
   None.
 
 
   */
   */
 
 
static void
static void
hw_iobus_attach_address_callback(device *me,
hw_iobus_attach_address_callback(device *me,
                                 attach_type type,
                                 attach_type type,
                                 int space,
                                 int space,
                                 unsigned_word addr,
                                 unsigned_word addr,
                                 unsigned nr_bytes,
                                 unsigned nr_bytes,
                                 access_type access,
                                 access_type access,
                                 device *client) /*callback/default*/
                                 device *client) /*callback/default*/
{
{
  int attach_space;
  int attach_space;
  unsigned_word attach_address;
  unsigned_word attach_address;
  /* sanity check */
  /* sanity check */
  if (space != 0)
  if (space != 0)
    device_error(me, "invalid space (%d) specified by %s",
    device_error(me, "invalid space (%d) specified by %s",
                 space, device_path(client));
                 space, device_path(client));
  /* get the bus address */
  /* get the bus address */
  device_address_to_attach_address(device_parent(me),
  device_address_to_attach_address(device_parent(me),
                                   device_unit_address(me),
                                   device_unit_address(me),
                                   &attach_space,
                                   &attach_space,
                                   &attach_address,
                                   &attach_address,
                                   me);
                                   me);
  if (addr < attach_address)
  if (addr < attach_address)
    device_error(me, "Invalid attach address 0x%lx", (unsigned long)addr);
    device_error(me, "Invalid attach address 0x%lx", (unsigned long)addr);
  device_attach_address(device_parent(me),
  device_attach_address(device_parent(me),
                        type,
                        type,
                        attach_space,
                        attach_space,
                        addr,
                        addr,
                        nr_bytes,
                        nr_bytes,
                        access,
                        access,
                        client);
                        client);
}
}
 
 
 
 
static device_callbacks const hw_iobus_callbacks = {
static device_callbacks const hw_iobus_callbacks = {
  { NULL, },
  { NULL, },
  { hw_iobus_attach_address_callback, },
  { hw_iobus_attach_address_callback, },
  { NULL, }, /* IO */
  { NULL, }, /* IO */
  { NULL, }, /* DMA */
  { NULL, }, /* DMA */
  { NULL, }, /* interrupt */
  { NULL, }, /* interrupt */
  { generic_device_unit_decode,
  { generic_device_unit_decode,
    generic_device_unit_encode,
    generic_device_unit_encode,
    generic_device_address_to_attach_address,
    generic_device_address_to_attach_address,
    generic_device_size_to_attach_size }
    generic_device_size_to_attach_size }
};
};
 
 
 
 
const device_descriptor hw_iobus_device_descriptor[] = {
const device_descriptor hw_iobus_device_descriptor[] = {
  { "iobus", NULL, &hw_iobus_callbacks },
  { "iobus", NULL, &hw_iobus_callbacks },
  { NULL, },
  { NULL, },
};
};
 
 
#endif /* _HW_IOBUS_ */
#endif /* _HW_IOBUS_ */
 
 

powered by: WebSVN 2.1.0

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