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

Subversion Repositories openrisc_me

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* frv device support
2
   Copyright (C) 1998, 1999, 2007, 2008 Free Software Foundation, Inc.
3
   Contributed by Red Hat.
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
/* ??? All of this is just to get something going.  wip!  */
21
 
22
#include "sim-main.h"
23
 
24
#ifdef HAVE_DV_SOCKSER
25
#include "dv-sockser.h"
26
#endif
27
 
28
device frv_devices;
29
 
30
int
31
device_io_read_buffer (device *me, void *source, int space,
32
                       address_word addr, unsigned nr_bytes,
33
                       SIM_DESC sd, SIM_CPU *cpu, sim_cia cia)
34
{
35
  if (STATE_ENVIRONMENT (sd) != OPERATING_ENVIRONMENT)
36
    return nr_bytes;
37
 
38
#ifdef HAVE_DV_SOCKSER
39
  if (addr == UART_INCHAR_ADDR)
40
    {
41
      int c = dv_sockser_read (sd);
42
      if (c == -1)
43
        return 0;
44
      *(char *) source = c;
45
      return 1;
46
    }
47
  if (addr == UART_STATUS_ADDR)
48
    {
49
      int status = dv_sockser_status (sd);
50
      unsigned char *p = source;
51
      p[0] = 0;
52
      p[1] = (((status & DV_SOCKSER_INPUT_EMPTY)
53
#ifdef UART_INPUT_READY0
54
               ? UART_INPUT_READY : 0)
55
#else
56
               ? 0 : UART_INPUT_READY)
57
#endif
58
              + ((status & DV_SOCKSER_OUTPUT_EMPTY) ? UART_OUTPUT_READY : 0));
59
      return 2;
60
    }
61
#endif
62
 
63
  return nr_bytes;
64
}
65
 
66
int
67
device_io_write_buffer (device *me, const void *source, int space,
68
                        address_word addr, unsigned nr_bytes,
69
                        SIM_DESC sd, SIM_CPU *cpu, sim_cia cia)
70
{
71
 
72
#if WITH_SCACHE
73
  if (addr == MCCR_ADDR)
74
    {
75
      if ((*(const char *) source & MCCR_CP) != 0)
76
        scache_flush (sd);
77
      return nr_bytes;
78
    }
79
#endif
80
 
81
  if (STATE_ENVIRONMENT (sd) != OPERATING_ENVIRONMENT)
82
    return nr_bytes;
83
 
84
#if HAVE_DV_SOCKSER
85
  if (addr == UART_OUTCHAR_ADDR)
86
    {
87
      int rc = dv_sockser_write (sd, *(char *) source);
88
      return rc == 1;
89
    }
90
#endif
91
 
92
  return nr_bytes;
93
}
94
 
95
void device_error (device *me, char* message, ...) {}

powered by: WebSVN 2.1.0

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