changeset 821:16bee7b6bd6b

buzplayer: PWT needs to be turned on in order to not hang
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 30 May 2021 04:01:33 +0000
parents 03457a66d860
children 7c02cc7f28df
files target-utils/buzplayer/pwt.c
diffstat 1 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/buzplayer/pwt.c	Sun May 30 03:39:58 2021 +0000
+++ b/target-utils/buzplayer/pwt.c	Sun May 30 04:01:33 2021 +0000
@@ -16,6 +16,20 @@
 #define	PWT_GCR_REG	(*(volatile u8 *) 0xFFFE8802)
 
 void
+pwt_on()
+{
+	ASIC_CONF_REG |= PWT_MODE_MASK;
+	PWT_GCR_REG = 0x01;
+}
+
+void
+pwt_off()
+{
+	ASIC_CONF_REG &= ~PWT_MODE_MASK;
+	PWT_GCR_REG = 0;
+}
+
+void
 cmd_pwt(argbulk)
 	char *argbulk;
 {
@@ -23,13 +37,11 @@
 
 	if (parse_args(argbulk, 1, 1, argv, 0) < 0)
 		return;
-	if (!strcmp(argv[0], "on")) {
-		ASIC_CONF_REG |= PWT_MODE_MASK;
-		PWT_GCR_REG = 0x01;
-	} else if (!strcmp(argv[0], "off")) {
-		ASIC_CONF_REG &= ~PWT_MODE_MASK;
-		PWT_GCR_REG = 0;
-	} else
+	if (!strcmp(argv[0], "on"))
+		pwt_on();
+	else if (!strcmp(argv[0], "off"))
+		pwt_off();
+	else
 		printf("ERROR: \"on\" or \"off\" argument expected\n");
 }
 
@@ -56,6 +68,7 @@
 		}
 	} else
 		vol = 63;
+	pwt_on();
 	PWT_FRC_REG = note;
 	PWT_VCR_REG = (vol << 1) | 1;
 	for (;;) {