- Add GetTime stub, bump version to 1.4.
authorevb <evb@svn.reactos.org>
Thu, 4 Feb 2010 06:44:06 +0000 (06:44 +0000)
committerevb <evb@svn.reactos.org>
Thu, 4 Feb 2010 06:44:06 +0000 (06:44 +0000)
- Implement function for drawing character on the screen when request come from firmware.
- Tui.c assumes all screens are x86 VGA Consoles with 8-bit character and 8-bit attribute. On ARM, call Mach function to draw character instead of drawing into ScreenMemory off-screen buffer.
- FreeLDR menu now appears, need GetTime for counter.

svn path=/trunk/; revision=45413

reactos/boot/armllb/fw.c
reactos/boot/armllb/hw/video.c
reactos/boot/armllb/inc/fw.h
reactos/boot/armllb/inc/osloader.h
reactos/boot/armllb/inc/video.h
reactos/boot/armllb/os/loader.c
reactos/boot/freeldr/freeldr/arch/arm/macharm.c
reactos/boot/freeldr/freeldr/ui/tui.c

index 884d0f8..94350fa 100644 (file)
@@ -75,11 +75,31 @@ LlbFwVideoHideShowTextCursor(IN BOOLEAN Show)
     return;
 }
 
+USHORT ColorPalette[16][3] =
+{
+    {0x00, 0x00, 0x00},
+    {0x00, 0x00, 0xAA},
+    {0x00, 0xAA, 0x00},
+    {0x00, 0xAA, 0xAA},
+    {0xAA, 0x00, 0x00},
+    {0xAA, 0x00, 0xAA},
+    {0xAA, 0x55, 0x00},
+    {0xAA, 0xAA, 0xAA},
+    {0x55, 0x55, 0x55},
+    {0x55, 0x55, 0xFF},
+    {0x55, 0xFF, 0x55},
+    {0x55, 0xFF, 0xFF},
+    {0xFF, 0x55, 0x55},
+    {0xFF, 0x55, 0xFF},
+    {0xFF, 0xFF, 0x55},
+    {0xFF, 0xFF, 0xFF},
+};
+
 VOID
 LlbFwVideoCopyOffScreenBufferToVRAM(IN PVOID Buffer)
 {
-    printf("%s is UNIMPLEMENTED", __FUNCTION__);
-    while (TRUE);
+    /* No double-buffer is used on ARM */
+    return;
 }
 
 VOID
@@ -95,8 +115,22 @@ LlbFwVideoPutChar(IN INT c,
                   IN ULONG X,
                   IN ULONG Y)
 {
-    printf("%s is UNIMPLEMENTED", __FUNCTION__);
-    while (TRUE);
+    ULONG Color, BackColor;
+    PUSHORT Buffer;
+    
+    /* Convert EGA index to color used by hardware */
+    Color = LlbHwVideoCreateColor(ColorPalette[Attr & 0xF][0],
+                                  ColorPalette[Attr & 0xF][1],
+                                  ColorPalette[Attr & 0xF][2]);
+    BackColor = LlbHwVideoCreateColor(ColorPalette[Attr >> 4][0],
+                                      ColorPalette[Attr >> 4][1],
+                                      ColorPalette[Attr >> 4][2]);
+                                      
+    /* Compute buffer address */
+    Buffer = (PUSHORT)LlbHwGetFrameBuffer() + (LlbHwGetScreenWidth() * (Y * 8)) + (X * 8);
+                                      
+    /* Draw it */
+    LlbVideoDrawChar(c, Buffer, Color, BackColor);
 }
 
 BOOLEAN
@@ -137,4 +171,12 @@ LlbFwVideoSync(VOID)
     return;
 }
 
+VOID
+LlbFwGetTime(VOID)
+{
+    printf("%s is UNIMPLEMENTED", __FUNCTION__);
+    while (TRUE);
+    return;   
+}
+
 /* EOF */
index 10f2802..174c30e 100644 (file)
@@ -268,51 +268,22 @@ CHAR LlbHwBootFont[] =
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 };
 
-#if 0
-USHORT ColorPalette[16] =
-{
-    RGB565(0x00, 0x00, 0x00),
-    RGB565(0x00, 0x00, 0xAA),
-    RGB565(0x00, 0xAA, 0x00),
-    RGB565(0x00, 0xAA, 0xAA),
-    RGB565(0xAA, 0x00, 0x00),
-    RGB565(0xAA, 0x00, 0xAA),
-    RGB565(0xAA, 0x55, 0x00),
-    RGB565(0xAA, 0xAA, 0xAA),
-    RGB565(0x55, 0x55, 0x55),
-    RGB565(0x55, 0x55, 0xFF),
-    RGB565(0x55, 0xFF, 0x55),
-    RGB565(0x55, 0xFF, 0xFF),
-    RGB565(0xFF, 0x55, 0x55),
-    RGB565(0xFF, 0x55, 0xFF),
-    RGB565(0xFF, 0xFF, 0x55),
-    RGB565(0xFF, 0xFF, 0xFF),
-};
-#endif
-
 ULONG ScreenCursor;
 
 VOID
 NTAPI
 LlbVideoDrawChar(IN CHAR c,
-                 IN ULONG cx,
-                 IN ULONG cy,
+                 IN PUSHORT Buffer,
                  IN USHORT Color,
                  IN USHORT BackColor)
 {
-    PUSHORT Buffer;
     PCHAR Pixels;
     CHAR Line;
     ULONG y, ScreenWidth;
     LONG x;
-    PUSHORT VideoBuffer;
-    
-    /* Get screen width and frame buffer */
-    ScreenWidth = LlbHwGetScreenWidth();
-    VideoBuffer = LlbHwGetFrameBuffer();
 
-    /* Compute starting address on-screen and in the character-array */
-    Buffer = VideoBuffer + ScreenWidth * cy + cx;
+    /* Get screen width */
+    ScreenWidth = LlbHwGetScreenWidth();
     Pixels = LlbHwBootFont + c * 8;
 
     /* Loop y pixels */
@@ -371,13 +342,14 @@ VOID
 NTAPI
 LlbVideoPutChar(IN CHAR c)
 {
-    ULONG cx, cy, CharsPerLine, BackColor;
+    ULONG cx, cy, CharsPerLine, BackColor, ScreenWidth;
     
     /* Forecolor on this machine */
     BackColor = LlbHwVideoCreateColor(14, 0, 82);
     
     /* Amount of characters in a line */
-    CharsPerLine = LlbHwGetScreenWidth() / 8;
+    ScreenWidth = LlbHwGetScreenWidth();
+    CharsPerLine = ScreenWidth / 8;
 
     /* Handle new line and scrolling */
     if (c == '\n')
@@ -394,7 +366,10 @@ LlbVideoPutChar(IN CHAR c)
         cx = (ScreenCursor % CharsPerLine) * 8;
 
         /* Draw the character and increment the cursor */
-        LlbVideoDrawChar(c, cx, cy, 0xFFFF, BackColor);
+        LlbVideoDrawChar(c,
+                         (PUSHORT)LlbHwGetFrameBuffer() + ScreenWidth * cy + cx,
+                         0xFFFF,
+                         BackColor);
         ScreenCursor++;
     }
 }
index fb1404e..3c44c2d 100755 (executable)
@@ -94,4 +94,9 @@ LlbFwVideoSync(
     VOID
 );
 
+VOID
+LlbFwGetTime(
+    VOID
+);
+
 /* EOF */
index 133dafb..6251bb1 100644 (file)
@@ -42,7 +42,7 @@ typedef struct
 // Information sent from LLB to OS Loader
 //
 #define ARM_BOARD_CONFIGURATION_MAJOR_VERSION 1
-#define ARM_BOARD_CONFIGURATION_MINOR_VERSION 3
+#define ARM_BOARD_CONFIGURATION_MINOR_VERSION 4
 typedef struct _ARM_BOARD_CONFIGURATION_BLOCK
 {
     ULONG MajorVersion;
@@ -69,6 +69,7 @@ typedef struct _ARM_BOARD_CONFIGURATION_BLOCK
     PVOID VideoSetPaletteColor;
     PVOID VideoGetPaletteColor;
     PVOID VideoSync;
+    PVOID GetTime;
 } ARM_BOARD_CONFIGURATION_BLOCK, *PARM_BOARD_CONFIGURATION_BLOCK;
 
 VOID
index 416f6ee..0e67123 100755 (executable)
@@ -18,4 +18,13 @@ LlbVideoPutChar(
     IN CHAR c
 );
 
+VOID
+NTAPI
+LlbVideoDrawChar(
+    IN CHAR c,
+    IN PUSHORT Buffer,
+    IN USHORT Color,
+    IN USHORT BackColor
+);
+                 
 /* EOF */
index 7c705ca..d7f7e90 100755 (executable)
@@ -86,6 +86,7 @@ LlbBuildArmBlock(VOID)
     ArmBlock.VideoSetPaletteColor = LlbFwVideoSetPaletteColor;
     ArmBlock.VideoGetPaletteColor = LlbFwVideoGetPaletteColor;
     ArmBlock.VideoSync = LlbFwVideoSync;
+    ArmBlock.GetTime = LlbFwGetTime;
 }
 
 VOID
index 1450595..006a299 100644 (file)
@@ -171,6 +171,7 @@ MachInit(IN PCCH CommandLine)
             MachVtbl.VideoSetPaletteColor = ArmBoardBlock->VideoSetPaletteColor;
             MachVtbl.VideoGetPaletteColor = ArmBoardBlock->VideoGetPaletteColor;
             MachVtbl.VideoSync = ArmBoardBlock->VideoSync;
+            MachVtbl.GetTime = ArmBoardBlock->GetTime;
                         
             /* Setup the disk and file system buffers */
             gDiskReadBuffer = 0x00090000;
index 726eb80..d0016f4 100644 (file)
@@ -325,8 +325,13 @@ VOID TuiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr)
        // Draw the text
        for (i=X, j=0; Text[j]  && i<UiScreenWidth; i++,j++)
        {
+#ifndef _ARM_
                ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)] = (UCHAR)Text[j];
                ScreenMemory[((Y*2)*UiScreenWidth)+(i*2)+1] = Attr;
+#else
+        UNREFERENCED_PARAMETER(ScreenMemory);
+        MachVideoPutChar(Text[j], Attr, i, Y);
+#endif
        }
 }