annotate src/g23m-gprs/grlc/grlc_meass.c @ 662:8cd8fd15a095

SIM speed enhancement re-enabled and made configurable TI's original code supported SIM speed enhancement, but Openmoko had it disabled, and OM's disabling of speed enhancement somehow caused certain SIM cards to start working which didn't work before (OM's bug #666). Because our FC community is much smaller in year 2020 than OM's community was in their day, we are not able to find one of those #666-affected SIMs, thus the real issue they had encountered remains elusive. Thus our solution is to re-enable SIM speed enhancement and simply wait for if and when someone runs into a #666-affected SIM once again. We provide a SIM_allow_speed_enhancement global variable that allows SIM speed enhancement to be enabled or disabled per session, and an /etc/SIM_spenh file in FFS that allows it to enabled or disabled on a non-volatile basis. SIM speed enhancement is now enabled by default.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 24 May 2020 05:02:28 +0000
parents 219afcfc6250
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
183
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 +-----------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 | Project : GPRS (8441)
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 | Modul : GRLC
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 +-----------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 | Copyright 2002 Texas Instruments Berlin, AG
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 | All rights reserved.
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 | This file is confidential and a trade secret of Texas
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 | Instruments Berlin, AG
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 | The receipt of or possession of this file does not convey
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 | any rights to reproduce or disclose its contents or to
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 | manufacture, use, or sell anything it may describe, in
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 | whole, or in part, without the specific written consent of
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 | Texas Instruments Berlin, AG.
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 +-----------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 | Purpose : This module implements signal handler functions for service
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 | MEAS of entity GRLC.
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 +-----------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #ifndef GRLC_MEASS_C
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #define GRLC_MEASS_C
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #endif /* #ifndef GRLC_MEASS_C */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #define ENTITY_GRLC
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 /*==== INCLUDES =============================================================*/
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "typedefs.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #include "vsi.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include "macdef.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include "gprs.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #include "gsm.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 #include "ccdapi.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #include "prim.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 #include "message.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #include "grlc.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #include "grlc_meass.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 #include "grlc_measf.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 #include "cl_rlcmac.h"
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 /*==== CONST ================================================================*/
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 #define MEAS_MAX_NUM_MEAN 1000 /* maximum numbers of element considered for */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 /* calculating the mean */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 /* maybe for later use */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 #define M_ROUND_UP(x,meas_acrcy) (((x)>=0)? \
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 ((((x)%(meas_acrcy))< ((meas_acrcy)/ 2))? \
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 ( (x)/(meas_acrcy) ):(((x)/(meas_acrcy))+1)): \
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 ((((x)%(meas_acrcy))<=((meas_acrcy)/-2))? \
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 (((x)/(meas_acrcy))-1):( (x)/(meas_acrcy) )))
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 #define M_ROUND_UP(x,meas_acrcy) ((((x)%(meas_acrcy))< ((meas_acrcy)/ 2))? \
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 ( (x)/(meas_acrcy) ):(((x)/(meas_acrcy))+1))
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 #define MEAS_C_INC_INDEX(index) { \
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 if( index < (T_C_INDEX)(~0) ) index++; \
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 #define NORM_FFB_MAX (ULONG)100000 /* normalised forgetting factor b maximum value */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 #define NORM_FFC_MAX (ULONG)500000 /* normalised forgetting factor c maximum value */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 #define NORM_FFB_DIV (ULONG)10 /* normalised forgetting factor b divisor value */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 #define NORM_FFC_DIV (ULONG)20 /* normalised forgetting factor c divisor value */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 #define SV_ACRCY_DIV (ULONG)10 /* signal variance accuracy divisor */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 #define C_VALUE_IDX_DEFAULT 0
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 #define C_VALUE_DEFAULT 0
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 #define SV_VALUE_DEFAULT 0
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 #define RXQUAL_VALUE_DEFAULT 0
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 #define SV_LEVEL_MAX 63
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 #define SV_LEVEL_STEP ((T_SIGN_VAR_VALUE)(MEAS_ACRCY/4))
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 /* dB2 step size of the signal */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 /* variance */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 /*==== LOCAL VARS ===========================================================*/
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 * normalised forgetting factor b used in context of C value calculation
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 * NORM_FFB_MAX * ( 1 / ( 6 * t_avg_t ) )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 LOCAL const ULONG norm_ffb[] = { NORM_FFB_MAX,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 70711, 50000, 35355, 25000, 17678, 12500,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 8839, 6250, 4419, 3125, 2210, 1563,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 1105, 781, 552, 391, 276, 195,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 138, 98, 69, 49, 35, 24,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 17 };
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 * normalised forgetting factor c used in context of C value calculation
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 * NORM_FFC_MAX * ( 1 / ( 12 * t_avg_t ) )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 LOCAL const ULONG norm_ffc[] = { NORM_FFC_MAX,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 353553, 250000, 176777, 125000, 88388, 62500,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 44194, 31250, 22097, 15625, 11049, 7813,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 5524, 3906, 2762, 1953, 1381, 977,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 691, 488, 345, 244, 173, 122,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 86 };
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 /*==== LOCAL TYPES===========================================================*/
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 #if !defined (NTRACE)
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 LOCAL void meas_int_trace_i_level( T_ilev *i_level );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 #endif /* #if !defined (NTRACE) */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 /*==== PUBLIC FUNCTIONS =====================================================*/
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 | Function : meas_grlc_init
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 | Description :
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 | Parameters :
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 GLOBAL void meas_grlc_init ( void )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 TRACE_FUNCTION( "meas_grlc_init" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 /* initialization of C value management */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 meas_c_restart( );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 /* initialization of signal variance management */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 meas_sv_restart( );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 /* initialization of signal quality management */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 meas_sq_restart( );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 } /* grlc_meas_init() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 | Function : sig_rd_meas_qual_rpt_sent
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 | Description : Handles the internal signal SIG_RD_MEAS_QUAL_RPT_SENT
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 | Parameters : void
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 GLOBAL void sig_rd_meas_qual_rpt_sent ( void )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 TRACE_ISIG( "sig_rd_meas_qual_rpt_sent" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 meas_sv_restart( );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 grlc_data->meas.sq_restart = TRUE;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 } /* sig_rd_meas_qual_rpt_sent() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 | Function : sig_tm_meas_ptm
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 | Description : Handles the internal signal SIG_TM_MEAS_PTM
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 | Parameters : void
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 GLOBAL void sig_tm_meas_ptm ( void )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 TRACE_ISIG( "sig_tm_meas_ptm" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 meas_sv_restart( );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 meas_sq_restart( );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 } /* sig_tm_meas_ptm() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 | Function : meas_grlc_c_get_value
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 | Description : This function returns the current C value.
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 | Parameters : void
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 GLOBAL UBYTE meas_grlc_c_get_value ( void )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 UBYTE c_value;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 TRACE_FUNCTION( "meas_grlc_c_get_value" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 if( grlc_data->meas.c_filter.index > 0 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 c_value = ( M_ROUND_UP( grlc_data->meas.c_filter.value, MEAS_ACRCY ) );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 #ifdef _SIMULATION_
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 TRACE_ERROR( "meas_grlc_c_get_value: grlc_data->meas.c_filter.index EQ 0" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 #endif /* #ifdef _SIMULATION_ */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 c_value = C_VALUE_DEFAULT;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 return( c_value );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 } /* meas_grlc_c_get_value() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 | Function : meas_grlc_c_get_c_value
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 | Description :
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 | Parameters :
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 GLOBAL void meas_grlc_c_get_c_value ( T_CGRLC_c_value *c_value )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224 TRACE_FUNCTION( "meas_grlc_c_get_c_value" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 c_value->c_acrcy = MEAS_ACRCY;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 c_value->c_lev = grlc_data->meas.c_filter.value;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 c_value->c_idx = grlc_data->meas.c_filter.index;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
229
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
230 } /* meas_grlc_c_get_c_value() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
231
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
232 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
233 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
234 | Function : meas_grlc_c_set_c_value
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
235 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
236 | Description :
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
237 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
238 | Parameters :
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
239 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
240 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
241 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
242 GLOBAL void meas_grlc_c_set_c_value ( T_CGRLC_c_value *c_value )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
243 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
244 TRACE_FUNCTION( "meas_grlc_c_set_c_value" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
245
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
246 grlc_data->meas.c_filter.value = (c_value->c_lev / c_value->c_acrcy) *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
247 MEAS_ACRCY;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
248
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
249 grlc_data->meas.c_filter.index = c_value->c_idx;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
250
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
251 } /* meas_grlc_c_set_c_value() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
252
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
253 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
254 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
255 | Function : meas_c_val_update_ptm
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
256 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
257 | Description : ...
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
258 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
259 | Parameters : -
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
260 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
261 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
262 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
263 GLOBAL void meas_c_val_update_ptm ( T_MAC_PWR_CTRL_IND *mac_pwr_ctrl_ind,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
264 T_CGRLC_glbl_pwr_ctrl_param *pwr_ctrl_param,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
265 T_CGRLC_freq_param *freq_param )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
266 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
267 UBYTE pb_rdc; /* Pb reduction */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
268 UBYTE vld_smpl = 0; /* valid measurement samples */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
269
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
270 ULONG ff_value;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
271 ULONG c_value;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
272
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
273 T_C_FILTER *c_filter = &grlc_data->meas.c_filter;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
274
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
275 TRACE_FUNCTION( "meas_c_val_update_ptm" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
276
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
277 if( pwr_ctrl_param->pc_meas_chan EQ CGRLC_MEAS_CHAN_BCCH AND
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
278 mac_pwr_ctrl_ind->bcch_level NEQ MAC_RXLEV_NONE )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
279 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
280 MEAS_C_INC_INDEX( c_filter->index );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
281
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
282 if( c_filter->index EQ 1 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
283 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
284 c_filter->value = MEAS_ACRCY * mac_pwr_ctrl_ind->bcch_level;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
285 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
286 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
287 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
288 /* calculate the forgetting factor */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
289 ff_value = norm_ffb[pwr_ctrl_param->t_avg_t];
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
290
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
291 /* update the filter */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
292 c_value = ( NORM_FFB_MAX - ff_value ) *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
293 ( c_filter->value / NORM_FFB_DIV )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
294 +
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
295 ff_value *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
296 ( MEAS_ACRCY / NORM_FFB_DIV ) *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
297 mac_pwr_ctrl_ind->bcch_level;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
298
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
299 c_filter->value = (T_C_VALUE)(c_value / (NORM_FFB_MAX / NORM_FFB_DIV));
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
300 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
301
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
302 #ifdef _SIMULATION_
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
303 TRACE_EVENT_P2( "C-Value = %d, C-Index = %d",
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
304 c_filter->value, c_filter->index );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
305 #endif /* #ifdef _SIMULATION_ */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
306 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
307 else if( pwr_ctrl_param->pc_meas_chan EQ CGRLC_MEAS_CHAN_PDCH )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
308 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
309 vld_smpl = meas_c_calc_mean ( mac_pwr_ctrl_ind->burst_level,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
310 mac_pwr_ctrl_ind->radio_freq,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
311 &c_value, &pb_rdc, freq_param );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
312
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
313 if( vld_smpl )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
314 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
315 MEAS_C_INC_INDEX( c_filter->index );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
316
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
317 /* consider the BTS output power reduction */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
318 c_value -= ( ( 2 * pwr_ctrl_param->pb ) *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
319 ( MEAS_ACRCY * pb_rdc ) / MAC_BURST_PER_BLOCK );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
320
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
321
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
322 if( c_filter->index EQ 1 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
323 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
324 c_filter->value = (T_C_VALUE)c_value;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
325 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
326 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
327 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
328 /* calculate the forgetting factor */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
329 ff_value = norm_ffc[pwr_ctrl_param->t_avg_t];
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
330
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
331 /* update the filter */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
332 c_value = ( NORM_FFC_MAX - ff_value ) *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
333 ( c_filter->value / NORM_FFC_DIV )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
334 +
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
335 ff_value *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
336 ( c_value / NORM_FFC_DIV );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
337
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
338 c_filter->value = (T_C_VALUE)(c_value / (NORM_FFC_MAX / NORM_FFC_DIV));
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
339 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
340 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
341 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
342 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
343 #ifdef _SIMULATION_
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
344 TRACE_EVENT( "no valid RXLEV information in meas_c_val_update_ptm 1" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
345 #endif /* #ifdef _SIMULATION_ */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
346 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
347
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
348 #ifdef _SIMULATION_
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
349 TRACE_EVENT_P2( "C-Value = %d, C-Index = %d",
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
350 c_filter->value, c_filter->index );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
351 #endif /* #ifdef _SIMULATION_ */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
352 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
353 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
354 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
355 #ifdef _SIMULATION_
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
356 TRACE_EVENT( "no valid RXLEV information in meas_c_val_update_ptm 2" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
357 #endif /* #ifdef _SIMULATION_ */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
358 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
359 } /* meas_c_val_update_ptm() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
360
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
361 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
362 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
363 | Function : meas_c_restart
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
364 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
365 | Description : This function initializes the parameters for deriving the
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
366 | C value.
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
367 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
368 | Parameters : void
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
369 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
370 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
371 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
372 GLOBAL void meas_c_restart ( void )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
373 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
374 TRACE_FUNCTION( "meas_c_restart" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
375
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
376 grlc_data->meas.c_filter.value = 0;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
377 grlc_data->meas.c_filter.index = 0;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
378 } /* meas_c_restart() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
379
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
380 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
381 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
382 | Function : meas_sv_get_value
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
383 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
384 | Description : This function returns the current signal variance.
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
385 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
386 | Parameters : void
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
387 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
388 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
389 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
390 GLOBAL UBYTE meas_sv_get_value ( void )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
391 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
392 T_SIGN_VAR_VALUE sv_val;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
393
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
394 TRACE_FUNCTION( "meas_sv_get_value" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
395
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
396 sv_val = grlc_data->meas.sign_var.value / SV_LEVEL_STEP;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
397
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
398 if( grlc_data->meas.sign_var.value % SV_LEVEL_STEP EQ 0 AND
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
399 grlc_data->meas.sign_var.value NEQ 0 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
400 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
401 sv_val -= 1;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
402 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
403
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
404 if( sv_val > SV_LEVEL_MAX )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
405 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
406 sv_val = SV_LEVEL_MAX;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
407 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
408
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
409 return( (UBYTE)sv_val );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
410 } /* meas_sv_get_value() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
411
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
412 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
413 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
414 | Function : meas_sv_update
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
415 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
416 | Description : ...
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
417 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
418 | Parameters : -
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
419 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
420 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
421 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
422 GLOBAL void meas_sv_update ( T_MAC_PWR_CTRL_IND *mac_pwr_ctrl_ind,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
423 T_CGRLC_glbl_pwr_ctrl_param *pwr_ctrl_param,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
424 T_CGRLC_freq_param *freq_param )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
425 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
426 T_SIGN_VAR *sign_var = &grlc_data->meas.sign_var;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
427
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
428 UBYTE i; /* used for counting */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
429 UBYTE ss_on_bcch[MAC_BURST_PER_BLOCK];
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
430 /* receive signal level measured on BCCH */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
431 UBYTE ss_off_bcch[MAC_BURST_PER_BLOCK];
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
432 /* receive signal level not measured on BCCH */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
433 UBYTE j = 0; /* indicates the number of bursts received */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
434 /* on BCCH frequency */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
435 UBYTE *ss_k = NULL; /* points to the receive signal levels */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
436
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
437 TRACE_FUNCTION( "meas_sv_update" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
438
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
439 /* initialize arrays */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
440 for( i = 0; i < MAC_BURST_PER_BLOCK; i++ )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
441 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
442 ss_on_bcch [i] = MAC_RXLEV_NONE;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
443 ss_off_bcch[i] = MAC_RXLEV_NONE;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
444 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
445
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
446 if( mac_pwr_ctrl_ind->crc_error EQ GRLC_CRC_PASS AND
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
447 pwr_ctrl_param->pc_meas_chan EQ CGRLC_MEAS_CHAN_PDCH )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
448 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
449 if( !freq_param->pdch_hopping )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
450 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
451 /* sort burst level acc. its radio frequency */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
452 for( i = 0; i < MAC_BURST_PER_BLOCK; i++ )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
453 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
454 if( mac_pwr_ctrl_ind->radio_freq[i] EQ freq_param->bcch_arfcn )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
455 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
456 j++;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
457
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
458 ss_on_bcch[i] = mac_pwr_ctrl_ind->burst_level[i];
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
459 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
460 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
461 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
462 ss_off_bcch[i] = mac_pwr_ctrl_ind->burst_level[i];
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
463 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
464 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
465
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
466 /* calculate the burst level that should be taken into account */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
467 switch( j )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
468 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
469 case( 0 ): ss_k = &ss_off_bcch[0]; j = 4; break;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
470 case( 1 ): ss_k = &ss_off_bcch[0]; j = 3; break;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
471 case( 2 ): ss_k = NULL; break;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
472 case( 3 ): ss_k = &ss_on_bcch[0]; j = 3; break;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
473 case( 4 ): ss_k = &ss_on_bcch[0]; j = 4; break;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
474 default : TRACE_ASSERT( j < 4 ); break;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
475
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
476 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
477 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
478 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
479 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
480 /* calculate the burst level that should be taken into account */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
481 ss_k = &mac_pwr_ctrl_ind->burst_level[0];
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
482 j = 4;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
483 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
484 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
485
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
486 if( ss_k NEQ NULL )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
487 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
488 T_SIGN_VAR_INDEX old_num;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
489 ULONG old_elem;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
490 UBYTE pb_rdc; /* Pb reduction */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
491 LONG base;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
492 ULONG sum = 0; /* sum of all squares */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
493 ULONG bl_var; /* block variance */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
494 ULONG ss_block;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
495
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
496 if( meas_c_calc_mean ( ss_k, mac_pwr_ctrl_ind->radio_freq,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
497 &ss_block, &pb_rdc, freq_param ) > 0 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
498 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
499 /* calculate the sum of the squares of the difference between */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
500 /* each individual burst level value and the mean */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
501 for( i = 0; i < j; i++ )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
502 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
503 if( ss_k[i] NEQ MAC_RXLEV_NONE )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
504 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
505 base = ( ( ss_k[i] * MEAS_ACRCY ) / SV_ACRCY_DIV ) -
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
506 ( ss_block / SV_ACRCY_DIV );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
507 sum += ( ULONG )( base * base );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
508 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
509 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
510
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
511 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
512 * calculate block variance
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
513 *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
514 * in case ss_k NEQ NULL, j will be either set to the value 3 or 4
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
515 *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
516 * the lint comment below only works when linting current file alone,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
517 * when linting current file together with all other files of the project,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
518 * an error message will be generated anyway
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
519 *
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
520 * I don't know why and gave-up to fix it
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
521 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
522 bl_var = sum / ( UBYTE )( j - 1 ); /*lint !e414*/
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
523
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
524 /* calculate the signal variance */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
525 if( sign_var->index EQ MEAS_MAX_NUM_MEAN )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
526 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
527 old_num = MEAS_MAX_NUM_MEAN - 1;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
528 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
529 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
530 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
531 old_num = sign_var->index;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
532 sign_var->index++;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
533 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
534
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
535 old_elem = sign_var->value * old_num;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
536
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
537 sign_var->value =
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
538 (T_SIGN_VAR_VALUE)((old_elem + (bl_var / SV_ACRCY_DIV)) / sign_var->index);
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
539 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
540 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
541 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
542 #ifdef _SIMULATION_
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
543 TRACE_EVENT( "no valid RXLEV information in meas_sv_update 1" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
544 #endif /* #ifdef _SIMULATION_ */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
545 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
546
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
547 #ifdef _SIMULATION_
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
548 TRACE_EVENT_P2( "SIGN-VAR-Value = %d, SIGN-VAR-Index = %d",
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
549 sign_var->value, sign_var->index );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
550 #endif /* #ifdef _SIMULATION_ */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
551 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
552 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
553 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
554 #ifdef _SIMULATION_
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
555 TRACE_EVENT( "no valid RXLEV information in meas_sv_update 2" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
556 #endif /* #ifdef _SIMULATION_ */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
557 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
558 } /* meas_sv_update() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
559
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
560 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
561 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
562 | Function : meas_sv_restart
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
563 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
564 | Description : This function initializes the parameters for deriving the
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
565 | signal variance.
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
566 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
567 | Parameters : void
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
568 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
569 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
570 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
571 GLOBAL void meas_sv_restart ( void )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
572 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
573 TRACE_FUNCTION( "meas_sv_restart" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
574
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
575 grlc_data->meas.sign_var.value = 0;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
576 grlc_data->meas.sign_var.index = 0;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
577 } /* meas_sv_restart() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
578
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
579 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
580 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
581 | Function : meas_sq_get_rxqual_value
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
582 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
583 | Description : This function returns the current RXQUAL value
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
584 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
585 | Parameters : void
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
586 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
587 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
588 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
589 GLOBAL UBYTE meas_sq_get_rxqual_value ( void)
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
590 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
591 UBYTE rxqual;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
592 T_BER_AVG *ber_avg = &grlc_data->meas.ber_avg;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
593
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
594 TRACE_FUNCTION( "meas_sq_get_rxqual_value" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
595
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
596 if ( ber_avg->value < 200 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
597 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
598 rxqual = 0; /* RX_QUAL_0 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
599 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
600 else if ( ber_avg->value < 400 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
601 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
602 rxqual = 1; /* RX_QUAL_1 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
603 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
604 else if ( ber_avg->value < 800 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
605 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
606 rxqual = 2; /* RX_QUAL_2 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
607 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
608 else if ( ber_avg->value < 1600 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
609 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
610 rxqual = 3; /* RX_QUAL_3 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
611 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
612 else if ( ber_avg->value < 3200 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
613 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
614 rxqual = 4; /* RX_QUAL_4 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
615 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
616 else if ( ber_avg->value < 6400 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
617 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
618 rxqual = 5; /* RX_QUAL_5 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
619 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
620 else if ( ber_avg->value < 12800 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
621 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
622 rxqual = 6; /* RX_QUAL_6 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
623 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
624 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
625 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
626 rxqual = 7; /* RX_QUAL_7 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
627 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
628
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
629 return ( rxqual );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
630 } /* meas_sq_get_rxqual_value() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
631
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
632 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
633 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
634 | Function : meas_sq_update
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
635 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
636 | Description : This function updates the RXQUAL value.
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
637 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
638 | Parameters : per_ind - Ptr to struct T_BER_IND
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
639 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
640 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
641 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
642 GLOBAL void meas_sq_update ( T_BER_IND *ber_ind )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
643 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
644 UBYTE i;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
645 ULONG norm_fault;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
646 ULONG norm_ber;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
647 ULONG old_elem;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
648 T_BER_INDEX old_num;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
649
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
650 T_BER_AVG *ber_avg = &grlc_data->meas.ber_avg;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
651
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
652 TRACE_FUNCTION( "meas_sq_update" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
653
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
654 if(grlc_data->meas.sq_restart)
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
655 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
656 grlc_data->meas.ber_avg.value = 0;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
657 grlc_data->meas.ber_avg.index = 0;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
658
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
659 grlc_data->meas.sq_restart = FALSE;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
660 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
661
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
662 for( i = 0; i < ber_ind->num_dl_blck; i++ )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
663 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
664 if( ber_ind->be_info[i].total NEQ 0 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
665 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
666 if( ber_avg->index EQ MEAS_MAX_NUM_MEAN )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
667 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
668 old_num = MEAS_MAX_NUM_MEAN - 1;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
669 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
670 else
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
671 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
672 old_num = ber_avg->index;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
673 ber_avg->index++;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
674 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
675
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
676 old_elem = ber_avg->value * old_num;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
677 norm_fault = ber_ind->be_info[i].fault * MEAS_ACRCY * 100;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
678 norm_ber = norm_fault / ber_ind->be_info[i].total;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
679 ber_avg->value = (T_BER_VALUE)((old_elem + norm_ber) / ber_avg->index);
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
680
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
681 RX_SetRxQual( meas_sq_get_rxqual_value( ) );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
682 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
683 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
684
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
685 #ifdef _SIMULATION_
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
686 TRACE_EVENT_P2( "BER-Value = %d, BER-Index = %d",
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
687 ber_avg->value, ber_avg->index );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
688 #endif /* #ifdef _SIMULATION_ */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
689 } /* meas_sq_update() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
690
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
691 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
692 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
693 | Function : meas_sq_restart
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
694 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
695 | Description : This function initializes the parameters for deriving the
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
696 | RXQUAL value.
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
697 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
698 | Parameters : void
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
699 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
700 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
701 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
702 GLOBAL void meas_sq_restart ( void )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
703 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
704 TRACE_FUNCTION( "meas_sq_restart" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
705
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
706 grlc_data->meas.ber_avg.value = 0;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
707 grlc_data->meas.ber_avg.index = 0;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
708 } /* meas_sq_restart() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
709
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
710 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
711 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
712 | Function : meas_int_get_rel_i_level
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
713 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
714 | Description : This function returns the interference level values mapped to
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
715 | values relative to the C value.
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
716 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
717 | Parameters : *i_level - Ptr to relative interference level values
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
718 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
719 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
720 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
721 GLOBAL void meas_int_get_rel_i_level ( T_ilev *i_level )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
722 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
723 USHORT c_raw_data_lev = grlc_data->meas.c_filter.value;
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
724
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
725 TRACE_FUNCTION( "meas_int_get_rel_i_level" );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
726
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
727 meas_int_fill_rel_iLevel( &i_level->v_ilev0, &i_level->ilev0, 0, c_raw_data_lev );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
728 meas_int_fill_rel_iLevel( &i_level->v_ilev1, &i_level->ilev1, 1, c_raw_data_lev );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
729 meas_int_fill_rel_iLevel( &i_level->v_ilev2, &i_level->ilev2, 2, c_raw_data_lev );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
730 meas_int_fill_rel_iLevel( &i_level->v_ilev3, &i_level->ilev3, 3, c_raw_data_lev );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
731 meas_int_fill_rel_iLevel( &i_level->v_ilev4, &i_level->ilev4, 4, c_raw_data_lev );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
732 meas_int_fill_rel_iLevel( &i_level->v_ilev5, &i_level->ilev5, 5, c_raw_data_lev );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
733 meas_int_fill_rel_iLevel( &i_level->v_ilev6, &i_level->ilev6, 6, c_raw_data_lev );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
734 meas_int_fill_rel_iLevel( &i_level->v_ilev7, &i_level->ilev7, 7, c_raw_data_lev );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
735
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
736 #if !defined (NTRACE)
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
737
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
738 meas_int_trace_i_level( i_level );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
739
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
740 #endif /* #if !defined (NTRACE) */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
741
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
742 } /* meas_int_get_rel_i_level() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
743
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
744 #if !defined (NTRACE)
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
745
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
746 /*
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
747 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
748 | Function : meas_int_trace_i_level
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
749 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
750 | Description :
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
751 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
752 | Parameters :
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
753 |
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
754 +------------------------------------------------------------------------------
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
755 */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
756 LOCAL void meas_int_trace_i_level( T_ilev *i_level )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
757 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
758 if( grlc_data->meas.v_im_trace NEQ 0 )
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
759 {
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
760 TRACE_EVENT_P8( "meas_int_trace_i_level: %02X %02X %02X %02X %02X %02X %02X %02X",
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
761 i_level->ilev0, i_level->ilev1, i_level->ilev2,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
762 i_level->ilev3, i_level->ilev4, i_level->ilev5,
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
763 i_level->ilev6, i_level->ilev7 );
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
764 }
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
765 } /* meas_int_trace_i_level() */
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
766
219afcfc6250 src/g23m-gprs: initial import from TCS3.2/LoCosto
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
767 #endif /* #if !defined (NTRACE) */