summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-25 15:10:11 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-26 11:55:47 +0200
commit88c74ab115b5135d4d93050596905d6ee573dd1e (patch)
tree395b852dd384040e20a6f178e913dddccac436bf /cpukit/score
parentscore: Create object implementation header (diff)
downloadrtems-88c74ab115b5135d4d93050596905d6ee573dd1e.tar.bz2
score: Merge tod implementation into one file
Delete TOD_MICROSECONDS_PER_SECOND, TOD_MICROSECONDS_TO_TICKS() and TOD_MILLISECONDS_TO_TICKS().
Diffstat (limited to '')
-rw-r--r--cpukit/score/Makefile.am5
-rw-r--r--cpukit/score/include/rtems/score/tod.h86
-rw-r--r--cpukit/score/inline/rtems/score/tod.inl72
-rw-r--r--cpukit/score/preinstall.am4
-rw-r--r--cpukit/score/src/coretod.c3
-rw-r--r--cpukit/score/src/coretodget.c1
-rw-r--r--cpukit/score/src/coretodgetuptimetimespec.c3
-rw-r--r--cpukit/score/src/coretodmsecstoticks.c44
-rw-r--r--cpukit/score/src/coretodset.c5
-rw-r--r--cpukit/score/src/coretodtickle.c3
-rw-r--r--cpukit/score/src/coretodtickspersec.c3
-rw-r--r--cpukit/score/src/coretodusectoticks.c44
-rw-r--r--cpukit/score/src/timespecaddto.c2
-rw-r--r--cpukit/score/src/timespecdivide.c2
-rw-r--r--cpukit/score/src/timespecdividebyinteger.c2
-rw-r--r--cpukit/score/src/timespecfromticks.c5
-rw-r--r--cpukit/score/src/timespecisvalid.c3
-rw-r--r--cpukit/score/src/timespeclessthan.c1
-rw-r--r--cpukit/score/src/timespecsubtract.c3
-rw-r--r--cpukit/score/src/timespectoticks.c6
-rw-r--r--cpukit/score/src/ts64toticks.c1
21 files changed, 49 insertions, 249 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index a5daa5cddc..531ddc1486 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -101,9 +101,6 @@ if HAS_SMP
include_rtems_score_HEADERS += include/rtems/score/schedulersimplesmp.h
endif
-## inline
-include_rtems_score_HEADERS += inline/rtems/score/tod.inl
-
## src
AM_CPPFLAGS += -D__RTEMS_INSIDE__
@@ -301,7 +298,7 @@ libscore_a_SOURCES += src/ts64addto.c src/ts64dividebyinteger.c \
## TOD_C_FILES
libscore_a_SOURCES += src/coretod.c src/coretodset.c src/coretodget.c \
src/coretodgetuptimetimespec.c src/coretodtickle.c \
- src/coretodmsecstoticks.c src/coretodtickspersec.c src/coretodusectoticks.c
+ src/coretodtickspersec.c
## WATCHDOG_C_FILES
libscore_a_SOURCES += src/watchdog.c src/watchdogadjust.c \
diff --git a/cpukit/score/include/rtems/score/tod.h b/cpukit/score/include/rtems/score/tod.h
index df73f95970..0cbbe2f46a 100644
--- a/cpukit/score/include/rtems/score/tod.h
+++ b/cpukit/score/include/rtems/score/tod.h
@@ -1,10 +1,9 @@
/**
- * @file rtems/score/tod.h
+ * @file
*
- * @brief Constants and Structures Associated with the Time of Day Handler.
+ * @ingroup ScoreTOD
*
- * This include file contains all the constants and structures associated
- * with the Time of Day Handler.
+ * @brief Time of Day Handler API
*/
/*
@@ -19,16 +18,18 @@
#ifndef _RTEMS_SCORE_TOD_H
#define _RTEMS_SCORE_TOD_H
-#include <time.h>
+#include <rtems/score/basedefs.h>
#include <rtems/score/timestamp.h>
-#include <rtems/score/basedefs.h> /* SCORE_EXTERN */
+
+#include <sys/time.h>
+#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
- * @defgroup ScoreTODConstants TOD Constants
+ * @defgroup ScoreTOD Time of Day Handler
*
* @ingroup Score
*
@@ -264,37 +265,6 @@ void _TOD_Get_uptime_as_timespec(
void _TOD_Tickle_ticks( void );
/**
- * @brief Converts an interval expressed in milliseconds to microseconds.
- *
- * This routine converts an interval expressed in milliseconds to microseconds.
- *
- * @note This must be a macro so it can be used in "static" tables.
- */
-#define TOD_MILLISECONDS_TO_MICROSECONDS(_ms) ((uint32_t)(_ms) * 1000L)
-
-/**
- * @brief Converts an interval expressed in microseconds to ticks.
- *
- * This routine converts an interval expressed in microseconds to ticks.
- *
- * @note This must be a macro so it can be used in "static" tables.
- */
-uint32_t TOD_MICROSECONDS_TO_TICKS(
- uint32_t microseconds
-);
-
-/**
- * @brief Converts an interval expressed in milliseconds to ticks.
- *
- * This routine converts an interval expressed in milliseconds to ticks.
- *
- * @note This must be a macro so it can be used in "static" tables.
- */
-uint32_t TOD_MILLISECONDS_TO_TICKS(
- uint32_t milliseconds
-);
-
-/**
* @brief Gets number of ticks in a second.
*
* This method returns the number of ticks in a second.
@@ -314,15 +284,45 @@ uint32_t TOD_TICKS_PER_SECOND_method(void);
*/
#define TOD_TICKS_PER_SECOND TOD_TICKS_PER_SECOND_method()
-#ifndef __RTEMS_APPLICATION__
-#include <rtems/score/tod.inl>
-#endif
+/**
+ * This routine deactivates updating of the current time of day.
+ */
-#ifdef __cplusplus
+RTEMS_INLINE_ROUTINE void _TOD_Deactivate( void )
+{
+ /* XXX do we need something now that we are using timespec for TOD */
+}
+
+/**
+ * This routine activates updating of the current time of day.
+ */
+
+RTEMS_INLINE_ROUTINE void _TOD_Activate( void )
+{
+ /* XXX do we need something now that we are using timespec for TOD */
+}
+
+/**
+ * This routine returns a timeval based upon the internal timespec format TOD.
+ */
+
+RTEMS_INLINE_ROUTINE void _TOD_Get_timeval(
+ struct timeval *time
+)
+{
+ Timestamp_Control snapshot_as_timestamp;
+ Timestamp_Control *snapshot_as_timestamp_ptr;
+
+ snapshot_as_timestamp_ptr =
+ _TOD_Get_with_nanoseconds( &snapshot_as_timestamp, &_TOD.now );
+ _Timestamp_To_timeval( snapshot_as_timestamp_ptr, time );
}
-#endif
/**@}*/
+#ifdef __cplusplus
+}
+#endif
+
#endif
/* end of include file */
diff --git a/cpukit/score/inline/rtems/score/tod.inl b/cpukit/score/inline/rtems/score/tod.inl
deleted file mode 100644
index 89b2634d95..0000000000
--- a/cpukit/score/inline/rtems/score/tod.inl
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * @file
- *
- * @brief Inlined Routines from the Time of Day Handle
- *
- * This file contains the static inline implementation of the inlined routines
- * from the Time of Day Handler.
- */
-
-/*
- * COPYRIGHT (c) 1989-2007.
- * 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
-# error "Never use <rtems/score/tod.inl> directly; include <rtems/score/tod.h> instead."
-#endif
-
-#ifndef _RTEMS_SCORE_TOD_INL
-#define _RTEMS_SCORE_TOD_INL
-
-#include <sys/time.h> /* struct timeval */
-
-#include <rtems/score/isr.h>
-
-/**
- * @addtogroup ScoreTOD
- */
-/**@{**/
-
-/**
- * This routine deactivates updating of the current time of day.
- */
-
-RTEMS_INLINE_ROUTINE void _TOD_Deactivate( void )
-{
- /* XXX do we need something now that we are using timespec for TOD */
-}
-
-/**
- * This routine activates updating of the current time of day.
- */
-
-RTEMS_INLINE_ROUTINE void _TOD_Activate( void )
-{
- /* XXX do we need something now that we are using timespec for TOD */
-}
-
-/**
- * This routine returns a timeval based upon the internal timespec format TOD.
- */
-
-RTEMS_INLINE_ROUTINE void _TOD_Get_timeval(
- struct timeval *time
-)
-{
- Timestamp_Control snapshot_as_timestamp;
- Timestamp_Control *snapshot_as_timestamp_ptr;
-
- snapshot_as_timestamp_ptr =
- _TOD_Get_with_nanoseconds( &snapshot_as_timestamp, &_TOD.now );
- _Timestamp_To_timeval( snapshot_as_timestamp_ptr, time );
-}
-
-/** @} */
-
-#endif
-/* end of include file */
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index 42e2dbf828..420fdaad2b 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -339,7 +339,3 @@ $(PROJECT_INCLUDE)/rtems/score/schedulersimplesmp.h: include/rtems/score/schedul
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulersimplesmp.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulersimplesmp.h
endif
-$(PROJECT_INCLUDE)/rtems/score/tod.inl: inline/rtems/score/tod.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/tod.inl
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/tod.inl
-
diff --git a/cpukit/score/src/coretod.c b/cpukit/score/src/coretod.c
index 2f664b4b45..1dcf19fea7 100644
--- a/cpukit/score/src/coretod.c
+++ b/cpukit/score/src/coretod.c
@@ -18,10 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
-#include <rtems/score/watchdog.h>
void _TOD_Handler_initialization(void)
{
diff --git a/cpukit/score/src/coretodget.c b/cpukit/score/src/coretodget.c
index e58b9fee95..3e2cb4f4de 100644
--- a/cpukit/score/src/coretodget.c
+++ b/cpukit/score/src/coretodget.c
@@ -19,6 +19,7 @@
#endif
#include <rtems/score/tod.h>
+#include <rtems/score/isrlevel.h>
#include <rtems/score/watchdogimpl.h>
Timestamp_Control *_TOD_Get_with_nanoseconds(
diff --git a/cpukit/score/src/coretodgetuptimetimespec.c b/cpukit/score/src/coretodgetuptimetimespec.c
index 500acfd479..16e519e36b 100644
--- a/cpukit/score/src/coretodgetuptimetimespec.c
+++ b/cpukit/score/src/coretodgetuptimetimespec.c
@@ -18,9 +18,6 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/timestamp.h>
#include <rtems/score/tod.h>
void _TOD_Get_uptime_as_timespec(
diff --git a/cpukit/score/src/coretodmsecstoticks.c b/cpukit/score/src/coretodmsecstoticks.c
deleted file mode 100644
index c55338ee47..0000000000
--- a/cpukit/score/src/coretodmsecstoticks.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @file
- *
- * @brief Convert Microseconds to Ticks
- *
- * @ingroup ScoreTODConstants
- */
-
-/* COPYRIGHT (c) 1989-2011.
- * 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.
- */
-
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/tod.h>
-
-uint32_t TOD_MILLISECONDS_TO_TICKS(
- uint32_t milliseconds
-)
-{
- uint32_t ticks;
- uint32_t milliseconds_per_tick;
-
- /**
- * We should ensure the ticks not be truncated by integer division. We
- * need to have it be greater than or equal to the requested time. It
- * should not be shorter.
- */
- milliseconds_per_tick = rtems_configuration_get_milliseconds_per_tick();
- ticks = milliseconds / milliseconds_per_tick;
- if ( (milliseconds % milliseconds_per_tick) != 0 )
- ticks += 1;
-
- return ticks;
-}
diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c
index 5c5e9c452c..23ba2e6ce8 100644
--- a/cpukit/score/src/coretodset.c
+++ b/cpukit/score/src/coretodset.c
@@ -18,11 +18,8 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threaddispatch.h>
-#include <rtems/score/timestamp.h>
#include <rtems/score/tod.h>
+#include <rtems/score/threaddispatch.h>
#include <rtems/score/watchdogimpl.h>
void _TOD_Set_with_timestamp(
diff --git a/cpukit/score/src/coretodtickle.c b/cpukit/score/src/coretodtickle.c
index d55c054a82..41644b980c 100644
--- a/cpukit/score/src/coretodtickle.c
+++ b/cpukit/score/src/coretodtickle.c
@@ -18,9 +18,6 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/timestamp.h>
#include <rtems/score/tod.h>
#include <rtems/score/watchdogimpl.h>
#include <rtems/config.h>
diff --git a/cpukit/score/src/coretodtickspersec.c b/cpukit/score/src/coretodtickspersec.c
index 3dc792a6d3..58e7e04c88 100644
--- a/cpukit/score/src/coretodtickspersec.c
+++ b/cpukit/score/src/coretodtickspersec.c
@@ -18,9 +18,8 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/config.h>
#include <rtems/score/tod.h>
+#include <rtems/config.h>
uint32_t TOD_TICKS_PER_SECOND_method(void)
{
diff --git a/cpukit/score/src/coretodusectoticks.c b/cpukit/score/src/coretodusectoticks.c
deleted file mode 100644
index 60d08b9280..0000000000
--- a/cpukit/score/src/coretodusectoticks.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @file
- *
- * @brief Converts Microseconds to Ticks
- *
- * @ingroup ScoreTOD
- */
-
-/* COPYRIGHT (c) 1989-2011.
- * 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.
- */
-
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/tod.h>
-
-uint32_t TOD_MICROSECONDS_TO_TICKS(
- uint32_t microseconds
-)
-{
- uint32_t ticks;
- uint32_t microseconds_per_tick;
-
- /**
- * We should ensure the ticks not be truncated by integer division. We
- * need to have it be greater than or equal to the requested time. It
- * should not be shorter.
- */
- microseconds_per_tick = rtems_configuration_get_microseconds_per_tick();
- ticks = microseconds / microseconds_per_tick;
- if ( (microseconds % microseconds_per_tick) != 0 )
- ticks += 1;
-
- return ticks;
-}
diff --git a/cpukit/score/src/timespecaddto.c b/cpukit/score/src/timespecaddto.c
index a71e1d63bf..a1d6c871c0 100644
--- a/cpukit/score/src/timespecaddto.c
+++ b/cpukit/score/src/timespecaddto.c
@@ -18,8 +18,6 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <sys/types.h>
#include <rtems/score/timespec.h>
#include <rtems/score/tod.h>
#include <rtems/score/watchdog.h>
diff --git a/cpukit/score/src/timespecdivide.c b/cpukit/score/src/timespecdivide.c
index e889dac1c9..3434fdf7f1 100644
--- a/cpukit/score/src/timespecdivide.c
+++ b/cpukit/score/src/timespecdivide.c
@@ -18,8 +18,6 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <sys/types.h>
#include <rtems/score/timespec.h>
#include <rtems/score/tod.h>
diff --git a/cpukit/score/src/timespecdividebyinteger.c b/cpukit/score/src/timespecdividebyinteger.c
index 33d21643ff..6d97dcbc41 100644
--- a/cpukit/score/src/timespecdividebyinteger.c
+++ b/cpukit/score/src/timespecdividebyinteger.c
@@ -19,8 +19,6 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <sys/types.h>
#include <rtems/score/timespec.h>
#include <rtems/score/tod.h>
diff --git a/cpukit/score/src/timespecfromticks.c b/cpukit/score/src/timespecfromticks.c
index dc11fbf3cd..3e994a03f2 100644
--- a/cpukit/score/src/timespecfromticks.c
+++ b/cpukit/score/src/timespecfromticks.c
@@ -18,12 +18,9 @@
#include "config.h"
#endif
-#include <time.h>
-
-#include <rtems/system.h>
-#include <rtems/config.h>
#include <rtems/score/timespec.h>
#include <rtems/score/tod.h>
+#include <rtems/config.h>
void _Timespec_From_ticks(
uint32_t ticks,
diff --git a/cpukit/score/src/timespecisvalid.c b/cpukit/score/src/timespecisvalid.c
index 4a0a247ba9..61dce72830 100644
--- a/cpukit/score/src/timespecisvalid.c
+++ b/cpukit/score/src/timespecisvalid.c
@@ -18,9 +18,6 @@
#include "config.h"
#endif
-#include <sys/types.h>
-
-#include <rtems/system.h>
#include <rtems/score/timespec.h>
#include <rtems/score/tod.h>
diff --git a/cpukit/score/src/timespeclessthan.c b/cpukit/score/src/timespeclessthan.c
index c120ae97b6..885f40bb82 100644
--- a/cpukit/score/src/timespeclessthan.c
+++ b/cpukit/score/src/timespeclessthan.c
@@ -22,7 +22,6 @@
#include <rtems/system.h>
#include <rtems/score/timespec.h>
-#include <rtems/score/tod.h>
bool _Timespec_Less_than(
const struct timespec *lhs,
diff --git a/cpukit/score/src/timespecsubtract.c b/cpukit/score/src/timespecsubtract.c
index 391cbc0a90..8d29f17197 100644
--- a/cpukit/score/src/timespecsubtract.c
+++ b/cpukit/score/src/timespecsubtract.c
@@ -18,11 +18,8 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <sys/types.h>
#include <rtems/score/timespec.h>
#include <rtems/score/tod.h>
-#include <rtems/score/watchdog.h>
void _Timespec_Subtract(
const struct timespec *start,
diff --git a/cpukit/score/src/timespectoticks.c b/cpukit/score/src/timespectoticks.c
index 4fe22f03f7..12eaadaa96 100644
--- a/cpukit/score/src/timespectoticks.c
+++ b/cpukit/score/src/timespectoticks.c
@@ -15,13 +15,9 @@
#include "config.h"
#endif
-#include <sys/types.h>
-
-#include <rtems/system.h>
-#include <rtems/config.h>
#include <rtems/score/timespec.h>
#include <rtems/score/tod.h>
-#include <rtems/score/watchdog.h>
+#include <rtems/config.h>
/**
*
diff --git a/cpukit/score/src/ts64toticks.c b/cpukit/score/src/ts64toticks.c
index f1b97587d2..365198dd26 100644
--- a/cpukit/score/src/ts64toticks.c
+++ b/cpukit/score/src/ts64toticks.c
@@ -23,7 +23,6 @@
#include <rtems/system.h>
#include <rtems/config.h>
#include <rtems/score/timestamp.h>
-#include <rtems/score/tod.h>
#if CPU_TIMESTAMP_USE_INT64 == TRUE
uint32_t _Timestamp64_To_ticks(