FreeCalypso > hg > fc-magnetite
comparison src/g23m-gprs/grlc/grlc_measf.c @ 183:219afcfc6250
src/g23m-gprs: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 13 Oct 2016 04:24:13 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
182:f02d0a0e1849 | 183:219afcfc6250 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GPRS (8441) | |
4 | Modul : GRLC | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This module implements local functions for service | |
18 | MEAS of entity GRLC. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef GRLC_MEASF_C | |
23 #define GRLC_MEASF_C | |
24 #endif /* #ifndef GRLC_MEASF_C */ | |
25 | |
26 #define ENTITY_GRLC | |
27 | |
28 /*==== INCLUDES =============================================================*/ | |
29 | |
30 #include "typedefs.h" | |
31 #include "vsi.h" | |
32 #include "macdef.h" | |
33 #include "gprs.h" | |
34 #include "gsm.h" | |
35 #include "ccdapi.h" | |
36 #include "prim.h" | |
37 #include "message.h" | |
38 #include "grlc.h" | |
39 #include "grlc_measf.h" | |
40 | |
41 /*==== CONST ================================================================*/ | |
42 | |
43 #define I_LEVEL_MIN I_LEVEL_0 | |
44 #define I_LEVEL_0 0 /* i.lev. is greater than C */ | |
45 #define I_LEVEL_15 15 /* i.lev. is less than or equal to C - 28 dB */ | |
46 #define I_LEVEL_MAX I_LEVEL_15 | |
47 #define I_LEVEL_GAMMA_0_SKIPPED 0xF0 /* used for tracing */ | |
48 #define I_LEVEL_GAMMA_1_SKIPPED 0xF1 /* used for tracing */ | |
49 #define I_LEVEL_GAMMA_2_SKIPPED 0xF2 /* used for tracing */ | |
50 #define I_LEVEL_GAMMA_3_SKIPPED 0xF3 /* used for tracing */ | |
51 #define I_LEVEL_STATE_MISMATCH 0xFD /* used for tracing */ | |
52 #define I_LEVEL_IDX_TO_SMALL 0xFE /* used for tracing */ | |
53 #define I_LEVEL_NOT_AVAIL 0xFF /* used for tracing */ | |
54 | |
55 /*==== LOCAL VARS ===========================================================*/ | |
56 | |
57 /*==== LOCAL TYPES===========================================================*/ | |
58 | |
59 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
60 /* | |
61 +------------------------------------------------------------------------------ | |
62 | Function : meas_c_calc_mean | |
63 +------------------------------------------------------------------------------ | |
64 | Description : This function calculates the mean of the received signal level | |
65 | of the four normal bursts that compose a block. It returns | |
66 | the amount of bursts with valid receibed signal values. | |
67 | | |
68 | Parameters : burst_level - receive signal level of the first valid downlink | |
69 | PDCH radio block | |
70 | radio_freq - radio frequency of TDMA frame within a | |
71 | radio block | |
72 | ss_block - mean of the received signal level | |
73 | pb_rdc - Pb reduction | |
74 | | |
75 +------------------------------------------------------------------------------ | |
76 */ | |
77 GLOBAL UBYTE meas_c_calc_mean ( UBYTE *burst_level, | |
78 USHORT *radio_freq, | |
79 ULONG *ss_block, | |
80 UBYTE *pb_rdc, | |
81 T_CGRLC_freq_param *freq_param ) | |
82 { | |
83 UBYTE i; /* used for counting */ | |
84 UBYTE vld_smpl = 0; /* valid measurement samples */ | |
85 | |
86 TRACE_FUNCTION( "meas_c_calc_mean" ); | |
87 | |
88 *pb_rdc = 0; | |
89 *ss_block = 0; | |
90 | |
91 /* add up all measurement data */ | |
92 for( i = 0; i < MAC_BURST_PER_BLOCK; i++ ) | |
93 { | |
94 if( burst_level[i] NEQ MAC_RXLEV_NONE ) | |
95 { | |
96 vld_smpl++; | |
97 | |
98 *ss_block += burst_level[i]; | |
99 | |
100 if( !( grlc_data->tm.freq_param.pdch_hopping EQ FALSE AND | |
101 grlc_data->tm.freq_param.bcch_arfcn EQ radio_freq[i] ) ) | |
102 { | |
103 *pb_rdc += 1; | |
104 } | |
105 } | |
106 } | |
107 | |
108 /* calculate the mean */ | |
109 if( vld_smpl ) | |
110 { | |
111 *ss_block = ( *ss_block * MEAS_ACRCY ) / vld_smpl; | |
112 } | |
113 | |
114 return( vld_smpl ); | |
115 } /* meas_c_calc_mean() */ | |
116 | |
117 /* | |
118 +------------------------------------------------------------------------------ | |
119 | Function : meas_int_fill_rel_iLevel | |
120 +------------------------------------------------------------------------------ | |
121 | Description : ... | |
122 | | |
123 | Parameters : ... | |
124 | | |
125 +------------------------------------------------------------------------------ | |
126 */ | |
127 GLOBAL void meas_int_fill_rel_iLevel ( UBYTE *v_ilev, | |
128 UBYTE *ilev, | |
129 UBYTE idx, | |
130 USHORT c_raw_data_lev ) | |
131 { | |
132 UBYTE val; /* holds interference level data */ | |
133 | |
134 if( grlc_data->meas.ilev.ilev[idx] NEQ CGRLC_ILEV_NONE ) | |
135 { | |
136 if( c_raw_data_lev < grlc_data->meas.ilev.ilev[idx] * MEAS_ACRCY ) | |
137 { | |
138 *ilev = I_LEVEL_MIN; | |
139 } | |
140 else | |
141 { | |
142 val = ( c_raw_data_lev - grlc_data->meas.ilev.ilev[idx] * MEAS_ACRCY ) / | |
143 ( 2 * MEAS_ACRCY ) + 1; | |
144 | |
145 if( val > I_LEVEL_MAX ) *ilev = I_LEVEL_MAX; | |
146 else *ilev = val; | |
147 } | |
148 | |
149 *v_ilev = TRUE; | |
150 } | |
151 else | |
152 { | |
153 *v_ilev = FALSE; | |
154 } | |
155 } /* meas_int_fill_rel_iLevel() */ |