comparison g23m/condat/ms/src/mfw/mfw_acie.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*
2 +--------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_acie.c $|
4 | $Author:: Es $Revision:: 1 $|
5 | CREATED: 26.10.98 $Modtime:: 2.03.00 15:25 $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9 MODULE : MFW_ACIE
10
11 PURPOSE : This modul contains ACI external functions.
12
13
14 $History:: mfw_acie.c $
15 *
16 * ***************** Version 8 *****************
17 * User: Es Date: 2.03.00 Time: 16:04
18 * Updated in $/GSM/Condat/MS/SRC/MFW
19 * some cleanups
20 *
21 * ***************** Version 7 *****************
22 * User: Vo Date: 12.02.99 Time: 18:59
23 * Updated in $/GSM/DEV/MS/SRC/MFW
24 *
25 * ***************** Version 6 *****************
26 * User: Es Date: 8.12.98 Time: 16:53
27 * Updated in $/GSM/DEV/MS/SRC/MFW
28 *
29 * ***************** Version 5 *****************
30 * User: Vo Date: 24.11.98 Time: 21:40
31 * Updated in $/GSM/DEV/MS/SRC/MFW
32 * first successful compilation of MFW
33 |
34 | ***************** Version 4 *****************
35 | User: Le Date: 11.11.98 Time: 13:35
36 | Updated in $/GSM/DEV/MS/SRC/MFW
37 |
38 | ***************** Version 3 *****************
39 | User: Le Date: 10.11.98 Time: 16:07
40 | Updated in $/GSM/DEV/MS/SRC/MFW
41 |
42 | ***************** Version 2 *****************
43 | User: Le Date: 10.11.98 Time: 11:08
44 | Updated in $/GSM/DEV/MS/SRC/MFW
45 |
46 | ***************** Version 1 *****************
47 | User: Le Date: 27.10.98 Time: 15:58
48 | Created in $/GSM/DEV/MS/SRC/MFW
49 | first implementation
50
51 */
52 #define ENTITY_MFW
53
54 #if defined (NEW_FRAME)
55
56 #include "typedefs.h"
57 #include "vsi.h"
58 #include "custom.h"
59 #include "gsm.h"
60
61 #else
62
63 #include "STDDEFS.H"
64 #include "custom.h"
65 #include "gsm.h"
66 #include "vsi.h"
67
68 #endif
69 #ifdef BT_INTERFACE
70 #include "Bti.h"
71 #include "mfw_mfw.h"
72 #include "mfw_bt.h"
73 #endif
74 #include "mfw_acie.h"
75 #include <string.h>
76
77 T_MFW_ACI_EXT aci_ext_handler [MAX_ACI_HANDLER];
78 #ifdef BT_INTERFACE
79 int pSlotBt = 0;
80 #endif
81 /*
82 +--------------------------------------------------------------------+
83 | PROJECT: GSM-MFW (8417) MODULE: MFW_ACIE |
84 | STATE : code ROUTINE: aci_ext_init |
85 +--------------------------------------------------------------------+
86
87 PURPOSE :
88
89 */
90
91 void aci_ext_init()
92 {
93 UBYTE i;
94
95 TRACE_FUNCTION ("aci_ext_init()");
96
97 for (i=0;i<MAX_ACI_HANDLER;i++)
98 {
99 aci_ext_handler[i].prim_handler = NULL;
100 aci_ext_handler[i].cmd_handler = NULL;
101 }
102 }
103
104 /*
105 +--------------------------------------------------------------------+
106 | PROJECT: GSM-MFW (8417) MODULE: MFW_ACIE |
107 | STATE : code ROUTINE: aci_create |
108 +--------------------------------------------------------------------+
109
110 PURPOSE :
111
112 */
113
114 GLOBAL int aci_create(T_PRIM_HANDLER prim_func, T_CMD_HANDLER cmd_func)
115 {
116 UBYTE i;
117
118 TRACE_FUNCTION ("aci_create()");
119
120
121 /* changes to resolve the BUG OMAPS00064964, checking wether the
122 * callbacks are registered twice.
123 */
124 for (i=0;i<MAX_ACI_HANDLER;i++)
125 {
126
127 if(aci_ext_handler[i].prim_handler EQ prim_func AND
128 aci_ext_handler[i].cmd_handler EQ cmd_func)
129 {
130 return i;
131 }
132
133 }
134
135 for (i=0;i<MAX_ACI_HANDLER;i++)
136 {
137 if (aci_ext_handler[i].prim_handler EQ NULL AND
138 aci_ext_handler[i].cmd_handler EQ NULL)
139 {
140 /*
141 * empty entry
142 */
143 aci_ext_handler[i].prim_handler = prim_func;
144 aci_ext_handler[i].cmd_handler = cmd_func;
145 return i;
146 }
147 }
148 return -1;
149 }
150
151
152 /*
153 +--------------------------------------------------------------------+
154 | PROJECT: GSM-MFW (8417) MODULE: MFW_ACIE |
155 | STATE : code ROUTINE: aci_delete |
156 +--------------------------------------------------------------------+
157
158 PURPOSE :
159
160 */
161
162 GLOBAL void aci_delete(int handle)
163 {
164 TRACE_FUNCTION ("aci_delete ()");
165
166 if (handle >= 0 AND
167 handle < MAX_ACI_HANDLER)
168 {
169 aci_ext_handler[handle].prim_handler = NULL;
170 aci_ext_handler[handle].cmd_handler = NULL;
171 }
172 }
173
174
175 /*
176 +--------------------------------------------------------------------+
177 | PROJECT: GSM-MFW (8417) MODULE: MFW_ACIE |
178 | STATE : code ROUTINE: aci_check_primitive |
179 +--------------------------------------------------------------------+
180
181 PURPOSE :
182
183 */
184
185 GLOBAL BOOL aci_check_primitive(ULONG opc, void * data)
186 {
187 UBYTE i;
188
189 TRACE_FUNCTION ("aci_check_primitive()");
190
191 for (i=0;i<MAX_ACI_HANDLER;i++)
192 {
193 if (aci_ext_handler[i].prim_handler NEQ NULL)
194 {
195 /*
196 * extension handler is installed; pass 32 bit opcode to primitive
197 * handling function; note that the MFW functions are similar to pei_primitive
198 * of aci_pei.c and as a loop is used and thus any primitive is parsed, the casting
199 * to 32 bit opcodes needs to be performed inside those handling functions
200 * which handle still 16bit SAPs
201 */
202 if (aci_ext_handler[i].prim_handler(opc, data))
203 /*
204 * primitive is processed by the extension
205 */
206 return TRUE;
207 }
208 }
209 #ifdef _SIMULATION_
210 #ifdef BT_INTERFACE
211 if(!pSlotBt)
212 {
213 TRACE_EVENT_P1 ("mfw_acie:pSlotBt = %d",pSlotBt);
214 bt_init();
215 }
216 #endif
217 #endif
218 /*
219 * primitive is not processed by the extension
220 */
221 return FALSE;
222 }
223
224 /*
225 +--------------------------------------------------------------------+
226 | PROJECT: GSM-MFW (8417) MODULE: MFW_ACIE |
227 | STATE : code ROUTINE: aci_check_command |
228 +--------------------------------------------------------------------+
229
230 PURPOSE :
231
232 */
233
234 GLOBAL BOOL aci_check_command(char * cmd)
235 {
236 UBYTE i;
237
238 TRACE_FUNCTION ("aci_check_command()");
239
240 for (i=0;i<MAX_ACI_HANDLER;i++)
241 {
242 if (aci_ext_handler[i].cmd_handler NEQ NULL)
243 {
244 /*
245 * extension handler is installed
246 */
247 if ((*aci_ext_handler[i].cmd_handler) (cmd))
248 /*
249 * command is processed by the extension
250 */
251 return TRUE;
252 }
253 }
254 /*
255 * command is not processed by the extension
256 */
257 return FALSE;
258 }