changeset 1014:0511507bf6e7

fc-shell: tch-dl control command implemented
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 20 Mar 2016 22:52:25 +0000
parents 6eee1e547778
children 9ced8e13cf91
files rvinterf/asyncshell/Makefile rvinterf/asyncshell/oneshot.c rvinterf/asyncshell/tchcmd.c rvinterf/asyncshell/usercmd.c rvinterf/include/tch_feature.h
diffstat 5 files changed, 79 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/asyncshell/Makefile	Sun Mar 20 22:27:07 2016 +0000
+++ b/rvinterf/asyncshell/Makefile	Sun Mar 20 22:52:25 2016 +0000
@@ -2,7 +2,7 @@
 CFLAGS=	-O2 -I../include
 PROG=	fc-shell
 OBJS=	at.o init.o main.o oneshot.o parse.o pktsort.o poweroff.o rxctl.o \
-	sendarb.o sendsp.o usercmd.o
+	sendarb.o sendsp.o tchcmd.o usercmd.o
 LIBS=	../libasync/libasync.a ../libg23/libg23.a
 INSTBIN=/usr/local/bin
 
--- a/rvinterf/asyncshell/oneshot.c	Sun Mar 20 22:27:07 2016 +0000
+++ b/rvinterf/asyncshell/oneshot.c	Sun Mar 20 22:52:25 2016 +0000
@@ -11,6 +11,7 @@
 extern int cmd_poweroff();
 extern int cmd_send_oneshot();
 extern int cmd_sp_oneshot();
+extern int cmd_tchdl_oneshot();
 extern int cmd_tgtreset();
 
 static struct cmdtab {
@@ -22,6 +23,7 @@
 	{"poweroff", 0, 0, cmd_poweroff},
 	{"send", 1, MAX_PKT_TO_TARGET, cmd_send_oneshot},
 	{"sp", 2, 2, cmd_sp_oneshot},
+	{"tch-dl", 1, 1, cmd_tchdl_oneshot},
 	{"tgtreset", 0, 0, cmd_tgtreset},
 	{0, 0, 0, 0}
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rvinterf/asyncshell/tchcmd.c	Sun Mar 20 22:52:25 2016 +0000
@@ -0,0 +1,62 @@
+/*
+ * Commands for manipulating the experimental TCH rerouting feature
+ * of FreeCalypso GSM firmware
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <stdlib.h>
+#include "pktmux.h"
+#include "tch_feature.h"
+
+send_tch_config_req(config)
+{
+	u_char sendpkt[3];
+
+	sendpkt[0] = RVT_TCH_HEADER;
+	sendpkt[1] = TCH_CONFIG_REQ;
+	sendpkt[2] = config;
+	/* send it! */
+	send_pkt_to_target(sendpkt, 3);
+	return(0);
+}
+
+cmd_tchdl_common(argc, argv)
+	char **argv;
+{
+	int config;
+
+	if (!strcmp(argv[1], "enable") || !strcmp(argv[1], "on") ||
+	    !strcmp(argv[1], "1"))
+		config = 1;
+	else if (!strcmp(argv[1], "disable") || !strcmp(argv[1], "off") ||
+		 !strcmp(argv[1], "0"))
+		config = 0;
+	else {
+		printf("error: boolean argument required\n");
+		return(1);
+	}
+	return send_tch_config_req(config);
+}
+
+void
+cmd_tchdl_interactive(argstr)
+	char *argstr;
+{
+	char *argv[2];
+	int argc, rc;
+
+	rc = parse_interactive_command_into_argv(argstr, argv, 1, 1, &argc);
+	if (rc < 0)
+		return;
+	tch_rx_control(1);
+	cmd_tchdl_common(argc, argv);
+}
+
+cmd_tchdl_oneshot(argc, argv)
+	char **argv;
+{
+	return cmd_tchdl_common(argc - 1, argv + 1);
+}
--- a/rvinterf/asyncshell/usercmd.c	Sun Mar 20 22:27:07 2016 +0000
+++ b/rvinterf/asyncshell/usercmd.c	Sun Mar 20 22:52:25 2016 +0000
@@ -17,6 +17,7 @@
 extern void cmd_sendat();
 extern void cmd_send_interactive();
 extern void cmd_sp_interactive();
+extern void cmd_tchdl_interactive();
 extern void cmd_tgtreset();
 
 void
@@ -38,6 +39,7 @@
 	{"send", cmd_send_interactive},
 	{"sp", cmd_sp_interactive},
 	{"str", cmd_sendat},
+	{"tch-dl", cmd_tchdl_interactive},
 	{"tgtreset", cmd_tgtreset},
 	{0, 0}
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rvinterf/include/tch_feature.h	Sun Mar 20 22:52:25 2016 +0000
@@ -0,0 +1,12 @@
+/*
+ * This header file contains definitions for the
+ * custom voice TCH rerouting feature that
+ * has been implemented as an experiment in the
+ * FreeCalypso GSM firmware.
+ */
+
+#define	TCH_CONFIG_REQ	0x11
+#define	TCH_CONFIG_CONF	0x12
+#define	TCH_ULBITS_REQ	0x13
+#define	TCH_ULBITS_CONF	0x14
+#define	TCH_DLBITS_IND	0x15