FreeCalypso > hg > fc-rfcal-tools
view autocal/rxcommon.c @ 47:e86779d5445c
autocal: preparations for receiving auto stats and rfe completion
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 27 May 2017 06:46:17 +0000 |
parents | 751f8d9efed0 |
children | 1a0dbc746d57 |
line wrap: on
line source
/* * This module contains the common code for * fc-rfcal-gmagic and fc-rfcal-rxband. */ #include <stdio.h> #include <stdlib.h> #include <rvinterf/l1tm.h> #include <rvinterf/exitcodes.h> #include "rxcaldefs.h" l1tm_setup_for_rxcal() { do_rxpw(RX_AGC_ENA_FLAG, 0); do_rxpw(RX_AGC_GAIN, RXCAL_AGC_DB); do_rfpw(AFC_ENA_FLAG, 0); do_scw(LOOPS, RXCAL_LOOP_COUNT); do_scw(AUTO_RESULT_LOOPS, RXCAL_LOOP_COUNT); do_scw(AUTO_RESET_LOOPS, RXCAL_LOOP_COUNT); do_scw(STAT_TYPE, ACCUMULATED_RX_STATS); do_scw(STAT_BITMASK, DSP_PM); return(0); } halfdb_to_string(halfdb, strbuf) int halfdb; char *strbuf; { int sign; if (halfdb < 0) { sign = 1; halfdb = -halfdb; } else sign = 0; sprintf(strbuf, "%s%d.%c", sign ? "-" : "", halfdb >> 1, halfdb & 1 ? '5' : '0'); return(0); } rx_single_offset_meas(arfcn, offset) unsigned arfcn; char *offset; { char dbm[64], tsid_cmd[128]; 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); }