changeset 296:a927f030a4e0

add AT@VIBR and AT@VIBS commands for testing VIBR SWE
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 28 Mar 2022 00:43:11 +0000
parents e5cfd6362158
children 8dfdf88d632f
files src/cs/services/vibr/vibr_api.h 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, 44 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/services/vibr/vibr_api.h	Sun Mar 27 19:44:08 2022 +0000
+++ b/src/cs/services/vibr/vibr_api.h	Mon Mar 28 00:43:11 2022 +0000
@@ -8,6 +8,7 @@
 
 #include "rv/rv_general.h"
 
+#define	VIBR_INFINITE	0
 #define	VIBR_LEVEL_MAX	255
 
 T_RV_RET vibr_pulse_train_start(UINT8 num_pulses, UINT8 vibr_level);
--- a/src/g23m-aci/aci/aci_cmh.h	Sun Mar 27 19:44:08 2022 +0000
+++ b/src/g23m-aci/aci/aci_cmh.h	Mon Mar 28 00:43:11 2022 +0000
@@ -548,6 +548,10 @@
   AT_CMD_AT_PWL,
   AT_CMD_IOR,
   AT_CMD_IOW,
+  AT_CMD_AT_BUZ,
+  AT_CMD_AT_BZSTOP,
+  AT_CMD_AT_VIBR,
+  AT_CMD_AT_VIBS,
   /* 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 Mar 27 19:44:08 2022 +0000
+++ b/src/g23m-aci/aci/ati_cmd.c	Mon Mar 28 00:43:11 2022 +0000
@@ -782,6 +782,10 @@
 #endif
 EXTERN T_ATI_RSLT atPlusIOR (char *cl, UBYTE srcId);
 EXTERN T_ATI_RSLT atPlusIOW (char *cl, UBYTE srcId);
+#ifdef RVM_VIBR_SWE
+EXTERN T_ATI_RSLT atAtVIBR (char *cl, UBYTE srcId);
+EXTERN T_ATI_RSLT atAtVIBS (char *cl, UBYTE srcId);
+#endif
 
 LOCAL const ATCommand_bas cmds_bas[] =
 {
@@ -1257,6 +1261,10 @@
     {"+IOR",	AT_CMD_IOR,      atPlusIOR,	test_gen, 0,	"%s: (0-13)"},
     {"+IOW",	AT_CMD_IOW,      atPlusIOW,	test_gen, 0,
 						"%s: (0-13),(0,1)"},
+#ifdef RVM_VIBR_SWE
+    {"@VIBR",	AT_CMD_AT_VIBR,  atAtVIBR,	0,	0,	0},
+    {"@VIBS",	AT_CMD_AT_VIBS,  atAtVIBS,	0,	0,	0},
+#endif
     /* terminator */
     {NULL,AT_CMD_NONE,NULL,NULL,NULL,NULL}
 };
--- a/src/g23m-aci/aci/ati_fcmisc.c	Sun Mar 27 19:44:08 2022 +0000
+++ b/src/g23m-aci/aci/ati_fcmisc.c	Mon Mar 28 00:43:11 2022 +0000
@@ -56,10 +56,15 @@
 
 #endif /*FF_ATI_BAT*/
 
+#include "rv/rv_defined_swe.h"     /* for RVM_BUZM_SWE and RVM_VIBR_SWE */
 #include "main/sys_types.h"
 #include "fc-target.h"
 #include "armio.h"
 
+#ifdef RVM_VIBR_SWE
+#include "vibr/vibr_api.h"
+#endif
+
 extern SYS_UWORD8 SIM_allow_speed_enhancement;
 
 /* AT@SPENH - enable or disable SIM speed enhancement */
@@ -205,4 +210,30 @@
 	return (ATI_CMPL);
 }
 
+#ifdef RVM_VIBR_SWE
+/* AT@VIBR - run the vibrator by way of VIBR SWE */
+GLOBAL T_ATI_RSLT atAtVIBR ( char *cl, UBYTE srcId )
+{
+	int num_pulses = VIBR_INFINITE;
+	int vibr_level = VIBR_LEVEL_MAX;
+
+	cl = parse(cl, "dd", &num_pulses, &vibr_level);
+	if (!cl)
+		return (ATI_FAIL);
+	if (vibr_pulse_train_start(num_pulses, vibr_level) == RV_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+
+/* AT@VIBS - stop vibration that was started with AT@VIBR */
+GLOBAL T_ATI_RSLT atAtVIBS ( char *cl, UBYTE srcId )
+{
+	if (vibr_pulse_train_stop() == RV_OK)
+		return (ATI_CMPL);
+	else
+		return (ATI_FAIL);
+}
+#endif
+
 #endif /* ATI_FCMISC_C */