Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / sim / common / dv-core.c
CommitLineData
b85e4829
AC
1/* The common simulator framework for GDB, the GNU Debugger.
2
88b9d363 3 Copyright 2002-2022 Free Software Foundation, Inc.
b85e4829
AC
4
5 Contributed by Andrew Cagney and Red Hat.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
4744ac1b 11 the Free Software Foundation; either version 3 of the License, or
b85e4829
AC
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
4744ac1b 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c 21
6df01ab8
MF
22/* This must come before any other includes. */
23#include "defs.h"
c906108c
SS
24
25#include "sim-main.h"
26#include "hw-main.h"
27
28/* DEVICE
028f6515 29
c906108c 30 core - root of the device tree
028f6515 31
c906108c 32 DESCRIPTION
028f6515 33
c906108c
SS
34 The core device, positioned at the root of the device tree appears
35 to its child devices as a normal device just like every other
36 device in the tree.
37
38 Internally it is implemented using a core object. Requests to
39 attach (or detach) address spaces are passed to that core object.
40 Requests to transfer (DMA) data are reflected back down the device
41 tree using the core_map data transfer methods.
42
43 PROPERTIES
44
45 None.
46
47 */
48
49
50static void
51dv_core_attach_address_callback (struct hw *me,
52 int level,
53 int space,
54 address_word addr,
55 address_word nr_bytes,
56 struct hw *client)
57{
58 HW_TRACE ((me, "attach - level=%d, space=%d, addr=0x%lx, nr_bytes=%ld, client=%s",
59 level, space, (unsigned long) addr, (unsigned long) nr_bytes, hw_path (client)));
60 /* NOTE: At preset the space is assumed to be zero. Perhaphs the
61 space should be mapped onto something for instance: space0 -
62 unified memory; space1 - IO memory; ... */
c906108c
SS
63 sim_core_attach (hw_system (me),
64 NULL, /*cpu*/
65 level,
66 access_read_write_exec,
67 space, addr,
68 nr_bytes,
69 0, /* modulo */
70 client,
71 NULL);
72}
73
74
75static unsigned
76dv_core_dma_read_buffer_callback (struct hw *me,
77 void *dest,
78 int space,
79 unsigned_word addr,
80 unsigned nr_bytes)
81{
82 return sim_core_read_buffer (hw_system (me),
83 NULL, /*CPU*/
84 space, /*???*/
85 dest,
86 addr,
87 nr_bytes);
88}
89
90
91static unsigned
92dv_core_dma_write_buffer_callback (struct hw *me,
93 const void *source,
94 int space,
95 unsigned_word addr,
96 unsigned nr_bytes,
97 int violate_read_only_section)
98{
99 return sim_core_write_buffer (hw_system (me),
100 NULL, /*cpu*/
101 space, /*???*/
102 source,
103 addr,
104 nr_bytes);
105}
106
107
108static void
109dv_core_finish (struct hw *me)
110{
111 set_hw_attach_address (me, dv_core_attach_address_callback);
112 set_hw_dma_write_buffer (me, dv_core_dma_write_buffer_callback);
113 set_hw_dma_read_buffer (me, dv_core_dma_read_buffer_callback);
114}
115
116const struct hw_descriptor dv_core_descriptor[] = {
117 { "core", dv_core_finish, },
21cf617c 118 { NULL, NULL },
c906108c 119};
This page took 1.063901 seconds and 4 git commands to generate.