FreeCalypso > hg > freecalypso-reveng
changeset 222:63c5bb42eca5
osmo2psi test program written
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 23 Nov 2017 22:24:18 +0000 |
parents | 9f2e0c34fe33 |
children | e226ead8d24b |
files | .hgignore miscprog/Makefile miscprog/osmo2psi.c |
diffstat | 3 files changed, 37 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Fri Nov 17 19:58:07 2017 +0000 +++ b/.hgignore Thu Nov 23 22:24:18 2017 +0000 @@ -34,6 +34,7 @@ ^miscprog/imeibrute$ ^miscprog/memwrite-grep$ ^miscprog/mokosrec2bin$ +^miscprog/osmo2psi$ ^miscprog/pircalextr$ ^miscprog/pircksum$ ^miscprog/pircksum2$
--- a/miscprog/Makefile Fri Nov 17 19:58:07 2017 +0000 +++ b/miscprog/Makefile Thu Nov 23 22:24:18 2017 +0000 @@ -1,7 +1,7 @@ CC= gcc CFLAGS= -O2 STD= atsc calextract factdiff ftmdump grokdsn memwrite-grep mokosrec2bin \ - pircalextr pircksum pircksum2 rfcap-grep + osmo2psi pircalextr pircksum pircksum2 rfcap-grep CRYPTO= imeibrute pirimei PROGS= ${STD} ${CRYPTO} @@ -21,6 +21,7 @@ imeibrute: imeibrute.c memwrite-grep: memwrite-grep.c mokosrec2bin: mokosrec2bin.c +osmo2psi: osmo2psi.c pircalextr: pircalextr.c pircksum: pircksum.c pircksum2: pircksum2.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/miscprog/osmo2psi.c Thu Nov 23 22:24:18 2017 +0000 @@ -0,0 +1,34 @@ +/* + * This test program seeks to help figure out the mapping between OsmocomBB's + * AFC_SLOPE constant and the Psi constants used by TI's AFC implementation, + * as our fc-rfcal-vcxo tool would compute them from CMU200 measurements. + */ + +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +main(argc, argv) + char **argv; +{ + int afc_slope; + float lin_a; + float Psi_sta, Psi_st; + + if (argc != 2) { + fprintf(stderr, "usage: %s osmo-afc-slope\n", argv[0]); + exit(1); + } + afc_slope = atoi(argv[1]); + lin_a = (float)afc_slope / 32768.0f * 898.0f; + + /* Psi computations */ + Psi_sta = 2.0f * (float)M_PI * lin_a / 270833.0f; + Psi_st = Psi_sta * 0.8f; + + printf("Psi_sta_inv = %u\n", (unsigned)(1.0f / Psi_sta)); + printf("Psi_st = %u\n", (unsigned)(Psi_st * 65536.0f)); + printf("Psi_st_32 = %u\n", (unsigned)(Psi_st * 65536.0f * 65536.0f)); + printf("Psi_st_inv = %u\n", (unsigned)(1.0f / Psi_st)); + exit(0); +}