comparison gsm-fw/g23m-gsm/ss/ss_em.c @ 673:2f7df7a314f8

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