Sync with trunk head (part 1 or 2)
[reactos.git] / boot / armllb / fw.c
1 /*
2 * PROJECT: ReactOS Boot Loader
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: boot/armllb/fw.c
5 * PURPOSE: LLB Firmware Routines (accessible by OS Loader)
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9 #include "precomp.h"
10
11 USHORT ColorPalette[16][3] =
12 {
13 {0x00, 0x00, 0x00},
14 {0x00, 0x00, 0xAA},
15 {0x00, 0xAA, 0x00},
16 {0x00, 0xAA, 0xAA},
17 {0xAA, 0x00, 0x00},
18 {0xAA, 0x00, 0xAA},
19 {0xAA, 0x55, 0x00},
20 {0xAA, 0xAA, 0xAA},
21 {0x55, 0x55, 0x55},
22 {0x55, 0x55, 0xFF},
23 {0x55, 0xFF, 0x55},
24 {0x55, 0xFF, 0xFF},
25 {0xFF, 0x55, 0x55},
26 {0xFF, 0x55, 0xFF},
27 {0xFF, 0xFF, 0x55},
28 {0xFF, 0xFF, 0xFF},
29 };
30
31 VOID
32 LlbFwPutChar(INT Ch)
33 {
34 /* Just call directly the video function */
35 LlbVideoPutChar(Ch);
36
37 /* DEBUG ONLY */
38 LlbSerialPutChar(Ch);
39 }
40
41 BOOLEAN
42 LlbFwKbHit(VOID)
43 {
44 /* Check RX buffer */
45 return LlbHwKbdReady();
46 }
47
48 INT
49 LlbFwGetCh(VOID)
50 {
51 /* Return the key pressed */
52 return LlbKeyboardGetChar();
53 }
54
55 ULONG
56 LlbFwVideoSetDisplayMode(IN PCHAR DisplayModeName,
57 IN BOOLEAN Init)
58 {
59 /* Return text mode */
60 return 0;
61 }
62
63 VOID
64 LlbFwVideoGetDisplaySize(OUT PULONG Width,
65 OUT PULONG Height,
66 OUT PULONG Depth)
67 {
68 /* Query static settings */
69 *Width = LlbHwGetScreenWidth() / 8;
70 *Height = LlbHwGetScreenHeight() / 16;
71
72 /* Depth is always 16 bpp */
73 *Depth = 16;
74 }
75
76 VOID
77 LlbFwVideoClearScreen(IN UCHAR Attr)
78 {
79 /* Clear the screen */
80 LlbVideoClearScreen(TRUE);
81 }
82
83 VOID
84 LlbFwVideoPutChar(IN INT c,
85 IN UCHAR Attr,
86 IN ULONG X,
87 IN ULONG Y)
88 {
89 ULONG Color, BackColor;
90 PUSHORT Buffer;
91
92 /* Convert EGA index to color used by hardware */
93 Color = LlbHwVideoCreateColor(ColorPalette[Attr & 0xF][0],
94 ColorPalette[Attr & 0xF][1],
95 ColorPalette[Attr & 0xF][2]);
96 BackColor = LlbHwVideoCreateColor(ColorPalette[Attr >> 4][0],
97 ColorPalette[Attr >> 4][1],
98 ColorPalette[Attr >> 4][2]);
99
100 /* Compute buffer address */
101 Buffer = (PUSHORT)LlbHwGetFrameBuffer() + (LlbHwGetScreenWidth() * (Y * 16)) + (X * 8);
102
103 /* Draw it */
104 LlbVideoDrawChar(c, Buffer, Color, BackColor);
105 }
106
107
108 TIMEINFO*
109 LlbFwGetTime(VOID)
110 {
111 /* Call existing function */
112 return LlbGetTime();
113 }
114
115 /* EOF */