comparison g23m-gsm/ss/ss_em.c @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
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 defines the engineering mode (EM) device driver for the
18 | G23 protocol stack. This driver is used to control all engineering
19 | mode related functions.
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef SS_EM_C
24 #define SS_EM_C
25
26 #include "config.h"
27 #include "fixedconf.h"
28 #include "condat-features.h"
29
30 #define ENTITY_SS
31
32 /*==== INCLUDES ===================================================*/
33
34 #include <string.h>
35 #include <stdlib.h>
36 #include <stddef.h>
37 #include "typedefs.h"
38 #include "pcm.h"
39 #include "pconst.cdg"
40 #include "mconst.cdg"
41 #include "message.h"
42 #include "ccdapi.h"
43 #include "vsi.h"
44 #include "custom.h"
45 #include "gsm.h"
46 #include "prim.h"
47 #include "cnf_ss.h"
48 #include "mon_ss.h"
49 #include "pei.h"
50 #include "tok.h"
51 #include "ss.h"
52 #include "ss_em.h"
53
54 /*==== EXPORT =====================================================*/
55
56 /*==== PRIVAT =====================================================*/
57
58 /*==== VARIABLES ==================================================*/
59 #ifdef FF_EM_MODE
60 GLOBAL UBYTE em_ss_event_buffer[EM_SS_BUFFER_SIZE ];
61 GLOBAL UBYTE em_ss_buffer_write;
62
63 /* Event tracing flags for EM */
64 GLOBAL BOOL ss_v[EM_MAX_SS_EVENTS];
65
66 static UBYTE em_ss_trace_occured;
67
68 /*==== FUNCTIONS ==================================================*/
69
70 /*
71 +------------------------------------------------------------------------------
72 | Function : em_write_buffer_3
73 +------------------------------------------------------------------------------
74 | Description : Perform buffer check and store corresponding data in it.
75 |
76 | Parameters : Event number, data value
77 |
78 | Return : TRUE/FALSE
79 |
80 +------------------------------------------------------------------------------
81 */
82
83 GLOBAL UBYTE em_write_buffer_3 (UBYTE event_no, UBYTE value)
84 {
85 TRACE_FUNCTION ("ss_em_write_buffer_3()");
86
87 if (check_write_index(3))
88 {
89 em_ss_event_buffer[em_ss_buffer_write++] = event_no; /* Tag: Event number */
90 em_ss_event_buffer[em_ss_buffer_write++] = 1; /* Length: 0 equals no value */
91 em_ss_event_buffer[em_ss_buffer_write++] = value; /* Value: Data to be stored */
92 return FALSE; /* Data is stored inside buffer, reset flag */
93 }
94 else
95 return TRUE; /* No more space inside buffer, serve flag next time */
96 }
97
98
99 /*
100 +------------------------------------------------------------------------------
101 | Function : check_write_index
102 +------------------------------------------------------------------------------
103 | Description : Checks the write index inside the buffer. No reset when
104 | buffer is full.
105 |
106 | Parameters : Number of bytes to be stored in buffer
107 |
108 | Return : TRUE/FALSE
109 |
110 +------------------------------------------------------------------------------
111 */
112
113 GLOBAL UBYTE check_write_index (UBYTE n)
114 {
115 TRACE_FUNCTION ("ss_check_write_index()");
116
117 if (em_ss_buffer_write + n < EM_SS_BUFFER_SIZE )
118 {
119 /*
120 * ACI is informed about the first event trace,
121 * used for later data processing.
122 */
123 if (em_ss_trace_occured == 0)
124 {
125 PALLOC(em_notification, EM_DATA_IND);
126 em_notification->entity = EM_SS;
127 PSENDX(MMI, em_notification);
128 em_ss_trace_occured++;
129 }
130 return TRUE;
131 }
132 else
133 return FALSE;
134 }
135
136
137 /*
138 +------------------------------------------------------------------------------
139 | Function : em_init_ss_event_trace
140 +------------------------------------------------------------------------------
141 | Description : Initialize the event tracing flags for SMS
142 |
143 | Parameters :
144 |
145 | Return :
146 |
147 +------------------------------------------------------------------------------
148 */
149 GLOBAL void em_init_ss_event_trace(void)
150 {
151 UBYTE i;
152
153 TRACE_FUNCTION ("em_init_ss_event_trace()");
154
155 for(i = 1; i < EM_MAX_SS_EVENTS; i++)
156 ss_v[i] = 0;
157
158 em_ss_buffer_write = 0;
159 }
160
161
162 /*
163 +------------------------------------------------------------------------------
164 | Function : ss_em_ss_event_req
165 +------------------------------------------------------------------------------
166 | Description : Set the event tracing flags according the bitmask
167 |
168 | Parameters : Primitive - Bitmask
169 |
170 | Return :
171 |
172 +------------------------------------------------------------------------------
173 */
174
175 GLOBAL void ss_em_ss_event_req (T_EM_SS_EVENT_REQ *em_ss_event_req)
176 {
177 UBYTE i;
178
179 TRACE_FUNCTION ("em_ss_em_ss_event_req()");
180
181 /*
182 * The event tracing flags are set according the bitmask. ss_v[i] are
183 * the flags belonging to the event number described in 8443.601
184 */
185 for(i=1; i<(EM_MAX_SS_EVENTS); i++)
186 ss_v[i] = ((em_ss_event_req->bitmask_ss & (0x01<<(i-1))) > 0) ? TRUE : FALSE;
187
188 /*
189 * A new event trace is generated therefor the flag is reset.
190 */
191 em_ss_trace_occured = 0;
192
193 PFREE(em_ss_event_req);
194 }
195
196 #endif /* FF_EM_MODE */
197
198 #endif /* #ifndef SS_EM_C */