# HG changeset patch # User Mychaela Falconia # Date 1495864084 0 # Node ID 98abe6bd2042d8f1b81be0ab043b0d6f2855ec6f # Parent 5018fd8eeccee8c9a2c8b2a80db57f82d5b19588 autocal: scw implemented for Rx cal diff -r 5018fd8eecce -r 98abe6bd2042 autocal/Makefile --- a/autocal/Makefile Sat May 27 05:33:42 2017 +0000 +++ b/autocal/Makefile Sat May 27 05:48:04 2017 +0000 @@ -3,8 +3,9 @@ PROGS= fc-rfcal-gmagic fc-rfcal-vcxo INSTBIN=/opt/freecalypso/bin -GMAGIC_OBJS= gmagicmain.o l1tmops.o rvinterf.o rxcommon.o sockopts.o \ - tsidsock.o +GMAGIC_OBJS= gmagicmain.o l1meas.o l1tmops.o rvinterf.o rxcommon.o \ + sockopts.o tsidsock.o + VCXO_OBJS= l1tmops.o rvinterf.o sockopts.o tsidsock.o vcxomain.o vcxomeas.o all: ${PROGS} diff -r 5018fd8eecce -r 98abe6bd2042 autocal/l1meas.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/autocal/l1meas.c Sat May 27 05:48:04 2017 +0000 @@ -0,0 +1,41 @@ +/* + * In this module we are going to implement the functions for making + * measurements on the DUT via L1TM. + */ + +#include +#include +#include +#include +#include +#include +#include + +extern u_char rvi_msg[]; +extern int rvi_msg_len; + +do_scw(index, value) +{ + u_char cmdpkt[7]; + + cmdpkt[1] = STATS_CONFIG_WRITE; + cmdpkt[2] = index; + cmdpkt[3] = index >> 8; + cmdpkt[4] = value; + cmdpkt[5] = value >> 8; + l1tm_pkt_exch(cmdpkt, 5); + if (rvi_msg[3]) { + fprintf(stderr, "DUT error %u in response to scw\n", + rvi_msg[3]); + exit(ERROR_TARGET); + } + if (rvi_msg_len != 6) { + fprintf(stderr, "DUT error: scw response wrong length\n"); + exit(ERROR_TARGET); + } + if (rvi_msg[4] != index) { + fprintf(stderr, "DUT error: scw response wrong index\n"); + exit(ERROR_TARGET); + } + return(0); +} diff -r 5018fd8eecce -r 98abe6bd2042 autocal/rxcaldefs.h --- a/autocal/rxcaldefs.h Sat May 27 05:33:42 2017 +0000 +++ b/autocal/rxcaldefs.h Sat May 27 05:48:04 2017 +0000 @@ -2,3 +2,5 @@ #define RXCAL_SIGGEN_LEVEL 149 /* -74.5 dBm */ #define RXCAL_AGC_DB 34 + +#define RXCAL_LOOP_COUNT 50 diff -r 5018fd8eecce -r 98abe6bd2042 autocal/rxcommon.c --- a/autocal/rxcommon.c Sat May 27 05:33:42 2017 +0000 +++ b/autocal/rxcommon.c Sat May 27 05:48:04 2017 +0000 @@ -5,8 +5,6 @@ #include #include -#include -#include #include #include #include "rxcaldefs.h" @@ -16,6 +14,10 @@ do_rxpw(RX_AGC_ENA_FLAG, 0); do_rxpw(RX_AGC_GAIN, RXCAL_AGC_DB); do_rfpw(AFC_ENA_FLAG, 0); - /* scw settings to be added */ + 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); }