changeset 196:5f3544fc0308

AT@SPENH brought over from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 24 May 2020 19:46:18 +0000
parents 2863e5e4af4f
children 4ec995864679
files components/aci src/g23m-aci/aci/aci_cmh.h src/g23m-aci/aci/ati_cmd.c src/g23m-aci/aci/ati_fcmisc.c
diffstat 4 files changed, 103 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/components/aci	Sun May 24 19:34:29 2020 +0000
+++ b/components/aci	Sun May 24 19:46:18 2020 +0000
@@ -176,6 +176,7 @@
 c_file $SRCDIR/ati_omcompat.c
 c_file $SRCDIR/ati_audio.c
 c_file $SRCDIR/ati_fchg.c
+c_file $SRCDIR/ati_fcmisc.c
 
 # ACI stuff
 c_file $SRCDIR/aci_aci.c
--- a/src/g23m-aci/aci/aci_cmh.h	Sun May 24 19:34:29 2020 +0000
+++ b/src/g23m-aci/aci/aci_cmh.h	Sun May 24 19:46:18 2020 +0000
@@ -543,6 +543,7 @@
   AT_CMD_P_CBC,
   AT_CMD_AT_CHG,
   AT_CMD_P_VBAT,
+  AT_CMD_AT_SPENH,
   /* terminator */
   AT_CMD_MAX,                  /* maximum command id */
   AT_CMD_BIGGEST = 0x0000ffff  /* To avoid the lint warning 650 */
--- a/src/g23m-aci/aci/ati_cmd.c	Sun May 24 19:34:29 2020 +0000
+++ b/src/g23m-aci/aci/ati_cmd.c	Sun May 24 19:46:18 2020 +0000
@@ -770,6 +770,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[] =
 {
@@ -1233,6 +1235,8 @@
     {"@CHG",	AT_CMD_AT_CHG,   atAtCHG,	test_gen, 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,AT_CMD_NONE,NULL,NULL,NULL,NULL}
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/g23m-aci/aci/ati_fcmisc.c	Sun May 24 19:46:18 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 */