2 Copyright (C) 1997, 1998 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions.
5 This file is part of GDB, the GNU debugger.
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)
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.
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. */
23 #ifdef HAVE_DV_SOCKSER
24 #include "dv-sockser.h"
27 /* Handling the MSPR register is done by creating a device in the core
28 mapping that winds up here. */
33 device_io_read_buffer (device *me, void *source, int space,
34 address_word addr, unsigned nr_bytes,
35 SIM_CPU *cpu, sim_cia cia)
37 SIM_DESC sd = CPU_STATE (cpu);
39 if (STATE_ENVIRONMENT (sd) != OPERATING_ENVIRONMENT)
42 #ifdef HAVE_DV_SOCKSER
43 if (addr == UART_INCHAR_ADDR)
45 int c = dv_sockser_read (sd);
51 if (addr == UART_STATUS_ADDR)
53 int status = dv_sockser_status (sd);
54 unsigned char *p = source;
56 p[1] = (((status & DV_SOCKSER_INPUT_EMPTY)
57 #ifdef UART_INPUT_READY0
58 ? UART_INPUT_READY : 0)
60 ? 0 : UART_INPUT_READY)
62 + ((status & DV_SOCKSER_OUTPUT_EMPTY) ? UART_OUTPUT_READY : 0));
71 device_io_write_buffer (device *me, const void *source, int space,
72 address_word addr, unsigned nr_bytes,
73 SIM_CPU *cpu, sim_cia cia)
75 SIM_DESC sd = CPU_STATE (cpu);
78 /* MSPR support is deprecated but is kept in for upward compatibility
79 with existing overlay support. */
80 if (addr == MSPR_ADDR)
82 if ((*(const char *) source & MSPR_PURGE) != 0)
86 if (addr == MCCR_ADDR)
88 if ((*(const char *) source & MCCR_CP) != 0)
94 if (STATE_ENVIRONMENT (sd) != OPERATING_ENVIRONMENT)
97 #ifdef HAVE_DV_SOCKSER
98 if (addr == UART_OUTCHAR_ADDR)
100 int rc = dv_sockser_write (sd, *(char *) source);
108 void device_error () {}