changeset 292:85b38e37810b

AT@SPKR and AT@VPATH ported over to aci3
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 02 Sep 2017 17:05:04 +0000
parents 21d128939204
children 5b2ebc94cae4
files src/g23m-aci/aci/aci_cmh.h src/g23m-aci/aci/ati_audio.c src/g23m-aci/aci/ati_cmd.c
diffstat 3 files changed, 97 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/g23m-aci/aci/aci_cmh.h	Thu Aug 31 06:01:10 2017 +0000
+++ b/src/g23m-aci/aci/aci_cmh.h	Sat Sep 02 17:05:04 2017 +0000
@@ -526,6 +526,7 @@
   AT_CMD_P_BAND,	/* Get RF band */
   /* FreeCalypso additions */
   AT_CMD_AT_SPKR,
+  AT_CMD_AT_VPATH,
   AT_CMD_AT_SND,
   AT_CMD_AT_E1,
   AT_CMD_AT_E2,
--- a/src/g23m-aci/aci/ati_audio.c	Thu Aug 31 06:01:10 2017 +0000
+++ b/src/g23m-aci/aci/ati_audio.c	Sat Sep 02 17:05:04 2017 +0000
@@ -66,6 +66,43 @@
 #include "audio/audio_api.h"
 #include "audio.h"	/* Condat */
 
+#include "fc-target.cfg"
+#include "armio.h"
+
+#ifdef CONFIG_TARGET_FCDEV3B
+/* AT@SPKR - turn loudspeaker amplifier on or off */
+GLOBAL T_ATI_RSLT atAtSPKR ( char *cl, UBYTE srcId )
+{
+	int state;
+
+	TRACE_FUNCTION("atAtSPKR()");
+
+	cl = parse(cl, "D", &state);
+	if (!cl)
+		return (ATI_FAIL);
+	if (state)
+		AI_SetBit(1);
+	else
+		AI_ResetBit(1);
+	return (ATI_CMPL);
+}
+
+GLOBAL T_ATI_RSLT queatAtSPKR (char *cl, UBYTE srcId)
+{
+	char *me="@SPKR: ";
+	int state;
+
+	TRACE_FUNCTION("queatAtSPKR()");
+
+	state = AI_ReadBit(1);
+	sprintf(g_sa, "%s%d", me, state);
+
+	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
+
+	return (ATI_CMPL);
+}
+#endif
+
 /* AT@SND - emit sound through Condat API */
 GLOBAL T_ATI_RSLT atAtSND ( char *cl, UBYTE srcId )
 {
@@ -130,6 +167,53 @@
 	return (ATI_CMPL);
 }
 
+#ifdef CONFIG_TARGET_FCDEV3B
+/* AT@VPATH - configure digital voice path */
+GLOBAL T_ATI_RSLT atAtVPATH ( char *cl, UBYTE srcId )
+{
+	int vpath_int;
+	T_AUDIO_VOICE_PATH_SETTING vpath;
+	T_AUDIO_FULL_ACCESS_WRITE audio_param;
+	T_RV_RETURN return_path;
+
+	TRACE_FUNCTION("atAtVPATH()");
+
+	cl = parse(cl, "D", &vpath_int);
+	if (!cl)
+		return (ATI_FAIL);
+	vpath = vpath_int;
+	audio_param.variable_indentifier = AUDIO_PATH_USED;
+	audio_param.data = &vpath;
+
+	return_path.addr_id        = NULL;
+	return_path.callback_func  = audio_callback;
+	if (audio_full_access_write(&audio_param, return_path) == AUDIO_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
+GLOBAL T_ATI_RSLT queatAtVPATH (char *cl, UBYTE srcId)
+{
+	char *me="@VPATH: ";
+	T_AUDIO_VOICE_PATH_SETTING vpath;
+	T_AUDIO_FULL_ACCESS_READ audio_param;
+
+	TRACE_FUNCTION("queatAtVPATH()");
+
+	audio_param.variable_indentifier = AUDIO_PATH_USED;
+	audio_param.data = &vpath;
+	if (audio_full_access_read(&audio_param) != AUDIO_OK)
+		return (ATI_FAIL);
+
+	sprintf(g_sa, "%s%d", me, vpath);
+
+	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
+
+	return (ATI_CMPL);
+}
+#endif
+
 /* AT@E1 - play an E1 format melody */
 GLOBAL T_ATI_RSLT atAtE1 ( char *cl, UBYTE srcId )
 {
--- a/src/g23m-aci/aci/ati_cmd.c	Thu Aug 31 06:01:10 2017 +0000
+++ b/src/g23m-aci/aci/ati_cmd.c	Sat Sep 02 17:05:04 2017 +0000
@@ -76,6 +76,8 @@
 #include "aci_bat.h"
 #endif
 
+#include "fc-target.cfg"
+
 #define OLD_NON_STANDARDIZED_ATCMD "&ABDEFHILMOPQSTVWXZ"
 
 /*==== EXTERNALS ======================================================*/
@@ -740,6 +742,12 @@
 EXTERN T_ATI_RSLT atAtBAND (CHAR *cl, UBYTE srcId);
 
 /* FreeCalypso additions */
+#ifdef CONFIG_TARGET_FCDEV3B
+EXTERN T_ATI_RSLT atAtSPKR (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT queatAtSPKR (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT atAtVPATH (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT queatAtVPATH (char *cl, UBYTE srcId);
+#endif
 EXTERN T_ATI_RSLT atAtSND (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtE1 (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtE2 (char *cl, UBYTE srcId);
@@ -1191,6 +1199,10 @@
     {"@BAND",     AT_CMD_P_BAND,   atAtBAND,     0,       0,    0},
 #endif
     /* FreeCalypso additions */
+#ifdef CONFIG_TARGET_FCDEV3B
+    {"@SPKR",	AT_CMD_AT_SPKR,  atAtSPKR, test_gen, queatAtSPKR, "%s: (0,1)"},
+    {"@VPATH",	AT_CMD_AT_VPATH, atAtVPATH,test_gen, queatAtVPATH,"%s: (0-2)"},
+#endif
     {"@SND",	AT_CMD_AT_SND,   atAtSND,	0,	0,	0},
     {"@E1",	AT_CMD_AT_E1,    atAtE1,	0,	0,	0},
     {"@E2",	AT_CMD_AT_E2,    atAtE2,	0,	0,	0},