OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [sim/] [cris/] [devices.c] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* CRIS device support
2
   Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
3
   Contributed by Axis Communications.
4
 
5
This file is part of the GNU simulators.
6
 
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 3 of the License, or
10
(at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
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
 
29
#include "hw-device.h"
30
 
31
/* Placeholder definition.  */
32
struct _device { char dummy; } cris_devices;
33
 
34
void
35
device_error (device *me ATTRIBUTE_UNUSED,
36
              char *message ATTRIBUTE_UNUSED,
37
              ...)
38
{
39
  abort ();
40
}
41
 
42
int
43
device_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
{
52
#if WITH_HW
53
  return hw_io_read_buffer ((struct hw *) me, source, space, addr, nr_bytes);
54
#else
55
  abort ();
56
#endif
57
}
58
 
59
int
60
device_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
 
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
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);
85
 
86
  return 0;
87
}

powered by: WebSVN 2.1.0

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