2007-04-17 Joel Sherrill <joel@OARcorp.com>

* mpc6xx/clock/c_clock.c: Add initial cut at nanoseconds since last
	tick handler.
This commit is contained in:
Joel Sherrill
2007-04-17 17:41:19 +00:00
parent 62f93dbaea
commit f7588ebab7
2 changed files with 25 additions and 2 deletions

View File

@@ -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.

View File

@@ -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.