17 </ul></div> |
17 </ul></div> |
18 <h1>/home/epimerde/documents/tc11/CanFestival-3/src/timer.c File Reference</h1><code>#include <applicfg.h></code><br> |
18 <h1>/home/epimerde/documents/tc11/CanFestival-3/src/timer.c File Reference</h1><code>#include <applicfg.h></code><br> |
19 <code>#include "timer.h"</code><br> |
19 <code>#include "timer.h"</code><br> |
20 |
20 |
21 <p> |
21 <p> |
|
22 Include dependency graph for timer.c:<p><center><img src="timer_8c__incl.png" border="0" usemap="#/home/epimerde/documents/tc11/CanFestival-3/src/timer.c_map" alt=""></center> |
|
23 |
|
24 <p> |
22 <a href="timer_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0"> |
25 <a href="timer_8c-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0"> |
23 <tr><td></td></tr> |
26 <tr><td></td></tr> |
24 <tr><td colspan="2"><br><h2>Defines</h2></td></tr> |
27 <tr><td colspan="2"><br><h2>Defines</h2></td></tr> |
25 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8c.html#8536312cebeeea3a23dc0027800122c9">min_val</a>(a, b) ((a<b)?a:b)</td></tr> |
28 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8c.html#8536312cebeeea3a23dc0027800122c9">min_val</a>(a, b) ((a<b)?a:b)</td></tr> |
26 |
29 |
37 <tr><td class="memItemLeft" nowrap align="right" valign="top">TIMEVAL </td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8c.html#5e9651eed13d70bcce9bdf3489a72a3d">total_sleep_time</a> = TIMEVAL_MAX</td></tr> |
40 <tr><td class="memItemLeft" nowrap align="right" valign="top">TIMEVAL </td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8c.html#5e9651eed13d70bcce9bdf3489a72a3d">total_sleep_time</a> = TIMEVAL_MAX</td></tr> |
38 |
41 |
39 <tr><td class="memItemLeft" nowrap align="right" valign="top">TIMER_HANDLE </td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8c.html#1dab7b9a29bdee8b1931f8ea90685c6f">last_timer_raw</a> = -1</td></tr> |
42 <tr><td class="memItemLeft" nowrap align="right" valign="top">TIMER_HANDLE </td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8c.html#1dab7b9a29bdee8b1931f8ea90685c6f">last_timer_raw</a> = -1</td></tr> |
40 |
43 |
41 </table> |
44 </table> |
42 <hr><h2>Define Documentation</h2> |
45 <hr><a name="_details"></a><h2>Detailed Description</h2> |
|
46 <dl class="author" compact><dt><b>Author:</b></dt><dd>Edouard TISSERANT and Francis DUPIN </dd></dl> |
|
47 <dl class="date" compact><dt><b>Date:</b></dt><dd>Tue Jun 5 09:32:32 2007 </dd></dl> |
|
48 |
|
49 <p> |
|
50 Definition in file <a class="el" href="timer_8c-source.html">timer.c</a>.<hr><h2>Define Documentation</h2> |
43 <a class="anchor" name="8536312cebeeea3a23dc0027800122c9"></a><!-- doxytag: member="timer.c::min_val" ref="8536312cebeeea3a23dc0027800122c9" args="(a, b)" --> |
51 <a class="anchor" name="8536312cebeeea3a23dc0027800122c9"></a><!-- doxytag: member="timer.c::min_val" ref="8536312cebeeea3a23dc0027800122c9" args="(a, b)" --> |
44 <div class="memitem"> |
52 <div class="memitem"> |
45 <div class="memproto"> |
53 <div class="memproto"> |
46 <table class="memname"> |
54 <table class="memname"> |
47 <tr> |
55 <tr> |
60 <div class="memdoc"> |
68 <div class="memdoc"> |
61 |
69 |
62 <p> |
70 <p> |
63 |
71 |
64 <p> |
72 <p> |
65 Definition at line <a class="el" href="timer_8c-source.html#l00035">35</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
73 Definition at line <a class="el" href="timer_8c-source.html#l00044">44</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
|
74 <p> |
|
75 Referenced by <a class="el" href="timer_8c-source.html#l00131">TimeDispatch()</a>. |
66 </div> |
76 </div> |
67 </div><p> |
77 </div><p> |
68 <hr><h2>Function Documentation</h2> |
78 <hr><h2>Function Documentation</h2> |
69 <a class="anchor" name="991b3cfaac2f201b14d5530f75985c21"></a><!-- doxytag: member="timer.c::DelAlarm" ref="991b3cfaac2f201b14d5530f75985c21" args="(TIMER_HANDLE handle)" --> |
79 <a class="anchor" name="991b3cfaac2f201b14d5530f75985c21"></a><!-- doxytag: member="timer.c::DelAlarm" ref="991b3cfaac2f201b14d5530f75985c21" args="(TIMER_HANDLE handle)" --> |
70 <div class="memitem"> |
80 <div class="memitem"> |
81 </table> |
91 </table> |
82 </div> |
92 </div> |
83 <div class="memdoc"> |
93 <div class="memdoc"> |
84 |
94 |
85 <p> |
95 <p> |
86 |
96 ----- Use this to remove an alarm ----<p> |
87 <p> |
97 <dl compact><dt><b>Parameters:</b></dt><dd> |
88 Definition at line <a class="el" href="timer_8c-source.html#l00087">87</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
98 <table border="0" cellspacing="2" cellpadding="0"> |
89 <p> |
99 <tr><td valign="top"></td><td valign="top"><em>handle</em> </td><td></td></tr> |
90 References <a class="el" href="timer_8c-source.html#l00033">last_timer_raw</a>, and <a class="el" href="timer_8c-source.html#l00030">timers</a>. |
100 </table> |
|
101 </dl> |
|
102 <dl class="return" compact><dt><b>Returns:</b></dt><dd></dd></dl> |
|
103 |
|
104 <p> |
|
105 Quick and dirty. system timer will continue to be trigged, but no action will be preformed. |
|
106 <p> |
|
107 Definition at line <a class="el" href="timer_8c-source.html#l00112">112</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
|
108 <p> |
|
109 References <a class="el" href="timer_8c-source.html#l00042">last_timer_raw</a>, and <a class="el" href="timer_8c-source.html#l00039">timers</a>. |
|
110 <p> |
|
111 Referenced by <a class="el" href="lifegrd_8c-source.html#l00236">heartbeatStop()</a>, <a class="el" href="lifegrd_8c-source.html#l00081">proceedNODE_GUARD()</a>, <a class="el" href="lifegrd_8c-source.html#l00161">ProducerHearbeatAlarm()</a>, and <a class="el" href="sync_8c-source.html#l00105">stopSYNC()</a>. |
91 </div> |
112 </div> |
92 </div><p> |
113 </div><p> |
93 <a class="anchor" name="11c2616d78f06ed9144ef662f757b128"></a><!-- doxytag: member="timer.c::SetAlarm" ref="11c2616d78f06ed9144ef662f757b128" args="(CO_Data *d, UNS32 id, TimerCallback_t callback, TIMEVAL value, TIMEVAL period)" --> |
114 <a class="anchor" name="11c2616d78f06ed9144ef662f757b128"></a><!-- doxytag: member="timer.c::SetAlarm" ref="11c2616d78f06ed9144ef662f757b128" args="(CO_Data *d, UNS32 id, TimerCallback_t callback, TIMEVAL value, TIMEVAL period)" --> |
94 <div class="memitem"> |
115 <div class="memitem"> |
95 <div class="memproto"> |
116 <div class="memproto"> |
132 </table> |
153 </table> |
133 </div> |
154 </div> |
134 <div class="memdoc"> |
155 <div class="memdoc"> |
135 |
156 |
136 <p> |
157 <p> |
137 |
158 ------- Use this to declare a new alarm ------<p> |
138 <p> |
159 <dl compact><dt><b>Parameters:</b></dt><dd> |
139 Definition at line <a class="el" href="timer_8c-source.html#l00038">38</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
160 <table border="0" cellspacing="2" cellpadding="0"> |
140 <p> |
161 <tr><td valign="top"></td><td valign="top"><em>d</em> </td><td></td></tr> |
141 References <a class="el" href="timer_8c-source.html#l00033">last_timer_raw</a>, and <a class="el" href="timer_8c-source.html#l00030">timers</a>. |
162 <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td></td></tr> |
|
163 <tr><td valign="top"></td><td valign="top"><em>callback</em> </td><td></td></tr> |
|
164 <tr><td valign="top"></td><td valign="top"><em>value</em> </td><td></td></tr> |
|
165 <tr><td valign="top"></td><td valign="top"><em>period</em> </td><td></td></tr> |
|
166 </table> |
|
167 </dl> |
|
168 <dl class="return" compact><dt><b>Returns:</b></dt><dd></dd></dl> |
|
169 |
|
170 <p> |
|
171 in order to decide new timer setting we have to run over all timer rows<p> |
|
172 if something to store<p> |
|
173 and empty row<p> |
|
174 just store<p> |
|
175 if successfull<p> |
|
176 set next wakeup alarm if new entry is sooner than others, or if it is alone<p> |
|
177 printf("elapsed_time=%d real_timer_value=%d total_sleep_time=%d\n", elapsed_time, real_timer_value, total_sleep_time);<p> |
|
178 printf("SetAlarm() return %d\n", row_number); |
|
179 <p> |
|
180 Definition at line <a class="el" href="timer_8c-source.html#l00057">57</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
|
181 <p> |
|
182 References <a class="el" href="timer_8c-source.html#l00042">last_timer_raw</a>, and <a class="el" href="timer_8c-source.html#l00039">timers</a>. |
|
183 <p> |
|
184 Referenced by <a class="el" href="lifegrd_8c-source.html#l00206">heartbeatInit()</a>, <a class="el" href="lifegrd_8c-source.html#l00081">proceedNODE_GUARD()</a>, and <a class="el" href="sync_8c-source.html#l00080">startSYNC()</a>. |
142 </div> |
185 </div> |
143 </div><p> |
186 </div><p> |
144 <a class="anchor" name="fa75192a3238525618f8cb83004930cc"></a><!-- doxytag: member="timer.c::TimeDispatch" ref="fa75192a3238525618f8cb83004930cc" args="()" --> |
187 <a class="anchor" name="fa75192a3238525618f8cb83004930cc"></a><!-- doxytag: member="timer.c::TimeDispatch" ref="fa75192a3238525618f8cb83004930cc" args="()" --> |
145 <div class="memitem"> |
188 <div class="memitem"> |
146 <div class="memproto"> |
189 <div class="memproto"> |
155 </table> |
198 </table> |
156 </div> |
199 </div> |
157 <div class="memdoc"> |
200 <div class="memdoc"> |
158 |
201 |
159 <p> |
202 <p> |
160 |
203 ------ TimeDispatch is called on each timer expiration ---- |
161 <p> |
204 <p> |
162 Definition at line <a class="el" href="timer_8c-source.html#l00104">104</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
205 used to compute when should normaly occur next wakeup<p> |
163 <p> |
206 First run : change timer state depending on time<p> |
164 References <a class="el" href="timer_8c-source.html#l00033">last_timer_raw</a>, <a class="el" href="timer_8c-source.html#l00035">min_val</a>, <a class="el" href="timer_8c-source.html#l00030">timers</a>, and <a class="el" href="timer_8c-source.html#l00032">total_sleep_time</a>. |
207 Get time since timer signal<p> |
|
208 if row is active<p> |
|
209 to be trigged<p> |
|
210 if simply outdated<p> |
|
211 ask for trig<p> |
|
212 or period have expired<p> |
|
213 set val as interval, with overrun correction<p> |
|
214 Check if this new timer value is the soonest<p> |
|
215 Each armed timer value in decremented.<p> |
|
216 Check if this new timer value is the soonest<p> |
|
217 Remember how much time we should sleep.<p> |
|
218 Set timer to soonest occurence<p> |
|
219 Then trig them or not.<p> |
|
220 reset trig state (will be free if not periodic)<p> |
|
221 trig ! |
|
222 <p> |
|
223 Definition at line <a class="el" href="timer_8c-source.html#l00131">131</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
|
224 <p> |
|
225 References <a class="el" href="timer_8c-source.html#l00042">last_timer_raw</a>, <a class="el" href="timer_8c-source.html#l00044">min_val</a>, <a class="el" href="timer_8c-source.html#l00039">timers</a>, and <a class="el" href="timer_8c-source.html#l00041">total_sleep_time</a>. |
165 </div> |
226 </div> |
166 </div><p> |
227 </div><p> |
167 <hr><h2>Variable Documentation</h2> |
228 <hr><h2>Variable Documentation</h2> |
168 <a class="anchor" name="1dab7b9a29bdee8b1931f8ea90685c6f"></a><!-- doxytag: member="timer.c::last_timer_raw" ref="1dab7b9a29bdee8b1931f8ea90685c6f" args="" --> |
229 <a class="anchor" name="1dab7b9a29bdee8b1931f8ea90685c6f"></a><!-- doxytag: member="timer.c::last_timer_raw" ref="1dab7b9a29bdee8b1931f8ea90685c6f" args="" --> |
169 <div class="memitem"> |
230 <div class="memitem"> |
177 <div class="memdoc"> |
238 <div class="memdoc"> |
178 |
239 |
179 <p> |
240 <p> |
180 |
241 |
181 <p> |
242 <p> |
182 Definition at line <a class="el" href="timer_8c-source.html#l00033">33</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
243 Definition at line <a class="el" href="timer_8c-source.html#l00042">42</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
|
244 <p> |
|
245 Referenced by <a class="el" href="timer_8c-source.html#l00112">DelAlarm()</a>, <a class="el" href="timer_8c-source.html#l00057">SetAlarm()</a>, and <a class="el" href="timer_8c-source.html#l00131">TimeDispatch()</a>. |
183 </div> |
246 </div> |
184 </div><p> |
247 </div><p> |
185 <a class="anchor" name="a74e2cf2504bfd18b12f112c7aaad845"></a><!-- doxytag: member="timer.c::timers" ref="a74e2cf2504bfd18b12f112c7aaad845" args="[MAX_NB_TIMER]" --> |
248 <a class="anchor" name="a74e2cf2504bfd18b12f112c7aaad845"></a><!-- doxytag: member="timer.c::timers" ref="a74e2cf2504bfd18b12f112c7aaad845" args="[MAX_NB_TIMER]" --> |
186 <div class="memitem"> |
249 <div class="memitem"> |
187 <div class="memproto"> |
250 <div class="memproto"> |
194 <div class="memdoc"> |
257 <div class="memdoc"> |
195 |
258 |
196 <p> |
259 <p> |
197 |
260 |
198 <p> |
261 <p> |
199 Definition at line <a class="el" href="timer_8c-source.html#l00030">30</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
262 Definition at line <a class="el" href="timer_8c-source.html#l00039">39</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
|
263 <p> |
|
264 Referenced by <a class="el" href="timer_8c-source.html#l00112">DelAlarm()</a>, <a class="el" href="timer_8c-source.html#l00057">SetAlarm()</a>, and <a class="el" href="timer_8c-source.html#l00131">TimeDispatch()</a>. |
200 </div> |
265 </div> |
201 </div><p> |
266 </div><p> |
202 <a class="anchor" name="5e9651eed13d70bcce9bdf3489a72a3d"></a><!-- doxytag: member="timer.c::total_sleep_time" ref="5e9651eed13d70bcce9bdf3489a72a3d" args="" --> |
267 <a class="anchor" name="5e9651eed13d70bcce9bdf3489a72a3d"></a><!-- doxytag: member="timer.c::total_sleep_time" ref="5e9651eed13d70bcce9bdf3489a72a3d" args="" --> |
203 <div class="memitem"> |
268 <div class="memitem"> |
204 <div class="memproto"> |
269 <div class="memproto"> |
211 <div class="memdoc"> |
276 <div class="memdoc"> |
212 |
277 |
213 <p> |
278 <p> |
214 |
279 |
215 <p> |
280 <p> |
216 Definition at line <a class="el" href="timer_8c-source.html#l00032">32</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
281 Definition at line <a class="el" href="timer_8c-source.html#l00041">41</a> of file <a class="el" href="timer_8c-source.html">timer.c</a>. |
217 </div> |
282 <p> |
218 </div><p> |
283 Referenced by <a class="el" href="timer_8c-source.html#l00131">TimeDispatch()</a>. |
219 <hr size="1"><address style="align: right;"><small>Generated on Mon Jun 4 17:09:27 2007 for CanFestival by |
284 </div> |
|
285 </div><p> |
|
286 <hr size="1"><address style="align: right;"><small>Generated on Tue Jun 5 18:32:11 2007 for CanFestival by |
220 <a href="http://www.doxygen.org/index.html"> |
287 <a href="http://www.doxygen.org/index.html"> |
221 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address> |
288 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address> |
222 </body> |
289 </body> |
223 </html> |
290 </html> |