summaryrefslogtreecommitdiff
path: root/sys/arch/amiga/dev/grf_cvreg.h
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-30 22:18:28 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-30 22:18:28 +0000
commit66416e15911955f5e0ef86b19dff8fbceb46c755 (patch)
tree98ca47a564122aa4b484e1e1c07699544d554be4 /sys/arch/amiga/dev/grf_cvreg.h
parentf6ab5cd567eae5b6537564ff2a13e61b444e8d59 (diff)
From NetBSD: merge of 960317
Diffstat (limited to 'sys/arch/amiga/dev/grf_cvreg.h')
-rw-r--r--sys/arch/amiga/dev/grf_cvreg.h188
1 files changed, 55 insertions, 133 deletions
diff --git a/sys/arch/amiga/dev/grf_cvreg.h b/sys/arch/amiga/dev/grf_cvreg.h
index 9ba27e6361e..64078af7270 100644
--- a/sys/arch/amiga/dev/grf_cvreg.h
+++ b/sys/arch/amiga/dev/grf_cvreg.h
@@ -1,4 +1,5 @@
-/* $NetBSD: grf_cvreg.h,v 1.3 1995/12/27 07:15:55 chopps Exp $ */
+/* $OpenBSD: grf_cvreg.h,v 1.5 1996/03/30 22:18:17 niklas Exp $ */
+/* $NetBSD: grf_cvreg.h,v 1.4 1996/03/02 14:02:58 veego Exp $ */
/*
* Copyright (c) 1995 Michael Teske
@@ -63,6 +64,31 @@ struct grfcvtext_mode {
#define vgaw(ba, reg, val) \
*(((volatile caddr_t)ba)+reg) = ((val) & 0xff)
+
+/* read 32 Bit VGA register */
+#define vgar32(ba, reg) ( *((unsigned long *) (((volatile caddr_t)ba)+reg)) )
+
+/* write 32 Bit VGA register */
+#define vgaw32(ba, reg, val) \
+ *((unsigned long *) (((volatile caddr_t)ba)+reg)) = val
+
+/* read 16 Bit VGA register */
+#define vgar16(ba, reg) ( *((unsigned short *) (((volatile caddr_t)ba)+reg)) )
+
+/* write 16 Bit VGA register */
+#define vgaw16(ba, reg, val) \
+ *((unsigned short *) (((volatile caddr_t)ba)+reg)) = val
+
+int grfcv_cnprobe __P((void));
+void grfcv_iteinit __P((struct grf_softc *));
+static inline void GfxBusyWait __P((volatile caddr_t));
+static inline void GfxFifoWait __P((volatile caddr_t));
+static inline unsigned char RAttr __P((volatile caddr_t, short));
+static inline unsigned char RSeq __P((volatile caddr_t, short));
+static inline unsigned char RCrt __P((volatile caddr_t, short));
+static inline unsigned char RGfx __P((volatile caddr_t, short));
+
+
/*
* defines for the used register addresses (mw)
*
@@ -331,6 +357,34 @@ struct grfcvtext_mode {
WSeq(ba, SEQ_ID_MAP_MASK, (1 << (m & 3)));\
} while (0)
+
+/* Gfx engine busy wait */
+
+static inline void
+GfxBusyWait (ba)
+ volatile caddr_t ba;
+{
+ int test;
+
+ do {
+ test = vgar16 (ba, ECR_GP_STAT);
+ asm volatile ("nop");
+ } while (test & (1 << 9));
+}
+
+
+static inline void
+GfxFifoWait(ba)
+ volatile caddr_t ba;
+{
+ int test;
+
+ do {
+ test = vgar16 (ba, ECR_GP_STAT);
+ } while (test & 0x0f);
+}
+
+
/* Special wakeup/passthrough registers on graphics boards
*
* The methods have diverged a bit for each board, so
@@ -376,137 +430,5 @@ RGfx(ba, idx)
return vgar(ba, GCT_ADDRESS_R);
}
-
-static inline void
-cv_write_port(bits, BoardAddr)
- unsigned short bits;
- volatile caddr_t BoardAddr;
-{
- volatile char *addr;
- static unsigned char CVPortBits = 0; /* mirror port bits here */
-
- addr = BoardAddr + 0x40001;
- if (bits & 0x8000)
- CVPortBits |= bits&0xFF; /* Set bits */
- else {
- bits = bits & 0xFF;
- bits = (~bits) & 0xFF ;
- CVPortBits &= bits; /* Clear bits */
- }
-
- *addr = CVPortBits;
-}
-
-#define set_port_bits(b, ba) cv_write_port((unsigned short )b | 0x8000,ba)
-#define clear_port_bits(b, ba) cv_write_port((unsigned short )b & 0xff,ba)
-
-
-/*
- * Monitor Switch
- * 0 = CyberVision Signal
- * 1 = Amiga Signal,
- * ba = boardaddr
- */
-
-static inline void
-cvscreen(toggle, ba)
- char *toggle;
- volatile caddr_t ba;
-{
-
- if (toggle)
- cv_write_port (0x10, ba);
- else
- cv_write_port (0x8010, ba);
-}
-
-/* 0 = on, 1= off */
-/* ba= registerbase */
-static inline void
-gfx_on_off(toggle, ba)
- int toggle;
- volatile caddr_t ba;
-{
- int r;
-
- toggle &= 0x1;
- toggle = toggle << 5;
-
- r = RSeq(ba, SEQ_ID_CLOCKING_MODE);
- r &= 0xdf; /* set Bit 5 to 0 */
-
- WSeq(ba, SEQ_ID_CLOCKING_MODE, r | toggle);
-}
-
-#if 0
-int grfcv_cnprobe __P((void));
-void grfcv_iteinit __P((struct grf_softc *gp));
-#endif
-
-static unsigned char clocks[]={
-0x13, 0x61, 0x6b, 0x6d, 0x51, 0x69, 0x54, 0x69,
-0x4f, 0x68, 0x6b, 0x6b, 0x18, 0x61, 0x7b, 0x6c,
-0x51, 0x67, 0x24, 0x62, 0x56, 0x67, 0x77, 0x6a,
-0x1d, 0x61, 0x53, 0x66, 0x6b, 0x68, 0x79, 0x69,
-0x7c, 0x69, 0x7f, 0x69, 0x22, 0x61, 0x54, 0x65,
-0x56, 0x65, 0x58, 0x65, 0x67, 0x66, 0x41, 0x63,
-0x27, 0x61, 0x13, 0x41, 0x37, 0x62, 0x6b, 0x4d,
-0x23, 0x43, 0x51, 0x49, 0x79, 0x66, 0x54, 0x49,
-0x7d, 0x66, 0x34, 0x56, 0x4f, 0x63, 0x1f, 0x42,
-0x6b, 0x4b, 0x7e, 0x4d, 0x18, 0x41, 0x2a, 0x43,
-0x7b, 0x4c, 0x74, 0x4b, 0x51, 0x47, 0x65, 0x49,
-0x24, 0x42, 0x68, 0x49, 0x56, 0x47, 0x75, 0x4a,
-0x77, 0x4a, 0x31, 0x43, 0x1d, 0x41, 0x71, 0x49,
-0x53, 0x46, 0x29, 0x42, 0x6b, 0x48, 0x1f, 0x41,
-0x79, 0x49, 0x6f, 0x48, 0x7c, 0x49, 0x38, 0x43,
-0x7f, 0x49, 0x5d, 0x46, 0x22, 0x41, 0x53, 0x45,
-0x54, 0x45, 0x55, 0x45, 0x56, 0x45, 0x57, 0x45,
-0x58, 0x45, 0x25, 0x41, 0x67, 0x46, 0x5b, 0x45,
-0x41, 0x43, 0x78, 0x47, 0x27, 0x41, 0x51, 0x44,
-0x13, 0x21, 0x7d, 0x47, 0x37, 0x42, 0x71, 0x46,
-0x6b, 0x2d, 0x14, 0x21, 0x23, 0x23, 0x7d, 0x2f,
-0x51, 0x29, 0x61, 0x2b, 0x79, 0x46, 0x1d, 0x22,
-0x54, 0x29, 0x45, 0x27, 0x7d, 0x46, 0x7f, 0x46,
-0x4f, 0x43, 0x2f, 0x41, 0x1f, 0x22, 0x6a, 0x2b,
-0x6b, 0x2b, 0x5b, 0x29, 0x7e, 0x2d, 0x65, 0x44,
-0x18, 0x21, 0x5e, 0x29, 0x2a, 0x23, 0x45, 0x26,
-0x7b, 0x2c, 0x19, 0x21, 0x74, 0x2b, 0x75, 0x2b,
-0x51, 0x27, 0x3f, 0x25, 0x65, 0x29, 0x40, 0x25,
-0x24, 0x22, 0x41, 0x25, 0x68, 0x29, 0x42, 0x25,
-0x56, 0x27, 0x7e, 0x2b, 0x75, 0x2a, 0x1c, 0x21,
-0x77, 0x2a, 0x4f, 0x26, 0x31, 0x23, 0x6f, 0x29,
-0x1d, 0x21, 0x32, 0x23, 0x71, 0x29, 0x72, 0x29,
-0x53, 0x26, 0x69, 0x28, 0x29, 0x22, 0x75, 0x29,
-0x6b, 0x28, 0x1f, 0x21, 0x1f, 0x21, 0x6d, 0x28,
-0x79, 0x29, 0x2b, 0x22, 0x6f, 0x28, 0x59, 0x26,
-0x7c, 0x29, 0x7d, 0x29, 0x38, 0x23, 0x21, 0x21,
-0x7f, 0x29, 0x39, 0x23, 0x5d, 0x26, 0x75, 0x28,
-0x22, 0x21, 0x77, 0x28, 0x53, 0x25, 0x6c, 0x27,
-0x54, 0x25, 0x61, 0x26, 0x55, 0x25, 0x30, 0x22,
-0x56, 0x25, 0x63, 0x26, 0x57, 0x25, 0x71, 0x27,
-0x58, 0x25, 0x7f, 0x28, 0x25, 0x21, 0x74, 0x27,
-0x67, 0x26, 0x40, 0x23, 0x5b, 0x25, 0x26, 0x21,
-0x41, 0x23, 0x34, 0x22, 0x78, 0x27, 0x6b, 0x26,
-0x27, 0x21, 0x35, 0x22, 0x51, 0x24, 0x7b, 0x27,
-0x13, 0x1, 0x13, 0x1, 0x7d, 0x27, 0x4c, 0x9,
-0x37, 0x22, 0x5b, 0xb, 0x71, 0x26, 0x5c, 0xb,
-0x6b, 0xd, 0x47, 0x23, 0x14, 0x1, 0x4f, 0x9,
-0x23, 0x3, 0x75, 0x26, 0x7d, 0xf, 0x1c, 0x2,
-0x51, 0x9, 0x59, 0x24, 0x61, 0xb, 0x69, 0x25,
-0x79, 0x26, 0x34, 0x5, 0x1d, 0x2, 0x6b, 0x25,
-0x54, 0x9, 0x35, 0x5, 0x45, 0x7, 0x6d, 0x25,
-0x7d, 0x26, 0x16, 0x1, 0x7f, 0x26, 0x77, 0xd,
-0x4f, 0x23, 0x78, 0xd, 0x2f, 0x21, 0x27, 0x3,
-0x1f, 0x2, 0x59, 0x9, 0x6a, 0xb, 0x73, 0x25,
-0x6b, 0xb, 0x63, 0x24, 0x5b, 0x9, 0x20, 0x2,
-0x7e, 0xd, 0x4b, 0x7, 0x65, 0x24, 0x43, 0x22,
-0x18, 0x1, 0x6f, 0xb, 0x5e, 0x9, 0x70, 0xb,
-0x2a, 0x3, 0x33, 0x4, 0x45, 0x6, 0x60, 0x9,
-0x7b, 0xc, 0x19, 0x1, 0x19, 0x1, 0x7d, 0xc,
-0x74, 0xb, 0x50, 0x7, 0x75, 0xb, 0x63, 0x9,
-0x51, 0x7, 0x23, 0x2, 0x3f, 0x5, 0x1a, 0x1,
-0x65, 0x9, 0x2d, 0x3, 0x40, 0x5, 0x0, 0x0,
-};
-
#endif /* _GRF_RHREG_H */