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.
This commit is contained in:
Sebastian Huber
2013-07-22 16:57:24 +02:00
parent 982e97463f
commit f17c779828
15 changed files with 90 additions and 86 deletions
+1 -1
View File
@@ -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[] = {
+1 -1
View File
@@ -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
+7 -67
View File
@@ -19,9 +19,14 @@
#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>
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup POSIX_INTERNAL_TIMERS POSIX Timer Private Support
@@ -30,34 +35,6 @@
*/
/**@{*/
#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.
*/
#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
@@ -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 */
+4 -4
View File
@@ -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
+1 -1
View File
@@ -44,7 +44,7 @@
#include <stdio.h>
#include <signal.h>
#include <rtems/posix/timer.h>
#include <rtems/posix/timerimpl.h>
/*
* _POSIX_Timer_Manager_initialization
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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(
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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(
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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>
@@ -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"