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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [sim/] [common/] [dv-core.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*  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
#include "sim-main.h"
23
#include "hw-main.h"
24
 
25
/* DEVICE
26
 
27
   core - root of the device tree
28
 
29
   DESCRIPTION
30
 
31
   The core device, positioned at the root of the device tree appears
32
   to its child devices as a normal device just like every other
33
   device in the tree.
34
 
35
   Internally it is implemented using a core object.  Requests to
36
   attach (or detach) address spaces are passed to that core object.
37
   Requests to transfer (DMA) data are reflected back down the device
38
   tree using the core_map data transfer methods.
39
 
40
   PROPERTIES
41
 
42
   None.
43
 
44
   */
45
 
46
 
47
static void
48
dv_core_attach_address_callback (struct hw *me,
49
                                 int level,
50
                                 int space,
51
                                 address_word addr,
52
                                 address_word nr_bytes,
53
                                 struct hw *client)
54
{
55
  HW_TRACE ((me, "attach - level=%d, space=%d, addr=0x%lx, nr_bytes=%ld, client=%s",
56
             level, space, (unsigned long) addr, (unsigned long) nr_bytes, hw_path (client)));
57
  /* NOTE: At preset the space is assumed to be zero.  Perhaphs the
58
     space should be mapped onto something for instance: space0 -
59
     unified memory; space1 - IO memory; ... */
60
  sim_core_attach (hw_system (me),
61
                   NULL, /*cpu*/
62
                   level,
63
                   access_read_write_exec,
64
                   space, addr,
65
                   nr_bytes,
66
                   0, /* modulo */
67
                   client,
68
                   NULL);
69
}
70
 
71
 
72
static unsigned
73
dv_core_dma_read_buffer_callback (struct hw *me,
74
                                  void *dest,
75
                                  int space,
76
                                  unsigned_word addr,
77
                                  unsigned nr_bytes)
78
{
79
  return sim_core_read_buffer (hw_system (me),
80
                               NULL, /*CPU*/
81
                               space, /*???*/
82
                               dest,
83
                               addr,
84
                               nr_bytes);
85
}
86
 
87
 
88
static unsigned
89
dv_core_dma_write_buffer_callback (struct hw *me,
90
                                   const void *source,
91
                                   int space,
92
                                   unsigned_word addr,
93
                                   unsigned nr_bytes,
94
                                   int violate_read_only_section)
95
{
96
  return sim_core_write_buffer (hw_system (me),
97
                                NULL, /*cpu*/
98
                                space, /*???*/
99
                                source,
100
                                addr,
101
                                nr_bytes);
102
}
103
 
104
 
105
static void
106
dv_core_finish (struct hw *me)
107
{
108
  set_hw_attach_address (me, dv_core_attach_address_callback);
109
  set_hw_dma_write_buffer (me, dv_core_dma_write_buffer_callback);
110
  set_hw_dma_read_buffer (me, dv_core_dma_read_buffer_callback);
111
}
112
 
113
const struct hw_descriptor dv_core_descriptor[] = {
114
  { "core", dv_core_finish, },
115
  { NULL },
116
};

powered by: WebSVN 2.1.0

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