Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm * Add the ability to display .'s on the 7seg...
details: https://anonhg.NetBSD.org/src/rev/af4b2dd44574
branches: trunk
changeset: 525540:af4b2dd44574
user: thorpej <thorpej%NetBSD.org@localhost>
date: Fri Apr 12 20:50:26 2002 +0000
description:
* Add the ability to display .'s on the 7seg display.
* Display . . when halted.
diffstat:
sys/arch/evbarm/iq80310/iq80310_7seg.c | 35 +++++++++++++++++-------------
sys/arch/evbarm/iq80310/iq80310_machdep.c | 3 +-
sys/arch/evbarm/iq80321/iq80321_7seg.c | 33 ++++++++++++++++------------
sys/arch/evbarm/iq80321/iq80321_machdep.c | 3 +-
4 files changed, 43 insertions(+), 31 deletions(-)
diffs (160 lines):
diff -r c1852a8d8cbb -r af4b2dd44574 sys/arch/evbarm/iq80310/iq80310_7seg.c
--- a/sys/arch/evbarm/iq80310/iq80310_7seg.c Fri Apr 12 19:35:17 2002 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310_7seg.c Fri Apr 12 20:50:26 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: iq80310_7seg.c,v 1.5 2002/01/20 03:41:48 thorpej Exp $ */
+/* $NetBSD: iq80310_7seg.c,v 1.6 2002/04/12 20:50:26 thorpej Exp $ */
/*
- * Copyright (c) 2001 Wasabi Systems, Inc.
+ * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
@@ -48,12 +48,9 @@
#include <evbarm/iq80310/iq80310var.h>
#include <evbarm/iq80310/obiovar.h>
-#define ASCIIMAP_START '0'
-#define ASCIIMAP_END '9'
-
static int snakestate;
-static const uint8_t asciimap[] = {
+static const uint8_t digitmap[] = {
/* +#####+
* # #
* # #
@@ -175,20 +172,28 @@
SEG_D|SEG_E,
};
+static uint8_t
+iq80310_7seg_xlate(char c)
+{
+ uint8_t rv;
+
+ if (c >= '0' && c <= '9')
+ rv = digitmap[c - '0'];
+ else if (c == '.')
+ rv = (uint8_t) ~SEG_DP;
+ else
+ rv = 0xff;
+
+ return (rv);
+}
+
void
iq80310_7seg(char a, char b)
{
uint8_t msb, lsb;
- if (a < ASCIIMAP_START || a > ASCIIMAP_END)
- msb = 0xff;
- else
- msb = asciimap[a - ASCIIMAP_START] | SEG_DP;
-
- if (b < ASCIIMAP_START || b > ASCIIMAP_END)
- lsb = 0xff;
- else
- lsb = asciimap[b - ASCIIMAP_START] | SEG_DP;
+ msb = iq80310_7seg_xlate(a);
+ lsb = iq80310_7seg_xlate(b);
snakestate = 0;
diff -r c1852a8d8cbb -r af4b2dd44574 sys/arch/evbarm/iq80310/iq80310_machdep.c
--- a/sys/arch/evbarm/iq80310/iq80310_machdep.c Fri Apr 12 19:35:17 2002 +0000
+++ b/sys/arch/evbarm/iq80310/iq80310_machdep.c Fri Apr 12 20:50:26 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iq80310_machdep.c,v 1.39 2002/04/12 00:58:49 briggs Exp $ */
+/* $NetBSD: iq80310_machdep.c,v 1.40 2002/04/12 20:50:26 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -265,6 +265,7 @@
IRQdisable;
if (howto & RB_HALT) {
+ iq80310_7seg('.', '.');
printf("The operating system has halted.\n");
printf("Please press any key to reboot.\n\n");
cngetc();
diff -r c1852a8d8cbb -r af4b2dd44574 sys/arch/evbarm/iq80321/iq80321_7seg.c
--- a/sys/arch/evbarm/iq80321/iq80321_7seg.c Fri Apr 12 19:35:17 2002 +0000
+++ b/sys/arch/evbarm/iq80321/iq80321_7seg.c Fri Apr 12 20:50:26 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iq80321_7seg.c,v 1.1 2002/03/27 21:51:29 thorpej Exp $ */
+/* $NetBSD: iq80321_7seg.c,v 1.2 2002/04/12 20:50:27 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -49,12 +49,9 @@
#define WRITE(x, v) *((__volatile uint8_t *) (x)) = (v)
-#define ASCIIMAP_START '0'
-#define ASCIIMAP_END '9'
-
static int snakestate;
-static const uint8_t asciimap[] = {
+static const uint8_t digitmap[] = {
/* +#####+
* # #
* # #
@@ -176,20 +173,28 @@
SEG_D|SEG_E,
};
+static uint8_t
+iq80321_7seg_xlate(char c)
+{
+ uint8_t rv;
+
+ if (c >= '0' && c <= '9')
+ rv = digitmap[c - '0'];
+ else if (c == '.')
+ rv = ~SEG_DP;
+ else
+ rv = 0xff;
+
+ return (rv);
+}
+
void
iq80321_7seg(char a, char b)
{
uint8_t msb, lsb;
- if (a < ASCIIMAP_START || a > ASCIIMAP_END)
- msb = 0xff;
- else
- msb = asciimap[a - ASCIIMAP_START] | SEG_DP;
-
- if (b < ASCIIMAP_START || b > ASCIIMAP_END)
- lsb = 0xff;
- else
- lsb = asciimap[b - ASCIIMAP_START] | SEG_DP;
+ msb = iq80321_7seg_xlate(a);
+ lsb = iq80321_7seg_xlate(b);
snakestate = 0;
diff -r c1852a8d8cbb -r af4b2dd44574 sys/arch/evbarm/iq80321/iq80321_machdep.c
--- a/sys/arch/evbarm/iq80321/iq80321_machdep.c Fri Apr 12 19:35:17 2002 +0000
+++ b/sys/arch/evbarm/iq80321/iq80321_machdep.c Fri Apr 12 20:50:26 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iq80321_machdep.c,v 1.5 2002/04/09 23:44:03 thorpej Exp $ */
+/* $NetBSD: iq80321_machdep.c,v 1.6 2002/04/12 20:50:27 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -267,6 +267,7 @@
IRQdisable;
if (howto & RB_HALT) {
+ iq80321_7seg('.', '.');
printf("The operating system has halted.\n");
printf("Please press any key to reboot.\n\n");
cngetc();
Home |
Main Index |
Thread Index |
Old Index