FreeCalypso > hg > fc-rfcal-tools
changeset 49:1a0dbc746d57
autocal: Rx cal main engine implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 27 May 2017 07:23:20 +0000 |
parents | 201f27bd8dca |
children | d309241fcae3 |
files | autocal/l1meas.c autocal/rxcommon.c |
diffstat | 2 files changed, 39 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/autocal/l1meas.c Sat May 27 07:03:08 2017 +0000 +++ b/autocal/l1meas.c Sat May 27 07:23:20 2017 +0000 @@ -174,3 +174,15 @@ } return(0); } + +collect_rfe_completion() +{ + collect_extra_pkt_from_target(); + l1tm_resp_sanity_check(RF_ENABLE); + if (rvi_msg[3] != 1) { + fprintf(stderr, "DUT error %u in rfe completion message\n", + rvi_msg[3]); + exit(ERROR_TARGET); + } + return(0); +}
--- a/autocal/rxcommon.c Sat May 27 07:03:08 2017 +0000 +++ b/autocal/rxcommon.c Sat May 27 07:23:20 2017 +0000 @@ -5,8 +5,10 @@ #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include <rvinterf/l1tm.h> #include <rvinterf/exitcodes.h> +#include "l1stats.h" #include "rxcaldefs.h" l1tm_setup_for_rxcal() @@ -38,17 +40,41 @@ return(0); } +static unsigned rx_single_offset_meas(arfcn, offset) unsigned arfcn; char *offset; { char dbm[64], tsid_cmd[128]; + struct l1stats l1st; + unsigned pm; halfdb_to_string(RXCAL_SIGGEN_LEVEL, dbm); printf("Rx meas at ARFCN %u offset %s kHz, TL=%s dBm, AGC=%d dB\n", arfcn, offset, dbm, RXCAL_AGC_DB); sprintf(tsid_cmd, "signal-gen-sine %u %s %s\n", arfcn, offset, dbm); tsid_command(tsid_cmd); - + usleep(20000); + do_rfe(RX_TCH); + collect_auto_stats(&l1st); + collect_rfe_completion(); + if (!(l1st.bitmask & DSP_PM)) { + fprintf(stderr, "DUT error: no DSP_PM in auto-stats msg\n"); + exit(ERROR_TARGET); + } + pm = l1st.dsp_pm; + printf("DSP_PM=0x%04X, %u half-dBm\n", pm, (pm + 16) >> 5); + return(pm); +} +unsigned +rx_measure(arfcn) + unsigned arfcn; +{ + unsigned pm1, pm2; + + do_rfpw(TCH_ARFCN, arfcn); + pm1 = rx_single_offset_meas(arfcn, "+67"); + pm2 = rx_single_offset_meas(arfcn, "-67"); + return (pm1 + pm2 + 32) >> 6; }