FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/nucleus/tms.c @ 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/tms.c@947b1f473960 |
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 /* tms.c Nucleus PLUS 1.14 */ | |
17 /* */ | |
18 /* COMPONENT */ | |
19 /* */ | |
20 /* TM - Timer Management */ | |
21 /* */ | |
22 /* DESCRIPTION */ | |
23 /* */ | |
24 /* This file contains supplemental routines for the timer */ | |
25 /* management component. */ | |
26 /* */ | |
27 /* DATA STRUCTURES */ | |
28 /* */ | |
29 /* None */ | |
30 /* */ | |
31 /* FUNCTIONS */ | |
32 /* */ | |
33 /* TMS_Create_Timer Create an application timer */ | |
34 /* TMS_Delete_Timer Delete an application timer */ | |
35 /* TMS_Reset_Timer Reset application timer */ | |
36 /* TMS_Control_Timer Enable/Disable application */ | |
37 /* timer */ | |
38 /* */ | |
39 /* DEPENDENCIES */ | |
40 /* */ | |
41 /* cs_extr.h Common Service functions */ | |
42 /* tc_extr.h Thread Control functions */ | |
43 /* tm_extr.h Timer functions */ | |
44 /* hi_extr.h History functions */ | |
45 /* */ | |
46 /* HISTORY */ | |
47 /* */ | |
48 /* DATE REMARKS */ | |
49 /* */ | |
50 /* 03-01-1994 Created initial version 1.1 from */ | |
51 /* previous version of TMC.C */ | |
52 /* */ | |
53 /* 03-18-1994 Verified version 1.1 */ | |
54 /* 04-17-1996 updated to version 1.2 */ | |
55 /* 03-24-1998 Released version 1.3. */ | |
56 /* 03-26-1999 Released 1.11m (new release */ | |
57 /* numbering scheme) */ | |
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 "tc_extr.h" /* Thread control functions */ | |
66 #include "tm_extr.h" /* Timer functions */ | |
67 #include "hi_extr.h" /* History functions */ | |
68 #include "profiler.h" /* ProView interface */ | |
69 | |
70 | |
71 /* Define external inner-component global data references. */ | |
72 | |
73 extern CS_NODE *TMD_Created_Timers_List; | |
74 extern UNSIGNED TMD_Total_Timers; | |
75 extern TM_TCB *TMD_Active_Timers_List; | |
76 extern INT TMD_Active_List_Busy; | |
77 extern TC_PROTECT TMD_Created_List_Protect; | |
78 | |
79 | |
80 /* Define internal function prototypes. */ | |
81 | |
82 VOID TMC_Start_Timer(TM_TCB *timer, UNSIGNED time); | |
83 VOID TMC_Stop_Timer(TM_TCB *timer); | |
84 | |
85 | |
86 | |
87 /*************************************************************************/ | |
88 /* */ | |
89 /* FUNCTION */ | |
90 /* */ | |
91 /* TMS_Create_Timer */ | |
92 /* */ | |
93 /* DESCRIPTION */ | |
94 /* */ | |
95 /* This function creates an application timer and places it on the */ | |
96 /* list of created timers. The timer is activated if designated by */ | |
97 /* the enable parameter. */ | |
98 /* */ | |
99 /* CALLED BY */ | |
100 /* */ | |
101 /* Application */ | |
102 /* TMSE_Create_Timer Error checking shell */ | |
103 /* */ | |
104 /* CALLS */ | |
105 /* */ | |
106 /* CSC_Place_On_List Add node to linked-list */ | |
107 /* [HIC_Make_History_Entry] Make entry in history log */ | |
108 /* [TCT_Check_Stack] Stack checking function */ | |
109 /* TCT_Protect Data structure protect */ | |
110 /* TCT_Unprotect Un-protect data structure */ | |
111 /* TMS_Control_Timer Enable the new timer */ | |
112 /* */ | |
113 /* INPUTS */ | |
114 /* */ | |
115 /* timer_ptr Timer control block pointer */ | |
116 /* name Timer name */ | |
117 /* expiration_routine Timer expiration routine */ | |
118 /* id Timer expiration ID */ | |
119 /* initial_time Initial expiration time */ | |
120 /* reschedule_time Reschedule expiration time */ | |
121 /* enable Automatic enable option */ | |
122 /* */ | |
123 /* OUTPUTS */ | |
124 /* */ | |
125 /* NU_SUCCESS */ | |
126 /* */ | |
127 /* HISTORY */ | |
128 /* */ | |
129 /* DATE REMARKS */ | |
130 /* */ | |
131 /* 03-01-1993 Created initial version 1.0 */ | |
132 /* 04-19-1993 Verified version 1.0 */ | |
133 /* 03-01-1994 Changed function prototype, */ | |
134 /* resulting in version 1.1 */ | |
135 /* */ | |
136 /* 03-18-1994 Verified version 1.1 */ | |
137 /* */ | |
138 /*************************************************************************/ | |
139 STATUS TMS_Create_Timer(NU_TIMER *timer_ptr, CHAR *name, | |
140 VOID (*expiration_routine)(UNSIGNED), UNSIGNED id, | |
141 UNSIGNED initial_time, UNSIGNED reschedule_time, OPTION enable) | |
142 { | |
143 | |
144 R1 TM_APP_TCB *timer; /* Timer control block ptr */ | |
145 INT i; /* Working index variable */ | |
146 NU_SUPERV_USER_VARIABLES | |
147 | |
148 /* Switch to supervisor mode */ | |
149 NU_SUPERVISOR_MODE(); | |
150 | |
151 /* Move input timer pointer into internal pointer. */ | |
152 timer = (TM_APP_TCB *) timer_ptr; | |
153 | |
154 | |
155 #ifdef NU_ENABLE_STACK_CHECK | |
156 | |
157 /* Call stack checking function to check for an overflow condition. */ | |
158 TCT_Check_Stack(); | |
159 | |
160 #endif | |
161 | |
162 #ifdef NU_ENABLE_HISTORY | |
163 | |
164 /* Make an entry that corresponds to this function in the system history | |
165 log. */ | |
166 HIC_Make_History_Entry(NU_CREATE_TIMER_ID, (UNSIGNED) timer, | |
167 (UNSIGNED) name, (UNSIGNED) expiration_routine); | |
168 | |
169 #endif | |
170 | |
171 /* First, clear the timer ID just in case it is an old Timer | |
172 Control Block. */ | |
173 timer -> tm_id = 0; | |
174 | |
175 /* Fill in the timer name. */ | |
176 for (i = 0; i < NU_MAX_NAME; i++) | |
177 timer -> tm_name[i] = name[i]; | |
178 | |
179 /* Load the timer with the appropriate values. */ | |
180 timer -> tm_expiration_routine = expiration_routine; | |
181 timer -> tm_expiration_id = id; | |
182 timer -> tm_expirations = 0; | |
183 timer -> tm_initial_time = initial_time; | |
184 timer -> tm_reschedule_time = reschedule_time; | |
185 timer -> tm_actual_timer.tm_timer_type = TM_APPL_TIMER; | |
186 timer -> tm_enabled = NU_FALSE; | |
187 | |
188 /* Initialize link pointers. */ | |
189 timer -> tm_created.cs_previous = NU_NULL; | |
190 timer -> tm_created.cs_next = NU_NULL; | |
191 timer -> tm_actual_timer.tm_next_timer = NU_NULL; | |
192 timer -> tm_actual_timer.tm_previous_timer= NU_NULL; | |
193 timer -> tm_actual_timer.tm_information = (VOID *) timer; | |
194 | |
195 /* Protect against access to the list of created timers. */ | |
196 TCT_Protect(&TMD_Created_List_Protect); | |
197 | |
198 /* At this point the timer is completely built. The ID can now be | |
199 set and it can be linked into the created timer list. */ | |
200 timer -> tm_id = TM_TIMER_ID; | |
201 | |
202 /* Link the timer into the list of created timers and increment the | |
203 total number of timers in the system. */ | |
204 CSC_Place_On_List(&TMD_Created_Timers_List, &(timer -> tm_created)); | |
205 TMD_Total_Timers++; | |
206 | |
207 #ifdef INCLUDE_PROVIEW | |
208 _RTProf_DumpTimer(RT_PROF_CREATE_TIMER,timer,RT_PROF_OK); | |
209 #endif | |
210 | |
211 /* Release protection against access to the list of created timers. */ | |
212 TCT_Unprotect(); | |
213 | |
214 /* Determine if the timer should be enabled. */ | |
215 if (enable == NU_ENABLE_TIMER) | |
216 | |
217 /* Activate the timer. */ | |
218 TMS_Control_Timer(timer_ptr, NU_ENABLE_TIMER); | |
219 | |
220 /* Return to user mode */ | |
221 NU_USER_MODE(); | |
222 | |
223 /* Return successful completion. */ | |
224 return(NU_SUCCESS); | |
225 } | |
226 | |
227 | |
228 /*************************************************************************/ | |
229 /* */ | |
230 /* FUNCTION */ | |
231 /* */ | |
232 /* TMS_Delete_Timer */ | |
233 /* */ | |
234 /* DESCRIPTION */ | |
235 /* */ | |
236 /* This function deletes an application timer and removes it from */ | |
237 /* the list of created timers. */ | |
238 /* */ | |
239 /* CALLED BY */ | |
240 /* */ | |
241 /* Application */ | |
242 /* TMSE_Delete_Timer Error checking shell */ | |
243 /* */ | |
244 /* CALLS */ | |
245 /* */ | |
246 /* CSC_Remove_From_List Remove node from list */ | |
247 /* [HIC_Make_History_Entry] Make entry in history log */ | |
248 /* [TCT_Check_Stack] Stack checking function */ | |
249 /* TCT_Protect Protect created list */ | |
250 /* TCT_System_Protect Protect active list */ | |
251 /* TCT_Unprotect Release protection */ | |
252 /* */ | |
253 /* INPUTS */ | |
254 /* */ | |
255 /* timer_ptr Timer control block pointer */ | |
256 /* */ | |
257 /* OUTPUTS */ | |
258 /* */ | |
259 /* NU_NOT_DISABLED Timer not disabled first */ | |
260 /* NU_SUCCESS */ | |
261 /* */ | |
262 /* HISTORY */ | |
263 /* */ | |
264 /* DATE REMARKS */ | |
265 /* */ | |
266 /* 03-01-1993 Created initial version 1.0 */ | |
267 /* 04-19-1993 Verified version 1.0 */ | |
268 /* 03-01-1994 Modified protection logic to use */ | |
269 /* system protection, changed */ | |
270 /* function prototype, resulting */ | |
271 /* in version 1.1 */ | |
272 /* */ | |
273 /* 03-18-1994 Verified version 1.1 */ | |
274 /* */ | |
275 /*************************************************************************/ | |
276 STATUS TMS_Delete_Timer(NU_TIMER *timer_ptr) | |
277 { | |
278 | |
279 TM_APP_TCB *timer; /* Timer control block ptr */ | |
280 STATUS status; /* Completion status */ | |
281 NU_SUPERV_USER_VARIABLES | |
282 | |
283 /* Switch to supervisor mode */ | |
284 NU_SUPERVISOR_MODE(); | |
285 | |
286 /* Move input timer pointer into internal pointer. */ | |
287 timer = (TM_APP_TCB *) timer_ptr; | |
288 | |
289 | |
290 #ifdef NU_ENABLE_STACK_CHECK | |
291 | |
292 /* Call stack checking function to check for an overflow condition. */ | |
293 TCT_Check_Stack(); | |
294 | |
295 #endif | |
296 | |
297 #ifdef NU_ENABLE_HISTORY | |
298 | |
299 /* Make an entry that corresponds to this function in the system history | |
300 log. */ | |
301 HIC_Make_History_Entry(NU_DELETE_TIMER_ID, (UNSIGNED) timer, | |
302 (UNSIGNED) 0, (UNSIGNED) 0); | |
303 | |
304 #endif | |
305 | |
306 /* Initialize the status. */ | |
307 status = NU_SUCCESS; | |
308 | |
309 /* Use system protect to protect the active timer list temporarily. */ | |
310 TCT_System_Protect(); | |
311 | |
312 /* Determine if the timer is currently disabled. */ | |
313 if (timer -> tm_enabled) | |
314 { | |
315 /* Error, indicate to the caller that the timer is currently active. */ | |
316 status = NU_NOT_DISABLED; | |
317 | |
318 #ifdef INCLUDE_PROVIEW | |
319 _RTProf_DumpTimer(RT_PROF_DELETE_TIMER,timer,RT_PROF_FAIL); | |
320 #endif | |
321 | |
322 } | |
323 else | |
324 { | |
325 /* Clear the timer ID. */ | |
326 timer -> tm_id = 0; | |
327 | |
328 #ifdef INCLUDE_PROVIEW | |
329 _RTProf_DumpTimer(RT_PROF_DELETE_TIMER,timer,RT_PROF_OK); | |
330 #endif /* INCLUDE_PROVIEW */ | |
331 | |
332 } | |
333 | |
334 /* Release protection. */ | |
335 TCT_Unprotect(); | |
336 | |
337 /* Determine if an error was detected. */ | |
338 if (status == NU_SUCCESS) | |
339 { | |
340 | |
341 /* Protect against access to the list of created timers. */ | |
342 TCT_Protect(&TMD_Created_List_Protect); | |
343 | |
344 /* Remove the timer from the list of created timers. */ | |
345 CSC_Remove_From_List(&TMD_Created_Timers_List, &(timer -> tm_created)); | |
346 | |
347 /* Decrement the total number of created timers. */ | |
348 TMD_Total_Timers--; | |
349 | |
350 /* Release protection against access to the list of created timers. */ | |
351 TCT_Unprotect(); | |
352 } | |
353 | |
354 /* Return to user mode */ | |
355 NU_USER_MODE(); | |
356 | |
357 /* Return completion status. */ | |
358 return(status); | |
359 } | |
360 | |
361 | |
362 /*************************************************************************/ | |
363 /* */ | |
364 /* FUNCTION */ | |
365 /* */ | |
366 /* TMS_Reset_Timer */ | |
367 /* */ | |
368 /* DESCRIPTION */ | |
369 /* */ | |
370 /* This function resets the specified application timer. Note that */ | |
371 /* the timer must be in a disabled state prior to this call. The */ | |
372 /* timer is activated after it is reset if the enable parameter */ | |
373 /* specifies automatic activation. */ | |
374 /* */ | |
375 /* CALLED BY */ | |
376 /* */ | |
377 /* Application */ | |
378 /* TMSE_Reset_Timer Error checking shell */ | |
379 /* */ | |
380 /* CALLS */ | |
381 /* */ | |
382 /* [HIC_Make_History_Entry] Make entry in history log */ | |
383 /* [TCT_Check_Stack] Stack checking function */ | |
384 /* TCT_System_Protect Protect active list */ | |
385 /* TCT_Unprotect Release protection */ | |
386 /* TMS_Control_Timer Enable/disable timer */ | |
387 /* */ | |
388 /* INPUTS */ | |
389 /* */ | |
390 /* timer_ptr Timer control block pointer */ | |
391 /* expiration_routine Timer expiration routine */ | |
392 /* initial_time Initial expiration time */ | |
393 /* reschedule_time Reschedule expiration time */ | |
394 /* enable Automatic enable option */ | |
395 /* */ | |
396 /* OUTPUTS */ | |
397 /* */ | |
398 /* NU_NOT_DISABLED Timer not disabled first */ | |
399 /* NU_SUCCESS Successful completion */ | |
400 /* */ | |
401 /* HISTORY */ | |
402 /* */ | |
403 /* DATE REMARKS */ | |
404 /* */ | |
405 /* 03-01-1993 Created initial version 1.0 */ | |
406 /* 04-19-1993 Verified version 1.0 */ | |
407 /* 03-01-1994 Modified protection logic to use */ | |
408 /* system protection, changed */ | |
409 /* function prototype, resulting */ | |
410 /* in version 1.1 */ | |
411 /* */ | |
412 /* 03-18-1994 Verified version 1.1 */ | |
413 /* */ | |
414 /*************************************************************************/ | |
415 STATUS TMS_Reset_Timer(NU_TIMER *timer_ptr, | |
416 VOID (*expiration_routine)(UNSIGNED), | |
417 UNSIGNED initial_time, UNSIGNED reschedule_time, OPTION enable) | |
418 { | |
419 | |
420 R1 TM_APP_TCB *timer; /* Timer control block ptr */ | |
421 STATUS status; /* Completion status */ | |
422 NU_SUPERV_USER_VARIABLES | |
423 | |
424 /* Switch to supervisor mode */ | |
425 NU_SUPERVISOR_MODE(); | |
426 | |
427 /* Move input timer pointer into internal pointer. */ | |
428 timer = (TM_APP_TCB *) timer_ptr; | |
429 | |
430 | |
431 #ifdef NU_ENABLE_STACK_CHECK | |
432 | |
433 /* Call stack checking function to check for an overflow condition. */ | |
434 TCT_Check_Stack(); | |
435 | |
436 #endif | |
437 | |
438 #ifdef NU_ENABLE_HISTORY | |
439 | |
440 /* Make an entry that corresponds to this function in the system history | |
441 log. */ | |
442 HIC_Make_History_Entry(NU_RESET_TIMER_ID, (UNSIGNED) timer, | |
443 (UNSIGNED) expiration_routine, (UNSIGNED) initial_time); | |
444 | |
445 #endif | |
446 | |
447 /* Protect against access to the active timer list. */ | |
448 TCT_System_Protect(); | |
449 | |
450 /* Determine if this timer is active. An active timer cannot be | |
451 reset. */ | |
452 if (timer -> tm_enabled) | |
453 { | |
454 | |
455 /* Indicate that the timer is active by returning the proper status. */ | |
456 status = NU_NOT_DISABLED; | |
457 | |
458 #ifdef INCLUDE_PROVIEW | |
459 _RTProf_DumpTimer(RT_PROF_RESET_TIMER,timer,RT_PROF_FAIL); | |
460 #endif /* INCLUDE_PROVIEW */ | |
461 | |
462 } | |
463 else | |
464 { | |
465 | |
466 /* Load the timer with the appropriate values. */ | |
467 timer -> tm_expiration_routine = expiration_routine; | |
468 timer -> tm_expirations = 0; | |
469 timer -> tm_initial_time = initial_time; | |
470 timer -> tm_reschedule_time = reschedule_time; | |
471 | |
472 /* Indicate successful completion status. */ | |
473 status = NU_SUCCESS; | |
474 #ifdef INCLUDE_PROVIEW | |
475 _RTProf_DumpTimer(RT_PROF_RESET_TIMER,timer,RT_PROF_OK); | |
476 #endif /* INCLUDE_PROVIEW */ | |
477 | |
478 } | |
479 | |
480 /* Release protection. */ | |
481 TCT_Unprotect(); | |
482 | |
483 /* Determine if the timer needs to be enabled. */ | |
484 if ((status == NU_SUCCESS) && (enable == NU_ENABLE_TIMER)) | |
485 | |
486 /* Activate the timer. */ | |
487 TMS_Control_Timer(timer_ptr, NU_ENABLE_TIMER); | |
488 | |
489 /* Return to user mode */ | |
490 NU_USER_MODE(); | |
491 | |
492 /* Return completion status. */ | |
493 return(status); | |
494 } | |
495 | |
496 | |
497 /*************************************************************************/ | |
498 /* */ | |
499 /* FUNCTION */ | |
500 /* */ | |
501 /* TMS_Control_Timer */ | |
502 /* */ | |
503 /* DESCRIPTION */ | |
504 /* */ | |
505 /* This function either enables or disables the specified timer. */ | |
506 /* If the timer is already in the desired state, simply leave it */ | |
507 /* alone. */ | |
508 /* */ | |
509 /* CALLED BY */ | |
510 /* */ | |
511 /* Application */ | |
512 /* TMSE_Control_Timer Error checking shell */ | |
513 /* */ | |
514 /* CALLS */ | |
515 /* */ | |
516 /* [HIC_Make_History_Entry] Make entry in history log */ | |
517 /* [TCT_Check_Stack] Stack checking function */ | |
518 /* TCT_System_Protect Protect the active list */ | |
519 /* TCT_Unprotect Release protection */ | |
520 /* TMC_Start_Timer Start a timer */ | |
521 /* TMC_Stop_Timer Stop a timer */ | |
522 /* */ | |
523 /* INPUTS */ | |
524 /* */ | |
525 /* app_timer Timer control block pointer */ | |
526 /* enable Disable/enable timer option */ | |
527 /* */ | |
528 /* OUTPUTS */ | |
529 /* */ | |
530 /* NU_SUCCESS If service is successful */ | |
531 /* */ | |
532 /* HISTORY */ | |
533 /* */ | |
534 /* DATE REMARKS */ | |
535 /* */ | |
536 /* 03-01-1993 Created initial version 1.0 */ | |
537 /* 04-19-1993 Verified version 1.0 */ | |
538 /* 03-01-1994 Modified protection logic to use */ | |
539 /* system protection, changed */ | |
540 /* function prototype, resulting */ | |
541 /* in version 1.1 */ | |
542 /* */ | |
543 /* 03-18-1994 Verified version 1.1 */ | |
544 /* */ | |
545 /*************************************************************************/ | |
546 STATUS TMS_Control_Timer(NU_TIMER *app_timer, OPTION enable) | |
547 { | |
548 | |
549 R1 TM_APP_TCB *timer; /* Timer control block ptr */ | |
550 TM_TCB *timer_ptr; /* Actual timer pointer */ | |
551 UNSIGNED time; /* Variable to hold request */ | |
552 NU_SUPERV_USER_VARIABLES | |
553 | |
554 /* Switch to supervisor mode */ | |
555 NU_SUPERVISOR_MODE(); | |
556 | |
557 /* Move input timer pointer into internal pointer. */ | |
558 timer = (TM_APP_TCB *) app_timer; | |
559 | |
560 | |
561 #ifdef NU_ENABLE_STACK_CHECK | |
562 | |
563 /* Call stack checking function to check for an overflow condition. */ | |
564 TCT_Check_Stack(); | |
565 | |
566 #endif | |
567 | |
568 #ifdef NU_ENABLE_HISTORY | |
569 | |
570 /* Make an entry that corresponds to this function in the system history | |
571 log. */ | |
572 HIC_Make_History_Entry(NU_CONTROL_TIMER_ID, (UNSIGNED) timer, | |
573 (UNSIGNED) enable, (UNSIGNED) 0); | |
574 | |
575 #endif | |
576 | |
577 /* Protect against simultaneous access to the active timer list. */ | |
578 TCT_System_Protect(); | |
579 | |
580 /* Setup pointer to actual timer part of the control block. */ | |
581 timer_ptr = &(timer -> tm_actual_timer); | |
582 | |
583 /* Determine what type of request is present. */ | |
584 if ((enable == NU_ENABLE_TIMER) && (!timer -> tm_enabled)) | |
585 { | |
586 | |
587 /* Enable timer request is present and timer is currently disabled. */ | |
588 | |
589 /* Determine how to setup the remaining field in the actual timer. */ | |
590 if (timer -> tm_expirations) | |
591 | |
592 /* Use reschedule time since this timer has expired previously. */ | |
593 time = timer -> tm_reschedule_time; | |
594 else | |
595 | |
596 /* Use initial time since this timer has never expired. */ | |
597 time = timer -> tm_initial_time; | |
598 | |
599 /* Mark the application timer as enabled. */ | |
600 timer -> tm_enabled = NU_TRUE; | |
601 | |
602 /* Call the start timer routine to actually start the timer. */ | |
603 TMC_Start_Timer(&(timer -> tm_actual_timer), time); | |
604 } | |
605 else if ((enable == NU_DISABLE_TIMER) && (timer -> tm_enabled)) | |
606 { | |
607 | |
608 /* Disable timer request is present and timer is currently enabled. */ | |
609 TMC_Stop_Timer(timer_ptr); | |
610 | |
611 /* Mark the timer as disabled. */ | |
612 timer -> tm_enabled = NU_FALSE; | |
613 } | |
614 | |
615 #ifdef INCLUDE_PROVIEW | |
616 _RTProf_DumpTimer(RT_PROF_CONTROL_TIMER,timer,RT_PROF_OK); | |
617 #endif /* INCLUDE_PROVIEW */ | |
618 /* Release protection. */ | |
619 TCT_Unprotect(); | |
620 | |
621 /* Return to user mode */ | |
622 NU_USER_MODE(); | |
623 | |
624 /* Return the completion status. */ | |
625 return(NU_SUCCESS); | |
626 } | |
627 | |
628 | |
629 | |
630 |