diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-03-28 19:56:14 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-03-28 19:56:14 +0000 |
commit | 4b6546f0bb2687af0463a855a78822785d656d6e (patch) | |
tree | e8fb6b77d7ad5d7a331684d0a8e35d59bc78b910 /cpukit | |
parent | 2007-03-28 Chris Johns <chrisj@rtems.org> (diff) | |
download | rtems-4b6546f0bb2687af0463a855a78822785d656d6e.tar.bz2 |
2007-03-28 Chris Johns <chrisj@rtems.org>
* rtems/Makefile.am, rtems/include/rtems/rtems/clock.h,
score/include/rtems/score/watchdog.h: Add support for a handler to
obtain the number of nanoseconds since the last clock tick. The
primary interface for this is rtems_clock_set_nanoseconds_extension.
Subsequent commits from Joel will redo the TOD support to use this
capability.
* rtems/src/clocksetnsecshandler.c: New file.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 10 | ||||
-rw-r--r-- | cpukit/rtems/Makefile.am | 2 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/clock.h | 29 | ||||
-rw-r--r-- | cpukit/rtems/src/clocksetnsecshandler.c | 49 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/watchdog.h | 17 |
5 files changed, 103 insertions, 4 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 41ac040846..358e0ba80e 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,13 @@ +2007-03-28 Chris Johns <chrisj@rtems.org> + + * rtems/Makefile.am, rtems/include/rtems/rtems/clock.h, + score/include/rtems/score/watchdog.h: Add support for a handler to + obtain the number of nanoseconds since the last clock tick. The + primary interface for this is rtems_clock_set_nanoseconds_extension. + Subsequent commits from Joel will redo the TOD support to use this + capability. + * rtems/src/clocksetnsecshandler.c: New file. + 2007-03-28 Joel Sherrill <joel@OARcorp.com> PR 1234/cpukit diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am index 7e9d3393e4..a12eef398f 100644 --- a/cpukit/rtems/Makefile.am +++ b/cpukit/rtems/Makefile.am @@ -77,7 +77,7 @@ librtems_a_SOURCES += src/barrier.c src/barriercreate.c src/barrierdelete.c \ ## CLOCK_C_FILES librtems_a_SOURCES += src/rtclock.c src/clockget.c src/clockset.c \ - src/clocktick.c + src/clocktick.c src/clocksetnsecshandler.c ## TIMER_C_FILES librtems_a_SOURCES += src/rtemstimer.c src/timercancel.c src/timercreate.c \ diff --git a/cpukit/rtems/include/rtems/rtems/clock.h b/cpukit/rtems/include/rtems/rtems/clock.h index c5f8bb080c..67fa8ab4cd 100644 --- a/cpukit/rtems/include/rtems/rtems/clock.h +++ b/cpukit/rtems/include/rtems/rtems/clock.h @@ -11,10 +11,10 @@ * * + set the current date and time * + obtain the current date and time + * + set the nanoseconds since last clock tick handler * + announce a clock tick * - * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -56,6 +56,12 @@ typedef struct { } rtems_clock_time_value; /* + * Type for the nanoseconds since last tick BSP extension. + */ +typedef Watchdog_Nanoseconds_since_last_tick_routine + rtems_nanoseconds_extension_routine; + +/* * rtems_clock_get * * DESCRIPTION: @@ -97,6 +103,25 @@ rtems_status_code rtems_clock_set( rtems_status_code rtems_clock_tick( void ); +/* + * rtems_clock_set_nanoseconds_extension + * + * DESCRIPTION: + * + * This directive sets the BSP provided nanoseconds since last tick + * extension. + * + * Input parameters: + * routine - pointer to the extension routine + * + * Output parameters: + * RTEMS_SUCCESSFUL - if successful + * error code - if unsuccessful + */ +rtems_status_code rtems_clock_set_nanoseconds_extension( + rtems_nanoseconds_extension_routine routine +); + #ifdef __cplusplus } #endif diff --git a/cpukit/rtems/src/clocksetnsecshandler.c b/cpukit/rtems/src/clocksetnsecshandler.c new file mode 100644 index 0000000000..8e4d0b113e --- /dev/null +++ b/cpukit/rtems/src/clocksetnsecshandler.c @@ -0,0 +1,49 @@ +/* + * Clock Manager + * + * COPYRIGHT (c) 1989-2006. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/system.h> +#include <rtems/rtems/status.h> +#include <rtems/rtems/clock.h> +#include <rtems/score/isr.h> +#include <rtems/score/thread.h> +#include <rtems/score/tod.h> +#include <rtems/score/watchdog.h> + +/*PAGE + * + * rtems_clock_set_nanoseconds_extension + * + * This directive sets the BSP provided nanoseconds since last tick + * extension. + * + * Input parameters: + * routine - pointer to the extension routine + * + * Output parameters: + * RTEMS_SUCCESSFUL - if successful + * error code - if unsuccessful + */ +rtems_status_code rtems_clock_set_nanoseconds_extension( + rtems_nanoseconds_extension_routine routine +) +{ + if ( !routine ) + return RTEMS_INVALID_ADDRESS; + + _Watchdog_Nanoseconds_since_tick_handler = routine; + return RTEMS_SUCCESSFUL; +} diff --git a/cpukit/score/include/rtems/score/watchdog.h b/cpukit/score/include/rtems/score/watchdog.h index fc902ad8c7..2432d4d801 100644 --- a/cpukit/score/include/rtems/score/watchdog.h +++ b/cpukit/score/include/rtems/score/watchdog.h @@ -7,7 +7,7 @@ */ /* - * COPYRIGHT (c) 1989-2006. + * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -50,6 +50,13 @@ extern "C" { */ typedef uint32_t Watchdog_Interval; +/** @brief Watchdog Nanoseconds Since Last Tick Extension + * + * This type defines a pointer to the BSP plugin to obtain the number + * of nanoseconds since the last clock tick. + */ +typedef uint32_t (*Watchdog_Nanoseconds_since_last_tick_routine)(void); + /** @brief Watchdog Service Routine Return Type * * This type defines the return type from a Watchdog Service Routine. @@ -158,6 +165,14 @@ SCORE_EXTERN volatile uint32_t _Watchdog_Sync_count; SCORE_EXTERN volatile Watchdog_Interval _Watchdog_Ticks_since_boot; +/** @brief Watchdog Nanoseconds Since Last Tick Handler + * + * This is a pointer to the optional BSP plugin to obtain the number + * of nanoseconds since the last clock tick. + */ +SCORE_EXTERN Watchdog_Nanoseconds_since_last_tick_routine + _Watchdog_Nanoseconds_since_tick_handler; + /** @brief Per Ticks Watchdog List * * This is the watchdog chain which is managed at ticks. |