* Add the ability to display .'s on the 7seg display.
* Display . . when halted.
This commit is contained in:
parent
09eacc7061
commit
3d6043053d
|
@ -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 @@ static const uint8_t asciimap[] = {
|
|||
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;
|
||||
|
||||
|
|
|
@ -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 @@ cpu_reboot(int howto, char *bootstr)
|
|||
IRQdisable;
|
||||
|
||||
if (howto & RB_HALT) {
|
||||
iq80310_7seg('.', '.');
|
||||
printf("The operating system has halted.\n");
|
||||
printf("Please press any key to reboot.\n\n");
|
||||
cngetc();
|
||||
|
|
|
@ -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 @@ static const uint8_t asciimap[] = {
|
|||
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;
|
||||
|
||||
|
|
|
@ -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 @@ cpu_reboot(int howto, char *bootstr)
|
|||
IRQdisable;
|
||||
|
||||
if (howto & RB_HALT) {
|
||||
iq80321_7seg('.', '.');
|
||||
printf("The operating system has halted.\n");
|
||||
printf("Please press any key to reboot.\n\n");
|
||||
cngetc();
|
||||
|
|
Loading…
Reference in New Issue