FreeCalypso > hg > freecalypso-reveng
view miscprog/osmo2psi.c @ 408:14302e075f37 default tip
hr-bits: further conditionalize SID-1-diff
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 22 Jul 2024 10:06:38 +0000 |
parents | 63c5bb42eca5 |
children |
line wrap: on
line source
/* * 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); }