Re-apply 14698 - 14762 and fix resulting problem
[reactos.git] / reactos / boot / freeldr / freeldr / include / machine.h
1 /* $Id$
2 *
3 * FreeLoader
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #ifndef __MACHINE_H_
21 #define __MACHINE_H_
22
23 #ifndef __DISK_H
24 #include "disk.h"
25 #endif
26
27 #ifndef __MEMORY_H
28 #include "mm.h"
29 #endif
30
31 typedef enum tagVIDEODISPLAYMODE
32 {
33 VideoTextMode,
34 VideoGraphicsMode
35 } VIDEODISPLAYMODE, *PVIDEODISPLAYMODE;
36
37 typedef struct tagMACHVTBL
38 {
39 VOID (*ConsPutChar)(int Ch);
40 BOOL (*ConsKbHit)(VOID);
41 int (*ConsGetCh)(VOID);
42
43 VOID (*VideoClearScreen)(UCHAR Attr);
44 VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOL Init);
45 VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth);
46 ULONG (*VideoGetBufferSize)(VOID);
47 VOID (*VideoSetTextCursorPosition)(ULONG X, ULONG Y);
48 VOID (*VideoHideShowTextCursor)(BOOL Show);
49 VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y);
50 VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer);
51 BOOL (*VideoIsPaletteFixed)(VOID);
52 VOID (*VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
53 VOID (*VideoGetPaletteColor)(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
54 VOID (*VideoSync)(VOID);
55 VOID (*VideoPrepareForReactOS)(VOID);
56
57 ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
58
59 BOOL (*DiskGetBootVolume)(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
60 BOOL (*DiskGetSystemVolume)(char *SystemPath, char *RemainingPath, PULONG Device, PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
61 BOOL (*DiskGetBootPath)(char *BootPath, unsigned Size);
62 VOID (*DiskGetBootDevice)(PULONG BootDevice);
63 BOOL (*DiskBootingFromFloppy)(VOID);
64 BOOL (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
65 BOOL (*DiskGetPartitionEntry)(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
66 BOOL (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry);
67 ULONG (*DiskGetCacheableBlockCount)(ULONG DriveNumber);
68
69 VOID (*RTCGetCurrentDateTime)(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second);
70
71 VOID (*HwDetect)(VOID);
72 } MACHVTBL, *PMACHVTBL;
73
74 VOID MachInit(char *CmdLine);
75
76 extern MACHVTBL MachVtbl;
77
78 #define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch)
79 #define MachConsKbHit() MachVtbl.ConsKbHit()
80 #define MachConsGetCh() MachVtbl.ConsGetCh()
81 #define MachVideoClearScreen(Attr) MachVtbl.VideoClearScreen(Attr)
82 #define MachVideoSetDisplayMode(Mode, Init) MachVtbl.VideoSetDisplayMode((Mode), (Init))
83 #define MachVideoGetDisplaySize(W, H, D) MachVtbl.VideoGetDisplaySize((W), (H), (D))
84 #define MachVideoGetBufferSize() MachVtbl.VideoGetBufferSize()
85 #define MachVideoSetTextCursorPosition(X, Y) MachVtbl.VideoSetTextCursorPosition((X), (Y))
86 #define MachVideoHideShowTextCursor(Show) MachVtbl.VideoHideShowTextCursor(Show)
87 #define MachVideoPutChar(Ch, Attr, X, Y) MachVtbl.VideoPutChar((Ch), (Attr), (X), (Y))
88 #define MachVideoCopyOffScreenBufferToVRAM(Buf) MachVtbl.VideoCopyOffScreenBufferToVRAM(Buf)
89 #define MachVideoIsPaletteFixed() MachVtbl.VideoIsPaletteFixed()
90 #define MachVideoSetPaletteColor(Col, R, G, B) MachVtbl.VideoSetPaletteColor((Col), (R), (G), (B))
91 #define MachVideoGetPaletteColor(Col, R, G, B) MachVtbl.VideoGetPaletteColor((Col), (R), (G), (B))
92 #define MachVideoSync() MachVtbl.VideoSync()
93 #define MachVideoPrepareForReactOS() MachVtbl.VideoPrepareForReactOS()
94 #define MachGetMemoryMap(MMap, Size) MachVtbl.GetMemoryMap((MMap), (Size))
95 #define MachDiskGetBootVolume(Drv, Start, Cnt, FsType) MachVtbl.DiskGetBootVolume((Drv), (Start), (Cnt), (FsType))
96 #define MachDiskGetSystemVolume(SysPath, RemPath, Dev, Drv, Start, Cnt, FsType) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev), (Drv), (Start), (Cnt), (FsType))
97 #define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size))
98 #define MachDiskGetBootDevice(BootDevice) MachVtbl.DiskGetBootDevice(BootDevice)
99 #define MachDiskBootingFromFloppy() MachVtbl.DiskBootingFromFloppy()
100 #define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
101 #define MachDiskGetPartitionEntry(Drive, Part, Entry) MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))
102 #define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive), (Geom))
103 #define MachDiskGetCacheableBlockCount(Drive) MachVtbl.DiskGetCacheableBlockCount(Drive)
104 #define MachRTCGetCurrentDateTime(Y, Mo, D, H, Mi, S) MachVtbl.RTCGetCurrentDateTime((Y), (Mo), (D), (H), (Mi), (S));
105 #define MachHwDetect() MachVtbl.HwDetect()
106
107 #endif /* __MACHINE_H_ */
108
109 /* EOF */