ReactOS 0.4.15-dev-7834-g00c4b3d
bootvid.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Boot Video Driver for ARM devices
3 * LICENSE: BSD - See COPYING.ARM in root directory
4 * PURPOSE: Main file
5 * COPYRIGHT: Copyright 2008 ReactOS Portable Systems Group <ros.arm@reactos.org>
6 */
7
8#include "precomp.h"
9
10#define NDEBUG
11#include <debug.h>
12
15
16/* PRIVATE FUNCTIONS *********************************************************/
17
18VOID
20 _In_ CHAR Character,
21 _In_ ULONG Left,
23 _In_ ULONG TextColor,
24 _In_ ULONG BackColor)
25{
26 PUCHAR FontChar;
27 ULONG i, j, XOffset;
28
29 /* Get the font line for this character */
30 FontChar = &VidpFontData[Character * BOOTCHAR_HEIGHT - Top];
31
32 /* Loop each pixel height */
33 for (i = BOOTCHAR_HEIGHT; i > 0; --i)
34 {
35 /* Loop each pixel width */
36 XOffset = Left;
37 for (j = (1 << 7); j > 0; j >>= 1)
38 {
39 /* Check if we should draw this pixel */
40 if (FontChar[Top] & (UCHAR)j)
41 {
42 /* We do, use the given Text Color */
43 SetPixel(XOffset, Top, (UCHAR)TextColor);
44 }
45 else if (BackColor < BV_COLOR_NONE)
46 {
47 /*
48 * This is a background pixel. We're drawing it
49 * unless it's transparent.
50 */
51 SetPixel(XOffset, Top, (UCHAR)BackColor);
52 }
53
54 /* Increase X Offset */
55 XOffset++;
56 }
57
58 /* Move to the next Y ordinate */
59 Top++;
60 }
61}
62
63VOID
65 _In_ ULONG Scroll)
66{
68 PUSHORT SourceOffset, DestOffset;
69 PUSHORT i, j;
70
71 /* Set memory positions of the scroll */
73 DestOffset = &SourceOffset[Scroll * (SCREEN_WIDTH / 8)];
74
75 /* Start loop */
76 for (Top = VidpScrollRegion[1]; Top <= VidpScrollRegion[3]; ++Top)
77 {
78 /* Set number of bytes to loop and start offset */
79 Offset = VidpScrollRegion[0] >> 3;
81
82 /* Check if this is part of the scroll region */
83 if (Offset <= (VidpScrollRegion[2] >> 3))
84 {
85 /* Update position */
86 i = (PUSHORT)(DestOffset - SourceOffset);
87
88 /* Loop the X axis */
89 do
90 {
91 /* Write value in the new position so that we can do the scroll */
93
94 /* Move to the next memory location to write to */
95 j++;
96
97 /* Move to the next byte in the region */
98 Offset++;
99
100 /* Make sure we don't go past the scroll region */
101 } while (Offset <= (VidpScrollRegion[2] >> 3));
102 }
103
104 /* Move to the next line */
105 SourceOffset += (SCREEN_WIDTH / 8);
106 DestOffset += (SCREEN_WIDTH / 8);
107 }
108}
109
110VOID
112 _In_ ULONG CurrentTop,
113 _In_ ULONG TopDelta,
114 _In_ BOOLEAN Restore)
115{
116 PUSHORT Position1, Position2;
117 ULONG Count;
118
119 /* Calculate the position in memory for the row */
120 if (Restore)
121 {
122 /* Restore the row by copying back the contents saved off-screen */
123 Position1 = &VgaArmBase[CurrentTop * (SCREEN_WIDTH / 8)];
124 Position2 = &VgaArmBase[SCREEN_HEIGHT * (SCREEN_WIDTH / 8)];
125 }
126 else
127 {
128 /* Preserve the row by saving its contents off-screen */
129 Position1 = &VgaArmBase[SCREEN_HEIGHT * (SCREEN_WIDTH / 8)];
130 Position2 = &VgaArmBase[CurrentTop * (SCREEN_WIDTH / 8)];
131 }
132
133 /* Set the count and loop every pixel */
134 Count = TopDelta * (SCREEN_WIDTH / 8);
135 while (Count--)
136 {
137 /* Write the data back on the other position */
138 WRITE_REGISTER_USHORT(Position1, READ_REGISTER_USHORT(Position2));
139
140 /* Increase both positions */
141 Position1++;
142 Position2++;
143 }
144}
145
146VOID
148{
149 //
150 // Set framebuffer address
151 //
154
155 //
156 // Initialize timings to 640x480
157 //
160
161 //
162 // Enable the LCD Display
163 //
169}
170
171VOID
175{
177}
178
179/* PUBLIC FUNCTIONS **********************************************************/
180
182NTAPI
184 _In_ BOOLEAN SetMode)
185{
186 DPRINT1("bv-arm v0.1\n");
187
188 //
189 // Allocate framebuffer
190 // 600kb works out to 640x480@16bpp
191 //
194 if (!VgaArmBase) return FALSE;
195
196 //
197 // Get physical address
198 //
200 if (!VgaPhysical.QuadPart) return FALSE;
201 DPRINT1("[BV-ARM] Frame Buffer @ 0x%p 0p%p\n", VgaArmBase, VgaPhysical.LowPart);
202
203 //
204 // Setup the display
205 //
207
208 //
209 // We are done!
210 //
211 return TRUE;
212}
213
214VOID
215NTAPI
217 _In_ BOOLEAN HalReset)
218{
219 //
220 // Clear the current position
221 //
222 VidpCurrentX = 0;
223 VidpCurrentY = 0;
224
225 //
226 // Re-initialize the VGA Display
227 //
229
230 //
231 // Re-initialize the palette and fill the screen black
232 //
235}
236
237VOID
238NTAPI
240{
242 while (TRUE);
243}
244
245VOID
246NTAPI
249 _In_ ULONG Left,
250 _In_ ULONG Top,
254{
256 while (TRUE);
257}
258
259VOID
260NTAPI
262 _In_ ULONG Left,
263 _In_ ULONG Top,
264 _In_ ULONG Right,
267{
268 int y, x;
269
270 //
271 // Loop along the Y-axis
272 //
273 for (y = Top; y <= Bottom; y++)
274 {
275 //
276 // Loop along the X-axis
277 //
278 for (x = Left; x <= Right; x++)
279 {
280 //
281 // Draw the pixel
282 //
283 SetPixel(x, y, Color);
284 }
285 }
286}
unsigned char BOOLEAN
VOID PreserveRow(_In_ ULONG CurrentTop, _In_ ULONG TopDelta, _In_ BOOLEAN Restore)
Definition: bootvid.c:111
VOID NTAPI VidScreenToBufferBlt(_Out_writes_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_ ULONG Delta)
Definition: bootvid.c:247
VOID NTAPI VidSolidColorFill(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ UCHAR Color)
Definition: bootvid.c:261
VOID NTAPI VidCleanUp(VOID)
Definition: bootvid.c:239
VOID NTAPI VidResetDisplay(_In_ BOOLEAN HalReset)
Definition: bootvid.c:216
PHYSICAL_ADDRESS VgaPhysical
Definition: bootvid.c:14
VOID DisplayCharacter(_In_ CHAR Character, _In_ ULONG Left, _In_ ULONG Top, _In_ ULONG TextColor, _In_ ULONG BackColor)
Definition: bootvid.c:19
VOID DoScroll(_In_ ULONG Scroll)
Definition: bootvid.c:64
VOID InitPaletteWithTable(_In_ PULONG Table, _In_ ULONG Count)
Definition: bootvid.c:172
VOID VidpInitializeDisplay(VOID)
Definition: bootvid.c:147
BOOLEAN NTAPI VidInitialize(_In_ BOOLEAN SetMode)
Definition: bootvid.c:183
PUSHORT VgaArmBase
Definition: bootvid.c:13
#define WRITE_REGISTER_USHORT(r, v)
Definition: arm.h:30
#define READ_REGISTER_USHORT(r)
Definition: arm.h:29
FORCEINLINE VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: arm.h:55
#define WRITE_REGISTER_ULONG(r, v)
Definition: arm.h:27
#define DPRINT1
Definition: precomp.h:8
static LPHIST_ENTRY Bottom
Definition: history.c:54
static LPHIST_ENTRY Top
Definition: history.c:53
#define UNIMPLEMENTED
Definition: debug.h:115
Definition: bufpool.h:45
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
Definition: contmem.c:626
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ULONG VidpCurrentY
Definition: common.c:17
ULONG VidpCurrentX
Definition: common.c:16
ULONG VidpScrollRegion[4]
Definition: common.c:19
#define BOOTCHAR_HEIGHT
Definition: precomp.h:36
#define InitializePalette()
Definition: precomp.h:77
UCHAR VidpFontData[256 *BOOTCHAR_HEIGHT]
Definition: fontdata.c:16
ASMGENDATA Table[]
Definition: genincdata.c:61
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define PL110_LCDCONTROL
Definition: hwclcd.c:23
#define LCDCONTROL_LCDBPP(x)
Definition: hwclcd.c:15
#define PL110_LCDTIMING1
Definition: hwclcd.c:19
#define PL110_LCDUPBASE
Definition: hwclcd.c:21
#define PL110_LCDTIMING0
Definition: hwclcd.c:18
#define LCDTIMING0_PPL(x)
Definition: hwclcd.c:11
#define LCDCONTROL_LCDPWR
Definition: hwclcd.c:13
#define LCDCONTROL_LCDEN
Definition: hwclcd.c:14
#define LCDCONTROL_LCDTFT
Definition: hwclcd.c:16
#define LCDTIMING1_LPP(x)
Definition: hwclcd.c:12
#define PL110_LCDLPBASE
Definition: hwclcd.c:22
#define _Out_writes_bytes_(size)
Definition: ms_sal.h:350
#define _In_
Definition: ms_sal.h:308
int Count
Definition: noreturn.cpp:7
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:685
#define SCREEN_WIDTH
Definition: pc98video.c:27
#define SCREEN_HEIGHT
Definition: pc98video.c:28
#define BV_COLOR_NONE
Definition: display.h:31
#define BV_COLOR_BLACK
Definition: display.h:15
uint32_t * PULONG
Definition: typedefs.h:59
#define NTAPI
Definition: typedefs.h:36
uint16_t * PUSHORT
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
_Must_inspect_result_ _In_ WDFMEMORY _In_ size_t SourceOffset
Definition: wdfmemory.h:320
static ULONG Delta
Definition: xboxvideo.c:33
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175