FreeCalypso > hg > fc-magnetite
changeset 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 (2018-01-19) |
parents | 780fa76e9c9b |
children | b3d65ae5f02c |
files | src/cs/layer1/tpu_drivers/source0/tpudrv10.c |
diffstat | 1 files changed, 38 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cs/layer1/tpu_drivers/source0/tpudrv10.c Fri Jan 19 21:07:28 2018 +0000 +++ b/src/cs/layer1/tpu_drivers/source0/tpudrv10.c Fri Jan 19 23:18:23 2018 +0000 @@ -143,19 +143,17 @@ /* EFFECTIVE DOWNLOADING THROUGH TSP */ /**************************************************************************/ /**************************************************************************/ -// rx & tx -typedef struct tx_rx_s -{ - UWORD16 farfcn0; - WORD8 ou; -} -T_TX_RX; struct synth_s { - // common - UWORD16 arfcn0; - UWORD16 limit; - T_TX_RX tx_rx[2]; + // common + UWORD16 arfcn0; + UWORD16 limit; + // Tx + UWORD16 ul_farfcn0; + WORD8 ul_sign; + // Rx + UWORD16 dl_farfcn0; + UWORD8 dl_mult; }; struct magic1_s { @@ -176,8 +174,8 @@ static const struct synth_s synth_900[] = { - { 0, 124, {{ 890, 1}, { 935, 4}}},// gsm 0 - 124 - {974, 1023, {{ 880, 1}, { 925, 4}}},// egsm 975 - 1023 + { 0, 124, 890, 1, 935, 4},// gsm 0 - 124 + {974, 1023, 880, 1, 925, 4},// egsm 975 - 1023 }; static const struct magic1_s magic1_900[] = @@ -201,7 +199,7 @@ static const struct synth_s synth_1800[] = { - {511, 885, {{1710, -1}, {1805, 1}}}, // dcs 512 - 885 + {511, 885, 1710, -1, 1805, 1}, // dcs 512 - 885 }; static const struct magic1_s magic1_1800[] = @@ -220,7 +218,7 @@ static const struct synth_s synth_1900[] = { - {511, 810, {{1850, -1}, {1930, 1}}}, // pcs 512 - 810; + {511, 810, 1850, -1, 1930, 1}, // pcs 512 - 810; }; static const struct magic1_s magic1_1900[] = @@ -235,7 +233,7 @@ static const struct synth_s synth_850[] = { - {127, 251, {{ 824, 1}, { 869, 4}}}, // gsm850 high + {127, 251, 824, 1, 869, 4}, // gsm850 }; static const struct magic1_s magic1_850[] = @@ -274,14 +272,36 @@ #if 0 UWORD32 calc_a_b(UWORD16 arfcn, UWORD8 downlink) { - UWORD32 farfcn; /* in 200 kHz units */ - UWORD32 n; /* B * P + A */ + UWORD32 farfcn; /* sp+0x1C, in 200 kHz units */ struct synth_s *s; + struct magic1_s *m1; + UWORD32 magic1; /* sp+0x24 */ + UWORD16 sp4; + UWORD32 sp0x14, sp0x18, sp0x20; s = rf_path[rf_index].synth; while(s->limit < arfcn) s++; + m1 = rf_path[rf_index].magic1; + while(m1->limit < arfcn) + m1++; + magic1 = m1->magic; + + if (downlink) { + sp0x20 = 0x27627 * s->dl_mult + 8; + farfcn = 5*s->dl_farfcn0 + (arfcn - s->arfcn0); + sp4 = farfcn * s->dl_mult; + sp0x18 = sp4 << 21; + sp0x14 = sp0x20 * farfcn; + } else { + sp0x20 = 0x2762F; + farfcn = 5*s->ul_farfcn0 + (arfcn - s->arfcn0); + sp4 = magic1 * s->ul_sign + farfcn; + sp0x18 = sp4 << 21; + sp0x14 = sp0x20 * (magic1 * s->ul_sign + farfcn); + } + rf_chip_band = s->rf_chip_band; // Convert the ARFCN to the channel frequency (times 5 to avoid the decimal value)