]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/cris/devices.c
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / sim / cris / devices.c
CommitLineData
f6bcefef 1/* CRIS device support
8acc9f48 2 Copyright (C) 2004-2013 Free Software Foundation, Inc.
f6bcefef
HPN
3 Contributed by Axis Communications.
4
5This file is part of the GNU simulators.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
4744ac1b
JB
9the Free Software Foundation; either version 3 of the License, or
10(at your option) any later version.
f6bcefef
HPN
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
4744ac1b
JB
17You should have received a copy of the GNU General Public License
18along with this program. If not, see <http://www.gnu.org/licenses/>. */
f6bcefef
HPN
19
20/* Based on the i960 devices.c (for the purposes, the same as all the
21 others). */
22
23#include "sim-main.h"
24
25#ifdef HAVE_DV_SOCKSER
26#include "dv-sockser.h"
27#endif
28
aad3b3cb
HPN
29#include "hw-device.h"
30
f6bcefef
HPN
31/* Placeholder definition. */
32struct _device { char dummy; } cris_devices;
33
34void
35device_error (device *me ATTRIBUTE_UNUSED,
fb0cc53e 36 const char *message ATTRIBUTE_UNUSED,
f6bcefef
HPN
37 ...)
38{
39 abort ();
40}
41
42int
43device_io_read_buffer (device *me ATTRIBUTE_UNUSED,
44 void *source ATTRIBUTE_UNUSED,
45 int space ATTRIBUTE_UNUSED,
46 address_word addr ATTRIBUTE_UNUSED,
47 unsigned nr_bytes ATTRIBUTE_UNUSED,
48 SIM_DESC sd ATTRIBUTE_UNUSED,
49 SIM_CPU *cpu ATTRIBUTE_UNUSED,
50 sim_cia cia ATTRIBUTE_UNUSED)
51{
aad3b3cb
HPN
52#if WITH_HW
53 return hw_io_read_buffer ((struct hw *) me, source, space, addr, nr_bytes);
54#else
f6bcefef 55 abort ();
aad3b3cb 56#endif
f6bcefef
HPN
57}
58
59int
60device_io_write_buffer (device *me ATTRIBUTE_UNUSED,
61 const void *source,
62 int space ATTRIBUTE_UNUSED,
63 address_word addr, unsigned nr_bytes,
64 SIM_DESC sd, SIM_CPU *cpu, sim_cia cia)
65{
66 static const unsigned char ok[] = { 4, 0, 0, 0x90};
67 static const unsigned char bad[] = { 8, 0, 0, 0x90};
68
aad3b3cb
HPN
69 if (cris_have_900000xxif)
70 {
71 if (addr == 0x90000004 && memcmp (source, ok, sizeof ok) == 0)
72 return cris_break_13_handler (cpu, 1, 0, 0, 0, 0, 0, 0, cia);
73 else if (addr == 0x90000008
74 && memcmp (source, bad, sizeof bad) == 0)
75 return cris_break_13_handler (cpu, 1, 34, 0, 0, 0, 0, 0, cia);
76 }
77#if WITH_HW
78 else
79 return hw_io_write_buffer ((struct hw *) me, source, space, addr, nr_bytes);
80#endif
f6bcefef
HPN
81
82 /* If it wasn't one of those, send an invalid-memory signal. */
83 sim_core_signal (sd, cpu, cia, 0, nr_bytes, addr,
84 write_transfer, sim_core_unmapped_signal);
aad3b3cb
HPN
85
86 return 0;
f6bcefef 87}