[rtems commit] RaspberryPi: Use rtems_configuration_get_microseconds_per_tick to set clock counter

Joel Sherril joel at rtems.org
Tue Jul 7 21:02:05 UTC 2015


Module:    rtems
Branch:    master
Commit:    e77f625401bbeb23867dae0707080a38682ed58c
Changeset: http://git.rtems.org/rtems/commit/?id=e77f625401bbeb23867dae0707080a38682ed58c

Author:    Jan Sommer <summerspam at web.de>
Date:      Tue Jul  7 22:33:51 2015 +0200

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..4ce795f 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;



More information about the vc mailing list