FreeCalypso > hg > fc-magnetite
changeset 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 | 706f4b71aceb |
files | src/cs/layer1/tpu_drivers/source0/tpudrv10.c |
diffstat | 1 files changed, 9 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cs/layer1/tpu_drivers/source0/tpudrv10.c Sat Jan 20 00:03:02 2018 +0000 +++ b/src/cs/layer1/tpu_drivers/source0/tpudrv10.c Sat Jan 20 00:37:48 2018 +0000 @@ -306,23 +306,15 @@ synth_900, magic1_900, magic2_rx900}, }; -/* - * Leonardo tpudrv12.obj contains a function named calc_a_b(); there is - * no such function in the LoCosto version, but there is a similar-looking - * calc_rf_freq() function instead. Let's try making our calc_a_b() - * from LoCosto's calc_rf_freq(). - */ - -#if 0 -UWORD32 calc_a_b(UWORD16 arfcn, UWORD8 downlink) +static UWORD32 calc_freq_prog(UWORD16 arfcn, UWORD8 downlink) { UWORD32 farfcn; /* sp+0x1C, in 200 kHz units */ - struct synth_s *s; - struct magic1_s *m1; - struct magic2_s *m2; + const struct synth_s *s; + const struct magic1_s *m1; + const struct magic2_s *m2; UWORD32 magic1; /* sp+0x24 */ UWORD16 sp4; - UWORD32 sp0x14, sp0x18, sp0x20; + UWORD32 sp8, sp0xC, sp0x10, sp0x14, sp0x18, sp0x20; s = rf_path[rf_index].synth; while(s->limit < arfcn) @@ -353,16 +345,12 @@ m2++; magic2_byte = (m2->magic & 7) << 5; - rf_chip_band = s->rf_chip_band; + sp8 = (sp0x14 / 16) >> 21; + sp0xC = sp0x14 - (sp8 << 25); + sp0x10 = (((sp8 << 4) + sp0xC) * 0x1A00000 - 0x18) >> 21; - // Convert the ARFCN to the channel frequency (times 5 to avoid the decimal value) - farfcn = 5*s->tx_rx[downlink].farfcn0 + (arfcn - s->arfcn0); - n = farfcn * s->tx_rx[downlink].ou; - - /* magic A & B encoding for Rita */ - return((n - 4096) << 3); + return ((sp0xC & 0xF) << 12) | ((sp8 & 0x7F) << 16) | ((sp0x10 & 0xF) << 8); } -#endif /*------------------------------------------*/ /* Convert_l1_radio_freq */