summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k/gen68360/timer
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/m68k/gen68360/timer')
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/timer/Makefile.in53
-rw-r--r--c/src/lib/libbsp/m68k/gen68360/timer/timer.c95
2 files changed, 148 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/m68k/gen68360/timer/Makefile.in b/c/src/lib/libbsp/m68k/gen68360/timer/Makefile.in
new file mode 100644
index 0000000000..79c8438431
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/timer/Makefile.in
@@ -0,0 +1,53 @@
+#
+# $Id$
+#
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH=@srcdir@
+
+PGM=${ARCH}/timer.rel
+
+# C source names, if any, go here -- minus the .c
+C_PIECES=timer
+C_FILES=$(C_PIECES:%=%.c)
+C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
+
+H_FILES=
+
+SRCS=$(C_FILES) $(H_FILES)
+OBJS=$(C_O_FILES)
+
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+#
+# (OPTIONAL) Add local stuff here using +=
+#
+
+DEFINES +=
+CPPFLAGS +=
+CFLAGS +=
+
+LD_PATHS +=
+LD_LIBS +=
+LDFLAGS +=
+
+#
+# Add your list of files to delete here. The config files
+# already know how to delete some stuff, so you may want
+# to just run 'make clean' first to see what gets missed.
+# 'make clobber' already includes 'make clean'
+#
+
+CLEAN_ADDITIONS +=
+CLOBBER_ADDITIONS +=
+
+${PGM}: ${SRCS} ${OBJS}
+ $(make-rel)
+
+all: ${ARCH} $(SRCS) $(PGM)
+
+# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
+install: all
diff --git a/c/src/lib/libbsp/m68k/gen68360/timer/timer.c b/c/src/lib/libbsp/m68k/gen68360/timer/timer.c
new file mode 100644
index 0000000000..7d87c1397a
--- /dev/null
+++ b/c/src/lib/libbsp/m68k/gen68360/timer/timer.c
@@ -0,0 +1,95 @@
+/*
+ * Timer_init()
+ *
+ * Use TIMER 1 and TIMER 2 for Timing Test Suite
+ *
+ * The hardware on the MC68360 makes these routines very simple.
+ *
+ * Based on the `gen68302' board support package, and covered by the
+ * original distribution terms.
+ *
+ * W. Eric Norum
+ * Saskatchewan Accelerator Laboratory
+ * University of Saskatchewan
+ * Saskatoon, Saskatchewan, CANADA
+ * eric@skatter.usask.ca
+ *
+ * $Id$
+ */
+
+/*
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * NOTE: It is important that the timer start/stop overhead be
+ * determined when porting or modifying this code.
+ *
+ * COPYRIGHT (c) 1989-1997.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may in
+ * the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ */
+
+#include <rtems.h>
+#include <bsp.h>
+#include "m68360.h"
+
+void
+Timer_initialize (void)
+{
+ /*
+ * Reset timers 1 and 2
+ */
+ m360.tgcr &= ~0x00FF;
+ m360.tcn1 = 0;
+ m360.tcn2 = 0;
+ m360.ter1 = 0xFFFF;
+ m360.ter2 = 0xFFFF;
+
+ /*
+ * Cascade timers 1 and 2
+ */
+ m360.tgcr |= 0x0080;
+
+ /*
+ * Configure timers 1 and 2 to a single 32-bit, 1 MHz timer.
+ * HARDWARE:
+ * Change the `25' to match your processor clock
+ */
+ m360.tmr2 = ((25-1) << 8) | 0x2;
+ m360.tmr1 = 0;
+
+ /*
+ * Start the timers
+ */
+ m360.tgcr |= 0x0011;
+}
+
+/*
+ * Return timer value in microsecond units
+ */
+int
+Read_timer (void)
+{
+ return *(rtems_unsigned32 *)&m360.tcn1;
+}
+
+/*
+ * Empty function call used in loops to measure basic cost of looping
+ * in Timing Test Suite.
+ */
+rtems_status_code
+Empty_function (void)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+void
+Set_find_average_overhead(rtems_boolean find_flag)
+{
+}