summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu/sh/sh7032/delay
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-22 13:48:10 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-22 13:48:10 +0000
commit875fbdbb49cae497c654c9f9f27d97de78225b30 (patch)
treec7b7ed45f88a5182b4c7a676c281b54a598d356f /c/src/lib/libcpu/sh/sh7032/delay
parentAdding files not added as part of merger of SH2 port. (diff)
downloadrtems-875fbdbb49cae497c654c9f9f27d97de78225b30.tar.bz2
Added files missed by previous merger of SH-2 port.
Diffstat (limited to 'c/src/lib/libcpu/sh/sh7032/delay')
-rw-r--r--c/src/lib/libcpu/sh/sh7032/delay/Makefile.in70
-rw-r--r--c/src/lib/libcpu/sh/sh7032/delay/delay.c53
2 files changed, 123 insertions, 0 deletions
diff --git a/c/src/lib/libcpu/sh/sh7032/delay/Makefile.in b/c/src/lib/libcpu/sh/sh7032/delay/Makefile.in
new file mode 100644
index 0000000000..740015b9f7
--- /dev/null
+++ b/c/src/lib/libcpu/sh/sh7032/delay/Makefile.in
@@ -0,0 +1,70 @@
+#
+# $Id$
+#
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = ../../..
+subdir = sh/sh7032/delay
+
+RTEMS_ROOT = @RTEMS_ROOT@
+PROJECT_ROOT = @PROJECT_ROOT@
+
+VPATH = @srcdir@
+
+PGM = ${ARCH}/delay.rel
+
+# C source names, if any, go here -- minus the .c
+C_PIECES = delay
+C_FILES = $(C_PIECES:%=%.c)
+C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
+
+H_FILES =
+
+# Assembly source names, if any, go here -- minus the .S
+S_PIECES =
+S_FILES = $(S_PIECES:%=%.S)
+S_O_FILES = $(S_FILES:%.S=${ARCH}/%.o)
+
+SRCS = $(DOCS) $(C_FILES) $(H_FILES)
+OBJS = $(C_O_FILES)
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(RTEMS_ROOT)/make/leaf.cfg
+
+INSTALL_CHANGE = @INSTALL_CHANGE@
+
+#
+# (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
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
diff --git a/c/src/lib/libcpu/sh/sh7032/delay/delay.c b/c/src/lib/libcpu/sh/sh7032/delay/delay.c
new file mode 100644
index 0000000000..83f48df853
--- /dev/null
+++ b/c/src/lib/libcpu/sh/sh7032/delay/delay.c
@@ -0,0 +1,53 @@
+/*
+ * This routine is a simple spin delay
+ *
+ * Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
+ *
+ * COPYRIGHT (c) 1999, Ralf Corsepius, Ulm, Germany
+ *
+ * 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.
+ *
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+
+#include <rtems.h>
+
+/*
+ * Simple spin delay in microsecond units for device drivers.
+ * This is very dependent on the clock speed of the target.
+ *
+ * Since we don't have a real time clock, this is a very rough
+ * approximation, assuming that each cycle of the delay loop takes
+ * approx. 4 machine cycles.
+ *
+ * e.g.: clicks_per_second = 20MHz
+ * => 5e-8 secs per instruction
+ * => 4 * 5e-8 secs per delay loop
+ */
+
+void CPU_delay( unsigned32 microseconds )
+{
+ register unsigned32 clicks_per_usec =
+ rtems_cpu_configuration_get_clicks_per_second() / 1000000 ;
+ register unsigned32 _delay =
+ (microseconds) * (clicks_per_usec);
+ asm volatile (
+"0: add #-4,%0\n
+ nop\n
+ cmp/pl %0\n
+ bt 0b
+ nop"
+ :: "r" (_delay) );
+}