ab24ad82cf0dce75a462fb2c5232089f18373fbc
[reactos.git] / freeldr / freeldr / include / machine.h
1 /* $Id: machine.h,v 1.7 2004/11/28 22:42:40 gvg Exp $
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 BOOL (*ConsKbHit)(VOID);
41 int (*ConsGetCh)(VOID);
42
43 VOID (*VideoClearScreen)(U8 Attr);
44 VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOL Init);
45 VOID (*VideoGetDisplaySize)(PU32 Width, PU32 Height, PU32 Depth);
46 U32 (*VideoGetBufferSize)(VOID);
47 VOID (*VideoSetTextCursorPosition)(U32 X, U32 Y);
48 VOID (*VideoHideShowTextCursor)(BOOL Show);
49 VOID (*VideoPutChar)(int Ch, U8 Attr, unsigned X, unsigned Y);
50 VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer);
51 BOOL (*VideoIsPaletteFixed)(VOID);
52 VOID (*VideoSetPaletteColor)(U8 Color, U8 Red, U8 Green, U8 Blue);
53 VOID (*VideoGetPaletteColor)(U8 Color, U8* Red, U8* Green, U8* Blue);
54 VOID (*VideoSync)(VOID);
55 VOID (*VideoPrepareForReactOS)(VOID);
56
57 U32 (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize);
58
59 BOOL (*DiskReadLogicalSectors)(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer);
60 BOOL (*DiskGetPartitionEntry)(U32 DriveNumber, U32 PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
61 BOOL (*DiskGetDriveGeometry)(U32 DriveNumber, PGEOMETRY DriveGeometry);
62 U32 (*DiskGetCacheableBlockCount)(U32 DriveNumber);
63
64 VOID (*RTCGetCurrentDateTime)(PU32 Year, PU32 Month, PU32 Day, PU32 Hour, PU32 Minute, PU32 Second);
65
66 VOID (*HwDetect)(VOID);
67 } MACHVTBL, *PMACHVTBL;
68
69 VOID MachInit(VOID);
70
71 extern MACHVTBL MachVtbl;
72
73 #define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch)
74 #define MachConsKbHit() MachVtbl.ConsKbHit()
75 #define MachConsGetCh() MachVtbl.ConsGetCh()
76 #define MachVideoClearScreen(Attr) MachVtbl.VideoClearScreen(Attr)
77 #define MachVideoSetDisplayMode(Mode, Init) MachVtbl.VideoSetDisplayMode((Mode), (Init))
78 #define MachVideoGetDisplaySize(W, H, D) MachVtbl.VideoGetDisplaySize((W), (H), (D))
79 #define MachVideoGetBufferSize() MachVtbl.VideoGetBufferSize()
80 #define MachVideoSetTextCursorPosition(X, Y) MachVtbl.VideoSetTextCursorPosition((X), (Y))
81 #define MachVideoHideShowTextCursor(Show) MachVtbl.VideoHideShowTextCursor(Show)
82 #define MachVideoPutChar(Ch, Attr, X, Y) MachVtbl.VideoPutChar((Ch), (Attr), (X), (Y))
83 #define MachVideoCopyOffScreenBufferToVRAM(Buf) MachVtbl.VideoCopyOffScreenBufferToVRAM(Buf)
84 #define MachVideoIsPaletteFixed() MachVtbl.VideoIsPaletteFixed()
85 #define MachVideoSetPaletteColor(Col, R, G, B) MachVtbl.VideoSetPaletteColor((Col), (R), (G), (B))
86 #define MachVideoGetPaletteColor(Col, R, G, B) MachVtbl.VideoGetPaletteColor((Col), (R), (G), (B))
87 #define MachVideoSync() MachVtbl.VideoSync()
88 #define MachVideoPrepareForReactOS() MachVtbl.VideoPrepareForReactOS()
89 #define MachGetMemoryMap(MMap, Size) MachVtbl.GetMemoryMap((MMap), (Size))
90 #define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
91 #define MachDiskGetPartitionEntry(Drive, Part, Entry) MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))
92 #define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive), (Geom))
93 #define MachDiskGetCacheableBlockCount(Drive) MachVtbl.DiskGetCacheableBlockCount(Drive)
94 #define MachRTCGetCurrentDateTime(Y, Mo, D, H, Mi, S) MachVtbl.RTCGetCurrentDateTime((Y), (Mo), (D), (H), (Mi), (S));
95 #define MachHwDetect() MachVtbl.HwDetect()
96
97 #endif /* __MACHINE_H_ */
98
99 /* EOF */