changeset 239:e0b9c21d7908

AT@TONE and AT@TSTOP audio test commands implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 22 Mar 2017 04:51:29 +0000
parents 828a6898241e
children 9034c3a7267e
files src/aci2/aci/aci_cmh.h src/aci2/aci/ati_audio.c src/aci2/aci/ati_cmd.c
diffstat 3 files changed, 54 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/aci2/aci/aci_cmh.h	Mon Mar 20 04:00:10 2017 +0000
+++ b/src/aci2/aci/aci_cmh.h	Wed Mar 22 04:51:29 2017 +0000
@@ -483,6 +483,8 @@
   AT_CMD_AT_E1,
   AT_CMD_AT_E2,
   AT_CMD_AT_E2LSI,
+  AT_CMD_AT_TONE,
+  AT_CMD_AT_TSTOP,
   /* terminator */
   AT_CMD_MAX                  /* maximum command id */
 } T_ACI_AT_CMD;
--- a/src/aci2/aci/ati_audio.c	Mon Mar 20 04:00:10 2017 +0000
+++ b/src/aci2/aci/ati_audio.c	Wed Mar 22 04:51:29 2017 +0000
@@ -139,4 +139,52 @@
 		return (ATI_FAIL);
 }
 
+/* AT@TONE - exercise TONES through RiViera Audio Service API */
+GLOBAL T_ATI_RSLT atAtTONE ( char *cl, UBYTE srcId )
+{
+	int tone_start[3], tone_stop[3], tone_freq[3], tone_ampl[3];
+	int frame_dur, sequence_dur, period_dur, repetition;
+	int i;
+	T_AUDIO_TONES_PARAMETER t;
+	T_RV_RETURN return_path;
+
+	cl = parse(cl, "DDDDDDDDDDDDDDDD",
+		&tone_start[0], &tone_stop[0], &tone_freq[0], &tone_ampl[0],
+		&tone_start[1], &tone_stop[1], &tone_freq[1], &tone_ampl[1],
+		&tone_start[2], &tone_stop[2], &tone_freq[2], &tone_ampl[2],
+		&frame_dur, &sequence_dur, &period_dur, &repetition);
+	if (!cl)
+		return (ATI_FAIL);
+	for (i = 0; i < 3; i++) {
+		t.tones[i].start_tone = tone_start[i];
+		t.tones[i].stop_tone = tone_stop[i];
+		t.tones[i].frequency_tone = tone_freq[i];
+		t.tones[i].amplitude_tone = -tone_ampl[i];
+	}
+	t.frame_duration = frame_dur;
+	t.sequence_duration = sequence_dur;
+	t.period_duration = period_dur;
+	t.repetition = repetition;
+
+	return_path.addr_id        = NULL;
+	return_path.callback_func  = audio_callback;
+	if (audio_tones_start(&t, return_path) == AUDIO_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
+/* AT@TSTOP - stop tones started with AT@TONE */
+GLOBAL T_ATI_RSLT atAtTSTOP ( char *cl, UBYTE srcId )
+{
+	T_RV_RETURN return_path;
+
+	return_path.addr_id        = NULL;
+	return_path.callback_func  = audio_callback;
+	if (audio_tones_stop(return_path) == AUDIO_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
 #endif /* ATI_AUDIO_C */
--- a/src/aci2/aci/ati_cmd.c	Mon Mar 20 04:00:10 2017 +0000
+++ b/src/aci2/aci/ati_cmd.c	Wed Mar 22 04:51:29 2017 +0000
@@ -676,6 +676,8 @@
 EXTERN T_ATI_RSLT atAtE1 (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtE2 (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atAtE2LSI (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT atAtTONE (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT atAtTSTOP (char *cl, UBYTE srcId);
 
 LOCAL const ATCommand_bas cmds_bas[] =
 {
@@ -1068,6 +1070,8 @@
     {"@E1",	AT_CMD_AT_E1,    atAtE1,	0,	0,	0},
     {"@E2",	AT_CMD_AT_E2,    atAtE2,	0,	0,	0},
     {"@E2LSI",	AT_CMD_AT_E2LSI, atAtE2LSI,	0,	0,	0},
+    {"@TONE",	AT_CMD_AT_TONE,  atAtTONE,	0,	0,	0},
+    {"@TSTOP",	AT_CMD_AT_TSTOP, atAtTSTOP,	0,	0,	0},
     /* terminator */
     {NULL,0,0,0,0,0}
 };