1 /*
2  * PROJECT:     ReactOS framebuffer driver for NEC PC-98 series
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Miniport driver header file
5  * COPYRIGHT:   Copyright 2020 Dmitry Borisov (di.sean@protonmail.com)
6  */
7 
8 #ifndef _PC98VID_PCH_
9 #define _PC98VID_PCH_
10 
11 #include <ntdef.h>
12 #include <section_attribs.h>
13 #include <dderror.h>
14 #include <devioctl.h>
15 #include <miniport.h>
16 #include <video.h>
17 #include <debug.h>
18 
19 #undef WRITE_PORT_UCHAR
20 #undef READ_PORT_UCHAR
21 #define WRITE_PORT_UCHAR(p, d) VideoPortWritePortUchar(p, d)
22 #define READ_PORT_UCHAR(p) VideoPortReadPortUchar(p)
23 #include <drivers/pc98/video.h>
24 
25 #if defined(_MSC_VER)
26 #pragma section("PAGECONS", read)
27 #endif
28 
29 #define MONITOR_HW_ID 0x1033FACE /* Dummy */
30 
31 typedef struct _VIDEOMODE
32 {
33     USHORT HResolution;
34     USHORT VResolution;
35     UCHAR HorizontalScanRate;
36     UCHAR Clock1;
37     UCHAR Clock2;
38     UCHAR Mem;
39     UCHAR RefreshRate;
40     SYNCPARAM TextSyncParameters;
41     SYNCPARAM VideoSyncParameters;
42 } VIDEOMODE, *PVIDEOMODE;
43 
44 typedef struct _HW_DEVICE_EXTENSION
45 {
46     UCHAR MonitorCount;
47     UCHAR ModeCount;
48     UCHAR CurrentMode;
49     PHYSICAL_ADDRESS PegcControl;
50     ULONG PegcControlLength;
51     ULONG_PTR PegcControlVa;
52     PHYSICAL_ADDRESS FrameBuffer;
53     ULONG FrameBufferLength;
54 } HW_DEVICE_EXTENSION, *PHW_DEVICE_EXTENSION;
55 
56 BOOLEAN
57 NTAPI
58 HasPegcController(
59     _In_ PHW_DEVICE_EXTENSION DeviceExtension);
60 
61 CODE_SEG("PAGE")
62 BOOLEAN
63 NTAPI
64 Pc98VidStartIO(
65     _In_ PVOID HwDeviceExtension,
66     _Inout_ PVIDEO_REQUEST_PACKET RequestPacket);
67 
68 CODE_SEG("PAGE")
69 VP_STATUS
70 FASTCALL
71 Pc98VidSetCurrentMode(
72     _In_ PHW_DEVICE_EXTENSION DeviceExtension,
73     _In_ PVIDEO_MODE RequestedMode);
74 
75 CODE_SEG("PAGE")
76 VP_STATUS
77 FASTCALL
78 Pc98VidSetColorRegisters(
79     _In_ PVIDEO_CLUT ColorLookUpTable);
80 
81 CODE_SEG("PAGE")
82 VP_STATUS
83 NTAPI
84 Pc98VidGetPowerState(
85     _In_ PVOID HwDeviceExtension,
86     _In_ ULONG HwId,
87     _In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl);
88 
89 CODE_SEG("PAGE")
90 VP_STATUS
91 NTAPI
92 Pc98VidSetPowerState(
93     _In_ PVOID HwDeviceExtension,
94     _In_ ULONG HwId,
95     _In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl);
96 
97 DATA_SEG("PAGECONS")
98 extern const VIDEOMODE VideoModes[];
99 
100 #endif /* _PC98VID_PCH_ */
101