Hi,

I hope that's how this works. Here is a patch for the raspberrypi clock driver 
to use the correct value for the timer counter based on 
rtems_configuration_get_microseconds_per_tick() as discussed in the user-list.

Cheers,

   Jan
-------------------------------------------------------------
>From 57e7ce5554a64ee69c424f1bd55af2f89f9e4061 Mon Sep 17 00:00:00 2001
From: Jan Sommer <summers...@web.de>
Date: Tue, 7 Jul 2015 22:33:51 +0200
Subject: [PATCH] RaspberryPi: Use
 rtems_configuration_get_microseconds_per_tick to set clock counter

    timer interrupt was hard coded to 10 ms per tick.
    Fix uses the setting of CONFIGURE_MICROSECONDS_PER_TICK to compute the correct start value for the counter
    See for more information: http://permalink.gmane.org/gmane.os.rtems.user/22691
---
 c/src/lib/libbsp/arm/raspberrypi/clock/clockdrv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/c/src/lib/libbsp/arm/raspberrypi/clock/clockdrv.c b/c/src/lib/libbsp/arm/raspberrypi/clock/clockdrv.c
index f765485..e239f5a 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/clock/clockdrv.c
+++ b/c/src/lib/libbsp/arm/raspberrypi/clock/clockdrv.c
@@ -50,8 +50,10 @@ static void raspberrypi_clock_handler_install(void)
 static void raspberrypi_clock_initialize(void)
 {
    BCM2835_REG(BCM2835_TIMER_CTL) = 0x003E0000;
-   BCM2835_REG(BCM2835_TIMER_LOD) = 10000 - 1;
-   BCM2835_REG(BCM2835_TIMER_RLD) = 10000 - 1;
+   BCM2835_REG(BCM2835_TIMER_LOD) = 
+                rtems_configuration_get_microseconds_per_tick() - 1;
+   BCM2835_REG(BCM2835_TIMER_RLD) = 
+                rtems_configuration_get_microseconds_per_tick() - 1;
    BCM2835_REG(BCM2835_TIMER_DIV) = BCM2835_TIMER_PRESCALE;
    BCM2835_REG(BCM2835_TIMER_CLI) = 0;
    BCM2835_REG(BCM2835_TIMER_CTL) = 0x003E00A2;
-- 
2.1.4

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to