From 88c74ab115b5135d4d93050596905d6ee573dd1e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 25 Jul 2013 15:10:11 +0200 Subject: score: Merge tod implementation into one file Delete TOD_MICROSECONDS_PER_SECOND, TOD_MICROSECONDS_TO_TICKS() and TOD_MILLISECONDS_TO_TICKS(). --- c/src/ada-tests/support/init.c | 3 +- c/src/lib/libbsp/i386/pc386/ide/ide.c | 4 +- c/src/lib/libbsp/lm32/shared/startup/bspstart.c | 6 -- c/src/lib/libcpu/bfin/clock/rtc.c | 1 + c/src/libchip/network/cs8900.c | 8 +-- c/src/libchip/network/open_eth.c | 2 +- cpukit/libblock/src/bdbuf.c | 2 +- cpukit/libcsupport/src/__gettod.c | 2 +- cpukit/libcsupport/src/__times.c | 1 + cpukit/libmisc/cpuuse/cpuusagereport.c | 1 + cpukit/libmisc/cpuuse/cpuusagereset.c | 6 +- cpukit/libnetworking/rtems/rtems_dhcp.c | 4 +- cpukit/libnetworking/rtems/rtems_dhcp_failsafe.c | 6 +- cpukit/posix/src/alarm.c | 1 + cpukit/posix/src/clockgetcpuclockid.c | 1 - cpukit/posix/src/clockgetenableattr.c | 1 - cpukit/posix/src/clockgetres.c | 6 +- cpukit/posix/src/clockgettime.c | 4 -- cpukit/posix/src/clocksetenableattr.c | 1 - cpukit/posix/src/mqueueopen.c | 4 +- cpukit/posix/src/nanosleep.c | 1 - cpukit/posix/src/posixtimespecabsolutetimeout.c | 2 +- cpukit/posix/src/ptimer.c | 1 - cpukit/posix/src/sched_getscheduler.c | 1 - cpukit/posix/src/sched_rr_get_interval.c | 1 - cpukit/posix/src/sched_setparam.c | 1 - cpukit/posix/src/sched_setscheduler.c | 1 - cpukit/posix/src/sysconf.c | 2 +- cpukit/posix/src/timergettime.c | 7 +- cpukit/posix/src/timersettime.c | 8 +-- cpukit/posix/src/timertsr.c | 5 +- cpukit/posix/src/ualarm.c | 1 + cpukit/rtems/include/rtems/rtems/clock.h | 1 - cpukit/rtems/include/rtems/rtems/support.h | 6 +- cpukit/rtems/include/rtems/rtems/types.h | 1 - cpukit/rtems/src/clockget.c | 1 - cpukit/rtems/src/clockgetsecondssinceepoch.c | 5 -- cpukit/rtems/src/clockgettickspersecond.c | 7 +- cpukit/rtems/src/clockgettickssinceboot.c | 1 - cpukit/rtems/src/clockgettod.c | 7 +- cpukit/rtems/src/clockgettodtimeval.c | 5 -- cpukit/rtems/src/clockgetuptime.c | 6 -- cpukit/rtems/src/clockgetuptimeseconds.c | 2 + cpukit/rtems/src/clockgetuptimetimeval.c | 1 + cpukit/rtems/src/clocksetnsecshandler.c | 1 - cpukit/rtems/src/clocktodtoseconds.c | 2 +- cpukit/rtems/src/clocktodvalidate.c | 4 +- cpukit/rtems/src/rtclock.c | 1 - cpukit/rtems/src/rtemstimer.c | 1 - cpukit/rtems/src/signalsend.c | 1 + cpukit/rtems/src/taskident.c | 1 - cpukit/rtems/src/taskinitusers.c | 1 - cpukit/rtems/src/tasks.c | 1 - cpukit/rtems/src/taskwakewhen.c | 1 + cpukit/rtems/src/timercancel.c | 1 - cpukit/rtems/src/timercreate.c | 1 - cpukit/rtems/src/timerdelete.c | 1 - cpukit/rtems/src/timerfireafter.c | 1 - cpukit/rtems/src/timerfirewhen.c | 4 -- cpukit/rtems/src/timergetinfo.c | 1 - cpukit/rtems/src/timerident.c | 1 - cpukit/rtems/src/timerreset.c | 1 - cpukit/rtems/src/timerserver.c | 1 + cpukit/rtems/src/timerserverfireafter.c | 1 - cpukit/rtems/src/timerserverfirewhen.c | 4 -- cpukit/score/Makefile.am | 5 +- cpukit/score/include/rtems/score/tod.h | 86 ++++++++++++------------ cpukit/score/inline/rtems/score/tod.inl | 72 -------------------- cpukit/score/preinstall.am | 4 -- cpukit/score/src/coretod.c | 3 - cpukit/score/src/coretodget.c | 1 + cpukit/score/src/coretodgetuptimetimespec.c | 3 - cpukit/score/src/coretodmsecstoticks.c | 44 ------------ cpukit/score/src/coretodset.c | 5 +- cpukit/score/src/coretodtickle.c | 3 - cpukit/score/src/coretodtickspersec.c | 3 +- cpukit/score/src/coretodusectoticks.c | 44 ------------ cpukit/score/src/timespecaddto.c | 2 - cpukit/score/src/timespecdivide.c | 2 - cpukit/score/src/timespecdividebyinteger.c | 2 - cpukit/score/src/timespecfromticks.c | 5 +- cpukit/score/src/timespecisvalid.c | 3 - cpukit/score/src/timespeclessthan.c | 1 - cpukit/score/src/timespecsubtract.c | 3 - cpukit/score/src/timespectoticks.c | 6 +- cpukit/score/src/ts64toticks.c | 1 - testsuites/libtests/block06/init.c | 6 +- testsuites/psxtests/psx01/init.c | 2 + testsuites/psxtests/psx05/init.c | 2 + testsuites/psxtests/psxclock/init.c | 2 + testsuites/samples/nsecs/init.c | 7 +- testsuites/sptests/sp01/task1.c | 7 +- testsuites/sptests/sp16/task5.c | 7 +- testsuites/sptests/spcbssched01/task1.c | 7 +- testsuites/sptests/spedfsched01/task1.c | 7 +- 95 files changed, 111 insertions(+), 403 deletions(-) delete mode 100644 cpukit/score/inline/rtems/score/tod.inl delete mode 100644 cpukit/score/src/coretodmsecstoticks.c delete mode 100644 cpukit/score/src/coretodusectoticks.c diff --git a/c/src/ada-tests/support/init.c b/c/src/ada-tests/support/init.c index ad98409c3c..983e51d578 100644 --- a/c/src/ada-tests/support/init.c +++ b/c/src/ada-tests/support/init.c @@ -51,8 +51,7 @@ uint32_t milliseconds_per_tick(void) uint32_t ticks_per_second(void) { - /* XXX HACK -- use public API */ - return TOD_TICKS_PER_SECOND; + return rtems_clock_get_ticks_per_second(); } uint32_t work_space_size(void) diff --git a/c/src/lib/libbsp/i386/pc386/ide/ide.c b/c/src/lib/libbsp/i386/pc386/ide/ide.c index 3288cd2d65..2c2ca911bb 100644 --- a/c/src/lib/libbsp/i386/pc386/ide/ide.c +++ b/c/src/lib/libbsp/i386/pc386/ide/ide.c @@ -63,8 +63,8 @@ static void pc386_ide_prestart_sleep (void) */ static void pc386_ide_tasking_sleep (void) { - rtems_task_wake_after (TOD_MICROSECONDS_TO_TICKS (10000) ? - TOD_MICROSECONDS_TO_TICKS (10000) : 1); + rtems_task_wake_after (RTEMS_MICROSECONDS_TO_TICKS (10000) ? + RTEMS_MICROSECONDS_TO_TICKS (10000) : 1); } typedef void (*pc386_ide_sleeper)(void); diff --git a/c/src/lib/libbsp/lm32/shared/startup/bspstart.c b/c/src/lib/libbsp/lm32/shared/startup/bspstart.c index ef82ad0a07..5b51e474a4 100644 --- a/c/src/lib/libbsp/lm32/shared/startup/bspstart.c +++ b/c/src/lib/libbsp/lm32/shared/startup/bspstart.c @@ -21,12 +21,6 @@ #include #include "../include/system_conf.h" #include "../console/uart.h" -#include - -#include -#include -#include -#include /* * bsp_start diff --git a/c/src/lib/libcpu/bfin/clock/rtc.c b/c/src/lib/libcpu/bfin/clock/rtc.c index 7032fe3387..657bf8fcd6 100644 --- a/c/src/lib/libcpu/bfin/clock/rtc.c +++ b/c/src/lib/libcpu/bfin/clock/rtc.c @@ -16,6 +16,7 @@ #include #include #include +#include /* The following are inside RTEMS -- we are violating visibility!!! * Perhaps an API could be defined to get days since 1 Jan. diff --git a/c/src/libchip/network/cs8900.c b/c/src/libchip/network/cs8900.c index 8cd907eecc..6d40fa78aa 100644 --- a/c/src/libchip/network/cs8900.c +++ b/c/src/libchip/network/cs8900.c @@ -258,7 +258,7 @@ cs8900_hardware_init (cs8900_device *cs) io_pp_bit_set_reg_16 (cs, CS8900_PP_SelfCTL, CS8900_SELF_CTRL_RESET); - rtems_task_wake_after (TOD_MILLISECONDS_TO_TICKS (20)); + rtems_task_wake_after (RTEMS_MILLISECONDS_TO_TICKS (20)); status = io_pp_get_reg_16 (cs, CS8900_PP_SelfST); if (status == 0) { @@ -660,7 +660,7 @@ cs8900_rx_task (void *arg) sc = rtems_bsdnet_event_receive (CS8900_RX_OK_EVENT, RTEMS_WAIT | RTEMS_EVENT_ANY, - TOD_MILLISECONDS_TO_TICKS (250), + RTEMS_MILLISECONDS_TO_TICKS (250), &events); cs8900_rx_refill_queue (cs); @@ -749,7 +749,7 @@ cs8900_tx_task (void *arg) * Wait for the link to come up. */ - rtems_task_wake_after (TOD_MILLISECONDS_TO_TICKS (750)); + rtems_task_wake_after (RTEMS_MILLISECONDS_TO_TICKS (750)); /* * Loop processing the tx queue. @@ -815,7 +815,7 @@ cs8900_tx_task (void *arg) cs->eth_stats.tx_wait_for_rdy4tx++; sc = rtems_bsdnet_event_receive (CS8900_TX_WAIT_EVENT, RTEMS_WAIT | RTEMS_EVENT_ANY, - TOD_MILLISECONDS_TO_TICKS (750), + RTEMS_MILLISECONDS_TO_TICKS (750), &events); if (sc == RTEMS_TIMEOUT) { diff --git a/c/src/libchip/network/open_eth.c b/c/src/libchip/network/open_eth.c index d7c0b05dc4..b311080215 100644 --- a/c/src/libchip/network/open_eth.c +++ b/c/src/libchip/network/open_eth.c @@ -459,7 +459,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m) rtems_event_set events; rtems_bsdnet_event_receive (OPEN_ETH_TX_WAIT_EVENT, RTEMS_WAIT | RTEMS_EVENT_ANY, - TOD_MILLISECONDS_TO_TICKS(500), &events); + RTEMS_MILLISECONDS_TO_TICKS(500), &events); #endif } diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c index d2b4238aef..0fbafaa6f4 100644 --- a/cpukit/libblock/src/bdbuf.c +++ b/cpukit/libblock/src/bdbuf.c @@ -206,7 +206,7 @@ typedef enum { #define RTEMS_BDBUF_WAIT_TIMEOUT RTEMS_NO_TIMEOUT #if !defined (RTEMS_BDBUF_WAIT_TIMEOUT) #define RTEMS_BDBUF_WAIT_TIMEOUT \ - (TOD_MICROSECONDS_TO_TICKS (20000000)) + (RTEMS_MICROSECONDS_TO_TICKS (20000000)) #endif static rtems_task rtems_bdbuf_swapout_task(rtems_task_argument arg); diff --git a/cpukit/libcsupport/src/__gettod.c b/cpukit/libcsupport/src/__gettod.c index 73cd04f821..d73e681353 100644 --- a/cpukit/libcsupport/src/__gettod.c +++ b/cpukit/libcsupport/src/__gettod.c @@ -23,7 +23,7 @@ #if defined(RTEMS_NEWLIB) #include #include -#include +#include #include #if defined(RTEMS_NEWLIB) && !defined(HAVE_GETTIMEOFDAY) diff --git a/cpukit/libcsupport/src/__times.c b/cpukit/libcsupport/src/__times.c index 71eb4e20e9..f143bb8209 100644 --- a/cpukit/libcsupport/src/__times.c +++ b/cpukit/libcsupport/src/__times.c @@ -25,6 +25,7 @@ #include #include #include +#include #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ #include #endif diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c b/cpukit/libmisc/cpuuse/cpuusagereport.c index aa5a8c65e3..14945d7071 100644 --- a/cpukit/libmisc/cpuuse/cpuusagereport.c +++ b/cpukit/libmisc/cpuuse/cpuusagereport.c @@ -26,6 +26,7 @@ #include #include +#include #include #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ diff --git a/cpukit/libmisc/cpuuse/cpuusagereset.c b/cpukit/libmisc/cpuuse/cpuusagereset.c index 77bd095ffa..9f682f386c 100644 --- a/cpukit/libmisc/cpuuse/cpuusagereset.c +++ b/cpukit/libmisc/cpuuse/cpuusagereset.c @@ -18,11 +18,9 @@ #include "config.h" #endif -#include -#include -#include - #include +#include +#include #include static void CPU_usage_Per_thread_handler( diff --git a/cpukit/libnetworking/rtems/rtems_dhcp.c b/cpukit/libnetworking/rtems/rtems_dhcp.c index 4039a48200..957a30a822 100644 --- a/cpukit/libnetworking/rtems/rtems_dhcp.c +++ b/cpukit/libnetworking/rtems/rtems_dhcp.c @@ -712,7 +712,7 @@ dhcp_task (rtems_task_argument _sdl) /* * Sleep until the next poll */ - timeout = TOD_MILLISECONDS_TO_TICKS (1000); + timeout = RTEMS_MILLISECONDS_TO_TICKS (1000); ev_st = rtems_event_receive (RTEMS_EVENT_0, RTEMS_WAIT | RTEMS_EVENT_ANY, timeout, &event_out); @@ -1147,7 +1147,7 @@ void rtems_bsdnet_do_dhcp (void) while( dhcp_init (update) < 0 ) { update = false; rtems_bsdnet_semaphore_release(); - rtems_task_wake_after(TOD_MILLISECONDS_TO_TICKS(1000)); + rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(1000)); rtems_bsdnet_semaphore_obtain (); } rtems_bsdnet_semaphore_release (); diff --git a/cpukit/libnetworking/rtems/rtems_dhcp_failsafe.c b/cpukit/libnetworking/rtems/rtems_dhcp_failsafe.c index 62046dbb66..3516504a34 100644 --- a/cpukit/libnetworking/rtems/rtems_dhcp_failsafe.c +++ b/cpukit/libnetworking/rtems/rtems_dhcp_failsafe.c @@ -257,7 +257,7 @@ do_dhcp_init (struct rtems_bsdnet_ifconfig *ifp) { #if BROADCAST_DELAY /* Wait before sending broadcast. */ - rtems_task_wake_after(TOD_MILLISECONDS_TO_TICKS(BROADCAST_DELAY * 1000)); + rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(BROADCAST_DELAY * 1000)); #endif printf ("starting dhcp client...\n"); @@ -303,7 +303,7 @@ static void dhcp_monitor_task (rtems_task_argument ifp_arg) must_renew = TRUE; #if NETWORK_DOWN_TIME dhcp_if_down(ifname); - rtems_task_wake_after(TOD_MILLISECONDS_TO_TICKS(NETWORK_DOWN_TIME * 1000)); + rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(NETWORK_DOWN_TIME * 1000)); dhcp_if_up(ifname); downcount = 0; #endif @@ -311,7 +311,7 @@ static void dhcp_monitor_task (rtems_task_argument ifp_arg) } } - rtems_task_wake_after(TOD_MILLISECONDS_TO_TICKS(1000)); + rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(1000)); } error_out: diff --git a/cpukit/posix/src/alarm.c b/cpukit/posix/src/alarm.c index acdec65574..065fae642d 100644 --- a/cpukit/posix/src/alarm.c +++ b/cpukit/posix/src/alarm.c @@ -25,6 +25,7 @@ #include #include +#include #include #include diff --git a/cpukit/posix/src/clockgetcpuclockid.c b/cpukit/posix/src/clockgetcpuclockid.c index d69783cb83..0556e344a4 100644 --- a/cpukit/posix/src/clockgetcpuclockid.c +++ b/cpukit/posix/src/clockgetcpuclockid.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/cpukit/posix/src/clockgetenableattr.c b/cpukit/posix/src/clockgetenableattr.c index b6a638b100..a2a36911fb 100644 --- a/cpukit/posix/src/clockgetenableattr.c +++ b/cpukit/posix/src/clockgetenableattr.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/cpukit/posix/src/clockgetres.c b/cpukit/posix/src/clockgetres.c index 08fd773a11..d35d50f2ba 100644 --- a/cpukit/posix/src/clockgetres.c +++ b/cpukit/posix/src/clockgetres.c @@ -21,12 +21,8 @@ #include #include -#include -#include -#include -#include #include - +#include #include /* diff --git a/cpukit/posix/src/clockgettime.c b/cpukit/posix/src/clockgettime.c index a8aa0f09bb..ebd04968d4 100644 --- a/cpukit/posix/src/clockgettime.c +++ b/cpukit/posix/src/clockgettime.c @@ -21,11 +21,7 @@ #include #include -#include -#include -#include #include - #include /* diff --git a/cpukit/posix/src/clocksetenableattr.c b/cpukit/posix/src/clocksetenableattr.c index d6e2c11e84..3917c1ef6b 100644 --- a/cpukit/posix/src/clocksetenableattr.c +++ b/cpukit/posix/src/clocksetenableattr.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/cpukit/posix/src/mqueueopen.c b/cpukit/posix/src/mqueueopen.c index e01be7adaf..79e7422bd8 100644 --- a/cpukit/posix/src/mqueueopen.c +++ b/cpukit/posix/src/mqueueopen.c @@ -38,11 +38,11 @@ #include #include -#include +#include #include -#include #include #include +#include /* * 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272 diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c index 3c408ebe68..7aaaa1271b 100644 --- a/cpukit/posix/src/nanosleep.c +++ b/cpukit/posix/src/nanosleep.c @@ -25,7 +25,6 @@ #include #include #include -#include #include /* diff --git a/cpukit/posix/src/posixtimespecabsolutetimeout.c b/cpukit/posix/src/posixtimespecabsolutetimeout.c index c46f13bf89..47cb87542d 100644 --- a/cpukit/posix/src/posixtimespecabsolutetimeout.c +++ b/cpukit/posix/src/posixtimespecabsolutetimeout.c @@ -26,9 +26,9 @@ #include #include -#include #include #include +#include #include /* diff --git a/cpukit/posix/src/ptimer.c b/cpukit/posix/src/ptimer.c index 5ce17d4e21..9cc5376ed0 100644 --- a/cpukit/posix/src/ptimer.c +++ b/cpukit/posix/src/ptimer.c @@ -26,7 +26,6 @@ #include #include #include -#include #include diff --git a/cpukit/posix/src/sched_getscheduler.c b/cpukit/posix/src/sched_getscheduler.c index ed958e0221..d4f8b0526e 100644 --- a/cpukit/posix/src/sched_getscheduler.c +++ b/cpukit/posix/src/sched_getscheduler.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/cpukit/posix/src/sched_rr_get_interval.c b/cpukit/posix/src/sched_rr_get_interval.c index 242077d337..ca50480640 100644 --- a/cpukit/posix/src/sched_rr_get_interval.c +++ b/cpukit/posix/src/sched_rr_get_interval.c @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/cpukit/posix/src/sched_setparam.c b/cpukit/posix/src/sched_setparam.c index 6a2047d031..689ec697af 100644 --- a/cpukit/posix/src/sched_setparam.c +++ b/cpukit/posix/src/sched_setparam.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/cpukit/posix/src/sched_setscheduler.c b/cpukit/posix/src/sched_setscheduler.c index 1ce173ff5c..0ff6286f77 100644 --- a/cpukit/posix/src/sched_setscheduler.c +++ b/cpukit/posix/src/sched_setscheduler.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/cpukit/posix/src/sysconf.c b/cpukit/posix/src/sysconf.c index 65812d34a5..eb94e17a4f 100644 --- a/cpukit/posix/src/sysconf.c +++ b/cpukit/posix/src/sysconf.c @@ -22,9 +22,9 @@ #include #include +#include #include #include -#include #include #include diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c index 40f0f610fa..e4fd60dd96 100644 --- a/cpukit/posix/src/timergettime.c +++ b/cpukit/posix/src/timergettime.c @@ -23,13 +23,10 @@ #include #include -#include -#include -#include +#include #include -#include #include -#include +#include /* * - When a timer is initialized, the value of the time in diff --git a/cpukit/posix/src/timersettime.c b/cpukit/posix/src/timersettime.c index 2b7f07403f..a1bd40b223 100644 --- a/cpukit/posix/src/timersettime.c +++ b/cpukit/posix/src/timersettime.c @@ -23,14 +23,12 @@ #include #include -#include -#include -#include -#include -#include #include #include #include +#include +#include +#include int timer_settime( timer_t timerid, diff --git a/cpukit/posix/src/timertsr.c b/cpukit/posix/src/timertsr.c index eb6ca9fd89..9c8f035b66 100644 --- a/cpukit/posix/src/timertsr.c +++ b/cpukit/posix/src/timertsr.c @@ -24,13 +24,10 @@ #include #include -#include -#include -#include -#include #include #include #include +#include /* * This is the operation that is run when a timer expires diff --git a/cpukit/posix/src/ualarm.c b/cpukit/posix/src/ualarm.c index 17573ba6ec..ae65a637d1 100644 --- a/cpukit/posix/src/ualarm.c +++ b/cpukit/posix/src/ualarm.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/cpukit/rtems/include/rtems/rtems/clock.h b/cpukit/rtems/include/rtems/rtems/clock.h index 3254b59dc1..3c32ccd0dd 100644 --- a/cpukit/rtems/include/rtems/rtems/clock.h +++ b/cpukit/rtems/include/rtems/rtems/clock.h @@ -30,7 +30,6 @@ #ifndef _RTEMS_RTEMS_CLOCK_H #define _RTEMS_RTEMS_CLOCK_H -#include #include #include #include diff --git a/cpukit/rtems/include/rtems/rtems/support.h b/cpukit/rtems/include/rtems/rtems/support.h index e2e01b0b15..80da79bc58 100644 --- a/cpukit/rtems/include/rtems/rtems/support.h +++ b/cpukit/rtems/include/rtems/rtems/support.h @@ -19,6 +19,7 @@ #define _RTEMS_RTEMS_SUPPORT_H #include +#include #ifdef __cplusplus extern "C" { @@ -32,14 +33,13 @@ extern "C" { /** * @brief Returns the number of micro seconds for the milli seconds value @a _ms. */ -#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \ - TOD_MILLISECONDS_TO_MICROSECONDS(_ms) +#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) ((uint32_t)(_ms) * 1000UL) /** * @brief Returns the number of ticks for the milli seconds value @a _ms. */ #define RTEMS_MILLISECONDS_TO_TICKS(_ms) \ - (TOD_MILLISECONDS_TO_MICROSECONDS(_ms) / \ + (RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) / \ rtems_configuration_get_microseconds_per_tick()) /** diff --git a/cpukit/rtems/include/rtems/rtems/types.h b/cpukit/rtems/include/rtems/rtems/types.h index 60a787db5f..ae121e06f4 100644 --- a/cpukit/rtems/include/rtems/rtems/types.h +++ b/cpukit/rtems/include/rtems/rtems/types.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #if defined(RTEMS_MULTIPROCESSING) diff --git a/cpukit/rtems/src/clockget.c b/cpukit/rtems/src/clockget.c index 45f4c299e1..fdf8b22612 100644 --- a/cpukit/rtems/src/clockget.c +++ b/cpukit/rtems/src/clockget.c @@ -23,7 +23,6 @@ #include #include #include -#include #include rtems_status_code rtems_clock_get( diff --git a/cpukit/rtems/src/clockgetsecondssinceepoch.c b/cpukit/rtems/src/clockgetsecondssinceepoch.c index c1f2af5374..1f23072f17 100644 --- a/cpukit/rtems/src/clockgetsecondssinceepoch.c +++ b/cpukit/rtems/src/clockgetsecondssinceepoch.c @@ -18,13 +18,8 @@ #include "config.h" #endif -#include -#include #include -#include -#include #include -#include rtems_status_code rtems_clock_get_seconds_since_epoch( rtems_interval *the_interval diff --git a/cpukit/rtems/src/clockgettickspersecond.c b/cpukit/rtems/src/clockgettickspersecond.c index 3a6d2808f3..87ae7bbcc1 100644 --- a/cpukit/rtems/src/clockgettickspersecond.c +++ b/cpukit/rtems/src/clockgettickspersecond.c @@ -18,14 +18,9 @@ #include "config.h" #endif -#include -#include -#include #include -#include -#include #include -#include +#include rtems_interval rtems_clock_get_ticks_per_second(void) { diff --git a/cpukit/rtems/src/clockgettickssinceboot.c b/cpukit/rtems/src/clockgettickssinceboot.c index 340b4bc385..a016777e22 100644 --- a/cpukit/rtems/src/clockgettickssinceboot.c +++ b/cpukit/rtems/src/clockgettickssinceboot.c @@ -23,7 +23,6 @@ #include #include #include -#include #include rtems_interval rtems_clock_get_ticks_since_boot(void) diff --git a/cpukit/rtems/src/clockgettod.c b/cpukit/rtems/src/clockgettod.c index 18f7773912..8710b0f94d 100644 --- a/cpukit/rtems/src/clockgettod.c +++ b/cpukit/rtems/src/clockgettod.c @@ -18,14 +18,9 @@ #include "config.h" #endif -#include -#include -#include #include -#include -#include #include -#include +#include rtems_status_code rtems_clock_get_tod( rtems_time_of_day *time_buffer diff --git a/cpukit/rtems/src/clockgettodtimeval.c b/cpukit/rtems/src/clockgettodtimeval.c index b2d7c52784..b10c4f26bc 100644 --- a/cpukit/rtems/src/clockgettodtimeval.c +++ b/cpukit/rtems/src/clockgettodtimeval.c @@ -18,13 +18,8 @@ #include "config.h" #endif -#include -#include #include -#include -#include #include -#include rtems_status_code rtems_clock_get_tod_timeval( struct timeval *time diff --git a/cpukit/rtems/src/clockgetuptime.c b/cpukit/rtems/src/clockgetuptime.c index 848fd34b04..0645b8e71f 100644 --- a/cpukit/rtems/src/clockgetuptime.c +++ b/cpukit/rtems/src/clockgetuptime.c @@ -18,14 +18,8 @@ #include "config.h" #endif -#include -#include #include -#include -#include -#include #include -#include /* * rtems_clock_get_uptime diff --git a/cpukit/rtems/src/clockgetuptimeseconds.c b/cpukit/rtems/src/clockgetuptimeseconds.c index 655a18e1e3..e4436c1075 100644 --- a/cpukit/rtems/src/clockgetuptimeseconds.c +++ b/cpukit/rtems/src/clockgetuptimeseconds.c @@ -24,6 +24,8 @@ #endif #include +#include +#include time_t rtems_clock_get_uptime_seconds( void ) { diff --git a/cpukit/rtems/src/clockgetuptimetimeval.c b/cpukit/rtems/src/clockgetuptimetimeval.c index c173a71b34..ef1388257c 100644 --- a/cpukit/rtems/src/clockgetuptimetimeval.c +++ b/cpukit/rtems/src/clockgetuptimetimeval.c @@ -24,6 +24,7 @@ #endif #include +#include void rtems_clock_get_uptime_timeval( struct timeval *uptime ) { diff --git a/cpukit/rtems/src/clocksetnsecshandler.c b/cpukit/rtems/src/clocksetnsecshandler.c index 8b79d0c228..25c0ad7f03 100644 --- a/cpukit/rtems/src/clocksetnsecshandler.c +++ b/cpukit/rtems/src/clocksetnsecshandler.c @@ -23,7 +23,6 @@ #include #include #include -#include #include /* diff --git a/cpukit/rtems/src/clocktodtoseconds.c b/cpukit/rtems/src/clocktodtoseconds.c index 9f80b5390b..daa33b4b12 100644 --- a/cpukit/rtems/src/clocktodtoseconds.c +++ b/cpukit/rtems/src/clocktodtoseconds.c @@ -18,8 +18,8 @@ #include "config.h" #endif -#include #include +#include #define TOD_SECONDS_AT_2100_03_01_00_00 4107538800UL diff --git a/cpukit/rtems/src/clocktodvalidate.c b/cpukit/rtems/src/clocktodvalidate.c index a56b1df56b..c464c37572 100644 --- a/cpukit/rtems/src/clocktodvalidate.c +++ b/cpukit/rtems/src/clocktodvalidate.c @@ -18,9 +18,9 @@ #include "config.h" #endif -#include -#include #include +#include +#include /* * The following array contains the number of days in all months. diff --git a/cpukit/rtems/src/rtclock.c b/cpukit/rtems/src/rtclock.c index fb4cb35b51..dcf878c81c 100644 --- a/cpukit/rtems/src/rtclock.c +++ b/cpukit/rtems/src/rtclock.c @@ -23,7 +23,6 @@ #include #include #include -#include #include /* No initialization routine */ diff --git a/cpukit/rtems/src/rtemstimer.c b/cpukit/rtems/src/rtemstimer.c index 259df4ccf3..4c86c86147 100644 --- a/cpukit/rtems/src/rtemstimer.c +++ b/cpukit/rtems/src/rtemstimer.c @@ -24,7 +24,6 @@ #include #include #include -#include #include void _Timer_Manager_initialization(void) diff --git a/cpukit/rtems/src/signalsend.c b/cpukit/rtems/src/signalsend.c index 8da26e8b53..440405a40c 100644 --- a/cpukit/rtems/src/signalsend.c +++ b/cpukit/rtems/src/signalsend.c @@ -21,6 +21,7 @@ #include #include #include +#include #include rtems_status_code rtems_signal_send( diff --git a/cpukit/rtems/src/taskident.c b/cpukit/rtems/src/taskident.c index ecd01c003c..659b1df308 100644 --- a/cpukit/rtems/src/taskident.c +++ b/cpukit/rtems/src/taskident.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c index b086a6ea7e..a86a2ff11c 100644 --- a/cpukit/rtems/src/taskinitusers.c +++ b/cpukit/rtems/src/taskinitusers.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c index ddbc0d235a..9a2a96f567 100644 --- a/cpukit/rtems/src/tasks.c +++ b/cpukit/rtems/src/tasks.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/cpukit/rtems/src/taskwakewhen.c b/cpukit/rtems/src/taskwakewhen.c index 7bee637bcc..759cb2eec1 100644 --- a/cpukit/rtems/src/taskwakewhen.c +++ b/cpukit/rtems/src/taskwakewhen.c @@ -21,6 +21,7 @@ #include #include #include +#include #include rtems_status_code rtems_task_wake_when( diff --git a/cpukit/rtems/src/timercancel.c b/cpukit/rtems/src/timercancel.c index 28d16f49da..45f0c709b0 100644 --- a/cpukit/rtems/src/timercancel.c +++ b/cpukit/rtems/src/timercancel.c @@ -19,7 +19,6 @@ #include #include #include -#include #include /* diff --git a/cpukit/rtems/src/timercreate.c b/cpukit/rtems/src/timercreate.c index 516be2fc2e..06e6e7a0b1 100644 --- a/cpukit/rtems/src/timercreate.c +++ b/cpukit/rtems/src/timercreate.c @@ -23,7 +23,6 @@ #include #include #include -#include #include rtems_status_code rtems_timer_create( diff --git a/cpukit/rtems/src/timerdelete.c b/cpukit/rtems/src/timerdelete.c index dee2dfafb4..5f1f404985 100644 --- a/cpukit/rtems/src/timerdelete.c +++ b/cpukit/rtems/src/timerdelete.c @@ -23,7 +23,6 @@ #include #include #include -#include #include rtems_status_code rtems_timer_delete( diff --git a/cpukit/rtems/src/timerfireafter.c b/cpukit/rtems/src/timerfireafter.c index a7df31e78d..3bab7d2491 100644 --- a/cpukit/rtems/src/timerfireafter.c +++ b/cpukit/rtems/src/timerfireafter.c @@ -23,7 +23,6 @@ #include #include #include -#include #include rtems_status_code rtems_timer_fire_after( diff --git a/cpukit/rtems/src/timerfirewhen.c b/cpukit/rtems/src/timerfirewhen.c index 453c84944a..c2be8b8a0f 100644 --- a/cpukit/rtems/src/timerfirewhen.c +++ b/cpukit/rtems/src/timerfirewhen.c @@ -18,10 +18,6 @@ #include "config.h" #endif -#include -#include -#include -#include #include #include #include diff --git a/cpukit/rtems/src/timergetinfo.c b/cpukit/rtems/src/timergetinfo.c index f711228aa5..cf15198cde 100644 --- a/cpukit/rtems/src/timergetinfo.c +++ b/cpukit/rtems/src/timergetinfo.c @@ -23,7 +23,6 @@ #include #include #include -#include #include rtems_status_code rtems_timer_get_information( diff --git a/cpukit/rtems/src/timerident.c b/cpukit/rtems/src/timerident.c index e87585c0a8..58b753131e 100644 --- a/cpukit/rtems/src/timerident.c +++ b/cpukit/rtems/src/timerident.c @@ -23,7 +23,6 @@ #include #include #include -#include #include rtems_status_code rtems_timer_ident( diff --git a/cpukit/rtems/src/timerreset.c b/cpukit/rtems/src/timerreset.c index fb55f9e9de..0b18daabd0 100644 --- a/cpukit/rtems/src/timerreset.c +++ b/cpukit/rtems/src/timerreset.c @@ -23,7 +23,6 @@ #include #include #include -#include #include /* diff --git a/cpukit/rtems/src/timerserver.c b/cpukit/rtems/src/timerserver.c index 5c7099c561..a76f346216 100644 --- a/cpukit/rtems/src/timerserver.c +++ b/cpukit/rtems/src/timerserver.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include diff --git a/cpukit/rtems/src/timerserverfireafter.c b/cpukit/rtems/src/timerserverfireafter.c index c486d91421..f361f06363 100644 --- a/cpukit/rtems/src/timerserverfireafter.c +++ b/cpukit/rtems/src/timerserverfireafter.c @@ -23,7 +23,6 @@ #include #include #include -#include #include rtems_status_code rtems_timer_server_fire_after( diff --git a/cpukit/rtems/src/timerserverfirewhen.c b/cpukit/rtems/src/timerserverfirewhen.c index c6749b2a60..bf1f7d5c5e 100644 --- a/cpukit/rtems/src/timerserverfirewhen.c +++ b/cpukit/rtems/src/timerserverfirewhen.c @@ -18,10 +18,6 @@ #include "config.h" #endif -#include -#include -#include -#include #include #include #include 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 +#include #include -#include /* SCORE_EXTERN */ + +#include +#include #ifdef __cplusplus extern "C" { #endif /** - * @defgroup ScoreTODConstants TOD Constants + * @defgroup ScoreTOD Time of Day Handler * * @ingroup Score * @@ -263,37 +264,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. * @@ -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 -#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 directly; include instead." -#endif - -#ifndef _RTEMS_SCORE_TOD_INL -#define _RTEMS_SCORE_TOD_INL - -#include /* struct timeval */ - -#include - -/** - * @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 -#include #include -#include 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 +#include #include 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 -#include -#include #include 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 -#include -#include - -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 -#include -#include -#include #include +#include #include 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 -#include -#include #include #include #include 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 -#include #include +#include 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 -#include -#include - -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 -#include #include #include #include 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 -#include #include #include 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 -#include #include #include 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 - -#include -#include #include #include +#include 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 - -#include #include #include 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 #include -#include 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 -#include #include #include -#include 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 - -#include -#include #include #include -#include +#include /** * 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 #include #include -#include #if CPU_TIMESTAMP_USE_INT64 == TRUE uint32_t _Timestamp64_To_ticks( diff --git a/testsuites/libtests/block06/init.c b/testsuites/libtests/block06/init.c index cbab05630c..6352aba933 100644 --- a/testsuites/libtests/block06/init.c +++ b/testsuites/libtests/block06/init.c @@ -202,7 +202,7 @@ bdbuf_wait (const char* who, unsigned long timeout) rtems_event_set out; sc = rtems_event_receive (RTEMS_EVENT_0, RTEMS_WAIT | RTEMS_EVENT_ANY, - TOD_MICROSECONDS_TO_TICKS (timeout * 1000), + RTEMS_MICROSECONDS_TO_TICKS (timeout * 1000), &out); if (sc != RTEMS_SUCCESSFUL) { @@ -236,7 +236,7 @@ bdbuf_watch (unsigned long timeout) rtems_event_set out; sc = rtems_event_receive (RTEMS_EVENT_1, RTEMS_WAIT | RTEMS_EVENT_ANY, - TOD_MICROSECONDS_TO_TICKS (timeout * 1000), + RTEMS_MICROSECONDS_TO_TICKS (timeout * 1000), &out); if (sc != RTEMS_SUCCESSFUL) { @@ -330,7 +330,7 @@ static bool bdbuf_sleep (unsigned long msecs) { rtems_status_code sc; - sc = rtems_task_wake_after (TOD_MICROSECONDS_TO_TICKS (msecs * 1000)); + sc = rtems_task_wake_after (RTEMS_MICROSECONDS_TO_TICKS (msecs * 1000)); if (sc != RTEMS_SUCCESSFUL) { bdbuf_test_printf ("sleep wake after failed: "); diff --git a/testsuites/psxtests/psx01/init.c b/testsuites/psxtests/psx01/init.c index 13eb0246cc..128bf23c02 100644 --- a/testsuites/psxtests/psx01/init.c +++ b/testsuites/psxtests/psx01/init.c @@ -18,6 +18,8 @@ #include "system.h" #include "pritime.h" +#include + void *POSIX_Init( void *argument ) diff --git a/testsuites/psxtests/psx05/init.c b/testsuites/psxtests/psx05/init.c index 06b5a371af..dc6a0c1637 100644 --- a/testsuites/psxtests/psx05/init.c +++ b/testsuites/psxtests/psx05/init.c @@ -17,6 +17,8 @@ #include "system.h" #include +#include + #define MUTEX_BAD_ID 0xfffffffe void Print_mutexattr( diff --git a/testsuites/psxtests/psxclock/init.c b/testsuites/psxtests/psxclock/init.c index 16b3c3c6d3..819bc15d6d 100644 --- a/testsuites/psxtests/psxclock/init.c +++ b/testsuites/psxtests/psxclock/init.c @@ -17,6 +17,8 @@ #include "pmacros.h" #include "pritime.h" +#include + /* forward declarations to avoid warnings */ rtems_task Init(rtems_task_argument argument); void check_enosys(int status); diff --git a/testsuites/samples/nsecs/init.c b/testsuites/samples/nsecs/init.c index f94c672d0c..fe5390dc38 100644 --- a/testsuites/samples/nsecs/init.c +++ b/testsuites/samples/nsecs/init.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #define CONFIGURE_INIT @@ -81,13 +82,9 @@ rtems_task Init( for (index=0 ; index <10 ; index++ ) { struct timespec start, stop; struct timespec diff; -#if 0 + clock_gettime( CLOCK_REALTIME, &start ); clock_gettime( CLOCK_REALTIME, &stop ); -#else - _TOD_Get( &start ); - _TOD_Get( &stop ); -#endif subtract_em( &start, &stop, &diff ); printf( "Start: %s:%ld\nStop : %s:%ld", diff --git a/testsuites/sptests/sp01/task1.c b/testsuites/sptests/sp01/task1.c index 1527b808a6..d2b824afc1 100644 --- a/testsuites/sptests/sp01/task1.c +++ b/testsuites/sptests/sp01/task1.c @@ -25,12 +25,7 @@ rtems_task Task_1_through_3( status = rtems_object_get_classic_name( rtems_task_self(), &name ); directive_failed( status, "rtems_object_get_classic_name" ); - /* - * Use TOD_MILLISECONDS_TO_TICKS not RTEMS_MILLISECONDS_TO_TICKS to - * test C implementation in SuperCore -- not macro version used - * everywhere else. - */ - ticks = TOD_MILLISECONDS_TO_TICKS( index * 5 * 1000 ); + ticks = RTEMS_MILLISECONDS_TO_TICKS( index * 5 * 1000 ); while( FOREVER ) { status = rtems_clock_get_tod( &time ); diff --git a/testsuites/sptests/sp16/task5.c b/testsuites/sptests/sp16/task5.c index ced8c27106..d2dcc4e527 100644 --- a/testsuites/sptests/sp16/task5.c +++ b/testsuites/sptests/sp16/task5.c @@ -46,12 +46,7 @@ rtems_task Task5( Put_address_from_area_1( segment_address_1 ); new_line; - /* - * Use TOD_MICROSECONDS_TO_TICKS not RTEMS_MICROSECONDS_TO_TICKS to - * test C implementation in SuperCore -- not macro version used - * everywhere else. - */ - status = rtems_task_wake_after( TOD_MICROSECONDS_TO_TICKS( 1000000 ) ); + status = rtems_task_wake_after( RTEMS_MICROSECONDS_TO_TICKS( 1000000 ) ); directive_failed( status, "rtems_task_wake_after" ); puts( "TA5 - rtems_region_get_segment - wait on 3K segment from region 1" ); diff --git a/testsuites/sptests/spcbssched01/task1.c b/testsuites/sptests/spcbssched01/task1.c index 0139f04715..cf965491e6 100644 --- a/testsuites/sptests/spcbssched01/task1.c +++ b/testsuites/sptests/spcbssched01/task1.c @@ -34,12 +34,7 @@ rtems_task Task_1_through_3( status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); directive_failed( status, "rtems_task_ident" ); - /* - * Use TOD_MILLISECONDS_TO_TICKS not RTEMS_MILLISECONDS_TO_TICKS to - * test C implementation in SuperCore -- not macro version used - * everywhere else. - */ - ticks = TOD_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 ); + ticks = RTEMS_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 ); while( FOREVER ) { status = rtems_clock_get_tod( &time ); diff --git a/testsuites/sptests/spedfsched01/task1.c b/testsuites/sptests/spedfsched01/task1.c index a668190613..d38df41a46 100644 --- a/testsuites/sptests/spedfsched01/task1.c +++ b/testsuites/sptests/spedfsched01/task1.c @@ -34,12 +34,7 @@ rtems_task Task_1_through_3( status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); directive_failed( status, "rtems_task_ident" ); - /* - * Use TOD_MILLISECONDS_TO_TICKS not RTEMS_MILLISECONDS_TO_TICKS to - * test C implementation in SuperCore -- not macro version used - * everywhere else. - */ - ticks = TOD_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 ); + ticks = RTEMS_MILLISECONDS_TO_TICKS( task_number( tid ) * 5 * 1000 ); while( FOREVER ) { status = rtems_clock_get_tod( &time ); -- cgit v1.2.3