Author: hbelusca
Date: Sun Aug 31 23:00:29 2014
New Revision: 64017
URL:
http://svn.reactos.org/svn/reactos?rev=64017&view=rev
Log:
[BOOTVID]
- Synchronize correctly arm/bootdata.c with i386, as it was done previously.
- Code formatting: whitespace fixes, add braces/brackets and spaces where needed; comments
styling.
- Correctly put braces for casts and around macro parameters.
- Add some IN/OUT.
- Fix parameter names of a function.
[INBV]
- Fix parameter names of two functions.
Modified:
trunk/reactos/drivers/base/bootvid/arm/bootdata.c
trunk/reactos/drivers/base/bootvid/arm/bootvid.c
trunk/reactos/drivers/base/bootvid/i386/bootvid.c
trunk/reactos/drivers/base/bootvid/i386/vga.c
trunk/reactos/drivers/base/bootvid/precomp.h
trunk/reactos/include/ndk/inbvfuncs.h
trunk/reactos/include/reactos/drivers/bootvid/bootvid.h
trunk/reactos/ntoskrnl/inbv/inbv.c
Modified: trunk/reactos/drivers/base/bootvid/arm/bootdata.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/bootvid/arm/b…
==============================================================================
--- trunk/reactos/drivers/base/bootvid/arm/bootdata.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/bootvid/arm/bootdata.c [iso-8859-1] Sun Aug 31 23:00:29
2014
@@ -48,7 +48,10 @@
0x0 // End of command stream
};
-UCHAR FontData[256 * 13] =
+//
+// The character generator is in natural order, top of char is first element.
+//
+UCHAR FontData[256 * BOOTCHAR_HEIGHT] =
{
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 0
0x00, 0x00, 0x3C, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x3C, 0x00, 0x00, 0x00, // 13
Modified: trunk/reactos/drivers/base/bootvid/arm/bootvid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/bootvid/arm/b…
==============================================================================
--- trunk/reactos/drivers/base/bootvid/arm/bootvid.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/bootvid/arm/bootvid.c [iso-8859-1] Sun Aug 31 23:00:29
2014
@@ -3,19 +3,19 @@
#define NDEBUG
#include <debug.h>
-#define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2)
-#define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1)
-#define LCDCONTROL_LCDPWR (1 << 11)
-#define LCDCONTROL_LCDEN (1)
-#define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1)
-#define LCDCONTROL_LCDTFT (1 << 5)
-
-#define PL110_LCDTIMING0 (PVOID)0xE0020000
-#define PL110_LCDTIMING1 (PVOID)0xE0020004
-#define PL110_LCDTIMING2 (PVOID)0xE0020008
-#define PL110_LCDUPBASE (PVOID)0xE0020010
-#define PL110_LCDLPBASE (PVOID)0xE0020014
-#define PL110_LCDCONTROL (PVOID)0xE0020018
+#define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2)
+#define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1)
+#define LCDCONTROL_LCDPWR (1 << 11)
+#define LCDCONTROL_LCDEN (1)
+#define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1)
+#define LCDCONTROL_LCDTFT (1 << 5)
+
+#define PL110_LCDTIMING0 (PVOID)0xE0020000
+#define PL110_LCDTIMING1 (PVOID)0xE0020004
+#define PL110_LCDTIMING2 (PVOID)0xE0020008
+#define PL110_LCDUPBASE (PVOID)0xE0020010
+#define PL110_LCDLPBASE (PVOID)0xE0020014
+#define PL110_LCDCONTROL (PVOID)0xE0020018
#define READ_REGISTER_ULONG(r) (*(volatile ULONG * const)(r))
#define WRITE_REGISTER_ULONG(r, v) (*(volatile ULONG *)(r) = (v))
@@ -71,14 +71,14 @@
VidpBuildColor(IN UCHAR Color)
{
UCHAR Red, Green, Blue;
-
+
//
// Extract color components
//
Red = VidpVga8To16BitTransform[Color].Red;
Green = VidpVga8To16BitTransform[Color].Green;
Blue = VidpVga8To16BitTransform[Color].Blue;
-
+
//
// Build the 16-bit color mask
//
@@ -93,7 +93,7 @@
IN UCHAR Color)
{
PUSHORT PixelPosition;
-
+
//
// Calculate the pixel position
//
@@ -107,18 +107,18 @@
VOID
NTAPI
-DisplayCharacter(CHAR Character,
- ULONG Left,
- ULONG Top,
- ULONG TextColor,
- ULONG BackTextColor)
+DisplayCharacter(IN CHAR Character,
+ IN ULONG Left,
+ IN ULONG Top,
+ IN ULONG TextColor,
+ IN ULONG BackTextColor)
{
PUCHAR FontChar;
ULONG i, j, XOffset;
-
+
/* Get the font line for this character */
FontChar = &FontData[Character * 13 - Top];
-
+
/* Loop each pixel height */
i = 13;
do
@@ -140,11 +140,11 @@
/* transparent. */
VidpSetPixel(XOffset, Top, (UCHAR)BackTextColor);
}
-
+
/* Increase X Offset */
XOffset++;
} while (j >>= 1);
-
+
/* Move to the next Y ordinate */
Top++;
} while (--i);
@@ -152,56 +152,56 @@
VOID
NTAPI
-VgaScroll(ULONG Scroll)
+VgaScroll(IN ULONG Scroll)
{
ULONG Top, Offset;
PUSHORT SourceOffset, DestOffset;
PUSHORT i, j;
-
+
/* Set memory positions of the scroll */
SourceOffset = &VgaArmBase[(VidpScrollRegion[1] * 80) + (VidpScrollRegion[0]
>> 3)];
DestOffset = &SourceOffset[Scroll * 80];
-
+
/* Save top and check if it's above the bottom */
Top = VidpScrollRegion[1];
if (Top > VidpScrollRegion[3]) return;
-
+
/* Start loop */
do
{
/* Set number of bytes to loop and start offset */
Offset = VidpScrollRegion[0] >> 3;
j = SourceOffset;
-
+
/* Check if this is part of the scroll region */
if (Offset <= (VidpScrollRegion[2] >> 3))
{
/* Update position */
i = (PUSHORT)(DestOffset - SourceOffset);
-
+
/* Loop the X axis */
do
{
/* Write value in the new position so that we can do the scroll */
WRITE_REGISTER_USHORT(j, READ_REGISTER_USHORT(j + (ULONG_PTR)i));
-
+
/* Move to the next memory location to write to */
j++;
-
+
/* Move to the next byte in the region */
Offset++;
-
+
/* Make sure we don't go past the scroll region */
} while (Offset <= (VidpScrollRegion[2] >> 3));
}
-
+
/* Move to the next line */
SourceOffset += 80;
DestOffset += 80;
-
+
/* Increase top */
Top++;
-
+
/* Make sure we don't go past the scroll region */
} while (Top <= VidpScrollRegion[3]);
}
@@ -214,7 +214,7 @@
{
PUSHORT Position1, Position2;
ULONG Count;
-
+
/* Check which way we're preserving */
if (Direction)
{
@@ -228,21 +228,17 @@
Position1 = &VgaArmBase[0x9600];
Position2 = &VgaArmBase[CurrentTop * 80];
}
-
- /* Set the count and make sure it's above 0 */
+
+ /* Set the count and loop every pixel */
Count = TopDelta * 80;
- if (Count)
- {
- /* Loop every pixel */
- do
- {
- /* Write the data back on the other position */
- WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2));
-
- /* Increase both positions */
- Position2++;
- Position1++;
- } while (--Count);
+ while (Count--)
+ {
+ /* Write the data back on the other position */
+ WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2));
+
+ /* Increase both positions */
+ Position1++;
+ Position2++;
}
}
@@ -255,17 +251,17 @@
//
WRITE_REGISTER_ULONG(PL110_LCDUPBASE, VgaPhysical.LowPart);
WRITE_REGISTER_ULONG(PL110_LCDLPBASE, VgaPhysical.LowPart);
-
+
//
// Initialize timings to 640x480
//
- WRITE_REGISTER_ULONG(PL110_LCDTIMING0, LCDTIMING0_PPL(640));
- WRITE_REGISTER_ULONG(PL110_LCDTIMING1, LCDTIMING1_LPP(480));
-
+ WRITE_REGISTER_ULONG(PL110_LCDTIMING0, LCDTIMING0_PPL(640));
+ WRITE_REGISTER_ULONG(PL110_LCDTIMING1, LCDTIMING1_LPP(480));
+
//
// Enable the LCD Display
//
- WRITE_REGISTER_ULONG(PL110_LCDCONTROL,
+ WRITE_REGISTER_ULONG(PL110_LCDCONTROL,
LCDCONTROL_LCDEN |
LCDCONTROL_LCDTFT |
LCDCONTROL_LCDPWR |
@@ -280,9 +276,9 @@
BOOLEAN
NTAPI
VidInitialize(IN BOOLEAN SetMode)
-{
+{
DPRINT1("bv-arm v0.1\n");
-
+
//
// Allocate framebuffer
// 600kb works out to 640x480@16bpp
@@ -290,7 +286,7 @@
VgaPhysical.QuadPart = -1;
VgaArmBase = MmAllocateContiguousMemory(600 * 1024, VgaPhysical);
if (!VgaArmBase) return FALSE;
-
+
//
// Get physical address
//
@@ -321,12 +317,12 @@
//
VidpCurrentX = 0;
VidpCurrentY = 0;
-
+
//
// Re-initialize the VGA Display
//
VidpInitializeDisplay();
-
+
//
// Re-initialize the palette and fill the screen black
//
@@ -339,16 +335,16 @@
*/
ULONG
NTAPI
-VidSetTextColor(ULONG Color)
+VidSetTextColor(IN ULONG Color)
{
UCHAR OldColor;
-
+
//
// Save the old, set the new
//
OldColor = VidpTextColor;
VidpTextColor = Color;
-
+
//
// Return the old text color
//
@@ -360,10 +356,10 @@
*/
VOID
NTAPI
-VidDisplayStringXY(PUCHAR String,
- ULONG Left,
- ULONG Top,
- BOOLEAN Transparent)
+VidDisplayStringXY(IN PUCHAR String,
+ IN ULONG Left,
+ IN ULONG Top,
+ IN BOOLEAN Transparent)
{
UNIMPLEMENTED;
while (TRUE);
@@ -374,24 +370,24 @@
*/
VOID
NTAPI
-VidSetScrollRegion(ULONG x1,
- ULONG y1,
- ULONG x2,
- ULONG y2)
+VidSetScrollRegion(IN ULONG Left,
+ IN ULONG Top,
+ IN ULONG Right,
+ IN ULONG Bottom)
{
/* Assert alignment */
- ASSERT((x1 & 0x7) == 0);
- ASSERT((x2 & 0x7) == 7);
-
+ ASSERT((Left & 0x7) == 0);
+ ASSERT((Right & 0x7) == 7);
+
/* Set Scroll Region */
- VidpScrollRegion[0] = x1;
- VidpScrollRegion[1] = y1;
- VidpScrollRegion[2] = x2;
- VidpScrollRegion[3] = y2;
-
+ VidpScrollRegion[0] = Left;
+ VidpScrollRegion[1] = Top;
+ VidpScrollRegion[2] = Right;
+ VidpScrollRegion[3] = Bottom;
+
/* Set current X and Y */
- VidpCurrentX = x1;
- VidpCurrentY = y1;
+ VidpCurrentX = Left;
+ VidpCurrentY = Top;
}
/*
@@ -426,10 +422,10 @@
*/
VOID
NTAPI
-VidDisplayString(PUCHAR String)
+VidDisplayString(IN PUCHAR String)
{
ULONG TopDelta = 14;
-
+
/* Start looping the string */
while (*String)
{
@@ -443,14 +439,14 @@
/* Scroll the view */
VgaScroll(TopDelta);
VidpCurrentY -= TopDelta;
-
+
/* Preserve row */
PreserveRow(VidpCurrentY, TopDelta, TRUE);
}
-
+
/* Update current X */
VidpCurrentX = VidpScrollRegion[0];
-
+
/* Preseve the current row */
PreserveRow(VidpCurrentY, TopDelta, FALSE);
}
@@ -458,7 +454,7 @@
{
/* Update current X */
VidpCurrentX = VidpScrollRegion[0];
-
+
/* Check if we're being followed by a new line */
if (String[1] != '\n') NextLine = TRUE;
}
@@ -471,7 +467,7 @@
PreserveRow(VidpCurrentY, TopDelta, TRUE);
NextLine = FALSE;
}
-
+
/* Display this character */
DisplayCharacter(*String,
VidpCurrentX,
@@ -479,7 +475,7 @@
VidpTextColor,
16);
VidpCurrentX += 8;
-
+
/* Check if we should scroll */
if (VidpCurrentX > VidpScrollRegion[2])
{
@@ -490,29 +486,29 @@
/* Do the scroll */
VgaScroll(TopDelta);
VidpCurrentY -= TopDelta;
-
+
/* Save the row */
PreserveRow(VidpCurrentY, TopDelta, TRUE);
}
-
+
/* Update X */
VidpCurrentX = VidpScrollRegion[0];
}
}
-
+
/* Get the next character */
String++;
- }
-}
-
-/*
- * @implemented
- */
-VOID
-NTAPI
-VidBitBlt(PUCHAR Buffer,
- ULONG Left,
- ULONG Top)
+ }
+}
+
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+VidBitBlt(IN PUCHAR Buffer,
+ IN ULONG Left,
+ IN ULONG Top)
{
UNIMPLEMENTED;
//while (TRUE);
@@ -523,12 +519,12 @@
*/
VOID
NTAPI
-VidScreenToBufferBlt(PUCHAR Buffer,
- ULONG Left,
- ULONG Top,
- ULONG Width,
- ULONG Height,
- ULONG Delta)
+VidScreenToBufferBlt(IN PUCHAR Buffer,
+ IN ULONG Left,
+ IN ULONG Top,
+ IN ULONG Width,
+ IN ULONG Height,
+ IN ULONG Delta)
{
UNIMPLEMENTED;
while (TRUE);
@@ -546,12 +542,12 @@
IN UCHAR Color)
{
int y, x;
-
+
//
// Loop along the Y-axis
//
- for (y = Top; y <= Bottom; y++)
- {
+ for (y = Top; y <= Bottom; y++)
+ {
//
// Loop along the X-axis
//
@@ -562,5 +558,5 @@
//
VidpSetPixel(x, y, Color);
}
- }
-}
+ }
+}
Modified: trunk/reactos/drivers/base/bootvid/i386/bootvid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/bootvid/i386/…
==============================================================================
--- trunk/reactos/drivers/base/bootvid/i386/bootvid.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/bootvid/i386/bootvid.c [iso-8859-1] Sun Aug 31 23:00:29
2014
@@ -5,7 +5,7 @@
/* PRIVATE FUNCTIONS *********************************************************/
-BOOLEAN
+static BOOLEAN
NTAPI
VgaInterpretCmdStream(IN PUSHORT CmdStream)
{
@@ -139,6 +139,7 @@
switch (Minor)
{
case 0:
+ {
/* The port is what is in the stream right now */
ShortPort = UlongToPtr(*CmdStream);
@@ -167,7 +168,10 @@
WRITE_PORT_USHORT(ShortPort, ShortValue);
}
break;
+ }
+
case 1:
+ {
/* The port is what is in the stream right now. Add the base too */
Port = *CmdStream + Base;
@@ -196,7 +200,10 @@
WRITE_PORT_UCHAR(Port, Value);
}
break;
+ }
+
case 2:
+ {
/* The port is what is in the stream right now. Add the base too */
Port = *CmdStream + Base;
@@ -208,6 +215,8 @@
/* Write the value */
WRITE_PORT_UCHAR(Port, Value);
break;
+ }
+
default:
/* Unknown command, fail */
return FALSE;
@@ -227,7 +236,7 @@
return TRUE;
}
-BOOLEAN
+static BOOLEAN
NTAPI
VgaIsPresent(VOID)
{
Modified: trunk/reactos/drivers/base/bootvid/i386/vga.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/bootvid/i386/…
==============================================================================
--- trunk/reactos/drivers/base/bootvid/i386/vga.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/bootvid/i386/vga.c [iso-8859-1] Sun Aug 31 23:00:29 2014
@@ -2,14 +2,14 @@
/* GLOBALS *******************************************************************/
-ULONG ScrollRegion[4] =
+static ULONG ScrollRegion[4] =
{
0,
0,
640 - 1,
480 - 1
};
-UCHAR lMaskTable[8] =
+static UCHAR lMaskTable[8] =
{
(1 << 8) - (1 << 0),
(1 << 7) - (1 << 0),
@@ -20,7 +20,7 @@
(1 << 2) - (1 << 0),
(1 << 1) - (1 << 0)
};
-UCHAR rMaskTable[8] =
+static UCHAR rMaskTable[8] =
{
(1 << 7),
(1 << 7)+ (1 << 6),
@@ -43,7 +43,7 @@
(1 << 1),
(1 << 0),
};
-ULONG lookup[16] =
+static ULONG lookup[16] =
{
0x0000,
0x0100,
@@ -63,24 +63,24 @@
0x1111,
};
-ULONG VidTextColor = 0xF;
+ULONG_PTR VgaRegisterBase = 0;
+ULONG_PTR VgaBase = 0;
ULONG curr_x = 0;
ULONG curr_y = 0;
-BOOLEAN CarriageReturn = FALSE;
-ULONG_PTR VgaRegisterBase = 0;
-ULONG_PTR VgaBase = 0;
+static ULONG VidTextColor = 0xF;
+static BOOLEAN CarriageReturn = FALSE;
#define __outpb(Port, Value) \
- WRITE_PORT_UCHAR((PUCHAR)VgaRegisterBase + Port, (UCHAR)Value)
+ WRITE_PORT_UCHAR((PUCHAR)(VgaRegisterBase + (Port)), (UCHAR)(Value))
#define __outpw(Port, Value) \
- WRITE_PORT_USHORT((PUSHORT)(VgaRegisterBase + Port), (USHORT)Value)
+ WRITE_PORT_USHORT((PUSHORT)(VgaRegisterBase + (Port)), (USHORT)(Value))
/* PRIVATE FUNCTIONS *********************************************************/
-VOID
-NTAPI
-ReadWriteMode(UCHAR Mode)
+static VOID
+NTAPI
+ReadWriteMode(IN UCHAR Mode)
{
UCHAR Value;
@@ -93,7 +93,6 @@
/* Set the new mode */
__outpb(0x3CF, Mode | Value);
}
-
FORCEINLINE
VOID
@@ -104,7 +103,7 @@
PUCHAR PixelPosition;
/* Calculate the pixel position. */
- PixelPosition = (PUCHAR)VgaBase + (Left >> 3) + (Top * 80);
+ PixelPosition = (PUCHAR)(VgaBase + (Left >> 3) + (Top * 80));
/* Select the bitmask register and write the mask */
__outpw(0x3CE, (PixelMask[Left & 7] << 8) | 8);
@@ -113,6 +112,14 @@
WRITE_REGISTER_UCHAR(PixelPosition,
READ_REGISTER_UCHAR(PixelPosition) & Color);
}
+
+#define SET_PIXELS(_PixelPtr, _PixelMask, _TextColor) \
+do { \
+ /* Select the bitmask register and write the mask */ \
+ __outpw(0x3CE, ((_PixelMask) << 8) | 8); \
+ /* Set the new color */ \
+ WRITE_REGISTER_UCHAR((_PixelPtr), (UCHAR)(_TextColor)); \
+} while (0);
#ifdef CHAR_GEN_UPSIDE_DOWN
# define GetFontPtr(_Char) &FontData[_Char * BOOTCHAR_HEIGHT] + BOOTCHAR_HEIGHT - 1;
@@ -122,20 +129,13 @@
# define FONT_PTR_DELTA (1)
#endif
-#define SET_PIXELS(_PixelPtr, _PixelMask, _TextColor) \
- /* Select the bitmask register and write the mask */ \
- __outpw(0x3CE, (_PixelMask << 8) | 8); \
-\
- /* Set the new color */ \
- WRITE_REGISTER_UCHAR(_PixelPtr, (UCHAR)_TextColor);\
-
-VOID
-NTAPI
-DisplayCharacter(CHAR Character,
- ULONG Left,
- ULONG Top,
- ULONG TextColor,
- ULONG BackColor)
+static VOID
+NTAPI
+DisplayCharacter(IN CHAR Character,
+ IN ULONG Left,
+ IN ULONG Top,
+ IN ULONG TextColor,
+ IN ULONG BackColor)
{
PUCHAR FontChar, PixelPtr;
ULONG Height;
@@ -155,7 +155,7 @@
/* Get the font and pixel pointer */
FontChar = GetFontPtr(Character);
- PixelPtr = (PUCHAR)VgaBase + (Left >> 3) + (Top * 80);
+ PixelPtr = (PUCHAR)(VgaBase + (Left >> 3) + (Top * 80));
/* Loop all pixel rows */
Height = BOOTCHAR_HEIGHT;
@@ -174,7 +174,7 @@
/* Get the font and pixel pointer (2nd byte) */
FontChar = GetFontPtr(Character);
- PixelPtr = (PUCHAR)VgaBase + (Left >> 3) + (Top * 80) + 1;
+ PixelPtr = (PUCHAR)(VgaBase + (Left >> 3) + (Top * 80) + 1);
/* Loop all pixel rows */
Height = BOOTCHAR_HEIGHT;
@@ -198,7 +198,7 @@
/* Get the font and pixel pointer */
FontChar = GetFontPtr(Character);
- PixelPtr = (PUCHAR)VgaBase + (Left >> 3) + (Top * 80);
+ PixelPtr = (PUCHAR)(VgaBase + (Left >> 3) + (Top * 80));
/* Loop all pixel rows */
Height = BOOTCHAR_HEIGHT;
@@ -217,7 +217,7 @@
/* Get the font and pixel pointer (2nd byte) */
FontChar = GetFontPtr(Character);
- PixelPtr = (PUCHAR)VgaBase + (Left >> 3) + (Top * 80) + 1;
+ PixelPtr = (PUCHAR)(VgaBase + (Left >> 3) + (Top * 80) + 1);
/* Loop all pixel rows */
Height = BOOTCHAR_HEIGHT;
@@ -230,13 +230,13 @@
}
}
-VOID
-NTAPI
-DisplayStringXY(PUCHAR String,
- ULONG Left,
- ULONG Top,
- ULONG TextColor,
- ULONG BackColor)
+static VOID
+NTAPI
+DisplayStringXY(IN PUCHAR String,
+ IN ULONG Left,
+ IN ULONG Top,
+ IN ULONG TextColor,
+ IN ULONG BackColor)
{
/* Loop every character */
while (*String)
@@ -250,7 +250,7 @@
}
}
-VOID
+static VOID
NTAPI
SetPaletteEntryRGB(IN ULONG Id,
IN ULONG Rgb)
@@ -266,7 +266,7 @@
__outpb(0x3C9, Colors[0] >> 2);
}
-VOID
+static VOID
NTAPI
InitPaletteWithTable(IN PULONG Table,
IN ULONG Count)
@@ -282,7 +282,7 @@
}
}
-VOID
+static VOID
NTAPI
SetPaletteEntry(IN ULONG Id,
IN ULONG PaletteEntry)
@@ -300,18 +300,18 @@
NTAPI
InitializePalette(VOID)
{
- ULONG PaletteEntry[16] = {0,
- 0x20,
- 0x2000,
- 0x2020,
+ ULONG PaletteEntry[16] = {0x000000,
+ 0x000020,
+ 0x002000,
+ 0x002020,
0x200000,
0x200020,
0x202000,
0x202020,
0x303030,
- 0x3F,
- 0x3F00,
- 0x3F3F,
+ 0x00003F,
+ 0x003F00,
+ 0x003F3F,
0x3F0000,
0x3F003F,
0x3F3F00,
@@ -322,9 +322,9 @@
for (i = 0; i < 16; i++) SetPaletteEntry(i, PaletteEntry[i]);
}
-VOID
-NTAPI
-VgaScroll(ULONG Scroll)
+static VOID
+NTAPI
+VgaScroll(IN ULONG Scroll)
{
ULONG Top, RowSize;
PUCHAR OldPosition, NewPosition;
@@ -341,11 +341,11 @@
RowSize = (ScrollRegion[2] - ScrollRegion[0] + 1) / 8;
/* Calculate the position in memory for the row */
- OldPosition = (PUCHAR)VgaBase + (ScrollRegion[1] + Scroll) * 80 + ScrollRegion[0] /
8;
- NewPosition = (PUCHAR)VgaBase + ScrollRegion[1] * 80 + ScrollRegion[0] / 8;
+ OldPosition = (PUCHAR)(VgaBase + (ScrollRegion[1] + Scroll) * 80 + ScrollRegion[0] /
8);
+ NewPosition = (PUCHAR)(VgaBase + ScrollRegion[1] * 80 + ScrollRegion[0] / 8);
/* Start loop */
- for(Top = ScrollRegion[1]; Top <= ScrollRegion[3]; ++Top)
+ for (Top = ScrollRegion[1]; Top <= ScrollRegion[3]; ++Top)
{
#if defined(_M_IX86) || defined(_M_AMD64)
__movsb(NewPosition, OldPosition, RowSize);
@@ -353,7 +353,7 @@
ULONG i;
/* Scroll the row */
- for(i = 0; i < RowSize; ++i)
+ for (i = 0; i < RowSize; ++i)
WRITE_REGISTER_UCHAR(NewPosition + i, READ_REGISTER_UCHAR(OldPosition + i));
#endif
OldPosition += 80;
@@ -361,7 +361,7 @@
}
}
-VOID
+static VOID
NTAPI
PreserveRow(IN ULONG CurrentTop,
IN ULONG TopDelta,
@@ -383,36 +383,35 @@
if (Direction)
{
/* Calculate the position in memory for the row */
- Position1 = (PUCHAR)VgaBase + CurrentTop * 80;
- Position2 = (PUCHAR)VgaBase + 0x9600;
+ Position1 = (PUCHAR)(VgaBase + CurrentTop * 80);
+ Position2 = (PUCHAR)(VgaBase + 0x9600);
}
else
{
/* Calculate the position in memory for the row */
- Position1 = (PUCHAR)VgaBase + 0x9600;
- Position2 = (PUCHAR)VgaBase + CurrentTop * 80;
- }
-
- /* Set the count and make sure it's above 0 */
+ Position1 = (PUCHAR)(VgaBase + 0x9600);
+ Position2 = (PUCHAR)(VgaBase + CurrentTop * 80);
+ }
+
+ /* Set the count and loop every pixel */
Count = TopDelta * 80;
#if defined(_M_IX86) || defined(_M_AMD64)
__movsb(Position1, Position2, Count);
#else
- /* Loop every pixel */
while (Count--)
{
/* Write the data back on the other position */
WRITE_REGISTER_UCHAR(Position1, READ_REGISTER_UCHAR(Position2));
/* Increase both positions */
+ Position1++;
Position2++;
- Position1++;
}
#endif
}
-VOID
+static VOID
NTAPI
BitBlt(IN ULONG Left,
IN ULONG Top,
@@ -479,7 +478,7 @@
} while (dy < Bottom);
}
-VOID
+static VOID
NTAPI
RleBitBlt(IN ULONG Left,
IN ULONG Top,
@@ -577,22 +576,24 @@
{
/* Case 0 */
case 0:
-
+ {
/* Set new x value, decrease distance and restart */
x = Left;
YDelta--;
Buffer++;
continue;
+ }
/* Case 1 */
case 1:
-
+ {
/* Done */
return;
+ }
/* Case 2 */
case 2:
-
+ {
/* Set new x value, decrease distance and restart */
Buffer++;
x += *Buffer;
@@ -600,12 +601,14 @@
YDelta -= *Buffer;
Buffer++;
continue;
+ }
/* Other values */
default:
-
+ {
Buffer++;
break;
+ }
}
/* Check if we've gone past the edge */
@@ -684,7 +687,7 @@
*/
ULONG
NTAPI
-VidSetTextColor(ULONG Color)
+VidSetTextColor(IN ULONG Color)
{
ULONG OldColor;
@@ -699,16 +702,18 @@
*/
VOID
NTAPI
-VidDisplayStringXY(PUCHAR String,
- ULONG Left,
- ULONG Top,
- BOOLEAN Transparent)
+VidDisplayStringXY(IN PUCHAR String,
+ IN ULONG Left,
+ IN ULONG Top,
+ IN BOOLEAN Transparent)
{
ULONG BackColor;
- /* If the caller wanted transparent, then send the special value (16), else */
- /* use our default and call the helper routine. */
- BackColor = (Transparent) ? 16 : 14;
+ /*
+ * If the caller wanted transparent, then send the special value (16),
+ * else use our default and call the helper routine.
+ */
+ BackColor = Transparent ? 16 : 14;
DisplayStringXY(String, Left, Top, 12, BackColor);
}
@@ -717,24 +722,24 @@
*/
VOID
NTAPI
-VidSetScrollRegion(ULONG x1,
- ULONG y1,
- ULONG x2,
- ULONG y2)
+VidSetScrollRegion(IN ULONG Left,
+ IN ULONG Top,
+ IN ULONG Right,
+ IN ULONG Bottom)
{
/* Assert alignment */
- ASSERT((x1 & 0x7) == 0);
- ASSERT((x2 & 0x7) == 7);
+ ASSERT((Left & 0x7) == 0);
+ ASSERT((Right & 0x7) == 7);
/* Set Scroll Region */
- ScrollRegion[0] = x1;
- ScrollRegion[1] = y1;
- ScrollRegion[2] = x2;
- ScrollRegion[3] = y2;
+ ScrollRegion[0] = Left;
+ ScrollRegion[1] = Top;
+ ScrollRegion[2] = Right;
+ ScrollRegion[3] = Bottom;
/* Set current X and Y */
- curr_x = x1;
- curr_y = y1;
+ curr_x = Left;
+ curr_y = Top;
}
/*
@@ -764,7 +769,7 @@
IN ULONG Delta)
{
/* Make sure we have a width and height */
- if (!(Width) || !(Height)) return;
+ if (!Width || !Height) return;
/* Call the helper function */
BitBlt(Left, Top, Width, Height, Buffer, 4, Delta);
@@ -775,7 +780,7 @@
*/
VOID
NTAPI
-VidDisplayString(PUCHAR String)
+VidDisplayString(IN PUCHAR String)
{
ULONG TopDelta = BOOTCHAR_HEIGHT + 1;
@@ -859,9 +864,9 @@
*/
VOID
NTAPI
-VidBitBlt(PUCHAR Buffer,
- ULONG Left,
- ULONG Top)
+VidBitBlt(IN PUCHAR Buffer,
+ IN ULONG Left,
+ IN ULONG Top)
{
PBITMAPINFOHEADER BitmapInfoHeader;
LONG Delta;
@@ -878,15 +883,17 @@
/* Make sure we can support this bitmap */
ASSERT((BitmapInfoHeader->biBitCount * BitmapInfoHeader->biPlanes) <= 4);
- /* Calculate the delta and align it on 32-bytes, then calculate the actual */
- /* start of the bitmap data. */
+ /*
+ * Calculate the delta and align it on 32-bytes, then calculate
+ * the actual start of the bitmap data.
+ */
Delta = (BitmapInfoHeader->biBitCount * BitmapInfoHeader->biWidth) + 31;
Delta >>= 3;
Delta &= ~3;
BitmapOffset = Buffer + sizeof(BITMAPINFOHEADER) + 16 * sizeof(ULONG);
/* Check the compression of the bitmap */
- if (BitmapInfoHeader->biCompression == 2)
+ if (BitmapInfoHeader->biCompression == BI_RLE4)
{
/* Make sure we have a width and a height */
if ((BitmapInfoHeader->biWidth) && (BitmapInfoHeader->biHeight))
@@ -910,7 +917,7 @@
else
{
/* Update buffer offset */
- BitmapOffset += ((BitmapInfoHeader->biHeight -1) * Delta);
+ BitmapOffset += ((BitmapInfoHeader->biHeight - 1) * Delta);
Delta *= -1;
}
@@ -934,12 +941,12 @@
*/
VOID
NTAPI
-VidScreenToBufferBlt(PUCHAR Buffer,
- ULONG Left,
- ULONG Top,
- ULONG Width,
- ULONG Height,
- ULONG Delta)
+VidScreenToBufferBlt(IN PUCHAR Buffer,
+ IN ULONG Left,
+ IN ULONG Top,
+ IN ULONG Width,
+ IN ULONG Height,
+ IN ULONG Delta)
{
ULONG Plane;
ULONG XDistance;
@@ -974,7 +981,7 @@
do
{
/* Set the current pixel position and reset buffer loop variable */
- PixelPosition = (PUCHAR)VgaBase + PixelOffset;
+ PixelPosition = (PUCHAR)(VgaBase + PixelOffset);
i = Buffer;
/* Set Mode 0 */
@@ -1073,7 +1080,7 @@
__outpw(0x3CE, 7);
/* Calculate pixel position for the read */
- Offset = VgaBase + (Top * 80) + (PUCHAR)(ULONG_PTR)LeftOffset;
+ Offset = (PUCHAR)(VgaBase + (Top * 80) + LeftOffset);
/* Select the bitmask register and write the mask */
__outpw(0x3CE, (USHORT)lMask);
@@ -1097,7 +1104,7 @@
if (Distance)
{
/* Calculate new pixel position */
- Offset = VgaBase + (Top * 80) + (PUCHAR)(ULONG_PTR)RightOffset;
+ Offset = (PUCHAR)(VgaBase + (Top * 80) + RightOffset);
Distance--;
/* Select the bitmask register and write the mask */
@@ -1123,7 +1130,7 @@
if (Distance)
{
/* Calculate new pixel position */
- Offset = VgaBase + (Top * 80) + (PUCHAR)(ULONG_PTR)(LeftOffset + 1);
+ Offset = (PUCHAR)(VgaBase + (Top * 80) + LeftOffset + 1);
/* Set the bitmask to 0xFF for all 4 planes */
__outpw(0x3CE, 0xFF08);
Modified: trunk/reactos/drivers/base/bootvid/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/bootvid/preco…
==============================================================================
--- trunk/reactos/drivers/base/bootvid/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/bootvid/precomp.h [iso-8859-1] Sun Aug 31 23:00:29 2014
@@ -31,11 +31,13 @@
ULONG biClrImportant;
} BITMAPINFOHEADER, *PBITMAPINFOHEADER;
+/* Supported bitmap compression formats */
+#define BI_RGB 0
+#define BI_RLE4 2
+
VOID
NTAPI
-InitializePalette(
- VOID
-);
+InitializePalette(VOID);
/* Globals */
extern USHORT AT_Initialization[];
Modified: trunk/reactos/include/ndk/inbvfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/inbvfuncs.h?re…
==============================================================================
--- trunk/reactos/include/ndk/inbvfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/inbvfuncs.h [iso-8859-1] Sun Aug 31 23:00:29 2014
@@ -94,8 +94,8 @@
InbvSetScrollRegion(
_In_ ULONG Left,
_In_ ULONG Top,
- _In_ ULONG Width,
- _In_ ULONG Height
+ _In_ ULONG Right,
+ _In_ ULONG Bottom
);
VOID
@@ -109,8 +109,8 @@
InbvSolidColorFill(
_In_ ULONG Left,
_In_ ULONG Top,
- _In_ ULONG Width,
- _In_ ULONG Height,
+ _In_ ULONG Right,
+ _In_ ULONG Bottom,
_In_ ULONG Color
);
Modified: trunk/reactos/include/reactos/drivers/bootvid/bootvid.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/drivers/bo…
==============================================================================
--- trunk/reactos/include/reactos/drivers/bootvid/bootvid.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/drivers/bootvid/bootvid.h [iso-8859-1] Sun Aug 31
23:00:29 2014
@@ -11,22 +11,21 @@
ULONG
NTAPI
-VidSetTextColor(ULONG Color);
+VidSetTextColor(IN ULONG Color);
VOID
NTAPI
-VidDisplayStringXY(PUCHAR String,
- ULONG Left,
- ULONG Top,
- BOOLEAN Transparent);
+VidDisplayStringXY(IN PUCHAR String,
+ IN ULONG Left,
+ IN ULONG Top,
+ IN BOOLEAN Transparent);
VOID
NTAPI
-VidSetScrollRegion(ULONG x1,
- ULONG y1,
- ULONG x2,
- ULONG y2);
-
+VidSetScrollRegion(IN ULONG Left,
+ IN ULONG Top,
+ IN ULONG Right,
+ IN ULONG Bottom);
VOID
NTAPI
@@ -43,22 +42,22 @@
VOID
NTAPI
-VidDisplayString(PUCHAR String);
+VidDisplayString(IN PUCHAR String);
VOID
NTAPI
-VidBitBlt(PUCHAR Buffer,
- ULONG Left,
- ULONG Top);
+VidBitBlt(IN PUCHAR Buffer,
+ IN ULONG Left,
+ IN ULONG Top);
VOID
NTAPI
-VidScreenToBufferBlt(PUCHAR Buffer,
- ULONG Left,
- ULONG Top,
- ULONG Width,
- ULONG Height,
- ULONG Delta);
+VidScreenToBufferBlt(IN PUCHAR Buffer,
+ IN ULONG Left,
+ IN ULONG Top,
+ IN ULONG Width,
+ IN ULONG Height,
+ IN ULONG Delta);
VOID
NTAPI
Modified: trunk/reactos/ntoskrnl/inbv/inbv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/inbv/inbv.c?rev=6…
==============================================================================
--- trunk/reactos/ntoskrnl/inbv/inbv.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/inbv/inbv.c [iso-8859-1] Sun Aug 31 23:00:29 2014
@@ -363,7 +363,7 @@
InbvAcquireLock();
/* Make sure we're installed and display the string */
- if (InbvBootDriverInstalled) VidDisplayString((PUCHAR) String);
+ if (InbvBootDriverInstalled) VidDisplayString((PUCHAR)String);
/* Print the string on the EMS port */
HeadlessDispatch(HeadlessCmdPutString,
@@ -462,11 +462,11 @@
NTAPI
InbvSetScrollRegion(IN ULONG Left,
IN ULONG Top,
- IN ULONG Width,
- IN ULONG Height)
+ IN ULONG Right,
+ IN ULONG Bottom)
{
/* Just call bootvid */
- VidSetScrollRegion(Left, Top, Width, Height);
+ VidSetScrollRegion(Left, Top, Right, Bottom);
}
VOID
@@ -483,8 +483,8 @@
NTAPI
InbvSolidColorFill(IN ULONG Left,
IN ULONG Top,
- IN ULONG Width,
- IN ULONG Height,
+ IN ULONG Right,
+ IN ULONG Bottom,
IN ULONG Color)
{
/* Make sure we own it */
@@ -497,7 +497,7 @@
if (InbvBootDriverInstalled)
{
/* Call bootvid */
- VidSolidColorFill(Left, Top, Width, Height, (UCHAR)Color);
+ VidSolidColorFill(Left, Top, Right, Bottom, (UCHAR)Color);
}
/* FIXME: Headless */