diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-19 15:08:53 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-22 16:57:24 +0200 |
commit | f17c7798288c530cda114db266dd6790c70f8b28 (patch) | |
tree | e60d2ce825ff6c1bebced34e0fdb6753648cb645 | |
parent | score: Avoid direct usage of _Thread_Executing (diff) | |
download | rtems-f17c7798288c530cda114db266dd6790c70f8b28.tar.bz2 |
posix: Create timer implementation header
Move implementation specific parts of timer.h and timer.inl into new
header file timerimpl.h. The timer.h contains now only the application
visible API.
-rw-r--r-- | cpukit/libcsupport/src/resource_snapshot.c | 2 | ||||
-rw-r--r-- | cpukit/posix/Makefile.am | 2 | ||||
-rw-r--r-- | cpukit/posix/include/rtems/posix/timer.h | 74 | ||||
-rw-r--r-- | cpukit/posix/include/rtems/posix/timerimpl.h (renamed from cpukit/posix/inline/rtems/posix/timer.inl) | 71 | ||||
-rw-r--r-- | cpukit/posix/preinstall.am | 8 | ||||
-rw-r--r-- | cpukit/posix/src/ptimer.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/timercreate.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/timerdelete.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/timergetoverrun.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/timergettime.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/timerinserthelper.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/timersettime.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/timertsr.c | 2 | ||||
-rw-r--r-- | cpukit/sapi/src/posixapi.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer01/psxtimer.c | 1 |
15 files changed, 90 insertions, 86 deletions
diff --git a/cpukit/libcsupport/src/resource_snapshot.c b/cpukit/libcsupport/src/resource_snapshot.c index 6b875a8487..48bbdc8306 100644 --- a/cpukit/libcsupport/src/resource_snapshot.c +++ b/cpukit/libcsupport/src/resource_snapshot.c @@ -40,7 +40,7 @@ #include <rtems/posix/rwlockimpl.h> #include <rtems/posix/semaphoreimpl.h> #include <rtems/posix/spinlock.h> - #include <rtems/posix/timer.h> + #include <rtems/posix/timerimpl.h> #endif static const Objects_Information *objects_info_table[] = { diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am index 6e69fdd6bd..9bea73b56c 100644 --- a/cpukit/posix/Makefile.am +++ b/cpukit/posix/Makefile.am @@ -46,6 +46,7 @@ include_rtems_posix_HEADERS += include/rtems/posix/semaphoreimpl.h include_rtems_posix_HEADERS += include/rtems/posix/threadsup.h include_rtems_posix_HEADERS += include/rtems/posix/time.h include_rtems_posix_HEADERS += include/rtems/posix/timer.h +include_rtems_posix_HEADERS += include/rtems/posix/timerimpl.h include_rtems_posix_HEADERS += include/rtems/posix/barrier.h include_rtems_posix_HEADERS += include/rtems/posix/barrierimpl.h include_rtems_posix_HEADERS += include/rtems/posix/rwlock.h @@ -53,7 +54,6 @@ include_rtems_posix_HEADERS += include/rtems/posix/rwlockimpl.h include_rtems_posix_HEADERS += include/rtems/posix/spinlock.h include_rtems_posix_HEADERS += inline/rtems/posix/key.inl -include_rtems_posix_HEADERS += inline/rtems/posix/timer.inl include_rtems_posix_HEADERS += inline/rtems/posix/spinlock.inl ## src diff --git a/cpukit/posix/include/rtems/posix/timer.h b/cpukit/posix/include/rtems/posix/timer.h index 0b70cc9950..ff21df0295 100644 --- a/cpukit/posix/include/rtems/posix/timer.h +++ b/cpukit/posix/include/rtems/posix/timer.h @@ -19,44 +19,21 @@ #ifndef _RTEMS_POSIX_TIMER_H #define _RTEMS_POSIX_TIMER_H -#include <rtems/posix/config.h> #include <rtems/score/object.h> -#include <rtems/score/watchdog.h> /* Watchdog_Control */ +#include <rtems/score/watchdog.h> -/** - * @defgroup POSIX_INTERNAL_TIMERS POSIX Timer Private Support - * - * @ingroup POSIXAPI - */ -/**@{*/ +#include <pthread.h> #ifdef __cplusplus extern "C" { #endif -/* Timer is free */ -#define POSIX_TIMER_STATE_FREE 0x01 - -/* Created timer but not running */ -#define POSIX_TIMER_STATE_CREATE_NEW 0x02 - -/* Created timer and running */ -#define POSIX_TIMER_STATE_CREATE_RUN 0x03 - -/* Created, ran and stopped timer */ -#define POSIX_TIMER_STATE_CREATE_STOP 0x04 - -/* Indicates that the fire time is relative to the current one */ -#define POSIX_TIMER_RELATIVE 0 - -/* - * POSIX defines TIMER_ABSTIME but no constant for relative. So - * we have one internally but we need to be careful it has a different - * value. +/** + * @defgroup POSIX_INTERNAL_TIMERS POSIX Timer Private Support + * + * @ingroup POSIXAPI */ -#if (POSIX_TIMER_RELATIVE == TIMER_ABSTIME) -#error "POSIX_TIMER_RELATIVE == TIMER_ABSTIME" -#endif +/**@{*/ /* * Data for a timer @@ -73,43 +50,6 @@ typedef struct { struct timespec time; /* Time at which the timer was started */ } POSIX_Timer_Control; -/* - * _POSIX_Timers_Manager_initialization - * - * DESCRIPTION: - * - * This routine performs the initialization necessary for this manager. - */ -void _POSIX_Timer_Manager_initialization(void); - -/* - * @brief Operation that is run when a timer expires - * - * Timer TSR - */ -void _POSIX_Timer_TSR(Objects_Id timer, void *data); - -/* - * Watchdog Insert helper - */ -bool _POSIX_Timer_Insert_helper( - Watchdog_Control *timer, - Watchdog_Interval ticks, - Objects_Id id, - Watchdog_Service_routine_entry TSR, - void *arg -); - -/* - * The following defines the information control block used to manage - * this class of objects. - */ -POSIX_EXTERN Objects_Information _POSIX_Timer_Information; - -#ifndef __RTEMS_APPLICATION__ -#include <rtems/posix/timer.inl> -#endif - /** @} */ #ifdef __cplusplus diff --git a/cpukit/posix/inline/rtems/posix/timer.inl b/cpukit/posix/include/rtems/posix/timerimpl.h index bc1db80c88..73f953b45e 100644 --- a/cpukit/posix/inline/rtems/posix/timer.inl +++ b/cpukit/posix/include/rtems/posix/timerimpl.h @@ -16,12 +16,71 @@ * http://www.rtems.com/license/LICENSE. */ -#ifndef _RTEMS_POSIX_TIMER_H -# error "Never use <rtems/posix/timer.inl> directly; include <rtems/posix/timer.h> instead." +#ifndef _RTEMS_POSIX_TIMERIMPL_H +#define _RTEMS_POSIX_TIMERIMPL_H + +#include <rtems/posix/timer.h> + +#ifdef __cplusplus +extern "C" { #endif -#ifndef _RTEMS_POSIX_TIMER_INL -#define _RTEMS_POSIX_TIMER_INL +/* Timer is free */ +#define POSIX_TIMER_STATE_FREE 0x01 + +/* Created timer but not running */ +#define POSIX_TIMER_STATE_CREATE_NEW 0x02 + +/* Created timer and running */ +#define POSIX_TIMER_STATE_CREATE_RUN 0x03 + +/* Created, ran and stopped timer */ +#define POSIX_TIMER_STATE_CREATE_STOP 0x04 + +/* Indicates that the fire time is relative to the current one */ +#define POSIX_TIMER_RELATIVE 0 + +/* + * POSIX defines TIMER_ABSTIME but no constant for relative. So + * we have one internally but we need to be careful it has a different + * value. + */ +#if (POSIX_TIMER_RELATIVE == TIMER_ABSTIME) +#error "POSIX_TIMER_RELATIVE == TIMER_ABSTIME" +#endif + +/* + * _POSIX_Timers_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ +void _POSIX_Timer_Manager_initialization(void); + +/* + * @brief Operation that is run when a timer expires + * + * Timer TSR + */ +void _POSIX_Timer_TSR(Objects_Id timer, void *data); + +/* + * Watchdog Insert helper + */ +bool _POSIX_Timer_Insert_helper( + Watchdog_Control *timer, + Watchdog_Interval ticks, + Objects_Id id, + Watchdog_Service_routine_entry TSR, + void *arg +); + +/* + * The following defines the information control block used to manage + * this class of objects. + */ +POSIX_EXTERN Objects_Information _POSIX_Timer_Information; /* * _POSIX_Timer_Allocate @@ -89,5 +148,9 @@ RTEMS_INLINE_ROUTINE bool _POSIX_Timer_Is_null ( return (the_timer == NULL); } +#ifdef __cplusplus +} +#endif + #endif /* end of include file */ diff --git a/cpukit/posix/preinstall.am b/cpukit/posix/preinstall.am index 07e987aac2..7cb8ee8348 100644 --- a/cpukit/posix/preinstall.am +++ b/cpukit/posix/preinstall.am @@ -128,6 +128,10 @@ $(PROJECT_INCLUDE)/rtems/posix/timer.h: include/rtems/posix/timer.h $(PROJECT_IN $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/timer.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/timer.h +$(PROJECT_INCLUDE)/rtems/posix/timerimpl.h: include/rtems/posix/timerimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/timerimpl.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/timerimpl.h + $(PROJECT_INCLUDE)/rtems/posix/barrier.h: include/rtems/posix/barrier.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/barrier.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/barrier.h @@ -152,10 +156,6 @@ $(PROJECT_INCLUDE)/rtems/posix/key.inl: inline/rtems/posix/key.inl $(PROJECT_INC $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/key.inl PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/key.inl -$(PROJECT_INCLUDE)/rtems/posix/timer.inl: inline/rtems/posix/timer.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/timer.inl -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/timer.inl - $(PROJECT_INCLUDE)/rtems/posix/spinlock.inl: inline/rtems/posix/spinlock.inl $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/spinlock.inl PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/spinlock.inl diff --git a/cpukit/posix/src/ptimer.c b/cpukit/posix/src/ptimer.c index 540fb71cef..5ce17d4e21 100644 --- a/cpukit/posix/src/ptimer.c +++ b/cpukit/posix/src/ptimer.c @@ -44,7 +44,7 @@ #include <stdio.h> #include <signal.h> -#include <rtems/posix/timer.h> +#include <rtems/posix/timerimpl.h> /* * _POSIX_Timer_Manager_initialization diff --git a/cpukit/posix/src/timercreate.c b/cpukit/posix/src/timercreate.c index a8690b6699..8316e58398 100644 --- a/cpukit/posix/src/timercreate.c +++ b/cpukit/posix/src/timercreate.c @@ -29,7 +29,7 @@ #include <rtems/score/thread.h> #include <rtems/posix/sigset.h> #include <rtems/posix/time.h> -#include <rtems/posix/timer.h> +#include <rtems/posix/timerimpl.h> int timer_create( clockid_t clock_id, diff --git a/cpukit/posix/src/timerdelete.c b/cpukit/posix/src/timerdelete.c index e17d48b181..686dc78f1d 100644 --- a/cpukit/posix/src/timerdelete.c +++ b/cpukit/posix/src/timerdelete.c @@ -28,7 +28,7 @@ #include <rtems/seterr.h> #include <rtems/score/thread.h> #include <rtems/posix/time.h> -#include <rtems/posix/timer.h> +#include <rtems/posix/timerimpl.h> int timer_delete( diff --git a/cpukit/posix/src/timergetoverrun.c b/cpukit/posix/src/timergetoverrun.c index 0708db4f7d..fda4280dd9 100644 --- a/cpukit/posix/src/timergetoverrun.c +++ b/cpukit/posix/src/timergetoverrun.c @@ -24,7 +24,7 @@ #include <rtems/system.h> #include <rtems/seterr.h> #include <rtems/score/thread.h> -#include <rtems/posix/timer.h> +#include <rtems/posix/timerimpl.h> int timer_getoverrun( timer_t timerid diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c index a4b0f3ae58..b000ed4b47 100644 --- a/cpukit/posix/src/timergettime.c +++ b/cpukit/posix/src/timergettime.c @@ -28,7 +28,7 @@ #include <rtems/score/thread.h> #include <rtems/score/tod.h> #include <rtems/score/timespec.h> -#include <rtems/posix/timer.h> +#include <rtems/posix/timerimpl.h> /* * - When a timer is initialized, the value of the time in diff --git a/cpukit/posix/src/timerinserthelper.c b/cpukit/posix/src/timerinserthelper.c index eddc455f57..66b3e9b007 100644 --- a/cpukit/posix/src/timerinserthelper.c +++ b/cpukit/posix/src/timerinserthelper.c @@ -26,7 +26,7 @@ #include <rtems/seterr.h> #include <rtems/score/isr.h> #include <rtems/score/watchdog.h> -#include <rtems/posix/timer.h> +#include <rtems/posix/timerimpl.h> #include <rtems/posix/ptimer.h> bool _POSIX_Timer_Insert_helper( diff --git a/cpukit/posix/src/timersettime.c b/cpukit/posix/src/timersettime.c index 678266ae3c..ae29e3d582 100644 --- a/cpukit/posix/src/timersettime.c +++ b/cpukit/posix/src/timersettime.c @@ -29,7 +29,7 @@ #include <rtems/score/tod.h> #include <rtems/posix/time.h> #include <rtems/posix/ptimer.h> -#include <rtems/posix/timer.h> +#include <rtems/posix/timerimpl.h> int timer_settime( timer_t timerid, diff --git a/cpukit/posix/src/timertsr.c b/cpukit/posix/src/timertsr.c index ad17ae91c2..eb6ca9fd89 100644 --- a/cpukit/posix/src/timertsr.c +++ b/cpukit/posix/src/timertsr.c @@ -30,7 +30,7 @@ #include <rtems/score/tod.h> #include <rtems/posix/time.h> #include <rtems/posix/ptimer.h> -#include <rtems/posix/timer.h> +#include <rtems/posix/timerimpl.h> /* * This is the operation that is run when a timer expires diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c index b460406ce2..6cdffa7a28 100644 --- a/cpukit/sapi/src/posixapi.c +++ b/cpukit/sapi/src/posixapi.c @@ -39,7 +39,7 @@ #include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthreadimpl.h> #include <rtems/posix/rwlockimpl.h> -#include <rtems/posix/timer.h> +#include <rtems/posix/timerimpl.h> #include <rtems/posix/semaphoreimpl.h> #include <rtems/posix/spinlock.h> #include <rtems/posix/time.h> diff --git a/testsuites/psxtests/psxtimer01/psxtimer.c b/testsuites/psxtests/psxtimer01/psxtimer.c index 2f51d33579..e055dea1c7 100644 --- a/testsuites/psxtests/psxtimer01/psxtimer.c +++ b/testsuites/psxtests/psxtimer01/psxtimer.c @@ -32,6 +32,7 @@ #include <sched.h> /* schedule facilities */ #include <time.h> /* time facilities */ #include <stdio.h> /* console facilities */ +#include <rtems/posix/timerimpl.h> #include <rtems/score/timespec.h> #include "pritime.h" |