changeset 664:afcb1115b9b3

AT@SPENH command implemented in aci2
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 24 May 2020 07:38:44 +0000
parents cf1cfe12a54a
children 2795a11973b8
files components/aci-classic src/aci2/aci/aci_cmh.h src/aci2/aci/ati_cmd.c src/aci2/aci/ati_fcmisc.c
diffstat 4 files changed, 103 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/components/aci-classic	Sun May 24 06:53:25 2020 +0000
+++ b/components/aci-classic	Sun May 24 07:38:44 2020 +0000
@@ -147,6 +147,7 @@
 cfile_str2ind $SRCDIR/ati_omcompat.c
 cfile_str2ind $SRCDIR/ati_audio.c
 cfile_str2ind $SRCDIR/ati_fchg.c
+cfile_str2ind $SRCDIR/ati_fcmisc.c
 
 # ACI stuff
 cfile_str2ind $SRCDIR/aci_aci.c
--- a/src/aci2/aci/aci_cmh.h	Sun May 24 06:53:25 2020 +0000
+++ b/src/aci2/aci/aci_cmh.h	Sun May 24 07:38:44 2020 +0000
@@ -497,6 +497,7 @@
   AT_CMD_P_CBC,
   AT_CMD_AT_CHG,
   AT_CMD_P_VBAT,
+  AT_CMD_AT_SPENH,
   /* terminator */
   AT_CMD_MAX                  /* maximum command id */
 } T_ACI_AT_CMD;
--- a/src/aci2/aci/ati_cmd.c	Sun May 24 06:53:25 2020 +0000
+++ b/src/aci2/aci/ati_cmd.c	Sun May 24 07:38:44 2020 +0000
@@ -702,6 +702,8 @@
 EXTERN T_ATI_RSLT atAtCHG (char *cl, UBYTE srcId);
 #endif
 EXTERN T_ATI_RSLT atPercentVBAT (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT atAtSPENH (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT queatAtSPENH (char *cl, UBYTE srcId);
 
 LOCAL const ATCommand_bas cmds_bas[] =
 {
@@ -1114,6 +1116,8 @@
     {"@CHG",	AT_CMD_AT_CHG,   atAtCHG,	0,	0,	"%s: (0,1)"},
 #endif
     {"%VBAT",	AT_CMD_P_VBAT,   atPercentVBAT,	0,	0,	0},
+    {"@SPENH",	AT_CMD_AT_SPENH, atAtSPENH,	test_gen, queatAtSPENH,
+						"%s: (0,1),(0,1)"},
     /* terminator */
     {NULL,0,0,0,0,0}
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/aci2/aci/ati_fcmisc.c	Sun May 24 07:38:44 2020 +0000
@@ -0,0 +1,97 @@
+/*
+ * This module implements miscellaneous FreeCalypso-added AT commands.
+ */
+
+#ifndef ATI_FCMISC_C
+#define ATI_FCMISC_C
+
+#include "aci_all.h"
+
+#include <ctype.h>
+#include <string.h>
+
+#include "aci_cmh.h"
+#include "ati_cmd.h"
+#include "aci_cmd.h"
+#include "aci_io.h"
+#include "aci_cmd.h"
+#include "l4_tim.h"
+#include "line_edit.h"
+#include "aci_lst.h"
+
+#include "pcm.h"
+#include "audio.h"
+#include "aci.h"
+#include "rx.h"
+#include "pwr.h"
+#include "l4_tim.h"
+
+#ifdef GPRS
+#ifdef DTI
+#include "dti.h"
+#include "dti_conn_mng.h"
+#include "dti_cntrl_mng.h"
+#endif /* DTI */
+#include "gaci.h"
+#include "gaci_cmh.h"
+#include "gaci_cmd.h"
+#endif  /* GPRS */
+
+#include "aci_mem.h"
+#include "aci_prs.h"
+
+#include "ati_int.h"
+
+#ifndef _SIMULATION_
+#include "ffs/ffs.h"
+#endif
+
+#ifdef FF_ATI_BAT
+
+#include "typedefs.h"
+#include "gdd.h"
+#include "bat.h"
+
+#include "ati_bat.h"
+
+#endif /*FF_ATI_BAT*/
+
+#include "main/sys_types.h"
+
+extern SYS_UWORD8 SIM_allow_speed_enhancement;
+
+/* AT@SPENH - enable or disable SIM speed enhancement */
+GLOBAL T_ATI_RSLT atAtSPENH ( char *cl, UBYTE srcId )
+{
+	int state, nonvol = 0;
+
+	TRACE_FUNCTION("atAtSPENH()");
+
+	cl = parse(cl, "Dd", &state, &nonvol);
+	if (!cl)
+		return (ATI_FAIL);
+	if (state != 0 && state != 1)
+		return (ATI_FAIL);
+	SIM_allow_speed_enhancement = state;
+	if (!nonvol)
+		return (ATI_CMPL);
+	ffs_mkdir("/etc");
+	if (ffs_file_write("/etc/SIM_spenh", &SIM_allow_speed_enhancement, 1,
+			   FFS_O_CREATE | FFS_O_TRUNC) == EFFS_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
+GLOBAL T_ATI_RSLT queatAtSPENH (char *cl, UBYTE srcId)
+{
+	char *me="@SPENH: ";
+
+	TRACE_FUNCTION("queatAtSPENH()");
+
+	sprintf(g_sa, "%s%u", me, SIM_allow_speed_enhancement);
+	io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
+	return (ATI_CMPL);
+}
+
+#endif /* ATI_FCMISC_C */