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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [sim/] [ppc/] [sim_callbacks.h] - Diff between revs 835 and 841

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 835 Rev 841
/*  This file is part of the program psim.
/*  This file is part of the program psim.
 
 
    Copyright (C) 1994-1995,1998, Andrew Cagney <cagney@highland.com.au>
    Copyright (C) 1994-1995,1998, Andrew Cagney <cagney@highland.com.au>
 
 
    This program is free software; you can redistribute it and/or modify
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    (at your option) any later version.
 
 
    This program is distributed in the hope that it will be useful,
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    GNU General Public License for more details.
 
 
    You should have received a copy of the GNU General Public License
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 
    */
    */
 
 
 
 
#ifndef _SIM_CALLBACKS_H_
#ifndef _SIM_CALLBACKS_H_
#define _SIM_CALLBACKS_H_
#define _SIM_CALLBACKS_H_
 
 
/* Simulator output:
/* Simulator output:
 
 
   Functions to report diagnostic information to the user. */
   Functions to report diagnostic information to the user. */
 
 
#define printf_filtered sim_io_printf_filtered
#define printf_filtered sim_io_printf_filtered
void sim_io_printf_filtered
void sim_io_printf_filtered
(const char *msg, ...) __attribute__ ((format (printf, 1, 2)));
(const char *msg, ...) __attribute__ ((format (printf, 1, 2)));
 
 
void NORETURN error
void NORETURN error
(const char *msg, ...);
(const char *msg, ...);
 
 
 
 
/* External environment:
/* External environment:
 
 
   Some HOST OS's require regular polling so that external events such
   Some HOST OS's require regular polling so that external events such
   as GUI io can be handled. */
   as GUI io can be handled. */
 
 
void sim_io_poll_quit
void sim_io_poll_quit
(void);
(void);
 
 
 
 
 
 
/* Model I/O:
/* Model I/O:
 
 
   These functions provide the interface between the modeled targets
   These functions provide the interface between the modeled targets
   standard input and output streams and the hosts external
   standard input and output streams and the hosts external
   environment.
   environment.
 
 
   The underlying model is responsible for co-ordinating I/O
   The underlying model is responsible for co-ordinating I/O
   interactions such as:
   interactions such as:
 
 
        main()
        main()
        {
        {
          const char mess[] = "Hello World\r\n";
          const char mess[] = "Hello World\r\n";
          int out;
          int out;
          out = dup(1);
          out = dup(1);
          close(1);
          close(1);
          write(out, mess, sizeof(mess))
          write(out, mess, sizeof(mess))
        }
        }
 
 
   That is to say, the underlying model would, in implementing dup()
   That is to say, the underlying model would, in implementing dup()
   recorded the fact that any output directed at fid-OUT should be
   recorded the fact that any output directed at fid-OUT should be
   displayed using sim_io_write_stdout().  While for the code stub:
   displayed using sim_io_write_stdout().  While for the code stub:
 
 
        main()
        main()
        {
        {
          const char mess[] = "Hello World\r\n";
          const char mess[] = "Hello World\r\n";
          int out;
          int out;
          close(1);
          close(1);
          out = open("output", 0x0001|0x0200, 0); // write+create
          out = open("output", 0x0001|0x0200, 0); // write+create
          out = dup(1);
          out = dup(1);
          write(out, mess, sizeof(mess))
          write(out, mess, sizeof(mess))
        }
        }
 
 
   would result in output to fid-1 being directed towards the file
   would result in output to fid-1 being directed towards the file
   "output". */
   "output". */
 
 
 
 
int
int
sim_io_write_stdout
sim_io_write_stdout
(const char *buf,
(const char *buf,
 int sizeof_buf);
 int sizeof_buf);
 
 
int
int
sim_io_write_stderr
sim_io_write_stderr
(const char *buf,
(const char *buf,
 int sizeof_buf);
 int sizeof_buf);
 
 
/* read results */
/* read results */
enum { sim_io_eof = -1, sim_io_not_ready = -2, }; /* See: IEEE 1275 */
enum { sim_io_eof = -1, sim_io_not_ready = -2, }; /* See: IEEE 1275 */
 
 
int
int
sim_io_read_stdin
sim_io_read_stdin
(char *buf,
(char *buf,
 int sizeof_buf);
 int sizeof_buf);
 
 
#define flush_stdoutput sim_io_flush_stdoutput
#define flush_stdoutput sim_io_flush_stdoutput
void sim_io_flush_stdoutput
void sim_io_flush_stdoutput
(void);
(void);
 
 
 
 
/* Simulator instance.  */
/* Simulator instance.  */
extern psim *simulator;
extern psim *simulator;
 
 
 
 
/* Memory management with an allocator that clears memory before use. */
/* Memory management with an allocator that clears memory before use. */
 
 
void *zalloc
void *zalloc
(long size);
(long size);
 
 
#define ZALLOC(TYPE) (TYPE*)zalloc(sizeof (TYPE))
#define ZALLOC(TYPE) (TYPE*)zalloc(sizeof (TYPE))
 
 
void zfree(void*);
void zfree(void*);
 
 
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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