1 | /** |
---|
2 | * @file rtems/posix/timer.h |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * $Id$ |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef _RTEMS_POSIX_TIMER_H |
---|
10 | #define _RTEMS_POSIX_TIMER_H |
---|
11 | |
---|
12 | #include <rtems/posix/config.h> |
---|
13 | /* |
---|
14 | * Constants |
---|
15 | */ |
---|
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 */ |
---|
21 | /* Maximum number of nsec allowed */ |
---|
22 | #define MAX_NSEC_C (uint32_t )1000000000 |
---|
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*/ |
---|
27 | /* Nanoseconds in a second */ |
---|
28 | #define NSEC_PER_SEC_C (uint32_t )1000000000 |
---|
29 | |
---|
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 ) |
---|
35 | |
---|
36 | |
---|
37 | /* |
---|
38 | * Data for a timer |
---|
39 | */ |
---|
40 | |
---|
41 | typedef struct { |
---|
42 | Objects_Control Object; |
---|
43 | Watchdog_Control Timer; /* Internal Timer */ |
---|
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 */ |
---|
48 | uint32_t ticks; /* Number of ticks of the initialization */ |
---|
49 | uint32_t overrun; /* Number of expirations of the timer */ |
---|
50 | TOD_Control time; /* Time in which the timer was started */ |
---|
51 | } POSIX_Timer_Control; |
---|
52 | |
---|
53 | /* |
---|
54 | * _POSIX_Timers_Manager_initialization |
---|
55 | * |
---|
56 | * DESCRIPTION: |
---|
57 | * |
---|
58 | * This routine performs the initialization necessary for this manager. |
---|
59 | */ |
---|
60 | |
---|
61 | void _POSIX_Timer_Manager_initialization ( int max_timers ); |
---|
62 | |
---|
63 | /* |
---|
64 | * The following defines the information control block used to manage |
---|
65 | * this class of objects. |
---|
66 | */ |
---|
67 | |
---|
68 | POSIX_EXTERN Objects_Information _POSIX_Timer_Information; |
---|
69 | |
---|
70 | #ifndef __RTEMS_APPLICATION__ |
---|
71 | #include <rtems/posix/timer.inl> |
---|
72 | #endif |
---|
73 | |
---|
74 | #endif |
---|
75 | /* end of include file */ |
---|