comparison src/g23m-gprs/grr/grr_measp.c @ 183:219afcfc6250

src/g23m-gprs: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 13 Oct 2016 04:24:13 +0000
parents
children
comparison
equal deleted inserted replaced
182:f02d0a0e1849 183:219afcfc6250
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GPRS (8441)
4 | Modul : GRR
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 implements primitive handler functions for service
18 | MEAS of entity GRR.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef GRR_MEASP_C
23 #define GRR_MEASP_C
24 #endif
25
26 #define ENTITY_GRR
27
28 /*==== INCLUDES =============================================================*/
29
30 #include "typedefs.h" /* to get Condat data types */
31 #include <string.h>
32 #include "vsi.h" /* to get a lot of macros */
33 #include "macdef.h"
34 #include "gprs.h"
35 #include "gsm.h" /* to get a lot of macros */
36 #include "ccdapi.h" /* to get CCD API */
37 #include "cnf_grr.h" /* to get cnf-definitions */
38 #include "mon_grr.h" /* to get mon-definitions */
39 #include "prim.h" /* to get the definitions of used SAP and directions */
40 #include "message.h"
41 #include "grr.h" /* to get the global entity definitions */
42 #include "grr_f.h"
43 #include "grr_measf.h" /* to get the definitions for interference measurements */
44 #include "grr_css.h"
45
46 /*==== CONST ================================================================*/
47
48 /*==== LOCAL VARS ===========================================================*/
49
50 /*==== PRIVATE FUNCTIONS ====================================================*/
51 /*
52 +------------------------------------------------------------------------------
53 | Function : meas_p_meas_order_ind
54 +------------------------------------------------------------------------------
55 | Description : ...
56 |
57 | Parameters : *d_meas_order - Ptr to packet measurement order message
58 |
59 +------------------------------------------------------------------------------
60 */
61 GLOBAL void meas_p_meas_order_ind ( T_D_MEAS_ORDER *d_meas_order )
62 {
63 T_NC_ORDER ctrl_order;
64 UBYTE valid_pars;
65
66 TRACE_FUNCTION( "meas_p_meas_order_ind" );
67
68 switch( GET_STATE( MEAS ) )
69 {
70 case MEAS_NULL :
71 case MEAS_IDLE :
72 case MEAS_ACCESS :
73 case MEAS_TRANSFER :
74 valid_pars = meas_em_prcs_meas_order( d_meas_order, &ctrl_order );
75
76 if( ( valid_pars & PMO_EXT_VLD ) EQ PMO_EXT_VLD )
77 {
78 switch( GET_STATE( MEAS_EM ) )
79 {
80 case MEAS_EM_REP_REQ:
81 meas_em_stop_req( );
82
83 /*lint -fallthrough*/
84
85 default:
86 meas_em_valid_pmo( );
87 meas_em_process_t3178( );
88 break;
89 }
90 }
91 if( ( valid_pars & PMO_NC_VLD ) EQ PMO_NC_VLD )
92 {
93 sig_meas_cs_meas_order( ctrl_order );
94 }
95 break;
96
97 default:
98 TRACE_ERROR( "PACKET MEASUREMENT ORDER unexpected 2" );
99 break;
100 }
101 } /* meas_p_meas_order_ind() */
102
103 /*==== PUBLIC FUNCTIONS =====================================================*/
104
105 /*
106 +------------------------------------------------------------------------------
107 | Function : meas_t_im_sync
108 +------------------------------------------------------------------------------
109 | Description : Handles the timeout of timer T_IM_SYNC
110 |
111 | Parameters : void
112 |
113 +------------------------------------------------------------------------------
114 */
115 GLOBAL void meas_t_im_sync ( void )
116 {
117 TRACE_FUNCTION( "meas_t_im_sync" );
118
119 meas_im_timer_elapsed( );
120 } /* meas_t_im_sync() */
121
122 /*
123 +------------------------------------------------------------------------------
124 | Function : meas_t3178
125 +------------------------------------------------------------------------------
126 | Description : Handles the timeout of timer T3178
127 |
128 | Parameters : void
129 |
130 +------------------------------------------------------------------------------
131 */
132 GLOBAL void meas_t3178 ( void )
133 {
134 TRACE_FUNCTION( "meas_t3178" );
135
136 TRACE_EVENT( "T3178 timeout" );
137
138 switch( GET_STATE( MEAS ) )
139 {
140 case MEAS_IDLE:
141 switch( GET_STATE( MEAS_EM ) )
142 {
143 case MEAS_EM_NULL:
144 meas_em_start( );
145
146 SET_STATE( MEAS_EM, MEAS_EM_REP_REQ );
147 break;
148
149 default:
150 meas_em_process_t3178( );
151 break;
152 }
153 break;
154
155 case MEAS_ACCESS:
156 case MEAS_TRANSFER:
157 /*
158 * if the MS is in packet transfer mode when the measurement shall start,
159 * the MS shall wait until it returns to packet idle mode
160 */
161 switch( GET_STATE( MEAS_EM ) )
162 {
163 case MEAS_EM_NULL:
164 case MEAS_EM_REP_REQ:
165 SET_STATE( MEAS_EM, MEAS_EM_PENDING );
166
167 meas_em_process_t3178( );
168 break;
169
170 case MEAS_EM_PMR_SENDING:
171 case MEAS_EM_PENDING:
172 meas_em_process_t3178( );
173 break;
174 }
175 break;
176
177 default:
178 TRACE_ERROR( "T3178 timeout unexpected 3" );
179 break;
180 }
181 } /* meas_t3178() */
182
183 /*
184 +------------------------------------------------------------------------------
185 | Function : meas_tb_rxlev_sc_req
186 +------------------------------------------------------------------------------
187 | Description : Handles the primitive TB_RXLEV_SC_REQ
188 |
189 | Parameters : *tb_rxlev_sc_req - Ptr to primitive payload
190 |
191 +------------------------------------------------------------------------------
192 */
193 GLOBAL void meas_tb_rxlev_sc_req ( T_TB_RXLEV_SC_REQ *tb_rxlev_sc_req )
194 {
195 TRACE_FUNCTION( "meas_tb_rxlev_sc_req" );
196
197 switch( GET_STATE( MEAS ) )
198 {
199 case MEAS_NULL:
200 break;
201
202 case MEAS_IDLE:
203 case MEAS_ACCESS:
204 if( grr_is_pbcch_present( ) EQ FALSE )
205 {
206 meas_c_val_update_pim( tb_rxlev_sc_req->sc_rxlev );
207 grr_cgrlc_pwr_ctrl_req( TRUE );
208 }
209 break;
210
211 default:
212 TRACE_ERROR( "TB_RXLEV_SC_REQ unexpected" );
213 break;
214 }
215
216 PFREE( tb_rxlev_sc_req );
217
218 } /* meas_tb_rxlev_sc_req() */