changeset 845:aec320fe2653

fc-tmsync: new madc command reads all 8 MADC channels
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 31 Jul 2021 22:23:05 +0000
parents 4694c7686ccd
children a2e17e0f9622
files rvinterf/etmsync/l1tmcmd.c rvinterf/etmsync/tmscmdtab.c
diffstat 2 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/etmsync/l1tmcmd.c	Sat Jul 31 21:57:48 2021 +0000
+++ b/rvinterf/etmsync/l1tmcmd.c	Sat Jul 31 22:23:05 2021 +0000
@@ -324,3 +324,44 @@
 		printf("read value: 0x%04X (%u)\n", val, val);
 	return(0);
 }
+
+cmd_madc(argc, argv)
+	char **argv;
+{
+	u16 val;
+	int rc;
+
+	rc = do_mpr(CONVERTED_ADC0, &val);
+	if (rc)
+		return(rc);
+	printf("VBAT=%u\n", val);
+	rc = do_mpr(CONVERTED_ADC1, &val);
+	if (rc)
+		return(rc);
+	printf("VCHG=%u\n", val);
+	rc = do_mpr(RAW_ADC2, &val);
+	if (rc)
+		return(rc);
+	printf("ICHG=%u\n", val);
+	rc = do_mpr(CONVERTED_ADC3, &val);
+	if (rc)
+		return(rc);
+	printf("VBACKUP=%u\n", val);
+	rc = do_mpr(RAW_ADC4, &val);
+	if (rc)
+		return(rc);
+	printf("ADIN1=0x%04X\n", val);
+	rc = do_mpr(RAW_ADC5, &val);
+	if (rc)
+		return(rc);
+	printf("ADIN2=0x%04X\n", val);
+	rc = do_mpr(RAW_ADC6, &val);
+	if (rc)
+		return(rc);
+	printf("ADIN3=0x%04X\n", val);
+	rc = do_mpr(RAW_ADC7, &val);
+	if (rc)
+		return(rc);
+	printf("ADIN4=0x%04X\n", val);
+	return(0);
+}
--- a/rvinterf/etmsync/tmscmdtab.c	Sat Jul 31 21:57:48 2021 +0000
+++ b/rvinterf/etmsync/tmscmdtab.c	Sat Jul 31 22:23:05 2021 +0000
@@ -9,6 +9,7 @@
 extern int cmd_dieid();
 extern int cmd_exec();
 extern int cmd_exit();
+extern int cmd_madc();
 extern int cmd_memdump();
 extern int cmd_mpr();
 extern int cmd_omemdump();
@@ -28,6 +29,7 @@
 	{"dieid", 0, 0, cmd_dieid},
 	{"exec", 1, 1, cmd_exec},
 	{"exit", 0, 0, cmd_exit},
+	{"madc", 0, 0, cmd_madc},
 	{"memdump", 2, 2, cmd_memdump},
 	{"mpr", 1, 1, cmd_mpr},
 	{"omemdump", 2, 2, cmd_omemdump},