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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [sim/] [fr30/] [devices.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/* fr30 device support
2
   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
3
   Contributed by Cygnus Solutions.
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 2, or (at your option)
10
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 along
18
with this program; if not, write to the Free Software Foundation, Inc.,
19
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
 
21
/* ??? All of this is just to get something going.  wip!  */
22
 
23
#include "sim-main.h"
24
 
25
#ifdef HAVE_DV_SOCKSER
26
#include "dv-sockser.h"
27
#endif
28
 
29
device fr30_devices;
30
 
31
int
32
device_io_read_buffer (device *me, void *source, int space,
33
                       address_word addr, unsigned nr_bytes,
34
                       SIM_DESC sd, SIM_CPU *cpu, sim_cia cia)
35
{
36
  if (STATE_ENVIRONMENT (sd) != OPERATING_ENVIRONMENT)
37
    return nr_bytes;
38
 
39
#ifdef HAVE_DV_SOCKSER
40
  if (addr == UART_INCHAR_ADDR)
41
    {
42
      int c = dv_sockser_read (sd);
43
      if (c == -1)
44
        return 0;
45
      *(char *) source = c;
46
      return 1;
47
    }
48
  if (addr == UART_STATUS_ADDR)
49
    {
50
      int status = dv_sockser_status (sd);
51
      unsigned char *p = source;
52
      p[0] = 0;
53
      p[1] = (((status & DV_SOCKSER_INPUT_EMPTY)
54
#ifdef UART_INPUT_READY0
55
               ? UART_INPUT_READY : 0)
56
#else
57
               ? 0 : UART_INPUT_READY)
58
#endif
59
              + ((status & DV_SOCKSER_OUTPUT_EMPTY) ? UART_OUTPUT_READY : 0));
60
      return 2;
61
    }
62
#endif
63
 
64
  return nr_bytes;
65
}
66
 
67
int
68
device_io_write_buffer (device *me, const void *source, int space,
69
                        address_word addr, unsigned nr_bytes,
70
                        SIM_DESC sd, SIM_CPU *cpu, sim_cia cia)
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
96
device_error (device *me, char *message, ...)
97
{
98
}

powered by: WebSVN 2.1.0

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