Date: Thu, 11 Dec 1997 11:12:11 +0100 (CET)
From: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
To: Linux/m68k <linux-m68k@lists.linux-m68k.org>
Subject: L68K: thump-thump-pause
Sender: owner-linux-m68k@phil.uni-sb.de


Anyone else who likes this patch? I like to see flashing LEDs at night (power
LED heartbeat, Ethernet hubs, ...).

BTW, if you enable CONFIG_HEARTBEAT, you'll notice some sound degradation.
That's because the Amiga power LED is connected to a low pass filter for the
sound system.

diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.64/arch/m68k/config.in m68k-newfb/arch/m68k/config.in
--- m68k-2.1.64/arch/m68k/config.in	Tue Nov 25 20:51:46 1997
+++ m68k-newfb/arch/m68k/config.in	Thu Dec 11 20:46:08 1997
@@ -62,6 +62,7 @@
 #    bool 'DMI Resolver support' CONFIG_GSP_RESOLVER
 #    bool 'A2410 support' CONFIG_GSP_A2410
 #  fi
+  bool 'Use power LED as a heartbeat' CONFIG_HEARTBEAT
 fi
 if [ "$CONFIG_ATARI" = "y" ]; then
   bool 'Support for ST-RAM as swap space' CONFIG_STRAM_SWAP
diff -u --recursive --exclude-from=/home/geert/diff-excludes-linux --new-file m68k-2.1.64/arch/m68k/kernel/time.c m68k-newfb/arch/m68k/kernel/time.c
--- m68k-2.1.64/arch/m68k/kernel/time.c	Mon Nov 17 22:00:17 1997
+++ m68k-newfb/arch/m68k/kernel/time.c	Wed Dec 10 21:48:26 1997
@@ -7,6 +7,7 @@
  * Most of the stuff is located in the machine specific files.
  */
 
+#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -17,6 +18,13 @@
 #include <asm/machdep.h>
 #include <asm/io.h>
 
+#ifdef CONFIG_HEARTBEAT
+#include <linux/kernel_stat.h>
+#include <asm/setup.h>
+#include <asm/amigahw.h>
+#include <asm/amigaints.h>
+#endif /* CONFIG_HEARTBEAT */
+
 #include <linux/timex.h>
 
 
@@ -72,6 +80,23 @@
 	  else
 	    last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
 	}
+#ifdef CONFIG_HEARTBEAT
+	if (MACH_IS_AMIGA) {
+	    /* use power LED as a heartbeat instead -- much more useful
+	       for debugging -- based on the version for PReP by Cort */
+	    switch(kstat.interrupts[SYS_IRQS + IRQ_AMIGA_CIAB_TA] % 101) {
+		/* act like an actual heart beat -- ie thump-thump-pause... */
+		case 0:
+		case 20:
+		    ciaa.pra &= ~2;
+		    break;
+		case 7:
+		case 27:
+		    ciaa.pra |= 2;
+		    break;
+	    }
+        }
+#endif /* CONFIG_HEARTBEAT */
 }
 
 /* Converts Gregorian date to seconds since 1970-01-01 00:00:00.

Greetings,

						Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium

