summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-31 14:10:20 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-08-01 16:45:46 +0200
commit965a442a4ed63845455956433f7581934663081c (patch)
treefbc25d4d54b675b14585e82f34130b7692626cb2 /cpukit/score/include
parentscore: Add and use _TOD_Is_set() (diff)
downloadrtems-965a442a4ed63845455956433f7581934663081c.tar.bz2
score: Move nanoseconds since last tick support
Move the nanoseconds since last tick support from the Watchdog to the TOD handler. Now the TOD managment is encapsulated in the TOD_Control structure.
Diffstat (limited to '')
-rw-r--r--cpukit/score/include/rtems/score/tod.h41
-rw-r--r--cpukit/score/include/rtems/score/todimpl.h16
-rw-r--r--cpukit/score/include/rtems/score/watchdog.h9
-rw-r--r--cpukit/score/include/rtems/score/watchdogimpl.h16
4 files changed, 56 insertions, 26 deletions
diff --git a/cpukit/score/include/rtems/score/tod.h b/cpukit/score/include/rtems/score/tod.h
new file mode 100644
index 0000000000..57609b994f
--- /dev/null
+++ b/cpukit/score/include/rtems/score/tod.h
@@ -0,0 +1,41 @@
+/**
+ * @file
+ *
+ * @ingroup ScoreTOD
+ *
+ * @brief Time of Day Handler API
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2009.
+ * 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.
+ */
+
+#ifndef _RTEMS_SCORE_TOD_H
+#define _RTEMS_SCORE_TOD_H
+
+#include <rtems/score/basedefs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Returns the nanoseconds since the last clock tick.
+ *
+ * @ingroup ScoreTOD
+ *
+ * @return The nanoseconds since the last clock tick.
+ */
+typedef uint32_t ( *TOD_Nanoseconds_since_last_tick_routine )( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/todimpl.h b/cpukit/score/include/rtems/score/todimpl.h
index 0e2da2fcae..a7c3e5d737 100644
--- a/cpukit/score/include/rtems/score/todimpl.h
+++ b/cpukit/score/include/rtems/score/todimpl.h
@@ -18,7 +18,7 @@
#ifndef _RTEMS_SCORE_TODIMPL_H
#define _RTEMS_SCORE_TODIMPL_H
-#include <rtems/score/basedefs.h>
+#include <rtems/score/tod.h>
#include <rtems/score/timestamp.h>
#include <sys/time.h>
@@ -149,6 +149,13 @@ typedef struct {
uint32_t seconds_trigger;
/**
+ * @brief The current nanoseconds since last tick handler.
+ *
+ * This field must not be NULL after initialization.
+ */
+ TOD_Nanoseconds_since_last_tick_routine nanoseconds_since_last_tick;
+
+ /**
* @brief Indicates if the time of day is set.
*
* This is true if the application has set the current
@@ -300,6 +307,13 @@ RTEMS_INLINE_ROUTINE void _TOD_Get_timeval(
_Timestamp_To_timeval( snapshot_as_timestamp_ptr, time );
}
+RTEMS_INLINE_ROUTINE void _TOD_Set_nanoseconds_since_last_tick_handler(
+ TOD_Nanoseconds_since_last_tick_routine routine
+)
+{
+ _TOD.nanoseconds_since_last_tick = routine;
+}
+
RTEMS_INLINE_ROUTINE bool _TOD_Is_set( void )
{
return _TOD.is_set;
diff --git a/cpukit/score/include/rtems/score/watchdog.h b/cpukit/score/include/rtems/score/watchdog.h
index b67e5ca28c..bd218fd7fd 100644
--- a/cpukit/score/include/rtems/score/watchdog.h
+++ b/cpukit/score/include/rtems/score/watchdog.h
@@ -64,15 +64,6 @@ typedef Watchdog_Service_routine ( *Watchdog_Service_routine_entry )(
);
/**
- * @brief Pointer to the BSP plugin to obtain the number
- * of nanoseconds since the last clock tick.
- *
- * 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 The constant for indefinite wait.
*
* This is the constant for indefinite wait. It is actually an
diff --git a/cpukit/score/include/rtems/score/watchdogimpl.h b/cpukit/score/include/rtems/score/watchdogimpl.h
index 3085a440f6..faf68fa81c 100644
--- a/cpukit/score/include/rtems/score/watchdogimpl.h
+++ b/cpukit/score/include/rtems/score/watchdogimpl.h
@@ -93,15 +93,6 @@ SCORE_EXTERN volatile uint32_t _Watchdog_Sync_count;
SCORE_EXTERN volatile Watchdog_Interval _Watchdog_Ticks_since_boot;
/**
- * @brief The number of nanoseconds since the last clock tick.
- *
- * This is a pointer to the optional BSP plugin to obtain the number
- * of nanoseconds since the last clock tick.
- */
-extern Watchdog_Nanoseconds_since_last_tick_routine
- _Watchdog_Nanoseconds_since_tick_handler;
-
-/**
* @brief Watchdog chain which is managed at ticks.
*
* This is the watchdog chain which is managed at ticks.
@@ -245,13 +236,6 @@ void _Watchdog_Report_chain(
);
/**
- * @brief Handler for default nanoseconds since last tick.
- *
- * @retval 0 Always.
- */
-uint32_t _Watchdog_Nanoseconds_since_tick_default_handler( void );
-
-/**
* This routine initializes the specified watchdog. The watchdog is
* made inactive, the watchdog id and handler routine are set to the
* specified values.