changeset 3:b552e8d86474

fc-cmu200d: started implementing operation modes
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 May 2017 07:01:53 +0000
parents e2db512abbee
children 504d3cbb95b5
files cmu200/Makefile cmu200/mode.c cmu200/mode.h cmu200/session.c
diffstat 4 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cmu200/Makefile	Sun May 21 06:37:56 2017 +0000
+++ b/cmu200/Makefile	Sun May 21 07:01:53 2017 +0000
@@ -3,8 +3,9 @@
 PROGS=	fc-cmu200d fc-serscpi
 INSTBIN=/opt/freecalypso/bin
 
-CMU200D_OBJS=	band.o dispatch.o init.o main.o openport.o sercmd.o session.o \
-		socket.o
+CMU200D_OBJS=	band.o dispatch.o init.o main.o mode.o openport.o sercmd.o \
+		session.o socket.o
+
 SERSCPI_OBJS=	openport.o sertool.o
 
 all:	${PROGS}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmu200/mode.c	Sun May 21 07:01:53 2017 +0000
@@ -0,0 +1,20 @@
+/*
+ * In this module we are going to implement the logic for switching
+ * the CMU200 into different modes as needed for signal generation,
+ * frequency measurement etc.
+ */
+
+#include "mode.h"
+
+int current_mode;
+
+cmu200_session_begin()
+{
+	current_mode = OP_MODE_UNDEF;
+}
+
+stop_signal_gen()
+{
+	if (current_mode == OP_MODE_SIGNAL_GEN)
+		send_scpi_cmd("ABORT:RFG\n");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmu200/mode.h	Sun May 21 07:01:53 2017 +0000
@@ -0,0 +1,5 @@
+/* Definition of our operating modes */
+
+#define	OP_MODE_UNDEF		0
+#define	OP_MODE_SIGNAL_GEN	1
+#define	OP_MODE_VCXO_CAL	2
--- a/cmu200/session.c	Sun May 21 06:37:56 2017 +0000
+++ b/cmu200/session.c	Sun May 21 07:01:53 2017 +0000
@@ -76,6 +76,7 @@
 {
 	int rc;
 
+	cmu200_session_begin();
 	send_socket_response("+CMU200 interface daemon ready\n");
 	for (;;) {
 		rc = handle_command();
@@ -83,4 +84,5 @@
 			break;
 	}
 	close(activesock);
+	stop_signal_gen();
 }