changeset 159:8fac4aaec230

fc-tmsh: beginning of intelligent ETM_AUDIO response handling
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 17 Mar 2017 07:34:29 +0000
parents 86e4d8aea021
children e4c98a2c1673
files rvinterf/tmsh/Makefile rvinterf/tmsh/audioresp.c rvinterf/tmsh/etmbasic.c
diffstat 3 files changed, 68 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/tmsh/Makefile	Fri Mar 17 06:46:42 2017 +0000
+++ b/rvinterf/tmsh/Makefile	Fri Mar 17 07:34:29 2017 +0000
@@ -1,9 +1,9 @@
 CC=	gcc
 CFLAGS=	-O2 -I../include
 PROG=	fc-tmsh
-OBJS=	abb.o abbtm3.o audiocmd.o etmbasic.o ffs2.o ffs2resp.o init.o l1cmd.o \
-	l1resp.o main.o misc.o omr.o omw.o oneshot.o pktsort.o rftablechk.o \
-	rftablerd.o rftablewr.o saverftab.o tmcore.o usercmd.o
+OBJS=	abb.o abbtm3.o audiocmd.o audioresp.o etmbasic.o ffs2.o ffs2resp.o \
+	init.o l1cmd.o l1resp.o main.o misc.o omr.o omw.o oneshot.o pktsort.o \
+	rftablechk.o rftablerd.o rftablewr.o saverftab.o tmcore.o usercmd.o
 LIBS=	../libasync/libasync.a
 INSTBIN=/opt/freecalypso/bin
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rvinterf/tmsh/audioresp.c	Fri Mar 17 07:34:29 2017 +0000
@@ -0,0 +1,62 @@
+/*
+ * In this module we are going to implement the handling of ETM_AUDIO responses.
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <stdlib.h>
+#include "pktmux.h"
+#include "limits.h"
+#include "localtypes.h"
+#include "etm.h"
+
+extern u_char rvi_msg[];
+extern int rvi_msg_len;
+
+static void
+aul_response()
+{
+	print_etm_pkt_raw("aul response");
+}
+
+static void
+aus_response()
+{
+	print_etm_pkt_raw("aus response");
+}
+
+static void
+aur_response()
+{
+	print_etm_pkt_raw("aur response");
+}
+
+static void
+auw_response()
+{
+	print_etm_pkt_raw("auw response");
+}
+
+void
+etm_audio_msg_rx()
+{
+	switch (rvi_msg[4]) {
+	case 'L':
+		aul_response();
+		return;
+	case 'S':
+		aus_response();
+		return;
+	case 'R':
+		aur_response();
+		return;
+	case 'W':
+		auw_response();
+		return;
+	default:
+	unknown:
+		print_etm_pkt_raw("ETM_AUDIO");
+	}
+}
--- a/rvinterf/tmsh/etmbasic.c	Fri Mar 17 06:46:42 2017 +0000
+++ b/rvinterf/tmsh/etmbasic.c	Fri Mar 17 07:34:29 2017 +0000
@@ -63,7 +63,9 @@
 		handle_ffs2_response();
 		return;
 	case ETM_AUDIO:
-		print_etm_pkt_raw("ETM_AUDIO");
+		if (rvi_msg_len < 6)
+			goto runt;
+		etm_audio_msg_rx();
 		return;
 	/* TM3 */
 	case MEM_READ: