Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/tc - Rework copycols() with SFB ASIC calls.
details: https://anonhg.NetBSD.org/src/rev/0080653a312e
branches: trunk
changeset: 473637:0080653a312e
user: nisimura <nisimura%NetBSD.org@localhost>
date: Fri Jun 11 00:56:09 1999 +0000
description:
- Rework copycols() with SFB ASIC calls.
diffstat:
sys/dev/tc/sfb.c | 293 +++++++++++++++++++++++++++++++++++-------------------
1 files changed, 190 insertions(+), 103 deletions(-)
diffs (truncated from 460 to 300 lines):
diff -r 9e7397b980ad -r 0080653a312e sys/dev/tc/sfb.c
--- a/sys/dev/tc/sfb.c Thu Jun 10 23:40:53 1999 +0000
+++ b/sys/dev/tc/sfb.c Fri Jun 11 00:56:09 1999 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: sfb.c,v 1.15 1999/05/07 08:00:31 nisimura Exp $ */
+/* $NetBSD: sfb.c,v 1.16 1999/06/11 00:56:09 nisimura Exp $ */
/*
- * Copyright (c) 1998 Tohru Nishimura. All rights reserved.
+ * Copyright (c) 1998, 1999 Tohru Nishimura. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: sfb.c,v 1.15 1999/05/07 08:00:31 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sfb.c,v 1.16 1999/06/11 00:56:09 nisimura Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -57,8 +57,6 @@
#include <uvm/uvm_extern.h>
-/* XXX BUS'IFYING XXX */
-
#if defined(pmax)
#define machine_btop(x) mips_btop(x)
#define MACHINE_KSEG0_TO_PHYS(x) MIPS_KSEG1_TO_PHYS(x)
@@ -82,15 +80,26 @@
* } bt_lo;
* ...
* Although HX has single Bt459, 32bit R/W can be done w/o any trouble.
+ * struct bt459reg {
+ * u_int32_t bt_lo;
+ * u_int32_t bt_hi;
+ * u_int32_t bt_reg;
+ * u_int32_t bt_cmap;
+ * };
+ *
*/
-struct bt459reg {
- u_int32_t bt_lo;
- u_int32_t bt_hi;
- u_int32_t bt_reg;
- u_int32_t bt_cmap;
-};
+
+#define bt_lo 0
+#define bt_hi 1
+#define bt_reg 2
+#define bt_cmap 3
-/* XXX XXX XXX */
+#define REG(base, index) *((u_int32_t *)(base) + (index))
+#define SELECT(vdac, regno) do { \
+ REG(vdac, bt_lo) = ((regno) & 0x00ff); \
+ REG(vdac, bt_hi) = ((regno) & 0x0f00) >> 8; \
+ tc_wmb(); \
+ } while (0)
struct fb_devconfig {
vaddr_t dc_vaddr; /* memory space virtual base address */
@@ -216,13 +225,6 @@
static void set_curpos __P((struct sfb_softc *, struct wsdisplay_curpos *));
static void bt459_set_curpos __P((struct sfb_softc *));
-/* XXX XXX XXX */
-#define BT459_SELECT(vdac, regno) do { \
- vdac->bt_lo = (regno) & 0x00ff; \
- vdac->bt_hi = ((regno)& 0x0f00) >> 8; \
- tc_wmb(); \
- } while (0)
-/* XXX XXX XXX */
/*
* Compose 2 bit/pixel cursor image. Bit order will be reversed.
@@ -529,7 +531,7 @@
struct sfb_softc *sc = arg;
caddr_t sfbbase = (caddr_t)sc->sc_dc->dc_vaddr;
caddr_t sfbasic = sfbbase + SFB_ASIC_OFFSET;
- struct bt459reg *vdac;
+ caddr_t vdac;
int v;
*(u_int32_t *)(sfbasic + SFB_ASIC_CLEAR_INTR) = 0;
@@ -543,20 +545,20 @@
sc->sc_changed = 0;
if (v & DATA_ENB_CHANGED) {
- BT459_SELECT(vdac, BT459_REG_CCR);
- vdac->bt_reg = (sc->sc_curenb) ? 0xc0 : 0x00;
+ SELECT(vdac, BT459_REG_CCR);
+ REG(vdac, bt_reg) = (sc->sc_curenb) ? 0xc0 : 0x00;
}
if (v & DATA_CURCMAP_CHANGED) {
u_int8_t *cp = sc->sc_cursor.cc_color;
- BT459_SELECT(vdac, BT459_REG_CCOLOR_2);
- vdac->bt_reg = cp[1]; tc_wmb();
- vdac->bt_reg = cp[3]; tc_wmb();
- vdac->bt_reg = cp[5]; tc_wmb();
+ SELECT(vdac, BT459_REG_CCOLOR_2);
+ REG(vdac, bt_reg) = cp[1]; tc_wmb();
+ REG(vdac, bt_reg) = cp[3]; tc_wmb();
+ REG(vdac, bt_reg) = cp[5]; tc_wmb();
- vdac->bt_reg = cp[0]; tc_wmb();
- vdac->bt_reg = cp[2]; tc_wmb();
- vdac->bt_reg = cp[4]; tc_wmb();
+ REG(vdac, bt_reg) = cp[0]; tc_wmb();
+ REG(vdac, bt_reg) = cp[2]; tc_wmb();
+ REG(vdac, bt_reg) = cp[4]; tc_wmb();
}
if (v & DATA_CURSHAPE_CHANGED) {
u_int8_t *ip, *mp, img, msk;
@@ -567,29 +569,29 @@
mp = (u_int8_t *)(sc->sc_cursor.cc_image + CURSOR_MAX_SIZE);
bcnt = 0;
- BT459_SELECT(vdac, BT459_REG_CRAM_BASE+0);
+ SELECT(vdac, BT459_REG_CRAM_BASE+0);
/* 64 pixel scan line is consisted with 16 byte cursor ram */
while (bcnt < sc->sc_cursor.cc_size.y * 16) {
/* pad right half 32 pixel when smaller than 33 */
if ((bcnt & 0x8) && sc->sc_cursor.cc_size.x < 33) {
- vdac->bt_reg = 0; tc_wmb();
- vdac->bt_reg = 0; tc_wmb();
+ REG(vdac, bt_reg) = 0; tc_wmb();
+ REG(vdac, bt_reg) = 0; tc_wmb();
}
else {
img = *ip++;
msk = *mp++;
img &= msk; /* cookie off image */
u = (msk & 0x0f) << 4 | (img & 0x0f);
- vdac->bt_reg = shuffle[u]; tc_wmb();
+ REG(vdac, bt_reg) = shuffle[u]; tc_wmb();
u = (msk & 0xf0) | (img & 0xf0) >> 4;
- vdac->bt_reg = shuffle[u]; tc_wmb();
+ REG(vdac, bt_reg) = shuffle[u]; tc_wmb();
}
bcnt += 2;
}
/* pad unoccupied scan lines */
while (bcnt < CURSOR_MAX_SIZE * 16) {
- vdac->bt_reg = 0; tc_wmb();
- vdac->bt_reg = 0; tc_wmb();
+ REG(vdac, bt_reg) = 0; tc_wmb();
+ REG(vdac, bt_reg) = 0; tc_wmb();
bcnt += 2;
}
}
@@ -597,11 +599,11 @@
struct hwcmap256 *cm = &sc->sc_cmap;
int index;
- BT459_SELECT(vdac, 0);
+ SELECT(vdac, 0);
for (index = 0; index < CMAP_SIZE; index++) {
- vdac->bt_cmap = cm->r[index]; tc_wmb();
- vdac->bt_cmap = cm->g[index]; tc_wmb();
- vdac->bt_cmap = cm->b[index]; tc_wmb();
+ REG(vdac, bt_cmap) = cm->r[index]; tc_wmb();
+ REG(vdac, bt_cmap) = cm->g[index]; tc_wmb();
+ REG(vdac, bt_cmap) = cm->b[index]; tc_wmb();
}
}
return (1);
@@ -612,7 +614,7 @@
struct fb_devconfig *dc;
{
caddr_t sfbasic = (caddr_t)(dc->dc_vaddr + SFB_ASIC_OFFSET);
- struct bt459reg *vdac = (void *)(dc->dc_vaddr + SFB_RAMDAC_OFFSET);
+ caddr_t vdac = (void *)(dc->dc_vaddr + SFB_RAMDAC_OFFSET);
int i;
*(u_int32_t *)(sfbasic + SFB_ASIC_VIDEO_VALID) = 0;
@@ -623,67 +625,67 @@
*(u_int32_t *)(sfbasic + 0x180000) = 0; /* Bt459 reset */
- BT459_SELECT(vdac, BT459_REG_COMMAND_0);
- vdac->bt_reg = 0x40; /* CMD0 */ tc_wmb();
- vdac->bt_reg = 0x0; /* CMD1 */ tc_wmb();
- vdac->bt_reg = 0xc0; /* CMD2 */ tc_wmb();
- vdac->bt_reg = 0xff; /* PRM */ tc_wmb();
- vdac->bt_reg = 0; /* 205 */ tc_wmb();
- vdac->bt_reg = 0x0; /* PBM */ tc_wmb();
- vdac->bt_reg = 0; /* 207 */ tc_wmb();
- vdac->bt_reg = 0x0; /* ORM */ tc_wmb();
- vdac->bt_reg = 0x0; /* OBM */ tc_wmb();
- vdac->bt_reg = 0x0; /* ILV */ tc_wmb();
- vdac->bt_reg = 0x0; /* TEST */ tc_wmb();
+ SELECT(vdac, BT459_REG_COMMAND_0);
+ REG(vdac, bt_reg) = 0x40; /* CMD0 */ tc_wmb();
+ REG(vdac, bt_reg) = 0x0; /* CMD1 */ tc_wmb();
+ REG(vdac, bt_reg) = 0xc0; /* CMD2 */ tc_wmb();
+ REG(vdac, bt_reg) = 0xff; /* PRM */ tc_wmb();
+ REG(vdac, bt_reg) = 0; /* 205 */ tc_wmb();
+ REG(vdac, bt_reg) = 0x0; /* PBM */ tc_wmb();
+ REG(vdac, bt_reg) = 0; /* 207 */ tc_wmb();
+ REG(vdac, bt_reg) = 0x0; /* ORM */ tc_wmb();
+ REG(vdac, bt_reg) = 0x0; /* OBM */ tc_wmb();
+ REG(vdac, bt_reg) = 0x0; /* ILV */ tc_wmb();
+ REG(vdac, bt_reg) = 0x0; /* TEST */ tc_wmb();
- BT459_SELECT(vdac, BT459_REG_CCR);
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
- vdac->bt_reg = 0x0; tc_wmb();
+ SELECT(vdac, BT459_REG_CCR);
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
+ REG(vdac, bt_reg) = 0x0; tc_wmb();
/* build sane colormap */
- BT459_SELECT(vdac, 0);
- vdac->bt_cmap = 0; tc_wmb();
- vdac->bt_cmap = 0; tc_wmb();
- vdac->bt_cmap = 0; tc_wmb();
+ SELECT(vdac, 0);
+ REG(vdac, bt_cmap) = 0; tc_wmb();
+ REG(vdac, bt_cmap) = 0; tc_wmb();
+ REG(vdac, bt_cmap) = 0; tc_wmb();
for (i = 1; i < CMAP_SIZE; i++) {
- vdac->bt_cmap = 0xff; tc_wmb();
- vdac->bt_cmap = 0xff; tc_wmb();
- vdac->bt_cmap = 0xff; tc_wmb();
+ REG(vdac, bt_cmap) = 0xff; tc_wmb();
+ REG(vdac, bt_cmap) = 0xff; tc_wmb();
+ REG(vdac, bt_cmap) = 0xff; tc_wmb();
}
/* clear out cursor image */
- BT459_SELECT(vdac, BT459_REG_CRAM_BASE);
+ SELECT(vdac, BT459_REG_CRAM_BASE);
for (i = 0; i < 1024; i++)
- vdac->bt_reg = 0xff; tc_wmb();
+ REG(vdac, bt_reg) = 0xff; tc_wmb();
/*
* 2 bit/pixel cursor. Assign MSB for cursor mask and LSB for
* cursor image. CCOLOR_2 for mask color, while CCOLOR_3 for
* image color. CCOLOR_1 will be never used.
*/
- BT459_SELECT(vdac, BT459_REG_CCOLOR_1);
- vdac->bt_reg = 0xff; tc_wmb();
- vdac->bt_reg = 0xff; tc_wmb();
- vdac->bt_reg = 0xff; tc_wmb();
+ SELECT(vdac, BT459_REG_CCOLOR_1);
+ REG(vdac, bt_reg) = 0xff; tc_wmb();
+ REG(vdac, bt_reg) = 0xff; tc_wmb();
+ REG(vdac, bt_reg) = 0xff; tc_wmb();
- vdac->bt_reg = 0; tc_wmb();
- vdac->bt_reg = 0; tc_wmb();
- vdac->bt_reg = 0; tc_wmb();
+ REG(vdac, bt_reg) = 0; tc_wmb();
+ REG(vdac, bt_reg) = 0; tc_wmb();
+ REG(vdac, bt_reg) = 0; tc_wmb();
- vdac->bt_reg = 0xff; tc_wmb();
- vdac->bt_reg = 0xff; tc_wmb();
- vdac->bt_reg = 0xff; tc_wmb();
+ REG(vdac, bt_reg) = 0xff; tc_wmb();
+ REG(vdac, bt_reg) = 0xff; tc_wmb();
+ REG(vdac, bt_reg) = 0xff; tc_wmb();
}
static int
@@ -824,7 +826,7 @@
struct sfb_softc *sc;
{
caddr_t sfbbase = (caddr_t)sc->sc_dc->dc_vaddr;
- struct bt459reg *vdac = (void *)(sfbbase + SFB_RAMDAC_OFFSET);
+ caddr_t vdac = (void *)(sfbbase + SFB_RAMDAC_OFFSET);
int x, y, s;
Home |
Main Index |
Thread Index |
Old Index