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