[6c2675d] | 1 | /** |
---|
| 2 | * @file rtems/posix/timer.h |
---|
| 3 | */ |
---|
| 4 | |
---|
[68003979] | 5 | /* |
---|
| 6 | * $Id$ |
---|
| 7 | */ |
---|
| 8 | |
---|
[5ec2f12d] | 9 | #ifndef _RTEMS_POSIX_TIMER_H |
---|
| 10 | #define _RTEMS_POSIX_TIMER_H |
---|
[68003979] | 11 | |
---|
[0243b0d] | 12 | #include <rtems/posix/config.h> |
---|
| 13 | /* |
---|
[07e0743] | 14 | * Constants |
---|
[0243b0d] | 15 | */ |
---|
[07e0743] | 16 | |
---|
| 17 | #define STATE_FREE_C 0x01 /* Free position of the table of timers */ |
---|
| 18 | #define STATE_CREATE_NEW_C 0x02 /* Created timer but not running */ |
---|
| 19 | #define STATE_CREATE_RUN_C 0x03 /* Created timer and running */ |
---|
| 20 | #define STATE_CREATE_STOP_C 0x04 /* Created, ran and stopped timer */ |
---|
[35ee867] | 21 | /* Maximum number of nsec allowed */ |
---|
[39cefdd] | 22 | #define MAX_NSEC_C (uint32_t )1000000000 |
---|
[07e0743] | 23 | #define MIN_NSEC_C 0 /* Minimum number of nsec allowew */ |
---|
| 24 | #define TIMER_RELATIVE_C 0 /* Indicates that the fire time is |
---|
| 25 | * relative to the current one */ |
---|
| 26 | #define SEC_TO_TICKS_C _TOD_Ticks_per_second /* Number of ticks in a second*/ |
---|
[35ee867] | 27 | /* Nanoseconds in a second */ |
---|
[39cefdd] | 28 | #define NSEC_PER_SEC_C (uint32_t )1000000000 |
---|
[07e0743] | 29 | |
---|
[39cefdd] | 30 | #define SECONDS_PER_YEAR_C (uint32_t )(360 * 24) * (uint32_t )(60 * 60) |
---|
| 31 | #define SECONDS_PER_MONTH_C (uint32_t )( 30 * 24) * (uint32_t )(60 * 60) |
---|
| 32 | #define SECONDS_PER_DAY_C (uint32_t )( 24 * 60) * (uint32_t )(60) |
---|
| 33 | #define SECONDS_PER_HOUR_C (uint32_t )( 60 * 60 ) |
---|
| 34 | #define SECONDS_PER_MINUTE_C (uint32_t )( 60 ) |
---|
[07e0743] | 35 | |
---|
| 36 | |
---|
[68003979] | 37 | /* |
---|
| 38 | * Data for a timer |
---|
| 39 | */ |
---|
| 40 | |
---|
| 41 | typedef struct { |
---|
[b602c298] | 42 | Objects_Control Object; |
---|
[0243b0d] | 43 | Watchdog_Control Timer; /* Internal Timer */ |
---|
[68003979] | 44 | pthread_t thread_id; /* Thread identifier */ |
---|
| 45 | char state; /* State of the timer */ |
---|
| 46 | struct sigevent inf; /* Information associated to the timer */ |
---|
| 47 | struct itimerspec timer_data; /* Timing data of the timer */ |
---|
[39cefdd] | 48 | uint32_t ticks; /* Number of ticks of the initialization */ |
---|
| 49 | uint32_t overrun; /* Number of expirations of the timer */ |
---|
[0243b0d] | 50 | TOD_Control time; /* Time in which the timer was started */ |
---|
[939e29d] | 51 | } POSIX_Timer_Control; |
---|
[68003979] | 52 | |
---|
| 53 | /* |
---|
[0243b0d] | 54 | * _POSIX_Timers_Manager_initialization |
---|
| 55 | * |
---|
| 56 | * DESCRIPTION: |
---|
| 57 | * |
---|
| 58 | * This routine performs the initialization necessary for this manager. |
---|
[68003979] | 59 | */ |
---|
| 60 | |
---|
[0243b0d] | 61 | void _POSIX_Timer_Manager_initialization ( int max_timers ); |
---|
[68003979] | 62 | |
---|
[b602c298] | 63 | /* |
---|
| 64 | * The following defines the information control block used to manage |
---|
| 65 | * this class of objects. |
---|
| 66 | */ |
---|
| 67 | |
---|
[0243b0d] | 68 | POSIX_EXTERN Objects_Information _POSIX_Timer_Information; |
---|
[b602c298] | 69 | |
---|
| 70 | #ifndef __RTEMS_APPLICATION__ |
---|
| 71 | #include <rtems/posix/timer.inl> |
---|
| 72 | #endif |
---|
| 73 | |
---|
[68003979] | 74 | #endif |
---|
| 75 | /* end of include file */ |
---|