summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-03-01 11:57:52 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-03-01 11:57:52 +0000
commit2449ed33d4e23801606c4c42f199be052c3ae8fa (patch)
treeb5f40952ca5986cc24b72952e9bd88822b30beac /sys
parentab9fc1c7b93ab11bf0d6252ebfbbf3cf05b9b54f (diff)
More readable DAC programming.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc/dev/rfx.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/arch/sparc/dev/rfx.c b/sys/arch/sparc/dev/rfx.c
index c17dbd29cc7..b585a2eeae1 100644
--- a/sys/arch/sparc/dev/rfx.c
+++ b/sys/arch/sparc/dev/rfx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rfx.c,v 1.2 2004/03/01 07:53:01 miod Exp $ */
+/* $OpenBSD: rfx.c,v 1.3 2004/03/01 11:57:51 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
@@ -57,6 +57,8 @@
#include <sparc/dev/sbusvar.h>
+#include <dev/ic/bt463reg.h>
+
/*
* Configuration structure
*/
@@ -485,14 +487,19 @@ rfx_putcmap(struct rfx_cmap *cm, struct wsdisplay_cmap *rcm)
void
rfx_loadcmap(struct rfx_softc *sc, int start, int ncolors)
{
+ u_int8_t *r, *g, *b;
+
+ r = sc->sc_cmap.red + start;
+ g = sc->sc_cmap.green + start;
+ b = sc->sc_cmap.blue + start;
- sc->sc_ramdac[0] = (start & 0xff);
- sc->sc_ramdac[1] = 0;
+ start += BT463_IREG_CPALETTE_RAM;
+ sc->sc_ramdac[BT463_REG_ADDR_LOW] = start & 0xff;
+ sc->sc_ramdac[BT463_REG_ADDR_HIGH] = (start >> 8) & 0xff;
while (ncolors-- != 0) {
- sc->sc_ramdac[3] = sc->sc_cmap.red[start];
- sc->sc_ramdac[3] = sc->sc_cmap.green[start];
- sc->sc_ramdac[3] = sc->sc_cmap.blue[start];
- start++;
+ sc->sc_ramdac[BT463_REG_CMAP_DATA] = *r++;
+ sc->sc_ramdac[BT463_REG_CMAP_DATA] = *g++;
+ sc->sc_ramdac[BT463_REG_CMAP_DATA] = *b++;
}
}