summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-05-01 19:16:04 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-05-01 19:16:04 +0000
commit716f6bede98614f69a223f9eac9acd14efbbf563 (patch)
treed1006d839e9cc9cfb5d42a4f5521ae18189c7a32 /c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c
parent2007-05-01 Ray Xu <xr@trasin.net> (diff)
downloadrtems-716f6bede98614f69a223f9eac9acd14efbbf563.tar.bz2
2007-05-01 Ray Xu <xr@trasin.net>
* lpc22xx/clock/clockdrv.c, lpc22xx/include/lpc22xx.h, lpc22xx/irq/bsp_irq_asm.S, lpc22xx/irq/bsp_irq_init.c, lpc22xx/irq/irq.c, lpc22xx/irq/irq.h, lpc22xx/timer/timer.c: Update BSP to address changes between 4.7 and CVS head as well as to address comments from Ralf and Joel.
Diffstat (limited to 'c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c')
-rw-r--r--c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c b/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c
index b486b09b8c..ef3e847731 100644
--- a/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c
+++ b/c/src/lib/libcpu/arm/lpc22xx/clock/clockdrv.c
@@ -1,6 +1,8 @@
/*
- * LPC22XX clock specific using the System Timer
- * set the Time0
+ * LPC22XX/LPC21xx clock specific using the System Timer
+ * Copyright (c) 2006 by Ray <rayx.cn@gmail.com>
+ * Set the Time0 to generate click for RTEMS
+ *
* This is hardware specific part of the clock driver. At the end of this
* file, the generic part of the driver is #included.
*
@@ -76,9 +78,9 @@ rtems_irq_connect_data clock_isr_data = {LPC22xx_INTERRUPT_TIMER0,
* NOPs.
*/
- /* set timer to generate interrupt every BSP_Configuration.microseconds_per_tick */
- /* MR0/(LPC22xx_Fpclk/(PR0+1)) = 10/1000 = 0.01s */
-
+ /* set timer to generate interrupt every BSP_Configuration.microseconds_per_tick
+ * MR0/(LPC22xx_Fpclk/(PR0+1)) = 10/1000 = 0.01s
+ */
#define Clock_driver_support_initialize_hardware() \
do { \
@@ -104,6 +106,19 @@ rtems_irq_connect_data clock_isr_data = {LPC22xx_INTERRUPT_TIMER0,
BSP_remove_rtems_irq_handler(&clock_isr_data); \
} while (0)
+uint32_t bsp_clock_nanoseconds_since_last_tick(void)
+{
+ uint32_t clicks;
+
+ clicks = T0TC; /*T0TC is the 32bit time counter 0*/
+
+ return (uint32_t) (BSP_Configuration.microseconds_per_tick - clicks) * 1000;
+}
+
+#define Clock_driver_nanoseconds_since_last_tick bsp_clock_nanoseconds_since_last_tick
+
+
+
/**
* Enables clock interrupt.
*