comparison src/cs/layer1/tpu_drivers/source0/tpudrv10.c @ 414:cbc25978be5a

tpudrv10.c: beginning to reconstruct the frequency programming function
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 19 Jan 2018 23:18:23 +0000
parents 780fa76e9c9b
children b3d65ae5f02c
comparison
equal deleted inserted replaced
413:780fa76e9c9b 414:cbc25978be5a
141 /**************************************************************************/ 141 /**************************************************************************/
142 /* INTERNAL FUNCTIONS OF TPUDRV14.C */ 142 /* INTERNAL FUNCTIONS OF TPUDRV14.C */
143 /* EFFECTIVE DOWNLOADING THROUGH TSP */ 143 /* EFFECTIVE DOWNLOADING THROUGH TSP */
144 /**************************************************************************/ 144 /**************************************************************************/
145 /**************************************************************************/ 145 /**************************************************************************/
146 // rx & tx
147 typedef struct tx_rx_s
148 {
149 UWORD16 farfcn0;
150 WORD8 ou;
151 }
152 T_TX_RX;
153 146
154 struct synth_s { 147 struct synth_s {
155 // common 148 // common
156 UWORD16 arfcn0; 149 UWORD16 arfcn0;
157 UWORD16 limit; 150 UWORD16 limit;
158 T_TX_RX tx_rx[2]; 151 // Tx
152 UWORD16 ul_farfcn0;
153 WORD8 ul_sign;
154 // Rx
155 UWORD16 dl_farfcn0;
156 UWORD8 dl_mult;
159 }; 157 };
160 158
161 struct magic1_s { 159 struct magic1_s {
162 UWORD16 limit; 160 UWORD16 limit;
163 UWORD16 magic; 161 UWORD16 magic;
174 struct magic1_s *magic1; 172 struct magic1_s *magic1;
175 }; 173 };
176 174
177 static const struct synth_s synth_900[] = 175 static const struct synth_s synth_900[] =
178 { 176 {
179 { 0, 124, {{ 890, 1}, { 935, 4}}},// gsm 0 - 124 177 { 0, 124, 890, 1, 935, 4},// gsm 0 - 124
180 {974, 1023, {{ 880, 1}, { 925, 4}}},// egsm 975 - 1023 178 {974, 1023, 880, 1, 925, 4},// egsm 975 - 1023
181 }; 179 };
182 180
183 static const struct magic1_s magic1_900[] = 181 static const struct magic1_s magic1_900[] =
184 { 182 {
185 { 26, 0x0820}, 183 { 26, 0x0820},
199 {1023, 0x0820}, 197 {1023, 0x0820},
200 }; 198 };
201 199
202 static const struct synth_s synth_1800[] = 200 static const struct synth_s synth_1800[] =
203 { 201 {
204 {511, 885, {{1710, -1}, {1805, 1}}}, // dcs 512 - 885 202 {511, 885, 1710, -1, 1805, 1}, // dcs 512 - 885
205 }; 203 };
206 204
207 static const struct magic1_s magic1_1800[] = 205 static const struct magic1_s magic1_1800[] =
208 { 206 {
209 {571, 0x0820}, 207 {571, 0x0820},
218 {885, 0x082D}, 216 {885, 0x082D},
219 }; 217 };
220 218
221 static const struct synth_s synth_1900[] = 219 static const struct synth_s synth_1900[] =
222 { 220 {
223 {511, 810, {{1850, -1}, {1930, 1}}}, // pcs 512 - 810; 221 {511, 810, 1850, -1, 1930, 1}, // pcs 512 - 810;
224 }; 222 };
225 223
226 static const struct magic1_s magic1_1900[] = 224 static const struct magic1_s magic1_1900[] =
227 { 225 {
228 {550, 0x0847}, 226 {550, 0x0847},
233 {810, 0x0861}, 231 {810, 0x0861},
234 }; 232 };
235 233
236 static const struct synth_s synth_850[] = 234 static const struct synth_s synth_850[] =
237 { 235 {
238 {127, 251, {{ 824, 1}, { 869, 4}}}, // gsm850 high 236 {127, 251, 824, 1, 869, 4}, // gsm850
239 }; 237 };
240 238
241 static const struct magic1_s magic1_850[] = 239 static const struct magic1_s magic1_850[] =
242 { 240 {
243 {251, 0x0924}, 241 {251, 0x0924},
272 */ 270 */
273 271
274 #if 0 272 #if 0
275 UWORD32 calc_a_b(UWORD16 arfcn, UWORD8 downlink) 273 UWORD32 calc_a_b(UWORD16 arfcn, UWORD8 downlink)
276 { 274 {
277 UWORD32 farfcn; /* in 200 kHz units */ 275 UWORD32 farfcn; /* sp+0x1C, in 200 kHz units */
278 UWORD32 n; /* B * P + A */
279 struct synth_s *s; 276 struct synth_s *s;
277 struct magic1_s *m1;
278 UWORD32 magic1; /* sp+0x24 */
279 UWORD16 sp4;
280 UWORD32 sp0x14, sp0x18, sp0x20;
280 281
281 s = rf_path[rf_index].synth; 282 s = rf_path[rf_index].synth;
282 while(s->limit < arfcn) 283 while(s->limit < arfcn)
283 s++; 284 s++;
285
286 m1 = rf_path[rf_index].magic1;
287 while(m1->limit < arfcn)
288 m1++;
289 magic1 = m1->magic;
290
291 if (downlink) {
292 sp0x20 = 0x27627 * s->dl_mult + 8;
293 farfcn = 5*s->dl_farfcn0 + (arfcn - s->arfcn0);
294 sp4 = farfcn * s->dl_mult;
295 sp0x18 = sp4 << 21;
296 sp0x14 = sp0x20 * farfcn;
297 } else {
298 sp0x20 = 0x2762F;
299 farfcn = 5*s->ul_farfcn0 + (arfcn - s->arfcn0);
300 sp4 = magic1 * s->ul_sign + farfcn;
301 sp0x18 = sp4 << 21;
302 sp0x14 = sp0x20 * (magic1 * s->ul_sign + farfcn);
303 }
284 304
285 rf_chip_band = s->rf_chip_band; 305 rf_chip_band = s->rf_chip_band;
286 306
287 // Convert the ARFCN to the channel frequency (times 5 to avoid the decimal value) 307 // Convert the ARFCN to the channel frequency (times 5 to avoid the decimal value)
288 farfcn = 5*s->tx_rx[downlink].farfcn0 + (arfcn - s->arfcn0); 308 farfcn = 5*s->tx_rx[downlink].farfcn0 + (arfcn - s->arfcn0);