MIPS Arch fix for hal_delay_us
Tim Michals
t.michals@attbi.com
Thu Jan 9 05:11:00 GMT 2003
All,
In mips/arch/hal_misc.c function hal_delay_us uses counter/compare in the
MIPS core. If a HAL would like to use a different timer this causes an
issue, due to how HAL_DELAY_US is defined.
Several options that I could see:
1) replace the assembly with #define for reading the timer
2) hal_intr.h move the #define
externC void hal_delay_us(int us);
#define HAL_DELAY_US(n) hal_delay_us(n)
into the CYGHWR_HAL_CLOCK_CONTROL_DEFINED and have the user supply the
function and macro
Enclosed is a fix for 1) is this ok? Is there another way?
Index: hal_misc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/mips/arch/current/src/hal_misc.c,v
retrieving revision 1.29
diff -u -5 -p -r1.29 hal_misc.c
--- hal_misc.c 23 May 2002 23:03:22 -0000 1.29
+++ hal_misc.c 9 Jan 2003 05:03:53 -0000
@@ -374,14 +374,14 @@ hal_delay_us(int us)
us -= us1;
ticks = us1 * usticks;
- asm volatile("mfc0 %0,$9;" : "=r"(val1));
+ HAL_CLOCK_READ(&val1);
while (ticks > 0) {
do {
- asm volatile("mfc0 %0,$9;" : "=r"(val2));
+ HAL_CLOCK_READ(&val1);
} while (val1 == val2);
diff = val2 - val1;
if (diff < 0) diff += CYGNUM_HAL_RTC_PERIOD;
ticks -= diff;
val1 = val2;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: out
Type: application/octet-stream
Size: 812 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/ecos-patches/attachments/20030109/897f5794/attachment.obj>
More information about the Ecos-patches
mailing list