2011-03-04 Joel Sherrill <joel.sherrilL@OARcorp.com>

PR 1748/bsps
	* clock/ckinit.c, include/leon.h: When the clock tick generates an
	interrupt WHILE we have interrupts disabled doing a get TOD or
	uptime, the get nanoseconds handler was returning a bogusly large
	number.
This commit is contained in:
Joel Sherrill
2011-03-04 14:07:08 +00:00
parent 631a092239
commit 7fce2ca5cd
3 changed files with 22 additions and 6 deletions

View File

@@ -1,3 +1,11 @@
2011-03-04 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1748/bsps
* clock/ckinit.c, include/leon.h: When the clock tick generates an
interrupt WHILE we have interrupts disabled doing a get TOD or
uptime, the get nanoseconds handler was returning a bogusly large
number.
2011-02-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Require autoconf-2.68, automake-1.11.1.

View File

@@ -97,16 +97,24 @@ static int clkirq;
uint32_t bsp_clock_nanoseconds_since_last_tick(void)
{
uint32_t clicks;
uint32_t usecs;
if ( !LEON3_Timer_Regs )
return 0;
clicks = LEON3_Timer_Regs->timer[0].value;
/* Down counter */
return (uint32_t)
(rtems_configuration_get_microseconds_per_tick() - clicks) * 1000;
if ( LEON_Is_interrupt_pending( clkirq ) ) {
clicks = LEON3_Timer_Regs->timer[0].value;
usecs = (2*rtems_configuration_get_microseconds_per_tick() - clicks);
} else {
usecs = (rtems_configuration_get_microseconds_per_tick() - clicks);
}
return usecs * 1000;
}
#define Clock_driver_nanoseconds_since_last_tick bsp_clock_nanoseconds_since_last_tick
#define Clock_driver_nanoseconds_since_last_tick \
bsp_clock_nanoseconds_since_last_tick
#include "../../../shared/clockdrv_shell.h"

View File

@@ -245,11 +245,11 @@ extern int LEON3_Cpu_Index;
} while (0)
#define LEON_Is_interrupt_pending( _source ) \
(LEON3_IrqCtrl_Regs.ipend & (1 << (_source)))
(LEON3_IrqCtrl_Regs->ipend & (1 << (_source)))
#define LEON_Is_interrupt_masked( _source ) \
do {\
(LEON3_IrqCtrl_Regs.mask[LEON3_Cpu_Index] & (1 << (_source))); \
(LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] & (1 << (_source))); \
} while (0)