9ed71df28c75c5d86fea799942cc388f868def15
[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 #ifndef __FS_H
32 #include "fs.h"
33 #endif
34
35 typedef enum tagVIDEODISPLAYMODE
36 {
37 VideoTextMode,
38 VideoGraphicsMode
39 } VIDEODISPLAYMODE, *PVIDEODISPLAYMODE;
40
41 typedef struct tagMACHVTBL
42 {
43 VOID (*ConsPutChar)(int Ch);
44 BOOLEAN (*ConsKbHit)(VOID);
45 int (*ConsGetCh)(VOID);
46
47 VOID (*VideoClearScreen)(UCHAR Attr);
48 VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init);
49 VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth);
50 ULONG (*VideoGetBufferSize)(VOID);
51 VOID (*VideoSetTextCursorPosition)(ULONG X, ULONG Y);
52 VOID (*VideoHideShowTextCursor)(BOOLEAN Show);
53 VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y);
54 VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer);
55 BOOLEAN (*VideoIsPaletteFixed)(VOID);
56 VOID (*VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
57 VOID (*VideoGetPaletteColor)(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
58 VOID (*VideoSync)(VOID);
59 VOID (*Beep)(VOID);
60 VOID (*PrepareForReactOS)(IN BOOLEAN Setup);
61
62 MEMORY_DESCRIPTOR* (*GetMemoryDescriptor)(MEMORY_DESCRIPTOR* Current);
63 ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
64
65 BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size);
66 BOOLEAN (*DiskNormalizeSystemPath)(char *SystemPath, unsigned Size);
67 BOOLEAN (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
68 BOOLEAN (*DiskGetPartitionEntry)(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
69 BOOLEAN (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry);
70 ULONG (*DiskGetCacheableBlockCount)(ULONG DriveNumber);
71
72 TIMEINFO* (*GetTime)(VOID);
73 ULONG (*GetRelativeTime)(VOID);
74
75 PCONFIGURATION_COMPONENT_DATA (*HwDetect)(VOID);
76 } MACHVTBL, *PMACHVTBL;
77
78 VOID MachInit(const char *CmdLine);
79
80 extern MACHVTBL MachVtbl;
81
82 VOID MachConsPutChar(int Ch);
83 BOOLEAN MachConsKbHit();
84 int MachConsGetCh();
85 VOID MachVideoClearScreen(UCHAR Attr);
86 VIDEODISPLAYMODE MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init);
87 VOID MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
88 ULONG MachVideoGetBufferSize(VOID);
89 VOID MachVideoSetTextCursorPosition(ULONG X, ULONG Y);
90 VOID MachVideoHideShowTextCursor(BOOLEAN Show);
91 VOID MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y);
92 VOID MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer);
93 BOOLEAN MachVideoIsPaletteFixed(VOID);
94 VOID MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
95 VOID MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue);
96 VOID MachVideoSync(VOID);
97 VOID MachBeep(VOID);
98 MEMORY_DESCRIPTOR* ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current);
99 BOOLEAN MachDiskGetBootPath(char *BootPath, unsigned Size);
100 BOOLEAN MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size);
101 BOOLEAN MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
102 BOOLEAN MachDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
103 BOOLEAN MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry);
104 ULONG MachDiskGetCacheableBlockCount(ULONG DriveNumber);
105 TIMEINFO* ArcGetTime(VOID);
106 ULONG ArcGetRelativeTime(VOID);
107 VOID MachHwDetect(VOID);
108 VOID MachPrepareForReactOS(IN BOOLEAN Setup);
109
110 #define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch)
111 #define MachConsKbHit() MachVtbl.ConsKbHit()
112 #define MachConsGetCh() MachVtbl.ConsGetCh()
113 #define MachVideoClearScreen(Attr) MachVtbl.VideoClearScreen(Attr)
114 #define MachVideoSetDisplayMode(Mode, Init) MachVtbl.VideoSetDisplayMode((Mode), (Init))
115 #define MachVideoGetDisplaySize(W, H, D) MachVtbl.VideoGetDisplaySize((W), (H), (D))
116 #define MachVideoGetBufferSize() MachVtbl.VideoGetBufferSize()
117 #define MachVideoSetTextCursorPosition(X, Y) MachVtbl.VideoSetTextCursorPosition((X), (Y))
118 #define MachVideoHideShowTextCursor(Show) MachVtbl.VideoHideShowTextCursor(Show)
119 #define MachVideoPutChar(Ch, Attr, X, Y) MachVtbl.VideoPutChar((Ch), (Attr), (X), (Y))
120 #define MachVideoCopyOffScreenBufferToVRAM(Buf) MachVtbl.VideoCopyOffScreenBufferToVRAM(Buf)
121 #define MachVideoIsPaletteFixed() MachVtbl.VideoIsPaletteFixed()
122 #define MachVideoSetPaletteColor(Col, R, G, B) MachVtbl.VideoSetPaletteColor((Col), (R), (G), (B))
123 #define MachVideoGetPaletteColor(Col, R, G, B) MachVtbl.VideoGetPaletteColor((Col), (R), (G), (B))
124 #define MachVideoSync() MachVtbl.VideoSync()
125 #define MachBeep() MachVtbl.Beep()
126 #define MachPrepareForReactOS(a) MachVtbl.PrepareForReactOS(a)
127 #define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size))
128 #define MachDiskNormalizeSystemPath(Path, Size) MachVtbl.DiskNormalizeSystemPath((Path), (Size))
129 #define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
130 #define MachDiskGetPartitionEntry(Drive, Part, Entry) MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))
131 #define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive), (Geom))
132 #define MachDiskGetCacheableBlockCount(Drive) MachVtbl.DiskGetCacheableBlockCount(Drive)
133 #define MachHwDetect() MachVtbl.HwDetect()
134
135 #endif /* __MACHINE_H_ */
136
137 /* EOF */