changeset 114:eb54195fded6

fc-tmsh: rfpw command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 16 Jan 2017 20:14:48 +0000
parents 816d91739a32
children c41511b79b1d
files rvinterf/tmsh/l1cmd.c rvinterf/tmsh/usercmd.c
diffstat 2 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/tmsh/l1cmd.c	Mon Jan 16 19:30:40 2017 +0000
+++ b/rvinterf/tmsh/l1cmd.c	Mon Jan 16 20:14:48 2017 +0000
@@ -114,3 +114,53 @@
 	send_etm_cmd(cmdpkt, 5);
 	return(0);
 }
+
+cmd_rfpw2(argc, argv)
+	char **argv;
+{
+	u16 index, value;
+	u_char cmdpkt[7];
+
+	index = strtoul(argv[1], 0, 0);
+	value = strtol(argv[2], 0, 0);
+	cmdpkt[1] = RF_PARAM_WRITE;
+	cmdpkt[2] = index;
+	cmdpkt[3] = index >> 8;
+	cmdpkt[4] = value;
+	cmdpkt[5] = value >> 8;
+	send_etm_cmd(cmdpkt, 5);
+	return(0);
+}
+
+cmd_rfpw3(argc, argv)
+	char **argv;
+{
+	u16 index;
+	u8 val1, val2;
+	u_char cmdpkt[7];
+
+	index = strtoul(argv[1], 0, 0);
+	val1 = strtoul(argv[2], 0, 0);
+	val2 = strtoul(argv[3], 0, 0);
+	cmdpkt[1] = RF_PARAM_WRITE;
+	cmdpkt[2] = index;
+	cmdpkt[3] = index >> 8;
+	cmdpkt[4] = val1;
+	cmdpkt[5] = val2;
+	send_etm_cmd(cmdpkt, 5);
+	return(0);
+}
+
+cmd_rfpw(argc, argv)
+	char **argv;
+{
+	switch (argc) {
+	case 3:
+		return cmd_rfpw2(argc, argv);
+	case 4:
+		return cmd_rfpw3(argc, argv);
+	default:
+		fprintf(stderr, "BUG: wrong argc in cmd_rfpw()\n");
+		return(ERROR_BUG);
+	}
+}
--- a/rvinterf/tmsh/usercmd.c	Mon Jan 16 19:30:40 2017 +0000
+++ b/rvinterf/tmsh/usercmd.c	Mon Jan 16 20:14:48 2017 +0000
@@ -24,6 +24,7 @@
 extern int cmd_r16();
 extern int cmd_r32();
 extern int cmd_rfe();
+extern int cmd_rfpw();
 extern int cmd_scr();
 extern int cmd_scw();
 extern int cmd_sr();
@@ -64,6 +65,7 @@
 	{"r16", 1, 2, cmd_r16},
 	{"r32", 1, 2, cmd_r32},
 	{"rfe", 1, 1, cmd_rfe},
+	{"rfpw", 2, 3, cmd_rfpw},
 	{"scr", 1, 1, cmd_scr},
 	{"scw", 2, 2, cmd_scw},
 	{"sr", 2, 2, cmd_sr},