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