Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/cobalt/dev Replace the rwrite and rread functions t...
details: https://anonhg.NetBSD.org/src/rev/bab2e16846ae
branches: trunk
changeset: 572585:bab2e16846ae
user: joff <joff%NetBSD.org@localhost>
date: Sat Jan 08 20:21:00 2005 +0000
description:
Replace the rwrite and rread functions that take a bus_space_tag_t and
bus_space_handle_t with the new writereg and readreg
functions that take a struct hd44780_chip * and a u_int32_t rs (register-select)
diffstat:
sys/arch/cobalt/dev/panel.c | 52 ++++++++++++++++++++++++++++++--------------
1 files changed, 35 insertions(+), 17 deletions(-)
diffs (101 lines):
diff -r 80bdfe39d1a5 -r bab2e16846ae sys/arch/cobalt/dev/panel.c
--- a/sys/arch/cobalt/dev/panel.c Sat Jan 08 20:19:08 2005 +0000
+++ b/sys/arch/cobalt/dev/panel.c Sat Jan 08 20:21:00 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: panel.c,v 1.3 2003/09/12 14:59:14 tsutsui Exp $ */
+/* $NetBSD: panel.c,v 1.4 2005/01/08 20:21:00 joff Exp $ */
/*
* Copyright (c) 2002 Dennis I. Chernoivanov
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.3 2003/09/12 14:59:14 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: panel.c,v 1.4 2005/01/08 20:21:00 joff Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,8 +68,9 @@
static void panel_soft(void *);
-static void panel_cbt_rwrite(bus_space_tag_t, bus_space_handle_t, u_int8_t);
-static u_int8_t panel_cbt_rread(bus_space_tag_t, bus_space_handle_t);
+static u_int8_t panel_cbt_kprread(bus_space_tag_t, bus_space_handle_t);
+static u_int8_t panel_cbt_hdreadreg(struct hd44780_chip *, u_int32_t);
+static void panel_cbt_hdwritereg(struct hd44780_chip *, u_int32_t, u_int8_t);
dev_type_open(panelopen);
dev_type_close(panelclose);
@@ -125,8 +126,9 @@
sc->sc_lcd.sc_vrows = 40;
sc->sc_lcd.sc_flags = HD_8BIT | HD_MULTILINE | HD_KEYPAD;
- sc->sc_lcd.sc_rwrite = panel_cbt_rwrite;
- sc->sc_lcd.sc_rread = panel_cbt_rread;
+ sc->sc_lcd.sc_writereg = panel_cbt_hdwritereg;
+ sc->sc_lcd.sc_readreg = panel_cbt_hdreadreg;
+ sc->sc_lcd.sc_dev = self;
hd44780_attach_subr(&sc->sc_lcd);
@@ -135,7 +137,7 @@
sc->sc_kp.sc_knum = sizeof(keys) / sizeof(struct lcdkp_xlate);
sc->sc_kp.sc_kpad = keys;
- sc->sc_kp.sc_rread = panel_cbt_rread;
+ sc->sc_kp.sc_rread = panel_cbt_kprread;
lcdkp_attach_subr(&sc->sc_kp);
@@ -144,23 +146,39 @@
printf("\n");
}
-static void
-panel_cbt_rwrite(iot, ioh, cmd)
+static u_int8_t
+panel_cbt_kprread(iot, ioh)
bus_space_tag_t iot;
bus_space_handle_t ioh;
- u_int8_t cmd;
{
- bus_space_write_4(iot, ioh, 0x00, cmd << 24);
- delay(TIMEOUT_NORMAL);
+ delay(HD_TIMEOUT_NORMAL);
+ return (bus_space_read_4(iot, ioh, 0x00) >> 24) & 0xff;
+}
+
+
+static void
+panel_cbt_hdwritereg(hd, rs, dat)
+ struct hd44780_chip *hd;
+ u_int32_t rs;
+ u_int8_t dat;
+{
+ if (rs)
+ bus_space_write_4(hd->sc_iot, hd->sc_iodr, 0x00, dat << 24);
+ else
+ bus_space_write_4(hd->sc_iot, hd->sc_ioir, 0x00, dat << 24);
+ delay(HD_TIMEOUT_NORMAL);
}
static u_int8_t
-panel_cbt_rread(iot, ioh)
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
+panel_cbt_hdreadreg(hd, rs)
+ struct hd44780_chip *hd;
+ u_int32_t rs;
{
- delay(TIMEOUT_NORMAL);
- return (bus_space_read_4(iot, ioh, 0x00) >> 24) & 0xff;
+ delay(HD_TIMEOUT_NORMAL);
+ if (rs)
+ return (bus_space_read_4(hd->sc_iot, hd->sc_iodr, 0x00) >> 24) & 0xff;
+ else
+ return (bus_space_read_4(hd->sc_iot, hd->sc_ioir, 0x00) >> 24) & 0xff;
}
int
Home |
Main Index |
Thread Index |
Old Index