From 75bf564ba18652d4392c77e2efebfd47478d34a9 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 7 Mar 2006 21:05:28 +0000 Subject: 2006-03-07 Lars Munch * at91rm9200/clock/clock.c: The clock tick is not very precise on at91rm9200. The attached patch improves the situation by: (1) Not reloading the "period interval timer" register in the interrupt handler since this is done automatically. (2) Use integer rounding in the calculation of the "period interval timer" register value to get as close as posible to the CONFIGURE_MICROSECONDS_PER_TICK value. --- c/src/lib/libcpu/arm/ChangeLog | 10 ++++++++++ c/src/lib/libcpu/arm/at91rm9200/clock/clock.c | 5 +---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/c/src/lib/libcpu/arm/ChangeLog b/c/src/lib/libcpu/arm/ChangeLog index ca9ebc86e6..cd5211cc03 100644 --- a/c/src/lib/libcpu/arm/ChangeLog +++ b/c/src/lib/libcpu/arm/ChangeLog @@ -1,3 +1,13 @@ +2006-03-07 Lars Munch + + * at91rm9200/clock/clock.c: The clock tick is not very precise on + at91rm9200. The attached patch improves the situation by: + (1) Not reloading the "period interval timer" register in the + interrupt handler since this is done automatically. + (2) Use integer rounding in the calculation of the "period interval + timer" register value to get as close as posible to the + CONFIGURE_MICROSECONDS_PER_TICK value. + 2005-11-04 Ralf Corsepius * configure.ac: Remove RTEMS_CHECK_CUSTOM_BSP. diff --git a/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c b/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c index 5bba53c101..c6876c2aa6 100644 --- a/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c +++ b/c/src/lib/libcpu/arm/at91rm9200/clock/clock.c @@ -54,9 +54,6 @@ rtems_isr clock_isr(rtems_vector_number vector) /* read the status to clear the int */ st_str = ST_REG(ST_SR); - /* reload the timer value */ - ST_REG(ST_PIMR) = st_pimr_reload; - rtems_clock_tick(); } @@ -71,7 +68,7 @@ void Install_clock(rtems_isr_entry clock_isr) /* the system timer is driven from SLCK */ slck = at91rm9200_get_slck(); - st_pimr_reload = ((BSP_Configuration.microseconds_per_tick * slck) / + st_pimr_reload = (((BSP_Configuration.microseconds_per_tick * slck) + (1000000/2))/ 1000000); /* read the status to clear the int */ -- cgit v1.2.3