FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/nucleus/debug-chases/tmse.c.dbg @ 143:afceeeb2cba1
Our nuc-fw is destined to become gsm-fw, so I went ahead and did the big hg mv
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Tue, 12 Nov 2013 05:35:48 +0000 |
parents | nuc-fw/nucleus/debug-chases/tmse.c.dbg@85994b210f6a |
children |
comparison
equal
deleted
inserted
replaced
142:15d5977390c2 | 143:afceeeb2cba1 |
---|---|
1 /*************************************************************************/ | |
2 /* */ | |
3 /* Copyright Mentor Graphics Corporation 2002 */ | |
4 /* All Rights Reserved. */ | |
5 /* */ | |
6 /* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS */ | |
7 /* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS */ | |
8 /* SUBJECT TO LICENSE TERMS. */ | |
9 /* */ | |
10 /*************************************************************************/ | |
11 | |
12 /*************************************************************************/ | |
13 /* */ | |
14 /* FILE NAME VERSION */ | |
15 /* */ | |
16 /* tmse.c Nucleus PLUS 1.14 */ | |
17 /* */ | |
18 /* COMPONENT */ | |
19 /* */ | |
20 /* TM - Timer Management */ | |
21 /* */ | |
22 /* DESCRIPTION */ | |
23 /* */ | |
24 /* This file contains the error checking routines for the functions */ | |
25 /* in the Timer component. This permits easy removal of error */ | |
26 /* checking logic when it is not needed. */ | |
27 /* */ | |
28 /* DATA STRUCTURES */ | |
29 /* */ | |
30 /* None */ | |
31 /* */ | |
32 /* FUNCTIONS */ | |
33 /* */ | |
34 /* TMSE_Create_Timer Create an application timer */ | |
35 /* TMSE_Delete_Timer Delete an application timer */ | |
36 /* TMSE_Reset_Timer Reset application timer */ | |
37 /* TMSE_Control_Timer Enable/Disable application */ | |
38 /* timer */ | |
39 /* */ | |
40 /* DEPENDENCIES */ | |
41 /* */ | |
42 /* cs_extr.h Common Service functions */ | |
43 /* tm_extr.h Timer functions */ | |
44 /* */ | |
45 /* HISTORY */ | |
46 /* */ | |
47 /* DATE REMARKS */ | |
48 /* */ | |
49 /* 03-01-1993 Created initial version 1.0 */ | |
50 /* 04-19-1993 Verified version 1.0 */ | |
51 /* 03-01-1994 Changed names of error checking */ | |
52 /* shell to match new conventions, */ | |
53 /* resulting in version 1.1 */ | |
54 /* */ | |
55 /* 03-18-1994 Verified version 1.1 */ | |
56 /* 04-17-1996 updated to version 1.2 */ | |
57 /* 03-24-1998 Released version 1.3 */ | |
58 /* 04-17-2002 Released version 1.13m */ | |
59 /* 11-07-2002 Released version 1.14 */ | |
60 /*************************************************************************/ | |
61 #define NU_SOURCE_FILE | |
62 | |
63 | |
64 #include "cs_extr.h" /* Common service functions */ | |
65 #include "tm_extr.h" /* Timer functions */ | |
66 | |
67 | |
68 | |
69 /*************************************************************************/ | |
70 /* */ | |
71 /* FUNCTION */ | |
72 /* */ | |
73 /* TMSE_Create_Timer */ | |
74 /* */ | |
75 /* DESCRIPTION */ | |
76 /* */ | |
77 /* This function performs error checking on the parameters supplied */ | |
78 /* to the create timer function. */ | |
79 /* */ | |
80 /* CALLED BY */ | |
81 /* */ | |
82 /* Application */ | |
83 /* */ | |
84 /* CALLS */ | |
85 /* */ | |
86 /* TMS_Create_Timer Actual create timer function */ | |
87 /* */ | |
88 /* INPUTS */ | |
89 /* */ | |
90 /* timer_ptr Timer control block pointer */ | |
91 /* name Timer name */ | |
92 /* expiration_routine Timer expiration routine */ | |
93 /* id Timer expiration ID */ | |
94 /* initial_time Initial expiration time */ | |
95 /* reschedule_time Reschedule expiration time */ | |
96 /* enable Automatic enable option */ | |
97 /* */ | |
98 /* OUTPUTS */ | |
99 /* */ | |
100 /* NU_INVALID_TIMER Indicates timer pointer is */ | |
101 /* NULL */ | |
102 /* NU_INVALID_FUNCTION Indicates timer expiration */ | |
103 /* function pointer is NULL */ | |
104 /* NU_INVALID_ENABLE Indicates enable parameter */ | |
105 /* is invalid */ | |
106 /* */ | |
107 /* HISTORY */ | |
108 /* */ | |
109 /* DATE REMARKS */ | |
110 /* */ | |
111 /* 03-01-1993 Created initial version 1.0 */ | |
112 /* 04-19-1993 Verified version 1.0 */ | |
113 /* 03-01-1994 Changed function interface, */ | |
114 /* resulting in version 1.1 */ | |
115 /* */ | |
116 /* 03-18-1994 Verified version 1.1 */ | |
117 /* */ | |
118 /*************************************************************************/ | |
119 STATUS TMSE_Create_Timer(NU_TIMER *timer_ptr, CHAR *name, | |
120 VOID (*expiration_routine)(UNSIGNED), UNSIGNED id, | |
121 UNSIGNED initial_time, UNSIGNED reschedule_time, OPTION enable) | |
122 { | |
123 | |
124 TM_APP_TCB *timer; /* Timer control block ptr */ | |
125 STATUS status; /* Completion status */ | |
126 | |
127 | |
128 /* Move input timer pointer into internal pointer. */ | |
129 timer = (TM_APP_TCB *) timer_ptr; | |
130 | |
131 /* Check the parameters to the create timer function. */ | |
132 if ((timer == NU_NULL) || (timer -> tm_id == TM_TIMER_ID)) | |
133 | |
134 /* Invalid timer pointer. */ | |
135 status = NU_INVALID_TIMER; | |
136 | |
137 else if (expiration_routine == NU_NULL) | |
138 | |
139 /* Invalid expiration function pointer. */ | |
140 status = NU_INVALID_FUNCTION; | |
141 | |
142 else if (initial_time == 0) | |
143 | |
144 /* Invalid time value. */ | |
145 status = NU_INVALID_OPERATION; | |
146 | |
147 | |
148 else if ((enable != NU_ENABLE_TIMER) && (enable != NU_DISABLE_TIMER)) | |
149 | |
150 /* Invalid enable parameter. */ | |
151 status = NU_INVALID_ENABLE; | |
152 | |
153 else | |
154 | |
155 /* Call the actual create timer function. */ | |
156 status = TMS_Create_Timer(timer_ptr, name, expiration_routine, id, | |
157 initial_time, reschedule_time, enable); | |
158 | |
159 /* Return the completion status. */ | |
160 return(status); | |
161 } | |
162 | |
163 | |
164 /*************************************************************************/ | |
165 /* */ | |
166 /* FUNCTION */ | |
167 /* */ | |
168 /* TMSE_Delete_Timer */ | |
169 /* */ | |
170 /* DESCRIPTION */ | |
171 /* */ | |
172 /* This function performs error checking on the parameters supplied */ | |
173 /* to the delete timer function. */ | |
174 /* */ | |
175 /* CALLED BY */ | |
176 /* */ | |
177 /* Application */ | |
178 /* */ | |
179 /* CALLS */ | |
180 /* */ | |
181 /* TMS_Delete_Timer Actual delete timer function */ | |
182 /* */ | |
183 /* INPUTS */ | |
184 /* */ | |
185 /* timer_ptr Timer control block pointer */ | |
186 /* */ | |
187 /* OUTPUTS */ | |
188 /* */ | |
189 /* NU_INVALID_TIMER Indicates the timer pointer */ | |
190 /* is NULL or not a timer */ | |
191 /* */ | |
192 /* HISTORY */ | |
193 /* */ | |
194 /* DATE REMARKS */ | |
195 /* */ | |
196 /* 03-01-1993 Created initial version 1.0 */ | |
197 /* 04-19-1993 Verified version 1.0 */ | |
198 /* 03-01-1994 Changed function interface, */ | |
199 /* resulting in version 1.1 */ | |
200 /* */ | |
201 /* 03-18-1994 Verified version 1.1 */ | |
202 /* */ | |
203 /*************************************************************************/ | |
204 STATUS TMSE_Delete_Timer(NU_TIMER *timer_ptr) | |
205 { | |
206 | |
207 TM_APP_TCB *timer; /* Timer control block ptr */ | |
208 STATUS status; /* Completion status */ | |
209 | |
210 | |
211 /* Move input timer pointer into internal pointer. */ | |
212 timer = (TM_APP_TCB *) timer_ptr; | |
213 | |
214 /* Check the parameters to the delete timer function. */ | |
215 if (timer == NU_NULL) | |
216 | |
217 /* Invalid timer pointer. */ | |
218 status = NU_INVALID_TIMER; | |
219 | |
220 else if (timer -> tm_id != TM_TIMER_ID) | |
221 | |
222 /* Invalid timer pointer. */ | |
223 status = NU_INVALID_TIMER; | |
224 | |
225 else | |
226 | |
227 /* Call the actual delete timer function. */ | |
228 status = TMS_Delete_Timer(timer_ptr); | |
229 | |
230 /* Return completion status. */ | |
231 return(status); | |
232 } | |
233 | |
234 | |
235 /*************************************************************************/ | |
236 /* */ | |
237 /* FUNCTION */ | |
238 /* */ | |
239 /* TMSE_Reset_Timer */ | |
240 /* */ | |
241 /* DESCRIPTION */ | |
242 /* */ | |
243 /* This function performs error checking on the parameters supplied */ | |
244 /* to the reset timer function. */ | |
245 /* */ | |
246 /* CALLED BY */ | |
247 /* */ | |
248 /* Application */ | |
249 /* */ | |
250 /* CALLS */ | |
251 /* */ | |
252 /* TMS_Reset_Timer Actual reset timer function */ | |
253 /* */ | |
254 /* INPUTS */ | |
255 /* */ | |
256 /* timer_ptr Timer control block pointer */ | |
257 /* expiration_routine Timer expiration routine */ | |
258 /* initial_time Initial expiration time */ | |
259 /* reschedule_time Reschedule expiration time */ | |
260 /* enable Automatic enable option */ | |
261 /* */ | |
262 /* OUTPUTS */ | |
263 /* */ | |
264 /* NU_INVALID_TIMER Indicates timer pointer is */ | |
265 /* invalid */ | |
266 /* NU_INVALID_FUNCTION Indicates that expiration */ | |
267 /* function pointer is NULL */ | |
268 /* NU_INVALID_ENABLE Indicates enable parameter */ | |
269 /* is invalid */ | |
270 /* */ | |
271 /* HISTORY */ | |
272 /* */ | |
273 /* DATE REMARKS */ | |
274 /* */ | |
275 /* 03-01-1993 Created initial version 1.0 */ | |
276 /* 04-19-1993 Verified version 1.0 */ | |
277 /* 03-01-1994 Changed function interface, */ | |
278 /* resulting in version 1.1 */ | |
279 /* */ | |
280 /* 03-18-1994 Verified version 1.1 */ | |
281 /* */ | |
282 /*************************************************************************/ | |
283 STATUS TMSE_Reset_Timer(NU_TIMER *timer_ptr, | |
284 VOID (*expiration_routine)(UNSIGNED), | |
285 UNSIGNED initial_time, UNSIGNED reschedule_time, OPTION enable) | |
286 { | |
287 | |
288 TM_APP_TCB *timer; /* Timer contorl block ptr */ | |
289 STATUS status; /* Completion status */ | |
290 static char dbgstr[512]; | |
291 | |
292 sprintf(dbgstr, "* TMSE_Reset_Timer(): timer_ptr=%08x, expiration_routine=%08x, initial_time=%x, reschedule_time=%x, enable=%x", | |
293 (unsigned)timer_ptr, (unsigned)expiration_routine, | |
294 (unsigned)initial_time, (unsigned)reschedule_time, | |
295 (unsigned)enable); | |
296 freecalypso_raw_dbgout(dbgstr); | |
297 | |
298 /* Move input timer pointer into internal pointer. */ | |
299 timer = (TM_APP_TCB *) timer_ptr; | |
300 | |
301 /* Check the parameters to the reset timer function. */ | |
302 if (timer == NU_NULL) | |
303 | |
304 /* Invalid timer pointer. */ | |
305 status = NU_INVALID_TIMER; | |
306 | |
307 else if (timer -> tm_id != TM_TIMER_ID) { | |
308 | |
309 sprintf(dbgstr, "* TMSE_Reset_Timer: invalid tm_id=%08x", | |
310 (unsigned)timer->tm_id); | |
311 freecalypso_raw_dbgout(dbgstr); | |
312 | |
313 /* Invalid timer pointer. */ | |
314 status = NU_INVALID_TIMER; | |
315 } | |
316 else if (initial_time == 0) | |
317 | |
318 /* Invalid time value. */ | |
319 status = NU_INVALID_OPERATION; | |
320 | |
321 | |
322 else if (expiration_routine == NU_NULL) | |
323 | |
324 /* Invalid expiration function pointer. */ | |
325 status = NU_INVALID_FUNCTION; | |
326 | |
327 else if ((enable != NU_ENABLE_TIMER) && (enable != NU_DISABLE_TIMER)) | |
328 | |
329 /* Invalid enable parameter. */ | |
330 status = NU_INVALID_ENABLE; | |
331 | |
332 else | |
333 | |
334 /* Call the actual reset timer function. */ | |
335 status = TMS_Reset_Timer(timer_ptr, expiration_routine, initial_time, | |
336 reschedule_time, enable); | |
337 | |
338 sprintf(dbgstr, "* TMSE_Reset_Timer result: %d", (int)status); | |
339 freecalypso_raw_dbgout(dbgstr); | |
340 | |
341 /* Return completion status. */ | |
342 return(status); | |
343 } | |
344 | |
345 | |
346 /*************************************************************************/ | |
347 /* */ | |
348 /* FUNCTION */ | |
349 /* */ | |
350 /* TMSE_Control_Timer */ | |
351 /* */ | |
352 /* DESCRIPTION */ | |
353 /* */ | |
354 /* This function performs error checking on the parameters supplied */ | |
355 /* to the control timer function. */ | |
356 /* */ | |
357 /* CALLED BY */ | |
358 /* */ | |
359 /* Application */ | |
360 /* */ | |
361 /* CALLS */ | |
362 /* */ | |
363 /* TMS_Control_Timer Actual control timer function*/ | |
364 /* */ | |
365 /* INPUTS */ | |
366 /* */ | |
367 /* timer_ptr Timer control block pointer */ | |
368 /* enable Disable/enable timer option */ | |
369 /* */ | |
370 /* OUTPUTS */ | |
371 /* */ | |
372 /* NU_INVALID_TIMER Indicates the timer pointer */ | |
373 /* is invalid */ | |
374 /* NU_INVALID_ENABLE Indicates enable parameter */ | |
375 /* is invalid */ | |
376 /* */ | |
377 /* HISTORY */ | |
378 /* */ | |
379 /* DATE REMARKS */ | |
380 /* */ | |
381 /* 03-01-1993 Created initial version 1.0 */ | |
382 /* 04-19-1993 Verified version 1.0 */ | |
383 /* 03-01-1994 Changed function interface, */ | |
384 /* resulting in version 1.1 */ | |
385 /* */ | |
386 /* 03-18-1994 Verified version 1.1 */ | |
387 /* */ | |
388 /*************************************************************************/ | |
389 STATUS TMSE_Control_Timer(NU_TIMER *timer_ptr, OPTION enable) | |
390 { | |
391 | |
392 TM_APP_TCB *timer; /* Timer control block ptr */ | |
393 STATUS status; /* Completion status */ | |
394 | |
395 | |
396 /* Move input timer pointer to internal pointer. */ | |
397 timer = (TM_APP_TCB *) timer_ptr; | |
398 | |
399 /* Check the parameters to the reset timer function. */ | |
400 if (timer == NU_NULL) | |
401 | |
402 /* Invalid timer pointer. */ | |
403 status = NU_INVALID_TIMER; | |
404 | |
405 else if (timer -> tm_id != TM_TIMER_ID) | |
406 | |
407 /* Invalid timer pointer. */ | |
408 status = NU_INVALID_TIMER; | |
409 | |
410 else if ((enable != NU_ENABLE_TIMER) && (enable != NU_DISABLE_TIMER)) | |
411 | |
412 /* Invalid enable parameter. */ | |
413 status = NU_INVALID_ENABLE; | |
414 | |
415 else | |
416 | |
417 /* Call actual control timer function. */ | |
418 status = TMS_Control_Timer(timer_ptr, enable); | |
419 | |
420 /* Return completion status. */ | |
421 return(status); | |
422 } | |
423 | |
424 | |
425 | |
426 | |
427 |