FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/L1/stand/forwarder.c @ 753:7f68d2ab0d33
SIM_TOOLKIT re-enabled: the SIM entity code is broken without it
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 11 Oct 2014 21:24:24 +0000 |
parents | 0c736bd8385e |
children |
rev | line source |
---|---|
618
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This module implements the special "forwarder" (L1IF) GPF entity |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * for L1 standalone operation described in README. |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 /*==== INCLUDES =============================================================*/ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <string.h> |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include "typedefs.h" /* to get Condat data types */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include "vsi.h" /* to get a lot of macros */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "pei.h" /* to get PEI interface */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "tools.h" /* to get common tools */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "header.h" |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 #include "os.h" |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 #include "../../gpf/frame/route.h" |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 /*==== LOCALS ================================================================*/ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 static T_HANDLE Our_Handle; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 #define VSI_CALLER Our_Handle, |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 static T_HANDLE hCommTST = VSI_ERROR; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 /*==== PRIVATE FUNCTIONS =====================================================*/ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 /* |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 +------------------------------------------------------------------------------ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 | Function : pei_init |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 +------------------------------------------------------------------------------ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 | Description : Initialize Protocol Stack Entity |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 | |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 | Parameters : handle - task handle |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 | |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 | Return : PEI_OK - entity initialised |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 | PEI_ERROR - entity not (yet) initialised |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 +------------------------------------------------------------------------------ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 LOCAL SHORT pei_init ( T_HANDLE Handle ) |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 { |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 Our_Handle = Handle; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 if (hCommTST < VSI_OK) |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 { |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 if ((hCommTST = vsi_c_open (VSI_CALLER "TST")) < VSI_OK) |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 return PEI_ERROR; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 } |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 return PEI_OK; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 } |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 LOCAL SHORT pei_primitive (void *primitive) |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 { |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 OS_QDATA OS_Msg = { 0 }; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 T_VOID_STRUCT *prim = (T_VOID_STRUCT *) primitive; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 OS_Msg.data16 = MSG_PRIMITIVE; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 OS_Msg.e_id = Our_Handle; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 OS_Msg.ptr = prim; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 OS_Msg.data32 = P_OPC(prim); |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 os_GetTime(0, &OS_Msg.time); |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 rt_ExtPrimitive(Our_Handle, hCommTST, Our_Handle, "EXT", &OS_Msg); |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 return PEI_OK; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 } |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 /*==== PUBLIC FUNCTIONS =====================================================*/ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 /* |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 +------------------------------------------------------------------------------ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 | Function : pei_create |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 +------------------------------------------------------------------------------ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 | Description : Create the Protocol Stack Entity. |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 | |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 | Parameters : info - Pointer to the structure of entity parameters |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 | |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 | Return : PEI_OK - entity created successfully |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 | |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 +------------------------------------------------------------------------------ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 GLOBAL SHORT l1stand_fwd_pei_create ( T_PEI_INFO **info ) |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 { |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 static T_PEI_INFO pei_info = |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 { |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 "L1IF", |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 { |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 pei_init, |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 NULL, |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 pei_primitive, |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 NULL, /* no timeout function */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 NULL, /* no signal function */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 NULL, /* no run function */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 NULL, /* no config function */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 NULL, /* no monitor function */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 }, |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 1000, /* Stack Size */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 50, /* Queue Entries */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 20, /* Priority */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 0, /* number of timer */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 PASSIVE_BODY | COPY_BY_REF | TRC_NO_SUSPEND /* flags */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 }; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 /* |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 * export startup configuration data |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 *info = &pei_info; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 /* |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 * Initialize entity data |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 */ |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 return PEI_OK; |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 } |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 |
0c736bd8385e
L1 standalone: forwarder entity implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 /*==== END OF FILE ==========================================================*/ |