diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-12-11 05:23:58 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-12-11 05:23:58 +0100 |
commit | b6156d3e3d0c20fd5be7acffcee25f4bc90613bc (patch) | |
tree | 32201f7d7ccf2c25ba16e45be69933a7dc0f30ec /src/host/rita_pll/mtk_pll.pl | |
parent | 155cbeab1dcf82f6779c10320ce0eafad3f15780 (diff) |
add perl scripts to compute MTK RF Transceiver PLL settings
Diffstat (limited to 'src/host/rita_pll/mtk_pll.pl')
-rwxr-xr-x | src/host/rita_pll/mtk_pll.pl | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/host/rita_pll/mtk_pll.pl b/src/host/rita_pll/mtk_pll.pl new file mode 100755 index 00000000..ff931c5c --- /dev/null +++ b/src/host/rita_pll/mtk_pll.pl @@ -0,0 +1,79 @@ +#!/usr/bin/perl + +# Rx Mode and Tx Mode: +# N = Nint + (Nfrac / 130) = (0.5*Fvco) / 26M +# where 0 <= Nfrac < 130 +# where 0 <= Ninit <= 127 (as Nint is 7 bit) +# where Fvco = 4 * Fch (GSM 850/900), Fvco = 2 * Fch (GSM 1800/1900) + +# (Nint + (Nfrac / 130)) * 52 MHz = Fvco + +sub mtk_fvco($$) { + my ($nint, $nfrac) = @_; + return ($nint + ($nfrac / 130)) * (26 * 2) +} + +sub hr() { + printf("======================================================================\n"); +} + +sub vco_print($$$) +{ + my ($nint, $nfrac, $hiband) = @_; + my $fvco = mtk_fvco($nint, $nfrac); + my $mult; + + if ($hiband == 1) { + $mult = 2; + } else { + $mult = 4; + } + + printf("Fch=%4.2f (Fvco=%4.2f, Nint=%03u, Nfrac=%03u)\n", + $fvco/$mult, $fvco, $nint, $nfrac); +} + +#for (my $nint = 0; $nint <= 127; $nint++) { +# for (my $nfrac = 0; $nfrac <= 130; $nfrac++) { +# vco_print($nint, $nfrac); +# } +#} + +printf("PLL Rx Low Band:\n"); +for (my $nint = 68; $nint <= 73; $nint++) { +#for GSM 810 +#for (my $b = 132; $b <= 150; $b++) { + for (my $nfrac = 0; $nfrac <= 130; $nfrac++) { + vco_print($nint, $nfrac, 0); + } +} + +hr(); +printf("PLL Rx High Band:\n"); +for (my $nint = 69; $nint <= 79; $nint++) { + for (my $nfrac = 0; $nfrac <= 130; $nfrac++) { + vco_print($nint, $nfrac, 1); + } +} + +hr(); +printf("PLL Tx Low Band:\n"); +for (my $nint = 63; $nint <= 70; $nint++) { + for (my $nfrac = 0; $nfrac <= 130; $nfrac++) { + vco_print($nint, $nfrac, 0); + } +} + + +hr(); +printf("PLL Tx High Band\n"); +for (my $nint = 65; $nint <= 73; $nint++) { + for (my $nfrac = 0; $nfrac <= 130; $nfrac++) { + vco_print($nint, $nfrac, 1); + } +} + + + +exit(0); + |