comparison src/g23m-gprs/grlc/grlc_tpcg.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 | TPC of entity GRLC.
19 +-----------------------------------------------------------------------------
20 */
21
22 /*
23 * !!!ATTENTION!!!ATTENTION!!!ATTENTION!!!ATTENTION!!!ATTENTION!!!ATTENTION!!!
24 *
25 * This file was previously named grlc_tpcf.c.
26 *
27 * A renaming was necessary due to an ClearCase evil twin problem across the
28 * TCS2/TCS3/TCS4 and the TCS5 programs.
29 *
30 * The same applied for the file grlc_tpcf.h.
31 *
32 * !!!ATTENTION!!!ATTENTION!!!ATTENTION!!!ATTENTION!!!ATTENTION!!!ATTENTION!!!
33 */
34
35 #ifndef GRLC_TPCG_C
36 #define GRLC_TPCG_C
37 #endif /* #ifndef GRLC_TPCG_C */
38
39 #define ENTITY_GRLC
40
41 /*==== INCLUDES =============================================================*/
42
43 #include <string.h>
44 #include "typedefs.h"
45 #include "vsi.h"
46 #include "macdef.h"
47 #include "gprs.h"
48 #include "gsm.h"
49 #include "ccdapi.h"
50 #include "prim.h"
51 #include "message.h"
52 #include "grlc.h"
53
54 /*==== CONST ================================================================*/
55
56 #define MIN_PCL_GSM900 31 /* minimum power control level GSM 900 */
57 #define MAX_PCL_GSM900 0 /* maximum power control level GSM 900 */
58 #define MIN_PCL_DCS1800 28 /* minimum power control level DCS 1800 */
59 #define MAX_PCL_DCS1800 29 /* maximum power control level DCS 1800 */
60 #define MIN_PCL_PCS1900 21 /* minimum power control level PCS 1900 */
61 #define MAX_PCL_PCS1900 22 /* maximum power control level PCS 1900 */
62
63 #define GAMMA_0_GSM900 39
64 #define GAMMA_0_DCS1800 36
65 #define GAMMA_0_PCS1900 36
66
67 #define MAX_PCL 32
68
69 /*==== DIAGNOSTICS ==========================================================*/
70
71 /*==== LOCAL VARS ===========================================================*/
72 /*
73 * The following tables converts the air-interface coding of
74 * the system information parameter MAX_TXPWR_CCCH to a value
75 * in dBm depending on the frequency standard (GSM, DCS or PCS).
76 */
77 const UBYTE pcl_to_dbm_gsm [MAX_PCL] =
78 { 39, /* 0 -> 39 dBm */
79 39, /* 1 -> 39 dBm */
80 39, /* 2 -> 39 dBm */
81 37, /* 3 -> 37 dBm */
82 35, /* 4 -> 35 dBm */
83 33, /* 5 -> 33 dBm */
84 31, /* 6 -> 31 dBm */
85 29, /* 7 -> 29 dBm */
86 27, /* 8 -> 27 dBm */
87 25, /* 9 -> 25 dBm */
88 23, /* 10 -> 23 dBm */
89 21, /* 11 -> 21 dBm */
90 19, /* 12 -> 19 dBm */
91 17, /* 13 -> 17 dBm */
92 15, /* 14 -> 15 dBm */
93 13, /* 15 -> 13 dBm */
94 11, /* 16 -> 11 dBm */
95 9, /* 17 -> 9 dBm */
96 7, /* 18 -> 7 dBm */
97 5, /* 19 -> 5 dBm */
98 5, /* 20 -> 5 dBm */
99 5, /* 21 -> 5 dBm */
100 5, /* 22 -> 5 dBm */
101 5, /* 23 -> 5 dBm */
102 5, /* 24 -> 5 dBm */
103 5, /* 25 -> 5 dBm */
104 5, /* 26 -> 5 dBm */
105 5, /* 27 -> 5 dBm */
106 5, /* 28 -> 5 dBm */
107 5, /* 29 -> 5 dBm */
108 5, /* 30 -> 5 dBm */
109 5 /* 31 -> 5 dBm */
110 };
111
112 const UBYTE pcl_to_dbm_dcs [MAX_PCL] =
113 { 30, /* 0 -> 30 dBm */
114 28, /* 1 -> 28 dBm */
115 26, /* 2 -> 26 dBm */
116 24, /* 3 -> 24 dBm */
117 22, /* 4 -> 22 dBm */
118 20, /* 5 -> 20 dBm */
119 18, /* 6 -> 18 dBm */
120 16, /* 7 -> 16 dBm */
121 14, /* 8 -> 14 dBm */
122 12, /* 9 -> 12 dBm */
123 10, /* 10 -> 10 dBm */
124 8, /* 11 -> 8 dBm */
125 6, /* 12 -> 6 dBm */
126 4, /* 13 -> 4 dBm */
127 2, /* 14 -> 2 dBm */
128 0, /* 15 -> 0 dBm */
129 0, /* 16 -> 0 dBm */
130 0, /* 17 -> 0 dBm */
131 0, /* 18 -> 0 dBm */
132 0, /* 19 -> 0 dBm */
133 0, /* 20 -> 0 dBm */
134 0, /* 21 -> 0 dBm */
135 0, /* 22 -> 0 dBm */
136 0, /* 23 -> 0 dBm */
137 0, /* 24 -> 0 dBm */
138 0, /* 25 -> 0 dBm */
139 0, /* 26 -> 0 dBm */
140 0, /* 27 -> 0 dBm */
141 0, /* 28 -> 0 dBm */
142 36, /* 29 -> 36 dBm */
143 34, /* 30 -> 34 dBm */
144 32 /* 31 -> 32 dBm */
145 };
146
147 const UBYTE pcl_to_dbm_pcs [MAX_PCL] =
148 { 30, /* 0 -> 30 dBm */
149 28, /* 1 -> 28 dBm */
150 26, /* 2 -> 26 dBm */
151 24, /* 3 -> 24 dBm */
152 22, /* 4 -> 22 dBm */
153 20, /* 5 -> 20 dBm */
154 18, /* 6 -> 18 dBm */
155 16, /* 7 -> 16 dBm */
156 14, /* 8 -> 14 dBm */
157 12, /* 9 -> 12 dBm */
158 10, /* 10 -> 10 dBm */
159 8, /* 11 -> 8 dBm */
160 6, /* 12 -> 6 dBm */
161 4, /* 13 -> 4 dBm */
162 2, /* 14 -> 2 dBm */
163 0, /* 15 -> 0 dBm */
164 0, /* 16 -> 0 dBm */
165 0, /* 17 -> 0 dBm */
166 0, /* 18 -> 0 dBm */
167 0, /* 19 -> 0 dBm */
168 0, /* 20 -> 0 dBm */
169 0, /* 21 -> 0 dBm */
170 33, /* 22 -> 33 dBm */
171 33, /* 23 -> 33 dBm */
172 33, /* 24 -> 33 dBm */
173 33, /* 25 -> 33 dBm */
174 33, /* 26 -> 33 dBm */
175 33, /* 27 -> 33 dBm */
176 33, /* 28 -> 33 dBm */
177 33, /* 29 -> 33 dBm */
178 33, /* 30 -> 33 dBm */
179 32 /* 31 -> 32 dBm */
180 };
181
182 /*==== PRIVATE FUNCTIONS ====================================================*/
183
184 /*==== PUBLIC FUNCTIONS =====================================================*/
185 /*
186 +------------------------------------------------------------------------------
187 | Function : tpc_get_ms_pwr_cap
188 +------------------------------------------------------------------------------
189 | Description :
190 |
191 | Parameters :
192 |
193 +------------------------------------------------------------------------------
194 */
195 GLOBAL void tpc_get_ms_pwr_cap ( UBYTE band_indicator,
196 T_MS_PWR_CAP *ms_pwr_cap )
197 {
198 TRACE_FUNCTION( "tpc_get_ms_pwr_cap" );
199
200 switch( band_indicator )
201 {
202 default:
203 case CGRLC_GSM_400:
204 case CGRLC_GSM_850:
205 case CGRLC_GSM_900:
206 ms_pwr_cap->p_control = pcl_to_dbm_gsm;
207 ms_pwr_cap->pwr_min = pcl_to_dbm_gsm[MIN_PCL_GSM900];
208 ms_pwr_cap->gamma_0 = GAMMA_0_GSM900;
209 break;
210
211 case CGRLC_DCS_1800:
212 ms_pwr_cap->p_control = pcl_to_dbm_dcs;
213 ms_pwr_cap->pwr_min = pcl_to_dbm_dcs[MIN_PCL_DCS1800];
214 ms_pwr_cap->gamma_0 = GAMMA_0_DCS1800;
215 break;
216
217 case CGRLC_PCS_1900:
218 ms_pwr_cap->p_control = pcl_to_dbm_pcs;
219 ms_pwr_cap->pwr_min = pcl_to_dbm_pcs[MIN_PCL_PCS1900];
220 ms_pwr_cap->gamma_0 = GAMMA_0_PCS1900;
221 break;
222 }
223
224 } /* tpc_get_ms_pwr_cap() */
225
226 /*
227 +------------------------------------------------------------------------------
228 | Function : tpc_get_pcl
229 +------------------------------------------------------------------------------
230 | Description : This function is used to convert the nominal output power to
231 | the power control level
232 |
233 | Parameters : p_ctrl - pointer to table of power control levels
234 | nop - nominal output power
235 |
236 +------------------------------------------------------------------------------
237 */
238 GLOBAL UBYTE tpc_get_pcl ( UBYTE const *p_ctrl, SHORT nop )
239 {
240 UBYTE pcl = 0; /* power control level */
241
242 TRACE_FUNCTION( "tpc_get_pcl" );
243
244 /* get power control level */
245 while( nop < (SHORT)p_ctrl[pcl] - 1 OR nop >= (SHORT)p_ctrl[pcl] + 1 ) pcl++;
246
247 return( pcl );
248
249 } /* tpc_get_pcl() */
250