2 Copyright (C) 1998, 1999, 2007 Free Software Foundation, Inc.
3 Contributed by Red Hat.
5 This file is part of the GNU simulators.
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.
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
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* ??? All of this is just to get something going. wip! */
24 #ifdef HAVE_DV_SOCKSER
25 #include "dv-sockser.h"
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)
35 if (STATE_ENVIRONMENT (sd) != OPERATING_ENVIRONMENT)
38 #ifdef HAVE_DV_SOCKSER
39 if (addr == UART_INCHAR_ADDR)
41 int c = dv_sockser_read (sd);
47 if (addr == UART_STATUS_ADDR)
49 int status = dv_sockser_status (sd);
50 unsigned char *p = source;
52 p[1] = (((status & DV_SOCKSER_INPUT_EMPTY)
53 #ifdef UART_INPUT_READY0
54 ? UART_INPUT_READY : 0)
56 ? 0 : UART_INPUT_READY)
58 + ((status & DV_SOCKSER_OUTPUT_EMPTY) ? UART_OUTPUT_READY : 0));
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)
73 if (addr == MCCR_ADDR)
75 if ((*(const char *) source & MCCR_CP) != 0)
81 if (STATE_ENVIRONMENT (sd) != OPERATING_ENVIRONMENT)
85 if (addr == UART_OUTCHAR_ADDR)
87 int rc = dv_sockser_write (sd, *(char *) source);
95 void device_error (device *me, char* message, ...) {}