Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/iq80310 Implement a "snake" for the 7-segmen...



details:   https://anonhg.NetBSD.org/src/rev/7265543dc174
branches:  trunk
changeset: 518481:7265543dc174
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Dec 01 02:04:27 2001 +0000

description:
Implement a "snake" for the 7-segment display.

diffstat:

 sys/arch/evbarm/iq80310/iq80310_7seg.c  |  92 ++++++++++++++++++++++++++++++++-
 sys/arch/evbarm/iq80310/iq80310_timer.c |   6 +-
 sys/arch/evbarm/iq80310/iq80310var.h    |   3 +-
 3 files changed, 98 insertions(+), 3 deletions(-)

diffs (155 lines):

diff -r a0369b4efbe2 -r 7265543dc174 sys/arch/evbarm/iq80310/iq80310_7seg.c
--- a/sys/arch/evbarm/iq80310/iq80310_7seg.c    Sat Dec 01 02:02:46 2001 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310_7seg.c    Sat Dec 01 02:04:27 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iq80310_7seg.c,v 1.2 2001/11/07 02:24:18 thorpej Exp $ */
+/*     $NetBSD: iq80310_7seg.c,v 1.3 2001/12/01 02:04:27 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -50,6 +50,8 @@
 #define        ASCIIMAP_START  '0'
 #define        ASCIIMAP_END    '9'
 
+static int snakestate;
+
 static const uint8_t asciimap[] = {
 /*     +#####+
  *     #     #
@@ -187,6 +189,94 @@
        else
                lsb = asciimap[b - ASCIIMAP_START] | SEG_DP;
 
+       snakestate = 0;
+
        CPLD_WRITE(IQ80310_7SEG_MSB, msb);
        CPLD_WRITE(IQ80310_7SEG_LSB, lsb);
 }
+
+static const uint8_t snakemap[][2] = {
+
+/*     +#####+         +#####+
+ *     |     |         |     |
+ *     |     |         |     |
+ *     |     |         |     |
+ *     +-----+         +-----+
+ *     |     |         |     |
+ *     |     |         |     |
+ *     |     |         |     |
+ *     +-----+         +-----+
+ */
+       { ~SEG_A,       ~SEG_A },
+
+/*     +-----+         +-----+
+ *     #     |         |     #
+ *     #     |         |     #
+ *     #     |         |     #
+ *     +-----+         +-----+
+ *     |     |         |     |
+ *     |     |         |     |
+ *     |     |         |     |
+ *     +-----+         +-----+
+ */
+       { ~SEG_F,       ~SEG_B },
+
+/*     +-----+         +-----+
+ *     |     |         |     |
+ *     |     |         |     |
+ *     |     |         |     |
+ *     +-----+         +-----+
+ *     #     |         |     #
+ *     #     |         |     #
+ *     #     |         |     #
+ *     +-----+         +-----+
+ */
+       { ~SEG_E,       ~SEG_C },
+
+/*     +-----+         +-----+
+ *     |     |         |     |
+ *     |     |         |     |
+ *     |     |         |     |
+ *     +-----+         +-----+
+ *     |     |         |     |
+ *     |     |         |     |
+ *     |     |         |     |
+ *     +#####+         +#####+
+ */
+       { ~SEG_D,       ~SEG_D },
+
+/*     +-----+         +-----+
+ *     |     |         |     |
+ *     |     |         |     |
+ *     |     |         |     |
+ *     +-----+         +-----+
+ *     |     #         #     |
+ *     |     #         #     |
+ *     |     #         #     |
+ *     +-----+         +-----+
+ */
+       { ~SEG_C,       ~SEG_E },
+
+/*     +-----+         +-----+
+ *     |     #         #     |
+ *     |     #         #     |
+ *     |     #         #     |
+ *     +-----+         +-----+
+ *     |     |         |     |
+ *     |     |         |     |
+ *     |     |         |     |
+ *     +-----+         +-----+
+ */
+       { ~SEG_B,       ~SEG_F },
+};
+
+void
+iq80310_7seg_snake(void)
+{
+       int cur = snakestate;
+
+       CPLD_WRITE(IQ80310_7SEG_MSB, snakemap[cur][0]);
+       CPLD_WRITE(IQ80310_7SEG_LSB, snakemap[cur][1]);
+
+       snakestate = (snakestate == 5) ? 0 : cur + 1;
+}
diff -r a0369b4efbe2 -r 7265543dc174 sys/arch/evbarm/iq80310/iq80310_timer.c
--- a/sys/arch/evbarm/iq80310/iq80310_timer.c   Sat Dec 01 02:02:46 2001 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310_timer.c   Sat Dec 01 02:04:27 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iq80310_timer.c,v 1.5 2001/11/26 18:01:05 thorpej Exp $        */
+/*     $NetBSD: iq80310_timer.c,v 1.6 2001/12/01 02:04:27 thorpej Exp $        */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -331,11 +331,15 @@
 clockhandler(void *arg)
 {
        struct clockframe *frame = arg;
+       static int snakefreq;
 
        timer_disable(TIMER_ENABLE_INTEN);
        timer_enable(TIMER_ENABLE_INTEN);
 
        hardclock(frame);
 
+       if ((snakefreq++ & 15) == 0)
+               iq80310_7seg_snake();
+
        return (1);
 }
diff -r a0369b4efbe2 -r 7265543dc174 sys/arch/evbarm/iq80310/iq80310var.h
--- a/sys/arch/evbarm/iq80310/iq80310var.h      Sat Dec 01 02:02:46 2001 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310var.h      Sat Dec 01 02:04:27 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iq80310var.h,v 1.2 2001/11/09 20:58:58 thorpej Exp $   */
+/*     $NetBSD: iq80310var.h,v 1.3 2001/12/01 02:04:27 thorpej Exp $   */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -49,6 +49,7 @@
 void   iq80310_calibrate_delay(void);
 
 void   iq80310_7seg(char, char);
+void   iq80310_7seg_snake(void);
 
 void   iq80310_pci_init(pci_chipset_tag_t, void *);
 



Home | Main Index | Thread Index | Old Index