summaryrefslogtreecommitdiff
path: root/QemuVGADriver/src/VideoDriverPrivate.h
blob: cd4cdba9c7fa40dc5b71a922cf9f9c1aff9d9de4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef __VideoDriverPrivate_H__
#define __VideoDriverPrivate_H__

#pragma internal off

#include <VideoServices.h>
#include <Video.h>
#include <Displays.h>
#include <DriverGestalt.h>
#include <DriverServices.h>
#include <PCI.h>

#pragma internal on

#ifndef FALSE
#define TRUE	1
#define FALSE	0
#endif

#define QEMU_PCI_VIDEO_VENDOR_ID		0x1234
#define QEMU_PCI_VIDEO_DEVICE_ID		0x1111
#define QEMU_PCI_VIDEO_NAME				"\pQemuVgaVideo"
#define QEMU_PCI_VIDEO_PNAME			"\p.QemuVgaVideo"

#define QEMU_PCI_VIDEO_BASE_REG			0x10
#define QEMU_PCI_VIDEO_MMIO_REG			0x18

#define kDriverGlobalsPropertyName	"GLOBALS"
#define kDriverFailTextPropertyName	"FAILURE"
#define kDriverFailCodePropertyName	"FAIL-CODE"


/*
 * Our global storage is defined by this structure. This is not a requirement of the
 * driver environment, but it collects globals into a coherent structure for debugging.
 */
struct DriverGlobal {
	DriverRefNum		refNum;			/* Driver refNum for PB... */
	RegEntryID			deviceEntry;		/* Name Registry Entry ID */
	LogicalAddress		boardFBAddress;
	ByteCount			boardFBMappedSize;
	LogicalAddress		boardRegAddress;
	ByteCount			boardRegMappedSize;

	volatile Boolean	inInterrupt;

	/* Common globals */
	UInt32				openCount;
	
	/* Frame buffer configuration */
	Boolean				qdInterruptsEnable;	/* Enable VBLs for qd */
	Boolean				qdLuminanceMapping;

	Boolean				hasTimer;
	InterruptServiceIDType	qdVBLInterrupt;
	TimerID				VBLTimerID;

	Boolean				isOpen;
	
	UInt32				vramSize;
	UInt32				depth;
	UInt32				bootDepth;
	UInt32				bootMode;
	UInt32				curMode;
	UInt32				numModes;
};
typedef struct DriverGlobal DriverGlobal, *DriverGlobalPtr;

/*
 * Globals and functions
 */
extern DriverGlobal		gDriverGlobal;		/* All interesting globals */
#define GLOBAL			(gDriverGlobal)		/* GLOBAL.field for references */
extern DriverDescription	TheDriverDescription;	/* Exported to the universe */

#define FB_START			((char*)GLOBAL.boardFBAddress)
#define CHECK_OPEN( error )	if( !GLOBAL.isOpen ) return (error)

#endif