[FREELDR]
[reactos.git] / reactos / boot / freeldr / freeldr / include / machine.h
1 /*
2 * FreeLoader
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #pragma once
20
21 #ifndef __DISK_H
22 #include "disk.h"
23 #endif
24
25 #ifndef __MEMORY_H
26 #include "mm.h"
27 #endif
28
29 #ifndef __FS_H
30 #include "fs.h"
31 #endif
32
33 typedef enum tagVIDEODISPLAYMODE
34 {
35 VideoTextMode,
36 VideoGraphicsMode
37 } VIDEODISPLAYMODE, *PVIDEODISPLAYMODE;
38
39 typedef struct tagMACHVTBL
40 {
41 VOID (*ConsPutChar)(int Ch);
42 BOOLEAN (*ConsKbHit)(VOID);
43 int (*ConsGetCh)(VOID);
44
45 VOID (*VideoClearScreen)(UCHAR Attr);
46 VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init);
47 VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth);
48 ULONG (*VideoGetBufferSize)(VOID);
49 VOID (*VideoSetTextCursorPosition)(UCHAR X, UCHAR Y);
50 VOID (*VideoHideShowTextCursor)(BOOLEAN Show);
51 VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y);
52 VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer);
53 BOOLEAN (*VideoIsPaletteFixed)(VOID);
54 VOID (*VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
55 VOID (*VideoGetPaletteColor)(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
56 VOID (*VideoSync)(VOID);
57 VOID (*Beep)(VOID);
58 VOID (*PrepareForReactOS)(IN BOOLEAN Setup);
59
60 MEMORY_DESCRIPTOR* (*GetMemoryDescriptor)(MEMORY_DESCRIPTOR* Current);
61 PMEMORY_DESCRIPTOR (*GetMemoryMap)(PULONG MaxMemoryMapSize);
62
63 BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size);
64 BOOLEAN (*DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
65 BOOLEAN (*DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry);
66 ULONG (*DiskGetCacheableBlockCount)(UCHAR DriveNumber);
67
68 TIMEINFO* (*GetTime)(VOID);
69 ULONG (*GetRelativeTime)(VOID);
70
71 PCONFIGURATION_COMPONENT_DATA (*HwDetect)(VOID);
72 } MACHVTBL, *PMACHVTBL;
73
74 VOID MachInit(const char *CmdLine);
75
76 extern MACHVTBL MachVtbl;
77
78 VOID MachConsPutChar(int Ch);
79 BOOLEAN MachConsKbHit(VOID);
80 int MachConsGetCh(VOID);
81 VOID MachVideoClearScreen(UCHAR Attr);
82 VIDEODISPLAYMODE MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init);
83 VOID MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
84 ULONG MachVideoGetBufferSize(VOID);
85 VOID MachVideoSetTextCursorPosition(UCHAR X, UCHAR Y);
86 VOID MachVideoHideShowTextCursor(BOOLEAN Show);
87 VOID MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y);
88 VOID MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer);
89 BOOLEAN MachVideoIsPaletteFixed(VOID);
90 VOID MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
91 VOID MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue);
92 VOID MachVideoSync(VOID);
93 VOID MachBeep(VOID);
94 BOOLEAN MachDiskGetBootPath(char *BootPath, unsigned Size);
95 BOOLEAN MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size);
96 BOOLEAN MachDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
97 BOOLEAN MachDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry);
98 ULONG MachDiskGetCacheableBlockCount(UCHAR DriveNumber);
99 VOID MachPrepareForReactOS(IN BOOLEAN Setup);
100
101 #define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch)
102 #define MachConsKbHit() MachVtbl.ConsKbHit()
103 #define MachConsGetCh() MachVtbl.ConsGetCh()
104 #define MachVideoClearScreen(Attr) MachVtbl.VideoClearScreen(Attr)
105 #define MachVideoSetDisplayMode(Mode, Init) MachVtbl.VideoSetDisplayMode((Mode), (Init))
106 #define MachVideoGetDisplaySize(W, H, D) MachVtbl.VideoGetDisplaySize((W), (H), (D))
107 #define MachVideoGetBufferSize() MachVtbl.VideoGetBufferSize()
108 #define MachVideoSetTextCursorPosition(X, Y) MachVtbl.VideoSetTextCursorPosition((X), (Y))
109 #define MachVideoHideShowTextCursor(Show) MachVtbl.VideoHideShowTextCursor(Show)
110 #define MachVideoPutChar(Ch, Attr, X, Y) MachVtbl.VideoPutChar((Ch), (Attr), (X), (Y))
111 #define MachVideoCopyOffScreenBufferToVRAM(Buf) MachVtbl.VideoCopyOffScreenBufferToVRAM(Buf)
112 #define MachVideoIsPaletteFixed() MachVtbl.VideoIsPaletteFixed()
113 #define MachVideoSetPaletteColor(Col, R, G, B) MachVtbl.VideoSetPaletteColor((Col), (R), (G), (B))
114 #define MachVideoGetPaletteColor(Col, R, G, B) MachVtbl.VideoGetPaletteColor((Col), (R), (G), (B))
115 #define MachVideoSync() MachVtbl.VideoSync()
116 #define MachBeep() MachVtbl.Beep()
117 #define MachPrepareForReactOS(a) MachVtbl.PrepareForReactOS(a)
118 #define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size))
119 #define MachDiskNormalizeSystemPath(Path, Size) MachVtbl.DiskNormalizeSystemPath((Path), (Size))
120 #define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
121 #define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive), (Geom))
122 #define MachDiskGetCacheableBlockCount(Drive) MachVtbl.DiskGetCacheableBlockCount(Drive)
123 #define MachHwDetect() MachVtbl.HwDetect()
124
125 /* EOF */