changeset 7:948031e6de50

fc-cmu200d: vcxo-cal-setup implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 May 2017 08:03:35 +0000
parents d8cbc7a383eb
children c873a36a16e6
files cmu200/Makefile cmu200/dispatch.c cmu200/vcxocal.c
diffstat 3 files changed, 51 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cmu200/Makefile	Sun May 21 07:52:11 2017 +0000
+++ b/cmu200/Makefile	Sun May 21 08:03:35 2017 +0000
@@ -4,7 +4,7 @@
 INSTBIN=/opt/freecalypso/bin
 
 CMU200D_OBJS=	band.o dispatch.o init.o main.o mode.o openport.o sercmd.o \
-		session.o signalgen.o socket.o
+		session.o signalgen.o socket.o vcxocal.o
 
 SERSCPI_OBJS=	openport.o sertool.o
 
--- a/cmu200/dispatch.c	Sun May 21 07:52:11 2017 +0000
+++ b/cmu200/dispatch.c	Sun May 21 08:03:35 2017 +0000
@@ -13,6 +13,7 @@
 extern int cmd_signal_gen_off();
 extern int cmd_signal_gen_sine();
 extern int cmd_signal_gen_setup();
+extern int cmd_vcxo_cal_setup();
 
 cmd_ping()
 {
@@ -28,6 +29,7 @@
 	{"signal-gen-off", cmd_signal_gen_off},
 	{"signal-gen-sine", cmd_signal_gen_sine},
 	{"signal-gen-setup", cmd_signal_gen_setup},
+	{"vcxo-cal-setup", cmd_vcxo_cal_setup},
 	{0, 0}
 };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmu200/vcxocal.c	Sun May 21 08:03:35 2017 +0000
@@ -0,0 +1,48 @@
+/*
+ * This module implements the VCXO calibration support functionality.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include "mode.h"
+#include "band.h"
+
+extern char *client_cmd_fields[];
+extern int client_cmd_nfields;
+
+extern int current_mode;
+extern struct band *current_band;
+
+cmd_vcxo_cal_setup()
+{
+	int rc;
+	unsigned arfcn;
+	char cmdstr[32];
+
+	if (client_cmd_nfields != 3) {
+		send_socket_response("-Wrong number of arguments\n");
+		return(0);
+	}
+	stop_signal_gen();
+	current_mode = OP_MODE_UNDEF;
+	rc = find_named_band(client_cmd_fields[1]);
+	if (rc < 0) {
+		send_socket_response("-Invalid band argument\n");
+		return(0);
+	}
+	arfcn = atoi(client_cmd_fields[2]);
+	if (verify_arfcn(arfcn, 0, 0) < 0) {
+		send_socket_response("-Invalid ARFCN\n");
+		return(0);
+	}
+	sprintf(cmdstr, "*SEC %d\n", current_band->secaddr);
+	send_scpi_cmd(cmdstr);
+	sprintf(cmdstr, "RFAN:CHAN %uCH\n", arfcn);
+	send_scpi_cmd(cmdstr);
+	send_scpi_cmd("RFAN:TSEQ GSM5\n");
+	current_mode = OP_MODE_VCXO_CAL;
+	send_socket_response("+OK\n");
+	return(0);
+}