summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-04-17 17:41:19 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-04-17 17:41:19 +0000
commitf7588ebab7194d8890ce2336cd7b9a66319f00cf (patch)
treead252b82892c47c4077b6ed36cac00ca689d6c07 /c
parent2007-04-17 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-f7588ebab7194d8890ce2336cd7b9a66319f00cf.tar.bz2
2007-04-17 Joel Sherrill <joel@OARcorp.com>
* mpc6xx/clock/c_clock.c: Add initial cut at nanoseconds since last tick handler.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libcpu/powerpc/ChangeLog5
-rw-r--r--c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c22
2 files changed, 25 insertions, 2 deletions
diff --git a/c/src/lib/libcpu/powerpc/ChangeLog b/c/src/lib/libcpu/powerpc/ChangeLog
index 5722ca27a2..54117fc0f2 100644
--- a/c/src/lib/libcpu/powerpc/ChangeLog
+++ b/c/src/lib/libcpu/powerpc/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-17 Joel Sherrill <joel@OARcorp.com>
+
+ * mpc6xx/clock/c_clock.c: Add initial cut at nanoseconds since last
+ tick handler.
+
2007-04-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* shared/include/byteorder.h: Use uint*_t instead of char/short/int.
diff --git a/c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c b/c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c
index 9fac5a1683..caf5bc87af 100644
--- a/c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c
+++ b/c/src/lib/libcpu/powerpc/mpc6xx/clock/c_clock.c
@@ -6,7 +6,7 @@
* The tick frequency is directly programmed to the configured number of
* microseconds per tick.
*
- * COPYRIGHT (c) 1989-1997.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may in
@@ -130,6 +130,18 @@ void Clock_exit( void )
(void) BSP_disconnect_clock_handler ();
}
+uint32_t Clock_driver_nanoseconds_since_last_tick(void)
+{
+ uint32_t clicks, tmp;
+
+ PPC_Get_decrementer( clicks );
+
+ tmp = (Clock_Decrementer_value - clicks) * 1000000;
+ tmp /= (BSP_bus_frequency/BSP_time_base_divisor);
+
+ return tmp;
+}
+
/*
* Clock_initialize
*
@@ -145,7 +157,6 @@ void Clock_exit( void )
* Return values:
* rtems_device_driver status code
*/
-
rtems_device_driver Clock_initialize(
rtems_device_major_number major,
rtems_device_minor_number minor,
@@ -160,6 +171,13 @@ rtems_device_driver Clock_initialize(
*/
PPC_Set_decrementer( (unsigned)-1 );
+ /*
+ * Set the nanoseconds since last tick handler
+ */
+ rtems_clock_set_nanoseconds_extension(
+ Clock_driver_nanoseconds_since_last_tick
+ );
+
/* if a decrementer exception was pending, it is cleared by
* executing the default (nop) handler at this point;
* The next exception will then be taken by our clock handler.