1 | /* |
---|
2 | * $Id$ |
---|
3 | */ |
---|
4 | |
---|
5 | #ifndef __RTEMS_POSIX_TIMERS_h |
---|
6 | #define __RTEMS_POSIX_TIMERS_h |
---|
7 | |
---|
8 | /* ************ |
---|
9 | * Constants |
---|
10 | * ************/ |
---|
11 | |
---|
12 | #define STATE_FREE_C 0x01 /* Free position of the table of timers */ |
---|
13 | #define STATE_CREATE_NEW_C 0x02 /* Created timer but not running */ |
---|
14 | #define STATE_CREATE_RUN_C 0x03 /* Created timer and running */ |
---|
15 | #define STATE_CREATE_STOP_C 0x04 /* Created, ran and stopped timer */ |
---|
16 | /* Maximum number of nsec allowed */ |
---|
17 | #define MAX_NSEC_C (uint32_t )1000000000 |
---|
18 | #define MIN_NSEC_C 0 /* Minimum number of nsec allowew */ |
---|
19 | #define TIMER_RELATIVE_C 0 /* Indicates that the fire time is |
---|
20 | * relative to the current one */ |
---|
21 | #define SEC_TO_TICKS_C _TOD_Ticks_per_second /* Number of ticks in a second*/ |
---|
22 | /* Nanoseconds in a second */ |
---|
23 | #define NSEC_PER_SEC_C (uint32_t )1000000000 |
---|
24 | |
---|
25 | #define NO_MORE_TIMERS_C 11 /* There is not available timers */ |
---|
26 | #define BAD_TIMER_C 11 /* The timer does not exist in the table */ |
---|
27 | |
---|
28 | #define SECONDS_PER_YEAR_C (uint32_t )(360 * 24) * (uint32_t )(60 * 60) |
---|
29 | #define SECONDS_PER_MONTH_C (uint32_t )( 30 * 24) * (uint32_t )(60 * 60) |
---|
30 | #define SECONDS_PER_DAY_C (uint32_t )( 24 * 60) * (uint32_t )(60) |
---|
31 | #define SECONDS_PER_HOUR_C (uint32_t )( 60 * 60 ) |
---|
32 | #define SECONDS_PER_MINUTE_C (uint32_t )( 60 ) |
---|
33 | |
---|
34 | |
---|
35 | /* |
---|
36 | * Data for a timer |
---|
37 | */ |
---|
38 | |
---|
39 | typedef struct { |
---|
40 | Objects_Control Object; |
---|
41 | Watchdog_Control Ticker; |
---|
42 | |
---|
43 | pthread_t thread_id; /* Thread identifier */ |
---|
44 | char state; /* State of the timer */ |
---|
45 | struct sigevent inf; /* Information associated to the timer */ |
---|
46 | timer_t timer_id; /* Created timer identifier */ |
---|
47 | struct itimerspec timer_data; /* Timing data of the timer */ |
---|
48 | uint32_t ticks; /* Number of ticks of the initialization */ |
---|
49 | uint32_t overrun; /* Number of expirations of the timer */ |
---|
50 | rtems_time_of_day time; /* Time in which the timer was started */ |
---|
51 | } POSIX_Timer_Control; |
---|
52 | |
---|
53 | /* |
---|
54 | * Array of Timers |
---|
55 | */ |
---|
56 | |
---|
57 | extern int timer_max; |
---|
58 | extern POSIX_Timer_Control *timer_struct; |
---|
59 | |
---|
60 | /* |
---|
61 | * The following defines the information control block used to manage |
---|
62 | * this class of objects. |
---|
63 | */ |
---|
64 | |
---|
65 | RTEMS_EXTERN Objects_Information _POSIX_Timer_Information; |
---|
66 | |
---|
67 | #ifndef __RTEMS_APPLICATION__ |
---|
68 | #include <rtems/posix/timer.inl> |
---|
69 | #endif |
---|
70 | |
---|
71 | #endif |
---|
72 | /* end of include file */ |
---|
73 | |
---|