comparison src/g23m-gsm/mm/mm_em.h @ 104:27a4235405c6

src/g23m-gsm: import from LoCosto source
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 04 Oct 2016 18:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
103:76d139c7a25e 104:27a4235405c6
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
5 +-----------------------------------------------------------------------------
6 | Copyright 2003 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 : Engineering Mode (EM) Declarations + Macros
18 |
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef MM_EM_H
23 #define MM_EM_H
24
25 #ifdef FF_EM_MODE
26 /* ---------------- data declarations for EM ----------------*/
27
28 /*
29 * Ring buffer is by one bigger than max. number of prims, because it
30 * needs always one empty entry
31 */
32 #define EM_MM_BUFFER_SIZE 168
33
34 /*
35 * EM_MAX_MM_EVENTS defines maximum number of event traces for the engineering
36 * mode. The number is increased by one to ensure that the event numbers
37 * defined in the corresponding document are the same as in the sources.
38 */
39 #define EM_MAX_MM_EVENTS 19
40
41 /*
42 * The offset is used to indicate the source entity the event trace is from.
43 * L1/ALR = 0x00, DL = 0x2D, RR = 0x37, MM = 0x5F,
44 * CC = 0x78, SS = 0xAF, SMS = 0xBE, SIM = E1
45 */
46 #define MM_OFFSET 0x5F
47 #define EM_ESTABLISHED 2
48 #define EM_FAILED 3
49 #define EM_ACCEPT 4
50 #define EM_REJECT 5
51 #define EM_AUTOMATIC 0
52 #define EM_MANUAL 1
53 #define EM_LIMITED_SERVICE 8
54 #define EM_FULL_SERVICE 9
55 #define EM_NO_SERVICE 10
56 #define EM_NORMAL_LUP 11
57 #define EM_PERIODIC_LUP 12
58 #define EM_IMSI_ATTACH_LUP 13
59 #define EM_REQUEST 14
60 #define EM_RESPONSE 15
61 #define EM_CIPHERING 14
62 #define EM_COMMAND 15
63
64 /*
65 * Type is combination of entity index(upper nibble) plus
66 * event number(lower nibble). To optimize the buffersize,
67 * the data is packed in the buffer as follows: type, length, value
68 * Value is the combination of the additional parameters
69 * as defined in 8443.601, coded as UBYTE.
70 */
71 #define MM_V_1 (1+MM_OFFSET)
72 #define MM_V_2 (2+MM_OFFSET)
73 #define MM_V_3 (3+MM_OFFSET)
74 #define MM_V_4 (4+MM_OFFSET)
75 #define MM_V_5 (5+MM_OFFSET)
76 #define MM_V_6 (6+MM_OFFSET)
77 #define MM_V_7 (7+MM_OFFSET)
78 #define MM_V_8 (8+MM_OFFSET)
79 #define MM_V_9 (9+MM_OFFSET)
80 #define MM_V_10 (10+MM_OFFSET)
81 #define MM_V_11 (11+MM_OFFSET)
82 #define MM_V_12 (12+MM_OFFSET)
83 #define MM_V_13 (13+MM_OFFSET)
84 #define MM_V_14 (14+MM_OFFSET)
85 #define MM_V_15 (15+MM_OFFSET)
86 #define MM_V_16 (16+MM_OFFSET)
87 #define MM_V_17 (17+MM_OFFSET)
88 #define MM_V_18 (18+MM_OFFSET)
89
90 EXTERN BOOL mm_v[EM_MAX_MM_EVENTS];
91
92 EXTERN UBYTE em_mm_event_buffer[EM_MM_BUFFER_SIZE];
93 EXTERN UBYTE em_mm_buffer_write;
94
95 /*----------------- Functions ---------------------*/
96
97
98 /*
99 * Mobility management primitives Engineering Mode
100 * Bitmask for the event tracing
101 */
102 EXTERN void mm_em_mm_event_req (T_EM_MM_EVENT_REQ *em_mm_event_req);
103 EXTERN void mm_em_dl_event_req (T_EM_DL_EVENT_REQ *em_dl_event_req);
104 EXTERN void em_init_mm_event_trace (void);
105
106 /*
107 * If all entities are linked into one module this definitions
108 * prefixes all this functions with the enity name
109 */
110 #ifdef OPTION_MULTITHREAD
111 #define em_write_buffer_2 _ENTITY_PREFIXED(em_write_buffer_2)
112 #define em_write_buffer_3 _ENTITY_PREFIXED(em_write_buffer_3)
113 #define em_write_buffer_3a _ENTITY_PREFIXED(em_write_buffer_3a)
114 #define em_write_buffer_3b _ENTITY_PREFIXED(em_write_buffer_3b)
115 #define em_write_buffer_4 _ENTITY_PREFIXED(em_write_buffer_4)
116 #define em_write_buffer_4a _ENTITY_PREFIXED(em_write_buffer_4a)
117 #define em_write_buffer_4b _ENTITY_PREFIXED(em_write_buffer_4b)
118 #define em_write_buffer_4c _ENTITY_PREFIXED(em_write_buffer_4c)
119 #define em_write_buffer_5a _ENTITY_PREFIXED(em_write_buffer_5a)
120 #define em_write_buffer_6 _ENTITY_PREFIXED(em_write_buffer_6)
121
122 #define check_write_index _ENTITY_PREFIXED(check_write_index)
123 #endif /*OPTION_MULTITHREAD*/
124
125 EXTERN UBYTE em_write_buffer_2 (UBYTE event_no);
126 EXTERN UBYTE em_write_buffer_3 (UBYTE event_no, UBYTE value);
127 EXTERN UBYTE em_write_buffer_3a (UBYTE event_no, USHORT value);
128 EXTERN UBYTE em_write_buffer_3b (UBYTE event_no, ULONG value);
129 EXTERN UBYTE em_write_buffer_4 (UBYTE event_no, UBYTE value1, T_plmn *plmn);
130 EXTERN UBYTE em_write_buffer_4a (UBYTE event_no, UBYTE value1, USHORT value2);
131 EXTERN UBYTE em_write_buffer_4b (UBYTE event_no, UBYTE ident_type, UBYTE *value);
132 EXTERN UBYTE em_write_buffer_4c (UBYTE event_no, UBYTE ident_type, ULONG value);
133 EXTERN UBYTE em_write_buffer_5a (UBYTE event_no, UBYTE value, UBYTE mcc[SIZE_MCC], UBYTE mnc[SIZE_MNC]);
134 EXTERN UBYTE em_write_buffer_6 (UBYTE event_no, UBYTE loc_upd_type, T_loc_area_ident lai);
135
136
137
138 EXTERN UBYTE check_write_index (UBYTE n);
139
140
141
142 /* ---------------- Macro definitions ---------------------- */
143
144 #define EM_SIM_INSERT \
145 /* SIM Insert */\
146 if (mm_v[1])\
147 {\
148 mm_v[1] = em_write_buffer_2 (MM_V_1 );\
149 } /* mm_v[1] */
150
151 #define EM_SIM_REMOVE \
152 /* SIM remove */\
153 if (mm_v[2])\
154 {\
155 mm_v[2] = em_write_buffer_2 (MM_V_2 );\
156 } /* mm_v[2] */
157
158 #define EM_SET_PLMN_SEARCH_MODE \
159 /* Set PLMN search mode */\
160 if (mm_v[3])\
161 {\
162 mm_v[3] = em_write_buffer_3 (MM_V_3 , plmn_mode_req->mode);\
163 } /* mm_v[3] */
164
165 #define EM_START_REGISTRATION_AUTO_MODE \
166 /* Start registration auto mode */\
167 if (mm_v[4])\
168 {\
169 mm_v[4] = em_write_buffer_5a (MM_V_4, SERVICE_MODE_FULL,\
170 mm_data->reg.actual_plmn.mcc,\
171 mm_data->reg.actual_plmn.mnc);\
172 } /* mm_v[4] */
173
174 #define EM_START_REGISTRATION_MANUAL_MODE \
175 /* Start registration manual mode */\
176 if (mm_v[4])\
177 {\
178 mm_v[4] = em_write_buffer_5a (MM_V_4, service_mode, mm_data->mm.lai.mcc, mm_data->mm.lai.mnc);\
179 } /* mm_v[4] */
180
181 #define EM_START_PLMN_LIST_REQUEST \
182 /* Start PLMN list request */\
183 if (mm_v[5])\
184 {\
185 mm_v[5] = em_write_buffer_2 (MM_V_5 );\
186 } /* mm_v[5] */
187
188 #define EM_CELL_SELECTION_RESELECTION \
189 /* Cell selection/reselection */\
190 if (mm_v[6])\
191 {\
192 mm_v[6] = em_write_buffer_5a (MM_V_6, rr_activate_cnf->op.service, rr_activate_cnf->plmn.mcc, rr_activate_cnf->plmn.mnc);\
193 } /* mm_v[6] */
194
195 #define EM_RESULT_PLMN_LIST \
196 /* MM Event Tracing */\
197 /* Result PLMN list */\
198 if (mm_v[7])\
199 {\
200 mm_v[7] = em_write_buffer_4(MM_V_7, rr_abort_ind->plmn_avail, rr_abort_ind->plmn);\
201 } /* mm_v[7] */
202
203 #define EM_RR_CONECTION_REQUESTED \
204 /* RR connection requested */\
205 if (mm_v[8])\
206 {\
207 mm_v[8] = em_write_buffer_6 (MM_V_8, loc_upd_type, mm_data->mm.lai);\
208 } /* mm_v[8] */
209
210 #define EM_RR_CONECTION_ESTABLISHED \
211 /* RR connection established */\
212 if (mm_v[9])\
213 {\
214 mm_v[9] = em_write_buffer_2 (MM_V_9);\
215 } /* mm_v[9] */
216
217 #define EM_RR_CONNECTION_ESTABLISHED_2 \
218 if (mm_count_connections (CM_PENDING) NEQ 0)\
219 {\
220 /* RR connection established */\
221 if (mm_v[9])\
222 {\
223 /* Event number flag is set */\
224 mm_v[9] = em_write_buffer_3a (MM_V_9, mm_data->rej_cause);\
225 } /* mm_v[9] */\
226 } /* mm_count_connections (CM_PENDING) */
227
228 #define EM_LOCATION_UPDATING \
229 /* Location updating */\
230 if (mm_v[10])\
231 {\
232 mm_v[10] = em_write_buffer_3 (MM_V_10, EM_ACCEPT);\
233 } /* mm_v[10 */
234
235 #define EM_LOCATION_UPDATING_REJECT \
236 /* Location updating reject*/\
237 if (mm_v[10])\
238 {\
239 mm_v[10]=em_write_buffer_4a ( MM_V_10, EM_REJECT, mm_data->limited_cause);\
240 } /* mm_v[10] */
241
242 #define EM_TMSI_REALLOCATION_COMPLETE\
243 /* TMSI reallocation complete */\
244 if (mm_v[11])\
245 {\
246 mm_v[11]=em_write_buffer_3b (MM_V_11, mm_data->reg.tmsi);\
247 } /* mm_v[11] */
248
249 #define EM_IMSI_DETACH \
250 /* IMSI detach */\
251 if (mm_v[12])\
252 { \
253 mm_v[12] = em_write_buffer_2 (MM_V_12);\
254 } /* mm_v[12] */
255
256 #define EM_IDENTITY_REQUEST_RESPONSE \
257 /* Identity request/response */\
258 if (mm_v[13])\
259 {\
260 switch (ident_req->ident.ident_type)\
261 {\
262 case ID_TYPE_IMSI:\
263 case ID_TYPE_IMEI:\
264 case ID_TYPE_IMEISV: /*stores ident_type and IMSI|IMEI|IMEISV*/\
265 mm_v[13]=em_write_buffer_4b(MM_V_13, ident_req->ident.ident_type, ident_res->mob_id.ident_dig);\
266 break;\
267 case ID_TYPE_TMSI: /*stores ident_type and TMSI*/\
268 mm_v[13]=em_write_buffer_4c(MM_V_13, ident_req->ident.ident_type, mm_data->reg.tmsi);\
269 break;\
270 default: /* Illegal mobile identity */\
271 break;\
272 }/*switch*/\
273 } /* mm_v[13] */
274
275 #define EM_AUTHENTICATION(x) \
276 /* Authentication reject*/\
277 if (mm_v[14])\
278 {\
279 mm_v[14] = em_write_buffer_3 (MM_V_14, x);\
280 } /* mm_v[14] */
281
282 #define EM_CM_SERVICE_REQUESTED \
283 /* CM service requested */\
284 if (mm_v[15])\
285 {\
286 mm_v[15] = em_write_buffer_3 (MM_V_15, mm_data->pend_conn.comp);\
287 } /* mm_v[15] */
288
289 #define EM_CM_SERVICE_ACCEPTED(x) \
290 /* CM service accepted */\
291 if (mm_v[16])\
292 {\
293 mm_v[16] = em_write_buffer_3 (MM_V_16, x);\
294 } /* mm_v[16] */
295
296 #define EM_CM_SERVICE_REJECT \
297 /* CM service reject */\
298 if (mm_v[17])\
299 {\
300 mm_v[17] = em_write_buffer_3a (MM_V_17, cm_serv_rej->rej_cause);\
301 } /* mm_v[17] */
302
303 #define EM_SERVICE_ABORTED \
304 /* CM service aborted */\
305 if (mm_v[18])\
306 {\
307 mm_v[18] = em_write_buffer_2 (MM_V_18);\
308 } /* mm_v[18] */
309
310 #else /*FF_EM_MODE not defined*/
311
312 /*Macros will stay empty, if no EM */
313 #define EM_SIM_INSERT /* Event 1*/
314 #define EM_SIM_REMOVE /* Event 2*/
315 #define EM_SET_PLMN_SEARCH_MODE /* Event 3*/
316 #define EM_START_REGISTRATION_AUTO_MODE /* Event 4*/
317 #define EM_START_REGISTRATION_MANUAL_MODE /* Event 4*/
318 #define EM_START_PLMN_LIST_REQUEST /* Event 5*/
319 #define EM_CELL_SELECTION_RESELECTION /* Event 6*/
320 #define EM_RESULT_PLMN_LIST /* Event 7*/
321 #define EM_RR_CONECTION_REQUESTED /* Event 8*/
322 #define EM_RR_CONECTION_ESTABLISHED /* Event 9*/
323 #define EM_RR_CONNECTION_ESTABLISHED_2 /* Event 9*/
324 #define EM_LOCATION_UPDATING /* Event 10*/
325 #define EM_LOCATION_UPDATING_REJECT /* Event 10*/
326 #define EM_TMSI_REALLOCATION_COMPLETE /* Event 11*/
327 #define EM_IMSI_DETACH /* Event 12*/
328 #define EM_IDENTITY_REQUEST_RESPONSE /* Event 13*/
329 #define EM_AUTHENTICATION(x) /* Event 14*/
330 #define EM_CM_SERVICE_REQUESTED /* Event 15*/
331 #define EM_CM_SERVICE_ACCEPTED(x) /* Event 16*/
332 #define EM_CM_SERVICE_REJECT /* Event 17*/
333 #define EM_SERVICE_ABORTED /* Event 18*/
334
335 #endif /* FF_EM_MODE */
336 #endif /* MM_EM_H */