diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-10-28 16:01:41 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-10-28 16:01:41 +0000 |
commit | 7046cddb1b07083d23f9f62592790f2f9174a470 (patch) | |
tree | bf25abe9bd3a53d2765983f534bbfb53e2741a79 /c/src/lib | |
parent | changed version to 19991028 (diff) | |
download | rtems-7046cddb1b07083d23f9f62592790f2f9174a470.tar.bz2 |
Patch rtems-rc-19991011-3.diff from Ralf Corsepius.
Diffstat (limited to 'c/src/lib')
-rw-r--r-- | c/src/lib/libbsp/sh/gensh1/include/bsp.h | 33 | ||||
-rw-r--r-- | c/src/lib/libbsp/sh/gensh1/startup/Makefile.in | 2 | ||||
-rw-r--r-- | c/src/lib/libcpu/sh/sh7032/clock/Makefile.in | 2 | ||||
-rw-r--r-- | c/src/lib/libcpu/sh/sh7032/timer/Makefile.in | 2 |
4 files changed, 35 insertions, 4 deletions
diff --git a/c/src/lib/libbsp/sh/gensh1/include/bsp.h b/c/src/lib/libbsp/sh/gensh1/include/bsp.h index 8f676d07fe..8422599b42 100644 --- a/c/src/lib/libbsp/sh/gensh1/include/bsp.h +++ b/c/src/lib/libbsp/sh/gensh1/include/bsp.h @@ -68,8 +68,39 @@ extern "C" { #define Lower_tm27_intr() /* Constants */ +#ifndef MHZ +#error Missing MHZ +#endif + +/* + * 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.: MHZ = 20 => 5e-8 secs per instruction + * => 4 * 5e-8 secs per delay loop + */ + +#define delay( microseconds ) \ +{ register unsigned int _delay = (microseconds) * (MHZ / 4 ); \ + asm volatile ( \ +"0: add #-1,%0\n \ + nop\n \ + cmp/pl %0\n \ + bt 0b\ + nop" \ + :: "r" (_delay) ); \ +} -#define MHZ 20 +/* + * For backward compatibility only. + * Do not rely on them being present in future + */ +#define CPU_delay( microseconds ) delay( microseconds ) +#define sh_deley( microseconds ) delay( microseconds ) /* * Defined in the linker script 'linkcmds' diff --git a/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in b/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in index c2eca457b9..3d03489ca3 100644 --- a/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in +++ b/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in @@ -47,7 +47,7 @@ $(INSTALLDIRS): # DEFINES += -CPPFLAGS += +CPPFLAGS += $(BSP_CPPFLAGS) CFLAGS += LD_PATHS += diff --git a/c/src/lib/libcpu/sh/sh7032/clock/Makefile.in b/c/src/lib/libcpu/sh/sh7032/clock/Makefile.in index 5617ae594e..c9bd2ac92d 100644 --- a/c/src/lib/libcpu/sh/sh7032/clock/Makefile.in +++ b/c/src/lib/libcpu/sh/sh7032/clock/Makefile.in @@ -40,7 +40,7 @@ INSTALL_CHANGE = @INSTALL_CHANGE@ # DEFINES += -CPPFLAGS += +CPPFLAGS += -DMHZ=$(MHZ) CFLAGS += $(CFLAGS_OS_V) LD_PATHS += diff --git a/c/src/lib/libcpu/sh/sh7032/timer/Makefile.in b/c/src/lib/libcpu/sh/sh7032/timer/Makefile.in index ce19bbb25c..735ef3961d 100644 --- a/c/src/lib/libcpu/sh/sh7032/timer/Makefile.in +++ b/c/src/lib/libcpu/sh/sh7032/timer/Makefile.in @@ -40,7 +40,7 @@ INSTALL_CHANGE = @INSTALL_CHANGE@ # DEFINES += -CPPFLAGS += +CPPFLAGS += -DMHZ=$(MHZ) CFLAGS += LD_PATHS += |