1/* 2 Copyright 2008 Haiku, Inc. All rights reserved. 3 Distributed under the terms of the MIT license. 4 5 Authors: 6 Gerald Zajac 2008 7*/ 8 9#ifndef __REGISTER_IO_H__ 10#define __REGISTER_IO_H__ 11 12 13// PIO address of various VGA registers. If accessing these registers using 14// MMIO, add 0x8000 to thses addresses. 15 16#define VGA_ENABLE 0x3c3 17#define MISC_OUT_R 0x3cc // read 18#define MISC_OUT_W 0x3c2 // write 19#define CRTC_INDEX 0x3d4 20#define CRTC_DATA 0x3d5 21#define SEQ_INDEX 0x3c4 22#define SEQ_DATA 0x3c5 23 24 25// Prototypes of I/O functions for accessing registers using PIO. 26 27uint32 ReadPIO(uint32 addr, uint8 numBytes); 28void WritePIO(uint32 addr, uint8 numBytes, uint32 value); 29 30inline uint8 ReadPIO_8(uint32 addr) { return ReadPIO(addr, 1); } 31inline void WritePIO_8(uint32 addr, uint8 value) { WritePIO(addr, 1, value); } 32 33 34// Prototypes of I/O functions for accessing registers using PIO or MMIO 35// depending upon the type of S3 chip. 36 37uint8 ReadReg8(uint32 addr); 38uint16 ReadReg16(uint32 addr); 39uint32 ReadReg32(uint32 addr); 40 41void WriteReg8(uint32 addr, uint8 value); 42void WriteReg16(uint32 addr, uint16 value); 43void WriteReg32(uint32 addr, uint32 value); 44 45uint8 ReadCrtcReg(uint8 index); 46void WriteCrtcReg(uint8 index, uint8 value); 47void WriteCrtcReg(uint8 index, uint8 value, uint8 mask); 48 49uint8 ReadSeqReg(uint8 index); 50void WriteSeqReg(uint8 index, uint8 value); 51void WriteSeqReg(uint8 index, uint8 value, uint8 mask); 52 53uint8 ReadMiscOutReg(); 54void WriteMiscOutReg(uint8 value); 55 56void WriteIndexedColor(uint8 index, uint8 red, uint8 green, uint8 blue); 57 58 59#endif // __REGISTER_IO_H__ 60