modules/tm/timer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef _TIMER_H
00039 #define _TIMER_H
00040
00041 #include "../../timer.h"
00042 #include "lock.h"
00043
00044 #define MIN_TIMER_VALUE 2
00045
00046
00047
00048
00049
00050 enum lists
00051 {
00052 FR_TIMER_LIST, FR_INV_TIMER_LIST,
00053 WT_TIMER_LIST,
00054 DELETE_LIST,
00055 RT_T1_TO_1, RT_T1_TO_2, RT_T1_TO_3,
00056 RT_T2,
00057 NR_OF_TIMER_LISTS
00058 };
00059
00060
00061
00062
00063 typedef struct timer_link
00064 {
00065 struct timer_link *next_tl;
00066 struct timer_link *prev_tl;
00067 struct timer_link *ld_tl;
00068 volatile utime_t time_out;
00069 struct timer *timer_list;
00070 unsigned int deleted;
00071 #ifdef EXTRA_DEBUG
00072 enum timer_groups tg;
00073 #endif
00074 }timer_link_type ;
00075
00076
00077
00078 typedef struct timer
00079 {
00080 struct timer_link first_tl;
00081 struct timer_link last_tl;
00082 ser_lock_t* mutex;
00083 enum lists id;
00084 } timer_type;
00085
00086
00087
00088 struct timer_table
00089 {
00090
00091 struct timer timers[ NR_OF_TIMER_LISTS ];
00092 };
00093
00094
00095
00096
00097
00098 extern int timer_group[NR_OF_TIMER_LISTS];
00099 extern unsigned int timer_id2timeout[NR_OF_TIMER_LISTS];
00100
00101
00102
00103 struct timer_table * tm_init_timers(void);
00104 void unlink_timer_lists(void);
00105 void free_timer_table(void);
00106 void init_timer_list( enum lists list_id);
00107 void reset_timer_list( enum lists list_id);
00108
00109 void reset_timer( struct timer_link* tl );
00110
00111
00112 void set_timer( struct timer_link *new_tl, enum lists list_id,
00113 utime_t* ext_timeout );
00114
00115
00116
00117 void set_1timer( struct timer_link *new_tl, enum lists list_id,
00118 utime_t* ext_timeout );
00119
00120 void timer_routine( unsigned int, void*);
00121
00122 void utimer_routine( utime_t, void*);
00123
00124 struct timer_table *get_timertable(void);
00125
00126 #endif