2 Copyright 2008 Haiku, Inc. All rights reserved.
3 Distributed under the terms of the MIT license.
9 #ifndef __REGISTER_IO_H__
10 #define __REGISTER_IO_H__
13 // PIO address of various VGA registers. If accessing these registers using
14 // MMIO, add 0x8000 to thses addresses.
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
25 // Prototypes of I/O functions for accessing registers using PIO.
27 uint32
ReadPIO(uint32 addr
, uint8 numBytes
);
28 void WritePIO(uint32 addr
, uint8 numBytes
, uint32 value
);
30 inline uint8
ReadPIO_8(uint32 addr
) { return ReadPIO(addr
, 1); }
31 inline void WritePIO_8(uint32 addr
, uint8 value
) { WritePIO(addr
, 1, value
); }
34 // Prototypes of I/O functions for accessing registers using PIO or MMIO
35 // depending upon the type of S3 chip.
37 uint8
ReadReg8(uint32 addr
);
38 uint16
ReadReg16(uint32 addr
);
39 uint32
ReadReg32(uint32 addr
);
41 void WriteReg8(uint32 addr
, uint8 value
);
42 void WriteReg16(uint32 addr
, uint16 value
);
43 void WriteReg32(uint32 addr
, uint32 value
);
45 uint8
ReadCrtcReg(uint8 index
);
46 void WriteCrtcReg(uint8 index
, uint8 value
);
47 void WriteCrtcReg(uint8 index
, uint8 value
, uint8 mask
);
49 uint8
ReadSeqReg(uint8 index
);
50 void WriteSeqReg(uint8 index
, uint8 value
);
51 void WriteSeqReg(uint8 index
, uint8 value
, uint8 mask
);
53 uint8
ReadMiscOutReg();
54 void WriteMiscOutReg(uint8 value
);
56 void WriteIndexedColor(uint8 index
, uint8 red
, uint8 green
, uint8 blue
);
59 #endif // __REGISTER_IO_H__