[BOOTVID] Code refactoring. (#2510)

- Abstract the VGA and LCD code.
- Create a common file for all platforms.
This commit is contained in:
Dmitry Borisov 2020-04-08 11:42:05 +06:00 committed by Hermès Bélusca-Maïto
parent df23bb779e
commit 5f2ca473dc
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
9 changed files with 624 additions and 659 deletions

View file

@ -5,16 +5,22 @@
#include <ndk/halfuncs.h>
#include <drivers/bootvid/bootvid.h>
/* Arch specific includes */
#if defined(_M_IX86) || defined(_M_AMD64)
#include "i386/pc/vga.h"
#include "i386/pc/pc.h"
#elif defined(_M_ARM)
#include "arm/arm.h"
#else
#error Unknown architecture
#endif
/* Define if FontData has upside down characters */
#undef CHAR_GEN_UPSIDE_DOWN
#define BOOTCHAR_HEIGHT 13
#define BOOTCHAR_WIDTH 8 // Each character line is encoded in a UCHAR.
#ifndef _M_ARM
#include "i386/pc/vga.h"
#endif /* _M_ARM */
/* Bitmap Header */
typedef struct tagBITMAPINFOHEADER
{
@ -35,31 +41,43 @@ typedef struct tagBITMAPINFOHEADER
#define BI_RGB 0
#define BI_RLE4 2
typedef struct _PALETTE_ENTRY
{
UCHAR Red;
UCHAR Green;
UCHAR Blue;
} PALETTE_ENTRY, *PPALETTE_ENTRY;
VOID
NTAPI
InitializePalette(VOID);
/* Globals */
#ifndef _M_ARM
extern ULONG curr_x;
extern ULONG curr_y;
extern ULONG_PTR VgaRegisterBase;
extern ULONG_PTR VgaBase;
extern USHORT AT_Initialization[];
extern USHORT VGA_640x480[];
#endif /* _M_ARM */
VOID
NTAPI
DisplayCharacter(
_In_ CHAR Character,
_In_ ULONG Left,
_In_ ULONG Top,
_In_ ULONG TextColor,
_In_ ULONG BackColor
);
VOID
PrepareForSetPixel(VOID);
VOID
NTAPI
InitPaletteWithTable(
_In_ PULONG Table,
_In_ ULONG Count);
/*
* Globals
*/
extern UCHAR VidpTextColor;
extern ULONG VidpCurrentX;
extern ULONG VidpCurrentY;
extern ULONG VidpScrollRegion[4];
extern UCHAR FontData[256 * BOOTCHAR_HEIGHT];
#define __inpb(Port) \
READ_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)))
#define __inpw(Port) \
READ_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)))
#define __outpb(Port, Value) \
WRITE_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)), (UCHAR)(Value))
#define __outpw(Port, Value) \
WRITE_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)), (USHORT)(Value))
#endif /* _BOOTVID_PCH_ */