Subject: port-hp300/553: hp300 heartbeat light too boring
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: None <thorpej@cs.orst.edu>
List: netbsd-bugs
Date: 11/04/1994 00:20:05
>Number:         553
>Category:       port-hp300
>Synopsis:       hp300 heartbeat light too boring
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Nov  4 00:20:04 1994
>Originator:     
>Organization:
--------------------------------------------------------------------------
Jason R. Thorpe               thorpej@cs.orst.edu                 758-2003
Systems Administrator            CSWest Room 5                    737-5567
CS Dept, Oregon State University           http://www.cs.orst.edu/~thorpej
               "I brought my BOWLING BALL -- and some DRUGS!"
                      -- ztp
>Release:        1.0
>Environment:
	
System: NetBSD helix 1.0 NetBSD 1.0 (HELIX) #34: Thu Nov 3 21:48:29 PST 1994 thorpej@helix:/usr/src/sys/arch/hp300/compile/HELIX hp300


>Description:
	The heartbeat light on an hp300, when compiled with USELEDS, is
	a little too boring, being a constant on-off-on-off, with the same
	delay for all iterations.  Sorry, but the HP-UX algorithm for the
	heartbeat light is just a little cooler to look at.  :-)
>How-To-Repeat:
	Compile an hp300 kernel with USELEDS.  Look at the front panel
	on a 400-series.  Peer through the front slats on a
	380, 375, 370 and 345.
>Fix:
	The following patch to locore.s pretty much emulates the
	HP-UX ``heartbeat'' with alternating fast and slow throbs.
	It might be off by as much as a few 100ths of a second, but is
	pretty close :-)

*** distribution/locore.s	Thu Nov  3 23:57:46 1994
--- locore.s	Thu Nov  3 23:56:58 1994
***************
*** 644,654 ****
  	movl	heartbeat,d0		| get tick count
  	addql	#1,d0			|  increment
  	movl	_hz,d1
! 	lsrl	#1,d1			| throb twice a second
  	cmpl	d0,d1			| are we there yet?
  	jne	Lnoled1			| no, nothing to do
  	tstl	_inledcontrol		| already updating LEDs?
  	jne	Lnoled2			| yes, skip it
  	movl	#LED_PULSE,sp@-
  	movl	#LED_DISK+LED_LANRCV+LED_LANXMT,sp@-
  	clrl	sp@-
--- 644,664 ----
  	movl	heartbeat,d0		| get tick count
  	addql	#1,d0			|  increment
  	movl	_hz,d1
! 	addl	#50,d1			| get the timing a little closer
! 	cmpl	#0,beatstatus		| time to slow down?
! 	jeq	SlowThrob
! 	lsrl	#3,d1			| fast throb
! SlowThrob:
! 	lsrl	#1,d1			| slow throb
  	cmpl	d0,d1			| are we there yet?
  	jne	Lnoled1			| no, nothing to do
  	tstl	_inledcontrol		| already updating LEDs?
  	jne	Lnoled2			| yes, skip it
+ 	addl	#1,beatstatus		| incr beat status
+ 	cmpl	#3,beatstatus		| time to reset?
+ 	ble	SkipReset
+ 	movl	#0,beatstatus		| reset the status indicator
+ SkipReset:
  	movl	#LED_PULSE,sp@-
  	movl	#LED_DISK+LED_LANRCV+LED_LANXMT,sp@-
  	clrl	sp@-
***************
*** 2430,2435 ****
--- 2440,2447 ----
  #ifdef USELEDS
  heartbeat:
  	.long	0		| clock ticks since last pulse of heartbeat
+ beatstatus:
+ 	.long	0		| for determining a fast or slow throb
  #endif
  #ifdef DEBUG
  	.globl	fulltflush, fullcflush
>Audit-Trail:
>Unformatted: