comparison src/cs/layer1/tpu_drivers/source0/tpudrv10.c @ 416:5ca341a26dda

tpudrv10.c: frequency programming function reconstructed
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 20 Jan 2018 00:37:48 +0000
parents b3d65ae5f02c
children f8e74b692c80
comparison
equal deleted inserted replaced
415:b3d65ae5f02c 416:5ca341a26dda
304 /* non-E GSM */ 304 /* non-E GSM */
305 { BAND_SELECT_GSM, RU_900, RD_900, TU_900, TD_900, TU_REV_900, 305 { BAND_SELECT_GSM, RU_900, RD_900, TU_900, TD_900, TU_REV_900,
306 synth_900, magic1_900, magic2_rx900}, 306 synth_900, magic1_900, magic2_rx900},
307 }; 307 };
308 308
309 /* 309 static UWORD32 calc_freq_prog(UWORD16 arfcn, UWORD8 downlink)
310 * Leonardo tpudrv12.obj contains a function named calc_a_b(); there is
311 * no such function in the LoCosto version, but there is a similar-looking
312 * calc_rf_freq() function instead. Let's try making our calc_a_b()
313 * from LoCosto's calc_rf_freq().
314 */
315
316 #if 0
317 UWORD32 calc_a_b(UWORD16 arfcn, UWORD8 downlink)
318 { 310 {
319 UWORD32 farfcn; /* sp+0x1C, in 200 kHz units */ 311 UWORD32 farfcn; /* sp+0x1C, in 200 kHz units */
320 struct synth_s *s; 312 const struct synth_s *s;
321 struct magic1_s *m1; 313 const struct magic1_s *m1;
322 struct magic2_s *m2; 314 const struct magic2_s *m2;
323 UWORD32 magic1; /* sp+0x24 */ 315 UWORD32 magic1; /* sp+0x24 */
324 UWORD16 sp4; 316 UWORD16 sp4;
325 UWORD32 sp0x14, sp0x18, sp0x20; 317 UWORD32 sp8, sp0xC, sp0x10, sp0x14, sp0x18, sp0x20;
326 318
327 s = rf_path[rf_index].synth; 319 s = rf_path[rf_index].synth;
328 while(s->limit < arfcn) 320 while(s->limit < arfcn)
329 s++; 321 s++;
330 322
351 343
352 while(m2->limit < sp4) 344 while(m2->limit < sp4)
353 m2++; 345 m2++;
354 magic2_byte = (m2->magic & 7) << 5; 346 magic2_byte = (m2->magic & 7) << 5;
355 347
356 rf_chip_band = s->rf_chip_band; 348 sp8 = (sp0x14 / 16) >> 21;
357 349 sp0xC = sp0x14 - (sp8 << 25);
358 // Convert the ARFCN to the channel frequency (times 5 to avoid the decimal value) 350 sp0x10 = (((sp8 << 4) + sp0xC) * 0x1A00000 - 0x18) >> 21;
359 farfcn = 5*s->tx_rx[downlink].farfcn0 + (arfcn - s->arfcn0); 351
360 n = farfcn * s->tx_rx[downlink].ou; 352 return ((sp0xC & 0xF) << 12) | ((sp8 & 0x7F) << 16) | ((sp0x10 & 0xF) << 8);
361 353 }
362 /* magic A & B encoding for Rita */
363 return((n - 4096) << 3);
364 }
365 #endif
366 354
367 /*------------------------------------------*/ 355 /*------------------------------------------*/
368 /* Convert_l1_radio_freq */ 356 /* Convert_l1_radio_freq */
369 /*------------------------------------------*/ 357 /*------------------------------------------*/
370 /* conversion of l1 radio_freq to */ 358 /* conversion of l1 radio_freq to */