Fix a couple of problems with FreeLDR portability.
[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 BOOLEAN (*ConsKbHit)(VOID);
41 int (*ConsGetCh)(VOID);
42
43 VOID (*VideoClearScreen)(UCHAR Attr);
44 VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init);
45 VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth);
46 ULONG (*VideoGetBufferSize)(VOID);
47 VOID (*VideoSetTextCursorPosition)(ULONG X, ULONG Y);
48 VOID (*VideoHideShowTextCursor)(BOOLEAN Show);
49 VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y);
50 VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer);
51 BOOLEAN (*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 (*Beep)(VOID);
56 VOID (*PrepareForReactOS)(IN BOOLEAN Setup);
57
58 ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
59
60 BOOLEAN (*DiskGetBootVolume)(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
61 BOOLEAN (*DiskGetSystemVolume)(char *SystemPath, char *RemainingPath, PULONG Device, PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
62 BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size);
63 VOID (*DiskGetBootDevice)(PULONG BootDevice);
64 BOOLEAN (*DiskBootingFromFloppy)(VOID);
65 BOOLEAN (*DiskNormalizeSystemPath)(char *SystemPath, unsigned Size);
66 BOOLEAN (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
67 BOOLEAN (*DiskGetPartitionEntry)(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
68 BOOLEAN (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry);
69 ULONG (*DiskGetCacheableBlockCount)(ULONG DriveNumber);
70
71 VOID (*RTCGetCurrentDateTime)(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second);
72
73 PCONFIGURATION_COMPONENT_DATA (*HwDetect)(VOID);
74 } MACHVTBL, *PMACHVTBL;
75
76 VOID MachInit(const char *CmdLine);
77
78 extern MACHVTBL MachVtbl;
79
80 VOID MachConsPutChar(int Ch);
81 BOOLEAN MachConsKbHit();
82 int MachConsGetCh();
83 VOID MachVideoClearScreen(UCHAR Attr);
84 VIDEODISPLAYMODE MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init);
85 VOID MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
86 ULONG MachVideoGetBufferSize(VOID);
87 VOID MachVideoSetTextCursorPosition(ULONG X, ULONG Y);
88 VOID MachVideoHideShowTextCursor(BOOLEAN Show);
89 VOID MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y);
90 VOID MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer);
91 BOOLEAN MachVideoIsPaletteFixed(VOID);
92 VOID MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
93 VOID MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue);
94 VOID MachVideoSync(VOID);
95 VOID MachBeep(VOID);
96 ULONG MachGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
97 BOOLEAN MachDiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
98 BOOLEAN
99 MachDiskGetSystemVolume(char *SystemPath,
100 char *RemainingPath,
101 PULONG Device,
102 PULONG DriveNumber,
103 PULONGLONG StartSector,
104 PULONGLONG SectorCount,
105 int *FsType);
106 BOOLEAN MachDiskGetBootPath(char *BootPath, unsigned Size);
107 VOID MachDiskGetBootDevice(PULONG BootDevice);
108 BOOLEAN MachDiskBootingFromFloppy();
109 BOOLEAN MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size);
110 BOOLEAN MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
111 BOOLEAN MachDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
112 BOOLEAN MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry);
113 ULONG MachDiskGetCacheableBlockCount(ULONG DriveNumber);
114 VOID MachRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second);
115 VOID MachHwDetect(VOID);
116 VOID MachPrepareForReactOS(IN BOOLEAN Setup);
117
118 #define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch)
119 #define MachConsKbHit() MachVtbl.ConsKbHit()
120 #define MachConsGetCh() MachVtbl.ConsGetCh()
121 #define MachVideoClearScreen(Attr) MachVtbl.VideoClearScreen(Attr)
122 #define MachVideoSetDisplayMode(Mode, Init) MachVtbl.VideoSetDisplayMode((Mode), (Init))
123 #define MachVideoGetDisplaySize(W, H, D) MachVtbl.VideoGetDisplaySize((W), (H), (D))
124 #define MachVideoGetBufferSize() MachVtbl.VideoGetBufferSize()
125 #define MachVideoSetTextCursorPosition(X, Y) MachVtbl.VideoSetTextCursorPosition((X), (Y))
126 #define MachVideoHideShowTextCursor(Show) MachVtbl.VideoHideShowTextCursor(Show)
127 #define MachVideoPutChar(Ch, Attr, X, Y) MachVtbl.VideoPutChar((Ch), (Attr), (X), (Y))
128 #define MachVideoCopyOffScreenBufferToVRAM(Buf) MachVtbl.VideoCopyOffScreenBufferToVRAM(Buf)
129 #define MachVideoIsPaletteFixed() MachVtbl.VideoIsPaletteFixed()
130 #define MachVideoSetPaletteColor(Col, R, G, B) MachVtbl.VideoSetPaletteColor((Col), (R), (G), (B))
131 #define MachVideoGetPaletteColor(Col, R, G, B) MachVtbl.VideoGetPaletteColor((Col), (R), (G), (B))
132 #define MachVideoSync() MachVtbl.VideoSync()
133 #define MachBeep() MachVtbl.Beep()
134 #define MachPrepareForReactOS(a) MachVtbl.PrepareForReactOS(a)
135 #define MachGetMemoryMap(MMap, Size) MachVtbl.GetMemoryMap((MMap), (Size))
136 #define MachDiskGetBootVolume(Drv, Start, Cnt, FsType) MachVtbl.DiskGetBootVolume((Drv), (Start), (Cnt), (FsType))
137 #define MachDiskGetSystemVolume(SysPath, RemPath, Dev, Drv, Start, Cnt, FsType) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev), (Drv), (Start), (Cnt), (FsType))
138 #define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size))
139 #define MachDiskGetBootDevice(BootDevice) MachVtbl.DiskGetBootDevice(BootDevice)
140 #define MachDiskBootingFromFloppy() MachVtbl.DiskBootingFromFloppy()
141 #define MachDiskNormalizeSystemPath(Path, Size) MachVtbl.DiskNormalizeSystemPath((Path), (Size))
142 #define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
143 #define MachDiskGetPartitionEntry(Drive, Part, Entry) MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))
144 #define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive), (Geom))
145 #define MachDiskGetCacheableBlockCount(Drive) MachVtbl.DiskGetCacheableBlockCount(Drive)
146 #define MachRTCGetCurrentDateTime(Y, Mo, D, H, Mi, S) MachVtbl.RTCGetCurrentDateTime((Y), (Mo), (D), (H), (Mi), (S));
147 #define MachHwDetect() MachVtbl.HwDetect()
148
149 #endif /* __MACHINE_H_ */
150
151 /* EOF */