1 /* 2 Haiku S3 Virge driver adapted from the X.org S3 Virge driver. 3 4 Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. 5 6 Copyright 2007-2008 Haiku, Inc. All rights reserved. 7 Distributed under the terms of the MIT license. 8 9 Authors: 10 Gerald Zajac 2007-2008 11 */ 12 13 14 #ifndef __VIRGE_H__ 15 #define __VIRGE_H__ 16 17 18 19 #define CURSOR_BYTES 1024 // bytes used for cursor image in video memory 20 21 // Miscellaneous registers. 22 #define SUBSYS_STAT_REG 0x8504 23 #define SYSTEM_CONTROL_REG 0x83DA 24 #define DDC_REG 0xFF20 25 26 // Memory port controller registers. 27 #define FIFO_CONTROL_REG 0x8200 28 29 // Image write stuff. 30 #define SRC_BASE 0xA4D4 31 #define DEST_BASE 0xA4D8 32 #define CLIP_L_R 0xA4DC 33 #define CLIP_T_B 0xA4E0 34 #define DEST_SRC_STR 0xA4E4 35 #define MONO_PAT_0 0xA4E8 36 #define MONO_PAT_1 0xA4EC 37 #define PAT_BG_CLR 0xA4F0 38 #define PAT_FG_CLR 0xA4F4 39 #define CMD_SET 0xA500 40 #define RWIDTH_HEIGHT 0xA504 41 #define RSRC_XY 0xA508 42 #define RDEST_XY 0xA50C 43 44 // Command Register. 45 #define CMD_OP_MSK (0xf << 27) 46 #define CMD_BITBLT (0x0 << 27) 47 #define CMD_RECT ((0x2 << 27) | 0x0100) 48 #define CMD_LINE (0x3 << 27) 49 #define CMD_POLYFILL (0x5 << 27) 50 #define CMD_NOP (0xf << 27) 51 52 #define DRAW 0x0020 53 54 // Destination Color Format. 55 #define DST_8BPP 0x00 56 #define DST_16BPP 0x04 57 #define DST_24BPP 0x08 58 59 // X Positive, Y Positive (Bit BLT). 60 #define CMD_XP 0x02000000 61 #define CMD_YP 0x04000000 62 63 64 #define IN_SUBSYS_STAT() (ReadReg32(SUBSYS_STAT_REG)) 65 66 VerticalRetraceWait()67static inline void VerticalRetraceWait() 68 { 69 if (ReadCrtcReg(0x17) & 0x80) { 70 int i = 0x10000; 71 while ((ReadReg8(SYSTEM_CONTROL_REG) & 0x08) == 0x08 && i--) ; 72 i = 0x10000; 73 while ((ReadReg8(SYSTEM_CONTROL_REG) & 0x08) == 0x00 && i--) ; 74 } 75 } 76 77 78 #endif // __VIRGE_H__ 79