Subject: port-sun3/2144: sun3 doesn't do Cylon emulation
To: None <gnats-bugs@NetBSD.ORG>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: netbsd-bugs
Date: 02/28/1996 06:00:44
>Number:         2144
>Category:       port-sun3
>Synopsis:       sun3 doesn't do Cylon emulation
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 28 06:20:01 1996
>Last-Modified:
>Originator:     der Mouse
>Organization:
Dis-
>Release:        -current sup as of Feb 27 08:30 sup
>Environment:
	Sun-3/110
>Description:
	The sun3 diagnostic lights pattern is very boring.  These
	patches give a Cylon-style bouncing light instead, and make it
	very easy to install whatever pattern you please.
>How-To-Repeat:
	Look at the blinkenlights, wish they were a little more
	interesting.
>Fix:
	Apply this.  Tune the led_patterns[] array to taste, tune the
	CLOCK_COUNTDOWN constant to fiddle the speed with which
	led_patterns[] get sent to the lights.

--- OLD/sys/arch/sun3/sun3/clock.c	Thu Jan  1 00:00:00 1970
+++ NEW/sys/arch/sun3/sun3/clock.c	Thu Jan  1 00:00:00 1970
@@ -241,11 +241,18 @@
  * This is is called by the "custom" interrupt handler
  * after it has reset the pending bit in the clock.
  */
-int clock_count = 0;
 void clock_intr(frame)
 	struct clockframe *frame;
 {
-	static unsigned char led_pattern = 0xFE;
+	/* These patterns specify the Cylon impression. */
+	/* 1 bits are dark, 0 bits are lit. */
+	static const unsigned char led_patterns[] =
+	{ 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf,
+	  0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd };
+#define N_LED_PATTERNS (sizeof(led_patterns)/sizeof(led_patterns[0]))
+	static int led_px = 0;
+	static int clock_count = 0;
+#define CLOCK_COUNTDOWN 5
 
 #ifdef	DIAGNOSTIC
 	if (!clk_intr_ready)
@@ -253,12 +260,11 @@
 #endif
 
 	/* XXX - Move this LED frobbing to the idle loop? */
-	clock_count++;
-	if ((clock_count & 7) == 0) {
-		led_pattern = (led_pattern << 1) | 1;
-		if (led_pattern == 0xFF)
-			led_pattern = 0xFE;
-		set_control_byte((char *) DIAG_REG, led_pattern);
+	if (--clock_count < 0) {
+		clock_count = CLOCK_COUNTDOWN;
+		set_control_byte((char *) DIAG_REG, led_patterns[led_px]);
+		if (--led_px < 0)
+			led_px = N_LED_PATTERNS - 1;
 	}
 	hardclock(frame);
 }

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu
>Audit-Trail:
>Unformatted: