summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-16 17:36:01 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-16 17:36:01 +0000
commit3d66dfc1cb98974df47bf4735291a674d34038bc (patch)
tree23d592a42aa1a333463855389a9a6a0151a3f704
parent2008-12-16 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-3d66dfc1cb98974df47bf4735291a674d34038bc.tar.bz2
2008-12-16 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/src/__times.c, posix/src/adjtime.c, posix/src/clockgetres.c, posix/src/sysconf.c, rtems/src/clockgettickspersecond.c, rtems/src/clockgettod.c, rtems/src/clockset.c, rtems/src/clocktodvalidate.c, score/src/timespecfromticks.c, score/src/timespectoticks.c, score/src/ts64toticks.c: More case converted to use configuration table entry not _TOD_Microseconds_per_tick.
-rw-r--r--cpukit/ChangeLog10
-rw-r--r--cpukit/libcsupport/src/__times.c6
-rw-r--r--cpukit/posix/src/adjtime.c3
-rw-r--r--cpukit/posix/src/clockgetres.c7
-rw-r--r--cpukit/posix/src/sysconf.c8
-rw-r--r--cpukit/rtems/src/clockgettickspersecond.c4
-rw-r--r--cpukit/rtems/src/clockgettod.c4
-rw-r--r--cpukit/rtems/src/clockset.c3
-rw-r--r--cpukit/rtems/src/clocktodvalidate.c7
-rw-r--r--cpukit/score/src/timespecfromticks.c3
-rw-r--r--cpukit/score/src/timespectoticks.c7
-rw-r--r--cpukit/score/src/ts64toticks.c3
12 files changed, 45 insertions, 20 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 4562f0d37a..65f931e362 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,5 +1,15 @@
2008-12-16 Joel Sherrill <joel.sherrill@oarcorp.com>
+ * libcsupport/src/__times.c, posix/src/adjtime.c,
+ posix/src/clockgetres.c, posix/src/sysconf.c,
+ rtems/src/clockgettickspersecond.c, rtems/src/clockgettod.c,
+ rtems/src/clockset.c, rtems/src/clocktodvalidate.c,
+ score/src/timespecfromticks.c, score/src/timespectoticks.c,
+ score/src/ts64toticks.c: More case converted to use configuration
+ table entry not _TOD_Microseconds_per_tick.
+
+2008-12-16 Joel Sherrill <joel.sherrill@oarcorp.com>
+
* libgnat/adasupp.c: Add helper method so Ada binding does not
reference _TOD_Microseconds_per_tick.
diff --git a/cpukit/libcsupport/src/__times.c b/cpukit/libcsupport/src/__times.c
index 8ddad3ad9f..255057cc6e 100644
--- a/cpukit/libcsupport/src/__times.c
+++ b/cpukit/libcsupport/src/__times.c
@@ -59,8 +59,10 @@ clock_t _times(
_Timestamp_Set(
&per_tick,
- _TOD_Microseconds_per_tick / TOD_MILLISECONDS_PER_SECOND,
- (_TOD_Microseconds_per_tick % TOD_MILLISECONDS_PER_SECOND) / 1000
+ rtems_configuration_get_microseconds_per_tick() /
+ TOD_MICROSECONDS_PER_SECOND,
+ (rtems_configuration_get_nanoseconds_per_tick() %
+ TOD_NANOSECONDS_PER_SECOND)
);
_Timestamp_Divide(
diff --git a/cpukit/posix/src/adjtime.c b/cpukit/posix/src/adjtime.c
index 42fa1de550..89ccd7950d 100644
--- a/cpukit/posix/src/adjtime.c
+++ b/cpukit/posix/src/adjtime.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/seterr.h>
#include <rtems/score/tod.h>
#include <rtems/posix/time.h>
@@ -65,7 +66,7 @@ int adjtime(
adjustment += delta->tv_usec;
/* too small to account for */
- if ( adjustment < _TOD_Microseconds_per_tick )
+ if ( adjustment < rtems_configuration_get_microseconds_per_tick() )
return 0;
/*
diff --git a/cpukit/posix/src/clockgetres.c b/cpukit/posix/src/clockgetres.c
index 9c5f1be925..2698734547 100644
--- a/cpukit/posix/src/clockgetres.c
+++ b/cpukit/posix/src/clockgetres.c
@@ -21,6 +21,7 @@
#include <errno.h>
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
@@ -51,9 +52,9 @@ int clock_getres(
case CLOCK_PROCESS_CPUTIME:
case CLOCK_THREAD_CPUTIME:
if ( res ) {
- res->tv_sec = _TOD_Microseconds_per_tick / 1000000;
- res->tv_nsec = _TOD_Microseconds_per_tick * 1000;
- /* _TOD_From_ticks( _TOD_Microseconds_per_tick, res ); */
+ res->tv_sec = rtems_configuration_get_microseconds_per_tick() /
+ TOD_MICROSECONDS_PER_SECOND;
+ res->tv_nsec = rtems_configuration_get_nanoseconds_per_tick();
}
break;
diff --git a/cpukit/posix/src/sysconf.c b/cpukit/posix/src/sysconf.c
index c0b18ed7dc..6021dec63d 100644
--- a/cpukit/posix/src/sysconf.c
+++ b/cpukit/posix/src/sysconf.c
@@ -36,11 +36,11 @@ long sysconf(
switch (name) {
case _SC_CLK_TCK:
- return (TOD_MICROSECONDS_PER_SECOND / _TOD_Microseconds_per_tick);
+ return (TOD_MICROSECONDS_PER_SECOND /
+ rtems_configuration_get_microseconds_per_tick());
- case _SC_OPEN_MAX: {
- return rtems_libio_number_iops;
- }
+ case _SC_OPEN_MAX:
+ return rtems_libio_number_iops;
case _SC_GETPW_R_SIZE_MAX:
return 1024;
diff --git a/cpukit/rtems/src/clockgettickspersecond.c b/cpukit/rtems/src/clockgettickspersecond.c
index 9a4bd1ccad..23e2dd7c39 100644
--- a/cpukit/rtems/src/clockgettickspersecond.c
+++ b/cpukit/rtems/src/clockgettickspersecond.c
@@ -16,6 +16,7 @@
#endif
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/rtems/status.h>
#include <rtems/rtems/clock.h>
#include <rtems/score/isr.h>
@@ -25,5 +26,6 @@
rtems_interval rtems_clock_get_ticks_per_second(void)
{
- return TOD_MICROSECONDS_PER_SECOND / _TOD_Microseconds_per_tick;
+ return TOD_MICROSECONDS_PER_SECOND /
+ rtems_configuration_get_microseconds_per_tick();
}
diff --git a/cpukit/rtems/src/clockgettod.c b/cpukit/rtems/src/clockgettod.c
index 9347d797ee..128fd3480e 100644
--- a/cpukit/rtems/src/clockgettod.c
+++ b/cpukit/rtems/src/clockgettod.c
@@ -16,6 +16,7 @@
#endif
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/rtems/status.h>
#include <rtems/rtems/clock.h>
#include <rtems/score/isr.h>
@@ -50,7 +51,8 @@ rtems_status_code rtems_clock_get_tod(
tmbuf->hour = time.tm_hour;
tmbuf->minute = time.tm_min;
tmbuf->second = time.tm_sec;
- tmbuf->ticks = now.tv_usec / _TOD_Microseconds_per_tick;
+ tmbuf->ticks = now.tv_usec /
+ rtems_configuration_get_microseconds_per_tick();
return RTEMS_SUCCESSFUL;
}
diff --git a/cpukit/rtems/src/clockset.c b/cpukit/rtems/src/clockset.c
index 1b1bbe8b04..30127cdc39 100644
--- a/cpukit/rtems/src/clockset.c
+++ b/cpukit/rtems/src/clockset.c
@@ -16,6 +16,7 @@
#endif
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/rtems/status.h>
#include <rtems/rtems/clock.h>
#include <rtems/score/isr.h>
@@ -49,7 +50,7 @@ rtems_status_code rtems_clock_set(
if ( _TOD_Validate( time_buffer ) ) {
newtime.tv_sec = _TOD_To_seconds( time_buffer );
newtime.tv_nsec = time_buffer->ticks *
- (_TOD_Microseconds_per_tick * TOD_NANOSECONDS_PER_MICROSECOND);
+ rtems_configuration_get_nanoseconds_per_tick();
_Thread_Disable_dispatch();
_TOD_Set( &newtime );
diff --git a/cpukit/rtems/src/clocktodvalidate.c b/cpukit/rtems/src/clocktodvalidate.c
index e40f7b9595..54da8284b3 100644
--- a/cpukit/rtems/src/clocktodvalidate.c
+++ b/cpukit/rtems/src/clocktodvalidate.c
@@ -17,6 +17,7 @@
#endif
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/rtems/clock.h>
/*
@@ -51,10 +52,12 @@ bool _TOD_Validate(
)
{
uint32_t days_in_month;
+ uint32_t ticks_per_second;
+ ticks_per_second = TOD_MICROSECONDS_PER_SECOND /
+ rtems_configuration_get_microseconds_per_tick();
if ((!the_tod) ||
- (the_tod->ticks >=
- (TOD_MICROSECONDS_PER_SECOND / _TOD_Microseconds_per_tick)) ||
+ (the_tod->ticks >= ticks_per_second) ||
(the_tod->second >= TOD_SECONDS_PER_MINUTE) ||
(the_tod->minute >= TOD_MINUTES_PER_HOUR) ||
(the_tod->hour >= TOD_HOURS_PER_DAY) ||
diff --git a/cpukit/score/src/timespecfromticks.c b/cpukit/score/src/timespecfromticks.c
index 73dda79db9..a3f44977fc 100644
--- a/cpukit/score/src/timespecfromticks.c
+++ b/cpukit/score/src/timespecfromticks.c
@@ -16,6 +16,7 @@
#include <time.h>
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/score/timespec.h>
#include <rtems/score/tod.h>
@@ -26,7 +27,7 @@ void _Timespec_From_ticks(
{
uint32_t usecs;
- usecs = ticks * _TOD_Microseconds_per_tick;
+ usecs = ticks * rtems_configuration_get_microseconds_per_tick();
time->tv_sec = usecs / TOD_MICROSECONDS_PER_SECOND;
time->tv_nsec = (usecs % TOD_MICROSECONDS_PER_SECOND) *
diff --git a/cpukit/score/src/timespectoticks.c b/cpukit/score/src/timespectoticks.c
index 550ce617b3..51ad0e07f3 100644
--- a/cpukit/score/src/timespectoticks.c
+++ b/cpukit/score/src/timespectoticks.c
@@ -17,9 +17,11 @@
#include "config.h"
#endif
+#include <sys/types.h>
+
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/score/timespec.h>
-#include <sys/types.h>
#include <rtems/score/tod.h>
#include <rtems/score/watchdog.h>
@@ -39,8 +41,7 @@ uint32_t _Timespec_To_ticks(
ticks = time->tv_sec * TOD_TICKS_PER_SECOND;
- ticks += (time->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
- _TOD_Microseconds_per_tick;
+ ticks += time->tv_nsec / rtems_configuration_get_nanoseconds_per_tick();
if (ticks)
return ticks;
diff --git a/cpukit/score/src/ts64toticks.c b/cpukit/score/src/ts64toticks.c
index 5594387df8..d751a109a1 100644
--- a/cpukit/score/src/ts64toticks.c
+++ b/cpukit/score/src/ts64toticks.c
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <rtems/system.h>
+#include <rtems/config.h>
#include <rtems/score/timestamp.h>
#include <rtems/score/tod.h>
@@ -31,7 +32,7 @@ uint32_t _Timestamp64_To_ticks(
{
uint32_t ticks;
- ticks = *time / (_TOD_Microseconds_per_tick * 1000);
+ ticks = *time / rtems_configuration_get_nanoseconds_per_tick();
if ( ticks )
return ticks;
return 1;