- Change prefix for Bt459 register defs to BT459_IREG to indicate that

these are indirectly accessed registers.
- Add defs for directly accessed registers to bt459reg.h.
This commit is contained in:
ad 1999-12-15 15:09:36 +00:00
parent f458e50bdf
commit f607dfe4dd
5 changed files with 102 additions and 83 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: px.c,v 1.22 1999/12/08 21:38:10 ad Exp $ */
/* $NetBSD: px.c,v 1.23 1999/12/15 15:09:38 ad Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
#endif
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.22 1999/12/08 21:38:10 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: px.c,v 1.23 1999/12/15 15:09:38 ad Exp $");
/*
* px.c: driver for the DEC TURBOchannel 2D and 3D accelerated framebuffers
@ -474,7 +474,7 @@ px_bt459_init(pxi)
int i;
/* Hit it... */
BT459_SELECT(vdac, BT459_REG_COMMAND_0);
BT459_SELECT(vdac, BT459_IREG_COMMAND_0);
BT459_WRITE_REG(vdac, 0xc0c0c0);
/* Now reset the VDAC */
@ -486,7 +486,7 @@ px_bt459_init(pxi)
tc_wmb();
/* Finish the initalization */
BT459_SELECT(vdac, BT459_REG_COMMAND_1);
BT459_SELECT(vdac, BT459_IREG_COMMAND_1);
BT459_WRITE_REG(vdac, 0x000000);
BT459_WRITE_REG(vdac, 0xc2c2c2);
BT459_WRITE_REG(vdac, 0xffffff);
@ -495,7 +495,7 @@ px_bt459_init(pxi)
BT459_WRITE_REG(vdac, 0);
/* Set cursor colormap */
BT459_SELECT(vdac, BT459_REG_CCOLOR_1);
BT459_SELECT(vdac, BT459_IREG_CCOLOR_1);
BT459_WRITE_REG(vdac, 0xffffff);
BT459_WRITE_REG(vdac, 0xffffff);
BT459_WRITE_REG(vdac, 0xffffff);
@ -522,11 +522,11 @@ px_bt459_init(pxi)
px_load_cursor(pxi);
/* Enable cursor */
BT459_SELECT(vdac, BT459_REG_CCR);
BT459_SELECT(vdac, BT459_IREG_CCR);
BT459_WRITE_REG(vdac, 0x1c1c1c1);
pxi->pxi_flg |= PX_CURSOR_ENABLE;
} else {
BT459_SELECT(vdac, BT459_REG_CCR);
BT459_SELECT(vdac, BT459_IREG_CCR);
BT459_WRITE_REG(vdac, 0);
}
}
@ -549,7 +549,7 @@ px_probe_planes(pxi, buf)
* VDAC ID. One color is active at level 0x4a for 8 bits, all
* colors are active at 0x4a on the 24 bit cards.
*/
BT459_SELECT(pxi->pxi_vdac, BT459_REG_ID);
BT459_SELECT(pxi->pxi_vdac, BT459_IREG_ID);
i = pxi->pxi_vdac->reg & 0x00ffffff;
/* 3 VDACs */
@ -780,7 +780,7 @@ px_load_cursor_data(pxi, pos, val)
val = DUPBYTE0(val);
for (cnt = 10; cnt; cnt--) {
BT459_SELECT(vdac, BT459_REG_CRAM_BASE + pos);
BT459_SELECT(vdac, BT459_IREG_CRAM_BASE + pos);
BT459_WRITE_REG(vdac, val);
if ((BT459_READ_REG(vdac) & pxi->pxi_planemask) == val)
@ -805,7 +805,7 @@ px_load_cursor(pxi)
mp = pxi->pxi_cursor + (sizeof(pxi->pxi_cursor) >> 1);
bcnt = 0;
BT459_SELECT(vdac, BT459_REG_CRAM_BASE + 0);
BT459_SELECT(vdac, BT459_IREG_CRAM_BASE + 0);
/* 64 pixel scan line is made with 8 bytes of cursor RAM */
while (bcnt < sizeof(pxi->pxi_cursor)) {
@ -862,7 +862,7 @@ px_bt459_flush(pxi)
vdac = pxi->pxi_vdac;
if (pxi->pxi_dirty & PX_DIRTY_CURSOR_POS) {
BT459_SELECT(vdac, BT459_REG_CURSOR_X_LOW);
BT459_SELECT(vdac, BT459_IREG_CURSOR_X_LOW);
BT459_WRITE_REG(vdac, DUPBYTE0(pxi->pxi_curx));
BT459_WRITE_REG(vdac, DUPBYTE1(pxi->pxi_curx));
BT459_WRITE_REG(vdac, DUPBYTE0(pxi->pxi_cury));
@ -875,7 +875,7 @@ px_bt459_flush(pxi)
if (pxi->pxi_dirty & PX_DIRTY_CURSOR_CMAP) {
cp = pxi->pxi_curcmap;
BT459_SELECT(vdac, BT459_REG_CCOLOR_1);
BT459_SELECT(vdac, BT459_IREG_CCOLOR_1);
BT459_WRITE_REG(vdac, DUPBYTE0(cp[3]));
BT459_WRITE_REG(vdac, DUPBYTE0(cp[4]));
BT459_WRITE_REG(vdac, DUPBYTE0(cp[5]));
@ -889,12 +889,12 @@ px_bt459_flush(pxi)
if (pxi->pxi_dirty & PX_DIRTY_ENABLE) {
if (pxi->pxi_flg & PX_ENABLE) {
BT459_SELECT(vdac, BT459_REG_PRM);
BT459_SELECT(vdac, BT459_IREG_PRM);
BT459_WRITE_REG(vdac, 0xffffff);
px_load_cmap(pxi, 0, 1);
pxi->pxi_dirty |= PX_DIRTY_CURSOR_ENABLE;
} else {
BT459_SELECT(vdac, BT459_REG_PRM);
BT459_SELECT(vdac, BT459_IREG_PRM);
BT459_WRITE_REG(vdac, 0);
BT459_SELECT(vdac, 0);
@ -902,7 +902,7 @@ px_bt459_flush(pxi)
BT459_WRITE_CMAP(vdac, 0);
BT459_WRITE_CMAP(vdac, 0);
BT459_SELECT(vdac, BT459_REG_CCR);
BT459_SELECT(vdac, BT459_IREG_CCR);
BT459_WRITE_REG(vdac, 0);
}
}
@ -922,7 +922,7 @@ px_bt459_flush(pxi)
} else
i = 0;
BT459_SELECT(vdac, BT459_REG_CCR);
BT459_SELECT(vdac, BT459_IREG_CCR);
BT459_WRITE_REG(vdac, i);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: bt459reg.h,v 1.1 1998/10/28 04:10:36 nisimura Exp $ */
/* $NetBSD: bt459reg.h,v 1.2 1999/12/15 15:09:36 ad Exp $ */
/*
* Mach Operating System
@ -30,39 +30,58 @@
* Register definitions for the Brooktree Bt459 135 MHz Monolithic
* CMOS 256x64 Color Palette RAMDAC.
*/
/* 0000-00ff Color Map entries */
#define BT459_REG_CCOLOR_1 0x0181 /* Cursor color regs */
#define BT459_REG_CCOLOR_2 0x0182
#define BT459_REG_CCOLOR_3 0x0183
#define BT459_REG_ID 0x0200 /* read-only, gives "4a" */
#define BT459_REG_COMMAND_0 0x0201
#define BT459_REG_COMMAND_1 0x0202
#define BT459_REG_COMMAND_2 0x0203
#define BT459_REG_PRM 0x0204
/*
* Directly-accessible registers. Note the address register is
* auto-incrementing.
*/
#define BT459_REG_ADDR_LOW 0x00 /* C1,C0 == 0,0 */
#define BT459_REG_ADDR_HIGH 0x01 /* C1,C0 == 0,1 */
#define BT459_REG_IREG_DATA 0x02 /* C1,C0 == 1,0 */
#define BT459_REG_CMAP_DATA 0x03 /* C1,C0 == 1,1 */
#define BT459_REG_MAX BT459_REG_CMAP_DATA
/*
* All internal register access to the Bt459 is done indirectly via the
* Address Register (mapped into the host bus in a device-specific
* fashion). The following register definitions are in terms of
* their address register address values.
*/
/* 0000-00ff colormap entries */
#define BT459_IREG_CCOLOR_1 0x0181 /* Cursor color regs */
#define BT459_IREG_CCOLOR_2 0x0182
#define BT459_IREG_CCOLOR_3 0x0183
#define BT459_IREG_ID 0x0200 /* read-only, gives "4a" */
#define BT459_IREG_COMMAND_0 0x0201
#define BT459_IREG_COMMAND_1 0x0202
#define BT459_IREG_COMMAND_2 0x0203
#define BT459_IREG_PRM 0x0204
/* 0205 reserved */
#define BT459_REG_PBM 0x0206
#define BT459_IREG_PBM 0x0206
/* 0207 reserved */
#define BT459_REG_ORM 0x0208
#define BT459_REG_OBM 0x0209
#define BT459_REG_ILV 0x020a
#define BT459_REG_TEST 0x020b
#define BT459_REG_RSIG 0x020c
#define BT459_REG_GSIG 0x020d
#define BT459_REG_BSIG 0x020e
#define BT459_IREG_ORM 0x0208
#define BT459_IREG_OBM 0x0209
#define BT459_IREG_ILV 0x020a
#define BT459_IREG_TEST 0x020b
#define BT459_IREG_RSIG 0x020c
#define BT459_IREG_GSIG 0x020d
#define BT459_IREG_BSIG 0x020e
/* 020f-02ff reserved */
#define BT459_REG_CCR 0x0300
#define BT459_REG_CURSOR_X_LOW 0x0301
#define BT459_REG_CURSOR_X_HIGH 0x0302
#define BT459_REG_CURSOR_Y_LOW 0x0303
#define BT459_REG_CURSOR_Y_HIGH 0x0304
#define BT459_REG_WXLO 0x0305
#define BT459_REG_WXHI 0x0306
#define BT459_REG_WYLO 0x0307
#define BT459_REG_WYHI 0x0308
#define BT459_REG_WWLO 0x0309
#define BT459_REG_WWHI 0x030a
#define BT459_REG_WHLO 0x030b
#define BT459_REG_WHHI 0x030c
#define BT459_IREG_CCR 0x0300
#define BT459_IREG_CURSOR_X_LOW 0x0301
#define BT459_IREG_CURSOR_X_HIGH 0x0302
#define BT459_IREG_CURSOR_Y_LOW 0x0303
#define BT459_IREG_CURSOR_Y_HIGH 0x0304
#define BT459_IREG_WXLO 0x0305
#define BT459_IREG_WXHI 0x0306
#define BT459_IREG_WYLO 0x0307
#define BT459_IREG_WYHI 0x0308
#define BT459_IREG_WWLO 0x0309
#define BT459_IREG_WWHI 0x030a
#define BT459_IREG_WHLO 0x030b
#define BT459_IREG_WHHI 0x030c
/* 030d-03ff reserved */
#define BT459_REG_CRAM_BASE 0x0400
#define BT459_IREG_CRAM_BASE 0x0400

View File

@ -1,4 +1,4 @@
/* $NetBSD: cfb.c,v 1.16 1999/12/08 09:41:24 nisimura Exp $ */
/* $NetBSD: cfb.c,v 1.17 1999/12/15 15:09:37 ad Exp $ */
/*
* Copyright (c) 1998, 1999 Tohru Nishimura. All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.16 1999/12/08 09:41:24 nisimura Exp $");
__KERNEL_RCSID(0, "$NetBSD: cfb.c,v 1.17 1999/12/15 15:09:37 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -534,13 +534,13 @@ cfbintr(arg)
v = sc->sc_changed;
sc->sc_changed = 0;
if (v & DATA_ENB_CHANGED) {
SELECT(vdac, BT459_REG_CCR);
SELECT(vdac, BT459_IREG_CCR);
REG(vdac, bt_reg) = (sc->sc_curenb) ? 0xc0 : 0x00;
}
if (v & DATA_CURCMAP_CHANGED) {
u_int8_t *cp = sc->sc_cursor.cc_color;
SELECT(vdac, BT459_REG_CCOLOR_2);
SELECT(vdac, BT459_IREG_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();
@ -558,7 +558,7 @@ cfbintr(arg)
mp = (u_int8_t *)(sc->sc_cursor.cc_image + CURSOR_MAX_SIZE);
bcnt = 0;
SELECT(vdac, BT459_REG_CRAM_BASE+0);
SELECT(vdac, BT459_IREG_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 */
@ -606,7 +606,7 @@ cfbinit(dc)
struct bt459reg *vdac = (void *)(cfbbase + CX_BT459_OFFSET);
int i;
SELECT(vdac, BT459_REG_COMMAND_0);
SELECT(vdac, BT459_IREG_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();
@ -619,7 +619,7 @@ cfbinit(dc)
REG(vdac, bt_reg) = 0x0; /* ILV */ tc_wmb();
REG(vdac, bt_reg) = 0x0; /* TEST */ tc_wmb();
SELECT(vdac, BT459_REG_CCR);
SELECT(vdac, BT459_IREG_CCR);
REG(vdac, bt_reg) = 0x0; tc_wmb();
REG(vdac, bt_reg) = 0x0; tc_wmb();
REG(vdac, bt_reg) = 0x0; tc_wmb();
@ -646,7 +646,7 @@ cfbinit(dc)
}
/* clear out cursor image */
SELECT(vdac, BT459_REG_CRAM_BASE);
SELECT(vdac, BT459_IREG_CRAM_BASE);
for (i = 0; i < 1024; i++)
REG(vdac, bt_reg) = 0xff; tc_wmb();
@ -655,7 +655,7 @@ cfbinit(dc)
* cursor image. CCOLOR_2 for mask color, while CCOLOR_3 for
* image color. CCOLOR_1 will be never used.
*/
SELECT(vdac, BT459_REG_CCOLOR_1);
SELECT(vdac, BT459_IREG_CCOLOR_1);
REG(vdac, bt_reg) = 0xff; tc_wmb();
REG(vdac, bt_reg) = 0xff; tc_wmb();
REG(vdac, bt_reg) = 0xff; tc_wmb();
@ -817,7 +817,7 @@ bt459_set_curpos(sc)
s = spltty();
SELECT(vdac, BT459_REG_CURSOR_X_LOW);
SELECT(vdac, BT459_IREG_CURSOR_X_LOW);
REG(vdac, bt_reg) = x; tc_wmb();
REG(vdac, bt_reg) = x >> 8; tc_wmb();
REG(vdac, bt_reg) = y; tc_wmb();

View File

@ -1,4 +1,4 @@
/* $NetBSD: sfb.c,v 1.30 1999/12/06 19:26:00 drochner Exp $ */
/* $NetBSD: sfb.c,v 1.31 1999/12/15 15:09:37 ad Exp $ */
/*
* Copyright (c) 1998, 1999 Tohru Nishimura. All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: sfb.c,v 1.30 1999/12/06 19:26:00 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: sfb.c,v 1.31 1999/12/15 15:09:37 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -556,13 +556,13 @@ sfbintr(arg)
sc->sc_changed = 0;
if (v & DATA_ENB_CHANGED) {
SELECT(vdac, BT459_REG_CCR);
SELECT(vdac, BT459_IREG_CCR);
REG(vdac, bt_reg) = (sc->sc_curenb) ? 0xc0 : 0x00;
}
if (v & DATA_CURCMAP_CHANGED) {
u_int8_t *cp = sc->sc_cursor.cc_color;
SELECT(vdac, BT459_REG_CCOLOR_2);
SELECT(vdac, BT459_IREG_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();
@ -580,7 +580,7 @@ sfbintr(arg)
mp = (u_int8_t *)(sc->sc_cursor.cc_image + CURSOR_MAX_SIZE);
bcnt = 0;
SELECT(vdac, BT459_REG_CRAM_BASE+0);
SELECT(vdac, BT459_IREG_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 */
@ -635,7 +635,7 @@ sfbinit(dc)
*(u_int32_t *)(sfbasic + 0x180000) = 0; /* Bt459 reset */
SELECT(vdac, BT459_REG_COMMAND_0);
SELECT(vdac, BT459_IREG_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();
@ -648,7 +648,7 @@ sfbinit(dc)
REG(vdac, bt_reg) = 0x0; /* ILV */ tc_wmb();
REG(vdac, bt_reg) = 0x0; /* TEST */ tc_wmb();
SELECT(vdac, BT459_REG_CCR);
SELECT(vdac, BT459_IREG_CCR);
REG(vdac, bt_reg) = 0x0; tc_wmb();
REG(vdac, bt_reg) = 0x0; tc_wmb();
REG(vdac, bt_reg) = 0x0; tc_wmb();
@ -675,7 +675,7 @@ sfbinit(dc)
}
/* clear out cursor image */
SELECT(vdac, BT459_REG_CRAM_BASE);
SELECT(vdac, BT459_IREG_CRAM_BASE);
for (i = 0; i < 1024; i++)
REG(vdac, bt_reg) = 0xff; tc_wmb();
@ -684,7 +684,7 @@ sfbinit(dc)
* cursor image. CCOLOR_2 for mask color, while CCOLOR_3 for
* image color. CCOLOR_1 will be never used.
*/
SELECT(vdac, BT459_REG_CCOLOR_1);
SELECT(vdac, BT459_IREG_CCOLOR_1);
REG(vdac, bt_reg) = 0xff; tc_wmb();
REG(vdac, bt_reg) = 0xff; tc_wmb();
REG(vdac, bt_reg) = 0xff; tc_wmb();
@ -846,7 +846,7 @@ bt459_set_curpos(sc)
s = spltty();
SELECT(vdac, BT459_REG_CURSOR_X_LOW);
SELECT(vdac, BT459_IREG_CURSOR_X_LOW);
REG(vdac, bt_reg) = x; tc_wmb();
REG(vdac, bt_reg) = x >> 8; tc_wmb();
REG(vdac, bt_reg) = y; tc_wmb();

View File

@ -1,4 +1,4 @@
/* $NetBSD: sfbplus.c,v 1.2 1999/12/06 19:26:01 drochner Exp $ */
/* $NetBSD: sfbplus.c,v 1.3 1999/12/15 15:09:37 ad Exp $ */
/*
* Copyright (c) 1999 Tohru Nishimura. All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: sfbplus.c,v 1.2 1999/12/06 19:26:01 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: sfbplus.c,v 1.3 1999/12/15 15:09:37 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -609,7 +609,7 @@ sfbpinit(dc)
if (dc->dc_depth == 8) {
*(u_int32_t *)(sfbasic + 0x180000) = 0; /* Bt459 reset */
SELECT(vdac, BT459_REG_COMMAND_0);
SELECT(vdac, BT459_IREG_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();
@ -622,7 +622,7 @@ sfbpinit(dc)
REG(vdac, bt_reg) = 0x0; /* ILV */ tc_wmb();
REG(vdac, bt_reg) = 0x0; /* TEST */ tc_wmb();
SELECT(vdac, BT459_REG_CCR);
SELECT(vdac, BT459_IREG_CCR);
REG(vdac, bt_reg) = 0x0; tc_wmb();
REG(vdac, bt_reg) = 0x0; tc_wmb();
REG(vdac, bt_reg) = 0x0; tc_wmb();
@ -649,7 +649,7 @@ sfbpinit(dc)
}
/* clear out cursor image */
SELECT(vdac, BT459_REG_CRAM_BASE);
SELECT(vdac, BT459_IREG_CRAM_BASE);
for (i = 0; i < 1024; i++)
REG(vdac, bt_reg) = 0xff; tc_wmb();
@ -658,7 +658,7 @@ sfbpinit(dc)
* cursor image. CCOLOR_2 for mask color, while CCOLOR_3 for
* image color. CCOLOR_1 will be never used.
*/
SELECT(vdac, BT459_REG_CCOLOR_1);
SELECT(vdac, BT459_IREG_CCOLOR_1);
REG(vdac, bt_reg) = 0xff; tc_wmb();
REG(vdac, bt_reg) = 0xff; tc_wmb();
REG(vdac, bt_reg) = 0xff; tc_wmb();
@ -873,7 +873,7 @@ bt459visible(hw, on)
void *hw;
int on;
{
SELECT(hw, BT459_REG_CCR);
SELECT(hw, BT459_IREG_CCR);
REG(hw, bt_reg) = (on) ? 0xc0 : 0x00;
tc_wmb();
}
@ -893,7 +893,7 @@ bt459locate(hw, x, y)
int s;
s = spltty();
SELECT(hw, BT459_REG_CURSOR_X_LOW);
SELECT(hw, BT459_IREG_CURSOR_X_LOW);
REG(hw, bt_reg) = x; tc_wmb();
REG(hw, bt_reg) = x >> 8; tc_wmb();
REG(hw, bt_reg) = y; tc_wmb();
@ -915,7 +915,7 @@ bt459color(hw, cp)
void *hw;
u_int8_t *cp;
{
SELECT(hw, BT459_REG_CCOLOR_2);
SELECT(hw, BT459_IREG_CCOLOR_2);
REG(hw, bt_reg) = cp[1]; tc_wmb();
REG(hw, bt_reg) = cp[3]; tc_wmb();
REG(hw, bt_reg) = cp[5]; tc_wmb();
@ -946,7 +946,7 @@ bt459shape(hw, size, image)
mp = (u_int8_t *)(image + CURSOR_MAX_SIZE);
bcnt = 0;
SELECT(hw, BT459_REG_CRAM_BASE+0);
SELECT(hw, BT459_IREG_CRAM_BASE+0);
/* 64 pixel scan line is consisted with 16 byte cursor ram */
while (bcnt < size->y * 16) {
/* pad right half 32 pixel when smaller than 33 */