Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/cobalt rename panel to lcdpanel.



details:   https://anonhg.NetBSD.org/src/rev/269e8308a0ca
branches:  trunk
changeset: 321913:269e8308a0ca
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 09 20:16:16 2018 +0000

description:
rename panel to lcdpanel.

diffstat:

 sys/arch/cobalt/conf/GENERIC      |    6 +-
 sys/arch/cobalt/conf/INSTALL      |    6 +-
 sys/arch/cobalt/conf/files.cobalt |    8 +-
 sys/arch/cobalt/dev/lcdpanel.c    |  334 ++++++++++++++++++++++++++++++++++++++
 sys/arch/cobalt/dev/panel.c       |  334 --------------------------------------
 sys/arch/cobalt/include/cpu.h     |    4 +-
 6 files changed, 346 insertions(+), 346 deletions(-)

diffs (truncated from 770 to 300 lines):

diff -r b3aaf5accc5b -r 269e8308a0ca sys/arch/cobalt/conf/GENERIC
--- a/sys/arch/cobalt/conf/GENERIC      Mon Apr 09 20:07:22 2018 +0000
+++ b/sys/arch/cobalt/conf/GENERIC      Mon Apr 09 20:16:16 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.157 2018/04/09 19:05:26 christos Exp $
+# $NetBSD: GENERIC,v 1.158 2018/04/09 20:16:16 christos Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.157 $"
+#ident                 "GENERIC-$Revision: 1.158 $"
 
 maxusers       32
 
@@ -146,7 +146,7 @@
 zstty0         at zsc0 channel 0
 zstty1         at zsc0 channel 1
 
-ledpanel0      at mainbus? addr 0x1f000000
+lcdpanel0      at mainbus? addr 0x1f000000
 
 gt0            at mainbus? addr 0x14000000
 
diff -r b3aaf5accc5b -r 269e8308a0ca sys/arch/cobalt/conf/INSTALL
--- a/sys/arch/cobalt/conf/INSTALL      Mon Apr 09 20:07:22 2018 +0000
+++ b/sys/arch/cobalt/conf/INSTALL      Mon Apr 09 20:16:16 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.66 2018/04/09 19:05:26 christos Exp $
+# $NetBSD: INSTALL,v 1.67 2018/04/09 20:16:16 christos Exp $
 #
 # INSTALL -- installation and rescue kernel.
 #
@@ -10,7 +10,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "INSTALL-$Revision: 1.66 $"
+#ident                 "INSTALL-$Revision: 1.67 $"
 
 makeoptions     COPTS="-Os -mmemcpy"
 makeoptions    CPUFLAGS="-march=vr5000 -mabi=32"
@@ -135,7 +135,7 @@
 zstty0         at zsc0 channel 0
 #zstty1                at zsc0 channel 1
 
-ledpanel0      at mainbus? addr 0x1f000000
+lcdpanel0      at mainbus? addr 0x1f000000
 
 gt0            at mainbus? addr 0x14000000
 
diff -r b3aaf5accc5b -r 269e8308a0ca sys/arch/cobalt/conf/files.cobalt
--- a/sys/arch/cobalt/conf/files.cobalt Mon Apr 09 20:07:22 2018 +0000
+++ b/sys/arch/cobalt/conf/files.cobalt Mon Apr 09 20:16:16 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.cobalt,v 1.40 2018/04/09 19:05:26 christos Exp $
+#      $NetBSD: files.cobalt,v 1.41 2018/04/09 20:16:16 christos Exp $
 
 maxpartitions 16
 
@@ -31,9 +31,9 @@
 attach mcclock at mainbus
 file arch/cobalt/dev/mcclock.c         mcclock         needs-flag
 
-device ledpanel: hd44780
-attach ledpanel at mainbus
-file arch/cobalt/dev/panel.c           ledpanel
+device lcdpanel: hd44780
+attach lcdpanel at mainbus
+file arch/cobalt/dev/lcdpanel.c                lcdpanel
 
 device gt: pcibus
 attach gt at mainbus
diff -r b3aaf5accc5b -r 269e8308a0ca sys/arch/cobalt/dev/lcdpanel.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/cobalt/dev/lcdpanel.c    Mon Apr 09 20:16:16 2018 +0000
@@ -0,0 +1,334 @@
+/* $NetBSD: lcdpanel.c,v 1.1 2018/04/09 20:16:16 christos Exp $ */
+
+/*
+ * Copyright (c) 2002 Dennis I. Chernoivanov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: lcdpanel.c,v 1.1 2018/04/09 20:16:16 christos Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/poll.h>
+#include <sys/conf.h>
+#include <sys/uio.h>
+#include <sys/types.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/callout.h>
+#include <sys/select.h>
+#include <sys/reboot.h>
+
+#include <sys/bus.h>
+#include <machine/autoconf.h>
+
+#include <dev/ic/hd44780reg.h>
+#include <dev/ic/hd44780var.h>
+#include <dev/ic/lcdkp_subr.h>
+
+#include "ioconf.h"
+
+#define LCDPANEL_POLLRATE      (hz / 10)
+#define LCDPANEL_REGION        0x20
+#define DATA_OFFSET    0x10
+#define LCDPANEL_COLS  16
+#define LCDPANEL_VCOLS 40
+#define LCDPANEL_ROWS  2
+
+struct lcdpanel_softc {
+       device_t sc_dev;
+
+       struct hd44780_chip sc_lcd;
+       struct lcdkp_chip sc_kp;
+
+       struct selinfo sc_selq;
+       struct callout sc_callout;
+};
+
+struct lcd_message {
+       const char firstcol[LCDPANEL_VCOLS];
+       const char secondcol[LCDPANEL_VCOLS];
+};
+static const struct lcd_message startup_message = {
+       "NetBSD/cobalt   ",
+       "Starting up...  "
+};
+static const struct lcd_message halt_message = {
+       "NetBSD/cobalt   ",
+       "Halting...      "
+};
+static const struct lcd_message reboot_message = {
+       "NetBSD/cobalt   ",
+       "Rebooting...    "
+};
+
+static int     lcdpanel_match(device_t, cfdata_t, void *);
+static void    lcdpanel_attach(device_t, device_t, void *);
+static bool    lcdpanel_shutdown(device_t, int);
+
+static void    lcdpanel_soft(void *);
+
+static uint8_t lcdpanel_cbt_kprread(bus_space_tag_t, bus_space_handle_t);
+static uint8_t lcdpanel_cbt_hdreadreg(struct hd44780_chip *, uint32_t, uint32_t);
+static void    lcdpanel_cbt_hdwritereg(struct hd44780_chip *, uint32_t, uint32_t,
+    uint8_t);
+
+dev_type_open(lcdpanelopen);
+dev_type_close(lcdpanelclose);
+dev_type_read(lcdpanelread);
+dev_type_write(lcdpanelwrite);
+dev_type_ioctl(lcdpanelioctl);
+dev_type_poll(lcdpanelpoll);
+
+const struct cdevsw lcdpanel_cdevsw = {
+       .d_open = lcdpanelopen,
+       .d_close = lcdpanelclose,
+       .d_read = lcdpanelread,
+       .d_write = lcdpanelwrite,
+       .d_ioctl = lcdpanelioctl,
+       .d_stop = nostop,
+       .d_tty = notty,
+       .d_poll = lcdpanelpoll,
+       .d_mmap = nommap,
+       .d_kqfilter = nokqfilter,
+       .d_discard = nodiscard,
+       .d_flag = 0
+};
+
+CFATTACH_DECL_NEW(lcdpanel, sizeof(struct lcdpanel_softc),
+    lcdpanel_match, lcdpanel_attach, NULL, NULL);
+
+static int
+lcdpanel_match(device_t parent, cfdata_t cf, void *aux)
+{
+
+       return 1;
+}
+
+static void
+lcdpanel_attach(device_t parent, device_t self, void *aux)
+{
+       struct lcdpanel_softc *sc = device_private(self);
+       struct mainbus_attach_args *maa = aux;
+       struct hd44780_io io;
+       static struct lcdkp_xlate keys[] = {
+               { 0xfa, 'h' },
+               { 0xf6, 'k' },
+               { 0xde, 'l' },
+               { 0xee, 'j' },
+               { 0x7e, 's' },
+               { 0xbe, 'e' }
+       };
+
+       sc->sc_lcd.sc_dev = self;
+       sc->sc_lcd.sc_iot = maa->ma_iot;
+       if (bus_space_map(sc->sc_lcd.sc_iot, maa->ma_addr, LCDPANEL_REGION,
+           0, &sc->sc_lcd.sc_ioir)) {
+               aprint_error(": unable to map registers\n");
+               return;
+       }
+       bus_space_subregion(sc->sc_lcd.sc_iot, sc->sc_lcd.sc_ioir, DATA_OFFSET,
+           1, &sc->sc_lcd.sc_iodr);
+
+       printf("\n");
+
+       sc->sc_lcd.sc_dev_ok = 1;
+       sc->sc_lcd.sc_cols = LCDPANEL_COLS;
+       sc->sc_lcd.sc_vcols = LCDPANEL_VCOLS;
+       sc->sc_lcd.sc_flags = HD_8BIT | HD_MULTILINE | HD_KEYPAD;
+
+       sc->sc_lcd.sc_writereg = lcdpanel_cbt_hdwritereg;
+       sc->sc_lcd.sc_readreg = lcdpanel_cbt_hdreadreg;
+
+       hd44780_attach_subr(&sc->sc_lcd);
+
+       /* Hello World */
+       io.dat = 0;
+       io.len = LCDPANEL_VCOLS * LCDPANEL_ROWS;
+       memcpy(io.buf, &startup_message, io.len);
+       hd44780_ddram_io(&sc->sc_lcd, sc->sc_lcd.sc_curchip, &io,
+           HD_DDRAM_WRITE);
+
+       pmf_device_register1(self, NULL, NULL, lcdpanel_shutdown);
+
+       sc->sc_kp.sc_iot = maa->ma_iot;
+       sc->sc_kp.sc_ioh = MIPS_PHYS_TO_KSEG1(LCDPANEL_BASE); /* XXX */
+
+       sc->sc_kp.sc_knum = sizeof(keys) / sizeof(struct lcdkp_xlate);
+       sc->sc_kp.sc_kpad = keys;
+       sc->sc_kp.sc_rread = lcdpanel_cbt_kprread;
+
+       lcdkp_attach_subr(&sc->sc_kp);
+
+       callout_init(&sc->sc_callout, 0);
+       selinit(&sc->sc_selq);
+}
+
+static bool
+lcdpanel_shutdown(device_t self, int howto)
+{
+       struct lcdpanel_softc *sc = device_private(self);
+       struct hd44780_io io;
+
+       /* Goodbye World */
+       io.dat = 0;
+       io.len = LCDPANEL_VCOLS * LCDPANEL_ROWS;
+       if (howto & RB_HALT)
+               memcpy(io.buf, &halt_message, io.len);
+       else
+               memcpy(io.buf, &reboot_message, io.len);
+       hd44780_ddram_io(&sc->sc_lcd, sc->sc_lcd.sc_curchip, &io,
+           HD_DDRAM_WRITE);
+
+       return true;
+}
+
+static uint8_t
+lcdpanel_cbt_kprread(bus_space_tag_t iot, bus_space_handle_t ioh)
+{
+
+       delay(HD_TIMEOUT_NORMAL);
+       return (bus_space_read_4(iot, ioh, 0x00) >> 24) & 0xff;
+}
+
+
+static void
+lcdpanel_cbt_hdwritereg(struct hd44780_chip *hd, uint32_t en, uint32_t rs,



Home | Main Index | Thread Index | Old Index