Print "NetBSD/cobalt Starting up... " to LCD panel on boot, and also
print "NetBSD/cobalt Shutting donw..." on halt via shutdown hook. This would be useful for users who don't have serial console. No objection on port-cobalt.
This commit is contained in:
parent
e42e7941c2
commit
50698ab6af
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: panel.c,v 1.15 2008/03/01 14:16:49 rmind Exp $ */
|
||||
/* $NetBSD: panel.c,v 1.16 2008/03/04 14:40:16 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Dennis I. Chernoivanov
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.15 2008/03/01 14:16:49 rmind Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.16 2008/03/04 14:40:16 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -54,6 +54,9 @@ __KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.15 2008/03/01 14:16:49 rmind Exp $");
|
||||
#define PANEL_POLLRATE (hz / 10)
|
||||
#define PANEL_REGION 0x20
|
||||
#define DATA_OFFSET 0x10
|
||||
#define PANEL_COLS 16
|
||||
#define PANEL_VCOLS 40
|
||||
#define PANEL_ROWS 2
|
||||
|
||||
struct panel_softc {
|
||||
struct device sc_dev;
|
||||
@ -65,8 +68,22 @@ struct panel_softc {
|
||||
struct callout sc_callout;
|
||||
};
|
||||
|
||||
struct lcd_message {
|
||||
const char firstcol[PANEL_VCOLS];
|
||||
const char secondcol[PANEL_VCOLS];
|
||||
};
|
||||
static const struct lcd_message startup_message = {
|
||||
"NetBSD/cobalt ",
|
||||
"Starting up... "
|
||||
};
|
||||
static const struct lcd_message shutdown_message = {
|
||||
"NetBSD/cobalt ",
|
||||
"Shutting down..."
|
||||
};
|
||||
|
||||
static int panel_match(struct device *, struct cfdata *, void *);
|
||||
static void panel_attach(struct device *, struct device *, void *);
|
||||
static void panel_shutdown(void *);
|
||||
|
||||
static void panel_soft(void *);
|
||||
|
||||
@ -102,7 +119,7 @@ panel_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct panel_softc *sc = (void *)self;
|
||||
struct mainbus_attach_args *maa = aux;
|
||||
|
||||
struct hd44780_io io;
|
||||
static struct lcdkp_xlate keys[] = {
|
||||
{ 0xfa, 'h' },
|
||||
{ 0xf6, 'k' },
|
||||
@ -122,8 +139,8 @@ panel_attach(struct device *parent, struct device *self, void *aux)
|
||||
1, &sc->sc_lcd.sc_iodr);
|
||||
|
||||
sc->sc_lcd.sc_dev_ok = 1;
|
||||
sc->sc_lcd.sc_cols = 16;
|
||||
sc->sc_lcd.sc_vcols = 40;
|
||||
sc->sc_lcd.sc_cols = PANEL_COLS;
|
||||
sc->sc_lcd.sc_vcols = PANEL_VCOLS;
|
||||
sc->sc_lcd.sc_flags = HD_8BIT | HD_MULTILINE | HD_KEYPAD;
|
||||
|
||||
sc->sc_lcd.sc_writereg = panel_cbt_hdwritereg;
|
||||
@ -132,6 +149,15 @@ panel_attach(struct device *parent, struct device *self, void *aux)
|
||||
|
||||
hd44780_attach_subr(&sc->sc_lcd);
|
||||
|
||||
/* Hello World */
|
||||
io.dat = 0;
|
||||
io.len = PANEL_VCOLS * PANEL_ROWS;
|
||||
memcpy(io.buf, &startup_message, io.len);
|
||||
hd44780_ddram_io(&sc->sc_lcd, sc->sc_lcd.sc_curchip, &io,
|
||||
HD_DDRAM_WRITE);
|
||||
|
||||
shutdownhook_establish(panel_shutdown, sc);
|
||||
|
||||
sc->sc_kp.sc_iot = maa->ma_iot;
|
||||
sc->sc_kp.sc_ioh = MIPS_PHYS_TO_KSEG1(0x1d000000); /* XXX */
|
||||
|
||||
@ -147,6 +173,20 @@ panel_attach(struct device *parent, struct device *self, void *aux)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
panel_shutdown(void *arg)
|
||||
{
|
||||
struct panel_softc *sc = arg;
|
||||
struct hd44780_io io;
|
||||
|
||||
/* Goodbye World */
|
||||
io.dat = 0;
|
||||
io.len = PANEL_VCOLS * PANEL_ROWS;
|
||||
memcpy(io.buf, &shutdown_message, io.len);
|
||||
hd44780_ddram_io(&sc->sc_lcd, sc->sc_lcd.sc_curchip, &io,
|
||||
HD_DDRAM_WRITE);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
panel_cbt_kprread(bus_space_tag_t iot, bus_space_handle_t ioh)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user