comparison gsm-fw/L1/stand/l1_pei.c @ 614:4274171eabd2

gsm-fw/L1/stand/l1_pei.c: getting close to passing compilation
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 29 Aug 2014 18:38:07 +0000
parents 9e605ec89ed0
children 4d40f9a99445
comparison
equal deleted inserted replaced
613:9e605ec89ed0 614:4274171eabd2
1 /* 1 /*
2 +----------------------------------------------------------------------------- 2 * This is a bastardized version of L1 PEI that will be used only when
3 | Project : 3 * building FreeCalypso in the standalone L1 configuration; see README.
4 | Modul : 4 */
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This module implements the process body interface
18 | for the entity L1.
19 +-----------------------------------------------------------------------------
20 */
21 5
22 #define L1_PEI_C 6 #define L1_PEI_C
23 7
24 #define ENTITY_L1 8 #define ENTITY_L1
25 9
26 #define CUST_OS_C 10 #define CUST_OS_C
27 /*==== INCLUDES =============================================================*/ 11 /*==== INCLUDES =============================================================*/
28 12
29 #if 1
30 #include <string.h> 13 #include <string.h>
31 #if defined (NEW_FRAME) 14 #include "typedefs.h" /* to get Condat data types */
32 #include "typedefs.h" /* to get Condat data types */
33 #else
34 #include "stddefs.h" /* to get Condat data types */
35 #endif
36 #include "vsi.h" /* to get a lot of macros */ 15 #include "vsi.h" /* to get a lot of macros */
37 #include "custom.h"
38 #ifdef GPRS
39 #include "macdef.h"
40 #include "gprs.h"
41 #endif
42 #include "gsm.h" /* to get a lot of macros */
43 #include "prim.h" /* to get the definitions of used SAP and directions */
44 #include "pei.h" /* to get PEI interface */ 16 #include "pei.h" /* to get PEI interface */
45 #include "tools.h" /* to get common tools */ 17 #include "tools.h" /* to get common tools */
46 #include "l1.h" /* to get the global entity definitions */
47 #include "cust_os.h" /* to get cust_os definitions */ 18 #include "cust_os.h" /* to get cust_os definitions */
48
49 #else /* 1 */
50
51 #if defined NEW_FRAME
52
53 #include <string.h>
54 #include <stdio.h>
55 #include "typedefs.h"
56 #include "pconst.cdg"
57 #include "mconst.cdg"
58 #include "message.h"
59 #include "ccdapi.h"
60 #include "vsi.h"
61 #include "custom.h"
62 #include "gsm.h"
63 #include "prim.h"
64 #include "cnf_l1.h"
65 #include "mon_l1.h"
66 #include "cus_l1.h"
67 #include "pei.h"
68 #include "tok.h"
69 #include "l1.h"
70
71
72 #else
73 #include <string.h>
74 #include <stdio.h>
75 #include "stddefs.h"
76 #include "pconst.cdg"
77 #include "mconst.cdg"
78 #include "message.h"
79 #include "ccdapi.h"
80 #include "custom.h"
81 #include "gsm.h"
82 #include "prim.h"
83 #include "cnf_l1.h"
84 #include "mon_l1.h"
85 #include "vsi.h"
86 #include "pei.h"
87 #include "tok.h"
88 #include "l1.h"
89
90 #endif
91 #endif /* 1 */
92 19
93 /*==== CONSTS ================================================================*/ 20 /*==== CONSTS ================================================================*/
94 21
95 /*==== TYPES =================================================================*/ 22 /*==== TYPES =================================================================*/
96 23
102 /*==== LOCALS ================================================================*/ 29 /*==== LOCALS ================================================================*/
103 30
104 static T_MONITOR l1_mon; 31 static T_MONITOR l1_mon;
105 static USHORT first_access = TRUE; 32 static USHORT first_access = TRUE;
106 33
34 static T_HANDLE L1_Handle;
35
36 #define VSI_CALLER L1_Handle,
37
38 static T_HANDLE hCommL1 = VSI_ERROR;
39
107 /*==== PROTOTYPES ============================================================*/ 40 /*==== PROTOTYPES ============================================================*/
108 41
109 SHORT pei_create (T_PEI_INFO **info); 42 void l1_create_HISR (void);
110
111 void l1_create_ISR (void);
112 void l1a_task(unsigned arcg, void *argv); 43 void l1a_task(unsigned arcg, void *argv);
113 44
114 /*==== PRIVATE FUNCTIONS =====================================================*/ 45 /*==== PRIVATE FUNCTIONS =====================================================*/
115 46
116
117 /*
118 +------------------------------------------------------------------------------
119 | Function : pei_primitive
120 +------------------------------------------------------------------------------
121 | Description : Process protocol specific primitive.
122 |
123 | Parameters : prim - pointer to the received primitive
124 |
125 | Return : PEI_OK - function succeeded
126 | PEI_ERROR - function failed
127 +------------------------------------------------------------------------------
128
129 | |
130 PL PPC(GPRS only) UPLINK
131 | |
132 +------v-----------v-------+
133 | |
134 | L1 ASYNC |
135 | |
136 +-------------^------------+
137 |
138 L1 SYNC DOWNLINK
139 |
140
141 */
142 #if defined (NEW_FRAME)
143 LOCAL SHORT pei_primitive (void * ptr)
144 #else
145 EXPORT T_PEI_RETURN pei_primitive (T_PRIM * prim)
146 #endif
147 {
148 #if defined (NEW_FRAME)
149 T_PRIM *prim = (T_PRIM*)ptr;
150 #endif
151
152 USHORT opc = prim->custom.opc;
153
154 /*
155 * primitive is not a GSM primitive - forward it to the environment
156 */
157 if (opc & SYS_MASK)
158 vsi_c_primitive (VSI_CALLER prim);
159 else
160 {
161 PFREE (P2D(prim));
162 return PEI_ERROR;
163 }
164
165 return PEI_OK;
166 }
167 47
168 /* 48 /*
169 +------------------------------------------------------------------------------ 49 +------------------------------------------------------------------------------
170 | Function : pei_init 50 | Function : pei_init
171 +------------------------------------------------------------------------------ 51 +------------------------------------------------------------------------------
175 | 55 |
176 | Return : PEI_OK - entity initialised 56 | Return : PEI_OK - entity initialised
177 | PEI_ERROR - entity not (yet) initialised 57 | PEI_ERROR - entity not (yet) initialised
178 +------------------------------------------------------------------------------ 58 +------------------------------------------------------------------------------
179 */ 59 */
180 #if defined (NEW_FRAME)
181 LOCAL SHORT pei_init ( T_HANDLE Handle ) 60 LOCAL SHORT pei_init ( T_HANDLE Handle )
182 #else 61 {
183 T_PEI_RETURN pei_init (void)
184 #endif
185 {
186 #if defined (NEW_FRAME)
187 L1_Handle = Handle; 62 L1_Handle = Handle;
188 #endif 63
189
190
191
192 #ifdef TI_PS_HCOMM_CHANGE
193 #ifdef NEW_FRAME
194 if ( first_access == TRUE ) 64 if ( first_access == TRUE )
195 { 65 {
196 first_access = FALSE; 66 first_access = FALSE;
197 _osx_init(); 67 _osx_init();
198 } 68 }
199 #endif
200
201 if (!cl_hcom_all_handles_open()) return PEI_ERROR;
202
203 #ifdef NEW_FRAME
204 _osx_open (VSI_CALLER L1_QUEUE, _hCommL1);
205 #endif
206 _osx_open (VSI_CALLER DL_QUEUE, _hCommPL);
207 _osx_open (VSI_CALLER RR_QUEUE, _hCommPL);
208
209 _osx_open (VSI_CALLER GPF_ACI_QUEUE, _hCommMMI);
210 #else
211 #ifdef NEW_FRAME
212 if ( first_access == TRUE )
213 {
214 first_access = FALSE;
215 _osx_init();
216 }
217 /* 69 /*
218 * Associate own "queue" handle (a task handle in the end) with L1_QUEUE, 70 * Associate own "queue" handle (a task handle in the end) with L1_QUEUE,
219 * in order to be able to receive primitives. 71 * in order to be able to receive primitives.
220 */ 72 */
221 if (hCommL1 < VSI_OK) 73 if (hCommL1 < VSI_OK)
222 { 74 {
223 if ((hCommL1 = vsi_c_open (VSI_CALLER L1_NAME)) < VSI_OK) 75 if ((hCommL1 = vsi_c_open (VSI_CALLER "L1")) < VSI_OK)
224 return PEI_ERROR; 76 return PEI_ERROR;
225 _osx_open (VSI_CALLER L1_QUEUE, hCommL1); 77 _osx_open (VSI_CALLER L1_QUEUE, hCommL1);
226 } 78 }
227 #endif
228 79
229 if (hCommPL < VSI_OK) 80 if (hCommPL < VSI_OK)
230 { 81 {
231 if ((hCommPL = vsi_c_open (VSI_CALLER PL_NAME)) < VSI_OK) 82 if ((hCommPL = vsi_c_open (VSI_CALLER PL_NAME)) < VSI_OK)
232 return PEI_ERROR; 83 return PEI_ERROR;
238 { 89 {
239 if ((hCommACI = vsi_c_open (VSI_CALLER ACI_NAME)) < VSI_OK) 90 if ((hCommACI = vsi_c_open (VSI_CALLER ACI_NAME)) < VSI_OK)
240 return PEI_ERROR; 91 return PEI_ERROR;
241 _osx_open (VSI_CALLER GPF_ACI_QUEUE, hCommACI); 92 _osx_open (VSI_CALLER GPF_ACI_QUEUE, hCommACI);
242 } 93 }
243 #endif /* TI_PS_HCOMM_CHANGE */
244 94
245 #ifdef GPRS 95 #ifdef GPRS
246 if (hCommGRR < VSI_OK) 96 if (hCommGRR < VSI_OK)
247 { 97 {
248 if ((hCommGRR = vsi_c_open (VSI_CALLER GRR_NAME)) < VSI_OK) 98 if ((hCommGRR = vsi_c_open (VSI_CALLER GRR_NAME)) < VSI_OK)
268 /* 118 /*
269 * Register VSI_CALLER as generic caller entity. 119 * Register VSI_CALLER as generic caller entity.
270 */ 120 */
271 _osx_open (VSI_CALLER 0, 0); 121 _osx_open (VSI_CALLER 0, 0);
272 122
273 l1_create_ISR (); 123 l1_create_HISR ();
274 124
275 return PEI_OK;
276 }
277
278 /*
279 +------------------------------------------------------------------------------
280 | Function : pei_timeout
281 +------------------------------------------------------------------------------
282 | Description : Process timeout.
283 |
284 | Parameters : index - timer index
285 |
286 | Return : PEI_OK - timeout processed
287 | PEI_ERROR - timeout not processed
288 +------------------------------------------------------------------------------
289 */
290 #if !defined (NEW_FRAME)
291
292 T_PEI_RETURN l1_pei_timeout (T_VSI_THANDLE handle)
293 {
294 TRACE_FUNCTION ("pei_timeout()")
295
296 return PEI_OK;
297 }
298
299 #endif
300
301 /*
302 +------------------------------------------------------------------------------
303 | Function : pei_exit
304 +------------------------------------------------------------------------------
305 | Description : Close Resources and terminate.
306 |
307 | Parameters : -
308 |
309 | Return : PEI_OK - exit sucessful
310 +------------------------------------------------------------------------------
311 */
312 #if defined (NEW_FRAME)
313 LOCAL SHORT pei_exit (void)
314 #else
315 T_PEI_RETURN l1_pei_exit (void)
316 #endif
317 {
318
319
320
321 #ifdef TI_PS_HCOMM_CHANGE
322 #else
323 vsi_c_close (VSI_CALLER hCommPL);
324 hCommPL = VSI_ERROR;
325 #endif
326 return PEI_OK; 125 return PEI_OK;
327 } 126 }
328 127
329 /* 128 /*
330 +------------------------------------------------------------------------------ 129 +------------------------------------------------------------------------------
339 | 138 |
340 | Return : PEI_OK - sucessful 139 | Return : PEI_OK - sucessful
341 | PEI_ERROR - not successful 140 | PEI_ERROR - not successful
342 +------------------------------------------------------------------------------ 141 +------------------------------------------------------------------------------
343 */ 142 */
344 #if defined (NEW_FRAME)
345 LOCAL SHORT pei_run ( T_HANDLE taskhandle, T_HANDLE comhandle ) 143 LOCAL SHORT pei_run ( T_HANDLE taskhandle, T_HANDLE comhandle )
346 #else 144 {
347 T_PEI_RETURN l1_pei_run (T_VSI_CHANDLE comhandle)
348 #endif
349 {
350
351 #ifdef TI_PS_HCOMM_CHANGE
352 #else
353 hCommL1 = comhandle; 145 hCommL1 = comhandle;
354 #endif
355
356 146
357 l1a_task (0, NULL); 147 l1a_task (0, NULL);
358 return PEI_OK; 148 return PEI_OK;
359 } 149 }
360 150
390 | 180 |
391 | Return : PEI_OK - sucessful (address in out_monitor is valid) 181 | Return : PEI_OK - sucessful (address in out_monitor is valid)
392 | PEI_ERROR - not successful 182 | PEI_ERROR - not successful
393 +------------------------------------------------------------------------------ 183 +------------------------------------------------------------------------------
394 */ 184 */
395 #if defined (NEW_FRAME)
396 LOCAL SHORT pei_monitor (void ** monitor) 185 LOCAL SHORT pei_monitor (void ** monitor)
397 #else 186 {
398 T_PEI_RETURN l1_pei_monitor (void ** monitor) 187 l1_mon.version = "FC standalone L1";
399 #endif
400 {
401
402
403 l1_mon.version = "ALR 2.0.0";
404 *monitor = &l1_mon; 188 *monitor = &l1_mon;
405 189
406 return PEI_OK; 190 return PEI_OK;
407 } 191 }
408 192
419 | 203 |
420 | Return : PEI_OK - entity created successfully 204 | Return : PEI_OK - entity created successfully
421 | 205 |
422 +------------------------------------------------------------------------------ 206 +------------------------------------------------------------------------------
423 */ 207 */
424 #if defined (NEW_FRAME)
425
426 GLOBAL SHORT l1_pei_create ( T_PEI_INFO **info ) 208 GLOBAL SHORT l1_pei_create ( T_PEI_INFO **info )
427 { 209 {
428 static T_PEI_INFO pei_info = 210 static T_PEI_INFO pei_info =
429 { 211 {
430 "L1", 212 "L1",
431 { 213 {
432 pei_init, 214 pei_init,
433 #ifdef _SIMULATION_
434 pei_exit,
435 #else
436 NULL, 215 NULL,
437 #endif
438 NULL, /* no primitive function */ 216 NULL, /* no primitive function */
439 NULL, /* no timeout function */ 217 NULL, /* no timeout function */
440 NULL, /* no signal function */ 218 NULL, /* no signal function */
441 pei_run, 219 pei_run,
442 pei_config, 220 pei_config,
443 pei_monitor, 221 pei_monitor,
444 }, 222 },
445 #if defined (GPRS)
446 2800, /* Stack Size */ 223 2800, /* Stack Size */
447 #else
448 #if defined (FAX_AND_DATA)
449 2800, /* Stack Size */
450 #else
451 1805, /* Stacksize */
452 #endif
453 #endif
454 10, /* Queue Entries */ 224 10, /* Queue Entries */
455 235, /* Priority */ 225 235, /* Priority */
456 0, /* number of timer */ 226 0, /* number of timer */
457 #ifdef GPRS
458 COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND /* flags */ 227 COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND /* flags */
459 #else
460 COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND /* flags */
461 #endif
462 }; 228 };
463 229
464 /* 230 /*
465 * export startup configuration data 231 * export startup configuration data
466 */ 232 */
470 */ 236 */
471 237
472 return PEI_OK; 238 return PEI_OK;
473 } 239 }
474 240
475 #else /* NEW_FRAME */
476
477 T_PEI_RETURN pei_create (T_VSI_CNAME * name)
478 {
479 TRACE_FUNCTION ("pei_create()")
480
481 *name = L1_NAME;
482
483 return PEI_OK;
484 }
485
486 #endif /* NEW_FRAME */
487
488 /*==== END OF FILE ==========================================================*/ 241 /*==== END OF FILE ==========================================================*/