forked from Imagelibrary/rtems
2011-03-04 Joel Sherrill <joel.sherrilL@OARcorp.com>
* timer/timer.c: Retry up to 5 times when the calibration loop fails.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
2011-03-04 Joel Sherrill <joel.sherrilL@OARcorp.com>
|
||||||
|
|
||||||
|
* timer/timer.c: Retry up to 5 times when the calibration loop fails.
|
||||||
|
|
||||||
2011-02-11 Ralf Corsépius <ralf.corsepius@rtems.org>
|
2011-02-11 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
* include/bsp.h, include/tm27.h:
|
* include/bsp.h, include/tm27.h:
|
||||||
|
|||||||
@@ -334,13 +334,19 @@ Calibrate_loop_1ms(void)
|
|||||||
unsigned int targetClockBits, currentClockBits;
|
unsigned int targetClockBits, currentClockBits;
|
||||||
unsigned int slowLoopGranularity, fastLoopGranularity;
|
unsigned int slowLoopGranularity, fastLoopGranularity;
|
||||||
rtems_interrupt_level level;
|
rtems_interrupt_level level;
|
||||||
|
int retries = 0;
|
||||||
|
|
||||||
|
rtems_interrupt_disable(level);
|
||||||
|
|
||||||
|
retry:
|
||||||
|
if ( ++retries >= 5 ) {
|
||||||
|
printk( "Calibrate_loop_1ms: too many attempts. giving up!!\n" );
|
||||||
|
while (1);
|
||||||
|
}
|
||||||
#ifdef DEBUG_CALIBRATE
|
#ifdef DEBUG_CALIBRATE
|
||||||
printk("Calibrate_loop_1ms is starting, please wait (but not too long.)\n");
|
printk("Calibrate_loop_1ms is starting, please wait (but not too long.)\n");
|
||||||
#endif
|
#endif
|
||||||
targetClockBits = US_TO_TICK(1000);
|
targetClockBits = US_TO_TICK(1000);
|
||||||
|
|
||||||
rtems_interrupt_disable(level);
|
|
||||||
/*
|
/*
|
||||||
* Fill up the cache to get a correct offset
|
* Fill up the cache to get a correct offset
|
||||||
*/
|
*/
|
||||||
@@ -384,8 +390,11 @@ Calibrate_loop_1ms(void)
|
|||||||
fastLoop (10000);
|
fastLoop (10000);
|
||||||
res = readTimer0() - offset;
|
res = readTimer0() - offset;
|
||||||
if (res < emptyCall) {
|
if (res < emptyCall) {
|
||||||
printk("Problem #1 in offset computation in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
|
printk(
|
||||||
while (1);
|
"Problem #1 in offset computation in Calibrate_loop_1ms "
|
||||||
|
" in file libbsp/i386/pc386/timer/timer.c\n"
|
||||||
|
);
|
||||||
|
goto retry;
|
||||||
}
|
}
|
||||||
fastLoopGranularity = (res - emptyCall) / 10000;
|
fastLoopGranularity = (res - emptyCall) / 10000;
|
||||||
/*
|
/*
|
||||||
@@ -395,14 +404,20 @@ Calibrate_loop_1ms(void)
|
|||||||
slowLoop(10);
|
slowLoop(10);
|
||||||
res = readTimer0();
|
res = readTimer0();
|
||||||
if (res < offset + emptyCall) {
|
if (res < offset + emptyCall) {
|
||||||
printk("Problem #2 in offset computation in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
|
printk(
|
||||||
while (1);
|
"Problem #2 in offset computation in Calibrate_loop_1ms "
|
||||||
|
" in file libbsp/i386/pc386/timer/timer.c\n"
|
||||||
|
);
|
||||||
|
goto retry;
|
||||||
}
|
}
|
||||||
slowLoopGranularity = (res - offset - emptyCall)/ 10;
|
slowLoopGranularity = (res - offset - emptyCall)/ 10;
|
||||||
|
|
||||||
if (slowLoopGranularity == 0) {
|
if (slowLoopGranularity == 0) {
|
||||||
printk("Problem #3 in Calibrate_loop_1ms in file libbsp/i386/pc386/timer/timer.c\n");
|
printk(
|
||||||
while (1);
|
"Problem #3 in offset computation in Calibrate_loop_1ms "
|
||||||
|
" in file libbsp/i386/pc386/timer/timer.c\n"
|
||||||
|
);
|
||||||
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
targetClockBits += offset;
|
targetClockBits += offset;
|
||||||
|
|||||||
Reference in New Issue
Block a user