-/* $OpenBSD: clock.c,v 1.8 2000/02/09 05:51:21 mickey Exp $ */
+/* $OpenBSD: clock.c,v 1.9 2000/03/29 23:11:06 mickey Exp $ */
/*
* Copyright (c) 1998,1999 Michael Shalayeff
void *v;
{
struct trapframe *frame = v;
-#ifdef USELEDS
- static u_int hbcnt = 0;
-
- if (!(hbcnt % (hz / 8)) && ((hbcnt / (hz / 8)) & 7) < 4)
- ledctl(0, 0, PALED_HEARTBEAT);
- hbcnt++;
-#endif
/* printf ("clock int 0x%x @ 0x%x for %p\n", t,
frame->tf_iioq_head, curproc); */
-/* $OpenBSD: autoconf.c,v 1.7 1999/11/25 18:31:53 mickey Exp $ */
+/* $OpenBSD: autoconf.c,v 1.8 2000/03/29 23:11:12 mickey Exp $ */
/*
- * Copyright (c) 1998 Michael Shalayeff
+ * Copyright (c) 1998-2000 Michael Shalayeff
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
#include <sys/conf.h>
#include <sys/reboot.h>
#include <sys/device.h>
+#include <sys/timeout.h>
#include <machine/iomod.h>
#include <machine/autoconf.h>
void (*cold_hook) __P((void)); /* see below */
register_t kpsw = PSW_Q | PSW_P | PSW_C | PSW_D;
+/*
+ * LED blinking thing
+ */
+#ifdef USELEDS
+struct timeout heartbeat_tmo;
+void heartbeat __P((void *));
+extern int hz;
+#endif
+
/*
* configure:
* called at boot time, configure all devices on system
cold = 0;
if (cold_hook)
(*cold_hook)();
+
+#ifdef USELEDS
+ timeout_set(&heartbeat_tmo, heartbeat, NULL);
+ timeout_add(&heartbeat_tmo, hz / 8);
+#endif
}
+#ifdef USELEDS
+/*
+ * turn the heartbeat alive.
+ * right thing would be to pass counter to each subsequent timeout
+ * as an argument to heartbeat() incrementing every turn,
+ * i.e. avoiding the static hbcnt, but doing timeout_set() on each
+ * timeout_add() sounds ugly, guts of struct timeout looks ugly
+ * to ponder in even more.
+ */
+void
+heartbeat(v)
+ void *v;
+{
+ static u_int hbcnt = 0;
+
+ /*
+ * do this:
+ *
+ * |~| |~|
+ * _| |_| |_,_,_,_
+ * 0 1 2 3 4 6 7
+ */
+ if (hbcnt % 8 < 4)
+ ledctl(0, 0, PALED_HEARTBEAT);
+ hbcnt++;
+
+ timeout_add(&heartbeat_tmo, hz / 8);
+}
+#endif
+
/*
* Configure swap space and related parameters.
*/
if (nblks <= ctod(1))
goto bad;
dumpblks = cpu_dumpsize();
- if (dumpblks < 0)
+ if (dumpblks < 0)
goto bad;
dumpblks += ctod(physmem);
-/* $OpenBSD: cpufunc.h,v 1.14 2000/02/09 05:10:10 mickey Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.15 2000/03/29 23:11:12 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
int btlb_insert __P((pa_space_t space, vaddr_t va, paddr_t pa,
vsize_t *lenp, u_int prot));
hppa_hpa_t cpu_gethpa __P((int n));
-void heartbeat __P((int on));
#endif
#endif /* _MACHINE_CPUFUNC_H_ */