FreeCalypso > hg > fc-rfcal-tools
changeset 4:504d3cbb95b5
fc-cmu200d: signal-gen-setup implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 May 2017 07:21:17 +0000 |
parents | b552e8d86474 |
children | 493987a4527e |
files | cmu200/Makefile cmu200/dispatch.c cmu200/signalgen.c |
diffstat | 3 files changed, 42 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/cmu200/Makefile Sun May 21 07:01:53 2017 +0000 +++ b/cmu200/Makefile Sun May 21 07:21:17 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 socket.o + session.o signalgen.o socket.o SERSCPI_OBJS= openport.o sertool.o
--- a/cmu200/dispatch.c Sun May 21 07:01:53 2017 +0000 +++ b/cmu200/dispatch.c Sun May 21 07:21:17 2017 +0000 @@ -10,6 +10,8 @@ extern char *client_cmd_fields[]; extern int client_cmd_nfields; +extern int cmd_signal_gen_setup(); + cmd_ping() { send_socket_response("+Pong\n"); @@ -21,6 +23,7 @@ int (*handler)(); } cmdtab[] = { {"ping", cmd_ping}, + {"signal-gen-setup", cmd_signal_gen_setup}, {0, 0} };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmu200/signalgen.c Sun May 21 07:21:17 2017 +0000 @@ -0,0 +1,38 @@ +/* + * This module implements the signal generator functionality. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include "mode.h" +#include "secaddr.h" + +extern char *client_cmd_fields[]; +extern int client_cmd_nfields; + +extern int current_mode; + +cmd_signal_gen_setup() +{ + int rc; + char cmdstr[32]; + + if (client_cmd_nfields != 2) { + 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); + } + sprintf(cmdstr, "*SEC %d\n", SECADDR_RF_NSIG); + send_scpi_cmd(cmdstr); + current_mode = OP_MODE_SIGNAL_GEN; + send_socket_response("+OK\n"); + return(0); +}