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

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /or1k/trunk/or1ksim/vapi
    from Rev 1751 to Rev 1765
    Reverse comparison

Rev 1751 → Rev 1765

/vapi.c
0,0 → 1,792
/* vapi.c -- Verification API Interface
 
Copyright (C) 2001, Marko Mlinar, markom@opencores.org
Copyright (C) 2008 Embecosm Limited
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
This file is part of OpenRISC 1000 Architectural Simulator.
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 the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>. */
 
/* This program is commented throughout in a fashion suitable for processing
with Doxygen. */
 
 
/* Autoconf and/or portability configuration */
#include "config.h"
#include "port.h"
 
/* System includes */
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/tcp.h>
 
/* Package includes */
#include "sim-config.h"
#include "vapi.h"
 
 
static unsigned int serverIP = 0;
 
static unsigned int server_fd = 0;
static unsigned int nhandlers = 0;
 
static int tcp_level = 0;
 
static struct vapi_handler
{
int fd;
unsigned long base_id, num_ids;
void (*read_func) (unsigned long, unsigned long, void *);
void *priv_dat;
struct vapi_handler *next;
int temp;
} *vapi_handler = NULL;
 
/* Structure for polling, it is cached, that it doesn't have to be rebuilt each time */
static struct pollfd *fds = NULL;
static int nfds = 0;
 
/* Rebuilds the fds structures; see fds. */
void
rebuild_fds ()
{
struct vapi_handler *t;
if (fds)
free (fds);
fds = (struct pollfd *) malloc (sizeof (struct pollfd) * (nhandlers + 1));
if (!fds)
{
fprintf (stderr, "FATAL: Out of memory.\n");
exit (1);
}
 
nfds = 0;
fds[nfds].fd = server_fd;
fds[nfds].events = POLLIN;
fds[nfds++].revents = 0;
 
for (t = vapi_handler; t; t = t->next)
{
if (t->fd)
{
t->temp = nfds;
fds[nfds].fd = t->fd;
fds[nfds].events = POLLIN;
fds[nfds++].revents = 0;
}
else
t->temp = -1;
}
}
 
/* Determines whether a certain handler handles an ID */
static int
handler_fits_id (const struct vapi_handler *t, unsigned long id)
{
return ((id >= t->base_id) && (id < t->base_id + t->num_ids));
}
 
/* Finds a handler with given ID, return it, NULL if not found. */
static struct vapi_handler *
find_handler (unsigned long id)
{
struct vapi_handler *t = vapi_handler;
while (t && !handler_fits_id (t, id))
t = t->next;
return t;
}
 
/* Adds a handler with given id and returns it. */
static struct vapi_handler *
add_handler (unsigned long base_id, unsigned long num_ids)
{
struct vapi_handler **t = &vapi_handler;
struct vapi_handler *tt;
while ((*t))
t = &(*t)->next;
tt = (struct vapi_handler *) malloc (sizeof (struct vapi_handler));
tt->next = NULL;
tt->base_id = base_id;
tt->num_ids = num_ids;
tt->read_func = NULL;
tt->priv_dat = NULL;
tt->fd = 0;
(*t) = tt;
free (fds);
fds = NULL;
nhandlers++;
rebuild_fds ();
return tt;
}
 
void
vapi_write_log_file (VAPI_COMMAND command, unsigned long devid,
unsigned long data)
{
if (!runtime.vapi.vapi_file)
return;
if (!config.vapi.hide_device_id && devid <= VAPI_MAX_DEVID)
fprintf (runtime.vapi.vapi_file, "%04lx", devid);
fprintf (runtime.vapi.vapi_file, "%1x%08lx\n", command, data);
}
 
static int
vapi_write_stream (int fd, void *buf, int len)
{
int n;
char *w_buf = (char *) buf;
struct pollfd block;
 
while (len)
{
if ((n = write (fd, w_buf, len)) < 0)
{
switch (errno)
{
case EWOULDBLOCK: /* or EAGAIN */
/* We've been called on a descriptor marked
for nonblocking I/O. We better simulate
blocking behavior. */
block.fd = fd;
block.events = POLLOUT;
block.revents = 0;
poll (&block, 1, -1);
continue;
case EINTR:
continue;
case EPIPE:
close (fd);
fd = 0;
return -1;
default:
return -1;
}
}
else
{
len -= n;
w_buf += n;
}
}
return 0;
}
 
static int
vapi_read_stream (int fd, void *buf, int len)
{
int n;
char *r_buf = (char *) buf;
struct pollfd block;
 
while (len)
{
if ((n = read (fd, r_buf, len)) < 0)
{
switch (errno)
{
case EWOULDBLOCK: /* or EAGAIN */
/* We've been called on a descriptor marked
for nonblocking I/O. We better simulate
blocking behavior. */
block.fd = fd;
block.events = POLLIN;
block.revents = 0;
poll (&block, 1, -1);
continue;
case EINTR:
continue;
default:
return -1;
}
}
else if (n == 0)
{
close (fd);
fd = 0;
return -1;
}
else
{
len -= n;
r_buf += n;
}
}
return 0;
}
 
/* Added by CZ 24/05/01 */
int
get_server_socket (const char *name, const char *proto, int port)
{
struct servent *service;
struct protoent *protocol;
struct sockaddr_in sa;
struct hostent *hp;
int sockfd;
socklen_t len;
char myname[256];
int flags;
char sTemp[256];
 
/* First, get the protocol number of TCP */
if (!(protocol = getprotobyname (proto)))
{
sprintf (sTemp, "Unable to load protocol \"%s\"", proto);
perror (sTemp);
return 0;
}
tcp_level = protocol->p_proto; /* Save for later */
 
/* If we weren't passed a non standard port, get the port
from the services directory. */
if (!port)
{
if ((service = getservbyname (name, protocol->p_name)))
port = ntohs (service->s_port);
}
 
/* Create the socket using the TCP protocol */
if ((sockfd = socket (PF_INET, SOCK_STREAM, protocol->p_proto)) < 0)
{
perror ("Unable to create socket");
return 0;
}
 
flags = 1;
if (setsockopt
(sockfd, SOL_SOCKET, SO_REUSEADDR, (const char *) &flags,
sizeof (int)) < 0)
{
sprintf (sTemp, "Can not set SO_REUSEADDR option on socket %d", sockfd);
perror (sTemp);
close (sockfd);
return 0;
}
 
/* The server should also be non blocking. Get the current flags. */
if (fcntl (sockfd, F_GETFL, &flags) < 0)
{
sprintf (sTemp, "Unable to get flags for socket %d", sockfd);
perror (sTemp);
close (sockfd);
return 0;
}
 
/* Set the nonblocking flag */
if (fcntl (sockfd, F_SETFL, flags | O_NONBLOCK) < 0)
{
sprintf (sTemp, "Unable to set flags for socket %d to value 0x%08x",
sockfd, flags | O_NONBLOCK);
perror (sTemp);
close (sockfd);
return 0;
}
 
/* Find out what our address is */
memset (&sa, 0, sizeof (struct sockaddr_in));
gethostname (myname, sizeof (myname));
if (!(hp = gethostbyname (myname)))
{
perror ("Unable to read hostname");
close (sockfd);
return 0;
}
 
/* Bind our socket to the appropriate address */
sa.sin_family = hp->h_addrtype;
sa.sin_port = htons (port);
if (bind (sockfd, (struct sockaddr *) &sa, sizeof (struct sockaddr_in)) < 0)
{
sprintf (sTemp, "Unable to bind socket %d to port %d", sockfd, port);
perror (sTemp);
close (sockfd);
return 0;
}
serverIP = sa.sin_addr.s_addr;
len = sizeof (struct sockaddr_in);
if (getsockname (sockfd, (struct sockaddr *) &sa, &len) < 0)
{
sprintf (sTemp, "Unable to get socket information for socket %d",
sockfd);
perror (sTemp);
close (sockfd);
return 0;
}
runtime.vapi.server_port = ntohs (sa.sin_port);
 
/* Set the backlog to 1 connections */
if (listen (sockfd, 1) < 0)
{
sprintf (sTemp, "Unable to set backlog on socket %d to %d", sockfd, 1);
perror (sTemp);
close (sockfd);
return 0;
}
 
return sockfd;
}
 
static void
server_request ()
{
struct sockaddr_in sa;
struct sockaddr *addr = (struct sockaddr *) &sa;
socklen_t len = sizeof (struct sockaddr_in);
int fd = accept (server_fd, addr, &len);
int on_off = 0; /* Turn off Nagel's algorithm on the socket */
int flags;
char sTemp[256];
 
if (fd < 0)
{
/* This is valid, because a connection could have started,
and then terminated due to a protocol error or user
initiation before the accept could take place. */
if (errno != EWOULDBLOCK && errno != EAGAIN)
{
perror ("accept");
close (server_fd);
server_fd = 0;
runtime.vapi.enabled = 0;
serverIP = 0;
}
return;
}
 
if (fcntl (fd, F_GETFL, &flags) < 0)
{
sprintf (sTemp, "Unable to get flags for vapi socket %d", fd);
perror (sTemp);
close (fd);
return;
}
 
if (fcntl (fd, F_SETFL, flags | O_NONBLOCK) < 0)
{
sprintf (sTemp,
"Unable to set flags for vapi socket %d to value 0x%08x", fd,
flags | O_NONBLOCK);
perror (sTemp);
close (fd);
return;
}
 
if (setsockopt (fd, tcp_level, TCP_NODELAY, &on_off, sizeof (int)) < 0)
{
sprintf (sTemp,
"Unable to disable Nagel's algorithm for socket %d.\nsetsockopt",
fd);
perror (sTemp);
close (fd);
return;
}
 
/* Install new handler */
{
unsigned long id;
struct vapi_handler *t;
if (vapi_read_stream (fd, &id, sizeof (id)))
{
perror ("Cannot get id");
close (fd);
return;
}
t = find_handler (id);
if (t)
{
if (t->fd)
{
fprintf (stderr,
"WARNING: Test with id %lx already connected. Ignoring.\n",
id);
close (fd);
return;
}
else
{
t->fd = fd;
rebuild_fds ();
}
}
else
{
fprintf (stderr,
"WARNING: Test with id %lx not registered. Ignoring.\n", id);
close (fd); /* kill the connection */
return;
}
if (config.sim.verbose)
PRINTF ("\nConnection with test (id %lx) established.\n", id);
}
}
 
static int
write_packet (unsigned long id, unsigned long data)
{
struct vapi_handler *t = find_handler (id);
if (!t || !t->fd)
return 1;
id = htonl (id);
if (vapi_write_stream (t->fd, &id, sizeof (id)) < 0)
return 1;
data = htonl (data);
if (vapi_write_stream (t->fd, &data, sizeof (data)) < 0)
return 1;
return 0;
}
 
static int
read_packet (int fd, unsigned long *id, unsigned long *data)
{
if (fd <= 0)
return 1;
if (vapi_read_stream (fd, id, sizeof (unsigned long)) < 0)
return 1;
*id = ntohl (*id);
if (vapi_read_stream (fd, data, sizeof (unsigned long)) < 0)
return 1;
*data = ntohl (*data);
return 0;
}
 
static void
vapi_request (struct vapi_handler *t)
{
unsigned long id, data;
 
if (read_packet (t->fd, &id, &data))
{
if (t->fd > 0)
{
perror ("vapi read");
close (t->fd);
t->fd = 0;
rebuild_fds ();
}
return;
}
 
vapi_write_log_file (VAPI_COMMAND_REQUEST, id, data);
 
/* This packet may be for another handler */
if (!handler_fits_id (t, id))
t = find_handler (id);
if (!t || !t->read_func)
fprintf (stderr,
"WARNING: Received packet for undefined id %08lx, data %08lx\n",
id, data);
else
t->read_func (id, data, t->priv_dat);
}
 
void
vapi_check ()
{
struct vapi_handler *t;
 
if (!server_fd || !fds)
{
fprintf (stderr, "FATAL: Unable to maintain VAPI server.\n");
exit (1);
}
 
/* Handle everything in queue. */
while (1)
{
switch (poll (fds, nfds, 0))
{
case -1:
if (errno == EINTR)
continue;
perror ("poll");
if (server_fd)
close (server_fd);
runtime.vapi.enabled = 0;
serverIP = 0;
return;
case 0: /* Nothing interesting going on */
return;
default:
/* Handle the vapi ports first. */
for (t = vapi_handler; t; t = t->next)
if (t->temp >= 0 && fds[t->temp].revents)
vapi_request (t);
 
if (fds[0].revents)
{
if (fds[0].revents & POLLIN)
server_request ();
else
{ /* Error Occurred */
fprintf (stderr,
"Received flags 0x%08x on server. Shutting down.\n",
fds[0].revents);
if (server_fd)
close (server_fd);
server_fd = 0;
runtime.vapi.enabled = 0;
serverIP = 0;
}
}
break;
} /* End of switch statement */
} /* End of while statement */
}
 
/* Inits the VAPI, according to sim-config */
int
vapi_init ()
{
nhandlers = 0;
vapi_handler = NULL;
if (!runtime.vapi.enabled)
return 0; /* Nothing to do */
 
runtime.vapi.server_port = config.vapi.server_port;
if (!runtime.vapi.server_port)
{
fprintf (stderr, "WARNING: server_port = 0, shutting down VAPI\n");
runtime.vapi.enabled = 0;
return 1;
}
if ((server_fd =
get_server_socket ("or1ksim", "tcp", runtime.vapi.server_port)))
PRINTF ("VAPI Server started on port %d\n", runtime.vapi.server_port);
else
{
perror ("Connection");
return 1;
}
 
rebuild_fds ();
 
if ((runtime.vapi.vapi_file = fopen (config.vapi.vapi_fn, "wt+")) == NULL)
fprintf (stderr, "WARNING: cannot open VAPI log file\n");
 
return 0;
}
 
/* Closes the VAPI */
void
vapi_done ()
{
int i;
struct vapi_handler *t = vapi_handler;
 
for (i = 0; i < nfds; i++)
if (fds[i].fd)
close (fds[i].fd);
server_fd = 0;
runtime.vapi.enabled = 0;
serverIP = 0;
free (fds);
fds = 0;
if (runtime.vapi.vapi_file)
{
/* Mark end of simulation */
vapi_write_log_file (VAPI_COMMAND_END, 0, 0);
fclose (runtime.vapi.vapi_file);
}
 
while (vapi_handler)
{
t = vapi_handler;
vapi_handler = vapi_handler->next;
free (t);
}
}
 
/* Installs a vapi handler for one VAPI id */
void
vapi_install_handler (unsigned long id,
void (*read_func) (unsigned long, unsigned long,
void *), void *dat)
{
vapi_install_multi_handler (id, 1, read_func, dat);
}
 
/* Installs a vapi handler for many VAPI id */
void
vapi_install_multi_handler (unsigned long base_id, unsigned long num_ids,
void (*read_func) (unsigned long, unsigned long,
void *), void *dat)
{
struct vapi_handler *tt;
 
if (read_func == NULL)
{
struct vapi_handler **t = &vapi_handler;
while ((*t) && !handler_fits_id (*t, base_id))
t = &(*t)->next;
if (!t)
{
fprintf (stderr, "Cannot uninstall VAPI read handler from id %lx\n",
base_id);
exit (1);
}
tt = *t;
(*t) = (*t)->next;
free (tt);
nhandlers--;
}
else
{
tt = find_handler (base_id);
if (!tt)
{
tt = add_handler (base_id, num_ids);
tt->read_func = read_func;
tt->priv_dat = dat;
}
else
{
tt->read_func = read_func;
tt->priv_dat = dat;
rebuild_fds ();
}
}
}
 
/* Returns number of unconnected handles. */
int
vapi_num_unconnected (int printout)
{
struct vapi_handler *t = vapi_handler;
int numu = 0;
for (; t; t = t->next)
{
if (!t->fd)
{
numu++;
if (printout)
{
if (t->num_ids == 1)
PRINTF (" 0x%lx", t->base_id);
else
PRINTF (" 0x%lx..0x%lx", t->base_id,
t->base_id + t->num_ids - 1);
}
}
}
return numu;
}
 
/* Sends a packet to specified test */
void
vapi_send (unsigned long id, unsigned long data)
{
vapi_write_log_file (VAPI_COMMAND_SEND, id, data);
write_packet (id, data);
}
 
/*
int main ()
{
runtime.vapi.enabled = 1;
config.vapi.server_port = 9999;
vapi_init ();
while (1) {
vapi_check();
usleep(1);
}
vapi_done ();
}*/
 
/*---------------------------------------------------[ VAPI configuration ]---*/
 
static void
vapi_enabled (union param_val val, void *dat)
{
config.vapi.enabled = val.int_val;
}
 
 
/*---------------------------------------------------------------------------*/
/*!Set the VAPI server port
 
Ensure the value chosen is valid
 
@param[in] val The value to use
@param[in] dat The config data structure (not used here) */
/*---------------------------------------------------------------------------*/
static void
vapi_server_port (union param_val val, void *dat)
{
if ((val.int_val < 1) || (val.int_val > 65535))
{
fprintf (stderr, "Warning: invalid VAPI port specified: ignored\n");
}
else
{
config.vapi.server_port = val.int_val;
}
} /* vapi_server_port() */
 
 
static void
vapi_log_enabled (union param_val val, void *dat)
{
config.vapi.log_enabled = val.int_val;
}
 
static void
vapi_hide_device_id (union param_val val, void *dat)
{
config.vapi.hide_device_id = val.int_val;
}
 
 
/*---------------------------------------------------------------------------*/
/*!Set the log file
 
Free any existing string.
 
@param[in] val The value to use
@param[in] dat The config data structure (not used here) */
/*---------------------------------------------------------------------------*/
static void
vapi_log_fn (union param_val val,
void *dat)
{
if (NULL != config.vapi.vapi_fn)
{
free (config.vapi.vapi_fn);
}
 
config.vapi.vapi_fn = strdup (val.str_val);
 
} /* vapi_log_fn() */
 
 
void
reg_vapi_sec (void)
{
struct config_section *sec = reg_config_sec ("VAPI", NULL, NULL);
 
reg_config_param (sec, "enabled", paramt_int, vapi_enabled);
reg_config_param (sec, "server_port", paramt_int, vapi_server_port);
reg_config_param (sec, "log_enabled", paramt_int, vapi_log_enabled);
reg_config_param (sec, "hide_device_id", paramt_int, vapi_hide_device_id);
reg_config_param (sec, "vapi_log_file", paramt_str, vapi_log_fn);
reg_config_param (sec, "vapi_log_fn", paramt_str, vapi_log_fn);
}
vapi.c Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: Makefile.in =================================================================== --- Makefile.in (nonexistent) +++ Makefile.in (revision 1765) @@ -0,0 +1,469 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile -- Makefile for peripherals simulation +# Copyright (C) 1999 Damjan Lampret, lampret@opencores.org +# +# This file is part of OpenRISC 1000 Architectural Simulator. +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = vapi +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libvapi_la_LIBADD = +am_libvapi_la_OBJECTS = vapi.lo +libvapi_la_OBJECTS = $(am_libvapi_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libvapi_la_SOURCES) +DIST_SOURCES = $(libvapi_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +ARFLAGS = @ARFLAGS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_DIR = @BUILD_DIR@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_ARCH = @CPU_ARCH@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUGFLAGS = @DEBUGFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INCLUDES = @INCLUDES@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LOCAL_CFLAGS = @LOCAL_CFLAGS@ +LOCAL_DEFS = @LOCAL_DEFS@ +LOCAL_LDFLAGS = @LOCAL_LDFLAGS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MAKE_SHELL = @MAKE_SHELL@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POW_LIB = @POW_LIB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SUMVERSION = @SUMVERSION@ +TERMCAP_LIB = @TERMCAP_LIB@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libvapi.la +libvapi_la_SOURCES = vapi.c \ + vapi.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu vapi/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu vapi/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libvapi.la: $(libvapi_la_OBJECTS) $(libvapi_la_DEPENDENCIES) + $(LINK) $(libvapi_la_OBJECTS) $(libvapi_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vapi.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: vapi.h =================================================================== --- vapi.h (nonexistent) +++ vapi.h (revision 1765) @@ -0,0 +1,64 @@ +/* vapi.h - Verification API Interface + + Copyright (C) 2001, Marko Mlinar, markom@opencores.org + Copyright (C) 2008 Embecosm Limited + + Contributor Jeremy Bennett + + This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator. + + 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 the Free + Software Foundation; either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see . */ + +/* This program is commented throughout in a fashion suitable for processing + with Doxygen. */ + + +#ifndef VAPI__H +#define VAPI__H + +/*! Maximum value for VAPI device id */ +#define VAPI_MAX_DEVID 0xFFFF + +/* Types of commands that can be written to the VAPI log file */ +typedef enum +{ + VAPI_COMMAND_REQUEST = 0, /* Data coming from outside world to device */ + VAPI_COMMAND_SEND = 1, /* Device writing data to the outside world */ + VAPI_COMMAND_END = 2 /* End of log for device */ +} VAPI_COMMAND; + +/* Prototypes for external use */ +extern int vapi_init (); +extern void vapi_done (); +extern void vapi_install_handler (unsigned long id, + void (*read_func) (unsigned long, + unsigned long, + void *), + void *dat); +extern void vapi_install_multi_handler (unsigned long base_id, + unsigned long num_ids, + void (*read_func) (unsigned long, + unsigned long, + void *), + void *dat); +extern void vapi_check (); +extern int vapi_num_unconnected (int printout); +extern void vapi_send (unsigned long id, + unsigned long data); +extern void vapi_write_log_file (VAPI_COMMAND command, + unsigned long device_id, + unsigned long data); +extern void reg_vapi_sec (); + +#endif /* VAPI__H */
vapi.h Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: Makefile.am =================================================================== --- Makefile.am (nonexistent) +++ Makefile.am (revision 1765) @@ -0,0 +1,23 @@ +# Makefile -- Makefile for peripherals simulation +# Copyright (C) 1999 Damjan Lampret, lampret@opencores.org +# +# This file is part of OpenRISC 1000 Architectural Simulator. +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +noinst_LTLIBRARIES = libvapi.la +libvapi_la_SOURCES = vapi.c \ + vapi.h
Makefile.am Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: . =================================================================== --- . (nonexistent) +++ . (revision 1765)
. Property changes : Added: svn:ignore ## -0,0 +1,2 ## +Makefile +.deps

powered by: WebSVN 2.1.0

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