URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/or1ksim/testsuite/test-code/lib-inttest
- from Rev 428 to Rev 432
- ↔ Reverse comparison
Rev 428 → Rev 432
/lib-inttest-level.c
File deleted
lib-inttest-level.c
Property changes :
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: lib-inttest-edge.c
===================================================================
--- lib-inttest-edge.c (revision 428)
+++ lib-inttest-edge.c (nonexistent)
@@ -1,230 +0,0 @@
-/* lib-inttest-edge.c. Test of Or1ksim library edge triggered interrupt funcs.
-
- Copyright (C) 1999-2006 OpenCores
- Copyright (C) 2010 Embecosm Limited
-
- Contributors various OpenCores participants
- Contributor Jeremy Bennett
-
- 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 . */
-
-/* ----------------------------------------------------------------------------
- This code is commented throughout for use with Doxygen.
- --------------------------------------------------------------------------*/
-
-#include
-#include
-
-#include "or1ksim.h"
-
-
-/*! Number of interrupts in PIC */
-#define NUM_INTS 32
-
-/*! Globally shared pointer to the interrupts */
-char **intv;
-
-/*! Number of interrupts to process */
-int intc;
-
-
-/* --------------------------------------------------------------------------*/
-/*!Trigger the next interrupt
-
- Generate the next edge triggered interrupt. Put out a message if doing so,
- and warn if the interrupt would be invalid.
-
- @return 1 (true) if an interrupt was triggered, 0 (false) otherwise. */
-/* --------------------------------------------------------------------------*/
-static int
-do_next_int ()
-{
- static int next_int = 0; /* Next interrupt to process */
-
- while (next_int < intc)
- {
- int inum = atoi (intv[next_int++]);
-
- if ((0 <= inum) && (inum < NUM_INTS))
- {
- printf ("Triggering interrupt %d\n", inum);
- or1ksim_interrupt (inum);
- return 1;
- }
- else
- {
- printf ("Warning: Invalid interrupt # %d - ignored\n", inum);
- }
- }
-
- return 0; /* No more interrupts to trigger */
-
-} /* do_next_int () */
-
-
-/* --------------------------------------------------------------------------*/
-/*!Read upcall
-
- Upcall from Or1ksim to read a word from an external peripheral. If called
- this will trigger an interrupt.
-
- @param[in] class_ptr A handle pass back from the initalization. Intended
- for C++ callers, not used here.
- @param[in] addr Address to read from. Ignored here.
- @param[in] mask Byte mask for the read. Ignored here.
- @param[out] rdata Buffer for the data read. Ignored here.
- @param[in] data_len Number of bytes in mask and rdata.
-
- @return Zero on success, non-zero on failure. Always zero here. */
-/* --------------------------------------------------------------------------*/
-static int
-read_upcall (void *class_ptr,
- unsigned long int addr,
- unsigned char mask[],
- unsigned char rdata[],
- int data_len)
-{
- do_next_int ();
-
- return 0; /* Success */
-
-} /* read_upcall () */
-
-
-/* --------------------------------------------------------------------------*/
-/*!Write upcall
-
- Upcall from Or1ksim to write a word to an external peripheral. If called
- this will trigger an interrupt.
-
- @param[in] class_ptr A handle pass back from the initalization. Intended
- for C++ callers, not used here.
- @param[in] addr Address to write to. Ignored here.
- @param[in] mask Byte mask for the write. Ignored here.
- @param[in] wdata The data to write. Ignored here.
- @param[in] data_len Number of bytes in mask and rdata.
-
- @return Zero on success, non-zero on failure. Always zero here. */
-/* --------------------------------------------------------------------------*/
-static int
-write_upcall (void *class_ptr,
- unsigned long int addr,
- unsigned char mask[],
- unsigned char wdata[],
- int data_len)
-{
- do_next_int ();
-
- return 0; /* Success */
-
-} /* write_upcall () */
-
-
-/* --------------------------------------------------------------------------*/
-/*!Main program
-
- Build an or1ksim program using the library which loads a program and config
- from the command line, and then drives interrupts. Usage:
-
- lib-inttest-edge ...
-
- is run for repeated perios of , during which it
- will make upcalls. Between each period and during each upcall an edge based
- interrupt will be triggered, until all interrupts listed have been
- triggered.
-
- @param[in] argc Number of elements in argv
- @param[in] argv Vector of program name and arguments
-
- @return Return code for the program. */
-/* --------------------------------------------------------------------------*/
-int
-main (int argc,
- char *argv[])
-{
- /* Parse args */
- if (argc < 5)
- {
- fprintf (stderr,
- "usage: lib-inttest-edge "
- " ...\n");
- return 1;
- }
-
- int duration_ms = atoi (argv[3]);
- double duration = (double) duration_ms / 1.0e3;
-
- if (duration_ms <= 0)
- {
- fprintf (stderr, "ERROR. Duration must be positive number of ms\n");
- return 1;
- }
-
- /* Dummy argv array to pass arguments to or1ksim_init. Varies depending on
- whether an image file is specified. */
- int dummy_argc;
- char *dummy_argv[5];
-
- dummy_argv[0] = "libsim";
- dummy_argv[1] = "-q";
- dummy_argv[2] = "-f";
- dummy_argv[3] = argv[1];
- dummy_argv[4] = argv[2];
-
- dummy_argc = 5;
-
- /* Initialize the program. Put the initialization message afterwards, or it
- will get swamped by the Or1ksim header. */
- if (0 == or1ksim_init (dummy_argc, dummy_argv, NULL, &read_upcall,
- &write_upcall))
- {
- printf ("Initalization succeeded.\n");
- }
- else
- {
- printf ("Initalization failed.\n");
- return 1;
- }
-
- /* Do each interrupt in turn. Set up the shared pointer to the interrupts
- and counter. */
- intv = &(argv[4]);
- intc = argc - 4;
-
- do
- {
- /* Run the code */
- if (OR1KSIM_RC_OK != or1ksim_run (duration))
- {
- printf ("ERROR: run failed\n");
- return 1;
- }
- }
- while (do_next_int ());
-
- /* One more run, to allow interrupt handler enough time to finish
- processing. */
- if (OR1KSIM_RC_OK != or1ksim_run (duration))
- {
- printf ("ERROR: run failed\n");
- return 1;
- }
-
- /* All interrupts should have been handled. */
- printf ("Test completed successfully.\n");
- return 0;
-
-} /* main () */
lib-inttest-edge.c
Property changes :
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: Makefile.in
===================================================================
--- Makefile.in (revision 428)
+++ Makefile.in (revision 432)
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -59,7 +59,7 @@
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-check_PROGRAMS = lib-inttest-edge$(EXEEXT) lib-inttest-level$(EXEEXT)
+check_PROGRAMS = lib-inttest$(EXEEXT)
subdir = testsuite/test-code/lib-inttest
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -73,12 +73,9 @@
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-am_lib_inttest_edge_OBJECTS = lib-inttest-edge.$(OBJEXT)
-lib_inttest_edge_OBJECTS = $(am_lib_inttest_edge_OBJECTS)
-lib_inttest_edge_DEPENDENCIES = $(top_builddir)/libsim.la
-am_lib_inttest_level_OBJECTS = lib-inttest-level.$(OBJEXT)
-lib_inttest_level_OBJECTS = $(am_lib_inttest_level_OBJECTS)
-lib_inttest_level_DEPENDENCIES = $(top_builddir)/libsim.la
+am_lib_inttest_OBJECTS = lib-inttest.$(OBJEXT)
+lib_inttest_OBJECTS = $(am_lib_inttest_OBJECTS)
+lib_inttest_DEPENDENCIES = $(top_builddir)/libsim.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -92,9 +89,8 @@
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(lib_inttest_edge_SOURCES) $(lib_inttest_level_SOURCES)
-DIST_SOURCES = $(lib_inttest_edge_SOURCES) \
- $(lib_inttest_level_SOURCES)
+SOURCES = $(lib_inttest_SOURCES)
+DIST_SOURCES = $(lib_inttest_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -230,14 +226,8 @@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-
-# Edge based interrupt
-lib_inttest_edge_SOURCES = lib-inttest-edge.c
-lib_inttest_edge_LDADD = $(top_builddir)/libsim.la
-
-# Level based interrupt
-lib_inttest_level_SOURCES = lib-inttest-level.c
-lib_inttest_level_LDADD = $(top_builddir)/libsim.la
+lib_inttest_SOURCES = lib-inttest.c
+lib_inttest_LDADD = $(top_builddir)/libsim.la
all: all-am
.SUFFIXES:
@@ -281,12 +271,9 @@
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-lib-inttest-edge$(EXEEXT): $(lib_inttest_edge_OBJECTS) $(lib_inttest_edge_DEPENDENCIES)
- @rm -f lib-inttest-edge$(EXEEXT)
- $(LINK) $(lib_inttest_edge_OBJECTS) $(lib_inttest_edge_LDADD) $(LIBS)
-lib-inttest-level$(EXEEXT): $(lib_inttest_level_OBJECTS) $(lib_inttest_level_DEPENDENCIES)
- @rm -f lib-inttest-level$(EXEEXT)
- $(LINK) $(lib_inttest_level_OBJECTS) $(lib_inttest_level_LDADD) $(LIBS)
+lib-inttest$(EXEEXT): $(lib_inttest_OBJECTS) $(lib_inttest_DEPENDENCIES)
+ @rm -f lib-inttest$(EXEEXT)
+ $(LINK) $(lib_inttest_OBJECTS) $(lib_inttest_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -294,8 +281,7 @@
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib-inttest-edge.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib-inttest-level.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib-inttest.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
/Makefile.am
24,17 → 24,8
# ----------------------------------------------------------------------------- |
|
|
# Test programs of the library interrupt driving functions. Two versions, one |
# to drive edge based interrupts, one to drive level based interrupts. |
check_PROGRAMS = lib-inttest-edge \ |
lib-inttest-level |
# Test program of the library interrupt driving functions. |
check_PROGRAMS = lib-inttest |
|
# Edge based interrupt |
lib_inttest_edge_SOURCES = lib-inttest-edge.c |
|
lib_inttest_edge_LDADD = $(top_builddir)/libsim.la |
|
# Level based interrupt |
lib_inttest_level_SOURCES = lib-inttest-level.c |
|
lib_inttest_level_LDADD = $(top_builddir)/libsim.la |
lib_inttest_SOURCES = lib-inttest.c |
lib_inttest_LDADD = $(top_builddir)/libsim.la |