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

PR 1748/bsps
	* clock/ckinit.c: 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:17 +00:00
parent 5357e24abc
commit 9ec55e633e
4 changed files with 33 additions and 8 deletions

View File

@@ -1,3 +1,10 @@
2011-03-04 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1748/bsps
* clock/ckinit.c: 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.
2009-03-09 Antoine Lacroix <antoine.lacroix at sodern.fr>
PR 1391/bsps

View File

@@ -49,11 +49,17 @@ extern int CLOCK_SPEED;
uint32_t bsp_clock_nanoseconds_since_last_tick(void)
{
uint32_t clicks;
uint32_t usecs;
clicks = ERC32_MEC.Real_Time_Clock_Counter;
return (uint32_t)
(rtems_configuration_get_microseconds_per_tick() - clicks) * 1000;
if ( ERC32_Is_interrupt_pending( ERC32_INTERRUPT_REAL_TIME_CLOCK ) ) {
clicks = ERC32_MEC.Real_Time_Clock_Counter;
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 \

View File

@@ -1,3 +1,10 @@
2011-03-04 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1748/bsps
* clock/ckinit.c: 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.
2009-03-09 Antoine Lacroix <antoine.lacroix at sodern.fr>
PR 1391/bsps

View File

@@ -59,17 +59,22 @@ extern int CLOCK_SPEED;
LEON_REG.Timer_Control_1 = 0; \
} while (0)
uint32_t bsp_clock_nanoseconds_since_last_tick(void)
{
uint32_t clicks;
uint32_t usecs;
clicks = LEON_REG.Timer_Counter_1;
/* Down counter */
return (uint32_t)
(rtems_configuration_get_microseconds_per_tick() - clicks) * 1000;
if ( LEON_Is_interrupt_pending( LEON_INTERRUPT_TIMER1 ) ) {
clicks = LEON_REG.Timer_Counter_1;
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.c"