[FREELDR] Other enhancements.
[reactos.git] / 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 (*VideoGetFontsFromFirmware)(PULONG RomFontPointers);
50 VOID (*VideoSetTextCursorPosition)(UCHAR X, UCHAR Y);
51 VOID (*VideoHideShowTextCursor)(BOOLEAN Show);
52 VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y);
53 VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer);
54 BOOLEAN (*VideoIsPaletteFixed)(VOID);
55 VOID (*VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
56 VOID (*VideoGetPaletteColor)(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
57 VOID (*VideoSync)(VOID);
58 VOID (*Beep)(VOID);
59 VOID (*PrepareForReactOS)(VOID);
60
61 // NOTE: Not in the machine.c ...
62 FREELDR_MEMORY_DESCRIPTOR* (*GetMemoryDescriptor)(FREELDR_MEMORY_DESCRIPTOR* Current);
63 PFREELDR_MEMORY_DESCRIPTOR (*GetMemoryMap)(PULONG MaxMemoryMapSize);
64 VOID (*GetExtendedBIOSData)(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize);
65
66 UCHAR (*GetFloppyCount)(VOID);
67 BOOLEAN (*DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
68 BOOLEAN (*DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry);
69 ULONG (*DiskGetCacheableBlockCount)(UCHAR DriveNumber);
70
71 // NOTE: In the machine.c under the name of "ArcGetXXXTime"
72 TIMEINFO* (*GetTime)(VOID);
73 ULONG (*GetRelativeTime)(VOID);
74
75 // NOTE: Not in the machine.c ...
76 BOOLEAN (*InitializeBootDevices)(VOID);
77 PCONFIGURATION_COMPONENT_DATA (*HwDetect)(VOID);
78 VOID (*HwIdle)(VOID);
79 } MACHVTBL, *PMACHVTBL;
80
81 extern MACHVTBL MachVtbl;
82
83 /* NOTE: Implemented by each architecture */
84 VOID MachInit(const char *CmdLine);
85
86 #define MachConsPutChar(Ch) \
87 MachVtbl.ConsPutChar(Ch)
88 #define MachConsKbHit() \
89 MachVtbl.ConsKbHit()
90 #define MachConsGetCh() \
91 MachVtbl.ConsGetCh()
92 #define MachVideoClearScreen(Attr) \
93 MachVtbl.VideoClearScreen(Attr)
94 #define MachVideoSetDisplayMode(Mode, Init) \
95 MachVtbl.VideoSetDisplayMode((Mode), (Init))
96 #define MachVideoGetDisplaySize(W, H, D) \
97 MachVtbl.VideoGetDisplaySize((W), (H), (D))
98 #define MachVideoGetBufferSize() \
99 MachVtbl.VideoGetBufferSize()
100 #define MachVideoGetFontsFromFirmware(RomFontPointers) \
101 MachVtbl.VideoGetFontsFromFirmware((RomFontPointers))
102 #define MachVideoSetTextCursorPosition(X, Y) \
103 MachVtbl.VideoSetTextCursorPosition((X), (Y))
104 #define MachVideoHideShowTextCursor(Show) \
105 MachVtbl.VideoHideShowTextCursor(Show)
106 #define MachVideoPutChar(Ch, Attr, X, Y) \
107 MachVtbl.VideoPutChar((Ch), (Attr), (X), (Y))
108 #define MachVideoCopyOffScreenBufferToVRAM(Buf) \
109 MachVtbl.VideoCopyOffScreenBufferToVRAM(Buf)
110 #define MachVideoIsPaletteFixed() \
111 MachVtbl.VideoIsPaletteFixed()
112 #define MachVideoSetPaletteColor(Col, R, G, B) \
113 MachVtbl.VideoSetPaletteColor((Col), (R), (G), (B))
114 #define MachVideoGetPaletteColor(Col, R, G, B) \
115 MachVtbl.VideoGetPaletteColor((Col), (R), (G), (B))
116 #define MachVideoSync() \
117 MachVtbl.VideoSync()
118 #define MachBeep() \
119 MachVtbl.Beep()
120 #define MachPrepareForReactOS() \
121 MachVtbl.PrepareForReactOS()
122 #define MachGetExtendedBIOSData(ExtendedBIOSDataArea, ExtendedBIOSDataSize) \
123 MachVtbl.GetExtendedBIOSData((ExtendedBIOSDataArea), (ExtendedBIOSDataSize))
124 #define MachGetFloppyCount() \
125 MachVtbl.GetFloppyCount()
126 #define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) \
127 MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
128 #define MachDiskGetDriveGeometry(Drive, Geom) \
129 MachVtbl.DiskGetDriveGeometry((Drive), (Geom))
130 #define MachDiskGetCacheableBlockCount(Drive) \
131 MachVtbl.DiskGetCacheableBlockCount(Drive)
132
133 #define MachInitializeBootDevices() \
134 MachVtbl.InitializeBootDevices()
135
136 #define MachHwDetect() MachVtbl.HwDetect()
137 #define MachHwIdle() MachVtbl.HwIdle()
138
139 /* ARC FUNCTIONS **************************************************************/
140
141 TIMEINFO* ArcGetTime(VOID);
142 ULONG ArcGetRelativeTime(VOID);
143
144 /* EOF */