FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/gpf/osl/contrib/os_tim_ir.c @ 1021:8b52011dc66a
doc/Pirelli-Howto: update for the current situation
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 23 Apr 2016 06:19:09 +0000 |
parents | 536c53d3356c |
children |
rev | line source |
---|---|
476
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This C module is a reconstruction based on the disassembly of |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * os_tim.obj in frame_na7_db_ir.lib from the Leonardo package. |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 */ |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 /* set of included headers from COFF symtab: */ |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <stdio.h> |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include "gpfconf.h" /* FreeCalypso addition */ |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include "../../nucleus/nucleus.h" |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include "typedefs.h" |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "os.h" |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "gdi.h" |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "os_types.h" |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 #include "os_glob.h" |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 extern unsigned os_time_to_tick_multiplier; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 extern unsigned os_tick_to_time_multiplier; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 extern T_OS_TIMER_ENTRY TimerTable[]; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 extern T_OS_TIMER_TABLE_ENTRY *p_list[]; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 extern int volatile t_list_access; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 extern unsigned t_start_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 extern T_OS_TIMER_TABLE_ENTRY * volatile t_running; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 extern int used_timers; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 extern int next_t_handle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 extern NU_SEMAPHORE TimSemCB; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 extern NU_TIMER os_timer_cb; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 extern int max_used_timers; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 void os_Timeout(UNSIGNED t_handle); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 void timer_error(int err) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 err = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 static int os_remove_timer_from_list(T_OS_TIMER_TABLE_ENTRY *timer) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 OS_TICK c_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 if (timer != t_running) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 if (timer->next != t_running) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 timer->next->r_ticks += timer->r_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 else { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 c_ticks = NU_Retrieve_Clock(); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 if (timer->next == timer) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 t_running = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 } else { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 timer->next->r_ticks = |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 t_start_ticks + timer->r_ticks + |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 timer->next->r_ticks - c_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 t_running = timer->next; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 NU_Control_Timer(&os_timer_cb, NU_DISABLE_TIMER); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 if (t_running != NULL) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 t_start_ticks = c_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 if (t_running->r_ticks != 0) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 NU_Reset_Timer(&os_timer_cb, os_Timeout, |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 t_running->r_ticks, 0, |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 NU_ENABLE_TIMER); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 if (timer->next != timer) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 timer->prev->next = timer->next; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 timer->next->prev = timer->prev; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 timer->next = NULL; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 timer->prev = NULL; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 timer->status = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 return 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 static unsigned os_add_timer_to_list(T_OS_TIMER_TABLE_ENTRY *timer, OS_TICK ticks) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 T_OS_TIMER_TABLE_ENTRY *t_list; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 OS_TICK c_ticks, r1_ticks, return_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 if (ticks == 0) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 ticks = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 c_ticks = NU_Retrieve_Clock(); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 t_list = t_running; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 if (t_list != NULL) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 if (t_running->r_ticks >= c_ticks - t_start_ticks) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 r1_ticks = |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 t_running->r_ticks - c_ticks + t_start_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 t_running->r_ticks = r1_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 } else { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 r1_ticks = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 t_running->r_ticks = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 t_start_ticks = c_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 return_ticks = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 while (ticks >= r1_ticks) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 ticks -= r1_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 t_list = t_list->next; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 if (t_list == t_running) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 goto out; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 r1_ticks = t_list->r_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 t_list->r_ticks -= ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 if (t_list == t_running) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 t_running = timer; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 t_start_ticks = c_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 NU_Control_Timer(&os_timer_cb, NU_DISABLE_TIMER); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 return_ticks = ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 out: |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 timer->next = t_list; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 timer->prev = t_list->prev; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 t_list->prev->next = timer; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 t_list->prev = timer; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 timer->r_ticks = ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 } else { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 timer->next = timer; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 timer->prev = timer; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 timer->r_ticks = ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 t_start_ticks = c_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 t_running = timer; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 return_ticks = ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 timer->status = 2; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 return return_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 GLOBAL LONG os_StartTimer(OS_HANDLE TaskHandle, OS_HANDLE TimerHandle, |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 USHORT Index, OS_TIME InitialTime, |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 OS_TIME RescheduleTime) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 T_OS_TIMER_TABLE_ENTRY *timer; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 OS_TICK ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 USHORT status; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 STATUS sts; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 t_list_access = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 timer = &TimerTable[TimerHandle].entry; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 if (TimerHandle > MaxSimultaneousTimer || timer->status == 0) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 t_list_access = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 return OS_ERROR; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 sts = NU_Obtain_Semaphore(&TimSemCB, NU_SUSPEND); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 /* FIXME: not sure about this |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 if (sts != NU_SUCCESS) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 os_MyHandle(sts); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 */ |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 status = timer->status; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 if (status == 2) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 status = os_remove_timer_from_list(timer); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 timer->t_handle = TimerHandle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 timer->task_handle = os_MyHandle(); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 timer->entity_handle = TaskHandle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 timer->t_index = Index; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 timer->p_ticks = TIME_TO_SYSTEM_TICKS(RescheduleTime); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 ticks = os_add_timer_to_list(timer, TIME_TO_SYSTEM_TICKS(InitialTime)); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 if (ticks) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 NU_Reset_Timer(&os_timer_cb, os_Timeout, ticks, 0, NU_ENABLE_TIMER); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 if (sts == NU_SUCCESS) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 NU_Release_Semaphore(&TimSemCB); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 t_list_access = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 return OS_OK; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
166 /* FIXME: t_handle is unused?! */ |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 void os_Timeout(UNSIGNED t_handle) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 UNSIGNED s_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
170 OS_HANDLE task_handle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
171 OS_HANDLE e_handle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
172 int t_index, i, done; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
173 T_OS_TIMER_TABLE_ENTRY **t_r4; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 T_OS_TIMER_TABLE_ENTRY *timer; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 void (*timeout_func) (OS_HANDLE, OS_HANDLE, USHORT); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 OS_TIME InitialTime; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
178 if (t_list_access) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
179 t_start_ticks++; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
180 NU_Reset_Timer(&os_timer_cb, os_Timeout, 1, 0, |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
181 NU_ENABLE_TIMER); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
182 return; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
183 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
184 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
185 t_list_access = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 timer = t_running; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
187 if (t_running) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
188 s_ticks = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
189 done = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
190 i = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
191 do { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
192 timeout_func = timer->TimeoutProc; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
193 if (timer->p_ticks) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
194 p_list[i++] = timer; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
195 task_handle = timer->task_handle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
196 e_handle = timer->entity_handle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 t_index = timer->t_index; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 timer->status = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
199 if (timer->next == timer) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
200 t_running = NULL; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 done = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
202 } else { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
203 timer->prev->next = timer->next; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 timer->next->prev = timer->prev; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 if (timer->next->r_ticks) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 t_running = timer->next; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 s_ticks = timer->r_ticks; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
208 done = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 } else |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 timer = timer->next; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
211 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
212 /* FIXME: IND$CALL() ? */ |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
213 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
214 while (!done); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
215 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
216 if (s_ticks) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
217 t_start_ticks = NU_Retrieve_Clock(); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
218 NU_Reset_Timer(&os_timer_cb, os_Timeout, s_ticks, 0, |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 NU_ENABLE_TIMER); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 for (t_r4 = p_list; *t_r4; t_r4++) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 timer = *t_r4; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 InitialTime = SYSTEM_TICKS_TO_TIME(timer->p_ticks); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 os_StartTimer(timer->entity_handle, timer->t_handle, |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 timer->t_index, InitialTime, InitialTime); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
227 *t_r4 = NULL; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
228 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
229 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
230 t_list_access = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
231 return; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
232 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
233 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
234 /* FIXME: TaskHandle is unused?! */ |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 GLOBAL LONG os_StopTimer(OS_HANDLE TaskHandle, OS_HANDLE TimerHandle) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
236 { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
237 T_OS_TIMER_ENTRY *timer_e; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
238 STATUS sts; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 t_list_access = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
241 timer_e = &TimerTable[TimerHandle]; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
242 if (TimerHandle > MaxSimultaneousTimer || timer_e->entry.status == 0) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
243 t_list_access = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
244 return OS_ERROR; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
245 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
246 sts = NU_Obtain_Semaphore(&TimSemCB, NU_SUSPEND); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
247 if (timer_e->entry.status == 2) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 os_remove_timer_from_list(&timer_e->entry); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
249 if (sts == NU_SUCCESS) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
250 NU_Release_Semaphore(&TimSemCB); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 t_list_access = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
252 return OS_OK; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 GLOBAL LONG os_IncrementTick(OS_TICK ticks) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
256 { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
257 return OS_OK; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
258 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
259 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
260 /* FIXME: TaskHandle is unused?! */ |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
261 GLOBAL LONG os_DestroyTimer(OS_HANDLE TaskHandle, OS_HANDLE TimerHandle) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
262 { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
263 STATUS sts; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
264 T_OS_TIMER_ENTRY *timer_e; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
265 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
266 t_list_access = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
267 sts = NU_Obtain_Semaphore(&TimSemCB, NU_SUSPEND); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
268 timer_e = &TimerTable[TimerHandle]; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
269 if (TimerHandle > MaxSimultaneousTimer || timer_e->entry.status == 0) { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
270 if (sts == NU_SUCCESS) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
271 NU_Release_Semaphore(&TimSemCB); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
272 t_list_access = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
273 return OS_ERROR; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
274 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
275 timer_e->next_t_handle = next_t_handle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
276 timer_e->entry.status = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
277 used_timers--; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
278 t_list_access = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
279 if (sts == NU_SUCCESS) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
280 NU_Release_Semaphore(&TimSemCB); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
281 return OS_OK; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
282 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
283 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
284 /* FIXME: TaskHandle and MemPoolHandle are unused?! */ |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
285 GLOBAL LONG os_CreateTimer(OS_HANDLE TaskHandle, |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
286 void (*TimeoutProc) (OS_HANDLE, OS_HANDLE, USHORT), |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
287 OS_HANDLE *TimerHandle, OS_HANDLE MemPoolHandle) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
288 { |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
289 STATUS sts; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
290 OS_HANDLE orig_next_t_handle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
291 T_OS_TIMER_ENTRY *timer_e; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
292 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
293 t_list_access = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
294 sts = NU_Obtain_Semaphore(&TimSemCB, NU_SUSPEND); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
295 orig_next_t_handle = next_t_handle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
296 if (next_t_handle == 0) { /* INVALID_HANDLE */ |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
297 if (sts == NU_SUCCESS) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
298 NU_Release_Semaphore(&TimSemCB); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
299 t_list_access = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
300 return OS_ERROR; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
301 } |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
302 |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
303 timer_e = &TimerTable[next_t_handle]; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
304 timer_e->entry.status = 1; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
305 timer_e->entry.TimeoutProc = TimeoutProc; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
306 *TimerHandle = orig_next_t_handle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
307 next_t_handle = timer_e->next_t_handle; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
308 used_timers++; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
309 if (max_used_timers < used_timers) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
310 max_used_timers = used_timers; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
311 if (sts == NU_SUCCESS) |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
312 NU_Release_Semaphore(&TimSemCB); |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
313 t_list_access = 0; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
314 return OS_OK; |
536c53d3356c
gsm-fw/gpf/osl/contrib/os_tim_ir.c: version contributed by Das Signal
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
315 } |