comparison gsm-fw/L1/stand/forwarder.c @ 618:0c736bd8385e

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