diff options
author | Andrew Cagney <cagney@redhat.com> | 1998-03-22 04:18:52 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 1998-03-22 04:18:52 +0000 |
commit | b1e9223cee0728b89f6b909c445a896d9fe41452 (patch) | |
tree | b38bb06b7ec6075dcebfca1705743b29cc5a79be /sim/common/dv-core.c | |
parent | 6cfaad4d884e380f3a0f9aa06618bcda1e5762d3 (diff) | |
download | gdb-b1e9223cee0728b89f6b909c445a896d9fe41452.zip gdb-b1e9223cee0728b89f6b909c445a896d9fe41452.tar.gz gdb-b1e9223cee0728b89f6b909c445a896d9fe41452.tar.bz2 |
Replace *attach_address() arguments SPACEMASK:ADDR with SPACE:ADDR.
Add notes to hw-device.h that discuss the interpretation of SPACE:ADDR
on a BUS.
Diffstat (limited to 'sim/common/dv-core.c')
-rw-r--r-- | sim/common/dv-core.c | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/sim/common/dv-core.c b/sim/common/dv-core.c new file mode 100644 index 0000000..bdb612c --- /dev/null +++ b/sim/common/dv-core.c @@ -0,0 +1,116 @@ +/* This file is part of the program psim. + + Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au> + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + +#include "sim-main.h" +#include "hw-base.h" + +/* DEVICE + + core - root of the device tree + + DESCRIPTION + + The core device, positioned at the root of the device tree appears + to its child devices as a normal device just like every other + device in the tree. + + Internally it is implemented using a core object. Requests to + attach (or detach) address spaces are passed to that core object. + Requests to transfer (DMA) data are reflected back down the device + tree using the core_map data transfer methods. + + PROPERTIES + + None. + + */ + + +static void +dv_core_attach_address_callback (struct hw *me, + int level, + int space, + address_word addr, + address_word nr_bytes, + struct hw *client) +{ + /* NOTE: At preset the space is assumed to be zero. Perhaphs the + space should be mapped onto something for instance: space0 - + unified memory; space1 - IO memory; ... */ + if (space != 0) + hw_abort (me, "Hey! Unknown space %d", space); + sim_core_attach (hw_system (me), + NULL, /*cpu*/ + level, + access_read_write_exec, + space, addr, + nr_bytes, + 0, /* modulo */ + client, + NULL); +} + + +static unsigned +dv_core_dma_read_buffer_callback (struct hw *me, + void *dest, + int space, + unsigned_word addr, + unsigned nr_bytes) +{ + return sim_core_read_buffer (hw_system (me), + NULL, /*CPU*/ + space, /*???*/ + dest, + addr, + nr_bytes); +} + + +static unsigned +dv_core_dma_write_buffer_callback (struct hw *me, + const void *source, + int space, + unsigned_word addr, + unsigned nr_bytes, + int violate_read_only_section) +{ + return sim_core_write_buffer (hw_system (me), + NULL, /*cpu*/ + space, /*???*/ + source, + addr, + nr_bytes); +} + + +static void +dv_core_finish (struct hw *me) +{ + set_hw_attach_address (me, dv_core_attach_address_callback); + set_hw_dma_write_buffer (me, dv_core_dma_write_buffer_callback); + set_hw_dma_read_buffer (me, dv_core_dma_read_buffer_callback); +} + +const struct hw_device_descriptor dv_core_descriptor[] = { + { "core", dv_core_finish, }, + { NULL }, +}; |